@tempots/beatui 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/dist/ar-Wr6gMs-M.cjs +1 -0
  2. package/dist/{ar-C-kUt6f9.js → ar-fdUqbCvM.js} +154 -1
  3. package/dist/auth/index.cjs.js +1 -1
  4. package/dist/auth/index.es.js +1 -1
  5. package/dist/auth-divider-DewHpITQ.cjs +1 -0
  6. package/dist/{auth-divider-D_3gKZ6g.js → auth-divider-qnJuYK-x.js} +7 -7
  7. package/dist/beatui.css +2107 -171
  8. package/dist/beatui.tailwind.css +2107 -171
  9. package/dist/better-auth/index.cjs.js +1 -1
  10. package/dist/better-auth/index.es.js +5 -5
  11. package/dist/{modal-YKqlh4Dk.js → custom-validation-BetUqAEz.js} +186 -186
  12. package/dist/custom-validation-CLscGHY4.cjs +1 -0
  13. package/dist/{de-CP0kbElb.js → de-C5-k5Eov.js} +156 -3
  14. package/dist/de-DZqdSEta.cjs +1 -0
  15. package/dist/deep-merge-D90SW1Ci.cjs +1 -0
  16. package/dist/deep-merge-ZVigk5Qf.js +1765 -0
  17. package/dist/{duration-input-BrYLC1js.cjs → duration-input-4AQnQpyo.cjs} +1 -1
  18. package/dist/{duration-input-CFu6vq-y.js → duration-input-GMBmT1BE.js} +4 -4
  19. package/dist/{editor-toolbar-group-QVdBUbB8.cjs → editor-toolbar-group-C_ft_T8D.cjs} +1 -1
  20. package/dist/{editor-toolbar-group-DWUWUO-B.js → editor-toolbar-group-FpOHrmtx.js} +2 -2
  21. package/dist/es-CJgYfRap.cjs +1 -0
  22. package/dist/{es-BtIkcnsw.js → es-h6jmoF4X.js} +156 -3
  23. package/dist/fa-BQ5PzwNY.cjs +1 -0
  24. package/dist/{fa-11-rZmQ-.js → fa-BuxK837l.js} +154 -1
  25. package/dist/fr-Bv3TG44U.cjs +1 -0
  26. package/dist/{fr-C-L2F8w2.js → fr-BwILQ9G2.js} +165 -12
  27. package/dist/he-5LbvgMCC.cjs +1 -0
  28. package/dist/{he-Bu1xGoQ9.js → he-yC9Sc7JD.js} +154 -1
  29. package/dist/{hi-CewH-MAH.js → hi-Da7rcCpP.js} +154 -1
  30. package/dist/hi-YWhWcG_L.cjs +1 -0
  31. package/dist/{index-BGKz2Nol.js → index-DI8bf9oC.js} +175 -172
  32. package/dist/index-DeUj-5ph.cjs +1 -0
  33. package/dist/index.cjs.js +4 -4
  34. package/dist/index.es.js +11806 -8105
  35. package/dist/{input-container-CO3DNqpp.js → input-container-8JFB11xN.js} +1 -1
  36. package/dist/{input-container-BkPcNDaZ.cjs → input-container-CyOgiiQD.cjs} +1 -1
  37. package/dist/it-BxOIJE45.cjs +1 -0
  38. package/dist/{it-5hiKQO_p.js → it-Yeklau78.js} +156 -3
  39. package/dist/ja-CNhjK06P.cjs +1 -0
  40. package/dist/{ja-CGfEmZrm.js → ja-Dxj9Q5Yd.js} +155 -2
  41. package/dist/json-schema/index.cjs.js +1 -1
  42. package/dist/json-schema/index.es.js +110 -110
  43. package/dist/json-schema-display/index.cjs.js +1 -1
  44. package/dist/json-schema-display/index.es.js +1 -1
  45. package/dist/json-structure/index.cjs.js +1 -1
  46. package/dist/json-structure/index.es.js +5 -5
  47. package/dist/ko-DgkqcXTs.cjs +1 -0
  48. package/dist/{ko-DZthvREd.js → ko-gn_MsegK.js} +154 -1
  49. package/dist/lexical/index.cjs.js +1 -1
  50. package/dist/lexical/index.es.js +4 -4
  51. package/dist/nl-Dy9lmbBO.cjs +1 -0
  52. package/dist/{nl-CcKyHlQ7.js → nl-vHNFtXXb.js} +162 -9
  53. package/dist/{notice-Du3tWJTW.js → notice-B6ojfenv.js} +4 -4
  54. package/dist/{notice-Q0A1gIho.cjs → notice-p2IqXS5-.cjs} +1 -1
  55. package/dist/{oneof-branch-detection-DSzC0PkO.js → oneof-branch-detection-Q_jxvJIA.js} +1 -1
  56. package/dist/{oneof-branch-detection-BEkAezNi.cjs → oneof-branch-detection-xDDDdYRk.cjs} +1 -1
  57. package/dist/pl-BtYbtsmG.cjs +1 -0
  58. package/dist/{pl-Mwtjp4MV.js → pl-C0UdHla0.js} +184 -31
  59. package/dist/prosemirror/index.cjs.js +1 -1
  60. package/dist/prosemirror/index.es.js +4 -4
  61. package/dist/pt-CtNmqQ1X.cjs +1 -0
  62. package/dist/{pt-BaTsY-8f.js → pt-DGKtfN0d.js} +156 -3
  63. package/dist/ru-BaL_NPRU.cjs +1 -0
  64. package/dist/{ru-CvbGmz5s.js → ru-CpXYLt-v.js} +154 -1
  65. package/dist/tailwind/preset.cjs.js +1 -1
  66. package/dist/tailwind/preset.es.js +1 -1
  67. package/dist/tailwind/vite-plugin.cjs.js +1 -1
  68. package/dist/tailwind/vite-plugin.es.js +1 -1
  69. package/dist/{text-input-D_IxFd0M.cjs → text-input-DS5zlXb2.cjs} +1 -1
  70. package/dist/{text-input-BAn02BzO.js → text-input-NJypZSnE.js} +1 -1
  71. package/dist/{toolbar-CnecqhaU.cjs → toolbar-BBwfe8U9.cjs} +1 -1
  72. package/dist/{toolbar-BKan3NHw.js → toolbar-BF2L6WKC.js} +1 -1
  73. package/dist/{tr-YFqQdZjM.js → tr-DIFZDFW_.js} +156 -3
  74. package/dist/tr-DwOd87oB.cjs +1 -0
  75. package/dist/{translations-CxDUnbXn.js → translations-5cXBrENb.js} +1 -1
  76. package/dist/{translations-DT5QQ4WO.js → translations-BCMP-h52.js} +269 -115
  77. package/dist/{translations-C_-cObaF.cjs → translations-BqWc0ZHz.cjs} +1 -1
  78. package/dist/translations-EwEmHe3v.cjs +1 -0
  79. package/dist/types/beatui-i18n/default.d.ts +109 -0
  80. package/dist/types/beatui-i18n/locales/en.d.ts +109 -0
  81. package/dist/types/beatui-i18n/translations.d.ts +109 -0
  82. package/dist/types/components/button/copy-button.d.ts +42 -0
  83. package/dist/types/components/button/index.d.ts +1 -0
  84. package/dist/types/components/button/toggle-button-group.d.ts +2 -2
  85. package/dist/types/components/button/toggle-button.d.ts +2 -2
  86. package/dist/types/components/data/data-table-context.d.ts +9 -1
  87. package/dist/types/components/data/data-table-row-details.d.ts +21 -0
  88. package/dist/types/components/data/data-table-types.d.ts +23 -0
  89. package/dist/types/components/data/date-picker-shared.d.ts +2 -5
  90. package/dist/types/components/data/date-picker.d.ts +1 -1
  91. package/dist/types/components/data/date-range-picker.d.ts +1 -1
  92. package/dist/types/components/data/index.d.ts +4 -0
  93. package/dist/types/components/data/stat-card.d.ts +108 -0
  94. package/dist/types/components/data/time-picker.d.ts +54 -0
  95. package/dist/types/components/data/virtual-scrolling/index.d.ts +1 -0
  96. package/dist/types/components/data/virtual-scrolling/virtual-list.d.ts +91 -0
  97. package/dist/types/components/form/control/control.d.ts +5 -5
  98. package/dist/types/components/form/control/list-control.d.ts +11 -11
  99. package/dist/types/components/form/fieldset/fieldset.d.ts +60 -0
  100. package/dist/types/components/form/fieldset/index.d.ts +1 -0
  101. package/dist/types/components/form/index.d.ts +1 -0
  102. package/dist/types/components/form/input/checkbox-input.d.ts +1 -1
  103. package/dist/types/components/form/input/color-input.d.ts +1 -1
  104. package/dist/types/components/form/input/color-picker/canvas-draw.d.ts +12 -0
  105. package/dist/types/components/form/input/color-picker/channel-picker.d.ts +71 -0
  106. package/dist/types/components/form/input/color-picker/hex-color-picker.d.ts +20 -0
  107. package/dist/types/components/form/input/color-picker/hsl-color-picker.d.ts +14 -0
  108. package/dist/types/components/form/input/color-picker/hwb-color-picker.d.ts +15 -0
  109. package/dist/types/components/form/input/color-picker/index.d.ts +7 -0
  110. package/dist/types/components/form/input/color-picker/oklch-color-picker.d.ts +15 -0
  111. package/dist/types/components/form/input/color-picker/rgb-color-picker.d.ts +17 -0
  112. package/dist/types/components/form/input/color-swatch-input.d.ts +1 -1
  113. package/dist/types/components/form/input/combobox-input.d.ts +3 -3
  114. package/dist/types/components/form/input/combobox-tags-input.d.ts +1 -1
  115. package/dist/types/components/form/input/date-input.d.ts +1 -1
  116. package/dist/types/components/form/input/date-range-select-base.d.ts +23 -0
  117. package/dist/types/components/form/input/date-range-select.d.ts +64 -0
  118. package/dist/types/components/form/input/date-select.d.ts +52 -0
  119. package/dist/types/components/form/input/date-time-input.d.ts +2 -2
  120. package/dist/types/components/form/input/date-time-select-base.d.ts +23 -0
  121. package/dist/types/components/form/input/date-time-select.d.ts +66 -0
  122. package/dist/types/components/form/input/dropdown-input.d.ts +3 -3
  123. package/dist/types/components/form/input/email-input.d.ts +1 -1
  124. package/dist/types/components/form/input/field-layout.d.ts +64 -0
  125. package/dist/types/components/form/input/{input-wrapper.d.ts → field.d.ts} +23 -14
  126. package/dist/types/components/form/input/index.d.ts +19 -1
  127. package/dist/types/components/form/input/multi-select.d.ts +2 -2
  128. package/dist/types/components/form/input/native-select.d.ts +1 -1
  129. package/dist/types/components/form/input/nullable-date-select.d.ts +55 -0
  130. package/dist/types/components/form/input/nullable-date-time-select.d.ts +68 -0
  131. package/dist/types/components/form/input/nullable-time-select.d.ts +64 -0
  132. package/dist/types/components/form/input/number-input.d.ts +5 -40
  133. package/dist/types/components/form/input/number-stepper.d.ts +53 -0
  134. package/dist/types/components/form/input/open-date-range-select.d.ts +75 -0
  135. package/dist/types/components/form/input/otp-input.d.ts +2 -2
  136. package/dist/types/components/form/input/password-input.d.ts +1 -1
  137. package/dist/types/components/form/input/radio-group.d.ts +1 -1
  138. package/dist/types/components/form/input/range-slider.d.ts +23 -6
  139. package/dist/types/components/form/input/rating-input.d.ts +1 -1
  140. package/dist/types/components/form/input/segmented-input.d.ts +6 -2
  141. package/dist/types/components/form/input/segmented-select.d.ts +84 -0
  142. package/dist/types/components/form/input/select-tags-input.d.ts +1 -1
  143. package/dist/types/components/form/input/slider-input.d.ts +2 -2
  144. package/dist/types/components/form/input/sortable-list.d.ts +68 -0
  145. package/dist/types/components/form/input/switch.d.ts +1 -1
  146. package/dist/types/components/form/input/text-area.d.ts +1 -1
  147. package/dist/types/components/form/input/text-input.d.ts +1 -1
  148. package/dist/types/components/form/input/time-format.d.ts +31 -0
  149. package/dist/types/components/form/input/time-select-base.d.ts +23 -0
  150. package/dist/types/components/form/input/time-select.d.ts +61 -0
  151. package/dist/types/components/form/input/transfer-list.d.ts +56 -0
  152. package/dist/types/components/form/input/tri-state-checkbox-input.d.ts +1 -1
  153. package/dist/types/components/form/input/url-input.d.ts +1 -1
  154. package/dist/types/components/format/format-bigint.d.ts +64 -0
  155. package/dist/types/components/format/format-date-time.d.ts +54 -0
  156. package/dist/types/components/format/format-date.d.ts +82 -0
  157. package/dist/types/components/format/format-display-name.d.ts +70 -0
  158. package/dist/types/components/format/format-file-size.d.ts +30 -0
  159. package/dist/types/components/format/format-list.d.ts +61 -0
  160. package/dist/types/components/format/format-number.d.ts +88 -0
  161. package/dist/types/components/format/format-plural.d.ts +96 -0
  162. package/dist/types/components/format/format-relative-time.d.ts +62 -0
  163. package/dist/types/components/format/format-time.d.ts +66 -0
  164. package/dist/types/components/format/index.d.ts +11 -0
  165. package/dist/types/components/i18n/locale-selector.d.ts +1 -1
  166. package/dist/types/components/json-schema/controls/composition-shared.d.ts +1 -1
  167. package/dist/types/components/json-schema/controls/shared-utils.d.ts +3 -3
  168. package/dist/types/components/json-schema/widgets/string-controls.d.ts +2 -2
  169. package/dist/types/components/json-schema-display/display-wrapper.d.ts +1 -1
  170. package/dist/types/components/layout/nine-slice-scroll-view.d.ts +1 -1
  171. package/dist/types/components/navigation/index.d.ts +1 -0
  172. package/dist/types/components/navigation/stepper.d.ts +102 -0
  173. package/dist/types/components/overlay/index.d.ts +1 -1
  174. package/dist/types/components/overlay/spotlight.d.ts +62 -0
  175. package/dist/types/index.d.ts +1 -0
  176. package/dist/types/utils/index.d.ts +0 -1
  177. package/dist/ur-D9nLchps.cjs +1 -0
  178. package/dist/{ur-CdnwwnG_.js → ur-DBst-TXc.js} +154 -1
  179. package/dist/use-form-Dcra7GeE.cjs +2 -0
  180. package/dist/{use-form-D_TJyZhP.js → use-form-NfobsGNl.js} +474 -434
  181. package/dist/{vi-Bwvz1d_n.js → vi-DQOJp32U.js} +183 -30
  182. package/dist/vi-Dg1aiMr5.cjs +1 -0
  183. package/dist/widget-customization-BtkexHgm.js +1458 -0
  184. package/dist/widget-customization-pqmtsraC.cjs +1 -0
  185. package/dist/{zh-hy7Uw6c5.js → zh-DPK4HXl2.js} +154 -1
  186. package/dist/zh-tbwSTbmn.cjs +1 -0
  187. package/package.json +9 -9
  188. package/dist/ar-Dc56zcjW.cjs +0 -1
  189. package/dist/auth-divider-itm5-j5G.cjs +0 -1
  190. package/dist/de-DboQlEC4.cjs +0 -1
  191. package/dist/deep-merge-Bydz6jLt.cjs +0 -1
  192. package/dist/deep-merge-CzZVsVF-.js +0 -1704
  193. package/dist/es-CAmE_0Ph.cjs +0 -1
  194. package/dist/fa-D9LrFZdW.cjs +0 -1
  195. package/dist/fr-DKogQyss.cjs +0 -1
  196. package/dist/he-CVx91Jdr.cjs +0 -1
  197. package/dist/hi-BgrHV72l.cjs +0 -1
  198. package/dist/index-DFF7Uahh.cjs +0 -1
  199. package/dist/it-B1rA1F9l.cjs +0 -1
  200. package/dist/ja-DZnjjqoi.cjs +0 -1
  201. package/dist/ko-CDnYKYWU.cjs +0 -1
  202. package/dist/modal-DCxNGrzk.cjs +0 -1
  203. package/dist/nl-Bj8QnDEY.cjs +0 -1
  204. package/dist/pl-BmuuxxVd.cjs +0 -1
  205. package/dist/pt-RiC0yeVA.cjs +0 -1
  206. package/dist/ru-pRqtOQHF.cjs +0 -1
  207. package/dist/tr-B9JhBJeL.cjs +0 -1
  208. package/dist/translations-qefRsdGi.cjs +0 -1
  209. package/dist/types/components/overlay/command-palette.d.ts +0 -17
  210. package/dist/types/utils/color.d.ts +0 -346
  211. package/dist/ur-BZakU0iv.cjs +0 -1
  212. package/dist/use-form-BvBkVEKi.cjs +0 -2
  213. package/dist/vi-D1nly0nb.cjs +0 -1
  214. package/dist/widget-customization-BAchyOUo.js +0 -1066
  215. package/dist/widget-customization-DELy3SMQ.cjs +0 -1
  216. package/dist/zh-DBk7sSD9.cjs +0 -1
@@ -1,1066 +0,0 @@
1
- import { Value as p, prop as ut, computedOf as D, html as _, attr as u, svg as ot, svgAttr as J, Empty as A, on as I, When as z, Fragment as j, aria as R, emitValue as at, Use as ft, input as pt, emitValueAsNullableDate as ct, emitValueAsNullableDateTime as it, Repeat as mt, emit as bt, style as wt, emitValueAsNumber as E } from "@tempots/dom";
2
- import { F as yt, N as X, T as Mt, U as It, a as $t } from "./deep-merge-CzZVsVF-.js";
3
- import { decodeBase64 as xt } from "@tempots/std";
4
- import { I as P } from "./input-container-CO3DNqpp.js";
5
- import { C as O, m as dt, T as _t } from "./text-input-BAn02BzO.js";
6
- import { B as kt, I as et, b as lt, a as Ft } from "./translations-DT5QQ4WO.js";
7
- import { AutoSelect as Ct } from "@tempots/ui";
8
- import { E as Tt, P as St } from "./notice-Du3tWJTW.js";
9
- import { s as At } from "./session-id-3KiilioY.js";
10
- import { r as vt } from "./utils-vUtP6iPG.js";
11
- function ht(t) {
12
- if (typeof t != "string") return !1;
13
- const e = t.startsWith("#") ? t.slice(1) : t;
14
- return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(e);
15
- }
16
- function Nt(t) {
17
- if (typeof t != "string") return !1;
18
- const e = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i, a = t.match(e);
19
- if (!a) return !1;
20
- const [, n, r, s] = a, o = parseInt(n, 10), c = parseInt(r, 10), i = parseInt(s, 10);
21
- return o >= 0 && o <= 255 && c >= 0 && c <= 255 && i >= 0 && i <= 255;
22
- }
23
- function Rt(t) {
24
- if (typeof t != "string") return !1;
25
- const e = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i, a = t.match(e);
26
- if (!a) return !1;
27
- const [, n, r, s, o] = a, c = parseInt(n, 10), i = parseInt(r, 10), l = parseInt(s, 10), d = parseFloat(o);
28
- return c >= 0 && c <= 255 && i >= 0 && i <= 255 && l >= 0 && l <= 255 && d >= 0 && d <= 1;
29
- }
30
- function Bt(t) {
31
- if (typeof t != "string") return !1;
32
- const e = /^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i, a = t.match(e);
33
- if (!a) return !1;
34
- const [, n, r, s] = a, o = parseInt(n, 10), c = parseInt(r, 10), i = parseInt(s, 10);
35
- return o >= 0 && o <= 360 && c >= 0 && c <= 100 && i >= 0 && i <= 100;
36
- }
37
- function de(t) {
38
- return ht(t) || Nt(t) || Rt(t) || Bt(t);
39
- }
40
- function Dt(t) {
41
- if (!ht(t)) return null;
42
- let e = t.startsWith("#") ? t.slice(1) : t;
43
- return e.length === 3 && (e = e.split("").map((a) => a + a).join("")), `#${e.toLowerCase()}`;
44
- }
45
- function nt(t, e, a) {
46
- const n = (r) => {
47
- const s = Math.round(Math.max(0, Math.min(255, r))).toString(16);
48
- return s.length === 1 ? "0" + s : s;
49
- };
50
- return `#${n(t)}${n(e)}${n(a)}`;
51
- }
52
- function H(t) {
53
- const e = Dt(t);
54
- if (!e) return null;
55
- const a = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
56
- return a ? {
57
- r: parseInt(a[1], 16),
58
- g: parseInt(a[2], 16),
59
- b: parseInt(a[3], 16)
60
- } : null;
61
- }
62
- function he(t, e) {
63
- const a = H(t), n = H(e);
64
- if (!a || !n) return null;
65
- const r = (l, d, h) => {
66
- const [w, f, g] = [l, d, h].map((y) => (y = y / 255, y <= 0.03928 ? y / 12.92 : Math.pow((y + 0.055) / 1.055, 2.4)));
67
- return 0.2126 * w + 0.7152 * f + 0.0722 * g;
68
- }, s = r(a.r, a.g, a.b), o = r(n.r, n.g, n.b), c = Math.max(s, o), i = Math.min(s, o);
69
- return (c + 0.05) / (i + 0.05);
70
- }
71
- function Vt(t) {
72
- if (!t) return [0, 0, 0, 1];
73
- const a = t.trim().match(
74
- /^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/
75
- );
76
- if (a) {
77
- const l = a[1];
78
- if (l.length === 8) {
79
- const d = parseInt(l.slice(0, 2), 16), h = parseInt(l.slice(2, 4), 16), w = parseInt(l.slice(4, 6), 16), f = parseInt(l.slice(6, 8), 16) / 255;
80
- return [d, h, w, f];
81
- }
82
- if (l.length === 6)
83
- return [
84
- parseInt(l.slice(0, 2), 16),
85
- parseInt(l.slice(2, 4), 16),
86
- parseInt(l.slice(4, 6), 16),
87
- 1
88
- ];
89
- if (l.length === 4) {
90
- const d = parseInt(l[0] + l[0], 16), h = parseInt(l[1] + l[1], 16), w = parseInt(l[2] + l[2], 16), f = parseInt(l[3] + l[3], 16) / 255;
91
- return [d, h, w, f];
92
- }
93
- if (l.length === 3) {
94
- const d = parseInt(l[0] + l[0], 16), h = parseInt(l[1] + l[1], 16), w = parseInt(l[2] + l[2], 16);
95
- return [d, h, w, 1];
96
- }
97
- }
98
- const n = t.match(
99
- /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i
100
- );
101
- if (n)
102
- return [
103
- parseInt(n[1], 10),
104
- parseInt(n[2], 10),
105
- parseInt(n[3], 10),
106
- parseFloat(n[4])
107
- ];
108
- const r = t.match(
109
- /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i
110
- );
111
- if (r)
112
- return [parseInt(r[1], 10), parseInt(r[2], 10), parseInt(r[3], 10), 1];
113
- const s = t.match(
114
- /^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i
115
- );
116
- if (s) {
117
- const l = parseFloat(s[1]), d = parseFloat(s[2]), h = parseFloat(s[3]), w = s[4] != null ? parseFloat(s[4]) : 1, [f, g, y] = gt(l, d / 100, h / 100);
118
- return [f, g, y, w];
119
- }
120
- const o = t.match(
121
- /^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i
122
- );
123
- if (o) {
124
- const l = parseFloat(o[1]), d = parseFloat(o[2]) / 100, h = parseFloat(o[3]) / 100, w = o[4] != null ? parseFloat(o[4]) : 1, [f, g, y] = Ot(l, d, h);
125
- return [f, g, y, w];
126
- }
127
- const c = t.match(
128
- /^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i
129
- );
130
- if (c) {
131
- const l = c[1], d = parseFloat(c[2]), h = parseFloat(c[3]), w = c[4] != null ? parseFloat(c[4]) : 1, f = l.endsWith("%") ? Math.max(0, Math.min(1, parseFloat(l) / 100)) : Math.max(0, Math.min(1, parseFloat(l))), [g, y, F] = Ut(f, d, h);
132
- return [g, y, F, w];
133
- }
134
- const i = H(t);
135
- return i ? [i.r, i.g, i.b, 1] : [0, 0, 0, 1];
136
- }
137
- function Et(t, e, a, n) {
138
- return `rgba(${Math.round(t)}, ${Math.round(e)}, ${Math.round(a)}, ${Math.max(
139
- 0,
140
- Math.min(1, Math.round(n * 100) / 100)
141
- )})`;
142
- }
143
- function Pt(t) {
144
- let e = t + 1831565813;
145
- return function() {
146
- return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
147
- };
148
- }
149
- function gt(t, e, a) {
150
- t = (t % 360 + 360) % 360;
151
- const n = (1 - Math.abs(2 * a - 1)) * e, r = n * (1 - Math.abs(t / 60 % 2 - 1)), s = a - n / 2;
152
- let o, c, i;
153
- return 0 <= t && t < 60 ? [o, c, i] = [n, r, 0] : 60 <= t && t < 120 ? [o, c, i] = [r, n, 0] : 120 <= t && t < 180 ? [o, c, i] = [0, n, r] : 180 <= t && t < 240 ? [o, c, i] = [0, r, n] : 240 <= t && t < 300 ? [o, c, i] = [r, 0, n] : [o, c, i] = [n, 0, r], [
154
- Math.round((o + s) * 255),
155
- Math.round((c + s) * 255),
156
- Math.round((i + s) * 255)
157
- ];
158
- }
159
- function Ot(t, e, a) {
160
- t = (t % 360 + 360) % 360;
161
- const n = e + a;
162
- n > 1 && (e /= n, a /= n);
163
- const [r, s, o] = gt(t, 1, 0.5).map((h) => h / 255), c = 1 - e - a, i = r * c + e, l = s * c + e, d = o * c + e;
164
- return [Math.round(i * 255), Math.round(l * 255), Math.round(d * 255)];
165
- }
166
- function st(t, e, a) {
167
- t /= 255, e /= 255, a /= 255;
168
- const n = Math.max(t, e, a), r = Math.min(t, e, a);
169
- let s = 0, o = 0;
170
- const c = (n + r) / 2, i = n - r;
171
- if (i !== 0) {
172
- switch (o = c > 0.5 ? i / (2 - n - r) : i / (n + r), n) {
173
- case t:
174
- s = (e - a) / i + (e < a ? 6 : 0);
175
- break;
176
- case e:
177
- s = (a - t) / i + 2;
178
- break;
179
- default:
180
- s = (t - e) / i + 4;
181
- }
182
- s *= 60;
183
- }
184
- return [Math.round(s), Math.round(o * 100), Math.round(c * 100)];
185
- }
186
- function Lt(t, e, a) {
187
- const [n] = st(t, e, a), r = t / 255, s = e / 255, o = a / 255, c = Math.min(r, s, o), i = 1 - Math.max(r, s, o);
188
- return [n, Math.round(c * 100), Math.round(i * 100)];
189
- }
190
- function Z(t) {
191
- const e = t / 255;
192
- return e <= 0.04045 ? e / 12.92 : Math.pow((e + 0.055) / 1.055, 2.4);
193
- }
194
- function tt(t) {
195
- const e = t <= 31308e-7 ? 12.92 * t : 1.055 * Math.pow(t, 0.4166666666666667) - 0.055;
196
- return Math.round(Math.max(0, Math.min(1, e)) * 255);
197
- }
198
- function Ut(t, e, a) {
199
- const n = a * Math.PI / 180, r = Math.cos(n) * e, s = Math.sin(n) * e, o = t + 0.3963377774 * r + 0.2158037573 * s, c = t - 0.1055613458 * r - 0.0638541728 * s, i = t - 0.0894841775 * r - 1.291485548 * s, l = o * o * o, d = c * c * c, h = i * i * i, w = 4.0767416621 * l - 3.3077115913 * d + 0.2309699292 * h, f = -1.2684380046 * l + 2.6097574011 * d - 0.3413193965 * h, g = -0.0041960863 * l - 0.7034186147 * d + 1.707614701 * h;
200
- return [tt(w), tt(f), tt(g)];
201
- }
202
- function Wt(t, e, a) {
203
- const n = Z(t), r = Z(e), s = Z(a), o = 0.4122214708 * n + 0.5363325363 * r + 0.0514459929 * s, c = 0.2119034982 * n + 0.6806995451 * r + 0.1073969566 * s, i = 0.0883024619 * n + 0.2817188376 * r + 0.6299787005 * s, l = Math.cbrt(o), d = Math.cbrt(c), h = Math.cbrt(i), w = 0.2104542553 * l + 0.793617785 * d - 0.0040720468 * h, f = 1.9779984951 * l - 2.428592205 * d + 0.4505937099 * h, g = 0.0259040371 * l + 0.7827717662 * d - 0.808675766 * h, y = Math.sqrt(f * f + g * g);
204
- let F = Math.atan2(g, f) * 180 / Math.PI;
205
- return F < 0 && (F += 360), [w, y, F];
206
- }
207
- function U(t, e, a, n, r, s) {
208
- switch (r) {
209
- case "hex":
210
- if (s) {
211
- const o = (i) => i.toString(16).padStart(2, "0"), c = Math.max(0, Math.min(255, Math.round(n * 255)));
212
- return `#${o(t)}${o(e)}${o(a)}${o(c)}`;
213
- }
214
- return nt(t, e, a);
215
- case "rgb":
216
- return `rgb(${t}, ${e}, ${a})`;
217
- case "rgba":
218
- return `rgba(${t}, ${e}, ${a}, ${Math.round(n * 100) / 100})`;
219
- case "hsl": {
220
- const [o, c, i] = st(t, e, a);
221
- return `hsl(${o}, ${c}%, ${i}%)`;
222
- }
223
- case "hsla": {
224
- const [o, c, i] = st(t, e, a);
225
- return `hsla(${o}, ${c}%, ${i}%, ${Math.round(n * 100) / 100})`;
226
- }
227
- case "hwb": {
228
- const [o, c, i] = Lt(t, e, a);
229
- return n < 1 ? `hwb(${o} ${c}% ${i}% / ${Math.round(n * 100) / 100})` : `hwb(${o} ${c}% ${i}%)`;
230
- }
231
- case "oklch": {
232
- const [o, c, i] = Wt(t, e, a), l = (Math.round(o * 1e3) / 1e3).toFixed(3), d = (Math.round(c * 1e3) / 1e3).toFixed(3), h = (Math.round(i * 10) / 10).toFixed(1), w = Math.round(n * 100) / 100;
233
- return s || n < 1 ? `oklch(${l} ${d} ${h} / ${w})` : `oklch(${l} ${d} ${h})`;
234
- }
235
- }
236
- }
237
- function W(t, e) {
238
- return e ? t === "rgb" ? "rgba" : t === "hsl" ? "hsla" : t : t === "rgba" ? "rgb" : t === "hsla" ? "hsl" : t;
239
- }
240
- async function zt(t) {
241
- return new Promise((e, a) => {
242
- const n = new FileReader();
243
- n.readAsDataURL(t), n.onload = () => {
244
- const r = n.result;
245
- e(r.split(",")[1]);
246
- }, n.onerror = (r) => a(r);
247
- });
248
- }
249
- function Ht(t) {
250
- return Promise.all(t.map(zt));
251
- }
252
- function jt(t) {
253
- if (t.length >= 4) {
254
- if (t[0] === 137 && t[1] === 80 && t[2] === 78 && t[3] === 71)
255
- return "image/png";
256
- if (t[0] === 255 && t[1] === 216) return "image/jpeg";
257
- if (t[0] === 71 && t[1] === 73 && t[2] === 70)
258
- return "image/gif";
259
- if (t[0] === 82 && t[1] === 73 && t[2] === 70 && t[3] === 70 && t.length >= 12 && t[8] === 87 && t[9] === 69 && t[10] === 66 && t[11] === 80)
260
- return "image/webp";
261
- }
262
- try {
263
- if (new TextDecoder("utf-8").decode(t.slice(0, 256)).includes("<svg")) return "image/svg+xml";
264
- } catch {
265
- }
266
- return "application/octet-stream";
267
- }
268
- function Xt(t) {
269
- const e = xt(t ?? ""), a = e.length, n = new Uint8Array(a);
270
- for (let r = 0; r < a; r++) n[r] = e.charCodeAt(r);
271
- return n;
272
- }
273
- function Yt(t) {
274
- const {
275
- value: e,
276
- onChange: a,
277
- onInput: n,
278
- ...r
279
- } = t, s = /* @__PURE__ */ new Map(), o = p.toSignal(e).map((d) => d.map((h, w) => {
280
- const f = s.get(h), g = Xt(h ?? ""), y = f?.type || jt(g), F = f?.name ?? `file-${w}`, T = g.buffer.slice(
281
- g.byteOffset,
282
- g.byteOffset + g.byteLength
283
- ), M = new Blob([T], { type: y });
284
- return new File([M], F, { type: y });
285
- })), c = (d) => (h) => {
286
- d && Ht(h).then((w) => {
287
- for (const [f, g] of w.entries())
288
- s.set(g, { name: h[f].name, type: h[f].type });
289
- d(w);
290
- });
291
- }, i = c(a), l = c(n);
292
- return yt({
293
- ...r,
294
- value: o,
295
- onChange: i,
296
- onInput: l
297
- });
298
- }
299
- function ge(t) {
300
- const {
301
- value: e,
302
- onInput: a,
303
- onChange: n,
304
- ...r
305
- } = t;
306
- return Yt({
307
- ...r,
308
- maxFiles: 1,
309
- value: p.map(e, (s) => s == null ? [] : [s]),
310
- onChange: (s) => {
311
- n?.(s[0]);
312
- },
313
- onInput: (s) => {
314
- a?.(s[0]);
315
- }
316
- });
317
- }
318
- function Gt(t, e) {
319
- const [a, n, r] = t, s = a << 16 ^ n << 8 ^ r, o = Pt(s), c = 6 + Math.floor(o() * 5), i = 0.18 + o() * 0.06, l = [];
320
- for (let f = 0; f < c; f++) {
321
- const g = f / c * Math.PI * 2, y = e * (1 + (o() * 2 - 1) * i), F = Math.cos(g) * y, T = Math.sin(g) * y;
322
- l.push({ x: F, y: T });
323
- }
324
- const d = (l[0].x + l[c - 1].x) / 2, h = (l[0].y + l[c - 1].y) / 2;
325
- let w = `M ${d.toFixed(3)} ${h.toFixed(3)}`;
326
- for (let f = 0; f < c; f++) {
327
- const g = l[f], y = l[(f + 1) % c], F = (g.x + y.x) / 2, T = (g.y + y.y) / 2;
328
- w += ` Q ${g.x.toFixed(3)} ${g.y.toFixed(3)} ${F.toFixed(3)} ${T.toFixed(3)}`;
329
- }
330
- return w += " Z", w;
331
- }
332
- const fe = (t) => {
333
- const {
334
- value: e,
335
- onBlur: a,
336
- onChange: n,
337
- onInput: r,
338
- displayValue: s,
339
- swatchSize: o,
340
- withAlpha: c
341
- } = t, i = {
342
- xs: 20,
343
- sm: 26,
344
- md: 32,
345
- lg: 40,
346
- xl: 52
347
- }, l = o != null ? p.map(o, (m) => Number(m)) : p.map(
348
- t.size ?? "md",
349
- (m) => i[m] ?? 32
350
- ), d = p.map(e, (m) => Vt(m ?? "#000000")), h = p.map(
351
- d,
352
- ([m, x, C]) => [m, x, C]
353
- ), w = p.map(d, ([, , , m]) => m), f = ut(p.get(w) ?? 1), g = p.map(c ?? !1, (m) => m), y = p.map(
354
- t.colorTextFormat ?? "rgb",
355
- (m) => m
356
- ), F = D(
357
- h,
358
- f,
359
- y,
360
- g
361
- )(
362
- ([m, x, C], v, N, B) => U(m, x, C, v ?? 1, W(N, B), B)
363
- ), T = p.map(
364
- t.colorTextFormat ?? "hex",
365
- (m) => m
366
- ), M = p.map(l, (m) => `${-m / 2} ${-m / 2} ${m} ${m}`), b = D(
367
- h,
368
- l
369
- )((m, x) => Gt(m, x / 2)), $ = D(
370
- h,
371
- f,
372
- g
373
- )(
374
- ([m, x, C], v, N) => N || v < 1 ? Et(m, x, C, v) : nt(m, x, C)
375
- ), S = _.div(
376
- u.class("bc-color-swatch-input__control"),
377
- u.class(
378
- p.map(
379
- g,
380
- (m) => m ? "bc-color-swatch-input__control--alpha" : ""
381
- )
382
- ),
383
- u.style(D(l)((m) => `width:${m + 2}px;height:${m + 2}px`)),
384
- // The SVG blob preview
385
- ot.svg(
386
- u.class("bc-color-swatch-input__svg"),
387
- J.viewBox(M),
388
- ot.path(J.d(b), J.fill($))
389
- ),
390
- // Invisible native input overlays the blob for picker and accessibility
391
- _.input(
392
- u.type("color"),
393
- O(t),
394
- // Native color input needs hex without alpha
395
- u.value(p.map(h, ([m, x, C]) => nt(m, x, C))),
396
- u.class(
397
- "bc-input bc-color-swatch-input bc-color-swatch-input__native"
398
- ),
399
- a != null ? I.blur(a) : A,
400
- n != null ? I.change((m) => {
401
- const x = m.target.value;
402
- if (!n) return;
403
- const { r: C, g: v, b: N } = H(x) ?? { r: 0, g: 0, b: 0 }, B = p.get(f) ?? 1, V = W(
404
- p.get(T),
405
- p.get(g)
406
- ), Q = U(C, v, N, B, V, p.get(g));
407
- n(Q);
408
- }) : A,
409
- r != null ? I.input((m) => {
410
- const x = m.target.value;
411
- if (!r) return;
412
- const { r: C, g: v, b: N } = H(x) ?? { r: 0, g: 0, b: 0 }, B = p.get(f) ?? 1, V = W(
413
- p.get(T),
414
- p.get(g)
415
- ), Q = U(C, v, N, B, V, p.get(g));
416
- r(Q);
417
- }) : A
418
- )
419
- ), k = z(
420
- g,
421
- () => _.input(
422
- u.type("range"),
423
- u.class("bc-color-swatch-input__alpha"),
424
- u.min(0),
425
- u.max(1),
426
- u.step(0.01),
427
- u.value(p.map(f, (m) => String(m ?? 1))),
428
- u.disabled(t.disabled),
429
- I.input((m) => {
430
- const x = parseFloat(m.target.value);
431
- f.set(x);
432
- const [C, v, N] = p.get(h), B = W(
433
- p.get(T),
434
- p.get(g)
435
- ), V = U(C, v, N, x, B, p.get(g));
436
- r?.(V);
437
- }),
438
- I.change((m) => {
439
- const x = parseFloat(m.target.value);
440
- f.set(x);
441
- const [C, v, N] = p.get(h), B = W(
442
- p.get(T),
443
- p.get(g)
444
- ), V = U(C, v, N, x, B, p.get(g));
445
- n?.(V);
446
- })
447
- )
448
- ), {
449
- swatchSize: Y,
450
- displayValue: G,
451
- withAlpha: q,
452
- colorTextFormat: rt,
453
- ...K
454
- } = t;
455
- return P({
456
- baseContainer: !0,
457
- ...K,
458
- // ensure our control does not try to grow
459
- growInput: !1,
460
- input: S,
461
- // If caller provided an `after`, append RGB before it
462
- after: j(
463
- z(
464
- s ?? !1,
465
- () => _.span(u.class("bc-color-swatch-input__rgb"), F)
466
- ),
467
- k,
468
- t.after
469
- )
470
- });
471
- }, Kt = (t) => typeof t == "string" && t.trim() === "" ? null : t, qt = (t) => t ?? "";
472
- function L(t) {
473
- return (e) => {
474
- const { after: a, disabled: n } = e, r = dt(e, qt, Kt), s = X(
475
- e.value,
476
- n,
477
- e.onChange ?? e.onInput
478
- );
479
- return t({
480
- ...r,
481
- after: a != null ? j(s, a) : s
482
- });
483
- };
484
- }
485
- const me = ({
486
- startEditing: t,
487
- value: e,
488
- onChange: a,
489
- placeholder: n,
490
- disabled: r
491
- }) => {
492
- const s = p.deriveProp(t ?? !1), o = ut(!1), c = p.map(r ?? !1, (i) => i);
493
- return _.div(
494
- u.class("bc-editable-text"),
495
- u.class(
496
- p.map(
497
- c,
498
- (i) => i ? "bc-editable-text--disabled" : ""
499
- )
500
- ),
501
- R.disabled(c),
502
- z(
503
- s,
504
- () => _.input(
505
- u.placeholder(n),
506
- u.value(e),
507
- u.class("bc-editable-text__input"),
508
- Ct(),
509
- I.keydown((i) => {
510
- i.key === "Enter" ? s.set(!1) : i.key === "Escape" && (o.set(!0), s.set(!1));
511
- }),
512
- I.blur(
513
- at((i) => {
514
- if (s.set(!1), o.value) {
515
- o.set(!1);
516
- return;
517
- }
518
- a(i);
519
- })
520
- )
521
- ),
522
- () => _.span(
523
- I.click(() => {
524
- p.get(c) || s.set(!0);
525
- }),
526
- u.class("bc-editable-text__display"),
527
- z(
528
- p.map(e, (i) => i != null && i.trim() !== ""),
529
- () => _.span(u.class("bc-editable-text__text"), e),
530
- () => _.span(
531
- u.class("bc-editable-text__placeholder"),
532
- n
533
- )
534
- ),
535
- z(
536
- p.map(c, (i) => !i),
537
- () => _.button(
538
- u.type("button"),
539
- u.class("bc-editable-text__edit-button"),
540
- ft(kt, (i) => R.label(i.$.editLabel)),
541
- I.click(() => s.set(!0)),
542
- et({ icon: "line-md/pencil", color: "neutral" })
543
- )
544
- )
545
- )
546
- )
547
- );
548
- }, be = (t) => {
549
- const { value: e, onBlur: a, onChange: n, onInput: r, after: s, disabled: o } = t, c = X(e, o, n ?? r);
550
- return P({
551
- ...t,
552
- input: pt.date(
553
- O(t),
554
- u.valueAsDate(e),
555
- u.class("bc-input"),
556
- a != null ? I.blur(at(a)) : A,
557
- n != null ? I.change(ct(n)) : A,
558
- r != null ? I.input(ct(r)) : A
559
- ),
560
- after: s != null ? j(c, s) : c
561
- });
562
- }, Qt = (t) => {
563
- const e = t.getFullYear(), a = t.getMonth() + 1, n = t.getDate(), r = t.getHours(), s = t.getMinutes(), o = t.getSeconds();
564
- return `${e}-${a.toString().padStart(2, "0")}-${n.toString().padStart(2, "0")}T${r.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}`;
565
- }, we = (t) => {
566
- const { value: e, onBlur: a, onChange: n, onInput: r, after: s, disabled: o } = t, c = p.map(e, (l) => l != null ? Qt(l) : null), i = X(e, o, n ?? r);
567
- return P({
568
- ...t,
569
- input: pt["datetime-local"](
570
- O(t),
571
- u.value(p.map(c, (l) => l ?? null)),
572
- u.class("bc-input"),
573
- a != null ? I.blur(at(a)) : A,
574
- n != null ? I.change(it(n)) : A,
575
- r != null ? I.input(it(r)) : A
576
- ),
577
- after: s != null ? j(i, s) : i
578
- });
579
- }, ye = L(Tt), Me = L(_t), Ie = L(St), $e = L(
580
- Mt
581
- ), xe = ({
582
- value: t,
583
- onChange: e,
584
- onInput: a,
585
- onBlur: n,
586
- offLabel: r,
587
- onLabel: s,
588
- disabled: o = !1,
589
- size: c = "md",
590
- id: i,
591
- color: l = "primary",
592
- tabIndex: d = 0,
593
- matchInputHeight: h = !0,
594
- ariaLabel: w
595
- }) => {
596
- const f = i ?? At("switch");
597
- function g(M, b) {
598
- const $ = [
599
- "bc-switch",
600
- `bc-switch--size-${b}`,
601
- `bc-switch--${b}`
602
- ];
603
- return h && $.push("bc-switch--match-input"), M && $.push("bc-switch--disabled"), $.join(" ");
604
- }
605
- function y(M) {
606
- const b = M ?? "primary", $ = /* @__PURE__ */ new Map(), S = lt(b, "solid", "light"), k = lt(b, "solid", "dark");
607
- return $.set("--switch-track-on-bg", S.backgroundColor), $.set("--switch-track-on-label", S.textColor), $.set("--switch-track-on-bg-dark", k.backgroundColor), $.set("--switch-track-on-label-dark", k.textColor), $.set(
608
- "--switch-track-on-border-dark",
609
- Ft(b, "dark")
610
- ), Array.from($.entries()).map(([Y, G]) => `${Y}: ${G}`).join("; ");
611
- }
612
- const F = () => {
613
- p.get(o) || (e?.(!p.get(t)), a?.(!p.get(t)));
614
- }, T = (M) => {
615
- p.get(o) || (M.key === " " || M.key === "Enter") && (M.preventDefault(), F());
616
- };
617
- return _.div(
618
- u.class(
619
- D(
620
- o ?? !1,
621
- c
622
- )(
623
- (M, b) => g(M ?? !1, b ?? "md")
624
- )
625
- ),
626
- u.style(
627
- D(l)(
628
- (M) => y(M)
629
- )
630
- ),
631
- u.id(f),
632
- u.role("switch"),
633
- u.tabindex(
634
- D(
635
- o ?? !1,
636
- d
637
- )((M, b) => M ? -1 : b ?? 0)
638
- ),
639
- R.checked(t),
640
- R.disabled(o),
641
- w != null ? R.label(w) : null,
642
- I.click(F),
643
- I.keydown(T),
644
- n != null ? I.blur(n) : null,
645
- _.div(
646
- u.class("bc-switch__track"),
647
- u.class(
648
- p.map(
649
- t,
650
- (M) => M ? "bc-switch__track--on" : "bc-switch__track--off"
651
- )
652
- ),
653
- r != null ? _.div(
654
- R.hidden(!0),
655
- u.class("bc-switch__track-label bc-switch__track-label--off"),
656
- u.class(
657
- p.map(
658
- t,
659
- (M) => M ? "bc-switch__track-label--hidden" : "bc-switch__track-label--visible"
660
- )
661
- ),
662
- r
663
- ) : null,
664
- s != null ? _.div(
665
- u.class("bc-switch__track-label bc-switch__track-label--on"),
666
- u.class(
667
- p.map(
668
- t,
669
- (M) => M ? "bc-switch__track-label--visible" : "bc-switch__track-label--hidden"
670
- )
671
- ),
672
- s
673
- ) : null,
674
- _.div(
675
- u.class("bc-switch__thumb"),
676
- u.class(
677
- p.map(
678
- t,
679
- (M) => M ? "bc-switch__thumb--on" : "bc-switch__thumb--off"
680
- )
681
- )
682
- )
683
- )
684
- );
685
- }, _e = L(It), Jt = "line-md:star-alt-filled", Zt = "line-md:star-alt", te = (t) => {
686
- const {
687
- value: e,
688
- onChange: a,
689
- onInput: n,
690
- disabled: r,
691
- max: s = 5,
692
- fullColor: o = "yellow",
693
- emptyColor: c = "neutral",
694
- activeIcon: i = Jt,
695
- inactiveIcon: l = Zt,
696
- size: d = "md",
697
- onBlur: h,
698
- rounding: w = 1
699
- } = t, f = () => {
700
- const b = p.get(w);
701
- return b > 0 ? b : 1;
702
- }, g = (b) => Math.min(Math.max(b, 0), p.get(s)), y = (b, $) => {
703
- if (p.get(r ?? !1)) return;
704
- const k = b.currentTarget.getBoundingClientRect(), Y = (b.clientX - k.left) / k.width, G = $ - 1 + Y, q = f(), rt = Math.ceil(G / q) * q, K = g(rt);
705
- a?.(K), n?.(K);
706
- }, F = (b) => {
707
- if (p.get(r ?? !1)) return;
708
- const $ = f(), S = p.get(e) ?? 0;
709
- let k;
710
- switch (b.key) {
711
- case "ArrowRight":
712
- case "ArrowUp":
713
- k = g(S + $);
714
- break;
715
- case "ArrowLeft":
716
- case "ArrowDown":
717
- k = g(S - $);
718
- break;
719
- case "Home":
720
- k = 0;
721
- break;
722
- case "End":
723
- k = p.get(s);
724
- break;
725
- default:
726
- return;
727
- }
728
- b.preventDefault(), a?.(k), n?.(k);
729
- }, T = p.map(d, (b) => `bc-icon--${b}`), M = ({ index: b, counter: $ }) => _.span(
730
- u.class("bc-rating-input__icon-container"),
731
- u.class(T),
732
- I.click(
733
- bt((S) => y(S, $), {
734
- preventDefault: !0,
735
- stopPropagation: !0
736
- })
737
- ),
738
- et(
739
- {
740
- icon: l,
741
- size: d,
742
- color: c,
743
- tone: "soft"
744
- },
745
- u.class("bc-rating-input__icon-empty")
746
- ),
747
- _.span(
748
- u.class("bc-rating-input__icon-clipper"),
749
- u.class(T),
750
- wt.width(
751
- p.map(e, (S) => {
752
- const k = Math.floor(S);
753
- return k > b ? "100%" : k < b ? "0%" : `${(S - b) * 100}%`;
754
- })
755
- ),
756
- et(
757
- {
758
- icon: i,
759
- size: d,
760
- color: o,
761
- tone: "soft"
762
- },
763
- u.class("bc-rating-input__icon-full")
764
- )
765
- )
766
- );
767
- return P({
768
- baseContainer: !0,
769
- growInput: !1,
770
- focusableSelector: '[role="slider"]',
771
- ...t,
772
- input: _.div(
773
- // Common input attributes (id, required, invalid, custom classes, etc.)
774
- O(t),
775
- u.class("bc-rating-input"),
776
- // ARIA slider semantics
777
- u.role("slider"),
778
- u.tabindex(p.map(r ?? !1, (b) => b ? -1 : 0)),
779
- R.disabled(r ?? !1),
780
- R.valuemin(0),
781
- R.valuemax(p.map(s, (b) => b ?? 0)),
782
- R.valuenow(p.map(e, (b) => b ?? 0)),
783
- R.valuetext(
784
- D(
785
- e,
786
- s
787
- )((b, $) => {
788
- const S = b ?? 0, k = $ ?? 0;
789
- return `${String(S)} / ${String(k)}`;
790
- })
791
- ),
792
- // Keyboard & focus handlers
793
- I.keydown(F),
794
- h != null ? I.blur(h) : null,
795
- mt(s, M)
796
- )
797
- });
798
- }, ke = (t) => {
799
- const { after: e, disabled: a } = t, n = dt(
800
- t,
801
- (s) => s ?? 0,
802
- (s) => s
803
- ), r = X(
804
- t.value,
805
- a,
806
- t.onChange ?? t.onInput
807
- );
808
- return te({
809
- ...n,
810
- after: e != null ? j(r, e) : r
811
- });
812
- }, Fe = (t) => {
813
- const { value: e, step: a, min: n, max: r, onBlur: s, onChange: o, onInput: c } = t;
814
- return P({
815
- ...t,
816
- // Make sure clicks anywhere focus the range input
817
- focusableSelector: 'input[type="range"]',
818
- input: _.input(
819
- u.type("range"),
820
- O(t),
821
- u.min(n),
822
- u.max(r),
823
- u.step(a),
824
- // Using value as number to keep it in sync
825
- u.valueAsNumber(e),
826
- u.class("bc-input bc-slider-input"),
827
- s != null ? I.blur(E(s)) : A,
828
- o != null ? I.change(E(o)) : A,
829
- c != null ? I.input(E(c)) : A
830
- )
831
- });
832
- }, Ce = (t) => {
833
- const { value: e, step: a, min: n, max: r, onBlur: s, onChange: o, onInput: c } = t, i = p.map(e, (d) => {
834
- if (d != null) return d;
835
- const h = n != null ? p.get(n) : void 0;
836
- return typeof h == "number" ? h : 0;
837
- }), l = X(
838
- e,
839
- t.disabled,
840
- o ?? c
841
- );
842
- return P({
843
- ...t,
844
- focusableSelector: 'input[type="range"]',
845
- after: l,
846
- input: _.input(
847
- u.type("range"),
848
- O(t),
849
- u.min(n),
850
- u.max(r),
851
- u.step(a),
852
- u.valueAsNumber(i),
853
- u.class("bc-input bc-slider-input"),
854
- s != null ? I.blur(E(s)) : A,
855
- o != null ? I.change(
856
- E((d) => {
857
- o(d);
858
- })
859
- ) : A,
860
- c != null ? I.input(
861
- E((d) => {
862
- c(d);
863
- })
864
- ) : A
865
- )
866
- });
867
- }, Te = L($t);
868
- class ee {
869
- widgets = /* @__PURE__ */ new Map();
870
- typeMapping = /* @__PURE__ */ new Map();
871
- // JSON Schema type -> widget names
872
- /**
873
- * Register a custom widget
874
- */
875
- register(e, a) {
876
- if (this.widgets.set(e, a), a.supportedTypes)
877
- for (const n of a.supportedTypes)
878
- this.typeMapping.has(n) || this.typeMapping.set(n, []), this.typeMapping.get(n).push(e), this.typeMapping.get(n).sort((r, s) => {
879
- const o = this.widgets.get(r)?.priority || 0;
880
- return (this.widgets.get(s)?.priority || 0) - o;
881
- });
882
- }
883
- /**
884
- * Unregister a widget
885
- */
886
- unregister(e) {
887
- const a = this.widgets.get(e);
888
- if (a && (this.widgets.delete(e), a.supportedTypes))
889
- for (const n of a.supportedTypes) {
890
- const r = this.typeMapping.get(n);
891
- if (r) {
892
- const s = r.indexOf(e);
893
- s >= 0 && r.splice(s, 1), r.length === 0 && this.typeMapping.delete(n);
894
- }
895
- }
896
- }
897
- /**
898
- * Get a registered widget
899
- */
900
- get(e) {
901
- return this.widgets.get(e);
902
- }
903
- /**
904
- * Get all registered widgets
905
- */
906
- getAll() {
907
- return new Map(this.widgets);
908
- }
909
- /**
910
- * Get widgets that support a specific JSON Schema type
911
- */
912
- getForType(e) {
913
- return (this.typeMapping.get(e) || []).map((n) => this.widgets.get(n)).filter(Boolean);
914
- }
915
- /**
916
- * Find the best widget for a schema context
917
- */
918
- findBestWidget(e) {
919
- const a = vt(e.definition, e.name);
920
- if (a?.widget) {
921
- const r = this.widgets.get(a.widget);
922
- if (r)
923
- return { name: a.widget, registration: r, resolved: a };
924
- }
925
- const n = [];
926
- for (const [r, s] of this.widgets.entries())
927
- if (s.matcher)
928
- try {
929
- s.matcher(e) && n.push({
930
- name: r,
931
- registration: s,
932
- priority: s.priority ?? 0
933
- });
934
- } catch (o) {
935
- console.warn(`Error in matcher for widget "${r}":`, o);
936
- }
937
- if (n.length > 0) {
938
- n.sort((s, o) => o.priority - s.priority);
939
- const r = n[0];
940
- return {
941
- name: r.name,
942
- registration: r.registration,
943
- resolved: { widget: r.name, source: "heuristics" }
944
- };
945
- }
946
- if (typeof e.definition == "object" && e.definition.type) {
947
- const r = Array.isArray(e.definition.type) ? e.definition.type[0] : e.definition.type, s = this.getForType(r);
948
- if (s.length > 0) {
949
- const o = this.typeMapping.get(r)[0];
950
- return {
951
- name: o,
952
- registration: s[0],
953
- resolved: { widget: o, source: "type-fallback" }
954
- };
955
- }
956
- }
957
- return null;
958
- }
959
- }
960
- const Se = new ee();
961
- function Ae(t, e, a) {
962
- return {
963
- factory: e,
964
- matcher: (n) => {
965
- const s = n.definition["x:ui"];
966
- return s === t || typeof s == "object" && s !== null && s.widget === t;
967
- },
968
- displayName: a?.displayName ?? t,
969
- priority: a?.priority ?? 100,
970
- // High priority for explicit matches
971
- ...a
972
- };
973
- }
974
- function ve(t, e, a) {
975
- return {
976
- factory: e,
977
- matcher: (n) => n.definition.format === t,
978
- displayName: a?.displayName ?? `${t} widget`,
979
- priority: a?.priority ?? 75,
980
- ...a
981
- };
982
- }
983
- function Ne(t, e, a, n) {
984
- return {
985
- factory: a,
986
- matcher: (r) => {
987
- const s = r.definition;
988
- return s.type === t && s.format === e;
989
- },
990
- displayName: n?.displayName ?? `${t}:${e} widget`,
991
- priority: n?.priority ?? 80,
992
- ...n
993
- };
994
- }
995
- function Re(t) {
996
- const e = t?.logPrefix ?? "WIDGET_DIAG", a = t?.filterFn ?? (() => !0);
997
- return {
998
- factory: () => null,
999
- displayName: "Diagnostic Widget (never matches)",
1000
- priority: -1e3,
1001
- // Very low priority, should never actually match
1002
- matcher: (n) => {
1003
- if (!a(n)) return !1;
1004
- const r = n.definition, s = {
1005
- name: n.name,
1006
- path: n.path.map(String),
1007
- type: r?.type,
1008
- hasRegistry: n.widgetRegistry !== void 0,
1009
- definition: r
1010
- };
1011
- return console.log(
1012
- `[${e}] name="${s.name ?? "ROOT"}" path=[${s.path.join(", ")}] type="${s.type ?? "unknown"}" hasRegistry=${s.hasRegistry}`
1013
- ), t?.onProcess?.(s), !1;
1014
- }
1015
- };
1016
- }
1017
- export {
1018
- Ot as A,
1019
- ge as B,
1020
- fe as C,
1021
- Bt as D,
1022
- me as E,
1023
- Nt as F,
1024
- Rt as G,
1025
- tt as H,
1026
- Pt as I,
1027
- Ut as J,
1028
- Vt as K,
1029
- W as L,
1030
- nt as M,
1031
- Me as N,
1032
- st as O,
1033
- Lt as P,
1034
- Wt as Q,
1035
- te as R,
1036
- Fe as S,
1037
- Z as T,
1038
- Et as U,
1039
- ee as W,
1040
- $e as a,
1041
- _e as b,
1042
- Te as c,
1043
- Ie as d,
1044
- we as e,
1045
- be as f,
1046
- Se as g,
1047
- ye as h,
1048
- Ce as i,
1049
- ke as j,
1050
- xe as k,
1051
- Re as l,
1052
- ve as m,
1053
- Ne as n,
1054
- Ae as o,
1055
- Kt as p,
1056
- qt as q,
1057
- de as r,
1058
- ht as s,
1059
- Dt as t,
1060
- Yt as u,
1061
- zt as v,
1062
- U as w,
1063
- he as x,
1064
- H as y,
1065
- gt as z
1066
- };