@qualtrics/ui-react 2.20.0 → 2.22.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 +17 -33
- package/dist/__shared/cjs/{index-90d4069b.js → index-025620bf.js} +718 -673
- package/dist/__shared/cjs/{index-579c4690.js → index-41a013d2.js} +4 -4
- package/dist/components/Accordion/Accordion.js +1 -1
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Accordion/AccordionHeader.js +4 -4
- package/dist/components/Accordion/AccordionPanel.js +3 -3
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Button/Button2.js +2 -2
- package/dist/components/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +11 -11
- package/dist/components/Checkbox/Checkbox2.js +3 -3
- package/dist/components/Checkbox/VisualCheckbox2.js +3 -3
- package/dist/components/ColorPicker/Alpha.js +12 -16
- package/dist/components/ColorPicker/ColorPicker.js +15 -9
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/ColorPicker/ColorPickerFlyout.js +9 -4
- package/dist/components/ColorPicker/ColorPickerFlyoutInputs.js +8 -6
- package/dist/components/ColorPicker/Hue.js +3 -9
- package/dist/components/ColorPicker/Palette.js +13 -9
- package/dist/components/ColorPicker/Saturation.js +9 -17
- package/dist/components/ColorPicker/utils/hexToRgbaString.js +3 -2
- package/dist/components/ColorPicker/utils/rgbToHex.js +1 -1
- package/dist/components/ColorPicker/utils/validateHex.js +10 -9
- package/dist/components/Combobox/Combobox.js +54 -31
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/Combobox/ComboboxHeader.js +1 -1
- package/dist/components/Combobox/ComboboxIcon.js +3 -2
- package/dist/components/Combobox/ComboboxInput.js +4 -4
- package/dist/components/Combobox/ComboboxList.js +2 -2
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +5 -2
- package/dist/components/Dropdown/Dropdown.js +14 -14
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/Dropdown/DropdownButton.js +23 -19
- package/dist/components/Dropdown/DropdownList.js +4 -4
- package/dist/components/Dropdown/DropdownOption.js +5 -7
- package/dist/components/Dropdown/DropdownSearch.js +12 -9
- package/dist/components/FilePicker/FilePicker.js +13 -13
- package/dist/components/FilePicker/FilePicker2.js +3 -3
- package/dist/components/FormField/Caption.js +3 -3
- package/dist/components/FormField/FormField.js +2 -2
- package/dist/components/FormField/FormField2.js +3 -3
- package/dist/components/FormField/FormFieldContext.js +3 -3
- package/dist/components/FullScreenTakeover/FullScreenTakeover.js +5 -3
- package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
- package/dist/components/Icon/Icon.js +2 -2
- package/dist/components/IconButton/IconButton2.js +3 -3
- package/dist/components/InlineInput/InlineInput.js +12 -9
- package/dist/components/InlineInput/InlineInput2.js +3 -3
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/Input2.js +3 -3
- package/dist/components/Input/InputField.js +2 -2
- 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/LoadingSpinner.js +1 -1
- package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
- package/dist/components/LogicEditor/ConditionSet.js +5 -5
- package/dist/components/LogicEditor/LogicEditor.js +1 -1
- package/dist/components/LogicEditor/LogicEditor2.js +3 -3
- package/dist/components/LogicEditor/utils.js +2 -1
- package/dist/components/Modal/Modal.js +14 -13
- package/dist/components/Modal/Modal2.js +3 -3
- package/dist/components/NewMenu/BaseMenu.js +41 -30
- package/dist/components/NewMenu/NewMenu.js +3 -3
- package/dist/components/NewMenu/SelectMenu/SelectMenu.js +2 -2
- package/dist/components/NewMenu/parts/ArrowNav/ArrowNav.js +19 -15
- package/dist/components/NewMenu/parts/MenuItem.js +1 -1
- package/dist/components/NumberStepper/NumberStepper.js +7 -6
- package/dist/components/NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/NumberStepper/NumberStepperDecrement.js +1 -1
- package/dist/components/NumberStepper/NumberStepperIncrement.js +1 -1
- package/dist/components/NumberStepper/NumberStepperInput.js +3 -3
- package/dist/components/PageLayout/PageLayout.js +3 -3
- package/dist/components/Pagination/Pagination.js +1 -1
- package/dist/components/Pagination/Pagination2.js +3 -3
- package/dist/components/Pagination/PaginationNextButton.js +5 -5
- package/dist/components/Pagination/PaginationPageInput.js +11 -9
- package/dist/components/Pagination/PaginationPreviousButton.js +5 -5
- package/dist/components/Popover/Popover.js +9 -7
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch.js +4 -3
- package/dist/components/QuickSearch/QuickSearch2.js +3 -3
- package/dist/components/QuickSearch/QuickSearchInput.js +4 -4
- package/dist/components/Radio/Radio.js +12 -11
- package/dist/components/Radio/Radio2.js +3 -3
- package/dist/components/SearchInput/SearchInput.js +4 -3
- package/dist/components/SearchInput/SearchInput2.js +3 -3
- package/dist/components/SidebarNav/SidebarNav.js +2 -1
- package/dist/components/SidebarNav/SidebarNav2.js +3 -3
- package/dist/components/SidebarNav/SidebarNavLink.js +1 -1
- package/dist/components/Slider/RangeSlider.js +2 -2
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Slider/Slider2.js +3 -3
- package/dist/components/Slider/SliderButton.js +1 -1
- package/dist/components/Switch/Switch.js +11 -11
- package/dist/components/Switch/Switch2.js +3 -3
- package/dist/components/Table/Table2.js +3 -3
- package/dist/components/Tabs/Tab.js +3 -3
- package/dist/components/Tabs/TabList.js +6 -5
- package/dist/components/Tabs/TabPanel.js +3 -3
- package/dist/components/Tabs/Tabs2.js +3 -3
- package/dist/components/Tooltip/Tooltip.js +15 -7
- package/dist/components/Tooltip/Tooltip2.js +3 -3
- package/dist/components/UIProvider/UIProvider.js +2 -2
- package/dist/components/deprecated_ColorPicker/Alpha.js +4 -4
- package/dist/components/deprecated_ColorPicker/Color.js +6 -6
- package/dist/components/deprecated_ColorPicker/ColorPicker.js +2 -2
- package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/deprecated_ColorPicker/HexInput.js +1 -1
- package/dist/components/deprecated_ColorPicker/Hue.js +3 -3
- package/dist/components/deprecated_ColorPicker/Saturation.js +5 -5
- package/dist/components/deprecated_ColorPicker/Swatch.js +2 -2
- package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/deprecated_NumberStepper/NumberStepperDecrement.js +2 -2
- package/dist/components/deprecated_NumberStepper/NumberStepperIncrement.js +2 -2
- package/dist/components/deprecated_NumberStepper/NumberStepperInput.js +8 -8
- package/dist/components/deprecated_Tabs/Tabs.js +11 -7
- package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
- package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
- package/dist/components/deprecated_Toolbar/ToolbarPanel.js +3 -3
- package/dist/components/deprecated_Toolbar/ToolbarPanels.js +4 -29
- package/dist/components/deprecated_Toolbar/ToolbarTab.js +8 -8
- package/dist/components/deprecated_Toolbar/ToolbarTabs.js +6 -3
- package/dist/hooks/useBreakpoints/useBreakpoints.js +1 -1
- package/dist/hooks/useClickOutside/useClickOutside.js +2 -1
- package/dist/hooks/useControllableState/useControllableState.js +2 -1
- package/dist/hooks/useEventListener/useEventListener.js +4 -1
- package/dist/hooks/useId/useId.js +1 -1
- package/dist/hooks/useOverlay/useOverlay.js +11 -6
- package/dist/hooks/useOverlay/useOverlay2.js +3 -3
- package/dist/hooks/useResponsiveValue/useResponsiveValue.js +2 -1
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement.js +4 -2
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
- package/dist/icons/Icon.js +3 -3
- package/dist/icons/createIconComponent.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +17 -8
- package/dist/index.es.js +1 -7
- package/dist/index.js +4 -7
- package/dist/next/AdvancedTable/AdvancedTable.js +86 -87
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTableCell.js +6 -4
- package/dist/next/AdvancedTable/AdvancedTableColumnHeader.js +18 -10
- package/dist/next/AdvancedTable/AdvancedTableColumnHeaderMenu.js +7 -6
- package/dist/next/AdvancedTable/AdvancedTableDragPreview.js +5 -4
- package/dist/next/AdvancedTable/AdvancedTablePagination.js +1 -1
- package/dist/next/AdvancedTable/useAdvancedTableDragAndDrop.js +3 -2
- package/dist/next/AdvancedTable/useComputedWidth.js +1 -1
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput.js +6 -5
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInputIconButton.js +1 -1
- package/dist/next/Combobox/Combobox2.js +3 -3
- package/dist/next/Combobox/ComboboxFlyout.js +2 -2
- package/dist/next/Combobox/ComboboxGroup.js +1 -1
- package/dist/next/Combobox/ComboboxInput.js +2 -2
- package/dist/next/Combobox/ComboboxOption.js +1 -1
- package/dist/next/Combobox/hooks/useComboboxFilteredGroup/useComboboxFilteredGroup.js +1 -1
- package/dist/next/Combobox/hooks/useComboboxFocusSequence/useComboboxFocusSequence.js +12 -8
- package/dist/next/Combobox/hooks/useComboboxValue/useComboboxValue.js +1 -1
- package/dist/next/Combobox/hooks/useListboxFlyoutDimensions/useListboxFlyoutDimensions.js +3 -2
- package/dist/next/Combobox/hooks/useSelectedOptionScroll/useSelectedOptionScroll.js +2 -1
- package/dist/next/Combobox/hooks/useShouldRenderGroupHeader/useShouldRenderGroupHeader.js +2 -1
- package/dist/next/Combobox/utils/nodeRegistration/nodeRegistration.js +1 -1
- package/dist/next/Drawer/Drawer.js +7 -4
- package/dist/next/Drawer/Drawer2.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
- package/dist/next/Input/Input.js +2 -2
- package/dist/next/Input/Input2.js +3 -3
- package/dist/next/Menu/Menu.js +11 -5
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuItem.js +19 -11
- package/dist/next/Menu/MenuPane.js +70 -40
- package/dist/next/Menu/MenuSearch.js +16 -71
- package/dist/next/Menu/SubMenu.js +63 -46
- package/dist/next/Menu/constants.js +5 -1
- package/dist/next/Menu/useMutationObserver.js +17 -0
- package/dist/next/Menu/usePaneSearch.js +109 -7
- package/dist/next/PhoneNumberInput/PhoneNumberInput.js +7 -6
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/SplitButton/SplitButton.js +8 -2
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/TimePicker/TimeDropdown.js +4 -4
- package/dist/next/TimePicker/TimeInput.js +2 -2
- package/dist/next/TimePicker/TimePicker.js +4 -4
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/TimePicker/TimePickerIcon.js +2 -1
- package/dist/next/TimePicker/utils.js +10 -9
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.d.ts +2 -1
- package/dist/next/index.js +601 -432
- package/dist/utils/Flyout/Flyout.js +1 -1
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/dist/utils/Popper/Popper.js +9 -5
- package/dist/utils/TextOverflowTooltip/TextOverflowTooltip.js +2 -1
- package/dist/utils/Translation/useTranslation.js +4 -5
- package/dist/utils/filterChildren/filterChildren.js +2 -1
- package/dist/utils/getSubDataTestId/getSubDataTestId.js +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/mediaQueryManager/mediaQueryManager.js +1 -1
- package/dist/utils/mergeRefs/mergeRefs.js +1 -1
- package/dist/utils/wrapEvent/wrapEvent.js +2 -2
- package/icons/package.json +1 -0
- package/next/package.json +2 -1
- package/package.json +4 -4
- package/dist/utils/keyboardUser/index.js +0 -1
- package/dist/utils/keyboardUser/keyboardUser.js +0 -30
package/dist/next/index.js
CHANGED
|
@@ -9,11 +9,12 @@ var classNames = require('classnames');
|
|
|
9
9
|
var reactDnd = require('react-dnd');
|
|
10
10
|
var reactDndHtml5Backend = require('react-dnd-html5-backend');
|
|
11
11
|
var useResizeObserver = require('@react-hook/resize-observer');
|
|
12
|
-
var index = require('../__shared/cjs/index-
|
|
13
|
-
var icons_index = require('../__shared/cjs/index-
|
|
12
|
+
var index = require('../__shared/cjs/index-025620bf.js');
|
|
13
|
+
var icons_index = require('../__shared/cjs/index-41a013d2.js');
|
|
14
14
|
var libphonenumberJs = require('libphonenumber-js');
|
|
15
15
|
var InputMask = require('react-input-mask');
|
|
16
16
|
var reactDropdownMenu = require('@radix-ui/react-dropdown-menu');
|
|
17
|
+
var interactions = require('@react-aria/interactions');
|
|
17
18
|
var ReactDOM = require('react-dom');
|
|
18
19
|
require('react-popper');
|
|
19
20
|
require('@popperjs/core');
|
|
@@ -31,9 +32,9 @@ var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
|
31
32
|
var useResizeObserver__default = /*#__PURE__*/_interopDefaultLegacy(useResizeObserver);
|
|
32
33
|
var InputMask__default = /*#__PURE__*/_interopDefaultLegacy(InputMask);
|
|
33
34
|
|
|
34
|
-
var css_248z$a = ".
|
|
35
|
-
var styles$a = {"advancedTable":"
|
|
36
|
-
var stylesheet$a=".
|
|
35
|
+
var css_248z$a = "._brNXC{overflow:auto;position:relative;max-width:100%;max-height:100%}._brNXC,._HSu7R{background-color:#fff}._HSu7R{height:70px;z-index:100;display:flex;align-items:flex-end;justify-content:center;position:-webkit-sticky;position:sticky;left:0}._9wlNT{margin-bottom:4px}._AT1Ij{position:-webkit-sticky;position:sticky;top:0;z-index:100}._3wgpr{display:flex}._3wgpr:focus{outline:none}._3wgpr.focus-visible ._EvxeW:after,._3wgpr:focus-visible ._EvxeW: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}._3wgpr.focus-visible ._EvxeW:last-of-type:after,._3wgpr:focus-visible ._EvxeW:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._3wgpr.focus-visible ._EvxeW:first-of-type:after,._3wgpr:focus-visible ._EvxeW:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._3wgpr.focus-visible ._EvxeW._JUVa-:after,._3wgpr:focus-visible ._EvxeW._JUVa-:after{right:-3px;bottom:1px}._uR2-c{padding-right:3px}._SYZHd{display:flex}._SYZHd._qNkCq ._EvxeW,._SYZHd._qNkCq ._JFrgK{cursor:pointer}._SYZHd._To13F ._EvxeW,._SYZHd._To13F ._JFrgK{background-color:rgba(11,110,208,.08);font-weight:500;box-shadow:inset 0 -1px 0 0 #0b6ed0}._SYZHd._To13F ._EvxeW._JUVa-,._SYZHd._To13F ._JFrgK._JUVa-{background-color:#fff;box-shadow:inset 0 -2px 0 0 #0b6ed0}._SYZHd._To13F ._EvxeW._JUVa- ._JFrgK,._SYZHd._To13F ._EvxeW._JUVa- ._mMBOw,._SYZHd._To13F ._EvxeW._JUVa- ._qwY8i,._SYZHd._To13F ._JFrgK._JUVa- ._JFrgK,._SYZHd._To13F ._JFrgK._JUVa- ._mMBOw,._SYZHd._To13F ._JFrgK._JUVa- ._qwY8i{background-color:rgba(11,110,208,.08)}._SYZHd._qNkCq:hover:not(._To13F):not(._9W80x) ._EvxeW,._SYZHd._qNkCq:hover:not(._To13F):not(._9W80x) ._JFrgK{background-color:#f9f9f9}._SYZHd._qNkCq:active:not(._To13F):not(._9W80x) ._EvxeW,._SYZHd._qNkCq:active:not(._To13F):not(._9W80x) ._JFrgK{background-color:#f3f3f3}._SYZHd:focus{outline:none}._SYZHd.focus-visible ._EvxeW:after,._SYZHd:focus-visible ._EvxeW: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}._SYZHd.focus-visible ._EvxeW:last-of-type:after,._SYZHd:focus-visible ._EvxeW:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._SYZHd.focus-visible ._EvxeW:first-of-type:after,._SYZHd:focus-visible ._EvxeW:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._SYZHd.focus-visible ._EvxeW._JUVa-:after,._SYZHd:focus-visible ._EvxeW._JUVa-:after{right:-3px;bottom:0}._SYZHd:last-of-type:focus{outline:none}._SYZHd:last-of-type.focus-visible ._EvxeW:after,._SYZHd:last-of-type:focus-visible ._EvxeW: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}._SYZHd:last-of-type.focus-visible ._EvxeW:last-of-type:after,._SYZHd:last-of-type:focus-visible ._EvxeW:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._SYZHd:last-of-type.focus-visible ._EvxeW:first-of-type:after,._SYZHd:last-of-type:focus-visible ._EvxeW:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._SYZHd:last-of-type.focus-visible ._EvxeW._JUVa-:after,._SYZHd:last-of-type:focus-visible ._EvxeW._JUVa-:after{right:-3px;bottom:1px}._SYZHd:last-of-type ._mMBOw:focus{outline:none}._SYZHd:last-of-type ._mMBOw._Ml-JU.focus-visible:after,._SYZHd:last-of-type ._mMBOw._Ml-JU:focus-visible:after,._SYZHd:last-of-type ._mMBOw.focus-visible:after,._SYZHd:last-of-type ._mMBOw: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}._SYZHd:first-of-type:focus{outline:none}._SYZHd:first-of-type.focus-visible ._EvxeW:after,._SYZHd:first-of-type:focus-visible ._EvxeW: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}._SYZHd:first-of-type.focus-visible ._EvxeW:last-of-type:after,._SYZHd:first-of-type:focus-visible ._EvxeW:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._SYZHd:first-of-type.focus-visible ._EvxeW:first-of-type:after,._SYZHd:first-of-type:focus-visible ._EvxeW:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._SYZHd:first-of-type.focus-visible ._EvxeW._JUVa-:after,._SYZHd:first-of-type:focus-visible ._EvxeW._JUVa-:after{right:-3px;bottom:0}._SYZHd:first-of-type ._mMBOw:focus{outline:none}._SYZHd:first-of-type ._mMBOw._Ml-JU.focus-visible:after,._SYZHd:first-of-type ._mMBOw._Ml-JU:focus-visible:after,._SYZHd:first-of-type ._mMBOw.focus-visible:after,._SYZHd:first-of-type ._mMBOw: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}._dFK8f{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}._dFK8f._qpvZQ{flex-grow:1}._dFK8f._L6ikB{cursor:pointer}._dFK8f._L6ikB:hover:not(._nzGZd){background-color:#f9f9f9;border-bottom-color:#6a6d70}._dFK8f._L6ikB:active:not(._nzGZd){background-color:#f3f3f3}._dFK8f._IWaBN:not(._nzGZd){color:#32363a;fill:#32363a;border-bottom-color:#8a8f94}._dFK8f._nzGZd{cursor:move;background-color:#efefef;border-bottom-color:#ccc;border-top-left-radius:4px;border-top-right-radius:4px}._dFK8f ._7JIow{background-color:#d9d9d9;position:absolute;width:1px;top:0;pointer-events:none}._dFK8f ._7JIow._oky5Z{left:-1px}._dFK8f ._7JIow._6HDZV{right:0}._dFK8f ._BwYWV{background-color:#0a6ed1;position:absolute;width:3px;top:4px;bottom:4px;border-radius:4px;pointer-events:none}._dFK8f ._BwYWV._oky5Z{left:-2px}._dFK8f ._BwYWV._6HDZV{right:-1px}._dFK8f:first-of-type ._oky5Z._7JIow{left:0;width:2px;border-left:1px solid #fff}._dFK8f:first-of-type ._oky5Z._BwYWV{left:0}._dFK8f:last-of-type ._6HDZV._7JIow{right:0;width:2px;border-right:1px solid #fff}._dFK8f:last-of-type ._6HDZV._BwYWV{right:0}._dFK8f ._VzLYl{position:absolute;width:6px;right:-3px;top:0;cursor:ew-resize;z-index:50}._dFK8f ._VzLYl ._xVM2J{position:absolute;width:2px;right:2px;top:0;bottom:0}._dFK8f ._VzLYl ._xVM2J._yux-4{background-color:#0a6ed1}._dFK8f ._VzLYl:hover ._xVM2J:not(._yux-4){background-color:#d9d9d9}._dFK8f ._W6Djm{display:flex;flex-grow:1;align-items:center;min-width:0;padding:14px 0 13px 12px}._dFK8f ._W6Djm._k4K5H{flex-direction:row-reverse;justify-content:flex-start}._dFK8f ._W6Djm._k4K5H ._xMBLi{margin:1px 7px 1px 1px}._dFK8f ._W6Djm ._KnjlU{text-overflow:ellipsis;overflow:hidden;-webkit-hyphens:auto;hyphens:auto;pointer-events:none;overflow-wrap:break-word;display:-webkit-box;-webkit-box-orient:vertical}._dFK8f ._W6Djm ._xMBLi{margin:1px 1px 1px 7px;flex-shrink:0}._dFK8f ._gk9iN{margin-left:6px;margin-right:4px;flex-shrink:0}._dFK8f ._sqHXr{pointer-events:none;position:absolute;top:0;left:0;bottom:0;right:0}._dFK8f:focus{outline:none}._dFK8f._Ml-JU.focus-visible:after,._dFK8f._Ml-JU:focus-visible:after,._dFK8f.focus-visible:after,._dFK8f: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}._pGMry{margin-right:6px}._JUVa-{display:flex;border-right:3px solid #e5e5e5;position:-webkit-sticky;position:sticky;left:0;background-color:#fff;z-index:20}._JUVa-[focus-within]{z-index:30}._JUVa-:focus-within{z-index:30}._mMBOw{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}._mMBOw ._pSAIH{width:100%;padding:12px 12px 11px;overflow:hidden}._mMBOw._nzGZd{background-color:#efefef;border-bottom-color:#dfdfe1}._mMBOw._qpvZQ{flex-grow:1}._mMBOw:focus{outline:none}._mMBOw._Ml-JU.focus-visible:after,._mMBOw._Ml-JU:focus-visible:after,._mMBOw.focus-visible:after,._mMBOw: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}._JFrgK{display:flex!important;min-height:44px!important;align-items:center;justify-content:right;border-bottom:1px solid #eee;flex-shrink:0}._JFrgK._3aAi6{border-bottom-color:#d9d9d9;background-color:#fff}._qwY8i{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}._qwY8i._3aAi6{border-bottom-color:#d9d9d9;padding:14px 12px 13px}._qwY8i:focus input~span,._qwY8i:hover input~span{border-color:#0b6ed0}._qwY8i ._01rf7{position:relative;display:inline-flex}._qwY8i ._01rf7 ._ISuSh{margin:0!important}._qwY8i ._01rf7 ._wXh-j{position:absolute;top:3px;left:3px;height:10px;width:10px;border-radius:2px;background-color:#0b6ed0}._i01WR{justify-content:flex-start}._RpSiy{justify-content:center;text-align:center}._k4K5H{justify-content:flex-end;text-align:right}._ISavx{display:none}._HgH0q{opacity:0;height:0;width:0;overflow:hidden}._HgH0q,._oHbFw{position:absolute}._oHbFw{cursor:move;background-color:rgba(11,110,208,.08);border-radius:4px;z-index:1000;pointer-events:none}._mizXj{width:246px}";
|
|
36
|
+
var styles$a = {"advancedTable":"_brNXC","advancedTablePaginationContainer":"_HSu7R","advancedTablePagination":"_9wlNT","advancedTableColumnHeadersRowGroup":"_AT1Ij","advancedTableColumnHeaders":"_3wgpr","advancedTableRowChild":"_EvxeW","pinnedContainer":"_JUVa-","advancedTableRowGroup":"_uR2-c","advancedTableRow":"_SYZHd","hasRowAction":"_qNkCq","advancedTableExpandRowSpacer":"_JFrgK","isSelected":"_To13F","advancedTableCheckbox":"_qwY8i","advancedTableCell":"_mMBOw","isCheckboxHovered":"_9W80x","showFocusRing":"_Ml-JU","advancedTableColumnHeader":"_dFK8f","fillRemainingSpace":"_qpvZQ","isSortable":"_L6ikB","isDragging":"_nzGZd","isSorted":"_IWaBN","dropTargetLine":"_7JIow","dropTargetLeft":"_oky5Z","dropTargetRight":"_6HDZV","dropTargetMarker":"_BwYWV","resizeHandle":"_VzLYl","resizeLine":"_xVM2J","isResizing":"_yux-4","advancedTableColumnHeaderLabel":"_W6Djm","rightAligned":"_k4K5H","sortIcon":"_xMBLi","advancedTableColumnHeaderLabelText":"_KnjlU","advancedTableColumnHeaderMenu":"_gk9iN","advancedTableColumnHeaderMenuHiddenAnchor":"_sqHXr","advancedTableColumnHeaderMenuItemIcon":"_pGMry","advancedTableCellContainer":"_pSAIH","header":"_3aAi6","checkboxContainer":"_01rf7","checkbox":"_ISuSh","mixed":"_wXh-j","leftAligned":"_i01WR","centerAligned":"_RpSiy","hiddenDescription":"_ISavx","hiddenLiveRegion":"_HgH0q","dragPreview":"_oHbFw","rowActionMenuPane":"_mizXj"};
|
|
37
|
+
var stylesheet$a="._brNXC{overflow:auto;position:relative;max-width:100%;max-height:100%}._brNXC,._HSu7R{background-color:#fff}._HSu7R{height:70px;z-index:100;display:flex;align-items:flex-end;justify-content:center;position:-webkit-sticky;position:sticky;left:0}._9wlNT{margin-bottom:4px}._AT1Ij{position:-webkit-sticky;position:sticky;top:0;z-index:100}._3wgpr{display:flex}._3wgpr:focus{outline:none}._3wgpr.focus-visible ._EvxeW:after,._3wgpr:focus-visible ._EvxeW: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}._3wgpr.focus-visible ._EvxeW:last-of-type:after,._3wgpr:focus-visible ._EvxeW:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._3wgpr.focus-visible ._EvxeW:first-of-type:after,._3wgpr:focus-visible ._EvxeW:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._3wgpr.focus-visible ._EvxeW._JUVa-:after,._3wgpr:focus-visible ._EvxeW._JUVa-:after{right:-3px;bottom:1px}._uR2-c{padding-right:3px}._SYZHd{display:flex}._SYZHd._qNkCq ._EvxeW,._SYZHd._qNkCq ._JFrgK{cursor:pointer}._SYZHd._To13F ._EvxeW,._SYZHd._To13F ._JFrgK{background-color:rgba(11,110,208,.08);font-weight:500;box-shadow:inset 0 -1px 0 0 #0b6ed0}._SYZHd._To13F ._EvxeW._JUVa-,._SYZHd._To13F ._JFrgK._JUVa-{background-color:#fff;box-shadow:inset 0 -2px 0 0 #0b6ed0}._SYZHd._To13F ._EvxeW._JUVa- ._JFrgK,._SYZHd._To13F ._EvxeW._JUVa- ._mMBOw,._SYZHd._To13F ._EvxeW._JUVa- ._qwY8i,._SYZHd._To13F ._JFrgK._JUVa- ._JFrgK,._SYZHd._To13F ._JFrgK._JUVa- ._mMBOw,._SYZHd._To13F ._JFrgK._JUVa- ._qwY8i{background-color:rgba(11,110,208,.08)}._SYZHd._qNkCq:hover:not(._To13F):not(._9W80x) ._EvxeW,._SYZHd._qNkCq:hover:not(._To13F):not(._9W80x) ._JFrgK{background-color:#f9f9f9}._SYZHd._qNkCq:active:not(._To13F):not(._9W80x) ._EvxeW,._SYZHd._qNkCq:active:not(._To13F):not(._9W80x) ._JFrgK{background-color:#f3f3f3}._SYZHd:focus{outline:none}._SYZHd.focus-visible ._EvxeW:after,._SYZHd:focus-visible ._EvxeW: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}._SYZHd.focus-visible ._EvxeW:last-of-type:after,._SYZHd:focus-visible ._EvxeW:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._SYZHd.focus-visible ._EvxeW:first-of-type:after,._SYZHd:focus-visible ._EvxeW:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._SYZHd.focus-visible ._EvxeW._JUVa-:after,._SYZHd:focus-visible ._EvxeW._JUVa-:after{right:-3px;bottom:0}._SYZHd:last-of-type:focus{outline:none}._SYZHd:last-of-type.focus-visible ._EvxeW:after,._SYZHd:last-of-type:focus-visible ._EvxeW: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}._SYZHd:last-of-type.focus-visible ._EvxeW:last-of-type:after,._SYZHd:last-of-type:focus-visible ._EvxeW:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._SYZHd:last-of-type.focus-visible ._EvxeW:first-of-type:after,._SYZHd:last-of-type:focus-visible ._EvxeW:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._SYZHd:last-of-type.focus-visible ._EvxeW._JUVa-:after,._SYZHd:last-of-type:focus-visible ._EvxeW._JUVa-:after{right:-3px;bottom:1px}._SYZHd:last-of-type ._mMBOw:focus{outline:none}._SYZHd:last-of-type ._mMBOw._Ml-JU.focus-visible:after,._SYZHd:last-of-type ._mMBOw._Ml-JU:focus-visible:after,._SYZHd:last-of-type ._mMBOw.focus-visible:after,._SYZHd:last-of-type ._mMBOw: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}._SYZHd:first-of-type:focus{outline:none}._SYZHd:first-of-type.focus-visible ._EvxeW:after,._SYZHd:first-of-type:focus-visible ._EvxeW: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}._SYZHd:first-of-type.focus-visible ._EvxeW:last-of-type:after,._SYZHd:first-of-type:focus-visible ._EvxeW:last-of-type:after{border-top-right-radius:2px;border-bottom-right-radius:2px;border-right:2px solid #0a3f88}._SYZHd:first-of-type.focus-visible ._EvxeW:first-of-type:after,._SYZHd:first-of-type:focus-visible ._EvxeW:first-of-type:after{border-top-left-radius:2px;border-bottom-left-radius:2px;border-left:2px solid #0a3f88}._SYZHd:first-of-type.focus-visible ._EvxeW._JUVa-:after,._SYZHd:first-of-type:focus-visible ._EvxeW._JUVa-:after{right:-3px;bottom:0}._SYZHd:first-of-type ._mMBOw:focus{outline:none}._SYZHd:first-of-type ._mMBOw._Ml-JU.focus-visible:after,._SYZHd:first-of-type ._mMBOw._Ml-JU:focus-visible:after,._SYZHd:first-of-type ._mMBOw.focus-visible:after,._SYZHd:first-of-type ._mMBOw: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}._dFK8f{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}._dFK8f._qpvZQ{flex-grow:1}._dFK8f._L6ikB{cursor:pointer}._dFK8f._L6ikB:hover:not(._nzGZd){background-color:#f9f9f9;border-bottom-color:#6a6d70}._dFK8f._L6ikB:active:not(._nzGZd){background-color:#f3f3f3}._dFK8f._IWaBN:not(._nzGZd){color:#32363a;fill:#32363a;border-bottom-color:#8a8f94}._dFK8f._nzGZd{cursor:move;background-color:#efefef;border-bottom-color:#ccc;border-top-left-radius:4px;border-top-right-radius:4px}._dFK8f ._7JIow{background-color:#d9d9d9;position:absolute;width:1px;top:0;pointer-events:none}._dFK8f ._7JIow._oky5Z{left:-1px}._dFK8f ._7JIow._6HDZV{right:0}._dFK8f ._BwYWV{background-color:#0a6ed1;position:absolute;width:3px;top:4px;bottom:4px;border-radius:4px;pointer-events:none}._dFK8f ._BwYWV._oky5Z{left:-2px}._dFK8f ._BwYWV._6HDZV{right:-1px}._dFK8f:first-of-type ._oky5Z._7JIow{left:0;width:2px;border-left:1px solid #fff}._dFK8f:first-of-type ._oky5Z._BwYWV{left:0}._dFK8f:last-of-type ._6HDZV._7JIow{right:0;width:2px;border-right:1px solid #fff}._dFK8f:last-of-type ._6HDZV._BwYWV{right:0}._dFK8f ._VzLYl{position:absolute;width:6px;right:-3px;top:0;cursor:ew-resize;z-index:50}._dFK8f ._VzLYl ._xVM2J{position:absolute;width:2px;right:2px;top:0;bottom:0}._dFK8f ._VzLYl ._xVM2J._yux-4{background-color:#0a6ed1}._dFK8f ._VzLYl:hover ._xVM2J:not(._yux-4){background-color:#d9d9d9}._dFK8f ._W6Djm{display:flex;flex-grow:1;align-items:center;min-width:0;padding:14px 0 13px 12px}._dFK8f ._W6Djm._k4K5H{flex-direction:row-reverse;justify-content:flex-start}._dFK8f ._W6Djm._k4K5H ._xMBLi{margin:1px 7px 1px 1px}._dFK8f ._W6Djm ._KnjlU{text-overflow:ellipsis;overflow:hidden;-webkit-hyphens:auto;hyphens:auto;pointer-events:none;overflow-wrap:break-word;display:-webkit-box;-webkit-box-orient:vertical}._dFK8f ._W6Djm ._xMBLi{margin:1px 1px 1px 7px;flex-shrink:0}._dFK8f ._gk9iN{margin-left:6px;margin-right:4px;flex-shrink:0}._dFK8f ._sqHXr{pointer-events:none;position:absolute;top:0;left:0;bottom:0;right:0}._dFK8f:focus{outline:none}._dFK8f._Ml-JU.focus-visible:after,._dFK8f._Ml-JU:focus-visible:after,._dFK8f.focus-visible:after,._dFK8f: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}._pGMry{margin-right:6px}._JUVa-{display:flex;border-right:3px solid #e5e5e5;position:-webkit-sticky;position:sticky;left:0;background-color:#fff;z-index:20}._JUVa-[focus-within]{z-index:30}._JUVa-:focus-within{z-index:30}._mMBOw{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}._mMBOw ._pSAIH{width:100%;padding:12px 12px 11px;overflow:hidden}._mMBOw._nzGZd{background-color:#efefef;border-bottom-color:#dfdfe1}._mMBOw._qpvZQ{flex-grow:1}._mMBOw:focus{outline:none}._mMBOw._Ml-JU.focus-visible:after,._mMBOw._Ml-JU:focus-visible:after,._mMBOw.focus-visible:after,._mMBOw: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}._JFrgK{display:flex!important;min-height:44px!important;align-items:center;justify-content:right;border-bottom:1px solid #eee;flex-shrink:0}._JFrgK._3aAi6{border-bottom-color:#d9d9d9;background-color:#fff}._qwY8i{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}._qwY8i._3aAi6{border-bottom-color:#d9d9d9;padding:14px 12px 13px}._qwY8i:focus input~span,._qwY8i:hover input~span{border-color:#0b6ed0}._qwY8i ._01rf7{position:relative;display:inline-flex}._qwY8i ._01rf7 ._ISuSh{margin:0!important}._qwY8i ._01rf7 ._wXh-j{position:absolute;top:3px;left:3px;height:10px;width:10px;border-radius:2px;background-color:#0b6ed0}._i01WR{justify-content:flex-start}._RpSiy{justify-content:center;text-align:center}._k4K5H{justify-content:flex-end;text-align:right}._ISavx{display:none}._HgH0q{opacity:0;height:0;width:0;overflow:hidden}._HgH0q,._oHbFw{position:absolute}._oHbFw{cursor:move;background-color:rgba(11,110,208,.08);border-radius:4px;z-index:1000;pointer-events:none}._mizXj{width:246px}";
|
|
37
38
|
icons_index.styleInject(css_248z$a);
|
|
38
39
|
|
|
39
40
|
// TODO: Move the imported types into this file to avoid a ciruclar dependency warning.
|
|
@@ -85,10 +86,11 @@ const AdvancedTableColumnHeaderMenu = _ref => {
|
|
|
85
86
|
role: "menuitem" // Enables having an action menu item inside of a SelectMenu
|
|
86
87
|
,
|
|
87
88
|
onSelect: e => {
|
|
89
|
+
var _columnHeaderRef$curr;
|
|
88
90
|
e.preventDefault(); // prevents SelectMenu value from changing
|
|
89
91
|
setIsOpen(false);
|
|
90
|
-
columnHeaderRef.current
|
|
91
|
-
onSelect
|
|
92
|
+
(_columnHeaderRef$curr = columnHeaderRef.current) === null || _columnHeaderRef$curr === void 0 ? void 0 : _columnHeaderRef$curr.focus();
|
|
93
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
|
92
94
|
},
|
|
93
95
|
"date-testid": menuItemDataTestId
|
|
94
96
|
}, /*#__PURE__*/React__default["default"].createElement(Icon, {
|
|
@@ -119,7 +121,7 @@ const AdvancedTableColumnHeaderMenu = _ref => {
|
|
|
119
121
|
},
|
|
120
122
|
isOpen: isOpen,
|
|
121
123
|
onIsOpenChange: setIsOpen
|
|
122
|
-
}, rest), sortOptions
|
|
124
|
+
}, rest), sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.map((_ref3, index$1) => {
|
|
123
125
|
let {
|
|
124
126
|
ascendingLabel,
|
|
125
127
|
ascendingIcon,
|
|
@@ -142,7 +144,7 @@ const AdvancedTableColumnHeaderMenu = _ref => {
|
|
|
142
144
|
key: ascendingValue,
|
|
143
145
|
value: ascendingValue,
|
|
144
146
|
label: ascendingLabel,
|
|
145
|
-
"data-testid": index.getSubDataTestId(dataTestId,
|
|
147
|
+
"data-testid": index.getSubDataTestId(dataTestId, "ColumnHeaderMenu-Sort-".concat(index$1, "-").concat(SortDirections.Ascending))
|
|
146
148
|
}, /*#__PURE__*/React__default["default"].createElement(AscendingIconComponent, {
|
|
147
149
|
size: "small",
|
|
148
150
|
className: styles$a.advancedTableColumnHeaderMenuItemIcon,
|
|
@@ -151,13 +153,13 @@ const AdvancedTableColumnHeaderMenu = _ref => {
|
|
|
151
153
|
key: descendingValue,
|
|
152
154
|
value: descendingValue,
|
|
153
155
|
label: descendingLabel,
|
|
154
|
-
"data-testid": index.getSubDataTestId(dataTestId,
|
|
156
|
+
"data-testid": index.getSubDataTestId(dataTestId, "ColumnHeaderMenu-Sort-".concat(index$1, "-").concat(SortDirections.Descending))
|
|
155
157
|
}, /*#__PURE__*/React__default["default"].createElement(DescendingIconComponent, {
|
|
156
158
|
size: "small",
|
|
157
159
|
className: styles$a.advancedTableColumnHeaderMenuItemIcon,
|
|
158
160
|
"aria-hidden": "true"
|
|
159
161
|
}), descendingLabel)];
|
|
160
|
-
}), sortOptions
|
|
162
|
+
}), (sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.length) && (onIsPinnedChange || onMoveLeft || onMoveRight) && /*#__PURE__*/React__default["default"].createElement(index.Divider, null), pinItem, onMoveLeft && getActionMenuItem({
|
|
161
163
|
onSelect: onMoveLeft,
|
|
162
164
|
Icon: icons_index.ArrowLeftIcon,
|
|
163
165
|
label: translate('advancedTable.moveColumnLeft'),
|
|
@@ -219,6 +221,7 @@ const useDragAndDrop = _ref => {
|
|
|
219
221
|
}, dropRef] = reactDnd.useDrop(() => ({
|
|
220
222
|
accept: tableId,
|
|
221
223
|
hover: (item, monitor) => {
|
|
224
|
+
var _monitor$getClientOff, _columnHeaderRef$curr;
|
|
222
225
|
const {
|
|
223
226
|
id: dragSourceId,
|
|
224
227
|
columnIndex: dragSourceColumnIndex,
|
|
@@ -231,11 +234,11 @@ const useDragAndDrop = _ref => {
|
|
|
231
234
|
}
|
|
232
235
|
|
|
233
236
|
// Calculate which column line is closest
|
|
234
|
-
const dropX = monitor.getClientOffset()
|
|
237
|
+
const dropX = (_monitor$getClientOff = monitor.getClientOffset()) === null || _monitor$getClientOff === void 0 ? void 0 : _monitor$getClientOff.x;
|
|
235
238
|
const {
|
|
236
239
|
x,
|
|
237
240
|
width
|
|
238
|
-
} = columnHeaderRef.current
|
|
241
|
+
} = (_columnHeaderRef$curr = columnHeaderRef.current) === null || _columnHeaderRef$curr === void 0 ? void 0 : _columnHeaderRef$curr.getBoundingClientRect();
|
|
239
242
|
const diffLeft = Math.abs(dropX - x) || 0;
|
|
240
243
|
const diffRight = Math.abs(dropX - (x + width)) || 0;
|
|
241
244
|
if (diffLeft < diffRight) {
|
|
@@ -336,7 +339,7 @@ const useDragAndDrop = _ref => {
|
|
|
336
339
|
function useComputedWidth() {
|
|
337
340
|
let widthBuffer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
338
341
|
let defaultWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
339
|
-
return React.useMemo(() => typeof defaultWidth === 'number' ?
|
|
342
|
+
return React.useMemo(() => typeof defaultWidth === 'number' ? "".concat(defaultWidth + widthBuffer, "px") : "calc(".concat(widthBuffer, "px + ").concat(defaultWidth, ")"), [widthBuffer, defaultWidth]);
|
|
340
343
|
}
|
|
341
344
|
|
|
342
345
|
const AdvancedTableColumnHeader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
@@ -378,8 +381,8 @@ const AdvancedTableColumnHeader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
378
381
|
const [ellipsisShown, setEllipsisShown] = React.useState();
|
|
379
382
|
const columnHeaderRef = React.useRef(null);
|
|
380
383
|
const labelContainerRef = React.useRef(null);
|
|
381
|
-
const isSortable = Boolean(sortOptions
|
|
382
|
-
const isSorted = isSortable && selectedSortOption.columnId === id && selectedSortOption.index >= 0 && selectedSortOption.index < sortOptions
|
|
384
|
+
const isSortable = Boolean(sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.length);
|
|
385
|
+
const isSorted = isSortable && selectedSortOption.columnId === id && selectedSortOption.index >= 0 && selectedSortOption.index < (sortOptions === null || sortOptions === void 0 ? void 0 : sortOptions.length) && (selectedSortOption.direction === 'ascending' || selectedSortOption.direction === 'descending');
|
|
383
386
|
const selectedSortIndex = isSorted ? selectedSortOption.index : -1;
|
|
384
387
|
const arrowUpSvgContent = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
385
388
|
fillRule: "evenodd",
|
|
@@ -443,19 +446,22 @@ const AdvancedTableColumnHeader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
443
446
|
setIsHiddenMenuOpen(true);
|
|
444
447
|
setHiddenMenuHighlightedIndex(0);
|
|
445
448
|
} else if (onWidthChange && e.key === 'ArrowRight' && e.shiftKey) {
|
|
449
|
+
var _columnHeaderRef$curr;
|
|
446
450
|
e.preventDefault(); // prevent scroll
|
|
447
|
-
const newWidth = columnHeaderRef.current
|
|
451
|
+
const newWidth = ((_columnHeaderRef$curr = columnHeaderRef.current) === null || _columnHeaderRef$curr === void 0 ? void 0 : _columnHeaderRef$curr.getBoundingClientRect().width) + 10;
|
|
448
452
|
onWidthChange(newWidth);
|
|
449
453
|
} else if (onWidthChange && e.key === 'ArrowLeft' && e.shiftKey) {
|
|
454
|
+
var _columnHeaderRef$curr2;
|
|
450
455
|
e.preventDefault(); // prevent scroll
|
|
451
|
-
const newWidth = Math.max(80, columnHeaderRef.current
|
|
456
|
+
const newWidth = Math.max(80, ((_columnHeaderRef$curr2 = columnHeaderRef.current) === null || _columnHeaderRef$curr2 === void 0 ? void 0 : _columnHeaderRef$curr2.getBoundingClientRect().width) - 10);
|
|
452
457
|
onWidthChange(newWidth);
|
|
453
458
|
} else {
|
|
454
|
-
onKeyDown
|
|
459
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
|
|
455
460
|
}
|
|
456
461
|
};
|
|
457
462
|
const handleClick = e => {
|
|
458
|
-
|
|
463
|
+
var _labelContainerRef$cu;
|
|
464
|
+
if (e.target === e.currentTarget || (_labelContainerRef$cu = labelContainerRef.current) !== null && _labelContainerRef$cu !== void 0 && _labelContainerRef$cu.contains(e.target)) {
|
|
459
465
|
const newIndex = isSorted ? selectedSortIndex : 0;
|
|
460
466
|
const newDirection = isSorted && selectedSortOption.direction === 'ascending' ? 'descending' : 'ascending';
|
|
461
467
|
setSelectedSortOption({
|
|
@@ -520,10 +526,11 @@ const AdvancedTableColumnHeader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
520
526
|
}
|
|
521
527
|
};
|
|
522
528
|
const handleMouseMove = e => {
|
|
529
|
+
var _columnHeaderRef$curr3;
|
|
523
530
|
const mouseX = e.clientX;
|
|
524
|
-
const headerX = columnHeaderRef.current
|
|
531
|
+
const headerX = (_columnHeaderRef$curr3 = columnHeaderRef.current) === null || _columnHeaderRef$curr3 === void 0 ? void 0 : _columnHeaderRef$curr3.getBoundingClientRect().x;
|
|
525
532
|
const newWidth = Math.max(80, mouseX - headerX);
|
|
526
|
-
onWidthChange
|
|
533
|
+
onWidthChange === null || onWidthChange === void 0 ? void 0 : onWidthChange(newWidth);
|
|
527
534
|
};
|
|
528
535
|
const handleMouseUp = e => {
|
|
529
536
|
if (e.button === 0) {
|
|
@@ -543,7 +550,10 @@ const AdvancedTableColumnHeader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
543
550
|
onIsPinnedChange: disableUserPinnableColumns ? undefined : handleIsPinnedChange,
|
|
544
551
|
onMoveLeft: disableUserReorderableColumns || isPinned && columnIndex === 0 || !isPinned && columnIndex === minUnpinnedColumnIndex ? undefined : handleMoveLeft,
|
|
545
552
|
onMoveRight: disableUserReorderableColumns || isPinned && columnIndex === minUnpinnedColumnIndex - 1 || !isPinned && columnIndex === maxUnpinnedColumnIndex ? undefined : handleMoveRight,
|
|
546
|
-
onFocus: () =>
|
|
553
|
+
onFocus: () => {
|
|
554
|
+
var _columnHeaderRef$curr4;
|
|
555
|
+
return (_columnHeaderRef$curr4 = columnHeaderRef.current) === null || _columnHeaderRef$curr4 === void 0 ? void 0 : _columnHeaderRef$curr4.focus();
|
|
556
|
+
},
|
|
547
557
|
columnId: id,
|
|
548
558
|
columnHeaderRef,
|
|
549
559
|
'data-testid': dataTestId
|
|
@@ -611,7 +621,8 @@ const AdvancedTableColumnHeader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
611
621
|
tabIndex: -1,
|
|
612
622
|
"aria-hidden": "true",
|
|
613
623
|
onFocus: () => {
|
|
614
|
-
|
|
624
|
+
var _columnHeaderRef$curr5;
|
|
625
|
+
(_columnHeaderRef$curr5 = columnHeaderRef.current) === null || _columnHeaderRef$curr5 === void 0 ? void 0 : _columnHeaderRef$curr5.focus();
|
|
615
626
|
},
|
|
616
627
|
className: styles$a.advancedTableColumnHeaderMenuHiddenAnchor
|
|
617
628
|
})
|
|
@@ -675,14 +686,15 @@ const AdvancedTableCell = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
675
686
|
} : undefined;
|
|
676
687
|
const handleKeyDown = e => {
|
|
677
688
|
if (e.target === e.currentTarget && e.key === 'Enter' && isInteractive) {
|
|
678
|
-
|
|
689
|
+
var _focusableElementRef$;
|
|
690
|
+
(_focusableElementRef$ = focusableElementRef.current) === null || _focusableElementRef$ === void 0 ? void 0 : _focusableElementRef$.focus();
|
|
679
691
|
e.preventDefault(); // Prevent click event from occurring on the focusable element
|
|
680
692
|
}
|
|
681
693
|
|
|
682
|
-
onKeyDown
|
|
694
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
|
|
683
695
|
};
|
|
684
696
|
const handleFocus = e => {
|
|
685
|
-
onFocus
|
|
697
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
686
698
|
if (isInteractive) {
|
|
687
699
|
if (e.target !== e.currentTarget) {
|
|
688
700
|
setIsEditing(true);
|
|
@@ -697,7 +709,8 @@ const AdvancedTableCell = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
697
709
|
}
|
|
698
710
|
} : undefined;
|
|
699
711
|
const focusCell = () => {
|
|
700
|
-
|
|
712
|
+
var _cellRef$current;
|
|
713
|
+
(_cellRef$current = cellRef.current) === null || _cellRef$current === void 0 ? void 0 : _cellRef$current.focus();
|
|
701
714
|
};
|
|
702
715
|
const computedWidth = useComputedWidth(widthBuffer, width);
|
|
703
716
|
return /*#__PURE__*/React__default["default"].createElement("div", _extends__default["default"]({}, rest, {
|
|
@@ -848,6 +861,7 @@ const AdvancedTableHiddenDescription = _ref => {
|
|
|
848
861
|
};
|
|
849
862
|
|
|
850
863
|
const AdvancedTableDragPreview = _ref => {
|
|
864
|
+
var _columnHeaderRefs$ite, _columnHeaderRefs$ite2, _tableRef$current, _tableRef$current$get;
|
|
851
865
|
let {
|
|
852
866
|
tableRef,
|
|
853
867
|
columnHeaderRefs
|
|
@@ -859,10 +873,10 @@ const AdvancedTableDragPreview = _ref => {
|
|
|
859
873
|
item: monitor.getItem(),
|
|
860
874
|
currentOffset: monitor.getSourceClientOffset()
|
|
861
875
|
}));
|
|
862
|
-
const width = columnHeaderRefs
|
|
863
|
-
const height = tableRef.current
|
|
864
|
-
const top = currentOffset
|
|
865
|
-
const left = currentOffset
|
|
876
|
+
const width = columnHeaderRefs === null || columnHeaderRefs === void 0 ? void 0 : (_columnHeaderRefs$ite = columnHeaderRefs[item === null || item === void 0 ? void 0 : item.columnIndex]) === null || _columnHeaderRefs$ite === void 0 ? void 0 : (_columnHeaderRefs$ite2 = _columnHeaderRefs$ite.getBoundingClientRect()) === null || _columnHeaderRefs$ite2 === void 0 ? void 0 : _columnHeaderRefs$ite2.width;
|
|
877
|
+
const height = (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$get = _tableRef$current.getBoundingClientRect()) === null || _tableRef$current$get === void 0 ? void 0 : _tableRef$current$get.height;
|
|
878
|
+
const top = (currentOffset === null || currentOffset === void 0 ? void 0 : currentOffset.y) || 0;
|
|
879
|
+
const left = (currentOffset === null || currentOffset === void 0 ? void 0 : currentOffset.x) || 0;
|
|
866
880
|
return /*#__PURE__*/React__default["default"].createElement(index.Portal, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
867
881
|
className: styles$a.dragPreview,
|
|
868
882
|
style: {
|
|
@@ -890,7 +904,7 @@ const AdvancedTablePagination = _ref => {
|
|
|
890
904
|
page
|
|
891
905
|
} = _ref2;
|
|
892
906
|
setCurrentPage(page);
|
|
893
|
-
onPageChange
|
|
907
|
+
onPageChange === null || onPageChange === void 0 ? void 0 : onPageChange(page);
|
|
894
908
|
};
|
|
895
909
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
896
910
|
className: styles$a.advancedTablePaginationContainer
|
|
@@ -945,6 +959,7 @@ const AdvancedTableRowExpandButton = _ref => {
|
|
|
945
959
|
};
|
|
946
960
|
|
|
947
961
|
const AdvancedTable = _ref => {
|
|
962
|
+
var _ref5;
|
|
948
963
|
let {
|
|
949
964
|
columnConfigs: externalColumnConfigs,
|
|
950
965
|
rows: rowsPropExternal,
|
|
@@ -986,7 +1001,7 @@ const AdvancedTable = _ref => {
|
|
|
986
1001
|
// This handles an edge case where no rows are passed in
|
|
987
1002
|
// and the internal row transforms cause infinite state updates using a standard default assignment
|
|
988
1003
|
const stableDefaultArray = React.useMemo(() => [], []);
|
|
989
|
-
const rowsProp = rowsPropExternal
|
|
1004
|
+
const rowsProp = rowsPropExternal !== null && rowsPropExternal !== void 0 ? rowsPropExternal : stableDefaultArray;
|
|
990
1005
|
const [rows, setRows] = React.useState();
|
|
991
1006
|
const rowActionsColumnConfigId = index.useId();
|
|
992
1007
|
let rowActionsColumnConfig;
|
|
@@ -995,7 +1010,7 @@ const AdvancedTable = _ref => {
|
|
|
995
1010
|
[externalColumnConfigs, rows] // columnConfigs has an implicit dependency on rows because it is initially computed using rows data
|
|
996
1011
|
);
|
|
997
1012
|
|
|
998
|
-
const [currentPage, setCurrentPage] = React.useState(initialPage
|
|
1013
|
+
const [currentPage, setCurrentPage] = React.useState(initialPage !== null && initialPage !== void 0 ? initialPage : 1);
|
|
999
1014
|
const [tableHeight, setTableHeight] = React.useState();
|
|
1000
1015
|
const getPaginatedRowIndex = React.useCallback(universalRowIndex => rowsPerPage ? universalRowIndex + rowsPerPage * (currentPage - 1) : universalRowIndex, [rowsPerPage, currentPage]);
|
|
1001
1016
|
const paginatedRows = React.useMemo(() => {
|
|
@@ -1037,13 +1052,14 @@ const AdvancedTable = _ref => {
|
|
|
1037
1052
|
}
|
|
1038
1053
|
}, /*#__PURE__*/React__default["default"].createElement(icons_index.EllipsisHorizontalIcon, null))), /*#__PURE__*/React__default["default"].createElement(index.DropdownList, {
|
|
1039
1054
|
className: styles$a.rowActionMenuPane
|
|
1040
|
-
}, !rows ? [] : rowActions
|
|
1055
|
+
}, !rows ? [] : rowActions === null || rowActions === void 0 ? void 0 : rowActions.map((actionGroup, groupIndex) => {
|
|
1056
|
+
var _actionGroup$actions;
|
|
1041
1057
|
const row = rows[rowIndex];
|
|
1042
|
-
const actions = !row ? [] : actionGroup.actions
|
|
1058
|
+
const actions = !row ? [] : (_actionGroup$actions = actionGroup.actions) === null || _actionGroup$actions === void 0 ? void 0 : _actionGroup$actions.map((action, actionIndex) => /*#__PURE__*/React__default["default"].createElement(index.DropdownOption
|
|
1043
1059
|
// React Docs: "We don't recommend using indexes for keys if the order of items may change." These will not change; the alternative is to require an id from the consumer.
|
|
1044
1060
|
// eslint-disable-next-line react/no-array-index-key
|
|
1045
1061
|
, {
|
|
1046
|
-
key:
|
|
1062
|
+
key: "".concat(groupIndex, "-").concat(actionIndex),
|
|
1047
1063
|
disabled: typeof action.isDisabled === 'function' ? action.isDisabled(row && row.rowPropReference) : action.isDisabled,
|
|
1048
1064
|
onSelect: () => action.action(row && row.rowPropReference),
|
|
1049
1065
|
value: "",
|
|
@@ -1083,9 +1099,9 @@ const AdvancedTable = _ref => {
|
|
|
1083
1099
|
const minColumnIndex = hasFocusableRows ? -1 : 0; // When entire rows are focusable, they get an index of -1 so that the columns can be zero-indexed
|
|
1084
1100
|
const maxColumnIndex = columnConfigs.length - 1;
|
|
1085
1101
|
const tableId = index.useId(externalTableId);
|
|
1086
|
-
const arrowKeyDescriptionId =
|
|
1087
|
-
const rowActionDescriptionId =
|
|
1088
|
-
const rowCheckboxDescriptionId =
|
|
1102
|
+
const arrowKeyDescriptionId = "".concat(tableId, "-arrowKeyDescription");
|
|
1103
|
+
const rowActionDescriptionId = "".concat(tableId, "-rowActionDescription");
|
|
1104
|
+
const rowCheckboxDescriptionId = "".concat(tableId, "-rowCheckboxDescription");
|
|
1089
1105
|
useResizeObserver__default["default"](tableRef, entry => {
|
|
1090
1106
|
setTableHeight(entry.contentRect.height);
|
|
1091
1107
|
});
|
|
@@ -1099,11 +1115,11 @@ const AdvancedTable = _ref => {
|
|
|
1099
1115
|
index.useDidUpdate(() => {
|
|
1100
1116
|
setInternalColumnOrder(columnConfigsOrder);
|
|
1101
1117
|
}, [JSON.stringify(columnConfigsOrder)]);
|
|
1102
|
-
const columnOrder = externalColumnOrder
|
|
1118
|
+
const columnOrder = externalColumnOrder !== null && externalColumnOrder !== void 0 ? externalColumnOrder : internalColumnOrder;
|
|
1103
1119
|
const setColumnOrder = index.useEventCallback(value => {
|
|
1104
1120
|
const newColumnOrder = typeof value === 'function' ? value(columnOrder) : value;
|
|
1105
1121
|
setInternalColumnOrder(newColumnOrder);
|
|
1106
|
-
onColumnOrderChange
|
|
1122
|
+
onColumnOrderChange === null || onColumnOrderChange === void 0 ? void 0 : onColumnOrderChange(newColumnOrder);
|
|
1107
1123
|
});
|
|
1108
1124
|
const {
|
|
1109
1125
|
pinnedColumnConfigs,
|
|
@@ -1210,7 +1226,7 @@ const AdvancedTable = _ref => {
|
|
|
1210
1226
|
return ids;
|
|
1211
1227
|
}, [rowsProp]);
|
|
1212
1228
|
const totalRowsCountWithExpansion = React.useMemo(() => getAllRowIds().length, [getAllRowIds]);
|
|
1213
|
-
const hasExpandableRows = React.useMemo(() => rows
|
|
1229
|
+
const hasExpandableRows = React.useMemo(() => rows === null || rows === void 0 ? void 0 : rows.some(_ref3 => {
|
|
1214
1230
|
let {
|
|
1215
1231
|
hasChildRows
|
|
1216
1232
|
} = _ref3;
|
|
@@ -1229,10 +1245,10 @@ const AdvancedTable = _ref => {
|
|
|
1229
1245
|
} else if (expand !== false) {
|
|
1230
1246
|
rowPropReference.isExpanded = true;
|
|
1231
1247
|
}
|
|
1232
|
-
onRowsChange
|
|
1248
|
+
onRowsChange === null || onRowsChange === void 0 ? void 0 : onRowsChange([...rowsProp]);
|
|
1233
1249
|
};
|
|
1234
1250
|
const getLastToggledRowIndex = () => {
|
|
1235
|
-
const index = rows
|
|
1251
|
+
const index = rows === null || rows === void 0 ? void 0 : rows.findIndex(_ref4 => {
|
|
1236
1252
|
let {
|
|
1237
1253
|
id
|
|
1238
1254
|
} = _ref4;
|
|
@@ -1258,10 +1274,11 @@ const AdvancedTable = _ref => {
|
|
|
1258
1274
|
}
|
|
1259
1275
|
};
|
|
1260
1276
|
const multiUpdateCheckedRowIds = (startIndex, endIndex) => {
|
|
1277
|
+
var _rows$endIndex;
|
|
1261
1278
|
if (!rows || startIndex === headerRowIndex || endIndex === headerRowIndex) {
|
|
1262
1279
|
return;
|
|
1263
1280
|
}
|
|
1264
|
-
const endRowId = rows
|
|
1281
|
+
const endRowId = rows === null || rows === void 0 ? void 0 : (_rows$endIndex = rows[endIndex]) === null || _rows$endIndex === void 0 ? void 0 : _rows$endIndex.id;
|
|
1265
1282
|
const isEndIndexChecked = checkedRowIdsSet.has(endRowId);
|
|
1266
1283
|
let newCheckedRowIds = [...checkedRowIds];
|
|
1267
1284
|
const increment = startIndex < endIndex ? 1 : -1;
|
|
@@ -1329,12 +1346,11 @@ const AdvancedTable = _ref => {
|
|
|
1329
1346
|
let newFocusedRowIndex;
|
|
1330
1347
|
const currentRow = rows[rowIndex];
|
|
1331
1348
|
const rowOrFirstColumnIsFocused = focusedColumnIndex <= 0;
|
|
1332
|
-
const rowCanExpand = currentRow
|
|
1333
|
-
const rowCanCollapse = currentRow
|
|
1349
|
+
const rowCanExpand = (currentRow === null || currentRow === void 0 ? void 0 : currentRow.hasChildRows) && !(currentRow !== null && currentRow !== void 0 && currentRow.isExpanded);
|
|
1350
|
+
const rowCanCollapse = (currentRow === null || currentRow === void 0 ? void 0 : currentRow.hasChildRows) && (currentRow === null || currentRow === void 0 ? void 0 : currentRow.isExpanded);
|
|
1334
1351
|
switch (e.key) {
|
|
1335
1352
|
case 'ArrowUp':
|
|
1336
1353
|
e.preventDefault(); // prevent scroll
|
|
1337
|
-
index.setIsKeyboardUser(true);
|
|
1338
1354
|
newFocusedRowIndex = updateRowFocusIndex(rowIndex === minRowIndex ? headerRowIndex : rowIndex - 1);
|
|
1339
1355
|
if (e.shiftKey) {
|
|
1340
1356
|
multiUpdateCheckedRowIds(rowIndex, newFocusedRowIndex);
|
|
@@ -1342,7 +1358,6 @@ const AdvancedTable = _ref => {
|
|
|
1342
1358
|
break;
|
|
1343
1359
|
case 'ArrowDown':
|
|
1344
1360
|
e.preventDefault(); // prevent scroll
|
|
1345
|
-
index.setIsKeyboardUser(true);
|
|
1346
1361
|
newFocusedRowIndex = updateRowFocusIndex(rowIndex === headerRowIndex ? minRowIndex : rowIndex + 1);
|
|
1347
1362
|
if (e.shiftKey) {
|
|
1348
1363
|
multiUpdateCheckedRowIds(rowIndex, newFocusedRowIndex);
|
|
@@ -1350,7 +1365,6 @@ const AdvancedTable = _ref => {
|
|
|
1350
1365
|
break;
|
|
1351
1366
|
case 'ArrowLeft':
|
|
1352
1367
|
e.preventDefault(); // prevent scroll
|
|
1353
|
-
index.setIsKeyboardUser(true);
|
|
1354
1368
|
// If the row is expanded and on the first cell, collapse the row
|
|
1355
1369
|
if (e.shiftKey || rowOrFirstColumnIsFocused && rowCanCollapse) {
|
|
1356
1370
|
updateExpandedRowIds(rowIndex, false);
|
|
@@ -1360,7 +1374,6 @@ const AdvancedTable = _ref => {
|
|
|
1360
1374
|
break;
|
|
1361
1375
|
case 'ArrowRight':
|
|
1362
1376
|
e.preventDefault(); // prevent scroll
|
|
1363
|
-
index.setIsKeyboardUser(true);
|
|
1364
1377
|
// If the row is collapsed and on the first cell, expand the row
|
|
1365
1378
|
if (e.shiftKey || rowOrFirstColumnIsFocused && rowCanExpand) {
|
|
1366
1379
|
updateExpandedRowIds(rowIndex, true);
|
|
@@ -1370,17 +1383,14 @@ const AdvancedTable = _ref => {
|
|
|
1370
1383
|
break;
|
|
1371
1384
|
case 'PageUp':
|
|
1372
1385
|
e.preventDefault(); // prevent scroll
|
|
1373
|
-
index.setIsKeyboardUser(true);
|
|
1374
1386
|
updateRowFocusIndex(headerRowIndex);
|
|
1375
1387
|
break;
|
|
1376
1388
|
case 'PageDown':
|
|
1377
1389
|
e.preventDefault(); // prevent scroll
|
|
1378
|
-
index.setIsKeyboardUser(true);
|
|
1379
1390
|
updateRowFocusIndex(maxRowIndex);
|
|
1380
1391
|
break;
|
|
1381
1392
|
case 'Home':
|
|
1382
1393
|
e.preventDefault(); // prevent scroll
|
|
1383
|
-
index.setIsKeyboardUser(true);
|
|
1384
1394
|
updateColumnFocusIndex(minColumnIndex);
|
|
1385
1395
|
if (e.ctrlKey) {
|
|
1386
1396
|
updateRowFocusIndex(headerRowIndex);
|
|
@@ -1388,7 +1398,6 @@ const AdvancedTable = _ref => {
|
|
|
1388
1398
|
break;
|
|
1389
1399
|
case 'End':
|
|
1390
1400
|
e.preventDefault(); // prevent scroll
|
|
1391
|
-
index.setIsKeyboardUser(true);
|
|
1392
1401
|
updateColumnFocusIndex(maxColumnIndex);
|
|
1393
1402
|
if (e.ctrlKey) {
|
|
1394
1403
|
updateRowFocusIndex(maxRowIndex);
|
|
@@ -1396,7 +1405,6 @@ const AdvancedTable = _ref => {
|
|
|
1396
1405
|
break;
|
|
1397
1406
|
case ' ':
|
|
1398
1407
|
e.preventDefault(); // prevent scroll
|
|
1399
|
-
index.setIsKeyboardUser(true);
|
|
1400
1408
|
if (rowIndex === headerRowIndex) {
|
|
1401
1409
|
handleColumnHeaderCheckboxToggle();
|
|
1402
1410
|
} else if (e.shiftKey) {
|
|
@@ -1410,6 +1418,7 @@ const AdvancedTable = _ref => {
|
|
|
1410
1418
|
}
|
|
1411
1419
|
};
|
|
1412
1420
|
const getColumnHeaderProps = (columnConfig, columnIndex, isPinned) => {
|
|
1421
|
+
var _columnWidths$id;
|
|
1413
1422
|
const rowIndex = headerRowIndex;
|
|
1414
1423
|
const {
|
|
1415
1424
|
id,
|
|
@@ -1422,9 +1431,9 @@ const AdvancedTable = _ref => {
|
|
|
1422
1431
|
return {
|
|
1423
1432
|
id,
|
|
1424
1433
|
isRowActionMenuColumn,
|
|
1425
|
-
'data-testid': dataTestId && id ?
|
|
1434
|
+
'data-testid': dataTestId && id ? "".concat(dataTestId, "-").concat(id) : undefined,
|
|
1426
1435
|
label: headerLabel,
|
|
1427
|
-
width: columnWidths[id]
|
|
1436
|
+
width: (_columnWidths$id = columnWidths[id]) !== null && _columnWidths$id !== void 0 ? _columnWidths$id : width,
|
|
1428
1437
|
widthBuffer: columnIndex === 0 && maxRowDepth > 0 ? columnWidthBuffers[0] : undefined,
|
|
1429
1438
|
onWidthChange: disableUserResizableColumns || isRowActionMenuColumn ? undefined : newWidth => {
|
|
1430
1439
|
setColumnWidths(currentColumnWidths => {
|
|
@@ -1434,8 +1443,9 @@ const AdvancedTable = _ref => {
|
|
|
1434
1443
|
} else if (currentColumnWidths[colId]) {
|
|
1435
1444
|
map[colId] = currentColumnWidths[colId];
|
|
1436
1445
|
} else {
|
|
1437
|
-
|
|
1438
|
-
|
|
1446
|
+
var _cellRefs$current, _cellRefs$current$hea;
|
|
1447
|
+
const colRef = (_cellRefs$current = cellRefs.current) === null || _cellRefs$current === void 0 ? void 0 : (_cellRefs$current$hea = _cellRefs$current[headerRowIndex]) === null || _cellRefs$current$hea === void 0 ? void 0 : _cellRefs$current$hea[index];
|
|
1448
|
+
map[colId] = colRef === null || colRef === void 0 ? void 0 : colRef.getBoundingClientRect().width;
|
|
1439
1449
|
}
|
|
1440
1450
|
return map;
|
|
1441
1451
|
}, {});
|
|
@@ -1471,7 +1481,7 @@ const AdvancedTable = _ref => {
|
|
|
1471
1481
|
};
|
|
1472
1482
|
};
|
|
1473
1483
|
const getAdvancedTableRowExpandButton = (rowId, isExpanded, rowIndex) => /*#__PURE__*/React__default["default"].createElement(AdvancedTableRowExpandButton, {
|
|
1474
|
-
"data-testid": dataTestId && rowId ?
|
|
1484
|
+
"data-testid": dataTestId && rowId ? "".concat(dataTestId, "-row-").concat(rowId, "-expand-button") : undefined,
|
|
1475
1485
|
isRowExpanded: !!isExpanded,
|
|
1476
1486
|
onClick: e => {
|
|
1477
1487
|
e.stopPropagation(); // prevent onRowSelect
|
|
@@ -1492,6 +1502,7 @@ const AdvancedTable = _ref => {
|
|
|
1492
1502
|
}, children);
|
|
1493
1503
|
};
|
|
1494
1504
|
const getCellProps = (columnConfig, columnIndex, data, rowIndex, rowId, depth) => {
|
|
1505
|
+
var _columnWidths$columnI;
|
|
1495
1506
|
const {
|
|
1496
1507
|
id: columnId,
|
|
1497
1508
|
width,
|
|
@@ -1505,18 +1516,18 @@ const AdvancedTable = _ref => {
|
|
|
1505
1516
|
setValue: newValue => {
|
|
1506
1517
|
const newRows = [...rowsProp];
|
|
1507
1518
|
newRows[rowIndex].data[columnId] = newValue;
|
|
1508
|
-
onRowsChange
|
|
1519
|
+
onRowsChange === null || onRowsChange === void 0 ? void 0 : onRowsChange(newRows);
|
|
1509
1520
|
},
|
|
1510
1521
|
renderCellContent,
|
|
1511
1522
|
isCellContentInteractive,
|
|
1512
|
-
width: columnWidths[columnId]
|
|
1523
|
+
width: (_columnWidths$columnI = columnWidths[columnId]) !== null && _columnWidths$columnI !== void 0 ? _columnWidths$columnI : width,
|
|
1513
1524
|
widthBuffer: columnIndex === 0 && maxRowDepth > 0 ? columnWidthBuffers[depth] : undefined,
|
|
1514
1525
|
alignment,
|
|
1515
1526
|
rowId,
|
|
1516
1527
|
columnId,
|
|
1517
1528
|
rowIndex,
|
|
1518
1529
|
columnIndex,
|
|
1519
|
-
'data-testid': dataTestId && rowId && columnId ?
|
|
1530
|
+
'data-testid': dataTestId && rowId && columnId ? "".concat(dataTestId, "-cell-").concat(rowId, "-").concat(columnId) : undefined,
|
|
1520
1531
|
isFocused: rowIndex === focusedRowIndex && columnIndex === focusedColumnIndex,
|
|
1521
1532
|
onFocus: onCellFocus(rowIndex, columnIndex),
|
|
1522
1533
|
onKeyDown: onKeyDown(rowIndex),
|
|
@@ -1576,16 +1587,16 @@ const AdvancedTable = _ref => {
|
|
|
1576
1587
|
onClick: handleColumnHeaderCheckboxToggle,
|
|
1577
1588
|
onFocus: onRowFocus(headerRowIndex, minColumnIndex),
|
|
1578
1589
|
variant: "header"
|
|
1579
|
-
}), hasExpandableRows && pinnedColumnConfigs.length ? getExpandableRowsSpacer(
|
|
1590
|
+
}), hasExpandableRows && pinnedColumnConfigs.length ? getExpandableRowsSpacer("".concat(widthBufferWidth, "px"), true) : undefined, pinnedColumnConfigs.map((columnConfigs, i) => {
|
|
1580
1591
|
const props = getColumnHeaderProps(columnConfigs, i, true);
|
|
1581
1592
|
return /*#__PURE__*/React__default["default"].createElement(AdvancedTableColumnHeader, props);
|
|
1582
|
-
})) : undefined, hasExpandableRows && !pinnedColumnConfigs.length ? getExpandableRowsSpacer(
|
|
1593
|
+
})) : undefined, hasExpandableRows && !pinnedColumnConfigs.length ? getExpandableRowsSpacer("".concat(widthBufferWidth, "px"), true) : undefined, unpinnedColumnConfigs.map((columnConfigs, i) => {
|
|
1583
1594
|
const props = getColumnHeaderProps(columnConfigs, i + pinnedColumnConfigs.length, false);
|
|
1584
1595
|
return /*#__PURE__*/React__default["default"].createElement(AdvancedTableColumnHeader, props);
|
|
1585
1596
|
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1586
1597
|
role: "rowgroup",
|
|
1587
1598
|
className: styles$a.advancedTableRowGroup
|
|
1588
|
-
}, (paginatedRows
|
|
1599
|
+
}, ((_ref5 = paginatedRows !== null && paginatedRows !== void 0 ? paginatedRows : rows) !== null && _ref5 !== void 0 ? _ref5 : []).map((row, rowIndex) => {
|
|
1589
1600
|
const {
|
|
1590
1601
|
id: rowId,
|
|
1591
1602
|
data,
|
|
@@ -1602,7 +1613,7 @@ const AdvancedTable = _ref => {
|
|
|
1602
1613
|
const onSelect = e => {
|
|
1603
1614
|
e.preventDefault(); // stops event from triggering on new target when focus is changed during onSelect
|
|
1604
1615
|
if (hasOnRowSelect) {
|
|
1605
|
-
onRowSelect
|
|
1616
|
+
onRowSelect === null || onRowSelect === void 0 ? void 0 : onRowSelect(row.rowPropReference);
|
|
1606
1617
|
setSelectedRowId(rowId);
|
|
1607
1618
|
}
|
|
1608
1619
|
};
|
|
@@ -1617,7 +1628,7 @@ const AdvancedTable = _ref => {
|
|
|
1617
1628
|
"aria-rowindex": hasExpandableRows ? undefined : paginatedRowIndex + 2 // aria-rowindex is one-indexed + the column headers row is the first row in the table
|
|
1618
1629
|
,
|
|
1619
1630
|
|
|
1620
|
-
"data-testid": dataTestId && rowId ?
|
|
1631
|
+
"data-testid": dataTestId && rowId ? "".concat(dataTestId, "-row-").concat(rowId) : undefined,
|
|
1621
1632
|
hasOnRowSelect: hasOnRowSelect,
|
|
1622
1633
|
isFocusable: hasFocusableRows,
|
|
1623
1634
|
isFocused: paginatedRowIndex === focusedRowIndex && minColumnIndex === focusedColumnIndex,
|
|
@@ -1626,7 +1637,7 @@ const AdvancedTable = _ref => {
|
|
|
1626
1637
|
onKeyDown: onRowKeyDown,
|
|
1627
1638
|
onFocus: onRowFocus(paginatedRowIndex, minColumnIndex),
|
|
1628
1639
|
onClick: e => onSelect(e),
|
|
1629
|
-
key:
|
|
1640
|
+
key: "".concat(rowId).concat(depth).concat(parentId),
|
|
1630
1641
|
ref: createRef(paginatedRowIndex, minColumnIndex),
|
|
1631
1642
|
"aria-level": hasExpandableRows ? depth + 1 : undefined // aria-level is one-indexed
|
|
1632
1643
|
,
|
|
@@ -1650,14 +1661,14 @@ const AdvancedTable = _ref => {
|
|
|
1650
1661
|
onMouseEnter: () => setIsCheckboxHovered(true),
|
|
1651
1662
|
onMouseLeave: () => setIsCheckboxHovered(false),
|
|
1652
1663
|
onFocus: onRowFocus(paginatedRowIndex, minColumnIndex)
|
|
1653
|
-
}), hasExpandableRows && pinnedColumnConfigs.length ? getExpandableRowsSpacer(
|
|
1664
|
+
}), hasExpandableRows && pinnedColumnConfigs.length ? getExpandableRowsSpacer("".concat(widthBufferWidth * (depth + 1), "px"), false, hasChildRows ? getAdvancedTableRowExpandButton(rowId, isExpanded, rowIndex) : undefined) : undefined, pinnedColumnConfigs.map((c, i) => {
|
|
1654
1665
|
const props = getCellProps(c, i, data, paginatedRowIndex, rowId, depth);
|
|
1655
1666
|
return /*#__PURE__*/React__default["default"].createElement(AdvancedTableCell, _extends__default["default"]({}, props, {
|
|
1656
1667
|
"aria-rowindex": hasExpandableRows ? undefined : rowIndex + 2 // aria-rowindex is one-indexed + the column headers row is the first row in the table
|
|
1657
1668
|
,
|
|
1658
1669
|
"aria-colindex": i + 1 // aria-colindex is one-indexed
|
|
1659
1670
|
}));
|
|
1660
|
-
})) : undefined, hasExpandableRows && !pinnedColumnConfigs.length ? getExpandableRowsSpacer(
|
|
1671
|
+
})) : undefined, hasExpandableRows && !pinnedColumnConfigs.length ? getExpandableRowsSpacer("".concat(widthBufferWidth * (depth + 1), "px"), false, hasChildRows ? getAdvancedTableRowExpandButton(rowId, isExpanded, rowIndex) : undefined) : undefined, unpinnedColumnConfigs.map((c, i) => {
|
|
1661
1672
|
const props = getCellProps(c, i + pinnedColumnConfigs.length, data, paginatedRowIndex, rowId, depth);
|
|
1662
1673
|
return /*#__PURE__*/React__default["default"].createElement(AdvancedTableCell, _extends__default["default"]({}, props, {
|
|
1663
1674
|
className: styles$a.advancedTableRowChild,
|
|
@@ -1678,26 +1689,27 @@ const AdvancedTable = _ref => {
|
|
|
1678
1689
|
};
|
|
1679
1690
|
|
|
1680
1691
|
// TODO: move hook to separate file
|
|
1681
|
-
function useSortedRows(
|
|
1692
|
+
function useSortedRows(_ref6) {
|
|
1682
1693
|
let {
|
|
1683
1694
|
columnConfigs,
|
|
1684
1695
|
onRowsChange,
|
|
1685
1696
|
selectedSortOption,
|
|
1686
1697
|
setCurrentPage
|
|
1687
|
-
} =
|
|
1698
|
+
} = _ref6;
|
|
1688
1699
|
const columnConfigsRef = index.useLatest(columnConfigs);
|
|
1689
1700
|
const onRowsChangeRef = index.useLatest(onRowsChange);
|
|
1690
1701
|
index.useDidUpdate(() => {
|
|
1702
|
+
var _columnConfigsRef$cur, _columnConfigsRef$cur2, _columnConfigsRef$cur3;
|
|
1691
1703
|
const {
|
|
1692
1704
|
columnId,
|
|
1693
1705
|
index
|
|
1694
1706
|
} = selectedSortOption;
|
|
1695
|
-
const sort = columnConfigsRef.current.find(
|
|
1707
|
+
const sort = (_columnConfigsRef$cur = columnConfigsRef.current.find(_ref7 => {
|
|
1696
1708
|
let {
|
|
1697
1709
|
id
|
|
1698
|
-
} =
|
|
1710
|
+
} = _ref7;
|
|
1699
1711
|
return id === columnId;
|
|
1700
|
-
})
|
|
1712
|
+
})) === null || _columnConfigsRef$cur === void 0 ? void 0 : (_columnConfigsRef$cur2 = _columnConfigsRef$cur.sortOptions) === null || _columnConfigsRef$cur2 === void 0 ? void 0 : (_columnConfigsRef$cur3 = _columnConfigsRef$cur2[index]) === null || _columnConfigsRef$cur3 === void 0 ? void 0 : _columnConfigsRef$cur3.sort;
|
|
1701
1713
|
if (typeof sort === 'function' && onRowsChangeRef.current) {
|
|
1702
1714
|
onRowsChangeRef.current(sort(selectedSortOption));
|
|
1703
1715
|
setCurrentPage(1);
|
|
@@ -1706,7 +1718,7 @@ function useSortedRows(_ref5) {
|
|
|
1706
1718
|
}
|
|
1707
1719
|
|
|
1708
1720
|
// TODO: move hook to separate file
|
|
1709
|
-
function useFocusState(
|
|
1721
|
+
function useFocusState(_ref8) {
|
|
1710
1722
|
let {
|
|
1711
1723
|
headerRowIndex,
|
|
1712
1724
|
maxRowIndex,
|
|
@@ -1716,7 +1728,7 @@ function useFocusState(_ref7) {
|
|
|
1716
1728
|
pinnedUnpinnedColumnOrder,
|
|
1717
1729
|
tableRef,
|
|
1718
1730
|
currentPage
|
|
1719
|
-
} =
|
|
1731
|
+
} = _ref8;
|
|
1720
1732
|
const cellRefs = React.useRef({});
|
|
1721
1733
|
const pinnedContainersRef = React.useRef({});
|
|
1722
1734
|
const [focusedRowIndex, setFocusedRowIndex] = React.useState(headerRowIndex);
|
|
@@ -1742,57 +1754,58 @@ function useFocusState(_ref7) {
|
|
|
1742
1754
|
return newIndex;
|
|
1743
1755
|
};
|
|
1744
1756
|
const focusCell = index.useEventCallback(cell => {
|
|
1757
|
+
var _tableRef$current, _cellRefs$current2, _cellRefs$current2$he;
|
|
1745
1758
|
// Manually scroll cells/rows into view if needed
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
if (
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
tableRef.current.scrollTop += cellPos.bottom - tablePos.bottom;
|
|
1763
|
-
}
|
|
1759
|
+
const tablePos = (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.getBoundingClientRect();
|
|
1760
|
+
const header = (_cellRefs$current2 = cellRefs.current) === null || _cellRefs$current2 === void 0 ? void 0 : (_cellRefs$current2$he = _cellRefs$current2[headerRowIndex]) === null || _cellRefs$current2$he === void 0 ? void 0 : _cellRefs$current2$he[-1];
|
|
1761
|
+
const headerPos = header === null || header === void 0 ? void 0 : header.getBoundingClientRect();
|
|
1762
|
+
let cellPos = cell === null || cell === void 0 ? void 0 : cell.getBoundingClientRect();
|
|
1763
|
+
|
|
1764
|
+
// Vertical scroll
|
|
1765
|
+
if (cell !== header && !header.contains(cell)) {
|
|
1766
|
+
if (cellPos.top < headerPos.top + headerPos.height) {
|
|
1767
|
+
// Scroll down if cell covered by header
|
|
1768
|
+
tableRef.current.scrollTop -= headerPos.top + headerPos.height - cellPos.top;
|
|
1769
|
+
} else if (cellPos.top < tablePos.top) {
|
|
1770
|
+
// Scroll down if cell out of view above table
|
|
1771
|
+
tableRef.current.scrollTop -= tablePos.top - cellPos.top;
|
|
1772
|
+
} else if (cellPos.bottom > tablePos.bottom) {
|
|
1773
|
+
// Scroll up if cell out of view below table
|
|
1774
|
+
tableRef.current.scrollTop += cellPos.bottom - tablePos.bottom;
|
|
1764
1775
|
}
|
|
1776
|
+
}
|
|
1765
1777
|
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1778
|
+
// Horizontal scroll
|
|
1779
|
+
// Scroll left if an entire row is focused
|
|
1780
|
+
if (minColumnIndex === -1 && focusedColumnIndex === minColumnIndex) {
|
|
1781
|
+
tableRef.current.scrollLeft -= tablePos.left - cellPos.left;
|
|
1782
|
+
} else {
|
|
1783
|
+
var _pinnedContainersRef$;
|
|
1784
|
+
if (cellPos.left < tablePos.left) {
|
|
1785
|
+
// Scroll right if cell out of view to the left of the table
|
|
1769
1786
|
tableRef.current.scrollLeft -= tablePos.left - cellPos.left;
|
|
1770
|
-
} else {
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
}
|
|
1778
|
-
const pinnedContainer = pinnedContainersRef.current?.[focusedRowIndex];
|
|
1779
|
-
const pinnedContainerPos = pinnedContainer?.getBoundingClientRect();
|
|
1780
|
-
cellPos = cell?.getBoundingClientRect();
|
|
1787
|
+
} else if (cellPos.right > tablePos.right) {
|
|
1788
|
+
// Scroll left if cell out of view to the right of the table
|
|
1789
|
+
tableRef.current.scrollLeft += cellPos.right - tablePos.right;
|
|
1790
|
+
}
|
|
1791
|
+
const pinnedContainer = (_pinnedContainersRef$ = pinnedContainersRef.current) === null || _pinnedContainersRef$ === void 0 ? void 0 : _pinnedContainersRef$[focusedRowIndex];
|
|
1792
|
+
const pinnedContainerPos = pinnedContainer === null || pinnedContainer === void 0 ? void 0 : pinnedContainer.getBoundingClientRect();
|
|
1793
|
+
cellPos = cell === null || cell === void 0 ? void 0 : cell.getBoundingClientRect();
|
|
1781
1794
|
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
}
|
|
1795
|
+
// Scroll right if cell covered by pinned columns
|
|
1796
|
+
if (pinnedContainer && cellPos.left < pinnedContainerPos.left + pinnedContainerPos.width && !pinnedContainer.contains(cell)) {
|
|
1797
|
+
tableRef.current.scrollLeft -= pinnedContainerPos.left + pinnedContainerPos.width - cellPos.left;
|
|
1786
1798
|
}
|
|
1787
1799
|
}
|
|
1788
|
-
cell
|
|
1800
|
+
cell === null || cell === void 0 ? void 0 : cell.focus();
|
|
1789
1801
|
});
|
|
1790
1802
|
|
|
1791
1803
|
// Focus header cell when the focused column id changes. Used when pinning/unpinning columns since a new DOM element is created.
|
|
1792
1804
|
index.useDidUpdate(() => {
|
|
1793
1805
|
if (focusedColumnId) {
|
|
1806
|
+
var _cellRefs$current3, _cellRefs$current3$fo;
|
|
1794
1807
|
const columnIndex = pinnedUnpinnedColumnOrder.indexOf(focusedColumnId);
|
|
1795
|
-
focusCell(cellRefs.current
|
|
1808
|
+
focusCell((_cellRefs$current3 = cellRefs.current) === null || _cellRefs$current3 === void 0 ? void 0 : (_cellRefs$current3$fo = _cellRefs$current3[focusedRowIndex]) === null || _cellRefs$current3$fo === void 0 ? void 0 : _cellRefs$current3$fo[columnIndex]);
|
|
1796
1809
|
setFocusedColumnIndex(columnIndex);
|
|
1797
1810
|
setFocusedColumnId(undefined);
|
|
1798
1811
|
}
|
|
@@ -1800,7 +1813,8 @@ function useFocusState(_ref7) {
|
|
|
1800
1813
|
|
|
1801
1814
|
// Focus cell when the focused indices change
|
|
1802
1815
|
index.useDidUpdate(() => {
|
|
1803
|
-
|
|
1816
|
+
var _cellRefs$current4, _cellRefs$current4$fo;
|
|
1817
|
+
const newFocusedCell = (_cellRefs$current4 = cellRefs.current) === null || _cellRefs$current4 === void 0 ? void 0 : (_cellRefs$current4$fo = _cellRefs$current4[focusedRowIndex]) === null || _cellRefs$current4$fo === void 0 ? void 0 : _cellRefs$current4$fo[focusedColumnIndex];
|
|
1804
1818
|
|
|
1805
1819
|
/* Prevent cells from stealing focus from their children when they
|
|
1806
1820
|
* receive focus, but still allow focus to move from a cell to a row.
|
|
@@ -1827,9 +1841,9 @@ function useFocusState(_ref7) {
|
|
|
1827
1841
|
|
|
1828
1842
|
/* eslint-disable import/prefer-default-export */
|
|
1829
1843
|
|
|
1830
|
-
var css_248z$9 = ".
|
|
1831
|
-
var styles$9 = {"collapsibleSearchInput":"
|
|
1832
|
-
var stylesheet$9=".
|
|
1844
|
+
var css_248z$9 = "._jakeN{display:inline-block;width:36px;transition:width .25s ease-out}._eTa5V{width:100%}._4oLH9>input{padding-right:0!important}._P3iQS>svg{fill:#515559}";
|
|
1845
|
+
var styles$9 = {"collapsibleSearchInput":"_jakeN","searchInput":"_eTa5V","searchInputCollapsed":"_4oLH9","iconButton":"_P3iQS"};
|
|
1846
|
+
var stylesheet$9="._jakeN{display:inline-block;width:36px;transition:width .25s ease-out}._eTa5V{width:100%}._4oLH9>input{padding-right:0!important}._P3iQS>svg{fill:#515559}";
|
|
1833
1847
|
icons_index.styleInject(css_248z$9);
|
|
1834
1848
|
|
|
1835
1849
|
const CollapsibleSearchInputIconButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
@@ -1845,7 +1859,7 @@ const CollapsibleSearchInputIconButton = /*#__PURE__*/React.forwardRef((_ref, re
|
|
|
1845
1859
|
return /*#__PURE__*/React__default["default"].createElement(index.IconButton, _extends__default["default"]({}, rest, {
|
|
1846
1860
|
className: styles$9.iconButton,
|
|
1847
1861
|
"aria-label": label,
|
|
1848
|
-
tooltipContent: tooltipContent
|
|
1862
|
+
tooltipContent: tooltipContent !== null && tooltipContent !== void 0 ? tooltipContent : label,
|
|
1849
1863
|
tooltipPlacement: tooltipPlacement,
|
|
1850
1864
|
ref: ref
|
|
1851
1865
|
}), /*#__PURE__*/React__default["default"].createElement(icons_index.SearchIcon, null));
|
|
@@ -1906,7 +1920,8 @@ const CollapsibleSearchInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
1906
1920
|
});
|
|
1907
1921
|
};
|
|
1908
1922
|
const handleIconButtonClick = () => {
|
|
1909
|
-
|
|
1923
|
+
var _iconButtonRef$curren;
|
|
1924
|
+
(_iconButtonRef$curren = iconButtonRef.current) === null || _iconButtonRef$curren === void 0 ? void 0 : _iconButtonRef$curren.focus();
|
|
1910
1925
|
setExternalIsExpanded(true);
|
|
1911
1926
|
};
|
|
1912
1927
|
index.useDidUpdate(() => {
|
|
@@ -1921,18 +1936,19 @@ const CollapsibleSearchInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
1921
1936
|
});
|
|
1922
1937
|
}, [externalIsExpanded]);
|
|
1923
1938
|
React.useEffect(() => {
|
|
1939
|
+
var _searchInputRef$curre, _iconButtonRef$curren2;
|
|
1924
1940
|
if (isComponentFocused) {
|
|
1925
1941
|
switch (internalExpandedState) {
|
|
1926
1942
|
case expandedStates.EXPANDING:
|
|
1927
|
-
searchInputRef.current
|
|
1943
|
+
(_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 ? void 0 : _searchInputRef$curre.focus();
|
|
1928
1944
|
break;
|
|
1929
1945
|
case expandedStates.COLLAPSED:
|
|
1930
1946
|
/*
|
|
1931
1947
|
* Handles use-case when user clicks on search input to enter text and the component is collapsed while focus is still on the search input.
|
|
1932
1948
|
* This will show the focus ring on the icon button and allow the tooltip to appear.
|
|
1933
1949
|
*/
|
|
1934
|
-
|
|
1935
|
-
iconButtonRef.current
|
|
1950
|
+
|
|
1951
|
+
(_iconButtonRef$curren2 = iconButtonRef.current) === null || _iconButtonRef$curren2 === void 0 ? void 0 : _iconButtonRef$curren2.focus();
|
|
1936
1952
|
break;
|
|
1937
1953
|
default:
|
|
1938
1954
|
}
|
|
@@ -1968,9 +1984,9 @@ const CollapsibleSearchInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
1968
1984
|
}));
|
|
1969
1985
|
});
|
|
1970
1986
|
|
|
1971
|
-
var css_248z$8 = ".
|
|
1972
|
-
var styles$8 = {"input":"
|
|
1973
|
-
var stylesheet$8=".
|
|
1987
|
+
var css_248z$8 = "._YIYhi input{padding-left:76px!important}._8-lxx input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._8-lxx input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._8-lxx input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._Sijhl{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._Sijhl,._Sijhl._8-lxx:hover{background-color:transparent!important}._Sijhl:hover{background-color:rgba(50,54,58,.08)!important}._Sijhl:active{background-color:rgba(50,54,58,.11)!important}._Sijhl svg{top:2px!important}._SAdmy{position:relative}._Aoh3n{position:absolute;top:18px;left:12px;line-height:0;font-size:14px;color:#32363a;z-index:101;pointer-events:none}";
|
|
1988
|
+
var styles$8 = {"input":"_YIYhi","disabled":"_8-lxx","dropdown":"_Sijhl","container":"_SAdmy","countryCode":"_Aoh3n"};
|
|
1989
|
+
var stylesheet$8="._YIYhi input{padding-left:76px!important}._8-lxx input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._8-lxx input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._8-lxx input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._Sijhl{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._Sijhl,._Sijhl._8-lxx:hover{background-color:transparent!important}._Sijhl:hover{background-color:rgba(50,54,58,.08)!important}._Sijhl:active{background-color:rgba(50,54,58,.11)!important}._Sijhl svg{top:2px!important}._SAdmy{position:relative}._Aoh3n{position:absolute;top:18px;left:12px;line-height:0;font-size:14px;color:#32363a;z-index:101;pointer-events:none}";
|
|
1974
1990
|
icons_index.styleInject(css_248z$8);
|
|
1975
1991
|
|
|
1976
1992
|
const PhoneNumberInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
@@ -1996,9 +2012,10 @@ const PhoneNumberInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
1996
2012
|
translate
|
|
1997
2013
|
} = index.useTranslation();
|
|
1998
2014
|
const getMinMaxLength = React.useCallback(() => {
|
|
2015
|
+
var _metadata$numberingPl;
|
|
1999
2016
|
const metadata = new libphonenumberJs.Metadata();
|
|
2000
2017
|
metadata.selectNumberingPlan(countryCode);
|
|
2001
|
-
const possibleLengths = metadata
|
|
2018
|
+
const possibleLengths = metadata === null || metadata === void 0 ? void 0 : (_metadata$numberingPl = metadata.numberingPlan) === null || _metadata$numberingPl === void 0 ? void 0 : _metadata$numberingPl.possibleLengths();
|
|
2002
2019
|
return possibleLengths ? [Math.min(...possibleLengths), Math.max(...possibleLengths)] : [0, genericMaxNumberLength];
|
|
2003
2020
|
}, [countryCode]);
|
|
2004
2021
|
const shouldUseMask = Number(libphonenumberJs.getCountryCallingCode(countryCode)) === 1;
|
|
@@ -2012,7 +2029,7 @@ const PhoneNumberInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
2012
2029
|
React.useEffect(() => {
|
|
2013
2030
|
updateMask();
|
|
2014
2031
|
}, [countryCode, updateMask]);
|
|
2015
|
-
const removeNonNumericCharacters = value => value
|
|
2032
|
+
const removeNonNumericCharacters = value => value === null || value === void 0 ? void 0 : value.replace(/\D/g, '');
|
|
2016
2033
|
const handleInputChange = a => {
|
|
2017
2034
|
// remove all non-numeric characters
|
|
2018
2035
|
const value = removeNonNumericCharacters(a.target.value);
|
|
@@ -2028,12 +2045,12 @@ const PhoneNumberInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
2028
2045
|
} catch (e) {
|
|
2029
2046
|
// `parsePhoneNumber` throws an error if the inputs are invalid.
|
|
2030
2047
|
}
|
|
2031
|
-
onChange
|
|
2048
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(internationalNumber, isValidLength, countryCode, value);
|
|
2032
2049
|
};
|
|
2033
2050
|
const inputClassNames = classNames__default["default"](styles$8.input, {
|
|
2034
2051
|
[styles$8.disabled]: isDisabled
|
|
2035
2052
|
});
|
|
2036
|
-
const dropdownLabel = React.useMemo(() => countryCode ?
|
|
2053
|
+
const dropdownLabel = React.useMemo(() => countryCode ? "+".concat(libphonenumberJs.getCountryCallingCode(countryCode)) : undefined, [countryCode]);
|
|
2037
2054
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2038
2055
|
className: styles$8.container,
|
|
2039
2056
|
"data-testid": dataTestId
|
|
@@ -2050,14 +2067,14 @@ const PhoneNumberInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
2050
2067
|
disabled: isDisabled,
|
|
2051
2068
|
"aria-label": buttonAriaLabel,
|
|
2052
2069
|
"aria-labelledby": buttonAriaLabelledBy
|
|
2053
|
-
}, (countryCodes
|
|
2070
|
+
}, (countryCodes !== null && countryCodes !== void 0 ? countryCodes : libphonenumberJs.getCountries()).map(individualCountryCode => {
|
|
2054
2071
|
if (!libphonenumberJs.isSupportedCountry(individualCountryCode)) {
|
|
2055
2072
|
return null;
|
|
2056
2073
|
}
|
|
2057
2074
|
return /*#__PURE__*/React__default["default"].createElement(index.MenuItem, {
|
|
2058
2075
|
key: individualCountryCode,
|
|
2059
2076
|
value: individualCountryCode
|
|
2060
|
-
},
|
|
2077
|
+
}, "".concat(translate(individualCountryCode), " +").concat(libphonenumberJs.getCountryCallingCode(individualCountryCode)));
|
|
2061
2078
|
})), /*#__PURE__*/React__default["default"].createElement(InputMask__default["default"], {
|
|
2062
2079
|
value: isDisabled ? removeNonNumericCharacters(initialValue) : undefined,
|
|
2063
2080
|
type: "tel",
|
|
@@ -2112,7 +2129,7 @@ function deleteOption(option, options, hookFunctionName) {
|
|
|
2112
2129
|
const indexOfNodeToDelete = options.findIndex(n => n === option);
|
|
2113
2130
|
if (indexOfNodeToDelete === -1) {
|
|
2114
2131
|
// eslint-disable-next-line no-console
|
|
2115
|
-
console.error(
|
|
2132
|
+
console.error("[".concat(hookFunctionName, "] Attempt to delete node failed. This node does not exist in the list of registered nodes."));
|
|
2116
2133
|
} else {
|
|
2117
2134
|
options.splice(indexOfNodeToDelete, 1);
|
|
2118
2135
|
}
|
|
@@ -2135,7 +2152,7 @@ function useComboboxFilteredGroup() {
|
|
|
2135
2152
|
// NOTE: This function and its dependencies *must* not change during re-renders because it will cause ComboboxOptions to deregister and reregister, thus causing unexpected behavior
|
|
2136
2153
|
if (!option) {
|
|
2137
2154
|
// eslint-disable-next-line no-console
|
|
2138
|
-
console.warn(
|
|
2155
|
+
console.warn("[".concat(useComboboxFilteredGroup.name, "] registerOption called without any parameters! Pass in \"option\" as parameter."));
|
|
2139
2156
|
return;
|
|
2140
2157
|
}
|
|
2141
2158
|
insertOption(option, filteredOptionsRef.current);
|
|
@@ -2202,7 +2219,8 @@ isDisabled) {
|
|
|
2202
2219
|
* @param descendantElement - The element to be marked as the active descendant element.
|
|
2203
2220
|
*/
|
|
2204
2221
|
const focusDescendant = React.useCallback((descendantElement, index) => {
|
|
2205
|
-
|
|
2222
|
+
var _inputRef$current;
|
|
2223
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.setAttribute('aria-activedescendant', descendantElement.id);
|
|
2206
2224
|
setActiveDescendant({
|
|
2207
2225
|
element: descendantElement,
|
|
2208
2226
|
index
|
|
@@ -2233,7 +2251,7 @@ isDisabled) {
|
|
|
2233
2251
|
// NOTE: This function and its dependencies *must* not change during re-renders because it will cause ComboboxOptions to deregister and reregister, thus causing unexpected behavior
|
|
2234
2252
|
if (!option) {
|
|
2235
2253
|
// eslint-disable-next-line no-console
|
|
2236
|
-
console.error(
|
|
2254
|
+
console.error("[".concat(useComboboxFocusSequence.name, "] registerOption called without any parameters! Pass in a 'ComboboxOption' via the \"option\" parameter."));
|
|
2237
2255
|
} else {
|
|
2238
2256
|
insertOption(option, filteredOptionsRef.current);
|
|
2239
2257
|
}
|
|
@@ -2247,10 +2265,11 @@ isDisabled) {
|
|
|
2247
2265
|
// NOTE: This function and its dependencies *must* not change during re-renders because it will cause ComboboxOptions to deregister and reregister, thus causing unexpected behavior
|
|
2248
2266
|
if (!option) {
|
|
2249
2267
|
// eslint-disable-next-line no-console
|
|
2250
|
-
console.error(
|
|
2268
|
+
console.error("[".concat(useComboboxFocusSequence.name, "] deregisterOption called without any parameters! Pass in a 'ComboboxOption' via the \"option\" parameter."));
|
|
2251
2269
|
} else {
|
|
2270
|
+
var _activeDescendantRef$;
|
|
2252
2271
|
deleteOption(option, filteredOptionsRef.current, useComboboxFocusSequence.name);
|
|
2253
|
-
if (option === activeDescendantRef.current
|
|
2272
|
+
if (option === ((_activeDescendantRef$ = activeDescendantRef.current) === null || _activeDescendantRef$ === void 0 ? void 0 : _activeDescendantRef$.element)) {
|
|
2254
2273
|
setActiveDescendant(undefined);
|
|
2255
2274
|
}
|
|
2256
2275
|
if (filteredOptionsRef.current.length === 0) {
|
|
@@ -2292,7 +2311,8 @@ isDisabled) {
|
|
|
2292
2311
|
if (!isOpen) {
|
|
2293
2312
|
openFlyoutAndFocus(focusNext.name);
|
|
2294
2313
|
} else {
|
|
2295
|
-
|
|
2314
|
+
var _activeDescendantRef$2;
|
|
2315
|
+
const currentFocusedNodeIndex = (_activeDescendantRef$2 = activeDescendantRef.current) === null || _activeDescendantRef$2 === void 0 ? void 0 : _activeDescendantRef$2.index;
|
|
2296
2316
|
if (currentFocusedNodeIndex === filteredOptionsRef.current.length - 1) {
|
|
2297
2317
|
focusInput();
|
|
2298
2318
|
} else if (currentFocusedNodeIndex === undefined) {
|
|
@@ -2313,7 +2333,8 @@ isDisabled) {
|
|
|
2313
2333
|
if (!isOpen) {
|
|
2314
2334
|
openFlyoutAndFocus(focusPrevious.name);
|
|
2315
2335
|
} else {
|
|
2316
|
-
|
|
2336
|
+
var _activeDescendantRef$3;
|
|
2337
|
+
const currentFocusedNodeIndex = (_activeDescendantRef$3 = activeDescendantRef.current) === null || _activeDescendantRef$3 === void 0 ? void 0 : _activeDescendantRef$3.index;
|
|
2317
2338
|
if (currentFocusedNodeIndex === 0) {
|
|
2318
2339
|
focusInput();
|
|
2319
2340
|
} else if (currentFocusedNodeIndex === undefined) {
|
|
@@ -2400,13 +2421,13 @@ isDisabled) {
|
|
|
2400
2421
|
focusLast,
|
|
2401
2422
|
focusNext,
|
|
2402
2423
|
focusPrevious,
|
|
2403
|
-
activeDescendantElement: activeDescendant
|
|
2424
|
+
activeDescendantElement: activeDescendant === null || activeDescendant === void 0 ? void 0 : activeDescendant.element,
|
|
2404
2425
|
filteredOptionsRef
|
|
2405
2426
|
};
|
|
2406
2427
|
}
|
|
2407
2428
|
function logNoOptionsToFocusError(functionName) {
|
|
2408
2429
|
// eslint-disable-next-line no-console
|
|
2409
|
-
console.error(
|
|
2430
|
+
console.error("[".concat(useComboboxFocusSequence.name, "] Invalid call to '").concat(functionName, "'. There are no registered nodes to focus."));
|
|
2410
2431
|
}
|
|
2411
2432
|
|
|
2412
2433
|
/**
|
|
@@ -2493,7 +2514,7 @@ function useComboboxLoadingState(isLoading, isComponentFocused, activeDescendant
|
|
|
2493
2514
|
*/
|
|
2494
2515
|
function useComboboxValue(initialInputValue, externalInputValue, externalOnChange) {
|
|
2495
2516
|
// This is the `value` of the `input` element (what is displayed to the user)
|
|
2496
|
-
const [rawInputValue, setRawInputValue] = React.useState(externalInputValue
|
|
2517
|
+
const [rawInputValue, setRawInputValue] = React.useState(externalInputValue !== null && externalInputValue !== void 0 ? externalInputValue : initialInputValue);
|
|
2497
2518
|
|
|
2498
2519
|
// The `value` of the `input` element will become this value by the time the `input` element is blurred
|
|
2499
2520
|
const [committedInputValue, setCommittedInputValue_DO_NOT_USE // A setter is created below so that the raw input value is also updated
|
|
@@ -2529,9 +2550,10 @@ function getFlyoutDimensions(anchorDimensions) {
|
|
|
2529
2550
|
* @returns A CSS style object containing styles to properly size the flyout.
|
|
2530
2551
|
*/
|
|
2531
2552
|
function useListboxFlyoutDimensions(anchorElement) {
|
|
2553
|
+
var _anchorElement$offset, _anchorElement$offset2;
|
|
2532
2554
|
const [anchorDimensions, setAnchorDimensions] = React.useState({
|
|
2533
|
-
width: anchorElement
|
|
2534
|
-
height: anchorElement
|
|
2555
|
+
width: (_anchorElement$offset = anchorElement === null || anchorElement === void 0 ? void 0 : anchorElement.offsetWidth) !== null && _anchorElement$offset !== void 0 ? _anchorElement$offset : 0,
|
|
2556
|
+
height: (_anchorElement$offset2 = anchorElement === null || anchorElement === void 0 ? void 0 : anchorElement.offsetHeight) !== null && _anchorElement$offset2 !== void 0 ? _anchorElement$offset2 : 18
|
|
2535
2557
|
});
|
|
2536
2558
|
const [flyoutDimensions, setFlyoutDimensions] = React.useState(getFlyoutDimensions(anchorDimensions));
|
|
2537
2559
|
|
|
@@ -2569,8 +2591,9 @@ function useSelectedOptionScroll(isOpen, activeDescendantElement, optionsRef, fl
|
|
|
2569
2591
|
// Scrolls to the selected option if the selected option is out of view
|
|
2570
2592
|
React.useEffect(() => {
|
|
2571
2593
|
if (isOpen && activeDescendantElement && flyoutRef.current) {
|
|
2594
|
+
var _optionsRef$current;
|
|
2572
2595
|
const flyoutContainerElement = flyoutRef.current;
|
|
2573
|
-
if (activeDescendantElement === optionsRef.current
|
|
2596
|
+
if (activeDescendantElement === ((_optionsRef$current = optionsRef.current) === null || _optionsRef$current === void 0 ? void 0 : _optionsRef$current[0])) {
|
|
2574
2597
|
// Scrolls the first header into view if one exists
|
|
2575
2598
|
flyoutContainerElement.scrollTop = 0;
|
|
2576
2599
|
} else if (flyoutContainerElement.scrollHeight > flyoutContainerElement.clientHeight) {
|
|
@@ -2597,7 +2620,8 @@ function useShouldRenderGroupHeader(filteredOptionsRef, committedInputValue) {
|
|
|
2597
2620
|
|
|
2598
2621
|
// Should render the header if the group includes at least one filtered option
|
|
2599
2622
|
React.useEffect(() => {
|
|
2600
|
-
|
|
2623
|
+
var _filteredOptionsRef$c;
|
|
2624
|
+
if (((_filteredOptionsRef$c = filteredOptionsRef.current) === null || _filteredOptionsRef$c === void 0 ? void 0 : _filteredOptionsRef$c.length) === 0) {
|
|
2601
2625
|
setShouldRenderHeader(false);
|
|
2602
2626
|
} else {
|
|
2603
2627
|
setShouldRenderHeader(true);
|
|
@@ -2682,9 +2706,9 @@ function Combobox(_ref) {
|
|
|
2682
2706
|
}, children);
|
|
2683
2707
|
}
|
|
2684
2708
|
|
|
2685
|
-
var css_248z$7 = ".
|
|
2686
|
-
var styles$7 = {"loadingSpinner":"
|
|
2687
|
-
var stylesheet$7=".
|
|
2709
|
+
var css_248z$7 = "._xq0A3 :after{background-color:#515559!important}._5aqVK>input:focus{box-shadow:none!important;border:1px solid #898989!important}._N4RtS{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}._N4RtS ._-TygD ._WCjrf{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}._N4RtS ._-TygD:first-child ._kr1f5{display:none}._N4RtS ._eSWAu{display:flex;align-items:center;min-height:40px;padding:10px 12px;font-size:14px;color:#32363a;word-break:break-word;outline:none;cursor:pointer}._N4RtS ._eSWAu:hover{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._N4RtS ._eSWAu:hover._PQ7bi{background-color:#e4effa}._N4RtS ._eSWAu._PQ7bi{background-color:#ebf3fb;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._N4RtS ._eSWAu:active:not(._PQ7bi){background-color:#e8e9e9}";
|
|
2710
|
+
var styles$7 = {"loadingSpinner":"_xq0A3","ignoreFocusStyle":"_5aqVK","flyout":"_N4RtS","group":"_-TygD","header":"_WCjrf","divider":"_kr1f5","option":"_eSWAu","selected":"_PQ7bi"};
|
|
2711
|
+
var stylesheet$7="._xq0A3 :after{background-color:#515559!important}._5aqVK>input:focus{box-shadow:none!important;border:1px solid #898989!important}._N4RtS{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}._N4RtS ._-TygD ._WCjrf{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}._N4RtS ._-TygD:first-child ._kr1f5{display:none}._N4RtS ._eSWAu{display:flex;align-items:center;min-height:40px;padding:10px 12px;font-size:14px;color:#32363a;word-break:break-word;outline:none;cursor:pointer}._N4RtS ._eSWAu:hover{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._N4RtS ._eSWAu:hover._PQ7bi{background-color:#e4effa}._N4RtS ._eSWAu._PQ7bi{background-color:#ebf3fb;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._N4RtS ._eSWAu:active:not(._PQ7bi){background-color:#e8e9e9}";
|
|
2688
2712
|
icons_index.styleInject(css_248z$7);
|
|
2689
2713
|
|
|
2690
2714
|
const ComboboxInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
@@ -2816,8 +2840,8 @@ const ComboboxInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
2816
2840
|
onBlur: () => {
|
|
2817
2841
|
commitCurrentRawInputValueAndCloseFlyout();
|
|
2818
2842
|
},
|
|
2819
|
-
"aria-label": ariaLabel
|
|
2820
|
-
"aria-labelledby": ariaLabelledBy
|
|
2843
|
+
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : rootAriaLabel,
|
|
2844
|
+
"aria-labelledby": ariaLabelledBy !== null && ariaLabelledBy !== void 0 ? ariaLabelledBy : rootAriaLabelledBy,
|
|
2821
2845
|
"aria-describedby": ariaDescribedBy,
|
|
2822
2846
|
"data-testid": index.getSubDataTestId(rootDataTestId, 'input'),
|
|
2823
2847
|
"aria-expanded": isOpen,
|
|
@@ -2861,8 +2885,8 @@ const ComboboxFlyout = _ref => {
|
|
|
2861
2885
|
id: flyoutId,
|
|
2862
2886
|
className: styles$7.flyout,
|
|
2863
2887
|
style: flyoutDimensions,
|
|
2864
|
-
"aria-label": ariaLabel
|
|
2865
|
-
"aria-labelledby": ariaLabelledBy
|
|
2888
|
+
"aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : rootAriaLabel,
|
|
2889
|
+
"aria-labelledby": ariaLabelledBy !== null && ariaLabelledBy !== void 0 ? ariaLabelledBy : rootAriaLabelledBy,
|
|
2866
2890
|
"aria-describedby": ariaDescribedBy,
|
|
2867
2891
|
"data-testid": index.getSubDataTestId(rootDataTestId, 'flyout'),
|
|
2868
2892
|
ref: flyoutRef
|
|
@@ -2914,7 +2938,7 @@ function ComboboxGroup(_ref) {
|
|
|
2914
2938
|
className: styles$7.group,
|
|
2915
2939
|
"aria-labelledby": headerElementId,
|
|
2916
2940
|
"aria-describedby": ariaDescribedBy,
|
|
2917
|
-
"data-testid": index.getSubDataTestId(rootDataTestId,
|
|
2941
|
+
"data-testid": index.getSubDataTestId(rootDataTestId, "group-".concat(label))
|
|
2918
2942
|
}, /*#__PURE__*/React__default["default"].createElement(index.Divider, {
|
|
2919
2943
|
className: styles$7.divider
|
|
2920
2944
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -2985,14 +3009,14 @@ function ComboboxOption(_ref) {
|
|
|
2985
3009
|
onMouseDown: e => e.preventDefault() // Prevents the input from getting blurred
|
|
2986
3010
|
,
|
|
2987
3011
|
"aria-selected": isOptionSelected,
|
|
2988
|
-
"data-testid": index.getSubDataTestId(rootDataTestId,
|
|
3012
|
+
"data-testid": index.getSubDataTestId(rootDataTestId, "option-".concat(label)),
|
|
2989
3013
|
ref: containerElementRef
|
|
2990
3014
|
}, label);
|
|
2991
3015
|
}
|
|
2992
3016
|
|
|
2993
|
-
var css_248z$6 = ".
|
|
2994
|
-
var styles$6 = {"container":"
|
|
2995
|
-
var stylesheet$6=".
|
|
3017
|
+
var css_248z$6 = "._B6seV{display:flex}._pqoB0{z-index:2;width:1px;margin-left:-1px;margin-right:-1px}._pqoB0._UBkiu{background-color:#fff}._pqoB0._3U-X7,._pqoB0._UBkiu._0hH1c:not(._pqoB0._UBkiu._MbRy5),._pqoB0._UBkiu._4gcxR.focus-visible:not(._4ZzAQ),._pqoB0._UBkiu._4gcxR:focus-visible:not(._4ZzAQ){background-color:#0b6ed0}._pqoB0._3U-X7._4ZzAQ._4gcxR,._pqoB0._3U-X7._4ZzAQ._MbRy5,._pqoB0._3U-X7._MbRy5._0hH1c{opacity:.4}._7rzyU{border-radius:4px 0 0 4px;border-right:none;padding-right:17px}._7rzyU:focus{z-index:1}._Mn5Se{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}._Mn5Se svg{margin-left:1px}._Mn5Se._UBkiu{background-color:#0b6ed0;border-color:transparent}._Mn5Se._UBkiu svg{fill:#fff!important}._Mn5Se._UBkiu:not(._HDAla):hover{background-color:#085caf!important}._Mn5Se._UBkiu:not(._HDAla):active{background-color:#0854a1!important}._Mn5Se._UBkiu._HDAla{opacity:.4}._Mn5Se._UBkiu._HDAla svg{background-color:transparent}._Mn5Se._3U-X7{border-color:#0b6ed0;background-color:#fff}._Mn5Se._3U-X7 svg{fill:#0b6ed0!important}._Mn5Se._3U-X7:not(._HDAla):hover{background-color:#eef5fc!important}._Mn5Se._3U-X7:not(._HDAla):active{background-color:#e1edf9!important}._Mn5Se._3U-X7._HDAla{opacity:.4}._Mn5Se._3U-X7._HDAla svg{background-color:transparent}._ehPYJ{width:260px}";
|
|
3018
|
+
var styles$6 = {"container":"_B6seV","divider":"_pqoB0","primary":"_UBkiu","mainButtonFocus":"_4gcxR","mainButtonDisabled":"_4ZzAQ","dropdownButtonFocus":"_0hH1c","dropdownButtonDisabled":"_MbRy5","secondary":"_3U-X7","mainButton":"_7rzyU","dropdownButton":"_Mn5Se","disabled":"_HDAla","dropdownOption":"_ehPYJ"};
|
|
3019
|
+
var stylesheet$6="._B6seV{display:flex}._pqoB0{z-index:2;width:1px;margin-left:-1px;margin-right:-1px}._pqoB0._UBkiu{background-color:#fff}._pqoB0._3U-X7,._pqoB0._UBkiu._0hH1c:not(._pqoB0._UBkiu._MbRy5),._pqoB0._UBkiu._4gcxR.focus-visible:not(._4ZzAQ),._pqoB0._UBkiu._4gcxR:focus-visible:not(._4ZzAQ){background-color:#0b6ed0}._pqoB0._3U-X7._4ZzAQ._4gcxR,._pqoB0._3U-X7._4ZzAQ._MbRy5,._pqoB0._3U-X7._MbRy5._0hH1c{opacity:.4}._7rzyU{border-radius:4px 0 0 4px;border-right:none;padding-right:17px}._7rzyU:focus{z-index:1}._Mn5Se{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}._Mn5Se svg{margin-left:1px}._Mn5Se._UBkiu{background-color:#0b6ed0;border-color:transparent}._Mn5Se._UBkiu svg{fill:#fff!important}._Mn5Se._UBkiu:not(._HDAla):hover{background-color:#085caf!important}._Mn5Se._UBkiu:not(._HDAla):active{background-color:#0854a1!important}._Mn5Se._UBkiu._HDAla{opacity:.4}._Mn5Se._UBkiu._HDAla svg{background-color:transparent}._Mn5Se._3U-X7{border-color:#0b6ed0;background-color:#fff}._Mn5Se._3U-X7 svg{fill:#0b6ed0!important}._Mn5Se._3U-X7:not(._HDAla):hover{background-color:#eef5fc!important}._Mn5Se._3U-X7:not(._HDAla):active{background-color:#e1edf9!important}._Mn5Se._3U-X7._HDAla{opacity:.4}._Mn5Se._3U-X7._HDAla svg{background-color:transparent}._ehPYJ{width:260px}";
|
|
2996
3020
|
icons_index.styleInject(css_248z$6);
|
|
2997
3021
|
|
|
2998
3022
|
const SplitButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
@@ -3016,8 +3040,14 @@ const SplitButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
3016
3040
|
const [mainButtonHasFocus, setMainButtonHasFocus] = React.useState(false);
|
|
3017
3041
|
|
|
3018
3042
|
// 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.
|
|
3019
|
-
index.useEventListener(mainButtonRef, 'keydown', e =>
|
|
3020
|
-
|
|
3043
|
+
index.useEventListener(mainButtonRef, 'keydown', e => {
|
|
3044
|
+
var _dropdownButtonRef$cu;
|
|
3045
|
+
return e.key === 'ArrowRight' && ((_dropdownButtonRef$cu = dropdownButtonRef.current) === null || _dropdownButtonRef$cu === void 0 ? void 0 : _dropdownButtonRef$cu.focus());
|
|
3046
|
+
});
|
|
3047
|
+
index.useEventListener(dropdownButtonRef, 'keydown', e => {
|
|
3048
|
+
var _mainButtonRef$curren;
|
|
3049
|
+
return e.key === 'ArrowLeft' && ((_mainButtonRef$curren = mainButtonRef.current) === null || _mainButtonRef$curren === void 0 ? void 0 : _mainButtonRef$curren.focus());
|
|
3050
|
+
});
|
|
3021
3051
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3022
3052
|
"data-testid": dataTestId,
|
|
3023
3053
|
className: classNames__default["default"](styles$6.container, className),
|
|
@@ -3086,9 +3116,9 @@ const SplitButtonOption = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
3086
3116
|
}, children);
|
|
3087
3117
|
});
|
|
3088
3118
|
|
|
3089
|
-
var css_248z$5 = ".
|
|
3090
|
-
var styles$5 = {"button":"
|
|
3091
|
-
var stylesheet$5=".
|
|
3119
|
+
var css_248z$5 = "._hd5Op{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}._hd5Op:hover:not(._bwYzJ){background-color:rgba(50,54,58,.08)}._hd5Op:hover:not(._bwYzJ)._pbRsW{border-color:#085caf;background-color:rgba(11,110,208,.04)}._hd5Op:hover:not(._bwYzJ)._pbRsW ._6K2iq{color:#32363a}._hd5Op:hover:not(._bwYzJ)._pbRsW ._ymGAJ{fill:#32363a}._hd5Op:hover:not(._bwYzJ)._pbRsW ._rrUXQ{fill:#085caf}._hd5Op:hover:not(._bwYzJ)._pbRsW ._cf46Y{background-color:rgba(11,110,208,.11)}._hd5Op:hover:not(._bwYzJ)._pbRsW ._cf46Y ._0oWI8{color:#085caf}._hd5Op:active:not(._bwYzJ){background-color:#e8e9e9}._hd5Op:active:not(._bwYzJ)._pbRsW{background-color:rgba(11,110,208,.11);border-color:#0854a1}._hd5Op:active:not(._bwYzJ)._pbRsW ._rrUXQ{fill:#0854a1}._hd5Op:active:not(._bwYzJ)._pbRsW ._cf46Y{background-color:rgba(11,110,208,.11)}._hd5Op:active:not(._bwYzJ)._pbRsW ._cf46Y ._0oWI8{color:#0854a1}._hd5Op._bwYzJ{background-color:#fafafa;border-color:#e5e5e5;cursor:not-allowed}._hd5Op._pbRsW{border-color:#0b6ed0}._ymGAJ{fill:#515559;margin-right:4px}._6K2iq{max-width:180px;margin-right:3px;color:#515559;fill:#515559;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._6K2iq+._cf46Y{margin-left:6px}._6K2iq._bwYzJ{color:#74777a}._cf46Y{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}._0oWI8{color:#0b6ed0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._rrUXQ{fill:#515559}._rrUXQ._bwYzJ,._rrUXQ._bwYzJ._pbRsW{fill:rgba(116,119,122,.4)}._rrUXQ._pbRsW{fill:#0b6ed0}._rrUXQ._rcyO1{transform:rotate(-180deg)}._hd5Op.focus-visible,._hd5Op:focus-visible{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
3120
|
+
var styles$5 = {"button":"_hd5Op","disabled":"_bwYzJ","selected":"_pbRsW","label":"_6K2iq","lockIcon":"_ymGAJ","chevronIcon":"_rrUXQ","selectedFiltersContainer":"_cf46Y","selectedFilters":"_0oWI8","open":"_rcyO1"};
|
|
3121
|
+
var stylesheet$5="._hd5Op{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}._hd5Op:hover:not(._bwYzJ){background-color:rgba(50,54,58,.08)}._hd5Op:hover:not(._bwYzJ)._pbRsW{border-color:#085caf;background-color:rgba(11,110,208,.04)}._hd5Op:hover:not(._bwYzJ)._pbRsW ._6K2iq{color:#32363a}._hd5Op:hover:not(._bwYzJ)._pbRsW ._ymGAJ{fill:#32363a}._hd5Op:hover:not(._bwYzJ)._pbRsW ._rrUXQ{fill:#085caf}._hd5Op:hover:not(._bwYzJ)._pbRsW ._cf46Y{background-color:rgba(11,110,208,.11)}._hd5Op:hover:not(._bwYzJ)._pbRsW ._cf46Y ._0oWI8{color:#085caf}._hd5Op:active:not(._bwYzJ){background-color:#e8e9e9}._hd5Op:active:not(._bwYzJ)._pbRsW{background-color:rgba(11,110,208,.11);border-color:#0854a1}._hd5Op:active:not(._bwYzJ)._pbRsW ._rrUXQ{fill:#0854a1}._hd5Op:active:not(._bwYzJ)._pbRsW ._cf46Y{background-color:rgba(11,110,208,.11)}._hd5Op:active:not(._bwYzJ)._pbRsW ._cf46Y ._0oWI8{color:#0854a1}._hd5Op._bwYzJ{background-color:#fafafa;border-color:#e5e5e5;cursor:not-allowed}._hd5Op._pbRsW{border-color:#0b6ed0}._ymGAJ{fill:#515559;margin-right:4px}._6K2iq{max-width:180px;margin-right:3px;color:#515559;fill:#515559;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._6K2iq+._cf46Y{margin-left:6px}._6K2iq._bwYzJ{color:#74777a}._cf46Y{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}._0oWI8{color:#0b6ed0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._rrUXQ{fill:#515559}._rrUXQ._bwYzJ,._rrUXQ._bwYzJ._pbRsW{fill:rgba(116,119,122,.4)}._rrUXQ._pbRsW{fill:#0b6ed0}._rrUXQ._rcyO1{transform:rotate(-180deg)}._hd5Op.focus-visible,._hd5Op:focus-visible{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
3092
3122
|
icons_index.styleInject(css_248z$5);
|
|
3093
3123
|
|
|
3094
3124
|
const FilterAnchor = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
@@ -3122,14 +3152,14 @@ const FilterAnchor = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
3122
3152
|
if (isDisabled) {
|
|
3123
3153
|
e.stopPropagation(); // Prevents "click" events from occurring on parent elements
|
|
3124
3154
|
} else {
|
|
3125
|
-
onClick
|
|
3155
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
3126
3156
|
}
|
|
3127
3157
|
},
|
|
3128
3158
|
onKeyDown: e => {
|
|
3129
3159
|
if (isDisabled) {
|
|
3130
3160
|
e.stopPropagation(); // Prevents "keydown" events from occurring on parent elements
|
|
3131
3161
|
} else {
|
|
3132
|
-
onKeyDown
|
|
3162
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
|
|
3133
3163
|
}
|
|
3134
3164
|
},
|
|
3135
3165
|
disabled: undefined // This component uses aria-disabled instead of disabled
|
|
@@ -3156,7 +3186,7 @@ const FilterAnchor = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
3156
3186
|
}, label)), isLoading ? /*#__PURE__*/React__default["default"].createElement(index.LoadingSpinner, {
|
|
3157
3187
|
show: true,
|
|
3158
3188
|
size: "xs",
|
|
3159
|
-
"aria-label": loadingSpinnerAriaLabel
|
|
3189
|
+
"aria-label": loadingSpinnerAriaLabel !== null && loadingSpinnerAriaLabel !== void 0 ? loadingSpinnerAriaLabel : translate('loading')
|
|
3160
3190
|
}) : selectedFilters && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3161
3191
|
className: styles$5.selectedFiltersContainer
|
|
3162
3192
|
}, /*#__PURE__*/React__default["default"].createElement(index.TextOverflowTooltip, {
|
|
@@ -3210,6 +3240,7 @@ const usePaneContext = childItemRef => {
|
|
|
3210
3240
|
|
|
3211
3241
|
/* eslint-disable max-classes-per-file */
|
|
3212
3242
|
const Menu = _ref => {
|
|
3243
|
+
var _process$env;
|
|
3213
3244
|
let {
|
|
3214
3245
|
'data-testid': dataTestId,
|
|
3215
3246
|
isOpen,
|
|
@@ -3217,9 +3248,10 @@ const Menu = _ref => {
|
|
|
3217
3248
|
isDisabled,
|
|
3218
3249
|
children
|
|
3219
3250
|
} = _ref;
|
|
3220
|
-
if (typeof process !== 'undefined' && process.env
|
|
3221
|
-
|
|
3222
|
-
window.
|
|
3251
|
+
if (typeof process !== 'undefined' && ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.NODE_ENV) === 'test' && window) {
|
|
3252
|
+
var _window$ResizeObserve, _window$PointerEvent;
|
|
3253
|
+
window.ResizeObserver = (_window$ResizeObserve = window.ResizeObserver) !== null && _window$ResizeObserve !== void 0 ? _window$ResizeObserve : ResizeObserver;
|
|
3254
|
+
window.PointerEvent = (_window$PointerEvent = window.PointerEvent) !== null && _window$PointerEvent !== void 0 ? _window$PointerEvent : PointerEvent;
|
|
3223
3255
|
}
|
|
3224
3256
|
const [open, setOpen] = index.useControllableState(isOpen, onIsOpenChange, isOpen);
|
|
3225
3257
|
const [maskHeight, setMaskHeight] = React.useState(null);
|
|
@@ -3237,6 +3269,7 @@ const Menu = _ref => {
|
|
|
3237
3269
|
});
|
|
3238
3270
|
};
|
|
3239
3271
|
const openPaneDepth = React.useMemo(() => open ? submenus.size + 1 : 0, [submenus, open]);
|
|
3272
|
+
const [searchBarConfigs, setSearchBarConfigs] = React.useState([]);
|
|
3240
3273
|
return /*#__PURE__*/React__default["default"].createElement(MenuContextProvider, {
|
|
3241
3274
|
value: {
|
|
3242
3275
|
dataTestId,
|
|
@@ -3246,11 +3279,14 @@ const Menu = _ref => {
|
|
|
3246
3279
|
maskHeight,
|
|
3247
3280
|
setMaskHeight,
|
|
3248
3281
|
open,
|
|
3249
|
-
triggerRef
|
|
3282
|
+
triggerRef,
|
|
3283
|
+
searchBarConfigs,
|
|
3284
|
+
setSearchBarConfigs
|
|
3250
3285
|
}
|
|
3251
3286
|
}, /*#__PURE__*/React__default["default"].createElement(reactDropdownMenu.Root, {
|
|
3252
3287
|
open: open,
|
|
3253
|
-
onOpenChange: shouldOpen => setOpen(!isDisabled && shouldOpen)
|
|
3288
|
+
onOpenChange: shouldOpen => setOpen(!isDisabled && shouldOpen),
|
|
3289
|
+
modal: false
|
|
3254
3290
|
}, children));
|
|
3255
3291
|
};
|
|
3256
3292
|
|
|
@@ -3285,9 +3321,9 @@ class PointerEvent extends Event {
|
|
|
3285
3321
|
}
|
|
3286
3322
|
}
|
|
3287
3323
|
|
|
3288
|
-
var css_248z$4 = ".
|
|
3289
|
-
var styles$4 = {"buttonContainer":"
|
|
3290
|
-
var stylesheet$4=".
|
|
3324
|
+
var css_248z$4 = "._Ub19k{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._Ub19k>._4Ha8W{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}._Ub19k>._4Ha8W:hover:not([aria-disabled=true]){background-color:#f5f5f5}._Ub19k>._4Ha8W.focus-visible,._Ub19k>._4Ha8W:focus-visible{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._Ub19k>._4Ha8W+._JyDqK{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._Ub19k>._4Ha8W[data-state=open]+._JyDqK{transform:rotate(-180deg) translateY(50%)}._Ub19k>._4Ha8W[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._Ub19k>._4Ha8W[aria-disabled=true]+._JyDqK{fill:#515559;opacity:.4}._rWG1C>[data-radix-popper-content-wrapper]{overflow:hidden;background-color:#fff;width:var(--radix-dropdown-menu-trigger-width);min-width:200px!important;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);border-radius:4px;z-index:1!important}._rWG1C>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._FgUgU{margin:0;padding:4px 0;background:#fff;transition:.35s;opacity:1;overflow:auto;width:var(--radix-dropdown-menu-trigger-width);min-width:200px;max-height:350px}._FgUgU._1V3KV{margin-left:30px;opacity:0}._FgUgU._3jwFU{margin-left:-30px}._6Eaw4{position:relative;padding:10px 12px;min-height:40px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;word-break:break-word;font-size:14px;color:#32363a;width:100%}._6Eaw4._96pWW{cursor:unset}._6Eaw4 ._EF6gu{fill:#32363a;margin-right:4px}._6Eaw4:focus,._6Eaw4:hover{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._6Eaw4[aria-disabled=true]{cursor:not-allowed;opacity:.65}._6Eaw4._l5dhb{padding-right:32px}._6Eaw4._l5dhb ._JyDqK{position:absolute;height:100%;right:3px;fill:#515559}._6Eaw4._6Ukt4{pointer-events:none}._60fcN{position:-webkit-sticky;position:sticky;top:0;background-color:#fff;z-index:1;border-bottom:1px solid #e8e8e8}._60fcN._UyKRl{padding-top:49px}._ebned{z-index:1;pointer-events:none;position:fixed;left:0;top:0}._L6fLA{position:absolute;background-color:#fff;padding:8px;border-radius:4px 4px 0 0;pointer-events:auto;overflow:hidden;opacity:1;transition:opacity .35s}._L6fLA._3jwFU{opacity:0}._L6fLA._3jwFU>._4vs8I{margin-left:-30px}._L6fLA._1V3KV{opacity:0}._L6fLA._1V3KV>._4vs8I{margin-left:30px}._L6fLA>._4vs8I{transition:margin-left .35s;width:100%}._L6fLA._6Ukt4{pointer-events:none}body.keyboard-user ._6Eaw4:hover:not(:focus){background-color:#fff;box-shadow:none}";
|
|
3325
|
+
var styles$4 = {"buttonContainer":"_Ub19k","button":"_4Ha8W","rightIcon":"_JyDqK","maskContainer":"_rWG1C","flyout":"_FgUgU","animatedRight":"_1V3KV","animatedLeft":"_3jwFU","menuItem":"_6Eaw4","noItems":"_96pWW","backIcon":"_EF6gu","subMenu":"_l5dhb","unresponsive":"_6Ukt4","stickyBox":"_60fcN","isSearchable":"_UyKRl","searchBoxesContainer":"_ebned","searchBox":"_L6fLA","searchInput":"_4vs8I"};
|
|
3326
|
+
var stylesheet$4="._Ub19k{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._Ub19k>._4Ha8W{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}._Ub19k>._4Ha8W:hover:not([aria-disabled=true]){background-color:#f5f5f5}._Ub19k>._4Ha8W.focus-visible,._Ub19k>._4Ha8W:focus-visible{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._Ub19k>._4Ha8W+._JyDqK{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._Ub19k>._4Ha8W[data-state=open]+._JyDqK{transform:rotate(-180deg) translateY(50%)}._Ub19k>._4Ha8W[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._Ub19k>._4Ha8W[aria-disabled=true]+._JyDqK{fill:#515559;opacity:.4}._rWG1C>[data-radix-popper-content-wrapper]{overflow:hidden;background-color:#fff;width:var(--radix-dropdown-menu-trigger-width);min-width:200px!important;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);border-radius:4px;z-index:1!important}._rWG1C>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._FgUgU{margin:0;padding:4px 0;background:#fff;transition:.35s;opacity:1;overflow:auto;width:var(--radix-dropdown-menu-trigger-width);min-width:200px;max-height:350px}._FgUgU._1V3KV{margin-left:30px;opacity:0}._FgUgU._3jwFU{margin-left:-30px}._6Eaw4{position:relative;padding:10px 12px;min-height:40px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;word-break:break-word;font-size:14px;color:#32363a;width:100%}._6Eaw4._96pWW{cursor:unset}._6Eaw4 ._EF6gu{fill:#32363a;margin-right:4px}._6Eaw4:focus,._6Eaw4:hover{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._6Eaw4[aria-disabled=true]{cursor:not-allowed;opacity:.65}._6Eaw4._l5dhb{padding-right:32px}._6Eaw4._l5dhb ._JyDqK{position:absolute;height:100%;right:3px;fill:#515559}._6Eaw4._6Ukt4{pointer-events:none}._60fcN{position:-webkit-sticky;position:sticky;top:0;background-color:#fff;z-index:1;border-bottom:1px solid #e8e8e8}._60fcN._UyKRl{padding-top:49px}._ebned{z-index:1;pointer-events:none;position:fixed;left:0;top:0}._L6fLA{position:absolute;background-color:#fff;padding:8px;border-radius:4px 4px 0 0;pointer-events:auto;overflow:hidden;opacity:1;transition:opacity .35s}._L6fLA._3jwFU{opacity:0}._L6fLA._3jwFU>._4vs8I{margin-left:-30px}._L6fLA._1V3KV{opacity:0}._L6fLA._1V3KV>._4vs8I{margin-left:30px}._L6fLA>._4vs8I{transition:margin-left .35s;width:100%}._L6fLA._6Ukt4{pointer-events:none}body.keyboard-user ._6Eaw4:hover:not(:focus){background-color:#fff;box-shadow:none}";
|
|
3291
3327
|
icons_index.styleInject(css_248z$4);
|
|
3292
3328
|
|
|
3293
3329
|
/* eslint-disable import/prefer-default-export */
|
|
@@ -3301,7 +3337,11 @@ const DATA_TESTID_SUFFIXES = {
|
|
|
3301
3337
|
const KEYS = {
|
|
3302
3338
|
OPEN_SUBMENU: ['ArrowRight', 'Enter', ' '],
|
|
3303
3339
|
CLOSE_SUBMENU: ['ArrowLeft'],
|
|
3304
|
-
|
|
3340
|
+
NAVIGATE_UP: ['ArrowUp'],
|
|
3341
|
+
NAVIGATE_DOWN: ['ArrowDown'],
|
|
3342
|
+
NAVIGATE_TOP: ['Home'],
|
|
3343
|
+
NAVIIGATE_BOTTOM: ['End'],
|
|
3344
|
+
IGNORED_BY_SEARCH_INPUT: ['Tab']
|
|
3305
3345
|
};
|
|
3306
3346
|
|
|
3307
3347
|
const AsChildWrapper = _ref => {
|
|
@@ -3343,98 +3383,229 @@ const MenuButton = /*#__PURE__*/React__default["default"].forwardRef((_ref2, ref
|
|
|
3343
3383
|
|
|
3344
3384
|
const MenuSearch = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
3345
3385
|
let {
|
|
3346
|
-
setSearchValue
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
const {
|
|
3351
|
-
translate
|
|
3352
|
-
} = index.useTranslation();
|
|
3353
|
-
const searchText = translate('searchText');
|
|
3354
|
-
const {
|
|
3355
|
-
dataTestId: menuParentDataTestId,
|
|
3386
|
+
setSearchValue,
|
|
3387
|
+
animatedLeft,
|
|
3388
|
+
animatedRight,
|
|
3389
|
+
dataTestId,
|
|
3356
3390
|
searchValue = '',
|
|
3357
|
-
isInteractive,
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
const dataTestId = menuParentDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_SEARCH);
|
|
3362
|
-
React.useEffect(() => () => setSearchValue(''), [setSearchValue]);
|
|
3363
|
-
const [previouslyFocusedElement, setPreviouslyFocusedElement] = React.useState();
|
|
3364
|
-
|
|
3365
|
-
// hack to keep focus on search input on mouse leave
|
|
3366
|
-
index.useEventListener(flyoutRef, 'focus', e => {
|
|
3367
|
-
if (e.target === e.currentTarget && previouslyFocusedElement === itemRef.current && isInteractive) {
|
|
3368
|
-
inputRef.current?.focus();
|
|
3369
|
-
}
|
|
3370
|
-
setPreviouslyFocusedElement(e.target);
|
|
3371
|
-
}, {
|
|
3372
|
-
isCaptureEvent: true
|
|
3373
|
-
});
|
|
3374
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(reactDropdownMenu.Item, {
|
|
3391
|
+
isInteractive = false,
|
|
3392
|
+
searchPlaceholder
|
|
3393
|
+
} = _ref;
|
|
3394
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3375
3395
|
className: classNames__default["default"](styles$4.searchBox, {
|
|
3376
|
-
[styles$4.unresponsive]: !isInteractive
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
,
|
|
3380
|
-
|
|
3381
|
-
onFocus: () => inputRef.current?.focus(),
|
|
3382
|
-
role: undefined,
|
|
3383
|
-
ref: index.mergeRefs(itemRef, ref)
|
|
3396
|
+
[styles$4.unresponsive]: !isInteractive,
|
|
3397
|
+
[styles$4.animatedLeft]: animatedLeft,
|
|
3398
|
+
[styles$4.animatedRight]: animatedRight
|
|
3399
|
+
}),
|
|
3400
|
+
ref: ref
|
|
3384
3401
|
}, /*#__PURE__*/React__default["default"].createElement(index.Input$1, {
|
|
3385
3402
|
"data-testid": dataTestId,
|
|
3386
3403
|
role: "searchbox",
|
|
3387
3404
|
value: searchValue,
|
|
3388
3405
|
onChange: e => setSearchValue(e.target.value),
|
|
3389
|
-
placeholder:
|
|
3390
|
-
onKeyDown: e => {
|
|
3391
|
-
var _context, _context2;
|
|
3392
|
-
// stop propagation to prevent typeAhead
|
|
3393
|
-
e.stopPropagation();
|
|
3394
|
-
|
|
3395
|
-
// allow caret movement through text entry, but close searchable submenu if on the very left
|
|
3396
|
-
if (e.target?.selectionStart === 0 && _includesInstanceProperty__default["default"](_context = KEYS.CLOSE_SUBMENU).call(_context, e.key)) {
|
|
3397
|
-
closeSubmenu?.(e);
|
|
3398
|
-
return;
|
|
3399
|
-
}
|
|
3400
|
-
|
|
3401
|
-
// forward keypress directly to `Item` to let Radix handle keyboard navigation
|
|
3402
|
-
if (_includesInstanceProperty__default["default"](_context2 = KEYS.IGNORED_BY_SEARCH_INPUT).call(_context2, e.key)) {
|
|
3403
|
-
// `view` types are incompatible
|
|
3404
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3405
|
-
const {
|
|
3406
|
-
view,
|
|
3407
|
-
...eventClone
|
|
3408
|
-
} = e;
|
|
3409
|
-
itemRef?.current?.dispatchEvent(new KeyboardEvent('keydown', eventClone));
|
|
3410
|
-
}
|
|
3411
|
-
},
|
|
3406
|
+
placeholder: searchPlaceholder,
|
|
3412
3407
|
leftAddOn: /*#__PURE__*/React__default["default"].createElement(icons_index.SearchIcon, null),
|
|
3413
|
-
ref: inputRef,
|
|
3414
3408
|
className: styles$4.searchInput
|
|
3415
|
-
}))
|
|
3409
|
+
}));
|
|
3416
3410
|
});
|
|
3417
3411
|
|
|
3418
3412
|
// abstracts the logic required for searching by both `MenuPane` and `SubMenu`
|
|
3419
|
-
|
|
3413
|
+
// creates a searchBarConfig, which maps to an instance of `MenuSearch`
|
|
3414
|
+
// returns values that are necessary for use within pane
|
|
3415
|
+
function usePaneSearch(isSearchable, externalSearchValue, onSearchValueChange, items, animatedLeft, animatedRight, menuParentDataTestId, id, flyoutRef) {
|
|
3416
|
+
var _searchRef$current$qu, _searchRef$current;
|
|
3417
|
+
let backButtonRef = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : undefined;
|
|
3418
|
+
let closeSubmenu = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : undefined;
|
|
3420
3419
|
const [internalSearchValue, setSearchValue] = index.useControllableState(externalSearchValue, onSearchValueChange, externalSearchValue);
|
|
3421
3420
|
const [zeroSearchResults, setZeroSearchResults] = React.useState();
|
|
3422
3421
|
const {
|
|
3423
3422
|
translate
|
|
3424
3423
|
} = index.useTranslation();
|
|
3425
3424
|
const noMatchesText = translate('menu.noItemsToDisplay');
|
|
3425
|
+
const searchPlaceholder = translate('searchText');
|
|
3426
|
+
React.useEffect(() => setZeroSearchResults((items === null || items === void 0 ? void 0 : items.filter(item => item.element.current).length) === 0), [items, internalSearchValue]);
|
|
3427
|
+
const {
|
|
3428
|
+
isFocusVisible
|
|
3429
|
+
} = interactions.useFocusVisible({
|
|
3430
|
+
isTextInput: true
|
|
3431
|
+
});
|
|
3432
|
+
const searchRef = React.useRef(null);
|
|
3433
|
+
const searchInput = (_searchRef$current$qu = (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : _searchRef$current.querySelector('input')) !== null && _searchRef$current$qu !== void 0 ? _searchRef$current$qu : null;
|
|
3434
|
+
const getFirstNonNullItem = () => {
|
|
3435
|
+
var _backButtonRef$curren, _items$find;
|
|
3436
|
+
return (_backButtonRef$curren = backButtonRef === null || backButtonRef === void 0 ? void 0 : backButtonRef.current) !== null && _backButtonRef$curren !== void 0 ? _backButtonRef$curren : (_items$find = items.find(item => item.element.current)) === null || _items$find === void 0 ? void 0 : _items$find.element.current;
|
|
3437
|
+
};
|
|
3438
|
+
const getLastNonNullItem = () => {
|
|
3439
|
+
var _findLast$element$cur, _findLast;
|
|
3440
|
+
return (// our tsconfig does not target a recent enough version to use `Array.prototype.findLast`
|
|
3441
|
+
(_findLast$element$cur = (_findLast = items.findLast(item => item.element.current)) === null || _findLast === void 0 ? void 0 : _findLast.element.current) !== null && _findLast$element$cur !== void 0 ? _findLast$element$cur : backButtonRef === null || backButtonRef === void 0 ? void 0 : backButtonRef.current
|
|
3442
|
+
);
|
|
3443
|
+
};
|
|
3444
|
+
index.useEventListener(flyoutRef, 'keydown', e => {
|
|
3445
|
+
var _context, _context2;
|
|
3446
|
+
if (_includesInstanceProperty__default["default"](_context = KEYS.NAVIGATE_UP).call(_context, e.key) && e.target === getFirstNonNullItem() || _includesInstanceProperty__default["default"](_context2 = KEYS.NAVIGATE_DOWN).call(_context2, e.key) && e.target === getLastNonNullItem()) {
|
|
3447
|
+
searchInput === null || searchInput === void 0 ? void 0 : searchInput.focus();
|
|
3448
|
+
}
|
|
3449
|
+
}, {
|
|
3450
|
+
additionalDependencies: [flyoutRef.current],
|
|
3451
|
+
isDisabled: !isSearchable
|
|
3452
|
+
});
|
|
3453
|
+
index.useEventListener(searchInput, 'keydown', e => {
|
|
3454
|
+
var _context3, _context4, _context5, _e$target, _context6;
|
|
3455
|
+
if (_includesInstanceProperty__default["default"](_context3 = [...KEYS.NAVIGATE_DOWN, ...KEYS.NAVIGATE_TOP]).call(_context3, e.key)) {
|
|
3456
|
+
var _getFirstNonNullItem;
|
|
3457
|
+
// prevent scrolling
|
|
3458
|
+
e.preventDefault();
|
|
3459
|
+
(_getFirstNonNullItem = getFirstNonNullItem()) === null || _getFirstNonNullItem === void 0 ? void 0 : _getFirstNonNullItem.focus();
|
|
3460
|
+
} else if (_includesInstanceProperty__default["default"](_context4 = [...KEYS.NAVIGATE_UP, ...KEYS.NAVIIGATE_BOTTOM]).call(_context4, e.key)) {
|
|
3461
|
+
var _getLastNonNullItem;
|
|
3462
|
+
// prevent scrolling
|
|
3463
|
+
e.preventDefault();
|
|
3464
|
+
(_getLastNonNullItem = getLastNonNullItem()) === null || _getLastNonNullItem === void 0 ? void 0 : _getLastNonNullItem.focus();
|
|
3465
|
+
} else if (_includesInstanceProperty__default["default"](_context5 = KEYS.CLOSE_SUBMENU).call(_context5, e.key) && ((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.selectionStart) === 0) {
|
|
3466
|
+
closeSubmenu === null || closeSubmenu === void 0 ? void 0 : closeSubmenu(e);
|
|
3467
|
+
} else if (_includesInstanceProperty__default["default"](_context6 = KEYS.IGNORED_BY_SEARCH_INPUT).call(_context6, e.key)) {
|
|
3468
|
+
e.preventDefault();
|
|
3469
|
+
}
|
|
3470
|
+
});
|
|
3471
|
+
index.useEventListener(searchInput, 'blur', () => !isFocusVisible && !animatedLeft && !animatedRight && (searchInput === null || searchInput === void 0 ? void 0 : searchInput.focus()));
|
|
3472
|
+
const {
|
|
3473
|
+
searchBarConfigs,
|
|
3474
|
+
setSearchBarConfigs
|
|
3475
|
+
} = useMenuContext();
|
|
3476
|
+
const onInteractOutside = React.useCallback(e => searchBarConfigs.some(config => {
|
|
3477
|
+
var _config$ref$current;
|
|
3478
|
+
return (_config$ref$current = config.ref.current) === null || _config$ref$current === void 0 ? void 0 : _config$ref$current.contains(e.target);
|
|
3479
|
+
}) && e.preventDefault(), [searchBarConfigs]);
|
|
3426
3480
|
React.useEffect(() => {
|
|
3427
|
-
|
|
3428
|
-
|
|
3481
|
+
if (!isSearchable) {
|
|
3482
|
+
return undefined;
|
|
3483
|
+
}
|
|
3484
|
+
setSearchBarConfigs(configs => {
|
|
3485
|
+
const configsClone = [...configs];
|
|
3486
|
+
const updatedConfig = {
|
|
3487
|
+
searchValue: internalSearchValue,
|
|
3488
|
+
isInteractive: !animatedLeft && !animatedRight,
|
|
3489
|
+
animatedLeft,
|
|
3490
|
+
animatedRight,
|
|
3491
|
+
dataTestId: menuParentDataTestId === null || menuParentDataTestId === void 0 ? void 0 : menuParentDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_SEARCH),
|
|
3492
|
+
setSearchValue,
|
|
3493
|
+
ref: searchRef,
|
|
3494
|
+
id,
|
|
3495
|
+
searchPlaceholder
|
|
3496
|
+
};
|
|
3497
|
+
const configIndex = configs.findIndex(config => config.id === id);
|
|
3498
|
+
if (configIndex === -1) {
|
|
3499
|
+
configsClone.push(updatedConfig);
|
|
3500
|
+
} else {
|
|
3501
|
+
configsClone[configIndex] = updatedConfig;
|
|
3502
|
+
}
|
|
3503
|
+
return configsClone;
|
|
3504
|
+
});
|
|
3505
|
+
return () => setSearchBarConfigs(configs => {
|
|
3506
|
+
const configIndex = configs.findIndex(config => config.id === id);
|
|
3507
|
+
if (configIndex === -1) {
|
|
3508
|
+
return configs;
|
|
3509
|
+
}
|
|
3510
|
+
const configsClone = [...configs];
|
|
3511
|
+
configsClone.splice(configIndex, 1);
|
|
3512
|
+
return configsClone;
|
|
3513
|
+
});
|
|
3514
|
+
}, [isSearchable, searchPlaceholder, setSearchBarConfigs, internalSearchValue, animatedLeft, animatedRight, menuParentDataTestId, setSearchValue, searchRef, id]);
|
|
3515
|
+
const noSearchResultsNode = zeroSearchResults && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3516
|
+
className: classNames__default["default"](styles$4.menuItem, styles$4.noItems),
|
|
3517
|
+
"aria-live": "assertive"
|
|
3518
|
+
}, noMatchesText);
|
|
3429
3519
|
return {
|
|
3430
3520
|
internalSearchValue,
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
noMatchesText
|
|
3521
|
+
noSearchResultsNode,
|
|
3522
|
+
onInteractOutside
|
|
3434
3523
|
};
|
|
3435
3524
|
}
|
|
3436
3525
|
|
|
3526
|
+
const useMutationObserver = (target, options, onMutate) => React.useEffect(() => {
|
|
3527
|
+
if (!target) {
|
|
3528
|
+
return undefined;
|
|
3529
|
+
}
|
|
3530
|
+
const observer = new MutationObserver(function () {
|
|
3531
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3532
|
+
args[_key] = arguments[_key];
|
|
3533
|
+
}
|
|
3534
|
+
onMutate === null || onMutate === void 0 ? void 0 : onMutate(...args);
|
|
3535
|
+
});
|
|
3536
|
+
observer.observe(target, options);
|
|
3537
|
+
return () => observer.disconnect();
|
|
3538
|
+
}, [target, options, onMutate]);
|
|
3539
|
+
|
|
3540
|
+
var css_248z$3 = "._kc36j{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}._dUHYG{visibility:hidden}";
|
|
3541
|
+
var styles$3 = {"overlay":"_kc36j","hidden":"_dUHYG"};
|
|
3542
|
+
var stylesheet$3="._kc36j{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}._dUHYG{visibility:hidden}";
|
|
3543
|
+
icons_index.styleInject(css_248z$3);
|
|
3544
|
+
|
|
3545
|
+
/**
|
|
3546
|
+
* Adds an overlay to an area that obscures visibility and disables background elements.
|
|
3547
|
+
* @param {MutableRefObject} containerRef - A ref pointing to the DOM element to be filled by the overlay.
|
|
3548
|
+
* @param {boolean} isVisible - When true, displays overlay and disables all element behind it.
|
|
3549
|
+
* @param {React.MouseEventHandler} onClick - A function to be called when the overlay recieves a click event.
|
|
3550
|
+
* @param {string[]} ignoreIds - An array of ids belonging to elements that should not become inert when isInert is true.
|
|
3551
|
+
* @param {CSSProperties['zIndex']} zIndex - The zIndex of the overlay.
|
|
3552
|
+
* @param {string} dataTestId - A string to be added to the overlay element as a data-testid.
|
|
3553
|
+
* @param {number} opacity - The opacity of the overlay.
|
|
3554
|
+
*/
|
|
3555
|
+
const useOverlay = _ref => {
|
|
3556
|
+
let {
|
|
3557
|
+
containerRef,
|
|
3558
|
+
isVisible,
|
|
3559
|
+
onClick,
|
|
3560
|
+
ignoreIds = [],
|
|
3561
|
+
zIndex,
|
|
3562
|
+
dataTestId,
|
|
3563
|
+
opacity
|
|
3564
|
+
} = _ref;
|
|
3565
|
+
const overlayId = index.useId();
|
|
3566
|
+
React.useEffect(() => {
|
|
3567
|
+
var _containerRef$current;
|
|
3568
|
+
const containerNode = (_containerRef$current = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : document.body;
|
|
3569
|
+
const overlay = document.createElement('div');
|
|
3570
|
+
overlay.id = overlayId;
|
|
3571
|
+
overlay.classList.add(styles$3.overlay);
|
|
3572
|
+
if (onClick) overlay.addEventListener('click', onClick);
|
|
3573
|
+
if (dataTestId) overlay.dataset.testid = dataTestId;
|
|
3574
|
+
if (!isVisible) overlay.classList.add(styles$3.hidden);
|
|
3575
|
+
if (zIndex || zIndex === 0) overlay.style.zIndex = zIndex.toString();
|
|
3576
|
+
if (opacity || opacity === 0) overlay.style.opacity = opacity.toString();
|
|
3577
|
+
containerNode.appendChild(overlay);
|
|
3578
|
+
containerNode.style.position = 'relative';
|
|
3579
|
+
return () => {
|
|
3580
|
+
containerNode.style.position = 'static';
|
|
3581
|
+
containerNode.removeChild(overlay);
|
|
3582
|
+
};
|
|
3583
|
+
}, [containerRef, overlayId, isVisible, onClick, dataTestId, zIndex]);
|
|
3584
|
+
React.useEffect(() => {
|
|
3585
|
+
var _containerRef$current2;
|
|
3586
|
+
const containerNode = (_containerRef$current2 = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _containerRef$current2 !== void 0 ? _containerRef$current2 : document.body;
|
|
3587
|
+
const overlayNode = document.getElementById(overlayId);
|
|
3588
|
+
if (isVisible) {
|
|
3589
|
+
Array.from(containerNode.children).forEach(child => {
|
|
3590
|
+
if (!_includesInstanceProperty__default["default"](ignoreIds).call(ignoreIds, child.id) && child.id !== overlayId) child.setAttribute('inert', '');
|
|
3591
|
+
});
|
|
3592
|
+
overlayNode === null || overlayNode === void 0 ? void 0 : overlayNode.classList.remove(styles$3.hidden);
|
|
3593
|
+
} else {
|
|
3594
|
+
Array.from(containerNode.children).forEach(child => {
|
|
3595
|
+
child.removeAttribute('inert');
|
|
3596
|
+
});
|
|
3597
|
+
overlayNode === null || overlayNode === void 0 ? void 0 : overlayNode.classList.add(styles$3.hidden);
|
|
3598
|
+
}
|
|
3599
|
+
return () => {
|
|
3600
|
+
Array.from(containerNode.children).forEach(child => {
|
|
3601
|
+
child.removeAttribute('inert');
|
|
3602
|
+
});
|
|
3603
|
+
};
|
|
3604
|
+
}, [containerRef, isVisible, ignoreIds, overlayId]);
|
|
3605
|
+
};
|
|
3606
|
+
|
|
3437
3607
|
const MenuPane = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
3608
|
+
var _flyoutRef$current$pa, _flyoutRef$current2, _flyoutRef$current3;
|
|
3438
3609
|
let {
|
|
3439
3610
|
placement,
|
|
3440
3611
|
children,
|
|
@@ -3448,31 +3619,45 @@ const MenuPane = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
3448
3619
|
} = _ref;
|
|
3449
3620
|
const [items, setItems] = React.useState([]);
|
|
3450
3621
|
const flyoutRef = React.useRef(null);
|
|
3451
|
-
const
|
|
3452
|
-
internalSearchValue,
|
|
3453
|
-
setSearchValue,
|
|
3454
|
-
zeroSearchResults,
|
|
3455
|
-
noMatchesText
|
|
3456
|
-
} = usePaneSearch(externalSearchValue, onSearchValueChange, items);
|
|
3622
|
+
const stickyBoxRef = React.useRef(null);
|
|
3457
3623
|
const portalTarget = index.usePortalTarget();
|
|
3458
|
-
const [side, align] = React.useMemo(() =>
|
|
3624
|
+
const [side, align] = React.useMemo(() => {
|
|
3625
|
+
var _placement$split, _placement$split2;
|
|
3626
|
+
return (_placement$split = placement === null || placement === void 0 ? void 0 : (_placement$split2 = placement.split) === null || _placement$split2 === void 0 ? void 0 : _placement$split2.call(placement, '-')) !== null && _placement$split !== void 0 ? _placement$split : [];
|
|
3627
|
+
}, [placement]);
|
|
3459
3628
|
const {
|
|
3460
3629
|
dataTestId: rootDataTestId,
|
|
3461
3630
|
openPaneDepth,
|
|
3462
3631
|
setMaskHeight,
|
|
3463
3632
|
maskHeight,
|
|
3464
3633
|
open,
|
|
3465
|
-
triggerRef
|
|
3634
|
+
triggerRef,
|
|
3635
|
+
searchBarConfigs
|
|
3466
3636
|
} = useMenuContext();
|
|
3637
|
+
const thisPanesDepth = 1;
|
|
3638
|
+
const maskContainerId = 'maskContainer';
|
|
3639
|
+
useOverlay({
|
|
3640
|
+
isVisible: open,
|
|
3641
|
+
ignoreIds: [maskContainerId],
|
|
3642
|
+
opacity: 0
|
|
3643
|
+
});
|
|
3644
|
+
const animatedLeft = React.useMemo(() => openPaneDepth > thisPanesDepth, [openPaneDepth]);
|
|
3645
|
+
const dataTestId = index.getSubDataTestId(rootDataTestId, DATA_TESTID_SUFFIXES.MENU_PANE);
|
|
3646
|
+
const {
|
|
3647
|
+
internalSearchValue,
|
|
3648
|
+
noSearchResultsNode,
|
|
3649
|
+
onInteractOutside
|
|
3650
|
+
} = usePaneSearch(isSearchable, externalSearchValue, onSearchValueChange, items, animatedLeft, false, dataTestId, index.useId(), flyoutRef);
|
|
3467
3651
|
|
|
3468
3652
|
// In order to preseve the css animation for vertical resizing, we cannot set the height of this pane to `auto`. It must be a pixel value.
|
|
3469
3653
|
// We cache the pixel value here, to use it later if the user returns to this pane from a submenu.
|
|
3470
3654
|
const initialHeightOfThisPane = React.useRef(null);
|
|
3471
3655
|
index.useDidUpdate(() => {
|
|
3472
|
-
if (openPaneDepth ===
|
|
3656
|
+
if (openPaneDepth === thisPanesDepth) {
|
|
3473
3657
|
if (initialHeightOfThisPane.current === null) {
|
|
3474
3658
|
window.requestAnimationFrame(() => {
|
|
3475
|
-
|
|
3659
|
+
var _flyoutRef$current$cl, _flyoutRef$current;
|
|
3660
|
+
initialHeightOfThisPane.current = (_flyoutRef$current$cl = (_flyoutRef$current = flyoutRef.current) === null || _flyoutRef$current === void 0 ? void 0 : _flyoutRef$current.clientHeight) !== null && _flyoutRef$current$cl !== void 0 ? _flyoutRef$current$cl : null;
|
|
3476
3661
|
setMaskHeight(initialHeightOfThisPane.current);
|
|
3477
3662
|
});
|
|
3478
3663
|
} else {
|
|
@@ -3480,19 +3665,9 @@ const MenuPane = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
3480
3665
|
}
|
|
3481
3666
|
}
|
|
3482
3667
|
}, [openPaneDepth]);
|
|
3483
|
-
const dataTestId = index.getSubDataTestId(rootDataTestId, DATA_TESTID_SUFFIXES.MENU_PANE);
|
|
3484
|
-
const animatedLeft = React.useMemo(() => openPaneDepth > 1, [openPaneDepth]);
|
|
3485
|
-
index.useEventListener(flyoutRef, 'keydown', e => {
|
|
3486
|
-
var _context;
|
|
3487
|
-
return _includesInstanceProperty__default["default"](_context = Object.values(KEYS).flat()).call(_context, e.key) && index.setIsKeyboardUser(true);
|
|
3488
|
-
}, {
|
|
3489
|
-
additionalDependencies: [openPaneDepth]
|
|
3490
|
-
});
|
|
3491
|
-
index.useEventListener(flyoutRef, 'pointerenter', () => index.setIsKeyboardUser(false), {
|
|
3492
|
-
additionalDependencies: [openPaneDepth]
|
|
3493
|
-
});
|
|
3494
3668
|
const defaultSide = React.useMemo(() => {
|
|
3495
|
-
|
|
3669
|
+
var _triggerRef$current;
|
|
3670
|
+
const rect = triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.getBoundingClientRect();
|
|
3496
3671
|
if (!rect) {
|
|
3497
3672
|
return 'bottom';
|
|
3498
3673
|
}
|
|
@@ -3515,6 +3690,15 @@ const MenuPane = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
3515
3690
|
}
|
|
3516
3691
|
return 'bottom';
|
|
3517
3692
|
}, [open, triggerRef]);
|
|
3693
|
+
const [transform, setTransform] = React.useState('');
|
|
3694
|
+
const target = (_flyoutRef$current$pa = (_flyoutRef$current2 = flyoutRef.current) === null || _flyoutRef$current2 === void 0 ? void 0 : _flyoutRef$current2.parentNode) !== null && _flyoutRef$current$pa !== void 0 ? _flyoutRef$current$pa : undefined;
|
|
3695
|
+
useMutationObserver(target, {
|
|
3696
|
+
attributes: true,
|
|
3697
|
+
attributeFilter: ['style']
|
|
3698
|
+
}, () => {
|
|
3699
|
+
var _style$transform, _style;
|
|
3700
|
+
return setTransform((_style$transform = target === null || target === void 0 ? void 0 : (_style = target.style) === null || _style === void 0 ? void 0 : _style.transform) !== null && _style$transform !== void 0 ? _style$transform : '');
|
|
3701
|
+
});
|
|
3518
3702
|
return /*#__PURE__*/React__default["default"].createElement(PaneContextProvider, {
|
|
3519
3703
|
items: items,
|
|
3520
3704
|
setItems: setItems,
|
|
@@ -3523,35 +3707,51 @@ const MenuPane = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
3523
3707
|
searchValue: internalSearchValue,
|
|
3524
3708
|
isSearchFilteringDisabled,
|
|
3525
3709
|
isInteractive: !animatedLeft,
|
|
3526
|
-
flyoutRef
|
|
3710
|
+
flyoutRef,
|
|
3711
|
+
stickyBoxRef
|
|
3527
3712
|
}
|
|
3528
3713
|
}, /*#__PURE__*/React__default["default"].createElement(reactDropdownMenu.Portal, {
|
|
3529
3714
|
container: portalTarget || undefined
|
|
3530
3715
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3531
|
-
className: styles$4.maskContainer
|
|
3716
|
+
className: styles$4.maskContainer,
|
|
3717
|
+
id: maskContainerId
|
|
3532
3718
|
}, /*#__PURE__*/React__default["default"].createElement(reactDropdownMenu.Content, _extends__default["default"]({}, rest, {
|
|
3719
|
+
onCloseAutoFocus: () => {
|
|
3720
|
+
var _triggerRef$current2;
|
|
3721
|
+
return triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current2 = triggerRef.current) === null || _triggerRef$current2 === void 0 ? void 0 : _triggerRef$current2.focus();
|
|
3722
|
+
},
|
|
3533
3723
|
sideOffset: 6,
|
|
3534
|
-
loop:
|
|
3724
|
+
loop: !isSearchable,
|
|
3535
3725
|
side: side || defaultSide,
|
|
3536
3726
|
align: align || 'start',
|
|
3537
3727
|
ref: index.mergeRefs(ref, flyoutRef),
|
|
3538
3728
|
"data-testid": dataTestId,
|
|
3539
3729
|
className: classNames__default["default"](className, {
|
|
3540
|
-
[styles$4.animatedLeft]: animatedLeft
|
|
3541
|
-
[styles$4.containsStickyBox]: isSearchable
|
|
3730
|
+
[styles$4.animatedLeft]: animatedLeft
|
|
3542
3731
|
}, styles$4.flyout),
|
|
3732
|
+
onInteractOutside: onInteractOutside,
|
|
3543
3733
|
style: {
|
|
3544
3734
|
...style,
|
|
3545
|
-
height: internalSearchValue && openPaneDepth ===
|
|
3735
|
+
height: internalSearchValue && openPaneDepth === thisPanesDepth ? undefined : maskHeight !== null && maskHeight !== void 0 ? maskHeight : undefined
|
|
3546
3736
|
}
|
|
3547
3737
|
}), isSearchable && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3548
|
-
className: styles$4.stickyBox
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3738
|
+
className: classNames__default["default"](styles$4.stickyBox, styles$4.isSearchable),
|
|
3739
|
+
ref: stickyBoxRef
|
|
3740
|
+
}), noSearchResultsNode, children), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3741
|
+
className: styles$4.searchBoxesContainer,
|
|
3742
|
+
style: {
|
|
3743
|
+
transform,
|
|
3744
|
+
width: (_flyoutRef$current3 = flyoutRef.current) === null || _flyoutRef$current3 === void 0 ? void 0 : _flyoutRef$current3.clientWidth
|
|
3745
|
+
}
|
|
3746
|
+
}, searchBarConfigs.length ? searchBarConfigs.map(_ref2 => {
|
|
3747
|
+
let {
|
|
3748
|
+
id,
|
|
3749
|
+
...config
|
|
3750
|
+
} = _ref2;
|
|
3751
|
+
return /*#__PURE__*/React__default["default"].createElement(MenuSearch, _extends__default["default"]({
|
|
3752
|
+
key: id
|
|
3753
|
+
}, config));
|
|
3754
|
+
}) : null))));
|
|
3555
3755
|
});
|
|
3556
3756
|
|
|
3557
3757
|
const MenuItem = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) => {
|
|
@@ -3572,16 +3772,24 @@ const MenuItem = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
3572
3772
|
isSearchFilteringDisabled,
|
|
3573
3773
|
isInteractive,
|
|
3574
3774
|
closeSubmenu,
|
|
3575
|
-
flyoutRef
|
|
3775
|
+
flyoutRef,
|
|
3776
|
+
stickyBoxRef
|
|
3576
3777
|
} = usePaneContext(itemRef);
|
|
3577
|
-
const
|
|
3778
|
+
const {
|
|
3779
|
+
isFocusVisible
|
|
3780
|
+
} = interactions.useFocusVisible({
|
|
3781
|
+
isTextInput: true
|
|
3782
|
+
});
|
|
3783
|
+
const dataTestId = index.getSubDataTestId(menuParentDataTestId === null || menuParentDataTestId === void 0 ? void 0 : menuParentDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM), String(index$1));
|
|
3578
3784
|
const isVisible = React.useMemo(() => {
|
|
3579
|
-
|
|
3580
|
-
|
|
3785
|
+
var _context;
|
|
3786
|
+
const searchMatcher = label !== null && label !== void 0 ? label : typeof children === 'string' ? children : undefined;
|
|
3787
|
+
return isSearchFilteringDisabled || !searchValue || (searchMatcher === null || searchMatcher === void 0 ? void 0 : _includesInstanceProperty__default["default"](_context = searchMatcher.toLowerCase()).call(_context, searchValue.toLowerCase()));
|
|
3581
3788
|
}, [children, searchValue, label, isSearchFilteringDisabled]);
|
|
3582
3789
|
const handleFocus = () => {
|
|
3583
|
-
if (itemRef.current && flyoutRef.current &&
|
|
3584
|
-
|
|
3790
|
+
if (itemRef.current && flyoutRef.current && isFocusVisible) {
|
|
3791
|
+
var _stickyBoxRef$current, _stickyBoxRef$current2;
|
|
3792
|
+
const stickyBoxHeight = (_stickyBoxRef$current = (_stickyBoxRef$current2 = stickyBoxRef.current) === null || _stickyBoxRef$current2 === void 0 ? void 0 : _stickyBoxRef$current2.clientHeight) !== null && _stickyBoxRef$current !== void 0 ? _stickyBoxRef$current : 0;
|
|
3585
3793
|
|
|
3586
3794
|
// if the top of the focused menu item is beneath the sticky box
|
|
3587
3795
|
if (itemRef.current.offsetTop < flyoutRef.current.scrollTop + stickyBoxHeight) {
|
|
@@ -3599,20 +3807,20 @@ const MenuItem = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
|
|
|
3599
3807
|
"data-testid": dataTestId,
|
|
3600
3808
|
ref: index.mergeRefs(ref, itemRef),
|
|
3601
3809
|
onKeyDown: e => {
|
|
3602
|
-
var
|
|
3810
|
+
var _context2;
|
|
3603
3811
|
if (!isInteractive) {
|
|
3604
3812
|
e.preventDefault();
|
|
3605
3813
|
return;
|
|
3606
3814
|
}
|
|
3607
|
-
if (_includesInstanceProperty__default["default"](
|
|
3608
|
-
closeSubmenu
|
|
3815
|
+
if (_includesInstanceProperty__default["default"](_context2 = KEYS.CLOSE_SUBMENU).call(_context2, e.key)) {
|
|
3816
|
+
closeSubmenu === null || closeSubmenu === void 0 ? void 0 : closeSubmenu(e);
|
|
3609
3817
|
}
|
|
3610
3818
|
},
|
|
3611
3819
|
onFocus: handleFocus
|
|
3612
3820
|
// stop radix from closing the menu on selection of disabled item
|
|
3613
3821
|
// other pointer and keyboard events still work, even when disabled
|
|
3614
3822
|
,
|
|
3615
|
-
onSelect: e => isDisabled ? e.preventDefault() : onSelect
|
|
3823
|
+
onSelect: e => isDisabled ? e.preventDefault() : onSelect === null || onSelect === void 0 ? void 0 : onSelect()
|
|
3616
3824
|
}), (!children || typeof children === 'string') && label ? label : children) : null;
|
|
3617
3825
|
});
|
|
3618
3826
|
|
|
@@ -3627,19 +3835,14 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
3627
3835
|
isSearchFilteringDisabled: isSearchFilteringDisabledForChildren = false,
|
|
3628
3836
|
className,
|
|
3629
3837
|
style,
|
|
3838
|
+
onIsOpenChange,
|
|
3630
3839
|
...rest
|
|
3631
3840
|
} = _ref;
|
|
3632
3841
|
const [items, setItems] = React.useState([]);
|
|
3633
|
-
const {
|
|
3634
|
-
internalSearchValue,
|
|
3635
|
-
setSearchValue,
|
|
3636
|
-
zeroSearchResults,
|
|
3637
|
-
noMatchesText
|
|
3638
|
-
} = usePaneSearch(externalSearchValue, onSearchValueChange, items);
|
|
3639
3842
|
const internalId = index.useId();
|
|
3640
3843
|
const triggerRef = React.useRef(null);
|
|
3641
3844
|
const flyoutRef = React.useRef(null);
|
|
3642
|
-
const
|
|
3845
|
+
const stickyBoxRef = React.useRef(null);
|
|
3643
3846
|
const backButtonRef = React.useRef(null);
|
|
3644
3847
|
const {
|
|
3645
3848
|
dataTestId: paneContainingTriggerDataTestId,
|
|
@@ -3654,17 +3857,32 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
3654
3857
|
registerSubmenu,
|
|
3655
3858
|
setMaskHeight
|
|
3656
3859
|
} = useMenuContext();
|
|
3860
|
+
const {
|
|
3861
|
+
isFocusVisible
|
|
3862
|
+
} = interactions.useFocusVisible();
|
|
3657
3863
|
const thisPanesDepth = React.useRef(totalOpenPaneDepth + 1).current;
|
|
3864
|
+
const [isPaneInDOM, setIsPaneInDOM] = React.useState(false);
|
|
3865
|
+
const [isFrameAfterPaneAddedToDOM, setIsFrameAfterPaneAddedToDOM] = React.useState(false);
|
|
3866
|
+
const [isTransitioningFromRight, setIsTransitioningFromRight] = React.useState(false);
|
|
3867
|
+
const animatedLeft = React.useMemo(() => thisPanesDepth < totalOpenPaneDepth, [totalOpenPaneDepth, thisPanesDepth]);
|
|
3868
|
+
const animatedRight = React.useMemo(() => thisPanesDepth > totalOpenPaneDepth || isFrameAfterPaneAddedToDOM, [totalOpenPaneDepth, isFrameAfterPaneAddedToDOM, thisPanesDepth]);
|
|
3658
3869
|
const paneDataTestId = index.getSubDataTestId(paneContainingTriggerDataTestId, String(triggerIndex));
|
|
3659
|
-
const
|
|
3660
|
-
|
|
3870
|
+
const closeThisSubmenu = e => {
|
|
3871
|
+
// prevent closing the entire menu, and Radix keyboard navigation
|
|
3872
|
+
e.preventDefault();
|
|
3873
|
+
registerSubmenu(internalId, false);
|
|
3874
|
+
};
|
|
3875
|
+
const {
|
|
3876
|
+
internalSearchValue,
|
|
3877
|
+
noSearchResultsNode,
|
|
3878
|
+
onInteractOutside
|
|
3879
|
+
} = usePaneSearch(isSearchable, externalSearchValue, onSearchValueChange, items, animatedLeft, animatedRight, paneDataTestId, internalId, flyoutRef, backButtonRef, closeThisSubmenu);
|
|
3880
|
+
const backButtonDataTestId = paneDataTestId === null || paneDataTestId === void 0 ? void 0 : paneDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_BACK);
|
|
3881
|
+
const triggerDataTestId = paneDataTestId === null || paneDataTestId === void 0 ? void 0 : paneDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM);
|
|
3661
3882
|
const triggerIsVisible = React.useMemo(() => {
|
|
3662
3883
|
var _context;
|
|
3663
3884
|
return isSearchFilteringDisabledForPaneContainingTrigger || !paneContainingTriggerSearchValue || typeof label === 'string' && _includesInstanceProperty__default["default"](_context = label.toLowerCase()).call(_context, paneContainingTriggerSearchValue.toLowerCase());
|
|
3664
3885
|
}, [paneContainingTriggerSearchValue, label, isSearchFilteringDisabledForPaneContainingTrigger]);
|
|
3665
|
-
const [isPaneInDOM, setIsPaneInDOM] = React.useState(false);
|
|
3666
|
-
const [isFrameAfterPaneAddedToDOM, setIsFrameAfterPaneAddedToDOM] = React.useState(false);
|
|
3667
|
-
const [isTransitioningFromRight, setIsTransitioningFromRight] = React.useState(false);
|
|
3668
3886
|
index.useDidUpdate(() => {
|
|
3669
3887
|
if (isPaneInDOM) {
|
|
3670
3888
|
setIsTransitioningFromRight(true);
|
|
@@ -3673,42 +3891,51 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
3673
3891
|
window.requestAnimationFrame(() => setIsFrameAfterPaneAddedToDOM(false));
|
|
3674
3892
|
}
|
|
3675
3893
|
registerSubmenu(internalId, isPaneInDOM);
|
|
3894
|
+
onIsOpenChange === null || onIsOpenChange === void 0 ? void 0 : onIsOpenChange(isPaneInDOM);
|
|
3676
3895
|
}, [isPaneInDOM]);
|
|
3896
|
+
|
|
3897
|
+
// Omitted dependencies because this should only run on unmount
|
|
3898
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3677
3899
|
React.useEffect(() => () => registerSubmenu(internalId, false), []);
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3900
|
+
index.useDidUpdate(() => {
|
|
3901
|
+
if (thisPanesDepth === totalOpenPaneDepth) {
|
|
3902
|
+
var _flyoutRef$current$cl, _flyoutRef$current;
|
|
3903
|
+
setMaskHeight((_flyoutRef$current$cl = (_flyoutRef$current = flyoutRef.current) === null || _flyoutRef$current === void 0 ? void 0 : _flyoutRef$current.clientHeight) !== null && _flyoutRef$current$cl !== void 0 ? _flyoutRef$current$cl : null);
|
|
3904
|
+
}
|
|
3905
|
+
},
|
|
3906
|
+
// ignoring other dependencies because this should only run when the children change
|
|
3907
|
+
[children]);
|
|
3683
3908
|
index.useDidUpdate(() => {
|
|
3684
3909
|
if (thisPanesDepth === totalOpenPaneDepth) {
|
|
3685
3910
|
window.requestAnimationFrame(() => {
|
|
3686
|
-
|
|
3911
|
+
var _flyoutRef$current$cl2, _flyoutRef$current2;
|
|
3912
|
+
setMaskHeight((_flyoutRef$current$cl2 = (_flyoutRef$current2 = flyoutRef.current) === null || _flyoutRef$current2 === void 0 ? void 0 : _flyoutRef$current2.clientHeight) !== null && _flyoutRef$current$cl2 !== void 0 ? _flyoutRef$current$cl2 : null);
|
|
3687
3913
|
});
|
|
3688
3914
|
}
|
|
3689
3915
|
}, [totalOpenPaneDepth, internalSearchValue]);
|
|
3690
|
-
const animatedLeft = React.useMemo(() => thisPanesDepth < totalOpenPaneDepth, [totalOpenPaneDepth]);
|
|
3691
|
-
const animatedRight = React.useMemo(() => thisPanesDepth > totalOpenPaneDepth || isFrameAfterPaneAddedToDOM, [totalOpenPaneDepth, isFrameAfterPaneAddedToDOM]);
|
|
3692
3916
|
const handlePaneTransitionEnd = () => {
|
|
3917
|
+
var _flyoutRef$current3;
|
|
3693
3918
|
if (animatedLeft) {
|
|
3694
3919
|
return;
|
|
3695
3920
|
}
|
|
3696
3921
|
if (animatedRight) {
|
|
3697
3922
|
setIsPaneInDOM(false);
|
|
3698
|
-
if (
|
|
3699
|
-
|
|
3923
|
+
if (isFocusVisible) {
|
|
3924
|
+
var _triggerRef$current;
|
|
3925
|
+
(_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.focus();
|
|
3700
3926
|
}
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3927
|
+
return;
|
|
3928
|
+
}
|
|
3929
|
+
|
|
3930
|
+
// if the newly closed submenu doesn't place the focus on its trigger due to mouse events
|
|
3931
|
+
if (!((_flyoutRef$current3 = flyoutRef.current) !== null && _flyoutRef$current3 !== void 0 && _flyoutRef$current3.contains(document.activeElement)) && isFocusVisible) {
|
|
3932
|
+
if (triggerRef.current && paneContainingTriggerIsInteractive) {
|
|
3933
|
+
triggerRef.current.focus();
|
|
3934
|
+
} else if (backButtonRef.current) {
|
|
3935
|
+
backButtonRef.current.focus();
|
|
3709
3936
|
}
|
|
3710
|
-
setIsTransitioningFromRight(false);
|
|
3711
3937
|
}
|
|
3938
|
+
setIsTransitioningFromRight(false);
|
|
3712
3939
|
};
|
|
3713
3940
|
return triggerIsVisible ? /*#__PURE__*/React__default["default"].createElement(reactDropdownMenu.Sub, {
|
|
3714
3941
|
open: isPaneInDOM
|
|
@@ -3729,7 +3956,7 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
3729
3956
|
if (!isDisabled && _includesInstanceProperty__default["default"](_context2 = KEYS.OPEN_SUBMENU).call(_context2, e.key)) {
|
|
3730
3957
|
setIsPaneInDOM(true);
|
|
3731
3958
|
} else if (_includesInstanceProperty__default["default"](_context3 = KEYS.CLOSE_SUBMENU).call(_context3, e.key)) {
|
|
3732
|
-
closeSubmenuContainingTrigger
|
|
3959
|
+
closeSubmenuContainingTrigger === null || closeSubmenuContainingTrigger === void 0 ? void 0 : closeSubmenuContainingTrigger(e);
|
|
3733
3960
|
}
|
|
3734
3961
|
}
|
|
3735
3962
|
}, label, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronRightIcon, {
|
|
@@ -3743,13 +3970,15 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
3743
3970
|
isSearchFilteringDisabled: isSearchFilteringDisabledForChildren,
|
|
3744
3971
|
isInteractive: !isTransitioningFromRight && !animatedLeft && !animatedRight,
|
|
3745
3972
|
closeSubmenu: closeThisSubmenu,
|
|
3746
|
-
flyoutRef
|
|
3973
|
+
flyoutRef,
|
|
3974
|
+
stickyBoxRef
|
|
3747
3975
|
}
|
|
3748
3976
|
}, /*#__PURE__*/React__default["default"].createElement(reactDropdownMenu.SubContent, _extends__default["default"]({}, rest, {
|
|
3749
|
-
loop:
|
|
3977
|
+
loop: !isSearchable,
|
|
3750
3978
|
"data-testid": paneDataTestId,
|
|
3751
3979
|
ref: index.mergeRefs(ref, flyoutRef),
|
|
3752
|
-
|
|
3980
|
+
onInteractOutside: onInteractOutside,
|
|
3981
|
+
className: classNames__default["default"](className, styles$4.flyout, {
|
|
3753
3982
|
[styles$4.animatedRight]: animatedRight,
|
|
3754
3983
|
[styles$4.animatedLeft]: animatedLeft
|
|
3755
3984
|
}),
|
|
@@ -3759,11 +3988,11 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
3759
3988
|
zIndex: thisPanesDepth
|
|
3760
3989
|
}
|
|
3761
3990
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3762
|
-
className: styles$4.stickyBox
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
ref:
|
|
3766
|
-
}
|
|
3991
|
+
className: classNames__default["default"](styles$4.stickyBox, {
|
|
3992
|
+
[styles$4.isSearchable]: isSearchable
|
|
3993
|
+
}),
|
|
3994
|
+
ref: stickyBoxRef
|
|
3995
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactDropdownMenu.Item, {
|
|
3767
3996
|
className: classNames__default["default"](styles$4.menuItem, {
|
|
3768
3997
|
[styles$4.unresponsive]: isTransitioningFromRight || animatedLeft || animatedRight
|
|
3769
3998
|
}),
|
|
@@ -3779,80 +4008,16 @@ const SubMenu = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =>
|
|
|
3779
4008
|
}, /*#__PURE__*/React__default["default"].createElement(icons_index.ArrowLeftIcon, {
|
|
3780
4009
|
size: "small",
|
|
3781
4010
|
className: styles$4.backIcon
|
|
3782
|
-
}), label)),
|
|
3783
|
-
className: classNames__default["default"](styles$4.menuItem, styles$4.noItems),
|
|
3784
|
-
"aria-live": "assertive"
|
|
3785
|
-
}, noMatchesText), children))) : null;
|
|
4011
|
+
}), label)), noSearchResultsNode, children))) : null;
|
|
3786
4012
|
});
|
|
3787
4013
|
|
|
3788
|
-
var css_248z$
|
|
3789
|
-
var styles$
|
|
3790
|
-
var stylesheet$
|
|
3791
|
-
icons_index.styleInject(css_248z$3);
|
|
3792
|
-
|
|
3793
|
-
/**
|
|
3794
|
-
* Adds an overlay to an area that obscures visibility and disables background elements.
|
|
3795
|
-
* @param {MutableRefObject} containerRef - A ref pointing to the DOM element to be filled by the overlay.
|
|
3796
|
-
* @param {boolean} isVisible - When true, displays overlay and disables all element behind it.
|
|
3797
|
-
* @param {React.MouseEventHandler} onClick - A function to be called when the overlay recieves a click event.
|
|
3798
|
-
* @param {string[]} ignoreIds - An array of ids belonging to elements that should not become inert when isInert is true.
|
|
3799
|
-
* @param {CSSProperties['zIndex']} zIndex - The zIndex of the overlay.
|
|
3800
|
-
* @param {string} dataTestId - A string to be added to the overlay element as a data-testid.
|
|
3801
|
-
*/
|
|
3802
|
-
const useOverlay = _ref => {
|
|
3803
|
-
let {
|
|
3804
|
-
containerRef,
|
|
3805
|
-
isVisible,
|
|
3806
|
-
onClick,
|
|
3807
|
-
ignoreIds = [],
|
|
3808
|
-
zIndex,
|
|
3809
|
-
dataTestId
|
|
3810
|
-
} = _ref;
|
|
3811
|
-
const overlayId = index.useId();
|
|
3812
|
-
React.useEffect(() => {
|
|
3813
|
-
const containerNode = containerRef?.current ?? document.body;
|
|
3814
|
-
const overlay = document.createElement('div');
|
|
3815
|
-
overlay.id = overlayId;
|
|
3816
|
-
overlay.classList.add(styles$3.overlay);
|
|
3817
|
-
if (onClick) overlay.addEventListener('click', onClick);
|
|
3818
|
-
if (dataTestId) overlay.dataset.testid = dataTestId;
|
|
3819
|
-
if (!isVisible) overlay.classList.add(styles$3.hidden);
|
|
3820
|
-
if (zIndex) overlay.style.zIndex = zIndex.toString();
|
|
3821
|
-
containerNode.appendChild(overlay);
|
|
3822
|
-
containerNode.style.position = 'relative';
|
|
3823
|
-
return () => {
|
|
3824
|
-
containerNode.style.position = 'static';
|
|
3825
|
-
containerNode.removeChild(overlay);
|
|
3826
|
-
};
|
|
3827
|
-
}, [containerRef, overlayId, isVisible, onClick, dataTestId, zIndex]);
|
|
3828
|
-
React.useEffect(() => {
|
|
3829
|
-
const containerNode = containerRef?.current ?? document.body;
|
|
3830
|
-
const overlayNode = document.getElementById(overlayId);
|
|
3831
|
-
if (isVisible) {
|
|
3832
|
-
Array.from(containerNode.children).forEach(child => {
|
|
3833
|
-
if (!_includesInstanceProperty__default["default"](ignoreIds).call(ignoreIds, child.id) && child.id !== overlayId) child.setAttribute('inert', '');
|
|
3834
|
-
});
|
|
3835
|
-
overlayNode?.classList.remove(styles$3.hidden);
|
|
3836
|
-
} else {
|
|
3837
|
-
Array.from(containerNode.children).forEach(child => {
|
|
3838
|
-
child.removeAttribute('inert');
|
|
3839
|
-
});
|
|
3840
|
-
overlayNode?.classList.add(styles$3.hidden);
|
|
3841
|
-
}
|
|
3842
|
-
return () => {
|
|
3843
|
-
Array.from(containerNode.children).forEach(child => {
|
|
3844
|
-
child.removeAttribute('inert');
|
|
3845
|
-
});
|
|
3846
|
-
};
|
|
3847
|
-
}, [containerRef, isVisible, ignoreIds, overlayId]);
|
|
3848
|
-
};
|
|
3849
|
-
|
|
3850
|
-
var css_248z$2 = "._qjffl{position:absolute;top:0;height:100%;color:#32363a;background-color:#fff;border-right:1px solid #eee;z-index:1000;padding:12px 20px 20px;transition:left .5s}._HItSr{visibility:hidden}._G-q2r{display:flex;justify-content:space-between;align-items:start;line-height:20px;font-size:16px;padding-bottom:12px}._iiyNj{padding-top:8px}._bPPA8{margin-left:12px}";
|
|
3851
|
-
var styles$2 = {"drawer":"_qjffl","hidden":"_HItSr","header":"_G-q2r","title":"_iiyNj","closeButton":"_bPPA8"};
|
|
3852
|
-
var stylesheet$2="._qjffl{position:absolute;top:0;height:100%;color:#32363a;background-color:#fff;border-right:1px solid #eee;z-index:1000;padding:12px 20px 20px;transition:left .5s}._HItSr{visibility:hidden}._G-q2r{display:flex;justify-content:space-between;align-items:start;line-height:20px;font-size:16px;padding-bottom:12px}._iiyNj{padding-top:8px}._bPPA8{margin-left:12px}";
|
|
4014
|
+
var css_248z$2 = "._a3VHe{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}._SCuPd{visibility:hidden}._sFqQi{display:flex;justify-content:space-between;align-items:start;line-height:20px;font-size:16px;padding-bottom:12px}._8UPIu{padding-top:8px}._LCjYN{margin-left:12px}";
|
|
4015
|
+
var styles$2 = {"drawer":"_a3VHe","hidden":"_SCuPd","header":"_sFqQi","title":"_8UPIu","closeButton":"_LCjYN"};
|
|
4016
|
+
var stylesheet$2="._a3VHe{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}._SCuPd{visibility:hidden}._sFqQi{display:flex;justify-content:space-between;align-items:start;line-height:20px;font-size:16px;padding-bottom:12px}._8UPIu{padding-top:8px}._LCjYN{margin-left:12px}";
|
|
3853
4017
|
icons_index.styleInject(css_248z$2);
|
|
3854
4018
|
|
|
3855
4019
|
const Drawer = _ref => {
|
|
4020
|
+
var _containerRef$current;
|
|
3856
4021
|
let {
|
|
3857
4022
|
id,
|
|
3858
4023
|
isOpen: externalIsOpen,
|
|
@@ -3904,13 +4069,15 @@ const Drawer = _ref => {
|
|
|
3904
4069
|
setIsHidden(false);
|
|
3905
4070
|
setElementUsedToOpenModal(document.activeElement);
|
|
3906
4071
|
} else {
|
|
4072
|
+
var _elementRefToFocusOnC;
|
|
3907
4073
|
setIsClosing(true);
|
|
3908
|
-
if (elementRefToFocusOnClose !== undefined) elementRefToFocusOnClose
|
|
4074
|
+
if (elementRefToFocusOnClose !== undefined) elementRefToFocusOnClose === null || elementRefToFocusOnClose === void 0 ? void 0 : (_elementRefToFocusOnC = elementRefToFocusOnClose.current) === null || _elementRefToFocusOnC === void 0 ? void 0 : _elementRefToFocusOnC.focus();else elementUsedToOpenModal === null || elementUsedToOpenModal === void 0 ? void 0 : elementUsedToOpenModal.focus();
|
|
3909
4075
|
}
|
|
3910
4076
|
}, [elementRefToFocusOnClose, isOpen]);
|
|
3911
4077
|
React.useEffect(() => {
|
|
3912
4078
|
if (isOpen && !isHidden) {
|
|
3913
|
-
|
|
4079
|
+
var _closeButtonRef$curre;
|
|
4080
|
+
(_closeButtonRef$curre = closeButtonRef.current) === null || _closeButtonRef$curre === void 0 ? void 0 : _closeButtonRef$curre.focus();
|
|
3914
4081
|
}
|
|
3915
4082
|
}, [isOpen, isHidden]);
|
|
3916
4083
|
const handleTransitionEnd = () => {
|
|
@@ -3929,7 +4096,7 @@ const Drawer = _ref => {
|
|
|
3929
4096
|
}),
|
|
3930
4097
|
style: {
|
|
3931
4098
|
width,
|
|
3932
|
-
left:
|
|
4099
|
+
left: "".concat(isHidden || isClosing ? "-".concat(width) : '0'),
|
|
3933
4100
|
zIndex
|
|
3934
4101
|
},
|
|
3935
4102
|
onKeyDown: handleKeyDown,
|
|
@@ -3954,12 +4121,12 @@ const Drawer = _ref => {
|
|
|
3954
4121
|
"aria-label": closeButtonAriaLabel
|
|
3955
4122
|
}, /*#__PURE__*/React__default["default"].createElement(icons_index.CloseIcon, null))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3956
4123
|
"data-testid": index.getSubDataTestId(dataTestId, 'body')
|
|
3957
|
-
}, children))), containerRef
|
|
4124
|
+
}, children))), (_containerRef$current = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) !== null && _containerRef$current !== void 0 ? _containerRef$current : document.body) : null;
|
|
3958
4125
|
};
|
|
3959
4126
|
|
|
3960
|
-
var css_248z$1 = ".
|
|
3961
|
-
var styles$1 = {"container":"
|
|
3962
|
-
var stylesheet$1=".
|
|
4127
|
+
var css_248z$1 = "._Li157{display:inline-block;position:relative}._qGkcS{width:120px}._qGkcS ._gv4Jw._9W5cr{transform:rotate(-180deg)}._qGkcS ._gv4Jw._g5S4T{fill:#9d9fa1;opacity:.4}._txezi>input:focus{box-shadow:none!important;border:1px solid #898989!important}._FjddE{width:120px}._FjddE ._Yf4jJ._QMeNI{background-color:#efefef;border-radius:6px}._gv4Jw{position:absolute;right:4px;bottom:4px;height:28px;width:28px}._gv4Jw._9W5cr{transform:rotate(-180deg)}";
|
|
4128
|
+
var styles$1 = {"container":"_Li157","input":"_qGkcS","icon":"_gv4Jw","open":"_9W5cr","disabled":"_g5S4T","ignoreFocusStyle":"_txezi","flyout":"_FjddE","option":"_Yf4jJ","exactMatch":"_QMeNI"};
|
|
4129
|
+
var stylesheet$1="._Li157{display:inline-block;position:relative}._qGkcS{width:120px}._qGkcS ._gv4Jw._9W5cr{transform:rotate(-180deg)}._qGkcS ._gv4Jw._g5S4T{fill:#9d9fa1;opacity:.4}._txezi>input:focus{box-shadow:none!important;border:1px solid #898989!important}._FjddE{width:120px}._FjddE ._Yf4jJ._QMeNI{background-color:#efefef;border-radius:6px}._gv4Jw{position:absolute;right:4px;bottom:4px;height:28px;width:28px}._gv4Jw._9W5cr{transform:rotate(-180deg)}";
|
|
3963
4130
|
icons_index.styleInject(css_248z$1);
|
|
3964
4131
|
|
|
3965
4132
|
const TimeDropdown = _ref => {
|
|
@@ -3999,14 +4166,14 @@ const TimeDropdown = _ref => {
|
|
|
3999
4166
|
"aria-label": ariaLabel,
|
|
4000
4167
|
"aria-labelledby": ariaLabelledBy,
|
|
4001
4168
|
"aria-describedby": ariaDescribedBy,
|
|
4002
|
-
"data-testid": dataTestId &&
|
|
4169
|
+
"data-testid": dataTestId && "".concat(dataTestId, "-dropdown"),
|
|
4003
4170
|
className: styles$1.flyout,
|
|
4004
4171
|
onMouseOver: () => setIsOptionHovered(true),
|
|
4005
4172
|
onMouseLeave: () => setIsOptionHovered(false)
|
|
4006
4173
|
}, items.map((item, index$1) => /*#__PURE__*/React__default["default"].createElement(index.FlyoutOption, {
|
|
4007
4174
|
id: item.id,
|
|
4008
4175
|
isHighlightedOnHover: true,
|
|
4009
|
-
isHighlighted: scrolledToItem
|
|
4176
|
+
isHighlighted: (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.index) === index$1 && (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.isFocused),
|
|
4010
4177
|
key: item.label,
|
|
4011
4178
|
ref: node => {
|
|
4012
4179
|
if (node) {
|
|
@@ -4015,9 +4182,9 @@ const TimeDropdown = _ref => {
|
|
|
4015
4182
|
}
|
|
4016
4183
|
},
|
|
4017
4184
|
onClick: () => onClick(index$1),
|
|
4018
|
-
"data-testid": dataTestId &&
|
|
4185
|
+
"data-testid": dataTestId && "".concat(dataTestId, "-option-").concat(index$1),
|
|
4019
4186
|
className: classNames__default["default"](styles$1.option, {
|
|
4020
|
-
[styles$1.exactMatch]: scrolledToItem
|
|
4187
|
+
[styles$1.exactMatch]: (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.index) === index$1 && scrolledToItem.isExactMatch && !isOptionHovered
|
|
4021
4188
|
})
|
|
4022
4189
|
}, item.label))),
|
|
4023
4190
|
anchorNode: inputRef.current,
|
|
@@ -4041,7 +4208,7 @@ const formatUtcDate = (utcDate, is24HourClock) => {
|
|
|
4041
4208
|
const dateWithoutLeadingZeros = format(utcDate);
|
|
4042
4209
|
let dateWithLeadingZeros = dateWithoutLeadingZeros;
|
|
4043
4210
|
if (dateWithLeadingZeros.split(':')[0].length === 1) {
|
|
4044
|
-
dateWithLeadingZeros =
|
|
4211
|
+
dateWithLeadingZeros = "0".concat(dateWithLeadingZeros);
|
|
4045
4212
|
}
|
|
4046
4213
|
return dateWithLeadingZeros.toLowerCase();
|
|
4047
4214
|
};
|
|
@@ -4070,17 +4237,18 @@ const generateTimes = (step, is24HourClock) => {
|
|
|
4070
4237
|
return {
|
|
4071
4238
|
label: labelWithLeadingZeros,
|
|
4072
4239
|
value: i * step,
|
|
4073
|
-
id:
|
|
4240
|
+
id: "time-option-".concat(i)
|
|
4074
4241
|
};
|
|
4075
4242
|
});
|
|
4076
4243
|
};
|
|
4077
4244
|
function getTimeStringCorrector(str, is24HourClock) {
|
|
4245
|
+
var _letterString;
|
|
4078
4246
|
let [numberString, letterString] = str.replace(':', '').split(' ');
|
|
4079
|
-
letterString = letterString
|
|
4247
|
+
letterString = (_letterString = letterString) === null || _letterString === void 0 ? void 0 : _letterString.toLowerCase();
|
|
4080
4248
|
let selectionModifier = 0;
|
|
4081
4249
|
const getTimeString = () => {
|
|
4082
|
-
const finalNumberString =
|
|
4083
|
-
return is24HourClock ? finalNumberString :
|
|
4250
|
+
const finalNumberString = "".concat(numberString.slice(0, 2), ":").concat(numberString.slice(2, 4));
|
|
4251
|
+
return is24HourClock ? finalNumberString : "".concat(finalNumberString, " ").concat(letterString);
|
|
4084
4252
|
};
|
|
4085
4253
|
const getSelectionModifier = () => selectionModifier;
|
|
4086
4254
|
const replaceDashes = () => {
|
|
@@ -4095,18 +4263,18 @@ function getTimeStringCorrector(str, is24HourClock) {
|
|
|
4095
4263
|
}
|
|
4096
4264
|
};
|
|
4097
4265
|
const shiftMinutesRight = () => {
|
|
4098
|
-
numberString =
|
|
4266
|
+
numberString = "".concat(numberString.slice(0, 2), "0").concat(numberString[2]);
|
|
4099
4267
|
selectionModifier += 1;
|
|
4100
4268
|
};
|
|
4101
4269
|
const prependCharacter = character => {
|
|
4102
|
-
numberString =
|
|
4270
|
+
numberString = "".concat(character).concat(numberString);
|
|
4103
4271
|
selectionModifier += 1;
|
|
4104
4272
|
};
|
|
4105
4273
|
const setHoursTo12 = () => {
|
|
4106
|
-
numberString =
|
|
4274
|
+
numberString = "12".concat(numberString.slice(2));
|
|
4107
4275
|
};
|
|
4108
4276
|
const clearSecondHoursDigit = () => {
|
|
4109
|
-
numberString =
|
|
4277
|
+
numberString = "".concat(numberString.slice(0, 1), "0").concat(numberString.slice(2));
|
|
4110
4278
|
};
|
|
4111
4279
|
const hoursAre00 = () => numberString[0] === '0' && numberString[1] === '0';
|
|
4112
4280
|
const firstHourGreaterThan1 = () => {
|
|
@@ -4257,7 +4425,7 @@ const TimeInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
4257
4425
|
correctedTime,
|
|
4258
4426
|
selectionModifier
|
|
4259
4427
|
} = correctTime(next.value, is24HourClock, false);
|
|
4260
|
-
const newSelection = next
|
|
4428
|
+
const newSelection = next === null || next === void 0 ? void 0 : next.selection;
|
|
4261
4429
|
if (newSelection) {
|
|
4262
4430
|
const validTimeLength = mask.length;
|
|
4263
4431
|
newSelection.start = shouldMoveSelectionToEnd ? validTimeLength : newSelection.start;
|
|
@@ -4289,7 +4457,7 @@ const TimeInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
4289
4457
|
"aria-labelledby": ariaLabelledBy,
|
|
4290
4458
|
"aria-describedby": ariaDescribedBy,
|
|
4291
4459
|
"aria-activedescendant": ariaActiveDescendant,
|
|
4292
|
-
"data-testid": dataTestId &&
|
|
4460
|
+
"data-testid": dataTestId && "".concat(dataTestId, "-input")
|
|
4293
4461
|
}));
|
|
4294
4462
|
});
|
|
4295
4463
|
|
|
@@ -4310,8 +4478,9 @@ const TimePickerIcon = _ref => {
|
|
|
4310
4478
|
})
|
|
4311
4479
|
}, /*#__PURE__*/React__default["default"].createElement(icons_index.ChevronDownIcon, {
|
|
4312
4480
|
onClick: !isDisabled ? () => {
|
|
4481
|
+
var _inputRef$current;
|
|
4313
4482
|
setIsFlyoutOpen(i => !i);
|
|
4314
|
-
inputRef.current
|
|
4483
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
4315
4484
|
} : undefined,
|
|
4316
4485
|
onMouseDown: e => e.preventDefault(),
|
|
4317
4486
|
ref: iconRef
|
|
@@ -4341,8 +4510,8 @@ const TimePicker = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
|
|
|
4341
4510
|
'aria-describedby': ariaDescribedBy
|
|
4342
4511
|
} = _ref;
|
|
4343
4512
|
const timePickerId = index.useId(externalId);
|
|
4344
|
-
const inputId =
|
|
4345
|
-
const dropdownId =
|
|
4513
|
+
const inputId = "".concat(timePickerId, "-input");
|
|
4514
|
+
const dropdownId = "".concat(timePickerId, "-dropdown");
|
|
4346
4515
|
const [isOptionHovered, setIsOptionHovered] = React.useState(false);
|
|
4347
4516
|
const [timeObject, setTimeObject] = index.useControllableState(DEFAULT_TIME, externalOnChange, externalValue);
|
|
4348
4517
|
const defaultTimeString = convertTimeObjectToTimeString(timeObject, is24HourClock);
|
|
@@ -4471,7 +4640,7 @@ const TimePicker = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
|
|
|
4471
4640
|
break;
|
|
4472
4641
|
case 'Enter':
|
|
4473
4642
|
e.preventDefault();
|
|
4474
|
-
if (scrolledToItem
|
|
4643
|
+
if (scrolledToItem !== null && scrolledToItem !== void 0 && scrolledToItem.isFocused) {
|
|
4475
4644
|
// "focus" is on the listbox
|
|
4476
4645
|
handleSelectTime(scrolledToItem.index);
|
|
4477
4646
|
} else {
|
|
@@ -4494,7 +4663,7 @@ const TimePicker = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
|
|
|
4494
4663
|
}, /*#__PURE__*/React__default["default"].createElement(TimeInput, {
|
|
4495
4664
|
id: inputId,
|
|
4496
4665
|
dataTestId: dataTestId,
|
|
4497
|
-
ariaActiveDescendant: isFlyoutOpen && scrolledToItem
|
|
4666
|
+
ariaActiveDescendant: isFlyoutOpen && scrolledToItem !== null && scrolledToItem !== void 0 && scrolledToItem.isFocused ? dropdownItems[scrolledToItem.index].id : undefined,
|
|
4498
4667
|
ariaControls: dropdownId,
|
|
4499
4668
|
ariaExpanded: isFlyoutOpen,
|
|
4500
4669
|
onChange: handleType,
|
|
@@ -4538,9 +4707,9 @@ const {
|
|
|
4538
4707
|
Provider: ToggleButtonGroupContextProvider
|
|
4539
4708
|
} = index.createContextUtilities(null);
|
|
4540
4709
|
|
|
4541
|
-
var css_248z = ".
|
|
4542
|
-
var styles = {"default":"
|
|
4543
|
-
var stylesheet=".
|
|
4710
|
+
var css_248z = "._4-P5E{border-color:transparent;background-color:transparent;color:#515559;cursor:pointer}._pO5r1{background-color:rgba(50,54,58,.08)}._7tsZZ{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._z7lDi{color:rgba(81,85,89,.4);cursor:not-allowed}._g3YQh{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._W12WF{color:#085caf;border-color:#085caf}._UESvM,._W12WF{background:rgba(11,110,208,.11)}._UESvM{color:#0854a1;border-color:#0854a1}._xNNgy{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._f4qzl{position:relative;display:inline-grid}._f4qzl svg{fill:currentColor}._f4qzl ._bRI3y{-webkit-appearance:none;-moz-appearance:none;appearance:none;grid-column:1;grid-row:1}._f4qzl ._bRI3y+._gM0BN{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}._f4qzl ._bRI3y+._gM0BN._gMX7j{padding:5px;max-width:36px;min-width:36px}._f4qzl ._bRI3y+._gM0BN._XCTsZ{padding:0 16px}._f4qzl ._bRI3y+._gM0BN._6Mk4Q{padding:0 16px 0 12px}._f4qzl ._bRI3y:hover+._gM0BN{background-color:rgba(50,54,58,.08)}._f4qzl ._bRI3y:disabled+._gM0BN{color:rgba(81,85,89,.4);cursor:not-allowed}._f4qzl ._bRI3y:active+._gM0BN,._f4qzl ._bRI3y:focus:active+._gM0BN{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._f4qzl ._bRI3y:checked+._gM0BN{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._f4qzl ._bRI3y:checked:hover+._gM0BN{background:rgba(11,110,208,.11);color:#085caf;border-color:#085caf}._f4qzl ._bRI3y:checked:disabled+._gM0BN{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._f4qzl ._bRI3y:checked:active+._gM0BN,._f4qzl ._bRI3y:checked:focus:active+._gM0BN{background:rgba(11,110,208,.11);color:#0854a1;border-color:#0854a1}._QvJdy{display:inline-flex;position:relative}._QvJdy:before{content:\"\";border:1px solid #d9d9d9;border-radius:4px;position:absolute;top:0;bottom:0;right:0;left:0}._QvJdy>*{flex-shrink:0;flex-grow:0}._2gpoS{border:none;margin:0;padding:0}._2gpoS legend{padding:0;display:block;font-size:14px;margin-bottom:6px;color:#515559}._f4qzl ._bRI3y.focus-visible+._gM0BN,._f4qzl ._bRI3y:focus-visible+._gM0BN{z-index:20;outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
4711
|
+
var styles = {"default":"_4-P5E","hovered":"_pO5r1","pressed":"_7tsZZ","disabled":"_z7lDi","selectedDefault":"_g3YQh","selectedHovered":"_W12WF","selectedPressed":"_UESvM","selectedDisabled":"_xNNgy","toggleContainer":"_f4qzl","toggleInput":"_bRI3y","toggleButton":"_gM0BN","iconOnly":"_gMX7j","text":"_XCTsZ","iconText":"_6Mk4Q","toggleButtonGroup":"_QvJdy","toggleButtonGroupFieldset":"_2gpoS"};
|
|
4712
|
+
var stylesheet="._4-P5E{border-color:transparent;background-color:transparent;color:#515559;cursor:pointer}._pO5r1{background-color:rgba(50,54,58,.08)}._7tsZZ{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._z7lDi{color:rgba(81,85,89,.4);cursor:not-allowed}._g3YQh{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._W12WF{color:#085caf;border-color:#085caf}._UESvM,._W12WF{background:rgba(11,110,208,.11)}._UESvM{color:#0854a1;border-color:#0854a1}._xNNgy{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._f4qzl{position:relative;display:inline-grid}._f4qzl svg{fill:currentColor}._f4qzl ._bRI3y{-webkit-appearance:none;-moz-appearance:none;appearance:none;grid-column:1;grid-row:1}._f4qzl ._bRI3y+._gM0BN{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}._f4qzl ._bRI3y+._gM0BN._gMX7j{padding:5px;max-width:36px;min-width:36px}._f4qzl ._bRI3y+._gM0BN._XCTsZ{padding:0 16px}._f4qzl ._bRI3y+._gM0BN._6Mk4Q{padding:0 16px 0 12px}._f4qzl ._bRI3y:hover+._gM0BN{background-color:rgba(50,54,58,.08)}._f4qzl ._bRI3y:disabled+._gM0BN{color:rgba(81,85,89,.4);cursor:not-allowed}._f4qzl ._bRI3y:active+._gM0BN,._f4qzl ._bRI3y:focus:active+._gM0BN{color:#0b6ed0;background-color:rgba(11,110,208,.08)}._f4qzl ._bRI3y:checked+._gM0BN{background:rgba(11,110,208,.08);color:#0b6ed0;border-color:#0b6ed0}._f4qzl ._bRI3y:checked:hover+._gM0BN{background:rgba(11,110,208,.11);color:#085caf;border-color:#085caf}._f4qzl ._bRI3y:checked:disabled+._gM0BN{background:rgba(11,110,208,.032);color:rgba(11,110,208,.4);border-color:rgba(11,110,208,.4)}._f4qzl ._bRI3y:checked:active+._gM0BN,._f4qzl ._bRI3y:checked:focus:active+._gM0BN{background:rgba(11,110,208,.11);color:#0854a1;border-color:#0854a1}._QvJdy{display:inline-flex;position:relative}._QvJdy:before{content:\"\";border:1px solid #d9d9d9;border-radius:4px;position:absolute;top:0;bottom:0;right:0;left:0}._QvJdy>*{flex-shrink:0;flex-grow:0}._2gpoS{border:none;margin:0;padding:0}._2gpoS legend{padding:0;display:block;font-size:14px;margin-bottom:6px;color:#515559}._f4qzl ._bRI3y.focus-visible+._gM0BN,._f4qzl ._bRI3y:focus-visible+._gM0BN{z-index:20;outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
4544
4713
|
icons_index.styleInject(css_248z);
|
|
4545
4714
|
|
|
4546
4715
|
const ToggleButtonGroup = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|