@qualtrics/ui-react 2.28.0 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/__shared/cjs/{index-2ad33b44.js → index-c2d2f188.js} +601 -391
- package/dist/__shared/cjs/{index-0c005184.js → index-c9e48360.js} +3 -3
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +54 -10
- package/dist/components/Checkbox/Checkbox2.js +3 -3
- package/dist/components/Checkbox/VisualCheckbox2.js +3 -3
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/Dropdown.js +59 -7
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/FilePicker/FilePicker2.js +3 -3
- package/dist/components/FormField/Caption.js +3 -3
- package/dist/components/FormField/FormField2.js +3 -3
- package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
- package/dist/components/IconButton/IconButton2.js +3 -3
- package/dist/components/InlineInput/InlineInput2.js +3 -3
- package/dist/components/Input/Input2.js +3 -3
- package/dist/components/InputGroup/InputGroup2.js +3 -3
- package/dist/components/Label/Label2.js +3 -3
- package/dist/components/Link/Link2.js +3 -3
- package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
- package/dist/components/LogicEditor/LogicEditor2.js +3 -3
- package/dist/components/Modal/Modal2.js +3 -3
- package/dist/components/NewMenu/NewMenu.js +3 -3
- package/dist/components/NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/PageLayout/PageLayout.js +3 -3
- package/dist/components/Pagination/Pagination2.js +3 -3
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch2.js +3 -3
- package/dist/components/Radio/Radio.js +25 -5
- package/dist/components/Radio/Radio2.js +3 -3
- package/dist/components/Radio/RadioGroup.js +16 -3
- package/dist/components/SearchInput/SearchInput2.js +3 -3
- package/dist/components/SidebarNav/SidebarNav2.js +3 -3
- package/dist/components/Slider/Slider2.js +3 -3
- package/dist/components/Switch/Switch2.js +3 -3
- package/dist/components/Table/Table2.js +3 -3
- package/dist/components/Tabs/Tabs2.js +3 -3
- package/dist/components/Tooltip/Tooltip2.js +3 -3
- package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
- package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
- package/dist/hooks/useOverlay/useOverlay2.js +3 -3
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
- package/dist/icons/Icon.js +3 -3
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.es.js +1 -1
- package/dist/index.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTable.js +54 -78
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
- package/dist/next/Combobox/Combobox2.js +3 -3
- package/dist/next/Drawer/Drawer2.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
- package/dist/next/Form/FormFields/FormFieldWrapper.js +36 -0
- package/dist/next/Form/FormFields/InputField.js +8 -0
- package/dist/next/Form/index.js +2 -0
- package/dist/next/Form/useForm.js +298 -0
- package/dist/next/Form/useFormField.js +25 -0
- package/dist/next/Form/utils/createFormInstance.js +32 -0
- package/dist/next/Form/utils/useFormContext.js +9 -0
- package/dist/next/Input/Input.js +47 -7
- package/dist/next/Input/Input2.js +3 -3
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuPane.js +2 -2
- package/dist/next/Pagination/Pagination.css.js +9 -0
- package/dist/next/Pagination/Pagination.css.ts.vanilla.js +8 -0
- package/dist/next/Pagination/Pagination.js +166 -0
- package/dist/next/Pagination/RowDisplayCount.js +46 -0
- package/dist/next/Pagination/index.js +2 -0
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/Select/Select2.js +3 -3
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/ToggleButton/ToggleButton.js +2 -2
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.d.ts +168 -2
- package/dist/next/index.es.js +29 -23
- package/dist/next/index.js +1962 -1474
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/icons/package.json +1 -1
- package/next/package.json +2 -2
- package/package.json +2 -2
package/dist/next/index.js
CHANGED
|
@@ -8,15 +8,15 @@ var classNames = require('classnames');
|
|
|
8
8
|
var reactDnd = require('react-dnd');
|
|
9
9
|
var reactDndHtml5Backend = require('react-dnd-html5-backend');
|
|
10
10
|
var useResizeObserver = require('@react-hook/resize-observer');
|
|
11
|
-
var index = require('../__shared/cjs/index-
|
|
12
|
-
var icons_index = require('../__shared/cjs/index-
|
|
13
|
-
var
|
|
14
|
-
var InputMask = require('react-input-mask');
|
|
11
|
+
var index = require('../__shared/cjs/index-c2d2f188.js');
|
|
12
|
+
var icons_index = require('../__shared/cjs/index-c9e48360.js');
|
|
13
|
+
var ReactDOM = require('react-dom');
|
|
15
14
|
var reactDropdownMenu = require('@radix-ui/react-dropdown-menu');
|
|
16
15
|
var resizeObserver = require('@juggle/resize-observer');
|
|
17
16
|
var interactions = require('@react-aria/interactions');
|
|
18
17
|
var reactVirtuoso = require('react-virtuoso');
|
|
19
|
-
var
|
|
18
|
+
var libphonenumberJs = require('libphonenumber-js');
|
|
19
|
+
var InputMask = require('react-input-mask');
|
|
20
20
|
require('react-popper');
|
|
21
21
|
require('@popperjs/core');
|
|
22
22
|
require('react-focus-lock');
|
|
@@ -32,10 +32,10 @@ var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
|
32
32
|
var useResizeObserver__default = /*#__PURE__*/_interopDefaultLegacy(useResizeObserver);
|
|
33
33
|
var InputMask__default = /*#__PURE__*/_interopDefaultLegacy(InputMask);
|
|
34
34
|
|
|
35
|
-
var css_248z$
|
|
36
|
-
var styles$b = {"advancedTable":"
|
|
37
|
-
var stylesheet$
|
|
38
|
-
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$
|
|
35
|
+
var css_248z$c = "._duJkh{overflow:auto;position:relative;max-width:100%;max-height:100%}._duJkh,._nv0py{background-color:#fff}._nv0py{height:70px;z-index:100;display:flex;align-items:flex-end;justify-content:center;position:-webkit-sticky;position:sticky;left:0}._GcJh9{margin-bottom:4px}._iwQ-4{position:-webkit-sticky;position:sticky;top:0;z-index:100}._XxcI7{display:flex}._XxcI7:focus{outline:none}._XxcI7.focus-visible ._vMY9J:after,._XxcI7:focus-visible ._vMY9J:after{content:\"\";display:block;position:absolute;top:0;bottom:0;left:0;right:0;border-bottom:2px solid #0a3f88;border-top:2px solid #0a3f88;z-index:50}._XxcI7.focus-visible ._vMY9J:last-of-type:after,._XxcI7:focus-visible ._vMY9J:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._XxcI7.focus-visible ._vMY9J:first-of-type:after,._XxcI7:focus-visible ._vMY9J:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._XxcI7.focus-visible ._vMY9J._w0o-P:after,._XxcI7:focus-visible ._vMY9J._w0o-P:after{right:-3px;bottom:1px}._pxrWn{padding-right:3px}._7mcyg{display:flex}._7mcyg._XYBgP ._LEItJ,._7mcyg._XYBgP ._vMY9J{cursor:pointer}._7mcyg._cXRrC ._LEItJ,._7mcyg._cXRrC ._vMY9J{background-color:rgba(11,110,208,.08);font-weight:500;box-shadow:inset 0 -1px 0 0 #0b6ed0}._7mcyg._cXRrC ._LEItJ._w0o-P,._7mcyg._cXRrC ._vMY9J._w0o-P{background-color:#fff;box-shadow:inset 0 -2px 0 0 #0b6ed0}._7mcyg._cXRrC ._LEItJ._w0o-P ._-PERA,._7mcyg._cXRrC ._LEItJ._w0o-P ._FOp9S,._7mcyg._cXRrC ._LEItJ._w0o-P ._LEItJ,._7mcyg._cXRrC ._vMY9J._w0o-P ._-PERA,._7mcyg._cXRrC ._vMY9J._w0o-P ._FOp9S,._7mcyg._cXRrC ._vMY9J._w0o-P ._LEItJ{background-color:rgba(11,110,208,.08)}._7mcyg._XYBgP:hover:not(._cXRrC) ._LEItJ,._7mcyg._XYBgP:hover:not(._cXRrC) ._vMY9J{background-color:#f9f9f9}._7mcyg._XYBgP:active:not(._cXRrC):not(._7mcyg._XYBgP:active:not(._cXRrC):has(._FOp9S:active)) ._LEItJ,._7mcyg._XYBgP:active:not(._cXRrC):not(._7mcyg._XYBgP:active:not(._cXRrC):has(._FOp9S:active)) ._vMY9J{background-color:#f3f3f3}._7mcyg:focus{outline:none}._7mcyg.focus-visible ._vMY9J:after,._7mcyg:focus-visible ._vMY9J:after{content:\"\";display:block;position:absolute;top:-2px;bottom:-1px;left:0;right:0;border-bottom:2px solid #0a3f88;border-top:2px solid #0a3f88;z-index:50}._7mcyg.focus-visible ._vMY9J:last-of-type:after,._7mcyg:focus-visible ._vMY9J:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._7mcyg.focus-visible ._vMY9J:first-of-type:after,._7mcyg:focus-visible ._vMY9J:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._7mcyg.focus-visible ._vMY9J._w0o-P:after,._7mcyg:focus-visible ._vMY9J._w0o-P:after{right:-3px;bottom:0}._7mcyg:last-of-type:focus{outline:none}._7mcyg:last-of-type.focus-visible ._vMY9J:after,._7mcyg:last-of-type:focus-visible ._vMY9J:after{content:\"\";display:block;position:absolute;top:-2px;bottom:0;left:0;right:0;border-bottom:2px solid #0a3f88;border-top:2px solid #0a3f88;z-index:50}._7mcyg:last-of-type.focus-visible ._vMY9J:last-of-type:after,._7mcyg:last-of-type:focus-visible ._vMY9J:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._7mcyg:last-of-type.focus-visible ._vMY9J:first-of-type:after,._7mcyg:last-of-type:focus-visible ._vMY9J:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._7mcyg:last-of-type.focus-visible ._vMY9J._w0o-P:after,._7mcyg:last-of-type:focus-visible ._vMY9J._w0o-P:after{right:-3px;bottom:1px}._7mcyg:last-of-type ._-PERA:focus{outline:none}._7mcyg:last-of-type ._-PERA._QyUJ8.focus-visible:after,._7mcyg:last-of-type ._-PERA._QyUJ8:focus-visible:after,._7mcyg:last-of-type ._-PERA.focus-visible:after,._7mcyg:last-of-type ._-PERA:focus-visible:after{content:\"\";display:block;position:absolute;top:-2px;bottom:-1px;left:0;right:0;border-radius:2px;border:2px solid #0a3f88;z-index:10}._7mcyg:first-of-type:focus{outline:none}._7mcyg:first-of-type.focus-visible ._vMY9J:after,._7mcyg:first-of-type:focus-visible ._vMY9J:after{content:\"\";display:block;position:absolute;top:0;bottom:-1px;left:0;right:0;border-bottom:2px solid #0a3f88;border-top:2px solid #0a3f88;z-index:50}._7mcyg:first-of-type.focus-visible ._vMY9J:last-of-type:after,._7mcyg:first-of-type:focus-visible ._vMY9J:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._7mcyg:first-of-type.focus-visible ._vMY9J:first-of-type:after,._7mcyg:first-of-type:focus-visible ._vMY9J:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._7mcyg:first-of-type.focus-visible ._vMY9J._w0o-P:after,._7mcyg:first-of-type:focus-visible ._vMY9J._w0o-P:after{right:-3px;bottom:0}._7mcyg:first-of-type ._-PERA:focus{outline:none}._7mcyg:first-of-type ._-PERA._QyUJ8.focus-visible:after,._7mcyg:first-of-type ._-PERA._QyUJ8:focus-visible:after,._7mcyg:first-of-type ._-PERA.focus-visible:after,._7mcyg:first-of-type ._-PERA:focus-visible:after{content:\"\";display:block;position:absolute;top:0;bottom:-1px;left:0;right:0;border-radius:2px;border:2px solid #0a3f88;z-index:10}._naXDr{display:flex;align-items:center;min-height:44px;width:200px;min-width:80px;border-bottom:1px solid #d9d9d9;flex-shrink:0;font-size:12px;line-height:16px;font-weight:700;color:#6a6d70;background-color:#fff;position:relative}._naXDr._495dc{flex-grow:1}._naXDr._P6r2E{cursor:pointer}._naXDr._P6r2E:hover:not(._A1zC6){background-color:#f9f9f9;border-bottom-color:#6a6d70}._naXDr._P6r2E:active:not(._A1zC6){background-color:#f3f3f3}._naXDr._3ZakK:not(._A1zC6){color:#32363a;fill:#32363a;border-bottom-color:#8a8f94}._naXDr._A1zC6{cursor:move;background-color:#efefef;border-bottom-color:#ccc;border-top-left-radius:4px;border-top-right-radius:4px}._naXDr ._9g6v7{background-color:#d9d9d9;position:absolute;width:1px;top:0;pointer-events:none}._naXDr ._9g6v7._rBt6f{left:-1px}._naXDr ._9g6v7._O19pX{right:0}._naXDr ._o16ns{background-color:#0a6ed1;position:absolute;width:3px;top:4px;bottom:4px;border-radius:4px;pointer-events:none}._naXDr ._o16ns._rBt6f{left:-2px}._naXDr ._o16ns._O19pX{right:-1px}._naXDr:first-of-type ._rBt6f._9g6v7{left:0;width:2px;border-left:1px solid #fff}._naXDr:first-of-type ._rBt6f._o16ns{left:0}._naXDr:last-of-type ._O19pX._9g6v7{right:0;width:2px;border-right:1px solid #fff}._naXDr:last-of-type ._O19pX._o16ns{right:0}._naXDr ._Y9Ttq{position:absolute;width:6px;right:-3px;top:0;cursor:ew-resize;z-index:50}._naXDr ._Y9Ttq ._QwckB{position:absolute;width:2px;right:2px;top:0;bottom:0}._naXDr ._Y9Ttq ._QwckB._BsZLd{background-color:#0a6ed1}._naXDr ._Y9Ttq:hover ._QwckB:not(._BsZLd){background-color:#d9d9d9}._naXDr ._aHg0S{display:flex;flex-grow:1;align-items:center;min-width:0;padding:14px 0 13px 12px}._naXDr ._aHg0S._PUMGt{flex-direction:row-reverse;justify-content:flex-start}._naXDr ._aHg0S._PUMGt ._9kYJ6{margin:1px 7px 1px 1px}._naXDr ._aHg0S ._N5cPH{text-overflow:ellipsis;overflow:hidden;-webkit-hyphens:auto;hyphens:auto;pointer-events:none;overflow-wrap:break-word;display:-webkit-box;-webkit-box-orient:vertical}._naXDr ._aHg0S ._9kYJ6{margin:1px 1px 1px 7px;flex-shrink:0}._naXDr ._wz2-Y{margin-left:6px;margin-right:4px;flex-shrink:0}._naXDr ._tzJQb{pointer-events:none;position:absolute;top:0;left:0;bottom:0;right:0}._naXDr:focus{outline:none}._naXDr._QyUJ8.focus-visible:after,._naXDr._QyUJ8:focus-visible:after,._naXDr.focus-visible:after,._naXDr:focus-visible:after{content:\"\";display:block;position:absolute;top:0;bottom:-1px;left:0;right:0;border-radius:2px;border:2px solid #0a3f88;z-index:10}._n-EhX{margin-right:6px}._w0o-P{display:flex;border-right:3px solid #e5e5e5;position:-webkit-sticky;position:sticky;left:0;background-color:#fff;z-index:20}._w0o-P[focus-within]{z-index:30}._w0o-P:focus-within{z-index:30}._-PERA{display:flex;align-items:center;min-height:44px;width:200px;min-width:80px;border-bottom:1px solid #eee;flex-shrink:0;font-size:14px;line-height:20px;overflow-wrap:break-word;color:#32363a;position:relative}._-PERA ._lQmJX{width:100%;padding:12px 12px 11px;overflow:hidden}._-PERA._A1zC6{background-color:#efefef;border-bottom-color:#dfdfe1}._-PERA._495dc{flex-grow:1}._-PERA:focus{outline:none}._-PERA._QyUJ8.focus-visible:after,._-PERA._QyUJ8:focus-visible:after,._-PERA.focus-visible:after,._-PERA:focus-visible:after{content:\"\";display:block;position:absolute;top:-2px;bottom:-2px;left:0;right:0;border-radius:2px;border:2px solid #0a3f88;z-index:10}._LEItJ{display:flex!important;min-height:44px!important;align-items:center;justify-content:right;border-bottom:1px solid #eee;flex-shrink:0}._LEItJ._di0i8{border-bottom-color:#d9d9d9;background-color:#fff}._FOp9S{display:flex;align-items:center;justify-content:center;min-height:44px;width:40px;border-bottom:1px solid #eee;padding:12px 12px 11px;flex-shrink:0;cursor:pointer}._FOp9S._di0i8{border-bottom-color:#d9d9d9;padding:14px 12px 13px}._FOp9S:focus input~span,._FOp9S:hover input~span{border-color:#0b6ed0}._FOp9S ._-QUs-{position:relative;display:inline-flex}._FOp9S ._-QUs- ._OWuvs{margin:0!important}._FOp9S ._-QUs- ._2cikd{position:absolute;top:3px;left:3px;height:10px;width:10px;border-radius:2px;background-color:#0b6ed0}._RoU7Y{justify-content:flex-start}._M7mXO{justify-content:center;text-align:center}._PUMGt{justify-content:flex-end;text-align:right}._wVzR7{display:none}._h4Fbn{opacity:0;height:0;width:0;overflow:hidden}._h4Fbn,._HUr4J{position:absolute}._HUr4J{cursor:move;background-color:rgba(11,110,208,.08);border-radius:4px;z-index:1000;pointer-events:none}._8gQhI{max-width:250px;min-width:150px!important}";
|
|
36
|
+
var styles$b = {"advancedTable":"_duJkh","advancedTablePaginationContainer":"_nv0py","advancedTablePagination":"_GcJh9","advancedTableColumnHeadersRowGroup":"_iwQ-4","advancedTableColumnHeaders":"_XxcI7","advancedTableRowChild":"_vMY9J","pinnedContainer":"_w0o-P","advancedTableRowGroup":"_pxrWn","advancedTableRow":"_7mcyg","hasRowAction":"_XYBgP","advancedTableExpandRowSpacer":"_LEItJ","isSelected":"_cXRrC","advancedTableCheckbox":"_FOp9S","advancedTableCell":"_-PERA","showFocusRing":"_QyUJ8","advancedTableColumnHeader":"_naXDr","fillRemainingSpace":"_495dc","isSortable":"_P6r2E","isDragging":"_A1zC6","isSorted":"_3ZakK","dropTargetLine":"_9g6v7","dropTargetLeft":"_rBt6f","dropTargetRight":"_O19pX","dropTargetMarker":"_o16ns","resizeHandle":"_Y9Ttq","resizeLine":"_QwckB","isResizing":"_BsZLd","advancedTableColumnHeaderLabel":"_aHg0S","rightAligned":"_PUMGt","sortIcon":"_9kYJ6","advancedTableColumnHeaderLabelText":"_N5cPH","advancedTableColumnHeaderMenu":"_wz2-Y","advancedTableColumnHeaderMenuHiddenAnchor":"_tzJQb","advancedTableColumnHeaderMenuItemIcon":"_n-EhX","advancedTableCellContainer":"_lQmJX","header":"_di0i8","checkboxContainer":"_-QUs-","checkbox":"_OWuvs","mixed":"_2cikd","leftAligned":"_RoU7Y","centerAligned":"_M7mXO","hiddenDescription":"_wVzR7","hiddenLiveRegion":"_h4Fbn","dragPreview":"_HUr4J","rowActionMenuPane":"_8gQhI"};
|
|
37
|
+
var stylesheet$c="._duJkh{overflow:auto;position:relative;max-width:100%;max-height:100%}._duJkh,._nv0py{background-color:#fff}._nv0py{height:70px;z-index:100;display:flex;align-items:flex-end;justify-content:center;position:-webkit-sticky;position:sticky;left:0}._GcJh9{margin-bottom:4px}._iwQ-4{position:-webkit-sticky;position:sticky;top:0;z-index:100}._XxcI7{display:flex}._XxcI7:focus{outline:none}._XxcI7.focus-visible ._vMY9J:after,._XxcI7:focus-visible ._vMY9J:after{content:\"\";display:block;position:absolute;top:0;bottom:0;left:0;right:0;border-bottom:2px solid #0a3f88;border-top:2px solid #0a3f88;z-index:50}._XxcI7.focus-visible ._vMY9J:last-of-type:after,._XxcI7:focus-visible ._vMY9J:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._XxcI7.focus-visible ._vMY9J:first-of-type:after,._XxcI7:focus-visible ._vMY9J:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._XxcI7.focus-visible ._vMY9J._w0o-P:after,._XxcI7:focus-visible ._vMY9J._w0o-P:after{right:-3px;bottom:1px}._pxrWn{padding-right:3px}._7mcyg{display:flex}._7mcyg._XYBgP ._LEItJ,._7mcyg._XYBgP ._vMY9J{cursor:pointer}._7mcyg._cXRrC ._LEItJ,._7mcyg._cXRrC ._vMY9J{background-color:rgba(11,110,208,.08);font-weight:500;box-shadow:inset 0 -1px 0 0 #0b6ed0}._7mcyg._cXRrC ._LEItJ._w0o-P,._7mcyg._cXRrC ._vMY9J._w0o-P{background-color:#fff;box-shadow:inset 0 -2px 0 0 #0b6ed0}._7mcyg._cXRrC ._LEItJ._w0o-P ._-PERA,._7mcyg._cXRrC ._LEItJ._w0o-P ._FOp9S,._7mcyg._cXRrC ._LEItJ._w0o-P ._LEItJ,._7mcyg._cXRrC ._vMY9J._w0o-P ._-PERA,._7mcyg._cXRrC ._vMY9J._w0o-P ._FOp9S,._7mcyg._cXRrC ._vMY9J._w0o-P ._LEItJ{background-color:rgba(11,110,208,.08)}._7mcyg._XYBgP:hover:not(._cXRrC) ._LEItJ,._7mcyg._XYBgP:hover:not(._cXRrC) ._vMY9J{background-color:#f9f9f9}._7mcyg._XYBgP:active:not(._cXRrC):not(._7mcyg._XYBgP:active:not(._cXRrC):has(._FOp9S:active)) ._LEItJ,._7mcyg._XYBgP:active:not(._cXRrC):not(._7mcyg._XYBgP:active:not(._cXRrC):has(._FOp9S:active)) ._vMY9J{background-color:#f3f3f3}._7mcyg:focus{outline:none}._7mcyg.focus-visible ._vMY9J:after,._7mcyg:focus-visible ._vMY9J:after{content:\"\";display:block;position:absolute;top:-2px;bottom:-1px;left:0;right:0;border-bottom:2px solid #0a3f88;border-top:2px solid #0a3f88;z-index:50}._7mcyg.focus-visible ._vMY9J:last-of-type:after,._7mcyg:focus-visible ._vMY9J:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._7mcyg.focus-visible ._vMY9J:first-of-type:after,._7mcyg:focus-visible ._vMY9J:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._7mcyg.focus-visible ._vMY9J._w0o-P:after,._7mcyg:focus-visible ._vMY9J._w0o-P:after{right:-3px;bottom:0}._7mcyg:last-of-type:focus{outline:none}._7mcyg:last-of-type.focus-visible ._vMY9J:after,._7mcyg:last-of-type:focus-visible ._vMY9J:after{content:\"\";display:block;position:absolute;top:-2px;bottom:0;left:0;right:0;border-bottom:2px solid #0a3f88;border-top:2px solid #0a3f88;z-index:50}._7mcyg:last-of-type.focus-visible ._vMY9J:last-of-type:after,._7mcyg:last-of-type:focus-visible ._vMY9J:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._7mcyg:last-of-type.focus-visible ._vMY9J:first-of-type:after,._7mcyg:last-of-type:focus-visible ._vMY9J:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._7mcyg:last-of-type.focus-visible ._vMY9J._w0o-P:after,._7mcyg:last-of-type:focus-visible ._vMY9J._w0o-P:after{right:-3px;bottom:1px}._7mcyg:last-of-type ._-PERA:focus{outline:none}._7mcyg:last-of-type ._-PERA._QyUJ8.focus-visible:after,._7mcyg:last-of-type ._-PERA._QyUJ8:focus-visible:after,._7mcyg:last-of-type ._-PERA.focus-visible:after,._7mcyg:last-of-type ._-PERA:focus-visible:after{content:\"\";display:block;position:absolute;top:-2px;bottom:-1px;left:0;right:0;border-radius:2px;border:2px solid #0a3f88;z-index:10}._7mcyg:first-of-type:focus{outline:none}._7mcyg:first-of-type.focus-visible ._vMY9J:after,._7mcyg:first-of-type:focus-visible ._vMY9J:after{content:\"\";display:block;position:absolute;top:0;bottom:-1px;left:0;right:0;border-bottom:2px solid #0a3f88;border-top:2px solid #0a3f88;z-index:50}._7mcyg:first-of-type.focus-visible ._vMY9J:last-of-type:after,._7mcyg:first-of-type:focus-visible ._vMY9J:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._7mcyg:first-of-type.focus-visible ._vMY9J:first-of-type:after,._7mcyg:first-of-type:focus-visible ._vMY9J:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._7mcyg:first-of-type.focus-visible ._vMY9J._w0o-P:after,._7mcyg:first-of-type:focus-visible ._vMY9J._w0o-P:after{right:-3px;bottom:0}._7mcyg:first-of-type ._-PERA:focus{outline:none}._7mcyg:first-of-type ._-PERA._QyUJ8.focus-visible:after,._7mcyg:first-of-type ._-PERA._QyUJ8:focus-visible:after,._7mcyg:first-of-type ._-PERA.focus-visible:after,._7mcyg:first-of-type ._-PERA:focus-visible:after{content:\"\";display:block;position:absolute;top:0;bottom:-1px;left:0;right:0;border-radius:2px;border:2px solid #0a3f88;z-index:10}._naXDr{display:flex;align-items:center;min-height:44px;width:200px;min-width:80px;border-bottom:1px solid #d9d9d9;flex-shrink:0;font-size:12px;line-height:16px;font-weight:700;color:#6a6d70;background-color:#fff;position:relative}._naXDr._495dc{flex-grow:1}._naXDr._P6r2E{cursor:pointer}._naXDr._P6r2E:hover:not(._A1zC6){background-color:#f9f9f9;border-bottom-color:#6a6d70}._naXDr._P6r2E:active:not(._A1zC6){background-color:#f3f3f3}._naXDr._3ZakK:not(._A1zC6){color:#32363a;fill:#32363a;border-bottom-color:#8a8f94}._naXDr._A1zC6{cursor:move;background-color:#efefef;border-bottom-color:#ccc;border-top-left-radius:4px;border-top-right-radius:4px}._naXDr ._9g6v7{background-color:#d9d9d9;position:absolute;width:1px;top:0;pointer-events:none}._naXDr ._9g6v7._rBt6f{left:-1px}._naXDr ._9g6v7._O19pX{right:0}._naXDr ._o16ns{background-color:#0a6ed1;position:absolute;width:3px;top:4px;bottom:4px;border-radius:4px;pointer-events:none}._naXDr ._o16ns._rBt6f{left:-2px}._naXDr ._o16ns._O19pX{right:-1px}._naXDr:first-of-type ._rBt6f._9g6v7{left:0;width:2px;border-left:1px solid #fff}._naXDr:first-of-type ._rBt6f._o16ns{left:0}._naXDr:last-of-type ._O19pX._9g6v7{right:0;width:2px;border-right:1px solid #fff}._naXDr:last-of-type ._O19pX._o16ns{right:0}._naXDr ._Y9Ttq{position:absolute;width:6px;right:-3px;top:0;cursor:ew-resize;z-index:50}._naXDr ._Y9Ttq ._QwckB{position:absolute;width:2px;right:2px;top:0;bottom:0}._naXDr ._Y9Ttq ._QwckB._BsZLd{background-color:#0a6ed1}._naXDr ._Y9Ttq:hover ._QwckB:not(._BsZLd){background-color:#d9d9d9}._naXDr ._aHg0S{display:flex;flex-grow:1;align-items:center;min-width:0;padding:14px 0 13px 12px}._naXDr ._aHg0S._PUMGt{flex-direction:row-reverse;justify-content:flex-start}._naXDr ._aHg0S._PUMGt ._9kYJ6{margin:1px 7px 1px 1px}._naXDr ._aHg0S ._N5cPH{text-overflow:ellipsis;overflow:hidden;-webkit-hyphens:auto;hyphens:auto;pointer-events:none;overflow-wrap:break-word;display:-webkit-box;-webkit-box-orient:vertical}._naXDr ._aHg0S ._9kYJ6{margin:1px 1px 1px 7px;flex-shrink:0}._naXDr ._wz2-Y{margin-left:6px;margin-right:4px;flex-shrink:0}._naXDr ._tzJQb{pointer-events:none;position:absolute;top:0;left:0;bottom:0;right:0}._naXDr:focus{outline:none}._naXDr._QyUJ8.focus-visible:after,._naXDr._QyUJ8:focus-visible:after,._naXDr.focus-visible:after,._naXDr:focus-visible:after{content:\"\";display:block;position:absolute;top:0;bottom:-1px;left:0;right:0;border-radius:2px;border:2px solid #0a3f88;z-index:10}._n-EhX{margin-right:6px}._w0o-P{display:flex;border-right:3px solid #e5e5e5;position:-webkit-sticky;position:sticky;left:0;background-color:#fff;z-index:20}._w0o-P[focus-within]{z-index:30}._w0o-P:focus-within{z-index:30}._-PERA{display:flex;align-items:center;min-height:44px;width:200px;min-width:80px;border-bottom:1px solid #eee;flex-shrink:0;font-size:14px;line-height:20px;overflow-wrap:break-word;color:#32363a;position:relative}._-PERA ._lQmJX{width:100%;padding:12px 12px 11px;overflow:hidden}._-PERA._A1zC6{background-color:#efefef;border-bottom-color:#dfdfe1}._-PERA._495dc{flex-grow:1}._-PERA:focus{outline:none}._-PERA._QyUJ8.focus-visible:after,._-PERA._QyUJ8:focus-visible:after,._-PERA.focus-visible:after,._-PERA:focus-visible:after{content:\"\";display:block;position:absolute;top:-2px;bottom:-2px;left:0;right:0;border-radius:2px;border:2px solid #0a3f88;z-index:10}._LEItJ{display:flex!important;min-height:44px!important;align-items:center;justify-content:right;border-bottom:1px solid #eee;flex-shrink:0}._LEItJ._di0i8{border-bottom-color:#d9d9d9;background-color:#fff}._FOp9S{display:flex;align-items:center;justify-content:center;min-height:44px;width:40px;border-bottom:1px solid #eee;padding:12px 12px 11px;flex-shrink:0;cursor:pointer}._FOp9S._di0i8{border-bottom-color:#d9d9d9;padding:14px 12px 13px}._FOp9S:focus input~span,._FOp9S:hover input~span{border-color:#0b6ed0}._FOp9S ._-QUs-{position:relative;display:inline-flex}._FOp9S ._-QUs- ._OWuvs{margin:0!important}._FOp9S ._-QUs- ._2cikd{position:absolute;top:3px;left:3px;height:10px;width:10px;border-radius:2px;background-color:#0b6ed0}._RoU7Y{justify-content:flex-start}._M7mXO{justify-content:center;text-align:center}._PUMGt{justify-content:flex-end;text-align:right}._wVzR7{display:none}._h4Fbn{opacity:0;height:0;width:0;overflow:hidden}._h4Fbn,._HUr4J{position:absolute}._HUr4J{cursor:move;background-color:rgba(11,110,208,.08);border-radius:4px;z-index:1000;pointer-events:none}._8gQhI{max-width:250px;min-width:150px!important}";
|
|
38
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$c);}
|
|
39
39
|
|
|
40
40
|
// TODO: Move the imported types into this file to avoid a ciruclar dependency warning.
|
|
41
41
|
// Also Alignment, etc can be defined directly and have AdvancedTableColumnConfig use them instead of the reverse like now.
|
|
@@ -946,7 +946,7 @@ const AdvancedTableRowExpandButton = _ref => {
|
|
|
946
946
|
};
|
|
947
947
|
|
|
948
948
|
const AdvancedTable = _ref => {
|
|
949
|
-
var
|
|
949
|
+
var _ref7;
|
|
950
950
|
let {
|
|
951
951
|
columnConfigs: externalColumnConfigs,
|
|
952
952
|
rows: rowsPropExternal,
|
|
@@ -1017,7 +1017,6 @@ const AdvancedTable = _ref => {
|
|
|
1017
1017
|
const endingRowIndex = startingRowIndex + rowsPerPage;
|
|
1018
1018
|
return rows.slice(startingRowIndex, endingRowIndex);
|
|
1019
1019
|
}, [rows, rowsPerPage, currentPage]);
|
|
1020
|
-
const paginatedRowIds = React.useMemo(() => paginatedRows === null || paginatedRows === void 0 ? void 0 : paginatedRows.map(row => row.id), [paginatedRows]);
|
|
1021
1020
|
React.useEffect(() => {
|
|
1022
1021
|
if (rows && rowsPerPage) {
|
|
1023
1022
|
const pageCount = Math.ceil(rows.length / rowsPerPage);
|
|
@@ -1150,16 +1149,13 @@ const AdvancedTable = _ref => {
|
|
|
1150
1149
|
const [lastToggledRowId, setLastToggledRowId] = React.useState('');
|
|
1151
1150
|
|
|
1152
1151
|
// Enables using Set.prototype.has() vs Array.prototype.includes() for better performance at scale
|
|
1153
|
-
const
|
|
1152
|
+
const checkedRowIdsSet = React.useMemo(() => new Set(checkedRowIds), [checkedRowIds]);
|
|
1154
1153
|
useSortedRows({
|
|
1155
1154
|
columnConfigs,
|
|
1156
1155
|
onRowsChange,
|
|
1157
1156
|
selectedSortOption,
|
|
1158
1157
|
setCurrentPage
|
|
1159
1158
|
});
|
|
1160
|
-
React.useEffect(() => {
|
|
1161
|
-
setCheckedRowIdsSet(new Set(checkedRowIds));
|
|
1162
|
-
}, [checkedRowIds]);
|
|
1163
1159
|
const {
|
|
1164
1160
|
focusedRowIndex,
|
|
1165
1161
|
focusedColumnIndex,
|
|
@@ -1190,7 +1186,6 @@ const AdvancedTable = _ref => {
|
|
|
1190
1186
|
});
|
|
1191
1187
|
return ids;
|
|
1192
1188
|
}, [rowsProp]);
|
|
1193
|
-
const totalRowsCountWithExpansion = React.useMemo(() => getAllRowIds().length, [getAllRowIds]);
|
|
1194
1189
|
const hasExpandableRows = React.useMemo(() => rows === null || rows === void 0 ? void 0 : rows.some(_ref3 => {
|
|
1195
1190
|
let {
|
|
1196
1191
|
hasChildRows
|
|
@@ -1221,104 +1216,85 @@ const AdvancedTable = _ref => {
|
|
|
1221
1216
|
});
|
|
1222
1217
|
return index === -1 ? 0 : index;
|
|
1223
1218
|
};
|
|
1219
|
+
const getAllLeafIds = row => {
|
|
1220
|
+
if (!row.childRows) return [row.id];
|
|
1221
|
+
return row.childRows.reduce((arr, child) => {
|
|
1222
|
+
arr.push(...getAllLeafIds(child));
|
|
1223
|
+
return arr;
|
|
1224
|
+
}, []);
|
|
1225
|
+
};
|
|
1224
1226
|
const getCheckboxStateForRow = row => {
|
|
1225
|
-
|
|
1227
|
+
const ids = getAllLeafIds(row.rowPropReference);
|
|
1228
|
+
const checkedIds = ids.filter(id => checkedRowIdsSet.has(id));
|
|
1229
|
+
if (checkedIds.length === ids.length) {
|
|
1226
1230
|
return 'true';
|
|
1227
1231
|
}
|
|
1228
|
-
if (
|
|
1232
|
+
if (checkedIds.length) {
|
|
1229
1233
|
return 'mixed';
|
|
1230
1234
|
}
|
|
1231
1235
|
return 'false';
|
|
1232
1236
|
};
|
|
1233
1237
|
const columnHeaderCheckboxState = React.useMemo(() => {
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
return 'true';
|
|
1238
|
-
}
|
|
1239
|
-
if (checkedPaginatedRowIds.length) {
|
|
1240
|
-
return 'mixed';
|
|
1241
|
-
}
|
|
1242
|
-
return 'false';
|
|
1243
|
-
}
|
|
1244
|
-
if (checkedRowIds.length === totalRowsCountWithExpansion) {
|
|
1238
|
+
const visibleRows = paginatedRows !== null && paginatedRows !== void 0 ? paginatedRows : rows;
|
|
1239
|
+
const checkedRows = visibleRows.filter(row => getCheckboxStateForRow(row) === 'true');
|
|
1240
|
+
if (checkedRows.length === visibleRows.length) {
|
|
1245
1241
|
return 'true';
|
|
1246
1242
|
}
|
|
1247
|
-
if (
|
|
1243
|
+
if (checkedRows.length) {
|
|
1248
1244
|
return 'mixed';
|
|
1249
1245
|
}
|
|
1250
1246
|
return 'false';
|
|
1251
|
-
}, [
|
|
1247
|
+
}, [checkedRowIdsSet, paginatedRows, rows]);
|
|
1252
1248
|
const handleColumnHeaderCheckboxToggle = () => {
|
|
1253
1249
|
setLastToggledRowId('');
|
|
1254
|
-
if (
|
|
1255
|
-
if (paginatedRowIds !== null && paginatedRowIds !== void 0 && paginatedRowIds.every(rowId => checkedRowIds.includes(rowId))) {
|
|
1256
|
-
setCheckedRowIds(checkedRowIds.filter(checkedRowId => !paginatedRowIds.includes(checkedRowId)));
|
|
1257
|
-
} else {
|
|
1258
|
-
setCheckedRowIds([...checkedRowIds, ...paginatedRowIds]);
|
|
1259
|
-
}
|
|
1260
|
-
} else if (checkedRowIds.length === totalRowsCountWithExpansion) {
|
|
1250
|
+
if (columnHeaderCheckboxState === 'true') {
|
|
1261
1251
|
setCheckedRowIds([]);
|
|
1262
1252
|
} else {
|
|
1263
|
-
|
|
1253
|
+
const visibleLeafIds = Array.from((paginatedRows !== null && paginatedRows !== void 0 ? paginatedRows : rows).reduce((set, _ref5) => {
|
|
1254
|
+
let {
|
|
1255
|
+
rowPropReference
|
|
1256
|
+
} = _ref5;
|
|
1257
|
+
getAllLeafIds(rowPropReference).forEach(id => set.add(id));
|
|
1258
|
+
return set;
|
|
1259
|
+
}, new Set()));
|
|
1260
|
+
setCheckedRowIds(visibleLeafIds);
|
|
1264
1261
|
}
|
|
1265
1262
|
};
|
|
1266
1263
|
const multiUpdateCheckedRowIds = (startIndex, endIndex) => {
|
|
1267
|
-
var _rows$endIndex;
|
|
1268
1264
|
if (!rows || startIndex === headerRowIndex || endIndex === headerRowIndex) {
|
|
1269
1265
|
return;
|
|
1270
1266
|
}
|
|
1271
|
-
const
|
|
1272
|
-
const isEndIndexChecked =
|
|
1273
|
-
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1276
|
-
const {
|
|
1277
|
-
id: rowId,
|
|
1278
|
-
hasChildRows,
|
|
1267
|
+
const endRow = rows[endIndex];
|
|
1268
|
+
const isEndIndexChecked = getCheckboxStateForRow(endRow) === 'true';
|
|
1269
|
+
setLastToggledRowId(endRow.id);
|
|
1270
|
+
const newIds = rows.slice(Math.min(startIndex, endIndex), Math.max(startIndex, endIndex) + 1).reduce((set, _ref6) => {
|
|
1271
|
+
let {
|
|
1279
1272
|
rowPropReference
|
|
1280
|
-
} =
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
}
|
|
1289
|
-
newCheckedRowIds = newCheckedRowIds.filter(id => !idsToUncheck.includes(id));
|
|
1290
|
-
} else if (!checkedRowIdsSet.has(rowId)) {
|
|
1291
|
-
let idsToCheck = [rowId];
|
|
1292
|
-
if (hasChildRows) {
|
|
1293
|
-
idsToCheck = idsToCheck.concat(getAllRowIds(rowPropReference.childRows));
|
|
1294
|
-
}
|
|
1295
|
-
newCheckedRowIds = newCheckedRowIds.concat(idsToCheck);
|
|
1296
|
-
}
|
|
1273
|
+
} = _ref6;
|
|
1274
|
+
getAllLeafIds(rowPropReference).forEach(id => set.add(id));
|
|
1275
|
+
return set;
|
|
1276
|
+
}, new Set());
|
|
1277
|
+
if (isEndIndexChecked) {
|
|
1278
|
+
setCheckedRowIds(checkedRowIds.filter(id => !newIds.has(id)));
|
|
1279
|
+
} else {
|
|
1280
|
+
setCheckedRowIds([...checkedRowIds, ...Array.from(newIds).filter(id => !checkedRowIdsSet.has(id))]);
|
|
1297
1281
|
}
|
|
1298
|
-
setLastToggledRowId(endRowId);
|
|
1299
|
-
setCheckedRowIds(newCheckedRowIds);
|
|
1300
1282
|
};
|
|
1301
1283
|
const singleUpdateCheckedRowIds = index => {
|
|
1302
1284
|
if (!rows) {
|
|
1303
1285
|
return;
|
|
1304
1286
|
}
|
|
1287
|
+
const row = rows[index];
|
|
1305
1288
|
const {
|
|
1306
1289
|
id: rowId,
|
|
1307
|
-
rowPropReference
|
|
1308
|
-
|
|
1309
|
-
} = rows[index];
|
|
1290
|
+
rowPropReference
|
|
1291
|
+
} = row;
|
|
1310
1292
|
setLastToggledRowId(rowId);
|
|
1311
|
-
if (
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
idsToUncheck = idsToUncheck.concat(getAllRowIds(rowPropReference.childRows));
|
|
1315
|
-
}
|
|
1316
|
-
setCheckedRowIds(checkedRowIds.filter(id => !idsToUncheck.includes(id)));
|
|
1293
|
+
if (getCheckboxStateForRow(row) === 'true') {
|
|
1294
|
+
const idsToUncheck = new Set(getAllLeafIds(rowPropReference));
|
|
1295
|
+
setCheckedRowIds(checkedRowIds.filter(id => !idsToUncheck.has(id)));
|
|
1317
1296
|
} else {
|
|
1318
|
-
|
|
1319
|
-
if (hasChildRows) {
|
|
1320
|
-
idsToCheck = idsToCheck.concat(getAllRowIds(rowPropReference.childRows).filter(r => !checkedRowIdsSet.has(r)));
|
|
1321
|
-
}
|
|
1297
|
+
const idsToCheck = getAllLeafIds(rowPropReference).filter(id => !checkedRowIdsSet.has(id));
|
|
1322
1298
|
setCheckedRowIds([...checkedRowIds, ...idsToCheck]);
|
|
1323
1299
|
}
|
|
1324
1300
|
};
|
|
@@ -1587,7 +1563,7 @@ const AdvancedTable = _ref => {
|
|
|
1587
1563
|
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1588
1564
|
role: "rowgroup",
|
|
1589
1565
|
className: styles$b.advancedTableRowGroup
|
|
1590
|
-
}, ((
|
|
1566
|
+
}, ((_ref7 = paginatedRows !== null && paginatedRows !== void 0 ? paginatedRows : rows) !== null && _ref7 !== void 0 ? _ref7 : []).map((row, rowIndex) => {
|
|
1591
1567
|
const {
|
|
1592
1568
|
id: rowId,
|
|
1593
1569
|
data,
|
|
@@ -1677,13 +1653,13 @@ const AdvancedTable = _ref => {
|
|
|
1677
1653
|
};
|
|
1678
1654
|
|
|
1679
1655
|
// TODO: move hook to separate file
|
|
1680
|
-
function useSortedRows(
|
|
1656
|
+
function useSortedRows(_ref8) {
|
|
1681
1657
|
let {
|
|
1682
1658
|
columnConfigs,
|
|
1683
1659
|
onRowsChange,
|
|
1684
1660
|
selectedSortOption,
|
|
1685
1661
|
setCurrentPage
|
|
1686
|
-
} =
|
|
1662
|
+
} = _ref8;
|
|
1687
1663
|
const columnConfigsRef = index.useLatest(columnConfigs);
|
|
1688
1664
|
const onRowsChangeRef = index.useLatest(onRowsChange);
|
|
1689
1665
|
index.useDidUpdate(() => {
|
|
@@ -1692,10 +1668,10 @@ function useSortedRows(_ref6) {
|
|
|
1692
1668
|
columnId,
|
|
1693
1669
|
index
|
|
1694
1670
|
} = selectedSortOption;
|
|
1695
|
-
const sort = (_columnConfigsRef$cur = columnConfigsRef.current.find(
|
|
1671
|
+
const sort = (_columnConfigsRef$cur = columnConfigsRef.current.find(_ref9 => {
|
|
1696
1672
|
let {
|
|
1697
1673
|
id
|
|
1698
|
-
} =
|
|
1674
|
+
} = _ref9;
|
|
1699
1675
|
return id === columnId;
|
|
1700
1676
|
})) === null || _columnConfigsRef$cur === void 0 || (_columnConfigsRef$cur = _columnConfigsRef$cur.sortOptions) === null || _columnConfigsRef$cur === void 0 || (_columnConfigsRef$cur = _columnConfigsRef$cur[index]) === null || _columnConfigsRef$cur === void 0 ? void 0 : _columnConfigsRef$cur.sort;
|
|
1701
1677
|
if (typeof sort === 'function' && onRowsChangeRef.current) {
|
|
@@ -1706,7 +1682,7 @@ function useSortedRows(_ref6) {
|
|
|
1706
1682
|
}
|
|
1707
1683
|
|
|
1708
1684
|
// TODO: move hook to separate file
|
|
1709
|
-
function useFocusState(
|
|
1685
|
+
function useFocusState(_ref10) {
|
|
1710
1686
|
let {
|
|
1711
1687
|
headerRowIndex,
|
|
1712
1688
|
maxRowIndex,
|
|
@@ -1716,7 +1692,7 @@ function useFocusState(_ref8) {
|
|
|
1716
1692
|
pinnedUnpinnedColumnOrder,
|
|
1717
1693
|
tableRef,
|
|
1718
1694
|
currentPage
|
|
1719
|
-
} =
|
|
1695
|
+
} = _ref10;
|
|
1720
1696
|
const cellRefs = React.useRef({});
|
|
1721
1697
|
const pinnedContainersRef = React.useRef({});
|
|
1722
1698
|
const [focusedRowIndex, setFocusedRowIndex] = React.useState(headerRowIndex);
|
|
@@ -1852,10 +1828,10 @@ function mapExternalRowToInternalRows(row, depthSize, depthIndex, parentId) {
|
|
|
1852
1828
|
|
|
1853
1829
|
/* eslint-disable import/prefer-default-export */
|
|
1854
1830
|
|
|
1855
|
-
var css_248z$
|
|
1856
|
-
var styles$a = {"collapsibleSearchInput":"
|
|
1857
|
-
var stylesheet$
|
|
1858
|
-
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$
|
|
1831
|
+
var css_248z$b = "._JxCCx{display:inline-block;width:36px;transition:width .25s ease-out}._wPpDy{width:100%}._DQtXK>input{padding-right:0!important}._r0oxP>svg{fill:#515559}";
|
|
1832
|
+
var styles$a = {"collapsibleSearchInput":"_JxCCx","searchInput":"_wPpDy","searchInputCollapsed":"_DQtXK","iconButton":"_r0oxP"};
|
|
1833
|
+
var stylesheet$b="._JxCCx{display:inline-block;width:36px;transition:width .25s ease-out}._wPpDy{width:100%}._DQtXK>input{padding-right:0!important}._r0oxP>svg{fill:#515559}";
|
|
1834
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$b);}
|
|
1859
1835
|
|
|
1860
1836
|
const CollapsibleSearchInputIconButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
1861
1837
|
let {
|
|
@@ -1995,116 +1971,71 @@ const CollapsibleSearchInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
1995
1971
|
}));
|
|
1996
1972
|
});
|
|
1997
1973
|
|
|
1998
|
-
|
|
1999
|
-
var styles$9 = {"input":"_7tH8z","disabled":"_WaRuO","dropdown":"_0wVEa","container":"_uVSfx","countryCode":"_aLxHs"};
|
|
2000
|
-
var stylesheet$9="._7tH8z input{padding-left:76px!important}._WaRuO input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._WaRuO input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._WaRuO input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._0wVEa{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._0wVEa,._0wVEa._WaRuO:hover{background-color:transparent!important}._0wVEa:hover{background-color:rgba(50,54,58,.08)!important}._0wVEa:active{background-color:rgba(50,54,58,.11)!important}._0wVEa svg{top:2px!important}._uVSfx{position:relative}._aLxHs{position:absolute;top:18px;left:12px;line-height:0;font-size:14px;color:#32363a;z-index:101;pointer-events:none}";
|
|
2001
|
-
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$9);}
|
|
2002
|
-
|
|
2003
|
-
const PhoneNumberInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
1974
|
+
const GridChildrenWrapper = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
2004
1975
|
let {
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
onChange,
|
|
2008
|
-
limitToValidLength = false,
|
|
2009
|
-
isDisabled,
|
|
2010
|
-
initialValue,
|
|
2011
|
-
buttonAriaLabel,
|
|
2012
|
-
inputAriaLabel,
|
|
2013
|
-
buttonAriaLabelledBy,
|
|
2014
|
-
inputAriaLabelledBy,
|
|
1976
|
+
asChild,
|
|
1977
|
+
style,
|
|
2015
1978
|
'data-testid': dataTestId,
|
|
2016
|
-
|
|
1979
|
+
children
|
|
2017
1980
|
} = _ref;
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
const metadata = new libphonenumberJs.Metadata();
|
|
2028
|
-
metadata.selectNumberingPlan(countryCode);
|
|
2029
|
-
const possibleLengths = metadata === null || metadata === void 0 || (_metadata$numberingPl = metadata.numberingPlan) === null || _metadata$numberingPl === void 0 ? void 0 : _metadata$numberingPl.possibleLengths();
|
|
2030
|
-
return possibleLengths ? [Math.min(...possibleLengths), Math.max(...possibleLengths)] : [0, genericMaxNumberLength];
|
|
2031
|
-
}, [countryCode]);
|
|
2032
|
-
const shouldUseMask = Number(libphonenumberJs.getCountryCallingCode(countryCode)) === 1;
|
|
2033
|
-
const updateMask = React.useCallback(() => {
|
|
2034
|
-
if (shouldUseMask) {
|
|
2035
|
-
setMask('(999) 999-9999');
|
|
2036
|
-
} else {
|
|
2037
|
-
setMask('9'.repeat(limitToValidLength ? getMinMaxLength()[1] : genericMaxNumberLength));
|
|
2038
|
-
}
|
|
2039
|
-
}, [shouldUseMask, getMinMaxLength, limitToValidLength]);
|
|
2040
|
-
React.useEffect(() => {
|
|
2041
|
-
updateMask();
|
|
2042
|
-
}, [countryCode, updateMask]);
|
|
2043
|
-
const removeNonNumericCharacters = value => value === null || value === void 0 ? void 0 : value.replace(/\D/g, '');
|
|
2044
|
-
const handleInputChange = a => {
|
|
2045
|
-
// remove all non-numeric characters
|
|
2046
|
-
const value = removeNonNumericCharacters(a.target.value);
|
|
2047
|
-
let internationalNumber = null;
|
|
2048
|
-
let isValidLength = false;
|
|
2049
|
-
if (!value) {
|
|
2050
|
-
return;
|
|
2051
|
-
}
|
|
2052
|
-
try {
|
|
2053
|
-
const phoneNumber = libphonenumberJs.parsePhoneNumber(value, countryCode);
|
|
2054
|
-
internationalNumber = phoneNumber.format('E.164');
|
|
2055
|
-
isValidLength = phoneNumber.isPossible();
|
|
2056
|
-
} catch (e) {
|
|
2057
|
-
// `parsePhoneNumber` throws an error if the inputs are invalid.
|
|
2058
|
-
}
|
|
2059
|
-
onChange === null || onChange === void 0 || onChange(internationalNumber, isValidLength, countryCode, value);
|
|
2060
|
-
};
|
|
2061
|
-
const inputClassNames = classNames__default["default"](styles$9.input, {
|
|
2062
|
-
[styles$9.disabled]: isDisabled
|
|
2063
|
-
});
|
|
2064
|
-
const dropdownLabel = React.useMemo(() => countryCode ? "+".concat(libphonenumberJs.getCountryCallingCode(countryCode)) : undefined, [countryCode]);
|
|
1981
|
+
if (asChild && /*#__PURE__*/React.isValidElement(children)) {
|
|
1982
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
1983
|
+
style: {
|
|
1984
|
+
...children.props.style,
|
|
1985
|
+
...style
|
|
1986
|
+
},
|
|
1987
|
+
ref: index.mergeRefs(children.ref, ref)
|
|
1988
|
+
});
|
|
1989
|
+
}
|
|
2065
1990
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2066
|
-
className: styles$9.container,
|
|
2067
|
-
"data-testid": dataTestId
|
|
2068
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
2069
|
-
className: styles$9.countryCode
|
|
2070
|
-
}, dropdownLabel), /*#__PURE__*/React__default["default"].createElement(index.SelectMenu, {
|
|
2071
|
-
label: " ",
|
|
2072
|
-
defaultValue: countryCode,
|
|
2073
|
-
onChange: value => setCountryCode(value),
|
|
2074
|
-
className: classNames__default["default"](styles$9.dropdown, {
|
|
2075
|
-
[styles$9.disabled]: isDisabled
|
|
2076
|
-
}),
|
|
2077
|
-
searchable: true,
|
|
2078
|
-
disabled: isDisabled,
|
|
2079
|
-
"aria-label": buttonAriaLabel,
|
|
2080
|
-
"aria-labelledby": buttonAriaLabelledBy
|
|
2081
|
-
}, (countryCodes !== null && countryCodes !== void 0 ? countryCodes : libphonenumberJs.getCountries()).map(individualCountryCode => {
|
|
2082
|
-
if (!libphonenumberJs.isSupportedCountry(individualCountryCode)) {
|
|
2083
|
-
return null;
|
|
2084
|
-
}
|
|
2085
|
-
return /*#__PURE__*/React__default["default"].createElement(index.MenuItem, {
|
|
2086
|
-
key: individualCountryCode,
|
|
2087
|
-
value: individualCountryCode
|
|
2088
|
-
}, "".concat(translate(individualCountryCode), " +").concat(libphonenumberJs.getCountryCallingCode(individualCountryCode)));
|
|
2089
|
-
})), /*#__PURE__*/React__default["default"].createElement(InputMask__default["default"], {
|
|
2090
|
-
value: isDisabled ? removeNonNumericCharacters(initialValue) : undefined,
|
|
2091
|
-
type: "tel",
|
|
2092
|
-
alwaysShowMask: true
|
|
2093
|
-
// hide formatting if not using mask
|
|
2094
|
-
,
|
|
2095
|
-
maskChar: shouldUseMask ? '_' : '',
|
|
2096
|
-
mask: mask,
|
|
2097
|
-
onChange: !isDisabled ? handleInputChange : undefined
|
|
2098
|
-
}, () => /*#__PURE__*/React__default["default"].createElement(index.Input$1, {
|
|
2099
1991
|
ref: ref,
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
1992
|
+
"data-testid": dataTestId,
|
|
1993
|
+
style: {
|
|
1994
|
+
...style
|
|
1995
|
+
}
|
|
1996
|
+
}, children);
|
|
1997
|
+
});
|
|
1998
|
+
|
|
1999
|
+
const CollectionGrid = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
2000
|
+
let {
|
|
2001
|
+
minColumnWidth = '0px',
|
|
2002
|
+
maxColumnWidth = '1fr',
|
|
2003
|
+
numColumns = 'auto-fit',
|
|
2004
|
+
columnGap,
|
|
2005
|
+
rowGap,
|
|
2006
|
+
gap,
|
|
2007
|
+
rowHeight,
|
|
2008
|
+
asChild = false,
|
|
2009
|
+
'data-testid': dataTestId,
|
|
2010
|
+
children
|
|
2011
|
+
} = _ref;
|
|
2012
|
+
const calculatedStyle = {
|
|
2013
|
+
display: 'grid',
|
|
2014
|
+
gridTemplateColumns: "repeat(".concat(numColumns, ", minmax(").concat(minColumnWidth, ", ").concat(maxColumnWidth, "))"),
|
|
2015
|
+
columnGap,
|
|
2016
|
+
rowGap,
|
|
2017
|
+
gridGap: gap,
|
|
2018
|
+
gridAutoRows: rowHeight
|
|
2019
|
+
};
|
|
2020
|
+
return /*#__PURE__*/React__default["default"].createElement(GridChildrenWrapper, {
|
|
2021
|
+
asChild: asChild,
|
|
2022
|
+
style: calculatedStyle,
|
|
2023
|
+
"data-testid": dataTestId,
|
|
2024
|
+
ref: ref
|
|
2025
|
+
}, children);
|
|
2026
|
+
});
|
|
2027
|
+
|
|
2028
|
+
const CollectionGridItem = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
2029
|
+
let {
|
|
2030
|
+
asChild = false,
|
|
2031
|
+
'data-testid': dataTestId,
|
|
2032
|
+
children
|
|
2033
|
+
} = _ref;
|
|
2034
|
+
return /*#__PURE__*/React__default["default"].createElement(GridChildrenWrapper, {
|
|
2035
|
+
asChild: asChild,
|
|
2036
|
+
"data-testid": dataTestId,
|
|
2037
|
+
ref: ref
|
|
2038
|
+
}, children);
|
|
2108
2039
|
});
|
|
2109
2040
|
|
|
2110
2041
|
const {
|
|
@@ -2719,10 +2650,10 @@ function Combobox(_ref) {
|
|
|
2719
2650
|
}, children);
|
|
2720
2651
|
}
|
|
2721
2652
|
|
|
2722
|
-
var css_248z$
|
|
2723
|
-
var styles$
|
|
2724
|
-
var stylesheet$
|
|
2725
|
-
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$
|
|
2653
|
+
var css_248z$a = "._3jFVA :after{background-color:#515559!important}._pZoM4>input:focus{box-shadow:none!important;border:1px solid #898989!important}._fTLSW{max-width:500px;padding:4px 0;background-color:#fff;border:1px solid #eee;border-radius:4px;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);z-index:1000;overflow-x:hidden;overflow-y:auto;overflow:hidden auto}._fTLSW ._6heqn ._xPmGT{display:flex;align-items:center;min-height:40px;padding:10px 12px;color:#32363a;font-size:12px;line-height:16px;font-weight:700;word-break:break-word}._fTLSW ._6heqn:first-child ._-3kuz{display:none}._fTLSW ._ammwR{display:flex;align-items:center;min-height:40px;padding:10px 12px;font-size:14px;color:#32363a;word-break:break-word;outline:none;cursor:pointer}._fTLSW ._ammwR:hover{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._fTLSW ._ammwR:hover._-cuj7{background-color:#e4effa}._fTLSW ._ammwR._-cuj7{background-color:#ebf3fb;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._fTLSW ._ammwR:active:not(._-cuj7){background-color:#e8e9e9}";
|
|
2654
|
+
var styles$9 = {"loadingSpinner":"_3jFVA","ignoreFocusStyle":"_pZoM4","flyout":"_fTLSW","group":"_6heqn","header":"_xPmGT","divider":"_-3kuz","option":"_ammwR","selected":"_-cuj7"};
|
|
2655
|
+
var stylesheet$a="._3jFVA :after{background-color:#515559!important}._pZoM4>input:focus{box-shadow:none!important;border:1px solid #898989!important}._fTLSW{max-width:500px;padding:4px 0;background-color:#fff;border:1px solid #eee;border-radius:4px;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);z-index:1000;overflow-x:hidden;overflow-y:auto;overflow:hidden auto}._fTLSW ._6heqn ._xPmGT{display:flex;align-items:center;min-height:40px;padding:10px 12px;color:#32363a;font-size:12px;line-height:16px;font-weight:700;word-break:break-word}._fTLSW ._6heqn:first-child ._-3kuz{display:none}._fTLSW ._ammwR{display:flex;align-items:center;min-height:40px;padding:10px 12px;font-size:14px;color:#32363a;word-break:break-word;outline:none;cursor:pointer}._fTLSW ._ammwR:hover{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._fTLSW ._ammwR:hover._-cuj7{background-color:#e4effa}._fTLSW ._ammwR._-cuj7{background-color:#ebf3fb;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._fTLSW ._ammwR:active:not(._-cuj7){background-color:#e8e9e9}";
|
|
2656
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$a);}
|
|
2726
2657
|
|
|
2727
2658
|
const ComboboxInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
2728
2659
|
let {
|
|
@@ -2828,7 +2759,7 @@ const ComboboxInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
2828
2759
|
return /*#__PURE__*/React__default["default"].createElement(index.Input$1, {
|
|
2829
2760
|
role: "combobox",
|
|
2830
2761
|
className: classNames__default["default"](className, {
|
|
2831
|
-
[styles$
|
|
2762
|
+
[styles$9.ignoreFocusStyle]: hoveredOption || activeDescendantElement
|
|
2832
2763
|
}),
|
|
2833
2764
|
style: style,
|
|
2834
2765
|
id: id,
|
|
@@ -2841,7 +2772,7 @@ const ComboboxInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
2841
2772
|
},
|
|
2842
2773
|
leftAddOn: leftAddOn,
|
|
2843
2774
|
rightAddOn: isLoading ? /*#__PURE__*/React__default["default"].createElement(index.LoadingSpinner, {
|
|
2844
|
-
className: styles$
|
|
2775
|
+
className: styles$9.loadingSpinner,
|
|
2845
2776
|
size: "xs",
|
|
2846
2777
|
show: isLoading,
|
|
2847
2778
|
"aria-hidden": true
|
|
@@ -2898,7 +2829,7 @@ const ComboboxFlyout = _ref => {
|
|
|
2898
2829
|
popper: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2899
2830
|
role: "listbox",
|
|
2900
2831
|
id: flyoutId,
|
|
2901
|
-
className: styles$
|
|
2832
|
+
className: styles$9.flyout,
|
|
2902
2833
|
style: flyoutDimensions,
|
|
2903
2834
|
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : rootAriaLabel,
|
|
2904
2835
|
"aria-labelledby": ariaLabelledBy !== null && ariaLabelledBy !== void 0 ? ariaLabelledBy : rootAriaLabelledBy,
|
|
@@ -2950,16 +2881,16 @@ function ComboboxGroup(_ref) {
|
|
|
2950
2881
|
}, children);
|
|
2951
2882
|
return hasFilteredOptions ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2952
2883
|
role: "group",
|
|
2953
|
-
className: styles$
|
|
2884
|
+
className: styles$9.group,
|
|
2954
2885
|
"aria-labelledby": headerElementId,
|
|
2955
2886
|
"aria-describedby": ariaDescribedBy,
|
|
2956
2887
|
"data-testid": index.getSubDataTestId(rootDataTestId, "group-".concat(label))
|
|
2957
2888
|
}, /*#__PURE__*/React__default["default"].createElement(index.Divider, {
|
|
2958
|
-
className: styles$
|
|
2889
|
+
className: styles$9.divider
|
|
2959
2890
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2960
2891
|
"aria-hidden": "true",
|
|
2961
2892
|
id: headerElementId,
|
|
2962
|
-
className: styles$
|
|
2893
|
+
className: styles$9.header
|
|
2963
2894
|
}, label), childrenWithContext) : childrenWithContext // Even if the group currently has no filtered children, the children (i.e. options) still need the context so that they can register themselves later on if the input value changes
|
|
2964
2895
|
;
|
|
2965
2896
|
}
|
|
@@ -3012,8 +2943,8 @@ function ComboboxOption(_ref) {
|
|
|
3012
2943
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3013
2944
|
role: "option",
|
|
3014
2945
|
id: containerId,
|
|
3015
|
-
className: classNames__default["default"](styles$
|
|
3016
|
-
[styles$
|
|
2946
|
+
className: classNames__default["default"](styles$9.option, {
|
|
2947
|
+
[styles$9.selected]: isOptionSelected
|
|
3017
2948
|
}),
|
|
3018
2949
|
onClick: () => {
|
|
3019
2950
|
setCommittedInputValue(label);
|
|
@@ -3031,112 +2962,194 @@ function ComboboxOption(_ref) {
|
|
|
3031
2962
|
}, label);
|
|
3032
2963
|
}
|
|
3033
2964
|
|
|
3034
|
-
var css_248z$
|
|
3035
|
-
var styles$
|
|
3036
|
-
var stylesheet$
|
|
3037
|
-
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$
|
|
2965
|
+
var css_248z$9 = "._gkhZy{background-color:#000;opacity:.5;width:100%;height:100%;position:absolute;top:0;left:0;right:0;bottom:0;display:grid;align-items:left;justify-items:left;place-items:left;overflow-y:auto}._T7amd{visibility:hidden}";
|
|
2966
|
+
var styles$8 = {"overlay":"_gkhZy","hidden":"_T7amd"};
|
|
2967
|
+
var stylesheet$9="._gkhZy{background-color:#000;opacity:.5;width:100%;height:100%;position:absolute;top:0;left:0;right:0;bottom:0;display:grid;align-items:left;justify-items:left;place-items:left;overflow-y:auto}._T7amd{visibility:hidden}";
|
|
2968
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$9);}
|
|
3038
2969
|
|
|
3039
|
-
|
|
2970
|
+
/**
|
|
2971
|
+
* Adds an overlay to an area that obscures visibility and disables background elements.
|
|
2972
|
+
* @param {MutableRefObject} containerRef - A ref pointing to the DOM element to be filled by the overlay.
|
|
2973
|
+
* @param {boolean} isVisible - When true, displays overlay and disables all element behind it.
|
|
2974
|
+
* @param {React.MouseEventHandler} onClick - A function to be called when the overlay recieves a click event.
|
|
2975
|
+
* @param {string[]} ignoreIds - An array of ids belonging to elements that should not become inert when isInert is true.
|
|
2976
|
+
* @param {CSSProperties['zIndex']} zIndex - The zIndex of the overlay.
|
|
2977
|
+
* @param {string} dataTestId - A string to be added to the overlay element as a data-testid.
|
|
2978
|
+
* @param {number} opacity - The opacity of the overlay.
|
|
2979
|
+
*/
|
|
2980
|
+
const useOverlay = _ref => {
|
|
3040
2981
|
let {
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
buttonAriaLabel,
|
|
3049
|
-
buttonAriaLabelledBy,
|
|
3050
|
-
dropdownAriaLabel,
|
|
3051
|
-
dropdownAriaLabelledBy,
|
|
3052
|
-
onClick
|
|
2982
|
+
containerRef,
|
|
2983
|
+
isVisible,
|
|
2984
|
+
onClick,
|
|
2985
|
+
ignoreIds = [],
|
|
2986
|
+
zIndex,
|
|
2987
|
+
dataTestId,
|
|
2988
|
+
opacity
|
|
3053
2989
|
} = _ref;
|
|
3054
|
-
const
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
},
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
})
|
|
3096
|
-
}), /*#__PURE__*/React__default["default"].createElement(index.Dropdown, {
|
|
3097
|
-
"data-testid": index.getSubDataTestId(dataTestId, 'dropdown'),
|
|
3098
|
-
"aria-label": dropdownAriaLabel,
|
|
3099
|
-
"aria-labelledby": dropdownAriaLabelledBy,
|
|
3100
|
-
value: 0,
|
|
3101
|
-
disabled: isDropdownDisabled
|
|
3102
|
-
}, /*#__PURE__*/React__default["default"].createElement(index.DropdownButton
|
|
3103
|
-
// `label` of type `string` adds Dropdown's `isString` class, which causes a css bug in Safari
|
|
3104
|
-
, {
|
|
3105
|
-
label: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null),
|
|
3106
|
-
className: classNames__default["default"](styles$7.dropdownButton, {
|
|
3107
|
-
[styles$7.disabled]: isDropdownDisabled,
|
|
3108
|
-
[styles$7.primary]: kind === 'primary',
|
|
3109
|
-
[styles$7.secondary]: kind === 'secondary'
|
|
3110
|
-
}),
|
|
3111
|
-
ref: dropdownButtonRef,
|
|
3112
|
-
tabIndex: -1,
|
|
3113
|
-
onFocus: () => setDropdownButtonHasFocus(true),
|
|
3114
|
-
onBlur: () => setDropdownButtonHasFocus(false)
|
|
3115
|
-
}), /*#__PURE__*/React__default["default"].createElement(index.DropdownList, {
|
|
3116
|
-
placement: "bottom"
|
|
3117
|
-
}, children)));
|
|
3118
|
-
});
|
|
2990
|
+
const overlayId = index.useId();
|
|
2991
|
+
React.useEffect(() => {
|
|
2992
|
+
var _containerRef$current;
|
|
2993
|
+
const containerNode = (_containerRef$current = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : document.body;
|
|
2994
|
+
const overlay = document.createElement('div');
|
|
2995
|
+
overlay.id = overlayId;
|
|
2996
|
+
overlay.classList.add(styles$8.overlay);
|
|
2997
|
+
if (onClick) overlay.addEventListener('click', onClick);
|
|
2998
|
+
if (dataTestId) overlay.dataset.testid = dataTestId;
|
|
2999
|
+
if (!isVisible) overlay.classList.add(styles$8.hidden);
|
|
3000
|
+
if (zIndex || zIndex === 0) overlay.style.zIndex = zIndex.toString();
|
|
3001
|
+
if (opacity || opacity === 0) overlay.style.opacity = opacity.toString();
|
|
3002
|
+
containerNode.appendChild(overlay);
|
|
3003
|
+
containerNode.style.position = 'relative';
|
|
3004
|
+
return () => {
|
|
3005
|
+
containerNode.style.position = 'static';
|
|
3006
|
+
containerNode.removeChild(overlay);
|
|
3007
|
+
};
|
|
3008
|
+
}, [containerRef, overlayId, isVisible, onClick, dataTestId, zIndex, opacity]);
|
|
3009
|
+
React.useEffect(() => {
|
|
3010
|
+
var _containerRef$current2;
|
|
3011
|
+
const containerNode = (_containerRef$current2 = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _containerRef$current2 !== void 0 ? _containerRef$current2 : document.body;
|
|
3012
|
+
const overlayNode = document.getElementById(overlayId);
|
|
3013
|
+
if (isVisible) {
|
|
3014
|
+
Array.from(containerNode.children).forEach(child => {
|
|
3015
|
+
if (!ignoreIds.includes(child.id) && child.id !== overlayId) child.setAttribute('inert', '');
|
|
3016
|
+
});
|
|
3017
|
+
overlayNode === null || overlayNode === void 0 || overlayNode.classList.remove(styles$8.hidden);
|
|
3018
|
+
} else {
|
|
3019
|
+
Array.from(containerNode.children).forEach(child => {
|
|
3020
|
+
child.removeAttribute('inert');
|
|
3021
|
+
});
|
|
3022
|
+
overlayNode === null || overlayNode === void 0 || overlayNode.classList.add(styles$8.hidden);
|
|
3023
|
+
}
|
|
3024
|
+
return () => {
|
|
3025
|
+
Array.from(containerNode.children).forEach(child => {
|
|
3026
|
+
child.removeAttribute('inert');
|
|
3027
|
+
});
|
|
3028
|
+
};
|
|
3029
|
+
}, [containerRef, isVisible, ignoreIds, overlayId]);
|
|
3030
|
+
};
|
|
3119
3031
|
|
|
3120
|
-
|
|
3032
|
+
var css_248z$8 = "._z-DPG{position:absolute;top:0;height:100%;overflow:auto;color:#32363a;background-color:#fff;border-right:1px solid #eee;z-index:1000;padding:12px 20px 20px;transition:left .5s}._GOLAP{visibility:hidden}._csuZ0{display:flex;justify-content:space-between;align-items:start;line-height:20px;font-size:16px;padding-bottom:12px}._Umlpx{padding-top:8px}._tewgb{margin-left:12px}";
|
|
3033
|
+
var styles$7 = {"drawer":"_z-DPG","hidden":"_GOLAP","header":"_csuZ0","title":"_Umlpx","closeButton":"_tewgb"};
|
|
3034
|
+
var stylesheet$8="._z-DPG{position:absolute;top:0;height:100%;overflow:auto;color:#32363a;background-color:#fff;border-right:1px solid #eee;z-index:1000;padding:12px 20px 20px;transition:left .5s}._GOLAP{visibility:hidden}._csuZ0{display:flex;justify-content:space-between;align-items:start;line-height:20px;font-size:16px;padding-bottom:12px}._Umlpx{padding-top:8px}._tewgb{margin-left:12px}";
|
|
3035
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$8);}
|
|
3036
|
+
|
|
3037
|
+
const Drawer = _ref => {
|
|
3038
|
+
var _containerRef$current;
|
|
3121
3039
|
let {
|
|
3122
|
-
|
|
3123
|
-
|
|
3040
|
+
id,
|
|
3041
|
+
isOpen: externalIsOpen,
|
|
3042
|
+
onIsOpenChange,
|
|
3043
|
+
title,
|
|
3044
|
+
width = '292px',
|
|
3045
|
+
zIndex = 1000,
|
|
3046
|
+
elementRefToFocusOnClose,
|
|
3047
|
+
containerRef,
|
|
3048
|
+
'aria-label': ariaLabel,
|
|
3049
|
+
'aria-labelledby': ariaLabelledby,
|
|
3050
|
+
'aria-describedby': ariaDescribedby,
|
|
3051
|
+
'data-testid': dataTestId,
|
|
3124
3052
|
children
|
|
3125
3053
|
} = _ref;
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3054
|
+
// waits to createPortal until after containerRef is in DOM
|
|
3055
|
+
const [domReady, setDomReady] = React.useState(false);
|
|
3056
|
+
React.useEffect(() => {
|
|
3057
|
+
setDomReady(true);
|
|
3058
|
+
}, [setDomReady]);
|
|
3059
|
+
const [elementUsedToOpenModal, setElementUsedToOpenModal] = React.useState();
|
|
3060
|
+
const drawerRef = React.useRef(null);
|
|
3061
|
+
const drawerId = index.useId(id);
|
|
3062
|
+
const [isOpen, setIsOpen] = index.useControllableState(externalIsOpen, onIsOpenChange, externalIsOpen);
|
|
3063
|
+
const [isClosing, setIsClosing] = React.useState(false);
|
|
3064
|
+
const [isHidden, setIsHidden] = React.useState(!isOpen);
|
|
3065
|
+
const {
|
|
3066
|
+
translate
|
|
3067
|
+
} = index.useTranslation();
|
|
3068
|
+
const closeButtonAriaLabel = translate('close');
|
|
3069
|
+
const closeButtonRef = React.useRef(null);
|
|
3070
|
+
const close = () => {
|
|
3071
|
+
setIsOpen(false);
|
|
3072
|
+
};
|
|
3073
|
+
const handleKeyDown = e => {
|
|
3074
|
+
if (e.key === 'Escape') {
|
|
3075
|
+
close();
|
|
3076
|
+
e.preventDefault(); // Prevent Safari from exiting full-screen mode
|
|
3077
|
+
}
|
|
3078
|
+
};
|
|
3135
3079
|
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3080
|
+
useOverlay({
|
|
3081
|
+
containerRef,
|
|
3082
|
+
isVisible: isOpen,
|
|
3083
|
+
onClick: close,
|
|
3084
|
+
ignoreIds: [drawerId],
|
|
3085
|
+
zIndex: Number(zIndex) - 1,
|
|
3086
|
+
dataTestId: index.getSubDataTestId(dataTestId, 'overlay')
|
|
3087
|
+
});
|
|
3088
|
+
index.useDidUpdate(() => {
|
|
3089
|
+
if (isOpen) {
|
|
3090
|
+
setIsClosing(false);
|
|
3091
|
+
setIsHidden(false);
|
|
3092
|
+
setElementUsedToOpenModal(document.activeElement);
|
|
3093
|
+
} else {
|
|
3094
|
+
var _elementRefToFocusOnC;
|
|
3095
|
+
setIsClosing(true);
|
|
3096
|
+
if (elementRefToFocusOnClose !== undefined) elementRefToFocusOnClose === null || elementRefToFocusOnClose === void 0 || (_elementRefToFocusOnC = elementRefToFocusOnClose.current) === null || _elementRefToFocusOnC === void 0 || _elementRefToFocusOnC.focus();else elementUsedToOpenModal === null || elementUsedToOpenModal === void 0 || elementUsedToOpenModal.focus();
|
|
3097
|
+
}
|
|
3098
|
+
}, [elementRefToFocusOnClose, isOpen]);
|
|
3099
|
+
React.useEffect(() => {
|
|
3100
|
+
if (isOpen && !isHidden) {
|
|
3101
|
+
var _closeButtonRef$curre;
|
|
3102
|
+
(_closeButtonRef$curre = closeButtonRef.current) === null || _closeButtonRef$curre === void 0 || _closeButtonRef$curre.focus();
|
|
3103
|
+
}
|
|
3104
|
+
}, [isOpen, isHidden]);
|
|
3105
|
+
const handleTransitionEnd = () => {
|
|
3106
|
+
if (!isOpen) {
|
|
3107
|
+
setIsClosing(false);
|
|
3108
|
+
setIsHidden(true);
|
|
3109
|
+
}
|
|
3110
|
+
};
|
|
3111
|
+
|
|
3112
|
+
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
3113
|
+
return domReady ? /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React__default["default"].createElement("aside", {
|
|
3114
|
+
id: drawerId,
|
|
3115
|
+
className: classNames__default["default"](styles$7.drawer, {
|
|
3116
|
+
[styles$7.hidden]: isHidden,
|
|
3117
|
+
[styles$7.closing]: isClosing
|
|
3118
|
+
}),
|
|
3119
|
+
style: {
|
|
3120
|
+
width,
|
|
3121
|
+
left: "".concat(isHidden || isClosing ? "-".concat(width) : '0'),
|
|
3122
|
+
zIndex
|
|
3123
|
+
},
|
|
3124
|
+
onKeyDown: handleKeyDown,
|
|
3125
|
+
onTransitionEnd: handleTransitionEnd,
|
|
3126
|
+
"data-testid": dataTestId,
|
|
3127
|
+
"aria-label": ariaLabel,
|
|
3128
|
+
"aria-labelledby": ariaLabelledby,
|
|
3129
|
+
"aria-describedby": ariaDescribedby,
|
|
3130
|
+
ref: drawerRef
|
|
3131
|
+
}, /*#__PURE__*/React__default["default"].createElement(index.PortalTargetProvider, {
|
|
3132
|
+
target: drawerRef.current
|
|
3133
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3134
|
+
className: styles$7.header
|
|
3135
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3136
|
+
className: styles$7.title,
|
|
3137
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'title')
|
|
3138
|
+
}, title), /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
3139
|
+
className: styles$7.closeButton,
|
|
3140
|
+
onClick: close,
|
|
3141
|
+
ref: closeButtonRef,
|
|
3142
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'close-button'),
|
|
3143
|
+
"aria-label": closeButtonAriaLabel
|
|
3144
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons_index.CloseIcon, null))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3145
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'body')
|
|
3146
|
+
}, children))), (_containerRef$current = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : document.body) : null;
|
|
3147
|
+
};
|
|
3148
|
+
|
|
3149
|
+
var css_248z$7 = "._Cgjit{display:flex;justify-content:space-between;align-items:center;max-width:100%;min-width:76px;height:36px;padding:0 6px 0 12px;outline:none;font-size:14px;background-color:#fff;border:1px solid #898989;border-radius:20px;cursor:pointer}._Cgjit:hover:not(._AD4ZS){background-color:rgba(50,54,58,.08)}._Cgjit:hover:not(._AD4ZS)._OqOcQ{border-color:#085caf;background-color:rgba(11,110,208,.04)}._Cgjit:hover:not(._AD4ZS)._OqOcQ ._yf6yU{color:#32363a}._Cgjit:hover:not(._AD4ZS)._OqOcQ ._Kaj1K{fill:#32363a}._Cgjit:hover:not(._AD4ZS)._OqOcQ ._wXS9v{fill:#085caf}._Cgjit:hover:not(._AD4ZS)._OqOcQ ._dksPL{background-color:rgba(11,110,208,.11)}._Cgjit:hover:not(._AD4ZS)._OqOcQ ._dksPL ._lfkPT{color:#085caf}._Cgjit:active:not(._AD4ZS){background-color:#e8e9e9}._Cgjit:active:not(._AD4ZS)._OqOcQ{background-color:rgba(11,110,208,.11);border-color:#0854a1}._Cgjit:active:not(._AD4ZS)._OqOcQ ._wXS9v{fill:#0854a1}._Cgjit:active:not(._AD4ZS)._OqOcQ ._dksPL{background-color:rgba(11,110,208,.11)}._Cgjit:active:not(._AD4ZS)._OqOcQ ._dksPL ._lfkPT{color:#0854a1}._Cgjit._AD4ZS{background-color:#fafafa;border-color:#e5e5e5;cursor:not-allowed}._Cgjit._OqOcQ{border-color:#0b6ed0}._Kaj1K{fill:#515559;margin-right:4px}._yf6yU{max-width:180px;margin-right:3px;color:#515559;fill:#515559;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._yf6yU+._dksPL{margin-left:6px}._yf6yU._AD4ZS{color:#74777a}._dksPL{display:flex;justify-content:center;align-items:center;max-width:350px;flex:1;min-width:0;height:24px;margin-right:3px;padding:0 10px;background-color:#ebf3fb;border-radius:20px}._lfkPT{color:#0b6ed0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._wXS9v{fill:#515559}._wXS9v._AD4ZS,._wXS9v._AD4ZS._OqOcQ{fill:rgba(116,119,122,.4)}._wXS9v._OqOcQ{fill:#0b6ed0}._wXS9v._jZoyc{transform:rotate(-180deg)}._Cgjit.focus-visible,._Cgjit:focus-visible{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
3150
|
+
var styles$6 = {"button":"_Cgjit","disabled":"_AD4ZS","selected":"_OqOcQ","label":"_yf6yU","lockIcon":"_Kaj1K","chevronIcon":"_wXS9v","selectedFiltersContainer":"_dksPL","selectedFilters":"_lfkPT","open":"_jZoyc"};
|
|
3151
|
+
var stylesheet$7="._Cgjit{display:flex;justify-content:space-between;align-items:center;max-width:100%;min-width:76px;height:36px;padding:0 6px 0 12px;outline:none;font-size:14px;background-color:#fff;border:1px solid #898989;border-radius:20px;cursor:pointer}._Cgjit:hover:not(._AD4ZS){background-color:rgba(50,54,58,.08)}._Cgjit:hover:not(._AD4ZS)._OqOcQ{border-color:#085caf;background-color:rgba(11,110,208,.04)}._Cgjit:hover:not(._AD4ZS)._OqOcQ ._yf6yU{color:#32363a}._Cgjit:hover:not(._AD4ZS)._OqOcQ ._Kaj1K{fill:#32363a}._Cgjit:hover:not(._AD4ZS)._OqOcQ ._wXS9v{fill:#085caf}._Cgjit:hover:not(._AD4ZS)._OqOcQ ._dksPL{background-color:rgba(11,110,208,.11)}._Cgjit:hover:not(._AD4ZS)._OqOcQ ._dksPL ._lfkPT{color:#085caf}._Cgjit:active:not(._AD4ZS){background-color:#e8e9e9}._Cgjit:active:not(._AD4ZS)._OqOcQ{background-color:rgba(11,110,208,.11);border-color:#0854a1}._Cgjit:active:not(._AD4ZS)._OqOcQ ._wXS9v{fill:#0854a1}._Cgjit:active:not(._AD4ZS)._OqOcQ ._dksPL{background-color:rgba(11,110,208,.11)}._Cgjit:active:not(._AD4ZS)._OqOcQ ._dksPL ._lfkPT{color:#0854a1}._Cgjit._AD4ZS{background-color:#fafafa;border-color:#e5e5e5;cursor:not-allowed}._Cgjit._OqOcQ{border-color:#0b6ed0}._Kaj1K{fill:#515559;margin-right:4px}._yf6yU{max-width:180px;margin-right:3px;color:#515559;fill:#515559;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._yf6yU+._dksPL{margin-left:6px}._yf6yU._AD4ZS{color:#74777a}._dksPL{display:flex;justify-content:center;align-items:center;max-width:350px;flex:1;min-width:0;height:24px;margin-right:3px;padding:0 10px;background-color:#ebf3fb;border-radius:20px}._lfkPT{color:#0b6ed0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._wXS9v{fill:#515559}._wXS9v._AD4ZS,._wXS9v._AD4ZS._OqOcQ{fill:rgba(116,119,122,.4)}._wXS9v._OqOcQ{fill:#0b6ed0}._wXS9v._jZoyc{transform:rotate(-180deg)}._Cgjit.focus-visible,._Cgjit:focus-visible{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
3152
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$7);}
|
|
3140
3153
|
|
|
3141
3154
|
const FilterAnchor = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
3142
3155
|
let {
|
|
@@ -3222,94 +3235,464 @@ const FilterAnchor = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
3222
3235
|
}));
|
|
3223
3236
|
});
|
|
3224
3237
|
|
|
3225
|
-
|
|
3226
|
-
useContext: useMenuContext,
|
|
3227
|
-
Provider: MenuContextProvider
|
|
3228
|
-
} = index.createContextUtilities();
|
|
3229
|
-
const {
|
|
3230
|
-
useContext: useItemContext,
|
|
3231
|
-
Provider: ItemContextProvider
|
|
3232
|
-
} = index.createContextUtilities({});
|
|
3233
|
-
const {
|
|
3234
|
-
useContext: intermediaryUseMenuContext,
|
|
3235
|
-
Provider: IntermediaryMenuContextProvider
|
|
3236
|
-
} = index.createContextUtilities();
|
|
3237
|
-
const PaneContextProvider = _ref => {
|
|
3238
|
+
function createFormInstance(_ref) {
|
|
3238
3239
|
let {
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
children
|
|
3240
|
+
register,
|
|
3241
|
+
getFormState,
|
|
3242
|
+
formRef
|
|
3243
3243
|
} = _ref;
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3244
|
+
const Form = _ref2 => {
|
|
3245
|
+
let {
|
|
3246
|
+
children,
|
|
3247
|
+
...rest
|
|
3248
|
+
} = _ref2;
|
|
3249
|
+
const formState = getFormState();
|
|
3250
|
+
const context = React.useMemo(() => ({
|
|
3251
|
+
register,
|
|
3252
|
+
formState
|
|
3253
|
+
}), [formState]);
|
|
3254
|
+
return /*#__PURE__*/React__default["default"].createElement(index.FormProvider, {
|
|
3255
|
+
value: context
|
|
3256
|
+
}, /*#__PURE__*/React__default["default"].createElement("form", _extends__default["default"]({
|
|
3257
|
+
ref: formRef
|
|
3258
|
+
}, rest), children));
|
|
3259
|
+
};
|
|
3256
3260
|
return {
|
|
3257
|
-
|
|
3258
|
-
...coreContext
|
|
3261
|
+
Form
|
|
3259
3262
|
};
|
|
3260
|
-
}
|
|
3263
|
+
}
|
|
3261
3264
|
|
|
3262
|
-
/* eslint-disable
|
|
3263
|
-
|
|
3264
|
-
var _process$env;
|
|
3265
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
3266
|
+
function useForm(_ref) {
|
|
3265
3267
|
let {
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
onIsOpenChange,
|
|
3269
|
-
isDisabled,
|
|
3270
|
-
children,
|
|
3271
|
-
isVirtualizationDisabled
|
|
3268
|
+
initialValues,
|
|
3269
|
+
validateField
|
|
3272
3270
|
} = _ref;
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
const
|
|
3281
|
-
|
|
3282
|
-
const
|
|
3283
|
-
const
|
|
3284
|
-
const
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3271
|
+
const [formState, setFormState] = React.useState({
|
|
3272
|
+
values: initialValues !== null && initialValues !== void 0 ? initialValues : {},
|
|
3273
|
+
touched: {},
|
|
3274
|
+
errors: {},
|
|
3275
|
+
formError: '',
|
|
3276
|
+
isSubmitting: false
|
|
3277
|
+
});
|
|
3278
|
+
const formStateRef = React.useRef(formState);
|
|
3279
|
+
formStateRef.current = formState;
|
|
3280
|
+
const getFormState = React.useCallback(() => formStateRef.current, []);
|
|
3281
|
+
const formRef = React.useRef(null);
|
|
3282
|
+
const allFieldRefs = React.useRef({});
|
|
3283
|
+
const validateFieldRef = index.useLatest(validateField);
|
|
3284
|
+
const refCallback = React.useCallback(node => {
|
|
3285
|
+
if (!node) return;
|
|
3286
|
+
const fieldName = node.name;
|
|
3287
|
+
if (node.type === 'radio') {
|
|
3288
|
+
const radioNodes = allFieldRefs.current[fieldName];
|
|
3289
|
+
if (radioNodes && Array.isArray(radioNodes)) {
|
|
3290
|
+
allFieldRefs.current[fieldName] = [...radioNodes, node];
|
|
3289
3291
|
} else {
|
|
3290
|
-
|
|
3292
|
+
allFieldRefs.current[fieldName] = [node];
|
|
3291
3293
|
}
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
};
|
|
3295
|
-
|
|
3296
|
-
// Virtuoso and Radix-Dropdown have conflicting ResizeObserver behavior
|
|
3297
|
-
// according to the author of the error, this is not a problem https://stackoverflow.com/a/50387233/9487902
|
|
3298
|
-
// the virtuoso library author recommends this approach for conflicting libraries https://virtuoso.dev/react-beautiful-dnd/
|
|
3299
|
-
index.useEventListener(window, 'error', e => {
|
|
3300
|
-
if (e.message === 'ResizeObserver loop completed with undelivered notifications.' || e.message === 'ResizeObserver loop limit exceeded') {
|
|
3301
|
-
e.stopImmediatePropagation();
|
|
3302
|
-
e.preventDefault();
|
|
3294
|
+
} else {
|
|
3295
|
+
allFieldRefs.current[fieldName] = node;
|
|
3303
3296
|
}
|
|
3304
|
-
});
|
|
3305
|
-
const
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3297
|
+
}, []);
|
|
3298
|
+
const refCallbackCustom = React.useCallback(fieldName => node => {
|
|
3299
|
+
if (!node) return;
|
|
3300
|
+
allFieldRefs.current[fieldName] = node;
|
|
3301
|
+
}, []);
|
|
3302
|
+
const setValue = React.useCallback((name, value) => {
|
|
3303
|
+
setFormState(prevFormState => ({
|
|
3304
|
+
...prevFormState,
|
|
3305
|
+
values: {
|
|
3306
|
+
...prevFormState.values,
|
|
3307
|
+
[name]: value
|
|
3308
|
+
}
|
|
3309
|
+
}));
|
|
3310
|
+
}, [setFormState]);
|
|
3311
|
+
const setTouched = React.useCallback((name, touched) => {
|
|
3312
|
+
setFormState(prevFormState => ({
|
|
3313
|
+
...prevFormState,
|
|
3314
|
+
touched: {
|
|
3315
|
+
...prevFormState.touched,
|
|
3316
|
+
[name]: touched
|
|
3317
|
+
}
|
|
3318
|
+
}));
|
|
3319
|
+
}, [setFormState]);
|
|
3320
|
+
const setError = React.useCallback((name, error) => {
|
|
3321
|
+
setFormState(prevFormState => ({
|
|
3322
|
+
...prevFormState,
|
|
3323
|
+
errors: {
|
|
3324
|
+
...prevFormState.errors,
|
|
3325
|
+
[name]: error
|
|
3326
|
+
}
|
|
3327
|
+
}));
|
|
3328
|
+
}, [setFormState]);
|
|
3329
|
+
const validate = React.useCallback((name, value) => {
|
|
3330
|
+
var _validateFieldRef$cur;
|
|
3331
|
+
const formValues = getFormState().values;
|
|
3332
|
+
const newFormValues = {
|
|
3333
|
+
...formValues,
|
|
3334
|
+
[name]: value
|
|
3335
|
+
};
|
|
3336
|
+
const validationResult = (_validateFieldRef$cur = validateFieldRef.current) === null || _validateFieldRef$cur === void 0 ? void 0 : _validateFieldRef$cur.call(validateFieldRef, name, value, newFormValues);
|
|
3337
|
+
return validationResult;
|
|
3338
|
+
}, [getFormState, validateFieldRef]);
|
|
3339
|
+
const onChange = React.useCallback(event => {
|
|
3340
|
+
const target = event.currentTarget;
|
|
3341
|
+
const fieldName = target.name;
|
|
3342
|
+
const fieldType = target.type;
|
|
3343
|
+
let fieldValue;
|
|
3344
|
+
switch (fieldType) {
|
|
3345
|
+
case 'text':
|
|
3346
|
+
case 'email':
|
|
3347
|
+
case 'password':
|
|
3348
|
+
case 'radio':
|
|
3349
|
+
fieldValue = target.value;
|
|
3350
|
+
break;
|
|
3351
|
+
case 'checkbox':
|
|
3352
|
+
fieldValue = target.checked;
|
|
3353
|
+
break;
|
|
3354
|
+
default:
|
|
3355
|
+
fieldValue = '';
|
|
3356
|
+
break;
|
|
3357
|
+
}
|
|
3358
|
+
if (getFormState().touched[fieldName]) {
|
|
3359
|
+
const error = validate(fieldName, fieldValue);
|
|
3360
|
+
setError(fieldName, error);
|
|
3361
|
+
}
|
|
3362
|
+
setValue(fieldName, fieldValue);
|
|
3363
|
+
}, [setValue, setError, validate, getFormState]);
|
|
3364
|
+
|
|
3365
|
+
// Used for registering components without normal event passing
|
|
3366
|
+
const onChangeCustom = React.useCallback(fieldName => fieldValue => {
|
|
3367
|
+
if (getFormState().touched[fieldName]) {
|
|
3368
|
+
const error = validate(fieldName, fieldValue);
|
|
3369
|
+
setError(fieldName, error);
|
|
3370
|
+
}
|
|
3371
|
+
setValue(fieldName, fieldValue);
|
|
3372
|
+
}, [getFormState, setValue, setError, validate]);
|
|
3373
|
+
const onBlur = React.useCallback(event => {
|
|
3374
|
+
const fieldName = event.target.name;
|
|
3375
|
+
const fieldType = event.target.type;
|
|
3376
|
+
let fieldValue;
|
|
3377
|
+
switch (fieldType) {
|
|
3378
|
+
case 'text':
|
|
3379
|
+
case 'email':
|
|
3380
|
+
case 'password':
|
|
3381
|
+
case 'radio':
|
|
3382
|
+
fieldValue = event.target.value;
|
|
3383
|
+
break;
|
|
3384
|
+
case 'checkbox':
|
|
3385
|
+
fieldValue = event.target.checked;
|
|
3386
|
+
break;
|
|
3387
|
+
default:
|
|
3388
|
+
fieldValue = '';
|
|
3389
|
+
break;
|
|
3390
|
+
}
|
|
3391
|
+
const error = validate(fieldName, fieldValue);
|
|
3392
|
+
setError(fieldName, error);
|
|
3393
|
+
setTouched(fieldName, true);
|
|
3394
|
+
}, [setTouched, setError, validate]);
|
|
3395
|
+
const onBlurCustom = React.useCallback(fieldName => () => {
|
|
3396
|
+
const fieldValue = getFormState().values[fieldName];
|
|
3397
|
+
const error = validate(fieldName, fieldValue);
|
|
3398
|
+
setError(fieldName, error);
|
|
3399
|
+
setTouched(fieldName, true);
|
|
3400
|
+
}, [getFormState, setError, setTouched, validate]);
|
|
3401
|
+
|
|
3402
|
+
// register function types are determined by overloading here
|
|
3403
|
+
|
|
3404
|
+
function internalRegister(name) {
|
|
3405
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
3406
|
+
type: 'text'
|
|
3407
|
+
};
|
|
3408
|
+
const {
|
|
3409
|
+
type
|
|
3410
|
+
} = options;
|
|
3411
|
+
let registerProps;
|
|
3412
|
+
switch (type) {
|
|
3413
|
+
case 'text':
|
|
3414
|
+
case 'email':
|
|
3415
|
+
case 'password':
|
|
3416
|
+
{
|
|
3417
|
+
const defaultValue = getFormState().values[name];
|
|
3418
|
+
registerProps = {
|
|
3419
|
+
name,
|
|
3420
|
+
type,
|
|
3421
|
+
value: defaultValue,
|
|
3422
|
+
onBlur,
|
|
3423
|
+
onChange,
|
|
3424
|
+
ref: refCallback
|
|
3425
|
+
};
|
|
3426
|
+
break;
|
|
3427
|
+
}
|
|
3428
|
+
case 'checkbox':
|
|
3429
|
+
{
|
|
3430
|
+
const defaultChecked = !!getFormState().values[name];
|
|
3431
|
+
registerProps = {
|
|
3432
|
+
name,
|
|
3433
|
+
type,
|
|
3434
|
+
checked: defaultChecked,
|
|
3435
|
+
onBlur,
|
|
3436
|
+
onChange,
|
|
3437
|
+
ref: refCallback
|
|
3438
|
+
};
|
|
3439
|
+
break;
|
|
3440
|
+
}
|
|
3441
|
+
case 'radio':
|
|
3442
|
+
{
|
|
3443
|
+
const {
|
|
3444
|
+
radioValue
|
|
3445
|
+
} = options;
|
|
3446
|
+
const defaultChecked = getFormState().values[name] === radioValue;
|
|
3447
|
+
registerProps = {
|
|
3448
|
+
name,
|
|
3449
|
+
type,
|
|
3450
|
+
value: radioValue,
|
|
3451
|
+
checked: defaultChecked,
|
|
3452
|
+
onBlur,
|
|
3453
|
+
onChange,
|
|
3454
|
+
ref: refCallback
|
|
3455
|
+
};
|
|
3456
|
+
break;
|
|
3457
|
+
}
|
|
3458
|
+
default:
|
|
3459
|
+
{
|
|
3460
|
+
const defaultValue = getFormState().values[name];
|
|
3461
|
+
registerProps = {
|
|
3462
|
+
name,
|
|
3463
|
+
value: defaultValue,
|
|
3464
|
+
onBlur: onBlurCustom(name),
|
|
3465
|
+
onChange: onChangeCustom(name),
|
|
3466
|
+
ref: refCallbackCustom(name)
|
|
3467
|
+
};
|
|
3468
|
+
break;
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3471
|
+
return registerProps;
|
|
3472
|
+
}
|
|
3473
|
+
const register = React.useCallback(internalRegister, [onChange, onChangeCustom, onBlur, onBlurCustom, refCallback, refCallbackCustom, getFormState]);
|
|
3474
|
+
const handleSubmit = React.useCallback(onSubmit => async e => {
|
|
3475
|
+
e.preventDefault(); // prevents page refresh on submit
|
|
3476
|
+
|
|
3477
|
+
const {
|
|
3478
|
+
values
|
|
3479
|
+
} = getFormState();
|
|
3480
|
+
const invalidFieldNames = [];
|
|
3481
|
+
Object.keys(allFieldRefs.current).forEach(fieldName => {
|
|
3482
|
+
const fieldValue = values[fieldName];
|
|
3483
|
+
const error = validate(fieldName, fieldValue);
|
|
3484
|
+
setError(fieldName, error);
|
|
3485
|
+
setTouched(fieldName, true);
|
|
3486
|
+
if (typeof error === 'string') {
|
|
3487
|
+
invalidFieldNames.push(fieldName);
|
|
3488
|
+
}
|
|
3489
|
+
});
|
|
3490
|
+
if (invalidFieldNames.length > 0) {
|
|
3491
|
+
var _allFieldRefs$current;
|
|
3492
|
+
const sorted = [...invalidFieldNames].sort((a, b) => {
|
|
3493
|
+
const fieldA = allFieldRefs.current[a];
|
|
3494
|
+
const fieldB = allFieldRefs.current[b];
|
|
3495
|
+
|
|
3496
|
+
// Radio nodes are as an array within the same key
|
|
3497
|
+
// If node is an array, instead compare based on the first node in the array
|
|
3498
|
+
const nodeA = Array.isArray(fieldA) ? fieldA[0] : fieldA;
|
|
3499
|
+
const nodeB = Array.isArray(fieldB) ? fieldB[0] : fieldB;
|
|
3500
|
+
|
|
3501
|
+
/* eslint-disable no-bitwise */
|
|
3502
|
+
// @ts-ignore
|
|
3503
|
+
return nodeA.compareDocumentPosition(nodeB) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
3504
|
+
});
|
|
3505
|
+
|
|
3506
|
+
// TODO: replace with imperitve focusField function
|
|
3507
|
+
// If first invalid field is a radio, focus the checked input
|
|
3508
|
+
// or the first input if none are checked
|
|
3509
|
+
const firstInvalidField = (_allFieldRefs$current = allFieldRefs.current) === null || _allFieldRefs$current === void 0 ? void 0 : _allFieldRefs$current[sorted[0]];
|
|
3510
|
+
if (Array.isArray(firstInvalidField)) {
|
|
3511
|
+
const checkedRadio = firstInvalidField.find(node => node.checked);
|
|
3512
|
+
if (checkedRadio) checkedRadio.focus();else firstInvalidField[0].focus();
|
|
3513
|
+
} else {
|
|
3514
|
+
firstInvalidField === null || firstInvalidField === void 0 || firstInvalidField.focus();
|
|
3515
|
+
}
|
|
3516
|
+
return;
|
|
3517
|
+
}
|
|
3518
|
+
setFormState(prevFormState => ({
|
|
3519
|
+
...prevFormState,
|
|
3520
|
+
isSubmitting: true
|
|
3521
|
+
}));
|
|
3522
|
+
try {
|
|
3523
|
+
await onSubmit(values, e);
|
|
3524
|
+
setFormState(prevFormState => ({
|
|
3525
|
+
...prevFormState,
|
|
3526
|
+
isSubmitting: false
|
|
3527
|
+
}));
|
|
3528
|
+
} catch (err) {
|
|
3529
|
+
setFormState(prevFormState => ({
|
|
3530
|
+
...prevFormState,
|
|
3531
|
+
isSubmitting: false,
|
|
3532
|
+
formError: err === null || err === void 0 ? void 0 : err.message
|
|
3533
|
+
}));
|
|
3534
|
+
}
|
|
3535
|
+
}, [setError, setTouched, getFormState, setFormState, validate]);
|
|
3536
|
+
const {
|
|
3537
|
+
Form
|
|
3538
|
+
} = React.useMemo(() => createFormInstance({
|
|
3539
|
+
handleSubmit,
|
|
3540
|
+
register,
|
|
3541
|
+
getFormState,
|
|
3542
|
+
setFormState,
|
|
3543
|
+
formRef
|
|
3544
|
+
}), [getFormState, handleSubmit, register, formRef]);
|
|
3545
|
+
return {
|
|
3546
|
+
Form,
|
|
3547
|
+
register,
|
|
3548
|
+
formValues: formState.values,
|
|
3549
|
+
fieldErrors: formState.errors,
|
|
3550
|
+
formError: formState.formError,
|
|
3551
|
+
formTouched: formState.touched,
|
|
3552
|
+
isSubmitting: formState.isSubmitting,
|
|
3553
|
+
handleSubmit
|
|
3554
|
+
};
|
|
3555
|
+
}
|
|
3556
|
+
|
|
3557
|
+
const convertGridTemplateRowsOrColumns = rowsOrColumns => rowsOrColumns && rowsOrColumns.join(' ');
|
|
3558
|
+
const convertGridTemplateAreas = areas => areas.map(row => "\"".concat(row.join(' '), "\"")).join(' ');
|
|
3559
|
+
const LayoutGrid = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
3560
|
+
let {
|
|
3561
|
+
columnGap,
|
|
3562
|
+
rowGap,
|
|
3563
|
+
gap,
|
|
3564
|
+
rowHeights,
|
|
3565
|
+
columnWidths,
|
|
3566
|
+
areas,
|
|
3567
|
+
area,
|
|
3568
|
+
asChild = false,
|
|
3569
|
+
'data-testid': dataTestId,
|
|
3570
|
+
children
|
|
3571
|
+
} = _ref;
|
|
3572
|
+
const calculatedStyle = {
|
|
3573
|
+
display: 'grid',
|
|
3574
|
+
columnGap,
|
|
3575
|
+
rowGap,
|
|
3576
|
+
gridGap: gap,
|
|
3577
|
+
gridTemplateRows: convertGridTemplateRowsOrColumns(rowHeights),
|
|
3578
|
+
gridTemplateColumns: convertGridTemplateRowsOrColumns(columnWidths),
|
|
3579
|
+
gridTemplateAreas: convertGridTemplateAreas(areas),
|
|
3580
|
+
gridArea: area
|
|
3581
|
+
};
|
|
3582
|
+
return /*#__PURE__*/React__default["default"].createElement(GridChildrenWrapper, {
|
|
3583
|
+
asChild: asChild,
|
|
3584
|
+
style: calculatedStyle,
|
|
3585
|
+
"data-testid": dataTestId,
|
|
3586
|
+
ref: ref
|
|
3587
|
+
}, children);
|
|
3588
|
+
});
|
|
3589
|
+
|
|
3590
|
+
const LayoutGridItem = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
3591
|
+
let {
|
|
3592
|
+
area,
|
|
3593
|
+
asChild = false,
|
|
3594
|
+
'data-testid': dataTestId,
|
|
3595
|
+
children
|
|
3596
|
+
} = _ref;
|
|
3597
|
+
const calculatedStyle = {
|
|
3598
|
+
gridArea: area
|
|
3599
|
+
};
|
|
3600
|
+
return /*#__PURE__*/React__default["default"].createElement(GridChildrenWrapper, {
|
|
3601
|
+
asChild: asChild,
|
|
3602
|
+
style: calculatedStyle,
|
|
3603
|
+
"data-testid": dataTestId,
|
|
3604
|
+
ref: ref
|
|
3605
|
+
}, children);
|
|
3606
|
+
});
|
|
3607
|
+
|
|
3608
|
+
const {
|
|
3609
|
+
useContext: useMenuContext,
|
|
3610
|
+
Provider: MenuContextProvider
|
|
3611
|
+
} = index.createContextUtilities();
|
|
3612
|
+
const {
|
|
3613
|
+
useContext: useItemContext,
|
|
3614
|
+
Provider: ItemContextProvider
|
|
3615
|
+
} = index.createContextUtilities({});
|
|
3616
|
+
const {
|
|
3617
|
+
useContext: intermediaryUseMenuContext,
|
|
3618
|
+
Provider: IntermediaryMenuContextProvider
|
|
3619
|
+
} = index.createContextUtilities();
|
|
3620
|
+
const PaneContextProvider = _ref => {
|
|
3621
|
+
let {
|
|
3622
|
+
items,
|
|
3623
|
+
setItems,
|
|
3624
|
+
value,
|
|
3625
|
+
children
|
|
3626
|
+
} = _ref;
|
|
3627
|
+
return /*#__PURE__*/React__default["default"].createElement(index.ChildIndexProvider, {
|
|
3628
|
+
items: items,
|
|
3629
|
+
setItems: setItems
|
|
3630
|
+
}, /*#__PURE__*/React__default["default"].createElement(IntermediaryMenuContextProvider, {
|
|
3631
|
+
value: value
|
|
3632
|
+
}, children));
|
|
3633
|
+
};
|
|
3634
|
+
const usePaneContext = childItemRef => {
|
|
3635
|
+
const coreContext = intermediaryUseMenuContext();
|
|
3636
|
+
const childIndex = index.useChildIndex({
|
|
3637
|
+
element: childItemRef
|
|
3638
|
+
});
|
|
3639
|
+
return {
|
|
3640
|
+
childIndex,
|
|
3641
|
+
...coreContext
|
|
3642
|
+
};
|
|
3643
|
+
};
|
|
3644
|
+
|
|
3645
|
+
/* eslint-disable max-classes-per-file */
|
|
3646
|
+
const Menu = _ref => {
|
|
3647
|
+
var _process$env;
|
|
3648
|
+
let {
|
|
3649
|
+
'data-testid': dataTestId,
|
|
3650
|
+
isOpen,
|
|
3651
|
+
onIsOpenChange,
|
|
3652
|
+
isDisabled,
|
|
3653
|
+
children,
|
|
3654
|
+
isVirtualizationDisabled
|
|
3655
|
+
} = _ref;
|
|
3656
|
+
if (typeof process !== 'undefined' && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) === 'test' && window) {
|
|
3657
|
+
var _window$ResizeObserve, _window$PointerEvent;
|
|
3658
|
+
window.ResizeObserver = (_window$ResizeObserve = window.ResizeObserver) !== null && _window$ResizeObserve !== void 0 ? _window$ResizeObserve : resizeObserver.ResizeObserver;
|
|
3659
|
+
window.PointerEvent = (_window$PointerEvent = window.PointerEvent) !== null && _window$PointerEvent !== void 0 ? _window$PointerEvent : PointerEvent;
|
|
3660
|
+
}
|
|
3661
|
+
const [open, setOpen] = index.useControllableState(isOpen, onIsOpenChange, isOpen);
|
|
3662
|
+
const virtuoso = React.useRef(null);
|
|
3663
|
+
const [maskHeight, setMaskHeight] = React.useState(null);
|
|
3664
|
+
const [maskWidth, setMaskWidth] = React.useState(null);
|
|
3665
|
+
const [submenus, setSubmenus] = React.useState(new Set());
|
|
3666
|
+
const triggerRef = React.useRef(null);
|
|
3667
|
+
const registerSubmenu = (submenuId, submenuIsOpen) => {
|
|
3668
|
+
setSubmenus(subs => {
|
|
3669
|
+
const clone = new Set(subs);
|
|
3670
|
+
if (submenuIsOpen) {
|
|
3671
|
+
clone.add(submenuId);
|
|
3672
|
+
} else {
|
|
3673
|
+
clone.delete(submenuId);
|
|
3674
|
+
}
|
|
3675
|
+
return clone;
|
|
3676
|
+
});
|
|
3677
|
+
};
|
|
3678
|
+
|
|
3679
|
+
// Virtuoso and Radix-Dropdown have conflicting ResizeObserver behavior
|
|
3680
|
+
// according to the author of the error, this is not a problem https://stackoverflow.com/a/50387233/9487902
|
|
3681
|
+
// the virtuoso library author recommends this approach for conflicting libraries https://virtuoso.dev/react-beautiful-dnd/
|
|
3682
|
+
index.useEventListener(window, 'error', e => {
|
|
3683
|
+
if (e.message === 'ResizeObserver loop completed with undelivered notifications.' || e.message === 'ResizeObserver loop limit exceeded') {
|
|
3684
|
+
e.stopImmediatePropagation();
|
|
3685
|
+
e.preventDefault();
|
|
3686
|
+
}
|
|
3687
|
+
});
|
|
3688
|
+
const openPaneDepth = React.useMemo(() => open ? submenus.size + 1 : 0, [submenus, open]);
|
|
3689
|
+
const [searchBarConfigs, setSearchBarConfigs] = React.useState([]);
|
|
3690
|
+
return /*#__PURE__*/React__default["default"].createElement(MenuContextProvider, {
|
|
3691
|
+
value: {
|
|
3692
|
+
dataTestId,
|
|
3693
|
+
isDisabled,
|
|
3694
|
+
openPaneDepth,
|
|
3695
|
+
registerSubmenu,
|
|
3313
3696
|
maskHeight,
|
|
3314
3697
|
setMaskHeight,
|
|
3315
3698
|
open,
|
|
@@ -3338,10 +3721,10 @@ class PointerEvent extends Event {
|
|
|
3338
3721
|
}
|
|
3339
3722
|
}
|
|
3340
3723
|
|
|
3341
|
-
var css_248z$
|
|
3342
|
-
var styles$5 = {"buttonContainer":"
|
|
3343
|
-
var stylesheet$
|
|
3344
|
-
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$
|
|
3724
|
+
var css_248z$6 = "._JzPKZ{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._JzPKZ>._q6pza{cursor:unset;width:100%;height:100%;padding:0 28px 0 12px;border-radius:4px;white-space:nowrap;line-height:20px;font-size:14px;text-align:left;outline:none;border:none;box-shadow:inset 0 0 0 1px #898989;color:#515559;background-color:#fafafa;overflow:hidden;text-overflow:ellipsis}._JzPKZ>._q6pza:hover:not([aria-disabled=true]){background-color:#f5f5f5}._JzPKZ>._q6pza.focus-visible,._JzPKZ>._q6pza:focus-visible{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._JzPKZ>._q6pza+._4U8FO{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._JzPKZ>._q6pza[data-state=open]+._4U8FO{transform:rotate(-180deg) translateY(50%)}._JzPKZ>._q6pza[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._JzPKZ>._q6pza[aria-disabled=true]+._4U8FO{fill:#515559;opacity:.4}._R24FG>[data-radix-popper-content-wrapper]{overflow:hidden;background-color:#fff;max-width:350px;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);border-radius:4px;z-index:var(--mask-z-index)!important;width:var(--mask-width);height:var(--mask-height);transition:height .35s,width .35s}._R24FG>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._jjLLy{margin:0;padding-bottom:var(--flyout-bottom-padding);background:#fff;transition:margin-left .35s,opacity .35s,height .35s,width .35s;opacity:1;max-width:350px;width:-webkit-max-content;width:-moz-max-content;width:max-content;min-width:200px;max-height:var(--flyout-max-height)}._jjLLy ._V4D9n{height:100%;overflow-y:scroll}._jjLLy._SZQCR{margin-left:30px;opacity:0}._jjLLy._wMgQL{margin-left:-30px}._Qq6ps{position:relative;padding:10px 12px;display:flex;flex-direction:row;min-height:40px;align-items:center;cursor:pointer;outline:none;word-break:break-word;font-size:14px;color:#32363a;width:100%}._Qq6ps._Uy4Cq{cursor:unset}._Qq6ps ._oEnlH{fill:#32363a;margin-right:4px}._Qq6ps:focus,._Qq6ps:hover:not(._Qq6ps._Uy4Cq){background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._Qq6ps[aria-disabled=true]{cursor:not-allowed;opacity:.65}._Qq6ps._2pXrP{padding-right:32px}._Qq6ps._2pXrP ._4U8FO{position:absolute;height:100%;right:3px;fill:#515559}._Qq6ps._T7j0r{pointer-events:none}._F-fgA{position:-webkit-sticky;position:sticky;top:0;background-color:#fff;border-bottom:1px solid #e8e8e8}._F-fgA._tR4v6{padding-top:52px}._Ys3hV{pointer-events:none;position:fixed;left:0;top:0;transition:width .35s;min-width:200px;width:var(--mask-width);max-width:350px}._-uV5H{position:absolute;padding:8px;border-radius:4px 4px 0 0;pointer-events:auto;opacity:1;width:100%;transition:opacity .35s,margin-left .35s}._-uV5H._wMgQL{opacity:0}._-uV5H._wMgQL>._7IFWj{margin-left:-30px}._-uV5H._SZQCR{opacity:0}._-uV5H._SZQCR>._7IFWj{margin-left:30px}._-uV5H>._7IFWj{transition:margin-left .35s;width:100%}._-uV5H._T7j0r{pointer-events:none}body.keyboard-user ._Qq6ps:hover:not(:focus){background-color:#fff;box-shadow:none}";
|
|
3725
|
+
var styles$5 = {"buttonContainer":"_JzPKZ","button":"_q6pza","rightIcon":"_4U8FO","maskContainer":"_R24FG","flyout":"_jjLLy","scrollContainer":"_V4D9n","animatedRight":"_SZQCR","animatedLeft":"_wMgQL","menuItem":"_Qq6ps","noItems":"_Uy4Cq","backIcon":"_oEnlH","subMenu":"_2pXrP","unresponsive":"_T7j0r","stickyBox":"_F-fgA","isSearchable":"_tR4v6","searchBoxesContainer":"_Ys3hV","searchBox":"_-uV5H","searchInput":"_7IFWj"};
|
|
3726
|
+
var stylesheet$6="._JzPKZ{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._JzPKZ>._q6pza{cursor:unset;width:100%;height:100%;padding:0 28px 0 12px;border-radius:4px;white-space:nowrap;line-height:20px;font-size:14px;text-align:left;outline:none;border:none;box-shadow:inset 0 0 0 1px #898989;color:#515559;background-color:#fafafa;overflow:hidden;text-overflow:ellipsis}._JzPKZ>._q6pza:hover:not([aria-disabled=true]){background-color:#f5f5f5}._JzPKZ>._q6pza.focus-visible,._JzPKZ>._q6pza:focus-visible{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._JzPKZ>._q6pza+._4U8FO{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._JzPKZ>._q6pza[data-state=open]+._4U8FO{transform:rotate(-180deg) translateY(50%)}._JzPKZ>._q6pza[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._JzPKZ>._q6pza[aria-disabled=true]+._4U8FO{fill:#515559;opacity:.4}._R24FG>[data-radix-popper-content-wrapper]{overflow:hidden;background-color:#fff;max-width:350px;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);border-radius:4px;z-index:var(--mask-z-index)!important;width:var(--mask-width);height:var(--mask-height);transition:height .35s,width .35s}._R24FG>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._jjLLy{margin:0;padding-bottom:var(--flyout-bottom-padding);background:#fff;transition:margin-left .35s,opacity .35s,height .35s,width .35s;opacity:1;max-width:350px;width:-webkit-max-content;width:-moz-max-content;width:max-content;min-width:200px;max-height:var(--flyout-max-height)}._jjLLy ._V4D9n{height:100%;overflow-y:scroll}._jjLLy._SZQCR{margin-left:30px;opacity:0}._jjLLy._wMgQL{margin-left:-30px}._Qq6ps{position:relative;padding:10px 12px;display:flex;flex-direction:row;min-height:40px;align-items:center;cursor:pointer;outline:none;word-break:break-word;font-size:14px;color:#32363a;width:100%}._Qq6ps._Uy4Cq{cursor:unset}._Qq6ps ._oEnlH{fill:#32363a;margin-right:4px}._Qq6ps:focus,._Qq6ps:hover:not(._Qq6ps._Uy4Cq){background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._Qq6ps[aria-disabled=true]{cursor:not-allowed;opacity:.65}._Qq6ps._2pXrP{padding-right:32px}._Qq6ps._2pXrP ._4U8FO{position:absolute;height:100%;right:3px;fill:#515559}._Qq6ps._T7j0r{pointer-events:none}._F-fgA{position:-webkit-sticky;position:sticky;top:0;background-color:#fff;border-bottom:1px solid #e8e8e8}._F-fgA._tR4v6{padding-top:52px}._Ys3hV{pointer-events:none;position:fixed;left:0;top:0;transition:width .35s;min-width:200px;width:var(--mask-width);max-width:350px}._-uV5H{position:absolute;padding:8px;border-radius:4px 4px 0 0;pointer-events:auto;opacity:1;width:100%;transition:opacity .35s,margin-left .35s}._-uV5H._wMgQL{opacity:0}._-uV5H._wMgQL>._7IFWj{margin-left:-30px}._-uV5H._SZQCR{opacity:0}._-uV5H._SZQCR>._7IFWj{margin-left:30px}._-uV5H>._7IFWj{transition:margin-left .35s;width:100%}._-uV5H._T7j0r{pointer-events:none}body.keyboard-user ._Qq6ps:hover:not(:focus){background-color:#fff;box-shadow:none}";
|
|
3727
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$6);}
|
|
3345
3728
|
|
|
3346
3729
|
/* eslint-disable import/prefer-default-export */
|
|
3347
3730
|
const DATA_TESTID_SUFFIXES$1 = {
|
|
@@ -3664,73 +4047,6 @@ const useMutationObserver = (target, options, onMutate) => React.useEffect(() =>
|
|
|
3664
4047
|
return () => observer.disconnect();
|
|
3665
4048
|
}, [target, options, onMutate]);
|
|
3666
4049
|
|
|
3667
|
-
var css_248z$4 = "._SCU-5{background-color:#000;opacity:.5;width:100%;height:100%;position:absolute;top:0;left:0;right:0;bottom:0;display:grid;align-items:left;justify-items:left;place-items:left;overflow-y:auto}._0rcmd{visibility:hidden}";
|
|
3668
|
-
var styles$4 = {"overlay":"_SCU-5","hidden":"_0rcmd"};
|
|
3669
|
-
var stylesheet$4="._SCU-5{background-color:#000;opacity:.5;width:100%;height:100%;position:absolute;top:0;left:0;right:0;bottom:0;display:grid;align-items:left;justify-items:left;place-items:left;overflow-y:auto}._0rcmd{visibility:hidden}";
|
|
3670
|
-
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$4);}
|
|
3671
|
-
|
|
3672
|
-
/**
|
|
3673
|
-
* Adds an overlay to an area that obscures visibility and disables background elements.
|
|
3674
|
-
* @param {MutableRefObject} containerRef - A ref pointing to the DOM element to be filled by the overlay.
|
|
3675
|
-
* @param {boolean} isVisible - When true, displays overlay and disables all element behind it.
|
|
3676
|
-
* @param {React.MouseEventHandler} onClick - A function to be called when the overlay recieves a click event.
|
|
3677
|
-
* @param {string[]} ignoreIds - An array of ids belonging to elements that should not become inert when isInert is true.
|
|
3678
|
-
* @param {CSSProperties['zIndex']} zIndex - The zIndex of the overlay.
|
|
3679
|
-
* @param {string} dataTestId - A string to be added to the overlay element as a data-testid.
|
|
3680
|
-
* @param {number} opacity - The opacity of the overlay.
|
|
3681
|
-
*/
|
|
3682
|
-
const useOverlay = _ref => {
|
|
3683
|
-
let {
|
|
3684
|
-
containerRef,
|
|
3685
|
-
isVisible,
|
|
3686
|
-
onClick,
|
|
3687
|
-
ignoreIds = [],
|
|
3688
|
-
zIndex,
|
|
3689
|
-
dataTestId,
|
|
3690
|
-
opacity
|
|
3691
|
-
} = _ref;
|
|
3692
|
-
const overlayId = index.useId();
|
|
3693
|
-
React.useEffect(() => {
|
|
3694
|
-
var _containerRef$current;
|
|
3695
|
-
const containerNode = (_containerRef$current = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : document.body;
|
|
3696
|
-
const overlay = document.createElement('div');
|
|
3697
|
-
overlay.id = overlayId;
|
|
3698
|
-
overlay.classList.add(styles$4.overlay);
|
|
3699
|
-
if (onClick) overlay.addEventListener('click', onClick);
|
|
3700
|
-
if (dataTestId) overlay.dataset.testid = dataTestId;
|
|
3701
|
-
if (!isVisible) overlay.classList.add(styles$4.hidden);
|
|
3702
|
-
if (zIndex || zIndex === 0) overlay.style.zIndex = zIndex.toString();
|
|
3703
|
-
if (opacity || opacity === 0) overlay.style.opacity = opacity.toString();
|
|
3704
|
-
containerNode.appendChild(overlay);
|
|
3705
|
-
containerNode.style.position = 'relative';
|
|
3706
|
-
return () => {
|
|
3707
|
-
containerNode.style.position = 'static';
|
|
3708
|
-
containerNode.removeChild(overlay);
|
|
3709
|
-
};
|
|
3710
|
-
}, [containerRef, overlayId, isVisible, onClick, dataTestId, zIndex, opacity]);
|
|
3711
|
-
React.useEffect(() => {
|
|
3712
|
-
var _containerRef$current2;
|
|
3713
|
-
const containerNode = (_containerRef$current2 = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _containerRef$current2 !== void 0 ? _containerRef$current2 : document.body;
|
|
3714
|
-
const overlayNode = document.getElementById(overlayId);
|
|
3715
|
-
if (isVisible) {
|
|
3716
|
-
Array.from(containerNode.children).forEach(child => {
|
|
3717
|
-
if (!ignoreIds.includes(child.id) && child.id !== overlayId) child.setAttribute('inert', '');
|
|
3718
|
-
});
|
|
3719
|
-
overlayNode === null || overlayNode === void 0 || overlayNode.classList.remove(styles$4.hidden);
|
|
3720
|
-
} else {
|
|
3721
|
-
Array.from(containerNode.children).forEach(child => {
|
|
3722
|
-
child.removeAttribute('inert');
|
|
3723
|
-
});
|
|
3724
|
-
overlayNode === null || overlayNode === void 0 || overlayNode.classList.add(styles$4.hidden);
|
|
3725
|
-
}
|
|
3726
|
-
return () => {
|
|
3727
|
-
Array.from(containerNode.children).forEach(child => {
|
|
3728
|
-
child.removeAttribute('inert');
|
|
3729
|
-
});
|
|
3730
|
-
};
|
|
3731
|
-
}, [containerRef, isVisible, ignoreIds, overlayId]);
|
|
3732
|
-
};
|
|
3733
|
-
|
|
3734
4050
|
const useCSSVariable = function (name, value) {
|
|
3735
4051
|
let dependencies = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
3736
4052
|
React.useEffect(() => {
|
|
@@ -3820,10 +4136,10 @@ const SubSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
|
|
|
3820
4136
|
}, /*#__PURE__*/React__default["default"].createElement(SubMenu$1, sharedSubMenuProps, children));
|
|
3821
4137
|
});
|
|
3822
4138
|
|
|
3823
|
-
var css_248z$
|
|
3824
|
-
var styles$
|
|
3825
|
-
var stylesheet$
|
|
3826
|
-
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$
|
|
4139
|
+
var css_248z$5 = "._CJ6cu{box-shadow:inset 0 0 0 1px #b00!important}._ao75N{width:unset!important;min-height:unset!important;padding:0!important;margin-right:7px}._LF5DX{background-color:rgba(11,110,208,.08);font-weight:500}";
|
|
4140
|
+
var styles$4 = {"isInvalid":"_CJ6cu","checkbox":"_ao75N","selectedItem":"_LF5DX"};
|
|
4141
|
+
var stylesheet$5="._CJ6cu{box-shadow:inset 0 0 0 1px #b00!important}._ao75N{width:unset!important;min-height:unset!important;padding:0!important;margin-right:7px}._LF5DX{background-color:rgba(11,110,208,.08);font-weight:500}";
|
|
4142
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$5);}
|
|
3827
4143
|
|
|
3828
4144
|
const SelectItem = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
3829
4145
|
let {
|
|
@@ -3847,7 +4163,7 @@ const SelectItem = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
|
|
|
3847
4163
|
};
|
|
3848
4164
|
return /*#__PURE__*/React__default["default"].createElement(MenuItem$1, _extends__default["default"]({}, rest, sharedMenuItemProps, {
|
|
3849
4165
|
className: classNames__default["default"](className, {
|
|
3850
|
-
[styles$
|
|
4166
|
+
[styles$4.selectedItem]: isSelected
|
|
3851
4167
|
}),
|
|
3852
4168
|
asChild: true,
|
|
3853
4169
|
onSelect: () => onItemSelect === null || onItemSelect === void 0 ? void 0 : onItemSelect(value, !isSelected)
|
|
@@ -3856,7 +4172,7 @@ const SelectItem = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
|
|
|
3856
4172
|
role: "treeitem"
|
|
3857
4173
|
}, multiselect ? /*#__PURE__*/React__default["default"].createElement(AdvancedTableCheckbox, {
|
|
3858
4174
|
state: isSelected ? 'true' : 'false',
|
|
3859
|
-
className: styles$
|
|
4175
|
+
className: styles$4.checkbox,
|
|
3860
4176
|
isDisabled: isDisabled
|
|
3861
4177
|
}) : null, children !== null && children !== void 0 ? children : label));
|
|
3862
4178
|
});
|
|
@@ -4099,8 +4415,8 @@ const MenuPane = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
4099
4415
|
// We use the top-level Radix container as a mask. Radix does not expose this container to consumers, except through CSS.
|
|
4100
4416
|
// These hooks dynamically update the style of that container using CSS variables.
|
|
4101
4417
|
useCSSVariable('--mask-z-index', String(zIndex), [open]);
|
|
4102
|
-
useCSSVariable('--mask-width', "".concat(maskWidth, "px"));
|
|
4103
|
-
useCSSVariable('--mask-height', "".concat(maskHeight, "px"));
|
|
4418
|
+
useCSSVariable('--mask-width', Number.isNaN(Number(maskWidth)) ? "".concat(maskWidth) : "".concat(maskWidth, "px"));
|
|
4419
|
+
useCSSVariable('--mask-height', Number.isNaN(Number(maskHeight)) ? "".concat(maskHeight) : "".concat(maskHeight, "px"));
|
|
4104
4420
|
useCSSVariable('--flyout-max-height', "".concat(paneMaxHeight, "px"));
|
|
4105
4421
|
useCSSVariable('--flyout-bottom-padding', "".concat(paneBottomPadding, "px"));
|
|
4106
4422
|
useOverlay({
|
|
@@ -4399,7 +4715,7 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
4399
4715
|
}, /*#__PURE__*/React__default["default"].createElement(reactDropdownMenu.SubTrigger, _extends__default["default"]({
|
|
4400
4716
|
className: classNames__default["default"](styles$5.menuItem, styles$5.subMenu, {
|
|
4401
4717
|
[styles$5.unresponsive]: !paneContainingTriggerIsInteractive,
|
|
4402
|
-
[styles$
|
|
4718
|
+
[styles$4.selectedItem]: triggerCheckedState === 'true' && !isSelectedItems
|
|
4403
4719
|
}),
|
|
4404
4720
|
"data-testid": triggerDataTestId,
|
|
4405
4721
|
"aria-disabled": isDisabled,
|
|
@@ -4428,7 +4744,7 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
4428
4744
|
}
|
|
4429
4745
|
}, subSelectTriggerProps), multiselect && !isSelectedItems ? /*#__PURE__*/React__default["default"].createElement(AdvancedTableCheckbox, {
|
|
4430
4746
|
state: triggerCheckedState,
|
|
4431
|
-
className: styles$
|
|
4747
|
+
className: styles$4.checkbox,
|
|
4432
4748
|
onClick: onTriggerCheckboxSelect,
|
|
4433
4749
|
isDisabled: isDisabled
|
|
4434
4750
|
}) : null, label, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronRightIcon, {
|
|
@@ -4493,804 +4809,585 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
4493
4809
|
});
|
|
4494
4810
|
var SubMenu$1 = SubMenu;
|
|
4495
4811
|
|
|
4496
|
-
var css_248z$
|
|
4497
|
-
var
|
|
4498
|
-
var stylesheet$
|
|
4499
|
-
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$
|
|
4812
|
+
var css_248z$4 = ".Pagination_pagination__1iropsc0{display:flex;align-items:center}.Pagination_pageNumber__1iropsc1{display:inline-flex;align-items:center;font-size:14px;grid-gap:6px;gap:6px;padding:0 6px;color:#32363a;text-align:center}.Pagination_growingInput__1iropsc2{position:relative;display:inline-flex}.Pagination_hidden__1iropsc3{position:absolute;visibility:hidden;padding:8px 12px;border:1px solid transparent}.Pagination_rowCount__1iropsc4{display:inline-flex;align-items:center;grid-gap:6px;gap:6px;font-size:14px;padding:0 6px;color:#32363a}";
|
|
4813
|
+
var Pagination_css_ts_vanilla = {"Pagination_pagination__1iropsc0":"Pagination_pagination__1iropsc0","Pagination_pageNumber__1iropsc1":"Pagination_pageNumber__1iropsc1","Pagination_growingInput__1iropsc2":"Pagination_growingInput__1iropsc2","Pagination_hidden__1iropsc3":"Pagination_hidden__1iropsc3","Pagination_rowCount__1iropsc4":"Pagination_rowCount__1iropsc4"};
|
|
4814
|
+
var stylesheet$4=".Pagination_pagination__1iropsc0{display:flex;align-items:center}.Pagination_pageNumber__1iropsc1{display:inline-flex;align-items:center;font-size:14px;grid-gap:6px;gap:6px;padding:0 6px;color:#32363a;text-align:center}.Pagination_growingInput__1iropsc2{position:relative;display:inline-flex}.Pagination_hidden__1iropsc3{position:absolute;visibility:hidden;padding:8px 12px;border:1px solid transparent}.Pagination_rowCount__1iropsc4{display:inline-flex;align-items:center;grid-gap:6px;gap:6px;font-size:14px;padding:0 6px;color:#32363a}";
|
|
4815
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$4);}
|
|
4500
4816
|
|
|
4501
|
-
|
|
4502
|
-
|
|
4817
|
+
var growingInput = 'Pagination_growingInput__1iropsc2';
|
|
4818
|
+
var hidden = 'Pagination_hidden__1iropsc3';
|
|
4819
|
+
var pageNumber = 'Pagination_pageNumber__1iropsc1';
|
|
4820
|
+
var pagination = 'Pagination_pagination__1iropsc0';
|
|
4821
|
+
var rowCount = 'Pagination_rowCount__1iropsc4';
|
|
4822
|
+
|
|
4823
|
+
const INVALID_INTEGER_INPUT_CHARS = ['-', '+', 'e', '.'];
|
|
4824
|
+
const coalesceIntegerToRange = (value, min, max) => Math.min(Math.max(Math.round(value), min), max);
|
|
4825
|
+
const GrowingIntegerInput = _ref => {
|
|
4503
4826
|
let {
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
zIndex = 1000,
|
|
4510
|
-
elementRefToFocusOnClose,
|
|
4511
|
-
containerRef,
|
|
4512
|
-
'aria-label': ariaLabel,
|
|
4513
|
-
'aria-labelledby': ariaLabelledby,
|
|
4514
|
-
'aria-describedby': ariaDescribedby,
|
|
4515
|
-
'data-testid': dataTestId,
|
|
4516
|
-
children
|
|
4827
|
+
value,
|
|
4828
|
+
onChangeInput,
|
|
4829
|
+
max,
|
|
4830
|
+
min,
|
|
4831
|
+
...rest
|
|
4517
4832
|
} = _ref;
|
|
4518
|
-
|
|
4519
|
-
const [
|
|
4520
|
-
React.
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
const closeButtonAriaLabel = translate('close');
|
|
4533
|
-
const closeButtonRef = React.useRef(null);
|
|
4534
|
-
const close = () => {
|
|
4535
|
-
setIsOpen(false);
|
|
4833
|
+
const [width, setWidth] = React.useState(0);
|
|
4834
|
+
const [internalValue, setInternalValue] = React.useState(value);
|
|
4835
|
+
const [previousExternalValue, setPreviousExternalValue] = React.useState(value);
|
|
4836
|
+
const span = React.useRef(null);
|
|
4837
|
+
if (value !== previousExternalValue) {
|
|
4838
|
+
setPreviousExternalValue(value);
|
|
4839
|
+
setInternalValue(value);
|
|
4840
|
+
}
|
|
4841
|
+
index.useSSRLayoutEffect(() => {
|
|
4842
|
+
var _span$current$offsetW, _span$current;
|
|
4843
|
+
setWidth((_span$current$offsetW = (_span$current = span.current) === null || _span$current === void 0 ? void 0 : _span$current.offsetWidth) !== null && _span$current$offsetW !== void 0 ? _span$current$offsetW : 0);
|
|
4844
|
+
}, [internalValue]);
|
|
4845
|
+
const triggerInternalChange = e => {
|
|
4846
|
+
setInternalValue(coalesceIntegerToRange(Number(e.target.value), Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER));
|
|
4536
4847
|
};
|
|
4537
|
-
const
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4848
|
+
const triggerExternalChange = e => {
|
|
4849
|
+
const maxNumber = Number(max) || Number.MAX_SAFE_INTEGER;
|
|
4850
|
+
const minNumber = Number(min) || Number.MIN_SAFE_INTEGER;
|
|
4851
|
+
const newValue = coalesceIntegerToRange(Number(e.target.value), minNumber, maxNumber);
|
|
4852
|
+
setInternalValue(newValue);
|
|
4853
|
+
onChangeInput(newValue);
|
|
4542
4854
|
};
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
ignoreIds: [drawerId],
|
|
4549
|
-
zIndex: Number(zIndex) - 1,
|
|
4550
|
-
dataTestId: index.getSubDataTestId(dataTestId, 'overlay')
|
|
4551
|
-
});
|
|
4552
|
-
index.useDidUpdate(() => {
|
|
4553
|
-
if (isOpen) {
|
|
4554
|
-
setIsClosing(false);
|
|
4555
|
-
setIsHidden(false);
|
|
4556
|
-
setElementUsedToOpenModal(document.activeElement);
|
|
4557
|
-
} else {
|
|
4558
|
-
var _elementRefToFocusOnC;
|
|
4559
|
-
setIsClosing(true);
|
|
4560
|
-
if (elementRefToFocusOnClose !== undefined) elementRefToFocusOnClose === null || elementRefToFocusOnClose === void 0 || (_elementRefToFocusOnC = elementRefToFocusOnClose.current) === null || _elementRefToFocusOnC === void 0 || _elementRefToFocusOnC.focus();else elementUsedToOpenModal === null || elementUsedToOpenModal === void 0 || elementUsedToOpenModal.focus();
|
|
4561
|
-
}
|
|
4562
|
-
}, [elementRefToFocusOnClose, isOpen]);
|
|
4563
|
-
React.useEffect(() => {
|
|
4564
|
-
if (isOpen && !isHidden) {
|
|
4565
|
-
var _closeButtonRef$curre;
|
|
4566
|
-
(_closeButtonRef$curre = closeButtonRef.current) === null || _closeButtonRef$curre === void 0 || _closeButtonRef$curre.focus();
|
|
4567
|
-
}
|
|
4568
|
-
}, [isOpen, isHidden]);
|
|
4569
|
-
const handleTransitionEnd = () => {
|
|
4570
|
-
if (!isOpen) {
|
|
4571
|
-
setIsClosing(false);
|
|
4572
|
-
setIsHidden(true);
|
|
4855
|
+
const onKeyDownHandler = e => {
|
|
4856
|
+
if (e.key === 'Enter') {
|
|
4857
|
+
triggerExternalChange(e);
|
|
4858
|
+
} else if (INVALID_INTEGER_INPUT_CHARS.includes(e.key)) {
|
|
4859
|
+
e.preventDefault();
|
|
4573
4860
|
}
|
|
4574
4861
|
};
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
className:
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4862
|
+
const displayValue = internalValue.toString();
|
|
4863
|
+
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
4864
|
+
className: growingInput
|
|
4865
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
4866
|
+
className: hidden,
|
|
4867
|
+
ref: span
|
|
4868
|
+
}, displayValue), /*#__PURE__*/React__default["default"].createElement(index.Input$1, _extends__default["default"]({
|
|
4869
|
+
type: "number",
|
|
4870
|
+
value: displayValue,
|
|
4583
4871
|
style: {
|
|
4584
4872
|
width,
|
|
4585
|
-
|
|
4586
|
-
zIndex
|
|
4873
|
+
minWidth: 1
|
|
4587
4874
|
},
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4875
|
+
onChange: triggerInternalChange,
|
|
4876
|
+
onKeyDown: onKeyDownHandler,
|
|
4877
|
+
onBlur: triggerExternalChange
|
|
4878
|
+
}, rest)));
|
|
4879
|
+
};
|
|
4880
|
+
const PageInput = _ref2 => {
|
|
4881
|
+
let {
|
|
4882
|
+
numPages,
|
|
4883
|
+
currentPage,
|
|
4884
|
+
onChange,
|
|
4885
|
+
'aria-label': ariaLabel,
|
|
4886
|
+
disabled,
|
|
4887
|
+
'data-testid': dataTestId
|
|
4888
|
+
} = _ref2;
|
|
4889
|
+
const delegatedInput = /*#__PURE__*/React__default["default"].createElement(GrowingIntegerInput, {
|
|
4890
|
+
max: numPages !== null && numPages !== void 0 ? numPages : undefined,
|
|
4891
|
+
min: 1,
|
|
4892
|
+
disabled: disabled,
|
|
4893
|
+
key: "currentPage",
|
|
4894
|
+
value: currentPage,
|
|
4591
4895
|
"aria-label": ariaLabel,
|
|
4592
|
-
|
|
4593
|
-
"
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
onClick: close,
|
|
4605
|
-
ref: closeButtonRef,
|
|
4606
|
-
"data-testid": index.getSubDataTestId(dataTestId, 'close-button'),
|
|
4607
|
-
"aria-label": closeButtonAriaLabel
|
|
4608
|
-
}, /*#__PURE__*/React__default["default"].createElement(icons_index.CloseIcon, null))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4609
|
-
"data-testid": index.getSubDataTestId(dataTestId, 'body')
|
|
4610
|
-
}, children))), (_containerRef$current = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : document.body) : null;
|
|
4896
|
+
onChangeInput: onChange,
|
|
4897
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'input')
|
|
4898
|
+
});
|
|
4899
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4900
|
+
className: pageNumber
|
|
4901
|
+
}, numPages ? /*#__PURE__*/React__default["default"].createElement(index.Translate, {
|
|
4902
|
+
messageKey: "pagination",
|
|
4903
|
+
placeholders: {
|
|
4904
|
+
currentPage: delegatedInput,
|
|
4905
|
+
numPages
|
|
4906
|
+
}
|
|
4907
|
+
}) : delegatedInput);
|
|
4611
4908
|
};
|
|
4612
|
-
|
|
4613
|
-
var css_248z$1 = "._-XGwZ{display:inline-block;position:relative}._-XGwZ ._OU704{width:120px}._-XGwZ ._OU704 ._mmYLw._i279p{transform:rotate(-180deg)}._-XGwZ ._OU704 ._mmYLw._oJr2x{fill:#9d9fa1;opacity:.4}._-XGwZ ._PjBqH>input:focus{box-shadow:none!important;border:1px solid #898989!important}._-XGwZ ._mmYLw{position:absolute;right:4px;bottom:4px;height:28px;width:28px}._-XGwZ ._mmYLw._i279p{transform:rotate(-180deg)}._UdgQs{width:120px}._UdgQs ._qv-IY._lV6up{background-color:#efefef;border-radius:6px}";
|
|
4614
|
-
var styles$1 = {"timePickerContainer":"_-XGwZ","input":"_OU704","icon":"_mmYLw","open":"_i279p","disabled":"_oJr2x","ignoreFocusStyle":"_PjBqH","timePickerFlyout":"_UdgQs","option":"_qv-IY","exactMatch":"_lV6up"};
|
|
4615
|
-
var stylesheet$1="._-XGwZ{display:inline-block;position:relative}._-XGwZ ._OU704{width:120px}._-XGwZ ._OU704 ._mmYLw._i279p{transform:rotate(-180deg)}._-XGwZ ._OU704 ._mmYLw._oJr2x{fill:#9d9fa1;opacity:.4}._-XGwZ ._PjBqH>input:focus{box-shadow:none!important;border:1px solid #898989!important}._-XGwZ ._mmYLw{position:absolute;right:4px;bottom:4px;height:28px;width:28px}._-XGwZ ._mmYLw._i279p{transform:rotate(-180deg)}._UdgQs{width:120px}._UdgQs ._qv-IY._lV6up{background-color:#efefef;border-radius:6px}";
|
|
4616
|
-
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$1);}
|
|
4617
|
-
|
|
4618
|
-
const TimeDropdown = _ref => {
|
|
4909
|
+
const Pagination = _ref3 => {
|
|
4619
4910
|
let {
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
dataTestId
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
if (
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
const {
|
|
4641
|
-
parentNode
|
|
4642
|
-
} = nodeToScrollTo;
|
|
4643
|
-
parentNode.scrollTop = nodeToScrollTo.offsetTop;
|
|
4644
|
-
}
|
|
4911
|
+
hidePageNumber = false,
|
|
4912
|
+
hideFirstAndLastButtons = false,
|
|
4913
|
+
numPages,
|
|
4914
|
+
currentPage,
|
|
4915
|
+
onPageChange,
|
|
4916
|
+
isDisabled = false,
|
|
4917
|
+
'data-testid': dataTestId
|
|
4918
|
+
} = _ref3;
|
|
4919
|
+
const {
|
|
4920
|
+
translate
|
|
4921
|
+
} = index.useTranslation();
|
|
4922
|
+
const announceToScreenReader = index.useScreenReaderAnnouncement('polite');
|
|
4923
|
+
index.useDidUpdate(() => {
|
|
4924
|
+
let messageKey = 'currentPageNumber';
|
|
4925
|
+
const placeholders = {
|
|
4926
|
+
currentPage
|
|
4927
|
+
};
|
|
4928
|
+
if (numPages) {
|
|
4929
|
+
messageKey = 'currentPageNumberOf';
|
|
4930
|
+
placeholders.numPages = numPages;
|
|
4645
4931
|
}
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
[styles$1.exactMatch]: (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.index) === index$1 && scrolledToItem.isExactMatch && !isOptionHovered
|
|
4680
|
-
})
|
|
4681
|
-
}, item.label))),
|
|
4682
|
-
anchorNode: inputRef.current,
|
|
4683
|
-
modifiers: [{
|
|
4684
|
-
name: 'offset',
|
|
4685
|
-
options: {
|
|
4686
|
-
offset: [0, 5]
|
|
4687
|
-
}
|
|
4688
|
-
}]
|
|
4689
|
-
});
|
|
4932
|
+
announceToScreenReader(translate(messageKey, placeholders));
|
|
4933
|
+
}, [announceToScreenReader, translate, currentPage, numPages]);
|
|
4934
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4935
|
+
className: pagination,
|
|
4936
|
+
"data-testid": dataTestId
|
|
4937
|
+
}, !hideFirstAndLastButtons && numPages && /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
4938
|
+
"aria-label": translate('firstPage'),
|
|
4939
|
+
onClick: () => onPageChange(1),
|
|
4940
|
+
disabled: isDisabled || currentPage <= 1,
|
|
4941
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'first-page')
|
|
4942
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronSkipBackIcon, null)), /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
4943
|
+
"aria-label": translate('previousPage'),
|
|
4944
|
+
disabled: isDisabled || currentPage <= 1,
|
|
4945
|
+
onClick: () => onPageChange(currentPage - 1),
|
|
4946
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'previous-page')
|
|
4947
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronLeftIcon, null)), !hidePageNumber && /*#__PURE__*/React__default["default"].createElement(PageInput, {
|
|
4948
|
+
"aria-label": translate('currentPage'),
|
|
4949
|
+
currentPage: currentPage,
|
|
4950
|
+
numPages: numPages,
|
|
4951
|
+
onChange: onPageChange,
|
|
4952
|
+
disabled: isDisabled || numPages === 1,
|
|
4953
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'current-page')
|
|
4954
|
+
}), /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
4955
|
+
"aria-label": translate('nextPage'),
|
|
4956
|
+
disabled: isDisabled || numPages !== undefined && currentPage >= numPages,
|
|
4957
|
+
onClick: () => onPageChange(currentPage + 1),
|
|
4958
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'next-page')
|
|
4959
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronRightIcon, null)), !hideFirstAndLastButtons && numPages && /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
4960
|
+
"aria-label": translate('lastPage'),
|
|
4961
|
+
disabled: isDisabled || currentPage >= numPages,
|
|
4962
|
+
onClick: () => onPageChange(numPages),
|
|
4963
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'last-page')
|
|
4964
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronSkipForwardIcon, null)));
|
|
4690
4965
|
};
|
|
4691
4966
|
|
|
4692
|
-
const
|
|
4967
|
+
const SelectPane = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
4968
|
+
let {
|
|
4969
|
+
children,
|
|
4970
|
+
isSearchable,
|
|
4971
|
+
placement,
|
|
4972
|
+
showSelectedItemsPane = false,
|
|
4973
|
+
searchValue,
|
|
4974
|
+
onSearchValueChange,
|
|
4975
|
+
isSearchFilteringDisabled,
|
|
4976
|
+
zIndex,
|
|
4977
|
+
...rest
|
|
4978
|
+
} = _ref;
|
|
4979
|
+
const selectContext = useSelectContext();
|
|
4693
4980
|
const {
|
|
4694
|
-
|
|
4695
|
-
} =
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
}
|
|
4705
|
-
return dateWithLeadingZeros.toLowerCase();
|
|
4706
|
-
};
|
|
4707
|
-
const convertTimeObjectToTimeString = (time, is24HourClock) => {
|
|
4708
|
-
const date = Date.UTC(2000, 0, 0, time.hour, time.minute);
|
|
4709
|
-
return formatUtcDate(date, is24HourClock);
|
|
4710
|
-
};
|
|
4711
|
-
const convertTimeStringToTimeObject = completeTimeString => {
|
|
4712
|
-
const [hourPart, minutePart, amPmPart] = completeTimeString.split(/:| /);
|
|
4713
|
-
let hour = +hourPart;
|
|
4714
|
-
const minute = +minutePart;
|
|
4715
|
-
if (amPmPart === 'am' && hour === 12) {
|
|
4716
|
-
hour = 0;
|
|
4717
|
-
} else if (amPmPart === 'pm' && hour < 12) {
|
|
4718
|
-
hour += 12;
|
|
4719
|
-
}
|
|
4720
|
-
return {
|
|
4721
|
-
hour,
|
|
4722
|
-
minute
|
|
4981
|
+
multiselect
|
|
4982
|
+
} = selectContext;
|
|
4983
|
+
const sharedMenuProps = {
|
|
4984
|
+
placement,
|
|
4985
|
+
isSearchable,
|
|
4986
|
+
searchValue,
|
|
4987
|
+
onSearchValueChange,
|
|
4988
|
+
isSearchFilteringDisabled,
|
|
4989
|
+
zIndex,
|
|
4990
|
+
ref
|
|
4723
4991
|
};
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
const labelWithLeadingZeros = formatUtcDate(Date.UTC(2000, 0, 1, 0, 0, i * step, 0), is24HourClock);
|
|
4729
|
-
return {
|
|
4730
|
-
label: labelWithLeadingZeros,
|
|
4731
|
-
value: i * step,
|
|
4732
|
-
id: "time-option-".concat(i)
|
|
4733
|
-
};
|
|
4734
|
-
});
|
|
4735
|
-
};
|
|
4736
|
-
function getTimeStringCorrector(str, is24HourClock) {
|
|
4737
|
-
var _letterString;
|
|
4738
|
-
let [numberString, letterString] = str.replace(':', '').split(' ');
|
|
4739
|
-
letterString = (_letterString = letterString) === null || _letterString === void 0 ? void 0 : _letterString.toLowerCase();
|
|
4740
|
-
let selectionModifier = 0;
|
|
4741
|
-
const getTimeString = () => {
|
|
4742
|
-
const finalNumberString = "".concat(numberString.slice(0, 2), ":").concat(numberString.slice(2, 4));
|
|
4743
|
-
return is24HourClock ? finalNumberString : "".concat(finalNumberString, " ").concat(letterString);
|
|
4744
|
-
};
|
|
4745
|
-
const getSelectionModifier = () => selectionModifier;
|
|
4746
|
-
const replaceDashes = () => {
|
|
4747
|
-
numberString = numberString.replace(/-/g, '0');
|
|
4748
|
-
if (letterString) {
|
|
4749
|
-
if (letterString[0] === '-' || letterString[0] === 'a') {
|
|
4750
|
-
// Arbitrarily choose AM if user hasn't typed 'a' or 'p'
|
|
4751
|
-
letterString = 'am';
|
|
4752
|
-
} else {
|
|
4753
|
-
letterString = 'pm';
|
|
4754
|
-
}
|
|
4992
|
+
return /*#__PURE__*/React__default["default"].createElement(SelectContextProvider, {
|
|
4993
|
+
value: {
|
|
4994
|
+
...selectContext,
|
|
4995
|
+
showSelectedItemsPane
|
|
4755
4996
|
}
|
|
4756
|
-
}
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
};
|
|
4768
|
-
const clearSecondHoursDigit = () => {
|
|
4769
|
-
numberString = "".concat(numberString.slice(0, 1), "0").concat(numberString.slice(2));
|
|
4770
|
-
};
|
|
4771
|
-
const hoursAre00 = () => numberString[0] === '0' && numberString[1] === '0';
|
|
4772
|
-
const firstHourGreaterThan1 = () => !'01-'.includes(numberString[0]);
|
|
4773
|
-
const firstHourGreaterThan2 = () => !'012-'.includes(numberString[0]);
|
|
4774
|
-
const hoursGreaterThan12 = () => numberString[0] === '1' && !'012-'.includes(numberString[1]);
|
|
4775
|
-
const hoursGreaterThan23 = () => numberString[0] === '2' && !'0123-'.includes(numberString[1]);
|
|
4776
|
-
const firstMinuteGreaterThan5 = () => numberString[2] !== '-' && +numberString[2] > 5;
|
|
4777
|
-
const hasTypedMinutes = () => numberString[2] !== '-' && numberString[3] !== '-';
|
|
4778
|
-
return {
|
|
4779
|
-
getTimeString,
|
|
4780
|
-
getSelectionModifier,
|
|
4781
|
-
replaceDashes,
|
|
4782
|
-
setHoursTo12,
|
|
4783
|
-
clearSecondHoursDigit,
|
|
4784
|
-
shiftMinutesRight,
|
|
4785
|
-
prependCharacter,
|
|
4786
|
-
hoursAre00,
|
|
4787
|
-
firstHourGreaterThan1,
|
|
4788
|
-
firstHourGreaterThan2,
|
|
4789
|
-
hoursGreaterThan12,
|
|
4790
|
-
hoursGreaterThan23,
|
|
4791
|
-
firstMinuteGreaterThan5,
|
|
4792
|
-
hasTypedMinutes
|
|
4793
|
-
};
|
|
4794
|
-
}
|
|
4795
|
-
const correct12HourTime = (time, mustCompleteTime) => {
|
|
4796
|
-
const timeStringCorrector = getTimeStringCorrector(time, false);
|
|
4797
|
-
if (mustCompleteTime) {
|
|
4798
|
-
timeStringCorrector.replaceDashes();
|
|
4799
|
-
}
|
|
4800
|
-
if (timeStringCorrector.firstHourGreaterThan1()) {
|
|
4801
|
-
timeStringCorrector.prependCharacter('0');
|
|
4997
|
+
}, /*#__PURE__*/React__default["default"].createElement(MenuPane, _extends__default["default"]({}, rest, sharedMenuProps, {
|
|
4998
|
+
"aria-multiselectable": Boolean(multiselect),
|
|
4999
|
+
role: "tree"
|
|
5000
|
+
}), children));
|
|
5001
|
+
});
|
|
5002
|
+
|
|
5003
|
+
const GetSelectItemsFrom = function (startingChildren) {
|
|
5004
|
+
let filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
5005
|
+
const current = [];
|
|
5006
|
+
if (!startingChildren) {
|
|
5007
|
+
return current;
|
|
4802
5008
|
}
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
// probably are about to fix up the second digit. We'll set it to 0
|
|
4808
|
-
timeStringCorrector.clearSecondHoursDigit();
|
|
4809
|
-
} else {
|
|
4810
|
-
// Assume the user forgot a leading 0
|
|
4811
|
-
// Example: we are changing '13:--' to '01:3-'
|
|
4812
|
-
timeStringCorrector.prependCharacter('0');
|
|
5009
|
+
const childrenArray = Array.isArray(startingChildren) ? startingChildren : [startingChildren];
|
|
5010
|
+
childrenArray.forEach(child => {
|
|
5011
|
+
if (filter && !filter(child.props)) {
|
|
5012
|
+
return;
|
|
4813
5013
|
}
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
correctedTime: timeStringCorrector.getTimeString(),
|
|
4825
|
-
selectionModifier: timeStringCorrector.getSelectionModifier()
|
|
4826
|
-
};
|
|
4827
|
-
};
|
|
4828
|
-
const correct24HourTime = (time, mustCompleteTime) => {
|
|
4829
|
-
const timeStringCorrector = getTimeStringCorrector(time, true);
|
|
4830
|
-
if (mustCompleteTime) {
|
|
4831
|
-
timeStringCorrector.replaceDashes();
|
|
4832
|
-
}
|
|
4833
|
-
if (timeStringCorrector.hoursGreaterThan23()) {
|
|
4834
|
-
// User likely just edited the first digit and that made the second
|
|
4835
|
-
// digit invalid, e.g., changed '15:' to '25:'. They probably
|
|
4836
|
-
// are about to fix up the second digit. We'll set it to 0
|
|
4837
|
-
if (timeStringCorrector.hasTypedMinutes()) {
|
|
4838
|
-
timeStringCorrector.clearSecondHoursDigit();
|
|
4839
|
-
} else {
|
|
4840
|
-
// Assume the user forgot a leading 0
|
|
4841
|
-
// Example: we are changing '25:--' to '02:5-'
|
|
4842
|
-
timeStringCorrector.prependCharacter('0');
|
|
5014
|
+
if (child.type === SelectItem) {
|
|
5015
|
+
const {
|
|
5016
|
+
label,
|
|
5017
|
+
value: childValue,
|
|
5018
|
+
children: childChildren
|
|
5019
|
+
} = child.props;
|
|
5020
|
+
const safeLabel = label !== null && label !== void 0 ? label : ['string', 'number'].includes(typeof childChildren) ? childChildren : undefined;
|
|
5021
|
+
current.push([childValue, safeLabel]);
|
|
5022
|
+
} else if (child.type === SubSelect) {
|
|
5023
|
+
current.push(...GetSelectItemsFrom(child.props.children, filter));
|
|
4843
5024
|
}
|
|
4844
|
-
}
|
|
4845
|
-
|
|
4846
|
-
// Assume the user forgot a leading 0
|
|
4847
|
-
// Example: we are changing '3-:--' to '03:--'
|
|
4848
|
-
timeStringCorrector.prependCharacter('0');
|
|
4849
|
-
}
|
|
4850
|
-
if (timeStringCorrector.firstMinuteGreaterThan5()) {
|
|
4851
|
-
// Assume the user forgot a 0
|
|
4852
|
-
// Example: we are changing 12:6- to 12:06
|
|
4853
|
-
timeStringCorrector.shiftMinutesRight();
|
|
4854
|
-
}
|
|
4855
|
-
return {
|
|
4856
|
-
correctedTime: timeStringCorrector.getTimeString(),
|
|
4857
|
-
selectionModifier: timeStringCorrector.getSelectionModifier()
|
|
4858
|
-
};
|
|
5025
|
+
});
|
|
5026
|
+
return current;
|
|
4859
5027
|
};
|
|
4860
|
-
|
|
4861
|
-
// We will follow the same process to correct the time regardless
|
|
4862
|
-
// of what specific character changed.
|
|
4863
|
-
// This simplifies logic for when multiple chars are pasted in
|
|
4864
|
-
// and for when the input has to be shifted due to invalid entries.
|
|
4865
|
-
const correctTime = (time, is24HourClock, mustCompleteTime) => is24HourClock ? correct24HourTime(time, mustCompleteTime) : correct12HourTime(time, mustCompleteTime);
|
|
4866
|
-
|
|
4867
|
-
const TimeInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
5028
|
+
const Select = _ref => {
|
|
4868
5029
|
let {
|
|
5030
|
+
multiselect,
|
|
5031
|
+
children,
|
|
5032
|
+
isDisabled,
|
|
4869
5033
|
onChange,
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
setIsFlyoutOpen,
|
|
4874
|
-
setShouldMoveSelectionToEnd,
|
|
4875
|
-
shouldMoveSelectionToEnd,
|
|
5034
|
+
isOpen,
|
|
5035
|
+
onIsOpenChange,
|
|
5036
|
+
value,
|
|
4876
5037
|
isInvalid,
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
id,
|
|
4880
|
-
dataTestId,
|
|
4881
|
-
ariaControls,
|
|
4882
|
-
ariaActiveDescendant,
|
|
4883
|
-
ariaLabel,
|
|
4884
|
-
ariaLabelledBy,
|
|
4885
|
-
ariaDescribedBy,
|
|
4886
|
-
isOptionHovered
|
|
5038
|
+
'data-testid': dataTestId,
|
|
5039
|
+
isVirtualizationDisabled
|
|
4887
5040
|
} = _ref;
|
|
4888
|
-
const
|
|
4889
|
-
const
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
maskChar: "-",
|
|
4902
|
-
mask: mask,
|
|
4903
|
-
beforeMaskedValueChange: next => {
|
|
4904
|
-
const {
|
|
4905
|
-
correctedTime,
|
|
4906
|
-
selectionModifier
|
|
4907
|
-
} = correctTime(next.value, is24HourClock, false);
|
|
4908
|
-
const newSelection = next === null || next === void 0 ? void 0 : next.selection;
|
|
4909
|
-
if (newSelection) {
|
|
4910
|
-
const validTimeLength = mask.length;
|
|
4911
|
-
newSelection.start = shouldMoveSelectionToEnd ? validTimeLength : newSelection.start;
|
|
4912
|
-
newSelection.end = shouldMoveSelectionToEnd ? validTimeLength : newSelection.end;
|
|
4913
|
-
newSelection.start = Math.min(newSelection.start + selectionModifier, validTimeLength);
|
|
4914
|
-
newSelection.end = Math.min(newSelection.end + selectionModifier, validTimeLength);
|
|
4915
|
-
}
|
|
4916
|
-
setShouldMoveSelectionToEnd(false);
|
|
4917
|
-
return {
|
|
4918
|
-
...next,
|
|
4919
|
-
value: correctedTime,
|
|
4920
|
-
selection: newSelection
|
|
4921
|
-
};
|
|
5041
|
+
const [selectedValues, setSelectedValues] = index.useControllableState(value, onChange, value);
|
|
5042
|
+
const selectPaneChildren = React.useMemo(() => {
|
|
5043
|
+
var _children$find;
|
|
5044
|
+
return Array.isArray(children) ? (_children$find = children.find(child => child.type === SelectPane)) === null || _children$find === void 0 ? void 0 : _children$find.props.children : null;
|
|
5045
|
+
}, [children]);
|
|
5046
|
+
const selectedSelectItems = React.useMemo(() => {
|
|
5047
|
+
if (Array.isArray(selectedValues)) {
|
|
5048
|
+
return new Map(GetSelectItemsFrom(selectPaneChildren, _ref2 => {
|
|
5049
|
+
let {
|
|
5050
|
+
value: _value
|
|
5051
|
+
} = _ref2;
|
|
5052
|
+
return _value == null || selectedValues.includes(_value);
|
|
5053
|
+
}));
|
|
4922
5054
|
}
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
5055
|
+
return new Map(GetSelectItemsFrom(selectPaneChildren, _ref3 => {
|
|
5056
|
+
let {
|
|
5057
|
+
value: _value
|
|
5058
|
+
} = _ref3;
|
|
5059
|
+
return _value == null || selectedValues === _value;
|
|
5060
|
+
}));
|
|
5061
|
+
}, [selectedValues, selectPaneChildren]);
|
|
5062
|
+
const enabledSelectItems = React.useMemo(() => new Map(GetSelectItemsFrom(selectPaneChildren, _ref4 => {
|
|
5063
|
+
let {
|
|
5064
|
+
isDisabled: _isDisabled
|
|
5065
|
+
} = _ref4;
|
|
5066
|
+
return !_isDisabled;
|
|
5067
|
+
})), [selectPaneChildren]);
|
|
5068
|
+
const onItemSelect = React.useCallback((_value, isSelected) => {
|
|
5069
|
+
setSelectedValues(currentSelectedValues => {
|
|
5070
|
+
if (multiselect) {
|
|
5071
|
+
if (Array.isArray(currentSelectedValues)) {
|
|
5072
|
+
const clone = new Set(currentSelectedValues);
|
|
5073
|
+
if (isSelected) {
|
|
5074
|
+
clone.add(_value);
|
|
5075
|
+
} else {
|
|
5076
|
+
clone.delete(_value);
|
|
5077
|
+
}
|
|
5078
|
+
return Array.from(clone);
|
|
5079
|
+
}
|
|
5080
|
+
if (isSelected) {
|
|
5081
|
+
return [_value];
|
|
5082
|
+
}
|
|
5083
|
+
} else if (isSelected) {
|
|
5084
|
+
return _value;
|
|
5085
|
+
}
|
|
5086
|
+
return currentSelectedValues;
|
|
5087
|
+
});
|
|
5088
|
+
}, [setSelectedValues, multiselect]);
|
|
5089
|
+
const sharedMenuProps = {
|
|
5090
|
+
isDisabled,
|
|
5091
|
+
isOpen,
|
|
5092
|
+
onIsOpenChange,
|
|
5093
|
+
'data-testid': dataTestId,
|
|
5094
|
+
isVirtualizationDisabled
|
|
5095
|
+
};
|
|
5096
|
+
return /*#__PURE__*/React__default["default"].createElement(SelectContextProvider, {
|
|
5097
|
+
value: {
|
|
5098
|
+
multiselect,
|
|
5099
|
+
onItemSelect,
|
|
5100
|
+
selectedValues,
|
|
5101
|
+
selectedSelectItems,
|
|
5102
|
+
GetSelectItemsFrom,
|
|
5103
|
+
isInvalid,
|
|
5104
|
+
setSelectedValues,
|
|
5105
|
+
enabledSelectItems
|
|
5106
|
+
}
|
|
5107
|
+
}, /*#__PURE__*/React__default["default"].createElement(Menu, sharedMenuProps, children));
|
|
5108
|
+
};
|
|
4943
5109
|
|
|
4944
|
-
const
|
|
5110
|
+
const SelectButton = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
4945
5111
|
let {
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
inputRef
|
|
5112
|
+
children,
|
|
5113
|
+
asChild,
|
|
5114
|
+
placeholder: externalPlaceholder,
|
|
5115
|
+
...rest
|
|
4951
5116
|
} = _ref;
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
5117
|
+
const {
|
|
5118
|
+
selectedSelectItems,
|
|
5119
|
+
isInvalid,
|
|
5120
|
+
multiselect
|
|
5121
|
+
} = useSelectContext();
|
|
5122
|
+
const {
|
|
5123
|
+
translate
|
|
5124
|
+
} = index.useTranslation();
|
|
5125
|
+
const placeholder = externalPlaceholder !== null && externalPlaceholder !== void 0 ? externalPlaceholder : multiselect ? translate('selectOneOrMore') : translate('selectOne');
|
|
5126
|
+
const selectedItemsString = React.useMemo(() => Array.from(selectedSelectItems)
|
|
5127
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5128
|
+
.map(_ref2 => {
|
|
5129
|
+
let [value, label] = _ref2;
|
|
5130
|
+
return label;
|
|
5131
|
+
}).join(', '), [selectedSelectItems]);
|
|
5132
|
+
const sharedMenuButtonProps = {
|
|
5133
|
+
ref,
|
|
5134
|
+
asChild
|
|
5135
|
+
};
|
|
5136
|
+
return /*#__PURE__*/React__default["default"].createElement(MenuButton, _extends__default["default"]({}, rest, sharedMenuButtonProps, {
|
|
5137
|
+
"aria-haspopup": "tree",
|
|
5138
|
+
role: "combobox",
|
|
5139
|
+
className: classNames__default["default"]({
|
|
5140
|
+
[styles$4.isInvalid]: isInvalid
|
|
4958
5141
|
})
|
|
4959
|
-
},
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
5142
|
+
}), children !== null && children !== void 0 ? children : selectedSelectItems !== null && selectedSelectItems !== void 0 && selectedSelectItems.size ? selectedItemsString : placeholder);
|
|
5143
|
+
});
|
|
5144
|
+
|
|
5145
|
+
const RowDisplayCount = _ref => {
|
|
5146
|
+
let {
|
|
5147
|
+
'data-testid': dataTestId,
|
|
5148
|
+
displayCount,
|
|
5149
|
+
displayCountOptions,
|
|
5150
|
+
onDisplayCountChange,
|
|
5151
|
+
isDisabled = false
|
|
5152
|
+
} = _ref;
|
|
5153
|
+
const displayCountSelect = /*#__PURE__*/React__default["default"].createElement(Select, {
|
|
5154
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'select'),
|
|
5155
|
+
isDisabled: isDisabled,
|
|
5156
|
+
value: displayCount,
|
|
5157
|
+
onChange: onDisplayCountChange,
|
|
5158
|
+
key: "displayCountSelect"
|
|
5159
|
+
}, /*#__PURE__*/React__default["default"].createElement(SelectButton, null), /*#__PURE__*/React__default["default"].createElement(SelectPane, {
|
|
5160
|
+
style: {
|
|
5161
|
+
minWidth: 'var(--radix-dropdown-menu-trigger-width)'
|
|
5162
|
+
}
|
|
5163
|
+
}, displayCountOptions === null || displayCountOptions === void 0 ? void 0 : displayCountOptions.map(option => /*#__PURE__*/React__default["default"].createElement(SelectItem, {
|
|
5164
|
+
value: option,
|
|
5165
|
+
label: "".concat(option),
|
|
5166
|
+
key: option
|
|
5167
|
+
}))));
|
|
5168
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5169
|
+
className: rowCount,
|
|
5170
|
+
"data-testid": dataTestId
|
|
5171
|
+
}, /*#__PURE__*/React__default["default"].createElement(index.Translate, {
|
|
5172
|
+
messageKey: "rowDisplayCount",
|
|
5173
|
+
placeholders: {
|
|
5174
|
+
select: displayCountSelect
|
|
5175
|
+
}
|
|
4967
5176
|
}));
|
|
4968
5177
|
};
|
|
4969
5178
|
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
minute
|
|
4977
|
-
};
|
|
4978
|
-
})();
|
|
4979
|
-
const TimePicker = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
5179
|
+
var css_248z$3 = "._ex4kH input{padding-left:76px!important}._XLcmY input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._XLcmY input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._XLcmY input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._CEWCL{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._CEWCL,._CEWCL._XLcmY:hover{background-color:transparent!important}._CEWCL:hover{background-color:rgba(50,54,58,.08)!important}._CEWCL:active{background-color:rgba(50,54,58,.11)!important}._CEWCL svg{top:2px!important}._e48CZ{position:relative}._Hpw0X{position:absolute;top:18px;left:12px;line-height:0;font-size:14px;color:#32363a;z-index:101;pointer-events:none}";
|
|
5180
|
+
var styles$3 = {"input":"_ex4kH","disabled":"_XLcmY","dropdown":"_CEWCL","container":"_e48CZ","countryCode":"_Hpw0X"};
|
|
5181
|
+
var stylesheet$3="._ex4kH input{padding-left:76px!important}._XLcmY input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._XLcmY input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._XLcmY input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._CEWCL{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._CEWCL,._CEWCL._XLcmY:hover{background-color:transparent!important}._CEWCL:hover{background-color:rgba(50,54,58,.08)!important}._CEWCL:active{background-color:rgba(50,54,58,.11)!important}._CEWCL svg{top:2px!important}._e48CZ{position:relative}._Hpw0X{position:absolute;top:18px;left:12px;line-height:0;font-size:14px;color:#32363a;z-index:101;pointer-events:none}";
|
|
5182
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$3);}
|
|
5183
|
+
|
|
5184
|
+
const PhoneNumberInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
4980
5185
|
let {
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
5186
|
+
initialCountryCode = 'US',
|
|
5187
|
+
countryCodes,
|
|
5188
|
+
onChange,
|
|
5189
|
+
limitToValidLength = false,
|
|
5190
|
+
isDisabled,
|
|
5191
|
+
initialValue,
|
|
5192
|
+
buttonAriaLabel,
|
|
5193
|
+
inputAriaLabel,
|
|
5194
|
+
buttonAriaLabelledBy,
|
|
5195
|
+
inputAriaLabelledBy,
|
|
4987
5196
|
'data-testid': dataTestId,
|
|
4988
|
-
|
|
4989
|
-
'aria-labelledby': ariaLabelledBy,
|
|
4990
|
-
'aria-describedby': ariaDescribedBy
|
|
5197
|
+
inputId
|
|
4991
5198
|
} = _ref;
|
|
4992
|
-
const
|
|
4993
|
-
const
|
|
4994
|
-
|
|
4995
|
-
const
|
|
4996
|
-
const
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
for (let i = 1; i < dropdownItems.length; i += 1) {
|
|
5013
|
-
const distance = correctedTimeValue - dropdownItems[i].value;
|
|
5014
|
-
if (distance > minDistance || distance < 0) {
|
|
5015
|
-
return {
|
|
5016
|
-
index: i - 1,
|
|
5017
|
-
isFocused: false,
|
|
5018
|
-
isExactMatch: minDistance === 0
|
|
5019
|
-
};
|
|
5020
|
-
}
|
|
5021
|
-
minDistance = distance;
|
|
5199
|
+
const [countryCode, setCountryCode] = React.useState(initialCountryCode);
|
|
5200
|
+
const [mask, setMask] = React.useState();
|
|
5201
|
+
// As of the day of writing the longest number format is 15 numbers long. This is 5 places longer to be safe.
|
|
5202
|
+
const genericMaxNumberLength = 20;
|
|
5203
|
+
const {
|
|
5204
|
+
translate
|
|
5205
|
+
} = index.useTranslation();
|
|
5206
|
+
const getMinMaxLength = React.useCallback(() => {
|
|
5207
|
+
var _metadata$numberingPl;
|
|
5208
|
+
const metadata = new libphonenumberJs.Metadata();
|
|
5209
|
+
metadata.selectNumberingPlan(countryCode);
|
|
5210
|
+
const possibleLengths = metadata === null || metadata === void 0 || (_metadata$numberingPl = metadata.numberingPlan) === null || _metadata$numberingPl === void 0 ? void 0 : _metadata$numberingPl.possibleLengths();
|
|
5211
|
+
return possibleLengths ? [Math.min(...possibleLengths), Math.max(...possibleLengths)] : [0, genericMaxNumberLength];
|
|
5212
|
+
}, [countryCode]);
|
|
5213
|
+
const shouldUseMask = Number(libphonenumberJs.getCountryCallingCode(countryCode)) === 1;
|
|
5214
|
+
const updateMask = React.useCallback(() => {
|
|
5215
|
+
if (shouldUseMask) {
|
|
5216
|
+
setMask('(999) 999-9999');
|
|
5217
|
+
} else {
|
|
5218
|
+
setMask('9'.repeat(limitToValidLength ? getMinMaxLength()[1] : genericMaxNumberLength));
|
|
5022
5219
|
}
|
|
5023
|
-
|
|
5024
|
-
index: dropdownItems.length - 1,
|
|
5025
|
-
isFocused: false,
|
|
5026
|
-
isExactMatch: minDistance === 0
|
|
5027
|
-
};
|
|
5028
|
-
}, [is24HourClock, dropdownItems]);
|
|
5029
|
-
const [scrolledToItem, setScrolledToItem] = React.useState(() => getScrolledToItemFromTimeString(timeString));
|
|
5030
|
-
const [shouldMoveSelectionToEnd, setShouldMoveSelectionToEnd] = React.useState(true);
|
|
5031
|
-
|
|
5032
|
-
// timeObject may be controlled and may change at any time, so we need to update timeString and the focused item whenever it changes.
|
|
5220
|
+
}, [shouldUseMask, getMinMaxLength, limitToValidLength]);
|
|
5033
5221
|
React.useEffect(() => {
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
const dropdownRef = React.useRef(null);
|
|
5054
|
-
const iconRef = React.useRef(null);
|
|
5055
|
-
index.useClickOutside([inputRef, dropdownRef, iconRef], () => isTimeStringDirty ? commitTimeString() : setIsFlyoutOpen(false));
|
|
5056
|
-
const focusNext = () => {
|
|
5057
|
-
setScrolledToItem(f => {
|
|
5058
|
-
if (!f.isFocused) {
|
|
5059
|
-
// Focus just moved from input to listbox.
|
|
5060
|
-
// Move to item that was highlighted based on user input
|
|
5061
|
-
return {
|
|
5062
|
-
index: f.index,
|
|
5063
|
-
isFocused: true,
|
|
5064
|
-
isExactMatch: false
|
|
5065
|
-
};
|
|
5066
|
-
}
|
|
5067
|
-
if (f.index === dropdownItems.length - 1) {
|
|
5068
|
-
return f;
|
|
5069
|
-
}
|
|
5070
|
-
return {
|
|
5071
|
-
index: f.index + 1,
|
|
5072
|
-
isFocused: true,
|
|
5073
|
-
isExactMatch: false
|
|
5074
|
-
};
|
|
5075
|
-
});
|
|
5076
|
-
};
|
|
5077
|
-
const focusPrevious = () => {
|
|
5078
|
-
setScrolledToItem(f => {
|
|
5079
|
-
if (!f.isFocused) {
|
|
5080
|
-
// Focus just moved from input to listbox
|
|
5081
|
-
// Move to last item on arrowUp.
|
|
5082
|
-
return {
|
|
5083
|
-
index: dropdownItems.length - 1,
|
|
5084
|
-
isFocused: true,
|
|
5085
|
-
isExactMatch: false
|
|
5086
|
-
};
|
|
5087
|
-
}
|
|
5088
|
-
if (f.index === 0) {
|
|
5089
|
-
return f;
|
|
5090
|
-
}
|
|
5091
|
-
return {
|
|
5092
|
-
index: f.index - 1,
|
|
5093
|
-
isFocused: true,
|
|
5094
|
-
isExactMatch: false
|
|
5095
|
-
};
|
|
5096
|
-
});
|
|
5097
|
-
};
|
|
5098
|
-
const handleType = typedTime => {
|
|
5099
|
-
setIsFlyoutOpen(true);
|
|
5100
|
-
setTimeString(typedTime);
|
|
5101
|
-
setIsTimeStringDirty(true);
|
|
5102
|
-
setScrolledToItem(getScrolledToItemFromTimeString(typedTime));
|
|
5103
|
-
};
|
|
5104
|
-
const handleSelectTime = selectedIndex => {
|
|
5105
|
-
const timeLabel = dropdownItems[selectedIndex].label;
|
|
5106
|
-
setIsOptionHovered(false);
|
|
5107
|
-
commitTimeString(timeLabel);
|
|
5108
|
-
};
|
|
5109
|
-
const handleKeyDown = e => {
|
|
5110
|
-
switch (e.key) {
|
|
5111
|
-
case 'ArrowUp':
|
|
5112
|
-
e.preventDefault();
|
|
5113
|
-
setIsFlyoutOpen(true);
|
|
5114
|
-
focusPrevious();
|
|
5115
|
-
break;
|
|
5116
|
-
case 'ArrowDown':
|
|
5117
|
-
e.preventDefault();
|
|
5118
|
-
setIsFlyoutOpen(true);
|
|
5119
|
-
focusNext();
|
|
5120
|
-
break;
|
|
5121
|
-
case 'Enter':
|
|
5122
|
-
e.preventDefault();
|
|
5123
|
-
if (scrolledToItem !== null && scrolledToItem !== void 0 && scrolledToItem.isFocused) {
|
|
5124
|
-
// "Focus" is on the listbox
|
|
5125
|
-
handleSelectTime(scrolledToItem.index);
|
|
5126
|
-
} else {
|
|
5127
|
-
// "Focus" is on the input
|
|
5128
|
-
commitTimeString();
|
|
5129
|
-
}
|
|
5130
|
-
break;
|
|
5131
|
-
case 'Escape':
|
|
5132
|
-
// Prevent Safari from exiting full-screen mode
|
|
5133
|
-
if (isFlyoutOpen) e.preventDefault();
|
|
5134
|
-
// Use whatever time is closest to what's in the input
|
|
5135
|
-
commitTimeString();
|
|
5136
|
-
break;
|
|
5137
|
-
case 'Tab':
|
|
5138
|
-
// Use whatever time is closest to what's in the input
|
|
5139
|
-
commitTimeString();
|
|
5140
|
-
break;
|
|
5141
|
-
default:
|
|
5142
|
-
break;
|
|
5143
|
-
}
|
|
5222
|
+
updateMask();
|
|
5223
|
+
}, [countryCode, updateMask]);
|
|
5224
|
+
const removeNonNumericCharacters = value => value === null || value === void 0 ? void 0 : value.replace(/\D/g, '');
|
|
5225
|
+
const handleInputChange = a => {
|
|
5226
|
+
// remove all non-numeric characters
|
|
5227
|
+
const value = removeNonNumericCharacters(a.target.value);
|
|
5228
|
+
let internationalNumber = null;
|
|
5229
|
+
let isValidLength = false;
|
|
5230
|
+
if (!value) {
|
|
5231
|
+
return;
|
|
5232
|
+
}
|
|
5233
|
+
try {
|
|
5234
|
+
const phoneNumber = libphonenumberJs.parsePhoneNumber(value, countryCode);
|
|
5235
|
+
internationalNumber = phoneNumber.format('E.164');
|
|
5236
|
+
isValidLength = phoneNumber.isPossible();
|
|
5237
|
+
} catch (e) {
|
|
5238
|
+
// `parsePhoneNumber` throws an error if the inputs are invalid.
|
|
5239
|
+
}
|
|
5240
|
+
onChange === null || onChange === void 0 || onChange(internationalNumber, isValidLength, countryCode, value);
|
|
5144
5241
|
};
|
|
5242
|
+
const inputClassNames = classNames__default["default"](styles$3.input, {
|
|
5243
|
+
[styles$3.disabled]: isDisabled
|
|
5244
|
+
});
|
|
5245
|
+
const dropdownLabel = React.useMemo(() => countryCode ? "+".concat(libphonenumberJs.getCountryCallingCode(countryCode)) : undefined, [countryCode]);
|
|
5145
5246
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
5247
|
+
className: styles$3.container,
|
|
5248
|
+
"data-testid": dataTestId
|
|
5249
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
5250
|
+
className: styles$3.countryCode
|
|
5251
|
+
}, dropdownLabel), /*#__PURE__*/React__default["default"].createElement(index.SelectMenu, {
|
|
5252
|
+
label: " ",
|
|
5253
|
+
defaultValue: countryCode,
|
|
5254
|
+
onChange: value => setCountryCode(value),
|
|
5255
|
+
className: classNames__default["default"](styles$3.dropdown, {
|
|
5256
|
+
[styles$3.disabled]: isDisabled
|
|
5257
|
+
}),
|
|
5258
|
+
searchable: true,
|
|
5259
|
+
disabled: isDisabled,
|
|
5260
|
+
"aria-label": buttonAriaLabel,
|
|
5261
|
+
"aria-labelledby": buttonAriaLabelledBy
|
|
5262
|
+
}, (countryCodes !== null && countryCodes !== void 0 ? countryCodes : libphonenumberJs.getCountries()).map(individualCountryCode => {
|
|
5263
|
+
if (!libphonenumberJs.isSupportedCountry(individualCountryCode)) {
|
|
5264
|
+
return null;
|
|
5265
|
+
}
|
|
5266
|
+
return /*#__PURE__*/React__default["default"].createElement(index.MenuItem, {
|
|
5267
|
+
key: individualCountryCode,
|
|
5268
|
+
value: individualCountryCode
|
|
5269
|
+
}, "".concat(translate(individualCountryCode), " +").concat(libphonenumberJs.getCountryCallingCode(individualCountryCode)));
|
|
5270
|
+
})), /*#__PURE__*/React__default["default"].createElement(InputMask__default["default"], {
|
|
5271
|
+
value: isDisabled ? removeNonNumericCharacters(initialValue) : undefined,
|
|
5272
|
+
type: "tel",
|
|
5273
|
+
alwaysShowMask: true
|
|
5274
|
+
// hide formatting if not using mask
|
|
5275
|
+
,
|
|
5276
|
+
maskChar: shouldUseMask ? '_' : '',
|
|
5277
|
+
mask: mask,
|
|
5278
|
+
onChange: !isDisabled ? handleInputChange : undefined
|
|
5279
|
+
}, () => /*#__PURE__*/React__default["default"].createElement(index.Input$1, {
|
|
5280
|
+
ref: ref,
|
|
5149
5281
|
id: inputId,
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
setIsFlyoutOpen: setIsFlyoutOpen,
|
|
5158
|
-
isDisabled: isDisabled,
|
|
5159
|
-
is24HourClock: is24HourClock,
|
|
5160
|
-
isInvalid: isInvalid,
|
|
5161
|
-
ariaLabel: ariaLabel,
|
|
5162
|
-
ariaLabelledBy: ariaLabelledBy,
|
|
5163
|
-
ariaDescribedBy: ariaDescribedBy,
|
|
5164
|
-
isOptionHovered: isOptionHovered,
|
|
5165
|
-
setShouldMoveSelectionToEnd: setShouldMoveSelectionToEnd,
|
|
5166
|
-
shouldMoveSelectionToEnd: shouldMoveSelectionToEnd,
|
|
5167
|
-
ref: index.mergeRefs(ref, inputRef)
|
|
5168
|
-
}), /*#__PURE__*/React__default["default"].createElement(TimePickerIcon, {
|
|
5169
|
-
isOpen: isFlyoutOpen,
|
|
5170
|
-
isDisabled: isDisabled,
|
|
5171
|
-
setIsFlyoutOpen: setIsFlyoutOpen,
|
|
5172
|
-
iconRef: iconRef,
|
|
5173
|
-
inputRef: inputRef
|
|
5174
|
-
}), isFlyoutOpen && /*#__PURE__*/React__default["default"].createElement(TimeDropdown, {
|
|
5175
|
-
id: dropdownId,
|
|
5176
|
-
inputRef: inputRef,
|
|
5177
|
-
dropdownRef: dropdownRef,
|
|
5178
|
-
onClick: handleSelectTime,
|
|
5179
|
-
scrolledToItem: scrolledToItem,
|
|
5180
|
-
items: dropdownItems,
|
|
5181
|
-
dataTestId: dataTestId,
|
|
5182
|
-
ariaLabel: ariaLabel,
|
|
5183
|
-
ariaLabelledBy: ariaLabelledBy,
|
|
5184
|
-
ariaDescribedBy: ariaDescribedBy,
|
|
5185
|
-
setIsOptionHovered: setIsOptionHovered,
|
|
5186
|
-
isOptionHovered: isOptionHovered
|
|
5187
|
-
}));
|
|
5282
|
+
className: inputClassNames,
|
|
5283
|
+
type: "tel",
|
|
5284
|
+
autoComplete: "tel-national",
|
|
5285
|
+
"aria-label": inputAriaLabel,
|
|
5286
|
+
"aria-labelledby": inputAriaLabelledBy,
|
|
5287
|
+
initialValue: isDisabled ? undefined : removeNonNumericCharacters(initialValue)
|
|
5288
|
+
})));
|
|
5188
5289
|
});
|
|
5189
5290
|
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
var css_248z = "._VaCMy{border-color:transparent;background-color:transparent;color:#515559;cursor:pointer}._tuOBB{background-color:rgba(50,54,58,.08)}._JYadl{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._IEeBJ{color:rgba(81,85,89,.4);cursor:not-allowed}._6KEIz{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._CWqAl{color:#085caf;border-color:#085caf}._CWqAl,._gHBII{background:rgba(11,110,208,.11)}._gHBII{color:#0854a1;border-color:#0854a1}._uQV0G{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._0Xr6v{position:relative;display:inline-grid}._0Xr6v svg{fill:currentColor}._0Xr6v ._13GNt{-webkit-appearance:none;-moz-appearance:none;appearance:none;grid-column:1;grid-row:1}._0Xr6v ._13GNt+._YyNli{background-color:transparent;color:#515559;cursor:pointer;border:1px solid transparent;border-radius:4px;grid-column:1;grid-row:1;padding:0;min-width:76px;-webkit-user-select:none;-moz-user-select:none;user-select:none}._0Xr6v ._13GNt+._YyNli._nE1y7{padding:5px;max-width:36px;min-width:36px}._0Xr6v ._13GNt+._YyNli._F6KVc{padding:0 16px}._0Xr6v ._13GNt+._YyNli._Y-f0O{padding:0 16px 0 12px}._0Xr6v ._13GNt:hover+._YyNli{background-color:rgba(50,54,58,.08)}._0Xr6v ._13GNt:disabled+._YyNli{color:rgba(81,85,89,.4);cursor:not-allowed}._0Xr6v ._13GNt:active+._YyNli,._0Xr6v ._13GNt:focus:active+._YyNli{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._0Xr6v ._13GNt:checked+._YyNli{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._0Xr6v ._13GNt:checked:hover+._YyNli{background:rgba(11,110,208,.11);color:#085caf;border-color:#085caf}._0Xr6v ._13GNt:checked:disabled+._YyNli{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._0Xr6v ._13GNt:checked:active+._YyNli,._0Xr6v ._13GNt:checked:focus:active+._YyNli{background:rgba(11,110,208,.11);color:#0854a1;border-color:#0854a1}._8wGFF{display:inline-flex;position:relative}._8wGFF:before{content:\"\";border:1px solid #d9d9d9;border-radius:4px;position:absolute;top:0;bottom:0;right:0;left:0}._8wGFF>*{flex-shrink:0;flex-grow:0}._q6Tdr{border:none;margin:0;padding:0}._q6Tdr legend{padding:0;display:block;font-size:14px;margin-bottom:6px;color:#515559}._0Xr6v ._13GNt.focus-visible+._YyNli,._0Xr6v ._13GNt:focus-visible+._YyNli{z-index:20;outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
5196
|
-
var styles = {"default":"_VaCMy","hovered":"_tuOBB","pressed":"_JYadl","disabled":"_IEeBJ","selectedDefault":"_6KEIz","selectedHovered":"_CWqAl","selectedPressed":"_gHBII","selectedDisabled":"_uQV0G","toggleContainer":"_0Xr6v","toggleInput":"_13GNt","toggleButton":"_YyNli","iconOnly":"_nE1y7","text":"_F6KVc","iconText":"_Y-f0O","toggleButtonGroup":"_8wGFF","toggleButtonGroupFieldset":"_q6Tdr"};
|
|
5197
|
-
var stylesheet="._VaCMy{border-color:transparent;background-color:transparent;color:#515559;cursor:pointer}._tuOBB{background-color:rgba(50,54,58,.08)}._JYadl{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._IEeBJ{color:rgba(81,85,89,.4);cursor:not-allowed}._6KEIz{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._CWqAl{color:#085caf;border-color:#085caf}._CWqAl,._gHBII{background:rgba(11,110,208,.11)}._gHBII{color:#0854a1;border-color:#0854a1}._uQV0G{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._0Xr6v{position:relative;display:inline-grid}._0Xr6v svg{fill:currentColor}._0Xr6v ._13GNt{-webkit-appearance:none;-moz-appearance:none;appearance:none;grid-column:1;grid-row:1}._0Xr6v ._13GNt+._YyNli{background-color:transparent;color:#515559;cursor:pointer;border:1px solid transparent;border-radius:4px;grid-column:1;grid-row:1;padding:0;min-width:76px;-webkit-user-select:none;-moz-user-select:none;user-select:none}._0Xr6v ._13GNt+._YyNli._nE1y7{padding:5px;max-width:36px;min-width:36px}._0Xr6v ._13GNt+._YyNli._F6KVc{padding:0 16px}._0Xr6v ._13GNt+._YyNli._Y-f0O{padding:0 16px 0 12px}._0Xr6v ._13GNt:hover+._YyNli{background-color:rgba(50,54,58,.08)}._0Xr6v ._13GNt:disabled+._YyNli{color:rgba(81,85,89,.4);cursor:not-allowed}._0Xr6v ._13GNt:active+._YyNli,._0Xr6v ._13GNt:focus:active+._YyNli{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._0Xr6v ._13GNt:checked+._YyNli{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._0Xr6v ._13GNt:checked:hover+._YyNli{background:rgba(11,110,208,.11);color:#085caf;border-color:#085caf}._0Xr6v ._13GNt:checked:disabled+._YyNli{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._0Xr6v ._13GNt:checked:active+._YyNli,._0Xr6v ._13GNt:checked:focus:active+._YyNli{background:rgba(11,110,208,.11);color:#0854a1;border-color:#0854a1}._8wGFF{display:inline-flex;position:relative}._8wGFF:before{content:\"\";border:1px solid #d9d9d9;border-radius:4px;position:absolute;top:0;bottom:0;right:0;left:0}._8wGFF>*{flex-shrink:0;flex-grow:0}._q6Tdr{border:none;margin:0;padding:0}._q6Tdr legend{padding:0;display:block;font-size:14px;margin-bottom:6px;color:#515559}._0Xr6v ._13GNt.focus-visible+._YyNli,._0Xr6v ._13GNt:focus-visible+._YyNli{z-index:20;outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
5198
|
-
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z);}
|
|
5291
|
+
var css_248z$2 = "._MyQMX{display:flex}._9-3-D{z-index:2;width:1px;margin-left:-1px;margin-right:-1px}._9-3-D._Y5ey6{background-color:#fff}._9-3-D._W6uBO,._9-3-D._Y5ey6._9EbiJ.focus-visible:not(._xu2tf),._9-3-D._Y5ey6._9EbiJ:focus-visible:not(._xu2tf),._9-3-D._Y5ey6._WZahD:not(._9-3-D._Y5ey6._iexVS){background-color:#0b6ed0}._9-3-D._W6uBO._iexVS._WZahD,._9-3-D._W6uBO._xu2tf._9EbiJ,._9-3-D._W6uBO._xu2tf._iexVS{opacity:.4}._HRQJK{border-radius:4px 0 0 4px;border-right:none;padding-right:17px}._HRQJK:focus{z-index:1}._jn-hg{border-radius:0 4px 4px 0;transition:border .2s,background .2s,color .2s;border-left:none;min-width:35px!important;padding:0!important;justify-content:center!important}._jn-hg svg{margin-left:1px}._jn-hg._Y5ey6{background-color:#0b6ed0;border-color:transparent}._jn-hg._Y5ey6 svg{fill:#fff!important}._jn-hg._Y5ey6:not(._mhzDX):hover{background-color:#085caf!important}._jn-hg._Y5ey6:not(._mhzDX):active{background-color:#0854a1!important}._jn-hg._Y5ey6._mhzDX{opacity:.4}._jn-hg._Y5ey6._mhzDX svg{background-color:transparent}._jn-hg._W6uBO{border-color:#0b6ed0;background-color:#fff}._jn-hg._W6uBO svg{fill:#0b6ed0!important}._jn-hg._W6uBO:not(._mhzDX):hover{background-color:#eef5fc!important}._jn-hg._W6uBO:not(._mhzDX):active{background-color:#e1edf9!important}._jn-hg._W6uBO._mhzDX{opacity:.4}._jn-hg._W6uBO._mhzDX svg{background-color:transparent}._YG-2t{width:260px}";
|
|
5292
|
+
var styles$2 = {"container":"_MyQMX","divider":"_9-3-D","primary":"_Y5ey6","mainButtonFocus":"_9EbiJ","mainButtonDisabled":"_xu2tf","dropdownButtonFocus":"_WZahD","dropdownButtonDisabled":"_iexVS","secondary":"_W6uBO","mainButton":"_HRQJK","dropdownButton":"_jn-hg","disabled":"_mhzDX","dropdownOption":"_YG-2t"};
|
|
5293
|
+
var stylesheet$2="._MyQMX{display:flex}._9-3-D{z-index:2;width:1px;margin-left:-1px;margin-right:-1px}._9-3-D._Y5ey6{background-color:#fff}._9-3-D._W6uBO,._9-3-D._Y5ey6._9EbiJ.focus-visible:not(._xu2tf),._9-3-D._Y5ey6._9EbiJ:focus-visible:not(._xu2tf),._9-3-D._Y5ey6._WZahD:not(._9-3-D._Y5ey6._iexVS){background-color:#0b6ed0}._9-3-D._W6uBO._iexVS._WZahD,._9-3-D._W6uBO._xu2tf._9EbiJ,._9-3-D._W6uBO._xu2tf._iexVS{opacity:.4}._HRQJK{border-radius:4px 0 0 4px;border-right:none;padding-right:17px}._HRQJK:focus{z-index:1}._jn-hg{border-radius:0 4px 4px 0;transition:border .2s,background .2s,color .2s;border-left:none;min-width:35px!important;padding:0!important;justify-content:center!important}._jn-hg svg{margin-left:1px}._jn-hg._Y5ey6{background-color:#0b6ed0;border-color:transparent}._jn-hg._Y5ey6 svg{fill:#fff!important}._jn-hg._Y5ey6:not(._mhzDX):hover{background-color:#085caf!important}._jn-hg._Y5ey6:not(._mhzDX):active{background-color:#0854a1!important}._jn-hg._Y5ey6._mhzDX{opacity:.4}._jn-hg._Y5ey6._mhzDX svg{background-color:transparent}._jn-hg._W6uBO{border-color:#0b6ed0;background-color:#fff}._jn-hg._W6uBO svg{fill:#0b6ed0!important}._jn-hg._W6uBO:not(._mhzDX):hover{background-color:#eef5fc!important}._jn-hg._W6uBO:not(._mhzDX):active{background-color:#e1edf9!important}._jn-hg._W6uBO._mhzDX{opacity:.4}._jn-hg._W6uBO._mhzDX svg{background-color:transparent}._YG-2t{width:260px}";
|
|
5294
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$2);}
|
|
5199
5295
|
|
|
5200
|
-
const
|
|
5296
|
+
const SplitButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
5201
5297
|
let {
|
|
5202
|
-
|
|
5203
|
-
value,
|
|
5204
|
-
onChange,
|
|
5205
|
-
name,
|
|
5298
|
+
kind = 'primary',
|
|
5206
5299
|
label,
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5300
|
+
children,
|
|
5301
|
+
isButtonDisabled = false,
|
|
5302
|
+
isDropdownDisabled = false,
|
|
5303
|
+
'data-testid': dataTestId,
|
|
5304
|
+
className,
|
|
5305
|
+
buttonAriaLabel,
|
|
5306
|
+
buttonAriaLabelledBy,
|
|
5307
|
+
dropdownAriaLabel,
|
|
5308
|
+
dropdownAriaLabelledBy,
|
|
5309
|
+
onClick
|
|
5210
5310
|
} = _ref;
|
|
5211
|
-
const
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
"
|
|
5311
|
+
const mainButtonRef = React.useRef(null);
|
|
5312
|
+
const dropdownButtonRef = React.useRef(null);
|
|
5313
|
+
const [dropdownButtonHasFocus, setDropdownButtonHasFocus] = React.useState(false);
|
|
5314
|
+
const [mainButtonHasFocus, setMainButtonHasFocus] = React.useState(false);
|
|
5315
|
+
|
|
5316
|
+
// Keyboard navigation cannot be implemented using `onKeyDown` on the `button`s because keyboard events are disabled if the buttons are disabled. The consumer must be able to access either button, even if the other is disabled.
|
|
5317
|
+
index.useEventListener(mainButtonRef, 'keydown', e => {
|
|
5318
|
+
var _dropdownButtonRef$cu;
|
|
5319
|
+
return e.key === 'ArrowRight' && ((_dropdownButtonRef$cu = dropdownButtonRef.current) === null || _dropdownButtonRef$cu === void 0 ? void 0 : _dropdownButtonRef$cu.focus());
|
|
5320
|
+
});
|
|
5321
|
+
index.useEventListener(dropdownButtonRef, 'keydown', e => {
|
|
5322
|
+
var _mainButtonRef$curren;
|
|
5323
|
+
return e.key === 'ArrowLeft' && ((_mainButtonRef$curren = mainButtonRef.current) === null || _mainButtonRef$curren === void 0 ? void 0 : _mainButtonRef$curren.focus());
|
|
5324
|
+
});
|
|
5325
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5326
|
+
"data-testid": dataTestId,
|
|
5327
|
+
className: classNames__default["default"](styles$2.container, className),
|
|
5227
5328
|
ref: ref
|
|
5228
|
-
},
|
|
5229
|
-
|
|
5329
|
+
}, /*#__PURE__*/React__default["default"].createElement(index.Button, {
|
|
5330
|
+
kind: kind,
|
|
5331
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'button'),
|
|
5332
|
+
className: classNames__default["default"](styles$2.mainButton, {
|
|
5333
|
+
[styles$2.disabled]: isButtonDisabled,
|
|
5334
|
+
[styles$2.primary]: kind === 'primary'
|
|
5335
|
+
}),
|
|
5336
|
+
onClick: onClick,
|
|
5337
|
+
disabled: isButtonDisabled,
|
|
5338
|
+
ref: mainButtonRef,
|
|
5339
|
+
tabIndex: dropdownButtonHasFocus ? -1 : 0,
|
|
5340
|
+
"aria-label": buttonAriaLabel,
|
|
5341
|
+
"aria-labelledby": buttonAriaLabelledBy,
|
|
5342
|
+
onFocus: () => setMainButtonHasFocus(true),
|
|
5343
|
+
onBlur: () => setMainButtonHasFocus(false)
|
|
5344
|
+
}, label), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5345
|
+
className: classNames__default["default"](styles$2.divider, {
|
|
5346
|
+
[styles$2.primary]: kind === 'primary',
|
|
5347
|
+
[styles$2.secondary]: kind === 'secondary',
|
|
5348
|
+
[styles$2.mainButtonFocus]: mainButtonHasFocus,
|
|
5349
|
+
[styles$2.dropdownButtonFocus]: dropdownButtonHasFocus,
|
|
5350
|
+
[styles$2.mainButtonDisabled]: isButtonDisabled,
|
|
5351
|
+
[styles$2.dropdownButtonDisabled]: isDropdownDisabled
|
|
5352
|
+
})
|
|
5353
|
+
}), /*#__PURE__*/React__default["default"].createElement(index.Dropdown, {
|
|
5354
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'dropdown'),
|
|
5355
|
+
"aria-label": dropdownAriaLabel,
|
|
5356
|
+
"aria-labelledby": dropdownAriaLabelledBy,
|
|
5357
|
+
value: 0,
|
|
5358
|
+
disabled: isDropdownDisabled
|
|
5359
|
+
}, /*#__PURE__*/React__default["default"].createElement(index.DropdownButton
|
|
5360
|
+
// `label` of type `string` adds Dropdown's `isString` class, which causes a css bug in Safari
|
|
5361
|
+
, {
|
|
5362
|
+
label: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null),
|
|
5363
|
+
className: classNames__default["default"](styles$2.dropdownButton, {
|
|
5364
|
+
[styles$2.disabled]: isDropdownDisabled,
|
|
5365
|
+
[styles$2.primary]: kind === 'primary',
|
|
5366
|
+
[styles$2.secondary]: kind === 'secondary'
|
|
5367
|
+
}),
|
|
5368
|
+
ref: dropdownButtonRef,
|
|
5369
|
+
tabIndex: -1,
|
|
5370
|
+
onFocus: () => setDropdownButtonHasFocus(true),
|
|
5371
|
+
onBlur: () => setDropdownButtonHasFocus(false)
|
|
5372
|
+
}), /*#__PURE__*/React__default["default"].createElement(index.DropdownList, {
|
|
5373
|
+
placement: "bottom"
|
|
5230
5374
|
}, children)));
|
|
5231
5375
|
});
|
|
5232
5376
|
|
|
5233
|
-
const
|
|
5377
|
+
const SplitButtonOption = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
5234
5378
|
let {
|
|
5235
|
-
|
|
5236
|
-
isActivated,
|
|
5237
|
-
onChange,
|
|
5238
|
-
value,
|
|
5379
|
+
onClick,
|
|
5239
5380
|
isDisabled,
|
|
5240
|
-
|
|
5241
|
-
'aria-label': ariaLabel,
|
|
5242
|
-
'aria-labelledby': ariaLabelledby,
|
|
5243
|
-
name: inputName,
|
|
5244
|
-
dataTestId
|
|
5381
|
+
children
|
|
5245
5382
|
} = _ref;
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
onChange(checked);
|
|
5255
|
-
}
|
|
5256
|
-
};
|
|
5257
|
-
if (inGroup) {
|
|
5258
|
-
checked = value === groupContext.value;
|
|
5259
|
-
disabled = groupContext.isDisabled || isDisabled;
|
|
5260
|
-
name = groupContext.name;
|
|
5261
|
-
handleChange = () => {
|
|
5262
|
-
if (onChange) {
|
|
5263
|
-
onChange(checked);
|
|
5264
|
-
}
|
|
5265
|
-
groupContext.onChange(value);
|
|
5266
|
-
};
|
|
5267
|
-
}
|
|
5268
|
-
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
5269
|
-
ref: ref,
|
|
5270
|
-
className: styles.toggleContainer
|
|
5271
|
-
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
5272
|
-
type: inGroup ? 'radio' : 'checkbox',
|
|
5273
|
-
name: name,
|
|
5274
|
-
checked: checked,
|
|
5275
|
-
onChange: handleChange,
|
|
5276
|
-
id: id,
|
|
5277
|
-
disabled: disabled,
|
|
5278
|
-
value: value,
|
|
5279
|
-
className: styles.toggleInput,
|
|
5280
|
-
"data-testid": index.getSubDataTestId(dataTestId, 'input'),
|
|
5281
|
-
role: inGroup ? undefined : 'button',
|
|
5282
|
-
"aria-pressed": inGroup ? undefined : checked,
|
|
5283
|
-
"aria-label": ariaLabel,
|
|
5284
|
-
"aria-labelledby": ariaLabelledby
|
|
5285
|
-
}), /*#__PURE__*/React__default["default"].createElement("label", {
|
|
5286
|
-
htmlFor: id,
|
|
5287
|
-
className: classNames__default["default"]([index.buttonStyles.btn, styles.toggleButton], {
|
|
5288
|
-
[styles.iconOnly]: kind === 'icon',
|
|
5289
|
-
[styles.textOnly]: kind === 'text',
|
|
5290
|
-
[styles.iconText]: kind === 'icon-text'
|
|
5291
|
-
}),
|
|
5292
|
-
"data-testid": index.getSubDataTestId(dataTestId, 'label')
|
|
5293
|
-
}, children));
|
|
5383
|
+
return /*#__PURE__*/React__default["default"].createElement(index.DropdownOption, {
|
|
5384
|
+
value: -1,
|
|
5385
|
+
label: "",
|
|
5386
|
+
disabled: isDisabled,
|
|
5387
|
+
onSelect: onClick,
|
|
5388
|
+
className: styles$2.dropdownOption,
|
|
5389
|
+
ref: ref
|
|
5390
|
+
}, children);
|
|
5294
5391
|
});
|
|
5295
5392
|
|
|
5296
5393
|
const convertAlignment = alignment => {
|
|
@@ -5414,305 +5511,693 @@ const StackItem = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
5414
5511
|
}, children);
|
|
5415
5512
|
});
|
|
5416
5513
|
|
|
5417
|
-
|
|
5514
|
+
var css_248z$1 = "._M911N{display:inline-block;position:relative}._M911N ._n6-Um{width:120px}._M911N ._n6-Um ._CaEZh._Hwm-A{transform:rotate(-180deg)}._M911N ._n6-Um ._CaEZh._aop6-{fill:#9d9fa1;opacity:.4}._M911N ._bw1Xx>input:focus{box-shadow:none!important;border:1px solid #898989!important}._M911N ._CaEZh{position:absolute;right:4px;bottom:4px;height:28px;width:28px}._M911N ._CaEZh._Hwm-A{transform:rotate(-180deg)}._zpdVv{width:120px}._zpdVv ._p5dVy._oQwaO{background-color:#efefef;border-radius:6px}";
|
|
5515
|
+
var styles$1 = {"timePickerContainer":"_M911N","input":"_n6-Um","icon":"_CaEZh","open":"_Hwm-A","disabled":"_aop6-","ignoreFocusStyle":"_bw1Xx","timePickerFlyout":"_zpdVv","option":"_p5dVy","exactMatch":"_oQwaO"};
|
|
5516
|
+
var stylesheet$1="._M911N{display:inline-block;position:relative}._M911N ._n6-Um{width:120px}._M911N ._n6-Um ._CaEZh._Hwm-A{transform:rotate(-180deg)}._M911N ._n6-Um ._CaEZh._aop6-{fill:#9d9fa1;opacity:.4}._M911N ._bw1Xx>input:focus{box-shadow:none!important;border:1px solid #898989!important}._M911N ._CaEZh{position:absolute;right:4px;bottom:4px;height:28px;width:28px}._M911N ._CaEZh._Hwm-A{transform:rotate(-180deg)}._zpdVv{width:120px}._zpdVv ._p5dVy._oQwaO{background-color:#efefef;border-radius:6px}";
|
|
5517
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$1);}
|
|
5518
|
+
|
|
5519
|
+
const TimeDropdown = _ref => {
|
|
5418
5520
|
let {
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5521
|
+
onClick,
|
|
5522
|
+
scrolledToItem,
|
|
5523
|
+
inputRef,
|
|
5524
|
+
dropdownRef,
|
|
5525
|
+
items,
|
|
5526
|
+
id,
|
|
5527
|
+
dataTestId,
|
|
5528
|
+
ariaLabel,
|
|
5529
|
+
ariaLabelledBy,
|
|
5530
|
+
ariaDescribedBy,
|
|
5531
|
+
setIsOptionHovered,
|
|
5532
|
+
isOptionHovered
|
|
5428
5533
|
} = _ref;
|
|
5429
|
-
const
|
|
5430
|
-
const
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
};
|
|
5442
|
-
return /*#__PURE__*/React__default["default"].createElement(SelectContextProvider, {
|
|
5443
|
-
value: {
|
|
5444
|
-
...selectContext,
|
|
5445
|
-
showSelectedItemsPane
|
|
5534
|
+
const scrollRef = React.useRef(Array(items.length));
|
|
5535
|
+
const [refsInitialized, setRefsInitialized] = React.useState(false);
|
|
5536
|
+
React.useEffect(() => {
|
|
5537
|
+
const nodes = scrollRef.current;
|
|
5538
|
+
if (scrolledToItem) {
|
|
5539
|
+
const nodeToScrollTo = nodes[scrolledToItem.index];
|
|
5540
|
+
if (nodeToScrollTo) {
|
|
5541
|
+
const {
|
|
5542
|
+
parentNode
|
|
5543
|
+
} = nodeToScrollTo;
|
|
5544
|
+
parentNode.scrollTop = nodeToScrollTo.offsetTop;
|
|
5545
|
+
}
|
|
5446
5546
|
}
|
|
5447
|
-
},
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5547
|
+
}, [scrolledToItem, refsInitialized]);
|
|
5548
|
+
return /*#__PURE__*/React__default["default"].createElement(index.Popper, {
|
|
5549
|
+
open: true,
|
|
5550
|
+
isFocusLocked: true,
|
|
5551
|
+
focusLockProps: {
|
|
5552
|
+
returnFocus: true
|
|
5553
|
+
},
|
|
5554
|
+
placement: "bottom",
|
|
5555
|
+
popper: /*#__PURE__*/React__default["default"].createElement(index.Flyout, {
|
|
5556
|
+
anchorRef: inputRef,
|
|
5557
|
+
ref: dropdownRef,
|
|
5558
|
+
id: id,
|
|
5559
|
+
"aria-label": ariaLabel,
|
|
5560
|
+
"aria-labelledby": ariaLabelledBy,
|
|
5561
|
+
"aria-describedby": ariaDescribedBy,
|
|
5562
|
+
"data-testid": dataTestId && "".concat(dataTestId, "-dropdown"),
|
|
5563
|
+
className: styles$1.timePickerFlyout,
|
|
5564
|
+
onMouseOver: () => setIsOptionHovered(true),
|
|
5565
|
+
onMouseLeave: () => setIsOptionHovered(false)
|
|
5566
|
+
}, items.map((item, index$1) => /*#__PURE__*/React__default["default"].createElement(index.FlyoutOption, {
|
|
5567
|
+
id: item.id,
|
|
5568
|
+
isHighlightedOnHover: true,
|
|
5569
|
+
isHighlighted: (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.index) === index$1 && (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.isFocused),
|
|
5570
|
+
key: item.label,
|
|
5571
|
+
ref: node => {
|
|
5572
|
+
if (node) {
|
|
5573
|
+
scrollRef.current[index$1] = node;
|
|
5574
|
+
setRefsInitialized(true);
|
|
5575
|
+
}
|
|
5576
|
+
},
|
|
5577
|
+
onClick: () => onClick(index$1),
|
|
5578
|
+
"data-testid": dataTestId && "".concat(dataTestId, "-option-").concat(index$1),
|
|
5579
|
+
className: classNames__default["default"](styles$1.option, {
|
|
5580
|
+
[styles$1.exactMatch]: (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.index) === index$1 && scrolledToItem.isExactMatch && !isOptionHovered
|
|
5581
|
+
})
|
|
5582
|
+
}, item.label))),
|
|
5583
|
+
anchorNode: inputRef.current,
|
|
5584
|
+
modifiers: [{
|
|
5585
|
+
name: 'offset',
|
|
5586
|
+
options: {
|
|
5587
|
+
offset: [0, 5]
|
|
5588
|
+
}
|
|
5589
|
+
}]
|
|
5590
|
+
});
|
|
5591
|
+
};
|
|
5452
5592
|
|
|
5453
|
-
const
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5593
|
+
const formatUtcDate = (utcDate, is24HourClock) => {
|
|
5594
|
+
const {
|
|
5595
|
+
format
|
|
5596
|
+
} = Intl.DateTimeFormat(undefined, {
|
|
5597
|
+
timeStyle: 'short',
|
|
5598
|
+
timeZone: 'UTC',
|
|
5599
|
+
hourCycle: is24HourClock ? 'h23' : 'h12'
|
|
5600
|
+
});
|
|
5601
|
+
const dateWithoutLeadingZeros = format(utcDate);
|
|
5602
|
+
let dateWithLeadingZeros = dateWithoutLeadingZeros;
|
|
5603
|
+
if (dateWithLeadingZeros.split(':')[0].length === 1) {
|
|
5604
|
+
dateWithLeadingZeros = "0".concat(dateWithLeadingZeros);
|
|
5458
5605
|
}
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5606
|
+
return dateWithLeadingZeros.toLowerCase();
|
|
5607
|
+
};
|
|
5608
|
+
const convertTimeObjectToTimeString = (time, is24HourClock) => {
|
|
5609
|
+
const date = Date.UTC(2000, 0, 0, time.hour, time.minute);
|
|
5610
|
+
return formatUtcDate(date, is24HourClock);
|
|
5611
|
+
};
|
|
5612
|
+
const convertTimeStringToTimeObject = completeTimeString => {
|
|
5613
|
+
const [hourPart, minutePart, amPmPart] = completeTimeString.split(/:| /);
|
|
5614
|
+
let hour = +hourPart;
|
|
5615
|
+
const minute = +minutePart;
|
|
5616
|
+
if (amPmPart === 'am' && hour === 12) {
|
|
5617
|
+
hour = 0;
|
|
5618
|
+
} else if (amPmPart === 'pm' && hour < 12) {
|
|
5619
|
+
hour += 12;
|
|
5620
|
+
}
|
|
5621
|
+
return {
|
|
5622
|
+
hour,
|
|
5623
|
+
minute
|
|
5624
|
+
};
|
|
5625
|
+
};
|
|
5626
|
+
const generateTimes = (step, is24HourClock) => {
|
|
5627
|
+
const secondsInDay = 60 * 60 * 24;
|
|
5628
|
+
return Array.from(Array(secondsInDay / step)).map((_, i) => {
|
|
5629
|
+
const labelWithLeadingZeros = formatUtcDate(Date.UTC(2000, 0, 1, 0, 0, i * step, 0), is24HourClock);
|
|
5630
|
+
return {
|
|
5631
|
+
label: labelWithLeadingZeros,
|
|
5632
|
+
value: i * step,
|
|
5633
|
+
id: "time-option-".concat(i)
|
|
5634
|
+
};
|
|
5475
5635
|
});
|
|
5476
|
-
return current;
|
|
5477
5636
|
};
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
const selectedSelectItems = React.useMemo(() => {
|
|
5497
|
-
if (Array.isArray(selectedValues)) {
|
|
5498
|
-
return new Map(GetSelectItemsFrom(selectPaneChildren, _ref2 => {
|
|
5499
|
-
let {
|
|
5500
|
-
value: _value
|
|
5501
|
-
} = _ref2;
|
|
5502
|
-
return _value == null || selectedValues.includes(_value);
|
|
5503
|
-
}));
|
|
5504
|
-
}
|
|
5505
|
-
return new Map(GetSelectItemsFrom(selectPaneChildren, _ref3 => {
|
|
5506
|
-
let {
|
|
5507
|
-
value: _value
|
|
5508
|
-
} = _ref3;
|
|
5509
|
-
return _value == null || selectedValues === _value;
|
|
5510
|
-
}));
|
|
5511
|
-
}, [selectedValues, selectPaneChildren]);
|
|
5512
|
-
const enabledSelectItems = React.useMemo(() => new Map(GetSelectItemsFrom(selectPaneChildren, _ref4 => {
|
|
5513
|
-
let {
|
|
5514
|
-
isDisabled: _isDisabled
|
|
5515
|
-
} = _ref4;
|
|
5516
|
-
return !_isDisabled;
|
|
5517
|
-
})), [selectPaneChildren]);
|
|
5518
|
-
const onItemSelect = React.useCallback((_value, isSelected) => {
|
|
5519
|
-
setSelectedValues(currentSelectedValues => {
|
|
5520
|
-
if (multiselect) {
|
|
5521
|
-
if (Array.isArray(currentSelectedValues)) {
|
|
5522
|
-
const clone = new Set(currentSelectedValues);
|
|
5523
|
-
if (isSelected) {
|
|
5524
|
-
clone.add(_value);
|
|
5525
|
-
} else {
|
|
5526
|
-
clone.delete(_value);
|
|
5527
|
-
}
|
|
5528
|
-
return Array.from(clone);
|
|
5529
|
-
}
|
|
5530
|
-
if (isSelected) {
|
|
5531
|
-
return [_value];
|
|
5532
|
-
}
|
|
5533
|
-
} else if (isSelected) {
|
|
5534
|
-
return _value;
|
|
5637
|
+
function getTimeStringCorrector(str, is24HourClock) {
|
|
5638
|
+
var _letterString;
|
|
5639
|
+
let [numberString, letterString] = str.replace(':', '').split(' ');
|
|
5640
|
+
letterString = (_letterString = letterString) === null || _letterString === void 0 ? void 0 : _letterString.toLowerCase();
|
|
5641
|
+
let selectionModifier = 0;
|
|
5642
|
+
const getTimeString = () => {
|
|
5643
|
+
const finalNumberString = "".concat(numberString.slice(0, 2), ":").concat(numberString.slice(2, 4));
|
|
5644
|
+
return is24HourClock ? finalNumberString : "".concat(finalNumberString, " ").concat(letterString);
|
|
5645
|
+
};
|
|
5646
|
+
const getSelectionModifier = () => selectionModifier;
|
|
5647
|
+
const replaceDashes = () => {
|
|
5648
|
+
numberString = numberString.replace(/-/g, '0');
|
|
5649
|
+
if (letterString) {
|
|
5650
|
+
if (letterString[0] === '-' || letterString[0] === 'a') {
|
|
5651
|
+
// Arbitrarily choose AM if user hasn't typed 'a' or 'p'
|
|
5652
|
+
letterString = 'am';
|
|
5653
|
+
} else {
|
|
5654
|
+
letterString = 'pm';
|
|
5535
5655
|
}
|
|
5536
|
-
|
|
5537
|
-
});
|
|
5538
|
-
}, [setSelectedValues, multiselect]);
|
|
5539
|
-
const sharedMenuProps = {
|
|
5540
|
-
isDisabled,
|
|
5541
|
-
isOpen,
|
|
5542
|
-
onIsOpenChange,
|
|
5543
|
-
'data-testid': dataTestId,
|
|
5544
|
-
isVirtualizationDisabled
|
|
5656
|
+
}
|
|
5545
5657
|
};
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5658
|
+
const shiftMinutesRight = () => {
|
|
5659
|
+
numberString = "".concat(numberString.slice(0, 2), "0").concat(numberString[2]);
|
|
5660
|
+
selectionModifier += 1;
|
|
5661
|
+
};
|
|
5662
|
+
const prependCharacter = character => {
|
|
5663
|
+
numberString = "".concat(character).concat(numberString);
|
|
5664
|
+
selectionModifier += 1;
|
|
5665
|
+
};
|
|
5666
|
+
const setHoursTo12 = () => {
|
|
5667
|
+
numberString = "12".concat(numberString.slice(2));
|
|
5668
|
+
};
|
|
5669
|
+
const clearSecondHoursDigit = () => {
|
|
5670
|
+
numberString = "".concat(numberString.slice(0, 1), "0").concat(numberString.slice(2));
|
|
5671
|
+
};
|
|
5672
|
+
const hoursAre00 = () => numberString[0] === '0' && numberString[1] === '0';
|
|
5673
|
+
const firstHourGreaterThan1 = () => !'01-'.includes(numberString[0]);
|
|
5674
|
+
const firstHourGreaterThan2 = () => !'012-'.includes(numberString[0]);
|
|
5675
|
+
const hoursGreaterThan12 = () => numberString[0] === '1' && !'012-'.includes(numberString[1]);
|
|
5676
|
+
const hoursGreaterThan23 = () => numberString[0] === '2' && !'0123-'.includes(numberString[1]);
|
|
5677
|
+
const firstMinuteGreaterThan5 = () => numberString[2] !== '-' && +numberString[2] > 5;
|
|
5678
|
+
const hasTypedMinutes = () => numberString[2] !== '-' && numberString[3] !== '-';
|
|
5679
|
+
return {
|
|
5680
|
+
getTimeString,
|
|
5681
|
+
getSelectionModifier,
|
|
5682
|
+
replaceDashes,
|
|
5683
|
+
setHoursTo12,
|
|
5684
|
+
clearSecondHoursDigit,
|
|
5685
|
+
shiftMinutesRight,
|
|
5686
|
+
prependCharacter,
|
|
5687
|
+
hoursAre00,
|
|
5688
|
+
firstHourGreaterThan1,
|
|
5689
|
+
firstHourGreaterThan2,
|
|
5690
|
+
hoursGreaterThan12,
|
|
5691
|
+
hoursGreaterThan23,
|
|
5692
|
+
firstMinuteGreaterThan5,
|
|
5693
|
+
hasTypedMinutes
|
|
5694
|
+
};
|
|
5695
|
+
}
|
|
5696
|
+
const correct12HourTime = (time, mustCompleteTime) => {
|
|
5697
|
+
const timeStringCorrector = getTimeStringCorrector(time, false);
|
|
5698
|
+
if (mustCompleteTime) {
|
|
5699
|
+
timeStringCorrector.replaceDashes();
|
|
5700
|
+
}
|
|
5701
|
+
if (timeStringCorrector.firstHourGreaterThan1()) {
|
|
5702
|
+
timeStringCorrector.prependCharacter('0');
|
|
5703
|
+
}
|
|
5704
|
+
if (timeStringCorrector.hoursGreaterThan12()) {
|
|
5705
|
+
if (timeStringCorrector.hasTypedMinutes()) {
|
|
5706
|
+
// User likely just edited the first digit and that made the
|
|
5707
|
+
// second digit invalid, e.g., changed '08:' to '18:'. They
|
|
5708
|
+
// probably are about to fix up the second digit. We'll set it to 0
|
|
5709
|
+
timeStringCorrector.clearSecondHoursDigit();
|
|
5710
|
+
} else {
|
|
5711
|
+
// Assume the user forgot a leading 0
|
|
5712
|
+
// Example: we are changing '13:--' to '01:3-'
|
|
5713
|
+
timeStringCorrector.prependCharacter('0');
|
|
5556
5714
|
}
|
|
5557
|
-
}
|
|
5715
|
+
}
|
|
5716
|
+
if (timeStringCorrector.hoursAre00()) {
|
|
5717
|
+
timeStringCorrector.setHoursTo12();
|
|
5718
|
+
}
|
|
5719
|
+
if (timeStringCorrector.firstMinuteGreaterThan5()) {
|
|
5720
|
+
// Assume the user forgot a 0
|
|
5721
|
+
// Example: we are changing 12:6- to 12:06
|
|
5722
|
+
timeStringCorrector.shiftMinutesRight();
|
|
5723
|
+
}
|
|
5724
|
+
return {
|
|
5725
|
+
correctedTime: timeStringCorrector.getTimeString(),
|
|
5726
|
+
selectionModifier: timeStringCorrector.getSelectionModifier()
|
|
5727
|
+
};
|
|
5728
|
+
};
|
|
5729
|
+
const correct24HourTime = (time, mustCompleteTime) => {
|
|
5730
|
+
const timeStringCorrector = getTimeStringCorrector(time, true);
|
|
5731
|
+
if (mustCompleteTime) {
|
|
5732
|
+
timeStringCorrector.replaceDashes();
|
|
5733
|
+
}
|
|
5734
|
+
if (timeStringCorrector.hoursGreaterThan23()) {
|
|
5735
|
+
// User likely just edited the first digit and that made the second
|
|
5736
|
+
// digit invalid, e.g., changed '15:' to '25:'. They probably
|
|
5737
|
+
// are about to fix up the second digit. We'll set it to 0
|
|
5738
|
+
if (timeStringCorrector.hasTypedMinutes()) {
|
|
5739
|
+
timeStringCorrector.clearSecondHoursDigit();
|
|
5740
|
+
} else {
|
|
5741
|
+
// Assume the user forgot a leading 0
|
|
5742
|
+
// Example: we are changing '25:--' to '02:5-'
|
|
5743
|
+
timeStringCorrector.prependCharacter('0');
|
|
5744
|
+
}
|
|
5745
|
+
}
|
|
5746
|
+
if (timeStringCorrector.firstHourGreaterThan2()) {
|
|
5747
|
+
// Assume the user forgot a leading 0
|
|
5748
|
+
// Example: we are changing '3-:--' to '03:--'
|
|
5749
|
+
timeStringCorrector.prependCharacter('0');
|
|
5750
|
+
}
|
|
5751
|
+
if (timeStringCorrector.firstMinuteGreaterThan5()) {
|
|
5752
|
+
// Assume the user forgot a 0
|
|
5753
|
+
// Example: we are changing 12:6- to 12:06
|
|
5754
|
+
timeStringCorrector.shiftMinutesRight();
|
|
5755
|
+
}
|
|
5756
|
+
return {
|
|
5757
|
+
correctedTime: timeStringCorrector.getTimeString(),
|
|
5758
|
+
selectionModifier: timeStringCorrector.getSelectionModifier()
|
|
5759
|
+
};
|
|
5558
5760
|
};
|
|
5559
5761
|
|
|
5560
|
-
|
|
5762
|
+
// We will follow the same process to correct the time regardless
|
|
5763
|
+
// of what specific character changed.
|
|
5764
|
+
// This simplifies logic for when multiple chars are pasted in
|
|
5765
|
+
// and for when the input has to be shifted due to invalid entries.
|
|
5766
|
+
const correctTime = (time, is24HourClock, mustCompleteTime) => is24HourClock ? correct24HourTime(time, mustCompleteTime) : correct12HourTime(time, mustCompleteTime);
|
|
5767
|
+
|
|
5768
|
+
const TimeInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
5561
5769
|
let {
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5770
|
+
onChange,
|
|
5771
|
+
ariaExpanded,
|
|
5772
|
+
userInput,
|
|
5773
|
+
handleKeyDown,
|
|
5774
|
+
setIsFlyoutOpen,
|
|
5775
|
+
setShouldMoveSelectionToEnd,
|
|
5776
|
+
shouldMoveSelectionToEnd,
|
|
5569
5777
|
isInvalid,
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
const
|
|
5583
|
-
|
|
5584
|
-
|
|
5778
|
+
isDisabled,
|
|
5779
|
+
is24HourClock,
|
|
5780
|
+
id,
|
|
5781
|
+
dataTestId,
|
|
5782
|
+
ariaControls,
|
|
5783
|
+
ariaActiveDescendant,
|
|
5784
|
+
ariaLabel,
|
|
5785
|
+
ariaLabelledBy,
|
|
5786
|
+
ariaDescribedBy,
|
|
5787
|
+
isOptionHovered
|
|
5788
|
+
} = _ref;
|
|
5789
|
+
const mask24 = '99:99';
|
|
5790
|
+
const mask12 = '99:99 am';
|
|
5791
|
+
const mask = is24HourClock ? mask24 : mask12;
|
|
5792
|
+
return /*#__PURE__*/React__default["default"].createElement(InputMask__default["default"], {
|
|
5793
|
+
value: userInput,
|
|
5794
|
+
onChange: e => onChange(e.target.value),
|
|
5795
|
+
disabled: isDisabled,
|
|
5796
|
+
alwaysShowMask: true,
|
|
5797
|
+
formatChars: {
|
|
5798
|
+
'9': '[0-9]',
|
|
5799
|
+
a: '[AaPp]',
|
|
5800
|
+
m: '[Mm]'
|
|
5801
|
+
},
|
|
5802
|
+
maskChar: "-",
|
|
5803
|
+
mask: mask,
|
|
5804
|
+
beforeMaskedValueChange: next => {
|
|
5805
|
+
const {
|
|
5806
|
+
correctedTime,
|
|
5807
|
+
selectionModifier
|
|
5808
|
+
} = correctTime(next.value, is24HourClock, false);
|
|
5809
|
+
const newSelection = next === null || next === void 0 ? void 0 : next.selection;
|
|
5810
|
+
if (newSelection) {
|
|
5811
|
+
const validTimeLength = mask.length;
|
|
5812
|
+
newSelection.start = shouldMoveSelectionToEnd ? validTimeLength : newSelection.start;
|
|
5813
|
+
newSelection.end = shouldMoveSelectionToEnd ? validTimeLength : newSelection.end;
|
|
5814
|
+
newSelection.start = Math.min(newSelection.start + selectionModifier, validTimeLength);
|
|
5815
|
+
newSelection.end = Math.min(newSelection.end + selectionModifier, validTimeLength);
|
|
5816
|
+
}
|
|
5817
|
+
setShouldMoveSelectionToEnd(false);
|
|
5818
|
+
return {
|
|
5819
|
+
...next,
|
|
5820
|
+
value: correctedTime,
|
|
5821
|
+
selection: newSelection
|
|
5822
|
+
};
|
|
5823
|
+
}
|
|
5824
|
+
}, () => /*#__PURE__*/React__default["default"].createElement(index.Input$1, {
|
|
5825
|
+
id: id,
|
|
5826
|
+
disabled: isDisabled,
|
|
5827
|
+
role: "combobox",
|
|
5828
|
+
"aria-expanded": ariaExpanded,
|
|
5829
|
+
"aria-controls": ariaControls,
|
|
5830
|
+
ref: ref,
|
|
5831
|
+
className: classNames__default["default"](styles$1.input, {
|
|
5832
|
+
[styles$1.ignoreFocusStyle]: !!ariaActiveDescendant || isOptionHovered
|
|
5833
|
+
}),
|
|
5834
|
+
"aria-invalid": isInvalid,
|
|
5835
|
+
onKeyDown: handleKeyDown,
|
|
5836
|
+
onClick: () => setIsFlyoutOpen(true),
|
|
5837
|
+
"aria-label": ariaLabel,
|
|
5838
|
+
"aria-labelledby": ariaLabelledBy,
|
|
5839
|
+
"aria-describedby": ariaDescribedBy,
|
|
5840
|
+
"aria-activedescendant": ariaActiveDescendant,
|
|
5841
|
+
"data-testid": dataTestId && "".concat(dataTestId, "-input")
|
|
5842
|
+
}));
|
|
5843
|
+
});
|
|
5844
|
+
|
|
5845
|
+
const TimePickerIcon = _ref => {
|
|
5846
|
+
let {
|
|
5847
|
+
isOpen,
|
|
5848
|
+
isDisabled,
|
|
5849
|
+
setIsFlyoutOpen,
|
|
5850
|
+
iconRef,
|
|
5851
|
+
inputRef
|
|
5852
|
+
} = _ref;
|
|
5853
|
+
return /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
5854
|
+
"aria-hidden": "true",
|
|
5855
|
+
tabIndex: -1,
|
|
5856
|
+
disabled: isDisabled,
|
|
5857
|
+
className: classNames__default["default"](styles$1.icon, {
|
|
5858
|
+
[styles$1.open]: isOpen
|
|
5859
|
+
})
|
|
5860
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronDownIcon, {
|
|
5861
|
+
onClick: !isDisabled ? () => {
|
|
5862
|
+
var _inputRef$current;
|
|
5863
|
+
setIsFlyoutOpen(i => !i);
|
|
5864
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
5865
|
+
} : undefined,
|
|
5866
|
+
onMouseDown: e => e.preventDefault(),
|
|
5867
|
+
ref: iconRef
|
|
5868
|
+
}));
|
|
5869
|
+
};
|
|
5870
|
+
|
|
5871
|
+
const DEFAULT_TIME = (() => {
|
|
5872
|
+
const now = new Date();
|
|
5873
|
+
const hour = now.getHours();
|
|
5874
|
+
const minute = now.getMinutes();
|
|
5875
|
+
return {
|
|
5876
|
+
hour,
|
|
5877
|
+
minute
|
|
5878
|
+
};
|
|
5879
|
+
})();
|
|
5880
|
+
const TimePicker = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
5881
|
+
let {
|
|
5882
|
+
value: externalValue,
|
|
5883
|
+
onChange: externalOnChange,
|
|
5884
|
+
is24HourClock = false,
|
|
5885
|
+
isDisabled = false,
|
|
5886
|
+
isInvalid = false,
|
|
5887
|
+
id: externalId,
|
|
5888
|
+
'data-testid': dataTestId,
|
|
5889
|
+
'aria-label': ariaLabel,
|
|
5890
|
+
'aria-labelledby': ariaLabelledBy,
|
|
5891
|
+
'aria-describedby': ariaDescribedBy
|
|
5892
|
+
} = _ref;
|
|
5893
|
+
const timePickerId = index.useId(externalId);
|
|
5894
|
+
const inputId = "".concat(timePickerId, "-input");
|
|
5895
|
+
const dropdownId = "".concat(timePickerId, "-dropdown");
|
|
5896
|
+
const [isOptionHovered, setIsOptionHovered] = React.useState(false);
|
|
5897
|
+
const [timeObject, setTimeObject] = index.useControllableState(DEFAULT_TIME, externalOnChange, externalValue);
|
|
5898
|
+
const defaultTimeString = convertTimeObjectToTimeString(timeObject, is24HourClock);
|
|
5899
|
+
|
|
5900
|
+
// timeString needs its own state instead of always being derived from timeObject, since typing doesn't "commit" a new time.
|
|
5901
|
+
const [timeString, setTimeString] = React.useState(defaultTimeString);
|
|
5902
|
+
const [isTimeStringDirty, setIsTimeStringDirty] = React.useState(false);
|
|
5903
|
+
const step = 60 * 30;
|
|
5904
|
+
const dropdownItems = React.useMemo(() => generateTimes(step, is24HourClock), [is24HourClock, step]);
|
|
5905
|
+
const getScrolledToItemFromTimeString = React.useCallback(typedTime => {
|
|
5906
|
+
const {
|
|
5907
|
+
correctedTime
|
|
5908
|
+
} = correctTime(typedTime, is24HourClock, true);
|
|
5909
|
+
const correctedTimeObject = convertTimeStringToTimeObject(correctedTime);
|
|
5910
|
+
const correctedTimeValue = correctedTimeObject.hour * 60 * 60 + correctedTimeObject.minute * 60;
|
|
5911
|
+
let minDistance = correctedTimeValue - dropdownItems[0].value;
|
|
5912
|
+
// Substring search up to first empty spot
|
|
5913
|
+
for (let i = 1; i < dropdownItems.length; i += 1) {
|
|
5914
|
+
const distance = correctedTimeValue - dropdownItems[i].value;
|
|
5915
|
+
if (distance > minDistance || distance < 0) {
|
|
5916
|
+
return {
|
|
5917
|
+
index: i - 1,
|
|
5918
|
+
isFocused: false,
|
|
5919
|
+
isExactMatch: minDistance === 0
|
|
5920
|
+
};
|
|
5921
|
+
}
|
|
5922
|
+
minDistance = distance;
|
|
5923
|
+
}
|
|
5924
|
+
return {
|
|
5925
|
+
index: dropdownItems.length - 1,
|
|
5926
|
+
isFocused: false,
|
|
5927
|
+
isExactMatch: minDistance === 0
|
|
5928
|
+
};
|
|
5929
|
+
}, [is24HourClock, dropdownItems]);
|
|
5930
|
+
const [scrolledToItem, setScrolledToItem] = React.useState(() => getScrolledToItemFromTimeString(timeString));
|
|
5931
|
+
const [shouldMoveSelectionToEnd, setShouldMoveSelectionToEnd] = React.useState(true);
|
|
5932
|
+
|
|
5933
|
+
// timeObject may be controlled and may change at any time, so we need to update timeString and the focused item whenever it changes.
|
|
5934
|
+
React.useEffect(() => {
|
|
5935
|
+
const newTimeString = convertTimeObjectToTimeString(timeObject, is24HourClock);
|
|
5936
|
+
setTimeString(newTimeString);
|
|
5937
|
+
setIsTimeStringDirty(false);
|
|
5938
|
+
setShouldMoveSelectionToEnd(true);
|
|
5939
|
+
setScrolledToItem(getScrolledToItemFromTimeString(newTimeString));
|
|
5940
|
+
}, [timeObject, is24HourClock, getScrolledToItemFromTimeString]);
|
|
5941
|
+
const [isFlyoutOpen, setIsFlyoutOpen] = React.useState(false);
|
|
5942
|
+
|
|
5943
|
+
// Sets the actual time object and updates the flyout and focus state
|
|
5944
|
+
const commitTimeString = function () {
|
|
5945
|
+
let newTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : timeString;
|
|
5946
|
+
const {
|
|
5947
|
+
correctedTime
|
|
5948
|
+
} = correctTime(newTime, is24HourClock, true);
|
|
5949
|
+
const newTimeObject = convertTimeStringToTimeObject(correctedTime);
|
|
5950
|
+
setTimeObject(newTimeObject);
|
|
5951
|
+
setIsFlyoutOpen(false);
|
|
5952
|
+
};
|
|
5953
|
+
const inputRef = React.useRef(null);
|
|
5954
|
+
const dropdownRef = React.useRef(null);
|
|
5955
|
+
const iconRef = React.useRef(null);
|
|
5956
|
+
index.useClickOutside([inputRef, dropdownRef, iconRef], () => isTimeStringDirty ? commitTimeString() : setIsFlyoutOpen(false));
|
|
5957
|
+
const focusNext = () => {
|
|
5958
|
+
setScrolledToItem(f => {
|
|
5959
|
+
if (!f.isFocused) {
|
|
5960
|
+
// Focus just moved from input to listbox.
|
|
5961
|
+
// Move to item that was highlighted based on user input
|
|
5962
|
+
return {
|
|
5963
|
+
index: f.index,
|
|
5964
|
+
isFocused: true,
|
|
5965
|
+
isExactMatch: false
|
|
5966
|
+
};
|
|
5967
|
+
}
|
|
5968
|
+
if (f.index === dropdownItems.length - 1) {
|
|
5969
|
+
return f;
|
|
5970
|
+
}
|
|
5971
|
+
return {
|
|
5972
|
+
index: f.index + 1,
|
|
5973
|
+
isFocused: true,
|
|
5974
|
+
isExactMatch: false
|
|
5975
|
+
};
|
|
5976
|
+
});
|
|
5977
|
+
};
|
|
5978
|
+
const focusPrevious = () => {
|
|
5979
|
+
setScrolledToItem(f => {
|
|
5980
|
+
if (!f.isFocused) {
|
|
5981
|
+
// Focus just moved from input to listbox
|
|
5982
|
+
// Move to last item on arrowUp.
|
|
5983
|
+
return {
|
|
5984
|
+
index: dropdownItems.length - 1,
|
|
5985
|
+
isFocused: true,
|
|
5986
|
+
isExactMatch: false
|
|
5987
|
+
};
|
|
5988
|
+
}
|
|
5989
|
+
if (f.index === 0) {
|
|
5990
|
+
return f;
|
|
5991
|
+
}
|
|
5992
|
+
return {
|
|
5993
|
+
index: f.index - 1,
|
|
5994
|
+
isFocused: true,
|
|
5995
|
+
isExactMatch: false
|
|
5996
|
+
};
|
|
5997
|
+
});
|
|
5998
|
+
};
|
|
5999
|
+
const handleType = typedTime => {
|
|
6000
|
+
setIsFlyoutOpen(true);
|
|
6001
|
+
setTimeString(typedTime);
|
|
6002
|
+
setIsTimeStringDirty(true);
|
|
6003
|
+
setScrolledToItem(getScrolledToItemFromTimeString(typedTime));
|
|
6004
|
+
};
|
|
6005
|
+
const handleSelectTime = selectedIndex => {
|
|
6006
|
+
const timeLabel = dropdownItems[selectedIndex].label;
|
|
6007
|
+
setIsOptionHovered(false);
|
|
6008
|
+
commitTimeString(timeLabel);
|
|
6009
|
+
};
|
|
6010
|
+
const handleKeyDown = e => {
|
|
6011
|
+
switch (e.key) {
|
|
6012
|
+
case 'ArrowUp':
|
|
6013
|
+
e.preventDefault();
|
|
6014
|
+
setIsFlyoutOpen(true);
|
|
6015
|
+
focusPrevious();
|
|
6016
|
+
break;
|
|
6017
|
+
case 'ArrowDown':
|
|
6018
|
+
e.preventDefault();
|
|
6019
|
+
setIsFlyoutOpen(true);
|
|
6020
|
+
focusNext();
|
|
6021
|
+
break;
|
|
6022
|
+
case 'Enter':
|
|
6023
|
+
e.preventDefault();
|
|
6024
|
+
if (scrolledToItem !== null && scrolledToItem !== void 0 && scrolledToItem.isFocused) {
|
|
6025
|
+
// "Focus" is on the listbox
|
|
6026
|
+
handleSelectTime(scrolledToItem.index);
|
|
6027
|
+
} else {
|
|
6028
|
+
// "Focus" is on the input
|
|
6029
|
+
commitTimeString();
|
|
6030
|
+
}
|
|
6031
|
+
break;
|
|
6032
|
+
case 'Escape':
|
|
6033
|
+
// Prevent Safari from exiting full-screen mode
|
|
6034
|
+
if (isFlyoutOpen) e.preventDefault();
|
|
6035
|
+
// Use whatever time is closest to what's in the input
|
|
6036
|
+
commitTimeString();
|
|
6037
|
+
break;
|
|
6038
|
+
case 'Tab':
|
|
6039
|
+
// Use whatever time is closest to what's in the input
|
|
6040
|
+
commitTimeString();
|
|
6041
|
+
break;
|
|
6042
|
+
default:
|
|
6043
|
+
break;
|
|
6044
|
+
}
|
|
5585
6045
|
};
|
|
5586
|
-
return /*#__PURE__*/React__default["default"].createElement(MenuButton, _extends__default["default"]({}, rest, sharedMenuButtonProps, {
|
|
5587
|
-
"aria-haspopup": "tree",
|
|
5588
|
-
role: "combobox",
|
|
5589
|
-
className: classNames__default["default"]({
|
|
5590
|
-
[styles$3.isInvalid]: isInvalid
|
|
5591
|
-
})
|
|
5592
|
-
}), children !== null && children !== void 0 ? children : selectedSelectItems !== null && selectedSelectItems !== void 0 && selectedSelectItems.size ? selectedItemsString : placeholder);
|
|
5593
|
-
});
|
|
5594
|
-
|
|
5595
|
-
const GridChildrenWrapper = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
5596
|
-
let {
|
|
5597
|
-
asChild,
|
|
5598
|
-
style,
|
|
5599
|
-
'data-testid': dataTestId,
|
|
5600
|
-
children
|
|
5601
|
-
} = _ref;
|
|
5602
|
-
if (asChild && /*#__PURE__*/React.isValidElement(children)) {
|
|
5603
|
-
return /*#__PURE__*/React.cloneElement(children, {
|
|
5604
|
-
style: {
|
|
5605
|
-
...children.props.style,
|
|
5606
|
-
...style
|
|
5607
|
-
},
|
|
5608
|
-
ref: index.mergeRefs(children.ref, ref)
|
|
5609
|
-
});
|
|
5610
|
-
}
|
|
5611
6046
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
6047
|
+
id: timePickerId,
|
|
6048
|
+
className: styles$1.timePickerContainer
|
|
6049
|
+
}, /*#__PURE__*/React__default["default"].createElement(TimeInput, {
|
|
6050
|
+
id: inputId,
|
|
6051
|
+
dataTestId: dataTestId,
|
|
6052
|
+
ariaActiveDescendant: isFlyoutOpen && scrolledToItem !== null && scrolledToItem !== void 0 && scrolledToItem.isFocused ? dropdownItems[scrolledToItem.index].id : undefined,
|
|
6053
|
+
ariaControls: dropdownId,
|
|
6054
|
+
ariaExpanded: isFlyoutOpen,
|
|
6055
|
+
onChange: handleType,
|
|
6056
|
+
userInput: timeString,
|
|
6057
|
+
handleKeyDown: handleKeyDown,
|
|
6058
|
+
setIsFlyoutOpen: setIsFlyoutOpen,
|
|
6059
|
+
isDisabled: isDisabled,
|
|
6060
|
+
is24HourClock: is24HourClock,
|
|
6061
|
+
isInvalid: isInvalid,
|
|
6062
|
+
ariaLabel: ariaLabel,
|
|
6063
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
6064
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
6065
|
+
isOptionHovered: isOptionHovered,
|
|
6066
|
+
setShouldMoveSelectionToEnd: setShouldMoveSelectionToEnd,
|
|
6067
|
+
shouldMoveSelectionToEnd: shouldMoveSelectionToEnd,
|
|
6068
|
+
ref: index.mergeRefs(ref, inputRef)
|
|
6069
|
+
}), /*#__PURE__*/React__default["default"].createElement(TimePickerIcon, {
|
|
6070
|
+
isOpen: isFlyoutOpen,
|
|
6071
|
+
isDisabled: isDisabled,
|
|
6072
|
+
setIsFlyoutOpen: setIsFlyoutOpen,
|
|
6073
|
+
iconRef: iconRef,
|
|
6074
|
+
inputRef: inputRef
|
|
6075
|
+
}), isFlyoutOpen && /*#__PURE__*/React__default["default"].createElement(TimeDropdown, {
|
|
6076
|
+
id: dropdownId,
|
|
6077
|
+
inputRef: inputRef,
|
|
6078
|
+
dropdownRef: dropdownRef,
|
|
6079
|
+
onClick: handleSelectTime,
|
|
6080
|
+
scrolledToItem: scrolledToItem,
|
|
6081
|
+
items: dropdownItems,
|
|
6082
|
+
dataTestId: dataTestId,
|
|
6083
|
+
ariaLabel: ariaLabel,
|
|
6084
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
6085
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
6086
|
+
setIsOptionHovered: setIsOptionHovered,
|
|
6087
|
+
isOptionHovered: isOptionHovered
|
|
6088
|
+
}));
|
|
5618
6089
|
});
|
|
5619
6090
|
|
|
5620
|
-
const
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
columnGap,
|
|
5625
|
-
rowGap,
|
|
5626
|
-
gap,
|
|
5627
|
-
rowHeights,
|
|
5628
|
-
columnWidths,
|
|
5629
|
-
areas,
|
|
5630
|
-
area,
|
|
5631
|
-
asChild = false,
|
|
5632
|
-
'data-testid': dataTestId,
|
|
5633
|
-
children
|
|
5634
|
-
} = _ref;
|
|
5635
|
-
const calculatedStyle = {
|
|
5636
|
-
display: 'grid',
|
|
5637
|
-
columnGap,
|
|
5638
|
-
rowGap,
|
|
5639
|
-
gridGap: gap,
|
|
5640
|
-
gridTemplateRows: convertGridTemplateRowsOrColumns(rowHeights),
|
|
5641
|
-
gridTemplateColumns: convertGridTemplateRowsOrColumns(columnWidths),
|
|
5642
|
-
gridTemplateAreas: convertGridTemplateAreas(areas),
|
|
5643
|
-
gridArea: area
|
|
5644
|
-
};
|
|
5645
|
-
return /*#__PURE__*/React__default["default"].createElement(GridChildrenWrapper, {
|
|
5646
|
-
asChild: asChild,
|
|
5647
|
-
style: calculatedStyle,
|
|
5648
|
-
"data-testid": dataTestId,
|
|
5649
|
-
ref: ref
|
|
5650
|
-
}, children);
|
|
5651
|
-
});
|
|
6091
|
+
const {
|
|
6092
|
+
useContext: useToggleButtonGroupContext,
|
|
6093
|
+
Provider: ToggleButtonGroupContextProvider
|
|
6094
|
+
} = index.createContextUtilities(null);
|
|
5652
6095
|
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
'data-testid': dataTestId,
|
|
5658
|
-
children
|
|
5659
|
-
} = _ref;
|
|
5660
|
-
const calculatedStyle = {
|
|
5661
|
-
gridArea: area
|
|
5662
|
-
};
|
|
5663
|
-
return /*#__PURE__*/React__default["default"].createElement(GridChildrenWrapper, {
|
|
5664
|
-
asChild: asChild,
|
|
5665
|
-
style: calculatedStyle,
|
|
5666
|
-
"data-testid": dataTestId,
|
|
5667
|
-
ref: ref
|
|
5668
|
-
}, children);
|
|
5669
|
-
});
|
|
6096
|
+
var css_248z = "._I3Wby{border-color:transparent;background-color:transparent;color:#515559;cursor:pointer}._f5cIL{background-color:rgba(50,54,58,.08)}._QcHKu{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._1Y5xs{color:rgba(81,85,89,.4);cursor:not-allowed}._5YR9F{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._bZvc2{color:#085caf;border-color:#085caf}._808KD,._bZvc2{background:rgba(11,110,208,.11)}._808KD{color:#0854a1;border-color:#0854a1}._zh73S{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._wGU4f{position:relative;display:inline-grid}._wGU4f svg{fill:currentColor}._wGU4f ._9rTIm{-webkit-appearance:none;-moz-appearance:none;appearance:none;grid-column:1;grid-row:1}._wGU4f ._9rTIm+._B6PXc{background-color:transparent;color:#515559;cursor:pointer;border:1px solid transparent;border-radius:4px;grid-column:1;grid-row:1;padding:0;min-width:76px;-webkit-user-select:none;-moz-user-select:none;user-select:none}._wGU4f ._9rTIm+._B6PXc._6nXow{padding:5px;max-width:36px;min-width:36px}._wGU4f ._9rTIm+._B6PXc._znJ-v{padding:0 16px}._wGU4f ._9rTIm+._B6PXc._AZPJR{padding:0 16px 0 12px}._wGU4f ._9rTIm:hover+._B6PXc{background-color:rgba(50,54,58,.08)}._wGU4f ._9rTIm:disabled+._B6PXc{color:rgba(81,85,89,.4);cursor:not-allowed}._wGU4f ._9rTIm:active+._B6PXc,._wGU4f ._9rTIm:focus:active+._B6PXc{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._wGU4f ._9rTIm:checked+._B6PXc{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._wGU4f ._9rTIm:checked:hover+._B6PXc{background:rgba(11,110,208,.11);color:#085caf;border-color:#085caf}._wGU4f ._9rTIm:checked:disabled+._B6PXc{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._wGU4f ._9rTIm:checked:active+._B6PXc,._wGU4f ._9rTIm:checked:focus:active+._B6PXc{background:rgba(11,110,208,.11);color:#0854a1;border-color:#0854a1}._N4WjV{display:inline-flex;position:relative}._N4WjV:before{content:\"\";border:1px solid #d9d9d9;border-radius:4px;position:absolute;top:0;bottom:0;right:0;left:0}._N4WjV>*{flex-shrink:0;flex-grow:0}._e0yg8{border:none;margin:0;padding:0}._e0yg8 legend{padding:0;display:block;font-size:14px;margin-bottom:6px;color:#515559}._wGU4f ._9rTIm.focus-visible+._B6PXc,._wGU4f ._9rTIm:focus-visible+._B6PXc{z-index:20;outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
6097
|
+
var styles = {"default":"_I3Wby","hovered":"_f5cIL","pressed":"_QcHKu","disabled":"_1Y5xs","selectedDefault":"_5YR9F","selectedHovered":"_bZvc2","selectedPressed":"_808KD","selectedDisabled":"_zh73S","toggleContainer":"_wGU4f","toggleInput":"_9rTIm","toggleButton":"_B6PXc","iconOnly":"_6nXow","text":"_znJ-v","iconText":"_AZPJR","toggleButtonGroup":"_N4WjV","toggleButtonGroupFieldset":"_e0yg8"};
|
|
6098
|
+
var stylesheet="._I3Wby{border-color:transparent;background-color:transparent;color:#515559;cursor:pointer}._f5cIL{background-color:rgba(50,54,58,.08)}._QcHKu{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._1Y5xs{color:rgba(81,85,89,.4);cursor:not-allowed}._5YR9F{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._bZvc2{color:#085caf;border-color:#085caf}._808KD,._bZvc2{background:rgba(11,110,208,.11)}._808KD{color:#0854a1;border-color:#0854a1}._zh73S{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._wGU4f{position:relative;display:inline-grid}._wGU4f svg{fill:currentColor}._wGU4f ._9rTIm{-webkit-appearance:none;-moz-appearance:none;appearance:none;grid-column:1;grid-row:1}._wGU4f ._9rTIm+._B6PXc{background-color:transparent;color:#515559;cursor:pointer;border:1px solid transparent;border-radius:4px;grid-column:1;grid-row:1;padding:0;min-width:76px;-webkit-user-select:none;-moz-user-select:none;user-select:none}._wGU4f ._9rTIm+._B6PXc._6nXow{padding:5px;max-width:36px;min-width:36px}._wGU4f ._9rTIm+._B6PXc._znJ-v{padding:0 16px}._wGU4f ._9rTIm+._B6PXc._AZPJR{padding:0 16px 0 12px}._wGU4f ._9rTIm:hover+._B6PXc{background-color:rgba(50,54,58,.08)}._wGU4f ._9rTIm:disabled+._B6PXc{color:rgba(81,85,89,.4);cursor:not-allowed}._wGU4f ._9rTIm:active+._B6PXc,._wGU4f ._9rTIm:focus:active+._B6PXc{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._wGU4f ._9rTIm:checked+._B6PXc{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._wGU4f ._9rTIm:checked:hover+._B6PXc{background:rgba(11,110,208,.11);color:#085caf;border-color:#085caf}._wGU4f ._9rTIm:checked:disabled+._B6PXc{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._wGU4f ._9rTIm:checked:active+._B6PXc,._wGU4f ._9rTIm:checked:focus:active+._B6PXc{background:rgba(11,110,208,.11);color:#0854a1;border-color:#0854a1}._N4WjV{display:inline-flex;position:relative}._N4WjV:before{content:\"\";border:1px solid #d9d9d9;border-radius:4px;position:absolute;top:0;bottom:0;right:0;left:0}._N4WjV>*{flex-shrink:0;flex-grow:0}._e0yg8{border:none;margin:0;padding:0}._e0yg8 legend{padding:0;display:block;font-size:14px;margin-bottom:6px;color:#515559}._wGU4f ._9rTIm.focus-visible+._B6PXc,._wGU4f ._9rTIm:focus-visible+._B6PXc{z-index:20;outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
6099
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z);}
|
|
5670
6100
|
|
|
5671
|
-
const
|
|
6101
|
+
const ToggleButtonGroup = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
5672
6102
|
let {
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
'data-testid': dataTestId,
|
|
5682
|
-
children
|
|
6103
|
+
children,
|
|
6104
|
+
value,
|
|
6105
|
+
onChange,
|
|
6106
|
+
name,
|
|
6107
|
+
label,
|
|
6108
|
+
isDisabled,
|
|
6109
|
+
'aria-label': ariaLabel,
|
|
6110
|
+
'aria-labelledby': ariaLabelledby
|
|
5683
6111
|
} = _ref;
|
|
5684
|
-
const
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
6112
|
+
const backupName = index.useId();
|
|
6113
|
+
return /*#__PURE__*/React__default["default"].createElement(ToggleButtonGroupContextProvider, {
|
|
6114
|
+
value: {
|
|
6115
|
+
value,
|
|
6116
|
+
onChange,
|
|
6117
|
+
name: name || backupName,
|
|
6118
|
+
isDisabled
|
|
6119
|
+
}
|
|
6120
|
+
}, /*#__PURE__*/React__default["default"].createElement("fieldset", {
|
|
6121
|
+
className: styles.toggleButtonGroupFieldset,
|
|
6122
|
+
disabled: isDisabled
|
|
6123
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
|
|
6124
|
+
,
|
|
6125
|
+
role: "radiogroup",
|
|
6126
|
+
"aria-label": ariaLabel,
|
|
6127
|
+
"aria-labelledby": ariaLabelledby,
|
|
5696
6128
|
ref: ref
|
|
5697
|
-
},
|
|
6129
|
+
}, label && /*#__PURE__*/React__default["default"].createElement("legend", null, label), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
6130
|
+
className: styles.toggleButtonGroup
|
|
6131
|
+
}, children)));
|
|
5698
6132
|
});
|
|
5699
6133
|
|
|
5700
|
-
const
|
|
6134
|
+
const ToggleButton = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
5701
6135
|
let {
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
6136
|
+
children,
|
|
6137
|
+
isActivated = false,
|
|
6138
|
+
onChange,
|
|
6139
|
+
value,
|
|
6140
|
+
isDisabled = false,
|
|
6141
|
+
kind = 'icon-text',
|
|
6142
|
+
'aria-label': ariaLabel,
|
|
6143
|
+
'aria-labelledby': ariaLabelledby,
|
|
6144
|
+
name: inputName,
|
|
6145
|
+
dataTestId
|
|
5705
6146
|
} = _ref;
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
6147
|
+
const id = index.useId();
|
|
6148
|
+
const groupContext = useToggleButtonGroupContext();
|
|
6149
|
+
const inGroup = groupContext !== null;
|
|
6150
|
+
let checked = isActivated;
|
|
6151
|
+
let disabled = isDisabled;
|
|
6152
|
+
let name = inputName;
|
|
6153
|
+
let handleChange = () => {
|
|
6154
|
+
if (onChange) {
|
|
6155
|
+
onChange(checked);
|
|
6156
|
+
}
|
|
6157
|
+
};
|
|
6158
|
+
if (inGroup) {
|
|
6159
|
+
checked = value === groupContext.value;
|
|
6160
|
+
disabled = groupContext.isDisabled || isDisabled;
|
|
6161
|
+
name = groupContext.name;
|
|
6162
|
+
handleChange = () => {
|
|
6163
|
+
if (onChange) {
|
|
6164
|
+
onChange(checked);
|
|
6165
|
+
}
|
|
6166
|
+
groupContext.onChange(value);
|
|
6167
|
+
};
|
|
6168
|
+
}
|
|
6169
|
+
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
6170
|
+
ref: ref,
|
|
6171
|
+
className: styles.toggleContainer
|
|
6172
|
+
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
6173
|
+
type: inGroup ? 'radio' : 'checkbox',
|
|
6174
|
+
name: name,
|
|
6175
|
+
checked: checked,
|
|
6176
|
+
onChange: handleChange,
|
|
6177
|
+
id: id,
|
|
6178
|
+
disabled: disabled,
|
|
6179
|
+
value: value,
|
|
6180
|
+
className: styles.toggleInput,
|
|
6181
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'input'),
|
|
6182
|
+
role: inGroup ? undefined : 'button',
|
|
6183
|
+
"aria-pressed": inGroup ? undefined : checked,
|
|
6184
|
+
"aria-label": ariaLabel,
|
|
6185
|
+
"aria-labelledby": ariaLabelledby
|
|
6186
|
+
}), /*#__PURE__*/React__default["default"].createElement("label", {
|
|
6187
|
+
htmlFor: id,
|
|
6188
|
+
className: classNames__default["default"]([index.buttonStyles.btn, styles.toggleButton], {
|
|
6189
|
+
[styles.iconOnly]: kind === 'icon',
|
|
6190
|
+
[styles.textOnly]: kind === 'text',
|
|
6191
|
+
[styles.iconText]: kind === 'icon-text'
|
|
6192
|
+
}),
|
|
6193
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'label')
|
|
6194
|
+
}, children));
|
|
5711
6195
|
});
|
|
5712
6196
|
|
|
5713
6197
|
/* eslint-disable camelcase */
|
|
5714
6198
|
|
|
5715
6199
|
exports.Input = index.Input$1;
|
|
6200
|
+
exports.useFormField = index.useFormField;
|
|
5716
6201
|
exports.AdvancedTable = AdvancedTable;
|
|
5717
6202
|
exports.CollapsibleSearchInput = CollapsibleSearchInput;
|
|
5718
6203
|
exports.CollectionGrid = CollectionGrid;
|
|
@@ -5731,7 +6216,9 @@ exports.Menu = Menu;
|
|
|
5731
6216
|
exports.MenuButton = MenuButton;
|
|
5732
6217
|
exports.MenuItem = MenuItem$1;
|
|
5733
6218
|
exports.MenuPane = MenuPane;
|
|
6219
|
+
exports.Pagination = Pagination;
|
|
5734
6220
|
exports.PhoneNumberInput = PhoneNumberInput;
|
|
6221
|
+
exports.RowDisplayCount = RowDisplayCount;
|
|
5735
6222
|
exports.Select = Select;
|
|
5736
6223
|
exports.SelectButton = SelectButton;
|
|
5737
6224
|
exports.SelectItem = SelectItem;
|
|
@@ -5745,3 +6232,4 @@ exports.TimePicker = TimePicker;
|
|
|
5745
6232
|
exports.ToggleButton = ToggleButton;
|
|
5746
6233
|
exports.ToggleButtonGroup = ToggleButtonGroup;
|
|
5747
6234
|
exports.VStack = VStack;
|
|
6235
|
+
exports.useForm = useForm;
|