@nubisco/ui 5.12.0 → 5.13.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/Badge-BgCdM21g.cjs +1 -0
- package/dist/Badge-CfXOTEnO.js +59 -0
- package/dist/DatePicker-B_lnTkqz.cjs +1 -0
- package/dist/DatePicker-DcWyOduI.js +704 -0
- package/dist/{Menu-Dy1JwMdl.js → Menu-CsA8dtMR.js} +6 -1
- package/dist/Menu-Xt1MCf-q.cjs +1 -0
- package/dist/{MenuBarItem-Ya88A6xZ.cjs → MenuBarItem-42bSEdWZ.cjs} +1 -1
- package/dist/{MenuBarItem-CYofbcgq.js → MenuBarItem-H1sFt0Mx.js} +1 -1
- package/dist/{Pagination-CcZB4Lp_.cjs → Pagination-BVqdCAar.cjs} +1 -1
- package/dist/{Pagination-DDIc4vUH.js → Pagination-DfE_VBmi.js} +1 -1
- package/dist/{Select-CB4BSCaj.js → Select-C4kly9iF.js} +77 -74
- package/dist/Select-CDaJcun8.cjs +1 -0
- package/dist/{Tabs-BPgmRLDi.cjs → Tabs-4-VnGh4i.cjs} +1 -1
- package/dist/{Tabs-DseHSwTm.js → Tabs-q8dnIAkO.js} +2 -2
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +7 -7
- package/dist/component-styles.json +2 -1
- package/dist/components/Badge.cjs +1 -1
- package/dist/components/Badge.d.ts +18 -0
- package/dist/components/Badge.mjs +1 -1
- package/dist/components/Badge.vue.d.ts +5 -2
- package/dist/components/Badge.vue.d.ts.map +1 -1
- package/dist/components/DatePicker.cjs +1 -1
- package/dist/components/DatePicker.mjs +1 -1
- package/dist/components/DatePicker.vue.d.ts +1 -1
- package/dist/components/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/Menu.cjs +1 -1
- package/dist/components/Menu.mjs +1 -1
- package/dist/components/Menu.vue.d.ts.map +1 -1
- package/dist/components/MenuBarItem.cjs +1 -1
- package/dist/components/MenuBarItem.mjs +1 -1
- package/dist/components/NotificationCenter.vue.d.ts +1 -1
- package/dist/components/NotificationCenterItem.vue.d.ts +1 -1
- package/dist/components/NumberInput.vue.d.ts +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/Select.cjs +1 -1
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Select.vue.d.ts +1 -1
- package/dist/components/Select.vue.d.ts.map +1 -1
- package/dist/components/Tabs.cjs +1 -1
- package/dist/components/Tabs.mjs +1 -1
- package/dist/components/Tabs.vue.d.ts.map +1 -1
- package/dist/components/TextInput.vue.d.ts +1 -1
- package/dist/components/TextInput.vue.d.ts.map +1 -1
- package/dist/composables/useMenuSurface.composable.cjs +1 -0
- package/dist/composables/useMenuSurface.composable.d.ts +14 -0
- package/dist/composables/useMenuSurface.composable.d.ts.map +1 -0
- package/dist/composables/useMenuSurface.composable.mjs +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +7 -7
- package/dist/styles/Badge.css +1 -1
- package/dist/styles/Tabs.css +1 -1
- package/dist/ui.css +2 -2
- package/package.json +1 -1
- package/dist/Badge-BOF-mQu9.cjs +0 -1
- package/dist/Badge-MPdaJamD.js +0 -30
- package/dist/DatePicker-DQJ31TUm.cjs +0 -1
- package/dist/DatePicker-htoxxlSw.js +0 -701
- package/dist/Menu-BSbPfsiE.cjs +0 -1
- package/dist/Select-BMamCNcN.cjs +0 -1
|
@@ -1,701 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./Icon-rREAqsu0.js";
|
|
2
|
-
import { useSurfaceLayer as t } from "./composables/useSurfaceLayer.composable.mjs";
|
|
3
|
-
import { t as n } from "./Label-glcQoGCr.js";
|
|
4
|
-
import { t as r } from "./Message-Ciyc2nN6.js";
|
|
5
|
-
import { t as i } from "./Grid-CgUyhsw4.js";
|
|
6
|
-
import { Fragment as a, Teleport as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, mergeProps as ee, nextTick as h, normalizeClass as g, onBeforeUnmount as te, openBlock as _, ref as v, renderList as ne, renderSlot as re, toDisplayString as y, unref as b, useId as ie, watch as ae, withCtx as x, withModifiers as oe } from "vue";
|
|
7
|
-
import { regular as se } from "@nubisco/ui/icons/caret-right";
|
|
8
|
-
import { regular as S } from "@nubisco/ui/icons/calendar";
|
|
9
|
-
import { regular as ce } from "@nubisco/ui/icons/caret-double-left";
|
|
10
|
-
import { regular as le } from "@nubisco/ui/icons/caret-left";
|
|
11
|
-
import { regular as ue } from "@nubisco/ui/icons/caret-double-right";
|
|
12
|
-
//#region src/components/DatePicker.vue?vue&type=script&setup=true&lang.ts
|
|
13
|
-
var de = { class: "nb-date-picker__col" }, fe = [
|
|
14
|
-
"id",
|
|
15
|
-
"value",
|
|
16
|
-
"placeholder",
|
|
17
|
-
"disabled",
|
|
18
|
-
"readonly",
|
|
19
|
-
"required",
|
|
20
|
-
"name",
|
|
21
|
-
"aria-invalid",
|
|
22
|
-
"aria-describedby"
|
|
23
|
-
], pe = ["disabled", "aria-label"], me = {
|
|
24
|
-
key: 0,
|
|
25
|
-
class: "nb-date-picker__col"
|
|
26
|
-
}, he = [
|
|
27
|
-
"id",
|
|
28
|
-
"value",
|
|
29
|
-
"placeholder",
|
|
30
|
-
"disabled",
|
|
31
|
-
"readonly",
|
|
32
|
-
"required",
|
|
33
|
-
"aria-invalid",
|
|
34
|
-
"aria-describedby"
|
|
35
|
-
], ge = ["disabled", "aria-label"], _e = {
|
|
36
|
-
key: 0,
|
|
37
|
-
class: "nb-date-picker__inner-header"
|
|
38
|
-
}, ve = ["for"], ye = {
|
|
39
|
-
key: 0,
|
|
40
|
-
class: "nb-date-picker__asterisk",
|
|
41
|
-
"aria-hidden": "true"
|
|
42
|
-
}, be = { class: "nb-date-picker__fluid-row" }, xe = [
|
|
43
|
-
"id",
|
|
44
|
-
"value",
|
|
45
|
-
"placeholder",
|
|
46
|
-
"disabled",
|
|
47
|
-
"readonly",
|
|
48
|
-
"required",
|
|
49
|
-
"name",
|
|
50
|
-
"aria-invalid"
|
|
51
|
-
], Se = ["disabled", "aria-label"], Ce = {
|
|
52
|
-
key: 0,
|
|
53
|
-
class: "nb-date-picker__inner-header"
|
|
54
|
-
}, we = ["for"], Te = {
|
|
55
|
-
key: 0,
|
|
56
|
-
class: "nb-date-picker__asterisk",
|
|
57
|
-
"aria-hidden": "true"
|
|
58
|
-
}, Ee = { class: "nb-date-picker__fluid-row" }, De = [
|
|
59
|
-
"id",
|
|
60
|
-
"value",
|
|
61
|
-
"placeholder",
|
|
62
|
-
"disabled",
|
|
63
|
-
"readonly",
|
|
64
|
-
"required",
|
|
65
|
-
"aria-invalid"
|
|
66
|
-
], Oe = ["disabled", "aria-label"], ke = ["aria-label"], Ae = { class: "nb-date-picker__cal-header" }, je = ["id"], Me = ["aria-labelledby"], Ne = { class: "nb-date-picker__cal-weekdays" }, Pe = ["abbr"], Fe = ["aria-selected", "aria-disabled"], Ie = [
|
|
67
|
-
"tabindex",
|
|
68
|
-
"disabled",
|
|
69
|
-
"aria-label",
|
|
70
|
-
"data-date",
|
|
71
|
-
"onClick"
|
|
72
|
-
], Le = /* @__PURE__ */ m({
|
|
73
|
-
inheritAttrs: !1,
|
|
74
|
-
__name: "DatePicker",
|
|
75
|
-
props: {
|
|
76
|
-
modelValue: { default: null },
|
|
77
|
-
type: { default: "single" },
|
|
78
|
-
endValue: { default: null },
|
|
79
|
-
min: { default: void 0 },
|
|
80
|
-
max: { default: void 0 },
|
|
81
|
-
weekStart: { default: 1 },
|
|
82
|
-
locale: { default: void 0 },
|
|
83
|
-
endPlaceholder: { default: "" },
|
|
84
|
-
endLabel: { default: "" },
|
|
85
|
-
endError: { default: "" },
|
|
86
|
-
endWarning: { default: "" },
|
|
87
|
-
disabledDates: {
|
|
88
|
-
type: [Array, Function],
|
|
89
|
-
default: void 0
|
|
90
|
-
},
|
|
91
|
-
readonly: {
|
|
92
|
-
type: Boolean,
|
|
93
|
-
default: !1
|
|
94
|
-
},
|
|
95
|
-
placeholder: { default: "" },
|
|
96
|
-
name: { default: "" },
|
|
97
|
-
disabled: {
|
|
98
|
-
type: Boolean,
|
|
99
|
-
default: !1
|
|
100
|
-
},
|
|
101
|
-
required: {
|
|
102
|
-
type: Boolean,
|
|
103
|
-
default: !1
|
|
104
|
-
},
|
|
105
|
-
id: { default: void 0 },
|
|
106
|
-
label: { default: "" },
|
|
107
|
-
error: { default: "" },
|
|
108
|
-
warning: { default: "" },
|
|
109
|
-
helper: { default: "" },
|
|
110
|
-
variant: { default: "default" },
|
|
111
|
-
size: { default: "md" }
|
|
112
|
-
},
|
|
113
|
-
emits: [
|
|
114
|
-
"update:modelValue",
|
|
115
|
-
"update:endValue",
|
|
116
|
-
"change"
|
|
117
|
-
],
|
|
118
|
-
setup(m, { expose: Le, emit: Re }) {
|
|
119
|
-
let C = m, { layerProps: ze } = t({ overlay: !0 }), w = Re, Be = `nb-date-picker-${ie()}`, T = s(() => C.id ?? Be), E = s(() => `${T.value}-end`), Ve = s(() => `${T.value}-helper`), He = s(() => `${T.value}-message`), Ue = s(() => `${T.value}-end-message`), We = s(() => `${T.value}-cal-title`), D = v(null), Ge = s(() => D.value !== null), O = v(!1), k = v($(/* @__PURE__ */ new Date())), Ke = v(null), A = v(null), j = v(null), qe = v(null), Je = v({
|
|
120
|
-
position: "fixed",
|
|
121
|
-
top: "0px",
|
|
122
|
-
left: "0px",
|
|
123
|
-
zIndex: "9999"
|
|
124
|
-
}), M = v("start"), N = s(() => C.locale || navigator.language || "pt-PT"), P = s(() => new Intl.DateTimeFormat(N.value).formatToParts(new Date(2e3, 0, 15)).map((e) => e.type === "day" ? "dd" : e.type === "month" ? "mm" : e.type === "year" ? "yyyy" : e.value).join(""));
|
|
125
|
-
function F(e) {
|
|
126
|
-
if (!e) return "";
|
|
127
|
-
let t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
128
|
-
return isNaN(t.getTime()) ? e : t.toLocaleDateString(N.value);
|
|
129
|
-
}
|
|
130
|
-
function Ye(e) {
|
|
131
|
-
return (/* @__PURE__ */ new Date(e + "T00:00:00")).toLocaleDateString(N.value, {
|
|
132
|
-
weekday: "long",
|
|
133
|
-
year: "numeric",
|
|
134
|
-
month: "long",
|
|
135
|
-
day: "numeric"
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
let Xe = s(() => F(C.modelValue ?? null)), Ze = s(() => F(C.endValue ?? null)), I = s(() => C.error ? {
|
|
139
|
-
variant: "error",
|
|
140
|
-
text: C.error
|
|
141
|
-
} : C.warning ? {
|
|
142
|
-
variant: "warning",
|
|
143
|
-
text: C.warning
|
|
144
|
-
} : null), L = s(() => C.type === "range" ? C.endError ? {
|
|
145
|
-
variant: "error",
|
|
146
|
-
text: C.endError
|
|
147
|
-
} : C.endWarning ? {
|
|
148
|
-
variant: "warning",
|
|
149
|
-
text: C.endWarning
|
|
150
|
-
} : null : null), R = s(() => I.value ? I.value : C.helper ? {
|
|
151
|
-
variant: "helper",
|
|
152
|
-
text: C.helper
|
|
153
|
-
} : null), Qe = s(() => {
|
|
154
|
-
if (C.variant === "default") return I.value ? He.value : C.helper ? Ve.value : void 0;
|
|
155
|
-
}), $e = s(() => {
|
|
156
|
-
if (C.variant === "default") return L.value ? Ue.value : C.helper ? Ve.value : void 0;
|
|
157
|
-
}), et = s(() => C.type === "range" && !!C.endLabel), tt = s(() => C.endLabel || C.endPlaceholder);
|
|
158
|
-
function z(e) {
|
|
159
|
-
return C.min != null && e < C.min || C.max != null && e > C.max ? !0 : C.disabledDates ? typeof C.disabledDates == "function" ? C.disabledDates(e) : C.disabledDates.includes(e) : !1;
|
|
160
|
-
}
|
|
161
|
-
function nt(e) {
|
|
162
|
-
let t = e.trim();
|
|
163
|
-
if (!t) return null;
|
|
164
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(t)) {
|
|
165
|
-
let e = /* @__PURE__ */ new Date(t + "T00:00:00");
|
|
166
|
-
return isNaN(e.getTime()) ? null : t;
|
|
167
|
-
}
|
|
168
|
-
let n = new Date(t);
|
|
169
|
-
return isNaN(n.getTime()) ? null : $(n);
|
|
170
|
-
}
|
|
171
|
-
function rt(e) {
|
|
172
|
-
let t = e.target.value, n = nt(t);
|
|
173
|
-
n && z(n) || (n || t === "") && (w("update:modelValue", n), w("change", n));
|
|
174
|
-
}
|
|
175
|
-
function it(e) {
|
|
176
|
-
let t = e.target.value, n = nt(t);
|
|
177
|
-
n && z(n) || (n || t === "") && w("update:endValue", n);
|
|
178
|
-
}
|
|
179
|
-
function B(e) {
|
|
180
|
-
D.value = e.target === j.value ? "end" : "start", C.type !== "simple" && !C.readonly && (M.value = D.value, O.value ? at() : U());
|
|
181
|
-
}
|
|
182
|
-
function V() {
|
|
183
|
-
D.value = null;
|
|
184
|
-
}
|
|
185
|
-
function H(e) {
|
|
186
|
-
if (!(C.type === "simple" || C.readonly)) switch (e.key) {
|
|
187
|
-
case "Escape":
|
|
188
|
-
O.value && (W(), e.preventDefault());
|
|
189
|
-
break;
|
|
190
|
-
case "ArrowDown":
|
|
191
|
-
e.preventDefault(), O.value || U(), h(K);
|
|
192
|
-
break;
|
|
193
|
-
case "Enter":
|
|
194
|
-
O.value || (e.preventDefault(), U(), h(K));
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
function at() {
|
|
199
|
-
let e = Ke.value?.querySelectorAll(".nb-date-picker__input-wrapper");
|
|
200
|
-
if (!e?.length) return;
|
|
201
|
-
let t = (M.value === "end" && e.length > 1 ? e[1] : e[0]).getBoundingClientRect();
|
|
202
|
-
Je.value = {
|
|
203
|
-
position: "fixed",
|
|
204
|
-
top: `${t.bottom + 4}px`,
|
|
205
|
-
left: `${t.left}px`,
|
|
206
|
-
zIndex: "9999"
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
function U() {
|
|
210
|
-
if (C.disabled || C.readonly || C.type === "simple" || O.value) return;
|
|
211
|
-
O.value = !0;
|
|
212
|
-
let e = M.value === "end" && C.endValue ? C.endValue : C.modelValue, t = e ? /* @__PURE__ */ new Date(e + "T00:00:00") : /* @__PURE__ */ new Date();
|
|
213
|
-
X.value = t.getFullYear(), Z.value = t.getMonth(), k.value = e || $(/* @__PURE__ */ new Date()), at();
|
|
214
|
-
}
|
|
215
|
-
function W() {
|
|
216
|
-
O.value && (O.value = !1, h(() => {
|
|
217
|
-
M.value === "end" && j.value ? j.value.focus() : A.value?.focus();
|
|
218
|
-
}));
|
|
219
|
-
}
|
|
220
|
-
function G() {
|
|
221
|
-
O.value ? W() : (M.value = "start", U(), h(K));
|
|
222
|
-
}
|
|
223
|
-
function K() {
|
|
224
|
-
h(() => {
|
|
225
|
-
(qe.value?.querySelector(`[data-date="${k.value}"]`))?.focus();
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
function ot(e) {
|
|
229
|
-
z(e) || (C.type === "range" ? M.value === "start" ? (w("update:modelValue", e), w("change", e), M.value = "end", k.value = e, h(() => j.value?.focus())) : (C.modelValue && e < C.modelValue ? (w("update:endValue", C.modelValue), w("update:modelValue", e), w("change", e)) : w("update:endValue", e), W()) : (w("update:modelValue", e), w("change", e), W()));
|
|
230
|
-
}
|
|
231
|
-
function st(e) {
|
|
232
|
-
let t = /* @__PURE__ */ new Date(k.value + "T00:00:00"), n = !0;
|
|
233
|
-
switch (e.key) {
|
|
234
|
-
case "ArrowRight":
|
|
235
|
-
q(t, 1);
|
|
236
|
-
break;
|
|
237
|
-
case "ArrowLeft":
|
|
238
|
-
q(t, -1);
|
|
239
|
-
break;
|
|
240
|
-
case "ArrowDown":
|
|
241
|
-
q(t, 7);
|
|
242
|
-
break;
|
|
243
|
-
case "ArrowUp":
|
|
244
|
-
q(t, -7);
|
|
245
|
-
break;
|
|
246
|
-
case "Home":
|
|
247
|
-
ct(t, "start");
|
|
248
|
-
break;
|
|
249
|
-
case "End":
|
|
250
|
-
ct(t, "end");
|
|
251
|
-
break;
|
|
252
|
-
case "PageUp":
|
|
253
|
-
e.shiftKey ? J(t, -12) : J(t, -1);
|
|
254
|
-
break;
|
|
255
|
-
case "PageDown":
|
|
256
|
-
e.shiftKey ? J(t, 12) : J(t, 1);
|
|
257
|
-
break;
|
|
258
|
-
case "Enter":
|
|
259
|
-
case " ":
|
|
260
|
-
e.preventDefault(), ot(k.value);
|
|
261
|
-
return;
|
|
262
|
-
case "Escape":
|
|
263
|
-
W();
|
|
264
|
-
break;
|
|
265
|
-
case "Tab":
|
|
266
|
-
W();
|
|
267
|
-
return;
|
|
268
|
-
default: n = !1;
|
|
269
|
-
}
|
|
270
|
-
n && e.preventDefault();
|
|
271
|
-
}
|
|
272
|
-
function q(e, t) {
|
|
273
|
-
let n = new Date(e);
|
|
274
|
-
n.setDate(n.getDate() + t), lt(n);
|
|
275
|
-
}
|
|
276
|
-
function ct(e, t) {
|
|
277
|
-
let n = e.getDay();
|
|
278
|
-
C.weekStart === 1 && (n = n === 0 ? 6 : n - 1);
|
|
279
|
-
let r = t === "start" ? -n : 6 - n, i = new Date(e);
|
|
280
|
-
i.setDate(i.getDate() + r), lt(i);
|
|
281
|
-
}
|
|
282
|
-
function J(e, t) {
|
|
283
|
-
let n = new Date(e);
|
|
284
|
-
n.setMonth(n.getMonth() + t), n.getDate() !== e.getDate() && n.setDate(0), lt(n);
|
|
285
|
-
}
|
|
286
|
-
function lt(e) {
|
|
287
|
-
let t = $(e);
|
|
288
|
-
C.min != null && t < C.min || C.max != null && t > C.max || (k.value = t, X.value = e.getFullYear(), Z.value = e.getMonth(), K());
|
|
289
|
-
}
|
|
290
|
-
function ut(e) {
|
|
291
|
-
let t = e.target, n = Ke.value?.contains(t) ?? !1, r = qe.value?.contains(t) ?? !1;
|
|
292
|
-
!n && !r && W();
|
|
293
|
-
}
|
|
294
|
-
function Y() {
|
|
295
|
-
O.value && at();
|
|
296
|
-
}
|
|
297
|
-
ae(O, (e) => {
|
|
298
|
-
e ? (document.addEventListener("mousedown", ut), window.addEventListener("scroll", Y, !0), window.addEventListener("resize", Y)) : (document.removeEventListener("mousedown", ut), window.removeEventListener("scroll", Y, !0), window.removeEventListener("resize", Y));
|
|
299
|
-
}), te(() => {
|
|
300
|
-
document.removeEventListener("mousedown", ut), window.removeEventListener("scroll", Y, !0), window.removeEventListener("resize", Y);
|
|
301
|
-
});
|
|
302
|
-
let X = v((/* @__PURE__ */ new Date()).getFullYear()), Z = v((/* @__PURE__ */ new Date()).getMonth());
|
|
303
|
-
function Q(e) {
|
|
304
|
-
let t = X.value * 12 + Z.value + e;
|
|
305
|
-
X.value = Math.floor(t / 12), Z.value = (t % 12 + 12) % 12;
|
|
306
|
-
let n = (/* @__PURE__ */ new Date(k.value + "T00:00:00")).getDate(), r = new Date(X.value, Z.value + 1, 0).getDate();
|
|
307
|
-
k.value = $(new Date(X.value, Z.value, Math.min(n, r))), K();
|
|
308
|
-
}
|
|
309
|
-
let dt = () => Q(-1), ft = () => Q(1), pt = () => Q(-12), mt = () => Q(12), ht = s(() => {
|
|
310
|
-
let e = new Date(X.value, Z.value, 1).toLocaleDateString(N.value, {
|
|
311
|
-
month: "long",
|
|
312
|
-
year: "numeric"
|
|
313
|
-
});
|
|
314
|
-
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
315
|
-
}), gt = s(() => {
|
|
316
|
-
let e = [], t = new Date(2024, 0, C.weekStart === 0 ? 7 : 1);
|
|
317
|
-
for (let n = 0; n < 7; n++) {
|
|
318
|
-
let r = new Date(t);
|
|
319
|
-
r.setDate(t.getDate() + n);
|
|
320
|
-
let i = r.toLocaleDateString(N.value, { weekday: "narrow" }).toUpperCase(), a = r.toLocaleDateString(N.value, { weekday: "long" });
|
|
321
|
-
e.push({
|
|
322
|
-
narrow: i,
|
|
323
|
-
full: a.charAt(0).toUpperCase() + a.slice(1)
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
return e;
|
|
327
|
-
});
|
|
328
|
-
function $(e) {
|
|
329
|
-
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
330
|
-
}
|
|
331
|
-
let _t = s(() => $(/* @__PURE__ */ new Date())), vt = s(() => {
|
|
332
|
-
let e = X.value, t = Z.value, n = new Date(e, t, 1), r = new Date(e, t + 1, 0), i = n.getDay();
|
|
333
|
-
C.weekStart === 1 && (i = i === 0 ? 6 : i - 1);
|
|
334
|
-
let a = [], o = C.modelValue ?? null, s = C.endValue ?? null, c = o && s ? o < s ? o : s : null, l = o && s ? o < s ? s : o : null;
|
|
335
|
-
function u(e, t) {
|
|
336
|
-
let n = $(e);
|
|
337
|
-
return {
|
|
338
|
-
key: n,
|
|
339
|
-
date: n,
|
|
340
|
-
day: e.getDate(),
|
|
341
|
-
inMonth: t,
|
|
342
|
-
isToday: n === _t.value,
|
|
343
|
-
isSelected: n === o || n === s,
|
|
344
|
-
inRange: c != null && l != null && n > c && n < l,
|
|
345
|
-
isRangeStart: n === c && l != null,
|
|
346
|
-
isRangeEnd: n === l && c != null,
|
|
347
|
-
isDisabled: z(n)
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
for (let n = i - 1; n >= 0; n--) a.push(u(new Date(e, t, -n), !1));
|
|
351
|
-
for (let n = 1; n <= r.getDate(); n++) a.push(u(new Date(e, t, n), !0));
|
|
352
|
-
let d = 7 - a.length % 7;
|
|
353
|
-
if (d < 7) for (let n = 1; n <= d; n++) a.push(u(new Date(e, t + 1, n), !1));
|
|
354
|
-
return a;
|
|
355
|
-
}), yt = s(() => {
|
|
356
|
-
let e = [];
|
|
357
|
-
for (let t = 0; t < vt.value.length; t += 7) e.push(vt.value.slice(t, t + 7));
|
|
358
|
-
return e;
|
|
359
|
-
}), bt = s(() => [
|
|
360
|
-
"nb-date-picker",
|
|
361
|
-
`nb-date-picker--${C.variant}`,
|
|
362
|
-
`nb-date-picker--${C.size}`,
|
|
363
|
-
`nb-date-picker--${C.type}`,
|
|
364
|
-
{
|
|
365
|
-
"nb-date-picker--focused": Ge.value,
|
|
366
|
-
"nb-date-picker--open": O.value,
|
|
367
|
-
"nb-date-picker--error": !!C.error || !!C.endError,
|
|
368
|
-
"nb-date-picker--warning": !C.error && !C.endError && (!!C.warning || !!C.endWarning),
|
|
369
|
-
"nb-date-picker--disabled": C.disabled,
|
|
370
|
-
"nb-date-picker--readonly": C.readonly
|
|
371
|
-
}
|
|
372
|
-
]), xt = s(() => ({
|
|
373
|
-
"nb-date-picker__input-wrapper--focused": D.value === "start",
|
|
374
|
-
"nb-date-picker__input-wrapper--error": !!C.error,
|
|
375
|
-
"nb-date-picker__input-wrapper--warning": !C.error && !!C.warning,
|
|
376
|
-
"nb-date-picker__input-wrapper--disabled": C.disabled,
|
|
377
|
-
"nb-date-picker__input-wrapper--readonly": C.readonly
|
|
378
|
-
})), St = s(() => ({
|
|
379
|
-
"nb-date-picker__input-wrapper--focused": D.value === "end",
|
|
380
|
-
"nb-date-picker__input-wrapper--error": !!C.endError,
|
|
381
|
-
"nb-date-picker__input-wrapper--warning": !C.endError && !!C.endWarning,
|
|
382
|
-
"nb-date-picker__input-wrapper--disabled": C.disabled,
|
|
383
|
-
"nb-date-picker__input-wrapper--readonly": C.readonly
|
|
384
|
-
}));
|
|
385
|
-
return Le({
|
|
386
|
-
open: U,
|
|
387
|
-
close: W,
|
|
388
|
-
focus: () => A.value?.focus()
|
|
389
|
-
}), (t, s) => (_(), u(a, null, [d("div", {
|
|
390
|
-
ref_key: "rootRef",
|
|
391
|
-
ref: Ke,
|
|
392
|
-
class: g(bt.value)
|
|
393
|
-
}, [m.variant === "default" ? (_(), u(a, { key: 0 }, [
|
|
394
|
-
t.$slots.label ? re(t.$slots, "label", { key: 0 }) : m.label && !et.value ? (_(), c(n, {
|
|
395
|
-
key: 1,
|
|
396
|
-
for: T.value,
|
|
397
|
-
required: m.required,
|
|
398
|
-
disabled: m.disabled
|
|
399
|
-
}, {
|
|
400
|
-
default: x(() => [f(y(m.label), 1)]),
|
|
401
|
-
_: 1
|
|
402
|
-
}, 8, [
|
|
403
|
-
"for",
|
|
404
|
-
"required",
|
|
405
|
-
"disabled"
|
|
406
|
-
])) : l("", !0),
|
|
407
|
-
p(i, {
|
|
408
|
-
dir: "row",
|
|
409
|
-
gap: m.type === "range" ? "sm" : void 0,
|
|
410
|
-
class: "nb-date-picker__fields"
|
|
411
|
-
}, {
|
|
412
|
-
default: x(() => [d("div", de, [et.value && m.label ? (_(), c(n, {
|
|
413
|
-
key: 0,
|
|
414
|
-
for: T.value,
|
|
415
|
-
required: m.required,
|
|
416
|
-
disabled: m.disabled
|
|
417
|
-
}, {
|
|
418
|
-
default: x(() => [f(y(m.label), 1)]),
|
|
419
|
-
_: 1
|
|
420
|
-
}, 8, [
|
|
421
|
-
"for",
|
|
422
|
-
"required",
|
|
423
|
-
"disabled"
|
|
424
|
-
])) : l("", !0), d("div", { class: g(["nb-date-picker__input-wrapper", xt.value]) }, [d("input", ee({
|
|
425
|
-
id: T.value,
|
|
426
|
-
ref_key: "inputRef",
|
|
427
|
-
ref: A
|
|
428
|
-
}, t.$attrs, {
|
|
429
|
-
type: "text",
|
|
430
|
-
class: "nb-date-picker__field",
|
|
431
|
-
value: Xe.value,
|
|
432
|
-
placeholder: m.placeholder || P.value,
|
|
433
|
-
disabled: m.disabled,
|
|
434
|
-
readonly: m.readonly,
|
|
435
|
-
required: m.required,
|
|
436
|
-
name: m.name,
|
|
437
|
-
"aria-invalid": m.error ? !0 : void 0,
|
|
438
|
-
"aria-describedby": Qe.value,
|
|
439
|
-
onInput: s[0] ||= (e) => rt(e),
|
|
440
|
-
onFocus: B,
|
|
441
|
-
onBlur: V,
|
|
442
|
-
onKeydown: H
|
|
443
|
-
}), null, 16, fe), m.type === "simple" ? l("", !0) : (_(), u("button", {
|
|
444
|
-
key: 0,
|
|
445
|
-
type: "button",
|
|
446
|
-
class: "nb-date-picker__icon",
|
|
447
|
-
disabled: m.disabled || m.readonly,
|
|
448
|
-
tabindex: "-1",
|
|
449
|
-
"aria-label": m.modelValue ? `Change date, ${F(m.modelValue)}` : "Choose date",
|
|
450
|
-
onClick: G
|
|
451
|
-
}, [p(e, {
|
|
452
|
-
name: b(S),
|
|
453
|
-
size: 16
|
|
454
|
-
}, null, 8, ["name"])], 8, pe))], 2)]), m.type === "range" ? (_(), u("div", me, [et.value ? (_(), c(n, {
|
|
455
|
-
key: 0,
|
|
456
|
-
for: E.value,
|
|
457
|
-
required: m.required,
|
|
458
|
-
disabled: m.disabled
|
|
459
|
-
}, {
|
|
460
|
-
default: x(() => [f(y(m.endLabel), 1)]),
|
|
461
|
-
_: 1
|
|
462
|
-
}, 8, [
|
|
463
|
-
"for",
|
|
464
|
-
"required",
|
|
465
|
-
"disabled"
|
|
466
|
-
])) : l("", !0), d("div", { class: g(["nb-date-picker__input-wrapper", St.value]) }, [d("input", {
|
|
467
|
-
id: E.value,
|
|
468
|
-
ref_key: "endInputRef",
|
|
469
|
-
ref: j,
|
|
470
|
-
type: "text",
|
|
471
|
-
class: "nb-date-picker__field",
|
|
472
|
-
value: Ze.value,
|
|
473
|
-
placeholder: m.endPlaceholder || P.value,
|
|
474
|
-
disabled: m.disabled,
|
|
475
|
-
readonly: m.readonly,
|
|
476
|
-
required: m.required,
|
|
477
|
-
"aria-invalid": m.endError ? !0 : void 0,
|
|
478
|
-
"aria-describedby": $e.value,
|
|
479
|
-
onInput: s[1] ||= (e) => it(e),
|
|
480
|
-
onFocus: B,
|
|
481
|
-
onBlur: V,
|
|
482
|
-
onKeydown: H
|
|
483
|
-
}, null, 40, he), d("button", {
|
|
484
|
-
type: "button",
|
|
485
|
-
class: "nb-date-picker__icon",
|
|
486
|
-
disabled: m.disabled || m.readonly,
|
|
487
|
-
tabindex: "-1",
|
|
488
|
-
"aria-label": m.endValue ? `Change end date, ${F(m.endValue)}` : "Choose end date",
|
|
489
|
-
onClick: G
|
|
490
|
-
}, [p(e, {
|
|
491
|
-
name: b(S),
|
|
492
|
-
size: 16
|
|
493
|
-
}, null, 8, ["name"])], 8, ge)], 2)])) : l("", !0)]),
|
|
494
|
-
_: 1
|
|
495
|
-
}, 8, ["gap"]),
|
|
496
|
-
I.value ? (_(), c(r, {
|
|
497
|
-
key: 2,
|
|
498
|
-
id: He.value,
|
|
499
|
-
variant: I.value.variant,
|
|
500
|
-
class: "nb-date-picker__message"
|
|
501
|
-
}, {
|
|
502
|
-
default: x(() => [f(y(I.value.text), 1)]),
|
|
503
|
-
_: 1
|
|
504
|
-
}, 8, ["id", "variant"])) : l("", !0),
|
|
505
|
-
L.value ? (_(), c(r, {
|
|
506
|
-
key: 3,
|
|
507
|
-
id: Ue.value,
|
|
508
|
-
variant: L.value.variant,
|
|
509
|
-
class: "nb-date-picker__message"
|
|
510
|
-
}, {
|
|
511
|
-
default: x(() => [f(y(L.value.text), 1)]),
|
|
512
|
-
_: 1
|
|
513
|
-
}, 8, ["id", "variant"])) : l("", !0),
|
|
514
|
-
!I.value && !L.value && m.helper ? (_(), c(r, {
|
|
515
|
-
key: 4,
|
|
516
|
-
id: Ve.value,
|
|
517
|
-
variant: "helper",
|
|
518
|
-
class: "nb-date-picker__message"
|
|
519
|
-
}, {
|
|
520
|
-
default: x(() => [f(y(m.helper), 1)]),
|
|
521
|
-
_: 1
|
|
522
|
-
}, 8, ["id"])) : l("", !0)
|
|
523
|
-
], 64)) : m.variant === "fluid" ? (_(), c(i, {
|
|
524
|
-
key: 1,
|
|
525
|
-
dir: "row",
|
|
526
|
-
gap: m.type === "range" ? "sm" : void 0,
|
|
527
|
-
class: "nb-date-picker__fields"
|
|
528
|
-
}, {
|
|
529
|
-
default: x(() => [d("div", { class: g(["nb-date-picker__input-wrapper nb-date-picker__input-wrapper--fluid", xt.value]) }, [m.label || t.$slots.label || R.value ? (_(), u("div", _e, [t.$slots.label ? re(t.$slots, "label", { key: 0 }) : (_(), u("label", {
|
|
530
|
-
key: 1,
|
|
531
|
-
for: T.value,
|
|
532
|
-
class: "nb-date-picker__inner-label"
|
|
533
|
-
}, [f(y(m.label) + " ", 1), m.required ? (_(), u("span", ye, "*")) : l("", !0)], 8, ve)), R.value ? (_(), c(r, {
|
|
534
|
-
key: 2,
|
|
535
|
-
variant: R.value.variant,
|
|
536
|
-
"icon-only": "",
|
|
537
|
-
class: "nb-date-picker__inner-message"
|
|
538
|
-
}, {
|
|
539
|
-
default: x(() => [f(y(R.value.text), 1)]),
|
|
540
|
-
_: 1
|
|
541
|
-
}, 8, ["variant"])) : l("", !0)])) : l("", !0), d("div", be, [d("input", ee({
|
|
542
|
-
id: T.value,
|
|
543
|
-
ref_key: "inputRef",
|
|
544
|
-
ref: A
|
|
545
|
-
}, t.$attrs, {
|
|
546
|
-
type: "text",
|
|
547
|
-
class: "nb-date-picker__field",
|
|
548
|
-
value: Xe.value,
|
|
549
|
-
placeholder: m.placeholder || P.value,
|
|
550
|
-
disabled: m.disabled,
|
|
551
|
-
readonly: m.readonly,
|
|
552
|
-
required: m.required,
|
|
553
|
-
name: m.name,
|
|
554
|
-
"aria-invalid": m.error ? !0 : void 0,
|
|
555
|
-
onInput: s[2] ||= (e) => rt(e),
|
|
556
|
-
onFocus: B,
|
|
557
|
-
onBlur: V,
|
|
558
|
-
onKeydown: H
|
|
559
|
-
}), null, 16, xe), m.type === "simple" ? l("", !0) : (_(), u("button", {
|
|
560
|
-
key: 0,
|
|
561
|
-
type: "button",
|
|
562
|
-
class: "nb-date-picker__icon",
|
|
563
|
-
disabled: m.disabled || m.readonly,
|
|
564
|
-
tabindex: "-1",
|
|
565
|
-
"aria-label": m.modelValue ? `Change date, ${F(m.modelValue)}` : "Choose date",
|
|
566
|
-
onClick: G
|
|
567
|
-
}, [p(e, {
|
|
568
|
-
name: b(S),
|
|
569
|
-
size: 16
|
|
570
|
-
}, null, 8, ["name"])], 8, Se))])], 2), m.type === "range" ? (_(), u("div", {
|
|
571
|
-
key: 0,
|
|
572
|
-
class: g(["nb-date-picker__input-wrapper nb-date-picker__input-wrapper--fluid", St.value])
|
|
573
|
-
}, [tt.value || L.value ? (_(), u("div", Ce, [d("label", {
|
|
574
|
-
for: E.value,
|
|
575
|
-
class: "nb-date-picker__inner-label"
|
|
576
|
-
}, [f(y(tt.value) + " ", 1), m.required ? (_(), u("span", Te, "*")) : l("", !0)], 8, we), L.value ? (_(), c(r, {
|
|
577
|
-
key: 0,
|
|
578
|
-
variant: L.value.variant,
|
|
579
|
-
"icon-only": "",
|
|
580
|
-
class: "nb-date-picker__inner-message"
|
|
581
|
-
}, {
|
|
582
|
-
default: x(() => [f(y(L.value.text), 1)]),
|
|
583
|
-
_: 1
|
|
584
|
-
}, 8, ["variant"])) : l("", !0)])) : l("", !0), d("div", Ee, [d("input", {
|
|
585
|
-
id: E.value,
|
|
586
|
-
ref_key: "endInputRef",
|
|
587
|
-
ref: j,
|
|
588
|
-
type: "text",
|
|
589
|
-
class: "nb-date-picker__field",
|
|
590
|
-
value: Ze.value,
|
|
591
|
-
placeholder: m.endPlaceholder || P.value,
|
|
592
|
-
disabled: m.disabled,
|
|
593
|
-
readonly: m.readonly,
|
|
594
|
-
required: m.required,
|
|
595
|
-
"aria-invalid": m.endError ? !0 : void 0,
|
|
596
|
-
onInput: s[3] ||= (e) => it(e),
|
|
597
|
-
onFocus: B,
|
|
598
|
-
onBlur: V,
|
|
599
|
-
onKeydown: H
|
|
600
|
-
}, null, 40, De), d("button", {
|
|
601
|
-
type: "button",
|
|
602
|
-
class: "nb-date-picker__icon",
|
|
603
|
-
disabled: m.disabled || m.readonly,
|
|
604
|
-
tabindex: "-1",
|
|
605
|
-
"aria-label": m.endValue ? `Change end date, ${F(m.endValue)}` : "Choose end date",
|
|
606
|
-
onClick: G
|
|
607
|
-
}, [p(e, {
|
|
608
|
-
name: b(S),
|
|
609
|
-
size: 16
|
|
610
|
-
}, null, 8, ["name"])], 8, Oe)])], 2)) : l("", !0)]),
|
|
611
|
-
_: 3
|
|
612
|
-
}, 8, ["gap"])) : l("", !0)], 2), (_(), c(o, { to: "body" }, [O.value ? (_(), u("div", ee({
|
|
613
|
-
key: 0,
|
|
614
|
-
ref_key: "calendarRef",
|
|
615
|
-
ref: qe,
|
|
616
|
-
role: "dialog",
|
|
617
|
-
"aria-modal": "true",
|
|
618
|
-
"aria-label": m.label ? `${m.label} calendar` : "Date picker",
|
|
619
|
-
class: "nb-date-picker__calendar"
|
|
620
|
-
}, b(ze), {
|
|
621
|
-
style: Je.value,
|
|
622
|
-
onKeydown: st,
|
|
623
|
-
onMousedown: s[4] ||= oe(() => {}, ["prevent"])
|
|
624
|
-
}), [d("div", Ae, [
|
|
625
|
-
d("button", {
|
|
626
|
-
type: "button",
|
|
627
|
-
class: "nb-date-picker__cal-nav",
|
|
628
|
-
"aria-label": "Previous year",
|
|
629
|
-
onClick: pt
|
|
630
|
-
}, [p(e, {
|
|
631
|
-
name: b(ce),
|
|
632
|
-
size: 16
|
|
633
|
-
}, null, 8, ["name"])]),
|
|
634
|
-
d("button", {
|
|
635
|
-
type: "button",
|
|
636
|
-
class: "nb-date-picker__cal-nav",
|
|
637
|
-
"aria-label": "Previous month",
|
|
638
|
-
onClick: dt
|
|
639
|
-
}, [p(e, {
|
|
640
|
-
name: b(le),
|
|
641
|
-
size: 16
|
|
642
|
-
}, null, 8, ["name"])]),
|
|
643
|
-
d("span", {
|
|
644
|
-
id: We.value,
|
|
645
|
-
class: "nb-date-picker__cal-title",
|
|
646
|
-
"aria-live": "polite"
|
|
647
|
-
}, y(ht.value), 9, je),
|
|
648
|
-
d("button", {
|
|
649
|
-
type: "button",
|
|
650
|
-
class: "nb-date-picker__cal-nav",
|
|
651
|
-
"aria-label": "Next month",
|
|
652
|
-
onClick: ft
|
|
653
|
-
}, [p(e, {
|
|
654
|
-
name: b(se),
|
|
655
|
-
size: 16
|
|
656
|
-
}, null, 8, ["name"])]),
|
|
657
|
-
d("button", {
|
|
658
|
-
type: "button",
|
|
659
|
-
class: "nb-date-picker__cal-nav",
|
|
660
|
-
"aria-label": "Next year",
|
|
661
|
-
onClick: mt
|
|
662
|
-
}, [p(e, {
|
|
663
|
-
name: b(ue),
|
|
664
|
-
size: 16
|
|
665
|
-
}, null, 8, ["name"])])
|
|
666
|
-
]), d("table", {
|
|
667
|
-
role: "grid",
|
|
668
|
-
"aria-labelledby": We.value,
|
|
669
|
-
class: "nb-date-picker__cal-table"
|
|
670
|
-
}, [d("thead", null, [d("tr", Ne, [(_(!0), u(a, null, ne(gt.value, (e) => (_(), u("th", {
|
|
671
|
-
key: e.narrow,
|
|
672
|
-
scope: "col",
|
|
673
|
-
class: "nb-date-picker__cal-weekday",
|
|
674
|
-
abbr: e.full
|
|
675
|
-
}, y(e.narrow), 9, Pe))), 128))])]), d("tbody", null, [(_(!0), u(a, null, ne(yt.value, (e, t) => (_(), u("tr", { key: t }, [(_(!0), u(a, null, ne(e, (e) => (_(), u("td", {
|
|
676
|
-
key: e.key,
|
|
677
|
-
role: "gridcell",
|
|
678
|
-
"aria-selected": e.isSelected || void 0,
|
|
679
|
-
"aria-disabled": e.isDisabled || void 0
|
|
680
|
-
}, [d("button", {
|
|
681
|
-
type: "button",
|
|
682
|
-
class: g(["nb-date-picker__cal-day", {
|
|
683
|
-
"nb-date-picker__cal-day--outside": !e.inMonth,
|
|
684
|
-
"nb-date-picker__cal-day--today": e.isToday,
|
|
685
|
-
"nb-date-picker__cal-day--selected": e.isSelected,
|
|
686
|
-
"nb-date-picker__cal-day--in-range": e.inRange,
|
|
687
|
-
"nb-date-picker__cal-day--range-start": e.isRangeStart,
|
|
688
|
-
"nb-date-picker__cal-day--range-end": e.isRangeEnd,
|
|
689
|
-
"nb-date-picker__cal-day--disabled": e.isDisabled,
|
|
690
|
-
"nb-date-picker__cal-day--focused": e.date === k.value
|
|
691
|
-
}]),
|
|
692
|
-
tabindex: e.date === k.value ? 0 : -1,
|
|
693
|
-
disabled: e.isDisabled,
|
|
694
|
-
"aria-label": Ye(e.date),
|
|
695
|
-
"data-date": e.date,
|
|
696
|
-
onClick: (t) => ot(e.date)
|
|
697
|
-
}, y(e.day), 11, Ie)], 8, Fe))), 128))]))), 128))])], 8, Me)], 16, ke)) : l("", !0)]))], 64));
|
|
698
|
-
}
|
|
699
|
-
});
|
|
700
|
-
//#endregion
|
|
701
|
-
export { Le as t };
|