@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
|
@@ -1,690 +0,0 @@
|
|
|
1
|
-
import { jsx as $, jsxs as B } from "react/jsx-runtime";
|
|
2
|
-
import P, { useMemo as R, useRef as E, useCallback as U, useState as O, forwardRef as se, createContext as z, useContext as X, Fragment as de } from "react";
|
|
3
|
-
import { createSlotRecipeContext as ce, useSlotRecipe as ue, chakra as fe } 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 J, a as ve } from "./Button-DbDspzBf.es.js";
|
|
7
|
-
import { q as ye, d as ge, i as he, r as xe, g as Se } from "./Dialog-FtshtbuD.es.js";
|
|
8
|
-
import { $ as Q, e as Y, a as Z, b as Pe, 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 _ } 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 N } 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 T, $ as qe, e as Ae } from "./mergeProps-CzyOU2NE.es.js";
|
|
18
|
-
import { $ as G } 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 ee } 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 te } from "./extractStyleProps-CNXOLneR.es.js";
|
|
37
|
-
import { $ as rt } from "./useObjectRef-CaJ5pgjX.es.js";
|
|
38
|
-
import { Flex as A } from "@chakra-ui/react/flex";
|
|
39
|
-
import { B as H } 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 L = /* @__PURE__ */ new WeakMap();
|
|
49
|
-
function nt(e, t, a) {
|
|
50
|
-
let { keyboardDelegate: i, isDisabled: l, isRequired: b, name: m, form: r, validationBehavior: c = "aria" } = e, u = Ye({
|
|
51
|
-
usage: "search",
|
|
52
|
-
sensitivity: "base"
|
|
53
|
-
}), o = R(() => i || new Xe(t.collection, t.disabledKeys, a, u), [
|
|
54
|
-
i,
|
|
55
|
-
t.collection,
|
|
56
|
-
t.disabledKeys,
|
|
57
|
-
u,
|
|
58
|
-
a
|
|
59
|
-
]), { menuTriggerProps: s, 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 = o.getKeyAbove) === null || F === void 0 ? void 0 : F.call(o, t.selectedKey) : (M = o.getFirstKey) === null || M === void 0 ? void 0 : M.call(o);
|
|
69
|
-
V && t.setSelectedKey(V);
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
case "ArrowRight": {
|
|
73
|
-
var k, q;
|
|
74
|
-
y.preventDefault();
|
|
75
|
-
let V = t.selectedKey != null ? (k = o.getKeyBelow) === null || k === void 0 ? void 0 : k.call(o, t.selectedKey) : (q = o.getFirstKey) === null || q === void 0 ? void 0 : q.call(o);
|
|
76
|
-
V && t.setSelectedKey(V);
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, { typeSelectProps: d } = Je({
|
|
81
|
-
keyboardDelegate: o,
|
|
82
|
-
selectionManager: t.selectionManager,
|
|
83
|
-
onTypeSelect(y) {
|
|
84
|
-
t.setSelectedKey(y);
|
|
85
|
-
}
|
|
86
|
-
}), { isInvalid: x, validationErrors: C, validationDetails: f } = t.displayValidation, { labelProps: g, fieldProps: S, descriptionProps: n, errorMessageProps: D } = Ze({
|
|
87
|
-
...e,
|
|
88
|
-
labelElementType: "span",
|
|
89
|
-
isInvalid: x,
|
|
90
|
-
errorMessage: e.errorMessage || C
|
|
91
|
-
});
|
|
92
|
-
d.onKeyDown = d.onKeyDownCapture, delete d.onKeyDownCapture, t.selectionManager.selectionMode === "multiple" && (d = {});
|
|
93
|
-
let I = G(e, {
|
|
94
|
-
labelable: !0
|
|
95
|
-
}), h = T(d, s, S), w = qe();
|
|
96
|
-
return L.set(t, {
|
|
97
|
-
isDisabled: l,
|
|
98
|
-
isRequired: b,
|
|
99
|
-
name: m,
|
|
100
|
-
form: r,
|
|
101
|
-
validationBehavior: c
|
|
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: T(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
|
-
S["aria-labelledby"],
|
|
144
|
-
h["aria-label"] && !S["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 i = L.get(t) || {}, { autoComplete: l, name: b = i.name, form: m = i.form, isDisabled: r = i.isDisabled } = e, { validationBehavior: c, isRequired: u } = i, { visuallyHiddenProps: o } = 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: c,
|
|
173
|
-
focus: () => {
|
|
174
|
-
var d;
|
|
175
|
-
return (d = a.current) === null || d === void 0 ? void 0 : d.focus();
|
|
176
|
-
}
|
|
177
|
-
}, t, e.selectRef);
|
|
178
|
-
let s = t.setValue, p = U((d) => {
|
|
179
|
-
d.target.multiple ? s(Array.from(d.target.selectedOptions, (x) => x.value)) : s(d.currentTarget.value);
|
|
180
|
-
}, [
|
|
181
|
-
s
|
|
182
|
-
]);
|
|
183
|
-
var v;
|
|
184
|
-
return {
|
|
185
|
-
containerProps: {
|
|
186
|
-
...o,
|
|
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: c === "native" && u,
|
|
204
|
-
name: b,
|
|
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: i, name: l, form: b, isDisabled: m } = e, r = E(null), c = E(null), { containerProps: u, selectProps: o } = st({
|
|
214
|
-
...e,
|
|
215
|
-
selectRef: t.collection.size <= 300 ? r : c
|
|
216
|
-
}, t, a);
|
|
217
|
-
if (t.collection.size <= 300) return /* @__PURE__ */ P.createElement("div", {
|
|
218
|
-
...u,
|
|
219
|
-
"data-testid": "hidden-select-container"
|
|
220
|
-
}, /* @__PURE__ */ P.createElement("label", null, i, /* @__PURE__ */ P.createElement("select", {
|
|
221
|
-
...o,
|
|
222
|
-
ref: r
|
|
223
|
-
}, /* @__PURE__ */ P.createElement("option", null), [
|
|
224
|
-
...t.collection.getKeys()
|
|
225
|
-
].map((s) => {
|
|
226
|
-
let p = t.collection.getItem(s);
|
|
227
|
-
if (p && p.type === "item") return /* @__PURE__ */ P.createElement("option", {
|
|
228
|
-
key: p.key,
|
|
229
|
-
value: p.key
|
|
230
|
-
}, p.textValue);
|
|
231
|
-
}))));
|
|
232
|
-
if (l) {
|
|
233
|
-
let s = L.get(t) || {}, { validationBehavior: p } = s, v = Array.isArray(t.value) ? t.value : [
|
|
234
|
-
t.value
|
|
235
|
-
];
|
|
236
|
-
v.length === 0 && (v = [
|
|
237
|
-
null
|
|
238
|
-
]);
|
|
239
|
-
let d = v.map((x, C) => {
|
|
240
|
-
let f = {
|
|
241
|
-
type: "hidden",
|
|
242
|
-
autoComplete: o.autoComplete,
|
|
243
|
-
name: l,
|
|
244
|
-
form: b,
|
|
245
|
-
disabled: m,
|
|
246
|
-
value: x ?? ""
|
|
247
|
-
};
|
|
248
|
-
return p === "native" ? /* @__PURE__ */ P.createElement("input", {
|
|
249
|
-
key: C,
|
|
250
|
-
...f,
|
|
251
|
-
ref: C === 0 ? c : null,
|
|
252
|
-
style: {
|
|
253
|
-
display: "none"
|
|
254
|
-
},
|
|
255
|
-
type: "text",
|
|
256
|
-
required: C === 0 ? o.required : !1,
|
|
257
|
-
onChange: () => {
|
|
258
|
-
}
|
|
259
|
-
}) : /* @__PURE__ */ P.createElement("input", {
|
|
260
|
-
key: C,
|
|
261
|
-
...f,
|
|
262
|
-
ref: C === 0 ? c : null
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
return /* @__PURE__ */ P.createElement(P.Fragment, null, d);
|
|
266
|
-
}
|
|
267
|
-
return null;
|
|
268
|
-
}
|
|
269
|
-
function ct(e) {
|
|
270
|
-
let { selectionMode: t = "single" } = e, a = Te(e), [i, l] = O(null), b = 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, c] = He(m, b, e.onChange), u = t === "single" && Array.isArray(r) ? r[0] : r, o = (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
|
-
c(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
|
-
]), c(h);
|
|
291
|
-
}
|
|
292
|
-
}, s = 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
|
-
o(I), a.close();
|
|
306
|
-
} else o([
|
|
307
|
-
...n
|
|
308
|
-
]);
|
|
309
|
-
d.commitValidation();
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}), p = s.selectionManager.firstSelectedKey, v = R(() => [
|
|
313
|
-
...s.selectionManager.selectedKeys
|
|
314
|
-
].map((n) => s.collection.getItem(n)).filter((n) => n != null), [
|
|
315
|
-
s.selectionManager.selectedKeys,
|
|
316
|
-
s.collection
|
|
317
|
-
]), d = je({
|
|
318
|
-
...e,
|
|
319
|
-
value: Array.isArray(u) && u.length === 0 ? null : u
|
|
320
|
-
}), [x, C] = O(!1), [f] = O(u);
|
|
321
|
-
var g, S;
|
|
322
|
-
return {
|
|
323
|
-
...d,
|
|
324
|
-
...s,
|
|
325
|
-
...a,
|
|
326
|
-
value: u,
|
|
327
|
-
defaultValue: b ?? f,
|
|
328
|
-
setValue: o,
|
|
329
|
-
selectedKey: p,
|
|
330
|
-
setSelectedKey: o,
|
|
331
|
-
selectedItem: (g = v[0]) !== null && g !== void 0 ? g : null,
|
|
332
|
-
selectedItems: v,
|
|
333
|
-
defaultSelectedKey: (S = e.defaultSelectedKey) !== null && S !== void 0 ? S : e.selectionMode === "single" ? f : null,
|
|
334
|
-
focusStrategy: i,
|
|
335
|
-
open(n = null) {
|
|
336
|
-
s.collection.size !== 0 && (l(n), a.open());
|
|
337
|
-
},
|
|
338
|
-
toggle(n = null) {
|
|
339
|
-
s.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 j = /* @__PURE__ */ z(null), W = /* @__PURE__ */ z(null), bt = /* @__PURE__ */ se(function(t, a) {
|
|
355
|
-
[t, a] = Q(t, a, j);
|
|
356
|
-
let { children: i, isDisabled: l = !1, isInvalid: b = !1, isRequired: m = !1 } = t, r = R(() => typeof i == "function" ? i({
|
|
357
|
-
isOpen: !1,
|
|
358
|
-
isDisabled: l,
|
|
359
|
-
isInvalid: b,
|
|
360
|
-
isRequired: m,
|
|
361
|
-
isFocused: !1,
|
|
362
|
-
isFocusVisible: !1,
|
|
363
|
-
defaultChildren: null
|
|
364
|
-
}) : i, [
|
|
365
|
-
i,
|
|
366
|
-
l,
|
|
367
|
-
b,
|
|
368
|
-
m
|
|
369
|
-
]);
|
|
370
|
-
return /* @__PURE__ */ P.createElement(we, {
|
|
371
|
-
content: r
|
|
372
|
-
}, (c) => /* @__PURE__ */ P.createElement(mt, {
|
|
373
|
-
props: t,
|
|
374
|
-
collection: c,
|
|
375
|
-
selectRef: a
|
|
376
|
-
}));
|
|
377
|
-
}), $t = [
|
|
378
|
-
_,
|
|
379
|
-
J,
|
|
380
|
-
N
|
|
381
|
-
];
|
|
382
|
-
function mt({ props: e, selectRef: t, collection: a }) {
|
|
383
|
-
let { validationBehavior: i } = Y(Ie) || {};
|
|
384
|
-
var l, b;
|
|
385
|
-
let m = (b = (l = e.validationBehavior) !== null && l !== void 0 ? l : i) !== null && b !== void 0 ? b : "native", r = ct({
|
|
386
|
-
...e,
|
|
387
|
-
collection: a,
|
|
388
|
-
children: void 0,
|
|
389
|
-
validationBehavior: m
|
|
390
|
-
}), { isFocusVisible: c, focusProps: u } = Ue({
|
|
391
|
-
within: !0
|
|
392
|
-
}), o = E(null), [s, p] = Pe(!e["aria-label"] && !e["aria-labelledby"]), { labelProps: v, triggerProps: d, valueProps: x, menuProps: C, descriptionProps: f, errorMessageProps: g, hiddenSelectProps: S, ...n } = nt({
|
|
393
|
-
...Ce(e),
|
|
394
|
-
label: p,
|
|
395
|
-
validationBehavior: m
|
|
396
|
-
}, r, o), [D, I] = O(null), h = U(() => {
|
|
397
|
-
o.current && I(o.current.offsetWidth + "px");
|
|
398
|
-
}, [
|
|
399
|
-
o
|
|
400
|
-
]);
|
|
401
|
-
ze({
|
|
402
|
-
ref: o,
|
|
403
|
-
onResize: h
|
|
404
|
-
});
|
|
405
|
-
let w = R(() => ({
|
|
406
|
-
isOpen: r.isOpen,
|
|
407
|
-
isFocused: r.isFocused,
|
|
408
|
-
isFocusVisible: c,
|
|
409
|
-
isDisabled: e.isDisabled || !1,
|
|
410
|
-
isInvalid: n.isInvalid || !1,
|
|
411
|
-
isRequired: e.isRequired || !1
|
|
412
|
-
}), [
|
|
413
|
-
r.isOpen,
|
|
414
|
-
r.isFocused,
|
|
415
|
-
c,
|
|
416
|
-
e.isDisabled,
|
|
417
|
-
n.isInvalid,
|
|
418
|
-
e.isRequired
|
|
419
|
-
]), y = Z({
|
|
420
|
-
...e,
|
|
421
|
-
values: w,
|
|
422
|
-
defaultClassName: "react-aria-Select"
|
|
423
|
-
}), F = G(e, {
|
|
424
|
-
global: !0
|
|
425
|
-
});
|
|
426
|
-
delete F.id;
|
|
427
|
-
let M = E(null);
|
|
428
|
-
return /* @__PURE__ */ P.createElement(Re, {
|
|
429
|
-
values: [
|
|
430
|
-
[
|
|
431
|
-
j,
|
|
432
|
-
e
|
|
433
|
-
],
|
|
434
|
-
[
|
|
435
|
-
W,
|
|
436
|
-
r
|
|
437
|
-
],
|
|
438
|
-
[
|
|
439
|
-
le,
|
|
440
|
-
x
|
|
441
|
-
],
|
|
442
|
-
[
|
|
443
|
-
_,
|
|
444
|
-
{
|
|
445
|
-
...v,
|
|
446
|
-
ref: s,
|
|
447
|
-
elementType: "span"
|
|
448
|
-
}
|
|
449
|
-
],
|
|
450
|
-
[
|
|
451
|
-
J,
|
|
452
|
-
{
|
|
453
|
-
...d,
|
|
454
|
-
ref: o,
|
|
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: o,
|
|
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
|
-
N,
|
|
490
|
-
{
|
|
491
|
-
slots: {
|
|
492
|
-
description: f,
|
|
493
|
-
errorMessage: g
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
],
|
|
497
|
-
[
|
|
498
|
-
De,
|
|
499
|
-
n
|
|
500
|
-
]
|
|
501
|
-
]
|
|
502
|
-
}, /* @__PURE__ */ P.createElement("div", {
|
|
503
|
-
...T(F, y, u),
|
|
504
|
-
ref: t,
|
|
505
|
-
slot: e.slot || void 0,
|
|
506
|
-
"data-focused": r.isFocused || void 0,
|
|
507
|
-
"data-focus-visible": c || 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__ */ P.createElement(dt, {
|
|
513
|
-
...S,
|
|
514
|
-
autoComplete: e.autoComplete
|
|
515
|
-
})));
|
|
516
|
-
}
|
|
517
|
-
const le = /* @__PURE__ */ z(null), pt = /* @__PURE__ */ ke(function(t, a) {
|
|
518
|
-
var i;
|
|
519
|
-
[t, a] = Q(t, a, le);
|
|
520
|
-
let l = X(W), { placeholder: b } = Y(j), m = l.selectedItems.map((f) => {
|
|
521
|
-
var g;
|
|
522
|
-
let S = (g = f.props) === null || g === void 0 ? void 0 : g.children;
|
|
523
|
-
return typeof S == "function" && (S = S({
|
|
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
|
-
})), S;
|
|
533
|
-
}), r = it(), c = R(() => l.selectedItems.map((f) => f?.textValue), [
|
|
534
|
-
l.selectedItems
|
|
535
|
-
]), u = l.selectionManager.selectionMode, o = R(() => {
|
|
536
|
-
var f;
|
|
537
|
-
return u === "single" ? (f = c[0]) !== null && f !== void 0 ? f : "" : r.format(c);
|
|
538
|
-
}, [
|
|
539
|
-
u,
|
|
540
|
-
r,
|
|
541
|
-
c
|
|
542
|
-
]), s = R(() => {
|
|
543
|
-
if (u === "single") return m[0];
|
|
544
|
-
let f = r.formatToParts(c);
|
|
545
|
-
if (f.length === 0) return null;
|
|
546
|
-
let g = 0;
|
|
547
|
-
return f.map((S) => S.type === "element" ? /* @__PURE__ */ P.createElement(de, {
|
|
548
|
-
key: g
|
|
549
|
-
}, m[g++]) : S.value);
|
|
550
|
-
}, [
|
|
551
|
-
u,
|
|
552
|
-
r,
|
|
553
|
-
c,
|
|
554
|
-
m
|
|
555
|
-
]), p = Ge(ft(Fe), "react-aria-components");
|
|
556
|
-
var v, d;
|
|
557
|
-
let x = Z({
|
|
558
|
-
...t,
|
|
559
|
-
defaultChildren: (v = s ?? b) !== null && v !== void 0 ? v : p.format("selectPlaceholder"),
|
|
560
|
-
defaultClassName: "react-aria-SelectValue",
|
|
561
|
-
values: {
|
|
562
|
-
selectedItem: (d = (i = l.selectedItems[0]) === null || i === void 0 ? void 0 : i.value) !== null && d !== void 0 ? d : 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: o,
|
|
570
|
-
isPlaceholder: l.selectedItems.length === 0,
|
|
571
|
-
state: l
|
|
572
|
-
}
|
|
573
|
-
}), C = G(t, {
|
|
574
|
-
global: !0
|
|
575
|
-
});
|
|
576
|
-
return /* @__PURE__ */ P.createElement("span", {
|
|
577
|
-
ref: a,
|
|
578
|
-
...C,
|
|
579
|
-
...x,
|
|
580
|
-
"data-placeholder": l.selectedItems.length === 0 || void 0
|
|
581
|
-
}, /* @__PURE__ */ P.createElement(N.Provider, {
|
|
582
|
-
value: void 0
|
|
583
|
-
}, x.children));
|
|
584
|
-
}), { withProvider: vt, withContext: K } = /* @__PURE__ */ ce({
|
|
585
|
-
recipe: ee
|
|
586
|
-
}), yt = /* @__PURE__ */ vt(
|
|
587
|
-
"div",
|
|
588
|
-
"root"
|
|
589
|
-
), gt = /* @__PURE__ */ K("div", "leadingElement"), ht = /* @__PURE__ */ K("button", "trigger"), xt = /* @__PURE__ */ K("span", "triggerLabel"), St = /* @__PURE__ */ K("div", "options"), Pt = /* @__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
|
-
}), ae = () => {
|
|
596
|
-
const e = X(W), t = lt();
|
|
597
|
-
if (!e?.selectedKey)
|
|
598
|
-
return null;
|
|
599
|
-
const a = () => {
|
|
600
|
-
e?.setSelectedKey(null);
|
|
601
|
-
};
|
|
602
|
-
return /* @__PURE__ */ $(xe, { children: /* @__PURE__ */ $(
|
|
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
|
-
children: /* @__PURE__ */ $($e, {})
|
|
612
|
-
}
|
|
613
|
-
) });
|
|
614
|
-
};
|
|
615
|
-
ae.displayName = "Select.ClearButton";
|
|
616
|
-
const re = function({
|
|
617
|
-
ref: t,
|
|
618
|
-
children: a,
|
|
619
|
-
leadingElement: i,
|
|
620
|
-
isLoading: l,
|
|
621
|
-
isDisabled: b,
|
|
622
|
-
isClearable: m = !0,
|
|
623
|
-
...r
|
|
624
|
-
}) {
|
|
625
|
-
const c = E(null), u = rt(be(c, t)), o = ue({ recipe: ee }), [s, p] = o.splitVariantProps(r), [v, d] = te(p), x = {
|
|
626
|
-
...d,
|
|
627
|
-
isDisabled: l || b
|
|
628
|
-
};
|
|
629
|
-
return /* @__PURE__ */ $(yt, { asChild: !0, ref: u, ...s, ...v, children: /* @__PURE__ */ B(bt, { ...x, children: [
|
|
630
|
-
/* @__PURE__ */ B(fe.div, { position: "relative", children: [
|
|
631
|
-
/* @__PURE__ */ $(ht, { zIndex: 0, asChild: !0, children: /* @__PURE__ */ B(ve, { children: [
|
|
632
|
-
i && /* @__PURE__ */ $(gt, { asChild: !0, children: i }),
|
|
633
|
-
/* @__PURE__ */ $(xt, { asChild: !0, children: /* @__PURE__ */ $(pt, {}) })
|
|
634
|
-
] }) }),
|
|
635
|
-
/* @__PURE__ */ B(
|
|
636
|
-
A,
|
|
637
|
-
{
|
|
638
|
-
position: "absolute",
|
|
639
|
-
top: "0",
|
|
640
|
-
bottom: "0",
|
|
641
|
-
zIndex: 1,
|
|
642
|
-
right: "400",
|
|
643
|
-
pointerEvents: "none",
|
|
644
|
-
children: [
|
|
645
|
-
m && /* @__PURE__ */ $(A, { width: "600", my: "auto", children: /* @__PURE__ */ $(ae, {}) }),
|
|
646
|
-
/* @__PURE__ */ $(A, { my: "auto", w: "600", h: "600", pointerEvents: "none", children: /* @__PURE__ */ $(H, { color: "neutral.9", asChild: !0, m: "auto", w: "400", h: "400", children: l ? /* @__PURE__ */ $(H, { asChild: !0, animation: "spin", animationDuration: "slowest", children: /* @__PURE__ */ $(me, {}) }) : /* @__PURE__ */ $(pe, {}) }) })
|
|
647
|
-
]
|
|
648
|
-
}
|
|
649
|
-
)
|
|
650
|
-
] }),
|
|
651
|
-
/* @__PURE__ */ $(Se, { children: a })
|
|
652
|
-
] }) });
|
|
653
|
-
};
|
|
654
|
-
re.displayName = "Select.Root";
|
|
655
|
-
const oe = (e) => {
|
|
656
|
-
const { ref: t, ...a } = e, [i, l] = te(a);
|
|
657
|
-
return /* @__PURE__ */ $(St, { asChild: !0, ...i, children: /* @__PURE__ */ $(Ve, { ref: t, ...l }) });
|
|
658
|
-
};
|
|
659
|
-
oe.displayName = "Select.Options";
|
|
660
|
-
const ie = ({
|
|
661
|
-
ref: e,
|
|
662
|
-
...t
|
|
663
|
-
}) => /* @__PURE__ */ $(Pt, { asChild: !0, ref: e, children: /* @__PURE__ */ $(Be, { ...t }) });
|
|
664
|
-
ie.displayName = "Select.Option";
|
|
665
|
-
const ne = (e) => {
|
|
666
|
-
const { ref: t, label: a, items: i, children: l, ...b } = e;
|
|
667
|
-
if (i && typeof l != "function")
|
|
668
|
-
throw new Error(
|
|
669
|
-
'SelectOptionGroup: When "items" is provided, "children" must be a function'
|
|
670
|
-
);
|
|
671
|
-
return /* @__PURE__ */ B(Ee, { ref: t, ...b, children: [
|
|
672
|
-
/* @__PURE__ */ $(Ct, { asChild: !0, children: /* @__PURE__ */ $(ot, { children: a }) }),
|
|
673
|
-
i ? /* @__PURE__ */ $(Oe, { items: i, children: (m) => typeof l == "function" ? l(m) : null }) : l
|
|
674
|
-
] });
|
|
675
|
-
};
|
|
676
|
-
ne.displayName = "Select.OptionGroup";
|
|
677
|
-
const fl = {
|
|
678
|
-
Root: re,
|
|
679
|
-
Options: oe,
|
|
680
|
-
Option: ie,
|
|
681
|
-
OptionGroup: ne
|
|
682
|
-
};
|
|
683
|
-
export {
|
|
684
|
-
fl as S,
|
|
685
|
-
re as a,
|
|
686
|
-
oe as b,
|
|
687
|
-
ie as c,
|
|
688
|
-
ne as d
|
|
689
|
-
};
|
|
690
|
-
//# sourceMappingURL=select-CWttUH5b.es.js.map
|