@chain-ui/core 0.1.2 → 0.2.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 (38) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.css +1 -1
  3. package/dist/index.js +1042 -266
  4. package/dist/src/components/checkbox/checkbox.d.ts +40 -0
  5. package/dist/src/components/checkbox/checkbox.stories.d.ts +29 -0
  6. package/dist/src/components/checkbox/checkbox.test.d.ts +1 -0
  7. package/dist/src/components/checkbox/index.d.ts +2 -0
  8. package/dist/src/components/index.d.ts +7 -0
  9. package/dist/src/components/message/index.d.ts +2 -0
  10. package/dist/src/components/message/message.d.ts +16 -0
  11. package/dist/src/components/message/message.stories.d.ts +18 -0
  12. package/dist/src/components/message/message.test.d.ts +1 -0
  13. package/dist/src/components/notification/index.d.ts +2 -0
  14. package/dist/src/components/notification/notification.d.ts +18 -0
  15. package/dist/src/components/notification/notification.stories.d.ts +18 -0
  16. package/dist/src/components/notification/notification.test.d.ts +1 -0
  17. package/dist/src/components/popover/index.d.ts +2 -0
  18. package/dist/src/components/popover/popover.d.ts +23 -0
  19. package/dist/src/components/popover/popover.stories.d.ts +18 -0
  20. package/dist/src/components/popover/popover.test.d.ts +1 -0
  21. package/dist/src/components/radio/index.d.ts +2 -0
  22. package/dist/src/components/radio/radio.d.ts +37 -0
  23. package/dist/src/components/radio/radio.stories.d.ts +28 -0
  24. package/dist/src/components/radio/radio.test.d.ts +1 -0
  25. package/dist/src/components/switch/index.d.ts +2 -0
  26. package/dist/src/components/switch/switch.d.ts +14 -0
  27. package/dist/src/components/switch/switch.stories.d.ts +24 -0
  28. package/dist/src/components/switch/switch.test.d.ts +1 -0
  29. package/dist/src/components/tooltip/index.d.ts +2 -0
  30. package/dist/src/components/tooltip/tooltip.d.ts +20 -0
  31. package/dist/src/components/tooltip/tooltip.stories.d.ts +19 -0
  32. package/dist/src/components/tooltip/tooltip.test.d.ts +1 -0
  33. package/dist/src/utils/icons.d.ts +1 -0
  34. package/dist/src/utils/index.d.ts +5 -1
  35. package/dist/src/utils/portal.d.ts +13 -0
  36. package/dist/src/utils/position.d.ts +7 -0
  37. package/package.json +4 -1
  38. package/dist/index.d.ts +0 -1
package/dist/index.js CHANGED
@@ -159,157 +159,157 @@ function g(e, t) {
159
159
  return e === t.value;
160
160
  }
161
161
  var _ = t(function({ value: e, defaultValue: t, onChange: i, options: a = [], variant: c = "outline", size: f = "md", status: p = "default", disabled: m = !1, loading: h = !1, allowClear: _ = !1, placeholder: v = "Please select", mode: y = "single", showSearch: b = !1, prefix: x, suffix: S, emptyText: C = "暂无数据", clearAriaLabel: w = "Clear selection", searchPlaceholder: T = "Search", expandAriaLabel: E = "Expand", collapseAriaLabel: D = "Collapse", removeAriaLabel: O = "Remove", dropdownClassName: k, dropdownStyle: A, getPopupContainer: j, className: M, style: N, ...P }, F) {
162
- let I = e !== void 0, [ee, te] = s(t ?? (y === "multiple" ? [] : "")), L = I ? e : ee, [R, z] = s(!1), [B, V] = s(-1), [H, U] = s(""), [W, ne] = s({
162
+ let I = e !== void 0, [L, R] = s(t ?? (y === "multiple" ? [] : "")), z = I ? e : L, [B, V] = s(!1), [H, U] = s(-1), [W, G] = s(""), [K, ee] = s({
163
163
  top: 0,
164
164
  left: 0,
165
165
  width: 0
166
- }), G = o(null), re = o(null), ie = o(null), K = o(null), q = m || h, J = n((e, t) => {
167
- I || te(e), i?.(e, t);
168
- }, [I, i]), ae = a.filter((e) => y === "multiple" && Array.isArray(L) ? L.some((t) => g(t, e)) : g(L, e)), oe = b && H ? a.filter((e) => String(e.label).toLowerCase().includes(H.toLowerCase())) : a, Y = oe.filter((e) => !e.disabled), X = n(() => {
169
- if (!G.current) return;
170
- let e = G.current.getBoundingClientRect();
171
- ne({
166
+ }), q = o(null), te = o(null), J = o(null), Y = o(null), X = m || h, Z = n((e, t) => {
167
+ I || R(e), i?.(e, t);
168
+ }, [I, i]), ne = a.filter((e) => y === "multiple" && Array.isArray(z) ? z.some((t) => g(t, e)) : g(z, e)), re = b && W ? a.filter((e) => String(e.label).toLowerCase().includes(W.toLowerCase())) : a, Q = re.filter((e) => !e.disabled), ie = n(() => {
169
+ if (!q.current) return;
170
+ let e = q.current.getBoundingClientRect();
171
+ ee({
172
172
  top: e.bottom + 4,
173
173
  left: e.left,
174
174
  width: e.width
175
175
  });
176
- }, []), Z = n(() => {
177
- q || (X(), z(!0), V(-1), U(""));
178
- }, [q, X]), Q = n(() => {
179
- z(!1), V(-1), U("");
180
- }, []), $ = n((e, t) => {
176
+ }, []), ae = n(() => {
177
+ X || (ie(), V(!0), U(-1), G(""));
178
+ }, [X, ie]), $ = n(() => {
179
+ V(!1), U(-1), G("");
180
+ }, []), oe = n((e, t) => {
181
181
  if (!e.disabled) if (y === "multiple") {
182
- let n = Array.isArray(L) ? L : [];
183
- J(n.some((t) => g(t, e)) ? n.filter((t) => !g(t, e)) : [...n, e.value], t);
184
- } else J(e.value, t), Q();
182
+ let n = Array.isArray(z) ? z : [];
183
+ Z(n.some((t) => g(t, e)) ? n.filter((t) => !g(t, e)) : [...n, e.value], t);
184
+ } else Z(e.value, t), $();
185
185
  }, [
186
186
  y,
187
- L,
188
- J,
189
- Q
187
+ z,
188
+ Z,
189
+ $
190
190
  ]), se = n((e) => {
191
- e.stopPropagation(), J(y === "multiple" ? [] : "", e);
192
- }, [y, J]), ce = n((e, t) => {
193
- t.stopPropagation(), y === "multiple" && Array.isArray(L) && J(L.filter((t) => !g(t, e)), t);
191
+ e.stopPropagation(), Z(y === "multiple" ? [] : "", e);
192
+ }, [y, Z]), ce = n((e, t) => {
193
+ t.stopPropagation(), y === "multiple" && Array.isArray(z) && Z(z.filter((t) => !g(t, e)), t);
194
194
  }, [
195
195
  y,
196
- L,
197
- J
196
+ z,
197
+ Z
198
198
  ]), le = () => {
199
- if (y === "multiple" && Array.isArray(L) && L.length > 0) return null;
200
- if (y === "single" && L !== "" && L !== void 0) {
201
- let e = a.find((e) => g(L, e));
202
- return e ? e.label : String(L);
199
+ if (y === "multiple" && Array.isArray(z) && z.length > 0) return null;
200
+ if (y === "single" && z !== "" && z !== void 0) {
201
+ let e = a.find((e) => g(z, e));
202
+ return e ? e.label : String(z);
203
203
  }
204
204
  return null;
205
205
  }, ue = n(() => {
206
- q || (R ? Q() : Z());
206
+ X || (B ? $() : ae());
207
207
  }, [
208
- q,
209
- R,
210
- Z,
211
- Q
208
+ X,
209
+ B,
210
+ ae,
211
+ $
212
212
  ]), de = n((e) => {
213
- if (!q) switch (e.key) {
213
+ if (!X) switch (e.key) {
214
214
  case "Enter":
215
215
  case " ":
216
- e.preventDefault(), R ? B >= 0 && B < Y.length && $(Y[B], e) : Z();
216
+ e.preventDefault(), B ? H >= 0 && H < Q.length && oe(Q[H], e) : ae();
217
217
  break;
218
218
  case "ArrowDown":
219
- e.preventDefault(), R ? V((e) => e < Y.length - 1 ? e + 1 : 0) : (Z(), V(0));
219
+ e.preventDefault(), B ? U((e) => e < Q.length - 1 ? e + 1 : 0) : (ae(), U(0));
220
220
  break;
221
221
  case "ArrowUp":
222
- e.preventDefault(), R && V((e) => e > 0 ? e - 1 : Y.length - 1);
222
+ e.preventDefault(), B && U((e) => e > 0 ? e - 1 : Q.length - 1);
223
223
  break;
224
224
  case "Escape":
225
- e.preventDefault(), Q(), G.current?.focus();
225
+ e.preventDefault(), $(), q.current?.focus();
226
226
  break;
227
227
  case "Tab":
228
- R && Q();
228
+ B && $();
229
229
  break;
230
230
  }
231
231
  }, [
232
- q,
233
- R,
232
+ X,
234
233
  B,
235
- Y,
236
- $,
237
- Z,
238
- Q
234
+ H,
235
+ Q,
236
+ oe,
237
+ ae,
238
+ $
239
239
  ]), fe = n((e, t) => {
240
- $(e, t);
241
- }, [$]), pe = n((e) => {
240
+ oe(e, t);
241
+ }, [oe]), pe = n((e) => {
242
242
  se(e);
243
243
  }, [se]), me = n((e) => {
244
- U(e.target.value), V(-1);
244
+ G(e.target.value), U(-1);
245
245
  }, []);
246
246
  r(() => {
247
- if (!R) return;
247
+ if (!B) return;
248
248
  let e = (e) => {
249
249
  let t = e.target;
250
- re.current?.contains(t) || G.current?.contains(t) || Q();
250
+ te.current?.contains(t) || q.current?.contains(t) || $();
251
251
  };
252
252
  return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
253
- }, [R, Q]), r(() => {
254
- if (!R) return;
255
- let e = () => X();
253
+ }, [B, $]), r(() => {
254
+ if (!B) return;
255
+ let e = () => ie();
256
256
  return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
257
257
  window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
258
258
  };
259
- }, [R, X]), r(() => {
260
- R && b && requestAnimationFrame(() => ie.current?.focus());
261
- }, [R, b]), r(() => {
262
- if (B < 0 || !K.current) return;
263
- let e = K.current.querySelectorAll(".chain-select__item")[B];
259
+ }, [B, ie]), r(() => {
260
+ B && b && requestAnimationFrame(() => J.current?.focus());
261
+ }, [B, b]), r(() => {
262
+ if (H < 0 || !Y.current) return;
263
+ let e = Y.current.querySelectorAll(".chain-select__item")[H];
264
264
  e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
265
- }, [B]);
266
- let he = _ && !q && (y === "multiple" ? Array.isArray(L) && L.length > 0 : L !== "" && L !== void 0), ge = [
265
+ }, [H]);
266
+ let he = _ && !X && (y === "multiple" ? Array.isArray(z) && z.length > 0 : z !== "" && z !== void 0), ge = [
267
267
  "chain-select",
268
268
  `chain-select--${c}`,
269
269
  `chain-select--${f}`,
270
270
  p !== "default" && `chain-select--${p}`,
271
- q && "chain-select--disabled",
271
+ X && "chain-select--disabled",
272
272
  h && "chain-select--loading",
273
273
  y === "multiple" && "chain-select--multiple",
274
- R && "chain-select--open",
274
+ B && "chain-select--open",
275
275
  M
276
276
  ].filter(Boolean).join(" "), _e = le(), ve = () => {
277
- if (!R) return null;
277
+ if (!B) return null;
278
278
  let e = j?.() ?? document.body;
279
279
  return d(/* @__PURE__ */ u("div", {
280
- ref: re,
280
+ ref: te,
281
281
  className: ["chain-select__dropdown", k].filter(Boolean).join(" "),
282
282
  style: {
283
- top: W.top,
284
- left: W.left,
285
- width: W.width,
283
+ top: K.top,
284
+ left: K.left,
285
+ width: K.width,
286
286
  ...A
287
287
  },
288
288
  children: [b && /* @__PURE__ */ l("div", {
289
289
  className: "chain-select__search",
290
290
  children: /* @__PURE__ */ l("input", {
291
- ref: ie,
291
+ ref: J,
292
292
  className: "chain-select__search-input",
293
293
  placeholder: T,
294
- value: H,
294
+ value: W,
295
295
  onChange: me,
296
296
  role: "searchbox",
297
297
  onClick: (e) => e.stopPropagation()
298
298
  })
299
- }), oe.length === 0 ? /* @__PURE__ */ l("div", {
299
+ }), re.length === 0 ? /* @__PURE__ */ l("div", {
300
300
  className: "chain-select__empty",
301
301
  children: C
302
302
  }) : /* @__PURE__ */ l("ul", {
303
- ref: K,
303
+ ref: Y,
304
304
  className: "chain-select__list",
305
305
  role: "listbox",
306
- children: oe.map((e, t) => {
307
- let n = y === "multiple" && Array.isArray(L) ? L.some((t) => g(t, e)) : g(L, e);
306
+ children: re.map((e, t) => {
307
+ let n = y === "multiple" && Array.isArray(z) ? z.some((t) => g(t, e)) : g(z, e);
308
308
  return /* @__PURE__ */ u("li", {
309
309
  className: [
310
310
  "chain-select__item",
311
311
  n && "chain-select__item--selected",
312
- t === B && "chain-select__item--highlighted",
312
+ t === H && "chain-select__item--highlighted",
313
313
  e.disabled && "chain-select__item--disabled"
314
314
  ].filter(Boolean).join(" "),
315
315
  role: "option",
@@ -319,7 +319,7 @@ var _ = t(function({ value: e, defaultValue: t, onChange: i, options: a = [], va
319
319
  e.disabled || fe(e, t);
320
320
  },
321
321
  onMouseEnter: () => {
322
- e.disabled || V(t);
322
+ e.disabled || U(t);
323
323
  },
324
324
  children: [/* @__PURE__ */ l("span", { children: e.label }), n && /* @__PURE__ */ l("span", {
325
325
  className: "chain-select__item-check",
@@ -337,13 +337,13 @@ var _ = t(function({ value: e, defaultValue: t, onChange: i, options: a = [], va
337
337
  style: N,
338
338
  ...P,
339
339
  children: [/* @__PURE__ */ u("div", {
340
- ref: G,
340
+ ref: q,
341
341
  className: "chain-select__trigger",
342
342
  role: "combobox",
343
- "aria-expanded": R,
343
+ "aria-expanded": B,
344
344
  "aria-haspopup": "listbox",
345
- "aria-disabled": q || void 0,
346
- tabIndex: q ? -1 : 0,
345
+ "aria-disabled": X || void 0,
346
+ tabIndex: X ? -1 : 0,
347
347
  onClick: ue,
348
348
  onKeyDown: de,
349
349
  children: [
@@ -353,9 +353,9 @@ var _ = t(function({ value: e, defaultValue: t, onChange: i, options: a = [], va
353
353
  }),
354
354
  /* @__PURE__ */ l("div", {
355
355
  className: "chain-select__trigger-inner",
356
- children: y === "multiple" && Array.isArray(L) && L.length > 0 ? /* @__PURE__ */ l("div", {
356
+ children: y === "multiple" && Array.isArray(z) && z.length > 0 ? /* @__PURE__ */ l("div", {
357
357
  className: "chain-select__tags",
358
- children: ae.map((e) => /* @__PURE__ */ u("span", {
358
+ children: ne.map((e) => /* @__PURE__ */ u("span", {
359
359
  className: "chain-select__tag",
360
360
  children: [/* @__PURE__ */ l("span", { children: e.label }), /* @__PURE__ */ l("button", {
361
361
  type: "button",
@@ -385,7 +385,7 @@ var _ = t(function({ value: e, defaultValue: t, onChange: i, options: a = [], va
385
385
  "aria-hidden": "true"
386
386
  }) : /* @__PURE__ */ l("span", {
387
387
  className: "chain-select__arrow",
388
- "aria-label": R ? D : E,
388
+ "aria-label": B ? D : E,
389
389
  children: "▼"
390
390
  }),
391
391
  S && /* @__PURE__ */ l("span", {
@@ -395,193 +395,310 @@ var _ = t(function({ value: e, defaultValue: t, onChange: i, options: a = [], va
395
395
  ]
396
396
  }), ve()]
397
397
  });
398
- }), v = {
398
+ });
399
+ function v(e, t, n) {
400
+ let r = window.scrollX ?? window.pageXOffset, i = window.scrollY ?? window.pageYOffset, a = e.left + r, o = e.top + i, s = e.width, c = e.height, l = t.width, u = t.height, [d, f] = n.split("-"), p = 0, m = 0;
401
+ switch (d) {
402
+ case "top":
403
+ p = o - u - 10;
404
+ break;
405
+ case "bottom":
406
+ p = o + c + 10;
407
+ break;
408
+ case "left":
409
+ m = a - l - 10;
410
+ break;
411
+ case "right":
412
+ m = a + s + 10;
413
+ break;
414
+ }
415
+ return (d === "top" || d === "bottom") && (m = f === "start" ? a : f === "end" ? a + s - l : a + s / 2 - l / 2), (d === "left" || d === "right") && (p = f === "start" ? o : f === "end" ? o + c - u : o + c / 2 - u / 2), {
416
+ top: p,
417
+ left: m
418
+ };
419
+ }
420
+ //#endregion
421
+ //#region src/utils/icons.ts
422
+ var y = {
423
+ success: "✓",
424
+ error: "✗",
425
+ warning: "!",
426
+ info: "ℹ"
427
+ };
428
+ //#endregion
429
+ //#region src/utils/portal.tsx
430
+ function b(e, t = {}) {
431
+ let { duration: n = 200, onExited: i } = t, [a, c] = s(e), [l, u] = s(e), [d, f] = s(!1), p = o(void 0), m = o(i);
432
+ return m.current = i, r(() => {
433
+ if (e) c(!0), f(!1), requestAnimationFrame(() => u(!0));
434
+ else if (a) return u(!1), f(!0), p.current = setTimeout(() => {
435
+ f(!1), c(!1), m.current?.();
436
+ }, n), () => clearTimeout(p.current);
437
+ }, [e]), r(() => () => clearTimeout(p.current), []), {
438
+ mounted: a,
439
+ animating: l,
440
+ closing: d
441
+ };
442
+ }
443
+ function x({ getContainer: e, children: t }) {
444
+ return d(t, e?.() ?? document.body);
445
+ }
446
+ //#endregion
447
+ //#region ../hooks/dist/index.js
448
+ function S({ mounted: e, animating: t, closing: n }, r = {}) {
449
+ let { duration: i = 200, easing: a = "ease", from: o = 0, to: s = 1 } = r;
450
+ return e ? {
451
+ opacity: t && !n ? s : o,
452
+ transition: `opacity ${i}ms ${a}`
453
+ } : { opacity: o };
454
+ }
455
+ function C({ mounted: e, animating: t, closing: n }, r = {}) {
456
+ let { duration: i = 200, easing: a = "ease", from: o = .9, to: s = 1 } = r;
457
+ return e ? {
458
+ transform: t && !n ? `scale(${s})` : `scale(${o})`,
459
+ transition: `transform ${i}ms ${a}`
460
+ } : { transform: `scale(${o})` };
461
+ }
462
+ function w(e) {
463
+ return typeof e == "number" ? `${e}px` : e;
464
+ }
465
+ function T(e, t) {
466
+ switch (e) {
467
+ case "up": return {
468
+ x: 0,
469
+ y: t
470
+ };
471
+ case "down": return {
472
+ x: 0,
473
+ y: -t
474
+ };
475
+ case "left": return {
476
+ x: t,
477
+ y: 0
478
+ };
479
+ case "right": return {
480
+ x: -t,
481
+ y: 0
482
+ };
483
+ }
484
+ }
485
+ function E({ mounted: e, animating: t, closing: n }, r = {}) {
486
+ let { duration: i = 250, easing: a = "ease", direction: o = "down", distance: s = 16 } = r, c = r.from ?? T(o, s), l = r.to ?? {
487
+ x: 0,
488
+ y: 0
489
+ };
490
+ if (!e) return { transform: `translate(${w(c.x)}, ${w(c.y)})` };
491
+ let u = t && !n ? l : c;
492
+ return {
493
+ transform: `translate(${w(u.x)}, ${w(u.y)})`,
494
+ transition: `transform ${i}ms ${a}`
495
+ };
496
+ }
497
+ function D(...e) {
498
+ let t = {}, n = [];
499
+ for (let r of e) for (let e of Object.keys(r)) if (e === "transition") {
500
+ let t = r[e];
501
+ typeof t == "string" && t && n.push(t);
502
+ } else t[e] = r[e];
503
+ return n.length > 0 && (t.transition = n.join(", ")), t;
504
+ }
505
+ //#endregion
506
+ //#region src/components/modal/modal.tsx
507
+ var O = {
399
508
  sm: "400px",
400
509
  md: "520px",
401
510
  lg: "720px"
402
- }, y = "a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", b = t(function({ open: e = !1, onCancel: t, title: a, children: c, footer: p, onOk: m, okText: h = "确定", okButtonProps: g, cancelText: _ = "取消", cancelButtonProps: b, confirmLoading: x = !1, closable: S = !0, closeAriaLabel: C = "Close", maskClosable: w = !0, keyboard: T = !0, destroyOnClose: E = !1, size: D = "md", width: O, centered: k = !1, getContainer: A, className: j, style: M, ...N }, P) {
403
- let F = i(), [I, ee] = s(!1), [te, L] = s(!1), [R, z] = s(!1), B = o(null), V = o(null), H = o(null), U = o(0), W = e || I, ne = n((e) => {
404
- B.current = e, typeof P == "function" ? P(e) : P && (P.current = e);
405
- }, [P]);
406
- r(() => {
407
- if (e) H.current = document.activeElement, requestAnimationFrame(() => {
408
- ee(!0);
409
- });
410
- else {
411
- L(!0);
412
- let e = setTimeout(() => {
413
- L(!1), ee(!1);
414
- }, 250);
415
- return () => clearTimeout(e);
511
+ }, k = "a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", A = t(function({ open: e = !1, onCancel: t, title: a, children: c, footer: d, onOk: p, okText: m = "确定", okButtonProps: h, cancelText: g = "取消", cancelButtonProps: _, confirmLoading: v = !1, closable: y = !0, closeAriaLabel: w = "Close", maskClosable: T = !0, keyboard: E = !0, destroyOnClose: A = !1, size: j = "md", width: M, centered: N = !1, getContainer: P, className: F, style: I, ...L }, R) {
512
+ let z = i(), B = b(e, {
513
+ duration: 250,
514
+ onExited: () => {
515
+ J.current &&= (J.current.focus(), null);
416
516
  }
517
+ }), { mounted: V, animating: H, closing: U } = B, W = S(B, { duration: 250 }), G = D(S(B, { duration: 250 }), C(B, {
518
+ from: .95,
519
+ duration: 250
520
+ })), [K, ee] = s(!1), q = o(null), te = o(null), J = o(null), Y = o(0), X = V, Z = n((e) => {
521
+ q.current = e, typeof R == "function" ? R(e) : R && (R.current = e);
522
+ }, [R]);
523
+ r(() => {
524
+ e && (J.current = document.activeElement);
417
525
  }, [e]), r(() => {
418
- if (!W) return;
526
+ if (!X) return;
419
527
  let e = window.innerWidth - document.documentElement.clientWidth;
420
- U.current = e;
528
+ Y.current = e;
421
529
  let t = document.body.style.overflow, n = document.body.style.paddingRight;
422
530
  return document.body.style.overflow = "hidden", e > 0 && (document.body.style.paddingRight = `${e}px`), () => {
423
531
  document.body.style.overflow = t, document.body.style.paddingRight = n;
424
532
  };
425
- }, [W]), r(() => {
426
- if (!W) return;
533
+ }, [X]), r(() => {
534
+ if (!X) return;
427
535
  let e = setTimeout(() => {
428
- V.current?.focus();
536
+ te.current?.focus();
429
537
  }, 50);
430
538
  return () => clearTimeout(e);
431
- }, [W]), r(() => {
432
- !W && H.current && (H.current.focus(), H.current = null);
433
- }, [W]), r(() => {
434
- if (!W || !T) return;
539
+ }, [X]), r(() => {
540
+ if (!X || !E) return;
435
541
  let e = (e) => {
436
542
  e.key === "Escape" && t?.();
437
543
  };
438
544
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
439
545
  }, [
440
- W,
441
- T,
546
+ X,
547
+ E,
442
548
  t
443
549
  ]);
444
- let G = n((e) => {
445
- w && e.target === e.currentTarget && t?.();
446
- }, [w, t]), re = n(async () => {
447
- if (!m) return;
448
- let e = m();
550
+ let ne = n((e) => {
551
+ T && e.target === e.currentTarget && t?.();
552
+ }, [T, t]), re = n(async () => {
553
+ if (!p) return;
554
+ let e = p();
449
555
  if (e instanceof Promise) {
450
- z(!0);
556
+ ee(!0);
451
557
  try {
452
- await e, z(!1), t?.();
558
+ await e, ee(!1), t?.();
453
559
  } catch {
454
- z(!1);
560
+ ee(!1);
455
561
  }
456
562
  }
457
- }, [m, t]), ie = n((e) => {
563
+ }, [p, t]), Q = n((e) => {
458
564
  if (e.key !== "Tab") return;
459
- let t = V.current;
565
+ let t = te.current;
460
566
  if (!t) return;
461
- let n = t.querySelectorAll(y);
567
+ let n = t.querySelectorAll(k);
462
568
  if (n.length === 0) {
463
569
  e.preventDefault();
464
570
  return;
465
571
  }
466
572
  let r = n[0], i = n[n.length - 1];
467
573
  e.shiftKey ? document.activeElement === r && (e.preventDefault(), i.focus()) : document.activeElement === i && (e.preventDefault(), r.focus());
468
- }, []), K = O ?? v[D] ?? v.md, q = x || R, J = [
574
+ }, []), ie = M ?? O[j] ?? O.md, ae = v || K, $ = [
469
575
  "chain-modal",
470
- I && !te && "chain-modal--open",
471
- te && "chain-modal--hidden",
472
- k && "chain-modal--centered",
473
- j
576
+ N && "chain-modal--centered",
577
+ F
474
578
  ].filter(Boolean).join(" ");
475
- return !W && E ? null : d(/* @__PURE__ */ u("div", {
476
- ref: ne,
477
- className: J,
478
- style: M,
479
- role: "dialog",
480
- "aria-modal": "true",
481
- "aria-labelledby": a ? F : void 0,
482
- ...N,
483
- children: [/* @__PURE__ */ l("div", {
484
- className: "chain-modal__mask",
485
- onMouseDown: G
486
- }), /* @__PURE__ */ l("div", {
487
- className: "chain-modal__wrap",
488
- children: /* @__PURE__ */ u("div", {
489
- ref: V,
490
- className: "chain-modal__content",
491
- tabIndex: -1,
492
- style: { width: typeof K == "number" ? `${K}px` : K },
493
- onKeyDown: ie,
494
- children: [
495
- a !== void 0 || S ? /* @__PURE__ */ u("div", {
496
- className: "chain-modal__header",
497
- children: [a && /* @__PURE__ */ l("h2", {
498
- id: F,
499
- className: "chain-modal__title",
500
- children: a
501
- }), S && /* @__PURE__ */ l("button", {
502
- type: "button",
503
- className: "chain-modal__close",
504
- "aria-label": C,
505
- onClick: t,
506
- children: "×"
507
- })]
508
- }) : null,
509
- c && /* @__PURE__ */ l("div", {
510
- className: "chain-modal__body",
511
- children: c
512
- }),
513
- p === void 0 ? p === null ? null : /* @__PURE__ */ u("div", {
514
- className: "chain-modal__footer",
515
- children: [/* @__PURE__ */ l(f, {
516
- ...b,
517
- onClick: t,
518
- children: _
519
- }), /* @__PURE__ */ l(f, {
520
- variant: "solid",
521
- color: "primary",
522
- ...g,
523
- loading: q,
524
- onClick: re,
525
- children: h
526
- })]
527
- }) : p
528
- ]
529
- })
530
- })]
531
- }), A?.() ?? document.body);
579
+ return !X && A ? null : /* @__PURE__ */ l(x, {
580
+ getContainer: P,
581
+ children: /* @__PURE__ */ u("div", {
582
+ ref: Z,
583
+ className: $,
584
+ style: {
585
+ pointerEvents: X ? "auto" : "none",
586
+ ...I
587
+ },
588
+ role: "dialog",
589
+ "aria-modal": "true",
590
+ "aria-labelledby": a ? z : void 0,
591
+ ...L,
592
+ children: [/* @__PURE__ */ l("div", {
593
+ className: "chain-modal__mask",
594
+ style: {
595
+ ...W,
596
+ pointerEvents: H && !U ? "auto" : "none"
597
+ },
598
+ onMouseDown: ne
599
+ }), /* @__PURE__ */ l("div", {
600
+ className: "chain-modal__wrap",
601
+ children: /* @__PURE__ */ u("div", {
602
+ ref: te,
603
+ className: "chain-modal__content",
604
+ tabIndex: -1,
605
+ style: {
606
+ ...G,
607
+ width: typeof ie == "number" ? `${ie}px` : ie
608
+ },
609
+ onKeyDown: Q,
610
+ children: [
611
+ a !== void 0 || y ? /* @__PURE__ */ u("div", {
612
+ className: "chain-modal__header",
613
+ children: [a && /* @__PURE__ */ l("h2", {
614
+ id: z,
615
+ className: "chain-modal__title",
616
+ children: a
617
+ }), y && /* @__PURE__ */ l("button", {
618
+ type: "button",
619
+ className: "chain-modal__close",
620
+ "aria-label": w,
621
+ onClick: t,
622
+ children: "×"
623
+ })]
624
+ }) : null,
625
+ c && /* @__PURE__ */ l("div", {
626
+ className: "chain-modal__body",
627
+ children: c
628
+ }),
629
+ d === void 0 ? d === null ? null : /* @__PURE__ */ u("div", {
630
+ className: "chain-modal__footer",
631
+ children: [/* @__PURE__ */ l(f, {
632
+ ..._,
633
+ onClick: t,
634
+ children: g
635
+ }), /* @__PURE__ */ l(f, {
636
+ variant: "solid",
637
+ color: "primary",
638
+ ...h,
639
+ loading: ae,
640
+ onClick: re,
641
+ children: m
642
+ })]
643
+ }) : d
644
+ ]
645
+ })
646
+ })]
647
+ })
648
+ });
532
649
  });
533
650
  //#endregion
534
651
  //#region src/components/table/table.tsx
535
- function x(e, t, n) {
652
+ function j(e, t, n) {
536
653
  if (typeof n == "function") return n(e);
537
654
  let r = e[n];
538
655
  return String(r ?? t);
539
656
  }
540
- function S(e, t) {
657
+ function M(e, t) {
541
658
  if (t != null) return Array.isArray(t) ? t.reduce((e, t) => {
542
659
  if (typeof e == "object" && e) return e[t];
543
660
  }, e) : e[t];
544
661
  }
545
- var C = t(function({ dataSource: e, columns: t, rowKey: r = "key", rowSelection: i, loading: o = !1, emptyText: s = "暂无数据", pagination: c, bordered: d = !0, size: p = "md", locale: m, scroll: h, onRow: g, className: _, style: v, ...y }, b) {
546
- let C = {
662
+ var N = t(function({ dataSource: e, columns: t, rowKey: r = "key", rowSelection: i, loading: o = !1, emptyText: s = "暂无数据", pagination: c, bordered: d = !0, size: p = "md", locale: m, scroll: h, onRow: g, className: _, style: v, ...y }, b) {
663
+ let x = {
547
664
  total: m?.total ?? "共",
548
665
  items: m?.items ?? "条",
549
666
  prevPage: m?.prevPage ?? "上一页",
550
667
  nextPage: m?.nextPage ?? "下一页"
551
- }, w = i?.type === "radio", T = i != null, E = a(() => i?.selectedRowKeys ?? [], [i?.selectedRowKeys]), D = n(() => {
668
+ }, S = i?.type === "radio", C = i != null, w = a(() => i?.selectedRowKeys ?? [], [i?.selectedRowKeys]), T = n(() => {
552
669
  if (!i) return;
553
- let t = e.filter((e) => !i.getCheckboxProps?.(e)?.disabled).map((e, t) => x(e, t, r));
554
- if (w) return;
555
- let n = t.every((e) => E.includes(e)), a;
556
- if (n) a = E.filter((e) => !t.includes(e));
670
+ let t = e.filter((e) => !i.getCheckboxProps?.(e)?.disabled).map((e, t) => j(e, t, r));
671
+ if (S) return;
672
+ let n = t.every((e) => w.includes(e)), a;
673
+ if (n) a = w.filter((e) => !t.includes(e));
557
674
  else {
558
- let e = new Set(E);
675
+ let e = new Set(w);
559
676
  t.forEach((t) => e.add(t)), a = Array.from(e);
560
677
  }
561
- let o = e.filter((e, t) => a.includes(x(e, t, r)));
678
+ let o = e.filter((e, t) => a.includes(j(e, t, r)));
562
679
  i.onChange?.(a, o), i.onSelect?.(e[0], !n, o);
563
680
  }, [
564
681
  i,
565
682
  e,
566
- E,
567
683
  w,
684
+ S,
568
685
  r
569
- ]), O = n((t, n) => {
686
+ ]), E = n((t, n) => {
570
687
  if (!i) return;
571
- let a = x(t, n, r), o, s = E.includes(a);
572
- if (w) {
688
+ let a = j(t, n, r), o, s = w.includes(a);
689
+ if (S) {
573
690
  if (s) return;
574
691
  o = [a];
575
- } else o = s ? E.filter((e) => e !== a) : [...E, a];
576
- let c = e.filter((e, t) => o.includes(x(e, t, r)));
692
+ } else o = s ? w.filter((e) => e !== a) : [...w, a];
693
+ let c = e.filter((e, t) => o.includes(j(e, t, r)));
577
694
  i.onChange?.(o, c), i.onSelect?.(t, !s, c);
578
695
  }, [
579
696
  i,
580
697
  e,
581
- E,
582
698
  w,
699
+ S,
583
700
  r
584
- ]), k = e.map((e, t) => i?.getCheckboxProps?.(e)?.disabled ? null : x(e, t, r)).filter(Boolean), A = k.length > 0 && k.every((e) => E.includes(e)), j = E.some((e) => k.includes(e)) && !A, M = c ? c.current ?? 1 : 1, N = c ? c.pageSize ?? 10 : 10, P = c ? c.total ?? e.length : e.length, F = Math.max(1, Math.ceil(P / N)), I = n((e) => {
701
+ ]), D = e.map((e, t) => i?.getCheckboxProps?.(e)?.disabled ? null : j(e, t, r)).filter(Boolean), O = D.length > 0 && D.every((e) => w.includes(e)), k = w.some((e) => D.includes(e)) && !O, A = c ? c.current ?? 1 : 1, N = c ? c.pageSize ?? 10 : 10, P = c ? c.total ?? e.length : e.length, F = Math.max(1, Math.ceil(P / N)), I = n((e) => {
585
702
  c && c.onChange?.(e, N);
586
703
  }, [c, N]);
587
704
  return /* @__PURE__ */ u("div", {
@@ -606,23 +723,23 @@ var C = t(function({ dataSource: e, columns: t, rowKey: r = "key", rowSelection:
606
723
  children: /* @__PURE__ */ u("table", {
607
724
  className: "chain-table__table",
608
725
  children: [
609
- /* @__PURE__ */ u("colgroup", { children: [T && /* @__PURE__ */ l("col", { style: { width: 48 } }), t.map((e) => /* @__PURE__ */ l("col", { style: { width: e.width } }, e.key))] }),
726
+ /* @__PURE__ */ u("colgroup", { children: [C && /* @__PURE__ */ l("col", { style: { width: 48 } }), t.map((e) => /* @__PURE__ */ l("col", { style: { width: e.width } }, e.key))] }),
610
727
  /* @__PURE__ */ l("thead", {
611
728
  className: "chain-table__header",
612
729
  children: /* @__PURE__ */ u("tr", {
613
730
  className: "chain-table__header-row",
614
- children: [T && /* @__PURE__ */ l("th", {
731
+ children: [C && /* @__PURE__ */ l("th", {
615
732
  className: "chain-table__selection chain-table__header-cell",
616
733
  role: "columnheader",
617
- children: !w && /* @__PURE__ */ l("span", {
734
+ children: !S && /* @__PURE__ */ l("span", {
618
735
  className: "chain-table__checkbox",
619
736
  children: /* @__PURE__ */ l("input", {
620
737
  type: "checkbox",
621
- checked: A,
738
+ checked: O,
622
739
  ref: (e) => {
623
- e && (e.indeterminate = j);
740
+ e && (e.indeterminate = k);
624
741
  },
625
- onChange: D,
742
+ onChange: T,
626
743
  "aria-label": "Select all"
627
744
  })
628
745
  })
@@ -639,13 +756,13 @@ var C = t(function({ dataSource: e, columns: t, rowKey: r = "key", rowSelection:
639
756
  className: "chain-table__row",
640
757
  children: /* @__PURE__ */ l("td", {
641
758
  className: "chain-table__cell chain-table__empty",
642
- colSpan: t.length + +!!T,
759
+ colSpan: t.length + +!!C,
643
760
  role: "status",
644
761
  "aria-live": "polite",
645
762
  children: s
646
763
  })
647
764
  }) : e.map((e, n) => {
648
- let a = x(e, n, r), o = E.includes(a), s = i?.getCheckboxProps?.(e)?.disabled ?? !1, c = g?.(e, n);
765
+ let a = j(e, n, r), o = w.includes(a), s = i?.getCheckboxProps?.(e)?.disabled ?? !1, c = g?.(e, n);
649
766
  return /* @__PURE__ */ u("tr", {
650
767
  className: [
651
768
  "chain-table__row",
@@ -655,22 +772,22 @@ var C = t(function({ dataSource: e, columns: t, rowKey: r = "key", rowSelection:
655
772
  role: "row",
656
773
  onClick: c?.onClick,
657
774
  onDoubleClick: c?.onDoubleClick,
658
- children: [T && /* @__PURE__ */ l("td", {
775
+ children: [C && /* @__PURE__ */ l("td", {
659
776
  className: "chain-table__selection chain-table__cell",
660
777
  role: "cell",
661
778
  children: /* @__PURE__ */ l("span", {
662
779
  className: "chain-table__checkbox",
663
780
  children: /* @__PURE__ */ l("input", {
664
- type: w ? "radio" : "checkbox",
665
- name: w ? "chain-table-radio" : void 0,
781
+ type: S ? "radio" : "checkbox",
782
+ name: S ? "chain-table-radio" : void 0,
666
783
  checked: o,
667
784
  disabled: s,
668
- onChange: () => O(e, n),
785
+ onChange: () => E(e, n),
669
786
  "aria-label": i.selectAriaLabel ?? "Select row"
670
787
  })
671
788
  })
672
789
  }), t.map((t) => {
673
- let r = S(e, t.dataIndex), i = t.render ? t.render(r, e, n) : r == null ? "-" : String(r);
790
+ let r = M(e, t.dataIndex), i = t.render ? t.render(r, e, n) : r == null ? "-" : String(r);
674
791
  return /* @__PURE__ */ l("td", {
675
792
  className: [
676
793
  "chain-table__cell",
@@ -697,38 +814,38 @@ var C = t(function({ dataSource: e, columns: t, rowKey: r = "key", rowSelection:
697
814
  children: [/* @__PURE__ */ u("span", {
698
815
  className: "chain-table__pagination-total",
699
816
  children: [
700
- C.total,
817
+ x.total,
701
818
  " ",
702
819
  P,
703
820
  " ",
704
- C.items
821
+ x.items
705
822
  ]
706
823
  }), /* @__PURE__ */ u("div", {
707
824
  className: "chain-table__pagination-nav",
708
825
  children: [
709
826
  /* @__PURE__ */ l(f, {
710
827
  size: "sm",
711
- disabled: M <= 1,
712
- onClick: () => I(M - 1),
713
- children: C.prevPage
828
+ disabled: A <= 1,
829
+ onClick: () => I(A - 1),
830
+ children: x.prevPage
714
831
  }),
715
832
  /* @__PURE__ */ u("span", { children: [
716
- M,
833
+ A,
717
834
  " / ",
718
835
  F
719
836
  ] }),
720
837
  /* @__PURE__ */ l(f, {
721
838
  size: "sm",
722
- disabled: M >= F,
723
- onClick: () => I(M + 1),
724
- children: C.nextPage
839
+ disabled: A >= F,
840
+ onClick: () => I(A + 1),
841
+ children: x.nextPage
725
842
  })
726
843
  ]
727
844
  })]
728
845
  })
729
846
  ]
730
847
  });
731
- }), w = t(function({ color: e = "default", variant: t = "light", size: n = "md", closable: r = !1, onClose: i, children: a, className: o, ...s }, c) {
848
+ }), P = t(function({ color: e = "default", variant: t = "light", size: n = "md", closable: r = !1, onClose: i, children: a, className: o, ...s }, c) {
732
849
  return /* @__PURE__ */ u("span", {
733
850
  ref: c,
734
851
  className: [
@@ -755,7 +872,7 @@ var C = t(function({ dataSource: e, columns: t, rowKey: r = "key", rowSelection:
755
872
  children: "×"
756
873
  })]
757
874
  });
758
- }), T = t(function({ count: e, dot: t = !1, color: n = "error", size: r = "md", overflowCount: i = 99, showZero: a = !1, offset: o, children: s, className: d, style: f, ...p }, m) {
875
+ }), F = t(function({ count: e, dot: t = !1, color: n = "error", size: r = "md", overflowCount: i = 99, showZero: a = !1, offset: o, children: s, className: d, style: f, ...p }, m) {
759
876
  let h = !t && e !== void 0 && !a && e === 0, g = e === void 0 && !t, _ = (() => {
760
877
  if (t || e === void 0) return null;
761
878
  let n = typeof e == "number" ? e : void 0;
@@ -794,7 +911,7 @@ var C = t(function({ dataSource: e, columns: t, rowKey: r = "key", rowSelection:
794
911
  });
795
912
  //#endregion
796
913
  //#region src/components/pagination/pagination.tsx
797
- function E(e, t) {
914
+ function I(e, t) {
798
915
  if (t <= 7) return Array.from({ length: t }, (e, t) => t + 1);
799
916
  let n = [];
800
917
  n.push(1), e > 3 && n.push("ellipsis");
@@ -802,43 +919,43 @@ function E(e, t) {
802
919
  for (let e = r; e <= i; e++) n.push(e);
803
920
  return e < t - 2 && n.push("ellipsis"), n.push(t), n;
804
921
  }
805
- var D = t(function({ value: e, defaultValue: t = 1, pageSize: r = 10, total: i = 0, onChange: o, showSizeChanger: c = !1, pageSizeOptions: d = [
922
+ var L = t(function({ value: e, defaultValue: t = 1, pageSize: r = 10, total: i = 0, onChange: o, showSizeChanger: c = !1, pageSizeOptions: d = [
806
923
  10,
807
924
  20,
808
925
  50,
809
926
  100
810
927
  ], showQuickJumper: f = !1, showTotal: p = !0, size: m = "md", disabled: h = !1, locale: g, className: _, ...v }, y) {
811
- let [b, x] = s(t), S = e !== void 0, C = S ? e : b, [w, T] = s(""), [D, O] = s(r), k = S ? r : D, A = {
928
+ let [b, x] = s(t), S = e !== void 0, C = S ? e : b, [w, T] = s(""), [E, D] = s(r), O = S ? r : E, k = {
812
929
  total: g?.total ?? "共",
813
930
  items: g?.items ?? "条",
814
931
  prevPage: g?.prevPage ?? "上一页",
815
932
  nextPage: g?.nextPage ?? "下一页",
816
933
  jumpTo: g?.jumpTo ?? "前往"
817
- }, j = Math.max(1, Math.ceil(i / k)), M = Math.max(1, Math.min(C, j)), N = a(() => E(M, j), [M, j]), P = n((e) => {
934
+ }, A = Math.max(1, Math.ceil(i / O)), j = Math.max(1, Math.min(C, A)), M = a(() => I(j, A), [j, A]), N = n((e) => {
818
935
  if (h) return;
819
- let t = Math.max(1, Math.min(e, j));
820
- S || x(t), o?.(t, k);
936
+ let t = Math.max(1, Math.min(e, A));
937
+ S || x(t), o?.(t, O);
821
938
  }, [
822
939
  h,
823
- j,
940
+ A,
824
941
  S,
825
942
  o,
826
- k
827
- ]), F = n((e) => {
943
+ O
944
+ ]), P = n((e) => {
828
945
  if (h) return;
829
- O(e);
830
- let t = Math.ceil(i / e), n = Math.min(M, t);
831
- S || (x(n), O(e)), o?.(n, e);
946
+ D(e);
947
+ let t = Math.ceil(i / e), n = Math.min(j, t);
948
+ S || (x(n), D(e)), o?.(n, e);
832
949
  }, [
833
950
  h,
834
951
  i,
835
- M,
952
+ j,
836
953
  S,
837
954
  o
838
- ]), I = n(() => {
955
+ ]), F = n(() => {
839
956
  let e = parseInt(w, 10);
840
- isNaN(e) || (P(e), T(""));
841
- }, [w, P]);
957
+ isNaN(e) || (N(e), T(""));
958
+ }, [w, N]);
842
959
  return /* @__PURE__ */ u("div", {
843
960
  ref: y,
844
961
  className: [
@@ -852,59 +969,59 @@ var D = t(function({ value: e, defaultValue: t = 1, pageSize: r = 10, total: i =
852
969
  p && /* @__PURE__ */ u("span", {
853
970
  className: "chain-pagination__total",
854
971
  children: [
855
- A.total,
972
+ k.total,
856
973
  " ",
857
974
  i,
858
975
  " ",
859
- A.items
976
+ k.items
860
977
  ]
861
978
  }),
862
979
  /* @__PURE__ */ u("ul", {
863
980
  className: "chain-pagination__list",
864
981
  children: [
865
982
  /* @__PURE__ */ l("li", {
866
- className: ["chain-pagination__prev", (h || M <= 1) && "chain-pagination__item--disabled"].filter(Boolean).join(" "),
983
+ className: ["chain-pagination__prev", (h || j <= 1) && "chain-pagination__item--disabled"].filter(Boolean).join(" "),
867
984
  children: /* @__PURE__ */ l("button", {
868
985
  type: "button",
869
- disabled: h || M <= 1,
870
- onClick: () => P(M - 1),
871
- children: A.prevPage
986
+ disabled: h || j <= 1,
987
+ onClick: () => N(j - 1),
988
+ children: k.prevPage
872
989
  })
873
990
  }),
874
- N.map((e, t) => e === "ellipsis" ? /* @__PURE__ */ l("li", {
991
+ M.map((e, t) => e === "ellipsis" ? /* @__PURE__ */ l("li", {
875
992
  className: "chain-pagination__item chain-pagination__item--disabled",
876
993
  children: /* @__PURE__ */ l("span", { children: "..." })
877
994
  }, `ellipsis-${t}`) : /* @__PURE__ */ l("li", {
878
- className: ["chain-pagination__item", e === M && "chain-pagination__item--active"].filter(Boolean).join(" "),
995
+ className: ["chain-pagination__item", e === j && "chain-pagination__item--active"].filter(Boolean).join(" "),
879
996
  children: /* @__PURE__ */ l("button", {
880
997
  type: "button",
881
998
  disabled: h,
882
- onClick: () => P(e),
999
+ onClick: () => N(e),
883
1000
  children: e
884
1001
  })
885
1002
  }, e)),
886
1003
  /* @__PURE__ */ l("li", {
887
- className: ["chain-pagination__next", (h || M >= j) && "chain-pagination__item--disabled"].filter(Boolean).join(" "),
1004
+ className: ["chain-pagination__next", (h || j >= A) && "chain-pagination__item--disabled"].filter(Boolean).join(" "),
888
1005
  children: /* @__PURE__ */ l("button", {
889
1006
  type: "button",
890
- disabled: h || M >= j,
891
- onClick: () => P(M + 1),
892
- children: A.nextPage
1007
+ disabled: h || j >= A,
1008
+ onClick: () => N(j + 1),
1009
+ children: k.nextPage
893
1010
  })
894
1011
  })
895
1012
  ]
896
1013
  }),
897
1014
  c && /* @__PURE__ */ l("select", {
898
1015
  className: "chain-pagination__size-changer",
899
- value: k,
1016
+ value: O,
900
1017
  disabled: h,
901
- onChange: (e) => F(Number(e.target.value)),
1018
+ onChange: (e) => P(Number(e.target.value)),
902
1019
  children: d.map((e) => /* @__PURE__ */ u("option", {
903
1020
  value: e,
904
1021
  children: [
905
1022
  e,
906
1023
  " ",
907
- A.items
1024
+ k.items
908
1025
  ]
909
1026
  }, e))
910
1027
  }),
@@ -916,24 +1033,24 @@ var D = t(function({ value: e, defaultValue: t = 1, pageSize: r = 10, total: i =
916
1033
  disabled: h,
917
1034
  onChange: (e) => T(e.target.value),
918
1035
  onKeyDown: (e) => {
919
- e.key === "Enter" && I();
1036
+ e.key === "Enter" && F();
920
1037
  },
921
1038
  placeholder: ""
922
1039
  }), /* @__PURE__ */ l("button", {
923
1040
  type: "button",
924
1041
  disabled: h,
925
- onClick: I,
926
- children: A.jumpTo
1042
+ onClick: F,
1043
+ children: k.jumpTo
927
1044
  })]
928
1045
  })
929
1046
  ]
930
1047
  });
931
- }), O = {
1048
+ }), R = {
932
1049
  success: "✓",
933
1050
  warning: "!",
934
1051
  error: "✗",
935
1052
  info: "ℹ"
936
- }, k = t(function({ color: e = "info", size: t = "md", message: n, description: r, showIcon: i = !0, closable: a = !1, closeAriaLabel: o = "Close", onClose: s, open: c = !0, action: d, children: f, className: p, ...m }, h) {
1053
+ }, z = t(function({ color: e = "info", size: t = "md", message: n, description: r, showIcon: i = !0, closable: a = !1, closeAriaLabel: o = "Close", onClose: s, open: c = !0, action: d, children: f, className: p, ...m }, h) {
937
1054
  return c ? /* @__PURE__ */ u("div", {
938
1055
  ref: h,
939
1056
  className: [
@@ -949,7 +1066,7 @@ var D = t(function({ value: e, defaultValue: t = 1, pageSize: r = 10, total: i =
949
1066
  i && /* @__PURE__ */ l("span", {
950
1067
  className: "chain-alert__icon",
951
1068
  "aria-hidden": "true",
952
- children: O[e]
1069
+ children: R[e]
953
1070
  }),
954
1071
  /* @__PURE__ */ u("div", {
955
1072
  className: "chain-alert__content",
@@ -978,12 +1095,12 @@ var D = t(function({ value: e, defaultValue: t = 1, pageSize: r = 10, total: i =
978
1095
  })
979
1096
  ]
980
1097
  }) : null;
981
- }), A = {
1098
+ }), B = {
982
1099
  sm: "var(--space-1)",
983
1100
  md: "var(--space-2)",
984
1101
  lg: "var(--space-4)"
985
- }, j = t(function({ size: e = "md", gap: t, direction: n = "horizontal", align: r = "center", wrap: i = !1, children: a, className: o, style: s, ...c }, u) {
986
- let d = t == null ? typeof e == "number" ? `${e}px` : A[e] ?? A.md : typeof t == "number" ? `${t}px` : t;
1102
+ }, V = t(function({ size: e = "md", gap: t, direction: n = "horizontal", align: r = "center", wrap: i = !1, children: a, className: o, style: s, ...c }, u) {
1103
+ let d = t == null ? typeof e == "number" ? `${e}px` : B[e] ?? B.md : typeof t == "number" ? `${t}px` : t;
987
1104
  return /* @__PURE__ */ l("div", {
988
1105
  ref: u,
989
1106
  className: [
@@ -1000,7 +1117,7 @@ var D = t(function({ value: e, defaultValue: t = 1, pageSize: r = 10, total: i =
1000
1117
  ...c,
1001
1118
  children: a
1002
1119
  });
1003
- }), M = t(function({ orientation: e = "horizontal", type: t = "solid", size: n = "md", children: r, className: i, ...a }, o) {
1120
+ }), H = t(function({ orientation: e = "horizontal", type: t = "solid", size: n = "md", children: r, className: i, ...a }, o) {
1004
1121
  return e === "vertical" ? /* @__PURE__ */ l("hr", {
1005
1122
  ref: o,
1006
1123
  className: [
@@ -1045,6 +1162,665 @@ var D = t(function({ value: e, defaultValue: t = 1, pageSize: r = 10, total: i =
1045
1162
  role: "separator",
1046
1163
  ...a
1047
1164
  });
1165
+ }), U = t(function({ checked: e, defaultChecked: t = !1, onChange: i, indeterminate: a = !1, disabled: c = !1, size: d = "md", color: f = "primary", status: p = "default", shape: m = "square", label: h, ariaLabel: g = "Checkbox", inputRef: _, value: v, className: y, style: b, children: x, id: S, name: C, ...w }, T) {
1166
+ let E = e !== void 0, [D, O] = s(t), k = E ? e : D, A = o(null);
1167
+ r(() => {
1168
+ let e = A.current;
1169
+ e && (e.indeterminate = a);
1170
+ }, [a]);
1171
+ let j = n((e) => {
1172
+ if (c) return;
1173
+ let t = a ? !0 : !k;
1174
+ E || O(t), i?.(t, e);
1175
+ }, [
1176
+ c,
1177
+ a,
1178
+ k,
1179
+ E,
1180
+ i
1181
+ ]);
1182
+ r(() => {
1183
+ typeof _ == "function" ? _(A.current) : _ && "current" in _ && (_.current = A.current);
1184
+ }, [_]);
1185
+ let M = h !== void 0 || x !== void 0;
1186
+ return /* @__PURE__ */ u("label", {
1187
+ ref: T,
1188
+ className: [
1189
+ "chain-checkbox",
1190
+ `chain-checkbox--${d}`,
1191
+ `chain-checkbox--${f}`,
1192
+ m !== "square" && `chain-checkbox--${m}`,
1193
+ k && !a && "chain-checkbox--checked",
1194
+ a && "chain-checkbox--indeterminate",
1195
+ c && "chain-checkbox--disabled",
1196
+ p !== "default" && `chain-checkbox--${p}`,
1197
+ y
1198
+ ].filter(Boolean).join(" "),
1199
+ style: b,
1200
+ children: [
1201
+ /* @__PURE__ */ l("input", {
1202
+ ref: A,
1203
+ type: "checkbox",
1204
+ className: "chain-checkbox__input",
1205
+ checked: k,
1206
+ disabled: c,
1207
+ onChange: j,
1208
+ id: S,
1209
+ name: C,
1210
+ value: v,
1211
+ "aria-checked": a ? "mixed" : k,
1212
+ "aria-label": M ? void 0 : g,
1213
+ ...w
1214
+ }),
1215
+ /* @__PURE__ */ l("span", {
1216
+ className: "chain-checkbox__box",
1217
+ "aria-hidden": "true",
1218
+ children: a ? /* @__PURE__ */ l("span", { className: "chain-checkbox__indeterminate" }) : k ? /* @__PURE__ */ l("span", {
1219
+ className: "chain-checkbox__check",
1220
+ children: "✓"
1221
+ }) : null
1222
+ }),
1223
+ M && /* @__PURE__ */ l("span", {
1224
+ className: "chain-checkbox__label",
1225
+ children: h ?? x
1226
+ })
1227
+ ]
1228
+ });
1229
+ }), W = t(function({ value: t, defaultValue: i = [], onChange: a, options: o, disabled: c = !1, size: u = "md", color: d = "primary", direction: f = "vertical", className: p, style: m, children: h }, g) {
1230
+ let _ = t !== void 0, [v, y] = s(i), b = _ ? t : v, x = n((e, t) => {
1231
+ let n = b.includes(e) ? b.filter((t) => t !== e) : [...b, e];
1232
+ _ || y(n), a?.(n, t);
1233
+ }, [
1234
+ b,
1235
+ _,
1236
+ a
1237
+ ]);
1238
+ r(() => {
1239
+ o && h && console.warn("[CheckboxGroup] Both `options` and `children` provided — `children` takes precedence.");
1240
+ }, [o, h]);
1241
+ let S = [
1242
+ "chain-checkbox-group",
1243
+ `chain-checkbox-group--${f}`,
1244
+ p
1245
+ ].filter(Boolean).join(" "), C = (e) => /* @__PURE__ */ l(U, {
1246
+ value: e.value,
1247
+ label: e.label,
1248
+ disabled: c || e.disabled,
1249
+ size: u,
1250
+ color: d,
1251
+ indeterminate: e.indeterminate,
1252
+ checked: b.includes(e.value),
1253
+ onChange: (t, n) => x(e.value, n)
1254
+ }, e.value), w;
1255
+ return h ? w = e.Children.map(h, (t) => {
1256
+ if (!e.isValidElement(t)) return t;
1257
+ let n = t.props.value;
1258
+ return n === void 0 ? t : e.cloneElement(t, {
1259
+ checked: b.includes(n),
1260
+ onChange: (e, r) => {
1261
+ x(n, r), t.props.onChange?.(e, r);
1262
+ },
1263
+ disabled: t.props.disabled || c,
1264
+ size: t.props.size || u,
1265
+ color: t.props.color || d
1266
+ });
1267
+ }) : o && (w = o.map(C)), /* @__PURE__ */ l("div", {
1268
+ ref: g,
1269
+ className: S,
1270
+ style: m,
1271
+ role: "group",
1272
+ children: w
1273
+ });
1274
+ }), G = t(function({ checked: e, defaultChecked: t = !1, onChange: r, disabled: i = !1, size: a = "md", color: o = "primary", status: c = "default", label: d, ariaLabel: f = "Radio", inputRef: p, value: m, className: h, style: g, children: _, id: v, name: y, ...b }, x) {
1275
+ let S = e !== void 0, [C, w] = s(t), T = S ? e : C, E = n((e) => {
1276
+ i || T || (S || w(!0), r?.(!0, e));
1277
+ }, [
1278
+ i,
1279
+ T,
1280
+ S,
1281
+ r
1282
+ ]), D = d !== void 0 || _ !== void 0;
1283
+ return /* @__PURE__ */ u("label", {
1284
+ ref: x,
1285
+ className: [
1286
+ "chain-radio",
1287
+ `chain-radio--${a}`,
1288
+ `chain-radio--${o}`,
1289
+ T && "chain-radio--checked",
1290
+ i && "chain-radio--disabled",
1291
+ c !== "default" && !T && `chain-radio--${c}`,
1292
+ h
1293
+ ].filter(Boolean).join(" "),
1294
+ style: g,
1295
+ children: [
1296
+ /* @__PURE__ */ l("input", {
1297
+ ref: p,
1298
+ type: "radio",
1299
+ className: "chain-radio__input",
1300
+ checked: T,
1301
+ disabled: i,
1302
+ onChange: E,
1303
+ id: v,
1304
+ name: y,
1305
+ value: m,
1306
+ "aria-checked": T,
1307
+ "aria-label": D ? void 0 : f,
1308
+ ...b
1309
+ }),
1310
+ /* @__PURE__ */ l("span", {
1311
+ className: "chain-radio__box",
1312
+ "aria-hidden": "true",
1313
+ children: T && /* @__PURE__ */ l("span", { className: "chain-radio__dot" })
1314
+ }),
1315
+ D && /* @__PURE__ */ l("span", {
1316
+ className: "chain-radio__label",
1317
+ children: d ?? _
1318
+ })
1319
+ ]
1320
+ });
1321
+ }), K = t(function({ value: t, defaultValue: i, onChange: a, options: o, disabled: c = !1, size: u = "md", color: d = "primary", direction: f = "vertical", className: p, style: m, children: h }, g) {
1322
+ let _ = t !== void 0, [v, y] = s(i), b = _ ? t : v, x = n((e, t) => {
1323
+ e !== b && (_ || y(e), a?.(e, t));
1324
+ }, [
1325
+ b,
1326
+ _,
1327
+ a
1328
+ ]);
1329
+ r(() => {
1330
+ o && h && console.warn("[RadioGroup] Both `options` and `children` provided — `children` takes precedence.");
1331
+ }, [o, h]);
1332
+ let S = [
1333
+ "chain-radio-group",
1334
+ `chain-radio-group--${f}`,
1335
+ p
1336
+ ].filter(Boolean).join(" "), C = (e) => /* @__PURE__ */ l(G, {
1337
+ value: e.value,
1338
+ label: e.label,
1339
+ disabled: c || e.disabled,
1340
+ size: u,
1341
+ color: d,
1342
+ checked: b === e.value,
1343
+ onChange: (t, n) => x(e.value, n)
1344
+ }, e.value), w;
1345
+ return h ? w = e.Children.map(h, (t) => {
1346
+ if (!e.isValidElement(t)) return t;
1347
+ let n = t.props.value;
1348
+ return n === void 0 ? t : e.cloneElement(t, {
1349
+ checked: b === n,
1350
+ onChange: (e, r) => {
1351
+ x(n, r), t.props.onChange?.(!0, r);
1352
+ },
1353
+ disabled: t.props.disabled || c,
1354
+ size: t.props.size || u,
1355
+ color: t.props.color || d
1356
+ });
1357
+ }) : o && (w = o.map(C)), /* @__PURE__ */ l("div", {
1358
+ ref: g,
1359
+ className: S,
1360
+ style: m,
1361
+ role: "radiogroup",
1362
+ children: w
1363
+ });
1364
+ }), ee = t(function({ checked: e, defaultChecked: t = !1, onChange: r, disabled: i = !1, loading: a = !1, size: o = "md", color: c = "primary", checkedChildren: d, unCheckedChildren: f, ariaLabel: p = "Switch", className: m, style: h, onClick: g, onKeyDown: _, ...v }, y) {
1365
+ let b = e !== void 0, [x, S] = s(t), C = b ? e : x, w = i || a, T = n((e) => {
1366
+ if (w) return;
1367
+ let t = !C;
1368
+ b || S(t), r?.(t, e), g?.(e);
1369
+ }, [
1370
+ w,
1371
+ C,
1372
+ b,
1373
+ r,
1374
+ g
1375
+ ]), E = n((e) => {
1376
+ if ((e.key === " " || e.key === "Enter") && (e.preventDefault(), !w)) {
1377
+ let e = !C;
1378
+ b || S(e), r?.(e);
1379
+ }
1380
+ _?.(e);
1381
+ }, [
1382
+ w,
1383
+ C,
1384
+ b,
1385
+ r,
1386
+ _
1387
+ ]), D = o !== "sm";
1388
+ return /* @__PURE__ */ l("button", {
1389
+ ref: y,
1390
+ type: "button",
1391
+ role: "switch",
1392
+ className: [
1393
+ "chain-switch",
1394
+ `chain-switch--${o}`,
1395
+ `chain-switch--${c}`,
1396
+ C && "chain-switch--checked",
1397
+ w && "chain-switch--disabled",
1398
+ a && "chain-switch--loading",
1399
+ m
1400
+ ].filter(Boolean).join(" "),
1401
+ style: h,
1402
+ "aria-checked": C,
1403
+ "aria-busy": a || void 0,
1404
+ "aria-label": p,
1405
+ disabled: i,
1406
+ onClick: T,
1407
+ onKeyDown: E,
1408
+ ...v,
1409
+ children: /* @__PURE__ */ u("span", {
1410
+ className: "chain-switch__track",
1411
+ children: [
1412
+ D && /* @__PURE__ */ l("span", {
1413
+ className: "chain-switch__text chain-switch__text--off",
1414
+ children: f
1415
+ }),
1416
+ /* @__PURE__ */ l("span", {
1417
+ className: "chain-switch__thumb",
1418
+ children: a && /* @__PURE__ */ l("span", {
1419
+ className: "chain-switch__spinner",
1420
+ "aria-hidden": "true"
1421
+ })
1422
+ }),
1423
+ D && /* @__PURE__ */ l("span", {
1424
+ className: "chain-switch__text chain-switch__text--on",
1425
+ children: d
1426
+ })
1427
+ ]
1428
+ })
1429
+ });
1430
+ }), q = t(function({ title: e, content: t, placement: a = "top", trigger: d = "hover", visible: f, defaultVisible: p = !1, onVisibleChange: m, color: h = "dark", arrow: g = !0, mouseEnterDelay: _ = 100, mouseLeaveDelay: y = 100, zIndex: w = 1060, getPopupContainer: T, destroyOnClose: E = !0, className: O, style: k, children: A, ...j }, M) {
1431
+ let N = i(), P = f !== void 0, [F, I] = s(p), L = P ? f : F, R = b(L, { duration: 200 }), { mounted: z, animating: B, closing: V } = R, H = D(S(R), C(R)), [U, W] = s({
1432
+ top: 0,
1433
+ left: 0
1434
+ }), G = o(null), K = o(null), ee = o(void 0), q = o(void 0), te = n((e) => {
1435
+ K.current = e, typeof M == "function" ? M(e) : M && (M.current = e);
1436
+ }, [M]), J = n((e) => {
1437
+ e !== L && (P || I(e), m?.(e));
1438
+ }, [
1439
+ L,
1440
+ P,
1441
+ m
1442
+ ]), Y = n(() => {
1443
+ clearTimeout(q.current), !L && (ee.current = setTimeout(() => {
1444
+ J(!0);
1445
+ }, _));
1446
+ }, [
1447
+ L,
1448
+ _,
1449
+ J
1450
+ ]), X = n(() => {
1451
+ clearTimeout(ee.current), q.current = setTimeout(() => {
1452
+ J(!1);
1453
+ }, y);
1454
+ }, [y, J]);
1455
+ r(() => {
1456
+ B && !V && requestAnimationFrame(() => {
1457
+ G.current && K.current && W(v(G.current.getBoundingClientRect(), K.current.getBoundingClientRect(), a));
1458
+ });
1459
+ }, [
1460
+ B,
1461
+ V,
1462
+ a
1463
+ ]), r(() => {
1464
+ if (!z || V) return;
1465
+ let e = () => {
1466
+ G.current && K.current && W(v(G.current.getBoundingClientRect(), K.current.getBoundingClientRect(), a));
1467
+ };
1468
+ return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
1469
+ window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
1470
+ };
1471
+ }, [
1472
+ z,
1473
+ V,
1474
+ a
1475
+ ]), r(() => {
1476
+ if (d !== "click" || !z || V) return;
1477
+ let e = (e) => {
1478
+ let t = e.target;
1479
+ K.current?.contains(t) || G.current?.contains(t) || J(!1);
1480
+ };
1481
+ return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
1482
+ }, [
1483
+ d,
1484
+ z,
1485
+ V,
1486
+ J
1487
+ ]), r(() => {
1488
+ if (d !== "click" || !z || V) return;
1489
+ let e = (e) => {
1490
+ e.key === "Escape" && J(!1);
1491
+ };
1492
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
1493
+ }, [
1494
+ d,
1495
+ z,
1496
+ V,
1497
+ J
1498
+ ]), r(() => () => {
1499
+ clearTimeout(ee.current), clearTimeout(q.current);
1500
+ }, []);
1501
+ let Z = {};
1502
+ d === "hover" && (Z.onMouseEnter = Y, Z.onMouseLeave = X), d === "focus" && (Z.onFocusCapture = Y, Z.onBlurCapture = X), d === "click" && (Z.onClick = (e) => {
1503
+ e.stopPropagation(), L ? X() : Y();
1504
+ });
1505
+ let ne = [
1506
+ "chain-tooltip",
1507
+ `chain-tooltip--${h}`,
1508
+ `chain-tooltip--${a.split("-")[0]}`,
1509
+ a.includes("-start") && "chain-tooltip--start",
1510
+ a.includes("-end") && "chain-tooltip--end",
1511
+ !g && "chain-tooltip--no-arrow",
1512
+ O
1513
+ ].filter(Boolean).join(" "), re = t ?? e;
1514
+ return !z && E ? /* @__PURE__ */ l("span", {
1515
+ ref: G,
1516
+ className: "chain-tooltip__wrapper",
1517
+ ...Z,
1518
+ children: A
1519
+ }) : /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("span", {
1520
+ ref: G,
1521
+ className: "chain-tooltip__wrapper",
1522
+ "aria-describedby": B ? N : void 0,
1523
+ ...Z,
1524
+ children: A
1525
+ }), /* @__PURE__ */ l(x, {
1526
+ getContainer: T,
1527
+ children: /* @__PURE__ */ u("div", {
1528
+ ref: te,
1529
+ id: N,
1530
+ className: ne,
1531
+ role: "tooltip",
1532
+ style: {
1533
+ ...H,
1534
+ pointerEvents: B && !V ? "auto" : "none",
1535
+ ...k,
1536
+ top: U.top,
1537
+ left: U.left,
1538
+ zIndex: w
1539
+ },
1540
+ onMouseEnter: d === "hover" ? Y : void 0,
1541
+ onMouseLeave: d === "hover" ? X : void 0,
1542
+ ...j,
1543
+ children: [/* @__PURE__ */ l("div", {
1544
+ className: "chain-tooltip__content",
1545
+ children: re
1546
+ }), g && /* @__PURE__ */ l("div", { className: "chain-tooltip__arrow" })]
1547
+ })
1548
+ })] });
1549
+ }), te = "a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", J = t(function({ title: e, content: t, footer: a, placement: d = "top", trigger: f = "click", visible: p, defaultVisible: m = !1, onVisibleChange: h, closable: g = !1, closeAriaLabel: _ = "Close", arrow: y = !0, width: w = 320, mouseEnterDelay: T = 100, mouseLeaveDelay: E = 100, zIndex: O = 1060, getPopupContainer: k, destroyOnClose: A = !0, className: j, style: M, children: N, ...P }, F) {
1550
+ let I = i(), L = i(), R = p !== void 0, [z, B] = s(m), V = R ? p : z, H = b(V, { duration: 200 }), { mounted: U, animating: W, closing: G } = H, K = D(S(H), C(H)), [ee, q] = s({
1551
+ top: 0,
1552
+ left: 0
1553
+ }), J = o(null), Y = o(null), X = o(void 0), Z = o(void 0), ne = o(null), re = n((e) => {
1554
+ Y.current = e, typeof F == "function" ? F(e) : F && (F.current = e);
1555
+ }, [F]), Q = n((e) => {
1556
+ e !== V && (R || B(e), h?.(e));
1557
+ }, [
1558
+ V,
1559
+ R,
1560
+ h
1561
+ ]), ie = n(() => {
1562
+ clearTimeout(Z.current), !V && (ne.current = document.activeElement, X.current = setTimeout(() => {
1563
+ Q(!0);
1564
+ }, T));
1565
+ }, [
1566
+ V,
1567
+ T,
1568
+ Q
1569
+ ]), ae = n(() => {
1570
+ clearTimeout(X.current), Z.current = setTimeout(() => {
1571
+ Q(!1);
1572
+ }, E);
1573
+ }, [E, Q]);
1574
+ r(() => {
1575
+ W && !G && requestAnimationFrame(() => {
1576
+ Y.current && Y.current.querySelector(te)?.focus(), J.current && Y.current && q(v(J.current.getBoundingClientRect(), Y.current.getBoundingClientRect(), d));
1577
+ });
1578
+ }, [
1579
+ W,
1580
+ G,
1581
+ d
1582
+ ]), r(() => {
1583
+ G && (ne.current?.focus(), ne.current = null);
1584
+ }, [G]), r(() => {
1585
+ if (!U || G) return;
1586
+ let e = () => {
1587
+ J.current && Y.current && q(v(J.current.getBoundingClientRect(), Y.current.getBoundingClientRect(), d));
1588
+ };
1589
+ return window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
1590
+ window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
1591
+ };
1592
+ }, [
1593
+ U,
1594
+ G,
1595
+ d
1596
+ ]), r(() => {
1597
+ if (!U || G) return;
1598
+ let e = (e) => {
1599
+ let t = e.target;
1600
+ Y.current?.contains(t) || J.current?.contains(t) || Q(!1);
1601
+ };
1602
+ return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
1603
+ }, [
1604
+ U,
1605
+ G,
1606
+ Q
1607
+ ]), r(() => {
1608
+ if (!U || G) return;
1609
+ let e = (e) => {
1610
+ e.key === "Escape" && Q(!1);
1611
+ };
1612
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
1613
+ }, [
1614
+ U,
1615
+ G,
1616
+ Q
1617
+ ]), r(() => () => {
1618
+ clearTimeout(X.current), clearTimeout(Z.current);
1619
+ }, []);
1620
+ let $ = {};
1621
+ f === "hover" && ($.onMouseEnter = ie, $.onMouseLeave = ae), f === "focus" && ($.onFocusCapture = ie, $.onBlurCapture = ae), f === "click" && ($.onClick = (e) => {
1622
+ e.stopPropagation(), V ? ae() : ie();
1623
+ });
1624
+ let oe = n(() => {
1625
+ Q(!1);
1626
+ }, [Q]), se = e !== void 0 || g, ce = [
1627
+ "chain-popover",
1628
+ `chain-popover--${d.split("-")[0]}`,
1629
+ d.includes("-start") && "chain-popover--start",
1630
+ d.includes("-end") && "chain-popover--end",
1631
+ !y && "chain-popover--no-arrow",
1632
+ j
1633
+ ].filter(Boolean).join(" ");
1634
+ return !U && A ? /* @__PURE__ */ l("span", {
1635
+ ref: J,
1636
+ className: "chain-popover__wrapper",
1637
+ ...$,
1638
+ children: N
1639
+ }) : /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("span", {
1640
+ ref: J,
1641
+ className: "chain-popover__wrapper",
1642
+ "aria-describedby": W ? I : void 0,
1643
+ ...$,
1644
+ children: N
1645
+ }), /* @__PURE__ */ l(x, {
1646
+ getContainer: k,
1647
+ children: /* @__PURE__ */ u("div", {
1648
+ ref: re,
1649
+ id: I,
1650
+ className: ce,
1651
+ role: "dialog",
1652
+ "aria-labelledby": e ? L : void 0,
1653
+ style: {
1654
+ ...K,
1655
+ pointerEvents: W && !G ? "auto" : "none",
1656
+ ...M,
1657
+ top: ee.top,
1658
+ left: ee.left,
1659
+ width: typeof w == "number" ? `${w}px` : w,
1660
+ zIndex: O
1661
+ },
1662
+ ...P,
1663
+ children: [
1664
+ se && /* @__PURE__ */ u("div", {
1665
+ className: "chain-popover__header",
1666
+ children: [e && /* @__PURE__ */ l("h3", {
1667
+ id: L,
1668
+ className: "chain-popover__title",
1669
+ children: e
1670
+ }), g && /* @__PURE__ */ l("button", {
1671
+ type: "button",
1672
+ className: "chain-popover__close",
1673
+ "aria-label": _,
1674
+ onClick: oe,
1675
+ children: "×"
1676
+ })]
1677
+ }),
1678
+ t && /* @__PURE__ */ l("div", {
1679
+ className: "chain-popover__body",
1680
+ children: t
1681
+ }),
1682
+ a && /* @__PURE__ */ l("div", {
1683
+ className: "chain-popover__footer",
1684
+ children: a
1685
+ }),
1686
+ y && /* @__PURE__ */ l("div", { className: "chain-popover__arrow" })
1687
+ ]
1688
+ })
1689
+ })] });
1690
+ }), Y = t(function({ type: e = "info", content: t, open: i, defaultOpen: a = !0, onClose: c, duration: d = 3e3, closable: f = !1, closeAriaLabel: p = "Close", icon: m, placement: h = "top", getContainer: g, destroyOnClose: _ = !0, className: v, style: C, ...w }, T) {
1691
+ let O = i !== void 0, [k, A] = s(a), j = O ? i : k, M = b(j, { duration: 250 }), { mounted: N, animating: P, closing: F } = M, I = h === "top" ? {
1692
+ x: "-50%",
1693
+ y: -16
1694
+ } : {
1695
+ x: 0,
1696
+ y: -16
1697
+ }, L = h === "top" ? {
1698
+ x: "-50%",
1699
+ y: 0
1700
+ } : {
1701
+ x: 0,
1702
+ y: 0
1703
+ }, R = D(S(M), E(M, {
1704
+ from: I,
1705
+ to: L,
1706
+ duration: 250
1707
+ })), z = o(void 0), B = n(() => {
1708
+ clearTimeout(z.current), O || A(!1), c?.();
1709
+ }, [O, c]);
1710
+ r(() => (j && d > 0 && !O && (z.current = setTimeout(B, d)), () => clearTimeout(z.current)), [
1711
+ j,
1712
+ d,
1713
+ O,
1714
+ B
1715
+ ]);
1716
+ let V = n(() => {
1717
+ B();
1718
+ }, [B]), H = m === !1 ? null : m === void 0 ? y[e] : m, U = [
1719
+ "chain-message",
1720
+ `chain-message--${e}`,
1721
+ `chain-message--${h}`,
1722
+ v
1723
+ ].filter(Boolean).join(" ");
1724
+ return !N && _ ? null : /* @__PURE__ */ l(x, {
1725
+ getContainer: g,
1726
+ children: /* @__PURE__ */ u("div", {
1727
+ ref: T,
1728
+ className: U,
1729
+ role: e === "error" ? "alert" : "status",
1730
+ "aria-live": e === "error" ? "assertive" : "polite",
1731
+ style: {
1732
+ ...R,
1733
+ pointerEvents: P && !F ? "auto" : "none",
1734
+ ...C
1735
+ },
1736
+ ...w,
1737
+ children: [
1738
+ H && /* @__PURE__ */ l("span", {
1739
+ className: "chain-message__icon",
1740
+ "aria-hidden": "true",
1741
+ children: H
1742
+ }),
1743
+ /* @__PURE__ */ l("span", {
1744
+ className: "chain-message__content",
1745
+ children: t
1746
+ }),
1747
+ f && /* @__PURE__ */ l("button", {
1748
+ type: "button",
1749
+ className: "chain-message__close",
1750
+ "aria-label": p,
1751
+ onClick: V,
1752
+ children: "×"
1753
+ })
1754
+ ]
1755
+ })
1756
+ });
1757
+ }), X = t(function({ type: e = "info", title: t, description: i, open: a, defaultOpen: c = !0, onClose: d, duration: f = 0, closable: p = !0, closeAriaLabel: m = "Close", icon: h, placement: g = "top-right", action: _, getContainer: v, destroyOnClose: C = !0, className: w, style: T, ...O }, k) {
1758
+ let A = a !== void 0, [j, M] = s(c), N = A ? a : j, P = b(N, { duration: 250 }), { mounted: F, animating: I, closing: L } = P, R = g === "top-left" ? "left" : "right", z = D(S(P), E(P, {
1759
+ direction: R,
1760
+ distance: 120,
1761
+ duration: 300
1762
+ })), B = o(void 0), V = n(() => {
1763
+ clearTimeout(B.current), A || M(!1), d?.();
1764
+ }, [A, d]);
1765
+ r(() => (N && f > 0 && !A && (B.current = setTimeout(V, f)), () => clearTimeout(B.current)), [
1766
+ N,
1767
+ f,
1768
+ A,
1769
+ V
1770
+ ]);
1771
+ let H = n(() => {
1772
+ V();
1773
+ }, [V]), U = h === !1 ? null : h === void 0 ? y[e] : h, W = [
1774
+ "chain-notification",
1775
+ `chain-notification--${e}`,
1776
+ `chain-notification--${g}`,
1777
+ w
1778
+ ].filter(Boolean).join(" ");
1779
+ return !F && C ? null : /* @__PURE__ */ l(x, {
1780
+ getContainer: v,
1781
+ children: /* @__PURE__ */ u("div", {
1782
+ ref: k,
1783
+ className: W,
1784
+ role: "status",
1785
+ "aria-live": "polite",
1786
+ style: {
1787
+ ...z,
1788
+ pointerEvents: I && !L ? "auto" : "none",
1789
+ ...T
1790
+ },
1791
+ ...O,
1792
+ children: [/* @__PURE__ */ u("div", {
1793
+ className: "chain-notification__body",
1794
+ children: [
1795
+ U && /* @__PURE__ */ l("span", {
1796
+ className: "chain-notification__icon",
1797
+ "aria-hidden": "true",
1798
+ children: U
1799
+ }),
1800
+ /* @__PURE__ */ u("div", {
1801
+ className: "chain-notification__text",
1802
+ children: [t && /* @__PURE__ */ l("div", {
1803
+ className: "chain-notification__title",
1804
+ children: t
1805
+ }), i && /* @__PURE__ */ l("div", {
1806
+ className: "chain-notification__description",
1807
+ children: i
1808
+ })]
1809
+ }),
1810
+ p && /* @__PURE__ */ l("button", {
1811
+ type: "button",
1812
+ className: "chain-notification__close",
1813
+ "aria-label": m,
1814
+ onClick: H,
1815
+ children: "×"
1816
+ })
1817
+ ]
1818
+ }), _ && /* @__PURE__ */ l("div", {
1819
+ className: "chain-notification__action",
1820
+ children: _
1821
+ })]
1822
+ })
1823
+ });
1048
1824
  });
1049
1825
  //#endregion
1050
- export { k as Alert, T as Badge, f as Button, M as Divider, h as FormItem, p as Input, b as Modal, D as Pagination, _ as Select, j as Space, C as Table, w as Tag };
1826
+ export { z as Alert, F as Badge, f as Button, U as Checkbox, W as CheckboxGroup, H as Divider, h as FormItem, p as Input, Y as Message, A as Modal, X as Notification, L as Pagination, J as Popover, G as Radio, K as RadioGroup, _ as Select, V as Space, ee as Switch, N as Table, P as Tag, q as Tooltip };