code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
async isVisible() { const { x, y } = await (await this.rootElement.$('div[role="option"]')).getLocation(); const { width, height } = await (await this.rootElement.$('div[role="option"]')).getSize(); return ( (await this.rootElement.isDisplayedInViewport()) && ((await isPointWithinRect({ x, y }, this.containerRect)) && (await isPointWithinRect({ x: x + width, y: y + height }, this.containerRect))) ); }
Returns true when the Option is visible inside the menu container. @method @returns {bool}
isVisible
javascript
nexxtway/react-rainbow
src/components/Option/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Option/pageObject/index.js
MIT
async waitUntilIsVisible() { await browser.waitUntil(async () => await this.isVisible(), 30000); }
Wait until the option is visible. @method
waitUntilIsVisible
javascript
nexxtway/react-rainbow
src/components/Option/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Option/pageObject/index.js
MIT
async scrollIntoView() { await this.rootElement.scrollIntoView(); }
Scrolls the Option into view. @method
scrollIntoView
javascript
nexxtway/react-rainbow
src/components/Option/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Option/pageObject/index.js
MIT
function Pagination(props) { const { pages, activePage, onChange, className, style, variant } = props; const isFirstItemSelected = activePage === 1; const isLastItemSelected = activePage === pages; return ( <StyledNav className={className} aria-label="pagination" style={style}> <StyledPaginationContainer> <NavigationButton dataId="previous-page-button" icon={<LeftArrow />} onClick={event => onChange(event, activePage - 1)} disabled={isFirstItemSelected} ariaLabel="Goto Previous Page" variant={variant} /> <PageButtonsContainer onChange={onChange} pages={pages} activePage={activePage} variant={variant} /> <NavigationButton dataId="next-page-button" icon={<RightArrow />} onClick={event => onChange(event, activePage + 1)} disabled={isLastItemSelected} ariaLabel="Goto Next Page" variant={variant} /> </StyledPaginationContainer> </StyledNav> ); }
The Pagination component shows you the pagination options for dividing content into pages. It is very useful when you want to display a large recordset on multiple pages. @category Layout
Pagination
javascript
nexxtway/react-rainbow
src/components/Pagination/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Pagination/index.js
MIT
function Path(props) { const { currentStepName, onClick, children, id, className, style } = props; const [hoveredStepName, setHoveredStepName] = useState(null); const [stepsCount, setStepsCount] = useState(0); const registeredSteps = useRef([]); const containerRef = useRef(); const privateRegisterStep = useCallback((stepRef, stepProps) => { if (isChildRegistered(stepProps.name, registeredSteps.current)) return; const [...nodes] = getChildStepsNodes(containerRef.current); const newStepsList = insertChildOrderly( registeredSteps.current, { ref: stepRef, ...stepProps, }, nodes, ); registeredSteps.current = newStepsList; setStepsCount(registeredSteps.current.length); }, []); const privateUnregisterStep = useCallback((stepRef, stepName) => { if (!isChildRegistered(stepName, registeredSteps.current)) return; registeredSteps.current = registeredSteps.current.filter(step => step.name !== stepName); setStepsCount(registeredSteps.current.length); }, []); const getStepIndex = useCallback( name => registeredSteps.current.findIndex(step => step.name === name), [], ); const privateGetStepZIndex = useCallback(name => stepsCount - getStepIndex(name), [ getStepIndex, stepsCount, ]); const privateUpdateStepProps = useCallback(stepProps => { if (!isChildRegistered(stepProps.name, registeredSteps.current)) return; const index = registeredSteps.current.findIndex( registeredStep => registeredStep.name === stepProps.name, ); const updatedStep = registeredSteps.current[index]; registeredSteps.current[index] = { ...updatedStep, ...stepProps, }; }, []); const context = useMemo(() => { const selectedIndex = registeredSteps.current.findIndex( step => step.name === currentStepName, ); const hoveredIndex = registeredSteps.current.findIndex( step => step.name === hoveredStepName, ); return { selectedIndex, hoveredIndex, privateGetStepIndex: getStepIndex, privateGetStepZIndex, privateRegisterStep, privateUnregisterStep, privateUpdateStepProps, privateOnClick: onClick, privateUpdateHoveredStep: setHoveredStepName, }; }, [ currentStepName, getStepIndex, hoveredStepName, onClick, privateGetStepZIndex, privateRegisterStep, privateUnregisterStep, privateUpdateStepProps, ]); return ( <StyledContainer id={id} className={className} style={style} ref={containerRef}> <StyledStepsList> <Provider value={context}>{children}</Provider> </StyledStepsList> </StyledContainer> ); }
Path component is a navigation bar that guides users through the steps of a task. When a given task is complicated or has a certain sequence in the series of subtasks, we can decompose it into several steps to make things easier.
Path
javascript
nexxtway/react-rainbow
src/components/Path/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Path/index.js
MIT
function PathStep(props) { const { name, label, hasError, className, style } = props; const { selectedIndex, hoveredIndex, privateGetStepIndex, privateGetStepZIndex, privateRegisterStep, privateUnregisterStep, privateUpdateStepProps, privateUpdateHoveredStep, privateOnClick, } = useContext(PathContext); const stepRef = useRef(); useEffect(() => { privateRegisterStep(stepRef.current, { name, label, hasError }); return () => { privateUnregisterStep(stepRef, name); }; // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { privateUpdateStepProps({ name, label, hasError, }); }, [name, label, hasError, privateUpdateStepProps]); const index = privateGetStepIndex(name); const activeStepIndex = useMemo( () => getActiveStepIndex({ hoveredIndex, selectedIndex, }), [hoveredIndex, selectedIndex], ); const isChecked = activeStepIndex > index; const isSelected = useMemo( () => isStepSelected({ index, hoveredIndex, selectedIndex, }), [hoveredIndex, index, selectedIndex], ); const renderCheckIcon = !hasError && (isChecked || isSelected || activeStepIndex === index); return ( <StyledStepItem ref={stepRef} role="option" className={className} style={style} isSelected={isSelected} hasError={hasError} isChecked={isChecked} zIndex={privateGetStepZIndex(name)} onClick={() => privateOnClick(name)} onMouseEnter={() => privateUpdateHoveredStep(name)} onMouseLeave={() => privateUpdateHoveredStep(null)} > {label} <RenderIf isTrue={renderCheckIcon}> <CheckMark /> </RenderIf> <RenderIf isTrue={hasError}> <Exclamation /> </RenderIf> </StyledStepItem> ); }
The PathStep component displays progress through a sequence of logical and numbered steps. Path and PathStep components are related and should be implemented together.
PathStep
javascript
nexxtway/react-rainbow
src/components/PathStep/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PathStep/index.js
MIT
handleFocus = () => { if (!hasFocus) { setHasFocus(true); onFocus(value); } }
phone input are used for freeform data entry. @category Form
handleFocus
javascript
nexxtway/react-rainbow
src/components/PhoneInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PhoneInput/index.js
MIT
handleFocus = () => { if (!hasFocus) { setHasFocus(true); onFocus(value); } }
phone input are used for freeform data entry. @category Form
handleFocus
javascript
nexxtway/react-rainbow
src/components/PhoneInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PhoneInput/index.js
MIT
handleBlur = event => { const { relatedTarget } = event; if ( relatedTarget !== null && !containerRef.current.contains(relatedTarget) && (!pickerRef.current || !pickerRef.current.contains(relatedTarget)) ) { setHasFocus(false); onBlur(value); } }
phone input are used for freeform data entry. @category Form
handleBlur
javascript
nexxtway/react-rainbow
src/components/PhoneInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PhoneInput/index.js
MIT
handleBlur = event => { const { relatedTarget } = event; if ( relatedTarget !== null && !containerRef.current.contains(relatedTarget) && (!pickerRef.current || !pickerRef.current.contains(relatedTarget)) ) { setHasFocus(false); onBlur(value); } }
phone input are used for freeform data entry. @category Form
handleBlur
javascript
nexxtway/react-rainbow
src/components/PhoneInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PhoneInput/index.js
MIT
onCountryChange = newCountry => { setIsOpen(false); inputRef.current.focus(); onChange({ ...value, isoCode: newCountry.isoCode, countryCode: newCountry.countryCode, }); }
phone input are used for freeform data entry. @category Form
onCountryChange
javascript
nexxtway/react-rainbow
src/components/PhoneInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PhoneInput/index.js
MIT
onCountryChange = newCountry => { setIsOpen(false); inputRef.current.focus(); onChange({ ...value, isoCode: newCountry.isoCode, countryCode: newCountry.countryCode, }); }
phone input are used for freeform data entry. @category Form
onCountryChange
javascript
nexxtway/react-rainbow
src/components/PhoneInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PhoneInput/index.js
MIT
handlePhoneChange = event => { const rawPhone = event.target.value; const newPhone = rawPhone.replace(/\D/g, ''); onChange({ countryCode, isoCode, phone: newPhone, }); }
phone input are used for freeform data entry. @category Form
handlePhoneChange
javascript
nexxtway/react-rainbow
src/components/PhoneInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PhoneInput/index.js
MIT
handlePhoneChange = event => { const rawPhone = event.target.value; const newPhone = rawPhone.replace(/\D/g, ''); onChange({ countryCode, isoCode, phone: newPhone, }); }
phone input are used for freeform data entry. @category Form
handlePhoneChange
javascript
nexxtway/react-rainbow
src/components/PhoneInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PhoneInput/index.js
MIT
handleClick = () => { if (isOpen) setIsOpen(false); else setIsOpen(true); }
phone input are used for freeform data entry. @category Form
handleClick
javascript
nexxtway/react-rainbow
src/components/PhoneInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PhoneInput/index.js
MIT
handleClick = () => { if (isOpen) setIsOpen(false); else setIsOpen(true); }
phone input are used for freeform data entry. @category Form
handleClick
javascript
nexxtway/react-rainbow
src/components/PhoneInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PhoneInput/index.js
MIT
handleKeyDown = event => { if (event.key === 'Tab' || event.key === 'Escape') { event.preventDefault(); setIsOpen(false); inputRef.current.focus(); } }
phone input are used for freeform data entry. @category Form
handleKeyDown
javascript
nexxtway/react-rainbow
src/components/PhoneInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PhoneInput/index.js
MIT
handleKeyDown = event => { if (event.key === 'Tab' || event.key === 'Escape') { event.preventDefault(); setIsOpen(false); inputRef.current.focus(); } }
phone input are used for freeform data entry. @category Form
handleKeyDown
javascript
nexxtway/react-rainbow
src/components/PhoneInput/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PhoneInput/index.js
MIT
constructor(props) { super(props); this.inputId = uniqueId('picklist-input'); this.errorMessageId = uniqueId('error-message'); this.listboxId = uniqueId('listbox'); this.containerRef = React.createRef(); this.triggerRef = React.createRef(); this.dropdownRef = React.createRef(); this.handleInputClick = this.handleInputClick.bind(this); this.handleFocus = this.handleFocus.bind(this); this.handleBlur = this.handleBlur.bind(this); this.handleKeyPressed = this.handleKeyPressed.bind(this); this.handleChange = this.handleChange.bind(this); this.closeAndFocusInput = this.closeAndFocusInput.bind(this); this.handleWindowScroll = this.handleWindowScroll.bind(this); this.handleWindowResize = this.handleWindowResize.bind(this); this.outsideClick = new OutsideClick(); this.windowScrolling = new WindowScrolling(); this.windowResize = new WindowResize(); this.activeChildren = []; this.state = { isOpen: false, }; this.keyHandlerMap = { [ESCAPE_KEY]: this.closeAndFocusInput, [TAB_KEY]: this.closeAndFocusInput, }; }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
constructor
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
componentDidUpdate(prevProps, prevState) { const { isOpen: wasOpen } = prevState; const { isOpen } = this.state; if (!wasOpen && isOpen) { // eslint-disable-next-line id-length this.outsideClick.startListening(this.containerRef.current, (_, event) => { if (!this.dropdownRef.current.contains(event.target)) { this.closeMenu(); this.handleBlur(); } }); if (window.screen.width > 600) { this.windowScrolling.startListening(this.handleWindowScroll); } this.windowResize.startListening(this.handleWindowResize); } }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
componentDidUpdate
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
componentWillUnmount() { this.outsideClick.stopListening(); this.windowScrolling.stopListening(); this.windowResize.stopListening(); }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
componentWillUnmount
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
getErrorMessageId() { const { error } = this.props; if (error) { return this.errorMessageId; } return undefined; }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
getErrorMessageId
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
handleKeyPressed(event) { const { isOpen } = this.state; const { readOnly } = this.props; if (isOpen) { if (this.keyHandlerMap[event.keyCode]) { return this.keyHandlerMap[event.keyCode](); } } else if (shouldOpenMenu(event.keyCode) && !readOnly) { event.preventDefault(); this.openMenu(); } return null; }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
handleKeyPressed
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
handleWindowScroll(event) { if (this.dropdownRef.current.contains(event.target)) return; this.closeMenu(); }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
handleWindowScroll
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
closeAndFocusInput() { this.closeMenu(); this.focus(); }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
closeAndFocusInput
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
openMenu() { const { readOnly } = this.props; if (!readOnly) { this.setState({ isOpen: true, }); } }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
openMenu
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
closeMenu() { this.outsideClick.stopListening(); this.windowScrolling.stopListening(); this.windowResize.stopListening(); this.setState({ isOpen: false, }); }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
closeMenu
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
handleInputClick(event) { const { onClick } = this.props; const { isOpen } = this.state; onClick(event); if (isOpen) { return this.closeMenu(); } return this.openMenu(); }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
handleInputClick
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
handleFocus() { const { onFocus, value } = this.props; const eventValue = value || null; onFocus(eventValue); }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
handleFocus
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
handleBlur() { const { isOpen } = this.state; if (isOpen) return; const { onBlur, value } = this.props; const eventValue = value || null; onBlur(eventValue); }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
handleBlur
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
handleChange(option) { const { onChange } = this.props; const { label, name, icon, value } = option; this.closeMenu(); setTimeout(() => { this.focus(); return onChange({ label, name, icon, value }); }, 0); }
A Picklist provides a user with an read-only input field that is accompanied with a listbox of pre-defined options. @category Form
handleChange
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
render() { const { label: pickListLabel, labelAlignment, hideLabel, style, className, variant, error, isLoading, disabled, readOnly, required, children, id, tabIndex, placeholder, name, value: valueInProps, enableSearch, onSearch, debounce, emptyComponent, size, borderRadius, } = this.props; const { label: valueLabel, icon } = getNormalizeValue(valueInProps); const value = valueLabel || ''; const errorMessageId = this.getErrorMessageId(); const { isOpen } = this.state; const isReadOnly = !!(!disabled && readOnly); const labelVariant = variant === 'inverse' ? variant : 'default'; return ( <StyledContainer id={id} role="presentation" className={className} style={style} onKeyDown={this.handleKeyPressed} ref={this.containerRef} readOnly={readOnly} > <RenderIf isTrue={pickListLabel}> <Label label={pickListLabel} labelAlignment={labelAlignment} hideLabel={hideLabel} required={required} inputId={this.inputId} readOnly={isReadOnly} variant={labelVariant} size={size} /> </RenderIf> <StyledInnerContainer disabled={disabled} readOnly={readOnly} aria-expanded={isOpen} aria-haspopup="listbox" // eslint-disable-next-line jsx-a11y/role-has-required-aria-props role="combobox" > <RenderIf isTrue={icon}> <StyledIcon error={error}>{icon}</StyledIcon> </RenderIf> <RenderIf isTrue={!readOnly}> <StyledIndicator error={error} disabled={disabled} /> </RenderIf> <StyledInput aria-controls={this.listboxId} id={this.inputId} type="text" name={name} value={value} error={error} onClick={this.handleInputClick} onFocus={this.handleFocus} onBlur={this.handleBlur} placeholder={placeholder} tabIndex={tabIndex} readOnly isReadOnly={readOnly} disabled={disabled} required={required} aria-describedby={errorMessageId} autoComplete="off" ref={this.triggerRef} icon={icon} iconPosition="left" variant={variant} size={size} borderRadius={borderRadius} /> <InternalOverlay isVisible={isOpen} positionResolver={opt => positionResolver(opt, enableSearch)} onOpened={() => this.dropdownRef.current.focus()} triggerElementRef={() => this.triggerRef} keepScrollEnabled > <InternalDropdown id={this.listboxId} isLoading={isLoading} value={valueInProps} onChange={this.handleChange} enableSearch={enableSearch} onSearch={onSearch} debounce={debounce} ref={this.dropdownRef} emptyComponent={emptyComponent} borderRadius={borderRadius} > {children} </InternalDropdown> </InternalOverlay> </StyledInnerContainer> <RenderIf isTrue={error}> <StyledError id={errorMessageId}>{error}</StyledError> </RenderIf> </StyledContainer> ); }
Sets blur on the element. @public
render
javascript
nexxtway/react-rainbow
src/components/Picklist/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new PagePicklist page object. @constructor @param {string} rootElement - The selector of the PagePicklist root element.
constructor
javascript
nexxtway/react-rainbow
src/components/Picklist/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/pageObject/index.js
MIT
async hasFocusInput() { return $(this.rootElement) .$('input[type="text"]') .isFocused(); }
Returns true when the input element has focus. @method @returns {bool}
hasFocusInput
javascript
nexxtway/react-rainbow
src/components/Picklist/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/pageObject/index.js
MIT
async mouseLeaveScrollArrow() { return $(this.rootElement) .$('input[type="text"]') .moveTo(); }
It move the pointer off any menu scroll arrow @method
mouseLeaveScrollArrow
javascript
nexxtway/react-rainbow
src/components/Picklist/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/pageObject/index.js
MIT
async getSelectedOptionLabel() { return $(this.rootElement) .$('input[type="text"]') .getValue(); }
Returns the label of the selected PicklistOption @method @returns {string}
getSelectedOptionLabel
javascript
nexxtway/react-rainbow
src/components/Picklist/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/pageObject/index.js
MIT
async isMenuOpen() { return ( (await $(this.rootElement) .$('div[role="combobox"]') .getAttribute('aria-expanded')) === 'true' ); }
Returns true when the options menu is open, false otherwise. @method @returns {bool}
isMenuOpen
javascript
nexxtway/react-rainbow
src/components/Picklist/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/pageObject/index.js
MIT
async waitUntilOpen() { await browser.waitUntil(async () => this.isMenuOpen()); }
Wait until the options menu is open. @method
waitUntilOpen
javascript
nexxtway/react-rainbow
src/components/Picklist/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/pageObject/index.js
MIT
async hoverScrollUpArrow() { return (await this[privateGetMenu]()).hoverScrollUpArrow(); }
It moves the pointer over the menu scroll up arrow @method
hoverScrollUpArrow
javascript
nexxtway/react-rainbow
src/components/Picklist/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/pageObject/index.js
MIT
async hoverScrollDownArrow() { return (await this[privateGetMenu]()).hoverScrollDownArrow(); }
It moves the pointer over the menu scroll down arrow @method
hoverScrollDownArrow
javascript
nexxtway/react-rainbow
src/components/Picklist/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/pageObject/index.js
MIT
async getOptionsLength() { return (await this[privateGetMenu]()).getOptionsLength(); }
Get the number of registered options. @method @returns {number}
getOptionsLength
javascript
nexxtway/react-rainbow
src/components/Picklist/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/pageObject/index.js
MIT
async getOption(optionIndex) { return (await this[privateGetMenu]()).getOption(optionIndex); }
Returns a new PicklistOption page object of the element in item position. @method @param {number} optionIndex - The base 0 index of the PicklistOption.
getOption
javascript
nexxtway/react-rainbow
src/components/Picklist/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Picklist/pageObject/index.js
MIT
function PicklistOption(props) { // eslint-disable-next-line react/jsx-props-no-spreading return <Option {...props} />; }
Represents a list options in a menu. @category Form
PicklistOption
javascript
nexxtway/react-rainbow
src/components/PicklistOption/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PicklistOption/index.js
MIT
constructor(rootElement, containerRect) { this.rootElement = rootElement; this.containerRect = containerRect; }
Create a new PicklistOption page object. @constructor @param {string} rootElement - The selector of the PicklistOption root element.
constructor
javascript
nexxtway/react-rainbow
src/components/PicklistOption/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PicklistOption/pageObject/index.js
MIT
hover() { const itemElement = this.rootElement.$('div[role="option"]'); itemElement.moveTo(); }
It moves the pointer over the PicklistOption @method
hover
javascript
nexxtway/react-rainbow
src/components/PicklistOption/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PicklistOption/pageObject/index.js
MIT
getLabel() { return this.rootElement.$('div[role="option"]').getText(); }
Get the label of the PicklistOption. @method @returns {string}
getLabel
javascript
nexxtway/react-rainbow
src/components/PicklistOption/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PicklistOption/pageObject/index.js
MIT
isActive() { return this.rootElement.$('div[aria-selected="true"]').isExisting(); }
Returns true when the PicklistOption is active. @method @returns {bool}
isActive
javascript
nexxtway/react-rainbow
src/components/PicklistOption/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PicklistOption/pageObject/index.js
MIT
isVisible() { const { x, y } = this.rootElement.$('div[role="option"]').getLocation(); const { width, height } = this.rootElement.$('div[role="option"]').getSize(); return ( this.rootElement.isDisplayedInViewport() && (isPointWithinRect({ x, y }, this.containerRect) && isPointWithinRect({ x: x + width, y: y + height }, this.containerRect)) ); }
Returns true when the PicklistOption is visible inside the menu container. @method @returns {bool}
isVisible
javascript
nexxtway/react-rainbow
src/components/PicklistOption/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PicklistOption/pageObject/index.js
MIT
waitUntilIsVisible() { browser.waitUntil(() => this.isVisible()); }
Wait until the option is visible. @method
waitUntilIsVisible
javascript
nexxtway/react-rainbow
src/components/PicklistOption/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PicklistOption/pageObject/index.js
MIT
render() { const { style, className, value, onChange, label, disabled, tabIndex, onFocus, onBlur, onClick, onKeyDown, id, name, checked, } = this.props; return ( <StyledContainer id={id} className={className} style={style}> <StyledInnerContainer> <input id={this.inputId} name={name} type="checkbox" value={value} onChange={onChange} tabIndex={tabIndex} onFocus={onFocus} onBlur={onBlur} onClick={onClick} onKeyDown={onKeyDown} disabled={disabled} checked={checked} ref={this.inputRef} /> <Label label={label} inputId={this.inputId} /> </StyledInnerContainer> </StyledContainer> ); }
Sets blur on the element. @public
render
javascript
nexxtway/react-rainbow
src/components/PrimitiveCheckbox/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PrimitiveCheckbox/index.js
MIT
async isDropdownOpen() { const dropdown = await this.dropdown; const exists = await dropdown.isExisting(); const visible = await dropdown.isDisplayed(); return exists && visible; }
Returns true when the menu is open, false otherwise. @method @returns {bool}
isDropdownOpen
javascript
nexxtway/react-rainbow
src/components/PrimitiveMenu/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PrimitiveMenu/pageObject/index.js
MIT
async hasFocusTrigger() { return (await this.trigger).isFocused(); }
Returns true when the button element has focus. @method @returns {bool}
hasFocusTrigger
javascript
nexxtway/react-rainbow
src/components/PrimitiveMenu/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PrimitiveMenu/pageObject/index.js
MIT
async getItem(itemPosition) { const menuItems = await this.dropdown.$$('li[role="menuitem"]'); if (menuItems[itemPosition]) { return new PageMenuItem(menuItems[itemPosition]); } return null; }
@method @param {number} index @return {PageMenuItem}
getItem
javascript
nexxtway/react-rainbow
src/components/PrimitiveMenu/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/PrimitiveMenu/pageObject/index.js
MIT
function ProgressBar(props) { const { className, style, assistiveText, value, size, variant } = props; const normalizedValue = normalizeValue(value); const WIDTH = { width: `${normalizedValue}%` }; return ( <StyledContainer className={className} style={style} size={size} variant={variant} aria-valuemin="0" aria-valuemax="100" aria-valuenow={normalizedValue} role="progressbar" aria-label={assistiveText} > <StyledBar variant={variant} style={WIDTH}> <AsistiveText text={assistiveText} /> </StyledBar> </StyledContainer> ); }
Progress bar component communicates to the user the progress of a particular process.
ProgressBar
javascript
nexxtway/react-rainbow
src/components/ProgressBar/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ProgressBar/index.js
MIT
function ProgressCircular(props) { const { value, variant, assistiveText, className, style } = props; const normalizedValue = normalizeValue(value); return ( <StyledContainer className={className} aria-valuemin="0" aria-valuemax="100" aria-valuenow={normalizedValue} role="progressbar" aria-label={assistiveText} style={style} > <ProgressRing variant={variant} percent={normalizedValue} /> <StyledPercentValue variant={variant}>{`${normalizedValue}%`}</StyledPercentValue> <AssistiveText text={assistiveText} /> </StyledContainer> ); }
ProgressCircular component communicates to the user the progress of a particular process.
ProgressCircular
javascript
nexxtway/react-rainbow
src/components/ProgressCircular/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ProgressCircular/index.js
MIT
constructor(props) { super(props); this.stepChildren = []; this.numbersMap = {}; this.registerStep = this.registerStep.bind(this); this.setChildrenState = this.setChildrenState.bind(this); }
The ProgressIndicator is a visual representation of a user's progress through a set of steps. To add the steps, you will need to implement the `ProgressStep` component.
constructor
javascript
nexxtway/react-rainbow
src/components/ProgressIndicator/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ProgressIndicator/index.js
MIT
setChildrenState(step) { const { currentStepName } = this.props; const activeStepIndex = this.stepChildren.findIndex(item => item.name === currentStepName); const currentChildIndex = this.stepChildren.findIndex(item => item.name === step.name); if (currentChildIndex === activeStepIndex) { step.onSetStepState('Active'); } else if (activeStepIndex === -1 || currentChildIndex < activeStepIndex) { step.onSetStepState('Completed'); } else if (currentChildIndex > activeStepIndex) { step.onSetStepState('Inactive'); } }
The ProgressIndicator is a visual representation of a user's progress through a set of steps. To add the steps, you will need to implement the `ProgressStep` component.
setChildrenState
javascript
nexxtway/react-rainbow
src/components/ProgressIndicator/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ProgressIndicator/index.js
MIT
registerStep(step) { const newChildrenRefs = this.stepChildren.concat([step]); this.stepChildren = newChildrenRefs; const { name } = step; this.numbersMap[name] = newChildrenRefs.length; this.setChildrenState(step); }
The ProgressIndicator is a visual representation of a user's progress through a set of steps. To add the steps, you will need to implement the `ProgressStep` component.
registerStep
javascript
nexxtway/react-rainbow
src/components/ProgressIndicator/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ProgressIndicator/index.js
MIT
render() { const { style, className, variant, children, currentStepName, onClick } = this.props; const context = { currentStepName, privateRegisterStep: this.registerStep, privateOnClick: onClick, setChildrenState: this.setChildrenState, numbersMap: this.numbersMap, variant, }; return ( <StyledContainer className={className} style={style}> <StyledIndicatorList> <Provider value={context}>{children}</Provider> </StyledIndicatorList> </StyledContainer> ); }
The ProgressIndicator is a visual representation of a user's progress through a set of steps. To add the steps, you will need to implement the `ProgressStep` component.
render
javascript
nexxtway/react-rainbow
src/components/ProgressIndicator/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ProgressIndicator/index.js
MIT
function ProgressStep(props) { // eslint-disable-next-line react/jsx-props-no-spreading return <Consumer>{context => <StepItem {...props} {...context} />}</Consumer>; }
A progress step represents one step of the progress indicator. ProgressStep and ProgressIndicator components are related and should be implemented together.
ProgressStep
javascript
nexxtway/react-rainbow
src/components/ProgressStep/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ProgressStep/index.js
MIT
constructor(props) { super(props); this.errorId = uniqueId('error-message'); this.groupNameId = props.name || uniqueId('options'); this.optionsRefs = this.generateRefsForOptions(); this.state = { options: this.addRefsToOptions(props.options), markerLeft: 0, markerWidth: 0, }; }
A button list that can have a single entry checked at any one time. @category Form
constructor
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/index.js
MIT
componentDidMount() { setTimeout(() => { this.updateMarker(); }, 0); }
A button list that can have a single entry checked at any one time. @category Form
componentDidMount
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/index.js
MIT
componentDidUpdate(prevProps) { const { options, value } = this.props; if (prevProps.options !== options) { this.updateRefs(); } if (prevProps.value !== value) { this.updateMarker(); } }
A button list that can have a single entry checked at any one time. @category Form
componentDidUpdate
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/index.js
MIT
getErrorMessageId() { const { error } = this.props; if (error) { return this.errorId; } return undefined; }
A button list that can have a single entry checked at any one time. @category Form
getErrorMessageId
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/index.js
MIT
getCheckedOptionRef() { const { value, options } = this.props; const currentOptionIndex = options.findIndex(option => isOptionChecked(option, value)); return currentOptionIndex !== -1 ? this.optionsRefs[currentOptionIndex] : null; }
A button list that can have a single entry checked at any one time. @category Form
getCheckedOptionRef
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/index.js
MIT
generateRefsForOptions() { const { options } = this.props; return options.map(() => React.createRef()); }
A button list that can have a single entry checked at any one time. @category Form
generateRefsForOptions
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/index.js
MIT
addRefsToOptions(options) { return options.map((option, index) => ({ ...option, optionRef: this.optionsRefs[index], })); }
A button list that can have a single entry checked at any one time. @category Form
addRefsToOptions
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/index.js
MIT
isMarkerActive() { const { value, options } = this.props; return options.some(option => !option.disabled && option.value === value); }
A button list that can have a single entry checked at any one time. @category Form
isMarkerActive
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/index.js
MIT
updateMarker() { const activeOptionRef = this.getCheckedOptionRef(); if (activeOptionRef && activeOptionRef.current) { this.setState({ markerLeft: activeOptionRef.current.offsetLeft, markerWidth: Math.max( activeOptionRef.current.offsetWidth, activeOptionRef.current.clientWidth, ), }); } }
A button list that can have a single entry checked at any one time. @category Form
updateMarker
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/index.js
MIT
updateRefs() { const { options } = this.props; this.optionsRefs = this.generateRefsForOptions(); this.setState({ options: this.addRefsToOptions(options), }); setTimeout(() => { this.updateMarker(); }, 0); }
A button list that can have a single entry checked at any one time. @category Form
updateRefs
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/index.js
MIT
render() { const { style, className, label, labelAlignment, hideLabel, required, error, value, id, onChange, variant, size, borderRadius, } = this.props; const { options, markerLeft, markerWidth } = this.state; const markerStyle = { left: markerLeft, width: markerWidth, }; return ( <StyledContainer id={id} className={className} style={style}> <RenderIf isTrue={label}> <StyledLabel label={label} variant={variant} labelAlignment={labelAlignment} hideLabel={hideLabel} required={required} forwardedAs="legend" /> </RenderIf> <StyledButtonItemsContainer variant={variant} size={size} borderRadius={borderRadius} > <Marker variant={variant} isVisible={this.isMarkerActive()} style={markerStyle} size={size} borderRadius={borderRadius} /> <ButtonItems value={value} onChange={onChange} options={options} name={this.groupNameId} required={required} ariaDescribedby={this.getErrorMessageId()} variant={variant} size={size} borderRadius={borderRadius} /> </StyledButtonItemsContainer> <RenderIf isTrue={error}> <StyledErrorText id={this.getErrorMessageId()}>{error}</StyledErrorText> </RenderIf> </StyledContainer> ); }
A button list that can have a single entry checked at any one time. @category Form
render
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new RadioButtonGroup page object. @constructor @param {string} rootElement - The selector of the RadioButtonGroup root element.
constructor
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/pageObject/index.js
MIT
async getItem(itemPosition) { const items = await $(this.rootElement).$$( 'span[data-id="radio-button-group_radio-container"]', ); if (items[itemPosition]) { return new PageRadioButtonItem( `${ this.rootElement } span[data-id="radio-button-group_radio-container"]:nth-child(${itemPosition + 1})`, ); } return null; }
Returns a new RadioButton page object of the element in item position. @method @param {number} itemPosition - The base 0 index of the radio.
getItem
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/pageObject/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new RadioButton page object. @constructor @param {string} rootElement - The selector of the Radio root element.
constructor
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/pageObject/radioButton.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/pageObject/radioButton.js
MIT
async hasFocus() { return $(this.rootElement) .$('input[type="radio"]') .isFocused(); }
Returns true when the radiobutton has the focus. @method @returns {bool}
hasFocus
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/pageObject/radioButton.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/pageObject/radioButton.js
MIT
async isChecked() { return !!(await $(this.rootElement) .$('input[type="radio"]') .isSelected()); }
Returns true when the radio is checked. @method @returns {bool}
isChecked
javascript
nexxtway/react-rainbow
src/components/RadioButtonGroup/pageObject/radioButton.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioButtonGroup/pageObject/radioButton.js
MIT
constructor(props) { super(props); this.errorId = uniqueId('error-message'); this.groupNameId = props.name || uniqueId('options'); }
A select list that can have a single entry checked at any one time. @category Form
constructor
javascript
nexxtway/react-rainbow
src/components/RadioGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioGroup/index.js
MIT
getErrorMessageId() { const { error } = this.props; if (error) { return this.errorId; } return undefined; }
A select list that can have a single entry checked at any one time. @category Form
getErrorMessageId
javascript
nexxtway/react-rainbow
src/components/RadioGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioGroup/index.js
MIT
render() { const { style, className, label, labelAlignment, hideLabel, required, error, onChange, options, value, id, orientation, } = this.props; return ( <StyledFieldset id={id} className={className} style={style}> <RenderIf isTrue={label}> <StyledLabel label={label} labelAlignment={labelAlignment} hideLabel={hideLabel} required={required} forwardedAs="legend" /> </RenderIf> <StyledContentContainer orientation={orientation}> <RadioItems value={value} onChange={onChange} options={options} name={this.groupNameId} ariaDescribedby={this.getErrorMessageId()} error={error} /> </StyledContentContainer> <RenderIf isTrue={error}> <StyledTextError id={this.getErrorMessageId()}>{error}</StyledTextError> </RenderIf> </StyledFieldset> ); }
A select list that can have a single entry checked at any one time. @category Form
render
javascript
nexxtway/react-rainbow
src/components/RadioGroup/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioGroup/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new RadioGroup page object. @constructor @param {string} rootElement - The selector of the RadioGroup root element.
constructor
javascript
nexxtway/react-rainbow
src/components/RadioGroup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioGroup/pageObject/index.js
MIT
async getItem(itemPosition) { const items = await $(this.rootElement).$$('[data-id="input-radio_container"]'); if (items[itemPosition]) { return new PageRadioItem( `${ this.rootElement } [data-id="input-radiogroup_container"]:nth-child(${itemPosition + 1})`, ); } return null; }
Returns a new Radio page object of the element in item position. @method @param {number} itemPosition - The base 0 index of the radio.
getItem
javascript
nexxtway/react-rainbow
src/components/RadioGroup/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioGroup/pageObject/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new Radio page object. @constructor @param {string} rootElement - The selector of the Radio root element.
constructor
javascript
nexxtway/react-rainbow
src/components/RadioGroup/pageObject/radio.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioGroup/pageObject/radio.js
MIT
async hasFocus() { return $(this.rootElement) .$('input[type="radio"]') .isFocused(); }
Returns true when the radio has the focus. @method @returns {bool}
hasFocus
javascript
nexxtway/react-rainbow
src/components/RadioGroup/pageObject/radio.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioGroup/pageObject/radio.js
MIT
async isChecked() { return !!(await $(this.rootElement) .$('input[type="radio"]') .isSelected()); }
Returns true when the radio is checked. @method @returns {bool}
isChecked
javascript
nexxtway/react-rainbow
src/components/RadioGroup/pageObject/radio.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RadioGroup/pageObject/radio.js
MIT
RainbowThemeContainer = ({ theme, children }) => { const [normalizedTheme, setTheme] = useState(() => normalizeTheme(theme)); useEffect(() => { setTheme(normalizeTheme(theme)); }, [theme]); return <ThemeProvider theme={normalizedTheme}>{children}</ThemeProvider>; }
RainbowThemeContainer allows to overwrite the theme for specific parts of your tree.
RainbowThemeContainer
javascript
nexxtway/react-rainbow
src/components/RainbowThemeContainer/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RainbowThemeContainer/index.js
MIT
RainbowThemeContainer = ({ theme, children }) => { const [normalizedTheme, setTheme] = useState(() => normalizeTheme(theme)); useEffect(() => { setTheme(normalizeTheme(theme)); }, [theme]); return <ThemeProvider theme={normalizedTheme}>{children}</ThemeProvider>; }
RainbowThemeContainer allows to overwrite the theme for specific parts of your tree.
RainbowThemeContainer
javascript
nexxtway/react-rainbow
src/components/RainbowThemeContainer/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/RainbowThemeContainer/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new Rating page object. @constructor @param {string} rootElement - The selector of the Rating root element.
constructor
javascript
nexxtway/react-rainbow
src/components/Rating/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Rating/pageObject/index.js
MIT
getItem(itemPosition) { const items = $(this.rootElement).$$('.rainbow-rating_star'); if (items[itemPosition]) { return new PageRatingStar( `${this.rootElement} .rainbow-rating_star:nth-child(${itemPosition + 1})`, ); } return null; }
Returns a new Star page object of the element in item position. @method @param {number} itemPosition - The base 0 index of the star.
getItem
javascript
nexxtway/react-rainbow
src/components/Rating/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Rating/pageObject/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new Star page object. @constructor @param {string} rootElement - The selector of the Star root element.
constructor
javascript
nexxtway/react-rainbow
src/components/Rating/pageObject/star.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Rating/pageObject/star.js
MIT
isChecked() { return !!$(this.rootElement) .$('input[type="radio"]') .getAttribute('checked'); }
Returns true when the star is checked. @method @returns {bool}
isChecked
javascript
nexxtway/react-rainbow
src/components/Rating/pageObject/star.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Rating/pageObject/star.js
MIT
constructor(props) { super(props); const { lang } = props; this.ReCaptchaComponent = scriptLoader(getUrl(lang))(ReCaptchaWrapper); }
The ReCaptcha component is used to protects your website from spam and abuse.
constructor
javascript
nexxtway/react-rainbow
src/components/ReCaptcha/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ReCaptcha/index.js
MIT
reset() { if (window.grecaptcha && this.optWidgetID) { window.grecaptcha.reset(this.optWidgetID); } }
The ReCaptcha component is used to protects your website from spam and abuse.
reset
javascript
nexxtway/react-rainbow
src/components/ReCaptcha/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ReCaptcha/index.js
MIT
render() { const { ReCaptchaComponent } = this; return ( <ReCaptchaComponent // eslint-disable-next-line react/jsx-props-no-spreading {...this.props} onCreateRecaptcha={optWidgetID => { this.optWidgetID = optWidgetID; }} /> ); }
The ReCaptcha component is used to protects your website from spam and abuse.
render
javascript
nexxtway/react-rainbow
src/components/ReCaptcha/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ReCaptcha/index.js
MIT
constructor(props) { super(props); this.selectId = uniqueId('select'); this.selectRef = React.createRef(); }
Select element presents a menu of options. @category Form
constructor
javascript
nexxtway/react-rainbow
src/components/Select/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Select/index.js
MIT
render() { const { label, value, onChange, onFocus, onBlur, onClick, bottomHelpText, error, required, disabled, options, style, className, id, name, labelAlignment, hideLabel, tabIndex, variant, size, borderRadius, } = this.props; return ( <StyledContainer className={className} style={style} id={id}> <Label label={label} labelAlignment={labelAlignment} hideLabel={hideLabel} required={required} inputId={this.selectId} size={size} /> <StyledInnerContainer error={error} disabled={disabled}> <StyledSelect error={error} id={this.selectId} name={name} onChange={onChange} onFocus={onFocus} onBlur={onBlur} onClick={onClick} value={value} tabIndex={tabIndex} required={required} disabled={disabled} variant={variant} ref={this.selectRef} size={size} borderRadius={borderRadius} > <Options options={options} /> </StyledSelect> </StyledInnerContainer> <RenderIf isTrue={bottomHelpText}> <HelpText>{bottomHelpText}</HelpText> </RenderIf> <RenderIf isTrue={error}> <ErrorText>{error}</ErrorText> </RenderIf> </StyledContainer> ); }
Sets blur on the element. @public
render
javascript
nexxtway/react-rainbow
src/components/Select/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Select/index.js
MIT
constructor(rootElement) { this.rootElement = rootElement; }
Create a new Select page object. @constructor @param {string} rootElement - The selector of the Select root element.
constructor
javascript
nexxtway/react-rainbow
src/components/Select/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Select/pageObject/index.js
MIT
async hasFocusSelect() { return $(this.rootElement) .$('select') .isFocused(); }
Returns true when the select element has focus. @method @returns {bool}
hasFocusSelect
javascript
nexxtway/react-rainbow
src/components/Select/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Select/pageObject/index.js
MIT
async isSelectedItem(itemPosition) { const items = await $(this.rootElement).$$('option'); if (items[itemPosition]) { return items[itemPosition].isSelected(); } return false; }
Returns true when the select item with item position is selected. @method @returns {bool} @param {number} itemPosition - The base 0 index of the select item.
isSelectedItem
javascript
nexxtway/react-rainbow
src/components/Select/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Select/pageObject/index.js
MIT
function ServerApplication(props) { const { children, className, style, locale, theme } = props; const contextValue = { locale: useLocale(locale) }; const [normalizedTheme, setTheme] = useState(() => normalizeTheme(theme)); useEffect(() => { setTheme(normalizeTheme(theme)); }, [theme]); return ( <Provider value={contextValue}> <ThemeProvider theme={normalizedTheme}> <div className={className} style={style}> {children} </div> </ThemeProvider> </Provider> ); }
This component is used to setup the React Rainbow context for a tree. Usually, this component will wrap an app's root component so that the entire app will be within the configured context. @category Layout
ServerApplication
javascript
nexxtway/react-rainbow
src/components/ServerApplication/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ServerApplication/index.js
MIT
ShowIf = ({ id, className, style, isTrue, inAnimation, outAnimation, children }) => { const [animation, setAnimation] = useState(); const [isVisible, setIsVisible] = useState(isTrue); const [dimensions, setDimensions] = useState(); const ref = useRef(); useLayoutEffect(() => { if (isTrue) { const rect = getElementBoundingClientRect(ref.current); setDimensions(rect); setIsVisible(true); setAnimation(`${inAnimation}In`); } else { setAnimation(`${outAnimation}Out`); } }, [isTrue, inAnimation, outAnimation]); const handleAnimationEnd = event => { if (event.animationName.includes('Out')) { setIsVisible(false); } }; return ( <AnimatedContainer id={id} className={className} style={style} animation={animation} isVisible={isVisible} dimensions={dimensions} onAnimationEnd={handleAnimationEnd} ref={ref} > {children} </AnimatedContainer> ); }
A component that shows its contents when a condition is met. Works similar to `RenderIf`, but `ShowIf` does not remove the elements from the DOM, and animates the content in and out.
ShowIf
javascript
nexxtway/react-rainbow
src/components/ShowIf/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/ShowIf/index.js
MIT