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 isP... | 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}>
<St... | 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 privateRegis... | 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,
privateUpdateH... | 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(v... | 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(v... | 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 = Reac... | 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 ... | 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) {
... | 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,... | 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) &&
... | 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,
... | 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}
... | 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={... | 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)... | 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,
number... | 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: ... | 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.offsetWidt... | 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.p... | 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[da... | 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;
retu... | 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(${it... | 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,
... | 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]);
... | 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) {... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.