@commercetools/nimbus 0.0.0-canary-20251010175720 → 0.0.0-canary-20251013071647
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/chunks/{localized-field-CV69UdIU.es.js → localized-field-COJ9aoma.es.js} +2 -2
- package/dist/chunks/{localized-field-CV69UdIU.es.js.map → localized-field-COJ9aoma.es.js.map} +1 -1
- package/dist/chunks/{localized-field-BqUMaU2Z.cjs.js → localized-field-DCgNEoJc.cjs.js} +2 -2
- package/dist/chunks/{localized-field-BqUMaU2Z.cjs.js.map → localized-field-DCgNEoJc.cjs.js.map} +1 -1
- package/dist/chunks/{money-input-BklJuHw0.cjs.js → money-input-CwrbJsn1.cjs.js} +2 -2
- package/dist/chunks/{money-input-BklJuHw0.cjs.js.map → money-input-CwrbJsn1.cjs.js.map} +1 -1
- package/dist/chunks/{money-input-CavdTx-o.es.js → money-input-DvR9Nnz5.es.js} +2 -2
- package/dist/chunks/{money-input-CavdTx-o.es.js.map → money-input-DvR9Nnz5.es.js.map} +1 -1
- package/dist/chunks/{pagination-CBrMi7gy.es.js → pagination-2Zl9bHfw.es.js} +2 -2
- package/dist/chunks/{pagination-CBrMi7gy.es.js.map → pagination-2Zl9bHfw.es.js.map} +1 -1
- package/dist/chunks/{pagination-DUCo0L7g.cjs.js → pagination-EVJ_rBrc.cjs.js} +2 -2
- package/dist/chunks/{pagination-DUCo0L7g.cjs.js.map → pagination-EVJ_rBrc.cjs.js.map} +1 -1
- package/dist/chunks/select-97-5UUPX.cjs.js +2 -0
- package/dist/chunks/{select-D_HPNSo0.cjs.js.map → select-97-5UUPX.cjs.js.map} +1 -1
- package/dist/chunks/select-D5QaNAMe.es.js +775 -0
- package/dist/chunks/{select-CWttUH5b.es.js.map → select-D5QaNAMe.es.js.map} +1 -1
- package/dist/components/localized-field.cjs +1 -1
- package/dist/components/localized-field.es.js +1 -1
- package/dist/components/money-input.cjs +1 -1
- package/dist/components/money-input.es.js +1 -1
- package/dist/components/pagination.cjs +1 -1
- package/dist/components/pagination.es.js +1 -1
- package/dist/components/scoped-search-input.cjs +1 -1
- package/dist/components/scoped-search-input.es.js +1 -1
- package/dist/components/select.cjs +1 -1
- package/dist/components/select.es.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.es.js +4 -4
- package/dist/select.d.ts +110 -7
- package/package.json +5 -5
- package/dist/chunks/select-CWttUH5b.es.js +0 -690
- package/dist/chunks/select-D_HPNSo0.cjs.js +0 -2
|
@@ -0,0 +1,775 @@
|
|
|
1
|
+
import { jsx as b, jsxs as B } from "react/jsx-runtime";
|
|
2
|
+
import S, { useMemo as R, useRef as E, useCallback as X, useState as O, forwardRef as de, createContext as N, useContext as J, Fragment as ce } from "react";
|
|
3
|
+
import { createSlotRecipeContext as ue, useSlotRecipe as fe, chakra as Q } from "@chakra-ui/react/styled-system";
|
|
4
|
+
import { mergeRefs as be } from "@chakra-ui/react";
|
|
5
|
+
import { Close as $e, Loop as me, KeyboardArrowDown as pe } from "@commercetools/nimbus-icons";
|
|
6
|
+
import { $ as Y, a as ve } from "./Button-DbDspzBf.es.js";
|
|
7
|
+
import { q as ye, d as ge, i as he, r as xe, g as Pe } from "./Dialog-FtshtbuD.es.js";
|
|
8
|
+
import { $ as Z, e as _, a as ee, b as Se, g as Ce, d as Re } from "./utils-Cyja2WdR.es.js";
|
|
9
|
+
import { $ as De } from "./FieldError-CXcEMuBf.es.js";
|
|
10
|
+
import { $ as Ie } from "./Form-CXcEMuBf.es.js";
|
|
11
|
+
import { $ as Fe } from "./intlStrings-Cd44R5hT.es.js";
|
|
12
|
+
import { $ as te } from "./Label-qcXzazih.es.js";
|
|
13
|
+
import { $ as Me, a as Ke, b as Ve, c as Be, d as Ee } from "./ListBox-CA_ARARw.es.js";
|
|
14
|
+
import { $ as G } from "./Text-DOcU1ycg.es.js";
|
|
15
|
+
import { f as we, g as Oe } from "./CollectionBuilder-Wz-mnWjQ.es.js";
|
|
16
|
+
import { $ as ke } from "./Hidden-j3Lbt7xL.es.js";
|
|
17
|
+
import { a as z, $ as qe, e as Ae } from "./mergeProps-CzyOU2NE.es.js";
|
|
18
|
+
import { $ as L } from "./filterDOMProps-BSVCO5jK.es.js";
|
|
19
|
+
import { $ as Te, c as ze } from "./OverlayArrow-CwYMJqgj.es.js";
|
|
20
|
+
import { $ as Ne } from "./context-R4YUlO9Y.es.js";
|
|
21
|
+
import { $ as Ge } from "./useLocalizedStringFormatter-BRnRyxJp.es.js";
|
|
22
|
+
import { a as Le, $ as je } from "./useFormValidation-DR5NgZ9j.es.js";
|
|
23
|
+
import { $ as We } from "./useListState-wotFHS2D.es.js";
|
|
24
|
+
import { $ as He } from "./useControlledState-u436Wbp1.es.js";
|
|
25
|
+
import { $ as Ue } from "./useFocusRing-DRIG5NVg.es.js";
|
|
26
|
+
import { $ as Xe } from "./ListKeyboardDelegate-XLAitX9C.es.js";
|
|
27
|
+
import { j as Je } from "./SelectionManager-C9i8k50b.es.js";
|
|
28
|
+
import { c as Qe } from "./useFocusVisible-BIPjFmFE.es.js";
|
|
29
|
+
import { $ as Ye } from "./useCollator-BHMZd1r6.es.js";
|
|
30
|
+
import { $ as Ze } from "./useField-B0j4t47V.es.js";
|
|
31
|
+
import { $ as _e } from "./useFormReset-D_wskGk5.es.js";
|
|
32
|
+
import { a as et } from "./VisuallyHidden-Dxf1qswV.es.js";
|
|
33
|
+
import { o as le } from "./index-DthLdwMN.es.js";
|
|
34
|
+
import { defineMessages as tt, useIntl as lt } from "react-intl";
|
|
35
|
+
import { I as at } from "./icon-button-D4w1XTVg.es.js";
|
|
36
|
+
import { e as k } from "./extractStyleProps-CNXOLneR.es.js";
|
|
37
|
+
import { $ as rt } from "./useObjectRef-CaJ5pgjX.es.js";
|
|
38
|
+
import { Flex as T } from "@chakra-ui/react/flex";
|
|
39
|
+
import { B as U } from "./box-DuBoAZvq.es.js";
|
|
40
|
+
import { c as ot } from "./Header-_Z7cZ9Ql.es.js";
|
|
41
|
+
function it(e = {}) {
|
|
42
|
+
let { locale: t } = Ne();
|
|
43
|
+
return R(() => new Intl.ListFormat(t, e), [
|
|
44
|
+
t,
|
|
45
|
+
e
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
const j = /* @__PURE__ */ new WeakMap();
|
|
49
|
+
function nt(e, t, a) {
|
|
50
|
+
let { keyboardDelegate: o, isDisabled: l, isRequired: $, name: m, form: r, validationBehavior: s = "aria" } = e, u = Ye({
|
|
51
|
+
usage: "search",
|
|
52
|
+
sensitivity: "base"
|
|
53
|
+
}), i = R(() => o || new Xe(t.collection, t.disabledKeys, a, u), [
|
|
54
|
+
o,
|
|
55
|
+
t.collection,
|
|
56
|
+
t.disabledKeys,
|
|
57
|
+
u,
|
|
58
|
+
a
|
|
59
|
+
]), { menuTriggerProps: d, menuProps: p } = ye({
|
|
60
|
+
isDisabled: l,
|
|
61
|
+
type: "listbox"
|
|
62
|
+
}, t, a), v = (y) => {
|
|
63
|
+
if (t.selectionManager.selectionMode !== "multiple")
|
|
64
|
+
switch (y.key) {
|
|
65
|
+
case "ArrowLeft": {
|
|
66
|
+
var F, M;
|
|
67
|
+
y.preventDefault();
|
|
68
|
+
let V = t.selectedKey != null ? (F = i.getKeyAbove) === null || F === void 0 ? void 0 : F.call(i, t.selectedKey) : (M = i.getFirstKey) === null || M === void 0 ? void 0 : M.call(i);
|
|
69
|
+
V && t.setSelectedKey(V);
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
case "ArrowRight": {
|
|
73
|
+
var q, A;
|
|
74
|
+
y.preventDefault();
|
|
75
|
+
let V = t.selectedKey != null ? (q = i.getKeyBelow) === null || q === void 0 ? void 0 : q.call(i, t.selectedKey) : (A = i.getFirstKey) === null || A === void 0 ? void 0 : A.call(i);
|
|
76
|
+
V && t.setSelectedKey(V);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, { typeSelectProps: c } = Je({
|
|
81
|
+
keyboardDelegate: i,
|
|
82
|
+
selectionManager: t.selectionManager,
|
|
83
|
+
onTypeSelect(y) {
|
|
84
|
+
t.setSelectedKey(y);
|
|
85
|
+
}
|
|
86
|
+
}), { isInvalid: x, validationErrors: C, validationDetails: f } = t.displayValidation, { labelProps: g, fieldProps: P, descriptionProps: n, errorMessageProps: D } = Ze({
|
|
87
|
+
...e,
|
|
88
|
+
labelElementType: "span",
|
|
89
|
+
isInvalid: x,
|
|
90
|
+
errorMessage: e.errorMessage || C
|
|
91
|
+
});
|
|
92
|
+
c.onKeyDown = c.onKeyDownCapture, delete c.onKeyDownCapture, t.selectionManager.selectionMode === "multiple" && (c = {});
|
|
93
|
+
let I = L(e, {
|
|
94
|
+
labelable: !0
|
|
95
|
+
}), h = z(c, d, P), w = qe();
|
|
96
|
+
return j.set(t, {
|
|
97
|
+
isDisabled: l,
|
|
98
|
+
isRequired: $,
|
|
99
|
+
name: m,
|
|
100
|
+
form: r,
|
|
101
|
+
validationBehavior: s
|
|
102
|
+
}), {
|
|
103
|
+
labelProps: {
|
|
104
|
+
...g,
|
|
105
|
+
onClick: () => {
|
|
106
|
+
if (!e.isDisabled) {
|
|
107
|
+
var y;
|
|
108
|
+
(y = a.current) === null || y === void 0 || y.focus(), Qe("keyboard");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
triggerProps: z(I, {
|
|
113
|
+
...h,
|
|
114
|
+
isDisabled: l,
|
|
115
|
+
onKeyDown: Ae(h.onKeyDown, v, e.onKeyDown),
|
|
116
|
+
onKeyUp: e.onKeyUp,
|
|
117
|
+
"aria-labelledby": [
|
|
118
|
+
w,
|
|
119
|
+
h["aria-labelledby"],
|
|
120
|
+
h["aria-label"] && !h["aria-labelledby"] ? h.id : null
|
|
121
|
+
].filter(Boolean).join(" "),
|
|
122
|
+
onFocus(y) {
|
|
123
|
+
t.isFocused || (e.onFocus && e.onFocus(y), e.onFocusChange && e.onFocusChange(!0), t.setFocused(!0));
|
|
124
|
+
},
|
|
125
|
+
onBlur(y) {
|
|
126
|
+
t.isOpen || (e.onBlur && e.onBlur(y), e.onFocusChange && e.onFocusChange(!1), t.setFocused(!1));
|
|
127
|
+
}
|
|
128
|
+
}),
|
|
129
|
+
valueProps: {
|
|
130
|
+
id: w
|
|
131
|
+
},
|
|
132
|
+
menuProps: {
|
|
133
|
+
...p,
|
|
134
|
+
autoFocus: t.focusStrategy || !0,
|
|
135
|
+
shouldSelectOnPressUp: !0,
|
|
136
|
+
shouldFocusOnHover: !0,
|
|
137
|
+
disallowEmptySelection: !0,
|
|
138
|
+
linkBehavior: "selection",
|
|
139
|
+
onBlur: (y) => {
|
|
140
|
+
y.currentTarget.contains(y.relatedTarget) || (e.onBlur && e.onBlur(y), e.onFocusChange && e.onFocusChange(!1), t.setFocused(!1));
|
|
141
|
+
},
|
|
142
|
+
"aria-labelledby": [
|
|
143
|
+
P["aria-labelledby"],
|
|
144
|
+
h["aria-label"] && !P["aria-labelledby"] ? h.id : null
|
|
145
|
+
].filter(Boolean).join(" ")
|
|
146
|
+
},
|
|
147
|
+
descriptionProps: n,
|
|
148
|
+
errorMessageProps: D,
|
|
149
|
+
isInvalid: x,
|
|
150
|
+
validationErrors: C,
|
|
151
|
+
validationDetails: f,
|
|
152
|
+
hiddenSelectProps: {
|
|
153
|
+
isDisabled: l,
|
|
154
|
+
name: m,
|
|
155
|
+
label: e.label,
|
|
156
|
+
state: t,
|
|
157
|
+
triggerRef: a,
|
|
158
|
+
form: r
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function st(e, t, a) {
|
|
163
|
+
let o = j.get(t) || {}, { autoComplete: l, name: $ = o.name, form: m = o.form, isDisabled: r = o.isDisabled } = e, { validationBehavior: s, isRequired: u } = o, { visuallyHiddenProps: i } = et({
|
|
164
|
+
style: {
|
|
165
|
+
// Prevent page scrolling.
|
|
166
|
+
position: "fixed",
|
|
167
|
+
top: 0,
|
|
168
|
+
left: 0
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
_e(e.selectRef, t.defaultValue, t.setValue), Le({
|
|
172
|
+
validationBehavior: s,
|
|
173
|
+
focus: () => {
|
|
174
|
+
var c;
|
|
175
|
+
return (c = a.current) === null || c === void 0 ? void 0 : c.focus();
|
|
176
|
+
}
|
|
177
|
+
}, t, e.selectRef);
|
|
178
|
+
let d = t.setValue, p = X((c) => {
|
|
179
|
+
c.target.multiple ? d(Array.from(c.target.selectedOptions, (x) => x.value)) : d(c.currentTarget.value);
|
|
180
|
+
}, [
|
|
181
|
+
d
|
|
182
|
+
]);
|
|
183
|
+
var v;
|
|
184
|
+
return {
|
|
185
|
+
containerProps: {
|
|
186
|
+
...i,
|
|
187
|
+
"aria-hidden": !0,
|
|
188
|
+
// @ts-ignore
|
|
189
|
+
"data-react-aria-prevent-focus": !0,
|
|
190
|
+
// @ts-ignore
|
|
191
|
+
"data-a11y-ignore": "aria-hidden-focus"
|
|
192
|
+
},
|
|
193
|
+
inputProps: {
|
|
194
|
+
style: {
|
|
195
|
+
display: "none"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
selectProps: {
|
|
199
|
+
tabIndex: -1,
|
|
200
|
+
autoComplete: l,
|
|
201
|
+
disabled: r,
|
|
202
|
+
multiple: t.selectionManager.selectionMode === "multiple",
|
|
203
|
+
required: s === "native" && u,
|
|
204
|
+
name: $,
|
|
205
|
+
form: m,
|
|
206
|
+
value: (v = t.value) !== null && v !== void 0 ? v : "",
|
|
207
|
+
onChange: p,
|
|
208
|
+
onInput: p
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function dt(e) {
|
|
213
|
+
let { state: t, triggerRef: a, label: o, name: l, form: $, isDisabled: m } = e, r = E(null), s = E(null), { containerProps: u, selectProps: i } = st({
|
|
214
|
+
...e,
|
|
215
|
+
selectRef: t.collection.size <= 300 ? r : s
|
|
216
|
+
}, t, a);
|
|
217
|
+
if (t.collection.size <= 300) return /* @__PURE__ */ S.createElement("div", {
|
|
218
|
+
...u,
|
|
219
|
+
"data-testid": "hidden-select-container"
|
|
220
|
+
}, /* @__PURE__ */ S.createElement("label", null, o, /* @__PURE__ */ S.createElement("select", {
|
|
221
|
+
...i,
|
|
222
|
+
ref: r
|
|
223
|
+
}, /* @__PURE__ */ S.createElement("option", null), [
|
|
224
|
+
...t.collection.getKeys()
|
|
225
|
+
].map((d) => {
|
|
226
|
+
let p = t.collection.getItem(d);
|
|
227
|
+
if (p && p.type === "item") return /* @__PURE__ */ S.createElement("option", {
|
|
228
|
+
key: p.key,
|
|
229
|
+
value: p.key
|
|
230
|
+
}, p.textValue);
|
|
231
|
+
}))));
|
|
232
|
+
if (l) {
|
|
233
|
+
let d = j.get(t) || {}, { validationBehavior: p } = d, v = Array.isArray(t.value) ? t.value : [
|
|
234
|
+
t.value
|
|
235
|
+
];
|
|
236
|
+
v.length === 0 && (v = [
|
|
237
|
+
null
|
|
238
|
+
]);
|
|
239
|
+
let c = v.map((x, C) => {
|
|
240
|
+
let f = {
|
|
241
|
+
type: "hidden",
|
|
242
|
+
autoComplete: i.autoComplete,
|
|
243
|
+
name: l,
|
|
244
|
+
form: $,
|
|
245
|
+
disabled: m,
|
|
246
|
+
value: x ?? ""
|
|
247
|
+
};
|
|
248
|
+
return p === "native" ? /* @__PURE__ */ S.createElement("input", {
|
|
249
|
+
key: C,
|
|
250
|
+
...f,
|
|
251
|
+
ref: C === 0 ? s : null,
|
|
252
|
+
style: {
|
|
253
|
+
display: "none"
|
|
254
|
+
},
|
|
255
|
+
type: "text",
|
|
256
|
+
required: C === 0 ? i.required : !1,
|
|
257
|
+
onChange: () => {
|
|
258
|
+
}
|
|
259
|
+
}) : /* @__PURE__ */ S.createElement("input", {
|
|
260
|
+
key: C,
|
|
261
|
+
...f,
|
|
262
|
+
ref: C === 0 ? s : null
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
return /* @__PURE__ */ S.createElement(S.Fragment, null, c);
|
|
266
|
+
}
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
function ct(e) {
|
|
270
|
+
let { selectionMode: t = "single" } = e, a = Te(e), [o, l] = O(null), $ = R(() => {
|
|
271
|
+
var n;
|
|
272
|
+
return e.defaultValue !== void 0 ? e.defaultValue : t === "single" ? (n = e.defaultSelectedKey) !== null && n !== void 0 ? n : null : [];
|
|
273
|
+
}, [
|
|
274
|
+
e.defaultValue,
|
|
275
|
+
e.defaultSelectedKey,
|
|
276
|
+
t
|
|
277
|
+
]), m = R(() => e.value !== void 0 ? e.value : t === "single" ? e.selectedKey : void 0, [
|
|
278
|
+
e.value,
|
|
279
|
+
e.selectedKey,
|
|
280
|
+
t
|
|
281
|
+
]), [r, s] = He(m, $, e.onChange), u = t === "single" && Array.isArray(r) ? r[0] : r, i = (n) => {
|
|
282
|
+
if (t === "single") {
|
|
283
|
+
var D, I;
|
|
284
|
+
let h = Array.isArray(n) ? (I = n[0]) !== null && I !== void 0 ? I : null : n;
|
|
285
|
+
s(h), h !== u && ((D = e.onSelectionChange) === null || D === void 0 || D.call(e, h));
|
|
286
|
+
} else {
|
|
287
|
+
let h = [];
|
|
288
|
+
Array.isArray(n) ? h = n : n != null && (h = [
|
|
289
|
+
n
|
|
290
|
+
]), s(h);
|
|
291
|
+
}
|
|
292
|
+
}, d = We({
|
|
293
|
+
...e,
|
|
294
|
+
selectionMode: t,
|
|
295
|
+
disallowEmptySelection: t === "single",
|
|
296
|
+
allowDuplicateSelectionEvents: !0,
|
|
297
|
+
selectedKeys: R(() => ut(u), [
|
|
298
|
+
u
|
|
299
|
+
]),
|
|
300
|
+
onSelectionChange: (n) => {
|
|
301
|
+
if (n !== "all") {
|
|
302
|
+
if (t === "single") {
|
|
303
|
+
var D;
|
|
304
|
+
let I = (D = n.values().next().value) !== null && D !== void 0 ? D : null;
|
|
305
|
+
i(I), a.close();
|
|
306
|
+
} else i([
|
|
307
|
+
...n
|
|
308
|
+
]);
|
|
309
|
+
c.commitValidation();
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}), p = d.selectionManager.firstSelectedKey, v = R(() => [
|
|
313
|
+
...d.selectionManager.selectedKeys
|
|
314
|
+
].map((n) => d.collection.getItem(n)).filter((n) => n != null), [
|
|
315
|
+
d.selectionManager.selectedKeys,
|
|
316
|
+
d.collection
|
|
317
|
+
]), c = je({
|
|
318
|
+
...e,
|
|
319
|
+
value: Array.isArray(u) && u.length === 0 ? null : u
|
|
320
|
+
}), [x, C] = O(!1), [f] = O(u);
|
|
321
|
+
var g, P;
|
|
322
|
+
return {
|
|
323
|
+
...c,
|
|
324
|
+
...d,
|
|
325
|
+
...a,
|
|
326
|
+
value: u,
|
|
327
|
+
defaultValue: $ ?? f,
|
|
328
|
+
setValue: i,
|
|
329
|
+
selectedKey: p,
|
|
330
|
+
setSelectedKey: i,
|
|
331
|
+
selectedItem: (g = v[0]) !== null && g !== void 0 ? g : null,
|
|
332
|
+
selectedItems: v,
|
|
333
|
+
defaultSelectedKey: (P = e.defaultSelectedKey) !== null && P !== void 0 ? P : e.selectionMode === "single" ? f : null,
|
|
334
|
+
focusStrategy: o,
|
|
335
|
+
open(n = null) {
|
|
336
|
+
d.collection.size !== 0 && (l(n), a.open());
|
|
337
|
+
},
|
|
338
|
+
toggle(n = null) {
|
|
339
|
+
d.collection.size !== 0 && (l(n), a.toggle());
|
|
340
|
+
},
|
|
341
|
+
isFocused: x,
|
|
342
|
+
setFocused: C
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function ut(e) {
|
|
346
|
+
if (e !== void 0)
|
|
347
|
+
return e === null ? [] : Array.isArray(e) ? e : [
|
|
348
|
+
e
|
|
349
|
+
];
|
|
350
|
+
}
|
|
351
|
+
function ft(e) {
|
|
352
|
+
return e && e.__esModule ? e.default : e;
|
|
353
|
+
}
|
|
354
|
+
const W = /* @__PURE__ */ N(null), H = /* @__PURE__ */ N(null), bt = /* @__PURE__ */ de(function(t, a) {
|
|
355
|
+
[t, a] = Z(t, a, W);
|
|
356
|
+
let { children: o, isDisabled: l = !1, isInvalid: $ = !1, isRequired: m = !1 } = t, r = R(() => typeof o == "function" ? o({
|
|
357
|
+
isOpen: !1,
|
|
358
|
+
isDisabled: l,
|
|
359
|
+
isInvalid: $,
|
|
360
|
+
isRequired: m,
|
|
361
|
+
isFocused: !1,
|
|
362
|
+
isFocusVisible: !1,
|
|
363
|
+
defaultChildren: null
|
|
364
|
+
}) : o, [
|
|
365
|
+
o,
|
|
366
|
+
l,
|
|
367
|
+
$,
|
|
368
|
+
m
|
|
369
|
+
]);
|
|
370
|
+
return /* @__PURE__ */ S.createElement(we, {
|
|
371
|
+
content: r
|
|
372
|
+
}, (s) => /* @__PURE__ */ S.createElement(mt, {
|
|
373
|
+
props: t,
|
|
374
|
+
collection: s,
|
|
375
|
+
selectRef: a
|
|
376
|
+
}));
|
|
377
|
+
}), $t = [
|
|
378
|
+
te,
|
|
379
|
+
Y,
|
|
380
|
+
G
|
|
381
|
+
];
|
|
382
|
+
function mt({ props: e, selectRef: t, collection: a }) {
|
|
383
|
+
let { validationBehavior: o } = _(Ie) || {};
|
|
384
|
+
var l, $;
|
|
385
|
+
let m = ($ = (l = e.validationBehavior) !== null && l !== void 0 ? l : o) !== null && $ !== void 0 ? $ : "native", r = ct({
|
|
386
|
+
...e,
|
|
387
|
+
collection: a,
|
|
388
|
+
children: void 0,
|
|
389
|
+
validationBehavior: m
|
|
390
|
+
}), { isFocusVisible: s, focusProps: u } = Ue({
|
|
391
|
+
within: !0
|
|
392
|
+
}), i = E(null), [d, p] = Se(!e["aria-label"] && !e["aria-labelledby"]), { labelProps: v, triggerProps: c, valueProps: x, menuProps: C, descriptionProps: f, errorMessageProps: g, hiddenSelectProps: P, ...n } = nt({
|
|
393
|
+
...Ce(e),
|
|
394
|
+
label: p,
|
|
395
|
+
validationBehavior: m
|
|
396
|
+
}, r, i), [D, I] = O(null), h = X(() => {
|
|
397
|
+
i.current && I(i.current.offsetWidth + "px");
|
|
398
|
+
}, [
|
|
399
|
+
i
|
|
400
|
+
]);
|
|
401
|
+
ze({
|
|
402
|
+
ref: i,
|
|
403
|
+
onResize: h
|
|
404
|
+
});
|
|
405
|
+
let w = R(() => ({
|
|
406
|
+
isOpen: r.isOpen,
|
|
407
|
+
isFocused: r.isFocused,
|
|
408
|
+
isFocusVisible: s,
|
|
409
|
+
isDisabled: e.isDisabled || !1,
|
|
410
|
+
isInvalid: n.isInvalid || !1,
|
|
411
|
+
isRequired: e.isRequired || !1
|
|
412
|
+
}), [
|
|
413
|
+
r.isOpen,
|
|
414
|
+
r.isFocused,
|
|
415
|
+
s,
|
|
416
|
+
e.isDisabled,
|
|
417
|
+
n.isInvalid,
|
|
418
|
+
e.isRequired
|
|
419
|
+
]), y = ee({
|
|
420
|
+
...e,
|
|
421
|
+
values: w,
|
|
422
|
+
defaultClassName: "react-aria-Select"
|
|
423
|
+
}), F = L(e, {
|
|
424
|
+
global: !0
|
|
425
|
+
});
|
|
426
|
+
delete F.id;
|
|
427
|
+
let M = E(null);
|
|
428
|
+
return /* @__PURE__ */ S.createElement(Re, {
|
|
429
|
+
values: [
|
|
430
|
+
[
|
|
431
|
+
W,
|
|
432
|
+
e
|
|
433
|
+
],
|
|
434
|
+
[
|
|
435
|
+
H,
|
|
436
|
+
r
|
|
437
|
+
],
|
|
438
|
+
[
|
|
439
|
+
ae,
|
|
440
|
+
x
|
|
441
|
+
],
|
|
442
|
+
[
|
|
443
|
+
te,
|
|
444
|
+
{
|
|
445
|
+
...v,
|
|
446
|
+
ref: d,
|
|
447
|
+
elementType: "span"
|
|
448
|
+
}
|
|
449
|
+
],
|
|
450
|
+
[
|
|
451
|
+
Y,
|
|
452
|
+
{
|
|
453
|
+
...c,
|
|
454
|
+
ref: i,
|
|
455
|
+
isPressed: r.isOpen,
|
|
456
|
+
autoFocus: e.autoFocus
|
|
457
|
+
}
|
|
458
|
+
],
|
|
459
|
+
[
|
|
460
|
+
ge,
|
|
461
|
+
r
|
|
462
|
+
],
|
|
463
|
+
[
|
|
464
|
+
he,
|
|
465
|
+
{
|
|
466
|
+
trigger: "Select",
|
|
467
|
+
triggerRef: i,
|
|
468
|
+
scrollRef: M,
|
|
469
|
+
placement: "bottom start",
|
|
470
|
+
style: {
|
|
471
|
+
"--trigger-width": D
|
|
472
|
+
},
|
|
473
|
+
"aria-labelledby": C["aria-labelledby"],
|
|
474
|
+
clearContexts: $t
|
|
475
|
+
}
|
|
476
|
+
],
|
|
477
|
+
[
|
|
478
|
+
Me,
|
|
479
|
+
{
|
|
480
|
+
...C,
|
|
481
|
+
ref: M
|
|
482
|
+
}
|
|
483
|
+
],
|
|
484
|
+
[
|
|
485
|
+
Ke,
|
|
486
|
+
r
|
|
487
|
+
],
|
|
488
|
+
[
|
|
489
|
+
G,
|
|
490
|
+
{
|
|
491
|
+
slots: {
|
|
492
|
+
description: f,
|
|
493
|
+
errorMessage: g
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
],
|
|
497
|
+
[
|
|
498
|
+
De,
|
|
499
|
+
n
|
|
500
|
+
]
|
|
501
|
+
]
|
|
502
|
+
}, /* @__PURE__ */ S.createElement("div", {
|
|
503
|
+
...z(F, y, u),
|
|
504
|
+
ref: t,
|
|
505
|
+
slot: e.slot || void 0,
|
|
506
|
+
"data-focused": r.isFocused || void 0,
|
|
507
|
+
"data-focus-visible": s || void 0,
|
|
508
|
+
"data-open": r.isOpen || void 0,
|
|
509
|
+
"data-disabled": e.isDisabled || void 0,
|
|
510
|
+
"data-invalid": n.isInvalid || void 0,
|
|
511
|
+
"data-required": e.isRequired || void 0
|
|
512
|
+
}, y.children, /* @__PURE__ */ S.createElement(dt, {
|
|
513
|
+
...P,
|
|
514
|
+
autoComplete: e.autoComplete
|
|
515
|
+
})));
|
|
516
|
+
}
|
|
517
|
+
const ae = /* @__PURE__ */ N(null), pt = /* @__PURE__ */ ke(function(t, a) {
|
|
518
|
+
var o;
|
|
519
|
+
[t, a] = Z(t, a, ae);
|
|
520
|
+
let l = J(H), { placeholder: $ } = _(W), m = l.selectedItems.map((f) => {
|
|
521
|
+
var g;
|
|
522
|
+
let P = (g = f.props) === null || g === void 0 ? void 0 : g.children;
|
|
523
|
+
return typeof P == "function" && (P = P({
|
|
524
|
+
isHovered: !1,
|
|
525
|
+
isPressed: !1,
|
|
526
|
+
isSelected: !1,
|
|
527
|
+
isFocused: !1,
|
|
528
|
+
isFocusVisible: !1,
|
|
529
|
+
isDisabled: !1,
|
|
530
|
+
selectionMode: "single",
|
|
531
|
+
selectionBehavior: "toggle"
|
|
532
|
+
})), P;
|
|
533
|
+
}), r = it(), s = R(() => l.selectedItems.map((f) => f?.textValue), [
|
|
534
|
+
l.selectedItems
|
|
535
|
+
]), u = l.selectionManager.selectionMode, i = R(() => {
|
|
536
|
+
var f;
|
|
537
|
+
return u === "single" ? (f = s[0]) !== null && f !== void 0 ? f : "" : r.format(s);
|
|
538
|
+
}, [
|
|
539
|
+
u,
|
|
540
|
+
r,
|
|
541
|
+
s
|
|
542
|
+
]), d = R(() => {
|
|
543
|
+
if (u === "single") return m[0];
|
|
544
|
+
let f = r.formatToParts(s);
|
|
545
|
+
if (f.length === 0) return null;
|
|
546
|
+
let g = 0;
|
|
547
|
+
return f.map((P) => P.type === "element" ? /* @__PURE__ */ S.createElement(ce, {
|
|
548
|
+
key: g
|
|
549
|
+
}, m[g++]) : P.value);
|
|
550
|
+
}, [
|
|
551
|
+
u,
|
|
552
|
+
r,
|
|
553
|
+
s,
|
|
554
|
+
m
|
|
555
|
+
]), p = Ge(ft(Fe), "react-aria-components");
|
|
556
|
+
var v, c;
|
|
557
|
+
let x = ee({
|
|
558
|
+
...t,
|
|
559
|
+
defaultChildren: (v = d ?? $) !== null && v !== void 0 ? v : p.format("selectPlaceholder"),
|
|
560
|
+
defaultClassName: "react-aria-SelectValue",
|
|
561
|
+
values: {
|
|
562
|
+
selectedItem: (c = (o = l.selectedItems[0]) === null || o === void 0 ? void 0 : o.value) !== null && c !== void 0 ? c : null,
|
|
563
|
+
selectedItems: R(() => l.selectedItems.map((f) => {
|
|
564
|
+
var g;
|
|
565
|
+
return (g = f.value) !== null && g !== void 0 ? g : null;
|
|
566
|
+
}), [
|
|
567
|
+
l.selectedItems
|
|
568
|
+
]),
|
|
569
|
+
selectedText: i,
|
|
570
|
+
isPlaceholder: l.selectedItems.length === 0,
|
|
571
|
+
state: l
|
|
572
|
+
}
|
|
573
|
+
}), C = L(t, {
|
|
574
|
+
global: !0
|
|
575
|
+
});
|
|
576
|
+
return /* @__PURE__ */ S.createElement("span", {
|
|
577
|
+
ref: a,
|
|
578
|
+
...C,
|
|
579
|
+
...x,
|
|
580
|
+
"data-placeholder": l.selectedItems.length === 0 || void 0
|
|
581
|
+
}, /* @__PURE__ */ S.createElement(G.Provider, {
|
|
582
|
+
value: void 0
|
|
583
|
+
}, x.children));
|
|
584
|
+
}), { withProvider: vt, withContext: K } = /* @__PURE__ */ ue({
|
|
585
|
+
recipe: le
|
|
586
|
+
}), yt = /* @__PURE__ */ vt(
|
|
587
|
+
"div",
|
|
588
|
+
"root"
|
|
589
|
+
), gt = /* @__PURE__ */ K("div", "leadingElement"), ht = /* @__PURE__ */ K("button", "trigger"), xt = /* @__PURE__ */ K("span", "triggerLabel"), Pt = /* @__PURE__ */ K("div", "options"), St = /* @__PURE__ */ K("div", "option"), Ct = /* @__PURE__ */ K("div", "optionGroup"), Rt = /* @__PURE__ */ tt({
|
|
590
|
+
clearSelection: {
|
|
591
|
+
id: "Nimbus.Select.clearSelection",
|
|
592
|
+
description: "aria-label for select clear button",
|
|
593
|
+
defaultMessage: "Clear selection"
|
|
594
|
+
}
|
|
595
|
+
}), re = () => {
|
|
596
|
+
const e = J(H), t = lt();
|
|
597
|
+
if (!e?.selectedKey)
|
|
598
|
+
return null;
|
|
599
|
+
const a = () => {
|
|
600
|
+
e?.setSelectedKey(null);
|
|
601
|
+
};
|
|
602
|
+
return /* @__PURE__ */ b(xe, { children: /* @__PURE__ */ b(
|
|
603
|
+
at,
|
|
604
|
+
{
|
|
605
|
+
pointerEvents: "all",
|
|
606
|
+
size: "2xs",
|
|
607
|
+
variant: "ghost",
|
|
608
|
+
"aria-label": t.formatMessage(Rt.clearSelection),
|
|
609
|
+
"aria-labelledby": "",
|
|
610
|
+
onPress: a,
|
|
611
|
+
slot: null,
|
|
612
|
+
children: /* @__PURE__ */ b($e, {})
|
|
613
|
+
}
|
|
614
|
+
) });
|
|
615
|
+
};
|
|
616
|
+
re.displayName = "Select.ClearButton";
|
|
617
|
+
const oe = function({
|
|
618
|
+
ref: t,
|
|
619
|
+
children: a,
|
|
620
|
+
leadingElement: o,
|
|
621
|
+
isLoading: l,
|
|
622
|
+
isDisabled: $,
|
|
623
|
+
isClearable: m = !0,
|
|
624
|
+
...r
|
|
625
|
+
}) {
|
|
626
|
+
const s = E(null), u = rt(be(s, t)), i = fe({ recipe: le }), [d, p] = i.splitVariantProps(r), [v, c] = k(p), x = {
|
|
627
|
+
...c,
|
|
628
|
+
isDisabled: l || $
|
|
629
|
+
};
|
|
630
|
+
return /* @__PURE__ */ b(yt, { asChild: !0, ref: u, ...d, ...v, children: /* @__PURE__ */ B(bt, { ...x, children: [
|
|
631
|
+
/* @__PURE__ */ B(Q.div, { position: "relative", children: [
|
|
632
|
+
/* @__PURE__ */ b(ht, { zIndex: 0, asChild: !0, children: /* @__PURE__ */ B(ve, { children: [
|
|
633
|
+
o && /* @__PURE__ */ b(gt, { asChild: !0, children: o }),
|
|
634
|
+
/* @__PURE__ */ b(xt, { asChild: !0, children: /* @__PURE__ */ b(pt, {}) })
|
|
635
|
+
] }) }),
|
|
636
|
+
/* @__PURE__ */ B(
|
|
637
|
+
T,
|
|
638
|
+
{
|
|
639
|
+
position: "absolute",
|
|
640
|
+
top: "0",
|
|
641
|
+
bottom: "0",
|
|
642
|
+
zIndex: 1,
|
|
643
|
+
right: "400",
|
|
644
|
+
pointerEvents: "none",
|
|
645
|
+
children: [
|
|
646
|
+
m && /* @__PURE__ */ b(T, { width: "600", my: "auto", children: /* @__PURE__ */ b(re, {}) }),
|
|
647
|
+
/* @__PURE__ */ b(T, { my: "auto", w: "600", h: "600", children: /* @__PURE__ */ b(U, { color: "neutral.9", asChild: !0, m: "auto", w: "400", h: "400", children: l ? /* @__PURE__ */ b(U, { asChild: !0, animation: "spin", animationDuration: "slowest", children: /* @__PURE__ */ b(me, {}) }) : /* @__PURE__ */ b(pe, {}) }) })
|
|
648
|
+
]
|
|
649
|
+
}
|
|
650
|
+
)
|
|
651
|
+
] }),
|
|
652
|
+
/* @__PURE__ */ b(Pe, { children: a })
|
|
653
|
+
] }) });
|
|
654
|
+
};
|
|
655
|
+
oe.displayName = "Select.Root";
|
|
656
|
+
const ie = (e) => {
|
|
657
|
+
const { ref: t, ...a } = e, [o, l] = k(a);
|
|
658
|
+
return /* @__PURE__ */ b(Pt, { asChild: !0, ...o, children: /* @__PURE__ */ b(Ve, { ref: t, ...l }) });
|
|
659
|
+
};
|
|
660
|
+
ie.displayName = "Select.Options";
|
|
661
|
+
const ne = (e) => {
|
|
662
|
+
const { ref: t, ...a } = e, [o, l] = k(a);
|
|
663
|
+
return /* @__PURE__ */ b(St, { asChild: !0, ...o, children: /* @__PURE__ */ b(Be, { ref: t, ...l }) });
|
|
664
|
+
};
|
|
665
|
+
ne.displayName = "Select.Option";
|
|
666
|
+
const se = (e) => {
|
|
667
|
+
const { ref: t, label: a, items: o, children: l, ...$ } = e, [m, r] = k($);
|
|
668
|
+
if (o && typeof l != "function")
|
|
669
|
+
throw new Error(
|
|
670
|
+
'SelectOptionGroup: When "items" is provided, "children" must be a function'
|
|
671
|
+
);
|
|
672
|
+
return /* @__PURE__ */ b(Q.section, { ...m, asChild: !0, children: /* @__PURE__ */ B(Ee, { ref: t, ...r, children: [
|
|
673
|
+
/* @__PURE__ */ b(Ct, { asChild: !0, children: /* @__PURE__ */ b(ot, { children: a }) }),
|
|
674
|
+
o ? /* @__PURE__ */ b(Oe, { items: o, children: (s) => typeof l == "function" ? l(s) : null }) : l
|
|
675
|
+
] }) });
|
|
676
|
+
};
|
|
677
|
+
se.displayName = "Select.OptionGroup";
|
|
678
|
+
const fl = {
|
|
679
|
+
/**
|
|
680
|
+
* # Select.Root
|
|
681
|
+
*
|
|
682
|
+
* The root component that provides context and state management for the select.
|
|
683
|
+
* This component must wrap all select parts (Options, Option, etc.) and provides
|
|
684
|
+
* the select state, variant styling context, and selection management.
|
|
685
|
+
*
|
|
686
|
+
* @example
|
|
687
|
+
* ```tsx
|
|
688
|
+
* <Select.Root>
|
|
689
|
+
* <Select.Options placeholder="Choose...">
|
|
690
|
+
* <Select.Option id="apple">Apple</Select.Option>
|
|
691
|
+
* <Select.Option id="orange">Orange</Select.Option>
|
|
692
|
+
* </Select.Options>
|
|
693
|
+
* </Select.Root>
|
|
694
|
+
* ```
|
|
695
|
+
*/
|
|
696
|
+
Root: oe,
|
|
697
|
+
/**
|
|
698
|
+
* # Select.Options
|
|
699
|
+
*
|
|
700
|
+
* The trigger button and dropdown container for select options.
|
|
701
|
+
* Displays the selected value and opens the options list when activated.
|
|
702
|
+
*
|
|
703
|
+
* This component handles the visual presentation of the select, including
|
|
704
|
+
* the trigger button, selected value display, dropdown icon, and the
|
|
705
|
+
* popover containing options.
|
|
706
|
+
*
|
|
707
|
+
* @example
|
|
708
|
+
* ```tsx
|
|
709
|
+
* <Select.Root>
|
|
710
|
+
* <Select.Options
|
|
711
|
+
* placeholder="Select fruit"
|
|
712
|
+
* label="Favorite Fruit"
|
|
713
|
+
* >
|
|
714
|
+
* <Select.Option id="apple">Apple</Select.Option>
|
|
715
|
+
* <Select.Option id="banana">Banana</Select.Option>
|
|
716
|
+
* </Select.Options>
|
|
717
|
+
* </Select.Root>
|
|
718
|
+
* ```
|
|
719
|
+
*/
|
|
720
|
+
Options: ie,
|
|
721
|
+
/**
|
|
722
|
+
* # Select.Option
|
|
723
|
+
*
|
|
724
|
+
* An individual selectable option within the select dropdown.
|
|
725
|
+
* Represents a single choice that can be selected by the user.
|
|
726
|
+
*
|
|
727
|
+
* Options automatically handle selection state, keyboard navigation,
|
|
728
|
+
* and visual feedback for hover and selection states.
|
|
729
|
+
*
|
|
730
|
+
* @example
|
|
731
|
+
* ```tsx
|
|
732
|
+
* <Select.Options>
|
|
733
|
+
* <Select.Option id="red" textValue="Red">
|
|
734
|
+
* 🔴 Red
|
|
735
|
+
* </Select.Option>
|
|
736
|
+
* <Select.Option id="blue" textValue="Blue">
|
|
737
|
+
* 🔵 Blue
|
|
738
|
+
* </Select.Option>
|
|
739
|
+
* </Select.Options>
|
|
740
|
+
* ```
|
|
741
|
+
*/
|
|
742
|
+
Option: ne,
|
|
743
|
+
/**
|
|
744
|
+
* # Select.OptionGroup
|
|
745
|
+
*
|
|
746
|
+
* A container for grouping related options with an optional label.
|
|
747
|
+
* Provides visual separation and semantic grouping of options.
|
|
748
|
+
*
|
|
749
|
+
* Option groups help organize large lists of options into logical
|
|
750
|
+
* categories with proper accessibility support.
|
|
751
|
+
*
|
|
752
|
+
* @example
|
|
753
|
+
* ```tsx
|
|
754
|
+
* <Select.Options>
|
|
755
|
+
* <Select.OptionGroup label="Fruits">
|
|
756
|
+
* <Select.Option id="apple">Apple</Select.Option>
|
|
757
|
+
* <Select.Option id="banana">Banana</Select.Option>
|
|
758
|
+
* </Select.OptionGroup>
|
|
759
|
+
* <Select.OptionGroup label="Vegetables">
|
|
760
|
+
* <Select.Option id="carrot">Carrot</Select.Option>
|
|
761
|
+
* <Select.Option id="broccoli">Broccoli</Select.Option>
|
|
762
|
+
* </Select.OptionGroup>
|
|
763
|
+
* </Select.Options>
|
|
764
|
+
* ```
|
|
765
|
+
*/
|
|
766
|
+
OptionGroup: se
|
|
767
|
+
};
|
|
768
|
+
export {
|
|
769
|
+
fl as S,
|
|
770
|
+
oe as a,
|
|
771
|
+
ie as b,
|
|
772
|
+
ne as c,
|
|
773
|
+
se as d
|
|
774
|
+
};
|
|
775
|
+
//# sourceMappingURL=select-D5QaNAMe.es.js.map
|