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