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