@paolojulian.dev/design-system 4.3.0 → 4.4.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,122 +1,1144 @@
1
- import { jsx as r, jsxs as k } from "react/jsx-runtime";
2
- import { cn as c } from "./utils.es.js";
3
- import { forwardRef as j, useId as C, useState as L } from "react";
4
- const G = ({
5
- children: t,
6
- gap: n = void 0,
7
- alignItems: e = void 0,
8
- justifyContent: a = void 0,
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 = ({
5
+ children: e,
6
+ gap: t = void 0,
7
+ alignItems: n = void 0,
8
+ justifyContent: r = void 0,
9
9
  className: s = ""
10
- }) => /* @__PURE__ */ r(
10
+ }) => /* @__PURE__ */ a(
11
11
  "div",
12
12
  {
13
- className: c("flex flex-row", s),
13
+ className: p("flex flex-row", s),
14
14
  style: {
15
- gap: n,
16
- alignItems: e,
17
- justifyContent: a
15
+ gap: t,
16
+ alignItems: n,
17
+ justifyContent: r
18
18
  },
19
- children: t
19
+ children: e
20
20
  }
21
- ), T = ({
22
- children: t,
23
- gap: n = void 0,
24
- alignItems: e = void 0,
25
- justifyContent: a = void 0,
21
+ ), ut = ({
22
+ children: e,
23
+ gap: t = void 0,
24
+ alignItems: n = void 0,
25
+ justifyContent: r = void 0,
26
26
  className: s = ""
27
- }) => /* @__PURE__ */ r(
27
+ }) => /* @__PURE__ */ a(
28
28
  "div",
29
29
  {
30
- className: c("flex flex-col", s),
30
+ className: p("flex flex-col", s),
31
31
  style: {
32
- gap: n,
33
- alignItems: e,
34
- justifyContent: a
32
+ gap: t,
33
+ alignItems: n,
34
+ justifyContent: r
35
35
  },
36
- children: t
36
+ children: e
37
+ }
38
+ ), pt = U(
39
+ ({
40
+ as: e = "span",
41
+ variant: t = "neutral",
42
+ size: n = "sm",
43
+ appearance: r = "subtle",
44
+ leftIcon: s,
45
+ rightIcon: l,
46
+ children: d,
47
+ className: f,
48
+ ...b
49
+ }, c) => /* @__PURE__ */ k(
50
+ e,
51
+ {
52
+ ...b,
53
+ ref: c,
54
+ className: p(
55
+ "p-badge",
56
+ `p-badge--${t}`,
57
+ `p-badge--${n}`,
58
+ `p-badge--${r}`,
59
+ f
60
+ ),
61
+ children: [
62
+ s && /* @__PURE__ */ a("span", { className: "p-badge__icon", "aria-hidden": "true", children: s }),
63
+ /* @__PURE__ */ a("span", { className: "p-badge__label", children: d }),
64
+ l && /* @__PURE__ */ a("span", { className: "p-badge__icon", "aria-hidden": "true", children: l })
65
+ ]
66
+ }
67
+ )
68
+ );
69
+ pt.displayName = "PBadge";
70
+ const ht = U(
71
+ ({
72
+ variant: e = "primary",
73
+ size: t = "md",
74
+ fullWidth: n = !1,
75
+ isActive: r = !1,
76
+ isLoading: s = !1,
77
+ leftIcon: l,
78
+ rightIcon: d,
79
+ children: f,
80
+ className: b,
81
+ ...c
82
+ }, u) => {
83
+ const h = !!("disabled" in c && c.disabled || s), v = p(
84
+ "p-button",
85
+ `p-button--${e}`,
86
+ `p-button--${t}`,
87
+ n && "p-button--full-width",
88
+ r && "p-button--active",
89
+ b
90
+ ), C = /* @__PURE__ */ k(nt, { children: [
91
+ s ? /* @__PURE__ */ a("span", { className: "p-button__spinner", "aria-hidden": "true" }) : l && /* @__PURE__ */ a("span", { className: "p-button__icon", "aria-hidden": "true", children: l }),
92
+ /* @__PURE__ */ a("span", { className: "p-button__label", children: f }),
93
+ !s && d && /* @__PURE__ */ a("span", { className: "p-button__icon", "aria-hidden": "true", children: d })
94
+ ] });
95
+ if ("href" in c && typeof c.href == "string") {
96
+ const { disabled: $, onClick: w, ...x } = c, P = (q) => {
97
+ if (h) {
98
+ q.preventDefault();
99
+ return;
100
+ }
101
+ w == null || w(q);
102
+ };
103
+ return /* @__PURE__ */ a(
104
+ "a",
105
+ {
106
+ ...x,
107
+ ref: u,
108
+ className: v,
109
+ "aria-disabled": h || void 0,
110
+ "aria-busy": s || void 0,
111
+ "data-active": r || void 0,
112
+ "data-disabled": $ || void 0,
113
+ tabIndex: h ? -1 : x.tabIndex,
114
+ onClick: P,
115
+ children: C
116
+ }
117
+ );
118
+ }
119
+ const { type: M = "button", disabled: m, ..._ } = c;
120
+ return /* @__PURE__ */ a(
121
+ "button",
122
+ {
123
+ ..._,
124
+ ref: u,
125
+ type: M,
126
+ disabled: !!(m || s),
127
+ className: v,
128
+ "aria-busy": s || void 0,
129
+ "data-active": r || void 0,
130
+ children: C
131
+ }
132
+ );
37
133
  }
38
134
  );
39
- function V(t) {
40
- var n, e, a = "";
41
- if (typeof t == "string" || typeof t == "number") a += t;
42
- else if (typeof t == "object") if (Array.isArray(t)) for (n = 0; n < t.length; n++) t[n] && (e = V(t[n])) && (a && (a += " "), a += e);
43
- else for (n in t) t[n] && (a && (a += " "), a += n);
44
- return a;
45
- }
46
- function $() {
47
- for (var t, n, e = 0, a = ""; e < arguments.length; ) (t = arguments[e++]) && (n = V(t)) && (a && (a += " "), a += n);
48
- return a;
49
- }
50
- const I = (t) => typeof t == "boolean" ? "".concat(t) : t === 0 ? "0" : t, P = $, O = (t, n) => (e) => {
51
- var a;
52
- if ((n == null ? void 0 : n.variants) == null) return P(t, e == null ? void 0 : e.class, e == null ? void 0 : e.className);
53
- const { variants: s, defaultVariants: i } = n, l = Object.keys(s).map((o) => {
54
- const u = e == null ? void 0 : e[o], x = i == null ? void 0 : i[o];
135
+ ht.displayName = "PButton";
136
+ function it(e) {
137
+ var t, n, r = "";
138
+ if (typeof e == "string" || typeof e == "number") r += e;
139
+ else if (typeof e == "object") if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (n = it(e[t])) && (r && (r += " "), r += n);
140
+ else for (t in e) e[t] && (r && (r += " "), r += t);
141
+ return r;
142
+ }
143
+ function mt() {
144
+ for (var e, t, n = 0, r = ""; n < arguments.length; ) (e = arguments[n++]) && (t = it(e)) && (r && (r += " "), r += t);
145
+ return r;
146
+ }
147
+ const Qe = (e) => typeof e == "boolean" ? "".concat(e) : e === 0 ? "0" : e, Xe = mt, gt = (e, t) => (n) => {
148
+ 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];
55
152
  if (u === null) return null;
56
- const d = I(u) || I(x);
57
- return s[o][d];
58
- }), f = e && Object.entries(e).reduce((o, u) => {
59
- let [x, d] = u;
60
- return d === void 0 || (o[x] = d), o;
61
- }, {}), b = n == null || (a = n.compoundVariants) === null || a === void 0 ? void 0 : a.reduce((o, u) => {
62
- let { class: x, className: d, ...v } = u;
63
- return Object.entries(v).every((h) => {
64
- let [p, m] = h;
65
- return Array.isArray(m) ? m.includes({
66
- ...i,
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,
67
164
  ...f
68
- }[p]) : {
69
- ...i,
165
+ }[m]) : {
166
+ ...l,
70
167
  ...f
71
- }[p] === m;
168
+ }[m] === _;
72
169
  }) ? [
73
- ...o,
74
- x,
75
- d
76
- ] : o;
170
+ ...c,
171
+ h,
172
+ v
173
+ ] : c;
77
174
  }, []);
78
- return P(t, l, b, e == null ? void 0 : e.class, e == null ? void 0 : e.className);
79
- }, R = {
80
- serif: "font-serif",
81
- body: "text-base",
82
- "body-wide": "text-sm tracking-[0.40em] font-medium",
83
- heading: "text-[1.5rem] md:text-4xl tracking-[-0.04em] font-medium",
84
- "heading-lg": "text-[2.5rem] md:text-[4rem] tracking-[-0.04em] font-medium leading-[2.75rem] md:leading-[4.5rem]",
85
- "heading-xl": "text-[4rem] md:text-[7rem] tracking-[-0.04em] leading-[3.5rem] md:leading-[5.5rem] font-medium"
86
- }, W = O("font-sans", {
175
+ return Xe(e, d, b, n == null ? void 0 : n.class, n == null ? void 0 : n.className);
176
+ }, ft = {
177
+ serif: "p-typography--serif",
178
+ body: "p-typography--body",
179
+ "body-wide": "p-typography--body-wide",
180
+ heading: "p-typography--heading",
181
+ "heading-lg": "p-typography--heading-lg",
182
+ "heading-xl": "p-typography--heading-xl"
183
+ }, yt = gt("p-typography", {
87
184
  variants: {
88
- variant: R
185
+ variant: ft
89
186
  },
90
187
  defaultVariants: {
91
188
  variant: "body"
92
189
  }
93
190
  });
94
- function F({
95
- as: t = "p",
96
- children: n,
97
- className: e = "",
98
- variant: a,
191
+ function Re({
192
+ as: e = "p",
193
+ children: t,
194
+ className: n = "",
195
+ variant: r,
99
196
  ...s
100
197
  }) {
101
- return /* @__PURE__ */ r(
102
- t,
198
+ return /* @__PURE__ */ a(
199
+ e,
103
200
  {
104
- className: c(W({ variant: a, className: e })),
201
+ className: p(yt({ variant: r, className: n })),
105
202
  ...s,
106
- children: n
203
+ children: t
107
204
  }
108
205
  );
109
206
  }
110
- function J({ title: t }) {
111
- return /* @__PURE__ */ r(T, { className: "pt-2 border-t border-white text-white", children: /* @__PURE__ */ r(F, { className: "uppercase", variant: "body-wide", children: t }) });
207
+ function oe(e) {
208
+ return e != null && e !== !1 && e !== "";
209
+ }
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;
212
+ }
213
+ function Ce(e) {
214
+ return typeof e == "number" ? `${e}px` : e;
215
+ }
216
+ const _t = U(
217
+ ({
218
+ prefix: e,
219
+ eyebrow: t,
220
+ title: n,
221
+ description: r,
222
+ media: s,
223
+ actions: l,
224
+ density: d = "default",
225
+ fullWidth: f = !1,
226
+ width: b,
227
+ minWidth: c,
228
+ height: u,
229
+ minHeight: h,
230
+ className: v,
231
+ style: C,
232
+ children: M,
233
+ ...m
234
+ }, _) => {
235
+ const $ = "href" in m && typeof m.href == "string", w = p(
236
+ "p-card",
237
+ d !== "default" && `p-card--${d}`,
238
+ f && "p-card--full-width",
239
+ b !== void 0 && "p-card--custom-width",
240
+ c !== void 0 && "p-card--custom-min-width",
241
+ u !== void 0 && "p-card--custom-height",
242
+ h !== void 0 && "p-card--custom-min-height",
243
+ $ && "p-card--interactive",
244
+ v
245
+ ), x = {
246
+ ...C,
247
+ ...b !== void 0 ? { "--p-card-width": Ce(b) } : {},
248
+ ...c !== void 0 ? { "--p-card-min-width": Ce(c) } : {},
249
+ ...u !== void 0 ? { "--p-card-height": Ce(u) } : {},
250
+ ...h !== void 0 ? { "--p-card-min-height": Ce(h) } : {}
251
+ }, P = /* @__PURE__ */ k(nt, { children: [
252
+ oe(s) && /* @__PURE__ */ a("div", { className: "p-card__media", children: s }),
253
+ (oe(e) || oe(t)) && /* @__PURE__ */ k("div", { className: "p-card__meta", children: [
254
+ Ee(e, "p-card__prefix"),
255
+ Ee(t, "p-card__eyebrow")
256
+ ] }),
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
260
+ ] }),
261
+ oe(M) && /* @__PURE__ */ a("div", { className: "p-card__content", children: M }),
262
+ oe(l) && /* @__PURE__ */ a("div", { className: "p-card__actions", children: l })
263
+ ] });
264
+ return $ ? /* @__PURE__ */ a("article", { ref: _, className: w, style: x, children: P }) : /* @__PURE__ */ a(
265
+ "article",
266
+ {
267
+ ...m,
268
+ ref: _,
269
+ className: w,
270
+ style: x,
271
+ children: P
272
+ }
273
+ );
274
+ }
275
+ );
276
+ _t.displayName = "PCard";
277
+ const bt = new Intl.DateTimeFormat(void 0, { weekday: "short" });
278
+ function Se(e) {
279
+ if (!e)
280
+ return null;
281
+ if (e instanceof Date)
282
+ return Number.isNaN(e.getTime()) ? null : new Date(e.getFullYear(), e.getMonth(), e.getDate());
283
+ const t = e.split("-").map(Number);
284
+ if (t.length !== 3 || t.some(Number.isNaN))
285
+ 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;
288
+ }
289
+ function ke(e) {
290
+ if (!e)
291
+ return "";
292
+ const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
293
+ return `${t}-${n}-${r}`;
294
+ }
295
+ function ue(e) {
296
+ return new Date(e.getFullYear(), e.getMonth(), 1);
297
+ }
298
+ function vt(e) {
299
+ return new Date(e.getFullYear(), e.getMonth() + 1, 0);
300
+ }
301
+ function Ge(e, t) {
302
+ return new Date(e.getFullYear(), e.getMonth() + t, 1);
303
+ }
304
+ function et(e, t) {
305
+ const n = Ge(e, t), r = vt(n).getDate();
306
+ return new Date(n.getFullYear(), n.getMonth(), Math.min(e.getDate(), r));
307
+ }
308
+ function R(e, t) {
309
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
310
+ }
311
+ function De(e, t) {
312
+ return !!(e && t && ke(e) === ke(t));
313
+ }
314
+ function de() {
315
+ const e = /* @__PURE__ */ new Date();
316
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate());
317
+ }
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));
321
+ }
322
+ function He(e) {
323
+ const t = typeof e.value == "function" ? e.value() : e.value;
324
+ return Se(t);
325
+ }
326
+ function kt(e, t) {
327
+ return new Intl.DateTimeFormat(t, { month: "long", year: "numeric" }).format(e);
328
+ }
329
+ function Nt(e, t) {
330
+ return new Intl.DateTimeFormat(t, {
331
+ month: "short",
332
+ day: "numeric",
333
+ year: "numeric"
334
+ }).format(e);
335
+ }
336
+ function wt(e, t) {
337
+ return new Intl.DateTimeFormat(t, {
338
+ weekday: "long",
339
+ month: "long",
340
+ day: "numeric",
341
+ year: "numeric"
342
+ }).format(e);
343
+ }
344
+ function xt(e, t) {
345
+ const n = new Date(2024, 0, 7);
346
+ return Array.from({ length: 7 }, (r, s) => {
347
+ const l = R(n, e + s);
348
+ return bt.formatToParts(l).length ? new Intl.DateTimeFormat(t, { weekday: "short" }).format(l) : "";
349
+ });
350
+ }
351
+ function Oe(e, t) {
352
+ return !!(t && e.getTime() < t.getTime());
353
+ }
354
+ function Ve(e, t) {
355
+ return !!(t && e.getTime() > t.getTime());
356
+ }
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
+ ] });
364
+ }
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" }) });
367
+ }
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" }) });
370
+ }
371
+ const Ct = U(
372
+ ({
373
+ label: e,
374
+ value: t,
375
+ defaultValue: n,
376
+ onValueChange: r,
377
+ presets: s = [],
378
+ customLabel: l = "Custom",
379
+ showCustom: d = !0,
380
+ presetColumns: f = "auto",
381
+ placeholder: b = "Select date",
382
+ helperText: c,
383
+ isError: u = !1,
384
+ errorMessage: h,
385
+ min: v,
386
+ max: C,
387
+ name: M,
388
+ disabled: m = !1,
389
+ readOnly: _ = !1,
390
+ required: $ = !1,
391
+ locale: w,
392
+ weekStartsOn: x = 0,
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 || _)
410
+ 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 || _)
418
+ 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);
428
+ return;
429
+ }
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));
441
+ };
442
+ return /* @__PURE__ */ k(
443
+ "div",
444
+ {
445
+ ...se,
446
+ ref: pe,
447
+ id: E,
448
+ style: ne ? { ...ie, ...ne } : ie,
449
+ className: p(
450
+ "p-date-picker",
451
+ ae && "p-date-picker--with-presets",
452
+ u && "p-date-picker--error",
453
+ m && "p-date-picker--disabled",
454
+ P
455
+ ),
456
+ children: [
457
+ /* @__PURE__ */ k("div", { id: L, className: "p-date-picker__label", children: [
458
+ /* @__PURE__ */ a("span", { children: e }),
459
+ ae ? /* @__PURE__ */ a("span", { className: p("p-date-picker__label-value", !g && "p-date-picker__label-value--empty"), children: fe }) : null
460
+ ] }),
461
+ ae ? /* @__PURE__ */ k(
462
+ "div",
463
+ {
464
+ "aria-describedby": Me,
465
+ "aria-labelledby": L,
466
+ className: p(
467
+ "p-date-picker__presets",
468
+ f !== "auto" && "p-date-picker__presets--fixed"
469
+ ),
470
+ role: "group",
471
+ children: [
472
+ s.map((i) => {
473
+ const N = He(i), S = De(N, g);
474
+ return /* @__PURE__ */ a(
475
+ "button",
476
+ {
477
+ 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
483
+ },
484
+ i.label
485
+ );
486
+ }),
487
+ je ? /* @__PURE__ */ a(
488
+ "button",
489
+ {
490
+ type: "button",
491
+ className: p(
492
+ "p-date-picker__preset",
493
+ _e && "p-date-picker__preset--active"
494
+ ),
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
501
+ }
502
+ ) : null
503
+ ]
504
+ }
505
+ ) : /* @__PURE__ */ k(
506
+ "button",
507
+ {
508
+ 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,
514
+ "aria-haspopup": "dialog",
515
+ "aria-labelledby": L,
516
+ onClick: (i) => Y ? W(!0) : $e(i.currentTarget),
517
+ children: [
518
+ /* @__PURE__ */ a("span", { children: fe }),
519
+ /* @__PURE__ */ a("span", { className: "p-date-picker__trigger-icon", children: /* @__PURE__ */ a(Mt, {}) })
520
+ ]
521
+ }
522
+ ),
523
+ /* @__PURE__ */ a("input", { type: "hidden", name: M, value: ge ?? "", required: $ }),
524
+ Y && /* @__PURE__ */ k(
525
+ "div",
526
+ {
527
+ id: A,
528
+ className: "p-date-picker__panel",
529
+ role: "dialog",
530
+ "aria-labelledby": `${A}-title`,
531
+ onKeyDown: (i) => {
532
+ i.key === "Escape" && W();
533
+ },
534
+ children: [
535
+ /* @__PURE__ */ k("div", { className: "p-date-picker__calendar-header", children: [
536
+ /* @__PURE__ */ a(
537
+ "button",
538
+ {
539
+ type: "button",
540
+ className: "p-date-picker__nav",
541
+ "aria-label": "Previous month",
542
+ onClick: () => K((i) => Ge(i, -1)),
543
+ children: /* @__PURE__ */ a($t, {})
544
+ }
545
+ ),
546
+ /* @__PURE__ */ a("div", { id: `${A}-title`, className: "p-date-picker__month", children: kt(G, w) }),
547
+ /* @__PURE__ */ a(
548
+ "button",
549
+ {
550
+ type: "button",
551
+ className: "p-date-picker__nav",
552
+ "aria-label": "Next month",
553
+ onClick: () => K((i) => Ge(i, 1)),
554
+ children: /* @__PURE__ */ a(Pt, {})
555
+ }
556
+ )
557
+ ] }),
558
+ /* @__PURE__ */ a("div", { className: "p-date-picker__weekdays", "aria-hidden": "true", children: xe.map((i) => /* @__PURE__ */ a("span", { children: i }, i)) }),
559
+ /* @__PURE__ */ a("div", { className: "p-date-picker__grid", role: "grid", "aria-labelledby": `${A}-title`, children: we.map((i) => {
560
+ const N = ke(i), S = i.getMonth() !== G.getMonth(), o = De(i, g), D = De(i, F), B = Oe(i, ee) || Ve(i, Z);
561
+ return /* @__PURE__ */ a(
562
+ "button",
563
+ {
564
+ ref: (re) => {
565
+ te.current[N] = re;
566
+ },
567
+ type: "button",
568
+ role: "gridcell",
569
+ "data-date": N,
570
+ className: p(
571
+ "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"
575
+ ),
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()
583
+ },
584
+ N
585
+ );
586
+ }) })
587
+ ]
588
+ }
589
+ ),
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
592
+ ]
593
+ }
594
+ );
595
+ }
596
+ );
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()) },
603
+ endOfMonth: {
604
+ label: "End of month",
605
+ value: () => {
606
+ const e = de();
607
+ return new Date(e.getFullYear(), e.getMonth() + 1, 0);
608
+ }
609
+ }
610
+ }, It = new Intl.DateTimeFormat(void 0, { weekday: "short" });
611
+ function Ae(e) {
612
+ if (!e)
613
+ return null;
614
+ if (e instanceof Date)
615
+ return Number.isNaN(e.getTime()) ? null : new Date(e.getFullYear(), e.getMonth(), e.getDate());
616
+ const t = e.split("-").map(Number);
617
+ if (t.length !== 3 || t.some(Number.isNaN))
618
+ 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;
621
+ }
622
+ function y(e) {
623
+ if (!e)
624
+ return "";
625
+ const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
626
+ return `${t}-${n}-${r}`;
627
+ }
628
+ function X(e) {
629
+ return new Date(e.getFullYear(), e.getMonth(), 1);
630
+ }
631
+ function Je(e) {
632
+ return new Date(e.getFullYear(), e.getMonth() + 1, 0);
633
+ }
634
+ function Ye(e, t) {
635
+ return new Date(e.getFullYear(), e.getMonth() + t, 1);
636
+ }
637
+ function tt(e, t) {
638
+ const n = Ye(e, t), r = Je(n).getDate();
639
+ return new Date(n.getFullYear(), n.getMonth(), Math.min(e.getDate(), r));
640
+ }
641
+ function I(e, t) {
642
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate() + t);
643
+ }
644
+ function O() {
645
+ const e = /* @__PURE__ */ new Date();
646
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate());
647
+ }
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));
651
+ }
652
+ function St(e, t) {
653
+ return new Intl.DateTimeFormat(t, { month: "long", year: "numeric" }).format(e);
654
+ }
655
+ function Ie(e, t) {
656
+ return new Intl.DateTimeFormat(t, {
657
+ month: "short",
658
+ day: "numeric",
659
+ year: "numeric"
660
+ }).format(e);
661
+ }
662
+ function Tt(e, t) {
663
+ return new Intl.DateTimeFormat(t, {
664
+ weekday: "long",
665
+ month: "long",
666
+ day: "numeric",
667
+ year: "numeric"
668
+ }).format(e);
112
669
  }
113
- function H() {
670
+ function Bt(e, t) {
671
+ const n = new Date(2024, 0, 7);
672
+ return Array.from({ length: 7 }, (r, s) => {
673
+ const l = I(n, e + s);
674
+ return It.formatToParts(l).length ? new Intl.DateTimeFormat(t, { weekday: "short" }).format(l) : "";
675
+ });
676
+ }
677
+ function Fe(e, t) {
678
+ return !!(e && t && y(e) === y(t));
679
+ }
680
+ function Ue(e, t) {
681
+ return !!(t && e.getTime() < t.getTime());
682
+ }
683
+ function qe(e, t) {
684
+ return !!(t && e.getTime() > t.getTime());
685
+ }
686
+ function Rt(e, t, n) {
687
+ return !!(t && n && e > t && e < n);
688
+ }
689
+ function At(e, t) {
690
+ return !e && !t ? {} : e && t && t < e ? {
691
+ start: y(t),
692
+ end: y(e)
693
+ } : {
694
+ start: y(e),
695
+ end: y(t)
696
+ };
697
+ }
698
+ function Ze(e) {
699
+ return typeof e.value == "function" ? e.value() : e.value;
700
+ }
701
+ function Te(e) {
702
+ return {
703
+ startDate: Ae(e == null ? void 0 : e.start),
704
+ endDate: Ae(e == null ? void 0 : e.end)
705
+ };
706
+ }
707
+ function at(e, t) {
708
+ 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
+ }
710
+ function Yt(e, t, n) {
711
+ const { startDate: r, endDate: s } = Te(e);
712
+ return r && s ? `${Ie(r, n)} - ${Ie(s, n)}` : r ? `${Ie(r, n)} -` : s ? `- ${Ie(s, n)}` : t;
713
+ }
714
+ function Lt() {
715
+ return /* @__PURE__ */ k("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: [
716
+ /* @__PURE__ */ a("path", { d: "M6 3v3" }),
717
+ /* @__PURE__ */ a("path", { d: "M14 3v3" }),
718
+ /* @__PURE__ */ a("path", { d: "M4 8h12" }),
719
+ /* @__PURE__ */ a("path", { d: "M5 5h10a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1Z" })
720
+ ] });
721
+ }
722
+ function zt() {
723
+ return /* @__PURE__ */ a("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "m12 5-5 5 5 5" }) });
724
+ }
725
+ function Kt() {
726
+ return /* @__PURE__ */ a("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.75", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "m8 5 5 5-5 5" }) });
727
+ }
728
+ const jt = U(
729
+ ({
730
+ label: e,
731
+ value: t,
732
+ defaultValue: n,
733
+ onValueChange: r,
734
+ presets: s = [],
735
+ customLabel: l = "Custom",
736
+ showCustom: d = !0,
737
+ presetColumns: f = "auto",
738
+ placeholder: b = "Select range",
739
+ helperText: c,
740
+ isError: u = !1,
741
+ errorMessage: h,
742
+ min: v,
743
+ max: C,
744
+ nameStart: M,
745
+ nameEnd: m,
746
+ disabled: _ = !1,
747
+ readOnly: $ = !1,
748
+ required: w = !1,
749
+ locale: x,
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
771
+ });
772
+ }, Pe = (o) => {
773
+ if (_ || $)
774
+ 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");
786
+ return;
787
+ }
788
+ te(o), ve({ start: y(F), end: y(o) }, "calendar"), Q(!0);
789
+ }
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);
795
+ return;
796
+ }
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));
808
+ };
809
+ return /* @__PURE__ */ k(
810
+ "div",
811
+ {
812
+ ...pe,
813
+ ref: ze,
814
+ id: L,
815
+ style: fe ? { ...se, ...fe } : se,
816
+ className: p(
817
+ "p-date-range-picker",
818
+ ne && "p-date-range-picker--with-presets",
819
+ u && "p-date-range-picker--error",
820
+ _ && "p-date-range-picker--disabled",
821
+ q
822
+ ),
823
+ children: [
824
+ /* @__PURE__ */ k("div", { id: A, className: "p-date-range-picker__label", children: [
825
+ /* @__PURE__ */ a("span", { children: e }),
826
+ /* @__PURE__ */ a(
827
+ "span",
828
+ {
829
+ className: p(
830
+ "p-date-range-picker__label-value",
831
+ !ye && "p-date-range-picker__label-value--empty"
832
+ ),
833
+ children: be
834
+ }
835
+ )
836
+ ] }),
837
+ ne ? /* @__PURE__ */ k(
838
+ "div",
839
+ {
840
+ "aria-describedby": _e,
841
+ "aria-labelledby": A,
842
+ className: p(
843
+ "p-date-range-picker__presets",
844
+ f !== "auto" && "p-date-range-picker__presets--fixed"
845
+ ),
846
+ role: "group",
847
+ children: [
848
+ s.map((o) => {
849
+ const D = Ze(o), B = at(D, g);
850
+ return /* @__PURE__ */ a(
851
+ "button",
852
+ {
853
+ 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
859
+ },
860
+ o.label
861
+ );
862
+ }),
863
+ Me ? /* @__PURE__ */ a(
864
+ "button",
865
+ {
866
+ type: "button",
867
+ className: p(
868
+ "p-date-range-picker__preset",
869
+ W && "p-date-range-picker__preset--active"
870
+ ),
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
877
+ }
878
+ ) : null
879
+ ]
880
+ }
881
+ ) : /* @__PURE__ */ k(
882
+ "button",
883
+ {
884
+ type: "button",
885
+ className: p(
886
+ "p-date-range-picker__trigger",
887
+ !ye && "p-date-range-picker__trigger--empty"
888
+ ),
889
+ disabled: _,
890
+ "aria-controls": z,
891
+ "aria-describedby": _e,
892
+ "aria-expanded": T,
893
+ "aria-haspopup": "dialog",
894
+ "aria-labelledby": A,
895
+ onClick: (o) => T ? Q(!0) : Pe(o.currentTarget),
896
+ children: [
897
+ /* @__PURE__ */ a("span", { children: be }),
898
+ /* @__PURE__ */ a("span", { className: "p-date-range-picker__trigger-icon", children: /* @__PURE__ */ a(Lt, {}) })
899
+ ]
900
+ }
901
+ ),
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(
905
+ "div",
906
+ {
907
+ id: z,
908
+ className: "p-date-range-picker__panel",
909
+ role: "dialog",
910
+ "aria-labelledby": `${z}-title`,
911
+ onKeyDown: (o) => {
912
+ o.key === "Escape" && Q();
913
+ },
914
+ children: [
915
+ /* @__PURE__ */ k("div", { className: "p-date-range-picker__calendar-header", children: [
916
+ /* @__PURE__ */ a(
917
+ "button",
918
+ {
919
+ type: "button",
920
+ className: "p-date-range-picker__nav",
921
+ "aria-label": "Previous month",
922
+ onClick: () => j((o) => Ye(o, -1)),
923
+ children: /* @__PURE__ */ a(zt, {})
924
+ }
925
+ ),
926
+ /* @__PURE__ */ a("div", { id: `${z}-title`, className: "p-date-range-picker__month", children: St(J, x) }),
927
+ /* @__PURE__ */ a(
928
+ "button",
929
+ {
930
+ type: "button",
931
+ className: "p-date-range-picker__nav",
932
+ "aria-label": "Next month",
933
+ onClick: () => j((o) => Ye(o, 1)),
934
+ children: /* @__PURE__ */ a(Kt, {})
935
+ }
936
+ )
937
+ ] }),
938
+ /* @__PURE__ */ a("div", { className: "p-date-range-picker__weekdays", "aria-hidden": "true", children: je.map((o) => /* @__PURE__ */ a("span", { children: o }, o)) }),
939
+ /* @__PURE__ */ a("div", { className: "p-date-range-picker__grid", role: "grid", "aria-labelledby": `${z}-title`, children: ae.map((o) => {
940
+ const D = y(o), B = o.getMonth() !== J.getMonth(), re = Fe(o, F), H = Fe(o, ee), ce = Rt(o, F, ee), st = Fe(o, Z), lt = Ue(o, G) || qe(o, K);
941
+ return /* @__PURE__ */ a(
942
+ "button",
943
+ {
944
+ ref: (ct) => {
945
+ xe.current[D] = ct;
946
+ },
947
+ type: "button",
948
+ role: "gridcell",
949
+ "data-date": D,
950
+ className: p(
951
+ "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"
956
+ ),
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()
964
+ },
965
+ D
966
+ );
967
+ }) })
968
+ ]
969
+ }
970
+ ),
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
973
+ ]
974
+ }
975
+ );
976
+ }
977
+ );
978
+ jt.displayName = "PDateRangePicker";
979
+ const Et = {
980
+ thisWeek: {
981
+ label: "This week",
982
+ value: () => {
983
+ const e = O(), t = I(e, -e.getDay());
984
+ return {
985
+ start: y(t),
986
+ end: y(I(t, 6))
987
+ };
988
+ }
989
+ },
990
+ last7Days: {
991
+ label: "Last 7 days",
992
+ value: () => {
993
+ const e = O();
994
+ return {
995
+ start: y(I(e, -6)),
996
+ end: y(e)
997
+ };
998
+ }
999
+ },
1000
+ last14Days: {
1001
+ label: "Last 14 days",
1002
+ value: () => {
1003
+ const e = O();
1004
+ return {
1005
+ start: y(I(e, -13)),
1006
+ end: y(e)
1007
+ };
1008
+ }
1009
+ },
1010
+ last30Days: {
1011
+ label: "Last 30 days",
1012
+ value: () => {
1013
+ const e = O();
1014
+ return {
1015
+ start: y(I(e, -29)),
1016
+ end: y(e)
1017
+ };
1018
+ }
1019
+ },
1020
+ thisMonth: {
1021
+ label: "This month",
1022
+ value: () => {
1023
+ const e = O(), t = X(e), n = Je(e);
1024
+ return {
1025
+ start: y(t),
1026
+ end: y(n)
1027
+ };
1028
+ }
1029
+ },
1030
+ lastMonth: {
1031
+ label: "Last month",
1032
+ value: () => {
1033
+ const e = O(), t = Ye(e, -1);
1034
+ return {
1035
+ start: y(X(t)),
1036
+ end: y(Je(t))
1037
+ };
1038
+ }
1039
+ },
1040
+ monthToDate: {
1041
+ label: "Month to date",
1042
+ value: () => {
1043
+ const e = O(), t = X(e);
1044
+ return {
1045
+ start: y(t),
1046
+ end: y(e)
1047
+ };
1048
+ }
1049
+ },
1050
+ yearToDate: {
1051
+ label: "Year to date",
1052
+ value: () => {
1053
+ const e = O();
1054
+ return {
1055
+ start: y(new Date(e.getFullYear(), 0, 1)),
1056
+ end: y(e)
1057
+ };
1058
+ }
1059
+ }
1060
+ }, Wt = U(
1061
+ ({
1062
+ as: e = "span",
1063
+ variant: t = "primary",
1064
+ appearance: n = "text",
1065
+ color: r,
1066
+ textColor: s,
1067
+ children: l,
1068
+ className: d,
1069
+ style: f,
1070
+ ...b
1071
+ }, c) => {
1072
+ const u = {
1073
+ ...f,
1074
+ ...r ? { "--p-highlight-color": r, "--p-highlight-bg": r } : {},
1075
+ ...s ? { "--p-highlight-text": s } : {}
1076
+ };
1077
+ return /* @__PURE__ */ a(
1078
+ e,
1079
+ {
1080
+ ...b,
1081
+ ref: c,
1082
+ className: p(
1083
+ "p-highlight",
1084
+ `p-highlight--${t}`,
1085
+ n === "background" && "p-highlight--background",
1086
+ d
1087
+ ),
1088
+ style: u,
1089
+ children: l
1090
+ }
1091
+ );
1092
+ }
1093
+ );
1094
+ Wt.displayName = "PHighlight";
1095
+ const Ht = U(
1096
+ ({
1097
+ children: e,
1098
+ ariaLabel: t = "Horizontal content",
1099
+ gap: n,
1100
+ snap: r = !0,
1101
+ className: s,
1102
+ scrollerClassName: l,
1103
+ listClassName: d,
1104
+ itemClassName: f,
1105
+ style: b,
1106
+ ...c
1107
+ }, u) => {
1108
+ const h = {
1109
+ ...b,
1110
+ ...n ? { "--p-horizontal-slider-gap": n } : {}
1111
+ };
1112
+ return /* @__PURE__ */ a(
1113
+ "div",
1114
+ {
1115
+ ...c,
1116
+ ref: u,
1117
+ className: p("p-horizontal-slider", !r && "p-horizontal-slider--no-snap", s),
1118
+ style: h,
1119
+ children: /* @__PURE__ */ a(
1120
+ "div",
1121
+ {
1122
+ "aria-label": t,
1123
+ className: p("p-horizontal-slider__scroller", l),
1124
+ role: "region",
1125
+ 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 })) })
1127
+ }
1128
+ )
1129
+ }
1130
+ );
1131
+ }
1132
+ );
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 }) });
1136
+ }
1137
+ function Ot() {
114
1138
  return /* @__PURE__ */ k(
115
1139
  "svg",
116
1140
  {
117
1141
  xmlns: "http://www.w3.org/2000/svg",
118
- width: "20",
119
- height: "20",
120
1142
  viewBox: "0 0 24 24",
121
1143
  fill: "none",
122
1144
  stroke: "currentColor",
@@ -125,20 +1147,19 @@ function H() {
125
1147
  strokeLinejoin: "round",
126
1148
  "aria-hidden": "true",
127
1149
  focusable: "false",
1150
+ className: "p-text-input__icon",
128
1151
  children: [
129
- /* @__PURE__ */ r("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }),
130
- /* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "3" })
1152
+ /* @__PURE__ */ a("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }),
1153
+ /* @__PURE__ */ a("circle", { cx: "12", cy: "12", r: "3" })
131
1154
  ]
132
1155
  }
133
1156
  );
134
1157
  }
135
- function z() {
1158
+ function Vt() {
136
1159
  return /* @__PURE__ */ k(
137
1160
  "svg",
138
1161
  {
139
1162
  xmlns: "http://www.w3.org/2000/svg",
140
- width: "20",
141
- height: "20",
142
1163
  viewBox: "0 0 24 24",
143
1164
  fill: "none",
144
1165
  stroke: "currentColor",
@@ -147,246 +1168,213 @@ function z() {
147
1168
  strokeLinejoin: "round",
148
1169
  "aria-hidden": "true",
149
1170
  focusable: "false",
1171
+ className: "p-text-input__icon",
150
1172
  children: [
151
- /* @__PURE__ */ r("path", { d: "M9.88 9.88a3 3 0 1 0 4.24 4.24" }),
152
- /* @__PURE__ */ r("path", { d: "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" }),
153
- /* @__PURE__ */ r("path", { d: "M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" }),
154
- /* @__PURE__ */ r("line", { x1: "2", x2: "22", y1: "2", y2: "22" })
1173
+ /* @__PURE__ */ a("path", { d: "M9.88 9.88a3 3 0 1 0 4.24 4.24" }),
1174
+ /* @__PURE__ */ a("path", { d: "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" }),
1175
+ /* @__PURE__ */ a("path", { d: "M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" }),
1176
+ /* @__PURE__ */ a("line", { x1: "2", x2: "22", y1: "2", y2: "22" })
155
1177
  ]
156
1178
  }
157
1179
  );
158
1180
  }
159
- const K = j(
1181
+ const Ut = U(
160
1182
  ({
161
- className: t,
162
- inputClassName: n,
163
- type: e,
164
- label: a,
1183
+ className: e,
1184
+ inputClassName: t,
1185
+ type: n,
1186
+ label: r,
165
1187
  helperText: s,
166
- id: i,
167
- isError: l = !1,
1188
+ id: l,
1189
+ isError: d = !1,
168
1190
  errorMessage: f,
169
1191
  rightAdornment: b,
170
- disabled: o,
1192
+ disabled: c,
171
1193
  readOnly: u,
172
- style: x,
173
- ...d
174
- }, v) => {
175
- const h = C(), p = i ?? h, m = `${p}-error`, g = `${p}-helper`, y = e === "password", N = !!b && !y, [w, A] = L(!1), B = y ? w ? "text" : "password" : e ?? "text", S = [
176
- l && f ? m : null,
177
- !l && s ? g : null
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
178
1200
  ].filter(Boolean).join(" ") || void 0;
179
- return /* @__PURE__ */ k("div", { className: c("p-text-input relative w-full", t), style: x, children: [
180
- /* @__PURE__ */ r(
1201
+ return /* @__PURE__ */ k("div", { className: p("p-text-input", e), style: h, children: [
1202
+ /* @__PURE__ */ a(
181
1203
  "input",
182
1204
  {
183
- ...d,
184
- id: p,
185
- ref: v,
186
- type: B,
187
- disabled: o,
1205
+ ...v,
1206
+ id: m,
1207
+ ref: C,
1208
+ type: ie,
1209
+ disabled: c,
188
1210
  readOnly: u,
189
1211
  placeholder: " ",
190
- "aria-invalid": l || void 0,
191
- "aria-describedby": S,
192
- "aria-required": d.required,
193
- "aria-disabled": o,
1212
+ "aria-invalid": d || void 0,
1213
+ "aria-describedby": se,
1214
+ "aria-required": v.required,
1215
+ "aria-disabled": c,
194
1216
  "aria-readonly": u,
195
- autoComplete: d.autoComplete ?? (y ? "current-password" : void 0),
196
- className: c(
197
- // Layout — tall enough for the floating label + value
198
- "peer h-16 w-full rounded px-4 pt-6 pb-2",
199
- (y || N) && "pr-12",
200
- // Visuals
201
- "bg-(--p-input-bg) text-(--p-input-text)",
202
- "font-sans text-sm outline-none",
203
- "border border-(--p-input-border) focus:border-(--p-input-border-focus)",
204
- // Focus
205
- "focus:bg-(--p-input-bg-focus)",
206
- "focus:ring-2 focus:ring-(--p-input-ring)",
207
- // Motion
208
- "transition-all duration-150 ease-in",
209
- // States
210
- "disabled:cursor-not-allowed disabled:opacity-50",
211
- "read-only:cursor-default read-only:bg-(--p-input-bg-readonly)",
212
- l && "ring-2 ring-red-500",
213
- // Date — hide native picker chrome so rightAdornment can replace it
214
- N && e === "date" && "[&::-webkit-calendar-picker-indicator]:absolute [&::-webkit-calendar-picker-indicator]:right-0 [&::-webkit-calendar-picker-indicator]:h-full [&::-webkit-calendar-picker-indicator]:w-full [&::-webkit-calendar-picker-indicator]:cursor-pointer [&::-webkit-calendar-picker-indicator]:opacity-0",
215
- n
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
216
1224
  )
217
1225
  }
218
1226
  ),
219
- /* @__PURE__ */ r(
1227
+ /* @__PURE__ */ a(
220
1228
  "span",
221
1229
  {
222
1230
  "aria-hidden": "true",
223
- className: c(
224
- "pointer-events-none absolute top-2 left-4",
225
- "font-sans text-xs",
226
- "origin-left transition-all duration-150 ease-in",
227
- // Hidden by default
228
- "scale-0 opacity-0",
229
- l ? "text-red-500" : "text-(--p-input-label) peer-focus:text-(--p-input-label-focus)",
230
- // Reveal when focused or filled
231
- "peer-focus:scale-100 peer-focus:opacity-100",
232
- "peer-not-placeholder-shown:scale-100 peer-not-placeholder-shown:opacity-100"
1231
+ className: p(
1232
+ "p-text-input__label p-text-input__floating-label",
1233
+ d && "p-text-input__label--error"
233
1234
  ),
234
- children: a
1235
+ children: r
235
1236
  }
236
1237
  ),
237
- /* @__PURE__ */ r(
1238
+ /* @__PURE__ */ a(
238
1239
  "label",
239
1240
  {
240
- htmlFor: p,
241
- className: c(
242
- "pointer-events-none absolute top-1/2 left-4 -translate-y-1/2",
243
- "font-sans text-sm text-(--p-input-text)",
244
- "origin-left transition-all duration-150 ease-in",
245
- // Collapse when focused or filled
246
- "peer-focus:scale-0 peer-focus:opacity-0",
247
- "peer-not-placeholder-shown:scale-0 peer-not-placeholder-shown:opacity-0",
248
- o && "opacity-50"
249
- ),
250
- children: a
1241
+ htmlFor: m,
1242
+ className: "p-text-input__label p-text-input__placeholder-label",
1243
+ children: r
251
1244
  }
252
1245
  ),
253
- y && /* @__PURE__ */ r(
1246
+ w && /* @__PURE__ */ a(
254
1247
  "button",
255
1248
  {
256
1249
  type: "button",
257
- onClick: () => A((q) => !q),
258
- disabled: o,
259
- className: c(
260
- "absolute top-1/2 right-4 -translate-y-1/2",
261
- "text-(--p-input-label) hover:text-(--p-input-text)",
262
- "transition-colors duration-150",
263
- "focus-visible:outline-2 focus-visible:outline-offset-2",
264
- "focus-visible:outline-(--p-input-ring)",
265
- "disabled:pointer-events-none disabled:opacity-50"
266
- ),
267
- "aria-label": w ? "Hide password" : "Show password",
268
- "aria-pressed": w,
269
- "aria-controls": p,
270
- children: w ? /* @__PURE__ */ r(H, {}) : /* @__PURE__ */ r(z, {})
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, {})
271
1257
  }
272
1258
  ),
273
- N && /* @__PURE__ */ r(
274
- "span",
1259
+ x && /* @__PURE__ */ a("span", { "aria-hidden": "true", className: "p-text-input__adornment", children: b }),
1260
+ d && f && /* @__PURE__ */ a(
1261
+ "p",
275
1262
  {
276
- "aria-hidden": "true",
277
- className: "pointer-events-none absolute top-1/2 right-4 -translate-y-1/2 text-(--p-input-label)",
278
- children: b
1263
+ id: _,
1264
+ role: "alert",
1265
+ className: "p-text-input__message p-text-input__message--error",
1266
+ children: f
279
1267
  }
280
1268
  ),
281
- l && f && /* @__PURE__ */ r("p", { id: m, role: "alert", className: "mt-1 px-4 font-sans text-xs text-red-500", children: f }),
282
- !l && s && /* @__PURE__ */ r("p", { id: g, className: "mt-1 px-4 font-sans text-xs text-(--p-input-text-helper)", children: s })
1269
+ !d && s && /* @__PURE__ */ a(
1270
+ "p",
1271
+ {
1272
+ id: $,
1273
+ className: "p-text-input__message p-text-input__message--helper",
1274
+ children: s
1275
+ }
1276
+ )
283
1277
  ] });
284
1278
  }
285
1279
  );
286
- K.displayName = "PTextInput";
287
- const M = j(
1280
+ Ut.displayName = "PTextInput";
1281
+ const qt = U(
288
1282
  ({
289
- className: t,
290
- textareaClassName: n,
291
- label: e,
292
- helperText: a,
1283
+ className: e,
1284
+ textareaClassName: t,
1285
+ label: n,
1286
+ helperText: r,
293
1287
  id: s,
294
- isError: i = !1,
295
- errorMessage: l,
1288
+ isError: l = !1,
1289
+ errorMessage: d,
296
1290
  disabled: f,
297
1291
  readOnly: b,
298
- rows: o = 4,
1292
+ rows: c = 4,
299
1293
  style: u,
300
- ...x
301
- }, d) => {
302
- const v = C(), h = s ?? v, p = `${h}-error`, m = `${h}-helper`, g = [
303
- i && l ? p : null,
304
- !i && a ? m : null
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
305
1299
  ].filter(Boolean).join(" ") || void 0;
306
- return /* @__PURE__ */ k("div", { className: c("p-text-area relative w-full", t), style: u, children: [
307
- /* @__PURE__ */ r(
1300
+ return /* @__PURE__ */ k("div", { className: p("p-text-area", e), style: u, children: [
1301
+ /* @__PURE__ */ a(
308
1302
  "textarea",
309
1303
  {
310
- ...x,
311
- id: h,
312
- ref: d,
313
- rows: o,
1304
+ ...h,
1305
+ id: M,
1306
+ ref: v,
1307
+ rows: c,
314
1308
  disabled: f,
315
1309
  readOnly: b,
316
1310
  placeholder: " ",
317
- "aria-invalid": i || void 0,
318
- "aria-describedby": g,
319
- "aria-required": x.required,
1311
+ "aria-invalid": l || void 0,
1312
+ "aria-describedby": $,
1313
+ "aria-required": h.required,
320
1314
  "aria-disabled": f,
321
1315
  "aria-readonly": b,
322
- className: c(
323
- // Layout
324
- "peer w-full rounded px-4 pt-8 pb-3",
325
- // Visuals
326
- "bg-(--p-textarea-bg) text-(--p-textarea-text)",
327
- "font-sans text-sm outline-none",
328
- "border border-(--p-textarea-border) focus:border-(--p-textarea-border-focus)",
329
- // Focus
330
- "focus:bg-(--p-textarea-bg-focus)",
331
- "focus:ring-2 focus:ring-(--p-textarea-ring)",
332
- // Resize
333
- "resize-y",
334
- // Motion
335
- "transition-all duration-150 ease-in",
336
- // States
337
- "disabled:cursor-not-allowed disabled:opacity-50",
338
- "read-only:cursor-default read-only:bg-(--p-textarea-bg-readonly)",
339
- i && "ring-2 ring-red-500",
340
- n
1316
+ className: p(
1317
+ "p-text-area__control",
1318
+ l && "p-text-area__control--error",
1319
+ t
341
1320
  )
342
1321
  }
343
1322
  ),
344
- /* @__PURE__ */ r(
1323
+ /* @__PURE__ */ a(
345
1324
  "span",
346
1325
  {
347
1326
  "aria-hidden": "true",
348
- className: c(
349
- "pointer-events-none absolute top-2 left-4",
350
- "font-sans text-xs",
351
- "origin-left transition-all duration-150 ease-in",
352
- // Hidden by default
353
- "scale-0 opacity-0",
354
- i ? "text-red-500" : "text-(--p-textarea-label) peer-focus:text-(--p-textarea-label-focus)",
355
- // Reveal when focused or filled
356
- "peer-focus:scale-100 peer-focus:opacity-100",
357
- "peer-not-placeholder-shown:scale-100 peer-not-placeholder-shown:opacity-100"
1327
+ className: p(
1328
+ "p-text-area__label p-text-area__floating-label",
1329
+ l && "p-text-area__label--error"
358
1330
  ),
359
- children: e
1331
+ children: n
360
1332
  }
361
1333
  ),
362
- /* @__PURE__ */ r(
1334
+ /* @__PURE__ */ a(
363
1335
  "label",
364
1336
  {
365
- htmlFor: h,
366
- className: c(
367
- "pointer-events-none absolute top-4 left-4",
368
- "font-sans text-sm text-(--p-textarea-text)",
369
- "origin-left transition-all duration-150 ease-in",
370
- // Collapse when focused or filled
371
- "peer-focus:scale-0 peer-focus:opacity-0",
372
- "peer-not-placeholder-shown:scale-0 peer-not-placeholder-shown:opacity-0",
373
- f && "opacity-50"
374
- ),
375
- children: e
1337
+ htmlFor: M,
1338
+ className: "p-text-area__label p-text-area__placeholder-label",
1339
+ children: n
1340
+ }
1341
+ ),
1342
+ l && d && /* @__PURE__ */ a(
1343
+ "p",
1344
+ {
1345
+ id: m,
1346
+ role: "alert",
1347
+ className: "p-text-area__message p-text-area__message--error",
1348
+ children: d
376
1349
  }
377
1350
  ),
378
- i && l && /* @__PURE__ */ r("p", { id: p, role: "alert", className: "mt-1 px-4 font-sans text-xs text-red-500", children: l }),
379
- !i && a && /* @__PURE__ */ r("p", { id: m, className: "mt-1 px-4 font-sans text-xs text-(--p-textarea-text-helper)", children: a })
1351
+ !l && r && /* @__PURE__ */ a(
1352
+ "p",
1353
+ {
1354
+ id: _,
1355
+ className: "p-text-area__message p-text-area__message--helper",
1356
+ children: r
1357
+ }
1358
+ )
380
1359
  ] });
381
1360
  }
382
1361
  );
383
- M.displayName = "PTextArea";
1362
+ qt.displayName = "PTextArea";
384
1363
  export {
385
- J as PSectionHeader,
386
- M as PTextArea,
387
- K as PTextInput,
388
- F as PTypography,
389
- G as Row,
390
- T as Stack
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
391
1379
  };
392
1380
  //# sourceMappingURL=index.es.js.map