@qualtrics/ui-react 2.18.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 +28 -0
- package/dist/__shared/cjs/{index-00992312.js → index-384184bd.js} +994 -1872
- package/dist/__shared/cjs/{index-615ed9b2.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/HStack.js +11 -0
- package/dist/next/Stack/Stack.js +95 -0
- package/dist/next/Stack/StackItem.js +37 -0
- package/dist/next/Stack/VStack.js +11 -0
- package/dist/next/Stack/index.js +3 -0
- 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 +82 -4
- package/dist/next/index.es.js +4 -0
- package/dist/next/index.js +514 -745
- 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 +3 -2
- package/next/package.json +6 -2
- package/package.json +10 -5
|
@@ -18,31 +18,20 @@ import useControllableState from '../../hooks/useControllableState/useControllab
|
|
|
18
18
|
import useClickOutside from '../../hooks/useClickOutside/useClickOutside.js';
|
|
19
19
|
import wrapEvent from '../../utils/wrapEvent/wrapEvent.js';
|
|
20
20
|
|
|
21
|
-
const getOptionLabel = option =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return option === null || option === void 0 ? void 0 : (_option$props = option.props) === null || _option$props === void 0 ? void 0 : _option$props.label;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const getOptionValue = option => {
|
|
28
|
-
var _option$props2;
|
|
29
|
-
|
|
30
|
-
return option === null || option === void 0 ? void 0 : (_option$props2 = option.props) === null || _option$props2 === void 0 ? void 0 : _option$props2.value;
|
|
31
|
-
};
|
|
32
|
-
|
|
21
|
+
const getOptionLabel = option => option?.props?.label;
|
|
22
|
+
const getOptionValue = option => option?.props?.value;
|
|
33
23
|
const doesOptionMatchFilter = (option, header, inputValue) => {
|
|
34
24
|
var _context, _context2;
|
|
25
|
+
const label = getOptionLabel(option);
|
|
35
26
|
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
// Filtering is turned off if the input value is empty or not a string, so the given option will be included in the filtered list, thus returns true
|
|
38
28
|
if (typeof inputValue !== 'string' || !inputValue) {
|
|
39
29
|
return true;
|
|
40
|
-
}
|
|
41
|
-
|
|
30
|
+
}
|
|
42
31
|
|
|
32
|
+
// Returns true if the given option's label or the given header includes the input value (the label and header must be strings in order to do the comparison)
|
|
43
33
|
return typeof label === 'string' && _includesInstanceProperty(_context = label.toLowerCase()).call(_context, inputValue.toLowerCase()) || typeof header === 'string' && _includesInstanceProperty(_context2 = header.toLowerCase()).call(_context2, inputValue.toLowerCase());
|
|
44
34
|
};
|
|
45
|
-
|
|
46
35
|
const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
47
36
|
let {
|
|
48
37
|
children,
|
|
@@ -69,27 +58,25 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
69
58
|
const isOptionSelectedOnKeyboardHighlight = unstable_isOptionSelectedOnKeyboardHighlight;
|
|
70
59
|
const isFilteringDisabled = isOptionSelectedOnKeyboardHighlight || externalIsFilteringDisabled;
|
|
71
60
|
let comboboxInput = /*#__PURE__*/React__default.createElement(ComboboxInput, null);
|
|
72
|
-
let comboboxList = /*#__PURE__*/React__default.createElement(ComboboxList, null);
|
|
61
|
+
let comboboxList = /*#__PURE__*/React__default.createElement(ComboboxList, null);
|
|
73
62
|
|
|
63
|
+
// Gets the <ComboboxInput> and <ComboboxList> components from the children
|
|
74
64
|
React__default.Children.forEach(children, child => {
|
|
75
65
|
if ( /*#__PURE__*/React__default.isValidElement(child)) {
|
|
76
|
-
if (
|
|
66
|
+
if (child?.type === ComboboxInput) {
|
|
77
67
|
comboboxInput = child;
|
|
78
|
-
} else if (
|
|
68
|
+
} else if (child?.type === ComboboxList) {
|
|
79
69
|
comboboxList = child;
|
|
80
70
|
}
|
|
81
71
|
}
|
|
82
72
|
});
|
|
83
73
|
const listContainerId = useId(comboboxList.props.id);
|
|
84
|
-
const noMatchesFoundContainerId =
|
|
74
|
+
const noMatchesFoundContainerId = `${listContainerId}-no-matches-found`;
|
|
85
75
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
matcher: child => (child === null || child === void 0 ? void 0 : child.type) === ComboboxOption
|
|
91
|
-
}]);
|
|
92
|
-
}, [comboboxList]);
|
|
76
|
+
// Extracts all ComboboxOptions
|
|
77
|
+
const [, [allOptions]] = useMemo(() => filterChildren(comboboxList?.props?.children, [{
|
|
78
|
+
matcher: child => child?.type === ComboboxOption
|
|
79
|
+
}]), [comboboxList]);
|
|
93
80
|
const {
|
|
94
81
|
defaultValue: defaultInputValue,
|
|
95
82
|
onChange: onInputChange,
|
|
@@ -100,45 +87,48 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
100
87
|
const inputRef = useRef(null);
|
|
101
88
|
const iconRef = useRef(null);
|
|
102
89
|
const [isFlyoutOpen, setIsFlyoutOpen] = useControllableState(false, onIsOpenChange, externalIsOpen);
|
|
103
|
-
const [isKeyboardUser, setIsKeyboardUser] = useState(false);
|
|
90
|
+
const [isKeyboardUser, setIsKeyboardUser] = useState(false);
|
|
104
91
|
|
|
105
|
-
|
|
92
|
+
// Highlighted index is only used when isOptionSelectedOnKeyboardHighlight is set to false
|
|
93
|
+
const [highlightedIndex, setHighlightedIndex] = useState(-1);
|
|
106
94
|
|
|
95
|
+
// This option value is the "computer readable" value. The option value is not used to set the input value.
|
|
107
96
|
const [selectedOptionValue, setSelectedOptionValue] = useControllableState(defaultSelectedOptionValue, onChange, externalSelectedOptionValue);
|
|
108
|
-
const getLabelForValue = useCallback(value => getOptionLabel(allOptions.find(option => getOptionValue(option) === value)), [allOptions]);
|
|
97
|
+
const getLabelForValue = useCallback(value => getOptionLabel(allOptions.find(option => getOptionValue(option) === value)), [allOptions]);
|
|
109
98
|
|
|
99
|
+
// The option label is the "human readable" value. The option label is used to set the input value.
|
|
110
100
|
const [selectedOptionLabel, setSelectedOptionLabel] = useState(() => getLabelForValue(selectedOptionValue) || externalInputValue || defaultInputValue || '');
|
|
111
|
-
const [inputValue, setInputValue] = useControllableState(selectedOptionLabel,
|
|
112
|
-
|
|
101
|
+
const [inputValue, setInputValue] = useControllableState(selectedOptionLabel,
|
|
102
|
+
// `e &&` prevents `ComboboxInput` from calling consumer-passed `onChange` for consumer-controlled `Combobox` value updates.
|
|
103
|
+
(_, e) => e && onInputChange?.(e), externalInputValue);
|
|
113
104
|
|
|
105
|
+
// listen for updates from controlled value
|
|
114
106
|
useEffect(() => {
|
|
115
107
|
if (selectedOptionValue) {
|
|
116
108
|
setInputValue(getLabelForValue(selectedOptionValue), null);
|
|
117
109
|
}
|
|
118
|
-
}, [selectedOptionValue, setInputValue, getLabelForValue]);
|
|
110
|
+
}, [selectedOptionValue, setInputValue, getLabelForValue]);
|
|
119
111
|
|
|
112
|
+
// Selected index is only used when isOptionSelectedOnKeyboardHighlight is set to true
|
|
120
113
|
const [selectedIndex, setSelectedIndex] = useState(() => {
|
|
121
114
|
if (isOptionSelectedOnKeyboardHighlight) {
|
|
122
115
|
for (let i = 0; i < allOptions.length; i += 1) {
|
|
123
116
|
const option = allOptions[i];
|
|
124
|
-
|
|
125
117
|
if (getOptionValue(option) === selectedOptionValue) {
|
|
126
118
|
return i;
|
|
127
119
|
}
|
|
128
120
|
}
|
|
129
121
|
}
|
|
130
|
-
|
|
131
122
|
return -1;
|
|
132
123
|
});
|
|
133
|
-
useClickOutside([listRef, inputRef, iconRef], () => isFlyoutOpen && setIsFlyoutOpen(false));
|
|
124
|
+
useClickOutside([listRef, inputRef, iconRef], () => isFlyoutOpen && setIsFlyoutOpen(false));
|
|
134
125
|
|
|
135
|
-
|
|
126
|
+
// The number of options that match the filter for each header
|
|
127
|
+
const headerCounts = {};
|
|
136
128
|
|
|
129
|
+
// Gets the filtered options based on the current input value (only if isFilteringDisabled is false)
|
|
137
130
|
const [listChildrenFilteredOptions, [, filteredOptions]] = useMemo(() => {
|
|
138
|
-
var _comboboxList2, _comboboxList2$props;
|
|
139
|
-
|
|
140
131
|
let currentHeaderTitle;
|
|
141
|
-
|
|
142
132
|
const handleSelect = option => {
|
|
143
133
|
const newOptionValue = getOptionValue(option);
|
|
144
134
|
const newInputValue = getOptionLabel(option);
|
|
@@ -149,18 +139,15 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
149
139
|
}
|
|
150
140
|
});
|
|
151
141
|
};
|
|
152
|
-
|
|
153
|
-
return filterChildren((_comboboxList2 = comboboxList) === null || _comboboxList2 === void 0 ? void 0 : (_comboboxList2$props = _comboboxList2.props) === null || _comboboxList2$props === void 0 ? void 0 : _comboboxList2$props.children, [
|
|
142
|
+
return filterChildren(comboboxList?.props?.children, [
|
|
154
143
|
/*
|
|
155
144
|
* For each header, adds a key value pair to the headerCounts object where the key is the header title and the value is 0.
|
|
156
145
|
* The value will be updated in the matcher/modifier below this matcher/modifier.
|
|
157
146
|
*/
|
|
158
147
|
{
|
|
159
|
-
matcher: child =>
|
|
148
|
+
matcher: child => child?.type === ComboboxHeader,
|
|
160
149
|
modifier: child => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
currentHeaderTitle = (_props = child.props) === null || _props === void 0 ? void 0 : _props.title;
|
|
150
|
+
currentHeaderTitle = child.props?.title;
|
|
164
151
|
headerCounts[currentHeaderTitle] = 0;
|
|
165
152
|
return child;
|
|
166
153
|
}
|
|
@@ -170,119 +157,95 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
170
157
|
* Otherwise, returns null.
|
|
171
158
|
*/
|
|
172
159
|
{
|
|
173
|
-
matcher: child =>
|
|
160
|
+
matcher: child => child?.type === ComboboxOption,
|
|
174
161
|
modifier: (child, index) => {
|
|
175
162
|
if (inputValue === selectedOptionLabel || isFilteringDisabled || doesOptionMatchFilter(child, currentHeaderTitle, inputValue)) {
|
|
176
|
-
var _props$id;
|
|
177
|
-
|
|
178
163
|
headerCounts[currentHeaderTitle] += 1;
|
|
179
164
|
return /*#__PURE__*/cloneElement(child, {
|
|
180
165
|
onSelect: e => {
|
|
181
|
-
|
|
166
|
+
child?.props?.onSelect?.(e);
|
|
182
167
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if ((e === null || e === void 0 ? void 0 : e.key) === 'Enter') {
|
|
168
|
+
// Prevents form submission
|
|
169
|
+
if (e?.key === 'Enter') {
|
|
186
170
|
e.preventDefault();
|
|
187
171
|
}
|
|
188
|
-
|
|
189
172
|
if (!e.key) {
|
|
190
173
|
setIsFlyoutOpen(false);
|
|
191
174
|
}
|
|
192
|
-
|
|
193
175
|
handleSelect(child);
|
|
194
176
|
},
|
|
195
177
|
onMouseEnter: wrapEvent(child.props.onMouseEnter, () => {
|
|
196
178
|
if (!isOptionSelectedOnKeyboardHighlight) {
|
|
197
179
|
setHighlightedIndex(index);
|
|
198
180
|
}
|
|
199
|
-
|
|
200
181
|
setIsKeyboardUser(false);
|
|
201
182
|
}),
|
|
202
183
|
onMouseLeave: wrapEvent(child.props.onMouseLeave, () => {
|
|
203
184
|
if (!isOptionSelectedOnKeyboardHighlight) {
|
|
204
185
|
setHighlightedIndex(-1);
|
|
205
186
|
}
|
|
206
|
-
|
|
207
187
|
setIsKeyboardUser(false);
|
|
208
188
|
}),
|
|
209
189
|
isHighlightedOnHover: isOptionSelectedOnKeyboardHighlight,
|
|
210
190
|
isHighlighted: isOptionSelectedOnKeyboardHighlight ? false : index === highlightedIndex,
|
|
211
191
|
isSelected: isOptionSelectedOnKeyboardHighlight ? index === selectedIndex : selectedOptionValue === getOptionValue(child),
|
|
212
|
-
id:
|
|
192
|
+
id: child.props.id ?? `${listContainerId}-option-${index}`,
|
|
213
193
|
ref: node => {
|
|
214
194
|
optionRefs.current[Number(index)] = node;
|
|
215
195
|
}
|
|
216
196
|
});
|
|
217
197
|
}
|
|
218
|
-
|
|
219
198
|
return null;
|
|
220
199
|
}
|
|
221
200
|
}]);
|
|
222
201
|
}, [comboboxList, headerCounts, highlightedIndex, inputValue, isFilteringDisabled, selectedOptionLabel, selectedOptionValue, setInputValue, setIsFlyoutOpen, setSelectedOptionValue, isOptionSelectedOnKeyboardHighlight, selectedIndex, listContainerId]);
|
|
223
|
-
const isAriaExpanded = useMemo(() => isFlyoutOpen && (unstable_isLoading || filteredOptions.length > 0), [isFlyoutOpen, filteredOptions, unstable_isLoading]);
|
|
202
|
+
const isAriaExpanded = useMemo(() => isFlyoutOpen && (unstable_isLoading || filteredOptions.length > 0), [isFlyoutOpen, filteredOptions, unstable_isLoading]);
|
|
224
203
|
|
|
204
|
+
// Gets all filtered options, as well as headers that have at least one filtered option
|
|
225
205
|
const [listChildrenFilteredOptionsAndHeaders] = useMemo(() => filterChildren(listChildrenFilteredOptions, [{
|
|
226
|
-
matcher: child =>
|
|
206
|
+
matcher: child => child?.type === ComboboxOption
|
|
227
207
|
}, {
|
|
228
|
-
matcher: child =>
|
|
229
|
-
modifier: child =>
|
|
230
|
-
var _props3;
|
|
231
|
-
|
|
232
|
-
return headerCounts[(_props3 = child.props) === null || _props3 === void 0 ? void 0 : _props3.title] ? child : null;
|
|
233
|
-
}
|
|
208
|
+
matcher: child => child?.type === ComboboxHeader,
|
|
209
|
+
modifier: child => headerCounts[child.props?.title] ? child : null
|
|
234
210
|
}]), [headerCounts, listChildrenFilteredOptions]);
|
|
235
|
-
|
|
236
211
|
const keyboardHighlightOrSelectOption = (index, e) => {
|
|
237
212
|
setIsKeyboardUser(true);
|
|
238
|
-
|
|
239
213
|
if (isOptionSelectedOnKeyboardHighlight) {
|
|
240
|
-
var _filteredOptions$inde, _filteredOptions$inde2, _filteredOptions$inde3;
|
|
241
|
-
|
|
242
214
|
setSelectedIndex(index);
|
|
243
|
-
|
|
215
|
+
filteredOptions[index]?.props?.onSelect?.(e);
|
|
244
216
|
} else {
|
|
245
217
|
setHighlightedIndex(index);
|
|
246
218
|
}
|
|
247
219
|
};
|
|
248
|
-
|
|
249
220
|
const handleFocus = () => {
|
|
250
221
|
if (!isFlyoutOpen) {
|
|
251
222
|
setIsFlyoutOpen(true);
|
|
252
223
|
}
|
|
253
224
|
};
|
|
254
|
-
|
|
255
225
|
const handleBlur = () => {
|
|
256
226
|
if (isFlyoutOpen) {
|
|
257
227
|
setIsFlyoutOpen(false);
|
|
258
228
|
}
|
|
259
|
-
|
|
260
229
|
if (!inputValue) {
|
|
261
230
|
if (selectedOptionValue !== '') {
|
|
262
231
|
setSelectedOptionValue('');
|
|
263
232
|
}
|
|
264
|
-
|
|
265
233
|
return;
|
|
266
234
|
}
|
|
267
|
-
|
|
268
235
|
if (selectedOptionLabel !== inputValue) {
|
|
269
236
|
// Updates the selected option value and selected index based on the input value
|
|
270
237
|
if (unstable_autoSelect) {
|
|
271
238
|
for (let i = 0; i < allOptions.length; i += 1) {
|
|
272
239
|
const option = allOptions[i];
|
|
273
|
-
|
|
274
240
|
if (getOptionLabel(option) === inputValue) {
|
|
275
241
|
setSelectedOptionValue(getOptionValue(option));
|
|
276
|
-
|
|
277
242
|
if (isOptionSelectedOnKeyboardHighlight) {
|
|
278
243
|
setSelectedIndex(i);
|
|
279
244
|
}
|
|
280
|
-
|
|
281
245
|
return;
|
|
282
246
|
}
|
|
283
247
|
}
|
|
284
248
|
}
|
|
285
|
-
|
|
286
249
|
if (unstable_freeForm) {
|
|
287
250
|
setSelectedOptionValue(null);
|
|
288
251
|
} else {
|
|
@@ -294,32 +257,24 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
294
257
|
}
|
|
295
258
|
}
|
|
296
259
|
};
|
|
297
|
-
|
|
298
260
|
const handleInputChange = e => {
|
|
299
261
|
e.persist();
|
|
300
262
|
setInputValue(e.target.value, e);
|
|
301
|
-
|
|
302
263
|
if (!isOptionSelectedOnKeyboardHighlight) {
|
|
303
264
|
setHighlightedIndex(-1);
|
|
304
265
|
}
|
|
305
266
|
};
|
|
306
|
-
|
|
307
267
|
const handleKeyDown = e => {
|
|
308
268
|
const currentIndex = isOptionSelectedOnKeyboardHighlight ? selectedIndex : highlightedIndex;
|
|
309
|
-
|
|
310
269
|
switch (e.key) {
|
|
311
270
|
case 'Enter':
|
|
312
271
|
if (isFlyoutOpen) {
|
|
313
272
|
if (!isOptionSelectedOnKeyboardHighlight && filteredOptions.length > 0 && filteredOptions[highlightedIndex] !== undefined) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
(_filteredOptions$high = filteredOptions[highlightedIndex]) === null || _filteredOptions$high === void 0 ? void 0 : (_filteredOptions$high2 = _filteredOptions$high.props) === null || _filteredOptions$high2 === void 0 ? void 0 : (_filteredOptions$high3 = _filteredOptions$high2.onSelect) === null || _filteredOptions$high3 === void 0 ? void 0 : _filteredOptions$high3.call(_filteredOptions$high2, e);
|
|
273
|
+
filteredOptions[highlightedIndex]?.props?.onSelect?.(e);
|
|
317
274
|
}
|
|
318
275
|
}
|
|
319
|
-
|
|
320
276
|
setIsFlyoutOpen(false);
|
|
321
277
|
break;
|
|
322
|
-
|
|
323
278
|
case 'ArrowDown':
|
|
324
279
|
e.preventDefault(); // Prevents cursor movement inside of input
|
|
325
280
|
|
|
@@ -330,10 +285,8 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
330
285
|
} else if (currentIndex >= filteredOptions.length && filteredOptions.length > 0) {
|
|
331
286
|
keyboardHighlightOrSelectOption(filteredOptions.length - 1, e);
|
|
332
287
|
}
|
|
333
|
-
|
|
334
288
|
setIsFlyoutOpen(true);
|
|
335
289
|
break;
|
|
336
|
-
|
|
337
290
|
case 'ArrowUp':
|
|
338
291
|
e.preventDefault(); // Prevents cursor movement inside of input
|
|
339
292
|
|
|
@@ -342,62 +295,49 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
342
295
|
} else if (currentIndex >= filteredOptions.length || currentIndex === -1 && filteredOptions.length > 0) {
|
|
343
296
|
keyboardHighlightOrSelectOption(filteredOptions.length - 1, e);
|
|
344
297
|
}
|
|
345
|
-
|
|
346
298
|
setIsFlyoutOpen(true);
|
|
347
299
|
break;
|
|
348
|
-
|
|
349
300
|
case 'PageUp':
|
|
350
301
|
e.preventDefault(); // Prevents page scroll
|
|
351
302
|
|
|
352
303
|
if (filteredOptions.length > 0) {
|
|
353
304
|
keyboardHighlightOrSelectOption(0, e);
|
|
354
305
|
}
|
|
355
|
-
|
|
356
306
|
setIsFlyoutOpen(true);
|
|
357
307
|
break;
|
|
358
|
-
|
|
359
308
|
case 'PageDown':
|
|
360
309
|
e.preventDefault(); // Prevents page scroll
|
|
361
310
|
|
|
362
311
|
if (filteredOptions.length > 0) {
|
|
363
312
|
keyboardHighlightOrSelectOption(filteredOptions.length - 1, e);
|
|
364
313
|
}
|
|
365
|
-
|
|
366
314
|
setIsFlyoutOpen(true);
|
|
367
315
|
break;
|
|
368
|
-
|
|
369
316
|
case 'Escape':
|
|
370
317
|
e.preventDefault();
|
|
371
|
-
|
|
372
318
|
if (isFlyoutOpen) {
|
|
373
319
|
e.stopPropagation(); // prevent event from closing modals or popovers
|
|
374
320
|
}
|
|
375
321
|
|
|
376
322
|
setIsFlyoutOpen(false);
|
|
377
323
|
break;
|
|
378
|
-
|
|
379
324
|
default:
|
|
380
325
|
return false;
|
|
381
326
|
}
|
|
382
|
-
|
|
383
327
|
return false;
|
|
384
|
-
};
|
|
385
|
-
|
|
328
|
+
};
|
|
386
329
|
|
|
330
|
+
// Scrolls to the highlighted option if the highlighted option is out of view
|
|
387
331
|
useEffect(() => {
|
|
388
332
|
const currentIndex = isOptionSelectedOnKeyboardHighlight ? selectedIndex : highlightedIndex;
|
|
389
333
|
const optionRef = optionRefs.current[currentIndex];
|
|
390
|
-
|
|
391
|
-
if (isKeyboardUser && isFlyoutOpen && optionRef && listRef !== null && listRef !== void 0 && listRef.current) {
|
|
392
|
-
var _listRef$current, _listRef$current2;
|
|
393
|
-
|
|
334
|
+
if (isKeyboardUser && isFlyoutOpen && optionRef && listRef?.current) {
|
|
394
335
|
if (currentIndex === 0) {
|
|
395
336
|
// Scrolls the first header into view if one exists
|
|
396
337
|
listRef.current.scrollTop = 0;
|
|
397
|
-
} else if (
|
|
338
|
+
} else if (listRef.current?.scrollHeight > listRef.current?.clientHeight) {
|
|
398
339
|
const scrollBottom = listRef.current.clientHeight + listRef.current.scrollTop;
|
|
399
340
|
const elementBottom = optionRef.offsetTop + optionRef.offsetHeight;
|
|
400
|
-
|
|
401
341
|
if (elementBottom > scrollBottom) {
|
|
402
342
|
listRef.current.scrollTop = elementBottom - listRef.current.clientHeight;
|
|
403
343
|
} else if (optionRef.offsetTop < listRef.current.scrollTop) {
|
|
@@ -405,24 +345,21 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
405
345
|
}
|
|
406
346
|
}
|
|
407
347
|
}
|
|
408
|
-
}, [isKeyboardUser, highlightedIndex, selectedIndex, isOptionSelectedOnKeyboardHighlight, isFlyoutOpen]);
|
|
348
|
+
}, [isKeyboardUser, highlightedIndex, selectedIndex, isOptionSelectedOnKeyboardHighlight, isFlyoutOpen]);
|
|
409
349
|
|
|
350
|
+
// Updates the selected option label and selected option index based on the new selected option value
|
|
410
351
|
useEffect(() => {
|
|
411
352
|
if (isOptionSelectedOnKeyboardHighlight) {
|
|
412
353
|
setSelectedIndex(-1);
|
|
413
354
|
}
|
|
414
|
-
|
|
415
355
|
if (selectedOptionValue === '') {
|
|
416
356
|
setSelectedOptionLabel('');
|
|
417
357
|
return;
|
|
418
358
|
}
|
|
419
|
-
|
|
420
359
|
for (let i = 0; i < allOptions.length; i += 1) {
|
|
421
360
|
const option = allOptions[i];
|
|
422
|
-
|
|
423
361
|
if (getOptionValue(option) === selectedOptionValue) {
|
|
424
362
|
setSelectedOptionLabel(getOptionLabel(option));
|
|
425
|
-
|
|
426
363
|
if (isOptionSelectedOnKeyboardHighlight) {
|
|
427
364
|
setSelectedIndex(i);
|
|
428
365
|
return;
|
|
@@ -438,26 +375,18 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
438
375
|
const activeDescendantId = useMemo(() => {
|
|
439
376
|
if (isAriaExpanded) {
|
|
440
377
|
if (unstable_isLoading) {
|
|
441
|
-
return
|
|
378
|
+
return `${listContainerId}-loading-spinner`;
|
|
442
379
|
}
|
|
443
|
-
|
|
444
380
|
if (filteredOptions.length === 0) {
|
|
445
381
|
return undefined;
|
|
446
382
|
}
|
|
447
|
-
|
|
448
383
|
if (selectedIndex !== -1) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
return (_filteredOptions$sele = filteredOptions[selectedIndex]) === null || _filteredOptions$sele === void 0 ? void 0 : _filteredOptions$sele.props.id;
|
|
384
|
+
return filteredOptions[selectedIndex]?.props.id;
|
|
452
385
|
}
|
|
453
|
-
|
|
454
386
|
if (highlightedIndex !== -1) {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
return (_filteredOptions$high4 = filteredOptions[highlightedIndex]) === null || _filteredOptions$high4 === void 0 ? void 0 : _filteredOptions$high4.props.id;
|
|
387
|
+
return filteredOptions[highlightedIndex]?.props.id;
|
|
458
388
|
}
|
|
459
389
|
}
|
|
460
|
-
|
|
461
390
|
return undefined;
|
|
462
391
|
}, [isAriaExpanded, selectedIndex, highlightedIndex, unstable_isOptionSelectedOnKeyboardHighlight, filteredOptions, unstable_isLoading, listContainerId]);
|
|
463
392
|
return /*#__PURE__*/React__default.createElement(ComboboxContextProvider, {
|
|
@@ -493,7 +422,8 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
493
422
|
ref: ref
|
|
494
423
|
}), comboboxInput, /*#__PURE__*/React__default.createElement(ComboboxIcon, null), /*#__PURE__*/React__default.cloneElement(comboboxList, {}, filteredOptions.length === 0 ? /*#__PURE__*/React__default.createElement("div", {
|
|
495
424
|
className: styles.comboboxEmpty,
|
|
496
|
-
id: noMatchesFoundContainerId
|
|
425
|
+
id: noMatchesFoundContainerId
|
|
426
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
497
427
|
,
|
|
498
428
|
role: "option" // `aria-selected` is omitted because this option is not selectable
|
|
499
429
|
,
|
|
@@ -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 = {"combobox":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._-v2RP{position:relative;display:inline-block}._m3dzE{padding-right:36px}._m3dzE._m9rO2{box-shadow:none!important;border:1px solid #898989!important}._ZHtKi{margin-top:4px}._sU7TX{position:absolute;right:4px;bottom:4px;height:28px;width:28px;border-radius:4px;fill:#515559;cursor:pointer}._sU7TX:hover{background-color:rgba(50,54,58,.08)}._sU7TX:active{background-color:rgba(50,54,58,.11)}._sU7TX._-AQdH{transform:rotate(-180deg)}._sU7TX._As3gq{opacity:.4}._15ELK{min-height:40px;padding:10px 12px;display:flex;flex-direction:row;align-items:center;background-color:#fff;font-size:14px;color:#32363a;word-break:break-word}._As3gq{cursor:not-allowed}._As3gq:hover{background-color:transparent}";
|
|
4
|
+
var styles = {"combobox":"_-v2RP","comboboxInput":"_m3dzE","ignoreFocusStyle":"_m9rO2","labelledInput":"_ZHtKi","comboboxIcon":"_sU7TX","open":"_-AQdH","disabled":"_As3gq","comboboxEmpty":"_15ELK"};
|
|
5
|
+
var stylesheet="._-v2RP{position:relative;display:inline-block}._m3dzE{padding-right:36px}._m3dzE._m9rO2{box-shadow:none!important;border:1px solid #898989!important}._ZHtKi{margin-top:4px}._sU7TX{position:absolute;right:4px;bottom:4px;height:28px;width:28px;border-radius:4px;fill:#515559;cursor:pointer}._sU7TX:hover{background-color:rgba(50,54,58,.08)}._sU7TX:active{background-color:rgba(50,54,58,.11)}._sU7TX._-AQdH{transform:rotate(-180deg)}._sU7TX._As3gq{opacity:.4}._15ELK{min-height:40px;padding:10px 12px;display:flex;flex-direction:row;align-items:center;background-color:#fff;font-size:14px;color:#32363a;word-break:break-word}._As3gq{cursor:not-allowed}._As3gq:hover{background-color:transparent}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -13,7 +13,7 @@ const ComboboxHeader = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
13
13
|
} = _ref;
|
|
14
14
|
return /*#__PURE__*/React__default.createElement(FlyoutHeader, _extends({}, rest, {
|
|
15
15
|
title: title,
|
|
16
|
-
onMouseDown: wrapEvent(onMouseDown, e => e
|
|
16
|
+
onMouseDown: wrapEvent(onMouseDown, e => e?.preventDefault()),
|
|
17
17
|
ref: ref
|
|
18
18
|
}), children);
|
|
19
19
|
});
|
|
@@ -34,12 +34,10 @@ const ComboboxIcon = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
34
34
|
if (inputRef.current === document.activeElement) {
|
|
35
35
|
setIsOpen(!isOpen);
|
|
36
36
|
} else {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
37
|
+
inputRef.current?.focus();
|
|
40
38
|
}
|
|
41
39
|
}) : undefined,
|
|
42
|
-
onMouseDown: wrapEvent(onMouseDown, e => e
|
|
40
|
+
onMouseDown: wrapEvent(onMouseDown, e => e?.preventDefault()),
|
|
43
41
|
ref: mergeRefs(ref, iconRef),
|
|
44
42
|
"aria-hidden": "true"
|
|
45
43
|
}));
|
|
@@ -69,22 +69,21 @@ const ComboboxInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
69
69
|
onChange: handleInputChange,
|
|
70
70
|
onFocus: wrapEvent(onFocus, handleFocus),
|
|
71
71
|
onKeyDown: wrapEvent(onKeyDown, handleKeyDown),
|
|
72
|
-
onMouseDown: e => onMouseDown
|
|
72
|
+
onMouseDown: e => onMouseDown?.(e),
|
|
73
73
|
onClick: e => {
|
|
74
74
|
if (!isOptionSelectedOnKeyboardHighlight && numberOfOptions > 0) {
|
|
75
75
|
setHighlightedIndex(0);
|
|
76
76
|
}
|
|
77
|
-
|
|
78
77
|
setIsOpen(true);
|
|
79
|
-
onClick
|
|
78
|
+
onClick?.(e);
|
|
80
79
|
},
|
|
81
80
|
role: "combobox",
|
|
82
81
|
"aria-autocomplete": isFilteringDisabled ? 'none' : 'list',
|
|
83
82
|
"aria-expanded": isAriaExpanded,
|
|
84
83
|
"aria-controls": isAriaExpanded ? listContainerId : undefined,
|
|
85
84
|
"aria-activedescendant": activeDescendantId,
|
|
86
|
-
"aria-label": ariaLabelFromProps
|
|
87
|
-
"aria-labelledby": ariaLabelledbyFromProps
|
|
85
|
+
"aria-label": ariaLabelFromProps ?? ariaLabel,
|
|
86
|
+
"aria-labelledby": ariaLabelledbyFromProps ?? ariaLabelledby
|
|
88
87
|
}));
|
|
89
88
|
});
|
|
90
89
|
|
|
@@ -48,8 +48,8 @@ const ComboboxList = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
48
48
|
...style
|
|
49
49
|
} : style,
|
|
50
50
|
id: listContainerId,
|
|
51
|
-
"aria-label": ariaLabelFromProps
|
|
52
|
-
"aria-labelledby": ariaLabelledbyFromProps
|
|
51
|
+
"aria-label": ariaLabelFromProps ?? ariaLabel,
|
|
52
|
+
"aria-labelledby": ariaLabelledbyFromProps ?? ariaLabelledby
|
|
53
53
|
}), children)
|
|
54
54
|
});
|
|
55
55
|
});
|
|
@@ -37,13 +37,11 @@ const ExpandCollapseButton = _ref => {
|
|
|
37
37
|
const hidePanelLabel = translate('configPane.hidePanel');
|
|
38
38
|
const [isTooltipVisible, setIsTooltipVisible] = useState(false);
|
|
39
39
|
const [isHiddenByEscape, setIsHiddenByEscape] = useState(false);
|
|
40
|
-
|
|
41
40
|
const handleKeyDown = event => {
|
|
42
41
|
if (event.key === 'Escape' && isOpen) {
|
|
43
42
|
setIsHiddenByEscape(true);
|
|
44
43
|
}
|
|
45
44
|
};
|
|
46
|
-
|
|
47
45
|
useEffect(() => {
|
|
48
46
|
setIsHiddenByEscape(false);
|
|
49
47
|
}, [isContainerHovered]);
|
|
@@ -76,7 +74,6 @@ const ExpandCollapseButton = _ref => {
|
|
|
76
74
|
"aria-hidden": "true"
|
|
77
75
|
}))));
|
|
78
76
|
};
|
|
79
|
-
|
|
80
77
|
const ConfigPane = _ref2 => {
|
|
81
78
|
let {
|
|
82
79
|
id,
|
|
@@ -106,9 +103,7 @@ const ConfigPane = _ref2 => {
|
|
|
106
103
|
} = useTranslation();
|
|
107
104
|
const pinPanelLabel = translate('configPane.pinPanel');
|
|
108
105
|
const unpinPanelLabel = translate('configPane.unpinPanel');
|
|
109
|
-
|
|
110
106
|
const toggleOpen = () => setIsOpen(currentIsOpen => !currentIsOpen);
|
|
111
|
-
|
|
112
107
|
const [isContainerHoveredRef, isContainerHovered] = useIsHovered();
|
|
113
108
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
114
109
|
className: classNames(styles.paneContainer, {
|
|
@@ -155,13 +150,11 @@ const ConfigPane = _ref2 => {
|
|
|
155
150
|
"data-testid": getSubDataTestId(dataTestId, DATA_TESTID_SUFFIXES.BODY)
|
|
156
151
|
}, children)))), !hideOpenButton &&
|
|
157
152
|
/*#__PURE__*/
|
|
158
|
-
|
|
159
153
|
/*
|
|
160
154
|
the following element is clickable but doesn't need an accessible role since it is
|
|
161
155
|
purely a visual convenience for opening the panel. Keyboard users can use the
|
|
162
156
|
expand/collapse button to achieve the same functionality
|
|
163
157
|
*/
|
|
164
|
-
|
|
165
158
|
/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
|
|
166
159
|
React__default.createElement("div", {
|
|
167
160
|
className: styles.clickableArea,
|
|
@@ -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 = {"paneContainer":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._cp-VM{grid-area:configPane;position:relative;height:100%}._BnDwN{overflow:hidden;height:100%;position:absolute;background-color:#fff;top:0;transition:width .5s;width:292px;border-right:1px solid #898989;box-sizing:border-box}._ajPA3._-N3W4 ._BnDwN,._ajPA3:not(._qJaqH) ._BnDwN{-webkit-clip-path:inset(0 -20px 0 0);clip-path:inset(0 -20px 0 0);box-shadow:0 8px 20px 0 rgba(0,0,0,.1),0 4px 6px 0 rgba(0,0,0,.05)}._qJaqH ._BnDwN{width:0}._-N3W4._qJaqH ._BnDwN{width:30px;cursor:pointer}._uiSP8 ._BnDwN{border-right-color:#eee}._B4uVO{height:100%;position:relative;width:292px}._ajPA3 ._B4uVO,._qJaqH ._B4uVO{width:0}._-N3W4._ajPA3 ._B4uVO,._-N3W4._qJaqH ._B4uVO{width:30px}._CSIJ5 ._B4uVO{transition:width .5s}._6wst0{position:absolute;width:292px;height:100%;right:0;overflow:auto;padding:12px 0}._qJaqH ._6wst0{visibility:hidden}._CSIJ5 ._6wst0{visibility:visible}._6wst0 ._E7hRf{width:252px;margin-left:20px}._uIc1S{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-bottom:12px}._5uPHq{flex-grow:1;padding-right:8px;line-height:20px;margin:8px 0}._5uPHq *{font-weight:400;font-size:16px;margin:0}._U19ti{position:absolute;transition:left .5s;top:0;left:290px;width:12px;cursor:pointer;height:100%}._qJaqH ._U19ti{left:0}._-N3W4._qJaqH ._U19ti{left:30px}._U19ti ._gZlgM{width:4px;height:100%}._-N3W4._qJaqH ._BnDwN:hover+._U19ti ._gZlgM,._U19ti:hover ._gZlgM{background-color:#9dc5ed}._-N3W4._qJaqH ._BnDwN:hover+._U19ti ._Ys-HM>span,._U19ti:hover ._Ys-HM>span{background-color:#0b6ed0;border-color:#0b6ed0}._-N3W4._qJaqH ._BnDwN:hover+._U19ti ._Ys-HM>span>svg,._U19ti:hover ._Ys-HM>span>svg{fill:#fff}._-N3W4._qJaqH ._BnDwN:hover+._U19ti ._Ys-HM:active>span,._U19ti:hover ._Ys-HM:active>span{background-color:#0854a1;border-color:#0854a1}._-N3W4._qJaqH ._BnDwN:hover+._U19ti ._Ys-HM:active>span>svg,._U19ti:hover ._Ys-HM:active>span>svg{fill:#fff}._U19ti ._Ys-HM{left:-16px;width:36px;height:36px;position:absolute;top:48px;display:flex;justify-content:center;align-items:center;padding:0;background-color:transparent;border:2px solid transparent;border-radius:6px;outline:none;cursor:pointer;z-index:10;opacity:0}._U19ti ._Ys-HM._v08CX._v08CX._v08CX{opacity:1}._U19ti ._Ys-HM._JQ-rV._JQ-rV._JQ-rV{opacity:0}._U19ti ._Ys-HM:active>span{background-color:#0854a1;border-color:#0854a1}._U19ti ._Ys-HM:active>span>svg{fill:#fff}._U19ti ._Ys-HM>span{width:24px;height:24px;display:flex;justify-content:center;align-items:center;background-color:#fff;border:1px solid #898989;border-radius:50%}._U19ti ._Ys-HM>span>svg{fill:#515559;border-radius:50%}._BnDwN:hover+._U19ti ._Ys-HM,._qJaqH ._U19ti ._Ys-HM,._U19ti:hover ._Ys-HM{opacity:1}body.keyboard-user ._Ys-HM:focus{opacity:1;border-color:#0a3f88}";
|
|
4
|
+
var styles = {"paneContainer":"_cp-VM","paneContentContainer":"_BnDwN","unpinned":"_ajPA3","hidden":"_qJaqH","preview":"_-N3W4","openHidden":"_uiSP8","spacer":"_B4uVO","transitioning":"_CSIJ5","paneContent":"_6wst0","paneContentInner":"_E7hRf","header":"_uIc1S","title":"_5uPHq","clickableArea":"_U19ti","hoverBorder":"_gZlgM","toolbarPanelExpandCollapseButton":"_Ys-HM","overrideShow":"_v08CX","overrideHide":"_JQ-rV"};
|
|
5
|
+
var stylesheet="._cp-VM{grid-area:configPane;position:relative;height:100%}._BnDwN{overflow:hidden;height:100%;position:absolute;background-color:#fff;top:0;transition:width .5s;width:292px;border-right:1px solid #898989;box-sizing:border-box}._ajPA3._-N3W4 ._BnDwN,._ajPA3:not(._qJaqH) ._BnDwN{-webkit-clip-path:inset(0 -20px 0 0);clip-path:inset(0 -20px 0 0);box-shadow:0 8px 20px 0 rgba(0,0,0,.1),0 4px 6px 0 rgba(0,0,0,.05)}._qJaqH ._BnDwN{width:0}._-N3W4._qJaqH ._BnDwN{width:30px;cursor:pointer}._uiSP8 ._BnDwN{border-right-color:#eee}._B4uVO{height:100%;position:relative;width:292px}._ajPA3 ._B4uVO,._qJaqH ._B4uVO{width:0}._-N3W4._ajPA3 ._B4uVO,._-N3W4._qJaqH ._B4uVO{width:30px}._CSIJ5 ._B4uVO{transition:width .5s}._6wst0{position:absolute;width:292px;height:100%;right:0;overflow:auto;padding:12px 0}._qJaqH ._6wst0{visibility:hidden}._CSIJ5 ._6wst0{visibility:visible}._6wst0 ._E7hRf{width:252px;margin-left:20px}._uIc1S{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-bottom:12px}._5uPHq{flex-grow:1;padding-right:8px;line-height:20px;margin:8px 0}._5uPHq *{font-weight:400;font-size:16px;margin:0}._U19ti{position:absolute;transition:left .5s;top:0;left:290px;width:12px;cursor:pointer;height:100%}._qJaqH ._U19ti{left:0}._-N3W4._qJaqH ._U19ti{left:30px}._U19ti ._gZlgM{width:4px;height:100%}._-N3W4._qJaqH ._BnDwN:hover+._U19ti ._gZlgM,._U19ti:hover ._gZlgM{background-color:#9dc5ed}._-N3W4._qJaqH ._BnDwN:hover+._U19ti ._Ys-HM>span,._U19ti:hover ._Ys-HM>span{background-color:#0b6ed0;border-color:#0b6ed0}._-N3W4._qJaqH ._BnDwN:hover+._U19ti ._Ys-HM>span>svg,._U19ti:hover ._Ys-HM>span>svg{fill:#fff}._-N3W4._qJaqH ._BnDwN:hover+._U19ti ._Ys-HM:active>span,._U19ti:hover ._Ys-HM:active>span{background-color:#0854a1;border-color:#0854a1}._-N3W4._qJaqH ._BnDwN:hover+._U19ti ._Ys-HM:active>span>svg,._U19ti:hover ._Ys-HM:active>span>svg{fill:#fff}._U19ti ._Ys-HM{left:-16px;width:36px;height:36px;position:absolute;top:48px;display:flex;justify-content:center;align-items:center;padding:0;background-color:transparent;border:2px solid transparent;border-radius:6px;outline:none;cursor:pointer;z-index:10;opacity:0}._U19ti ._Ys-HM._v08CX._v08CX._v08CX{opacity:1}._U19ti ._Ys-HM._JQ-rV._JQ-rV._JQ-rV{opacity:0}._U19ti ._Ys-HM:active>span{background-color:#0854a1;border-color:#0854a1}._U19ti ._Ys-HM:active>span>svg{fill:#fff}._U19ti ._Ys-HM>span{width:24px;height:24px;display:flex;justify-content:center;align-items:center;background-color:#fff;border:1px solid #898989;border-radius:50%}._U19ti ._Ys-HM>span>svg{fill:#515559;border-radius:50%}._BnDwN:hover+._U19ti ._Ys-HM,._qJaqH ._U19ti ._Ys-HM,._U19ti:hover ._Ys-HM{opacity:1}body.keyboard-user ._Ys-HM:focus{opacity:1;border-color:#0a3f88}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|