@wix/site-ui 1.347.0 → 1.348.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/dist/{6706.js → 1093.js} +3 -3
- package/dist/{8724.js → 1219.js} +2 -2
- package/dist/{7373.js → 1288.js} +8 -2
- package/dist/{5299.js → 1381.js} +98 -127
- package/dist/{3056.js → 1607.js} +32 -34
- package/dist/1629.js +2 -0
- package/dist/1669.js +75 -0
- package/dist/1718.js +26 -0
- package/dist/{1477.js → 201.js} +17 -26
- package/dist/2221.js +9 -0
- package/dist/{2445.js → 226.js} +12 -48
- package/dist/2387.js +7 -0
- package/dist/2580.js +6 -0
- package/dist/{1500.js → 2859.js} +10 -34
- package/dist/3014.js +178 -0
- package/dist/{6247.js → 3054.js} +3 -3
- package/dist/{7642.js → 3093.js} +1 -1
- package/dist/3189.js +5 -0
- package/dist/{7564.js → 331.js} +2 -2
- package/dist/3357.js +7 -0
- package/dist/{487.js → 3398.js} +38 -39
- package/dist/3502.js +224 -0
- package/dist/3695.js +50 -0
- package/dist/3829.js +1 -1
- package/dist/{6588.js → 3859.js} +115 -92
- package/dist/{3670.js → 3910.js} +28 -21
- package/dist/392.js +7 -0
- package/dist/{4549.js → 4155.js} +11 -3
- package/dist/4226.js +7 -0
- package/dist/{6329.js → 4229.js} +1 -1
- package/dist/4293.js +3 -0
- package/dist/4346.js +853 -2
- package/dist/{285.js → 4472.js} +3 -3
- package/dist/4605.js +207 -0
- package/dist/{7366.js → 488.js} +60 -7
- package/dist/{8750.js → 497.js} +190 -375
- package/dist/4989.js +35 -0
- package/dist/{6270.js → 510.js} +157 -196
- package/dist/5258.js +26 -0
- package/dist/{5036.js → 5275.js} +0 -3
- package/dist/{8171.js → 5298.js} +90 -102
- package/dist/5473.js +11 -0
- package/dist/{4745.js → 5490.js} +3 -1
- package/dist/{6089.js → 5561.js} +869 -786
- package/dist/{8996.js → 5595.js} +4 -3
- package/dist/5890.js +25 -0
- package/dist/{6046.js → 5969.js} +1 -1
- package/dist/5984.js +38 -0
- package/dist/{8527.js → 6006.js} +3 -3
- package/dist/6040.js +97 -0
- package/dist/{8758.js → 6137.js} +10 -8
- package/dist/{4281.js → 6140.js} +18 -10
- package/dist/{8960.js → 6191.js} +2 -2
- package/dist/6240.js +121 -0
- package/dist/{4490.js → 6373.js} +7 -5
- package/dist/{904.js → 6487.js} +19 -17
- package/dist/{9635.js → 6498.js} +1 -1
- package/dist/6499.js +4 -7
- package/dist/6508.js +7 -0
- package/dist/{8225.js → 6540.js} +1 -0
- package/dist/6551.js +46 -0
- package/dist/{9369.js → 6620.js} +35 -34
- package/dist/{4143.js → 6838.js} +19 -10
- package/dist/6902.js +48 -0
- package/dist/6904.js +51 -0
- package/dist/70.js +24 -0
- package/dist/7024.js +39 -0
- package/dist/{6882.js → 721.js} +737 -362
- package/dist/{951.js → 7270.js} +4 -4
- package/dist/{3485.js → 7323.js} +143 -111
- package/dist/{7541.js → 7488.js} +2 -2
- package/dist/{4863.js → 7542.js} +7 -6
- package/dist/7551.js +28 -0
- package/dist/{7021.js → 7640.js} +1 -1
- package/dist/{353.js → 7692.js} +3 -7
- package/dist/{4707.js → 7930.js} +2 -2
- package/dist/{8052.js → 8.js} +80 -64
- package/dist/{6914.js → 8129.js} +3 -15
- package/dist/{3319.js → 8358.js} +62 -63
- package/dist/{5864.js → 8407.js} +13 -13
- package/dist/8488.js +15 -0
- package/dist/{4768.js → 8495.js} +1 -1
- package/dist/8734.js +171 -0
- package/dist/{1763.js → 9018.js} +205 -331
- package/dist/9053.js +29 -0
- package/dist/9067.js +41 -0
- package/dist/{2861.js → 9120.js} +2 -2
- package/dist/{42.js → 9197.js} +2 -2
- package/dist/{9189.js → 9248.js} +36 -17
- package/dist/{2801.js → 9252.js} +4 -9
- package/dist/9295.js +7 -0
- package/dist/9303.js +8 -0
- package/dist/{167.js → 9374.js} +1 -1
- package/dist/{9352.js → 9540.js} +17 -47
- package/dist/9576.js +51 -0
- package/dist/{8272.js → 9591.js} +36 -46
- package/dist/{6107.js → 9770.js} +2 -2
- package/dist/{5085.js → 9880.js} +6 -3
- package/dist/Accordion/index.d.ts +207 -41
- package/dist/Accordion/index.js +75 -177
- package/dist/AlertDialog/index.d.ts +440 -140
- package/dist/AlertDialog/index.js +3 -13
- package/dist/Autocomplete/index.d.ts +722 -150
- package/dist/Autocomplete/index.js +16 -29
- package/dist/Avatar/index.d.ts +38 -3
- package/dist/Avatar/index.js +82 -28
- package/dist/Breadcrumbs/index.d.ts +63 -91
- package/dist/Breadcrumbs/index.js +1 -1
- package/dist/Button/index.d.ts +11 -0
- package/dist/Button/index.js +2 -2
- package/dist/Checkbox/index.d.ts +206 -36
- package/dist/Checkbox/index.js +293 -8
- package/dist/CheckboxField/index.css +1 -1
- package/dist/CheckboxField/index.d.ts +40 -36
- package/dist/CheckboxGroup/index.d.ts +50 -36
- package/dist/CheckboxGroup/index.js +87 -58
- package/dist/CheckboxGroupField/index.css +1 -1
- package/dist/Collapsible/index.d.ts +128 -36
- package/dist/Collapsible/index.js +21 -25
- package/dist/Combobox/index.d.ts +801 -158
- package/dist/Combobox/index.js +70 -114
- package/dist/ContextMenu/index.d.ts +1162 -195
- package/dist/ContextMenu/index.js +46 -36
- package/dist/Dialog/index.d.ts +425 -133
- package/dist/Dialog/index.js +8 -4
- package/dist/Drawer/index.d.ts +589 -144
- package/dist/Drawer/index.js +482 -562
- package/dist/Field/index.css +1 -1
- package/dist/Field/index.d.ts +341 -42
- package/dist/Field/index.js +123 -273
- package/dist/Fieldset/index.d.ts +11 -0
- package/dist/Fieldset/index.js +10 -17
- package/dist/Form/index.d.ts +43 -39
- package/dist/Form/index.js +58 -50
- package/dist/Input/index.css +1 -1
- package/dist/Input/index.d.ts +94 -42
- package/dist/Input/index.js +1 -1
- package/dist/Menu/index.d.ts +1140 -175
- package/dist/Menu/index.js +51 -67
- package/dist/Menubar/index.d.ts +651 -173
- package/dist/Menubar/index.js +12 -16
- package/dist/Meter/index.js +21 -18
- package/dist/NavigationMenu/index.d.ts +370 -86
- package/dist/NavigationMenu/index.js +144 -178
- package/dist/NumberField/index.css +1 -1
- package/dist/NumberField/index.d.ts +507 -47
- package/dist/NumberField/index.js +434 -718
- package/dist/Popover/index.d.ts +561 -142
- package/dist/Popover/index.js +181 -252
- package/dist/PreviewCard/index.d.ts +507 -143
- package/dist/PreviewCard/index.js +97 -151
- package/dist/Progress/index.d.ts +117 -3
- package/dist/Progress/index.js +37 -36
- package/dist/Radio/index.d.ts +177 -7
- package/dist/Radio/index.js +54 -70
- package/dist/RadioField/index.css +1 -1
- package/dist/RadioField/index.d.ts +23 -7
- package/dist/RadioGroup/index.d.ts +51 -37
- package/dist/RadioGroup/index.js +60 -51
- package/dist/RadioGroupField/index.css +1 -1
- package/dist/RadioGroupField/index.d.ts +40 -37
- package/dist/ScrollArea/index.d.ts +295 -1
- package/dist/ScrollArea/index.js +256 -324
- package/dist/Select/index.d.ts +516 -123
- package/dist/Select/index.js +513 -635
- package/dist/SelectField/index.css +1 -1
- package/dist/SelectField/index.d.ts +109 -134
- package/dist/SelectField/index.js +5 -1
- package/dist/Separator/index.d.ts +12 -0
- package/dist/Separator/index.js +1 -1
- package/dist/Slider/index.d.ts +383 -64
- package/dist/Slider/index.js +298 -374
- package/dist/Switch/index.d.ts +184 -37
- package/dist/Switch/index.js +44 -58
- package/dist/Tabs/index.d.ts +220 -35
- package/dist/Tabs/index.js +199 -193
- package/dist/Toast/index.d.ts +280 -64
- package/dist/Toast/index.js +299 -374
- package/dist/Toggle/index.d.ts +55 -35
- package/dist/Toggle/index.js +19 -13
- package/dist/ToggleGroup/index.d.ts +62 -35
- package/dist/ToggleGroup/index.js +13 -31
- package/dist/Toolbar/index.d.ts +117 -2
- package/dist/Toolbar/index.js +31 -43
- package/dist/Tooltip/index.d.ts +507 -150
- package/dist/Tooltip/index.js +163 -213
- package/dist/index.d.ts +12912 -5382
- package/package.json +3 -3
- package/dist/2205.js +0 -26
- package/dist/2274.js +0 -34
- package/dist/2287.js +0 -17
- package/dist/3020.js +0 -7
- package/dist/3021.js +0 -72
- package/dist/3140.js +0 -4
- package/dist/3248.js +0 -307
- package/dist/4026.js +0 -12
- package/dist/4922.js +0 -15
- package/dist/5659.js +0 -4
- package/dist/5992.js +0 -447
- package/dist/6330.js +0 -30
- package/dist/6535.js +0 -72
- package/dist/6917.js +0 -55
- package/dist/7725.js +0 -10
- package/dist/7871.js +0 -38
- package/dist/8106.js +0 -239
- package/dist/8685.js +0 -102
- package/dist/8935.js +0 -8
- package/dist/8971.js +0 -40
- package/dist/8979.js +0 -10
- package/dist/9048.js +0 -52
- package/dist/9087.js +0 -256
- package/dist/9255.js +0 -136
- /package/dist/{1457.js → 1068.js} +0 -0
- /package/dist/{6003.js → 1234.js} +0 -0
- /package/dist/{4723.js → 1282.js} +0 -0
- /package/dist/{6825.js → 1876.js} +0 -0
- /package/dist/{5778.js → 1885.js} +0 -0
- /package/dist/{2445.js.LICENSE.txt → 226.js.LICENSE.txt} +0 -0
- /package/dist/{1279.js → 3278.js} +0 -0
- /package/dist/{3296.js → 5568.js} +0 -0
- /package/dist/{8685.css → 6240.css} +0 -0
- /package/dist/{9829.js → 6488.js} +0 -0
- /package/dist/{9863.js → 6534.js} +0 -0
- /package/dist/{4495.js → 7718.js} +0 -0
- /package/dist/{3395.js → 8866.js} +0 -0
- /package/dist/{2418.js → 9837.js} +0 -0
package/dist/Combobox/index.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useFieldRootContext, fieldValidityMapping } from "../
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { createChangeEventDetails } from "../
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { Separator } from "../9635.js";
|
|
2
|
+
import { useFieldRootContext, fieldValidityMapping } from "../201.js";
|
|
3
|
+
import { ComboboxArrow_ComboboxArrow, handleInputPress, useComboboxItemContext, AriaCombobox, ComboboxInputGroup_ComboboxInputGroup, ComboboxPositioner_ComboboxPositioner, ComboboxBackdrop_ComboboxBackdrop, useComboboxRootContext, useComboboxChipsContext, ComboboxRow_ComboboxRow, ComboboxIcon_ComboboxIcon, ComboboxClear_ComboboxClear, getChipNavigationKeys, ComboboxCollection, ComboboxTrigger_ComboboxTrigger, ComboboxGroup_ComboboxGroup, ComboboxGroupLabel_ComboboxGroupLabel, ComboboxStatus_ComboboxStatus, ComboboxPopup_ComboboxPopup, ComboboxInput_ComboboxInput, ComboboxEmpty_ComboboxEmpty, ComboboxPortal_ComboboxPortal, getIndexAfterChipRemoval, ComboboxChipsContext, ComboboxList_ComboboxList, ComboboxItem_ComboboxItem } from "../5561.js";
|
|
4
|
+
import { getDefaultLabelId } from "../1876.js";
|
|
5
|
+
import { SafeReact } from "../3357.js";
|
|
6
|
+
import { error } from "../4293.js";
|
|
7
|
+
import { useLabel } from "../6838.js";
|
|
8
|
+
import { useRenderElement, EMPTY_OBJECT } from "../9591.js";
|
|
9
|
+
import { ItemIndicator_ItemIndicator } from "../9067.js";
|
|
10
|
+
import { CompositeList } from "../3014.js";
|
|
11
|
+
import { utils_formatErrorMessage } from "../5473.js";
|
|
12
|
+
import { useDirection } from "../6534.js";
|
|
13
|
+
import { useCompositeListItem } from "../9576.js";
|
|
14
|
+
import { stopEvent } from "../8358.js";
|
|
15
|
+
import { listNavigation, keyboard, chipRemovePress } from "../9837.js";
|
|
16
|
+
import { createChangeEventDetails } from "../8495.js";
|
|
17
|
+
import { useButton } from "../9248.js";
|
|
18
|
+
import { ListboxSeparator_ListboxSeparator, findItemIndex, resolveMultipleLabels, resolveSelectedLabel } from "../488.js";
|
|
19
|
+
import { getHighlightReason } from "../9303.js";
|
|
21
20
|
import * as __rspack_external_react from "react";
|
|
22
21
|
import * as __rspack_external_react_dom_7136dc57 from "react-dom";
|
|
23
22
|
const ComboboxLabel_ComboboxLabel = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
@@ -26,10 +25,10 @@ const ComboboxLabel_ComboboxLabel = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
26
25
|
delete elementPropsWithoutId.id;
|
|
27
26
|
const fieldRootContext = useFieldRootContext();
|
|
28
27
|
const store = useComboboxRootContext();
|
|
29
|
-
const inputInsidePopup =
|
|
30
|
-
const triggerElement =
|
|
31
|
-
const inputElement =
|
|
32
|
-
const rootId =
|
|
28
|
+
const inputInsidePopup = store.useState('inputInsidePopup');
|
|
29
|
+
const triggerElement = store.useState('triggerElement');
|
|
30
|
+
const inputElement = store.useState('inputElement');
|
|
31
|
+
const rootId = store.useState('id');
|
|
33
32
|
const defaultLabelId = getDefaultLabelId(rootId);
|
|
34
33
|
const localControlId = triggerElement?.id ?? (inputInsidePopup ? rootId : void 0);
|
|
35
34
|
if ('production' !== process.env.NODE_ENV) __rspack_external_react.useEffect(()=>{
|
|
@@ -45,7 +44,8 @@ const ComboboxLabel_ComboboxLabel = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
45
44
|
id: defaultLabelId,
|
|
46
45
|
fallbackControlId: localControlId,
|
|
47
46
|
setLabelId (nextLabelId) {
|
|
48
|
-
store.
|
|
47
|
+
const resolvedLabelId = 'function' == typeof nextLabelId ? nextLabelId(store.state.labelId) : nextLabelId;
|
|
48
|
+
store.set('labelId', resolvedLabelId);
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
return useRenderElement('div', componentProps, {
|
|
@@ -60,62 +60,25 @@ const ComboboxLabel_ComboboxLabel = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
60
60
|
});
|
|
61
61
|
if ("production" !== process.env.NODE_ENV) ComboboxLabel_ComboboxLabel.displayName = "ComboboxLabel";
|
|
62
62
|
const ComboboxItemIndicator_ComboboxItemIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
63
|
-
const keepMounted = componentProps.keepMounted ?? false;
|
|
64
63
|
const { selected } = useComboboxItemContext();
|
|
65
|
-
const shouldRender = keepMounted || selected;
|
|
64
|
+
const shouldRender = componentProps.keepMounted || selected;
|
|
66
65
|
if (!shouldRender) return null;
|
|
67
|
-
return /*#__PURE__*/ jsx(
|
|
66
|
+
return /*#__PURE__*/ jsx(ItemIndicator_ItemIndicator, {
|
|
68
67
|
...componentProps,
|
|
68
|
+
selected: selected,
|
|
69
69
|
ref: forwardedRef
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
72
|
if ("production" !== process.env.NODE_ENV) ComboboxItemIndicator_ComboboxItemIndicator.displayName = "ComboboxItemIndicator";
|
|
73
|
-
const Inner = /*#__PURE__*/ __rspack_external_react.memo(/*#__PURE__*/ __rspack_external_react.forwardRef((componentProps, forwardedRef)=>{
|
|
74
|
-
const { render, className, style, keepMounted, ...elementProps } = componentProps;
|
|
75
|
-
const { selected } = useComboboxItemContext();
|
|
76
|
-
const indicatorRef = __rspack_external_react.useRef(null);
|
|
77
|
-
const { transitionStatus, setMounted } = useTransitionStatus(selected);
|
|
78
|
-
const state = {
|
|
79
|
-
selected,
|
|
80
|
-
transitionStatus
|
|
81
|
-
};
|
|
82
|
-
const element = useRenderElement('span', componentProps, {
|
|
83
|
-
ref: [
|
|
84
|
-
forwardedRef,
|
|
85
|
-
indicatorRef
|
|
86
|
-
],
|
|
87
|
-
state,
|
|
88
|
-
props: [
|
|
89
|
-
{
|
|
90
|
-
'aria-hidden': true,
|
|
91
|
-
children: '✔️'
|
|
92
|
-
},
|
|
93
|
-
elementProps
|
|
94
|
-
],
|
|
95
|
-
stateAttributesMapping: transitionStatusMapping
|
|
96
|
-
});
|
|
97
|
-
useOpenChangeComplete({
|
|
98
|
-
open: selected,
|
|
99
|
-
ref: indicatorRef,
|
|
100
|
-
onComplete () {
|
|
101
|
-
if (!selected) setMounted(false);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
return element;
|
|
105
|
-
}));
|
|
106
|
-
if ("production" !== process.env.NODE_ENV) Inner.displayName = "Inner";
|
|
107
73
|
const ComboboxChips_ComboboxChips = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
108
74
|
const { render, className, style, ...elementProps } = componentProps;
|
|
109
75
|
const store = useComboboxRootContext();
|
|
110
|
-
const
|
|
111
|
-
const hasSelectionChips = useStore(store, selectors.hasSelectionChips);
|
|
112
|
-
const [highlightedChipIndex, setHighlightedChipIndex] = __rspack_external_react.useState(void 0);
|
|
113
|
-
if (open && void 0 !== highlightedChipIndex) setHighlightedChipIndex(void 0);
|
|
76
|
+
const hasSelectionChips = store.useState('hasSelectionChips');
|
|
114
77
|
const chipsRef = __rspack_external_react.useRef([]);
|
|
115
78
|
const element = useRenderElement('div', componentProps, {
|
|
116
79
|
ref: [
|
|
117
80
|
forwardedRef,
|
|
118
|
-
store.
|
|
81
|
+
store.context.chipsContainerRef
|
|
119
82
|
],
|
|
120
83
|
props: [
|
|
121
84
|
hasSelectionChips ? {
|
|
@@ -123,21 +86,15 @@ const ComboboxChips_ComboboxChips = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
123
86
|
} : EMPTY_OBJECT,
|
|
124
87
|
{
|
|
125
88
|
onMouseDown (event) {
|
|
126
|
-
handleInputPress(event, store, store.state.disabled
|
|
89
|
+
handleInputPress(event, store, store.state.disabled);
|
|
127
90
|
}
|
|
128
91
|
},
|
|
129
92
|
elementProps
|
|
130
93
|
]
|
|
131
94
|
});
|
|
132
95
|
const contextValue = __rspack_external_react.useMemo(()=>({
|
|
133
|
-
highlightedChipIndex,
|
|
134
|
-
setHighlightedChipIndex,
|
|
135
96
|
chipsRef
|
|
136
|
-
}), [
|
|
137
|
-
highlightedChipIndex,
|
|
138
|
-
setHighlightedChipIndex,
|
|
139
|
-
chipsRef
|
|
140
|
-
]);
|
|
97
|
+
}), []);
|
|
141
98
|
return /*#__PURE__*/ jsx(ComboboxChipsContext.Provider, {
|
|
142
99
|
value: contextValue,
|
|
143
100
|
children: /*#__PURE__*/ jsx(CompositeList, {
|
|
@@ -151,23 +108,21 @@ const ComboboxChipContext = /*#__PURE__*/ __rspack_external_react.createContext(
|
|
|
151
108
|
if ("production" !== process.env.NODE_ENV) ComboboxChipContext.displayName = "ComboboxChipContext";
|
|
152
109
|
function useComboboxChipContext() {
|
|
153
110
|
const context = __rspack_external_react.useContext(ComboboxChipContext);
|
|
154
|
-
if (!context) throw new Error("production" !== process.env.NODE_ENV ? '
|
|
111
|
+
if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ComboboxChipContext is missing. ComboboxChip parts must be placed within <Combobox.Chip>.' : utils_formatErrorMessage(17));
|
|
155
112
|
return context;
|
|
156
113
|
}
|
|
157
114
|
const ComboboxChip_ComboboxChip = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
158
115
|
const { render, className, style, ...elementProps } = componentProps;
|
|
159
116
|
const store = useComboboxRootContext();
|
|
160
|
-
const {
|
|
117
|
+
const { chipsRef } = useComboboxChipsContext();
|
|
161
118
|
const direction = useDirection();
|
|
162
|
-
const disabled =
|
|
163
|
-
const readOnly =
|
|
164
|
-
const selectedValue =
|
|
119
|
+
const disabled = store.useState('disabled');
|
|
120
|
+
const readOnly = store.useState('readOnly');
|
|
121
|
+
const selectedValue = store.useState('selectedValue');
|
|
165
122
|
const { ref, index } = useCompositeListItem();
|
|
166
123
|
function handleKeyDown(event) {
|
|
167
124
|
let nextIndex = index;
|
|
168
|
-
const
|
|
169
|
-
const previousChipKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
|
|
170
|
-
const nextChipKey = isRtl ? 'ArrowLeft' : 'ArrowRight';
|
|
125
|
+
const [previousChipKey, nextChipKey] = getChipNavigationKeys(direction);
|
|
171
126
|
if (event.key === previousChipKey) {
|
|
172
127
|
event.preventDefault();
|
|
173
128
|
nextIndex = index > 0 ? index - 1 : void 0;
|
|
@@ -175,21 +130,25 @@ const ComboboxChip_ComboboxChip = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
175
130
|
event.preventDefault();
|
|
176
131
|
nextIndex = index < chipsRef.current.length - 1 ? index + 1 : void 0;
|
|
177
132
|
} else if ('Backspace' === event.key || 'Delete' === event.key) {
|
|
178
|
-
|
|
179
|
-
nextIndex = computedNextIndex >= 0 ? computedNextIndex : void 0;
|
|
133
|
+
nextIndex = getIndexAfterChipRemoval(index, selectedValue.length);
|
|
180
134
|
stopEvent(event);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
135
|
+
__rspack_external_react_dom_7136dc57.flushSync(()=>{
|
|
136
|
+
store.context.setIndices({
|
|
137
|
+
activeIndex: null,
|
|
138
|
+
selectedIndex: null,
|
|
139
|
+
type: keyboard,
|
|
140
|
+
event: event.nativeEvent
|
|
141
|
+
});
|
|
142
|
+
store.context.setSelectedValue(selectedValue.filter((_, i)=>i !== index), createChangeEventDetails("none", event.nativeEvent));
|
|
185
143
|
});
|
|
186
|
-
store.state.setSelectedValue(selectedValue.filter((_, i)=>i !== index), createChangeEventDetails("none", event.nativeEvent));
|
|
187
144
|
} else if ('Enter' === event.key || ' ' === event.key) {
|
|
188
145
|
stopEvent(event);
|
|
189
146
|
nextIndex = void 0;
|
|
190
147
|
} else if ('ArrowDown' === event.key || 'ArrowUp' === event.key) {
|
|
191
148
|
stopEvent(event);
|
|
192
|
-
|
|
149
|
+
__rspack_external_react_dom_7136dc57.flushSync(()=>{
|
|
150
|
+
store.context.setOpen(true, createChangeEventDetails(listNavigation, event.nativeEvent));
|
|
151
|
+
});
|
|
193
152
|
nextIndex = void 0;
|
|
194
153
|
} else if (1 === event.key.length && !event.ctrlKey && !event.metaKey && !event.altKey) nextIndex = void 0;
|
|
195
154
|
return nextIndex;
|
|
@@ -211,10 +170,7 @@ const ComboboxChip_ComboboxChip = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
211
170
|
onKeyDown (event) {
|
|
212
171
|
if (disabled || readOnly) return;
|
|
213
172
|
const nextIndex = handleKeyDown(event);
|
|
214
|
-
|
|
215
|
-
setHighlightedChipIndex(nextIndex);
|
|
216
|
-
});
|
|
217
|
-
if (void 0 === nextIndex) store.state.inputRef.current?.focus();
|
|
173
|
+
if (void 0 === nextIndex) store.context.inputRef.current?.focus();
|
|
218
174
|
else chipsRef.current[nextIndex]?.focus();
|
|
219
175
|
}
|
|
220
176
|
},
|
|
@@ -236,10 +192,10 @@ const ComboboxChipRemove_ComboboxChipRemove = /*#__PURE__*/ __rspack_external_re
|
|
|
236
192
|
const { render, className, disabled: disabledProp = false, nativeButton = true, style, ...elementProps } = componentProps;
|
|
237
193
|
const store = useComboboxRootContext();
|
|
238
194
|
const { index } = useComboboxChipContext();
|
|
239
|
-
const comboboxDisabled =
|
|
240
|
-
const readOnly =
|
|
241
|
-
const selectedValue =
|
|
242
|
-
const isItemEqualToValue =
|
|
195
|
+
const comboboxDisabled = store.useState('disabled');
|
|
196
|
+
const readOnly = store.useState('readOnly');
|
|
197
|
+
const selectedValue = store.useState('selectedValue');
|
|
198
|
+
const isItemEqualToValue = store.useState('isItemEqualToValue');
|
|
243
199
|
const disabled = comboboxDisabled || disabledProp;
|
|
244
200
|
const { buttonRef, getButtonProps } = useButton({
|
|
245
201
|
native: nativeButton,
|
|
@@ -249,21 +205,22 @@ const ComboboxChipRemove_ComboboxChipRemove = /*#__PURE__*/ __rspack_external_re
|
|
|
249
205
|
const state = {
|
|
250
206
|
disabled
|
|
251
207
|
};
|
|
252
|
-
function clearActiveIndexForRemovedItem(removedItem) {
|
|
208
|
+
function clearActiveIndexForRemovedItem(removedItem, event) {
|
|
253
209
|
const activeIndex = store.state.activeIndex;
|
|
254
210
|
if (null == activeIndex) return;
|
|
255
|
-
const removedIndex = findItemIndex(store.
|
|
256
|
-
if (-1 !== removedIndex && activeIndex === removedIndex) store.
|
|
211
|
+
const removedIndex = findItemIndex(store.context.valuesRef.current, removedItem, isItemEqualToValue);
|
|
212
|
+
if (-1 !== removedIndex && activeIndex === removedIndex) store.context.setIndices({
|
|
257
213
|
activeIndex: null,
|
|
258
|
-
type:
|
|
214
|
+
type: getHighlightReason(event),
|
|
215
|
+
event
|
|
259
216
|
});
|
|
260
217
|
}
|
|
261
218
|
function removeChip(event) {
|
|
262
219
|
const eventDetails = createChangeEventDetails(chipRemovePress, event.nativeEvent);
|
|
263
220
|
const removedItem = selectedValue[index];
|
|
264
|
-
clearActiveIndexForRemovedItem(removedItem);
|
|
265
|
-
store.
|
|
266
|
-
store.
|
|
221
|
+
clearActiveIndexForRemovedItem(removedItem, event.nativeEvent);
|
|
222
|
+
store.context.setSelectedValue(selectedValue.filter((_, i)=>i !== index), eventDetails);
|
|
223
|
+
store.context.inputRef.current?.focus();
|
|
267
224
|
return eventDetails;
|
|
268
225
|
}
|
|
269
226
|
const element = useRenderElement('button', componentProps, {
|
|
@@ -279,12 +236,10 @@ const ComboboxChipRemove_ComboboxChipRemove = /*#__PURE__*/ __rspack_external_re
|
|
|
279
236
|
event.preventDefault();
|
|
280
237
|
},
|
|
281
238
|
onClick (event) {
|
|
282
|
-
if (disabled || readOnly) return;
|
|
283
239
|
const eventDetails = removeChip(event);
|
|
284
240
|
if (!eventDetails.isPropagationAllowed) event.stopPropagation();
|
|
285
241
|
},
|
|
286
242
|
onKeyDown (event) {
|
|
287
|
-
if (disabled || readOnly) return;
|
|
288
243
|
if ('Enter' === event.key || ' ' === event.key) {
|
|
289
244
|
const eventDetails = removeChip(event);
|
|
290
245
|
if (!eventDetails.isPropagationAllowed) stopEvent(event);
|
|
@@ -312,19 +267,20 @@ function ComboboxRoot(props) {
|
|
|
312
267
|
function ComboboxValue(props) {
|
|
313
268
|
const { children: childrenProp, placeholder } = props;
|
|
314
269
|
const store = useComboboxRootContext();
|
|
315
|
-
const itemToStringLabel =
|
|
316
|
-
const selectedValue =
|
|
317
|
-
const items =
|
|
318
|
-
const multiple = 'multiple' ===
|
|
319
|
-
const hasSelectedValue =
|
|
270
|
+
const itemToStringLabel = store.useState('itemToStringLabel');
|
|
271
|
+
const selectedValue = store.useState('selectedValue');
|
|
272
|
+
const items = store.useState('items');
|
|
273
|
+
const multiple = 'multiple' === store.useState('selectionMode');
|
|
274
|
+
const hasSelectedValue = store.useState('hasSelectedValue');
|
|
320
275
|
const shouldCheckNullItemLabel = !hasSelectedValue && null != placeholder && null == childrenProp;
|
|
321
|
-
const hasNullLabel =
|
|
276
|
+
const hasNullLabel = store.useState('hasNullItemLabel', shouldCheckNullItemLabel);
|
|
322
277
|
let children = null;
|
|
323
278
|
children = 'function' == typeof childrenProp ? childrenProp(selectedValue) : null != childrenProp ? childrenProp : hasSelectedValue || null == placeholder || hasNullLabel ? multiple && Array.isArray(selectedValue) ? resolveMultipleLabels(selectedValue, items, itemToStringLabel) : resolveSelectedLabel(selectedValue, items, itemToStringLabel) : placeholder;
|
|
324
279
|
return /*#__PURE__*/ jsx(__rspack_external_react.Fragment, {
|
|
325
280
|
children: children
|
|
326
281
|
});
|
|
327
282
|
}
|
|
283
|
+
const ComboboxSeparator = ListboxSeparator_ListboxSeparator;
|
|
328
284
|
const Label = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxLabel_ComboboxLabel, {
|
|
329
285
|
ref: ref,
|
|
330
286
|
className: className,
|
|
@@ -456,6 +412,6 @@ const Combobox = {
|
|
|
456
412
|
Root: ComboboxRoot,
|
|
457
413
|
Value: ComboboxValue,
|
|
458
414
|
Portal: ComboboxPortal_ComboboxPortal,
|
|
459
|
-
Separator:
|
|
415
|
+
Separator: ComboboxSeparator
|
|
460
416
|
};
|
|
461
417
|
export { Combobox };
|