@revolist/ui 4.0.1-rc → 4.0.2-rc
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 +6 -5
- package/_chunks/calendar-CpaUK7w1.js +248 -0
- package/_chunks/chart-frame-BC99KjGa.js +127 -0
- package/_chunks/choice-chips-Cs4D-3nH.js +110 -0
- package/_chunks/{color-palette-BmZ7kH9R.js → color-palette-BBMFmUNA.js} +41 -41
- package/_chunks/color-picker-D90Jg-M8.js +138 -0
- package/_chunks/compat.module-DDB2pm9O.js +229 -0
- package/_chunks/component-YDcfoOLz.js +859 -0
- package/_chunks/{control-tooltip-BCNzQCXE.js → control-tooltip-ztgmsG7H.js} +29 -29
- package/_chunks/{controller-CmLo-Ajc.js → controller-hRBm_Lfz.js} +15 -15
- package/_chunks/{controls-NEL5tDaz.js → controls-DIum-E66.js} +192 -192
- package/_chunks/{date-control-CYCkb1aQ.js → date-control-BJSzu79z.js} +21 -21
- package/_chunks/date-time-BxPJusp9.js +770 -0
- package/_chunks/{delete-button-DnpmDNEJ.js → delete-button-Bblyah10.js} +1 -1
- package/_chunks/dialog.parts-DBqo3Qwb.js +134 -0
- package/_chunks/{dropdown-CkGQBm1Q.js → dropdown-voWqmwAe.js} +102 -102
- package/_chunks/duration-87U2EoMS.js +271 -0
- package/_chunks/editor-commit-Bq3wSgvr.js +12 -0
- package/_chunks/{editor-popup-B7fu_A_T.js → editor-popup-D3JdS8l3.js} +8 -8
- package/_chunks/framework-mount-C-Zwm44H.js +54 -0
- package/_chunks/hooks.module-CG3gN83z.js +157 -0
- package/_chunks/jsxRuntime.module-F6UFnpT-.js +30 -0
- package/_chunks/mount-DZe_6VtR.js +90 -0
- package/_chunks/native.view-ByyZ1CT5.js +32 -0
- package/_chunks/{number-input-NnH57J4j.js → number-input-BeIadZuL.js} +89 -89
- package/_chunks/picker-DpP7iQLA.js +122 -0
- package/_chunks/preact.module-BBM36DnO.js +290 -0
- package/_chunks/{rating-choice-CWAsNQNS.js → rating-choice-Ca8ZBty3.js} +10 -10
- package/_chunks/reorder-list-Cc3KmfAN.js +59 -0
- package/_chunks/request-trail-IdNiFvKH.js +347 -0
- package/_chunks/{rich-text-2Rla349o.js → rich-text-BzI1DyfF.js} +167 -167
- package/_vendor/preact/LICENSE +21 -0
- package/_vendor/preact/compat/src/index.d.ts +353 -0
- package/_vendor/preact/compat/src/suspense-list.d.ts +16 -0
- package/_vendor/preact/compat/src/suspense.d.ts +19 -0
- package/_vendor/preact/hooks/src/index.d.ts +145 -0
- package/_vendor/preact/src/dom.d.ts +2548 -0
- package/_vendor/preact/src/index.d.ts +373 -0
- package/_vendor/preact/src/jsx.d.ts +2958 -0
- package/activity-message.d.ts +1 -1
- package/activity-message.js +16 -16
- package/ai/components.d.ts +1 -1
- package/ai/index.js +2 -2
- package/ai/request-trail.d.ts +1 -1
- package/ai/translation-context.d.ts +1 -1
- package/alert.d.ts +2 -2
- package/assignee/field.d.ts +2 -2
- package/assignee/index.js +87 -87
- package/assignee/layout.d.ts +2 -2
- package/assignee/picker.d.ts +1 -1
- package/avatar/index.js +25 -25
- package/avatar/index.view.d.ts +1 -1
- package/brush-range/component.d.ts +1 -1
- package/brush-range/component.js +30 -30
- package/buttons/delete-button.js +1 -1
- package/buttons/remove-button.d.ts +1 -1
- package/buttons/remove-button.js +3 -3
- package/buttons/svg-button.d.ts +1 -1
- package/buttons/svg-button.js +35 -35
- package/calendar/calendar.d.ts +1 -1
- package/calendar/calendar.js +1 -1
- package/calendar/caption.d.ts +1 -1
- package/calendar/day.d.ts +1 -1
- package/calendar/day.js +4 -4
- package/calendar/header.d.ts +1 -1
- package/calendar/header.js +35 -35
- package/calendar/index.js +2 -2
- package/calendar/month-grid.d.ts +1 -1
- package/calendar/month-grid.js +37 -37
- package/calendar/picker.d.ts +1 -1
- package/calendar/types.d.ts +1 -1
- package/calendar/year-grid.d.ts +1 -1
- package/calendar/year-grid.js +12 -12
- package/checkbox/index.d.ts +2 -2
- package/checkbox/index.js +9 -9
- package/choice-chips/index.d.ts +1 -1
- package/choice-chips/index.js +1 -1
- package/color-palette/color-palette.d.ts +1 -1
- package/color-palette/color-palette.js +1 -1
- package/color-palette/color-picker.d.ts +1 -1
- package/color-palette/color-picker.js +2 -2
- package/component-catalog.d.ts +19 -19
- package/control-presentation.js +18 -18
- package/controls.d.ts +4 -4
- package/controls.js +1 -1
- package/core/editor-commit.d.ts +1 -1
- package/core/editor-popup.d.ts +1 -1
- package/core/editor-popup.js +1 -1
- package/date-time/date-control.d.ts +1 -1
- package/date-time/field.d.ts +2 -2
- package/date-time/index.js +1 -1
- package/date-time/picker.d.ts +1 -1
- package/date-time/time-control.d.ts +1 -1
- package/date-time/time-selection.d.ts +1 -1
- package/date-time/types.d.ts +1 -1
- package/dialog/dialog-action-footer.view.d.ts +1 -1
- package/dialog/dialog.dom.js +52 -52
- package/dialog/dialog.parts.d.ts +18 -18
- package/dialog/dialog.parts.js +1 -1
- package/dialog/dialog.preact.d.ts +1 -1
- package/dialog/dialog.preact.js +6 -6
- package/distribution-chart/area-chart.d.ts +1 -1
- package/distribution-chart/area-chart.js +25 -25
- package/distribution-chart/bar-chart.d.ts +1 -1
- package/distribution-chart/bar-chart.js +6 -6
- package/distribution-chart/chart-frame.d.ts +1 -1
- package/distribution-chart/index.d.ts +1 -1
- package/distribution-chart/index.js +6 -6
- package/distribution-chart/line-chart.d.ts +1 -1
- package/distribution-chart/line-chart.js +9 -9
- package/distribution-chart/types.d.ts +1 -1
- package/dropdown/content.d.ts +1 -1
- package/dropdown/content.js +83 -82
- package/dropdown/dropdown.service.d.ts +1 -1
- package/dropdown/dropdown.service.js +9 -9
- package/dropdown/index.js +1 -1
- package/dropdown/lookup-field.d.ts +1 -1
- package/dropdown/lookup-field.js +41 -41
- package/dropdown/popup.d.ts +1 -1
- package/dropdown/popup.js +17 -16
- package/duration/controls.d.ts +1 -1
- package/duration/index.d.ts +2 -2
- package/duration/index.js +1 -1
- package/editor-actions.d.ts +1 -1
- package/editor-actions.js +21 -20
- package/editor-layout/index.d.ts +1 -1
- package/editor-layout/index.js +27 -27
- package/field-configurator.d.ts +1 -1
- package/field-configurator.js +93 -93
- package/field-reorder.hook.js +32 -32
- package/filter/filters/slider/preact.js +3 -3
- package/filter/filters/slider/single.d.ts +1 -1
- package/filter/filters/slider/single.js +23 -23
- package/filter-badge.d.ts +1 -1
- package/filter-badge.js +23 -22
- package/filter-controls.d.ts +1 -1
- package/filter-controls.js +31 -31
- package/form-controls/index.js +20 -20
- package/form-controls/presentation.d.ts +1 -1
- package/form-controls/presentation.js +44 -44
- package/formatting/comparison-preview.d.ts +1 -1
- package/formatting/control-tooltip.d.ts +1 -1
- package/formatting/icon-controls.d.ts +1 -1
- package/formatting/index.js +99 -98
- package/formatting/inspector-section.d.ts +1 -1
- package/formatting/typography-controls.d.ts +1 -1
- package/framework-mount.d.ts +1 -1
- package/framework.js +19 -19
- package/icons/icon.d.ts +1 -1
- package/icons/icon.js +1 -1
- package/legend.d.ts +1 -1
- package/legend.js +12 -12
- package/masked-input/index.d.ts +1 -1
- package/masked-input/index.js +109 -109
- package/native-control.d.ts +11 -11
- package/native-control.js +12 -12
- package/native.js +39 -39
- package/number-input/index.d.ts +1 -1
- package/number-input/index.js +1 -1
- package/package.json +1 -2
- package/pdf-viewer/component.d.ts +1 -1
- package/pdf-viewer/controller.js +1 -1
- package/pdf-viewer/header.d.ts +1 -1
- package/pdf-viewer/index.js +13 -13
- package/pdf-viewer/search-bar.d.ts +1 -1
- package/pdf-viewer/status.d.ts +1 -1
- package/pdf-viewer/toolbar.d.ts +1 -1
- package/pickers.d.ts +1 -1
- package/preact-mount.d.ts +1 -1
- package/preact-mount.js +1 -1
- package/preact.js +14 -14
- package/rating-choice.d.ts +1 -1
- package/rating-choice.js +1 -1
- package/react-adapter.d.ts +1 -1
- package/react.js +19 -19
- package/reorder-list.d.ts +1 -1
- package/reorder-list.js +1 -1
- package/resource-picker/resource-picker-avatar.d.ts +1 -1
- package/resource-picker/resource-picker-avatar.js +14 -14
- package/resource-picker/resource-picker-option.d.ts +1 -1
- package/resource-picker/resource-picker-option.js +28 -28
- package/resource-picker/resource-picker-popup.d.ts +1 -1
- package/resource-picker/resource-picker-popup.js +3 -3
- package/resource-picker/resource-picker.d.ts +1 -1
- package/resource-picker/resource-picker.js +88 -88
- package/rich-text/index.d.ts +1 -1
- package/rich-text/index.js +1 -1
- package/rich-text/toolbar.d.ts +1 -1
- package/search-input/index.js +12 -12
- package/segmented-switch/index.d.ts +1 -1
- package/segmented-switch/index.js +1 -1
- package/status-feedback/render.d.ts +2 -2
- package/status-feedback/render.js +13 -13
- package/surfaces.js +34 -34
- package/svelte.js +2 -2
- package/switch/index.js +15 -15
- package/time-grid.d.ts +1 -1
- package/time-grid.js +58 -58
- package/timeline-track/component.d.ts +1 -1
- package/timeline-track/index.js +75 -75
- package/vue-adapter.d.ts +1 -1
- package/vue.d.ts +116 -116
- package/vue.js +121 -121
- package/_chunks/calendar-BsDxCYhI.js +0 -248
- package/_chunks/chart-frame-BvxbmEU9.js +0 -126
- package/_chunks/choice-chips-0HfOnK_4.js +0 -110
- package/_chunks/color-picker-BRv-__AM.js +0 -138
- package/_chunks/component-D4PH5UZT.js +0 -859
- package/_chunks/date-time-DjucJmbc.js +0 -769
- package/_chunks/dialog.parts-Dt3KinUz.js +0 -134
- package/_chunks/duration-BCaktcvz.js +0 -270
- package/_chunks/editor-commit-D6Rf5rGz.js +0 -12
- package/_chunks/framework-mount-BKIOsvY-.js +0 -54
- package/_chunks/mount-0-8opf1j.js +0 -90
- package/_chunks/native.view-8q_nwQ7x.js +0 -32
- package/_chunks/picker-oazJ7sO_.js +0 -121
- package/_chunks/reorder-list-BV3kZXso.js +0 -59
- package/_chunks/request-trail-D0oVzdRd.js +0 -347
|
@@ -0,0 +1,770 @@
|
|
|
1
|
+
import { i as e } from "./preact.module-BBM36DnO.js";
|
|
2
|
+
import { c as t, i as n, n as r, r as i, t as a } from "./hooks.module-CG3gN83z.js";
|
|
3
|
+
import { t as o } from "./jsxRuntime.module-F6UFnpT-.js";
|
|
4
|
+
import { SvgIcon as s } from "../icons/icon.js";
|
|
5
|
+
import { createPreactElement as c, releasePreactElement as l } from "../preact-mount.js";
|
|
6
|
+
import { Input as u } from "../native-control.js";
|
|
7
|
+
import { n as d, z as f } from "./controls-DIum-E66.js";
|
|
8
|
+
import { createControlId as p } from "../core/control-id.js";
|
|
9
|
+
import { EditorList as m, EditorListItem as h } from "../editor-layout/index.js";
|
|
10
|
+
import { i as g, s as _ } from "./iso-B0YHBK7m.js";
|
|
11
|
+
import { f as v, h as y, m as b, p as x } from "./model-mPO2tG2f.js";
|
|
12
|
+
import { n as S, t as C } from "./date-control-BJSzu79z.js";
|
|
13
|
+
import { t as w } from "./picker-DpP7iQLA.js";
|
|
14
|
+
import { t as T } from "./editor-popup-D3JdS8l3.js";
|
|
15
|
+
import { n as E } from "./editor-commit-Bq3wSgvr.js";
|
|
16
|
+
import { EditorActions as D } from "../editor-actions.js";
|
|
17
|
+
//#region ../dates/src/date-controls.ts
|
|
18
|
+
var O = /^(\d{4})-(\d{2})-(\d{2})$/, k = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?$/, A = /^(\d{2}):(\d{2})(?::(\d{2}))?$/;
|
|
19
|
+
function j(e, t, n = "minute") {
|
|
20
|
+
if (Number.isNaN(t.getTime())) return "";
|
|
21
|
+
let r = `${N(t.getHours())}:${N(t.getMinutes())}${n === "second" ? `:${N(t.getSeconds())}` : ""}`;
|
|
22
|
+
if (e === "time") return r;
|
|
23
|
+
let i = g(t);
|
|
24
|
+
return e === "date" ? i : `${i}T${r}`;
|
|
25
|
+
}
|
|
26
|
+
function M(e, t, n = /* @__PURE__ */ new Date()) {
|
|
27
|
+
if (e === "time") {
|
|
28
|
+
let e = A.exec(t);
|
|
29
|
+
if (!e) return;
|
|
30
|
+
let r = Number(e[1]), i = Number(e[2]), a = Number(e[3] ?? 0);
|
|
31
|
+
if (r > 23 || i > 59 || a > 59 || Number.isNaN(n.getTime())) return;
|
|
32
|
+
let o = new Date(n.getTime());
|
|
33
|
+
return o.setHours(r, i, a, 0), o;
|
|
34
|
+
}
|
|
35
|
+
let r = e === "date" ? O.exec(t) : k.exec(t);
|
|
36
|
+
if (!r) return;
|
|
37
|
+
let i = Number(r[1]), a = Number(r[2]), o = Number(r[3]), s = Number(r[4] ?? 0), c = Number(r[5] ?? 0), l = Number(r[6] ?? 0), u = Number((r[7] ?? "").padEnd(3, "0")), d = /* @__PURE__ */ new Date(0);
|
|
38
|
+
if (d.setFullYear(i, a - 1, o), d.setHours(s, c, l, u), !(a < 1 || a > 12 || o < 1 || d.getFullYear() !== i || d.getMonth() !== a - 1 || d.getDate() !== o || d.getHours() !== s || d.getMinutes() !== c || d.getSeconds() !== l || d.getMilliseconds() !== u)) return d;
|
|
39
|
+
}
|
|
40
|
+
function N(e) {
|
|
41
|
+
return String(e).padStart(2, "0");
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region ../dates/src/civil-time.ts
|
|
45
|
+
var P = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?$/;
|
|
46
|
+
function F(e) {
|
|
47
|
+
let t = /* @__PURE__ */ new Date(0);
|
|
48
|
+
return t.setUTCFullYear(e.year, e.month - 1, e.day), t.setUTCHours(e.hour, e.minute, e.second, 0), t.getTime();
|
|
49
|
+
}
|
|
50
|
+
function I(e) {
|
|
51
|
+
let t = P.exec(e);
|
|
52
|
+
if (!t) return;
|
|
53
|
+
let n = {
|
|
54
|
+
year: Number(t[1]),
|
|
55
|
+
month: Number(t[2]),
|
|
56
|
+
day: Number(t[3]),
|
|
57
|
+
hour: Number(t[4]),
|
|
58
|
+
minute: Number(t[5]),
|
|
59
|
+
second: Number(t[6] ?? 0)
|
|
60
|
+
}, r = new Date(F(n)), i = {
|
|
61
|
+
year: r.getUTCFullYear(),
|
|
62
|
+
month: r.getUTCMonth() + 1,
|
|
63
|
+
day: r.getUTCDate(),
|
|
64
|
+
hour: r.getUTCHours(),
|
|
65
|
+
minute: r.getUTCMinutes(),
|
|
66
|
+
second: r.getUTCSeconds()
|
|
67
|
+
};
|
|
68
|
+
return Object.keys(n).every((e) => n[e] === i[e]) ? n : void 0;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region ../dates/src/temporal-controls.ts
|
|
72
|
+
function L(e) {
|
|
73
|
+
return e.split("T")[0];
|
|
74
|
+
}
|
|
75
|
+
function R(e) {
|
|
76
|
+
return e.includes("T") ? e.split("T")[1] : e;
|
|
77
|
+
}
|
|
78
|
+
function z(e, t, n) {
|
|
79
|
+
return n === "datetime" ? `${e}T${t.includes("T") ? R(t) : "00:00"}` : e;
|
|
80
|
+
}
|
|
81
|
+
function B(e, t, n) {
|
|
82
|
+
return n === "datetime" ? `${L(e)}T${t}` : t;
|
|
83
|
+
}
|
|
84
|
+
function V(e, t) {
|
|
85
|
+
return e === "date" ? _(t) : e === "datetime" ? !!I(t.replace(/(\d{2}:\d{2}:\d{2})\.\d{1,3}$/, "$1")) : !!M(e, t);
|
|
86
|
+
}
|
|
87
|
+
function H(e) {
|
|
88
|
+
let t = M("time", e);
|
|
89
|
+
return t ? t.getHours() * 3600 + t.getMinutes() * 60 + t.getSeconds() : void 0;
|
|
90
|
+
}
|
|
91
|
+
function U(e, t) {
|
|
92
|
+
let n = H(e);
|
|
93
|
+
if (n === void 0) return !1;
|
|
94
|
+
let r = t.min ? H(t.min) : void 0, i = t.max ? H(t.max) : void 0;
|
|
95
|
+
return (r === void 0 || n >= r) && (i === void 0 || n <= i) && (t.step === void 0 || t.step > 0 && (n - (r ?? 0)) % t.step === 0);
|
|
96
|
+
}
|
|
97
|
+
function W(e, t, n = "minute", r) {
|
|
98
|
+
let i = M("time", e);
|
|
99
|
+
return i ? new Intl.DateTimeFormat(r ?? (t === "12h" ? "en-US" : "en-GB"), {
|
|
100
|
+
hour: "2-digit",
|
|
101
|
+
minute: "2-digit",
|
|
102
|
+
...n === "second" ? { second: "2-digit" } : {},
|
|
103
|
+
hourCycle: t === "12h" ? "h12" : "h23"
|
|
104
|
+
}).format(i) : e;
|
|
105
|
+
}
|
|
106
|
+
function G(e, t = "minute", n) {
|
|
107
|
+
if (e = e.replace(/[\u200e\u200f\u061c]/g, "").trim(), n) {
|
|
108
|
+
let t = new Intl.NumberFormat(n, { useGrouping: !1 });
|
|
109
|
+
for (let n = 0; n < 10; n++) e = e.split(t.format(n)).join(String(n));
|
|
110
|
+
let r = new Intl.DateTimeFormat(n, {
|
|
111
|
+
hour: "numeric",
|
|
112
|
+
hourCycle: "h12"
|
|
113
|
+
});
|
|
114
|
+
for (let [t, n] of [[1, "AM"], [13, "PM"]]) {
|
|
115
|
+
let i = r.formatToParts(new Date(2e3, 0, 1, t)).find((e) => e.type === "dayPeriod")?.value;
|
|
116
|
+
i && (e = e.replace(i, n));
|
|
117
|
+
}
|
|
118
|
+
let i = new Intl.DateTimeFormat(n, {
|
|
119
|
+
hour: "2-digit",
|
|
120
|
+
minute: "2-digit",
|
|
121
|
+
second: "2-digit",
|
|
122
|
+
hourCycle: "h23"
|
|
123
|
+
}).formatToParts(new Date(2e3, 0, 1, 13, 45, 20));
|
|
124
|
+
for (let t of i) t.type === "literal" && t.value.trim() && (e = e.split(t.value).join(":"));
|
|
125
|
+
e = e.replace(/^\s*(AM|PM)\s*(.*)$/i, "$2 $1");
|
|
126
|
+
}
|
|
127
|
+
let r = M("time", e.trim());
|
|
128
|
+
if (r) return j("time", r, t);
|
|
129
|
+
let i = /^(\d{1,2}):(\d{2})(?::(\d{2}))?\s*([ap])\.?m\.?$/i.exec(e.trim());
|
|
130
|
+
if (!i) return;
|
|
131
|
+
let a = Number(i[1]);
|
|
132
|
+
if (a < 1 || a > 12) return;
|
|
133
|
+
let o = M("time", `${String(a % 12 + (i[4].toLowerCase() === "p" ? 12 : 0)).padStart(2, "0")}:${i[2]}:${i[3] ?? "00"}`);
|
|
134
|
+
return o ? j("time", o, t) : void 0;
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region ../dates/src/time-selection.ts
|
|
138
|
+
function K(e) {
|
|
139
|
+
let t = e.min ? H(e.min) : void 0, n = e.max ? H(e.max) : void 0, r = e.step ?? (e.precision === "second" ? 1 : 60);
|
|
140
|
+
if (!Number.isFinite(r) || r <= 0) return [];
|
|
141
|
+
let i = e.precision === "second" ? 1 : 60, a = [];
|
|
142
|
+
for (let e = 0; e < 86400; e += i) (t === void 0 || e >= t) && (n === void 0 || e <= n) && (e - (t ?? 0)) % r === 0 && a.push(e);
|
|
143
|
+
return a;
|
|
144
|
+
}
|
|
145
|
+
function q(e, t = "minute") {
|
|
146
|
+
let n = (e) => String(e).padStart(2, "0");
|
|
147
|
+
return `${n(Math.floor(e / 3600))}:${n(Math.floor(e / 60) % 60)}${t === "second" ? `:${n(e % 60)}` : ""}`;
|
|
148
|
+
}
|
|
149
|
+
function J(e, t) {
|
|
150
|
+
return e === "12h" || e === "locale" && !!new Intl.DateTimeFormat(t, { hour: "numeric" }).resolvedOptions().hour12;
|
|
151
|
+
}
|
|
152
|
+
function ee(e, t) {
|
|
153
|
+
return new Intl.DateTimeFormat(t, {
|
|
154
|
+
hour: "numeric",
|
|
155
|
+
hourCycle: "h12"
|
|
156
|
+
}).formatToParts(new Date(2e3, 0, 1, e ? 13 : 1)).find((e) => e.type === "dayPeriod")?.value ?? (e ? "PM" : "AM");
|
|
157
|
+
}
|
|
158
|
+
function te(e, t, n) {
|
|
159
|
+
let r = H(t), i = r ?? e[0] ?? 0, a = Math.floor(i / 3600), o = Math.floor(i / 60) % 60, s = i % 60, c = {
|
|
160
|
+
hour: /* @__PURE__ */ new Map(),
|
|
161
|
+
minute: /* @__PURE__ */ new Map(),
|
|
162
|
+
second: /* @__PURE__ */ new Map(),
|
|
163
|
+
period: /* @__PURE__ */ new Map()
|
|
164
|
+
}, l = (e, t, n, r) => {
|
|
165
|
+
let i = c[e].get(t);
|
|
166
|
+
(i === void 0 || Math.abs(n - r) < Math.abs(i - r)) && c[e].set(t, n);
|
|
167
|
+
};
|
|
168
|
+
for (let t of e) {
|
|
169
|
+
let e = Math.floor(t / 3600), r = Math.floor(t / 60) % 60, i = t % 60;
|
|
170
|
+
(!n || Math.floor(e / 12) === Math.floor(a / 12)) && l("hour", e, t, e * 3600 + o * 60 + s), e === a && l("minute", r, t, a * 3600 + r * 60 + s), e === a && r === o && l("second", i, t, a * 3600 + o * 60 + i);
|
|
171
|
+
let c = Math.floor(e / 12);
|
|
172
|
+
l("period", c, t, (a % 12 + c * 12) * 3600 + o * 60 + s);
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
columns: c,
|
|
176
|
+
hour: a,
|
|
177
|
+
minute: o,
|
|
178
|
+
second: s,
|
|
179
|
+
period: Math.floor(a / 12),
|
|
180
|
+
hasValue: r !== void 0
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/date-time/types.ts
|
|
185
|
+
var Y = {
|
|
186
|
+
date: "Date",
|
|
187
|
+
dates: "Dates",
|
|
188
|
+
invalidDate: "Enter a valid date in the indicated format.",
|
|
189
|
+
outOfRange: "The date is outside the allowed range.",
|
|
190
|
+
disabledDate: "This date is unavailable.",
|
|
191
|
+
invalidRange: "Enter a complete range with the start before or equal to the end.",
|
|
192
|
+
selectionCount: "The selection does not meet the allowed count or length.",
|
|
193
|
+
requiredValue: "A value is required.",
|
|
194
|
+
startDate: "Start date",
|
|
195
|
+
endDate: "End date",
|
|
196
|
+
startTime: "Start time",
|
|
197
|
+
endTime: "End time",
|
|
198
|
+
time: "Time",
|
|
199
|
+
hours: "Hour",
|
|
200
|
+
minutes: "Minute",
|
|
201
|
+
seconds: "Second",
|
|
202
|
+
dayPeriod: "Period",
|
|
203
|
+
noTimes: "No available times.",
|
|
204
|
+
invalid: "Enter a valid value within the allowed range.",
|
|
205
|
+
chooseDate: "Choose date",
|
|
206
|
+
chooseTime: "Choose time"
|
|
207
|
+
};
|
|
208
|
+
function X(e, t) {
|
|
209
|
+
return (e === "time" ? t?.chooseTime ?? t?.chooseDate : t?.chooseDate) ?? (e === "time" ? Y.chooseTime : Y.chooseDate);
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/date-time/validation.ts
|
|
213
|
+
function Z(e, t, n = "") {
|
|
214
|
+
let { kind: r = "date", selection: i = "single", value: a, calendar: o = {} } = e, s = {
|
|
215
|
+
...Y,
|
|
216
|
+
...e.text
|
|
217
|
+
}, c = a && !Array.isArray(a) && typeof a == "object" ? a : void 0, l = typeof a == "string" ? a : "", u = c?.from ?? "", d = c?.to ?? "", f = e.required ?? o.required ?? !1, p = c ? [u, d] : Array.isArray(a) ? a : l ? [l] : [], m = (e) => _(e) && (!o.minDate || e >= o.minDate) && (!o.maxDate || e <= o.maxDate) && !o.isDateDisabled?.(e) && !o.isMonthDisabled?.(v(e, o.calendarSystem)), h = (t) => V(r, t) && (r === "time" || m(L(t))) && (r === "date" || U(R(t), {
|
|
218
|
+
min: e.minTime,
|
|
219
|
+
max: e.maxTime,
|
|
220
|
+
step: e.timeStep
|
|
221
|
+
})), g = c && d ? b(L(u), L(d)) : 0, y = i === "multiple" ? p.length : g, S = !p.length && !f || i === "single" || (!o.min || y >= o.min) && (o.max === void 0 || y <= o.max), C = (() => {
|
|
222
|
+
if (r === "time" || !c?.to || !o.excludeDisabled || !p.every(h)) return !0;
|
|
223
|
+
if (g > 366e3) return !1;
|
|
224
|
+
for (let e = L(u); e <= L(d); e = x(e, 1)) if (!m(e)) return !1;
|
|
225
|
+
return !0;
|
|
226
|
+
})(), w = "", T = r === "time" || p.every((e) => {
|
|
227
|
+
let n = L(e);
|
|
228
|
+
if (!_(n)) return !1;
|
|
229
|
+
let r = o.validateSelection?.(n, {
|
|
230
|
+
month: o.month ?? t,
|
|
231
|
+
view: o.defaultView ?? "month",
|
|
232
|
+
referenceDate: o.referenceDate,
|
|
233
|
+
selection: c ? {
|
|
234
|
+
from: L(u),
|
|
235
|
+
to: L(d || u)
|
|
236
|
+
} : {
|
|
237
|
+
from: n,
|
|
238
|
+
to: n
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
return typeof r == "string" && (w = r), r !== !1 && typeof r != "string";
|
|
242
|
+
}), E = !n && S && T && C && (!f || p.length > 0) && p.every(h) && (i !== "multiple" || new Set(p).size === p.length) && (!c || !!d && u <= d) && (i !== "multiple" || r === "date"), D = (t) => e.text?.[t] ?? e.text?.invalid ?? s[t] ?? s.invalid, O = r === "time" ? [] : p.map(L);
|
|
243
|
+
return {
|
|
244
|
+
valid: E,
|
|
245
|
+
errorMessage: n || w || (!p.length && f ? D("requiredValue") : c && (!u || !d) ? D("invalidRange") : O.some((e) => !_(e)) ? D("invalidDate") : O.some((e) => o.minDate && e < o.minDate || o.maxDate && e > o.maxDate) ? D("outOfRange") : O.some((e) => !m(e)) || !C ? D("disabledDate") : c && (!d || u > d) ? D("invalidRange") : !S || i === "multiple" && new Set(p).size !== p.length ? D("selectionCount") : s.invalid),
|
|
246
|
+
validDate: m
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/date-time/time-control.tsx
|
|
251
|
+
function ne({ value: e, label: t, format: r = "locale", precision: i = "minute", locale: a, min: s, max: c, step: l, onChange: d }) {
|
|
252
|
+
let [f, p] = n(!1), [m, h] = n("");
|
|
253
|
+
if (r === "locale") return /* @__PURE__ */ o(u, {
|
|
254
|
+
type: "time",
|
|
255
|
+
"aria-label": t,
|
|
256
|
+
value: e,
|
|
257
|
+
min: s,
|
|
258
|
+
max: c,
|
|
259
|
+
step: l ?? (i === "second" ? 1 : 60),
|
|
260
|
+
onInput: (e) => d(e.currentTarget.value)
|
|
261
|
+
});
|
|
262
|
+
let g = W(e, r, i, a);
|
|
263
|
+
return /* @__PURE__ */ o(u, {
|
|
264
|
+
type: "text",
|
|
265
|
+
"aria-label": t,
|
|
266
|
+
value: f ? m : g,
|
|
267
|
+
"aria-invalid": !!e && !U(e, {
|
|
268
|
+
min: s,
|
|
269
|
+
max: c,
|
|
270
|
+
step: l
|
|
271
|
+
}),
|
|
272
|
+
placeholder: r === "12h" ? "09:00 AM" : "09:00",
|
|
273
|
+
onFocus: () => {
|
|
274
|
+
p(!0), h(g);
|
|
275
|
+
},
|
|
276
|
+
onBlur: () => p(!1),
|
|
277
|
+
onInput: (e) => {
|
|
278
|
+
let t = e.currentTarget.value;
|
|
279
|
+
h(t), d(t ? G(t, i, a) ?? t : "");
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/date-time/time-selection.tsx
|
|
285
|
+
function re({ label: e, accessibleLabel: t, values: n, selected: r, choices: s, display: c, onSelect: l }) {
|
|
286
|
+
let u = a(null), d = r !== void 0 && s.has(r), f = d ? r : n.find((e) => s.has(e));
|
|
287
|
+
i(() => {
|
|
288
|
+
let e = u.current;
|
|
289
|
+
if (!e) return;
|
|
290
|
+
let t = () => {
|
|
291
|
+
let t = e.querySelector("[aria-selected=\"true\"], [tabindex=\"0\"]");
|
|
292
|
+
t && e.clientHeight && (e.scrollTop = t.offsetTop - (e.clientHeight - t.clientHeight) / 2);
|
|
293
|
+
};
|
|
294
|
+
t();
|
|
295
|
+
let n = new ResizeObserver(t);
|
|
296
|
+
return n.observe(e), () => n.disconnect();
|
|
297
|
+
}, [r, f]);
|
|
298
|
+
let p = (e) => {
|
|
299
|
+
let t = s.get(Number(e));
|
|
300
|
+
t !== void 0 && l(t);
|
|
301
|
+
};
|
|
302
|
+
return /* @__PURE__ */ o("div", {
|
|
303
|
+
class: "rv-time-selection__column",
|
|
304
|
+
children: [/* @__PURE__ */ o("span", {
|
|
305
|
+
class: "rv-time-selection__label",
|
|
306
|
+
children: e
|
|
307
|
+
}), /* @__PURE__ */ o(m, {
|
|
308
|
+
label: t,
|
|
309
|
+
listRef: u,
|
|
310
|
+
variant: "plain",
|
|
311
|
+
className: "rv-time-selection__list",
|
|
312
|
+
onSelect: p,
|
|
313
|
+
children: n.map((e) => /* @__PURE__ */ o(h, {
|
|
314
|
+
value: String(e),
|
|
315
|
+
selected: r === e && d,
|
|
316
|
+
disabled: !s.has(e),
|
|
317
|
+
tabIndex: e === f ? 0 : -1,
|
|
318
|
+
onClick: () => p(String(e)),
|
|
319
|
+
children: c(e)
|
|
320
|
+
}, e))
|
|
321
|
+
})]
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
function Q({ value: e, label: t, text: n, onChange: i, format: a = "locale", precision: s = "minute", locale: c, min: l, max: u, step: d }) {
|
|
325
|
+
let f = J(a, c), p = r(() => K({
|
|
326
|
+
min: l,
|
|
327
|
+
max: u,
|
|
328
|
+
step: d,
|
|
329
|
+
precision: s
|
|
330
|
+
}), [
|
|
331
|
+
l,
|
|
332
|
+
u,
|
|
333
|
+
d,
|
|
334
|
+
s
|
|
335
|
+
]), m = r(() => te(p, e, f), [
|
|
336
|
+
p,
|
|
337
|
+
e,
|
|
338
|
+
f
|
|
339
|
+
]), h = r(() => new Intl.NumberFormat(c, {
|
|
340
|
+
minimumIntegerDigits: 2,
|
|
341
|
+
useGrouping: !1
|
|
342
|
+
}), [c]), g = (e) => i(q(e, s)), _ = (e, n, r, i = (e) => h.format(e)) => /* @__PURE__ */ o(re, {
|
|
343
|
+
label: n,
|
|
344
|
+
accessibleLabel: `${t}: ${n}`,
|
|
345
|
+
values: r,
|
|
346
|
+
selected: m.hasValue ? m[e] : void 0,
|
|
347
|
+
choices: m.columns[e],
|
|
348
|
+
display: i,
|
|
349
|
+
onSelect: g
|
|
350
|
+
}), v = (e, t = 0) => Array.from({ length: e }, (e, n) => t + n);
|
|
351
|
+
return /* @__PURE__ */ o("section", {
|
|
352
|
+
class: "rv-time-selection",
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ o("label", {
|
|
355
|
+
class: "rv-time-selection__entry",
|
|
356
|
+
children: [/* @__PURE__ */ o("span", { children: t }), /* @__PURE__ */ o(ne, {
|
|
357
|
+
value: e,
|
|
358
|
+
label: t,
|
|
359
|
+
format: a,
|
|
360
|
+
precision: s,
|
|
361
|
+
locale: c,
|
|
362
|
+
min: l,
|
|
363
|
+
max: u,
|
|
364
|
+
step: d,
|
|
365
|
+
onChange: i
|
|
366
|
+
})]
|
|
367
|
+
}),
|
|
368
|
+
/* @__PURE__ */ o("div", {
|
|
369
|
+
class: `rv-time-selection__columns${s === "second" ? " rv-time-selection__columns--seconds" : ""}`,
|
|
370
|
+
children: [
|
|
371
|
+
_("hour", n.hours, v(f ? 12 : 24, f ? m.period * 12 : 0), (e) => h.format(f ? e % 12 || 12 : e)),
|
|
372
|
+
_("minute", n.minutes, v(60)),
|
|
373
|
+
s === "second" && _("second", n.seconds, v(60))
|
|
374
|
+
]
|
|
375
|
+
}),
|
|
376
|
+
f && /* @__PURE__ */ o("div", {
|
|
377
|
+
class: "rv-time-selection__period",
|
|
378
|
+
children: _("period", n.dayPeriod, [0, 1], (e) => ee(e, c))
|
|
379
|
+
}),
|
|
380
|
+
!p.length && /* @__PURE__ */ o("p", {
|
|
381
|
+
class: "rv-time-selection__empty",
|
|
382
|
+
role: "status",
|
|
383
|
+
children: n.noTimes
|
|
384
|
+
})
|
|
385
|
+
]
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/date-time/picker.tsx
|
|
390
|
+
function ie(r) {
|
|
391
|
+
let { kind: i = "date", selection: a = "single", value: s, onChange: c, calendar: l = {} } = r, u = {
|
|
392
|
+
...Y,
|
|
393
|
+
...r.text
|
|
394
|
+
}, [m] = n(() => p("rv-date-error")), h = (e) => i === "date" ? e : L(e), g = {
|
|
395
|
+
locale: l.locale,
|
|
396
|
+
...typeof r.dateInput == "object" ? r.dateInput : {}
|
|
397
|
+
}, [b, x] = n(r.endpoint === "to" ? "to" : void 0), [S, T] = n(""), E = s && !Array.isArray(s) && typeof s == "object" ? s : void 0, D = typeof s == "string" ? s : "", O = Array.isArray(s) ? s : [], k = E?.from ?? "", A = E?.to ?? "", j = L(i === "time" ? y() : r.endpoint === "to" ? A : k || D || O[0] || ""), [M, N] = n(() => l.defaultMonth ?? v(_(j) ? j : y(), l.calendarSystem)), P = r.required ?? l.required ?? !1, { valid: F, errorMessage: I, validDate: V } = Z(r, M, S);
|
|
398
|
+
t(() => r.onValidityChange?.(!!F), [F]);
|
|
399
|
+
let H = (e) => {
|
|
400
|
+
T(""), c(e);
|
|
401
|
+
}, U = (e) => {
|
|
402
|
+
H(e), i === "date" && a !== "multiple" && Z({
|
|
403
|
+
...r,
|
|
404
|
+
value: e
|
|
405
|
+
}, M).valid && r.onSelectionComplete?.(e);
|
|
406
|
+
}, W = (e) => {
|
|
407
|
+
if (!V(e)) return;
|
|
408
|
+
let t = v(e, l.calendarSystem);
|
|
409
|
+
t !== (l.month ?? M) && (N(t), l.onMonthChange?.(t));
|
|
410
|
+
}, G = (e, t) => {
|
|
411
|
+
if (typeof t != "string") return;
|
|
412
|
+
W(t);
|
|
413
|
+
let n = {
|
|
414
|
+
from: k,
|
|
415
|
+
to: A,
|
|
416
|
+
[e]: t ? z(t, e === "from" ? k : A, i) : ""
|
|
417
|
+
};
|
|
418
|
+
H(!n.from && !n.to ? null : n);
|
|
419
|
+
}, K = (e, t, n, i = !0) => /* @__PURE__ */ o("label", {
|
|
420
|
+
class: `rv-temporal-picker__time${i ? "" : " rv-temporal-picker__time--single"}`,
|
|
421
|
+
children: [i && /* @__PURE__ */ o("span", { children: t }), /* @__PURE__ */ o(ne, {
|
|
422
|
+
label: t,
|
|
423
|
+
value: e ? R(e) : "",
|
|
424
|
+
min: r.minTime,
|
|
425
|
+
max: r.maxTime,
|
|
426
|
+
step: r.timeStep,
|
|
427
|
+
precision: r.precision,
|
|
428
|
+
format: r.timeFormat,
|
|
429
|
+
locale: l.locale,
|
|
430
|
+
onChange: n
|
|
431
|
+
})]
|
|
432
|
+
}), q = {
|
|
433
|
+
...l,
|
|
434
|
+
month: l.month ?? M,
|
|
435
|
+
onMonthChange: (e) => {
|
|
436
|
+
N(e), l.onMonthChange?.(e);
|
|
437
|
+
},
|
|
438
|
+
required: P,
|
|
439
|
+
onInvalidSelection: (e, t) => {
|
|
440
|
+
T(e || u.invalid), l.onInvalidSelection?.(e, t);
|
|
441
|
+
}
|
|
442
|
+
}, J;
|
|
443
|
+
if (a === "multiple") J = {
|
|
444
|
+
...q,
|
|
445
|
+
mode: "multiple",
|
|
446
|
+
selected: O.filter(_),
|
|
447
|
+
onSelectionChange: (e) => U([...e])
|
|
448
|
+
};
|
|
449
|
+
else if (a === "range" && !b) J = {
|
|
450
|
+
...q,
|
|
451
|
+
mode: "range",
|
|
452
|
+
selected: k && _(L(k)) ? {
|
|
453
|
+
from: L(k),
|
|
454
|
+
...A && _(L(A)) ? { to: L(A) } : {}
|
|
455
|
+
} : void 0,
|
|
456
|
+
onSelectionChange: (e) => U(e ? {
|
|
457
|
+
from: z(e.from, k, i),
|
|
458
|
+
...e.to ? { to: z(e.to, A, i) } : {}
|
|
459
|
+
} : null)
|
|
460
|
+
};
|
|
461
|
+
else {
|
|
462
|
+
let e = a === "range" ? b === "to" ? A : k : D;
|
|
463
|
+
J = {
|
|
464
|
+
...q,
|
|
465
|
+
mode: "single",
|
|
466
|
+
selected: e && _(L(e)) ? L(e) : void 0,
|
|
467
|
+
onSelectionChange: (t) => {
|
|
468
|
+
U(a === "range" ? t ? {
|
|
469
|
+
from: k,
|
|
470
|
+
to: A,
|
|
471
|
+
[b ?? "from"]: z(t, e, i)
|
|
472
|
+
} : null : t ? z(t, D, i) : null);
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
return /* @__PURE__ */ o("div", {
|
|
477
|
+
class: `rv-temporal-picker rv-temporal-picker--${i}`,
|
|
478
|
+
children: [
|
|
479
|
+
r.dateInput === !1 && a === "range" && i !== "time" && /* @__PURE__ */ o("div", {
|
|
480
|
+
class: `rv-temporal-picker__endpoints ${r.classNames?.endpoints ?? ""}`,
|
|
481
|
+
children: [/* @__PURE__ */ o(d, {
|
|
482
|
+
"aria-label": `${u.startDate}: ${k}`,
|
|
483
|
+
"aria-pressed": b !== "to",
|
|
484
|
+
onClick: () => {
|
|
485
|
+
x(void 0), k && N(v(L(k), l.calendarSystem)), T("");
|
|
486
|
+
},
|
|
487
|
+
children: k ? L(k) : "—"
|
|
488
|
+
}), /* @__PURE__ */ o(d, {
|
|
489
|
+
"aria-label": `${u.endDate}: ${A}`,
|
|
490
|
+
"aria-pressed": b === "to",
|
|
491
|
+
onClick: () => {
|
|
492
|
+
x("to"), A && N(v(L(A), l.calendarSystem)), T("");
|
|
493
|
+
},
|
|
494
|
+
children: A ? L(A) : "—"
|
|
495
|
+
})]
|
|
496
|
+
}),
|
|
497
|
+
/* @__PURE__ */ o("div", {
|
|
498
|
+
class: "rv-temporal-picker__header",
|
|
499
|
+
children: i !== "time" && r.dateInput !== !1 && /* @__PURE__ */ o("div", {
|
|
500
|
+
class: `rv-temporal-picker__dates ${a === "range" ? `rv-temporal-picker__endpoints ${r.classNames?.endpoints ?? ""}` : ""}`,
|
|
501
|
+
children: a === "range" ? /* @__PURE__ */ o(e, { children: [/* @__PURE__ */ o("div", {
|
|
502
|
+
class: "rv-temporal-picker__endpoint",
|
|
503
|
+
role: "group",
|
|
504
|
+
"aria-label": u.startDate,
|
|
505
|
+
children: [/* @__PURE__ */ o(C, {
|
|
506
|
+
label: u.startDate,
|
|
507
|
+
value: h(k),
|
|
508
|
+
options: g,
|
|
509
|
+
invalid: !F,
|
|
510
|
+
errorId: m,
|
|
511
|
+
onFocus: () => x(void 0),
|
|
512
|
+
onChange: (e) => G("from", e)
|
|
513
|
+
}), i === "datetime" && K(k, u.startTime, (e) => H({
|
|
514
|
+
from: B(k, e, i),
|
|
515
|
+
...A ? { to: A } : {}
|
|
516
|
+
}), !1)]
|
|
517
|
+
}), /* @__PURE__ */ o("div", {
|
|
518
|
+
class: "rv-temporal-picker__endpoint",
|
|
519
|
+
role: "group",
|
|
520
|
+
"aria-label": u.endDate,
|
|
521
|
+
children: [/* @__PURE__ */ o(C, {
|
|
522
|
+
label: u.endDate,
|
|
523
|
+
value: h(A),
|
|
524
|
+
options: g,
|
|
525
|
+
invalid: !F,
|
|
526
|
+
errorId: m,
|
|
527
|
+
onFocus: () => x("to"),
|
|
528
|
+
onChange: (e) => G("to", e)
|
|
529
|
+
}), i === "datetime" && K(A, u.endTime, (e) => H({
|
|
530
|
+
from: k,
|
|
531
|
+
to: B(A, e, i)
|
|
532
|
+
}), !1)]
|
|
533
|
+
})] }) : /* @__PURE__ */ o(C, {
|
|
534
|
+
label: a === "multiple" ? u.dates : u.date,
|
|
535
|
+
value: a === "multiple" ? O : h(D),
|
|
536
|
+
multiple: a === "multiple",
|
|
537
|
+
options: g,
|
|
538
|
+
invalid: !F,
|
|
539
|
+
errorId: m,
|
|
540
|
+
onChange: (e) => {
|
|
541
|
+
typeof e == "string" && W(e), H(Array.isArray(e) ? e : e ? z(e, D, i) : null);
|
|
542
|
+
}
|
|
543
|
+
})
|
|
544
|
+
})
|
|
545
|
+
}),
|
|
546
|
+
/* @__PURE__ */ o("div", {
|
|
547
|
+
class: "rv-temporal-picker__body",
|
|
548
|
+
children: [i !== "time" && /* @__PURE__ */ o(w, { ...J }), i !== "date" && a !== "range" && /* @__PURE__ */ o(Q, {
|
|
549
|
+
value: R(D),
|
|
550
|
+
label: u.time,
|
|
551
|
+
text: u,
|
|
552
|
+
format: r.timeFormat,
|
|
553
|
+
precision: r.precision,
|
|
554
|
+
locale: l.locale,
|
|
555
|
+
min: r.minTime,
|
|
556
|
+
max: r.maxTime,
|
|
557
|
+
step: r.timeStep,
|
|
558
|
+
onChange: (e) => H(B(D, e, i))
|
|
559
|
+
})]
|
|
560
|
+
}),
|
|
561
|
+
i !== "date" && a === "range" && (i === "time" || r.dateInput === !1) && /* @__PURE__ */ o("div", {
|
|
562
|
+
class: "rv-temporal-picker__times",
|
|
563
|
+
children: [i === "time" ? /* @__PURE__ */ o(Q, {
|
|
564
|
+
value: R(k),
|
|
565
|
+
label: u.startTime,
|
|
566
|
+
text: u,
|
|
567
|
+
format: r.timeFormat,
|
|
568
|
+
precision: r.precision,
|
|
569
|
+
locale: l.locale,
|
|
570
|
+
min: r.minTime,
|
|
571
|
+
max: r.maxTime,
|
|
572
|
+
step: r.timeStep,
|
|
573
|
+
onChange: (e) => H({
|
|
574
|
+
from: e,
|
|
575
|
+
...A ? { to: A } : {}
|
|
576
|
+
})
|
|
577
|
+
}) : K(k, u.startTime, (e) => H({
|
|
578
|
+
from: B(k, e, i),
|
|
579
|
+
...A ? { to: A } : {}
|
|
580
|
+
})), i === "time" ? /* @__PURE__ */ o(Q, {
|
|
581
|
+
value: R(A),
|
|
582
|
+
label: u.endTime,
|
|
583
|
+
text: u,
|
|
584
|
+
format: r.timeFormat,
|
|
585
|
+
precision: r.precision,
|
|
586
|
+
locale: l.locale,
|
|
587
|
+
min: r.minTime,
|
|
588
|
+
max: r.maxTime,
|
|
589
|
+
step: r.timeStep,
|
|
590
|
+
onChange: (e) => H({
|
|
591
|
+
from: k,
|
|
592
|
+
to: e
|
|
593
|
+
})
|
|
594
|
+
}) : K(A, u.endTime, (e) => H({
|
|
595
|
+
from: k,
|
|
596
|
+
to: B(A, e, i)
|
|
597
|
+
}))]
|
|
598
|
+
}),
|
|
599
|
+
!F && /* @__PURE__ */ o(f, {
|
|
600
|
+
tone: "danger",
|
|
601
|
+
children: /* @__PURE__ */ o("span", {
|
|
602
|
+
id: m,
|
|
603
|
+
children: I
|
|
604
|
+
})
|
|
605
|
+
})
|
|
606
|
+
]
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region ../../node_modules/.pnpm/@fortawesome+fontawesome-free@7.3.1/node_modules/@fortawesome/fontawesome-free/svgs/regular/clock.svg?raw
|
|
611
|
+
var ae = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><!--! Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2026 Fonticons, Inc. --><path fill=\"currentColor\" d=\"M464 256a208 208 0 1 1 -416 0 208 208 0 1 1 416 0zM0 256a256 256 0 1 0 512 0 256 256 0 1 0 -512 0zM232 120l0 136c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2 280 120c0-13.3-10.7-24-24-24s-24 10.7-24 24z\"/></svg>";
|
|
612
|
+
//#endregion
|
|
613
|
+
//#region src/date-time/field.tsx
|
|
614
|
+
function $({ value: e, options: t, apply: r, cancel: i, clearable: a = !0 }) {
|
|
615
|
+
let [s, c] = n(e), [l, u] = n(!1), [d, p] = n(""), m = (e) => {
|
|
616
|
+
c(e), p("");
|
|
617
|
+
}, h = t.autoApply !== !1, g = JSON.stringify(s) !== JSON.stringify(e), _ = (e) => {
|
|
618
|
+
let t = r(e) || "";
|
|
619
|
+
return p(t), !t;
|
|
620
|
+
}, v = () => l ? _(s) : !1;
|
|
621
|
+
return E(() => !g || v(), h), /* @__PURE__ */ o("div", {
|
|
622
|
+
class: `rv-temporal-draft${t.kind === "time" ? " rv-temporal-draft--time" : ""}`,
|
|
623
|
+
onKeyDown: (e) => {
|
|
624
|
+
e.key === "Enter" && !e.isComposing && (e.ctrlKey || e.metaKey || h && e.target instanceof HTMLInputElement) && (e.preventDefault(), v());
|
|
625
|
+
},
|
|
626
|
+
children: [
|
|
627
|
+
/* @__PURE__ */ o(ie, {
|
|
628
|
+
...t,
|
|
629
|
+
value: s,
|
|
630
|
+
onChange: m,
|
|
631
|
+
onValidityChange: u,
|
|
632
|
+
onSelectionComplete: h ? _ : void 0
|
|
633
|
+
}),
|
|
634
|
+
d && /* @__PURE__ */ o(f, {
|
|
635
|
+
tone: "danger",
|
|
636
|
+
children: d
|
|
637
|
+
}),
|
|
638
|
+
/* @__PURE__ */ o(D, {
|
|
639
|
+
text: t.actions,
|
|
640
|
+
showConfirm: t.showActions ?? !h,
|
|
641
|
+
disabled: !l,
|
|
642
|
+
apply: v,
|
|
643
|
+
cancel: i,
|
|
644
|
+
clear: !a || (t.required ?? t.calendar?.required) ? void 0 : () => {
|
|
645
|
+
let e = t.selection === "multiple" ? [] : null;
|
|
646
|
+
m(e), h && _(e);
|
|
647
|
+
}
|
|
648
|
+
})
|
|
649
|
+
]
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
function oe({ value: e, kind: t = "date", picker: n, onValueChange: r, onInput: c, formatValue: l, parseValue: f, ...p }) {
|
|
653
|
+
let m = a(null), h = a(), g = a({
|
|
654
|
+
value: e,
|
|
655
|
+
kind: t,
|
|
656
|
+
picker: n,
|
|
657
|
+
onValueChange: r,
|
|
658
|
+
input: p
|
|
659
|
+
});
|
|
660
|
+
return g.current = {
|
|
661
|
+
value: e,
|
|
662
|
+
kind: t,
|
|
663
|
+
picker: n,
|
|
664
|
+
onValueChange: r,
|
|
665
|
+
input: p
|
|
666
|
+
}, i(() => () => h.current?.close(), []), i(() => {
|
|
667
|
+
(p.disabled || p.readOnly) && h.current?.close();
|
|
668
|
+
}, [p.disabled, p.readOnly]), /* @__PURE__ */ o("span", {
|
|
669
|
+
class: "rv-date-time-field",
|
|
670
|
+
children: [/* @__PURE__ */ o(u, {
|
|
671
|
+
...p,
|
|
672
|
+
type: "text",
|
|
673
|
+
value: l?.(e) ?? e,
|
|
674
|
+
placeholder: p.placeholder ?? (t === "date" ? "YYYY-MM-DD" : t === "time" ? "HH:mm" : "YYYY-MM-DDTHH:mm"),
|
|
675
|
+
onInput: (e) => {
|
|
676
|
+
c?.(e);
|
|
677
|
+
let t = f ? f(e.currentTarget.value) : e.currentTarget.value;
|
|
678
|
+
t !== void 0 && r?.(t);
|
|
679
|
+
}
|
|
680
|
+
}), /* @__PURE__ */ o(d, {
|
|
681
|
+
ref: m,
|
|
682
|
+
variant: "ghost",
|
|
683
|
+
"aria-label": X(t, n?.text),
|
|
684
|
+
disabled: p.disabled || p.readOnly,
|
|
685
|
+
onClick: () => {
|
|
686
|
+
m.current && !h.current && (h.current = T(m.current, (r) => /* @__PURE__ */ o($, {
|
|
687
|
+
value: e || null,
|
|
688
|
+
options: {
|
|
689
|
+
...n,
|
|
690
|
+
required: n?.required ?? p.required,
|
|
691
|
+
kind: t,
|
|
692
|
+
selection: "single"
|
|
693
|
+
},
|
|
694
|
+
cancel: r,
|
|
695
|
+
apply: (e) => {
|
|
696
|
+
!g.current.input.disabled && !g.current.input.readOnly && g.current.onValueChange?.(typeof e == "string" ? e : ""), r();
|
|
697
|
+
}
|
|
698
|
+
}), {
|
|
699
|
+
label: X(t, n?.text),
|
|
700
|
+
className: t === "time" ? "rv-editor-popup--time" : t === "datetime" ? "rv-editor-popup--datetime" : void 0,
|
|
701
|
+
onClose: () => {
|
|
702
|
+
h.current = void 0;
|
|
703
|
+
}
|
|
704
|
+
}));
|
|
705
|
+
},
|
|
706
|
+
children: /* @__PURE__ */ o(s, { svg: t === "time" ? ae : S })
|
|
707
|
+
})]
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
//#endregion
|
|
711
|
+
//#region src/date-time/attach.tsx
|
|
712
|
+
function se(e, t, n) {
|
|
713
|
+
let r, i = c(e.ownerDocument, /* @__PURE__ */ o(d, {
|
|
714
|
+
variant: "ghost",
|
|
715
|
+
disabled: e.disabled || e.readOnly,
|
|
716
|
+
"aria-label": X(t.kind ?? "date", t.text),
|
|
717
|
+
onClick: () => {
|
|
718
|
+
e.disabled || e.readOnly || r || (r = T(e, (r) => /* @__PURE__ */ o($, {
|
|
719
|
+
value: e.value || null,
|
|
720
|
+
options: {
|
|
721
|
+
...t,
|
|
722
|
+
selection: "single",
|
|
723
|
+
required: t.required ?? t.calendar?.required ?? e.required
|
|
724
|
+
},
|
|
725
|
+
cancel: r,
|
|
726
|
+
apply: (t) => {
|
|
727
|
+
!e.disabled && !e.readOnly && n(typeof t == "string" ? t : ""), r();
|
|
728
|
+
}
|
|
729
|
+
}), {
|
|
730
|
+
className: t.kind === "time" ? "rv-editor-popup--time" : t.kind === "datetime" ? "rv-editor-popup--datetime" : void 0,
|
|
731
|
+
label: X(t.kind ?? "date", t.text),
|
|
732
|
+
onClose: () => {
|
|
733
|
+
r = void 0;
|
|
734
|
+
}
|
|
735
|
+
}));
|
|
736
|
+
},
|
|
737
|
+
children: /* @__PURE__ */ o(s, { svg: t.kind === "time" ? ae : S })
|
|
738
|
+
}));
|
|
739
|
+
e.after(i);
|
|
740
|
+
let a = e.ownerDocument.defaultView?.MutationObserver, u = a ? new a(() => {
|
|
741
|
+
i.disabled = e.disabled || e.readOnly, i.disabled && r?.close();
|
|
742
|
+
}) : void 0;
|
|
743
|
+
return u?.observe(e, {
|
|
744
|
+
attributes: !0,
|
|
745
|
+
attributeFilter: ["disabled", "readonly"]
|
|
746
|
+
}), () => {
|
|
747
|
+
u?.disconnect(), r?.close(), l(i), i.remove();
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region src/date-time/value.tsx
|
|
752
|
+
function ce(e, t) {
|
|
753
|
+
let n = Number.isFinite(t.maxVisibleDates) ? Math.max(1, Math.floor(t.maxVisibleDates)) : 2, r = t.multiple ? t.values.slice(0, n) : t.values, i = t.values.length - r.length;
|
|
754
|
+
return e("span", {
|
|
755
|
+
class: "rv-temporal-value",
|
|
756
|
+
role: t.fullValue ? "group" : void 0,
|
|
757
|
+
dir: t.dir ?? "auto",
|
|
758
|
+
title: t.fullValue || void 0,
|
|
759
|
+
"data-tooltip": t.fullValue || void 0,
|
|
760
|
+
"aria-label": t.fullValue || void 0
|
|
761
|
+
}, [...r.map((t) => e("span", {
|
|
762
|
+
class: "rv-badge rv-temporal-value__item",
|
|
763
|
+
"aria-hidden": "true"
|
|
764
|
+
}, t)), i > 0 ? e("span", {
|
|
765
|
+
class: "rv-badge rv-temporal-value__more",
|
|
766
|
+
"aria-hidden": "true"
|
|
767
|
+
}, `+${i}`) : null]);
|
|
768
|
+
}
|
|
769
|
+
//#endregion
|
|
770
|
+
export { ie as a, $ as i, se as n, Y as o, oe as r, X as s, ce as t };
|