@tempots/beatui 0.19.0 → 0.20.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 (124) hide show
  1. package/dist/{2019-D0n7sHsB.js → 2019-B4Mw3glM.js} +2 -2
  2. package/dist/{2019-CfIF9XVA.cjs → 2019-u0Cs1ZdE.cjs} +1 -1
  3. package/dist/{2020-D1ziwonq.cjs → 2020-BcwEHv2O.cjs} +1 -1
  4. package/dist/{2020-BkXWq9F8.js → 2020-BvFyb4Gy.js} +2 -2
  5. package/dist/{ar-DYmDITuw.cjs → ar-DyhaQaJU.cjs} +1 -1
  6. package/dist/{ar-CMndb3tf.js → ar-RkpJ2n6w.js} +1 -1
  7. package/dist/auth/index.cjs.js +1 -1
  8. package/dist/auth/index.es.js +646 -651
  9. package/dist/beatui.css +1 -1
  10. package/dist/{de-Cgy7XJBg.js → de-BdSVR4Zm.js} +1 -1
  11. package/dist/{de-ClQgQrXM.cjs → de-CnZ4Ik2a.cjs} +1 -1
  12. package/dist/{es-j0qszDAW.js → es-B_Qn5EUy.js} +1 -1
  13. package/dist/{es-BN5Mihv0.cjs → es-ZKraCneL.cjs} +1 -1
  14. package/dist/{fa-BUQvM0nj.cjs → fa-D2p_ch4Q.cjs} +1 -1
  15. package/dist/{fa-COUp2ofv.js → fa-jBaLjqfG.js} +1 -1
  16. package/dist/{fr-B5Ar6QcE.js → fr-B0KaMM2j.js} +1 -1
  17. package/dist/{fr-CwvsJDIZ.cjs → fr-CBeo42lQ.cjs} +1 -1
  18. package/dist/{he-HZvvmFUB.cjs → he-BmqEF3o-.cjs} +1 -1
  19. package/dist/{he-D5HTHvKh.js → he-DjeYjcW7.js} +1 -1
  20. package/dist/{hi-Cnr1RtgA.cjs → hi-BAfIFl1n.cjs} +1 -1
  21. package/dist/{hi-Bcc7iEXp.js → hi-DxBQV0uz.js} +1 -1
  22. package/dist/index-4NoQLiJo.cjs +2 -0
  23. package/dist/{index-DSvEBuy-.cjs → index-9UO7Pd64.cjs} +1 -1
  24. package/dist/{index-tuwLQMCb.js → index-B001qopB.js} +3 -3
  25. package/dist/{index-ykojBEwT.js → index-BIUeLQJ1.js} +4 -4
  26. package/dist/{index-FEy4Hwnx.cjs → index-BInDdLXi.cjs} +1 -1
  27. package/dist/{index-BUKtbimR.cjs → index-BWiQR9j3.cjs} +1 -1
  28. package/dist/{index-Dben4dbo.js → index-BX_AooS9.js} +2 -2
  29. package/dist/{index-CRfUh74G.cjs → index-Blq-MoAk.cjs} +1 -1
  30. package/dist/{index-rWglN8IQ.js → index-BnaafQ9o.js} +1 -1
  31. package/dist/{index-BJfVmi_X.js → index-BnbEC2zq.js} +2 -2
  32. package/dist/{index-CHgx0rFt.js → index-C4jYy0NW.js} +2 -2
  33. package/dist/{index-B-d5blto.js → index-C4xio93t.js} +3 -3
  34. package/dist/{index-CFo2nnaI.js → index-C5l1mFuD.js} +2 -2
  35. package/dist/{index-BYk56bqR.cjs → index-CDYYXcsk.cjs} +2 -2
  36. package/dist/{index-CIfx_bs7.cjs → index-CJM_lW9n.cjs} +1 -1
  37. package/dist/{index-D0-d-xdJ.js → index-CaNnYmEs.js} +6 -6
  38. package/dist/{index-BZHMnjr6.cjs → index-CaOzAsWD.cjs} +1 -1
  39. package/dist/{index-BF4pXHo-.js → index-CdvplJG6.js} +4 -4
  40. package/dist/{index-CUs1c8a9.js → index-ClvbjqJL.js} +8 -8
  41. package/dist/{index-DgUJYXoy.cjs → index-CpB78PPQ.cjs} +1 -1
  42. package/dist/{index-B16dbwxM.cjs → index-CpKAa22o.cjs} +1 -1
  43. package/dist/{index-DJ-avKHU.js → index-CpMCZBAl.js} +2 -2
  44. package/dist/{index-2DKUYRWr.js → index-Cs_PxtnZ.js} +1 -1
  45. package/dist/{index-DxG_avr8.cjs → index-CvRJPSEv.cjs} +1 -1
  46. package/dist/{index-DD-MOsCa.js → index-D5nWhHZv.js} +2 -2
  47. package/dist/{index-Cohec4rB.cjs → index-D7o5LhMm.cjs} +1 -1
  48. package/dist/{index-DYIv5X6N.js → index-DC5Cn-TM.js} +2 -2
  49. package/dist/{index-CKRuo2DB.js → index-DCpnqWRN.js} +3 -3
  50. package/dist/{index-BirEb-BA.js → index-DOlgncMG.js} +2178 -2193
  51. package/dist/{index-kk6qFeC5.cjs → index-DOyppfix.cjs} +1 -1
  52. package/dist/{index-DjNMMz5-.cjs → index-DXUQTPON.cjs} +1 -1
  53. package/dist/{index-C9XAXTDx.cjs → index-DdlxwtnE.cjs} +1 -1
  54. package/dist/{index-_OaxQJX1.js → index-DhJIuRg9.js} +4 -4
  55. package/dist/{index-Bg1QLlyj.js → index-DiV6JJiS.js} +3 -3
  56. package/dist/{index-DD8_efWr.cjs → index-Dl-wY6fc.cjs} +1 -1
  57. package/dist/{index-BguvTLHu.cjs → index-DlaVE6S2.cjs} +1 -1
  58. package/dist/index-JHbFZFZF.cjs +8 -0
  59. package/dist/{index-dsitEt8M.cjs → index-Jt6D3QJ7.cjs} +1 -1
  60. package/dist/{index-85k3bgcY.cjs → index-KcBlGDqr.cjs} +1 -1
  61. package/dist/{index-dV4F3c70.js → index-MyVoESdk.js} +3 -3
  62. package/dist/{index-DC4nzG_w.js → index-NysVuvZA.js} +5 -5
  63. package/dist/{index-D-Rzl363.cjs → index-RGCDszX8.cjs} +1 -1
  64. package/dist/{index-CoBM7UvE.js → index-c-O5R5i2.js} +2 -2
  65. package/dist/{index-C4UzgyIA.cjs → index-cjtIcxwt.cjs} +1 -1
  66. package/dist/{index-faGepKVA.js → index-fnMeddEM.js} +2 -2
  67. package/dist/{index-DV7tB1MN.cjs → index-uR3OZ_8K.cjs} +1 -1
  68. package/dist/index.cjs.js +25 -25
  69. package/dist/index.es.js +2248 -2264
  70. package/dist/index.esm-DJRz9AE-.cjs +1 -0
  71. package/dist/{index.esm-CSotgpVw.js → index.esm-DPNh6inz.js} +410 -420
  72. package/dist/{it-CTCKFU5g.js → it-B4qZsicu.js} +1 -1
  73. package/dist/{it-B7KeOLBm.cjs → it-CzKrFTFY.cjs} +1 -1
  74. package/dist/{ja-BGoETTZv.js → ja-BnCSmhkg.js} +1 -1
  75. package/dist/{ja-0ldomgID.cjs → ja-i_9MZ1j0.cjs} +1 -1
  76. package/dist/json-schema/index.cjs.js +1 -1
  77. package/dist/json-schema/index.es.js +1 -1
  78. package/dist/{ko-C4WEkArz.cjs → ko-CF9il-Az.cjs} +1 -1
  79. package/dist/{ko-xHeRs9LU.js → ko-D_gGkjrC.js} +1 -1
  80. package/dist/milkdown/index.cjs.js +1 -1
  81. package/dist/milkdown/index.es.js +1 -1
  82. package/dist/{milkdown-input-BbbZJGDl.js → milkdown-input-CYme9OBn.js} +14757 -14822
  83. package/dist/milkdown-input-KjtVqDzi.cjs +941 -0
  84. package/dist/modal-B-f3LBKr.cjs +1 -0
  85. package/dist/modal-BItfEmu0.js +600 -0
  86. package/dist/monaco/index.cjs.js +2 -2
  87. package/dist/monaco/index.es.js +114 -116
  88. package/dist/{nl-ey2Li7DF.js → nl-CsLCWUFF.js} +1 -1
  89. package/dist/{nl-D-y231ZO.cjs → nl-DfWlqR6T.cjs} +1 -1
  90. package/dist/notice-B7JqE59s.cjs +1 -0
  91. package/dist/notice-CmmpobJd.js +2415 -0
  92. package/dist/{pl-Bf0QaCGx.js → pl-Bsmj1KbZ.js} +1 -1
  93. package/dist/{pl-G6e4Mybr.cjs → pl-wK2sgv7l.cjs} +1 -1
  94. package/dist/{pt-D-_KxA9g.js → pt-BR_NuRJS.js} +1 -1
  95. package/dist/{pt-CD2Eqazl.cjs → pt-DAQIuOPW.cjs} +1 -1
  96. package/dist/{ru-CKh2xgqC.cjs → ru-BnoiCxrw.cjs} +1 -1
  97. package/dist/{ru-Dzbl29K2.js → ru-CiQ_qKD_.js} +1 -1
  98. package/dist/timer-BdH4cK6a.cjs +1 -0
  99. package/dist/timer-CQlK5LhW.js +47 -0
  100. package/dist/{tr-BbpC5gzM.cjs → tr-Bme5PfaE.cjs} +1 -1
  101. package/dist/{tr-yMHT8n7z.js → tr-Q9xP1nE4.js} +1 -1
  102. package/dist/translations-ClgoCEFC.js +1969 -0
  103. package/dist/{translations-DbN-OSLv.js → translations-D4hFMU4P.js} +1 -1
  104. package/dist/translations-DRBh70w8.cjs +2 -0
  105. package/dist/{translations-CXE8Z_Ac.cjs → translations-lnK_6RdU.cjs} +1 -1
  106. package/dist/{ur-kkik6-_r.cjs → ur-B4b39hNV.cjs} +1 -1
  107. package/dist/{ur-CdQA0epV.js → ur-CGTjSoJt.js} +1 -1
  108. package/dist/{vi-A8UmZU3L.js → vi-BF3HTFU9.js} +1 -1
  109. package/dist/{vi-1xtFXJc0.cjs → vi-CSpW181L.cjs} +1 -1
  110. package/dist/{zh-D0nnvX8T.js → zh-BreM8U2w.js} +1 -1
  111. package/dist/{zh-DC_SsXdk.cjs → zh-PeL8FN2c.cjs} +1 -1
  112. package/package.json +6 -6
  113. package/dist/index-B66rNs5i.cjs +0 -2
  114. package/dist/index-DXFKCiah.cjs +0 -8
  115. package/dist/index.esm-8xolKogd.cjs +0 -1
  116. package/dist/milkdown-input-C-Muq7PQ.cjs +0 -941
  117. package/dist/modal-nbZW44XS.js +0 -614
  118. package/dist/modal-wbG_oGOr.cjs +0 -1
  119. package/dist/notice-CIPcSfD5.js +0 -2432
  120. package/dist/notice-Cq02YHoN.cjs +0 -1
  121. package/dist/timer-CcMCjYrq.cjs +0 -1
  122. package/dist/timer-CkgWORR9.js +0 -42
  123. package/dist/translations-DBtfTNnM.js +0 -2005
  124. package/dist/translations-EQ1qPZ0_.cjs +0 -2
@@ -1,614 +0,0 @@
1
- var G = Object.defineProperty;
2
- var J = (o, n, t) => n in o ? G(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
3
- var k = (o, n, t) => J(o, typeof n != "symbol" ? n + "" : n, t);
4
- import { WithElement as z, OnDispose as Q, prop as R, attr as p, computedOf as B, WithBrowserCtx as X, Value as U, render as Y, html as T, dataAttr as D, aria as M, on as Z, When as I, Use as H, Fragment as ee, coalesce as O } from "@tempots/dom";
5
- import { w as $, T as j } from "./timer-CkgWORR9.js";
6
- import { s as te, B as K, C as se, a as P } from "./translations-DBtfTNnM.js";
7
- const ne = [
8
- "a[href]",
9
- "button:not([disabled])",
10
- "input:not([disabled])",
11
- "select:not([disabled])",
12
- "textarea:not([disabled])",
13
- '[tabindex]:not([tabindex="-1"])',
14
- '[contenteditable="true"]',
15
- "audio[controls]",
16
- "video[controls]",
17
- "details > summary:first-of-type",
18
- "details[open]"
19
- ].join(", ");
20
- function ae(o) {
21
- return Array.from(o.querySelectorAll(ne)).filter(
22
- (n) => {
23
- const t = n;
24
- return t.offsetWidth > 0 && t.offsetHeight > 0 && !t.hasAttribute("inert") && window.getComputedStyle(t).visibility !== "hidden";
25
- }
26
- );
27
- }
28
- function F(o = {}) {
29
- const {
30
- active: n = !0,
31
- escapeDeactivates: t = !0,
32
- onEscape: e,
33
- initialFocus: s,
34
- returnFocus: r,
35
- clickOutsideDeactivates: i = !1,
36
- onClickOutside: c
37
- } = o;
38
- return z((f) => {
39
- let d = n, l = null, u = [];
40
- typeof document < "u" && (l = document.activeElement);
41
- const y = () => {
42
- u = ae(f);
43
- }, b = (a) => {
44
- var L, A;
45
- if (d) {
46
- if (t && a.key === "Escape") {
47
- a.preventDefault(), e == null || e();
48
- return;
49
- }
50
- if (a.key === "Tab") {
51
- if (y(), u.length === 0) {
52
- a.preventDefault();
53
- return;
54
- }
55
- const v = u.indexOf(
56
- document.activeElement
57
- );
58
- a.shiftKey ? v <= 0 && (a.preventDefault(), (L = u[u.length - 1]) == null || L.focus()) : v >= u.length - 1 && (a.preventDefault(), (A = u[0]) == null || A.focus());
59
- }
60
- }
61
- }, h = (a) => {
62
- if (!d || !i) return;
63
- const L = a.target;
64
- f.contains(L) || c == null || c();
65
- }, E = () => {
66
- if (!d) return;
67
- y();
68
- let a = null;
69
- typeof s == "function" ? a = s() : s ? a = s : u.length > 0 && (a = u[0]), a && setTimeout(() => {
70
- a == null || a.focus();
71
- }, 50), document.addEventListener("keydown", b, !0), i && document.addEventListener("click", h, !0);
72
- }, x = () => {
73
- d = !1, document.removeEventListener("keydown", b, !0), document.removeEventListener("click", h, !0);
74
- let a = null;
75
- typeof r == "function" ? a = r() : r ? a = r : l && (a = l), a && document.body.contains(a) && setTimeout(() => {
76
- a == null || a.focus();
77
- }, 0);
78
- };
79
- return setTimeout(() => E(), 0), Q(() => {
80
- x();
81
- });
82
- });
83
- }
84
- function pe(o = {}) {
85
- return {
86
- activate: () => F({ ...o, active: !0 }),
87
- deactivate: () => F({ ...o, active: !1 })
88
- };
89
- }
90
- function N({
91
- initialStatus: o = "closed",
92
- openedAfter: n,
93
- closedAfter: t
94
- }) {
95
- const e = R(o), s = () => {
96
- e.set("start-opening");
97
- }, r = () => {
98
- e.set("start-closing");
99
- }, i = e.map(
100
- (a) => a !== "closed" && a !== "start-closing" && a !== "closing"
101
- ), c = (a) => {
102
- a ? s() : r();
103
- }, f = () => {
104
- c(!i.value);
105
- }, d = (a) => e.on((L) => {
106
- L === "closed" && a();
107
- });
108
- let l = () => {
109
- };
110
- e.on((a) => {
111
- switch (l(), a) {
112
- case "start-opening":
113
- l = $(() => e.set("opening"));
114
- break;
115
- case "opening":
116
- l = n(() => e.set("opened"));
117
- break;
118
- case "start-closing":
119
- l = $(() => e.set("closing"));
120
- break;
121
- case "closing":
122
- l = t(() => e.set("closed"));
123
- break;
124
- }
125
- }), e.onDispose(() => l());
126
- const u = e.map((a) => a === "closed"), y = e.map((a) => a === "start-opening"), b = e.map((a) => a === "opening"), h = e.map((a) => a === "opened"), E = e.map((a) => a === "closing"), x = e.map((a) => a === "start-closing");
127
- return {
128
- status: e,
129
- open: s,
130
- close: r,
131
- toggle: f,
132
- setOpen: c,
133
- display: i,
134
- isClosed: u,
135
- isStartOpening: y,
136
- isOpening: b,
137
- isOpened: h,
138
- isClosing: E,
139
- isStartClosing: x,
140
- dispose: () => e.dispose(),
141
- onClosed: d
142
- };
143
- }
144
- function ge({
145
- initialStatus: o = "closed",
146
- duration: n,
147
- openDuration: t = n ?? 500,
148
- closeDuration: e = n ?? 500
149
- } = {}) {
150
- return N({
151
- initialStatus: o,
152
- openedAfter: (s) => j(s, t),
153
- closedAfter: (s) => j(s, e)
154
- });
155
- }
156
- function W(o, n) {
157
- let t = !1, e = null;
158
- function s() {
159
- t || (t = !0, e && (clearTimeout(e), e = null), n());
160
- }
161
- function r(d) {
162
- d.target === o && s();
163
- }
164
- function i(d) {
165
- d.target === o && s();
166
- }
167
- const f = $(() => {
168
- if (typeof o.getAnimations > "u") {
169
- e = setTimeout(s, 16);
170
- return;
171
- }
172
- o.getAnimations().length === 0 ? (o.addEventListener("transitionend", r, { once: !0 }), o.addEventListener("animationend", i, { once: !0 }), e = setTimeout(s, 1e3)) : (o.addEventListener("transitionend", r, { once: !0 }), o.addEventListener("animationend", i, { once: !0 }));
173
- });
174
- return () => {
175
- t = !0, f(), e && (clearTimeout(e), e = null), o.removeEventListener("transitionend", r), o.removeEventListener("animationend", i);
176
- };
177
- }
178
- function re({
179
- initialStatus: o = "closed",
180
- element: n
181
- } = {}) {
182
- let t = n;
183
- return {
184
- setElement: (e) => {
185
- t = e;
186
- },
187
- ...N({
188
- initialStatus: o,
189
- openedAfter: (e) => t == null ? (e(), () => {
190
- }) : W(t, e),
191
- closedAfter: (e) => t == null ? (e(), () => {
192
- }) : W(t, e)
193
- })
194
- };
195
- }
196
- function be(o, n) {
197
- return p.class(
198
- B(
199
- o,
200
- n
201
- )((t, e) => `bu-toggle--animated bu-toggle--${t} bu-toggle--${e}`)
202
- );
203
- }
204
- function oe(o) {
205
- return {
206
- "~standard": {
207
- version: 1,
208
- vendor: "beatui-custom",
209
- validate: (t) => {
210
- const e = o.validate(t);
211
- return e.success ? { value: e.data } : {
212
- issues: e.errors.map((s) => ({
213
- message: s.message,
214
- path: s.path
215
- }))
216
- };
217
- },
218
- types: void 0
219
- },
220
- safeParse: (t) => {
221
- const e = o.validate(t);
222
- return e.success ? { success: !0, data: e.data } : {
223
- success: !1,
224
- error: {
225
- errors: e.errors.map((s) => {
226
- var r;
227
- return {
228
- message: s.message,
229
- path: ((r = s.path) == null ? void 0 : r.map(
230
- (i) => typeof i == "object" && "key" in i ? i.key.toString() : i.toString()
231
- )) || []
232
- };
233
- })
234
- }
235
- };
236
- }
237
- };
238
- }
239
- class V {
240
- optional() {
241
- return new ie(this);
242
- }
243
- default(n) {
244
- return new ce(this, n);
245
- }
246
- schema() {
247
- return oe(this);
248
- }
249
- }
250
- class C extends V {
251
- constructor() {
252
- super(...arguments);
253
- k(this, "minLength");
254
- k(this, "maxLength");
255
- k(this, "pattern");
256
- k(this, "customValidations", []);
257
- }
258
- validate(t) {
259
- if (typeof t != "string")
260
- return { success: !1, errors: [{ message: "Expected string" }] };
261
- const e = [];
262
- this.minLength !== void 0 && t.length < this.minLength && e.push({ message: `Must be at least ${this.minLength} characters` }), this.maxLength !== void 0 && t.length > this.maxLength && e.push({ message: `Must be at most ${this.maxLength} characters` }), this.pattern && !this.pattern.test(t) && e.push({ message: "Invalid format" });
263
- for (const s of this.customValidations) {
264
- const r = s(t);
265
- r && e.push({ message: r });
266
- }
267
- return e.length > 0 ? { success: !1, errors: e } : { success: !0, data: t };
268
- }
269
- min(t, e) {
270
- const s = new C();
271
- return s.minLength = t, s.maxLength = this.maxLength, s.pattern = this.pattern, s.customValidations = [...this.customValidations], e && s.customValidations.push(
272
- (r) => r.length < t ? e : null
273
- ), s;
274
- }
275
- max(t, e) {
276
- const s = new C();
277
- return s.minLength = this.minLength, s.maxLength = t, s.pattern = this.pattern, s.customValidations = [...this.customValidations], e && s.customValidations.push(
278
- (r) => r.length > t ? e : null
279
- ), s;
280
- }
281
- regex(t, e) {
282
- const s = new C();
283
- return s.minLength = this.minLength, s.maxLength = this.maxLength, s.pattern = t, s.customValidations = [...this.customValidations], e && s.customValidations.push(
284
- (r) => t.test(r) ? null : e
285
- ), s;
286
- }
287
- email(t = "Please enter a valid email address") {
288
- const e = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, s = new C();
289
- return s.minLength = this.minLength, s.maxLength = this.maxLength, s.pattern = this.pattern, s.customValidations = [
290
- ...this.customValidations,
291
- (r) => e.test(r) ? null : t
292
- ], s;
293
- }
294
- refine(t) {
295
- const e = new C();
296
- return e.minLength = this.minLength, e.maxLength = this.maxLength, e.pattern = this.pattern, e.customValidations = [...this.customValidations, t], e;
297
- }
298
- }
299
- class S extends V {
300
- constructor() {
301
- super(...arguments);
302
- k(this, "mustBeTrue", !1);
303
- k(this, "trueMessage");
304
- }
305
- validate(t) {
306
- return typeof t != "boolean" ? { success: !1, errors: [{ message: "Expected boolean" }] } : this.mustBeTrue && t !== !0 ? {
307
- success: !1,
308
- errors: [{ message: this.trueMessage || "Must be true" }]
309
- } : { success: !0, data: t };
310
- }
311
- refine(t, e) {
312
- const s = new S();
313
- s.mustBeTrue = this.mustBeTrue, s.trueMessage = this.trueMessage;
314
- const r = s.validate.bind(s);
315
- return s.validate = (i) => {
316
- const c = r(i);
317
- return c.success ? t(c.data) ? c : { success: !1, errors: [{ message: e }] } : c;
318
- }, s;
319
- }
320
- literal(t, e) {
321
- const s = new S();
322
- return s.mustBeTrue = !0, s.trueMessage = e, s;
323
- }
324
- }
325
- class ie extends V {
326
- constructor(n) {
327
- super(), this.inner = n;
328
- }
329
- validate(n) {
330
- if (n === void 0)
331
- return { success: !0, data: void 0 };
332
- const t = this.inner.validate(n);
333
- return t.success ? { success: !0, data: t.data } : { success: !1, errors: t.errors };
334
- }
335
- }
336
- class ce extends V {
337
- constructor(n, t) {
338
- super(), this.inner = n, this.defaultValue = t;
339
- }
340
- validate(n) {
341
- return n === void 0 ? { success: !0, data: this.defaultValue } : this.inner.validate(n);
342
- }
343
- }
344
- class q extends V {
345
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
346
- constructor(n) {
347
- super(), this.shape = n;
348
- }
349
- validate(n) {
350
- if (typeof n != "object" || n === null || Array.isArray(n))
351
- return { success: !1, errors: [{ message: "Expected object" }] };
352
- const t = n, e = {}, s = [];
353
- for (const [r, i] of Object.entries(this.shape)) {
354
- const c = i.validate(t[r]);
355
- if (c.success)
356
- e[r] = c.data;
357
- else
358
- for (const f of c.errors)
359
- s.push({
360
- message: f.message,
361
- path: [r, ...f.path || []]
362
- });
363
- }
364
- return s.length > 0 ? { success: !1, errors: s } : { success: !0, data: e };
365
- }
366
- refine(n, t) {
367
- const e = new q(this.shape), s = e.validate.bind(e);
368
- return e.validate = (r) => {
369
- const i = s(r);
370
- if (!i.success) return i;
371
- const c = n(i.data);
372
- return c ? {
373
- success: !1,
374
- errors: [
375
- {
376
- message: c,
377
- path: t == null ? void 0 : t.path
378
- }
379
- ]
380
- } : { success: !0, data: i.data };
381
- }, e;
382
- }
383
- }
384
- const ve = () => new C(), ye = () => new S(), Le = (o) => new q(o);
385
- function ue(o) {
386
- return X((n) => {
387
- const t = [], e = () => t.forEach((r) => r());
388
- return o(({
389
- effect: r = "opaque",
390
- mode: i = "capturing",
391
- onClickOutside: c,
392
- onEscape: f,
393
- content: d,
394
- container: l = "body"
395
- }) => {
396
- l === "body" && (n = n.makePortal("body"));
397
- const u = re();
398
- u.onClosed(e);
399
- let y = () => {
400
- }, b = () => {
401
- };
402
- const h = (v) => {
403
- v.key === "Escape" && (f == null || f(), u.close());
404
- }, E = () => {
405
- c == null || c(), u.close();
406
- }, x = (v) => {
407
- y(), b(), v === "capturing" ? (document.addEventListener("keydown", h), y = () => document.removeEventListener("keydown", h), n.element.addEventListener("mousedown", E), b = () => n.element.removeEventListener("mousedown", E)) : (y = () => {
408
- }, b = () => {
409
- });
410
- }, a = U.on(i, x);
411
- t.push(a), t.push(() => {
412
- y(), b();
413
- });
414
- const A = Y((() => {
415
- var m, w;
416
- const v = /* @__PURE__ */ new Set();
417
- for (const g of n.element.querySelectorAll(
418
- ":scope > :not([data-overlay])"
419
- ))
420
- g.hasAttribute("inert") ? v.add(g) : g.setAttribute("inert", "");
421
- return t.push(() => {
422
- for (const g of n.element.querySelectorAll(
423
- ":scope > :not([data-overlay])"
424
- ))
425
- v.has(g) || g.removeAttribute("inert");
426
- v.clear();
427
- }), (w = (m = document.activeElement) == null ? void 0 : m.blur) == null || w.call(m), T.div(
428
- z((g) => u.setElement(g)),
429
- D.status(u.status.map(String)),
430
- D.overlay("true"),
431
- p.class(
432
- B(
433
- r ?? "opaque",
434
- i
435
- )(
436
- (g, _) => `bc-overlay bc-overlay--effect-${g} bc-overlay--mode-${_}`
437
- )
438
- ),
439
- d
440
- );
441
- })(), n.element, {
442
- disposeWithParent: !0,
443
- clear: !1,
444
- providers: n.providers
445
- });
446
- t.push(A), $(() => u.open());
447
- }, e);
448
- });
449
- }
450
- function le(o, n) {
451
- const {
452
- size: t = "md",
453
- dismissable: e = !0,
454
- showCloseButton: s = !0,
455
- onClose: r,
456
- overlayEffect: i = "opaque",
457
- container: c = "body",
458
- position: f = "center"
459
- } = o;
460
- return ue((d, l) => {
461
- let u = () => {
462
- };
463
- return n((h) => {
464
- u = l;
465
- const E = R("capturing");
466
- U.on(e, (m) => {
467
- E.set(m ? "capturing" : "non-capturing");
468
- });
469
- const x = B(
470
- h.header != null,
471
- s
472
- )((m, w) => m || w), a = te("modal"), L = `${a}-header`, A = `${a}-body`, v = T.div(
473
- p.class(
474
- B(
475
- t,
476
- f
477
- )(
478
- (m, w) => `bc-modal bc-modal--size-${m} bc-modal--container-${c} bc-modal--position-${w}`
479
- )
480
- ),
481
- // Essential ARIA attributes for modal dialog
482
- p.role("dialog"),
483
- M.modal(!0),
484
- ...h.header ? [M.labelledby(L)] : [],
485
- M.describedby(A),
486
- p.tabindex(-1),
487
- // Make modal focusable for initial focus
488
- p.id(a),
489
- D.focusTrap("true"),
490
- // Mark as focus trap container
491
- Z.mousedown((m) => m.stopPropagation()),
492
- // Prevent overlay click-outside when clicking modal content
493
- // Focus trap implementation
494
- F({
495
- escapeDeactivates: !1,
496
- // Let Overlay handle escape key
497
- initialFocus: () => {
498
- const m = document.getElementById(a);
499
- if (!m) return null;
500
- const w = m.querySelector(
501
- '[aria-label="Close modal"]'
502
- );
503
- if (w) return w;
504
- const g = m.querySelector(
505
- 'button, input, select, textarea, [tabindex]:not([tabindex="-1"])'
506
- );
507
- return g || m;
508
- }
509
- }),
510
- // Modal content container
511
- T.div(
512
- p.class("bc-modal__content"),
513
- // Header section
514
- I(
515
- x,
516
- () => T.div(
517
- p.class("bc-modal__header"),
518
- T.div(
519
- p.class("bu-font-semibold bu-text-gray"),
520
- ...h.header ? [p.id(L)] : [],
521
- h.header
522
- ),
523
- I(
524
- s,
525
- () => H(
526
- K,
527
- (m) => se({
528
- size: "sm",
529
- label: m.$.closeModal,
530
- onClick: () => {
531
- u(), l();
532
- }
533
- })
534
- )
535
- )
536
- )
537
- ),
538
- // Body section
539
- T.div(p.class("bc-modal__body"), p.id(A), h.body),
540
- // Footer section
541
- h.footer && T.div(p.class("bc-modal__footer"), h.footer)
542
- )
543
- );
544
- d({
545
- mode: E,
546
- effect: i ?? "opaque",
547
- container: c,
548
- content: v,
549
- onClickOutside: () => {
550
- r == null || r(), l();
551
- },
552
- onEscape: () => {
553
- r == null || r(), l();
554
- }
555
- });
556
- }, () => {
557
- u(), l();
558
- });
559
- });
560
- }
561
- function Ee(o, n) {
562
- const { confirmText: t, cancelText: e, onConfirm: s, onCancel: r, ...i } = o;
563
- return H(
564
- K,
565
- (c) => le({ showCloseButton: !1, ...i }, (f, d) => {
566
- const l = () => {
567
- s == null || s(), d();
568
- }, u = () => {
569
- r == null || r(), d();
570
- };
571
- return n((b) => {
572
- f({
573
- body: b,
574
- footer: ee(
575
- p.class("bu-justify-end"),
576
- P(
577
- {
578
- variant: "outline",
579
- onClick: u
580
- },
581
- O(e, c.$.cancel)
582
- ),
583
- P(
584
- {
585
- color: "primary",
586
- variant: "filled",
587
- onClick: l
588
- },
589
- O(t, c.$.confirm)
590
- )
591
- )
592
- });
593
- }, d);
594
- })
595
- );
596
- }
597
- export {
598
- be as A,
599
- S as B,
600
- Ee as C,
601
- F,
602
- le as M,
603
- ue as O,
604
- C as S,
605
- q as a,
606
- ye as b,
607
- oe as c,
608
- pe as d,
609
- N as e,
610
- ge as f,
611
- Le as o,
612
- ve as s,
613
- re as u
614
- };
@@ -1 +0,0 @@
1
- "use strict";var P=Object.defineProperty;var U=(i,n,t)=>n in i?P(i,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[n]=t;var V=(i,n,t)=>U(i,typeof n!="symbol"?n+"":n,t);const o=require("@tempots/dom"),C=require("./timer-CcMCjYrq.cjs"),k=require("./translations-EQ1qPZ0_.cjs"),z=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","details[open]"].join(", ");function R(i){return Array.from(i.querySelectorAll(z)).filter(n=>{const t=n;return t.offsetWidth>0&&t.offsetHeight>0&&!t.hasAttribute("inert")&&window.getComputedStyle(t).visibility!=="hidden"})}function $(i={}){const{active:n=!0,escapeDeactivates:t=!0,onEscape:e,initialFocus:s,returnFocus:r,clickOutsideDeactivates:c=!1,onClickOutside:l}=i;return o.WithElement(h=>{let m=n,d=null,u=[];typeof document<"u"&&(d=document.activeElement);const y=()=>{u=R(h)},b=a=>{var L,A;if(m){if(t&&a.key==="Escape"){a.preventDefault(),e==null||e();return}if(a.key==="Tab"){if(y(),u.length===0){a.preventDefault();return}const v=u.indexOf(document.activeElement);a.shiftKey?v<=0&&(a.preventDefault(),(L=u[u.length-1])==null||L.focus()):v>=u.length-1&&(a.preventDefault(),(A=u[0])==null||A.focus())}}},p=a=>{if(!m||!c)return;const L=a.target;h.contains(L)||l==null||l()},E=()=>{if(!m)return;y();let a=null;typeof s=="function"?a=s():s?a=s:u.length>0&&(a=u[0]),a&&setTimeout(()=>{a==null||a.focus()},50),document.addEventListener("keydown",b,!0),c&&document.addEventListener("click",p,!0)},x=()=>{m=!1,document.removeEventListener("keydown",b,!0),document.removeEventListener("click",p,!0);let a=null;typeof r=="function"?a=r():r?a=r:d&&(a=d),a&&document.body.contains(a)&&setTimeout(()=>{a==null||a.focus()},0)};return setTimeout(()=>E(),0),o.OnDispose(()=>{x()})})}function H(i={}){return{activate:()=>$({...i,active:!0}),deactivate:()=>$({...i,active:!1})}}function O({initialStatus:i="closed",openedAfter:n,closedAfter:t}){const e=o.prop(i),s=()=>{e.set("start-opening")},r=()=>{e.set("start-closing")},c=e.map(a=>a!=="closed"&&a!=="start-closing"&&a!=="closing"),l=a=>{a?s():r()},h=()=>{l(!c.value)},m=a=>e.on(L=>{L==="closed"&&a()});let d=()=>{};e.on(a=>{switch(d(),a){case"start-opening":d=C.w(()=>e.set("opening"));break;case"opening":d=n(()=>e.set("opened"));break;case"start-closing":d=C.w(()=>e.set("closing"));break;case"closing":d=t(()=>e.set("closed"));break}}),e.onDispose(()=>d());const u=e.map(a=>a==="closed"),y=e.map(a=>a==="start-opening"),b=e.map(a=>a==="opening"),p=e.map(a=>a==="opened"),E=e.map(a=>a==="closing"),x=e.map(a=>a==="start-closing");return{status:e,open:s,close:r,toggle:h,setOpen:l,display:c,isClosed:u,isStartOpening:y,isOpening:b,isOpened:p,isClosing:E,isStartClosing:x,dispose:()=>e.dispose(),onClosed:m}}function K({initialStatus:i="closed",duration:n,openDuration:t=n??500,closeDuration:e=n??500}={}){return O({initialStatus:i,openedAfter:s=>C.T(s,t),closedAfter:s=>C.T(s,e)})}function q(i,n){let t=!1,e=null;function s(){t||(t=!0,e&&(clearTimeout(e),e=null),n())}function r(m){m.target===i&&s()}function c(m){m.target===i&&s()}const l=()=>{if(typeof i.getAnimations>"u"){e=setTimeout(s,16);return}i.getAnimations().length===0?(i.addEventListener("transitionend",r,{once:!0}),i.addEventListener("animationend",c,{once:!0}),e=setTimeout(s,1e3)):(i.addEventListener("transitionend",r,{once:!0}),i.addEventListener("animationend",c,{once:!0}))},h=C.w(l);return()=>{t=!0,h(),e&&(clearTimeout(e),e=null),i.removeEventListener("transitionend",r),i.removeEventListener("animationend",c)}}function F({initialStatus:i="closed",element:n}={}){let t=n;return{setElement:e=>{t=e},...O({initialStatus:i,openedAfter:e=>t==null?(e(),()=>{}):q(t,e),closedAfter:e=>t==null?(e(),()=>{}):q(t,e)})}}function N(i,n){return o.attr.class(o.computedOf(i,n)((t,e)=>`bu-toggle--animated bu-toggle--${t} bu-toggle--${e}`))}function D(i){return{"~standard":{version:1,vendor:"beatui-custom",validate:t=>{const e=i.validate(t);return e.success?{value:e.data}:{issues:e.errors.map(s=>({message:s.message,path:s.path}))}},types:void 0},safeParse:t=>{const e=i.validate(t);return e.success?{success:!0,data:e.data}:{success:!1,error:{errors:e.errors.map(s=>{var r;return{message:s.message,path:((r=s.path)==null?void 0:r.map(c=>typeof c=="object"&&"key"in c?c.key.toString():c.toString()))||[]}})}}}}}class S{optional(){return new _(this)}default(n){return new G(this,n)}schema(){return D(this)}}class T extends S{constructor(){super(...arguments);V(this,"minLength");V(this,"maxLength");V(this,"pattern");V(this,"customValidations",[])}validate(t){if(typeof t!="string")return{success:!1,errors:[{message:"Expected string"}]};const e=[];this.minLength!==void 0&&t.length<this.minLength&&e.push({message:`Must be at least ${this.minLength} characters`}),this.maxLength!==void 0&&t.length>this.maxLength&&e.push({message:`Must be at most ${this.maxLength} characters`}),this.pattern&&!this.pattern.test(t)&&e.push({message:"Invalid format"});for(const s of this.customValidations){const r=s(t);r&&e.push({message:r})}return e.length>0?{success:!1,errors:e}:{success:!0,data:t}}min(t,e){const s=new T;return s.minLength=t,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations],e&&s.customValidations.push(r=>r.length<t?e:null),s}max(t,e){const s=new T;return s.minLength=this.minLength,s.maxLength=t,s.pattern=this.pattern,s.customValidations=[...this.customValidations],e&&s.customValidations.push(r=>r.length>t?e:null),s}regex(t,e){const s=new T;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=t,s.customValidations=[...this.customValidations],e&&s.customValidations.push(r=>t.test(r)?null:e),s}email(t="Please enter a valid email address"){const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,s=new T;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,r=>e.test(r)?null:t],s}refine(t){const e=new T;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations,t],e}}class B extends S{constructor(){super(...arguments);V(this,"mustBeTrue",!1);V(this,"trueMessage")}validate(t){return typeof t!="boolean"?{success:!1,errors:[{message:"Expected boolean"}]}:this.mustBeTrue&&t!==!0?{success:!1,errors:[{message:this.trueMessage||"Must be true"}]}:{success:!0,data:t}}refine(t,e){const s=new B;s.mustBeTrue=this.mustBeTrue,s.trueMessage=this.trueMessage;const r=s.validate.bind(s);return s.validate=c=>{const l=r(c);return l.success?t(l.data)?l:{success:!1,errors:[{message:e}]}:l},s}literal(t,e){const s=new B;return s.mustBeTrue=!0,s.trueMessage=e,s}}class _ extends S{constructor(n){super(),this.inner=n}validate(n){if(n===void 0)return{success:!0,data:void 0};const t=this.inner.validate(n);return t.success?{success:!0,data:t.data}:{success:!1,errors:t.errors}}}class G extends S{constructor(n,t){super(),this.inner=n,this.defaultValue=t}validate(n){return n===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(n)}}class M extends S{constructor(n){super(),this.shape=n}validate(n){if(typeof n!="object"||n===null||Array.isArray(n))return{success:!1,errors:[{message:"Expected object"}]};const t=n,e={},s=[];for(const[r,c]of Object.entries(this.shape)){const l=c.validate(t[r]);if(l.success)e[r]=l.data;else for(const h of l.errors)s.push({message:h.message,path:[r,...h.path||[]]})}return s.length>0?{success:!1,errors:s}:{success:!0,data:e}}refine(n,t){const e=new M(this.shape),s=e.validate.bind(e);return e.validate=r=>{const c=s(r);if(!c.success)return c;const l=n(c.data);return l?{success:!1,errors:[{message:l,path:t==null?void 0:t.path}]}:{success:!0,data:c.data}},e}}const J=()=>new T,Q=()=>new B,X=i=>new M(i);function I(i){return o.WithBrowserCtx(n=>{const t=[],e=()=>t.forEach(r=>r());return i(({effect:r="opaque",mode:c="capturing",onClickOutside:l,onEscape:h,content:m,container:d="body"})=>{d==="body"&&(n=n.makePortal("body"));const u=F();u.onClosed(e);let y=()=>{},b=()=>{};const p=v=>{v.key==="Escape"&&(h==null||h(),u.close())},E=()=>{l==null||l(),u.close()},x=v=>{y(),b(),v==="capturing"?(document.addEventListener("keydown",p),y=()=>document.removeEventListener("keydown",p),n.element.addEventListener("mousedown",E),b=()=>n.element.removeEventListener("mousedown",E)):(y=()=>{},b=()=>{})},a=o.Value.on(c,x);t.push(a),t.push(()=>{y(),b()});const L=()=>{var f,w;const v=new Set;for(const g of n.element.querySelectorAll(":scope > :not([data-overlay])"))g.hasAttribute("inert")?v.add(g):g.setAttribute("inert","");return t.push(()=>{for(const g of n.element.querySelectorAll(":scope > :not([data-overlay])"))v.has(g)||g.removeAttribute("inert");v.clear()}),(w=(f=document.activeElement)==null?void 0:f.blur)==null||w.call(f),o.html.div(o.WithElement(g=>u.setElement(g)),o.dataAttr.status(u.status.map(String)),o.dataAttr.overlay("true"),o.attr.class(o.computedOf(r??"opaque",c)((g,W)=>`bc-overlay bc-overlay--effect-${g} bc-overlay--mode-${W}`)),m)},A=o.render(L(),n.element,{disposeWithParent:!0,clear:!1,providers:n.providers});t.push(A),C.w(()=>u.open())},e)})}function j(i,n){const{size:t="md",dismissable:e=!0,showCloseButton:s=!0,onClose:r,overlayEffect:c="opaque",container:l="body",position:h="center"}=i;return I((m,d)=>{let u=()=>{};return n(p=>{u=d;const E=o.prop("capturing");o.Value.on(e,f=>{E.set(f?"capturing":"non-capturing")});const x=o.computedOf(p.header!=null,s)((f,w)=>f||w),a=k.sessionId("modal"),L=`${a}-header`,A=`${a}-body`,v=o.html.div(o.attr.class(o.computedOf(t,h)((f,w)=>`bc-modal bc-modal--size-${f} bc-modal--container-${l} bc-modal--position-${w}`)),o.attr.role("dialog"),o.aria.modal(!0),...p.header?[o.aria.labelledby(L)]:[],o.aria.describedby(A),o.attr.tabindex(-1),o.attr.id(a),o.dataAttr.focusTrap("true"),o.on.mousedown(f=>f.stopPropagation()),$({escapeDeactivates:!1,initialFocus:()=>{const f=document.getElementById(a);if(!f)return null;const w=f.querySelector('[aria-label="Close modal"]');if(w)return w;const g=f.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return g||f}}),o.html.div(o.attr.class("bc-modal__content"),o.When(x,()=>o.html.div(o.attr.class("bc-modal__header"),o.html.div(o.attr.class("bu-font-semibold bu-text-gray"),...p.header?[o.attr.id(L)]:[],p.header),o.When(s,()=>o.Use(k.BeatUII18n,f=>k.CloseButton({size:"sm",label:f.$.closeModal,onClick:()=>{u(),d()}}))))),o.html.div(o.attr.class("bc-modal__body"),o.attr.id(A),p.body),p.footer&&o.html.div(o.attr.class("bc-modal__footer"),p.footer)));m({mode:E,effect:c??"opaque",container:l,content:v,onClickOutside:()=>{r==null||r(),d()},onEscape:()=>{r==null||r(),d()}})},()=>{u(),d()})})}function Y(i,n){const{confirmText:t,cancelText:e,onConfirm:s,onCancel:r,...c}=i;return o.Use(k.BeatUII18n,l=>j({showCloseButton:!1,...c},(h,m)=>{const d=()=>{s==null||s(),m()},u=()=>{r==null||r(),m()};return n(b=>{h({body:b,footer:o.Fragment(o.attr.class("bu-justify-end"),k.Button({variant:"outline",onClick:u},o.coalesce(e,l.$.cancel)),k.Button({color:"primary",variant:"filled",onClick:d},o.coalesce(t,l.$.confirm)))})},m)}))}exports.AnimatedToggleClass=N;exports.BooleanValidator=B;exports.ConfirmModal=Y;exports.FocusTrap=$;exports.Modal=j;exports.ObjectValidator=M;exports.Overlay=I;exports.StringValidator=T;exports.boolean=Q;exports.createStandardSchema=D;exports.object=X;exports.string=J;exports.useAnimatedElementToggle=F;exports.useAnimatedToggle=O;exports.useFocusTrap=H;exports.useTimedToggle=K;