@nubisco/ui 5.37.0 → 5.39.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.
Files changed (52) hide show
  1. package/dist/{AiProvider-CFTfot9P.js → AiProvider-BUU8NJPa.js} +1 -1
  2. package/dist/{AiProvider-DdMne4pp.cjs → AiProvider-CzcMQh78.cjs} +1 -1
  3. package/dist/{Blueprint-CrscH3bU.cjs → Blueprint-BUH7BNRk.cjs} +1 -1
  4. package/dist/{Blueprint-DGqjK9oB.js → Blueprint-Bqiyvbkg.js} +1 -1
  5. package/dist/ImagePicker-C2Kz4U4G.js +171 -0
  6. package/dist/ImagePicker-D6udeZN0.cjs +1 -0
  7. package/dist/{Pagination-CEASb9u_.cjs → Pagination-DxpwnXrE.cjs} +1 -1
  8. package/dist/{Pagination-DevdWGZK.js → Pagination-ZYbBPdqi.js} +1 -1
  9. package/dist/Select-CNetl2JU.js +548 -0
  10. package/dist/Select-Dz5XXNrc.cjs +1 -0
  11. package/dist/all.cjs +1 -1
  12. package/dist/all.mjs +23 -21
  13. package/dist/component-styles.json +6 -0
  14. package/dist/components/AiProvider.cjs +1 -1
  15. package/dist/components/AiProvider.mjs +1 -1
  16. package/dist/components/Blueprint.cjs +1 -1
  17. package/dist/components/Blueprint.mjs +1 -1
  18. package/dist/components/ImagePicker.cjs +1 -0
  19. package/dist/components/ImagePicker.d.ts +57 -0
  20. package/dist/components/ImagePicker.mjs +2 -0
  21. package/dist/components/ImagePicker.vue.d.ts +38 -0
  22. package/dist/components/ImagePicker.vue.d.ts.map +1 -0
  23. package/dist/components/Pagination.cjs +1 -1
  24. package/dist/components/Pagination.mjs +1 -1
  25. package/dist/components/Select.cjs +1 -1
  26. package/dist/components/Select.d.ts +11 -0
  27. package/dist/components/Select.mjs +1 -1
  28. package/dist/components/Select.vue.d.ts +3 -0
  29. package/dist/components/Select.vue.d.ts.map +1 -1
  30. package/dist/components/Walkthrough.cjs +1 -1
  31. package/dist/components/Walkthrough.mjs +1 -1
  32. package/dist/components/index.d.ts.map +1 -1
  33. package/dist/components/manifest.d.ts +1 -0
  34. package/dist/components/manifest.d.ts.map +1 -1
  35. package/dist/components/manifest.js +1 -0
  36. package/dist/global.d.ts +2 -0
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.mjs +16 -15
  39. package/dist/main.d.ts +1 -0
  40. package/dist/main.d.ts.map +1 -1
  41. package/dist/styles/ImagePicker.css +1 -0
  42. package/dist/styles/Select.css +1 -1
  43. package/dist/types.d.ts +1 -0
  44. package/dist/types.d.ts.map +1 -1
  45. package/dist/ui.css +3 -2
  46. package/package.json +2 -1
  47. package/dist/Select-Djtr68yO.js +0 -489
  48. package/dist/Select-tqEDoa5r.cjs +0 -1
  49. /package/dist/{Walkthrough-dQn9Scz1.js → Walkthrough-BmSzAV_b.js} +0 -0
  50. /package/dist/{Walkthrough-BVa1zCp4.cjs → Walkthrough-CV9RAizC.cjs} +0 -0
  51. /package/dist/{pixi-scene-DdcmrtpA.cjs → pixi-scene-DSMij-ex.cjs} +0 -0
  52. /package/dist/{pixi-scene-tM_RIArI.js → pixi-scene-Du_Uq_zl.js} +0 -0
@@ -1,489 +0,0 @@
1
- import { t as e } from "./Icon-rREAqsu0.js";
2
- import { t } from "./Grid-CJFQvcko.js";
3
- import { t as n } from "./Label-BEW_5nYq.js";
4
- import { t as r } from "./Message-DPv6St5M.js";
5
- import { useMenuSurface as i } from "./composables/useMenuSurface.composable.mjs";
6
- import { Fragment as a, Teleport as ee, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, h as te, nextTick as m, normalizeClass as h, normalizeStyle as ne, onBeforeUnmount as re, openBlock as g, ref as _, renderList as v, renderSlot as y, toDisplayString as b, unref as x, useId as ie, vModelText as ae, watch as oe, withCtx as S, withDirectives as se, withKeys as C, withModifiers as w } from "vue";
7
- import { regular as T } from "@nubisco/ui/icons/caret-down";
8
- import { regular as E } from "@nubisco/ui/icons/caret-up";
9
- import { regular as ce } from "@nubisco/ui/icons/x";
10
- //#region src/components/Select.vue?vue&type=script&setup=true&lang.ts
11
- var le = [
12
- "id",
13
- "aria-expanded",
14
- "aria-disabled",
15
- "aria-required",
16
- "disabled"
17
- ], ue = {
18
- key: 2,
19
- class: "nb-select__clear-space",
20
- "aria-hidden": "true"
21
- }, de = ["aria-label"], fe = [
22
- "id",
23
- "aria-expanded",
24
- "aria-disabled",
25
- "aria-required",
26
- "disabled"
27
- ], pe = {
28
- key: 1,
29
- class: "nb-select__inner-label"
30
- }, me = {
31
- key: 0,
32
- class: "nb-select__asterisk",
33
- "aria-hidden": "true"
34
- }, he = {
35
- key: 0,
36
- class: "nb-select__clear-space",
37
- "aria-hidden": "true"
38
- }, ge = ["aria-label"], _e = ["aria-multiselectable"], ve = ["aria-labelledby"], ye = ["id"], be = [
39
- "aria-selected",
40
- "aria-disabled",
41
- "onMouseenter",
42
- "onClick"
43
- ], xe = {
44
- key: 0,
45
- class: "nb-select__option-check",
46
- "aria-hidden": "true"
47
- }, Se = {
48
- key: 0,
49
- viewBox: "0 0 10 8",
50
- fill: "none",
51
- width: "10",
52
- height: "8"
53
- }, Ce = { class: "nb-select__option-label" }, we = {
54
- key: 0,
55
- class: "nb-select__empty"
56
- }, Te = ["placeholder", "onKeydown"], D = /* @__PURE__ */ p({
57
- __name: "Select",
58
- props: {
59
- modelValue: { default: null },
60
- options: { default: () => [] },
61
- multiple: {
62
- type: Boolean,
63
- default: !1
64
- },
65
- creatable: {
66
- type: Boolean,
67
- default: !1
68
- },
69
- createPlaceholder: { default: "" },
70
- clearable: {
71
- type: Boolean,
72
- default: !1
73
- },
74
- clearLabel: { default: "Clear selection" },
75
- placeholder: { default: "Select…" },
76
- name: { default: "" },
77
- disabled: {
78
- type: Boolean,
79
- default: !1
80
- },
81
- required: {
82
- type: Boolean,
83
- default: !1
84
- },
85
- id: { default: void 0 },
86
- label: { default: "" },
87
- error: { default: "" },
88
- warning: { default: "" },
89
- helper: { default: "" },
90
- variant: { default: "default" },
91
- size: { default: "md" }
92
- },
93
- emits: [
94
- "update:modelValue",
95
- "change",
96
- "create"
97
- ],
98
- setup(p, { expose: D, emit: Ee }) {
99
- let O = p, k = Ee, A = (e, { slots: t }) => e.wrap ? te("div", { class: "nb-select__control" }, t.default?.()) : t.default?.();
100
- A.props = ["wrap"];
101
- let j = _("");
102
- function De() {
103
- let e = j.value.trim();
104
- e && (k("create", e), j.value = "");
105
- }
106
- let M = _(!1), N = _(!1), P = _(-1), F = _(null), I = _(null), L = _(null);
107
- i(L);
108
- let R = _({
109
- position: "fixed",
110
- top: "0px",
111
- left: "0px",
112
- width: "0px",
113
- zIndex: "9999"
114
- }), Oe = `nb-select-${ie()}`, z = o(() => O.id ?? Oe), B = o(() => O.modelValue == null ? [] : Array.isArray(O.modelValue) ? O.modelValue : [O.modelValue]), V = o(() => {
115
- if (!(O.multiple || B.value.length !== 1)) return (O.options ?? []).find((e) => e.value === B.value[0])?.icon;
116
- }), H = o(() => {
117
- if (B.value.length === 0) return "";
118
- let e = O.options ?? [];
119
- return O.multiple ? B.value.length === 1 ? e.find((e) => e.value === B.value[0])?.label ?? String(B.value[0]) : B.value.length === 2 ? B.value.map((t) => e.find((e) => e.value === t)?.label ?? String(t)).join(", ") : `${B.value.length} selected` : e.find((e) => e.value === B.value[0])?.label ?? String(B.value[0]);
120
- });
121
- function U(e) {
122
- return B.value.includes(e);
123
- }
124
- let ke = o(() => {
125
- let e = [];
126
- return (O.options ?? []).forEach((t, n) => {
127
- let r = e[e.length - 1];
128
- (!r || r.name !== t.group) && e.push({
129
- key: `${e.length}:${t.group ?? ""}`,
130
- name: t.group,
131
- labelId: `${z.value}-group-${e.length}`,
132
- entries: []
133
- }), e[e.length - 1].entries.push({
134
- option: t,
135
- index: n
136
- });
137
- }), e;
138
- });
139
- function W(e, t) {
140
- let n = O.options ?? [];
141
- for (let r = e + t; r >= 0 && r < n.length; r += t) if (!n[r].disabled) return r;
142
- return e;
143
- }
144
- function G(e) {
145
- if (e.disabled) return;
146
- let t;
147
- if (O.multiple) {
148
- let n = [...B.value], r = n.indexOf(e.value);
149
- r >= 0 ? n.splice(r, 1) : n.push(e.value), t = n;
150
- } else t = e.value, J();
151
- k("update:modelValue", t), k("change", t);
152
- }
153
- function K() {
154
- if (!I.value) return;
155
- let e = I.value.getBoundingClientRect(), t = L.value?.offsetHeight ?? 0, n = window.innerHeight - e.bottom, r = e.top;
156
- R.value = {
157
- position: "fixed",
158
- top: t > 0 && n < t && r > n ? `${e.top - t}px` : `${e.bottom}px`,
159
- left: `${e.left}px`,
160
- width: `${e.width}px`,
161
- zIndex: "9999"
162
- };
163
- }
164
- function q() {
165
- if (O.disabled) return;
166
- M.value = !0, K();
167
- let e = O.options ?? [];
168
- P.value = B.value.length > 0 ? Math.max(0, e.findIndex((e) => e.value === B.value[0])) : -1, m(() => {
169
- K(), Z();
170
- });
171
- }
172
- function J() {
173
- M.value = !1, P.value = -1;
174
- }
175
- function Ae() {
176
- M.value ? J() : q();
177
- }
178
- function Y(e) {
179
- let t = e.target, n = F.value?.contains(t) ?? !1, r = L.value?.contains(t) ?? !1;
180
- !n && !r && J();
181
- }
182
- function X() {
183
- M.value && K();
184
- }
185
- oe(M, (e) => {
186
- e ? (document.addEventListener("mousedown", Y), window.addEventListener("scroll", X, !0), window.addEventListener("resize", X)) : (document.removeEventListener("mousedown", Y), window.removeEventListener("scroll", X, !0), window.removeEventListener("resize", X));
187
- }), re(() => {
188
- document.removeEventListener("mousedown", Y), window.removeEventListener("scroll", X, !0), window.removeEventListener("resize", X);
189
- });
190
- function je(e) {
191
- let t = O.options ?? [];
192
- if (!M.value) {
193
- (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), q());
194
- return;
195
- }
196
- e.key === "Escape" ? (J(), e.preventDefault()) : e.key === "Tab" ? J() : e.key === "ArrowDown" ? (e.preventDefault(), P.value = W(P.value, 1), Z()) : e.key === "ArrowUp" ? (e.preventDefault(), P.value > 0 && (P.value = W(P.value, -1)), Z()) : (e.key === "Enter" || e.key === " ") && P.value >= 0 && (e.preventDefault(), G(t[P.value]));
197
- }
198
- function Z() {
199
- m(() => {
200
- !L.value || P.value < 0 || L.value.querySelectorAll(".nb-select__option")[P.value]?.scrollIntoView({ block: "nearest" });
201
- });
202
- }
203
- let Q = o(() => O.clearable && !O.disabled && B.value.length > 0);
204
- function $() {
205
- let e = O.multiple ? [] : null;
206
- J(), k("update:modelValue", e), k("change", e), I.value?.focus();
207
- }
208
- let Me = o(() => [
209
- "nb-select",
210
- `nb-select--${O.variant}`,
211
- `nb-select--${O.size}`,
212
- {
213
- "nb-select--open": M.value,
214
- "nb-select--focused": N.value && !M.value,
215
- "nb-select--error": !!O.error,
216
- "nb-select--warning": !O.error && !!O.warning,
217
- "nb-select--multiple": O.multiple
218
- }
219
- ]);
220
- return D({
221
- open: q,
222
- close: J
223
- }), (i, o) => (g(), l(a, null, [u("div", {
224
- ref_key: "rootRef",
225
- ref: F,
226
- class: h(Me.value),
227
- onKeydown: je
228
- }, [p.variant === "default" ? (g(), l(a, { key: 0 }, [
229
- i.$slots.label ? y(i.$slots, "label", { key: 0 }) : p.label ? (g(), s(n, {
230
- key: 1,
231
- for: z.value,
232
- required: p.required,
233
- disabled: p.disabled
234
- }, {
235
- default: S(() => [d(b(p.label), 1)]),
236
- _: 1
237
- }, 8, [
238
- "for",
239
- "required",
240
- "disabled"
241
- ])) : c("", !0),
242
- f(A, { wrap: p.clearable }, {
243
- default: S(() => [u("button", {
244
- id: z.value,
245
- ref_key: "triggerRef",
246
- ref: I,
247
- type: "button",
248
- class: "nb-select__trigger",
249
- role: "combobox",
250
- "aria-expanded": M.value,
251
- "aria-haspopup": "listbox",
252
- "aria-disabled": p.disabled || void 0,
253
- "aria-required": p.required || void 0,
254
- disabled: p.disabled || void 0,
255
- onClick: Ae,
256
- onFocus: o[0] ||= (e) => N.value = !0,
257
- onBlur: o[1] ||= (e) => N.value = !1
258
- }, [
259
- u("span", { class: h(["nb-select__value", {
260
- "nb-select__value--placeholder": !H.value,
261
- "nb-select__value--with-icon": !!V.value
262
- }]) }, [V.value ? (g(), s(e, {
263
- key: 0,
264
- class: "nb-select__value-icon",
265
- name: V.value,
266
- size: 16
267
- }, null, 8, ["name"])) : c("", !0), H.value ? y(i.$slots, "value", {
268
- key: 1,
269
- values: B.value
270
- }, () => [d(b(H.value), 1)]) : (g(), l(a, { key: 2 }, [d(b(p.placeholder), 1)], 64))], 2),
271
- p.error ? (g(), s(r, {
272
- key: 0,
273
- variant: "error",
274
- "icon-only": !0,
275
- class: "nb-select__status-icon"
276
- }, {
277
- default: S(() => [d(b(p.error), 1)]),
278
- _: 1
279
- })) : p.warning ? (g(), s(r, {
280
- key: 1,
281
- variant: "warning",
282
- "icon-only": !0,
283
- class: "nb-select__status-icon"
284
- }, {
285
- default: S(() => [d(b(p.warning), 1)]),
286
- _: 1
287
- })) : c("", !0),
288
- Q.value ? (g(), l("span", ue)) : c("", !0),
289
- f(t, {
290
- align: "center",
291
- justify: "center",
292
- class: "nb-select__caret"
293
- }, {
294
- default: S(() => [f(e, {
295
- name: M.value ? x(E) : x(T),
296
- size: 16
297
- }, null, 8, ["name"])]),
298
- _: 1
299
- })
300
- ], 40, le), Q.value ? (g(), l("button", {
301
- key: 0,
302
- type: "button",
303
- class: "nb-select__clear",
304
- "aria-label": p.clearLabel,
305
- onClick: $,
306
- onKeydown: [o[2] ||= C(w(() => {}, ["stop"]), ["enter"]), o[3] ||= C(w(() => {}, ["stop"]), ["space"])]
307
- }, [f(e, {
308
- name: x(ce),
309
- size: 16
310
- }, null, 8, ["name"])], 40, de)) : c("", !0)]),
311
- _: 3
312
- }, 8, ["wrap"]),
313
- p.error ? (g(), s(r, {
314
- key: 2,
315
- variant: "error",
316
- class: "nb-select__message"
317
- }, {
318
- default: S(() => [d(b(p.error), 1)]),
319
- _: 1
320
- })) : p.warning ? (g(), s(r, {
321
- key: 3,
322
- variant: "warning",
323
- class: "nb-select__message"
324
- }, {
325
- default: S(() => [d(b(p.warning), 1)]),
326
- _: 1
327
- })) : p.helper ? (g(), s(r, {
328
- key: 4,
329
- variant: "helper",
330
- class: "nb-select__message"
331
- }, {
332
- default: S(() => [d(b(p.helper), 1)]),
333
- _: 1
334
- })) : c("", !0)
335
- ], 64)) : p.variant === "fluid" ? (g(), l(a, { key: 1 }, [f(A, { wrap: p.clearable }, {
336
- default: S(() => [u("button", {
337
- id: z.value,
338
- ref_key: "triggerRef",
339
- ref: I,
340
- type: "button",
341
- class: "nb-select__trigger",
342
- role: "combobox",
343
- "aria-expanded": M.value,
344
- "aria-haspopup": "listbox",
345
- "aria-disabled": p.disabled || void 0,
346
- "aria-required": p.required || void 0,
347
- disabled: p.disabled || void 0,
348
- onClick: Ae,
349
- onFocus: o[4] ||= (e) => N.value = !0,
350
- onBlur: o[5] ||= (e) => N.value = !1
351
- }, [p.label || i.$slots.label ? (g(), s(t, {
352
- key: 0,
353
- dir: "row",
354
- align: "center",
355
- gap: "xs",
356
- class: "nb-select__inner-header"
357
- }, {
358
- default: S(() => [i.$slots.label ? y(i.$slots, "label", { key: 0 }) : (g(), l("label", pe, [d(b(p.label) + " ", 1), p.required ? (g(), l("span", me, "*")) : c("", !0)])), p.helper && !p.error && !p.warning ? (g(), s(r, {
359
- key: 2,
360
- variant: "helper",
361
- "icon-only": !0,
362
- class: "nb-select__inner-message"
363
- }, {
364
- default: S(() => [d(b(p.helper), 1)]),
365
- _: 1
366
- })) : c("", !0)]),
367
- _: 3
368
- })) : c("", !0), f(t, {
369
- dir: "row",
370
- align: "end",
371
- flex: "",
372
- class: "nb-select__value-row"
373
- }, {
374
- default: S(() => [
375
- u("span", { class: h(["nb-select__value", {
376
- "nb-select__value--placeholder": !H.value,
377
- "nb-select__value--with-icon": !!V.value
378
- }]) }, [V.value ? (g(), s(e, {
379
- key: 0,
380
- class: "nb-select__value-icon",
381
- name: V.value,
382
- size: 16
383
- }, null, 8, ["name"])) : c("", !0), H.value ? y(i.$slots, "value", {
384
- key: 1,
385
- values: B.value
386
- }, () => [d(b(H.value), 1)]) : (g(), l(a, { key: 2 }, [d(b(p.placeholder), 1)], 64))], 2),
387
- Q.value ? (g(), l("span", he)) : c("", !0),
388
- f(t, {
389
- align: "center",
390
- justify: "center",
391
- class: "nb-select__caret"
392
- }, {
393
- default: S(() => [f(e, {
394
- name: M.value ? x(E) : x(T),
395
- size: 16
396
- }, null, 8, ["name"])]),
397
- _: 1
398
- })
399
- ]),
400
- _: 3
401
- })], 40, fe), Q.value ? (g(), l("button", {
402
- key: 0,
403
- type: "button",
404
- class: "nb-select__clear",
405
- "aria-label": p.clearLabel,
406
- onClick: $,
407
- onKeydown: [o[6] ||= C(w(() => {}, ["stop"]), ["enter"]), o[7] ||= C(w(() => {}, ["stop"]), ["space"])]
408
- }, [f(e, {
409
- name: x(ce),
410
- size: 16
411
- }, null, 8, ["name"])], 40, ge)) : c("", !0)]),
412
- _: 3
413
- }, 8, ["wrap"]), p.error ? (g(), s(r, {
414
- key: 0,
415
- variant: "error",
416
- class: "nb-select__fluid-message"
417
- }, {
418
- default: S(() => [d(b(p.error), 1)]),
419
- _: 1
420
- })) : p.warning ? (g(), s(r, {
421
- key: 1,
422
- variant: "warning",
423
- class: "nb-select__fluid-message"
424
- }, {
425
- default: S(() => [d(b(p.warning), 1)]),
426
- _: 1
427
- })) : c("", !0)], 64)) : c("", !0)], 34), (g(), s(ee, { to: "body" }, [M.value ? (g(), l("div", {
428
- key: 0,
429
- ref_key: "dropdownRef",
430
- ref: L,
431
- class: "nb-select__dropdown",
432
- style: ne(R.value),
433
- role: "listbox",
434
- "aria-multiselectable": p.multiple || void 0
435
- }, [
436
- (g(!0), l(a, null, v(ke.value, (t) => (g(), l("div", {
437
- key: t.key,
438
- class: "nb-select__group",
439
- role: "group",
440
- "aria-labelledby": t.name ? t.labelId : void 0
441
- }, [t.name ? (g(), l("div", {
442
- key: 0,
443
- id: t.labelId,
444
- class: "nb-select__group-label"
445
- }, b(t.name), 9, ye)) : c("", !0), (g(!0), l(a, null, v(t.entries, (t) => (g(), l("div", {
446
- key: t.option.value,
447
- class: h(["nb-select__option", {
448
- "nb-select__option--selected": U(t.option.value),
449
- "nb-select__option--highlighted": P.value === t.index,
450
- "nb-select__option--disabled": t.option.disabled
451
- }]),
452
- role: "option",
453
- "aria-selected": U(t.option.value),
454
- "aria-disabled": t.option.disabled || void 0,
455
- onMouseenter: (e) => P.value = t.index,
456
- onClick: (e) => G(t.option)
457
- }, [
458
- p.multiple ? (g(), l("span", xe, [U(t.option.value) ? (g(), l("svg", Se, [...o[11] ||= [u("path", {
459
- d: "M1 4l3 3 5-6",
460
- stroke: "currentColor",
461
- "stroke-width": "1.5",
462
- "stroke-linecap": "round",
463
- "stroke-linejoin": "round"
464
- }, null, -1)]])) : c("", !0)])) : c("", !0),
465
- t.option.icon ? (g(), s(e, {
466
- key: 1,
467
- class: "nb-select__option-icon",
468
- name: t.option.icon,
469
- size: 16
470
- }, null, 8, ["name"])) : c("", !0),
471
- u("span", Ce, [y(i.$slots, "option", { option: t.option }, () => [d(b(t.option.label), 1)])])
472
- ], 42, be))), 128))], 8, ve))), 128)),
473
- !p.options || p.options.length === 0 ? (g(), l("div", we, " No options ")) : c("", !0),
474
- p.creatable ? (g(), l("div", {
475
- key: 1,
476
- class: "nb-select__create",
477
- onMousedown: o[10] ||= w(() => {}, ["prevent"])
478
- }, [se(u("input", {
479
- "onUpdate:modelValue": o[8] ||= (e) => j.value = e,
480
- type: "text",
481
- class: "nb-select__create-input",
482
- placeholder: p.createPlaceholder || "Add new…",
483
- onKeydown: [C(w(De, ["prevent"]), ["enter"]), o[9] ||= w(() => {}, ["stop"])]
484
- }, null, 40, Te), [[ae, j.value]])], 32)) : c("", !0)
485
- ], 12, _e)) : c("", !0)]))], 64));
486
- }
487
- });
488
- //#endregion
489
- export { D as t };
@@ -1 +0,0 @@
1
- require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Icon-C8R_r_In.cjs`),t=require(`./Grid-CXE0B85G.cjs`),n=require(`./Label-71QAuWf4.cjs`),r=require(`./Message-vFr_gB2V.cjs`),i=require(`./composables/useMenuSurface.composable.cjs`);let a=require(`vue`),o=require(`@nubisco/ui/icons/caret-down`),s=require(`@nubisco/ui/icons/caret-up`),c=require(`@nubisco/ui/icons/x`);var l=[`id`,`aria-expanded`,`aria-disabled`,`aria-required`,`disabled`],u={key:2,class:`nb-select__clear-space`,"aria-hidden":`true`},d=[`aria-label`],f=[`id`,`aria-expanded`,`aria-disabled`,`aria-required`,`disabled`],p={key:1,class:`nb-select__inner-label`},m={key:0,class:`nb-select__asterisk`,"aria-hidden":`true`},h={key:0,class:`nb-select__clear-space`,"aria-hidden":`true`},g=[`aria-label`],_=[`aria-multiselectable`],v=[`aria-labelledby`],y=[`id`],b=[`aria-selected`,`aria-disabled`,`onMouseenter`,`onClick`],x={key:0,class:`nb-select__option-check`,"aria-hidden":`true`},ee={key:0,viewBox:`0 0 10 8`,fill:`none`,width:`10`,height:`8`},te={class:`nb-select__option-label`},ne={key:0,class:`nb-select__empty`},re=[`placeholder`,`onKeydown`],S=(0,a.defineComponent)({__name:`Select`,props:{modelValue:{default:null},options:{default:()=>[]},multiple:{type:Boolean,default:!1},creatable:{type:Boolean,default:!1},createPlaceholder:{default:``},clearable:{type:Boolean,default:!1},clearLabel:{default:`Clear selection`},placeholder:{default:`Select…`},name:{default:``},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},id:{default:void 0},label:{default:``},error:{default:``},warning:{default:``},helper:{default:``},variant:{default:`default`},size:{default:`md`}},emits:[`update:modelValue`,`change`,`create`],setup(S,{expose:C,emit:ie}){let w=S,T=ie,E=(e,{slots:t})=>e.wrap?(0,a.h)(`div`,{class:`nb-select__control`},t.default?.()):t.default?.();E.props=[`wrap`];let D=(0,a.ref)(``);function O(){let e=D.value.trim();e&&(T(`create`,e),D.value=``)}let k=(0,a.ref)(!1),A=(0,a.ref)(!1),j=(0,a.ref)(-1),M=(0,a.ref)(null),N=(0,a.ref)(null),P=(0,a.ref)(null);i.useMenuSurface(P);let F=(0,a.ref)({position:`fixed`,top:`0px`,left:`0px`,width:`0px`,zIndex:`9999`}),I=`nb-select-${(0,a.useId)()}`,L=(0,a.computed)(()=>w.id??I),R=(0,a.computed)(()=>w.modelValue==null?[]:Array.isArray(w.modelValue)?w.modelValue:[w.modelValue]),z=(0,a.computed)(()=>{if(!(w.multiple||R.value.length!==1))return(w.options??[]).find(e=>e.value===R.value[0])?.icon}),B=(0,a.computed)(()=>{if(R.value.length===0)return``;let e=w.options??[];return w.multiple?R.value.length===1?e.find(e=>e.value===R.value[0])?.label??String(R.value[0]):R.value.length===2?R.value.map(t=>e.find(e=>e.value===t)?.label??String(t)).join(`, `):`${R.value.length} selected`:e.find(e=>e.value===R.value[0])?.label??String(R.value[0])});function V(e){return R.value.includes(e)}let H=(0,a.computed)(()=>{let e=[];return(w.options??[]).forEach((t,n)=>{let r=e[e.length-1];(!r||r.name!==t.group)&&e.push({key:`${e.length}:${t.group??``}`,name:t.group,labelId:`${L.value}-group-${e.length}`,entries:[]}),e[e.length-1].entries.push({option:t,index:n})}),e});function U(e,t){let n=w.options??[];for(let r=e+t;r>=0&&r<n.length;r+=t)if(!n[r].disabled)return r;return e}function W(e){if(e.disabled)return;let t;if(w.multiple){let n=[...R.value],r=n.indexOf(e.value);r>=0?n.splice(r,1):n.push(e.value),t=n}else t=e.value,q();T(`update:modelValue`,t),T(`change`,t)}function G(){if(!N.value)return;let e=N.value.getBoundingClientRect(),t=P.value?.offsetHeight??0,n=window.innerHeight-e.bottom,r=e.top;F.value={position:`fixed`,top:t>0&&n<t&&r>n?`${e.top-t}px`:`${e.bottom}px`,left:`${e.left}px`,width:`${e.width}px`,zIndex:`9999`}}function K(){if(w.disabled)return;k.value=!0,G();let e=w.options??[];j.value=R.value.length>0?Math.max(0,e.findIndex(e=>e.value===R.value[0])):-1,(0,a.nextTick)(()=>{G(),Z()})}function q(){k.value=!1,j.value=-1}function J(){k.value?q():K()}function Y(e){let t=e.target,n=M.value?.contains(t)??!1,r=P.value?.contains(t)??!1;!n&&!r&&q()}function X(){k.value&&G()}(0,a.watch)(k,e=>{e?(document.addEventListener(`mousedown`,Y),window.addEventListener(`scroll`,X,!0),window.addEventListener(`resize`,X)):(document.removeEventListener(`mousedown`,Y),window.removeEventListener(`scroll`,X,!0),window.removeEventListener(`resize`,X))}),(0,a.onBeforeUnmount)(()=>{document.removeEventListener(`mousedown`,Y),window.removeEventListener(`scroll`,X,!0),window.removeEventListener(`resize`,X)});function ae(e){let t=w.options??[];if(!k.value){(e.key===`Enter`||e.key===` `||e.key===`ArrowDown`)&&(e.preventDefault(),K());return}e.key===`Escape`?(q(),e.preventDefault()):e.key===`Tab`?q():e.key===`ArrowDown`?(e.preventDefault(),j.value=U(j.value,1),Z()):e.key===`ArrowUp`?(e.preventDefault(),j.value>0&&(j.value=U(j.value,-1)),Z()):(e.key===`Enter`||e.key===` `)&&j.value>=0&&(e.preventDefault(),W(t[j.value]))}function Z(){(0,a.nextTick)(()=>{!P.value||j.value<0||P.value.querySelectorAll(`.nb-select__option`)[j.value]?.scrollIntoView({block:`nearest`})})}let Q=(0,a.computed)(()=>w.clearable&&!w.disabled&&R.value.length>0);function $(){let e=w.multiple?[]:null;q(),T(`update:modelValue`,e),T(`change`,e),N.value?.focus()}let oe=(0,a.computed)(()=>[`nb-select`,`nb-select--${w.variant}`,`nb-select--${w.size}`,{"nb-select--open":k.value,"nb-select--focused":A.value&&!k.value,"nb-select--error":!!w.error,"nb-select--warning":!w.error&&!!w.warning,"nb-select--multiple":w.multiple}]);return C({open:K,close:q}),(i,C)=>((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,null,[(0,a.createElementVNode)(`div`,{ref_key:`rootRef`,ref:M,class:(0,a.normalizeClass)(oe.value),onKeydown:ae},[S.variant===`default`?((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:0},[i.$slots.label?(0,a.renderSlot)(i.$slots,`label`,{key:0}):S.label?((0,a.openBlock)(),(0,a.createBlock)(n.t,{key:1,for:L.value,required:S.required,disabled:S.disabled},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(S.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,a.createCommentVNode)(``,!0),(0,a.createVNode)(E,{wrap:S.clearable},{default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`button`,{id:L.value,ref_key:`triggerRef`,ref:N,type:`button`,class:`nb-select__trigger`,role:`combobox`,"aria-expanded":k.value,"aria-haspopup":`listbox`,"aria-disabled":S.disabled||void 0,"aria-required":S.required||void 0,disabled:S.disabled||void 0,onClick:J,onFocus:C[0]||=e=>A.value=!0,onBlur:C[1]||=e=>A.value=!1},[(0,a.createElementVNode)(`span`,{class:(0,a.normalizeClass)([`nb-select__value`,{"nb-select__value--placeholder":!B.value,"nb-select__value--with-icon":!!z.value}])},[z.value?((0,a.openBlock)(),(0,a.createBlock)(e.t,{key:0,class:`nb-select__value-icon`,name:z.value,size:16},null,8,[`name`])):(0,a.createCommentVNode)(``,!0),B.value?(0,a.renderSlot)(i.$slots,`value`,{key:1,values:R.value},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(B.value),1)]):((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:2},[(0,a.createTextVNode)((0,a.toDisplayString)(S.placeholder),1)],64))],2),S.error?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:0,variant:`error`,"icon-only":!0,class:`nb-select__status-icon`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(S.error),1)]),_:1})):S.warning?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:1,variant:`warning`,"icon-only":!0,class:`nb-select__status-icon`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(S.warning),1)]),_:1})):(0,a.createCommentVNode)(``,!0),Q.value?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,u)):(0,a.createCommentVNode)(``,!0),(0,a.createVNode)(t.t,{align:`center`,justify:`center`,class:`nb-select__caret`},{default:(0,a.withCtx)(()=>[(0,a.createVNode)(e.t,{name:k.value?(0,a.unref)(s.regular):(0,a.unref)(o.regular),size:16},null,8,[`name`])]),_:1})],40,l),Q.value?((0,a.openBlock)(),(0,a.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-select__clear`,"aria-label":S.clearLabel,onClick:$,onKeydown:[C[2]||=(0,a.withKeys)((0,a.withModifiers)(()=>{},[`stop`]),[`enter`]),C[3]||=(0,a.withKeys)((0,a.withModifiers)(()=>{},[`stop`]),[`space`])]},[(0,a.createVNode)(e.t,{name:(0,a.unref)(c.regular),size:16},null,8,[`name`])],40,d)):(0,a.createCommentVNode)(``,!0)]),_:3},8,[`wrap`]),S.error?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:2,variant:`error`,class:`nb-select__message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(S.error),1)]),_:1})):S.warning?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:3,variant:`warning`,class:`nb-select__message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(S.warning),1)]),_:1})):S.helper?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:4,variant:`helper`,class:`nb-select__message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(S.helper),1)]),_:1})):(0,a.createCommentVNode)(``,!0)],64)):S.variant===`fluid`?((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:1},[(0,a.createVNode)(E,{wrap:S.clearable},{default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`button`,{id:L.value,ref_key:`triggerRef`,ref:N,type:`button`,class:`nb-select__trigger`,role:`combobox`,"aria-expanded":k.value,"aria-haspopup":`listbox`,"aria-disabled":S.disabled||void 0,"aria-required":S.required||void 0,disabled:S.disabled||void 0,onClick:J,onFocus:C[4]||=e=>A.value=!0,onBlur:C[5]||=e=>A.value=!1},[S.label||i.$slots.label?((0,a.openBlock)(),(0,a.createBlock)(t.t,{key:0,dir:`row`,align:`center`,gap:`xs`,class:`nb-select__inner-header`},{default:(0,a.withCtx)(()=>[i.$slots.label?(0,a.renderSlot)(i.$slots,`label`,{key:0}):((0,a.openBlock)(),(0,a.createElementBlock)(`label`,p,[(0,a.createTextVNode)((0,a.toDisplayString)(S.label)+` `,1),S.required?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,m,`*`)):(0,a.createCommentVNode)(``,!0)])),S.helper&&!S.error&&!S.warning?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:2,variant:`helper`,"icon-only":!0,class:`nb-select__inner-message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(S.helper),1)]),_:1})):(0,a.createCommentVNode)(``,!0)]),_:3})):(0,a.createCommentVNode)(``,!0),(0,a.createVNode)(t.t,{dir:`row`,align:`end`,flex:``,class:`nb-select__value-row`},{default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`span`,{class:(0,a.normalizeClass)([`nb-select__value`,{"nb-select__value--placeholder":!B.value,"nb-select__value--with-icon":!!z.value}])},[z.value?((0,a.openBlock)(),(0,a.createBlock)(e.t,{key:0,class:`nb-select__value-icon`,name:z.value,size:16},null,8,[`name`])):(0,a.createCommentVNode)(``,!0),B.value?(0,a.renderSlot)(i.$slots,`value`,{key:1,values:R.value},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(B.value),1)]):((0,a.openBlock)(),(0,a.createElementBlock)(a.Fragment,{key:2},[(0,a.createTextVNode)((0,a.toDisplayString)(S.placeholder),1)],64))],2),Q.value?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,h)):(0,a.createCommentVNode)(``,!0),(0,a.createVNode)(t.t,{align:`center`,justify:`center`,class:`nb-select__caret`},{default:(0,a.withCtx)(()=>[(0,a.createVNode)(e.t,{name:k.value?(0,a.unref)(s.regular):(0,a.unref)(o.regular),size:16},null,8,[`name`])]),_:1})]),_:3})],40,f),Q.value?((0,a.openBlock)(),(0,a.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-select__clear`,"aria-label":S.clearLabel,onClick:$,onKeydown:[C[6]||=(0,a.withKeys)((0,a.withModifiers)(()=>{},[`stop`]),[`enter`]),C[7]||=(0,a.withKeys)((0,a.withModifiers)(()=>{},[`stop`]),[`space`])]},[(0,a.createVNode)(e.t,{name:(0,a.unref)(c.regular),size:16},null,8,[`name`])],40,g)):(0,a.createCommentVNode)(``,!0)]),_:3},8,[`wrap`]),S.error?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:0,variant:`error`,class:`nb-select__fluid-message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(S.error),1)]),_:1})):S.warning?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:1,variant:`warning`,class:`nb-select__fluid-message`},{default:(0,a.withCtx)(()=>[(0,a.createTextVNode)((0,a.toDisplayString)(S.warning),1)]),_:1})):(0,a.createCommentVNode)(``,!0)],64)):(0,a.createCommentVNode)(``,!0)],34),((0,a.openBlock)(),(0,a.createBlock)(a.Teleport,{to:`body`},[k.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:0,ref_key:`dropdownRef`,ref:P,class:`nb-select__dropdown`,style:(0,a.normalizeStyle)(F.value),role:`listbox`,"aria-multiselectable":S.multiple||void 0},[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(H.value,t=>((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:t.key,class:`nb-select__group`,role:`group`,"aria-labelledby":t.name?t.labelId:void 0},[t.name?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:0,id:t.labelId,class:`nb-select__group-label`},(0,a.toDisplayString)(t.name),9,y)):(0,a.createCommentVNode)(``,!0),((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(t.entries,t=>((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:t.option.value,class:(0,a.normalizeClass)([`nb-select__option`,{"nb-select__option--selected":V(t.option.value),"nb-select__option--highlighted":j.value===t.index,"nb-select__option--disabled":t.option.disabled}]),role:`option`,"aria-selected":V(t.option.value),"aria-disabled":t.option.disabled||void 0,onMouseenter:e=>j.value=t.index,onClick:e=>W(t.option)},[S.multiple?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,x,[V(t.option.value)?((0,a.openBlock)(),(0,a.createElementBlock)(`svg`,ee,[...C[11]||=[(0,a.createElementVNode)(`path`,{d:`M1 4l3 3 5-6`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,-1)]])):(0,a.createCommentVNode)(``,!0)])):(0,a.createCommentVNode)(``,!0),t.option.icon?((0,a.openBlock)(),(0,a.createBlock)(e.t,{key:1,class:`nb-select__option-icon`,name:t.option.icon,size:16},null,8,[`name`])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`span`,te,[(0,a.renderSlot)(i.$slots,`option`,{option:t.option},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(t.option.label),1)])])],42,b))),128))],8,v))),128)),!S.options||S.options.length===0?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,ne,` No options `)):(0,a.createCommentVNode)(``,!0),S.creatable?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:1,class:`nb-select__create`,onMousedown:C[10]||=(0,a.withModifiers)(()=>{},[`prevent`])},[(0,a.withDirectives)((0,a.createElementVNode)(`input`,{"onUpdate:modelValue":C[8]||=e=>D.value=e,type:`text`,class:`nb-select__create-input`,placeholder:S.createPlaceholder||`Add new…`,onKeydown:[(0,a.withKeys)((0,a.withModifiers)(O,[`prevent`]),[`enter`]),C[9]||=(0,a.withModifiers)(()=>{},[`stop`])]},null,40,re),[[a.vModelText,D.value]])],32)):(0,a.createCommentVNode)(``,!0)],12,_)):(0,a.createCommentVNode)(``,!0)]))],64))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return S}});