@qualtrics/ui-react 2.19.0 → 2.19.1
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 +16 -0
- package/dist/__shared/cjs/{index-4e4cc354.js → index-384184bd.js} +994 -1872
- package/dist/__shared/cjs/{index-bf07471d.js → index-4a5425cc.js} +10 -7
- package/dist/components/Accordion/Accordion.js +1 -5
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Accordion/AccordionHeader.js +4 -8
- 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 +12 -41
- 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 +1 -0
- 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/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.js +376 -748
- 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
|
@@ -7,6 +7,7 @@ import useScreenReaderAnnouncement from '../../../../hooks/useScreenReaderAnnoun
|
|
|
7
7
|
import useTranslation from '../../../../utils/Translation/useTranslation.js';
|
|
8
8
|
|
|
9
9
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
10
|
+
|
|
10
11
|
/**
|
|
11
12
|
* Updates the committed input value and makes a screen reader announcement when new options are loaded.
|
|
12
13
|
* @param isLoading - Indicates if new options are being loaded.
|
|
@@ -15,21 +16,19 @@ import useTranslation from '../../../../utils/Translation/useTranslation.js';
|
|
|
15
16
|
* @param rawInputValue - The raw input value.
|
|
16
17
|
* @param setCommittedInputValue - A function that updates the committed input value.
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
19
|
function useComboboxLoadingState(isLoading, isComponentFocused, activeDescendantElement, rawInputValue, setCommittedInputValue) {
|
|
20
20
|
const previousIsLoadingRef = useLatest(usePrevious(isLoading)); // The value of `isLoading` during the previous call to this hook
|
|
21
|
-
|
|
22
21
|
const newOptionsLoadingTimeoutIdRef = useRef();
|
|
23
22
|
const didNewOptionsLoadingAnnouncementOccurRef = useRef(false);
|
|
24
23
|
const announceToScreenReader = useScreenReaderAnnouncement('polite');
|
|
25
24
|
const {
|
|
26
25
|
translate
|
|
27
26
|
} = useTranslation();
|
|
27
|
+
|
|
28
28
|
/* If the user is navigating through options in the flyout when new options are loaded or if a new options loading announcement was made during the current loading cycle:
|
|
29
29
|
* 1. Sends a message to the screen reader
|
|
30
30
|
* 2. Commits the currently selected value
|
|
31
31
|
*/
|
|
32
|
-
|
|
33
32
|
useEffect(() => {
|
|
34
33
|
if (previousIsLoadingRef.current && !isLoading && isComponentFocused && (activeDescendantElement || didNewOptionsLoadingAnnouncementOccurRef.current)) {
|
|
35
34
|
// @ts-ignore - 'newOptionsLoaded' is not in the current list of translations
|
|
@@ -37,8 +36,9 @@ function useComboboxLoadingState(isLoading, isComponentFocused, activeDescendant
|
|
|
37
36
|
setCommittedInputValue(rawInputValue);
|
|
38
37
|
didNewOptionsLoadingAnnouncementOccurRef.current = false;
|
|
39
38
|
}
|
|
40
|
-
}, [previousIsLoadingRef, isLoading, activeDescendantElement, isComponentFocused, announceToScreenReader, translate, setCommittedInputValue, rawInputValue]);
|
|
39
|
+
}, [previousIsLoadingRef, isLoading, activeDescendantElement, isComponentFocused, announceToScreenReader, translate, setCommittedInputValue, rawInputValue]);
|
|
41
40
|
|
|
41
|
+
// If new options are taking a while to load, make a screen reader announcement that new options are loading
|
|
42
42
|
useEffect(() => {
|
|
43
43
|
if (isLoading && isComponentFocused) {
|
|
44
44
|
newOptionsLoadingTimeoutIdRef.current = window.setTimeout(() => {
|
|
@@ -47,7 +47,6 @@ function useComboboxLoadingState(isLoading, isComponentFocused, activeDescendant
|
|
|
47
47
|
didNewOptionsLoadingAnnouncementOccurRef.current = true;
|
|
48
48
|
}, 3000);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
50
|
return () => {
|
|
52
51
|
clearTimeout(newOptionsLoadingTimeoutIdRef.current);
|
|
53
52
|
};
|
|
@@ -3,6 +3,7 @@ import '../../../../hooks/index.js';
|
|
|
3
3
|
import useControllableState from '../../../../hooks/useControllableState/useControllableState.js';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable camelcase */
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* Creates state for the different types of combobox values to keep track of.
|
|
8
9
|
* @param initialInputValue - The initial value of the input.
|
|
@@ -10,14 +11,15 @@ import useControllableState from '../../../../hooks/useControllableState/useCont
|
|
|
10
11
|
* @param externalOnChange - The function to be called when the input value changes.
|
|
11
12
|
* @returns - Utils that handle both types of input values: the raw value and the committed value.
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
14
|
function useComboboxValue(initialInputValue, externalInputValue, externalOnChange) {
|
|
15
15
|
// This is the `value` of the `input` element (what is displayed to the user)
|
|
16
|
-
const [rawInputValue, setRawInputValue] = useState(externalInputValue
|
|
16
|
+
const [rawInputValue, setRawInputValue] = useState(externalInputValue ?? initialInputValue);
|
|
17
17
|
|
|
18
|
+
// The `value` of the `input` element will become this value by the time the `input` element is blurred
|
|
18
19
|
const [committedInputValue, setCommittedInputValue_DO_NOT_USE // A setter is created below so that the raw input value is also updated
|
|
19
|
-
] = useControllableState(initialInputValue, externalOnChange, externalInputValue);
|
|
20
|
+
] = useControllableState(initialInputValue, externalOnChange, externalInputValue);
|
|
20
21
|
|
|
22
|
+
// Use of `setCommittedInputValue_DO_NOT_USE` is okay here because this function is used as the actual state updater
|
|
21
23
|
const setCommittedInputValue = useCallback(newValue => {
|
|
22
24
|
setCommittedInputValue_DO_NOT_USE(newValue);
|
|
23
25
|
setRawInputValue(newValue);
|
|
@@ -9,30 +9,28 @@ function getFlyoutDimensions(anchorDimensions) {
|
|
|
9
9
|
// TODO: If this hook becomes a reusable hook, an `isFocused` parameter should be added to determine if the focus ring width width should be added
|
|
10
10
|
// Adds the focus ring width to account for the box-shadow focus ring on each side of the anchor
|
|
11
11
|
minWidth: anchorDimensions.width + FOCUS_RING_WIDTH * 2,
|
|
12
|
-
maxHeight: Math.min(350,
|
|
12
|
+
maxHeight: Math.min(350,
|
|
13
|
+
// Half of window height - flyout popper offset - half of anchor height
|
|
13
14
|
document.documentElement.clientHeight / 2 - FLYOUT_POPPER_OFFSET[1] - anchorDimensions.height / 2)
|
|
14
15
|
};
|
|
15
16
|
}
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* Computes the sizing of a listbox flyout based on the size of the anchor element and the document.
|
|
18
20
|
* @param anchorElement The element acting as the anchor for the flyout.
|
|
19
21
|
* @returns A CSS style object containing styles to properly size the flyout.
|
|
20
22
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
23
|
function useListboxFlyoutDimensions(anchorElement) {
|
|
24
|
-
var _anchorElement$offset, _anchorElement$offset2;
|
|
25
|
-
|
|
26
24
|
const [anchorDimensions, setAnchorDimensions] = useState({
|
|
27
|
-
width:
|
|
28
|
-
height:
|
|
25
|
+
width: anchorElement?.offsetWidth ?? 0,
|
|
26
|
+
height: anchorElement?.offsetHeight ?? 18
|
|
29
27
|
});
|
|
30
28
|
const [flyoutDimensions, setFlyoutDimensions] = useState(getFlyoutDimensions(anchorDimensions));
|
|
29
|
+
|
|
31
30
|
/*
|
|
32
31
|
* The element being passed in to this hook could be coming from a ref which may be null at first.
|
|
33
32
|
* This effect updates the anchor dimensions state whenever the anchor element changes.
|
|
34
33
|
*/
|
|
35
|
-
|
|
36
34
|
useEffect(() => {
|
|
37
35
|
if (anchorElement) {
|
|
38
36
|
setAnchorDimensions({
|
|
@@ -40,12 +38,14 @@ function useListboxFlyoutDimensions(anchorElement) {
|
|
|
40
38
|
height: anchorElement.offsetHeight
|
|
41
39
|
});
|
|
42
40
|
}
|
|
43
|
-
}, [anchorElement]);
|
|
41
|
+
}, [anchorElement]);
|
|
44
42
|
|
|
43
|
+
// Updates flyout dimensions when the anchor dimensions change
|
|
45
44
|
useEffect(() => {
|
|
46
45
|
setFlyoutDimensions(getFlyoutDimensions(anchorDimensions));
|
|
47
|
-
}, [anchorDimensions]);
|
|
46
|
+
}, [anchorDimensions]);
|
|
48
47
|
|
|
48
|
+
// Updates flyout dimensions when the the window is resized
|
|
49
49
|
useEventListener(window, 'resize', () => setFlyoutDimensions(getFlyoutDimensions(anchorDimensions)));
|
|
50
50
|
return flyoutDimensions;
|
|
51
51
|
}
|
|
@@ -7,22 +7,17 @@ import { useEffect } from 'react';
|
|
|
7
7
|
* @param optionsRef - Options in the flyout.
|
|
8
8
|
* @param flyoutRef - The flyout container.
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
10
|
function useSelectedOptionScroll(isOpen, activeDescendantElement, optionsRef, flyoutRef) {
|
|
12
11
|
// Scrolls to the selected option if the selected option is out of view
|
|
13
12
|
useEffect(() => {
|
|
14
13
|
if (isOpen && activeDescendantElement && flyoutRef.current) {
|
|
15
|
-
var _optionsRef$current;
|
|
16
|
-
|
|
17
14
|
const flyoutContainerElement = flyoutRef.current;
|
|
18
|
-
|
|
19
|
-
if (activeDescendantElement === ((_optionsRef$current = optionsRef.current) === null || _optionsRef$current === void 0 ? void 0 : _optionsRef$current[0])) {
|
|
15
|
+
if (activeDescendantElement === optionsRef.current?.[0]) {
|
|
20
16
|
// Scrolls the first header into view if one exists
|
|
21
17
|
flyoutContainerElement.scrollTop = 0;
|
|
22
18
|
} else if (flyoutContainerElement.scrollHeight > flyoutContainerElement.clientHeight) {
|
|
23
19
|
const scrollBottom = flyoutContainerElement.clientHeight + flyoutContainerElement.scrollTop;
|
|
24
20
|
const elementBottom = activeDescendantElement.offsetTop + activeDescendantElement.offsetHeight;
|
|
25
|
-
|
|
26
21
|
if (elementBottom > scrollBottom) {
|
|
27
22
|
flyoutContainerElement.scrollTop = elementBottom - flyoutContainerElement.clientHeight;
|
|
28
23
|
} else if (activeDescendantElement.offsetTop < flyoutContainerElement.scrollTop) {
|
|
@@ -6,21 +6,21 @@ import { useState, useEffect } from 'react';
|
|
|
6
6
|
* @param committedInputValue - The committed value of the input.
|
|
7
7
|
* @returns A boolean indicating if the group includes at least one filtered option. If there are no filtered options, the group header should not be rendered.
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
9
|
function useShouldRenderGroupHeader(filteredOptionsRef, committedInputValue) {
|
|
11
|
-
const [shouldRenderHeader, setShouldRenderHeader] = useState(true);
|
|
10
|
+
const [shouldRenderHeader, setShouldRenderHeader] = useState(true);
|
|
12
11
|
|
|
12
|
+
// Should render the header if the group includes at least one filtered option
|
|
13
13
|
useEffect(() => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (((_filteredOptionsRef$c = filteredOptionsRef.current) === null || _filteredOptionsRef$c === void 0 ? void 0 : _filteredOptionsRef$c.length) === 0) {
|
|
14
|
+
if (filteredOptionsRef.current?.length === 0) {
|
|
17
15
|
setShouldRenderHeader(false);
|
|
18
16
|
} else {
|
|
19
17
|
setShouldRenderHeader(true);
|
|
20
18
|
}
|
|
21
|
-
}, [filteredOptionsRef,
|
|
19
|
+
}, [filteredOptionsRef,
|
|
20
|
+
// This needs to be a ref to ensure that the effect doesn't run before options have a chance to register themselves
|
|
22
21
|
committedInputValue // Options will be registered/deregistered based on this value, so this effect needs to run every time this value changes
|
|
23
22
|
]);
|
|
23
|
+
|
|
24
24
|
return shouldRenderHeader;
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -6,29 +6,27 @@
|
|
|
6
6
|
function insertOption(option, options) {
|
|
7
7
|
for (let i = 0; i < options.length; i += 1) {
|
|
8
8
|
const currentNode = options[i];
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
if (
|
|
10
|
+
// eslint-disable-next-line no-bitwise
|
|
11
11
|
currentNode.compareDocumentPosition(option) & Node.DOCUMENT_POSITION_PRECEDING) {
|
|
12
12
|
options.splice(i, 0, option);
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
options.push(option);
|
|
18
17
|
}
|
|
18
|
+
|
|
19
19
|
/**
|
|
20
20
|
* Deletes the `ComboboxOption` element from the options array.
|
|
21
21
|
* @param option - The `ComboboxOption` element to delete.
|
|
22
22
|
* @param options - The list of registered `ComboboxOption`s.
|
|
23
23
|
* @param hookFunctionName - The name of the hook function that is calling this function. Used for any error logs.
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
25
|
function deleteOption(option, options, hookFunctionName) {
|
|
27
26
|
const indexOfNodeToDelete = options.findIndex(n => n === option);
|
|
28
|
-
|
|
29
27
|
if (indexOfNodeToDelete === -1) {
|
|
30
28
|
// eslint-disable-next-line no-console
|
|
31
|
-
console.error(
|
|
29
|
+
console.error(`[${hookFunctionName}] Attempt to delete node failed. This node does not exist in the list of registered nodes.`);
|
|
32
30
|
} else {
|
|
33
31
|
options.splice(indexOfNodeToDelete, 1);
|
|
34
32
|
}
|
|
@@ -20,8 +20,6 @@ import { PortalTargetProvider } from '../../components/UIProvider/PortalTargetCo
|
|
|
20
20
|
import CloseIcon from '../../icons/components/CloseIcon.js';
|
|
21
21
|
|
|
22
22
|
const Drawer = _ref => {
|
|
23
|
-
var _containerRef$current;
|
|
24
|
-
|
|
25
23
|
let {
|
|
26
24
|
id,
|
|
27
25
|
isOpen: externalIsOpen,
|
|
@@ -53,15 +51,12 @@ const Drawer = _ref => {
|
|
|
53
51
|
} = useTranslation();
|
|
54
52
|
const closeButtonAriaLabel = translate('close');
|
|
55
53
|
const closeButtonRef = useRef(null);
|
|
56
|
-
|
|
57
54
|
const close = () => {
|
|
58
55
|
setIsOpen(false);
|
|
59
56
|
};
|
|
60
|
-
|
|
61
57
|
const handleKeyDown = e => {
|
|
62
58
|
if (e.key === 'Escape') close();
|
|
63
59
|
};
|
|
64
|
-
|
|
65
60
|
useOverlay({
|
|
66
61
|
containerRef,
|
|
67
62
|
isVisible: isOpen,
|
|
@@ -76,29 +71,23 @@ const Drawer = _ref => {
|
|
|
76
71
|
setIsHidden(false);
|
|
77
72
|
setElementUsedToOpenModal(document.activeElement);
|
|
78
73
|
} else {
|
|
79
|
-
var _elementRefToFocusOnC;
|
|
80
|
-
|
|
81
74
|
setIsClosing(true);
|
|
82
|
-
if (elementRefToFocusOnClose !== undefined) elementRefToFocusOnClose
|
|
75
|
+
if (elementRefToFocusOnClose !== undefined) elementRefToFocusOnClose?.current?.focus();else elementUsedToOpenModal?.focus();
|
|
83
76
|
}
|
|
84
77
|
}, [elementRefToFocusOnClose, isOpen]);
|
|
85
78
|
useEffect(() => {
|
|
86
79
|
if (isOpen && !isHidden) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
(_closeButtonRef$curre = closeButtonRef.current) === null || _closeButtonRef$curre === void 0 ? void 0 : _closeButtonRef$curre.focus();
|
|
80
|
+
closeButtonRef.current?.focus();
|
|
90
81
|
}
|
|
91
82
|
}, [isOpen, isHidden]);
|
|
92
|
-
|
|
93
83
|
const handleTransitionEnd = () => {
|
|
94
84
|
if (!isOpen) {
|
|
95
85
|
setIsClosing(false);
|
|
96
86
|
setIsHidden(true);
|
|
97
87
|
}
|
|
98
88
|
};
|
|
99
|
-
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
100
|
-
|
|
101
89
|
|
|
90
|
+
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
102
91
|
return domReady ? /*#__PURE__*/createPortal( /*#__PURE__*/React__default.createElement("aside", {
|
|
103
92
|
id: drawerId,
|
|
104
93
|
className: classNames(styles.drawer, {
|
|
@@ -107,7 +96,7 @@ const Drawer = _ref => {
|
|
|
107
96
|
}),
|
|
108
97
|
style: {
|
|
109
98
|
width,
|
|
110
|
-
left:
|
|
99
|
+
left: `${isHidden || isClosing ? `-${width}` : '0'}`,
|
|
111
100
|
zIndex
|
|
112
101
|
},
|
|
113
102
|
onKeyDown: handleKeyDown,
|
|
@@ -132,7 +121,7 @@ const Drawer = _ref => {
|
|
|
132
121
|
"aria-label": closeButtonAriaLabel
|
|
133
122
|
}, /*#__PURE__*/React__default.createElement(CloseIcon, null))), /*#__PURE__*/React__default.createElement("div", {
|
|
134
123
|
"data-testid": getSubDataTestId(dataTestId, 'body')
|
|
135
|
-
}, children))),
|
|
124
|
+
}, children))), containerRef?.current ?? document.body) : null;
|
|
136
125
|
};
|
|
137
126
|
|
|
138
127
|
export { Drawer as default };
|
|
@@ -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 = {"drawer":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._J7cVG{position:absolute;top:0;height:100%;color:#32363a;background-color:#fff;border-right:1px solid #eee;z-index:1000;padding:12px 20px 20px;transition:left .5s}._9XV1R{visibility:hidden}._Mdjdm{display:flex;justify-content:space-between;align-items:start;line-height:20px;font-size:16px;padding-bottom:12px}._XhETZ{padding-top:8px}._RT7Ji{margin-left:12px}";
|
|
4
|
+
var styles = {"drawer":"_J7cVG","hidden":"_9XV1R","header":"_Mdjdm","title":"_XhETZ","closeButton":"_RT7Ji"};
|
|
5
|
+
var stylesheet="._J7cVG{position:absolute;top:0;height:100%;color:#32363a;background-color:#fff;border-right:1px solid #eee;z-index:1000;padding:12px 20px 20px;transition:left .5s}._9XV1R{visibility:hidden}._Mdjdm{display:flex;justify-content:space-between;align-items:start;line-height:20px;font-size:16px;padding-bottom:12px}._XhETZ{padding-top:8px}._RT7Ji{margin-left:12px}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -45,26 +45,28 @@ const FilterAnchor = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
45
45
|
if (isDisabled) {
|
|
46
46
|
e.stopPropagation(); // Prevents "click" events from occurring on parent elements
|
|
47
47
|
} else {
|
|
48
|
-
onClick
|
|
48
|
+
onClick?.(e);
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
onKeyDown: e => {
|
|
52
52
|
if (isDisabled) {
|
|
53
53
|
e.stopPropagation(); // Prevents "keydown" events from occurring on parent elements
|
|
54
54
|
} else {
|
|
55
|
-
onKeyDown
|
|
55
|
+
onKeyDown?.(e);
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
disabled: undefined // This component uses aria-disabled instead of disabled
|
|
59
59
|
,
|
|
60
60
|
"aria-disabled": isDisabled,
|
|
61
|
-
"aria-labelledby": concatIds(selectedFilters && selectedFiltersElementId,
|
|
61
|
+
"aria-labelledby": concatIds(selectedFilters && selectedFiltersElementId,
|
|
62
|
+
// The selected filters (i.e. value) id comes before the label id to match how VoiceOver reads native inputs.
|
|
62
63
|
label && labelElementId, isLocked && lockIconElementId, externalAriaLabelledBy),
|
|
63
64
|
ref: ref
|
|
64
65
|
}), isLocked && /*#__PURE__*/React__default.createElement(LockIcon, {
|
|
65
66
|
size: "small",
|
|
66
67
|
id: lockIconElementId,
|
|
67
|
-
className: styles.lockIcon
|
|
68
|
+
className: styles.lockIcon
|
|
69
|
+
// @ts-ignore - 'locked' is not in the current list of translations
|
|
68
70
|
,
|
|
69
71
|
"aria-label": translate('locked')
|
|
70
72
|
}), label && /*#__PURE__*/React__default.createElement(TextOverflowTooltip, {
|
|
@@ -77,7 +79,7 @@ const FilterAnchor = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
77
79
|
}, label)), isLoading ? /*#__PURE__*/React__default.createElement(LoadingSpinner, {
|
|
78
80
|
show: true,
|
|
79
81
|
size: "xs",
|
|
80
|
-
"aria-label": loadingSpinnerAriaLabel
|
|
82
|
+
"aria-label": loadingSpinnerAriaLabel ?? translate('loading')
|
|
81
83
|
}) : selectedFilters && /*#__PURE__*/React__default.createElement("div", {
|
|
82
84
|
className: styles.selectedFiltersContainer
|
|
83
85
|
}, /*#__PURE__*/React__default.createElement(TextOverflowTooltip, {
|
|
@@ -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 = {"button":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._v8Zjy{display:flex;justify-content:space-between;align-items:center;max-width:100%;min-width:76px;height:36px;padding:0 6px 0 12px;outline:none;font-size:14px;background-color:#fff;border:1px solid #898989;border-radius:20px;cursor:pointer}._v8Zjy:hover:not(._Ku4-o){background-color:rgba(50,54,58,.08)}._v8Zjy:hover:not(._Ku4-o)._vH0o-{border-color:#085caf;background-color:rgba(11,110,208,.04)}._v8Zjy:hover:not(._Ku4-o)._vH0o- ._9m4Is{color:#32363a}._v8Zjy:hover:not(._Ku4-o)._vH0o- ._HGkjY{fill:#32363a}._v8Zjy:hover:not(._Ku4-o)._vH0o- ._uKrcM{fill:#085caf}._v8Zjy:hover:not(._Ku4-o)._vH0o- ._CXHed{background-color:rgba(11,110,208,.11)}._v8Zjy:hover:not(._Ku4-o)._vH0o- ._CXHed ._oHRZe{color:#085caf}._v8Zjy:active:not(._Ku4-o){background-color:#e8e9e9}._v8Zjy:active:not(._Ku4-o)._vH0o-{background-color:rgba(11,110,208,.11);border-color:#0854a1}._v8Zjy:active:not(._Ku4-o)._vH0o- ._uKrcM{fill:#0854a1}._v8Zjy:active:not(._Ku4-o)._vH0o- ._CXHed{background-color:rgba(11,110,208,.11)}._v8Zjy:active:not(._Ku4-o)._vH0o- ._CXHed ._oHRZe{color:#0854a1}._v8Zjy._Ku4-o{background-color:#fafafa;border-color:#e5e5e5;cursor:not-allowed}._v8Zjy._vH0o-{border-color:#0b6ed0}._HGkjY{fill:#515559;margin-right:4px}._9m4Is{max-width:180px;margin-right:3px;color:#515559;fill:#515559;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9m4Is+._CXHed{margin-left:6px}._9m4Is._Ku4-o{color:#74777a}._CXHed{display:flex;justify-content:center;align-items:center;max-width:350px;flex:1;min-width:0;height:24px;margin-right:3px;padding:0 10px;background-color:#ebf3fb;border-radius:20px}._oHRZe{color:#0b6ed0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._uKrcM{fill:#515559}._uKrcM._Ku4-o,._uKrcM._Ku4-o._vH0o-{fill:rgba(116,119,122,.4)}._uKrcM._vH0o-{fill:#0b6ed0}._uKrcM._MLQyb{transform:rotate(-180deg)}body.keyboard-user ._v8Zjy:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
4
|
+
var styles = {"button":"_v8Zjy","disabled":"_Ku4-o","selected":"_vH0o-","label":"_9m4Is","lockIcon":"_HGkjY","chevronIcon":"_uKrcM","selectedFiltersContainer":"_CXHed","selectedFilters":"_oHRZe","open":"_MLQyb"};
|
|
5
|
+
var stylesheet="._v8Zjy{display:flex;justify-content:space-between;align-items:center;max-width:100%;min-width:76px;height:36px;padding:0 6px 0 12px;outline:none;font-size:14px;background-color:#fff;border:1px solid #898989;border-radius:20px;cursor:pointer}._v8Zjy:hover:not(._Ku4-o){background-color:rgba(50,54,58,.08)}._v8Zjy:hover:not(._Ku4-o)._vH0o-{border-color:#085caf;background-color:rgba(11,110,208,.04)}._v8Zjy:hover:not(._Ku4-o)._vH0o- ._9m4Is{color:#32363a}._v8Zjy:hover:not(._Ku4-o)._vH0o- ._HGkjY{fill:#32363a}._v8Zjy:hover:not(._Ku4-o)._vH0o- ._uKrcM{fill:#085caf}._v8Zjy:hover:not(._Ku4-o)._vH0o- ._CXHed{background-color:rgba(11,110,208,.11)}._v8Zjy:hover:not(._Ku4-o)._vH0o- ._CXHed ._oHRZe{color:#085caf}._v8Zjy:active:not(._Ku4-o){background-color:#e8e9e9}._v8Zjy:active:not(._Ku4-o)._vH0o-{background-color:rgba(11,110,208,.11);border-color:#0854a1}._v8Zjy:active:not(._Ku4-o)._vH0o- ._uKrcM{fill:#0854a1}._v8Zjy:active:not(._Ku4-o)._vH0o- ._CXHed{background-color:rgba(11,110,208,.11)}._v8Zjy:active:not(._Ku4-o)._vH0o- ._CXHed ._oHRZe{color:#0854a1}._v8Zjy._Ku4-o{background-color:#fafafa;border-color:#e5e5e5;cursor:not-allowed}._v8Zjy._vH0o-{border-color:#0b6ed0}._HGkjY{fill:#515559;margin-right:4px}._9m4Is{max-width:180px;margin-right:3px;color:#515559;fill:#515559;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9m4Is+._CXHed{margin-left:6px}._9m4Is._Ku4-o{color:#74777a}._CXHed{display:flex;justify-content:center;align-items:center;max-width:350px;flex:1;min-width:0;height:24px;margin-right:3px;padding:0 10px;background-color:#ebf3fb;border-radius:20px}._oHRZe{color:#0b6ed0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._uKrcM{fill:#515559}._uKrcM._Ku4-o,._uKrcM._Ku4-o._vH0o-{fill:rgba(116,119,122,.4)}._uKrcM._vH0o-{fill:#0b6ed0}._uKrcM._MLQyb{transform:rotate(-180deg)}body.keyboard-user ._v8Zjy:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
package/dist/next/Input/Input.js
CHANGED
|
@@ -9,7 +9,6 @@ const getAddOnComponent = (addOn, containerClassName, containerRef) => {
|
|
|
9
9
|
if (!addOn) {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
12
|
const isAddOnAStringOrNumber = typeof addOn === 'string' || typeof addOn === 'number';
|
|
14
13
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
15
14
|
className: classNames(containerClassName, {
|
|
@@ -19,7 +18,6 @@ const getAddOnComponent = (addOn, containerClassName, containerRef) => {
|
|
|
19
18
|
ref: containerRef
|
|
20
19
|
}, addOn);
|
|
21
20
|
};
|
|
22
|
-
|
|
23
21
|
const Input = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
24
22
|
let {
|
|
25
23
|
type = 'text',
|
|
@@ -42,22 +40,21 @@ const Input = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
42
40
|
useSSRLayoutEffect(() => {
|
|
43
41
|
let leftAddOnWidth = 0;
|
|
44
42
|
let rightAddOnWidth = 0;
|
|
45
|
-
|
|
46
43
|
if (leftAddOnRef.current) {
|
|
47
44
|
leftAddOnWidth = leftAddOnRef.current.getBoundingClientRect().width;
|
|
48
45
|
}
|
|
49
|
-
|
|
50
46
|
if (rightAddOnRef.current) {
|
|
51
47
|
rightAddOnWidth = rightAddOnRef.current.getBoundingClientRect().width;
|
|
52
48
|
}
|
|
53
|
-
|
|
54
49
|
setAddOnWidths({
|
|
55
50
|
leftAddOnWidth,
|
|
56
51
|
rightAddOnWidth
|
|
57
52
|
});
|
|
58
|
-
}, [leftAddOn,
|
|
53
|
+
}, [leftAddOn,
|
|
54
|
+
// Re-runs effect when the left add-on changes
|
|
59
55
|
rightAddOn // Re-runs effect when the right add-on changes
|
|
60
56
|
]);
|
|
57
|
+
|
|
61
58
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
62
59
|
className: classNames(inputClasses.container, externalClassName),
|
|
63
60
|
style: style
|
|
@@ -68,8 +65,8 @@ const Input = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
68
65
|
onChange: onChange,
|
|
69
66
|
className: inputClasses.input,
|
|
70
67
|
style: {
|
|
71
|
-
paddingLeft:
|
|
72
|
-
paddingRight:
|
|
68
|
+
paddingLeft: `${addOnWidths.leftAddOnWidth + ADD_ON_HORIZONTAL_PADDING}px`,
|
|
69
|
+
paddingRight: `${addOnWidths.rightAddOnWidth + ADD_ON_HORIZONTAL_PADDING}px`
|
|
73
70
|
},
|
|
74
71
|
ref: ref
|
|
75
72
|
})), getAddOnComponent(rightAddOn, inputClasses.rightAddOn, rightAddOnRef));
|
|
@@ -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 inputClasses = {"container":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._qLNb7{position:relative;display:inline-block;height:36px}._jBfr4{width:100%;height:100%;padding:8px 12px;color:#32363a;caret-color:#32363a;font-size:14px;background-color:#fafafa;border:1px solid #898989;border-radius:4px;outline:none}._jBfr4:hover{cursor:pointer;background-color:#f5f5f5}._jBfr4:focus{background-color:#fafafa;cursor:text;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88;outline:none;border-color:transparent}._jBfr4:disabled,._jBfr4[aria-disabled=true]{background-color:#fafafa;border-color:#e5e5e5;color:#9d9fa1;-webkit-text-fill-color:#9d9fa1;cursor:not-allowed}._jBfr4:disabled::-moz-placeholder,._jBfr4[aria-disabled=true]::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._jBfr4:disabled::placeholder,._jBfr4[aria-disabled=true]::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._jBfr4:invalid,._jBfr4[aria-invalid=true]{border-color:#b00}._jBfr4:invalid:focus,._jBfr4[aria-invalid=true]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000;border-color:transparent}._jBfr4[type=number]{-moz-appearance:textfield}._jBfr4[type=number]::-webkit-inner-spin-button,._jBfr4[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._jBfr4::-moz-placeholder{color:#515559;opacity:1}._jBfr4::placeholder{color:#515559;opacity:1}._xdNju{pointer-events:none;color:#515559;fill:#515559}._fSmRA{display:flex;flex-direction:column;align-items:center;position:absolute;top:50%;transform:translateY(-50%)}._d2GOk{color:#515559;font-size:16px}._hX3p4{left:0;margin-left:6px}._hX3p4,._N09ma{pointer-events:none;color:#515559;fill:#515559;display:flex;flex-direction:column;align-items:center;position:absolute;top:50%;transform:translateY(-50%)}._N09ma{right:0;margin-right:6px}";
|
|
4
|
+
var inputClasses = {"container":"_qLNb7","input":"_jBfr4","addOn":"_xdNju","addOnVerticalCenter":"_fSmRA","addOnTextNode":"_d2GOk","leftAddOn":"_hX3p4","rightAddOn":"_N09ma"};
|
|
5
|
+
var stylesheet="._qLNb7{position:relative;display:inline-block;height:36px}._jBfr4{width:100%;height:100%;padding:8px 12px;color:#32363a;caret-color:#32363a;font-size:14px;background-color:#fafafa;border:1px solid #898989;border-radius:4px;outline:none}._jBfr4:hover{cursor:pointer;background-color:#f5f5f5}._jBfr4:focus{background-color:#fafafa;cursor:text;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88;outline:none;border-color:transparent}._jBfr4:disabled,._jBfr4[aria-disabled=true]{background-color:#fafafa;border-color:#e5e5e5;color:#9d9fa1;-webkit-text-fill-color:#9d9fa1;cursor:not-allowed}._jBfr4:disabled::-moz-placeholder,._jBfr4[aria-disabled=true]::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._jBfr4:disabled::placeholder,._jBfr4[aria-disabled=true]::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._jBfr4:invalid,._jBfr4[aria-invalid=true]{border-color:#b00}._jBfr4:invalid:focus,._jBfr4[aria-invalid=true]:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000;border-color:transparent}._jBfr4[type=number]{-moz-appearance:textfield}._jBfr4[type=number]::-webkit-inner-spin-button,._jBfr4[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._jBfr4::-moz-placeholder{color:#515559;opacity:1}._jBfr4::placeholder{color:#515559;opacity:1}._xdNju{pointer-events:none;color:#515559;fill:#515559}._fSmRA{display:flex;flex-direction:column;align-items:center;position:absolute;top:50%;transform:translateY(-50%)}._d2GOk{color:#515559;font-size:16px}._hX3p4{left:0;margin-left:6px}._hX3p4,._N09ma{pointer-events:none;color:#515559;fill:#515559;display:flex;flex-direction:column;align-items:center;position:absolute;top:50%;transform:translateY(-50%)}._N09ma{right:0;margin-right:6px}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { inputClasses as default, stylesheet };
|
package/dist/next/Menu/Menu.js
CHANGED
|
@@ -5,10 +5,7 @@ import '../../hooks/index.js';
|
|
|
5
5
|
import useControllableState from '../../hooks/useControllableState/useControllableState.js';
|
|
6
6
|
|
|
7
7
|
/* eslint-disable max-classes-per-file */
|
|
8
|
-
|
|
9
8
|
const Menu = _ref => {
|
|
10
|
-
var _process$env;
|
|
11
|
-
|
|
12
9
|
let {
|
|
13
10
|
'data-testid': dataTestId,
|
|
14
11
|
isOpen,
|
|
@@ -16,33 +13,25 @@ const Menu = _ref => {
|
|
|
16
13
|
isDisabled,
|
|
17
14
|
children
|
|
18
15
|
} = _ref;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
window.ResizeObserver = (_window$ResizeObserve = window.ResizeObserver) !== null && _window$ResizeObserve !== void 0 ? _window$ResizeObserve : ResizeObserver;
|
|
24
|
-
window.PointerEvent = (_window$PointerEvent = window.PointerEvent) !== null && _window$PointerEvent !== void 0 ? _window$PointerEvent : PointerEvent;
|
|
16
|
+
if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'test' && window) {
|
|
17
|
+
window.ResizeObserver = window.ResizeObserver ?? ResizeObserver;
|
|
18
|
+
window.PointerEvent = window.PointerEvent ?? PointerEvent;
|
|
25
19
|
}
|
|
26
|
-
|
|
27
20
|
const [open, setOpen] = useControllableState(isOpen, onIsOpenChange, isOpen);
|
|
28
21
|
const [maskHeight, setMaskHeight] = useState(null);
|
|
29
22
|
const [submenus, setSubmenus] = useState(new Set());
|
|
30
23
|
const triggerRef = useRef(null);
|
|
31
|
-
|
|
32
24
|
const registerSubmenu = (submenuId, submenuIsOpen) => {
|
|
33
25
|
setSubmenus(subs => {
|
|
34
26
|
const clone = new Set(subs);
|
|
35
|
-
|
|
36
27
|
if (submenuIsOpen) {
|
|
37
28
|
clone.add(submenuId);
|
|
38
29
|
} else {
|
|
39
30
|
clone.delete(submenuId);
|
|
40
31
|
}
|
|
41
|
-
|
|
42
32
|
return clone;
|
|
43
33
|
});
|
|
44
34
|
};
|
|
45
|
-
|
|
46
35
|
const openPaneDepth = useMemo(() => open ? submenus.size + 1 : 0, [submenus, open]);
|
|
47
36
|
return /*#__PURE__*/React__default.createElement(MenuContextProvider, {
|
|
48
37
|
value: {
|
|
@@ -61,11 +50,11 @@ const Menu = _ref => {
|
|
|
61
50
|
}, children));
|
|
62
51
|
};
|
|
63
52
|
|
|
53
|
+
// https://github.com/radix-ui/primitives/issues/420#issuecomment-771615182
|
|
64
54
|
class ResizeObserver {
|
|
65
55
|
constructor(cb) {
|
|
66
56
|
this.cb = cb;
|
|
67
57
|
}
|
|
68
|
-
|
|
69
58
|
observe() {
|
|
70
59
|
this.cb([{
|
|
71
60
|
borderBoxSize: {
|
|
@@ -73,17 +62,16 @@ class ResizeObserver {
|
|
|
73
62
|
blockSize: 0
|
|
74
63
|
}
|
|
75
64
|
}]);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
unobserve() {} // eslint-disable-next-line class-methods-use-this
|
|
65
|
+
}
|
|
80
66
|
|
|
67
|
+
// eslint-disable-next-line class-methods-use-this
|
|
68
|
+
unobserve() {}
|
|
81
69
|
|
|
70
|
+
// eslint-disable-next-line class-methods-use-this
|
|
82
71
|
disconnect() {}
|
|
72
|
+
}
|
|
83
73
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
74
|
+
// https://github.com/radix-ui/primitives/issues/1220#issuecomment-1087465026
|
|
87
75
|
class PointerEvent extends Event {
|
|
88
76
|
constructor(type, props) {
|
|
89
77
|
super(type, props);
|
|
@@ -91,7 +79,6 @@ class PointerEvent extends Event {
|
|
|
91
79
|
this.ctrlKey = props.ctrlKey || false;
|
|
92
80
|
this.pointerType = props.pointerType || 'mouse';
|
|
93
81
|
}
|
|
94
|
-
|
|
95
82
|
}
|
|
96
83
|
|
|
97
84
|
export { Menu as default };
|
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 = "._zmXuy{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._zmXuy>._Au4JW{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}._zmXuy>._Au4JW:hover:not([aria-disabled=true]){background-color:#f5f5f5}._zmXuy>._Au4JW:focus{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._zmXuy>._Au4JW+._aanC9{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._zmXuy>._Au4JW[data-state=open]+._aanC9{transform:rotate(-180deg) translateY(50%)}._zmXuy>._Au4JW[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._zmXuy>._Au4JW[aria-disabled=true]+._aanC9{fill:#515559;opacity:.4}._qv9PY>[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}._qv9PY>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._aWGc6{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}._aWGc6._o-zRb{padding-top:0}._aWGc6._gyNh8{margin-left:30px;opacity:0;pointer-events:none}._aWGc6._vBNoJ{margin-left:-30px;pointer-events:none}._iAMLH{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%}._iAMLH._T29bC{cursor:unset}._iAMLH ._ua4oj{fill:#32363a;margin-right:4px}._iAMLH[data-highlighted]{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._iAMLH[aria-disabled=true]{cursor:not-allowed;opacity:.65}._iAMLH._-764L{padding-right:32px}._iAMLH._-764L ._aanC9{position:absolute;height:100%;right:3px;fill:#515559}._iAMLH._D2--X{pointer-events:none}._N7SZP{position:sticky;top:0;padding-top:4px;background-color:#fff;z-index:1;border-bottom:1px solid #e8e8e8}._N7SZP>._A8q8b{padding:4px 8px 8px;border-radius:4px 4px 0 0}._N7SZP>._A8q8b>._3vx7P{width:100%}._N7SZP>._A8q8b._D2--X{pointer-events:none}";
|
|
4
|
+
var styles = {"buttonContainer":"_zmXuy","button":"_Au4JW","rightIcon":"_aanC9","maskContainer":"_qv9PY","flyout":"_aWGc6","containsStickyBox":"_o-zRb","animatedRight":"_gyNh8","animatedLeft":"_vBNoJ","menuItem":"_iAMLH","noItems":"_T29bC","backIcon":"_ua4oj","subMenu":"_-764L","unresponsive":"_D2--X","stickyBox":"_N7SZP","searchBox":"_A8q8b","searchInput":"_3vx7P"};
|
|
5
|
+
var stylesheet="._zmXuy{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._zmXuy>._Au4JW{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}._zmXuy>._Au4JW:hover:not([aria-disabled=true]){background-color:#f5f5f5}._zmXuy>._Au4JW:focus{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._zmXuy>._Au4JW+._aanC9{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._zmXuy>._Au4JW[data-state=open]+._aanC9{transform:rotate(-180deg) translateY(50%)}._zmXuy>._Au4JW[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._zmXuy>._Au4JW[aria-disabled=true]+._aanC9{fill:#515559;opacity:.4}._qv9PY>[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}._qv9PY>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._aWGc6{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}._aWGc6._o-zRb{padding-top:0}._aWGc6._gyNh8{margin-left:30px;opacity:0;pointer-events:none}._aWGc6._vBNoJ{margin-left:-30px;pointer-events:none}._iAMLH{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%}._iAMLH._T29bC{cursor:unset}._iAMLH ._ua4oj{fill:#32363a;margin-right:4px}._iAMLH[data-highlighted]{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._iAMLH[aria-disabled=true]{cursor:not-allowed;opacity:.65}._iAMLH._-764L{padding-right:32px}._iAMLH._-764L ._aanC9{position:absolute;height:100%;right:3px;fill:#515559}._iAMLH._D2--X{pointer-events:none}._N7SZP{position:sticky;top:0;padding-top:4px;background-color:#fff;z-index:1;border-bottom:1px solid #e8e8e8}._N7SZP>._A8q8b{padding:4px 8px 8px;border-radius:4px 4px 0 0}._N7SZP>._A8q8b>._3vx7P{width:100%}._N7SZP>._A8q8b._D2--X{pointer-events:none}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -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({
|