@qualtrics/ui-react 2.28.0 → 2.30.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 +33 -0
- package/dist/__shared/cjs/{index-2ad33b44.js → index-30cc916b.js} +601 -391
- package/dist/__shared/cjs/{index-0c005184.js → index-e0e97b93.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/useOverlay.js +1 -0
- 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/Combobox.js +5 -2
- package/dist/next/Combobox/Combobox2.js +3 -3
- package/dist/next/Drawer/Drawer.js +3 -2
- 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 +171 -3
- package/dist/next/index.es.js +29 -23
- package/dist/next/index.js +1968 -1476
- 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-30cc916b.js');
|
|
12
|
+
var icons_index = require('../__shared/cjs/index-e0e97b93.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 = "._z3Ye0{overflow:auto;position:relative;max-width:100%;max-height:100%}._ljYb8,._z3Ye0{background-color:#fff}._ljYb8{height:70px;z-index:100;display:flex;align-items:flex-end;justify-content:center;position:-webkit-sticky;position:sticky;left:0}._DagMI{margin-bottom:4px}._aeY8-{position:-webkit-sticky;position:sticky;top:0;z-index:100}._4BXWr{display:flex}._4BXWr:focus{outline:none}._4BXWr.focus-visible ._EG-G4:after,._4BXWr:focus-visible ._EG-G4: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}._4BXWr.focus-visible ._EG-G4:last-of-type:after,._4BXWr:focus-visible ._EG-G4:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._4BXWr.focus-visible ._EG-G4:first-of-type:after,._4BXWr:focus-visible ._EG-G4:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._4BXWr.focus-visible ._EG-G4._b0ppg:after,._4BXWr:focus-visible ._EG-G4._b0ppg:after{right:-3px;bottom:1px}._lfcAx{padding-right:3px}._FnQtw{display:flex}._FnQtw._CHSF0 ._EG-G4,._FnQtw._CHSF0 ._jPr2x{cursor:pointer}._FnQtw._F0o7y ._EG-G4,._FnQtw._F0o7y ._jPr2x{background-color:rgba(11,110,208,.08);font-weight:500;box-shadow:inset 0 -1px 0 0 #0b6ed0}._FnQtw._F0o7y ._EG-G4._b0ppg,._FnQtw._F0o7y ._jPr2x._b0ppg{background-color:#fff;box-shadow:inset 0 -2px 0 0 #0b6ed0}._FnQtw._F0o7y ._EG-G4._b0ppg ._DQvjk,._FnQtw._F0o7y ._EG-G4._b0ppg ._jPr2x,._FnQtw._F0o7y ._EG-G4._b0ppg ._Pe-cd,._FnQtw._F0o7y ._jPr2x._b0ppg ._DQvjk,._FnQtw._F0o7y ._jPr2x._b0ppg ._jPr2x,._FnQtw._F0o7y ._jPr2x._b0ppg ._Pe-cd{background-color:rgba(11,110,208,.08)}._FnQtw._CHSF0:hover:not(._F0o7y) ._EG-G4,._FnQtw._CHSF0:hover:not(._F0o7y) ._jPr2x{background-color:#f9f9f9}._FnQtw._CHSF0:active:not(._F0o7y):not(._FnQtw._CHSF0:active:not(._F0o7y):has(._Pe-cd:active)) ._EG-G4,._FnQtw._CHSF0:active:not(._F0o7y):not(._FnQtw._CHSF0:active:not(._F0o7y):has(._Pe-cd:active)) ._jPr2x{background-color:#f3f3f3}._FnQtw:focus{outline:none}._FnQtw.focus-visible ._EG-G4:after,._FnQtw:focus-visible ._EG-G4: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}._FnQtw.focus-visible ._EG-G4:last-of-type:after,._FnQtw:focus-visible ._EG-G4:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._FnQtw.focus-visible ._EG-G4:first-of-type:after,._FnQtw:focus-visible ._EG-G4:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._FnQtw.focus-visible ._EG-G4._b0ppg:after,._FnQtw:focus-visible ._EG-G4._b0ppg:after{right:-3px;bottom:0}._FnQtw:last-of-type:focus{outline:none}._FnQtw:last-of-type.focus-visible ._EG-G4:after,._FnQtw:last-of-type:focus-visible ._EG-G4: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}._FnQtw:last-of-type.focus-visible ._EG-G4:last-of-type:after,._FnQtw:last-of-type:focus-visible ._EG-G4:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._FnQtw:last-of-type.focus-visible ._EG-G4:first-of-type:after,._FnQtw:last-of-type:focus-visible ._EG-G4:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._FnQtw:last-of-type.focus-visible ._EG-G4._b0ppg:after,._FnQtw:last-of-type:focus-visible ._EG-G4._b0ppg:after{right:-3px;bottom:1px}._FnQtw:last-of-type ._DQvjk:focus{outline:none}._FnQtw:last-of-type ._DQvjk._ldtOD.focus-visible:after,._FnQtw:last-of-type ._DQvjk._ldtOD:focus-visible:after,._FnQtw:last-of-type ._DQvjk.focus-visible:after,._FnQtw:last-of-type ._DQvjk: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}._FnQtw:first-of-type:focus{outline:none}._FnQtw:first-of-type.focus-visible ._EG-G4:after,._FnQtw:first-of-type:focus-visible ._EG-G4: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}._FnQtw:first-of-type.focus-visible ._EG-G4:last-of-type:after,._FnQtw:first-of-type:focus-visible ._EG-G4:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._FnQtw:first-of-type.focus-visible ._EG-G4:first-of-type:after,._FnQtw:first-of-type:focus-visible ._EG-G4:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._FnQtw:first-of-type.focus-visible ._EG-G4._b0ppg:after,._FnQtw:first-of-type:focus-visible ._EG-G4._b0ppg:after{right:-3px;bottom:0}._FnQtw:first-of-type ._DQvjk:focus{outline:none}._FnQtw:first-of-type ._DQvjk._ldtOD.focus-visible:after,._FnQtw:first-of-type ._DQvjk._ldtOD:focus-visible:after,._FnQtw:first-of-type ._DQvjk.focus-visible:after,._FnQtw:first-of-type ._DQvjk: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}._uKCXE{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}._uKCXE._8i3oQ{flex-grow:1}._uKCXE._p-gDZ{cursor:pointer}._uKCXE._p-gDZ:hover:not(._atGQR){background-color:#f9f9f9;border-bottom-color:#6a6d70}._uKCXE._p-gDZ:active:not(._atGQR){background-color:#f3f3f3}._uKCXE._KRtFL:not(._atGQR){color:#32363a;fill:#32363a;border-bottom-color:#8a8f94}._uKCXE._atGQR{cursor:move;background-color:#efefef;border-bottom-color:#ccc;border-top-left-radius:4px;border-top-right-radius:4px}._uKCXE ._9szvz{background-color:#d9d9d9;position:absolute;width:1px;top:0;pointer-events:none}._uKCXE ._9szvz._lzRda{left:-1px}._uKCXE ._9szvz._pMY9l{right:0}._uKCXE ._hPx-z{background-color:#0a6ed1;position:absolute;width:3px;top:4px;bottom:4px;border-radius:4px;pointer-events:none}._uKCXE ._hPx-z._lzRda{left:-2px}._uKCXE ._hPx-z._pMY9l{right:-1px}._uKCXE:first-of-type ._lzRda._9szvz{left:0;width:2px;border-left:1px solid #fff}._uKCXE:first-of-type ._lzRda._hPx-z{left:0}._uKCXE:last-of-type ._pMY9l._9szvz{right:0;width:2px;border-right:1px solid #fff}._uKCXE:last-of-type ._pMY9l._hPx-z{right:0}._uKCXE ._mqmJe{position:absolute;width:6px;right:-3px;top:0;cursor:ew-resize;z-index:50}._uKCXE ._mqmJe ._2M7nz{position:absolute;width:2px;right:2px;top:0;bottom:0}._uKCXE ._mqmJe ._2M7nz._ycZAp{background-color:#0a6ed1}._uKCXE ._mqmJe:hover ._2M7nz:not(._ycZAp){background-color:#d9d9d9}._uKCXE ._z9XFv{display:flex;flex-grow:1;align-items:center;min-width:0;padding:14px 0 13px 12px}._uKCXE ._z9XFv._lyl5e{flex-direction:row-reverse;justify-content:flex-start}._uKCXE ._z9XFv._lyl5e ._5en04{margin:1px 7px 1px 1px}._uKCXE ._z9XFv ._0heED{text-overflow:ellipsis;overflow:hidden;-webkit-hyphens:auto;hyphens:auto;pointer-events:none;overflow-wrap:break-word;display:-webkit-box;-webkit-box-orient:vertical}._uKCXE ._z9XFv ._5en04{margin:1px 1px 1px 7px;flex-shrink:0}._uKCXE ._SCrPU{margin-left:6px;margin-right:4px;flex-shrink:0}._uKCXE ._lkILN{pointer-events:none;position:absolute;top:0;left:0;bottom:0;right:0}._uKCXE:focus{outline:none}._uKCXE._ldtOD.focus-visible:after,._uKCXE._ldtOD:focus-visible:after,._uKCXE.focus-visible:after,._uKCXE: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}._2bz7e{margin-right:6px}._b0ppg{display:flex;border-right:3px solid #e5e5e5;position:-webkit-sticky;position:sticky;left:0;background-color:#fff;z-index:20}._b0ppg[focus-within]{z-index:30}._b0ppg:focus-within{z-index:30}._DQvjk{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}._DQvjk ._n66MY{width:100%;padding:12px 12px 11px;overflow:hidden}._DQvjk._atGQR{background-color:#efefef;border-bottom-color:#dfdfe1}._DQvjk._8i3oQ{flex-grow:1}._DQvjk:focus{outline:none}._DQvjk._ldtOD.focus-visible:after,._DQvjk._ldtOD:focus-visible:after,._DQvjk.focus-visible:after,._DQvjk: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}._jPr2x{display:flex!important;min-height:44px!important;align-items:center;justify-content:right;border-bottom:1px solid #eee;flex-shrink:0}._jPr2x._v6WyX{border-bottom-color:#d9d9d9;background-color:#fff}._Pe-cd{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}._Pe-cd._v6WyX{border-bottom-color:#d9d9d9;padding:14px 12px 13px}._Pe-cd:focus input~span,._Pe-cd:hover input~span{border-color:#0b6ed0}._Pe-cd ._XPhYN{position:relative;display:inline-flex}._Pe-cd ._XPhYN ._VNPCq{margin:0!important}._Pe-cd ._XPhYN ._r2IhR{position:absolute;top:3px;left:3px;height:10px;width:10px;border-radius:2px;background-color:#0b6ed0}._5dSQb{justify-content:flex-start}._Y4n9x{justify-content:center;text-align:center}._lyl5e{justify-content:flex-end;text-align:right}._yQpfl{display:none}._c-QdE{opacity:0;height:0;width:0;overflow:hidden}._6bLj8,._c-QdE{position:absolute}._6bLj8{cursor:move;background-color:rgba(11,110,208,.08);border-radius:4px;z-index:1000;pointer-events:none}._BJqT0{max-width:250px;min-width:150px!important}";
|
|
36
|
+
var styles$b = {"advancedTable":"_z3Ye0","advancedTablePaginationContainer":"_ljYb8","advancedTablePagination":"_DagMI","advancedTableColumnHeadersRowGroup":"_aeY8-","advancedTableColumnHeaders":"_4BXWr","advancedTableRowChild":"_EG-G4","pinnedContainer":"_b0ppg","advancedTableRowGroup":"_lfcAx","advancedTableRow":"_FnQtw","hasRowAction":"_CHSF0","advancedTableExpandRowSpacer":"_jPr2x","isSelected":"_F0o7y","advancedTableCheckbox":"_Pe-cd","advancedTableCell":"_DQvjk","showFocusRing":"_ldtOD","advancedTableColumnHeader":"_uKCXE","fillRemainingSpace":"_8i3oQ","isSortable":"_p-gDZ","isDragging":"_atGQR","isSorted":"_KRtFL","dropTargetLine":"_9szvz","dropTargetLeft":"_lzRda","dropTargetRight":"_pMY9l","dropTargetMarker":"_hPx-z","resizeHandle":"_mqmJe","resizeLine":"_2M7nz","isResizing":"_ycZAp","advancedTableColumnHeaderLabel":"_z9XFv","rightAligned":"_lyl5e","sortIcon":"_5en04","advancedTableColumnHeaderLabelText":"_0heED","advancedTableColumnHeaderMenu":"_SCrPU","advancedTableColumnHeaderMenuHiddenAnchor":"_lkILN","advancedTableColumnHeaderMenuItemIcon":"_2bz7e","advancedTableCellContainer":"_n66MY","header":"_v6WyX","checkboxContainer":"_XPhYN","checkbox":"_VNPCq","mixed":"_r2IhR","leftAligned":"_5dSQb","centerAligned":"_Y4n9x","hiddenDescription":"_yQpfl","hiddenLiveRegion":"_c-QdE","dragPreview":"_6bLj8","rowActionMenuPane":"_BJqT0"};
|
|
37
|
+
var stylesheet$c="._z3Ye0{overflow:auto;position:relative;max-width:100%;max-height:100%}._ljYb8,._z3Ye0{background-color:#fff}._ljYb8{height:70px;z-index:100;display:flex;align-items:flex-end;justify-content:center;position:-webkit-sticky;position:sticky;left:0}._DagMI{margin-bottom:4px}._aeY8-{position:-webkit-sticky;position:sticky;top:0;z-index:100}._4BXWr{display:flex}._4BXWr:focus{outline:none}._4BXWr.focus-visible ._EG-G4:after,._4BXWr:focus-visible ._EG-G4: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}._4BXWr.focus-visible ._EG-G4:last-of-type:after,._4BXWr:focus-visible ._EG-G4:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._4BXWr.focus-visible ._EG-G4:first-of-type:after,._4BXWr:focus-visible ._EG-G4:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._4BXWr.focus-visible ._EG-G4._b0ppg:after,._4BXWr:focus-visible ._EG-G4._b0ppg:after{right:-3px;bottom:1px}._lfcAx{padding-right:3px}._FnQtw{display:flex}._FnQtw._CHSF0 ._EG-G4,._FnQtw._CHSF0 ._jPr2x{cursor:pointer}._FnQtw._F0o7y ._EG-G4,._FnQtw._F0o7y ._jPr2x{background-color:rgba(11,110,208,.08);font-weight:500;box-shadow:inset 0 -1px 0 0 #0b6ed0}._FnQtw._F0o7y ._EG-G4._b0ppg,._FnQtw._F0o7y ._jPr2x._b0ppg{background-color:#fff;box-shadow:inset 0 -2px 0 0 #0b6ed0}._FnQtw._F0o7y ._EG-G4._b0ppg ._DQvjk,._FnQtw._F0o7y ._EG-G4._b0ppg ._jPr2x,._FnQtw._F0o7y ._EG-G4._b0ppg ._Pe-cd,._FnQtw._F0o7y ._jPr2x._b0ppg ._DQvjk,._FnQtw._F0o7y ._jPr2x._b0ppg ._jPr2x,._FnQtw._F0o7y ._jPr2x._b0ppg ._Pe-cd{background-color:rgba(11,110,208,.08)}._FnQtw._CHSF0:hover:not(._F0o7y) ._EG-G4,._FnQtw._CHSF0:hover:not(._F0o7y) ._jPr2x{background-color:#f9f9f9}._FnQtw._CHSF0:active:not(._F0o7y):not(._FnQtw._CHSF0:active:not(._F0o7y):has(._Pe-cd:active)) ._EG-G4,._FnQtw._CHSF0:active:not(._F0o7y):not(._FnQtw._CHSF0:active:not(._F0o7y):has(._Pe-cd:active)) ._jPr2x{background-color:#f3f3f3}._FnQtw:focus{outline:none}._FnQtw.focus-visible ._EG-G4:after,._FnQtw:focus-visible ._EG-G4: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}._FnQtw.focus-visible ._EG-G4:last-of-type:after,._FnQtw:focus-visible ._EG-G4:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._FnQtw.focus-visible ._EG-G4:first-of-type:after,._FnQtw:focus-visible ._EG-G4:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._FnQtw.focus-visible ._EG-G4._b0ppg:after,._FnQtw:focus-visible ._EG-G4._b0ppg:after{right:-3px;bottom:0}._FnQtw:last-of-type:focus{outline:none}._FnQtw:last-of-type.focus-visible ._EG-G4:after,._FnQtw:last-of-type:focus-visible ._EG-G4: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}._FnQtw:last-of-type.focus-visible ._EG-G4:last-of-type:after,._FnQtw:last-of-type:focus-visible ._EG-G4:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._FnQtw:last-of-type.focus-visible ._EG-G4:first-of-type:after,._FnQtw:last-of-type:focus-visible ._EG-G4:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._FnQtw:last-of-type.focus-visible ._EG-G4._b0ppg:after,._FnQtw:last-of-type:focus-visible ._EG-G4._b0ppg:after{right:-3px;bottom:1px}._FnQtw:last-of-type ._DQvjk:focus{outline:none}._FnQtw:last-of-type ._DQvjk._ldtOD.focus-visible:after,._FnQtw:last-of-type ._DQvjk._ldtOD:focus-visible:after,._FnQtw:last-of-type ._DQvjk.focus-visible:after,._FnQtw:last-of-type ._DQvjk: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}._FnQtw:first-of-type:focus{outline:none}._FnQtw:first-of-type.focus-visible ._EG-G4:after,._FnQtw:first-of-type:focus-visible ._EG-G4: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}._FnQtw:first-of-type.focus-visible ._EG-G4:last-of-type:after,._FnQtw:first-of-type:focus-visible ._EG-G4:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._FnQtw:first-of-type.focus-visible ._EG-G4:first-of-type:after,._FnQtw:first-of-type:focus-visible ._EG-G4:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._FnQtw:first-of-type.focus-visible ._EG-G4._b0ppg:after,._FnQtw:first-of-type:focus-visible ._EG-G4._b0ppg:after{right:-3px;bottom:0}._FnQtw:first-of-type ._DQvjk:focus{outline:none}._FnQtw:first-of-type ._DQvjk._ldtOD.focus-visible:after,._FnQtw:first-of-type ._DQvjk._ldtOD:focus-visible:after,._FnQtw:first-of-type ._DQvjk.focus-visible:after,._FnQtw:first-of-type ._DQvjk: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}._uKCXE{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}._uKCXE._8i3oQ{flex-grow:1}._uKCXE._p-gDZ{cursor:pointer}._uKCXE._p-gDZ:hover:not(._atGQR){background-color:#f9f9f9;border-bottom-color:#6a6d70}._uKCXE._p-gDZ:active:not(._atGQR){background-color:#f3f3f3}._uKCXE._KRtFL:not(._atGQR){color:#32363a;fill:#32363a;border-bottom-color:#8a8f94}._uKCXE._atGQR{cursor:move;background-color:#efefef;border-bottom-color:#ccc;border-top-left-radius:4px;border-top-right-radius:4px}._uKCXE ._9szvz{background-color:#d9d9d9;position:absolute;width:1px;top:0;pointer-events:none}._uKCXE ._9szvz._lzRda{left:-1px}._uKCXE ._9szvz._pMY9l{right:0}._uKCXE ._hPx-z{background-color:#0a6ed1;position:absolute;width:3px;top:4px;bottom:4px;border-radius:4px;pointer-events:none}._uKCXE ._hPx-z._lzRda{left:-2px}._uKCXE ._hPx-z._pMY9l{right:-1px}._uKCXE:first-of-type ._lzRda._9szvz{left:0;width:2px;border-left:1px solid #fff}._uKCXE:first-of-type ._lzRda._hPx-z{left:0}._uKCXE:last-of-type ._pMY9l._9szvz{right:0;width:2px;border-right:1px solid #fff}._uKCXE:last-of-type ._pMY9l._hPx-z{right:0}._uKCXE ._mqmJe{position:absolute;width:6px;right:-3px;top:0;cursor:ew-resize;z-index:50}._uKCXE ._mqmJe ._2M7nz{position:absolute;width:2px;right:2px;top:0;bottom:0}._uKCXE ._mqmJe ._2M7nz._ycZAp{background-color:#0a6ed1}._uKCXE ._mqmJe:hover ._2M7nz:not(._ycZAp){background-color:#d9d9d9}._uKCXE ._z9XFv{display:flex;flex-grow:1;align-items:center;min-width:0;padding:14px 0 13px 12px}._uKCXE ._z9XFv._lyl5e{flex-direction:row-reverse;justify-content:flex-start}._uKCXE ._z9XFv._lyl5e ._5en04{margin:1px 7px 1px 1px}._uKCXE ._z9XFv ._0heED{text-overflow:ellipsis;overflow:hidden;-webkit-hyphens:auto;hyphens:auto;pointer-events:none;overflow-wrap:break-word;display:-webkit-box;-webkit-box-orient:vertical}._uKCXE ._z9XFv ._5en04{margin:1px 1px 1px 7px;flex-shrink:0}._uKCXE ._SCrPU{margin-left:6px;margin-right:4px;flex-shrink:0}._uKCXE ._lkILN{pointer-events:none;position:absolute;top:0;left:0;bottom:0;right:0}._uKCXE:focus{outline:none}._uKCXE._ldtOD.focus-visible:after,._uKCXE._ldtOD:focus-visible:after,._uKCXE.focus-visible:after,._uKCXE: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}._2bz7e{margin-right:6px}._b0ppg{display:flex;border-right:3px solid #e5e5e5;position:-webkit-sticky;position:sticky;left:0;background-color:#fff;z-index:20}._b0ppg[focus-within]{z-index:30}._b0ppg:focus-within{z-index:30}._DQvjk{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}._DQvjk ._n66MY{width:100%;padding:12px 12px 11px;overflow:hidden}._DQvjk._atGQR{background-color:#efefef;border-bottom-color:#dfdfe1}._DQvjk._8i3oQ{flex-grow:1}._DQvjk:focus{outline:none}._DQvjk._ldtOD.focus-visible:after,._DQvjk._ldtOD:focus-visible:after,._DQvjk.focus-visible:after,._DQvjk: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}._jPr2x{display:flex!important;min-height:44px!important;align-items:center;justify-content:right;border-bottom:1px solid #eee;flex-shrink:0}._jPr2x._v6WyX{border-bottom-color:#d9d9d9;background-color:#fff}._Pe-cd{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}._Pe-cd._v6WyX{border-bottom-color:#d9d9d9;padding:14px 12px 13px}._Pe-cd:focus input~span,._Pe-cd:hover input~span{border-color:#0b6ed0}._Pe-cd ._XPhYN{position:relative;display:inline-flex}._Pe-cd ._XPhYN ._VNPCq{margin:0!important}._Pe-cd ._XPhYN ._r2IhR{position:absolute;top:3px;left:3px;height:10px;width:10px;border-radius:2px;background-color:#0b6ed0}._5dSQb{justify-content:flex-start}._Y4n9x{justify-content:center;text-align:center}._lyl5e{justify-content:flex-end;text-align:right}._yQpfl{display:none}._c-QdE{opacity:0;height:0;width:0;overflow:hidden}._6bLj8,._c-QdE{position:absolute}._6bLj8{cursor:move;background-color:rgba(11,110,208,.08);border-radius:4px;z-index:1000;pointer-events:none}._BJqT0{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 = "._6yqzu{display:inline-block;width:36px;transition:width .25s ease-out}._TimlY{width:100%}._TqoIH>input{padding-right:0!important}._AHHOB>svg{fill:#515559}";
|
|
1832
|
+
var styles$a = {"collapsibleSearchInput":"_6yqzu","searchInput":"_TimlY","searchInputCollapsed":"_TqoIH","iconButton":"_AHHOB"};
|
|
1833
|
+
var stylesheet$b="._6yqzu{display:inline-block;width:36px;transition:width .25s ease-out}._TimlY{width:100%}._TqoIH>input{padding-right:0!important}._AHHOB>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 {
|
|
@@ -2655,6 +2586,8 @@ function Combobox(_ref) {
|
|
|
2655
2586
|
isInvalid,
|
|
2656
2587
|
isRequired,
|
|
2657
2588
|
isLoading = false,
|
|
2589
|
+
isOpen: externalIsOpen,
|
|
2590
|
+
onIsOpenChange: externalOnIsOpenChange,
|
|
2658
2591
|
'aria-label': ariaLabel,
|
|
2659
2592
|
'aria-labelledby': ariaLabelledBy,
|
|
2660
2593
|
'data-testid': dataTestId,
|
|
@@ -2663,7 +2596,7 @@ function Combobox(_ref) {
|
|
|
2663
2596
|
const inputRef = React.useRef(null);
|
|
2664
2597
|
const flyoutRef = React.useRef(null);
|
|
2665
2598
|
const flyoutId = index.useId();
|
|
2666
|
-
const [isOpen, setIsOpen] =
|
|
2599
|
+
const [isOpen, setIsOpen] = index.useControllableState(externalIsOpen !== null && externalIsOpen !== void 0 ? externalIsOpen : false, externalOnIsOpenChange, externalIsOpen);
|
|
2667
2600
|
const [hoveredOption, setHoveredOption] = React.useState(null);
|
|
2668
2601
|
const [inputFocusRef, isComponentFocused] = index.useIsFocused();
|
|
2669
2602
|
const {
|
|
@@ -2694,7 +2627,7 @@ function Combobox(_ref) {
|
|
|
2694
2627
|
flyoutRef,
|
|
2695
2628
|
flyoutId,
|
|
2696
2629
|
isOpen,
|
|
2697
|
-
setIsOpen,
|
|
2630
|
+
setIsOpen: setIsOpen,
|
|
2698
2631
|
inputRef,
|
|
2699
2632
|
inputFocusRef,
|
|
2700
2633
|
isDisabled,
|
|
@@ -2719,10 +2652,10 @@ function Combobox(_ref) {
|
|
|
2719
2652
|
}, children);
|
|
2720
2653
|
}
|
|
2721
2654
|
|
|
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$
|
|
2655
|
+
var css_248z$a = "._DO9D6 :after{background-color:#515559!important}._V66-w>input:focus{box-shadow:none!important;border:1px solid #898989!important}._B4AEv{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}._B4AEv ._1u84a ._EHYRX{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}._B4AEv ._1u84a:first-child ._7bgS-{display:none}._B4AEv ._kVK9H{display:flex;align-items:center;min-height:40px;padding:10px 12px;font-size:14px;color:#32363a;word-break:break-word;outline:none;cursor:pointer}._B4AEv ._kVK9H:hover{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._B4AEv ._kVK9H:hover._G7Qcw{background-color:#e4effa}._B4AEv ._kVK9H._G7Qcw{background-color:#ebf3fb;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._B4AEv ._kVK9H:active:not(._G7Qcw){background-color:#e8e9e9}";
|
|
2656
|
+
var styles$9 = {"loadingSpinner":"_DO9D6","ignoreFocusStyle":"_V66-w","flyout":"_B4AEv","group":"_1u84a","header":"_EHYRX","divider":"_7bgS-","option":"_kVK9H","selected":"_G7Qcw"};
|
|
2657
|
+
var stylesheet$a="._DO9D6 :after{background-color:#515559!important}._V66-w>input:focus{box-shadow:none!important;border:1px solid #898989!important}._B4AEv{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}._B4AEv ._1u84a ._EHYRX{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}._B4AEv ._1u84a:first-child ._7bgS-{display:none}._B4AEv ._kVK9H{display:flex;align-items:center;min-height:40px;padding:10px 12px;font-size:14px;color:#32363a;word-break:break-word;outline:none;cursor:pointer}._B4AEv ._kVK9H:hover{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._B4AEv ._kVK9H:hover._G7Qcw{background-color:#e4effa}._B4AEv ._kVK9H._G7Qcw{background-color:#ebf3fb;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._B4AEv ._kVK9H:active:not(._G7Qcw){background-color:#e8e9e9}";
|
|
2658
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$a);}
|
|
2726
2659
|
|
|
2727
2660
|
const ComboboxInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
2728
2661
|
let {
|
|
@@ -2828,7 +2761,7 @@ const ComboboxInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
2828
2761
|
return /*#__PURE__*/React__default["default"].createElement(index.Input$1, {
|
|
2829
2762
|
role: "combobox",
|
|
2830
2763
|
className: classNames__default["default"](className, {
|
|
2831
|
-
[styles$
|
|
2764
|
+
[styles$9.ignoreFocusStyle]: hoveredOption || activeDescendantElement
|
|
2832
2765
|
}),
|
|
2833
2766
|
style: style,
|
|
2834
2767
|
id: id,
|
|
@@ -2841,7 +2774,7 @@ const ComboboxInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
2841
2774
|
},
|
|
2842
2775
|
leftAddOn: leftAddOn,
|
|
2843
2776
|
rightAddOn: isLoading ? /*#__PURE__*/React__default["default"].createElement(index.LoadingSpinner, {
|
|
2844
|
-
className: styles$
|
|
2777
|
+
className: styles$9.loadingSpinner,
|
|
2845
2778
|
size: "xs",
|
|
2846
2779
|
show: isLoading,
|
|
2847
2780
|
"aria-hidden": true
|
|
@@ -2898,7 +2831,7 @@ const ComboboxFlyout = _ref => {
|
|
|
2898
2831
|
popper: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2899
2832
|
role: "listbox",
|
|
2900
2833
|
id: flyoutId,
|
|
2901
|
-
className: styles$
|
|
2834
|
+
className: styles$9.flyout,
|
|
2902
2835
|
style: flyoutDimensions,
|
|
2903
2836
|
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : rootAriaLabel,
|
|
2904
2837
|
"aria-labelledby": ariaLabelledBy !== null && ariaLabelledBy !== void 0 ? ariaLabelledBy : rootAriaLabelledBy,
|
|
@@ -2950,16 +2883,16 @@ function ComboboxGroup(_ref) {
|
|
|
2950
2883
|
}, children);
|
|
2951
2884
|
return hasFilteredOptions ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2952
2885
|
role: "group",
|
|
2953
|
-
className: styles$
|
|
2886
|
+
className: styles$9.group,
|
|
2954
2887
|
"aria-labelledby": headerElementId,
|
|
2955
2888
|
"aria-describedby": ariaDescribedBy,
|
|
2956
2889
|
"data-testid": index.getSubDataTestId(rootDataTestId, "group-".concat(label))
|
|
2957
2890
|
}, /*#__PURE__*/React__default["default"].createElement(index.Divider, {
|
|
2958
|
-
className: styles$
|
|
2891
|
+
className: styles$9.divider
|
|
2959
2892
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2960
2893
|
"aria-hidden": "true",
|
|
2961
2894
|
id: headerElementId,
|
|
2962
|
-
className: styles$
|
|
2895
|
+
className: styles$9.header
|
|
2963
2896
|
}, 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
2897
|
;
|
|
2965
2898
|
}
|
|
@@ -3012,8 +2945,8 @@ function ComboboxOption(_ref) {
|
|
|
3012
2945
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3013
2946
|
role: "option",
|
|
3014
2947
|
id: containerId,
|
|
3015
|
-
className: classNames__default["default"](styles$
|
|
3016
|
-
[styles$
|
|
2948
|
+
className: classNames__default["default"](styles$9.option, {
|
|
2949
|
+
[styles$9.selected]: isOptionSelected
|
|
3017
2950
|
}),
|
|
3018
2951
|
onClick: () => {
|
|
3019
2952
|
setCommittedInputValue(label);
|
|
@@ -3031,112 +2964,196 @@ function ComboboxOption(_ref) {
|
|
|
3031
2964
|
}, label);
|
|
3032
2965
|
}
|
|
3033
2966
|
|
|
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$
|
|
2967
|
+
var css_248z$9 = "._pCPq5{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}._lmtNE{visibility:hidden}._JWsAU{position:fixed}";
|
|
2968
|
+
var styles$8 = {"overlay":"_pCPq5","hidden":"_lmtNE","anchoredToBody":"_JWsAU"};
|
|
2969
|
+
var stylesheet$9="._pCPq5{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}._lmtNE{visibility:hidden}._JWsAU{position:fixed}";
|
|
2970
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$9);}
|
|
3038
2971
|
|
|
3039
|
-
|
|
2972
|
+
/**
|
|
2973
|
+
* Adds an overlay to an area that obscures visibility and disables background elements.
|
|
2974
|
+
* @param {MutableRefObject} containerRef - A ref pointing to the DOM element to be filled by the overlay.
|
|
2975
|
+
* @param {boolean} isVisible - When true, displays overlay and disables all element behind it.
|
|
2976
|
+
* @param {React.MouseEventHandler} onClick - A function to be called when the overlay recieves a click event.
|
|
2977
|
+
* @param {string[]} ignoreIds - An array of ids belonging to elements that should not become inert when isInert is true.
|
|
2978
|
+
* @param {CSSProperties['zIndex']} zIndex - The zIndex of the overlay.
|
|
2979
|
+
* @param {string} dataTestId - A string to be added to the overlay element as a data-testid.
|
|
2980
|
+
* @param {number} opacity - The opacity of the overlay.
|
|
2981
|
+
*/
|
|
2982
|
+
const useOverlay = _ref => {
|
|
3040
2983
|
let {
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
buttonAriaLabel,
|
|
3049
|
-
buttonAriaLabelledBy,
|
|
3050
|
-
dropdownAriaLabel,
|
|
3051
|
-
dropdownAriaLabelledBy,
|
|
3052
|
-
onClick
|
|
2984
|
+
containerRef,
|
|
2985
|
+
isVisible,
|
|
2986
|
+
onClick,
|
|
2987
|
+
ignoreIds = [],
|
|
2988
|
+
zIndex,
|
|
2989
|
+
dataTestId,
|
|
2990
|
+
opacity
|
|
3053
2991
|
} = _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
|
-
});
|
|
2992
|
+
const overlayId = index.useId();
|
|
2993
|
+
React.useEffect(() => {
|
|
2994
|
+
var _containerRef$current;
|
|
2995
|
+
const containerNode = (_containerRef$current = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : document.body;
|
|
2996
|
+
const overlay = document.createElement('div');
|
|
2997
|
+
if (containerNode === document.body) overlay.classList.add(styles$8.anchoredToBody);
|
|
2998
|
+
overlay.id = overlayId;
|
|
2999
|
+
overlay.classList.add(styles$8.overlay);
|
|
3000
|
+
if (onClick) overlay.addEventListener('click', onClick);
|
|
3001
|
+
if (dataTestId) overlay.dataset.testid = dataTestId;
|
|
3002
|
+
if (!isVisible) overlay.classList.add(styles$8.hidden);
|
|
3003
|
+
if (zIndex || zIndex === 0) overlay.style.zIndex = zIndex.toString();
|
|
3004
|
+
if (opacity || opacity === 0) overlay.style.opacity = opacity.toString();
|
|
3005
|
+
containerNode.appendChild(overlay);
|
|
3006
|
+
containerNode.style.position = 'relative';
|
|
3007
|
+
return () => {
|
|
3008
|
+
containerNode.style.position = 'static';
|
|
3009
|
+
containerNode.removeChild(overlay);
|
|
3010
|
+
};
|
|
3011
|
+
}, [containerRef, overlayId, isVisible, onClick, dataTestId, zIndex, opacity]);
|
|
3012
|
+
React.useEffect(() => {
|
|
3013
|
+
var _containerRef$current2;
|
|
3014
|
+
const containerNode = (_containerRef$current2 = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _containerRef$current2 !== void 0 ? _containerRef$current2 : document.body;
|
|
3015
|
+
const overlayNode = document.getElementById(overlayId);
|
|
3016
|
+
if (isVisible) {
|
|
3017
|
+
Array.from(containerNode.children).forEach(child => {
|
|
3018
|
+
if (!ignoreIds.includes(child.id) && child.id !== overlayId) child.setAttribute('inert', '');
|
|
3019
|
+
});
|
|
3020
|
+
overlayNode === null || overlayNode === void 0 || overlayNode.classList.remove(styles$8.hidden);
|
|
3021
|
+
} else {
|
|
3022
|
+
Array.from(containerNode.children).forEach(child => {
|
|
3023
|
+
child.removeAttribute('inert');
|
|
3024
|
+
});
|
|
3025
|
+
overlayNode === null || overlayNode === void 0 || overlayNode.classList.add(styles$8.hidden);
|
|
3026
|
+
}
|
|
3027
|
+
return () => {
|
|
3028
|
+
Array.from(containerNode.children).forEach(child => {
|
|
3029
|
+
child.removeAttribute('inert');
|
|
3030
|
+
});
|
|
3031
|
+
};
|
|
3032
|
+
}, [containerRef, isVisible, ignoreIds, overlayId]);
|
|
3033
|
+
};
|
|
3119
3034
|
|
|
3120
|
-
|
|
3035
|
+
var css_248z$8 = "._XTTH2{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}._z1gTE{visibility:hidden}._eCC0-{position:fixed}._Zpdua{display:flex;justify-content:space-between;align-items:start;line-height:20px;font-size:16px;padding-bottom:12px}._1Cs5g{padding-top:8px}._-dj7u{margin-left:12px}";
|
|
3036
|
+
var styles$7 = {"drawer":"_XTTH2","hidden":"_z1gTE","anchoredToBody":"_eCC0-","header":"_Zpdua","title":"_1Cs5g","closeButton":"_-dj7u"};
|
|
3037
|
+
var stylesheet$8="._XTTH2{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}._z1gTE{visibility:hidden}._eCC0-{position:fixed}._Zpdua{display:flex;justify-content:space-between;align-items:start;line-height:20px;font-size:16px;padding-bottom:12px}._1Cs5g{padding-top:8px}._-dj7u{margin-left:12px}";
|
|
3038
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$8);}
|
|
3039
|
+
|
|
3040
|
+
const Drawer = _ref => {
|
|
3041
|
+
var _containerRef$current;
|
|
3121
3042
|
let {
|
|
3122
|
-
|
|
3123
|
-
|
|
3043
|
+
id,
|
|
3044
|
+
isOpen: externalIsOpen,
|
|
3045
|
+
onIsOpenChange,
|
|
3046
|
+
title,
|
|
3047
|
+
width = '292px',
|
|
3048
|
+
zIndex = 1000,
|
|
3049
|
+
elementRefToFocusOnClose,
|
|
3050
|
+
containerRef,
|
|
3051
|
+
'aria-label': ariaLabel,
|
|
3052
|
+
'aria-labelledby': ariaLabelledby,
|
|
3053
|
+
'aria-describedby': ariaDescribedby,
|
|
3054
|
+
'data-testid': dataTestId,
|
|
3124
3055
|
children
|
|
3125
3056
|
} = _ref;
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3057
|
+
// waits to createPortal until after containerRef is in DOM
|
|
3058
|
+
const [domReady, setDomReady] = React.useState(false);
|
|
3059
|
+
React.useEffect(() => {
|
|
3060
|
+
setDomReady(true);
|
|
3061
|
+
}, [setDomReady]);
|
|
3062
|
+
const [elementUsedToOpenModal, setElementUsedToOpenModal] = React.useState();
|
|
3063
|
+
const drawerRef = React.useRef(null);
|
|
3064
|
+
const drawerId = index.useId(id);
|
|
3065
|
+
const [isOpen, setIsOpen] = index.useControllableState(externalIsOpen, onIsOpenChange, externalIsOpen);
|
|
3066
|
+
const [isClosing, setIsClosing] = React.useState(false);
|
|
3067
|
+
const [isHidden, setIsHidden] = React.useState(!isOpen);
|
|
3068
|
+
const {
|
|
3069
|
+
translate
|
|
3070
|
+
} = index.useTranslation();
|
|
3071
|
+
const closeButtonAriaLabel = translate('close');
|
|
3072
|
+
const closeButtonRef = React.useRef(null);
|
|
3073
|
+
const close = () => {
|
|
3074
|
+
setIsOpen(false);
|
|
3075
|
+
};
|
|
3076
|
+
const handleKeyDown = e => {
|
|
3077
|
+
if (e.key === 'Escape') {
|
|
3078
|
+
close();
|
|
3079
|
+
e.preventDefault(); // Prevent Safari from exiting full-screen mode
|
|
3080
|
+
}
|
|
3081
|
+
};
|
|
3135
3082
|
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3083
|
+
useOverlay({
|
|
3084
|
+
containerRef,
|
|
3085
|
+
isVisible: isOpen,
|
|
3086
|
+
onClick: close,
|
|
3087
|
+
ignoreIds: [drawerId],
|
|
3088
|
+
zIndex: Number(zIndex) - 1,
|
|
3089
|
+
dataTestId: index.getSubDataTestId(dataTestId, 'overlay')
|
|
3090
|
+
});
|
|
3091
|
+
index.useDidUpdate(() => {
|
|
3092
|
+
if (isOpen) {
|
|
3093
|
+
setIsClosing(false);
|
|
3094
|
+
setIsHidden(false);
|
|
3095
|
+
setElementUsedToOpenModal(document.activeElement);
|
|
3096
|
+
} else {
|
|
3097
|
+
var _elementRefToFocusOnC;
|
|
3098
|
+
setIsClosing(true);
|
|
3099
|
+
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();
|
|
3100
|
+
}
|
|
3101
|
+
}, [elementRefToFocusOnClose, isOpen]);
|
|
3102
|
+
React.useEffect(() => {
|
|
3103
|
+
if (isOpen && !isHidden) {
|
|
3104
|
+
var _closeButtonRef$curre;
|
|
3105
|
+
(_closeButtonRef$curre = closeButtonRef.current) === null || _closeButtonRef$curre === void 0 || _closeButtonRef$curre.focus();
|
|
3106
|
+
}
|
|
3107
|
+
}, [isOpen, isHidden]);
|
|
3108
|
+
const handleTransitionEnd = () => {
|
|
3109
|
+
if (!isOpen) {
|
|
3110
|
+
setIsClosing(false);
|
|
3111
|
+
setIsHidden(true);
|
|
3112
|
+
}
|
|
3113
|
+
};
|
|
3114
|
+
const containerNode = (_containerRef$current = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : document.body;
|
|
3115
|
+
|
|
3116
|
+
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
3117
|
+
return domReady ? /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React__default["default"].createElement("aside", {
|
|
3118
|
+
id: drawerId,
|
|
3119
|
+
className: classNames__default["default"](styles$7.drawer, {
|
|
3120
|
+
[styles$7.hidden]: isHidden,
|
|
3121
|
+
[styles$7.anchoredToBody]: containerNode === document.body
|
|
3122
|
+
}),
|
|
3123
|
+
style: {
|
|
3124
|
+
width,
|
|
3125
|
+
left: "".concat(isHidden || isClosing ? "-".concat(width) : '0'),
|
|
3126
|
+
zIndex
|
|
3127
|
+
},
|
|
3128
|
+
onKeyDown: handleKeyDown,
|
|
3129
|
+
onTransitionEnd: handleTransitionEnd,
|
|
3130
|
+
"data-testid": dataTestId,
|
|
3131
|
+
"aria-label": ariaLabel,
|
|
3132
|
+
"aria-labelledby": ariaLabelledby,
|
|
3133
|
+
"aria-describedby": ariaDescribedby,
|
|
3134
|
+
ref: drawerRef
|
|
3135
|
+
}, /*#__PURE__*/React__default["default"].createElement(index.PortalTargetProvider, {
|
|
3136
|
+
target: drawerRef.current
|
|
3137
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3138
|
+
className: styles$7.header
|
|
3139
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3140
|
+
className: styles$7.title,
|
|
3141
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'title')
|
|
3142
|
+
}, title), /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
3143
|
+
className: styles$7.closeButton,
|
|
3144
|
+
onClick: close,
|
|
3145
|
+
ref: closeButtonRef,
|
|
3146
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'close-button'),
|
|
3147
|
+
"aria-label": closeButtonAriaLabel
|
|
3148
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons_index.CloseIcon, null))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3149
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'body')
|
|
3150
|
+
}, children))), containerNode) : null;
|
|
3151
|
+
};
|
|
3152
|
+
|
|
3153
|
+
var css_248z$7 = "._9wdiV{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}._9wdiV:hover:not(._I3YCP){background-color:rgba(50,54,58,.08)}._9wdiV:hover:not(._I3YCP)._DVhZQ{border-color:#085caf;background-color:rgba(11,110,208,.04)}._9wdiV:hover:not(._I3YCP)._DVhZQ ._m57PN{color:#32363a}._9wdiV:hover:not(._I3YCP)._DVhZQ ._we8t-{fill:#32363a}._9wdiV:hover:not(._I3YCP)._DVhZQ ._cRGYq{fill:#085caf}._9wdiV:hover:not(._I3YCP)._DVhZQ ._zFfY7{background-color:rgba(11,110,208,.11)}._9wdiV:hover:not(._I3YCP)._DVhZQ ._zFfY7 ._9Sd76{color:#085caf}._9wdiV:active:not(._I3YCP){background-color:#e8e9e9}._9wdiV:active:not(._I3YCP)._DVhZQ{background-color:rgba(11,110,208,.11);border-color:#0854a1}._9wdiV:active:not(._I3YCP)._DVhZQ ._cRGYq{fill:#0854a1}._9wdiV:active:not(._I3YCP)._DVhZQ ._zFfY7{background-color:rgba(11,110,208,.11)}._9wdiV:active:not(._I3YCP)._DVhZQ ._zFfY7 ._9Sd76{color:#0854a1}._9wdiV._I3YCP{background-color:#fafafa;border-color:#e5e5e5;cursor:not-allowed}._9wdiV._DVhZQ{border-color:#0b6ed0}._we8t-{fill:#515559;margin-right:4px}._m57PN{max-width:180px;margin-right:3px;color:#515559;fill:#515559;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._m57PN+._zFfY7{margin-left:6px}._m57PN._I3YCP{color:#74777a}._zFfY7{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}._9Sd76{color:#0b6ed0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._cRGYq{fill:#515559}._cRGYq._I3YCP,._cRGYq._I3YCP._DVhZQ{fill:rgba(116,119,122,.4)}._cRGYq._DVhZQ{fill:#0b6ed0}._cRGYq._pXPSh{transform:rotate(-180deg)}._9wdiV.focus-visible,._9wdiV:focus-visible{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
3154
|
+
var styles$6 = {"button":"_9wdiV","disabled":"_I3YCP","selected":"_DVhZQ","label":"_m57PN","lockIcon":"_we8t-","chevronIcon":"_cRGYq","selectedFiltersContainer":"_zFfY7","selectedFilters":"_9Sd76","open":"_pXPSh"};
|
|
3155
|
+
var stylesheet$7="._9wdiV{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}._9wdiV:hover:not(._I3YCP){background-color:rgba(50,54,58,.08)}._9wdiV:hover:not(._I3YCP)._DVhZQ{border-color:#085caf;background-color:rgba(11,110,208,.04)}._9wdiV:hover:not(._I3YCP)._DVhZQ ._m57PN{color:#32363a}._9wdiV:hover:not(._I3YCP)._DVhZQ ._we8t-{fill:#32363a}._9wdiV:hover:not(._I3YCP)._DVhZQ ._cRGYq{fill:#085caf}._9wdiV:hover:not(._I3YCP)._DVhZQ ._zFfY7{background-color:rgba(11,110,208,.11)}._9wdiV:hover:not(._I3YCP)._DVhZQ ._zFfY7 ._9Sd76{color:#085caf}._9wdiV:active:not(._I3YCP){background-color:#e8e9e9}._9wdiV:active:not(._I3YCP)._DVhZQ{background-color:rgba(11,110,208,.11);border-color:#0854a1}._9wdiV:active:not(._I3YCP)._DVhZQ ._cRGYq{fill:#0854a1}._9wdiV:active:not(._I3YCP)._DVhZQ ._zFfY7{background-color:rgba(11,110,208,.11)}._9wdiV:active:not(._I3YCP)._DVhZQ ._zFfY7 ._9Sd76{color:#0854a1}._9wdiV._I3YCP{background-color:#fafafa;border-color:#e5e5e5;cursor:not-allowed}._9wdiV._DVhZQ{border-color:#0b6ed0}._we8t-{fill:#515559;margin-right:4px}._m57PN{max-width:180px;margin-right:3px;color:#515559;fill:#515559;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._m57PN+._zFfY7{margin-left:6px}._m57PN._I3YCP{color:#74777a}._zFfY7{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}._9Sd76{color:#0b6ed0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._cRGYq{fill:#515559}._cRGYq._I3YCP,._cRGYq._I3YCP._DVhZQ{fill:rgba(116,119,122,.4)}._cRGYq._DVhZQ{fill:#0b6ed0}._cRGYq._pXPSh{transform:rotate(-180deg)}._9wdiV.focus-visible,._9wdiV:focus-visible{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
3156
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$7);}
|
|
3140
3157
|
|
|
3141
3158
|
const FilterAnchor = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
3142
3159
|
let {
|
|
@@ -3222,94 +3239,464 @@ const FilterAnchor = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
3222
3239
|
}));
|
|
3223
3240
|
});
|
|
3224
3241
|
|
|
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 => {
|
|
3242
|
+
function createFormInstance(_ref) {
|
|
3238
3243
|
let {
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
children
|
|
3244
|
+
register,
|
|
3245
|
+
getFormState,
|
|
3246
|
+
formRef
|
|
3243
3247
|
} = _ref;
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3248
|
+
const Form = _ref2 => {
|
|
3249
|
+
let {
|
|
3250
|
+
children,
|
|
3251
|
+
...rest
|
|
3252
|
+
} = _ref2;
|
|
3253
|
+
const formState = getFormState();
|
|
3254
|
+
const context = React.useMemo(() => ({
|
|
3255
|
+
register,
|
|
3256
|
+
formState
|
|
3257
|
+
}), [formState]);
|
|
3258
|
+
return /*#__PURE__*/React__default["default"].createElement(index.FormProvider, {
|
|
3259
|
+
value: context
|
|
3260
|
+
}, /*#__PURE__*/React__default["default"].createElement("form", _extends__default["default"]({
|
|
3261
|
+
ref: formRef
|
|
3262
|
+
}, rest), children));
|
|
3263
|
+
};
|
|
3256
3264
|
return {
|
|
3257
|
-
|
|
3258
|
-
...coreContext
|
|
3265
|
+
Form
|
|
3259
3266
|
};
|
|
3260
|
-
}
|
|
3267
|
+
}
|
|
3261
3268
|
|
|
3262
|
-
/* eslint-disable
|
|
3263
|
-
|
|
3264
|
-
var _process$env;
|
|
3269
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
3270
|
+
function useForm(_ref) {
|
|
3265
3271
|
let {
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
onIsOpenChange,
|
|
3269
|
-
isDisabled,
|
|
3270
|
-
children,
|
|
3271
|
-
isVirtualizationDisabled
|
|
3272
|
+
initialValues,
|
|
3273
|
+
validateField
|
|
3272
3274
|
} = _ref;
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
const
|
|
3281
|
-
|
|
3282
|
-
const
|
|
3283
|
-
const
|
|
3284
|
-
const
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3275
|
+
const [formState, setFormState] = React.useState({
|
|
3276
|
+
values: initialValues !== null && initialValues !== void 0 ? initialValues : {},
|
|
3277
|
+
touched: {},
|
|
3278
|
+
errors: {},
|
|
3279
|
+
formError: '',
|
|
3280
|
+
isSubmitting: false
|
|
3281
|
+
});
|
|
3282
|
+
const formStateRef = React.useRef(formState);
|
|
3283
|
+
formStateRef.current = formState;
|
|
3284
|
+
const getFormState = React.useCallback(() => formStateRef.current, []);
|
|
3285
|
+
const formRef = React.useRef(null);
|
|
3286
|
+
const allFieldRefs = React.useRef({});
|
|
3287
|
+
const validateFieldRef = index.useLatest(validateField);
|
|
3288
|
+
const refCallback = React.useCallback(node => {
|
|
3289
|
+
if (!node) return;
|
|
3290
|
+
const fieldName = node.name;
|
|
3291
|
+
if (node.type === 'radio') {
|
|
3292
|
+
const radioNodes = allFieldRefs.current[fieldName];
|
|
3293
|
+
if (radioNodes && Array.isArray(radioNodes)) {
|
|
3294
|
+
allFieldRefs.current[fieldName] = [...radioNodes, node];
|
|
3289
3295
|
} else {
|
|
3290
|
-
|
|
3296
|
+
allFieldRefs.current[fieldName] = [node];
|
|
3291
3297
|
}
|
|
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();
|
|
3298
|
+
} else {
|
|
3299
|
+
allFieldRefs.current[fieldName] = node;
|
|
3303
3300
|
}
|
|
3304
|
-
});
|
|
3305
|
-
const
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3301
|
+
}, []);
|
|
3302
|
+
const refCallbackCustom = React.useCallback(fieldName => node => {
|
|
3303
|
+
if (!node) return;
|
|
3304
|
+
allFieldRefs.current[fieldName] = node;
|
|
3305
|
+
}, []);
|
|
3306
|
+
const setValue = React.useCallback((name, value) => {
|
|
3307
|
+
setFormState(prevFormState => ({
|
|
3308
|
+
...prevFormState,
|
|
3309
|
+
values: {
|
|
3310
|
+
...prevFormState.values,
|
|
3311
|
+
[name]: value
|
|
3312
|
+
}
|
|
3313
|
+
}));
|
|
3314
|
+
}, [setFormState]);
|
|
3315
|
+
const setTouched = React.useCallback((name, touched) => {
|
|
3316
|
+
setFormState(prevFormState => ({
|
|
3317
|
+
...prevFormState,
|
|
3318
|
+
touched: {
|
|
3319
|
+
...prevFormState.touched,
|
|
3320
|
+
[name]: touched
|
|
3321
|
+
}
|
|
3322
|
+
}));
|
|
3323
|
+
}, [setFormState]);
|
|
3324
|
+
const setError = React.useCallback((name, error) => {
|
|
3325
|
+
setFormState(prevFormState => ({
|
|
3326
|
+
...prevFormState,
|
|
3327
|
+
errors: {
|
|
3328
|
+
...prevFormState.errors,
|
|
3329
|
+
[name]: error
|
|
3330
|
+
}
|
|
3331
|
+
}));
|
|
3332
|
+
}, [setFormState]);
|
|
3333
|
+
const validate = React.useCallback((name, value) => {
|
|
3334
|
+
var _validateFieldRef$cur;
|
|
3335
|
+
const formValues = getFormState().values;
|
|
3336
|
+
const newFormValues = {
|
|
3337
|
+
...formValues,
|
|
3338
|
+
[name]: value
|
|
3339
|
+
};
|
|
3340
|
+
const validationResult = (_validateFieldRef$cur = validateFieldRef.current) === null || _validateFieldRef$cur === void 0 ? void 0 : _validateFieldRef$cur.call(validateFieldRef, name, value, newFormValues);
|
|
3341
|
+
return validationResult;
|
|
3342
|
+
}, [getFormState, validateFieldRef]);
|
|
3343
|
+
const onChange = React.useCallback(event => {
|
|
3344
|
+
const target = event.currentTarget;
|
|
3345
|
+
const fieldName = target.name;
|
|
3346
|
+
const fieldType = target.type;
|
|
3347
|
+
let fieldValue;
|
|
3348
|
+
switch (fieldType) {
|
|
3349
|
+
case 'text':
|
|
3350
|
+
case 'email':
|
|
3351
|
+
case 'password':
|
|
3352
|
+
case 'radio':
|
|
3353
|
+
fieldValue = target.value;
|
|
3354
|
+
break;
|
|
3355
|
+
case 'checkbox':
|
|
3356
|
+
fieldValue = target.checked;
|
|
3357
|
+
break;
|
|
3358
|
+
default:
|
|
3359
|
+
fieldValue = '';
|
|
3360
|
+
break;
|
|
3361
|
+
}
|
|
3362
|
+
if (getFormState().touched[fieldName]) {
|
|
3363
|
+
const error = validate(fieldName, fieldValue);
|
|
3364
|
+
setError(fieldName, error);
|
|
3365
|
+
}
|
|
3366
|
+
setValue(fieldName, fieldValue);
|
|
3367
|
+
}, [setValue, setError, validate, getFormState]);
|
|
3368
|
+
|
|
3369
|
+
// Used for registering components without normal event passing
|
|
3370
|
+
const onChangeCustom = React.useCallback(fieldName => fieldValue => {
|
|
3371
|
+
if (getFormState().touched[fieldName]) {
|
|
3372
|
+
const error = validate(fieldName, fieldValue);
|
|
3373
|
+
setError(fieldName, error);
|
|
3374
|
+
}
|
|
3375
|
+
setValue(fieldName, fieldValue);
|
|
3376
|
+
}, [getFormState, setValue, setError, validate]);
|
|
3377
|
+
const onBlur = React.useCallback(event => {
|
|
3378
|
+
const fieldName = event.target.name;
|
|
3379
|
+
const fieldType = event.target.type;
|
|
3380
|
+
let fieldValue;
|
|
3381
|
+
switch (fieldType) {
|
|
3382
|
+
case 'text':
|
|
3383
|
+
case 'email':
|
|
3384
|
+
case 'password':
|
|
3385
|
+
case 'radio':
|
|
3386
|
+
fieldValue = event.target.value;
|
|
3387
|
+
break;
|
|
3388
|
+
case 'checkbox':
|
|
3389
|
+
fieldValue = event.target.checked;
|
|
3390
|
+
break;
|
|
3391
|
+
default:
|
|
3392
|
+
fieldValue = '';
|
|
3393
|
+
break;
|
|
3394
|
+
}
|
|
3395
|
+
const error = validate(fieldName, fieldValue);
|
|
3396
|
+
setError(fieldName, error);
|
|
3397
|
+
setTouched(fieldName, true);
|
|
3398
|
+
}, [setTouched, setError, validate]);
|
|
3399
|
+
const onBlurCustom = React.useCallback(fieldName => () => {
|
|
3400
|
+
const fieldValue = getFormState().values[fieldName];
|
|
3401
|
+
const error = validate(fieldName, fieldValue);
|
|
3402
|
+
setError(fieldName, error);
|
|
3403
|
+
setTouched(fieldName, true);
|
|
3404
|
+
}, [getFormState, setError, setTouched, validate]);
|
|
3405
|
+
|
|
3406
|
+
// register function types are determined by overloading here
|
|
3407
|
+
|
|
3408
|
+
function internalRegister(name) {
|
|
3409
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
3410
|
+
type: 'text'
|
|
3411
|
+
};
|
|
3412
|
+
const {
|
|
3413
|
+
type
|
|
3414
|
+
} = options;
|
|
3415
|
+
let registerProps;
|
|
3416
|
+
switch (type) {
|
|
3417
|
+
case 'text':
|
|
3418
|
+
case 'email':
|
|
3419
|
+
case 'password':
|
|
3420
|
+
{
|
|
3421
|
+
const defaultValue = getFormState().values[name];
|
|
3422
|
+
registerProps = {
|
|
3423
|
+
name,
|
|
3424
|
+
type,
|
|
3425
|
+
value: defaultValue,
|
|
3426
|
+
onBlur,
|
|
3427
|
+
onChange,
|
|
3428
|
+
ref: refCallback
|
|
3429
|
+
};
|
|
3430
|
+
break;
|
|
3431
|
+
}
|
|
3432
|
+
case 'checkbox':
|
|
3433
|
+
{
|
|
3434
|
+
const defaultChecked = !!getFormState().values[name];
|
|
3435
|
+
registerProps = {
|
|
3436
|
+
name,
|
|
3437
|
+
type,
|
|
3438
|
+
checked: defaultChecked,
|
|
3439
|
+
onBlur,
|
|
3440
|
+
onChange,
|
|
3441
|
+
ref: refCallback
|
|
3442
|
+
};
|
|
3443
|
+
break;
|
|
3444
|
+
}
|
|
3445
|
+
case 'radio':
|
|
3446
|
+
{
|
|
3447
|
+
const {
|
|
3448
|
+
radioValue
|
|
3449
|
+
} = options;
|
|
3450
|
+
const defaultChecked = getFormState().values[name] === radioValue;
|
|
3451
|
+
registerProps = {
|
|
3452
|
+
name,
|
|
3453
|
+
type,
|
|
3454
|
+
value: radioValue,
|
|
3455
|
+
checked: defaultChecked,
|
|
3456
|
+
onBlur,
|
|
3457
|
+
onChange,
|
|
3458
|
+
ref: refCallback
|
|
3459
|
+
};
|
|
3460
|
+
break;
|
|
3461
|
+
}
|
|
3462
|
+
default:
|
|
3463
|
+
{
|
|
3464
|
+
const defaultValue = getFormState().values[name];
|
|
3465
|
+
registerProps = {
|
|
3466
|
+
name,
|
|
3467
|
+
value: defaultValue,
|
|
3468
|
+
onBlur: onBlurCustom(name),
|
|
3469
|
+
onChange: onChangeCustom(name),
|
|
3470
|
+
ref: refCallbackCustom(name)
|
|
3471
|
+
};
|
|
3472
|
+
break;
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
return registerProps;
|
|
3476
|
+
}
|
|
3477
|
+
const register = React.useCallback(internalRegister, [onChange, onChangeCustom, onBlur, onBlurCustom, refCallback, refCallbackCustom, getFormState]);
|
|
3478
|
+
const handleSubmit = React.useCallback(onSubmit => async e => {
|
|
3479
|
+
e.preventDefault(); // prevents page refresh on submit
|
|
3480
|
+
|
|
3481
|
+
const {
|
|
3482
|
+
values
|
|
3483
|
+
} = getFormState();
|
|
3484
|
+
const invalidFieldNames = [];
|
|
3485
|
+
Object.keys(allFieldRefs.current).forEach(fieldName => {
|
|
3486
|
+
const fieldValue = values[fieldName];
|
|
3487
|
+
const error = validate(fieldName, fieldValue);
|
|
3488
|
+
setError(fieldName, error);
|
|
3489
|
+
setTouched(fieldName, true);
|
|
3490
|
+
if (typeof error === 'string') {
|
|
3491
|
+
invalidFieldNames.push(fieldName);
|
|
3492
|
+
}
|
|
3493
|
+
});
|
|
3494
|
+
if (invalidFieldNames.length > 0) {
|
|
3495
|
+
var _allFieldRefs$current;
|
|
3496
|
+
const sorted = [...invalidFieldNames].sort((a, b) => {
|
|
3497
|
+
const fieldA = allFieldRefs.current[a];
|
|
3498
|
+
const fieldB = allFieldRefs.current[b];
|
|
3499
|
+
|
|
3500
|
+
// Radio nodes are as an array within the same key
|
|
3501
|
+
// If node is an array, instead compare based on the first node in the array
|
|
3502
|
+
const nodeA = Array.isArray(fieldA) ? fieldA[0] : fieldA;
|
|
3503
|
+
const nodeB = Array.isArray(fieldB) ? fieldB[0] : fieldB;
|
|
3504
|
+
|
|
3505
|
+
/* eslint-disable no-bitwise */
|
|
3506
|
+
// @ts-ignore
|
|
3507
|
+
return nodeA.compareDocumentPosition(nodeB) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
3508
|
+
});
|
|
3509
|
+
|
|
3510
|
+
// TODO: replace with imperitve focusField function
|
|
3511
|
+
// If first invalid field is a radio, focus the checked input
|
|
3512
|
+
// or the first input if none are checked
|
|
3513
|
+
const firstInvalidField = (_allFieldRefs$current = allFieldRefs.current) === null || _allFieldRefs$current === void 0 ? void 0 : _allFieldRefs$current[sorted[0]];
|
|
3514
|
+
if (Array.isArray(firstInvalidField)) {
|
|
3515
|
+
const checkedRadio = firstInvalidField.find(node => node.checked);
|
|
3516
|
+
if (checkedRadio) checkedRadio.focus();else firstInvalidField[0].focus();
|
|
3517
|
+
} else {
|
|
3518
|
+
firstInvalidField === null || firstInvalidField === void 0 || firstInvalidField.focus();
|
|
3519
|
+
}
|
|
3520
|
+
return;
|
|
3521
|
+
}
|
|
3522
|
+
setFormState(prevFormState => ({
|
|
3523
|
+
...prevFormState,
|
|
3524
|
+
isSubmitting: true
|
|
3525
|
+
}));
|
|
3526
|
+
try {
|
|
3527
|
+
await onSubmit(values, e);
|
|
3528
|
+
setFormState(prevFormState => ({
|
|
3529
|
+
...prevFormState,
|
|
3530
|
+
isSubmitting: false
|
|
3531
|
+
}));
|
|
3532
|
+
} catch (err) {
|
|
3533
|
+
setFormState(prevFormState => ({
|
|
3534
|
+
...prevFormState,
|
|
3535
|
+
isSubmitting: false,
|
|
3536
|
+
formError: err === null || err === void 0 ? void 0 : err.message
|
|
3537
|
+
}));
|
|
3538
|
+
}
|
|
3539
|
+
}, [setError, setTouched, getFormState, setFormState, validate]);
|
|
3540
|
+
const {
|
|
3541
|
+
Form
|
|
3542
|
+
} = React.useMemo(() => createFormInstance({
|
|
3543
|
+
handleSubmit,
|
|
3544
|
+
register,
|
|
3545
|
+
getFormState,
|
|
3546
|
+
setFormState,
|
|
3547
|
+
formRef
|
|
3548
|
+
}), [getFormState, handleSubmit, register, formRef]);
|
|
3549
|
+
return {
|
|
3550
|
+
Form,
|
|
3551
|
+
register,
|
|
3552
|
+
formValues: formState.values,
|
|
3553
|
+
fieldErrors: formState.errors,
|
|
3554
|
+
formError: formState.formError,
|
|
3555
|
+
formTouched: formState.touched,
|
|
3556
|
+
isSubmitting: formState.isSubmitting,
|
|
3557
|
+
handleSubmit
|
|
3558
|
+
};
|
|
3559
|
+
}
|
|
3560
|
+
|
|
3561
|
+
const convertGridTemplateRowsOrColumns = rowsOrColumns => rowsOrColumns && rowsOrColumns.join(' ');
|
|
3562
|
+
const convertGridTemplateAreas = areas => areas.map(row => "\"".concat(row.join(' '), "\"")).join(' ');
|
|
3563
|
+
const LayoutGrid = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
3564
|
+
let {
|
|
3565
|
+
columnGap,
|
|
3566
|
+
rowGap,
|
|
3567
|
+
gap,
|
|
3568
|
+
rowHeights,
|
|
3569
|
+
columnWidths,
|
|
3570
|
+
areas,
|
|
3571
|
+
area,
|
|
3572
|
+
asChild = false,
|
|
3573
|
+
'data-testid': dataTestId,
|
|
3574
|
+
children
|
|
3575
|
+
} = _ref;
|
|
3576
|
+
const calculatedStyle = {
|
|
3577
|
+
display: 'grid',
|
|
3578
|
+
columnGap,
|
|
3579
|
+
rowGap,
|
|
3580
|
+
gridGap: gap,
|
|
3581
|
+
gridTemplateRows: convertGridTemplateRowsOrColumns(rowHeights),
|
|
3582
|
+
gridTemplateColumns: convertGridTemplateRowsOrColumns(columnWidths),
|
|
3583
|
+
gridTemplateAreas: convertGridTemplateAreas(areas),
|
|
3584
|
+
gridArea: area
|
|
3585
|
+
};
|
|
3586
|
+
return /*#__PURE__*/React__default["default"].createElement(GridChildrenWrapper, {
|
|
3587
|
+
asChild: asChild,
|
|
3588
|
+
style: calculatedStyle,
|
|
3589
|
+
"data-testid": dataTestId,
|
|
3590
|
+
ref: ref
|
|
3591
|
+
}, children);
|
|
3592
|
+
});
|
|
3593
|
+
|
|
3594
|
+
const LayoutGridItem = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
3595
|
+
let {
|
|
3596
|
+
area,
|
|
3597
|
+
asChild = false,
|
|
3598
|
+
'data-testid': dataTestId,
|
|
3599
|
+
children
|
|
3600
|
+
} = _ref;
|
|
3601
|
+
const calculatedStyle = {
|
|
3602
|
+
gridArea: area
|
|
3603
|
+
};
|
|
3604
|
+
return /*#__PURE__*/React__default["default"].createElement(GridChildrenWrapper, {
|
|
3605
|
+
asChild: asChild,
|
|
3606
|
+
style: calculatedStyle,
|
|
3607
|
+
"data-testid": dataTestId,
|
|
3608
|
+
ref: ref
|
|
3609
|
+
}, children);
|
|
3610
|
+
});
|
|
3611
|
+
|
|
3612
|
+
const {
|
|
3613
|
+
useContext: useMenuContext,
|
|
3614
|
+
Provider: MenuContextProvider
|
|
3615
|
+
} = index.createContextUtilities();
|
|
3616
|
+
const {
|
|
3617
|
+
useContext: useItemContext,
|
|
3618
|
+
Provider: ItemContextProvider
|
|
3619
|
+
} = index.createContextUtilities({});
|
|
3620
|
+
const {
|
|
3621
|
+
useContext: intermediaryUseMenuContext,
|
|
3622
|
+
Provider: IntermediaryMenuContextProvider
|
|
3623
|
+
} = index.createContextUtilities();
|
|
3624
|
+
const PaneContextProvider = _ref => {
|
|
3625
|
+
let {
|
|
3626
|
+
items,
|
|
3627
|
+
setItems,
|
|
3628
|
+
value,
|
|
3629
|
+
children
|
|
3630
|
+
} = _ref;
|
|
3631
|
+
return /*#__PURE__*/React__default["default"].createElement(index.ChildIndexProvider, {
|
|
3632
|
+
items: items,
|
|
3633
|
+
setItems: setItems
|
|
3634
|
+
}, /*#__PURE__*/React__default["default"].createElement(IntermediaryMenuContextProvider, {
|
|
3635
|
+
value: value
|
|
3636
|
+
}, children));
|
|
3637
|
+
};
|
|
3638
|
+
const usePaneContext = childItemRef => {
|
|
3639
|
+
const coreContext = intermediaryUseMenuContext();
|
|
3640
|
+
const childIndex = index.useChildIndex({
|
|
3641
|
+
element: childItemRef
|
|
3642
|
+
});
|
|
3643
|
+
return {
|
|
3644
|
+
childIndex,
|
|
3645
|
+
...coreContext
|
|
3646
|
+
};
|
|
3647
|
+
};
|
|
3648
|
+
|
|
3649
|
+
/* eslint-disable max-classes-per-file */
|
|
3650
|
+
const Menu = _ref => {
|
|
3651
|
+
var _process$env;
|
|
3652
|
+
let {
|
|
3653
|
+
'data-testid': dataTestId,
|
|
3654
|
+
isOpen,
|
|
3655
|
+
onIsOpenChange,
|
|
3656
|
+
isDisabled,
|
|
3657
|
+
children,
|
|
3658
|
+
isVirtualizationDisabled
|
|
3659
|
+
} = _ref;
|
|
3660
|
+
if (typeof process !== 'undefined' && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) === 'test' && window) {
|
|
3661
|
+
var _window$ResizeObserve, _window$PointerEvent;
|
|
3662
|
+
window.ResizeObserver = (_window$ResizeObserve = window.ResizeObserver) !== null && _window$ResizeObserve !== void 0 ? _window$ResizeObserve : resizeObserver.ResizeObserver;
|
|
3663
|
+
window.PointerEvent = (_window$PointerEvent = window.PointerEvent) !== null && _window$PointerEvent !== void 0 ? _window$PointerEvent : PointerEvent;
|
|
3664
|
+
}
|
|
3665
|
+
const [open, setOpen] = index.useControllableState(isOpen, onIsOpenChange, isOpen);
|
|
3666
|
+
const virtuoso = React.useRef(null);
|
|
3667
|
+
const [maskHeight, setMaskHeight] = React.useState(null);
|
|
3668
|
+
const [maskWidth, setMaskWidth] = React.useState(null);
|
|
3669
|
+
const [submenus, setSubmenus] = React.useState(new Set());
|
|
3670
|
+
const triggerRef = React.useRef(null);
|
|
3671
|
+
const registerSubmenu = (submenuId, submenuIsOpen) => {
|
|
3672
|
+
setSubmenus(subs => {
|
|
3673
|
+
const clone = new Set(subs);
|
|
3674
|
+
if (submenuIsOpen) {
|
|
3675
|
+
clone.add(submenuId);
|
|
3676
|
+
} else {
|
|
3677
|
+
clone.delete(submenuId);
|
|
3678
|
+
}
|
|
3679
|
+
return clone;
|
|
3680
|
+
});
|
|
3681
|
+
};
|
|
3682
|
+
|
|
3683
|
+
// Virtuoso and Radix-Dropdown have conflicting ResizeObserver behavior
|
|
3684
|
+
// according to the author of the error, this is not a problem https://stackoverflow.com/a/50387233/9487902
|
|
3685
|
+
// the virtuoso library author recommends this approach for conflicting libraries https://virtuoso.dev/react-beautiful-dnd/
|
|
3686
|
+
index.useEventListener(window, 'error', e => {
|
|
3687
|
+
if (e.message === 'ResizeObserver loop completed with undelivered notifications.' || e.message === 'ResizeObserver loop limit exceeded') {
|
|
3688
|
+
e.stopImmediatePropagation();
|
|
3689
|
+
e.preventDefault();
|
|
3690
|
+
}
|
|
3691
|
+
});
|
|
3692
|
+
const openPaneDepth = React.useMemo(() => open ? submenus.size + 1 : 0, [submenus, open]);
|
|
3693
|
+
const [searchBarConfigs, setSearchBarConfigs] = React.useState([]);
|
|
3694
|
+
return /*#__PURE__*/React__default["default"].createElement(MenuContextProvider, {
|
|
3695
|
+
value: {
|
|
3696
|
+
dataTestId,
|
|
3697
|
+
isDisabled,
|
|
3698
|
+
openPaneDepth,
|
|
3699
|
+
registerSubmenu,
|
|
3313
3700
|
maskHeight,
|
|
3314
3701
|
setMaskHeight,
|
|
3315
3702
|
open,
|
|
@@ -3338,10 +3725,10 @@ class PointerEvent extends Event {
|
|
|
3338
3725
|
}
|
|
3339
3726
|
}
|
|
3340
3727
|
|
|
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$
|
|
3728
|
+
var css_248z$6 = "._TmS-9{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._TmS-9>._jX7QJ{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}._TmS-9>._jX7QJ:hover:not([aria-disabled=true]){background-color:#f5f5f5}._TmS-9>._jX7QJ.focus-visible,._TmS-9>._jX7QJ:focus-visible{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._TmS-9>._jX7QJ+._INnhs{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._TmS-9>._jX7QJ[data-state=open]+._INnhs{transform:rotate(-180deg) translateY(50%)}._TmS-9>._jX7QJ[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._TmS-9>._jX7QJ[aria-disabled=true]+._INnhs{fill:#515559;opacity:.4}._uvuxs>[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}._uvuxs>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._PZ55S{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)}._PZ55S ._Am22m{height:100%;overflow-y:scroll}._PZ55S._8fqBr{margin-left:30px;opacity:0}._PZ55S._9mDLq{margin-left:-30px}._6W7m-{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%}._6W7m-._cZDoL{cursor:unset}._6W7m- ._7fSK3{fill:#32363a;margin-right:4px}._6W7m-:focus,._6W7m-:hover:not(._6W7m-._cZDoL){background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._6W7m-[aria-disabled=true]{cursor:not-allowed;opacity:.65}._6W7m-._O5Hdy{padding-right:32px}._6W7m-._O5Hdy ._INnhs{position:absolute;height:100%;right:3px;fill:#515559}._6W7m-._rOzoi{pointer-events:none}._MuuWU{position:-webkit-sticky;position:sticky;top:0;background-color:#fff;border-bottom:1px solid #e8e8e8}._MuuWU._ZQXZO{padding-top:52px}._bWZ-3{pointer-events:none;position:fixed;left:0;top:0;transition:width .35s;min-width:200px;width:var(--mask-width);max-width:350px}._RZ-U5{position:absolute;padding:8px;border-radius:4px 4px 0 0;pointer-events:auto;opacity:1;width:100%;transition:opacity .35s,margin-left .35s}._RZ-U5._9mDLq{opacity:0}._RZ-U5._9mDLq>._SWG-z{margin-left:-30px}._RZ-U5._8fqBr{opacity:0}._RZ-U5._8fqBr>._SWG-z{margin-left:30px}._RZ-U5>._SWG-z{transition:margin-left .35s;width:100%}._RZ-U5._rOzoi{pointer-events:none}body.keyboard-user ._6W7m-:hover:not(:focus){background-color:#fff;box-shadow:none}";
|
|
3729
|
+
var styles$5 = {"buttonContainer":"_TmS-9","button":"_jX7QJ","rightIcon":"_INnhs","maskContainer":"_uvuxs","flyout":"_PZ55S","scrollContainer":"_Am22m","animatedRight":"_8fqBr","animatedLeft":"_9mDLq","menuItem":"_6W7m-","noItems":"_cZDoL","backIcon":"_7fSK3","subMenu":"_O5Hdy","unresponsive":"_rOzoi","stickyBox":"_MuuWU","isSearchable":"_ZQXZO","searchBoxesContainer":"_bWZ-3","searchBox":"_RZ-U5","searchInput":"_SWG-z"};
|
|
3730
|
+
var stylesheet$6="._TmS-9{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._TmS-9>._jX7QJ{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}._TmS-9>._jX7QJ:hover:not([aria-disabled=true]){background-color:#f5f5f5}._TmS-9>._jX7QJ.focus-visible,._TmS-9>._jX7QJ:focus-visible{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._TmS-9>._jX7QJ+._INnhs{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._TmS-9>._jX7QJ[data-state=open]+._INnhs{transform:rotate(-180deg) translateY(50%)}._TmS-9>._jX7QJ[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._TmS-9>._jX7QJ[aria-disabled=true]+._INnhs{fill:#515559;opacity:.4}._uvuxs>[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}._uvuxs>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._PZ55S{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)}._PZ55S ._Am22m{height:100%;overflow-y:scroll}._PZ55S._8fqBr{margin-left:30px;opacity:0}._PZ55S._9mDLq{margin-left:-30px}._6W7m-{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%}._6W7m-._cZDoL{cursor:unset}._6W7m- ._7fSK3{fill:#32363a;margin-right:4px}._6W7m-:focus,._6W7m-:hover:not(._6W7m-._cZDoL){background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._6W7m-[aria-disabled=true]{cursor:not-allowed;opacity:.65}._6W7m-._O5Hdy{padding-right:32px}._6W7m-._O5Hdy ._INnhs{position:absolute;height:100%;right:3px;fill:#515559}._6W7m-._rOzoi{pointer-events:none}._MuuWU{position:-webkit-sticky;position:sticky;top:0;background-color:#fff;border-bottom:1px solid #e8e8e8}._MuuWU._ZQXZO{padding-top:52px}._bWZ-3{pointer-events:none;position:fixed;left:0;top:0;transition:width .35s;min-width:200px;width:var(--mask-width);max-width:350px}._RZ-U5{position:absolute;padding:8px;border-radius:4px 4px 0 0;pointer-events:auto;opacity:1;width:100%;transition:opacity .35s,margin-left .35s}._RZ-U5._9mDLq{opacity:0}._RZ-U5._9mDLq>._SWG-z{margin-left:-30px}._RZ-U5._8fqBr{opacity:0}._RZ-U5._8fqBr>._SWG-z{margin-left:30px}._RZ-U5>._SWG-z{transition:margin-left .35s;width:100%}._RZ-U5._rOzoi{pointer-events:none}body.keyboard-user ._6W7m-:hover:not(:focus){background-color:#fff;box-shadow:none}";
|
|
3731
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$6);}
|
|
3345
3732
|
|
|
3346
3733
|
/* eslint-disable import/prefer-default-export */
|
|
3347
3734
|
const DATA_TESTID_SUFFIXES$1 = {
|
|
@@ -3664,73 +4051,6 @@ const useMutationObserver = (target, options, onMutate) => React.useEffect(() =>
|
|
|
3664
4051
|
return () => observer.disconnect();
|
|
3665
4052
|
}, [target, options, onMutate]);
|
|
3666
4053
|
|
|
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
4054
|
const useCSSVariable = function (name, value) {
|
|
3735
4055
|
let dependencies = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
3736
4056
|
React.useEffect(() => {
|
|
@@ -3820,10 +4140,10 @@ const SubSelect = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
|
|
|
3820
4140
|
}, /*#__PURE__*/React__default["default"].createElement(SubMenu$1, sharedSubMenuProps, children));
|
|
3821
4141
|
});
|
|
3822
4142
|
|
|
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$
|
|
4143
|
+
var css_248z$5 = "._gKYCf{box-shadow:inset 0 0 0 1px #b00!important}._m88AW{width:unset!important;min-height:unset!important;padding:0!important;margin-right:7px}._k7-Tv{background-color:rgba(11,110,208,.08);font-weight:500}";
|
|
4144
|
+
var styles$4 = {"isInvalid":"_gKYCf","checkbox":"_m88AW","selectedItem":"_k7-Tv"};
|
|
4145
|
+
var stylesheet$5="._gKYCf{box-shadow:inset 0 0 0 1px #b00!important}._m88AW{width:unset!important;min-height:unset!important;padding:0!important;margin-right:7px}._k7-Tv{background-color:rgba(11,110,208,.08);font-weight:500}";
|
|
4146
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$5);}
|
|
3827
4147
|
|
|
3828
4148
|
const SelectItem = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
3829
4149
|
let {
|
|
@@ -3847,7 +4167,7 @@ const SelectItem = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
|
|
|
3847
4167
|
};
|
|
3848
4168
|
return /*#__PURE__*/React__default["default"].createElement(MenuItem$1, _extends__default["default"]({}, rest, sharedMenuItemProps, {
|
|
3849
4169
|
className: classNames__default["default"](className, {
|
|
3850
|
-
[styles$
|
|
4170
|
+
[styles$4.selectedItem]: isSelected
|
|
3851
4171
|
}),
|
|
3852
4172
|
asChild: true,
|
|
3853
4173
|
onSelect: () => onItemSelect === null || onItemSelect === void 0 ? void 0 : onItemSelect(value, !isSelected)
|
|
@@ -3856,7 +4176,7 @@ const SelectItem = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
|
|
|
3856
4176
|
role: "treeitem"
|
|
3857
4177
|
}, multiselect ? /*#__PURE__*/React__default["default"].createElement(AdvancedTableCheckbox, {
|
|
3858
4178
|
state: isSelected ? 'true' : 'false',
|
|
3859
|
-
className: styles$
|
|
4179
|
+
className: styles$4.checkbox,
|
|
3860
4180
|
isDisabled: isDisabled
|
|
3861
4181
|
}) : null, children !== null && children !== void 0 ? children : label));
|
|
3862
4182
|
});
|
|
@@ -4099,8 +4419,8 @@ const MenuPane = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
4099
4419
|
// We use the top-level Radix container as a mask. Radix does not expose this container to consumers, except through CSS.
|
|
4100
4420
|
// These hooks dynamically update the style of that container using CSS variables.
|
|
4101
4421
|
useCSSVariable('--mask-z-index', String(zIndex), [open]);
|
|
4102
|
-
useCSSVariable('--mask-width', "".concat(maskWidth, "px"));
|
|
4103
|
-
useCSSVariable('--mask-height', "".concat(maskHeight, "px"));
|
|
4422
|
+
useCSSVariable('--mask-width', Number.isNaN(Number(maskWidth)) ? "".concat(maskWidth) : "".concat(maskWidth, "px"));
|
|
4423
|
+
useCSSVariable('--mask-height', Number.isNaN(Number(maskHeight)) ? "".concat(maskHeight) : "".concat(maskHeight, "px"));
|
|
4104
4424
|
useCSSVariable('--flyout-max-height', "".concat(paneMaxHeight, "px"));
|
|
4105
4425
|
useCSSVariable('--flyout-bottom-padding', "".concat(paneBottomPadding, "px"));
|
|
4106
4426
|
useOverlay({
|
|
@@ -4399,7 +4719,7 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
4399
4719
|
}, /*#__PURE__*/React__default["default"].createElement(reactDropdownMenu.SubTrigger, _extends__default["default"]({
|
|
4400
4720
|
className: classNames__default["default"](styles$5.menuItem, styles$5.subMenu, {
|
|
4401
4721
|
[styles$5.unresponsive]: !paneContainingTriggerIsInteractive,
|
|
4402
|
-
[styles$
|
|
4722
|
+
[styles$4.selectedItem]: triggerCheckedState === 'true' && !isSelectedItems
|
|
4403
4723
|
}),
|
|
4404
4724
|
"data-testid": triggerDataTestId,
|
|
4405
4725
|
"aria-disabled": isDisabled,
|
|
@@ -4428,7 +4748,7 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
4428
4748
|
}
|
|
4429
4749
|
}, subSelectTriggerProps), multiselect && !isSelectedItems ? /*#__PURE__*/React__default["default"].createElement(AdvancedTableCheckbox, {
|
|
4430
4750
|
state: triggerCheckedState,
|
|
4431
|
-
className: styles$
|
|
4751
|
+
className: styles$4.checkbox,
|
|
4432
4752
|
onClick: onTriggerCheckboxSelect,
|
|
4433
4753
|
isDisabled: isDisabled
|
|
4434
4754
|
}) : null, label, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronRightIcon, {
|
|
@@ -4493,804 +4813,585 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
4493
4813
|
});
|
|
4494
4814
|
var SubMenu$1 = SubMenu;
|
|
4495
4815
|
|
|
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$
|
|
4816
|
+
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}";
|
|
4817
|
+
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"};
|
|
4818
|
+
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}";
|
|
4819
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$4);}
|
|
4500
4820
|
|
|
4501
|
-
|
|
4502
|
-
|
|
4821
|
+
var growingInput = 'Pagination_growingInput__1iropsc2';
|
|
4822
|
+
var hidden = 'Pagination_hidden__1iropsc3';
|
|
4823
|
+
var pageNumber = 'Pagination_pageNumber__1iropsc1';
|
|
4824
|
+
var pagination = 'Pagination_pagination__1iropsc0';
|
|
4825
|
+
var rowCount = 'Pagination_rowCount__1iropsc4';
|
|
4826
|
+
|
|
4827
|
+
const INVALID_INTEGER_INPUT_CHARS = ['-', '+', 'e', '.'];
|
|
4828
|
+
const coalesceIntegerToRange = (value, min, max) => Math.min(Math.max(Math.round(value), min), max);
|
|
4829
|
+
const GrowingIntegerInput = _ref => {
|
|
4503
4830
|
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
|
|
4831
|
+
value,
|
|
4832
|
+
onChangeInput,
|
|
4833
|
+
max,
|
|
4834
|
+
min,
|
|
4835
|
+
...rest
|
|
4517
4836
|
} = _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);
|
|
4837
|
+
const [width, setWidth] = React.useState(0);
|
|
4838
|
+
const [internalValue, setInternalValue] = React.useState(value);
|
|
4839
|
+
const [previousExternalValue, setPreviousExternalValue] = React.useState(value);
|
|
4840
|
+
const span = React.useRef(null);
|
|
4841
|
+
if (value !== previousExternalValue) {
|
|
4842
|
+
setPreviousExternalValue(value);
|
|
4843
|
+
setInternalValue(value);
|
|
4844
|
+
}
|
|
4845
|
+
index.useSSRLayoutEffect(() => {
|
|
4846
|
+
var _span$current$offsetW, _span$current;
|
|
4847
|
+
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);
|
|
4848
|
+
}, [internalValue]);
|
|
4849
|
+
const triggerInternalChange = e => {
|
|
4850
|
+
setInternalValue(coalesceIntegerToRange(Number(e.target.value), Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER));
|
|
4536
4851
|
};
|
|
4537
|
-
const
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4852
|
+
const triggerExternalChange = e => {
|
|
4853
|
+
const maxNumber = Number(max) || Number.MAX_SAFE_INTEGER;
|
|
4854
|
+
const minNumber = Number(min) || Number.MIN_SAFE_INTEGER;
|
|
4855
|
+
const newValue = coalesceIntegerToRange(Number(e.target.value), minNumber, maxNumber);
|
|
4856
|
+
setInternalValue(newValue);
|
|
4857
|
+
onChangeInput(newValue);
|
|
4542
4858
|
};
|
|
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);
|
|
4859
|
+
const onKeyDownHandler = e => {
|
|
4860
|
+
if (e.key === 'Enter') {
|
|
4861
|
+
triggerExternalChange(e);
|
|
4862
|
+
} else if (INVALID_INTEGER_INPUT_CHARS.includes(e.key)) {
|
|
4863
|
+
e.preventDefault();
|
|
4573
4864
|
}
|
|
4574
4865
|
};
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
className:
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4866
|
+
const displayValue = internalValue.toString();
|
|
4867
|
+
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
4868
|
+
className: growingInput
|
|
4869
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
4870
|
+
className: hidden,
|
|
4871
|
+
ref: span
|
|
4872
|
+
}, displayValue), /*#__PURE__*/React__default["default"].createElement(index.Input$1, _extends__default["default"]({
|
|
4873
|
+
type: "number",
|
|
4874
|
+
value: displayValue,
|
|
4583
4875
|
style: {
|
|
4584
4876
|
width,
|
|
4585
|
-
|
|
4586
|
-
zIndex
|
|
4877
|
+
minWidth: 1
|
|
4587
4878
|
},
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4879
|
+
onChange: triggerInternalChange,
|
|
4880
|
+
onKeyDown: onKeyDownHandler,
|
|
4881
|
+
onBlur: triggerExternalChange
|
|
4882
|
+
}, rest)));
|
|
4883
|
+
};
|
|
4884
|
+
const PageInput = _ref2 => {
|
|
4885
|
+
let {
|
|
4886
|
+
numPages,
|
|
4887
|
+
currentPage,
|
|
4888
|
+
onChange,
|
|
4889
|
+
'aria-label': ariaLabel,
|
|
4890
|
+
disabled,
|
|
4891
|
+
'data-testid': dataTestId
|
|
4892
|
+
} = _ref2;
|
|
4893
|
+
const delegatedInput = /*#__PURE__*/React__default["default"].createElement(GrowingIntegerInput, {
|
|
4894
|
+
max: numPages !== null && numPages !== void 0 ? numPages : undefined,
|
|
4895
|
+
min: 1,
|
|
4896
|
+
disabled: disabled,
|
|
4897
|
+
key: "currentPage",
|
|
4898
|
+
value: currentPage,
|
|
4591
4899
|
"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;
|
|
4900
|
+
onChangeInput: onChange,
|
|
4901
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'input')
|
|
4902
|
+
});
|
|
4903
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4904
|
+
className: pageNumber
|
|
4905
|
+
}, numPages ? /*#__PURE__*/React__default["default"].createElement(index.Translate, {
|
|
4906
|
+
messageKey: "pagination",
|
|
4907
|
+
placeholders: {
|
|
4908
|
+
currentPage: delegatedInput,
|
|
4909
|
+
numPages
|
|
4910
|
+
}
|
|
4911
|
+
}) : delegatedInput);
|
|
4611
4912
|
};
|
|
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 => {
|
|
4913
|
+
const Pagination = _ref3 => {
|
|
4619
4914
|
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
|
-
}
|
|
4915
|
+
hidePageNumber = false,
|
|
4916
|
+
hideFirstAndLastButtons = false,
|
|
4917
|
+
numPages,
|
|
4918
|
+
currentPage,
|
|
4919
|
+
onPageChange,
|
|
4920
|
+
isDisabled = false,
|
|
4921
|
+
'data-testid': dataTestId
|
|
4922
|
+
} = _ref3;
|
|
4923
|
+
const {
|
|
4924
|
+
translate
|
|
4925
|
+
} = index.useTranslation();
|
|
4926
|
+
const announceToScreenReader = index.useScreenReaderAnnouncement('polite');
|
|
4927
|
+
index.useDidUpdate(() => {
|
|
4928
|
+
let messageKey = 'currentPageNumber';
|
|
4929
|
+
const placeholders = {
|
|
4930
|
+
currentPage
|
|
4931
|
+
};
|
|
4932
|
+
if (numPages) {
|
|
4933
|
+
messageKey = 'currentPageNumberOf';
|
|
4934
|
+
placeholders.numPages = numPages;
|
|
4645
4935
|
}
|
|
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
|
-
});
|
|
4936
|
+
announceToScreenReader(translate(messageKey, placeholders));
|
|
4937
|
+
}, [announceToScreenReader, translate, currentPage, numPages]);
|
|
4938
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4939
|
+
className: pagination,
|
|
4940
|
+
"data-testid": dataTestId
|
|
4941
|
+
}, !hideFirstAndLastButtons && numPages && /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
4942
|
+
"aria-label": translate('firstPage'),
|
|
4943
|
+
onClick: () => onPageChange(1),
|
|
4944
|
+
disabled: isDisabled || currentPage <= 1,
|
|
4945
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'first-page')
|
|
4946
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronSkipBackIcon, null)), /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
4947
|
+
"aria-label": translate('previousPage'),
|
|
4948
|
+
disabled: isDisabled || currentPage <= 1,
|
|
4949
|
+
onClick: () => onPageChange(currentPage - 1),
|
|
4950
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'previous-page')
|
|
4951
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronLeftIcon, null)), !hidePageNumber && /*#__PURE__*/React__default["default"].createElement(PageInput, {
|
|
4952
|
+
"aria-label": translate('currentPage'),
|
|
4953
|
+
currentPage: currentPage,
|
|
4954
|
+
numPages: numPages,
|
|
4955
|
+
onChange: onPageChange,
|
|
4956
|
+
disabled: isDisabled || numPages === 1,
|
|
4957
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'current-page')
|
|
4958
|
+
}), /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
4959
|
+
"aria-label": translate('nextPage'),
|
|
4960
|
+
disabled: isDisabled || numPages !== undefined && currentPage >= numPages,
|
|
4961
|
+
onClick: () => onPageChange(currentPage + 1),
|
|
4962
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'next-page')
|
|
4963
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronRightIcon, null)), !hideFirstAndLastButtons && numPages && /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
4964
|
+
"aria-label": translate('lastPage'),
|
|
4965
|
+
disabled: isDisabled || currentPage >= numPages,
|
|
4966
|
+
onClick: () => onPageChange(numPages),
|
|
4967
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'last-page')
|
|
4968
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronSkipForwardIcon, null)));
|
|
4690
4969
|
};
|
|
4691
4970
|
|
|
4692
|
-
const
|
|
4971
|
+
const SelectPane = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
4972
|
+
let {
|
|
4973
|
+
children,
|
|
4974
|
+
isSearchable,
|
|
4975
|
+
placement,
|
|
4976
|
+
showSelectedItemsPane = false,
|
|
4977
|
+
searchValue,
|
|
4978
|
+
onSearchValueChange,
|
|
4979
|
+
isSearchFilteringDisabled,
|
|
4980
|
+
zIndex,
|
|
4981
|
+
...rest
|
|
4982
|
+
} = _ref;
|
|
4983
|
+
const selectContext = useSelectContext();
|
|
4693
4984
|
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
|
|
4985
|
+
multiselect
|
|
4986
|
+
} = selectContext;
|
|
4987
|
+
const sharedMenuProps = {
|
|
4988
|
+
placement,
|
|
4989
|
+
isSearchable,
|
|
4990
|
+
searchValue,
|
|
4991
|
+
onSearchValueChange,
|
|
4992
|
+
isSearchFilteringDisabled,
|
|
4993
|
+
zIndex,
|
|
4994
|
+
ref
|
|
4723
4995
|
};
|
|
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
|
-
}
|
|
4996
|
+
return /*#__PURE__*/React__default["default"].createElement(SelectContextProvider, {
|
|
4997
|
+
value: {
|
|
4998
|
+
...selectContext,
|
|
4999
|
+
showSelectedItemsPane
|
|
4755
5000
|
}
|
|
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');
|
|
5001
|
+
}, /*#__PURE__*/React__default["default"].createElement(MenuPane, _extends__default["default"]({}, rest, sharedMenuProps, {
|
|
5002
|
+
"aria-multiselectable": Boolean(multiselect),
|
|
5003
|
+
role: "tree"
|
|
5004
|
+
}), children));
|
|
5005
|
+
});
|
|
5006
|
+
|
|
5007
|
+
const GetSelectItemsFrom = function (startingChildren) {
|
|
5008
|
+
let filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
5009
|
+
const current = [];
|
|
5010
|
+
if (!startingChildren) {
|
|
5011
|
+
return current;
|
|
4802
5012
|
}
|
|
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');
|
|
5013
|
+
const childrenArray = Array.isArray(startingChildren) ? startingChildren : [startingChildren];
|
|
5014
|
+
childrenArray.forEach(child => {
|
|
5015
|
+
if (filter && !filter(child.props)) {
|
|
5016
|
+
return;
|
|
4813
5017
|
}
|
|
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');
|
|
5018
|
+
if (child.type === SelectItem) {
|
|
5019
|
+
const {
|
|
5020
|
+
label,
|
|
5021
|
+
value: childValue,
|
|
5022
|
+
children: childChildren
|
|
5023
|
+
} = child.props;
|
|
5024
|
+
const safeLabel = label !== null && label !== void 0 ? label : ['string', 'number'].includes(typeof childChildren) ? childChildren : undefined;
|
|
5025
|
+
current.push([childValue, safeLabel]);
|
|
5026
|
+
} else if (child.type === SubSelect) {
|
|
5027
|
+
current.push(...GetSelectItemsFrom(child.props.children, filter));
|
|
4843
5028
|
}
|
|
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
|
-
};
|
|
5029
|
+
});
|
|
5030
|
+
return current;
|
|
4859
5031
|
};
|
|
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) => {
|
|
5032
|
+
const Select = _ref => {
|
|
4868
5033
|
let {
|
|
5034
|
+
multiselect,
|
|
5035
|
+
children,
|
|
5036
|
+
isDisabled,
|
|
4869
5037
|
onChange,
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
setIsFlyoutOpen,
|
|
4874
|
-
setShouldMoveSelectionToEnd,
|
|
4875
|
-
shouldMoveSelectionToEnd,
|
|
5038
|
+
isOpen,
|
|
5039
|
+
onIsOpenChange,
|
|
5040
|
+
value,
|
|
4876
5041
|
isInvalid,
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
id,
|
|
4880
|
-
dataTestId,
|
|
4881
|
-
ariaControls,
|
|
4882
|
-
ariaActiveDescendant,
|
|
4883
|
-
ariaLabel,
|
|
4884
|
-
ariaLabelledBy,
|
|
4885
|
-
ariaDescribedBy,
|
|
4886
|
-
isOptionHovered
|
|
5042
|
+
'data-testid': dataTestId,
|
|
5043
|
+
isVirtualizationDisabled
|
|
4887
5044
|
} = _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
|
-
};
|
|
5045
|
+
const [selectedValues, setSelectedValues] = index.useControllableState(value, onChange, value);
|
|
5046
|
+
const selectPaneChildren = React.useMemo(() => {
|
|
5047
|
+
var _children$find;
|
|
5048
|
+
return Array.isArray(children) ? (_children$find = children.find(child => child.type === SelectPane)) === null || _children$find === void 0 ? void 0 : _children$find.props.children : null;
|
|
5049
|
+
}, [children]);
|
|
5050
|
+
const selectedSelectItems = React.useMemo(() => {
|
|
5051
|
+
if (Array.isArray(selectedValues)) {
|
|
5052
|
+
return new Map(GetSelectItemsFrom(selectPaneChildren, _ref2 => {
|
|
5053
|
+
let {
|
|
5054
|
+
value: _value
|
|
5055
|
+
} = _ref2;
|
|
5056
|
+
return _value == null || selectedValues.includes(_value);
|
|
5057
|
+
}));
|
|
4922
5058
|
}
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
5059
|
+
return new Map(GetSelectItemsFrom(selectPaneChildren, _ref3 => {
|
|
5060
|
+
let {
|
|
5061
|
+
value: _value
|
|
5062
|
+
} = _ref3;
|
|
5063
|
+
return _value == null || selectedValues === _value;
|
|
5064
|
+
}));
|
|
5065
|
+
}, [selectedValues, selectPaneChildren]);
|
|
5066
|
+
const enabledSelectItems = React.useMemo(() => new Map(GetSelectItemsFrom(selectPaneChildren, _ref4 => {
|
|
5067
|
+
let {
|
|
5068
|
+
isDisabled: _isDisabled
|
|
5069
|
+
} = _ref4;
|
|
5070
|
+
return !_isDisabled;
|
|
5071
|
+
})), [selectPaneChildren]);
|
|
5072
|
+
const onItemSelect = React.useCallback((_value, isSelected) => {
|
|
5073
|
+
setSelectedValues(currentSelectedValues => {
|
|
5074
|
+
if (multiselect) {
|
|
5075
|
+
if (Array.isArray(currentSelectedValues)) {
|
|
5076
|
+
const clone = new Set(currentSelectedValues);
|
|
5077
|
+
if (isSelected) {
|
|
5078
|
+
clone.add(_value);
|
|
5079
|
+
} else {
|
|
5080
|
+
clone.delete(_value);
|
|
5081
|
+
}
|
|
5082
|
+
return Array.from(clone);
|
|
5083
|
+
}
|
|
5084
|
+
if (isSelected) {
|
|
5085
|
+
return [_value];
|
|
5086
|
+
}
|
|
5087
|
+
} else if (isSelected) {
|
|
5088
|
+
return _value;
|
|
5089
|
+
}
|
|
5090
|
+
return currentSelectedValues;
|
|
5091
|
+
});
|
|
5092
|
+
}, [setSelectedValues, multiselect]);
|
|
5093
|
+
const sharedMenuProps = {
|
|
5094
|
+
isDisabled,
|
|
5095
|
+
isOpen,
|
|
5096
|
+
onIsOpenChange,
|
|
5097
|
+
'data-testid': dataTestId,
|
|
5098
|
+
isVirtualizationDisabled
|
|
5099
|
+
};
|
|
5100
|
+
return /*#__PURE__*/React__default["default"].createElement(SelectContextProvider, {
|
|
5101
|
+
value: {
|
|
5102
|
+
multiselect,
|
|
5103
|
+
onItemSelect,
|
|
5104
|
+
selectedValues,
|
|
5105
|
+
selectedSelectItems,
|
|
5106
|
+
GetSelectItemsFrom,
|
|
5107
|
+
isInvalid,
|
|
5108
|
+
setSelectedValues,
|
|
5109
|
+
enabledSelectItems
|
|
5110
|
+
}
|
|
5111
|
+
}, /*#__PURE__*/React__default["default"].createElement(Menu, sharedMenuProps, children));
|
|
5112
|
+
};
|
|
4943
5113
|
|
|
4944
|
-
const
|
|
5114
|
+
const SelectButton = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
4945
5115
|
let {
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
inputRef
|
|
5116
|
+
children,
|
|
5117
|
+
asChild,
|
|
5118
|
+
placeholder: externalPlaceholder,
|
|
5119
|
+
...rest
|
|
4951
5120
|
} = _ref;
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
5121
|
+
const {
|
|
5122
|
+
selectedSelectItems,
|
|
5123
|
+
isInvalid,
|
|
5124
|
+
multiselect
|
|
5125
|
+
} = useSelectContext();
|
|
5126
|
+
const {
|
|
5127
|
+
translate
|
|
5128
|
+
} = index.useTranslation();
|
|
5129
|
+
const placeholder = externalPlaceholder !== null && externalPlaceholder !== void 0 ? externalPlaceholder : multiselect ? translate('selectOneOrMore') : translate('selectOne');
|
|
5130
|
+
const selectedItemsString = React.useMemo(() => Array.from(selectedSelectItems)
|
|
5131
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5132
|
+
.map(_ref2 => {
|
|
5133
|
+
let [value, label] = _ref2;
|
|
5134
|
+
return label;
|
|
5135
|
+
}).join(', '), [selectedSelectItems]);
|
|
5136
|
+
const sharedMenuButtonProps = {
|
|
5137
|
+
ref,
|
|
5138
|
+
asChild
|
|
5139
|
+
};
|
|
5140
|
+
return /*#__PURE__*/React__default["default"].createElement(MenuButton, _extends__default["default"]({}, rest, sharedMenuButtonProps, {
|
|
5141
|
+
"aria-haspopup": "tree",
|
|
5142
|
+
role: "combobox",
|
|
5143
|
+
className: classNames__default["default"]({
|
|
5144
|
+
[styles$4.isInvalid]: isInvalid
|
|
4958
5145
|
})
|
|
4959
|
-
},
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
5146
|
+
}), children !== null && children !== void 0 ? children : selectedSelectItems !== null && selectedSelectItems !== void 0 && selectedSelectItems.size ? selectedItemsString : placeholder);
|
|
5147
|
+
});
|
|
5148
|
+
|
|
5149
|
+
const RowDisplayCount = _ref => {
|
|
5150
|
+
let {
|
|
5151
|
+
'data-testid': dataTestId,
|
|
5152
|
+
displayCount,
|
|
5153
|
+
displayCountOptions,
|
|
5154
|
+
onDisplayCountChange,
|
|
5155
|
+
isDisabled = false
|
|
5156
|
+
} = _ref;
|
|
5157
|
+
const displayCountSelect = /*#__PURE__*/React__default["default"].createElement(Select, {
|
|
5158
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'select'),
|
|
5159
|
+
isDisabled: isDisabled,
|
|
5160
|
+
value: displayCount,
|
|
5161
|
+
onChange: onDisplayCountChange,
|
|
5162
|
+
key: "displayCountSelect"
|
|
5163
|
+
}, /*#__PURE__*/React__default["default"].createElement(SelectButton, null), /*#__PURE__*/React__default["default"].createElement(SelectPane, {
|
|
5164
|
+
style: {
|
|
5165
|
+
minWidth: 'var(--radix-dropdown-menu-trigger-width)'
|
|
5166
|
+
}
|
|
5167
|
+
}, displayCountOptions === null || displayCountOptions === void 0 ? void 0 : displayCountOptions.map(option => /*#__PURE__*/React__default["default"].createElement(SelectItem, {
|
|
5168
|
+
value: option,
|
|
5169
|
+
label: "".concat(option),
|
|
5170
|
+
key: option
|
|
5171
|
+
}))));
|
|
5172
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5173
|
+
className: rowCount,
|
|
5174
|
+
"data-testid": dataTestId
|
|
5175
|
+
}, /*#__PURE__*/React__default["default"].createElement(index.Translate, {
|
|
5176
|
+
messageKey: "rowDisplayCount",
|
|
5177
|
+
placeholders: {
|
|
5178
|
+
select: displayCountSelect
|
|
5179
|
+
}
|
|
4967
5180
|
}));
|
|
4968
5181
|
};
|
|
4969
5182
|
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
minute
|
|
4977
|
-
};
|
|
4978
|
-
})();
|
|
4979
|
-
const TimePicker = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
5183
|
+
var css_248z$3 = "._7Jk3A input{padding-left:76px!important}._-08BE input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._-08BE input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._-08BE input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._yrkU4{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._yrkU4,._yrkU4._-08BE:hover{background-color:transparent!important}._yrkU4:hover{background-color:rgba(50,54,58,.08)!important}._yrkU4:active{background-color:rgba(50,54,58,.11)!important}._yrkU4 svg{top:2px!important}._yZcqR{position:relative}._el7Ra{position:absolute;top:18px;left:12px;line-height:0;font-size:14px;color:#32363a;z-index:101;pointer-events:none}";
|
|
5184
|
+
var styles$3 = {"input":"_7Jk3A","disabled":"_-08BE","dropdown":"_yrkU4","container":"_yZcqR","countryCode":"_el7Ra"};
|
|
5185
|
+
var stylesheet$3="._7Jk3A input{padding-left:76px!important}._-08BE input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._-08BE input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._-08BE input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._yrkU4{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._yrkU4,._yrkU4._-08BE:hover{background-color:transparent!important}._yrkU4:hover{background-color:rgba(50,54,58,.08)!important}._yrkU4:active{background-color:rgba(50,54,58,.11)!important}._yrkU4 svg{top:2px!important}._yZcqR{position:relative}._el7Ra{position:absolute;top:18px;left:12px;line-height:0;font-size:14px;color:#32363a;z-index:101;pointer-events:none}";
|
|
5186
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$3);}
|
|
5187
|
+
|
|
5188
|
+
const PhoneNumberInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
4980
5189
|
let {
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
5190
|
+
initialCountryCode = 'US',
|
|
5191
|
+
countryCodes,
|
|
5192
|
+
onChange,
|
|
5193
|
+
limitToValidLength = false,
|
|
5194
|
+
isDisabled,
|
|
5195
|
+
initialValue,
|
|
5196
|
+
buttonAriaLabel,
|
|
5197
|
+
inputAriaLabel,
|
|
5198
|
+
buttonAriaLabelledBy,
|
|
5199
|
+
inputAriaLabelledBy,
|
|
4987
5200
|
'data-testid': dataTestId,
|
|
4988
|
-
|
|
4989
|
-
'aria-labelledby': ariaLabelledBy,
|
|
4990
|
-
'aria-describedby': ariaDescribedBy
|
|
5201
|
+
inputId
|
|
4991
5202
|
} = _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;
|
|
5203
|
+
const [countryCode, setCountryCode] = React.useState(initialCountryCode);
|
|
5204
|
+
const [mask, setMask] = React.useState();
|
|
5205
|
+
// As of the day of writing the longest number format is 15 numbers long. This is 5 places longer to be safe.
|
|
5206
|
+
const genericMaxNumberLength = 20;
|
|
5207
|
+
const {
|
|
5208
|
+
translate
|
|
5209
|
+
} = index.useTranslation();
|
|
5210
|
+
const getMinMaxLength = React.useCallback(() => {
|
|
5211
|
+
var _metadata$numberingPl;
|
|
5212
|
+
const metadata = new libphonenumberJs.Metadata();
|
|
5213
|
+
metadata.selectNumberingPlan(countryCode);
|
|
5214
|
+
const possibleLengths = metadata === null || metadata === void 0 || (_metadata$numberingPl = metadata.numberingPlan) === null || _metadata$numberingPl === void 0 ? void 0 : _metadata$numberingPl.possibleLengths();
|
|
5215
|
+
return possibleLengths ? [Math.min(...possibleLengths), Math.max(...possibleLengths)] : [0, genericMaxNumberLength];
|
|
5216
|
+
}, [countryCode]);
|
|
5217
|
+
const shouldUseMask = Number(libphonenumberJs.getCountryCallingCode(countryCode)) === 1;
|
|
5218
|
+
const updateMask = React.useCallback(() => {
|
|
5219
|
+
if (shouldUseMask) {
|
|
5220
|
+
setMask('(999) 999-9999');
|
|
5221
|
+
} else {
|
|
5222
|
+
setMask('9'.repeat(limitToValidLength ? getMinMaxLength()[1] : genericMaxNumberLength));
|
|
5022
5223
|
}
|
|
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.
|
|
5224
|
+
}, [shouldUseMask, getMinMaxLength, limitToValidLength]);
|
|
5033
5225
|
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
|
-
}
|
|
5226
|
+
updateMask();
|
|
5227
|
+
}, [countryCode, updateMask]);
|
|
5228
|
+
const removeNonNumericCharacters = value => value === null || value === void 0 ? void 0 : value.replace(/\D/g, '');
|
|
5229
|
+
const handleInputChange = a => {
|
|
5230
|
+
// remove all non-numeric characters
|
|
5231
|
+
const value = removeNonNumericCharacters(a.target.value);
|
|
5232
|
+
let internationalNumber = null;
|
|
5233
|
+
let isValidLength = false;
|
|
5234
|
+
if (!value) {
|
|
5235
|
+
return;
|
|
5236
|
+
}
|
|
5237
|
+
try {
|
|
5238
|
+
const phoneNumber = libphonenumberJs.parsePhoneNumber(value, countryCode);
|
|
5239
|
+
internationalNumber = phoneNumber.format('E.164');
|
|
5240
|
+
isValidLength = phoneNumber.isPossible();
|
|
5241
|
+
} catch (e) {
|
|
5242
|
+
// `parsePhoneNumber` throws an error if the inputs are invalid.
|
|
5243
|
+
}
|
|
5244
|
+
onChange === null || onChange === void 0 || onChange(internationalNumber, isValidLength, countryCode, value);
|
|
5144
5245
|
};
|
|
5246
|
+
const inputClassNames = classNames__default["default"](styles$3.input, {
|
|
5247
|
+
[styles$3.disabled]: isDisabled
|
|
5248
|
+
});
|
|
5249
|
+
const dropdownLabel = React.useMemo(() => countryCode ? "+".concat(libphonenumberJs.getCountryCallingCode(countryCode)) : undefined, [countryCode]);
|
|
5145
5250
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
5251
|
+
className: styles$3.container,
|
|
5252
|
+
"data-testid": dataTestId
|
|
5253
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
5254
|
+
className: styles$3.countryCode
|
|
5255
|
+
}, dropdownLabel), /*#__PURE__*/React__default["default"].createElement(index.SelectMenu, {
|
|
5256
|
+
label: " ",
|
|
5257
|
+
defaultValue: countryCode,
|
|
5258
|
+
onChange: value => setCountryCode(value),
|
|
5259
|
+
className: classNames__default["default"](styles$3.dropdown, {
|
|
5260
|
+
[styles$3.disabled]: isDisabled
|
|
5261
|
+
}),
|
|
5262
|
+
searchable: true,
|
|
5263
|
+
disabled: isDisabled,
|
|
5264
|
+
"aria-label": buttonAriaLabel,
|
|
5265
|
+
"aria-labelledby": buttonAriaLabelledBy
|
|
5266
|
+
}, (countryCodes !== null && countryCodes !== void 0 ? countryCodes : libphonenumberJs.getCountries()).map(individualCountryCode => {
|
|
5267
|
+
if (!libphonenumberJs.isSupportedCountry(individualCountryCode)) {
|
|
5268
|
+
return null;
|
|
5269
|
+
}
|
|
5270
|
+
return /*#__PURE__*/React__default["default"].createElement(index.MenuItem, {
|
|
5271
|
+
key: individualCountryCode,
|
|
5272
|
+
value: individualCountryCode
|
|
5273
|
+
}, "".concat(translate(individualCountryCode), " +").concat(libphonenumberJs.getCountryCallingCode(individualCountryCode)));
|
|
5274
|
+
})), /*#__PURE__*/React__default["default"].createElement(InputMask__default["default"], {
|
|
5275
|
+
value: isDisabled ? removeNonNumericCharacters(initialValue) : undefined,
|
|
5276
|
+
type: "tel",
|
|
5277
|
+
alwaysShowMask: true
|
|
5278
|
+
// hide formatting if not using mask
|
|
5279
|
+
,
|
|
5280
|
+
maskChar: shouldUseMask ? '_' : '',
|
|
5281
|
+
mask: mask,
|
|
5282
|
+
onChange: !isDisabled ? handleInputChange : undefined
|
|
5283
|
+
}, () => /*#__PURE__*/React__default["default"].createElement(index.Input$1, {
|
|
5284
|
+
ref: ref,
|
|
5149
5285
|
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
|
-
}));
|
|
5286
|
+
className: inputClassNames,
|
|
5287
|
+
type: "tel",
|
|
5288
|
+
autoComplete: "tel-national",
|
|
5289
|
+
"aria-label": inputAriaLabel,
|
|
5290
|
+
"aria-labelledby": inputAriaLabelledBy,
|
|
5291
|
+
initialValue: isDisabled ? undefined : removeNonNumericCharacters(initialValue)
|
|
5292
|
+
})));
|
|
5188
5293
|
});
|
|
5189
5294
|
|
|
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);}
|
|
5295
|
+
var css_248z$2 = "._Leube{display:flex}._9r05A{z-index:2;width:1px;margin-left:-1px;margin-right:-1px}._9r05A._L3S7p{background-color:#fff}._9r05A._L3S7p._aTjxl:not(._9r05A._L3S7p._s3dro),._9r05A._L3S7p._ypSlZ.focus-visible:not(._T93zj),._9r05A._L3S7p._ypSlZ:focus-visible:not(._T93zj),._9r05A._rSgmZ{background-color:#0b6ed0}._9r05A._rSgmZ._s3dro._aTjxl,._9r05A._rSgmZ._T93zj._s3dro,._9r05A._rSgmZ._T93zj._ypSlZ{opacity:.4}._60YdE{border-radius:4px 0 0 4px;border-right:none;padding-right:17px}._60YdE:focus{z-index:1}._cs1tH{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}._cs1tH svg{margin-left:1px}._cs1tH._L3S7p{background-color:#0b6ed0;border-color:transparent}._cs1tH._L3S7p svg{fill:#fff!important}._cs1tH._L3S7p:not(._xEgut):hover{background-color:#085caf!important}._cs1tH._L3S7p:not(._xEgut):active{background-color:#0854a1!important}._cs1tH._L3S7p._xEgut{opacity:.4}._cs1tH._L3S7p._xEgut svg{background-color:transparent}._cs1tH._rSgmZ{border-color:#0b6ed0;background-color:#fff}._cs1tH._rSgmZ svg{fill:#0b6ed0!important}._cs1tH._rSgmZ:not(._xEgut):hover{background-color:#eef5fc!important}._cs1tH._rSgmZ:not(._xEgut):active{background-color:#e1edf9!important}._cs1tH._rSgmZ._xEgut{opacity:.4}._cs1tH._rSgmZ._xEgut svg{background-color:transparent}._NbKkk{width:260px}";
|
|
5296
|
+
var styles$2 = {"container":"_Leube","divider":"_9r05A","primary":"_L3S7p","mainButtonFocus":"_ypSlZ","mainButtonDisabled":"_T93zj","dropdownButtonFocus":"_aTjxl","dropdownButtonDisabled":"_s3dro","secondary":"_rSgmZ","mainButton":"_60YdE","dropdownButton":"_cs1tH","disabled":"_xEgut","dropdownOption":"_NbKkk"};
|
|
5297
|
+
var stylesheet$2="._Leube{display:flex}._9r05A{z-index:2;width:1px;margin-left:-1px;margin-right:-1px}._9r05A._L3S7p{background-color:#fff}._9r05A._L3S7p._aTjxl:not(._9r05A._L3S7p._s3dro),._9r05A._L3S7p._ypSlZ.focus-visible:not(._T93zj),._9r05A._L3S7p._ypSlZ:focus-visible:not(._T93zj),._9r05A._rSgmZ{background-color:#0b6ed0}._9r05A._rSgmZ._s3dro._aTjxl,._9r05A._rSgmZ._T93zj._s3dro,._9r05A._rSgmZ._T93zj._ypSlZ{opacity:.4}._60YdE{border-radius:4px 0 0 4px;border-right:none;padding-right:17px}._60YdE:focus{z-index:1}._cs1tH{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}._cs1tH svg{margin-left:1px}._cs1tH._L3S7p{background-color:#0b6ed0;border-color:transparent}._cs1tH._L3S7p svg{fill:#fff!important}._cs1tH._L3S7p:not(._xEgut):hover{background-color:#085caf!important}._cs1tH._L3S7p:not(._xEgut):active{background-color:#0854a1!important}._cs1tH._L3S7p._xEgut{opacity:.4}._cs1tH._L3S7p._xEgut svg{background-color:transparent}._cs1tH._rSgmZ{border-color:#0b6ed0;background-color:#fff}._cs1tH._rSgmZ svg{fill:#0b6ed0!important}._cs1tH._rSgmZ:not(._xEgut):hover{background-color:#eef5fc!important}._cs1tH._rSgmZ:not(._xEgut):active{background-color:#e1edf9!important}._cs1tH._rSgmZ._xEgut{opacity:.4}._cs1tH._rSgmZ._xEgut svg{background-color:transparent}._NbKkk{width:260px}";
|
|
5298
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$2);}
|
|
5199
5299
|
|
|
5200
|
-
const
|
|
5300
|
+
const SplitButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
5201
5301
|
let {
|
|
5202
|
-
|
|
5203
|
-
value,
|
|
5204
|
-
onChange,
|
|
5205
|
-
name,
|
|
5302
|
+
kind = 'primary',
|
|
5206
5303
|
label,
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5304
|
+
children,
|
|
5305
|
+
isButtonDisabled = false,
|
|
5306
|
+
isDropdownDisabled = false,
|
|
5307
|
+
'data-testid': dataTestId,
|
|
5308
|
+
className,
|
|
5309
|
+
buttonAriaLabel,
|
|
5310
|
+
buttonAriaLabelledBy,
|
|
5311
|
+
dropdownAriaLabel,
|
|
5312
|
+
dropdownAriaLabelledBy,
|
|
5313
|
+
onClick
|
|
5210
5314
|
} = _ref;
|
|
5211
|
-
const
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
"
|
|
5315
|
+
const mainButtonRef = React.useRef(null);
|
|
5316
|
+
const dropdownButtonRef = React.useRef(null);
|
|
5317
|
+
const [dropdownButtonHasFocus, setDropdownButtonHasFocus] = React.useState(false);
|
|
5318
|
+
const [mainButtonHasFocus, setMainButtonHasFocus] = React.useState(false);
|
|
5319
|
+
|
|
5320
|
+
// 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.
|
|
5321
|
+
index.useEventListener(mainButtonRef, 'keydown', e => {
|
|
5322
|
+
var _dropdownButtonRef$cu;
|
|
5323
|
+
return e.key === 'ArrowRight' && ((_dropdownButtonRef$cu = dropdownButtonRef.current) === null || _dropdownButtonRef$cu === void 0 ? void 0 : _dropdownButtonRef$cu.focus());
|
|
5324
|
+
});
|
|
5325
|
+
index.useEventListener(dropdownButtonRef, 'keydown', e => {
|
|
5326
|
+
var _mainButtonRef$curren;
|
|
5327
|
+
return e.key === 'ArrowLeft' && ((_mainButtonRef$curren = mainButtonRef.current) === null || _mainButtonRef$curren === void 0 ? void 0 : _mainButtonRef$curren.focus());
|
|
5328
|
+
});
|
|
5329
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5330
|
+
"data-testid": dataTestId,
|
|
5331
|
+
className: classNames__default["default"](styles$2.container, className),
|
|
5227
5332
|
ref: ref
|
|
5228
|
-
},
|
|
5229
|
-
|
|
5333
|
+
}, /*#__PURE__*/React__default["default"].createElement(index.Button, {
|
|
5334
|
+
kind: kind,
|
|
5335
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'button'),
|
|
5336
|
+
className: classNames__default["default"](styles$2.mainButton, {
|
|
5337
|
+
[styles$2.disabled]: isButtonDisabled,
|
|
5338
|
+
[styles$2.primary]: kind === 'primary'
|
|
5339
|
+
}),
|
|
5340
|
+
onClick: onClick,
|
|
5341
|
+
disabled: isButtonDisabled,
|
|
5342
|
+
ref: mainButtonRef,
|
|
5343
|
+
tabIndex: dropdownButtonHasFocus ? -1 : 0,
|
|
5344
|
+
"aria-label": buttonAriaLabel,
|
|
5345
|
+
"aria-labelledby": buttonAriaLabelledBy,
|
|
5346
|
+
onFocus: () => setMainButtonHasFocus(true),
|
|
5347
|
+
onBlur: () => setMainButtonHasFocus(false)
|
|
5348
|
+
}, label), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5349
|
+
className: classNames__default["default"](styles$2.divider, {
|
|
5350
|
+
[styles$2.primary]: kind === 'primary',
|
|
5351
|
+
[styles$2.secondary]: kind === 'secondary',
|
|
5352
|
+
[styles$2.mainButtonFocus]: mainButtonHasFocus,
|
|
5353
|
+
[styles$2.dropdownButtonFocus]: dropdownButtonHasFocus,
|
|
5354
|
+
[styles$2.mainButtonDisabled]: isButtonDisabled,
|
|
5355
|
+
[styles$2.dropdownButtonDisabled]: isDropdownDisabled
|
|
5356
|
+
})
|
|
5357
|
+
}), /*#__PURE__*/React__default["default"].createElement(index.Dropdown, {
|
|
5358
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'dropdown'),
|
|
5359
|
+
"aria-label": dropdownAriaLabel,
|
|
5360
|
+
"aria-labelledby": dropdownAriaLabelledBy,
|
|
5361
|
+
value: 0,
|
|
5362
|
+
disabled: isDropdownDisabled
|
|
5363
|
+
}, /*#__PURE__*/React__default["default"].createElement(index.DropdownButton
|
|
5364
|
+
// `label` of type `string` adds Dropdown's `isString` class, which causes a css bug in Safari
|
|
5365
|
+
, {
|
|
5366
|
+
label: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null),
|
|
5367
|
+
className: classNames__default["default"](styles$2.dropdownButton, {
|
|
5368
|
+
[styles$2.disabled]: isDropdownDisabled,
|
|
5369
|
+
[styles$2.primary]: kind === 'primary',
|
|
5370
|
+
[styles$2.secondary]: kind === 'secondary'
|
|
5371
|
+
}),
|
|
5372
|
+
ref: dropdownButtonRef,
|
|
5373
|
+
tabIndex: -1,
|
|
5374
|
+
onFocus: () => setDropdownButtonHasFocus(true),
|
|
5375
|
+
onBlur: () => setDropdownButtonHasFocus(false)
|
|
5376
|
+
}), /*#__PURE__*/React__default["default"].createElement(index.DropdownList, {
|
|
5377
|
+
placement: "bottom"
|
|
5230
5378
|
}, children)));
|
|
5231
5379
|
});
|
|
5232
5380
|
|
|
5233
|
-
const
|
|
5381
|
+
const SplitButtonOption = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
5234
5382
|
let {
|
|
5235
|
-
|
|
5236
|
-
isActivated,
|
|
5237
|
-
onChange,
|
|
5238
|
-
value,
|
|
5383
|
+
onClick,
|
|
5239
5384
|
isDisabled,
|
|
5240
|
-
|
|
5241
|
-
'aria-label': ariaLabel,
|
|
5242
|
-
'aria-labelledby': ariaLabelledby,
|
|
5243
|
-
name: inputName,
|
|
5244
|
-
dataTestId
|
|
5385
|
+
children
|
|
5245
5386
|
} = _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));
|
|
5387
|
+
return /*#__PURE__*/React__default["default"].createElement(index.DropdownOption, {
|
|
5388
|
+
value: -1,
|
|
5389
|
+
label: "",
|
|
5390
|
+
disabled: isDisabled,
|
|
5391
|
+
onSelect: onClick,
|
|
5392
|
+
className: styles$2.dropdownOption,
|
|
5393
|
+
ref: ref
|
|
5394
|
+
}, children);
|
|
5294
5395
|
});
|
|
5295
5396
|
|
|
5296
5397
|
const convertAlignment = alignment => {
|
|
@@ -5414,305 +5515,693 @@ const StackItem = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
5414
5515
|
}, children);
|
|
5415
5516
|
});
|
|
5416
5517
|
|
|
5417
|
-
|
|
5518
|
+
var css_248z$1 = "._eYQqf{display:inline-block;position:relative}._eYQqf ._2ZuhM{width:120px}._eYQqf ._2ZuhM ._3IQsv._U-oN0{transform:rotate(-180deg)}._eYQqf ._2ZuhM ._3IQsv._HdHdw{fill:#9d9fa1;opacity:.4}._eYQqf ._eP-H5>input:focus{box-shadow:none!important;border:1px solid #898989!important}._eYQqf ._3IQsv{position:absolute;right:4px;bottom:4px;height:28px;width:28px}._eYQqf ._3IQsv._U-oN0{transform:rotate(-180deg)}._OfbX8{width:120px}._OfbX8 ._FXTTH._UQIzh{background-color:#efefef;border-radius:6px}";
|
|
5519
|
+
var styles$1 = {"timePickerContainer":"_eYQqf","input":"_2ZuhM","icon":"_3IQsv","open":"_U-oN0","disabled":"_HdHdw","ignoreFocusStyle":"_eP-H5","timePickerFlyout":"_OfbX8","option":"_FXTTH","exactMatch":"_UQIzh"};
|
|
5520
|
+
var stylesheet$1="._eYQqf{display:inline-block;position:relative}._eYQqf ._2ZuhM{width:120px}._eYQqf ._2ZuhM ._3IQsv._U-oN0{transform:rotate(-180deg)}._eYQqf ._2ZuhM ._3IQsv._HdHdw{fill:#9d9fa1;opacity:.4}._eYQqf ._eP-H5>input:focus{box-shadow:none!important;border:1px solid #898989!important}._eYQqf ._3IQsv{position:absolute;right:4px;bottom:4px;height:28px;width:28px}._eYQqf ._3IQsv._U-oN0{transform:rotate(-180deg)}._OfbX8{width:120px}._OfbX8 ._FXTTH._UQIzh{background-color:#efefef;border-radius:6px}";
|
|
5521
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z$1);}
|
|
5522
|
+
|
|
5523
|
+
const TimeDropdown = _ref => {
|
|
5418
5524
|
let {
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5525
|
+
onClick,
|
|
5526
|
+
scrolledToItem,
|
|
5527
|
+
inputRef,
|
|
5528
|
+
dropdownRef,
|
|
5529
|
+
items,
|
|
5530
|
+
id,
|
|
5531
|
+
dataTestId,
|
|
5532
|
+
ariaLabel,
|
|
5533
|
+
ariaLabelledBy,
|
|
5534
|
+
ariaDescribedBy,
|
|
5535
|
+
setIsOptionHovered,
|
|
5536
|
+
isOptionHovered
|
|
5428
5537
|
} = _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
|
|
5538
|
+
const scrollRef = React.useRef(Array(items.length));
|
|
5539
|
+
const [refsInitialized, setRefsInitialized] = React.useState(false);
|
|
5540
|
+
React.useEffect(() => {
|
|
5541
|
+
const nodes = scrollRef.current;
|
|
5542
|
+
if (scrolledToItem) {
|
|
5543
|
+
const nodeToScrollTo = nodes[scrolledToItem.index];
|
|
5544
|
+
if (nodeToScrollTo) {
|
|
5545
|
+
const {
|
|
5546
|
+
parentNode
|
|
5547
|
+
} = nodeToScrollTo;
|
|
5548
|
+
parentNode.scrollTop = nodeToScrollTo.offsetTop;
|
|
5549
|
+
}
|
|
5446
5550
|
}
|
|
5447
|
-
},
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5551
|
+
}, [scrolledToItem, refsInitialized]);
|
|
5552
|
+
return /*#__PURE__*/React__default["default"].createElement(index.Popper, {
|
|
5553
|
+
open: true,
|
|
5554
|
+
isFocusLocked: true,
|
|
5555
|
+
focusLockProps: {
|
|
5556
|
+
returnFocus: true
|
|
5557
|
+
},
|
|
5558
|
+
placement: "bottom",
|
|
5559
|
+
popper: /*#__PURE__*/React__default["default"].createElement(index.Flyout, {
|
|
5560
|
+
anchorRef: inputRef,
|
|
5561
|
+
ref: dropdownRef,
|
|
5562
|
+
id: id,
|
|
5563
|
+
"aria-label": ariaLabel,
|
|
5564
|
+
"aria-labelledby": ariaLabelledBy,
|
|
5565
|
+
"aria-describedby": ariaDescribedBy,
|
|
5566
|
+
"data-testid": dataTestId && "".concat(dataTestId, "-dropdown"),
|
|
5567
|
+
className: styles$1.timePickerFlyout,
|
|
5568
|
+
onMouseOver: () => setIsOptionHovered(true),
|
|
5569
|
+
onMouseLeave: () => setIsOptionHovered(false)
|
|
5570
|
+
}, items.map((item, index$1) => /*#__PURE__*/React__default["default"].createElement(index.FlyoutOption, {
|
|
5571
|
+
id: item.id,
|
|
5572
|
+
isHighlightedOnHover: true,
|
|
5573
|
+
isHighlighted: (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.index) === index$1 && (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.isFocused),
|
|
5574
|
+
key: item.label,
|
|
5575
|
+
ref: node => {
|
|
5576
|
+
if (node) {
|
|
5577
|
+
scrollRef.current[index$1] = node;
|
|
5578
|
+
setRefsInitialized(true);
|
|
5579
|
+
}
|
|
5580
|
+
},
|
|
5581
|
+
onClick: () => onClick(index$1),
|
|
5582
|
+
"data-testid": dataTestId && "".concat(dataTestId, "-option-").concat(index$1),
|
|
5583
|
+
className: classNames__default["default"](styles$1.option, {
|
|
5584
|
+
[styles$1.exactMatch]: (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.index) === index$1 && scrolledToItem.isExactMatch && !isOptionHovered
|
|
5585
|
+
})
|
|
5586
|
+
}, item.label))),
|
|
5587
|
+
anchorNode: inputRef.current,
|
|
5588
|
+
modifiers: [{
|
|
5589
|
+
name: 'offset',
|
|
5590
|
+
options: {
|
|
5591
|
+
offset: [0, 5]
|
|
5592
|
+
}
|
|
5593
|
+
}]
|
|
5594
|
+
});
|
|
5595
|
+
};
|
|
5452
5596
|
|
|
5453
|
-
const
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5597
|
+
const formatUtcDate = (utcDate, is24HourClock) => {
|
|
5598
|
+
const {
|
|
5599
|
+
format
|
|
5600
|
+
} = Intl.DateTimeFormat(undefined, {
|
|
5601
|
+
timeStyle: 'short',
|
|
5602
|
+
timeZone: 'UTC',
|
|
5603
|
+
hourCycle: is24HourClock ? 'h23' : 'h12'
|
|
5604
|
+
});
|
|
5605
|
+
const dateWithoutLeadingZeros = format(utcDate);
|
|
5606
|
+
let dateWithLeadingZeros = dateWithoutLeadingZeros;
|
|
5607
|
+
if (dateWithLeadingZeros.split(':')[0].length === 1) {
|
|
5608
|
+
dateWithLeadingZeros = "0".concat(dateWithLeadingZeros);
|
|
5458
5609
|
}
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5610
|
+
return dateWithLeadingZeros.toLowerCase();
|
|
5611
|
+
};
|
|
5612
|
+
const convertTimeObjectToTimeString = (time, is24HourClock) => {
|
|
5613
|
+
const date = Date.UTC(2000, 0, 0, time.hour, time.minute);
|
|
5614
|
+
return formatUtcDate(date, is24HourClock);
|
|
5615
|
+
};
|
|
5616
|
+
const convertTimeStringToTimeObject = completeTimeString => {
|
|
5617
|
+
const [hourPart, minutePart, amPmPart] = completeTimeString.split(/:| /);
|
|
5618
|
+
let hour = +hourPart;
|
|
5619
|
+
const minute = +minutePart;
|
|
5620
|
+
if (amPmPart === 'am' && hour === 12) {
|
|
5621
|
+
hour = 0;
|
|
5622
|
+
} else if (amPmPart === 'pm' && hour < 12) {
|
|
5623
|
+
hour += 12;
|
|
5624
|
+
}
|
|
5625
|
+
return {
|
|
5626
|
+
hour,
|
|
5627
|
+
minute
|
|
5628
|
+
};
|
|
5629
|
+
};
|
|
5630
|
+
const generateTimes = (step, is24HourClock) => {
|
|
5631
|
+
const secondsInDay = 60 * 60 * 24;
|
|
5632
|
+
return Array.from(Array(secondsInDay / step)).map((_, i) => {
|
|
5633
|
+
const labelWithLeadingZeros = formatUtcDate(Date.UTC(2000, 0, 1, 0, 0, i * step, 0), is24HourClock);
|
|
5634
|
+
return {
|
|
5635
|
+
label: labelWithLeadingZeros,
|
|
5636
|
+
value: i * step,
|
|
5637
|
+
id: "time-option-".concat(i)
|
|
5638
|
+
};
|
|
5475
5639
|
});
|
|
5476
|
-
return current;
|
|
5477
5640
|
};
|
|
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;
|
|
5641
|
+
function getTimeStringCorrector(str, is24HourClock) {
|
|
5642
|
+
var _letterString;
|
|
5643
|
+
let [numberString, letterString] = str.replace(':', '').split(' ');
|
|
5644
|
+
letterString = (_letterString = letterString) === null || _letterString === void 0 ? void 0 : _letterString.toLowerCase();
|
|
5645
|
+
let selectionModifier = 0;
|
|
5646
|
+
const getTimeString = () => {
|
|
5647
|
+
const finalNumberString = "".concat(numberString.slice(0, 2), ":").concat(numberString.slice(2, 4));
|
|
5648
|
+
return is24HourClock ? finalNumberString : "".concat(finalNumberString, " ").concat(letterString);
|
|
5649
|
+
};
|
|
5650
|
+
const getSelectionModifier = () => selectionModifier;
|
|
5651
|
+
const replaceDashes = () => {
|
|
5652
|
+
numberString = numberString.replace(/-/g, '0');
|
|
5653
|
+
if (letterString) {
|
|
5654
|
+
if (letterString[0] === '-' || letterString[0] === 'a') {
|
|
5655
|
+
// Arbitrarily choose AM if user hasn't typed 'a' or 'p'
|
|
5656
|
+
letterString = 'am';
|
|
5657
|
+
} else {
|
|
5658
|
+
letterString = 'pm';
|
|
5535
5659
|
}
|
|
5536
|
-
|
|
5537
|
-
});
|
|
5538
|
-
}, [setSelectedValues, multiselect]);
|
|
5539
|
-
const sharedMenuProps = {
|
|
5540
|
-
isDisabled,
|
|
5541
|
-
isOpen,
|
|
5542
|
-
onIsOpenChange,
|
|
5543
|
-
'data-testid': dataTestId,
|
|
5544
|
-
isVirtualizationDisabled
|
|
5660
|
+
}
|
|
5545
5661
|
};
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5662
|
+
const shiftMinutesRight = () => {
|
|
5663
|
+
numberString = "".concat(numberString.slice(0, 2), "0").concat(numberString[2]);
|
|
5664
|
+
selectionModifier += 1;
|
|
5665
|
+
};
|
|
5666
|
+
const prependCharacter = character => {
|
|
5667
|
+
numberString = "".concat(character).concat(numberString);
|
|
5668
|
+
selectionModifier += 1;
|
|
5669
|
+
};
|
|
5670
|
+
const setHoursTo12 = () => {
|
|
5671
|
+
numberString = "12".concat(numberString.slice(2));
|
|
5672
|
+
};
|
|
5673
|
+
const clearSecondHoursDigit = () => {
|
|
5674
|
+
numberString = "".concat(numberString.slice(0, 1), "0").concat(numberString.slice(2));
|
|
5675
|
+
};
|
|
5676
|
+
const hoursAre00 = () => numberString[0] === '0' && numberString[1] === '0';
|
|
5677
|
+
const firstHourGreaterThan1 = () => !'01-'.includes(numberString[0]);
|
|
5678
|
+
const firstHourGreaterThan2 = () => !'012-'.includes(numberString[0]);
|
|
5679
|
+
const hoursGreaterThan12 = () => numberString[0] === '1' && !'012-'.includes(numberString[1]);
|
|
5680
|
+
const hoursGreaterThan23 = () => numberString[0] === '2' && !'0123-'.includes(numberString[1]);
|
|
5681
|
+
const firstMinuteGreaterThan5 = () => numberString[2] !== '-' && +numberString[2] > 5;
|
|
5682
|
+
const hasTypedMinutes = () => numberString[2] !== '-' && numberString[3] !== '-';
|
|
5683
|
+
return {
|
|
5684
|
+
getTimeString,
|
|
5685
|
+
getSelectionModifier,
|
|
5686
|
+
replaceDashes,
|
|
5687
|
+
setHoursTo12,
|
|
5688
|
+
clearSecondHoursDigit,
|
|
5689
|
+
shiftMinutesRight,
|
|
5690
|
+
prependCharacter,
|
|
5691
|
+
hoursAre00,
|
|
5692
|
+
firstHourGreaterThan1,
|
|
5693
|
+
firstHourGreaterThan2,
|
|
5694
|
+
hoursGreaterThan12,
|
|
5695
|
+
hoursGreaterThan23,
|
|
5696
|
+
firstMinuteGreaterThan5,
|
|
5697
|
+
hasTypedMinutes
|
|
5698
|
+
};
|
|
5699
|
+
}
|
|
5700
|
+
const correct12HourTime = (time, mustCompleteTime) => {
|
|
5701
|
+
const timeStringCorrector = getTimeStringCorrector(time, false);
|
|
5702
|
+
if (mustCompleteTime) {
|
|
5703
|
+
timeStringCorrector.replaceDashes();
|
|
5704
|
+
}
|
|
5705
|
+
if (timeStringCorrector.firstHourGreaterThan1()) {
|
|
5706
|
+
timeStringCorrector.prependCharacter('0');
|
|
5707
|
+
}
|
|
5708
|
+
if (timeStringCorrector.hoursGreaterThan12()) {
|
|
5709
|
+
if (timeStringCorrector.hasTypedMinutes()) {
|
|
5710
|
+
// User likely just edited the first digit and that made the
|
|
5711
|
+
// second digit invalid, e.g., changed '08:' to '18:'. They
|
|
5712
|
+
// probably are about to fix up the second digit. We'll set it to 0
|
|
5713
|
+
timeStringCorrector.clearSecondHoursDigit();
|
|
5714
|
+
} else {
|
|
5715
|
+
// Assume the user forgot a leading 0
|
|
5716
|
+
// Example: we are changing '13:--' to '01:3-'
|
|
5717
|
+
timeStringCorrector.prependCharacter('0');
|
|
5556
5718
|
}
|
|
5557
|
-
}
|
|
5719
|
+
}
|
|
5720
|
+
if (timeStringCorrector.hoursAre00()) {
|
|
5721
|
+
timeStringCorrector.setHoursTo12();
|
|
5722
|
+
}
|
|
5723
|
+
if (timeStringCorrector.firstMinuteGreaterThan5()) {
|
|
5724
|
+
// Assume the user forgot a 0
|
|
5725
|
+
// Example: we are changing 12:6- to 12:06
|
|
5726
|
+
timeStringCorrector.shiftMinutesRight();
|
|
5727
|
+
}
|
|
5728
|
+
return {
|
|
5729
|
+
correctedTime: timeStringCorrector.getTimeString(),
|
|
5730
|
+
selectionModifier: timeStringCorrector.getSelectionModifier()
|
|
5731
|
+
};
|
|
5732
|
+
};
|
|
5733
|
+
const correct24HourTime = (time, mustCompleteTime) => {
|
|
5734
|
+
const timeStringCorrector = getTimeStringCorrector(time, true);
|
|
5735
|
+
if (mustCompleteTime) {
|
|
5736
|
+
timeStringCorrector.replaceDashes();
|
|
5737
|
+
}
|
|
5738
|
+
if (timeStringCorrector.hoursGreaterThan23()) {
|
|
5739
|
+
// User likely just edited the first digit and that made the second
|
|
5740
|
+
// digit invalid, e.g., changed '15:' to '25:'. They probably
|
|
5741
|
+
// are about to fix up the second digit. We'll set it to 0
|
|
5742
|
+
if (timeStringCorrector.hasTypedMinutes()) {
|
|
5743
|
+
timeStringCorrector.clearSecondHoursDigit();
|
|
5744
|
+
} else {
|
|
5745
|
+
// Assume the user forgot a leading 0
|
|
5746
|
+
// Example: we are changing '25:--' to '02:5-'
|
|
5747
|
+
timeStringCorrector.prependCharacter('0');
|
|
5748
|
+
}
|
|
5749
|
+
}
|
|
5750
|
+
if (timeStringCorrector.firstHourGreaterThan2()) {
|
|
5751
|
+
// Assume the user forgot a leading 0
|
|
5752
|
+
// Example: we are changing '3-:--' to '03:--'
|
|
5753
|
+
timeStringCorrector.prependCharacter('0');
|
|
5754
|
+
}
|
|
5755
|
+
if (timeStringCorrector.firstMinuteGreaterThan5()) {
|
|
5756
|
+
// Assume the user forgot a 0
|
|
5757
|
+
// Example: we are changing 12:6- to 12:06
|
|
5758
|
+
timeStringCorrector.shiftMinutesRight();
|
|
5759
|
+
}
|
|
5760
|
+
return {
|
|
5761
|
+
correctedTime: timeStringCorrector.getTimeString(),
|
|
5762
|
+
selectionModifier: timeStringCorrector.getSelectionModifier()
|
|
5763
|
+
};
|
|
5558
5764
|
};
|
|
5559
5765
|
|
|
5560
|
-
|
|
5766
|
+
// We will follow the same process to correct the time regardless
|
|
5767
|
+
// of what specific character changed.
|
|
5768
|
+
// This simplifies logic for when multiple chars are pasted in
|
|
5769
|
+
// and for when the input has to be shifted due to invalid entries.
|
|
5770
|
+
const correctTime = (time, is24HourClock, mustCompleteTime) => is24HourClock ? correct24HourTime(time, mustCompleteTime) : correct12HourTime(time, mustCompleteTime);
|
|
5771
|
+
|
|
5772
|
+
const TimeInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
5561
5773
|
let {
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5774
|
+
onChange,
|
|
5775
|
+
ariaExpanded,
|
|
5776
|
+
userInput,
|
|
5777
|
+
handleKeyDown,
|
|
5778
|
+
setIsFlyoutOpen,
|
|
5779
|
+
setShouldMoveSelectionToEnd,
|
|
5780
|
+
shouldMoveSelectionToEnd,
|
|
5569
5781
|
isInvalid,
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
const
|
|
5583
|
-
|
|
5584
|
-
|
|
5782
|
+
isDisabled,
|
|
5783
|
+
is24HourClock,
|
|
5784
|
+
id,
|
|
5785
|
+
dataTestId,
|
|
5786
|
+
ariaControls,
|
|
5787
|
+
ariaActiveDescendant,
|
|
5788
|
+
ariaLabel,
|
|
5789
|
+
ariaLabelledBy,
|
|
5790
|
+
ariaDescribedBy,
|
|
5791
|
+
isOptionHovered
|
|
5792
|
+
} = _ref;
|
|
5793
|
+
const mask24 = '99:99';
|
|
5794
|
+
const mask12 = '99:99 am';
|
|
5795
|
+
const mask = is24HourClock ? mask24 : mask12;
|
|
5796
|
+
return /*#__PURE__*/React__default["default"].createElement(InputMask__default["default"], {
|
|
5797
|
+
value: userInput,
|
|
5798
|
+
onChange: e => onChange(e.target.value),
|
|
5799
|
+
disabled: isDisabled,
|
|
5800
|
+
alwaysShowMask: true,
|
|
5801
|
+
formatChars: {
|
|
5802
|
+
'9': '[0-9]',
|
|
5803
|
+
a: '[AaPp]',
|
|
5804
|
+
m: '[Mm]'
|
|
5805
|
+
},
|
|
5806
|
+
maskChar: "-",
|
|
5807
|
+
mask: mask,
|
|
5808
|
+
beforeMaskedValueChange: next => {
|
|
5809
|
+
const {
|
|
5810
|
+
correctedTime,
|
|
5811
|
+
selectionModifier
|
|
5812
|
+
} = correctTime(next.value, is24HourClock, false);
|
|
5813
|
+
const newSelection = next === null || next === void 0 ? void 0 : next.selection;
|
|
5814
|
+
if (newSelection) {
|
|
5815
|
+
const validTimeLength = mask.length;
|
|
5816
|
+
newSelection.start = shouldMoveSelectionToEnd ? validTimeLength : newSelection.start;
|
|
5817
|
+
newSelection.end = shouldMoveSelectionToEnd ? validTimeLength : newSelection.end;
|
|
5818
|
+
newSelection.start = Math.min(newSelection.start + selectionModifier, validTimeLength);
|
|
5819
|
+
newSelection.end = Math.min(newSelection.end + selectionModifier, validTimeLength);
|
|
5820
|
+
}
|
|
5821
|
+
setShouldMoveSelectionToEnd(false);
|
|
5822
|
+
return {
|
|
5823
|
+
...next,
|
|
5824
|
+
value: correctedTime,
|
|
5825
|
+
selection: newSelection
|
|
5826
|
+
};
|
|
5827
|
+
}
|
|
5828
|
+
}, () => /*#__PURE__*/React__default["default"].createElement(index.Input$1, {
|
|
5829
|
+
id: id,
|
|
5830
|
+
disabled: isDisabled,
|
|
5831
|
+
role: "combobox",
|
|
5832
|
+
"aria-expanded": ariaExpanded,
|
|
5833
|
+
"aria-controls": ariaControls,
|
|
5834
|
+
ref: ref,
|
|
5835
|
+
className: classNames__default["default"](styles$1.input, {
|
|
5836
|
+
[styles$1.ignoreFocusStyle]: !!ariaActiveDescendant || isOptionHovered
|
|
5837
|
+
}),
|
|
5838
|
+
"aria-invalid": isInvalid,
|
|
5839
|
+
onKeyDown: handleKeyDown,
|
|
5840
|
+
onClick: () => setIsFlyoutOpen(true),
|
|
5841
|
+
"aria-label": ariaLabel,
|
|
5842
|
+
"aria-labelledby": ariaLabelledBy,
|
|
5843
|
+
"aria-describedby": ariaDescribedBy,
|
|
5844
|
+
"aria-activedescendant": ariaActiveDescendant,
|
|
5845
|
+
"data-testid": dataTestId && "".concat(dataTestId, "-input")
|
|
5846
|
+
}));
|
|
5847
|
+
});
|
|
5848
|
+
|
|
5849
|
+
const TimePickerIcon = _ref => {
|
|
5850
|
+
let {
|
|
5851
|
+
isOpen,
|
|
5852
|
+
isDisabled,
|
|
5853
|
+
setIsFlyoutOpen,
|
|
5854
|
+
iconRef,
|
|
5855
|
+
inputRef
|
|
5856
|
+
} = _ref;
|
|
5857
|
+
return /*#__PURE__*/React__default["default"].createElement(index.IconButton, {
|
|
5858
|
+
"aria-hidden": "true",
|
|
5859
|
+
tabIndex: -1,
|
|
5860
|
+
disabled: isDisabled,
|
|
5861
|
+
className: classNames__default["default"](styles$1.icon, {
|
|
5862
|
+
[styles$1.open]: isOpen
|
|
5863
|
+
})
|
|
5864
|
+
}, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronDownIcon, {
|
|
5865
|
+
onClick: !isDisabled ? () => {
|
|
5866
|
+
var _inputRef$current;
|
|
5867
|
+
setIsFlyoutOpen(i => !i);
|
|
5868
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
5869
|
+
} : undefined,
|
|
5870
|
+
onMouseDown: e => e.preventDefault(),
|
|
5871
|
+
ref: iconRef
|
|
5872
|
+
}));
|
|
5873
|
+
};
|
|
5874
|
+
|
|
5875
|
+
const DEFAULT_TIME = (() => {
|
|
5876
|
+
const now = new Date();
|
|
5877
|
+
const hour = now.getHours();
|
|
5878
|
+
const minute = now.getMinutes();
|
|
5879
|
+
return {
|
|
5880
|
+
hour,
|
|
5881
|
+
minute
|
|
5882
|
+
};
|
|
5883
|
+
})();
|
|
5884
|
+
const TimePicker = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
5885
|
+
let {
|
|
5886
|
+
value: externalValue,
|
|
5887
|
+
onChange: externalOnChange,
|
|
5888
|
+
is24HourClock = false,
|
|
5889
|
+
isDisabled = false,
|
|
5890
|
+
isInvalid = false,
|
|
5891
|
+
id: externalId,
|
|
5892
|
+
'data-testid': dataTestId,
|
|
5893
|
+
'aria-label': ariaLabel,
|
|
5894
|
+
'aria-labelledby': ariaLabelledBy,
|
|
5895
|
+
'aria-describedby': ariaDescribedBy
|
|
5896
|
+
} = _ref;
|
|
5897
|
+
const timePickerId = index.useId(externalId);
|
|
5898
|
+
const inputId = "".concat(timePickerId, "-input");
|
|
5899
|
+
const dropdownId = "".concat(timePickerId, "-dropdown");
|
|
5900
|
+
const [isOptionHovered, setIsOptionHovered] = React.useState(false);
|
|
5901
|
+
const [timeObject, setTimeObject] = index.useControllableState(DEFAULT_TIME, externalOnChange, externalValue);
|
|
5902
|
+
const defaultTimeString = convertTimeObjectToTimeString(timeObject, is24HourClock);
|
|
5903
|
+
|
|
5904
|
+
// timeString needs its own state instead of always being derived from timeObject, since typing doesn't "commit" a new time.
|
|
5905
|
+
const [timeString, setTimeString] = React.useState(defaultTimeString);
|
|
5906
|
+
const [isTimeStringDirty, setIsTimeStringDirty] = React.useState(false);
|
|
5907
|
+
const step = 60 * 30;
|
|
5908
|
+
const dropdownItems = React.useMemo(() => generateTimes(step, is24HourClock), [is24HourClock, step]);
|
|
5909
|
+
const getScrolledToItemFromTimeString = React.useCallback(typedTime => {
|
|
5910
|
+
const {
|
|
5911
|
+
correctedTime
|
|
5912
|
+
} = correctTime(typedTime, is24HourClock, true);
|
|
5913
|
+
const correctedTimeObject = convertTimeStringToTimeObject(correctedTime);
|
|
5914
|
+
const correctedTimeValue = correctedTimeObject.hour * 60 * 60 + correctedTimeObject.minute * 60;
|
|
5915
|
+
let minDistance = correctedTimeValue - dropdownItems[0].value;
|
|
5916
|
+
// Substring search up to first empty spot
|
|
5917
|
+
for (let i = 1; i < dropdownItems.length; i += 1) {
|
|
5918
|
+
const distance = correctedTimeValue - dropdownItems[i].value;
|
|
5919
|
+
if (distance > minDistance || distance < 0) {
|
|
5920
|
+
return {
|
|
5921
|
+
index: i - 1,
|
|
5922
|
+
isFocused: false,
|
|
5923
|
+
isExactMatch: minDistance === 0
|
|
5924
|
+
};
|
|
5925
|
+
}
|
|
5926
|
+
minDistance = distance;
|
|
5927
|
+
}
|
|
5928
|
+
return {
|
|
5929
|
+
index: dropdownItems.length - 1,
|
|
5930
|
+
isFocused: false,
|
|
5931
|
+
isExactMatch: minDistance === 0
|
|
5932
|
+
};
|
|
5933
|
+
}, [is24HourClock, dropdownItems]);
|
|
5934
|
+
const [scrolledToItem, setScrolledToItem] = React.useState(() => getScrolledToItemFromTimeString(timeString));
|
|
5935
|
+
const [shouldMoveSelectionToEnd, setShouldMoveSelectionToEnd] = React.useState(true);
|
|
5936
|
+
|
|
5937
|
+
// timeObject may be controlled and may change at any time, so we need to update timeString and the focused item whenever it changes.
|
|
5938
|
+
React.useEffect(() => {
|
|
5939
|
+
const newTimeString = convertTimeObjectToTimeString(timeObject, is24HourClock);
|
|
5940
|
+
setTimeString(newTimeString);
|
|
5941
|
+
setIsTimeStringDirty(false);
|
|
5942
|
+
setShouldMoveSelectionToEnd(true);
|
|
5943
|
+
setScrolledToItem(getScrolledToItemFromTimeString(newTimeString));
|
|
5944
|
+
}, [timeObject, is24HourClock, getScrolledToItemFromTimeString]);
|
|
5945
|
+
const [isFlyoutOpen, setIsFlyoutOpen] = React.useState(false);
|
|
5946
|
+
|
|
5947
|
+
// Sets the actual time object and updates the flyout and focus state
|
|
5948
|
+
const commitTimeString = function () {
|
|
5949
|
+
let newTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : timeString;
|
|
5950
|
+
const {
|
|
5951
|
+
correctedTime
|
|
5952
|
+
} = correctTime(newTime, is24HourClock, true);
|
|
5953
|
+
const newTimeObject = convertTimeStringToTimeObject(correctedTime);
|
|
5954
|
+
setTimeObject(newTimeObject);
|
|
5955
|
+
setIsFlyoutOpen(false);
|
|
5956
|
+
};
|
|
5957
|
+
const inputRef = React.useRef(null);
|
|
5958
|
+
const dropdownRef = React.useRef(null);
|
|
5959
|
+
const iconRef = React.useRef(null);
|
|
5960
|
+
index.useClickOutside([inputRef, dropdownRef, iconRef], () => isTimeStringDirty ? commitTimeString() : setIsFlyoutOpen(false));
|
|
5961
|
+
const focusNext = () => {
|
|
5962
|
+
setScrolledToItem(f => {
|
|
5963
|
+
if (!f.isFocused) {
|
|
5964
|
+
// Focus just moved from input to listbox.
|
|
5965
|
+
// Move to item that was highlighted based on user input
|
|
5966
|
+
return {
|
|
5967
|
+
index: f.index,
|
|
5968
|
+
isFocused: true,
|
|
5969
|
+
isExactMatch: false
|
|
5970
|
+
};
|
|
5971
|
+
}
|
|
5972
|
+
if (f.index === dropdownItems.length - 1) {
|
|
5973
|
+
return f;
|
|
5974
|
+
}
|
|
5975
|
+
return {
|
|
5976
|
+
index: f.index + 1,
|
|
5977
|
+
isFocused: true,
|
|
5978
|
+
isExactMatch: false
|
|
5979
|
+
};
|
|
5980
|
+
});
|
|
5981
|
+
};
|
|
5982
|
+
const focusPrevious = () => {
|
|
5983
|
+
setScrolledToItem(f => {
|
|
5984
|
+
if (!f.isFocused) {
|
|
5985
|
+
// Focus just moved from input to listbox
|
|
5986
|
+
// Move to last item on arrowUp.
|
|
5987
|
+
return {
|
|
5988
|
+
index: dropdownItems.length - 1,
|
|
5989
|
+
isFocused: true,
|
|
5990
|
+
isExactMatch: false
|
|
5991
|
+
};
|
|
5992
|
+
}
|
|
5993
|
+
if (f.index === 0) {
|
|
5994
|
+
return f;
|
|
5995
|
+
}
|
|
5996
|
+
return {
|
|
5997
|
+
index: f.index - 1,
|
|
5998
|
+
isFocused: true,
|
|
5999
|
+
isExactMatch: false
|
|
6000
|
+
};
|
|
6001
|
+
});
|
|
6002
|
+
};
|
|
6003
|
+
const handleType = typedTime => {
|
|
6004
|
+
setIsFlyoutOpen(true);
|
|
6005
|
+
setTimeString(typedTime);
|
|
6006
|
+
setIsTimeStringDirty(true);
|
|
6007
|
+
setScrolledToItem(getScrolledToItemFromTimeString(typedTime));
|
|
6008
|
+
};
|
|
6009
|
+
const handleSelectTime = selectedIndex => {
|
|
6010
|
+
const timeLabel = dropdownItems[selectedIndex].label;
|
|
6011
|
+
setIsOptionHovered(false);
|
|
6012
|
+
commitTimeString(timeLabel);
|
|
6013
|
+
};
|
|
6014
|
+
const handleKeyDown = e => {
|
|
6015
|
+
switch (e.key) {
|
|
6016
|
+
case 'ArrowUp':
|
|
6017
|
+
e.preventDefault();
|
|
6018
|
+
setIsFlyoutOpen(true);
|
|
6019
|
+
focusPrevious();
|
|
6020
|
+
break;
|
|
6021
|
+
case 'ArrowDown':
|
|
6022
|
+
e.preventDefault();
|
|
6023
|
+
setIsFlyoutOpen(true);
|
|
6024
|
+
focusNext();
|
|
6025
|
+
break;
|
|
6026
|
+
case 'Enter':
|
|
6027
|
+
e.preventDefault();
|
|
6028
|
+
if (scrolledToItem !== null && scrolledToItem !== void 0 && scrolledToItem.isFocused) {
|
|
6029
|
+
// "Focus" is on the listbox
|
|
6030
|
+
handleSelectTime(scrolledToItem.index);
|
|
6031
|
+
} else {
|
|
6032
|
+
// "Focus" is on the input
|
|
6033
|
+
commitTimeString();
|
|
6034
|
+
}
|
|
6035
|
+
break;
|
|
6036
|
+
case 'Escape':
|
|
6037
|
+
// Prevent Safari from exiting full-screen mode
|
|
6038
|
+
if (isFlyoutOpen) e.preventDefault();
|
|
6039
|
+
// Use whatever time is closest to what's in the input
|
|
6040
|
+
commitTimeString();
|
|
6041
|
+
break;
|
|
6042
|
+
case 'Tab':
|
|
6043
|
+
// Use whatever time is closest to what's in the input
|
|
6044
|
+
commitTimeString();
|
|
6045
|
+
break;
|
|
6046
|
+
default:
|
|
6047
|
+
break;
|
|
6048
|
+
}
|
|
5585
6049
|
};
|
|
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
6050
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
6051
|
+
id: timePickerId,
|
|
6052
|
+
className: styles$1.timePickerContainer
|
|
6053
|
+
}, /*#__PURE__*/React__default["default"].createElement(TimeInput, {
|
|
6054
|
+
id: inputId,
|
|
6055
|
+
dataTestId: dataTestId,
|
|
6056
|
+
ariaActiveDescendant: isFlyoutOpen && scrolledToItem !== null && scrolledToItem !== void 0 && scrolledToItem.isFocused ? dropdownItems[scrolledToItem.index].id : undefined,
|
|
6057
|
+
ariaControls: dropdownId,
|
|
6058
|
+
ariaExpanded: isFlyoutOpen,
|
|
6059
|
+
onChange: handleType,
|
|
6060
|
+
userInput: timeString,
|
|
6061
|
+
handleKeyDown: handleKeyDown,
|
|
6062
|
+
setIsFlyoutOpen: setIsFlyoutOpen,
|
|
6063
|
+
isDisabled: isDisabled,
|
|
6064
|
+
is24HourClock: is24HourClock,
|
|
6065
|
+
isInvalid: isInvalid,
|
|
6066
|
+
ariaLabel: ariaLabel,
|
|
6067
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
6068
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
6069
|
+
isOptionHovered: isOptionHovered,
|
|
6070
|
+
setShouldMoveSelectionToEnd: setShouldMoveSelectionToEnd,
|
|
6071
|
+
shouldMoveSelectionToEnd: shouldMoveSelectionToEnd,
|
|
6072
|
+
ref: index.mergeRefs(ref, inputRef)
|
|
6073
|
+
}), /*#__PURE__*/React__default["default"].createElement(TimePickerIcon, {
|
|
6074
|
+
isOpen: isFlyoutOpen,
|
|
6075
|
+
isDisabled: isDisabled,
|
|
6076
|
+
setIsFlyoutOpen: setIsFlyoutOpen,
|
|
6077
|
+
iconRef: iconRef,
|
|
6078
|
+
inputRef: inputRef
|
|
6079
|
+
}), isFlyoutOpen && /*#__PURE__*/React__default["default"].createElement(TimeDropdown, {
|
|
6080
|
+
id: dropdownId,
|
|
6081
|
+
inputRef: inputRef,
|
|
6082
|
+
dropdownRef: dropdownRef,
|
|
6083
|
+
onClick: handleSelectTime,
|
|
6084
|
+
scrolledToItem: scrolledToItem,
|
|
6085
|
+
items: dropdownItems,
|
|
6086
|
+
dataTestId: dataTestId,
|
|
6087
|
+
ariaLabel: ariaLabel,
|
|
6088
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
6089
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
6090
|
+
setIsOptionHovered: setIsOptionHovered,
|
|
6091
|
+
isOptionHovered: isOptionHovered
|
|
6092
|
+
}));
|
|
5618
6093
|
});
|
|
5619
6094
|
|
|
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
|
-
});
|
|
6095
|
+
const {
|
|
6096
|
+
useContext: useToggleButtonGroupContext,
|
|
6097
|
+
Provider: ToggleButtonGroupContextProvider
|
|
6098
|
+
} = index.createContextUtilities(null);
|
|
5652
6099
|
|
|
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
|
-
});
|
|
6100
|
+
var css_248z = "._tS7BW{border-color:transparent;background-color:transparent;color:#515559;cursor:pointer}._-AIIi{background-color:rgba(50,54,58,.08)}._3t5JJ{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._gk23V{color:rgba(81,85,89,.4);cursor:not-allowed}._4WXRB{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._v3Xf6{color:#085caf;border-color:#085caf}._mKVc4,._v3Xf6{background:rgba(11,110,208,.11)}._mKVc4{color:#0854a1;border-color:#0854a1}._UuAEZ{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._-8e90{position:relative;display:inline-grid}._-8e90 svg{fill:currentColor}._-8e90 ._tgyer{-webkit-appearance:none;-moz-appearance:none;appearance:none;grid-column:1;grid-row:1}._-8e90 ._tgyer+._RZEOs{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}._-8e90 ._tgyer+._RZEOs._rTqsY{padding:5px;max-width:36px;min-width:36px}._-8e90 ._tgyer+._RZEOs._RNCXo{padding:0 16px}._-8e90 ._tgyer+._RZEOs._cdvrB{padding:0 16px 0 12px}._-8e90 ._tgyer:hover+._RZEOs{background-color:rgba(50,54,58,.08)}._-8e90 ._tgyer:disabled+._RZEOs{color:rgba(81,85,89,.4);cursor:not-allowed}._-8e90 ._tgyer:active+._RZEOs,._-8e90 ._tgyer:focus:active+._RZEOs{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._-8e90 ._tgyer:checked+._RZEOs{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._-8e90 ._tgyer:checked:hover+._RZEOs{background:rgba(11,110,208,.11);color:#085caf;border-color:#085caf}._-8e90 ._tgyer:checked:disabled+._RZEOs{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._-8e90 ._tgyer:checked:active+._RZEOs,._-8e90 ._tgyer:checked:focus:active+._RZEOs{background:rgba(11,110,208,.11);color:#0854a1;border-color:#0854a1}._mqz8k{display:inline-flex;position:relative}._mqz8k:before{content:\"\";border:1px solid #d9d9d9;border-radius:4px;position:absolute;top:0;bottom:0;right:0;left:0}._mqz8k>*{flex-shrink:0;flex-grow:0}._ooP7p{border:none;margin:0;padding:0}._ooP7p legend{padding:0;display:block;font-size:14px;margin-bottom:6px;color:#515559}._-8e90 ._tgyer.focus-visible+._RZEOs,._-8e90 ._tgyer:focus-visible+._RZEOs{z-index:20;outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
6101
|
+
var styles = {"default":"_tS7BW","hovered":"_-AIIi","pressed":"_3t5JJ","disabled":"_gk23V","selectedDefault":"_4WXRB","selectedHovered":"_v3Xf6","selectedPressed":"_mKVc4","selectedDisabled":"_UuAEZ","toggleContainer":"_-8e90","toggleInput":"_tgyer","toggleButton":"_RZEOs","iconOnly":"_rTqsY","text":"_RNCXo","iconText":"_cdvrB","toggleButtonGroup":"_mqz8k","toggleButtonGroupFieldset":"_ooP7p"};
|
|
6102
|
+
var stylesheet="._tS7BW{border-color:transparent;background-color:transparent;color:#515559;cursor:pointer}._-AIIi{background-color:rgba(50,54,58,.08)}._3t5JJ{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._gk23V{color:rgba(81,85,89,.4);cursor:not-allowed}._4WXRB{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._v3Xf6{color:#085caf;border-color:#085caf}._mKVc4,._v3Xf6{background:rgba(11,110,208,.11)}._mKVc4{color:#0854a1;border-color:#0854a1}._UuAEZ{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._-8e90{position:relative;display:inline-grid}._-8e90 svg{fill:currentColor}._-8e90 ._tgyer{-webkit-appearance:none;-moz-appearance:none;appearance:none;grid-column:1;grid-row:1}._-8e90 ._tgyer+._RZEOs{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}._-8e90 ._tgyer+._RZEOs._rTqsY{padding:5px;max-width:36px;min-width:36px}._-8e90 ._tgyer+._RZEOs._RNCXo{padding:0 16px}._-8e90 ._tgyer+._RZEOs._cdvrB{padding:0 16px 0 12px}._-8e90 ._tgyer:hover+._RZEOs{background-color:rgba(50,54,58,.08)}._-8e90 ._tgyer:disabled+._RZEOs{color:rgba(81,85,89,.4);cursor:not-allowed}._-8e90 ._tgyer:active+._RZEOs,._-8e90 ._tgyer:focus:active+._RZEOs{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._-8e90 ._tgyer:checked+._RZEOs{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._-8e90 ._tgyer:checked:hover+._RZEOs{background:rgba(11,110,208,.11);color:#085caf;border-color:#085caf}._-8e90 ._tgyer:checked:disabled+._RZEOs{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._-8e90 ._tgyer:checked:active+._RZEOs,._-8e90 ._tgyer:checked:focus:active+._RZEOs{background:rgba(11,110,208,.11);color:#0854a1;border-color:#0854a1}._mqz8k{display:inline-flex;position:relative}._mqz8k:before{content:\"\";border:1px solid #d9d9d9;border-radius:4px;position:absolute;top:0;bottom:0;right:0;left:0}._mqz8k>*{flex-shrink:0;flex-grow:0}._ooP7p{border:none;margin:0;padding:0}._ooP7p legend{padding:0;display:block;font-size:14px;margin-bottom:6px;color:#515559}._-8e90 ._tgyer.focus-visible+._RZEOs,._-8e90 ._tgyer:focus-visible+._RZEOs{z-index:20;outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
6103
|
+
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){icons_index.styleInject(css_248z);}
|
|
5670
6104
|
|
|
5671
|
-
const
|
|
6105
|
+
const ToggleButtonGroup = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
5672
6106
|
let {
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
'data-testid': dataTestId,
|
|
5682
|
-
children
|
|
6107
|
+
children,
|
|
6108
|
+
value,
|
|
6109
|
+
onChange,
|
|
6110
|
+
name,
|
|
6111
|
+
label,
|
|
6112
|
+
isDisabled,
|
|
6113
|
+
'aria-label': ariaLabel,
|
|
6114
|
+
'aria-labelledby': ariaLabelledby
|
|
5683
6115
|
} = _ref;
|
|
5684
|
-
const
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
6116
|
+
const backupName = index.useId();
|
|
6117
|
+
return /*#__PURE__*/React__default["default"].createElement(ToggleButtonGroupContextProvider, {
|
|
6118
|
+
value: {
|
|
6119
|
+
value,
|
|
6120
|
+
onChange,
|
|
6121
|
+
name: name || backupName,
|
|
6122
|
+
isDisabled
|
|
6123
|
+
}
|
|
6124
|
+
}, /*#__PURE__*/React__default["default"].createElement("fieldset", {
|
|
6125
|
+
className: styles.toggleButtonGroupFieldset,
|
|
6126
|
+
disabled: isDisabled
|
|
6127
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
|
|
6128
|
+
,
|
|
6129
|
+
role: "radiogroup",
|
|
6130
|
+
"aria-label": ariaLabel,
|
|
6131
|
+
"aria-labelledby": ariaLabelledby,
|
|
5696
6132
|
ref: ref
|
|
5697
|
-
},
|
|
6133
|
+
}, label && /*#__PURE__*/React__default["default"].createElement("legend", null, label), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
6134
|
+
className: styles.toggleButtonGroup
|
|
6135
|
+
}, children)));
|
|
5698
6136
|
});
|
|
5699
6137
|
|
|
5700
|
-
const
|
|
6138
|
+
const ToggleButton = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
5701
6139
|
let {
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
6140
|
+
children,
|
|
6141
|
+
isActivated = false,
|
|
6142
|
+
onChange,
|
|
6143
|
+
value,
|
|
6144
|
+
isDisabled = false,
|
|
6145
|
+
kind = 'icon-text',
|
|
6146
|
+
'aria-label': ariaLabel,
|
|
6147
|
+
'aria-labelledby': ariaLabelledby,
|
|
6148
|
+
name: inputName,
|
|
6149
|
+
dataTestId
|
|
5705
6150
|
} = _ref;
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
6151
|
+
const id = index.useId();
|
|
6152
|
+
const groupContext = useToggleButtonGroupContext();
|
|
6153
|
+
const inGroup = groupContext !== null;
|
|
6154
|
+
let checked = isActivated;
|
|
6155
|
+
let disabled = isDisabled;
|
|
6156
|
+
let name = inputName;
|
|
6157
|
+
let handleChange = () => {
|
|
6158
|
+
if (onChange) {
|
|
6159
|
+
onChange(checked);
|
|
6160
|
+
}
|
|
6161
|
+
};
|
|
6162
|
+
if (inGroup) {
|
|
6163
|
+
checked = value === groupContext.value;
|
|
6164
|
+
disabled = groupContext.isDisabled || isDisabled;
|
|
6165
|
+
name = groupContext.name;
|
|
6166
|
+
handleChange = () => {
|
|
6167
|
+
if (onChange) {
|
|
6168
|
+
onChange(checked);
|
|
6169
|
+
}
|
|
6170
|
+
groupContext.onChange(value);
|
|
6171
|
+
};
|
|
6172
|
+
}
|
|
6173
|
+
return /*#__PURE__*/React__default["default"].createElement("span", {
|
|
6174
|
+
ref: ref,
|
|
6175
|
+
className: styles.toggleContainer
|
|
6176
|
+
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
6177
|
+
type: inGroup ? 'radio' : 'checkbox',
|
|
6178
|
+
name: name,
|
|
6179
|
+
checked: checked,
|
|
6180
|
+
onChange: handleChange,
|
|
6181
|
+
id: id,
|
|
6182
|
+
disabled: disabled,
|
|
6183
|
+
value: value,
|
|
6184
|
+
className: styles.toggleInput,
|
|
6185
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'input'),
|
|
6186
|
+
role: inGroup ? undefined : 'button',
|
|
6187
|
+
"aria-pressed": inGroup ? undefined : checked,
|
|
6188
|
+
"aria-label": ariaLabel,
|
|
6189
|
+
"aria-labelledby": ariaLabelledby
|
|
6190
|
+
}), /*#__PURE__*/React__default["default"].createElement("label", {
|
|
6191
|
+
htmlFor: id,
|
|
6192
|
+
className: classNames__default["default"]([index.buttonStyles.btn, styles.toggleButton], {
|
|
6193
|
+
[styles.iconOnly]: kind === 'icon',
|
|
6194
|
+
[styles.textOnly]: kind === 'text',
|
|
6195
|
+
[styles.iconText]: kind === 'icon-text'
|
|
6196
|
+
}),
|
|
6197
|
+
"data-testid": index.getSubDataTestId(dataTestId, 'label')
|
|
6198
|
+
}, children));
|
|
5711
6199
|
});
|
|
5712
6200
|
|
|
5713
6201
|
/* eslint-disable camelcase */
|
|
5714
6202
|
|
|
5715
6203
|
exports.Input = index.Input$1;
|
|
6204
|
+
exports.useFormField = index.useFormField;
|
|
5716
6205
|
exports.AdvancedTable = AdvancedTable;
|
|
5717
6206
|
exports.CollapsibleSearchInput = CollapsibleSearchInput;
|
|
5718
6207
|
exports.CollectionGrid = CollectionGrid;
|
|
@@ -5731,7 +6220,9 @@ exports.Menu = Menu;
|
|
|
5731
6220
|
exports.MenuButton = MenuButton;
|
|
5732
6221
|
exports.MenuItem = MenuItem$1;
|
|
5733
6222
|
exports.MenuPane = MenuPane;
|
|
6223
|
+
exports.Pagination = Pagination;
|
|
5734
6224
|
exports.PhoneNumberInput = PhoneNumberInput;
|
|
6225
|
+
exports.RowDisplayCount = RowDisplayCount;
|
|
5735
6226
|
exports.Select = Select;
|
|
5736
6227
|
exports.SelectButton = SelectButton;
|
|
5737
6228
|
exports.SelectItem = SelectItem;
|
|
@@ -5745,3 +6236,4 @@ exports.TimePicker = TimePicker;
|
|
|
5745
6236
|
exports.ToggleButton = ToggleButton;
|
|
5746
6237
|
exports.ToggleButtonGroup = ToggleButtonGroup;
|
|
5747
6238
|
exports.VStack = VStack;
|
|
6239
|
+
exports.useForm = useForm;
|