Created
July 9, 2021 09:50
-
-
Save vjsolanki/1c29af5aa60ff69885e5b229bd6f93e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { createContext, useContext, useMemo, useState, useRef, useLayoutEffect, useEffect } from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| function _extends() { | |
| _extends = Object.assign || function (target) { | |
| for (var i = 1; i < arguments.length; i++) { | |
| var source = arguments[i]; | |
| for (var key in source) { | |
| if (Object.prototype.hasOwnProperty.call(source, key)) { | |
| target[key] = source[key]; | |
| } | |
| } | |
| } | |
| return target; | |
| }; | |
| return _extends.apply(this, arguments); | |
| } | |
| function _objectWithoutPropertiesLoose(source, excluded) { | |
| if (source == null) return {}; | |
| var target = {}; | |
| var sourceKeys = Object.keys(source); | |
| var key, i; | |
| for (i = 0; i < sourceKeys.length; i++) { | |
| key = sourceKeys[i]; | |
| if (excluded.indexOf(key) >= 0) continue; | |
| target[key] = source[key]; | |
| } | |
| return target; | |
| } | |
| function createCommonjsModule(fn, module) { | |
| return module = { exports: {} }, fn(module, module.exports), module.exports; | |
| } | |
| var classnames = createCommonjsModule(function (module) { | |
| /*! | |
| Copyright (c) 2018 Jed Watson. | |
| Licensed under the MIT License (MIT), see | |
| http://jedwatson.github.io/classnames | |
| */ | |
| /* global define */ | |
| (function () { | |
| var hasOwn = {}.hasOwnProperty; | |
| function classNames() { | |
| var classes = []; | |
| for (var i = 0; i < arguments.length; i++) { | |
| var arg = arguments[i]; | |
| if (!arg) continue; | |
| var argType = typeof arg; | |
| if (argType === 'string' || argType === 'number') { | |
| classes.push(arg); | |
| } else if (Array.isArray(arg)) { | |
| if (arg.length) { | |
| var inner = classNames.apply(null, arg); | |
| if (inner) { | |
| classes.push(inner); | |
| } | |
| } | |
| } else if (argType === 'object') { | |
| if (arg.toString === Object.prototype.toString) { | |
| for (var key in arg) { | |
| if (hasOwn.call(arg, key) && arg[key]) { | |
| classes.push(key); | |
| } | |
| } | |
| } else { | |
| classes.push(arg.toString()); | |
| } | |
| } | |
| } | |
| return classes.join(' '); | |
| } | |
| if ( module.exports) { | |
| classNames.default = classNames; | |
| module.exports = classNames; | |
| } else { | |
| window.classNames = classNames; | |
| } | |
| }()); | |
| }); | |
| var mapBtnVariantToClassnames = { | |
| solid: 'ansh-btn--solid', | |
| ghost: 'ansh-btn--ghost', | |
| outline: 'ansh-btn--outline' | |
| }; | |
| var mapBtnSizeToClassnames = { | |
| small: 'ansh-btn--sm', | |
| medium: 'ansh-btn--md' | |
| }; | |
| var mapBtnColorToClassnames = { | |
| primary: 'ansh-btn--primary', | |
| secondary: 'ansh-btn--secondary', | |
| success: 'ansh-btn--success', | |
| danger: 'ansh-btn--danger', | |
| warning: 'ansh-btn--warning', | |
| info: 'ansh-btn--info' | |
| }; | |
| var YAPButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) { | |
| var _cx; | |
| var className = _ref.className, | |
| _ref$fullWidth = _ref.fullWidth, | |
| fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth, | |
| _ref$selected = _ref.selected, | |
| selected = _ref$selected === void 0 ? false : _ref$selected, | |
| _ref$disabled = _ref.disabled, | |
| disabled = _ref$disabled === void 0 ? false : _ref$disabled, | |
| leftComponent = _ref.leftComponent, | |
| rightComponent = _ref.rightComponent, | |
| _ref$size = _ref.size, | |
| size = _ref$size === void 0 ? 'medium' : _ref$size, | |
| _ref$variant = _ref.variant, | |
| variant = _ref$variant === void 0 ? 'solid' : _ref$variant, | |
| _ref$color = _ref.color, | |
| color = _ref$color === void 0 ? 'primary' : _ref$color, | |
| children = _ref.children, | |
| dataQaSelector = _ref.dataQaSelector, | |
| props = _objectWithoutPropertiesLoose(_ref, ["className", "fullWidth", "selected", "disabled", "leftComponent", "rightComponent", "size", "variant", "color", "children", "dataQaSelector"]); | |
| var sizeClass = mapBtnSizeToClassnames[size]; | |
| var variantClass = mapBtnVariantToClassnames[variant]; | |
| var colorClass = mapBtnColorToClassnames[color]; | |
| var btnClassnames = classnames((_cx = { | |
| 'ansh-btn ansh-h6': true | |
| }, _cx[sizeClass] = true, _cx[variantClass] = true, _cx[colorClass] = true, _cx['ansh-btn--selected'] = selected, _cx['ansh-btn--full-width'] = fullWidth, _cx[className] = Boolean(className), _cx)); | |
| return /*#__PURE__*/React.createElement("button", _extends({ | |
| ref: ref, | |
| disabled: disabled, | |
| className: btnClassnames, | |
| "data-qa-selector": dataQaSelector | |
| }, props), leftComponent ? /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-btn--component ansh-btn--component-left" | |
| }, leftComponent) : null, /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-btn--label" | |
| }, children), rightComponent ? /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-btn--component ansh-btn--component-right" | |
| }, rightComponent) : null); | |
| }); | |
| var FormControlContext = /*#__PURE__*/createContext(); | |
| var useFormControl = function useFormControl() { | |
| var formControlContext = useContext(FormControlContext); | |
| var context = useMemo(function () { | |
| return formControlContext; | |
| }, [formControlContext]); | |
| return context; | |
| }; | |
| var YAPInput = function YAPInput(_ref) { | |
| var _cx; | |
| var leftAddon = _ref.leftAddon, | |
| rightAddon = _ref.rightAddon, | |
| leftComponent = _ref.leftComponent, | |
| rightComponent = _ref.rightComponent, | |
| readOnly = _ref.readOnly, | |
| disabled = _ref.disabled, | |
| id = _ref.id, | |
| name = _ref.name, | |
| value = _ref.value, | |
| _ref$placeholder = _ref.placeholder, | |
| placeholder = _ref$placeholder === void 0 ? 'Please type something...' : _ref$placeholder, | |
| onChange = _ref.onChange, | |
| invalid = _ref.invalid, | |
| className = _ref.className, | |
| dataQaSelector = _ref.dataQaSelector, | |
| onFocus = _ref.onFocus, | |
| onBlur = _ref.onBlur, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["leftAddon", "rightAddon", "leftComponent", "rightComponent", "readOnly", "disabled", "id", "name", "value", "placeholder", "onChange", "invalid", "className", "dataQaSelector", "onFocus", "onBlur"]); | |
| var _useState = useState(false), | |
| isInputFocused = _useState[0], | |
| setInputFocused = _useState[1]; | |
| var contextValues = useFormControl(); | |
| var inputId = id !== undefined ? id : contextValues ? contextValues.id : undefined; | |
| var isInvalidInput = contextValues ? contextValues.invalid : invalid; | |
| var inputClassnames = classnames((_cx = { | |
| 'ansh-input ansh-body': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var inputWrapperClassnames = classnames({ | |
| 'ansh-input-wrapper': true, | |
| focused: isInputFocused, | |
| disabled: disabled, | |
| 'read-only': readOnly | |
| }); | |
| function handleInputFocus(event) { | |
| setInputFocused(true); | |
| onFocus && onFocus(event); | |
| } | |
| function handleInputBlur(event) { | |
| setInputFocused(false); | |
| onBlur && onBlur(event); | |
| } | |
| return /*#__PURE__*/React.createElement("div", { | |
| className: inputClassnames, | |
| "data-invalid": isInvalidInput | |
| }, leftAddon ? /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-input--left-addon" | |
| }, leftAddon) : null, /*#__PURE__*/React.createElement("div", { | |
| className: inputWrapperClassnames | |
| }, leftComponent ? /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-input-wrapper--left-component" | |
| }, leftComponent) : null, /*#__PURE__*/React.createElement("input", _extends({ | |
| name: name, | |
| value: value, | |
| id: inputId, | |
| placeholder: placeholder, | |
| onChange: onChange, | |
| onFocus: handleInputFocus, | |
| onBlur: handleInputBlur, | |
| className: "ansh-input-wrapper--field", | |
| "aria-describedby": inputId + "-helptext", | |
| "data-qa-selector": dataQaSelector, | |
| readOnly: readOnly, | |
| disabled: disabled | |
| }, rest)), rightComponent ? /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-input-wrapper--right-component" | |
| }, rightComponent) : null), rightAddon ? /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-input--right-addon" | |
| }, rightAddon) : null); | |
| }; | |
| var YAPIcon = function YAPIcon(_ref) { | |
| var _ref$viewBox = _ref.viewBox, | |
| viewBox = _ref$viewBox === void 0 ? '0 0 24 24' : _ref$viewBox, | |
| children = _ref.children, | |
| _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '20' : _ref$width, | |
| _ref$fill = _ref.fill, | |
| fill = _ref$fill === void 0 ? 'currentColor' : _ref$fill, | |
| focusable = _ref.focusable, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["viewBox", "children", "width", "height", "fill", "focusable"]); | |
| return /*#__PURE__*/React.createElement("svg", _extends({ | |
| viewBox: viewBox, | |
| width: width, | |
| height: width, | |
| fill: fill, | |
| focusable: focusable | |
| }, rest), children); | |
| }; | |
| var PlusIcon = function PlusIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "M0,12a1.5,1.5,0,0,0,1.5,1.5h8.75a.25.25,0,0,1,.25.25V22.5a1.5,1.5,0,0,0,3,0V13.75a.25.25,0,0,1,.25-.25H22.5a1.5,1.5,0,0,0,0-3H13.75a.25.25,0,0,1-.25-.25V1.5a1.5,1.5,0,0,0-3,0v8.75a.25.25,0,0,1-.25.25H1.5A1.5,1.5,0,0,0,0,12Z" | |
| }))); | |
| }; | |
| var PlusSquaredIcon = function PlusSquaredIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m20 0c2.209139 0 4 1.790861 4 4v16c0 2.209139-1.790861 4-4 4h-16c-2.209139 0-4-1.790861-4-4v-16c0-2.209139 1.790861-4 4-4zm0 2h-16c-1.1045695 0-2 .8954305-2 2v16c0 1.1045695.8954305 2 2 2h16c1.1045695 0 2-.8954305 2-2v-16c0-1.1045695-.8954305-2-2-2zm-14 9h12c.5522847 0 1 .4477153 1 1s-.4477153 1-1 1h-12c-.55228475 0-1-.4477153-1-1s.44771525-1 1-1zm6-6c.5522847 0 1 .44771525 1 1v12c0 .5522847-.4477153 1-1 1s-1-.4477153-1-1v-12c0-.55228475.4477153-1 1-1z" | |
| }))); | |
| }; | |
| var MinusIcon = function MinusIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("rect", { | |
| height: "4", | |
| width: "20", | |
| x: "2", | |
| y: "10" | |
| }))); | |
| }; | |
| var MinusSquaredIcon = function MinusSquaredIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m20 0c2.209139 0 4 1.790861 4 4v16c0 2.209139-1.790861 4-4 4h-16c-2.209139 0-4-1.790861-4-4v-16c0-2.209139 1.790861-4 4-4zm0 2h-16c-1.1045695 0-2 .8954305-2 2v16c0 1.1045695.8954305 2 2 2h16c1.1045695 0 2-.8954305 2-2v-16c0-1.1045695-.8954305-2-2-2zm-14 9h12c.5522847 0 1 .4477153 1 1s-.4477153 1-1 1h-12c-.55228475 0-1-.4477153-1-1s.44771525-1 1-1z" | |
| }))); | |
| }; | |
| var ArrowBackIcon = function ArrowBackIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" | |
| }))); | |
| }; | |
| var ArrowDownIcon = function ArrowDownIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z" | |
| }))); | |
| }; | |
| var ArrowForwardIcon = function ArrowForwardIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z" | |
| }))); | |
| }; | |
| var ArrowUpIcon = function ArrowUpIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z" | |
| }))); | |
| }; | |
| var AtSignIcon = function AtSignIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "M12,.5A11.634,11.634,0,0,0,.262,12,11.634,11.634,0,0,0,12,23.5a11.836,11.836,0,0,0,6.624-2,1.25,1.25,0,1,0-1.393-2.076A9.34,9.34,0,0,1,12,21a9.132,9.132,0,0,1-9.238-9A9.132,9.132,0,0,1,12,3a9.132,9.132,0,0,1,9.238,9v.891a1.943,1.943,0,0,1-3.884,0V12A5.355,5.355,0,1,0,12,17.261a5.376,5.376,0,0,0,3.861-1.634,4.438,4.438,0,0,0,7.877-2.736V12A11.634,11.634,0,0,0,12,.5Zm0,14.261A2.763,2.763,0,1,1,14.854,12,2.812,2.812,0,0,1,12,14.761Z" | |
| }))); | |
| }; | |
| var SearchIcon = function SearchIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "M23.384,21.619,16.855,15.09a9.284,9.284,0,1,0-1.768,1.768l6.529,6.529a1.266,1.266,0,0,0,1.768,0A1.251,1.251,0,0,0,23.384,21.619ZM2.75,9.5a6.75,6.75,0,1,1,6.75,6.75A6.758,6.758,0,0,1,2.75,9.5Z" | |
| }))); | |
| }; | |
| var SpinnerIcon = function SpinnerIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fillRule: "evenodd" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m11.988 0c6.636 0 12.012 5.376 12.012 12s-5.376 12-12.012 12c-6.624 0-11.988-5.376-11.988-12s5.364-12 11.988-12zm.012 2c-5.525 0-10 4.475-10 10s4.475 10 10 10 10-4.475 10-10-4.475-10-10-10z", | |
| fillOpacity: ".2" | |
| }), /*#__PURE__*/React.createElement("path", { | |
| d: "m24 12c0-6.624-5.364-12-12-12-1.5 0-1.5 2 0 2 6 0 10 5 10 10 0 1.5 2 1.5 2 0z" | |
| }))); | |
| }; | |
| var TimeIcon = function TimeIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m12 22c5.5228475 0 10-4.4771525 10-10s-4.4771525-10-10-10-10 4.4771525-10 10 4.4771525 10 10 10zm0-22c6.627417 0 12 5.372583 12 12s-5.372583 12-12 12-12-5.372583-12-12 5.372583-12 12-12zm1 5h-2v6h-6v2h6v6h2v-6h6v-2h-6z" | |
| }))); | |
| }; | |
| var UserIcon = function UserIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m12 0c-6.624 0-12 5.376-12 12s5.376 12 12 12 12-5.376 12-12-5.376-12-12-12zm-7 19.5c.516-1.08 4.744-2.5 7-2.5s6.496 1.42 7 2.5c-1.632 1.296-3.5 2.5-7 2.5s-5.5-1-7-2.5zm14.95-1.5c-1.7875-2.1699143-6.125-3-7.95-3s-6.2125.8300857-8 3c-1.275-1.6710834-2-3.7537023-2-6.0233827 0-5.49961029 4.4875-9.9766173 10-9.9766173s10 4.47700701 10 9.9766173c0 2.2696804-.725 4.3522993-2 6.0233827zm-7.95-13c-2.21714286 0-4 1.78285714-4 4 0 2.2171429 1.78285714 4 4 4 2.2171429 0 4-1.7828571 4-4 0-2.21714286-1.7828571-4-4-4zm0 6c-1.1066667 0-2-.8933333-2-2 0-1.10666667.8933333-2 2-2s2 .89333333 2 2c0 1.1066667-.8933333 2-2 2z" | |
| }))); | |
| }; | |
| var KeyIcon = function KeyIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m22 19h-6v-4h-3c-1.14 2.3335714-3.28 4-6 4-3.86 0-7-3.2778571-7-7 0-3.72214286 3.14-7 7-7 2.72 0 4.85 1.66642857 6 4h11v6h-2zm-4-2.4285714h2v-3.5714286h2v-2c-4 0-7.3333333 0-10 0 0-1-1.5-4-5-4-2.76 0-5 2.33857143-5 5 0 2.6614286 2.24 5 5 5 2.11 0 5-2 5-4h6zm-11-1.5714286c-1.65 0-3-1.4089286-3-3s1.35-3 3-3 3 1.4089286 3 3-1.35 3-3 3zm0-4c-.55 0-1 .4696429-1 1s.45 1 1 1 1-.4696429 1-1-.45-1-1-1z" | |
| }))); | |
| }; | |
| var GearIcon = function GearIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m14.1903028 24h-4.38060565c-.73010094 0-1.46020189-.5413534-1.64272713-1.443609l-.36505047-2.3458647c-.36505048-.1804511-.54757572-.3609022-.91262619-.5413534l-2.19030284.9022557c-.91262619.3609022-1.64272714 0-2.19030285-.7218045l-2.19030285-3.7894737c-.36505047-.7218045-.36505047-1.6240602.36505048-2.1654136l1.82525237-1.443609c0-.1804511 0-.3609022 0-.5413534 0-.1804511 0-.3609022 0-.5413533l-1.82525237-1.44360907c-.73010095-.54135338-.91262619-1.62406015-.36505048-2.16541353l2.19030285-3.78947369c.54757571-.72180451 1.4602019-.90225564 2.19030285-.72180451l2.19030284.90225564c.36505047-.18045113.54757571-.36090226.91262619-.54135338l.36505047-2.16541354c.18252524-.90225564.91262619-1.44360902 1.64272713-1.44360902h4.38060565c.730101 0 1.4602019.54135338 1.6427272 1.44360902l.3650505 2.34586466c.3650504.18045113.5475757.36090226.9126261.54135339l2.1903029-1.08270677c.9126262-.36090225 1.6427271 0 2.1903028.72180451l2.1903029 3.78947369c.3650505.72180451.1825252 1.62406015-.3650505 2.16541353l-1.8252524 1.44360907v.5413533.5413534l1.8252524 1.443609c.730101.5413534.9126262 1.6240602.3650505 2.1654136l-2.1903029 3.7894737c-.3650504.7218045-1.2776766 1.0827067-2.0077776.7218045l-2.1903028-.9022557c-.3650505.1804512-.5475757.3609023-.9126262.5413534l-.3650505 2.1654135c-.3650505.9022557-.9126262 1.6240602-1.8252524 1.6240602zm-3.8330299-2.5263158h3.2854542l.3650505-3.0676692.5475757-.1804511c.5475757-.1804511 1.0951514-.5413534 1.6427272-.9022556l.5475757-.3609023 2.9204038 1.0827068 1.6427271-2.8872181-2.3728281-1.8045112.1825252-.7218046c0-.3609022 0-.5413533 0-.9022556 0-.3609022 0-.5413534 0-.9022556v-.7218045l.5475758-.54135343 1.8252523-1.44360902-1.6427271-2.70676692-2.9204038 1.08270677-.5475757-.36090225c-.5475757-.36090226-1.0951514-.72180452-1.6427271-.90225564l-.5475758-.18045113-.3650504-3.06766917h-3.2854543l-.3650505 3.06766917-.54757568.18045113c-.54757571.18045112-1.09515143.54135338-1.64272714.90225564l-.73010095.72180451-2.92040379-1.2631579-1.64272713 2.88721805 2.37282808 1.80451129-.18252524.7218045v.9022556.9022557.7218045l-.54757571.3609022-1.82525237 1.4436091 1.64272713 2.887218 2.9204038-1.0827068.54757571.3609023c.54757571.3609023 1.09515142.7218045 1.64272713.9022556l.54757571.1804512zm1.6427271-5.2330827c-2.37282808 0-4.38060569-1.9849624-4.38060569-4.3308271 0-2.34586463 2.00777761-4.33082703 4.38060569-4.33082703 2.3728281 0 4.3806057 1.9849624 4.3806057 4.33082703 0 2.3458647-2.0077776 4.3308271-4.3806057 4.3308271zm0-6.31578947c-1.0951514 0-2.00777761.90225567-2.00777761 1.98496237 0 1.0827068.91262621 1.9849624 2.00777761 1.9849624s2.0077776-.9022556 2.0077776-1.9849624c0-1.0827067-.9126262-1.98496237-2.0077776-1.98496237z" | |
| }))); | |
| }; | |
| var FiltersIcon = function FiltersIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m8 16c1.74492528 0 3.5448021 1.3815186 4 3h11c.556353 0 1 .443647 1 1s-.4183582 1-1 1h-11c-.4551979 1.5931927-2.25507472 3-4 3s-3.5448021-1.3815186-4-3h-3c-.55635299 0-1-.443647-1-1s.41835824-1 1-1h3c.4551979-1.5931927 2.25507472-3 4-3zm0 2c-1.1045695 0-2 .8954305-2 2s.8954305 2 2 2 2-.8954305 2-2-.8954305-2-2-2zm8-10c1.7449253 0 3.5448021 1.38151858 4 3h3c.556353 0 1 .443647 1 1s-.4183582 1-1 1h-3c-.4551979 1.5931927-2.2550747 3-4 3s-3.5448021-1.3815186-4-3h-11c-.55635299 0-1-.443647-1-1s.41835824-1 1-1h11c.4551979-1.59319265 2.2550747-3 4-3zm0 2c-1.1045695 0-2 .8954305-2 2s.8954305 2 2 2 2-.8954305 2-2-.8954305-2-2-2zm-8-10c1.74492528 0 3.5448021 1.38151858 4 3h11c.556353 0 1 .44364701 1 1s-.4183582 1-1 1h-11c-.4551979 1.59319265-2.25507472 3-4 3s-3.5448021-1.38151858-4-3h-3c-.55635299 0-1-.44364701-1-1s.41835824-1 1-1h3c.4551979-1.59319265 2.25507472-3 4-3zm0 2c-1.1045695 0-2 .8954305-2 2s.8954305 2 2 2 2-.8954305 2-2-.8954305-2-2-2z" | |
| }))); | |
| }; | |
| var EyeOpenIcon = function EyeOpenIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m12 6c3.79 0 7.17 2.13 8.82 5.5-1.65 3.37-5.03 5.5-8.82 5.5s-7.17-2.13-8.82-5.5c1.65-3.37 5.03-5.5 8.82-5.5m0-2c-5 0-9.27 3.11-11 7.5 1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zm0 5c1.38 0 2.5 1.12 2.5 2.5s-1.12 2.5-2.5 2.5-2.5-1.12-2.5-2.5 1.12-2.5 2.5-2.5m0-2c-2.48 0-4.5 2.02-4.5 4.5s2.02 4.5 4.5 4.5 4.5-2.02 4.5-4.5-2.02-4.5-4.5-4.5z" | |
| }))); | |
| }; | |
| var EyeClosedIcon = function EyeClosedIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m12 6c3.79 0 7.17 2.13 8.82 5.5-.59 1.22-1.42 2.27-2.41 3.12l1.41 1.41c1.39-1.23 2.49-2.77 3.18-4.53-1.73-4.39-6-7.5-11-7.5-1.27 0-2.49.2-3.64.57l1.65 1.65c.65-.13 1.31-.22 1.99-.22zm-1.07 1.14 2.07 2.07c.57.25 1.03.71 1.28 1.28l2.07 2.07c.08-.34.140037-.7.140037-1.07.009963-2.48-2.010037-4.49-4.490037-4.49-.37 0-.72.05-1.07.14zm-8.92-3.27 2.68 2.68c-1.63 1.28-2.92 2.98-3.69 4.95 1.73 4.39 6 7.5 11 7.5 1.52 0 2.98-.29 4.32-.82l3.42 3.42 1.41-1.41-17.73-17.74zm7.5 7.5 2.61 2.61c-.04.01-.08.02-.12.02-1.38 0-2.5-1.12-2.5-2.5 0-.05.01-.08.01-.13zm-3.4-3.4 1.75 1.75c-.23.55-.36 1.15-.36 1.78 0 2.48 2.02 4.5 4.5 4.5.63 0 1.23-.13 1.77-.36l.98.98c-.88.24-1.8.38-2.75.38-3.79 0-7.17-2.13-8.82-5.5.7-1.43 1.72-2.61 2.93-3.53z" | |
| }))); | |
| }; | |
| var BlockedIcon = function BlockedIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m12 0c-6.624 0-12 5.376-12 12s5.376 12 12 12 12-5.376 12-12-5.376-12-12-12zm-10 12c0-5.304 4.696-10 10-10 2.22 0 4.38.728 6 2l-14 14c-1.272-1.62-2-3.78-2-6zm10 10c-2.22 0-4.38-.728-6-2l14-14c1.272 1.62 2 3.78 2 6 0 5.304-4.696 10-10 10z" | |
| }))); | |
| }; | |
| var CheckboxUncheckedIcon = function CheckboxUncheckedIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m20 0c2.209139 0 4 1.790861 4 4v16c0 2.209139-1.790861 4-4 4h-16c-2.209139 0-4-1.790861-4-4v-16c0-2.209139 1.790861-4 4-4zm0 2h-16c-1.1045695 0-2 .8954305-2 2v16c0 1.1045695.8954305 2 2 2h16c1.1045695 0 2-.8954305 2-2v-16c0-1.1045695-.8954305-2-2-2z" | |
| }))); | |
| }; | |
| var CheckboxCheckedIcon = function CheckboxCheckedIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m20 0c2.209139 0 4 1.790861 4 4v16c0 2.209139-1.790861 4-4 4h-16c-2.209139 0-4-1.790861-4-4v-16c0-2.209139 1.790861-4 4-4zm-3.2666667 7-6.6 8.0666667-3.66666663-3.6666667-1.46666667 1.4666667 5.1333333 5.1333333 8.0666667-9.53333333z" | |
| }))); | |
| }; | |
| var CheckboxPartialIcon = function CheckboxPartialIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m20 0c2.209139 0 4 1.790861 4 4v16c0 2.209139-1.790861 4-4 4h-16c-2.209139 0-4-1.790861-4-4v-16c0-2.209139 1.790861-4 4-4zm-1 11h-14v2h14z" | |
| }))); | |
| }; | |
| var RadioCheckedIcon = function RadioCheckedIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m12 22c5.5228475 0 10-4.4771525 10-10s-4.4771525-10-10-10-10 4.4771525-10 10 4.4771525 10 10 10zm0-4c3.3137085 0 6-2.6862915 6-6s-2.6862915-6-6-6-6 2.6862915-6 6 2.6862915 6 6 6zm0 6c-6.627417 0-12-5.372583-12-12s5.372583-12 12-12 12 5.372583 12 12-5.372583 12-12 12z" | |
| }))); | |
| }; | |
| var RadioUncheckedIcon = function RadioUncheckedIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m12 22c5.5228475 0 10-4.4771525 10-10s-4.4771525-10-10-10-10 4.4771525-10 10 4.4771525 10 10 10zm0 2c-6.627417 0-12-5.372583-12-12s5.372583-12 12-12 12 5.372583 12 12-5.372583 12-12 12z" | |
| }))); | |
| }; | |
| var StopwatchIcon = function StopwatchIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m15 0h-6v2h6zm-4 15.003811h2v-8h-2zm9-7.503811 2-2c-.4916627-.58313483-.9168652-1.01977132-1.5-1.5l-2 2c-1.7722725-1.41781801-4.0759886-2-6.5-2-5.68270605 0-10 4.31729395-10 10 0 5.6827061 4.30585993 10 10 10 5.6941401 0 10-4.3172939 10-10 0-2.4125774-.593616-4.72772749-2-6.5zm-8 14.5c-4.42285714 0-8-3.5771429-8-8 0-4.42285714 3.57714286-8 8-8 4.4228571 0 8 3.57714286 8 8 0 4.4228571-3.5771429 8-8 8z" | |
| }))); | |
| }; | |
| var CloseIcon = function CloseIcon(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m3 3c.33333333-.33333333.83333333-.33333333 1.5 0l7.5 7.5 7.5-7.5c.6666667-.33333333 1.1666667-.33333333 1.5 0s.3333333.83333333 0 1.5l-7.5 7.5 7.5 7.5c.3333333.6666667.3333333 1.1666667 0 1.5s-.8333333.3333333-1.5 0l-7.5-7.5-7.5 7.5c-.66666667.3333333-1.16666667.3333333-1.5 0s-.33333333-.8333333 0-1.5l7.5-7.5-7.5-7.5c-.33333333-.66666667-.33333333-1.16666667 0-1.5z" | |
| }))); | |
| }; | |
| var KebabMenu = function KebabMenu(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "M12,8.00381327 C13.1,8.00381327 14.0023522,7.1 14.0023522,6 C14.0023522,4.9 13.1,3.99981296 12,3.99981296 C10.9,3.99981296 10,4.9 10,6 C10,7.1 10.9,8.00381327 12,8.00381327 Z M12,10 C10.9,10 10,10.9 10,12 C10,13.1 10.9,14 12,14 C13.1,14 14,13.1 14,12 C14,10.9 13.1,10 12,10 Z M12,16 C10.9,16 10,16.9 10,18 C10,19.1 10.9,20 12,20 C13.1,20 14,19.1 14,18 C14,16.9 13.1,16 12,16 Z" | |
| }))); | |
| }; | |
| var HamburgerMenu = function HamburgerMenu(_ref) { | |
| var _ref$width = _ref.width, | |
| width = _ref$width === void 0 ? '1em' : _ref$width, | |
| _ref$height = _ref.height, | |
| height = _ref$height === void 0 ? '1em' : _ref$height, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["width", "height"]); | |
| return /*#__PURE__*/React.createElement(YAPIcon, _extends({ | |
| width: width, | |
| height: height | |
| }, rest), /*#__PURE__*/React.createElement("g", { | |
| fill: "currentColor" | |
| }, /*#__PURE__*/React.createElement("path", { | |
| d: "m22.5 17c.8284271 0 1.5.6715729 1.5 1.5s-.6715729 1.5-1.5 1.5h-21c-.82842712 0-1.5-.6715729-1.5-1.5s.67157288-1.5 1.5-1.5zm0-7c.8284271 0 1.5.6715729 1.5 1.5s-.6715729 1.5-1.5 1.5h-21c-.82842712 0-1.5-.6715729-1.5-1.5s.67157288-1.5 1.5-1.5zm0-7c.8284271 0 1.5.67157288 1.5 1.5s-.6715729 1.5-1.5 1.5h-21c-.82842712 0-1.5-.67157288-1.5-1.5s.67157288-1.5 1.5-1.5z" | |
| }))); | |
| }; | |
| var getNumberLengthAfterDecimalPoint = function getNumberLengthAfterDecimalPoint(number) { | |
| return number.toString().split('.')[1] ? number.toString().split('.')[1].length : 1; | |
| }; | |
| var YAPNumberInput = function YAPNumberInput(_ref) { | |
| var _cx; | |
| var value = _ref.value, | |
| onChange = _ref.onChange, | |
| id = _ref.id, | |
| _ref$max = _ref.max, | |
| max = _ref$max === void 0 ? '15' : _ref$max, | |
| _ref$min = _ref.min, | |
| min = _ref$min === void 0 ? '-5' : _ref$min, | |
| _ref$step = _ref.step, | |
| step = _ref$step === void 0 ? '1' : _ref$step, | |
| disabled = _ref.disabled, | |
| invalid = _ref.invalid, | |
| readOnly = _ref.readOnly, | |
| _ref$placeholder = _ref.placeholder, | |
| placeholder = _ref$placeholder === void 0 ? '0' : _ref$placeholder, | |
| dataQaSelector = _ref.dataQaSelector, | |
| className = _ref.className, | |
| props = _objectWithoutPropertiesLoose(_ref, ["value", "onChange", "id", "max", "min", "step", "disabled", "invalid", "readOnly", "placeholder", "dataQaSelector", "className"]); | |
| var _useState = useState(false), | |
| isIncrementBtnDisabled = _useState[0], | |
| setIncrementBtnDisabled = _useState[1]; | |
| var _useState2 = useState(false), | |
| isDecrementBtnDisabled = _useState2[0], | |
| setDecrementBtnDisabled = _useState2[1]; | |
| var contextValues = useFormControl(); | |
| var inputId = id !== undefined ? id : contextValues ? contextValues.id : undefined; | |
| var isInvalidInput = contextValues ? contextValues.invalid : invalid; | |
| function handleKeyDown(event) { | |
| if (event.keyCode === 38) { | |
| handleIncrement(); | |
| } else if (event.keyCode === 40) { | |
| handleDecrement(); | |
| } else { | |
| return undefined; | |
| } | |
| } | |
| function handleOnChange(event) { | |
| var isNumberRegex = new RegExp(/^-?[0-9]\d*(\.\d+)?$/); | |
| var val = Number(event.target.value); | |
| if (isNumberRegex.test(val)) { | |
| if (val <= Number(max)) { | |
| setIncrementBtnDisabled(false); | |
| } | |
| if (val >= Number(min)) { | |
| setDecrementBtnDisabled(false); | |
| } | |
| if (val <= Number(min)) { | |
| setDecrementBtnDisabled(true); | |
| } | |
| if (val >= Number(max)) { | |
| setIncrementBtnDisabled(true); | |
| } | |
| onChange && onChange(event.target.value); | |
| } | |
| } | |
| function getNewValue(inputUpdateType) { | |
| var stepDecPoint = getNumberLengthAfterDecimalPoint(step); | |
| var fractionDigit = stepDecPoint >= 1 && step[step.length - 1] !== '0' && step.length !== 1 ? stepDecPoint : 0; | |
| var newValue = inputUpdateType === 'increment' ? Number(value) + Number(step) : Number(value) - Number(step); | |
| return newValue.toFixed(fractionDigit); | |
| } | |
| function handleIncrement() { | |
| if (readOnly) return; | |
| var newValue = getNewValue('increment'); | |
| setDecrementBtnDisabled(false); | |
| if (newValue < Number(min)) { | |
| onChange(min); | |
| } else if (Number(value) < Number(step)) { | |
| onChange(newValue); | |
| } else if (max && newValue >= Number(max)) { | |
| onChange(max); | |
| setIncrementBtnDisabled(true); | |
| } else { | |
| onChange(newValue); | |
| } | |
| } | |
| function handleDecrement() { | |
| if (readOnly) return; | |
| var newValue = getNewValue('decrement'); | |
| setIncrementBtnDisabled(false); | |
| if (newValue > Number(max)) { | |
| onChange(max); | |
| } else if (Number(value) > Number(step)) { | |
| onChange(newValue); | |
| } else if (min && newValue <= Number(min)) { | |
| onChange(min); | |
| setDecrementBtnDisabled(true); | |
| } else { | |
| onChange(newValue); | |
| } | |
| } | |
| var inputWrapperClassnames = classnames((_cx = { | |
| 'ansh-number-input ansh-number-input--wrapper ansh-body': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| return /*#__PURE__*/React.createElement("div", { | |
| className: inputWrapperClassnames, | |
| "data-invalid": isInvalidInput | |
| }, /*#__PURE__*/React.createElement("button", { | |
| className: "ansh-number-input--btn ansh-number-input--btn-decrement", | |
| onClick: handleDecrement, | |
| disabled: disabled || isDecrementBtnDisabled, | |
| "data-qa-selector": dataQaSelector + "-decrement-btn" | |
| }, /*#__PURE__*/React.createElement(MinusSquaredIcon, null)), /*#__PURE__*/React.createElement("input", _extends({ | |
| type: "text", | |
| className: "ansh-number-input--number-field", | |
| value: value, | |
| id: inputId, | |
| disabled: disabled, | |
| readOnly: readOnly, | |
| placeholder: placeholder, | |
| onChange: handleOnChange, | |
| "aria-describedby": inputId + "-helptext", | |
| onKeyDown: handleKeyDown, | |
| "data-qa-selector": dataQaSelector + "-number-number-field" | |
| }, props)), /*#__PURE__*/React.createElement("button", { | |
| className: "ansh-number-input--btn ansh-number-input--btn-increment", | |
| onClick: handleIncrement, | |
| disabled: disabled || isIncrementBtnDisabled, | |
| "data-qa-selector": dataQaSelector + "-increment-btn" | |
| }, /*#__PURE__*/React.createElement(PlusSquaredIcon, null))); | |
| }; | |
| var mapBadgeVariantToClassnames = { | |
| solid: 'ansh-badge--solid', | |
| glassy: 'ansh-badge--glassy' | |
| }; | |
| var mapBadgeSizeToClassnames = { | |
| small: 'ansh-badge--sm', | |
| medium: 'ansh-badge--md' | |
| }; | |
| var mapBadgeColorToClassnames = { | |
| primary: 'ansh-badge--primary', | |
| secondary: 'ansh-badge--secondary', | |
| success: 'ansh-badge--success', | |
| danger: 'ansh-badge--danger', | |
| warning: 'ansh-badge--warning', | |
| info: 'ansh-badge--info' | |
| }; | |
| var YAPBadge = function YAPBadge(_ref) { | |
| var _cx; | |
| var _ref$size = _ref.size, | |
| size = _ref$size === void 0 ? 'medium' : _ref$size, | |
| _ref$variant = _ref.variant, | |
| variant = _ref$variant === void 0 ? 'solid' : _ref$variant, | |
| _ref$color = _ref.color, | |
| color = _ref$color === void 0 ? 'primary' : _ref$color, | |
| icon = _ref.icon, | |
| label = _ref.label, | |
| className = _ref.className, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["size", "variant", "color", "icon", "label", "className"]); | |
| var sizeClass = mapBadgeSizeToClassnames[size]; | |
| var variantClass = mapBadgeVariantToClassnames[variant]; | |
| var colorClass = mapBadgeColorToClassnames[color]; | |
| var badgeWrapperClassnames = classnames((_cx = { | |
| 'ansh-badge ansh-badge--wrapper ansh-caption': true | |
| }, _cx[sizeClass] = true, _cx[variantClass] = true, _cx[colorClass] = true, _cx[className] = Boolean(className), _cx)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: badgeWrapperClassnames | |
| }, rest), icon ? /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-badge--icon" | |
| }, icon) : null, /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-badge--label" | |
| }, label)); | |
| }; | |
| var TabContext = /*#__PURE__*/React.createContext({}); | |
| var YAPTabs = function YAPTabs(_ref) { | |
| var _cx; | |
| var children = _ref.children, | |
| selectedTab = _ref.selectedTab, | |
| _ref$onTabChange = _ref.onTabChange, | |
| onTabChange = _ref$onTabChange === void 0 ? function () {} : _ref$onTabChange, | |
| disabled = _ref.disabled, | |
| className = _ref.className; | |
| var tabWrapperClassnames = classnames((_cx = { | |
| 'ansh-tab ansh-tab-wrapper': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| return /*#__PURE__*/React.createElement(TabContext.Provider, { | |
| value: { | |
| selectedTab: selectedTab, | |
| onTabChange: onTabChange, | |
| parentDisabled: disabled | |
| } | |
| }, /*#__PURE__*/React.createElement("div", { | |
| className: tabWrapperClassnames | |
| }, children)); | |
| }; | |
| var YAPTab = function YAPTab(_ref) { | |
| var children = _ref.children, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["children"]); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: "ansh-tab--tablist-tab ansh-h6" | |
| }, rest), children); | |
| }; | |
| var keys = { | |
| left: 37, | |
| right: 39 | |
| }; | |
| var YAPTabList = function YAPTabList(_ref) { | |
| var children = _ref.children; | |
| var tabContext = useContext(TabContext); | |
| var handleOnTabChange = function handleOnTabChange(e, _ref2) { | |
| var tabId = _ref2.tabId, | |
| onClick = _ref2.onClick, | |
| disabled = _ref2.disabled; | |
| if (disabled || tabContext.parentDisabled) return; | |
| tabContext.onTabChange(tabId); | |
| onClick && onClick(e); | |
| }; | |
| var handleOnKeyUp = function handleOnKeyUp(e) { | |
| var target = e.target; | |
| var previousTab = target.previousSibling; | |
| var nextTab = target.nextSibling; | |
| if (previousTab && previousTab.dataset.disabled === 'true') { | |
| previousTab = previousTab.previousSibling; | |
| } | |
| if (nextTab && nextTab.dataset.disabled === 'true') { | |
| nextTab = nextTab.nextSibling; | |
| } | |
| if (e.keyCode === keys.left && previousTab) { | |
| var id = previousTab.dataset.tabid; | |
| previousTab.tabIndex = 0; | |
| previousTab.focus(); | |
| tabContext.onTabChange(id); | |
| } else if (e.keyCode === keys.right && nextTab) { | |
| var _id = nextTab.dataset.tabid; | |
| nextTab.tabIndex = 0; | |
| nextTab.focus(); | |
| tabContext.onTabChange(_id); | |
| } | |
| }; | |
| var getTabProps = function getTabProps(childProps) { | |
| var tabId = childProps.tabId, | |
| disabled = childProps.disabled, | |
| _onKeyUp = childProps.onKeyUp, | |
| rest = _objectWithoutPropertiesLoose(childProps, ["tabId", "disabled", "onKeyUp"]); | |
| var isSelected = tabContext.selectedTab === tabId; | |
| return _extends({}, rest, { | |
| tabIndex: isSelected ? 0 : -1, | |
| onClick: function onClick(e) { | |
| return handleOnTabChange(e, childProps); | |
| }, | |
| onKeyUp: function onKeyUp(e) { | |
| handleOnKeyUp(e); | |
| _onKeyUp && _onKeyUp(e); | |
| }, | |
| 'data-tabid': tabId, | |
| 'data-disabled': Boolean(disabled) || Boolean(tabContext.parentDisabled), | |
| 'data-selected': Boolean(isSelected), | |
| isSelected: isSelected | |
| }); | |
| }; | |
| var TabContent = React.Children.map(children, function (child) { | |
| return /*#__PURE__*/React.cloneElement(child, getTabProps(child.props)); | |
| }); | |
| return /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-tab--tablist" | |
| }, TabContent); | |
| }; | |
| var YAPTabPanels = function YAPTabPanels(_ref) { | |
| var children = _ref.children; | |
| return /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-tab--tabpanels" | |
| }, children); | |
| }; | |
| var YAPTabPanel = function YAPTabPanel(_ref) { | |
| var children = _ref.children, | |
| tabId = _ref.tabId; | |
| var _useContext = useContext(TabContext), | |
| selectedTab = _useContext.selectedTab; | |
| var isActive = tabId === selectedTab; | |
| return /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-tab--tabpanels-panel", | |
| style: { | |
| display: isActive ? 'block' : 'none' | |
| } | |
| }, children); | |
| }; | |
| var mapBannerVariantToClassnames = { | |
| solid: 'ansh-banner--solid', | |
| muted: 'ansh-banner--muted' | |
| }; | |
| var mapBannerColorToClassnames = { | |
| primary: 'ansh-banner--primary', | |
| secondary: 'ansh-banner--secondary', | |
| success: 'ansh-banner--success', | |
| danger: 'ansh-banner--danger', | |
| warning: 'ansh-banner--warning', | |
| info: 'ansh-banner--info' | |
| }; | |
| var YAPBanner = function YAPBanner(_ref) { | |
| var _cx; | |
| var children = _ref.children, | |
| title = _ref.title, | |
| icon = _ref.icon, | |
| _ref$variant = _ref.variant, | |
| variant = _ref$variant === void 0 ? 'solid' : _ref$variant, | |
| dataQaSelector = _ref.dataQaSelector, | |
| _ref$color = _ref.color, | |
| color = _ref$color === void 0 ? 'primary' : _ref$color, | |
| onCancel = _ref.onCancel, | |
| className = _ref.className, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["children", "title", "icon", "variant", "dataQaSelector", "color", "onCancel", "className"]); | |
| var variantClass = mapBannerVariantToClassnames[variant]; | |
| var colorClass = mapBannerColorToClassnames[color]; | |
| var bannerWrapperClassnames = classnames((_cx = { | |
| 'ansh-banner ansh-banner--wrapper': true | |
| }, _cx[variantClass] = true, _cx[colorClass] = true, _cx[className] = Boolean(className), _cx)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: bannerWrapperClassnames | |
| }, rest), /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-banner--content" | |
| }, icon ? /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-banner--icon" | |
| }, icon) : null, /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-banner--body" | |
| }, title ? /*#__PURE__*/React.createElement("h6", { | |
| className: "ansh-banner--body-title ansh-h6", | |
| style: { | |
| marginBottom: children ? '5px' : '0px' | |
| } | |
| }, title) : null, children ? /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-banner--body-children ansh-body" | |
| }, children) : null)), onCancel ? /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-banner--close-icon", | |
| "data-qa-selector": dataQaSelector, | |
| onClick: onCancel | |
| }, /*#__PURE__*/React.createElement(CloseIcon, null)) : null); | |
| }; | |
| var mapToSpinnerSizes = { | |
| small: 18, | |
| medium: 22, | |
| large: 44 | |
| }; | |
| var YAPSpinner = function YAPSpinner(_ref) { | |
| var _cx; | |
| var _ref$size = _ref.size, | |
| size = _ref$size === void 0 ? 'medium' : _ref$size, | |
| className = _ref.className, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["size", "className"]); | |
| var spinnerClassnames = classnames((_cx = { | |
| 'ansh-spinner': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| return /*#__PURE__*/React.createElement(SpinnerIcon, _extends({ | |
| width: mapToSpinnerSizes[size], | |
| height: mapToSpinnerSizes[size], | |
| className: spinnerClassnames | |
| }, rest)); | |
| }; | |
| var YAPSegmentedButton = function YAPSegmentedButton(_ref) { | |
| var _cx; | |
| var options = _ref.options, | |
| className = _ref.className, | |
| onChange = _ref.onChange, | |
| value = _ref.value, | |
| _ref$dataQaSelector = _ref.dataQaSelector, | |
| dataQaSelector = _ref$dataQaSelector === void 0 ? '' : _ref$dataQaSelector, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["options", "className", "onChange", "value", "dataQaSelector"]); | |
| var segmentedControlClassnames = classnames((_cx = { | |
| 'ansh-segmented-control ansh-segmented-control--wrapper': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var handleOnChange = function handleOnChange(e) { | |
| onChange && onChange(e.target.value); | |
| }; | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: segmentedControlClassnames | |
| }, rest), options.map(function (option, index) { | |
| return /*#__PURE__*/React.createElement("label", { | |
| key: option.value, | |
| "data-active": option.value === value, | |
| "data-disabled": option.disabled, | |
| className: "ansh-segmented-control--btn ansh-h6", | |
| "data-qa-selector": dataQaSelector + "-" + ++index | |
| }, /*#__PURE__*/React.createElement("input", { | |
| type: "radio", | |
| value: option.value, | |
| name: "segmented-btn", | |
| disabled: option.disabled, | |
| onClick: handleOnChange, | |
| checked: option.value === value | |
| }), option.label); | |
| })); | |
| }; | |
| var YAPBreadcrumbItemSeperator = function YAPBreadcrumbItemSeperator(_ref) { | |
| var seperator = _ref.seperator; | |
| return /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-breadcrumb--seperator", | |
| role: "presentation" | |
| }, seperator); | |
| }; | |
| var YAPBreadcrumbItem = function YAPBreadcrumbItem(_ref2) { | |
| var _cx; | |
| var children = _ref2.children, | |
| length = _ref2.length, | |
| index = _ref2.index, | |
| _ref2$active = _ref2.active, | |
| active = _ref2$active === void 0 ? false : _ref2$active, | |
| seperator = _ref2.seperator, | |
| className = _ref2.className, | |
| rest = _objectWithoutPropertiesLoose(_ref2, ["children", "length", "index", "active", "seperator", "className"]); | |
| var isLast = index === length - 1; | |
| var breadcrumbItemClassnames = classnames((_cx = { | |
| 'ansh-breadcrumb--item ansh-h6': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| return /*#__PURE__*/React.createElement("li", _extends({ | |
| className: breadcrumbItemClassnames, | |
| "data-active": active | |
| }, rest), /*#__PURE__*/React.createElement("span", null, children), ' ', !isLast ? /*#__PURE__*/React.createElement(YAPBreadcrumbItemSeperator, { | |
| seperator: seperator | |
| }) : null); | |
| }; | |
| var YAPBreadcrumb = function YAPBreadcrumb(_ref3) { | |
| var _cx2; | |
| var children = _ref3.children, | |
| className = _ref3.className, | |
| _ref3$seperator = _ref3.seperator, | |
| seperator = _ref3$seperator === void 0 ? '/' : _ref3$seperator, | |
| rest = _objectWithoutPropertiesLoose(_ref3, ["children", "className", "seperator"]); | |
| var breadcumbWrapperClassname = classnames((_cx2 = { | |
| 'ansh-breadcrumb ansh-breadcrumb--wrapper': true | |
| }, _cx2[className] = Boolean(className), _cx2)); | |
| return /*#__PURE__*/React.createElement("ol", _extends({ | |
| className: breadcumbWrapperClassname | |
| }, rest), React.Children.map(children, function (child, index) { | |
| return /*#__PURE__*/React.cloneElement(child, _extends({}, child.props, { | |
| length: children.length, | |
| index: index, | |
| seperator: seperator | |
| })); | |
| })); | |
| }; | |
| /** @license React v16.13.1 | |
| * react-is.production.min.js | |
| * | |
| * Copyright (c) Facebook, Inc. and its affiliates. | |
| * | |
| * This source code is licensed under the MIT license found in the | |
| * LICENSE file in the root directory of this source tree. | |
| */ | |
| var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? | |
| Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; | |
| function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d; | |
| var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t}; | |
| var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p}; | |
| var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z; | |
| var reactIs_production_min = { | |
| AsyncMode: AsyncMode, | |
| ConcurrentMode: ConcurrentMode, | |
| ContextConsumer: ContextConsumer, | |
| ContextProvider: ContextProvider, | |
| Element: Element, | |
| ForwardRef: ForwardRef, | |
| Fragment: Fragment, | |
| Lazy: Lazy, | |
| Memo: Memo, | |
| Portal: Portal, | |
| Profiler: Profiler, | |
| StrictMode: StrictMode, | |
| Suspense: Suspense, | |
| isAsyncMode: isAsyncMode, | |
| isConcurrentMode: isConcurrentMode, | |
| isContextConsumer: isContextConsumer, | |
| isContextProvider: isContextProvider, | |
| isElement: isElement, | |
| isForwardRef: isForwardRef, | |
| isFragment: isFragment, | |
| isLazy: isLazy, | |
| isMemo: isMemo, | |
| isPortal: isPortal, | |
| isProfiler: isProfiler, | |
| isStrictMode: isStrictMode, | |
| isSuspense: isSuspense, | |
| isValidElementType: isValidElementType, | |
| typeOf: typeOf | |
| }; | |
| var reactIs_development = createCommonjsModule(function (module, exports) { | |
| if (process.env.NODE_ENV !== "production") { | |
| (function() { | |
| // The Symbol used to tag the ReactElement-like types. If there is no native Symbol | |
| // nor polyfill, then a plain number is used for performance. | |
| var hasSymbol = typeof Symbol === 'function' && Symbol.for; | |
| var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; | |
| var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; | |
| var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; | |
| var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; | |
| var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; | |
| var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; | |
| var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary | |
| // (unstable) APIs that have been removed. Can we remove the symbols? | |
| var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; | |
| var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; | |
| var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; | |
| var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; | |
| var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; | |
| var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; | |
| var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; | |
| var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; | |
| var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; | |
| var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; | |
| var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; | |
| function isValidElementType(type) { | |
| return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. | |
| type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); | |
| } | |
| function typeOf(object) { | |
| if (typeof object === 'object' && object !== null) { | |
| var $$typeof = object.$$typeof; | |
| switch ($$typeof) { | |
| case REACT_ELEMENT_TYPE: | |
| var type = object.type; | |
| switch (type) { | |
| case REACT_ASYNC_MODE_TYPE: | |
| case REACT_CONCURRENT_MODE_TYPE: | |
| case REACT_FRAGMENT_TYPE: | |
| case REACT_PROFILER_TYPE: | |
| case REACT_STRICT_MODE_TYPE: | |
| case REACT_SUSPENSE_TYPE: | |
| return type; | |
| default: | |
| var $$typeofType = type && type.$$typeof; | |
| switch ($$typeofType) { | |
| case REACT_CONTEXT_TYPE: | |
| case REACT_FORWARD_REF_TYPE: | |
| case REACT_LAZY_TYPE: | |
| case REACT_MEMO_TYPE: | |
| case REACT_PROVIDER_TYPE: | |
| return $$typeofType; | |
| default: | |
| return $$typeof; | |
| } | |
| } | |
| case REACT_PORTAL_TYPE: | |
| return $$typeof; | |
| } | |
| } | |
| return undefined; | |
| } // AsyncMode is deprecated along with isAsyncMode | |
| var AsyncMode = REACT_ASYNC_MODE_TYPE; | |
| var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; | |
| var ContextConsumer = REACT_CONTEXT_TYPE; | |
| var ContextProvider = REACT_PROVIDER_TYPE; | |
| var Element = REACT_ELEMENT_TYPE; | |
| var ForwardRef = REACT_FORWARD_REF_TYPE; | |
| var Fragment = REACT_FRAGMENT_TYPE; | |
| var Lazy = REACT_LAZY_TYPE; | |
| var Memo = REACT_MEMO_TYPE; | |
| var Portal = REACT_PORTAL_TYPE; | |
| var Profiler = REACT_PROFILER_TYPE; | |
| var StrictMode = REACT_STRICT_MODE_TYPE; | |
| var Suspense = REACT_SUSPENSE_TYPE; | |
| var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated | |
| function isAsyncMode(object) { | |
| { | |
| if (!hasWarnedAboutDeprecatedIsAsyncMode) { | |
| hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint | |
| console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); | |
| } | |
| } | |
| return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; | |
| } | |
| function isConcurrentMode(object) { | |
| return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; | |
| } | |
| function isContextConsumer(object) { | |
| return typeOf(object) === REACT_CONTEXT_TYPE; | |
| } | |
| function isContextProvider(object) { | |
| return typeOf(object) === REACT_PROVIDER_TYPE; | |
| } | |
| function isElement(object) { | |
| return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | |
| } | |
| function isForwardRef(object) { | |
| return typeOf(object) === REACT_FORWARD_REF_TYPE; | |
| } | |
| function isFragment(object) { | |
| return typeOf(object) === REACT_FRAGMENT_TYPE; | |
| } | |
| function isLazy(object) { | |
| return typeOf(object) === REACT_LAZY_TYPE; | |
| } | |
| function isMemo(object) { | |
| return typeOf(object) === REACT_MEMO_TYPE; | |
| } | |
| function isPortal(object) { | |
| return typeOf(object) === REACT_PORTAL_TYPE; | |
| } | |
| function isProfiler(object) { | |
| return typeOf(object) === REACT_PROFILER_TYPE; | |
| } | |
| function isStrictMode(object) { | |
| return typeOf(object) === REACT_STRICT_MODE_TYPE; | |
| } | |
| function isSuspense(object) { | |
| return typeOf(object) === REACT_SUSPENSE_TYPE; | |
| } | |
| exports.AsyncMode = AsyncMode; | |
| exports.ConcurrentMode = ConcurrentMode; | |
| exports.ContextConsumer = ContextConsumer; | |
| exports.ContextProvider = ContextProvider; | |
| exports.Element = Element; | |
| exports.ForwardRef = ForwardRef; | |
| exports.Fragment = Fragment; | |
| exports.Lazy = Lazy; | |
| exports.Memo = Memo; | |
| exports.Portal = Portal; | |
| exports.Profiler = Profiler; | |
| exports.StrictMode = StrictMode; | |
| exports.Suspense = Suspense; | |
| exports.isAsyncMode = isAsyncMode; | |
| exports.isConcurrentMode = isConcurrentMode; | |
| exports.isContextConsumer = isContextConsumer; | |
| exports.isContextProvider = isContextProvider; | |
| exports.isElement = isElement; | |
| exports.isForwardRef = isForwardRef; | |
| exports.isFragment = isFragment; | |
| exports.isLazy = isLazy; | |
| exports.isMemo = isMemo; | |
| exports.isPortal = isPortal; | |
| exports.isProfiler = isProfiler; | |
| exports.isStrictMode = isStrictMode; | |
| exports.isSuspense = isSuspense; | |
| exports.isValidElementType = isValidElementType; | |
| exports.typeOf = typeOf; | |
| })(); | |
| } | |
| }); | |
| var reactIs = createCommonjsModule(function (module) { | |
| if (process.env.NODE_ENV === 'production') { | |
| module.exports = reactIs_production_min; | |
| } else { | |
| module.exports = reactIs_development; | |
| } | |
| }); | |
| /* | |
| object-assign | |
| (c) Sindre Sorhus | |
| @license MIT | |
| */ | |
| /* eslint-disable no-unused-vars */ | |
| var getOwnPropertySymbols = Object.getOwnPropertySymbols; | |
| var hasOwnProperty = Object.prototype.hasOwnProperty; | |
| var propIsEnumerable = Object.prototype.propertyIsEnumerable; | |
| function toObject(val) { | |
| if (val === null || val === undefined) { | |
| throw new TypeError('Object.assign cannot be called with null or undefined'); | |
| } | |
| return Object(val); | |
| } | |
| function shouldUseNative() { | |
| try { | |
| if (!Object.assign) { | |
| return false; | |
| } | |
| // Detect buggy property enumeration order in older V8 versions. | |
| // https://bugs.chromium.org/p/v8/issues/detail?id=4118 | |
| var test1 = new String('abc'); // eslint-disable-line no-new-wrappers | |
| test1[5] = 'de'; | |
| if (Object.getOwnPropertyNames(test1)[0] === '5') { | |
| return false; | |
| } | |
| // https://bugs.chromium.org/p/v8/issues/detail?id=3056 | |
| var test2 = {}; | |
| for (var i = 0; i < 10; i++) { | |
| test2['_' + String.fromCharCode(i)] = i; | |
| } | |
| var order2 = Object.getOwnPropertyNames(test2).map(function (n) { | |
| return test2[n]; | |
| }); | |
| if (order2.join('') !== '0123456789') { | |
| return false; | |
| } | |
| // https://bugs.chromium.org/p/v8/issues/detail?id=3056 | |
| var test3 = {}; | |
| 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { | |
| test3[letter] = letter; | |
| }); | |
| if (Object.keys(Object.assign({}, test3)).join('') !== | |
| 'abcdefghijklmnopqrst') { | |
| return false; | |
| } | |
| return true; | |
| } catch (err) { | |
| // We don't expect any of the above to throw, but better to be safe. | |
| return false; | |
| } | |
| } | |
| var objectAssign = shouldUseNative() ? Object.assign : function (target, source) { | |
| var from; | |
| var to = toObject(target); | |
| var symbols; | |
| for (var s = 1; s < arguments.length; s++) { | |
| from = Object(arguments[s]); | |
| for (var key in from) { | |
| if (hasOwnProperty.call(from, key)) { | |
| to[key] = from[key]; | |
| } | |
| } | |
| if (getOwnPropertySymbols) { | |
| symbols = getOwnPropertySymbols(from); | |
| for (var i = 0; i < symbols.length; i++) { | |
| if (propIsEnumerable.call(from, symbols[i])) { | |
| to[symbols[i]] = from[symbols[i]]; | |
| } | |
| } | |
| } | |
| } | |
| return to; | |
| }; | |
| /** | |
| * Copyright (c) 2013-present, Facebook, Inc. | |
| * | |
| * This source code is licensed under the MIT license found in the | |
| * LICENSE file in the root directory of this source tree. | |
| */ | |
| var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | |
| var ReactPropTypesSecret_1 = ReactPropTypesSecret; | |
| var printWarning = function() {}; | |
| if (process.env.NODE_ENV !== 'production') { | |
| var ReactPropTypesSecret$1 = ReactPropTypesSecret_1; | |
| var loggedTypeFailures = {}; | |
| var has = Function.call.bind(Object.prototype.hasOwnProperty); | |
| printWarning = function(text) { | |
| var message = 'Warning: ' + text; | |
| if (typeof console !== 'undefined') { | |
| console.error(message); | |
| } | |
| try { | |
| // --- Welcome to debugging React --- | |
| // This error was thrown as a convenience so that you can use this stack | |
| // to find the callsite that caused this warning to fire. | |
| throw new Error(message); | |
| } catch (x) {} | |
| }; | |
| } | |
| /** | |
| * Assert that the values match with the type specs. | |
| * Error messages are memorized and will only be shown once. | |
| * | |
| * @param {object} typeSpecs Map of name to a ReactPropType | |
| * @param {object} values Runtime values that need to be type-checked | |
| * @param {string} location e.g. "prop", "context", "child context" | |
| * @param {string} componentName Name of the component for error messages. | |
| * @param {?Function} getStack Returns the component stack. | |
| * @private | |
| */ | |
| function checkPropTypes(typeSpecs, values, location, componentName, getStack) { | |
| if (process.env.NODE_ENV !== 'production') { | |
| for (var typeSpecName in typeSpecs) { | |
| if (has(typeSpecs, typeSpecName)) { | |
| var error; | |
| // Prop type validation may throw. In case they do, we don't want to | |
| // fail the render phase where it didn't fail before. So we log it. | |
| // After these have been cleaned up, we'll let them throw. | |
| try { | |
| // This is intentionally an invariant that gets caught. It's the same | |
| // behavior as without this statement except with a better message. | |
| if (typeof typeSpecs[typeSpecName] !== 'function') { | |
| var err = Error( | |
| (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + | |
| 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' | |
| ); | |
| err.name = 'Invariant Violation'; | |
| throw err; | |
| } | |
| error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1); | |
| } catch (ex) { | |
| error = ex; | |
| } | |
| if (error && !(error instanceof Error)) { | |
| printWarning( | |
| (componentName || 'React class') + ': type specification of ' + | |
| location + ' `' + typeSpecName + '` is invalid; the type checker ' + | |
| 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + | |
| 'You may have forgotten to pass an argument to the type checker ' + | |
| 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + | |
| 'shape all require an argument).' | |
| ); | |
| } | |
| if (error instanceof Error && !(error.message in loggedTypeFailures)) { | |
| // Only monitor this failure once because there tends to be a lot of the | |
| // same error. | |
| loggedTypeFailures[error.message] = true; | |
| var stack = getStack ? getStack() : ''; | |
| printWarning( | |
| 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') | |
| ); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| /** | |
| * Resets warning cache when testing. | |
| * | |
| * @private | |
| */ | |
| checkPropTypes.resetWarningCache = function() { | |
| if (process.env.NODE_ENV !== 'production') { | |
| loggedTypeFailures = {}; | |
| } | |
| }; | |
| var checkPropTypes_1 = checkPropTypes; | |
| var has$1 = Function.call.bind(Object.prototype.hasOwnProperty); | |
| var printWarning$1 = function() {}; | |
| if (process.env.NODE_ENV !== 'production') { | |
| printWarning$1 = function(text) { | |
| var message = 'Warning: ' + text; | |
| if (typeof console !== 'undefined') { | |
| console.error(message); | |
| } | |
| try { | |
| // --- Welcome to debugging React --- | |
| // This error was thrown as a convenience so that you can use this stack | |
| // to find the callsite that caused this warning to fire. | |
| throw new Error(message); | |
| } catch (x) {} | |
| }; | |
| } | |
| function emptyFunctionThatReturnsNull() { | |
| return null; | |
| } | |
| var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) { | |
| /* global Symbol */ | |
| var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | |
| var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | |
| /** | |
| * Returns the iterator method function contained on the iterable object. | |
| * | |
| * Be sure to invoke the function with the iterable as context: | |
| * | |
| * var iteratorFn = getIteratorFn(myIterable); | |
| * if (iteratorFn) { | |
| * var iterator = iteratorFn.call(myIterable); | |
| * ... | |
| * } | |
| * | |
| * @param {?object} maybeIterable | |
| * @return {?function} | |
| */ | |
| function getIteratorFn(maybeIterable) { | |
| var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | |
| if (typeof iteratorFn === 'function') { | |
| return iteratorFn; | |
| } | |
| } | |
| /** | |
| * Collection of methods that allow declaration and validation of props that are | |
| * supplied to React components. Example usage: | |
| * | |
| * var Props = require('ReactPropTypes'); | |
| * var MyArticle = React.createClass({ | |
| * propTypes: { | |
| * // An optional string prop named "description". | |
| * description: Props.string, | |
| * | |
| * // A required enum prop named "category". | |
| * category: Props.oneOf(['News','Photos']).isRequired, | |
| * | |
| * // A prop named "dialog" that requires an instance of Dialog. | |
| * dialog: Props.instanceOf(Dialog).isRequired | |
| * }, | |
| * render: function() { ... } | |
| * }); | |
| * | |
| * A more formal specification of how these methods are used: | |
| * | |
| * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) | |
| * decl := ReactPropTypes.{type}(.isRequired)? | |
| * | |
| * Each and every declaration produces a function with the same signature. This | |
| * allows the creation of custom validation functions. For example: | |
| * | |
| * var MyLink = React.createClass({ | |
| * propTypes: { | |
| * // An optional string or URI prop named "href". | |
| * href: function(props, propName, componentName) { | |
| * var propValue = props[propName]; | |
| * if (propValue != null && typeof propValue !== 'string' && | |
| * !(propValue instanceof URI)) { | |
| * return new Error( | |
| * 'Expected a string or an URI for ' + propName + ' in ' + | |
| * componentName | |
| * ); | |
| * } | |
| * } | |
| * }, | |
| * render: function() {...} | |
| * }); | |
| * | |
| * @internal | |
| */ | |
| var ANONYMOUS = '<<anonymous>>'; | |
| // Important! | |
| // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. | |
| var ReactPropTypes = { | |
| array: createPrimitiveTypeChecker('array'), | |
| bool: createPrimitiveTypeChecker('boolean'), | |
| func: createPrimitiveTypeChecker('function'), | |
| number: createPrimitiveTypeChecker('number'), | |
| object: createPrimitiveTypeChecker('object'), | |
| string: createPrimitiveTypeChecker('string'), | |
| symbol: createPrimitiveTypeChecker('symbol'), | |
| any: createAnyTypeChecker(), | |
| arrayOf: createArrayOfTypeChecker, | |
| element: createElementTypeChecker(), | |
| elementType: createElementTypeTypeChecker(), | |
| instanceOf: createInstanceTypeChecker, | |
| node: createNodeChecker(), | |
| objectOf: createObjectOfTypeChecker, | |
| oneOf: createEnumTypeChecker, | |
| oneOfType: createUnionTypeChecker, | |
| shape: createShapeTypeChecker, | |
| exact: createStrictShapeTypeChecker, | |
| }; | |
| /** | |
| * inlined Object.is polyfill to avoid requiring consumers ship their own | |
| * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | |
| */ | |
| /*eslint-disable no-self-compare*/ | |
| function is(x, y) { | |
| // SameValue algorithm | |
| if (x === y) { | |
| // Steps 1-5, 7-10 | |
| // Steps 6.b-6.e: +0 != -0 | |
| return x !== 0 || 1 / x === 1 / y; | |
| } else { | |
| // Step 6.a: NaN == NaN | |
| return x !== x && y !== y; | |
| } | |
| } | |
| /*eslint-enable no-self-compare*/ | |
| /** | |
| * We use an Error-like object for backward compatibility as people may call | |
| * PropTypes directly and inspect their output. However, we don't use real | |
| * Errors anymore. We don't inspect their stack anyway, and creating them | |
| * is prohibitively expensive if they are created too often, such as what | |
| * happens in oneOfType() for any type before the one that matched. | |
| */ | |
| function PropTypeError(message) { | |
| this.message = message; | |
| this.stack = ''; | |
| } | |
| // Make `instanceof Error` still work for returned errors. | |
| PropTypeError.prototype = Error.prototype; | |
| function createChainableTypeChecker(validate) { | |
| if (process.env.NODE_ENV !== 'production') { | |
| var manualPropTypeCallCache = {}; | |
| var manualPropTypeWarningCount = 0; | |
| } | |
| function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { | |
| componentName = componentName || ANONYMOUS; | |
| propFullName = propFullName || propName; | |
| if (secret !== ReactPropTypesSecret_1) { | |
| if (throwOnDirectAccess) { | |
| // New behavior only for users of `prop-types` package | |
| var err = new Error( | |
| 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | |
| 'Use `PropTypes.checkPropTypes()` to call them. ' + | |
| 'Read more at http://fb.me/use-check-prop-types' | |
| ); | |
| err.name = 'Invariant Violation'; | |
| throw err; | |
| } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { | |
| // Old behavior for people using React.PropTypes | |
| var cacheKey = componentName + ':' + propName; | |
| if ( | |
| !manualPropTypeCallCache[cacheKey] && | |
| // Avoid spamming the console because they are often not actionable except for lib authors | |
| manualPropTypeWarningCount < 3 | |
| ) { | |
| printWarning$1( | |
| 'You are manually calling a React.PropTypes validation ' + | |
| 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + | |
| 'and will throw in the standalone `prop-types` package. ' + | |
| 'You may be seeing this warning due to a third-party PropTypes ' + | |
| 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' | |
| ); | |
| manualPropTypeCallCache[cacheKey] = true; | |
| manualPropTypeWarningCount++; | |
| } | |
| } | |
| } | |
| if (props[propName] == null) { | |
| if (isRequired) { | |
| if (props[propName] === null) { | |
| return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); | |
| } | |
| return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); | |
| } | |
| return null; | |
| } else { | |
| return validate(props, propName, componentName, location, propFullName); | |
| } | |
| } | |
| var chainedCheckType = checkType.bind(null, false); | |
| chainedCheckType.isRequired = checkType.bind(null, true); | |
| return chainedCheckType; | |
| } | |
| function createPrimitiveTypeChecker(expectedType) { | |
| function validate(props, propName, componentName, location, propFullName, secret) { | |
| var propValue = props[propName]; | |
| var propType = getPropType(propValue); | |
| if (propType !== expectedType) { | |
| // `propValue` being instance of, say, date/regexp, pass the 'object' | |
| // check, but we can offer a more precise error message here rather than | |
| // 'of type `object`'. | |
| var preciseType = getPreciseType(propValue); | |
| return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); | |
| } | |
| return null; | |
| } | |
| return createChainableTypeChecker(validate); | |
| } | |
| function createAnyTypeChecker() { | |
| return createChainableTypeChecker(emptyFunctionThatReturnsNull); | |
| } | |
| function createArrayOfTypeChecker(typeChecker) { | |
| function validate(props, propName, componentName, location, propFullName) { | |
| if (typeof typeChecker !== 'function') { | |
| return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); | |
| } | |
| var propValue = props[propName]; | |
| if (!Array.isArray(propValue)) { | |
| var propType = getPropType(propValue); | |
| return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); | |
| } | |
| for (var i = 0; i < propValue.length; i++) { | |
| var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1); | |
| if (error instanceof Error) { | |
| return error; | |
| } | |
| } | |
| return null; | |
| } | |
| return createChainableTypeChecker(validate); | |
| } | |
| function createElementTypeChecker() { | |
| function validate(props, propName, componentName, location, propFullName) { | |
| var propValue = props[propName]; | |
| if (!isValidElement(propValue)) { | |
| var propType = getPropType(propValue); | |
| return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); | |
| } | |
| return null; | |
| } | |
| return createChainableTypeChecker(validate); | |
| } | |
| function createElementTypeTypeChecker() { | |
| function validate(props, propName, componentName, location, propFullName) { | |
| var propValue = props[propName]; | |
| if (!reactIs.isValidElementType(propValue)) { | |
| var propType = getPropType(propValue); | |
| return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.')); | |
| } | |
| return null; | |
| } | |
| return createChainableTypeChecker(validate); | |
| } | |
| function createInstanceTypeChecker(expectedClass) { | |
| function validate(props, propName, componentName, location, propFullName) { | |
| if (!(props[propName] instanceof expectedClass)) { | |
| var expectedClassName = expectedClass.name || ANONYMOUS; | |
| var actualClassName = getClassName(props[propName]); | |
| return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); | |
| } | |
| return null; | |
| } | |
| return createChainableTypeChecker(validate); | |
| } | |
| function createEnumTypeChecker(expectedValues) { | |
| if (!Array.isArray(expectedValues)) { | |
| if (process.env.NODE_ENV !== 'production') { | |
| if (arguments.length > 1) { | |
| printWarning$1( | |
| 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + | |
| 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' | |
| ); | |
| } else { | |
| printWarning$1('Invalid argument supplied to oneOf, expected an array.'); | |
| } | |
| } | |
| return emptyFunctionThatReturnsNull; | |
| } | |
| function validate(props, propName, componentName, location, propFullName) { | |
| var propValue = props[propName]; | |
| for (var i = 0; i < expectedValues.length; i++) { | |
| if (is(propValue, expectedValues[i])) { | |
| return null; | |
| } | |
| } | |
| var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { | |
| var type = getPreciseType(value); | |
| if (type === 'symbol') { | |
| return String(value); | |
| } | |
| return value; | |
| }); | |
| return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); | |
| } | |
| return createChainableTypeChecker(validate); | |
| } | |
| function createObjectOfTypeChecker(typeChecker) { | |
| function validate(props, propName, componentName, location, propFullName) { | |
| if (typeof typeChecker !== 'function') { | |
| return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); | |
| } | |
| var propValue = props[propName]; | |
| var propType = getPropType(propValue); | |
| if (propType !== 'object') { | |
| return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); | |
| } | |
| for (var key in propValue) { | |
| if (has$1(propValue, key)) { | |
| var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); | |
| if (error instanceof Error) { | |
| return error; | |
| } | |
| } | |
| } | |
| return null; | |
| } | |
| return createChainableTypeChecker(validate); | |
| } | |
| function createUnionTypeChecker(arrayOfTypeCheckers) { | |
| if (!Array.isArray(arrayOfTypeCheckers)) { | |
| process.env.NODE_ENV !== 'production' ? printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; | |
| return emptyFunctionThatReturnsNull; | |
| } | |
| for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | |
| var checker = arrayOfTypeCheckers[i]; | |
| if (typeof checker !== 'function') { | |
| printWarning$1( | |
| 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + | |
| 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' | |
| ); | |
| return emptyFunctionThatReturnsNull; | |
| } | |
| } | |
| function validate(props, propName, componentName, location, propFullName) { | |
| for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | |
| var checker = arrayOfTypeCheckers[i]; | |
| if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) { | |
| return null; | |
| } | |
| } | |
| return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); | |
| } | |
| return createChainableTypeChecker(validate); | |
| } | |
| function createNodeChecker() { | |
| function validate(props, propName, componentName, location, propFullName) { | |
| if (!isNode(props[propName])) { | |
| return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); | |
| } | |
| return null; | |
| } | |
| return createChainableTypeChecker(validate); | |
| } | |
| function createShapeTypeChecker(shapeTypes) { | |
| function validate(props, propName, componentName, location, propFullName) { | |
| var propValue = props[propName]; | |
| var propType = getPropType(propValue); | |
| if (propType !== 'object') { | |
| return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); | |
| } | |
| for (var key in shapeTypes) { | |
| var checker = shapeTypes[key]; | |
| if (!checker) { | |
| continue; | |
| } | |
| var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); | |
| if (error) { | |
| return error; | |
| } | |
| } | |
| return null; | |
| } | |
| return createChainableTypeChecker(validate); | |
| } | |
| function createStrictShapeTypeChecker(shapeTypes) { | |
| function validate(props, propName, componentName, location, propFullName) { | |
| var propValue = props[propName]; | |
| var propType = getPropType(propValue); | |
| if (propType !== 'object') { | |
| return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); | |
| } | |
| // We need to check all keys in case some are required but missing from | |
| // props. | |
| var allKeys = objectAssign({}, props[propName], shapeTypes); | |
| for (var key in allKeys) { | |
| var checker = shapeTypes[key]; | |
| if (!checker) { | |
| return new PropTypeError( | |
| 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + | |
| '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + | |
| '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') | |
| ); | |
| } | |
| var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); | |
| if (error) { | |
| return error; | |
| } | |
| } | |
| return null; | |
| } | |
| return createChainableTypeChecker(validate); | |
| } | |
| function isNode(propValue) { | |
| switch (typeof propValue) { | |
| case 'number': | |
| case 'string': | |
| case 'undefined': | |
| return true; | |
| case 'boolean': | |
| return !propValue; | |
| case 'object': | |
| if (Array.isArray(propValue)) { | |
| return propValue.every(isNode); | |
| } | |
| if (propValue === null || isValidElement(propValue)) { | |
| return true; | |
| } | |
| var iteratorFn = getIteratorFn(propValue); | |
| if (iteratorFn) { | |
| var iterator = iteratorFn.call(propValue); | |
| var step; | |
| if (iteratorFn !== propValue.entries) { | |
| while (!(step = iterator.next()).done) { | |
| if (!isNode(step.value)) { | |
| return false; | |
| } | |
| } | |
| } else { | |
| // Iterator will provide entry [k,v] tuples rather than values. | |
| while (!(step = iterator.next()).done) { | |
| var entry = step.value; | |
| if (entry) { | |
| if (!isNode(entry[1])) { | |
| return false; | |
| } | |
| } | |
| } | |
| } | |
| } else { | |
| return false; | |
| } | |
| return true; | |
| default: | |
| return false; | |
| } | |
| } | |
| function isSymbol(propType, propValue) { | |
| // Native Symbol. | |
| if (propType === 'symbol') { | |
| return true; | |
| } | |
| // falsy value can't be a Symbol | |
| if (!propValue) { | |
| return false; | |
| } | |
| // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' | |
| if (propValue['@@toStringTag'] === 'Symbol') { | |
| return true; | |
| } | |
| // Fallback for non-spec compliant Symbols which are polyfilled. | |
| if (typeof Symbol === 'function' && propValue instanceof Symbol) { | |
| return true; | |
| } | |
| return false; | |
| } | |
| // Equivalent of `typeof` but with special handling for array and regexp. | |
| function getPropType(propValue) { | |
| var propType = typeof propValue; | |
| if (Array.isArray(propValue)) { | |
| return 'array'; | |
| } | |
| if (propValue instanceof RegExp) { | |
| // Old webkits (at least until Android 4.0) return 'function' rather than | |
| // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ | |
| // passes PropTypes.object. | |
| return 'object'; | |
| } | |
| if (isSymbol(propType, propValue)) { | |
| return 'symbol'; | |
| } | |
| return propType; | |
| } | |
| // This handles more types than `getPropType`. Only used for error messages. | |
| // See `createPrimitiveTypeChecker`. | |
| function getPreciseType(propValue) { | |
| if (typeof propValue === 'undefined' || propValue === null) { | |
| return '' + propValue; | |
| } | |
| var propType = getPropType(propValue); | |
| if (propType === 'object') { | |
| if (propValue instanceof Date) { | |
| return 'date'; | |
| } else if (propValue instanceof RegExp) { | |
| return 'regexp'; | |
| } | |
| } | |
| return propType; | |
| } | |
| // Returns a string that is postfixed to a warning about an invalid type. | |
| // For example, "undefined" or "of type array" | |
| function getPostfixForTypeWarning(value) { | |
| var type = getPreciseType(value); | |
| switch (type) { | |
| case 'array': | |
| case 'object': | |
| return 'an ' + type; | |
| case 'boolean': | |
| case 'date': | |
| case 'regexp': | |
| return 'a ' + type; | |
| default: | |
| return type; | |
| } | |
| } | |
| // Returns class name of the object, if any. | |
| function getClassName(propValue) { | |
| if (!propValue.constructor || !propValue.constructor.name) { | |
| return ANONYMOUS; | |
| } | |
| return propValue.constructor.name; | |
| } | |
| ReactPropTypes.checkPropTypes = checkPropTypes_1; | |
| ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache; | |
| ReactPropTypes.PropTypes = ReactPropTypes; | |
| return ReactPropTypes; | |
| }; | |
| function emptyFunction() {} | |
| function emptyFunctionWithReset() {} | |
| emptyFunctionWithReset.resetWarningCache = emptyFunction; | |
| var factoryWithThrowingShims = function() { | |
| function shim(props, propName, componentName, location, propFullName, secret) { | |
| if (secret === ReactPropTypesSecret_1) { | |
| // It is still safe when called from React. | |
| return; | |
| } | |
| var err = new Error( | |
| 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | |
| 'Use PropTypes.checkPropTypes() to call them. ' + | |
| 'Read more at http://fb.me/use-check-prop-types' | |
| ); | |
| err.name = 'Invariant Violation'; | |
| throw err; | |
| } shim.isRequired = shim; | |
| function getShim() { | |
| return shim; | |
| } // Important! | |
| // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. | |
| var ReactPropTypes = { | |
| array: shim, | |
| bool: shim, | |
| func: shim, | |
| number: shim, | |
| object: shim, | |
| string: shim, | |
| symbol: shim, | |
| any: shim, | |
| arrayOf: getShim, | |
| element: shim, | |
| elementType: shim, | |
| instanceOf: getShim, | |
| node: shim, | |
| objectOf: getShim, | |
| oneOf: getShim, | |
| oneOfType: getShim, | |
| shape: getShim, | |
| exact: getShim, | |
| checkPropTypes: emptyFunctionWithReset, | |
| resetWarningCache: emptyFunction | |
| }; | |
| ReactPropTypes.PropTypes = ReactPropTypes; | |
| return ReactPropTypes; | |
| }; | |
| var propTypes = createCommonjsModule(function (module) { | |
| /** | |
| * Copyright (c) 2013-present, Facebook, Inc. | |
| * | |
| * This source code is licensed under the MIT license found in the | |
| * LICENSE file in the root directory of this source tree. | |
| */ | |
| if (process.env.NODE_ENV !== 'production') { | |
| var ReactIs = reactIs; | |
| // By explicitly using `prop-types` you are opting into new development behavior. | |
| // http://fb.me/prop-types-in-prod | |
| var throwOnDirectAccess = true; | |
| module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess); | |
| } else { | |
| // By explicitly using `prop-types` you are opting into new production behavior. | |
| // http://fb.me/prop-types-in-prod | |
| module.exports = factoryWithThrowingShims(); | |
| } | |
| }); | |
| var YAPCheckbox = function YAPCheckbox(_ref) { | |
| var _cx, _ref2; | |
| var className = _ref.className, | |
| intermediate = _ref.intermediate, | |
| dataQaSelector = _ref.dataQaSelector, | |
| defaultChecked = _ref.defaultChecked, | |
| onChange = _ref.onChange, | |
| disabled = _ref.disabled, | |
| readonly = _ref.readonly, | |
| style = _ref.style, | |
| name = _ref.name, | |
| value = _ref.value, | |
| checked = _ref.checked, | |
| label = _ref.label, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["className", "intermediate", "dataQaSelector", "defaultChecked", "onChange", "disabled", "readonly", "style", "name", "value", "checked", "label"]); | |
| var checkboxClassnames = classnames((_cx = { | |
| 'ansh-checkbox': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var _useState = useState(defaultChecked), | |
| unControlledChecked = _useState[0], | |
| unControlledSetChecked = _useState[1]; | |
| var isCheckboxControlled = Boolean(onChange); | |
| var isChecked = !isCheckboxControlled ? unControlledChecked : checked; | |
| var renderCheckboxIcon = function renderCheckboxIcon() { | |
| return intermediate ? /*#__PURE__*/React.createElement(CheckboxPartialIcon, { | |
| width: "18", | |
| height: "18" | |
| }) : isChecked ? /*#__PURE__*/React.createElement(CheckboxCheckedIcon, { | |
| width: "18", | |
| height: "18" | |
| }) : /*#__PURE__*/React.createElement(CheckboxUncheckedIcon, { | |
| width: "18", | |
| height: "18" | |
| }); | |
| }; | |
| var handleOnChange = function handleOnChange(e) { | |
| var isChecked = e.target.checked; | |
| if (isCheckboxControlled) { | |
| onChange(e); | |
| } else { | |
| unControlledSetChecked(isChecked); | |
| } | |
| }; | |
| return /*#__PURE__*/React.createElement("label", { | |
| className: checkboxClassnames, | |
| "data-disabled": disabled, | |
| "data-readonly": readonly, | |
| style: style | |
| }, /*#__PURE__*/React.createElement("input", _extends({ | |
| className: "ansh-checkbox__input", | |
| type: "checkbox", | |
| "data-readonly": readonly, | |
| disabled: disabled, | |
| name: name, | |
| readOnly: readonly, | |
| value: value | |
| }, (_ref2 = {}, _ref2[isCheckboxControlled ? 'checked' : 'defaultChecked'] = isChecked, _ref2), { | |
| "data-qa-selector": dataQaSelector, | |
| onChange: handleOnChange | |
| }, rest)), /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-checkbox__icon", | |
| "data-readonly": readonly, | |
| "data-disabled": disabled, | |
| "data-checked": Boolean(isChecked) || Boolean(intermediate) | |
| }, /*#__PURE__*/React.createElement("div", { | |
| style: { | |
| display: 'flex', | |
| justifyContent: 'center', | |
| alignItems: 'center' | |
| } | |
| }, renderCheckboxIcon())), /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-checkbox__label ansh-body" | |
| }, label)); | |
| }; | |
| YAPCheckbox.propTypes = { | |
| className: propTypes.string, | |
| intermediate: propTypes.bool, | |
| dataQaSelector: propTypes.string, | |
| defaultChecked: propTypes.string, | |
| onChange: propTypes.func, | |
| disabled: propTypes.bool, | |
| readonly: propTypes.bool, | |
| name: propTypes.string, | |
| value: propTypes.string, | |
| checked: propTypes.bool, | |
| label: propTypes.node | |
| }; | |
| var YAPCheckboxGroup = function YAPCheckboxGroup(_ref) { | |
| var _cx; | |
| var className = _ref.className, | |
| _ref$orientation = _ref.orientation, | |
| orientation = _ref$orientation === void 0 ? 'vertical' : _ref$orientation, | |
| children = _ref.children, | |
| onChange = _ref.onChange, | |
| value = _ref.value, | |
| name = _ref.name, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["className", "orientation", "children", "onChange", "value", "name"]); | |
| var checkboxGroupClassnames = classnames((_cx = { | |
| 'ansh-checkbox-group': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var handleOnChange = function handleOnChange(e) { | |
| var checkedValue = e.target.value; | |
| var isValueChecked = e.target.checked; | |
| if (value.includes(checkedValue) && !isValueChecked) { | |
| onChange(value.filter(function (v) { | |
| return v !== checkedValue; | |
| })); | |
| } else if (!value.includes(checkedValue) && isValueChecked) { | |
| onChange([].concat(value, [checkedValue])); | |
| } | |
| }; | |
| var getIsChecked = function getIsChecked(val) { | |
| if (value instanceof String) { | |
| return value === val; | |
| } else if (value instanceof Array) { | |
| return value.includes(val); | |
| } | |
| }; | |
| var getCheckboxGroupControlledProps = function getCheckboxGroupControlledProps(childProps) { | |
| if (onChange) { | |
| return { | |
| onChange: handleOnChange, | |
| checked: getIsChecked(childProps.value) | |
| }; | |
| } | |
| return {}; | |
| }; | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: checkboxGroupClassnames, | |
| "data-orientation": orientation | |
| }, rest), React.Children.map(children, function (child) { | |
| return /*#__PURE__*/React.cloneElement(child, _extends({}, child.props, { | |
| name: name | |
| }, getCheckboxGroupControlledProps(child.props))); | |
| })); | |
| }; | |
| var YAPRadio = function YAPRadio(_ref) { | |
| var _cx; | |
| var className = _ref.className, | |
| dataQaSelector = _ref.dataQaSelector, | |
| onChange = _ref.onChange, | |
| _ref$disabled = _ref.disabled, | |
| disabled = _ref$disabled === void 0 ? false : _ref$disabled, | |
| _ref$readonly = _ref.readonly, | |
| readonly = _ref$readonly === void 0 ? false : _ref$readonly, | |
| style = _ref.style, | |
| name = _ref.name, | |
| value = _ref.value, | |
| _ref$checked = _ref.checked, | |
| checked = _ref$checked === void 0 ? false : _ref$checked, | |
| label = _ref.label, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["className", "intermediate", "dataQaSelector", "defaultChecked", "onChange", "disabled", "readonly", "style", "name", "value", "checked", "label"]); | |
| var radioClassnames = classnames((_cx = { | |
| 'ansh-radio': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| return /*#__PURE__*/React.createElement("label", { | |
| className: radioClassnames, | |
| "data-readonly": readonly, | |
| "data-disabled": disabled, | |
| style: style | |
| }, /*#__PURE__*/React.createElement("input", _extends({ | |
| className: "ansh-radio__input", | |
| type: "radio", | |
| disabled: disabled, | |
| name: name, | |
| readOnly: readonly, | |
| value: value, | |
| checked: checked, | |
| "data-qa-selector": dataQaSelector, | |
| onChange: onChange | |
| }, rest)), /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-radio__control", | |
| "data-disabled": disabled, | |
| "data-checked": checked | |
| }, /*#__PURE__*/React.createElement("div", { | |
| style: { | |
| display: 'flex', | |
| justifyContent: 'center', | |
| alignItems: 'center' | |
| } | |
| }, checked ? /*#__PURE__*/React.createElement(RadioCheckedIcon, { | |
| width: "18", | |
| height: "18" | |
| }) : /*#__PURE__*/React.createElement(RadioUncheckedIcon, { | |
| width: "18", | |
| height: "18" | |
| }))), /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-radio__label ansh-body" | |
| }, label)); | |
| }; | |
| YAPRadio.propTypes = { | |
| className: propTypes.string, | |
| dataQaSelector: propTypes.string, | |
| defaultChecked: propTypes.string, | |
| onChange: propTypes.func, | |
| disabled: propTypes.bool, | |
| readonly: propTypes.bool, | |
| name: propTypes.string, | |
| value: propTypes.string, | |
| checked: propTypes.bool, | |
| label: propTypes.string | |
| }; | |
| var YAPRadioGroup = function YAPRadioGroup(_ref) { | |
| var _cx; | |
| var className = _ref.className, | |
| _ref$orientation = _ref.orientation, | |
| orientation = _ref$orientation === void 0 ? 'vertical' : _ref$orientation, | |
| children = _ref.children, | |
| onChange = _ref.onChange, | |
| selected = _ref.selected, | |
| name = _ref.name, | |
| disabled = _ref.disabled, | |
| readonly = _ref.readonly, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["className", "orientation", "children", "onChange", "selected", "name", "disabled", "readonly"]); | |
| var checkboxGroupClassnames = classnames((_cx = { | |
| 'ansh-radio-group': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var handleOnChange = function handleOnChange(e) { | |
| var val = e.target.value; | |
| onChange(val); | |
| }; | |
| var getControlledProps = function getControlledProps(childProps) { | |
| if (onChange) { | |
| return { | |
| onChange: handleOnChange, | |
| checked: selected === childProps.value | |
| }; | |
| } | |
| return { | |
| checked: selected | |
| }; | |
| }; | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: checkboxGroupClassnames, | |
| "data-orientation": orientation | |
| }, rest), React.Children.map(children, function (child) { | |
| return /*#__PURE__*/React.cloneElement(child, _extends({ | |
| name: name, | |
| disabled: disabled, | |
| readonly: readonly | |
| }, child.props, getControlledProps(child.props))); | |
| })); | |
| }; | |
| var YAPFormControl = function YAPFormControl(_ref) { | |
| var _cx; | |
| var children = _ref.children, | |
| className = _ref.className, | |
| style = _ref.style, | |
| disabled = _ref.disabled, | |
| required = _ref.required, | |
| invalid = _ref.invalid, | |
| id = _ref.id, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "style", "disabled", "required", "invalid", "id"]); | |
| var formControlClassnames = classnames((_cx = { | |
| 'ansh-form-control': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var context = { | |
| disabled: disabled, | |
| required: required, | |
| invalid: invalid, | |
| id: id | |
| }; | |
| return /*#__PURE__*/React.createElement(FormControlContext.Provider, { | |
| value: context | |
| }, /*#__PURE__*/React.createElement("div", _extends({ | |
| className: formControlClassnames, | |
| style: style | |
| }, rest), children)); | |
| }; | |
| var YAPFormLabel = function YAPFormLabel(_ref) { | |
| var _cx; | |
| var children = _ref.children, | |
| className = _ref.className, | |
| dataQaSelector = _ref.dataQaSelector, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "dataQaSelector"]); | |
| var formContext = useFormControl(); | |
| var labelID = formContext ? formContext.id : undefined; | |
| var labelClassnames = classnames((_cx = { | |
| 'ansh-form-control__label ansh-h6': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| return /*#__PURE__*/React.createElement("label", _extends({ | |
| className: labelClassnames, | |
| htmlFor: labelID, | |
| "data-qa-selector": dataQaSelector | |
| }, rest), children, formContext.required ? /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-form-control__label--required" | |
| }, "*") : null); | |
| }; | |
| var YAPFormErrorMessage = function YAPFormErrorMessage(_ref) { | |
| var _cx; | |
| var className = _ref.className, | |
| children = _ref.children, | |
| props = _objectWithoutPropertiesLoose(_ref, ["className", "style", "dataQaSelector", "children"]); | |
| var formContext = useFormControl(); | |
| var formErrorClassnames = classnames((_cx = { | |
| 'ansh-form-control__error ansh-body': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var isFieldInvalid = formContext ? formContext.invalid : undefined; | |
| return isFieldInvalid ? /*#__PURE__*/React.createElement("div", { | |
| className: formErrorClassnames | |
| }, children) : null; | |
| }; | |
| var YAPFormHelpText = function YAPFormHelpText(_ref) { | |
| var _cx; | |
| var children = _ref.children, | |
| className = _ref.className, | |
| dataQaSelector = _ref.dataQaSelector, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "dataQaSelector"]); | |
| var helptextClassnames = classnames((_cx = { | |
| 'ansh-form-control__helptext ansh-body': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var formContext = useFormControl(); | |
| var helptextId = formContext ? formContext.id + "-helptext" : undefined; | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: helptextClassnames, | |
| id: helptextId, | |
| "data-qa-selector": dataQaSelector | |
| }, rest), children); | |
| }; | |
| var mapToastProgressColorToClassnames = { | |
| primary: 'ansh-toast--progress-bar__primary', | |
| secondary: 'ansh-toast--progress-bar__secondary', | |
| success: 'ansh-toast--progress-bar__success', | |
| danger: 'ansh-toast--progress-bar__danger', | |
| warning: 'ansh-toast--progress-bar__warning', | |
| info: 'ansh-toast--progress-bar__info' | |
| }; | |
| var YAPToast = function YAPToast(_ref) { | |
| var _cx, _cx2; | |
| var children = _ref.children, | |
| title = _ref.title, | |
| icon = _ref.icon, | |
| dataQaSelector = _ref.dataQaSelector, | |
| _ref$color = _ref.color, | |
| color = _ref$color === void 0 ? 'primary' : _ref$color, | |
| onCancel = _ref.onCancel, | |
| _ref$progressDuration = _ref.progressDuration, | |
| progressDuration = _ref$progressDuration === void 0 ? 5000 : _ref$progressDuration, | |
| className = _ref.className, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["children", "title", "icon", "dataQaSelector", "color", "onCancel", "progressDuration", "className"]); | |
| var toastRef = useRef(null); | |
| var toastRAFRef = useRef(null); | |
| useLayoutEffect(function () { | |
| toastRef.current.style.transitionDuration = progressDuration + "ms"; | |
| var startTime = window.performance.now(); | |
| function step(currentTime) { | |
| var diff = Math.round(currentTime - startTime); | |
| var val = Math.round(diff / progressDuration * 100); | |
| val = val > 100 ? 100 : val; | |
| toastRef.current.style.width = val + "%"; | |
| if (diff < progressDuration) { | |
| toastRAFRef.current = window.requestAnimationFrame(step); | |
| } | |
| } | |
| toastRAFRef.current = window.requestAnimationFrame(step, 100); | |
| return function () { | |
| window.cancelAnimationFrame(toastRAFRef.current); | |
| }; | |
| }, []); | |
| var progressColorClass = mapToastProgressColorToClassnames[color]; | |
| var toastWrapperClassnames = classnames((_cx = { | |
| 'ansh-toast ansh-toast--wrapper': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var toastProgressClassnames = classnames((_cx2 = { | |
| 'ansh-toast--progress-bar': true | |
| }, _cx2[progressColorClass] = true, _cx2[className] = Boolean(className), _cx2)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: toastWrapperClassnames | |
| }, rest), /*#__PURE__*/React.createElement("div", { | |
| className: toastProgressClassnames, | |
| ref: toastRef | |
| }), /*#__PURE__*/React.createElement(YAPBanner, { | |
| icon: icon, | |
| color: color, | |
| variant: "solid", | |
| title: title, | |
| onCancel: onCancel, | |
| dataQaSelector: dataQaSelector | |
| }, children)); | |
| }; | |
| var YAPSwitch = function YAPSwitch(_ref) { | |
| var _cx; | |
| var className = _ref.className, | |
| dataQaSelector = _ref.dataQaSelector, | |
| onChange = _ref.onChange, | |
| disabled = _ref.disabled, | |
| style = _ref.style, | |
| selectedIcon = _ref.selectedIcon, | |
| unSelectedIcon = _ref.unSelectedIcon, | |
| name = _ref.name, | |
| selected = _ref.selected, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["className", "dataQaSelector", "onChange", "disabled", "style", "selectedIcon", "unSelectedIcon", "name", "selected"]); | |
| var renderIcons = function renderIcons() { | |
| return selected ? selectedIcon : unSelectedIcon; | |
| }; | |
| var switchWrapperClassnames = classnames((_cx = { | |
| 'ansh-switch ansh-switch--wrapper': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var handleOnChange = function handleOnChange(e) { | |
| onChange(e.target.checked); | |
| }; | |
| return /*#__PURE__*/React.createElement("label", { | |
| className: switchWrapperClassnames, | |
| style: style | |
| }, /*#__PURE__*/React.createElement("input", _extends({ | |
| className: "ansh-switch--input", | |
| type: "checkbox", | |
| name: name, | |
| "data-qa-selector": dataQaSelector, | |
| checked: selected, | |
| disabled: disabled, | |
| "data-disabled": disabled, | |
| onChange: handleOnChange | |
| }, rest)), /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-switch--track", | |
| "data-checked": selected, | |
| "data-disabled": disabled | |
| }, /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-switch--button" | |
| }, selectedIcon || unSelectedIcon ? renderIcons() : null))); | |
| }; | |
| YAPSwitch.propTypes = { | |
| className: propTypes.string, | |
| dataQaSelector: propTypes.string, | |
| selected: propTypes.bool.isRequired, | |
| onChange: propTypes.func.isRequired, | |
| disabled: propTypes.bool, | |
| name: propTypes.string | |
| }; | |
| var YAPTopbarLayer = function YAPTopbarLayer(_ref) { | |
| var _cx; | |
| var children = _ref.children, | |
| className = _ref.className, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["children", "className"]); | |
| var topbarLayerClassnames = classnames((_cx = { | |
| 'ansh-topbar-layer': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: topbarLayerClassnames | |
| }, rest), children); | |
| }; | |
| var YAPSidebarLayer = function YAPSidebarLayer(_ref2) { | |
| var _cx2; | |
| var children = _ref2.children, | |
| className = _ref2.className, | |
| rest = _objectWithoutPropertiesLoose(_ref2, ["children", "className"]); | |
| var sidebarLayerClassnames = classnames((_cx2 = { | |
| 'ansh-sidebar-layer': true | |
| }, _cx2[className] = Boolean(className), _cx2)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: sidebarLayerClassnames | |
| }, rest), children); | |
| }; | |
| var YAPPageLayer = function YAPPageLayer(_ref3) { | |
| var _cx3; | |
| var children = _ref3.children, | |
| className = _ref3.className, | |
| rest = _objectWithoutPropertiesLoose(_ref3, ["children", "className"]); | |
| var pageLayerClassnames = classnames((_cx3 = { | |
| 'ansh-page-layer': true | |
| }, _cx3[className] = Boolean(className), _cx3)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: pageLayerClassnames | |
| }, rest), children); | |
| }; | |
| var YAPContentAreaLayer = function YAPContentAreaLayer(_ref4) { | |
| var _cx4; | |
| var children = _ref4.children, | |
| className = _ref4.className, | |
| rest = _objectWithoutPropertiesLoose(_ref4, ["children", "className"]); | |
| var contentAreaLayerClassnames = classnames((_cx4 = { | |
| 'ansh-content-area-layer': true | |
| }, _cx4[className] = Boolean(className), _cx4)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: contentAreaLayerClassnames | |
| }, rest), children); | |
| }; | |
| var YAPSectionLayer = function YAPSectionLayer(_ref5) { | |
| var _cx5; | |
| var children = _ref5.children, | |
| className = _ref5.className, | |
| rest = _objectWithoutPropertiesLoose(_ref5, ["children", "className"]); | |
| var sectionLayerClassnames = classnames((_cx5 = { | |
| 'ansh-section-layer': true | |
| }, _cx5[className] = Boolean(className), _cx5)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: sectionLayerClassnames | |
| }, rest), children); | |
| }; | |
| var YAPSectionHeaderLayer = function YAPSectionHeaderLayer(_ref6) { | |
| var _cx6; | |
| var children = _ref6.children, | |
| className = _ref6.className, | |
| rest = _objectWithoutPropertiesLoose(_ref6, ["children", "className"]); | |
| var sectionHeaderLayerClassnames = classnames((_cx6 = { | |
| 'ansh-section-header-layer': true | |
| }, _cx6[className] = Boolean(className), _cx6)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: sectionHeaderLayerClassnames | |
| }, rest), children); | |
| }; | |
| var YAPSectionContentLayer = function YAPSectionContentLayer(_ref7) { | |
| var _cx7; | |
| var children = _ref7.children, | |
| className = _ref7.className, | |
| rest = _objectWithoutPropertiesLoose(_ref7, ["children", "className"]); | |
| var sectionContentLayerClassnames = classnames((_cx7 = { | |
| 'ansh-section-content-layer': true | |
| }, _cx7[className] = Boolean(className), _cx7)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: sectionContentLayerClassnames | |
| }, rest), children); | |
| }; | |
| var YAPSectionFooterLayer = function YAPSectionFooterLayer(_ref8) { | |
| var _cx8; | |
| var children = _ref8.children, | |
| className = _ref8.className, | |
| rest = _objectWithoutPropertiesLoose(_ref8, ["children", "className"]); | |
| var sectionFooterLayerClassnames = classnames((_cx8 = { | |
| 'ansh-section-footer-layer': true | |
| }, _cx8[className] = Boolean(className), _cx8)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: sectionFooterLayerClassnames | |
| }, rest), children); | |
| }; | |
| var YAPBackdropLayer = function YAPBackdropLayer(_ref9) { | |
| var _cx9; | |
| var children = _ref9.children, | |
| className = _ref9.className, | |
| rest = _objectWithoutPropertiesLoose(_ref9, ["children", "className"]); | |
| var backdropLayerClassnames = classnames((_cx9 = { | |
| 'ansh-backdrop-layer': true | |
| }, _cx9[className] = Boolean(className), _cx9)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: backdropLayerClassnames | |
| }, rest), children); | |
| }; | |
| var YAPActionBarLayer = function YAPActionBarLayer(_ref10) { | |
| var _cx10; | |
| var children = _ref10.children, | |
| className = _ref10.className, | |
| rest = _objectWithoutPropertiesLoose(_ref10, ["children", "className"]); | |
| var actionBarLayerClassnames = classnames((_cx10 = { | |
| 'ansh-action-bar-layer': true | |
| }, _cx10[className] = Boolean(className), _cx10)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: actionBarLayerClassnames | |
| }, rest), children); | |
| }; | |
| var YAPSidebarBackdropLayer = function YAPSidebarBackdropLayer(_ref11) { | |
| var _cx11; | |
| var children = _ref11.children, | |
| className = _ref11.className, | |
| rest = _objectWithoutPropertiesLoose(_ref11, ["children", "className"]); | |
| var sidebarBackdropLayerClassnames = classnames((_cx11 = { | |
| 'ansh-sidebar-backdrop-layer': true | |
| }, _cx11[className] = Boolean(className), _cx11)); | |
| return /*#__PURE__*/React.createElement(YAPBackdropLayer, _extends({ | |
| className: sidebarBackdropLayerClassnames | |
| }, rest), children); | |
| }; | |
| var YAPOverlayLayer = /*#__PURE__*/React.forwardRef(function (_ref12, ref) { | |
| var _cx12; | |
| var children = _ref12.children, | |
| className = _ref12.className, | |
| rest = _objectWithoutPropertiesLoose(_ref12, ["children", "className"]); | |
| var overlayLayerClassnames = classnames((_cx12 = { | |
| 'ansh-overlay-layer': true | |
| }, _cx12[className] = Boolean(className), _cx12)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: overlayLayerClassnames | |
| }, rest, { | |
| ref: ref | |
| }), children); | |
| }); | |
| var YAPOverlayHeaderLayer = function YAPOverlayHeaderLayer(_ref13) { | |
| var _cx13; | |
| var children = _ref13.children, | |
| dataQaSelector = _ref13.dataQaSelector, | |
| className = _ref13.className, | |
| rest = _objectWithoutPropertiesLoose(_ref13, ["children", "dataQaSelector", "className"]); | |
| var overlayHeaderLayerClassnames = classnames((_cx13 = { | |
| 'ansh-overlay-header-layer': true | |
| }, _cx13[className] = Boolean(className), _cx13)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: overlayHeaderLayerClassnames, | |
| "data-qa-selector": dataQaSelector | |
| }, rest), children); | |
| }; | |
| var YAPOverlayBodyLayer = function YAPOverlayBodyLayer(_ref14) { | |
| var _cx14; | |
| var children = _ref14.children, | |
| className = _ref14.className, | |
| dataQaSelector = _ref14.dataQaSelector, | |
| rest = _objectWithoutPropertiesLoose(_ref14, ["children", "className", "dataQaSelector"]); | |
| var overlayBodyLayerClassnames = classnames((_cx14 = { | |
| 'ansh-overlay-body-layer': true | |
| }, _cx14[className] = Boolean(className), _cx14)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: overlayBodyLayerClassnames, | |
| "data-qa-selector": dataQaSelector | |
| }, rest), children); | |
| }; | |
| var YAPOverlayFooterLayer = function YAPOverlayFooterLayer(_ref15) { | |
| var _cx15; | |
| var children = _ref15.children, | |
| className = _ref15.className, | |
| dataQaSelector = _ref15.dataQaSelector, | |
| rest = _objectWithoutPropertiesLoose(_ref15, ["children", "className", "dataQaSelector"]); | |
| var overlayFooterLayerClassnames = classnames((_cx15 = { | |
| 'ansh-overlay-footer-layer': true | |
| }, _cx15[className] = Boolean(className), _cx15)); | |
| return /*#__PURE__*/React.createElement(YAPActionBarLayer, _extends({ | |
| className: overlayFooterLayerClassnames, | |
| "data-qa-selector": dataQaSelector | |
| }, rest), children); | |
| }; | |
| var YAPOverlayBackdropLayer = function YAPOverlayBackdropLayer(_ref16) { | |
| var _cx16; | |
| var children = _ref16.children, | |
| className = _ref16.className, | |
| rest = _objectWithoutPropertiesLoose(_ref16, ["children", "className"]); | |
| var overlayBackdropLayerClassnames = classnames((_cx16 = { | |
| 'ansh-overlay-backdrop-layer': true | |
| }, _cx16[className] = Boolean(className), _cx16)); | |
| return /*#__PURE__*/React.createElement(YAPBackdropLayer, _extends({ | |
| className: overlayBackdropLayerClassnames | |
| }, rest), children); | |
| }; | |
| var YAPCard = function YAPCard(_ref) { | |
| var _cx; | |
| var children = _ref.children, | |
| className = _ref.className, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["children", "className"]); | |
| var cardClassname = classnames((_cx = { | |
| 'ansh-card': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: cardClassname | |
| }, rest), children); | |
| }; | |
| var YAPCardBody = function YAPCardBody(_ref2) { | |
| var _cx2; | |
| var children = _ref2.children, | |
| className = _ref2.className, | |
| rest = _objectWithoutPropertiesLoose(_ref2, ["children", "className"]); | |
| var cardBodyClassname = classnames((_cx2 = { | |
| 'ansh-card--body': true | |
| }, _cx2[className] = Boolean(className), _cx2)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: cardBodyClassname | |
| }, rest), children); | |
| }; | |
| var YAPCardFooter = function YAPCardFooter(_ref3) { | |
| var _cx3; | |
| var children = _ref3.children, | |
| className = _ref3.className, | |
| rest = _objectWithoutPropertiesLoose(_ref3, ["children", "className"]); | |
| var cardFooterClassname = classnames((_cx3 = { | |
| 'ansh-card--footer': true | |
| }, _cx3[className] = Boolean(className), _cx3)); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: cardFooterClassname | |
| }, rest), children); | |
| }; | |
| YAPCard.propTypes = { | |
| className: propTypes.string | |
| }; | |
| YAPCardBody.propTypes = { | |
| className: propTypes.string | |
| }; | |
| YAPCardFooter.propTypes = { | |
| className: propTypes.string | |
| }; | |
| var YAPPagination = function YAPPagination(_ref) { | |
| var _cx; | |
| var _ref$defaultPage = _ref.defaultPage, | |
| defaultPage = _ref$defaultPage === void 0 ? 1 : _ref$defaultPage, | |
| _ref$itemPerPage = _ref.itemPerPage, | |
| itemPerPage = _ref$itemPerPage === void 0 ? 10 : _ref$itemPerPage, | |
| _ref$totalItems = _ref.totalItems, | |
| totalItems = _ref$totalItems === void 0 ? 25 : _ref$totalItems, | |
| onPageChange = _ref.onPageChange, | |
| renderPageInfo = _ref.renderPageInfo, | |
| _ref$dataQaSelector = _ref.dataQaSelector, | |
| dataQaSelector = _ref$dataQaSelector === void 0 ? {} : _ref$dataQaSelector, | |
| className = _ref.className, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["defaultPage", "itemPerPage", "totalItems", "onPageChange", "renderPageInfo", "dataQaSelector", "className"]); | |
| var _useState = useState(defaultPage), | |
| page = _useState[0], | |
| setPage = _useState[1]; | |
| var totalPages = Math.ceil(totalItems / itemPerPage); | |
| var paginationClassname = classnames((_cx = { | |
| 'ansh-pagination': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var handleSetPage = function handleSetPage(selectedPage) { | |
| if (selectedPage < 1 || selectedPage > totalPages) return; | |
| setPage(selectedPage); | |
| onPageChange && onPageChange(selectedPage); | |
| }; | |
| var handleOnPrevClick = function handleOnPrevClick() { | |
| var nextPage = page - 1; | |
| handleSetPage(nextPage); | |
| }; | |
| var handleOnNextClick = function handleOnNextClick() { | |
| var nextPage = page + 1; | |
| handleSetPage(nextPage); | |
| }; | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: paginationClassname | |
| }, rest), /*#__PURE__*/React.createElement("button", { | |
| className: "ansh-pagination-btn ansh-pagination-btn--prev", | |
| onClick: handleOnPrevClick, | |
| "data-qa-selector": dataQaSelector.prevBtn, | |
| disabled: page === 1 | |
| }, /*#__PURE__*/React.createElement(ArrowBackIcon, { | |
| width: "14", | |
| height: "14" | |
| })), /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-pagination--pager ansh-caption", | |
| "data-qa-selector": dataQaSelector.pageInfo | |
| }, renderPageInfo ? renderPageInfo({ | |
| page: page, | |
| totalPages: totalPages, | |
| defaultPage: defaultPage, | |
| itemPerPage: itemPerPage, | |
| totalItems: totalItems | |
| }) : page + " of " + totalPages), /*#__PURE__*/React.createElement("button", { | |
| className: "ansh-pagination-btn ansh-pagination-btn--next", | |
| onClick: handleOnNextClick, | |
| "data-qa-selector": dataQaSelector.nextBtn, | |
| disabled: page === totalPages | |
| }, /*#__PURE__*/React.createElement(ArrowForwardIcon, { | |
| width: "14", | |
| height: "14" | |
| }))); | |
| }; | |
| YAPPagination.propTypes = { | |
| className: propTypes.string, | |
| defaultPage: propTypes.number.isRequired, | |
| itemPerPage: propTypes.number.isRequired, | |
| totalItems: propTypes.number.isRequired, | |
| onPageChange: propTypes.func.isRequired, | |
| renderPageInfo: propTypes.func | |
| }; | |
| var getContrast = function getContrast(hexcolor) { | |
| if (hexcolor.slice(0, 1) === '#') { | |
| hexcolor = hexcolor.slice(1); | |
| } | |
| if (hexcolor.length === 3) { | |
| hexcolor = hexcolor.split('').map(function (hex) { | |
| return hex + hex; | |
| }).join(''); | |
| } | |
| var r = parseInt(hexcolor.substr(0, 2), 16); | |
| var g = parseInt(hexcolor.substr(2, 2), 16); | |
| var b = parseInt(hexcolor.substr(4, 2), 16); | |
| var red = r * 299; | |
| var green = g * 587; | |
| var blue = b * 114; | |
| var yiq = (red + green + blue) / 1000; | |
| return yiq >= 128 ? 'black' : 'white'; | |
| }; | |
| var setTheme = function setTheme(theme) { | |
| if (theme === undefined || typeof theme === 'string' && ['dark', 'light'].includes(theme)) { | |
| var prevTheme = document.body.dataset.theme || 'light'; | |
| var nextTheme = theme || (prevTheme === 'dark' ? 'light' : 'dark'); | |
| document.body.dataset.theme = nextTheme; | |
| } else { | |
| throw new Error("Passed theme as " + typeof theme + ", but expected theme as string one of 'dark / light'"); | |
| } | |
| }; | |
| var setDirection = function setDirection(direction) { | |
| if (direction === undefined || typeof direction === 'string' && ['ltr', 'rtl'].includes(direction)) { | |
| var prevDirection = document.body.dataset.direction || 'ltr'; | |
| var nextDirection = direction || (prevDirection === 'rtl' ? 'ltr' : 'rtl'); | |
| document.body.dataset.direction = nextDirection; | |
| } else { | |
| throw new Error("Passed direction as " + typeof theme + ", but expected direction as string one of 'ltr / rtl'"); | |
| } | |
| }; | |
| var YAPTag = function YAPTag(_ref) { | |
| var _cx; | |
| var children = _ref.children, | |
| className = _ref.className, | |
| style = _ref.style, | |
| dataQaSelector = _ref.dataQaSelector, | |
| _ref$bgColor = _ref.bgColor, | |
| bgColor = _ref$bgColor === void 0 ? '#000' : _ref$bgColor, | |
| textColor = _ref.textColor, | |
| onClose = _ref.onClose, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "style", "dataQaSelector", "bgColor", "textColor", "onClose"]); | |
| var tagClassname = classnames((_cx = { | |
| 'ansh-tag ansh-caption': true, | |
| 'ansh-tag--is_closable': onClose | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var mergeStyle = _extends({ | |
| background: bgColor, | |
| color: textColor || getContrast(bgColor) | |
| }, style); | |
| return /*#__PURE__*/React.createElement("button", _extends({ | |
| style: mergeStyle, | |
| className: tagClassname | |
| }, rest, { | |
| onClick: onClose | |
| }), children, onClose ? /*#__PURE__*/React.createElement("span", { | |
| className: "ansh-tag--close-icon", | |
| "data-qa-selector": dataQaSelector | |
| }, /*#__PURE__*/React.createElement(CloseIcon, { | |
| width: "10", | |
| height: "10" | |
| })) : null); | |
| }; | |
| YAPTag.propTypes = { | |
| className: propTypes.string, | |
| onClose: propTypes.func, | |
| bgColor: propTypes.string, | |
| textColor: propTypes.string, | |
| dataQaSelector: propTypes.string | |
| }; | |
| var YAPLink = function YAPLink(_ref) { | |
| var _cx; | |
| var _ref$as = _ref.as, | |
| as = _ref$as === void 0 ? 'a' : _ref$as, | |
| children = _ref.children, | |
| dataQaSelector = _ref.dataQaSelector, | |
| className = _ref.className, | |
| _ref$href = _ref.href, | |
| href = _ref$href === void 0 ? '#' : _ref$href, | |
| onClick = _ref.onClick, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["as", "children", "dataQaSelector", "className", "href", "onClick"]); | |
| var Component = as; | |
| var linkClassname = classnames((_cx = { | |
| 'ansh-link': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var handleOnClick = function handleOnClick(e) { | |
| onClick && onClick(e); | |
| }; | |
| return /*#__PURE__*/React.createElement(Component, _extends({ | |
| className: linkClassname, | |
| href: href, | |
| onClick: handleOnClick, | |
| "data-qa-selector": dataQaSelector | |
| }, rest), children); | |
| }; | |
| YAPLink.propTypes = { | |
| className: propTypes.string, | |
| as: propTypes.oneOfType([propTypes.string, propTypes.node, propTypes.func]), | |
| dataQaSelector: propTypes.string | |
| }; | |
| var generateRandomColor = function generateRandomColor(str) { | |
| var colors = ['#e51c23', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5', '#5677fc', '#03a9f4', '#00bcd4', '#009688', '#259b24', '#8bc34a', '#afb42b', '#ff9800', '#ff5722', '#795548', '#607d8b']; | |
| var hash = 0; | |
| if (str.length === 0) return hash; | |
| for (var i = 0; i < str.length; i++) { | |
| hash = str.charCodeAt(i) + ((hash << 5) - hash); | |
| hash = hash & hash; | |
| } | |
| hash = (hash % colors.length + colors.length) % colors.length; | |
| return colors[hash]; | |
| }; | |
| var getInitials = function getInitials(name) { | |
| if (!name) { | |
| return ''; | |
| } | |
| var _name$trim$split$join = name.trim().split(' ').join(''), | |
| firstLetter = _name$trim$split$join[0], | |
| lastLetter = _name$trim$split$join[1]; | |
| return [firstLetter, lastLetter].filter(Boolean).join(''); | |
| }; | |
| var mapSizeToClassname = { | |
| small: 'ansh-avatar--sm ansh-h6', | |
| medium: 'ansh-avatar--md ansh-h5', | |
| large: 'ansh-avatar--lg ansh-h4' | |
| }; | |
| var mapVariantToClassname = { | |
| rounded: 'ansh-avatar--rounded', | |
| squared: 'ansh-avatar--squared' | |
| }; | |
| var YAPAvatar = function YAPAvatar(_ref) { | |
| var _cx; | |
| var _ref$variant = _ref.variant, | |
| variant = _ref$variant === void 0 ? 'rounded' : _ref$variant, | |
| _ref$size = _ref.size, | |
| size = _ref$size === void 0 ? 'medium' : _ref$size, | |
| photo = _ref.photo, | |
| _ref$name = _ref.name, | |
| name = _ref$name === void 0 ? 'SM' : _ref$name, | |
| dataQaSelector = _ref.dataQaSelector, | |
| className = _ref.className, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["variant", "size", "photo", "name", "dataQaSelector", "className"]); | |
| var sizeClassname = mapSizeToClassname[size]; | |
| var variantClassname = mapVariantToClassname[variant]; | |
| var backgroundColor = generateRandomColor(name); | |
| var textColor = getContrast(backgroundColor); | |
| var avatarClassname = classnames((_cx = { | |
| 'ansh-avatar': true | |
| }, _cx[sizeClassname] = true, _cx[variantClassname] = true, _cx['ansh-avatar--border'] = Boolean(photo), _cx[className] = Boolean(className), _cx)); | |
| var initial = getInitials(name); | |
| return /*#__PURE__*/React.createElement("div", _extends({ | |
| className: avatarClassname, | |
| "data-qa-selector": dataQaSelector | |
| }, rest), !photo && name ? /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-avatar--initial", | |
| style: { | |
| background: backgroundColor, | |
| color: textColor | |
| } | |
| }, initial) : /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-avatar--picture" | |
| }, /*#__PURE__*/React.createElement("img", { | |
| src: photo | |
| }))); | |
| }; | |
| YAPAvatar.propTypes = { | |
| className: propTypes.string, | |
| size: propTypes.oneOf(['small', 'medium', 'large']), | |
| variant: propTypes.oneOf(['rounded', 'squared']), | |
| photo: propTypes.string | |
| }; | |
| var OverlayContext = /*#__PURE__*/React.createContext({}); | |
| var ModalManager = /*#__PURE__*/function () { | |
| function ModalManager() { | |
| this.overlayCount = 0; | |
| } | |
| var _proto = ModalManager.prototype; | |
| _proto.add = function add() { | |
| this.overlayCount = ++this.overlayCount; | |
| }; | |
| _proto.remove = function remove() { | |
| this.overlayCount = --this.overlayCount; | |
| }; | |
| return ModalManager; | |
| }(); | |
| var manager = new ModalManager(); | |
| function useModalManager(isOpen) { | |
| useEffect(function () { | |
| var bodyElement = document.body; | |
| if (isOpen) { | |
| manager.add(); | |
| bodyElement.style.overflow = 'hidden'; | |
| } else if (manager.overlayCount !== 0) { | |
| manager.remove(); | |
| } | |
| return function () { | |
| if (manager.overlayCount <= 1) { | |
| bodyElement.style.overflow = 'unset'; | |
| } else { | |
| manager.remove(); | |
| } | |
| }; | |
| }, [isOpen]); | |
| } | |
| var focusableElements = ['a[href]', 'area[href]', 'input:not([disabled]):not([type=hidden])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'object', 'embed', '[tabindex]:not(.modal)', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])']; | |
| function useFocusLock(ref, isOpen, focusFirstElement) { | |
| if (focusFirstElement === void 0) { | |
| focusFirstElement = true; | |
| } | |
| var firstFocusableElement = useRef(null); | |
| var lastFocusableElement = useRef(null); | |
| useEffect(function () { | |
| if (ref.current) { | |
| var focusableElementsRef = Array.from(ref.current.querySelectorAll(focusableElements.join(', '))); | |
| firstFocusableElement.current = focusableElementsRef[0]; | |
| lastFocusableElement.current = focusableElementsRef[focusableElementsRef.length - 1]; | |
| if (focusFirstElement && firstFocusableElement.current) { | |
| firstFocusableElement.current.focus(); | |
| } | |
| } | |
| }, [isOpen]); | |
| return { | |
| firstFocusableElement: firstFocusableElement, | |
| lastFocusableElement: lastFocusableElement | |
| }; | |
| } | |
| var OverlayRoot = document.createElement('div'); | |
| OverlayRoot.id = 'overlay-root'; | |
| var overlayRoot = document.querySelector('#overlay-root'); | |
| if (overlayRoot) { | |
| OverlayRoot = overlayRoot; | |
| } | |
| document.body.appendChild(OverlayRoot); | |
| var YAPOverlay = /*#__PURE__*/React.forwardRef(function (_ref, ref) { | |
| var _cx; | |
| var isOpen = _ref.isOpen, | |
| onClose = _ref.onClose, | |
| children = _ref.children, | |
| className = _ref.className, | |
| _ref$closeOnEsc = _ref.closeOnEsc, | |
| closeOnEsc = _ref$closeOnEsc === void 0 ? true : _ref$closeOnEsc, | |
| onEsc = _ref.onEsc, | |
| onBackdropClick = _ref.onBackdropClick, | |
| onKeyDown = _ref.onKeyDown, | |
| _ref$dataQaSelectors = _ref.dataQaSelectors, | |
| dataQaSelectors = _ref$dataQaSelectors === void 0 ? {} : _ref$dataQaSelectors, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["isOpen", "onClose", "children", "className", "closeOnEsc", "onEsc", "onBackdropClick", "onKeyDown", "dataQaSelectors"]); | |
| var overlayClassname = classnames((_cx = { | |
| 'ansh-overlay--content': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var modalRef = useRef(null); | |
| var triggeredElement = useRef(null); | |
| useModalManager(isOpen); | |
| useEffect(function () { | |
| if (isOpen) { | |
| triggeredElement.current = document.activeElement; | |
| } | |
| }, [isOpen]); | |
| var _useFocusLock = useFocusLock(modalRef, isOpen), | |
| firstFocusableElement = _useFocusLock.firstFocusableElement, | |
| lastFocusableElement = _useFocusLock.lastFocusableElement; | |
| var handleOnClose = function handleOnClose() { | |
| onClose(); | |
| }; | |
| useEffect(function () { | |
| return function () { | |
| if (triggeredElement.current) { | |
| triggeredElement.current.focus(); | |
| } | |
| }; | |
| }, [isOpen]); | |
| var handleOnKeyDown = function handleOnKeyDown(e) { | |
| var isEscapeKey = e.key === 'Escape'; | |
| var isTabKey = e.key === 'Tab'; | |
| var isShiftKey = e.shiftKey; | |
| var isFirstElementFocused = document.activeElement === firstFocusableElement.current; | |
| var isLastElementFocused = document.activeElement === lastFocusableElement.current; | |
| if (isEscapeKey && closeOnEsc) { | |
| handleOnClose(); | |
| onEsc && onEsc(e); | |
| } | |
| if (isLastElementFocused && isTabKey && !isShiftKey) { | |
| e.preventDefault(); | |
| firstFocusableElement.current.focus(); | |
| } | |
| if (isFirstElementFocused && isTabKey && isShiftKey) { | |
| e.preventDefault(); | |
| lastFocusableElement.current.focus(); | |
| } | |
| onKeyDown && onKeyDown(e); | |
| }; | |
| var handleOnBackDropClick = function handleOnBackDropClick(e) { | |
| if (modalRef.current && modalRef.current.contains(e.target)) { | |
| return; | |
| } | |
| onBackdropClick && onBackdropClick(); | |
| handleOnClose(); | |
| }; | |
| var renderOverlay = function renderOverlay() { | |
| return isOpen ? /*#__PURE__*/React.createElement("div", { | |
| tabIndex: -1, | |
| style: { | |
| position: 'relative', | |
| display: 'block', | |
| zIndex: 9999 | |
| } | |
| }, /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-overlay--container", | |
| onClick: handleOnBackDropClick | |
| }, /*#__PURE__*/React.createElement(YAPOverlayLayer, _extends({ | |
| className: overlayClassname, | |
| ref: modalRef, | |
| tabIndex: -1, | |
| onKeyDown: handleOnKeyDown | |
| }, rest), /*#__PURE__*/React.createElement(OverlayContext.Provider, { | |
| value: { | |
| handleOnClose: handleOnClose, | |
| dataQaSelectors: dataQaSelectors | |
| } | |
| }, children))), /*#__PURE__*/React.createElement(YAPOverlayBackdropLayer, { | |
| className: "ansh-overlay--backdrop" | |
| })) : /*#__PURE__*/React.createElement(React.Fragment, null); | |
| }; | |
| return /*#__PURE__*/ReactDOM.createPortal(renderOverlay(), OverlayRoot); | |
| }); | |
| var YAPOverlayHeader = function YAPOverlayHeader(_ref2) { | |
| var _cx2; | |
| var className = _ref2.className, | |
| children = _ref2.children, | |
| rest = _objectWithoutPropertiesLoose(_ref2, ["className", "children"]); | |
| var overlayHeaderClassname = classnames((_cx2 = { | |
| 'ansh-overlay--header': true | |
| }, _cx2[className] = Boolean(className), _cx2)); | |
| var _ref3 = useContext(OverlayContext) || {}, | |
| handleOnClose = _ref3.handleOnClose, | |
| _ref3$dataQaSelectors = _ref3.dataQaSelectors, | |
| dataQaSelectors = _ref3$dataQaSelectors === void 0 ? {} : _ref3$dataQaSelectors; | |
| return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(YAPOverlayHeaderLayer, _extends({ | |
| className: overlayHeaderClassname | |
| }, rest), children), /*#__PURE__*/React.createElement(YAPButton, { | |
| variant: "ghost", | |
| color: "secondary", | |
| "data-qa-selector": dataQaSelectors.closeBtn, | |
| className: "ansh-overlay--close-btn", | |
| onClick: handleOnClose | |
| }, /*#__PURE__*/React.createElement(CloseIcon, { | |
| width: "14", | |
| height: "14" | |
| }))); | |
| }; | |
| var YAPOverlayBody = function YAPOverlayBody(_ref4) { | |
| var _cx3; | |
| var className = _ref4.className, | |
| children = _ref4.children, | |
| rest = _objectWithoutPropertiesLoose(_ref4, ["className", "children"]); | |
| var overlayBodyClassname = classnames((_cx3 = { | |
| 'ansh-overlay--body': true | |
| }, _cx3[className] = Boolean(className), _cx3)); | |
| return /*#__PURE__*/React.createElement(YAPOverlayBodyLayer, _extends({ | |
| className: overlayBodyClassname | |
| }, rest), children); | |
| }; | |
| var YAPOverlayFooter = function YAPOverlayFooter(_ref5) { | |
| var _cx4; | |
| var className = _ref5.className, | |
| children = _ref5.children, | |
| rest = _objectWithoutPropertiesLoose(_ref5, ["className", "children"]); | |
| var overlayFooterClassname = classnames((_cx4 = { | |
| 'ansh-overlay--footer': true | |
| }, _cx4[className] = Boolean(className), _cx4)); | |
| return /*#__PURE__*/React.createElement(YAPOverlayFooterLayer, _extends({ | |
| className: overlayFooterClassname | |
| }, rest), children); | |
| }; | |
| YAPOverlay.propTypes = { | |
| className: propTypes.string, | |
| isOpen: propTypes.bool, | |
| closeOnEsc: propTypes.bool, | |
| onClose: propTypes.func, | |
| onEsc: propTypes.func, | |
| onBackdropClick: propTypes.func, | |
| dataQaSelectors: propTypes.shape({ | |
| closeBtn: propTypes.string | |
| }) | |
| }; | |
| YAPOverlayHeader.propTypes = { | |
| className: propTypes.string | |
| }; | |
| YAPOverlayBody.propTypes = { | |
| className: propTypes.string | |
| }; | |
| YAPOverlayFooter.propTypes = { | |
| className: propTypes.string | |
| }; | |
| var OverlayRoot$1 = document.createElement('div'); | |
| OverlayRoot$1.id = 'overlay-root'; | |
| var overlayRoot$1 = document.querySelector('#overlay-root'); | |
| if (overlayRoot$1) { | |
| OverlayRoot$1 = overlayRoot$1; | |
| } | |
| document.body.appendChild(OverlayRoot$1); | |
| var YAPAlert = /*#__PURE__*/React.forwardRef(function (_ref, ref) { | |
| var _cx; | |
| var isOpen = _ref.isOpen, | |
| onClose = _ref.onClose, | |
| children = _ref.children, | |
| className = _ref.className, | |
| _ref$closeOnEsc = _ref.closeOnEsc, | |
| closeOnEsc = _ref$closeOnEsc === void 0 ? true : _ref$closeOnEsc, | |
| onEsc = _ref.onEsc, | |
| leastDestructiveActionRef = _ref.leastDestructiveActionRef, | |
| onBackdropClick = _ref.onBackdropClick, | |
| onKeyDown = _ref.onKeyDown, | |
| _ref$dataQaSelectors = _ref.dataQaSelectors, | |
| dataQaSelectors = _ref$dataQaSelectors === void 0 ? {} : _ref$dataQaSelectors, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["isOpen", "onClose", "children", "className", "closeOnEsc", "onEsc", "onCancel", "leastDestructiveActionRef", "onSubmit", "onBackdropClick", "onKeyDown", "dataQaSelectors"]); | |
| var alertClassname = classnames((_cx = { | |
| 'ansh-alert--content': true | |
| }, _cx[className] = Boolean(className), _cx)); | |
| var modalRef = useRef(null); | |
| var triggeredElement = useRef(null); | |
| useModalManager(isOpen); | |
| useEffect(function () { | |
| if (isOpen) { | |
| triggeredElement.current = document.activeElement; | |
| } | |
| }, [isOpen]); | |
| useEffect(function () { | |
| if (isOpen) { | |
| if (leastDestructiveActionRef.current) { | |
| leastDestructiveActionRef.current.focus(); | |
| } | |
| } | |
| }, [isOpen]); | |
| var _useFocusLock = useFocusLock(modalRef, isOpen, false), | |
| firstFocusableElement = _useFocusLock.firstFocusableElement, | |
| lastFocusableElement = _useFocusLock.lastFocusableElement; | |
| var handleOnClose = function handleOnClose() { | |
| onClose(); | |
| }; | |
| useEffect(function () { | |
| return function () { | |
| if (triggeredElement.current) { | |
| triggeredElement.current.focus(); | |
| } | |
| }; | |
| }, [isOpen]); | |
| var handleOnKeyDown = function handleOnKeyDown(e) { | |
| var isEscapeKey = e.key === 'Escape'; | |
| var isTabKey = e.key === 'Tab'; | |
| var isShiftKey = e.shiftKey; | |
| var isFirstElementFocused = document.activeElement === firstFocusableElement.current; | |
| var isLastElementFocused = document.activeElement === lastFocusableElement.current; | |
| if (isEscapeKey && closeOnEsc) { | |
| handleOnClose(); | |
| onEsc && onEsc(e); | |
| } | |
| if (isLastElementFocused && isTabKey && !isShiftKey) { | |
| e.preventDefault(); | |
| firstFocusableElement.current.focus(); | |
| } | |
| if (isFirstElementFocused && isTabKey && isShiftKey) { | |
| e.preventDefault(); | |
| lastFocusableElement.current.focus(); | |
| } | |
| onKeyDown && onKeyDown(e); | |
| }; | |
| var handleOnBackDropClick = function handleOnBackDropClick(e) { | |
| if (modalRef.current && modalRef.current.contains(e.target)) { | |
| return; | |
| } | |
| onBackdropClick && onBackdropClick(); | |
| handleOnClose(); | |
| }; | |
| var renderOverlay = function renderOverlay() { | |
| return isOpen ? /*#__PURE__*/React.createElement("div", { | |
| tabIndex: -1, | |
| style: { | |
| position: 'relative', | |
| display: 'block', | |
| zIndex: 9999 | |
| } | |
| }, /*#__PURE__*/React.createElement("div", { | |
| className: "ansh-alert--container", | |
| onClick: handleOnBackDropClick | |
| }, /*#__PURE__*/React.createElement(YAPOverlayLayer, _extends({ | |
| className: alertClassname, | |
| ref: modalRef, | |
| tabIndex: -1, | |
| onKeyDown: handleOnKeyDown | |
| }, rest), /*#__PURE__*/React.createElement(OverlayContext.Provider, { | |
| value: { | |
| handleOnClose: handleOnClose, | |
| dataQaSelectors: dataQaSelectors | |
| } | |
| }, /*#__PURE__*/React.createElement(React.Fragment, null, children)))), /*#__PURE__*/React.createElement(YAPOverlayBackdropLayer, { | |
| className: "ansh-alert--backdrop" | |
| })) : /*#__PURE__*/React.createElement(React.Fragment, null); | |
| }; | |
| return /*#__PURE__*/ReactDOM.createPortal(renderOverlay(), OverlayRoot$1); | |
| }); | |
| function YAPAlertHeader(_ref2) { | |
| var _cx2; | |
| var className = _ref2.className, | |
| children = _ref2.children, | |
| rest = _objectWithoutPropertiesLoose(_ref2, ["className", "children"]); | |
| var overlayHeaderClassname = classnames((_cx2 = { | |
| 'ansh-alert--header ansh-h5': true | |
| }, _cx2[className] = Boolean(className), _cx2)); | |
| var _ref3 = useContext(OverlayContext) || {}, | |
| handleOnClose = _ref3.handleOnClose, | |
| _ref3$dataQaSelectors = _ref3.dataQaSelectors, | |
| dataQaSelectors = _ref3$dataQaSelectors === void 0 ? {} : _ref3$dataQaSelectors; | |
| return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(YAPOverlayHeaderLayer, _extends({ | |
| dataQaSelector: dataQaSelectors.alertHeader, | |
| className: overlayHeaderClassname | |
| }, rest), children), /*#__PURE__*/React.createElement(YAPButton, { | |
| variant: "ghost", | |
| color: "secondary", | |
| "data-qa-selector": dataQaSelectors.closeBtn, | |
| className: "ansh-alert--close-btn", | |
| onClick: handleOnClose | |
| }, /*#__PURE__*/React.createElement(CloseIcon, { | |
| width: "14", | |
| height: "14" | |
| }))); | |
| } | |
| function YAPAlertBody(_ref4) { | |
| var _cx3; | |
| var className = _ref4.className, | |
| children = _ref4.children, | |
| rest = _objectWithoutPropertiesLoose(_ref4, ["className", "children"]); | |
| var overlayBodyClassname = classnames((_cx3 = { | |
| 'ansh-alert--body': true | |
| }, _cx3[className] = Boolean(className), _cx3)); | |
| var _ref5 = useContext(OverlayContext) || {}, | |
| _ref5$dataQaSelectors = _ref5.dataQaSelectors, | |
| dataQaSelectors = _ref5$dataQaSelectors === void 0 ? {} : _ref5$dataQaSelectors; | |
| return /*#__PURE__*/React.createElement(YAPOverlayBodyLayer, _extends({ | |
| dataQaSelector: dataQaSelectors.alertBody, | |
| className: overlayBodyClassname | |
| }, rest), children); | |
| } | |
| function YAPAlertFooter(_ref6) { | |
| var _cx4; | |
| var className = _ref6.className, | |
| children = _ref6.children, | |
| rest = _objectWithoutPropertiesLoose(_ref6, ["className", "children"]); | |
| var overlayFooterClassname = classnames((_cx4 = { | |
| 'ansh-alert--footer': true | |
| }, _cx4[className] = Boolean(className), _cx4)); | |
| var _ref7 = useContext(OverlayContext) || {}, | |
| _ref7$dataQaSelectors = _ref7.dataQaSelectors, | |
| dataQaSelectors = _ref7$dataQaSelectors === void 0 ? {} : _ref7$dataQaSelectors; | |
| return /*#__PURE__*/React.createElement(YAPOverlayFooterLayer, _extends({ | |
| dataQaSelector: dataQaSelectors.alertFooter, | |
| className: overlayFooterClassname | |
| }, rest), children); | |
| } | |
| YAPAlert.propTypes = { | |
| className: propTypes.string, | |
| isOpen: propTypes.bool, | |
| closeOnEsc: propTypes.bool, | |
| onClose: propTypes.func, | |
| onEsc: propTypes.func, | |
| onBackdropClick: propTypes.func, | |
| leastDestructiveActionRef: propTypes.object, | |
| dataQaSelectors: propTypes.shape({ | |
| closeBtn: propTypes.string, | |
| alertHeader: propTypes.string, | |
| alertBody: propTypes.string, | |
| alertFooter: propTypes.string | |
| }) | |
| }; | |
| YAPAlertHeader.propTypes = { | |
| className: propTypes.string | |
| }; | |
| YAPAlertBody.propTypes = { | |
| className: propTypes.string | |
| }; | |
| YAPAlertFooter.propTypes = { | |
| className: propTypes.string | |
| }; | |
| var YAPSpace = function YAPSpace(_ref) { | |
| var _cx; | |
| var children = _ref.children, | |
| _ref$space = _ref.space, | |
| space = _ref$space === void 0 ? '0' : _ref$space, | |
| _ref$as = _ref.as, | |
| Component = _ref$as === void 0 ? 'div' : _ref$as, | |
| _ref$stack = _ref.stack, | |
| stack = _ref$stack === void 0 ? 'horizontal' : _ref$stack, | |
| _ref$alignItem = _ref.alignItem, | |
| alignItem = _ref$alignItem === void 0 ? 'start' : _ref$alignItem, | |
| _ref$flexWrap = _ref.flexWrap, | |
| flexWrap = _ref$flexWrap === void 0 ? 'nowrap' : _ref$flexWrap, | |
| _ref$justifyContent = _ref.justifyContent, | |
| justifyContent = _ref$justifyContent === void 0 ? 'start' : _ref$justifyContent, | |
| _ref$flexDirection = _ref.flexDirection, | |
| flexDirection = _ref$flexDirection === void 0 ? stack === 'horizontal' ? 'row' : 'column' : _ref$flexDirection, | |
| className = _ref.className, | |
| rest = _objectWithoutPropertiesLoose(_ref, ["children", "space", "as", "stack", "alignItem", "flexWrap", "justifyContent", "flexDirection", "className"]); | |
| var spaceClassname = classnames((_cx = { | |
| 'ansh-space': true | |
| }, _cx["ansh-space__" + stack] = true, _cx["ansh-space__" + stack + "__" + flexDirection] = true, _cx["ansh-space__" + stack + "__" + flexDirection + "__" + space] = true, _cx["ansh-space__align-item--" + alignItem] = true, _cx["ansh-space__justify-content--" + justifyContent] = true, _cx["ansh-space__flex-wrap--" + flexWrap] = true, _cx[className] = Boolean(className), _cx)); | |
| return /*#__PURE__*/React.createElement(Component, _extends({ | |
| className: spaceClassname | |
| }, rest), children); | |
| }; | |
| YAPSpace.propTypes = { | |
| className: propTypes.string, | |
| as: propTypes.node, | |
| space: propTypes.oneOf(['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']), | |
| flexDirection: propTypes.oneOf(['row', 'row-reverse', 'column', 'column-reverse']), | |
| stack: propTypes.oneOf(['horizontal', 'vertical']), | |
| justifyContent: propTypes.oneOf(['flex-start', 'flex-end', 'stretch', 'center', 'start', 'center', 'end', 'space-around', 'space-evenly']), | |
| alignItem: propTypes.oneOf(['flex-start', 'flex-end', 'stretch', 'center', 'start', 'center', 'end']), | |
| flexWrap: propTypes.oneOf(['nowrap', 'wrap']) | |
| }; | |
| export { ArrowBackIcon, ArrowDownIcon, ArrowForwardIcon, ArrowUpIcon, AtSignIcon, BlockedIcon, CheckboxCheckedIcon, CheckboxPartialIcon, CheckboxUncheckedIcon, CloseIcon, EyeClosedIcon, EyeOpenIcon, FiltersIcon, GearIcon, HamburgerMenu, KebabMenu, KeyIcon, MinusIcon, MinusSquaredIcon, PlusIcon, PlusSquaredIcon, RadioCheckedIcon, RadioUncheckedIcon, SearchIcon, SpinnerIcon, StopwatchIcon, TimeIcon, UserIcon, YAPActionBarLayer, YAPAlert, YAPAlertBody, YAPAlertFooter, YAPAlertHeader, YAPAvatar, YAPBackdropLayer, YAPBadge, YAPBanner, YAPBreadcrumb, YAPBreadcrumbItem, YAPButton, YAPCard, YAPCardBody, YAPCardFooter, YAPCheckbox, YAPCheckboxGroup, YAPContentAreaLayer, YAPFormControl, YAPFormErrorMessage, YAPFormHelpText, YAPFormLabel, YAPIcon, YAPInput, YAPLink, YAPNumberInput, YAPOverlay, YAPOverlayBackdropLayer, YAPOverlayBody, YAPOverlayBodyLayer, YAPOverlayFooter, YAPOverlayFooterLayer, YAPOverlayHeader, YAPOverlayHeaderLayer, YAPOverlayLayer, YAPPageLayer, YAPPagination, YAPRadio, YAPRadioGroup, YAPSectionContentLayer, YAPSectionFooterLayer, YAPSectionHeaderLayer, YAPSectionLayer, YAPSegmentedButton, YAPSidebarBackdropLayer, YAPSidebarLayer, YAPSpace, YAPSpinner, YAPSwitch, YAPTab, YAPTabList, YAPTabPanel, YAPTabPanels, YAPTabs, YAPTag, YAPToast, YAPTopbarLayer, setDirection, setTheme }; | |
| //# sourceMappingURL=index.modern.js.map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment