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