@kingsimba/nc-ui 0.1.48 → 0.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,13 +2,13 @@ var ht = Object.defineProperty;
2
2
  var mt = (e, t, n) => t in e ? ht(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var se = (e, t, n) => mt(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsx as s, jsxs as A, Fragment as Ee } from "react/jsx-runtime";
5
- import { d as Le, E as gt, R as bt, V as vt, k as wt, Y as yt, b as xt, a as kt, c as Nt } from "./GeneratedIcons-eOaZDTB3.js";
6
- import ze, { useState as P, useRef as j, useEffect as V, useMemo as $e, createContext as be, useContext as ae, Children as At, isValidElement as St, forwardRef as Ct, useImperativeHandle as Mt, useCallback as X, Suspense as $t } from "react";
5
+ import { d as Le, E as gt, R as bt, W as vt, k as wt, Z as yt, b as xt, a as kt, c as Nt } from "./GeneratedIcons-DAopmpGr.js";
6
+ import ze, { useState as P, useRef as Y, useEffect as V, useMemo as $e, createContext as be, useContext as ae, Children as At, isValidElement as St, forwardRef as Ct, useImperativeHandle as Mt, useCallback as X, Suspense as $t } from "react";
7
7
  import { createPortal as Ae } from "react-dom";
8
8
  import { useTranslation as oe } from "react-i18next";
9
9
  import It from "i18next";
10
10
  import { c as Rt } from "./clsx-OuTLNxxd.js";
11
- function Qe({
11
+ function Je({
12
12
  size: e = "default",
13
13
  color: t,
14
14
  overlay: n = !1,
@@ -68,7 +68,7 @@ function ne({ variant: e = "default", block: t, size: n = "default", appearance:
68
68
  ...p,
69
69
  children: [
70
70
  c && /* @__PURE__ */ s(
71
- Qe,
71
+ Je,
72
72
  {
73
73
  size: "small",
74
74
  className: "nc-button-spinner",
@@ -236,7 +236,7 @@ function Pt({ size: e }) {
236
236
  }
237
237
  ) });
238
238
  }
239
- function Jn({ checked: e, onChange: t, disabled: n, label: r, size: o = "default", labelColor: i, style: a, className: c = "" }) {
239
+ function Zn({ checked: e, onChange: t, disabled: n, label: r, size: o = "default", labelColor: i, style: a, className: c = "" }) {
240
240
  const l = o === "small", u = o === "tiny";
241
241
  return /* @__PURE__ */ A(
242
242
  "label",
@@ -266,7 +266,7 @@ function Jn({ checked: e, onChange: t, disabled: n, label: r, size: o = "default
266
266
  );
267
267
  }
268
268
  function Et({ option: e, onChange: t, selected: n, highlighted: r, small: o, renderOption: i, index: a }) {
269
- const c = j(null), { t: l } = oe(), u = e.disabled === !0;
269
+ const c = Y(null), { t: l } = oe(), u = e.disabled === !0;
270
270
  return V(() => {
271
271
  r && c.current && c.current.scrollIntoView({ block: "nearest" });
272
272
  }, [r]), /* @__PURE__ */ s(
@@ -372,7 +372,7 @@ function Bt({ open: e, small: t }) {
372
372
  }
373
373
  );
374
374
  }
375
- function Qn({
375
+ function Jn({
376
376
  value: e,
377
377
  onChange: t,
378
378
  placeholder: n = "Select…",
@@ -392,9 +392,9 @@ function Qn({
392
392
  style: v,
393
393
  className: y
394
394
  }) {
395
- const [h, f] = P(!1), [m, N] = P(""), [C, E] = P(-1), B = j(null), S = j(null), L = j(null), x = g === "small", { t: M } = oe(), z = !!o, F = w || z, [I, T] = P([]), [H, q] = P(() => {
395
+ const [h, f] = P(!1), [m, N] = P(""), [C, E] = P(-1), B = Y(null), S = Y(null), L = Y(null), x = g === "small", { t: M } = oe(), z = !!o, F = w || z, [I, T] = P([]), [H, q] = P(() => {
396
396
  if (r && e) {
397
- const R = r.find((Y) => Y.value === e);
397
+ const R = r.find((j) => j.value === e);
398
398
  return R ? R.label : "";
399
399
  }
400
400
  return o && e ? e : "";
@@ -405,11 +405,11 @@ function Qn({
405
405
  return;
406
406
  }
407
407
  if (r) {
408
- const R = r.find((Y) => Y.value === e);
408
+ const R = r.find((j) => j.value === e);
409
409
  R && q(R.label);
410
410
  } else o && q(e);
411
411
  }, [e, r, o]);
412
- const O = (R, Y = !1) => {
412
+ const O = (R, j = !1) => {
413
413
  if (!o) return;
414
414
  L.current && clearTimeout(L.current);
415
415
  const W = async () => {
@@ -420,29 +420,29 @@ function Qn({
420
420
  T([]);
421
421
  }
422
422
  };
423
- Y ? W() : L.current = setTimeout(W, 200);
423
+ j ? W() : L.current = setTimeout(W, 200);
424
424
  }, _ = $e(() => {
425
425
  if (z) return I;
426
426
  const R = m.toLowerCase();
427
- return F ? (r || []).filter((Y) => Y.label.toLowerCase().includes(R)) : r || [];
427
+ return F ? (r || []).filter((j) => j.label.toLowerCase().includes(R)) : r || [];
428
428
  }, [r, m, F, z, I]);
429
429
  V(() => {
430
430
  h && E(-1);
431
431
  }, [h, _]), V(() => {
432
432
  if (!p && !e && r && r.length > 0 && t) {
433
- const R = r.find((Y) => Y.default) || r[0];
433
+ const R = r.find((j) => j.default) || r[0];
434
434
  t(R.value);
435
435
  }
436
436
  }, [p, e, r, t]), V(() => {
437
- function R(Y) {
437
+ function R(j) {
438
438
  var W;
439
- Y.target instanceof Node && B.current && ((W = B.current.parentElement) != null && W.contains(Y.target) || f(!1));
439
+ j.target instanceof Node && B.current && ((W = B.current.parentElement) != null && W.contains(j.target) || f(!1));
440
440
  }
441
441
  return document.addEventListener("mousedown", R), () => document.removeEventListener("mousedown", R);
442
442
  }, []);
443
- const D = c ?? (r ? r.find((R) => R.value === e) : e ? { label: H, value: e } : void 0), J = D && p, le = !l && !J, fe = `nc-align-${b}`, de = !(h && F) && !!D, ue = (R, Y, W = !1) => {
443
+ const D = c ?? (r ? r.find((R) => R.value === e) : e ? { label: H, value: e } : void 0), Z = D && p, le = !l && !Z, fe = `nc-align-${b}`, de = !(h && F) && !!D, ue = (R, j, W = !1) => {
444
444
  var U;
445
- q(Y), t == null || t(R), f(!1), N(""), W && ((U = B.current) == null || U.blur());
445
+ q(j), t == null || t(R), f(!1), N(""), W && ((U = B.current) == null || U.blur());
446
446
  }, we = () => {
447
447
  t == null || t(void 0), N(""), f(!1);
448
448
  }, ye = (R) => {
@@ -450,7 +450,7 @@ function Qn({
450
450
  (R.key === "ArrowDown" || R.key === "ArrowUp") && (f(!0), R.preventDefault());
451
451
  return;
452
452
  }
453
- const Y = (W, U) => {
453
+ const j = (W, U) => {
454
454
  if (U === 1) {
455
455
  for (let G = W; G < _.length; G++)
456
456
  if (!_[G].disabled) return G;
@@ -468,13 +468,13 @@ function Qn({
468
468
  case "ArrowDown":
469
469
  R.preventDefault(), E((W) => {
470
470
  const U = W + 1, G = U >= _.length ? 0 : U;
471
- return Y(G, 1);
471
+ return j(G, 1);
472
472
  });
473
473
  break;
474
474
  case "ArrowUp":
475
475
  R.preventDefault(), E((W) => {
476
476
  const U = W - 1, G = U < 0 ? _.length - 1 : U;
477
- return Y(G, -1);
477
+ return j(G, -1);
478
478
  });
479
479
  break;
480
480
  case "Enter":
@@ -494,8 +494,8 @@ function Qn({
494
494
  style: { position: "relative", display: "flex", alignItems: "center" },
495
495
  onMouseDown: (R) => {
496
496
  if (l || F && R.target === B.current) return;
497
- const Y = !h;
498
- if (f((W) => (!W && F && D && N(D.label), !W)), z && Y) {
497
+ const j = !h;
498
+ if (f((W) => (!W && F && D && N(D.label), !W)), z && j) {
499
499
  const W = F && D ? D.label : "";
500
500
  T([]), setTimeout(() => O(W, !0), 0);
501
501
  }
@@ -516,21 +516,21 @@ function Qn({
516
516
  f(!0);
517
517
  const R = D ? D.label : "";
518
518
  D && (N(R), setTimeout(() => {
519
- var Y;
520
- return (Y = B.current) == null ? void 0 : Y.select();
519
+ var j;
520
+ return (j = B.current) == null ? void 0 : j.select();
521
521
  }, 0)), z && (T([]), O(R, !0));
522
522
  }
523
523
  },
524
524
  onChange: (R) => {
525
- const Y = R.target.value;
526
- F && (N(Y), z && O(Y));
525
+ const j = R.target.value;
526
+ F && (N(j), z && O(j));
527
527
  },
528
528
  onKeyDown: ye,
529
529
  value: h && F ? m : (D == null ? void 0 : D.label) || "",
530
530
  readOnly: l || !F,
531
531
  style: {
532
532
  width: "100%",
533
- paddingRight: le || J ? x ? 32 : 44 : 12,
533
+ paddingRight: le || Z ? x ? 32 : 44 : 12,
534
534
  caretColor: w ? void 0 : "transparent",
535
535
  cursor: w ? void 0 : "pointer",
536
536
  // The input text is invisible behind the overlay, so it must not be selectable
@@ -548,7 +548,7 @@ function Qn({
548
548
  style: {
549
549
  position: "absolute",
550
550
  left: x ? 8 : 12,
551
- right: le || J ? x ? 12 : 24 : x ? 8 : 12,
551
+ right: le || Z ? x ? 12 : 24 : x ? 8 : 12,
552
552
  top: "50%",
553
553
  transform: "translateY(-50%)",
554
554
  // The overlay carries the visible text, so it is the layer that can be selected/copied.
@@ -568,7 +568,7 @@ function Qn({
568
568
  ] })
569
569
  }
570
570
  ),
571
- J && /* @__PURE__ */ s(zt, { onClick: we, small: x }),
571
+ Z && /* @__PURE__ */ s(zt, { onClick: we, small: x }),
572
572
  le && /* @__PURE__ */ s(Bt, { open: h, small: x })
573
573
  ]
574
574
  }
@@ -576,7 +576,7 @@ function Qn({
576
576
  /* @__PURE__ */ s(Lt, { isOpen: h, options: _, onSelect: ue, selectedValue: e, placement: d, anchorRef: S, small: x, highlightedIndex: C, renderOption: i })
577
577
  ] });
578
578
  }
579
- function Zn({ onClick: e, loading: t = !1, disabled: n = !1, size: r = "default", title: o, "aria-label": i }) {
579
+ function Qn({ onClick: e, loading: t = !1, disabled: n = !1, size: r = "default", title: o, "aria-label": i }) {
580
580
  return /* @__PURE__ */ s(
581
581
  "button",
582
582
  {
@@ -590,7 +590,7 @@ function Zn({ onClick: e, loading: t = !1, disabled: n = !1, size: r = "default"
590
590
  }
591
591
  );
592
592
  }
593
- function Ze({ onClick: e, disabled: t = !1, size: n = "default", title: r = "Close", "aria-label": o = "Close" }) {
593
+ function Qe({ onClick: e, disabled: t = !1, size: n = "default", title: r = "Close", "aria-label": o = "Close" }) {
594
594
  return /* @__PURE__ */ s(
595
595
  "button",
596
596
  {
@@ -654,7 +654,7 @@ function rr({
654
654
  anchor: o,
655
655
  preferredDirection: i = "down"
656
656
  }) {
657
- const a = j(null), [c, l] = P({ top: 0, left: 0 }), u = o || (r == null ? void 0 : r.current);
657
+ const a = Y(null), [c, l] = P({ top: 0, left: 0 }), u = o || (r == null ? void 0 : r.current);
658
658
  if (V(() => {
659
659
  if (!e || !u || !a.current) return;
660
660
  const d = u.getBoundingClientRect(), g = a.current.getBoundingClientRect(), k = window.innerHeight, b = window.innerWidth, v = d.bottom + 8, y = v + g.height <= k - 8;
@@ -765,7 +765,7 @@ function or({
765
765
  className: v = "",
766
766
  onContentHeightChange: y
767
767
  }) {
768
- const h = j(null), f = j(null), { t: m } = oe(), N = { close: t }, C = (S) => {
768
+ const h = Y(null), f = Y(null), { t: m } = oe(), N = { close: t }, C = (S) => {
769
769
  d && S.target === S.currentTarget && t();
770
770
  };
771
771
  if (V(() => {
@@ -830,7 +830,7 @@ function or({
830
830
  children: [
831
831
  !b && /* @__PURE__ */ A("div", { className: "nc-dialog-header", children: [
832
832
  /* @__PURE__ */ s("h3", { id: "nc-dialog-title", className: "nc-dialog-title", children: n }),
833
- /* @__PURE__ */ s(Ze, { onClick: t, "aria-label": "Close dialog" })
833
+ /* @__PURE__ */ s(Qe, { onClick: t, "aria-label": "Close dialog" })
834
834
  ] }),
835
835
  /* @__PURE__ */ s("div", { ref: f, className: "nc-dialog-content", children: r }),
836
836
  E()
@@ -919,7 +919,7 @@ function sr({
919
919
  validator: f,
920
920
  showErrorMessage: m = !0
921
921
  }) {
922
- const N = j(null), C = j(null), E = j(!1), [B, S] = P(!1), [L, x] = P(!1), [M, z] = P(!1), F = e !== void 0, [I, T] = P(t), H = F ? e : I, [q, O] = P(H), _ = f ? f(H) : null, D = !!_, J = !y && g === "plain", le = J && L, fe = le ? q : H;
922
+ const N = Y(null), C = Y(null), E = Y(!1), [B, S] = P(!1), [L, x] = P(!1), [M, z] = P(!1), F = e !== void 0, [I, T] = P(t), H = F ? e : I, [q, O] = P(H), _ = f ? f(H) : null, D = !!_, Z = !y && g === "plain", le = Z && L, fe = le ? q : H;
923
923
  V(() => {
924
924
  le || O(H);
925
925
  }, [H, le]);
@@ -927,44 +927,44 @@ function sr({
927
927
  let R = 12;
928
928
  we && ue ? R = ye * 2 : (we || ue) && (R = ye);
929
929
  const W = b ? d === "small" ? 28 : 34 : void 0, U = () => {
930
- if (!J)
930
+ if (!Z)
931
931
  return H;
932
- const Q = q !== H;
933
- return F || T(q), Q && (n == null || n(q), r == null || r(q)), q;
932
+ const J = q !== H;
933
+ return F || T(q), J && (n == null || n(q), r == null || r(q)), q;
934
934
  }, G = () => {
935
935
  O(H);
936
936
  }, ft = () => {
937
- var Q, ee, je;
938
- if (J) {
939
- O(""), i == null || i(), (Q = N.current) == null || Q.focus();
937
+ var J, ee, Ye;
938
+ if (Z) {
939
+ O(""), i == null || i(), (J = N.current) == null || J.focus();
940
940
  return;
941
941
  }
942
- F || T(""), n == null || n(""), i == null || i(), y ? (ee = C.current) == null || ee.focus() : (je = N.current) == null || je.focus();
943
- }, He = (Q) => {
944
- if (J && Q.key === "Escape") {
945
- Q.preventDefault(), E.current = !0, G(), Q.currentTarget.blur();
942
+ F || T(""), n == null || n(""), i == null || i(), y ? (ee = C.current) == null || ee.focus() : (Ye = N.current) == null || Ye.focus();
943
+ }, He = (J) => {
944
+ if (Z && J.key === "Escape") {
945
+ J.preventDefault(), E.current = !0, G(), J.currentTarget.blur();
946
946
  return;
947
947
  }
948
- if (Q.key === "Enter" && !y) {
949
- const ee = J ? U() : H;
950
- J && (Q.preventDefault(), E.current = !0, Q.currentTarget.blur()), o == null || o(ee);
948
+ if (J.key === "Enter" && !y) {
949
+ const ee = Z ? U() : H;
950
+ Z && (J.preventDefault(), E.current = !0, J.currentTarget.blur()), o == null || o(ee);
951
951
  }
952
- }, Ve = (Q) => {
953
- const ee = Q.target.value;
954
- if (J) {
952
+ }, Ve = (J) => {
953
+ const ee = J.target.value;
954
+ if (Z) {
955
955
  O(ee), n == null || n(ee);
956
956
  return;
957
957
  }
958
958
  F || T(ee), n == null || n(ee);
959
959
  }, Fe = () => {
960
- x(!0), J && O(H);
960
+ x(!0), Z && O(H);
961
961
  }, Oe = () => {
962
- if (J && E.current) {
962
+ if (Z && E.current) {
963
963
  E.current = !1, x(!1);
964
964
  return;
965
965
  }
966
- J && U(), x(!1);
967
- }, Ye = `nc-input ${d === "small" ? "nc-small " : ""}${!y && g === "plain" ? "nc-plain " : ""}${D ? "nc-error " : ""}${w}`;
966
+ Z && U(), x(!1);
967
+ }, je = `nc-input ${d === "small" ? "nc-small " : ""}${!y && g === "plain" ? "nc-plain " : ""}${D ? "nc-error " : ""}${w}`;
968
968
  return /* @__PURE__ */ A(
969
969
  "div",
970
970
  {
@@ -980,7 +980,7 @@ function sr({
980
980
  "textarea",
981
981
  {
982
982
  ref: C,
983
- className: Ye,
983
+ className: je,
984
984
  placeholder: a,
985
985
  value: fe,
986
986
  onChange: Ve,
@@ -1002,7 +1002,7 @@ function sr({
1002
1002
  {
1003
1003
  ref: N,
1004
1004
  type: de && B ? "text" : p,
1005
- className: Ye,
1005
+ className: je,
1006
1006
  placeholder: a,
1007
1007
  value: fe,
1008
1008
  onChange: Ve,
@@ -1078,7 +1078,7 @@ function cr({ title: e, titleTools: t, children: n, style: r }) {
1078
1078
  ] });
1079
1079
  }
1080
1080
  function ar({ values: e, onChange: t, options: n, placeholder: r = "Select…", label: o }) {
1081
- const [i, a] = P(!1), [c, l] = P(""), u = j(null), p = $e(() => n.filter((d) => d.label.toLowerCase().includes(c.toLowerCase())), [n, c]);
1081
+ const [i, a] = P(!1), [c, l] = P(""), u = Y(null), p = $e(() => n.filter((d) => d.label.toLowerCase().includes(c.toLowerCase())), [n, c]);
1082
1082
  V(() => {
1083
1083
  function d(g) {
1084
1084
  !(g.target instanceof Node) || !u.current || u.current.contains(g.target) || a(!1);
@@ -1171,7 +1171,7 @@ function lr({
1171
1171
  disabled: i = !1,
1172
1172
  size: a = "default"
1173
1173
  }) {
1174
- const [c, l] = P(!1), [u, p] = P(""), [w, d] = P(""), [g, k] = P({ top: 0, left: 0, width: 0, right: void 0 }), b = j(null), v = j(null);
1174
+ const [c, l] = P(!1), [u, p] = P(""), [w, d] = P(""), [g, k] = P({ top: 0, left: 0, width: 0, right: void 0 }), b = Y(null), v = Y(null);
1175
1175
  V(() => {
1176
1176
  if (c && b.current) {
1177
1177
  const x = b.current.getBoundingClientRect(), z = Math.max(x.width, 400);
@@ -1284,7 +1284,7 @@ function lr({
1284
1284
  }
1285
1285
  const Vt = 5, Ft = 3;
1286
1286
  function dr({ value: e, onChange: t, min: n, max: r, step: o = 1, label: i, disabled: a, className: c = "", style: l, size: u = "default" }) {
1287
- const p = u === "small", w = (String(o).split(".")[1] || "").length, d = j(null), g = j(!1), k = j(null), [b, v] = P(!1), [y, h] = P(() => String(e)), f = (I) => parseFloat(I.toFixed(w)), m = (I) => {
1287
+ const p = u === "small", w = (String(o).split(".")[1] || "").length, d = Y(null), g = Y(!1), k = Y(null), [b, v] = P(!1), [y, h] = P(() => String(e)), f = (I) => parseFloat(I.toFixed(w)), m = (I) => {
1288
1288
  const T = f(I);
1289
1289
  h(String(T)), t(T);
1290
1290
  }, N = () => {
@@ -1448,12 +1448,12 @@ function ur({
1448
1448
  ] });
1449
1449
  }
1450
1450
  const Ot = ({ size: e = 24, className: t, style: n }) => /* @__PURE__ */ s("svg", { width: e, height: e, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", className: t, style: n, children: /* @__PURE__ */ s("polyline", { points: "18 15 12 9 6 15" }) });
1451
- function Yt({ children: e, className: t = "", style: n }) {
1451
+ function jt({ children: e, className: t = "", style: n }) {
1452
1452
  return /* @__PURE__ */ s("div", { className: `nc-tab-panel ${t}`, style: n, children: e });
1453
1453
  }
1454
1454
  function pr({ active: e, children: t, keepMounted: n = !1, className: r = "", style: o }) {
1455
1455
  const i = At.toArray(t).filter(
1456
- (c) => St(c) && (c.type === Yt || c.type.displayName === "TabPanel")
1456
+ (c) => St(c) && (c.type === jt || c.type.displayName === "TabPanel")
1457
1457
  );
1458
1458
  if (n)
1459
1459
  return /* @__PURE__ */ s("div", { className: `nc-tab-panels ${r}`, style: o, children: i.map((c) => {
@@ -1473,7 +1473,7 @@ function pr({ active: e, children: t, keepMounted: n = !1, className: r = "", st
1473
1473
  return /* @__PURE__ */ s("div", { className: `nc-tab-panels ${r}`, style: o, children: a });
1474
1474
  }
1475
1475
  function fr({ tabs: e, active: t, onChange: n, onClose: r, permanentTabs: o, className: i, toolbar: a, multiline: c, orientation: l = "horizontal", style: u }) {
1476
- const p = j(null), [w, d] = P(!1), [g, k] = P(!1), b = l === "verticalLeft" || l === "verticalRight", v = j(!1), y = j(0), h = j(0), f = j(!1);
1476
+ const p = Y(null), [w, d] = P(!1), [g, k] = P(!1), b = l === "verticalLeft" || l === "verticalRight", v = Y(!1), y = Y(0), h = Y(0), f = Y(!1);
1477
1477
  V(() => {
1478
1478
  const S = () => {
1479
1479
  if (p.current)
@@ -1636,7 +1636,7 @@ const _e = [
1636
1636
  "var(--nc-csv-col-8)",
1637
1637
  "var(--nc-csv-col-9)"
1638
1638
  ];
1639
- function jt(e, t) {
1639
+ function Yt(e, t) {
1640
1640
  const r = e.slice(0, t).split(`
1641
1641
  `), o = r.length, a = r[o - 1].split(" "), c = a.length, l = a[c - 1].length + 1;
1642
1642
  return { line: o, column: c, character: l, offset: t };
@@ -1663,7 +1663,7 @@ function Kt(e, t) {
1663
1663
  }
1664
1664
  const mr = Ct(
1665
1665
  function({ value: t, onChange: n, placeholder: r, className: o, style: i, showLineNumbers: a = !1, onCursorChange: c, highlightLine: l }, u) {
1666
- const p = j(null), w = j(null), d = j(null);
1666
+ const p = Y(null), w = Y(null), d = Y(null);
1667
1667
  Mt(u, () => ({
1668
1668
  goToLine(h) {
1669
1669
  const f = p.current;
@@ -1684,7 +1684,7 @@ const mr = Ct(
1684
1684
  }), [t]);
1685
1685
  const g = X(() => {
1686
1686
  if (!c || !p.current) return;
1687
- const h = jt(t, p.current.selectionStart);
1687
+ const h = Yt(t, p.current.selectionStart);
1688
1688
  c(h);
1689
1689
  }, [c, t]), k = X(() => {
1690
1690
  const h = p.current;
@@ -1866,7 +1866,7 @@ function Xt({ notification: e }) {
1866
1866
  );
1867
1867
  }
1868
1868
  function gr() {
1869
- const [e, t] = P([]), [n, r] = P(/* @__PURE__ */ new Map()), [o, i] = P(/* @__PURE__ */ new Set()), a = j(null), c = j([]);
1869
+ const [e, t] = P([]), [n, r] = P(/* @__PURE__ */ new Map()), [o, i] = P(/* @__PURE__ */ new Set()), a = Y(null), c = Y([]);
1870
1870
  return V(() => _t((u) => {
1871
1871
  const p = new Set(c.current.map((d) => d.id)), w = u.filter((d) => !p.has(d.id)).map((d) => d.id);
1872
1872
  w.length > 0 ? (t(u), i(new Set(w)), requestAnimationFrame(() => {
@@ -1930,11 +1930,11 @@ function gr() {
1930
1930
  }
1931
1931
  );
1932
1932
  }
1933
- function Jt(e) {
1933
+ function Zt(e) {
1934
1934
  return Ut(e);
1935
1935
  }
1936
1936
  const br = {
1937
- show: (e) => Jt(e)
1937
+ show: (e) => Zt(e)
1938
1938
  };
1939
1939
  function vr(e) {
1940
1940
  const t = It.createInstance(), n = {};
@@ -1957,7 +1957,7 @@ function vr(e) {
1957
1957
  }
1958
1958
  }).observe(document.documentElement, { attributes: !0 }), t;
1959
1959
  }
1960
- class Qt {
1960
+ class Jt {
1961
1961
  constructor() {
1962
1962
  se(this, "apps", /* @__PURE__ */ new Map());
1963
1963
  }
@@ -1997,8 +1997,8 @@ class Qt {
1997
1997
  return this.apps.has(t);
1998
1998
  }
1999
1999
  }
2000
- const ge = new Qt(), qe = "nc-ui-app-state";
2001
- class Zt {
2000
+ const ge = new Jt(), qe = "nc-ui-app-state";
2001
+ class Qt {
2002
2002
  constructor() {
2003
2003
  se(this, "state");
2004
2004
  se(this, "listeners", /* @__PURE__ */ new Map());
@@ -2045,7 +2045,7 @@ class Zt {
2045
2045
  (r = this.listeners.get(t)) == null || r.forEach((o) => o(n));
2046
2046
  }
2047
2047
  }
2048
- const re = new Zt();
2048
+ const re = new Qt();
2049
2049
  class en {
2050
2050
  constructor() {
2051
2051
  se(this, "apps", []);
@@ -2165,7 +2165,7 @@ class en {
2165
2165
  this.listeners.forEach((t) => t());
2166
2166
  }
2167
2167
  }
2168
- const Z = new en(), nt = be(null);
2168
+ const Q = new en(), nt = be(null);
2169
2169
  function tn() {
2170
2170
  const e = ae(nt);
2171
2171
  if (!e)
@@ -2208,7 +2208,7 @@ function rn({ title: e, onClose: t, onBack: n, toolbar: r, hideBackButton: o })
2208
2208
  ] }),
2209
2209
  /* @__PURE__ */ A("div", { className: "nc-app-title-bar-right", children: [
2210
2210
  r && /* @__PURE__ */ s("div", { className: "nc-app-title-bar-toolbar", children: r }),
2211
- /* @__PURE__ */ s(Ze, { onClick: t, "aria-label": "Close application" })
2211
+ /* @__PURE__ */ s(Qe, { onClick: t, "aria-label": "Close application" })
2212
2212
  ] })
2213
2213
  ] });
2214
2214
  }
@@ -2287,7 +2287,7 @@ function rt({ appId: e, isActive: t, onClose: n }) {
2287
2287
  children: /* @__PURE__ */ s(nt.Provider, { value: C, children: /* @__PURE__ */ s(on, { appId: e, children: /* @__PURE__ */ s(
2288
2288
  $t,
2289
2289
  {
2290
- fallback: /* @__PURE__ */ s("div", { className: "nc-app-loading", children: /* @__PURE__ */ s(Qe, {}) }),
2290
+ fallback: /* @__PURE__ */ s("div", { className: "nc-app-loading", children: /* @__PURE__ */ s(Je, {}) }),
2291
2291
  children: /* @__PURE__ */ s(E, {})
2292
2292
  }
2293
2293
  ) }) })
@@ -2381,7 +2381,7 @@ const Be = "-", sn = (e) => {
2381
2381
  }, Pe = (e, t, n, r) => {
2382
2382
  e.forEach((o) => {
2383
2383
  if (typeof o == "string") {
2384
- const i = o === "" ? t : Je(t, o);
2384
+ const i = o === "" ? t : Ze(t, o);
2385
2385
  i.classGroupId = n;
2386
2386
  return;
2387
2387
  }
@@ -2397,10 +2397,10 @@ const Be = "-", sn = (e) => {
2397
2397
  return;
2398
2398
  }
2399
2399
  Object.entries(o).forEach(([i, a]) => {
2400
- Pe(a, Je(t, i), n, r);
2400
+ Pe(a, Ze(t, i), n, r);
2401
2401
  });
2402
2402
  });
2403
- }, Je = (e, t) => {
2403
+ }, Ze = (e, t) => {
2404
2404
  let n = e;
2405
2405
  return t.split(Be).forEach((r) => {
2406
2406
  n.nextPart.has(r) || n.nextPart.set(r, {
@@ -4595,7 +4595,7 @@ function Wn(...e) {
4595
4595
  return Dn(Rt(e));
4596
4596
  }
4597
4597
  function yr({ autoWidth: e = !0, className: t, style: n }) {
4598
- const [r, o] = P(() => re.getActiveAppId()), [i, a] = P(() => Z.getRunningApps()), { isMobile: c } = it();
4598
+ const [r, o] = P(() => re.getActiveAppId()), [i, a] = P(() => Q.getRunningApps()), { isMobile: c } = it();
4599
4599
  V(() => {
4600
4600
  const v = re.subscribe("activeAppId", (y) => {
4601
4601
  o(y);
@@ -4603,16 +4603,16 @@ function yr({ autoWidth: e = !0, className: t, style: n }) {
4603
4603
  return () => {
4604
4604
  v();
4605
4605
  };
4606
- }, []), V(() => Z.subscribe(() => {
4607
- a(Z.getRunningApps());
4606
+ }, []), V(() => Q.subscribe(() => {
4607
+ a(Q.getRunningApps());
4608
4608
  }), []), V(() => {
4609
4609
  if (!new URLSearchParams(window.location.search).has("app")) {
4610
4610
  const h = re.getActiveAppId();
4611
- h && !Z.isRunning(h) && Z.launchApp(h);
4611
+ h && !Q.isRunning(h) && Q.launchApp(h);
4612
4612
  }
4613
4613
  }, []);
4614
4614
  const l = (v) => {
4615
- Z.closeApp(v);
4615
+ Q.closeApp(v);
4616
4616
  }, u = r ? ge.get(r) : null, w = (u == null ? void 0 : u.width) ?? 400, d = r !== null, b = { ...{
4617
4617
  overflow: "hidden",
4618
4618
  display: d ? "flex" : "none",
@@ -4638,7 +4638,7 @@ function xr({
4638
4638
  side: r = "left",
4639
4639
  getBadge: o
4640
4640
  }) {
4641
- const { t: i } = oe(), { isMobile: a } = it(), [c, l] = P(() => re.getActiveAppId()), [u, p] = P(() => Z.getRunningApps());
4641
+ const { t: i } = oe(), { isMobile: a } = it(), [c, l] = P(() => re.getActiveAppId()), [u, p] = P(() => Q.getRunningApps());
4642
4642
  V(() => {
4643
4643
  const f = re.subscribe("activeAppId", (m) => {
4644
4644
  l(m);
@@ -4646,11 +4646,11 @@ function xr({
4646
4646
  return () => {
4647
4647
  f();
4648
4648
  };
4649
- }, []), V(() => Z.subscribe(() => {
4650
- p(Z.getRunningApps());
4649
+ }, []), V(() => Q.subscribe(() => {
4650
+ p(Q.getRunningApps());
4651
4651
  }), []);
4652
4652
  const w = (f) => {
4653
- c === f ? Z.setActiveApp(null) : Z.launchApp(f);
4653
+ c === f ? Q.setActiveApp(null) : Q.launchApp(f);
4654
4654
  }, d = e.map((f) => ge.get(f)).filter((f) => !!f), g = u.filter((f) => !e.includes(f.appId)).map((f) => ({ running: f, def: ge.get(f.appId) })).filter((f) => !!f.def), k = (f) => u.some((m) => m.appId === f), b = (f) => f.titleKey ? String(i(f.titleKey)) : f.id, v = (f) => typeof f == "number" && f > 99 ? "99+" : f, y = (f, m) => {
4655
4655
  const N = o == null ? void 0 : o(f, m);
4656
4656
  return N ? /* @__PURE__ */ s(
@@ -4824,7 +4824,7 @@ function Cr() {
4824
4824
  }) }) });
4825
4825
  }
4826
4826
  export {
4827
- Qe as ActivityIndicator,
4827
+ Je as ActivityIndicator,
4828
4828
  Un as Alert,
4829
4829
  rt as AppContainer,
4830
4830
  nt as AppContext,
@@ -4835,9 +4835,9 @@ export {
4835
4835
  qn as Battery,
4836
4836
  ne as Button,
4837
4837
  Xn as ButtonGroup,
4838
- Jn as Checkbox,
4839
- Ze as CloseButton,
4840
- Qn as ComboBox,
4838
+ Zn as Checkbox,
4839
+ Qe as CloseButton,
4840
+ Jn as ComboBox,
4841
4841
  rr as ContextMenu,
4842
4842
  mr as CsvTextArea,
4843
4843
  or as Dialog,
@@ -4854,9 +4854,9 @@ export {
4854
4854
  Xt as Notification,
4855
4855
  gr as NotificationContainer,
4856
4856
  dr as NumberInput,
4857
- Zn as RefreshButton,
4857
+ Qn as RefreshButton,
4858
4858
  ur as Slider,
4859
- Yt as TabPanel,
4859
+ jt as TabPanel,
4860
4860
  pr as TabPanels,
4861
4861
  fr as Tabs,
4862
4862
  hr as Toggle,
@@ -4867,8 +4867,8 @@ export {
4867
4867
  Wn as cn,
4868
4868
  vr as createAppI18nFactory,
4869
4869
  br as notificationManager,
4870
- Z as runningAppsStore,
4871
- Jt as showNotification,
4870
+ Q as runningAppsStore,
4871
+ Zt as showNotification,
4872
4872
  tn as useApp,
4873
4873
  Dt as useDialog,
4874
4874
  Nr as useNavStack,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingsimba/nc-ui",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",