@nubisco/ui 5.49.0 → 5.50.1

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