@qualtrics/ui-react 2.21.0 → 2.22.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 +18 -0
- package/dist/__shared/cjs/{index-0ae99de2.js → index-75d9309a.js} +4 -4
- package/dist/__shared/cjs/{index-201e8786.js → index-a8c1a789.js} +678 -568
- package/dist/components/Accordion/Accordion.js +2 -3
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Accordion/AccordionHeader.js +5 -4
- package/dist/components/Accordion/AccordionPanel.js +3 -3
- package/dist/components/Accordion/AccordionSection.js +1 -2
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Button/Button2.js +2 -2
- package/dist/components/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +11 -11
- package/dist/components/Checkbox/Checkbox2.js +3 -3
- package/dist/components/Checkbox/VisualCheckbox2.js +3 -3
- package/dist/components/ColorPicker/Alpha.js +12 -9
- package/dist/components/ColorPicker/ColorPicker.js +10 -8
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/ColorPicker/ColorPickerFlyoutInputs.js +8 -6
- package/dist/components/ColorPicker/Hue.js +3 -2
- package/dist/components/ColorPicker/Palette.js +7 -5
- package/dist/components/ColorPicker/Saturation.js +9 -8
- package/dist/components/ColorPicker/utils/hexToRgbaString.js +3 -2
- package/dist/components/ColorPicker/utils/rgbToHex.js +1 -1
- package/dist/components/ColorPicker/utils/validateHex.js +10 -9
- package/dist/components/Combobox/Combobox.js +48 -29
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/Combobox/ComboboxHeader.js +1 -1
- package/dist/components/Combobox/ComboboxIcon.js +3 -2
- package/dist/components/Combobox/ComboboxInput.js +4 -4
- package/dist/components/Combobox/ComboboxList.js +2 -2
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +5 -2
- package/dist/components/Dropdown/Dropdown.js +14 -9
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/Dropdown/DropdownButton.js +23 -19
- package/dist/components/Dropdown/DropdownList.js +4 -4
- package/dist/components/Dropdown/DropdownOption.js +6 -9
- package/dist/components/Dropdown/DropdownSearch.js +12 -6
- package/dist/components/FilePicker/FilePicker.js +13 -6
- package/dist/components/FilePicker/FilePicker2.js +3 -3
- package/dist/components/FormField/Caption.js +3 -3
- package/dist/components/FormField/FormField.js +2 -2
- package/dist/components/FormField/FormField2.js +3 -3
- package/dist/components/FormField/FormFieldContext.js +3 -3
- package/dist/components/FullScreenTakeover/FullScreenTakeover.js +5 -3
- package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
- package/dist/components/Icon/Icon.js +2 -2
- package/dist/components/IconButton/IconButton2.js +3 -3
- package/dist/components/InlineInput/InlineInput.js +12 -9
- package/dist/components/InlineInput/InlineInput2.js +3 -3
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/Input2.js +3 -3
- package/dist/components/Input/InputField.js +2 -2
- package/dist/components/InputGroup/InputGroup2.js +3 -3
- package/dist/components/Label/Label2.js +3 -3
- package/dist/components/Link/Link2.js +3 -3
- package/dist/components/LoadingSpinner/LoadingSpinner.js +1 -1
- package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
- package/dist/components/LogicEditor/ConditionSet.js +5 -5
- package/dist/components/LogicEditor/LogicEditor.js +1 -1
- package/dist/components/LogicEditor/LogicEditor2.js +3 -3
- package/dist/components/LogicEditor/utils.js +2 -1
- package/dist/components/Modal/Modal.js +14 -13
- package/dist/components/Modal/Modal2.js +3 -3
- package/dist/components/NewMenu/BaseMenu.js +44 -36
- package/dist/components/NewMenu/NewMenu.js +3 -3
- package/dist/components/NewMenu/SelectMenu/SelectMenu.js +2 -2
- package/dist/components/NewMenu/parts/ArrowNav/ArrowNav.js +10 -7
- package/dist/components/NewMenu/parts/MenuItem.js +1 -1
- package/dist/components/NumberStepper/NumberStepper.js +7 -6
- package/dist/components/NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/NumberStepper/NumberStepperDecrement.js +1 -1
- package/dist/components/NumberStepper/NumberStepperIncrement.js +1 -1
- package/dist/components/NumberStepper/NumberStepperInput.js +3 -3
- package/dist/components/PageLayout/PageLayout.js +3 -3
- package/dist/components/Pagination/Pagination.js +1 -1
- package/dist/components/Pagination/Pagination2.js +3 -3
- package/dist/components/Pagination/PaginationNextButton.js +5 -5
- package/dist/components/Pagination/PaginationPageInput.js +11 -9
- package/dist/components/Pagination/PaginationPreviousButton.js +5 -5
- package/dist/components/Popover/Popover.js +9 -7
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch.js +4 -3
- package/dist/components/QuickSearch/QuickSearch2.js +3 -3
- package/dist/components/QuickSearch/QuickSearchInput.js +4 -4
- package/dist/components/Radio/Radio.js +12 -11
- package/dist/components/Radio/Radio2.js +3 -3
- package/dist/components/SearchInput/SearchInput.js +4 -3
- package/dist/components/SearchInput/SearchInput2.js +3 -3
- package/dist/components/SidebarNav/SidebarNav.js +2 -1
- package/dist/components/SidebarNav/SidebarNav2.js +3 -3
- package/dist/components/SidebarNav/SidebarNavLink.js +1 -1
- package/dist/components/Slider/RangeSlider.js +2 -2
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Slider/Slider2.js +3 -3
- package/dist/components/Slider/SliderButton.js +1 -1
- package/dist/components/Switch/Switch.js +11 -11
- package/dist/components/Switch/Switch2.js +3 -3
- package/dist/components/Table/Table2.js +3 -3
- package/dist/components/Tabs/Tab.js +3 -3
- package/dist/components/Tabs/TabList.js +6 -5
- package/dist/components/Tabs/TabPanel.js +3 -3
- package/dist/components/Tabs/Tabs2.js +3 -3
- package/dist/components/Tooltip/Tooltip.js +10 -4
- package/dist/components/Tooltip/Tooltip2.js +3 -3
- package/dist/components/UIProvider/UIProvider.js +2 -2
- package/dist/components/deprecated_ColorPicker/Alpha.js +4 -4
- package/dist/components/deprecated_ColorPicker/Color.js +6 -6
- package/dist/components/deprecated_ColorPicker/ColorPicker.js +2 -2
- package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/deprecated_ColorPicker/HexInput.js +1 -1
- package/dist/components/deprecated_ColorPicker/Hue.js +3 -3
- package/dist/components/deprecated_ColorPicker/Saturation.js +5 -5
- package/dist/components/deprecated_ColorPicker/Swatch.js +2 -2
- package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/deprecated_NumberStepper/NumberStepperDecrement.js +2 -2
- package/dist/components/deprecated_NumberStepper/NumberStepperIncrement.js +2 -2
- package/dist/components/deprecated_NumberStepper/NumberStepperInput.js +8 -8
- package/dist/components/deprecated_Tabs/Tabs.js +11 -7
- package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
- package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
- package/dist/components/deprecated_Toolbar/ToolbarPanel.js +3 -3
- package/dist/components/deprecated_Toolbar/ToolbarPanels.js +4 -2
- package/dist/components/deprecated_Toolbar/ToolbarTab.js +8 -8
- package/dist/components/deprecated_Toolbar/ToolbarTabs.js +6 -3
- package/dist/hooks/useBreakpoints/useBreakpoints.js +1 -1
- package/dist/hooks/useClickOutside/useClickOutside.js +2 -1
- package/dist/hooks/useControllableState/useControllableState.js +2 -1
- package/dist/hooks/useEventListener/useEventListener.js +1 -1
- package/dist/hooks/useId/useId.js +1 -1
- package/dist/hooks/useOverlay/useOverlay.js +7 -6
- package/dist/hooks/useOverlay/useOverlay2.js +3 -3
- package/dist/hooks/useResponsiveValue/useResponsiveValue.js +2 -1
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement.js +4 -2
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
- package/dist/icons/Icon.js +3 -3
- package/dist/icons/createIconComponent.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +14 -7
- package/dist/index.es.js +1 -1
- package/dist/index.js +3 -4
- package/dist/next/AdvancedTable/AdvancedTable.js +62 -52
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTableCell.js +6 -4
- package/dist/next/AdvancedTable/AdvancedTableColumnHeader.js +18 -10
- package/dist/next/AdvancedTable/AdvancedTableColumnHeaderMenu.js +7 -6
- package/dist/next/AdvancedTable/AdvancedTableDragPreview.js +5 -4
- package/dist/next/AdvancedTable/AdvancedTablePagination.js +1 -1
- package/dist/next/AdvancedTable/AdvancedTableTypes.js +6 -6
- package/dist/next/AdvancedTable/useAdvancedTableDragAndDrop.js +3 -2
- package/dist/next/AdvancedTable/useComputedWidth.js +1 -1
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput.js +5 -3
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInputIconButton.js +1 -1
- package/dist/next/Combobox/Combobox2.js +3 -3
- package/dist/next/Combobox/ComboboxFlyout.js +2 -2
- package/dist/next/Combobox/ComboboxGroup.js +1 -1
- package/dist/next/Combobox/ComboboxInput.js +2 -2
- package/dist/next/Combobox/ComboboxOption.js +1 -1
- package/dist/next/Combobox/hooks/useComboboxFilteredGroup/useComboboxFilteredGroup.js +1 -1
- package/dist/next/Combobox/hooks/useComboboxFocusSequence/useComboboxFocusSequence.js +12 -8
- package/dist/next/Combobox/hooks/useComboboxValue/useComboboxValue.js +1 -1
- package/dist/next/Combobox/hooks/useListboxFlyoutDimensions/useListboxFlyoutDimensions.js +3 -2
- package/dist/next/Combobox/hooks/useSelectedOptionScroll/useSelectedOptionScroll.js +2 -1
- package/dist/next/Combobox/hooks/useShouldRenderGroupHeader/useShouldRenderGroupHeader.js +2 -1
- package/dist/next/Combobox/utils/nodeRegistration/nodeRegistration.js +1 -1
- package/dist/next/Drawer/Drawer.js +7 -4
- package/dist/next/Drawer/Drawer2.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
- package/dist/next/Input/Input.js +2 -2
- package/dist/next/Input/Input2.js +3 -3
- package/dist/next/Menu/Menu.js +5 -3
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuItem.js +8 -9
- package/dist/next/Menu/MenuPane.js +20 -8
- package/dist/next/Menu/SubMenu.js +16 -18
- package/dist/next/Menu/useMutationObserver.js +1 -1
- package/dist/next/Menu/usePaneSearch.js +31 -21
- package/dist/next/PhoneNumberInput/PhoneNumberInput.js +7 -6
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/SplitButton/SplitButton.js +8 -2
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/TimePicker/TimeDropdown.js +4 -4
- package/dist/next/TimePicker/TimeInput.js +2 -2
- package/dist/next/TimePicker/TimePicker.js +4 -4
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/TimePicker/TimePickerIcon.js +2 -1
- package/dist/next/TimePicker/utils.js +14 -27
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +317 -260
- package/dist/utils/Flyout/Flyout.js +1 -1
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/dist/utils/Popper/Popper.js +9 -5
- package/dist/utils/TextOverflowTooltip/TextOverflowTooltip.js +2 -1
- package/dist/utils/Translation/containsComponentOrElement.js +1 -3
- package/dist/utils/Translation/useTranslation.js +4 -5
- package/dist/utils/filterChildren/filterChildren.js +2 -1
- package/dist/utils/getSubDataTestId/getSubDataTestId.js +1 -1
- package/dist/utils/mediaQueryManager/mediaQueryManager.js +1 -1
- package/dist/utils/mergeRefs/mergeRefs.js +1 -1
- package/dist/utils/wrapEvent/wrapEvent.js +2 -2
- package/next/package.json +1 -1
- package/package.json +2 -2
|
@@ -9,6 +9,7 @@ import useTranslation from '../../utils/Translation/useTranslation.js';
|
|
|
9
9
|
import calculateTargetId from './utils/calculateTargetId.js';
|
|
10
10
|
|
|
11
11
|
const Swatch = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
12
|
+
var _color$name;
|
|
12
13
|
let {
|
|
13
14
|
color,
|
|
14
15
|
onColorSwatchClick,
|
|
@@ -28,14 +29,14 @@ const Swatch = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
28
29
|
type: "button",
|
|
29
30
|
className: styles.swatch,
|
|
30
31
|
style: {
|
|
31
|
-
backgroundColor:
|
|
32
|
+
backgroundColor: "".concat(color.hex)
|
|
32
33
|
},
|
|
33
34
|
onClick: handleClick,
|
|
34
35
|
tabIndex: cellIndex === focusedSwatchIndex ? 0 : -1,
|
|
35
|
-
"aria-label":
|
|
36
|
+
"aria-label": "".concat((_color$name = color.name) !== null && _color$name !== void 0 ? _color$name : '', " ").concat(color.hex),
|
|
36
37
|
"aria-describedby": ariaDescribedBy,
|
|
37
38
|
ref: ref,
|
|
38
|
-
"data-testid": getSubDataTestId(dataTestId,
|
|
39
|
+
"data-testid": getSubDataTestId(dataTestId, "".concat(color.hex.substring(1), "-swatch"))
|
|
39
40
|
}));
|
|
40
41
|
});
|
|
41
42
|
function Palette(_ref2) {
|
|
@@ -52,7 +53,7 @@ function Palette(_ref2) {
|
|
|
52
53
|
} = useTranslation();
|
|
53
54
|
const paletteAriaLabel = translate('palette');
|
|
54
55
|
const swatchAriaDesc = translate('selectColor');
|
|
55
|
-
const swatchDescriptionId =
|
|
56
|
+
const swatchDescriptionId = "".concat(containerId, "-swatch-desc");
|
|
56
57
|
const swatchRefs = useRef({});
|
|
57
58
|
|
|
58
59
|
// split palette into rows for grid aria role semantics
|
|
@@ -68,8 +69,9 @@ function Palette(_ref2) {
|
|
|
68
69
|
function updateFocusedSwatchIndex(e, direction) {
|
|
69
70
|
e.preventDefault(); // prevents scroll
|
|
70
71
|
setFocusedSwatchIndex(prevFocusedSwatchIndex => {
|
|
72
|
+
var _swatchRefs$current;
|
|
71
73
|
const targetId = calculateTargetId(prevFocusedSwatchIndex, palette.length, direction);
|
|
72
|
-
swatchRefs.current
|
|
74
|
+
(_swatchRefs$current = swatchRefs.current) === null || _swatchRefs$current === void 0 || (_swatchRefs$current = _swatchRefs$current[targetId]) === null || _swatchRefs$current === void 0 ? void 0 : _swatchRefs$current.focus();
|
|
73
75
|
return targetId;
|
|
74
76
|
});
|
|
75
77
|
}
|
|
@@ -22,7 +22,7 @@ function Saturation(_ref) {
|
|
|
22
22
|
} = _ref;
|
|
23
23
|
const gridRef = useRef(null);
|
|
24
24
|
const loopRef = useRef(null);
|
|
25
|
-
const saturationId =
|
|
25
|
+
const saturationId = "".concat(containerId, "-saturation");
|
|
26
26
|
const {
|
|
27
27
|
translate
|
|
28
28
|
} = useTranslation();
|
|
@@ -87,22 +87,23 @@ function Saturation(_ref) {
|
|
|
87
87
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
88
88
|
className: styles.saturationGrid,
|
|
89
89
|
style: {
|
|
90
|
-
backgroundColor:
|
|
90
|
+
backgroundColor: "".concat(hsvToHex({
|
|
91
91
|
h: hsv.h,
|
|
92
92
|
s: 1,
|
|
93
93
|
v: 1
|
|
94
|
-
})
|
|
94
|
+
}))
|
|
95
95
|
},
|
|
96
96
|
onMouseDown: e => {
|
|
97
|
+
var _loopRef$current;
|
|
97
98
|
// prevent text highlighting while dragging
|
|
98
99
|
e.preventDefault();
|
|
99
|
-
loopRef.current
|
|
100
|
+
(_loopRef$current = loopRef.current) === null || _loopRef$current === void 0 ? void 0 : _loopRef$current.focus();
|
|
100
101
|
handleMouseDown(e);
|
|
101
102
|
},
|
|
102
103
|
"data-testid": getSubDataTestId(dataTestId, 'saturation-grid'),
|
|
103
104
|
ref: gridRef
|
|
104
105
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
105
|
-
id:
|
|
106
|
+
id: "".concat(saturationId, "-saturation-desc"),
|
|
106
107
|
className: styles.hidden
|
|
107
108
|
}, saturationAriaDesc), /*#__PURE__*/React__default.createElement("div", {
|
|
108
109
|
"aria-live": loopRef.current === document.activeElement ? 'assertive' : 'off',
|
|
@@ -113,13 +114,13 @@ function Saturation(_ref) {
|
|
|
113
114
|
}, valueAriaLive), /*#__PURE__*/React__default.createElement("div", {
|
|
114
115
|
className: styles.saturationLoop,
|
|
115
116
|
style: {
|
|
116
|
-
left:
|
|
117
|
-
bottom:
|
|
117
|
+
left: "calc(".concat(hsv.s * 100, "% - ").concat(hsv.s * 12, "px)"),
|
|
118
|
+
bottom: "calc(".concat(hsv.v * 100, "% - ").concat(hsv.v * 12, "px)")
|
|
118
119
|
},
|
|
119
120
|
onKeyDown: handleKeyDown,
|
|
120
121
|
tabIndex: 0,
|
|
121
122
|
"aria-label": saturationAriaLabel,
|
|
122
|
-
"aria-describedby":
|
|
123
|
+
"aria-describedby": "".concat(saturationId, "-saturation-desc"),
|
|
123
124
|
ref: loopRef,
|
|
124
125
|
"data-testid": getSubDataTestId(dataTestId, 'saturation-thumb')
|
|
125
126
|
}));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import hexToRgb from './hexToRgb.js';
|
|
2
2
|
|
|
3
3
|
function hexToRgbaString(color) {
|
|
4
|
+
var _color$alpha;
|
|
4
5
|
const rgb = hexToRgb(color.hex);
|
|
5
|
-
const alpha = color.alpha
|
|
6
|
-
return
|
|
6
|
+
const alpha = (_color$alpha = color.alpha) !== null && _color$alpha !== void 0 ? _color$alpha : 100;
|
|
7
|
+
return "rgba(".concat(rgb.r, ", ").concat(rgb.g, ", ").concat(rgb.b, ", ").concat(alpha / 100, ")");
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export { hexToRgbaString as default };
|
|
@@ -7,7 +7,7 @@ function rgbToHex(_ref) {
|
|
|
7
7
|
const rStr = r.toString(16).padStart(2, '0');
|
|
8
8
|
const gStr = g.toString(16).padStart(2, '0');
|
|
9
9
|
const bStr = b.toString(16).padStart(2, '0');
|
|
10
|
-
return
|
|
10
|
+
return "#".concat(rStr).concat(gStr).concat(bStr);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export { rgbToHex as default };
|
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
function validateHex(currentColor, newHex, isAlphaEnabled) {
|
|
2
|
+
var _currentColor$alpha;
|
|
2
3
|
// set current alpha to hex format
|
|
3
|
-
const alpha = Math.round((currentColor.alpha
|
|
4
|
+
const alpha = Math.round(((_currentColor$alpha = currentColor.alpha) !== null && _currentColor$alpha !== void 0 ? _currentColor$alpha : 100) / 100 * 255).toString(16).toUpperCase().padStart(2, '0');
|
|
4
5
|
let newAlpha = isAlphaEnabled ? alpha : '';
|
|
5
6
|
let validatedHex;
|
|
6
7
|
const hexLength = isAlphaEnabled ? 8 : 6;
|
|
7
8
|
const hexRegex = /^[a-fA-F0-9]+$/;
|
|
8
9
|
|
|
9
10
|
// if newHex contains invalid characters or is empty string, revert to previous color
|
|
10
|
-
if (!hexRegex.test(newHex.slice(0, hexLength))) return
|
|
11
|
+
if (!hexRegex.test(newHex.slice(0, hexLength))) return "".concat(currentColor.hex.substring(1)).concat(newAlpha);
|
|
11
12
|
|
|
12
13
|
// match validation pattern based on string length
|
|
13
14
|
switch (newHex.length) {
|
|
14
15
|
case 1:
|
|
15
|
-
validatedHex =
|
|
16
|
+
validatedHex = "".concat(newHex.repeat(6)).concat(newAlpha);
|
|
16
17
|
break;
|
|
17
18
|
case 2:
|
|
18
|
-
validatedHex =
|
|
19
|
+
validatedHex = "".concat(newHex.repeat(3)).concat(newAlpha);
|
|
19
20
|
break;
|
|
20
21
|
case 3:
|
|
21
|
-
validatedHex =
|
|
22
|
+
validatedHex = "".concat(newHex[0].repeat(2)).concat(newHex[1].repeat(2)).concat(newHex[2].repeat(2)).concat(newAlpha);
|
|
22
23
|
break;
|
|
23
24
|
case 4:
|
|
24
25
|
case 5:
|
|
25
26
|
newAlpha = isAlphaEnabled ? newHex[3].repeat(2) : '';
|
|
26
|
-
validatedHex =
|
|
27
|
+
validatedHex = "".concat(newHex[0].repeat(2)).concat(newHex[1].repeat(2)).concat(newHex[2].repeat(2)).concat(newAlpha);
|
|
27
28
|
break;
|
|
28
29
|
case 6:
|
|
29
|
-
validatedHex =
|
|
30
|
+
validatedHex = "".concat(newHex).concat(newAlpha);
|
|
30
31
|
break;
|
|
31
32
|
case 7:
|
|
32
|
-
validatedHex =
|
|
33
|
+
validatedHex = "".concat(newHex.substring(0, 6)).concat(newAlpha);
|
|
33
34
|
break;
|
|
34
35
|
default:
|
|
35
36
|
newAlpha = isAlphaEnabled ? newHex.substring(6, 8) : '';
|
|
36
|
-
validatedHex =
|
|
37
|
+
validatedHex = "".concat(newHex.substring(0, 6)).concat(newAlpha);
|
|
37
38
|
break;
|
|
38
39
|
}
|
|
39
40
|
return validatedHex.toUpperCase();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
2
|
-
import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
|
|
3
2
|
import React__default, { forwardRef, useMemo, useRef, useState, useCallback, useEffect, cloneElement } from 'react';
|
|
4
3
|
import classNames from 'classnames';
|
|
5
4
|
import { useFocusVisible } from '@react-aria/interactions';
|
|
@@ -19,10 +18,15 @@ import useControllableState from '../../hooks/useControllableState/useControllab
|
|
|
19
18
|
import useClickOutside from '../../hooks/useClickOutside/useClickOutside.js';
|
|
20
19
|
import wrapEvent from '../../utils/wrapEvent/wrapEvent.js';
|
|
21
20
|
|
|
22
|
-
const getOptionLabel = option =>
|
|
23
|
-
|
|
21
|
+
const getOptionLabel = option => {
|
|
22
|
+
var _option$props;
|
|
23
|
+
return option === null || option === void 0 || (_option$props = option.props) === null || _option$props === void 0 ? void 0 : _option$props.label;
|
|
24
|
+
};
|
|
25
|
+
const getOptionValue = option => {
|
|
26
|
+
var _option$props2;
|
|
27
|
+
return option === null || option === void 0 || (_option$props2 = option.props) === null || _option$props2 === void 0 ? void 0 : _option$props2.value;
|
|
28
|
+
};
|
|
24
29
|
const doesOptionMatchFilter = (option, header, inputValue) => {
|
|
25
|
-
var _context, _context2;
|
|
26
30
|
const label = getOptionLabel(option);
|
|
27
31
|
|
|
28
32
|
// 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
|
|
@@ -31,7 +35,7 @@ const doesOptionMatchFilter = (option, header, inputValue) => {
|
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
// 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)
|
|
34
|
-
return typeof label === 'string' &&
|
|
38
|
+
return typeof label === 'string' && label.toLowerCase().includes(inputValue.toLowerCase()) || typeof header === 'string' && header.toLowerCase().includes(inputValue.toLowerCase());
|
|
35
39
|
};
|
|
36
40
|
const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
37
41
|
let {
|
|
@@ -69,20 +73,23 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
69
73
|
// Gets the <ComboboxInput> and <ComboboxList> components from the children
|
|
70
74
|
React__default.Children.forEach(children, child => {
|
|
71
75
|
if ( /*#__PURE__*/React__default.isValidElement(child)) {
|
|
72
|
-
if (child
|
|
76
|
+
if ((child === null || child === void 0 ? void 0 : child.type) === ComboboxInput) {
|
|
73
77
|
comboboxInput = child;
|
|
74
|
-
} else if (child
|
|
78
|
+
} else if ((child === null || child === void 0 ? void 0 : child.type) === ComboboxList) {
|
|
75
79
|
comboboxList = child;
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
});
|
|
79
83
|
const listContainerId = useId(comboboxList.props.id);
|
|
80
|
-
const noMatchesFoundContainerId =
|
|
84
|
+
const noMatchesFoundContainerId = "".concat(listContainerId, "-no-matches-found");
|
|
81
85
|
|
|
82
86
|
// Extracts all ComboboxOptions
|
|
83
|
-
const [, [allOptions]] = useMemo(() =>
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
const [, [allOptions]] = useMemo(() => {
|
|
88
|
+
var _comboboxList;
|
|
89
|
+
return filterChildren((_comboboxList = comboboxList) === null || _comboboxList === void 0 || (_comboboxList = _comboboxList.props) === null || _comboboxList === void 0 ? void 0 : _comboboxList.children, [{
|
|
90
|
+
matcher: child => (child === null || child === void 0 ? void 0 : child.type) === ComboboxOption
|
|
91
|
+
}]);
|
|
92
|
+
}, [comboboxList]);
|
|
86
93
|
const {
|
|
87
94
|
defaultValue: defaultInputValue,
|
|
88
95
|
onChange: onInputChange,
|
|
@@ -105,7 +112,7 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
105
112
|
const [selectedOptionLabel, setSelectedOptionLabel] = useState(() => getLabelForValue(selectedOptionValue) || externalInputValue || defaultInputValue || '');
|
|
106
113
|
const [inputValue, setInputValue] = useControllableState(selectedOptionLabel,
|
|
107
114
|
// `e &&` prevents `ComboboxInput` from calling consumer-passed `onChange` for consumer-controlled `Combobox` value updates.
|
|
108
|
-
(_, e) => e && onInputChange
|
|
115
|
+
(_, e) => e && (onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(e)), externalInputValue);
|
|
109
116
|
|
|
110
117
|
// listen for updates from controlled value
|
|
111
118
|
useEffect(() => {
|
|
@@ -133,6 +140,7 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
133
140
|
|
|
134
141
|
// Gets the filtered options based on the current input value (only if isFilteringDisabled is false)
|
|
135
142
|
const [listChildrenFilteredOptions, [, filteredOptions]] = useMemo(() => {
|
|
143
|
+
var _comboboxList2;
|
|
136
144
|
let currentHeaderTitle;
|
|
137
145
|
const handleSelect = option => {
|
|
138
146
|
const newOptionValue = getOptionValue(option);
|
|
@@ -144,15 +152,16 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
144
152
|
}
|
|
145
153
|
});
|
|
146
154
|
};
|
|
147
|
-
return filterChildren(comboboxList
|
|
155
|
+
return filterChildren((_comboboxList2 = comboboxList) === null || _comboboxList2 === void 0 || (_comboboxList2 = _comboboxList2.props) === null || _comboboxList2 === void 0 ? void 0 : _comboboxList2.children, [
|
|
148
156
|
/*
|
|
149
157
|
* For each header, adds a key value pair to the headerCounts object where the key is the header title and the value is 0.
|
|
150
158
|
* The value will be updated in the matcher/modifier below this matcher/modifier.
|
|
151
159
|
*/
|
|
152
160
|
{
|
|
153
|
-
matcher: child => child
|
|
161
|
+
matcher: child => (child === null || child === void 0 ? void 0 : child.type) === ComboboxHeader,
|
|
154
162
|
modifier: child => {
|
|
155
|
-
|
|
163
|
+
var _props;
|
|
164
|
+
currentHeaderTitle = (_props = child.props) === null || _props === void 0 ? void 0 : _props.title;
|
|
156
165
|
headerCounts[currentHeaderTitle] = 0;
|
|
157
166
|
return child;
|
|
158
167
|
}
|
|
@@ -162,16 +171,18 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
162
171
|
* Otherwise, returns null.
|
|
163
172
|
*/
|
|
164
173
|
{
|
|
165
|
-
matcher: child => child
|
|
174
|
+
matcher: child => (child === null || child === void 0 ? void 0 : child.type) === ComboboxOption,
|
|
166
175
|
modifier: (child, index) => {
|
|
167
176
|
if (inputValue === selectedOptionLabel || isFilteringDisabled || doesOptionMatchFilter(child, currentHeaderTitle, inputValue)) {
|
|
177
|
+
var _props$id;
|
|
168
178
|
headerCounts[currentHeaderTitle] += 1;
|
|
169
179
|
return /*#__PURE__*/cloneElement(child, {
|
|
170
180
|
onSelect: e => {
|
|
171
|
-
|
|
181
|
+
var _props2, _props2$onSelect;
|
|
182
|
+
child === null || child === void 0 || (_props2 = child.props) === null || _props2 === void 0 || (_props2$onSelect = _props2.onSelect) === null || _props2$onSelect === void 0 ? void 0 : _props2$onSelect.call(_props2, e);
|
|
172
183
|
|
|
173
184
|
// Prevents form submission
|
|
174
|
-
if (e
|
|
185
|
+
if ((e === null || e === void 0 ? void 0 : e.key) === 'Enter') {
|
|
175
186
|
e.preventDefault();
|
|
176
187
|
}
|
|
177
188
|
if (!e.key) {
|
|
@@ -192,7 +203,7 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
192
203
|
isHighlightedOnHover: isOptionSelectedOnKeyboardHighlight,
|
|
193
204
|
isHighlighted: isOptionSelectedOnKeyboardHighlight ? false : index === highlightedIndex,
|
|
194
205
|
isSelected: isOptionSelectedOnKeyboardHighlight ? index === selectedIndex : selectedOptionValue === getOptionValue(child),
|
|
195
|
-
id: child.props.id
|
|
206
|
+
id: (_props$id = child.props.id) !== null && _props$id !== void 0 ? _props$id : "".concat(listContainerId, "-option-").concat(index),
|
|
196
207
|
ref: node => {
|
|
197
208
|
optionRefs.current[Number(index)] = node;
|
|
198
209
|
}
|
|
@@ -206,15 +217,19 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
206
217
|
|
|
207
218
|
// Gets all filtered options, as well as headers that have at least one filtered option
|
|
208
219
|
const [listChildrenFilteredOptionsAndHeaders] = useMemo(() => filterChildren(listChildrenFilteredOptions, [{
|
|
209
|
-
matcher: child => child
|
|
220
|
+
matcher: child => (child === null || child === void 0 ? void 0 : child.type) === ComboboxOption
|
|
210
221
|
}, {
|
|
211
|
-
matcher: child => child
|
|
212
|
-
modifier: child =>
|
|
222
|
+
matcher: child => (child === null || child === void 0 ? void 0 : child.type) === ComboboxHeader,
|
|
223
|
+
modifier: child => {
|
|
224
|
+
var _props3;
|
|
225
|
+
return headerCounts[(_props3 = child.props) === null || _props3 === void 0 ? void 0 : _props3.title] ? child : null;
|
|
226
|
+
}
|
|
213
227
|
}]), [headerCounts, listChildrenFilteredOptions]);
|
|
214
228
|
const keyboardHighlightOrSelectOption = (index, e) => {
|
|
215
229
|
if (isOptionSelectedOnKeyboardHighlight) {
|
|
230
|
+
var _filteredOptions$inde, _filteredOptions$inde2;
|
|
216
231
|
setSelectedIndex(index);
|
|
217
|
-
filteredOptions[index]
|
|
232
|
+
(_filteredOptions$inde = filteredOptions[index]) === null || _filteredOptions$inde === void 0 || (_filteredOptions$inde = _filteredOptions$inde.props) === null || _filteredOptions$inde === void 0 || (_filteredOptions$inde2 = _filteredOptions$inde.onSelect) === null || _filteredOptions$inde2 === void 0 ? void 0 : _filteredOptions$inde2.call(_filteredOptions$inde, e);
|
|
218
233
|
} else {
|
|
219
234
|
setHighlightedIndex(index);
|
|
220
235
|
}
|
|
@@ -272,7 +287,8 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
272
287
|
case 'Enter':
|
|
273
288
|
if (isFlyoutOpen) {
|
|
274
289
|
if (!isOptionSelectedOnKeyboardHighlight && filteredOptions.length > 0 && filteredOptions[highlightedIndex] !== undefined) {
|
|
275
|
-
|
|
290
|
+
var _filteredOptions$high, _filteredOptions$high2;
|
|
291
|
+
(_filteredOptions$high = filteredOptions[highlightedIndex]) === null || _filteredOptions$high === void 0 || (_filteredOptions$high = _filteredOptions$high.props) === null || _filteredOptions$high === void 0 || (_filteredOptions$high2 = _filteredOptions$high.onSelect) === null || _filteredOptions$high2 === void 0 ? void 0 : _filteredOptions$high2.call(_filteredOptions$high, e);
|
|
276
292
|
}
|
|
277
293
|
}
|
|
278
294
|
setIsFlyoutOpen(false);
|
|
@@ -333,11 +349,12 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
333
349
|
useEffect(() => {
|
|
334
350
|
const currentIndex = isOptionSelectedOnKeyboardHighlight ? selectedIndex : highlightedIndex;
|
|
335
351
|
const optionRef = optionRefs.current[currentIndex];
|
|
336
|
-
if (isFocusVisible && isFlyoutOpen && optionRef && listRef
|
|
352
|
+
if (isFocusVisible && isFlyoutOpen && optionRef && listRef !== null && listRef !== void 0 && listRef.current) {
|
|
353
|
+
var _listRef$current, _listRef$current2;
|
|
337
354
|
if (currentIndex === 0) {
|
|
338
355
|
// Scrolls the first header into view if one exists
|
|
339
356
|
listRef.current.scrollTop = 0;
|
|
340
|
-
} else if (listRef.current
|
|
357
|
+
} else if (((_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.scrollHeight) > ((_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.clientHeight)) {
|
|
341
358
|
const scrollBottom = listRef.current.clientHeight + listRef.current.scrollTop;
|
|
342
359
|
const elementBottom = optionRef.offsetTop + optionRef.offsetHeight;
|
|
343
360
|
if (elementBottom > scrollBottom) {
|
|
@@ -377,16 +394,18 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
377
394
|
const activeDescendantId = useMemo(() => {
|
|
378
395
|
if (isAriaExpanded) {
|
|
379
396
|
if (unstable_isLoading) {
|
|
380
|
-
return
|
|
397
|
+
return "".concat(listContainerId, "-loading-spinner");
|
|
381
398
|
}
|
|
382
399
|
if (filteredOptions.length === 0) {
|
|
383
400
|
return undefined;
|
|
384
401
|
}
|
|
385
402
|
if (selectedIndex !== -1) {
|
|
386
|
-
|
|
403
|
+
var _filteredOptions$sele;
|
|
404
|
+
return (_filteredOptions$sele = filteredOptions[selectedIndex]) === null || _filteredOptions$sele === void 0 ? void 0 : _filteredOptions$sele.props.id;
|
|
387
405
|
}
|
|
388
406
|
if (highlightedIndex !== -1) {
|
|
389
|
-
|
|
407
|
+
var _filteredOptions$high3;
|
|
408
|
+
return (_filteredOptions$high3 = filteredOptions[highlightedIndex]) === null || _filteredOptions$high3 === void 0 ? void 0 : _filteredOptions$high3.props.id;
|
|
390
409
|
}
|
|
391
410
|
}
|
|
392
411
|
return undefined;
|
|
@@ -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 = "._bZwvn{position:relative;display:inline-block}._k929v{padding-right:36px}._k929v._gsTix{box-shadow:none!important;border:1px solid #898989!important}._mUgkG{margin-top:4px}._gK0pz{position:absolute;right:4px;bottom:4px;height:28px;width:28px;border-radius:4px;fill:#515559;cursor:pointer}._gK0pz:hover{background-color:rgba(50,54,58,.08)}._gK0pz:active{background-color:rgba(50,54,58,.11)}._gK0pz._RbR6m{transform:rotate(-180deg)}._gK0pz._2vyAm{opacity:.4}._asLvc{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}._2vyAm{cursor:not-allowed}._2vyAm:hover{background-color:transparent}";
|
|
4
|
+
var styles = {"combobox":"_bZwvn","comboboxInput":"_k929v","ignoreFocusStyle":"_gsTix","labelledInput":"_mUgkG","comboboxIcon":"_gK0pz","open":"_RbR6m","disabled":"_2vyAm","comboboxEmpty":"_asLvc"};
|
|
5
|
+
var stylesheet="._bZwvn{position:relative;display:inline-block}._k929v{padding-right:36px}._k929v._gsTix{box-shadow:none!important;border:1px solid #898989!important}._mUgkG{margin-top:4px}._gK0pz{position:absolute;right:4px;bottom:4px;height:28px;width:28px;border-radius:4px;fill:#515559;cursor:pointer}._gK0pz:hover{background-color:rgba(50,54,58,.08)}._gK0pz:active{background-color:rgba(50,54,58,.11)}._gK0pz._RbR6m{transform:rotate(-180deg)}._gK0pz._2vyAm{opacity:.4}._asLvc{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}._2vyAm{cursor:not-allowed}._2vyAm: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 === null || e === void 0 ? void 0 : e.preventDefault()),
|
|
17
17
|
ref: ref
|
|
18
18
|
}), children);
|
|
19
19
|
});
|
|
@@ -34,10 +34,11 @@ const ComboboxIcon = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
34
34
|
if (inputRef.current === document.activeElement) {
|
|
35
35
|
setIsOpen(!isOpen);
|
|
36
36
|
} else {
|
|
37
|
-
|
|
37
|
+
var _inputRef$current;
|
|
38
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
38
39
|
}
|
|
39
40
|
}) : undefined,
|
|
40
|
-
onMouseDown: wrapEvent(onMouseDown, e => e
|
|
41
|
+
onMouseDown: wrapEvent(onMouseDown, e => e === null || e === void 0 ? void 0 : e.preventDefault()),
|
|
41
42
|
ref: mergeRefs(ref, iconRef),
|
|
42
43
|
"aria-hidden": "true"
|
|
43
44
|
}));
|
|
@@ -69,21 +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 === null || onMouseDown === void 0 ? void 0 : onMouseDown(e),
|
|
73
73
|
onClick: e => {
|
|
74
74
|
if (!isOptionSelectedOnKeyboardHighlight && numberOfOptions > 0) {
|
|
75
75
|
setHighlightedIndex(0);
|
|
76
76
|
}
|
|
77
77
|
setIsOpen(true);
|
|
78
|
-
onClick
|
|
78
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
79
79
|
},
|
|
80
80
|
role: "combobox",
|
|
81
81
|
"aria-autocomplete": isFilteringDisabled ? 'none' : 'list',
|
|
82
82
|
"aria-expanded": isAriaExpanded,
|
|
83
83
|
"aria-controls": isAriaExpanded ? listContainerId : undefined,
|
|
84
84
|
"aria-activedescendant": activeDescendantId,
|
|
85
|
-
"aria-label": ariaLabelFromProps
|
|
86
|
-
"aria-labelledby": ariaLabelledbyFromProps
|
|
85
|
+
"aria-label": ariaLabelFromProps !== null && ariaLabelFromProps !== void 0 ? ariaLabelFromProps : ariaLabel,
|
|
86
|
+
"aria-labelledby": ariaLabelledbyFromProps !== null && ariaLabelledbyFromProps !== void 0 ? ariaLabelledbyFromProps : ariaLabelledby
|
|
87
87
|
}));
|
|
88
88
|
});
|
|
89
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 !== null && ariaLabelFromProps !== void 0 ? ariaLabelFromProps : ariaLabel,
|
|
52
|
+
"aria-labelledby": ariaLabelledbyFromProps !== null && ariaLabelledbyFromProps !== void 0 ? ariaLabelledbyFromProps : ariaLabelledby
|
|
53
53
|
}), children)
|
|
54
54
|
});
|
|
55
55
|
});
|
|
@@ -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 = "._MGeCe{grid-area:configPane;position:relative;height:100%}._0Vjhf{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}._zTeq7._lNdSi ._0Vjhf,._zTeq7:not(._Ff6Pj) ._0Vjhf{-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)}._Ff6Pj ._0Vjhf{width:0}._lNdSi._Ff6Pj ._0Vjhf{width:30px;cursor:pointer}._5DHlo ._0Vjhf{border-right-color:#eee}._332zD{height:100%;position:relative;width:292px}._Ff6Pj ._332zD,._zTeq7 ._332zD{width:0}._lNdSi._Ff6Pj ._332zD,._lNdSi._zTeq7 ._332zD{width:30px}._yd1-W ._332zD{transition:width .5s}._y5FDR{position:absolute;width:292px;height:100%;right:0;overflow:auto;padding:12px 0}._Ff6Pj ._y5FDR{visibility:hidden}._yd1-W ._y5FDR{visibility:visible}._y5FDR ._oKgCZ{width:252px;margin-left:20px}._Xs90L{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-bottom:12px}._RqQ33{flex-grow:1;padding-right:8px;line-height:20px;margin:8px 0}._RqQ33 *{font-weight:400;font-size:16px;margin:0}._Zi0i9{position:absolute;transition:left .5s;top:0;left:290px;width:12px;cursor:pointer;height:100%}._Ff6Pj ._Zi0i9{left:0}._lNdSi._Ff6Pj ._Zi0i9{left:30px}._Zi0i9 ._WCnLT{width:4px;height:100%}._lNdSi._Ff6Pj ._0Vjhf:hover+._Zi0i9 ._WCnLT,._Zi0i9:hover ._WCnLT{background-color:#9dc5ed}._lNdSi._Ff6Pj ._0Vjhf:hover+._Zi0i9 ._szc-P>span,._Zi0i9:hover ._szc-P>span{background-color:#0b6ed0;border-color:#0b6ed0}._lNdSi._Ff6Pj ._0Vjhf:hover+._Zi0i9 ._szc-P>span>svg,._Zi0i9:hover ._szc-P>span>svg{fill:#fff}._lNdSi._Ff6Pj ._0Vjhf:hover+._Zi0i9 ._szc-P:active>span,._Zi0i9:hover ._szc-P:active>span{background-color:#0854a1;border-color:#0854a1}._lNdSi._Ff6Pj ._0Vjhf:hover+._Zi0i9 ._szc-P:active>span>svg,._Zi0i9:hover ._szc-P:active>span>svg{fill:#fff}._Zi0i9 ._szc-P{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}._Zi0i9 ._szc-P._dQnqp._dQnqp._dQnqp{opacity:1}._Zi0i9 ._szc-P._E-H1p._E-H1p._E-H1p{opacity:0}._Zi0i9 ._szc-P:active>span{background-color:#0854a1;border-color:#0854a1}._Zi0i9 ._szc-P:active>span>svg{fill:#fff}._Zi0i9 ._szc-P>span{width:24px;height:24px;display:flex;justify-content:center;align-items:center;background-color:#fff;border:1px solid #898989;border-radius:50%}._Zi0i9 ._szc-P>span>svg{fill:#515559;border-radius:50%}._0Vjhf:hover+._Zi0i9 ._szc-P,._Ff6Pj ._Zi0i9 ._szc-P,._Zi0i9:hover ._szc-P{opacity:1}._szc-P.focus-visible,._szc-P:focus-visible{opacity:1;border-color:#0a3f88}";
|
|
4
|
+
var styles = {"paneContainer":"_MGeCe","paneContentContainer":"_0Vjhf","unpinned":"_zTeq7","hidden":"_Ff6Pj","preview":"_lNdSi","openHidden":"_5DHlo","spacer":"_332zD","transitioning":"_yd1-W","paneContent":"_y5FDR","paneContentInner":"_oKgCZ","header":"_Xs90L","title":"_RqQ33","clickableArea":"_Zi0i9","hoverBorder":"_WCnLT","toolbarPanelExpandCollapseButton":"_szc-P","overrideShow":"_dQnqp","overrideHide":"_E-H1p"};
|
|
5
|
+
var stylesheet="._MGeCe{grid-area:configPane;position:relative;height:100%}._0Vjhf{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}._zTeq7._lNdSi ._0Vjhf,._zTeq7:not(._Ff6Pj) ._0Vjhf{-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)}._Ff6Pj ._0Vjhf{width:0}._lNdSi._Ff6Pj ._0Vjhf{width:30px;cursor:pointer}._5DHlo ._0Vjhf{border-right-color:#eee}._332zD{height:100%;position:relative;width:292px}._Ff6Pj ._332zD,._zTeq7 ._332zD{width:0}._lNdSi._Ff6Pj ._332zD,._lNdSi._zTeq7 ._332zD{width:30px}._yd1-W ._332zD{transition:width .5s}._y5FDR{position:absolute;width:292px;height:100%;right:0;overflow:auto;padding:12px 0}._Ff6Pj ._y5FDR{visibility:hidden}._yd1-W ._y5FDR{visibility:visible}._y5FDR ._oKgCZ{width:252px;margin-left:20px}._Xs90L{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-bottom:12px}._RqQ33{flex-grow:1;padding-right:8px;line-height:20px;margin:8px 0}._RqQ33 *{font-weight:400;font-size:16px;margin:0}._Zi0i9{position:absolute;transition:left .5s;top:0;left:290px;width:12px;cursor:pointer;height:100%}._Ff6Pj ._Zi0i9{left:0}._lNdSi._Ff6Pj ._Zi0i9{left:30px}._Zi0i9 ._WCnLT{width:4px;height:100%}._lNdSi._Ff6Pj ._0Vjhf:hover+._Zi0i9 ._WCnLT,._Zi0i9:hover ._WCnLT{background-color:#9dc5ed}._lNdSi._Ff6Pj ._0Vjhf:hover+._Zi0i9 ._szc-P>span,._Zi0i9:hover ._szc-P>span{background-color:#0b6ed0;border-color:#0b6ed0}._lNdSi._Ff6Pj ._0Vjhf:hover+._Zi0i9 ._szc-P>span>svg,._Zi0i9:hover ._szc-P>span>svg{fill:#fff}._lNdSi._Ff6Pj ._0Vjhf:hover+._Zi0i9 ._szc-P:active>span,._Zi0i9:hover ._szc-P:active>span{background-color:#0854a1;border-color:#0854a1}._lNdSi._Ff6Pj ._0Vjhf:hover+._Zi0i9 ._szc-P:active>span>svg,._Zi0i9:hover ._szc-P:active>span>svg{fill:#fff}._Zi0i9 ._szc-P{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}._Zi0i9 ._szc-P._dQnqp._dQnqp._dQnqp{opacity:1}._Zi0i9 ._szc-P._E-H1p._E-H1p._E-H1p{opacity:0}._Zi0i9 ._szc-P:active>span{background-color:#0854a1;border-color:#0854a1}._Zi0i9 ._szc-P:active>span>svg{fill:#fff}._Zi0i9 ._szc-P>span{width:24px;height:24px;display:flex;justify-content:center;align-items:center;background-color:#fff;border:1px solid #898989;border-radius:50%}._Zi0i9 ._szc-P>span>svg{fill:#515559;border-radius:50%}._0Vjhf:hover+._Zi0i9 ._szc-P,._Ff6Pj ._Zi0i9 ._szc-P,._Zi0i9:hover ._szc-P{opacity:1}._szc-P.focus-visible,._szc-P:focus-visible{opacity:1;border-color:#0a3f88}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -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 = {"divider":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._BS07a{border:none;height:1px;margin:0;flex-shrink:0;background-color:#e5e5e5}";
|
|
4
|
+
var styles = {"divider":"_BS07a"};
|
|
5
|
+
var stylesheet="._BS07a{border:none;height:1px;margin:0;flex-shrink:0;background-color:#e5e5e5}";
|
|
6
6
|
styleInject(css_248z);
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -40,14 +40,17 @@ function useDescendant(descendant, context, indexProp) {
|
|
|
40
40
|
// index on the following render and we will re-register descendants
|
|
41
41
|
// so that everything is up-to-date before the user interacts with a
|
|
42
42
|
// collection.
|
|
43
|
-
const index = indexProp
|
|
43
|
+
const index = indexProp !== null && indexProp !== void 0 ? indexProp : descendants.findIndex(item => item.element === descendant.element);
|
|
44
44
|
const previousDescendants = usePrevious(descendants);
|
|
45
45
|
|
|
46
46
|
// We also need to re-register descendants any time ANY of the other
|
|
47
47
|
// descendants have changed. My brain was melting when I wrote this and it
|
|
48
48
|
// feels a little off, but checking in render and using the result in the
|
|
49
49
|
// effect's dependency array works well enough.
|
|
50
|
-
const someDescendantsHaveChanged = descendants.some((descendant, index) =>
|
|
50
|
+
const someDescendantsHaveChanged = descendants.some((descendant, index) => {
|
|
51
|
+
var _previousDescendants$;
|
|
52
|
+
return descendant.element !== (previousDescendants === null || previousDescendants === void 0 || (_previousDescendants$ = previousDescendants[index]) === null || _previousDescendants$ === void 0 ? void 0 : _previousDescendants$.element);
|
|
53
|
+
});
|
|
51
54
|
|
|
52
55
|
// Prevent any flashing
|
|
53
56
|
useSSRLayoutEffect(() => {
|
|
@@ -13,6 +13,7 @@ import { useDidUpdate } from '../../hooks/useDidUpdate/useDidUpdate.js';
|
|
|
13
13
|
import useClickOutside from '../../hooks/useClickOutside/useClickOutside.js';
|
|
14
14
|
|
|
15
15
|
const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
16
|
+
var _ref2, _dropdownButton$props, _dropdownButton$props2, _dropdownList$props$i, _dropdownList$props;
|
|
16
17
|
let {
|
|
17
18
|
className,
|
|
18
19
|
children,
|
|
@@ -47,7 +48,7 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
47
48
|
const [searchHeight, setSearchHeight] = useState();
|
|
48
49
|
React__default.Children.forEach(children, child => {
|
|
49
50
|
if ( /*#__PURE__*/React__default.isValidElement(child)) {
|
|
50
|
-
switch (child
|
|
51
|
+
switch (child === null || child === void 0 ? void 0 : child.type) {
|
|
51
52
|
case DropdownButton:
|
|
52
53
|
dropdownButton = child;
|
|
53
54
|
break;
|
|
@@ -60,9 +61,9 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
63
|
const containerId = useId(id);
|
|
63
|
-
const buttonId = dropdownButton.props.children
|
|
64
|
-
const dialogId = dropdownList.props
|
|
65
|
-
const listboxId =
|
|
64
|
+
const buttonId = (_ref2 = (_dropdownButton$props = (_dropdownButton$props2 = dropdownButton.props.children) === null || _dropdownButton$props2 === void 0 || (_dropdownButton$props2 = _dropdownButton$props2.props) === null || _dropdownButton$props2 === void 0 ? void 0 : _dropdownButton$props2.id) !== null && _dropdownButton$props !== void 0 ? _dropdownButton$props : dropdownButton.props.id) !== null && _ref2 !== void 0 ? _ref2 : "".concat(containerId, "-button");
|
|
65
|
+
const dialogId = (_dropdownList$props$i = (_dropdownList$props = dropdownList.props) === null || _dropdownList$props === void 0 ? void 0 : _dropdownList$props.id) !== null && _dropdownList$props$i !== void 0 ? _dropdownList$props$i : "".concat(containerId, "-list");
|
|
66
|
+
const listboxId = "".concat(containerId, "-listbox");
|
|
66
67
|
const [isOpen, setIsOpen] = useControllableState(false, onIsOpenChange, externalIsOpen);
|
|
67
68
|
const [value, setValue] = useControllableState(defaultValue, onChange, externalValue);
|
|
68
69
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
@@ -84,8 +85,9 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
84
85
|
let currentIndex = (highlightedIndex + 1) % options.length; // start at next index
|
|
85
86
|
let count = 0;
|
|
86
87
|
while (count < options.length) {
|
|
88
|
+
var _option$label;
|
|
87
89
|
const option = options[currentIndex];
|
|
88
|
-
if (option.label
|
|
90
|
+
if ((_option$label = option.label) !== null && _option$label !== void 0 && _option$label.toLowerCase().startsWith(lowerCaseChar)) {
|
|
89
91
|
index = currentIndex;
|
|
90
92
|
break;
|
|
91
93
|
}
|
|
@@ -98,8 +100,9 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
98
100
|
}
|
|
99
101
|
};
|
|
100
102
|
const selectHighlightedItem = e => {
|
|
103
|
+
var _option$handleSelect;
|
|
101
104
|
const option = options[highlightedIndex];
|
|
102
|
-
option
|
|
105
|
+
option === null || option === void 0 || (_option$handleSelect = option.handleSelect) === null || _option$handleSelect === void 0 ? void 0 : _option$handleSelect.call(option, e);
|
|
103
106
|
};
|
|
104
107
|
useClickOutside([buttonRef, listRef], handleClose);
|
|
105
108
|
useEffect(() => {
|
|
@@ -119,9 +122,10 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
119
122
|
return valueArray;
|
|
120
123
|
});
|
|
121
124
|
} else {
|
|
125
|
+
var _buttonRef$current;
|
|
122
126
|
setValue(newValue);
|
|
123
127
|
handleClose();
|
|
124
|
-
buttonRef.current
|
|
128
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.focus();
|
|
125
129
|
}
|
|
126
130
|
}, [isMultiSelect, handleClose, setValue]);
|
|
127
131
|
const onKeyDownButton = e => {
|
|
@@ -160,6 +164,7 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
160
164
|
}
|
|
161
165
|
};
|
|
162
166
|
const onKeyDownList = e => {
|
|
167
|
+
var _buttonRef$current2, _buttonRef$current3;
|
|
163
168
|
let newHighlightedIndex;
|
|
164
169
|
if (disabled) return;
|
|
165
170
|
switch (e.key) {
|
|
@@ -200,12 +205,12 @@ const Dropdown = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
200
205
|
// close, focus button, and don't let event bubble up
|
|
201
206
|
e.stopPropagation();
|
|
202
207
|
handleClose();
|
|
203
|
-
buttonRef.current
|
|
208
|
+
(_buttonRef$current2 = buttonRef.current) === null || _buttonRef$current2 === void 0 ? void 0 : _buttonRef$current2.focus();
|
|
204
209
|
break;
|
|
205
210
|
case 'Tab':
|
|
206
211
|
// close and focus next focusable element
|
|
207
212
|
handleClose();
|
|
208
|
-
buttonRef.current
|
|
213
|
+
(_buttonRef$current3 = buttonRef.current) === null || _buttonRef$current3 === void 0 ? void 0 : _buttonRef$current3.focus();
|
|
209
214
|
break;
|
|
210
215
|
case 'PageUp':
|
|
211
216
|
case 'Home':
|