@tempots/beatui 0.38.0 → 0.40.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.
- package/dist/{2019-DxwU2aOm.cjs → 2019-nWH_nAwT.cjs} +1 -1
- package/dist/{2019-CGWicU9n.js → 2019-sCKLAY8c.js} +2 -2
- package/dist/{2020-BRNvbMGL.js → 2020-B4xCW_nu.js} +2 -2
- package/dist/{2020-DHep9dU6.cjs → 2020-D7RWX09D.cjs} +1 -1
- package/dist/{ar-CqAHPRKu.cjs → ar-D_4BfIJO.cjs} +1 -1
- package/dist/{ar-avevuYiW.js → ar-i2uHmy8P.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +54 -49
- package/dist/beatui.css +463 -59
- package/dist/beatui.tailwind.css +463 -59
- package/dist/{de--4OtRESW.cjs → de-C0PZz9sE.cjs} +1 -1
- package/dist/{de-Cz7ah611.js → de-CeLwmVZz.js} +1 -1
- package/dist/{es-CE1wRgxl.cjs → es-C8qT1ins.cjs} +1 -1
- package/dist/{es-CiNQQzF1.js → es-DxOgARww.js} +1 -1
- package/dist/{fa-Gkt0b9XN.js → fa-B9pEff8A.js} +1 -1
- package/dist/{fa-DjuJZNLK.cjs → fa-BFV9MxMX.cjs} +1 -1
- package/dist/{fr-DotyzMGL.cjs → fr-BBx5IJ7G.cjs} +1 -1
- package/dist/{fr-xM9p9Q6G.js → fr-Caeevx56.js} +1 -1
- package/dist/{he-BQ6ygVEQ.cjs → he-CMOvd4Dr.cjs} +1 -1
- package/dist/{he-CoO6PsiS.js → he-DeN-WW3u.js} +1 -1
- package/dist/{hi-DA3-4Cdo.js → hi-Dey2HxiD.js} +1 -1
- package/dist/{hi-BCfJ0mRh.cjs → hi-IOU_PzvH.cjs} +1 -1
- package/dist/{index-CesoPnvj.cjs → index-B-SyWyCc.cjs} +1 -1
- package/dist/{index-DJJ67-RV.js → index-B-pudlMv.js} +58 -58
- package/dist/{index-Dtqe3URb.cjs → index-B0ff5lT-.cjs} +4 -4
- package/dist/{index-i9pAnFtS.js → index-BTZqW3-b.js} +1245 -1232
- package/dist/{index-C5-BM51Y.cjs → index-C2VAPX2b.cjs} +1 -1
- package/dist/{index-DjShJtXp.js → index-CAeOFdez.js} +1 -1
- package/dist/{index-BI5w0jSz.js → index-CBT2SLat.js} +224 -223
- package/dist/{index-Bv2gn_kV.cjs → index-ClFVnBUS.cjs} +3 -3
- package/dist/{index-CCu0qfNP.cjs → index-D8fg48Fv.cjs} +1 -1
- package/dist/{index-C_nSdynJ.js → index-DJqo6Guq.js} +1 -1
- package/dist/{index-CZQHL_pf.cjs → index-Dtka01mK.cjs} +12 -12
- package/dist/{index-C2rz3G1d.js → index-HqWBd-jW.js} +680 -677
- package/dist/{index-D41aREgo.js → index-IQ3lRaL0.js} +1 -1
- package/dist/{index-CKyH3jwP.cjs → index-KPHFBjQB.cjs} +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +3349 -3064
- package/dist/{it-EdPuWBJR.js → it-DghnQdZa.js} +1 -1
- package/dist/{it-pv2Gm3jb.cjs → it-uQF0jkDT.cjs} +1 -1
- package/dist/{ja-CuRaPMgh.cjs → ja-BJD6uPbl.cjs} +1 -1
- package/dist/{ja-BSRCR430.js → ja-Kb7rxmFg.js} +1 -1
- package/dist/json-schema/index.cjs.js +1 -1
- package/dist/json-schema/index.es.js +1 -1
- package/dist/{ko-Dm4oD1fh.js → ko-53o5WJ-v.js} +1 -1
- package/dist/{ko-C7YP1PL4.cjs → ko-B7bLdRnp.cjs} +1 -1
- package/dist/markdown/index.cjs.js +1 -1
- package/dist/markdown/index.es.js +1 -1
- package/dist/modal-BRUgTJG9.cjs +1 -0
- package/dist/modal-_2B8vIo0.js +658 -0
- package/dist/{nl-ClCD6lP-.cjs → nl-CJE0fC8g.cjs} +1 -1
- package/dist/{nl-B0l1kdfd.js → nl-DvUVT7xd.js} +1 -1
- package/dist/{notice-BuYqG6zM.js → notice-C4n5jXi6.js} +408 -391
- package/dist/notice-CncwkUTy.cjs +2 -0
- package/dist/{pl-DVKneBSY.js → pl-C3oYeTwf.js} +1 -1
- package/dist/{pl-fyCkqVrr.cjs → pl-DUaY5slY.cjs} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/{pt-BHExG3lf.cjs → pt-BAqNKCuy.cjs} +1 -1
- package/dist/{pt-Bw0sTDOX.js → pt-BJGeScun.js} +1 -1
- package/dist/{ru-B26VQ4f9.js → ru-2irv1YXp.js} +1 -1
- package/dist/{ru-PuEOLDw1.cjs → ru-CAlgJm3K.cjs} +1 -1
- package/dist/tailwind/index.cjs.js +1 -1
- package/dist/tailwind/index.es.js +1 -1
- package/dist/tailwind/preset.cjs.js +1 -1
- package/dist/tailwind/preset.es.js +1 -1
- package/dist/tailwind/vite-plugin.cjs.js +1 -1
- package/dist/tailwind/vite-plugin.es.js +1 -1
- package/dist/{toolbar-kwkvH3nX.cjs → toolbar-B7HrL0vD.cjs} +1 -1
- package/dist/{toolbar-ClJbaKID.js → toolbar-CVDXVnje.js} +1 -1
- package/dist/{tr-DQMivdvy.js → tr-CkHLE5u7.js} +1 -1
- package/dist/{tr-CI97fTpD.cjs → tr-DMiXAhok.cjs} +1 -1
- package/dist/{translations-iam7PITs.js → translations-DEEflRUY.js} +96 -112
- package/dist/{translations-ZB5oDFId.cjs → translations-DRNj0YIi.cjs} +1 -1
- package/dist/translations-Dw1oO6Dh.cjs +1 -0
- package/dist/{translations-1yD6Rm5l.js → translations-Q5C5LyIi.js} +1 -1
- package/dist/types/components/beatui.d.ts +4 -1
- package/dist/types/components/button/button.d.ts +4 -3
- package/dist/types/components/form/input/input-wrapper.d.ts +2 -1
- package/dist/types/components/misc/index.d.ts +4 -0
- package/dist/types/components/misc/notification-provider.d.ts +47 -0
- package/dist/types/components/misc/notification.d.ts +17 -0
- package/dist/types/components/misc/opengraph.d.ts +111 -0
- package/dist/types/components/navigation/link/button-link.d.ts +2 -0
- package/dist/types/components/overlay/lightbox.d.ts +1 -1
- package/dist/types/components/overlay/modal.d.ts +2 -2
- package/dist/types/components/overlay/ribbon.d.ts +2 -2
- package/dist/types/utils/use-animated-toggle.d.ts +43 -9
- package/dist/{ur-B3CiO8KH.cjs → ur-BjiNs3SL.cjs} +1 -1
- package/dist/{ur-o3rog5MJ.js → ur-bxBR_9Z-.js} +1 -1
- package/dist/{utils-B_QSuN66.js → utils-BCbc19N0.js} +202 -193
- package/dist/utils-BJZipnfW.cjs +1 -0
- package/dist/{vi-FibsLfdk.cjs → vi-CByOZvV2.cjs} +1 -1
- package/dist/{vi-C7cb2K_B.js → vi-CKknZqol.js} +1 -1
- package/dist/{zh-BtSj_Euh.cjs → zh-C0QOebEA.cjs} +1 -1
- package/dist/{zh-NGrfqAHM.js → zh-CmUgcP9o.js} +1 -1
- package/package.json +4 -3
- package/dist/modal--1g8Y5LH.js +0 -601
- package/dist/modal-mA_AFUCI.cjs +0 -1
- package/dist/notice-DCuZEAQO.cjs +0 -2
- package/dist/translations-DQxg-W9w.cjs +0 -1
- package/dist/utils-BD6NGV1v.cjs +0 -1
package/dist/modal--1g8Y5LH.js
DELETED
|
@@ -1,601 +0,0 @@
|
|
|
1
|
-
import { WithElement as P, OnDispose as K, prop as W, attr as h, computedOf as A, WithBrowserCtx as N, Value as z, render as G, html as k, dataAttr as O, aria as F, on as J, When as D, Use as R, Fragment as Q, coalesce as q } from "@tempots/dom";
|
|
2
|
-
import { g as V, T as I } from "./timer-DzWb416P.js";
|
|
3
|
-
import { s as X, C as Y } from "./notice-BuYqG6zM.js";
|
|
4
|
-
import { a as U, B as j } from "./translations-iam7PITs.js";
|
|
5
|
-
const Z = [
|
|
6
|
-
"a[href]",
|
|
7
|
-
"button:not([disabled])",
|
|
8
|
-
"input:not([disabled])",
|
|
9
|
-
"select:not([disabled])",
|
|
10
|
-
"textarea:not([disabled])",
|
|
11
|
-
'[tabindex]:not([tabindex="-1"])',
|
|
12
|
-
'[contenteditable="true"]',
|
|
13
|
-
"audio[controls]",
|
|
14
|
-
"video[controls]",
|
|
15
|
-
"details > summary:first-of-type",
|
|
16
|
-
"details[open]"
|
|
17
|
-
].join(", ");
|
|
18
|
-
function ee(a) {
|
|
19
|
-
return Array.from(a.querySelectorAll(Z)).filter(
|
|
20
|
-
(t) => {
|
|
21
|
-
const s = t;
|
|
22
|
-
return s.offsetWidth > 0 && s.offsetHeight > 0 && !s.hasAttribute("inert") && window.getComputedStyle(s).visibility !== "hidden";
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
function $(a = {}) {
|
|
27
|
-
const {
|
|
28
|
-
active: t = !0,
|
|
29
|
-
escapeDeactivates: s = !0,
|
|
30
|
-
onEscape: e,
|
|
31
|
-
initialFocus: o,
|
|
32
|
-
returnFocus: r,
|
|
33
|
-
clickOutsideDeactivates: i = !1,
|
|
34
|
-
onClickOutside: u
|
|
35
|
-
} = a;
|
|
36
|
-
return P((f) => {
|
|
37
|
-
let m = t, d = null, l = [];
|
|
38
|
-
typeof document < "u" && (d = document.activeElement);
|
|
39
|
-
const b = () => {
|
|
40
|
-
l = ee(f);
|
|
41
|
-
}, g = (n) => {
|
|
42
|
-
if (m) {
|
|
43
|
-
if (s && n.key === "Escape") {
|
|
44
|
-
n.preventDefault(), e?.();
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (n.key === "Tab") {
|
|
48
|
-
if (b(), l.length === 0) {
|
|
49
|
-
n.preventDefault();
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const v = l.indexOf(
|
|
53
|
-
document.activeElement
|
|
54
|
-
);
|
|
55
|
-
n.shiftKey ? v <= 0 && (n.preventDefault(), l[l.length - 1]?.focus()) : v >= l.length - 1 && (n.preventDefault(), l[0]?.focus());
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}, p = (n) => {
|
|
59
|
-
if (!m || !i) return;
|
|
60
|
-
const v = n.target;
|
|
61
|
-
f.contains(v) || u?.();
|
|
62
|
-
}, y = () => {
|
|
63
|
-
if (!m) return;
|
|
64
|
-
b();
|
|
65
|
-
let n = null;
|
|
66
|
-
typeof o == "function" ? n = o() : o ? n = o : l.length > 0 && (n = l[0]), n && setTimeout(() => {
|
|
67
|
-
n?.focus();
|
|
68
|
-
}, 50), document.addEventListener("keydown", g, !0), i && document.addEventListener("click", p, !0);
|
|
69
|
-
}, C = () => {
|
|
70
|
-
m = !1, document.removeEventListener("keydown", g, !0), document.removeEventListener("click", p, !0);
|
|
71
|
-
let n = null;
|
|
72
|
-
typeof r == "function" ? n = r() : r ? n = r : d && (n = d), n && document.body.contains(n) && setTimeout(() => {
|
|
73
|
-
n?.focus();
|
|
74
|
-
}, 0);
|
|
75
|
-
};
|
|
76
|
-
return setTimeout(() => y(), 0), K(() => {
|
|
77
|
-
C();
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
function de(a = {}) {
|
|
82
|
-
return {
|
|
83
|
-
activate: () => $({ ...a, active: !0 }),
|
|
84
|
-
deactivate: () => $({ ...a, active: !1 })
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function H({
|
|
88
|
-
initialStatus: a = "closed",
|
|
89
|
-
openedAfter: t,
|
|
90
|
-
closedAfter: s
|
|
91
|
-
}) {
|
|
92
|
-
const e = W(a), o = () => {
|
|
93
|
-
e.set("start-opening");
|
|
94
|
-
}, r = () => {
|
|
95
|
-
e.set("start-closing");
|
|
96
|
-
}, i = e.map(
|
|
97
|
-
(n) => n !== "closed" && n !== "start-closing" && n !== "closing"
|
|
98
|
-
), u = (n) => {
|
|
99
|
-
n ? o() : r();
|
|
100
|
-
}, f = () => {
|
|
101
|
-
u(!i.value);
|
|
102
|
-
}, m = (n) => e.on((v) => {
|
|
103
|
-
v === "closed" && n();
|
|
104
|
-
});
|
|
105
|
-
let d = () => {
|
|
106
|
-
};
|
|
107
|
-
e.on((n) => {
|
|
108
|
-
switch (d(), n) {
|
|
109
|
-
case "start-opening":
|
|
110
|
-
d = V(() => e.set("opening"));
|
|
111
|
-
break;
|
|
112
|
-
case "opening":
|
|
113
|
-
d = t(() => e.set("opened"));
|
|
114
|
-
break;
|
|
115
|
-
case "start-closing":
|
|
116
|
-
d = V(() => e.set("closing"));
|
|
117
|
-
break;
|
|
118
|
-
case "closing":
|
|
119
|
-
d = s(() => e.set("closed"));
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
}), e.onDispose(() => d());
|
|
123
|
-
const l = e.map((n) => n === "closed"), b = e.map((n) => n === "start-opening"), g = e.map((n) => n === "opening"), p = e.map((n) => n === "opened"), y = e.map((n) => n === "closing"), C = e.map((n) => n === "start-closing");
|
|
124
|
-
return {
|
|
125
|
-
status: e,
|
|
126
|
-
open: o,
|
|
127
|
-
close: r,
|
|
128
|
-
toggle: f,
|
|
129
|
-
setOpen: u,
|
|
130
|
-
display: i,
|
|
131
|
-
isClosed: l,
|
|
132
|
-
isStartOpening: b,
|
|
133
|
-
isOpening: g,
|
|
134
|
-
isOpened: p,
|
|
135
|
-
isClosing: y,
|
|
136
|
-
isStartClosing: C,
|
|
137
|
-
dispose: () => e.dispose(),
|
|
138
|
-
onClosed: m
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function me({
|
|
142
|
-
initialStatus: a = "closed",
|
|
143
|
-
duration: t,
|
|
144
|
-
openDuration: s = t ?? 500,
|
|
145
|
-
closeDuration: e = t ?? 500
|
|
146
|
-
} = {}) {
|
|
147
|
-
return H({
|
|
148
|
-
initialStatus: a,
|
|
149
|
-
openedAfter: (o) => I(o, s),
|
|
150
|
-
closedAfter: (o) => I(o, e)
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function _(a, t) {
|
|
154
|
-
let s = !1, e = null;
|
|
155
|
-
function o() {
|
|
156
|
-
s || (s = !0, e && (clearTimeout(e), e = null), t());
|
|
157
|
-
}
|
|
158
|
-
function r(m) {
|
|
159
|
-
m.target === a && o();
|
|
160
|
-
}
|
|
161
|
-
function i(m) {
|
|
162
|
-
m.target === a && o();
|
|
163
|
-
}
|
|
164
|
-
const f = V(() => {
|
|
165
|
-
if (typeof a.getAnimations > "u") {
|
|
166
|
-
e = setTimeout(o, 16);
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
a.getAnimations().length === 0 ? (a.addEventListener("transitionend", r, { once: !0 }), a.addEventListener("animationend", i, { once: !0 }), e = setTimeout(o, 1e3)) : (a.addEventListener("transitionend", r, { once: !0 }), a.addEventListener("animationend", i, { once: !0 }));
|
|
170
|
-
});
|
|
171
|
-
return () => {
|
|
172
|
-
s = !0, f(), e && (clearTimeout(e), e = null), a.removeEventListener("transitionend", r), a.removeEventListener("animationend", i);
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
function te({
|
|
176
|
-
initialStatus: a = "closed",
|
|
177
|
-
element: t
|
|
178
|
-
} = {}) {
|
|
179
|
-
let s = t;
|
|
180
|
-
return {
|
|
181
|
-
setElement: (e) => {
|
|
182
|
-
s = e;
|
|
183
|
-
},
|
|
184
|
-
...H({
|
|
185
|
-
initialStatus: a,
|
|
186
|
-
openedAfter: (e) => s == null ? (e(), () => {
|
|
187
|
-
}) : _(s, e),
|
|
188
|
-
closedAfter: (e) => s == null ? (e(), () => {
|
|
189
|
-
}) : _(s, e)
|
|
190
|
-
})
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
function fe(a, t) {
|
|
194
|
-
return h.class(
|
|
195
|
-
A(
|
|
196
|
-
a,
|
|
197
|
-
t
|
|
198
|
-
)((s, e) => `bc-toggle--animated bc-toggle--${s} bc-toggle--${e}`)
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
function se(a) {
|
|
202
|
-
return {
|
|
203
|
-
"~standard": {
|
|
204
|
-
version: 1,
|
|
205
|
-
vendor: "beatui-custom",
|
|
206
|
-
validate: (s) => {
|
|
207
|
-
const e = a.validate(s);
|
|
208
|
-
return e.success ? { value: e.data } : {
|
|
209
|
-
issues: e.errors.map((o) => ({
|
|
210
|
-
message: o.message,
|
|
211
|
-
path: o.path
|
|
212
|
-
}))
|
|
213
|
-
};
|
|
214
|
-
},
|
|
215
|
-
types: void 0
|
|
216
|
-
},
|
|
217
|
-
safeParse: (s) => {
|
|
218
|
-
const e = a.validate(s);
|
|
219
|
-
return e.success ? { success: !0, data: e.data } : {
|
|
220
|
-
success: !1,
|
|
221
|
-
error: {
|
|
222
|
-
errors: e.errors.map((o) => ({
|
|
223
|
-
message: o.message,
|
|
224
|
-
path: o.path?.map(
|
|
225
|
-
(r) => typeof r == "object" && "key" in r ? r.key.toString() : r.toString()
|
|
226
|
-
) || []
|
|
227
|
-
}))
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
class x {
|
|
234
|
-
optional() {
|
|
235
|
-
return new ne(this);
|
|
236
|
-
}
|
|
237
|
-
default(t) {
|
|
238
|
-
return new oe(this, t);
|
|
239
|
-
}
|
|
240
|
-
schema() {
|
|
241
|
-
return se(this);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
class w extends x {
|
|
245
|
-
minLength;
|
|
246
|
-
maxLength;
|
|
247
|
-
pattern;
|
|
248
|
-
customValidations = [];
|
|
249
|
-
validate(t) {
|
|
250
|
-
if (typeof t != "string")
|
|
251
|
-
return { success: !1, errors: [{ message: "Expected string" }] };
|
|
252
|
-
const s = [];
|
|
253
|
-
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" });
|
|
254
|
-
for (const e of this.customValidations) {
|
|
255
|
-
const o = e(t);
|
|
256
|
-
o && s.push({ message: o });
|
|
257
|
-
}
|
|
258
|
-
return s.length > 0 ? { success: !1, errors: s } : { success: !0, data: t };
|
|
259
|
-
}
|
|
260
|
-
min(t, s) {
|
|
261
|
-
const e = new w();
|
|
262
|
-
return e.minLength = t, e.maxLength = this.maxLength, e.pattern = this.pattern, e.customValidations = [...this.customValidations], s && e.customValidations.push(
|
|
263
|
-
(o) => o.length < t ? s : null
|
|
264
|
-
), e;
|
|
265
|
-
}
|
|
266
|
-
max(t, s) {
|
|
267
|
-
const e = new w();
|
|
268
|
-
return e.minLength = this.minLength, e.maxLength = t, e.pattern = this.pattern, e.customValidations = [...this.customValidations], s && e.customValidations.push(
|
|
269
|
-
(o) => o.length > t ? s : null
|
|
270
|
-
), e;
|
|
271
|
-
}
|
|
272
|
-
regex(t, s) {
|
|
273
|
-
const e = new w();
|
|
274
|
-
return e.minLength = this.minLength, e.maxLength = this.maxLength, e.pattern = t, e.customValidations = [...this.customValidations], s && e.customValidations.push(
|
|
275
|
-
(o) => t.test(o) ? null : s
|
|
276
|
-
), e;
|
|
277
|
-
}
|
|
278
|
-
email(t = "Please enter a valid email address") {
|
|
279
|
-
const s = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, e = new w();
|
|
280
|
-
return e.minLength = this.minLength, e.maxLength = this.maxLength, e.pattern = this.pattern, e.customValidations = [
|
|
281
|
-
...this.customValidations,
|
|
282
|
-
(o) => s.test(o) ? null : t
|
|
283
|
-
], e;
|
|
284
|
-
}
|
|
285
|
-
refine(t) {
|
|
286
|
-
const s = new w();
|
|
287
|
-
return s.minLength = this.minLength, s.maxLength = this.maxLength, s.pattern = this.pattern, s.customValidations = [...this.customValidations, t], s;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
class B extends x {
|
|
291
|
-
mustBeTrue = !1;
|
|
292
|
-
trueMessage;
|
|
293
|
-
validate(t) {
|
|
294
|
-
return typeof t != "boolean" ? { success: !1, errors: [{ message: "Expected boolean" }] } : this.mustBeTrue && t !== !0 ? {
|
|
295
|
-
success: !1,
|
|
296
|
-
errors: [{ message: this.trueMessage || "Must be true" }]
|
|
297
|
-
} : { success: !0, data: t };
|
|
298
|
-
}
|
|
299
|
-
refine(t, s) {
|
|
300
|
-
const e = new B();
|
|
301
|
-
e.mustBeTrue = this.mustBeTrue, e.trueMessage = this.trueMessage;
|
|
302
|
-
const o = e.validate.bind(e);
|
|
303
|
-
return e.validate = (r) => {
|
|
304
|
-
const i = o(r);
|
|
305
|
-
return i.success ? t(i.data) ? i : { success: !1, errors: [{ message: s }] } : i;
|
|
306
|
-
}, e;
|
|
307
|
-
}
|
|
308
|
-
literal(t, s) {
|
|
309
|
-
const e = new B();
|
|
310
|
-
return e.mustBeTrue = !0, e.trueMessage = s, e;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
class ne extends x {
|
|
314
|
-
constructor(t) {
|
|
315
|
-
super(), this.inner = t;
|
|
316
|
-
}
|
|
317
|
-
validate(t) {
|
|
318
|
-
if (t === void 0)
|
|
319
|
-
return { success: !0, data: void 0 };
|
|
320
|
-
const s = this.inner.validate(t);
|
|
321
|
-
return s.success ? { success: !0, data: s.data } : { success: !1, errors: s.errors };
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
class oe extends x {
|
|
325
|
-
constructor(t, s) {
|
|
326
|
-
super(), this.inner = t, this.defaultValue = s;
|
|
327
|
-
}
|
|
328
|
-
validate(t) {
|
|
329
|
-
return t === void 0 ? { success: !0, data: this.defaultValue } : this.inner.validate(t);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
class S extends x {
|
|
333
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
334
|
-
constructor(t) {
|
|
335
|
-
super(), this.shape = t;
|
|
336
|
-
}
|
|
337
|
-
validate(t) {
|
|
338
|
-
if (typeof t != "object" || t === null || Array.isArray(t))
|
|
339
|
-
return { success: !1, errors: [{ message: "Expected object" }] };
|
|
340
|
-
const s = t, e = {}, o = [];
|
|
341
|
-
for (const [r, i] of Object.entries(this.shape)) {
|
|
342
|
-
const u = i.validate(s[r]);
|
|
343
|
-
if (u.success)
|
|
344
|
-
e[r] = u.data;
|
|
345
|
-
else
|
|
346
|
-
for (const f of u.errors)
|
|
347
|
-
o.push({
|
|
348
|
-
message: f.message,
|
|
349
|
-
path: [r, ...f.path || []]
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
return o.length > 0 ? { success: !1, errors: o } : { success: !0, data: e };
|
|
353
|
-
}
|
|
354
|
-
refine(t, s) {
|
|
355
|
-
const e = new S(this.shape), o = e.validate.bind(e);
|
|
356
|
-
return e.validate = (r) => {
|
|
357
|
-
const i = o(r);
|
|
358
|
-
if (!i.success) return i;
|
|
359
|
-
const u = t(i.data);
|
|
360
|
-
return u ? {
|
|
361
|
-
success: !1,
|
|
362
|
-
errors: [
|
|
363
|
-
{
|
|
364
|
-
message: u,
|
|
365
|
-
path: s?.path
|
|
366
|
-
}
|
|
367
|
-
]
|
|
368
|
-
} : { success: !0, data: i.data };
|
|
369
|
-
}, e;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
const pe = () => new w(), he = () => new B(), ge = (a) => new S(a);
|
|
373
|
-
function ae(a) {
|
|
374
|
-
return N((t) => {
|
|
375
|
-
const s = [], e = () => s.forEach((r) => r());
|
|
376
|
-
return a(({
|
|
377
|
-
effect: r = "opaque",
|
|
378
|
-
mode: i = "capturing",
|
|
379
|
-
onClickOutside: u,
|
|
380
|
-
onEscape: f,
|
|
381
|
-
content: m,
|
|
382
|
-
container: d = "body"
|
|
383
|
-
}) => {
|
|
384
|
-
d === "body" && (t = t.makePortal("body"));
|
|
385
|
-
const l = te();
|
|
386
|
-
l.onClosed(e);
|
|
387
|
-
let b = () => {
|
|
388
|
-
}, g = () => {
|
|
389
|
-
};
|
|
390
|
-
const p = (E) => {
|
|
391
|
-
E.key === "Escape" && (f?.(), l.close());
|
|
392
|
-
}, y = () => {
|
|
393
|
-
u?.(), l.close();
|
|
394
|
-
}, C = (E) => {
|
|
395
|
-
b(), g(), E === "capturing" ? (document.addEventListener("keydown", p), b = () => document.removeEventListener("keydown", p), t.element.addEventListener("mousedown", y), g = () => t.element.removeEventListener("mousedown", y)) : (b = () => {
|
|
396
|
-
}, g = () => {
|
|
397
|
-
});
|
|
398
|
-
}, n = z.on(i, C);
|
|
399
|
-
s.push(n), s.push(() => {
|
|
400
|
-
b(), g();
|
|
401
|
-
});
|
|
402
|
-
const T = G((() => {
|
|
403
|
-
const E = /* @__PURE__ */ new Set();
|
|
404
|
-
for (const c of t.element.querySelectorAll(
|
|
405
|
-
":scope > :not([data-overlay])"
|
|
406
|
-
))
|
|
407
|
-
c.hasAttribute("inert") ? E.add(c) : c.setAttribute("inert", "");
|
|
408
|
-
return s.push(() => {
|
|
409
|
-
for (const c of t.element.querySelectorAll(
|
|
410
|
-
":scope > :not([data-overlay])"
|
|
411
|
-
))
|
|
412
|
-
E.has(c) || c.removeAttribute("inert");
|
|
413
|
-
E.clear();
|
|
414
|
-
}), document.activeElement?.blur?.(), k.div(
|
|
415
|
-
P((c) => l.setElement(c)),
|
|
416
|
-
O.status(l.status.map(String)),
|
|
417
|
-
O.overlay("true"),
|
|
418
|
-
h.class(
|
|
419
|
-
A(
|
|
420
|
-
r ?? "opaque",
|
|
421
|
-
i
|
|
422
|
-
)(
|
|
423
|
-
(c, L) => `bc-overlay bc-overlay--effect-${c} bc-overlay--mode-${L}`
|
|
424
|
-
)
|
|
425
|
-
),
|
|
426
|
-
m
|
|
427
|
-
);
|
|
428
|
-
})(), t.element, {
|
|
429
|
-
disposeWithParent: !0,
|
|
430
|
-
clear: !1,
|
|
431
|
-
providers: t.providers
|
|
432
|
-
});
|
|
433
|
-
s.push(T), V(() => l.open());
|
|
434
|
-
}, e);
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
function re(a, t) {
|
|
438
|
-
const {
|
|
439
|
-
size: s = "md",
|
|
440
|
-
dismissable: e = !0,
|
|
441
|
-
showCloseButton: o = !0,
|
|
442
|
-
onClose: r,
|
|
443
|
-
overlayEffect: i = "opaque",
|
|
444
|
-
container: u = "body",
|
|
445
|
-
position: f = "center"
|
|
446
|
-
} = a;
|
|
447
|
-
return ae((m, d) => {
|
|
448
|
-
let l = () => {
|
|
449
|
-
};
|
|
450
|
-
return t((p) => {
|
|
451
|
-
l = d;
|
|
452
|
-
const y = W("capturing");
|
|
453
|
-
z.on(e, (c) => {
|
|
454
|
-
y.set(c ? "capturing" : "non-capturing");
|
|
455
|
-
});
|
|
456
|
-
const C = A(
|
|
457
|
-
p.header != null,
|
|
458
|
-
o
|
|
459
|
-
)((c, L) => c || L), n = X("modal"), v = `${n}-header`, T = `${n}-body`, E = k.div(
|
|
460
|
-
h.class(
|
|
461
|
-
A(
|
|
462
|
-
s,
|
|
463
|
-
f
|
|
464
|
-
)(
|
|
465
|
-
(c, L) => `bc-modal bc-modal--size-${c} bc-modal--container-${u} bc-modal--position-${L}`
|
|
466
|
-
)
|
|
467
|
-
),
|
|
468
|
-
// Essential ARIA attributes for modal dialog
|
|
469
|
-
h.role("dialog"),
|
|
470
|
-
F.modal(!0),
|
|
471
|
-
...p.header ? [F.labelledby(v)] : [],
|
|
472
|
-
F.describedby(T),
|
|
473
|
-
h.tabindex(-1),
|
|
474
|
-
// Make modal focusable for initial focus
|
|
475
|
-
h.id(n),
|
|
476
|
-
O.focusTrap("true"),
|
|
477
|
-
// Mark as focus trap container
|
|
478
|
-
J.mousedown((c) => c.stopPropagation()),
|
|
479
|
-
// Prevent overlay click-outside when clicking modal content
|
|
480
|
-
// Focus trap implementation
|
|
481
|
-
$({
|
|
482
|
-
escapeDeactivates: !1,
|
|
483
|
-
// Let Overlay handle escape key
|
|
484
|
-
initialFocus: () => {
|
|
485
|
-
const c = document.getElementById(n);
|
|
486
|
-
if (!c) return null;
|
|
487
|
-
const L = c.querySelector(
|
|
488
|
-
'[aria-label="Close modal"]'
|
|
489
|
-
);
|
|
490
|
-
if (L) return L;
|
|
491
|
-
const M = c.querySelector(
|
|
492
|
-
'button, input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
493
|
-
);
|
|
494
|
-
return M || c;
|
|
495
|
-
}
|
|
496
|
-
}),
|
|
497
|
-
// Modal content container
|
|
498
|
-
k.div(
|
|
499
|
-
h.class("bc-modal__content"),
|
|
500
|
-
// Header section
|
|
501
|
-
D(
|
|
502
|
-
C,
|
|
503
|
-
() => k.div(
|
|
504
|
-
h.class("bc-modal__header"),
|
|
505
|
-
k.div(
|
|
506
|
-
h.class("bc-modal__title"),
|
|
507
|
-
...p.header ? [h.id(v)] : [],
|
|
508
|
-
p.header
|
|
509
|
-
),
|
|
510
|
-
D(
|
|
511
|
-
o,
|
|
512
|
-
() => R(
|
|
513
|
-
U,
|
|
514
|
-
(c) => Y({
|
|
515
|
-
size: "sm",
|
|
516
|
-
label: c.$.closeModal,
|
|
517
|
-
onClick: () => {
|
|
518
|
-
l(), d();
|
|
519
|
-
}
|
|
520
|
-
})
|
|
521
|
-
)
|
|
522
|
-
)
|
|
523
|
-
)
|
|
524
|
-
),
|
|
525
|
-
// Body section
|
|
526
|
-
k.div(h.class("bc-modal__body"), h.id(T), p.body),
|
|
527
|
-
// Footer section
|
|
528
|
-
p.footer && k.div(h.class("bc-modal__footer"), p.footer)
|
|
529
|
-
)
|
|
530
|
-
);
|
|
531
|
-
m({
|
|
532
|
-
mode: y,
|
|
533
|
-
effect: i ?? "opaque",
|
|
534
|
-
container: u,
|
|
535
|
-
content: E,
|
|
536
|
-
onClickOutside: () => {
|
|
537
|
-
r?.(), d();
|
|
538
|
-
},
|
|
539
|
-
onEscape: () => {
|
|
540
|
-
r?.(), d();
|
|
541
|
-
}
|
|
542
|
-
});
|
|
543
|
-
}, () => {
|
|
544
|
-
l(), d();
|
|
545
|
-
});
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
function be(a, t) {
|
|
549
|
-
const { confirmText: s, cancelText: e, onConfirm: o, onCancel: r, ...i } = a;
|
|
550
|
-
return R(
|
|
551
|
-
U,
|
|
552
|
-
(u) => re({ showCloseButton: !1, ...i }, (f, m) => {
|
|
553
|
-
const d = () => {
|
|
554
|
-
o?.(), m();
|
|
555
|
-
}, l = () => {
|
|
556
|
-
r?.(), m();
|
|
557
|
-
};
|
|
558
|
-
return t((g) => {
|
|
559
|
-
f({
|
|
560
|
-
body: g,
|
|
561
|
-
footer: Q(
|
|
562
|
-
h.class("bc-modal__actions"),
|
|
563
|
-
j(
|
|
564
|
-
{
|
|
565
|
-
variant: "outline",
|
|
566
|
-
onClick: l
|
|
567
|
-
},
|
|
568
|
-
q(e, u.$.cancel)
|
|
569
|
-
),
|
|
570
|
-
j(
|
|
571
|
-
{
|
|
572
|
-
color: "primary",
|
|
573
|
-
variant: "filled",
|
|
574
|
-
onClick: d
|
|
575
|
-
},
|
|
576
|
-
q(s, u.$.confirm)
|
|
577
|
-
)
|
|
578
|
-
)
|
|
579
|
-
});
|
|
580
|
-
}, m);
|
|
581
|
-
})
|
|
582
|
-
);
|
|
583
|
-
}
|
|
584
|
-
export {
|
|
585
|
-
fe as A,
|
|
586
|
-
B,
|
|
587
|
-
be as C,
|
|
588
|
-
$ as F,
|
|
589
|
-
re as M,
|
|
590
|
-
ae as O,
|
|
591
|
-
w as S,
|
|
592
|
-
S as a,
|
|
593
|
-
he as b,
|
|
594
|
-
se as c,
|
|
595
|
-
de as d,
|
|
596
|
-
H as e,
|
|
597
|
-
me as f,
|
|
598
|
-
ge as o,
|
|
599
|
-
pe as s,
|
|
600
|
-
te as u
|
|
601
|
-
};
|
package/dist/modal-mA_AFUCI.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const o=require("@tempots/dom"),w=require("./timer-DK_yKNwE.cjs"),$=require("./notice-DCuZEAQO.cjs"),V=require("./translations-DQxg-W9w.cjs"),W=["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){return Array.from(r.querySelectorAll(W)).filter(t=>{const s=t;return s.offsetWidth>0&&s.offsetHeight>0&&!s.hasAttribute("inert")&&window.getComputedStyle(s).visibility!=="hidden"})}function B(r={}){const{active:t=!0,escapeDeactivates:s=!0,onEscape:e,initialFocus:a,returnFocus:i,clickOutsideDeactivates:c=!1,onClickOutside:d}=r;return o.WithElement(h=>{let f=t,m=null,u=[];typeof document<"u"&&(m=document.activeElement);const b=()=>{u=_(h)},g=n=>{if(f){if(s&&n.key==="Escape"){n.preventDefault(),e?.();return}if(n.key==="Tab"){if(b(),u.length===0){n.preventDefault();return}const v=u.indexOf(document.activeElement);n.shiftKey?v<=0&&(n.preventDefault(),u[u.length-1]?.focus()):v>=u.length-1&&(n.preventDefault(),u[0]?.focus())}}},p=n=>{if(!f||!c)return;const v=n.target;h.contains(v)||d?.()},y=()=>{if(!f)return;b();let n=null;typeof a=="function"?n=a():a?n=a:u.length>0&&(n=u[0]),n&&setTimeout(()=>{n?.focus()},50),document.addEventListener("keydown",g,!0),c&&document.addEventListener("click",p,!0)},T=()=>{f=!1,document.removeEventListener("keydown",g,!0),document.removeEventListener("click",p,!0);let n=null;typeof i=="function"?n=i():i?n=i:m&&(n=m),n&&document.body.contains(n)&&setTimeout(()=>{n?.focus()},0)};return setTimeout(()=>y(),0),o.OnDispose(()=>{T()})})}function P(r={}){return{activate:()=>B({...r,active:!0}),deactivate:()=>B({...r,active:!1})}}function F({initialStatus:r="closed",openedAfter:t,closedAfter:s}){const e=o.prop(r),a=()=>{e.set("start-opening")},i=()=>{e.set("start-closing")},c=e.map(n=>n!=="closed"&&n!=="start-closing"&&n!=="closing"),d=n=>{n?a():i()},h=()=>{d(!c.value)},f=n=>e.on(v=>{v==="closed"&&n()});let m=()=>{};e.on(n=>{switch(m(),n){case"start-opening":m=w.g(()=>e.set("opening"));break;case"opening":m=t(()=>e.set("opened"));break;case"start-closing":m=w.g(()=>e.set("closing"));break;case"closing":m=s(()=>e.set("closed"));break}}),e.onDispose(()=>m());const u=e.map(n=>n==="closed"),b=e.map(n=>n==="start-opening"),g=e.map(n=>n==="opening"),p=e.map(n=>n==="opened"),y=e.map(n=>n==="closing"),T=e.map(n=>n==="start-closing");return{status:e,open:a,close:i,toggle:h,setOpen:d,display:c,isClosed:u,isStartOpening:b,isOpening:g,isOpened:p,isClosing:y,isStartClosing:T,dispose:()=>e.dispose(),onClosed:f}}function U({initialStatus:r="closed",duration:t,openDuration:s=t??500,closeDuration:e=t??500}={}){return F({initialStatus:r,openedAfter:a=>w.T(a,s),closedAfter:a=>w.T(a,e)})}function q(r,t){let s=!1,e=null;function a(){s||(s=!0,e&&(clearTimeout(e),e=null),t())}function i(f){f.target===r&&a()}function c(f){f.target===r&&a()}const d=()=>{if(typeof r.getAnimations>"u"){e=setTimeout(a,16);return}r.getAnimations().length===0?(r.addEventListener("transitionend",i,{once:!0}),r.addEventListener("animationend",c,{once:!0}),e=setTimeout(a,1e3)):(r.addEventListener("transitionend",i,{once:!0}),r.addEventListener("animationend",c,{once:!0}))},h=w.g(d);return()=>{s=!0,h(),e&&(clearTimeout(e),e=null),r.removeEventListener("transitionend",i),r.removeEventListener("animationend",c)}}function M({initialStatus:r="closed",element:t}={}){let s=t;return{setElement:e=>{s=e},...F({initialStatus:r,openedAfter:e=>s==null?(e(),()=>{}):q(s,e),closedAfter:e=>s==null?(e(),()=>{}):q(s,e)})}}function z(r,t){return o.attr.class(o.computedOf(r,t)((s,e)=>`bc-toggle--animated bc-toggle--${s} bc-toggle--${e}`))}function D(r){return{"~standard":{version:1,vendor:"beatui-custom",validate:s=>{const e=r.validate(s);return e.success?{value:e.data}:{issues:e.errors.map(a=>({message:a.message,path:a.path}))}},types:void 0},safeParse:s=>{const e=r.validate(s);return e.success?{success:!0,data:e.data}:{success:!1,error:{errors:e.errors.map(a=>({message:a.message,path:a.path?.map(i=>typeof i=="object"&&"key"in i?i.key.toString():i.toString())||[]}))}}}}}class x{optional(){return new R(this)}default(t){return new H(this,t)}schema(){return D(this)}}class C extends x{minLength;maxLength;pattern;customValidations=[];validate(t){if(typeof t!="string")return{success:!1,errors:[{message:"Expected string"}]};const s=[];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"});for(const e of this.customValidations){const a=e(t);a&&s.push({message:a})}return s.length>0?{success:!1,errors:s}:{success:!0,data:t}}min(t,s){const e=new C;return e.minLength=t,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(a=>a.length<t?s:null),e}max(t,s){const e=new C;return e.minLength=this.minLength,e.maxLength=t,e.pattern=this.pattern,e.customValidations=[...this.customValidations],s&&e.customValidations.push(a=>a.length>t?s:null),e}regex(t,s){const e=new C;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=t,e.customValidations=[...this.customValidations],s&&e.customValidations.push(a=>t.test(a)?null:s),e}email(t="Please enter a valid email address"){const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,e=new C;return e.minLength=this.minLength,e.maxLength=this.maxLength,e.pattern=this.pattern,e.customValidations=[...this.customValidations,a=>s.test(a)?null:t],e}refine(t){const s=new C;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,t],s}}class A extends x{mustBeTrue=!1;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,s){const e=new A;e.mustBeTrue=this.mustBeTrue,e.trueMessage=this.trueMessage;const a=e.validate.bind(e);return e.validate=i=>{const c=a(i);return c.success?t(c.data)?c:{success:!1,errors:[{message:s}]}:c},e}literal(t,s){const e=new A;return e.mustBeTrue=!0,e.trueMessage=s,e}}class R extends x{constructor(t){super(),this.inner=t}validate(t){if(t===void 0)return{success:!0,data:void 0};const s=this.inner.validate(t);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.errors}}}class H extends x{constructor(t,s){super(),this.inner=t,this.defaultValue=s}validate(t){return t===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(t)}}class O extends x{constructor(t){super(),this.shape=t}validate(t){if(typeof t!="object"||t===null||Array.isArray(t))return{success:!1,errors:[{message:"Expected object"}]};const s=t,e={},a=[];for(const[i,c]of Object.entries(this.shape)){const d=c.validate(s[i]);if(d.success)e[i]=d.data;else for(const h of d.errors)a.push({message:h.message,path:[i,...h.path||[]]})}return a.length>0?{success:!1,errors:a}:{success:!0,data:e}}refine(t,s){const e=new O(this.shape),a=e.validate.bind(e);return e.validate=i=>{const c=a(i);if(!c.success)return c;const d=t(c.data);return d?{success:!1,errors:[{message:d,path:s?.path}]}:{success:!0,data:c.data}},e}}const K=()=>new C,N=()=>new A,G=r=>new O(r);function I(r){return o.WithBrowserCtx(t=>{const s=[],e=()=>s.forEach(i=>i());return r(({effect:i="opaque",mode:c="capturing",onClickOutside:d,onEscape:h,content:f,container:m="body"})=>{m==="body"&&(t=t.makePortal("body"));const u=M();u.onClosed(e);let b=()=>{},g=()=>{};const p=E=>{E.key==="Escape"&&(h?.(),u.close())},y=()=>{d?.(),u.close()},T=E=>{b(),g(),E==="capturing"?(document.addEventListener("keydown",p),b=()=>document.removeEventListener("keydown",p),t.element.addEventListener("mousedown",y),g=()=>t.element.removeEventListener("mousedown",y)):(b=()=>{},g=()=>{})},n=o.Value.on(c,T);s.push(n),s.push(()=>{b(),g()});const v=()=>{const E=new Set;for(const l of t.element.querySelectorAll(":scope > :not([data-overlay])"))l.hasAttribute("inert")?E.add(l):l.setAttribute("inert","");return s.push(()=>{for(const l of t.element.querySelectorAll(":scope > :not([data-overlay])"))E.has(l)||l.removeAttribute("inert");E.clear()}),document.activeElement?.blur?.(),o.html.div(o.WithElement(l=>u.setElement(l)),o.dataAttr.status(u.status.map(String)),o.dataAttr.overlay("true"),o.attr.class(o.computedOf(i??"opaque",c)((l,L)=>`bc-overlay bc-overlay--effect-${l} bc-overlay--mode-${L}`)),f)},k=o.render(v(),t.element,{disposeWithParent:!0,clear:!1,providers:t.providers});s.push(k),w.g(()=>u.open())},e)})}function j(r,t){const{size:s="md",dismissable:e=!0,showCloseButton:a=!0,onClose:i,overlayEffect:c="opaque",container:d="body",position:h="center"}=r;return I((f,m)=>{let u=()=>{};return t(p=>{u=m;const y=o.prop("capturing");o.Value.on(e,l=>{y.set(l?"capturing":"non-capturing")});const T=o.computedOf(p.header!=null,a)((l,L)=>l||L),n=$.sessionId("modal"),v=`${n}-header`,k=`${n}-body`,E=o.html.div(o.attr.class(o.computedOf(s,h)((l,L)=>`bc-modal bc-modal--size-${l} bc-modal--container-${d} bc-modal--position-${L}`)),o.attr.role("dialog"),o.aria.modal(!0),...p.header?[o.aria.labelledby(v)]:[],o.aria.describedby(k),o.attr.tabindex(-1),o.attr.id(n),o.dataAttr.focusTrap("true"),o.on.mousedown(l=>l.stopPropagation()),B({escapeDeactivates:!1,initialFocus:()=>{const l=document.getElementById(n);if(!l)return null;const L=l.querySelector('[aria-label="Close modal"]');if(L)return L;const S=l.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return S||l}}),o.html.div(o.attr.class("bc-modal__content"),o.When(T,()=>o.html.div(o.attr.class("bc-modal__header"),o.html.div(o.attr.class("bc-modal__title"),...p.header?[o.attr.id(v)]:[],p.header),o.When(a,()=>o.Use(V.BeatUII18n,l=>$.CloseButton({size:"sm",label:l.$.closeModal,onClick:()=>{u(),m()}}))))),o.html.div(o.attr.class("bc-modal__body"),o.attr.id(k),p.body),p.footer&&o.html.div(o.attr.class("bc-modal__footer"),p.footer)));f({mode:y,effect:c??"opaque",container:d,content:E,onClickOutside:()=>{i?.(),m()},onEscape:()=>{i?.(),m()}})},()=>{u(),m()})})}function J(r,t){const{confirmText:s,cancelText:e,onConfirm:a,onCancel:i,...c}=r;return o.Use(V.BeatUII18n,d=>j({showCloseButton:!1,...c},(h,f)=>{const m=()=>{a?.(),f()},u=()=>{i?.(),f()};return t(g=>{h({body:g,footer:o.Fragment(o.attr.class("bc-modal__actions"),V.Button({variant:"outline",onClick:u},o.coalesce(e,d.$.cancel)),V.Button({color:"primary",variant:"filled",onClick:m},o.coalesce(s,d.$.confirm)))})},f)}))}exports.AnimatedToggleClass=z;exports.BooleanValidator=A;exports.ConfirmModal=J;exports.FocusTrap=B;exports.Modal=j;exports.ObjectValidator=O;exports.Overlay=I;exports.StringValidator=C;exports.boolean=N;exports.createStandardSchema=D;exports.object=G;exports.string=K;exports.useAnimatedElementToggle=M;exports.useAnimatedToggle=F;exports.useFocusTrap=P;exports.useTimedToggle=U;
|
package/dist/notice-DCuZEAQO.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("@tempots/dom"),k=require("./translations-DQxg-W9w.cjs"),$=new Map;function M(e){const t=$.get(e)??0;return $.set(e,t+1),`${e}-${t}`}const v={notAsked:{type:"NotAsked"},loading(e=void 0){return{type:"Loading",previousValue:e}},success(e){return{type:"AsyncSuccess",value:e}},failure(e){return{type:"AsyncFailure",error:e}},isSuccess(e){return e.type==="AsyncSuccess"},isFailure(e){return e.type==="AsyncFailure"},isNotAsked(e){return e.type==="NotAsked"},isLoading(e){return e.type==="Loading"},getOrElse(e,t){return v.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return v.isSuccess(e)?e.value:t()},getOrNull(e){return v.isSuccess(e)?e.value:null},getOrUndefined(e){return v.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(v.isSuccess(e))return e.value;throw v.isFailure(e)?e.error:new Error("Cannot get value from a not-asked or loading result")},match:(e,{success:t,failure:n,loading:a,notAsked:r=a})=>v.isSuccess(e)?t(e.value):v.isFailure(e)?n(e.error):v.isNotAsked(e)?r():a(e.previousValue),whenSuccess:(e,t)=>(v.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(v.isFailure(e)&&t(e.error),e),equals:(e,t,n={valueEquals:(a,r)=>a===r,errorEquals:(a,r)=>a===r})=>e.type==="AsyncSuccess"&&t.type==="AsyncSuccess"?n.valueEquals(e.value,t.value):e.type==="AsyncFailure"&&t.type==="AsyncFailure"?n.errorEquals(e.error,t.error):e.type==="Loading"&&t.type==="Loading"?n.valueEquals(e.previousValue,t.previousValue):e.type==="NotAsked"&&t.type==="NotAsked",all:e=>{const t=[];for(const n of e)if(v.isSuccess(n))t.push(n.value);else return n;return v.success(t)},ofPromise:async e=>{try{const t=await e;return v.success(t)}catch(t){return v.failure(t instanceof Error?t:new Error(String(t)))}}},O=(e,t)=>e===t||e!==e&&t!==t,w={valid:{type:"valid"},invalid(e){return{type:"invalid",error:e}},isValid(e){return e.type==="valid"},isInvalid(e){return e.type==="invalid"},match:(e,t,n)=>w.isValid(e)?t():n(e.error),toResult:(e,t)=>w.match(e,()=>f.success(t),n=>f.failure(n)),whenValid:(e,t)=>(w.isValid(e)&&t(),e),whenInvalid:(e,t)=>(w.isInvalid(e)&&t(e.error),e)},f={success(e){return{type:"Success",value:e}},failure(e){return{type:"Failure",error:e}},map:(e,t)=>e.type==="Success"?f.success(t(e.value)):e,flatMap:(e,t)=>e.type==="Success"?t(e.value):e,toAsync(e){return f.match(e,t=>v.success(t),t=>v.failure(t))},toValidation(e){return f.match(e,()=>w.valid,t=>w.invalid(t))},isSuccess(e){return e.type==="Success"},isFailure(e){return e.type==="Failure"},getOrElse(e,t){return f.isSuccess(e)?e.value:t},getOrElseLazy(e,t){return f.isSuccess(e)?e.value:t()},getOrNull(e){return f.isSuccess(e)?e.value:null},getOrUndefined(e){return f.isSuccess(e)?e.value:void 0},getUnsafe:e=>{if(f.isSuccess(e))return e.value;throw e.error},match:(e,t,n)=>f.isSuccess(e)?t(e.value):n(e.error),whenSuccess:(e,t)=>(f.isSuccess(e)&&t(e.value),e),whenFailure:(e,t)=>(f.isFailure(e)&&t(e.error),e),combine:(e,t,n,a)=>f.match(e,r=>f.match(t,i=>f.success(n(r,i)),i=>f.failure(i)),r=>f.match(t,i=>f.failure(r),i=>f.failure(a(r,i)))),equals:(e,t,n={valueEquals:(a,r)=>a===r,errorEquals:(a,r)=>a===r})=>e.type==="Success"&&t.type==="Success"?n.valueEquals(e.value,t.value):e.type==="Failure"&&t.type==="Failure"?n.errorEquals(e.error,t.error):!1,all:e=>{const t=[];for(const n of e)if(f.isSuccess(n))t.push(n.value);else return n;return f.success(t)}};function x({size:e="sm",icon:t="line-md:close",disabled:n,roundedness:a="full",color:r="base",onClick:i,label:l},...o){return s.Use(k.BeatUII18n,c=>{const p=s.coalesce(l,c.$.closeModal);return k.Button({variant:"text",size:e,roundedness:a,disabled:n,color:r,onClick:i},s.attr.title(p),s.aria.label(p),...o,k.Icon({icon:t,size:e??"sm"}))})}function T(e){return`bc-label bc-label--${e}`}const Z=(...e)=>s.html.span(s.attr.class(T("emphasis")),...e),N=(...e)=>s.html.span(s.attr.class(T("default")),...e),j=(...e)=>s.html.span(s.attr.class(T("muted")),...e),ee=(...e)=>s.html.span(s.attr.class(T("danger")),...e),te=e=>{const{value:t,onBlur:n,onChange:a,placeholder:r,disabled:i,id:l,checkedIcon:o,uncheckedIcon:c,iconSize:p="lg"}=e,u=l??M("checkbox"),b=`${u}-label`,S=()=>{if(s.Value.get(i??!1))return;const h=s.Value.get(t);a?.(!h)},g=h=>{s.Value.get(i??!1)||(h.key===" "||h.key==="Enter")&&(h.preventDefault(),S())};return k.InputContainer({baseContainer:!0,growInput:!1,...e,input:s.html.span(s.attr.class("bc-checkbox-input"),s.html.span(s.attr.class("bc-checkbox-input__checkbox"),s.attr.class(s.Value.map(t,h=>h?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),s.attr.class(s.Value.map(i??!1,h=>h?"bc-checkbox-input__checkbox--disabled":"")),s.attr.id(u),s.attr.role("checkbox"),s.attr.tabindex(s.Value.map(i??!1,h=>h?-1:0)),s.aria.checked(t),s.aria.disabled(i),r!=null?s.aria.labelledby(b):s.Empty,s.on.keydown(g),n!=null?s.on.blur(n):s.Empty,k.Icon({icon:s.computedOf(t,o,c)((h,d,m)=>h?d??"akar-icons/check-box-fill":m??"akar-icons/box"),accessibility:"decorative",size:p})),r!=null?s.html.label(s.attr.class("bc-checkbox-input__label"),s.attr.id(b),s.attr.for(u),j(r)):s.Empty)},s.on.click(S))},q=s.html.span(s.attr.class("bc-input-wrapper__required")," *");function se(e){const t=["bc-input-wrapper"];return e!=="vertical"&&t.push(`bc-input-wrapper--${e}`),t.join(" ")}function ne(e,t){const n=["bc-input-wrapper__label-text"];return e?n.push("bc-input-wrapper__label-text--error"):t?n.push("bc-input-wrapper__label-text--disabled"):n.push("bc-input-wrapper__label-text--default"),n.join(" ")}function L(e,t){if(e==="horizontal-fixed"&&t!=null)return`--input-wrapper-label-width: ${t}`}const F=({required:e,label:t,labelChildren:n,context:a,description:r,content:i,error:l,labelFor:o,hasError:c,disabled:p,layout:u,labelWidth:b},...S)=>{const g=c??l!=null,h=p??!1,d=u??"vertical",m=M("input-wrapper"),C=r?`${m}-description`:void 0,I=l!=null?`${m}-error`:void 0,_=s.computedOf(d)(y=>y!=="vertical");return s.html.div(s.attr.class(s.Value.map(d,y=>se(y))),s.When(s.computedOf(d,b??void 0)((y,E)=>L(y,E)!=null),()=>s.attr.style(s.Value.map(s.computedOf(d,b??void 0)((y,E)=>L(y,E)),y=>y))),t!=null||a!=null?s.html.div(s.attr.class("bc-input-wrapper__header"),s.html.div(s.attr.class("bc-input-wrapper__label-section"),s.html.label(s.attr.class("bc-input-wrapper__label"),o!=null?s.attr.for(o):s.Empty,s.html.span(s.attr.class(s.computedOf(g,h)((y,E)=>ne(y??!1,E??!1))),t),t!=null&&e?q:s.Empty),s.When(s.computedOf(_,r)((y,E)=>y&&E!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),s.attr.id(C),r))),a!=null?N(a):s.Empty,n):s.Empty,s.html.div(s.attr.class("bc-input-wrapper__content"),[C,I].filter(Boolean).length>0?s.dataAttr.describedby([C,I].filter(Boolean).join(" ")):s.Empty,e?s.dataAttr.required("true"):s.Empty,s.When(g,()=>s.dataAttr.invalid("true")),i),s.When(s.computedOf(_,r)((y,E)=>!y&&E!=null),()=>s.html.div(s.attr.class("bc-input-wrapper__description"),s.attr.id(C),r)),l!=null?s.When(g,()=>s.html.div(s.attr.class("bc-input-wrapper__error"),s.attr.id(I),s.aria.live("polite"),s.attr.role("alert"),l)):null,...S)};function re(...e){return s.html.div(s.attr.class("bc-stack"),...e)}const ae=e=>{const t={name:"email",autocomplete:"email",...e},{value:n,before:a,onBlur:r,onChange:i,onInput:l,placeholder:o}=t,c=a??k.Icon({icon:"line-md:email",size:"sm",color:"neutral"});return s.Use(k.BeatUII18n,p=>k.InputContainer({...e,before:c,input:s.input.email(k.CommonInputAttributes(t),s.attr.placeholder(s.coalesce(o,p.$.emailPlaceholderText)),s.attr.value(n),s.attr.class("bc-input"),r!=null?s.on.blur(s.emitValue(r)):s.Empty,i!=null?s.on.change(s.emitValue(i)):s.Empty,l!=null?s.on.input(s.emitValue(l)):s.Empty)}))},ie=e=>{const{value:t,onBlur:n,onChange:a,onInput:r,before:i,after:l,hasError:o,disabled:c,autocomplete:p,placeholder:u,...b}=e,S={name:"password",disabled:c,...b},g=s.prop(!0),h=s.computedOf(g,p)((d,m)=>d?m??"current-password":"off");return s.Use(k.BeatUII18n,d=>{const m=s.computedOf(d.$.passwordPlaceholderText,g,u)((I,_,y)=>_?"•••••••••••••••":y??I),C=s.html.button(s.attr.type("button"),s.attr.class("bc-input-container__password-toggle"),s.aria.label(d.$.togglePasswordVisibility),s.on.click(()=>g.update(I=>!I)),s.When(g,()=>k.Icon({icon:"line-md:watch"}),()=>k.Icon({icon:"line-md:watch-off"})));return k.InputContainer({before:i,disabled:c,hasError:o,input:s.html.input(k.CommonInputAttributes({...S,autocomplete:h,placeholder:m}),s.When(g,()=>s.Fragment(s.attr.type("password")),()=>s.Fragment(s.attr.type("text"))),s.attr.class("bc-input"),s.attr.value(t),n!=null?s.on.blur(s.emitValue(n)):s.Empty,a!=null?s.on.change(s.emitValue(a)):s.Empty,r!=null?s.on.input(s.emitValue(r)):s.Empty),after:l!=null?s.Fragment(C,l):C})})},U=(e,t)=>()=>{e.markTouched(),t?.()},W=(e,t)=>n=>{e.change(n),t?.(n)};function B(e,t){const{controller:n,onBlur:a,onChange:r,...i}=t;return e({id:n.name,disabled:n.disabled,value:n.signal,hasError:n.errorVisible,...i,onChange:W(n,r),onBlur:U(n,a)})}function le(e,t,...n){return F({...t,content:B(e,t)},...n)}function H(e,t){const{toInput:n,fromInput:a,controller:r,...i}=t,l=r.transform(n,a);return B(e,{...i,controller:l})}function oe(e,t,...n){return F({...t,content:H(e,t)},...n)}function ce(e){return e.split(".").map(n=>{const a=n.match(/^\[(\d+)\]$/);return a?Number(a[1]):n})}function z(e){return typeof e=="number"?`[${e}]`:`.${e}`}function R(e){if(e.length===0)return"";const[t,...n]=e;return[typeof t=="number"?`[${t}]`:t,...n.map(z)].join("")}function D(e){return function(n){if(n.type==="valid")return n;let a=n.error;for(const r of e)if(a=a?.dependencies?.[r],a==null)return w.valid;return w.invalid(a)}}class V{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:s.prop(!1),touched:s.prop(!1)};#s;#t=s.prop(void 0);parent;disabled;#n=[];disabledOrHasErrors;constructor(t,n,a,r,i,l=O){this.path=t,this.change=n,this.signal=a,this.status=r,this.#s=l,this.#t.set(a.value),this.error=r.map(o=>o?.type==="invalid"?o.error?.message:void 0),this.hasError=this.error.map(o=>o!=null),this.touched=this.#e.touched,i.validationMode?this.errorVisible=s.computedOf(this.hasError,this.touched,i.validationMode)((o,c,p)=>p==="continuous"?!!o:!!o&&!!c):this.errorVisible=s.computedOf(this.hasError,this.touched)((o,c)=>!!o&&!!c),this.dirty=s.computedOf(this.signal,this.#t)((o,c)=>!this.#s(o,c)),this.dependencyErrors=r.map(o=>o?.type==="invalid"?o.error?.dependencies:void 0),this.parent=i,this.disabled=s.computedOf(this.#e.disabled,i.disabled)((o,c)=>o||c),this.disabledOrHasErrors=s.computedOf(this.disabled,this.hasError)((o,c)=>o||c),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#t.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return R(this.path)}onDispose=t=>{this.#n.push(t)};dispose=()=>{for(const t of this.#n)try{t()}catch(n){console.error("Error in dispose callback:",n)}this.#n.length=0};setDisabled=t=>{this.#e.disabled.set(t)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#t.set(this.signal.value)};reset=()=>{this.change(this.#t.value)};array=(t=O)=>new G(this.path,this.change,this.signal,this.status,this.parent,t);object=(t=O)=>new K(this.path,this.change,this.signal,this.status,this.parent,t);transform=(t,n,a=[],r=O)=>new V([...this.path,...a],i=>this.change(n(i)),this.signal.map(t,r),this.status.map(D(a)),this.parent,r);asyncTransform=(t,n,a,r=[],i=O)=>new V([...this.path,...r],l=>{n(l).then(o=>this.change(o))},this.signal.mapAsync(t,a,void 0,i),this.status.map(D(r)),this.parent,i)}class K extends V{#e=new Map;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,a,r,i,l){super(t,n,a.map(c=>c??{},l),r,i,l),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const o=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const c of this.#e.values())c.dispose();this.#e.clear();for(const c of this.#t.values())c();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const c of this.#r.values())c();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),o()})}field=t=>{if(this.#e.has(t))return this.#e.get(t);const n=async l=>{this.change({...this.signal.value,[t]:l})},a=new V([...this.path,t],n,this.signal.map(l=>l[t]),this.status.map(D([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(t,a);const r=a.touched.on(l=>{this.#s.set(t,l),this.#o()});this.#t.set(t,r);const i=a.dirty.on(l=>{this.#a.set(t,l),this.#i()});return this.#r.set(t,i),a};markAllTouched=()=>{this.markTouched();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markTouched();for(const n of this.#e.values())n.markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value;for(const n of Object.keys(t))this.field(n).markPristine?.();for(const n of this.#e.values())n.markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}class G extends V{#e=new Array;length;#s=new Map;#t=new Map;#n=s.prop(!1);touchedDeep=this.#n;#a=new Map;#r=new Map;#l=s.prop(!1);dirtyDeep=this.#l;#c;#u;#o=()=>{let t=!1;for(const n of this.#s.values())if(n){t=!0;break}this.#n.set(this.touched.value||t)};constructor(t,n,a,r,i,l){const o=a.map(u=>u??[],l);super(t,n,o,r,i,l);const c=o.on(u=>{const b=this.#e.length-u.length;b>0&&(this.#e.splice(u.length,b).forEach((S,g)=>{const h=u.length+g;S.dispose(),this.#t.get(h)?.(),this.#t.delete(h),this.#s.delete(h),this.#r.get(h)?.(),this.#r.delete(h),this.#a.delete(h)}),this.#o(),this.#i())});this.length=o.map(u=>u.length),this.#c=this.touched.on(()=>{this.#o()}),this.#u=this.dirty.on(()=>{this.#i()});const p=this.signal.on(()=>this.#i());this.onDispose(()=>{for(const u of this.#e)u.dispose();this.length.dispose(),this.#e.length=0,c(),o.dispose();for(const u of this.#t.values())u();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const u of this.#r.values())u();this.#r.clear(),this.#a.clear(),this.#l.dispose(),this.#c(),this.#u(),p()})}item=t=>{if(this.#e[t])return this.#e[t];const n=async l=>{const o=this.signal.value.slice();o[t]=l,this.change(o)},a=new V([...this.path,t],n,this.signal.map(l=>l[t]),this.status.map(D([t])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[t]=a;const r=a.touched.on(l=>{this.#s.set(t,l),this.#o()});this.#t.set(t,r);const i=a.dirty.on(l=>{this.#a.set(t,l),this.#i()});return this.#r.set(t,i),a};push=(...t)=>{this.change([...this.signal.value,...t])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...t)=>{this.change([...t,...this.signal.value])};removeAt=t=>{this.splice(t,1)};splice=(t,n)=>{const a=this.signal.value.slice();a.splice(t,n),this.change(a)};move=(t,n,a=1)=>{if(a<1||t===n)return;const r=this.signal.value.slice(),i=r.splice(t,a);r.splice(n,0,...i),this.change(r)};markAllTouched=()=>{this.markTouched();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markTouched()};markAllPristine=()=>{this.markPristine();const t=this.signal.value.length;for(let n=0;n<t;n++)this.item(n).markPristine?.()};#i=()=>{let t=!1;for(const n of this.#a.values())if(n){t=!0;break}this.#l.set(this.dirty.value||t)}}function J(e){function t(n){return typeof n=="number"?n:n.toString()}return e.map(n=>typeof n=="object"&&n.key!=null?t(n.key):t(n))}function Q(e){const t=e.filter(r=>r.path==null||r.path.length===0).map(r=>r.message),n=e.filter(r=>r.path!=null&&r.path.length>0).reduce((r,i)=>{const l=J(i.path),o=l.pop();let c=r;for(const p of l)c.dependencies==null&&(c.dependencies={}),c.dependencies[p]==null&&(c.dependencies[p]={}),c=c.dependencies[p];return c.dependencies==null&&(c.dependencies={}),c.dependencies[o]={message:i.message},r},{}),a=t.join(`
|
|
2
|
-
`);return{...n,message:a!=""?a:void 0}}function X({initialValue:e,onChange:t,validate:n,equals:a,validationMode:r,validateDebounceMs:i}){const l=s.Value.deriveProp(e),o=s.prop(w.valid),c=s.prop(!1),p=s.prop(r??"touchedOrSubmit"),u=d=>{o.set(d)};let b;const S=async d=>{if(n!=null){const m=await n(d);u(m)}},g=async d=>{l.set(d),t?.(d);const m=p.value;if(n!=null){if(m==="onSubmit")return;const C=i??0;C>0?(b&&clearTimeout(b),b=setTimeout(()=>{S(d)},C)):await S(d)}},h=new V([],g,l,o,{disabled:c,validationMode:p},a??O);return h.onDispose(()=>{c.dispose(),l.dispose(),o.dispose(),p.dispose(),b&&clearTimeout(b)}),{controller:h,setStatus:u}}function P(e){return s.Fragment(s.attr.disabled(e.disabled),s.attr.name(e.name))}function ue(e,{triggerOn:t="change"}={}){return s.Fragment(P(e),s.attr.value(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValue(e.change)))}function he(e,{triggerOn:t="change"}={}){return s.Fragment(P(e),s.attr.valueAsNumber(e.signal),(t==="input"?s.on.input:s.on.change)(s.emitValueAsNumber(e.change)))}function A(e){return e.issues!=null?w.invalid(Q(e.issues)):w.valid}async function de({task:e,errorMessage:t,errorPath:n=["root"],validation:a}){try{const r=await e();return a!=null?a(r):w.valid}catch(r){const i=t??(r instanceof Error?r.message:"Operation failed");return n.length===1&&n[0]==="root"?w.invalid({message:i}):w.invalid({dependencies:Y(n,i)})}}function Y(e,t){if(e.length===1)return{[e[0]]:{message:t}};const[n,...a]=e;return{[n]:{dependencies:Y(a,t)}}}function pe({initialValue:e={},schema:t,onSubmit:n=async()=>w.valid,validationMode:a,validateDebounceMs:r}){const{controller:i,setStatus:l}=X({initialValue:e,validationMode:a??"touchedOrSubmit",validateDebounceMs:r,validate:(a??"touchedOrSubmit")==="onSubmit"||t==null?void 0:async u=>A(await t["~standard"].validate(u))}),o=s.prop(!1),c=i.object();return c.onDispose(o.dispose),{controller:c,setStatus:l,submit:async u=>{if(o.set(!0),u?.preventDefault(),c.markAllTouched(),(a??"touchedOrSubmit")==="onSubmit"){const S=c.signal.value,g=t?.["~standard"].validate;if(g==null){o.set(!1);return}const h=A(await g(S));if(l(h),h.type==="invalid"){o.set(!1);return}}const b=await n(c.signal.value);o.set(!1),b.type==="invalid"&&l(b)},submitting:o}}function me(e){switch(e){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 fe(e){switch(e){case"success":return"success";case"warning":return"warning";case"danger":return"danger";case"info":default:return"info"}}function be(e,t,n,a){const r=["bc-notice",`bc-notice--${e}`,`bc-notice--tone-${t}`];return n&&r.push("bc-notice--dismissible"),a&&a.length>0&&r.push(a),r.join(" ")}function ge({variant:e="info",tone:t="subtle",role:n,title:a,icon:r,closable:i=!1,onDismiss:l,class:o},...c){const p=s.Value.map(i,d=>!!d||l!=null),u=s.Value.map(e,d=>d??"info"),b=s.Value.map(t,d=>d??"subtle"),S=s.computedOf(n,u)((d,m)=>d??(m==="danger"?"alert":"status")),g=s.prop(!0),h=s.Use(k.BeatUII18n,d=>s.html.div(s.attr.class(s.computedOf(u,b,p,o)((m,C,I,_)=>be(m,C,I,_))),s.attr.role(s.Value.map(S,m=>m)),s.Unless(s.Value.map(r,m=>m===!1),()=>s.html.div(s.attr.class("bc-notice__icon"),k.Icon({icon:s.computedOf(r,u)((m,C)=>m===void 0?me(C):String(m)),size:"md",color:s.Value.map(u,fe)}))),s.html.div(s.attr.class("bc-notice__body"),s.Ensure(a,m=>s.html.div(s.attr.class("bc-notice__title"),m)),s.html.div(s.attr.class("bc-notice__content"),...c)),s.When(p,()=>x({size:"xs",label:d.$.closeModal,onClick:()=>{g.set(!1),l?.()}}))));return s.When(g,()=>h)}exports.ArrayController=G;exports.BaseControl=B;exports.BaseMappedControl=H;exports.CheckboxInput=te;exports.CloseButton=x;exports.Control=le;exports.Controller=V;exports.DangerLabel=ee;exports.EmailInput=ae;exports.EmphasisLabel=Z;exports.InputWrapper=F;exports.Label=N;exports.MappedControl=oe;exports.MutedLabel=j;exports.Notice=ge;exports.O=O;exports.ObjectController=K;exports.PasswordInput=ie;exports.RequiredSymbol=q;exports.Stack=re;exports.a=w;exports.connectCommonAttributes=P;exports.connectNumberInput=he;exports.connectStringInput=ue;exports.convertStandardSchemaIssues=Q;exports.convertStandardSchemaPathToPath=J;exports.makeMapValidation=D;exports.makeOnBlurHandler=U;exports.makeOnChangeHandler=W;exports.parsePath=ce;exports.pathToString=R;exports.sessionId=M;exports.standardSchemaResultToValidation=A;exports.taskToValidation=de;exports.useController=X;exports.useForm=pe;exports.wrapSegment=z;
|