@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.
Files changed (218) hide show
  1. package/README.md +6 -5
  2. package/_chunks/calendar-CpaUK7w1.js +248 -0
  3. package/_chunks/chart-frame-BC99KjGa.js +127 -0
  4. package/_chunks/choice-chips-Cs4D-3nH.js +110 -0
  5. package/_chunks/{color-palette-BmZ7kH9R.js → color-palette-BBMFmUNA.js} +41 -41
  6. package/_chunks/color-picker-D90Jg-M8.js +138 -0
  7. package/_chunks/compat.module-DDB2pm9O.js +229 -0
  8. package/_chunks/component-YDcfoOLz.js +859 -0
  9. package/_chunks/{control-tooltip-BCNzQCXE.js → control-tooltip-ztgmsG7H.js} +29 -29
  10. package/_chunks/{controller-CmLo-Ajc.js → controller-hRBm_Lfz.js} +15 -15
  11. package/_chunks/{controls-NEL5tDaz.js → controls-DIum-E66.js} +192 -192
  12. package/_chunks/{date-control-CYCkb1aQ.js → date-control-BJSzu79z.js} +21 -21
  13. package/_chunks/date-time-BxPJusp9.js +770 -0
  14. package/_chunks/{delete-button-DnpmDNEJ.js → delete-button-Bblyah10.js} +1 -1
  15. package/_chunks/dialog.parts-DBqo3Qwb.js +134 -0
  16. package/_chunks/{dropdown-CkGQBm1Q.js → dropdown-voWqmwAe.js} +102 -102
  17. package/_chunks/duration-87U2EoMS.js +271 -0
  18. package/_chunks/editor-commit-Bq3wSgvr.js +12 -0
  19. package/_chunks/{editor-popup-B7fu_A_T.js → editor-popup-D3JdS8l3.js} +8 -8
  20. package/_chunks/framework-mount-C-Zwm44H.js +54 -0
  21. package/_chunks/hooks.module-CG3gN83z.js +157 -0
  22. package/_chunks/jsxRuntime.module-F6UFnpT-.js +30 -0
  23. package/_chunks/mount-DZe_6VtR.js +90 -0
  24. package/_chunks/native.view-ByyZ1CT5.js +32 -0
  25. package/_chunks/{number-input-NnH57J4j.js → number-input-BeIadZuL.js} +89 -89
  26. package/_chunks/picker-DpP7iQLA.js +122 -0
  27. package/_chunks/preact.module-BBM36DnO.js +290 -0
  28. package/_chunks/{rating-choice-CWAsNQNS.js → rating-choice-Ca8ZBty3.js} +10 -10
  29. package/_chunks/reorder-list-Cc3KmfAN.js +59 -0
  30. package/_chunks/request-trail-IdNiFvKH.js +347 -0
  31. package/_chunks/{rich-text-2Rla349o.js → rich-text-BzI1DyfF.js} +167 -167
  32. package/_vendor/preact/LICENSE +21 -0
  33. package/_vendor/preact/compat/src/index.d.ts +353 -0
  34. package/_vendor/preact/compat/src/suspense-list.d.ts +16 -0
  35. package/_vendor/preact/compat/src/suspense.d.ts +19 -0
  36. package/_vendor/preact/hooks/src/index.d.ts +145 -0
  37. package/_vendor/preact/src/dom.d.ts +2548 -0
  38. package/_vendor/preact/src/index.d.ts +373 -0
  39. package/_vendor/preact/src/jsx.d.ts +2958 -0
  40. package/activity-message.d.ts +1 -1
  41. package/activity-message.js +16 -16
  42. package/ai/components.d.ts +1 -1
  43. package/ai/index.js +2 -2
  44. package/ai/request-trail.d.ts +1 -1
  45. package/ai/translation-context.d.ts +1 -1
  46. package/alert.d.ts +2 -2
  47. package/assignee/field.d.ts +2 -2
  48. package/assignee/index.js +87 -87
  49. package/assignee/layout.d.ts +2 -2
  50. package/assignee/picker.d.ts +1 -1
  51. package/avatar/index.js +25 -25
  52. package/avatar/index.view.d.ts +1 -1
  53. package/brush-range/component.d.ts +1 -1
  54. package/brush-range/component.js +30 -30
  55. package/buttons/delete-button.js +1 -1
  56. package/buttons/remove-button.d.ts +1 -1
  57. package/buttons/remove-button.js +3 -3
  58. package/buttons/svg-button.d.ts +1 -1
  59. package/buttons/svg-button.js +35 -35
  60. package/calendar/calendar.d.ts +1 -1
  61. package/calendar/calendar.js +1 -1
  62. package/calendar/caption.d.ts +1 -1
  63. package/calendar/day.d.ts +1 -1
  64. package/calendar/day.js +4 -4
  65. package/calendar/header.d.ts +1 -1
  66. package/calendar/header.js +35 -35
  67. package/calendar/index.js +2 -2
  68. package/calendar/month-grid.d.ts +1 -1
  69. package/calendar/month-grid.js +37 -37
  70. package/calendar/picker.d.ts +1 -1
  71. package/calendar/types.d.ts +1 -1
  72. package/calendar/year-grid.d.ts +1 -1
  73. package/calendar/year-grid.js +12 -12
  74. package/checkbox/index.d.ts +2 -2
  75. package/checkbox/index.js +9 -9
  76. package/choice-chips/index.d.ts +1 -1
  77. package/choice-chips/index.js +1 -1
  78. package/color-palette/color-palette.d.ts +1 -1
  79. package/color-palette/color-palette.js +1 -1
  80. package/color-palette/color-picker.d.ts +1 -1
  81. package/color-palette/color-picker.js +2 -2
  82. package/component-catalog.d.ts +19 -19
  83. package/control-presentation.js +18 -18
  84. package/controls.d.ts +4 -4
  85. package/controls.js +1 -1
  86. package/core/editor-commit.d.ts +1 -1
  87. package/core/editor-popup.d.ts +1 -1
  88. package/core/editor-popup.js +1 -1
  89. package/date-time/date-control.d.ts +1 -1
  90. package/date-time/field.d.ts +2 -2
  91. package/date-time/index.js +1 -1
  92. package/date-time/picker.d.ts +1 -1
  93. package/date-time/time-control.d.ts +1 -1
  94. package/date-time/time-selection.d.ts +1 -1
  95. package/date-time/types.d.ts +1 -1
  96. package/dialog/dialog-action-footer.view.d.ts +1 -1
  97. package/dialog/dialog.dom.js +52 -52
  98. package/dialog/dialog.parts.d.ts +18 -18
  99. package/dialog/dialog.parts.js +1 -1
  100. package/dialog/dialog.preact.d.ts +1 -1
  101. package/dialog/dialog.preact.js +6 -6
  102. package/distribution-chart/area-chart.d.ts +1 -1
  103. package/distribution-chart/area-chart.js +25 -25
  104. package/distribution-chart/bar-chart.d.ts +1 -1
  105. package/distribution-chart/bar-chart.js +6 -6
  106. package/distribution-chart/chart-frame.d.ts +1 -1
  107. package/distribution-chart/index.d.ts +1 -1
  108. package/distribution-chart/index.js +6 -6
  109. package/distribution-chart/line-chart.d.ts +1 -1
  110. package/distribution-chart/line-chart.js +9 -9
  111. package/distribution-chart/types.d.ts +1 -1
  112. package/dropdown/content.d.ts +1 -1
  113. package/dropdown/content.js +83 -82
  114. package/dropdown/dropdown.service.d.ts +1 -1
  115. package/dropdown/dropdown.service.js +9 -9
  116. package/dropdown/index.js +1 -1
  117. package/dropdown/lookup-field.d.ts +1 -1
  118. package/dropdown/lookup-field.js +41 -41
  119. package/dropdown/popup.d.ts +1 -1
  120. package/dropdown/popup.js +17 -16
  121. package/duration/controls.d.ts +1 -1
  122. package/duration/index.d.ts +2 -2
  123. package/duration/index.js +1 -1
  124. package/editor-actions.d.ts +1 -1
  125. package/editor-actions.js +21 -20
  126. package/editor-layout/index.d.ts +1 -1
  127. package/editor-layout/index.js +27 -27
  128. package/field-configurator.d.ts +1 -1
  129. package/field-configurator.js +93 -93
  130. package/field-reorder.hook.js +32 -32
  131. package/filter/filters/slider/preact.js +3 -3
  132. package/filter/filters/slider/single.d.ts +1 -1
  133. package/filter/filters/slider/single.js +23 -23
  134. package/filter-badge.d.ts +1 -1
  135. package/filter-badge.js +23 -22
  136. package/filter-controls.d.ts +1 -1
  137. package/filter-controls.js +31 -31
  138. package/form-controls/index.js +20 -20
  139. package/form-controls/presentation.d.ts +1 -1
  140. package/form-controls/presentation.js +44 -44
  141. package/formatting/comparison-preview.d.ts +1 -1
  142. package/formatting/control-tooltip.d.ts +1 -1
  143. package/formatting/icon-controls.d.ts +1 -1
  144. package/formatting/index.js +99 -98
  145. package/formatting/inspector-section.d.ts +1 -1
  146. package/formatting/typography-controls.d.ts +1 -1
  147. package/framework-mount.d.ts +1 -1
  148. package/framework.js +19 -19
  149. package/icons/icon.d.ts +1 -1
  150. package/icons/icon.js +1 -1
  151. package/legend.d.ts +1 -1
  152. package/legend.js +12 -12
  153. package/masked-input/index.d.ts +1 -1
  154. package/masked-input/index.js +109 -109
  155. package/native-control.d.ts +11 -11
  156. package/native-control.js +12 -12
  157. package/native.js +39 -39
  158. package/number-input/index.d.ts +1 -1
  159. package/number-input/index.js +1 -1
  160. package/package.json +1 -2
  161. package/pdf-viewer/component.d.ts +1 -1
  162. package/pdf-viewer/controller.js +1 -1
  163. package/pdf-viewer/header.d.ts +1 -1
  164. package/pdf-viewer/index.js +13 -13
  165. package/pdf-viewer/search-bar.d.ts +1 -1
  166. package/pdf-viewer/status.d.ts +1 -1
  167. package/pdf-viewer/toolbar.d.ts +1 -1
  168. package/pickers.d.ts +1 -1
  169. package/preact-mount.d.ts +1 -1
  170. package/preact-mount.js +1 -1
  171. package/preact.js +14 -14
  172. package/rating-choice.d.ts +1 -1
  173. package/rating-choice.js +1 -1
  174. package/react-adapter.d.ts +1 -1
  175. package/react.js +19 -19
  176. package/reorder-list.d.ts +1 -1
  177. package/reorder-list.js +1 -1
  178. package/resource-picker/resource-picker-avatar.d.ts +1 -1
  179. package/resource-picker/resource-picker-avatar.js +14 -14
  180. package/resource-picker/resource-picker-option.d.ts +1 -1
  181. package/resource-picker/resource-picker-option.js +28 -28
  182. package/resource-picker/resource-picker-popup.d.ts +1 -1
  183. package/resource-picker/resource-picker-popup.js +3 -3
  184. package/resource-picker/resource-picker.d.ts +1 -1
  185. package/resource-picker/resource-picker.js +88 -88
  186. package/rich-text/index.d.ts +1 -1
  187. package/rich-text/index.js +1 -1
  188. package/rich-text/toolbar.d.ts +1 -1
  189. package/search-input/index.js +12 -12
  190. package/segmented-switch/index.d.ts +1 -1
  191. package/segmented-switch/index.js +1 -1
  192. package/status-feedback/render.d.ts +2 -2
  193. package/status-feedback/render.js +13 -13
  194. package/surfaces.js +34 -34
  195. package/svelte.js +2 -2
  196. package/switch/index.js +15 -15
  197. package/time-grid.d.ts +1 -1
  198. package/time-grid.js +58 -58
  199. package/timeline-track/component.d.ts +1 -1
  200. package/timeline-track/index.js +75 -75
  201. package/vue-adapter.d.ts +1 -1
  202. package/vue.d.ts +116 -116
  203. package/vue.js +121 -121
  204. package/_chunks/calendar-BsDxCYhI.js +0 -248
  205. package/_chunks/chart-frame-BvxbmEU9.js +0 -126
  206. package/_chunks/choice-chips-0HfOnK_4.js +0 -110
  207. package/_chunks/color-picker-BRv-__AM.js +0 -138
  208. package/_chunks/component-D4PH5UZT.js +0 -859
  209. package/_chunks/date-time-DjucJmbc.js +0 -769
  210. package/_chunks/dialog.parts-Dt3KinUz.js +0 -134
  211. package/_chunks/duration-BCaktcvz.js +0 -270
  212. package/_chunks/editor-commit-D6Rf5rGz.js +0 -12
  213. package/_chunks/framework-mount-BKIOsvY-.js +0 -54
  214. package/_chunks/mount-0-8opf1j.js +0 -90
  215. package/_chunks/native.view-8q_nwQ7x.js +0 -32
  216. package/_chunks/picker-oazJ7sO_.js +0 -121
  217. package/_chunks/reorder-list-BV3kZXso.js +0 -59
  218. package/_chunks/request-trail-D0oVzdRd.js +0 -347
@@ -1,11 +1,11 @@
1
- import { Input as e } from "../native-control.js";
2
- import { n as t } from "./controls-NEL5tDaz.js";
3
- import { createControlId as n } from "../core/control-id.js";
4
- import { EditorActions as r } from "../editor-actions.js";
5
- import { useEffect as i, useRef as a, useState as o } from "preact/hooks";
6
- import { jsx as s, jsxs as c } from "preact/jsx-runtime";
1
+ import { c as e, i as t, t as n } from "./hooks.module-CG3gN83z.js";
2
+ import { t as r } from "./jsxRuntime.module-F6UFnpT-.js";
3
+ import { Input as i } from "../native-control.js";
4
+ import { n as a } from "./controls-DIum-E66.js";
5
+ import { createControlId as o } from "../core/control-id.js";
6
+ import { EditorActions as s } from "../editor-actions.js";
7
7
  //#region src/number-input/model.ts
8
- var l = {
8
+ var c = {
9
9
  invalid: "Enter a valid number in the configured locale.",
10
10
  configuration: "The number input configuration is unsupported or invalid.",
11
11
  required: "Enter a value.",
@@ -14,14 +14,14 @@ var l = {
14
14
  maximum: "The value is above the maximum.",
15
15
  increase: "Increase",
16
16
  decrease: "Decrease"
17
- }, u = /[\u061c\u200e\u200f]/g, d = (e) => e.replace(u, "").trim(), f = (e) => typeof e == "number" && Number.isFinite(e);
18
- function p(e) {
17
+ }, l = /[\u061c\u200e\u200f]/g, u = (e) => e.replace(l, "").trim(), d = (e) => typeof e == "number" && Number.isFinite(e);
18
+ function f(e) {
19
19
  let t = e.kind ?? "number", n = e.precision ?? 2;
20
20
  if (![
21
21
  "number",
22
22
  "currency",
23
23
  "percent"
24
- ].includes(t) || !Number.isInteger(n) || n < 0 || n > 20 || e.min !== void 0 && !f(e.min) || e.max !== void 0 && !f(e.max) || e.step !== void 0 && (!f(e.step) || e.step <= 0) || e.min !== void 0 && e.max !== void 0 && e.min > e.max || e.useGrouping !== void 0 && typeof e.useGrouping != "boolean" || e.required !== void 0 && typeof e.required != "boolean" || e.locale !== void 0 && (typeof e.locale != "string" || !e.locale.trim() || !Intl.NumberFormat.supportedLocalesOf(e.locale).length)) throw RangeError();
24
+ ].includes(t) || !Number.isInteger(n) || n < 0 || n > 20 || e.min !== void 0 && !d(e.min) || e.max !== void 0 && !d(e.max) || e.step !== void 0 && (!d(e.step) || e.step <= 0) || e.min !== void 0 && e.max !== void 0 && e.min > e.max || e.useGrouping !== void 0 && typeof e.useGrouping != "boolean" || e.required !== void 0 && typeof e.required != "boolean" || e.locale !== void 0 && (typeof e.locale != "string" || !e.locale.trim() || !Intl.NumberFormat.supportedLocalesOf(e.locale).length)) throw RangeError();
25
25
  let r = e.currency ?? "USD";
26
26
  if (t === "currency" && (typeof r != "string" || !/^[A-Z]{3}$/.test(r))) throw RangeError();
27
27
  if (e.step !== void 0) {
@@ -43,23 +43,23 @@ function p(e) {
43
43
  formatter: a
44
44
  };
45
45
  }
46
- function m(e, t = {}) {
47
- let { formatter: n } = p(t);
46
+ function p(e, t = {}) {
47
+ let { formatter: n } = f(t);
48
48
  if (e == null) return "";
49
- if (!f(e)) throw TypeError("Expected a finite number or null.");
49
+ if (!d(e)) throw TypeError("Expected a finite number or null.");
50
50
  return n.format(e);
51
51
  }
52
- function h(e, t) {
53
- let { kind: n, currency: r } = p(t);
52
+ function m(e, t) {
53
+ let { kind: n, currency: r } = f(t);
54
54
  if (e == null) return "";
55
- if (!f(e)) return String(e);
55
+ if (!d(e)) return String(e);
56
56
  let i = new Intl.NumberFormat(t.locale, {
57
57
  style: n === "number" ? "decimal" : n,
58
58
  ...n === "currency" ? { currency: r } : {},
59
59
  useGrouping: t.useGrouping ?? !0,
60
60
  minimumFractionDigits: 0,
61
61
  maximumFractionDigits: 20
62
- }).format(e), a = g(i, {
62
+ }).format(e), a = h(i, {
63
63
  ...t,
64
64
  precision: 20,
65
65
  min: void 0,
@@ -68,29 +68,29 @@ function h(e, t) {
68
68
  });
69
69
  return a.error === void 0 && Object.is(a.value, e) ? i : e.toExponential();
70
70
  }
71
- function g(e, t = {}) {
71
+ function h(e, t = {}) {
72
72
  let n = {
73
- ...l,
73
+ ...c,
74
74
  ...t.text
75
75
  };
76
76
  try {
77
- let { kind: r, precision: i, currency: a } = p(t), o = d(e);
77
+ let { kind: r, precision: i, currency: a } = f(t), o = u(e);
78
78
  if (!o) return t.required ? { error: n.required } : { value: null };
79
79
  let s = new Intl.NumberFormat(t.locale, {
80
80
  useGrouping: !1,
81
81
  minimumFractionDigits: 1
82
- }).formatToParts(1.1).find((e) => e.type === "decimal").value, c = new Intl.NumberFormat(t.locale, { useGrouping: !1 }), l = new Map(Array.from({ length: 10 }, (e, t) => [d(c.format(t)), String(t)])), u = (e) => [...e].map((e) => l.get(e) ?? e).join(""), f = new Intl.NumberFormat(t.locale, {
82
+ }).formatToParts(1.1).find((e) => e.type === "decimal").value, c = new Intl.NumberFormat(t.locale, { useGrouping: !1 }), l = new Map(Array.from({ length: 10 }, (e, t) => [u(c.format(t)), String(t)])), d = (e) => [...e].map((e) => l.get(e) ?? e).join(""), p = new Intl.NumberFormat(t.locale, {
83
83
  useGrouping: !0,
84
84
  maximumFractionDigits: 0
85
- }), m = f.formatToParts(123456789).find((e) => e.type === "group")?.value, h = c.formatToParts(-1).find((e) => e.type === "minusSign")?.value ?? "-", g = !1, _ = !1;
86
- r === "currency" && o.startsWith("(") && o.endsWith(")") && (g = !0, _ = !0, o = d(o.slice(1, -1)));
85
+ }), m = p.formatToParts(123456789).find((e) => e.type === "group")?.value, h = c.formatToParts(-1).find((e) => e.type === "minusSign")?.value ?? "-", g = !1, _ = !1;
86
+ r === "currency" && o.startsWith("(") && o.endsWith(")") && (g = !0, _ = !0, o = u(o.slice(1, -1)));
87
87
  let v = () => {
88
88
  let e = [
89
89
  h,
90
90
  "-",
91
91
  "+"
92
92
  ].find((e) => o.startsWith(e));
93
- return !e || !_ && (_ = !0, g = e !== "+", o = d(o.slice(e.length)), !0);
93
+ return !e || !_ && (_ = !0, g = e !== "+", o = u(o.slice(e.length)), !0);
94
94
  };
95
95
  if (!v()) return { error: n.invalid };
96
96
  if (r === "currency") {
@@ -102,27 +102,27 @@ function g(e, t = {}) {
102
102
  }).formatToParts(1)) r.type === "currency" && e.add(r.value);
103
103
  for (let t of [...e].sort((e, t) => t.length - e.length)) {
104
104
  if (o.startsWith(t)) {
105
- o = d(o.slice(t.length));
105
+ o = u(o.slice(t.length));
106
106
  break;
107
107
  }
108
108
  if (o.endsWith(t)) {
109
- o = d(o.slice(0, -t.length));
109
+ o = u(o.slice(0, -t.length));
110
110
  break;
111
111
  }
112
112
  }
113
113
  if (!v()) return { error: n.invalid };
114
114
  } else if (r === "percent") {
115
115
  let e = new Intl.NumberFormat(t.locale, { style: "percent" }).formatToParts(1).find((e) => e.type === "percentSign").value;
116
- o.endsWith(e) ? o = d(o.slice(0, -e.length)) : o.startsWith(e) && (o = d(o.slice(e.length)));
116
+ o.endsWith(e) ? o = u(o.slice(0, -e.length)) : o.startsWith(e) && (o = u(o.slice(e.length)));
117
117
  }
118
- o = u(o);
118
+ o = d(o);
119
119
  let y = o.split(s);
120
120
  if (y.length > 2) return { error: n.invalid };
121
121
  let b = y[0], x = y[1] ?? "";
122
122
  if (!/^\d*$/.test(x) || y.length === 2 && !x) return { error: n.invalid };
123
123
  if (m && b.includes(m)) {
124
124
  let e = b.split(m).join("");
125
- if (!/^\d+$/.test(e) || u(d(f.format(BigInt(e)))) !== b) return { error: n.invalid };
125
+ if (!/^\d+$/.test(e) || d(u(p.format(BigInt(e)))) !== b) return { error: n.invalid };
126
126
  b = e;
127
127
  }
128
128
  if (!/^\d*$/.test(b) || !b && !x) return { error: n.invalid };
@@ -133,7 +133,7 @@ function g(e, t = {}) {
133
133
  return { error: n.configuration };
134
134
  }
135
135
  }
136
- function _(e, t) {
136
+ function g(e, t) {
137
137
  let n = (e) => {
138
138
  let [t, n = "0"] = String(e).split("e"), r = t.split(".")[1]?.length ?? 0;
139
139
  return {
@@ -143,100 +143,100 @@ function _(e, t) {
143
143
  }, r = n(e), i = n(t), a = Math.max(r.scale, i.scale, 0), o = r.integer * 10n ** BigInt(a - r.scale) + i.integer * 10n ** BigInt(a - i.scale);
144
144
  return Number(`${o}e-${a}`);
145
145
  }
146
- function v(e, t, n = {}) {
147
- let r = g(e, n);
146
+ function _(e, t, n = {}) {
147
+ let r = h(e, n);
148
148
  if (r.error !== void 0) return r;
149
- let { kind: i, precision: a } = p(n), o = n.step ?? 10 ** -(a + (i === "percent" ? 2 : 0)), s = r.value ?? Math.max(n.min ?? -Infinity, Math.min(n.max ?? Infinity, 0)), c = Math.max(n.min ?? -Infinity, Math.min(n.max ?? Infinity, _(s, t * o)));
150
- return !Number.isFinite(c) || Math.abs(c) > 2 ** 53 - 1 ? { error: n.text?.invalid ?? l.invalid } : g(h(c, n), n);
149
+ let { kind: i, precision: a } = f(n), o = n.step ?? 10 ** -(a + (i === "percent" ? 2 : 0)), s = r.value ?? Math.max(n.min ?? -Infinity, Math.min(n.max ?? Infinity, 0)), l = Math.max(n.min ?? -Infinity, Math.min(n.max ?? Infinity, g(s, t * o)));
150
+ return !Number.isFinite(l) || Math.abs(l) > 2 ** 53 - 1 ? { error: n.text?.invalid ?? c.invalid } : h(m(l, n), n);
151
151
  }
152
152
  //#endregion
153
153
  //#region src/number-input/index.tsx
154
- function y({ value: u, options: d, apply: f, cancel: p, initialSelection: m = "all" }) {
155
- let [_, y] = o(() => {
154
+ function v({ value: l, options: u, apply: d, cancel: f, initialSelection: p = "all" }) {
155
+ let [g, v] = t(() => {
156
156
  try {
157
- return h(u, d);
157
+ return m(l, u);
158
158
  } catch {
159
- return String(u ?? "");
159
+ return String(l ?? "");
160
160
  }
161
- }), [b, x] = o(""), [S] = o(() => n("rv-number")), C = a(null), w = a(!1), T = {
162
- ...l,
163
- ...d.text
164
- }, E = g(_, d), D = E.error ?? b, O = E.error !== void 0 || !!b, k = () => {
165
- if (w.current) return;
166
- let e = g(_, d);
167
- e.error === void 0 && !b && f(e.value);
161
+ }), [y, b] = t(""), [x] = t(() => o("rv-number")), S = n(null), C = n(!1), w = {
162
+ ...c,
163
+ ...u.text
164
+ }, T = h(g, u), E = T.error ?? y, D = T.error !== void 0 || !!y, O = () => {
165
+ if (C.current) return;
166
+ let e = h(g, u);
167
+ e.error === void 0 && !y && d(e.value);
168
+ }, k = (e) => {
169
+ b(""), v(e);
168
170
  }, A = (e) => {
169
- x(""), y(e);
170
- }, j = (e) => {
171
- if (w.current) return;
172
- let t = v(_, e, d);
173
- t.error === void 0 ? (x(""), y(h(t.value, d))) : x(t.error || T.invalid);
171
+ if (C.current) return;
172
+ let t = _(g, e, u);
173
+ t.error === void 0 ? (b(""), v(m(t.value, u))) : b(t.error || w.invalid);
174
174
  };
175
- return i(() => {
176
- if (C.current?.focus(), m === "end") {
177
- let e = C.current?.value.length ?? 0;
178
- C.current?.setSelectionRange(e, e);
179
- } else C.current?.select();
180
- }, []), /* @__PURE__ */ c("div", {
175
+ return e(() => {
176
+ if (S.current?.focus(), p === "end") {
177
+ let e = S.current?.value.length ?? 0;
178
+ S.current?.setSelectionRange(e, e);
179
+ } else S.current?.select();
180
+ }, []), /* @__PURE__ */ r("div", {
181
181
  class: "rv-number-draft",
182
182
  onKeyDown: (e) => {
183
- e.isComposing || w.current || (e.key === "Enter" && (e.target === C.current || e.ctrlKey || e.metaKey) ? (e.preventDefault(), k()) : e.target === C.current && ["ArrowUp", "ArrowDown"].includes(e.key) && (e.preventDefault(), j(e.key === "ArrowUp" ? 1 : -1)));
183
+ e.isComposing || C.current || (e.key === "Enter" && (e.target === S.current || e.ctrlKey || e.metaKey) ? (e.preventDefault(), O()) : e.target === S.current && ["ArrowUp", "ArrowDown"].includes(e.key) && (e.preventDefault(), A(e.key === "ArrowUp" ? 1 : -1)));
184
184
  },
185
185
  children: [
186
- /* @__PURE__ */ s("label", {
187
- htmlFor: S,
188
- children: d.label ?? (d.kind === "currency" ? "Currency amount" : d.kind === "percent" ? "Percentage" : "Number")
186
+ /* @__PURE__ */ r("label", {
187
+ htmlFor: x,
188
+ children: u.label ?? (u.kind === "currency" ? "Currency amount" : u.kind === "percent" ? "Percentage" : "Number")
189
189
  }),
190
- /* @__PURE__ */ c("div", {
190
+ /* @__PURE__ */ r("div", {
191
191
  class: "rv-number-draft__entry",
192
192
  children: [
193
- /* @__PURE__ */ s(e, {
194
- ref: C,
195
- id: S,
193
+ /* @__PURE__ */ r(i, {
194
+ ref: S,
195
+ id: x,
196
196
  class: "rv-control",
197
197
  type: "text",
198
198
  inputMode: "decimal",
199
- value: _,
200
- "aria-invalid": O,
201
- "aria-describedby": O ? `${S}-error` : void 0,
202
- required: d.required,
199
+ value: g,
200
+ "aria-invalid": D,
201
+ "aria-describedby": D ? `${x}-error` : void 0,
202
+ required: u.required,
203
203
  onCompositionStart: () => {
204
- w.current = !0;
204
+ C.current = !0;
205
205
  },
206
206
  onCompositionEnd: () => {
207
- w.current = !1;
207
+ C.current = !1;
208
208
  },
209
- onInput: (e) => A(e.currentTarget.value)
209
+ onInput: (e) => k(e.currentTarget.value)
210
210
  }),
211
- /* @__PURE__ */ s(t, {
212
- "aria-label": T.decrease,
213
- disabled: E.error !== void 0,
214
- onClick: () => j(-1),
211
+ /* @__PURE__ */ r(a, {
212
+ "aria-label": w.decrease,
213
+ disabled: T.error !== void 0,
214
+ onClick: () => A(-1),
215
215
  children: "−"
216
216
  }),
217
- /* @__PURE__ */ s(t, {
218
- "aria-label": T.increase,
219
- disabled: E.error !== void 0,
220
- onClick: () => j(1),
217
+ /* @__PURE__ */ r(a, {
218
+ "aria-label": w.increase,
219
+ disabled: T.error !== void 0,
220
+ onClick: () => A(1),
221
221
  children: "+"
222
222
  })
223
223
  ]
224
224
  }),
225
- O && /* @__PURE__ */ s("p", {
225
+ D && /* @__PURE__ */ r("p", {
226
226
  class: "rv-editor-error",
227
- id: `${S}-error`,
227
+ id: `${x}-error`,
228
228
  role: "alert",
229
- children: D || T.invalid || l.invalid
229
+ children: E || w.invalid || c.invalid
230
230
  }),
231
- /* @__PURE__ */ s(r, {
232
- text: d.actions,
233
- apply: k,
234
- cancel: p,
235
- disabled: O,
236
- clear: d.required ? void 0 : () => A("")
231
+ /* @__PURE__ */ r(s, {
232
+ text: u.actions,
233
+ apply: O,
234
+ cancel: f,
235
+ disabled: D,
236
+ clear: u.required ? void 0 : () => k("")
237
237
  })
238
238
  ]
239
239
  });
240
240
  }
241
241
  //#endregion
242
- export { v as a, g as i, h as n, m as r, y as t };
242
+ export { _ as a, h as i, m as n, p as r, v as t };
@@ -0,0 +1,122 @@
1
+ import { i as e } from "./preact.module-BBM36DnO.js";
2
+ import { i as t } from "./hooks.module-CG3gN83z.js";
3
+ import { t as n } from "./jsxRuntime.module-F6UFnpT-.js";
4
+ import { ButtonControl as r } from "../native-control.js";
5
+ import { DEFAULT_CALENDAR_TRANSLATIONS as i } from "../calendar/translations.js";
6
+ import { n as a } from "./iso-B0YHBK7m.js";
7
+ import { f as o, h as s, m as c, o as l, p as u } from "./model-mPO2tG2f.js";
8
+ import { t as d } from "./calendar-CpaUK7w1.js";
9
+ //#region src/calendar/picker.tsx
10
+ function f(f) {
11
+ let { selected: p, onSelectionChange: ee, presets: m, mode: h = "single", min: g = 0, max: _ = Infinity, required: v = !1, excludeDisabled: y = !1, month: b, defaultMonth: x, onMonthChange: S, ...C } = f, w = typeof p == "string" ? p : Array.isArray(p) ? p[0] : p?.from, [T, E] = t(x ?? w ?? f.referenceDate ?? s()), [D, O] = t(w ?? T), [k, A] = t(), [j, M] = t(), N = (e) => {
12
+ A(e), M(void 0);
13
+ }, P = b ?? T, F = f.views?.filter((e) => e === "month" || e === "year"), I = F?.length ? F : f.views || f.enableYearView === !1 ? ["month"] : ["month", "year"], [L, R] = t(f.defaultView && I.includes(f.defaultView) ? f.defaultView : I[0]), z = I.includes(L) ? L : I[0], B = (e) => {
14
+ E(e), N(), S?.(e);
15
+ }, V = f.translations?.invalidSelection ?? i.invalidSelection, H = (e, t = V) => {
16
+ A(e), M(t), f.onInvalidSelection?.(t, e);
17
+ }, U = (e) => !!(f.minDate && e < f.minDate || f.maxDate && e > f.maxDate || f.isDateDisabled?.(e) || f.isMonthDisabled?.(o(e, f.calendarSystem))), W = (e) => {
18
+ if (!e.to) return !U(e.from);
19
+ let t = c(e.from, e.to);
20
+ if (t < g || t > _ || t < 0 || U(e.from) || U(e.to)) return !1;
21
+ if (y) {
22
+ if (t > 366e3) return !1;
23
+ for (let t = e.from; t <= e.to; t = u(t, 1)) if (U(t)) return !1;
24
+ }
25
+ return !0;
26
+ }, G = (e) => {
27
+ if (f.mode === "multiple") {
28
+ let t = f.selected ?? [], n = t.includes(e), r = n ? t.filter((t) => t !== e) : [...t, e];
29
+ if (n && r.length < Math.max(g, +!!v) || r.length > _) {
30
+ H(e);
31
+ return;
32
+ }
33
+ f.onSelectionChange(r);
34
+ } else if (f.mode === "range") {
35
+ let t = f.selected;
36
+ if (!t || t.to) {
37
+ f.onSelectionChange({ from: e }), N();
38
+ return;
39
+ }
40
+ let n = l(t.from, e);
41
+ if (!W(n)) {
42
+ y && c(n.from, n.to) >= g && c(n.from, n.to) <= _ && f.onSelectionChange({ from: e }), H(e);
43
+ return;
44
+ }
45
+ f.onSelectionChange(n), N();
46
+ } else f.onSelectionChange(f.selected === e && !v ? void 0 : e);
47
+ }, K = f.mode === "range" ? f.selected : void 0, q = typeof p == "string" ? {
48
+ from: p,
49
+ to: p
50
+ } : K ? {
51
+ from: K.from,
52
+ to: K.to ?? K.from
53
+ } : void 0, J = K && !K.to && k ? l(K.from, k) : void 0, Y = (e) => {
54
+ let t = f.validateSelection?.(e, {
55
+ month: o(P, f.calendarSystem),
56
+ view: z,
57
+ selection: q,
58
+ preview: J,
59
+ referenceDate: f.referenceDate ?? (f.referenceInstant ? a(f.referenceInstant, f.timeZone ?? "UTC") : void 0)
60
+ });
61
+ if (t === !1 || typeof t == "string") return typeof t == "string" ? t : V;
62
+ }, X = J && !W(J) ? V : void 0, Z = j ?? X, Q = (e) => {
63
+ let t = Y(e);
64
+ return !t || (H(e, t), !1);
65
+ }, $ = (e) => {
66
+ let t = e.selection, n;
67
+ if (f.mode === "multiple") {
68
+ if (!Array.isArray(t) || t.length < Math.max(g, +!!v) || t.length > _ || t.some(U)) return;
69
+ let e = [...new Set(t)];
70
+ if (e.length < Math.max(g, +!!v) || !e.every(Q)) return;
71
+ f.onSelectionChange(e), n = e[0] ?? P;
72
+ } else if (f.mode === "range") {
73
+ if (!t?.from || !W(t) || !Q(t.from) || t.to && !Q(t.to)) return;
74
+ f.onSelectionChange(t), n = t.from;
75
+ } else {
76
+ if (typeof t != "string" || U(t) || !Q(t)) return;
77
+ f.onSelectionChange(t), n = t;
78
+ }
79
+ O(n), B(o(n, f.calendarSystem)), N();
80
+ };
81
+ return /* @__PURE__ */ n(d, {
82
+ ...C,
83
+ onViewChange: (e) => {
84
+ R(e), N(), f.onViewChange?.(e);
85
+ },
86
+ month: P,
87
+ focusedDate: D,
88
+ onFocusedDateChange: O,
89
+ onMonthChange: B,
90
+ selection: q,
91
+ selectedDates: f.mode === "multiple" ? f.selected : void 0,
92
+ preview: J,
93
+ previewInvalid: !!(J && Z),
94
+ previewDescription: h === "range" ? Z ?? "" : void 0,
95
+ onInvalidSelection: (e, t) => H(t, e),
96
+ fixedWeeks: f.fixedWeeks ?? !1,
97
+ showOutsideDays: f.showOutsideDays ?? !0,
98
+ allowOutsideMonthSelection: f.allowOutsideMonthSelection ?? !0,
99
+ onPresetSelect: (e) => {
100
+ if (f.mode === "multiple") {
101
+ let t = f.selected ?? [];
102
+ if (t.includes(e)) return;
103
+ if (t.length >= _) {
104
+ H(e);
105
+ return;
106
+ }
107
+ f.onSelectionChange([...t, e]);
108
+ } else f.mode === "range" ? f.onSelectionChange({ from: e }) : f.onSelectionChange(e);
109
+ },
110
+ onSelect: G,
111
+ onPreviewDateChange: N,
112
+ footer: m?.length || f.footer ? /* @__PURE__ */ n(e, { children: [m?.length ? /* @__PURE__ */ n("div", {
113
+ class: "revo-calendar__presets",
114
+ children: m.map((e) => /* @__PURE__ */ n(r, {
115
+ onClick: () => $(e),
116
+ children: e.label
117
+ }, e.label))
118
+ }) : null, f.footer] }) : void 0
119
+ });
120
+ }
121
+ //#endregion
122
+ export { f as t };