@plumile/backoffice-react 0.1.116 → 0.1.120

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 (63) hide show
  1. package/lib/esm/components/backoffice/billing/BackofficeBillingUsageChart.js +60 -0
  2. package/lib/esm/components/backoffice/billing/BackofficeBillingUsageChart.js.map +1 -0
  3. package/lib/esm/components/backoffice/billing/backofficeBillingUsageChart.css.js +7 -0
  4. package/lib/esm/components/backoffice/billing/backofficeBillingUsageChart.css.js.map +1 -0
  5. package/lib/esm/components/backoffice/columns/buildDataTableColumns.js +6 -6
  6. package/lib/esm/components/backoffice/layout/buildSidebarSections.js +167 -151
  7. package/lib/esm/components/backoffice/layout/buildSidebarSections.js.map +1 -1
  8. package/lib/esm/components/backoffice/layout/sidebarUtils.js +24 -21
  9. package/lib/esm/components/backoffice/layout/sidebarUtils.js.map +1 -1
  10. package/lib/esm/components/backoffice/links/resolveBackofficeLink.js +62 -54
  11. package/lib/esm/components/backoffice/links/resolveBackofficeLink.js.map +1 -1
  12. package/lib/esm/components/backoffice/links/resolveBackofficeTargetIcon.js +1 -1
  13. package/lib/esm/components/backoffice/links/resolveBackofficeTargetIcon.js.map +1 -1
  14. package/lib/esm/hooks/useBackofficeSidebarPins.js +44 -42
  15. package/lib/esm/hooks/useBackofficeSidebarPins.js.map +1 -1
  16. package/lib/esm/index.js +75 -74
  17. package/lib/esm/pages/BackofficeDashboardPage.helpers.js +1 -0
  18. package/lib/esm/pages/BackofficeDashboardPage.helpers.js.map +1 -1
  19. package/lib/esm/pages/BackofficeDashboardPage.js +181 -154
  20. package/lib/esm/pages/BackofficeDashboardPage.js.map +1 -1
  21. package/lib/esm/pages/BackofficeEntityDetailPage.js +12 -12
  22. package/lib/esm/pages/BackofficeLayoutPage.js +133 -129
  23. package/lib/esm/pages/BackofficeLayoutPage.js.map +1 -1
  24. package/lib/esm/provider/BackofficeConfigContext.js.map +1 -1
  25. package/lib/esm/provider/BackofficeProvider.js +126 -121
  26. package/lib/esm/provider/BackofficeProvider.js.map +1 -1
  27. package/lib/esm/provider/dashboardRegistrations.js +17 -0
  28. package/lib/esm/provider/dashboardRegistrations.js.map +1 -0
  29. package/lib/esm/router/createBackofficeRoutes.js +148 -131
  30. package/lib/esm/router/createBackofficeRoutes.js.map +1 -1
  31. package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.d.ts +25 -0
  32. package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.d.ts.map +1 -0
  33. package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.stories.d.ts +41 -0
  34. package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.stories.d.ts.map +1 -0
  35. package/lib/types/components/backoffice/billing/backofficeBillingUsageChart.css.d.ts +4 -0
  36. package/lib/types/components/backoffice/billing/backofficeBillingUsageChart.css.d.ts.map +1 -0
  37. package/lib/types/components/backoffice/layout/buildSidebarSections.d.ts +2 -1
  38. package/lib/types/components/backoffice/layout/buildSidebarSections.d.ts.map +1 -1
  39. package/lib/types/components/backoffice/layout/sidebarUtils.d.ts +1 -0
  40. package/lib/types/components/backoffice/layout/sidebarUtils.d.ts.map +1 -1
  41. package/lib/types/components/backoffice/links/resolveBackofficeLink.d.ts.map +1 -1
  42. package/lib/types/components/backoffice/links/types.d.ts +1 -0
  43. package/lib/types/components/backoffice/links/types.d.ts.map +1 -1
  44. package/lib/types/hooks/useBackofficeSidebarPins.d.ts +1 -0
  45. package/lib/types/hooks/useBackofficeSidebarPins.d.ts.map +1 -1
  46. package/lib/types/index.d.ts +2 -1
  47. package/lib/types/index.d.ts.map +1 -1
  48. package/lib/types/pages/BackofficeDashboardPage.d.ts +5 -1
  49. package/lib/types/pages/BackofficeDashboardPage.d.ts.map +1 -1
  50. package/lib/types/pages/BackofficeDashboardPage.helpers.d.ts.map +1 -1
  51. package/lib/types/pages/BackofficeDashboardPage.stories.d.ts +9 -0
  52. package/lib/types/pages/BackofficeDashboardPage.stories.d.ts.map +1 -0
  53. package/lib/types/pages/BackofficeLayoutPage.d.ts.map +1 -1
  54. package/lib/types/provider/BackofficeConfigContext.d.ts +2 -1
  55. package/lib/types/provider/BackofficeConfigContext.d.ts.map +1 -1
  56. package/lib/types/provider/BackofficeProvider.d.ts.map +1 -1
  57. package/lib/types/provider/dashboardRegistrations.d.ts +4 -0
  58. package/lib/types/provider/dashboardRegistrations.d.ts.map +1 -0
  59. package/lib/types/provider/types.d.ts +8 -1
  60. package/lib/types/provider/types.d.ts.map +1 -1
  61. package/lib/types/router/createBackofficeRoutes.d.ts +8 -2
  62. package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
  63. package/package.json +13 -13
@@ -0,0 +1,60 @@
1
+ import { rangeText as e, root as t, totalValue as n } from "./backofficeBillingUsageChart.css.js";
2
+ import { useMemo as r } from "react";
3
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
+ import { FormattedDate as o } from "@plumile/ui/atomic/atoms/formatted-date/FormattedDate.js";
5
+ import { TimeSeriesLineChart as s } from "@plumile/ui/components/charts/TimeSeriesLineChart.js";
6
+ import { formatCurrencyAmount as c } from "@plumile/ui/shared/currencyAmount.js";
7
+ import { toUtcDailyCategorySeries as l } from "@plumile/ui/shared/timeSeries.js";
8
+ //#region src/components/backoffice/billing/BackofficeBillingUsageChart.tsx
9
+ var u = "->", d = ({ ariaLabel: d, buckets: f, categories: p, currency: m, emptyLabel: h, from: g, rangePrefix: _, to: v, totalAmount: y }) => {
10
+ let b = r(() => p.map((e) => e.id), [p]), x = r(() => Object.fromEntries(p.map((e) => [e.id, e.color])), [p]), S = r(() => Object.fromEntries(p.map((e) => [e.id, e.label])), [p]), C = r(() => g == null || v == null ? [] : l({
11
+ fromIsoDateTime: g,
12
+ toIsoDateTime: v,
13
+ buckets: f,
14
+ categories: b
15
+ }), [
16
+ f,
17
+ b,
18
+ g,
19
+ v
20
+ ]), w = (e) => c({
21
+ amount: e,
22
+ currency: m
23
+ });
24
+ return f.length === 0 ? /* @__PURE__ */ i("p", {
25
+ className: e,
26
+ children: h
27
+ }) : /* @__PURE__ */ a("div", {
28
+ className: t,
29
+ children: [
30
+ /* @__PURE__ */ i("p", {
31
+ className: n,
32
+ children: w(y)
33
+ }),
34
+ g != null && v != null && /* @__PURE__ */ a("p", {
35
+ className: "txvbqb8p txvbqbva3 txvbqbfcp",
36
+ children: [
37
+ _,
38
+ " ",
39
+ /* @__PURE__ */ i(o, { value: g }),
40
+ " ",
41
+ u,
42
+ " ",
43
+ /* @__PURE__ */ i(o, { value: v })
44
+ ]
45
+ }),
46
+ /* @__PURE__ */ i(s, {
47
+ ariaLabel: d,
48
+ categoryColorById: x,
49
+ categoryLabel: (e) => S[e] ?? e,
50
+ categoryOrder: b,
51
+ formatValue: w,
52
+ series: C
53
+ })
54
+ ]
55
+ });
56
+ };
57
+ //#endregion
58
+ export { d as BackofficeBillingUsageChart, d as default };
59
+
60
+ //# sourceMappingURL=BackofficeBillingUsageChart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BackofficeBillingUsageChart.js","names":[],"sources":["../../../../../src/components/backoffice/billing/BackofficeBillingUsageChart.tsx"],"sourcesContent":["import { useMemo, type JSX } from 'react';\nimport { FormattedDate } from '@plumile/ui/atomic/atoms/formatted-date/FormattedDate.js';\nimport { TimeSeriesLineChart } from '@plumile/ui/components/charts/TimeSeriesLineChart.js';\nimport { formatCurrencyAmount } from '@plumile/ui/shared/currencyAmount.js';\nimport { toUtcDailyCategorySeries } from '@plumile/ui/shared/timeSeries.js';\n\nimport * as styles from './backofficeBillingUsageChart.css.js';\n\nexport type BackofficeBillingUsageChartBucket = {\n readonly day: string;\n readonly category: string;\n readonly value: number;\n};\n\nexport type BackofficeBillingUsageChartCategory = {\n readonly id: string;\n readonly label: string;\n readonly color: string;\n};\n\nexport type BackofficeBillingUsageChartProps = {\n readonly currency: string;\n readonly totalAmount: number;\n readonly from: string | null;\n readonly to: string | null;\n readonly buckets: readonly BackofficeBillingUsageChartBucket[];\n readonly categories: readonly BackofficeBillingUsageChartCategory[];\n readonly emptyLabel: string;\n readonly rangePrefix: string;\n readonly ariaLabel: string;\n};\n\nconst dateSeparator = '->';\n\nexport const BackofficeBillingUsageChart = ({\n ariaLabel,\n buckets,\n categories,\n currency,\n emptyLabel,\n from,\n rangePrefix,\n to,\n totalAmount,\n}: BackofficeBillingUsageChartProps): JSX.Element => {\n const categoryOrder = useMemo(() => {\n return categories.map((category) => {\n return category.id;\n });\n }, [categories]);\n\n const categoryColorById = useMemo(() => {\n return Object.fromEntries(\n categories.map((category) => {\n return [category.id, category.color];\n }),\n );\n }, [categories]);\n\n const categoryLabelById = useMemo(() => {\n return Object.fromEntries(\n categories.map((category) => {\n return [category.id, category.label];\n }),\n );\n }, [categories]);\n\n const series = useMemo(() => {\n if (from == null || to == null) {\n return [];\n }\n\n return toUtcDailyCategorySeries({\n fromIsoDateTime: from,\n toIsoDateTime: to,\n buckets,\n categories: categoryOrder,\n });\n }, [buckets, categoryOrder, from, to]);\n\n const formatChartValue = (value: number): string => {\n return formatCurrencyAmount({\n amount: value,\n currency,\n });\n };\n\n if (buckets.length === 0) {\n return <p className={styles.rangeText}>{emptyLabel}</p>;\n }\n\n return (\n <div className={styles.root}>\n <p className={styles.totalValue}>{formatChartValue(totalAmount)}</p>\n {from != null && to != null && (\n <p className={styles.rangeText}>\n {rangePrefix} <FormattedDate value={from} /> {dateSeparator}{' '}\n <FormattedDate value={to} />\n </p>\n )}\n <TimeSeriesLineChart\n ariaLabel={ariaLabel}\n categoryColorById={categoryColorById}\n categoryLabel={(category) => {\n return categoryLabelById[category] ?? category;\n }}\n categoryOrder={categoryOrder}\n formatValue={formatChartValue}\n series={series}\n />\n </div>\n );\n};\n\nexport default BackofficeBillingUsageChart;\n"],"mappings":";;;;;;;;AAgCA,IAAM,IAAgB,MAET,KAA+B,EAC1C,cACA,YACA,eACA,aACA,eACA,SACA,gBACA,OACA,qBACmD;CACnD,IAAM,IAAgB,QACb,EAAW,KAAK,MACd,EAAS,GAChB,EACD,CAAC,EAAW,CAAC,EAEV,IAAoB,QACjB,OAAO,YACZ,EAAW,KAAK,MACP,CAAC,EAAS,IAAI,EAAS,MAAM,CACpC,CACH,EACA,CAAC,EAAW,CAAC,EAEV,IAAoB,QACjB,OAAO,YACZ,EAAW,KAAK,MACP,CAAC,EAAS,IAAI,EAAS,MAAM,CACpC,CACH,EACA,CAAC,EAAW,CAAC,EAEV,IAAS,QACT,KAAQ,QAAQ,KAAM,OACjB,EAAE,GAGJ,EAAyB;EAC9B,iBAAiB;EACjB,eAAe;EACf;EACA,YAAY;EACb,CAAC,EACD;EAAC;EAAS;EAAe;EAAM;EAAG,CAAC,EAEhC,KAAoB,MACjB,EAAqB;EAC1B,QAAQ;EACR;EACD,CAAC;CAOJ,OAJI,EAAQ,WAAW,IACd,kBAAC,KAAD;EAAG,WAAW;YAAmB;EAAe,CAAA,GAIvD,kBAAC,OAAD;EAAK,WAAW;YAAhB;GACE,kBAAC,KAAD;IAAG,WAAW;cAAoB,EAAiB,EAAY;IAAK,CAAA;GACnE,KAAQ,QAAQ,KAAM,QACrB,kBAAC,KAAD;IAAG,WAAW;cAAd;KACG;KAAY;KAAC,kBAAC,GAAD,EAAe,OAAO,GAAQ,CAAA;;KAAE;KAAe;KAC7D,kBAAC,GAAD,EAAe,OAAO,GAAM,CAAA;KAC1B;;GAEN,kBAAC,GAAD;IACa;IACQ;IACnB,gBAAgB,MACP,EAAkB,MAAa;IAEzB;IACf,aAAa;IACL;IACR,CAAA;GACE"}
@@ -0,0 +1,7 @@
1
+ /* empty css */
2
+ //#region src/components/backoffice/billing/backofficeBillingUsageChart.css.ts
3
+ var e = "txvbqb9ip txvbqbai7 txvbqbaog", t = "txvbqb9y txvbqba9 txvbqbamp txvbqbv9z txvbqbfcp", n = "txvbqb8p txvbqbva3 txvbqbfcp";
4
+ //#endregion
5
+ export { n as rangeText, e as root, t as totalValue };
6
+
7
+ //# sourceMappingURL=backofficeBillingUsageChart.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backofficeBillingUsageChart.css.js","names":[],"sources":["../../../../../src/components/backoffice/billing/backofficeBillingUsageChart.css.ts"],"sourcesContent":["import { sprinkles } from '@plumile/ui/theme/sprinkles.css.js';\n\nexport const root = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 3,\n});\n\nexport const totalValue = sprinkles({\n fontSize: {\n base: '2xl',\n md: '3xl',\n },\n fontWeight: 'semibold',\n color: 'text',\n margin: 0,\n});\n\nexport const rangeText = sprinkles({\n fontSize: 'xs',\n color: 'textMuted',\n margin: 0,\n});\n"],"mappings":""}
@@ -1,8 +1,8 @@
1
1
  import { BackofficeInlineLink as e } from "../links/BackofficeInlineLink.js";
2
2
  import { Fragment as t, jsx as n } from "react/jsx-runtime";
3
- import { BACKOFFICE_DATE_TIME_OPTIONS as r } from "@plumile/backoffice-core/constants.js";
4
- import i from "@plumile/router/routing/Link.js";
5
- import { FormattedDate as a } from "@plumile/ui/atomic/atoms/formatted-date/FormattedDate.js";
3
+ import { FormattedDate as r } from "@plumile/ui/atomic/atoms/formatted-date/FormattedDate.js";
4
+ import { BACKOFFICE_DATE_TIME_OPTIONS as i } from "@plumile/backoffice-core/constants.js";
5
+ import a from "@plumile/router/routing/Link.js";
6
6
  import { Tag as o } from "@plumile/ui/backoffice/atoms/tag/Tag.js";
7
7
  //#region src/components/backoffice/columns/buildDataTableColumns.tsx
8
8
  var s = (e, t) => e(t), c = (e, t) => e == null || typeof e == "string" && e.trim() === "" ? t : String(e), l = (e) => {
@@ -25,7 +25,7 @@ function u(u, d) {
25
25
  case "text": return c(l.value(s), m);
26
26
  case "link": {
27
27
  let e = l.value(s);
28
- return e == null || typeof e == "string" && e.trim() === "" ? m : /* @__PURE__ */ n(i, {
28
+ return e == null || typeof e == "string" && e.trim() === "" ? m : /* @__PURE__ */ n(a, {
29
29
  to: l.to(s),
30
30
  children: e
31
31
  });
@@ -39,10 +39,10 @@ function u(u, d) {
39
39
  children: e
40
40
  });
41
41
  }
42
- case "dateTime": return /* @__PURE__ */ n(a, {
42
+ case "dateTime": return /* @__PURE__ */ n(r, {
43
43
  value: l.value(s),
44
44
  fallback: m,
45
- options: r
45
+ options: i
46
46
  });
47
47
  case "entityRef": {
48
48
  let t = l.value(s);
@@ -1,74 +1,80 @@
1
- import { buildEntityGroupLookup as e, isActivePath as t, resolveGroupItems as n, resolveHubEntityIds as r, resolveLabel as i, resolveSidebarGroups as a, resolveSidebarHub as o } from "./sidebarUtils.js";
2
- import { actionButton as s } from "./backofficeSidebarActions.css.js";
3
- import { jsx as c } from "react/jsx-runtime";
4
- import { SidebarTasksSvg as l } from "@plumile/ui/icons/SidebarTasksSvg.js";
5
- import { SidebarHomeSvg as u } from "@plumile/ui/icons/SidebarHomeSvg.js";
6
- import { BackofficeSidebarHistorySvg as d } from "@plumile/ui/icons/backoffice/BackofficeSidebarHistorySvg.js";
7
- import { GripDotsSvg as f } from "@plumile/ui/icons/GripDotsSvg.js";
8
- import { PinFilledSvg as p } from "@plumile/ui/icons/PinFilledSvg.js";
9
- import { PinSvg as m } from "@plumile/ui/icons/PinSvg.js";
1
+ import { buildEntityGroupLookup as e, isActivePath as t, joinBackofficePath as n, resolveGroupItems as r, resolveHubEntityIds as i, resolveLabel as a, resolveSidebarGroups as o, resolveSidebarHub as s } from "./sidebarUtils.js";
2
+ import { actionButton as c } from "./backofficeSidebarActions.css.js";
3
+ import { findBackofficeDashboardRegistration as l } from "../../../provider/dashboardRegistrations.js";
4
+ import { jsx as u } from "react/jsx-runtime";
5
+ import { SidebarTasksSvg as d } from "@plumile/ui/icons/SidebarTasksSvg.js";
6
+ import { SidebarHomeSvg as f } from "@plumile/ui/icons/SidebarHomeSvg.js";
7
+ import { BackofficeSidebarHistorySvg as p } from "@plumile/ui/icons/backoffice/BackofficeSidebarHistorySvg.js";
8
+ import { GripDotsSvg as m } from "@plumile/ui/icons/GripDotsSvg.js";
9
+ import { PinFilledSvg as h } from "@plumile/ui/icons/PinFilledSvg.js";
10
+ import { PinSvg as g } from "@plumile/ui/icons/PinSvg.js";
10
11
  //#region src/components/backoffice/layout/buildSidebarSections.tsx
11
- var h = (e, t, n = 18) => e == null ? t ?? null : /* @__PURE__ */ c(e, {
12
+ var _ = (e, t, n = 18) => e == null ? t ?? null : /* @__PURE__ */ u(e, {
12
13
  width: n,
13
14
  height: n,
14
15
  "aria-hidden": "true"
15
16
  });
16
- function g(g) {
17
- let { basePath: _, pathname: v, entities: y, sidebar: b, permissions: x, searchQuery: S, tApp: C, t: w, pinnedEntityIds: T = [], recentItems: E = [], onTogglePin: D, onReorderPin: O, collapsedByGroupId: k, onGroupCollapsedChange: A, sidebarCollapsed: j = !1 } = g, M = a(y, b), N = Object.entries(M), P = new Set(T), F = w("sidebar.actions.pin"), I = w("sidebar.actions.unpin"), L = w("sidebar.actions.reorder"), R = e(M, b), z = S?.trim().toLowerCase() ?? "", B = (e) => z === "" || e.toLowerCase().includes(z), V = (e) => {
18
- if (D == null) return null;
19
- let t = P.has(e), n = F, r = m;
20
- return t && (n = I, r = p), /* @__PURE__ */ c("button", {
17
+ function v(v) {
18
+ let { basePath: y, pathname: b, entities: x, dashboards: S = [], sidebar: C, permissions: w, searchQuery: T, tApp: E, t: D, pinnedEntityIds: O = [], recentItems: k = [], onTogglePin: A, onReorderPin: j, collapsedByGroupId: M, onGroupCollapsedChange: N, sidebarCollapsed: P = !1 } = v, F = o(x, C), I = Object.entries(F), L = new Set(O), R = D("sidebar.actions.pin"), z = D("sidebar.actions.unpin"), B = D("sidebar.actions.reorder"), V = e(F, C), H = T?.trim().toLowerCase() ?? "", U = (e) => H === "" || e.toLowerCase().includes(H), W = (e) => {
19
+ if (A == null) return null;
20
+ let t = L.has(e), n = R, r = g;
21
+ return t && (n = z, r = h), /* @__PURE__ */ u("button", {
21
22
  type: "button",
22
- className: s,
23
+ className: c,
23
24
  "aria-pressed": t,
24
25
  "aria-label": n,
25
26
  title: n,
26
27
  onClick: (t) => {
27
- t.preventDefault(), t.stopPropagation(), D(e);
28
+ t.preventDefault(), t.stopPropagation(), A(e);
28
29
  },
29
- children: /* @__PURE__ */ c(r, {
30
+ children: /* @__PURE__ */ u(r, {
30
31
  width: 14,
31
32
  height: 14,
32
33
  "aria-hidden": "true"
33
34
  })
34
35
  });
35
- }, H = (e) => {
36
- if (b?.isItemVisible?.({
36
+ }, G = (e, r) => {
37
+ let i = e?.id ?? "dashboard", o = {
37
38
  kind: "dashboard",
38
- id: "dashboard"
39
- }, x) === !1) return null;
40
- let n = w("sidebar.items.dashboard");
41
- return B(n) ? {
42
- id: "dashboard",
39
+ id: i
40
+ };
41
+ if (C?.isItemVisible?.(o, w) === !1) return null;
42
+ let s = l(S, i), c = e?.label;
43
+ if (c == null && s != null && (c = a(s.label, E)), c ??= D("sidebar.items.dashboard"), !U(c)) return null;
44
+ let d = y, p = "dashboard";
45
+ i !== "dashboard" && (d = n(y, `dashboard/${i}`), p = `dashboard-${i}`);
46
+ let m = t(b, d);
47
+ return i === "dashboard" && (m = b === y || b === `${y}/dashboard`), {
48
+ id: p,
43
49
  data: {
44
50
  kind: "dashboard",
45
- id: "dashboard",
46
- groupId: e
51
+ id: i,
52
+ groupId: r
47
53
  },
48
- label: n,
49
- href: _,
50
- icon: h(void 0, /* @__PURE__ */ c(u, {
54
+ label: c,
55
+ href: d,
56
+ icon: _(e?.icon ?? s?.icon, /* @__PURE__ */ u(f, {
51
57
  width: 18,
52
58
  height: 18,
53
59
  "aria-hidden": "true"
54
60
  })),
55
- isActive: t(v, _),
56
- ariaLabel: n
57
- } : null;
58
- }, U = (e) => {
59
- let { entityId: n, groupId: r, groupIcon: a, itemIcon: o, itemLabel: s, enableReorder: u } = e, d = y[n];
60
- if (d == null) return null;
61
- let p = {
61
+ isActive: m,
62
+ ariaLabel: c
63
+ };
64
+ }, K = (e) => {
65
+ let { entityId: n, groupId: r, groupIcon: i, itemIcon: o, itemLabel: s, enableReorder: c } = e, l = x[n];
66
+ if (l == null) return null;
67
+ let f = {
62
68
  kind: "entity",
63
69
  id: n
64
70
  };
65
- if (d.kind === "tool" && (p = {
71
+ if (l.kind === "tool" && (f = {
66
72
  kind: "tool",
67
73
  id: n
68
- }), b?.isItemVisible?.(p, x) === !1) return null;
69
- if (d.kind === "tool") {
70
- let e = s ?? i(d.label, C);
71
- return z !== "" && !e.toLowerCase().includes(z) ? null : {
74
+ }), C?.isItemVisible?.(f, w) === !1) return null;
75
+ if (l.kind === "tool") {
76
+ let e = s ?? a(l.label, E);
77
+ return H !== "" && !e.toLowerCase().includes(H) ? null : {
72
78
  id: `tool-${n}`,
73
79
  data: {
74
80
  kind: "tool",
@@ -76,69 +82,54 @@ function g(g) {
76
82
  groupId: r
77
83
  },
78
84
  label: e,
79
- href: d.routes.list,
80
- icon: h(o ?? a, /* @__PURE__ */ c(l, {
85
+ href: l.routes.list,
86
+ icon: _(o ?? i, /* @__PURE__ */ u(d, {
81
87
  width: 18,
82
88
  height: 18,
83
89
  "aria-hidden": "true"
84
90
  })),
85
- isActive: t(v, d.routes.list),
91
+ isActive: t(b, l.routes.list),
86
92
  ariaLabel: e,
87
- actionSlot: V(n)
93
+ actionSlot: W(n)
88
94
  };
89
95
  }
90
- if (!d.hasList) return null;
91
- let m = s ?? i(d.label, C);
92
- if (z !== "" && !m.toLowerCase().includes(z)) return null;
93
- let g, _, S, w, T = !1;
94
- u === !0 && O != null && (T = !0, g = /* @__PURE__ */ c(f, {
96
+ if (!l.hasList) return null;
97
+ let p = s ?? a(l.label, E);
98
+ if (H !== "" && !p.toLowerCase().includes(H)) return null;
99
+ let h;
100
+ c === !0 && j != null && (h = /* @__PURE__ */ u(m, {
95
101
  width: 14,
96
102
  height: 14,
97
103
  "aria-hidden": "true"
98
- }), _ = (e) => {
99
- let { dataTransfer: t } = e;
100
- t.effectAllowed = "move", t.setData("text/plain", n);
101
- }, S = (e) => {
102
- e.preventDefault();
103
- let { dataTransfer: t } = e;
104
- t.dropEffect = "move";
105
- }, w = (e) => {
106
- e.preventDefault();
107
- let t = e.dataTransfer.getData("text/plain");
108
- t === "" || t === n || O(t, n);
109
- });
110
- let E;
111
- return g != null && (E = L), {
104
+ }));
105
+ let g;
106
+ return h != null && (g = B), {
112
107
  id: n,
113
108
  data: {
114
109
  kind: "entity",
115
110
  id: n,
116
111
  groupId: r
117
112
  },
118
- label: m,
119
- href: d.routes.list,
120
- icon: h(o ?? a, /* @__PURE__ */ c(l, {
113
+ label: p,
114
+ href: l.routes.list,
115
+ icon: _(o ?? i, /* @__PURE__ */ u(d, {
121
116
  width: 18,
122
117
  height: 18,
123
118
  "aria-hidden": "true"
124
119
  })),
125
- isActive: t(v, d.routes.list),
126
- ariaLabel: m,
127
- actionSlot: V(n),
128
- dragHandleSlot: g,
129
- dragHandleLabel: E,
130
- draggable: T,
131
- onDragStart: _,
132
- onDragOver: S,
133
- onDrop: w
120
+ isActive: t(b, l.routes.list),
121
+ ariaLabel: p,
122
+ actionSlot: W(n),
123
+ dragHandleSlot: h,
124
+ dragHandleLabel: g
134
125
  };
135
- }, W = (e) => {
136
- let { hub: n, groupId: a, icon: o } = e, s = {
126
+ }, q = (e) => {
127
+ let { hub: n, groupId: r, icon: o } = e, s = {
137
128
  kind: "hub",
138
129
  id: n.id
139
130
  };
140
- if (b?.isItemVisible?.(s, x) === !1) return null;
141
- let u = r(n), d = u.map((e) => y[e] ?? null).filter((e) => {
131
+ if (C?.isItemVisible?.(s, w) === !1) return null;
132
+ let c = i(n), l = c.map((e) => x[e] ?? null).filter((e) => {
142
133
  if (e == null) return !1;
143
134
  let t = "entity";
144
135
  e.kind === "tool" && (t = "tool");
@@ -146,54 +137,61 @@ function g(g) {
146
137
  kind: t,
147
138
  id: e.id
148
139
  };
149
- return !(b?.isItemVisible?.(n, x) === !1 || e.kind !== "tool" && !e.hasList);
140
+ return !(C?.isItemVisible?.(n, w) === !1 || e.kind !== "tool" && !e.hasList);
150
141
  });
151
- if (u.length > 0 && d.length === 0) return null;
152
- let f = i(n.title, C), p = B(f), m = d.some((e) => B(i(e.label, C)));
142
+ if (c.length > 0 && l.length === 0) return null;
143
+ let f = a(n.title, E), p = U(f), m = l.some((e) => U(a(e.label, E)));
153
144
  if (!p && !m) return null;
154
- let g = t(v, n.href) || d.some((e) => t(v, e.routes.list));
145
+ let h = t(b, n.href) || l.some((e) => t(b, e.routes.list));
155
146
  return {
156
147
  id: `hub-${n.id}`,
157
148
  data: {
158
149
  kind: "hub",
159
150
  id: n.id,
160
- groupId: a
151
+ groupId: r
161
152
  },
162
153
  label: f,
163
154
  href: n.href,
164
- icon: h(o, /* @__PURE__ */ c(l, {
155
+ icon: _(o, /* @__PURE__ */ u(d, {
165
156
  width: 18,
166
157
  height: 18,
167
158
  "aria-hidden": "true"
168
159
  })),
169
- isActive: g,
160
+ isActive: h,
170
161
  ariaLabel: f
171
162
  };
172
- }, G = [], K = b?.primaryItems ?? [];
173
- if (K.length > 0) {
174
- let e = K.map((e) => {
175
- if (e.kind === "dashboard") return H();
176
- if (e.kind === "hub") return W({
177
- hub: o(e, b),
163
+ }, J = [], Y = C?.primaryItems ?? [];
164
+ if (Y.length > 0) {
165
+ let e = Y.map((e) => {
166
+ if (e.kind === "dashboard") {
167
+ let t;
168
+ return e.label != null && (t = a(e.label, E)), G({
169
+ id: e.id,
170
+ icon: e.icon,
171
+ label: t
172
+ });
173
+ }
174
+ if (e.kind === "hub") return q({
175
+ hub: s(e, C),
178
176
  icon: e.icon
179
177
  });
180
178
  let t;
181
- return e.label != null && (t = i(e.label, C)), U({
179
+ return e.label != null && (t = a(e.label, E)), K({
182
180
  entityId: e.id,
183
181
  itemIcon: e.icon,
184
182
  itemLabel: t
185
183
  });
186
184
  }).filter((e) => e != null);
187
- e.length > 0 && G.push({
185
+ e.length > 0 && J.push({
188
186
  id: "primary",
189
187
  items: e,
190
188
  collapsible: !1
191
189
  });
192
190
  }
193
- if (T.length > 0) {
194
- let e = T.map((e) => {
195
- let t = R.get(e);
196
- return U({
191
+ if (O.length > 0) {
192
+ let e = O.map((e) => {
193
+ let t = V.get(e);
194
+ return K({
197
195
  entityId: e,
198
196
  groupId: t?.groupId,
199
197
  groupIcon: t?.groupIcon,
@@ -201,27 +199,39 @@ function g(g) {
201
199
  enableReorder: !0
202
200
  });
203
201
  }).filter((e) => e != null);
204
- e.length > 0 && G.push({
205
- id: "pinned",
206
- title: w("sidebar.sections.pinned"),
207
- icon: h(void 0, /* @__PURE__ */ c(m, {
208
- width: 16,
209
- height: 16,
210
- "aria-hidden": "true"
211
- })),
212
- items: e,
213
- collapsible: !1
214
- });
202
+ if (e.length > 0) {
203
+ let t;
204
+ j != null && e.length > 1 && (t = {
205
+ enabled: !0,
206
+ onReorder: j
207
+ });
208
+ let n = e;
209
+ t ?? (n = e.map((e) => {
210
+ let { dragHandleSlot: t, dragHandleLabel: n, ...r } = e;
211
+ return r;
212
+ })), J.push({
213
+ id: "pinned",
214
+ title: D("sidebar.sections.pinned"),
215
+ icon: _(void 0, /* @__PURE__ */ u(g, {
216
+ width: 16,
217
+ height: 16,
218
+ "aria-hidden": "true"
219
+ })),
220
+ items: n,
221
+ collapsible: !1,
222
+ reorder: t
223
+ });
224
+ }
215
225
  }
216
- if (E.length > 0) {
217
- let e = E.map((e) => {
218
- if (y[e.id] == null) return null;
226
+ if (k.length > 0) {
227
+ let e = k.map((e) => {
228
+ if (x[e.id] == null) return null;
219
229
  let n = {
220
230
  kind: e.kind,
221
231
  id: e.id
222
232
  };
223
- if (b?.isItemVisible?.(n, x) === !1 || z !== "" && !e.label.toLowerCase().includes(z)) return null;
224
- let r = R.get(e.id);
233
+ if (C?.isItemVisible?.(n, w) === !1 || H !== "" && !e.label.toLowerCase().includes(H)) return null;
234
+ let r = V.get(e.id);
225
235
  return {
226
236
  id: `recent-${e.kind}-${e.id}`,
227
237
  data: {
@@ -231,19 +241,19 @@ function g(g) {
231
241
  },
232
242
  label: e.label,
233
243
  href: e.href,
234
- icon: h(r?.itemIcon ?? r?.groupIcon, /* @__PURE__ */ c(l, {
244
+ icon: _(r?.itemIcon ?? r?.groupIcon, /* @__PURE__ */ u(d, {
235
245
  width: 18,
236
246
  height: 18,
237
247
  "aria-hidden": "true"
238
248
  })),
239
- isActive: t(v, e.href),
249
+ isActive: t(b, e.href),
240
250
  ariaLabel: e.label
241
251
  };
242
252
  }).filter((e) => e != null);
243
- e.length > 0 && G.push({
253
+ e.length > 0 && J.push({
244
254
  id: "recent",
245
- title: w("sidebar.sections.recent"),
246
- icon: h(void 0, /* @__PURE__ */ c(d, {
255
+ title: D("sidebar.sections.recent"),
256
+ icon: _(void 0, /* @__PURE__ */ u(p, {
247
257
  width: 16,
248
258
  height: 16,
249
259
  "aria-hidden": "true"
@@ -252,55 +262,61 @@ function g(g) {
252
262
  collapsible: !1
253
263
  });
254
264
  }
255
- return N.forEach(([e, t]) => {
256
- if (t.isVisible != null && !t.isVisible(x)) return;
257
- let r = [], a = n(t);
258
- a.length > 0 && a.forEach((n) => {
259
- if (n.kind === "dashboard") {
260
- let t = H(e);
261
- t != null && r.push(t);
265
+ return I.forEach(([e, t]) => {
266
+ if (t.isVisible != null && !t.isVisible(w)) return;
267
+ let n = [], i = r(t);
268
+ i.length > 0 && i.forEach((r) => {
269
+ if (r.kind === "dashboard") {
270
+ let i;
271
+ r.label != null && (i = a(r.label, E));
272
+ let o = G({
273
+ id: r.id,
274
+ icon: r.icon ?? t.icon,
275
+ label: i
276
+ }, e);
277
+ o != null && n.push(o);
262
278
  return;
263
279
  }
264
- if (n.kind === "hub") {
265
- let i = W({
266
- hub: o(n, b),
280
+ if (r.kind === "hub") {
281
+ let i = q({
282
+ hub: s(r, C),
267
283
  groupId: e,
268
- icon: n.icon ?? t.icon
284
+ icon: r.icon ?? t.icon
269
285
  });
270
- i != null && r.push(i);
286
+ i != null && n.push(i);
271
287
  return;
272
288
  }
273
- let a;
274
- n.label != null && (a = i(n.label, C));
275
- let s = U({
276
- entityId: n.id,
289
+ let i;
290
+ r.label != null && (i = a(r.label, E));
291
+ let o = K({
292
+ entityId: r.id,
277
293
  groupId: e,
278
294
  groupIcon: t.icon,
279
- itemIcon: n.icon,
280
- itemLabel: a
295
+ itemIcon: r.icon,
296
+ itemLabel: i
281
297
  });
282
- s != null && r.push(s);
298
+ o != null && n.push(o);
283
299
  });
284
- let s = r;
285
- if (j && t.behavior?.showInCollapsedRail !== !0 && (s = r.filter((e) => e.id === "dashboard" || e.isActive === !0)), s.length === 0) return;
300
+ let o = n;
301
+ if (P && t.behavior?.showInCollapsedRail !== !0 && (o = n.filter((e) => e.data?.kind === "dashboard" || e.isActive === !0)), o.length === 0) return;
286
302
  let c;
287
- t.title != null && (c = i(t.title, C));
288
- let l = k?.[e], u;
289
- A != null && (u = (t) => {
290
- A(e, t);
291
- }), G.push({
303
+ t.title != null && (c = a(t.title, E));
304
+ let l = M?.[e], u;
305
+ N != null && (u = (t) => {
306
+ N(e, t);
307
+ }), J.push({
292
308
  id: e,
293
309
  title: c,
294
- icon: h(t.icon, void 0, 16),
295
- items: s,
310
+ icon: _(t.icon, void 0, 16),
311
+ items: o,
296
312
  collapsible: t.behavior?.collapsible ?? !0,
297
313
  defaultCollapsed: t.behavior?.defaultCollapsed ?? !0,
298
314
  isCollapsed: l,
299
315
  onCollapsedChange: u
300
316
  });
301
- }), G;
317
+ }), J;
302
318
  }
303
319
  //#endregion
304
- export { g as buildSidebarSections };
320
+ export { v as buildSidebarSections };
305
321
 
306
322
  //# sourceMappingURL=buildSidebarSections.js.map