@qualtrics/ui-react 2.19.0 → 2.20.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 +45 -0
- package/dist/__shared/cjs/{index-bf07471d.js → index-579c4690.js} +10 -7
- package/dist/__shared/cjs/{index-4e4cc354.js → index-90d4069b.js} +999 -1875
- package/dist/components/Accordion/Accordion.js +1 -5
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Accordion/AccordionHeader.js +8 -10
- package/dist/components/Accordion/AccordionPanel.js +3 -3
- package/dist/components/BreakpointSwitch/Breakpoint.js +0 -2
- package/dist/components/BreakpointSwitch/BreakpointSwitch.js +0 -3
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Button/Button2.js +2 -7
- package/dist/components/ButtonGroup/ButtonGroup.js +1 -2
- 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/VisualCheckbox.js +1 -1
- package/dist/components/Checkbox/VisualCheckbox2.js +3 -3
- package/dist/components/ColorPicker/Alpha.js +9 -30
- package/dist/components/ColorPicker/ColorPicker.js +33 -42
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/ColorPicker/ColorPickerFlyout.js +2 -1
- package/dist/components/ColorPicker/ColorPickerFlyoutInputs.js +20 -23
- package/dist/components/ColorPicker/Hue.js +2 -19
- package/dist/components/ColorPicker/Palette.js +7 -27
- package/dist/components/ColorPicker/Saturation.js +8 -29
- package/dist/components/ColorPicker/utils/calculateTargetId.js +10 -20
- package/dist/components/ColorPicker/utils/getMousePosition.js +4 -3
- package/dist/components/ColorPicker/utils/hexToHsv.js +0 -5
- package/dist/components/ColorPicker/utils/hexToRgbaString.js +2 -4
- package/dist/components/ColorPicker/utils/hsvToHex.js +0 -3
- package/dist/components/ColorPicker/utils/rgbToHex.js +1 -1
- package/dist/components/ColorPicker/utils/validateHex.js +12 -19
- package/dist/components/Combobox/Combobox.js +57 -127
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/Combobox/ComboboxHeader.js +1 -1
- package/dist/components/Combobox/ComboboxIcon.js +2 -4
- package/dist/components/Combobox/ComboboxInput.js +4 -5
- package/dist/components/Combobox/ComboboxList.js +2 -2
- package/dist/components/ConfigPane/ConfigPane.js +0 -7
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/ChildIndexContext/index.js +0 -1
- package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +34 -30
- package/dist/components/Dropdown/Dropdown.js +17 -68
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/Dropdown/DropdownButton.js +23 -33
- package/dist/components/Dropdown/DropdownHeader.js +2 -1
- package/dist/components/Dropdown/DropdownList.js +8 -7
- package/dist/components/Dropdown/DropdownOption.js +3 -10
- package/dist/components/Dropdown/DropdownSearch.js +6 -24
- package/dist/components/FilePicker/FilePicker.js +15 -26
- 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 -6
- package/dist/components/FormField/ReadOnlyText.js +2 -1
- package/dist/components/FullScreenTakeover/FullScreenTakeover.js +5 -11
- package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
- package/dist/components/Icon/Icon.js +3 -6
- package/dist/components/Icon/IconTypes.js +1 -0
- package/dist/components/IconButton/IconButton.js +1 -6
- package/dist/components/IconButton/IconButton2.js +3 -3
- package/dist/components/InlineInput/InlineInput.js +16 -33
- package/dist/components/InlineInput/InlineInput2.js +3 -3
- package/dist/components/Input/Input.js +3 -2
- package/dist/components/Input/Input2.js +3 -3
- package/dist/components/Input/InputField.js +2 -5
- package/dist/components/InputGroup/InputGroup2.js +3 -3
- package/dist/components/InputGroup/InputGroupProvider.js +0 -2
- 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/ConditionContainer.js +0 -2
- package/dist/components/LogicEditor/ConditionSet.js +8 -25
- package/dist/components/LogicEditor/Controls.js +2 -2
- package/dist/components/LogicEditor/LogicEditor.js +3 -12
- package/dist/components/LogicEditor/LogicEditor2.js +3 -3
- package/dist/components/LogicEditor/utils.js +9 -34
- package/dist/components/Modal/Modal.js +22 -35
- package/dist/components/Modal/Modal2.js +3 -3
- package/dist/components/NewMenu/BaseMenu.js +43 -108
- package/dist/components/NewMenu/NewMenu.js +3 -3
- package/dist/components/NewMenu/SelectMenu/SelectMenu.js +2 -3
- package/dist/components/NewMenu/parts/ArrowNav/ArrowNav.js +20 -32
- package/dist/components/NewMenu/parts/MenuItem.js +2 -3
- package/dist/components/NewMenu/parts/MenuSearchBox.js +2 -1
- package/dist/components/NumberStepper/NumberStepper.js +29 -44
- package/dist/components/NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/NumberStepper/NumberStepperDecrement.js +6 -5
- package/dist/components/NumberStepper/NumberStepperIncrement.js +6 -5
- package/dist/components/NumberStepper/NumberStepperInput.js +10 -12
- package/dist/components/PageLayout/PageLayout.js +3 -3
- package/dist/components/Pagination/Pagination.js +10 -6
- package/dist/components/Pagination/Pagination2.js +3 -3
- package/dist/components/Pagination/PaginationNextButton.js +8 -8
- package/dist/components/Pagination/PaginationPageInput.js +17 -22
- package/dist/components/Pagination/PaginationPreviousButton.js +8 -8
- package/dist/components/Popover/Popover.js +9 -18
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch.js +3 -5
- package/dist/components/QuickSearch/QuickSearch2.js +3 -3
- package/dist/components/QuickSearch/QuickSearchInput.js +6 -23
- package/dist/components/Radio/Radio.js +11 -13
- package/dist/components/Radio/Radio2.js +3 -3
- package/dist/components/SearchInput/SearchInput.js +5 -11
- package/dist/components/SearchInput/SearchInput2.js +3 -3
- package/dist/components/SidebarNav/ExpandCollapseButton.js +0 -2
- package/dist/components/SidebarNav/SidebarNav.js +5 -4
- package/dist/components/SidebarNav/SidebarNav2.js +3 -3
- package/dist/components/SidebarNav/SidebarNavLink.js +1 -4
- package/dist/components/Slider/RangeSlider.js +8 -22
- package/dist/components/Slider/Slider.js +7 -26
- package/dist/components/Slider/Slider2.js +3 -3
- package/dist/components/Slider/SliderButton.js +7 -9
- 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/TabContextProvider.js +1 -1
- package/dist/components/Tabs/TabList.js +9 -17
- package/dist/components/Tabs/TabPanel.js +3 -3
- package/dist/components/Tabs/TabPanels.js +0 -2
- package/dist/components/Tabs/Tabs2.js +3 -3
- package/dist/components/Tooltip/Tooltip.js +13 -42
- package/dist/components/Tooltip/Tooltip2.js +3 -3
- package/dist/components/UIProvider/PortalTargetContext.js +0 -1
- package/dist/components/UIProvider/UIProvider.js +2 -2
- package/dist/components/deprecated_ColorPicker/Alpha.js +4 -11
- package/dist/components/deprecated_ColorPicker/Color.js +9 -66
- package/dist/components/deprecated_ColorPicker/ColorPicker.js +2 -8
- package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/deprecated_ColorPicker/HexInput.js +1 -7
- package/dist/components/deprecated_ColorPicker/Hue.js +3 -10
- package/dist/components/deprecated_ColorPicker/Saturation.js +7 -14
- package/dist/components/deprecated_ColorPicker/Swatch.js +2 -6
- package/dist/components/deprecated_ColorPicker/useMouseDrag.js +0 -3
- package/dist/components/deprecated_NumberStepper/NumberStepper.js +14 -20
- package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/deprecated_NumberStepper/NumberStepperDecrement.js +7 -6
- package/dist/components/deprecated_NumberStepper/NumberStepperIncrement.js +7 -6
- package/dist/components/deprecated_NumberStepper/NumberStepperInput.js +16 -17
- package/dist/components/deprecated_Tabs/Tabs.js +9 -25
- 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 +3 -17
- package/dist/components/deprecated_Toolbar/ToolbarTab.js +10 -26
- package/dist/components/deprecated_Toolbar/ToolbarTabs.js +6 -18
- package/dist/hooks/useBreakpoints/useBreakpoints.js +3 -4
- package/dist/hooks/useClickOutside/useClickOutside.js +2 -7
- package/dist/hooks/useClickOutsidePortals/useClickOutsidePortals.js +3 -6
- package/dist/hooks/useControllableState/useControllableState.js +5 -10
- package/dist/hooks/useDidUpdate/useDidUpdate.js +2 -4
- package/dist/hooks/useEventCallback/useEventCallback.js +2 -1
- package/dist/hooks/useEventListener/useEventListener.js +1 -4
- package/dist/hooks/useFocusSequence/useFocusSequence.js +10 -17
- package/dist/hooks/useId/useId.js +1 -2
- package/dist/hooks/useIsFocused/useIsFocused.js +0 -1
- package/dist/hooks/useIsHovered/useIsHovered.js +0 -1
- package/dist/hooks/useIsTruncated/useIsTruncated.js +4 -3
- package/dist/hooks/useLatest/useLatest.js +0 -1
- package/dist/hooks/useMounted/useMounted.js +0 -1
- package/dist/hooks/useMouseDrag/useMouseDrag.js +0 -4
- package/dist/hooks/useOverlay/useOverlay.js +4 -10
- package/dist/hooks/useOverlay/useOverlay2.js +3 -3
- package/dist/hooks/usePrevious/usePrevious.js +0 -1
- package/dist/hooks/useResponsiveValue/useResponsiveValue.js +1 -4
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement.js +11 -16
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
- package/dist/icons/Icon.js +3 -3
- package/dist/icons/components/HeadsetIcon.js +6 -0
- package/dist/icons/components/PauseCircleIcon.js +1 -1
- package/dist/icons/createIconComponent.js +2 -3
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.es.js +1 -0
- package/dist/icons/index.js +2 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.es.js +4 -3
- package/dist/index.js +6 -5
- package/dist/next/AdvancedTable/AdvancedTable.js +82 -188
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTableCell.js +4 -14
- package/dist/next/AdvancedTable/AdvancedTableCheckbox.js +0 -1
- package/dist/next/AdvancedTable/AdvancedTableColumnHeader.js +11 -41
- package/dist/next/AdvancedTable/AdvancedTableColumnHeaderMenu.js +8 -14
- package/dist/next/AdvancedTable/AdvancedTableDragPreview.js +4 -6
- package/dist/next/AdvancedTable/AdvancedTablePagination.js +1 -4
- package/dist/next/AdvancedTable/AdvancedTableRowExpandButton.js +0 -1
- package/dist/next/AdvancedTable/AdvancedTableTypes.js +1 -3
- package/dist/next/AdvancedTable/useAdvancedTableDragAndDrop.js +8 -13
- package/dist/next/AdvancedTable/useComputedWidth.js +1 -1
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput.js +5 -20
- 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 +3 -3
- package/dist/next/Combobox/ComboboxGroup.js +1 -1
- package/dist/next/Combobox/ComboboxInput.js +7 -20
- package/dist/next/Combobox/ComboboxOption.js +5 -6
- package/dist/next/Combobox/hooks/useComboboxFilteredGroup/useComboboxFilteredGroup.js +4 -5
- package/dist/next/Combobox/hooks/useComboboxFocusSequence/useComboboxFocusSequence.js +37 -54
- package/dist/next/Combobox/hooks/useComboboxLoadingState/useComboboxLoadingState.js +4 -5
- package/dist/next/Combobox/hooks/useComboboxValue/useComboboxValue.js +5 -3
- package/dist/next/Combobox/hooks/useListboxFlyoutDimensions/useListboxFlyoutDimensions.js +10 -10
- package/dist/next/Combobox/hooks/useSelectedOptionScroll/useSelectedOptionScroll.js +1 -6
- package/dist/next/Combobox/hooks/useShouldRenderGroupHeader/useShouldRenderGroupHeader.js +6 -6
- package/dist/next/Combobox/utils/nodeRegistration/nodeRegistration.js +4 -6
- package/dist/next/Drawer/Drawer.js +5 -16
- package/dist/next/Drawer/Drawer2.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor.js +7 -5
- package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
- package/dist/next/Input/Input.js +5 -8
- package/dist/next/Input/Input2.js +3 -3
- package/dist/next/Menu/Menu.js +10 -23
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuButton.js +13 -6
- package/dist/next/Menu/MenuContext.js +0 -2
- package/dist/next/Menu/MenuItem.js +11 -15
- package/dist/next/Menu/MenuPane.js +11 -25
- package/dist/next/Menu/MenuSearch.js +15 -22
- package/dist/next/Menu/SubMenu.js +10 -27
- package/dist/next/Menu/usePaneSearch.js +2 -1
- package/dist/next/PhoneNumberInput/PhoneNumberInput.js +12 -19
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/SplitButton/SplitButton.js +6 -12
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/Stack/Stack.js +0 -3
- package/dist/next/TimePicker/TimeDropdown.js +4 -5
- package/dist/next/TimePicker/TimeInput.js +4 -5
- package/dist/next/TimePicker/TimePicker.js +12 -30
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/TimePicker/TimePickerIcon.js +1 -3
- package/dist/next/TimePicker/utils.js +12 -52
- package/dist/next/ToggleButton/ToggleButton.js +0 -5
- package/dist/next/ToggleButton/ToggleButtonGroup.js +2 -1
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.d.ts +5 -4
- package/dist/next/index.js +389 -754
- package/dist/utils/Flyout/Flyout.js +4 -5
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/dist/utils/Popper/Popper.js +18 -25
- package/dist/utils/Portal/Portal.js +2 -1
- package/dist/utils/TextOverflowTooltip/TextOverflowTooltip.js +4 -4
- package/dist/utils/Translation/Translate.js +0 -4
- package/dist/utils/Translation/TranslationProvider.js +0 -1
- package/dist/utils/Translation/containsComponentOrElement.js +1 -5
- package/dist/utils/Translation/insertPlaceholders.js +0 -1
- package/dist/utils/Translation/useTranslation.js +7 -14
- package/dist/utils/concatIds/concatIds.js +0 -1
- package/dist/utils/constants.js +2 -2
- package/dist/utils/createContextUtilities/createContextUtilities.js +0 -4
- package/dist/utils/filterChildren/filterChildren.js +8 -17
- package/dist/utils/getSubDataTestId/getSubDataTestId.js +1 -2
- package/dist/utils/keyboardUser/keyboardUser.js +0 -1
- package/dist/utils/mediaQueryManager/mediaQueryManager.js +1 -12
- package/dist/utils/mergeRefs/mergeRefs.js +1 -2
- package/dist/utils/wrapAround/wrapAround.js +1 -2
- package/dist/utils/wrapEvent/wrapEvent.js +2 -4
- package/icons/package.json +2 -1
- package/next/package.json +5 -1
- package/package.json +9 -4
|
@@ -11,22 +11,29 @@ import mergeRefs from '../../utils/mergeRefs/mergeRefs.js';
|
|
|
11
11
|
import getSubDataTestId from '../../utils/getSubDataTestId/getSubDataTestId.js';
|
|
12
12
|
import ChevronDownIcon from '../../icons/components/ChevronDownIcon.js';
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const AsChildWrapper = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
asChild,
|
|
17
|
+
children
|
|
18
|
+
} = _ref;
|
|
19
|
+
return asChild ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children) : /*#__PURE__*/React__default.createElement("div", {
|
|
20
|
+
className: styles.buttonContainer
|
|
21
|
+
}, children);
|
|
22
|
+
};
|
|
23
|
+
const MenuButton = /*#__PURE__*/React__default.forwardRef((_ref2, ref) => {
|
|
15
24
|
let {
|
|
16
25
|
asChild,
|
|
17
26
|
children,
|
|
18
27
|
className,
|
|
19
28
|
...rest
|
|
20
|
-
} =
|
|
29
|
+
} = _ref2;
|
|
21
30
|
const {
|
|
22
31
|
dataTestId: rootDataTestId,
|
|
23
32
|
isDisabled,
|
|
24
33
|
triggerRef
|
|
25
34
|
} = useMenuContext();
|
|
26
|
-
return /*#__PURE__*/React__default.createElement(
|
|
27
|
-
|
|
28
|
-
[styles.buttonContainer]: !asChild
|
|
29
|
-
})
|
|
35
|
+
return /*#__PURE__*/React__default.createElement(AsChildWrapper, {
|
|
36
|
+
asChild: asChild
|
|
30
37
|
}, /*#__PURE__*/React__default.createElement(Trigger, _extends({}, rest, {
|
|
31
38
|
"aria-disabled": isDisabled,
|
|
32
39
|
className: classNames(className, {
|
|
@@ -11,7 +11,6 @@ const {
|
|
|
11
11
|
useContext: intermediaryUseMenuContext,
|
|
12
12
|
Provider: IntermediaryMenuContextProvider
|
|
13
13
|
} = createContextUtilities();
|
|
14
|
-
|
|
15
14
|
const PaneContextProvider = _ref => {
|
|
16
15
|
let {
|
|
17
16
|
items,
|
|
@@ -26,7 +25,6 @@ const PaneContextProvider = _ref => {
|
|
|
26
25
|
value: value
|
|
27
26
|
}, children));
|
|
28
27
|
};
|
|
29
|
-
|
|
30
28
|
const usePaneContext = childItemRef => {
|
|
31
29
|
const coreContext = intermediaryUseMenuContext();
|
|
32
30
|
const childIndex = useChildIndex({
|
|
@@ -31,25 +31,22 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
31
31
|
closeSubmenu,
|
|
32
32
|
flyoutRef
|
|
33
33
|
} = usePaneContext(itemRef);
|
|
34
|
-
const dataTestId = getSubDataTestId(menuParentDataTestId
|
|
34
|
+
const dataTestId = getSubDataTestId(menuParentDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM), String(index));
|
|
35
35
|
const isVisible = useMemo(() => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const searchMatcher = label !== null && label !== void 0 ? label : typeof children === 'string' ? children : undefined;
|
|
39
|
-
return isSearchFilteringDisabled || !searchValue || (searchMatcher === null || searchMatcher === void 0 ? void 0 : _includesInstanceProperty(_context = searchMatcher.toLowerCase()).call(_context, searchValue.toLowerCase()));
|
|
36
|
+
const searchMatcher = label ?? (typeof children === 'string' ? children : undefined);
|
|
37
|
+
return isSearchFilteringDisabled || !searchValue || searchMatcher?.toLowerCase().includes(searchValue.toLowerCase());
|
|
40
38
|
}, [children, searchValue, label, isSearchFilteringDisabled]);
|
|
41
|
-
|
|
42
39
|
const handleFocus = () => {
|
|
43
40
|
if (itemRef.current && flyoutRef.current && getIsKeyboardUser()) {
|
|
44
|
-
const stickyBoxHeight = 93;
|
|
41
|
+
const stickyBoxHeight = 93;
|
|
45
42
|
|
|
43
|
+
// if the top of the focused menu item is beneath the sticky box
|
|
46
44
|
if (itemRef.current.offsetTop < flyoutRef.current.scrollTop + stickyBoxHeight) {
|
|
47
45
|
// scroll down a little
|
|
48
46
|
flyoutRef.current.scrollTop = itemRef.current.offsetTop - stickyBoxHeight;
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
49
|
};
|
|
52
|
-
|
|
53
50
|
return isVisible ? /*#__PURE__*/React__default.createElement(Item, _extends({}, rest, {
|
|
54
51
|
asChild: asChild,
|
|
55
52
|
"aria-disabled": isDisabled,
|
|
@@ -59,21 +56,20 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
59
56
|
"data-testid": dataTestId,
|
|
60
57
|
ref: mergeRefs(ref, itemRef),
|
|
61
58
|
onKeyDown: e => {
|
|
62
|
-
var
|
|
63
|
-
|
|
59
|
+
var _context;
|
|
64
60
|
if (!isInteractive) {
|
|
65
61
|
e.preventDefault();
|
|
66
62
|
return;
|
|
67
63
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
closeSubmenu === null || closeSubmenu === void 0 ? void 0 : closeSubmenu(e);
|
|
64
|
+
if (_includesInstanceProperty(_context = KEYS.CLOSE_SUBMENU).call(_context, e.key)) {
|
|
65
|
+
closeSubmenu?.(e);
|
|
71
66
|
}
|
|
72
67
|
},
|
|
73
|
-
onFocus: handleFocus
|
|
68
|
+
onFocus: handleFocus
|
|
69
|
+
// stop radix from closing the menu on selection of disabled item
|
|
74
70
|
// other pointer and keyboard events still work, even when disabled
|
|
75
71
|
,
|
|
76
|
-
onSelect: e => isDisabled ? e.preventDefault() : onSelect
|
|
72
|
+
onSelect: e => isDisabled ? e.preventDefault() : onSelect?.()
|
|
77
73
|
}), (!children || typeof children === 'string') && label ? label : children) : null;
|
|
78
74
|
});
|
|
79
75
|
|
|
@@ -38,11 +38,7 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
38
38
|
noMatchesText
|
|
39
39
|
} = usePaneSearch(externalSearchValue, onSearchValueChange, items);
|
|
40
40
|
const portalTarget = usePortalTarget();
|
|
41
|
-
const [side, align] = useMemo(() =>
|
|
42
|
-
var _placement$split, _placement$split2;
|
|
43
|
-
|
|
44
|
-
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 : [];
|
|
45
|
-
}, [placement]);
|
|
41
|
+
const [side, align] = useMemo(() => placement?.split?.('-') ?? [], [placement]);
|
|
46
42
|
const {
|
|
47
43
|
dataTestId: rootDataTestId,
|
|
48
44
|
openPaneDepth,
|
|
@@ -50,17 +46,16 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
50
46
|
maskHeight,
|
|
51
47
|
open,
|
|
52
48
|
triggerRef
|
|
53
|
-
} = useMenuContext();
|
|
54
|
-
// We cache the pixel value here, to use it later if the user returns to this pane from a submenu.
|
|
49
|
+
} = useMenuContext();
|
|
55
50
|
|
|
51
|
+
// 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.
|
|
52
|
+
// We cache the pixel value here, to use it later if the user returns to this pane from a submenu.
|
|
56
53
|
const initialHeightOfThisPane = useRef(null);
|
|
57
54
|
useDidUpdate(() => {
|
|
58
55
|
if (openPaneDepth === 1) {
|
|
59
56
|
if (initialHeightOfThisPane.current === null) {
|
|
60
57
|
window.requestAnimationFrame(() => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
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;
|
|
58
|
+
initialHeightOfThisPane.current = flyoutRef.current?.clientHeight ?? null;
|
|
64
59
|
setMaskHeight(initialHeightOfThisPane.current);
|
|
65
60
|
});
|
|
66
61
|
} else {
|
|
@@ -72,7 +67,6 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
72
67
|
const animatedLeft = useMemo(() => openPaneDepth > 1, [openPaneDepth]);
|
|
73
68
|
useEventListener(flyoutRef, 'keydown', e => {
|
|
74
69
|
var _context;
|
|
75
|
-
|
|
76
70
|
return _includesInstanceProperty(_context = Object.values(KEYS).flat()).call(_context, e.key) && setIsKeyboardUser(true);
|
|
77
71
|
}, {
|
|
78
72
|
additionalDependencies: [openPaneDepth]
|
|
@@ -81,36 +75,27 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
81
75
|
additionalDependencies: [openPaneDepth]
|
|
82
76
|
});
|
|
83
77
|
const defaultSide = useMemo(() => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const rect = triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.getBoundingClientRect();
|
|
87
|
-
|
|
78
|
+
const rect = triggerRef?.current?.getBoundingClientRect();
|
|
88
79
|
if (!rect) {
|
|
89
80
|
return 'bottom';
|
|
90
|
-
}
|
|
91
|
-
|
|
81
|
+
}
|
|
92
82
|
|
|
83
|
+
// hard coded in Menu.less
|
|
93
84
|
let maxHeight = 350;
|
|
94
|
-
|
|
95
85
|
if (flyoutRef.current) {
|
|
96
86
|
const computedString = window.getComputedStyle(flyoutRef.current).maxHeight.slice(0, -2);
|
|
97
|
-
|
|
98
87
|
if (computedString !== '' && !Number.isNaN(+computedString)) {
|
|
99
88
|
maxHeight = +computedString;
|
|
100
89
|
}
|
|
101
90
|
}
|
|
102
|
-
|
|
103
91
|
const distanceToBottom = window.innerHeight - rect.bottom;
|
|
104
92
|
const distanceToTop = rect.top;
|
|
105
|
-
|
|
106
93
|
if (distanceToBottom > maxHeight) {
|
|
107
94
|
return 'bottom';
|
|
108
95
|
}
|
|
109
|
-
|
|
110
96
|
if (distanceToTop > maxHeight) {
|
|
111
97
|
return 'top';
|
|
112
98
|
}
|
|
113
|
-
|
|
114
99
|
return 'bottom';
|
|
115
100
|
}, [open, triggerRef]);
|
|
116
101
|
return /*#__PURE__*/React__default.createElement(PaneContextProvider, {
|
|
@@ -138,8 +123,9 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
138
123
|
[styles.animatedLeft]: animatedLeft,
|
|
139
124
|
[styles.containsStickyBox]: isSearchable
|
|
140
125
|
}, styles.flyout),
|
|
141
|
-
style: {
|
|
142
|
-
|
|
126
|
+
style: {
|
|
127
|
+
...style,
|
|
128
|
+
height: internalSearchValue && openPaneDepth === 1 ? undefined : maskHeight ?? undefined
|
|
143
129
|
}
|
|
144
130
|
}), isSearchable && /*#__PURE__*/React__default.createElement("div", {
|
|
145
131
|
className: styles.stickyBox
|
|
@@ -32,17 +32,15 @@ const MenuSearch = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
32
32
|
closeSubmenu,
|
|
33
33
|
flyoutRef
|
|
34
34
|
} = usePaneContext();
|
|
35
|
-
const dataTestId = menuParentDataTestId
|
|
35
|
+
const dataTestId = menuParentDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_SEARCH);
|
|
36
36
|
useEffect(() => () => setSearchValue(''), [setSearchValue]);
|
|
37
|
-
const [previouslyFocusedElement, setPreviouslyFocusedElement] = useState();
|
|
37
|
+
const [previouslyFocusedElement, setPreviouslyFocusedElement] = useState();
|
|
38
38
|
|
|
39
|
+
// hack to keep focus on search input on mouse leave
|
|
39
40
|
useEventListener(flyoutRef, 'focus', e => {
|
|
40
41
|
if (e.target === e.currentTarget && previouslyFocusedElement === itemRef.current && isInteractive) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
42
|
+
inputRef.current?.focus();
|
|
44
43
|
}
|
|
45
|
-
|
|
46
44
|
setPreviouslyFocusedElement(e.target);
|
|
47
45
|
}, {
|
|
48
46
|
isCaptureEvent: true
|
|
@@ -50,14 +48,11 @@ const MenuSearch = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
50
48
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Item, {
|
|
51
49
|
className: classNames(styles.searchBox, {
|
|
52
50
|
[styles.unresponsive]: !isInteractive
|
|
53
|
-
})
|
|
51
|
+
})
|
|
52
|
+
// prevents dropdown from closing
|
|
54
53
|
,
|
|
55
54
|
onSelect: e => e.preventDefault(),
|
|
56
|
-
onFocus: () =>
|
|
57
|
-
var _inputRef$current2;
|
|
58
|
-
|
|
59
|
-
return (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
|
|
60
|
-
},
|
|
55
|
+
onFocus: () => inputRef.current?.focus(),
|
|
61
56
|
role: undefined,
|
|
62
57
|
ref: mergeRefs(itemRef, ref)
|
|
63
58
|
}, /*#__PURE__*/React__default.createElement(Input, {
|
|
@@ -67,27 +62,25 @@ const MenuSearch = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
67
62
|
onChange: e => setSearchValue(e.target.value),
|
|
68
63
|
placeholder: searchText,
|
|
69
64
|
onKeyDown: e => {
|
|
70
|
-
var
|
|
71
|
-
|
|
65
|
+
var _context, _context2;
|
|
72
66
|
// stop propagation to prevent typeAhead
|
|
73
|
-
e.stopPropagation();
|
|
67
|
+
e.stopPropagation();
|
|
74
68
|
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
// allow caret movement through text entry, but close searchable submenu if on the very left
|
|
70
|
+
if (e.target?.selectionStart === 0 && _includesInstanceProperty(_context = KEYS.CLOSE_SUBMENU).call(_context, e.key)) {
|
|
71
|
+
closeSubmenu?.(e);
|
|
77
72
|
return;
|
|
78
|
-
}
|
|
79
|
-
|
|
73
|
+
}
|
|
80
74
|
|
|
75
|
+
// forward keypress directly to `Item` to let Radix handle keyboard navigation
|
|
81
76
|
if (_includesInstanceProperty(_context2 = KEYS.IGNORED_BY_SEARCH_INPUT).call(_context2, e.key)) {
|
|
82
|
-
var _itemRef$current;
|
|
83
|
-
|
|
84
77
|
// `view` types are incompatible
|
|
85
78
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
86
79
|
const {
|
|
87
80
|
view,
|
|
88
81
|
...eventClone
|
|
89
82
|
} = e;
|
|
90
|
-
itemRef
|
|
83
|
+
itemRef?.current?.dispatchEvent(new KeyboardEvent('keydown', eventClone));
|
|
91
84
|
}
|
|
92
85
|
},
|
|
93
86
|
leftAddOn: /*#__PURE__*/React__default.createElement(SearchIcon, null),
|
|
@@ -59,11 +59,10 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
59
59
|
} = useMenuContext();
|
|
60
60
|
const thisPanesDepth = useRef(totalOpenPaneDepth + 1).current;
|
|
61
61
|
const paneDataTestId = getSubDataTestId(paneContainingTriggerDataTestId, String(triggerIndex));
|
|
62
|
-
const backButtonDataTestId = paneDataTestId
|
|
63
|
-
const triggerDataTestId = paneDataTestId
|
|
62
|
+
const backButtonDataTestId = paneDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_BACK);
|
|
63
|
+
const triggerDataTestId = paneDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM);
|
|
64
64
|
const triggerIsVisible = useMemo(() => {
|
|
65
65
|
var _context;
|
|
66
|
-
|
|
67
66
|
return isSearchFilteringDisabledForPaneContainingTrigger || !paneContainingTriggerSearchValue || typeof label === 'string' && _includesInstanceProperty(_context = label.toLowerCase()).call(_context, paneContainingTriggerSearchValue.toLowerCase());
|
|
68
67
|
}, [paneContainingTriggerSearchValue, label, isSearchFilteringDisabledForPaneContainingTrigger]);
|
|
69
68
|
const [isPaneInDOM, setIsPaneInDOM] = useState(false);
|
|
@@ -71,63 +70,49 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
71
70
|
const [isTransitioningFromRight, setIsTransitioningFromRight] = useState(false);
|
|
72
71
|
useDidUpdate(() => {
|
|
73
72
|
if (isPaneInDOM) {
|
|
74
|
-
setIsTransitioningFromRight(true);
|
|
75
|
-
|
|
73
|
+
setIsTransitioningFromRight(true);
|
|
74
|
+
// trigger css transition
|
|
76
75
|
setIsFrameAfterPaneAddedToDOM(true);
|
|
77
76
|
window.requestAnimationFrame(() => setIsFrameAfterPaneAddedToDOM(false));
|
|
78
77
|
}
|
|
79
|
-
|
|
80
78
|
registerSubmenu(internalId, isPaneInDOM);
|
|
81
79
|
}, [isPaneInDOM]);
|
|
82
80
|
useEffect(() => () => registerSubmenu(internalId, false), []);
|
|
83
|
-
|
|
84
81
|
const closeThisSubmenu = e => {
|
|
85
82
|
// prevent closing the entire menu, and Radix keyboard navigation
|
|
86
83
|
e.preventDefault();
|
|
87
84
|
registerSubmenu(internalId, false);
|
|
88
85
|
};
|
|
89
|
-
|
|
90
86
|
useDidUpdate(() => {
|
|
91
87
|
if (thisPanesDepth === totalOpenPaneDepth) {
|
|
92
88
|
window.requestAnimationFrame(() => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
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);
|
|
89
|
+
setMaskHeight(flyoutRef.current?.clientHeight ?? null);
|
|
96
90
|
});
|
|
97
91
|
}
|
|
98
92
|
}, [totalOpenPaneDepth, internalSearchValue]);
|
|
99
93
|
const animatedLeft = useMemo(() => thisPanesDepth < totalOpenPaneDepth, [totalOpenPaneDepth]);
|
|
100
94
|
const animatedRight = useMemo(() => thisPanesDepth > totalOpenPaneDepth || isFrameAfterPaneAddedToDOM, [totalOpenPaneDepth, isFrameAfterPaneAddedToDOM]);
|
|
101
|
-
|
|
102
95
|
const handlePaneTransitionEnd = () => {
|
|
103
96
|
if (animatedLeft) {
|
|
104
97
|
return;
|
|
105
98
|
}
|
|
106
|
-
|
|
107
99
|
if (animatedRight) {
|
|
108
100
|
setIsPaneInDOM(false);
|
|
109
|
-
|
|
110
101
|
if (getIsKeyboardUser()) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
(_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.focus();
|
|
102
|
+
triggerRef.current?.focus();
|
|
114
103
|
}
|
|
115
104
|
} else {
|
|
116
|
-
var _flyoutRef$current2;
|
|
117
|
-
|
|
118
105
|
// if the newly closed submenu doesn't place the focus on its trigger
|
|
119
|
-
if (!
|
|
106
|
+
if (!flyoutRef.current?.contains(document.activeElement) && getIsKeyboardUser()) {
|
|
120
107
|
if (searchItemRef.current) {
|
|
121
108
|
searchItemRef.current.focus();
|
|
122
109
|
} else if (backButtonRef.current) {
|
|
123
110
|
backButtonRef.current.focus();
|
|
124
111
|
}
|
|
125
112
|
}
|
|
126
|
-
|
|
127
113
|
setIsTransitioningFromRight(false);
|
|
128
114
|
}
|
|
129
115
|
};
|
|
130
|
-
|
|
131
116
|
return triggerIsVisible ? /*#__PURE__*/React__default.createElement(Sub, {
|
|
132
117
|
open: isPaneInDOM
|
|
133
118
|
}, /*#__PURE__*/React__default.createElement(SubTrigger, {
|
|
@@ -140,16 +125,14 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
140
125
|
onClick: () => !isDisabled && setIsPaneInDOM(true),
|
|
141
126
|
onKeyDown: e => {
|
|
142
127
|
var _context2, _context3;
|
|
143
|
-
|
|
144
128
|
if (!paneContainingTriggerIsInteractive) {
|
|
145
129
|
e.preventDefault();
|
|
146
130
|
return;
|
|
147
131
|
}
|
|
148
|
-
|
|
149
132
|
if (!isDisabled && _includesInstanceProperty(_context2 = KEYS.OPEN_SUBMENU).call(_context2, e.key)) {
|
|
150
133
|
setIsPaneInDOM(true);
|
|
151
134
|
} else if (_includesInstanceProperty(_context3 = KEYS.CLOSE_SUBMENU).call(_context3, e.key)) {
|
|
152
|
-
closeSubmenuContainingTrigger
|
|
135
|
+
closeSubmenuContainingTrigger?.(e);
|
|
153
136
|
}
|
|
154
137
|
}
|
|
155
138
|
}, label, /*#__PURE__*/React__default.createElement(ChevronRightIcon, {
|
|
@@ -174,7 +157,8 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
174
157
|
[styles.animatedLeft]: animatedLeft
|
|
175
158
|
}),
|
|
176
159
|
onTransitionEnd: handlePaneTransitionEnd,
|
|
177
|
-
style: {
|
|
160
|
+
style: {
|
|
161
|
+
...style,
|
|
178
162
|
zIndex: thisPanesDepth
|
|
179
163
|
}
|
|
180
164
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -191,7 +175,6 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
191
175
|
ref: backButtonRef,
|
|
192
176
|
onKeyDown: e => {
|
|
193
177
|
var _context4;
|
|
194
|
-
|
|
195
178
|
if (_includesInstanceProperty(_context4 = KEYS.CLOSE_SUBMENU).call(_context4, e.key)) {
|
|
196
179
|
closeThisSubmenu(e);
|
|
197
180
|
}
|
|
@@ -4,6 +4,7 @@ import '../../utils/index.js';
|
|
|
4
4
|
import useControllableState from '../../hooks/useControllableState/useControllableState.js';
|
|
5
5
|
import useTranslation from '../../utils/Translation/useTranslation.js';
|
|
6
6
|
|
|
7
|
+
// abstracts the logic required for searching by both `MenuPane` and `SubMenu`
|
|
7
8
|
function usePaneSearch(externalSearchValue, onSearchValueChange, items) {
|
|
8
9
|
const [internalSearchValue, setSearchValue] = useControllableState(externalSearchValue, onSearchValueChange, externalSearchValue);
|
|
9
10
|
const [zeroSearchResults, setZeroSearchResults] = useState();
|
|
@@ -12,7 +13,7 @@ function usePaneSearch(externalSearchValue, onSearchValueChange, items) {
|
|
|
12
13
|
} = useTranslation();
|
|
13
14
|
const noMatchesText = translate('menu.noItemsToDisplay');
|
|
14
15
|
useEffect(() => {
|
|
15
|
-
setZeroSearchResults(
|
|
16
|
+
setZeroSearchResults(items?.filter(item => item.element.current).length === 0);
|
|
16
17
|
}, [items, internalSearchValue]);
|
|
17
18
|
return {
|
|
18
19
|
internalSearchValue,
|
|
@@ -27,18 +27,16 @@ const PhoneNumberInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
27
27
|
inputId
|
|
28
28
|
} = _ref;
|
|
29
29
|
const [countryCode, setCountryCode] = useState(initialCountryCode);
|
|
30
|
-
const [mask, setMask] = useState();
|
|
31
|
-
|
|
30
|
+
const [mask, setMask] = useState();
|
|
31
|
+
// As of the day of writing the longest number format is 15 numbers long. This is 5 places longer to be safe.
|
|
32
32
|
const genericMaxNumberLength = 20;
|
|
33
33
|
const {
|
|
34
34
|
translate
|
|
35
35
|
} = useTranslation();
|
|
36
36
|
const getMinMaxLength = useCallback(() => {
|
|
37
|
-
var _metadata$numberingPl;
|
|
38
|
-
|
|
39
37
|
const metadata = new Metadata();
|
|
40
38
|
metadata.selectNumberingPlan(countryCode);
|
|
41
|
-
const possibleLengths = metadata
|
|
39
|
+
const possibleLengths = metadata?.numberingPlan?.possibleLengths();
|
|
42
40
|
return possibleLengths ? [Math.min(...possibleLengths), Math.max(...possibleLengths)] : [0, genericMaxNumberLength];
|
|
43
41
|
}, [countryCode]);
|
|
44
42
|
const shouldUseMask = Number(getCountryCallingCode(countryCode)) === 1;
|
|
@@ -52,33 +50,28 @@ const PhoneNumberInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
52
50
|
useEffect(() => {
|
|
53
51
|
updateMask();
|
|
54
52
|
}, [countryCode, updateMask]);
|
|
55
|
-
|
|
56
|
-
const removeNonNumericCharacters = value => value === null || value === void 0 ? void 0 : value.replace(/\D/g, '');
|
|
57
|
-
|
|
53
|
+
const removeNonNumericCharacters = value => value?.replace(/\D/g, '');
|
|
58
54
|
const handleInputChange = a => {
|
|
59
55
|
// remove all non-numeric characters
|
|
60
56
|
const value = removeNonNumericCharacters(a.target.value);
|
|
61
57
|
let internationalNumber = null;
|
|
62
58
|
let isValidLength = false;
|
|
63
|
-
|
|
64
59
|
if (!value) {
|
|
65
60
|
return;
|
|
66
61
|
}
|
|
67
|
-
|
|
68
62
|
try {
|
|
69
63
|
const phoneNumber = parsePhoneNumber(value, countryCode);
|
|
70
64
|
internationalNumber = phoneNumber.format('E.164');
|
|
71
65
|
isValidLength = phoneNumber.isPossible();
|
|
72
|
-
} catch (e) {
|
|
66
|
+
} catch (e) {
|
|
67
|
+
// `parsePhoneNumber` throws an error if the inputs are invalid.
|
|
73
68
|
}
|
|
74
|
-
|
|
75
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(internationalNumber, isValidLength, countryCode, value);
|
|
69
|
+
onChange?.(internationalNumber, isValidLength, countryCode, value);
|
|
76
70
|
};
|
|
77
|
-
|
|
78
71
|
const inputClassNames = classNames(styles.input, {
|
|
79
72
|
[styles.disabled]: isDisabled
|
|
80
73
|
});
|
|
81
|
-
const dropdownLabel = useMemo(() => countryCode ?
|
|
74
|
+
const dropdownLabel = useMemo(() => countryCode ? `+${getCountryCallingCode(countryCode)}` : undefined, [countryCode]);
|
|
82
75
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
83
76
|
className: styles.container,
|
|
84
77
|
"data-testid": dataTestId
|
|
@@ -95,19 +88,19 @@ const PhoneNumberInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
95
88
|
disabled: isDisabled,
|
|
96
89
|
"aria-label": buttonAriaLabel,
|
|
97
90
|
"aria-labelledby": buttonAriaLabelledBy
|
|
98
|
-
}, (countryCodes
|
|
91
|
+
}, (countryCodes ?? getCountries()).map(individualCountryCode => {
|
|
99
92
|
if (!isSupportedCountry(individualCountryCode)) {
|
|
100
93
|
return null;
|
|
101
94
|
}
|
|
102
|
-
|
|
103
95
|
return /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
104
96
|
key: individualCountryCode,
|
|
105
97
|
value: individualCountryCode
|
|
106
|
-
},
|
|
98
|
+
}, `${translate(individualCountryCode)} +${getCountryCallingCode(individualCountryCode)}`);
|
|
107
99
|
})), /*#__PURE__*/React__default.createElement(InputMask, {
|
|
108
100
|
value: isDisabled ? removeNonNumericCharacters(initialValue) : undefined,
|
|
109
101
|
type: "tel",
|
|
110
|
-
alwaysShowMask: true
|
|
102
|
+
alwaysShowMask: true
|
|
103
|
+
// hide formatting if not using mask
|
|
111
104
|
,
|
|
112
105
|
maskChar: shouldUseMask ? '_' : '',
|
|
113
106
|
mask: mask,
|
|
@@ -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 = "._0ugqV input{padding-left:76px!important}._5fTUE input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._5fTUE input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._5fTUE input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._jzrnt{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._jzrnt,._jzrnt._5fTUE:hover{background-color:transparent!important}._jzrnt:hover{background-color:rgba(50,54,58,.08)!important}._jzrnt:active{background-color:rgba(50,54,58,.11)!important}._jzrnt svg{top:2px!important}._Wv-Ld{position:relative}._Qcs1E{position:absolute;top:18px;left:12px;line-height:0;font-size:14px;color:#32363a;z-index:101;pointer-events:none}";
|
|
4
|
+
var styles = {"input":"_0ugqV","disabled":"_5fTUE","dropdown":"_jzrnt","container":"_Wv-Ld","countryCode":"_Qcs1E"};
|
|
5
|
+
var stylesheet="._0ugqV input{padding-left:76px!important}._5fTUE input{background-color:#e5e5e5!important;color:#9d9fa1!important;cursor:not-allowed!important;-webkit-text-fill-color:#9d9fa1}._5fTUE input::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._5fTUE input::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._jzrnt{position:absolute!important;left:4px;right:4px;bottom:4px;z-index:100;width:67px;height:28px!important;border-radius:4px}._jzrnt,._jzrnt._5fTUE:hover{background-color:transparent!important}._jzrnt:hover{background-color:rgba(50,54,58,.08)!important}._jzrnt:active{background-color:rgba(50,54,58,.11)!important}._jzrnt svg{top:2px!important}._Wv-Ld{position:relative}._Qcs1E{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 };
|
|
@@ -30,18 +30,11 @@ const SplitButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
30
30
|
const mainButtonRef = useRef(null);
|
|
31
31
|
const dropdownButtonRef = useRef(null);
|
|
32
32
|
const [dropdownButtonHasFocus, setDropdownButtonHasFocus] = useState(false);
|
|
33
|
-
const [mainButtonHasFocus, setMainButtonHasFocus] = useState(false);
|
|
33
|
+
const [mainButtonHasFocus, setMainButtonHasFocus] = useState(false);
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
43
|
-
return e.key === 'ArrowLeft' && ((_mainButtonRef$curren = mainButtonRef.current) === null || _mainButtonRef$curren === void 0 ? void 0 : _mainButtonRef$curren.focus());
|
|
44
|
-
});
|
|
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 => e.key === 'ArrowRight' && dropdownButtonRef.current?.focus());
|
|
37
|
+
useEventListener(dropdownButtonRef, 'keydown', e => e.key === 'ArrowLeft' && mainButtonRef.current?.focus());
|
|
45
38
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
46
39
|
"data-testid": dataTestId,
|
|
47
40
|
className: classNames(styles.container, className),
|
|
@@ -76,7 +69,8 @@ const SplitButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
76
69
|
"aria-labelledby": dropdownAriaLabelledBy,
|
|
77
70
|
value: 0,
|
|
78
71
|
disabled: isDropdownDisabled
|
|
79
|
-
}, /*#__PURE__*/React__default.createElement(DropdownButton
|
|
72
|
+
}, /*#__PURE__*/React__default.createElement(DropdownButton
|
|
73
|
+
// `label` of type `string` adds Dropdown's `isString` class, which causes a css bug in Safari
|
|
80
74
|
, {
|
|
81
75
|
label: /*#__PURE__*/React__default.createElement(React__default.Fragment, null),
|
|
82
76
|
className: classNames(styles.dropdownButton, {
|
|
@@ -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 = "._m7pGf{display:flex}._QN3kF{z-index:2;width:1px;margin-left:-1px;margin-right:-1px}._QN3kF._rQAGM{background-color:#fff}._QN3kF._rQAGM._eo5P0:not(._QN3kF._rQAGM._nnjid),._QN3kF._rZ4iL,body.keyboard-user ._QN3kF._rQAGM._42-Ca:not(._KWjQZ){background-color:#0b6ed0}._QN3kF._rZ4iL._KWjQZ._42-Ca,._QN3kF._rZ4iL._KWjQZ._nnjid,._QN3kF._rZ4iL._nnjid._eo5P0{opacity:.4}._ySQpY{border-radius:4px 0 0 4px;border-right:none;padding-right:17px}._ySQpY:focus{z-index:1}._WKbWy{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}._WKbWy svg{margin-left:1px}._WKbWy._rQAGM{background-color:#0b6ed0;border-color:transparent}._WKbWy._rQAGM svg{fill:#fff!important}._WKbWy._rQAGM:not(._KFkhb):hover{background-color:#085caf!important}._WKbWy._rQAGM:not(._KFkhb):active{background-color:#0854a1!important}._WKbWy._rQAGM._KFkhb{opacity:.4}._WKbWy._rQAGM._KFkhb svg{background-color:transparent}._WKbWy._rZ4iL{border-color:#0b6ed0;background-color:#fff}._WKbWy._rZ4iL svg{fill:#0b6ed0!important}._WKbWy._rZ4iL:not(._KFkhb):hover{background-color:#eef5fc!important}._WKbWy._rZ4iL:not(._KFkhb):active{background-color:#e1edf9!important}._WKbWy._rZ4iL._KFkhb{opacity:.4}._WKbWy._rZ4iL._KFkhb svg{background-color:transparent}._mpYIf{width:260px}";
|
|
4
|
+
var styles = {"container":"_m7pGf","divider":"_QN3kF","primary":"_rQAGM","mainButtonFocus":"_42-Ca","mainButtonDisabled":"_KWjQZ","dropdownButtonFocus":"_eo5P0","dropdownButtonDisabled":"_nnjid","secondary":"_rZ4iL","mainButton":"_ySQpY","dropdownButton":"_WKbWy","disabled":"_KFkhb","dropdownOption":"_mpYIf"};
|
|
5
|
+
var stylesheet="._m7pGf{display:flex}._QN3kF{z-index:2;width:1px;margin-left:-1px;margin-right:-1px}._QN3kF._rQAGM{background-color:#fff}._QN3kF._rQAGM._eo5P0:not(._QN3kF._rQAGM._nnjid),._QN3kF._rZ4iL,body.keyboard-user ._QN3kF._rQAGM._42-Ca:not(._KWjQZ){background-color:#0b6ed0}._QN3kF._rZ4iL._KWjQZ._42-Ca,._QN3kF._rZ4iL._KWjQZ._nnjid,._QN3kF._rZ4iL._nnjid._eo5P0{opacity:.4}._ySQpY{border-radius:4px 0 0 4px;border-right:none;padding-right:17px}._ySQpY:focus{z-index:1}._WKbWy{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}._WKbWy svg{margin-left:1px}._WKbWy._rQAGM{background-color:#0b6ed0;border-color:transparent}._WKbWy._rQAGM svg{fill:#fff!important}._WKbWy._rQAGM:not(._KFkhb):hover{background-color:#085caf!important}._WKbWy._rQAGM:not(._KFkhb):active{background-color:#0854a1!important}._WKbWy._rQAGM._KFkhb{opacity:.4}._WKbWy._rQAGM._KFkhb svg{background-color:transparent}._WKbWy._rZ4iL{border-color:#0b6ed0;background-color:#fff}._WKbWy._rZ4iL svg{fill:#0b6ed0!important}._WKbWy._rZ4iL:not(._KFkhb):hover{background-color:#eef5fc!important}._WKbWy._rZ4iL:not(._KFkhb):active{background-color:#e1edf9!important}._WKbWy._rZ4iL._KFkhb{opacity:.4}._WKbWy._rZ4iL._KFkhb svg{background-color:transparent}._mpYIf{width:260px}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
package/dist/next/Stack/Stack.js
CHANGED
|
@@ -16,7 +16,6 @@ const convertAlignment = alignment => {
|
|
|
16
16
|
};
|
|
17
17
|
return alignmentMap[alignment];
|
|
18
18
|
};
|
|
19
|
-
|
|
20
19
|
// Explicitly listed props to prevent arbitrary prop spreading
|
|
21
20
|
const Stack = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
22
21
|
let {
|
|
@@ -45,13 +44,11 @@ const Stack = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
45
44
|
'aria-describedby': ariaDescribedBy,
|
|
46
45
|
'data-testid': dataTestId
|
|
47
46
|
} = _ref;
|
|
48
|
-
|
|
49
47
|
const checkIsStackItem = child => {
|
|
50
48
|
if (!(child.type && (child.type === StackItem || child.type === HStack || child.type === VStack))) {
|
|
51
49
|
throw new Error('Stack received an invalid child. Only StackItems are valid children of Stacks.');
|
|
52
50
|
}
|
|
53
51
|
};
|
|
54
|
-
|
|
55
52
|
useEffect(() => {
|
|
56
53
|
if (Array.isArray(children)) {
|
|
57
54
|
children.forEach(child => {
|