@paolojulian.dev/design-system 4.4.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,16 +1,17 @@
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 a, jsxs as _, Fragment as wt } from "react/jsx-runtime";
2
+ import { cn as h } from "./utils.es.js";
3
+ import { forwardRef as oe, useId as Oe, useRef as me, useState as re, useMemo as tt, useEffect as Ce, Children as Xt } from "react";
4
+ import { C as qt, a as Pt, b as Ft } from "./chevron-right-icon-CDCRryr1.js";
5
+ const en = ({
5
6
  children: e,
6
7
  gap: t = void 0,
7
8
  alignItems: n = void 0,
8
9
  justifyContent: r = void 0,
9
- className: s = ""
10
+ className: l = ""
10
11
  }) => /* @__PURE__ */ a(
11
12
  "div",
12
13
  {
13
- className: p("flex flex-row", s),
14
+ className: h("flex flex-row", l),
14
15
  style: {
15
16
  gap: t,
16
17
  alignItems: n,
@@ -18,16 +19,16 @@ const Qt = ({
18
19
  },
19
20
  children: e
20
21
  }
21
- ), ut = ({
22
+ ), Zt = ({
22
23
  children: e,
23
24
  gap: t = void 0,
24
25
  alignItems: n = void 0,
25
26
  justifyContent: r = void 0,
26
- className: s = ""
27
+ className: l = ""
27
28
  }) => /* @__PURE__ */ a(
28
29
  "div",
29
30
  {
30
- className: p("flex flex-col", s),
31
+ className: h("flex flex-col", l),
31
32
  style: {
32
33
  gap: t,
33
34
  alignItems: n,
@@ -35,247 +36,683 @@ const Qt = ({
35
36
  },
36
37
  children: e
37
38
  }
38
- ), pt = U(
39
+ ), Jt = oe(
39
40
  ({
40
41
  as: e = "span",
41
42
  variant: t = "neutral",
42
43
  size: n = "sm",
43
44
  appearance: r = "subtle",
45
+ isPinging: l = !1,
44
46
  leftIcon: s,
45
- rightIcon: l,
46
- children: d,
47
- className: f,
47
+ rightIcon: d,
48
+ children: m,
49
+ className: y,
48
50
  ...b
49
- }, c) => /* @__PURE__ */ k(
51
+ }, u) => /* @__PURE__ */ _(
50
52
  e,
51
53
  {
52
54
  ...b,
53
- ref: c,
54
- className: p(
55
+ ref: u,
56
+ className: h(
55
57
  "p-badge",
56
58
  `p-badge--${t}`,
57
59
  `p-badge--${n}`,
58
60
  `p-badge--${r}`,
59
- f
61
+ l && "p-badge--pinging",
62
+ y
60
63
  ),
61
64
  children: [
62
65
  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 })
66
+ /* @__PURE__ */ a("span", { className: "p-badge__label", children: m }),
67
+ d && /* @__PURE__ */ a("span", { className: "p-badge__icon", "aria-hidden": "true", children: d })
65
68
  ]
66
69
  }
67
70
  )
68
71
  );
69
- pt.displayName = "PBadge";
70
- const ht = U(
72
+ Jt.displayName = "PBadge";
73
+ const Qt = oe(
71
74
  ({
72
75
  variant: e = "primary",
73
76
  size: t = "md",
74
77
  fullWidth: n = !1,
75
78
  isActive: r = !1,
76
- isLoading: s = !1,
77
- leftIcon: l,
78
- rightIcon: d,
79
- children: f,
79
+ isLoading: l = !1,
80
+ isPinging: s = !1,
81
+ leftIcon: d,
82
+ rightIcon: m,
83
+ children: y,
80
84
  className: b,
81
- ...c
82
- }, u) => {
83
- const h = !!("disabled" in c && c.disabled || s), v = p(
85
+ ...u
86
+ }, v) => {
87
+ const N = !!("disabled" in u && u.disabled || l), F = h(
84
88
  "p-button",
85
89
  `p-button--${e}`,
86
90
  `p-button--${t}`,
87
91
  n && "p-button--full-width",
88
92
  r && "p-button--active",
93
+ s && "p-button--pinging",
89
94
  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 })
95
+ ), k = /* @__PURE__ */ _(wt, { children: [
96
+ l ? /* @__PURE__ */ a("span", { className: "p-button__spinner", "aria-hidden": "true" }) : d && /* @__PURE__ */ a("span", { className: "p-button__icon", "aria-hidden": "true", children: d }),
97
+ /* @__PURE__ */ a("span", { className: "p-button__label", children: y }),
98
+ !l && m && /* @__PURE__ */ a("span", { className: "p-button__icon", "aria-hidden": "true", children: m })
94
99
  ] });
95
- if ("href" in c && typeof c.href == "string") {
96
- const { disabled: $, onClick: w, ...x } = c, P = (q) => {
97
- if (h) {
98
- q.preventDefault();
100
+ if ("href" in u && typeof u.href == "string") {
101
+ const { disabled: B, onClick: A, ...I } = u, T = (V) => {
102
+ if (N) {
103
+ V.preventDefault();
99
104
  return;
100
105
  }
101
- w == null || w(q);
106
+ A == null || A(V);
102
107
  };
103
108
  return /* @__PURE__ */ a(
104
109
  "a",
105
110
  {
106
- ...x,
107
- ref: u,
108
- className: v,
109
- "aria-disabled": h || void 0,
110
- "aria-busy": s || void 0,
111
+ ...I,
112
+ ref: v,
113
+ className: F,
114
+ "aria-disabled": N || void 0,
115
+ "aria-busy": l || void 0,
111
116
  "data-active": r || void 0,
112
- "data-disabled": $ || void 0,
113
- tabIndex: h ? -1 : x.tabIndex,
114
- onClick: P,
115
- children: C
117
+ "data-disabled": B || void 0,
118
+ tabIndex: N ? -1 : I.tabIndex,
119
+ onClick: T,
120
+ children: k
116
121
  }
117
122
  );
118
123
  }
119
- const { type: M = "button", disabled: m, ..._ } = c;
124
+ const { type: g = "button", disabled: $, ...j } = u;
120
125
  return /* @__PURE__ */ a(
121
126
  "button",
122
127
  {
123
- ..._,
124
- ref: u,
125
- type: M,
126
- disabled: !!(m || s),
127
- className: v,
128
- "aria-busy": s || void 0,
128
+ ...j,
129
+ ref: v,
130
+ type: g,
131
+ disabled: !!($ || l),
132
+ className: F,
133
+ "aria-busy": l || void 0,
129
134
  "data-active": r || void 0,
130
- children: C
135
+ children: k
131
136
  }
132
137
  );
133
138
  }
134
139
  );
135
- ht.displayName = "PButton";
136
- function it(e) {
140
+ Qt.displayName = "PButton";
141
+ function zt(e) {
137
142
  var t, n, r = "";
138
143
  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);
144
+ else if (typeof e == "object") if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (n = zt(e[t])) && (r && (r += " "), r += n);
140
145
  else for (t in e) e[t] && (r && (r += " "), r += t);
141
146
  return r;
142
147
  }
143
- function mt() {
144
- for (var e, t, n = 0, r = ""; n < arguments.length; ) (e = arguments[n++]) && (t = it(e)) && (r && (r += " "), r += t);
148
+ function Et() {
149
+ for (var e, t, n = 0, r = ""; n < arguments.length; ) (e = arguments[n++]) && (t = zt(e)) && (r && (r += " "), r += t);
145
150
  return r;
146
151
  }
147
- const Qe = (e) => typeof e == "boolean" ? "".concat(e) : e === 0 ? "0" : e, Xe = mt, gt = (e, t) => (n) => {
152
+ const Yt = (e) => typeof e == "boolean" ? "".concat(e) : e === 0 ? "0" : e, Ct = Et, ea = (e, t) => (n) => {
148
153
  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];
154
+ if ((t == null ? void 0 : t.variants) == null) return Ct(e, n == null ? void 0 : n.class, n == null ? void 0 : n.className);
155
+ const { variants: l, defaultVariants: s } = t, d = Object.keys(l).map((b) => {
156
+ const u = n == null ? void 0 : n[b], v = s == null ? void 0 : s[b];
152
157
  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] === _;
158
+ const N = Yt(u) || Yt(v);
159
+ return l[b][N];
160
+ }), m = n && Object.entries(n).reduce((b, u) => {
161
+ let [v, N] = u;
162
+ return N === void 0 || (b[v] = N), b;
163
+ }, {}), y = t == null || (r = t.compoundVariants) === null || r === void 0 ? void 0 : r.reduce((b, u) => {
164
+ let { class: v, className: N, ...F } = u;
165
+ return Object.entries(F).every((k) => {
166
+ let [g, $] = k;
167
+ return Array.isArray($) ? $.includes({
168
+ ...s,
169
+ ...m
170
+ }[g]) : {
171
+ ...s,
172
+ ...m
173
+ }[g] === $;
169
174
  }) ? [
170
- ...c,
171
- h,
172
- v
173
- ] : c;
175
+ ...b,
176
+ v,
177
+ N
178
+ ] : b;
174
179
  }, []);
175
- return Xe(e, d, b, n == null ? void 0 : n.class, n == null ? void 0 : n.className);
176
- }, ft = {
180
+ return Ct(e, d, y, n == null ? void 0 : n.class, n == null ? void 0 : n.className);
181
+ }, ta = {
177
182
  serif: "p-typography--serif",
178
183
  body: "p-typography--body",
179
184
  "body-wide": "p-typography--body-wide",
180
185
  heading: "p-typography--heading",
181
186
  "heading-lg": "p-typography--heading-lg",
182
187
  "heading-xl": "p-typography--heading-xl"
183
- }, yt = gt("p-typography", {
188
+ }, aa = ea("p-typography", {
184
189
  variants: {
185
- variant: ft
190
+ variant: ta
186
191
  },
187
192
  defaultVariants: {
188
193
  variant: "body"
189
194
  }
190
195
  });
191
- function Re({
196
+ function Ke({
192
197
  as: e = "p",
193
198
  children: t,
194
199
  className: n = "",
195
200
  variant: r,
196
- ...s
201
+ ...l
197
202
  }) {
198
203
  return /* @__PURE__ */ a(
199
204
  e,
200
205
  {
201
- className: p(yt({ variant: r, className: n })),
202
- ...s,
206
+ className: h(aa({ variant: r, className: n })),
207
+ ...l,
203
208
  children: t
204
209
  }
205
210
  );
206
211
  }
207
- function oe(e) {
212
+ function Ge(e) {
208
213
  return e != null && e !== !1 && e !== "";
209
214
  }
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;
215
+ function St(e, t) {
216
+ return Ge(e) ? typeof e == "string" || typeof e == "number" ? /* @__PURE__ */ a(Ke, { className: t, variant: "body-wide", children: e }) : /* @__PURE__ */ a("span", { className: h(t, "p-card__meta-custom"), children: e }) : null;
212
217
  }
213
- function Ce(e) {
218
+ function at(e) {
214
219
  return typeof e == "number" ? `${e}px` : e;
215
220
  }
216
- const _t = U(
221
+ const na = oe(
217
222
  ({
218
223
  prefix: e,
219
224
  eyebrow: t,
220
225
  title: n,
221
226
  description: r,
222
- media: s,
223
- actions: l,
227
+ media: l,
228
+ actions: s,
224
229
  density: d = "default",
225
- fullWidth: f = !1,
226
- width: b,
227
- minWidth: c,
230
+ fullWidth: m = !1,
231
+ width: y,
232
+ minWidth: b,
228
233
  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(
234
+ minHeight: v,
235
+ className: N,
236
+ style: F,
237
+ children: k,
238
+ ...g
239
+ }, $) => {
240
+ const j = "href" in g && typeof g.href == "string", B = h(
236
241
  "p-card",
237
242
  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",
243
+ m && "p-card--full-width",
244
+ y !== void 0 && "p-card--custom-width",
245
+ b !== void 0 && "p-card--custom-min-width",
241
246
  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")
247
+ v !== void 0 && "p-card--custom-min-height",
248
+ j && "p-card--interactive",
249
+ N
250
+ ), A = {
251
+ ...F,
252
+ ...y !== void 0 ? { "--p-card-width": at(y) } : {},
253
+ ...b !== void 0 ? { "--p-card-min-width": at(b) } : {},
254
+ ...u !== void 0 ? { "--p-card-height": at(u) } : {},
255
+ ...v !== void 0 ? { "--p-card-min-height": at(v) } : {}
256
+ }, I = /* @__PURE__ */ _(wt, { children: [
257
+ Ge(l) && /* @__PURE__ */ a("div", { className: "p-card__media", children: l }),
258
+ (Ge(e) || Ge(t)) && /* @__PURE__ */ _("div", { className: "p-card__meta", children: [
259
+ St(e, "p-card__prefix"),
260
+ St(t, "p-card__eyebrow")
256
261
  ] }),
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
262
+ /* @__PURE__ */ _("div", { className: "p-card__body", children: [
263
+ /* @__PURE__ */ a(Ke, { as: "h3", className: "p-card__title", variant: "heading", children: j ? /* @__PURE__ */ a("a", { ...g, className: "p-card__link", children: n }) : n }),
264
+ Ge(r) ? /* @__PURE__ */ a(Ke, { className: "p-card__description", variant: "body", children: r }) : null
260
265
  ] }),
261
- oe(M) && /* @__PURE__ */ a("div", { className: "p-card__content", children: M }),
262
- oe(l) && /* @__PURE__ */ a("div", { className: "p-card__actions", children: l })
266
+ Ge(k) && /* @__PURE__ */ a("div", { className: "p-card__content", children: k }),
267
+ Ge(s) && /* @__PURE__ */ a("div", { className: "p-card__actions", children: s })
263
268
  ] });
264
- return $ ? /* @__PURE__ */ a("article", { ref: _, className: w, style: x, children: P }) : /* @__PURE__ */ a(
269
+ return j ? /* @__PURE__ */ a("article", { ref: $, className: B, style: A, children: I }) : /* @__PURE__ */ a(
265
270
  "article",
266
271
  {
267
- ...m,
268
- ref: _,
269
- className: w,
270
- style: x,
271
- children: P
272
+ ...g,
273
+ ref: $,
274
+ className: B,
275
+ style: A,
276
+ children: I
277
+ }
278
+ );
279
+ }
280
+ );
281
+ na.displayName = "PCard";
282
+ function ra(e) {
283
+ return typeof e == "number" ? `${e}px` : e;
284
+ }
285
+ function la(e) {
286
+ return e ? typeof e == "number" ? {
287
+ mobile: 1,
288
+ tablet: Math.min(e, 2),
289
+ desktop: e
290
+ } : {
291
+ mobile: e.mobile ?? 1,
292
+ tablet: e.tablet ?? e.mobile ?? 2,
293
+ desktop: e.desktop ?? e.tablet ?? e.mobile ?? 2
294
+ } : {
295
+ mobile: 1,
296
+ tablet: 2,
297
+ desktop: 2
298
+ };
299
+ }
300
+ const ia = oe(
301
+ ({
302
+ as: e = "div",
303
+ columns: t,
304
+ minCardWidth: n,
305
+ gap: r = "none",
306
+ align: l = "stretch",
307
+ className: s,
308
+ style: d,
309
+ children: m,
310
+ ...y
311
+ }, b) => {
312
+ const u = la(t), v = {
313
+ ...d,
314
+ "--p-card-grid-mobile-columns": u.mobile,
315
+ "--p-card-grid-tablet-columns": u.tablet,
316
+ "--p-card-grid-desktop-columns": u.desktop,
317
+ ...n !== void 0 ? { "--p-card-grid-min-card-width": ra(n) } : {}
318
+ };
319
+ return /* @__PURE__ */ a(
320
+ e,
321
+ {
322
+ ...y,
323
+ ref: b,
324
+ className: h(
325
+ "p-card-grid",
326
+ `p-card-grid--gap-${r}`,
327
+ l === "start" && "p-card-grid--align-start",
328
+ n !== void 0 && "p-card-grid--auto-fit",
329
+ s
330
+ ),
331
+ style: v,
332
+ children: m
272
333
  }
273
334
  );
274
335
  }
275
336
  );
276
- _t.displayName = "PCard";
277
- const bt = new Intl.DateTimeFormat(void 0, { weekday: "short" });
278
- function Se(e) {
337
+ ia.displayName = "PCardGrid";
338
+ function sa() {
339
+ return /* @__PURE__ */ a("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "m5 8 5 5 5-5" }) });
340
+ }
341
+ function oa() {
342
+ return /* @__PURE__ */ a("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "m4 10 4 4 8-8" }) });
343
+ }
344
+ function Tt() {
345
+ return /* @__PURE__ */ _("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: [
346
+ /* @__PURE__ */ a("path", { d: "m5 5 10 10" }),
347
+ /* @__PURE__ */ a("path", { d: "m15 5-10 10" })
348
+ ] });
349
+ }
350
+ function Bt(e) {
351
+ return e.trim().toLocaleLowerCase();
352
+ }
353
+ function ht(e, t) {
354
+ const n = Bt(t);
355
+ return n ? e.filter((r) => {
356
+ const l = [
357
+ r.label,
358
+ r.value,
359
+ r.description,
360
+ r.group,
361
+ ...r.keywords ?? []
362
+ ].filter(Boolean).join(" ");
363
+ return Bt(l).includes(n);
364
+ }) : e;
365
+ }
366
+ function Rt(e) {
367
+ return e.findIndex((t) => !t.disabled);
368
+ }
369
+ function bt(e, t) {
370
+ const n = e.findIndex((r) => r.value === t && !r.disabled);
371
+ return n >= 0 ? n : Rt(e);
372
+ }
373
+ function At(e, t, n) {
374
+ var l;
375
+ if (!e.length)
376
+ return -1;
377
+ let r = t;
378
+ for (let s = 0; s < e.length; s += 1)
379
+ if (r = (r + n + e.length) % e.length, !((l = e[r]) != null && l.disabled))
380
+ return r;
381
+ return -1;
382
+ }
383
+ function ca(e, t) {
384
+ if (typeof e == "function") {
385
+ e(t);
386
+ return;
387
+ }
388
+ e && (e.current = t);
389
+ }
390
+ const da = oe(
391
+ ({
392
+ label: e,
393
+ options: t,
394
+ value: n,
395
+ defaultValue: r,
396
+ selectedOption: l,
397
+ onValueChange: s,
398
+ query: d,
399
+ defaultQuery: m,
400
+ onQueryChange: y,
401
+ filterMode: b = "local",
402
+ isLoading: u = !1,
403
+ isLoadingMore: v = !1,
404
+ hasMore: N = !1,
405
+ onLoadMore: F,
406
+ placeholder: k = "Select an option",
407
+ searchPlaceholder: g = "Search options",
408
+ emptyText: $ = "No options found.",
409
+ loadingText: j = "Loading options...",
410
+ loadingMoreText: B = "Loading more options...",
411
+ loadMoreText: A = "Load more options",
412
+ helperText: I,
413
+ isError: T = !1,
414
+ errorMessage: V,
415
+ name: S,
416
+ disabled: z = !1,
417
+ readOnly: ee = !1,
418
+ required: O = !1,
419
+ clearable: X = !0,
420
+ className: p,
421
+ inputClassName: M,
422
+ id: x,
423
+ style: W,
424
+ ...pe
425
+ }, w) => {
426
+ const D = Oe(), H = x ?? D, he = `${H}-label`, Y = `${H}-input`, R = `${H}-listbox`, te = `${H}-helper`, Z = `${H}-error`, G = me(null), J = me(null), q = me(null), ce = me(null), De = me(null), be = me(null), xe = n !== void 0, Fe = d !== void 0, [Se, Xe] = re(r ?? ""), le = xe ? n : Se, U = (l == null ? void 0 : l.value) === le ? l : t.find((c) => c.value === le) ?? null, [Ze, ge] = re(m ?? (U == null ? void 0 : U.label) ?? ""), de = Fe ? d : Ze, [L, ue] = re(!1), [ye, Te] = re(!1), Q = tt(
427
+ () => b === "local" ? ht(t, de) : t,
428
+ [b, t, de]
429
+ ), [Ie, Me] = re(() => bt(t, le)), $e = L ? Q[Ie] : void 0, je = $e ? `${R}-option-${Ie}` : void 0, ve = `${H}-modal-title`, we = T && V ? Z : I ? te : void 0, He = !!U, Ne = X && He && !z && !ee, Be = L ? de : (U == null ? void 0 : U.label) ?? de, We = u && Q.length === 0, Je = v || u && Q.length > 0, Qe = !!(N && F && !u && !v);
430
+ Ce(() => {
431
+ !L && !Fe && ge((U == null ? void 0 : U.label) ?? "");
432
+ }, [L, Fe, U]), Ce(() => {
433
+ L && Me((c) => Q[c] && !Q[c].disabled ? c : bt(Q, le));
434
+ }, [Q, L, le]), Ce(() => {
435
+ var c;
436
+ L && ((c = De.current) == null || c.scrollIntoView({ block: "nearest" }));
437
+ }, [Ie, L]), Ce(() => {
438
+ var Ve, Le;
439
+ const c = globalThis, f = (Ve = c.matchMedia) == null ? void 0 : Ve.call(c, "(max-width: 64rem)");
440
+ if (!f)
441
+ return;
442
+ const ne = () => Te(f.matches);
443
+ return ne(), (Le = f.addEventListener) == null || Le.call(f, "change", ne), () => {
444
+ var Ue;
445
+ return (Ue = f.removeEventListener) == null ? void 0 : Ue.call(f, "change", ne);
446
+ };
447
+ }, []), Ce(() => {
448
+ var c;
449
+ !L || !ye || (c = q.current) == null || c.focus();
450
+ }, [ye, L]), Ce(() => {
451
+ ce.current && ce.current.setCustomValidity(O && !le ? "Select an option." : "");
452
+ }, [O, le]);
453
+ const o = (c) => {
454
+ G.current = c, ca(w, c);
455
+ }, C = (c, f) => {
456
+ Fe || ge(c), y == null || y(c, { source: f });
457
+ }, ae = () => {
458
+ !N || !F || u || v || F({ query: de, optionCount: Q.length });
459
+ };
460
+ Ce(() => {
461
+ if (!L || !be.current)
462
+ return;
463
+ const { scrollHeight: c, clientHeight: f } = be.current;
464
+ c <= f + 48 && ae();
465
+ });
466
+ const i = (c) => {
467
+ const f = (c == null ? void 0 : c.value) ?? "";
468
+ xe || Xe(f), C((c == null ? void 0 : c.label) ?? "", c ? "selection" : "clear"), s == null || s(f, c);
469
+ }, P = (c = de) => {
470
+ if (z || ee)
471
+ return;
472
+ const f = b === "local" ? ht(t, c) : t;
473
+ C(c, "open"), Me(bt(f, le)), ue(!0);
474
+ }, E = () => {
475
+ ue(!1), C((U == null ? void 0 : U.label) ?? "", "reset");
476
+ }, Pe = (c) => {
477
+ const f = c.currentTarget.value, ne = b === "local" ? ht(t, f) : t;
478
+ C(f, "input"), Me(Rt(ne)), ue(!0);
479
+ }, _e = (c) => {
480
+ if (c.key === "ArrowDown") {
481
+ if (c.preventDefault(), !L) {
482
+ P("");
483
+ return;
484
+ }
485
+ Me((f) => At(Q, f, 1));
486
+ return;
487
+ }
488
+ if (c.key === "ArrowUp") {
489
+ if (c.preventDefault(), !L) {
490
+ P("");
491
+ return;
492
+ }
493
+ Me((f) => At(Q, f, -1));
494
+ return;
495
+ }
496
+ if (c.key === "Enter") {
497
+ if (!L) {
498
+ P(de);
499
+ return;
500
+ }
501
+ $e && !$e.disabled && (c.preventDefault(), i($e), ue(!1));
502
+ return;
503
+ }
504
+ if (c.key === "Escape" && L) {
505
+ c.preventDefault(), E();
506
+ return;
507
+ }
508
+ c.key === "Tab" && E();
509
+ }, Ae = (c, f) => {
510
+ var ne;
511
+ c.preventDefault(), !f.disabled && (i(f), ue(!1), (ne = J.current) == null || ne.focus());
512
+ }, dt = (c) => {
513
+ var f;
514
+ c.preventDefault(), c.stopPropagation(), i(null), ue(!1), (f = J.current) == null || f.focus();
515
+ }, ut = (c) => {
516
+ const f = c.currentTarget;
517
+ f.scrollHeight - f.scrollTop - f.clientHeight <= 48 && ae();
518
+ }, pt = (c) => {
519
+ if (!L)
520
+ return;
521
+ c.currentTarget.contains(c.relatedTarget) || E();
522
+ }, It = Q.reduce(
523
+ (c, f) => {
524
+ const ne = f.group ?? null, Ve = c.find((Le) => Le.group === ne);
525
+ return Ve ? (Ve.options.push(f), c) : (c.push({ group: ne, options: [f] }), c);
526
+ },
527
+ []
528
+ );
529
+ return /* @__PURE__ */ _(
530
+ "div",
531
+ {
532
+ ...pe,
533
+ ref: o,
534
+ id: H,
535
+ style: W,
536
+ onBlur: pt,
537
+ className: h(
538
+ "p-combobox",
539
+ L && "p-combobox--open",
540
+ T && "p-combobox--error",
541
+ z && "p-combobox--disabled",
542
+ ee && "p-combobox--readonly",
543
+ p
544
+ ),
545
+ children: [
546
+ /* @__PURE__ */ _("div", { className: "p-combobox__field", children: [
547
+ /* @__PURE__ */ a(
548
+ "input",
549
+ {
550
+ ref: J,
551
+ id: Y,
552
+ role: "combobox",
553
+ type: "text",
554
+ value: Be,
555
+ placeholder: L ? g : " ",
556
+ disabled: z,
557
+ readOnly: ee,
558
+ required: !1,
559
+ "aria-autocomplete": "list",
560
+ "aria-controls": R,
561
+ "aria-describedby": we,
562
+ "aria-activedescendant": je,
563
+ "aria-expanded": L,
564
+ "aria-haspopup": "listbox",
565
+ "aria-invalid": T || void 0,
566
+ "aria-labelledby": he,
567
+ autoComplete: "off",
568
+ className: h("p-combobox__input", (Ne || He) && "p-combobox__input--adorned", M),
569
+ onChange: Pe,
570
+ onClick: () => P(""),
571
+ onKeyDown: _e
572
+ }
573
+ ),
574
+ /* @__PURE__ */ a(
575
+ "label",
576
+ {
577
+ id: he,
578
+ htmlFor: Y,
579
+ className: h("p-combobox__label p-combobox__floating-label", T && "p-combobox__label--error"),
580
+ children: e
581
+ }
582
+ ),
583
+ /* @__PURE__ */ a("span", { "aria-hidden": "true", className: "p-combobox__label p-combobox__placeholder-label", children: k || e }),
584
+ Ne ? /* @__PURE__ */ a(
585
+ "button",
586
+ {
587
+ type: "button",
588
+ className: "p-combobox__clear",
589
+ "aria-label": `Clear ${e}`,
590
+ onMouseDown: dt,
591
+ children: /* @__PURE__ */ a(Tt, {})
592
+ }
593
+ ) : null,
594
+ /* @__PURE__ */ a("span", { className: "p-combobox__chevron", "aria-hidden": "true", children: /* @__PURE__ */ a(sa, {}) }),
595
+ L ? /* @__PURE__ */ _(
596
+ "div",
597
+ {
598
+ className: "p-combobox__panel",
599
+ role: ye ? "dialog" : void 0,
600
+ "aria-modal": ye || void 0,
601
+ "aria-labelledby": ye ? ve : void 0,
602
+ children: [
603
+ /* @__PURE__ */ _("div", { className: "p-combobox__modal-header", children: [
604
+ /* @__PURE__ */ a("div", { id: ve, className: "p-combobox__modal-title", children: e }),
605
+ /* @__PURE__ */ a("button", { type: "button", className: "p-combobox__modal-close", "aria-label": `Close ${e}`, onClick: E, children: /* @__PURE__ */ a(Tt, {}) })
606
+ ] }),
607
+ /* @__PURE__ */ a("div", { className: "p-combobox__modal-search", children: /* @__PURE__ */ a(
608
+ "input",
609
+ {
610
+ ref: q,
611
+ role: "combobox",
612
+ type: "search",
613
+ value: de,
614
+ placeholder: g,
615
+ "aria-activedescendant": je,
616
+ "aria-autocomplete": "list",
617
+ "aria-controls": R,
618
+ "aria-expanded": L,
619
+ "aria-haspopup": "listbox",
620
+ "aria-label": `Search ${e}`,
621
+ autoComplete: "off",
622
+ className: "p-combobox__modal-input",
623
+ onChange: Pe,
624
+ onKeyDown: _e
625
+ }
626
+ ) }),
627
+ /* @__PURE__ */ _(
628
+ "div",
629
+ {
630
+ id: R,
631
+ ref: (c) => {
632
+ be.current = c;
633
+ },
634
+ role: "listbox",
635
+ "aria-busy": u || v || void 0,
636
+ "aria-labelledby": he,
637
+ className: "p-combobox__list",
638
+ onScroll: ut,
639
+ children: [
640
+ We ? /* @__PURE__ */ _("div", { className: "p-combobox__status", role: "option", "aria-disabled": "true", "aria-selected": "false", children: [
641
+ /* @__PURE__ */ a("span", { className: "p-combobox__spinner", "aria-hidden": "true" }),
642
+ /* @__PURE__ */ a("span", { children: j })
643
+ ] }) : null,
644
+ It.length ? It.map((c) => /* @__PURE__ */ _("div", { className: "p-combobox__group", children: [
645
+ c.group ? /* @__PURE__ */ a("div", { className: "p-combobox__group-label", children: c.group }) : null,
646
+ c.options.map((f) => {
647
+ const ne = Q.indexOf(f), Ve = ne === Ie, Le = f.value === le;
648
+ return /* @__PURE__ */ _(
649
+ "div",
650
+ {
651
+ ref: Ve ? (Ue) => {
652
+ De.current = Ue;
653
+ } : void 0,
654
+ id: `${R}-option-${ne}`,
655
+ role: "option",
656
+ "aria-disabled": f.disabled || void 0,
657
+ "aria-selected": Le,
658
+ className: h(
659
+ "p-combobox__option",
660
+ Ve && "p-combobox__option--active",
661
+ Le && "p-combobox__option--selected",
662
+ f.disabled && "p-combobox__option--disabled"
663
+ ),
664
+ onMouseDown: (Ue) => Ae(Ue, f),
665
+ children: [
666
+ /* @__PURE__ */ a("span", { className: "p-combobox__option-check", children: Le ? /* @__PURE__ */ a(oa, {}) : null }),
667
+ /* @__PURE__ */ _("span", { className: "p-combobox__option-content", children: [
668
+ /* @__PURE__ */ a("span", { className: "p-combobox__option-label", children: f.label }),
669
+ f.description ? /* @__PURE__ */ a("span", { className: "p-combobox__option-description", children: f.description }) : null
670
+ ] }),
671
+ f.meta ? /* @__PURE__ */ a("span", { className: "p-combobox__option-meta", children: f.meta }) : null
672
+ ]
673
+ },
674
+ f.value
675
+ );
676
+ })
677
+ ] }, c.group ?? "ungrouped")) : We ? null : /* @__PURE__ */ a("div", { className: "p-combobox__empty", role: "option", "aria-disabled": "true", "aria-selected": "false", children: $ }),
678
+ Je ? /* @__PURE__ */ _("div", { className: "p-combobox__status p-combobox__status--footer", role: "option", "aria-disabled": "true", "aria-selected": "false", children: [
679
+ /* @__PURE__ */ a("span", { className: "p-combobox__spinner", "aria-hidden": "true" }),
680
+ /* @__PURE__ */ a("span", { children: B })
681
+ ] }) : null
682
+ ]
683
+ }
684
+ ),
685
+ Qe ? /* @__PURE__ */ a("div", { className: "p-combobox__footer", children: /* @__PURE__ */ a("button", { type: "button", className: "p-combobox__load-more", onMouseDown: (c) => c.preventDefault(), onClick: ae, children: A }) }) : null
686
+ ]
687
+ }
688
+ ) : null
689
+ ] }),
690
+ /* @__PURE__ */ a(
691
+ "input",
692
+ {
693
+ ref: ce,
694
+ type: "text",
695
+ name: S,
696
+ value: le ?? "",
697
+ required: O,
698
+ tabIndex: -1,
699
+ "aria-hidden": "true",
700
+ className: "p-combobox__hidden-input",
701
+ onChange: () => {
702
+ }
703
+ }
704
+ ),
705
+ L ? /* @__PURE__ */ a("div", { className: "p-combobox__backdrop", "aria-hidden": "true", onMouseDown: E }) : null,
706
+ T && V ? /* @__PURE__ */ a("p", { id: Z, role: "alert", className: "p-combobox__message p-combobox__message--error", children: V }) : null,
707
+ !T && I ? /* @__PURE__ */ a("p", { id: te, className: "p-combobox__message", children: I }) : null
708
+ ]
709
+ }
710
+ );
711
+ }
712
+ );
713
+ da.displayName = "PCombobox";
714
+ const ua = new Intl.DateTimeFormat(void 0, { weekday: "short" });
715
+ function lt(e) {
279
716
  if (!e)
280
717
  return null;
281
718
  if (e instanceof Date)
@@ -283,57 +720,63 @@ function Se(e) {
283
720
  const t = e.split("-").map(Number);
284
721
  if (t.length !== 3 || t.some(Number.isNaN))
285
722
  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;
723
+ const [n, r, l] = t, s = new Date(n, r - 1, l);
724
+ return s.getFullYear() !== n || s.getMonth() !== r - 1 || s.getDate() !== l ? null : s;
288
725
  }
289
- function ke(e) {
726
+ function et(e) {
290
727
  if (!e)
291
728
  return "";
292
729
  const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
293
730
  return `${t}-${n}-${r}`;
294
731
  }
295
- function ue(e) {
732
+ function fe(e) {
296
733
  return new Date(e.getFullYear(), e.getMonth(), 1);
297
734
  }
298
- function vt(e) {
735
+ function ct(e) {
299
736
  return new Date(e.getFullYear(), e.getMonth() + 1, 0);
300
737
  }
301
- function Ge(e, t) {
738
+ function Mt(e, t) {
302
739
  return new Date(e.getFullYear(), e.getMonth() + t, 1);
303
740
  }
304
- function et(e, t) {
305
- const n = Ge(e, t), r = vt(n).getDate();
741
+ function Vt(e, t) {
742
+ const n = Mt(e, t), r = ct(n).getDate();
306
743
  return new Date(n.getFullYear(), n.getMonth(), Math.min(e.getDate(), r));
307
744
  }
308
- function R(e, t) {
745
+ function ke(e, t) {
309
746
  return new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
310
747
  }
311
- function De(e, t) {
312
- return !!(e && t && ke(e) === ke(t));
748
+ function Ee(e, t) {
749
+ return !!(e && t && et(e) === et(t));
313
750
  }
314
- function de() {
751
+ function ze() {
315
752
  const e = /* @__PURE__ */ new Date();
316
753
  return new Date(e.getFullYear(), e.getMonth(), e.getDate());
317
754
  }
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));
755
+ function pa(e, t) {
756
+ const n = fe(e), r = (n.getDay() - t + 7) % 7, l = ke(n, -r);
757
+ return Array.from({ length: 42 }, (s, d) => ke(l, d));
321
758
  }
322
- function He(e) {
759
+ function _t(e) {
323
760
  const t = typeof e.value == "function" ? e.value() : e.value;
324
- return Se(t);
761
+ return lt(t);
325
762
  }
326
- function kt(e, t) {
763
+ function ha(e, t) {
327
764
  return new Intl.DateTimeFormat(t, { month: "long", year: "numeric" }).format(e);
328
765
  }
329
- function Nt(e, t) {
766
+ function ba(e) {
767
+ return Array.from({ length: 12 }, (t, n) => ({
768
+ label: new Intl.DateTimeFormat(e, { month: "long" }).format(new Date(2024, n, 1)),
769
+ value: n
770
+ }));
771
+ }
772
+ function _a(e, t) {
330
773
  return new Intl.DateTimeFormat(t, {
331
774
  month: "short",
332
775
  day: "numeric",
333
776
  year: "numeric"
334
777
  }).format(e);
335
778
  }
336
- function wt(e, t) {
779
+ function ma(e, t) {
337
780
  return new Intl.DateTimeFormat(t, {
338
781
  weekday: "long",
339
782
  month: "long",
@@ -341,274 +784,352 @@ function wt(e, t) {
341
784
  year: "numeric"
342
785
  }).format(e);
343
786
  }
344
- function xt(e, t) {
787
+ function fa(e, t) {
345
788
  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) : "";
789
+ return Array.from({ length: 7 }, (r, l) => {
790
+ const s = ke(n, e + l);
791
+ return ua.formatToParts(s).length ? new Intl.DateTimeFormat(t, { weekday: "short" }).format(s) : "";
349
792
  });
350
793
  }
351
- function Oe(e, t) {
794
+ function mt(e, t) {
352
795
  return !!(t && e.getTime() < t.getTime());
353
796
  }
354
- function Ve(e, t) {
797
+ function ft(e, t) {
355
798
  return !!(t && e.getTime() > t.getTime());
356
799
  }
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
- ] });
800
+ function Lt(e, t) {
801
+ return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth();
802
+ }
803
+ function gt(e, t, n) {
804
+ const r = fe(e), l = ct(e);
805
+ return !!(t && l < t || n && r > n);
364
806
  }
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" }) });
807
+ function ga(e, t, n) {
808
+ return t && ct(e) < t ? fe(t) : n && fe(e) > n ? fe(n) : fe(e);
809
+ }
810
+ function ya(e, t, n, r) {
811
+ const l = fe(e), s = ct(e);
812
+ let d = new Date(
813
+ l.getFullYear(),
814
+ l.getMonth(),
815
+ Math.min(t.getDate(), s.getDate())
816
+ );
817
+ return n && d < n && (d = Lt(n, l) ? n : l), r && d > r && (d = Lt(r, l) ? r : s), d;
367
818
  }
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" }) });
819
+ function va(e, t, n, r) {
820
+ const l = e.getFullYear(), s = Math.min(l, r.getFullYear() - 100), d = Math.max(l, r.getFullYear() + 20), m = (t == null ? void 0 : t.getFullYear()) ?? s, y = (n == null ? void 0 : n.getFullYear()) ?? d, b = Math.min(m, y, l), u = Math.max(m, y, l);
821
+ return Array.from({ length: u - b + 1 }, (v, N) => b + N);
370
822
  }
371
- const Ct = U(
823
+ const Na = oe(
372
824
  ({
373
825
  label: e,
374
826
  value: t,
375
827
  defaultValue: n,
376
828
  onValueChange: r,
377
- presets: s = [],
378
- customLabel: l = "Custom",
829
+ presets: l = [],
830
+ customLabel: s = "Custom",
379
831
  showCustom: d = !0,
380
- presetColumns: f = "auto",
381
- placeholder: b = "Select date",
382
- helperText: c,
832
+ presetColumns: m = "auto",
833
+ placeholder: y = "Select date",
834
+ helperText: b,
383
835
  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,
393
- 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 || _)
836
+ errorMessage: v,
837
+ min: N,
838
+ max: F,
839
+ name: k,
840
+ disabled: g = !1,
841
+ readOnly: $ = !1,
842
+ required: j = !1,
843
+ locale: B,
844
+ weekStartsOn: A = 0,
845
+ className: I,
846
+ id: T,
847
+ style: V,
848
+ ...S
849
+ }, z) => {
850
+ const ee = Oe(), O = T ?? ee, X = `${O}-label`, p = `${O}-panel`, M = `${O}-helper`, x = `${O}-error`, W = t !== void 0, [pe, w] = re(n ?? ""), [D, H] = re(!1), he = W ? t : pe, Y = lt(he), R = tt(ze, []), te = lt(N), Z = lt(F), [G, J] = re(() => fe(Y ?? R)), [q, ce] = re(() => Y ?? R), De = me(null), be = me({}), xe = me(!1), Fe = pa(G, A), Se = fa(A, B), Xe = tt(() => ba(B), [B]), le = va(G, te, Z, R), U = l.length > 0, Ze = U ? d : !0, ge = m === "auto" ? void 0 : {
851
+ "--p-date-picker-preset-columns": String(m)
852
+ }, de = u && v ? x : b ? M : void 0, L = Y ? _a(Y, B) : y, ue = U ? l.some((o) => Ee(_t(o), Y)) : !1, ye = D || !!(Y && !ue), Te = Mt(G, -1), Q = Mt(G, 1), Ie = gt(Te, te, Z), Me = gt(Q, te, Z);
853
+ Ce(() => {
854
+ var o;
855
+ D && xe.current && ((o = be.current[et(q)]) == null || o.focus(), xe.current = !1);
856
+ }, [q, D, G]);
857
+ const $e = (o, C) => {
858
+ const ae = et(o);
859
+ W || w(ae), o && J(fe(o)), r == null || r(ae, { date: o, source: C });
860
+ }, je = (o) => {
861
+ if (g || $)
410
862
  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 || _)
863
+ const C = Y ?? R;
864
+ De.current = o, xe.current = !0, ce(C), J(fe(C)), H(!0);
865
+ }, ve = (o = !1) => {
866
+ var C;
867
+ H(!1), o && ((C = De.current) == null || C.focus());
868
+ }, we = (o) => {
869
+ const C = ga(o, te, Z);
870
+ J(C), ce(ya(C, q, te, Z));
871
+ }, He = (o) => {
872
+ const { value: C } = o.currentTarget;
873
+ we(new Date(G.getFullYear(), Number(C), 1));
874
+ }, Ne = (o) => {
875
+ const { value: C } = o.currentTarget;
876
+ we(new Date(Number(C), G.getMonth(), 1));
877
+ }, Be = (o) => {
878
+ if (g || $)
418
879
  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);
880
+ const C = _t(o);
881
+ $e(C, "preset"), ve();
882
+ }, We = (o) => {
883
+ g || $ || mt(o, te) || ft(o, Z) || (ce(o), $e(o, "calendar"), ve(!0));
884
+ }, Je = (o) => {
885
+ mt(o, te) || ft(o, Z) || (xe.current = !0, ce(o), J(fe(o)));
886
+ }, Qe = (o) => (C) => {
887
+ if (C.key === "Escape") {
888
+ C.preventDefault(), ve(!0);
428
889
  return;
429
890
  }
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));
891
+ const ae = (o.getDay() - A + 7) % 7, P = {
892
+ ArrowLeft: ke(o, -1),
893
+ ArrowRight: ke(o, 1),
894
+ ArrowUp: ke(o, -7),
895
+ ArrowDown: ke(o, 7),
896
+ Home: ke(o, -ae),
897
+ End: ke(o, 6 - ae),
898
+ PageUp: Vt(o, -1),
899
+ PageDown: Vt(o, 1)
900
+ }[C.key];
901
+ P && (C.preventDefault(), Je(P));
441
902
  };
442
- return /* @__PURE__ */ k(
903
+ return /* @__PURE__ */ _(
443
904
  "div",
444
905
  {
445
- ...se,
446
- ref: pe,
447
- id: E,
448
- style: ne ? { ...ie, ...ne } : ie,
449
- className: p(
906
+ ...S,
907
+ ref: z,
908
+ id: O,
909
+ style: ge ? { ...V, ...ge } : V,
910
+ className: h(
450
911
  "p-date-picker",
451
- ae && "p-date-picker--with-presets",
912
+ U && "p-date-picker--with-presets",
452
913
  u && "p-date-picker--error",
453
- m && "p-date-picker--disabled",
454
- P
914
+ g && "p-date-picker--disabled",
915
+ I
455
916
  ),
456
917
  children: [
457
- /* @__PURE__ */ k("div", { id: L, className: "p-date-picker__label", children: [
918
+ U ? /* @__PURE__ */ _("div", { id: X, className: "p-date-picker__label", children: [
458
919
  /* @__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(
920
+ /* @__PURE__ */ a("span", { className: h("p-date-picker__label-value", !Y && "p-date-picker__label-value--empty"), children: L })
921
+ ] }) : null,
922
+ U ? /* @__PURE__ */ _(
462
923
  "div",
463
924
  {
464
- "aria-describedby": Me,
465
- "aria-labelledby": L,
466
- className: p(
925
+ "aria-describedby": de,
926
+ "aria-labelledby": X,
927
+ className: h(
467
928
  "p-date-picker__presets",
468
- f !== "auto" && "p-date-picker__presets--fixed"
929
+ m !== "auto" && "p-date-picker__presets--fixed"
469
930
  ),
470
931
  role: "group",
471
932
  children: [
472
- s.map((i) => {
473
- const N = He(i), S = De(N, g);
933
+ l.map((o) => {
934
+ const C = _t(o), ae = Ee(C, Y);
474
935
  return /* @__PURE__ */ a(
475
936
  "button",
476
937
  {
477
938
  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
939
+ className: h("p-date-picker__preset", ae && "p-date-picker__preset--active"),
940
+ disabled: g,
941
+ "aria-pressed": ae,
942
+ onClick: () => Be(o),
943
+ children: o.label
483
944
  },
484
- i.label
945
+ o.label
485
946
  );
486
947
  }),
487
- je ? /* @__PURE__ */ a(
948
+ Ze ? /* @__PURE__ */ a(
488
949
  "button",
489
950
  {
490
951
  type: "button",
491
- className: p(
952
+ className: h(
492
953
  "p-date-picker__preset",
493
- _e && "p-date-picker__preset--active"
954
+ ye && "p-date-picker__preset--active"
494
955
  ),
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
956
+ disabled: g,
957
+ "aria-controls": p,
958
+ "aria-expanded": D,
959
+ "aria-pressed": ye,
960
+ onClick: (o) => D ? ve(!0) : je(o.currentTarget),
961
+ children: s
501
962
  }
502
963
  ) : null
503
964
  ]
504
965
  }
505
- ) : /* @__PURE__ */ k(
966
+ ) : /* @__PURE__ */ _(
506
967
  "button",
507
968
  {
508
969
  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,
970
+ className: h(
971
+ "p-date-picker__trigger",
972
+ !Y && "p-date-picker__trigger--empty",
973
+ Y && "p-date-picker__trigger--filled",
974
+ D && "p-date-picker__trigger--open"
975
+ ),
976
+ disabled: g,
977
+ "aria-controls": p,
978
+ "aria-describedby": de,
979
+ "aria-expanded": D,
514
980
  "aria-haspopup": "dialog",
515
- "aria-labelledby": L,
516
- onClick: (i) => Y ? W(!0) : $e(i.currentTarget),
981
+ "aria-label": `${e}: ${L}`,
982
+ onClick: (o) => D ? ve(!0) : je(o.currentTarget),
517
983
  children: [
518
- /* @__PURE__ */ a("span", { children: fe }),
519
- /* @__PURE__ */ a("span", { className: "p-date-picker__trigger-icon", children: /* @__PURE__ */ a(Mt, {}) })
984
+ /* @__PURE__ */ a(
985
+ "span",
986
+ {
987
+ id: X,
988
+ className: h(
989
+ "p-date-picker__trigger-label p-date-picker__trigger-floating-label",
990
+ u && "p-date-picker__trigger-label--error"
991
+ ),
992
+ "aria-hidden": "true",
993
+ children: e
994
+ }
995
+ ),
996
+ /* @__PURE__ */ a(
997
+ "span",
998
+ {
999
+ className: h(
1000
+ "p-date-picker__trigger-label p-date-picker__trigger-placeholder-label",
1001
+ u && "p-date-picker__trigger-label--error"
1002
+ ),
1003
+ "aria-hidden": "true",
1004
+ children: e
1005
+ }
1006
+ ),
1007
+ /* @__PURE__ */ a("span", { className: "p-date-picker__trigger-value", children: L }),
1008
+ /* @__PURE__ */ a("span", { className: "p-date-picker__trigger-icon", children: /* @__PURE__ */ a(qt, {}) })
520
1009
  ]
521
1010
  }
522
1011
  ),
523
- /* @__PURE__ */ a("input", { type: "hidden", name: M, value: ge ?? "", required: $ }),
524
- Y && /* @__PURE__ */ k(
1012
+ /* @__PURE__ */ a("input", { type: "hidden", name: k, value: he ?? "", required: j }),
1013
+ D && /* @__PURE__ */ _(
525
1014
  "div",
526
1015
  {
527
- id: A,
1016
+ id: p,
528
1017
  className: "p-date-picker__panel",
529
1018
  role: "dialog",
530
- "aria-labelledby": `${A}-title`,
531
- onKeyDown: (i) => {
532
- i.key === "Escape" && W();
1019
+ "aria-labelledby": `${p}-title`,
1020
+ onKeyDown: (o) => {
1021
+ o.key === "Escape" && ve();
533
1022
  },
534
1023
  children: [
535
- /* @__PURE__ */ k("div", { className: "p-date-picker__calendar-header", children: [
1024
+ /* @__PURE__ */ _("div", { className: "p-date-picker__calendar-header", children: [
536
1025
  /* @__PURE__ */ a(
537
1026
  "button",
538
1027
  {
539
1028
  type: "button",
540
1029
  className: "p-date-picker__nav",
541
1030
  "aria-label": "Previous month",
542
- onClick: () => K((i) => Ge(i, -1)),
543
- children: /* @__PURE__ */ a($t, {})
1031
+ disabled: Ie,
1032
+ onClick: () => we(Te),
1033
+ children: /* @__PURE__ */ a(Pt, {})
544
1034
  }
545
1035
  ),
546
- /* @__PURE__ */ a("div", { id: `${A}-title`, className: "p-date-picker__month", children: kt(G, w) }),
1036
+ /* @__PURE__ */ _("div", { className: "p-date-picker__month", children: [
1037
+ /* @__PURE__ */ a("span", { id: `${p}-title`, className: "p-date-picker__month-label", children: ha(G, B) }),
1038
+ /* @__PURE__ */ a(
1039
+ "select",
1040
+ {
1041
+ className: "p-date-picker__month-select p-date-picker__calendar-select",
1042
+ "aria-label": "Month",
1043
+ value: G.getMonth(),
1044
+ onChange: He,
1045
+ children: Xe.map((o) => /* @__PURE__ */ a(
1046
+ "option",
1047
+ {
1048
+ value: o.value,
1049
+ disabled: gt(new Date(G.getFullYear(), o.value, 1), te, Z),
1050
+ children: o.label
1051
+ },
1052
+ o.value
1053
+ ))
1054
+ }
1055
+ ),
1056
+ /* @__PURE__ */ a(
1057
+ "select",
1058
+ {
1059
+ className: "p-date-picker__year-select p-date-picker__calendar-select",
1060
+ "aria-label": "Year",
1061
+ value: G.getFullYear(),
1062
+ onChange: Ne,
1063
+ children: le.map((o) => /* @__PURE__ */ a("option", { value: o, children: o }, o))
1064
+ }
1065
+ )
1066
+ ] }),
547
1067
  /* @__PURE__ */ a(
548
1068
  "button",
549
1069
  {
550
1070
  type: "button",
551
1071
  className: "p-date-picker__nav",
552
1072
  "aria-label": "Next month",
553
- onClick: () => K((i) => Ge(i, 1)),
554
- children: /* @__PURE__ */ a(Pt, {})
1073
+ disabled: Me,
1074
+ onClick: () => we(Q),
1075
+ children: /* @__PURE__ */ a(Ft, {})
555
1076
  }
556
1077
  )
557
1078
  ] }),
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);
1079
+ /* @__PURE__ */ a("div", { className: "p-date-picker__weekdays", "aria-hidden": "true", children: Se.map((o) => /* @__PURE__ */ a("span", { children: o }, o)) }),
1080
+ /* @__PURE__ */ a("div", { className: "p-date-picker__grid", role: "grid", "aria-labelledby": `${p}-title`, children: Fe.map((o) => {
1081
+ const C = et(o), ae = o.getMonth() !== G.getMonth(), i = Ee(o, Y), P = Ee(o, R), E = mt(o, te) || ft(o, Z);
561
1082
  return /* @__PURE__ */ a(
562
1083
  "button",
563
1084
  {
564
- ref: (re) => {
565
- te.current[N] = re;
1085
+ ref: (Pe) => {
1086
+ be.current[C] = Pe;
566
1087
  },
567
1088
  type: "button",
568
1089
  role: "gridcell",
569
- "data-date": N,
570
- className: p(
1090
+ "data-date": C,
1091
+ className: h(
571
1092
  "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"
1093
+ ae && "p-date-picker__day--outside",
1094
+ P && "p-date-picker__day--today",
1095
+ i && "p-date-picker__day--selected"
575
1096
  ),
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()
1097
+ disabled: E,
1098
+ "aria-label": ma(o, B),
1099
+ "aria-selected": i,
1100
+ tabIndex: Ee(o, q) ? 0 : -1,
1101
+ onClick: () => We(o),
1102
+ onKeyDown: Qe(o),
1103
+ children: o.getDate()
583
1104
  },
584
- N
1105
+ C
585
1106
  );
586
1107
  }) })
587
1108
  ]
588
1109
  }
589
1110
  ),
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
1111
+ u && v ? /* @__PURE__ */ a("p", { id: x, role: "alert", className: "p-date-picker__message p-date-picker__message--error", children: v }) : null,
1112
+ !u && b ? /* @__PURE__ */ a("p", { id: M, className: "p-date-picker__message", children: b }) : null
592
1113
  ]
593
1114
  }
594
1115
  );
595
1116
  }
596
1117
  );
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()) },
1118
+ Na.displayName = "PDatePicker";
1119
+ const tn = {
1120
+ today: { label: "Today", value: () => ze() },
1121
+ yesterday: { label: "Yesterday", value: () => ke(ze(), -1) },
1122
+ tomorrow: { label: "Tomorrow", value: () => ke(ze(), 1) },
1123
+ startOfMonth: { label: "Start of month", value: () => fe(ze()) },
603
1124
  endOfMonth: {
604
1125
  label: "End of month",
605
1126
  value: () => {
606
- const e = de();
1127
+ const e = ze();
607
1128
  return new Date(e.getFullYear(), e.getMonth() + 1, 0);
608
1129
  }
609
1130
  }
610
- }, It = new Intl.DateTimeFormat(void 0, { weekday: "short" });
611
- function Ae(e) {
1131
+ }, ka = new Intl.DateTimeFormat(void 0, { weekday: "short" });
1132
+ function st(e) {
612
1133
  if (!e)
613
1134
  return null;
614
1135
  if (e instanceof Date)
@@ -616,50 +1137,56 @@ function Ae(e) {
616
1137
  const t = e.split("-").map(Number);
617
1138
  if (t.length !== 3 || t.some(Number.isNaN))
618
1139
  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;
1140
+ const [n, r, l] = t, s = new Date(n, r - 1, l);
1141
+ return s.getFullYear() !== n || s.getMonth() !== r - 1 || s.getDate() !== l ? null : s;
621
1142
  }
622
- function y(e) {
1143
+ function K(e) {
623
1144
  if (!e)
624
1145
  return "";
625
1146
  const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
626
1147
  return `${t}-${n}-${r}`;
627
1148
  }
628
- function X(e) {
1149
+ function se(e) {
629
1150
  return new Date(e.getFullYear(), e.getMonth(), 1);
630
1151
  }
631
- function Je(e) {
1152
+ function Re(e) {
632
1153
  return new Date(e.getFullYear(), e.getMonth() + 1, 0);
633
1154
  }
634
- function Ye(e, t) {
1155
+ function ot(e, t) {
635
1156
  return new Date(e.getFullYear(), e.getMonth() + t, 1);
636
1157
  }
637
- function tt(e, t) {
638
- const n = Ye(e, t), r = Je(n).getDate();
1158
+ function Kt(e, t) {
1159
+ const n = ot(e, t), r = Re(n).getDate();
639
1160
  return new Date(n.getFullYear(), n.getMonth(), Math.min(e.getDate(), r));
640
1161
  }
641
- function I(e, t) {
1162
+ function ie(e, t) {
642
1163
  return new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
643
1164
  }
644
- function O() {
1165
+ function Ye() {
645
1166
  const e = /* @__PURE__ */ new Date();
646
1167
  return new Date(e.getFullYear(), e.getMonth(), e.getDate());
647
1168
  }
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));
1169
+ function Da(e, t) {
1170
+ const n = se(e), r = (n.getDay() - t + 7) % 7, l = ie(n, -r);
1171
+ return Array.from({ length: 42 }, (s, d) => ie(l, d));
651
1172
  }
652
- function St(e, t) {
1173
+ function xa(e, t) {
653
1174
  return new Intl.DateTimeFormat(t, { month: "long", year: "numeric" }).format(e);
654
1175
  }
655
- function Ie(e, t) {
1176
+ function Ma(e) {
1177
+ return Array.from({ length: 12 }, (t, n) => ({
1178
+ label: new Intl.DateTimeFormat(e, { month: "long" }).format(new Date(2024, n, 1)),
1179
+ value: n
1180
+ }));
1181
+ }
1182
+ function nt(e, t) {
656
1183
  return new Intl.DateTimeFormat(t, {
657
1184
  month: "short",
658
1185
  day: "numeric",
659
1186
  year: "numeric"
660
1187
  }).format(e);
661
1188
  }
662
- function Tt(e, t) {
1189
+ function $a(e, t) {
663
1190
  return new Intl.DateTimeFormat(t, {
664
1191
  weekday: "long",
665
1192
  month: "long",
@@ -667,475 +1194,1087 @@ function Tt(e, t) {
667
1194
  year: "numeric"
668
1195
  }).format(e);
669
1196
  }
670
- function Bt(e, t) {
1197
+ function wa(e, t) {
671
1198
  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) : "";
1199
+ return Array.from({ length: 7 }, (r, l) => {
1200
+ const s = ie(n, e + l);
1201
+ return ka.formatToParts(s).length ? new Intl.DateTimeFormat(t, { weekday: "short" }).format(s) : "";
675
1202
  });
676
1203
  }
677
- function Fe(e, t) {
678
- return !!(e && t && y(e) === y(t));
1204
+ function rt(e, t) {
1205
+ return !!(e && t && K(e) === K(t));
679
1206
  }
680
- function Ue(e, t) {
1207
+ function yt(e, t) {
681
1208
  return !!(t && e.getTime() < t.getTime());
682
1209
  }
683
- function qe(e, t) {
1210
+ function vt(e, t) {
684
1211
  return !!(t && e.getTime() > t.getTime());
685
1212
  }
686
- function Rt(e, t, n) {
1213
+ function jt(e, t) {
1214
+ return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth();
1215
+ }
1216
+ function Nt(e, t, n) {
1217
+ const r = se(e), l = Re(e);
1218
+ return !!(t && l < t || n && r > n);
1219
+ }
1220
+ function Pa(e, t, n) {
1221
+ return t && Re(e) < t ? se(t) : n && se(e) > n ? se(n) : se(e);
1222
+ }
1223
+ function Fa(e, t, n, r) {
1224
+ const l = se(e), s = Re(e);
1225
+ let d = new Date(
1226
+ l.getFullYear(),
1227
+ l.getMonth(),
1228
+ Math.min(t.getDate(), s.getDate())
1229
+ );
1230
+ return n && d < n && (d = jt(n, l) ? n : l), r && d > r && (d = jt(r, l) ? r : s), d;
1231
+ }
1232
+ function Ia(e, t, n, r) {
1233
+ const l = e.getFullYear(), s = Math.min(l, r.getFullYear() - 100), d = Math.max(l, r.getFullYear() + 20), m = (t == null ? void 0 : t.getFullYear()) ?? s, y = (n == null ? void 0 : n.getFullYear()) ?? d, b = Math.min(m, y, l), u = Math.max(m, y, l);
1234
+ return Array.from({ length: u - b + 1 }, (v, N) => b + N);
1235
+ }
1236
+ function Ya(e, t, n) {
687
1237
  return !!(t && n && e > t && e < n);
688
1238
  }
689
- function At(e, t) {
1239
+ function Ca(e, t) {
690
1240
  return !e && !t ? {} : e && t && t < e ? {
691
- start: y(t),
692
- end: y(e)
1241
+ start: K(t),
1242
+ end: K(e)
693
1243
  } : {
694
- start: y(e),
695
- end: y(t)
1244
+ start: K(e),
1245
+ end: K(t)
696
1246
  };
697
1247
  }
698
- function Ze(e) {
1248
+ function kt(e) {
699
1249
  return typeof e.value == "function" ? e.value() : e.value;
700
1250
  }
701
- function Te(e) {
1251
+ function it(e) {
702
1252
  return {
703
- startDate: Ae(e == null ? void 0 : e.start),
704
- endDate: Ae(e == null ? void 0 : e.end)
1253
+ startDate: st(e == null ? void 0 : e.start),
1254
+ endDate: st(e == null ? void 0 : e.end)
705
1255
  };
706
1256
  }
707
- function at(e, t) {
1257
+ function Ht(e, t) {
708
1258
  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
1259
  }
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;
1260
+ function Sa(e, t, n) {
1261
+ const { startDate: r, endDate: l } = it(e);
1262
+ return r && l ? `${nt(r, n)} - ${nt(l, n)}` : r ? `${nt(r, n)} -` : l ? `- ${nt(l, n)}` : t;
713
1263
  }
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" }) });
727
- }
728
- const jt = U(
1264
+ const Ta = oe(
729
1265
  ({
730
1266
  label: e,
731
1267
  value: t,
732
1268
  defaultValue: n,
733
1269
  onValueChange: r,
734
- presets: s = [],
735
- customLabel: l = "Custom",
1270
+ presets: l = [],
1271
+ customLabel: s = "Custom",
736
1272
  showCustom: d = !0,
737
- presetColumns: f = "auto",
738
- placeholder: b = "Select range",
739
- helperText: c,
1273
+ presetColumns: m = "auto",
1274
+ placeholder: y = "Select range",
1275
+ helperText: b,
740
1276
  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,
750
- 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
1277
+ errorMessage: v,
1278
+ min: N,
1279
+ max: F,
1280
+ nameStart: k,
1281
+ nameEnd: g,
1282
+ disabled: $ = !1,
1283
+ readOnly: j = !1,
1284
+ required: B = !1,
1285
+ locale: A,
1286
+ weekStartsOn: I = 0,
1287
+ className: T,
1288
+ id: V,
1289
+ style: S,
1290
+ ...z
1291
+ }, ee) => {
1292
+ const O = Oe(), X = V ?? O, p = `${X}-label`, M = `${X}-panel`, x = `${X}-helper`, W = `${X}-error`, pe = t !== void 0, [w, D] = re(n ?? {}), [H, he] = re(!1), Y = pe ? t : w, { startDate: R, endDate: te } = it(Y), Z = tt(Ye, []), G = st(N), J = st(F), [q, ce] = re(() => se(R ?? Z)), [De, be] = re(() => R ?? Z), xe = me(null), Fe = me({}), Se = me(!1), Xe = Da(q, I), le = wa(I, A), U = tt(() => Ma(A), [A]), Ze = Ia(q, G, J, Z), ge = l.length > 0, de = ge ? d : !0, L = m === "auto" ? void 0 : {
1293
+ "--p-date-range-picker-preset-columns": String(m)
1294
+ }, ue = !!(Y != null && Y.start && (Y != null && Y.end)), ye = u && v ? W : b ? x : void 0, Te = Sa(Y, y, A), Q = ge ? l.some((i) => Ht(kt(i), Y)) : !1, Ie = H || !!(ue && !Q), Me = ot(q, -1), $e = ot(q, 1), je = Nt(Me, G, J), ve = Nt($e, G, J);
1295
+ Ce(() => {
1296
+ var i;
1297
+ H && Se.current && ((i = Fe.current[K(De)]) == null || i.focus(), Se.current = !1);
1298
+ }, [De, H, q]);
1299
+ const we = (i, P) => {
1300
+ const { startDate: E, endDate: Pe } = it(i), _e = Ca(E, Pe);
1301
+ pe || D(_e);
1302
+ const Ae = it(_e);
1303
+ Ae.startDate && ce(se(Ae.startDate)), r == null || r(_e, {
1304
+ startDate: Ae.startDate,
1305
+ endDate: Ae.endDate,
1306
+ source: P
771
1307
  });
772
- }, Pe = (o) => {
773
- if (_ || $)
1308
+ }, He = (i) => {
1309
+ if ($ || j)
774
1310
  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");
1311
+ const P = R ?? Z;
1312
+ xe.current = i, Se.current = !0, be(P), ce(se(P)), he(!0);
1313
+ }, Ne = (i = !1) => {
1314
+ var P;
1315
+ he(!1), i && ((P = xe.current) == null || P.focus());
1316
+ }, Be = (i) => {
1317
+ const P = Pa(i, G, J);
1318
+ ce(P), be(Fa(P, De, G, J));
1319
+ }, We = (i) => {
1320
+ const { value: P } = i.currentTarget;
1321
+ Be(new Date(q.getFullYear(), Number(P), 1));
1322
+ }, Je = (i) => {
1323
+ const { value: P } = i.currentTarget;
1324
+ Be(new Date(Number(P), q.getMonth(), 1));
1325
+ }, Qe = (i) => {
1326
+ $ || j || (we(kt(i), "preset"), Ne());
1327
+ }, o = (i) => {
1328
+ if (!($ || j || yt(i, G) || vt(i, J))) {
1329
+ if (!R || te) {
1330
+ be(i), we({ start: K(i), end: "" }, "calendar");
786
1331
  return;
787
1332
  }
788
- te(o), ve({ start: y(F), end: y(o) }, "calendar"), Q(!0);
1333
+ be(i), we({ start: K(R), end: K(i) }, "calendar"), Ne(!0);
789
1334
  }
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);
1335
+ }, C = (i) => {
1336
+ yt(i, G) || vt(i, J) || (Se.current = !0, be(i), ce(se(i)));
1337
+ }, ae = (i) => (P) => {
1338
+ if (P.key === "Escape") {
1339
+ P.preventDefault(), Ne(!0);
795
1340
  return;
796
1341
  }
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));
1342
+ const E = (i.getDay() - I + 7) % 7, _e = {
1343
+ ArrowLeft: ie(i, -1),
1344
+ ArrowRight: ie(i, 1),
1345
+ ArrowUp: ie(i, -7),
1346
+ ArrowDown: ie(i, 7),
1347
+ Home: ie(i, -E),
1348
+ End: ie(i, 6 - E),
1349
+ PageUp: Kt(i, -1),
1350
+ PageDown: Kt(i, 1)
1351
+ }[P.key];
1352
+ _e && (P.preventDefault(), C(_e));
808
1353
  };
809
- return /* @__PURE__ */ k(
1354
+ return /* @__PURE__ */ _(
810
1355
  "div",
811
1356
  {
812
- ...pe,
813
- ref: ze,
814
- id: L,
815
- style: fe ? { ...se, ...fe } : se,
816
- className: p(
1357
+ ...z,
1358
+ ref: ee,
1359
+ id: X,
1360
+ style: L ? { ...S, ...L } : S,
1361
+ className: h(
817
1362
  "p-date-range-picker",
818
- ne && "p-date-range-picker--with-presets",
1363
+ ge && "p-date-range-picker--with-presets",
819
1364
  u && "p-date-range-picker--error",
820
- _ && "p-date-range-picker--disabled",
821
- q
1365
+ $ && "p-date-range-picker--disabled",
1366
+ T
822
1367
  ),
823
1368
  children: [
824
- /* @__PURE__ */ k("div", { id: A, className: "p-date-range-picker__label", children: [
1369
+ ge ? /* @__PURE__ */ _("div", { id: p, className: "p-date-range-picker__label", children: [
825
1370
  /* @__PURE__ */ a("span", { children: e }),
826
1371
  /* @__PURE__ */ a(
827
1372
  "span",
828
1373
  {
829
- className: p(
1374
+ className: h(
830
1375
  "p-date-range-picker__label-value",
831
- !ye && "p-date-range-picker__label-value--empty"
1376
+ !ue && "p-date-range-picker__label-value--empty"
832
1377
  ),
833
- children: be
1378
+ children: Te
834
1379
  }
835
1380
  )
836
- ] }),
837
- ne ? /* @__PURE__ */ k(
1381
+ ] }) : null,
1382
+ ge ? /* @__PURE__ */ _(
838
1383
  "div",
839
1384
  {
840
- "aria-describedby": _e,
841
- "aria-labelledby": A,
842
- className: p(
1385
+ "aria-describedby": ye,
1386
+ "aria-labelledby": p,
1387
+ className: h(
843
1388
  "p-date-range-picker__presets",
844
- f !== "auto" && "p-date-range-picker__presets--fixed"
1389
+ m !== "auto" && "p-date-range-picker__presets--fixed"
845
1390
  ),
846
1391
  role: "group",
847
1392
  children: [
848
- s.map((o) => {
849
- const D = Ze(o), B = at(D, g);
1393
+ l.map((i) => {
1394
+ const P = kt(i), E = Ht(P, Y);
850
1395
  return /* @__PURE__ */ a(
851
1396
  "button",
852
1397
  {
853
1398
  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
1399
+ className: h("p-date-range-picker__preset", E && "p-date-range-picker__preset--active"),
1400
+ disabled: $,
1401
+ "aria-pressed": E,
1402
+ onClick: () => Qe(i),
1403
+ children: i.label
859
1404
  },
860
- o.label
1405
+ i.label
861
1406
  );
862
1407
  }),
863
- Me ? /* @__PURE__ */ a(
1408
+ de ? /* @__PURE__ */ a(
864
1409
  "button",
865
1410
  {
866
1411
  type: "button",
867
- className: p(
1412
+ className: h(
868
1413
  "p-date-range-picker__preset",
869
- W && "p-date-range-picker__preset--active"
1414
+ Ie && "p-date-range-picker__preset--active"
870
1415
  ),
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
1416
+ disabled: $,
1417
+ "aria-controls": M,
1418
+ "aria-expanded": H,
1419
+ "aria-pressed": Ie,
1420
+ onClick: (i) => H ? Ne(!0) : He(i.currentTarget),
1421
+ children: s
877
1422
  }
878
1423
  ) : null
879
1424
  ]
880
1425
  }
881
- ) : /* @__PURE__ */ k(
1426
+ ) : /* @__PURE__ */ _(
882
1427
  "button",
883
1428
  {
884
1429
  type: "button",
885
- className: p(
1430
+ className: h(
886
1431
  "p-date-range-picker__trigger",
887
- !ye && "p-date-range-picker__trigger--empty"
1432
+ !ue && "p-date-range-picker__trigger--empty",
1433
+ ue && "p-date-range-picker__trigger--filled",
1434
+ H && "p-date-range-picker__trigger--open"
888
1435
  ),
889
- disabled: _,
890
- "aria-controls": z,
891
- "aria-describedby": _e,
892
- "aria-expanded": T,
1436
+ disabled: $,
1437
+ "aria-controls": M,
1438
+ "aria-describedby": ye,
1439
+ "aria-expanded": H,
893
1440
  "aria-haspopup": "dialog",
894
- "aria-labelledby": A,
895
- onClick: (o) => T ? Q(!0) : Pe(o.currentTarget),
1441
+ "aria-label": `${e}: ${Te}`,
1442
+ onClick: (i) => H ? Ne(!0) : He(i.currentTarget),
896
1443
  children: [
897
- /* @__PURE__ */ a("span", { children: be }),
898
- /* @__PURE__ */ a("span", { className: "p-date-range-picker__trigger-icon", children: /* @__PURE__ */ a(Lt, {}) })
1444
+ /* @__PURE__ */ a(
1445
+ "span",
1446
+ {
1447
+ id: p,
1448
+ className: h(
1449
+ "p-date-range-picker__trigger-label p-date-range-picker__trigger-floating-label",
1450
+ u && "p-date-range-picker__trigger-label--error"
1451
+ ),
1452
+ "aria-hidden": "true",
1453
+ children: e
1454
+ }
1455
+ ),
1456
+ /* @__PURE__ */ a(
1457
+ "span",
1458
+ {
1459
+ className: h(
1460
+ "p-date-range-picker__trigger-label p-date-range-picker__trigger-placeholder-label",
1461
+ u && "p-date-range-picker__trigger-label--error"
1462
+ ),
1463
+ "aria-hidden": "true",
1464
+ children: e
1465
+ }
1466
+ ),
1467
+ /* @__PURE__ */ a("span", { className: "p-date-range-picker__trigger-value", children: Te }),
1468
+ /* @__PURE__ */ a("span", { className: "p-date-range-picker__trigger-icon", children: /* @__PURE__ */ a(qt, {}) })
899
1469
  ]
900
1470
  }
901
1471
  ),
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(
1472
+ /* @__PURE__ */ a("input", { type: "hidden", name: k, value: (Y == null ? void 0 : Y.start) ?? "", required: B }),
1473
+ /* @__PURE__ */ a("input", { type: "hidden", name: g, value: (Y == null ? void 0 : Y.end) ?? "", required: B }),
1474
+ H && /* @__PURE__ */ _(
905
1475
  "div",
906
1476
  {
907
- id: z,
1477
+ id: M,
908
1478
  className: "p-date-range-picker__panel",
909
1479
  role: "dialog",
910
- "aria-labelledby": `${z}-title`,
911
- onKeyDown: (o) => {
912
- o.key === "Escape" && Q();
1480
+ "aria-labelledby": `${M}-title`,
1481
+ onKeyDown: (i) => {
1482
+ i.key === "Escape" && Ne();
913
1483
  },
914
1484
  children: [
915
- /* @__PURE__ */ k("div", { className: "p-date-range-picker__calendar-header", children: [
1485
+ /* @__PURE__ */ _("div", { className: "p-date-range-picker__calendar-header", children: [
916
1486
  /* @__PURE__ */ a(
917
1487
  "button",
918
1488
  {
919
1489
  type: "button",
920
1490
  className: "p-date-range-picker__nav",
921
1491
  "aria-label": "Previous month",
922
- onClick: () => j((o) => Ye(o, -1)),
923
- children: /* @__PURE__ */ a(zt, {})
1492
+ disabled: je,
1493
+ onClick: () => Be(Me),
1494
+ children: /* @__PURE__ */ a(Pt, {})
924
1495
  }
925
1496
  ),
926
- /* @__PURE__ */ a("div", { id: `${z}-title`, className: "p-date-range-picker__month", children: St(J, x) }),
1497
+ /* @__PURE__ */ _("div", { className: "p-date-range-picker__month", children: [
1498
+ /* @__PURE__ */ a("span", { id: `${M}-title`, className: "p-date-range-picker__month-label", children: xa(q, A) }),
1499
+ /* @__PURE__ */ a(
1500
+ "select",
1501
+ {
1502
+ className: "p-date-range-picker__month-select p-date-range-picker__calendar-select",
1503
+ "aria-label": "Month",
1504
+ value: q.getMonth(),
1505
+ onChange: We,
1506
+ children: U.map((i) => /* @__PURE__ */ a(
1507
+ "option",
1508
+ {
1509
+ value: i.value,
1510
+ disabled: Nt(new Date(q.getFullYear(), i.value, 1), G, J),
1511
+ children: i.label
1512
+ },
1513
+ i.value
1514
+ ))
1515
+ }
1516
+ ),
1517
+ /* @__PURE__ */ a(
1518
+ "select",
1519
+ {
1520
+ className: "p-date-range-picker__year-select p-date-range-picker__calendar-select",
1521
+ "aria-label": "Year",
1522
+ value: q.getFullYear(),
1523
+ onChange: Je,
1524
+ children: Ze.map((i) => /* @__PURE__ */ a("option", { value: i, children: i }, i))
1525
+ }
1526
+ )
1527
+ ] }),
927
1528
  /* @__PURE__ */ a(
928
1529
  "button",
929
1530
  {
930
1531
  type: "button",
931
1532
  className: "p-date-range-picker__nav",
932
1533
  "aria-label": "Next month",
933
- onClick: () => j((o) => Ye(o, 1)),
934
- children: /* @__PURE__ */ a(Kt, {})
1534
+ disabled: ve,
1535
+ onClick: () => Be($e),
1536
+ children: /* @__PURE__ */ a(Ft, {})
935
1537
  }
936
1538
  )
937
1539
  ] }),
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);
1540
+ /* @__PURE__ */ a("div", { className: "p-date-range-picker__weekdays", "aria-hidden": "true", children: le.map((i) => /* @__PURE__ */ a("span", { children: i }, i)) }),
1541
+ /* @__PURE__ */ a("div", { className: "p-date-range-picker__grid", role: "grid", "aria-labelledby": `${M}-title`, children: Xe.map((i) => {
1542
+ const P = K(i), E = i.getMonth() !== q.getMonth(), Pe = rt(i, R), _e = rt(i, te), Ae = Ya(i, R, te), dt = rt(i, Z), ut = yt(i, G) || vt(i, J);
941
1543
  return /* @__PURE__ */ a(
942
1544
  "button",
943
1545
  {
944
- ref: (ct) => {
945
- xe.current[D] = ct;
1546
+ ref: (pt) => {
1547
+ Fe.current[P] = pt;
946
1548
  },
947
1549
  type: "button",
948
1550
  role: "gridcell",
949
- "data-date": D,
950
- className: p(
1551
+ "data-date": P,
1552
+ className: h(
951
1553
  "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"
1554
+ E && "p-date-range-picker__day--outside",
1555
+ dt && "p-date-range-picker__day--today",
1556
+ Ae && "p-date-range-picker__day--in-range",
1557
+ (Pe || _e) && "p-date-range-picker__day--selected"
956
1558
  ),
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()
1559
+ disabled: ut,
1560
+ "aria-label": $a(i, A),
1561
+ "aria-selected": Pe || _e,
1562
+ tabIndex: rt(i, De) ? 0 : -1,
1563
+ onClick: () => o(i),
1564
+ onKeyDown: ae(i),
1565
+ children: i.getDate()
964
1566
  },
965
- D
1567
+ P
966
1568
  );
967
1569
  }) })
968
1570
  ]
969
1571
  }
970
1572
  ),
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
1573
+ u && v ? /* @__PURE__ */ a("p", { id: W, role: "alert", className: "p-date-range-picker__message p-date-range-picker__message--error", children: v }) : null,
1574
+ !u && b ? /* @__PURE__ */ a("p", { id: x, className: "p-date-range-picker__message", children: b }) : null
973
1575
  ]
974
1576
  }
975
1577
  );
976
1578
  }
977
1579
  );
978
- jt.displayName = "PDateRangePicker";
979
- const Et = {
1580
+ Ta.displayName = "PDateRangePicker";
1581
+ const an = {
980
1582
  thisWeek: {
981
1583
  label: "This week",
982
1584
  value: () => {
983
- const e = O(), t = I(e, -e.getDay());
1585
+ const e = Ye(), t = ie(e, -e.getDay());
984
1586
  return {
985
- start: y(t),
986
- end: y(I(t, 6))
1587
+ start: K(t),
1588
+ end: K(ie(t, 6))
987
1589
  };
988
1590
  }
989
1591
  },
990
1592
  last7Days: {
991
1593
  label: "Last 7 days",
992
1594
  value: () => {
993
- const e = O();
1595
+ const e = Ye();
994
1596
  return {
995
- start: y(I(e, -6)),
996
- end: y(e)
1597
+ start: K(ie(e, -6)),
1598
+ end: K(e)
997
1599
  };
998
1600
  }
999
1601
  },
1000
1602
  last14Days: {
1001
1603
  label: "Last 14 days",
1002
1604
  value: () => {
1003
- const e = O();
1605
+ const e = Ye();
1004
1606
  return {
1005
- start: y(I(e, -13)),
1006
- end: y(e)
1607
+ start: K(ie(e, -13)),
1608
+ end: K(e)
1007
1609
  };
1008
1610
  }
1009
1611
  },
1010
1612
  last30Days: {
1011
1613
  label: "Last 30 days",
1012
1614
  value: () => {
1013
- const e = O();
1615
+ const e = Ye();
1014
1616
  return {
1015
- start: y(I(e, -29)),
1016
- end: y(e)
1617
+ start: K(ie(e, -29)),
1618
+ end: K(e)
1017
1619
  };
1018
1620
  }
1019
1621
  },
1020
1622
  thisMonth: {
1021
1623
  label: "This month",
1022
1624
  value: () => {
1023
- const e = O(), t = X(e), n = Je(e);
1625
+ const e = Ye(), t = se(e), n = Re(e);
1024
1626
  return {
1025
- start: y(t),
1026
- end: y(n)
1627
+ start: K(t),
1628
+ end: K(n)
1027
1629
  };
1028
1630
  }
1029
1631
  },
1030
1632
  lastMonth: {
1031
1633
  label: "Last month",
1032
1634
  value: () => {
1033
- const e = O(), t = Ye(e, -1);
1635
+ const e = Ye(), t = ot(e, -1);
1034
1636
  return {
1035
- start: y(X(t)),
1036
- end: y(Je(t))
1637
+ start: K(se(t)),
1638
+ end: K(Re(t))
1037
1639
  };
1038
1640
  }
1039
1641
  },
1040
1642
  monthToDate: {
1041
1643
  label: "Month to date",
1042
1644
  value: () => {
1043
- const e = O(), t = X(e);
1645
+ const e = Ye(), t = se(e);
1044
1646
  return {
1045
- start: y(t),
1046
- end: y(e)
1647
+ start: K(t),
1648
+ end: K(e)
1047
1649
  };
1048
1650
  }
1049
1651
  },
1050
1652
  yearToDate: {
1051
1653
  label: "Year to date",
1052
1654
  value: () => {
1053
- const e = O();
1655
+ const e = Ye();
1054
1656
  return {
1055
- start: y(new Date(e.getFullYear(), 0, 1)),
1056
- end: y(e)
1657
+ start: K(new Date(e.getFullYear(), 0, 1)),
1658
+ end: K(e)
1057
1659
  };
1058
1660
  }
1059
1661
  }
1060
- }, Wt = U(
1662
+ }, Ba = oe(
1061
1663
  ({
1062
1664
  as: e = "span",
1063
1665
  variant: t = "primary",
1064
1666
  appearance: n = "text",
1065
1667
  color: r,
1066
- textColor: s,
1067
- children: l,
1668
+ textColor: l,
1669
+ children: s,
1068
1670
  className: d,
1069
- style: f,
1070
- ...b
1071
- }, c) => {
1671
+ style: m,
1672
+ ...y
1673
+ }, b) => {
1072
1674
  const u = {
1073
- ...f,
1675
+ ...m,
1074
1676
  ...r ? { "--p-highlight-color": r, "--p-highlight-bg": r } : {},
1075
- ...s ? { "--p-highlight-text": s } : {}
1677
+ ...l ? { "--p-highlight-text": l } : {}
1076
1678
  };
1077
1679
  return /* @__PURE__ */ a(
1078
1680
  e,
1079
1681
  {
1080
- ...b,
1081
- ref: c,
1082
- className: p(
1682
+ ...y,
1683
+ ref: b,
1684
+ className: h(
1083
1685
  "p-highlight",
1084
1686
  `p-highlight--${t}`,
1085
1687
  n === "background" && "p-highlight--background",
1086
1688
  d
1087
1689
  ),
1088
1690
  style: u,
1089
- children: l
1691
+ children: s
1090
1692
  }
1091
1693
  );
1092
1694
  }
1093
1695
  );
1094
- Wt.displayName = "PHighlight";
1095
- const Ht = U(
1696
+ Ba.displayName = "PHighlight";
1697
+ const Aa = oe(
1096
1698
  ({
1097
1699
  children: e,
1098
1700
  ariaLabel: t = "Horizontal content",
1099
1701
  gap: n,
1100
1702
  snap: r = !0,
1101
- className: s,
1102
- scrollerClassName: l,
1703
+ className: l,
1704
+ scrollerClassName: s,
1103
1705
  listClassName: d,
1104
- itemClassName: f,
1105
- style: b,
1106
- ...c
1706
+ itemClassName: m,
1707
+ style: y,
1708
+ ...b
1107
1709
  }, u) => {
1108
- const h = {
1109
- ...b,
1710
+ const v = {
1711
+ ...y,
1110
1712
  ...n ? { "--p-horizontal-slider-gap": n } : {}
1111
1713
  };
1112
1714
  return /* @__PURE__ */ a(
1113
1715
  "div",
1114
1716
  {
1115
- ...c,
1717
+ ...b,
1116
1718
  ref: u,
1117
- className: p("p-horizontal-slider", !r && "p-horizontal-slider--no-snap", s),
1118
- style: h,
1719
+ className: h("p-horizontal-slider", !r && "p-horizontal-slider--no-snap", l),
1720
+ style: v,
1119
1721
  children: /* @__PURE__ */ a(
1120
1722
  "div",
1121
1723
  {
1122
1724
  "aria-label": t,
1123
- className: p("p-horizontal-slider__scroller", l),
1725
+ className: h("p-horizontal-slider__scroller", s),
1124
1726
  role: "region",
1125
1727
  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 })) })
1728
+ children: /* @__PURE__ */ a("ul", { className: h("p-horizontal-slider__list", d), children: Xt.map(e, (N) => /* @__PURE__ */ a("li", { className: h("p-horizontal-slider__item", m), children: N })) })
1127
1729
  }
1128
1730
  )
1129
1731
  }
1130
1732
  );
1131
1733
  }
1132
1734
  );
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 }) });
1735
+ Aa.displayName = "PHorizontalSlider";
1736
+ function Va() {
1737
+ return /* @__PURE__ */ a("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "m5 8 5 5 5-5" }) });
1738
+ }
1739
+ function Gt(e) {
1740
+ return Array.isArray(e) ? e[0] ?? "" : e ?? "";
1741
+ }
1742
+ const Ot = oe(
1743
+ ({
1744
+ className: e,
1745
+ selectClassName: t,
1746
+ label: n,
1747
+ options: r,
1748
+ placeholder: l = "Select an option",
1749
+ helperText: s,
1750
+ id: d,
1751
+ isError: m = !1,
1752
+ errorMessage: y,
1753
+ density: b = "standard",
1754
+ variant: u = "floating",
1755
+ hideLabel: v = !1,
1756
+ disabled: N,
1757
+ required: F,
1758
+ value: k,
1759
+ defaultValue: g,
1760
+ onChange: $,
1761
+ onValueChange: j,
1762
+ style: B,
1763
+ ...A
1764
+ }, I) => {
1765
+ const T = Oe(), V = d ?? T, S = `${V}-error`, z = `${V}-helper`, ee = k !== void 0, [O, X] = re(Gt(g)), M = Gt(ee ? k : O) !== "", x = [
1766
+ m && y ? S : null,
1767
+ !m && s ? z : null
1768
+ ].filter(Boolean).join(" ") || void 0, W = r.reduce(
1769
+ (w, D) => {
1770
+ const H = D.group ?? null, he = w.find((Y) => Y.group === H);
1771
+ return he ? (he.options.push(D), w) : (w.push({ group: H, options: [D] }), w);
1772
+ },
1773
+ []
1774
+ ), pe = (w) => {
1775
+ const { value: D } = w.currentTarget;
1776
+ ee || X(D), $ == null || $(w), j == null || j(
1777
+ D,
1778
+ r.find((H) => String(H.value) === D) ?? null
1779
+ );
1780
+ };
1781
+ return /* @__PURE__ */ _(
1782
+ "div",
1783
+ {
1784
+ className: h(
1785
+ "p-select",
1786
+ `p-select--${b}`,
1787
+ `p-select--${u}`,
1788
+ M && "p-select--filled",
1789
+ m && "p-select--error",
1790
+ N && "p-select--disabled",
1791
+ e
1792
+ ),
1793
+ style: B,
1794
+ children: [
1795
+ /* @__PURE__ */ _("div", { className: "p-select__field", children: [
1796
+ /* @__PURE__ */ _(
1797
+ "select",
1798
+ {
1799
+ ...A,
1800
+ id: V,
1801
+ ref: I,
1802
+ value: k,
1803
+ defaultValue: k === void 0 ? g ?? "" : void 0,
1804
+ disabled: N,
1805
+ required: F,
1806
+ "aria-invalid": m || void 0,
1807
+ "aria-describedby": x,
1808
+ "aria-required": F,
1809
+ "aria-disabled": N,
1810
+ className: h("p-select__control", m && "p-select__control--error", t),
1811
+ onChange: pe,
1812
+ children: [
1813
+ l ? /* @__PURE__ */ a("option", { value: "", disabled: F, "aria-label": l, children: "" }) : null,
1814
+ W.map(
1815
+ (w) => w.group ? /* @__PURE__ */ a("optgroup", { label: w.group, children: w.options.map((D) => /* @__PURE__ */ a("option", { value: D.value, disabled: D.disabled, children: D.label }, String(D.value))) }, w.group) : w.options.map((D) => /* @__PURE__ */ a("option", { value: D.value, disabled: D.disabled, children: D.label }, String(D.value)))
1816
+ )
1817
+ ]
1818
+ }
1819
+ ),
1820
+ u === "floating" ? /* @__PURE__ */ _(wt, { children: [
1821
+ /* @__PURE__ */ a(
1822
+ "span",
1823
+ {
1824
+ "aria-hidden": "true",
1825
+ className: h(
1826
+ "p-select__label p-select__floating-label",
1827
+ v && "p-select__label--hidden",
1828
+ m && "p-select__label--error"
1829
+ ),
1830
+ children: n
1831
+ }
1832
+ ),
1833
+ /* @__PURE__ */ a(
1834
+ "label",
1835
+ {
1836
+ htmlFor: V,
1837
+ className: h("p-select__label p-select__placeholder-label", v && "p-select__label--hidden"),
1838
+ children: l || n
1839
+ }
1840
+ )
1841
+ ] }) : /* @__PURE__ */ a(
1842
+ "label",
1843
+ {
1844
+ htmlFor: V,
1845
+ className: h("p-select__label p-select__inline-label", v && "p-select__label--hidden"),
1846
+ children: n
1847
+ }
1848
+ ),
1849
+ /* @__PURE__ */ a("span", { className: "p-select__chevron", "aria-hidden": "true", children: /* @__PURE__ */ a(Va, {}) })
1850
+ ] }),
1851
+ m && y ? /* @__PURE__ */ a("p", { id: S, role: "alert", className: "p-select__message p-select__message--error", children: y }) : null,
1852
+ !m && s ? /* @__PURE__ */ a("p", { id: z, className: "p-select__message", children: s }) : null
1853
+ ]
1854
+ }
1855
+ );
1856
+ }
1857
+ );
1858
+ Ot.displayName = "PSelect";
1859
+ function $t(e, t) {
1860
+ return Number.isFinite(e) ? t ? Math.min(Math.max(1, Math.trunc(e)), Math.max(1, t)) : Math.max(1, Math.trunc(e)) : 1;
1136
1861
  }
1137
- function Ot() {
1138
- return /* @__PURE__ */ k(
1862
+ function qe(e, t) {
1863
+ return Array.from({ length: t - e + 1 }, (n, r) => e + r);
1864
+ }
1865
+ function La(e, t, n, r) {
1866
+ const l = Math.max(1, t), s = $t(e, l), d = Math.max(0, Math.trunc(n)), m = Math.max(1, Math.trunc(r)), y = m * 2 + d * 2 + 3;
1867
+ if (l <= y)
1868
+ return qe(1, l);
1869
+ const b = y - m - 1, u = qe(1, m), v = qe(l - m + 1, l), N = b, F = l - b + 1;
1870
+ if (s <= N - d)
1871
+ return [...qe(1, N), "ellipsis", ...v];
1872
+ if (s >= F + d)
1873
+ return [...u, "ellipsis", ...qe(F, l)];
1874
+ const k = s - d, g = s + d;
1875
+ return [
1876
+ ...u,
1877
+ "ellipsis",
1878
+ ...qe(k, g),
1879
+ "ellipsis",
1880
+ ...v
1881
+ ];
1882
+ }
1883
+ function Ka(e, t, n, r, l) {
1884
+ if (n !== void 0 && r) {
1885
+ if (n <= 0)
1886
+ return `No ${l}`;
1887
+ const s = (e - 1) * r + 1, d = Math.min(n, e * r);
1888
+ return `Showing ${s}-${d} of ${n} ${l}`;
1889
+ }
1890
+ return t ? `Page ${e} of ${t}` : `Page ${e}`;
1891
+ }
1892
+ function Dt({
1893
+ className: e,
1894
+ children: t,
1895
+ ...n
1896
+ }) {
1897
+ return /* @__PURE__ */ a("button", { ...n, type: "button", className: h("p-pagination__button", e), children: t });
1898
+ }
1899
+ const ja = oe(
1900
+ ({
1901
+ page: e,
1902
+ pageCount: t,
1903
+ totalItems: n,
1904
+ pageSize: r,
1905
+ pageSizeOptions: l,
1906
+ itemLabel: s = "items",
1907
+ density: d = "standard",
1908
+ siblingCount: m = 1,
1909
+ boundaryCount: y = 1,
1910
+ disabled: b = !1,
1911
+ isLoading: u = !1,
1912
+ hasPreviousPage: v,
1913
+ hasNextPage: N,
1914
+ showRowsPerPage: F = !0,
1915
+ onPageChange: k,
1916
+ onPageSizeChange: g,
1917
+ className: $,
1918
+ summary: j,
1919
+ ...B
1920
+ }, A) => {
1921
+ const I = t ? Math.max(1, Math.trunc(t)) : void 0, T = $t(e, I), V = b || u, S = !V && !!k, z = S && (v ?? T > 1), ee = S && (N ?? (I ? T < I : !0)), O = I ? La(T, I, m, y) : [], X = !!(F && r && (l != null && l.length) && g), p = j ?? Ka(T, I, n, r, s), M = (x) => {
1922
+ if (V)
1923
+ return;
1924
+ const W = $t(x, I);
1925
+ W === T && I || k == null || k(W);
1926
+ };
1927
+ return /* @__PURE__ */ _(
1928
+ "nav",
1929
+ {
1930
+ ...B,
1931
+ ref: A,
1932
+ className: h(
1933
+ "p-pagination",
1934
+ `p-pagination--${d}`,
1935
+ u && "p-pagination--loading",
1936
+ $
1937
+ ),
1938
+ "aria-label": B["aria-label"] ?? "Pagination",
1939
+ "aria-busy": u || void 0,
1940
+ children: [
1941
+ /* @__PURE__ */ a("div", { className: "p-pagination__summary", "aria-live": "polite", children: p }),
1942
+ /* @__PURE__ */ _("div", { className: "p-pagination__controls", children: [
1943
+ /* @__PURE__ */ _(
1944
+ Dt,
1945
+ {
1946
+ className: "p-pagination__button--previous",
1947
+ disabled: !z,
1948
+ "aria-label": "Go to previous page",
1949
+ onClick: () => M(T - 1),
1950
+ children: [
1951
+ /* @__PURE__ */ a(Pt, {}),
1952
+ /* @__PURE__ */ a("span", { children: "Previous" })
1953
+ ]
1954
+ }
1955
+ ),
1956
+ I ? /* @__PURE__ */ a("div", { className: "p-pagination__pages", "aria-label": "Pages", children: O.map(
1957
+ (x, W) => x === "ellipsis" ? /* @__PURE__ */ a("span", { className: "p-pagination__ellipsis", "aria-hidden": "true", children: "..." }, `ellipsis-${W}`) : /* @__PURE__ */ a(
1958
+ Dt,
1959
+ {
1960
+ className: h("p-pagination__page", x === T && "p-pagination__page--current"),
1961
+ "aria-label": `Go to page ${x}`,
1962
+ "aria-current": x === T ? "page" : void 0,
1963
+ disabled: !S || x === T,
1964
+ onClick: () => M(x),
1965
+ children: x
1966
+ },
1967
+ x
1968
+ )
1969
+ ) }) : /* @__PURE__ */ _("div", { className: "p-pagination__cursor-page", "aria-live": "polite", children: [
1970
+ "Page ",
1971
+ T
1972
+ ] }),
1973
+ /* @__PURE__ */ _(
1974
+ Dt,
1975
+ {
1976
+ className: "p-pagination__button--next",
1977
+ disabled: !ee,
1978
+ "aria-label": "Go to next page",
1979
+ onClick: () => M(T + 1),
1980
+ children: [
1981
+ /* @__PURE__ */ a("span", { children: "Next" }),
1982
+ /* @__PURE__ */ a(Ft, {})
1983
+ ]
1984
+ }
1985
+ )
1986
+ ] }),
1987
+ X ? /* @__PURE__ */ a(
1988
+ Ot,
1989
+ {
1990
+ className: "p-pagination__page-size",
1991
+ label: "Rows per page",
1992
+ placeholder: "",
1993
+ density: "compact",
1994
+ variant: "inline",
1995
+ hideLabel: !0,
1996
+ value: r,
1997
+ disabled: V,
1998
+ options: (l == null ? void 0 : l.map((x) => ({ value: x, label: `${x} / page` }))) ?? [],
1999
+ onValueChange: (x) => g == null ? void 0 : g(Number(x))
2000
+ }
2001
+ ) : null
2002
+ ]
2003
+ }
2004
+ );
2005
+ }
2006
+ );
2007
+ ja.displayName = "PPagination";
2008
+ function Wt(e) {
2009
+ return e.label ? e.label : e.mobileLabel ? e.mobileLabel : typeof e.header == "string" ? e.header : e.id;
2010
+ }
2011
+ function xt(e, t, n) {
2012
+ return t.cell ? t.cell(e, n) : typeof t.accessor == "function" ? t.accessor(e) : t.accessor ? e[t.accessor] : null;
2013
+ }
2014
+ function Ha(e) {
2015
+ return e === "ascending" ? "descending" : "ascending";
2016
+ }
2017
+ function Ga(e) {
2018
+ return !!(e && typeof e == "object" && "closest" in e && typeof e.closest == "function");
2019
+ }
2020
+ function Wa(e) {
2021
+ return !!(e && typeof e == "object" && "contains" in e && typeof e.contains == "function");
2022
+ }
2023
+ function Ut(e, t) {
2024
+ if (!Wa(t) || !Ga(e))
2025
+ return !1;
2026
+ const n = e.closest(
2027
+ [
2028
+ "a",
2029
+ "button",
2030
+ "input",
2031
+ "select",
2032
+ "textarea",
2033
+ "summary",
2034
+ '[contenteditable="true"]',
2035
+ '[role="button"]',
2036
+ '[role="link"]',
2037
+ '[role="menuitem"]',
2038
+ "[data-p-table-ignore-row-click]"
2039
+ ].join(",")
2040
+ );
2041
+ return !!(n && n !== t && t.contains(n));
2042
+ }
2043
+ function Ua({
2044
+ columns: e,
2045
+ rows: t,
2046
+ caption: n,
2047
+ captionHidden: r = !1,
2048
+ summary: l,
2049
+ density: s = "standard",
2050
+ stickyHeader: d = !0,
2051
+ stickyFirstColumn: m = !0,
2052
+ isLoading: y = !1,
2053
+ loadingLabel: b = "Loading table data...",
2054
+ emptyState: u = {
2055
+ title: "No records found",
2056
+ description: "Try adjusting the filters or checking back later."
2057
+ },
2058
+ errorState: v,
2059
+ getRowId: N,
2060
+ getRowTone: F,
2061
+ onRowClick: k,
2062
+ renderRowActions: g,
2063
+ onSortChange: $,
2064
+ className: j,
2065
+ tableClassName: B,
2066
+ ...A
2067
+ }, I) {
2068
+ const T = t.length > 0, V = !!g, S = v ?? (!y && !T ? u : null), z = e.filter((p) => !p.hideOnMobile), ee = e.length + (V ? 1 : 0), O = (p, M, x) => {
2069
+ Ut(x.target, x.currentTarget) || k == null || k(p, M, x);
2070
+ }, X = (p, M, x) => {
2071
+ Ut(x.target, x.currentTarget) || x.key !== "Enter" && x.key !== " " || (x.preventDefault(), k == null || k(p, M, x));
2072
+ };
2073
+ return /* @__PURE__ */ _(
2074
+ "div",
2075
+ {
2076
+ ...A,
2077
+ ref: I,
2078
+ className: h(
2079
+ "p-table",
2080
+ `p-table--${s}`,
2081
+ d && "p-table--sticky-header",
2082
+ m && "p-table--sticky-first-column",
2083
+ k && "p-table--interactive",
2084
+ j
2085
+ ),
2086
+ children: [
2087
+ /* @__PURE__ */ a("div", { className: "p-table__header", children: /* @__PURE__ */ _("div", { className: "p-table__header-copy", children: [
2088
+ /* @__PURE__ */ a("h3", { className: h("p-table__caption", r && "p-table__caption--hidden"), children: n }),
2089
+ l ? /* @__PURE__ */ a("div", { className: "p-table__summary", children: l }) : null
2090
+ ] }) }),
2091
+ /* @__PURE__ */ a("div", { className: "p-table__viewport", children: /* @__PURE__ */ _("table", { className: h("p-table__table", B), children: [
2092
+ /* @__PURE__ */ a("caption", { className: "p-table__native-caption", children: n }),
2093
+ /* @__PURE__ */ _("colgroup", { children: [
2094
+ e.map((p) => /* @__PURE__ */ a(
2095
+ "col",
2096
+ {
2097
+ className: h(
2098
+ "p-table__col",
2099
+ p.priority && `p-table__col--priority-${p.priority}`,
2100
+ p.hideOnTablet && "p-table__col--hide-tablet",
2101
+ p.hideOnMobile && "p-table__col--hide-mobile"
2102
+ ),
2103
+ style: p.width ? { width: p.width } : void 0
2104
+ },
2105
+ p.id
2106
+ )),
2107
+ V ? /* @__PURE__ */ a("col", { className: "p-table__actions-col" }) : null
2108
+ ] }),
2109
+ /* @__PURE__ */ a("thead", { className: "p-table__head", children: /* @__PURE__ */ _("tr", { children: [
2110
+ e.map((p) => {
2111
+ const M = Ha(p.sortDirection), x = p.sortDirection ?? (p.sortable ? "none" : void 0);
2112
+ return /* @__PURE__ */ a(
2113
+ "th",
2114
+ {
2115
+ scope: "col",
2116
+ "aria-sort": x,
2117
+ className: h(
2118
+ "p-table__cell p-table__head-cell",
2119
+ p.align && `p-table__cell--${p.align}`,
2120
+ p.priority && `p-table__cell--priority-${p.priority}`,
2121
+ p.hideOnTablet && "p-table__cell--hide-tablet",
2122
+ p.hideOnMobile && "p-table__cell--hide-mobile"
2123
+ ),
2124
+ children: p.sortable ? /* @__PURE__ */ _(
2125
+ "button",
2126
+ {
2127
+ type: "button",
2128
+ className: "p-table__sort-button",
2129
+ "aria-label": `Sort by ${Wt(p)}`,
2130
+ onClick: () => $ == null ? void 0 : $(p.id, M),
2131
+ children: [
2132
+ /* @__PURE__ */ a("span", { children: p.header }),
2133
+ /* @__PURE__ */ a(
2134
+ "span",
2135
+ {
2136
+ className: h(
2137
+ "p-table__sort-mark",
2138
+ p.sortDirection && `p-table__sort-mark--${p.sortDirection}`
2139
+ ),
2140
+ "aria-hidden": "true"
2141
+ }
2142
+ )
2143
+ ]
2144
+ }
2145
+ ) : p.header
2146
+ },
2147
+ p.id
2148
+ );
2149
+ }),
2150
+ V ? /* @__PURE__ */ a("th", { scope: "col", className: "p-table__cell p-table__head-cell p-table__actions-head", children: /* @__PURE__ */ a("span", { className: "p-table__sr-only", children: "Actions" }) }) : null
2151
+ ] }) }),
2152
+ /* @__PURE__ */ a("tbody", { className: "p-table__body", children: y ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ _("td", { className: "p-table__state-cell", colSpan: ee, children: [
2153
+ /* @__PURE__ */ a("span", { className: "p-table__loading-mark", "aria-hidden": "true" }),
2154
+ /* @__PURE__ */ a("span", { children: b })
2155
+ ] }) }) : S ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { className: "p-table__state-cell", colSpan: ee, children: /* @__PURE__ */ _("div", { className: h("p-table__state", S.tone && `p-table__state--${S.tone}`), children: [
2156
+ /* @__PURE__ */ a("strong", { children: S.title }),
2157
+ S.description ? /* @__PURE__ */ a("span", { children: S.description }) : null,
2158
+ S.action ? /* @__PURE__ */ a("div", { className: "p-table__state-action", children: S.action }) : null
2159
+ ] }) }) }) : t.map((p, M) => {
2160
+ const x = (N == null ? void 0 : N(p, M)) ?? String(M), W = F == null ? void 0 : F(p, M), pe = e.map((w) => /* @__PURE__ */ a(
2161
+ "td",
2162
+ {
2163
+ className: h(
2164
+ "p-table__cell p-table__body-cell",
2165
+ w.align && `p-table__cell--${w.align}`,
2166
+ w.priority && `p-table__cell--priority-${w.priority}`,
2167
+ w.hideOnTablet && "p-table__cell--hide-tablet",
2168
+ w.hideOnMobile && "p-table__cell--hide-mobile"
2169
+ ),
2170
+ children: xt(p, w, M)
2171
+ },
2172
+ w.id
2173
+ ));
2174
+ return /* @__PURE__ */ _(
2175
+ "tr",
2176
+ {
2177
+ className: h("p-table__row", W && `p-table__row--${W}`),
2178
+ tabIndex: k ? 0 : void 0,
2179
+ onClick: k ? (w) => O(p, M, w) : void 0,
2180
+ onKeyDown: k ? (w) => X(p, M, w) : void 0,
2181
+ children: [
2182
+ pe,
2183
+ V ? /* @__PURE__ */ a("td", { className: "p-table__cell p-table__body-cell p-table__actions-cell", children: g == null ? void 0 : g(p, M) }) : null
2184
+ ]
2185
+ },
2186
+ x
2187
+ );
2188
+ }) })
2189
+ ] }) }),
2190
+ /* @__PURE__ */ a("ul", { className: "p-table__mobile-list", "aria-label": `${n} rows`, children: y ? /* @__PURE__ */ _("li", { className: "p-table__mobile-state", children: [
2191
+ /* @__PURE__ */ a("span", { className: "p-table__loading-mark", "aria-hidden": "true" }),
2192
+ /* @__PURE__ */ a("span", { children: b })
2193
+ ] }) : S ? /* @__PURE__ */ a("li", { className: "p-table__mobile-state", children: /* @__PURE__ */ _("div", { className: h("p-table__state", S.tone && `p-table__state--${S.tone}`), children: [
2194
+ /* @__PURE__ */ a("strong", { children: S.title }),
2195
+ S.description ? /* @__PURE__ */ a("span", { children: S.description }) : null,
2196
+ S.action ? /* @__PURE__ */ a("div", { className: "p-table__state-action", children: S.action }) : null
2197
+ ] }) }) : t.map((p, M) => {
2198
+ const x = (N == null ? void 0 : N(p, M)) ?? String(M), W = z.find((D) => D.priority === "primary") ?? z[0], pe = z.filter((D) => D.id !== (W == null ? void 0 : W.id)), w = F == null ? void 0 : F(p, M);
2199
+ return /* @__PURE__ */ _(
2200
+ "li",
2201
+ {
2202
+ className: h("p-table__mobile-row", w && `p-table__mobile-row--${w}`),
2203
+ role: k ? "button" : void 0,
2204
+ tabIndex: k ? 0 : void 0,
2205
+ onClick: k ? (D) => O(p, M, D) : void 0,
2206
+ onKeyDown: k ? (D) => X(p, M, D) : void 0,
2207
+ children: [
2208
+ W ? /* @__PURE__ */ a("div", { className: "p-table__mobile-title", children: xt(p, W, M) }) : null,
2209
+ /* @__PURE__ */ a("dl", { className: "p-table__mobile-fields", children: pe.map((D) => /* @__PURE__ */ _("div", { className: "p-table__mobile-field", children: [
2210
+ /* @__PURE__ */ a("dt", { children: Wt(D) }),
2211
+ /* @__PURE__ */ a("dd", { children: xt(p, D, M) })
2212
+ ] }, D.id)) }),
2213
+ V ? /* @__PURE__ */ a("div", { className: "p-table__mobile-actions", children: g == null ? void 0 : g(p, M) }) : null
2214
+ ]
2215
+ },
2216
+ x
2217
+ );
2218
+ }) })
2219
+ ]
2220
+ }
2221
+ );
2222
+ }
2223
+ const qa = oe(Ua);
2224
+ qa.displayName = "PTable";
2225
+ function nn({
2226
+ title: e,
2227
+ index: t = "01",
2228
+ variant: n = "default",
2229
+ className: r
2230
+ }) {
2231
+ return n === "indexed" ? /* @__PURE__ */ _(
2232
+ "div",
2233
+ {
2234
+ className: h("p-section-header p-section-header--indexed", r),
2235
+ children: [
2236
+ /* @__PURE__ */ a(
2237
+ Ke,
2238
+ {
2239
+ as: "span",
2240
+ className: "p-section-header__mark",
2241
+ variant: "body",
2242
+ "aria-hidden": "true",
2243
+ children: "—"
2244
+ }
2245
+ ),
2246
+ /* @__PURE__ */ a(
2247
+ Ke,
2248
+ {
2249
+ as: "span",
2250
+ className: "p-section-header__index",
2251
+ variant: "body",
2252
+ children: t
2253
+ }
2254
+ ),
2255
+ /* @__PURE__ */ a(
2256
+ Ke,
2257
+ {
2258
+ as: "span",
2259
+ className: "p-section-header__divider",
2260
+ variant: "body",
2261
+ "aria-hidden": "true",
2262
+ children: "\\"
2263
+ }
2264
+ ),
2265
+ /* @__PURE__ */ a(Ke, { as: "h2", className: "p-section-header__title", variant: "body", children: e })
2266
+ ]
2267
+ }
2268
+ ) : /* @__PURE__ */ a(
2269
+ Zt,
2270
+ {
2271
+ className: h("p-section-header p-section-header--default", r),
2272
+ children: /* @__PURE__ */ a(Ke, { className: "p-section-header__title", variant: "body-wide", children: e })
2273
+ }
2274
+ );
2275
+ }
2276
+ function za() {
2277
+ return /* @__PURE__ */ _(
1139
2278
  "svg",
1140
2279
  {
1141
2280
  xmlns: "http://www.w3.org/2000/svg",
@@ -1155,8 +2294,8 @@ function Ot() {
1155
2294
  }
1156
2295
  );
1157
2296
  }
1158
- function Vt() {
1159
- return /* @__PURE__ */ k(
2297
+ function Ra() {
2298
+ return /* @__PURE__ */ _(
1160
2299
  "svg",
1161
2300
  {
1162
2301
  xmlns: "http://www.w3.org/2000/svg",
@@ -1178,144 +2317,146 @@ function Vt() {
1178
2317
  }
1179
2318
  );
1180
2319
  }
1181
- const Ut = U(
2320
+ const Oa = oe(
1182
2321
  ({
1183
2322
  className: e,
1184
2323
  inputClassName: t,
1185
2324
  type: n,
1186
2325
  label: r,
1187
- helperText: s,
1188
- id: l,
2326
+ helperText: l,
2327
+ id: s,
1189
2328
  isError: d = !1,
1190
- errorMessage: f,
1191
- rightAdornment: b,
1192
- disabled: c,
2329
+ errorMessage: m,
2330
+ rightAdornment: y,
2331
+ disabled: b,
1193
2332
  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
2333
+ style: v,
2334
+ ...N
2335
+ }, F) => {
2336
+ const k = Oe(), g = s ?? k, $ = `${g}-error`, j = `${g}-helper`, B = n === "password", A = !!y && !B, [I, T] = re(!1), V = B ? I ? "text" : "password" : n ?? "text", S = [
2337
+ d && m ? $ : null,
2338
+ !d && l ? j : null
1200
2339
  ].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(
2340
+ return /* @__PURE__ */ _("div", { className: h("p-text-input", e), style: v, children: [
2341
+ /* @__PURE__ */ _("div", { className: "p-text-input__field", children: [
2342
+ /* @__PURE__ */ a(
2343
+ "input",
2344
+ {
2345
+ ...N,
2346
+ id: g,
2347
+ ref: F,
2348
+ type: V,
2349
+ disabled: b,
2350
+ readOnly: u,
2351
+ placeholder: " ",
2352
+ "aria-invalid": d || void 0,
2353
+ "aria-describedby": S,
2354
+ "aria-required": N.required,
2355
+ "aria-disabled": b,
2356
+ "aria-readonly": u,
2357
+ autoComplete: N.autoComplete ?? (B ? "current-password" : void 0),
2358
+ className: h(
2359
+ "p-text-input__control",
2360
+ (B || A) && "p-text-input__control--adorned",
2361
+ d && "p-text-input__control--error",
2362
+ A && n === "date" && "p-text-input__control--date-adorned",
2363
+ t
2364
+ )
2365
+ }
2366
+ ),
2367
+ /* @__PURE__ */ a(
2368
+ "span",
2369
+ {
2370
+ "aria-hidden": "true",
2371
+ className: h(
2372
+ "p-text-input__label p-text-input__floating-label",
2373
+ d && "p-text-input__label--error"
2374
+ ),
2375
+ children: r
2376
+ }
2377
+ ),
2378
+ /* @__PURE__ */ a(
2379
+ "label",
2380
+ {
2381
+ htmlFor: g,
2382
+ className: "p-text-input__label p-text-input__placeholder-label",
2383
+ children: r
2384
+ }
2385
+ ),
2386
+ B && /* @__PURE__ */ a(
2387
+ "button",
2388
+ {
2389
+ type: "button",
2390
+ onClick: () => T((z) => !z),
2391
+ disabled: b,
2392
+ className: "p-text-input__action",
2393
+ "aria-label": I ? "Hide password" : "Show password",
2394
+ "aria-pressed": I,
2395
+ "aria-controls": g,
2396
+ children: I ? /* @__PURE__ */ a(za, {}) : /* @__PURE__ */ a(Ra, {})
2397
+ }
2398
+ ),
2399
+ A && /* @__PURE__ */ a("span", { "aria-hidden": "true", className: "p-text-input__adornment", children: y })
2400
+ ] }),
2401
+ d && m && /* @__PURE__ */ a(
1261
2402
  "p",
1262
2403
  {
1263
- id: _,
2404
+ id: $,
1264
2405
  role: "alert",
1265
2406
  className: "p-text-input__message p-text-input__message--error",
1266
- children: f
2407
+ children: m
1267
2408
  }
1268
2409
  ),
1269
- !d && s && /* @__PURE__ */ a(
2410
+ !d && l && /* @__PURE__ */ a(
1270
2411
  "p",
1271
2412
  {
1272
- id: $,
2413
+ id: j,
1273
2414
  className: "p-text-input__message p-text-input__message--helper",
1274
- children: s
2415
+ children: l
1275
2416
  }
1276
2417
  )
1277
2418
  ] });
1278
2419
  }
1279
2420
  );
1280
- Ut.displayName = "PTextInput";
1281
- const qt = U(
2421
+ Oa.displayName = "PTextInput";
2422
+ const Xa = oe(
1282
2423
  ({
1283
2424
  className: e,
1284
2425
  textareaClassName: t,
1285
2426
  label: n,
1286
2427
  helperText: r,
1287
- id: s,
1288
- isError: l = !1,
2428
+ id: l,
2429
+ isError: s = !1,
1289
2430
  errorMessage: d,
1290
- disabled: f,
1291
- readOnly: b,
1292
- rows: c = 4,
2431
+ disabled: m,
2432
+ readOnly: y,
2433
+ rows: b = 4,
1293
2434
  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
2435
+ ...v
2436
+ }, N) => {
2437
+ const F = Oe(), k = l ?? F, g = `${k}-error`, $ = `${k}-helper`, j = [
2438
+ s && d ? g : null,
2439
+ !s && r ? $ : null
1299
2440
  ].filter(Boolean).join(" ") || void 0;
1300
- return /* @__PURE__ */ k("div", { className: p("p-text-area", e), style: u, children: [
2441
+ return /* @__PURE__ */ _("div", { className: h("p-text-area", e), style: u, children: [
1301
2442
  /* @__PURE__ */ a(
1302
2443
  "textarea",
1303
2444
  {
1304
- ...h,
1305
- id: M,
1306
- ref: v,
1307
- rows: c,
1308
- disabled: f,
1309
- readOnly: b,
2445
+ ...v,
2446
+ id: k,
2447
+ ref: N,
2448
+ rows: b,
2449
+ disabled: m,
2450
+ readOnly: y,
1310
2451
  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(
2452
+ "aria-invalid": s || void 0,
2453
+ "aria-describedby": j,
2454
+ "aria-required": v.required,
2455
+ "aria-disabled": m,
2456
+ "aria-readonly": y,
2457
+ className: h(
1317
2458
  "p-text-area__control",
1318
- l && "p-text-area__control--error",
2459
+ s && "p-text-area__control--error",
1319
2460
  t
1320
2461
  )
1321
2462
  }
@@ -1324,9 +2465,9 @@ const qt = U(
1324
2465
  "span",
1325
2466
  {
1326
2467
  "aria-hidden": "true",
1327
- className: p(
2468
+ className: h(
1328
2469
  "p-text-area__label p-text-area__floating-label",
1329
- l && "p-text-area__label--error"
2470
+ s && "p-text-area__label--error"
1330
2471
  ),
1331
2472
  children: n
1332
2473
  }
@@ -1334,24 +2475,24 @@ const qt = U(
1334
2475
  /* @__PURE__ */ a(
1335
2476
  "label",
1336
2477
  {
1337
- htmlFor: M,
2478
+ htmlFor: k,
1338
2479
  className: "p-text-area__label p-text-area__placeholder-label",
1339
2480
  children: n
1340
2481
  }
1341
2482
  ),
1342
- l && d && /* @__PURE__ */ a(
2483
+ s && d && /* @__PURE__ */ a(
1343
2484
  "p",
1344
2485
  {
1345
- id: m,
2486
+ id: g,
1346
2487
  role: "alert",
1347
2488
  className: "p-text-area__message p-text-area__message--error",
1348
2489
  children: d
1349
2490
  }
1350
2491
  ),
1351
- !l && r && /* @__PURE__ */ a(
2492
+ !s && r && /* @__PURE__ */ a(
1352
2493
  "p",
1353
2494
  {
1354
- id: _,
2495
+ id: $,
1355
2496
  className: "p-text-area__message p-text-area__message--helper",
1356
2497
  children: r
1357
2498
  }
@@ -1359,22 +2500,27 @@ const qt = U(
1359
2500
  ] });
1360
2501
  }
1361
2502
  );
1362
- qt.displayName = "PTextArea";
2503
+ Xa.displayName = "PTextArea";
1363
2504
  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
2505
+ Jt as PBadge,
2506
+ Qt as PButton,
2507
+ na as PCard,
2508
+ ia as PCardGrid,
2509
+ da as PCombobox,
2510
+ Na as PDatePicker,
2511
+ tn as PDatePickerPresets,
2512
+ Ta as PDateRangePicker,
2513
+ an as PDateRangePickerPresets,
2514
+ Ba as PHighlight,
2515
+ Aa as PHorizontalSlider,
2516
+ ja as PPagination,
2517
+ nn as PSectionHeader,
2518
+ Ot as PSelect,
2519
+ qa as PTable,
2520
+ Xa as PTextArea,
2521
+ Oa as PTextInput,
2522
+ Ke as PTypography,
2523
+ en as Row,
2524
+ Zt as Stack
1379
2525
  };
1380
2526
  //# sourceMappingURL=index.es.js.map