@tempots/beatui 0.38.0 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/{2019-DxwU2aOm.cjs → 2019-1S9vgvv2.cjs} +1 -1
  2. package/dist/{2019-CGWicU9n.js → 2019-DPD_eCKE.js} +2 -2
  3. package/dist/{2020-DHep9dU6.cjs → 2020-CGrbEEmD.cjs} +1 -1
  4. package/dist/{2020-BRNvbMGL.js → 2020-aLm9VmDL.js} +2 -2
  5. package/dist/{ar-CqAHPRKu.cjs → ar-B0vT_MPe.cjs} +1 -1
  6. package/dist/{ar-avevuYiW.js → ar-CbM09z5P.js} +1 -1
  7. package/dist/auth/index.cjs.js +1 -1
  8. package/dist/auth/index.es.js +4 -4
  9. package/dist/beatui.css +385 -55
  10. package/dist/beatui.tailwind.css +385 -55
  11. package/dist/{de-Cz7ah611.js → de-Dd907tZQ.js} +1 -1
  12. package/dist/{de--4OtRESW.cjs → de-tK36cL_u.cjs} +1 -1
  13. package/dist/{es-CiNQQzF1.js → es-BkJxjMdG.js} +1 -1
  14. package/dist/{es-CE1wRgxl.cjs → es-K35LRZa-.cjs} +1 -1
  15. package/dist/{fa-DjuJZNLK.cjs → fa-BBikwwku.cjs} +1 -1
  16. package/dist/{fa-Gkt0b9XN.js → fa-DBTUBsw_.js} +1 -1
  17. package/dist/{fr-DotyzMGL.cjs → fr-DMtXrrnJ.cjs} +1 -1
  18. package/dist/{fr-xM9p9Q6G.js → fr-Fmupo556.js} +1 -1
  19. package/dist/{he-CoO6PsiS.js → he-DkI64oaY.js} +1 -1
  20. package/dist/{he-BQ6ygVEQ.cjs → he-on3Ivp8g.cjs} +1 -1
  21. package/dist/{hi-BCfJ0mRh.cjs → hi-CNFV8ITE.cjs} +1 -1
  22. package/dist/{hi-DA3-4Cdo.js → hi-GdD5MihT.js} +1 -1
  23. package/dist/{index-CesoPnvj.cjs → index-B-SyWyCc.cjs} +1 -1
  24. package/dist/{index-DJJ67-RV.js → index-B-pudlMv.js} +58 -58
  25. package/dist/{index-CCu0qfNP.cjs → index-BA93M8Ux.cjs} +1 -1
  26. package/dist/{index-C2rz3G1d.js → index-BK8t6gqu.js} +3 -3
  27. package/dist/{index-C_nSdynJ.js → index-BfFlhmAq.js} +1 -1
  28. package/dist/{index-i9pAnFtS.js → index-BkQ7xHgi.js} +5 -5
  29. package/dist/{index-CZQHL_pf.cjs → index-CPBlySmE.cjs} +1 -1
  30. package/dist/{index-D41aREgo.js → index-LUItEwlw.js} +1 -1
  31. package/dist/{index-Dtqe3URb.cjs → index-e8oQ-k0x.cjs} +2 -2
  32. package/dist/{index-C5-BM51Y.cjs → index-wdi93sK4.cjs} +1 -1
  33. package/dist/index.cjs.js +4 -4
  34. package/dist/index.es.js +3075 -2812
  35. package/dist/{it-pv2Gm3jb.cjs → it-BDOzBRkQ.cjs} +1 -1
  36. package/dist/{it-EdPuWBJR.js → it-Bpnfd60V.js} +1 -1
  37. package/dist/{ja-CuRaPMgh.cjs → ja-N-7c7zD7.cjs} +1 -1
  38. package/dist/{ja-BSRCR430.js → ja-SjlGNgs9.js} +1 -1
  39. package/dist/json-schema/index.cjs.js +1 -1
  40. package/dist/json-schema/index.es.js +1 -1
  41. package/dist/{ko-C7YP1PL4.cjs → ko-BBeTXIlY.cjs} +1 -1
  42. package/dist/{ko-Dm4oD1fh.js → ko-CH69ZNts.js} +1 -1
  43. package/dist/modal-BD76Rve3.js +633 -0
  44. package/dist/modal-DQycMZ8_.cjs +1 -0
  45. package/dist/{nl-ClCD6lP-.cjs → nl-C2C9QDH2.cjs} +1 -1
  46. package/dist/{nl-B0l1kdfd.js → nl-DnvMlW8v.js} +1 -1
  47. package/dist/notice-CFoc4PJe.cjs +2 -0
  48. package/dist/{notice-BuYqG6zM.js → notice-CQZseCQs.js} +366 -359
  49. package/dist/{pl-DVKneBSY.js → pl-CBEX2qN1.js} +1 -1
  50. package/dist/{pl-fyCkqVrr.cjs → pl-sNBCzEUd.cjs} +1 -1
  51. package/dist/prosemirror/index.cjs.js +1 -1
  52. package/dist/prosemirror/index.es.js +1 -1
  53. package/dist/{pt-BHExG3lf.cjs → pt-Bvxg9VEA.cjs} +1 -1
  54. package/dist/{pt-Bw0sTDOX.js → pt-ByFqFAdQ.js} +1 -1
  55. package/dist/{ru-B26VQ4f9.js → ru-6d5JfoDw.js} +1 -1
  56. package/dist/{ru-PuEOLDw1.cjs → ru-CPAdsn4m.cjs} +1 -1
  57. package/dist/tailwind/index.cjs.js +1 -1
  58. package/dist/tailwind/index.es.js +1 -1
  59. package/dist/tailwind/preset.cjs.js +1 -1
  60. package/dist/tailwind/preset.es.js +1 -1
  61. package/dist/tailwind/vite-plugin.cjs.js +1 -1
  62. package/dist/tailwind/vite-plugin.es.js +1 -1
  63. package/dist/{toolbar-ClJbaKID.js → toolbar-Cl_TAa3r.js} +1 -1
  64. package/dist/{toolbar-kwkvH3nX.cjs → toolbar-Dw2VQD9y.cjs} +1 -1
  65. package/dist/{tr-CI97fTpD.cjs → tr-IKZtCQQR.cjs} +1 -1
  66. package/dist/{tr-DQMivdvy.js → tr-gv4vJfm8.js} +1 -1
  67. package/dist/{translations-ZB5oDFId.cjs → translations-CK426qyd.cjs} +1 -1
  68. package/dist/translations-DJR65Jii.cjs +1 -0
  69. package/dist/{translations-1yD6Rm5l.js → translations-DXLmnUiB.js} +1 -1
  70. package/dist/{translations-iam7PITs.js → translations-djDSPqdb.js} +56 -73
  71. package/dist/types/components/beatui.d.ts +4 -1
  72. package/dist/types/components/button/button.d.ts +4 -3
  73. package/dist/types/components/form/input/input-wrapper.d.ts +2 -1
  74. package/dist/types/components/misc/index.d.ts +4 -0
  75. package/dist/types/components/misc/notification-provider.d.ts +47 -0
  76. package/dist/types/components/misc/notification.d.ts +17 -0
  77. package/dist/types/components/misc/opengraph.d.ts +111 -0
  78. package/dist/types/components/navigation/link/button-link.d.ts +2 -0
  79. package/dist/types/components/overlay/lightbox.d.ts +1 -1
  80. package/dist/types/components/overlay/modal.d.ts +2 -2
  81. package/dist/types/components/overlay/ribbon.d.ts +2 -2
  82. package/dist/types/utils/use-animated-toggle.d.ts +30 -9
  83. package/dist/{ur-B3CiO8KH.cjs → ur-Bgq_2yjr.cjs} +1 -1
  84. package/dist/{ur-o3rog5MJ.js → ur-Bo6bjEBS.js} +1 -1
  85. package/dist/{utils-BD6NGV1v.cjs → utils-Bsrfm-0d.cjs} +1 -1
  86. package/dist/{utils-B_QSuN66.js → utils-Bw911Eo4.js} +2 -2
  87. package/dist/{vi-FibsLfdk.cjs → vi-BrUQnj-8.cjs} +1 -1
  88. package/dist/{vi-C7cb2K_B.js → vi-xDLJ3TIx.js} +1 -1
  89. package/dist/{zh-NGrfqAHM.js → zh-BivWxJJh.js} +1 -1
  90. package/dist/{zh-BtSj_Euh.cjs → zh-BqH1Cioq.cjs} +1 -1
  91. package/package.json +3 -3
  92. package/dist/modal--1g8Y5LH.js +0 -601
  93. package/dist/modal-mA_AFUCI.cjs +0 -1
  94. package/dist/notice-DCuZEAQO.cjs +0 -2
  95. package/dist/translations-DQxg-W9w.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./translations-DQxg-W9w.cjs"),c={loadingExtended:"正在加载,请稍候",loadingShort:"加载中...",locale:"语言",iconDescription:"图标",loadingIcon:"加载图标",failedToLoadIcon:"图标加载失败",editLabel:"编辑",selectOne:"选择一个",selectMany:"选择多个",noResults:"无结果",passwordPlaceholderText:"密码",togglePasswordVisibility:"切换密码可见性",toggleMenu:"切换菜单",toggleAside:"切换侧边栏",mainNavigation:"主导航",sidebar:"侧边栏",closeDrawer:"关闭抽屉",closeModal:"关闭模态框",confirm:"确认",cancel:"取消",addLabel:"添加",removeItem:"删除项目",currentLocale:"简体中文",ar:"阿拉伯语",de:"德语",en:"英语",es:"西班牙语",fr:"法语",hi:" Hindi",it:"意大利语",ja:"日语",ko:"韩语",nl:"荷兰语",pl:"波兰语",pt:"葡萄牙语",ru:"俄语",tr:"土耳其语",vi:"越南语",zh:"简体中文",he:"希伯来语",fa:"波斯语",ur:"乌尔都语",emailPlaceholderText:"请输入邮箱",incrementValue:"增加值",decrementValue:"减少值",dropZoneInstructions:e=>e?"点击选择或将文件拖拽到此处,或按 Enter 或空格键打开文件选择器":"将文件拖拽到此处",fileSizeUnits:["字节","KB","MB","GB","TB"],removeFile:"删除文件",clearAllFiles:"清除所有文件",clearValue:"清除值",unknownType:"未知类型",filesInputInstructions:(e,t,l)=>{let n=(e==null||e>1,"点击选择或将文件拖拽到此处");if(e||t){const o=[];if(e!=null&&e>1&&o.push(`最多${e}个文件`),t&&l){const i=r.formatFileSize(t,{units:l});o.push(`每个最大${i}`)}o.length>0&&(n+=` (${o.join(",")})`)}else if(t&&l){const o=r.formatFileSize(t,{units:l});n+=` (最大${o})`}return n},prosemirror:{bold:"Bold",italic:"Italic",code:"Code",link:"Link",removeLink:"Remove Link",heading:e=>`Heading ${e}`,bulletList:"Bullet List",orderedList:"Ordered List",blockquote:"Blockquote",codeBlock:"Code Block",horizontalRule:"Horizontal Rule",linkUrlPlaceholder:"https://example.com"}};exports.default=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./translations-DJR65Jii.cjs"),c={loadingExtended:"正在加载,请稍候",loadingShort:"加载中...",locale:"语言",iconDescription:"图标",loadingIcon:"加载图标",failedToLoadIcon:"图标加载失败",editLabel:"编辑",selectOne:"选择一个",selectMany:"选择多个",noResults:"无结果",passwordPlaceholderText:"密码",togglePasswordVisibility:"切换密码可见性",toggleMenu:"切换菜单",toggleAside:"切换侧边栏",mainNavigation:"主导航",sidebar:"侧边栏",closeDrawer:"关闭抽屉",closeModal:"关闭模态框",confirm:"确认",cancel:"取消",addLabel:"添加",removeItem:"删除项目",currentLocale:"简体中文",ar:"阿拉伯语",de:"德语",en:"英语",es:"西班牙语",fr:"法语",hi:" Hindi",it:"意大利语",ja:"日语",ko:"韩语",nl:"荷兰语",pl:"波兰语",pt:"葡萄牙语",ru:"俄语",tr:"土耳其语",vi:"越南语",zh:"简体中文",he:"希伯来语",fa:"波斯语",ur:"乌尔都语",emailPlaceholderText:"请输入邮箱",incrementValue:"增加值",decrementValue:"减少值",dropZoneInstructions:e=>e?"点击选择或将文件拖拽到此处,或按 Enter 或空格键打开文件选择器":"将文件拖拽到此处",fileSizeUnits:["字节","KB","MB","GB","TB"],removeFile:"删除文件",clearAllFiles:"清除所有文件",clearValue:"清除值",unknownType:"未知类型",filesInputInstructions:(e,t,l)=>{let n=(e==null||e>1,"点击选择或将文件拖拽到此处");if(e||t){const o=[];if(e!=null&&e>1&&o.push(`最多${e}个文件`),t&&l){const i=r.formatFileSize(t,{units:l});o.push(`每个最大${i}`)}o.length>0&&(n+=` (${o.join(",")})`)}else if(t&&l){const o=r.formatFileSize(t,{units:l});n+=` (最大${o})`}return n},prosemirror:{bold:"Bold",italic:"Italic",code:"Code",link:"Link",removeLink:"Remove Link",heading:e=>`Heading ${e}`,bulletList:"Bullet List",orderedList:"Ordered List",blockquote:"Blockquote",codeBlock:"Code Block",horizontalRule:"Horizontal Rule",linkUrlPlaceholder:"https://example.com"}};exports.default=c;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/beatui",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",
@@ -110,9 +110,9 @@
110
110
  "registry": "https://registry.npmjs.org/"
111
111
  },
112
112
  "peerDependencies": {
113
- "@tempots/dom": "31.5.0",
113
+ "@tempots/dom": "31.6.0",
114
114
  "@tempots/std": "0.24.0",
115
- "@tempots/ui": "10.6.0",
115
+ "@tempots/ui": "10.7.0",
116
116
  "tailwindcss": "4.1.14"
117
117
  },
118
118
  "peerDependenciesMeta": {
@@ -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
- };
@@ -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;