@tempots/beatui 0.81.0 → 0.82.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_commonjsHelpers-DKOUU3wS.cjs +1 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/dist/{ar-DwHLVgKj.cjs → ar-D7CXDmVZ.cjs} +1 -1
- package/dist/{ar-Bo_FZZi7.js → ar-nOSKXpIW.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +63 -1349
- package/dist/auth-divider-BqZPH1-z.cjs +1 -0
- package/dist/auth-divider-Wr-S16kF.js +1355 -0
- package/dist/beatui.css +2035 -295
- package/dist/beatui.tailwind.css +2036 -296
- package/dist/better-auth/index.cjs.js +1 -0
- package/dist/better-auth/index.es.js +754 -0
- package/dist/{de-zI5mdV4M.cjs → de-WzsOu9Gn.cjs} +1 -1
- package/dist/{de-CCqwOkqN.js → de-f2xcEb34.js} +1 -1
- package/dist/{deep-merge-1uN6CG6K.js → deep-merge-BYm0y62g.js} +271 -285
- package/dist/deep-merge-d7sf0xmN.cjs +1 -0
- package/dist/duration-input-B9UNmUCh.cjs +1 -0
- package/dist/{duration-input-C9kpsw-t.js → duration-input-DqcJbxKD.js} +31 -29
- package/dist/editor-toolbar-group--a-xgsJw.cjs +1 -0
- package/dist/editor-toolbar-group-CVpl5mxF.js +31 -0
- package/dist/{es-BF02UrPL.js → es-CDqqzpCw.js} +1 -1
- package/dist/{es-Cw90CAbu.cjs → es-Ds2Xf3wV.cjs} +1 -1
- package/dist/{fa-DPQV4YB8.js → fa-C7tE_hR3.js} +1 -1
- package/dist/{fa-B4lssnzR.cjs → fa-Ct1UtDB7.cjs} +1 -1
- package/dist/{fr-1Kd6z1F-.cjs → fr-CzAkRFed.cjs} +1 -1
- package/dist/{fr-dmxPhwkD.js → fr-yOW_68YY.js} +1 -1
- package/dist/{he-BtQbrVt3.js → he-D2oUloCJ.js} +1 -1
- package/dist/{he-CJ3XnuPm.cjs → he-DlXALrK7.cjs} +1 -1
- package/dist/{hi-BpfnFKHp.cjs → hi-3dBhLwDs.cjs} +1 -1
- package/dist/{hi-D_Le4Yka.js → hi-D5ZlZoQq.js} +1 -1
- package/dist/{hls.light.min-Bhrf47iR.cjs → hls.light.min-C6xKDzRR.cjs} +1 -1
- package/dist/{hls.light.min-C6VwviEa.js → hls.light.min-hEMf_E8u.js} +1 -1
- package/dist/{index-CfaWytS2.cjs → index-05UbKOYe.cjs} +1 -1
- package/dist/{index-K6u33-GC.cjs → index-Bt7FYl80.cjs} +19 -19
- package/dist/{index-YtW7SCWB.js → index-C2Lq1m45.js} +1434 -1463
- package/dist/{index-CGEzILlC.js → index-lYhXnu6I.js} +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +2389 -2738
- package/dist/input-container-C6qEIjcA.cjs +1 -0
- package/dist/input-container-DiCjOzR2.js +247 -0
- package/dist/{it-DyHjSuHN.js → it-6e6X-4BB.js} +1 -1
- package/dist/{it-COCZ9NyB.cjs → it-DohtcWi9.cjs} +1 -1
- package/dist/{ja-X43lABza.js → ja-BxNuNo2H.js} +1 -1
- package/dist/{ja--NdggLU9.cjs → ja-eyTArrgS.cjs} +1 -1
- package/dist/json-schema/index.cjs.js +1 -8
- package/dist/json-schema/index.es.js +1359 -7608
- package/dist/json-schema-display/index.cjs.js +1 -0
- package/dist/json-schema-display/index.es.js +846 -0
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +542 -698
- package/dist/{ko-BUvb0ggK.cjs → ko-BFLCDMMs.cjs} +1 -1
- package/dist/{ko-B9g9iw99.js → ko-Ch0jFsBV.js} +1 -1
- package/dist/lexical/index.cjs.js +46 -0
- package/dist/lexical/index.es.js +21370 -0
- package/dist/lexical.css +1124 -0
- package/dist/menu-CZzRsQP_.js +372 -0
- package/dist/menu-ClrU72xH.cjs +1 -0
- package/dist/modal-I5srcntN.cjs +1 -0
- package/dist/modal-v3u2Fpnd.js +488 -0
- package/dist/{nl-0S25Gsld.cjs → nl-Bx2ACvr4.cjs} +1 -1
- package/dist/{nl-Ew5jnSsT.js → nl-NuTdZO1s.js} +1 -1
- package/dist/{notice-C-964yaY.js → notice-BuZvdvZh.js} +84 -82
- package/dist/notice-CLDdy1MW.cjs +1 -0
- package/dist/oneof-branch-detection-DsM1K5xc.cjs +8 -0
- package/dist/oneof-branch-detection-Dt8ss9lc.js +6281 -0
- package/dist/{pl-C9f6UBSe.js → pl-Bs4nLJ__.js} +1 -1
- package/dist/{pl-B3k-K3S4.cjs → pl-QHl6sl8f.cjs} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/{pt-DYtAvbrw.js → pt-BETjHZrL.js} +1 -1
- package/dist/{pt-CKoikRO5.cjs → pt-DZGw2Z-1.cjs} +1 -1
- package/dist/{ru-ZexN-b8V.js → ru-Bi1_DEKM.js} +1 -1
- package/dist/{ru-COb7RSDt.cjs → ru-D03IuLqh.cjs} +1 -1
- package/dist/session-id-3KiilioY.js +8 -0
- package/dist/session-id-B5lJMzbB.cjs +1 -0
- package/dist/stack-BJgsPJ9A.js +873 -0
- package/dist/stack-DcZ_u50f.cjs +1 -0
- package/dist/string-B9vVyfq3.cjs +1 -0
- package/dist/string-DYyMxBl-.js +19 -0
- package/dist/styles-url-B2dzXrYt.cjs +1 -0
- package/dist/styles-url-Cw_mxshe.js +4 -0
- package/dist/text-input-B3VBat1k.js +44 -0
- package/dist/text-input-Ds8e7Z1G.cjs +1 -0
- package/dist/{toolbar-DNpBIoJo.js → toolbar-D994_E_s.js} +4 -4
- package/dist/toolbar-x0_8lmKu.cjs +1 -0
- package/dist/{tr-tO_EH-Y2.cjs → tr-B_-_1wua.cjs} +1 -1
- package/dist/{tr-BDvn05-H.js → tr-DiYB-FwX.js} +1 -1
- package/dist/translations-B4-Zd2LM.cjs +1 -0
- package/dist/translations-Cq8bUKJP.js +584 -0
- package/dist/{translations-DwGC_94w.cjs → translations-D62qqNV9.cjs} +1 -1
- package/dist/{translations-CfWR4loD.js → translations-DPr6c05Z.js} +1 -1
- package/dist/types/better-auth/bridge.d.ts +2 -0
- package/dist/types/better-auth/callbacks.d.ts +6 -0
- package/dist/types/better-auth/components/authenticated.d.ts +4 -0
- package/dist/types/better-auth/components/better-auth-container.d.ts +4 -0
- package/dist/types/better-auth/components/better-auth-modal.d.ts +4 -0
- package/dist/types/better-auth/components/magic-link-form.d.ts +7 -0
- package/dist/types/better-auth/components/passkey-management.d.ts +6 -0
- package/dist/types/better-auth/components/passkey-signin.d.ts +12 -0
- package/dist/types/better-auth/components/two-factor-setup.d.ts +8 -0
- package/dist/types/better-auth/components/two-factor-verify.d.ts +10 -0
- package/dist/types/better-auth/i18n/default.d.ts +29 -0
- package/dist/types/better-auth/i18n/locales/en.d.ts +28 -0
- package/dist/types/better-auth/i18n/translations.d.ts +27 -0
- package/dist/types/better-auth/index.d.ts +22 -0
- package/dist/types/better-auth/provider.d.ts +6 -0
- package/dist/types/better-auth/session.d.ts +14 -0
- package/dist/types/better-auth/social-mapping.d.ts +2 -0
- package/dist/types/better-auth/types.d.ts +164 -0
- package/dist/types/components/auth/auth-container.d.ts +1 -1
- package/dist/types/components/auth/social-providers.d.ts +1 -1
- package/dist/types/components/auth/types.d.ts +2 -0
- package/dist/types/components/editor-toolbar/editor-toolbar-button.d.ts +16 -0
- package/dist/types/components/editor-toolbar/editor-toolbar-group.d.ts +9 -0
- package/dist/types/components/editor-toolbar/index.d.ts +2 -0
- package/dist/types/components/json-schema-display/display-widget-customization.d.ts +61 -0
- package/dist/types/components/json-schema-display/display-wrapper.d.ts +14 -0
- package/dist/types/components/json-schema-display/displays/any-display.d.ts +14 -0
- package/dist/types/components/json-schema-display/displays/array-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/boolean-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/composition-display.d.ts +14 -0
- package/dist/types/components/json-schema-display/displays/enum-const-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/generic-display.d.ts +18 -0
- package/dist/types/components/json-schema-display/displays/null-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/number-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/object-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/string-display.d.ts +14 -0
- package/dist/types/components/json-schema-display/index.d.ts +14 -0
- package/dist/types/components/json-schema-display/json-schema-display.d.ts +25 -0
- package/dist/types/components/json-schema-display/mismatch.d.ts +14 -0
- package/dist/types/components/json-structure/controls/control-utils.d.ts +19 -0
- package/dist/types/components/json-structure/controls/index.d.ts +1 -0
- package/dist/types/components/lexical/bare-editor.d.ts +29 -0
- package/dist/types/components/lexical/code/index.d.ts +1 -0
- package/dist/types/components/lexical/code/language-selector.d.ts +13 -0
- package/dist/types/components/lexical/contextual-editor.d.ts +22 -0
- package/dist/types/components/lexical/docked-editor.d.ts +23 -0
- package/dist/types/components/lexical/floating/block-handle.d.ts +16 -0
- package/dist/types/components/lexical/floating/floating-toolbar.d.ts +12 -0
- package/dist/types/components/lexical/floating/index.d.ts +6 -0
- package/dist/types/components/lexical/floating/slash-command-palette.d.ts +20 -0
- package/dist/types/components/lexical/index.d.ts +8 -0
- package/dist/types/components/lexical/lexical-editor-input.d.ts +30 -0
- package/dist/types/components/lexical/table/index.d.ts +1 -0
- package/dist/types/components/lexical/table/table-controls.d.ts +12 -0
- package/dist/types/components/lexical/toolbar/index.d.ts +6 -0
- package/dist/types/components/lexical/toolbar/lexical-toolbar.d.ts +12 -0
- package/dist/types/components/lexical/toolbar/toolbar-button.d.ts +1 -0
- package/dist/types/components/lexical/toolbar/toolbar-group.d.ts +1 -0
- package/dist/types/components/lexical/toolbar/toolbar-helpers.d.ts +30 -0
- package/dist/types/components/prosemirror/etoolbar-button.d.ts +1 -11
- package/dist/types/components/prosemirror/etoolbar-group.d.ts +1 -4
- package/dist/types/json-schema-display/index.d.ts +1 -0
- package/dist/types/lexical/commands/index.d.ts +17 -0
- package/dist/types/lexical/headless.d.ts +39 -0
- package/dist/types/lexical/horizontal-rule-node.d.ts +20 -0
- package/dist/types/lexical/index.d.ts +20 -0
- package/dist/types/lexical/lazy-loader.d.ts +35 -0
- package/dist/types/lexical/nodes.d.ts +29 -0
- package/dist/types/lexical/plugins/auto-link.d.ts +7 -0
- package/dist/types/lexical/plugins/clipboard.d.ts +11 -0
- package/dist/types/lexical/plugins/code-shiki.d.ts +11 -0
- package/dist/types/lexical/plugins/code.d.ts +7 -0
- package/dist/types/lexical/plugins/dragon.d.ts +6 -0
- package/dist/types/lexical/plugins/file-io.d.ts +10 -0
- package/dist/types/lexical/plugins/hashtag.d.ts +7 -0
- package/dist/types/lexical/plugins/history.d.ts +7 -0
- package/dist/types/lexical/plugins/horizontal-rule.d.ts +12 -0
- package/dist/types/lexical/plugins/html-io.d.ts +9 -0
- package/dist/types/lexical/plugins/index.d.ts +24 -0
- package/dist/types/lexical/plugins/link.d.ts +6 -0
- package/dist/types/lexical/plugins/list.d.ts +6 -0
- package/dist/types/lexical/plugins/mark.d.ts +15 -0
- package/dist/types/lexical/plugins/markdown-io.d.ts +13 -0
- package/dist/types/lexical/plugins/offset.d.ts +6 -0
- package/dist/types/lexical/plugins/overflow.d.ts +7 -0
- package/dist/types/lexical/plugins/plain-text.d.ts +6 -0
- package/dist/types/lexical/plugins/rich-text.d.ts +6 -0
- package/dist/types/lexical/plugins/selection.d.ts +6 -0
- package/dist/types/lexical/plugins/slash-commands.d.ts +26 -0
- package/dist/types/lexical/plugins/table.d.ts +11 -0
- package/dist/types/lexical/plugins/text.d.ts +13 -0
- package/dist/types/lexical/plugins/yjs.d.ts +9 -0
- package/dist/types/lexical/styles-url.d.ts +2 -0
- package/dist/types/lexical/styles.d.ts +2 -0
- package/dist/types/lexical/types.d.ts +634 -0
- package/dist/types/lexical-i18n/default.d.ts +92 -0
- package/dist/types/lexical-i18n/index.d.ts +21 -0
- package/dist/types/lexical-i18n/locales/ar.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/de.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/en.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/es.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/fa.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/fr.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/he.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/hi.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/it.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/ja.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/ko.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/nl.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/pl.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/pt.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/ru.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/tr.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/ur.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/vi.d.ts +91 -0
- package/dist/types/lexical-i18n/locales/zh.d.ts +91 -0
- package/dist/types/lexical-i18n/translations.d.ts +21 -0
- package/dist/{ur-DbEqQgS6.js → ur-B69X-xNs.js} +1 -1
- package/dist/{ur-BbnYJ3HS.cjs → ur-DyUSmIbo.cjs} +1 -1
- package/dist/use-animated-toggle-ChycsEoj.js +175 -0
- package/dist/use-animated-toggle-DR6CyMac.cjs +1 -0
- package/dist/use-form-B56E_x5Y.js +859 -0
- package/dist/use-form-Cnp3XQ5X.cjs +2 -0
- package/dist/utils-DEbsp9Q9.js +129 -0
- package/dist/utils-DIUEhA-Z.cjs +1 -0
- package/dist/{vi-CpZUeuSj.js → vi-BdzxA60L.js} +1 -1
- package/dist/{vi-ByBwvGQY.cjs → vi-CBmPaHxg.cjs} +1 -1
- package/dist/widget-customization-Dk7XcVly.cjs +1 -0
- package/dist/widget-customization-Ds9sicAg.js +1073 -0
- package/dist/{zh-DnxK0ieB.cjs → zh-Cb1b8uik.cjs} +1 -1
- package/dist/{zh-DJyhKO0I.js → zh-Dn1UJiZa.js} +1 -1
- package/package.json +59 -8
- package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
- package/dist/_commonjsHelpers-DwGv2jUC.cjs +0 -1
- package/dist/deep-merge-CBIkQM4E.cjs +0 -1
- package/dist/duration-input-DHWhQJnn.cjs +0 -1
- package/dist/modal-CSHIhHvI.js +0 -654
- package/dist/modal-cc8Ehngz.cjs +0 -1
- package/dist/notice-C_BWqu2K.cjs +0 -1
- package/dist/toolbar-D5FcnRju.cjs +0 -1
- package/dist/translations-0tLX4x7M.js +0 -866
- package/dist/translations-WPN3ibDg.cjs +0 -1
- package/dist/use-form-D4JFOcjo.cjs +0 -2
- package/dist/use-form-D4rqJkvG.js +0 -1731
- package/dist/widget-customization-BSjJz3_Y.js +0 -1195
- package/dist/widget-customization-CrFVrt4V.cjs +0 -1
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { prop as F, WithElement as V, Fragment as i, aria as m, OneOfValue as N, OnDispose as W, on as b, Value as L, attr as s, html as O, computedOf as R, dataAttr as U } from "@tempots/dom";
|
|
2
|
+
import { PopOver as j } from "@tempots/ui";
|
|
3
|
+
import { g as z } from "./timer-Rd2sKnvH.js";
|
|
4
|
+
import { u as G, A as J } from "./use-animated-toggle-ChycsEoj.js";
|
|
5
|
+
import { s as K } from "./session-id-3KiilioY.js";
|
|
6
|
+
function Q(f) {
|
|
7
|
+
const r = { fade: !0, scale: !0 };
|
|
8
|
+
return f.startsWith("top") ? (r.slide = "down", r.transformOrigin = "bottom") : f.startsWith("bottom") ? (r.slide = "up", r.transformOrigin = "top") : f.startsWith("left") ? (r.slide = "right", r.transformOrigin = "right") : f.startsWith("right") && (r.slide = "left", r.transformOrigin = "left"), r;
|
|
9
|
+
}
|
|
10
|
+
function B(f) {
|
|
11
|
+
const {
|
|
12
|
+
content: r,
|
|
13
|
+
placement: T = "top",
|
|
14
|
+
showDelay: P = 250,
|
|
15
|
+
hideDelay: C = 500,
|
|
16
|
+
mainAxisOffset: D = 8,
|
|
17
|
+
crossAxisOffset: $ = 0,
|
|
18
|
+
showOn: w = "hover-focus",
|
|
19
|
+
closable: v = !0,
|
|
20
|
+
arrow: E,
|
|
21
|
+
role: g,
|
|
22
|
+
hasPopup: x = "dialog"
|
|
23
|
+
} = f;
|
|
24
|
+
return j((A, h) => {
|
|
25
|
+
const a = G({
|
|
26
|
+
initialStatus: "closed"
|
|
27
|
+
}), I = K("flyout"), d = F(!1);
|
|
28
|
+
let y = null, p = null, S = !1;
|
|
29
|
+
function k() {
|
|
30
|
+
u != null && (clearTimeout(u), u = null), e != null && (clearTimeout(e), e = null), p && (p(), p = null), y && (document.removeEventListener("keydown", y), y = null), d.set(!1), S = !1;
|
|
31
|
+
}
|
|
32
|
+
function M() {
|
|
33
|
+
L.get(v) && (y = (o) => {
|
|
34
|
+
o.key === "Escape" && n();
|
|
35
|
+
}, document.addEventListener("keydown", y)), S = !0, d.set(!0), A({
|
|
36
|
+
placement: T ?? "top",
|
|
37
|
+
mainAxisOffset: D,
|
|
38
|
+
crossAxisOffset: $,
|
|
39
|
+
onClickOutside: () => {
|
|
40
|
+
L.get(v) && n();
|
|
41
|
+
},
|
|
42
|
+
arrow: E,
|
|
43
|
+
content: V((o) => {
|
|
44
|
+
a.setElement(o), p = z(() => {
|
|
45
|
+
a.open(), p = null;
|
|
46
|
+
});
|
|
47
|
+
const c = (l) => {
|
|
48
|
+
L.get(v) && l.key === "Escape" && (l.preventDefault(), l.stopPropagation(), n(), d.set(!1));
|
|
49
|
+
};
|
|
50
|
+
return document.addEventListener("keydown", c, !0), i(
|
|
51
|
+
W(() => {
|
|
52
|
+
k(), document.removeEventListener("keydown", c, !0);
|
|
53
|
+
}),
|
|
54
|
+
s.class("bc-flyout-container"),
|
|
55
|
+
s.id(I),
|
|
56
|
+
s.tabindex(-1),
|
|
57
|
+
// Make focusable for screen readers
|
|
58
|
+
O.div(
|
|
59
|
+
s.class("bc-flyout"),
|
|
60
|
+
J({
|
|
61
|
+
animation: L.map(T, Q),
|
|
62
|
+
status: a.status
|
|
63
|
+
}),
|
|
64
|
+
g ? s.role(g) : s.role("dialog"),
|
|
65
|
+
// Default to dialog role
|
|
66
|
+
r()
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
let u = null;
|
|
73
|
+
function t() {
|
|
74
|
+
if (u != null && (clearTimeout(u), u = null), e != null && (clearTimeout(e), e = null), a.isOpened.value || a.isOpening.value || a.isStartOpening.value)
|
|
75
|
+
return;
|
|
76
|
+
if (a.isClosing.value || a.isStartClosing.value) {
|
|
77
|
+
a.open();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const o = L.get(P);
|
|
81
|
+
u = setTimeout(() => {
|
|
82
|
+
u = null, M();
|
|
83
|
+
}, o);
|
|
84
|
+
}
|
|
85
|
+
let e = null;
|
|
86
|
+
function n() {
|
|
87
|
+
if (u != null && (clearTimeout(u), u = null), e != null && (clearTimeout(e), e = null), d.set(!1), p && (p(), p = null, S)) {
|
|
88
|
+
h(), k();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const o = L.get(C);
|
|
92
|
+
e = setTimeout(() => {
|
|
93
|
+
e = null, a.close(), a.listenOnClosed(() => {
|
|
94
|
+
h(), k();
|
|
95
|
+
});
|
|
96
|
+
}, o);
|
|
97
|
+
}
|
|
98
|
+
return V((o) => {
|
|
99
|
+
const c = () => {
|
|
100
|
+
t(), d.set(!0);
|
|
101
|
+
}, l = () => {
|
|
102
|
+
n(), d.set(!1);
|
|
103
|
+
}, _ = i(
|
|
104
|
+
m.expanded(d),
|
|
105
|
+
m.controls(I),
|
|
106
|
+
m.haspopup(
|
|
107
|
+
x
|
|
108
|
+
)
|
|
109
|
+
);
|
|
110
|
+
return typeof w == "function" ? i(
|
|
111
|
+
_,
|
|
112
|
+
w(c, l)
|
|
113
|
+
) : i(
|
|
114
|
+
_,
|
|
115
|
+
N(w, {
|
|
116
|
+
"hover-focus": () => i(
|
|
117
|
+
b.mouseenter(() => c()),
|
|
118
|
+
b.mouseleave(() => l()),
|
|
119
|
+
b.focus(() => c()),
|
|
120
|
+
b.blur(() => l())
|
|
121
|
+
),
|
|
122
|
+
hover: () => i(
|
|
123
|
+
b.mouseenter(() => c()),
|
|
124
|
+
b.mouseleave(() => l())
|
|
125
|
+
),
|
|
126
|
+
focus: () => i(
|
|
127
|
+
b.focus(() => c()),
|
|
128
|
+
b.blur(() => l())
|
|
129
|
+
),
|
|
130
|
+
click: () => {
|
|
131
|
+
function H() {
|
|
132
|
+
document.removeEventListener("click", q);
|
|
133
|
+
}
|
|
134
|
+
function q() {
|
|
135
|
+
H(), l();
|
|
136
|
+
}
|
|
137
|
+
return i(
|
|
138
|
+
W(H),
|
|
139
|
+
b.click(() => {
|
|
140
|
+
c(), z(() => {
|
|
141
|
+
document.addEventListener("click", q, {
|
|
142
|
+
once: !0
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
})
|
|
146
|
+
);
|
|
147
|
+
},
|
|
148
|
+
never: () => null
|
|
149
|
+
})
|
|
150
|
+
);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function se(f) {
|
|
155
|
+
const {
|
|
156
|
+
items: r,
|
|
157
|
+
placement: T = "bottom-start",
|
|
158
|
+
showDelay: P = 0,
|
|
159
|
+
hideDelay: C = 100,
|
|
160
|
+
mainAxisOffset: D = 4,
|
|
161
|
+
crossAxisOffset: $ = 0,
|
|
162
|
+
showOn: w = "click",
|
|
163
|
+
closable: v = !0,
|
|
164
|
+
onClose: E,
|
|
165
|
+
onAction: g,
|
|
166
|
+
ariaLabel: x,
|
|
167
|
+
ariaLabelledBy: A
|
|
168
|
+
} = f, h = K("menu"), a = F(-1), I = F([]);
|
|
169
|
+
let d = null;
|
|
170
|
+
return i(
|
|
171
|
+
B({
|
|
172
|
+
content: () => V((y) => {
|
|
173
|
+
d = document.activeElement;
|
|
174
|
+
const p = (t, e, n) => {
|
|
175
|
+
if (e.length === 0) return -1;
|
|
176
|
+
let o = t + n, c = 0;
|
|
177
|
+
for (; c < e.length; ) {
|
|
178
|
+
o >= e.length && (o = 0), o < 0 && (o = e.length - 1);
|
|
179
|
+
const l = e[o];
|
|
180
|
+
if (l && l.getAttribute("aria-disabled") !== "true")
|
|
181
|
+
return o;
|
|
182
|
+
o += n, c++;
|
|
183
|
+
}
|
|
184
|
+
return t;
|
|
185
|
+
}, S = (t) => {
|
|
186
|
+
const e = I.value, n = a.value;
|
|
187
|
+
switch (t.key) {
|
|
188
|
+
case "ArrowDown":
|
|
189
|
+
t.preventDefault(), t.stopPropagation();
|
|
190
|
+
const o = p(n, e, 1);
|
|
191
|
+
k(o, e);
|
|
192
|
+
break;
|
|
193
|
+
case "ArrowUp":
|
|
194
|
+
t.preventDefault(), t.stopPropagation();
|
|
195
|
+
const c = p(n, e, -1);
|
|
196
|
+
k(c, e);
|
|
197
|
+
break;
|
|
198
|
+
case "Enter":
|
|
199
|
+
case " ":
|
|
200
|
+
if (t.preventDefault(), t.stopPropagation(), n >= 0 && e[n]) {
|
|
201
|
+
const l = e[n];
|
|
202
|
+
if (l.getAttribute("aria-disabled") === "true")
|
|
203
|
+
return;
|
|
204
|
+
const _ = l.getAttribute("data-key");
|
|
205
|
+
_ && g && g(_), l.click(), E?.();
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
case "Escape":
|
|
209
|
+
E?.();
|
|
210
|
+
break;
|
|
211
|
+
case "Home":
|
|
212
|
+
t.preventDefault(), t.stopPropagation(), e.length > 0 && k(0, e);
|
|
213
|
+
break;
|
|
214
|
+
case "End":
|
|
215
|
+
t.preventDefault(), t.stopPropagation(), e.length > 0 && k(e.length - 1, e);
|
|
216
|
+
break;
|
|
217
|
+
case "ArrowRight":
|
|
218
|
+
if (t.preventDefault(), t.stopPropagation(), n >= 0 && e[n]) {
|
|
219
|
+
const l = e[n];
|
|
220
|
+
l.classList.contains(
|
|
221
|
+
"bc-menu-item--has-submenu"
|
|
222
|
+
) && l.dispatchEvent(new Event("mouseenter"));
|
|
223
|
+
}
|
|
224
|
+
break;
|
|
225
|
+
case "ArrowLeft":
|
|
226
|
+
t.preventDefault(), t.stopPropagation(), E?.();
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
}, k = (t, e) => {
|
|
230
|
+
a.value >= 0 && e[a.value] && (e[a.value].classList.remove(
|
|
231
|
+
"bc-menu-item--focused"
|
|
232
|
+
), e[a.value].removeAttribute("aria-selected")), t >= 0 && e[t] && (e[t].classList.add("bc-menu-item--focused"), e[t].setAttribute("aria-selected", "true"), a.set(t), typeof e[t].scrollIntoView == "function" && e[t].scrollIntoView({ block: "nearest" }));
|
|
233
|
+
}, M = () => {
|
|
234
|
+
const t = Array.from(
|
|
235
|
+
y.querySelectorAll('[role="menuitem"]')
|
|
236
|
+
);
|
|
237
|
+
if (I.set(t), t.length > 0) {
|
|
238
|
+
const e = t.findIndex(
|
|
239
|
+
(n) => n.getAttribute("aria-disabled") !== "true"
|
|
240
|
+
);
|
|
241
|
+
e >= 0 && k(e, t);
|
|
242
|
+
}
|
|
243
|
+
}, u = new MutationObserver(M);
|
|
244
|
+
return u.observe(y, { childList: !0, subtree: !0 }), setTimeout(() => {
|
|
245
|
+
M(), y.focus();
|
|
246
|
+
}, 0), document.addEventListener("keydown", S, !0), i(
|
|
247
|
+
W(() => {
|
|
248
|
+
u.disconnect(), document.removeEventListener("keydown", S, !0), d && d.focus();
|
|
249
|
+
}),
|
|
250
|
+
s.class("bc-menu"),
|
|
251
|
+
s.id(h),
|
|
252
|
+
s.role("menu"),
|
|
253
|
+
s.tabindex(-1),
|
|
254
|
+
m.orientation("vertical"),
|
|
255
|
+
x ? m.label(x) : i(),
|
|
256
|
+
A ? m.labelledby(A) : i(),
|
|
257
|
+
m.activedescendant(
|
|
258
|
+
a.map((t) => {
|
|
259
|
+
const e = I.value;
|
|
260
|
+
return t >= 0 && e[t] ? e[t].id || `${h}-item-${t}` : "";
|
|
261
|
+
})
|
|
262
|
+
),
|
|
263
|
+
b.click((t) => {
|
|
264
|
+
const n = t.target.closest(
|
|
265
|
+
'[role="menuitem"]'
|
|
266
|
+
);
|
|
267
|
+
if (n && n.getAttribute("aria-disabled") !== "true") {
|
|
268
|
+
const o = n.getAttribute("data-key");
|
|
269
|
+
o && g && g(o);
|
|
270
|
+
}
|
|
271
|
+
}),
|
|
272
|
+
// Live region for screen reader announcements
|
|
273
|
+
O.div(
|
|
274
|
+
s.class("sr-only"),
|
|
275
|
+
m.live("polite"),
|
|
276
|
+
m.atomic(!0),
|
|
277
|
+
a.map((t) => {
|
|
278
|
+
const e = I.value;
|
|
279
|
+
if (t >= 0 && e[t]) {
|
|
280
|
+
const n = e[t].textContent || "";
|
|
281
|
+
return e[t].getAttribute("aria-disabled") === "true" ? `${n}, disabled` : `${n}, ${t + 1} of ${e.length}`;
|
|
282
|
+
}
|
|
283
|
+
return "";
|
|
284
|
+
})
|
|
285
|
+
),
|
|
286
|
+
...r()
|
|
287
|
+
);
|
|
288
|
+
}),
|
|
289
|
+
placement: T,
|
|
290
|
+
showDelay: P,
|
|
291
|
+
hideDelay: C,
|
|
292
|
+
mainAxisOffset: D,
|
|
293
|
+
crossAxisOffset: $,
|
|
294
|
+
showOn: w,
|
|
295
|
+
closable: v,
|
|
296
|
+
role: "menu"
|
|
297
|
+
})
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
function oe(f) {
|
|
301
|
+
const {
|
|
302
|
+
key: r,
|
|
303
|
+
content: T,
|
|
304
|
+
startContent: P,
|
|
305
|
+
endContent: C,
|
|
306
|
+
disabled: D = !1,
|
|
307
|
+
onClick: $,
|
|
308
|
+
ariaLabel: w,
|
|
309
|
+
submenu: v,
|
|
310
|
+
submenuPlacement: E = "right-start"
|
|
311
|
+
} = f, g = r ?? K("menu-item"), x = `menu-item-${g}`, A = v != null;
|
|
312
|
+
return O.div(
|
|
313
|
+
s.class(
|
|
314
|
+
R(D)(
|
|
315
|
+
(h) => `bc-menu-item ${h ? "bc-menu-item--disabled" : ""} ${A ? "bc-menu-item--has-submenu" : ""}`
|
|
316
|
+
)
|
|
317
|
+
),
|
|
318
|
+
s.id(x),
|
|
319
|
+
s.role("menuitem"),
|
|
320
|
+
s.tabindex(-1),
|
|
321
|
+
U.key(g),
|
|
322
|
+
m.disabled(D),
|
|
323
|
+
m.selected(!1),
|
|
324
|
+
// Will be updated by focus management
|
|
325
|
+
A ? m.expanded(!1) : i(),
|
|
326
|
+
w ? m.label(w) : i(),
|
|
327
|
+
b.click((h) => {
|
|
328
|
+
if (L.get(D)) {
|
|
329
|
+
h.preventDefault(), h.stopPropagation();
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
$?.();
|
|
333
|
+
}),
|
|
334
|
+
// Start content
|
|
335
|
+
P && O.span(s.class("bc-menu-item__start"), P),
|
|
336
|
+
// Main content
|
|
337
|
+
O.span(s.class("bc-menu-item__content"), T),
|
|
338
|
+
// End content
|
|
339
|
+
C && O.span(s.class("bc-menu-item__end"), C),
|
|
340
|
+
// Submenu (if present)
|
|
341
|
+
A && v ? B({
|
|
342
|
+
content: () => i(
|
|
343
|
+
s.class("bc-menu bc-submenu"),
|
|
344
|
+
s.role("menu"),
|
|
345
|
+
...v()
|
|
346
|
+
),
|
|
347
|
+
placement: E,
|
|
348
|
+
showOn: "hover",
|
|
349
|
+
hasPopup: "menu",
|
|
350
|
+
showDelay: 100,
|
|
351
|
+
hideDelay: 300,
|
|
352
|
+
mainAxisOffset: 0,
|
|
353
|
+
crossAxisOffset: 0,
|
|
354
|
+
role: "menu"
|
|
355
|
+
}) : i()
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
function ae(f = {}) {
|
|
359
|
+
const { label: r } = f;
|
|
360
|
+
return O.div(
|
|
361
|
+
s.class("bc-menu-separator"),
|
|
362
|
+
s.role("separator"),
|
|
363
|
+
m.orientation("horizontal"),
|
|
364
|
+
r && O.span(s.class("bc-menu-separator__label"), r)
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
export {
|
|
368
|
+
B as F,
|
|
369
|
+
se as M,
|
|
370
|
+
ae as a,
|
|
371
|
+
oe as b
|
|
372
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("@tempots/dom"),W=require("@tempots/ui"),M=require("./timer-BJHOsuS6.cjs"),_=require("./use-animated-toggle-DR6CyMac.cjs"),C=require("./session-id-B5lJMzbB.cjs");function q(c){const l={fade:!0,scale:!0};return c.startsWith("top")?(l.slide="down",l.transformOrigin="bottom"):c.startsWith("bottom")?(l.slide="up",l.transformOrigin="top"):c.startsWith("left")?(l.slide="right",l.transformOrigin="right"):c.startsWith("right")&&(l.slide="left",l.transformOrigin="left"),l}function V(c){const{content:l,placement:A="top",showDelay:I=250,hideDelay:D=500,mainAxisOffset:k=8,crossAxisOffset:L=0,showOn:v="hover-focus",closable:g=!0,arrow:w,role:f,hasPopup:E="dialog"}=c;return W.PopOver((y,p)=>{const s=_.useAnimatedElementToggle({initialStatus:"closed"}),O=C.sessionId("flyout"),m=e.prop(!1);let b=null,d=null,F=!1;function h(){i!=null&&(clearTimeout(i),i=null),t!=null&&(clearTimeout(t),t=null),d&&(d(),d=null),b&&(document.removeEventListener("keydown",b),b=null),m.set(!1),F=!1}function P(){e.Value.get(g)&&(b=r=>{r.key==="Escape"&&a()},document.addEventListener("keydown",b)),F=!0,m.set(!0),y({placement:A??"top",mainAxisOffset:k,crossAxisOffset:L,onClickOutside:()=>{e.Value.get(g)&&a()},arrow:w,content:e.WithElement(r=>{s.setElement(r),d=M.g(()=>{s.open(),d=null});const u=o=>{e.Value.get(g)&&o.key==="Escape"&&(o.preventDefault(),o.stopPropagation(),a(),m.set(!1))};return document.addEventListener("keydown",u,!0),e.Fragment(e.OnDispose(()=>{h(),document.removeEventListener("keydown",u,!0)}),e.attr.class("bc-flyout-container"),e.attr.id(O),e.attr.tabindex(-1),e.html.div(e.attr.class("bc-flyout"),_.AnimatedToggleClass({animation:e.Value.map(A,q),status:s.status}),f?e.attr.role(f):e.attr.role("dialog"),l()))})})}let i=null;function n(){if(i!=null&&(clearTimeout(i),i=null),t!=null&&(clearTimeout(t),t=null),s.isOpened.value||s.isOpening.value||s.isStartOpening.value)return;if(s.isClosing.value||s.isStartClosing.value){s.open();return}const r=e.Value.get(I);i=setTimeout(()=>{i=null,P()},r)}let t=null;function a(){if(i!=null&&(clearTimeout(i),i=null),t!=null&&(clearTimeout(t),t=null),m.set(!1),d&&(d(),d=null,F)){p(),h();return}const r=e.Value.get(D);t=setTimeout(()=>{t=null,s.close(),s.listenOnClosed(()=>{p(),h()})},r)}return e.WithElement(r=>{const u=()=>{n(),m.set(!0)},o=()=>{a(),m.set(!1)},T=e.Fragment(e.aria.expanded(m),e.aria.controls(O),e.aria.haspopup(E));if(typeof v=="function")return e.Fragment(T,v(u,o));const $=v;return e.Fragment(T,e.OneOfValue($,{"hover-focus":()=>e.Fragment(e.on.mouseenter(()=>u()),e.on.mouseleave(()=>o()),e.on.focus(()=>u()),e.on.blur(()=>o())),hover:()=>e.Fragment(e.on.mouseenter(()=>u()),e.on.mouseleave(()=>o())),focus:()=>e.Fragment(e.on.focus(()=>u()),e.on.blur(()=>o())),click:()=>{function x(){document.removeEventListener("click",S)}function S(){x(),o()}return e.Fragment(e.OnDispose(x),e.on.click(()=>{u(),M.g(()=>{document.addEventListener("click",S,{once:!0})})}))},never:()=>null}))})})}function K(c){const{items:l,placement:A="bottom-start",showDelay:I=0,hideDelay:D=100,mainAxisOffset:k=4,crossAxisOffset:L=0,showOn:v="click",closable:g=!0,onClose:w,onAction:f,ariaLabel:E,ariaLabelledBy:y}=c,p=C.sessionId("menu"),s=e.prop(-1),O=e.prop([]);let m=null;return e.Fragment(V({content:()=>e.WithElement(b=>{m=document.activeElement;const d=(n,t,a)=>{if(t.length===0)return-1;let r=n+a,u=0;for(;u<t.length;){r>=t.length&&(r=0),r<0&&(r=t.length-1);const o=t[r];if(o&&o.getAttribute("aria-disabled")!=="true")return r;r+=a,u++}return n},F=n=>{const t=O.value,a=s.value;switch(n.key){case"ArrowDown":n.preventDefault(),n.stopPropagation();const r=d(a,t,1);h(r,t);break;case"ArrowUp":n.preventDefault(),n.stopPropagation();const u=d(a,t,-1);h(u,t);break;case"Enter":case" ":if(n.preventDefault(),n.stopPropagation(),a>=0&&t[a]){const o=t[a];if(o.getAttribute("aria-disabled")==="true")return;const T=o.getAttribute("data-key");T&&f&&f(T),o.click(),w?.()}break;case"Escape":w?.();break;case"Home":n.preventDefault(),n.stopPropagation(),t.length>0&&h(0,t);break;case"End":n.preventDefault(),n.stopPropagation(),t.length>0&&h(t.length-1,t);break;case"ArrowRight":if(n.preventDefault(),n.stopPropagation(),a>=0&&t[a]){const o=t[a];o.classList.contains("bc-menu-item--has-submenu")&&o.dispatchEvent(new Event("mouseenter"))}break;case"ArrowLeft":n.preventDefault(),n.stopPropagation(),w?.();break}},h=(n,t)=>{s.value>=0&&t[s.value]&&(t[s.value].classList.remove("bc-menu-item--focused"),t[s.value].removeAttribute("aria-selected")),n>=0&&t[n]&&(t[n].classList.add("bc-menu-item--focused"),t[n].setAttribute("aria-selected","true"),s.set(n),typeof t[n].scrollIntoView=="function"&&t[n].scrollIntoView({block:"nearest"}))},P=()=>{const n=Array.from(b.querySelectorAll('[role="menuitem"]'));if(O.set(n),n.length>0){const t=n.findIndex(a=>a.getAttribute("aria-disabled")!=="true");t>=0&&h(t,n)}},i=new MutationObserver(P);return i.observe(b,{childList:!0,subtree:!0}),setTimeout(()=>{P(),b.focus()},0),document.addEventListener("keydown",F,!0),e.Fragment(e.OnDispose(()=>{i.disconnect(),document.removeEventListener("keydown",F,!0),m&&m.focus()}),e.attr.class("bc-menu"),e.attr.id(p),e.attr.role("menu"),e.attr.tabindex(-1),e.aria.orientation("vertical"),E?e.aria.label(E):e.Fragment(),y?e.aria.labelledby(y):e.Fragment(),e.aria.activedescendant(s.map(n=>{const t=O.value;return n>=0&&t[n]?t[n].id||`${p}-item-${n}`:""})),e.on.click(n=>{const a=n.target.closest('[role="menuitem"]');if(a&&a.getAttribute("aria-disabled")!=="true"){const r=a.getAttribute("data-key");r&&f&&f(r)}}),e.html.div(e.attr.class("sr-only"),e.aria.live("polite"),e.aria.atomic(!0),s.map(n=>{const t=O.value;if(n>=0&&t[n]){const a=t[n].textContent||"";return t[n].getAttribute("aria-disabled")==="true"?`${a}, disabled`:`${a}, ${n+1} of ${t.length}`}return""})),...l())}),placement:A,showDelay:I,hideDelay:D,mainAxisOffset:k,crossAxisOffset:L,showOn:v,closable:g,role:"menu"}))}function H(c){const{key:l,content:A,startContent:I,endContent:D,disabled:k=!1,onClick:L,ariaLabel:v,submenu:g,submenuPlacement:w="right-start"}=c,f=l??C.sessionId("menu-item"),E=`menu-item-${f}`,y=g!=null;return e.html.div(e.attr.class(e.computedOf(k)(p=>`bc-menu-item ${p?"bc-menu-item--disabled":""} ${y?"bc-menu-item--has-submenu":""}`)),e.attr.id(E),e.attr.role("menuitem"),e.attr.tabindex(-1),e.dataAttr.key(f),e.aria.disabled(k),e.aria.selected(!1),y?e.aria.expanded(!1):e.Fragment(),v?e.aria.label(v):e.Fragment(),e.on.click(p=>{if(e.Value.get(k)){p.preventDefault(),p.stopPropagation();return}L?.()}),I&&e.html.span(e.attr.class("bc-menu-item__start"),I),e.html.span(e.attr.class("bc-menu-item__content"),A),D&&e.html.span(e.attr.class("bc-menu-item__end"),D),y&&g?V({content:()=>e.Fragment(e.attr.class("bc-menu bc-submenu"),e.attr.role("menu"),...g()),placement:w,showOn:"hover",hasPopup:"menu",showDelay:100,hideDelay:300,mainAxisOffset:0,crossAxisOffset:0,role:"menu"}):e.Fragment())}function z(c={}){const{label:l}=c;return e.html.div(e.attr.class("bc-menu-separator"),e.attr.role("separator"),e.aria.orientation("horizontal"),l&&e.html.span(e.attr.class("bc-menu-separator__label"),l))}exports.Flyout=V;exports.Menu=K;exports.MenuItem=H;exports.MenuSeparator=z;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("@tempots/dom"),S=require("./use-animated-toggle-DR6CyMac.cjs"),$=require("./timer-BJHOsuS6.cjs"),D=require("./session-id-B5lJMzbB.cjs"),q=require("./translations-B4-Zd2LM.cjs"),j=require("./use-form-Cnp3XQ5X.cjs"),B=require("./input-container-C6qEIjcA.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 _(u){return Array.from(u.querySelectorAll(W)).filter(e=>{const s=e;return s.offsetWidth>0&&s.offsetHeight>0&&!s.hasAttribute("inert")&&window.getComputedStyle(s).visibility!=="hidden"})}function V(u={}){const{active:e=!0,escapeDeactivates:s=!0,onEscape:t,initialFocus:a,returnFocus:i,clickOutsideDeactivates:c=!1,onClickOutside:d}=u;return n.WithElement(g=>{let h=e,f=null,l=[],b=null,p=null,m=null;typeof document<"u"&&(f=document.activeElement);const y=()=>{l=_(g)},C=r=>{if(h){if(s&&r.key==="Escape"){r.preventDefault(),t?.();return}if(r.key==="Tab"){if(y(),l.length===0){r.preventDefault();return}const o=l.indexOf(document.activeElement);r.shiftKey?o<=0&&(r.preventDefault(),l[l.length-1]?.focus()):o>=l.length-1&&(r.preventDefault(),l[0]?.focus())}}},v=r=>{if(!h||!c)return;const o=r.target;g.contains(o)||d?.()},x=()=>{if(!h)return;y();let r=null;typeof a=="function"?r=a():a?r=a:l.length>0&&(r=l[0]),r&&(p=setTimeout(()=>{p=null,r?.focus()},50)),document.addEventListener("keydown",C,!0),c&&document.addEventListener("click",v,!0)},w=()=>{h=!1,document.removeEventListener("keydown",C,!0),document.removeEventListener("click",v,!0);let r=null;typeof i=="function"?r=i():i?r=i:f&&(r=f),r&&document.body.contains(r)&&(m=setTimeout(()=>{m=null,r?.focus()},0))};return b=setTimeout(()=>{b=null,x()},0),n.OnDispose(()=>{b!=null&&clearTimeout(b),p!=null&&clearTimeout(p),m!=null&&clearTimeout(m),w()})})}function P(u={}){return{activate:()=>V({...u,active:!0}),deactivate:()=>V({...u,active:!1})}}function I(u){return{"~standard":{version:1,vendor:"beatui-custom",validate:s=>{const t=u.validate(s);return t.success?{value:t.data}:{issues:t.errors.map(a=>({message:a.message,path:a.path}))}},types:void 0},safeParse:s=>{const t=u.validate(s);return t.success?{success:!0,data:t.data}:{success:!1,error:{errors:t.errors.map(a=>({message:a.message,path:a.path?.map(i=>typeof i=="object"&&"key"in i?i.key.toString():i.toString())||[]}))}}}}}class k{optional(){return new U(this)}default(e){return new z(this,e)}schema(){return I(this)}}class E extends k{minLength;maxLength;pattern;customValidations=[];validate(e){if(typeof e!="string")return{success:!1,errors:[{message:"Expected string"}]};const s=[];this.minLength!==void 0&&e.length<this.minLength&&s.push({message:`Must be at least ${this.minLength} characters`}),this.maxLength!==void 0&&e.length>this.maxLength&&s.push({message:`Must be at most ${this.maxLength} characters`}),this.pattern&&!this.pattern.test(e)&&s.push({message:"Invalid format"});for(const t of this.customValidations){const a=t(e);a&&s.push({message:a})}return s.length>0?{success:!1,errors:s}:{success:!0,data:e}}min(e,s){const t=new E;return t.minLength=e,t.maxLength=this.maxLength,t.pattern=this.pattern,t.customValidations=[...this.customValidations],s&&t.customValidations.push(a=>a.length<e?s:null),t}max(e,s){const t=new E;return t.minLength=this.minLength,t.maxLength=e,t.pattern=this.pattern,t.customValidations=[...this.customValidations],s&&t.customValidations.push(a=>a.length>e?s:null),t}regex(e,s){const t=new E;return t.minLength=this.minLength,t.maxLength=this.maxLength,t.pattern=e,t.customValidations=[...this.customValidations],s&&t.customValidations.push(a=>e.test(a)?null:s),t}email(e="Please enter a valid email address"){const s=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,t=new E;return t.minLength=this.minLength,t.maxLength=this.maxLength,t.pattern=this.pattern,t.customValidations=[...this.customValidations,a=>s.test(a)?null:e],t}refine(e){const s=new E;return s.minLength=this.minLength,s.maxLength=this.maxLength,s.pattern=this.pattern,s.customValidations=[...this.customValidations,e],s}}class T extends k{mustBeTrue=!1;trueMessage;validate(e){return typeof e!="boolean"?{success:!1,errors:[{message:"Expected boolean"}]}:this.mustBeTrue&&e!==!0?{success:!1,errors:[{message:this.trueMessage||"Must be true"}]}:{success:!0,data:e}}refine(e,s){const t=new T;t.mustBeTrue=this.mustBeTrue,t.trueMessage=this.trueMessage;const a=t.validate.bind(t);return t.validate=i=>{const c=a(i);return c.success?e(c.data)?c:{success:!1,errors:[{message:s}]}:c},t}literal(e,s){const t=new T;return t.mustBeTrue=!0,t.trueMessage=s,t}}class U extends k{constructor(e){super(),this.inner=e}validate(e){if(e===void 0)return{success:!0,data:void 0};const s=this.inner.validate(e);return s.success?{success:!0,data:s.data}:{success:!1,errors:s.errors}}}class z extends k{constructor(e,s){super(),this.inner=e,this.defaultValue=s}validate(e){return e===void 0?{success:!0,data:this.defaultValue}:this.inner.validate(e)}}class F extends k{constructor(e){super(),this.shape=e}validate(e){if(typeof e!="object"||e===null||Array.isArray(e))return{success:!1,errors:[{message:"Expected object"}]};const s=e,t={},a=[];for(const[i,c]of Object.entries(this.shape)){const d=c.validate(s[i]);if(d.success)t[i]=d.data;else for(const g of d.errors)a.push({message:g.message,path:[i,...g.path||[]]})}return a.length>0?{success:!1,errors:a}:{success:!0,data:t}}refine(e,s){const t=new F(this.shape),a=t.validate.bind(t);return t.validate=i=>{const c=a(i);if(!c.success)return c;const d=e(c.data);return d?{success:!1,errors:[{message:d,path:s?.path}]}:{success:!0,data:c.data}},t}}const R=()=>new E,H=()=>new T,K=u=>new F(u);function O(u){return n.WithBrowserCtx(e=>{const s=[],t=()=>s.forEach(i=>i());return u(({effect:i="opaque",mode:c="capturing",onClickOutside:d,onEscape:g,content:h,container:f="body"})=>{f==="body"&&(e=e.makePortal("body"));const l=S.useAnimatedElementToggle();l.listenOnClosed(t);let b=()=>{},p=()=>{};const m=r=>{r.key==="Escape"&&(g?.(),l.close())},y=()=>{d?.(),l.close()},C=r=>{b(),p(),r==="capturing"?(document.addEventListener("keydown",m),b=()=>document.removeEventListener("keydown",m),e.element.addEventListener("mousedown",y),p=()=>e.element.removeEventListener("mousedown",y)):(b=()=>{},p=()=>{})},v=n.Value.on(c,C);s.push(v),s.push(()=>{l.dispose(),b(),p()});const x=()=>{const r=new Set;for(const o of e.element.querySelectorAll(":scope > :not([data-overlay])"))o.hasAttribute("inert")?r.add(o):o.setAttribute("inert","");return s.push(()=>{for(const o of e.element.querySelectorAll(":scope > :not([data-overlay])"))r.has(o)||o.removeAttribute("inert");r.clear()}),document.activeElement?.blur?.(),n.html.div(n.WithElement(o=>l.setElement(o)),n.dataAttr.status(l.status.map(String)),n.dataAttr.overlay("true"),n.attr.class(n.computedOf(i??"opaque",c)((o,L)=>`bc-overlay bc-overlay--effect-${o} bc-overlay--mode-${L}`)),h)},w=n.render(x(),e.element,{disposeWithParent:!0,clear:!1,providers:e.providers});s.push(w),$.g(()=>l.open())},t)})}function M(u,e){const{size:s="md",dismissable:t=!0,showCloseButton:a=!0,onClose:i,overlayEffect:c="opaque",container:d="body",position:g="center"}=u;return O((h,f)=>{let l=()=>{};return e(m=>{l=f;const y=n.prop("capturing");n.Value.on(t,o=>{y.set(o?"capturing":"non-capturing")});const C=n.computedOf(m.header!=null,a)((o,L)=>o||L),v=D.sessionId("modal"),x=`${v}-header`,w=`${v}-body`,r=n.html.div(n.attr.class(n.computedOf(s,g)((o,L)=>`bc-modal bc-modal--size-${o} bc-modal--container-${d} bc-modal--position-${L}`)),n.attr.role("dialog"),n.aria.modal(!0),...m.header?[n.aria.labelledby(x)]:[],n.aria.describedby(w),n.attr.tabindex(-1),n.attr.id(v),n.dataAttr.focusTrap("true"),n.on.mousedown(o=>o.stopPropagation()),V({escapeDeactivates:!1,initialFocus:()=>{const o=document.getElementById(v);if(!o)return null;const L=o.querySelector('[aria-label="Close modal"]');if(L)return L;const A=o.querySelector('button, input, select, textarea, [tabindex]:not([tabindex="-1"])');return A||o}}),n.html.div(n.attr.class("bc-modal__content"),n.When(C,()=>n.html.div(n.attr.class("bc-modal__header"),n.html.div(n.attr.class("bc-modal__title"),...m.header?[n.attr.id(x)]:[],m.header),n.When(a,()=>n.Use(q.BeatUII18n,o=>j.CloseButton({size:"sm",label:o.$.closeModal,onClick:()=>{l(),f()}}))))),n.html.div(n.attr.class("bc-modal__body"),n.attr.id(w),m.body),m.footer&&n.html.div(n.attr.class("bc-modal__footer"),m.footer)));h({mode:y,effect:c??"opaque",container:d,content:r,onClickOutside:()=>{i?.(),f()},onEscape:()=>{i?.(),f()}})},()=>{l(),f()})})}function G(u,e){const{confirmText:s,cancelText:t,onConfirm:a,onCancel:i,...c}=u;return n.Use(q.BeatUII18n,d=>M({showCloseButton:!1,...c},(g,h)=>{const f=()=>{a?.(),h()},l=()=>{i?.(),h()};return e(p=>{g({body:p,footer:n.Fragment(n.attr.class("bc-modal__actions"),B.Button({variant:"outline",onClick:l},n.coalesce(t,d.$.cancel)),B.Button({color:"primary",variant:"filled",onClick:f},n.coalesce(s,d.$.confirm)))})},h)}))}exports.BooleanValidator=T;exports.ConfirmModal=G;exports.FocusTrap=V;exports.Modal=M;exports.ObjectValidator=F;exports.Overlay=O;exports.StringValidator=E;exports.boolean=H;exports.createStandardSchema=I;exports.object=K;exports.string=R;exports.useFocusTrap=P;
|