@qualtrics/ui-react 2.21.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 +12 -0
- package/dist/__shared/cjs/{index-201e8786.js → index-025620bf.js} +666 -549
- package/dist/__shared/cjs/{index-0ae99de2.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 -9
- package/dist/components/ColorPicker/ColorPicker.js +10 -8
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/ColorPicker/ColorPickerFlyoutInputs.js +8 -6
- package/dist/components/ColorPicker/Hue.js +3 -2
- package/dist/components/ColorPicker/Palette.js +7 -5
- package/dist/components/ColorPicker/Saturation.js +9 -8
- 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 +47 -26
- 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 -9
- 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 +4 -3
- package/dist/components/Dropdown/DropdownSearch.js +10 -4
- package/dist/components/FilePicker/FilePicker.js +13 -6
- 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 +10 -7
- 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 +10 -4
- 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 -2
- 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 +1 -1
- package/dist/hooks/useId/useId.js +1 -1
- package/dist/hooks/useOverlay/useOverlay.js +6 -4
- 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 +14 -7
- package/dist/index.es.js +1 -1
- package/dist/index.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTable.js +60 -49
- 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 +5 -3
- 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 +5 -3
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuItem.js +10 -8
- package/dist/next/Menu/MenuPane.js +20 -8
- package/dist/next/Menu/SubMenu.js +12 -8
- package/dist/next/Menu/useMutationObserver.js +1 -1
- package/dist/next/Menu/usePaneSearch.js +27 -15
- 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 +1 -1
- package/dist/next/index.js +298 -219
- 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/mediaQueryManager/mediaQueryManager.js +1 -1
- package/dist/utils/mergeRefs/mergeRefs.js +1 -1
- package/dist/utils/wrapEvent/wrapEvent.js +2 -2
- package/next/package.json +1 -1
- package/package.json +2 -2
package/dist/next/Menu/Menu2.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"buttonContainer":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._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}";
|
|
4
|
+
var styles = {"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"};
|
|
5
|
+
var stylesheet="._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}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -37,14 +37,16 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
37
37
|
} = useFocusVisible({
|
|
38
38
|
isTextInput: true
|
|
39
39
|
});
|
|
40
|
-
const dataTestId = getSubDataTestId(menuParentDataTestId
|
|
40
|
+
const dataTestId = getSubDataTestId(menuParentDataTestId === null || menuParentDataTestId === void 0 ? void 0 : menuParentDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM), String(index));
|
|
41
41
|
const isVisible = useMemo(() => {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
var _context;
|
|
43
|
+
const searchMatcher = label !== null && label !== void 0 ? label : typeof children === 'string' ? children : undefined;
|
|
44
|
+
return isSearchFilteringDisabled || !searchValue || (searchMatcher === null || searchMatcher === void 0 ? void 0 : _includesInstanceProperty(_context = searchMatcher.toLowerCase()).call(_context, searchValue.toLowerCase()));
|
|
44
45
|
}, [children, searchValue, label, isSearchFilteringDisabled]);
|
|
45
46
|
const handleFocus = () => {
|
|
46
47
|
if (itemRef.current && flyoutRef.current && isFocusVisible) {
|
|
47
|
-
|
|
48
|
+
var _stickyBoxRef$current, _stickyBoxRef$current2;
|
|
49
|
+
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;
|
|
48
50
|
|
|
49
51
|
// if the top of the focused menu item is beneath the sticky box
|
|
50
52
|
if (itemRef.current.offsetTop < flyoutRef.current.scrollTop + stickyBoxHeight) {
|
|
@@ -62,20 +64,20 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
62
64
|
"data-testid": dataTestId,
|
|
63
65
|
ref: mergeRefs(ref, itemRef),
|
|
64
66
|
onKeyDown: e => {
|
|
65
|
-
var
|
|
67
|
+
var _context2;
|
|
66
68
|
if (!isInteractive) {
|
|
67
69
|
e.preventDefault();
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
|
-
if (_includesInstanceProperty(
|
|
71
|
-
closeSubmenu
|
|
72
|
+
if (_includesInstanceProperty(_context2 = KEYS.CLOSE_SUBMENU).call(_context2, e.key)) {
|
|
73
|
+
closeSubmenu === null || closeSubmenu === void 0 ? void 0 : closeSubmenu(e);
|
|
72
74
|
}
|
|
73
75
|
},
|
|
74
76
|
onFocus: handleFocus
|
|
75
77
|
// stop radix from closing the menu on selection of disabled item
|
|
76
78
|
// other pointer and keyboard events still work, even when disabled
|
|
77
79
|
,
|
|
78
|
-
onSelect: e => isDisabled ? e.preventDefault() : onSelect
|
|
80
|
+
onSelect: e => isDisabled ? e.preventDefault() : onSelect === null || onSelect === void 0 ? void 0 : onSelect()
|
|
79
81
|
}), (!children || typeof children === 'string') && label ? label : children) : null;
|
|
80
82
|
});
|
|
81
83
|
|
|
@@ -18,6 +18,7 @@ import { useDidUpdate } from '../../hooks/useDidUpdate/useDidUpdate.js';
|
|
|
18
18
|
import mergeRefs from '../../utils/mergeRefs/mergeRefs.js';
|
|
19
19
|
|
|
20
20
|
const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
21
|
+
var _flyoutRef$current$pa, _flyoutRef$current2, _flyoutRef$current3;
|
|
21
22
|
let {
|
|
22
23
|
placement,
|
|
23
24
|
children,
|
|
@@ -33,7 +34,10 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
33
34
|
const flyoutRef = useRef(null);
|
|
34
35
|
const stickyBoxRef = useRef(null);
|
|
35
36
|
const portalTarget = usePortalTarget();
|
|
36
|
-
const [side, align] = useMemo(() =>
|
|
37
|
+
const [side, align] = useMemo(() => {
|
|
38
|
+
var _placement$split, _placement$split2;
|
|
39
|
+
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 : [];
|
|
40
|
+
}, [placement]);
|
|
37
41
|
const {
|
|
38
42
|
dataTestId: rootDataTestId,
|
|
39
43
|
openPaneDepth,
|
|
@@ -65,7 +69,8 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
65
69
|
if (openPaneDepth === thisPanesDepth) {
|
|
66
70
|
if (initialHeightOfThisPane.current === null) {
|
|
67
71
|
window.requestAnimationFrame(() => {
|
|
68
|
-
|
|
72
|
+
var _flyoutRef$current$cl, _flyoutRef$current;
|
|
73
|
+
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;
|
|
69
74
|
setMaskHeight(initialHeightOfThisPane.current);
|
|
70
75
|
});
|
|
71
76
|
} else {
|
|
@@ -74,7 +79,8 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
74
79
|
}
|
|
75
80
|
}, [openPaneDepth]);
|
|
76
81
|
const defaultSide = useMemo(() => {
|
|
77
|
-
|
|
82
|
+
var _triggerRef$current;
|
|
83
|
+
const rect = triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.getBoundingClientRect();
|
|
78
84
|
if (!rect) {
|
|
79
85
|
return 'bottom';
|
|
80
86
|
}
|
|
@@ -98,11 +104,14 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
98
104
|
return 'bottom';
|
|
99
105
|
}, [open, triggerRef]);
|
|
100
106
|
const [transform, setTransform] = useState('');
|
|
101
|
-
const target = flyoutRef.current
|
|
107
|
+
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;
|
|
102
108
|
useMutationObserver(target, {
|
|
103
109
|
attributes: true,
|
|
104
110
|
attributeFilter: ['style']
|
|
105
|
-
}, () =>
|
|
111
|
+
}, () => {
|
|
112
|
+
var _style$transform, _style;
|
|
113
|
+
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 : '');
|
|
114
|
+
});
|
|
106
115
|
return /*#__PURE__*/React__default.createElement(PaneContextProvider, {
|
|
107
116
|
items: items,
|
|
108
117
|
setItems: setItems,
|
|
@@ -120,7 +129,10 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
120
129
|
className: styles.maskContainer,
|
|
121
130
|
id: maskContainerId
|
|
122
131
|
}, /*#__PURE__*/React__default.createElement(Content, _extends({}, rest, {
|
|
123
|
-
onCloseAutoFocus: () =>
|
|
132
|
+
onCloseAutoFocus: () => {
|
|
133
|
+
var _triggerRef$current2;
|
|
134
|
+
return triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current2 = triggerRef.current) === null || _triggerRef$current2 === void 0 ? void 0 : _triggerRef$current2.focus();
|
|
135
|
+
},
|
|
124
136
|
sideOffset: 6,
|
|
125
137
|
loop: !isSearchable,
|
|
126
138
|
side: side || defaultSide,
|
|
@@ -133,7 +145,7 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
133
145
|
onInteractOutside: onInteractOutside,
|
|
134
146
|
style: {
|
|
135
147
|
...style,
|
|
136
|
-
height: internalSearchValue && openPaneDepth === thisPanesDepth ? undefined : maskHeight
|
|
148
|
+
height: internalSearchValue && openPaneDepth === thisPanesDepth ? undefined : maskHeight !== null && maskHeight !== void 0 ? maskHeight : undefined
|
|
137
149
|
}
|
|
138
150
|
}), isSearchable && /*#__PURE__*/React__default.createElement("div", {
|
|
139
151
|
className: classNames(styles.stickyBox, styles.isSearchable),
|
|
@@ -142,7 +154,7 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
142
154
|
className: styles.searchBoxesContainer,
|
|
143
155
|
style: {
|
|
144
156
|
transform,
|
|
145
|
-
width: flyoutRef.current
|
|
157
|
+
width: (_flyoutRef$current3 = flyoutRef.current) === null || _flyoutRef$current3 === void 0 ? void 0 : _flyoutRef$current3.clientWidth
|
|
146
158
|
}
|
|
147
159
|
}, searchBarConfigs.length ? searchBarConfigs.map(_ref2 => {
|
|
148
160
|
let {
|
|
@@ -71,8 +71,8 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
71
71
|
noSearchResultsNode,
|
|
72
72
|
onInteractOutside
|
|
73
73
|
} = usePaneSearch(isSearchable, externalSearchValue, onSearchValueChange, items, animatedLeft, animatedRight, paneDataTestId, internalId, flyoutRef, backButtonRef, closeThisSubmenu);
|
|
74
|
-
const backButtonDataTestId = paneDataTestId
|
|
75
|
-
const triggerDataTestId = paneDataTestId
|
|
74
|
+
const backButtonDataTestId = paneDataTestId === null || paneDataTestId === void 0 ? void 0 : paneDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_BACK);
|
|
75
|
+
const triggerDataTestId = paneDataTestId === null || paneDataTestId === void 0 ? void 0 : paneDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM);
|
|
76
76
|
const triggerIsVisible = useMemo(() => {
|
|
77
77
|
var _context;
|
|
78
78
|
return isSearchFilteringDisabledForPaneContainingTrigger || !paneContainingTriggerSearchValue || typeof label === 'string' && _includesInstanceProperty(_context = label.toLowerCase()).call(_context, paneContainingTriggerSearchValue.toLowerCase());
|
|
@@ -85,7 +85,7 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
85
85
|
window.requestAnimationFrame(() => setIsFrameAfterPaneAddedToDOM(false));
|
|
86
86
|
}
|
|
87
87
|
registerSubmenu(internalId, isPaneInDOM);
|
|
88
|
-
onIsOpenChange
|
|
88
|
+
onIsOpenChange === null || onIsOpenChange === void 0 ? void 0 : onIsOpenChange(isPaneInDOM);
|
|
89
89
|
}, [isPaneInDOM]);
|
|
90
90
|
|
|
91
91
|
// Omitted dependencies because this should only run on unmount
|
|
@@ -93,7 +93,8 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
93
93
|
useEffect(() => () => registerSubmenu(internalId, false), []);
|
|
94
94
|
useDidUpdate(() => {
|
|
95
95
|
if (thisPanesDepth === totalOpenPaneDepth) {
|
|
96
|
-
|
|
96
|
+
var _flyoutRef$current$cl, _flyoutRef$current;
|
|
97
|
+
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);
|
|
97
98
|
}
|
|
98
99
|
},
|
|
99
100
|
// ignoring other dependencies because this should only run when the children change
|
|
@@ -101,24 +102,27 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
101
102
|
useDidUpdate(() => {
|
|
102
103
|
if (thisPanesDepth === totalOpenPaneDepth) {
|
|
103
104
|
window.requestAnimationFrame(() => {
|
|
104
|
-
|
|
105
|
+
var _flyoutRef$current$cl2, _flyoutRef$current2;
|
|
106
|
+
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);
|
|
105
107
|
});
|
|
106
108
|
}
|
|
107
109
|
}, [totalOpenPaneDepth, internalSearchValue]);
|
|
108
110
|
const handlePaneTransitionEnd = () => {
|
|
111
|
+
var _flyoutRef$current3;
|
|
109
112
|
if (animatedLeft) {
|
|
110
113
|
return;
|
|
111
114
|
}
|
|
112
115
|
if (animatedRight) {
|
|
113
116
|
setIsPaneInDOM(false);
|
|
114
117
|
if (isFocusVisible) {
|
|
115
|
-
|
|
118
|
+
var _triggerRef$current;
|
|
119
|
+
(_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.focus();
|
|
116
120
|
}
|
|
117
121
|
return;
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
// if the newly closed submenu doesn't place the focus on its trigger due to mouse events
|
|
121
|
-
if (!flyoutRef.current
|
|
125
|
+
if (!((_flyoutRef$current3 = flyoutRef.current) !== null && _flyoutRef$current3 !== void 0 && _flyoutRef$current3.contains(document.activeElement)) && isFocusVisible) {
|
|
122
126
|
if (triggerRef.current && paneContainingTriggerIsInteractive) {
|
|
123
127
|
triggerRef.current.focus();
|
|
124
128
|
} else if (backButtonRef.current) {
|
|
@@ -146,7 +150,7 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
146
150
|
if (!isDisabled && _includesInstanceProperty(_context2 = KEYS.OPEN_SUBMENU).call(_context2, e.key)) {
|
|
147
151
|
setIsPaneInDOM(true);
|
|
148
152
|
} else if (_includesInstanceProperty(_context3 = KEYS.CLOSE_SUBMENU).call(_context3, e.key)) {
|
|
149
|
-
closeSubmenuContainingTrigger
|
|
153
|
+
closeSubmenuContainingTrigger === null || closeSubmenuContainingTrigger === void 0 ? void 0 : closeSubmenuContainingTrigger(e);
|
|
150
154
|
}
|
|
151
155
|
}
|
|
152
156
|
}, label, /*#__PURE__*/React__default.createElement(ChevronRightIcon, {
|
|
@@ -8,7 +8,7 @@ const useMutationObserver = (target, options, onMutate) => useEffect(() => {
|
|
|
8
8
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9
9
|
args[_key] = arguments[_key];
|
|
10
10
|
}
|
|
11
|
-
onMutate
|
|
11
|
+
onMutate === null || onMutate === void 0 ? void 0 : onMutate(...args);
|
|
12
12
|
});
|
|
13
13
|
observer.observe(target, options);
|
|
14
14
|
return () => observer.disconnect();
|
|
@@ -15,6 +15,7 @@ import useEventListener from '../../hooks/useEventListener/useEventListener.js';
|
|
|
15
15
|
// creates a searchBarConfig, which maps to an instance of `MenuSearch`
|
|
16
16
|
// returns values that are necessary for use within pane
|
|
17
17
|
function usePaneSearch(isSearchable, externalSearchValue, onSearchValueChange, items, animatedLeft, animatedRight, menuParentDataTestId, id, flyoutRef) {
|
|
18
|
+
var _searchRef$current$qu, _searchRef$current;
|
|
18
19
|
let backButtonRef = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : undefined;
|
|
19
20
|
let closeSubmenu = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : undefined;
|
|
20
21
|
const [internalSearchValue, setSearchValue] = useControllableState(externalSearchValue, onSearchValueChange, externalSearchValue);
|
|
@@ -24,49 +25,60 @@ function usePaneSearch(isSearchable, externalSearchValue, onSearchValueChange, i
|
|
|
24
25
|
} = useTranslation();
|
|
25
26
|
const noMatchesText = translate('menu.noItemsToDisplay');
|
|
26
27
|
const searchPlaceholder = translate('searchText');
|
|
27
|
-
useEffect(() => setZeroSearchResults(items
|
|
28
|
+
useEffect(() => setZeroSearchResults((items === null || items === void 0 ? void 0 : items.filter(item => item.element.current).length) === 0), [items, internalSearchValue]);
|
|
28
29
|
const {
|
|
29
30
|
isFocusVisible
|
|
30
31
|
} = useFocusVisible({
|
|
31
32
|
isTextInput: true
|
|
32
33
|
});
|
|
33
34
|
const searchRef = useRef(null);
|
|
34
|
-
const searchInput = searchRef.current
|
|
35
|
-
const getFirstNonNullItem = () =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
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;
|
|
36
|
+
const getFirstNonNullItem = () => {
|
|
37
|
+
var _backButtonRef$curren, _items$find;
|
|
38
|
+
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;
|
|
39
|
+
};
|
|
40
|
+
const getLastNonNullItem = () => {
|
|
41
|
+
var _findLast$element$cur, _findLast;
|
|
42
|
+
return (// our tsconfig does not target a recent enough version to use `Array.prototype.findLast`
|
|
43
|
+
(_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
|
|
44
|
+
);
|
|
45
|
+
};
|
|
39
46
|
useEventListener(flyoutRef, 'keydown', e => {
|
|
40
47
|
var _context, _context2;
|
|
41
48
|
if (_includesInstanceProperty(_context = KEYS.NAVIGATE_UP).call(_context, e.key) && e.target === getFirstNonNullItem() || _includesInstanceProperty(_context2 = KEYS.NAVIGATE_DOWN).call(_context2, e.key) && e.target === getLastNonNullItem()) {
|
|
42
|
-
searchInput
|
|
49
|
+
searchInput === null || searchInput === void 0 ? void 0 : searchInput.focus();
|
|
43
50
|
}
|
|
44
51
|
}, {
|
|
45
52
|
additionalDependencies: [flyoutRef.current],
|
|
46
53
|
isDisabled: !isSearchable
|
|
47
54
|
});
|
|
48
55
|
useEventListener(searchInput, 'keydown', e => {
|
|
49
|
-
var _context3, _context4, _context5, _context6;
|
|
56
|
+
var _context3, _context4, _context5, _e$target, _context6;
|
|
50
57
|
if (_includesInstanceProperty(_context3 = [...KEYS.NAVIGATE_DOWN, ...KEYS.NAVIGATE_TOP]).call(_context3, e.key)) {
|
|
58
|
+
var _getFirstNonNullItem;
|
|
51
59
|
// prevent scrolling
|
|
52
60
|
e.preventDefault();
|
|
53
|
-
getFirstNonNullItem()
|
|
61
|
+
(_getFirstNonNullItem = getFirstNonNullItem()) === null || _getFirstNonNullItem === void 0 ? void 0 : _getFirstNonNullItem.focus();
|
|
54
62
|
} else if (_includesInstanceProperty(_context4 = [...KEYS.NAVIGATE_UP, ...KEYS.NAVIIGATE_BOTTOM]).call(_context4, e.key)) {
|
|
63
|
+
var _getLastNonNullItem;
|
|
55
64
|
// prevent scrolling
|
|
56
65
|
e.preventDefault();
|
|
57
|
-
getLastNonNullItem()
|
|
58
|
-
} else if (_includesInstanceProperty(_context5 = KEYS.CLOSE_SUBMENU).call(_context5, e.key) && e.target
|
|
59
|
-
closeSubmenu
|
|
66
|
+
(_getLastNonNullItem = getLastNonNullItem()) === null || _getLastNonNullItem === void 0 ? void 0 : _getLastNonNullItem.focus();
|
|
67
|
+
} else if (_includesInstanceProperty(_context5 = KEYS.CLOSE_SUBMENU).call(_context5, e.key) && ((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.selectionStart) === 0) {
|
|
68
|
+
closeSubmenu === null || closeSubmenu === void 0 ? void 0 : closeSubmenu(e);
|
|
60
69
|
} else if (_includesInstanceProperty(_context6 = KEYS.IGNORED_BY_SEARCH_INPUT).call(_context6, e.key)) {
|
|
61
70
|
e.preventDefault();
|
|
62
71
|
}
|
|
63
72
|
});
|
|
64
|
-
useEventListener(searchInput, 'blur', () => !isFocusVisible && !animatedLeft && !animatedRight && searchInput
|
|
73
|
+
useEventListener(searchInput, 'blur', () => !isFocusVisible && !animatedLeft && !animatedRight && (searchInput === null || searchInput === void 0 ? void 0 : searchInput.focus()));
|
|
65
74
|
const {
|
|
66
75
|
searchBarConfigs,
|
|
67
76
|
setSearchBarConfigs
|
|
68
77
|
} = useMenuContext();
|
|
69
|
-
const onInteractOutside = useCallback(e => searchBarConfigs.some(config =>
|
|
78
|
+
const onInteractOutside = useCallback(e => searchBarConfigs.some(config => {
|
|
79
|
+
var _config$ref$current;
|
|
80
|
+
return (_config$ref$current = config.ref.current) === null || _config$ref$current === void 0 ? void 0 : _config$ref$current.contains(e.target);
|
|
81
|
+
}) && e.preventDefault(), [searchBarConfigs]);
|
|
70
82
|
useEffect(() => {
|
|
71
83
|
if (!isSearchable) {
|
|
72
84
|
return undefined;
|
|
@@ -78,7 +90,7 @@ function usePaneSearch(isSearchable, externalSearchValue, onSearchValueChange, i
|
|
|
78
90
|
isInteractive: !animatedLeft && !animatedRight,
|
|
79
91
|
animatedLeft,
|
|
80
92
|
animatedRight,
|
|
81
|
-
dataTestId: menuParentDataTestId
|
|
93
|
+
dataTestId: menuParentDataTestId === null || menuParentDataTestId === void 0 ? void 0 : menuParentDataTestId.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_SEARCH),
|
|
82
94
|
setSearchValue,
|
|
83
95
|
ref: searchRef,
|
|
84
96
|
id,
|
|
@@ -34,9 +34,10 @@ const PhoneNumberInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
34
34
|
translate
|
|
35
35
|
} = useTranslation();
|
|
36
36
|
const getMinMaxLength = useCallback(() => {
|
|
37
|
+
var _metadata$numberingPl;
|
|
37
38
|
const metadata = new Metadata();
|
|
38
39
|
metadata.selectNumberingPlan(countryCode);
|
|
39
|
-
const possibleLengths = metadata
|
|
40
|
+
const possibleLengths = metadata === null || metadata === void 0 ? void 0 : (_metadata$numberingPl = metadata.numberingPlan) === null || _metadata$numberingPl === void 0 ? void 0 : _metadata$numberingPl.possibleLengths();
|
|
40
41
|
return possibleLengths ? [Math.min(...possibleLengths), Math.max(...possibleLengths)] : [0, genericMaxNumberLength];
|
|
41
42
|
}, [countryCode]);
|
|
42
43
|
const shouldUseMask = Number(getCountryCallingCode(countryCode)) === 1;
|
|
@@ -50,7 +51,7 @@ const PhoneNumberInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
50
51
|
useEffect(() => {
|
|
51
52
|
updateMask();
|
|
52
53
|
}, [countryCode, updateMask]);
|
|
53
|
-
const removeNonNumericCharacters = value => value
|
|
54
|
+
const removeNonNumericCharacters = value => value === null || value === void 0 ? void 0 : value.replace(/\D/g, '');
|
|
54
55
|
const handleInputChange = a => {
|
|
55
56
|
// remove all non-numeric characters
|
|
56
57
|
const value = removeNonNumericCharacters(a.target.value);
|
|
@@ -66,12 +67,12 @@ const PhoneNumberInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
66
67
|
} catch (e) {
|
|
67
68
|
// `parsePhoneNumber` throws an error if the inputs are invalid.
|
|
68
69
|
}
|
|
69
|
-
onChange
|
|
70
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(internationalNumber, isValidLength, countryCode, value);
|
|
70
71
|
};
|
|
71
72
|
const inputClassNames = classNames(styles.input, {
|
|
72
73
|
[styles.disabled]: isDisabled
|
|
73
74
|
});
|
|
74
|
-
const dropdownLabel = useMemo(() => countryCode ?
|
|
75
|
+
const dropdownLabel = useMemo(() => countryCode ? "+".concat(getCountryCallingCode(countryCode)) : undefined, [countryCode]);
|
|
75
76
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
76
77
|
className: styles.container,
|
|
77
78
|
"data-testid": dataTestId
|
|
@@ -88,14 +89,14 @@ const PhoneNumberInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
88
89
|
disabled: isDisabled,
|
|
89
90
|
"aria-label": buttonAriaLabel,
|
|
90
91
|
"aria-labelledby": buttonAriaLabelledBy
|
|
91
|
-
}, (countryCodes
|
|
92
|
+
}, (countryCodes !== null && countryCodes !== void 0 ? countryCodes : getCountries()).map(individualCountryCode => {
|
|
92
93
|
if (!isSupportedCountry(individualCountryCode)) {
|
|
93
94
|
return null;
|
|
94
95
|
}
|
|
95
96
|
return /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
96
97
|
key: individualCountryCode,
|
|
97
98
|
value: individualCountryCode
|
|
98
|
-
},
|
|
99
|
+
}, "".concat(translate(individualCountryCode), " +").concat(getCountryCallingCode(individualCountryCode)));
|
|
99
100
|
})), /*#__PURE__*/React__default.createElement(InputMask, {
|
|
100
101
|
value: isDisabled ? removeNonNumericCharacters(initialValue) : undefined,
|
|
101
102
|
type: "tel",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"input":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._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}";
|
|
4
|
+
var styles = {"input":"_YIYhi","disabled":"_8-lxx","dropdown":"_Sijhl","container":"_SAdmy","countryCode":"_Aoh3n"};
|
|
5
|
+
var stylesheet="._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}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -33,8 +33,14 @@ const SplitButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
33
33
|
const [mainButtonHasFocus, setMainButtonHasFocus] = useState(false);
|
|
34
34
|
|
|
35
35
|
// 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.
|
|
36
|
-
useEventListener(mainButtonRef, 'keydown', e =>
|
|
37
|
-
|
|
36
|
+
useEventListener(mainButtonRef, 'keydown', e => {
|
|
37
|
+
var _dropdownButtonRef$cu;
|
|
38
|
+
return e.key === 'ArrowRight' && ((_dropdownButtonRef$cu = dropdownButtonRef.current) === null || _dropdownButtonRef$cu === void 0 ? void 0 : _dropdownButtonRef$cu.focus());
|
|
39
|
+
});
|
|
40
|
+
useEventListener(dropdownButtonRef, 'keydown', e => {
|
|
41
|
+
var _mainButtonRef$curren;
|
|
42
|
+
return e.key === 'ArrowLeft' && ((_mainButtonRef$curren = mainButtonRef.current) === null || _mainButtonRef$curren === void 0 ? void 0 : _mainButtonRef$curren.focus());
|
|
43
|
+
});
|
|
38
44
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
39
45
|
"data-testid": dataTestId,
|
|
40
46
|
className: classNames(styles.container, className),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"container":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._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}";
|
|
4
|
+
var styles = {"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"};
|
|
5
|
+
var stylesheet="._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}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -43,14 +43,14 @@ const TimeDropdown = _ref => {
|
|
|
43
43
|
"aria-label": ariaLabel,
|
|
44
44
|
"aria-labelledby": ariaLabelledBy,
|
|
45
45
|
"aria-describedby": ariaDescribedBy,
|
|
46
|
-
"data-testid": dataTestId &&
|
|
46
|
+
"data-testid": dataTestId && "".concat(dataTestId, "-dropdown"),
|
|
47
47
|
className: styles.flyout,
|
|
48
48
|
onMouseOver: () => setIsOptionHovered(true),
|
|
49
49
|
onMouseLeave: () => setIsOptionHovered(false)
|
|
50
50
|
}, items.map((item, index) => /*#__PURE__*/React__default.createElement(FlyoutOption, {
|
|
51
51
|
id: item.id,
|
|
52
52
|
isHighlightedOnHover: true,
|
|
53
|
-
isHighlighted: scrolledToItem
|
|
53
|
+
isHighlighted: (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.index) === index && (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.isFocused),
|
|
54
54
|
key: item.label,
|
|
55
55
|
ref: node => {
|
|
56
56
|
if (node) {
|
|
@@ -59,9 +59,9 @@ const TimeDropdown = _ref => {
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
onClick: () => onClick(index),
|
|
62
|
-
"data-testid": dataTestId &&
|
|
62
|
+
"data-testid": dataTestId && "".concat(dataTestId, "-option-").concat(index),
|
|
63
63
|
className: classNames(styles.option, {
|
|
64
|
-
[styles.exactMatch]: scrolledToItem
|
|
64
|
+
[styles.exactMatch]: (scrolledToItem === null || scrolledToItem === void 0 ? void 0 : scrolledToItem.index) === index && scrolledToItem.isExactMatch && !isOptionHovered
|
|
65
65
|
})
|
|
66
66
|
}, item.label))),
|
|
67
67
|
anchorNode: inputRef.current,
|
|
@@ -47,7 +47,7 @@ const TimeInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
47
47
|
correctedTime,
|
|
48
48
|
selectionModifier
|
|
49
49
|
} = correctTime(next.value, is24HourClock, false);
|
|
50
|
-
const newSelection = next
|
|
50
|
+
const newSelection = next === null || next === void 0 ? void 0 : next.selection;
|
|
51
51
|
if (newSelection) {
|
|
52
52
|
const validTimeLength = mask.length;
|
|
53
53
|
newSelection.start = shouldMoveSelectionToEnd ? validTimeLength : newSelection.start;
|
|
@@ -79,7 +79,7 @@ const TimeInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
79
79
|
"aria-labelledby": ariaLabelledBy,
|
|
80
80
|
"aria-describedby": ariaDescribedBy,
|
|
81
81
|
"aria-activedescendant": ariaActiveDescendant,
|
|
82
|
-
"data-testid": dataTestId &&
|
|
82
|
+
"data-testid": dataTestId && "".concat(dataTestId, "-input")
|
|
83
83
|
}));
|
|
84
84
|
});
|
|
85
85
|
|
|
@@ -34,8 +34,8 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
34
34
|
'aria-describedby': ariaDescribedBy
|
|
35
35
|
} = _ref;
|
|
36
36
|
const timePickerId = useId(externalId);
|
|
37
|
-
const inputId =
|
|
38
|
-
const dropdownId =
|
|
37
|
+
const inputId = "".concat(timePickerId, "-input");
|
|
38
|
+
const dropdownId = "".concat(timePickerId, "-dropdown");
|
|
39
39
|
const [isOptionHovered, setIsOptionHovered] = useState(false);
|
|
40
40
|
const [timeObject, setTimeObject] = useControllableState(DEFAULT_TIME, externalOnChange, externalValue);
|
|
41
41
|
const defaultTimeString = convertTimeObjectToTimeString(timeObject, is24HourClock);
|
|
@@ -164,7 +164,7 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
164
164
|
break;
|
|
165
165
|
case 'Enter':
|
|
166
166
|
e.preventDefault();
|
|
167
|
-
if (scrolledToItem
|
|
167
|
+
if (scrolledToItem !== null && scrolledToItem !== void 0 && scrolledToItem.isFocused) {
|
|
168
168
|
// "focus" is on the listbox
|
|
169
169
|
handleSelectTime(scrolledToItem.index);
|
|
170
170
|
} else {
|
|
@@ -187,7 +187,7 @@ const TimePicker = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
187
187
|
}, /*#__PURE__*/React__default.createElement(TimeInput, {
|
|
188
188
|
id: inputId,
|
|
189
189
|
dataTestId: dataTestId,
|
|
190
|
-
ariaActiveDescendant: isFlyoutOpen && scrolledToItem
|
|
190
|
+
ariaActiveDescendant: isFlyoutOpen && scrolledToItem !== null && scrolledToItem !== void 0 && scrolledToItem.isFocused ? dropdownItems[scrolledToItem.index].id : undefined,
|
|
191
191
|
ariaControls: dropdownId,
|
|
192
192
|
ariaExpanded: isFlyoutOpen,
|
|
193
193
|
onChange: handleType,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"container":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._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)}";
|
|
4
|
+
var styles = {"container":"_Li157","input":"_qGkcS","icon":"_gv4Jw","open":"_9W5cr","disabled":"_g5S4T","ignoreFocusStyle":"_txezi","flyout":"_FjddE","option":"_Yf4jJ","exactMatch":"_QMeNI"};
|
|
5
|
+
var stylesheet="._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)}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -23,8 +23,9 @@ const TimePickerIcon = _ref => {
|
|
|
23
23
|
})
|
|
24
24
|
}, /*#__PURE__*/React__default.createElement(ChevronDownIcon, {
|
|
25
25
|
onClick: !isDisabled ? () => {
|
|
26
|
+
var _inputRef$current;
|
|
26
27
|
setIsFlyoutOpen(i => !i);
|
|
27
|
-
inputRef.current
|
|
28
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
28
29
|
} : undefined,
|
|
29
30
|
onMouseDown: e => e.preventDefault(),
|
|
30
31
|
ref: iconRef
|