@plumile/backoffice-react 0.1.117 → 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.
@@ -96,25 +96,14 @@ function v(v) {
96
96
  if (!l.hasList) return null;
97
97
  let p = s ?? a(l.label, E);
98
98
  if (H !== "" && !p.toLowerCase().includes(H)) return null;
99
- let h, g, v, y, S = !1;
100
- c === !0 && j != null && (S = !0, h = /* @__PURE__ */ u(m, {
99
+ let h;
100
+ c === !0 && j != null && (h = /* @__PURE__ */ u(m, {
101
101
  width: 14,
102
102
  height: 14,
103
103
  "aria-hidden": "true"
104
- }), g = (e) => {
105
- let { dataTransfer: t } = e;
106
- t.effectAllowed = "move", t.setData("text/plain", n);
107
- }, v = (e) => {
108
- e.preventDefault();
109
- let { dataTransfer: t } = e;
110
- t.dropEffect = "move";
111
- }, y = (e) => {
112
- e.preventDefault();
113
- let t = e.dataTransfer.getData("text/plain");
114
- t === "" || t === n || j(t, n);
115
- });
116
- let T;
117
- return h != null && (T = B), {
104
+ }));
105
+ let g;
106
+ return h != null && (g = B), {
118
107
  id: n,
119
108
  data: {
120
109
  kind: "entity",
@@ -132,11 +121,7 @@ function v(v) {
132
121
  ariaLabel: p,
133
122
  actionSlot: W(n),
134
123
  dragHandleSlot: h,
135
- dragHandleLabel: T,
136
- draggable: S,
137
- onDragStart: g,
138
- onDragOver: v,
139
- onDrop: y
124
+ dragHandleLabel: g
140
125
  };
141
126
  }, q = (e) => {
142
127
  let { hub: n, groupId: r, icon: o } = e, s = {
@@ -214,17 +199,29 @@ function v(v) {
214
199
  enableReorder: !0
215
200
  });
216
201
  }).filter((e) => e != null);
217
- e.length > 0 && J.push({
218
- id: "pinned",
219
- title: D("sidebar.sections.pinned"),
220
- icon: _(void 0, /* @__PURE__ */ u(g, {
221
- width: 16,
222
- height: 16,
223
- "aria-hidden": "true"
224
- })),
225
- items: e,
226
- collapsible: !1
227
- });
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
+ }
228
225
  }
229
226
  if (k.length > 0) {
230
227
  let e = k.map((e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"buildSidebarSections.js","names":[],"sources":["../../../../../src/components/backoffice/layout/buildSidebarSections.tsx"],"sourcesContent":["import { type DragEvent, type ReactNode } from 'react';\nimport type { TFunction } from 'i18next';\n\nimport type { BackofficeEntityManifestMap } from '@plumile/backoffice-core/types.js';\nimport type {\n BackofficeSidebarConfig,\n BackofficeDashboardRegistration,\n BackofficeSidebarItemDescriptor,\n BackofficeIconComponent,\n BackofficeSidebarRecentItem,\n} from '../../../provider/types.js';\nimport { type AdminSidebarSection } from '@plumile/ui/admin/organisms/admin_sidebar/AdminSidebar.js';\nimport { type SidebarNavSectionItem } from '@plumile/ui/backoffice/molecules/sidebar_nav_section/SidebarNavSection.js';\nimport { BackofficeSidebarHistorySvg } from '@plumile/ui/icons/backoffice/BackofficeSidebarHistorySvg.js';\nimport { GripDotsSvg } from '@plumile/ui/icons/GripDotsSvg.js';\nimport { PinFilledSvg } from '@plumile/ui/icons/PinFilledSvg.js';\nimport { PinSvg } from '@plumile/ui/icons/PinSvg.js';\nimport { SidebarHomeSvg } from '@plumile/ui/icons/SidebarHomeSvg.js';\nimport { SidebarTasksSvg } from '@plumile/ui/icons/SidebarTasksSvg.js';\nimport type { SidebarGroupCollapseState } from '../../../hooks/useSidebarGroupCollapse.js';\nimport { findBackofficeDashboardRegistration } from '../../../provider/dashboardRegistrations.js';\nimport * as styles from './backofficeSidebarActions.css.js';\nimport {\n buildEntityGroupLookup,\n isActivePath,\n joinBackofficePath,\n resolveLabel,\n resolveGroupItems,\n resolveHubEntityIds,\n resolveSidebarHub,\n resolveSidebarGroups,\n} from './sidebarUtils.js';\n\nconst renderIcon = (\n Icon?: BackofficeIconComponent,\n fallback?: ReactNode,\n size = 18,\n): ReactNode => {\n if (Icon != null) {\n return <Icon width={size} height={size} aria-hidden=\"true\" />;\n }\n return fallback ?? null;\n};\n\nexport type BuildSidebarSectionsInput = {\n basePath: string;\n pathname: string;\n entities: BackofficeEntityManifestMap;\n dashboards?: readonly BackofficeDashboardRegistration[];\n sidebar?: BackofficeSidebarConfig;\n permissions: unknown;\n searchQuery?: string;\n tApp: TFunction;\n t: TFunction;\n pinnedEntityIds?: readonly string[];\n recentItems?: readonly BackofficeSidebarRecentItem[];\n onTogglePin?: (entityId: string) => void;\n onReorderPin?: (fromId: string, toId: string) => void;\n collapsedByGroupId?: SidebarGroupCollapseState;\n onGroupCollapsedChange?: (groupId: string, collapsed: boolean) => void;\n sidebarCollapsed?: boolean;\n};\n\n/**\n * Builds the sidebar sections for the backoffice layout.\n */\nexport function buildSidebarSections(\n input: BuildSidebarSectionsInput,\n): readonly AdminSidebarSection[] {\n const {\n basePath,\n pathname,\n entities,\n dashboards = [],\n sidebar,\n permissions,\n searchQuery,\n tApp,\n t,\n pinnedEntityIds = [],\n recentItems = [],\n onTogglePin,\n onReorderPin,\n collapsedByGroupId,\n onGroupCollapsedChange,\n sidebarCollapsed = false,\n } = input;\n\n const groups = resolveSidebarGroups(entities, sidebar);\n const entries = Object.entries(groups);\n const pinnedSet = new Set(pinnedEntityIds);\n const pinLabel = t('sidebar.actions.pin');\n const unpinLabel = t('sidebar.actions.unpin');\n const reorderLabel = t('sidebar.actions.reorder');\n const entityGroupLookup = buildEntityGroupLookup(groups, sidebar);\n const normalizedQuery = searchQuery?.trim().toLowerCase() ?? '';\n\n const labelMatchesQuery = (label: string): boolean => {\n return (\n normalizedQuery === '' || label.toLowerCase().includes(normalizedQuery)\n );\n };\n\n const renderPinAction = (entityId: string): ReactNode | null => {\n if (onTogglePin == null) {\n return null;\n }\n const isPinned = pinnedSet.has(entityId);\n let label = pinLabel;\n let Icon = PinSvg;\n if (isPinned) {\n label = unpinLabel;\n Icon = PinFilledSvg;\n }\n\n return (\n <button\n type=\"button\"\n className={styles.actionButton}\n aria-pressed={isPinned}\n aria-label={label}\n title={label}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n onTogglePin(entityId);\n }}\n >\n <Icon width={14} height={14} aria-hidden=\"true\" />\n </button>\n );\n };\n\n const buildDashboardItem = (\n inputItem?: {\n id?: string;\n icon?: BackofficeIconComponent;\n label?: string;\n },\n groupId?: string,\n ): SidebarNavSectionItem | null => {\n const dashboardId = inputItem?.id ?? 'dashboard';\n const dashboardDescriptor: BackofficeSidebarItemDescriptor = {\n kind: 'dashboard',\n id: dashboardId,\n };\n const isDashboardVisible = sidebar?.isItemVisible?.(\n dashboardDescriptor,\n permissions,\n );\n if (isDashboardVisible === false) {\n return null;\n }\n\n const registration = findBackofficeDashboardRegistration(\n dashboards,\n dashboardId,\n );\n let label = inputItem?.label;\n if (label == null && registration != null) {\n label = resolveLabel(registration.label, tApp);\n }\n label ??= t('sidebar.items.dashboard');\n if (!labelMatchesQuery(label)) {\n return null;\n }\n\n let href = basePath;\n let id = 'dashboard';\n if (dashboardId !== 'dashboard') {\n href = joinBackofficePath(basePath, `dashboard/${dashboardId}`);\n id = `dashboard-${dashboardId}`;\n }\n\n let isActive = isActivePath(pathname, href);\n if (dashboardId === 'dashboard') {\n isActive = pathname === basePath || pathname === `${basePath}/dashboard`;\n }\n\n return {\n id,\n data: {\n kind: 'dashboard',\n id: dashboardId,\n groupId,\n },\n label,\n href,\n icon: renderIcon(\n inputItem?.icon ?? registration?.icon,\n <SidebarHomeSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive,\n ariaLabel: label,\n };\n };\n\n const buildEntityItem = (inputItem: {\n entityId: string;\n groupId?: string;\n groupIcon?: BackofficeIconComponent;\n itemIcon?: BackofficeIconComponent;\n itemLabel?: string;\n enableReorder?: boolean;\n }): SidebarNavSectionItem | null => {\n const { entityId, groupId, groupIcon, itemIcon, itemLabel, enableReorder } =\n inputItem;\n const config = entities[entityId];\n if (config == null) {\n return null;\n }\n\n let descriptor: BackofficeSidebarItemDescriptor = {\n kind: 'entity',\n id: entityId,\n };\n if (config.kind === 'tool') {\n descriptor = { kind: 'tool', id: entityId };\n }\n const isEntityVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isEntityVisible === false) {\n return null;\n }\n\n if (config.kind === 'tool') {\n const label = itemLabel ?? resolveLabel(config.label, tApp);\n if (\n normalizedQuery !== '' &&\n !label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n return {\n id: `tool-${entityId}`,\n data: {\n kind: 'tool',\n id: entityId,\n groupId,\n },\n label,\n href: config.routes.list,\n icon: renderIcon(\n itemIcon ?? groupIcon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, config.routes.list),\n ariaLabel: label,\n actionSlot: renderPinAction(entityId),\n };\n }\n\n if (!config.hasList) {\n return null;\n }\n\n const label = itemLabel ?? resolveLabel(config.label, tApp);\n if (\n normalizedQuery !== '' &&\n !label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n\n let dragHandleSlot: ReactNode | undefined;\n let onDragStart: ((event: DragEvent) => void) | undefined;\n let onDragOver: ((event: DragEvent) => void) | undefined;\n let onDrop: ((event: DragEvent) => void) | undefined;\n let draggable = false;\n\n if (enableReorder === true && onReorderPin != null) {\n draggable = true;\n dragHandleSlot = (\n <GripDotsSvg width={14} height={14} aria-hidden=\"true\" />\n );\n onDragStart = (event) => {\n const { dataTransfer } = event;\n dataTransfer.effectAllowed = 'move';\n dataTransfer.setData('text/plain', entityId);\n };\n onDragOver = (event) => {\n event.preventDefault();\n const { dataTransfer } = event;\n dataTransfer.dropEffect = 'move';\n };\n onDrop = (event) => {\n event.preventDefault();\n const fromId = event.dataTransfer.getData('text/plain');\n if (fromId === '' || fromId === entityId) {\n return;\n }\n onReorderPin(fromId, entityId);\n };\n }\n\n let dragHandleLabel: string | undefined;\n if (dragHandleSlot != null) {\n dragHandleLabel = reorderLabel;\n }\n\n return {\n id: entityId,\n data: {\n kind: 'entity',\n id: entityId,\n groupId,\n },\n label,\n href: config.routes.list,\n icon: renderIcon(\n itemIcon ?? groupIcon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, config.routes.list),\n ariaLabel: label,\n actionSlot: renderPinAction(entityId),\n dragHandleSlot,\n dragHandleLabel,\n draggable,\n onDragStart,\n onDragOver,\n onDrop,\n };\n };\n\n const buildHubItem = (inputItem: {\n hub: ReturnType<typeof resolveSidebarHub>;\n groupId?: string;\n icon?: BackofficeIconComponent;\n }): SidebarNavSectionItem | null => {\n const { hub, groupId, icon } = inputItem;\n const descriptor: BackofficeSidebarItemDescriptor = {\n kind: 'hub',\n id: hub.id,\n };\n const isVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isVisible === false) {\n return null;\n }\n const childEntityIds = resolveHubEntityIds(hub);\n const visibleChildConfigs = childEntityIds\n .map((entityId) => {\n return entities[entityId] ?? null;\n })\n .filter((config): config is BackofficeEntityManifestMap[string] => {\n if (config == null) {\n return false;\n }\n let childKind: BackofficeSidebarItemDescriptor['kind'] = 'entity';\n if (config.kind === 'tool') {\n childKind = 'tool';\n }\n const childDescriptor: BackofficeSidebarItemDescriptor = {\n kind: childKind,\n id: config.id,\n };\n const isChildVisible = sidebar?.isItemVisible?.(\n childDescriptor,\n permissions,\n );\n if (isChildVisible === false) {\n return false;\n }\n if (config.kind !== 'tool' && !config.hasList) {\n return false;\n }\n return true;\n });\n if (childEntityIds.length > 0 && visibleChildConfigs.length === 0) {\n return null;\n }\n const label = resolveLabel(hub.title, tApp);\n const matchesHub = labelMatchesQuery(label);\n const matchesChild = visibleChildConfigs.some((config) => {\n return labelMatchesQuery(resolveLabel(config.label, tApp));\n });\n if (!matchesHub && !matchesChild) {\n return null;\n }\n const isActive =\n isActivePath(pathname, hub.href) ||\n visibleChildConfigs.some((config) => {\n return isActivePath(pathname, config.routes.list);\n });\n return {\n id: `hub-${hub.id}`,\n data: {\n kind: 'hub',\n id: hub.id,\n groupId,\n },\n label,\n href: hub.href,\n icon: renderIcon(\n icon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive,\n ariaLabel: label,\n };\n };\n\n const sections: AdminSidebarSection[] = [];\n\n const primaryItems = sidebar?.primaryItems ?? [];\n if (primaryItems.length > 0) {\n const primarySectionItems = primaryItems\n .map((primaryItem): SidebarNavSectionItem | null => {\n if (primaryItem.kind === 'dashboard') {\n let itemLabel: string | undefined;\n if (primaryItem.label != null) {\n itemLabel = resolveLabel(primaryItem.label, tApp);\n }\n return buildDashboardItem({\n id: primaryItem.id,\n icon: primaryItem.icon,\n label: itemLabel,\n });\n }\n if (primaryItem.kind === 'hub') {\n const hub = resolveSidebarHub(primaryItem, sidebar);\n return buildHubItem({\n hub,\n icon: primaryItem.icon,\n });\n }\n let itemLabel: string | undefined;\n if (primaryItem.label != null) {\n itemLabel = resolveLabel(primaryItem.label, tApp);\n }\n return buildEntityItem({\n entityId: primaryItem.id,\n itemIcon: primaryItem.icon,\n itemLabel,\n });\n })\n .filter((item): item is SidebarNavSectionItem => {\n return item != null;\n });\n\n if (primarySectionItems.length > 0) {\n sections.push({\n id: 'primary',\n items: primarySectionItems,\n collapsible: false,\n });\n }\n }\n\n if (pinnedEntityIds.length > 0) {\n const pinnedItems = pinnedEntityIds\n .map((entityId) => {\n const groupMeta = entityGroupLookup.get(entityId);\n return buildEntityItem({\n entityId,\n groupId: groupMeta?.groupId,\n groupIcon: groupMeta?.groupIcon,\n itemIcon: groupMeta?.itemIcon,\n enableReorder: true,\n });\n })\n .filter((item): item is SidebarNavSectionItem => {\n return item != null;\n });\n\n if (pinnedItems.length > 0) {\n sections.push({\n id: 'pinned',\n title: t('sidebar.sections.pinned'),\n icon: renderIcon(\n undefined,\n <PinSvg width={16} height={16} aria-hidden=\"true\" />,\n ),\n items: pinnedItems,\n collapsible: false,\n });\n }\n }\n\n if (recentItems.length > 0) {\n const recentSectionItems = recentItems\n .map((recentItem): SidebarNavSectionItem | null => {\n const config = entities[recentItem.id];\n if (config == null) {\n return null;\n }\n const descriptor: BackofficeSidebarItemDescriptor = {\n kind: recentItem.kind,\n id: recentItem.id,\n };\n const isVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isVisible === false) {\n return null;\n }\n if (\n normalizedQuery !== '' &&\n !recentItem.label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n const groupMeta = entityGroupLookup.get(recentItem.id);\n return {\n id: `recent-${recentItem.kind}-${recentItem.id}`,\n data: {\n kind: recentItem.kind,\n id: recentItem.id,\n groupId: groupMeta?.groupId,\n },\n label: recentItem.label,\n href: recentItem.href,\n icon: renderIcon(\n groupMeta?.itemIcon ?? groupMeta?.groupIcon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, recentItem.href),\n ariaLabel: recentItem.label,\n } satisfies SidebarNavSectionItem;\n })\n .filter((item): item is SidebarNavSectionItem => {\n return item != null;\n });\n\n if (recentSectionItems.length > 0) {\n sections.push({\n id: 'recent',\n title: t('sidebar.sections.recent'),\n icon: renderIcon(\n undefined,\n <BackofficeSidebarHistorySvg\n width={16}\n height={16}\n aria-hidden=\"true\"\n />,\n ),\n items: recentSectionItems,\n collapsible: false,\n });\n }\n }\n\n entries.forEach(([groupId, group]) => {\n if (group.isVisible != null && !group.isVisible(permissions)) {\n return;\n }\n\n const items: SidebarNavSectionItem[] = [];\n\n const groupItems = resolveGroupItems(group);\n if (groupItems.length > 0) {\n groupItems.forEach((groupItem) => {\n if (groupItem.kind === 'dashboard') {\n let itemLabel: string | undefined;\n if (groupItem.label != null) {\n itemLabel = resolveLabel(groupItem.label, tApp);\n }\n const item = buildDashboardItem(\n {\n id: groupItem.id,\n icon: groupItem.icon ?? group.icon,\n label: itemLabel,\n },\n groupId,\n );\n if (item != null) {\n items.push(item);\n }\n return;\n }\n if (groupItem.kind === 'hub') {\n const hub = resolveSidebarHub(groupItem, sidebar);\n const item = buildHubItem({\n hub,\n groupId,\n icon: groupItem.icon ?? group.icon,\n });\n if (item != null) {\n items.push(item);\n }\n return;\n }\n let itemLabel: string | undefined;\n if (groupItem.label != null) {\n itemLabel = resolveLabel(groupItem.label, tApp);\n }\n const item = buildEntityItem({\n entityId: groupItem.id,\n groupId,\n groupIcon: group.icon,\n itemIcon: groupItem.icon,\n itemLabel,\n });\n if (item != null) {\n items.push(item);\n }\n });\n }\n\n let sectionItems: SidebarNavSectionItem[] = items;\n if (sidebarCollapsed && group.behavior?.showInCollapsedRail !== true) {\n sectionItems = items.filter((item) => {\n return item.data?.kind === 'dashboard' || item.isActive === true;\n });\n }\n\n if (sectionItems.length === 0) {\n return;\n }\n\n let title: string | undefined;\n if (group.title != null) {\n title = resolveLabel(group.title, tApp);\n }\n\n const isCollapsed = collapsedByGroupId?.[groupId];\n let onCollapsedChange: ((collapsed: boolean) => void) | undefined;\n if (onGroupCollapsedChange != null) {\n onCollapsedChange = (collapsed: boolean) => {\n onGroupCollapsedChange(groupId, collapsed);\n };\n }\n\n sections.push({\n id: groupId,\n title,\n icon: renderIcon(group.icon, undefined, 16),\n items: sectionItems,\n collapsible: group.behavior?.collapsible ?? true,\n defaultCollapsed: group.behavior?.defaultCollapsed ?? true,\n isCollapsed,\n onCollapsedChange,\n });\n });\n\n return sections;\n}\n"],"mappings":";;;;;;;;;;;AAiCA,IAAM,KACJ,GACA,GACA,IAAO,OAEH,KAAQ,OAGL,KAAY,OAFV,kBAAC,GAAD;CAAM,OAAO;CAAM,QAAQ;CAAM,eAAY;CAAS,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e,EAAM,QAAQ,MACpB,EAAK,MAAM,SAAS,eAAe,EAAK,aAAa,GAC5D,GAGA,EAAa,WAAW,GAC1B;EAGF,IAAI;EACJ,AAAI,EAAM,SAAS,SACjB,IAAQ,EAAa,EAAM,OAAO,EAAK;EAGzC,IAAM,IAAc,IAAqB,IACrC;EAOJ,AANI,KAA0B,SAC5B,KAAqB,MAAuB;GAC1C,EAAuB,GAAS,EAAU;MAI9C,EAAS,KAAK;GACZ,IAAI;GACJ;GACA,MAAM,EAAW,EAAM,MAAM,KAAA,GAAW,GAAG;GAC3C,OAAO;GACP,aAAa,EAAM,UAAU,eAAe;GAC5C,kBAAkB,EAAM,UAAU,oBAAoB;GACtD;GACA;GACD,CAAC;GACF,EAEK"}
1
+ {"version":3,"file":"buildSidebarSections.js","names":[],"sources":["../../../../../src/components/backoffice/layout/buildSidebarSections.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\nimport type { TFunction } from 'i18next';\n\nimport type { BackofficeEntityManifestMap } from '@plumile/backoffice-core/types.js';\nimport type {\n BackofficeSidebarConfig,\n BackofficeDashboardRegistration,\n BackofficeSidebarItemDescriptor,\n BackofficeIconComponent,\n BackofficeSidebarRecentItem,\n} from '../../../provider/types.js';\nimport { type AdminSidebarSection } from '@plumile/ui/admin/organisms/admin_sidebar/AdminSidebar.js';\nimport { type SidebarNavSectionItem } from '@plumile/ui/backoffice/molecules/sidebar_nav_section/SidebarNavSection.js';\nimport { BackofficeSidebarHistorySvg } from '@plumile/ui/icons/backoffice/BackofficeSidebarHistorySvg.js';\nimport { GripDotsSvg } from '@plumile/ui/icons/GripDotsSvg.js';\nimport { PinFilledSvg } from '@plumile/ui/icons/PinFilledSvg.js';\nimport { PinSvg } from '@plumile/ui/icons/PinSvg.js';\nimport { SidebarHomeSvg } from '@plumile/ui/icons/SidebarHomeSvg.js';\nimport { SidebarTasksSvg } from '@plumile/ui/icons/SidebarTasksSvg.js';\nimport type { SidebarGroupCollapseState } from '../../../hooks/useSidebarGroupCollapse.js';\nimport { findBackofficeDashboardRegistration } from '../../../provider/dashboardRegistrations.js';\nimport * as styles from './backofficeSidebarActions.css.js';\nimport {\n buildEntityGroupLookup,\n isActivePath,\n joinBackofficePath,\n resolveLabel,\n resolveGroupItems,\n resolveHubEntityIds,\n resolveSidebarHub,\n resolveSidebarGroups,\n} from './sidebarUtils.js';\n\nconst renderIcon = (\n Icon?: BackofficeIconComponent,\n fallback?: ReactNode,\n size = 18,\n): ReactNode => {\n if (Icon != null) {\n return <Icon width={size} height={size} aria-hidden=\"true\" />;\n }\n return fallback ?? null;\n};\n\nexport type BuildSidebarSectionsInput = {\n basePath: string;\n pathname: string;\n entities: BackofficeEntityManifestMap;\n dashboards?: readonly BackofficeDashboardRegistration[];\n sidebar?: BackofficeSidebarConfig;\n permissions: unknown;\n searchQuery?: string;\n tApp: TFunction;\n t: TFunction;\n pinnedEntityIds?: readonly string[];\n recentItems?: readonly BackofficeSidebarRecentItem[];\n onTogglePin?: (entityId: string) => void;\n onReorderPin?: (fromId: string, toId: string) => void;\n collapsedByGroupId?: SidebarGroupCollapseState;\n onGroupCollapsedChange?: (groupId: string, collapsed: boolean) => void;\n sidebarCollapsed?: boolean;\n};\n\n/**\n * Builds the sidebar sections for the backoffice layout.\n */\nexport function buildSidebarSections(\n input: BuildSidebarSectionsInput,\n): readonly AdminSidebarSection[] {\n const {\n basePath,\n pathname,\n entities,\n dashboards = [],\n sidebar,\n permissions,\n searchQuery,\n tApp,\n t,\n pinnedEntityIds = [],\n recentItems = [],\n onTogglePin,\n onReorderPin,\n collapsedByGroupId,\n onGroupCollapsedChange,\n sidebarCollapsed = false,\n } = input;\n\n const groups = resolveSidebarGroups(entities, sidebar);\n const entries = Object.entries(groups);\n const pinnedSet = new Set(pinnedEntityIds);\n const pinLabel = t('sidebar.actions.pin');\n const unpinLabel = t('sidebar.actions.unpin');\n const reorderLabel = t('sidebar.actions.reorder');\n const entityGroupLookup = buildEntityGroupLookup(groups, sidebar);\n const normalizedQuery = searchQuery?.trim().toLowerCase() ?? '';\n\n const labelMatchesQuery = (label: string): boolean => {\n return (\n normalizedQuery === '' || label.toLowerCase().includes(normalizedQuery)\n );\n };\n\n const renderPinAction = (entityId: string): ReactNode | null => {\n if (onTogglePin == null) {\n return null;\n }\n const isPinned = pinnedSet.has(entityId);\n let label = pinLabel;\n let Icon = PinSvg;\n if (isPinned) {\n label = unpinLabel;\n Icon = PinFilledSvg;\n }\n\n return (\n <button\n type=\"button\"\n className={styles.actionButton}\n aria-pressed={isPinned}\n aria-label={label}\n title={label}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n onTogglePin(entityId);\n }}\n >\n <Icon width={14} height={14} aria-hidden=\"true\" />\n </button>\n );\n };\n\n const buildDashboardItem = (\n inputItem?: {\n id?: string;\n icon?: BackofficeIconComponent;\n label?: string;\n },\n groupId?: string,\n ): SidebarNavSectionItem | null => {\n const dashboardId = inputItem?.id ?? 'dashboard';\n const dashboardDescriptor: BackofficeSidebarItemDescriptor = {\n kind: 'dashboard',\n id: dashboardId,\n };\n const isDashboardVisible = sidebar?.isItemVisible?.(\n dashboardDescriptor,\n permissions,\n );\n if (isDashboardVisible === false) {\n return null;\n }\n\n const registration = findBackofficeDashboardRegistration(\n dashboards,\n dashboardId,\n );\n let label = inputItem?.label;\n if (label == null && registration != null) {\n label = resolveLabel(registration.label, tApp);\n }\n label ??= t('sidebar.items.dashboard');\n if (!labelMatchesQuery(label)) {\n return null;\n }\n\n let href = basePath;\n let id = 'dashboard';\n if (dashboardId !== 'dashboard') {\n href = joinBackofficePath(basePath, `dashboard/${dashboardId}`);\n id = `dashboard-${dashboardId}`;\n }\n\n let isActive = isActivePath(pathname, href);\n if (dashboardId === 'dashboard') {\n isActive = pathname === basePath || pathname === `${basePath}/dashboard`;\n }\n\n return {\n id,\n data: {\n kind: 'dashboard',\n id: dashboardId,\n groupId,\n },\n label,\n href,\n icon: renderIcon(\n inputItem?.icon ?? registration?.icon,\n <SidebarHomeSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive,\n ariaLabel: label,\n };\n };\n\n const buildEntityItem = (inputItem: {\n entityId: string;\n groupId?: string;\n groupIcon?: BackofficeIconComponent;\n itemIcon?: BackofficeIconComponent;\n itemLabel?: string;\n enableReorder?: boolean;\n }): SidebarNavSectionItem | null => {\n const { entityId, groupId, groupIcon, itemIcon, itemLabel, enableReorder } =\n inputItem;\n const config = entities[entityId];\n if (config == null) {\n return null;\n }\n\n let descriptor: BackofficeSidebarItemDescriptor = {\n kind: 'entity',\n id: entityId,\n };\n if (config.kind === 'tool') {\n descriptor = { kind: 'tool', id: entityId };\n }\n const isEntityVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isEntityVisible === false) {\n return null;\n }\n\n if (config.kind === 'tool') {\n const label = itemLabel ?? resolveLabel(config.label, tApp);\n if (\n normalizedQuery !== '' &&\n !label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n return {\n id: `tool-${entityId}`,\n data: {\n kind: 'tool',\n id: entityId,\n groupId,\n },\n label,\n href: config.routes.list,\n icon: renderIcon(\n itemIcon ?? groupIcon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, config.routes.list),\n ariaLabel: label,\n actionSlot: renderPinAction(entityId),\n };\n }\n\n if (!config.hasList) {\n return null;\n }\n\n const label = itemLabel ?? resolveLabel(config.label, tApp);\n if (\n normalizedQuery !== '' &&\n !label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n\n let dragHandleSlot: ReactNode | undefined;\n if (enableReorder === true && onReorderPin != null) {\n dragHandleSlot = (\n <GripDotsSvg width={14} height={14} aria-hidden=\"true\" />\n );\n }\n\n let dragHandleLabel: string | undefined;\n if (dragHandleSlot != null) {\n dragHandleLabel = reorderLabel;\n }\n\n return {\n id: entityId,\n data: {\n kind: 'entity',\n id: entityId,\n groupId,\n },\n label,\n href: config.routes.list,\n icon: renderIcon(\n itemIcon ?? groupIcon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, config.routes.list),\n ariaLabel: label,\n actionSlot: renderPinAction(entityId),\n dragHandleSlot,\n dragHandleLabel,\n };\n };\n\n const buildHubItem = (inputItem: {\n hub: ReturnType<typeof resolveSidebarHub>;\n groupId?: string;\n icon?: BackofficeIconComponent;\n }): SidebarNavSectionItem | null => {\n const { hub, groupId, icon } = inputItem;\n const descriptor: BackofficeSidebarItemDescriptor = {\n kind: 'hub',\n id: hub.id,\n };\n const isVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isVisible === false) {\n return null;\n }\n const childEntityIds = resolveHubEntityIds(hub);\n const visibleChildConfigs = childEntityIds\n .map((entityId) => {\n return entities[entityId] ?? null;\n })\n .filter((config): config is BackofficeEntityManifestMap[string] => {\n if (config == null) {\n return false;\n }\n let childKind: BackofficeSidebarItemDescriptor['kind'] = 'entity';\n if (config.kind === 'tool') {\n childKind = 'tool';\n }\n const childDescriptor: BackofficeSidebarItemDescriptor = {\n kind: childKind,\n id: config.id,\n };\n const isChildVisible = sidebar?.isItemVisible?.(\n childDescriptor,\n permissions,\n );\n if (isChildVisible === false) {\n return false;\n }\n if (config.kind !== 'tool' && !config.hasList) {\n return false;\n }\n return true;\n });\n if (childEntityIds.length > 0 && visibleChildConfigs.length === 0) {\n return null;\n }\n const label = resolveLabel(hub.title, tApp);\n const matchesHub = labelMatchesQuery(label);\n const matchesChild = visibleChildConfigs.some((config) => {\n return labelMatchesQuery(resolveLabel(config.label, tApp));\n });\n if (!matchesHub && !matchesChild) {\n return null;\n }\n const isActive =\n isActivePath(pathname, hub.href) ||\n visibleChildConfigs.some((config) => {\n return isActivePath(pathname, config.routes.list);\n });\n return {\n id: `hub-${hub.id}`,\n data: {\n kind: 'hub',\n id: hub.id,\n groupId,\n },\n label,\n href: hub.href,\n icon: renderIcon(\n icon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive,\n ariaLabel: label,\n };\n };\n\n const sections: AdminSidebarSection[] = [];\n\n const primaryItems = sidebar?.primaryItems ?? [];\n if (primaryItems.length > 0) {\n const primarySectionItems = primaryItems\n .map((primaryItem): SidebarNavSectionItem | null => {\n if (primaryItem.kind === 'dashboard') {\n let itemLabel: string | undefined;\n if (primaryItem.label != null) {\n itemLabel = resolveLabel(primaryItem.label, tApp);\n }\n return buildDashboardItem({\n id: primaryItem.id,\n icon: primaryItem.icon,\n label: itemLabel,\n });\n }\n if (primaryItem.kind === 'hub') {\n const hub = resolveSidebarHub(primaryItem, sidebar);\n return buildHubItem({\n hub,\n icon: primaryItem.icon,\n });\n }\n let itemLabel: string | undefined;\n if (primaryItem.label != null) {\n itemLabel = resolveLabel(primaryItem.label, tApp);\n }\n return buildEntityItem({\n entityId: primaryItem.id,\n itemIcon: primaryItem.icon,\n itemLabel,\n });\n })\n .filter((item): item is SidebarNavSectionItem => {\n return item != null;\n });\n\n if (primarySectionItems.length > 0) {\n sections.push({\n id: 'primary',\n items: primarySectionItems,\n collapsible: false,\n });\n }\n }\n\n if (pinnedEntityIds.length > 0) {\n const pinnedItems = pinnedEntityIds\n .map((entityId) => {\n const groupMeta = entityGroupLookup.get(entityId);\n return buildEntityItem({\n entityId,\n groupId: groupMeta?.groupId,\n groupIcon: groupMeta?.groupIcon,\n itemIcon: groupMeta?.itemIcon,\n enableReorder: true,\n });\n })\n .filter((item): item is SidebarNavSectionItem => {\n return item != null;\n });\n\n if (pinnedItems.length > 0) {\n let reorder: AdminSidebarSection['reorder'];\n if (onReorderPin != null && pinnedItems.length > 1) {\n reorder = {\n enabled: true,\n onReorder: onReorderPin,\n };\n }\n let sectionItems = pinnedItems;\n if (reorder == null) {\n sectionItems = pinnedItems.map((item) => {\n const { dragHandleSlot, dragHandleLabel, ...rest } = item;\n return rest;\n });\n }\n\n sections.push({\n id: 'pinned',\n title: t('sidebar.sections.pinned'),\n icon: renderIcon(\n undefined,\n <PinSvg width={16} height={16} aria-hidden=\"true\" />,\n ),\n items: sectionItems,\n collapsible: false,\n reorder,\n });\n }\n }\n\n if (recentItems.length > 0) {\n const recentSectionItems = recentItems\n .map((recentItem): SidebarNavSectionItem | null => {\n const config = entities[recentItem.id];\n if (config == null) {\n return null;\n }\n const descriptor: BackofficeSidebarItemDescriptor = {\n kind: recentItem.kind,\n id: recentItem.id,\n };\n const isVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isVisible === false) {\n return null;\n }\n if (\n normalizedQuery !== '' &&\n !recentItem.label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n const groupMeta = entityGroupLookup.get(recentItem.id);\n return {\n id: `recent-${recentItem.kind}-${recentItem.id}`,\n data: {\n kind: recentItem.kind,\n id: recentItem.id,\n groupId: groupMeta?.groupId,\n },\n label: recentItem.label,\n href: recentItem.href,\n icon: renderIcon(\n groupMeta?.itemIcon ?? groupMeta?.groupIcon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, recentItem.href),\n ariaLabel: recentItem.label,\n } satisfies SidebarNavSectionItem;\n })\n .filter((item): item is SidebarNavSectionItem => {\n return item != null;\n });\n\n if (recentSectionItems.length > 0) {\n sections.push({\n id: 'recent',\n title: t('sidebar.sections.recent'),\n icon: renderIcon(\n undefined,\n <BackofficeSidebarHistorySvg\n width={16}\n height={16}\n aria-hidden=\"true\"\n />,\n ),\n items: recentSectionItems,\n collapsible: false,\n });\n }\n }\n\n entries.forEach(([groupId, group]) => {\n if (group.isVisible != null && !group.isVisible(permissions)) {\n return;\n }\n\n const items: SidebarNavSectionItem[] = [];\n\n const groupItems = resolveGroupItems(group);\n if (groupItems.length > 0) {\n groupItems.forEach((groupItem) => {\n if (groupItem.kind === 'dashboard') {\n let itemLabel: string | undefined;\n if (groupItem.label != null) {\n itemLabel = resolveLabel(groupItem.label, tApp);\n }\n const item = buildDashboardItem(\n {\n id: groupItem.id,\n icon: groupItem.icon ?? group.icon,\n label: itemLabel,\n },\n groupId,\n );\n if (item != null) {\n items.push(item);\n }\n return;\n }\n if (groupItem.kind === 'hub') {\n const hub = resolveSidebarHub(groupItem, sidebar);\n const item = buildHubItem({\n hub,\n groupId,\n icon: groupItem.icon ?? group.icon,\n });\n if (item != null) {\n items.push(item);\n }\n return;\n }\n let itemLabel: string | undefined;\n if (groupItem.label != null) {\n itemLabel = resolveLabel(groupItem.label, tApp);\n }\n const item = buildEntityItem({\n entityId: groupItem.id,\n groupId,\n groupIcon: group.icon,\n itemIcon: groupItem.icon,\n itemLabel,\n });\n if (item != null) {\n items.push(item);\n }\n });\n }\n\n let sectionItems: SidebarNavSectionItem[] = items;\n if (sidebarCollapsed && group.behavior?.showInCollapsedRail !== true) {\n sectionItems = items.filter((item) => {\n return item.data?.kind === 'dashboard' || item.isActive === true;\n });\n }\n\n if (sectionItems.length === 0) {\n return;\n }\n\n let title: string | undefined;\n if (group.title != null) {\n title = resolveLabel(group.title, tApp);\n }\n\n const isCollapsed = collapsedByGroupId?.[groupId];\n let onCollapsedChange: ((collapsed: boolean) => void) | undefined;\n if (onGroupCollapsedChange != null) {\n onCollapsedChange = (collapsed: boolean) => {\n onGroupCollapsedChange(groupId, collapsed);\n };\n }\n\n sections.push({\n id: groupId,\n title,\n icon: renderIcon(group.icon, undefined, 16),\n items: sectionItems,\n collapsible: group.behavior?.collapsible ?? true,\n defaultCollapsed: group.behavior?.defaultCollapsed ?? true,\n isCollapsed,\n onCollapsedChange,\n });\n });\n\n return sections;\n}\n"],"mappings":";;;;;;;;;;;AAiCA,IAAM,KACJ,GACA,GACA,IAAO,OAEH,KAAQ,OAGL,KAAY,OAFV,kBAAC,GAAD;CAAM,OAAO;CAAM,QAAQ;CAAM,eAAY;CAAS,CAAA;AA2BjE,SAAgB,EACd,GACgC;CAChC,IAAM,EACJ,aACA,aACA,aACA,gBAAa,EAAE,EACf,YACA,gBACA,gBACA,SACA,MACA,qBAAkB,EAAE,EACpB,iBAAc,EAAE,EAChB,gBACA,iBAC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,EAAW,EAAM,MAAM,KAAA,GAAW,GAAG;GAC3C,OAAO;GACP,aAAa,EAAM,UAAU,eAAe;GAC5C,kBAAkB,EAAM,UAAU,oBAAoB;GACtD;GACA;GACD,CAAC;GACF,EAEK"}
@@ -15,15 +15,21 @@ var i = "backoffice.sidebar.pins.v1", a = (e) => {
15
15
  return e.forEach((e) => {
16
16
  t.has(e) && (r.has(e) || (r.add(e), n.push(e)));
17
17
  }), n;
18
- }, s = (s) => {
19
- let { enabled: c = !0, storageKey: l = i, visibleEntityIds: u } = s, d = n(() => new Set(u), [u]), [f, p] = r(() => c ? o(a(l), d) : []);
18
+ }, s = (e, t, n) => {
19
+ if (t === n) return e;
20
+ let r = e.indexOf(t), i = e.indexOf(n);
21
+ if (r === -1 || i === -1 || r === i) return e;
22
+ let a = [...e];
23
+ return a.splice(r, 1), a.splice(i, 0, t), a;
24
+ }, c = (c) => {
25
+ let { enabled: l = !0, storageKey: u = i, visibleEntityIds: d } = c, f = n(() => new Set(d), [d]), [p, m] = r(() => l ? o(a(u), f) : []);
20
26
  t(() => {
21
- if (!c) {
22
- p([]);
27
+ if (!l) {
28
+ m([]);
23
29
  return;
24
30
  }
25
- p((e) => {
26
- let t = o(e, d);
31
+ m((e) => {
32
+ let t = o(e, f);
27
33
  if (t.length === e.length) {
28
34
  let n = !0;
29
35
  for (let r = 0; r < t.length; r += 1) if (t[r] !== e[r]) {
@@ -34,56 +40,52 @@ var i = "backoffice.sidebar.pins.v1", a = (e) => {
34
40
  }
35
41
  return t;
36
42
  });
37
- }, [c, d]), t(() => {
38
- if (!c) {
39
- p([]);
43
+ }, [l, f]), t(() => {
44
+ if (!l) {
45
+ m([]);
40
46
  return;
41
47
  }
42
- p(o(a(l), d));
48
+ m(o(a(u), f));
43
49
  }, [
44
- c,
45
50
  l,
46
- d
51
+ u,
52
+ f
47
53
  ]), t(() => {
48
- if (!(!c || typeof window > "u")) try {
49
- window.localStorage.setItem(l, JSON.stringify(f));
54
+ if (!(!l || typeof window > "u")) try {
55
+ window.localStorage.setItem(u, JSON.stringify(p));
50
56
  } catch {}
51
57
  }, [
52
- c,
53
- f,
54
- l
58
+ l,
59
+ p,
60
+ u
55
61
  ]);
56
- let m = n(() => new Set(f), [f]), h = e((e) => {
57
- c && d.has(e) && p((t) => t.includes(e) ? t : [...t, e]);
58
- }, [c, d]), g = e((e) => {
59
- c && p((t) => t.filter((t) => t !== e));
60
- }, [c]), _ = e((e) => {
61
- m.has(e) ? g(e) : h(e);
62
+ let h = n(() => new Set(p), [p]), g = e((e) => {
63
+ l && f.has(e) && m((t) => t.includes(e) ? t : [...t, e]);
64
+ }, [l, f]), _ = e((e) => {
65
+ l && m((t) => t.filter((t) => t !== e));
66
+ }, [l]), v = e((e) => {
67
+ h.has(e) ? _(e) : g(e);
62
68
  }, [
69
+ g,
63
70
  h,
64
- m,
65
- g
66
- ]), v = e((e, t) => {
67
- c && e !== t && p((n) => {
68
- let r = n.indexOf(e), i = n.indexOf(t);
69
- if (r === -1 || i === -1 || r === i) return n;
70
- let a = [...n];
71
- return a.splice(r, 1), a.splice(i, 0, e), a;
72
- });
73
- }, [c]);
71
+ _
72
+ ]), y = e((e, t) => {
73
+ l && m((n) => s(n, e, t));
74
+ }, [l]);
74
75
  return {
75
- pins: f,
76
- isPinned: e((e) => m.has(e), [m]),
77
- pin: h,
78
- unpin: g,
79
- toggle: _,
80
- reorder: v
76
+ pins: p,
77
+ isPinned: e((e) => h.has(e), [h]),
78
+ pin: g,
79
+ unpin: _,
80
+ toggle: v,
81
+ reorder: y
81
82
  };
82
- }, c = {
83
+ }, l = {
83
84
  normalizePins: o,
84
- readPinsFromStorage: a
85
+ readPinsFromStorage: a,
86
+ reorderPins: s
85
87
  };
86
88
  //#endregion
87
- export { c as __test, s as default, s as useBackofficeSidebarPins };
89
+ export { l as __test, c as default, c as useBackofficeSidebarPins };
88
90
 
89
91
  //# sourceMappingURL=useBackofficeSidebarPins.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBackofficeSidebarPins.js","names":[],"sources":["../../../src/hooks/useBackofficeSidebarPins.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react';\n\nconst DEFAULT_STORAGE_KEY = 'backoffice.sidebar.pins.v1';\n\ntype PinsPayload = unknown;\n\nconst readPinsFromStorage = (storageKey: string): string[] => {\n if (typeof window === 'undefined') {\n return [];\n }\n try {\n const raw = window.localStorage.getItem(storageKey);\n if (raw == null) {\n return [];\n }\n const parsed = JSON.parse(raw) as PinsPayload;\n if (!Array.isArray(parsed)) {\n return [];\n }\n return parsed.filter((entry): entry is string => {\n return typeof entry === 'string';\n });\n } catch {\n return [];\n }\n};\n\nconst normalizePins = (\n pins: readonly string[],\n validIds: Set<string>,\n): string[] => {\n const output: string[] = [];\n const seen = new Set<string>();\n pins.forEach((entry) => {\n if (!validIds.has(entry)) {\n return;\n }\n if (seen.has(entry)) {\n return;\n }\n seen.add(entry);\n output.push(entry);\n });\n return output;\n};\n\nexport type SidebarPinsState = {\n pins: readonly string[];\n isPinned: (id: string) => boolean;\n pin: (id: string) => void;\n unpin: (id: string) => void;\n toggle: (id: string) => void;\n reorder: (fromId: string, toId: string) => void;\n};\n\nexport type UseBackofficeSidebarPinsInput = {\n enabled?: boolean;\n storageKey?: string;\n visibleEntityIds: readonly string[];\n};\n\nexport const useBackofficeSidebarPins = (\n input: UseBackofficeSidebarPinsInput,\n): SidebarPinsState => {\n const {\n enabled = true,\n storageKey = DEFAULT_STORAGE_KEY,\n visibleEntityIds,\n } = input;\n const validIds = useMemo(() => {\n return new Set(visibleEntityIds);\n }, [visibleEntityIds]);\n\n const [pins, setPins] = useState<string[]>(() => {\n if (!enabled) {\n return [];\n }\n const stored = readPinsFromStorage(storageKey);\n return normalizePins(stored, validIds);\n });\n\n useEffect(() => {\n if (!enabled) {\n setPins([]);\n return;\n }\n setPins((prev) => {\n const normalized = normalizePins(prev, validIds);\n if (normalized.length === prev.length) {\n let unchanged = true;\n for (let index = 0; index < normalized.length; index += 1) {\n if (normalized[index] !== prev[index]) {\n unchanged = false;\n break;\n }\n }\n if (unchanged) {\n return prev;\n }\n }\n return normalized;\n });\n }, [enabled, validIds]);\n\n useEffect(() => {\n if (!enabled) {\n setPins([]);\n return;\n }\n const stored = readPinsFromStorage(storageKey);\n setPins(normalizePins(stored, validIds));\n }, [enabled, storageKey, validIds]);\n\n useEffect(() => {\n if (!enabled || typeof window === 'undefined') {\n return;\n }\n try {\n window.localStorage.setItem(storageKey, JSON.stringify(pins));\n } catch {\n // Ignore storage errors in non-browser or restricted environments.\n }\n }, [enabled, pins, storageKey]);\n\n const pinsSet = useMemo(() => {\n return new Set(pins);\n }, [pins]);\n\n const pin = useCallback(\n (id: string) => {\n if (!enabled) {\n return;\n }\n if (!validIds.has(id)) {\n return;\n }\n setPins((prev) => {\n if (prev.includes(id)) {\n return prev;\n }\n return [...prev, id];\n });\n },\n [enabled, validIds],\n );\n\n const unpin = useCallback(\n (id: string) => {\n if (!enabled) {\n return;\n }\n setPins((prev) => {\n return prev.filter((entry) => {\n return entry !== id;\n });\n });\n },\n [enabled],\n );\n\n const toggle = useCallback(\n (id: string) => {\n if (pinsSet.has(id)) {\n unpin(id);\n } else {\n pin(id);\n }\n },\n [pin, pinsSet, unpin],\n );\n\n const reorder = useCallback(\n (fromId: string, toId: string) => {\n if (!enabled) {\n return;\n }\n if (fromId === toId) {\n return;\n }\n setPins((prev) => {\n const fromIndex = prev.indexOf(fromId);\n const toIndex = prev.indexOf(toId);\n if (fromIndex === -1 || toIndex === -1) {\n return prev;\n }\n if (fromIndex === toIndex) {\n return prev;\n }\n const next = [...prev];\n next.splice(fromIndex, 1);\n next.splice(toIndex, 0, fromId);\n return next;\n });\n },\n [enabled],\n );\n\n const isPinned = useCallback(\n (id: string) => {\n return pinsSet.has(id);\n },\n [pinsSet],\n );\n\n return {\n pins,\n isPinned,\n pin,\n unpin,\n toggle,\n reorder,\n };\n};\n\nexport const __test = {\n normalizePins,\n readPinsFromStorage,\n};\n\nex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"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react';\n\nconst DEFAULT_STORAGE_KEY = 'backoffice.sidebar.pins.v1';\n\ntype PinsPayload = unknown;\n\nconst readPinsFromStorage = (storageKey: string): string[] => {\n if (typeof window === 'undefined') {\n return [];\n }\n try {\n const raw = window.localStorage.getItem(storageKey);\n if (raw == null) {\n return [];\n }\n const parsed = JSON.parse(raw) as PinsPayload;\n if (!Array.isArray(parsed)) {\n return [];\n }\n return parsed.filter((entry): entry is string => {\n return typeof entry === 'string';\n });\n } catch {\n return [];\n }\n};\n\nconst normalizePins = (\n pins: readonly string[],\n validIds: Set<string>,\n): string[] => {\n const output: string[] = [];\n const seen = new Set<string>();\n pins.forEach((entry) => {\n if (!validIds.has(entry)) {\n return;\n }\n if (seen.has(entry)) {\n return;\n }\n seen.add(entry);\n output.push(entry);\n });\n return output;\n};\n\nconst reorderPins = (\n pins: readonly string[],\n fromId: string,\n toId: string,\n): readonly string[] => {\n if (fromId === toId) {\n return pins;\n }\n const fromIndex = pins.indexOf(fromId);\n const toIndex = pins.indexOf(toId);\n if (fromIndex === -1 || toIndex === -1 || fromIndex === toIndex) {\n return pins;\n }\n const next = [...pins];\n next.splice(fromIndex, 1);\n next.splice(toIndex, 0, fromId);\n return next;\n};\n\nexport type SidebarPinsState = {\n pins: readonly string[];\n isPinned: (id: string) => boolean;\n pin: (id: string) => void;\n unpin: (id: string) => void;\n toggle: (id: string) => void;\n reorder: (fromId: string, toId: string) => void;\n};\n\nexport type UseBackofficeSidebarPinsInput = {\n enabled?: boolean;\n storageKey?: string;\n visibleEntityIds: readonly string[];\n};\n\nexport const useBackofficeSidebarPins = (\n input: UseBackofficeSidebarPinsInput,\n): SidebarPinsState => {\n const {\n enabled = true,\n storageKey = DEFAULT_STORAGE_KEY,\n visibleEntityIds,\n } = input;\n const validIds = useMemo(() => {\n return new Set(visibleEntityIds);\n }, [visibleEntityIds]);\n\n const [pins, setPins] = useState<string[]>(() => {\n if (!enabled) {\n return [];\n }\n const stored = readPinsFromStorage(storageKey);\n return normalizePins(stored, validIds);\n });\n\n useEffect(() => {\n if (!enabled) {\n setPins([]);\n return;\n }\n setPins((prev) => {\n const normalized = normalizePins(prev, validIds);\n if (normalized.length === prev.length) {\n let unchanged = true;\n for (let index = 0; index < normalized.length; index += 1) {\n if (normalized[index] !== prev[index]) {\n unchanged = false;\n break;\n }\n }\n if (unchanged) {\n return prev;\n }\n }\n return normalized;\n });\n }, [enabled, validIds]);\n\n useEffect(() => {\n if (!enabled) {\n setPins([]);\n return;\n }\n const stored = readPinsFromStorage(storageKey);\n setPins(normalizePins(stored, validIds));\n }, [enabled, storageKey, validIds]);\n\n useEffect(() => {\n if (!enabled || typeof window === 'undefined') {\n return;\n }\n try {\n window.localStorage.setItem(storageKey, JSON.stringify(pins));\n } catch {\n // Ignore storage errors in non-browser or restricted environments.\n }\n }, [enabled, pins, storageKey]);\n\n const pinsSet = useMemo(() => {\n return new Set(pins);\n }, [pins]);\n\n const pin = useCallback(\n (id: string) => {\n if (!enabled) {\n return;\n }\n if (!validIds.has(id)) {\n return;\n }\n setPins((prev) => {\n if (prev.includes(id)) {\n return prev;\n }\n return [...prev, id];\n });\n },\n [enabled, validIds],\n );\n\n const unpin = useCallback(\n (id: string) => {\n if (!enabled) {\n return;\n }\n setPins((prev) => {\n return prev.filter((entry) => {\n return entry !== id;\n });\n });\n },\n [enabled],\n );\n\n const toggle = useCallback(\n (id: string) => {\n if (pinsSet.has(id)) {\n unpin(id);\n } else {\n pin(id);\n }\n },\n [pin, pinsSet, unpin],\n );\n\n const reorder = useCallback(\n (fromId: string, toId: string) => {\n if (!enabled) {\n return;\n }\n setPins((prev) => {\n return reorderPins(prev, fromId, toId) as string[];\n });\n },\n [enabled],\n );\n\n const isPinned = useCallback(\n (id: string) => {\n return pinsSet.has(id);\n },\n [pinsSet],\n );\n\n return {\n pins,\n isPinned,\n pin,\n unpin,\n toggle,\n reorder,\n };\n};\n\nexport const __test = {\n normalizePins,\n read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;CACpB;CACA;CACA;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildSidebarSections.d.ts","sourceRoot":"","sources":["../../../../../src/components/backoffice/layout/buildSidebarSections.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,KAAK,EACV,uBAAuB,EACvB,+BAA+B,EAG/B,2BAA2B,EAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAQrG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAyB3F,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,2BAA2B,CAAC;IACtC,UAAU,CAAC,EAAE,SAAS,+BAA+B,EAAE,CAAC;IACxD,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,CAAC,EAAE,SAAS,CAAC;IACb,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,WAAW,CAAC,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACrD,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;IAC/C,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACvE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAKF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,yBAAyB,GAC/B,SAAS,mBAAmB,EAAE,CAqjBhC"}
1
+ {"version":3,"file":"buildSidebarSections.d.ts","sourceRoot":"","sources":["../../../../../src/components/backoffice/layout/buildSidebarSections.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,KAAK,EACV,uBAAuB,EACvB,+BAA+B,EAG/B,2BAA2B,EAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAQrG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAyB3F,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,2BAA2B,CAAC;IACtC,UAAU,CAAC,EAAE,SAAS,+BAA+B,EAAE,CAAC;IACxD,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,CAAC,EAAE,SAAS,CAAC;IACb,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,WAAW,CAAC,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACrD,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;IAC/C,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACvE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAKF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,yBAAyB,GAC/B,SAAS,mBAAmB,EAAE,CAyiBhC"}
@@ -15,6 +15,7 @@ export declare const useBackofficeSidebarPins: (input: UseBackofficeSidebarPinsI
15
15
  export declare const __test: {
16
16
  normalizePins: (pins: readonly string[], validIds: Set<string>) => string[];
17
17
  readPinsFromStorage: (storageKey: string) => string[];
18
+ reorderPins: (pins: readonly string[], fromId: string, toId: string) => readonly string[];
18
19
  };
19
20
  export default useBackofficeSidebarPins;
20
21
  //# sourceMappingURL=useBackofficeSidebarPins.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBackofficeSidebarPins.d.ts","sourceRoot":"","sources":["../../../src/hooks/useBackofficeSidebarPins.ts"],"names":[],"mappings":"AA8CA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1B,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,OAAO,6BAA6B,KACnC,gBAqJF,CAAC;AAEF,eAAO,MAAM,MAAM;0BA1LX,SAAS,MAAM,EAAE,YACb,GAAG,CAAC,MAAM,CAAC,KACpB,MAAM,EAAE;sCAxB8B,MAAM,KAAG,MAAM,EAAE;CAmNzD,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
1
+ {"version":3,"file":"useBackofficeSidebarPins.d.ts","sourceRoot":"","sources":["../../../src/hooks/useBackofficeSidebarPins.ts"],"names":[],"mappings":"AAiEA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1B,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,OAAO,6BAA6B,KACnC,gBAuIF,CAAC;AAEF,eAAO,MAAM,MAAM;0BA/LX,SAAS,MAAM,EAAE,YACb,GAAG,CAAC,MAAM,CAAC,KACpB,MAAM,EAAE;sCAxB8B,MAAM,KAAG,MAAM,EAAE;wBAyClD,SAAS,MAAM,EAAE,UACf,MAAM,QACR,MAAM,KACX,SAAS,MAAM,EAAE;CA6KnB,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumile/backoffice-react",
3
- "version": "0.1.117",
3
+ "version": "0.1.120",
4
4
  "description": "React provider and pages for Kronex backoffice",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -179,11 +179,11 @@
179
179
  "tslib": "^2.8.1"
180
180
  },
181
181
  "devDependencies": {
182
- "@plumile/auth": "^0.1.117",
183
- "@plumile/backoffice-core": "^0.1.117",
184
- "@plumile/filter-query": "^0.1.117",
185
- "@plumile/router": "^0.1.117",
186
- "@plumile/ui": "^0.1.117",
182
+ "@plumile/auth": "^0.1.120",
183
+ "@plumile/backoffice-core": "^0.1.120",
184
+ "@plumile/filter-query": "^0.1.120",
185
+ "@plumile/router": "^0.1.120",
186
+ "@plumile/ui": "^0.1.120",
187
187
  "@types/react": "19.2.14",
188
188
  "@types/react-dom": "19.2.3",
189
189
  "@types/relay-runtime": "20.1.1",