@plumile/backoffice-react 0.1.101 → 0.1.102

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 (79) hide show
  1. package/lib/esm/{BackofficeAcceptInvitationPage-CEtApVwL.js → BackofficeAcceptInvitationPage-BfRsORii.js} +3 -3
  2. package/lib/esm/{BackofficeAcceptInvitationPage-CEtApVwL.js.map → BackofficeAcceptInvitationPage-BfRsORii.js.map} +1 -1
  3. package/lib/esm/{BackofficeDashboardPage-r8vK_JA6.js → BackofficeDashboardPage-COKOYq4D.js} +5 -4
  4. package/lib/esm/{BackofficeDashboardPage-r8vK_JA6.js.map → BackofficeDashboardPage-COKOYq4D.js.map} +1 -1
  5. package/lib/esm/{BackofficeEntityActionFormDialog-BgRTJ_JS.js → BackofficeEntityActionFormDialog-BgMuhyU8.js} +2 -2
  6. package/lib/esm/{BackofficeEntityActionFormDialog-BgRTJ_JS.js.map → BackofficeEntityActionFormDialog-BgMuhyU8.js.map} +1 -1
  7. package/lib/esm/{BackofficeEntityDetailLayoutContext-C_tBqkVq.js → BackofficeEntityDetailLayoutContext-DeuH5PCW.js} +1 -1
  8. package/lib/esm/{BackofficeEntityDetailLayoutContext-C_tBqkVq.js.map → BackofficeEntityDetailLayoutContext-DeuH5PCW.js.map} +1 -1
  9. package/lib/esm/{BackofficeEntityDetailLayoutPage-DXjRqvcZ.js → BackofficeEntityDetailLayoutPage-Duc_DcIV.js} +2 -2
  10. package/lib/esm/{BackofficeEntityDetailLayoutPage-DXjRqvcZ.js.map → BackofficeEntityDetailLayoutPage-Duc_DcIV.js.map} +1 -1
  11. package/lib/esm/{BackofficeEntityDetailPage-CwzKp_Yw.js → BackofficeEntityDetailPage-ByioPO5K.js} +7 -6
  12. package/lib/esm/{BackofficeEntityDetailPage-CwzKp_Yw.js.map → BackofficeEntityDetailPage-ByioPO5K.js.map} +1 -1
  13. package/lib/esm/{BackofficeEntityDetailUnknownPageRedirect-DRWTeox-.js → BackofficeEntityDetailUnknownPageRedirect-xupMeril.js} +2 -2
  14. package/lib/esm/{BackofficeEntityDetailUnknownPageRedirect-DRWTeox-.js.map → BackofficeEntityDetailUnknownPageRedirect-xupMeril.js.map} +1 -1
  15. package/lib/esm/{BackofficeEntityListPage-DVT3rrfa.js → BackofficeEntityListPage-dyE4er_s.js} +5 -4
  16. package/lib/esm/{BackofficeEntityListPage-DVT3rrfa.js.map → BackofficeEntityListPage-dyE4er_s.js.map} +1 -1
  17. package/lib/esm/BackofficeHubPage-D2k0ZO6c.js +136 -0
  18. package/lib/esm/BackofficeHubPage-D2k0ZO6c.js.map +1 -0
  19. package/lib/esm/BackofficeLayoutPage-BiSUwAi9.js +625 -0
  20. package/lib/esm/BackofficeLayoutPage-BiSUwAi9.js.map +1 -0
  21. package/lib/esm/{BackofficeLoginPage-Cc3kcOQV.js → BackofficeLoginPage-BMPhO1cr.js} +4 -4
  22. package/lib/esm/{BackofficeLoginPage-Cc3kcOQV.js.map → BackofficeLoginPage-BMPhO1cr.js.map} +1 -1
  23. package/lib/esm/{BackofficePasswordResetCompletePage-CF_0t3Nq.js → BackofficePasswordResetCompletePage-OApMUiOi.js} +3 -3
  24. package/lib/esm/{BackofficePasswordResetCompletePage-CF_0t3Nq.js.map → BackofficePasswordResetCompletePage-OApMUiOi.js.map} +1 -1
  25. package/lib/esm/{BackofficePasswordResetRequestPage-BJOrQXcy.js → BackofficePasswordResetRequestPage-DPDImb37.js} +2 -2
  26. package/lib/esm/{BackofficePasswordResetRequestPage-BJOrQXcy.js.map → BackofficePasswordResetRequestPage-DPDImb37.js.map} +1 -1
  27. package/lib/esm/BackofficePermissionsContext-CmWwudBU.js +11 -0
  28. package/lib/esm/BackofficePermissionsContext-CmWwudBU.js.map +1 -0
  29. package/lib/esm/BackofficeRightPageLayout-BZb7LhT-.js +53 -0
  30. package/lib/esm/BackofficeRightPageLayout-BZb7LhT-.js.map +1 -0
  31. package/lib/esm/{BackofficeTopbarPortalContext-iD7dm4_h.js → BackofficeTopbarPortalContext-CphoSrZD.js} +1 -1
  32. package/lib/esm/{BackofficeTopbarPortalContext-iD7dm4_h.js.map → BackofficeTopbarPortalContext-CphoSrZD.js.map} +1 -1
  33. package/lib/esm/{BackofficeVerifyEmailPage-C81LlsNM.js → BackofficeVerifyEmailPage-DHuSOxDf.js} +3 -3
  34. package/lib/esm/{BackofficeVerifyEmailPage-C81LlsNM.js.map → BackofficeVerifyEmailPage-DHuSOxDf.js.map} +1 -1
  35. package/lib/esm/{LazyBackofficeEntityActionFormDialog-L8xwaGqH.js → LazyBackofficeEntityActionFormDialog-DwPGe2Qv.js} +2 -2
  36. package/lib/esm/{LazyBackofficeEntityActionFormDialog-L8xwaGqH.js.map → LazyBackofficeEntityActionFormDialog-DwPGe2Qv.js.map} +1 -1
  37. package/lib/esm/backoffice-react.js +287 -250
  38. package/lib/esm/backoffice-react.js.map +1 -1
  39. package/lib/esm/{backofficeAuthPaths-BiJvoI5Q.js → backofficeAuthPaths-2KMmkBLv.js} +1 -1
  40. package/lib/esm/{backofficeAuthPaths-BiJvoI5Q.js.map → backofficeAuthPaths-2KMmkBLv.js.map} +1 -1
  41. package/lib/esm/{buildBreadcrumbs-CqF9Nh6x.js → buildBreadcrumbs-C9cyiXb7.js} +8 -4
  42. package/lib/esm/buildBreadcrumbs-C9cyiXb7.js.map +1 -0
  43. package/lib/esm/buildDataTableColumns-D95yRO2W.js +65 -0
  44. package/lib/esm/buildDataTableColumns-D95yRO2W.js.map +1 -0
  45. package/lib/esm/sidebarUtils-BZETlHea.js +74 -0
  46. package/lib/esm/sidebarUtils-BZETlHea.js.map +1 -0
  47. package/lib/esm/style.css +1 -1
  48. package/lib/esm/{toastViewAction-BGTS7vqm.js → toastViewAction-DJkv_4p9.js} +1 -1
  49. package/lib/esm/{toastViewAction-BGTS7vqm.js.map → toastViewAction-DJkv_4p9.js.map} +1 -1
  50. package/lib/esm/{useBackofficeAuth-ers1FUGe.js → useBackofficeAuth-DVAXNAjP.js} +1 -1
  51. package/lib/esm/{useBackofficeAuth-ers1FUGe.js.map → useBackofficeAuth-DVAXNAjP.js.map} +1 -1
  52. package/lib/esm/{useBackofficeLazyValue-Bh_13h8A.js → useBackofficeLazyValue-CoIAK-5N.js} +1 -1
  53. package/lib/esm/{useBackofficeLazyValue-Bh_13h8A.js.map → useBackofficeLazyValue-CoIAK-5N.js.map} +1 -1
  54. package/lib/types/components/backoffice/layout/BackofficePermissionsContext.d.ts +8 -0
  55. package/lib/types/components/backoffice/layout/BackofficePermissionsContext.d.ts.map +1 -0
  56. package/lib/types/components/backoffice/layout/breadcrumb/buildBreadcrumbs.d.ts +4 -0
  57. package/lib/types/components/backoffice/layout/breadcrumb/buildBreadcrumbs.d.ts.map +1 -1
  58. package/lib/types/components/backoffice/layout/buildSidebarSections.d.ts.map +1 -1
  59. package/lib/types/components/backoffice/layout/sidebarUtils.d.ts +11 -3
  60. package/lib/types/components/backoffice/layout/sidebarUtils.d.ts.map +1 -1
  61. package/lib/types/i18n/resources.d.ts +28 -0
  62. package/lib/types/i18n/resources.d.ts.map +1 -1
  63. package/lib/types/pages/BackofficeHubPage.d.ts +8 -0
  64. package/lib/types/pages/BackofficeHubPage.d.ts.map +1 -0
  65. package/lib/types/pages/BackofficeLayoutPage.d.ts.map +1 -1
  66. package/lib/types/pages/backofficeHubPage.css.d.ts +15 -0
  67. package/lib/types/pages/backofficeHubPage.css.d.ts.map +1 -0
  68. package/lib/types/provider/types.d.ts +22 -5
  69. package/lib/types/provider/types.d.ts.map +1 -1
  70. package/lib/types/router/createBackofficeRoutes.d.ts +6 -1
  71. package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
  72. package/package.json +5 -5
  73. package/lib/esm/BackofficeLayoutPage-DQ0sVv24.js +0 -609
  74. package/lib/esm/BackofficeLayoutPage-DQ0sVv24.js.map +0 -1
  75. package/lib/esm/BackofficeRightPageLayout-hexJmpam.js +0 -113
  76. package/lib/esm/BackofficeRightPageLayout-hexJmpam.js.map +0 -1
  77. package/lib/esm/buildBreadcrumbs-CqF9Nh6x.js.map +0 -1
  78. package/lib/esm/sidebarUtils-DVkLmFbS.js +0 -52
  79. package/lib/esm/sidebarUtils-DVkLmFbS.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"BackofficeLayoutPage-DQ0sVv24.js","names":[],"sources":["../../src/hooks/useBackofficeSidebarPins.ts","../../src/hooks/useSidebarGroupCollapse.ts","../../src/components/backoffice/layout/backofficeSidebarActions.css.ts","../../src/components/backoffice/layout/buildSidebarSections.tsx","../../src/components/backoffice/routing/backofficeContentError.css.ts","../../src/components/backoffice/routing/BackofficeContentError.tsx","../../src/components/backoffice/routing/backofficeContentFallback.css.ts","../../src/components/backoffice/routing/BackofficeContentFallback.tsx","../../src/components/backoffice/routing/backofficeContentBoundary.css.ts","../../src/components/backoffice/routing/BackofficeContentBoundary.tsx","../../src/components/backoffice/layout/mapViewerToSidebarProfileView.ts","../../src/pages/BackofficeLayoutPage.tsx"],"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 storageKey?: string;\n visibleEntityIds: readonly string[];\n};\n\nexport const useBackofficeSidebarPins = (\n input: UseBackofficeSidebarPinsInput,\n): SidebarPinsState => {\n const { storageKey = DEFAULT_STORAGE_KEY, visibleEntityIds } = input;\n const validIds = useMemo(() => {\n return new Set(visibleEntityIds);\n }, [visibleEntityIds]);\n\n const [pins, setPins] = useState<string[]>(() => {\n const stored = readPinsFromStorage(storageKey);\n return normalizePins(stored, validIds);\n });\n\n useEffect(() => {\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 }, [validIds]);\n\n useEffect(() => {\n const stored = readPinsFromStorage(storageKey);\n setPins(normalizePins(stored, validIds));\n }, [storageKey, validIds]);\n\n useEffect(() => {\n if (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 }, [pins, storageKey]);\n\n const pinsSet = useMemo(() => {\n return new Set(pins);\n }, [pins]);\n\n const pin = useCallback(\n (id: string) => {\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 [validIds],\n );\n\n const unpin = useCallback((id: string) => {\n setPins((prev) => {\n return prev.filter((entry) => {\n return entry !== id;\n });\n });\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((fromId: string, toId: string) => {\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\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\nexport default useBackofficeSidebarPins;\n","import { useCallback, useEffect, useMemo, useState } from 'react';\n\nexport type SidebarGroupCollapseState = Record<string, boolean | undefined>;\n\nexport type UseSidebarGroupCollapseInput = {\n groupIds: readonly string[];\n activeGroupId?: string | null;\n defaultCollapsedByGroupId?: Record<string, boolean | undefined>;\n};\n\nconst buildInitialState = (\n groupIds: readonly string[],\n activeGroupId?: string | null,\n defaultCollapsedByGroupId?: Record<string, boolean | undefined>,\n): SidebarGroupCollapseState => {\n const state: SidebarGroupCollapseState = {};\n groupIds.forEach((groupId) => {\n state[groupId] = defaultCollapsedByGroupId?.[groupId] ?? true;\n });\n if (activeGroupId != null && groupIds.includes(activeGroupId)) {\n state[activeGroupId] = false;\n }\n return state;\n};\n\nexport const useSidebarGroupCollapse = (\n input: UseSidebarGroupCollapseInput,\n): {\n collapsedByGroupId: SidebarGroupCollapseState;\n setCollapsed: (groupId: string, collapsed: boolean) => void;\n} => {\n const { groupIds, activeGroupId, defaultCollapsedByGroupId } = input;\n\n const groupIdList = useMemo(() => {\n return [...groupIds];\n }, [groupIds]);\n\n const [collapsedByGroupId, setCollapsedByGroupId] =\n useState<SidebarGroupCollapseState>(() => {\n return buildInitialState(\n groupIdList,\n activeGroupId,\n defaultCollapsedByGroupId,\n );\n });\n\n useEffect(() => {\n setCollapsedByGroupId((prev) => {\n const next: SidebarGroupCollapseState = {};\n\n groupIdList.forEach((groupId) => {\n const existing = prev[groupId];\n next[groupId] =\n existing ?? defaultCollapsedByGroupId?.[groupId] ?? true;\n });\n\n if (activeGroupId != null && groupIdList.includes(activeGroupId)) {\n next[activeGroupId] = false;\n }\n\n return next;\n });\n }, [activeGroupId, defaultCollapsedByGroupId, groupIdList]);\n\n useEffect(() => {\n if (activeGroupId == null) {\n return;\n }\n setCollapsedByGroupId((prev) => {\n if (prev[activeGroupId] === false) {\n return prev;\n }\n return {\n ...prev,\n [activeGroupId]: false,\n };\n });\n }, [activeGroupId]);\n\n const setCollapsed = useCallback((groupId: string, collapsed: boolean) => {\n setCollapsedByGroupId((prev) => {\n if (prev[groupId] === collapsed) {\n return prev;\n }\n return {\n ...prev,\n [groupId]: collapsed,\n };\n });\n }, []);\n\n return {\n collapsedByGroupId,\n setCollapsed,\n };\n};\n\nexport default useSidebarGroupCollapse;\n","import { style } from '@vanilla-extract/css';\n\nimport { sprinkles, vars } from '@plumile/ui';\n\nexport const actionButton = style([\n sprinkles({\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 6,\n height: 6,\n borderRadius: 'md',\n borderWidth: 0,\n borderStyle: 'none',\n padding: 0,\n backgroundColor: 'transparent',\n color: 'textSecondary',\n cursor: 'pointer',\n transitionProperty: 'colors',\n transitionDuration: 150,\n transitionTimingFunction: 'ease',\n }),\n {\n selectors: {\n '&:hover': {\n backgroundColor: vars.colors.surfaceMuted,\n color: vars.colors.text,\n },\n '&:focus-visible': {\n outline: `2px solid ${vars.colors['blue-500']}`,\n outlineOffset: 2,\n },\n },\n },\n]);\n","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 BackofficeSidebarItemDescriptor,\n BackofficeIconComponent,\n BackofficeSidebarRecentItem,\n} from '../../../provider/types.js';\nimport {\n type AdminSidebarSection,\n type SidebarNavSectionItem,\n GripDotsSvg,\n PinFilledSvg,\n PinSvg,\n SidebarHomeSvg,\n SidebarTasksSvg,\n} from '@plumile/ui';\nimport type { SidebarGroupCollapseState } from '../../../hooks/useSidebarGroupCollapse.js';\nimport * as styles from './backofficeSidebarActions.css.js';\nimport {\n buildEntityGroupLookup,\n isActivePath,\n resolveLabel,\n resolveGroupItems,\n resolveSidebarGroups,\n} from './sidebarUtils.js';\n\nconst renderIcon = (\n Icon?: BackofficeIconComponent,\n fallback?: ReactNode,\n): ReactNode => {\n if (Icon != null) {\n return <Icon width={18} height={18} aria-hidden=\"true\" />;\n }\n return fallback ?? null;\n};\n\nexport type BuildSidebarSectionsInput = {\n basePath: string;\n pathname: string;\n entities: BackofficeEntityManifestMap;\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};\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 sidebar,\n permissions,\n searchQuery,\n tApp,\n t,\n pinnedEntityIds = [],\n recentItems = [],\n onTogglePin,\n onReorderPin,\n collapsedByGroupId,\n onGroupCollapsedChange,\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);\n const normalizedQuery = searchQuery?.trim().toLowerCase() ?? '';\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 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 hubId: string;\n label: string;\n href: string;\n groupId?: string;\n icon?: BackofficeIconComponent;\n }): SidebarNavSectionItem | null => {\n const { hubId, label, href, groupId, icon } = inputItem;\n const descriptor: BackofficeSidebarItemDescriptor = {\n kind: 'hub',\n id: hubId,\n };\n const isVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isVisible === false) {\n return null;\n }\n if (\n normalizedQuery !== '' &&\n !label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n return {\n id: `hub-${hubId}`,\n data: {\n kind: 'hub',\n id: hubId,\n groupId,\n },\n label,\n href,\n icon: renderIcon(\n icon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, href),\n ariaLabel: label,\n };\n };\n\n const sections: AdminSidebarSection[] = [];\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?.icon,\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 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?.icon,\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 items: recentSectionItems,\n collapsible: false,\n });\n }\n }\n\n entries.forEach(([groupId, group], index) => {\n if (group.isVisible != null && !group.isVisible(permissions)) {\n return;\n }\n\n const items: SidebarNavSectionItem[] = [];\n\n if (index === 0) {\n const dashboardDescriptor: BackofficeSidebarItemDescriptor = {\n kind: 'dashboard',\n id: 'dashboard',\n };\n const isDashboardVisible = sidebar?.isItemVisible?.(\n dashboardDescriptor,\n permissions,\n );\n if (isDashboardVisible !== false) {\n const dashboardLabel = t('sidebar.items.dashboard');\n if (\n normalizedQuery !== '' &&\n !dashboardLabel.toLowerCase().includes(normalizedQuery)\n ) {\n return;\n }\n items.push({\n id: 'dashboard',\n data: {\n kind: 'dashboard',\n id: 'dashboard',\n groupId,\n },\n label: dashboardLabel,\n href: basePath,\n icon: renderIcon(\n undefined,\n <SidebarHomeSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, basePath),\n ariaLabel: t('sidebar.items.dashboard'),\n });\n }\n }\n\n const groupItems = resolveGroupItems(group);\n if (groupItems.length > 0) {\n groupItems.forEach((groupItem) => {\n if (groupItem.kind === 'dashboard') {\n return;\n }\n if (groupItem.kind === 'hub') {\n const item = buildHubItem({\n hubId: groupItem.id,\n label: resolveLabel(groupItem.title, tApp),\n href: groupItem.href,\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 if (items.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 items,\n collapsible: group.behavior?.collapsible ?? true,\n defaultCollapsed: group.behavior?.defaultCollapsed ?? true,\n isCollapsed,\n onCollapsedChange,\n });\n });\n\n return sections;\n}\n","import { sprinkles } from '@plumile/ui';\n\nexport const root = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n width: 'full',\n});\n\nexport const banner = sprinkles({\n borderColor: 'borderStrong',\n});\n","import { type JSX } from 'react';\n\nimport { Button, InlineBanner } from '@plumile/ui';\nimport { useBackofficeReactTranslation } from '../../../i18n/useBackofficeReactTranslation.js';\n\nimport * as styles from './backofficeContentError.css.js';\n\ntype BackofficeContentErrorProps = {\n error: unknown;\n onRetry: () => void;\n};\n\nconst resolveErrorMessage = (error: unknown): string | null => {\n if (error instanceof Error) {\n const message = error.message.trim();\n if (message.length > 0) {\n return message;\n }\n return null;\n }\n if (typeof error === 'string') {\n const message = error.trim();\n if (message.length > 0) {\n return message;\n }\n return null;\n }\n return null;\n};\n\nexport const BackofficeContentError = ({\n error,\n onRetry,\n}: BackofficeContentErrorProps): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n const description = resolveErrorMessage(error);\n\n return (\n <div className={styles.root} role=\"alert\">\n <InlineBanner\n tone=\"danger\"\n className={styles.banner}\n actions={\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"small\"\n onClick={onRetry}\n >\n {t('common.actions.retry')}\n </Button>\n }\n >\n {description}\n </InlineBanner>\n </div>\n );\n};\n\nexport default BackofficeContentError;\n","import { sprinkles } from '@plumile/ui';\n\nexport const container = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 4,\n width: 'full',\n minHeight: 'full',\n});\n\nexport const title = sprinkles({\n maxWidth: 'md',\n});\n\nexport const grid = sprinkles({\n display: 'grid',\n gap: 4,\n gridTemplateColumns: 'autoFitMinmax240',\n});\n\nexport const card = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 3,\n padding: 4,\n minHeight: 44,\n borderRadius: 'xl',\n borderWidth: 'default',\n borderStyle: 'solid',\n borderColor: 'borderSubtle',\n backgroundColor: 'surfaceMuted',\n});\n","import { type JSX } from 'react';\n\nimport { Skeleton } from '@plumile/ui';\n\nimport * as styles from './backofficeContentFallback.css.js';\n\nexport const BackofficeContentFallback = (): JSX.Element => {\n return (\n <div\n className={styles.container}\n role=\"status\"\n aria-live=\"polite\"\n aria-busy=\"true\"\n >\n <Skeleton variant=\"text\" width=\"38%\" className={styles.title} />\n <Skeleton variant=\"text\" width=\"62%\" />\n <div className={styles.grid}>\n {Array.from({ length: 4 }, (_, index) => {\n return (\n <div key={`content-skeleton-${index}`} className={styles.card}>\n <Skeleton variant=\"text\" width=\"46%\" />\n <Skeleton variant=\"text\" width=\"82%\" lines={2} />\n <Skeleton variant=\"block\" width=\"100%\" height={120} />\n </div>\n );\n })}\n </div>\n </div>\n );\n};\n\nexport default BackofficeContentFallback;\n","import { sprinkles } from '@plumile/ui';\n\nexport const root = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n minHeight: 'full',\n width: 'full',\n minWidth: 0,\n});\n","import { Suspense, type JSX, type ReactNode } from 'react';\n\nimport { BackofficeErrorBoundary } from '../errors/BackofficeErrorBoundary.js';\n\nimport { BackofficeContentError } from './BackofficeContentError.js';\nimport { BackofficeContentFallback } from './BackofficeContentFallback.js';\nimport * as styles from './backofficeContentBoundary.css.js';\n\nexport type BackofficeContentBoundaryProps = {\n children: ReactNode;\n};\n\nexport const BackofficeContentBoundary = ({\n children,\n}: BackofficeContentBoundaryProps): JSX.Element => {\n return (\n <div className={styles.root}>\n <BackofficeErrorBoundary\n fallback={({ error, reset }) => {\n return <BackofficeContentError error={error} onRetry={reset} />;\n }}\n >\n <Suspense fallback={<BackofficeContentFallback />}>{children}</Suspense>\n </BackofficeErrorBoundary>\n </div>\n );\n};\n\nexport default BackofficeContentBoundary;\n","import type { BackofficeSidebarProfileViewer } from '@plumile/ui';\n\nexport type BackofficeViewerIdentity = {\n id: string;\n firstName: string;\n lastName: string;\n email: string;\n initials: string;\n};\n\ntype MapViewerToSidebarProfileViewInput = {\n viewer: BackofficeViewerIdentity | null | undefined;\n unknownUserLabel: string;\n};\n\nconst sanitizeToken = (value: string | null | undefined): string => {\n return value?.trim() ?? '';\n};\n\nexport const mapViewerToSidebarProfileView = ({\n viewer,\n unknownUserLabel,\n}: MapViewerToSidebarProfileViewInput): BackofficeSidebarProfileViewer => {\n const firstName = sanitizeToken(viewer?.firstName);\n const lastName = sanitizeToken(viewer?.lastName);\n const joinedDisplayName = [firstName, lastName]\n .filter((token) => {\n return token !== '';\n })\n .join(' ')\n .trim();\n let displayName = joinedDisplayName;\n if (displayName === '') {\n displayName = unknownUserLabel;\n }\n\n const email = sanitizeToken(viewer?.email);\n const initialsToken = sanitizeToken(viewer?.initials);\n let initials = initialsToken;\n if (initials === '') {\n initials = '?';\n }\n\n const ariaParts = [displayName];\n if (email !== '') {\n ariaParts.push(email);\n }\n\n return {\n displayName,\n email,\n initials,\n ariaLabel: ariaParts.join(' - '),\n };\n};\n\nexport default mapViewerToSidebarProfileView;\n","import {\n useEffect,\n useMemo,\n type JSX,\n type ReactNode,\n useCallback,\n useContext,\n useState,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n commitMutation,\n usePreloadedQuery,\n type PreloadedQuery,\n} from 'react-relay';\nimport type {\n GraphQLTaggedNode,\n MutationParameters,\n OperationType,\n} from 'relay-runtime';\nimport { RoutingContext, useLocation } from '@plumile/router';\n\nimport {\n AdminShellLayout,\n BackofficeSidebarProfileMenu,\n EnvironmentBadge,\n GlobalSearchInput,\n ToastProvider,\n} from '@plumile/ui';\n\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport type { LogoutResponse, LogoutVariables } from '../hooks/useAuth.js';\nimport { useBackofficeSidebarPins } from '../hooks/useBackofficeSidebarPins.js';\nimport { useSidebarGroupCollapse } from '../hooks/useSidebarGroupCollapse.js';\nimport { buildSidebarSections } from '../components/backoffice/layout/buildSidebarSections.js';\nimport { BackofficeContentBoundary } from '../components/backoffice/routing/BackofficeContentBoundary.js';\nimport {\n resolveActiveEntityId,\n resolveSidebarGroups,\n resolveVisibleEntityIds,\n} from '../components/backoffice/layout/sidebarUtils.js';\nimport { BackofficeTopbarPortalContextProvider } from '../components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.js';\nimport {\n mapViewerToSidebarProfileView,\n type BackofficeViewerIdentity,\n} from '../components/backoffice/layout/mapViewerToSidebarProfileView.js';\nimport { resetRelayStore } from '../relay/environment.js';\nimport { useRelayEnvironment } from '../relay/useRelayEnvironment.js';\nimport { getBackofficeLoginPath } from '../router/backofficeAuthPaths.js';\nimport type { BackofficeSidebarRecentItem } from '../provider/types.js';\n\nexport type BackofficeLayoutPageProps = {\n children: ReactNode;\n permissionsQuery?: GraphQLTaggedNode;\n prepared?: PreloadedQuery<OperationType> | null;\n authStatus?: {\n isLoggedIn?: boolean | null;\n me?: BackofficeViewerIdentity | null;\n } | null;\n activeGroupId?: string | null;\n};\n\ntype LayoutShellProps = {\n children: ReactNode;\n permissions: unknown;\n authStatus?: {\n isLoggedIn?: boolean | null;\n me?: BackofficeViewerIdentity | null;\n } | null;\n activeGroupId?: string | null;\n};\n\nconst DEFAULT_RECENT_ITEMS_STORAGE_KEY = 'plumile:backoffice:recent-items';\n\nconst readRecentItems = (\n storageKey: string,\n): readonly BackofficeSidebarRecentItem[] => {\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 unknown;\n if (!Array.isArray(parsed)) {\n return [];\n }\n return parsed.filter((item): item is BackofficeSidebarRecentItem => {\n if (item == null || typeof item !== 'object') {\n return false;\n }\n const candidate = item as Partial<BackofficeSidebarRecentItem>;\n return (\n (candidate.kind === 'entity' || candidate.kind === 'tool') &&\n typeof candidate.id === 'string' &&\n typeof candidate.label === 'string' &&\n typeof candidate.href === 'string' &&\n typeof candidate.visitedAt === 'number'\n );\n });\n } catch {\n return [];\n }\n};\n\nconst writeRecentItems = (\n storageKey: string,\n items: readonly BackofficeSidebarRecentItem[],\n): void => {\n if (typeof window === 'undefined') {\n return;\n }\n try {\n window.localStorage.setItem(storageKey, JSON.stringify(items));\n } catch {\n // Ignore storage quota / privacy mode failures.\n }\n};\n\nconst BackofficeLayoutShell = ({\n children,\n permissions,\n authStatus,\n activeGroupId,\n}: LayoutShellProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { pathname } = useLocation();\n const routing = useContext(RoutingContext);\n const relayEnvironment = useRelayEnvironment();\n const {\n auth: authConfig,\n basePath,\n entities,\n sidebar,\n } = useBackofficeConfig();\n const [sidebarQuery, setSidebarQuery] = useState('');\n const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(false);\n const [isSigningOut, setIsSigningOut] = useState(false);\n const [topbarTarget, setTopbarTarget] = useState<HTMLDivElement | null>(null);\n const recentItemsConfig = sidebar?.recentItems;\n const recentItemsEnabled = recentItemsConfig?.enabled === true;\n const recentItemsStorageKey =\n recentItemsConfig?.storageKey ?? DEFAULT_RECENT_ITEMS_STORAGE_KEY;\n const recentItemsMaxItems = recentItemsConfig?.maxItems ?? 8;\n const [recentItems, setRecentItems] = useState<\n readonly BackofficeSidebarRecentItem[]\n >(() => {\n if (!recentItemsEnabled) {\n return [];\n }\n return readRecentItems(recentItemsStorageKey);\n });\n\n const groups = useMemo(() => {\n return resolveSidebarGroups(entities, sidebar);\n }, [entities, sidebar]);\n\n const groupIds = useMemo(() => {\n return Object.keys(groups);\n }, [groups]);\n\n const defaultCollapsedByGroupId = useMemo(() => {\n return Object.fromEntries(\n Object.entries(groups).map(([groupId, group]) => {\n return [groupId, group.behavior?.defaultCollapsed ?? true];\n }),\n );\n }, [groups]);\n\n const visibleEntityIds = useMemo(() => {\n return resolveVisibleEntityIds(groups, entities, sidebar, permissions);\n }, [entities, groups, permissions, sidebar]);\n\n const activeEntityId = useMemo(() => {\n return resolveActiveEntityId(pathname, entities);\n }, [entities, pathname]);\n\n useEffect(() => {\n if (!recentItemsEnabled || activeEntityId == null) {\n return;\n }\n const config = entities[activeEntityId];\n if (config == null) {\n return;\n }\n if (config.kind !== 'tool' && !config.hasList) {\n return;\n }\n const href = config.routes.list;\n let kind: BackofficeSidebarRecentItem['kind'] = 'entity';\n if (config.kind === 'tool') {\n kind = 'tool';\n }\n const item: BackofficeSidebarRecentItem = {\n kind,\n id: activeEntityId,\n label: config.label(tApp),\n href,\n visitedAt: Date.now(),\n };\n setRecentItems((prev) => {\n const next = [\n item,\n ...prev.filter((entry) => {\n return entry.id !== item.id || entry.kind !== item.kind;\n }),\n ].slice(0, recentItemsMaxItems);\n writeRecentItems(recentItemsStorageKey, next);\n return next;\n });\n }, [\n activeEntityId,\n entities,\n recentItemsEnabled,\n recentItemsMaxItems,\n recentItemsStorageKey,\n tApp,\n ]);\n\n const {\n pins,\n toggle: togglePin,\n reorder: reorderPin,\n } = useBackofficeSidebarPins({ visibleEntityIds });\n\n const { collapsedByGroupId, setCollapsed } = useSidebarGroupCollapse({\n groupIds,\n activeGroupId,\n defaultCollapsedByGroupId,\n });\n\n const sections = useMemo(() => {\n return buildSidebarSections({\n basePath,\n pathname,\n entities,\n sidebar,\n permissions,\n searchQuery: sidebarQuery,\n tApp,\n t,\n pinnedEntityIds: pins,\n recentItems,\n onTogglePin: togglePin,\n onReorderPin: reorderPin,\n collapsedByGroupId,\n onGroupCollapsedChange: setCollapsed,\n });\n }, [\n basePath,\n collapsedByGroupId,\n entities,\n pathname,\n permissions,\n pins,\n recentItems,\n reorderPin,\n setCollapsed,\n sidebar,\n sidebarQuery,\n t,\n tApp,\n togglePin,\n ]);\n\n const environment = useMemo(() => {\n const meta = import.meta as unknown as { env?: Record<string, unknown> };\n if (meta.env?.DEV === true) {\n return 'dev' as const;\n }\n return 'prod' as const;\n }, []);\n\n const handleSignOut = useCallback(() => {\n if (isSigningOut) {\n return;\n }\n\n type LogoutMutation = MutationParameters & {\n response: LogoutResponse;\n variables: LogoutVariables;\n };\n\n setIsSigningOut(true);\n\n const runSignOut = async (): Promise<void> => {\n try {\n const config = await authConfig.logout.load();\n await new Promise<void>((resolve, reject) => {\n commitMutation<LogoutMutation>(relayEnvironment, {\n mutation: config.logoutMutation,\n variables: {},\n onCompleted: () => {\n resolve();\n },\n onError: (error) => {\n reject(error);\n },\n });\n });\n localStorage.removeItem('auth_token');\n localStorage.removeItem('remember_me');\n resetRelayStore();\n routing?.history.push({ pathname: getBackofficeLoginPath(basePath) });\n } finally {\n setIsSigningOut(false);\n }\n };\n\n runSignOut().catch(() => {\n /* noop */\n });\n }, [authConfig.logout, basePath, isSigningOut, relayEnvironment, routing]);\n\n const viewer = authStatus?.me ?? null;\n const sidebarProfile = useMemo(() => {\n return mapViewerToSidebarProfileView({\n viewer,\n unknownUserLabel: t('sidebar.profile.unknownUser'),\n });\n }, [t, viewer]);\n\n const sidebarFooter = (\n <BackofficeSidebarProfileMenu\n collapsed={isSidebarCollapsed}\n viewer={sidebarProfile}\n labels={{\n sectionTitle: t('sidebar.profile.title'),\n menuAriaLabel: t('sidebar.profile.menuAriaLabel'),\n signOut: t('sidebar.profile.actions.signOut'),\n }}\n onSignOut={handleSignOut}\n isSigningOut={isSigningOut}\n />\n );\n\n let contentNode: JSX.Element | null = null;\n if (topbarTarget != null) {\n contentNode = (\n <BackofficeContentBoundary>{children}</BackofficeContentBoundary>\n );\n }\n\n return (\n <ToastProvider>\n <AdminShellLayout\n sidebar={{\n sections,\n header: <EnvironmentBadge environment={environment} />,\n search: (\n <GlobalSearchInput\n value={sidebarQuery}\n onChange={setSidebarQuery}\n placeholder={t('sidebar.search.placeholder')}\n ariaLabel={t('sidebar.search.placeholder')}\n />\n ),\n footer: sidebarFooter,\n isCollapsed: isSidebarCollapsed,\n onCollapsedChange: setIsSidebarCollapsed,\n }}\n topbar={{\n breadcrumb: <div ref={setTopbarTarget} />,\n }}\n >\n <BackofficeTopbarPortalContextProvider value={{ target: topbarTarget }}>\n {contentNode}\n </BackofficeTopbarPortalContextProvider>\n </AdminShellLayout>\n </ToastProvider>\n );\n};\n\ntype LayoutWithPermissionsProps = {\n children: ReactNode;\n permissionsQuery: GraphQLTaggedNode;\n prepared: PreloadedQuery<OperationType>;\n authStatus?: {\n isLoggedIn?: boolean | null;\n me?: BackofficeViewerIdentity | null;\n } | null;\n activeGroupId?: string | null;\n};\n\nconst LayoutWithPermissions = ({\n children,\n permissionsQuery,\n prepared,\n authStatus,\n activeGroupId,\n}: LayoutWithPermissionsProps): JSX.Element => {\n const permissions = usePreloadedQuery(permissionsQuery, prepared);\n\n return (\n <BackofficeLayoutShell\n permissions={permissions}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </BackofficeLayoutShell>\n );\n};\n\nexport const BackofficeLayoutPage = ({\n children,\n permissionsQuery,\n prepared,\n authStatus,\n activeGroupId,\n}: BackofficeLayoutPageProps): JSX.Element => {\n if (permissionsQuery != null && prepared != null) {\n return (\n <LayoutWithPermissions\n permissionsQuery={permissionsQuery}\n prepared={prepared}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </LayoutWithPermissions>\n );\n }\n\n return (\n <BackofficeLayoutShell\n permissions={null}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </BackofficeLayoutShell>\n );\n};\n\nexport default BackofficeLayoutPage;\n"],"mappings":";;;;;;;;;;;;;;AAEA,IAAM,IAAsB,8BAItB,KAAuB,MAAiC;CAC5D,IAAI,OAAO,SAAW,KACpB,OAAO,EAAE;CAEX,IAAI;EACF,IAAM,IAAM,OAAO,aAAa,QAAQ,EAAW;EACnD,IAAI,KAAO,MACT,OAAO,EAAE;EAEX,IAAM,IAAS,KAAK,MAAM,EAAI;EAI9B,OAHK,MAAM,QAAQ,EAAO,GAGnB,EAAO,QAAQ,MACb,OAAO,KAAU,SACxB,GAJO,EAAE;SAKL;EACN,OAAO,EAAE;;GAIP,KACJ,GACA,MACa;CACb,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C;GACjD,SAAS,EAAE,kCAAkC;GAC9C;EACD,WAAW;EACG;EACd,CAAA,EAGA,KAAkC;CAOtC,OANI,KAAgB,SAClB,KACE,kBAAC,IAAD,EAA4B,aAAqC,CAAA,GAKnE,kBAAC,IAAD,EAAA,UACE,kBAAC,GAAD;EACE,SAAS;GACP;GACA,QAAQ,kBAAC,GAAD,EAA+B,iBAAe,CAAA;GACtD,QACE,kBAAC,GAAD;IACE,OAAO;IACP,UAAU;IACV,aAAa,EAAE,6BAA6B;IAC5C,WAAW,EAAE,6BAA6B;IAC1C,CAAA;GAEJ,QAAQ;GACR,aAAa;GACb,mBAAmB;GACpB;EACD,QAAQ,EACN,YAAY,kBAAC,OAAD,EAAK,KAAK,GAAmB,CAAA,EAC1C;YAED,kBAAC,GAAD;GAAuC,OAAO,EAAE,QAAQ,GAAc;aACnE;GACqC,CAAA;EACvB,CAAA,EACL,CAAA;GAed,KAAyB,EAC7B,aACA,qBACA,aACA,eACA,uBAKE,kBAAC,GAAD;CACe,aAJG,GAAkB,GAAkB,EAIvC;CACD;CACG;CAEd;CACqB,CAAA,EAIf,KAAwB,EACnC,aACA,qBACA,aACA,eACA,uBAEI,KAAoB,QAAQ,KAAY,OAExC,kBAAC,GAAD;CACoB;CACR;CACE;CACG;CAEd;CACqB,CAAA,GAK1B,kBAAC,GAAD;CACE,aAAa;CACD;CACG;CAEd;CACqB,CAAA"}
@@ -1,113 +0,0 @@
1
- import { n as e } from "./BackofficeTopbarPortalContext-iD7dm4_h.js";
2
- import { Link as t } from "@plumile/router";
3
- import { FormattedDate as n, Tag as r } from "@plumile/ui";
4
- import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
5
- import { BACKOFFICE_DATE_TIME_OPTIONS as s } from "@plumile/backoffice-core/constants.js";
6
- import { createPortal as c } from "react-dom";
7
- //#region src/components/backoffice/columns/buildDataTableColumns.tsx
8
- var l = (e, t) => e(t), u = (e, t) => e == null || typeof e == "string" && e.trim() === "" ? t : String(e), d = (e) => {
9
- if (e === "sm" || e === "md" || e === "lg" || e === "xl") return e;
10
- };
11
- function f(e, o) {
12
- let { tApp: c, t: f, resolveEntityHref: p } = o, m = f("common.notAvailable");
13
- return e.filter((e) => e.key !== "id").map((e) => ({
14
- id: e.key,
15
- header: l(e.header, c),
16
- size: e.size,
17
- isPrimary: e.visibility?.priority === "primary",
18
- priority: e.visibility?.priority,
19
- mobileRole: e.visibility?.mobile,
20
- minVisibleAt: d(e.visibility?.minVisibleAt),
21
- cell: (o) => {
22
- let { cell: c } = e;
23
- switch (c.type) {
24
- case "text": return u(c.value(o), m);
25
- case "link": {
26
- let e = c.value(o);
27
- return e == null || typeof e == "string" && e.trim() === "" ? m : /* @__PURE__ */ a(t, {
28
- to: c.to(o),
29
- children: e
30
- });
31
- }
32
- case "badge": {
33
- let e = c.value(o);
34
- if (e == null || e.trim() === "") return m;
35
- let { tone: t } = c;
36
- return typeof t == "function" && (t = t(o)), /* @__PURE__ */ a(r, {
37
- tone: t,
38
- children: e
39
- });
40
- }
41
- case "dateTime": return /* @__PURE__ */ a(n, {
42
- value: c.value(o),
43
- fallback: m,
44
- options: s
45
- });
46
- case "entityRef": {
47
- let e = c.value(o);
48
- if (e.trim() === "") return m;
49
- let n = p?.(c.entity, e) ?? null;
50
- return n == null ? m : /* @__PURE__ */ a(t, {
51
- to: n,
52
- children: f("actions.view")
53
- });
54
- }
55
- case "custom": {
56
- let e = c.render(o);
57
- return e == null || e === "" ? m : /* @__PURE__ */ a(i, { children: e });
58
- }
59
- default: return m;
60
- }
61
- }
62
- }));
63
- }
64
- //#endregion
65
- //#region src/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.ts
66
- var p = (e, t) => Error(t == null ? `Invalid breadcrumb contract: ${e}` : `Invalid breadcrumb contract: ${e} (${t})`), m = (e) => {
67
- if (e == null) throw p("MISSING_BREADCRUMB");
68
- if (e.length === 0) throw p("EMPTY_BREADCRUMB");
69
- let t = /* @__PURE__ */ new Set();
70
- if (e.forEach((e, n) => {
71
- if (typeof e.id != "string" || e.id.trim() === "") throw p("INVALID_SEGMENT_ID", `index=${n}`);
72
- if (t.has(e.id)) throw p("INVALID_SEGMENT_ID", `duplicate id="${e.id}"`);
73
- t.add(e.id);
74
- }), e[e.length - 1]?.isCurrent !== !0) throw p("MISSING_CURRENT_SEGMENT");
75
- return e;
76
- }, h = ({ children: t }) => {
77
- let { target: n } = e();
78
- if (n == null) throw Error("Backoffice topbar target is missing. Ensure BackofficeLayoutPage provides a topbar breadcrumb mount target before rendering right-side pages.");
79
- return c(t, n);
80
- }, g = "txvbqb9jg txvbqbcp", _ = "_80s44h0 txvbqb9jg txvbqbcp txvbqbao7", v = "txvbqb9jg txvbqbcp txvbqbao7", y = "_80s44h1 txvbqbva1 txvbqb8y txvbqbfb7", b = "txvbqbv9z txvbqb8y txvbqbfb7 txvbqbamp", x = ({ items: e }) => /* @__PURE__ */ a("nav", {
81
- className: g,
82
- "aria-label": "Breadcrumb",
83
- children: /* @__PURE__ */ a("ol", {
84
- className: _,
85
- children: e.map((e, n) => {
86
- let r = n === 0, i = e.isCurrent === !0, s = `${e.id}-${n}`, c = e.to != null && !i, l;
87
- if (c) l = /* @__PURE__ */ a(t, {
88
- to: e.to,
89
- className: y,
90
- children: e.label
91
- });
92
- else {
93
- let t = y;
94
- i && (t = b), l = /* @__PURE__ */ a("span", {
95
- className: t,
96
- children: e.label
97
- });
98
- }
99
- return /* @__PURE__ */ o("li", {
100
- className: v,
101
- children: [!r && /* @__PURE__ */ a("span", {
102
- className: "txvbqbva1 txvbqb8y txvbqbfb7",
103
- "aria-hidden": "true",
104
- children: "/"
105
- }), l]
106
- }, s);
107
- })
108
- })
109
- }), S = ({ breadcrumb: e, children: t }) => /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(h, { children: /* @__PURE__ */ a(x, { items: m(e) }) }), /* @__PURE__ */ a(i, { children: t })] });
110
- //#endregion
111
- export { f as n, S as t };
112
-
113
- //# sourceMappingURL=BackofficeRightPageLayout-hexJmpam.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BackofficeRightPageLayout-hexJmpam.js","names":[],"sources":["../../src/components/backoffice/columns/buildDataTableColumns.tsx","../../src/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.ts","../../src/components/backoffice/layout/breadcrumb/BackofficeTopbarPortal.tsx","../../src/components/backoffice/layout/breadcrumb/backofficeTopbarBreadcrumb.css.ts","../../src/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.tsx","../../src/components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.tsx"],"sourcesContent":["import { BACKOFFICE_DATE_TIME_OPTIONS } from '@plumile/backoffice-core/constants.js';\nimport type {\n BackofficeColumnSpec,\n BackofficeFieldSize,\n BackofficeListColumnVisibility,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type { TFunction } from 'i18next';\nimport { Link } from '@plumile/router';\nimport {\n FormattedDate,\n Tag,\n type DataTableBreakpoint,\n type DataTableColumn,\n} from '@plumile/ui';\n\nconst resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nconst resolveTextValue = (\n value: string | number | null,\n fallback: string,\n): string => {\n if (value == null) {\n return fallback;\n }\n if (typeof value === 'string' && value.trim() === '') {\n return fallback;\n }\n return String(value);\n};\n\nexport type BuildDataTableColumnsOptions = {\n tApp: TFunction;\n t: TFunction;\n resolveEntityHref?: (entityId: string, refId: string) => string | null;\n};\n\nexport type BackofficeSizedDataTableColumn<Row> = DataTableColumn<Row> & {\n size: BackofficeFieldSize;\n};\n\nconst resolveBreakpoint = (\n value: BackofficeListColumnVisibility['minVisibleAt'] | undefined,\n): DataTableBreakpoint | undefined => {\n if (value === 'sm' || value === 'md' || value === 'lg' || value === 'xl') {\n return value;\n }\n return undefined;\n};\n\n/**\n *\n */\nexport function buildDataTableColumns<Row>(\n columns: readonly BackofficeColumnSpec<Row>[],\n options: BuildDataTableColumnsOptions,\n): readonly BackofficeSizedDataTableColumn<Row>[] {\n const { tApp, t, resolveEntityHref } = options;\n const fallback = t('common.notAvailable');\n const filteredColumns = columns.filter((column) => {\n return column.key !== 'id';\n });\n\n return filteredColumns.map((column) => {\n return {\n id: column.key,\n header: resolveLabel(column.header, tApp),\n size: column.size,\n isPrimary: column.visibility?.priority === 'primary',\n priority: column.visibility?.priority,\n mobileRole: column.visibility?.mobile,\n minVisibleAt: resolveBreakpoint(column.visibility?.minVisibleAt),\n cell: (row) => {\n const { cell } = column;\n switch (cell.type) {\n case 'text': {\n return resolveTextValue(cell.value(row), fallback);\n }\n case 'link': {\n const value = cell.value(row);\n if (\n value == null ||\n (typeof value === 'string' && value.trim() === '')\n ) {\n return fallback;\n }\n return <Link to={cell.to(row)}>{value}</Link>;\n }\n case 'badge': {\n const value = cell.value(row);\n if (value == null || value.trim() === '') {\n return fallback;\n }\n let { tone } = cell;\n if (typeof tone === 'function') {\n tone = tone(row);\n }\n return <Tag tone={tone}>{value}</Tag>;\n }\n case 'dateTime': {\n const value = cell.value(row);\n return (\n <FormattedDate\n value={value}\n fallback={fallback}\n options={BACKOFFICE_DATE_TIME_OPTIONS}\n />\n );\n }\n case 'entityRef': {\n const id = cell.value(row);\n if (id.trim() === '') {\n return fallback;\n }\n const href = resolveEntityHref?.(cell.entity, id) ?? null;\n if (href != null) {\n return <Link to={href}>{t('actions.view')}</Link>;\n }\n return fallback;\n }\n case 'custom': {\n const rendered = cell.render(row);\n if (rendered == null || rendered === '') {\n return fallback;\n }\n return <>{rendered}</>;\n }\n default: {\n return fallback;\n }\n }\n },\n };\n });\n}\n","import type {\n BackofficeTopbarBreadcrumbItem,\n BreadcrumbContractErrorCode,\n} from './types.js';\n\nconst formatContractError = (\n code: BreadcrumbContractErrorCode,\n details?: string,\n): Error => {\n if (details == null) {\n return new Error(`Invalid breadcrumb contract: ${code}`);\n }\n return new Error(`Invalid breadcrumb contract: ${code} (${details})`);\n};\n\nexport const assertValidBreadcrumb = (\n items: readonly BackofficeTopbarBreadcrumbItem[] | null | undefined,\n): readonly BackofficeTopbarBreadcrumbItem[] => {\n if (items == null) {\n throw formatContractError('MISSING_BREADCRUMB');\n }\n if (items.length === 0) {\n throw formatContractError('EMPTY_BREADCRUMB');\n }\n\n const seen = new Set<string>();\n items.forEach((item, index) => {\n if (typeof item.id !== 'string' || item.id.trim() === '') {\n throw formatContractError('INVALID_SEGMENT_ID', `index=${index}`);\n }\n\n if (seen.has(item.id)) {\n throw formatContractError(\n 'INVALID_SEGMENT_ID',\n `duplicate id=\"${item.id}\"`,\n );\n }\n seen.add(item.id);\n });\n\n const last = items[items.length - 1];\n if (last?.isCurrent !== true) {\n throw formatContractError('MISSING_CURRENT_SEGMENT');\n }\n\n return items;\n};\n","import { type JSX, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { useBackofficeTopbarPortalContext } from './BackofficeTopbarPortalContext.js';\n\nexport type BackofficeTopbarPortalProps = {\n children: ReactNode;\n};\n\nexport const BackofficeTopbarPortal = ({\n children,\n}: BackofficeTopbarPortalProps): JSX.Element | null => {\n const { target } = useBackofficeTopbarPortalContext();\n if (target == null) {\n throw new Error(\n 'Backoffice topbar target is missing. Ensure BackofficeLayoutPage provides a topbar breadcrumb mount target before rendering right-side pages.',\n );\n }\n return createPortal(children, target);\n};\n\nexport default BackofficeTopbarPortal;\n","import { sprinkles } from '@plumile/ui';\nimport { style } from '@vanilla-extract/css';\n\nconst INLINE_FLEX = 'inline-flex' as const;\n\nexport const nav = sprinkles({\n display: INLINE_FLEX,\n alignItems: 'center',\n});\n\nexport const list = style([\n sprinkles({\n display: INLINE_FLEX,\n alignItems: 'center',\n gap: 2,\n }),\n {\n margin: 0,\n padding: 0,\n listStyle: 'none',\n },\n]);\n\nexport const item = sprinkles({\n display: INLINE_FLEX,\n alignItems: 'center',\n gap: 2,\n});\n\nexport const separator = sprinkles({\n color: 'textSecondary',\n fontSize: 'sm',\n lineHeight: 'normal',\n});\n\nexport const link = style([\n sprinkles({\n color: 'textSecondary',\n fontSize: 'sm',\n lineHeight: 'normal',\n }),\n {\n textDecoration: 'none',\n selectors: {\n '&:hover': {\n textDecoration: 'underline',\n },\n },\n },\n]);\n\nexport const current = sprinkles({\n color: 'text',\n fontSize: 'sm',\n lineHeight: 'normal',\n fontWeight: 'semibold',\n});\n","import { type JSX } from 'react';\nimport { Link } from '@plumile/router';\n\nimport type { BackofficeTopbarBreadcrumbItem } from './types.js';\nimport * as styles from './backofficeTopbarBreadcrumb.css.js';\n\nexport type BackofficeTopbarBreadcrumbProps = {\n items: readonly BackofficeTopbarBreadcrumbItem[];\n};\n\nexport const BackofficeTopbarBreadcrumb = ({\n items,\n}: BackofficeTopbarBreadcrumbProps): JSX.Element => {\n return (\n <nav className={styles.nav} aria-label=\"Breadcrumb\">\n <ol className={styles.list}>\n {items.map((item, index) => {\n const isFirst = index === 0;\n const isCurrent = item.isCurrent === true;\n const key = `${item.id}-${index}`;\n const shouldRenderLink = item.to != null && !isCurrent;\n let content: JSX.Element;\n\n if (shouldRenderLink) {\n content = (\n <Link to={item.to} className={styles.link}>\n {item.label}\n </Link>\n );\n } else {\n let className = styles.link;\n if (isCurrent) {\n className = styles.current;\n }\n content = <span className={className}>{item.label}</span>;\n }\n\n return (\n <li key={key} className={styles.item}>\n {!isFirst && (\n <span className={styles.separator} aria-hidden=\"true\">\n /\n </span>\n )}\n {content}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n};\n\nexport default BackofficeTopbarBreadcrumb;\n","import { type JSX, type ReactNode } from 'react';\n\nimport { assertValidBreadcrumb } from './assertValidBreadcrumb.js';\nimport { BackofficeTopbarPortal } from './BackofficeTopbarPortal.js';\nimport { BackofficeTopbarBreadcrumb } from './BackofficeTopbarBreadcrumb.js';\nimport type { BackofficeTopbarBreadcrumbItem } from './types.js';\n\nexport type BackofficeRightPageLayoutProps = {\n breadcrumb: readonly BackofficeTopbarBreadcrumbItem[];\n children: ReactNode;\n};\n\nexport const BackofficeRightPageLayout = ({\n breadcrumb,\n children,\n}: BackofficeRightPageLayoutProps): JSX.Element => {\n const items = assertValidBreadcrumb(breadcrumb);\n\n return (\n <>\n <BackofficeTopbarPortal>\n <BackofficeTopbarBreadcrumb items={items} />\n </BackofficeTopbarPortal>\n <>{children}</>\n </>\n );\n};\n\nexport default BackofficeRightPageLayout;\n"],"mappings":";;;;;;;AAgBA,IAAM,KAAgB,GAAkB,MAC/B,EAAM,EAAK,EAGd,KACJ,GACA,MAEI,KAAS,QAGT,OAAO,KAAU,YAAY,EAAM,MAAM,KAAK,KACzC,IAEF,OAAO,EAAM,EAahB,KACJ,MACoC;CACpC,IAAI,MAAU,QAAQ,MAAU,QAAQ,MAAU,QAAQ,MAAU,MAClE,OAAO;;AAQX,SAAgB,EACd,GACA,GACgD;CAChD,IAAM,EAAE,SAAM,MAAG,yBAAsB,GACjC,IAAW,EAAE,sBAAsB;CAKzC,OAJwB,EAAQ,QAAQ,MAC/B,EAAO,QAAQ,KAGjB,CAAgB,KAAK,OACnB;EACL,IAAI,EAAO;EACX,QAAQ,EAAa,EAAO,QAAQ,EAAK;EACzC,MAAM,EAAO;EACb,WAAW,EAAO,YAAY,aAAa;EAC3C,UAAU,EAAO,YAAY;EAC7B,YAAY,EAAO,YAAY;EAC/B,cAAc,EAAkB,EAAO,YAAY,aAAa;EAChE,OAAO,MAAQ;GACb,IAAM,EAAE,YAAS;GACjB,QAAQ,EAAK,MAAb;IACE,KAAK,QACH,OAAO,EAAiB,EAAK,MAAM,EAAI,EAAE,EAAS;IAEpD,KAAK,QAAQ;KACX,IAAM,IAAQ,EAAK,MAAM,EAAI;KAO7B,OALE,KAAS,QACR,OAAO,KAAU,YAAY,EAAM,MAAM,KAAK,KAExC,IAEF,kBAAC,GAAD;MAAM,IAAI,EAAK,GAAG,EAAI;gBAAG;MAAa,CAAA;;IAE/C,KAAK,SAAS;KACZ,IAAM,IAAQ,EAAK,MAAM,EAAI;KAC7B,IAAI,KAAS,QAAQ,EAAM,MAAM,KAAK,IACpC,OAAO;KAET,IAA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AAM,EAAE,cAAW,GAAkC;CACrD,IAAI,KAAU,MACZ,MAAU,MACR,gJACD;CAEH,OAAO,EAAa,GAAU,EAAO;yMER1B,KAA8B,EACzC,eAGE,kBAAC,OAAD;CAAK,WAAW;CAAY,cAAW;WACrC,kBAAC,MAAD;EAAI,WAAW;YACZ,EAAM,KAAK,GAAM,MAAU;GAC1B,IAAM,IAAU,MAAU,GACpB,IAAY,EAAK,cAAc,IAC/B,IAAM,GAAG,EAAK,GAAG,GAAG,KACpB,IAAmB,EAAK,MAAM,QAAQ,CAAC,GACzC;GAEJ,IAAI,GACF,IACE,kBAAC,GAAD;IAAM,IAAI,EAAK;IAAI,WAAW;cAC3B,EAAK;IACD,CAAA;QAEJ;IACL,IAAI,IAAY;IAIhB,AAHI,MACF,IAAY,IAEd,IAAU,kBAAC,QAAD;KAAiB;eAAY,EAAK;KAAa,CAAA;;GAG3D,OACE,kBAAC,MAAD;IAAc,WAAW;cAAzB,CACG,CAAC,KACA,kBAAC,QAAD;KAAM,WAAW;KAAkB,eAAY;eAAO;KAE/C,CAAA,EAER,EACE;MAPI,EAOJ;IAEP;EACC,CAAA;CACD,CAAA,ECrCG,KAA6B,EACxC,eACA,kBAKE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAmC,OAL3B,EAAsB,EAKK,EAAS,CAAA,EACrB,CAAA,EACzB,kBAAA,GAAA,EAAG,aAAY,CAAA,CACd,EAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildBreadcrumbs-CqF9Nh6x.js","names":[],"sources":["../../src/components/backoffice/layout/breadcrumb/buildBreadcrumbs.ts"],"sourcesContent":["import type { TFunction } from 'i18next';\n\nimport type {\n BackofficeResolvedDetailLayoutFacetConfig,\n BackofficeResolvedDetailPageFacetConfig,\n BackofficeResolvedListFacetConfig,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\n\nimport type { BackofficeTopbarBreadcrumbItem } from './types.js';\n\nconst resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nexport const resolveEntityTitleFromDetailHeader = <\n LayoutView extends object,\n>(input: {\n layoutView: LayoutView;\n detailHeader: BackofficeResolvedDetailLayoutFacetConfig['header'];\n tApp: TFunction;\n}): string => {\n const titleValue = input.detailHeader.titleValue?.(\n input.layoutView,\n input.tApp,\n );\n if (typeof titleValue === 'string' && titleValue.trim() !== '') {\n return titleValue;\n }\n\n const title = resolveLabel(input.detailHeader.title, input.tApp);\n if (title.trim() !== '') {\n return title;\n }\n\n const maybeId = (input.layoutView as { id?: unknown }).id;\n if (typeof maybeId === 'string' && maybeId.trim() !== '') {\n return maybeId;\n }\n\n return '';\n};\n\nexport const buildDashboardBreadcrumb = (\n t: TFunction,\n): readonly BackofficeTopbarBreadcrumbItem[] => {\n return [\n {\n id: 'dashboard',\n label: t('dashboard.title'),\n isCurrent: true,\n },\n ];\n};\n\nexport const buildEntityListBreadcrumb = (\n config: BackofficeResolvedListFacetConfig,\n tApp: TFunction,\n): readonly BackofficeTopbarBreadcrumbItem[] => {\n return [\n {\n id: `${config.id}-list`,\n label: resolveLabel(config.label, tApp),\n isCurrent: true,\n },\n ];\n};\n\nexport const buildEntityDetailBreadcrumb = (input: {\n config:\n | BackofficeResolvedDetailLayoutFacetConfig\n | BackofficeResolvedDetailPageFacetConfig;\n tApp: TFunction;\n entityId: string;\n layoutView: unknown;\n pageLabel: string;\n}): readonly BackofficeTopbarBreadcrumbItem[] => {\n const listLabel = resolveLabel(input.config.label, input.tApp);\n const entityTitle = resolveEntityTitleFromDetailHeader({\n layoutView: input.layoutView as object,\n detailHeader: input.config.header,\n tApp: input.tApp,\n });\n\n return [\n {\n id: `${input.config.id}-list`,\n label: listLabel,\n to: input.config.routes.list,\n },\n {\n id: `${input.config.id}-entity-${input.entityId}`,\n label: entityTitle,\n to: input.config.routes.detail(input.entityId),\n },\n {\n id: `${input.config.id}-page-${input.pageLabel}`,\n label: input.pageLabel,\n isCurrent: true,\n },\n ];\n};\n\nexport const buildToolBreadcrumb = (input: {\n title: string;\n}): readonly BackofficeTopbarBreadcrumbItem[] => {\n return [\n {\n id: `tool-${input.title}`,\n label: input.title,\n isCurrent: true,\n },\n ];\n};\n"],"mappings":";AAWA,IAAM,KAAgB,GAAkB,MAC/B,EAAM,EAAK,EAGP,KAEX,MAIY;CACZ,IAAM,IAAa,EAAM,aAAa,aACpC,EAAM,YACN,EAAM,KACP;CACD,IAAI,OAAO,KAAe,YAAY,EAAW,MAAM,KAAK,IAC1D,OAAO;CAGT,IAAM,IAAQ,EAAa,EAAM,aAAa,OAAO,EAAM,KAAK;CAChE,IAAI,EAAM,MAAM,KAAK,IACnB,OAAO;CAGT,IAAM,IAAW,EAAM,WAAgC;CAKvD,OAJI,OAAO,KAAY,YAAY,EAAQ,MAAM,KAAK,KAC7C,IAGF;GAGI,KACX,MAEO,CACL;CACE,IAAI;CACJ,OAAO,EAAE,kBAAkB;CAC3B,WAAW;CACZ,CACF,EAGU,KACX,GACA,MAEO,CACL;CACE,IAAI,GAAG,EAAO,GAAG;CACjB,OAAO,EAAa,EAAO,OAAO,EAAK;CACvC,WAAW;CACZ,CACF,EAGU,KAA+B,MAQK;CAC/C,IAAM,IAAY,EAAa,EAAM,OAAO,OAAO,EAAM,KAAK,EACxD,IAAc,EAAmC;EACrD,YAAY,EAAM;EAClB,cAAc,EAAM,OAAO;EAC3B,MAAM,EAAM;EACb,CAAC;CAEF,OAAO;EACL;GACE,IAAI,GAAG,EAAM,OAAO,GAAG;GACvB,OAAO;GACP,IAAI,EAAM,OAAO,OAAO;GACzB;EACD;GACE,IAAI,GAAG,EAAM,OAAO,GAAG,UAAU,EAAM;GACvC,OAAO;GACP,IAAI,EAAM,OAAO,OAAO,OAAO,EAAM,SAAS;GAC/C;EACD;GACE,IAAI,GAAG,EAAM,OAAO,GAAG,QAAQ,EAAM;GACrC,OAAO,EAAM;GACb,WAAW;GACZ;EACF"}
@@ -1,52 +0,0 @@
1
- //#region src/components/backoffice/layout/sidebarUtils.ts
2
- var e = (e, t) => e(t), t = (e, t) => !!(e === t || t !== "/" && e.startsWith(`${t}/`)), n = (e) => ({ main: { entities: Object.keys(e) } }), r = (e, t) => t?.groups ?? n(e), i = (e) => e.kind === "dashboard" ? {
3
- kind: "dashboard",
4
- id: e.id ?? "dashboard"
5
- } : {
6
- kind: e.kind,
7
- id: e.id
8
- }, a = (e) => e.items == null ? e.entities?.map((e) => ({
9
- kind: "entity",
10
- id: e
11
- })) ?? [] : e.items, o = (e) => a(e).flatMap((e) => e.kind === "entity" || e.kind === "tool" ? [e.id] : []), s = (e) => {
12
- let t = /* @__PURE__ */ new Map();
13
- return Object.entries(e).forEach(([e, n]) => {
14
- o(n).forEach((r) => {
15
- t.has(r) || t.set(r, {
16
- groupId: e,
17
- icon: n.icon
18
- });
19
- });
20
- }), t;
21
- }, c = (e, t, n, r) => {
22
- let i = t[e];
23
- if (i == null) return !1;
24
- let a = {
25
- kind: "entity",
26
- id: e
27
- };
28
- return i.kind === "tool" && (a = {
29
- kind: "tool",
30
- id: e
31
- }), n?.isItemVisible == null ? i.kind === "tool" ? !0 : i.hasList : n.isItemVisible(a, r);
32
- }, l = (e, t, n, r) => {
33
- let o = [], s = /* @__PURE__ */ new Set();
34
- return Object.entries(e).forEach(([, e]) => {
35
- e.isVisible != null && !e.isVisible(r) || a(e).forEach((e) => {
36
- let a = i(e);
37
- if (a.kind !== "entity" && a.kind !== "tool") return;
38
- let l = a.id;
39
- s.has(l) || c(l, t, n, r) && (s.add(l), o.push(l));
40
- });
41
- }), o;
42
- }, u = (e, n) => {
43
- let r = Object.entries(n);
44
- for (let [n, i] of r) if (i.kind === "tool") {
45
- if (t(e, i.routes.list)) return n;
46
- } else if (i.hasList && t(e, i.routes.list)) return n;
47
- return null;
48
- };
49
- //#endregion
50
- export { e as a, a as i, t as n, r as o, u as r, l as s, s as t };
51
-
52
- //# sourceMappingURL=sidebarUtils-DVkLmFbS.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sidebarUtils-DVkLmFbS.js","names":[],"sources":["../../src/components/backoffice/layout/sidebarUtils.ts"],"sourcesContent":["import type { TFunction } from 'i18next';\n\nimport type {\n BackofficeEntityManifestMap,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type {\n BackofficeSidebarConfig,\n BackofficeIconComponent,\n BackofficeSidebarGroupConfig,\n BackofficeSidebarItemDescriptor,\n BackofficeSidebarItemConfig,\n} from '../../../provider/types.js';\n\nexport const resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nexport const isActivePath = (pathname: string, href: string): boolean => {\n if (pathname === href) {\n return true;\n }\n if (href !== '/' && pathname.startsWith(`${href}/`)) {\n return true;\n }\n return false;\n};\n\nexport const buildDefaultGroups = (\n entities: BackofficeEntityManifestMap,\n): Record<string, BackofficeSidebarGroupConfig> => {\n const entityIds = Object.keys(entities);\n\n return {\n main: {\n entities: entityIds,\n },\n };\n};\n\nexport const resolveSidebarGroups = (\n entities: BackofficeEntityManifestMap,\n sidebar: BackofficeSidebarConfig | undefined,\n): Record<string, BackofficeSidebarGroupConfig> => {\n return sidebar?.groups ?? buildDefaultGroups(entities);\n};\n\nexport type EntityGroupLookup = Map<\n string,\n { groupId: string; icon?: BackofficeIconComponent }\n>;\n\nexport const resolveItemDescriptor = (\n item: BackofficeSidebarItemConfig,\n): BackofficeSidebarItemDescriptor => {\n if (item.kind === 'dashboard') {\n return { kind: 'dashboard', id: item.id ?? 'dashboard' };\n }\n return { kind: item.kind, id: item.id };\n};\n\nexport const resolveGroupItems = (\n group: BackofficeSidebarGroupConfig,\n): readonly BackofficeSidebarItemConfig[] => {\n if (group.items != null) {\n return group.items;\n }\n return (\n group.entities?.map((entityId) => {\n return { kind: 'entity', id: entityId } as const;\n }) ?? []\n );\n};\n\nexport const resolveGroupEntityIds = (\n group: BackofficeSidebarGroupConfig,\n): readonly string[] => {\n return resolveGroupItems(group).flatMap((item) => {\n if (item.kind === 'entity' || item.kind === 'tool') {\n return [item.id];\n }\n return [];\n });\n};\n\nexport const buildEntityGroupLookup = (\n groups: Record<string, BackofficeSidebarGroupConfig>,\n): EntityGroupLookup => {\n const lookup: EntityGroupLookup = new Map();\n\n Object.entries(groups).forEach(([groupId, group]) => {\n const entityIds = resolveGroupEntityIds(group);\n entityIds.forEach((entityId) => {\n if (!lookup.has(entityId)) {\n lookup.set(entityId, { groupId, icon: group.icon });\n }\n });\n });\n\n return lookup;\n};\n\nconst isEntityVisible = (\n entityId: string,\n entities: BackofficeEntityManifestMap,\n sidebar: BackofficeSidebarConfig | undefined,\n permissions: unknown,\n): boolean => {\n const config = entities[entityId];\n if (config == null) {\n return false;\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\n if (sidebar?.isItemVisible != null) {\n return sidebar.isItemVisible(descriptor, permissions);\n }\n\n if (config.kind === 'tool') {\n return true;\n }\n return config.hasList;\n};\n\nexport const resolveVisibleEntityIds = (\n groups: Record<string, BackofficeSidebarGroupConfig>,\n entities: BackofficeEntityManifestMap,\n sidebar: BackofficeSidebarConfig | undefined,\n permissions: unknown,\n): string[] => {\n const output: string[] = [];\n const seen = new Set<string>();\n\n Object.entries(groups).forEach(([, group]) => {\n if (group.isVisible != null && !group.isVisible(permissions)) {\n return;\n }\n resolveGroupItems(group).forEach((item) => {\n const descriptor = resolveItemDescriptor(item);\n if (descriptor.kind !== 'entity' && descriptor.kind !== 'tool') {\n return;\n }\n const entityId = descriptor.id;\n if (seen.has(entityId)) {\n return;\n }\n if (!isEntityVisible(entityId, entities, sidebar, permissions)) {\n return;\n }\n seen.add(entityId);\n output.push(entityId);\n });\n });\n\n return output;\n};\n\nexport const resolveActiveEntityId = (\n pathname: string,\n entities: BackofficeEntityManifestMap,\n): string | null => {\n const entries = Object.entries(entities);\n for (const [entityId, config] of entries) {\n if (config.kind === 'tool') {\n if (isActivePath(pathname, config.routes.list)) {\n return entityId;\n }\n } else if (config.hasList && isActivePath(pathname, config.routes.list)) {\n return entityId;\n }\n }\n return null;\n};\n\nexport const resolveActiveGroupId = (\n groups: Record<string, BackofficeSidebarGroupConfig>,\n activeEntityId: string | null,\n entities: BackofficeEntityManifestMap,\n sidebar: BackofficeSidebarConfig | undefined,\n permissions: unknown,\n): string | null => {\n if (activeEntityId == null) {\n return null;\n }\n\n if (!isEntityVisible(activeEntityId, entities, sidebar, permissions)) {\n return null;\n }\n\n for (const [groupId, group] of Object.entries(groups)) {\n const isVisible = group.isVisible == null || group.isVisible(permissions);\n if (isVisible && resolveGroupEntityIds(group).includes(activeEntityId)) {\n return groupId;\n }\n }\n\n return null;\n};\n"],"mappings":";AAcA,IAAa,KAAgB,GAAkB,MACtC,EAAM,EAAK,EAGP,KAAgB,GAAkB,MAI7C,GAHI,MAAa,KAGb,MAAS,OAAO,EAAS,WAAW,GAAG,EAAK,GAAG,GAMxC,KACX,OAIO,EACL,MAAM,EACJ,UAJc,OAAO,KAAK,EAIhB,EACX,EACF,GAGU,KACX,GACA,MAEO,GAAS,UAAU,EAAmB,EAAS,EAQ3C,KACX,MAEI,EAAK,SAAS,cACT;CAAE,MAAM;CAAa,IAAI,EAAK,MAAM;CAAa,GAEnD;CAAE,MAAM,EAAK;CAAM,IAAI,EAAK;CAAI,EAG5B,KACX,MAEI,EAAM,SAAS,OAIjB,EAAM,UAAU,KAAK,OACZ;CAAE,MAAM;CAAU,IAAI;CAAU,EACvC,IAAI,EAAE,GALD,EAAM,OASJ,KACX,MAEO,EAAkB,EAAM,CAAC,SAAS,MACnC,EAAK,SAAS,YAAY,EAAK,SAAS,SACnC,CAAC,EAAK,GAAG,GAEX,EAAE,CACT,EAGS,KACX,MACsB;CACtB,IAAM,oBAA4B,IAAI,KAAK;CAW3C,OATA,OAAO,QAAQ,EAAO,CAAC,SAAS,CAAC,GAAS,OAAW;EAEnD,EADwC,EACxC,CAAU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