@photon-ai/pho-ui 4.25.0 → 4.27.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/README.md +2 -2
- package/dist/chunks/{avatar-PgBOfszL.js → avatar-BJvgi8ON.js} +24 -30
- package/dist/chunks/avatar-BJvgi8ON.js.map +1 -0
- package/dist/chunks/{basic-page-DYBjCadG.js → basic-page-DSPzDKrZ.js} +80 -83
- package/dist/chunks/basic-page-DSPzDKrZ.js.map +1 -0
- package/dist/chunks/{box-search-CMl5bQ7Y.js → box-search-DD2EPtDy.js} +18 -19
- package/dist/chunks/box-search-DD2EPtDy.js.map +1 -0
- package/dist/chunks/{calendar-DDWITGo4.js → calendar-s-QRks1Z.js} +66 -69
- package/dist/chunks/calendar-s-QRks1Z.js.map +1 -0
- package/dist/chunks/{chat-D98GCjbe.js → chat-D6SGRahp.js} +226 -276
- package/dist/chunks/chat-D6SGRahp.js.map +1 -0
- package/dist/chunks/{checkbox-D8smFViR.js → checkbox-B3fVczYP.js} +2 -2
- package/dist/chunks/checkbox-B3fVczYP.js.map +1 -0
- package/dist/chunks/{close-button-Ck4rY1Fp.js → close-button-Bwv_OoCZ.js} +2 -2
- package/dist/chunks/close-button-Bwv_OoCZ.js.map +1 -0
- package/dist/chunks/{code-block-CthLWfxd.js → code-block-CiZWZBO2.js} +169 -238
- package/dist/chunks/code-block-CiZWZBO2.js.map +1 -0
- package/dist/chunks/copy-button-DNNZu6r4.js +69 -0
- package/dist/chunks/copy-button-DNNZu6r4.js.map +1 -0
- package/dist/chunks/{data-table-C1tLUdw0.js → data-table-CshUlqIu.js} +11 -12
- package/dist/chunks/data-table-CshUlqIu.js.map +1 -0
- package/dist/chunks/{date-picker-D-sWo3i8.js → date-picker-BaAkim2u.js} +126 -151
- package/dist/chunks/date-picker-BaAkim2u.js.map +1 -0
- package/dist/chunks/{description-list-DcTvBHzI.js → description-list-VTNz1MmJ.js} +2 -2
- package/dist/chunks/{description-list-DcTvBHzI.js.map → description-list-VTNz1MmJ.js.map} +1 -1
- package/dist/chunks/{dialog-H72fZGtf.js → dialog-C116Qr0w.js} +2 -2
- package/dist/chunks/{dialog-H72fZGtf.js.map → dialog-C116Qr0w.js.map} +1 -1
- package/dist/chunks/{filter-bar-D_sBAT5Y.js → filter-bar-DI5JO1Cd.js} +63 -72
- package/dist/chunks/filter-bar-DI5JO1Cd.js.map +1 -0
- package/dist/chunks/{ghost-search-CMUI2UH0.js → ghost-search-DhADxaWi.js} +11 -12
- package/dist/chunks/ghost-search-DhADxaWi.js.map +1 -0
- package/dist/chunks/icons-eq5FZ3Yc.js +1254 -0
- package/dist/chunks/icons-eq5FZ3Yc.js.map +1 -0
- package/dist/chunks/{input-DWnb33UF.js → input-hrrPhzXp.js} +37 -56
- package/dist/chunks/input-hrrPhzXp.js.map +1 -0
- package/dist/chunks/{select-Dux2SBVc.js → select-DlyDd7AB.js} +10 -10
- package/dist/chunks/select-DlyDd7AB.js.map +1 -0
- package/dist/chunks/{sidebar-ttBkgGRh.js → sidebar-DTRcoxrB.js} +95 -111
- package/dist/chunks/sidebar-DTRcoxrB.js.map +1 -0
- package/dist/chunks/{toast-Cbnn8lcA.js → toast-Btwu5Kjk.js} +7 -7
- package/dist/chunks/toast-Btwu5Kjk.js.map +1 -0
- package/dist/chunks/{trace-ClMpG82z.js → trace-CKYAff2U.js} +498 -607
- package/dist/chunks/trace-CKYAff2U.js.map +1 -0
- package/dist/components/avatar.js +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/chat.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/code-block.js +1 -1
- package/dist/components/command.js +36 -37
- package/dist/components/command.js.map +1 -1
- package/dist/components/copy-button.js +1 -1
- package/dist/components/data-table.js +2 -2
- package/dist/components/date-picker.js +1 -1
- package/dist/components/description-list.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/error.js +252 -11
- package/dist/components/error.js.map +1 -0
- package/dist/components/filter-bar.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/notification.js +27 -34
- package/dist/components/notification.js.map +1 -1
- package/dist/components/phone-input.js +3 -4
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/scope.js +52 -53
- package/dist/components/scope.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/theme-toggle.js +69 -95
- package/dist/components/theme-toggle.js.map +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/components/trace.js +1 -1
- package/dist/icons.js +235 -78
- package/dist/icons.js.map +1 -1
- package/dist/index.js +158 -158
- package/dist/sections/basic-page.js +2 -2
- package/dist/sections/sidebar.js +1 -1
- package/dist/src/components/avatar/avatar.d.ts +1 -1
- package/dist/src/components/notification/notification.d.ts +2 -2
- package/dist/src/components/trace/decorations.d.ts +3 -3
- package/dist/src/icons/index.d.ts +1 -0
- package/dist/src/icons/photon/icons.d.ts +315 -0
- package/dist/src/icons/photon/index.d.ts +2 -0
- package/dist/src/icons/photon/photon-icon.d.ts +51 -0
- package/package.json +5 -3
- package/src/styles/fonts.css +2 -1
- package/src/styles/theme.css +3 -1
- package/dist/chunks/IconArrowUpRight-OK8Fp0KQ.js +0 -14
- package/dist/chunks/IconArrowUpRight-OK8Fp0KQ.js.map +0 -1
- package/dist/chunks/IconCheck-DwSMn1wK.js +0 -11
- package/dist/chunks/IconCheck-DwSMn1wK.js.map +0 -1
- package/dist/chunks/IconChevronDown-Cd68NnX2.js +0 -11
- package/dist/chunks/IconChevronDown-Cd68NnX2.js.map +0 -1
- package/dist/chunks/IconChevronLeft-CptqhdxO.js +0 -11
- package/dist/chunks/IconChevronLeft-CptqhdxO.js.map +0 -1
- package/dist/chunks/IconChevronRight-BNkXCTk6.js +0 -11
- package/dist/chunks/IconChevronRight-BNkXCTk6.js.map +0 -1
- package/dist/chunks/IconChevronUp-Bxllwz8J.js +0 -11
- package/dist/chunks/IconChevronUp-Bxllwz8J.js.map +0 -1
- package/dist/chunks/IconInfoCircle-CTAynhe8.js +0 -21
- package/dist/chunks/IconInfoCircle-CTAynhe8.js.map +0 -1
- package/dist/chunks/IconSearch-DkcWWZ1H.js +0 -14
- package/dist/chunks/IconSearch-DkcWWZ1H.js.map +0 -1
- package/dist/chunks/IconX-DnPlFC68.js +0 -14
- package/dist/chunks/IconX-DnPlFC68.js.map +0 -1
- package/dist/chunks/avatar-PgBOfszL.js.map +0 -1
- package/dist/chunks/basic-page-DYBjCadG.js.map +0 -1
- package/dist/chunks/box-search-CMl5bQ7Y.js.map +0 -1
- package/dist/chunks/calendar-DDWITGo4.js.map +0 -1
- package/dist/chunks/chat-D98GCjbe.js.map +0 -1
- package/dist/chunks/checkbox-D8smFViR.js.map +0 -1
- package/dist/chunks/close-button-Ck4rY1Fp.js.map +0 -1
- package/dist/chunks/code-block-CthLWfxd.js.map +0 -1
- package/dist/chunks/copy-button-BLvirhXk.js +0 -76
- package/dist/chunks/copy-button-BLvirhXk.js.map +0 -1
- package/dist/chunks/data-table-C1tLUdw0.js.map +0 -1
- package/dist/chunks/date-picker-D-sWo3i8.js.map +0 -1
- package/dist/chunks/error-BT71wcUd.js +0 -270
- package/dist/chunks/error-BT71wcUd.js.map +0 -1
- package/dist/chunks/filter-bar-D_sBAT5Y.js.map +0 -1
- package/dist/chunks/ghost-search-CMUI2UH0.js.map +0 -1
- package/dist/chunks/input-DWnb33UF.js.map +0 -1
- package/dist/chunks/select-Dux2SBVc.js.map +0 -1
- package/dist/chunks/sidebar-ttBkgGRh.js.map +0 -1
- package/dist/chunks/toast-Cbnn8lcA.js.map +0 -1
- package/dist/chunks/trace-ClMpG82z.js.map +0 -1
|
@@ -1,36 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { t as p } from "./cn-CPbhpG1q.js";
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
3
|
+
import { C as he } from "./icons-eq5FZ3Yc.js";
|
|
4
|
+
import { t as pe } from "./calendar-s-QRks1Z.js";
|
|
5
5
|
import { t as V } from "./popover-Dtp9C6Qg.js";
|
|
6
|
-
import { useCallback as
|
|
6
|
+
import { useCallback as Ue, useEffect as Ze, useId as We, useRef as Q, useState as x, useSyncExternalStore as Je } from "react";
|
|
7
7
|
import { Fragment as te, jsx as f, jsxs as y } from "react/jsx-runtime";
|
|
8
|
-
var
|
|
9
|
-
["path", {
|
|
10
|
-
d: "M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12",
|
|
11
|
-
key: "svg-0"
|
|
12
|
-
}],
|
|
13
|
-
["path", {
|
|
14
|
-
d: "M16 3v4",
|
|
15
|
-
key: "svg-1"
|
|
16
|
-
}],
|
|
17
|
-
["path", {
|
|
18
|
-
d: "M8 3v4",
|
|
19
|
-
key: "svg-2"
|
|
20
|
-
}],
|
|
21
|
-
["path", {
|
|
22
|
-
d: "M4 11h16",
|
|
23
|
-
key: "svg-3"
|
|
24
|
-
}],
|
|
25
|
-
["path", {
|
|
26
|
-
d: "M11 15h1",
|
|
27
|
-
key: "svg-4"
|
|
28
|
-
}],
|
|
29
|
-
["path", {
|
|
30
|
-
d: "M12 15v3",
|
|
31
|
-
key: "svg-5"
|
|
32
|
-
}]
|
|
33
|
-
], pe = Ue("outline", "calendar", "Calendar", Xe), $e = {
|
|
8
|
+
var $e = {
|
|
34
9
|
hour: 3600,
|
|
35
10
|
minute: 60,
|
|
36
11
|
second: 1
|
|
@@ -38,15 +13,15 @@ var Xe = [
|
|
|
38
13
|
sm: "px-3 py-2 text-md md:text-base",
|
|
39
14
|
md: "px-3 py-2 text-md",
|
|
40
15
|
lg: "px-3.5 py-2.5 text-md"
|
|
41
|
-
},
|
|
16
|
+
}, be = {
|
|
42
17
|
sm: "rounded-base",
|
|
43
18
|
md: "rounded-base",
|
|
44
19
|
lg: "squircle rounded-base"
|
|
45
|
-
},
|
|
20
|
+
}, ve = p("bg-pho-primary ring-pho-primary text-pho-primary relative flex cursor-pointer items-center gap-2 text-left ring-1 ring-inset", "transition-shadow duration-100 ease-linear focus-visible:outline-none", "data-[invalid]:ring-pho-error-subtle data-[invalid]:ring-[1.5px]"), Qe = p("has-[input:focus-visible]:ring-pho-brand data-[popup-open]:ring-pho-brand has-[input:focus-visible]:ring-2 data-[popup-open]:ring-2", "data-[invalid]:has-[input:focus-visible]:ring-pho-error data-[invalid]:data-[popup-open]:ring-pho-error", "has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50"), Xe = p("has-[input:focus-visible]:ring-pho-brand has-[input:focus-visible]:ring-2", "data-[invalid]:has-[input:focus-visible]:ring-pho-error", "has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50"), et = p("flex shrink-0 cursor-pointer items-center rounded-sm px-2.5 py-1.5 text-left text-base whitespace-nowrap select-none", "text-pho-secondary transition-[color,background-color] duration-150 ease-out", "hover:bg-pho-ghost-hover hover:text-pho-primary", "outline-pho-brand focus-visible:outline-2 focus-visible:-outline-offset-1", "sm:w-full"), tt = "bg-pho-ghost-hover text-pho-primary font-medium", nt = /[\u00a0\u2000-\u200a\u202f\u205f\u3000]/g, A = (e) => e.replace(nt, " "), Ce = {
|
|
46
21
|
year: "numeric",
|
|
47
22
|
month: "2-digit",
|
|
48
23
|
day: "2-digit"
|
|
49
|
-
},
|
|
24
|
+
}, rt = {
|
|
50
25
|
hour: {
|
|
51
26
|
hour: "2-digit",
|
|
52
27
|
minute: "2-digit",
|
|
@@ -63,86 +38,86 @@ var Xe = [
|
|
|
63
38
|
second: "2-digit",
|
|
64
39
|
hourCycle: "h23"
|
|
65
40
|
}
|
|
66
|
-
}, R = "–",
|
|
67
|
-
function
|
|
41
|
+
}, R = "–", Se = new Date(2026, 8, 12, 15, 4, 5);
|
|
42
|
+
function Te(e, t) {
|
|
68
43
|
return new Intl.DateTimeFormat(e, {
|
|
69
44
|
...Ce,
|
|
70
|
-
...t ?
|
|
45
|
+
...t ? rt[t] : {}
|
|
71
46
|
});
|
|
72
47
|
}
|
|
73
|
-
var
|
|
74
|
-
function
|
|
75
|
-
return new Intl.DateTimeFormat(e, Ce).formatToParts(
|
|
48
|
+
var Ee = (e) => e === "year" || e === "month" || e === "day";
|
|
49
|
+
function ot(e) {
|
|
50
|
+
return new Intl.DateTimeFormat(e, Ce).formatToParts(Se).map((t) => t.type).filter(Ee);
|
|
76
51
|
}
|
|
77
|
-
var
|
|
52
|
+
var at = {
|
|
78
53
|
year: "yyyy",
|
|
79
54
|
month: "mm",
|
|
80
55
|
day: "dd"
|
|
81
56
|
};
|
|
82
|
-
function
|
|
83
|
-
return A(
|
|
57
|
+
function it(e, t) {
|
|
58
|
+
return A(Te(e, t).formatToParts(Se).map((n) => Ee(n.type) ? at[n.type] : n.type === "hour" ? "hh" : n.type === "minute" ? "mm" : n.type === "second" ? "ss" : n.value).join(""));
|
|
84
59
|
}
|
|
85
|
-
function
|
|
60
|
+
function lt(e, t, n) {
|
|
86
61
|
if (e == null) return "";
|
|
87
|
-
const c =
|
|
88
|
-
return e instanceof Date ? A(c.format(e)) : e.from == null ? "" : e.to == null || n == null && e.from.getFullYear() === e.to.getFullYear() && e.from.getMonth() === e.to.getMonth() && e.from.getDate() === e.to.getDate() ? A(c.format(e.from)) : A(
|
|
62
|
+
const c = Te(t, n);
|
|
63
|
+
return e instanceof Date ? A(c.format(e)) : e.from == null ? "" : e.to == null || n == null && e.from.getFullYear() === e.to.getFullYear() && e.from.getMonth() === e.to.getMonth() && e.from.getDate() === e.to.getDate() ? A(c.format(e.from)) : A(st(c, e.from, e.to, n != null));
|
|
89
64
|
}
|
|
90
|
-
function
|
|
91
|
-
const o = e.formatToParts(t),
|
|
92
|
-
if (c || o.length !==
|
|
93
|
-
const
|
|
65
|
+
function st(e, t, n, c) {
|
|
66
|
+
const o = e.formatToParts(t), l = e.formatToParts(n), s = (d) => d.map((M) => M.value).join("");
|
|
67
|
+
if (c || o.length !== l.length) return `${s(o)}${R}${s(l)}`;
|
|
68
|
+
const m = (d) => o[d].type === l[d].type && o[d].value === l[d].value;
|
|
94
69
|
if (o[0]?.type === "year") {
|
|
95
70
|
let d = 0;
|
|
96
|
-
for (; d < o.length &&
|
|
97
|
-
for (; d > 0 &&
|
|
98
|
-
return d > 0 && d < o.length ? `${
|
|
71
|
+
for (; d < o.length && m(d); ) d += 1;
|
|
72
|
+
for (; d > 0 && l[d - 1].type !== "literal"; ) d -= 1;
|
|
73
|
+
return d > 0 && d < o.length ? `${s(o)}${R}${s(l.slice(d))}` : `${s(o)}${R}${s(l)}`;
|
|
99
74
|
}
|
|
100
75
|
let u = o.length;
|
|
101
|
-
for (; u > 0 &&
|
|
76
|
+
for (; u > 0 && m(u - 1); ) u -= 1;
|
|
102
77
|
for (; u < o.length && o[u].type !== "literal"; ) u += 1;
|
|
103
|
-
return u > 0 && u < o.length ? `${
|
|
78
|
+
return u > 0 && u < o.length ? `${s(o.slice(0, u))}${R}${s(l)}` : `${s(o)}${R}${s(l)}`;
|
|
104
79
|
}
|
|
105
80
|
var O = (e) => String(e).padStart(2, "0");
|
|
106
|
-
function
|
|
81
|
+
function N(e) {
|
|
107
82
|
return `${e.getFullYear()}-${O(e.getMonth() + 1)}-${O(e.getDate())}`;
|
|
108
83
|
}
|
|
109
|
-
function
|
|
84
|
+
function ke(e, t) {
|
|
110
85
|
const n = `${O(e.getHours())}:${O(e.getMinutes())}`;
|
|
111
86
|
return t === "second" ? `${n}:${O(e.getSeconds())}` : n;
|
|
112
87
|
}
|
|
113
88
|
function X(e, t) {
|
|
114
|
-
return `${
|
|
89
|
+
return `${N(e)}T${ke(e, t)}`;
|
|
115
90
|
}
|
|
116
91
|
function j(e) {
|
|
117
92
|
const t = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2}))?)?$/.exec(e);
|
|
118
93
|
if (!t) return;
|
|
119
|
-
const [, n, c, o,
|
|
94
|
+
const [, n, c, o, l, s, m] = t, u = new Date(Number(n), Number(c) - 1, Number(o), Number(l ?? 0), Number(s ?? 0), Number(m ?? 0), 0);
|
|
120
95
|
return Number.isNaN(u.getTime()) ? void 0 : u;
|
|
121
96
|
}
|
|
122
97
|
function ye(e, t, n, c) {
|
|
123
98
|
const o = e < 100 ? 2e3 + e : e;
|
|
124
99
|
if (t < 1 || t > 12 || n < 1 || n > 31) return;
|
|
125
|
-
const [
|
|
126
|
-
if (
|
|
127
|
-
const u = new Date(o, t - 1, n,
|
|
100
|
+
const [l = 0, s = 0, m = 0] = c;
|
|
101
|
+
if (l > 23 || s > 59 || m > 59) return;
|
|
102
|
+
const u = new Date(o, t - 1, n, l, s, m, 0);
|
|
128
103
|
return u.getMonth() === t - 1 && u.getDate() === n ? u : void 0;
|
|
129
104
|
}
|
|
130
|
-
function
|
|
105
|
+
function ut(e, t) {
|
|
131
106
|
const n = e.trim();
|
|
132
107
|
if (n === "") return;
|
|
133
108
|
const c = (n.match(/\d+/g) ?? []).map(Number);
|
|
134
109
|
if (c.length >= 3) {
|
|
135
|
-
const
|
|
136
|
-
if (/\bpm\b/i.test(n) &&
|
|
137
|
-
const [
|
|
138
|
-
return ye(
|
|
110
|
+
const l = c.slice(3);
|
|
111
|
+
if (/\bpm\b/i.test(n) && l[0] !== void 0 && l[0] < 12 ? l[0] += 12 : /\bam\b/i.test(n) && l[0] === 12 && (l[0] = 0), /^\d{4}\D/.test(n)) {
|
|
112
|
+
const [m, u, d] = c;
|
|
113
|
+
return ye(m, u, d, l);
|
|
139
114
|
}
|
|
140
|
-
const
|
|
141
|
-
if (
|
|
142
|
-
|
|
143
|
-
}),
|
|
144
|
-
const
|
|
145
|
-
if (
|
|
115
|
+
const s = {};
|
|
116
|
+
if (ot(t).forEach((m, u) => {
|
|
117
|
+
s[m] = c[u];
|
|
118
|
+
}), s.year != null && s.month != null && s.day != null) {
|
|
119
|
+
const m = ye(s.year, s.month, s.day, l);
|
|
120
|
+
if (m) return m;
|
|
146
121
|
}
|
|
147
122
|
}
|
|
148
123
|
if (!/[a-z]/i.test(n) || c.length < 2 || !/\b\d{4}\b/.test(n)) return;
|
|
@@ -160,31 +135,31 @@ function z(e, t) {
|
|
|
160
135
|
const n = new Date(e);
|
|
161
136
|
return t && n.setHours(t.getHours(), t.getMinutes(), t.getSeconds(), 0), n;
|
|
162
137
|
}
|
|
163
|
-
var
|
|
164
|
-
function
|
|
138
|
+
var ct = (e) => new Date(e.getFullYear(), e.getMonth(), 1), dt = (e) => new Date(e.getFullYear(), e.getMonth() + 1, 0), ft = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()), xe = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate(), 23, 59, 59, 999), De = (e, t) => e && e > t ? e : t, Ne = (e, t) => e && e < t ? e : t;
|
|
139
|
+
function mt(e) {
|
|
165
140
|
if (e?.hidden != null) return null;
|
|
166
141
|
let t, n;
|
|
167
142
|
const c = e?.disabled == null ? [] : Array.isArray(e.disabled) ? e.disabled : [e.disabled];
|
|
168
143
|
for (const o of c) {
|
|
169
144
|
if (o == null || typeof o != "object" || o instanceof Date || Object.keys(o).length !== 1) return null;
|
|
170
|
-
if ("before" in o && o.before instanceof Date) t = De(t,
|
|
171
|
-
else if ("after" in o && o.after instanceof Date) n =
|
|
145
|
+
if ("before" in o && o.before instanceof Date) t = De(t, ft(o.before));
|
|
146
|
+
else if ("after" in o && o.after instanceof Date) n = Ne(n, xe(o.after));
|
|
172
147
|
else return null;
|
|
173
148
|
}
|
|
174
|
-
return e?.startMonth && (t = De(t,
|
|
149
|
+
return e?.startMonth && (t = De(t, ct(e.startMonth))), e?.endMonth && (n = Ne(n, xe(dt(e.endMonth)))), {
|
|
175
150
|
min: t,
|
|
176
151
|
max: n
|
|
177
152
|
};
|
|
178
153
|
}
|
|
179
|
-
var
|
|
180
|
-
function
|
|
181
|
-
const e =
|
|
154
|
+
var Me = "(pointer: coarse)";
|
|
155
|
+
function ht() {
|
|
156
|
+
const e = Ue((t) => {
|
|
182
157
|
if (typeof window > "u" || !window.matchMedia) return () => {
|
|
183
158
|
};
|
|
184
|
-
const n = window.matchMedia(
|
|
159
|
+
const n = window.matchMedia(Me);
|
|
185
160
|
return n.addEventListener("change", t), () => n.removeEventListener("change", t);
|
|
186
161
|
}, []);
|
|
187
|
-
return
|
|
162
|
+
return Je(e, () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(Me).matches, () => !1);
|
|
188
163
|
}
|
|
189
164
|
function ee({ label: e, value: t, time: n, disabled: c, onChange: o }) {
|
|
190
165
|
return /* @__PURE__ */ y(te, { children: [/* @__PURE__ */ f("span", {
|
|
@@ -197,28 +172,28 @@ function ee({ label: e, value: t, time: n, disabled: c, onChange: o }) {
|
|
|
197
172
|
step: $e[n],
|
|
198
173
|
disabled: c,
|
|
199
174
|
"aria-label": e,
|
|
200
|
-
value: t ?
|
|
201
|
-
onChange: (
|
|
175
|
+
value: t ? ke(t, n) : "",
|
|
176
|
+
onChange: (l) => o(l.target.value),
|
|
202
177
|
className: p("text-pho-primary w-full bg-transparent text-base tabular-nums outline-none", "[&::-webkit-calendar-picker-indicator]:hidden")
|
|
203
178
|
})
|
|
204
179
|
})] });
|
|
205
180
|
}
|
|
206
|
-
function
|
|
207
|
-
const { mode: t = "single", defaultValue: n, onValueChange: c, label: o, hint:
|
|
208
|
-
C || (
|
|
209
|
-
},
|
|
210
|
-
i ? Z(!1) : (Z(!0), ue(null)), oe || Oe(r), i ?
|
|
211
|
-
},
|
|
212
|
-
|
|
181
|
+
function pt(e) {
|
|
182
|
+
const { mode: t = "single", defaultValue: n, onValueChange: c, label: o, hint: l, placeholder: s, invalid: m, disabled: u, required: d, size: M = "md", width: $ = "fill", time: a, locales: G, calendarProps: T, id: Ie, className: ne, selectedPreset: H, align: Fe = "start", "aria-label": re } = e, Y = e.presets, { minDays: Pe, maxDays: Re } = e, oe = "value" in e, [Ae, Oe] = x(n), _ = oe ? e.value : Ae, [C, S] = x(!1), E = Q(0), q = s ?? (t === "range" ? "Pick a date range" : it(G, a)), _e = We(), k = Ie ?? _e, K = l ? `${k}-hint` : void 0, ae = `${k}-calendar`, [ie, le] = x(!1), B = (r = !1) => {
|
|
183
|
+
C || (E.current = 0, F(void 0), le(r), S(!0));
|
|
184
|
+
}, se = c, b = (r, i) => {
|
|
185
|
+
i ? Z(!1) : (Z(!0), ue(null)), oe || Oe(r), i ? se?.(r, i) : se?.(r);
|
|
186
|
+
}, v = t === "single" ? _ : void 0, h = t === "range" ? _ : void 0, Le = v ?? h?.from, [Ve, w] = x(null), [U, ue] = x(null), [je, Z] = x(!1);
|
|
187
|
+
Ze(() => {
|
|
213
188
|
Z(!1);
|
|
214
189
|
}, [H]);
|
|
215
|
-
const W = H && !je ? H : U && U.key === we(_) ? U.label : null, I = Ve ?? W ??
|
|
190
|
+
const W = H && !je ? H : U && U.key === we(_) ? U.label : null, I = Ve ?? W ?? lt(_, G, a), ze = Math.max(I.length, t === "range" ? 0 : q.length, 1), ce = $ === "hug" && t === "range", Ge = (r) => {
|
|
216
191
|
const i = typeof r.value == "function" ? r.value() : r.value;
|
|
217
192
|
ue({
|
|
218
193
|
label: r.label,
|
|
219
194
|
key: we(i)
|
|
220
|
-
}), w(null),
|
|
221
|
-
}, [He, F] = x(void 0), [Ye] = x(() =>
|
|
195
|
+
}), w(null), b(i, { preset: r }), S(!1);
|
|
196
|
+
}, [He, F] = x(void 0), [Ye] = x(() => T?.today ?? /* @__PURE__ */ new Date()), de = He ?? T?.defaultMonth ?? Le ?? Ye, J = Q(null), fe = Q(null), qe = ht(), D = mt(T), Ke = qe && t === "single" && D != null && !Y?.length, Be = /* @__PURE__ */ y(te, { children: [/* @__PURE__ */ f(he, { className: "text-pho-secondary size-4 shrink-0" }), /* @__PURE__ */ f("span", {
|
|
222
197
|
className: p("min-w-0 flex-1 truncate", I === "" && "text-pho-placeholder"),
|
|
223
198
|
children: I === "" ? q : I
|
|
224
199
|
})] });
|
|
@@ -226,7 +201,7 @@ function vt(e) {
|
|
|
226
201
|
className: p("flex flex-col gap-1.5", $ === "hug" ? "w-fit" : "w-full"),
|
|
227
202
|
children: [
|
|
228
203
|
o ? /* @__PURE__ */ y("label", {
|
|
229
|
-
htmlFor:
|
|
204
|
+
htmlFor: k,
|
|
230
205
|
className: "text-pho-secondary flex w-fit cursor-default items-center gap-0.5 text-base font-medium",
|
|
231
206
|
children: [o, d ? /* @__PURE__ */ f("span", {
|
|
232
207
|
className: "text-pho-brand",
|
|
@@ -234,37 +209,37 @@ function vt(e) {
|
|
|
234
209
|
}) : null]
|
|
235
210
|
}) : null,
|
|
236
211
|
Ke ? /* @__PURE__ */ y("div", {
|
|
237
|
-
"data-invalid":
|
|
238
|
-
className: p(
|
|
212
|
+
"data-invalid": m || void 0,
|
|
213
|
+
className: p(ve, Xe, $ === "hug" ? "w-fit" : "w-full", ge[M], be[M], ne),
|
|
239
214
|
children: [Be, /* @__PURE__ */ f("input", {
|
|
240
|
-
id:
|
|
215
|
+
id: k,
|
|
241
216
|
type: a ? "datetime-local" : "date",
|
|
242
217
|
step: a ? $e[a] : void 0,
|
|
243
|
-
min: D?.min ? a ? X(g(D.min, a), a) :
|
|
244
|
-
max: D?.max ? a ? X(g(D.max, a), a) :
|
|
218
|
+
min: D?.min ? a ? X(g(D.min, a), a) : N(D.min) : void 0,
|
|
219
|
+
max: D?.max ? a ? X(g(D.max, a), a) : N(D.max) : void 0,
|
|
245
220
|
required: d,
|
|
246
221
|
disabled: u,
|
|
247
222
|
"aria-label": re,
|
|
248
223
|
"aria-describedby": K,
|
|
249
|
-
value:
|
|
224
|
+
value: v ? a ? X(v, a) : N(v) : "",
|
|
250
225
|
onChange: (r) => {
|
|
251
226
|
const i = j(r.target.value);
|
|
252
|
-
|
|
227
|
+
b(i ? g(i, a) : void 0);
|
|
253
228
|
},
|
|
254
229
|
className: "absolute inset-0 size-full cursor-pointer opacity-0"
|
|
255
230
|
})]
|
|
256
231
|
}) : /* @__PURE__ */ y(V.Root, {
|
|
257
232
|
open: C,
|
|
258
233
|
onOpenChange: (r, i) => {
|
|
259
|
-
!r && i.reason === "outside-press" && i.event.target instanceof Node && J.current?.contains(i.event.target) || (r ? (
|
|
234
|
+
!r && i.reason === "outside-press" && i.event.target instanceof Node && J.current?.contains(i.event.target) || (r ? (E.current = 0, F(void 0)) : (w(null), le(!1)), S(r));
|
|
260
235
|
},
|
|
261
236
|
children: [/* @__PURE__ */ y("div", {
|
|
262
237
|
ref: J,
|
|
263
|
-
"data-invalid":
|
|
238
|
+
"data-invalid": m || void 0,
|
|
264
239
|
"data-popup-open": C || void 0,
|
|
265
|
-
className: p(
|
|
266
|
-
children: [/* @__PURE__ */ f(
|
|
267
|
-
id:
|
|
240
|
+
className: p(ve, Qe, $ === "hug" ? "w-fit" : "w-full", ge[M], be[M], ne),
|
|
241
|
+
children: [/* @__PURE__ */ f(he, { className: "text-pho-secondary size-4 shrink-0" }), /* @__PURE__ */ f("input", {
|
|
242
|
+
id: k,
|
|
268
243
|
type: "text",
|
|
269
244
|
readOnly: t === "range",
|
|
270
245
|
disabled: u,
|
|
@@ -284,16 +259,16 @@ function vt(e) {
|
|
|
284
259
|
onChange: (r) => {
|
|
285
260
|
const i = r.target.value;
|
|
286
261
|
if (w(i), i.trim() === "") {
|
|
287
|
-
|
|
262
|
+
b(void 0);
|
|
288
263
|
return;
|
|
289
264
|
}
|
|
290
|
-
const P =
|
|
291
|
-
P && (
|
|
265
|
+
const P = ut(i, G);
|
|
266
|
+
P && (b(g(P, a)), F(P));
|
|
292
267
|
},
|
|
293
268
|
onBlur: () => w(null),
|
|
294
269
|
onKeyDown: (r) => {
|
|
295
270
|
if (r.key === "Escape" && C) {
|
|
296
|
-
r.preventDefault(), w(null),
|
|
271
|
+
r.preventDefault(), w(null), S(!1);
|
|
297
272
|
return;
|
|
298
273
|
}
|
|
299
274
|
if (r.key === "ArrowDown") {
|
|
@@ -329,100 +304,100 @@ function vt(e) {
|
|
|
329
304
|
type: "button",
|
|
330
305
|
"aria-pressed": r.label === W,
|
|
331
306
|
onClick: () => Ge(r),
|
|
332
|
-
className: p(
|
|
307
|
+
className: p(et, r.label === W && tt),
|
|
333
308
|
children: r.label
|
|
334
309
|
}, r.label))
|
|
335
|
-
}) : null, /* @__PURE__ */ y("div", { children: [t === "range" ? /* @__PURE__ */ f(
|
|
336
|
-
...
|
|
310
|
+
}) : null, /* @__PURE__ */ y("div", { children: [t === "range" ? /* @__PURE__ */ f(pe, {
|
|
311
|
+
...T,
|
|
337
312
|
mode: "range",
|
|
338
313
|
min: Pe,
|
|
339
314
|
max: Re,
|
|
340
315
|
month: de,
|
|
341
316
|
onMonthChange: F,
|
|
342
317
|
autoFocus: ie,
|
|
343
|
-
selected:
|
|
318
|
+
selected: h,
|
|
344
319
|
onSelect: (r, i) => {
|
|
345
|
-
const P =
|
|
346
|
-
if (
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
from:
|
|
350
|
-
to: new Date(
|
|
320
|
+
const P = E.current === 0;
|
|
321
|
+
if (E.current += 1, P && h?.to) {
|
|
322
|
+
const me = g(z(i, a ? h.from : void 0), a);
|
|
323
|
+
b({
|
|
324
|
+
from: me,
|
|
325
|
+
to: new Date(me)
|
|
351
326
|
}), w(null);
|
|
352
327
|
return;
|
|
353
328
|
}
|
|
354
329
|
const L = r && {
|
|
355
|
-
from: r.from && g(z(r.from, a ?
|
|
356
|
-
to: r.to && g(z(r.to, a ?
|
|
330
|
+
from: r.from && g(z(r.from, a ? h?.from : void 0), a),
|
|
331
|
+
to: r.to && g(z(r.to, a ? h?.to : void 0), a)
|
|
357
332
|
};
|
|
358
|
-
|
|
333
|
+
b(L), w(null), !a && E.current >= 2 && (!L || L.from && L.to) && S(!1);
|
|
359
334
|
}
|
|
360
|
-
}) : /* @__PURE__ */ f(
|
|
361
|
-
...
|
|
335
|
+
}) : /* @__PURE__ */ f(pe, {
|
|
336
|
+
...T,
|
|
362
337
|
mode: "single",
|
|
363
338
|
month: de,
|
|
364
339
|
onMonthChange: F,
|
|
365
340
|
autoFocus: ie,
|
|
366
|
-
selected:
|
|
341
|
+
selected: v,
|
|
367
342
|
onSelect: (r) => {
|
|
368
|
-
|
|
343
|
+
b(r && g(z(r, a ? v : void 0), a)), w(null), a || S(!1);
|
|
369
344
|
}
|
|
370
345
|
}), a ? /* @__PURE__ */ f("div", {
|
|
371
346
|
className: "border-pho-secondary mt-3 grid grid-cols-[auto_1fr] items-center gap-x-3 gap-y-2 border-t pt-3",
|
|
372
347
|
children: t === "range" ? /* @__PURE__ */ y(te, { children: [/* @__PURE__ */ f(ee, {
|
|
373
348
|
label: "From",
|
|
374
|
-
value:
|
|
349
|
+
value: h?.from,
|
|
375
350
|
time: a,
|
|
376
351
|
onChange: (r) => {
|
|
377
|
-
if (!
|
|
378
|
-
const i = j(`${
|
|
379
|
-
i &&
|
|
380
|
-
...
|
|
352
|
+
if (!h?.from) return;
|
|
353
|
+
const i = j(`${N(h.from)}T${r}`);
|
|
354
|
+
i && b({
|
|
355
|
+
...h,
|
|
381
356
|
from: g(i, a)
|
|
382
357
|
});
|
|
383
358
|
},
|
|
384
|
-
disabled: !
|
|
359
|
+
disabled: !h?.from
|
|
385
360
|
}), /* @__PURE__ */ f(ee, {
|
|
386
361
|
label: "To",
|
|
387
|
-
value:
|
|
362
|
+
value: h?.to,
|
|
388
363
|
time: a,
|
|
389
364
|
onChange: (r) => {
|
|
390
|
-
if (!
|
|
391
|
-
const i = j(`${
|
|
392
|
-
i &&
|
|
393
|
-
...
|
|
365
|
+
if (!h?.to) return;
|
|
366
|
+
const i = j(`${N(h.to)}T${r}`);
|
|
367
|
+
i && b({
|
|
368
|
+
...h,
|
|
394
369
|
to: g(i, a)
|
|
395
370
|
});
|
|
396
371
|
},
|
|
397
|
-
disabled: !
|
|
372
|
+
disabled: !h?.to
|
|
398
373
|
})] }) : /* @__PURE__ */ f(ee, {
|
|
399
374
|
label: "Time",
|
|
400
|
-
value:
|
|
375
|
+
value: v,
|
|
401
376
|
time: a,
|
|
402
377
|
onChange: (r) => {
|
|
403
|
-
if (!
|
|
404
|
-
const i = j(`${
|
|
405
|
-
i &&
|
|
378
|
+
if (!v) return;
|
|
379
|
+
const i = j(`${N(v)}T${r}`);
|
|
380
|
+
i && b(g(i, a));
|
|
406
381
|
},
|
|
407
|
-
disabled: !
|
|
382
|
+
disabled: !v
|
|
408
383
|
})
|
|
409
384
|
}) : null] })]
|
|
410
385
|
})
|
|
411
386
|
})
|
|
412
387
|
}) })]
|
|
413
388
|
}),
|
|
414
|
-
|
|
389
|
+
l ? /* @__PURE__ */ f("p", {
|
|
415
390
|
id: K,
|
|
416
|
-
className: p("text-pho-description text-base",
|
|
417
|
-
children:
|
|
391
|
+
className: p("text-pho-description text-base", m && "text-pho-error"),
|
|
392
|
+
children: l
|
|
418
393
|
}) : null
|
|
419
394
|
]
|
|
420
395
|
});
|
|
421
396
|
}
|
|
422
|
-
|
|
397
|
+
pt.displayName = "DatePicker";
|
|
423
398
|
export {
|
|
424
|
-
|
|
425
|
-
|
|
399
|
+
lt as n,
|
|
400
|
+
pt as t
|
|
426
401
|
};
|
|
427
402
|
|
|
428
|
-
//# sourceMappingURL=date-picker-
|
|
403
|
+
//# sourceMappingURL=date-picker-BaAkim2u.js.map
|