@nubisco/ui 5.50.0 → 5.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AiProvider-BLGmpN6e.cjs → AiProvider-C5PGq8_N.cjs} +1 -1
- package/dist/{AiProvider-BY5kxf6u.js → AiProvider-DkRd4Oee.js} +2 -2
- package/dist/{Breadcrumbs-CQsziZK3.js → Breadcrumbs-8VM5XZTT.js} +1 -1
- package/dist/{Breadcrumbs-CCPzuiiv.cjs → Breadcrumbs-avQltgRZ.cjs} +1 -1
- package/dist/{Confirm-CZNS6FNr.js → Confirm-Bsf8R78g.js} +1 -1
- package/dist/{Confirm-DbrEaYlJ.cjs → Confirm-YFZK3eSw.cjs} +1 -1
- package/dist/{DatePicker-fS84mRE6.js → DatePicker-DPTMT52Y.js} +94 -90
- package/dist/DatePicker-DShl7pkk.cjs +1 -0
- package/dist/NumberInput-BNlXW5XD.cjs +1 -0
- package/dist/{NumberInput-B-TvTlXI.js → NumberInput-BgrIXtsT.js} +50 -50
- package/dist/{Pagination-DypRMTsC.cjs → Pagination-5qvBYkmf.cjs} +1 -1
- package/dist/{Pagination-CUat0BVv.js → Pagination-BTvOfCJG.js} +1 -1
- package/dist/{Search-CfH1Q9GB.cjs → Search-CQlcMCZ0.cjs} +1 -1
- package/dist/{Search-BnGuTcHp.js → Search-Cj9aSYg2.js} +1 -1
- package/dist/{Select-BxPZtw_Q.js → Select-DUAPhMYG.js} +171 -162
- package/dist/Select-dAsXp4vb.cjs +1 -0
- package/dist/{Slider-D3YgGPcY.cjs → Slider-CYYnC2N6.cjs} +1 -1
- package/dist/{Slider-BP-oEeJs.js → Slider-DjPICUZY.js} +1 -1
- package/dist/Submenu-BabY14Vm.cjs +1 -0
- package/dist/Submenu-DOzhF4BM.js +164 -0
- package/dist/{TextInput-BVTKUEey.cjs → TextInput-BTPC7DyL.cjs} +1 -1
- package/dist/{TextInput-DqaVhKud.js → TextInput-CYhPkNwH.js} +2 -2
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +11 -11
- package/dist/components/AiProvider.cjs +1 -1
- package/dist/components/AiProvider.mjs +1 -1
- package/dist/components/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs.mjs +1 -1
- package/dist/components/Confirm.cjs +1 -1
- package/dist/components/Confirm.mjs +1 -1
- package/dist/components/DatePicker.cjs +1 -1
- package/dist/components/DatePicker.mjs +1 -1
- package/dist/components/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/Menu.d.ts +7 -0
- package/dist/components/NumberInput.cjs +1 -1
- package/dist/components/NumberInput.mjs +1 -1
- package/dist/components/NumberInput.vue.d.ts.map +1 -1
- package/dist/components/Pagination.cjs +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Search.cjs +1 -1
- package/dist/components/Search.mjs +1 -1
- package/dist/components/Select.cjs +1 -1
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Select.vue.d.ts +1 -0
- package/dist/components/Select.vue.d.ts.map +1 -1
- package/dist/components/Slider.cjs +1 -1
- package/dist/components/Slider.mjs +1 -1
- package/dist/components/Submenu.cjs +1 -1
- package/dist/components/Submenu.mjs +1 -1
- package/dist/components/Submenu.vue.d.ts +1 -0
- package/dist/components/Submenu.vue.d.ts.map +1 -1
- package/dist/components/TextInput.cjs +1 -1
- package/dist/components/TextInput.mjs +1 -1
- package/dist/components/TextInput.vue.d.ts.map +1 -1
- package/dist/composables/useConfirm.composable.cjs +1 -1
- package/dist/composables/useConfirm.composable.mjs +1 -1
- package/dist/composables/useNbStrings.composable.cjs +1 -1
- package/dist/composables/useNbStrings.composable.d.ts +2 -0
- package/dist/composables/useNbStrings.composable.d.ts.map +1 -1
- package/dist/composables/useNbStrings.composable.mjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +11 -11
- package/dist/styles/NumberInput.css +1 -1
- package/dist/styles/TextInput.css +1 -1
- package/dist/ui.css +2 -2
- package/package.json +2 -2
- package/dist/DatePicker-Du21bjhe.cjs +0 -1
- package/dist/NumberInput-DaZI9hc3.cjs +0 -1
- package/dist/Select-uwMyqZ2S.cjs +0 -1
- package/dist/Submenu-DRkHiWsD.cjs +0 -1
- package/dist/Submenu-Dnj5MiFy.js +0 -149
|
@@ -15,6 +15,8 @@ import { regular as ye } from "@nubisco/ui/icons/x";
|
|
|
15
15
|
var be = [
|
|
16
16
|
"id",
|
|
17
17
|
"aria-expanded",
|
|
18
|
+
"aria-controls",
|
|
19
|
+
"aria-activedescendant",
|
|
18
20
|
"aria-disabled",
|
|
19
21
|
"aria-required",
|
|
20
22
|
"aria-invalid",
|
|
@@ -27,6 +29,8 @@ var be = [
|
|
|
27
29
|
}, Se = [
|
|
28
30
|
"id",
|
|
29
31
|
"aria-expanded",
|
|
32
|
+
"aria-controls",
|
|
33
|
+
"aria-activedescendant",
|
|
30
34
|
"aria-disabled",
|
|
31
35
|
"aria-required",
|
|
32
36
|
"aria-invalid",
|
|
@@ -128,37 +132,37 @@ var be = [
|
|
|
128
132
|
"create"
|
|
129
133
|
],
|
|
130
134
|
setup(h, { expose: Re, emit: ze }) {
|
|
131
|
-
let T = h, E = ze,
|
|
132
|
-
|
|
133
|
-
let
|
|
134
|
-
function
|
|
135
|
-
let e =
|
|
136
|
-
e && (E("create", e),
|
|
135
|
+
let T = h, E = ze, Be = (e, { slots: t }) => e.wrap ? ae("div", { class: "nb-select__control" }, t.default?.()) : t.default?.();
|
|
136
|
+
Be.props = ["wrap"];
|
|
137
|
+
let D = v(""), O = v(""), Ve = v(null);
|
|
138
|
+
function He() {
|
|
139
|
+
let e = D.value.trim();
|
|
140
|
+
e && (E("create", e), D.value = "");
|
|
137
141
|
}
|
|
138
|
-
let
|
|
139
|
-
function
|
|
140
|
-
(
|
|
142
|
+
let k = v(!1), A = v(!1), j = v(-1), M = v(null), N = v(null), Ue = pe(), We = () => (typeof T.anchor == "function" ? T.anchor() : T.anchor) ?? N.value ?? M.value;
|
|
143
|
+
function Ge() {
|
|
144
|
+
(N.value ?? M.value?.querySelector("button, [tabindex]"))?.focus();
|
|
141
145
|
}
|
|
142
|
-
let
|
|
143
|
-
ne(
|
|
144
|
-
let
|
|
146
|
+
let P = v(null);
|
|
147
|
+
ne(P);
|
|
148
|
+
let Ke = v({
|
|
145
149
|
position: "fixed",
|
|
146
150
|
top: "0px",
|
|
147
151
|
left: "0px",
|
|
148
152
|
width: "0px",
|
|
149
153
|
zIndex: "9999"
|
|
150
|
-
}),
|
|
151
|
-
if (!(T.multiple ||
|
|
152
|
-
}),
|
|
153
|
-
if (
|
|
154
|
+
}), F = te(T, `nb-select-${fe()}`), I = F.id, L = F.disabled, R = F.grouped, { ids: z, messageId: qe, invalid: Je, live: B, key: V } = ee(T, I), Ye = c(() => o(R ? void 0 : qe.value, F.describedBy.value)), Xe = c(() => Je.value ?? (F.status.value === "error" ? "true" : void 0)), Ze = c(() => !R && !!T.error || F.status.value === "error"), H = c(() => `${I.value}-listbox`), U = (e) => `${I.value}-option-${e}`, W = c(() => k.value && !T.searchable && j.value >= 0 ? U(j.value) : void 0), G = c(() => T.modelValue == null ? [] : Array.isArray(T.modelValue) ? T.modelValue : [T.modelValue]), K = c(() => {
|
|
155
|
+
if (!(T.multiple || G.value.length !== 1)) return (T.options ?? []).find((e) => e.value === G.value[0])?.icon;
|
|
156
|
+
}), q = c(() => {
|
|
157
|
+
if (G.value.length === 0) return "";
|
|
154
158
|
let e = T.options ?? [];
|
|
155
|
-
return T.multiple ?
|
|
159
|
+
return T.multiple ? G.value.length === 1 ? e.find((e) => e.value === G.value[0])?.label ?? String(G.value[0]) : G.value.length === 2 ? G.value.map((t) => e.find((e) => e.value === t)?.label ?? String(t)).join(", ") : `${G.value.length} selected` : e.find((e) => e.value === G.value[0])?.label ?? String(G.value[0]);
|
|
156
160
|
});
|
|
157
161
|
function Qe(e) {
|
|
158
|
-
return
|
|
162
|
+
return G.value.includes(e);
|
|
159
163
|
}
|
|
160
164
|
let $e = (e) => e.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase(), et = c(() => {
|
|
161
|
-
let e = T.options ?? [], t = T.searchable ? $e(
|
|
165
|
+
let e = T.options ?? [], t = T.searchable ? $e(O.value.trim()) : "", n = /* @__PURE__ */ new Set();
|
|
162
166
|
return e.forEach((e, r) => {
|
|
163
167
|
(!t || $e(e.label).includes(t)) && n.add(r);
|
|
164
168
|
}), n;
|
|
@@ -170,7 +174,7 @@ var be = [
|
|
|
170
174
|
(!r || r.name !== t.group) && e.push({
|
|
171
175
|
key: `${e.length}:${t.group ?? ""}`,
|
|
172
176
|
name: t.group,
|
|
173
|
-
labelId: `${
|
|
177
|
+
labelId: `${I.value}-group-${e.length}`,
|
|
174
178
|
entries: []
|
|
175
179
|
}), e[e.length - 1].entries.push({
|
|
176
180
|
option: t,
|
|
@@ -187,16 +191,16 @@ var be = [
|
|
|
187
191
|
if (e.disabled) return;
|
|
188
192
|
let t;
|
|
189
193
|
if (T.multiple) {
|
|
190
|
-
let n = [...
|
|
194
|
+
let n = [...G.value], r = n.indexOf(e.value);
|
|
191
195
|
r >= 0 ? n.splice(r, 1) : n.push(e.value), t = n;
|
|
192
|
-
} else t = e.value,
|
|
196
|
+
} else t = e.value, Y();
|
|
193
197
|
E("update:modelValue", t), E("change", t);
|
|
194
198
|
}
|
|
195
199
|
function it() {
|
|
196
|
-
let e =
|
|
200
|
+
let e = We();
|
|
197
201
|
if (!e) return;
|
|
198
|
-
let t = e.getBoundingClientRect(), n =
|
|
199
|
-
|
|
202
|
+
let t = e.getBoundingClientRect(), n = P.value?.offsetHeight ?? 0, r = window.innerHeight - t.bottom, i = t.top, a = n > 0 && r < n && i > r, o = Ue.trigger ? Math.max(t.width, 240) : t.width, ee = Ue.trigger ? Math.max(8, Math.min(t.left, window.innerWidth - o - 8)) : t.left;
|
|
203
|
+
Ke.value = {
|
|
200
204
|
position: "fixed",
|
|
201
205
|
top: a ? `${t.top - n}px` : `${t.bottom}px`,
|
|
202
206
|
left: `${ee}px`,
|
|
@@ -204,52 +208,52 @@ var be = [
|
|
|
204
208
|
zIndex: "9999"
|
|
205
209
|
};
|
|
206
210
|
}
|
|
207
|
-
function
|
|
208
|
-
if (
|
|
209
|
-
|
|
211
|
+
function J() {
|
|
212
|
+
if (L.value) return;
|
|
213
|
+
k.value = !0, it();
|
|
210
214
|
let e = T.options ?? [];
|
|
211
|
-
|
|
212
|
-
it(), Q(),
|
|
215
|
+
j.value = G.value.length > 0 ? Math.max(0, e.findIndex((e) => e.value === G.value[0])) : -1, se(() => {
|
|
216
|
+
it(), Q(), Ve.value?.focus({ preventScroll: !0 });
|
|
213
217
|
});
|
|
214
218
|
}
|
|
215
|
-
function J() {
|
|
216
|
-
let e = !!I.value?.contains(document.activeElement);
|
|
217
|
-
A.value = !1, M.value = -1, k.value = "", e && Ue();
|
|
218
|
-
}
|
|
219
219
|
function Y() {
|
|
220
|
-
|
|
220
|
+
let e = !!P.value?.contains(document.activeElement);
|
|
221
|
+
k.value = !1, j.value = -1, O.value = "", e && Ge();
|
|
222
|
+
}
|
|
223
|
+
function X() {
|
|
224
|
+
k.value ? Y() : J();
|
|
221
225
|
}
|
|
222
|
-
function
|
|
223
|
-
let t = e.target, n =
|
|
224
|
-
!n && !r &&
|
|
226
|
+
function at(e) {
|
|
227
|
+
let t = e.target, n = M.value?.contains(t) ?? !1, r = P.value?.contains(t) ?? !1;
|
|
228
|
+
!n && !r && Y();
|
|
225
229
|
}
|
|
226
230
|
function Z() {
|
|
227
|
-
|
|
231
|
+
k.value && it();
|
|
228
232
|
}
|
|
229
|
-
he(
|
|
230
|
-
e ? (document.addEventListener("mousedown",
|
|
233
|
+
he(k, (e) => {
|
|
234
|
+
e ? (document.addEventListener("mousedown", at), window.addEventListener("scroll", Z, !0), window.addEventListener("resize", Z)) : (document.removeEventListener("mousedown", at), window.removeEventListener("scroll", Z, !0), window.removeEventListener("resize", Z));
|
|
231
235
|
}), ue(() => {
|
|
232
|
-
document.removeEventListener("mousedown",
|
|
236
|
+
document.removeEventListener("mousedown", at), window.removeEventListener("scroll", Z, !0), window.removeEventListener("resize", Z);
|
|
233
237
|
});
|
|
234
|
-
function
|
|
238
|
+
function ot(e) {
|
|
235
239
|
let t = T.options ?? [];
|
|
236
|
-
if (!
|
|
237
|
-
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(),
|
|
240
|
+
if (!k.value) {
|
|
241
|
+
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), J());
|
|
238
242
|
return;
|
|
239
243
|
}
|
|
240
|
-
e.key === "Escape" ? (
|
|
244
|
+
e.key === "Escape" ? (Y(), e.preventDefault()) : e.key === "Tab" ? Y() : e.key === "ArrowDown" ? (e.preventDefault(), j.value = nt(j.value, 1), Q()) : e.key === "ArrowUp" ? (e.preventDefault(), j.value > 0 && (j.value = nt(j.value, -1)), Q()) : (e.key === "Enter" || e.key === " ") && j.value >= 0 && (e.preventDefault(), rt(t[j.value]));
|
|
241
245
|
}
|
|
242
246
|
function Q() {
|
|
243
247
|
se(() => {
|
|
244
|
-
!
|
|
248
|
+
!P.value || j.value < 0 || P.value.querySelector(`[data-index="${j.value}"]`)?.scrollIntoView({ block: "nearest" });
|
|
245
249
|
});
|
|
246
250
|
}
|
|
247
|
-
he(
|
|
248
|
-
if (!
|
|
251
|
+
he(O, () => {
|
|
252
|
+
if (!k.value) return;
|
|
249
253
|
let e = nt(-1, 1);
|
|
250
|
-
|
|
254
|
+
j.value = e === -1 ? -1 : e, Q();
|
|
251
255
|
});
|
|
252
|
-
function
|
|
256
|
+
function st(e) {
|
|
253
257
|
if (e.key === " ") {
|
|
254
258
|
e.stopPropagation();
|
|
255
259
|
return;
|
|
@@ -258,52 +262,53 @@ var be = [
|
|
|
258
262
|
e.stopPropagation();
|
|
259
263
|
return;
|
|
260
264
|
}
|
|
261
|
-
|
|
265
|
+
ot(e);
|
|
262
266
|
}
|
|
263
|
-
let
|
|
264
|
-
isOpen:
|
|
265
|
-
toggle:
|
|
266
|
-
open:
|
|
267
|
-
close:
|
|
267
|
+
let ct = c(() => ({
|
|
268
|
+
isOpen: k.value,
|
|
269
|
+
toggle: X,
|
|
270
|
+
open: J,
|
|
271
|
+
close: Y,
|
|
268
272
|
attrs: {
|
|
269
|
-
"aria-expanded":
|
|
273
|
+
"aria-expanded": k.value,
|
|
270
274
|
"aria-haspopup": "listbox",
|
|
271
|
-
"aria-controls":
|
|
272
|
-
"aria-
|
|
273
|
-
|
|
275
|
+
"aria-controls": k.value ? H.value : void 0,
|
|
276
|
+
"aria-activedescendant": W.value,
|
|
277
|
+
"aria-invalid": Je.value,
|
|
278
|
+
onClick: X
|
|
274
279
|
}
|
|
275
|
-
})),
|
|
276
|
-
function
|
|
280
|
+
})), lt = n(), ut = c(() => T.clearLabel ?? lt.value.selectClear), $ = c(() => T.clearable && !L.value && G.value.length > 0);
|
|
281
|
+
function dt() {
|
|
277
282
|
let e = T.multiple ? [] : null;
|
|
278
|
-
|
|
283
|
+
Y(), E("update:modelValue", e), E("change", e), Ge();
|
|
279
284
|
}
|
|
280
|
-
let
|
|
285
|
+
let ft = c(() => [
|
|
281
286
|
"nb-select",
|
|
282
287
|
`nb-select--${T.variant}`,
|
|
283
|
-
`nb-select--${
|
|
288
|
+
`nb-select--${F.size.value}`,
|
|
284
289
|
{
|
|
285
|
-
"nb-select--open":
|
|
286
|
-
"nb-select--focused":
|
|
287
|
-
"nb-select--error":
|
|
288
|
-
"nb-select--warning": !
|
|
290
|
+
"nb-select--open": k.value,
|
|
291
|
+
"nb-select--focused": A.value && !k.value,
|
|
292
|
+
"nb-select--error": Ze.value,
|
|
293
|
+
"nb-select--warning": !Ze.value && (!R && !!T.warning || F.status.value === "warning"),
|
|
289
294
|
"nb-select--multiple": T.multiple,
|
|
290
|
-
"nb-select--bare": !!
|
|
295
|
+
"nb-select--bare": !!Ue.trigger
|
|
291
296
|
}
|
|
292
297
|
]);
|
|
293
298
|
return Re({
|
|
294
|
-
open:
|
|
295
|
-
close:
|
|
299
|
+
open: J,
|
|
300
|
+
close: Y
|
|
296
301
|
}), (n, o) => (_(), d(s, null, [f("div", {
|
|
297
302
|
ref_key: "rootRef",
|
|
298
|
-
ref:
|
|
299
|
-
class: g(
|
|
300
|
-
onKeydown:
|
|
301
|
-
}, [n.$slots.trigger ? y(n.$slots, "trigger", ce(oe({ key: 0 },
|
|
302
|
-
n.$slots.label && !x(
|
|
303
|
+
ref: M,
|
|
304
|
+
class: g(ft.value),
|
|
305
|
+
onKeydown: ot
|
|
306
|
+
}, [n.$slots.trigger ? y(n.$slots, "trigger", ce(oe({ key: 0 }, ct.value))) : h.variant === "default" ? (_(), d(s, { key: 1 }, [
|
|
307
|
+
n.$slots.label && !x(R) ? y(n.$slots, "label", { key: 0 }) : h.label && !x(R) ? (_(), l(r, {
|
|
303
308
|
key: 1,
|
|
304
|
-
for: x(
|
|
309
|
+
for: x(I),
|
|
305
310
|
required: h.required,
|
|
306
|
-
disabled: x(
|
|
311
|
+
disabled: x(L)
|
|
307
312
|
}, {
|
|
308
313
|
default: S(() => [p(b(h.label), 1)]),
|
|
309
314
|
_: 1
|
|
@@ -312,38 +317,40 @@ var be = [
|
|
|
312
317
|
"required",
|
|
313
318
|
"disabled"
|
|
314
319
|
])) : u("", !0),
|
|
315
|
-
m(
|
|
320
|
+
m(Be, { wrap: h.clearable }, {
|
|
316
321
|
default: S(() => [f("button", {
|
|
317
|
-
id: x(
|
|
322
|
+
id: x(I),
|
|
318
323
|
ref_key: "triggerRef",
|
|
319
|
-
ref:
|
|
324
|
+
ref: N,
|
|
320
325
|
type: "button",
|
|
321
326
|
class: "nb-select__trigger",
|
|
322
327
|
role: "combobox",
|
|
323
|
-
"aria-expanded":
|
|
328
|
+
"aria-expanded": k.value,
|
|
324
329
|
"aria-haspopup": "listbox",
|
|
325
|
-
"aria-
|
|
330
|
+
"aria-controls": k.value ? H.value : void 0,
|
|
331
|
+
"aria-activedescendant": W.value,
|
|
332
|
+
"aria-disabled": x(L) || void 0,
|
|
326
333
|
"aria-required": h.required || void 0,
|
|
327
|
-
"aria-invalid":
|
|
328
|
-
"aria-describedby":
|
|
329
|
-
disabled: x(
|
|
330
|
-
onClick:
|
|
331
|
-
onFocus: o[0] ||= (e) =>
|
|
332
|
-
onBlur: o[1] ||= (e) =>
|
|
334
|
+
"aria-invalid": Xe.value,
|
|
335
|
+
"aria-describedby": Ye.value,
|
|
336
|
+
disabled: x(L) || void 0,
|
|
337
|
+
onClick: X,
|
|
338
|
+
onFocus: o[0] ||= (e) => A.value = !0,
|
|
339
|
+
onBlur: o[1] ||= (e) => A.value = !1
|
|
333
340
|
}, [
|
|
334
341
|
f("span", { class: g(["nb-select__value", {
|
|
335
|
-
"nb-select__value--placeholder": !
|
|
336
|
-
"nb-select__value--with-icon": !!
|
|
337
|
-
}]) }, [
|
|
342
|
+
"nb-select__value--placeholder": !q.value,
|
|
343
|
+
"nb-select__value--with-icon": !!K.value
|
|
344
|
+
}]) }, [K.value ? (_(), l(t, {
|
|
338
345
|
key: 0,
|
|
339
346
|
class: "nb-select__value-icon",
|
|
340
|
-
name:
|
|
347
|
+
name: K.value,
|
|
341
348
|
size: 16
|
|
342
|
-
}, null, 8, ["name"])) : u("", !0),
|
|
349
|
+
}, null, 8, ["name"])) : u("", !0), q.value ? y(n.$slots, "value", {
|
|
343
350
|
key: 1,
|
|
344
|
-
values:
|
|
345
|
-
}, () => [p(b(
|
|
346
|
-
h.error ? (_(), l(i, {
|
|
351
|
+
values: G.value
|
|
352
|
+
}, () => [p(b(q.value), 1)]) : (_(), d(s, { key: 2 }, [p(b(h.placeholder), 1)], 64))], 2),
|
|
353
|
+
h.error && !x(R) ? (_(), l(i, {
|
|
347
354
|
key: 0,
|
|
348
355
|
variant: "error",
|
|
349
356
|
"icon-only": !0,
|
|
@@ -353,7 +360,7 @@ var be = [
|
|
|
353
360
|
}, {
|
|
354
361
|
default: S(() => [p(b(h.error), 1)]),
|
|
355
362
|
_: 1
|
|
356
|
-
})) : h.warning ? (_(), l(i, {
|
|
363
|
+
})) : h.warning && !x(R) ? (_(), l(i, {
|
|
357
364
|
key: 1,
|
|
358
365
|
variant: "warning",
|
|
359
366
|
"icon-only": !0,
|
|
@@ -371,7 +378,7 @@ var be = [
|
|
|
371
378
|
class: "nb-select__caret"
|
|
372
379
|
}, {
|
|
373
380
|
default: S(() => [m(t, {
|
|
374
|
-
name:
|
|
381
|
+
name: k.value ? x(ve) : x(_e),
|
|
375
382
|
size: 16
|
|
376
383
|
}, null, 8, ["name"])]),
|
|
377
384
|
_: 1
|
|
@@ -381,60 +388,62 @@ var be = [
|
|
|
381
388
|
variant: "ghost",
|
|
382
389
|
icon: x(ye),
|
|
383
390
|
size: "xs",
|
|
384
|
-
label:
|
|
391
|
+
label: ut.value,
|
|
385
392
|
class: "nb-select__clear",
|
|
386
|
-
onClick:
|
|
393
|
+
onClick: dt,
|
|
387
394
|
onKeydown: [o[2] ||= C(w(() => {}, ["stop"]), ["enter"]), o[3] ||= C(w(() => {}, ["stop"]), ["space"])]
|
|
388
395
|
}, null, 8, ["icon", "label"])) : u("", !0)]),
|
|
389
396
|
_: 3
|
|
390
397
|
}, 8, ["wrap"]),
|
|
391
|
-
h.error && !x(
|
|
392
|
-
id: x(
|
|
393
|
-
key: x(
|
|
398
|
+
h.error && !x(R) ? (_(), l(i, {
|
|
399
|
+
id: x(z).error,
|
|
400
|
+
key: x(V),
|
|
394
401
|
variant: "error",
|
|
395
|
-
live: x(
|
|
402
|
+
live: x(B),
|
|
396
403
|
class: "nb-select__message"
|
|
397
404
|
}, {
|
|
398
405
|
default: S(() => [p(b(h.error), 1)]),
|
|
399
406
|
_: 1
|
|
400
|
-
}, 8, ["id", "live"])) : h.warning && !x(
|
|
401
|
-
id: x(
|
|
402
|
-
key: x(
|
|
407
|
+
}, 8, ["id", "live"])) : h.warning && !x(R) ? (_(), l(i, {
|
|
408
|
+
id: x(z).warning,
|
|
409
|
+
key: x(V),
|
|
403
410
|
variant: "warning",
|
|
404
|
-
live: x(
|
|
411
|
+
live: x(B),
|
|
405
412
|
class: "nb-select__message"
|
|
406
413
|
}, {
|
|
407
414
|
default: S(() => [p(b(h.warning), 1)]),
|
|
408
415
|
_: 1
|
|
409
|
-
}, 8, ["id", "live"])) : h.helper && !x(
|
|
410
|
-
id: x(
|
|
411
|
-
key: x(
|
|
416
|
+
}, 8, ["id", "live"])) : h.helper && !x(R) ? (_(), l(i, {
|
|
417
|
+
id: x(z).helper,
|
|
418
|
+
key: x(V),
|
|
412
419
|
variant: "helper",
|
|
413
|
-
live: x(
|
|
420
|
+
live: x(B),
|
|
414
421
|
class: "nb-select__message"
|
|
415
422
|
}, {
|
|
416
423
|
default: S(() => [p(b(h.helper), 1)]),
|
|
417
424
|
_: 1
|
|
418
425
|
}, 8, ["id", "live"])) : u("", !0)
|
|
419
|
-
], 64)) : h.variant === "fluid" ? (_(), d(s, { key: 2 }, [m(
|
|
426
|
+
], 64)) : h.variant === "fluid" ? (_(), d(s, { key: 2 }, [m(Be, { wrap: h.clearable }, {
|
|
420
427
|
default: S(() => [f("button", {
|
|
421
|
-
id: x(
|
|
428
|
+
id: x(I),
|
|
422
429
|
ref_key: "triggerRef",
|
|
423
|
-
ref:
|
|
430
|
+
ref: N,
|
|
424
431
|
type: "button",
|
|
425
432
|
class: "nb-select__trigger",
|
|
426
433
|
role: "combobox",
|
|
427
|
-
"aria-expanded":
|
|
434
|
+
"aria-expanded": k.value,
|
|
428
435
|
"aria-haspopup": "listbox",
|
|
429
|
-
"aria-
|
|
436
|
+
"aria-controls": k.value ? H.value : void 0,
|
|
437
|
+
"aria-activedescendant": W.value,
|
|
438
|
+
"aria-disabled": x(L) || void 0,
|
|
430
439
|
"aria-required": h.required || void 0,
|
|
431
|
-
"aria-invalid":
|
|
432
|
-
"aria-describedby":
|
|
433
|
-
disabled: x(
|
|
434
|
-
onClick:
|
|
435
|
-
onFocus: o[4] ||= (e) =>
|
|
436
|
-
onBlur: o[5] ||= (e) =>
|
|
437
|
-
}, [h.label || n.$slots.label ? (_(), l(a, {
|
|
440
|
+
"aria-invalid": Xe.value,
|
|
441
|
+
"aria-describedby": Ye.value,
|
|
442
|
+
disabled: x(L) || void 0,
|
|
443
|
+
onClick: X,
|
|
444
|
+
onFocus: o[4] ||= (e) => A.value = !0,
|
|
445
|
+
onBlur: o[5] ||= (e) => A.value = !1
|
|
446
|
+
}, [(h.label || n.$slots.label) && !x(R) ? (_(), l(a, {
|
|
438
447
|
key: 0,
|
|
439
448
|
dir: "row",
|
|
440
449
|
align: "center",
|
|
@@ -443,7 +452,7 @@ var be = [
|
|
|
443
452
|
}, {
|
|
444
453
|
default: S(() => [n.$slots.label ? y(n.$slots, "label", { key: 0 }) : (_(), d("label", Ce, [p(b(h.label) + " ", 1), h.required ? (_(), d("span", we, "*")) : u("", !0)])), h.helper && !h.error && !h.warning ? (_(), l(i, {
|
|
445
454
|
key: 2,
|
|
446
|
-
id: x(
|
|
455
|
+
id: x(z).helper,
|
|
447
456
|
variant: "helper",
|
|
448
457
|
"icon-only": !0,
|
|
449
458
|
live: "off",
|
|
@@ -462,17 +471,17 @@ var be = [
|
|
|
462
471
|
}, {
|
|
463
472
|
default: S(() => [
|
|
464
473
|
f("span", { class: g(["nb-select__value", {
|
|
465
|
-
"nb-select__value--placeholder": !
|
|
466
|
-
"nb-select__value--with-icon": !!
|
|
467
|
-
}]) }, [
|
|
474
|
+
"nb-select__value--placeholder": !q.value,
|
|
475
|
+
"nb-select__value--with-icon": !!K.value
|
|
476
|
+
}]) }, [K.value ? (_(), l(t, {
|
|
468
477
|
key: 0,
|
|
469
478
|
class: "nb-select__value-icon",
|
|
470
|
-
name:
|
|
479
|
+
name: K.value,
|
|
471
480
|
size: 16
|
|
472
|
-
}, null, 8, ["name"])) : u("", !0),
|
|
481
|
+
}, null, 8, ["name"])) : u("", !0), q.value ? y(n.$slots, "value", {
|
|
473
482
|
key: 1,
|
|
474
|
-
values:
|
|
475
|
-
}, () => [p(b(
|
|
483
|
+
values: G.value
|
|
484
|
+
}, () => [p(b(q.value), 1)]) : (_(), d(s, { key: 2 }, [p(b(h.placeholder), 1)], 64))], 2),
|
|
476
485
|
$.value ? (_(), d("span", Te)) : u("", !0),
|
|
477
486
|
m(a, {
|
|
478
487
|
align: "center",
|
|
@@ -480,7 +489,7 @@ var be = [
|
|
|
480
489
|
class: "nb-select__caret"
|
|
481
490
|
}, {
|
|
482
491
|
default: S(() => [m(t, {
|
|
483
|
-
name:
|
|
492
|
+
name: k.value ? x(ve) : x(_e),
|
|
484
493
|
size: 16
|
|
485
494
|
}, null, 8, ["name"])]),
|
|
486
495
|
_: 1
|
|
@@ -492,58 +501,58 @@ var be = [
|
|
|
492
501
|
variant: "ghost",
|
|
493
502
|
icon: x(ye),
|
|
494
503
|
size: "xs",
|
|
495
|
-
label:
|
|
504
|
+
label: ut.value,
|
|
496
505
|
class: "nb-select__clear",
|
|
497
|
-
onClick:
|
|
506
|
+
onClick: dt,
|
|
498
507
|
onKeydown: [o[6] ||= C(w(() => {}, ["stop"]), ["enter"]), o[7] ||= C(w(() => {}, ["stop"]), ["space"])]
|
|
499
508
|
}, null, 8, ["icon", "label"])) : u("", !0)]),
|
|
500
509
|
_: 3
|
|
501
|
-
}, 8, ["wrap"]), h.error ? (_(), l(i, {
|
|
502
|
-
id: x(
|
|
503
|
-
key: x(
|
|
510
|
+
}, 8, ["wrap"]), h.error && !x(R) ? (_(), l(i, {
|
|
511
|
+
id: x(z).error,
|
|
512
|
+
key: x(V),
|
|
504
513
|
variant: "error",
|
|
505
|
-
live: x(
|
|
514
|
+
live: x(B),
|
|
506
515
|
class: "nb-select__fluid-message"
|
|
507
516
|
}, {
|
|
508
517
|
default: S(() => [p(b(h.error), 1)]),
|
|
509
518
|
_: 1
|
|
510
|
-
}, 8, ["id", "live"])) : h.warning ? (_(), l(i, {
|
|
511
|
-
id: x(
|
|
512
|
-
key: x(
|
|
519
|
+
}, 8, ["id", "live"])) : h.warning && !x(R) ? (_(), l(i, {
|
|
520
|
+
id: x(z).warning,
|
|
521
|
+
key: x(V),
|
|
513
522
|
variant: "warning",
|
|
514
|
-
live: x(
|
|
523
|
+
live: x(B),
|
|
515
524
|
class: "nb-select__fluid-message"
|
|
516
525
|
}, {
|
|
517
526
|
default: S(() => [p(b(h.warning), 1)]),
|
|
518
527
|
_: 1
|
|
519
528
|
}, 8, ["id", "live"])) : u("", !0)], 64)) : u("", !0)], 34), (_(), l(re, { to: "body" }, [m(ie, { name: "nb-select-pop" }, {
|
|
520
|
-
default: S(() => [
|
|
529
|
+
default: S(() => [k.value ? (_(), d("div", {
|
|
521
530
|
key: 0,
|
|
522
|
-
id:
|
|
531
|
+
id: H.value,
|
|
523
532
|
ref_key: "dropdownRef",
|
|
524
|
-
ref:
|
|
533
|
+
ref: P,
|
|
525
534
|
class: g(["nb-select__dropdown", {
|
|
526
535
|
"nb-select__dropdown--check": h.selectedMark === "check",
|
|
527
536
|
"nb-select__dropdown--anchored": !!n.$slots.trigger
|
|
528
537
|
}]),
|
|
529
|
-
style: le(
|
|
538
|
+
style: le(Ke.value),
|
|
530
539
|
role: "listbox",
|
|
531
540
|
"aria-multiselectable": h.multiple || void 0
|
|
532
541
|
}, [
|
|
533
542
|
h.searchable ? (_(), d("div", De, [ge(f("input", {
|
|
534
543
|
ref_key: "searchRef",
|
|
535
|
-
ref:
|
|
536
|
-
"onUpdate:modelValue": o[8] ||= (e) =>
|
|
544
|
+
ref: Ve,
|
|
545
|
+
"onUpdate:modelValue": o[8] ||= (e) => O.value = e,
|
|
537
546
|
type: "search",
|
|
538
547
|
class: "nb-select__search-input",
|
|
539
548
|
autocomplete: "off",
|
|
540
549
|
spellcheck: "false",
|
|
541
550
|
placeholder: h.searchPlaceholder,
|
|
542
551
|
"aria-label": h.searchPlaceholder,
|
|
543
|
-
"aria-controls":
|
|
544
|
-
"aria-activedescendant":
|
|
545
|
-
onKeydown:
|
|
546
|
-
}, null, 40, Oe), [[me,
|
|
552
|
+
"aria-controls": H.value,
|
|
553
|
+
"aria-activedescendant": j.value >= 0 ? U(j.value) : void 0,
|
|
554
|
+
onKeydown: st
|
|
555
|
+
}, null, 40, Oe), [[me, O.value]])])) : u("", !0),
|
|
547
556
|
(_(!0), d(s, null, de(tt.value, (e) => (_(), d("div", {
|
|
548
557
|
key: e.key,
|
|
549
558
|
class: "nb-select__group",
|
|
@@ -554,18 +563,18 @@ var be = [
|
|
|
554
563
|
id: e.labelId,
|
|
555
564
|
class: "nb-select__group-label"
|
|
556
565
|
}, b(e.name), 9, Ae)) : u("", !0), (_(!0), d(s, null, de(e.entries, (e) => (_(), d("div", {
|
|
557
|
-
id:
|
|
566
|
+
id: U(e.index),
|
|
558
567
|
key: e.option.value,
|
|
559
568
|
"data-index": e.index,
|
|
560
569
|
class: g(["nb-select__option", {
|
|
561
570
|
"nb-select__option--selected": Qe(e.option.value),
|
|
562
|
-
"nb-select__option--highlighted":
|
|
571
|
+
"nb-select__option--highlighted": j.value === e.index,
|
|
563
572
|
"nb-select__option--disabled": e.option.disabled
|
|
564
573
|
}]),
|
|
565
574
|
role: "option",
|
|
566
575
|
"aria-selected": Qe(e.option.value),
|
|
567
576
|
"aria-disabled": e.option.disabled || void 0,
|
|
568
|
-
onMouseenter: (t) =>
|
|
577
|
+
onMouseenter: (t) => j.value = e.index,
|
|
569
578
|
onClick: (t) => rt(e.option)
|
|
570
579
|
}, [
|
|
571
580
|
h.multiple || h.selectedMark === "check" ? (_(), d("span", Me, [Qe(e.option.value) ? (_(), d("svg", Ne, [...o[12] ||= [f("path", {
|
|
@@ -589,12 +598,12 @@ var be = [
|
|
|
589
598
|
class: "nb-select__create",
|
|
590
599
|
onMousedown: o[11] ||= w(() => {}, ["prevent"])
|
|
591
600
|
}, [ge(f("input", {
|
|
592
|
-
"onUpdate:modelValue": o[9] ||= (e) =>
|
|
601
|
+
"onUpdate:modelValue": o[9] ||= (e) => D.value = e,
|
|
593
602
|
type: "text",
|
|
594
603
|
class: "nb-select__create-input",
|
|
595
604
|
placeholder: h.createPlaceholder || "Add new…",
|
|
596
|
-
onKeydown: [C(w(
|
|
597
|
-
}, null, 40, Le), [[me,
|
|
605
|
+
onKeydown: [C(w(He, ["prevent"]), ["enter"]), o[10] ||= w(() => {}, ["stop"])]
|
|
606
|
+
}, null, 40, Le), [[me, D.value]])], 32)) : u("", !0)
|
|
598
607
|
], 14, Ee)) : u("", !0)]),
|
|
599
608
|
_: 3
|
|
600
609
|
})]))], 64));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Button-BHFtgOXA.cjs`),t=require(`./Icon-CssV4E2-.cjs`),n=require(`./composables/useNbStrings.composable.cjs`),r=require(`./Label-CjxnZgNy.cjs`),i=require(`./Message-BJO4MjiQ.cjs`),a=require(`./Grid-BOtE_jXr.cjs`),o=require(`./composables/useFieldMessage.composable.cjs`),s=require(`./InputGroup.context-BHj-IvcT.cjs`),ee=require(`./composables/useMenuSurface.composable.cjs`);let c=require(`vue`),l=require(`@nubisco/ui/icons/caret-down`),u=require(`@nubisco/ui/icons/caret-up`),d=require(`@nubisco/ui/icons/x`);var te=[`id`,`aria-expanded`,`aria-controls`,`aria-activedescendant`,`aria-disabled`,`aria-required`,`aria-invalid`,`aria-describedby`,`disabled`],ne={key:2,class:`nb-select__clear-space`,"aria-hidden":`true`},re=[`id`,`aria-expanded`,`aria-controls`,`aria-activedescendant`,`aria-disabled`,`aria-required`,`aria-invalid`,`aria-describedby`,`disabled`],ie={key:1,class:`nb-select__inner-label`},ae={key:0,class:`nb-select__asterisk`,"aria-hidden":`true`},oe={key:0,class:`nb-select__clear-space`,"aria-hidden":`true`},se=[`id`,`aria-multiselectable`],ce={key:0,class:`nb-select__search`},le=[`placeholder`,`aria-label`,`aria-controls`,`aria-activedescendant`],ue=[`aria-labelledby`],de=[`id`],fe=[`id`,`data-index`,`aria-selected`,`aria-disabled`,`onMouseenter`,`onClick`],pe={key:0,class:`nb-select__option-check`,"aria-hidden":`true`},me={key:0,viewBox:`0 0 10 8`,fill:`none`,width:`10`,height:`8`},he={class:`nb-select__option-label`},ge={key:1,class:`nb-select__empty`},_e={key:2,class:`nb-select__empty`},ve=[`placeholder`,`onKeydown`],f=(0,c.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:void 0},searchable:{type:Boolean,default:!1},searchPlaceholder:{default:`Search`},noResultsLabel:{default:`No results`},anchor:{type:[Function,null],default:null},selectedMark:{default:`fill`},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(f,{expose:ye,emit:be}){let p=f,m=be,h=(e,{slots:t})=>e.wrap?(0,c.h)(`div`,{class:`nb-select__control`},t.default?.()):t.default?.();h.props=[`wrap`];let g=(0,c.ref)(``),_=(0,c.ref)(``),v=(0,c.ref)(null);function xe(){let e=g.value.trim();e&&(m(`create`,e),g.value=``)}let y=(0,c.ref)(!1),b=(0,c.ref)(!1),x=(0,c.ref)(-1),S=(0,c.ref)(null),C=(0,c.ref)(null),w=(0,c.useSlots)(),Se=()=>(typeof p.anchor==`function`?p.anchor():p.anchor)??C.value??S.value;function T(){(C.value??S.value?.querySelector(`button, [tabindex]`))?.focus()}let E=(0,c.ref)(null);ee.useMenuSurface(E);let D=(0,c.ref)({position:`fixed`,top:`0px`,left:`0px`,width:`0px`,zIndex:`9999`}),O=s.n(p,`nb-select-${(0,c.useId)()}`),k=O.id,A=O.disabled,j=O.grouped,{ids:M,messageId:Ce,invalid:N,live:P,key:F}=o.useFieldMessage(p,k),we=(0,c.computed)(()=>o.joinDescribedBy(j?void 0:Ce.value,O.describedBy.value)),Te=(0,c.computed)(()=>N.value??(O.status.value===`error`?`true`:void 0)),Ee=(0,c.computed)(()=>!j&&!!p.error||O.status.value===`error`),I=(0,c.computed)(()=>`${k.value}-listbox`),L=e=>`${k.value}-option-${e}`,R=(0,c.computed)(()=>y.value&&!p.searchable&&x.value>=0?L(x.value):void 0),z=(0,c.computed)(()=>p.modelValue==null?[]:Array.isArray(p.modelValue)?p.modelValue:[p.modelValue]),B=(0,c.computed)(()=>{if(!(p.multiple||z.value.length!==1))return(p.options??[]).find(e=>e.value===z.value[0])?.icon}),V=(0,c.computed)(()=>{if(z.value.length===0)return``;let e=p.options??[];return p.multiple?z.value.length===1?e.find(e=>e.value===z.value[0])?.label??String(z.value[0]):z.value.length===2?z.value.map(t=>e.find(e=>e.value===t)?.label??String(t)).join(`, `):`${z.value.length} selected`:e.find(e=>e.value===z.value[0])?.label??String(z.value[0])});function H(e){return z.value.includes(e)}let De=e=>e.normalize(`NFD`).replace(/\p{M}/gu,``).toLowerCase(),U=(0,c.computed)(()=>{let e=p.options??[],t=p.searchable?De(_.value.trim()):``,n=new Set;return e.forEach((e,r)=>{(!t||De(e.label).includes(t))&&n.add(r)}),n}),Oe=(0,c.computed)(()=>{let e=[];return(p.options??[]).forEach((t,n)=>{if(!U.value.has(n))return;let r=e[e.length-1];(!r||r.name!==t.group)&&e.push({key:`${e.length}:${t.group??``}`,name:t.group,labelId:`${k.value}-group-${e.length}`,entries:[]}),e[e.length-1].entries.push({option:t,index:n})}),e});function W(e,t){let n=p.options??[];for(let r=e+t;r>=0&&r<n.length;r+=t)if(!n[r].disabled&&U.value.has(r))return r;return e}function ke(e){if(e.disabled)return;let t;if(p.multiple){let n=[...z.value],r=n.indexOf(e.value);r>=0?n.splice(r,1):n.push(e.value),t=n}else t=e.value,q();m(`update:modelValue`,t),m(`change`,t)}function G(){let e=Se();if(!e)return;let t=e.getBoundingClientRect(),n=E.value?.offsetHeight??0,r=window.innerHeight-t.bottom,i=t.top,a=n>0&&r<n&&i>r,o=w.trigger?Math.max(t.width,240):t.width,s=w.trigger?Math.max(8,Math.min(t.left,window.innerWidth-o-8)):t.left;D.value={position:`fixed`,top:a?`${t.top-n}px`:`${t.bottom}px`,left:`${s}px`,width:`${o}px`,zIndex:`9999`}}function K(){if(A.value)return;y.value=!0,G();let e=p.options??[];x.value=z.value.length>0?Math.max(0,e.findIndex(e=>e.value===z.value[0])):-1,(0,c.nextTick)(()=>{G(),Z(),v.value?.focus({preventScroll:!0})})}function q(){let e=!!E.value?.contains(document.activeElement);y.value=!1,x.value=-1,_.value=``,e&&T()}function J(){y.value?q():K()}function Y(e){let t=e.target,n=S.value?.contains(t)??!1,r=E.value?.contains(t)??!1;!n&&!r&&q()}function X(){y.value&&G()}(0,c.watch)(y,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,c.onBeforeUnmount)(()=>{document.removeEventListener(`mousedown`,Y),window.removeEventListener(`scroll`,X,!0),window.removeEventListener(`resize`,X)});function Ae(e){let t=p.options??[];if(!y.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(),x.value=W(x.value,1),Z()):e.key===`ArrowUp`?(e.preventDefault(),x.value>0&&(x.value=W(x.value,-1)),Z()):(e.key===`Enter`||e.key===` `)&&x.value>=0&&(e.preventDefault(),ke(t[x.value]))}function Z(){(0,c.nextTick)(()=>{!E.value||x.value<0||E.value.querySelector(`[data-index="${x.value}"]`)?.scrollIntoView({block:`nearest`})})}(0,c.watch)(_,()=>{if(!y.value)return;let e=W(-1,1);x.value=e===-1?-1:e,Z()});function je(e){if(e.key===` `){e.stopPropagation();return}if(e.key===`Home`||e.key===`End`){e.stopPropagation();return}Ae(e)}let Me=(0,c.computed)(()=>({isOpen:y.value,toggle:J,open:K,close:q,attrs:{"aria-expanded":y.value,"aria-haspopup":`listbox`,"aria-controls":y.value?I.value:void 0,"aria-activedescendant":R.value,"aria-invalid":N.value,onClick:J}})),Ne=n.useNbStrings(),Pe=(0,c.computed)(()=>p.clearLabel??Ne.value.selectClear),Q=(0,c.computed)(()=>p.clearable&&!A.value&&z.value.length>0);function $(){let e=p.multiple?[]:null;q(),m(`update:modelValue`,e),m(`change`,e),T()}let Fe=(0,c.computed)(()=>[`nb-select`,`nb-select--${p.variant}`,`nb-select--${O.size.value}`,{"nb-select--open":y.value,"nb-select--focused":b.value&&!y.value,"nb-select--error":Ee.value,"nb-select--warning":!Ee.value&&(!j&&!!p.warning||O.status.value===`warning`),"nb-select--multiple":p.multiple,"nb-select--bare":!!w.trigger}]);return ye({open:K,close:q}),(n,o)=>((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,null,[(0,c.createElementVNode)(`div`,{ref_key:`rootRef`,ref:S,class:(0,c.normalizeClass)(Fe.value),onKeydown:Ae},[n.$slots.trigger?(0,c.renderSlot)(n.$slots,`trigger`,(0,c.normalizeProps)((0,c.mergeProps)({key:0},Me.value))):f.variant===`default`?((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:1},[n.$slots.label&&!(0,c.unref)(j)?(0,c.renderSlot)(n.$slots,`label`,{key:0}):f.label&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(r.t,{key:1,for:(0,c.unref)(k),required:f.required,disabled:(0,c.unref)(A)},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,c.createCommentVNode)(``,!0),(0,c.createVNode)(h,{wrap:f.clearable},{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`button`,{id:(0,c.unref)(k),ref_key:`triggerRef`,ref:C,type:`button`,class:`nb-select__trigger`,role:`combobox`,"aria-expanded":y.value,"aria-haspopup":`listbox`,"aria-controls":y.value?I.value:void 0,"aria-activedescendant":R.value,"aria-disabled":(0,c.unref)(A)||void 0,"aria-required":f.required||void 0,"aria-invalid":Te.value,"aria-describedby":we.value,disabled:(0,c.unref)(A)||void 0,onClick:J,onFocus:o[0]||=e=>b.value=!0,onBlur:o[1]||=e=>b.value=!1},[(0,c.createElementVNode)(`span`,{class:(0,c.normalizeClass)([`nb-select__value`,{"nb-select__value--placeholder":!V.value,"nb-select__value--with-icon":!!B.value}])},[B.value?((0,c.openBlock)(),(0,c.createBlock)(t.t,{key:0,class:`nb-select__value-icon`,name:B.value,size:16},null,8,[`name`])):(0,c.createCommentVNode)(``,!0),V.value?(0,c.renderSlot)(n.$slots,`value`,{key:1,values:z.value},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(V.value),1)]):((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:2},[(0,c.createTextVNode)((0,c.toDisplayString)(f.placeholder),1)],64))],2),f.error&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{key:0,variant:`error`,"icon-only":!0,live:`off`,"aria-hidden":`true`,class:`nb-select__status-icon`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.error),1)]),_:1})):f.warning&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{key:1,variant:`warning`,"icon-only":!0,live:`off`,"aria-hidden":`true`,class:`nb-select__status-icon`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.warning),1)]),_:1})):(0,c.createCommentVNode)(``,!0),Q.value?((0,c.openBlock)(),(0,c.createElementBlock)(`span`,ne)):(0,c.createCommentVNode)(``,!0),(0,c.createVNode)(a.t,{align:`center`,justify:`center`,class:`nb-select__caret`},{default:(0,c.withCtx)(()=>[(0,c.createVNode)(t.t,{name:y.value?(0,c.unref)(u.regular):(0,c.unref)(l.regular),size:16},null,8,[`name`])]),_:1})],40,te),Q.value?((0,c.openBlock)(),(0,c.createBlock)(e.t,{key:0,variant:`ghost`,icon:(0,c.unref)(d.regular),size:`xs`,label:Pe.value,class:`nb-select__clear`,onClick:$,onKeydown:[o[2]||=(0,c.withKeys)((0,c.withModifiers)(()=>{},[`stop`]),[`enter`]),o[3]||=(0,c.withKeys)((0,c.withModifiers)(()=>{},[`stop`]),[`space`])]},null,8,[`icon`,`label`])):(0,c.createCommentVNode)(``,!0)]),_:3},8,[`wrap`]),f.error&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{id:(0,c.unref)(M).error,key:(0,c.unref)(F),variant:`error`,live:(0,c.unref)(P),class:`nb-select__message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.error),1)]),_:1},8,[`id`,`live`])):f.warning&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{id:(0,c.unref)(M).warning,key:(0,c.unref)(F),variant:`warning`,live:(0,c.unref)(P),class:`nb-select__message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.warning),1)]),_:1},8,[`id`,`live`])):f.helper&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{id:(0,c.unref)(M).helper,key:(0,c.unref)(F),variant:`helper`,live:(0,c.unref)(P),class:`nb-select__message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.helper),1)]),_:1},8,[`id`,`live`])):(0,c.createCommentVNode)(``,!0)],64)):f.variant===`fluid`?((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:2},[(0,c.createVNode)(h,{wrap:f.clearable},{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`button`,{id:(0,c.unref)(k),ref_key:`triggerRef`,ref:C,type:`button`,class:`nb-select__trigger`,role:`combobox`,"aria-expanded":y.value,"aria-haspopup":`listbox`,"aria-controls":y.value?I.value:void 0,"aria-activedescendant":R.value,"aria-disabled":(0,c.unref)(A)||void 0,"aria-required":f.required||void 0,"aria-invalid":Te.value,"aria-describedby":we.value,disabled:(0,c.unref)(A)||void 0,onClick:J,onFocus:o[4]||=e=>b.value=!0,onBlur:o[5]||=e=>b.value=!1},[(f.label||n.$slots.label)&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(a.t,{key:0,dir:`row`,align:`center`,gap:`xs`,class:`nb-select__inner-header`},{default:(0,c.withCtx)(()=>[n.$slots.label?(0,c.renderSlot)(n.$slots,`label`,{key:0}):((0,c.openBlock)(),(0,c.createElementBlock)(`label`,ie,[(0,c.createTextVNode)((0,c.toDisplayString)(f.label)+` `,1),f.required?((0,c.openBlock)(),(0,c.createElementBlock)(`span`,ae,`*`)):(0,c.createCommentVNode)(``,!0)])),f.helper&&!f.error&&!f.warning?((0,c.openBlock)(),(0,c.createBlock)(i.t,{key:2,id:(0,c.unref)(M).helper,variant:`helper`,"icon-only":!0,live:`off`,"aria-hidden":`true`,class:`nb-select__inner-message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.helper),1)]),_:1},8,[`id`])):(0,c.createCommentVNode)(``,!0)]),_:3})):(0,c.createCommentVNode)(``,!0),(0,c.createVNode)(a.t,{dir:`row`,align:`end`,flex:``,class:`nb-select__value-row`},{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`span`,{class:(0,c.normalizeClass)([`nb-select__value`,{"nb-select__value--placeholder":!V.value,"nb-select__value--with-icon":!!B.value}])},[B.value?((0,c.openBlock)(),(0,c.createBlock)(t.t,{key:0,class:`nb-select__value-icon`,name:B.value,size:16},null,8,[`name`])):(0,c.createCommentVNode)(``,!0),V.value?(0,c.renderSlot)(n.$slots,`value`,{key:1,values:z.value},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(V.value),1)]):((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:2},[(0,c.createTextVNode)((0,c.toDisplayString)(f.placeholder),1)],64))],2),Q.value?((0,c.openBlock)(),(0,c.createElementBlock)(`span`,oe)):(0,c.createCommentVNode)(``,!0),(0,c.createVNode)(a.t,{align:`center`,justify:`center`,class:`nb-select__caret`},{default:(0,c.withCtx)(()=>[(0,c.createVNode)(t.t,{name:y.value?(0,c.unref)(u.regular):(0,c.unref)(l.regular),size:16},null,8,[`name`])]),_:1})]),_:3})],40,re),Q.value?((0,c.openBlock)(),(0,c.createBlock)(e.t,{key:0,variant:`ghost`,icon:(0,c.unref)(d.regular),size:`xs`,label:Pe.value,class:`nb-select__clear`,onClick:$,onKeydown:[o[6]||=(0,c.withKeys)((0,c.withModifiers)(()=>{},[`stop`]),[`enter`]),o[7]||=(0,c.withKeys)((0,c.withModifiers)(()=>{},[`stop`]),[`space`])]},null,8,[`icon`,`label`])):(0,c.createCommentVNode)(``,!0)]),_:3},8,[`wrap`]),f.error&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{id:(0,c.unref)(M).error,key:(0,c.unref)(F),variant:`error`,live:(0,c.unref)(P),class:`nb-select__fluid-message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.error),1)]),_:1},8,[`id`,`live`])):f.warning&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{id:(0,c.unref)(M).warning,key:(0,c.unref)(F),variant:`warning`,live:(0,c.unref)(P),class:`nb-select__fluid-message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.warning),1)]),_:1},8,[`id`,`live`])):(0,c.createCommentVNode)(``,!0)],64)):(0,c.createCommentVNode)(``,!0)],34),((0,c.openBlock)(),(0,c.createBlock)(c.Teleport,{to:`body`},[(0,c.createVNode)(c.Transition,{name:`nb-select-pop`},{default:(0,c.withCtx)(()=>[y.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,id:I.value,ref_key:`dropdownRef`,ref:E,class:(0,c.normalizeClass)([`nb-select__dropdown`,{"nb-select__dropdown--check":f.selectedMark===`check`,"nb-select__dropdown--anchored":!!n.$slots.trigger}]),style:(0,c.normalizeStyle)(D.value),role:`listbox`,"aria-multiselectable":f.multiple||void 0},[f.searchable?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,ce,[(0,c.withDirectives)((0,c.createElementVNode)(`input`,{ref_key:`searchRef`,ref:v,"onUpdate:modelValue":o[8]||=e=>_.value=e,type:`search`,class:`nb-select__search-input`,autocomplete:`off`,spellcheck:`false`,placeholder:f.searchPlaceholder,"aria-label":f.searchPlaceholder,"aria-controls":I.value,"aria-activedescendant":x.value>=0?L(x.value):void 0,onKeydown:je},null,40,le),[[c.vModelText,_.value]])])):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(Oe.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:e.key,class:`nb-select__group`,role:`group`,"aria-labelledby":e.name?e.labelId:void 0},[e.name?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,id:e.labelId,class:`nb-select__group-label`},(0,c.toDisplayString)(e.name),9,de)):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(e.entries,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{id:L(e.index),key:e.option.value,"data-index":e.index,class:(0,c.normalizeClass)([`nb-select__option`,{"nb-select__option--selected":H(e.option.value),"nb-select__option--highlighted":x.value===e.index,"nb-select__option--disabled":e.option.disabled}]),role:`option`,"aria-selected":H(e.option.value),"aria-disabled":e.option.disabled||void 0,onMouseenter:t=>x.value=e.index,onClick:t=>ke(e.option)},[f.multiple||f.selectedMark===`check`?((0,c.openBlock)(),(0,c.createElementBlock)(`span`,pe,[H(e.option.value)?((0,c.openBlock)(),(0,c.createElementBlock)(`svg`,me,[...o[12]||=[(0,c.createElementVNode)(`path`,{d:`M1 4l3 3 5-6`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,-1)]])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),e.option.icon?((0,c.openBlock)(),(0,c.createBlock)(t.t,{key:1,class:`nb-select__option-icon`,name:e.option.icon,size:16},null,8,[`name`])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`span`,he,[(0,c.renderSlot)(n.$slots,`option`,{option:e.option},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.option.label),1)])])],42,fe))),128))],8,ue))),128)),!f.options||f.options.length===0?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,ge,` No options `)):f.searchable&&U.value.size===0?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,_e,(0,c.toDisplayString)(f.noResultsLabel),1)):(0,c.createCommentVNode)(``,!0),f.creatable?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:3,class:`nb-select__create`,onMousedown:o[11]||=(0,c.withModifiers)(()=>{},[`prevent`])},[(0,c.withDirectives)((0,c.createElementVNode)(`input`,{"onUpdate:modelValue":o[9]||=e=>g.value=e,type:`text`,class:`nb-select__create-input`,placeholder:f.createPlaceholder||`Add new…`,onKeydown:[(0,c.withKeys)((0,c.withModifiers)(xe,[`prevent`]),[`enter`]),o[10]||=(0,c.withModifiers)(()=>{},[`stop`])]},null,40,ve),[[c.vModelText,g.value]])],32)):(0,c.createCommentVNode)(``,!0)],14,se)):(0,c.createCommentVNode)(``,!0)]),_:3})]))],64))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|