@khanacademy/wonder-blocks-dropdown 9.1.0 → 9.1.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/es/index.js +23 -23
- package/dist/index.js +80 -66
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-dropdown
|
|
2
2
|
|
|
3
|
+
## 9.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ee8d95a: Rollback rollup version from v4 to v2 to prevent an issue with CJS builds in unit tests
|
|
8
|
+
- Updated dependencies [ee8d95a]
|
|
9
|
+
- @khanacademy/wonder-blocks-cell@4.1.1
|
|
10
|
+
- @khanacademy/wonder-blocks-clickable@6.1.1
|
|
11
|
+
- @khanacademy/wonder-blocks-core@12.1.1
|
|
12
|
+
- @khanacademy/wonder-blocks-icon@5.1.1
|
|
13
|
+
- @khanacademy/wonder-blocks-layout@3.1.1
|
|
14
|
+
- @khanacademy/wonder-blocks-modal@7.1.1
|
|
15
|
+
- @khanacademy/wonder-blocks-pill@3.1.1
|
|
16
|
+
- @khanacademy/wonder-blocks-search-field@5.1.1
|
|
17
|
+
- @khanacademy/wonder-blocks-timing@7.0.1
|
|
18
|
+
- @khanacademy/wonder-blocks-tokens@4.2.1
|
|
19
|
+
- @khanacademy/wonder-blocks-typography@3.1.1
|
|
20
|
+
|
|
3
21
|
## 9.1.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/es/index.js
CHANGED
|
@@ -340,7 +340,7 @@ OptionItem.defaultProps = {
|
|
|
340
340
|
disabled: false,
|
|
341
341
|
focused: false,
|
|
342
342
|
horizontalRule: "none",
|
|
343
|
-
onToggle: () =>
|
|
343
|
+
onToggle: () => void 0,
|
|
344
344
|
role: "option",
|
|
345
345
|
selected: false
|
|
346
346
|
};
|
|
@@ -611,7 +611,7 @@ class DropdownCoreVirtualized extends React.Component {
|
|
|
611
611
|
}
|
|
612
612
|
setWidth() {
|
|
613
613
|
const rootNode = ReactDOM.findDOMNode(this);
|
|
614
|
-
const parentNode = rootNode == null ?
|
|
614
|
+
const parentNode = rootNode == null ? void 0 : rootNode.parentElement;
|
|
615
615
|
if (parentNode) {
|
|
616
616
|
const width = parentNode.getBoundingClientRect().width;
|
|
617
617
|
this.setState({
|
|
@@ -828,10 +828,10 @@ class DropdownCore extends React.Component {
|
|
|
828
828
|
}
|
|
829
829
|
constructor(props) {
|
|
830
830
|
super(props);
|
|
831
|
-
this.popperElement =
|
|
832
|
-
this.virtualizedListRef =
|
|
833
|
-
this.handleKeyDownDebounced =
|
|
834
|
-
this.textSuggestion =
|
|
831
|
+
this.popperElement = void 0;
|
|
832
|
+
this.virtualizedListRef = void 0;
|
|
833
|
+
this.handleKeyDownDebounced = void 0;
|
|
834
|
+
this.textSuggestion = void 0;
|
|
835
835
|
this.focusedIndex = -1;
|
|
836
836
|
this.focusedOriginalIndex = -1;
|
|
837
837
|
this.itemsClicked = false;
|
|
@@ -1510,7 +1510,7 @@ const _excluded$3 = ["text", "opened"];
|
|
|
1510
1510
|
class ActionMenu extends React.Component {
|
|
1511
1511
|
constructor(...args) {
|
|
1512
1512
|
super(...args);
|
|
1513
|
-
this.openerElement =
|
|
1513
|
+
this.openerElement = void 0;
|
|
1514
1514
|
this.state = {
|
|
1515
1515
|
opened: false
|
|
1516
1516
|
};
|
|
@@ -2237,7 +2237,7 @@ const MultiSelect = props => {
|
|
|
2237
2237
|
case 1:
|
|
2238
2238
|
const selectedItem = children.find(option => option.props.value === selectedValues[0]);
|
|
2239
2239
|
if (selectedItem) {
|
|
2240
|
-
const selectedLabel = getSelectOpenerLabel(showOpenerLabelAsText, selectedItem == null ?
|
|
2240
|
+
const selectedLabel = getSelectOpenerLabel(showOpenerLabelAsText, selectedItem == null ? void 0 : selectedItem.props);
|
|
2241
2241
|
if (selectedLabel) {
|
|
2242
2242
|
return selectedLabel;
|
|
2243
2243
|
} else {
|
|
@@ -2545,7 +2545,7 @@ function useListbox({
|
|
|
2545
2545
|
const renderList = React.useMemo(() => {
|
|
2546
2546
|
return options.map((component, index) => {
|
|
2547
2547
|
const isSingleSelection = selectionType === "single" && typeof selected === "string";
|
|
2548
|
-
const isSelected = (isSingleSelection ? selected === component.props.value : selected == null ?
|
|
2548
|
+
const isSelected = (isSingleSelection ? selected === component.props.value : selected == null ? void 0 : selected.includes(component.props.value)) || false;
|
|
2549
2549
|
const optionId = id ? `${id}-option-${index}` : `option-${index}`;
|
|
2550
2550
|
return React.cloneElement(component, {
|
|
2551
2551
|
key: index,
|
|
@@ -2592,19 +2592,19 @@ function useMultipleSelection({
|
|
|
2592
2592
|
if (key === "ArrowLeft") {
|
|
2593
2593
|
setFocusedMultiSelectIndex(prev => {
|
|
2594
2594
|
const newIndex = prev - 1;
|
|
2595
|
-
return newIndex < 0 ? (selected == null ?
|
|
2595
|
+
return newIndex < 0 ? (selected == null ? void 0 : selected.length) - 1 : newIndex;
|
|
2596
2596
|
});
|
|
2597
2597
|
}
|
|
2598
2598
|
if (key === "ArrowRight") {
|
|
2599
2599
|
setFocusedMultiSelectIndex(prev => {
|
|
2600
2600
|
const newIndex = prev + 1;
|
|
2601
|
-
return newIndex >= (selected == null ?
|
|
2601
|
+
return newIndex >= (selected == null ? void 0 : selected.length) ? 0 : newIndex;
|
|
2602
2602
|
});
|
|
2603
2603
|
}
|
|
2604
2604
|
if (inputValue === "" && key === "Backspace") {
|
|
2605
2605
|
let newSelected = [];
|
|
2606
2606
|
if (focusedMultiSelectIndex < 0) {
|
|
2607
|
-
newSelected = selected == null ?
|
|
2607
|
+
newSelected = selected == null ? void 0 : selected.slice(0, -1);
|
|
2608
2608
|
} else {
|
|
2609
2609
|
newSelected = selected.filter((_, index) => index !== focusedMultiSelectIndex);
|
|
2610
2610
|
}
|
|
@@ -2612,7 +2612,7 @@ function useMultipleSelection({
|
|
|
2612
2612
|
setFocusedMultiSelectIndex(-1);
|
|
2613
2613
|
}
|
|
2614
2614
|
if (focusedMultiSelectIndex >= 0 && key === "Enter") {
|
|
2615
|
-
const newSelected = selected == null ?
|
|
2615
|
+
const newSelected = selected == null ? void 0 : selected.filter((_, index) => index !== focusedMultiSelectIndex);
|
|
2616
2616
|
setSelected(newSelected);
|
|
2617
2617
|
setFocusedMultiSelectIndex(-1);
|
|
2618
2618
|
}
|
|
@@ -2653,11 +2653,11 @@ function ComboboxLiveRegion({
|
|
|
2653
2653
|
const lastSelectedValue = React.useRef(null);
|
|
2654
2654
|
const [message, setMessage] = React.useState("");
|
|
2655
2655
|
React.useEffect(() => {
|
|
2656
|
-
if (selected && selected !== (lastSelectedValue == null ?
|
|
2656
|
+
if (selected && selected !== (lastSelectedValue == null ? void 0 : lastSelectedValue.current)) {
|
|
2657
2657
|
var _lastSelectedValue$cu, _lastSelectedValue$cu2, _selected$length;
|
|
2658
2658
|
let newMessage = "";
|
|
2659
|
-
const lastSelectedLength = (_lastSelectedValue$cu = lastSelectedValue == null || (_lastSelectedValue$cu2 = lastSelectedValue.current) == null ?
|
|
2660
|
-
const selectedLength = (_selected$length = selected == null ?
|
|
2659
|
+
const lastSelectedLength = (_lastSelectedValue$cu = lastSelectedValue == null || (_lastSelectedValue$cu2 = lastSelectedValue.current) == null ? void 0 : _lastSelectedValue$cu2.length) != null ? _lastSelectedValue$cu : 0;
|
|
2660
|
+
const selectedLength = (_selected$length = selected == null ? void 0 : selected.length) != null ? _selected$length : 0;
|
|
2661
2661
|
if (Array.isArray(selected) && selected.length > 0) {
|
|
2662
2662
|
const currentLabels = selectedLabels.join(", ");
|
|
2663
2663
|
const selectedState = selectedLength > lastSelectedLength ? labels.selected(currentLabels) : labels.unselected(currentLabels);
|
|
@@ -2914,7 +2914,7 @@ function Combobox({
|
|
|
2914
2914
|
disableSpaceSelection: true,
|
|
2915
2915
|
selectionType
|
|
2916
2916
|
});
|
|
2917
|
-
const itemFromSelected = (_renderList$find = renderList.find(item => item.props.value === selected)) == null ?
|
|
2917
|
+
const itemFromSelected = (_renderList$find = renderList.find(item => item.props.value === selected)) == null ? void 0 : _renderList$find.props;
|
|
2918
2918
|
const labelFromSelected = itemFromSelected ? getLabel(itemFromSelected) : "";
|
|
2919
2919
|
const initialValue = typeof value === "string" ? labelFromSelected : "";
|
|
2920
2920
|
const [inputValue, setInputValue] = React.useState(initialValue);
|
|
@@ -2951,7 +2951,7 @@ function Combobox({
|
|
|
2951
2951
|
}
|
|
2952
2952
|
if (selectionType === "single" && typeof value === "string") {
|
|
2953
2953
|
var _renderList$find2;
|
|
2954
|
-
const itemFromSelected = (_renderList$find2 = renderList.find(item => item.props.value === value)) == null ?
|
|
2954
|
+
const itemFromSelected = (_renderList$find2 = renderList.find(item => item.props.value === value)) == null ? void 0 : _renderList$find2.props;
|
|
2955
2955
|
const labelFromSelected = itemFromSelected ? getLabel(itemFromSelected) : "";
|
|
2956
2956
|
updateOpenState(false, labelFromSelected);
|
|
2957
2957
|
} else if (Array.isArray(value)) {
|
|
@@ -3018,7 +3018,7 @@ function Combobox({
|
|
|
3018
3018
|
if (Array.isArray(selected)) {
|
|
3019
3019
|
return selected.map(value => {
|
|
3020
3020
|
const item = children.find(item => item.props.value === value);
|
|
3021
|
-
return item ? getLabel(item == null ?
|
|
3021
|
+
return item ? getLabel(item == null ? void 0 : item.props) : "";
|
|
3022
3022
|
});
|
|
3023
3023
|
}
|
|
3024
3024
|
return [labelFromSelected];
|
|
@@ -3039,7 +3039,7 @@ function Combobox({
|
|
|
3039
3039
|
};
|
|
3040
3040
|
const pillIdPrefix = `${uniqueId}-pill-`;
|
|
3041
3041
|
const textFieldId = useId();
|
|
3042
|
-
const currentActiveDescendant = !openState ? undefined : focusedIndex >= 0 ? (_renderList$focusedIn = renderList[focusedIndex]) == null || (_renderList$focusedIn = _renderList$focusedIn.props) == null ?
|
|
3042
|
+
const currentActiveDescendant = !openState ? undefined : focusedIndex >= 0 ? (_renderList$focusedIn = renderList[focusedIndex]) == null || (_renderList$focusedIn = _renderList$focusedIn.props) == null ? void 0 : _renderList$focusedIn.id : pillIdPrefix + focusedMultiSelectIndex;
|
|
3043
3043
|
const controlledWidget = !openState ? undefined : focusedIndex >= 0 ? uniqueId : pillIdPrefix;
|
|
3044
3044
|
return React.createElement(React.Fragment, null, React.createElement(View, {
|
|
3045
3045
|
onClick: () => {
|
|
@@ -3118,13 +3118,13 @@ function Combobox({
|
|
|
3118
3118
|
"aria-label": labels.comboboxButton
|
|
3119
3119
|
})), openState && React.createElement(DropdownPopper, {
|
|
3120
3120
|
alignment: "left",
|
|
3121
|
-
referenceElement: rootNodeRef == null ?
|
|
3121
|
+
referenceElement: rootNodeRef == null ? void 0 : rootNodeRef.current
|
|
3122
3122
|
}, isReferenceHidden => {
|
|
3123
3123
|
var _rootNodeRef$current, _rootNodeRef$current2;
|
|
3124
3124
|
return React.createElement(React.Fragment, null, renderList.length === 0 ? React.createElement(DetailCell, {
|
|
3125
3125
|
title: labels.noItems,
|
|
3126
3126
|
style: [styles.listbox, {
|
|
3127
|
-
minWidth: rootNodeRef == null || (_rootNodeRef$current = rootNodeRef.current) == null ?
|
|
3127
|
+
minWidth: rootNodeRef == null || (_rootNodeRef$current = rootNodeRef.current) == null ? void 0 : _rootNodeRef$current.offsetWidth
|
|
3128
3128
|
}],
|
|
3129
3129
|
horizontalRule: "none"
|
|
3130
3130
|
}) : React.createElement(Listbox, {
|
|
@@ -3132,7 +3132,7 @@ function Combobox({
|
|
|
3132
3132
|
tabIndex: -1,
|
|
3133
3133
|
selectionType: selectionType,
|
|
3134
3134
|
style: [styles.listbox, isReferenceHidden && styles.hidden, {
|
|
3135
|
-
minWidth: rootNodeRef == null || (_rootNodeRef$current2 = rootNodeRef.current) == null ?
|
|
3135
|
+
minWidth: rootNodeRef == null || (_rootNodeRef$current2 = rootNodeRef.current) == null ? void 0 : _rootNodeRef$current2.offsetWidth
|
|
3136
3136
|
}],
|
|
3137
3137
|
testId: testId ? `${testId}-listbox` : undefined,
|
|
3138
3138
|
"aria-label": labels.listbox,
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
4
6
|
var React = require('react');
|
|
5
7
|
var aphrodite = require('aphrodite');
|
|
@@ -26,7 +28,10 @@ var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
|
|
|
26
28
|
var IconButton = require('@khanacademy/wonder-blocks-icon-button');
|
|
27
29
|
var Pill = require('@khanacademy/wonder-blocks-pill');
|
|
28
30
|
|
|
29
|
-
function
|
|
31
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
32
|
+
|
|
33
|
+
function _interopNamespace(e) {
|
|
34
|
+
if (e && e.__esModule) return e;
|
|
30
35
|
var n = Object.create(null);
|
|
31
36
|
if (e) {
|
|
32
37
|
Object.keys(e).forEach(function (k) {
|
|
@@ -39,12 +44,21 @@ function _interopNamespaceDefault(e) {
|
|
|
39
44
|
}
|
|
40
45
|
});
|
|
41
46
|
}
|
|
42
|
-
n
|
|
47
|
+
n["default"] = e;
|
|
43
48
|
return Object.freeze(n);
|
|
44
49
|
}
|
|
45
50
|
|
|
46
|
-
var
|
|
47
|
-
var
|
|
51
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
52
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
53
|
+
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
54
|
+
var checkIcon__default = /*#__PURE__*/_interopDefaultLegacy(checkIcon);
|
|
55
|
+
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
56
|
+
var SearchField__default = /*#__PURE__*/_interopDefaultLegacy(SearchField);
|
|
57
|
+
var caretDownIcon__default = /*#__PURE__*/_interopDefaultLegacy(caretDownIcon);
|
|
58
|
+
var caretDownIcon__default$1 = /*#__PURE__*/_interopDefaultLegacy(caretDownIcon$1);
|
|
59
|
+
var xIcon__default = /*#__PURE__*/_interopDefaultLegacy(xIcon);
|
|
60
|
+
var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
|
|
61
|
+
var Pill__default = /*#__PURE__*/_interopDefaultLegacy(Pill);
|
|
48
62
|
|
|
49
63
|
const selectDropdownStyle = {
|
|
50
64
|
marginTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
@@ -117,7 +131,7 @@ class ActionItem extends React__namespace.Component {
|
|
|
117
131
|
const labelComponent = typeof label === "string" ? React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
118
132
|
lang: lang,
|
|
119
133
|
style: styles$c.label
|
|
120
|
-
}, label) : (React__namespace.cloneElement(label,
|
|
134
|
+
}, label) : (React__namespace.cloneElement(label, _extends__default["default"]({
|
|
121
135
|
lang,
|
|
122
136
|
style: styles$c.label
|
|
123
137
|
}, label.props)));
|
|
@@ -186,7 +200,7 @@ const Check = function Check(props) {
|
|
|
186
200
|
selected
|
|
187
201
|
} = props;
|
|
188
202
|
return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
189
|
-
icon:
|
|
203
|
+
icon: checkIcon__default["default"],
|
|
190
204
|
size: "small",
|
|
191
205
|
style: [styles$b.bounds, !selected && styles$b.hide]
|
|
192
206
|
});
|
|
@@ -217,7 +231,7 @@ const Checkbox = function Checkbox(props) {
|
|
|
217
231
|
className: "checkbox",
|
|
218
232
|
style: [styles$a.checkbox, selected && !disabled && styles$a.noBorder, disabled && styles$a.disabledCheckbox]
|
|
219
233
|
}, selected && React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
220
|
-
icon:
|
|
234
|
+
icon: checkIcon__default["default"],
|
|
221
235
|
size: "small",
|
|
222
236
|
className: "check",
|
|
223
237
|
style: [{
|
|
@@ -295,10 +309,10 @@ class OptionItem extends React__namespace.Component {
|
|
|
295
309
|
subtitle2,
|
|
296
310
|
role
|
|
297
311
|
} = _this$props,
|
|
298
|
-
sharedProps =
|
|
312
|
+
sharedProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded$5);
|
|
299
313
|
const CheckComponent = this.getCheckComponent();
|
|
300
314
|
const defaultStyle = [styles$9.item, style];
|
|
301
|
-
return React__namespace.createElement(wonderBlocksCell.DetailCell,
|
|
315
|
+
return React__namespace.createElement(wonderBlocksCell.DetailCell, _extends__default["default"]({
|
|
302
316
|
disabled: disabled,
|
|
303
317
|
horizontalRule: horizontalRule,
|
|
304
318
|
rootStyle: parentComponent === "listbox" ? styles$9.listboxItem : defaultStyle,
|
|
@@ -361,7 +375,7 @@ OptionItem.defaultProps = {
|
|
|
361
375
|
disabled: false,
|
|
362
376
|
focused: false,
|
|
363
377
|
horizontalRule: "none",
|
|
364
|
-
onToggle: () =>
|
|
378
|
+
onToggle: () => void 0,
|
|
365
379
|
role: "option",
|
|
366
380
|
selected: false
|
|
367
381
|
};
|
|
@@ -515,14 +529,14 @@ class DropdownOpener extends React__namespace.Component {
|
|
|
515
529
|
role,
|
|
516
530
|
onBlur
|
|
517
531
|
} = this.props;
|
|
518
|
-
const renderedChildren = this.props.children(
|
|
532
|
+
const renderedChildren = this.props.children(_extends__default["default"]({}, eventState, {
|
|
519
533
|
text,
|
|
520
534
|
opened
|
|
521
535
|
}));
|
|
522
536
|
const childrenProps = renderedChildren.props;
|
|
523
537
|
const childrenTestId = this.getTestIdFromProps(childrenProps);
|
|
524
538
|
const renderedAriaLabel = (_childrenProps$ariaL = childrenProps["aria-label"]) != null ? _childrenProps$ariaL : this.props["aria-label"];
|
|
525
|
-
return React__namespace.cloneElement(renderedChildren,
|
|
539
|
+
return React__namespace.cloneElement(renderedChildren, _extends__default["default"]({}, clickableChildrenProps, {
|
|
526
540
|
"aria-label": renderedAriaLabel != null ? renderedAriaLabel : undefined,
|
|
527
541
|
"aria-invalid": this.props.error,
|
|
528
542
|
disabled,
|
|
@@ -572,7 +586,7 @@ class DropdownVirtualizedItem extends React__namespace.Component {
|
|
|
572
586
|
role,
|
|
573
587
|
ref
|
|
574
588
|
} = item;
|
|
575
|
-
return React__namespace.cloneElement(component,
|
|
589
|
+
return React__namespace.cloneElement(component, _extends__default["default"]({
|
|
576
590
|
style
|
|
577
591
|
}, populatedProps, {
|
|
578
592
|
key: index,
|
|
@@ -632,7 +646,7 @@ class DropdownCoreVirtualized extends React__namespace.Component {
|
|
|
632
646
|
}
|
|
633
647
|
setWidth() {
|
|
634
648
|
const rootNode = ReactDOM__namespace.findDOMNode(this);
|
|
635
|
-
const parentNode = rootNode == null ?
|
|
649
|
+
const parentNode = rootNode == null ? void 0 : rootNode.parentElement;
|
|
636
650
|
if (parentNode) {
|
|
637
651
|
const width = parentNode.getBoundingClientRect().width;
|
|
638
652
|
this.setState({
|
|
@@ -712,7 +726,7 @@ function modifyMaxHeight({
|
|
|
712
726
|
const [basePlacement] = state.placement.split("-");
|
|
713
727
|
const heightProp = basePlacement === "top" ? "top" : "bottom";
|
|
714
728
|
const maxHeight = height - overflow[heightProp] - y;
|
|
715
|
-
state.styles.popper =
|
|
729
|
+
state.styles.popper = _extends__default["default"]({}, state.styles.popper, {
|
|
716
730
|
maxHeight: `${maxHeight}px`,
|
|
717
731
|
["--popper-max-height"]: `${maxHeight}px`
|
|
718
732
|
});
|
|
@@ -849,10 +863,10 @@ class DropdownCore extends React__namespace.Component {
|
|
|
849
863
|
}
|
|
850
864
|
constructor(props) {
|
|
851
865
|
super(props);
|
|
852
|
-
this.popperElement =
|
|
853
|
-
this.virtualizedListRef =
|
|
854
|
-
this.handleKeyDownDebounced =
|
|
855
|
-
this.textSuggestion =
|
|
866
|
+
this.popperElement = void 0;
|
|
867
|
+
this.virtualizedListRef = void 0;
|
|
868
|
+
this.handleKeyDownDebounced = void 0;
|
|
869
|
+
this.textSuggestion = void 0;
|
|
856
870
|
this.focusedIndex = -1;
|
|
857
871
|
this.focusedOriginalIndex = -1;
|
|
858
872
|
this.itemsClicked = false;
|
|
@@ -997,7 +1011,7 @@ class DropdownCore extends React__namespace.Component {
|
|
|
997
1011
|
prevItems: this.props.items,
|
|
998
1012
|
itemRefs: [],
|
|
999
1013
|
sameItemsFocusable: false,
|
|
1000
|
-
labels:
|
|
1014
|
+
labels: _extends__default["default"]({
|
|
1001
1015
|
noResults: defaultLabels.noResults,
|
|
1002
1016
|
someResults: defaultLabels.someSelected
|
|
1003
1017
|
}, props.labels)
|
|
@@ -1037,7 +1051,7 @@ class DropdownCore extends React__namespace.Component {
|
|
|
1037
1051
|
}
|
|
1038
1052
|
if (this.props.labels !== prevProps.labels) {
|
|
1039
1053
|
this.setState({
|
|
1040
|
-
labels:
|
|
1054
|
+
labels: _extends__default["default"]({}, this.state.labels, this.props.labels)
|
|
1041
1055
|
});
|
|
1042
1056
|
}
|
|
1043
1057
|
}
|
|
@@ -1219,7 +1233,7 @@ class DropdownCore extends React__namespace.Component {
|
|
|
1219
1233
|
}
|
|
1220
1234
|
const focusIndex = focusCounter - 1;
|
|
1221
1235
|
const currentRef = this.state.itemRefs[focusIndex] ? this.state.itemRefs[focusIndex].ref : null;
|
|
1222
|
-
return React__namespace.cloneElement(component,
|
|
1236
|
+
return React__namespace.cloneElement(component, _extends__default["default"]({}, populatedProps, {
|
|
1223
1237
|
key: index,
|
|
1224
1238
|
onClick: () => {
|
|
1225
1239
|
this.handleItemClick(focusIndex, item);
|
|
@@ -1240,7 +1254,7 @@ class DropdownCore extends React__namespace.Component {
|
|
|
1240
1254
|
focusCounter += 1;
|
|
1241
1255
|
}
|
|
1242
1256
|
const focusIndex = focusCounter - 1;
|
|
1243
|
-
return
|
|
1257
|
+
return _extends__default["default"]({}, item, {
|
|
1244
1258
|
role: populatedProps.role || itemRole,
|
|
1245
1259
|
ref: item.focusable && this.state.itemRefs[focusIndex] ? this.state.itemRefs[focusIndex].ref : null,
|
|
1246
1260
|
onClick: () => {
|
|
@@ -1263,7 +1277,7 @@ class DropdownCore extends React__namespace.Component {
|
|
|
1263
1277
|
const {
|
|
1264
1278
|
labels
|
|
1265
1279
|
} = this.state;
|
|
1266
|
-
return React__namespace.createElement(
|
|
1280
|
+
return React__namespace.createElement(SearchField__default["default"], {
|
|
1267
1281
|
clearAriaLabel: labels.clearSearch,
|
|
1268
1282
|
onChange: this.handleSearchTextChanged,
|
|
1269
1283
|
placeholder: labels.filter,
|
|
@@ -1416,7 +1430,7 @@ class ActionMenuOpenerCore extends React__namespace.Component {
|
|
|
1416
1430
|
opened,
|
|
1417
1431
|
"aria-label": ariaLabel
|
|
1418
1432
|
} = _this$props,
|
|
1419
|
-
restProps =
|
|
1433
|
+
restProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded$4);
|
|
1420
1434
|
const buttonColor = wonderBlocksTokens.color.blue;
|
|
1421
1435
|
const buttonStyles = _generateStyles$1(buttonColor);
|
|
1422
1436
|
const disabled = disabledProp;
|
|
@@ -1424,7 +1438,7 @@ class ActionMenuOpenerCore extends React__namespace.Component {
|
|
|
1424
1438
|
const label = React__namespace.createElement(wonderBlocksTypography.LabelLarge, {
|
|
1425
1439
|
style: sharedStyles.text
|
|
1426
1440
|
}, children);
|
|
1427
|
-
return React__namespace.createElement(StyledButton$1,
|
|
1441
|
+
return React__namespace.createElement(StyledButton$1, _extends__default["default"]({
|
|
1428
1442
|
"aria-expanded": opened ? "true" : "false",
|
|
1429
1443
|
"aria-haspopup": "menu",
|
|
1430
1444
|
"aria-label": ariaLabel,
|
|
@@ -1440,7 +1454,7 @@ class ActionMenuOpenerCore extends React__namespace.Component {
|
|
|
1440
1454
|
}), React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
1441
1455
|
size: "small",
|
|
1442
1456
|
color: "currentColor",
|
|
1443
|
-
icon:
|
|
1457
|
+
icon: caretDownIcon__default["default"],
|
|
1444
1458
|
"aria-hidden": "true"
|
|
1445
1459
|
}));
|
|
1446
1460
|
}
|
|
@@ -1531,7 +1545,7 @@ const _excluded$3 = ["text", "opened"];
|
|
|
1531
1545
|
class ActionMenu extends React__namespace.Component {
|
|
1532
1546
|
constructor(...args) {
|
|
1533
1547
|
super(...args);
|
|
1534
|
-
this.openerElement =
|
|
1548
|
+
this.openerElement = void 0;
|
|
1535
1549
|
this.state = {
|
|
1536
1550
|
opened: false
|
|
1537
1551
|
};
|
|
@@ -1596,7 +1610,7 @@ class ActionMenu extends React__namespace.Component {
|
|
|
1596
1610
|
populatedProps: {}
|
|
1597
1611
|
};
|
|
1598
1612
|
if (ActionItem.isClassOf(item)) {
|
|
1599
|
-
return
|
|
1613
|
+
return _extends__default["default"]({}, itemObject, {
|
|
1600
1614
|
populatedProps: {
|
|
1601
1615
|
indent: isOptionItemIncluded,
|
|
1602
1616
|
onClick: this.handleItemSelected
|
|
@@ -1604,7 +1618,7 @@ class ActionMenu extends React__namespace.Component {
|
|
|
1604
1618
|
});
|
|
1605
1619
|
} else if (OptionItem.isClassOf(item)) {
|
|
1606
1620
|
const selected = selectedValues ? selectedValues.includes(value) : false;
|
|
1607
|
-
return
|
|
1621
|
+
return _extends__default["default"]({}, itemObject, {
|
|
1608
1622
|
populatedProps: {
|
|
1609
1623
|
onToggle: this.handleOptionSelected,
|
|
1610
1624
|
selected,
|
|
@@ -1644,8 +1658,8 @@ class ActionMenu extends React__namespace.Component {
|
|
|
1644
1658
|
const {
|
|
1645
1659
|
opened
|
|
1646
1660
|
} = openerProps,
|
|
1647
|
-
eventState =
|
|
1648
|
-
return React__namespace.createElement(ActionMenuOpenerCore,
|
|
1661
|
+
eventState = _objectWithoutPropertiesLoose__default["default"](openerProps, _excluded$3);
|
|
1662
|
+
return React__namespace.createElement(ActionMenuOpenerCore, _extends__default["default"]({}, eventState, {
|
|
1649
1663
|
disabled: disabled,
|
|
1650
1664
|
opened: !!opened,
|
|
1651
1665
|
testId: testId
|
|
@@ -1744,11 +1758,11 @@ class SelectOpener extends React__namespace.Component {
|
|
|
1744
1758
|
"aria-required": ariaRequired,
|
|
1745
1759
|
onBlur
|
|
1746
1760
|
} = _this$props,
|
|
1747
|
-
sharedProps =
|
|
1761
|
+
sharedProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded$2);
|
|
1748
1762
|
const stateStyles = _generateStyles(isPlaceholder, error);
|
|
1749
1763
|
const iconColor = disabled ? wonderBlocksTokens.semanticColor.action.disabled.default : wonderBlocksTokens.semanticColor.icon.primary;
|
|
1750
1764
|
const style = [styles$4.shared, stateStyles.default, disabled && stateStyles.disabled, !disabled && this.state.pressed && stateStyles.press];
|
|
1751
|
-
return React__namespace.createElement(StyledButton,
|
|
1765
|
+
return React__namespace.createElement(StyledButton, _extends__default["default"]({}, sharedProps, {
|
|
1752
1766
|
"aria-disabled": disabled,
|
|
1753
1767
|
"aria-expanded": open ? "true" : "false",
|
|
1754
1768
|
"aria-invalid": error,
|
|
@@ -1769,7 +1783,7 @@ class SelectOpener extends React__namespace.Component {
|
|
|
1769
1783
|
}, children || React__namespace.createElement("span", {
|
|
1770
1784
|
"aria-hidden": "true"
|
|
1771
1785
|
}, "\xA0")), React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
1772
|
-
icon:
|
|
1786
|
+
icon: caretDownIcon__default["default"],
|
|
1773
1787
|
color: iconColor,
|
|
1774
1788
|
size: "small",
|
|
1775
1789
|
style: styles$4.caret,
|
|
@@ -1842,10 +1856,10 @@ const _generateStyles = (placeholder, error) => {
|
|
|
1842
1856
|
outlineStyle: "solid",
|
|
1843
1857
|
outlineWidth: wonderBlocksTokens.border.width.thin
|
|
1844
1858
|
};
|
|
1845
|
-
const focusHoverStyling =
|
|
1859
|
+
const focusHoverStyling = _extends__default["default"]({
|
|
1846
1860
|
outlineColor: action.hover.border
|
|
1847
1861
|
}, sharedOutlineStyling);
|
|
1848
|
-
const pressStyling =
|
|
1862
|
+
const pressStyling = _extends__default["default"]({
|
|
1849
1863
|
background: action.press.background,
|
|
1850
1864
|
color: placeholder ? error ? wonderBlocksTokens.semanticColor.text.secondary : wonderBlocksTokens.semanticColor.action.outlined.progressive.press.foreground : wonderBlocksTokens.semanticColor.text.primary,
|
|
1851
1865
|
outlineColor: action.press.border
|
|
@@ -1874,7 +1888,7 @@ const _generateStyles = (placeholder, error) => {
|
|
|
1874
1888
|
borderColor: states.disabled.border,
|
|
1875
1889
|
color: states.disabled.foreground,
|
|
1876
1890
|
cursor: "not-allowed",
|
|
1877
|
-
":focus-visible":
|
|
1891
|
+
":focus-visible": _extends__default["default"]({
|
|
1878
1892
|
outlineColor: wonderBlocksTokens.semanticColor.action.disabled.default
|
|
1879
1893
|
}, sharedOutlineStyling)
|
|
1880
1894
|
},
|
|
@@ -1990,7 +2004,7 @@ const SingleSelect = props => {
|
|
|
1990
2004
|
required,
|
|
1991
2005
|
showOpenerLabelAsText = true
|
|
1992
2006
|
} = props,
|
|
1993
|
-
sharedProps =
|
|
2007
|
+
sharedProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$1);
|
|
1994
2008
|
const [open, setOpen] = React__namespace.useState(false);
|
|
1995
2009
|
const [searchText, setSearchText] = React__namespace.useState("");
|
|
1996
2010
|
const [openerElement, setOpenerElement] = React__namespace.useState();
|
|
@@ -2103,7 +2117,7 @@ const SingleSelect = props => {
|
|
|
2103
2117
|
opened: open,
|
|
2104
2118
|
error: hasError,
|
|
2105
2119
|
onBlur: onOpenerBlurValidation
|
|
2106
|
-
}, opener) : React__namespace.createElement(SelectOpener,
|
|
2120
|
+
}, opener) : React__namespace.createElement(SelectOpener, _extends__default["default"]({}, sharedProps, {
|
|
2107
2121
|
"aria-label": ariaLabel,
|
|
2108
2122
|
"aria-controls": dropdownId,
|
|
2109
2123
|
disabled: isDisabled,
|
|
@@ -2181,8 +2195,8 @@ const MultiSelect = props => {
|
|
|
2181
2195
|
onValidate,
|
|
2182
2196
|
required
|
|
2183
2197
|
} = props,
|
|
2184
|
-
sharedProps =
|
|
2185
|
-
const labels =
|
|
2198
|
+
sharedProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded);
|
|
2199
|
+
const labels = _extends__default["default"]({}, defaultLabels, propLabels);
|
|
2186
2200
|
const [open, setOpen] = React__namespace.useState(false);
|
|
2187
2201
|
const [searchText, setSearchText] = React__namespace.useState("");
|
|
2188
2202
|
const [lastSelectedValues, setLastSelectedValues] = React__namespace.useState([]);
|
|
@@ -2258,7 +2272,7 @@ const MultiSelect = props => {
|
|
|
2258
2272
|
case 1:
|
|
2259
2273
|
const selectedItem = children.find(option => option.props.value === selectedValues[0]);
|
|
2260
2274
|
if (selectedItem) {
|
|
2261
|
-
const selectedLabel = getSelectOpenerLabel(showOpenerLabelAsText, selectedItem == null ?
|
|
2275
|
+
const selectedLabel = getSelectOpenerLabel(showOpenerLabelAsText, selectedItem == null ? void 0 : selectedItem.props);
|
|
2262
2276
|
if (selectedLabel) {
|
|
2263
2277
|
return selectedLabel;
|
|
2264
2278
|
} else {
|
|
@@ -2387,7 +2401,7 @@ const MultiSelect = props => {
|
|
|
2387
2401
|
role: "combobox",
|
|
2388
2402
|
text: menuContent,
|
|
2389
2403
|
opened: open
|
|
2390
|
-
}, opener) : React__namespace.createElement(SelectOpener,
|
|
2404
|
+
}, opener) : React__namespace.createElement(SelectOpener, _extends__default["default"]({}, sharedProps, {
|
|
2391
2405
|
error: hasError,
|
|
2392
2406
|
disabled: isDisabled,
|
|
2393
2407
|
id: uniqueOpenerId,
|
|
@@ -2566,7 +2580,7 @@ function useListbox({
|
|
|
2566
2580
|
const renderList = React__namespace.useMemo(() => {
|
|
2567
2581
|
return options.map((component, index) => {
|
|
2568
2582
|
const isSingleSelection = selectionType === "single" && typeof selected === "string";
|
|
2569
|
-
const isSelected = (isSingleSelection ? selected === component.props.value : selected == null ?
|
|
2583
|
+
const isSelected = (isSingleSelection ? selected === component.props.value : selected == null ? void 0 : selected.includes(component.props.value)) || false;
|
|
2570
2584
|
const optionId = id ? `${id}-option-${index}` : `option-${index}`;
|
|
2571
2585
|
return React__namespace.cloneElement(component, {
|
|
2572
2586
|
key: index,
|
|
@@ -2613,19 +2627,19 @@ function useMultipleSelection({
|
|
|
2613
2627
|
if (key === "ArrowLeft") {
|
|
2614
2628
|
setFocusedMultiSelectIndex(prev => {
|
|
2615
2629
|
const newIndex = prev - 1;
|
|
2616
|
-
return newIndex < 0 ? (selected == null ?
|
|
2630
|
+
return newIndex < 0 ? (selected == null ? void 0 : selected.length) - 1 : newIndex;
|
|
2617
2631
|
});
|
|
2618
2632
|
}
|
|
2619
2633
|
if (key === "ArrowRight") {
|
|
2620
2634
|
setFocusedMultiSelectIndex(prev => {
|
|
2621
2635
|
const newIndex = prev + 1;
|
|
2622
|
-
return newIndex >= (selected == null ?
|
|
2636
|
+
return newIndex >= (selected == null ? void 0 : selected.length) ? 0 : newIndex;
|
|
2623
2637
|
});
|
|
2624
2638
|
}
|
|
2625
2639
|
if (inputValue === "" && key === "Backspace") {
|
|
2626
2640
|
let newSelected = [];
|
|
2627
2641
|
if (focusedMultiSelectIndex < 0) {
|
|
2628
|
-
newSelected = selected == null ?
|
|
2642
|
+
newSelected = selected == null ? void 0 : selected.slice(0, -1);
|
|
2629
2643
|
} else {
|
|
2630
2644
|
newSelected = selected.filter((_, index) => index !== focusedMultiSelectIndex);
|
|
2631
2645
|
}
|
|
@@ -2633,7 +2647,7 @@ function useMultipleSelection({
|
|
|
2633
2647
|
setFocusedMultiSelectIndex(-1);
|
|
2634
2648
|
}
|
|
2635
2649
|
if (focusedMultiSelectIndex >= 0 && key === "Enter") {
|
|
2636
|
-
const newSelected = selected == null ?
|
|
2650
|
+
const newSelected = selected == null ? void 0 : selected.filter((_, index) => index !== focusedMultiSelectIndex);
|
|
2637
2651
|
setSelected(newSelected);
|
|
2638
2652
|
setFocusedMultiSelectIndex(-1);
|
|
2639
2653
|
}
|
|
@@ -2674,11 +2688,11 @@ function ComboboxLiveRegion({
|
|
|
2674
2688
|
const lastSelectedValue = React__namespace.useRef(null);
|
|
2675
2689
|
const [message, setMessage] = React__namespace.useState("");
|
|
2676
2690
|
React__namespace.useEffect(() => {
|
|
2677
|
-
if (selected && selected !== (lastSelectedValue == null ?
|
|
2691
|
+
if (selected && selected !== (lastSelectedValue == null ? void 0 : lastSelectedValue.current)) {
|
|
2678
2692
|
var _lastSelectedValue$cu, _lastSelectedValue$cu2, _selected$length;
|
|
2679
2693
|
let newMessage = "";
|
|
2680
|
-
const lastSelectedLength = (_lastSelectedValue$cu = lastSelectedValue == null || (_lastSelectedValue$cu2 = lastSelectedValue.current) == null ?
|
|
2681
|
-
const selectedLength = (_selected$length = selected == null ?
|
|
2694
|
+
const lastSelectedLength = (_lastSelectedValue$cu = lastSelectedValue == null || (_lastSelectedValue$cu2 = lastSelectedValue.current) == null ? void 0 : _lastSelectedValue$cu2.length) != null ? _lastSelectedValue$cu : 0;
|
|
2695
|
+
const selectedLength = (_selected$length = selected == null ? void 0 : selected.length) != null ? _selected$length : 0;
|
|
2682
2696
|
if (Array.isArray(selected) && selected.length > 0) {
|
|
2683
2697
|
const currentLabels = selectedLabels.join(", ");
|
|
2684
2698
|
const selectedState = selectedLength > lastSelectedLength ? labels.selected(currentLabels) : labels.unselected(currentLabels);
|
|
@@ -2764,7 +2778,7 @@ const MultipleSelection = React__namespace.memo(function SelectedPills({
|
|
|
2764
2778
|
const label = labels[index];
|
|
2765
2779
|
const focused = index === focusedMultiSelectIndex;
|
|
2766
2780
|
const uniqueId = id + index;
|
|
2767
|
-
return React__namespace.createElement(
|
|
2781
|
+
return React__namespace.createElement(Pill__default["default"], {
|
|
2768
2782
|
id: uniqueId,
|
|
2769
2783
|
key: uniqueId,
|
|
2770
2784
|
testId: testId ? `${testId}-pill-${index}` : undefined,
|
|
@@ -2775,7 +2789,7 @@ const MultipleSelection = React__namespace.memo(function SelectedPills({
|
|
|
2775
2789
|
tabIndex: -1,
|
|
2776
2790
|
onClick: () => onRemove(value)
|
|
2777
2791
|
}, React__namespace.createElement(React__namespace.Fragment, null, label, !disabled && React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
2778
|
-
icon:
|
|
2792
|
+
icon: xIcon__default["default"],
|
|
2779
2793
|
size: "small"
|
|
2780
2794
|
})));
|
|
2781
2795
|
}));
|
|
@@ -2935,7 +2949,7 @@ function Combobox({
|
|
|
2935
2949
|
disableSpaceSelection: true,
|
|
2936
2950
|
selectionType
|
|
2937
2951
|
});
|
|
2938
|
-
const itemFromSelected = (_renderList$find = renderList.find(item => item.props.value === selected)) == null ?
|
|
2952
|
+
const itemFromSelected = (_renderList$find = renderList.find(item => item.props.value === selected)) == null ? void 0 : _renderList$find.props;
|
|
2939
2953
|
const labelFromSelected = itemFromSelected ? getLabel(itemFromSelected) : "";
|
|
2940
2954
|
const initialValue = typeof value === "string" ? labelFromSelected : "";
|
|
2941
2955
|
const [inputValue, setInputValue] = React__namespace.useState(initialValue);
|
|
@@ -2972,7 +2986,7 @@ function Combobox({
|
|
|
2972
2986
|
}
|
|
2973
2987
|
if (selectionType === "single" && typeof value === "string") {
|
|
2974
2988
|
var _renderList$find2;
|
|
2975
|
-
const itemFromSelected = (_renderList$find2 = renderList.find(item => item.props.value === value)) == null ?
|
|
2989
|
+
const itemFromSelected = (_renderList$find2 = renderList.find(item => item.props.value === value)) == null ? void 0 : _renderList$find2.props;
|
|
2976
2990
|
const labelFromSelected = itemFromSelected ? getLabel(itemFromSelected) : "";
|
|
2977
2991
|
updateOpenState(false, labelFromSelected);
|
|
2978
2992
|
} else if (Array.isArray(value)) {
|
|
@@ -3039,7 +3053,7 @@ function Combobox({
|
|
|
3039
3053
|
if (Array.isArray(selected)) {
|
|
3040
3054
|
return selected.map(value => {
|
|
3041
3055
|
const item = children.find(item => item.props.value === value);
|
|
3042
|
-
return item ? getLabel(item == null ?
|
|
3056
|
+
return item ? getLabel(item == null ? void 0 : item.props) : "";
|
|
3043
3057
|
});
|
|
3044
3058
|
}
|
|
3045
3059
|
return [labelFromSelected];
|
|
@@ -3049,7 +3063,7 @@ function Combobox({
|
|
|
3049
3063
|
if (!startIcon) {
|
|
3050
3064
|
return null;
|
|
3051
3065
|
}
|
|
3052
|
-
const startIconElement = React__namespace.cloneElement(startIcon,
|
|
3066
|
+
const startIconElement = React__namespace.cloneElement(startIcon, _extends__default["default"]({
|
|
3053
3067
|
size: "small"
|
|
3054
3068
|
}, startIcon.props, {
|
|
3055
3069
|
color: disabled ? wonderBlocksTokens.color.offBlack32 : (_startIcon$props$colo = startIcon.props.color) != null ? _startIcon$props$colo : wonderBlocksTokens.semanticColor.icon.primary
|
|
@@ -3060,7 +3074,7 @@ function Combobox({
|
|
|
3060
3074
|
};
|
|
3061
3075
|
const pillIdPrefix = `${uniqueId}-pill-`;
|
|
3062
3076
|
const textFieldId = React.useId();
|
|
3063
|
-
const currentActiveDescendant = !openState ? undefined : focusedIndex >= 0 ? (_renderList$focusedIn = renderList[focusedIndex]) == null || (_renderList$focusedIn = _renderList$focusedIn.props) == null ?
|
|
3077
|
+
const currentActiveDescendant = !openState ? undefined : focusedIndex >= 0 ? (_renderList$focusedIn = renderList[focusedIndex]) == null || (_renderList$focusedIn = _renderList$focusedIn.props) == null ? void 0 : _renderList$focusedIn.id : pillIdPrefix + focusedMultiSelectIndex;
|
|
3064
3078
|
const controlledWidget = !openState ? undefined : focusedIndex >= 0 ? uniqueId : pillIdPrefix;
|
|
3065
3079
|
return React__namespace.createElement(React__namespace.Fragment, null, React__namespace.createElement(wonderBlocksCore.View, {
|
|
3066
3080
|
onClick: () => {
|
|
@@ -3112,17 +3126,17 @@ function Combobox({
|
|
|
3112
3126
|
ref: comboboxRef,
|
|
3113
3127
|
autoComplete: "off",
|
|
3114
3128
|
role: "combobox"
|
|
3115
|
-
}), inputValue && !disabled && React__namespace.createElement(
|
|
3116
|
-
icon:
|
|
3129
|
+
}), inputValue && !disabled && React__namespace.createElement(IconButton__default["default"], {
|
|
3130
|
+
icon: xIcon__default["default"],
|
|
3117
3131
|
onClick: handleClearClick,
|
|
3118
3132
|
kind: "tertiary",
|
|
3119
3133
|
size: "small",
|
|
3120
3134
|
style: [styles.button, styles.clearButton],
|
|
3121
3135
|
"aria-label": labels.clearSelection,
|
|
3122
3136
|
testId: testId ? `${testId}-clear` : undefined
|
|
3123
|
-
}), React__namespace.createElement(
|
|
3137
|
+
}), React__namespace.createElement(IconButton__default["default"], {
|
|
3124
3138
|
disabled: disabled,
|
|
3125
|
-
icon:
|
|
3139
|
+
icon: caretDownIcon__default$1["default"],
|
|
3126
3140
|
onClick: e => {
|
|
3127
3141
|
e.stopPropagation();
|
|
3128
3142
|
updateOpenState(!openState);
|
|
@@ -3139,13 +3153,13 @@ function Combobox({
|
|
|
3139
3153
|
"aria-label": labels.comboboxButton
|
|
3140
3154
|
})), openState && React__namespace.createElement(DropdownPopper, {
|
|
3141
3155
|
alignment: "left",
|
|
3142
|
-
referenceElement: rootNodeRef == null ?
|
|
3156
|
+
referenceElement: rootNodeRef == null ? void 0 : rootNodeRef.current
|
|
3143
3157
|
}, isReferenceHidden => {
|
|
3144
3158
|
var _rootNodeRef$current, _rootNodeRef$current2;
|
|
3145
3159
|
return React__namespace.createElement(React__namespace.Fragment, null, renderList.length === 0 ? React__namespace.createElement(wonderBlocksCell.DetailCell, {
|
|
3146
3160
|
title: labels.noItems,
|
|
3147
3161
|
style: [styles.listbox, {
|
|
3148
|
-
minWidth: rootNodeRef == null || (_rootNodeRef$current = rootNodeRef.current) == null ?
|
|
3162
|
+
minWidth: rootNodeRef == null || (_rootNodeRef$current = rootNodeRef.current) == null ? void 0 : _rootNodeRef$current.offsetWidth
|
|
3149
3163
|
}],
|
|
3150
3164
|
horizontalRule: "none"
|
|
3151
3165
|
}) : React__namespace.createElement(Listbox, {
|
|
@@ -3153,7 +3167,7 @@ function Combobox({
|
|
|
3153
3167
|
tabIndex: -1,
|
|
3154
3168
|
selectionType: selectionType,
|
|
3155
3169
|
style: [styles.listbox, isReferenceHidden && styles.hidden, {
|
|
3156
|
-
minWidth: rootNodeRef == null || (_rootNodeRef$current2 = rootNodeRef.current) == null ?
|
|
3170
|
+
minWidth: rootNodeRef == null || (_rootNodeRef$current2 = rootNodeRef.current) == null ? void 0 : _rootNodeRef$current2.offsetWidth
|
|
3157
3171
|
}],
|
|
3158
3172
|
testId: testId ? `${testId}-listbox` : undefined,
|
|
3159
3173
|
"aria-label": labels.listbox,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-dropdown",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.1",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"description": "Dropdown variants for Wonder Blocks.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,17 +13,17 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@babel/runtime": "^7.24.5",
|
|
16
|
-
"@khanacademy/wonder-blocks-cell": "4.1.
|
|
17
|
-
"@khanacademy/wonder-blocks-clickable": "6.1.
|
|
18
|
-
"@khanacademy/wonder-blocks-core": "12.1.
|
|
19
|
-
"@khanacademy/wonder-blocks-icon": "5.1.
|
|
20
|
-
"@khanacademy/wonder-blocks-layout": "3.1.
|
|
21
|
-
"@khanacademy/wonder-blocks-modal": "7.1.
|
|
22
|
-
"@khanacademy/wonder-blocks-pill": "3.1.
|
|
23
|
-
"@khanacademy/wonder-blocks-search-field": "5.1.
|
|
24
|
-
"@khanacademy/wonder-blocks-timing": "7.0.
|
|
25
|
-
"@khanacademy/wonder-blocks-tokens": "4.2.
|
|
26
|
-
"@khanacademy/wonder-blocks-typography": "3.1.
|
|
16
|
+
"@khanacademy/wonder-blocks-cell": "4.1.1",
|
|
17
|
+
"@khanacademy/wonder-blocks-clickable": "6.1.1",
|
|
18
|
+
"@khanacademy/wonder-blocks-core": "12.1.1",
|
|
19
|
+
"@khanacademy/wonder-blocks-icon": "5.1.1",
|
|
20
|
+
"@khanacademy/wonder-blocks-layout": "3.1.1",
|
|
21
|
+
"@khanacademy/wonder-blocks-modal": "7.1.1",
|
|
22
|
+
"@khanacademy/wonder-blocks-pill": "3.1.1",
|
|
23
|
+
"@khanacademy/wonder-blocks-search-field": "5.1.1",
|
|
24
|
+
"@khanacademy/wonder-blocks-timing": "7.0.1",
|
|
25
|
+
"@khanacademy/wonder-blocks-tokens": "4.2.1",
|
|
26
|
+
"@khanacademy/wonder-blocks-typography": "3.1.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@phosphor-icons/core": "^2.0.2",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"react-window": "^1.8.11"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@khanacademy/wb-dev-build-settings": "2.1.
|
|
40
|
+
"@khanacademy/wb-dev-build-settings": "2.1.1"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"test": "echo \"Error: no test specified\" && exit 1"
|