code
stringlengths
28
313k
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
74
language
stringclasses
1 value
repo
stringlengths
5
60
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
async hasTriggerFocus() { return (await $(this.rootElement).$('[role="combobox"] > button')).isFocused(); }
Returns true when the Add button has focus. @method @returns {bool}
hasTriggerFocus
javascript
nexxtway/react-rainbow
src/components/MultiSelect/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MultiSelect/pageObject/index.js
MIT
async hasInputFocus() { return (await $(this.rootElement).$('[role="textbox"]')).isFocused(); }
Returns true when the textbox input element has focus. @method @returns {bool}
hasInputFocus
javascript
nexxtway/react-rainbow
src/components/MultiSelect/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/MultiSelect/pageObject/index.js
MIT
function Notification(props) { const { className, style, icon, title, description, onRequestClose, hideCloseButton } = props; return ( <StyledContainer className={className} style={style}> <StyledAnchor> <RenderIf isTrue={icon}> <Icon icon={icon} /> </RenderIf> <span> <RenderIf isTrue={title}> <Title text={title} /> </RenderIf> <RenderIf isTrue={description}> <Description text={description} /> </RenderIf> </span> </StyledAnchor> <RenderIf isTrue={!hideCloseButton}> <StyledCloseButton icon={<CloseIcon />} size="small" title="Close" onClick={onRequestClose} /> </RenderIf> </StyledContainer> ); }
Notifications serve as a confirmation mechanism & feedback that comes into the page at the top.
Notification
javascript
nexxtway/react-rainbow
src/components/Notification/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Notification/index.js
MIT
function Option(props) { // eslint-disable-next-line react/jsx-props-no-spreading return <Consumer>{values => <OptionItem {...props} {...values} />}</Consumer>; }
This component represents a dropdown list with different options. It allows a user to select one among multiple options. @category Form
Option
javascript
nexxtway/react-rainbow
src/components/Option/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Option/index.js
MIT
constructor(rootElement, containerRect) { this.rootElement = rootElement; this.containerRect = containerRect; }
Create a new Option page object. @constructor @param {string} rootElement - The selector of the Option root element.
constructor
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 getLabel() { return (await this.rootElement.$('div[role="option"]')).getText(); }
Get the label of the Option. @method @returns {string}
getLabel
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 isActive() { return (await this.rootElement.$('div[aria-selected="true"]')).isExisting(); }
Returns true when the Option is active. @method @returns {bool}
isActive
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 isSelected() { return (await this.rootElement.getAttribute('data-selected')) === 'true'; }
Returns true when the Option is selected. @method @returns {bool}
isSelected
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 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 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
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
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 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
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
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
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
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
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
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
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
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
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
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
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
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
function Sidebar(props) { const { ariaLabel, style, selectedItem, onSelect, className, children, id, hideSelectedItemIndicator, } = props; const context = { selectedItem, onSelect, hideSelectedItemIndicator, }; return ( <StyledNav id={id} className={className} style={style} aria-label={ariaLabel}> <Provider value={context}> <StyledUl>{children}</StyledUl> </Provider> </StyledNav> ); }
The Sidebar component is a vertical bar that holds a list of SidebarItems. It helps users to jump from one site section to another without re-rendering the entire content on the page. Note that you have to compose the Sidebar with the SidebarItem component. @category Layout
Sidebar
javascript
nexxtway/react-rainbow
src/components/Sidebar/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Sidebar/index.js
MIT
async getItem(itemPosition) { const items = await $(this.rootElement).$$('li[data-id="sidebar-item-li"]'); if (items[itemPosition]) { return new PageSidebarItem( `${this.rootElement} li[data-id="sidebar-item-li"]:nth-child(${itemPosition + 1})`, ); } return null; }
Return a new SidebarItem page object of the element in item position. @method @param {number} itemPosition - The base 0 index of the sidebar item
getItem
javascript
nexxtway/react-rainbow
src/components/Sidebar/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Sidebar/pageObject/index.js
MIT
async isActive() { return $(this.rootElement) .$('[aria-current="page"]') .isExisting(); }
Return true when the sidebar item is active @method @returns {bool}
isActive
javascript
nexxtway/react-rainbow
src/components/SidebarItem/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/SidebarItem/pageObject/index.js
MIT
constructor(props) { super(props); this.sliderId = uniqueId('slider-id'); this.errorMessageId = uniqueId('error-message'); this.sliderRef = React.createRef(); }
An input range slider lets the user specify a numeric value which must be between two specified values. @category Form
constructor
javascript
nexxtway/react-rainbow
src/components/Slider/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Slider/index.js
MIT
function Spinner(props) { const { className, style, assistiveText, isVisible, size, variant, type, children } = props; const currentSize = getSizeValue(size); if (isVisible) { if (type === 'arc') { return ( <StyledSpinnerContainer className={className} style={style}> <StyledArcSpinner viewBox={`${0} ${0} ${currentSize} ${currentSize}`} size={size} variant={variant} > <circle className="path" cx={currentSize / 2} cy={currentSize / 2} r={(currentSize - 3) / 2} fill="none" strokeWidth="3" /> </StyledArcSpinner> <StyledChildContainer>{children}</StyledChildContainer> <AssistiveText text={assistiveText} /> </StyledSpinnerContainer> ); } return ( <StyledCircleSpinner className={className} size={size} variant={variant} style={style}> <div /> <div /> <div /> <div /> <div /> <div /> <div /> <div /> <StyledChildContainer>{children}</StyledChildContainer> <AssistiveText text={assistiveText} /> </StyledCircleSpinner> ); } return null; }
Spinners should be shown when retrieving data or performing slow, help to reassure the user that the system is actively retrieving data.
Spinner
javascript
nexxtway/react-rainbow
src/components/Spinner/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Spinner/index.js
MIT
async hasFocus() { return $(this.rootElement) .$('button[role="tab"]') .isFocused(); }
Returns true when the tab item has focus. @method @returns {bool}
hasFocus
javascript
nexxtway/react-rainbow
src/components/Tab/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tab/pageObject/index.js
MIT
async isSelected() { return !!(await $(this.rootElement) .$('button[role="tab"]') .getAttribute('data-active')); }
Returns true when the tab item is selected. @method @returns {bool}
isSelected
javascript
nexxtway/react-rainbow
src/components/Tab/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tab/pageObject/index.js
MIT
async isVisibleWithinViewport() { return $(this.rootElement) .$('button[role="tab"]') .isDisplayedInViewport(); }
Returns true when the tab item is visible in the viewport. @method @returns {bool}
isVisibleWithinViewport
javascript
nexxtway/react-rainbow
src/components/Tab/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tab/pageObject/index.js
MIT
async getLabelText() { return $(this.rootElement).getText(); }
Returns the text of the tab item. @method @returns {string}
getLabelText
javascript
nexxtway/react-rainbow
src/components/Tab/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tab/pageObject/index.js
MIT
constructor(props) { super(props); const { children, showCheckboxColumn, keyField, data, showRowNumberColumn, rowNumberOffset, maxRowSelection, minColumnWidth, maxColumnWidth, selectedRows, variant, } = props; this.state = { columns: getColumns({ children, showCheckboxColumn, showRowNumberColumn, rowNumberOffset, minColumnWidth, maxColumnWidth, variant, }), tableWidth: undefined, rows: getRows({ keyField, rows: normalizeData(data), maxRowSelection: maxRowSelection && Number(maxRowSelection), selectedRowsKeys: {}, }), bulkSelection: 'none', }; const { rows } = this.state; this.indexes = getIndexes(rows); this.selectedRowsKeys = getSelectedRowKeysFromSelectedRows(selectedRows, this.indexes); this.tableId = uniqueId('table'); this.tableContainerRef = React.createRef(); this.resizeTarget = React.createRef(); this.handleSort = this.handleSort.bind(this); this.handleResize = this.handleResize.bind(this); this.updateColumnsAndTableWidth = this.updateColumnsAndTableWidth.bind(this); this.handleSelectRow = this.handleSelectRow.bind(this); this.handleDeselectRow = this.handleDeselectRow.bind(this); this.handleSelectAllRows = this.handleSelectAllRows.bind(this); this.handleDeselectAllRows = this.handleDeselectAllRows.bind(this); this.scrollableY = React.createRef(); }
A table lists a collection of data that makes sense when displays them in rows and columns. The data contained in a table is easier to read due to the format, so it can be useful to sort, search, and filter your data. @category DataView
constructor
javascript
nexxtway/react-rainbow
src/components/Table/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Table/index.js
MIT
scrollTop() { this.scrollableY.current.scrollTop = 0; }
It will scroll to the top of the Y scrollable container. @public
scrollTop
javascript
nexxtway/react-rainbow
src/components/Table/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Table/index.js
MIT
async selectAllRows() { const headCheckbox = await $(this.rootElement) .$('thead') .$(HEAD_CHECKBOX_INPUT_SELECTOR); if ( !(await headCheckbox.isSelected()) && !(await headCheckbox.getAttribute('indeterminate')) ) { await $(this.rootElement) .$('thead') .$(HEAD_CHECKBOX_LABEL_SELECTOR) .click(); } }
Clicks the head checkbox to select the maximum selectable rows. @method
selectAllRows
javascript
nexxtway/react-rainbow
src/components/Table/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Table/pageObject/index.js
MIT
async deselectAllRows() { const headCheckbox = await $(this.rootElement) .$('thead') .$(HEAD_CHECKBOX_INPUT_SELECTOR); if ( (await headCheckbox.isSelected()) || (await headCheckbox.getAttribute('indeterminate')) ) { await $(this.rootElement) .$('thead') .$(HEAD_CHECKBOX_LABEL_SELECTOR) .click(); } }
Clicks the head checkbox to deselect all selected rows. @method
deselectAllRows
javascript
nexxtway/react-rainbow
src/components/Table/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Table/pageObject/index.js
MIT
async getRow(rowPosition) { const rows = await $(this.rootElement).$$('tbody > tr[data-id="table_body-row"]'); if (rows[rowPosition]) { return new PageTableRow( `${this.rootElement} tr[data-id="table_body-row"]:nth-child(${rowPosition + 1})`, ); } return null; }
Returns a new Row page object of the row in the position passed. @method @param {number} rowPosition - The base 0 index of the row item.
getRow
javascript
nexxtway/react-rainbow
src/components/Table/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Table/pageObject/index.js
MIT
async waitUntilDataIsLoaded() { await browser.waitUntil( async () => !(await $(this.rootElement) .$('div[data-id="table_body--loading"]') .isDisplayed()) && (await $(this.rootElement) .$('tr[data-id="table_body-row"]') .isDisplayed()), ); }
Wait until the data is loaded. @method
waitUntilDataIsLoaded
javascript
nexxtway/react-rainbow
src/components/Table/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Table/pageObject/index.js
MIT
async selectRow() { if (!(await this.isRowSelected())) { await $(this.rootElement) .$(CHECKBOX_LABEL_SELECTOR) .click(); } }
Clicks the row to select. @method
selectRow
javascript
nexxtway/react-rainbow
src/components/Table/pageObject/row.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Table/pageObject/row.js
MIT
async isRowSelected() { return $(this.rootElement) .$(CHECKBOX_INPUT_SELECTOR) .isSelected(); }
Returns true when the row is selected. @method @returns {bool}
isRowSelected
javascript
nexxtway/react-rainbow
src/components/Table/pageObject/row.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Table/pageObject/row.js
MIT
async isRowSelectionDisabled() { return !(await $(this.rootElement) .$(CHECKBOX_INPUT_SELECTOR) .isEnabled()); }
Returns true when the row input is disabled. @method @returns {bool}
isRowSelectionDisabled
javascript
nexxtway/react-rainbow
src/components/Table/pageObject/row.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Table/pageObject/row.js
MIT
constructor(props) { super(props); const { data, pageSize } = props; this.state = { activePage: 1, pageItems: getPageItems({ data, activePage: 1, pageSize, }), }; this.handleChange = this.handleChange.bind(this); this.handleSelectChange = this.handleSelectChange.bind(this); this.table = React.createRef(); }
This component implements a client-side pagination experience. Basically, it wires up the Table and the Pagination components in a composed manner and keeps the internal state of the active page based on a new prop pageSize. @category DataView
constructor
javascript
nexxtway/react-rainbow
src/components/TableWithBrowserPagination/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TableWithBrowserPagination/index.js
MIT
constructor(props) { super(props); this.state = { key: Date.now(), areButtonsVisible: false, }; this.isFirstTime = true; this.tabsetRef = React.createRef(); this.resizeTarget = React.createRef(); this.registerTab = this.registerTab.bind(this); this.unRegisterTab = this.unRegisterTab.bind(this); this.updateTab = this.updateTab.bind(this); this.handleKeyPressed = this.handleKeyPressed.bind(this); this.handleLeftButtonClick = this.handleLeftButtonClick.bind(this); this.handleRightButtonClick = this.handleRightButtonClick.bind(this); this.updateButtonsVisibility = this.updateButtonsVisibility.bind(this); this.handleSelect = this.handleSelect.bind(this); this.keyHandlerMap = { [RIGHT_KEY]: () => this.selectTab(RIGHT_SIDE), [LEFT_KEY]: () => this.selectTab(LEFT_SIDE), }; this.tabsetChildren = []; }
Tabs make it easy to explore and switch between different views. @category Layout
constructor
javascript
nexxtway/react-rainbow
src/components/Tabset/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tabset/index.js
MIT
async getItem(itemPosition) { const items = await $(this.rootElement).$$('li[role="presentation"]'); if (items[itemPosition]) { return new PageTab( `${this.rootElement} li[role="presentation"]:nth-child(${itemPosition + 1})`, ); } return null; }
Returns a new Tab page object of the element in item position. @method @param {number} itemPosition - The base 0 index of the tab item.
getItem
javascript
nexxtway/react-rainbow
src/components/Tabset/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tabset/pageObject/index.js
MIT
async isButtonsVisible() { const buttons = await $(this.rootElement).$$(BUTTON_SELECTOR); if (buttons && buttons.length) { return browser.waitUntil( async () => (await buttons[0].isDisplayed()) && (await buttons[1].isDisplayed()), ); } return false; }
Returns true when buttons are visible. @method @returns {bool}
isButtonsVisible
javascript
nexxtway/react-rainbow
src/components/Tabset/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tabset/pageObject/index.js
MIT
async isLeftButtonEnabled() { return $(this.rootElement) .$$(BUTTON_SELECTOR)[0] .isEnabled(); }
Returns true when the left button is enabled. @method @returns {bool}
isLeftButtonEnabled
javascript
nexxtway/react-rainbow
src/components/Tabset/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tabset/pageObject/index.js
MIT
async isRightButtonEnabled() { return $(this.rootElement) .$$(BUTTON_SELECTOR)[1] .isEnabled(); }
Returns true when the right button is enabled. @method @returns {bool}
isRightButtonEnabled
javascript
nexxtway/react-rainbow
src/components/Tabset/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tabset/pageObject/index.js
MIT
async clickLeftButton() { return $(this.rootElement) .$$(BUTTON_SELECTOR)[0] .click(); }
Click the left button. @method @returns {bool}
clickLeftButton
javascript
nexxtway/react-rainbow
src/components/Tabset/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tabset/pageObject/index.js
MIT
async clickRightButton() { return $(this.rootElement) .$$(BUTTON_SELECTOR)[1] .click(); }
Click the right button. @method @returns {bool}
clickRightButton
javascript
nexxtway/react-rainbow
src/components/Tabset/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tabset/pageObject/index.js
MIT
constructor(props) { super(props); this.textareaRef = React.createRef(); this.textareaId = uniqueId('textarea'); this.inlineTextLabelId = uniqueId('inline-text-label'); this.errorMessageId = uniqueId('error-message'); this.updateFocus = this.updateFocus.bind(this); this.state = { isFocused: false, }; }
Textarea inputs are used for freeform data entry. @category Form
constructor
javascript
nexxtway/react-rainbow
src/components/Textarea/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Textarea/index.js
MIT
async hasFocusTextarea() { return $(this.rootElement) .$('textarea') .isFocused(); }
Returns true when the textarea element has focus. @method @returns {bool}
hasFocusTextarea
javascript
nexxtway/react-rainbow
src/components/Textarea/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Textarea/pageObject/index.js
MIT
async setValue(value) { await $(this.rootElement) .$('textarea') .setValue(value); }
It set a value in the textarea. @method @param {string} values - The value to set in the textarea.
setValue
javascript
nexxtway/react-rainbow
src/components/Textarea/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Textarea/pageObject/index.js
MIT
async getValue() { return $(this.rootElement) .$('textarea') .getValue(); }
It get the value of the textarea. @method @returns {string}
getValue
javascript
nexxtway/react-rainbow
src/components/Textarea/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Textarea/pageObject/index.js
MIT
function TimelineMarker(props) { const context = useContext(ActivityTimelineContext); if (context) { // eslint-disable-next-line react/jsx-props-no-spreading return <AccordionTimelineMarker {...props} />; } // eslint-disable-next-line react/jsx-props-no-spreading return <BasicTimelineMarker {...props} />; }
The TimelineMarker displays one event of an item's timeline. It's generally used to compose the ActivityTimeline component. @category Layout
TimelineMarker
javascript
nexxtway/react-rainbow
src/components/TimelineMarker/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimelineMarker/index.js
MIT
getTriggerInputValue = () => { return getInputValue(value, placeholder, hour24); }
A TimePicker is used to input a time by displaying an interface the user can interact with. @category Form
getTriggerInputValue
javascript
nexxtway/react-rainbow
src/components/TimePicker/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/index.js
MIT
async clickUpButton() { await $(timePickerModalId) .$('button[id="time-picker_up-button"]') .click(); }
Clicks the up button element. @method
clickUpButton
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async clickDownButton() { await $(timePickerModalId) .$('button[id="time-picker_down-button"]') .click(); }
Clicks the down button element. @method
clickDownButton
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async clickCancelButton() { await $(timePickerModalId) .$('button[id="time-picker_cancel-button"]') .click(); }
Clicks the cancel button element. @method
clickCancelButton
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async clickOkButton() { await $(timePickerModalId) .$('button[id="time-picker_ok-button"]') .click(); }
Clicks the OK button element. @method
clickOkButton
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async isOpen() { return ( (await $(timePickerModalId).isDisplayed()) && (await (await $(timePickerModalId).$( 'button[id="time-picker_cancel-button"]', )).isDisplayed()) && (await (await $(timePickerModalId).$( 'button[id="time-picker_ok-button"]', )).isDisplayed()) && (await (await $(timePickerModalId).$( 'button[id="time-picker_up-button"]', )).isDisplayed()) && (await (await $(timePickerModalId).$( 'button[id="time-picker_down-button"]', )).isDisplayed()) && (await (await $(timePickerModalId).$('input[data-id="minutes"]')).isDisplayed()) && (await (await $(timePickerModalId).$('input[data-id="hour"]')).isDisplayed()) && (await (await $(timePickerModalId).$( 'input[aria-label="am-pm selector"]', )).isDisplayed()) ); }
Returns true when the TimePicker is open. @method @returns {bool}
isOpen
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async getTimeValue() { return $(this.rootElement) .$(timeInputId) .$('input') .getValue(); }
Get the TimePicker value. @method @returns {string}
getTimeValue
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async hasFocusTimeInput() { return $(this.rootElement) .$(timeInputId) .$('input') .isFocused(); }
Returns true when the TimePicker has focus. @method @returns {bool}
hasFocusTimeInput
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async hasFocusHourInput() { return $(timePickerModalId) .$('input[data-id="hour"]') .isFocused(); }
Returns true when the hour input has focus. @method @returns {bool}
hasFocusHourInput
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async getHourValue() { return $(timePickerModalId) .$('input[data-id="hour"]') .getValue(); }
Get the hour input value. @method @returns {string}
getHourValue
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async hasFocusMinutesInput() { return $(timePickerModalId) .$('input[data-id="minutes"]') .isFocused(); }
Returns true when the minutes input has focus. @method @returns {bool}
hasFocusMinutesInput
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async getMinutesValue() { return $(timePickerModalId) .$('input[data-id="minutes"]') .getValue(); }
Get the minutes input value. @method @returns {string}
getMinutesValue
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async hasFocusAmPmSelect() { return $(timePickerModalId) .$('fieldset[role="presentation"]') .isFocused(); }
Returns true when the am-pm selector has focus. @method @returns {bool}
hasFocusAmPmSelect
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async isAmSelected() { await browser.waitUntil(async () => $(timePickerModalId) .$('fieldset[role="presentation"]') .isFocused(), ); return $(timePickerModalId) .$('input[value="AM"]') .isSelected(); }
Returns true when the am input is selected. @method @returns {bool}
isAmSelected
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async isPmSelected() { await browser.waitUntil(async () => $(timePickerModalId) .$('fieldset[role="presentation"]') .isFocused(), ); return $(timePickerModalId) .$('input[value="PM"]') .isSelected(); }
Returns true when the pm input is selected. @method @returns {bool}
isPmSelected
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async setHourValue(value) { await $(timePickerModalId) .$('input[data-id="hour"]') .setValue(value); }
Type in the hour input element. @method @param {string} value - The value to type in the hour input element.
setHourValue
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async setMinutesValue(value) { await $(timePickerModalId) .$('input[data-id="minutes"]') .setValue(value); }
Type in the minutes input element. @method @param {string} value - The value to type in the minutes input element.
setMinutesValue
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
async waitUntilOpen() { await browser.waitUntil(async () => this.isOpen()); }
Wait until the TimePicker is open. @method
waitUntilOpen
javascript
nexxtway/react-rainbow
src/components/TimePicker/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/TimePicker/pageObject/index.js
MIT
function Tree(props) { const { data, onNodeExpand, onNodeCheck, onNodeSelect, selectedNode, className, style, id, ariaLabel, ariaLabelledBy, } = props; const visibleNodes = useTreeNodesAsPlainList(data); const { autoFocus, focusedNode, setFocusedNode, clearFocusedNode, keyDownHandler, } = useKeyNavigation({ visibleNodes, selectedNode, onNodeSelect, onNodeExpand, }); const treeData = Array.isArray(data) ? data : []; return ( <Provider value={{ autoFocus, focusedNode, onPrivateFocusNode: setFocusedNode, onPrivateBlurNode: clearFocusedNode, onPrivateKeyDown: keyDownHandler, }} > <TreeContainerUl className={className} style={style} id={id} role="tree" aria-labelledby={ariaLabelledBy} aria-label={ariaLabel} > <TreeChildren data={treeData} onNodeExpand={onNodeExpand} onNodeCheck={onNodeCheck} nodePath={[]} selectedNode={selectedNode} onNodeSelect={onNodeSelect} /> </TreeContainerUl> </Provider> ); }
A Tree is visualization of a structure hierarchy with nested elements. A branch can be expanded or collapsed or selected. This is a BETA version. @category Layout
Tree
javascript
nexxtway/react-rainbow
src/components/Tree/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tree/index.js
MIT
async getNode(path) { const nodePath = path.join('.'); const node = await $(this.rootElement).$(`[data-path="${nodePath}"]`); if (node) { return new PageNodeItem(`${this.rootElement} [data-path="${nodePath}"]`); } return null; }
Returns a new Node page object of the element at specified path. @method @param {array} path - Array with 0 base indexes that defines the node path in tree.
getNode
javascript
nexxtway/react-rainbow
src/components/Tree/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tree/pageObject/index.js
MIT
async hasFocus() { const nodeEl = $(this.rootElement); return (await nodeEl.isExisting()) && nodeEl.isFocused(); }
Returns true when the li has focus. @method @returns {bool}
hasFocus
javascript
nexxtway/react-rainbow
src/components/Tree/pageObject/node.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tree/pageObject/node.js
MIT
async isExpanded() { const childEl = await $(this.rootElement).$('[data-id="node-element-li"]'); return (await childEl.isExisting()) && childEl.isDisplayed(); }
Returns true when the node is expanded, false otherwise. @method @returns {bool}
isExpanded
javascript
nexxtway/react-rainbow
src/components/Tree/pageObject/node.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tree/pageObject/node.js
MIT
async isSelected() { return (await $(this.rootElement).getAttribute('aria-selected')) === 'true'; }
Returns true when the node is selected, false otherwise. @method @returns {bool}
isSelected
javascript
nexxtway/react-rainbow
src/components/Tree/pageObject/node.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/Tree/pageObject/node.js
MIT
function VerticalItem(props) { return ( <NavigationConsumer> {context => ( <SectionConsumer> {entityHeaderId => ( <SectionOverflowConsumer> {isExpanded => ( <Item {...props} {...context} entityHeaderId={entityHeaderId} isExpanded={isExpanded} /> )} </SectionOverflowConsumer> )} </SectionConsumer> )} </NavigationConsumer> ); }
A text-only link within VerticalNavigationSection or VerticalNavigationOverflow. @category Layout
VerticalItem
javascript
nexxtway/react-rainbow
src/components/VerticalItem/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/VerticalItem/index.js
MIT
async hasFocus() { return $(this.rootElement) .$('[data-id="vertical-item-clickable-element"]') .isFocused(); }
Returns true when the vertical item has focus. @method @returns {bool}
hasFocus
javascript
nexxtway/react-rainbow
src/components/VerticalItem/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/VerticalItem/pageObject/index.js
MIT
async isSelected() { return !!(await $(this.rootElement).getAttribute('data-active')); }
Returns true when the vertical item is selected. @method @returns {bool}
isSelected
javascript
nexxtway/react-rainbow
src/components/VerticalItem/pageObject/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/VerticalItem/pageObject/index.js
MIT
function VerticalNavigation(props) { const { id, ariaLabel, style, selectedItem, onSelect, compact, shaded, className, children, } = props; const context = { selectedItem, onSelect, }; return ( <StyledNav id={id} className={className} style={style} aria-label={ariaLabel} compact={compact} shaded={shaded} > <Provider value={context}>{children}</Provider> </StyledNav> ); }
Navigation represents a list of links that either take the user to another page or parts of the page the user is in. @category Layout
VerticalNavigation
javascript
nexxtway/react-rainbow
src/components/VerticalNavigation/index.js
https://github.com/nexxtway/react-rainbow/blob/master/src/components/VerticalNavigation/index.js
MIT