@starasia/admin 4.5.1 → 4.5.2

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.es.js CHANGED
@@ -57,7 +57,7 @@ import { Skeleton as Re } from "@starasia/skeleton";
57
57
  export * from "@starasia/skeleton";
58
58
  export * from "@starasia/progress-stepper";
59
59
  import { jsx as e, Fragment as G, jsxs as h } from "react/jsx-runtime";
60
- import Tt, { createContext as Pe, useState as S, useContext as We, useCallback as Ce, useMemo as De, memo as ie, useEffect as $, useRef as te, useLayoutEffect as lt, isValidElement as ct, forwardRef as Ot, Children as ar, useImperativeHandle as sr } from "react";
60
+ import Tt, { createContext as Pe, useState as S, useContext as We, useCallback as Ce, useMemo as De, memo as ie, useEffect as $, useRef as ee, useLayoutEffect as lt, isValidElement as ct, forwardRef as Ot, Children as ar, useImperativeHandle as sr } from "react";
61
61
  import { useSearchParams as Ye, useNavigate as ut, useLocation as ze, Outlet as Dt, Link as Ue, useParams as Nt } from "react-router";
62
62
  import dr, { createPortal as Zt } from "react-dom";
63
63
  import hr from "react-easy-crop";
@@ -234,7 +234,7 @@ function Dr({ children: t }) {
234
234
  return /* @__PURE__ */ e(gt.Provider, { value: a, children: t });
235
235
  }
236
236
  function vr({ slotKey: t, fallback: r }) {
237
- const i = We(gt), o = i ? (i.slotCounts[t] ?? 0) > 0 : !1, n = te(i == null ? void 0 : i.setOutletNode);
237
+ const i = We(gt), o = i ? (i.slotCounts[t] ?? 0) > 0 : !1, n = ee(i == null ? void 0 : i.setOutletNode);
238
238
  n.current = i == null ? void 0 : i.setOutletNode;
239
239
  const l = Ce(
240
240
  (s) => {
@@ -247,16 +247,16 @@ function vr({ slotKey: t, fallback: r }) {
247
247
  return /* @__PURE__ */ e(G, { children: o ? /* @__PURE__ */ e("div", { ref: l, style: { display: "contents" } }) : r });
248
248
  }
249
249
  function kn({ slotKey: t, children: r }) {
250
- const i = We(gt);
251
- if ($(() => {
252
- if (i)
253
- return i.registerSlot(t);
254
- }, [i, t]), !i)
250
+ const i = We(gt), o = ee(i == null ? void 0 : i.registerSlot);
251
+ if (o.current = i == null ? void 0 : i.registerSlot, $(() => {
252
+ var l;
253
+ return (l = o.current) == null ? void 0 : l.call(o, t);
254
+ }, [t]), !i)
255
255
  return process.env.NODE_ENV !== "production" && console.warn(
256
256
  "[SidebarGroupSlot] used outside AppLayout — content not rendered"
257
257
  ), null;
258
- const o = i.outletNodes[t];
259
- return o ? Zt(r, o) : null;
258
+ const n = i.outletNodes[t];
259
+ return n ? Zt(r, n) : null;
260
260
  }
261
261
  const Ge = "moduleSwitcherGroupId", at = "sa-module-switcher-change";
262
262
  function vt() {
@@ -340,13 +340,13 @@ function Fn({
340
340
  logoutButton: p
341
341
  }) {
342
342
  var Fe, Ze;
343
- const [v] = Ye(), L = v.get("embed") === "true", C = $t(), { badges: T } = mr(), Z = ut(), j = ze(), W = !re("md"), [fe, P] = S(!1), [R, K] = S(!1), [ce, ae] = S(!1), [U, se] = S(!1), [ee, ne] = S(
343
+ const [v] = Ye(), L = v.get("embed") === "true", C = $t(), { badges: T } = mr(), Z = ut(), j = ze(), W = !re("md"), [fe, P] = S(!1), [R, K] = S(!1), [ce, ae] = S(!1), [U, se] = S(!1), [te, ne] = S(
344
344
  () => new Set(bt)
345
345
  ), [Y, J] = S(null), { selectedGroupId: V, setSelectedGroupId: z } = Gt();
346
346
  $(() => {
347
- bt = ee;
348
- }, [ee]);
349
- const X = te(null), de = te(null);
347
+ bt = te;
348
+ }, [te]);
349
+ const X = ee(null), de = ee(null);
350
350
  $(() => {
351
351
  const y = X.current;
352
352
  if (!y) return;
@@ -443,7 +443,7 @@ function Fn({
443
443
  if (L)
444
444
  return /* @__PURE__ */ e("main", { style: { height: "100vh", overflowY: "auto", backgroundColor: "var(--sa-background-primary-inverse, #f8f8f8)" }, children: t || /* @__PURE__ */ e(Dt, {}) });
445
445
  const Se = (y) => {
446
- const F = y.children && y.children.length > 0, E = ee.has(y.id), x = F ? y.children.some((B) => oe(B.to)) : oe(y.to), k = tt(y.badge, T[y.id]), b = !!k && R && !W;
446
+ const F = y.children && y.children.length > 0, E = te.has(y.id), x = F ? y.children.some((B) => oe(B.to)) : oe(y.to), k = tt(y.badge, T[y.id]), b = !!k && R && !W;
447
447
  return /* @__PURE__ */ h("div", { "data-menu-active": x || void 0, children: [
448
448
  /* @__PURE__ */ h(
449
449
  "button",
@@ -2436,7 +2436,7 @@ const Sr = (t, r) => {
2436
2436
  }) => {
2437
2437
  const Z = (p == null ? void 0 : p.isShowLabel) ?? !0, [j, Q] = S(!1), [W, fe] = S(0), P = () => {
2438
2438
  fe((z) => z + 1);
2439
- }, { searchParams: R, setSearchParams: K, getQueryParam: ce } = mt(), ae = Qe(R.toString()), U = ri(t, R, a) || "", [se, ee] = S(U), ne = ce(a), J = !!(ne && !(() => {
2439
+ }, { searchParams: R, setSearchParams: K, getQueryParam: ce } = mt(), ae = Qe(R.toString()), U = ri(t, R, a) || "", [se, te] = S(U), ne = ce(a), J = !!(ne && !(() => {
2440
2440
  if (ne)
2441
2441
  try {
2442
2442
  const z = JSON.parse(ne);
@@ -2447,7 +2447,7 @@ const Sr = (t, r) => {
2447
2447
  return !1;
2448
2448
  })()), V = re("md");
2449
2449
  return $(() => {
2450
- ee(U);
2450
+ te(U);
2451
2451
  }, [U]), $(() => {
2452
2452
  if (se === U)
2453
2453
  return;
@@ -2487,7 +2487,7 @@ const Sr = (t, r) => {
2487
2487
  {
2488
2488
  onClick: () => {
2489
2489
  const z = new URLSearchParams(R);
2490
- z.delete(a), K(z), ee(""), P(), g && g();
2490
+ z.delete(a), K(z), te(""), P(), g && g();
2491
2491
  },
2492
2492
  variant: "outline",
2493
2493
  tone: "neutral",
@@ -2604,7 +2604,7 @@ const Sr = (t, r) => {
2604
2604
  {
2605
2605
  placeholder: i,
2606
2606
  leftIcon: /* @__PURE__ */ e(w, { name: "Search", width: 20, height: 20 }),
2607
- onChange: (z) => ee(z.target.value),
2607
+ onChange: (z) => te(z.target.value),
2608
2608
  value: se,
2609
2609
  fullWidth: !0
2610
2610
  },
@@ -2627,7 +2627,7 @@ const Sr = (t, r) => {
2627
2627
  }
2628
2628
  );
2629
2629
  }, oi = ({ children: t, borderRadius: r, height: i }) => {
2630
- const o = te(null), [n, l] = S("100vh");
2630
+ const o = ee(null), [n, l] = S("100vh");
2631
2631
  return $(() => {
2632
2632
  if (i) return;
2633
2633
  const s = () => {
@@ -2823,7 +2823,7 @@ const Sr = (t, r) => {
2823
2823
  }
2824
2824
  );
2825
2825
  }, si = ({ filter: t, columnTitle: r }) => {
2826
- const [i, o] = S(!1), n = te(null), l = te(null), s = te(null), [a, u] = S(""), [d, g] = S({ top: 0, left: 0 }), m = t.selectedValues, p = De(() => a ? t.options.filter(
2826
+ const [i, o] = S(!1), n = ee(null), l = ee(null), s = ee(null), [a, u] = S(""), [d, g] = S({ top: 0, left: 0 }), m = t.selectedValues, p = De(() => a ? t.options.filter(
2827
2827
  (C) => C.label.toLowerCase().includes(a.toLowerCase())
2828
2828
  ) : t.options, [t.options, a]);
2829
2829
  $(() => {
@@ -3201,7 +3201,7 @@ const Sr = (t, r) => {
3201
3201
  ), U = K ? W ?? null : ce, se = (x) => {
3202
3202
  if (x.sortKey) return x.sortKey;
3203
3203
  if (typeof x.accessor == "string") return x.accessor;
3204
- }, ee = (x) => {
3204
+ }, te = (x) => {
3205
3205
  const k = se(x);
3206
3206
  if (!k) return;
3207
3207
  let b;
@@ -3216,9 +3216,9 @@ const Sr = (t, r) => {
3216
3216
  const x = g.current;
3217
3217
  Oe(x.scrollHeight > x.clientHeight);
3218
3218
  }, [r, g]);
3219
- const Ae = te(null), [oe, Ne] = S([]), [He, Se] = S(
3219
+ const Ae = ee(null), [oe, Ne] = S([]), [He, Se] = S(
3220
3220
  () => Z ?? {}
3221
- ), Fe = te(null);
3221
+ ), Fe = ee(null);
3222
3222
  lt(() => {
3223
3223
  if (!m || !Ae.current) {
3224
3224
  Ne([]);
@@ -3306,7 +3306,7 @@ const Sr = (t, r) => {
3306
3306
  "button",
3307
3307
  {
3308
3308
  type: "button",
3309
- onClick: () => ee(x),
3309
+ onClick: () => te(x),
3310
3310
  title: pe === "asc" ? "Sorted ascending — click to sort descending" : pe === "desc" ? "Sorted descending — click to clear" : "Click to sort ascending",
3311
3311
  style: {
3312
3312
  flex: 1,
@@ -3540,9 +3540,9 @@ const Sr = (t, r) => {
3540
3540
  footerProps: o
3541
3541
  }) => {
3542
3542
  var m;
3543
- const n = te(null), [l, s] = S(
3543
+ const n = ee(null), [l, s] = S(
3544
3544
  (r == null ? void 0 : r.defaultFrozenCount) ?? 0
3545
- ), a = (i == null ? void 0 : i.show) ?? !0, u = te(null), d = (m = r == null ? void 0 : r.pagination) == null ? void 0 : m.totalData;
3545
+ ), a = (i == null ? void 0 : i.show) ?? !0, u = ee(null), d = (m = r == null ? void 0 : r.pagination) == null ? void 0 : m.totalData;
3546
3546
  typeof d == "number" && (u.current = d);
3547
3547
  const g = (o == null ? void 0 : o.showFooter) ?? (d === void 0 ? u.current !== 0 : d !== 0);
3548
3548
  return /* @__PURE__ */ h(oi, { ...t, children: [
@@ -4111,7 +4111,7 @@ const Fi = (t) => {
4111
4111
  );
4112
4112
  }, Ei = ({ status: t = "default", ...r }) => {
4113
4113
  var l;
4114
- const i = te(null), o = () => {
4114
+ const i = ee(null), o = () => {
4115
4115
  if (r.defaultUrl) {
4116
4116
  window.open(r.defaultUrl);
4117
4117
  return;
@@ -4842,7 +4842,7 @@ const At = {
4842
4842
  } catch {
4843
4843
  d == null || d("Gagal memproses gambar");
4844
4844
  }
4845
- }, U = te(null), se = () => {
4845
+ }, U = ee(null), se = () => {
4846
4846
  U.current && U.current.click();
4847
4847
  };
4848
4848
  sr(g, () => ({
@@ -4851,9 +4851,9 @@ const At = {
4851
4851
  (V = U.current) == null || V.click();
4852
4852
  }
4853
4853
  }));
4854
- const ee = parseInt(l, 10), ne = At[s];
4854
+ const te = parseInt(l, 10), ne = At[s];
4855
4855
  let Y, J;
4856
- return ne >= 1 ? (J = ee, Y = ee * ne) : (Y = ee, J = ee / ne), /* @__PURE__ */ h(
4856
+ return ne >= 1 ? (J = te, Y = te * ne) : (Y = te, J = te / ne), /* @__PURE__ */ h(
4857
4857
  f,
4858
4858
  {
4859
4859
  display: "flex",
@@ -6919,7 +6919,7 @@ const go = (t) => {
6919
6919
  footerProps: C = { borderTop: !0 },
6920
6920
  variantTag: T = "info"
6921
6921
  }) => {
6922
- const Z = te(null), [j, Q] = S("100vh");
6922
+ const Z = ee(null), [j, Q] = S("100vh");
6923
6923
  $(() => {
6924
6924
  const R = () => {
6925
6925
  if (Z.current) {