@wix/site-ui 1.30.0 → 1.31.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/1268.js +99 -0
- package/dist/1279.js +7 -0
- package/dist/1457.js +10 -0
- package/dist/1477.js +106 -0
- package/dist/1500.js +111 -0
- package/dist/167.js +6 -0
- package/dist/2274.js +34 -0
- package/dist/2287.js +17 -0
- package/dist/2418.js +31 -0
- package/dist/2801.js +20 -0
- package/dist/285.js +86 -0
- package/dist/2861.js +6 -0
- package/dist/3020.js +7 -0
- package/dist/3021.js +72 -0
- package/dist/3056.js +229 -0
- package/dist/3140.js +4 -0
- package/dist/3248.js +307 -0
- package/dist/3296.js +4 -0
- package/dist/3319.js +400 -0
- package/dist/3395.js +4 -0
- package/dist/3485.js +854 -0
- package/dist/353.js +14 -0
- package/dist/3670.js +418 -0
- package/dist/3829.js +113 -0
- package/dist/4026.js +12 -0
- package/dist/4143.js +46 -0
- package/dist/42.js +32 -0
- package/dist/4281.js +30 -0
- package/dist/4346.js +2 -0
- package/dist/4388.js +418 -0
- package/dist/4490.js +32 -0
- package/dist/4495.js +9 -0
- package/dist/4549.js +24 -0
- package/dist/4586.js +41 -0
- package/dist/4586.js.LICENSE.txt +19 -0
- package/dist/4707.js +19 -0
- package/dist/4723.js +7 -0
- package/dist/4745.js +7 -0
- package/dist/4768.js +35 -0
- package/dist/4922.js +15 -0
- package/dist/5036.js +17 -0
- package/dist/5085.js +20 -0
- package/dist/5299.js +597 -0
- package/dist/5659.js +4 -0
- package/dist/5778.js +10 -0
- package/dist/5864.js +86 -0
- package/dist/5992.js +913 -0
- package/dist/5992.js.LICENSE.txt +19 -0
- package/dist/6003.js +10 -0
- package/dist/6046.js +29 -0
- package/dist/6089.js +2355 -0
- package/dist/6107.js +10 -0
- package/dist/6247.js +20 -0
- package/dist/6270.js +487 -0
- package/dist/6329.js +32 -0
- package/dist/6330.js +30 -0
- package/dist/6499.js +7 -0
- package/dist/6535.js +71 -0
- package/dist/6588.js +382 -0
- package/dist/6706.js +16 -0
- package/dist/6825.js +7 -0
- package/dist/6882.js +1562 -0
- package/dist/6914.js +30 -0
- package/dist/7021.js +13 -0
- package/dist/7366.js +83 -0
- package/dist/7373.js +25 -0
- package/dist/7541.js +25 -0
- package/dist/7564.js +10 -0
- package/dist/7642.js +20 -0
- package/dist/7725.js +10 -0
- package/dist/7871.js +38 -0
- package/dist/8052.js +352 -0
- package/dist/8106.js +238 -0
- package/dist/8171.js +346 -0
- package/dist/8225.js +21 -0
- package/dist/8272.js +333 -0
- package/dist/8527.js +58 -0
- package/dist/8724.js +10 -0
- package/dist/8750.js +1920 -0
- package/dist/8758.js +43 -0
- package/dist/880.js +149 -0
- package/dist/8935.js +8 -0
- package/dist/8960.js +22 -0
- package/dist/8971.js +40 -0
- package/dist/8979.js +10 -0
- package/dist/8996.js +71 -0
- package/dist/904.js +121 -0
- package/dist/9048.js +52 -0
- package/dist/9087.js +256 -0
- package/dist/9189.js +158 -0
- package/dist/9255.js +136 -0
- package/dist/9352.js +148 -0
- package/dist/951.js +22 -0
- package/dist/9635.js +22 -0
- package/dist/9829.js +4 -0
- package/dist/9863.js +8 -0
- package/dist/Accordion/index.d.ts +569 -12
- package/dist/Accordion/index.js +423 -8
- package/dist/AlertDialog/index.d.ts +1417 -18
- package/dist/AlertDialog/index.js +34 -14
- package/dist/Autocomplete/index.d.ts +1861 -38
- package/dist/Autocomplete/index.js +98 -24
- package/dist/Avatar/index.d.ts +129 -7
- package/dist/Avatar/index.js +149 -6
- package/dist/Breadcrumbs/index.d.ts +960 -7
- package/dist/Breadcrumbs/index.js +5 -5
- package/dist/Button/index.d.ts +88 -6
- package/dist/Button/index.js +27 -3
- package/dist/Checkbox/index.d.ts +425 -5
- package/dist/Checkbox/index.js +45 -5
- package/dist/CheckboxGroup/index.d.ts +318 -3
- package/dist/CheckboxGroup/index.js +166 -3
- package/dist/Collapsible/index.d.ts +377 -7
- package/dist/Collapsible/index.js +160 -6
- package/dist/Combobox/index.d.ts +1984 -48
- package/dist/Combobox/index.js +352 -29
- package/dist/ContextMenu/index.d.ts +2340 -36
- package/dist/ContextMenu/index.js +197 -22
- package/dist/Dialog/index.d.ts +1355 -18
- package/dist/Dialog/index.js +16 -14
- package/dist/Drawer/index.d.ts +1653 -18
- package/dist/Drawer/index.js +2797 -20
- package/dist/Field/index.d.ts +655 -15
- package/dist/Field/index.js +677 -10
- package/dist/Fieldset/index.d.ts +94 -5
- package/dist/Fieldset/index.js +68 -5
- package/dist/Form/index.d.ts +331 -2
- package/dist/Form/index.js +106 -3
- package/dist/Input/index.d.ts +692 -3
- package/dist/Input/index.js +10 -3
- package/dist/Menu/index.d.ts +2301 -36
- package/dist/Menu/index.js +365 -26
- package/dist/Menubar/index.d.ts +2301 -3
- package/dist/Menubar/index.js +105 -3
- package/dist/Meter/index.d.ts +175 -11
- package/dist/Meter/index.js +129 -9
- package/dist/NavigationMenu/index.d.ts +978 -28
- package/dist/NavigationMenu/index.js +1034 -17
- package/dist/NumberField/index.d.ts +612 -15
- package/dist/NumberField/index.js +1409 -11
- package/dist/Popover/index.d.ts +1655 -20
- package/dist/Popover/index.js +792 -17
- package/dist/PreviewCard/index.d.ts +1523 -14
- package/dist/PreviewCard/index.js +679 -14
- package/dist/Progress/index.d.ts +183 -11
- package/dist/Progress/index.js +181 -9
- package/dist/Radio/index.d.ts +185 -6
- package/dist/Radio/index.js +253 -6
- package/dist/RadioGroup/index.d.ts +341 -2
- package/dist/RadioGroup/index.js +154 -3
- package/dist/ScrollArea/index.d.ts +265 -13
- package/dist/ScrollArea/index.js +892 -10
- package/dist/Select/index.d.ts +1493 -38
- package/dist/Select/index.js +1824 -23
- package/dist/Separator/index.d.ts +80 -6
- package/dist/Separator/index.js +3 -3
- package/dist/Slider/index.d.ts +678 -16
- package/dist/Slider/index.js +1199 -11
- package/dist/Switch/index.d.ts +393 -5
- package/dist/Switch/index.js +208 -6
- package/dist/Tabs/index.d.ts +523 -12
- package/dist/Tabs/index.js +685 -9
- package/dist/Toggle/index.d.ts +305 -2
- package/dist/Toggle/index.js +76 -3
- package/dist/ToggleGroup/index.d.ts +316 -2
- package/dist/ToggleGroup/index.js +102 -3
- package/dist/Toolbar/index.d.ts +282 -13
- package/dist/Toolbar/index.js +230 -9
- package/dist/Tooltip/index.d.ts +1572 -14
- package/dist/Tooltip/index.js +965 -14
- package/dist/index.d.ts +12749 -652
- package/dist/rslib-runtime.js +18 -0
- package/package.json +3 -3
package/dist/Combobox/index.js
CHANGED
|
@@ -1,7 +1,330 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Combobox } from "@base-ui/react/combobox";
|
|
3
2
|
import clsx from "clsx";
|
|
3
|
+
import { useFieldRootContext, fieldValidityMapping } from "../1477.js";
|
|
4
|
+
import { selectors, ComboboxArrow_ComboboxArrow, handleInputPress, useComboboxItemContext, AriaCombobox, ComboboxInputGroup_ComboboxInputGroup, ComboboxPositioner_ComboboxPositioner, useComboboxRootContext, useComboboxChipsContext, ComboboxBackdrop_ComboboxBackdrop, ComboboxRow_ComboboxRow, ComboboxIcon_ComboboxIcon, ComboboxClear_ComboboxClear, ComboboxCollection, ComboboxTrigger_ComboboxTrigger, ComboboxGroup_ComboboxGroup, ComboboxGroupLabel_ComboboxGroupLabel, ComboboxStatus_ComboboxStatus, ComboboxPopup_ComboboxPopup, ComboboxInput_ComboboxInput, ComboboxEmpty_ComboboxEmpty, ComboboxPortal_ComboboxPortal, ComboboxChipsContext, ComboboxList_ComboboxList, ComboboxItem_ComboboxItem } from "../6089.js";
|
|
5
|
+
import { useStore } from "../5992.js";
|
|
6
|
+
import { getDefaultLabelId } from "../6825.js";
|
|
7
|
+
import { SafeReact } from "../6499.js";
|
|
8
|
+
import { error } from "../4026.js";
|
|
9
|
+
import { useLabel } from "../4143.js";
|
|
10
|
+
import { esm_formatErrorMessage, useRenderElement, EMPTY_OBJECT } from "../8272.js";
|
|
11
|
+
import { transitionStatusMapping, useOpenChangeComplete, useTransitionStatus } from "../880.js";
|
|
12
|
+
import { CompositeList } from "../9255.js";
|
|
13
|
+
import { useDirection } from "../9863.js";
|
|
14
|
+
import { useCompositeListItem } from "../3021.js";
|
|
15
|
+
import { stopEvent } from "../6330.js";
|
|
16
|
+
import { createChangeEventDetails } from "../4768.js";
|
|
17
|
+
import { listNavigation, chipRemovePress } from "../2418.js";
|
|
18
|
+
import { useButton } from "../9189.js";
|
|
19
|
+
import { resolveSelectedLabel, resolveMultipleLabels, findItemIndex } from "../7366.js";
|
|
20
|
+
import { Separator } from "../9635.js";
|
|
4
21
|
import * as __rspack_external_react from "react";
|
|
22
|
+
import * as __rspack_external_react_dom_7136dc57 from "react-dom";
|
|
23
|
+
const ComboboxLabel_ComboboxLabel = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
24
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
25
|
+
const elementPropsWithoutId = elementProps;
|
|
26
|
+
delete elementPropsWithoutId.id;
|
|
27
|
+
const fieldRootContext = useFieldRootContext();
|
|
28
|
+
const store = useComboboxRootContext();
|
|
29
|
+
const inputInsidePopup = useStore(store, selectors.inputInsidePopup);
|
|
30
|
+
const triggerElement = useStore(store, selectors.triggerElement);
|
|
31
|
+
const inputElement = useStore(store, selectors.inputElement);
|
|
32
|
+
const rootId = useStore(store, selectors.id);
|
|
33
|
+
const defaultLabelId = getDefaultLabelId(rootId);
|
|
34
|
+
const localControlId = triggerElement?.id ?? (inputInsidePopup ? rootId : void 0);
|
|
35
|
+
if ('production' !== process.env.NODE_ENV) __rspack_external_react.useEffect(()=>{
|
|
36
|
+
if (!inputElement || inputInsidePopup) return;
|
|
37
|
+
const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';
|
|
38
|
+
const message = "<Combobox.Label> labels <Combobox.Trigger> only. When <Combobox.Input> is the form control, use a native <label> or <Field.Label> instead.";
|
|
39
|
+
error(`${message}${ownerStackMessage}`);
|
|
40
|
+
}, [
|
|
41
|
+
inputElement,
|
|
42
|
+
inputInsidePopup
|
|
43
|
+
]);
|
|
44
|
+
const labelProps = useLabel({
|
|
45
|
+
id: defaultLabelId,
|
|
46
|
+
fallbackControlId: localControlId,
|
|
47
|
+
setLabelId (nextLabelId) {
|
|
48
|
+
store.set('labelId', nextLabelId);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return useRenderElement('div', componentProps, {
|
|
52
|
+
ref: forwardedRef,
|
|
53
|
+
state: fieldRootContext.state,
|
|
54
|
+
props: [
|
|
55
|
+
labelProps,
|
|
56
|
+
elementProps
|
|
57
|
+
],
|
|
58
|
+
stateAttributesMapping: fieldValidityMapping
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
if ("production" !== process.env.NODE_ENV) ComboboxLabel_ComboboxLabel.displayName = "ComboboxLabel";
|
|
62
|
+
const ComboboxItemIndicator_ComboboxItemIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
63
|
+
const keepMounted = componentProps.keepMounted ?? false;
|
|
64
|
+
const { selected } = useComboboxItemContext();
|
|
65
|
+
const shouldRender = keepMounted || selected;
|
|
66
|
+
if (!shouldRender) return null;
|
|
67
|
+
return /*#__PURE__*/ jsx(Inner, {
|
|
68
|
+
...componentProps,
|
|
69
|
+
ref: forwardedRef
|
|
70
|
+
});
|
|
71
|
+
});
|
|
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
|
+
const ComboboxChips_ComboboxChips = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
108
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
109
|
+
const store = useComboboxRootContext();
|
|
110
|
+
const open = useStore(store, selectors.open);
|
|
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);
|
|
114
|
+
const chipsRef = __rspack_external_react.useRef([]);
|
|
115
|
+
const element = useRenderElement('div', componentProps, {
|
|
116
|
+
ref: [
|
|
117
|
+
forwardedRef,
|
|
118
|
+
store.state.chipsContainerRef
|
|
119
|
+
],
|
|
120
|
+
props: [
|
|
121
|
+
hasSelectionChips ? {
|
|
122
|
+
role: 'toolbar'
|
|
123
|
+
} : EMPTY_OBJECT,
|
|
124
|
+
{
|
|
125
|
+
onMouseDown (event) {
|
|
126
|
+
handleInputPress(event, store, store.state.disabled, store.state.readOnly);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
elementProps
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
const contextValue = __rspack_external_react.useMemo(()=>({
|
|
133
|
+
highlightedChipIndex,
|
|
134
|
+
setHighlightedChipIndex,
|
|
135
|
+
chipsRef
|
|
136
|
+
}), [
|
|
137
|
+
highlightedChipIndex,
|
|
138
|
+
setHighlightedChipIndex,
|
|
139
|
+
chipsRef
|
|
140
|
+
]);
|
|
141
|
+
return /*#__PURE__*/ jsx(ComboboxChipsContext.Provider, {
|
|
142
|
+
value: contextValue,
|
|
143
|
+
children: /*#__PURE__*/ jsx(CompositeList, {
|
|
144
|
+
elementsRef: chipsRef,
|
|
145
|
+
children: element
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
if ("production" !== process.env.NODE_ENV) ComboboxChips_ComboboxChips.displayName = "ComboboxChips";
|
|
150
|
+
const ComboboxChipContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
151
|
+
if ("production" !== process.env.NODE_ENV) ComboboxChipContext.displayName = "ComboboxChipContext";
|
|
152
|
+
function useComboboxChipContext() {
|
|
153
|
+
const context = __rspack_external_react.useContext(ComboboxChipContext);
|
|
154
|
+
if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'useComboboxChipContext must be used within a ComboboxChip' : esm_formatErrorMessage(17));
|
|
155
|
+
return context;
|
|
156
|
+
}
|
|
157
|
+
const ComboboxChip_ComboboxChip = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
158
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
159
|
+
const store = useComboboxRootContext();
|
|
160
|
+
const { setHighlightedChipIndex, chipsRef } = useComboboxChipsContext();
|
|
161
|
+
const direction = useDirection();
|
|
162
|
+
const disabled = useStore(store, selectors.disabled);
|
|
163
|
+
const readOnly = useStore(store, selectors.readOnly);
|
|
164
|
+
const selectedValue = useStore(store, selectors.selectedValue);
|
|
165
|
+
const { ref, index } = useCompositeListItem();
|
|
166
|
+
function handleKeyDown(event) {
|
|
167
|
+
let nextIndex = index;
|
|
168
|
+
const isRtl = 'rtl' === direction;
|
|
169
|
+
const previousChipKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
|
|
170
|
+
const nextChipKey = isRtl ? 'ArrowLeft' : 'ArrowRight';
|
|
171
|
+
if (event.key === previousChipKey) {
|
|
172
|
+
event.preventDefault();
|
|
173
|
+
nextIndex = index > 0 ? index - 1 : void 0;
|
|
174
|
+
} else if (event.key === nextChipKey) {
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
nextIndex = index < chipsRef.current.length - 1 ? index + 1 : void 0;
|
|
177
|
+
} else if ('Backspace' === event.key || 'Delete' === event.key) {
|
|
178
|
+
const computedNextIndex = index >= selectedValue.length - 1 ? selectedValue.length - 2 : index;
|
|
179
|
+
nextIndex = computedNextIndex >= 0 ? computedNextIndex : void 0;
|
|
180
|
+
stopEvent(event);
|
|
181
|
+
store.state.setIndices({
|
|
182
|
+
activeIndex: null,
|
|
183
|
+
selectedIndex: null,
|
|
184
|
+
type: 'keyboard'
|
|
185
|
+
});
|
|
186
|
+
store.state.setSelectedValue(selectedValue.filter((_, i)=>i !== index), createChangeEventDetails("none", event.nativeEvent));
|
|
187
|
+
} else if ('Enter' === event.key || ' ' === event.key) {
|
|
188
|
+
stopEvent(event);
|
|
189
|
+
nextIndex = void 0;
|
|
190
|
+
} else if ('ArrowDown' === event.key || 'ArrowUp' === event.key) {
|
|
191
|
+
stopEvent(event);
|
|
192
|
+
store.state.setOpen(true, createChangeEventDetails(listNavigation, event.nativeEvent));
|
|
193
|
+
nextIndex = void 0;
|
|
194
|
+
} else if (1 === event.key.length && !event.ctrlKey && !event.metaKey && !event.altKey) nextIndex = void 0;
|
|
195
|
+
return nextIndex;
|
|
196
|
+
}
|
|
197
|
+
const state = {
|
|
198
|
+
disabled
|
|
199
|
+
};
|
|
200
|
+
const element = useRenderElement('div', componentProps, {
|
|
201
|
+
ref: [
|
|
202
|
+
forwardedRef,
|
|
203
|
+
ref
|
|
204
|
+
],
|
|
205
|
+
state,
|
|
206
|
+
props: [
|
|
207
|
+
{
|
|
208
|
+
tabIndex: -1,
|
|
209
|
+
'aria-disabled': disabled || void 0,
|
|
210
|
+
'aria-readonly': readOnly || void 0,
|
|
211
|
+
onKeyDown (event) {
|
|
212
|
+
if (disabled || readOnly) return;
|
|
213
|
+
const nextIndex = handleKeyDown(event);
|
|
214
|
+
__rspack_external_react_dom_7136dc57.flushSync(()=>{
|
|
215
|
+
setHighlightedChipIndex(nextIndex);
|
|
216
|
+
});
|
|
217
|
+
if (void 0 === nextIndex) store.state.inputRef.current?.focus();
|
|
218
|
+
else chipsRef.current[nextIndex]?.focus();
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
elementProps
|
|
222
|
+
]
|
|
223
|
+
});
|
|
224
|
+
const contextValue = __rspack_external_react.useMemo(()=>({
|
|
225
|
+
index
|
|
226
|
+
}), [
|
|
227
|
+
index
|
|
228
|
+
]);
|
|
229
|
+
return /*#__PURE__*/ jsx(ComboboxChipContext.Provider, {
|
|
230
|
+
value: contextValue,
|
|
231
|
+
children: element
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
if ("production" !== process.env.NODE_ENV) ComboboxChip_ComboboxChip.displayName = "ComboboxChip";
|
|
235
|
+
const ComboboxChipRemove_ComboboxChipRemove = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
236
|
+
const { render, className, disabled: disabledProp = false, nativeButton = true, style, ...elementProps } = componentProps;
|
|
237
|
+
const store = useComboboxRootContext();
|
|
238
|
+
const { index } = useComboboxChipContext();
|
|
239
|
+
const comboboxDisabled = useStore(store, selectors.disabled);
|
|
240
|
+
const readOnly = useStore(store, selectors.readOnly);
|
|
241
|
+
const selectedValue = useStore(store, selectors.selectedValue);
|
|
242
|
+
const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);
|
|
243
|
+
const disabled = comboboxDisabled || disabledProp;
|
|
244
|
+
const { buttonRef, getButtonProps } = useButton({
|
|
245
|
+
native: nativeButton,
|
|
246
|
+
disabled: disabled || readOnly,
|
|
247
|
+
focusableWhenDisabled: true
|
|
248
|
+
});
|
|
249
|
+
const state = {
|
|
250
|
+
disabled
|
|
251
|
+
};
|
|
252
|
+
function clearActiveIndexForRemovedItem(removedItem) {
|
|
253
|
+
const activeIndex = store.state.activeIndex;
|
|
254
|
+
if (null == activeIndex) return;
|
|
255
|
+
const removedIndex = findItemIndex(store.state.valuesRef.current, removedItem, isItemEqualToValue);
|
|
256
|
+
if (-1 !== removedIndex && activeIndex === removedIndex) store.state.setIndices({
|
|
257
|
+
activeIndex: null,
|
|
258
|
+
type: store.state.keyboardActiveRef.current ? 'keyboard' : 'pointer'
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
function removeChip(event) {
|
|
262
|
+
const eventDetails = createChangeEventDetails(chipRemovePress, event.nativeEvent);
|
|
263
|
+
const removedItem = selectedValue[index];
|
|
264
|
+
clearActiveIndexForRemovedItem(removedItem);
|
|
265
|
+
store.state.setSelectedValue(selectedValue.filter((_, i)=>i !== index), eventDetails);
|
|
266
|
+
store.state.inputRef.current?.focus();
|
|
267
|
+
return eventDetails;
|
|
268
|
+
}
|
|
269
|
+
const element = useRenderElement('button', componentProps, {
|
|
270
|
+
ref: [
|
|
271
|
+
forwardedRef,
|
|
272
|
+
buttonRef
|
|
273
|
+
],
|
|
274
|
+
state,
|
|
275
|
+
props: [
|
|
276
|
+
{
|
|
277
|
+
tabIndex: -1,
|
|
278
|
+
onMouseDown (event) {
|
|
279
|
+
event.preventDefault();
|
|
280
|
+
},
|
|
281
|
+
onClick (event) {
|
|
282
|
+
if (disabled || readOnly) return;
|
|
283
|
+
const eventDetails = removeChip(event);
|
|
284
|
+
if (!eventDetails.isPropagationAllowed) event.stopPropagation();
|
|
285
|
+
},
|
|
286
|
+
onKeyDown (event) {
|
|
287
|
+
if (disabled || readOnly) return;
|
|
288
|
+
if ('Enter' === event.key || ' ' === event.key) {
|
|
289
|
+
const eventDetails = removeChip(event);
|
|
290
|
+
if (!eventDetails.isPropagationAllowed) stopEvent(event);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
elementProps,
|
|
295
|
+
getButtonProps
|
|
296
|
+
]
|
|
297
|
+
});
|
|
298
|
+
return element;
|
|
299
|
+
});
|
|
300
|
+
if ("production" !== process.env.NODE_ENV) ComboboxChipRemove_ComboboxChipRemove.displayName = "ComboboxChipRemove";
|
|
301
|
+
function ComboboxRoot(props) {
|
|
302
|
+
const { multiple = false, defaultValue, value, onValueChange, autoComplete, ...other } = props;
|
|
303
|
+
return /*#__PURE__*/ jsx(AriaCombobox, {
|
|
304
|
+
...other,
|
|
305
|
+
selectionMode: multiple ? 'multiple' : 'single',
|
|
306
|
+
selectedValue: value,
|
|
307
|
+
defaultSelectedValue: defaultValue,
|
|
308
|
+
onSelectedValueChange: onValueChange,
|
|
309
|
+
formAutoComplete: autoComplete
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function ComboboxValue(props) {
|
|
313
|
+
const { children: childrenProp, placeholder } = props;
|
|
314
|
+
const store = useComboboxRootContext();
|
|
315
|
+
const itemToStringLabel = useStore(store, selectors.itemToStringLabel);
|
|
316
|
+
const selectedValue = useStore(store, selectors.selectedValue);
|
|
317
|
+
const items = useStore(store, selectors.items);
|
|
318
|
+
const multiple = 'multiple' === useStore(store, selectors.selectionMode);
|
|
319
|
+
const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
|
|
320
|
+
const shouldCheckNullItemLabel = !hasSelectedValue && null != placeholder && null == childrenProp;
|
|
321
|
+
const hasNullLabel = useStore(store, selectors.hasNullItemLabel, shouldCheckNullItemLabel);
|
|
322
|
+
let children = null;
|
|
323
|
+
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
|
+
return /*#__PURE__*/ jsx(__rspack_external_react.Fragment, {
|
|
325
|
+
children: children
|
|
326
|
+
});
|
|
327
|
+
}
|
|
5
328
|
const Combobox_module = {
|
|
6
329
|
label: "label-AxhKN1",
|
|
7
330
|
inputGroup: "inputGroup-j4QBzY",
|
|
@@ -21,112 +344,112 @@ const Combobox_module = {
|
|
|
21
344
|
empty: "empty-ypPHaj",
|
|
22
345
|
clear: "clear-UgLOma"
|
|
23
346
|
};
|
|
24
|
-
const Label = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
347
|
+
const Label = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxLabel_ComboboxLabel, {
|
|
25
348
|
ref: ref,
|
|
26
349
|
className: clsx(Combobox_module.label, className),
|
|
27
350
|
...props
|
|
28
351
|
}));
|
|
29
|
-
const Input = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
352
|
+
const Input = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxInput_ComboboxInput, {
|
|
30
353
|
ref: ref,
|
|
31
354
|
className: clsx(Combobox_module.input, className),
|
|
32
355
|
...props
|
|
33
356
|
}));
|
|
34
|
-
const InputGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
357
|
+
const InputGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxInputGroup_ComboboxInputGroup, {
|
|
35
358
|
ref: ref,
|
|
36
359
|
className: clsx(Combobox_module.inputGroup, className),
|
|
37
360
|
...props
|
|
38
361
|
}));
|
|
39
|
-
const Trigger = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
362
|
+
const Trigger = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxTrigger_ComboboxTrigger, {
|
|
40
363
|
ref: ref,
|
|
41
364
|
className: clsx(Combobox_module.trigger, className),
|
|
42
365
|
...props
|
|
43
366
|
}));
|
|
44
|
-
const List = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
367
|
+
const List = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxList_ComboboxList, {
|
|
45
368
|
ref: ref,
|
|
46
369
|
className: clsx(Combobox_module.list, className),
|
|
47
370
|
...props
|
|
48
371
|
}));
|
|
49
|
-
const Status = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
372
|
+
const Status = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxStatus_ComboboxStatus, {
|
|
50
373
|
ref: ref,
|
|
51
374
|
className: clsx(Combobox_module.status, className),
|
|
52
375
|
...props
|
|
53
376
|
}));
|
|
54
|
-
const Backdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
377
|
+
const Backdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxBackdrop_ComboboxBackdrop, {
|
|
55
378
|
ref: ref,
|
|
56
379
|
className: clsx(Combobox_module.backdrop, className),
|
|
57
380
|
...props
|
|
58
381
|
}));
|
|
59
|
-
const Positioner = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
382
|
+
const Positioner = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxPositioner_ComboboxPositioner, {
|
|
60
383
|
ref: ref,
|
|
61
384
|
className: clsx(Combobox_module.positioner, className),
|
|
62
385
|
...props
|
|
63
386
|
}));
|
|
64
|
-
const Popup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
387
|
+
const Popup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxPopup_ComboboxPopup, {
|
|
65
388
|
ref: ref,
|
|
66
389
|
className: clsx(Combobox_module.popup, className),
|
|
67
390
|
...props
|
|
68
391
|
}));
|
|
69
|
-
const Arrow = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
392
|
+
const Arrow = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxArrow_ComboboxArrow, {
|
|
70
393
|
ref: ref,
|
|
71
394
|
className: clsx(Combobox_module.arrow, className),
|
|
72
395
|
...props
|
|
73
396
|
}));
|
|
74
|
-
const Icon = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
397
|
+
const Icon = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxIcon_ComboboxIcon, {
|
|
75
398
|
ref: ref,
|
|
76
399
|
className: clsx(Combobox_module.icon, className),
|
|
77
400
|
...props
|
|
78
401
|
}));
|
|
79
|
-
const Group = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
402
|
+
const Group = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxGroup_ComboboxGroup, {
|
|
80
403
|
ref: ref,
|
|
81
404
|
className: clsx(Combobox_module.group, className),
|
|
82
405
|
...props
|
|
83
406
|
}));
|
|
84
|
-
const GroupLabel = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
407
|
+
const GroupLabel = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxGroupLabel_ComboboxGroupLabel, {
|
|
85
408
|
ref: ref,
|
|
86
409
|
className: clsx(Combobox_module.groupLabel, className),
|
|
87
410
|
...props
|
|
88
411
|
}));
|
|
89
|
-
const Item = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
412
|
+
const Item = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxItem_ComboboxItem, {
|
|
90
413
|
ref: ref,
|
|
91
414
|
className: clsx(Combobox_module.item, className),
|
|
92
415
|
...props
|
|
93
416
|
}));
|
|
94
|
-
const ItemIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
417
|
+
const ItemIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxItemIndicator_ComboboxItemIndicator, {
|
|
95
418
|
ref: ref,
|
|
96
419
|
className: clsx(Combobox_module.itemIndicator, className),
|
|
97
420
|
...props
|
|
98
421
|
}));
|
|
99
|
-
const Chips = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
422
|
+
const Chips = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxChips_ComboboxChips, {
|
|
100
423
|
ref: ref,
|
|
101
424
|
className: clsx(Combobox_module.chips, className),
|
|
102
425
|
...props
|
|
103
426
|
}));
|
|
104
|
-
const Chip = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
427
|
+
const Chip = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxChip_ComboboxChip, {
|
|
105
428
|
ref: ref,
|
|
106
429
|
className: clsx(Combobox_module.chip, className),
|
|
107
430
|
...props
|
|
108
431
|
}));
|
|
109
|
-
const ChipRemove = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
432
|
+
const ChipRemove = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxChipRemove_ComboboxChipRemove, {
|
|
110
433
|
ref: ref,
|
|
111
434
|
className: clsx(Combobox_module.chipRemove, className),
|
|
112
435
|
...props
|
|
113
436
|
}));
|
|
114
|
-
const Row = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
437
|
+
const Row = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxRow_ComboboxRow, {
|
|
115
438
|
ref: ref,
|
|
116
439
|
className: clsx(Combobox_module.row, className),
|
|
117
440
|
...props
|
|
118
441
|
}));
|
|
119
|
-
const Empty = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
442
|
+
const Empty = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxEmpty_ComboboxEmpty, {
|
|
120
443
|
ref: ref,
|
|
121
444
|
className: clsx(Combobox_module.empty, className),
|
|
122
445
|
...props
|
|
123
446
|
}));
|
|
124
|
-
const Clear = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
447
|
+
const Clear = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ComboboxClear_ComboboxClear, {
|
|
125
448
|
ref: ref,
|
|
126
449
|
className: clsx(Combobox_module.clear, className),
|
|
127
450
|
...props
|
|
128
451
|
}));
|
|
129
|
-
const
|
|
452
|
+
const Combobox = {
|
|
130
453
|
Label: Label,
|
|
131
454
|
Input: Input,
|
|
132
455
|
InputGroup: InputGroup,
|
|
@@ -146,12 +469,12 @@ const Combobox_Combobox = {
|
|
|
146
469
|
Chip: Chip,
|
|
147
470
|
ChipRemove: ChipRemove,
|
|
148
471
|
Row: Row,
|
|
149
|
-
Collection:
|
|
472
|
+
Collection: ComboboxCollection,
|
|
150
473
|
Empty: Empty,
|
|
151
474
|
Clear: Clear,
|
|
152
|
-
Root:
|
|
153
|
-
Value:
|
|
154
|
-
Portal:
|
|
155
|
-
Separator:
|
|
475
|
+
Root: ComboboxRoot,
|
|
476
|
+
Value: ComboboxValue,
|
|
477
|
+
Portal: ComboboxPortal_ComboboxPortal,
|
|
478
|
+
Separator: Separator
|
|
156
479
|
};
|
|
157
|
-
export {
|
|
480
|
+
export { Combobox };
|