@paolojulian.dev/design-system 4.4.0 → 4.5.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.
package/dist/index.es.js CHANGED
@@ -1,281 +1,658 @@
1
- import { jsx as a, jsxs as k, Fragment as nt } from "react/jsx-runtime";
2
- import { cn as p } from "./utils.es.js";
3
- import { forwardRef as U, useId as Le, useState as V, useMemo as rt, useRef as Be, useEffect as ot, Children as dt } from "react";
4
- const Qt = ({
1
+ import { jsx as n, jsxs as _, Fragment as Bt } from "react/jsx-runtime";
2
+ import { cn as m } from "./utils.es.js";
3
+ import { forwardRef as Ne, useId as Qe, useRef as ne, useState as G, useMemo as Ee, useEffect as Me, Children as Kt } from "react";
4
+ import { C as Rt, a as At, b as Lt } from "./chevron-right-icon-CDCRryr1.js";
5
+ const Pa = ({
5
6
  children: e,
6
7
  gap: t = void 0,
7
- alignItems: n = void 0,
8
+ alignItems: a = void 0,
8
9
  justifyContent: r = void 0,
9
- className: s = ""
10
- }) => /* @__PURE__ */ a(
10
+ className: o = ""
11
+ }) => /* @__PURE__ */ n(
11
12
  "div",
12
13
  {
13
- className: p("flex flex-row", s),
14
+ className: m("flex flex-row", o),
14
15
  style: {
15
16
  gap: t,
16
- alignItems: n,
17
+ alignItems: a,
17
18
  justifyContent: r
18
19
  },
19
20
  children: e
20
21
  }
21
- ), ut = ({
22
+ ), jt = ({
22
23
  children: e,
23
24
  gap: t = void 0,
24
- alignItems: n = void 0,
25
+ alignItems: a = void 0,
25
26
  justifyContent: r = void 0,
26
- className: s = ""
27
- }) => /* @__PURE__ */ a(
27
+ className: o = ""
28
+ }) => /* @__PURE__ */ n(
28
29
  "div",
29
30
  {
30
- className: p("flex flex-col", s),
31
+ className: m("flex flex-col", o),
31
32
  style: {
32
33
  gap: t,
33
- alignItems: n,
34
+ alignItems: a,
34
35
  justifyContent: r
35
36
  },
36
37
  children: e
37
38
  }
38
- ), pt = U(
39
+ ), Ht = Ne(
39
40
  ({
40
41
  as: e = "span",
41
42
  variant: t = "neutral",
42
- size: n = "sm",
43
+ size: a = "sm",
43
44
  appearance: r = "subtle",
44
- leftIcon: s,
45
- rightIcon: l,
45
+ leftIcon: o,
46
+ rightIcon: c,
46
47
  children: d,
47
- className: f,
48
- ...b
49
- }, c) => /* @__PURE__ */ k(
48
+ className: g,
49
+ ...v
50
+ }, u) => /* @__PURE__ */ _(
50
51
  e,
51
52
  {
52
- ...b,
53
- ref: c,
54
- className: p(
53
+ ...v,
54
+ ref: u,
55
+ className: m(
55
56
  "p-badge",
56
57
  `p-badge--${t}`,
57
- `p-badge--${n}`,
58
+ `p-badge--${a}`,
58
59
  `p-badge--${r}`,
59
- f
60
+ g
60
61
  ),
61
62
  children: [
62
- s && /* @__PURE__ */ a("span", { className: "p-badge__icon", "aria-hidden": "true", children: s }),
63
- /* @__PURE__ */ a("span", { className: "p-badge__label", children: d }),
64
- l && /* @__PURE__ */ a("span", { className: "p-badge__icon", "aria-hidden": "true", children: l })
63
+ o && /* @__PURE__ */ n("span", { className: "p-badge__icon", "aria-hidden": "true", children: o }),
64
+ /* @__PURE__ */ n("span", { className: "p-badge__label", children: d }),
65
+ c && /* @__PURE__ */ n("span", { className: "p-badge__icon", "aria-hidden": "true", children: c })
65
66
  ]
66
67
  }
67
68
  )
68
69
  );
69
- pt.displayName = "PBadge";
70
- const ht = U(
70
+ Ht.displayName = "PBadge";
71
+ const Ut = Ne(
71
72
  ({
72
73
  variant: e = "primary",
73
74
  size: t = "md",
74
- fullWidth: n = !1,
75
+ fullWidth: a = !1,
75
76
  isActive: r = !1,
76
- isLoading: s = !1,
77
- leftIcon: l,
77
+ isLoading: o = !1,
78
+ leftIcon: c,
78
79
  rightIcon: d,
79
- children: f,
80
- className: b,
81
- ...c
82
- }, u) => {
83
- const h = !!("disabled" in c && c.disabled || s), v = p(
80
+ children: g,
81
+ className: v,
82
+ ...u
83
+ }, h) => {
84
+ const f = !!("disabled" in u && u.disabled || o), x = m(
84
85
  "p-button",
85
86
  `p-button--${e}`,
86
87
  `p-button--${t}`,
87
- n && "p-button--full-width",
88
+ a && "p-button--full-width",
88
89
  r && "p-button--active",
89
- b
90
- ), C = /* @__PURE__ */ k(nt, { children: [
91
- s ? /* @__PURE__ */ a("span", { className: "p-button__spinner", "aria-hidden": "true" }) : l && /* @__PURE__ */ a("span", { className: "p-button__icon", "aria-hidden": "true", children: l }),
92
- /* @__PURE__ */ a("span", { className: "p-button__label", children: f }),
93
- !s && d && /* @__PURE__ */ a("span", { className: "p-button__icon", "aria-hidden": "true", children: d })
90
+ v
91
+ ), R = /* @__PURE__ */ _(Bt, { children: [
92
+ o ? /* @__PURE__ */ n("span", { className: "p-button__spinner", "aria-hidden": "true" }) : c && /* @__PURE__ */ n("span", { className: "p-button__icon", "aria-hidden": "true", children: c }),
93
+ /* @__PURE__ */ n("span", { className: "p-button__label", children: g }),
94
+ !o && d && /* @__PURE__ */ n("span", { className: "p-button__icon", "aria-hidden": "true", children: d })
94
95
  ] });
95
- if ("href" in c && typeof c.href == "string") {
96
- const { disabled: $, onClick: w, ...x } = c, P = (q) => {
97
- if (h) {
98
- q.preventDefault();
96
+ if ("href" in u && typeof u.href == "string") {
97
+ const { disabled: A, onClick: I, ...C } = u, P = (U) => {
98
+ if (f) {
99
+ U.preventDefault();
99
100
  return;
100
101
  }
101
- w == null || w(q);
102
+ I == null || I(U);
102
103
  };
103
- return /* @__PURE__ */ a(
104
+ return /* @__PURE__ */ n(
104
105
  "a",
105
106
  {
106
- ...x,
107
- ref: u,
108
- className: v,
109
- "aria-disabled": h || void 0,
110
- "aria-busy": s || void 0,
107
+ ...C,
108
+ ref: h,
109
+ className: x,
110
+ "aria-disabled": f || void 0,
111
+ "aria-busy": o || void 0,
111
112
  "data-active": r || void 0,
112
- "data-disabled": $ || void 0,
113
- tabIndex: h ? -1 : x.tabIndex,
113
+ "data-disabled": A || void 0,
114
+ tabIndex: f ? -1 : C.tabIndex,
114
115
  onClick: P,
115
- children: C
116
+ children: R
116
117
  }
117
118
  );
118
119
  }
119
- const { type: M = "button", disabled: m, ..._ } = c;
120
- return /* @__PURE__ */ a(
120
+ const { type: T = "button", disabled: k, ...w } = u;
121
+ return /* @__PURE__ */ n(
121
122
  "button",
122
123
  {
123
- ..._,
124
- ref: u,
125
- type: M,
126
- disabled: !!(m || s),
127
- className: v,
128
- "aria-busy": s || void 0,
124
+ ...w,
125
+ ref: h,
126
+ type: T,
127
+ disabled: !!(k || o),
128
+ className: x,
129
+ "aria-busy": o || void 0,
129
130
  "data-active": r || void 0,
130
- children: C
131
+ children: R
131
132
  }
132
133
  );
133
134
  }
134
135
  );
135
- ht.displayName = "PButton";
136
- function it(e) {
137
- var t, n, r = "";
136
+ Ut.displayName = "PButton";
137
+ function Vt(e) {
138
+ var t, a, r = "";
138
139
  if (typeof e == "string" || typeof e == "number") r += e;
139
- else if (typeof e == "object") if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (n = it(e[t])) && (r && (r += " "), r += n);
140
+ else if (typeof e == "object") if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (a = Vt(e[t])) && (r && (r += " "), r += a);
140
141
  else for (t in e) e[t] && (r && (r += " "), r += t);
141
142
  return r;
142
143
  }
143
- function mt() {
144
- for (var e, t, n = 0, r = ""; n < arguments.length; ) (e = arguments[n++]) && (t = it(e)) && (r && (r += " "), r += t);
144
+ function Wt() {
145
+ for (var e, t, a = 0, r = ""; a < arguments.length; ) (e = arguments[a++]) && (t = Vt(e)) && (r && (r += " "), r += t);
145
146
  return r;
146
147
  }
147
- const Qe = (e) => typeof e == "boolean" ? "".concat(e) : e === 0 ? "0" : e, Xe = mt, gt = (e, t) => (n) => {
148
+ const Dt = (e) => typeof e == "boolean" ? "".concat(e) : e === 0 ? "0" : e, wt = Wt, qt = (e, t) => (a) => {
148
149
  var r;
149
- if ((t == null ? void 0 : t.variants) == null) return Xe(e, n == null ? void 0 : n.class, n == null ? void 0 : n.className);
150
- const { variants: s, defaultVariants: l } = t, d = Object.keys(s).map((c) => {
151
- const u = n == null ? void 0 : n[c], h = l == null ? void 0 : l[c];
152
- if (u === null) return null;
153
- const v = Qe(u) || Qe(h);
154
- return s[c][v];
155
- }), f = n && Object.entries(n).reduce((c, u) => {
156
- let [h, v] = u;
157
- return v === void 0 || (c[h] = v), c;
158
- }, {}), b = t == null || (r = t.compoundVariants) === null || r === void 0 ? void 0 : r.reduce((c, u) => {
159
- let { class: h, className: v, ...C } = u;
160
- return Object.entries(C).every((M) => {
161
- let [m, _] = M;
162
- return Array.isArray(_) ? _.includes({
163
- ...l,
164
- ...f
165
- }[m]) : {
166
- ...l,
167
- ...f
168
- }[m] === _;
150
+ if ((t == null ? void 0 : t.variants) == null) return wt(e, a == null ? void 0 : a.class, a == null ? void 0 : a.className);
151
+ const { variants: o, defaultVariants: c } = t, d = Object.keys(o).map((u) => {
152
+ const h = a == null ? void 0 : a[u], f = c == null ? void 0 : c[u];
153
+ if (h === null) return null;
154
+ const x = Dt(h) || Dt(f);
155
+ return o[u][x];
156
+ }), g = a && Object.entries(a).reduce((u, h) => {
157
+ let [f, x] = h;
158
+ return x === void 0 || (u[f] = x), u;
159
+ }, {}), v = t == null || (r = t.compoundVariants) === null || r === void 0 ? void 0 : r.reduce((u, h) => {
160
+ let { class: f, className: x, ...R } = h;
161
+ return Object.entries(R).every((T) => {
162
+ let [k, w] = T;
163
+ return Array.isArray(w) ? w.includes({
164
+ ...c,
165
+ ...g
166
+ }[k]) : {
167
+ ...c,
168
+ ...g
169
+ }[k] === w;
169
170
  }) ? [
170
- ...c,
171
- h,
172
- v
173
- ] : c;
171
+ ...u,
172
+ f,
173
+ x
174
+ ] : u;
174
175
  }, []);
175
- return Xe(e, d, b, n == null ? void 0 : n.class, n == null ? void 0 : n.className);
176
- }, ft = {
176
+ return wt(e, d, v, a == null ? void 0 : a.class, a == null ? void 0 : a.className);
177
+ }, Ot = {
177
178
  serif: "p-typography--serif",
178
179
  body: "p-typography--body",
179
180
  "body-wide": "p-typography--body-wide",
180
181
  heading: "p-typography--heading",
181
182
  "heading-lg": "p-typography--heading-lg",
182
183
  "heading-xl": "p-typography--heading-xl"
183
- }, yt = gt("p-typography", {
184
+ }, Gt = qt("p-typography", {
184
185
  variants: {
185
- variant: ft
186
+ variant: Ot
186
187
  },
187
188
  defaultVariants: {
188
189
  variant: "body"
189
190
  }
190
191
  });
191
- function Re({
192
+ function ot({
192
193
  as: e = "p",
193
194
  children: t,
194
- className: n = "",
195
+ className: a = "",
195
196
  variant: r,
196
- ...s
197
+ ...o
197
198
  }) {
198
- return /* @__PURE__ */ a(
199
+ return /* @__PURE__ */ n(
199
200
  e,
200
201
  {
201
- className: p(yt({ variant: r, className: n })),
202
- ...s,
202
+ className: m(Gt({ variant: r, className: a })),
203
+ ...o,
203
204
  children: t
204
205
  }
205
206
  );
206
207
  }
207
- function oe(e) {
208
+ function Ve(e) {
208
209
  return e != null && e !== !1 && e !== "";
209
210
  }
210
- function Ee(e, t) {
211
- return oe(e) ? typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ a(Re, { className: t, variant: "body-wide", children: e }) : /* @__PURE__ */ a("span", { className: p(t, "p-card__meta-custom"), children: e }) : null;
211
+ function Mt(e, t) {
212
+ return Ve(e) ? typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ n(ot, { className: t, variant: "body-wide", children: e }) : /* @__PURE__ */ n("span", { className: m(t, "p-card__meta-custom"), children: e }) : null;
212
213
  }
213
- function Ce(e) {
214
+ function et(e) {
214
215
  return typeof e == "number" ? `${e}px` : e;
215
216
  }
216
- const _t = U(
217
+ const Xt = Ne(
217
218
  ({
218
219
  prefix: e,
219
220
  eyebrow: t,
220
- title: n,
221
+ title: a,
221
222
  description: r,
222
- media: s,
223
- actions: l,
223
+ media: o,
224
+ actions: c,
224
225
  density: d = "default",
225
- fullWidth: f = !1,
226
- width: b,
227
- minWidth: c,
228
- height: u,
229
- minHeight: h,
230
- className: v,
231
- style: C,
232
- children: M,
233
- ...m
234
- }, _) => {
235
- const $ = "href" in m && typeof m.href == "string", w = p(
226
+ fullWidth: g = !1,
227
+ width: v,
228
+ minWidth: u,
229
+ height: h,
230
+ minHeight: f,
231
+ className: x,
232
+ style: R,
233
+ children: T,
234
+ ...k
235
+ }, w) => {
236
+ const A = "href" in k && typeof k.href == "string", I = m(
236
237
  "p-card",
237
238
  d !== "default" && `p-card--${d}`,
238
- f && "p-card--full-width",
239
- b !== void 0 && "p-card--custom-width",
240
- c !== void 0 && "p-card--custom-min-width",
241
- u !== void 0 && "p-card--custom-height",
242
- h !== void 0 && "p-card--custom-min-height",
243
- $ && "p-card--interactive",
244
- v
245
- ), x = {
246
- ...C,
247
- ...b !== void 0 ? { "--p-card-width": Ce(b) } : {},
248
- ...c !== void 0 ? { "--p-card-min-width": Ce(c) } : {},
249
- ...u !== void 0 ? { "--p-card-height": Ce(u) } : {},
250
- ...h !== void 0 ? { "--p-card-min-height": Ce(h) } : {}
251
- }, P = /* @__PURE__ */ k(nt, { children: [
252
- oe(s) && /* @__PURE__ */ a("div", { className: "p-card__media", children: s }),
253
- (oe(e) || oe(t)) && /* @__PURE__ */ k("div", { className: "p-card__meta", children: [
254
- Ee(e, "p-card__prefix"),
255
- Ee(t, "p-card__eyebrow")
239
+ g && "p-card--full-width",
240
+ v !== void 0 && "p-card--custom-width",
241
+ u !== void 0 && "p-card--custom-min-width",
242
+ h !== void 0 && "p-card--custom-height",
243
+ f !== void 0 && "p-card--custom-min-height",
244
+ A && "p-card--interactive",
245
+ x
246
+ ), C = {
247
+ ...R,
248
+ ...v !== void 0 ? { "--p-card-width": et(v) } : {},
249
+ ...u !== void 0 ? { "--p-card-min-width": et(u) } : {},
250
+ ...h !== void 0 ? { "--p-card-height": et(h) } : {},
251
+ ...f !== void 0 ? { "--p-card-min-height": et(f) } : {}
252
+ }, P = /* @__PURE__ */ _(Bt, { children: [
253
+ Ve(o) && /* @__PURE__ */ n("div", { className: "p-card__media", children: o }),
254
+ (Ve(e) || Ve(t)) && /* @__PURE__ */ _("div", { className: "p-card__meta", children: [
255
+ Mt(e, "p-card__prefix"),
256
+ Mt(t, "p-card__eyebrow")
256
257
  ] }),
257
- /* @__PURE__ */ k("div", { className: "p-card__body", children: [
258
- /* @__PURE__ */ a(Re, { as: "h3", className: "p-card__title", variant: "heading", children: $ ? /* @__PURE__ */ a("a", { ...m, className: "p-card__link", children: n }) : n }),
259
- oe(r) ? /* @__PURE__ */ a(Re, { className: "p-card__description", variant: "body", children: r }) : null
258
+ /* @__PURE__ */ _("div", { className: "p-card__body", children: [
259
+ /* @__PURE__ */ n(ot, { as: "h3", className: "p-card__title", variant: "heading", children: A ? /* @__PURE__ */ n("a", { ...k, className: "p-card__link", children: a }) : a }),
260
+ Ve(r) ? /* @__PURE__ */ n(ot, { className: "p-card__description", variant: "body", children: r }) : null
260
261
  ] }),
261
- oe(M) && /* @__PURE__ */ a("div", { className: "p-card__content", children: M }),
262
- oe(l) && /* @__PURE__ */ a("div", { className: "p-card__actions", children: l })
262
+ Ve(T) && /* @__PURE__ */ n("div", { className: "p-card__content", children: T }),
263
+ Ve(c) && /* @__PURE__ */ n("div", { className: "p-card__actions", children: c })
263
264
  ] });
264
- return $ ? /* @__PURE__ */ a("article", { ref: _, className: w, style: x, children: P }) : /* @__PURE__ */ a(
265
+ return A ? /* @__PURE__ */ n("article", { ref: w, className: I, style: C, children: P }) : /* @__PURE__ */ n(
265
266
  "article",
266
267
  {
267
- ...m,
268
- ref: _,
269
- className: w,
270
- style: x,
268
+ ...k,
269
+ ref: w,
270
+ className: I,
271
+ style: C,
271
272
  children: P
272
273
  }
273
274
  );
274
275
  }
275
276
  );
276
- _t.displayName = "PCard";
277
- const bt = new Intl.DateTimeFormat(void 0, { weekday: "short" });
278
- function Se(e) {
277
+ Xt.displayName = "PCard";
278
+ function Zt() {
279
+ return /* @__PURE__ */ n("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "m5 8 5 5 5-5" }) });
280
+ }
281
+ function Jt() {
282
+ return /* @__PURE__ */ n("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "m4 10 4 4 8-8" }) });
283
+ }
284
+ function It() {
285
+ return /* @__PURE__ */ _("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: [
286
+ /* @__PURE__ */ n("path", { d: "m5 5 10 10" }),
287
+ /* @__PURE__ */ n("path", { d: "m15 5-10 10" })
288
+ ] });
289
+ }
290
+ function $t(e) {
291
+ return e.trim().toLocaleLowerCase();
292
+ }
293
+ function pt(e, t) {
294
+ const a = $t(t);
295
+ return a ? e.filter((r) => {
296
+ const o = [
297
+ r.label,
298
+ r.value,
299
+ r.description,
300
+ r.group,
301
+ ...r.keywords ?? []
302
+ ].filter(Boolean).join(" ");
303
+ return $t(o).includes(a);
304
+ }) : e;
305
+ }
306
+ function zt(e) {
307
+ return e.findIndex((t) => !t.disabled);
308
+ }
309
+ function ht(e, t) {
310
+ const a = e.findIndex((r) => r.value === t && !r.disabled);
311
+ return a >= 0 ? a : zt(e);
312
+ }
313
+ function Ct(e, t, a) {
314
+ var o;
315
+ if (!e.length)
316
+ return -1;
317
+ let r = t;
318
+ for (let c = 0; c < e.length; c += 1)
319
+ if (r = (r + a + e.length) % e.length, !((o = e[r]) != null && o.disabled))
320
+ return r;
321
+ return -1;
322
+ }
323
+ function Et(e, t) {
324
+ if (typeof e == "function") {
325
+ e(t);
326
+ return;
327
+ }
328
+ e && (e.current = t);
329
+ }
330
+ const Qt = Ne(
331
+ ({
332
+ label: e,
333
+ options: t,
334
+ value: a,
335
+ defaultValue: r,
336
+ selectedOption: o,
337
+ onValueChange: c,
338
+ query: d,
339
+ defaultQuery: g,
340
+ onQueryChange: v,
341
+ filterMode: u = "local",
342
+ isLoading: h = !1,
343
+ isLoadingMore: f = !1,
344
+ hasMore: x = !1,
345
+ onLoadMore: R,
346
+ placeholder: T = "Select an option",
347
+ searchPlaceholder: k = "Search options",
348
+ emptyText: w = "No options found.",
349
+ loadingText: A = "Loading options...",
350
+ loadingMoreText: I = "Loading more options...",
351
+ loadMoreText: C = "Load more options",
352
+ helperText: P,
353
+ isError: U = !1,
354
+ errorMessage: he,
355
+ name: Ie,
356
+ disabled: me = !1,
357
+ readOnly: $e = !1,
358
+ required: oe = !1,
359
+ clearable: le = !0,
360
+ className: ee,
361
+ inputClassName: se,
362
+ id: Be,
363
+ style: Re,
364
+ ...ze
365
+ }, We) => {
366
+ const Z = Qe(), Y = Be ?? Z, ke = `${Y}-label`, N = `${Y}-input`, B = `${Y}-listbox`, j = `${Y}-helper`, L = `${Y}-error`, $ = ne(null), V = ne(null), S = ne(null), J = ne(null), ge = ne(null), te = ne(null), fe = a !== void 0, xe = d !== void 0, [Ce, qe] = G(r ?? ""), q = fe ? a : Ce, F = (o == null ? void 0 : o.value) === q ? o : t.find((i) => i.value === q) ?? null, [Oe, ie] = G(g ?? (F == null ? void 0 : F.label) ?? ""), E = xe ? d : Oe, [D, Q] = G(!1), [ce, Fe] = G(!1), z = Ee(
367
+ () => u === "local" ? pt(t, E) : t,
368
+ [u, t, E]
369
+ ), [De, be] = G(() => ht(t, q)), _e = D ? z[De] : void 0, Ae = _e ? `${B}-option-${De}` : void 0, de = `${Y}-modal-title`, ye = U && he ? L : P ? j : void 0, Le = !!F, ue = le && Le && !me && !$e, Ye = D ? E : (F == null ? void 0 : F.label) ?? E, Ke = h && z.length === 0, Ge = f || h && z.length > 0, Xe = !!(x && R && !h && !f);
370
+ Me(() => {
371
+ !D && !xe && ie((F == null ? void 0 : F.label) ?? "");
372
+ }, [D, xe, F]), Me(() => {
373
+ D && be((i) => z[i] && !z[i].disabled ? i : ht(z, q));
374
+ }, [z, D, q]), Me(() => {
375
+ var i;
376
+ D && ((i = ge.current) == null || i.scrollIntoView({ block: "nearest" }));
377
+ }, [De, D]), Me(() => {
378
+ var Te, Pe;
379
+ const i = globalThis, p = (Te = i.matchMedia) == null ? void 0 : Te.call(i, "(max-width: 64rem)");
380
+ if (!p)
381
+ return;
382
+ const W = () => Fe(p.matches);
383
+ return W(), (Pe = p.addEventListener) == null || Pe.call(p, "change", W), () => {
384
+ var je;
385
+ return (je = p.removeEventListener) == null ? void 0 : je.call(p, "change", W);
386
+ };
387
+ }, []), Me(() => {
388
+ var i;
389
+ !D || !ce || (i = S.current) == null || i.focus();
390
+ }, [ce, D]), Me(() => {
391
+ J.current && J.current.setCustomValidity(oe && !q ? "Select an option." : "");
392
+ }, [oe, q]);
393
+ const s = (i) => {
394
+ $.current = i, Et(We, i);
395
+ }, y = (i, p) => {
396
+ xe || ie(i), v == null || v(i, { source: p });
397
+ }, H = () => {
398
+ !x || !R || h || f || R({ query: E, optionCount: z.length });
399
+ };
400
+ Me(() => {
401
+ if (!D || !te.current)
402
+ return;
403
+ const { scrollHeight: i, clientHeight: p } = te.current;
404
+ i <= p + 48 && H();
405
+ });
406
+ const l = (i) => {
407
+ const p = (i == null ? void 0 : i.value) ?? "";
408
+ fe || qe(p), y((i == null ? void 0 : i.label) ?? "", i ? "selection" : "clear"), c == null || c(p, i);
409
+ }, b = (i = E) => {
410
+ if (me || $e)
411
+ return;
412
+ const p = u === "local" ? pt(t, i) : t;
413
+ y(i, "open"), be(ht(p, q)), Q(!0);
414
+ }, K = () => {
415
+ Q(!1), y((F == null ? void 0 : F.label) ?? "", "reset");
416
+ }, ve = (i) => {
417
+ const p = i.currentTarget.value, W = u === "local" ? pt(t, p) : t;
418
+ y(p, "input"), be(zt(W)), Q(!0);
419
+ }, ae = (i) => {
420
+ if (i.key === "ArrowDown") {
421
+ if (i.preventDefault(), !D) {
422
+ b("");
423
+ return;
424
+ }
425
+ be((p) => Ct(z, p, 1));
426
+ return;
427
+ }
428
+ if (i.key === "ArrowUp") {
429
+ if (i.preventDefault(), !D) {
430
+ b("");
431
+ return;
432
+ }
433
+ be((p) => Ct(z, p, -1));
434
+ return;
435
+ }
436
+ if (i.key === "Enter") {
437
+ if (!D) {
438
+ b(E);
439
+ return;
440
+ }
441
+ _e && !_e.disabled && (i.preventDefault(), l(_e), Q(!1));
442
+ return;
443
+ }
444
+ if (i.key === "Escape" && D) {
445
+ i.preventDefault(), K();
446
+ return;
447
+ }
448
+ i.key === "Tab" && K();
449
+ }, Se = (i, p) => {
450
+ var W;
451
+ i.preventDefault(), !p.disabled && (l(p), Q(!1), (W = V.current) == null || W.focus());
452
+ }, ct = (i) => {
453
+ var p;
454
+ i.preventDefault(), i.stopPropagation(), l(null), Q(!1), (p = V.current) == null || p.focus();
455
+ }, dt = (i) => {
456
+ const p = i.currentTarget;
457
+ p.scrollHeight - p.scrollTop - p.clientHeight <= 48 && H();
458
+ }, ut = (i) => {
459
+ if (!D)
460
+ return;
461
+ i.currentTarget.contains(i.relatedTarget) || K();
462
+ }, xt = z.reduce(
463
+ (i, p) => {
464
+ const W = p.group ?? null, Te = i.find((Pe) => Pe.group === W);
465
+ return Te ? (Te.options.push(p), i) : (i.push({ group: W, options: [p] }), i);
466
+ },
467
+ []
468
+ );
469
+ return /* @__PURE__ */ _(
470
+ "div",
471
+ {
472
+ ...ze,
473
+ ref: s,
474
+ id: Y,
475
+ style: Re,
476
+ onBlur: ut,
477
+ className: m(
478
+ "p-combobox",
479
+ D && "p-combobox--open",
480
+ U && "p-combobox--error",
481
+ me && "p-combobox--disabled",
482
+ $e && "p-combobox--readonly",
483
+ ee
484
+ ),
485
+ children: [
486
+ /* @__PURE__ */ _("div", { className: "p-combobox__field", children: [
487
+ /* @__PURE__ */ n(
488
+ "input",
489
+ {
490
+ ref: V,
491
+ id: N,
492
+ role: "combobox",
493
+ type: "text",
494
+ value: Ye,
495
+ placeholder: D ? k : " ",
496
+ disabled: me,
497
+ readOnly: $e,
498
+ required: !1,
499
+ "aria-autocomplete": "list",
500
+ "aria-controls": B,
501
+ "aria-describedby": ye,
502
+ "aria-activedescendant": Ae,
503
+ "aria-expanded": D,
504
+ "aria-haspopup": "listbox",
505
+ "aria-invalid": U || void 0,
506
+ "aria-labelledby": ke,
507
+ autoComplete: "off",
508
+ className: m("p-combobox__input", (ue || Le) && "p-combobox__input--adorned", se),
509
+ onChange: ve,
510
+ onClick: () => b(""),
511
+ onKeyDown: ae
512
+ }
513
+ ),
514
+ /* @__PURE__ */ n(
515
+ "label",
516
+ {
517
+ id: ke,
518
+ htmlFor: N,
519
+ className: m("p-combobox__label p-combobox__floating-label", U && "p-combobox__label--error"),
520
+ children: e
521
+ }
522
+ ),
523
+ /* @__PURE__ */ n("span", { "aria-hidden": "true", className: "p-combobox__label p-combobox__placeholder-label", children: T || e }),
524
+ ue ? /* @__PURE__ */ n(
525
+ "button",
526
+ {
527
+ type: "button",
528
+ className: "p-combobox__clear",
529
+ "aria-label": `Clear ${e}`,
530
+ onMouseDown: ct,
531
+ children: /* @__PURE__ */ n(It, {})
532
+ }
533
+ ) : null,
534
+ /* @__PURE__ */ n("span", { className: "p-combobox__chevron", "aria-hidden": "true", children: /* @__PURE__ */ n(Zt, {}) }),
535
+ D ? /* @__PURE__ */ _(
536
+ "div",
537
+ {
538
+ className: "p-combobox__panel",
539
+ role: ce ? "dialog" : void 0,
540
+ "aria-modal": ce || void 0,
541
+ "aria-labelledby": ce ? de : void 0,
542
+ children: [
543
+ /* @__PURE__ */ _("div", { className: "p-combobox__modal-header", children: [
544
+ /* @__PURE__ */ n("div", { id: de, className: "p-combobox__modal-title", children: e }),
545
+ /* @__PURE__ */ n("button", { type: "button", className: "p-combobox__modal-close", "aria-label": `Close ${e}`, onClick: K, children: /* @__PURE__ */ n(It, {}) })
546
+ ] }),
547
+ /* @__PURE__ */ n("div", { className: "p-combobox__modal-search", children: /* @__PURE__ */ n(
548
+ "input",
549
+ {
550
+ ref: S,
551
+ role: "combobox",
552
+ type: "search",
553
+ value: E,
554
+ placeholder: k,
555
+ "aria-activedescendant": Ae,
556
+ "aria-autocomplete": "list",
557
+ "aria-controls": B,
558
+ "aria-expanded": D,
559
+ "aria-haspopup": "listbox",
560
+ "aria-label": `Search ${e}`,
561
+ autoComplete: "off",
562
+ className: "p-combobox__modal-input",
563
+ onChange: ve,
564
+ onKeyDown: ae
565
+ }
566
+ ) }),
567
+ /* @__PURE__ */ _(
568
+ "div",
569
+ {
570
+ id: B,
571
+ ref: (i) => {
572
+ te.current = i;
573
+ },
574
+ role: "listbox",
575
+ "aria-busy": h || f || void 0,
576
+ "aria-labelledby": ke,
577
+ className: "p-combobox__list",
578
+ onScroll: dt,
579
+ children: [
580
+ Ke ? /* @__PURE__ */ _("div", { className: "p-combobox__status", role: "option", "aria-disabled": "true", "aria-selected": "false", children: [
581
+ /* @__PURE__ */ n("span", { className: "p-combobox__spinner", "aria-hidden": "true" }),
582
+ /* @__PURE__ */ n("span", { children: A })
583
+ ] }) : null,
584
+ xt.length ? xt.map((i) => /* @__PURE__ */ _("div", { className: "p-combobox__group", children: [
585
+ i.group ? /* @__PURE__ */ n("div", { className: "p-combobox__group-label", children: i.group }) : null,
586
+ i.options.map((p) => {
587
+ const W = z.indexOf(p), Te = W === De, Pe = p.value === q;
588
+ return /* @__PURE__ */ _(
589
+ "div",
590
+ {
591
+ ref: Te ? (je) => {
592
+ ge.current = je;
593
+ } : void 0,
594
+ id: `${B}-option-${W}`,
595
+ role: "option",
596
+ "aria-disabled": p.disabled || void 0,
597
+ "aria-selected": Pe,
598
+ className: m(
599
+ "p-combobox__option",
600
+ Te && "p-combobox__option--active",
601
+ Pe && "p-combobox__option--selected",
602
+ p.disabled && "p-combobox__option--disabled"
603
+ ),
604
+ onMouseDown: (je) => Se(je, p),
605
+ children: [
606
+ /* @__PURE__ */ n("span", { className: "p-combobox__option-check", children: Pe ? /* @__PURE__ */ n(Jt, {}) : null }),
607
+ /* @__PURE__ */ _("span", { className: "p-combobox__option-content", children: [
608
+ /* @__PURE__ */ n("span", { className: "p-combobox__option-label", children: p.label }),
609
+ p.description ? /* @__PURE__ */ n("span", { className: "p-combobox__option-description", children: p.description }) : null
610
+ ] }),
611
+ p.meta ? /* @__PURE__ */ n("span", { className: "p-combobox__option-meta", children: p.meta }) : null
612
+ ]
613
+ },
614
+ p.value
615
+ );
616
+ })
617
+ ] }, i.group ?? "ungrouped")) : Ke ? null : /* @__PURE__ */ n("div", { className: "p-combobox__empty", role: "option", "aria-disabled": "true", "aria-selected": "false", children: w }),
618
+ Ge ? /* @__PURE__ */ _("div", { className: "p-combobox__status p-combobox__status--footer", role: "option", "aria-disabled": "true", "aria-selected": "false", children: [
619
+ /* @__PURE__ */ n("span", { className: "p-combobox__spinner", "aria-hidden": "true" }),
620
+ /* @__PURE__ */ n("span", { children: I })
621
+ ] }) : null
622
+ ]
623
+ }
624
+ ),
625
+ Xe ? /* @__PURE__ */ n("div", { className: "p-combobox__footer", children: /* @__PURE__ */ n("button", { type: "button", className: "p-combobox__load-more", onMouseDown: (i) => i.preventDefault(), onClick: H, children: C }) }) : null
626
+ ]
627
+ }
628
+ ) : null
629
+ ] }),
630
+ /* @__PURE__ */ n(
631
+ "input",
632
+ {
633
+ ref: J,
634
+ type: "text",
635
+ name: Ie,
636
+ value: q ?? "",
637
+ required: oe,
638
+ tabIndex: -1,
639
+ "aria-hidden": "true",
640
+ className: "p-combobox__hidden-input",
641
+ onChange: () => {
642
+ }
643
+ }
644
+ ),
645
+ D ? /* @__PURE__ */ n("div", { className: "p-combobox__backdrop", "aria-hidden": "true", onMouseDown: K }) : null,
646
+ U && he ? /* @__PURE__ */ n("p", { id: L, role: "alert", className: "p-combobox__message p-combobox__message--error", children: he }) : null,
647
+ !U && P ? /* @__PURE__ */ n("p", { id: j, className: "p-combobox__message", children: P }) : null
648
+ ]
649
+ }
650
+ );
651
+ }
652
+ );
653
+ Qt.displayName = "PCombobox";
654
+ const ea = new Intl.DateTimeFormat(void 0, { weekday: "short" });
655
+ function nt(e) {
279
656
  if (!e)
280
657
  return null;
281
658
  if (e instanceof Date)
@@ -283,57 +660,63 @@ function Se(e) {
283
660
  const t = e.split("-").map(Number);
284
661
  if (t.length !== 3 || t.some(Number.isNaN))
285
662
  return null;
286
- const [n, r, s] = t, l = new Date(n, r - 1, s);
287
- return l.getFullYear() !== n || l.getMonth() !== r - 1 || l.getDate() !== s ? null : l;
663
+ const [a, r, o] = t, c = new Date(a, r - 1, o);
664
+ return c.getFullYear() !== a || c.getMonth() !== r - 1 || c.getDate() !== o ? null : c;
288
665
  }
289
- function ke(e) {
666
+ function Je(e) {
290
667
  if (!e)
291
668
  return "";
292
- const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
293
- return `${t}-${n}-${r}`;
669
+ const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
670
+ return `${t}-${a}-${r}`;
294
671
  }
295
- function ue(e) {
672
+ function re(e) {
296
673
  return new Date(e.getFullYear(), e.getMonth(), 1);
297
674
  }
298
- function vt(e) {
675
+ function it(e) {
299
676
  return new Date(e.getFullYear(), e.getMonth() + 1, 0);
300
677
  }
301
- function Ge(e, t) {
678
+ function kt(e, t) {
302
679
  return new Date(e.getFullYear(), e.getMonth() + t, 1);
303
680
  }
304
- function et(e, t) {
305
- const n = Ge(e, t), r = vt(n).getDate();
306
- return new Date(n.getFullYear(), n.getMonth(), Math.min(e.getDate(), r));
681
+ function Ft(e, t) {
682
+ const a = kt(e, t), r = it(a).getDate();
683
+ return new Date(a.getFullYear(), a.getMonth(), Math.min(e.getDate(), r));
307
684
  }
308
- function R(e, t) {
685
+ function pe(e, t) {
309
686
  return new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
310
687
  }
311
- function De(e, t) {
312
- return !!(e && t && ke(e) === ke(t));
688
+ function Ze(e, t) {
689
+ return !!(e && t && Je(e) === Je(t));
313
690
  }
314
- function de() {
691
+ function He() {
315
692
  const e = /* @__PURE__ */ new Date();
316
693
  return new Date(e.getFullYear(), e.getMonth(), e.getDate());
317
694
  }
318
- function Dt(e, t) {
319
- const n = ue(e), r = (n.getDay() - t + 7) % 7, s = R(n, -r);
320
- return Array.from({ length: 42 }, (l, d) => R(s, d));
695
+ function ta(e, t) {
696
+ const a = re(e), r = (a.getDay() - t + 7) % 7, o = pe(a, -r);
697
+ return Array.from({ length: 42 }, (c, d) => pe(o, d));
321
698
  }
322
- function He(e) {
699
+ function mt(e) {
323
700
  const t = typeof e.value == "function" ? e.value() : e.value;
324
- return Se(t);
701
+ return nt(t);
325
702
  }
326
- function kt(e, t) {
703
+ function aa(e, t) {
327
704
  return new Intl.DateTimeFormat(t, { month: "long", year: "numeric" }).format(e);
328
705
  }
329
- function Nt(e, t) {
706
+ function na(e) {
707
+ return Array.from({ length: 12 }, (t, a) => ({
708
+ label: new Intl.DateTimeFormat(e, { month: "long" }).format(new Date(2024, a, 1)),
709
+ value: a
710
+ }));
711
+ }
712
+ function ra(e, t) {
330
713
  return new Intl.DateTimeFormat(t, {
331
714
  month: "short",
332
715
  day: "numeric",
333
716
  year: "numeric"
334
717
  }).format(e);
335
718
  }
336
- function wt(e, t) {
719
+ function oa(e, t) {
337
720
  return new Intl.DateTimeFormat(t, {
338
721
  weekday: "long",
339
722
  month: "long",
@@ -341,274 +724,352 @@ function wt(e, t) {
341
724
  year: "numeric"
342
725
  }).format(e);
343
726
  }
344
- function xt(e, t) {
345
- const n = new Date(2024, 0, 7);
346
- return Array.from({ length: 7 }, (r, s) => {
347
- const l = R(n, e + s);
348
- return bt.formatToParts(l).length ? new Intl.DateTimeFormat(t, { weekday: "short" }).format(l) : "";
727
+ function la(e, t) {
728
+ const a = new Date(2024, 0, 7);
729
+ return Array.from({ length: 7 }, (r, o) => {
730
+ const c = pe(a, e + o);
731
+ return ea.formatToParts(c).length ? new Intl.DateTimeFormat(t, { weekday: "short" }).format(c) : "";
349
732
  });
350
733
  }
351
- function Oe(e, t) {
734
+ function gt(e, t) {
352
735
  return !!(t && e.getTime() < t.getTime());
353
736
  }
354
- function Ve(e, t) {
737
+ function ft(e, t) {
355
738
  return !!(t && e.getTime() > t.getTime());
356
739
  }
357
- function Mt() {
358
- return /* @__PURE__ */ k("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: [
359
- /* @__PURE__ */ a("path", { d: "M6 3v3" }),
360
- /* @__PURE__ */ a("path", { d: "M14 3v3" }),
361
- /* @__PURE__ */ a("path", { d: "M4 8h12" }),
362
- /* @__PURE__ */ a("path", { d: "M5 5h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1Z" })
363
- ] });
740
+ function Yt(e, t) {
741
+ return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth();
364
742
  }
365
- function $t() {
366
- return /* @__PURE__ */ a("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "m12 5-5 5 5 5" }) });
743
+ function bt(e, t, a) {
744
+ const r = re(e), o = it(e);
745
+ return !!(t && o < t || a && r > a);
367
746
  }
368
- function Pt() {
369
- return /* @__PURE__ */ a("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "m8 5 5 5-5 5" }) });
747
+ function sa(e, t, a) {
748
+ return t && it(e) < t ? re(t) : a && re(e) > a ? re(a) : re(e);
370
749
  }
371
- const Ct = U(
750
+ function ia(e, t, a, r) {
751
+ const o = re(e), c = it(e);
752
+ let d = new Date(
753
+ o.getFullYear(),
754
+ o.getMonth(),
755
+ Math.min(t.getDate(), c.getDate())
756
+ );
757
+ return a && d < a && (d = Yt(a, o) ? a : o), r && d > r && (d = Yt(r, o) ? r : c), d;
758
+ }
759
+ function ca(e, t, a, r) {
760
+ const o = e.getFullYear(), c = Math.min(o, r.getFullYear() - 100), d = Math.max(o, r.getFullYear() + 20), g = (t == null ? void 0 : t.getFullYear()) ?? c, v = (a == null ? void 0 : a.getFullYear()) ?? d, u = Math.min(g, v, o), h = Math.max(g, v, o);
761
+ return Array.from({ length: h - u + 1 }, (f, x) => u + x);
762
+ }
763
+ const da = Ne(
372
764
  ({
373
765
  label: e,
374
766
  value: t,
375
- defaultValue: n,
767
+ defaultValue: a,
376
768
  onValueChange: r,
377
- presets: s = [],
378
- customLabel: l = "Custom",
769
+ presets: o = [],
770
+ customLabel: c = "Custom",
379
771
  showCustom: d = !0,
380
- presetColumns: f = "auto",
381
- placeholder: b = "Select date",
382
- helperText: c,
383
- isError: u = !1,
384
- errorMessage: h,
385
- min: v,
386
- max: C,
387
- name: M,
388
- disabled: m = !1,
389
- readOnly: _ = !1,
390
- required: $ = !1,
391
- locale: w,
392
- weekStartsOn: x = 0,
772
+ presetColumns: g = "auto",
773
+ placeholder: v = "Select date",
774
+ helperText: u,
775
+ isError: h = !1,
776
+ errorMessage: f,
777
+ min: x,
778
+ max: R,
779
+ name: T,
780
+ disabled: k = !1,
781
+ readOnly: w = !1,
782
+ required: A = !1,
783
+ locale: I,
784
+ weekStartsOn: C = 0,
393
785
  className: P,
394
- id: q,
395
- style: ie,
396
- ...se
397
- }, pe) => {
398
- const ze = Le(), E = q ?? ze, L = `${E}-label`, A = `${E}-panel`, z = `${E}-helper`, he = `${E}-error`, me = t !== void 0, [Ne, Ke] = V(n ?? ""), [Y, T] = V(!1), ge = me ? t : Ne, g = Se(ge), F = rt(de, []), ee = Se(v), Z = Se(C), [G, K] = V(() => ue(g ?? F)), [J, j] = V(() => g ?? F), le = Be(null), te = Be({}), we = Dt(G, x), xe = xt(x, w), ae = s.length > 0, je = ae ? d : !0, ne = f === "auto" ? void 0 : {
399
- "--p-date-picker-preset-columns": String(f)
400
- }, Me = u && h ? he : c ? z : void 0, fe = g ? Nt(g, w) : b, ye = ae ? s.some((i) => De(He(i), g)) : !1, _e = Y || !!(g && !ye);
401
- ot(() => {
402
- var i;
403
- Y && ((i = te.current[ke(J)]) == null || i.focus());
404
- }, [J, Y, G]);
405
- const be = (i, N) => {
406
- const S = ke(i);
407
- me || Ke(S), i && K(ue(i)), r == null || r(S, { date: i, source: N });
408
- }, $e = (i) => {
409
- if (m || _)
786
+ id: U,
787
+ style: he,
788
+ ...Ie
789
+ }, me) => {
790
+ const $e = Qe(), oe = U ?? $e, le = `${oe}-label`, ee = `${oe}-panel`, se = `${oe}-helper`, Be = `${oe}-error`, Re = t !== void 0, [ze, We] = G(a ?? ""), [Z, Y] = G(!1), ke = Re ? t : ze, N = nt(ke), B = Ee(He, []), j = nt(x), L = nt(R), [$, V] = G(() => re(N ?? B)), [S, J] = G(() => N ?? B), ge = ne(null), te = ne({}), fe = ne(!1), xe = ta($, C), Ce = la(C, I), qe = Ee(() => na(I), [I]), q = ca($, j, L, B), F = o.length > 0, Oe = F ? d : !0, ie = g === "auto" ? void 0 : {
791
+ "--p-date-picker-preset-columns": String(g)
792
+ }, E = h && f ? Be : u ? se : void 0, D = N ? ra(N, I) : v, Q = F ? o.some((s) => Ze(mt(s), N)) : !1, ce = Z || !!(N && !Q), Fe = kt($, -1), z = kt($, 1), De = bt(Fe, j, L), be = bt(z, j, L);
793
+ Me(() => {
794
+ var s;
795
+ Z && fe.current && ((s = te.current[Je(S)]) == null || s.focus(), fe.current = !1);
796
+ }, [S, Z, $]);
797
+ const _e = (s, y) => {
798
+ const H = Je(s);
799
+ Re || We(H), s && V(re(s)), r == null || r(H, { date: s, source: y });
800
+ }, Ae = (s) => {
801
+ if (k || w)
410
802
  return;
411
- const N = g ?? F;
412
- le.current = i, j(N), K(ue(N)), T(!0);
413
- }, W = (i = !1) => {
414
- var N;
415
- T(!1), i && ((N = le.current) == null || N.focus());
416
- }, ve = (i) => {
417
- if (m || _)
803
+ const y = N ?? B;
804
+ ge.current = s, fe.current = !0, J(y), V(re(y)), Y(!0);
805
+ }, de = (s = !1) => {
806
+ var y;
807
+ Y(!1), s && ((y = ge.current) == null || y.focus());
808
+ }, ye = (s) => {
809
+ const y = sa(s, j, L);
810
+ V(y), J(ia(y, S, j, L));
811
+ }, Le = (s) => {
812
+ const { value: y } = s.currentTarget;
813
+ ye(new Date($.getFullYear(), Number(y), 1));
814
+ }, ue = (s) => {
815
+ const { value: y } = s.currentTarget;
816
+ ye(new Date(Number(y), $.getMonth(), 1));
817
+ }, Ye = (s) => {
818
+ if (k || w)
418
819
  return;
419
- const N = He(i);
420
- be(N, "preset"), W();
421
- }, Pe = (i) => {
422
- m || _ || Oe(i, ee) || Ve(i, Z) || (j(i), be(i, "calendar"), W(!0));
423
- }, Q = (i) => {
424
- Oe(i, ee) || Ve(i, Z) || (j(i), K(ue(i)));
425
- }, We = (i) => (N) => {
426
- if (N.key === "Escape") {
427
- N.preventDefault(), W(!0);
820
+ const y = mt(s);
821
+ _e(y, "preset"), de();
822
+ }, Ke = (s) => {
823
+ k || w || gt(s, j) || ft(s, L) || (J(s), _e(s, "calendar"), de(!0));
824
+ }, Ge = (s) => {
825
+ gt(s, j) || ft(s, L) || (fe.current = !0, J(s), V(re(s)));
826
+ }, Xe = (s) => (y) => {
827
+ if (y.key === "Escape") {
828
+ y.preventDefault(), de(!0);
428
829
  return;
429
830
  }
430
- const S = (i.getDay() - x + 7) % 7, D = {
431
- ArrowLeft: R(i, -1),
432
- ArrowRight: R(i, 1),
433
- ArrowUp: R(i, -7),
434
- ArrowDown: R(i, 7),
435
- Home: R(i, -S),
436
- End: R(i, 6 - S),
437
- PageUp: et(i, -1),
438
- PageDown: et(i, 1)
439
- }[N.key];
440
- D && (N.preventDefault(), Q(D));
831
+ const H = (s.getDay() - C + 7) % 7, b = {
832
+ ArrowLeft: pe(s, -1),
833
+ ArrowRight: pe(s, 1),
834
+ ArrowUp: pe(s, -7),
835
+ ArrowDown: pe(s, 7),
836
+ Home: pe(s, -H),
837
+ End: pe(s, 6 - H),
838
+ PageUp: Ft(s, -1),
839
+ PageDown: Ft(s, 1)
840
+ }[y.key];
841
+ b && (y.preventDefault(), Ge(b));
441
842
  };
442
- return /* @__PURE__ */ k(
843
+ return /* @__PURE__ */ _(
443
844
  "div",
444
845
  {
445
- ...se,
446
- ref: pe,
447
- id: E,
448
- style: ne ? { ...ie, ...ne } : ie,
449
- className: p(
846
+ ...Ie,
847
+ ref: me,
848
+ id: oe,
849
+ style: ie ? { ...he, ...ie } : he,
850
+ className: m(
450
851
  "p-date-picker",
451
- ae && "p-date-picker--with-presets",
452
- u && "p-date-picker--error",
453
- m && "p-date-picker--disabled",
852
+ F && "p-date-picker--with-presets",
853
+ h && "p-date-picker--error",
854
+ k && "p-date-picker--disabled",
454
855
  P
455
856
  ),
456
857
  children: [
457
- /* @__PURE__ */ k("div", { id: L, className: "p-date-picker__label", children: [
458
- /* @__PURE__ */ a("span", { children: e }),
459
- ae ? /* @__PURE__ */ a("span", { className: p("p-date-picker__label-value", !g && "p-date-picker__label-value--empty"), children: fe }) : null
460
- ] }),
461
- ae ? /* @__PURE__ */ k(
858
+ F ? /* @__PURE__ */ _("div", { id: le, className: "p-date-picker__label", children: [
859
+ /* @__PURE__ */ n("span", { children: e }),
860
+ /* @__PURE__ */ n("span", { className: m("p-date-picker__label-value", !N && "p-date-picker__label-value--empty"), children: D })
861
+ ] }) : null,
862
+ F ? /* @__PURE__ */ _(
462
863
  "div",
463
864
  {
464
- "aria-describedby": Me,
465
- "aria-labelledby": L,
466
- className: p(
865
+ "aria-describedby": E,
866
+ "aria-labelledby": le,
867
+ className: m(
467
868
  "p-date-picker__presets",
468
- f !== "auto" && "p-date-picker__presets--fixed"
869
+ g !== "auto" && "p-date-picker__presets--fixed"
469
870
  ),
470
871
  role: "group",
471
872
  children: [
472
- s.map((i) => {
473
- const N = He(i), S = De(N, g);
474
- return /* @__PURE__ */ a(
873
+ o.map((s) => {
874
+ const y = mt(s), H = Ze(y, N);
875
+ return /* @__PURE__ */ n(
475
876
  "button",
476
877
  {
477
878
  type: "button",
478
- className: p("p-date-picker__preset", S && "p-date-picker__preset--active"),
479
- disabled: m,
480
- "aria-pressed": S,
481
- onClick: () => ve(i),
482
- children: i.label
879
+ className: m("p-date-picker__preset", H && "p-date-picker__preset--active"),
880
+ disabled: k,
881
+ "aria-pressed": H,
882
+ onClick: () => Ye(s),
883
+ children: s.label
483
884
  },
484
- i.label
885
+ s.label
485
886
  );
486
887
  }),
487
- je ? /* @__PURE__ */ a(
888
+ Oe ? /* @__PURE__ */ n(
488
889
  "button",
489
890
  {
490
891
  type: "button",
491
- className: p(
892
+ className: m(
492
893
  "p-date-picker__preset",
493
- _e && "p-date-picker__preset--active"
894
+ ce && "p-date-picker__preset--active"
494
895
  ),
495
- disabled: m,
496
- "aria-controls": A,
497
- "aria-expanded": Y,
498
- "aria-pressed": _e,
499
- onClick: (i) => Y ? W(!0) : $e(i.currentTarget),
500
- children: l
896
+ disabled: k,
897
+ "aria-controls": ee,
898
+ "aria-expanded": Z,
899
+ "aria-pressed": ce,
900
+ onClick: (s) => Z ? de(!0) : Ae(s.currentTarget),
901
+ children: c
501
902
  }
502
903
  ) : null
503
904
  ]
504
905
  }
505
- ) : /* @__PURE__ */ k(
906
+ ) : /* @__PURE__ */ _(
506
907
  "button",
507
908
  {
508
909
  type: "button",
509
- className: p("p-date-picker__trigger", !g && "p-date-picker__trigger--empty"),
510
- disabled: m,
511
- "aria-controls": A,
512
- "aria-describedby": Me,
513
- "aria-expanded": Y,
910
+ className: m(
911
+ "p-date-picker__trigger",
912
+ !N && "p-date-picker__trigger--empty",
913
+ N && "p-date-picker__trigger--filled",
914
+ Z && "p-date-picker__trigger--open"
915
+ ),
916
+ disabled: k,
917
+ "aria-controls": ee,
918
+ "aria-describedby": E,
919
+ "aria-expanded": Z,
514
920
  "aria-haspopup": "dialog",
515
- "aria-labelledby": L,
516
- onClick: (i) => Y ? W(!0) : $e(i.currentTarget),
921
+ "aria-label": `${e}: ${D}`,
922
+ onClick: (s) => Z ? de(!0) : Ae(s.currentTarget),
517
923
  children: [
518
- /* @__PURE__ */ a("span", { children: fe }),
519
- /* @__PURE__ */ a("span", { className: "p-date-picker__trigger-icon", children: /* @__PURE__ */ a(Mt, {}) })
924
+ /* @__PURE__ */ n(
925
+ "span",
926
+ {
927
+ id: le,
928
+ className: m(
929
+ "p-date-picker__trigger-label p-date-picker__trigger-floating-label",
930
+ h && "p-date-picker__trigger-label--error"
931
+ ),
932
+ "aria-hidden": "true",
933
+ children: e
934
+ }
935
+ ),
936
+ /* @__PURE__ */ n(
937
+ "span",
938
+ {
939
+ className: m(
940
+ "p-date-picker__trigger-label p-date-picker__trigger-placeholder-label",
941
+ h && "p-date-picker__trigger-label--error"
942
+ ),
943
+ "aria-hidden": "true",
944
+ children: e
945
+ }
946
+ ),
947
+ /* @__PURE__ */ n("span", { className: "p-date-picker__trigger-value", children: D }),
948
+ /* @__PURE__ */ n("span", { className: "p-date-picker__trigger-icon", children: /* @__PURE__ */ n(Rt, {}) })
520
949
  ]
521
950
  }
522
951
  ),
523
- /* @__PURE__ */ a("input", { type: "hidden", name: M, value: ge ?? "", required: $ }),
524
- Y && /* @__PURE__ */ k(
952
+ /* @__PURE__ */ n("input", { type: "hidden", name: T, value: ke ?? "", required: A }),
953
+ Z && /* @__PURE__ */ _(
525
954
  "div",
526
955
  {
527
- id: A,
956
+ id: ee,
528
957
  className: "p-date-picker__panel",
529
958
  role: "dialog",
530
- "aria-labelledby": `${A}-title`,
531
- onKeyDown: (i) => {
532
- i.key === "Escape" && W();
959
+ "aria-labelledby": `${ee}-title`,
960
+ onKeyDown: (s) => {
961
+ s.key === "Escape" && de();
533
962
  },
534
963
  children: [
535
- /* @__PURE__ */ k("div", { className: "p-date-picker__calendar-header", children: [
536
- /* @__PURE__ */ a(
964
+ /* @__PURE__ */ _("div", { className: "p-date-picker__calendar-header", children: [
965
+ /* @__PURE__ */ n(
537
966
  "button",
538
967
  {
539
968
  type: "button",
540
969
  className: "p-date-picker__nav",
541
970
  "aria-label": "Previous month",
542
- onClick: () => K((i) => Ge(i, -1)),
543
- children: /* @__PURE__ */ a($t, {})
971
+ disabled: De,
972
+ onClick: () => ye(Fe),
973
+ children: /* @__PURE__ */ n(At, {})
544
974
  }
545
975
  ),
546
- /* @__PURE__ */ a("div", { id: `${A}-title`, className: "p-date-picker__month", children: kt(G, w) }),
547
- /* @__PURE__ */ a(
976
+ /* @__PURE__ */ _("div", { className: "p-date-picker__month", children: [
977
+ /* @__PURE__ */ n("span", { id: `${ee}-title`, className: "p-date-picker__month-label", children: aa($, I) }),
978
+ /* @__PURE__ */ n(
979
+ "select",
980
+ {
981
+ className: "p-date-picker__month-select p-date-picker__calendar-select",
982
+ "aria-label": "Month",
983
+ value: $.getMonth(),
984
+ onChange: Le,
985
+ children: qe.map((s) => /* @__PURE__ */ n(
986
+ "option",
987
+ {
988
+ value: s.value,
989
+ disabled: bt(new Date($.getFullYear(), s.value, 1), j, L),
990
+ children: s.label
991
+ },
992
+ s.value
993
+ ))
994
+ }
995
+ ),
996
+ /* @__PURE__ */ n(
997
+ "select",
998
+ {
999
+ className: "p-date-picker__year-select p-date-picker__calendar-select",
1000
+ "aria-label": "Year",
1001
+ value: $.getFullYear(),
1002
+ onChange: ue,
1003
+ children: q.map((s) => /* @__PURE__ */ n("option", { value: s, children: s }, s))
1004
+ }
1005
+ )
1006
+ ] }),
1007
+ /* @__PURE__ */ n(
548
1008
  "button",
549
1009
  {
550
1010
  type: "button",
551
1011
  className: "p-date-picker__nav",
552
1012
  "aria-label": "Next month",
553
- onClick: () => K((i) => Ge(i, 1)),
554
- children: /* @__PURE__ */ a(Pt, {})
1013
+ disabled: be,
1014
+ onClick: () => ye(z),
1015
+ children: /* @__PURE__ */ n(Lt, {})
555
1016
  }
556
1017
  )
557
1018
  ] }),
558
- /* @__PURE__ */ a("div", { className: "p-date-picker__weekdays", "aria-hidden": "true", children: xe.map((i) => /* @__PURE__ */ a("span", { children: i }, i)) }),
559
- /* @__PURE__ */ a("div", { className: "p-date-picker__grid", role: "grid", "aria-labelledby": `${A}-title`, children: we.map((i) => {
560
- const N = ke(i), S = i.getMonth() !== G.getMonth(), o = De(i, g), D = De(i, F), B = Oe(i, ee) || Ve(i, Z);
561
- return /* @__PURE__ */ a(
1019
+ /* @__PURE__ */ n("div", { className: "p-date-picker__weekdays", "aria-hidden": "true", children: Ce.map((s) => /* @__PURE__ */ n("span", { children: s }, s)) }),
1020
+ /* @__PURE__ */ n("div", { className: "p-date-picker__grid", role: "grid", "aria-labelledby": `${ee}-title`, children: xe.map((s) => {
1021
+ const y = Je(s), H = s.getMonth() !== $.getMonth(), l = Ze(s, N), b = Ze(s, B), K = gt(s, j) || ft(s, L);
1022
+ return /* @__PURE__ */ n(
562
1023
  "button",
563
1024
  {
564
- ref: (re) => {
565
- te.current[N] = re;
1025
+ ref: (ve) => {
1026
+ te.current[y] = ve;
566
1027
  },
567
1028
  type: "button",
568
1029
  role: "gridcell",
569
- "data-date": N,
570
- className: p(
1030
+ "data-date": y,
1031
+ className: m(
571
1032
  "p-date-picker__day",
572
- S && "p-date-picker__day--outside",
573
- D && "p-date-picker__day--today",
574
- o && "p-date-picker__day--selected"
1033
+ H && "p-date-picker__day--outside",
1034
+ b && "p-date-picker__day--today",
1035
+ l && "p-date-picker__day--selected"
575
1036
  ),
576
- disabled: B,
577
- "aria-label": wt(i, w),
578
- "aria-selected": o,
579
- tabIndex: De(i, J) ? 0 : -1,
580
- onClick: () => Pe(i),
581
- onKeyDown: We(i),
582
- children: i.getDate()
1037
+ disabled: K,
1038
+ "aria-label": oa(s, I),
1039
+ "aria-selected": l,
1040
+ tabIndex: Ze(s, S) ? 0 : -1,
1041
+ onClick: () => Ke(s),
1042
+ onKeyDown: Xe(s),
1043
+ children: s.getDate()
583
1044
  },
584
- N
1045
+ y
585
1046
  );
586
1047
  }) })
587
1048
  ]
588
1049
  }
589
1050
  ),
590
- u && h ? /* @__PURE__ */ a("p", { id: he, role: "alert", className: "p-date-picker__message p-date-picker__message--error", children: h }) : null,
591
- !u && c ? /* @__PURE__ */ a("p", { id: z, className: "p-date-picker__message", children: c }) : null
1051
+ h && f ? /* @__PURE__ */ n("p", { id: Be, role: "alert", className: "p-date-picker__message p-date-picker__message--error", children: f }) : null,
1052
+ !h && u ? /* @__PURE__ */ n("p", { id: se, className: "p-date-picker__message", children: u }) : null
592
1053
  ]
593
1054
  }
594
1055
  );
595
1056
  }
596
1057
  );
597
- Ct.displayName = "PDatePicker";
598
- const Xt = {
599
- today: { label: "Today", value: () => de() },
600
- yesterday: { label: "Yesterday", value: () => R(de(), -1) },
601
- tomorrow: { label: "Tomorrow", value: () => R(de(), 1) },
602
- startOfMonth: { label: "Start of month", value: () => ue(de()) },
1058
+ da.displayName = "PDatePicker";
1059
+ const Ba = {
1060
+ today: { label: "Today", value: () => He() },
1061
+ yesterday: { label: "Yesterday", value: () => pe(He(), -1) },
1062
+ tomorrow: { label: "Tomorrow", value: () => pe(He(), 1) },
1063
+ startOfMonth: { label: "Start of month", value: () => re(He()) },
603
1064
  endOfMonth: {
604
1065
  label: "End of month",
605
1066
  value: () => {
606
- const e = de();
1067
+ const e = He();
607
1068
  return new Date(e.getFullYear(), e.getMonth() + 1, 0);
608
1069
  }
609
1070
  }
610
- }, It = new Intl.DateTimeFormat(void 0, { weekday: "short" });
611
- function Ae(e) {
1071
+ }, ua = new Intl.DateTimeFormat(void 0, { weekday: "short" });
1072
+ function lt(e) {
612
1073
  if (!e)
613
1074
  return null;
614
1075
  if (e instanceof Date)
@@ -616,50 +1077,56 @@ function Ae(e) {
616
1077
  const t = e.split("-").map(Number);
617
1078
  if (t.length !== 3 || t.some(Number.isNaN))
618
1079
  return null;
619
- const [n, r, s] = t, l = new Date(n, r - 1, s);
620
- return l.getFullYear() !== n || l.getMonth() !== r - 1 || l.getDate() !== s ? null : l;
1080
+ const [a, r, o] = t, c = new Date(a, r - 1, o);
1081
+ return c.getFullYear() !== a || c.getMonth() !== r - 1 || c.getDate() !== o ? null : c;
621
1082
  }
622
- function y(e) {
1083
+ function M(e) {
623
1084
  if (!e)
624
1085
  return "";
625
- const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
626
- return `${t}-${n}-${r}`;
1086
+ const t = e.getFullYear(), a = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
1087
+ return `${t}-${a}-${r}`;
627
1088
  }
628
1089
  function X(e) {
629
1090
  return new Date(e.getFullYear(), e.getMonth(), 1);
630
1091
  }
631
- function Je(e) {
1092
+ function Ue(e) {
632
1093
  return new Date(e.getFullYear(), e.getMonth() + 1, 0);
633
1094
  }
634
- function Ye(e, t) {
1095
+ function st(e, t) {
635
1096
  return new Date(e.getFullYear(), e.getMonth() + t, 1);
636
1097
  }
637
- function tt(e, t) {
638
- const n = Ye(e, t), r = Je(n).getDate();
639
- return new Date(n.getFullYear(), n.getMonth(), Math.min(e.getDate(), r));
1098
+ function St(e, t) {
1099
+ const a = st(e, t), r = Ue(a).getDate();
1100
+ return new Date(a.getFullYear(), a.getMonth(), Math.min(e.getDate(), r));
640
1101
  }
641
- function I(e, t) {
1102
+ function O(e, t) {
642
1103
  return new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
643
1104
  }
644
- function O() {
1105
+ function we() {
645
1106
  const e = /* @__PURE__ */ new Date();
646
1107
  return new Date(e.getFullYear(), e.getMonth(), e.getDate());
647
1108
  }
648
- function Ft(e, t) {
649
- const n = X(e), r = (n.getDay() - t + 7) % 7, s = I(n, -r);
650
- return Array.from({ length: 42 }, (l, d) => I(s, d));
1109
+ function pa(e, t) {
1110
+ const a = X(e), r = (a.getDay() - t + 7) % 7, o = O(a, -r);
1111
+ return Array.from({ length: 42 }, (c, d) => O(o, d));
651
1112
  }
652
- function St(e, t) {
1113
+ function ha(e, t) {
653
1114
  return new Intl.DateTimeFormat(t, { month: "long", year: "numeric" }).format(e);
654
1115
  }
655
- function Ie(e, t) {
1116
+ function ma(e) {
1117
+ return Array.from({ length: 12 }, (t, a) => ({
1118
+ label: new Intl.DateTimeFormat(e, { month: "long" }).format(new Date(2024, a, 1)),
1119
+ value: a
1120
+ }));
1121
+ }
1122
+ function tt(e, t) {
656
1123
  return new Intl.DateTimeFormat(t, {
657
1124
  month: "short",
658
1125
  day: "numeric",
659
1126
  year: "numeric"
660
1127
  }).format(e);
661
1128
  }
662
- function Tt(e, t) {
1129
+ function ga(e, t) {
663
1130
  return new Intl.DateTimeFormat(t, {
664
1131
  weekday: "long",
665
1132
  month: "long",
@@ -667,475 +1134,550 @@ function Tt(e, t) {
667
1134
  year: "numeric"
668
1135
  }).format(e);
669
1136
  }
670
- function Bt(e, t) {
671
- const n = new Date(2024, 0, 7);
672
- return Array.from({ length: 7 }, (r, s) => {
673
- const l = I(n, e + s);
674
- return It.formatToParts(l).length ? new Intl.DateTimeFormat(t, { weekday: "short" }).format(l) : "";
1137
+ function fa(e, t) {
1138
+ const a = new Date(2024, 0, 7);
1139
+ return Array.from({ length: 7 }, (r, o) => {
1140
+ const c = O(a, e + o);
1141
+ return ua.formatToParts(c).length ? new Intl.DateTimeFormat(t, { weekday: "short" }).format(c) : "";
675
1142
  });
676
1143
  }
677
- function Fe(e, t) {
678
- return !!(e && t && y(e) === y(t));
1144
+ function at(e, t) {
1145
+ return !!(e && t && M(e) === M(t));
679
1146
  }
680
- function Ue(e, t) {
1147
+ function _t(e, t) {
681
1148
  return !!(t && e.getTime() < t.getTime());
682
1149
  }
683
- function qe(e, t) {
1150
+ function yt(e, t) {
684
1151
  return !!(t && e.getTime() > t.getTime());
685
1152
  }
686
- function Rt(e, t, n) {
687
- return !!(t && n && e > t && e < n);
1153
+ function Tt(e, t) {
1154
+ return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth();
1155
+ }
1156
+ function vt(e, t, a) {
1157
+ const r = X(e), o = Ue(e);
1158
+ return !!(t && o < t || a && r > a);
1159
+ }
1160
+ function ba(e, t, a) {
1161
+ return t && Ue(e) < t ? X(t) : a && X(e) > a ? X(a) : X(e);
1162
+ }
1163
+ function _a(e, t, a, r) {
1164
+ const o = X(e), c = Ue(e);
1165
+ let d = new Date(
1166
+ o.getFullYear(),
1167
+ o.getMonth(),
1168
+ Math.min(t.getDate(), c.getDate())
1169
+ );
1170
+ return a && d < a && (d = Tt(a, o) ? a : o), r && d > r && (d = Tt(r, o) ? r : c), d;
1171
+ }
1172
+ function ya(e, t, a, r) {
1173
+ const o = e.getFullYear(), c = Math.min(o, r.getFullYear() - 100), d = Math.max(o, r.getFullYear() + 20), g = (t == null ? void 0 : t.getFullYear()) ?? c, v = (a == null ? void 0 : a.getFullYear()) ?? d, u = Math.min(g, v, o), h = Math.max(g, v, o);
1174
+ return Array.from({ length: h - u + 1 }, (f, x) => u + x);
1175
+ }
1176
+ function va(e, t, a) {
1177
+ return !!(t && a && e > t && e < a);
688
1178
  }
689
- function At(e, t) {
1179
+ function Na(e, t) {
690
1180
  return !e && !t ? {} : e && t && t < e ? {
691
- start: y(t),
692
- end: y(e)
1181
+ start: M(t),
1182
+ end: M(e)
693
1183
  } : {
694
- start: y(e),
695
- end: y(t)
1184
+ start: M(e),
1185
+ end: M(t)
696
1186
  };
697
1187
  }
698
- function Ze(e) {
1188
+ function Nt(e) {
699
1189
  return typeof e.value == "function" ? e.value() : e.value;
700
1190
  }
701
- function Te(e) {
1191
+ function rt(e) {
702
1192
  return {
703
- startDate: Ae(e == null ? void 0 : e.start),
704
- endDate: Ae(e == null ? void 0 : e.end)
1193
+ startDate: lt(e == null ? void 0 : e.start),
1194
+ endDate: lt(e == null ? void 0 : e.end)
705
1195
  };
706
1196
  }
707
- function at(e, t) {
1197
+ function Pt(e, t) {
708
1198
  return !!(e != null && e.start && (e != null && e.end) && e.start === (t == null ? void 0 : t.start) && e.end === (t == null ? void 0 : t.end));
709
1199
  }
710
- function Yt(e, t, n) {
711
- const { startDate: r, endDate: s } = Te(e);
712
- return r && s ? `${Ie(r, n)} - ${Ie(s, n)}` : r ? `${Ie(r, n)} -` : s ? `- ${Ie(s, n)}` : t;
713
- }
714
- function Lt() {
715
- return /* @__PURE__ */ k("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: [
716
- /* @__PURE__ */ a("path", { d: "M6 3v3" }),
717
- /* @__PURE__ */ a("path", { d: "M14 3v3" }),
718
- /* @__PURE__ */ a("path", { d: "M4 8h12" }),
719
- /* @__PURE__ */ a("path", { d: "M5 5h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1Z" })
720
- ] });
721
- }
722
- function zt() {
723
- return /* @__PURE__ */ a("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "m12 5-5 5 5 5" }) });
724
- }
725
- function Kt() {
726
- return /* @__PURE__ */ a("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "m8 5 5 5-5 5" }) });
1200
+ function ka(e, t, a) {
1201
+ const { startDate: r, endDate: o } = rt(e);
1202
+ return r && o ? `${tt(r, a)} - ${tt(o, a)}` : r ? `${tt(r, a)} -` : o ? `- ${tt(o, a)}` : t;
727
1203
  }
728
- const jt = U(
1204
+ const xa = Ne(
729
1205
  ({
730
1206
  label: e,
731
1207
  value: t,
732
- defaultValue: n,
1208
+ defaultValue: a,
733
1209
  onValueChange: r,
734
- presets: s = [],
735
- customLabel: l = "Custom",
1210
+ presets: o = [],
1211
+ customLabel: c = "Custom",
736
1212
  showCustom: d = !0,
737
- presetColumns: f = "auto",
738
- placeholder: b = "Select range",
739
- helperText: c,
740
- isError: u = !1,
741
- errorMessage: h,
742
- min: v,
743
- max: C,
744
- nameStart: M,
745
- nameEnd: m,
746
- disabled: _ = !1,
747
- readOnly: $ = !1,
748
- required: w = !1,
749
- locale: x,
1213
+ presetColumns: g = "auto",
1214
+ placeholder: v = "Select range",
1215
+ helperText: u,
1216
+ isError: h = !1,
1217
+ errorMessage: f,
1218
+ min: x,
1219
+ max: R,
1220
+ nameStart: T,
1221
+ nameEnd: k,
1222
+ disabled: w = !1,
1223
+ readOnly: A = !1,
1224
+ required: I = !1,
1225
+ locale: C,
750
1226
  weekStartsOn: P = 0,
751
- className: q,
752
- id: ie,
753
- style: se,
754
- ...pe
755
- }, ze) => {
756
- const E = Le(), L = ie ?? E, A = `${L}-label`, z = `${L}-panel`, he = `${L}-helper`, me = `${L}-error`, Ne = t !== void 0, [Ke, Y] = V(n ?? {}), [T, ge] = V(!1), g = Ne ? t : Ke, { startDate: F, endDate: ee } = Te(g), Z = rt(O, []), G = Ae(v), K = Ae(C), [J, j] = V(() => X(F ?? Z)), [le, te] = V(() => F ?? Z), we = Be(null), xe = Be({}), ae = Ft(J, P), je = Bt(P, x), ne = s.length > 0, Me = ne ? d : !0, fe = f === "auto" ? void 0 : {
757
- "--p-date-range-picker-preset-columns": String(f)
758
- }, ye = !!(g != null && g.start && (g != null && g.end)), _e = u && h ? me : c ? he : void 0, be = Yt(g, b, x), $e = ne ? s.some((o) => at(Ze(o), g)) : !1, W = T || !!(ye && !$e);
759
- ot(() => {
760
- var o;
761
- T && ((o = xe.current[y(le)]) == null || o.focus());
762
- }, [le, T, J]);
763
- const ve = (o, D) => {
764
- const { startDate: B, endDate: re } = Te(o), H = At(B, re);
765
- Ne || Y(H);
766
- const ce = Te(H);
767
- ce.startDate && j(X(ce.startDate)), r == null || r(H, {
768
- startDate: ce.startDate,
769
- endDate: ce.endDate,
770
- source: D
1227
+ className: U,
1228
+ id: he,
1229
+ style: Ie,
1230
+ ...me
1231
+ }, $e) => {
1232
+ const oe = Qe(), le = he ?? oe, ee = `${le}-label`, se = `${le}-panel`, Be = `${le}-helper`, Re = `${le}-error`, ze = t !== void 0, [We, Z] = G(a ?? {}), [Y, ke] = G(!1), N = ze ? t : We, { startDate: B, endDate: j } = rt(N), L = Ee(we, []), $ = lt(x), V = lt(R), [S, J] = G(() => X(B ?? L)), [ge, te] = G(() => B ?? L), fe = ne(null), xe = ne({}), Ce = ne(!1), qe = pa(S, P), q = fa(P, C), F = Ee(() => ma(C), [C]), Oe = ya(S, $, V, L), ie = o.length > 0, E = ie ? d : !0, D = g === "auto" ? void 0 : {
1233
+ "--p-date-range-picker-preset-columns": String(g)
1234
+ }, Q = !!(N != null && N.start && (N != null && N.end)), ce = h && f ? Re : u ? Be : void 0, Fe = ka(N, v, C), z = ie ? o.some((l) => Pt(Nt(l), N)) : !1, De = Y || !!(Q && !z), be = st(S, -1), _e = st(S, 1), Ae = vt(be, $, V), de = vt(_e, $, V);
1235
+ Me(() => {
1236
+ var l;
1237
+ Y && Ce.current && ((l = xe.current[M(ge)]) == null || l.focus(), Ce.current = !1);
1238
+ }, [ge, Y, S]);
1239
+ const ye = (l, b) => {
1240
+ const { startDate: K, endDate: ve } = rt(l), ae = Na(K, ve);
1241
+ ze || Z(ae);
1242
+ const Se = rt(ae);
1243
+ Se.startDate && J(X(Se.startDate)), r == null || r(ae, {
1244
+ startDate: Se.startDate,
1245
+ endDate: Se.endDate,
1246
+ source: b
771
1247
  });
772
- }, Pe = (o) => {
773
- if (_ || $)
1248
+ }, Le = (l) => {
1249
+ if (w || A)
774
1250
  return;
775
- const D = F ?? Z;
776
- we.current = o, te(D), j(X(D)), ge(!0);
777
- }, Q = (o = !1) => {
778
- var D;
779
- ge(!1), o && ((D = we.current) == null || D.focus());
780
- }, We = (o) => {
781
- _ || $ || (ve(Ze(o), "preset"), Q());
782
- }, i = (o) => {
783
- if (!(_ || $ || Ue(o, G) || qe(o, K))) {
784
- if (!F || ee) {
785
- te(o), ve({ start: y(o), end: "" }, "calendar");
1251
+ const b = B ?? L;
1252
+ fe.current = l, Ce.current = !0, te(b), J(X(b)), ke(!0);
1253
+ }, ue = (l = !1) => {
1254
+ var b;
1255
+ ke(!1), l && ((b = fe.current) == null || b.focus());
1256
+ }, Ye = (l) => {
1257
+ const b = ba(l, $, V);
1258
+ J(b), te(_a(b, ge, $, V));
1259
+ }, Ke = (l) => {
1260
+ const { value: b } = l.currentTarget;
1261
+ Ye(new Date(S.getFullYear(), Number(b), 1));
1262
+ }, Ge = (l) => {
1263
+ const { value: b } = l.currentTarget;
1264
+ Ye(new Date(Number(b), S.getMonth(), 1));
1265
+ }, Xe = (l) => {
1266
+ w || A || (ye(Nt(l), "preset"), ue());
1267
+ }, s = (l) => {
1268
+ if (!(w || A || _t(l, $) || yt(l, V))) {
1269
+ if (!B || j) {
1270
+ te(l), ye({ start: M(l), end: "" }, "calendar");
786
1271
  return;
787
1272
  }
788
- te(o), ve({ start: y(F), end: y(o) }, "calendar"), Q(!0);
1273
+ te(l), ye({ start: M(B), end: M(l) }, "calendar"), ue(!0);
789
1274
  }
790
- }, N = (o) => {
791
- Ue(o, G) || qe(o, K) || (te(o), j(X(o)));
792
- }, S = (o) => (D) => {
793
- if (D.key === "Escape") {
794
- D.preventDefault(), Q(!0);
1275
+ }, y = (l) => {
1276
+ _t(l, $) || yt(l, V) || (Ce.current = !0, te(l), J(X(l)));
1277
+ }, H = (l) => (b) => {
1278
+ if (b.key === "Escape") {
1279
+ b.preventDefault(), ue(!0);
795
1280
  return;
796
1281
  }
797
- const B = (o.getDay() - P + 7) % 7, H = {
798
- ArrowLeft: I(o, -1),
799
- ArrowRight: I(o, 1),
800
- ArrowUp: I(o, -7),
801
- ArrowDown: I(o, 7),
802
- Home: I(o, -B),
803
- End: I(o, 6 - B),
804
- PageUp: tt(o, -1),
805
- PageDown: tt(o, 1)
806
- }[D.key];
807
- H && (D.preventDefault(), N(H));
1282
+ const K = (l.getDay() - P + 7) % 7, ae = {
1283
+ ArrowLeft: O(l, -1),
1284
+ ArrowRight: O(l, 1),
1285
+ ArrowUp: O(l, -7),
1286
+ ArrowDown: O(l, 7),
1287
+ Home: O(l, -K),
1288
+ End: O(l, 6 - K),
1289
+ PageUp: St(l, -1),
1290
+ PageDown: St(l, 1)
1291
+ }[b.key];
1292
+ ae && (b.preventDefault(), y(ae));
808
1293
  };
809
- return /* @__PURE__ */ k(
1294
+ return /* @__PURE__ */ _(
810
1295
  "div",
811
1296
  {
812
- ...pe,
813
- ref: ze,
814
- id: L,
815
- style: fe ? { ...se, ...fe } : se,
816
- className: p(
1297
+ ...me,
1298
+ ref: $e,
1299
+ id: le,
1300
+ style: D ? { ...Ie, ...D } : Ie,
1301
+ className: m(
817
1302
  "p-date-range-picker",
818
- ne && "p-date-range-picker--with-presets",
819
- u && "p-date-range-picker--error",
820
- _ && "p-date-range-picker--disabled",
821
- q
1303
+ ie && "p-date-range-picker--with-presets",
1304
+ h && "p-date-range-picker--error",
1305
+ w && "p-date-range-picker--disabled",
1306
+ U
822
1307
  ),
823
1308
  children: [
824
- /* @__PURE__ */ k("div", { id: A, className: "p-date-range-picker__label", children: [
825
- /* @__PURE__ */ a("span", { children: e }),
826
- /* @__PURE__ */ a(
1309
+ ie ? /* @__PURE__ */ _("div", { id: ee, className: "p-date-range-picker__label", children: [
1310
+ /* @__PURE__ */ n("span", { children: e }),
1311
+ /* @__PURE__ */ n(
827
1312
  "span",
828
1313
  {
829
- className: p(
1314
+ className: m(
830
1315
  "p-date-range-picker__label-value",
831
- !ye && "p-date-range-picker__label-value--empty"
1316
+ !Q && "p-date-range-picker__label-value--empty"
832
1317
  ),
833
- children: be
1318
+ children: Fe
834
1319
  }
835
1320
  )
836
- ] }),
837
- ne ? /* @__PURE__ */ k(
1321
+ ] }) : null,
1322
+ ie ? /* @__PURE__ */ _(
838
1323
  "div",
839
1324
  {
840
- "aria-describedby": _e,
841
- "aria-labelledby": A,
842
- className: p(
1325
+ "aria-describedby": ce,
1326
+ "aria-labelledby": ee,
1327
+ className: m(
843
1328
  "p-date-range-picker__presets",
844
- f !== "auto" && "p-date-range-picker__presets--fixed"
1329
+ g !== "auto" && "p-date-range-picker__presets--fixed"
845
1330
  ),
846
1331
  role: "group",
847
1332
  children: [
848
- s.map((o) => {
849
- const D = Ze(o), B = at(D, g);
850
- return /* @__PURE__ */ a(
1333
+ o.map((l) => {
1334
+ const b = Nt(l), K = Pt(b, N);
1335
+ return /* @__PURE__ */ n(
851
1336
  "button",
852
1337
  {
853
1338
  type: "button",
854
- className: p("p-date-range-picker__preset", B && "p-date-range-picker__preset--active"),
855
- disabled: _,
856
- "aria-pressed": B,
857
- onClick: () => We(o),
858
- children: o.label
1339
+ className: m("p-date-range-picker__preset", K && "p-date-range-picker__preset--active"),
1340
+ disabled: w,
1341
+ "aria-pressed": K,
1342
+ onClick: () => Xe(l),
1343
+ children: l.label
859
1344
  },
860
- o.label
1345
+ l.label
861
1346
  );
862
1347
  }),
863
- Me ? /* @__PURE__ */ a(
1348
+ E ? /* @__PURE__ */ n(
864
1349
  "button",
865
1350
  {
866
1351
  type: "button",
867
- className: p(
1352
+ className: m(
868
1353
  "p-date-range-picker__preset",
869
- W && "p-date-range-picker__preset--active"
1354
+ De && "p-date-range-picker__preset--active"
870
1355
  ),
871
- disabled: _,
872
- "aria-controls": z,
873
- "aria-expanded": T,
874
- "aria-pressed": W,
875
- onClick: (o) => T ? Q(!0) : Pe(o.currentTarget),
876
- children: l
1356
+ disabled: w,
1357
+ "aria-controls": se,
1358
+ "aria-expanded": Y,
1359
+ "aria-pressed": De,
1360
+ onClick: (l) => Y ? ue(!0) : Le(l.currentTarget),
1361
+ children: c
877
1362
  }
878
1363
  ) : null
879
1364
  ]
880
1365
  }
881
- ) : /* @__PURE__ */ k(
1366
+ ) : /* @__PURE__ */ _(
882
1367
  "button",
883
1368
  {
884
1369
  type: "button",
885
- className: p(
1370
+ className: m(
886
1371
  "p-date-range-picker__trigger",
887
- !ye && "p-date-range-picker__trigger--empty"
1372
+ !Q && "p-date-range-picker__trigger--empty",
1373
+ Q && "p-date-range-picker__trigger--filled",
1374
+ Y && "p-date-range-picker__trigger--open"
888
1375
  ),
889
- disabled: _,
890
- "aria-controls": z,
891
- "aria-describedby": _e,
892
- "aria-expanded": T,
1376
+ disabled: w,
1377
+ "aria-controls": se,
1378
+ "aria-describedby": ce,
1379
+ "aria-expanded": Y,
893
1380
  "aria-haspopup": "dialog",
894
- "aria-labelledby": A,
895
- onClick: (o) => T ? Q(!0) : Pe(o.currentTarget),
1381
+ "aria-label": `${e}: ${Fe}`,
1382
+ onClick: (l) => Y ? ue(!0) : Le(l.currentTarget),
896
1383
  children: [
897
- /* @__PURE__ */ a("span", { children: be }),
898
- /* @__PURE__ */ a("span", { className: "p-date-range-picker__trigger-icon", children: /* @__PURE__ */ a(Lt, {}) })
1384
+ /* @__PURE__ */ n(
1385
+ "span",
1386
+ {
1387
+ id: ee,
1388
+ className: m(
1389
+ "p-date-range-picker__trigger-label p-date-range-picker__trigger-floating-label",
1390
+ h && "p-date-range-picker__trigger-label--error"
1391
+ ),
1392
+ "aria-hidden": "true",
1393
+ children: e
1394
+ }
1395
+ ),
1396
+ /* @__PURE__ */ n(
1397
+ "span",
1398
+ {
1399
+ className: m(
1400
+ "p-date-range-picker__trigger-label p-date-range-picker__trigger-placeholder-label",
1401
+ h && "p-date-range-picker__trigger-label--error"
1402
+ ),
1403
+ "aria-hidden": "true",
1404
+ children: e
1405
+ }
1406
+ ),
1407
+ /* @__PURE__ */ n("span", { className: "p-date-range-picker__trigger-value", children: Fe }),
1408
+ /* @__PURE__ */ n("span", { className: "p-date-range-picker__trigger-icon", children: /* @__PURE__ */ n(Rt, {}) })
899
1409
  ]
900
1410
  }
901
1411
  ),
902
- /* @__PURE__ */ a("input", { type: "hidden", name: M, value: (g == null ? void 0 : g.start) ?? "", required: w }),
903
- /* @__PURE__ */ a("input", { type: "hidden", name: m, value: (g == null ? void 0 : g.end) ?? "", required: w }),
904
- T && /* @__PURE__ */ k(
1412
+ /* @__PURE__ */ n("input", { type: "hidden", name: T, value: (N == null ? void 0 : N.start) ?? "", required: I }),
1413
+ /* @__PURE__ */ n("input", { type: "hidden", name: k, value: (N == null ? void 0 : N.end) ?? "", required: I }),
1414
+ Y && /* @__PURE__ */ _(
905
1415
  "div",
906
1416
  {
907
- id: z,
1417
+ id: se,
908
1418
  className: "p-date-range-picker__panel",
909
1419
  role: "dialog",
910
- "aria-labelledby": `${z}-title`,
911
- onKeyDown: (o) => {
912
- o.key === "Escape" && Q();
1420
+ "aria-labelledby": `${se}-title`,
1421
+ onKeyDown: (l) => {
1422
+ l.key === "Escape" && ue();
913
1423
  },
914
1424
  children: [
915
- /* @__PURE__ */ k("div", { className: "p-date-range-picker__calendar-header", children: [
916
- /* @__PURE__ */ a(
1425
+ /* @__PURE__ */ _("div", { className: "p-date-range-picker__calendar-header", children: [
1426
+ /* @__PURE__ */ n(
917
1427
  "button",
918
1428
  {
919
1429
  type: "button",
920
1430
  className: "p-date-range-picker__nav",
921
1431
  "aria-label": "Previous month",
922
- onClick: () => j((o) => Ye(o, -1)),
923
- children: /* @__PURE__ */ a(zt, {})
1432
+ disabled: Ae,
1433
+ onClick: () => Ye(be),
1434
+ children: /* @__PURE__ */ n(At, {})
924
1435
  }
925
1436
  ),
926
- /* @__PURE__ */ a("div", { id: `${z}-title`, className: "p-date-range-picker__month", children: St(J, x) }),
927
- /* @__PURE__ */ a(
1437
+ /* @__PURE__ */ _("div", { className: "p-date-range-picker__month", children: [
1438
+ /* @__PURE__ */ n("span", { id: `${se}-title`, className: "p-date-range-picker__month-label", children: ha(S, C) }),
1439
+ /* @__PURE__ */ n(
1440
+ "select",
1441
+ {
1442
+ className: "p-date-range-picker__month-select p-date-range-picker__calendar-select",
1443
+ "aria-label": "Month",
1444
+ value: S.getMonth(),
1445
+ onChange: Ke,
1446
+ children: F.map((l) => /* @__PURE__ */ n(
1447
+ "option",
1448
+ {
1449
+ value: l.value,
1450
+ disabled: vt(new Date(S.getFullYear(), l.value, 1), $, V),
1451
+ children: l.label
1452
+ },
1453
+ l.value
1454
+ ))
1455
+ }
1456
+ ),
1457
+ /* @__PURE__ */ n(
1458
+ "select",
1459
+ {
1460
+ className: "p-date-range-picker__year-select p-date-range-picker__calendar-select",
1461
+ "aria-label": "Year",
1462
+ value: S.getFullYear(),
1463
+ onChange: Ge,
1464
+ children: Oe.map((l) => /* @__PURE__ */ n("option", { value: l, children: l }, l))
1465
+ }
1466
+ )
1467
+ ] }),
1468
+ /* @__PURE__ */ n(
928
1469
  "button",
929
1470
  {
930
1471
  type: "button",
931
1472
  className: "p-date-range-picker__nav",
932
1473
  "aria-label": "Next month",
933
- onClick: () => j((o) => Ye(o, 1)),
934
- children: /* @__PURE__ */ a(Kt, {})
1474
+ disabled: de,
1475
+ onClick: () => Ye(_e),
1476
+ children: /* @__PURE__ */ n(Lt, {})
935
1477
  }
936
1478
  )
937
1479
  ] }),
938
- /* @__PURE__ */ a("div", { className: "p-date-range-picker__weekdays", "aria-hidden": "true", children: je.map((o) => /* @__PURE__ */ a("span", { children: o }, o)) }),
939
- /* @__PURE__ */ a("div", { className: "p-date-range-picker__grid", role: "grid", "aria-labelledby": `${z}-title`, children: ae.map((o) => {
940
- const D = y(o), B = o.getMonth() !== J.getMonth(), re = Fe(o, F), H = Fe(o, ee), ce = Rt(o, F, ee), st = Fe(o, Z), lt = Ue(o, G) || qe(o, K);
941
- return /* @__PURE__ */ a(
1480
+ /* @__PURE__ */ n("div", { className: "p-date-range-picker__weekdays", "aria-hidden": "true", children: q.map((l) => /* @__PURE__ */ n("span", { children: l }, l)) }),
1481
+ /* @__PURE__ */ n("div", { className: "p-date-range-picker__grid", role: "grid", "aria-labelledby": `${se}-title`, children: qe.map((l) => {
1482
+ const b = M(l), K = l.getMonth() !== S.getMonth(), ve = at(l, B), ae = at(l, j), Se = va(l, B, j), ct = at(l, L), dt = _t(l, $) || yt(l, V);
1483
+ return /* @__PURE__ */ n(
942
1484
  "button",
943
1485
  {
944
- ref: (ct) => {
945
- xe.current[D] = ct;
1486
+ ref: (ut) => {
1487
+ xe.current[b] = ut;
946
1488
  },
947
1489
  type: "button",
948
1490
  role: "gridcell",
949
- "data-date": D,
950
- className: p(
1491
+ "data-date": b,
1492
+ className: m(
951
1493
  "p-date-range-picker__day",
952
- B && "p-date-range-picker__day--outside",
953
- st && "p-date-range-picker__day--today",
954
- ce && "p-date-range-picker__day--in-range",
955
- (re || H) && "p-date-range-picker__day--selected"
1494
+ K && "p-date-range-picker__day--outside",
1495
+ ct && "p-date-range-picker__day--today",
1496
+ Se && "p-date-range-picker__day--in-range",
1497
+ (ve || ae) && "p-date-range-picker__day--selected"
956
1498
  ),
957
- disabled: lt,
958
- "aria-label": Tt(o, x),
959
- "aria-selected": re || H,
960
- tabIndex: Fe(o, le) ? 0 : -1,
961
- onClick: () => i(o),
962
- onKeyDown: S(o),
963
- children: o.getDate()
1499
+ disabled: dt,
1500
+ "aria-label": ga(l, C),
1501
+ "aria-selected": ve || ae,
1502
+ tabIndex: at(l, ge) ? 0 : -1,
1503
+ onClick: () => s(l),
1504
+ onKeyDown: H(l),
1505
+ children: l.getDate()
964
1506
  },
965
- D
1507
+ b
966
1508
  );
967
1509
  }) })
968
1510
  ]
969
1511
  }
970
1512
  ),
971
- u && h ? /* @__PURE__ */ a("p", { id: me, role: "alert", className: "p-date-range-picker__message p-date-range-picker__message--error", children: h }) : null,
972
- !u && c ? /* @__PURE__ */ a("p", { id: he, className: "p-date-range-picker__message", children: c }) : null
1513
+ h && f ? /* @__PURE__ */ n("p", { id: Re, role: "alert", className: "p-date-range-picker__message p-date-range-picker__message--error", children: f }) : null,
1514
+ !h && u ? /* @__PURE__ */ n("p", { id: Be, className: "p-date-range-picker__message", children: u }) : null
973
1515
  ]
974
1516
  }
975
1517
  );
976
1518
  }
977
1519
  );
978
- jt.displayName = "PDateRangePicker";
979
- const Et = {
1520
+ xa.displayName = "PDateRangePicker";
1521
+ const Ra = {
980
1522
  thisWeek: {
981
1523
  label: "This week",
982
1524
  value: () => {
983
- const e = O(), t = I(e, -e.getDay());
1525
+ const e = we(), t = O(e, -e.getDay());
984
1526
  return {
985
- start: y(t),
986
- end: y(I(t, 6))
1527
+ start: M(t),
1528
+ end: M(O(t, 6))
987
1529
  };
988
1530
  }
989
1531
  },
990
1532
  last7Days: {
991
1533
  label: "Last 7 days",
992
1534
  value: () => {
993
- const e = O();
1535
+ const e = we();
994
1536
  return {
995
- start: y(I(e, -6)),
996
- end: y(e)
1537
+ start: M(O(e, -6)),
1538
+ end: M(e)
997
1539
  };
998
1540
  }
999
1541
  },
1000
1542
  last14Days: {
1001
1543
  label: "Last 14 days",
1002
1544
  value: () => {
1003
- const e = O();
1545
+ const e = we();
1004
1546
  return {
1005
- start: y(I(e, -13)),
1006
- end: y(e)
1547
+ start: M(O(e, -13)),
1548
+ end: M(e)
1007
1549
  };
1008
1550
  }
1009
1551
  },
1010
1552
  last30Days: {
1011
1553
  label: "Last 30 days",
1012
1554
  value: () => {
1013
- const e = O();
1555
+ const e = we();
1014
1556
  return {
1015
- start: y(I(e, -29)),
1016
- end: y(e)
1557
+ start: M(O(e, -29)),
1558
+ end: M(e)
1017
1559
  };
1018
1560
  }
1019
1561
  },
1020
1562
  thisMonth: {
1021
1563
  label: "This month",
1022
1564
  value: () => {
1023
- const e = O(), t = X(e), n = Je(e);
1565
+ const e = we(), t = X(e), a = Ue(e);
1024
1566
  return {
1025
- start: y(t),
1026
- end: y(n)
1567
+ start: M(t),
1568
+ end: M(a)
1027
1569
  };
1028
1570
  }
1029
1571
  },
1030
1572
  lastMonth: {
1031
1573
  label: "Last month",
1032
1574
  value: () => {
1033
- const e = O(), t = Ye(e, -1);
1575
+ const e = we(), t = st(e, -1);
1034
1576
  return {
1035
- start: y(X(t)),
1036
- end: y(Je(t))
1577
+ start: M(X(t)),
1578
+ end: M(Ue(t))
1037
1579
  };
1038
1580
  }
1039
1581
  },
1040
1582
  monthToDate: {
1041
1583
  label: "Month to date",
1042
1584
  value: () => {
1043
- const e = O(), t = X(e);
1585
+ const e = we(), t = X(e);
1044
1586
  return {
1045
- start: y(t),
1046
- end: y(e)
1587
+ start: M(t),
1588
+ end: M(e)
1047
1589
  };
1048
1590
  }
1049
1591
  },
1050
1592
  yearToDate: {
1051
1593
  label: "Year to date",
1052
1594
  value: () => {
1053
- const e = O();
1595
+ const e = we();
1054
1596
  return {
1055
- start: y(new Date(e.getFullYear(), 0, 1)),
1056
- end: y(e)
1597
+ start: M(new Date(e.getFullYear(), 0, 1)),
1598
+ end: M(e)
1057
1599
  };
1058
1600
  }
1059
1601
  }
1060
- }, Wt = U(
1602
+ }, Da = Ne(
1061
1603
  ({
1062
1604
  as: e = "span",
1063
1605
  variant: t = "primary",
1064
- appearance: n = "text",
1606
+ appearance: a = "text",
1065
1607
  color: r,
1066
- textColor: s,
1067
- children: l,
1608
+ textColor: o,
1609
+ children: c,
1068
1610
  className: d,
1069
- style: f,
1070
- ...b
1071
- }, c) => {
1072
- const u = {
1073
- ...f,
1611
+ style: g,
1612
+ ...v
1613
+ }, u) => {
1614
+ const h = {
1615
+ ...g,
1074
1616
  ...r ? { "--p-highlight-color": r, "--p-highlight-bg": r } : {},
1075
- ...s ? { "--p-highlight-text": s } : {}
1617
+ ...o ? { "--p-highlight-text": o } : {}
1076
1618
  };
1077
- return /* @__PURE__ */ a(
1619
+ return /* @__PURE__ */ n(
1078
1620
  e,
1079
1621
  {
1080
- ...b,
1081
- ref: c,
1082
- className: p(
1622
+ ...v,
1623
+ ref: u,
1624
+ className: m(
1083
1625
  "p-highlight",
1084
1626
  `p-highlight--${t}`,
1085
- n === "background" && "p-highlight--background",
1627
+ a === "background" && "p-highlight--background",
1086
1628
  d
1087
1629
  ),
1088
- style: u,
1089
- children: l
1630
+ style: h,
1631
+ children: c
1090
1632
  }
1091
1633
  );
1092
1634
  }
1093
1635
  );
1094
- Wt.displayName = "PHighlight";
1095
- const Ht = U(
1636
+ Da.displayName = "PHighlight";
1637
+ const wa = Ne(
1096
1638
  ({
1097
1639
  children: e,
1098
1640
  ariaLabel: t = "Horizontal content",
1099
- gap: n,
1641
+ gap: a,
1100
1642
  snap: r = !0,
1101
- className: s,
1102
- scrollerClassName: l,
1643
+ className: o,
1644
+ scrollerClassName: c,
1103
1645
  listClassName: d,
1104
- itemClassName: f,
1105
- style: b,
1106
- ...c
1107
- }, u) => {
1108
- const h = {
1109
- ...b,
1110
- ...n ? { "--p-horizontal-slider-gap": n } : {}
1646
+ itemClassName: g,
1647
+ style: v,
1648
+ ...u
1649
+ }, h) => {
1650
+ const f = {
1651
+ ...v,
1652
+ ...a ? { "--p-horizontal-slider-gap": a } : {}
1111
1653
  };
1112
- return /* @__PURE__ */ a(
1654
+ return /* @__PURE__ */ n(
1113
1655
  "div",
1114
1656
  {
1115
- ...c,
1116
- ref: u,
1117
- className: p("p-horizontal-slider", !r && "p-horizontal-slider--no-snap", s),
1118
- style: h,
1119
- children: /* @__PURE__ */ a(
1657
+ ...u,
1658
+ ref: h,
1659
+ className: m("p-horizontal-slider", !r && "p-horizontal-slider--no-snap", o),
1660
+ style: f,
1661
+ children: /* @__PURE__ */ n(
1120
1662
  "div",
1121
1663
  {
1122
1664
  "aria-label": t,
1123
- className: p("p-horizontal-slider__scroller", l),
1665
+ className: m("p-horizontal-slider__scroller", c),
1124
1666
  role: "region",
1125
1667
  tabIndex: 0,
1126
- children: /* @__PURE__ */ a("ul", { className: p("p-horizontal-slider__list", d), children: dt.map(e, (v) => /* @__PURE__ */ a("li", { className: p("p-horizontal-slider__item", f), children: v })) })
1668
+ children: /* @__PURE__ */ n("ul", { className: m("p-horizontal-slider__list", d), children: Kt.map(e, (x) => /* @__PURE__ */ n("li", { className: m("p-horizontal-slider__item", g), children: x })) })
1127
1669
  }
1128
1670
  )
1129
1671
  }
1130
1672
  );
1131
1673
  }
1132
1674
  );
1133
- Ht.displayName = "PHorizontalSlider";
1134
- function ea({ title: e }) {
1135
- return /* @__PURE__ */ a(ut, { className: "pt-2 border-t border-white text-white", children: /* @__PURE__ */ a(Re, { className: "uppercase", variant: "body-wide", children: e }) });
1675
+ wa.displayName = "PHorizontalSlider";
1676
+ function Aa({ title: e }) {
1677
+ return /* @__PURE__ */ n(jt, { className: "pt-2 border-t border-white text-white", children: /* @__PURE__ */ n(ot, { className: "uppercase", variant: "body-wide", children: e }) });
1136
1678
  }
1137
- function Ot() {
1138
- return /* @__PURE__ */ k(
1679
+ function Ma() {
1680
+ return /* @__PURE__ */ _(
1139
1681
  "svg",
1140
1682
  {
1141
1683
  xmlns: "http://www.w3.org/2000/svg",
@@ -1149,14 +1691,14 @@ function Ot() {
1149
1691
  focusable: "false",
1150
1692
  className: "p-text-input__icon",
1151
1693
  children: [
1152
- /* @__PURE__ */ a("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }),
1153
- /* @__PURE__ */ a("circle", { cx: "12", cy: "12", r: "3" })
1694
+ /* @__PURE__ */ n("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }),
1695
+ /* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "3" })
1154
1696
  ]
1155
1697
  }
1156
1698
  );
1157
1699
  }
1158
- function Vt() {
1159
- return /* @__PURE__ */ k(
1700
+ function Ia() {
1701
+ return /* @__PURE__ */ _(
1160
1702
  "svg",
1161
1703
  {
1162
1704
  xmlns: "http://www.w3.org/2000/svg",
@@ -1170,188 +1712,190 @@ function Vt() {
1170
1712
  focusable: "false",
1171
1713
  className: "p-text-input__icon",
1172
1714
  children: [
1173
- /* @__PURE__ */ a("path", { d: "M9.88 9.88a3 3 0 1 0 4.24 4.24" }),
1174
- /* @__PURE__ */ a("path", { d: "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" }),
1175
- /* @__PURE__ */ a("path", { d: "M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" }),
1176
- /* @__PURE__ */ a("line", { x1: "2", x2: "22", y1: "2", y2: "22" })
1715
+ /* @__PURE__ */ n("path", { d: "M9.88 9.88a3 3 0 1 0 4.24 4.24" }),
1716
+ /* @__PURE__ */ n("path", { d: "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" }),
1717
+ /* @__PURE__ */ n("path", { d: "M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" }),
1718
+ /* @__PURE__ */ n("line", { x1: "2", x2: "22", y1: "2", y2: "22" })
1177
1719
  ]
1178
1720
  }
1179
1721
  );
1180
1722
  }
1181
- const Ut = U(
1723
+ const $a = Ne(
1182
1724
  ({
1183
1725
  className: e,
1184
1726
  inputClassName: t,
1185
- type: n,
1727
+ type: a,
1186
1728
  label: r,
1187
- helperText: s,
1188
- id: l,
1729
+ helperText: o,
1730
+ id: c,
1189
1731
  isError: d = !1,
1190
- errorMessage: f,
1191
- rightAdornment: b,
1192
- disabled: c,
1193
- readOnly: u,
1194
- style: h,
1195
- ...v
1196
- }, C) => {
1197
- const M = Le(), m = l ?? M, _ = `${m}-error`, $ = `${m}-helper`, w = n === "password", x = !!b && !w, [P, q] = V(!1), ie = w ? P ? "text" : "password" : n ?? "text", se = [
1198
- d && f ? _ : null,
1199
- !d && s ? $ : null
1732
+ errorMessage: g,
1733
+ rightAdornment: v,
1734
+ disabled: u,
1735
+ readOnly: h,
1736
+ style: f,
1737
+ ...x
1738
+ }, R) => {
1739
+ const T = Qe(), k = c ?? T, w = `${k}-error`, A = `${k}-helper`, I = a === "password", C = !!v && !I, [P, U] = G(!1), he = I ? P ? "text" : "password" : a ?? "text", Ie = [
1740
+ d && g ? w : null,
1741
+ !d && o ? A : null
1200
1742
  ].filter(Boolean).join(" ") || void 0;
1201
- return /* @__PURE__ */ k("div", { className: p("p-text-input", e), style: h, children: [
1202
- /* @__PURE__ */ a(
1203
- "input",
1204
- {
1205
- ...v,
1206
- id: m,
1207
- ref: C,
1208
- type: ie,
1209
- disabled: c,
1210
- readOnly: u,
1211
- placeholder: " ",
1212
- "aria-invalid": d || void 0,
1213
- "aria-describedby": se,
1214
- "aria-required": v.required,
1215
- "aria-disabled": c,
1216
- "aria-readonly": u,
1217
- autoComplete: v.autoComplete ?? (w ? "current-password" : void 0),
1218
- className: p(
1219
- "p-text-input__control",
1220
- (w || x) && "p-text-input__control--adorned",
1221
- d && "p-text-input__control--error",
1222
- x && n === "date" && "p-text-input__control--date-adorned",
1223
- t
1224
- )
1225
- }
1226
- ),
1227
- /* @__PURE__ */ a(
1228
- "span",
1229
- {
1230
- "aria-hidden": "true",
1231
- className: p(
1232
- "p-text-input__label p-text-input__floating-label",
1233
- d && "p-text-input__label--error"
1234
- ),
1235
- children: r
1236
- }
1237
- ),
1238
- /* @__PURE__ */ a(
1239
- "label",
1240
- {
1241
- htmlFor: m,
1242
- className: "p-text-input__label p-text-input__placeholder-label",
1243
- children: r
1244
- }
1245
- ),
1246
- w && /* @__PURE__ */ a(
1247
- "button",
1248
- {
1249
- type: "button",
1250
- onClick: () => q((pe) => !pe),
1251
- disabled: c,
1252
- className: "p-text-input__action",
1253
- "aria-label": P ? "Hide password" : "Show password",
1254
- "aria-pressed": P,
1255
- "aria-controls": m,
1256
- children: P ? /* @__PURE__ */ a(Ot, {}) : /* @__PURE__ */ a(Vt, {})
1257
- }
1258
- ),
1259
- x && /* @__PURE__ */ a("span", { "aria-hidden": "true", className: "p-text-input__adornment", children: b }),
1260
- d && f && /* @__PURE__ */ a(
1743
+ return /* @__PURE__ */ _("div", { className: m("p-text-input", e), style: f, children: [
1744
+ /* @__PURE__ */ _("div", { className: "p-text-input__field", children: [
1745
+ /* @__PURE__ */ n(
1746
+ "input",
1747
+ {
1748
+ ...x,
1749
+ id: k,
1750
+ ref: R,
1751
+ type: he,
1752
+ disabled: u,
1753
+ readOnly: h,
1754
+ placeholder: " ",
1755
+ "aria-invalid": d || void 0,
1756
+ "aria-describedby": Ie,
1757
+ "aria-required": x.required,
1758
+ "aria-disabled": u,
1759
+ "aria-readonly": h,
1760
+ autoComplete: x.autoComplete ?? (I ? "current-password" : void 0),
1761
+ className: m(
1762
+ "p-text-input__control",
1763
+ (I || C) && "p-text-input__control--adorned",
1764
+ d && "p-text-input__control--error",
1765
+ C && a === "date" && "p-text-input__control--date-adorned",
1766
+ t
1767
+ )
1768
+ }
1769
+ ),
1770
+ /* @__PURE__ */ n(
1771
+ "span",
1772
+ {
1773
+ "aria-hidden": "true",
1774
+ className: m(
1775
+ "p-text-input__label p-text-input__floating-label",
1776
+ d && "p-text-input__label--error"
1777
+ ),
1778
+ children: r
1779
+ }
1780
+ ),
1781
+ /* @__PURE__ */ n(
1782
+ "label",
1783
+ {
1784
+ htmlFor: k,
1785
+ className: "p-text-input__label p-text-input__placeholder-label",
1786
+ children: r
1787
+ }
1788
+ ),
1789
+ I && /* @__PURE__ */ n(
1790
+ "button",
1791
+ {
1792
+ type: "button",
1793
+ onClick: () => U((me) => !me),
1794
+ disabled: u,
1795
+ className: "p-text-input__action",
1796
+ "aria-label": P ? "Hide password" : "Show password",
1797
+ "aria-pressed": P,
1798
+ "aria-controls": k,
1799
+ children: P ? /* @__PURE__ */ n(Ma, {}) : /* @__PURE__ */ n(Ia, {})
1800
+ }
1801
+ ),
1802
+ C && /* @__PURE__ */ n("span", { "aria-hidden": "true", className: "p-text-input__adornment", children: v })
1803
+ ] }),
1804
+ d && g && /* @__PURE__ */ n(
1261
1805
  "p",
1262
1806
  {
1263
- id: _,
1807
+ id: w,
1264
1808
  role: "alert",
1265
1809
  className: "p-text-input__message p-text-input__message--error",
1266
- children: f
1810
+ children: g
1267
1811
  }
1268
1812
  ),
1269
- !d && s && /* @__PURE__ */ a(
1813
+ !d && o && /* @__PURE__ */ n(
1270
1814
  "p",
1271
1815
  {
1272
- id: $,
1816
+ id: A,
1273
1817
  className: "p-text-input__message p-text-input__message--helper",
1274
- children: s
1818
+ children: o
1275
1819
  }
1276
1820
  )
1277
1821
  ] });
1278
1822
  }
1279
1823
  );
1280
- Ut.displayName = "PTextInput";
1281
- const qt = U(
1824
+ $a.displayName = "PTextInput";
1825
+ const Ca = Ne(
1282
1826
  ({
1283
1827
  className: e,
1284
1828
  textareaClassName: t,
1285
- label: n,
1829
+ label: a,
1286
1830
  helperText: r,
1287
- id: s,
1288
- isError: l = !1,
1831
+ id: o,
1832
+ isError: c = !1,
1289
1833
  errorMessage: d,
1290
- disabled: f,
1291
- readOnly: b,
1292
- rows: c = 4,
1293
- style: u,
1294
- ...h
1295
- }, v) => {
1296
- const C = Le(), M = s ?? C, m = `${M}-error`, _ = `${M}-helper`, $ = [
1297
- l && d ? m : null,
1298
- !l && r ? _ : null
1834
+ disabled: g,
1835
+ readOnly: v,
1836
+ rows: u = 4,
1837
+ style: h,
1838
+ ...f
1839
+ }, x) => {
1840
+ const R = Qe(), T = o ?? R, k = `${T}-error`, w = `${T}-helper`, A = [
1841
+ c && d ? k : null,
1842
+ !c && r ? w : null
1299
1843
  ].filter(Boolean).join(" ") || void 0;
1300
- return /* @__PURE__ */ k("div", { className: p("p-text-area", e), style: u, children: [
1301
- /* @__PURE__ */ a(
1844
+ return /* @__PURE__ */ _("div", { className: m("p-text-area", e), style: h, children: [
1845
+ /* @__PURE__ */ n(
1302
1846
  "textarea",
1303
1847
  {
1304
- ...h,
1305
- id: M,
1306
- ref: v,
1307
- rows: c,
1308
- disabled: f,
1309
- readOnly: b,
1848
+ ...f,
1849
+ id: T,
1850
+ ref: x,
1851
+ rows: u,
1852
+ disabled: g,
1853
+ readOnly: v,
1310
1854
  placeholder: " ",
1311
- "aria-invalid": l || void 0,
1312
- "aria-describedby": $,
1313
- "aria-required": h.required,
1314
- "aria-disabled": f,
1315
- "aria-readonly": b,
1316
- className: p(
1855
+ "aria-invalid": c || void 0,
1856
+ "aria-describedby": A,
1857
+ "aria-required": f.required,
1858
+ "aria-disabled": g,
1859
+ "aria-readonly": v,
1860
+ className: m(
1317
1861
  "p-text-area__control",
1318
- l && "p-text-area__control--error",
1862
+ c && "p-text-area__control--error",
1319
1863
  t
1320
1864
  )
1321
1865
  }
1322
1866
  ),
1323
- /* @__PURE__ */ a(
1867
+ /* @__PURE__ */ n(
1324
1868
  "span",
1325
1869
  {
1326
1870
  "aria-hidden": "true",
1327
- className: p(
1871
+ className: m(
1328
1872
  "p-text-area__label p-text-area__floating-label",
1329
- l && "p-text-area__label--error"
1873
+ c && "p-text-area__label--error"
1330
1874
  ),
1331
- children: n
1875
+ children: a
1332
1876
  }
1333
1877
  ),
1334
- /* @__PURE__ */ a(
1878
+ /* @__PURE__ */ n(
1335
1879
  "label",
1336
1880
  {
1337
- htmlFor: M,
1881
+ htmlFor: T,
1338
1882
  className: "p-text-area__label p-text-area__placeholder-label",
1339
- children: n
1883
+ children: a
1340
1884
  }
1341
1885
  ),
1342
- l && d && /* @__PURE__ */ a(
1886
+ c && d && /* @__PURE__ */ n(
1343
1887
  "p",
1344
1888
  {
1345
- id: m,
1889
+ id: k,
1346
1890
  role: "alert",
1347
1891
  className: "p-text-area__message p-text-area__message--error",
1348
1892
  children: d
1349
1893
  }
1350
1894
  ),
1351
- !l && r && /* @__PURE__ */ a(
1895
+ !c && r && /* @__PURE__ */ n(
1352
1896
  "p",
1353
1897
  {
1354
- id: _,
1898
+ id: w,
1355
1899
  className: "p-text-area__message p-text-area__message--helper",
1356
1900
  children: r
1357
1901
  }
@@ -1359,22 +1903,23 @@ const qt = U(
1359
1903
  ] });
1360
1904
  }
1361
1905
  );
1362
- qt.displayName = "PTextArea";
1906
+ Ca.displayName = "PTextArea";
1363
1907
  export {
1364
- pt as PBadge,
1365
- ht as PButton,
1366
- _t as PCard,
1367
- Ct as PDatePicker,
1368
- Xt as PDatePickerPresets,
1369
- jt as PDateRangePicker,
1370
- Et as PDateRangePickerPresets,
1371
- Wt as PHighlight,
1372
- Ht as PHorizontalSlider,
1373
- ea as PSectionHeader,
1374
- qt as PTextArea,
1375
- Ut as PTextInput,
1376
- Re as PTypography,
1377
- Qt as Row,
1378
- ut as Stack
1908
+ Ht as PBadge,
1909
+ Ut as PButton,
1910
+ Xt as PCard,
1911
+ Qt as PCombobox,
1912
+ da as PDatePicker,
1913
+ Ba as PDatePickerPresets,
1914
+ xa as PDateRangePicker,
1915
+ Ra as PDateRangePickerPresets,
1916
+ Da as PHighlight,
1917
+ wa as PHorizontalSlider,
1918
+ Aa as PSectionHeader,
1919
+ Ca as PTextArea,
1920
+ $a as PTextInput,
1921
+ ot as PTypography,
1922
+ Pa as Row,
1923
+ jt as Stack
1379
1924
  };
1380
1925
  //# sourceMappingURL=index.es.js.map