@tempots/beatui 0.82.0 → 0.82.1

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 (173) hide show
  1. package/dist/_commonjsHelpers-DKOUU3wS.cjs +1 -0
  2. package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
  3. package/dist/auth/index.cjs.js +1 -1
  4. package/dist/auth/index.es.js +63 -1351
  5. package/dist/auth-divider-BqZPH1-z.cjs +1 -0
  6. package/dist/auth-divider-Wr-S16kF.js +1355 -0
  7. package/dist/beatui.css +1347 -0
  8. package/dist/beatui.tailwind.css +1347 -0
  9. package/dist/better-auth/index.cjs.js +1 -0
  10. package/dist/better-auth/index.es.js +754 -0
  11. package/dist/{deep-merge-CiOwVWn8.js → deep-merge-BYm0y62g.js} +34 -33
  12. package/dist/deep-merge-d7sf0xmN.cjs +1 -0
  13. package/dist/duration-input-B9UNmUCh.cjs +1 -0
  14. package/dist/{duration-input-B3vnnwBZ.js → duration-input-DqcJbxKD.js} +23 -22
  15. package/dist/editor-toolbar-group--a-xgsJw.cjs +1 -0
  16. package/dist/editor-toolbar-group-CVpl5mxF.js +31 -0
  17. package/dist/{hls.light.min-Bhrf47iR.cjs → hls.light.min-C6xKDzRR.cjs} +1 -1
  18. package/dist/{hls.light.min-C6VwviEa.js → hls.light.min-hEMf_E8u.js} +1 -1
  19. package/dist/{index-C5YCCgnn.cjs → index-05UbKOYe.cjs} +1 -1
  20. package/dist/{index-ChsRjiIp.cjs → index-Bt7FYl80.cjs} +19 -19
  21. package/dist/{index-DT6-HMMz.js → index-C2Lq1m45.js} +1432 -1462
  22. package/dist/{index-CiAVfKIZ.js → index-lYhXnu6I.js} +1 -1
  23. package/dist/index.cjs.js +4 -4
  24. package/dist/index.es.js +2326 -2680
  25. package/dist/input-container-C6qEIjcA.cjs +1 -0
  26. package/dist/input-container-DiCjOzR2.js +247 -0
  27. package/dist/json-schema/index.cjs.js +1 -1
  28. package/dist/json-schema/index.es.js +33 -32
  29. package/dist/json-schema-display/index.cjs.js +1 -1
  30. package/dist/json-schema-display/index.es.js +1 -1
  31. package/dist/json-structure/index.cjs.js +1 -1
  32. package/dist/json-structure/index.es.js +542 -700
  33. package/dist/lexical/index.cjs.js +46 -0
  34. package/dist/lexical/index.es.js +21370 -0
  35. package/dist/lexical.css +1124 -0
  36. package/dist/menu-CZzRsQP_.js +372 -0
  37. package/dist/menu-ClrU72xH.cjs +1 -0
  38. package/dist/modal-I5srcntN.cjs +1 -0
  39. package/dist/modal-v3u2Fpnd.js +488 -0
  40. package/dist/{notice-CZHWWwOQ.js → notice-BuZvdvZh.js} +48 -47
  41. package/dist/notice-CLDdy1MW.cjs +1 -0
  42. package/dist/{oneof-branch-detection-C8g3eWnx.cjs → oneof-branch-detection-DsM1K5xc.cjs} +1 -1
  43. package/dist/{oneof-branch-detection-BVNoKU9d.js → oneof-branch-detection-Dt8ss9lc.js} +1 -1
  44. package/dist/prosemirror/index.cjs.js +1 -1
  45. package/dist/prosemirror/index.es.js +1 -1
  46. package/dist/session-id-3KiilioY.js +8 -0
  47. package/dist/session-id-B5lJMzbB.cjs +1 -0
  48. package/dist/styles-url-B2dzXrYt.cjs +1 -0
  49. package/dist/styles-url-Cw_mxshe.js +4 -0
  50. package/dist/text-input-B3VBat1k.js +44 -0
  51. package/dist/text-input-Ds8e7Z1G.cjs +1 -0
  52. package/dist/{toolbar-DR2Zd4Oo.js → toolbar-D994_E_s.js} +4 -4
  53. package/dist/toolbar-x0_8lmKu.cjs +1 -0
  54. package/dist/types/better-auth/bridge.d.ts +2 -0
  55. package/dist/types/better-auth/callbacks.d.ts +6 -0
  56. package/dist/types/better-auth/components/authenticated.d.ts +4 -0
  57. package/dist/types/better-auth/components/better-auth-container.d.ts +4 -0
  58. package/dist/types/better-auth/components/better-auth-modal.d.ts +4 -0
  59. package/dist/types/better-auth/components/magic-link-form.d.ts +7 -0
  60. package/dist/types/better-auth/components/passkey-management.d.ts +6 -0
  61. package/dist/types/better-auth/components/passkey-signin.d.ts +12 -0
  62. package/dist/types/better-auth/components/two-factor-setup.d.ts +8 -0
  63. package/dist/types/better-auth/components/two-factor-verify.d.ts +10 -0
  64. package/dist/types/better-auth/i18n/default.d.ts +29 -0
  65. package/dist/types/better-auth/i18n/locales/en.d.ts +28 -0
  66. package/dist/types/better-auth/i18n/translations.d.ts +27 -0
  67. package/dist/types/better-auth/index.d.ts +22 -0
  68. package/dist/types/better-auth/provider.d.ts +6 -0
  69. package/dist/types/better-auth/session.d.ts +14 -0
  70. package/dist/types/better-auth/social-mapping.d.ts +2 -0
  71. package/dist/types/better-auth/types.d.ts +164 -0
  72. package/dist/types/components/auth/auth-container.d.ts +1 -1
  73. package/dist/types/components/auth/social-providers.d.ts +1 -1
  74. package/dist/types/components/auth/types.d.ts +2 -0
  75. package/dist/types/components/editor-toolbar/editor-toolbar-button.d.ts +16 -0
  76. package/dist/types/components/editor-toolbar/editor-toolbar-group.d.ts +9 -0
  77. package/dist/types/components/editor-toolbar/index.d.ts +2 -0
  78. package/dist/types/components/json-structure/controls/control-utils.d.ts +19 -0
  79. package/dist/types/components/json-structure/controls/index.d.ts +1 -0
  80. package/dist/types/components/lexical/bare-editor.d.ts +29 -0
  81. package/dist/types/components/lexical/code/index.d.ts +1 -0
  82. package/dist/types/components/lexical/code/language-selector.d.ts +13 -0
  83. package/dist/types/components/lexical/contextual-editor.d.ts +22 -0
  84. package/dist/types/components/lexical/docked-editor.d.ts +23 -0
  85. package/dist/types/components/lexical/floating/block-handle.d.ts +16 -0
  86. package/dist/types/components/lexical/floating/floating-toolbar.d.ts +12 -0
  87. package/dist/types/components/lexical/floating/index.d.ts +6 -0
  88. package/dist/types/components/lexical/floating/slash-command-palette.d.ts +20 -0
  89. package/dist/types/components/lexical/index.d.ts +8 -0
  90. package/dist/types/components/lexical/lexical-editor-input.d.ts +30 -0
  91. package/dist/types/components/lexical/table/index.d.ts +1 -0
  92. package/dist/types/components/lexical/table/table-controls.d.ts +12 -0
  93. package/dist/types/components/lexical/toolbar/index.d.ts +6 -0
  94. package/dist/types/components/lexical/toolbar/lexical-toolbar.d.ts +12 -0
  95. package/dist/types/components/lexical/toolbar/toolbar-button.d.ts +1 -0
  96. package/dist/types/components/lexical/toolbar/toolbar-group.d.ts +1 -0
  97. package/dist/types/components/lexical/toolbar/toolbar-helpers.d.ts +30 -0
  98. package/dist/types/components/prosemirror/etoolbar-button.d.ts +1 -11
  99. package/dist/types/components/prosemirror/etoolbar-group.d.ts +1 -4
  100. package/dist/types/lexical/commands/index.d.ts +17 -0
  101. package/dist/types/lexical/headless.d.ts +39 -0
  102. package/dist/types/lexical/horizontal-rule-node.d.ts +20 -0
  103. package/dist/types/lexical/index.d.ts +20 -0
  104. package/dist/types/lexical/lazy-loader.d.ts +35 -0
  105. package/dist/types/lexical/nodes.d.ts +29 -0
  106. package/dist/types/lexical/plugins/auto-link.d.ts +7 -0
  107. package/dist/types/lexical/plugins/clipboard.d.ts +11 -0
  108. package/dist/types/lexical/plugins/code-shiki.d.ts +11 -0
  109. package/dist/types/lexical/plugins/code.d.ts +7 -0
  110. package/dist/types/lexical/plugins/dragon.d.ts +6 -0
  111. package/dist/types/lexical/plugins/file-io.d.ts +10 -0
  112. package/dist/types/lexical/plugins/hashtag.d.ts +7 -0
  113. package/dist/types/lexical/plugins/history.d.ts +7 -0
  114. package/dist/types/lexical/plugins/horizontal-rule.d.ts +12 -0
  115. package/dist/types/lexical/plugins/html-io.d.ts +9 -0
  116. package/dist/types/lexical/plugins/index.d.ts +24 -0
  117. package/dist/types/lexical/plugins/link.d.ts +6 -0
  118. package/dist/types/lexical/plugins/list.d.ts +6 -0
  119. package/dist/types/lexical/plugins/mark.d.ts +15 -0
  120. package/dist/types/lexical/plugins/markdown-io.d.ts +13 -0
  121. package/dist/types/lexical/plugins/offset.d.ts +6 -0
  122. package/dist/types/lexical/plugins/overflow.d.ts +7 -0
  123. package/dist/types/lexical/plugins/plain-text.d.ts +6 -0
  124. package/dist/types/lexical/plugins/rich-text.d.ts +6 -0
  125. package/dist/types/lexical/plugins/selection.d.ts +6 -0
  126. package/dist/types/lexical/plugins/slash-commands.d.ts +26 -0
  127. package/dist/types/lexical/plugins/table.d.ts +11 -0
  128. package/dist/types/lexical/plugins/text.d.ts +13 -0
  129. package/dist/types/lexical/plugins/yjs.d.ts +9 -0
  130. package/dist/types/lexical/styles-url.d.ts +2 -0
  131. package/dist/types/lexical/styles.d.ts +2 -0
  132. package/dist/types/lexical/types.d.ts +634 -0
  133. package/dist/types/lexical-i18n/default.d.ts +92 -0
  134. package/dist/types/lexical-i18n/index.d.ts +21 -0
  135. package/dist/types/lexical-i18n/locales/ar.d.ts +91 -0
  136. package/dist/types/lexical-i18n/locales/de.d.ts +91 -0
  137. package/dist/types/lexical-i18n/locales/en.d.ts +91 -0
  138. package/dist/types/lexical-i18n/locales/es.d.ts +91 -0
  139. package/dist/types/lexical-i18n/locales/fa.d.ts +91 -0
  140. package/dist/types/lexical-i18n/locales/fr.d.ts +91 -0
  141. package/dist/types/lexical-i18n/locales/he.d.ts +91 -0
  142. package/dist/types/lexical-i18n/locales/hi.d.ts +91 -0
  143. package/dist/types/lexical-i18n/locales/it.d.ts +91 -0
  144. package/dist/types/lexical-i18n/locales/ja.d.ts +91 -0
  145. package/dist/types/lexical-i18n/locales/ko.d.ts +91 -0
  146. package/dist/types/lexical-i18n/locales/nl.d.ts +91 -0
  147. package/dist/types/lexical-i18n/locales/pl.d.ts +91 -0
  148. package/dist/types/lexical-i18n/locales/pt.d.ts +91 -0
  149. package/dist/types/lexical-i18n/locales/ru.d.ts +91 -0
  150. package/dist/types/lexical-i18n/locales/tr.d.ts +91 -0
  151. package/dist/types/lexical-i18n/locales/ur.d.ts +91 -0
  152. package/dist/types/lexical-i18n/locales/vi.d.ts +91 -0
  153. package/dist/types/lexical-i18n/locales/zh.d.ts +91 -0
  154. package/dist/types/lexical-i18n/translations.d.ts +21 -0
  155. package/dist/use-animated-toggle-ChycsEoj.js +175 -0
  156. package/dist/use-animated-toggle-DR6CyMac.cjs +1 -0
  157. package/dist/{use-form-CgZyrACX.js → use-form-B56E_x5Y.js} +83 -88
  158. package/dist/use-form-Cnp3XQ5X.cjs +2 -0
  159. package/dist/widget-customization-Dk7XcVly.cjs +1 -0
  160. package/dist/{widget-customization-DRA7E9Zf.js → widget-customization-Ds9sicAg.js} +106 -105
  161. package/package.json +48 -3
  162. package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
  163. package/dist/_commonjsHelpers-DwGv2jUC.cjs +0 -1
  164. package/dist/deep-merge-DxZqCkE5.cjs +0 -1
  165. package/dist/duration-input-Dg5SX3lM.cjs +0 -1
  166. package/dist/modal-D2xE47kr.cjs +0 -1
  167. package/dist/modal-hkQD1bqZ.js +0 -655
  168. package/dist/notice-C0SmlheE.cjs +0 -1
  169. package/dist/text-input-CByq5OIo.cjs +0 -1
  170. package/dist/text-input-CFJntP7G.js +0 -287
  171. package/dist/toolbar-TPWYzoiF.cjs +0 -1
  172. package/dist/use-form-JjeKCINk.cjs +0 -2
  173. package/dist/widget-customization-G-QLB1rw.cjs +0 -1
@@ -1,655 +0,0 @@
1
- import { WithElement as S, OnDispose as z, prop as R, computedOf as A, Fragment as M, attr as g, WithBrowserCtx as J, Value as U, render as Q, html as k, dataAttr as V, aria as B, on as X, When as j, Use as H, coalesce as q } from "@tempots/dom";
2
- import { g as $, I as _ } from "./timer-Rd2sKnvH.js";
3
- import { s as Y, C as Z } from "./use-form-CgZyrACX.js";
4
- import { B as K } from "./translations-Cq8bUKJP.js";
5
- import { B as P } from "./text-input-CFJntP7G.js";
6
- const ee = [
7
- "a[href]",
8
- "button:not([disabled])",
9
- "input:not([disabled])",
10
- "select:not([disabled])",
11
- "textarea:not([disabled])",
12
- '[tabindex]:not([tabindex="-1"])',
13
- '[contenteditable="true"]',
14
- "audio[controls]",
15
- "video[controls]",
16
- "details > summary:first-of-type",
17
- "details[open]"
18
- ].join(", ");
19
- function te(o) {
20
- return Array.from(o.querySelectorAll(ee)).filter(
21
- (t) => {
22
- const s = t;
23
- return s.offsetWidth > 0 && s.offsetHeight > 0 && !s.hasAttribute("inert") && window.getComputedStyle(s).visibility !== "hidden";
24
- }
25
- );
26
- }
27
- function F(o = {}) {
28
- const {
29
- active: t = !0,
30
- escapeDeactivates: s = !0,
31
- onEscape: e,
32
- initialFocus: n,
33
- returnFocus: r,
34
- clickOutsideDeactivates: a = !1,
35
- onClickOutside: u
36
- } = o;
37
- return S((m) => {
38
- let f = t, p = null, c = [];
39
- typeof document < "u" && (p = document.activeElement);
40
- const v = () => {
41
- c = te(m);
42
- }, b = (l) => {
43
- if (f) {
44
- if (s && l.key === "Escape") {
45
- l.preventDefault(), e?.();
46
- return;
47
- }
48
- if (l.key === "Tab") {
49
- if (v(), c.length === 0) {
50
- l.preventDefault();
51
- return;
52
- }
53
- const i = c.indexOf(
54
- document.activeElement
55
- );
56
- l.shiftKey ? i <= 0 && (l.preventDefault(), c[c.length - 1]?.focus()) : i >= c.length - 1 && (l.preventDefault(), c[0]?.focus());
57
- }
58
- }
59
- }, h = (l) => {
60
- if (!f || !a) return;
61
- const i = l.target;
62
- m.contains(i) || u?.();
63
- }, y = () => {
64
- if (!f) return;
65
- v();
66
- let l = null;
67
- typeof n == "function" ? l = n() : n ? l = n : c.length > 0 && (l = c[0]), l && setTimeout(() => {
68
- l?.focus();
69
- }, 50), document.addEventListener("keydown", b, !0), a && document.addEventListener("click", h, !0);
70
- }, x = () => {
71
- f = !1, document.removeEventListener("keydown", b, !0), document.removeEventListener("click", h, !0);
72
- let l = null;
73
- typeof r == "function" ? l = r() : r ? l = r : p && (l = p), l && document.body.contains(l) && setTimeout(() => {
74
- l?.focus();
75
- }, 0);
76
- };
77
- return setTimeout(() => y(), 0), z(() => {
78
- x();
79
- });
80
- });
81
- }
82
- function he(o = {}) {
83
- return {
84
- activate: () => F({ ...o, active: !0 }),
85
- deactivate: () => F({ ...o, active: !1 })
86
- };
87
- }
88
- function N({
89
- initialStatus: o = "closed",
90
- openedAfter: t,
91
- closedAfter: s
92
- }) {
93
- const e = R(o), n = () => {
94
- e.set("start-opening");
95
- }, r = () => {
96
- e.set("start-closing");
97
- }, a = e.map(
98
- (i) => i !== "closed" && i !== "start-closing" && i !== "closing"
99
- ), u = (i) => {
100
- i ? n() : r();
101
- }, m = () => {
102
- u(!a.value);
103
- }, f = [], p = (i) => {
104
- f.push(
105
- e.on((w) => {
106
- w === "closed" && i();
107
- })
108
- );
109
- };
110
- let c = () => {
111
- };
112
- e.on((i) => {
113
- switch (c(), i) {
114
- case "start-opening":
115
- c = $(() => e.set("opening"));
116
- break;
117
- case "opening":
118
- c = t(() => e.set("opened"));
119
- break;
120
- case "start-closing":
121
- c = $(() => e.set("closing"));
122
- break;
123
- case "closing":
124
- c = s(() => e.set("closed"));
125
- break;
126
- case "closed":
127
- c = () => {
128
- };
129
- break;
130
- }
131
- }), e.onDispose(() => {
132
- f.forEach((i) => i()), c();
133
- });
134
- const v = e.map((i) => i === "closed"), b = e.map((i) => i === "start-opening"), h = e.map((i) => i === "opening"), y = e.map((i) => i === "opened"), x = e.map((i) => i === "closing"), l = e.map((i) => i === "start-closing");
135
- return {
136
- status: e,
137
- open: n,
138
- close: r,
139
- toggle: m,
140
- setOpen: u,
141
- display: a,
142
- isClosed: v,
143
- isStartOpening: b,
144
- isOpening: h,
145
- isOpened: y,
146
- isClosing: x,
147
- isStartClosing: l,
148
- dispose: () => e.dispose(),
149
- listenOnClosed: p
150
- };
151
- }
152
- function ge({
153
- initialStatus: o = "closed",
154
- duration: t,
155
- openDuration: s = t ?? 500,
156
- closeDuration: e = t ?? 500
157
- } = {}) {
158
- return N({
159
- initialStatus: o,
160
- openedAfter: (n) => _(n, s),
161
- closedAfter: (n) => _(n, e)
162
- });
163
- }
164
- function W(o, t) {
165
- let s = !1, e = null;
166
- function n() {
167
- s || (s = !0, o.removeEventListener("transitionend", r), o.removeEventListener("animationend", a), e && (clearTimeout(e), e = null), t());
168
- }
169
- function r(f) {
170
- f.target === o && n();
171
- }
172
- function a(f) {
173
- f.target === o && n();
174
- }
175
- const m = $(() => {
176
- if (typeof o.getAnimations > "u") {
177
- e = setTimeout(n, 16);
178
- return;
179
- }
180
- o.addEventListener("transitionend", r), o.addEventListener("animationend", a), o.getAnimations().length === 0 && (e = setTimeout(n, 1e3));
181
- });
182
- return () => {
183
- s = !0, m(), e && (clearTimeout(e), e = null), o.removeEventListener("transitionend", r), o.removeEventListener("animationend", a);
184
- };
185
- }
186
- function G({
187
- initialStatus: o = "closed",
188
- element: t
189
- } = {}) {
190
- let s = t;
191
- return {
192
- setElement: (e) => {
193
- s = e;
194
- },
195
- ...N({
196
- initialStatus: o,
197
- openedAfter: (e) => s == null ? (e(), () => {
198
- }) : W(s, e),
199
- closedAfter: (e) => s == null ? (e(), () => {
200
- }) : W(s, e)
201
- })
202
- };
203
- }
204
- function se(o) {
205
- if (o == null) return "";
206
- const t = [];
207
- return o.fade && t.push("fade"), o.slide && t.push(`slide-${o.slide}`), o.scale != null && t.push("scale"), t.length > 0 ? t.join(" ") : "none";
208
- }
209
- function ne(o) {
210
- if (o == null) return "";
211
- const t = [];
212
- return o.scale != null && typeof o.scale == "number" && t.push(`--scale-factor: ${o.scale}`), o.transformOrigin != null && t.push(`--transform-origin: ${o.transformOrigin}`), o.duration != null && t.push(`--animation-duration: ${o.duration}ms`), o.easing != null && t.push(`--animation-easing: ${o.easing}`), t.join("; ");
213
- }
214
- function oe({
215
- animation: o,
216
- status: t
217
- }) {
218
- const s = A(
219
- o,
220
- t
221
- )((n, r) => {
222
- if (n == null)
223
- return `bc-animated-toggle bc-animated-toggle--${r}`;
224
- const a = r === "start-opening" || r === "opening" || r === "opened";
225
- let u;
226
- return "enter" in n || "exit" in n ? u = a ? n.enter : n.exit : u = n, `bc-animated-toggle bc-animated-toggle--${se(u)} bc-animated-toggle--${r}`;
227
- }), e = A(
228
- o,
229
- t
230
- )((n, r) => {
231
- if (n == null) return "";
232
- const a = r === "start-opening" || r === "opening" || r === "opened";
233
- let u;
234
- return "enter" in n || "exit" in n ? u = a ? n.enter : n.exit : u = n, ne(u);
235
- });
236
- return M(g.class(s), g.style(e));
237
- }
238
- function be({
239
- initialStatus: o = "closed",
240
- animation: t
241
- }, s) {
242
- return S((e) => {
243
- const { setElement: n, dispose: r, ...a } = G({
244
- initialStatus: o,
245
- element: e
246
- });
247
- return n(e), M(
248
- oe({ status: a.status, animation: t }),
249
- z(r),
250
- s(a)
251
- );
252
- });
253
- }
254
- function re(o) {
255
- return {
256
- "~standard": {
257
- version: 1,
258
- vendor: "beatui-custom",
259
- validate: (s) => {
260
- const e = o.validate(s);
261
- return e.success ? { value: e.data } : {
262
- issues: e.errors.map((n) => ({
263
- message: n.message,
264
- path: n.path
265
- }))
266
- };
267
- },
268
- types: void 0
269
- },
270
- safeParse: (s) => {
271
- const e = o.validate(s);
272
- return e.success ? { success: !0, data: e.data } : {
273
- success: !1,
274
- error: {
275
- errors: e.errors.map((n) => ({
276
- message: n.message,
277
- path: n.path?.map(
278
- (r) => typeof r == "object" && "key" in r ? r.key.toString() : r.toString()
279
- ) || []
280
- }))
281
- }
282
- };
283
- }
284
- };
285
- }
286
- class T {
287
- optional() {
288
- return new ae(this);
289
- }
290
- default(t) {
291
- return new ie(this, t);
292
- }
293
- schema() {
294
- return re(this);
295
- }
296
- }
297
- class C extends T {
298
- minLength;
299
- maxLength;
300
- pattern;
301
- customValidations = [];
302
- validate(t) {
303
- if (typeof t != "string")
304
- return { success: !1, errors: [{ message: "Expected string" }] };
305
- const s = [];
306
- this.minLength !== void 0 && t.length < this.minLength && s.push({ message: `Must be at least ${this.minLength} characters` }), this.maxLength !== void 0 && t.length > this.maxLength && s.push({ message: `Must be at most ${this.maxLength} characters` }), this.pattern && !this.pattern.test(t) && s.push({ message: "Invalid format" });
307
- for (const e of this.customValidations) {
308
- const n = e(t);
309
- n && s.push({ message: n });
310
- }
311
- return s.length > 0 ? { success: !1, errors: s } : { success: !0, data: t };
312
- }
313
- min(t, s) {
314
- const e = new C();
315
- return e.minLength = t, e.maxLength = this.maxLength, e.pattern = this.pattern, e.customValidations = [...this.customValidations], s && e.customValidations.push(
316
- (n) => n.length < t ? s : null
317
- ), e;
318
- }
319
- max(t, s) {
320
- const e = new C();
321
- return e.minLength = this.minLength, e.maxLength = t, e.pattern = this.pattern, e.customValidations = [...this.customValidations], s && e.customValidations.push(
322
- (n) => n.length > t ? s : null
323
- ), e;
324
- }
325
- regex(t, s) {
326
- const e = new C();
327
- return e.minLength = this.minLength, e.maxLength = this.maxLength, e.pattern = t, e.customValidations = [...this.customValidations], s && e.customValidations.push(
328
- (n) => t.test(n) ? null : s
329
- ), e;
330
- }
331
- email(t = "Please enter a valid email address") {
332
- const s = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, e = new C();
333
- return e.minLength = this.minLength, e.maxLength = this.maxLength, e.pattern = this.pattern, e.customValidations = [
334
- ...this.customValidations,
335
- (n) => s.test(n) ? null : t
336
- ], e;
337
- }
338
- refine(t) {
339
- const s = new C();
340
- return s.minLength = this.minLength, s.maxLength = this.maxLength, s.pattern = this.pattern, s.customValidations = [...this.customValidations, t], s;
341
- }
342
- }
343
- class O extends T {
344
- mustBeTrue = !1;
345
- trueMessage;
346
- validate(t) {
347
- return typeof t != "boolean" ? { success: !1, errors: [{ message: "Expected boolean" }] } : this.mustBeTrue && t !== !0 ? {
348
- success: !1,
349
- errors: [{ message: this.trueMessage || "Must be true" }]
350
- } : { success: !0, data: t };
351
- }
352
- refine(t, s) {
353
- const e = new O();
354
- e.mustBeTrue = this.mustBeTrue, e.trueMessage = this.trueMessage;
355
- const n = e.validate.bind(e);
356
- return e.validate = (r) => {
357
- const a = n(r);
358
- return a.success ? t(a.data) ? a : { success: !1, errors: [{ message: s }] } : a;
359
- }, e;
360
- }
361
- literal(t, s) {
362
- const e = new O();
363
- return e.mustBeTrue = !0, e.trueMessage = s, e;
364
- }
365
- }
366
- class ae extends T {
367
- constructor(t) {
368
- super(), this.inner = t;
369
- }
370
- validate(t) {
371
- if (t === void 0)
372
- return { success: !0, data: void 0 };
373
- const s = this.inner.validate(t);
374
- return s.success ? { success: !0, data: s.data } : { success: !1, errors: s.errors };
375
- }
376
- }
377
- class ie extends T {
378
- constructor(t, s) {
379
- super(), this.inner = t, this.defaultValue = s;
380
- }
381
- validate(t) {
382
- return t === void 0 ? { success: !0, data: this.defaultValue } : this.inner.validate(t);
383
- }
384
- }
385
- class D extends T {
386
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
387
- constructor(t) {
388
- super(), this.shape = t;
389
- }
390
- validate(t) {
391
- if (typeof t != "object" || t === null || Array.isArray(t))
392
- return { success: !1, errors: [{ message: "Expected object" }] };
393
- const s = t, e = {}, n = [];
394
- for (const [r, a] of Object.entries(this.shape)) {
395
- const u = a.validate(s[r]);
396
- if (u.success)
397
- e[r] = u.data;
398
- else
399
- for (const m of u.errors)
400
- n.push({
401
- message: m.message,
402
- path: [r, ...m.path || []]
403
- });
404
- }
405
- return n.length > 0 ? { success: !1, errors: n } : { success: !0, data: e };
406
- }
407
- refine(t, s) {
408
- const e = new D(this.shape), n = e.validate.bind(e);
409
- return e.validate = (r) => {
410
- const a = n(r);
411
- if (!a.success) return a;
412
- const u = t(a.data);
413
- return u ? {
414
- success: !1,
415
- errors: [
416
- {
417
- message: u,
418
- path: s?.path
419
- }
420
- ]
421
- } : { success: !0, data: a.data };
422
- }, e;
423
- }
424
- }
425
- const ve = () => new C(), ye = () => new O(), Ee = (o) => new D(o);
426
- function ce(o) {
427
- return J((t) => {
428
- const s = [], e = () => s.forEach((r) => r());
429
- return o(({
430
- effect: r = "opaque",
431
- mode: a = "capturing",
432
- onClickOutside: u,
433
- onEscape: m,
434
- content: f,
435
- container: p = "body"
436
- }) => {
437
- p === "body" && (t = t.makePortal("body"));
438
- const c = G();
439
- c.listenOnClosed(e);
440
- let v = () => {
441
- }, b = () => {
442
- };
443
- const h = (E) => {
444
- E.key === "Escape" && (m?.(), c.close());
445
- }, y = () => {
446
- u?.(), c.close();
447
- }, x = (E) => {
448
- v(), b(), E === "capturing" ? (document.addEventListener("keydown", h), v = () => document.removeEventListener("keydown", h), t.element.addEventListener("mousedown", y), b = () => t.element.removeEventListener("mousedown", y)) : (v = () => {
449
- }, b = () => {
450
- });
451
- }, l = U.on(a, x);
452
- s.push(l), s.push(() => {
453
- c.dispose(), v(), b();
454
- });
455
- const w = Q((() => {
456
- const E = /* @__PURE__ */ new Set();
457
- for (const d of t.element.querySelectorAll(
458
- ":scope > :not([data-overlay])"
459
- ))
460
- d.hasAttribute("inert") ? E.add(d) : d.setAttribute("inert", "");
461
- return s.push(() => {
462
- for (const d of t.element.querySelectorAll(
463
- ":scope > :not([data-overlay])"
464
- ))
465
- E.has(d) || d.removeAttribute("inert");
466
- E.clear();
467
- }), document.activeElement?.blur?.(), k.div(
468
- S((d) => c.setElement(d)),
469
- V.status(c.status.map(String)),
470
- V.overlay("true"),
471
- g.class(
472
- A(
473
- r ?? "opaque",
474
- a
475
- )(
476
- (d, L) => `bc-overlay bc-overlay--effect-${d} bc-overlay--mode-${L}`
477
- )
478
- ),
479
- f
480
- );
481
- })(), t.element, {
482
- disposeWithParent: !0,
483
- clear: !1,
484
- providers: t.providers
485
- });
486
- s.push(w), $(() => c.open());
487
- }, e);
488
- });
489
- }
490
- function le(o, t) {
491
- const {
492
- size: s = "md",
493
- dismissable: e = !0,
494
- showCloseButton: n = !0,
495
- onClose: r,
496
- overlayEffect: a = "opaque",
497
- container: u = "body",
498
- position: m = "center"
499
- } = o;
500
- return ce((f, p) => {
501
- let c = () => {
502
- };
503
- return t((h) => {
504
- c = p;
505
- const y = R("capturing");
506
- U.on(e, (d) => {
507
- y.set(d ? "capturing" : "non-capturing");
508
- });
509
- const x = A(
510
- h.header != null,
511
- n
512
- )((d, L) => d || L), l = Y("modal"), i = `${l}-header`, w = `${l}-body`, E = k.div(
513
- g.class(
514
- A(
515
- s,
516
- m
517
- )(
518
- (d, L) => `bc-modal bc-modal--size-${d} bc-modal--container-${u} bc-modal--position-${L}`
519
- )
520
- ),
521
- // Essential ARIA attributes for modal dialog
522
- g.role("dialog"),
523
- B.modal(!0),
524
- ...h.header ? [B.labelledby(i)] : [],
525
- B.describedby(w),
526
- g.tabindex(-1),
527
- // Make modal focusable for initial focus
528
- g.id(l),
529
- V.focusTrap("true"),
530
- // Mark as focus trap container
531
- X.mousedown((d) => d.stopPropagation()),
532
- // Prevent overlay click-outside when clicking modal content
533
- // Focus trap implementation
534
- F({
535
- escapeDeactivates: !1,
536
- // Let Overlay handle escape key
537
- initialFocus: () => {
538
- const d = document.getElementById(l);
539
- if (!d) return null;
540
- const L = d.querySelector(
541
- '[aria-label="Close modal"]'
542
- );
543
- if (L) return L;
544
- const I = d.querySelector(
545
- 'button, input, select, textarea, [tabindex]:not([tabindex="-1"])'
546
- );
547
- return I || d;
548
- }
549
- }),
550
- // Modal content container
551
- k.div(
552
- g.class("bc-modal__content"),
553
- // Header section
554
- j(
555
- x,
556
- () => k.div(
557
- g.class("bc-modal__header"),
558
- k.div(
559
- g.class("bc-modal__title"),
560
- ...h.header ? [g.id(i)] : [],
561
- h.header
562
- ),
563
- j(
564
- n,
565
- () => H(
566
- K,
567
- (d) => Z({
568
- size: "sm",
569
- label: d.$.closeModal,
570
- onClick: () => {
571
- c(), p();
572
- }
573
- })
574
- )
575
- )
576
- )
577
- ),
578
- // Body section
579
- k.div(g.class("bc-modal__body"), g.id(w), h.body),
580
- // Footer section
581
- h.footer && k.div(g.class("bc-modal__footer"), h.footer)
582
- )
583
- );
584
- f({
585
- mode: y,
586
- effect: a ?? "opaque",
587
- container: u,
588
- content: E,
589
- onClickOutside: () => {
590
- r?.(), p();
591
- },
592
- onEscape: () => {
593
- r?.(), p();
594
- }
595
- });
596
- }, () => {
597
- c(), p();
598
- });
599
- });
600
- }
601
- function Le(o, t) {
602
- const { confirmText: s, cancelText: e, onConfirm: n, onCancel: r, ...a } = o;
603
- return H(
604
- K,
605
- (u) => le({ showCloseButton: !1, ...a }, (m, f) => {
606
- const p = () => {
607
- n?.(), f();
608
- }, c = () => {
609
- r?.(), f();
610
- };
611
- return t((b) => {
612
- m({
613
- body: b,
614
- footer: M(
615
- g.class("bc-modal__actions"),
616
- P(
617
- {
618
- variant: "outline",
619
- onClick: c
620
- },
621
- q(e, u.$.cancel)
622
- ),
623
- P(
624
- {
625
- color: "primary",
626
- variant: "filled",
627
- onClick: p
628
- },
629
- q(s, u.$.confirm)
630
- )
631
- )
632
- });
633
- }, f);
634
- })
635
- );
636
- }
637
- export {
638
- oe as A,
639
- O as B,
640
- Le as C,
641
- F,
642
- le as M,
643
- ce as O,
644
- C as S,
645
- be as a,
646
- ye as b,
647
- D as c,
648
- re as d,
649
- he as e,
650
- N as f,
651
- ge as g,
652
- Ee as o,
653
- ve as s,
654
- G as u
655
- };
@@ -1 +0,0 @@
1
- "use strict";const I=require("./text-input-CByq5OIo.cjs"),t=require("@tempots/dom"),f=require("./translations-B4-Zd2LM.cjs"),E=require("./use-form-JjeKCINk.cjs"),_=n=>{const r={name:"email",autocomplete:"email",...n},{value:s,before:l,onBlur:a,onChange:m,onInput:c,placeholder:h}=r,p=l??I.InputIcon({icon:"line-md:email",size:n.size,color:"neutral"});return t.Use(f.BeatUII18n,d=>I.InputContainer({...n,before:p,input:t.input.email(I.CommonInputAttributes(r),t.attr.placeholder(t.coalesce(h,d.$.emailPlaceholderText)),t.attr.value(s),t.attr.class("bc-input"),a!=null?t.on.blur(t.emitValue(a)):t.Empty,m!=null?t.on.change(t.emitValue(m)):t.Empty,c!=null?t.on.input(t.emitValue(c)):t.Empty)}))},O=n=>{const{value:r,onBlur:s,onChange:l,onInput:a,before:m,after:c,hasError:h,disabled:p,autocomplete:d,placeholder:w,...b}=n,V={name:"password",disabled:p,...b},u=t.prop(!0),o=t.computedOf(u,d)((e,i)=>e?i??"current-password":"off");return t.Use(f.BeatUII18n,e=>{const i=t.computedOf(e.$.passwordPlaceholderText,u,w)((g,v,C)=>v?"•••••••••••••••":C??g),y=t.html.button(t.attr.type("button"),t.attr.class("bc-input-container__password-toggle"),t.aria.label(e.$.togglePasswordVisibility),t.on.click(()=>u.update(g=>!g)),t.When(u,()=>f.Icon({icon:"line-md:watch"}),()=>f.Icon({icon:"line-md:watch-off"})));return I.InputContainer({before:m,disabled:p,hasError:h,input:t.html.input(I.CommonInputAttributes({...V,autocomplete:o,placeholder:i}),t.When(u,()=>t.Fragment(t.attr.type("password")),()=>t.Fragment(t.attr.type("text"))),t.attr.class("bc-input"),t.attr.value(r),s!=null?t.on.blur(t.emitValue(s)):t.Empty,l!=null?t.on.change(t.emitValue(l)):t.Empty,a!=null?t.on.input(t.emitValue(a)):t.Empty),after:c!=null?t.Fragment(y,c):y})})};function B(n){switch(n){case"success":return"material-symbols:check-circle-outline";case"warning":return"material-symbols:warning-outline";case"danger":return"material-symbols:error-outline";case"info":default:return"material-symbols:info-outline"}}function U(n){switch(n){case"success":return"success";case"warning":return"warning";case"danger":return"danger";case"info":default:return"info"}}function P(n,r,s,l){const a=["bc-notice",`bc-notice--${n}`,`bc-notice--tone-${r}`];return s&&a.push("bc-notice--dismissible"),l&&l.length>0&&a.push(l),a.join(" ")}function T({variant:n="info",tone:r="subtle",role:s,title:l,icon:a,closable:m=!1,onDismiss:c,class:h},...p){const d=t.prop(!0);return t.When(d,()=>{const w=t.Value.map(m,o=>!!o||c!=null),b=t.Value.map(n,o=>o??"info"),V=t.Value.map(r,o=>o??"subtle"),u=t.computedOf(s,b)((o,e)=>o??(e==="danger"?"alert":"status"));return t.Use(f.BeatUII18n,o=>t.html.div(t.attr.class(t.computedOf(b,V,w,h)((e,i,y,g)=>P(e,i,y,g))),t.attr.role(t.Value.map(u,e=>e)),t.Unless(t.Value.map(a,e=>e===!1),()=>t.html.div(t.attr.class("bc-notice__icon"),f.Icon({icon:t.computedOf(a,b)((e,i)=>e===void 0?B(i):String(e)),size:"md",color:t.Value.map(b,U)}))),t.html.div(t.attr.class("bc-notice__body"),t.Ensure(l,e=>t.html.div(t.attr.class("bc-notice__title"),e)),t.html.div(t.attr.class("bc-notice__content"),...p)),t.When(w,()=>E.CloseButton({size:"xs",label:o.$.closeModal,onClick:()=>{d.set(!1),c?.()}}))))})}exports.EmailInput=_;exports.Notice=T;exports.PasswordInput=O;
@@ -1 +0,0 @@
1
- "use strict";const t=require("@tempots/dom"),o=require("./translations-B4-Zd2LM.cjs"),w=require("@tempots/ui");function x(r,n,a,e){const l=["bc-button",`bc-button--size-${r}`,`bc-control--padding-${r}`,`bc-control--rounded-${n}`];return a&&l.push("bc-button--loading"),e&&l.push("bc-button--full-width"),l.join(" ")}function f(r,n,a){const e=new Map;e.set("--button-text-shadow","var(--text-shadow-none)"),e.set("--button-text-shadow-dark","var(--text-shadow-none)");const l=(s,u,i,d)=>{a||(e.set("--button-bg-hover",s),e.set("--button-text-hover",i),e.set("--button-bg-hover-dark",u),e.set("--button-text-hover-dark",d))};switch(r){case"filled":{const s=o.backgroundValue(n,"solid","light"),u=o.backgroundValue(n,"solid","dark");e.set("--button-bg",s.backgroundColor),e.set("--button-text",s.textColor),e.set("--button-bg-dark",u.backgroundColor),e.set("--button-text-dark",u.textColor),e.set("--button-text-shadow","var(--text-shadow-button-filled, var(--text-shadow-sm))"),e.set("--button-text-shadow-dark","var(--text-shadow-button-filled, var(--text-shadow-sm))");const i=o.hoverBackgroundValue(n,"solid","light"),d=o.hoverBackgroundValue(n,"solid","dark");l(i.backgroundColor,d.backgroundColor,i.textColor,d.textColor);break}case"light":{const s=o.backgroundValue(n,"light","light"),u=o.backgroundValue(n,"light","dark");e.set("--button-bg",s.backgroundColor),e.set("--button-text",s.textColor),e.set("--button-bg-dark",u.backgroundColor),e.set("--button-text-dark",u.textColor);const i=o.hoverBackgroundValue(n,"light","light"),d=o.hoverBackgroundValue(n,"light","dark");l(i.backgroundColor,d.backgroundColor,i.textColor,d.textColor);break}case"outline":{e.set("--button-bg","transparent"),e.set("--button-bg-dark","transparent"),e.set("--button-border",o.borderColorValue(n,"light")),e.set("--button-border-dark",o.borderColorValue(n,"dark")),e.set("--button-text",o.textColorValue(n,"light")),e.set("--button-text-dark",o.textColorValue(n,"dark")),e.set("--button-text-shadow","var(--text-shadow-button-light, var(--text-shadow-xs))"),e.set("--button-text-shadow-dark","var(--text-shadow-button-light, var(--text-shadow-xs))");const s=o.hoverBackgroundValue(n,"light","light"),u=o.hoverBackgroundValue(n,"light","dark");l(s.backgroundColor,u.backgroundColor,s.textColor,u.textColor);break}case"default":{const s=o.backgroundValue("neutral","light","light"),u=o.backgroundValue("neutral","light","dark");e.set("--button-bg",s.backgroundColor),e.set("--button-text",o.textColorValue(n,"light")),e.set("--button-bg-dark",u.backgroundColor),e.set("--button-text-dark",o.textColorValue(n,"dark")),e.set("--button-text-shadow","var(--text-shadow-button-default, var(--text-shadow-2xs))"),e.set("--button-text-shadow-dark","var(--text-shadow-button-default, var(--text-shadow-2xs))");const i=o.hoverBackgroundValue("base","light","light"),d=o.hoverBackgroundValue("base","light","dark");l(i.backgroundColor,d.backgroundColor,e.get("--button-text")??s.textColor,e.get("--button-text-dark")??u.textColor);break}case"text":{e.set("--button-bg","transparent"),e.set("--button-bg-dark","transparent"),e.set("--button-text",o.textColorValue(n,"light")),e.set("--button-text-dark",o.textColorValue(n,"dark")),a||e.set("--button-hover-decoration","underline");break}}return Array.from(e.entries()).map(([s,u])=>`${s}: ${u}`).join("; ")}function V({type:r="button",disabled:n=!1,loading:a=!1,variant:e="filled",size:l="md",color:s="base",roundedness:u="sm",onClick:i=()=>{},fullWidth:d=!1,stopPropagation:g=!0},...p){const b=t.prop(null);return t.Use(o.BeatUII18n,h=>t.html.button(t.attr.type(r),t.attr.disabled(t.computedOf(n,a)((c,k)=>c||k)),t.aria.busy(a??!1),t.When(a??!1,()=>t.aria.label(h.$.loadingExtended)),t.attr.class(t.computedOf(l,u,a,d)(x)),t.attr.style(t.computedOf(e,s,n)(f)),t.When(a??!1,()=>t.Fragment(t.style.width(b.map(c=>c==null?"":`${c.width}px`)),t.style.height(b.map(c=>c==null?"":`${c.height}px`)),o.Icon({icon:"line-md:loading-twotone-loop",size:l??"md"}),t.html.span(t.attr.class("sr-only"),t.aria.live("polite"),h.$.loadingExtended)),()=>t.Fragment(t.on.click(c=>{r!=="submit"&&c.preventDefault(),g&&c.stopPropagation(),i()}),...p)),t.When(a!=null,()=>w.ElementRect(c=>(c.on(k=>{t.Value.get(a??!1)||b.set(k)}),t.Empty)))))}function I(r,n,a){const e=[r?"bc-base-input-container":"bc-input-container"];return n?e.push(r?"bc-base-input-container--disabled":"bc-input-container--disabled"):e.push(r?"bc-base-input-container--default":"bc-input-container--default"),a&&e.push("bc-input-container--error"),e.join(" ")}function m(r,n){const a=["bc-input-container__input"];return r||(a.push(`bc-control--padding-${n}`),a.push(`bc-control--text-size-${n}`)),a.join(" ")}const v=({baseContainer:r,disabled:n,input:a,before:e,after:l,hasError:s,focusableSelector:u="input, select, textarea",growInput:i=!0,size:d},...g)=>{const p=t.Value.map(n??!1,b=>b);return t.html.div(t.WithElement(b=>{const h=()=>{b.querySelector(u)?.focus()};return b.addEventListener("click",h),t.OnDispose(()=>b.removeEventListener("click",h))}),t.attr.class(t.computedOf(r,p,s??!1)((b,h,c)=>I(b??!1,h??!1,c??!1))),e!=null?t.html.span(t.attr.class("bc-input-container__before"),e):null,t.html.div(t.attr.class(t.computedOf(r,d??"md")((b,h)=>m(b??!1,h??"md"))),t.attr.class(t.Value.map(i,b=>b?"bc-input-container__input--grow":"")),a),l!=null?t.html.span(t.attr.class("bc-input-container__after"),l):null,...g)};function B({icon:r,size:n="md",color:a="neutral"}){return t.html.span(t.attr.class("bc-input-container__icon"),o.Icon({icon:r,size:n,color:a}))}const C=({autocomplete:r,autofocus:n,class:a,disabled:e,name:l,placeholder:s,id:u,required:i,tabIndex:d,hasError:g})=>t.Fragment(t.attr.autocomplete(r),t.attr.autofocus(n),t.attr.class(a),t.attr.disabled(e),t.attr.name(l??u),t.attr.placeholder(s),t.attr.id(u),t.aria.required(i),t.attr.tabindex(d),g!=null?t.aria.invalid(g??!1):null),y=r=>{const{value:n,onBlur:a,onChange:e,onInput:l}=r;return v({...r,input:t.input.text(C(r),t.attr.value(n),t.attr.class("bc-input"),a!=null?t.on.blur(t.emitValue(a)):t.Empty,e!=null?t.on.change(t.emitValue(e)):t.Empty,l!=null?t.on.input(t.emitValue(l)):t.Empty)})};exports.Button=V;exports.CommonInputAttributes=C;exports.InputContainer=v;exports.InputIcon=B;exports.TextInput=y;exports.generateButtonClasses=x;exports.generateButtonStyles=f;exports.generateInputContainerInputClasses=m;