@rebasepro/cms 0.25.0 → 0.26.0

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 (125) hide show
  1. package/dist/collection_editor/liveSchemaClient.d.ts +3 -3
  2. package/dist/collection_editor/liveSchemaClient.js.map +1 -1
  3. package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js +1 -1
  4. package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js.map +1 -1
  5. package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.d.ts +7 -1
  6. package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js +61 -50
  7. package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -1
  8. package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js +22 -22
  9. package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -1
  10. package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js +14 -14
  11. package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js.map +1 -1
  12. package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js +24 -24
  13. package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js.map +1 -1
  14. package/dist/collection_editor/useLiveSchemaEditing.js +4 -1
  15. package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -1
  16. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +1 -1
  17. package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -1
  18. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.d.ts +1 -2
  19. package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -1
  20. package/dist/components/CollectionTableBinding/internal/EntityTableCell.d.ts +1 -2
  21. package/dist/components/CollectionTableBinding/internal/EntityTableCell.js.map +1 -1
  22. package/dist/components/CollectionViewBinding/CollectionViewActions.js +1 -1
  23. package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
  24. package/dist/components/CollectionViewBinding/CollectionViewBinding.js +2 -28
  25. package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
  26. package/dist/components/CollectionViewBinding/DefaultCollectionEmptyState.d.ts +12 -0
  27. package/dist/components/CollectionViewBinding/DefaultCollectionEmptyState.js +33 -0
  28. package/dist/components/CollectionViewBinding/DefaultCollectionEmptyState.js.map +1 -0
  29. package/dist/components/CollectionsScopeContext.d.ts +5 -1
  30. package/dist/components/CollectionsScopeContext.js +10 -2
  31. package/dist/components/CollectionsScopeContext.js.map +1 -1
  32. package/dist/components/DefaultAppBar.js +2 -1
  33. package/dist/components/DefaultAppBar.js.map +1 -1
  34. package/dist/components/DefaultDrawer.js +16 -4
  35. package/dist/components/DefaultDrawer.js.map +1 -1
  36. package/dist/components/DefaultMissingReference.d.ts +8 -0
  37. package/dist/components/DefaultMissingReference.js +13 -0
  38. package/dist/components/DefaultMissingReference.js.map +1 -0
  39. package/dist/components/DeleteEntityDialog.js +9 -9
  40. package/dist/components/DeleteEntityDialog.js.map +1 -1
  41. package/dist/components/EntityFormPanel.d.ts +7 -2
  42. package/dist/components/EntityFormPanel.js +72 -29
  43. package/dist/components/EntityFormPanel.js.map +1 -1
  44. package/dist/components/HomePage/ContentHomePage.js +4 -3
  45. package/dist/components/HomePage/ContentHomePage.js.map +1 -1
  46. package/dist/components/HomePage/HomePageDnD.js +3 -1
  47. package/dist/components/HomePage/HomePageDnD.js.map +1 -1
  48. package/dist/components/HomePage/SmallNavigationCard.js +25 -0
  49. package/dist/components/HomePage/SmallNavigationCard.js.map +1 -0
  50. package/dist/components/RebaseAuthGate.js +3 -2
  51. package/dist/components/RebaseAuthGate.js.map +1 -1
  52. package/dist/components/RebaseLayout.d.ts +4 -1
  53. package/dist/components/RebaseLayout.js +7 -1
  54. package/dist/components/RebaseLayout.js.map +1 -1
  55. package/dist/components/RebaseShell.d.ts +4 -1
  56. package/dist/components/RebaseShell.js.map +1 -1
  57. package/dist/components/ReferenceTable/SelectionTableBinding.js +4 -3
  58. package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
  59. package/dist/components/RelationSelector.js +2 -2
  60. package/dist/components/RelationSelector.js.map +1 -1
  61. package/dist/components/SideDialogs.js +10 -4
  62. package/dist/components/SideDialogs.js.map +1 -1
  63. package/dist/components/app/Scaffold.js +5 -1
  64. package/dist/components/app/Scaffold.js.map +1 -1
  65. package/dist/components/field_configs.js +1 -1
  66. package/dist/components/history/EntityHistoryView.js +6 -4
  67. package/dist/components/history/EntityHistoryView.js.map +1 -1
  68. package/dist/components/history/LastEditedByIndicator.d.ts +2 -1
  69. package/dist/data_export/export/export.d.ts +2 -13
  70. package/dist/data_export/export/export.js +1 -36
  71. package/dist/data_export/export/export.js.map +1 -1
  72. package/dist/form/EntityForm.d.ts +1 -1
  73. package/dist/form/EntityForm.js +17 -13
  74. package/dist/form/EntityForm.js.map +1 -1
  75. package/dist/form/EntityFormBinding.d.ts +1 -1
  76. package/dist/form/EntityFormBinding.js +42 -4
  77. package/dist/form/EntityFormBinding.js.map +1 -1
  78. package/dist/form/PropertyFieldBinding.js +1 -1
  79. package/dist/form/components/FieldBlock.d.ts +8 -1
  80. package/dist/form/components/FieldBlock.js +16 -2
  81. package/dist/form/components/FieldBlock.js.map +1 -1
  82. package/dist/form/components/FormSections.js +1 -1
  83. package/dist/form/components/FormSections.js.map +1 -1
  84. package/dist/form/components/LabelWithIcon.js +5 -2
  85. package/dist/form/components/LabelWithIcon.js.map +1 -1
  86. package/dist/form/field_bindings/DateTimeFieldBinding.js +2 -1
  87. package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -1
  88. package/dist/form/field_bindings/ReadOnlyFieldBinding.js +28 -1
  89. package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
  90. package/dist/form/field_bindings/RelationFieldBinding.js +7 -3
  91. package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
  92. package/dist/form/field_bindings/SelectFieldBinding.js +63 -42
  93. package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -1
  94. package/dist/form/field_bindings/SwitchFieldBinding.js +2 -1
  95. package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -1
  96. package/dist/form/field_bindings/TextFieldBinding.js +8 -6
  97. package/dist/form/field_bindings/TextFieldBinding.js.map +1 -1
  98. package/dist/form/form_utils.d.ts +18 -1
  99. package/dist/form/form_utils.js +38 -2
  100. package/dist/form/form_utils.js.map +1 -1
  101. package/dist/form/index.d.ts +1 -1
  102. package/dist/form/label_placement.d.ts +23 -0
  103. package/dist/form/label_placement.js +71 -0
  104. package/dist/form/label_placement.js.map +1 -0
  105. package/dist/form/resolve_form_properties.d.ts +35 -3
  106. package/dist/form/resolve_form_properties.js +67 -6
  107. package/dist/form/resolve_form_properties.js.map +1 -1
  108. package/dist/hooks/useHistory.d.ts +5 -0
  109. package/dist/hooks/useHistory.js +22 -6
  110. package/dist/hooks/useHistory.js.map +1 -1
  111. package/dist/index.d.ts +50 -0
  112. package/dist/index.js +34 -7
  113. package/dist/preview/components/ReferencePreview.js +1 -1
  114. package/dist/preview/components/ReferencePreview.js.map +1 -1
  115. package/dist/preview/components/RelationPreview.js +1 -1
  116. package/dist/preview/components/RelationPreview.js.map +1 -1
  117. package/dist/types/components/EntityFormProps.d.ts +11 -0
  118. package/package.json +11 -10
  119. package/recipes/README.md +131 -0
  120. package/recipes/bulk-set-status.tsx +62 -0
  121. package/recipes/calendar-view.tsx +123 -0
  122. package/recipes/custom-login.tsx +60 -0
  123. package/recipes/my-preferences.tsx +68 -0
  124. package/recipes/orders-dashboard.tsx +125 -0
  125. package/recipes/site-settings.tsx +63 -0
@@ -1 +1 @@
1
- {"version":3,"file":"HomePageDnD.js","names":[],"sources":["../../../src/components/HomePage/HomePageDnD.tsx"],"sourcesContent":["import type { NavigationEntry } from \"@rebasepro/cms-types\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n Active,\n DraggableAttributes,\n Over,\n closestCenter,\n closestCorners,\n CollisionDetection,\n DropAnimation,\n getFirstCollision,\n KeyboardSensor,\n MouseSensor,\n pointerWithin,\n rectIntersection,\n TouchSensor,\n UniqueIdentifier,\n useDndMonitor,\n useDroppable,\n useSensor,\n useSensors\n} from \"@dnd-kit/core\";\nimport {\n AnimateLayoutChanges,\n arrayMove,\n defaultAnimateLayoutChanges,\n rectSortingStrategy,\n SortableContext,\n useSortable\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\n\nimport { NavigationCardBinding } from \"./NavigationCardBinding\";\n;\nimport { cls } from \"@rebasepro/ui\";\n\nconst animateLayoutChanges: AnimateLayoutChanges = (args) =>\n defaultAnimateLayoutChanges({\n ...args,\n wasDragging: true\n });\n\nconst dropAnimationConfig: DropAnimation = {};\n\nconst cloneSerializableNavigationEntry = (entry: NavigationEntry): NavigationEntry => {\n const clonedEntry: Partial<NavigationEntry> = {\n id: entry.id,\n slug: entry.slug,\n url: entry.url,\n name: entry.name,\n type: entry.type,\n collection: entry.collection ? { ...entry.collection } : undefined,\n view: entry.view ? { ...entry.view } : undefined,\n ...(entry.group && { group: entry.group }),\n ...(entry.description && { description: entry.description })\n };\n return clonedEntry as NavigationEntry;\n};\n\nconst cloneItemsForDnd = (items: { name: string; entries: NavigationEntry[] }[]) =>\n items.map((g) => ({\n name: g.name,\n entries: g.entries.map(cloneSerializableNavigationEntry)\n }));\n\n/* ─────────────────────────────────────────────────────────── */\n/* Sortable card & group */\n\n/* ─────────────────────────────────────────────────────────── */\n\n/**\n * dnd-kit's `attributes`, minus the `role` it assumes.\n *\n * The wrapper these land on contains a `<Link>` and the card's own action\n * buttons, and dnd-kit's `role: \"button\"` therefore declared a button\n * containing a link containing more buttons. Measured on a scaffold's home\n * page: 17 focusables for 5 destinations, 13 of the 17 `[role=button]` nested\n * inside another — which is what a screen reader has to read through before it\n * reaches the collection you wanted.\n *\n * The rest is kept, and it is the part that carries meaning:\n * `aria-roledescription=\"sortable\"`, the instructions dnd-kit points\n * `aria-describedby` at, and the `tabIndex` its keyboard sensor needs — drag\n * still works from the keyboard.\n *\n * A dedicated drag handle is the better answer and the one dnd-kit documents;\n * it needs a control designed into the card, which is a visual change and not\n * this one.\n */\nfunction draggableAttributes(attributes: DraggableAttributes): Omit<DraggableAttributes, \"role\"> {\n const { role: _role, ...rest } = attributes;\n return rest;\n}\nexport function SortableNavigationCard({\n entry,\n onClick\n}: {\n entry: NavigationEntry;\n onClick?: () => void;\n}) {\n const {\n setNodeRef,\n listeners,\n attributes,\n transform,\n transition,\n isDragging\n } =\n useSortable({\n id: entry.url,\n animateLayoutChanges\n });\n\n const style = {\n transform: transform ? CSS.Transform.toString(transform) : undefined,\n transition,\n opacity: isDragging ? 0 : 1\n };\n\n return (\n <div ref={setNodeRef} style={style} {...draggableAttributes(attributes)} {...listeners}>\n <NavigationCardBinding {...entry} onClick={onClick}/>\n </div>\n );\n}\n\nexport function NavigationGroupDroppable({\n id,\n itemIds,\n children,\n isPotentialCardDropTarget = false\n}: {\n id: UniqueIdentifier;\n itemIds: UniqueIdentifier[];\n children: React.ReactNode;\n isPotentialCardDropTarget?: boolean;\n}) {\n const { setNodeRef } = useDroppable({ id });\n\n return (\n <div\n ref={setNodeRef}\n className={cls(\n isPotentialCardDropTarget\n ? \"p-2 bg-surface-raised rounded-lg\"\n : undefined,\n \"transition-all duration-200 ease-in-out\"\n )}\n >\n <SortableContext items={itemIds} strategy={rectSortingStrategy}>\n {children}\n </SortableContext>\n </div>\n );\n}\n\nexport function SortableNavigationGroup({\n groupName,\n children,\n disabled\n}: {\n groupName: string;\n children: React.ReactNode;\n disabled?: boolean;\n}) {\n const {\n attributes,\n listeners,\n setNodeRef,\n transform,\n transition,\n isDragging\n } =\n useSortable({\n id: groupName,\n animateLayoutChanges,\n disabled\n });\n\n const style = {\n transform: transform ? CSS.Transform.toString(transform) : undefined,\n transition,\n opacity: isDragging ? 0 : 1\n };\n\n return (\n <div ref={setNodeRef} style={style} {...draggableAttributes(attributes)} {...listeners}>\n {children}\n </div>\n );\n}\n\nexport function useHomePageDnd({\n items,\n setItems,\n disabled,\n onCardMovedBetweenGroups,\n onGroupMoved,\n onNewGroupDrop,\n onPersist\n}: {\n items: { name: string; entries: NavigationEntry[] }[];\n setItems: (\n newItemsOrUpdater:\n | { name: string; entries: NavigationEntry[] }[]\n | ((\n currentItems: { name: string; entries: NavigationEntry[] }[]\n ) => { name: string; entries: NavigationEntry[] }[])\n ) => void;\n disabled: boolean;\n onCardMovedBetweenGroups?: (card: NavigationEntry) => void;\n onGroupMoved?: (groupName: string, oldIndex: number, newIndex: number) => void;\n onNewGroupDrop?: () => void;\n onPersist?: (latest: { name: string; entries: NavigationEntry[] }[]) => void;\n}) {\n /* ---------------- local state ---------------- */\n const dndItems = items;\n const setDndItems = setItems;\n\n const [activeId, setActiveId] = useState<UniqueIdentifier | null>(null);\n const [activeIsGroup, setActiveIsGroup] = useState(false);\n const [currentDraggingGroupId, setCurrentDraggingGroupId] =\n useState<UniqueIdentifier | null>(null);\n const [dndKitActiveNode, setDndKitActiveNode] = useState<Active | null>(null);\n const [isDraggingCardOnly, setIsDraggingCardOnly] = useState(false);\n const [dialogOpenForGroup, setDialogOpenForGroup] = useState<string | null>(null);\n const [isHoveringNewGroupDropZone, setIsHoveringNewGroupDropZone] =\n useState(false);\n const [pendingNewGroupName, setPendingNewGroupName] = useState<string | null>(null);\n const [stateBeforeNewGroup, setStateBeforeNewGroup] = useState<\n { name: string; entries: NavigationEntry[] }[] | null\n >(null);\n\n /* store the original state before any drag modifications */\n const preDragItemsRef = useRef<\n { name: string; entries: NavigationEntry[] }[] | null\n >(null);\n\n /* store interim state for cross-group moves */\n const interimItemsRef = useRef<\n { name: string; entries: NavigationEntry[] }[] | null\n >(null);\n useEffect(() => {\n interimItemsRef.current = dndItems;\n }, [dndItems]);\n\n /* ---------------- sensors ---------------- */\n const mouseSensor = useSensor(MouseSensor, { activationConstraint: { distance: 10 } });\n const touchSensor = useSensor(TouchSensor, {\n activationConstraint: {\n delay: 150,\n tolerance: 5\n }\n });\n const keyboardSensor = useSensor(KeyboardSensor);\n const sensors = useSensors(mouseSensor, touchSensor, keyboardSensor);\n\n /* ---------------- helpers ---------------- */\n const dndContainers = dndItems.map((g) => g.name);\n\n const findDndContainer = useCallback(\n (id: UniqueIdentifier): string | undefined => {\n if (!id) return undefined;\n const group = dndItems.find((g) => g.name === id);\n if (group) return group.name;\n for (const g of dndItems) {\n if (g.entries.some((e) => e.url === id)) return g.name;\n }\n return undefined;\n },\n [dndItems]\n );\n\n /* ---------------- collision detection ---------------- */\n const lastOverId = useRef<UniqueIdentifier | null>(null);\n const recentlyMovedToNewContainer = useRef(false);\n\n const collisionDetection: CollisionDetection = useCallback(\n (args) => {\n if (disabled || !activeId) return [];\n if (activeIsGroup) {\n const groups = args.droppableContainers.filter((c) =>\n dndItems.some((g) => g.name === c.id)\n );\n if (!groups.length) return [];\n return closestCenter({\n ...args,\n droppableContainers: groups\n });\n }\n\n const pointer = pointerWithin(args);\n if (pointer.length) {\n const zone = pointer.find((c) => c.id === \"new-group-drop-zone\");\n if (zone) return [zone];\n\n const container = pointer.find((c) =>\n dndItems.some((g) => g.name === c.id)\n );\n if (container) {\n const itemsIn = dndItems.find((g) => g.name === container.id)\n ?.entries;\n if (itemsIn?.length) {\n const closest = closestCorners({\n ...args,\n droppableContainers: args.droppableContainers.filter(\n (c) => itemsIn.some((e) => e.url === c.id)\n )\n });\n if (closest.length) return closest;\n }\n return [container];\n }\n const first = getFirstCollision(pointer, \"id\");\n if (first) return [{ id: first }];\n }\n\n const rects = rectIntersection(args);\n const zoneRect = rects.find((c) => c.id === \"new-group-drop-zone\");\n if (zoneRect) return [zoneRect];\n\n let overId = getFirstCollision(rects, \"id\");\n if (overId != null) {\n const overIsContainer = dndItems.some((g) => g.name === overId);\n if (overIsContainer) {\n const itemsIn = dndItems.find((g) => g.name === overId)\n ?.entries;\n if (itemsIn?.length) {\n const closestItem = closestCorners({\n ...args,\n droppableContainers: args.droppableContainers.filter(\n (c) => itemsIn.some((e) => e.url === c.id)\n )\n })[0]?.id;\n if (closestItem) overId = closestItem;\n }\n }\n lastOverId.current = overId;\n return [{ id: overId }];\n }\n\n if (\n recentlyMovedToNewContainer.current &&\n lastOverId.current &&\n !activeIsGroup\n )\n return [{ id: lastOverId.current }];\n\n return [];\n },\n [activeId, dndItems, disabled, activeIsGroup]\n );\n\n /* ---------------- drag handlers ---------------- */\n const handleDragStart = ({ active }: { active: Active }) => {\n setDndKitActiveNode(active);\n if (disabled) return;\n\n // Capture the original state before any drag modifications\n preDragItemsRef.current = cloneItemsForDnd(dndItems);\n\n const isGroup = dndItems.some((g) => g.name === active.id);\n if (!active.data.current) active.data.current = {};\n active.data.current.type = isGroup ? \"group\" : \"item\";\n\n setActiveId(active.id);\n setActiveIsGroup(isGroup);\n setIsDraggingCardOnly(!isGroup);\n if (isGroup) setCurrentDraggingGroupId(active.id);\n recentlyMovedToNewContainer.current = false;\n };\n\n const handleDragOver = ({\n active,\n over\n }: { active: Active; over: Over | null }) => {\n if (disabled || !over) return;\n\n const activeIdNow = active.id;\n const overIdNow = over.id;\n if (activeIdNow === overIdNow) return;\n if (activeIsGroup) return;\n\n const activeCont = findDndContainer(activeIdNow);\n const overCont = findDndContainer(overIdNow);\n if (!activeCont) return;\n\n if (overCont && activeCont !== overCont) {\n recentlyMovedToNewContainer.current = true;\n lastOverId.current = overIdNow;\n\n // Update state for visual feedback during drag\n setDndItems((current) => {\n const newState = cloneItemsForDnd(current);\n const srcIdx = newState.findIndex((g) => g.name === activeCont);\n const tgtIdx = newState.findIndex((g) => g.name === overCont);\n if (srcIdx === -1 || tgtIdx === -1) return current;\n const src = newState[srcIdx];\n const tgt = newState[tgtIdx];\n const idxInSrc = src.entries.findIndex((e) => e.url === activeIdNow);\n if (idxInSrc === -1) return current;\n const [moved] = src.entries.splice(idxInSrc, 1);\n\n // Calculate insertion position - SAME logic as handleDragEnd\n const overIsContainer = overIdNow === overCont;\n if (overIsContainer) {\n tgt.entries.push(moved);\n } else {\n const overIdx = tgt.entries.findIndex((e) => e.url === overIdNow);\n if (overIdx !== -1) {\n tgt.entries.splice(overIdx, 0, moved);\n } else {\n tgt.entries.push(moved);\n }\n }\n\n return newState;\n });\n } else if (activeCont === overCont) {\n recentlyMovedToNewContainer.current = false;\n }\n };\n\n const handleDragEnd = ({\n active,\n over\n }: { active: Active; over: Over | null }) => {\n if (disabled || !over) {\n resetDragState();\n return;\n }\n\n const activeIdNow = active.id;\n const overIdNow = over.id;\n\n /* ─── group reorder ─── */\n if (activeIsGroup) {\n if (\n activeIdNow !== overIdNow &&\n dndItems.some((g) => g.name === overIdNow)\n ) {\n const from = dndItems.findIndex((g) => g.name === activeIdNow);\n const to = dndItems.findIndex((g) => g.name === overIdNow);\n if (from !== -1 && to !== -1) {\n const newState = arrayMove(dndItems, from, to);\n setDndItems(newState);\n onPersist?.(newState);\n onGroupMoved?.(activeIdNow as string, from, to);\n }\n }\n }\n /* ─── card move ─── */\n else {\n // CRITICAL: Find source container from ORIGINAL pre-drag state, not current (potentially stale) dndItems\n const findContainerInState = (id: string, state: { name: string; entries: NavigationEntry[] }[]): string | undefined => {\n const group = state.find((g) => g.name === id);\n if (group) return group.name;\n for (const g of state) {\n if (g.entries.some((e) => e.url === id)) return g.name;\n }\n return undefined;\n };\n\n const sourceState = preDragItemsRef.current || dndItems;\n const activeCont = findContainerInState(activeIdNow as string, sourceState);\n const overCont = findDndContainer(overIdNow);\n\n /* drop on new-group zone */\n if (overIdNow === \"new-group-drop-zone\") {\n if (activeCont) {\n // Save current state before making changes\n setStateBeforeNewGroup(cloneItemsForDnd(dndItems));\n\n const newState = cloneItemsForDnd(dndItems);\n const srcIdx = newState.findIndex((g) => g.name === activeCont);\n if (srcIdx !== -1) {\n const src = newState[srcIdx];\n const idxInSrc = src.entries.findIndex(\n (e) => e.url === activeIdNow\n );\n if (idxInSrc !== -1) {\n const [dragged] = src.entries.splice(idxInSrc, 1);\n if (src.entries.length === 0) newState.splice(srcIdx, 1);\n\n let tentative = \"New Group\";\n let counter = 1;\n while (newState.some((g) => g.name === tentative))\n tentative = `New Group ${counter++}`;\n\n newState.push({\n name: tentative,\n entries: [dragged]\n });\n\n // Update local state but DON'T persist yet\n setDndItems(newState);\n setPendingNewGroupName(tentative);\n setDialogOpenForGroup(tentative);\n onNewGroupDrop?.();\n }\n }\n }\n }\n /* reorder inside same container */\n else {\n const overCont = findDndContainer(overIdNow);\n if (activeCont === overCont) {\n const grpIdx = dndItems.findIndex((g) => g.name === activeCont);\n if (grpIdx !== -1) {\n const group = dndItems[grpIdx];\n const oldIdx = group.entries.findIndex(\n (e) => e.url === activeIdNow\n );\n let newIdx = group.entries.findIndex(\n (e) => e.url === overIdNow\n );\n if (newIdx === -1 && overIdNow === activeCont)\n newIdx = group.entries.length - 1;\n if (\n oldIdx !== -1 &&\n newIdx !== -1 &&\n oldIdx !== newIdx\n ) {\n const reordered = arrayMove(group.entries, oldIdx, newIdx);\n const newState = [...dndItems];\n newState[grpIdx] = {\n ...group,\n entries: reordered\n };\n setDndItems(newState);\n onPersist?.(newState);\n }\n }\n } else if (overCont && activeCont !== overCont) {\n // Card moved between different groups - use CLEAN pre-drag state\n const finalState = cloneItemsForDnd(sourceState);\n\n // Find target container from clean state too\n const finalOverId = lastOverId.current || overIdNow;\n const cleanOverCont = findContainerInState(finalOverId as string, sourceState) || overCont;\n\n const srcIdx = finalState.findIndex((g) => g.name === activeCont);\n const tgtIdx = finalState.findIndex((g) => g.name === cleanOverCont);\n\n if (srcIdx !== -1 && tgtIdx !== -1) {\n const src = finalState[srcIdx];\n const tgt = finalState[tgtIdx];\n const idxInSrc = src.entries.findIndex((e) => e.url === activeIdNow);\n\n if (idxInSrc !== -1) {\n // Remove from source\n const [moved] = src.entries.splice(idxInSrc, 1);\n\n // Calculate insertion position in target\n const overIsContainer = finalOverId === cleanOverCont;\n if (overIsContainer) {\n tgt.entries.push(moved);\n } else {\n const overIdx = tgt.entries.findIndex((e) => e.url === finalOverId);\n if (overIdx !== -1) {\n tgt.entries.splice(overIdx, 0, moved);\n } else {\n tgt.entries.push(moved);\n }\n }\n\n // Remove empty source group if needed\n if (src.entries.length === 0) {\n finalState.splice(srcIdx, 1);\n }\n\n setDndItems(finalState);\n onPersist?.(finalState);\n\n onCardMovedBetweenGroups?.(moved);\n }\n }\n } else if (recentlyMovedToNewContainer.current) {\n // This shouldn't happen but log it for debugging\n console.error(\"Move between containers detected but conditions not met\", {\n activeCont,\n overCont,\n activeIdNow,\n overIdNow\n });\n }\n }\n }\n\n resetDragState();\n };\n\n const resetDragState = () => {\n setDndKitActiveNode(null);\n setActiveId(null);\n setActiveIsGroup(false);\n setCurrentDraggingGroupId(null);\n setIsDraggingCardOnly(false);\n recentlyMovedToNewContainer.current = false;\n };\n\n const handleDragCancel = () => resetDragState();\n\n /* ---------------- group rename ---------------- */\n const handleRenameGroup = (oldName: string, newName: string) => {\n setDndItems((current) => {\n const idx = current.findIndex((g) => g.name === oldName);\n if (idx === -1) return current;\n if (current.some((g) => g.name === newName && g.name !== oldName))\n return current;\n\n const updated = [...current];\n updated[idx] = {\n ...updated[idx],\n name: newName\n };\n\n // Persist after successful rename\n onPersist?.(updated);\n return updated;\n });\n\n // Clear all pending state\n setPendingNewGroupName(null);\n setStateBeforeNewGroup(null);\n setDialogOpenForGroup(null);\n };\n\n /* Handle dialog close without renaming */\n const handleDialogClose = () => {\n // If there's a pending new group that wasn't renamed, restore previous state\n if (pendingNewGroupName && dialogOpenForGroup === pendingNewGroupName && stateBeforeNewGroup) {\n // Restore the state from before the new group was created\n setDndItems(stateBeforeNewGroup);\n }\n\n // Clear all pending state\n setPendingNewGroupName(null);\n setStateBeforeNewGroup(null);\n setDialogOpenForGroup(null);\n };\n\n /* ---------------- public API ---------------- */\n const activeItemForOverlay =\n disabled || !activeId || activeIsGroup\n ? null\n : dndItems.flatMap((g) => g.entries).find((e) => e.url === activeId) || null;\n\n const activeGroupData =\n disabled || !activeId || !activeIsGroup\n ? null\n : dndItems.find((g) => g.name === activeId) || null;\n\n return {\n sensors,\n collisionDetection,\n onDragStart: handleDragStart,\n onDragOver: handleDragOver,\n onDragEnd: handleDragEnd,\n onDragCancel: handleDragCancel,\n dropAnimation: dropAnimationConfig,\n activeItemForOverlay,\n activeGroupData,\n draggingGroupId: currentDraggingGroupId,\n containers: dndContainers,\n dndKitActiveNode,\n isDraggingCardOnly,\n dialogOpenForGroup,\n setDialogOpenForGroup,\n handleRenameGroup,\n handleDialogClose,\n isHoveringNewGroupDropZone,\n setIsHoveringNewGroupDropZone\n };\n}\n\nexport function NewGroupDropZone({\n disabled,\n setIsHovering\n}: {\n disabled: boolean;\n setIsHovering: (v: boolean) => void;\n}) {\n const {\n setNodeRef,\n isOver\n } = useDroppable({\n id: \"new-group-drop-zone\",\n disabled\n });\n const [isVisible, setIsVisible] = useState(false);\n\n useDndMonitor({\n onDragStart({ active }) {\n if (disabled) return;\n const tp = active.data.current?.type;\n setIsVisible(tp === \"item\");\n },\n onDragEnd() {\n setIsVisible(false);\n },\n onDragCancel() {\n setIsVisible(false);\n }\n });\n\n useEffect(() => {\n setIsHovering(isOver && isVisible);\n }, [isOver, isVisible, setIsHovering]);\n\n if (!isVisible || disabled) return null;\n\n return (\n <div\n ref={setNodeRef}\n className={cls(\n \"fixed right-8 top-1/2 -translate-y-1/2 w-[200px] h-[120px] border border-dashed rounded-lg flex items-center justify-center transition-all\",\n isOver\n ? \"bg-surface-raised border-hairline-strong\"\n : \"bg-surface-card border-hairline-strong\"\n )}>\n <div className=\"text-center p-4\">\n <span className=\"block font-medium text-sm\">\n Drop here to create a new group\n </span>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAoCA,IAAM,wBAA8C,SAChD,4BAA4B;CACxB,GAAG;CACH,aAAa;AACjB,CAAC;AAEL,IAAM,sBAAqC,CAAC;AAE5C,IAAM,oCAAoC,UAA4C;CAYlF,OAAO;EAVH,IAAI,MAAM;EACV,MAAM,MAAM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,YAAY,CAAC,YAAY,CAAC,gBACpB,OACA,SAAS,MAAM,MAAM,EAAE,SAAS,QAAQ,KAAK;EAYnD,iBAAiB;EACjB,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACJ;AACJ;AAEA,SAAgB,iBAAiB,EAC7B,UACA,iBAID;CACC,MAAM,EACF,YACA,WACA,aAAa;EACb,IAAI;EACJ;CACJ,CAAC;CACD,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;CAEhD,cAAc;EACV,YAAY,EAAE,UAAU;GACpB,IAAI,UAAU;GACd,MAAM,KAAK,OAAO,KAAK,SAAS;GAChC,aAAa,OAAO,MAAM;EAC9B;EACA,YAAY;GACR,aAAa,KAAK;EACtB;EACA,eAAe;GACX,aAAa,KAAK;EACtB;CACJ,CAAC;CAED,gBAAgB;EACZ,cAAc,UAAU,SAAS;CACrC,GAAG;EAAC;EAAQ;EAAW;CAAa,CAAC;CAErC,IAAI,CAAC,aAAa,UAAU,OAAO;CAEnC,OACI,oBAAC,OAAD;EACI,KAAK;EACL,WAAW,IACP,8IACA,SACM,6CACA,wCACV;YACA,oBAAC,OAAD;GAAK,WAAU;aACX,oBAAC,QAAD;IAAM,WAAU;cAA4B;GAEtC,CAAA;EACL,CAAA;CACJ,CAAA;AAEb"}
1
+ {"version":3,"file":"HomePageDnD.js","names":[],"sources":["../../../src/components/HomePage/HomePageDnD.tsx"],"sourcesContent":["import type { NavigationEntry } from \"@rebasepro/cms-types\";\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport {\n Active,\n DraggableAttributes,\n Over,\n closestCenter,\n closestCorners,\n CollisionDetection,\n DropAnimation,\n getFirstCollision,\n KeyboardSensor,\n MouseSensor,\n pointerWithin,\n rectIntersection,\n TouchSensor,\n UniqueIdentifier,\n useDndMonitor,\n useDroppable,\n useSensor,\n useSensors\n} from \"@dnd-kit/core\";\nimport {\n AnimateLayoutChanges,\n arrayMove,\n defaultAnimateLayoutChanges,\n rectSortingStrategy,\n SortableContext,\n useSortable\n} from \"@dnd-kit/sortable\";\nimport { CSS } from \"@dnd-kit/utilities\";\n\nimport { NavigationCardBinding } from \"./NavigationCardBinding\";\nimport { useComponentOverride } from \"@rebasepro/app\";\n;\nimport { cls } from \"@rebasepro/ui\";\n\nconst animateLayoutChanges: AnimateLayoutChanges = (args) =>\n defaultAnimateLayoutChanges({\n ...args,\n wasDragging: true\n });\n\nconst dropAnimationConfig: DropAnimation = {};\n\nconst cloneSerializableNavigationEntry = (entry: NavigationEntry): NavigationEntry => {\n const clonedEntry: Partial<NavigationEntry> = {\n id: entry.id,\n slug: entry.slug,\n url: entry.url,\n name: entry.name,\n type: entry.type,\n collection: entry.collection ? { ...entry.collection } : undefined,\n view: entry.view ? { ...entry.view } : undefined,\n ...(entry.group && { group: entry.group }),\n ...(entry.description && { description: entry.description })\n };\n return clonedEntry as NavigationEntry;\n};\n\nconst cloneItemsForDnd = (items: { name: string; entries: NavigationEntry[] }[]) =>\n items.map((g) => ({\n name: g.name,\n entries: g.entries.map(cloneSerializableNavigationEntry)\n }));\n\n/* ─────────────────────────────────────────────────────────── */\n/* Sortable card & group */\n\n/* ─────────────────────────────────────────────────────────── */\n\n/**\n * dnd-kit's `attributes`, minus the `role` it assumes.\n *\n * The wrapper these land on contains a `<Link>` and the card's own action\n * buttons, and dnd-kit's `role: \"button\"` therefore declared a button\n * containing a link containing more buttons. Measured on a scaffold's home\n * page: 17 focusables for 5 destinations, 13 of the 17 `[role=button]` nested\n * inside another — which is what a screen reader has to read through before it\n * reaches the collection you wanted.\n *\n * The rest is kept, and it is the part that carries meaning:\n * `aria-roledescription=\"sortable\"`, the instructions dnd-kit points\n * `aria-describedby` at, and the `tabIndex` its keyboard sensor needs — drag\n * still works from the keyboard.\n *\n * A dedicated drag handle is the better answer and the one dnd-kit documents;\n * it needs a control designed into the card, which is a visual change and not\n * this one.\n */\nfunction draggableAttributes(attributes: DraggableAttributes): Omit<DraggableAttributes, \"role\"> {\n const { role: _role, ...rest } = attributes;\n return rest;\n}\nexport function SortableNavigationCard({\n entry,\n onClick\n}: {\n entry: NavigationEntry;\n onClick?: () => void;\n}) {\n const {\n setNodeRef,\n listeners,\n attributes,\n transform,\n transition,\n isDragging\n } =\n useSortable({\n id: entry.url,\n animateLayoutChanges\n });\n\n const ResolvedCollectionCard = useComponentOverride(\"HomePage.CollectionCard\", NavigationCardBinding);\n\n const style = {\n transform: transform ? CSS.Transform.toString(transform) : undefined,\n transition,\n opacity: isDragging ? 0 : 1\n };\n\n return (\n <div ref={setNodeRef} style={style} {...draggableAttributes(attributes)} {...listeners}>\n <ResolvedCollectionCard {...entry} onClick={onClick}/>\n </div>\n );\n}\n\nexport function NavigationGroupDroppable({\n id,\n itemIds,\n children,\n isPotentialCardDropTarget = false\n}: {\n id: UniqueIdentifier;\n itemIds: UniqueIdentifier[];\n children: React.ReactNode;\n isPotentialCardDropTarget?: boolean;\n}) {\n const { setNodeRef } = useDroppable({ id });\n\n return (\n <div\n ref={setNodeRef}\n className={cls(\n isPotentialCardDropTarget\n ? \"p-2 bg-surface-raised rounded-lg\"\n : undefined,\n \"transition-all duration-200 ease-in-out\"\n )}\n >\n <SortableContext items={itemIds} strategy={rectSortingStrategy}>\n {children}\n </SortableContext>\n </div>\n );\n}\n\nexport function SortableNavigationGroup({\n groupName,\n children,\n disabled\n}: {\n groupName: string;\n children: React.ReactNode;\n disabled?: boolean;\n}) {\n const {\n attributes,\n listeners,\n setNodeRef,\n transform,\n transition,\n isDragging\n } =\n useSortable({\n id: groupName,\n animateLayoutChanges,\n disabled\n });\n\n const style = {\n transform: transform ? CSS.Transform.toString(transform) : undefined,\n transition,\n opacity: isDragging ? 0 : 1\n };\n\n return (\n <div ref={setNodeRef} style={style} {...draggableAttributes(attributes)} {...listeners}>\n {children}\n </div>\n );\n}\n\nexport function useHomePageDnd({\n items,\n setItems,\n disabled,\n onCardMovedBetweenGroups,\n onGroupMoved,\n onNewGroupDrop,\n onPersist\n}: {\n items: { name: string; entries: NavigationEntry[] }[];\n setItems: (\n newItemsOrUpdater:\n | { name: string; entries: NavigationEntry[] }[]\n | ((\n currentItems: { name: string; entries: NavigationEntry[] }[]\n ) => { name: string; entries: NavigationEntry[] }[])\n ) => void;\n disabled: boolean;\n onCardMovedBetweenGroups?: (card: NavigationEntry) => void;\n onGroupMoved?: (groupName: string, oldIndex: number, newIndex: number) => void;\n onNewGroupDrop?: () => void;\n onPersist?: (latest: { name: string; entries: NavigationEntry[] }[]) => void;\n}) {\n /* ---------------- local state ---------------- */\n const dndItems = items;\n const setDndItems = setItems;\n\n const [activeId, setActiveId] = useState<UniqueIdentifier | null>(null);\n const [activeIsGroup, setActiveIsGroup] = useState(false);\n const [currentDraggingGroupId, setCurrentDraggingGroupId] =\n useState<UniqueIdentifier | null>(null);\n const [dndKitActiveNode, setDndKitActiveNode] = useState<Active | null>(null);\n const [isDraggingCardOnly, setIsDraggingCardOnly] = useState(false);\n const [dialogOpenForGroup, setDialogOpenForGroup] = useState<string | null>(null);\n const [isHoveringNewGroupDropZone, setIsHoveringNewGroupDropZone] =\n useState(false);\n const [pendingNewGroupName, setPendingNewGroupName] = useState<string | null>(null);\n const [stateBeforeNewGroup, setStateBeforeNewGroup] = useState<\n { name: string; entries: NavigationEntry[] }[] | null\n >(null);\n\n /* store the original state before any drag modifications */\n const preDragItemsRef = useRef<\n { name: string; entries: NavigationEntry[] }[] | null\n >(null);\n\n /* store interim state for cross-group moves */\n const interimItemsRef = useRef<\n { name: string; entries: NavigationEntry[] }[] | null\n >(null);\n useEffect(() => {\n interimItemsRef.current = dndItems;\n }, [dndItems]);\n\n /* ---------------- sensors ---------------- */\n const mouseSensor = useSensor(MouseSensor, { activationConstraint: { distance: 10 } });\n const touchSensor = useSensor(TouchSensor, {\n activationConstraint: {\n delay: 150,\n tolerance: 5\n }\n });\n const keyboardSensor = useSensor(KeyboardSensor);\n const sensors = useSensors(mouseSensor, touchSensor, keyboardSensor);\n\n /* ---------------- helpers ---------------- */\n const dndContainers = dndItems.map((g) => g.name);\n\n const findDndContainer = useCallback(\n (id: UniqueIdentifier): string | undefined => {\n if (!id) return undefined;\n const group = dndItems.find((g) => g.name === id);\n if (group) return group.name;\n for (const g of dndItems) {\n if (g.entries.some((e) => e.url === id)) return g.name;\n }\n return undefined;\n },\n [dndItems]\n );\n\n /* ---------------- collision detection ---------------- */\n const lastOverId = useRef<UniqueIdentifier | null>(null);\n const recentlyMovedToNewContainer = useRef(false);\n\n const collisionDetection: CollisionDetection = useCallback(\n (args) => {\n if (disabled || !activeId) return [];\n if (activeIsGroup) {\n const groups = args.droppableContainers.filter((c) =>\n dndItems.some((g) => g.name === c.id)\n );\n if (!groups.length) return [];\n return closestCenter({\n ...args,\n droppableContainers: groups\n });\n }\n\n const pointer = pointerWithin(args);\n if (pointer.length) {\n const zone = pointer.find((c) => c.id === \"new-group-drop-zone\");\n if (zone) return [zone];\n\n const container = pointer.find((c) =>\n dndItems.some((g) => g.name === c.id)\n );\n if (container) {\n const itemsIn = dndItems.find((g) => g.name === container.id)\n ?.entries;\n if (itemsIn?.length) {\n const closest = closestCorners({\n ...args,\n droppableContainers: args.droppableContainers.filter(\n (c) => itemsIn.some((e) => e.url === c.id)\n )\n });\n if (closest.length) return closest;\n }\n return [container];\n }\n const first = getFirstCollision(pointer, \"id\");\n if (first) return [{ id: first }];\n }\n\n const rects = rectIntersection(args);\n const zoneRect = rects.find((c) => c.id === \"new-group-drop-zone\");\n if (zoneRect) return [zoneRect];\n\n let overId = getFirstCollision(rects, \"id\");\n if (overId != null) {\n const overIsContainer = dndItems.some((g) => g.name === overId);\n if (overIsContainer) {\n const itemsIn = dndItems.find((g) => g.name === overId)\n ?.entries;\n if (itemsIn?.length) {\n const closestItem = closestCorners({\n ...args,\n droppableContainers: args.droppableContainers.filter(\n (c) => itemsIn.some((e) => e.url === c.id)\n )\n })[0]?.id;\n if (closestItem) overId = closestItem;\n }\n }\n lastOverId.current = overId;\n return [{ id: overId }];\n }\n\n if (\n recentlyMovedToNewContainer.current &&\n lastOverId.current &&\n !activeIsGroup\n )\n return [{ id: lastOverId.current }];\n\n return [];\n },\n [activeId, dndItems, disabled, activeIsGroup]\n );\n\n /* ---------------- drag handlers ---------------- */\n const handleDragStart = ({ active }: { active: Active }) => {\n setDndKitActiveNode(active);\n if (disabled) return;\n\n // Capture the original state before any drag modifications\n preDragItemsRef.current = cloneItemsForDnd(dndItems);\n\n const isGroup = dndItems.some((g) => g.name === active.id);\n if (!active.data.current) active.data.current = {};\n active.data.current.type = isGroup ? \"group\" : \"item\";\n\n setActiveId(active.id);\n setActiveIsGroup(isGroup);\n setIsDraggingCardOnly(!isGroup);\n if (isGroup) setCurrentDraggingGroupId(active.id);\n recentlyMovedToNewContainer.current = false;\n };\n\n const handleDragOver = ({\n active,\n over\n }: { active: Active; over: Over | null }) => {\n if (disabled || !over) return;\n\n const activeIdNow = active.id;\n const overIdNow = over.id;\n if (activeIdNow === overIdNow) return;\n if (activeIsGroup) return;\n\n const activeCont = findDndContainer(activeIdNow);\n const overCont = findDndContainer(overIdNow);\n if (!activeCont) return;\n\n if (overCont && activeCont !== overCont) {\n recentlyMovedToNewContainer.current = true;\n lastOverId.current = overIdNow;\n\n // Update state for visual feedback during drag\n setDndItems((current) => {\n const newState = cloneItemsForDnd(current);\n const srcIdx = newState.findIndex((g) => g.name === activeCont);\n const tgtIdx = newState.findIndex((g) => g.name === overCont);\n if (srcIdx === -1 || tgtIdx === -1) return current;\n const src = newState[srcIdx];\n const tgt = newState[tgtIdx];\n const idxInSrc = src.entries.findIndex((e) => e.url === activeIdNow);\n if (idxInSrc === -1) return current;\n const [moved] = src.entries.splice(idxInSrc, 1);\n\n // Calculate insertion position - SAME logic as handleDragEnd\n const overIsContainer = overIdNow === overCont;\n if (overIsContainer) {\n tgt.entries.push(moved);\n } else {\n const overIdx = tgt.entries.findIndex((e) => e.url === overIdNow);\n if (overIdx !== -1) {\n tgt.entries.splice(overIdx, 0, moved);\n } else {\n tgt.entries.push(moved);\n }\n }\n\n return newState;\n });\n } else if (activeCont === overCont) {\n recentlyMovedToNewContainer.current = false;\n }\n };\n\n const handleDragEnd = ({\n active,\n over\n }: { active: Active; over: Over | null }) => {\n if (disabled || !over) {\n resetDragState();\n return;\n }\n\n const activeIdNow = active.id;\n const overIdNow = over.id;\n\n /* ─── group reorder ─── */\n if (activeIsGroup) {\n if (\n activeIdNow !== overIdNow &&\n dndItems.some((g) => g.name === overIdNow)\n ) {\n const from = dndItems.findIndex((g) => g.name === activeIdNow);\n const to = dndItems.findIndex((g) => g.name === overIdNow);\n if (from !== -1 && to !== -1) {\n const newState = arrayMove(dndItems, from, to);\n setDndItems(newState);\n onPersist?.(newState);\n onGroupMoved?.(activeIdNow as string, from, to);\n }\n }\n }\n /* ─── card move ─── */\n else {\n // CRITICAL: Find source container from ORIGINAL pre-drag state, not current (potentially stale) dndItems\n const findContainerInState = (id: string, state: { name: string; entries: NavigationEntry[] }[]): string | undefined => {\n const group = state.find((g) => g.name === id);\n if (group) return group.name;\n for (const g of state) {\n if (g.entries.some((e) => e.url === id)) return g.name;\n }\n return undefined;\n };\n\n const sourceState = preDragItemsRef.current || dndItems;\n const activeCont = findContainerInState(activeIdNow as string, sourceState);\n const overCont = findDndContainer(overIdNow);\n\n /* drop on new-group zone */\n if (overIdNow === \"new-group-drop-zone\") {\n if (activeCont) {\n // Save current state before making changes\n setStateBeforeNewGroup(cloneItemsForDnd(dndItems));\n\n const newState = cloneItemsForDnd(dndItems);\n const srcIdx = newState.findIndex((g) => g.name === activeCont);\n if (srcIdx !== -1) {\n const src = newState[srcIdx];\n const idxInSrc = src.entries.findIndex(\n (e) => e.url === activeIdNow\n );\n if (idxInSrc !== -1) {\n const [dragged] = src.entries.splice(idxInSrc, 1);\n if (src.entries.length === 0) newState.splice(srcIdx, 1);\n\n let tentative = \"New Group\";\n let counter = 1;\n while (newState.some((g) => g.name === tentative))\n tentative = `New Group ${counter++}`;\n\n newState.push({\n name: tentative,\n entries: [dragged]\n });\n\n // Update local state but DON'T persist yet\n setDndItems(newState);\n setPendingNewGroupName(tentative);\n setDialogOpenForGroup(tentative);\n onNewGroupDrop?.();\n }\n }\n }\n }\n /* reorder inside same container */\n else {\n const overCont = findDndContainer(overIdNow);\n if (activeCont === overCont) {\n const grpIdx = dndItems.findIndex((g) => g.name === activeCont);\n if (grpIdx !== -1) {\n const group = dndItems[grpIdx];\n const oldIdx = group.entries.findIndex(\n (e) => e.url === activeIdNow\n );\n let newIdx = group.entries.findIndex(\n (e) => e.url === overIdNow\n );\n if (newIdx === -1 && overIdNow === activeCont)\n newIdx = group.entries.length - 1;\n if (\n oldIdx !== -1 &&\n newIdx !== -1 &&\n oldIdx !== newIdx\n ) {\n const reordered = arrayMove(group.entries, oldIdx, newIdx);\n const newState = [...dndItems];\n newState[grpIdx] = {\n ...group,\n entries: reordered\n };\n setDndItems(newState);\n onPersist?.(newState);\n }\n }\n } else if (overCont && activeCont !== overCont) {\n // Card moved between different groups - use CLEAN pre-drag state\n const finalState = cloneItemsForDnd(sourceState);\n\n // Find target container from clean state too\n const finalOverId = lastOverId.current || overIdNow;\n const cleanOverCont = findContainerInState(finalOverId as string, sourceState) || overCont;\n\n const srcIdx = finalState.findIndex((g) => g.name === activeCont);\n const tgtIdx = finalState.findIndex((g) => g.name === cleanOverCont);\n\n if (srcIdx !== -1 && tgtIdx !== -1) {\n const src = finalState[srcIdx];\n const tgt = finalState[tgtIdx];\n const idxInSrc = src.entries.findIndex((e) => e.url === activeIdNow);\n\n if (idxInSrc !== -1) {\n // Remove from source\n const [moved] = src.entries.splice(idxInSrc, 1);\n\n // Calculate insertion position in target\n const overIsContainer = finalOverId === cleanOverCont;\n if (overIsContainer) {\n tgt.entries.push(moved);\n } else {\n const overIdx = tgt.entries.findIndex((e) => e.url === finalOverId);\n if (overIdx !== -1) {\n tgt.entries.splice(overIdx, 0, moved);\n } else {\n tgt.entries.push(moved);\n }\n }\n\n // Remove empty source group if needed\n if (src.entries.length === 0) {\n finalState.splice(srcIdx, 1);\n }\n\n setDndItems(finalState);\n onPersist?.(finalState);\n\n onCardMovedBetweenGroups?.(moved);\n }\n }\n } else if (recentlyMovedToNewContainer.current) {\n // This shouldn't happen but log it for debugging\n console.error(\"Move between containers detected but conditions not met\", {\n activeCont,\n overCont,\n activeIdNow,\n overIdNow\n });\n }\n }\n }\n\n resetDragState();\n };\n\n const resetDragState = () => {\n setDndKitActiveNode(null);\n setActiveId(null);\n setActiveIsGroup(false);\n setCurrentDraggingGroupId(null);\n setIsDraggingCardOnly(false);\n recentlyMovedToNewContainer.current = false;\n };\n\n const handleDragCancel = () => resetDragState();\n\n /* ---------------- group rename ---------------- */\n const handleRenameGroup = (oldName: string, newName: string) => {\n setDndItems((current) => {\n const idx = current.findIndex((g) => g.name === oldName);\n if (idx === -1) return current;\n if (current.some((g) => g.name === newName && g.name !== oldName))\n return current;\n\n const updated = [...current];\n updated[idx] = {\n ...updated[idx],\n name: newName\n };\n\n // Persist after successful rename\n onPersist?.(updated);\n return updated;\n });\n\n // Clear all pending state\n setPendingNewGroupName(null);\n setStateBeforeNewGroup(null);\n setDialogOpenForGroup(null);\n };\n\n /* Handle dialog close without renaming */\n const handleDialogClose = () => {\n // If there's a pending new group that wasn't renamed, restore previous state\n if (pendingNewGroupName && dialogOpenForGroup === pendingNewGroupName && stateBeforeNewGroup) {\n // Restore the state from before the new group was created\n setDndItems(stateBeforeNewGroup);\n }\n\n // Clear all pending state\n setPendingNewGroupName(null);\n setStateBeforeNewGroup(null);\n setDialogOpenForGroup(null);\n };\n\n /* ---------------- public API ---------------- */\n const activeItemForOverlay =\n disabled || !activeId || activeIsGroup\n ? null\n : dndItems.flatMap((g) => g.entries).find((e) => e.url === activeId) || null;\n\n const activeGroupData =\n disabled || !activeId || !activeIsGroup\n ? null\n : dndItems.find((g) => g.name === activeId) || null;\n\n return {\n sensors,\n collisionDetection,\n onDragStart: handleDragStart,\n onDragOver: handleDragOver,\n onDragEnd: handleDragEnd,\n onDragCancel: handleDragCancel,\n dropAnimation: dropAnimationConfig,\n activeItemForOverlay,\n activeGroupData,\n draggingGroupId: currentDraggingGroupId,\n containers: dndContainers,\n dndKitActiveNode,\n isDraggingCardOnly,\n dialogOpenForGroup,\n setDialogOpenForGroup,\n handleRenameGroup,\n handleDialogClose,\n isHoveringNewGroupDropZone,\n setIsHoveringNewGroupDropZone\n };\n}\n\nexport function NewGroupDropZone({\n disabled,\n setIsHovering\n}: {\n disabled: boolean;\n setIsHovering: (v: boolean) => void;\n}) {\n const {\n setNodeRef,\n isOver\n } = useDroppable({\n id: \"new-group-drop-zone\",\n disabled\n });\n const [isVisible, setIsVisible] = useState(false);\n\n useDndMonitor({\n onDragStart({ active }) {\n if (disabled) return;\n const tp = active.data.current?.type;\n setIsVisible(tp === \"item\");\n },\n onDragEnd() {\n setIsVisible(false);\n },\n onDragCancel() {\n setIsVisible(false);\n }\n });\n\n useEffect(() => {\n setIsHovering(isOver && isVisible);\n }, [isOver, isVisible, setIsHovering]);\n\n if (!isVisible || disabled) return null;\n\n return (\n <div\n ref={setNodeRef}\n className={cls(\n \"fixed right-8 top-1/2 -translate-y-1/2 w-[200px] h-[120px] border border-dashed rounded-lg flex items-center justify-center transition-all\",\n isOver\n ? \"bg-surface-raised border-hairline-strong\"\n : \"bg-surface-card border-hairline-strong\"\n )}>\n <div className=\"text-center p-4\">\n <span className=\"block font-medium text-sm\">\n Drop here to create a new group\n </span>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAqCA,IAAM,wBAA8C,SAChD,4BAA4B;CACxB,GAAG;CACH,aAAa;AACjB,CAAC;AAEL,IAAM,sBAAqC,CAAC;AAE5C,IAAM,oCAAoC,UAA4C;CAYlF,OAAO;EAVH,IAAI,MAAM;EACV,MAAM,MAAM;EACZ,KAAK,MAAM;EACX,MAAM,MAAM;EACZ,MAAM,MAAM;EACZ,YAAY,MAAM,aAAa,EAAE,GAAG,MAAM,WAAW,IAAI,KAAA;EACzD,MAAM,MAAM,OAAO,EAAE,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ACjB,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACJ;AACJ;AAEA,SAAgB,iBAAiB,EAC7B,UACA,iBAID;CACC,MAAM,EACF,YACA,WACA,aAAa;EACb,IAAI;EACJ;CACJ,CAAC;CACD,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;CAEhD,cAAc;EACV,YAAY,EAAE,UAAU;GACpB,IAAI,UAAU;GACd,MAAM,KAAK,OAAO,KAAK,SAAS;GAChC,aAAa,OAAO,MAAM;EAC9B;EACA,YAAY;GACR,aAAa,KAAK;EACtB;EACA,eAAe;GACX,aAAa,KAAK;EACtB;CACJ,CAAC;CAED,gBAAgB;EACZ,cAAc,UAAU,SAAS;CACrC,GAAG;EAAC;EAAQ;EAAW;CAAa,CAAC;CAErC,IAAI,CAAC,aAAa,UAAU,OAAO;CAEnC,OACI,oBAAC,OAAD;EACI,KAAK;EACL,WAAW,IACP,8IACA,SACM,6CACA,wCACV;YACA,oBAAC,OAAD;GAAK,WAAU;aACX,oBAAC,QAAD;IAAM,WAAU;cAA4B;GAEtC,CAAA;EACL,CAAA;CACJ,CAAA;AAEb"}
@@ -0,0 +1,25 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Typography, cardClickableMixin, cardMixin, cls } from "@rebasepro/ui";
3
+ import { Link } from "react-router";
4
+ //#region src/components/HomePage/SmallNavigationCard.tsx
5
+ function SmallNavigationCard({ name, url, icon }) {
6
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Link, {
7
+ tabIndex: 0,
8
+ className: cls(cardMixin, cardClickableMixin, "cursor-pointer flex flex-row items-center px-4 py-2 text-inherit dark:text-inherit visited:text-inherit dark:visited:text-inherit hover:text-inherit dark:hover:text-inherit "),
9
+ to: url,
10
+ children: /* @__PURE__ */ jsxs("div", {
11
+ className: "flex flex-row items-center grow gap-2 ",
12
+ children: [icon, /* @__PURE__ */ jsx(Typography, {
13
+ gutterBottom: true,
14
+ variant: "subtitle1",
15
+ component: "h2",
16
+ className: "mb-0 ml-3",
17
+ children: name
18
+ })]
19
+ })
20
+ }) });
21
+ }
22
+ //#endregion
23
+ export { SmallNavigationCard };
24
+
25
+ //# sourceMappingURL=SmallNavigationCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmallNavigationCard.js","names":[],"sources":["../../../src/components/HomePage/SmallNavigationCard.tsx"],"sourcesContent":["import { cardClickableMixin, cardMixin, cls, Typography } from \"@rebasepro/ui\";\n\nimport { Link } from \"react-router\";\n\nexport type SmallNavigationCardProps = {\n name: string,\n url: string;\n icon: React.ReactElement;\n};\n\nexport function SmallNavigationCard({\n name,\n url,\n icon\n}: SmallNavigationCardProps) {\n\n return (\n <>\n\n <Link\n tabIndex={0}\n className={cls(cardMixin,\n cardClickableMixin,\n \"cursor-pointer flex flex-row items-center px-4 py-2 text-inherit dark:text-inherit visited:text-inherit dark:visited:text-inherit hover:text-inherit dark:hover:text-inherit \")}\n to={url}\n >\n\n <div className=\"flex flex-row items-center grow gap-2 \">\n {icon}\n\n <Typography gutterBottom variant=\"subtitle1\"\n component=\"h2\"\n className=\"mb-0 ml-3\">\n {name}\n </Typography>\n </div>\n\n </Link>\n\n </>);\n}\n"],"mappings":";;;;AAUA,SAAgB,oBAAoB,EAChC,MACA,KACA,QACyB;CAEzB,OACI,oBAAA,UAAA,EAAA,UAEI,oBAAC,MAAD;EACI,UAAU;EACV,WAAW,IAAI,WACX,oBACA,+KAA+K;EACnL,IAAI;YAGJ,qBAAC,OAAD;GAAK,WAAU;aAAf,CACK,MAED,oBAAC,YAAD;IAAY,cAAA;IAAa,SAAQ;IAC7B,WAAU;IACV,WAAU;cACT;GACO,CAAA,CACX;;CAEH,CAAA,EAER,CAAA;AACV"}
@@ -1,7 +1,7 @@
1
1
  import "react";
2
2
  import { Fragment, jsx } from "react/jsx-runtime";
3
3
  import { CircularProgressCenter } from "@rebasepro/ui";
4
- import { LoginView, readEmailLinkAction, useAuthController, useRebaseRegistry } from "@rebasepro/app";
4
+ import { LoginView, readEmailLinkAction, useAuthController, useComponentOverride, useRebaseRegistry } from "@rebasepro/app";
5
5
  //#region src/components/RebaseAuthGate.tsx
6
6
  /**
7
7
  * Auth gate component that handles the authentication flow.
@@ -23,10 +23,11 @@ import { LoginView, readEmailLinkAction, useAuthController, useRebaseRegistry }
23
23
  function RebaseAuthGate({ children }) {
24
24
  const registry = useRebaseRegistry();
25
25
  const authController = useAuthController();
26
+ const ResolvedLoginView = useComponentOverride("Auth.LoginView", LoginView);
26
27
  if (authController?.initialLoading) return /* @__PURE__ */ jsx(CircularProgressCenter, { size: "large" });
27
28
  const openedLink = typeof window !== "undefined" ? readEmailLinkAction(window.location)?.kind : void 0;
28
29
  const linkOpensOverSession = openedLink === "verify-email" || openedLink === "confirm-email-change" || openedLink === "magic-link";
29
- if (!authController?.user || linkOpensOverSession) return /* @__PURE__ */ jsx(Fragment, { children: registry.authConfig?.loginView ?? /* @__PURE__ */ jsx(LoginView, { authController }) });
30
+ if (!authController?.user || linkOpensOverSession) return /* @__PURE__ */ jsx(Fragment, { children: registry.authConfig?.loginView ?? /* @__PURE__ */ jsx(ResolvedLoginView, { authController }) });
30
31
  return /* @__PURE__ */ jsx(Fragment, { children });
31
32
  }
32
33
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"RebaseAuthGate.js","names":[],"sources":["../../src/components/RebaseAuthGate.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n useRebaseRegistry,\n useAuthController\n} from \"@rebasepro/app\";\nimport { CircularProgressCenter } from \"@rebasepro/ui\";\nimport { LoginView, readEmailLinkAction } from \"@rebasepro/app\";\nimport type { AuthControllerExtended } from \"@rebasepro/cms-types\";\n\n/**\n * Auth gate component that handles the authentication flow.\n *\n * - Shows a loading spinner while `authController.initialLoading` is true.\n * - Shows the login view when no user is authenticated.\n * - Renders `children` when a user is authenticated.\n *\n * **Independently usable**: Use this alone when you want auth gating\n * without the full admin layout or navigation.\n *\n * @example\n * ```tsx\n * <RebaseAuthGate>\n * <MyCustomApp />\n * </RebaseAuthGate>\n * ```\n */\nexport function RebaseAuthGate({ children }: { children: React.ReactNode }) {\n const registry = useRebaseRegistry();\n const authController = useAuthController();\n\n\n if (authController?.initialLoading) {\n return <CircularProgressCenter size={\"large\"}/>;\n }\n\n // A verification link opened while signed in is verified by the session\n // itself — which keeps everything on the account — on the screen that\n // knows the link, and an address-change link is usually followed in the\n // tab that asked for the change. A magic link opened while signed in is\n // sent on to the app by that screen, without being spent. Left to the\n // app's router each was a page that does not exist.\n const openedLink = typeof window !== \"undefined\" ? readEmailLinkAction(window.location)?.kind : undefined;\n const linkOpensOverSession = openedLink === \"verify-email\"\n || openedLink === \"confirm-email-change\"\n || openedLink === \"magic-link\";\n\n if (!authController?.user || linkOpensOverSession) {\n const ActiveLoginView = registry.authConfig?.loginView ?? (\n <LoginView authController={authController as AuthControllerExtended}/>\n );\n return <>{ActiveLoginView}</>;\n }\n\n return <>{children}</>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,eAAe,EAAE,YAA2C;CACxE,MAAM,WAAW,kBAAkB;CACnC,MAAM,iBAAiB,kBAAkB;CAGzC,IAAI,gBAAgB,gBAChB,OAAO,oBAAC,wBAAD,EAAwB,MAAM,QAAS,CAAA;CASlD,MAAM,aAAa,OAAO,WAAW,cAAc,oBAAoB,OAAO,QAAQ,CAAC,EAAE,OAAO,KAAA;CAChG,MAAM,uBAAuB,eAAe,kBACrC,eAAe,0BACf,eAAe;CAEtB,IAAI,CAAC,gBAAgB,QAAQ,sBAIzB,OAAO,oBAAA,UAAA,EAAA,UAHiB,SAAS,YAAY,aACzC,oBAAC,WAAD,EAA2B,eAA0C,CAAA,EAE7C,CAAA;CAGhC,OAAO,oBAAA,UAAA,EAAG,SAAW,CAAA;AACzB"}
1
+ {"version":3,"file":"RebaseAuthGate.js","names":[],"sources":["../../src/components/RebaseAuthGate.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n useRebaseRegistry,\n useAuthController,\n useComponentOverride\n} from \"@rebasepro/app\";\nimport { CircularProgressCenter } from \"@rebasepro/ui\";\nimport { LoginView, readEmailLinkAction } from \"@rebasepro/app\";\nimport type { AuthControllerExtended } from \"@rebasepro/cms-types\";\n\n/**\n * Auth gate component that handles the authentication flow.\n *\n * - Shows a loading spinner while `authController.initialLoading` is true.\n * - Shows the login view when no user is authenticated.\n * - Renders `children` when a user is authenticated.\n *\n * **Independently usable**: Use this alone when you want auth gating\n * without the full admin layout or navigation.\n *\n * @example\n * ```tsx\n * <RebaseAuthGate>\n * <MyCustomApp />\n * </RebaseAuthGate>\n * ```\n */\nexport function RebaseAuthGate({ children }: { children: React.ReactNode }) {\n const registry = useRebaseRegistry();\n const authController = useAuthController();\n // `<RebaseAuth loginView>` is an element and wins; `\"Auth.LoginView\"` in\n // `<Rebase components>` replaces or wraps the built-in screen.\n const ResolvedLoginView = useComponentOverride(\"Auth.LoginView\", LoginView);\n\n if (authController?.initialLoading) {\n return <CircularProgressCenter size={\"large\"}/>;\n }\n\n // A verification link opened while signed in is verified by the session\n // itself — which keeps everything on the account — on the screen that\n // knows the link, and an address-change link is usually followed in the\n // tab that asked for the change. A magic link opened while signed in is\n // sent on to the app by that screen, without being spent. Left to the\n // app's router each was a page that does not exist.\n const openedLink = typeof window !== \"undefined\" ? readEmailLinkAction(window.location)?.kind : undefined;\n const linkOpensOverSession = openedLink === \"verify-email\"\n || openedLink === \"confirm-email-change\"\n || openedLink === \"magic-link\";\n\n if (!authController?.user || linkOpensOverSession) {\n const ActiveLoginView = registry.authConfig?.loginView ?? (\n <ResolvedLoginView authController={authController as AuthControllerExtended}/>\n );\n return <>{ActiveLoginView}</>;\n }\n\n return <>{children}</>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAgB,eAAe,EAAE,YAA2C;CACxE,MAAM,WAAW,kBAAkB;CACnC,MAAM,iBAAiB,kBAAkB;CAGzC,MAAM,oBAAoB,qBAAqB,kBAAkB,SAAS;CAE1E,IAAI,gBAAgB,gBAChB,OAAO,oBAAC,wBAAD,EAAwB,MAAM,QAAS,CAAA;CASlD,MAAM,aAAa,OAAO,WAAW,cAAc,oBAAoB,OAAO,QAAQ,CAAC,EAAE,OAAO,KAAA;CAChG,MAAM,uBAAuB,eAAe,kBACrC,eAAe,0BACf,eAAe;CAEtB,IAAI,CAAC,gBAAgB,QAAQ,sBAIzB,OAAO,oBAAA,UAAA,EAAA,UAHiB,SAAS,YAAY,aACzC,oBAAC,mBAAD,EAAmC,eAA0C,CAAA,EAErD,CAAA;CAGhC,OAAO,oBAAA,UAAA,EAAG,SAAW,CAAA;AACzB"}
@@ -3,7 +3,10 @@ import type { AppView } from "@rebasepro/cms-types";
3
3
  export interface RebaseLayoutProps {
4
4
  /** Title shown in the drawer. */
5
5
  title?: string;
6
- /** Top bar. Only rendered if provided — pass `<AppBar/>` for the default one. */
6
+ /**
7
+ * Top bar. Only rendered if provided — pass `<AppBar/>` for the default
8
+ * one — or when `<Rebase components>` overrides `"Shell.AppBar"`.
9
+ */
7
10
  appBar?: React.ReactNode;
8
11
  /** Custom Drawer to override the default. */
9
12
  drawer?: React.ReactNode;
@@ -1,5 +1,6 @@
1
1
  import { SideDialogs } from "./SideDialogs.js";
2
2
  import { AdminModeSyncer } from "./AdminModeSyncer.js";
3
+ import { DefaultAppBar } from "./DefaultAppBar.js";
3
4
  import { Drawer } from "./app/Drawer.js";
4
5
  import { Scaffold } from "./app/Scaffold.js";
5
6
  import "react";
@@ -36,6 +37,11 @@ function RebaseLayout(props) {
36
37
  const { title = "Rebase", appBar, drawer, autoOpenDrawer = true, defaultDrawerOpen = false, logo, devViews = [] } = props;
37
38
  const adminModeController = useAdminModeController();
38
39
  const ResolvedDrawer = useComponentOverride("Shell.Drawer", Drawer);
40
+ const ResolvedAppBar = useComponentOverride("Shell.AppBar", DefaultAppBar);
41
+ const ActiveAppBar = appBar ?? (ResolvedAppBar !== DefaultAppBar ? /* @__PURE__ */ jsx(ResolvedAppBar, {
42
+ title,
43
+ logo
44
+ }) : null);
39
45
  const ActiveDrawer = drawer ?? /* @__PURE__ */ jsx(ResolvedDrawer, {
40
46
  title,
41
47
  logoDestination: adminModeController.mode === "studio" ? "/s" : "/"
@@ -46,7 +52,7 @@ function RebaseLayout(props) {
46
52
  logo,
47
53
  children: [
48
54
  /* @__PURE__ */ jsx(AdminModeSyncer, { devViews }),
49
- appBar,
55
+ ActiveAppBar,
50
56
  ActiveDrawer,
51
57
  /* @__PURE__ */ jsx(Outlet, {}),
52
58
  /* @__PURE__ */ jsx(SideDialogs, {})
@@ -1 +1 @@
1
- {"version":3,"file":"RebaseLayout.js","names":[],"sources":["../../src/components/RebaseLayout.tsx"],"sourcesContent":["import React from \"react\";\nimport { Outlet } from \"react-router\";\nimport {\n useAdminModeController,\n useComponentOverride,\n useRebaseRegistry\n} from \"@rebasepro/app\";\n\nimport { Scaffold } from \"./app/Scaffold\";\nimport { Drawer } from \"./app/Drawer\";\nimport { SideDialogs } from \"./SideDialogs\";\nimport { AdminModeSyncer } from \"./AdminModeSyncer\";\nimport type { AppView } from \"@rebasepro/cms-types\";\n\nexport interface RebaseLayoutProps {\n /** Title shown in the drawer. */\n title?: string;\n /** Top bar. Only rendered if provided — pass `<AppBar/>` for the default one. */\n appBar?: React.ReactNode;\n /** Custom Drawer to override the default. */\n drawer?: React.ReactNode;\n /** Expand the drawer while the pointer is over it. On by default; pass `false` to opt out. Not a load-time default — that is `defaultDrawerOpen`. */\n autoOpenDrawer?: boolean;\n /** Start with the drawer expanded instead of collapsed to icons. Ignored on small layouts. */\n defaultDrawerOpen?: boolean;\n /** Path to the logo shown in the drawer and top bar. Falls back to the Rebase mark. */\n logo?: string;\n /** Dev views passed to AdminModeSyncer (resolved from RebaseNavigation). */\n devViews?: AppView[];\n}\n\n/**\n * Layout layer — provides the Scaffold, Drawer, and SideDialogs.\n *\n * Wraps the route outlet with the standard Rebase admin layout.\n * Override the drawer via props; pass `appBar` to add a top bar (there is\n * none by default — the drawer owns navigation and user actions).\n *\n * **Independently usable**: Use this when you want the Rebase layout\n * without its default route definitions.\n *\n * It takes no children: the routed view arrives through react-router's\n * `<Outlet/>`. This example used to pass `<Route>` elements, which is neither\n * what the component renders nor something `RebaseLayoutProps` accepts — a\n * reader following it wrote a type error whose message was about `children`,\n * not about routes.\n *\n * Hand it to `<RebaseRouteDefs layout>`, which renders the routes inside it:\n *\n * @example\n * ```tsx\n * <RebaseRouteDefs layout={<RebaseLayout title=\"My Admin\" appBar={<AppBar/>}/>}>\n * <Route path=\"/custom\" element={<CustomView/>}/>\n * </RebaseRouteDefs>\n * ```\n */\nexport function RebaseLayout(props: RebaseLayoutProps) {\n const {\n title = \"Rebase\",\n appBar,\n drawer,\n autoOpenDrawer = true,\n defaultDrawerOpen = false,\n logo,\n devViews = []\n } = props;\n\n const adminModeController = useAdminModeController();\n const ResolvedDrawer = useComponentOverride(\"Shell.Drawer\", Drawer);\n\n const ActiveDrawer = drawer ?? (\n <ResolvedDrawer\n title={title}\n logoDestination={adminModeController.mode === \"studio\" ? \"/s\" : \"/\"}\n />\n );\n\n return (\n <Scaffold autoOpenDrawer={autoOpenDrawer} defaultDrawerOpen={defaultDrawerOpen} logo={logo}>\n <AdminModeSyncer devViews={devViews}/>\n {appBar}\n {ActiveDrawer}\n <Outlet/>\n <SideDialogs/>\n </Scaffold>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,SAAgB,aAAa,OAA0B;CACnD,MAAM,EACF,QAAQ,UACR,QACA,QACA,iBAAiB,MACjB,oBAAoB,OACpB,MACA,WAAW,CAAC,MACZ;CAEJ,MAAM,sBAAsB,uBAAuB;CACnD,MAAM,iBAAiB,qBAAqB,gBAAgB,MAAM;CAElE,MAAM,eAAe,UACjB,oBAAC,gBAAD;EACW;EACP,iBAAiB,oBAAoB,SAAS,WAAW,OAAO;CACnE,CAAA;CAGL,OACI,qBAAC,UAAD;EAA0B;EAAmC;EAAyB;YAAtF;GACI,oBAAC,iBAAD,EAA2B,SAAU,CAAA;GACpC;GACA;GACD,oBAAC,QAAD,CAAQ,CAAA;GACR,oBAAC,aAAD,CAAa,CAAA;EACP;;AAElB"}
1
+ {"version":3,"file":"RebaseLayout.js","names":[],"sources":["../../src/components/RebaseLayout.tsx"],"sourcesContent":["import React from \"react\";\nimport { Outlet } from \"react-router\";\nimport {\n useAdminModeController,\n useComponentOverride,\n useRebaseRegistry\n} from \"@rebasepro/app\";\n\nimport { Scaffold } from \"./app/Scaffold\";\nimport { Drawer } from \"./app/Drawer\";\nimport { DefaultAppBar } from \"./DefaultAppBar\";\nimport { SideDialogs } from \"./SideDialogs\";\nimport { AdminModeSyncer } from \"./AdminModeSyncer\";\nimport type { AppView } from \"@rebasepro/cms-types\";\n\nexport interface RebaseLayoutProps {\n /** Title shown in the drawer. */\n title?: string;\n /**\n * Top bar. Only rendered if provided — pass `<AppBar/>` for the default\n * one — or when `<Rebase components>` overrides `\"Shell.AppBar\"`.\n */\n appBar?: React.ReactNode;\n /** Custom Drawer to override the default. */\n drawer?: React.ReactNode;\n /** Expand the drawer while the pointer is over it. On by default; pass `false` to opt out. Not a load-time default — that is `defaultDrawerOpen`. */\n autoOpenDrawer?: boolean;\n /** Start with the drawer expanded instead of collapsed to icons. Ignored on small layouts. */\n defaultDrawerOpen?: boolean;\n /** Path to the logo shown in the drawer and top bar. Falls back to the Rebase mark. */\n logo?: string;\n /** Dev views passed to AdminModeSyncer (resolved from RebaseNavigation). */\n devViews?: AppView[];\n}\n\n/**\n * Layout layer — provides the Scaffold, Drawer, and SideDialogs.\n *\n * Wraps the route outlet with the standard Rebase admin layout.\n * Override the drawer via props; pass `appBar` to add a top bar (there is\n * none by default — the drawer owns navigation and user actions).\n *\n * **Independently usable**: Use this when you want the Rebase layout\n * without its default route definitions.\n *\n * It takes no children: the routed view arrives through react-router's\n * `<Outlet/>`. This example used to pass `<Route>` elements, which is neither\n * what the component renders nor something `RebaseLayoutProps` accepts — a\n * reader following it wrote a type error whose message was about `children`,\n * not about routes.\n *\n * Hand it to `<RebaseRouteDefs layout>`, which renders the routes inside it:\n *\n * @example\n * ```tsx\n * <RebaseRouteDefs layout={<RebaseLayout title=\"My Admin\" appBar={<AppBar/>}/>}>\n * <Route path=\"/custom\" element={<CustomView/>}/>\n * </RebaseRouteDefs>\n * ```\n */\nexport function RebaseLayout(props: RebaseLayoutProps) {\n const {\n title = \"Rebase\",\n appBar,\n drawer,\n autoOpenDrawer = true,\n defaultDrawerOpen = false,\n logo,\n devViews = []\n } = props;\n\n const adminModeController = useAdminModeController();\n const ResolvedDrawer = useComponentOverride(\"Shell.Drawer\", Drawer);\n const ResolvedAppBar = useComponentOverride(\"Shell.AppBar\", DefaultAppBar);\n\n // There is no top bar by default, so an override of it is also the ask\n // for one: a replacement renders on its own, and a wrapper is handed the\n // default bar as `OriginalComponent`. An `appBar` element still wins, the\n // way a `drawer` element wins over a `\"Shell.Drawer\"` override.\n const ActiveAppBar = appBar ?? (ResolvedAppBar !== DefaultAppBar\n ? <ResolvedAppBar title={title} logo={logo}/>\n : null);\n\n const ActiveDrawer = drawer ?? (\n <ResolvedDrawer\n title={title}\n logoDestination={adminModeController.mode === \"studio\" ? \"/s\" : \"/\"}\n />\n );\n\n return (\n <Scaffold autoOpenDrawer={autoOpenDrawer} defaultDrawerOpen={defaultDrawerOpen} logo={logo}>\n <AdminModeSyncer devViews={devViews}/>\n {ActiveAppBar}\n {ActiveDrawer}\n <Outlet/>\n <SideDialogs/>\n </Scaffold>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,SAAgB,aAAa,OAA0B;CACnD,MAAM,EACF,QAAQ,UACR,QACA,QACA,iBAAiB,MACjB,oBAAoB,OACpB,MACA,WAAW,CAAC,MACZ;CAEJ,MAAM,sBAAsB,uBAAuB;CACnD,MAAM,iBAAiB,qBAAqB,gBAAgB,MAAM;CAClE,MAAM,iBAAiB,qBAAqB,gBAAgB,aAAa;CAMzE,MAAM,eAAe,WAAW,mBAAmB,gBAC7C,oBAAC,gBAAD;EAAuB;EAAa;CAAM,CAAA,IAC1C;CAEN,MAAM,eAAe,UACjB,oBAAC,gBAAD;EACW;EACP,iBAAiB,oBAAoB,SAAS,WAAW,OAAO;CACnE,CAAA;CAGL,OACI,qBAAC,UAAD;EAA0B;EAAmC;EAAyB;YAAtF;GACI,oBAAC,iBAAD,EAA2B,SAAU,CAAA;GACpC;GACA;GACD,oBAAC,QAAD,CAAQ,CAAA;GACR,oBAAC,aAAD,CAAa,CAAA;EACP;;AAElB"}
@@ -1,7 +1,10 @@
1
1
  import React from "react";
2
2
  export interface RebaseShellProps {
3
3
  title?: string;
4
- /** Top bar. Only rendered if provided — pass `<AppBar/>` for the default one. */
4
+ /**
5
+ * Top bar. Only rendered if provided — pass `<AppBar/>` for the default
6
+ * one — or when `<Rebase components>` overrides `"Shell.AppBar"`.
7
+ */
5
8
  appBar?: React.ReactNode;
6
9
  drawer?: React.ReactNode;
7
10
  /** Expand the drawer while the pointer is over it. On by default; pass `false` to opt out. Not a load-time default — that is `defaultDrawerOpen`. */
@@ -1 +1 @@
1
- {"version":3,"file":"RebaseShell.js","names":[],"sources":["../../src/components/RebaseShell.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport {\n useRebaseRegistry\n} from \"@rebasepro/app\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\n\nimport { RebaseAuthGate } from \"./RebaseAuthGate\";\nimport { RebaseNavigation } from \"./RebaseNavigation\";\nimport { RebaseLayout } from \"./RebaseLayout\";\nimport { RebaseRouteDefs } from \"./RebaseRouteDefs\";\n\nexport interface RebaseShellProps {\n title?: string;\n /** Top bar. Only rendered if provided — pass `<AppBar/>` for the default one. */\n appBar?: React.ReactNode;\n drawer?: React.ReactNode;\n /** Expand the drawer while the pointer is over it. On by default; pass `false` to opt out. Not a load-time default — that is `defaultDrawerOpen`. */\n autoOpenDrawer?: boolean;\n /** Start with the drawer expanded instead of collapsed to icons. Ignored on small layouts. */\n defaultDrawerOpen?: boolean;\n /** Path to the logo shown in the drawer and top bar. Falls back to the Rebase mark. */\n logo?: string;\n children?: React.ReactNode;\n}\n\n/**\n * Convenience component that composes all four admin layers:\n *\n * ```\n * <RebaseAuthGate>\n * <RebaseNavigation>\n * <RebaseRouteDefs layout={<RebaseLayout>}>\n * {children}\n * </RebaseRouteDefs>\n * </RebaseNavigation>\n * </RebaseAuthGate>\n * ```\n *\n * Each layer is independently usable — see their individual docs.\n * RebaseShell is sugar that composes them all with sensible defaults.\n */\nexport function RebaseShell(props: RebaseShellProps) {\n const {\n title = \"Rebase\",\n appBar,\n drawer,\n autoOpenDrawer = true,\n defaultDrawerOpen = false,\n logo,\n children\n } = props;\n\n const registry = useRebaseRegistry();\n\n // Compute devViews for the layout's AdminModeSyncer\n const devViews = useMemo(() => {\n return registry.studioConfig?.devViews ?? [];\n }, [registry.studioConfig?.devViews]);\n\n return (\n <RebaseAuthGate>\n <RebaseNavigation>\n <ErrorBoundary fullPage>\n <RebaseRouteDefs\n layout={\n <RebaseLayout\n title={title}\n appBar={appBar}\n drawer={drawer}\n autoOpenDrawer={autoOpenDrawer}\n defaultDrawerOpen={defaultDrawerOpen}\n logo={logo}\n devViews={devViews}\n />\n }\n >\n {children}\n </RebaseRouteDefs>\n </ErrorBoundary>\n </RebaseNavigation>\n </RebaseAuthGate>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,YAAY,OAAyB;CACjD,MAAM,EACF,QAAQ,UACR,QACA,QACA,iBAAiB,MACjB,oBAAoB,OACpB,MACA,aACA;CAEJ,MAAM,WAAW,kBAAkB;CAOnC,OACI,oBAAC,gBAAD,EAAA,UACI,oBAAC,kBAAD,EAAA,UACI,oBAAC,eAAD;EAAe,UAAA;YACX,oBAAC,iBAAD;GACI,QACI,oBAAC,cAAD;IACW;IACC;IACA;IACQ;IACG;IACb;IACI,UAjBrB,cAAc;KAC3B,OAAO,SAAS,cAAc,YAAY,CAAC;IAC/C,GAAG,CAAC,SAAS,cAAc,QAAQ,CAeG;GACb,CAAA;GAGJ;EACY,CAAA;CACN,CAAA,EACD,CAAA,EACN,CAAA;AAExB"}
1
+ {"version":3,"file":"RebaseShell.js","names":[],"sources":["../../src/components/RebaseShell.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport {\n useRebaseRegistry\n} from \"@rebasepro/app\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\n\nimport { RebaseAuthGate } from \"./RebaseAuthGate\";\nimport { RebaseNavigation } from \"./RebaseNavigation\";\nimport { RebaseLayout } from \"./RebaseLayout\";\nimport { RebaseRouteDefs } from \"./RebaseRouteDefs\";\n\nexport interface RebaseShellProps {\n title?: string;\n /**\n * Top bar. Only rendered if provided — pass `<AppBar/>` for the default\n * one — or when `<Rebase components>` overrides `\"Shell.AppBar\"`.\n */\n appBar?: React.ReactNode;\n drawer?: React.ReactNode;\n /** Expand the drawer while the pointer is over it. On by default; pass `false` to opt out. Not a load-time default — that is `defaultDrawerOpen`. */\n autoOpenDrawer?: boolean;\n /** Start with the drawer expanded instead of collapsed to icons. Ignored on small layouts. */\n defaultDrawerOpen?: boolean;\n /** Path to the logo shown in the drawer and top bar. Falls back to the Rebase mark. */\n logo?: string;\n children?: React.ReactNode;\n}\n\n/**\n * Convenience component that composes all four admin layers:\n *\n * ```\n * <RebaseAuthGate>\n * <RebaseNavigation>\n * <RebaseRouteDefs layout={<RebaseLayout>}>\n * {children}\n * </RebaseRouteDefs>\n * </RebaseNavigation>\n * </RebaseAuthGate>\n * ```\n *\n * Each layer is independently usable — see their individual docs.\n * RebaseShell is sugar that composes them all with sensible defaults.\n */\nexport function RebaseShell(props: RebaseShellProps) {\n const {\n title = \"Rebase\",\n appBar,\n drawer,\n autoOpenDrawer = true,\n defaultDrawerOpen = false,\n logo,\n children\n } = props;\n\n const registry = useRebaseRegistry();\n\n // Compute devViews for the layout's AdminModeSyncer\n const devViews = useMemo(() => {\n return registry.studioConfig?.devViews ?? [];\n }, [registry.studioConfig?.devViews]);\n\n return (\n <RebaseAuthGate>\n <RebaseNavigation>\n <ErrorBoundary fullPage>\n <RebaseRouteDefs\n layout={\n <RebaseLayout\n title={title}\n appBar={appBar}\n drawer={drawer}\n autoOpenDrawer={autoOpenDrawer}\n defaultDrawerOpen={defaultDrawerOpen}\n logo={logo}\n devViews={devViews}\n />\n }\n >\n {children}\n </RebaseRouteDefs>\n </ErrorBoundary>\n </RebaseNavigation>\n </RebaseAuthGate>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,SAAgB,YAAY,OAAyB;CACjD,MAAM,EACF,QAAQ,UACR,QACA,QACA,iBAAiB,MACjB,oBAAoB,OACpB,MACA,aACA;CAEJ,MAAM,WAAW,kBAAkB;CAOnC,OACI,oBAAC,gBAAD,EAAA,UACI,oBAAC,kBAAD,EAAA,UACI,oBAAC,eAAD;EAAe,UAAA;YACX,oBAAC,iBAAD;GACI,QACI,oBAAC,cAAD;IACW;IACC;IACA;IACQ;IACG;IACb;IACI,UAjBrB,cAAc;KAC3B,OAAO,SAAS,cAAc,YAAY,CAAC;IAC/C,GAAG,CAAC,SAAS,cAAc,QAAQ,CAeG;GACb,CAAA;GAGJ;EACY,CAAA;CACN,CAAA,EACD,CAAA,EACN,CAAA;AAExB"}
@@ -29,6 +29,7 @@ function SelectionTableBindingInternal({ onSingleEntitySelected, onMultipleEntit
29
29
  const sidePanelController = useSidePanel();
30
30
  const urlController = useUrlController();
31
31
  const analyticsController = useAnalyticsController();
32
+ const { t } = useTranslation();
32
33
  const path = urlController.resolveDatabasePathsFrom(pathInput);
33
34
  const dataClient = useData();
34
35
  const [entitiesDisplayedFirst, setEntitiesDisplayedFirst] = useState([]);
@@ -167,7 +168,7 @@ function SelectionTableBindingInternal({ onSingleEntitySelected, onMultipleEntit
167
168
  size: "small",
168
169
  collectionOrView: collection,
169
170
  className: "text-surface-300 dark:text-surface-600"
170
- }), collection.singularName ? `Select ${collection.singularName}` : `Select from ${collection.name}`]
171
+ }), collection.singularName ? t("select_specific", { name: collection.singularName }) : t("select_from", { name: collection.name })]
171
172
  }),
172
173
  defaultSize: collection.defaultSize,
173
174
  properties: collection.properties,
@@ -190,7 +191,7 @@ function SelectionTableBindingInternal({ onSingleEntitySelected, onMultipleEntit
190
191
  }), /* @__PURE__ */ jsx(Button, {
191
192
  onClick: onDone,
192
193
  variant: "filled",
193
- children: "Done"
194
+ children: t("done")
194
195
  })]
195
196
  })]
196
197
  })
@@ -215,7 +216,7 @@ function EntitySelectionDialogActions({ collection, path, onClear, onNewClick })
215
216
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button, {
216
217
  onClick: onClear,
217
218
  variant: "text",
218
- children: "Clear"
219
+ children: t("clear")
219
220
  }), addButton] });
220
221
  }
221
222
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionTableBinding.js","names":[],"sources":["../../../src/components/ReferenceTable/SelectionTableBinding.tsx"],"sourcesContent":["\nimport React, { MouseEventHandler, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { Entity, FilterValues } from \"@rebasepro/types\";\nimport { CollectionSize, AdminCollection } from \"@rebasepro/cms-types\";\n\nimport {\n CollectionRowActions,\n CollectionTableBinding\n} from \"../CollectionTableBinding\";\nimport {\n CollectionScopeProvider,\n useAuthController,\n useCustomizationController,\n useData,\n useDataTableController,\n useLargeLayout,\n usePermissions,\n useTranslation\n} from \"@rebasepro/app\";\nimport { ErrorView } from \"@rebasepro/app\";\nimport { Button, DialogActions, PlusIcon, Typography } from \"@rebasepro/ui\";\nimport { IconForView } from \"@rebasepro/app\";\nimport { useSelectionController } from \"../CollectionViewBinding/useSelectionController\";\n\nimport { useColumnIds } from \"@rebasepro/app\";\nimport { useSideDialogContext } from \"../SideDialogs\";\nimport { useAnalyticsController } from \"@rebasepro/app\";\nimport { useUrlController } from \"../../hooks/navigation/contexts/UrlContext\";\nimport { useSidePanel } from \"../../hooks/useSidePanel\";\nimport { findEntitiesByIds } from \"../../util/find_entities_by_ids\";\n\n/** Stable identity, so the effect that propagates the picks does not re-fire. */\nconst EMPTY_ENTITIES: Entity<any>[] = [];\n\n/**\n * @group Components\n */\nexport interface SelectionProps<M extends Record<string, unknown>> {\n\n /**\n * Allow multiple selection of values\n */\n multiselect?: boolean;\n\n /**\n * Entity collection config\n */\n collection?: AdminCollection<M>;\n\n /**\n * Absolute path of the collection.\n * May be not set if this hook is being used in a component and the path is\n * dynamic. If not set, the dialog won't open.\n */\n path: string;\n\n /**\n * If you are opening the dialog for the first time, you can select some\n * entity ids to be displayed first.\n */\n selectedEntityIds?: (string | number)[];\n\n /**\n * If `multiselect` is set to `false`, you will get the selected entity\n * in this callback.\n * @param entity\n * @callback\n */\n onSingleEntitySelected?(entity: Entity<any> | null): void;\n\n /**\n * If `multiselect` is set to `true`, you will get the selected entities\n * in this callback.\n * @param entities\n * @callback\n */\n onMultipleEntitiesSelected?(entities: Entity<any>[]): void;\n\n /**\n * Called once, with the final selection, when the user presses Done.\n *\n * `onMultipleEntitiesSelected` reports every tick as it happens, which is\n * right when the selection *is* the value (a reference field). Use this\n * one instead when acting on the selection writes something — linking\n * rows, say — so a row ticked and then unticked, or a selection cleared,\n * is never acted on.\n * @param entities\n * @callback\n */\n onSelectionDone?(entities: Entity<M>[]): void;\n\n /**\n * Allow selection of entities that pass the given filter only.\n */\n fixedFilter?: FilterValues<string>;\n\n /**\n * Use this description to indicate the user what to do in this dialog.\n */\n description?: React.ReactNode;\n\n /**\n * Maximum number of entities that can be selected.\n */\n maxSelection?: number;\n\n}\n\n/**\n * This component allows to select entities from a given collection.\n * You probably want to open this dialog as a side view using {@link useSelectionTableBinding}\n * @group Components\n */\nexport function SelectionTableBinding<M extends Record<string, unknown>>(\n props: SelectionProps<M>\n) {\n if (!props.collection) {\n return <ErrorView\n error={\"Could not find collection\"}/>\n }\n return <SelectionTableBindingInternal {...props} collection={props.collection} />;\n}\n\nfunction SelectionTableBindingInternal<M extends Record<string, unknown>>(\n {\n onSingleEntitySelected,\n onMultipleEntitiesSelected,\n onSelectionDone,\n multiselect,\n collection,\n path: pathInput,\n selectedEntityIds: selectedEntityIdsProp,\n description,\n fixedFilter,\n maxSelection\n }: SelectionProps<M> & { collection: AdminCollection<M> }) {\n\n const sideDialogContext = useSideDialogContext();\n const sidePanelController = useSidePanel();\n const urlController = useUrlController();\n const analyticsController = useAnalyticsController();\n\n const path = urlController.resolveDatabasePathsFrom(pathInput);\n\n const dataClient = useData();\n\n const [entitiesDisplayedFirst, setEntitiesDisplayedFirst] = useState<Entity<any>[]>([]);\n\n // Explicitly `<M>`: the hook defaults to `Record<string, unknown>`, and the\n // controller is handed to a table typed `SelectionController<M>`. `Entity<M>`\n // sits on both sides of that interface (`selectedEntities` out,\n // `toggleEntitySelection` in), so the default was never actually assignable\n // here — it only looked fine while the surrounding props gave TypeScript no\n // reason to bind `M` to this component's own parameter.\n const selectionController = useSelectionController<M>();\n\n // The rows picked in this dialog.\n //\n // This surface never enters query mode: it offers no \"select all matching\",\n // because pointing a reference field at every row of a collection is not\n // something anyone means to do, and `maxSelection` could not be enforced\n // against a count nobody has read yet. Every write below goes through\n // `setSelectedEntities`, so the query branch is unreachable here.\n const selectedEntities = selectionController.selection.type === \"entities\"\n ? selectionController.selection.entities\n : EMPTY_ENTITIES;\n\n // Track whether the selection has been initialized to avoid\n // firing onMultipleEntitiesSelected during the initial mount/fetch.\n const selectionInitializedRef = useRef(false);\n\n // Propagate selection changes to the parent callback.\n // This runs after the selectionController state updates, ensuring\n // we always send the correct, non-stale selection to the parent.\n useEffect(() => {\n if (!selectionInitializedRef.current) return;\n if (onMultipleEntitiesSelected) {\n onMultipleEntitiesSelected(selectedEntities);\n }\n }, [selectedEntities]);\n\n /**\n * Fetch initially selected ids\n */\n useEffect(() => {\n let unmounted = false;\n const selectedEntityIds = selectedEntityIdsProp?.map(id => id?.toString()).filter(Boolean);\n if (selectedEntityIds && selectedEntityIds.length > 0 && collection) {\n // One request per 1,000 ids, not one per id (see findEntitiesByIds).\n findEntitiesByIds(dataClient.collection<M>(path), collection, selectedEntityIds)\n .then((found) => {\n if (!unmounted) {\n // In the order given; an id with no row is dropped.\n const result = selectedEntityIds\n .map(id => found.get(id))\n .filter((e): e is Entity<any> => !!e);\n selectionController.setSelectedEntities(result);\n setEntitiesDisplayedFirst(result);\n // Mark initialized after the initial fetch completes\n selectionInitializedRef.current = true;\n }\n });\n } else {\n selectionController.setSelectedEntities([]);\n setEntitiesDisplayedFirst([]);\n selectionInitializedRef.current = true;\n }\n return () => {\n unmounted = true;\n };\n }, [dataClient, path, selectedEntityIdsProp, collection, selectionController.setSelectedEntities]);\n\n const onClear = () => {\n analyticsController.onAnalyticsEvent?.(\"reference_selection_clear\", {\n path\n });\n selectionController.setSelectedEntities([]);\n if (!multiselect && onSingleEntitySelected) {\n onSingleEntitySelected(null);\n }\n };\n\n const onEntityClick = useCallback((entity: Entity<any>) => {\n if (!multiselect && onSingleEntitySelected) {\n analyticsController.onAnalyticsEvent?.(\"reference_selected_single\", {\n path,\n entityId: entity.id\n });\n onSingleEntitySelected(entity);\n sideDialogContext.close(false);\n } else {\n // For multiselect, delegate to the selection controller's toggle.\n // The useEffect above will propagate the change to onMultipleEntitiesSelected.\n analyticsController.onAnalyticsEvent?.(\"reference_selection_toggle\", {\n path,\n entityId: entity.id\n });\n if (selectedEntities.map((e) => e.id).indexOf(entity.id) > -1) {\n selectionController.setSelectedEntities(\n selectedEntities.filter((item: Entity<any>) => item.id !== entity.id)\n );\n } else {\n if (maxSelection && selectedEntities.length >= maxSelection) return;\n selectionController.setSelectedEntities([...selectedEntities, entity]);\n }\n }\n }, [multiselect, onSingleEntitySelected, analyticsController, path, sideDialogContext, selectionController, selectedEntities, maxSelection]);\n\n // create a new entity from within the reference dialog\n const onNewClick = () => {\n analyticsController.onAnalyticsEvent?.(\"reference_selection_new_entity\", {\n path\n });\n sidePanelController.open({\n path: path,\n collection,\n // No URL, for the reason `RelationSelector` does the same: this\n // panel is a step inside the selection dialog, which is itself a\n // step inside whatever form opened it. `useUnsavedChangesDialog`\n // blocks on a *pathname* change, and this panel's path is a\n // different collection from the one being edited — so closing it\n // raced the panel clearing its own dirty flag and answered a\n // successful save with \"There are unsaved changes\", leaving the URL\n // on the target collection. A record that does not exist yet has no\n // address worth restoring anyway.\n updateUrl: false,\n onUpdate: ({ entity }) => {\n setEntitiesDisplayedFirst([entity, ...entitiesDisplayedFirst]);\n onEntityClick(entity);\n },\n closeOnSave: true\n });\n };\n\n const tableRowActionsBuilder = ({\n entity,\n size,\n width,\n frozen\n }: {\n entity: Entity<any>,\n size: CollectionSize,\n width: number,\n frozen?: boolean\n }) => {\n const isSelected = selectionController.isEntitySelected(entity);\n return <CollectionRowActions\n width={width}\n frozen={frozen}\n entity={entity}\n size={size}\n isSelected={isSelected}\n selectionEnabled={multiselect}\n hideId={collection?.hideIdFromCollection}\n path={path}\n selectionController={selectionController}\n openEntityMode={\"side_panel\"}\n />;\n\n };\n\n const onDone = useCallback((event: React.SyntheticEvent) => {\n event.stopPropagation();\n onSelectionDone?.(selectedEntities);\n sideDialogContext.close(false);\n }, [sideDialogContext, onSelectionDone, selectedEntities]);\n\n const displayedColumnIds = useColumnIds(collection, false);\n\n const tableController = useDataTableController<M>({\n path,\n collection,\n entitiesDisplayedFirst,\n fixedFilter,\n updateUrl: false\n });\n\n return (\n\n <CollectionScopeProvider collection={collection}>\n <div className=\"flex flex-col h-full\">\n\n <div className=\"grow\">\n {entitiesDisplayedFirst &&\n <CollectionTableBinding\n additionalFields={collection.additionalFields}\n displayedColumnIds={displayedColumnIds}\n onEntityClick={onEntityClick}\n tableController={tableController}\n enablePopupIcon={false}\n tableRowActionsBuilder={tableRowActionsBuilder}\n openEntityMode={\"side_panel\"}\n title={<Typography variant={\"subtitle2\"} className={\"flex flex-row gap-2\"}>\n <IconForView\n size={\"small\"}\n collectionOrView={collection}\n className={\"text-surface-300 dark:text-surface-600\"}/>\n {collection.singularName\n ? `Select ${collection.singularName}`\n : `Select from ${collection.name}`}\n </Typography>}\n defaultSize={collection.defaultSize}\n properties={collection.properties}\n fixedFilter={fixedFilter}\n inlineEditing={false}\n selectionController={selectionController}\n actions={<EntitySelectionDialogActions\n collection={collection}\n path={path}\n onNewClick={onNewClick}\n onClear={onClear}/>\n }\n />}\n </div>\n <DialogActions translucent={false}>\n {description &&\n <Typography variant={\"body2\"}\n className=\"grow text-left\">\n {description}\n </Typography>}\n <Button\n onClick={onDone}\n variant=\"filled\">\n Done\n </Button>\n </DialogActions>\n </div>\n </CollectionScopeProvider>\n\n );\n\n}\n\nfunction EntitySelectionDialogActions({\n collection,\n path,\n onClear,\n onNewClick\n}: {\n collection: AdminCollection<any>,\n path: string,\n onClear: () => void,\n onNewClick: () => void\n}) {\n\n const { canCreate } = usePermissions();\n\n const largeLayout = useLargeLayout();\n const { t } = useTranslation();\n\n const onClick: MouseEventHandler<HTMLButtonElement> | undefined = onNewClick\n ? (e) => {\n e.preventDefault();\n onNewClick();\n }\n : undefined;\n const addButton = canCreate(collection, path) &&\n onClick && (largeLayout\n ? <Button\n onClick={onClick}\n startIcon={<PlusIcon/>}>\n {t(\"add_specific\", { name: collection.singularName ?? collection.name })}\n </Button>\n : <Button\n onClick={onClick}>\n <PlusIcon/>\n </Button>);\n\n return (\n <>\n <Button onClick={onClear}\n variant={\"text\"}>\n Clear\n </Button>\n {addButton}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,IAAM,iBAAgC,CAAC;;;;;;AAiFvC,SAAgB,sBACZ,OACF;CACE,IAAI,CAAC,MAAM,YACP,OAAO,oBAAC,WAAD,EACH,OAAO,4BAA6B,CAAA;CAE5C,OAAO,oBAAC,+BAAD;EAA+B,GAAI;EAAO,YAAY,MAAM;CAAa,CAAA;AACpF;AAEA,SAAS,8BACL,EACI,wBACA,4BACA,iBACA,aACA,YACA,MAAM,WACN,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KAAK,CAAC;CACnE,CAAA,IACN,oBAAC,QAAD;EACW;YACT,oBAAC,UAAD,CAAU,CAAA;CACN,CAAA;CAEhB,OACI,qBAAA,UAAA,EAAA,UAAA,CACI,oBAAC,QAAD;EAAQ,SAAS;EACb,SAAS;YAAQ;CAEb,CAAA,GACP,SACH,EAAA,CAAA;AAEV"}
1
+ {"version":3,"file":"SelectionTableBinding.js","names":[],"sources":["../../../src/components/ReferenceTable/SelectionTableBinding.tsx"],"sourcesContent":["\nimport React, { MouseEventHandler, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { Entity, FilterValues } from \"@rebasepro/types\";\nimport { CollectionSize, AdminCollection } from \"@rebasepro/cms-types\";\n\nimport {\n CollectionRowActions,\n CollectionTableBinding\n} from \"../CollectionTableBinding\";\nimport {\n CollectionScopeProvider,\n useAuthController,\n useCustomizationController,\n useData,\n useDataTableController,\n useLargeLayout,\n usePermissions,\n useTranslation\n} from \"@rebasepro/app\";\nimport { ErrorView } from \"@rebasepro/app\";\nimport { Button, DialogActions, PlusIcon, Typography } from \"@rebasepro/ui\";\nimport { IconForView } from \"@rebasepro/app\";\nimport { useSelectionController } from \"../CollectionViewBinding/useSelectionController\";\n\nimport { useColumnIds } from \"@rebasepro/app\";\nimport { useSideDialogContext } from \"../SideDialogs\";\nimport { useAnalyticsController } from \"@rebasepro/app\";\nimport { useUrlController } from \"../../hooks/navigation/contexts/UrlContext\";\nimport { useSidePanel } from \"../../hooks/useSidePanel\";\nimport { findEntitiesByIds } from \"../../util/find_entities_by_ids\";\n\n/** Stable identity, so the effect that propagates the picks does not re-fire. */\nconst EMPTY_ENTITIES: Entity<any>[] = [];\n\n/**\n * @group Components\n */\nexport interface SelectionProps<M extends Record<string, unknown>> {\n\n /**\n * Allow multiple selection of values\n */\n multiselect?: boolean;\n\n /**\n * Entity collection config\n */\n collection?: AdminCollection<M>;\n\n /**\n * Absolute path of the collection.\n * May be not set if this hook is being used in a component and the path is\n * dynamic. If not set, the dialog won't open.\n */\n path: string;\n\n /**\n * If you are opening the dialog for the first time, you can select some\n * entity ids to be displayed first.\n */\n selectedEntityIds?: (string | number)[];\n\n /**\n * If `multiselect` is set to `false`, you will get the selected entity\n * in this callback.\n * @param entity\n * @callback\n */\n onSingleEntitySelected?(entity: Entity<any> | null): void;\n\n /**\n * If `multiselect` is set to `true`, you will get the selected entities\n * in this callback.\n * @param entities\n * @callback\n */\n onMultipleEntitiesSelected?(entities: Entity<any>[]): void;\n\n /**\n * Called once, with the final selection, when the user presses Done.\n *\n * `onMultipleEntitiesSelected` reports every tick as it happens, which is\n * right when the selection *is* the value (a reference field). Use this\n * one instead when acting on the selection writes something — linking\n * rows, say — so a row ticked and then unticked, or a selection cleared,\n * is never acted on.\n * @param entities\n * @callback\n */\n onSelectionDone?(entities: Entity<M>[]): void;\n\n /**\n * Allow selection of entities that pass the given filter only.\n */\n fixedFilter?: FilterValues<string>;\n\n /**\n * Use this description to indicate the user what to do in this dialog.\n */\n description?: React.ReactNode;\n\n /**\n * Maximum number of entities that can be selected.\n */\n maxSelection?: number;\n\n}\n\n/**\n * This component allows to select entities from a given collection.\n * You probably want to open this dialog as a side view using {@link useSelectionTableBinding}\n * @group Components\n */\nexport function SelectionTableBinding<M extends Record<string, unknown>>(\n props: SelectionProps<M>\n) {\n if (!props.collection) {\n return <ErrorView\n error={\"Could not find collection\"}/>\n }\n return <SelectionTableBindingInternal {...props} collection={props.collection} />;\n}\n\nfunction SelectionTableBindingInternal<M extends Record<string, unknown>>(\n {\n onSingleEntitySelected,\n onMultipleEntitiesSelected,\n onSelectionDone,\n multiselect,\n collection,\n path: pathInput,\n selectedEntityIds: selectedEntityIdsProp,\n description,\n fixedFilter,\n maxSelection\n }: SelectionProps<M> & { collection: AdminCollection<M> }) {\n\n const sideDialogContext = useSideDialogContext();\n const sidePanelController = useSidePanel();\n const urlController = useUrlController();\n const analyticsController = useAnalyticsController();\n const { t } = useTranslation();\n\n const path = urlController.resolveDatabasePathsFrom(pathInput);\n\n const dataClient = useData();\n\n const [entitiesDisplayedFirst, setEntitiesDisplayedFirst] = useState<Entity<any>[]>([]);\n\n // Explicitly `<M>`: the hook defaults to `Record<string, unknown>`, and the\n // controller is handed to a table typed `SelectionController<M>`. `Entity<M>`\n // sits on both sides of that interface (`selectedEntities` out,\n // `toggleEntitySelection` in), so the default was never actually assignable\n // here — it only looked fine while the surrounding props gave TypeScript no\n // reason to bind `M` to this component's own parameter.\n const selectionController = useSelectionController<M>();\n\n // The rows picked in this dialog.\n //\n // This surface never enters query mode: it offers no \"select all matching\",\n // because pointing a reference field at every row of a collection is not\n // something anyone means to do, and `maxSelection` could not be enforced\n // against a count nobody has read yet. Every write below goes through\n // `setSelectedEntities`, so the query branch is unreachable here.\n const selectedEntities = selectionController.selection.type === \"entities\"\n ? selectionController.selection.entities\n : EMPTY_ENTITIES;\n\n // Track whether the selection has been initialized to avoid\n // firing onMultipleEntitiesSelected during the initial mount/fetch.\n const selectionInitializedRef = useRef(false);\n\n // Propagate selection changes to the parent callback.\n // This runs after the selectionController state updates, ensuring\n // we always send the correct, non-stale selection to the parent.\n useEffect(() => {\n if (!selectionInitializedRef.current) return;\n if (onMultipleEntitiesSelected) {\n onMultipleEntitiesSelected(selectedEntities);\n }\n }, [selectedEntities]);\n\n /**\n * Fetch initially selected ids\n */\n useEffect(() => {\n let unmounted = false;\n const selectedEntityIds = selectedEntityIdsProp?.map(id => id?.toString()).filter(Boolean);\n if (selectedEntityIds && selectedEntityIds.length > 0 && collection) {\n // One request per 1,000 ids, not one per id (see findEntitiesByIds).\n findEntitiesByIds(dataClient.collection<M>(path), collection, selectedEntityIds)\n .then((found) => {\n if (!unmounted) {\n // In the order given; an id with no row is dropped.\n const result = selectedEntityIds\n .map(id => found.get(id))\n .filter((e): e is Entity<any> => !!e);\n selectionController.setSelectedEntities(result);\n setEntitiesDisplayedFirst(result);\n // Mark initialized after the initial fetch completes\n selectionInitializedRef.current = true;\n }\n });\n } else {\n selectionController.setSelectedEntities([]);\n setEntitiesDisplayedFirst([]);\n selectionInitializedRef.current = true;\n }\n return () => {\n unmounted = true;\n };\n }, [dataClient, path, selectedEntityIdsProp, collection, selectionController.setSelectedEntities]);\n\n const onClear = () => {\n analyticsController.onAnalyticsEvent?.(\"reference_selection_clear\", {\n path\n });\n selectionController.setSelectedEntities([]);\n if (!multiselect && onSingleEntitySelected) {\n onSingleEntitySelected(null);\n }\n };\n\n const onEntityClick = useCallback((entity: Entity<any>) => {\n if (!multiselect && onSingleEntitySelected) {\n analyticsController.onAnalyticsEvent?.(\"reference_selected_single\", {\n path,\n entityId: entity.id\n });\n onSingleEntitySelected(entity);\n sideDialogContext.close(false);\n } else {\n // For multiselect, delegate to the selection controller's toggle.\n // The useEffect above will propagate the change to onMultipleEntitiesSelected.\n analyticsController.onAnalyticsEvent?.(\"reference_selection_toggle\", {\n path,\n entityId: entity.id\n });\n if (selectedEntities.map((e) => e.id).indexOf(entity.id) > -1) {\n selectionController.setSelectedEntities(\n selectedEntities.filter((item: Entity<any>) => item.id !== entity.id)\n );\n } else {\n if (maxSelection && selectedEntities.length >= maxSelection) return;\n selectionController.setSelectedEntities([...selectedEntities, entity]);\n }\n }\n }, [multiselect, onSingleEntitySelected, analyticsController, path, sideDialogContext, selectionController, selectedEntities, maxSelection]);\n\n // create a new entity from within the reference dialog\n const onNewClick = () => {\n analyticsController.onAnalyticsEvent?.(\"reference_selection_new_entity\", {\n path\n });\n sidePanelController.open({\n path: path,\n collection,\n // No URL, for the reason `RelationSelector` does the same: this\n // panel is a step inside the selection dialog, which is itself a\n // step inside whatever form opened it. `useUnsavedChangesDialog`\n // blocks on a *pathname* change, and this panel's path is a\n // different collection from the one being edited — so closing it\n // raced the panel clearing its own dirty flag and answered a\n // successful save with \"There are unsaved changes\", leaving the URL\n // on the target collection. A record that does not exist yet has no\n // address worth restoring anyway.\n updateUrl: false,\n onUpdate: ({ entity }) => {\n setEntitiesDisplayedFirst([entity, ...entitiesDisplayedFirst]);\n onEntityClick(entity);\n },\n closeOnSave: true\n });\n };\n\n const tableRowActionsBuilder = ({\n entity,\n size,\n width,\n frozen\n }: {\n entity: Entity<any>,\n size: CollectionSize,\n width: number,\n frozen?: boolean\n }) => {\n const isSelected = selectionController.isEntitySelected(entity);\n return <CollectionRowActions\n width={width}\n frozen={frozen}\n entity={entity}\n size={size}\n isSelected={isSelected}\n selectionEnabled={multiselect}\n hideId={collection?.hideIdFromCollection}\n path={path}\n selectionController={selectionController}\n openEntityMode={\"side_panel\"}\n />;\n\n };\n\n const onDone = useCallback((event: React.SyntheticEvent) => {\n event.stopPropagation();\n onSelectionDone?.(selectedEntities);\n sideDialogContext.close(false);\n }, [sideDialogContext, onSelectionDone, selectedEntities]);\n\n const displayedColumnIds = useColumnIds(collection, false);\n\n const tableController = useDataTableController<M>({\n path,\n collection,\n entitiesDisplayedFirst,\n fixedFilter,\n updateUrl: false\n });\n\n return (\n\n <CollectionScopeProvider collection={collection}>\n <div className=\"flex flex-col h-full\">\n\n <div className=\"grow\">\n {entitiesDisplayedFirst &&\n <CollectionTableBinding\n additionalFields={collection.additionalFields}\n displayedColumnIds={displayedColumnIds}\n onEntityClick={onEntityClick}\n tableController={tableController}\n enablePopupIcon={false}\n tableRowActionsBuilder={tableRowActionsBuilder}\n openEntityMode={\"side_panel\"}\n title={<Typography variant={\"subtitle2\"} className={\"flex flex-row gap-2\"}>\n <IconForView\n size={\"small\"}\n collectionOrView={collection}\n className={\"text-surface-300 dark:text-surface-600\"}/>\n {collection.singularName\n ? t(\"select_specific\", { name: collection.singularName })\n : t(\"select_from\", { name: collection.name })}\n </Typography>}\n defaultSize={collection.defaultSize}\n properties={collection.properties}\n fixedFilter={fixedFilter}\n inlineEditing={false}\n selectionController={selectionController}\n actions={<EntitySelectionDialogActions\n collection={collection}\n path={path}\n onNewClick={onNewClick}\n onClear={onClear}/>\n }\n />}\n </div>\n <DialogActions translucent={false}>\n {description &&\n <Typography variant={\"body2\"}\n className=\"grow text-left\">\n {description}\n </Typography>}\n <Button\n onClick={onDone}\n variant=\"filled\">\n {t(\"done\")}\n </Button>\n </DialogActions>\n </div>\n </CollectionScopeProvider>\n\n );\n\n}\n\nfunction EntitySelectionDialogActions({\n collection,\n path,\n onClear,\n onNewClick\n}: {\n collection: AdminCollection<any>,\n path: string,\n onClear: () => void,\n onNewClick: () => void\n}) {\n\n const { canCreate } = usePermissions();\n\n const largeLayout = useLargeLayout();\n const { t } = useTranslation();\n\n const onClick: MouseEventHandler<HTMLButtonElement> | undefined = onNewClick\n ? (e) => {\n e.preventDefault();\n onNewClick();\n }\n : undefined;\n const addButton = canCreate(collection, path) &&\n onClick && (largeLayout\n ? <Button\n onClick={onClick}\n startIcon={<PlusIcon/>}>\n {t(\"add_specific\", { name: collection.singularName ?? collection.name })}\n </Button>\n : <Button\n onClick={onClick}>\n <PlusIcon/>\n </Button>);\n\n return (\n <>\n <Button onClick={onClear}\n variant={\"text\"}>\n {t(\"clear\")}\n </Button>\n {addButton}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,IAAM,iBAAgC,CAAC;;;;;;AAiFvC,SAAgB,sBACZ,OACF;CACE,IAAI,CAAC,MAAM,YACP,OAAO,oBAAC,WAAD,EACH,OAAO,4BAA6B,CAAA;CAE5C,OAAO,oBAAC,+BAAD;EAA+B,GAAI;EAAO,YAAY,MAAM;CAAa,CAAA;AACpF;AAEA,SAAS,8BACL,EACI,wBACA,4BACA,iBACA,aACA,YACA,MAAM,WACN,mBAAmB,uBACnB,aACA,aACA,gBACuD;CAE3D,MAAM,oBAAoB,qBAAqB;CAC/C,MAAM,sBAAsB,aAAa;CACzC,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,sBAAsB,uBAAuB;CACnD,MAAM,EAAE,MAAM,eAAe;CAE7B,MAAM,OAAO,cAAc,yBAAyB,SAAS;CAE7D,MAAM,aAAa,QAAQ;CAE3B,MAAM,CAAC,wBAAwB,6BAA6B,SAAwB,CAAC,CAAC;CAQtF,MAAM,sBAAsB,uB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}
@@ -440,9 +440,9 @@ var RelationSelector = React$1.forwardRef(({ value, size = "medium", onValueChan
440
440
  }), /* @__PURE__ */ jsxs("div", {
441
441
  className: "flex items-center flex-shrink-0",
442
442
  children: [!multiple && selectedItems.length === 1 && selectedItems[0]?.data && /* @__PURE__ */ jsx(Tooltip, {
443
- title: `Open ${selectedItems[0].label}`,
443
+ title: t("relation_open_record", { label: selectedItems[0].label }),
444
444
  children: /* @__PURE__ */ jsx(IconButton, {
445
- "aria-label": `Open ${selectedItems[0].label}`,
445
+ "aria-label": t("relation_open_record", { label: selectedItems[0].label }),
446
446
  component: "div",
447
447
  size: "small",
448
448
  className: "opacity-60 hover:opacity-100",