@qualtrics/ui-react 2.21.0 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/__shared/cjs/{index-201e8786.js → index-025620bf.js} +666 -549
- package/dist/__shared/cjs/{index-0ae99de2.js → index-41a013d2.js} +4 -4
- package/dist/components/Accordion/Accordion.js +1 -1
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Accordion/AccordionHeader.js +4 -4
- package/dist/components/Accordion/AccordionPanel.js +3 -3
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Button/Button2.js +2 -2
- package/dist/components/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +11 -11
- package/dist/components/Checkbox/Checkbox2.js +3 -3
- package/dist/components/Checkbox/VisualCheckbox2.js +3 -3
- package/dist/components/ColorPicker/Alpha.js +12 -9
- package/dist/components/ColorPicker/ColorPicker.js +10 -8
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/ColorPicker/ColorPickerFlyoutInputs.js +8 -6
- package/dist/components/ColorPicker/Hue.js +3 -2
- package/dist/components/ColorPicker/Palette.js +7 -5
- package/dist/components/ColorPicker/Saturation.js +9 -8
- package/dist/components/ColorPicker/utils/hexToRgbaString.js +3 -2
- package/dist/components/ColorPicker/utils/rgbToHex.js +1 -1
- package/dist/components/ColorPicker/utils/validateHex.js +10 -9
- package/dist/components/Combobox/Combobox.js +47 -26
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/Combobox/ComboboxHeader.js +1 -1
- package/dist/components/Combobox/ComboboxIcon.js +3 -2
- package/dist/components/Combobox/ComboboxInput.js +4 -4
- package/dist/components/Combobox/ComboboxList.js +2 -2
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +5 -2
- package/dist/components/Dropdown/Dropdown.js +14 -9
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/Dropdown/DropdownButton.js +23 -19
- package/dist/components/Dropdown/DropdownList.js +4 -4
- package/dist/components/Dropdown/DropdownOption.js +4 -3
- package/dist/components/Dropdown/DropdownSearch.js +10 -4
- package/dist/components/FilePicker/FilePicker.js +13 -6
- package/dist/components/FilePicker/FilePicker2.js +3 -3
- package/dist/components/FormField/Caption.js +3 -3
- package/dist/components/FormField/FormField.js +2 -2
- package/dist/components/FormField/FormField2.js +3 -3
- package/dist/components/FormField/FormFieldContext.js +3 -3
- package/dist/components/FullScreenTakeover/FullScreenTakeover.js +5 -3
- package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
- package/dist/components/Icon/Icon.js +2 -2
- package/dist/components/IconButton/IconButton2.js +3 -3
- package/dist/components/InlineInput/InlineInput.js +12 -9
- package/dist/components/InlineInput/InlineInput2.js +3 -3
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/Input2.js +3 -3
- package/dist/components/Input/InputField.js +2 -2
- package/dist/components/InputGroup/InputGroup2.js +3 -3
- package/dist/components/Label/Label2.js +3 -3
- package/dist/components/Link/Link2.js +3 -3
- package/dist/components/LoadingSpinner/LoadingSpinner.js +1 -1
- package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
- package/dist/components/LogicEditor/ConditionSet.js +5 -5
- package/dist/components/LogicEditor/LogicEditor.js +1 -1
- package/dist/components/LogicEditor/LogicEditor2.js +3 -3
- package/dist/components/LogicEditor/utils.js +2 -1
- package/dist/components/Modal/Modal.js +14 -13
- package/dist/components/Modal/Modal2.js +3 -3
- package/dist/components/NewMenu/BaseMenu.js +41 -30
- package/dist/components/NewMenu/NewMenu.js +3 -3
- package/dist/components/NewMenu/SelectMenu/SelectMenu.js +2 -2
- package/dist/components/NewMenu/parts/ArrowNav/ArrowNav.js +10 -7
- package/dist/components/NewMenu/parts/MenuItem.js +1 -1
- package/dist/components/NumberStepper/NumberStepper.js +7 -6
- package/dist/components/NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/NumberStepper/NumberStepperDecrement.js +1 -1
- package/dist/components/NumberStepper/NumberStepperIncrement.js +1 -1
- package/dist/components/NumberStepper/NumberStepperInput.js +3 -3
- package/dist/components/PageLayout/PageLayout.js +3 -3
- package/dist/components/Pagination/Pagination.js +1 -1
- package/dist/components/Pagination/Pagination2.js +3 -3
- package/dist/components/Pagination/PaginationNextButton.js +5 -5
- package/dist/components/Pagination/PaginationPageInput.js +11 -9
- package/dist/components/Pagination/PaginationPreviousButton.js +5 -5
- package/dist/components/Popover/Popover.js +9 -7
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch.js +4 -3
- package/dist/components/QuickSearch/QuickSearch2.js +3 -3
- package/dist/components/QuickSearch/QuickSearchInput.js +4 -4
- package/dist/components/Radio/Radio.js +12 -11
- package/dist/components/Radio/Radio2.js +3 -3
- package/dist/components/SearchInput/SearchInput.js +4 -3
- package/dist/components/SearchInput/SearchInput2.js +3 -3
- package/dist/components/SidebarNav/SidebarNav.js +2 -1
- package/dist/components/SidebarNav/SidebarNav2.js +3 -3
- package/dist/components/SidebarNav/SidebarNavLink.js +1 -1
- package/dist/components/Slider/RangeSlider.js +2 -2
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Slider/Slider2.js +3 -3
- package/dist/components/Slider/SliderButton.js +1 -1
- package/dist/components/Switch/Switch.js +11 -11
- package/dist/components/Switch/Switch2.js +3 -3
- package/dist/components/Table/Table2.js +3 -3
- package/dist/components/Tabs/Tab.js +3 -3
- package/dist/components/Tabs/TabList.js +6 -5
- package/dist/components/Tabs/TabPanel.js +3 -3
- package/dist/components/Tabs/Tabs2.js +3 -3
- package/dist/components/Tooltip/Tooltip.js +10 -4
- package/dist/components/Tooltip/Tooltip2.js +3 -3
- package/dist/components/UIProvider/UIProvider.js +2 -2
- package/dist/components/deprecated_ColorPicker/Alpha.js +4 -4
- package/dist/components/deprecated_ColorPicker/Color.js +6 -6
- package/dist/components/deprecated_ColorPicker/ColorPicker.js +2 -2
- package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/deprecated_ColorPicker/HexInput.js +1 -1
- package/dist/components/deprecated_ColorPicker/Hue.js +3 -3
- package/dist/components/deprecated_ColorPicker/Saturation.js +5 -5
- package/dist/components/deprecated_ColorPicker/Swatch.js +2 -2
- package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/deprecated_NumberStepper/NumberStepperDecrement.js +2 -2
- package/dist/components/deprecated_NumberStepper/NumberStepperIncrement.js +2 -2
- package/dist/components/deprecated_NumberStepper/NumberStepperInput.js +8 -8
- package/dist/components/deprecated_Tabs/Tabs.js +11 -7
- package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
- package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
- package/dist/components/deprecated_Toolbar/ToolbarPanel.js +3 -3
- package/dist/components/deprecated_Toolbar/ToolbarPanels.js +4 -2
- package/dist/components/deprecated_Toolbar/ToolbarTab.js +8 -8
- package/dist/components/deprecated_Toolbar/ToolbarTabs.js +6 -3
- package/dist/hooks/useBreakpoints/useBreakpoints.js +1 -1
- package/dist/hooks/useClickOutside/useClickOutside.js +2 -1
- package/dist/hooks/useControllableState/useControllableState.js +2 -1
- package/dist/hooks/useEventListener/useEventListener.js +1 -1
- package/dist/hooks/useId/useId.js +1 -1
- package/dist/hooks/useOverlay/useOverlay.js +6 -4
- package/dist/hooks/useOverlay/useOverlay2.js +3 -3
- package/dist/hooks/useResponsiveValue/useResponsiveValue.js +2 -1
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement.js +4 -2
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
- package/dist/icons/Icon.js +3 -3
- package/dist/icons/createIconComponent.js +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +14 -7
- package/dist/index.es.js +1 -1
- package/dist/index.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTable.js +60 -49
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTableCell.js +6 -4
- package/dist/next/AdvancedTable/AdvancedTableColumnHeader.js +18 -10
- package/dist/next/AdvancedTable/AdvancedTableColumnHeaderMenu.js +7 -6
- package/dist/next/AdvancedTable/AdvancedTableDragPreview.js +5 -4
- package/dist/next/AdvancedTable/AdvancedTablePagination.js +1 -1
- package/dist/next/AdvancedTable/useAdvancedTableDragAndDrop.js +3 -2
- package/dist/next/AdvancedTable/useComputedWidth.js +1 -1
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput.js +5 -3
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInputIconButton.js +1 -1
- package/dist/next/Combobox/Combobox2.js +3 -3
- package/dist/next/Combobox/ComboboxFlyout.js +2 -2
- package/dist/next/Combobox/ComboboxGroup.js +1 -1
- package/dist/next/Combobox/ComboboxInput.js +2 -2
- package/dist/next/Combobox/ComboboxOption.js +1 -1
- package/dist/next/Combobox/hooks/useComboboxFilteredGroup/useComboboxFilteredGroup.js +1 -1
- package/dist/next/Combobox/hooks/useComboboxFocusSequence/useComboboxFocusSequence.js +12 -8
- package/dist/next/Combobox/hooks/useComboboxValue/useComboboxValue.js +1 -1
- package/dist/next/Combobox/hooks/useListboxFlyoutDimensions/useListboxFlyoutDimensions.js +3 -2
- package/dist/next/Combobox/hooks/useSelectedOptionScroll/useSelectedOptionScroll.js +2 -1
- package/dist/next/Combobox/hooks/useShouldRenderGroupHeader/useShouldRenderGroupHeader.js +2 -1
- package/dist/next/Combobox/utils/nodeRegistration/nodeRegistration.js +1 -1
- package/dist/next/Drawer/Drawer.js +7 -4
- package/dist/next/Drawer/Drawer2.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
- package/dist/next/Input/Input.js +2 -2
- package/dist/next/Input/Input2.js +3 -3
- package/dist/next/Menu/Menu.js +5 -3
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuItem.js +10 -8
- package/dist/next/Menu/MenuPane.js +20 -8
- package/dist/next/Menu/SubMenu.js +12 -8
- package/dist/next/Menu/useMutationObserver.js +1 -1
- package/dist/next/Menu/usePaneSearch.js +27 -15
- package/dist/next/PhoneNumberInput/PhoneNumberInput.js +7 -6
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/SplitButton/SplitButton.js +8 -2
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/TimePicker/TimeDropdown.js +4 -4
- package/dist/next/TimePicker/TimeInput.js +2 -2
- package/dist/next/TimePicker/TimePicker.js +4 -4
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/TimePicker/TimePickerIcon.js +2 -1
- package/dist/next/TimePicker/utils.js +10 -9
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +298 -219
- package/dist/utils/Flyout/Flyout.js +1 -1
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/dist/utils/Popper/Popper.js +9 -5
- package/dist/utils/TextOverflowTooltip/TextOverflowTooltip.js +2 -1
- package/dist/utils/Translation/useTranslation.js +4 -5
- package/dist/utils/filterChildren/filterChildren.js +2 -1
- package/dist/utils/getSubDataTestId/getSubDataTestId.js +1 -1
- package/dist/utils/mediaQueryManager/mediaQueryManager.js +1 -1
- package/dist/utils/mergeRefs/mergeRefs.js +1 -1
- package/dist/utils/wrapEvent/wrapEvent.js +2 -2
- package/next/package.json +1 -1
- package/package.json +2 -2
|
@@ -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, _swatchRefs$current$t;
|
|
71
73
|
const targetId = calculateTargetId(prevFocusedSwatchIndex, palette.length, direction);
|
|
72
|
-
swatchRefs.current
|
|
74
|
+
(_swatchRefs$current = swatchRefs.current) === null || _swatchRefs$current === void 0 ? void 0 : (_swatchRefs$current$t = _swatchRefs$current[targetId]) === null || _swatchRefs$current$t === void 0 ? void 0 : _swatchRefs$current$t.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();
|
|
@@ -19,8 +19,14 @@ import useControllableState from '../../hooks/useControllableState/useControllab
|
|
|
19
19
|
import useClickOutside from '../../hooks/useClickOutside/useClickOutside.js';
|
|
20
20
|
import wrapEvent from '../../utils/wrapEvent/wrapEvent.js';
|
|
21
21
|
|
|
22
|
-
const getOptionLabel = option =>
|
|
23
|
-
|
|
22
|
+
const getOptionLabel = option => {
|
|
23
|
+
var _option$props;
|
|
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
|
+
const getOptionValue = option => {
|
|
27
|
+
var _option$props2;
|
|
28
|
+
return option === null || option === void 0 ? void 0 : (_option$props2 = option.props) === null || _option$props2 === void 0 ? void 0 : _option$props2.value;
|
|
29
|
+
};
|
|
24
30
|
const doesOptionMatchFilter = (option, header, inputValue) => {
|
|
25
31
|
var _context, _context2;
|
|
26
32
|
const label = getOptionLabel(option);
|
|
@@ -69,20 +75,23 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
69
75
|
// Gets the <ComboboxInput> and <ComboboxList> components from the children
|
|
70
76
|
React__default.Children.forEach(children, child => {
|
|
71
77
|
if ( /*#__PURE__*/React__default.isValidElement(child)) {
|
|
72
|
-
if (child
|
|
78
|
+
if ((child === null || child === void 0 ? void 0 : child.type) === ComboboxInput) {
|
|
73
79
|
comboboxInput = child;
|
|
74
|
-
} else if (child
|
|
80
|
+
} else if ((child === null || child === void 0 ? void 0 : child.type) === ComboboxList) {
|
|
75
81
|
comboboxList = child;
|
|
76
82
|
}
|
|
77
83
|
}
|
|
78
84
|
});
|
|
79
85
|
const listContainerId = useId(comboboxList.props.id);
|
|
80
|
-
const noMatchesFoundContainerId =
|
|
86
|
+
const noMatchesFoundContainerId = "".concat(listContainerId, "-no-matches-found");
|
|
81
87
|
|
|
82
88
|
// Extracts all ComboboxOptions
|
|
83
|
-
const [, [allOptions]] = useMemo(() =>
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
const [, [allOptions]] = useMemo(() => {
|
|
90
|
+
var _comboboxList, _comboboxList$props;
|
|
91
|
+
return filterChildren((_comboboxList = comboboxList) === null || _comboboxList === void 0 ? void 0 : (_comboboxList$props = _comboboxList.props) === null || _comboboxList$props === void 0 ? void 0 : _comboboxList$props.children, [{
|
|
92
|
+
matcher: child => (child === null || child === void 0 ? void 0 : child.type) === ComboboxOption
|
|
93
|
+
}]);
|
|
94
|
+
}, [comboboxList]);
|
|
86
95
|
const {
|
|
87
96
|
defaultValue: defaultInputValue,
|
|
88
97
|
onChange: onInputChange,
|
|
@@ -105,7 +114,7 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
105
114
|
const [selectedOptionLabel, setSelectedOptionLabel] = useState(() => getLabelForValue(selectedOptionValue) || externalInputValue || defaultInputValue || '');
|
|
106
115
|
const [inputValue, setInputValue] = useControllableState(selectedOptionLabel,
|
|
107
116
|
// `e &&` prevents `ComboboxInput` from calling consumer-passed `onChange` for consumer-controlled `Combobox` value updates.
|
|
108
|
-
(_, e) => e && onInputChange
|
|
117
|
+
(_, e) => e && (onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(e)), externalInputValue);
|
|
109
118
|
|
|
110
119
|
// listen for updates from controlled value
|
|
111
120
|
useEffect(() => {
|
|
@@ -133,6 +142,7 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
133
142
|
|
|
134
143
|
// Gets the filtered options based on the current input value (only if isFilteringDisabled is false)
|
|
135
144
|
const [listChildrenFilteredOptions, [, filteredOptions]] = useMemo(() => {
|
|
145
|
+
var _comboboxList2, _comboboxList2$props;
|
|
136
146
|
let currentHeaderTitle;
|
|
137
147
|
const handleSelect = option => {
|
|
138
148
|
const newOptionValue = getOptionValue(option);
|
|
@@ -144,15 +154,16 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
144
154
|
}
|
|
145
155
|
});
|
|
146
156
|
};
|
|
147
|
-
return filterChildren(comboboxList
|
|
157
|
+
return filterChildren((_comboboxList2 = comboboxList) === null || _comboboxList2 === void 0 ? void 0 : (_comboboxList2$props = _comboboxList2.props) === null || _comboboxList2$props === void 0 ? void 0 : _comboboxList2$props.children, [
|
|
148
158
|
/*
|
|
149
159
|
* 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
160
|
* The value will be updated in the matcher/modifier below this matcher/modifier.
|
|
151
161
|
*/
|
|
152
162
|
{
|
|
153
|
-
matcher: child => child
|
|
163
|
+
matcher: child => (child === null || child === void 0 ? void 0 : child.type) === ComboboxHeader,
|
|
154
164
|
modifier: child => {
|
|
155
|
-
|
|
165
|
+
var _props;
|
|
166
|
+
currentHeaderTitle = (_props = child.props) === null || _props === void 0 ? void 0 : _props.title;
|
|
156
167
|
headerCounts[currentHeaderTitle] = 0;
|
|
157
168
|
return child;
|
|
158
169
|
}
|
|
@@ -162,16 +173,18 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
162
173
|
* Otherwise, returns null.
|
|
163
174
|
*/
|
|
164
175
|
{
|
|
165
|
-
matcher: child => child
|
|
176
|
+
matcher: child => (child === null || child === void 0 ? void 0 : child.type) === ComboboxOption,
|
|
166
177
|
modifier: (child, index) => {
|
|
167
178
|
if (inputValue === selectedOptionLabel || isFilteringDisabled || doesOptionMatchFilter(child, currentHeaderTitle, inputValue)) {
|
|
179
|
+
var _props$id;
|
|
168
180
|
headerCounts[currentHeaderTitle] += 1;
|
|
169
181
|
return /*#__PURE__*/cloneElement(child, {
|
|
170
182
|
onSelect: e => {
|
|
171
|
-
|
|
183
|
+
var _props2, _props2$onSelect;
|
|
184
|
+
child === null || child === void 0 ? void 0 : (_props2 = child.props) === null || _props2 === void 0 ? void 0 : (_props2$onSelect = _props2.onSelect) === null || _props2$onSelect === void 0 ? void 0 : _props2$onSelect.call(_props2, e);
|
|
172
185
|
|
|
173
186
|
// Prevents form submission
|
|
174
|
-
if (e
|
|
187
|
+
if ((e === null || e === void 0 ? void 0 : e.key) === 'Enter') {
|
|
175
188
|
e.preventDefault();
|
|
176
189
|
}
|
|
177
190
|
if (!e.key) {
|
|
@@ -192,7 +205,7 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
192
205
|
isHighlightedOnHover: isOptionSelectedOnKeyboardHighlight,
|
|
193
206
|
isHighlighted: isOptionSelectedOnKeyboardHighlight ? false : index === highlightedIndex,
|
|
194
207
|
isSelected: isOptionSelectedOnKeyboardHighlight ? index === selectedIndex : selectedOptionValue === getOptionValue(child),
|
|
195
|
-
id: child.props.id
|
|
208
|
+
id: (_props$id = child.props.id) !== null && _props$id !== void 0 ? _props$id : "".concat(listContainerId, "-option-").concat(index),
|
|
196
209
|
ref: node => {
|
|
197
210
|
optionRefs.current[Number(index)] = node;
|
|
198
211
|
}
|
|
@@ -206,15 +219,19 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
206
219
|
|
|
207
220
|
// Gets all filtered options, as well as headers that have at least one filtered option
|
|
208
221
|
const [listChildrenFilteredOptionsAndHeaders] = useMemo(() => filterChildren(listChildrenFilteredOptions, [{
|
|
209
|
-
matcher: child => child
|
|
222
|
+
matcher: child => (child === null || child === void 0 ? void 0 : child.type) === ComboboxOption
|
|
210
223
|
}, {
|
|
211
|
-
matcher: child => child
|
|
212
|
-
modifier: child =>
|
|
224
|
+
matcher: child => (child === null || child === void 0 ? void 0 : child.type) === ComboboxHeader,
|
|
225
|
+
modifier: child => {
|
|
226
|
+
var _props3;
|
|
227
|
+
return headerCounts[(_props3 = child.props) === null || _props3 === void 0 ? void 0 : _props3.title] ? child : null;
|
|
228
|
+
}
|
|
213
229
|
}]), [headerCounts, listChildrenFilteredOptions]);
|
|
214
230
|
const keyboardHighlightOrSelectOption = (index, e) => {
|
|
215
231
|
if (isOptionSelectedOnKeyboardHighlight) {
|
|
232
|
+
var _filteredOptions$inde, _filteredOptions$inde2, _filteredOptions$inde3;
|
|
216
233
|
setSelectedIndex(index);
|
|
217
|
-
filteredOptions[index]
|
|
234
|
+
(_filteredOptions$inde = filteredOptions[index]) === null || _filteredOptions$inde === void 0 ? void 0 : (_filteredOptions$inde2 = _filteredOptions$inde.props) === null || _filteredOptions$inde2 === void 0 ? void 0 : (_filteredOptions$inde3 = _filteredOptions$inde2.onSelect) === null || _filteredOptions$inde3 === void 0 ? void 0 : _filteredOptions$inde3.call(_filteredOptions$inde2, e);
|
|
218
235
|
} else {
|
|
219
236
|
setHighlightedIndex(index);
|
|
220
237
|
}
|
|
@@ -272,7 +289,8 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
272
289
|
case 'Enter':
|
|
273
290
|
if (isFlyoutOpen) {
|
|
274
291
|
if (!isOptionSelectedOnKeyboardHighlight && filteredOptions.length > 0 && filteredOptions[highlightedIndex] !== undefined) {
|
|
275
|
-
|
|
292
|
+
var _filteredOptions$high, _filteredOptions$high2, _filteredOptions$high3;
|
|
293
|
+
(_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);
|
|
276
294
|
}
|
|
277
295
|
}
|
|
278
296
|
setIsFlyoutOpen(false);
|
|
@@ -333,11 +351,12 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
333
351
|
useEffect(() => {
|
|
334
352
|
const currentIndex = isOptionSelectedOnKeyboardHighlight ? selectedIndex : highlightedIndex;
|
|
335
353
|
const optionRef = optionRefs.current[currentIndex];
|
|
336
|
-
if (isFocusVisible && isFlyoutOpen && optionRef && listRef
|
|
354
|
+
if (isFocusVisible && isFlyoutOpen && optionRef && listRef !== null && listRef !== void 0 && listRef.current) {
|
|
355
|
+
var _listRef$current, _listRef$current2;
|
|
337
356
|
if (currentIndex === 0) {
|
|
338
357
|
// Scrolls the first header into view if one exists
|
|
339
358
|
listRef.current.scrollTop = 0;
|
|
340
|
-
} else if (listRef.current
|
|
359
|
+
} 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
360
|
const scrollBottom = listRef.current.clientHeight + listRef.current.scrollTop;
|
|
342
361
|
const elementBottom = optionRef.offsetTop + optionRef.offsetHeight;
|
|
343
362
|
if (elementBottom > scrollBottom) {
|
|
@@ -377,16 +396,18 @@ const Combobox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
377
396
|
const activeDescendantId = useMemo(() => {
|
|
378
397
|
if (isAriaExpanded) {
|
|
379
398
|
if (unstable_isLoading) {
|
|
380
|
-
return
|
|
399
|
+
return "".concat(listContainerId, "-loading-spinner");
|
|
381
400
|
}
|
|
382
401
|
if (filteredOptions.length === 0) {
|
|
383
402
|
return undefined;
|
|
384
403
|
}
|
|
385
404
|
if (selectedIndex !== -1) {
|
|
386
|
-
|
|
405
|
+
var _filteredOptions$sele;
|
|
406
|
+
return (_filteredOptions$sele = filteredOptions[selectedIndex]) === null || _filteredOptions$sele === void 0 ? void 0 : _filteredOptions$sele.props.id;
|
|
387
407
|
}
|
|
388
408
|
if (highlightedIndex !== -1) {
|
|
389
|
-
|
|
409
|
+
var _filteredOptions$high4;
|
|
410
|
+
return (_filteredOptions$high4 = filteredOptions[highlightedIndex]) === null || _filteredOptions$high4 === void 0 ? void 0 : _filteredOptions$high4.props.id;
|
|
390
411
|
}
|
|
391
412
|
}
|
|
392
413
|
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 = "._qt655{position:relative;display:inline-block}._6yCG2{padding-right:36px}._6yCG2._-yWRC{box-shadow:none!important;border:1px solid #898989!important}._A8C-V{margin-top:4px}._2sk--{position:absolute;right:4px;bottom:4px;height:28px;width:28px;border-radius:4px;fill:#515559;cursor:pointer}._2sk--:hover{background-color:rgba(50,54,58,.08)}._2sk--:active{background-color:rgba(50,54,58,.11)}._2sk--._jl2QZ{transform:rotate(-180deg)}._2sk--._L83pp{opacity:.4}._B-nk4{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}._L83pp{cursor:not-allowed}._L83pp:hover{background-color:transparent}";
|
|
4
|
+
var styles = {"combobox":"_qt655","comboboxInput":"_6yCG2","ignoreFocusStyle":"_-yWRC","labelledInput":"_A8C-V","comboboxIcon":"_2sk--","open":"_jl2QZ","disabled":"_L83pp","comboboxEmpty":"_B-nk4"};
|
|
5
|
+
var stylesheet="._qt655{position:relative;display:inline-block}._6yCG2{padding-right:36px}._6yCG2._-yWRC{box-shadow:none!important;border:1px solid #898989!important}._A8C-V{margin-top:4px}._2sk--{position:absolute;right:4px;bottom:4px;height:28px;width:28px;border-radius:4px;fill:#515559;cursor:pointer}._2sk--:hover{background-color:rgba(50,54,58,.08)}._2sk--:active{background-color:rgba(50,54,58,.11)}._2sk--._jl2QZ{transform:rotate(-180deg)}._2sk--._L83pp{opacity:.4}._B-nk4{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}._L83pp{cursor:not-allowed}._L83pp: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 = "._h9-EV{grid-area:configPane;position:relative;height:100%}._N2Ep9{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}._g3HZB._F7UUy ._N2Ep9,._g3HZB:not(._iN5gK) ._N2Ep9{-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)}._iN5gK ._N2Ep9{width:0}._F7UUy._iN5gK ._N2Ep9{width:30px;cursor:pointer}._ZnXVI ._N2Ep9{border-right-color:#eee}._eBakD{height:100%;position:relative;width:292px}._g3HZB ._eBakD,._iN5gK ._eBakD{width:0}._F7UUy._g3HZB ._eBakD,._F7UUy._iN5gK ._eBakD{width:30px}._DEd4g ._eBakD{transition:width .5s}._1Cv2c{position:absolute;width:292px;height:100%;right:0;overflow:auto;padding:12px 0}._iN5gK ._1Cv2c{visibility:hidden}._DEd4g ._1Cv2c{visibility:visible}._1Cv2c ._1pVuk{width:252px;margin-left:20px}._2lqAA{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-bottom:12px}._eev4v{flex-grow:1;padding-right:8px;line-height:20px;margin:8px 0}._eev4v *{font-weight:400;font-size:16px;margin:0}._f2dQ2{position:absolute;transition:left .5s;top:0;left:290px;width:12px;cursor:pointer;height:100%}._iN5gK ._f2dQ2{left:0}._F7UUy._iN5gK ._f2dQ2{left:30px}._f2dQ2 ._ZjH8m{width:4px;height:100%}._f2dQ2:hover ._ZjH8m,._F7UUy._iN5gK ._N2Ep9:hover+._f2dQ2 ._ZjH8m{background-color:#9dc5ed}._f2dQ2:hover ._nQgF2>span,._F7UUy._iN5gK ._N2Ep9:hover+._f2dQ2 ._nQgF2>span{background-color:#0b6ed0;border-color:#0b6ed0}._f2dQ2:hover ._nQgF2>span>svg,._F7UUy._iN5gK ._N2Ep9:hover+._f2dQ2 ._nQgF2>span>svg{fill:#fff}._f2dQ2:hover ._nQgF2:active>span,._F7UUy._iN5gK ._N2Ep9:hover+._f2dQ2 ._nQgF2:active>span{background-color:#0854a1;border-color:#0854a1}._f2dQ2:hover ._nQgF2:active>span>svg,._F7UUy._iN5gK ._N2Ep9:hover+._f2dQ2 ._nQgF2:active>span>svg{fill:#fff}._f2dQ2 ._nQgF2{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}._f2dQ2 ._nQgF2._PiprX._PiprX._PiprX{opacity:1}._f2dQ2 ._nQgF2._aaHx0._aaHx0._aaHx0{opacity:0}._f2dQ2 ._nQgF2:active>span{background-color:#0854a1;border-color:#0854a1}._f2dQ2 ._nQgF2:active>span>svg{fill:#fff}._f2dQ2 ._nQgF2>span{width:24px;height:24px;display:flex;justify-content:center;align-items:center;background-color:#fff;border:1px solid #898989;border-radius:50%}._f2dQ2 ._nQgF2>span>svg{fill:#515559;border-radius:50%}._f2dQ2:hover ._nQgF2,._iN5gK ._f2dQ2 ._nQgF2,._N2Ep9:hover+._f2dQ2 ._nQgF2{opacity:1}._nQgF2.focus-visible,._nQgF2:focus-visible{opacity:1;border-color:#0a3f88}";
|
|
4
|
+
var styles = {"paneContainer":"_h9-EV","paneContentContainer":"_N2Ep9","unpinned":"_g3HZB","hidden":"_iN5gK","preview":"_F7UUy","openHidden":"_ZnXVI","spacer":"_eBakD","transitioning":"_DEd4g","paneContent":"_1Cv2c","paneContentInner":"_1pVuk","header":"_2lqAA","title":"_eev4v","clickableArea":"_f2dQ2","hoverBorder":"_ZjH8m","toolbarPanelExpandCollapseButton":"_nQgF2","overrideShow":"_PiprX","overrideHide":"_aaHx0"};
|
|
5
|
+
var stylesheet="._h9-EV{grid-area:configPane;position:relative;height:100%}._N2Ep9{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}._g3HZB._F7UUy ._N2Ep9,._g3HZB:not(._iN5gK) ._N2Ep9{-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)}._iN5gK ._N2Ep9{width:0}._F7UUy._iN5gK ._N2Ep9{width:30px;cursor:pointer}._ZnXVI ._N2Ep9{border-right-color:#eee}._eBakD{height:100%;position:relative;width:292px}._g3HZB ._eBakD,._iN5gK ._eBakD{width:0}._F7UUy._g3HZB ._eBakD,._F7UUy._iN5gK ._eBakD{width:30px}._DEd4g ._eBakD{transition:width .5s}._1Cv2c{position:absolute;width:292px;height:100%;right:0;overflow:auto;padding:12px 0}._iN5gK ._1Cv2c{visibility:hidden}._DEd4g ._1Cv2c{visibility:visible}._1Cv2c ._1pVuk{width:252px;margin-left:20px}._2lqAA{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding-bottom:12px}._eev4v{flex-grow:1;padding-right:8px;line-height:20px;margin:8px 0}._eev4v *{font-weight:400;font-size:16px;margin:0}._f2dQ2{position:absolute;transition:left .5s;top:0;left:290px;width:12px;cursor:pointer;height:100%}._iN5gK ._f2dQ2{left:0}._F7UUy._iN5gK ._f2dQ2{left:30px}._f2dQ2 ._ZjH8m{width:4px;height:100%}._f2dQ2:hover ._ZjH8m,._F7UUy._iN5gK ._N2Ep9:hover+._f2dQ2 ._ZjH8m{background-color:#9dc5ed}._f2dQ2:hover ._nQgF2>span,._F7UUy._iN5gK ._N2Ep9:hover+._f2dQ2 ._nQgF2>span{background-color:#0b6ed0;border-color:#0b6ed0}._f2dQ2:hover ._nQgF2>span>svg,._F7UUy._iN5gK ._N2Ep9:hover+._f2dQ2 ._nQgF2>span>svg{fill:#fff}._f2dQ2:hover ._nQgF2:active>span,._F7UUy._iN5gK ._N2Ep9:hover+._f2dQ2 ._nQgF2:active>span{background-color:#0854a1;border-color:#0854a1}._f2dQ2:hover ._nQgF2:active>span>svg,._F7UUy._iN5gK ._N2Ep9:hover+._f2dQ2 ._nQgF2:active>span>svg{fill:#fff}._f2dQ2 ._nQgF2{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}._f2dQ2 ._nQgF2._PiprX._PiprX._PiprX{opacity:1}._f2dQ2 ._nQgF2._aaHx0._aaHx0._aaHx0{opacity:0}._f2dQ2 ._nQgF2:active>span{background-color:#0854a1;border-color:#0854a1}._f2dQ2 ._nQgF2:active>span>svg{fill:#fff}._f2dQ2 ._nQgF2>span{width:24px;height:24px;display:flex;justify-content:center;align-items:center;background-color:#fff;border:1px solid #898989;border-radius:50%}._f2dQ2 ._nQgF2>span>svg{fill:#515559;border-radius:50%}._f2dQ2:hover ._nQgF2,._iN5gK ._f2dQ2 ._nQgF2,._N2Ep9:hover+._f2dQ2 ._nQgF2{opacity:1}._nQgF2.focus-visible,._nQgF2: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 = "._dSRse{border:none;height:1px;margin:0;flex-shrink:0;background-color:#e5e5e5}";
|
|
4
|
+
var styles = {"divider":"_dSRse"};
|
|
5
|
+
var stylesheet="._dSRse{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 ? 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, _dropdownButton$props3, _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 ? void 0 : (_dropdownButton$props3 = _dropdownButton$props2.props) === null || _dropdownButton$props3 === void 0 ? void 0 : _dropdownButton$props3.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 ? 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':
|