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