@conloca/cms-spa 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App-Bk1LNxbS.mjs +10851 -0
- package/dist/App-Bk1LNxbS.mjs.map +1 -0
- package/dist/App.d.ts +35 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +52 -0
- package/dist/CmsSpaApp.d.ts +13 -0
- package/dist/CmsSpaApp.d.ts.map +1 -0
- package/dist/CmsSpaApp.js +33 -0
- package/dist/cn-dlASUkDY.mjs +10 -0
- package/dist/cn-dlASUkDY.mjs.map +1 -0
- package/dist/components/CMSDashboard.d.ts +2 -0
- package/dist/components/CMSDashboard.d.ts.map +1 -0
- package/dist/components/CMSDashboard.js +20 -0
- package/dist/components/CMSLayout.d.ts +2 -0
- package/dist/components/CMSLayout.d.ts.map +1 -0
- package/dist/components/CMSLayout.js +15 -0
- package/dist/components/ConlocaLogo.d.ts +2 -0
- package/dist/components/ConlocaLogo.d.ts.map +1 -0
- package/dist/components/ConlocaLogo.js +4 -0
- package/dist/components/GitStatusPanel.d.ts +25 -0
- package/dist/components/GitStatusPanel.d.ts.map +1 -0
- package/dist/components/GitStatusPanel.js +77 -0
- package/dist/components/MobileTopBar.d.ts +6 -0
- package/dist/components/MobileTopBar.d.ts.map +1 -0
- package/dist/components/MobileTopBar.js +6 -0
- package/dist/components/Sidebar.d.ts +8 -0
- package/dist/components/Sidebar.d.ts.map +1 -0
- package/dist/components/Sidebar.js +40 -0
- package/dist/components/UserAvatar.d.ts +2 -0
- package/dist/components/UserAvatar.d.ts.map +1 -0
- package/dist/components/UserAvatar.js +14 -0
- package/dist/components/cards/DataEntryCard.d.ts +14 -0
- package/dist/components/cards/DataEntryCard.d.ts.map +1 -0
- package/dist/components/cards/DataEntryCard.js +32 -0
- package/dist/components/cards/SectionCard.d.ts +15 -0
- package/dist/components/cards/SectionCard.d.ts.map +1 -0
- package/dist/components/cards/SectionCard.js +10 -0
- package/dist/components/cards/index.d.ts +2 -0
- package/dist/components/cards/index.d.ts.map +1 -0
- package/dist/components/cards/index.js +1 -0
- package/dist/components/dashboard/RecentActivity.d.ts +2 -0
- package/dist/components/dashboard/RecentActivity.d.ts.map +1 -0
- package/dist/components/dashboard/RecentActivity.js +58 -0
- package/dist/components/dialog.d.ts +53 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +56 -0
- package/dist/components/dialogs/BlockPropertiesDialog.d.ts +12 -0
- package/dist/components/dialogs/BlockPropertiesDialog.d.ts.map +1 -0
- package/dist/components/dialogs/BlockPropertiesDialog.js +42 -0
- package/dist/components/dialogs/ConflictDialog.d.ts +10 -0
- package/dist/components/dialogs/ConflictDialog.d.ts.map +1 -0
- package/dist/components/dialogs/ConflictDialog.js +29 -0
- package/dist/components/dialogs/CreateDataDialog.d.ts +9 -0
- package/dist/components/dialogs/CreateDataDialog.d.ts.map +1 -0
- package/dist/components/dialogs/CreateDataDialog.js +20 -0
- package/dist/components/dialogs/CreateFolderDialog.d.ts +9 -0
- package/dist/components/dialogs/CreateFolderDialog.d.ts.map +1 -0
- package/dist/components/dialogs/CreateFolderDialog.js +33 -0
- package/dist/components/dialogs/CreatePageDialog.d.ts +10 -0
- package/dist/components/dialogs/CreatePageDialog.d.ts.map +1 -0
- package/dist/components/dialogs/CreatePageDialog.js +155 -0
- package/dist/components/dialogs/DataPropertiesDialog.d.ts +10 -0
- package/dist/components/dialogs/DataPropertiesDialog.d.ts.map +1 -0
- package/dist/components/dialogs/DataPropertiesDialog.js +38 -0
- package/dist/components/dialogs/DeleteConfirmDialog.d.ts +12 -0
- package/dist/components/dialogs/DeleteConfirmDialog.d.ts.map +1 -0
- package/dist/components/dialogs/DeleteConfirmDialog.js +7 -0
- package/dist/components/dialogs/ErrorModal.d.ts +14 -0
- package/dist/components/dialogs/ErrorModal.d.ts.map +1 -0
- package/dist/components/dialogs/ErrorModal.js +38 -0
- package/dist/components/dialogs/MoveFolderDialog.d.ts +11 -0
- package/dist/components/dialogs/MoveFolderDialog.d.ts.map +1 -0
- package/dist/components/dialogs/MoveFolderDialog.js +45 -0
- package/dist/components/dialogs/PageMetadataDialog.d.ts +10 -0
- package/dist/components/dialogs/PageMetadataDialog.d.ts.map +1 -0
- package/dist/components/dialogs/PageMetadataDialog.js +85 -0
- package/dist/components/dialogs/UnsavedChangesDialog.d.ts +8 -0
- package/dist/components/dialogs/UnsavedChangesDialog.d.ts.map +1 -0
- package/dist/components/dialogs/UnsavedChangesDialog.js +6 -0
- package/dist/components/dialogs/index.d.ts +9 -0
- package/dist/components/dialogs/index.d.ts.map +1 -0
- package/dist/components/dialogs/index.js +8 -0
- package/dist/components/editor/BlockEditor.d.ts +8 -0
- package/dist/components/editor/BlockEditor.d.ts.map +1 -0
- package/dist/components/editor/BlockEditor.js +262 -0
- package/dist/components/editor/BlockWrappers.d.ts +15 -0
- package/dist/components/editor/BlockWrappers.d.ts.map +1 -0
- package/dist/components/editor/BlockWrappers.js +29 -0
- package/dist/components/editor/CMSMDXEditor.d.ts +13 -0
- package/dist/components/editor/CMSMDXEditor.d.ts.map +1 -0
- package/dist/components/editor/CMSMDXEditor.js +123 -0
- package/dist/components/editor/ContentDiff.d.ts +10 -0
- package/dist/components/editor/ContentDiff.d.ts.map +1 -0
- package/dist/components/editor/ContentDiff.js +51 -0
- package/dist/components/editor/CreateBlockDialog.d.ts +26 -0
- package/dist/components/editor/CreateBlockDialog.d.ts.map +1 -0
- package/dist/components/editor/CreateBlockDialog.js +131 -0
- package/dist/components/editor/DrawerItemOverride.d.ts +8 -0
- package/dist/components/editor/DrawerItemOverride.d.ts.map +1 -0
- package/dist/components/editor/DrawerItemOverride.js +41 -0
- package/dist/components/editor/EditorChromeToggles.d.ts +16 -0
- package/dist/components/editor/EditorChromeToggles.d.ts.map +1 -0
- package/dist/components/editor/EditorChromeToggles.js +16 -0
- package/dist/components/editor/GenericBlock.d.ts +3 -0
- package/dist/components/editor/GenericBlock.d.ts.map +1 -0
- package/dist/components/editor/GenericBlock.js +1067 -0
- package/dist/components/editor/ImagePickerDialog.d.ts +6 -0
- package/dist/components/editor/ImagePickerDialog.d.ts.map +1 -0
- package/dist/components/editor/ImagePickerDialog.js +24 -0
- package/dist/components/editor/JsxPropsPanel.d.ts +16 -0
- package/dist/components/editor/JsxPropsPanel.d.ts.map +1 -0
- package/dist/components/editor/JsxPropsPanel.js +145 -0
- package/dist/components/editor/LocaleSelector.d.ts +9 -0
- package/dist/components/editor/LocaleSelector.d.ts.map +1 -0
- package/dist/components/editor/LocaleSelector.js +13 -0
- package/dist/components/editor/MDXLivePreview.d.ts +14 -0
- package/dist/components/editor/MDXLivePreview.d.ts.map +1 -0
- package/dist/components/editor/MDXLivePreview.js +103 -0
- package/dist/components/editor/MdxPageEditor.d.ts +10 -0
- package/dist/components/editor/MdxPageEditor.d.ts.map +1 -0
- package/dist/components/editor/MdxPageEditor.js +297 -0
- package/dist/components/editor/PageEditor.d.ts +18 -0
- package/dist/components/editor/PageEditor.d.ts.map +1 -0
- package/dist/components/editor/PageEditor.js +288 -0
- package/dist/components/editor/PageEditorHeaderActions.d.ts +16 -0
- package/dist/components/editor/PageEditorHeaderActions.d.ts.map +1 -0
- package/dist/components/editor/PageEditorHeaderActions.js +19 -0
- package/dist/components/editor/PageEditorWrapper.d.ts +7 -0
- package/dist/components/editor/PageEditorWrapper.d.ts.map +1 -0
- package/dist/components/editor/PageEditorWrapper.js +319 -0
- package/dist/components/editor/SearchableSelect.d.ts +34 -0
- package/dist/components/editor/SearchableSelect.d.ts.map +1 -0
- package/dist/components/editor/SearchableSelect.js +116 -0
- package/dist/components/editor/host-wrapper-plugin.d.ts +51 -0
- package/dist/components/editor/host-wrapper-plugin.d.ts.map +1 -0
- package/dist/components/editor/host-wrapper-plugin.js +37 -0
- package/dist/components/editor/index.d.ts +9 -0
- package/dist/components/editor/index.d.ts.map +1 -0
- package/dist/components/editor/index.js +7 -0
- package/dist/components/editor/insert-menu/InsertMdxComponentButton.d.ts +15 -0
- package/dist/components/editor/insert-menu/InsertMdxComponentButton.d.ts.map +1 -0
- package/dist/components/editor/insert-menu/InsertMdxComponentButton.js +90 -0
- package/dist/components/editor/insert-menu/SlashMenuPlugin.d.ts +12 -0
- package/dist/components/editor/insert-menu/SlashMenuPlugin.d.ts.map +1 -0
- package/dist/components/editor/insert-menu/SlashMenuPlugin.js +106 -0
- package/dist/components/editor/insert-menu/insert-payload.d.ts +76 -0
- package/dist/components/editor/insert-menu/insert-payload.d.ts.map +1 -0
- package/dist/components/editor/insert-menu/insert-payload.js +94 -0
- package/dist/components/editor/insert-menu/mdx-components-plugin.d.ts +8 -0
- package/dist/components/editor/insert-menu/mdx-components-plugin.d.ts.map +1 -0
- package/dist/components/editor/insert-menu/mdx-components-plugin.js +13 -0
- package/dist/components/editors/DataEditor.d.ts +19 -0
- package/dist/components/editors/DataEditor.d.ts.map +1 -0
- package/dist/components/editors/DataEditor.js +139 -0
- package/dist/components/fields/ContentBlockSelectorField.d.ts +14 -0
- package/dist/components/fields/ContentBlockSelectorField.d.ts.map +1 -0
- package/dist/components/fields/ContentBlockSelectorField.js +105 -0
- package/dist/components/fields/ImageField.d.ts +16 -0
- package/dist/components/fields/ImageField.d.ts.map +1 -0
- package/dist/components/fields/ImageField.js +39 -0
- package/dist/components/fields/MDXEditField.d.ts +17 -0
- package/dist/components/fields/MDXEditField.d.ts.map +1 -0
- package/dist/components/fields/MDXEditField.js +28 -0
- package/dist/components/forms/ChipArrayField.d.ts +12 -0
- package/dist/components/forms/ChipArrayField.d.ts.map +1 -0
- package/dist/components/forms/ChipArrayField.js +40 -0
- package/dist/components/forms/HintForm.d.ts +22 -0
- package/dist/components/forms/HintForm.d.ts.map +1 -0
- package/dist/components/forms/HintForm.js +162 -0
- package/dist/components/forms/SchemaForm.d.ts +15 -0
- package/dist/components/forms/SchemaForm.d.ts.map +1 -0
- package/dist/components/forms/SchemaForm.js +106 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +13 -0
- package/dist/components/media/AssetCard.d.ts +14 -0
- package/dist/components/media/AssetCard.d.ts.map +1 -0
- package/dist/components/media/AssetCard.js +31 -0
- package/dist/components/media/AssetDetailSidebar.d.ts +11 -0
- package/dist/components/media/AssetDetailSidebar.d.ts.map +1 -0
- package/dist/components/media/AssetDetailSidebar.js +101 -0
- package/dist/components/media/BulkActionBar.d.ts +9 -0
- package/dist/components/media/BulkActionBar.d.ts.map +1 -0
- package/dist/components/media/BulkActionBar.js +8 -0
- package/dist/components/media/FolderNav.d.ts +7 -0
- package/dist/components/media/FolderNav.d.ts.map +1 -0
- package/dist/components/media/FolderNav.js +12 -0
- package/dist/components/media/FolderTreeSidebar.d.ts +9 -0
- package/dist/components/media/FolderTreeSidebar.d.ts.map +1 -0
- package/dist/components/media/FolderTreeSidebar.js +41 -0
- package/dist/components/media/ImagePicker.d.ts +14 -0
- package/dist/components/media/ImagePicker.d.ts.map +1 -0
- package/dist/components/media/ImagePicker.js +45 -0
- package/dist/components/media/MediaLibrary.d.ts +35 -0
- package/dist/components/media/MediaLibrary.d.ts.map +1 -0
- package/dist/components/media/MediaLibrary.js +100 -0
- package/dist/components/media/MediaToolbar.d.ts +21 -0
- package/dist/components/media/MediaToolbar.d.ts.map +1 -0
- package/dist/components/media/MediaToolbar.js +6 -0
- package/dist/components/media/UploadModal.d.ts +9 -0
- package/dist/components/media/UploadModal.d.ts.map +1 -0
- package/dist/components/media/UploadModal.js +42 -0
- package/dist/components/media/UploadZone.d.ts +8 -0
- package/dist/components/media/UploadZone.d.ts.map +1 -0
- package/dist/components/media/UploadZone.js +22 -0
- package/dist/components/media/index.d.ts +11 -0
- package/dist/components/media/index.d.ts.map +1 -0
- package/dist/components/media/index.js +10 -0
- package/dist/components/pages/BlockList.d.ts +2 -0
- package/dist/components/pages/BlockList.d.ts.map +1 -0
- package/dist/components/pages/BlockList.js +280 -0
- package/dist/components/pages/DataList.d.ts +7 -0
- package/dist/components/pages/DataList.d.ts.map +1 -0
- package/dist/components/pages/DataList.js +244 -0
- package/dist/components/pages/MediaPage.d.ts +8 -0
- package/dist/components/pages/MediaPage.d.ts.map +1 -0
- package/dist/components/pages/MediaPage.js +107 -0
- package/dist/components/pages/PageList.d.ts +7 -0
- package/dist/components/pages/PageList.d.ts.map +1 -0
- package/dist/components/pages/PageList.js +308 -0
- package/dist/components/pages/index.d.ts +3 -0
- package/dist/components/pages/index.d.ts.map +1 -0
- package/dist/components/pages/index.js +2 -0
- package/dist/components/puck/MDXContent.d.ts +10 -0
- package/dist/components/puck/MDXContent.d.ts.map +1 -0
- package/dist/components/puck/MDXContent.js +80 -0
- package/dist/components/puck/index.d.ts +2 -0
- package/dist/components/puck/index.d.ts.map +1 -0
- package/dist/components/puck/index.js +1 -0
- package/dist/components/toast.d.ts +44 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +7 -0
- package/dist/components/ui/Banner.d.ts +76 -0
- package/dist/components/ui/Banner.d.ts.map +1 -0
- package/dist/components/ui/Banner.js +49 -0
- package/dist/components/ui/Button.d.ts +25 -0
- package/dist/components/ui/Button.d.ts.map +1 -0
- package/dist/components/ui/Button.js +33 -0
- package/dist/components/ui/Card.d.ts +72 -0
- package/dist/components/ui/Card.d.ts.map +1 -0
- package/dist/components/ui/Card.js +49 -0
- package/dist/components/ui/FieldError.d.ts +24 -0
- package/dist/components/ui/FieldError.d.ts.map +1 -0
- package/dist/components/ui/FieldError.js +17 -0
- package/dist/components/ui/IconButton.d.ts +13 -0
- package/dist/components/ui/IconButton.d.ts.map +1 -0
- package/dist/components/ui/IconButton.js +10 -0
- package/dist/components/ui/Input.d.ts +37 -0
- package/dist/components/ui/Input.d.ts.map +1 -0
- package/dist/components/ui/Input.js +9 -0
- package/dist/components/ui/SaveIndicator.d.ts +8 -0
- package/dist/components/ui/SaveIndicator.d.ts.map +1 -0
- package/dist/components/ui/SaveIndicator.js +32 -0
- package/dist/components/ui/Select.d.ts +8 -0
- package/dist/components/ui/Select.d.ts.map +1 -0
- package/dist/components/ui/Select.js +9 -0
- package/dist/components/ui/Separator.d.ts +7 -0
- package/dist/components/ui/Separator.d.ts.map +1 -0
- package/dist/components/ui/Separator.js +8 -0
- package/dist/components/ui/Textarea.d.ts +8 -0
- package/dist/components/ui/Textarea.d.ts.map +1 -0
- package/dist/components/ui/Textarea.js +5 -0
- package/dist/components/ui/Tooltip.d.ts +9 -0
- package/dist/components/ui/Tooltip.d.ts.map +1 -0
- package/dist/components/ui/Tooltip.js +7 -0
- package/dist/components/ui/index.d.ts +14 -0
- package/dist/components/ui/index.d.ts.map +1 -0
- package/dist/components/ui/index.js +17 -0
- package/dist/data-schemas.d.mts +0 -1
- package/dist/data-schemas.d.mts.map +1 -1
- package/dist/data-schemas.d.ts +22 -0
- package/dist/data-schemas.d.ts.map +1 -0
- package/dist/data-schemas.js +51 -0
- package/dist/data-schemas.mjs +3 -4
- package/dist/data-schemas.mjs.map +1 -1
- package/dist/dev-entry.d.ts +2 -0
- package/dist/dev-entry.d.ts.map +1 -0
- package/dist/dev-entry.js +19 -0
- package/dist/dialog.d.mts +56 -0
- package/dist/dialog.d.mts.map +1 -0
- package/dist/dialog.mjs +67 -0
- package/dist/dialog.mjs.map +1 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/useCanvasTheme.d.ts +12 -0
- package/dist/hooks/useCanvasTheme.d.ts.map +1 -0
- package/dist/hooks/useCanvasTheme.js +33 -0
- package/dist/hooks/useClickOutside.d.ts +7 -0
- package/dist/hooks/useClickOutside.d.ts.map +1 -0
- package/dist/hooks/useClickOutside.js +18 -0
- package/dist/hooks/useDialogState.d.ts +23 -0
- package/dist/hooks/useDialogState.d.ts.map +1 -0
- package/dist/hooks/useDialogState.js +31 -0
- package/dist/hooks/useEditorPref.d.ts +2 -0
- package/dist/hooks/useEditorPref.d.ts.map +1 -0
- package/dist/hooks/useEditorPref.js +49 -0
- package/dist/hooks/useErrorModal.d.ts +15 -0
- package/dist/hooks/useErrorModal.d.ts.map +1 -0
- package/dist/hooks/useErrorModal.js +35 -0
- package/dist/hooks/useSiteBaseUrl.d.ts +10 -0
- package/dist/hooks/useSiteBaseUrl.d.ts.map +1 -0
- package/dist/hooks/useSiteBaseUrl.js +14 -0
- package/dist/hooks/useTheme.d.ts +13 -0
- package/dist/hooks/useTheme.d.ts.map +1 -0
- package/dist/hooks/useTheme.js +69 -0
- package/dist/hooks/useUnsavedChangesGuard.d.ts +16 -0
- package/dist/hooks/useUnsavedChangesGuard.d.ts.map +1 -0
- package/dist/hooks/useUnsavedChangesGuard.js +29 -0
- package/dist/hooks/useUpload.d.ts +10 -0
- package/dist/hooks/useUpload.d.ts.map +1 -0
- package/dist/hooks/useUpload.js +42 -0
- package/dist/hooks/useUploadFlow.d.ts +42 -0
- package/dist/hooks/useUploadFlow.d.ts.map +1 -0
- package/dist/hooks/useUploadFlow.js +148 -0
- package/dist/host-style-probe.d.ts +22 -0
- package/dist/host-style-probe.d.ts.map +1 -0
- package/dist/host-style-probe.js +508 -0
- package/dist/index.d.mts +165 -48
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.mjs +36 -2
- package/dist/index.mjs.map +1 -0
- package/dist/lib/utils.d.ts +13 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +47 -0
- package/dist/main-spa-781YUplS.mjs +46 -0
- package/dist/main-spa-781YUplS.mjs.map +1 -0
- package/dist/main-spa.d.ts +8 -0
- package/dist/main-spa.d.ts.map +1 -0
- package/dist/main-spa.js +61 -0
- package/dist/main.d.mts +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +13 -0
- package/dist/main.mjs +11 -4998
- package/dist/main.mjs.map +1 -1
- package/dist/mdx-components.d.mts +207 -0
- package/dist/mdx-components.d.mts.map +1 -0
- package/dist/mdx-components.d.ts +204 -0
- package/dist/mdx-components.d.ts.map +1 -0
- package/dist/mdx-components.js +217 -0
- package/dist/mdx-components.mjs +208 -0
- package/dist/mdx-components.mjs.map +1 -0
- package/dist/media/AssetScopePill.d.ts +30 -0
- package/dist/media/AssetScopePill.d.ts.map +1 -0
- package/dist/media/AssetScopePill.js +30 -0
- package/dist/media/MediaIssueBadge.d.ts +33 -0
- package/dist/media/MediaIssueBadge.d.ts.map +1 -0
- package/dist/media/MediaIssueBadge.js +54 -0
- package/dist/media/types.d.ts +101 -0
- package/dist/media/types.d.ts.map +1 -0
- package/dist/media/types.js +1 -0
- package/dist/media/use-asset-scope.d.ts +25 -0
- package/dist/media/use-asset-scope.d.ts.map +1 -0
- package/dist/media/use-asset-scope.js +54 -0
- package/dist/media/use-media-issue.d.ts +24 -0
- package/dist/media/use-media-issue.d.ts.map +1 -0
- package/dist/media/use-media-issue.js +49 -0
- package/dist/mock-puck-config.d.mts +23 -0
- package/dist/mock-puck-config.d.mts.map +1 -0
- package/dist/mock-puck-config.d.ts +21 -0
- package/dist/mock-puck-config.d.ts.map +1 -0
- package/dist/mock-puck-config.js +73 -0
- package/dist/mock-puck-config.mjs +125 -0
- package/dist/mock-puck-config.mjs.map +1 -0
- package/dist/page-schemas.d.mts +139 -6
- package/dist/page-schemas.d.mts.map +1 -1
- package/dist/page-schemas.d.ts +156 -0
- package/dist/page-schemas.d.ts.map +1 -0
- package/dist/page-schemas.js +118 -0
- package/dist/page-schemas.mjs +74 -6
- package/dist/page-schemas.mjs.map +1 -1
- package/dist/puck-config.d.mts +9 -1
- package/dist/puck-config.d.mts.map +1 -1
- package/dist/puck-config.d.ts +31 -0
- package/dist/puck-config.d.ts.map +1 -0
- package/dist/puck-config.js +50 -0
- package/dist/puck-config.mjs +3 -4
- package/dist/puck-config.mjs.map +1 -1
- package/dist/selected-block.d.ts +61 -0
- package/dist/selected-block.d.ts.map +1 -0
- package/dist/selected-block.js +64 -0
- package/dist/site-styles.d.mts +123 -0
- package/dist/site-styles.d.mts.map +1 -0
- package/dist/site-styles.d.ts +121 -0
- package/dist/site-styles.d.ts.map +1 -0
- package/dist/site-styles.js +253 -0
- package/dist/site-styles.mjs +234 -0
- package/dist/site-styles.mjs.map +1 -0
- package/dist/spa/main.css +5497 -4371
- package/dist/toast.d.mts +7 -0
- package/dist/toast.d.mts.map +1 -0
- package/dist/toast.mjs +16 -0
- package/dist/toast.mjs.map +1 -0
- package/dist/types.d.ts +57 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/ui-CIacC6Mv.mjs +318 -0
- package/dist/ui-CIacC6Mv.mjs.map +1 -0
- package/dist/ui-config.d.ts +70 -0
- package/dist/ui-config.d.ts.map +1 -0
- package/dist/ui-config.js +44 -0
- package/dist/ui.d.mts +290 -0
- package/dist/ui.d.mts.map +1 -0
- package/dist/ui.mjs +2 -0
- package/dist/utils/asset-url.d.ts +3 -0
- package/dist/utils/asset-url.d.ts.map +1 -0
- package/dist/utils/asset-url.js +7 -0
- package/dist/utils/cn.d.ts +3 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +5 -0
- package/dist/utils/format-date.d.ts +15 -0
- package/dist/utils/format-date.d.ts.map +1 -0
- package/dist/utils/format-date.js +37 -0
- package/dist/utils/mdast-to-html.d.ts +55 -0
- package/dist/utils/mdast-to-html.d.ts.map +1 -0
- package/dist/utils/mdast-to-html.js +206 -0
- package/dist/utils/mdast-tree.d.ts +104 -0
- package/dist/utils/mdast-tree.d.ts.map +1 -0
- package/dist/utils/mdast-tree.js +285 -0
- package/dist/utils/pageMetadata.d.ts +67 -0
- package/dist/utils/pageMetadata.d.ts.map +1 -0
- package/dist/utils/pageMetadata.js +161 -0
- package/dist/utils/slugify.d.ts +12 -0
- package/dist/utils/slugify.d.ts.map +1 -0
- package/dist/utils/slugify.js +17 -0
- package/dist/utils/zodIntrospect.d.ts +24 -0
- package/dist/utils/zodIntrospect.d.ts.map +1 -0
- package/dist/utils/zodIntrospect.js +88 -0
- package/package.json +153 -35
- package/styles/styles.css.d.ts +2 -0
- package/styles/tailwind-theme.css +126 -0
- package/styles/tailwind-theme.css.d.ts +2 -0
- package/dist/puck-CvjeYQRH.mjs +0 -1533
- package/dist/puck-CvjeYQRH.mjs.map +0 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { localesOf, useSitePages } from '@conloca/content-api-client';
|
|
3
|
+
import { AlertCircle, Clock, FileText, Loader2 } from 'lucide-react';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { Link } from 'react-router-dom';
|
|
6
|
+
import { cn } from '../../utils/cn';
|
|
7
|
+
import { relativeTime } from '../../utils/format-date';
|
|
8
|
+
export function RecentActivity() {
|
|
9
|
+
const { data, isLoading, error } = useSitePages('default');
|
|
10
|
+
const recentPages = useMemo(() => {
|
|
11
|
+
if (!data?.items)
|
|
12
|
+
return [];
|
|
13
|
+
const pages = [];
|
|
14
|
+
for (const entry of data.items) {
|
|
15
|
+
const locales = Array.from(localesOf(entry));
|
|
16
|
+
if (locales.length === 0)
|
|
17
|
+
continue;
|
|
18
|
+
const firstLocale = locales[0];
|
|
19
|
+
let latestModified = new Date(firstLocale.modified);
|
|
20
|
+
for (const loc of locales) {
|
|
21
|
+
const d = new Date(loc.modified);
|
|
22
|
+
if (d > latestModified)
|
|
23
|
+
latestModified = d;
|
|
24
|
+
}
|
|
25
|
+
let status = 'published';
|
|
26
|
+
const now = new Date();
|
|
27
|
+
const publishAt = firstLocale.publishAt ? new Date(firstLocale.publishAt) : null;
|
|
28
|
+
const unpublishAt = firstLocale.unpublishAt ? new Date(firstLocale.unpublishAt) : null;
|
|
29
|
+
if (publishAt && publishAt > now)
|
|
30
|
+
status = 'scheduled';
|
|
31
|
+
else if (unpublishAt && unpublishAt < now)
|
|
32
|
+
status = 'draft';
|
|
33
|
+
pages.push({
|
|
34
|
+
id: entry.id,
|
|
35
|
+
title: firstLocale.meta.title || entry.id,
|
|
36
|
+
path: firstLocale.pathname || '/',
|
|
37
|
+
modified: latestModified,
|
|
38
|
+
status,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return pages.sort((a, b) => b.modified.getTime() - a.modified.getTime()).slice(0, 10);
|
|
42
|
+
}, [data]);
|
|
43
|
+
if (isLoading) {
|
|
44
|
+
return (_jsx("div", { className: "flex items-center justify-center py-8", children: _jsx(Loader2, { className: "h-5 w-5 animate-spin text-grey-05 dark:text-grey-06" }) }));
|
|
45
|
+
}
|
|
46
|
+
if (error) {
|
|
47
|
+
return (_jsxs("div", { className: "text-center py-8", children: [_jsx(AlertCircle, { className: "h-8 w-8 text-red-04 mx-auto mb-2" }), _jsx("p", { className: "text-sm text-grey-05 dark:text-grey-06", children: "Failed to load recent activity" })] }));
|
|
48
|
+
}
|
|
49
|
+
if (recentPages.length === 0) {
|
|
50
|
+
return (_jsxs("div", { className: "text-center py-8", children: [_jsx(FileText, { className: "h-8 w-8 text-grey-06 dark:text-grey-05 mx-auto mb-2" }), _jsx("p", { className: "text-sm text-grey-05 dark:text-grey-06", children: "No pages yet" })] }));
|
|
51
|
+
}
|
|
52
|
+
const statusDot = {
|
|
53
|
+
published: 'bg-green-05',
|
|
54
|
+
draft: 'bg-grey-06',
|
|
55
|
+
scheduled: 'bg-yellow-05',
|
|
56
|
+
};
|
|
57
|
+
return (_jsx("div", { className: "space-y-1", children: recentPages.map((page) => (_jsxs(Link, { to: `/pages/${page.id}`, className: "flex items-center gap-3 px-3 py-2.5 rounded-md hover:bg-grey-11 dark:hover:bg-grey-03 transition-colors group", children: [_jsx("span", { className: cn('h-2 w-2 rounded-full flex-shrink-0', statusDot[page.status]), title: page.status, "aria-label": page.status }), _jsx(FileText, { className: "h-4 w-4 text-grey-06 dark:text-grey-05 flex-shrink-0" }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("span", { className: "block text-[15px] font-medium text-grey-01 dark:text-grey-12 truncate group-hover:text-azure-04 dark:group-hover:text-azure-06 transition-colors", children: page.title }), _jsx("span", { className: "text-xs text-grey-05 dark:text-grey-07 truncate block font-mono", children: page.path })] }), _jsxs("div", { className: "flex items-center gap-1 text-xs text-grey-05 dark:text-grey-06 flex-shrink-0", children: [_jsx(Clock, { className: "h-3 w-3" }), _jsx("span", { children: relativeTime(page.modified) })] })] }, page.id))) }));
|
|
58
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Dialog primitive surface for `@conloca/cms-spa/dialog`.
|
|
5
|
+
*
|
|
6
|
+
* Thin wrappers around `@radix-ui/react-dialog` so consumers share the
|
|
7
|
+
* same overlay/content vocabulary without each one re-mirroring the
|
|
8
|
+
* Radix layout by hand.
|
|
9
|
+
*
|
|
10
|
+
* Shape:
|
|
11
|
+
*
|
|
12
|
+
* - `Root`, `Portal`, `Trigger`, `Close`, `Title`, `Description` are
|
|
13
|
+
* re-exported verbatim from Radix. Consumers pass props directly; no
|
|
14
|
+
* runtime cost over importing Radix.
|
|
15
|
+
* - `Overlay` is a thin wrapper that bakes in the cms-spa overlay
|
|
16
|
+
* recipe (`fixed inset-0 bg-black/50 backdrop-blur-sm`). Consumers
|
|
17
|
+
* supply z-index (and any other layout) via `className`. We
|
|
18
|
+
* deliberately do NOT bake `z-40` so cms-spa's existing dialogs
|
|
19
|
+
* (which never set z) keep their byte-for-byte behavior.
|
|
20
|
+
* - `Content` is a wrapper that takes a `surface` prop:
|
|
21
|
+
* - `surface="overlay"` (default) — cms-spa's existing dialog look
|
|
22
|
+
* (`bg-overlay rounded-lg shadow-lg`). Used by every existing
|
|
23
|
+
* cms-spa dialog (CreatePageDialog, PageMetadataDialog, ...).
|
|
24
|
+
* - `surface="panel"` — for hosts that have their own surface
|
|
25
|
+
* tone and want the dialog to feel "from" that surface rather
|
|
26
|
+
* than competing with it
|
|
27
|
+
* (`bg-white dark:bg-grey-02 border border-grey-09 dark:border-grey-03 rounded-md shadow-lg`).
|
|
28
|
+
*
|
|
29
|
+
* Width and per-dialog padding are caller-provided via `className`
|
|
30
|
+
* (e.g. `w-full max-w-md` for cms-spa; `w-[calc(100vw-2rem)] max-w-md`
|
|
31
|
+
* for the host shell). Common chrome (`p-6 max-h-[90vh]
|
|
32
|
+
* overflow-y-auto`) is baked in.
|
|
33
|
+
*
|
|
34
|
+
* Style provenance: the utility classes baked into the wrappers (e.g.
|
|
35
|
+
* `bg-overlay`, `dark:bg-grey-02`) are scanned out of this file via
|
|
36
|
+
* the `@source "../src/components/dialog.tsx"` directive in
|
|
37
|
+
* `styles/tailwind-theme.css`, so any consumer importing the cms-spa
|
|
38
|
+
* theme contract gets the matching classes generated.
|
|
39
|
+
*/
|
|
40
|
+
export declare const Root: import("react").FC<RadixDialog.DialogProps>;
|
|
41
|
+
export declare const Portal: import("react").FC<RadixDialog.DialogPortalProps>;
|
|
42
|
+
export declare const Trigger: import("react").ForwardRefExoticComponent<RadixDialog.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
43
|
+
export declare const Close: import("react").ForwardRefExoticComponent<RadixDialog.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
44
|
+
export declare const Title: import("react").ForwardRefExoticComponent<RadixDialog.DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
45
|
+
export declare const Description: import("react").ForwardRefExoticComponent<RadixDialog.DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
46
|
+
export type OverlayProps = ComponentProps<typeof RadixDialog.Overlay>;
|
|
47
|
+
export declare function Overlay({ className, ...props }: OverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export type DialogSurface = 'overlay' | 'panel';
|
|
49
|
+
export interface ContentProps extends ComponentProps<typeof RadixDialog.Content> {
|
|
50
|
+
surface?: DialogSurface;
|
|
51
|
+
}
|
|
52
|
+
export declare function Content({ className, surface, ...props }: ContentProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,eAAO,MAAM,IAAI,6CAAmB,CAAC;AACrC,eAAO,MAAM,MAAM,mDAAqB,CAAC;AACzC,eAAO,MAAM,OAAO,8HAAsB,CAAC;AAC3C,eAAO,MAAM,KAAK,4HAAoB,CAAC;AACvC,eAAO,MAAM,KAAK,6HAAoB,CAAC;AACvC,eAAO,MAAM,WAAW,qIAA0B,CAAC;AAEnD,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;AAEtE,wBAAgB,OAAO,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,2CAE5D;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;AAOhD,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC;IAC9E,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,wBAAgB,OAAO,CAAC,EAAE,SAAS,EAAE,OAAmB,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,2CAWjF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
3
|
+
import { cn } from '../utils/cn';
|
|
4
|
+
/**
|
|
5
|
+
* Dialog primitive surface for `@conloca/cms-spa/dialog`.
|
|
6
|
+
*
|
|
7
|
+
* Thin wrappers around `@radix-ui/react-dialog` so consumers share the
|
|
8
|
+
* same overlay/content vocabulary without each one re-mirroring the
|
|
9
|
+
* Radix layout by hand.
|
|
10
|
+
*
|
|
11
|
+
* Shape:
|
|
12
|
+
*
|
|
13
|
+
* - `Root`, `Portal`, `Trigger`, `Close`, `Title`, `Description` are
|
|
14
|
+
* re-exported verbatim from Radix. Consumers pass props directly; no
|
|
15
|
+
* runtime cost over importing Radix.
|
|
16
|
+
* - `Overlay` is a thin wrapper that bakes in the cms-spa overlay
|
|
17
|
+
* recipe (`fixed inset-0 bg-black/50 backdrop-blur-sm`). Consumers
|
|
18
|
+
* supply z-index (and any other layout) via `className`. We
|
|
19
|
+
* deliberately do NOT bake `z-40` so cms-spa's existing dialogs
|
|
20
|
+
* (which never set z) keep their byte-for-byte behavior.
|
|
21
|
+
* - `Content` is a wrapper that takes a `surface` prop:
|
|
22
|
+
* - `surface="overlay"` (default) — cms-spa's existing dialog look
|
|
23
|
+
* (`bg-overlay rounded-lg shadow-lg`). Used by every existing
|
|
24
|
+
* cms-spa dialog (CreatePageDialog, PageMetadataDialog, ...).
|
|
25
|
+
* - `surface="panel"` — for hosts that have their own surface
|
|
26
|
+
* tone and want the dialog to feel "from" that surface rather
|
|
27
|
+
* than competing with it
|
|
28
|
+
* (`bg-white dark:bg-grey-02 border border-grey-09 dark:border-grey-03 rounded-md shadow-lg`).
|
|
29
|
+
*
|
|
30
|
+
* Width and per-dialog padding are caller-provided via `className`
|
|
31
|
+
* (e.g. `w-full max-w-md` for cms-spa; `w-[calc(100vw-2rem)] max-w-md`
|
|
32
|
+
* for the host shell). Common chrome (`p-6 max-h-[90vh]
|
|
33
|
+
* overflow-y-auto`) is baked in.
|
|
34
|
+
*
|
|
35
|
+
* Style provenance: the utility classes baked into the wrappers (e.g.
|
|
36
|
+
* `bg-overlay`, `dark:bg-grey-02`) are scanned out of this file via
|
|
37
|
+
* the `@source "../src/components/dialog.tsx"` directive in
|
|
38
|
+
* `styles/tailwind-theme.css`, so any consumer importing the cms-spa
|
|
39
|
+
* theme contract gets the matching classes generated.
|
|
40
|
+
*/
|
|
41
|
+
export const Root = RadixDialog.Root;
|
|
42
|
+
export const Portal = RadixDialog.Portal;
|
|
43
|
+
export const Trigger = RadixDialog.Trigger;
|
|
44
|
+
export const Close = RadixDialog.Close;
|
|
45
|
+
export const Title = RadixDialog.Title;
|
|
46
|
+
export const Description = RadixDialog.Description;
|
|
47
|
+
export function Overlay({ className, ...props }) {
|
|
48
|
+
return _jsx(RadixDialog.Overlay, { className: cn('fixed inset-0 bg-black/50 backdrop-blur-sm', className), ...props });
|
|
49
|
+
}
|
|
50
|
+
const SURFACE_CLASS = {
|
|
51
|
+
overlay: 'bg-overlay rounded-lg shadow-lg',
|
|
52
|
+
panel: 'bg-white dark:bg-grey-02 border border-grey-09 dark:border-grey-03 rounded-md shadow-lg',
|
|
53
|
+
};
|
|
54
|
+
export function Content({ className, surface = 'overlay', ...props }) {
|
|
55
|
+
return (_jsx(RadixDialog.Content, { className: cn('fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 p-6 max-h-[90vh] overflow-y-auto', SURFACE_CLASS[surface], className), ...props }));
|
|
56
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type BlockEditable } from '@conloca/content-api-client';
|
|
2
|
+
interface BlockPropertiesDialogProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
blockTitle: string;
|
|
5
|
+
currentMeta: BlockEditable;
|
|
6
|
+
onSave: (meta: BlockEditable) => void;
|
|
7
|
+
onCancel: () => void;
|
|
8
|
+
isSaving?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function BlockPropertiesDialog({ isOpen, blockTitle, currentMeta, onSave, onCancel, isSaving, }: BlockPropertiesDialogProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=BlockPropertiesDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockPropertiesDialog.d.ts","sourceRoot":"","sources":["../../../src/components/dialogs/BlockPropertiesDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,6BAA6B,CAAC;AAKtF,UAAU,0BAA0B;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,aAAa,CAAC;IAC3B,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,UAAU,EACV,WAAW,EACX,MAAM,EACN,QAAQ,EACR,QAAQ,GACT,EAAE,0BAA0B,kDA2E5B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { blockEditableSchema } from '@conloca/content-api-client';
|
|
3
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { SchemaForm } from '../forms/SchemaForm';
|
|
5
|
+
import { Button } from '../ui';
|
|
6
|
+
export function BlockPropertiesDialog({ isOpen, blockTitle, currentMeta, onSave, onCancel, isSaving, }) {
|
|
7
|
+
// Convert BlockMeta to form values
|
|
8
|
+
const initialValues = useMemo(() => ({
|
|
9
|
+
title: currentMeta.title || blockTitle,
|
|
10
|
+
description: currentMeta.description || '',
|
|
11
|
+
category: currentMeta.category || '',
|
|
12
|
+
tags: currentMeta.tags || [],
|
|
13
|
+
}), [currentMeta, blockTitle]);
|
|
14
|
+
const [formValues, setFormValues] = useState(initialValues);
|
|
15
|
+
// Reset form when dialog opens with new data
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (isOpen) {
|
|
18
|
+
setFormValues(initialValues);
|
|
19
|
+
}
|
|
20
|
+
}, [isOpen, initialValues]);
|
|
21
|
+
const handleSave = () => {
|
|
22
|
+
// SchemaForm returns tags as array directly
|
|
23
|
+
const tags = formValues.tags || [];
|
|
24
|
+
const filteredTags = tags.filter((tag) => tag.trim().length > 0);
|
|
25
|
+
const meta = {
|
|
26
|
+
title: (formValues.title || '').trim(),
|
|
27
|
+
description: (formValues.description || '').trim() || undefined,
|
|
28
|
+
category: (formValues.category || '').trim() || undefined,
|
|
29
|
+
tags: filteredTags.length > 0 ? filteredTags : undefined,
|
|
30
|
+
};
|
|
31
|
+
onSave(meta);
|
|
32
|
+
};
|
|
33
|
+
const handleKeyDown = (e) => {
|
|
34
|
+
if (e.key === 'Escape') {
|
|
35
|
+
onCancel();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
if (!isOpen)
|
|
39
|
+
return null;
|
|
40
|
+
const canSave = (formValues.title || '').trim().length > 0;
|
|
41
|
+
return (_jsx("div", { className: "fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50", role: "dialog", onKeyDown: handleKeyDown, children: _jsxs("div", { className: "bg-overlay rounded-lg p-6 w-full max-w-md", "data-testid": "properties-dialog", children: [_jsx("h2", { className: "text-xl font-semibold text-grey-01 dark:text-grey-12 mb-4", children: "Edit Block Properties" }), _jsx("div", { className: "mb-4", children: _jsx(SchemaForm, { schema: blockEditableSchema, values: formValues, onChange: setFormValues }) }), _jsxs("div", { className: "flex justify-end gap-3", children: [_jsx(Button, { variant: "outline", onClick: onCancel, disabled: isSaving, children: "Cancel" }), _jsx(Button, { variant: "primary", onClick: handleSave, disabled: !canSave || isSaving, "data-testid": "save-properties-submit", children: isSaving ? 'Saving...' : 'Save' })] })] }) }));
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UpdateResult } from '@conloca/content-api-client';
|
|
2
|
+
interface ConflictDialogProps {
|
|
3
|
+
conflict: UpdateResult;
|
|
4
|
+
onReload: () => void;
|
|
5
|
+
onForceSave: (newEtag: string) => void;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ConflictDialog({ conflict, onReload, onForceSave, onCancel }: ConflictDialogProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=ConflictDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConflictDialog.d.ts","sourceRoot":"","sources":["../../../src/components/dialogs/ConflictDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,mBAAmB,kDAmIhG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
export function ConflictDialog({ conflict, onReload, onForceSave, onCancel }) {
|
|
4
|
+
const [showReloadConfirm, setShowReloadConfirm] = useState(false);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
setShowReloadConfirm(false);
|
|
7
|
+
}, []);
|
|
8
|
+
// Escape key handler
|
|
9
|
+
const handleKeyDown = useCallback((e) => {
|
|
10
|
+
if (e.key === 'Escape')
|
|
11
|
+
onCancel();
|
|
12
|
+
}, [onCancel]);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
15
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
16
|
+
}, [handleKeyDown]);
|
|
17
|
+
if (conflict.success || conflict.reason !== 'stale_write') {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const { conflictDetails } = conflict;
|
|
21
|
+
const hasMetaChanges = conflictDetails?.metaChanged ?? false;
|
|
22
|
+
const hasContentChanges = conflictDetails?.contentChanged ?? false;
|
|
23
|
+
return (_jsx("div", { className: "fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50", children: _jsxs("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": "conflict-dialog-title", className: "bg-overlay rounded-lg p-6 max-w-2xl w-full max-h-[80vh] overflow-y-auto", children: [_jsx("h2", { id: "conflict-dialog-title", className: "text-2xl font-bold mb-4 text-foreground", children: "Conflict Detected" }), _jsxs("div", { className: "mb-6", children: [_jsx("p", { className: "text-foreground mb-2", "data-testid": "conflict-main-message", children: "The content has been modified by another user or process since you started editing." }), conflictDetails && (_jsxs("div", { className: "mt-4 p-4 bg-subtle rounded-md", children: [_jsx("h3", { className: "font-semibold mb-2 text-foreground", children: "Changes detected:" }), hasMetaChanges && hasContentChanges && (_jsx("p", { "data-testid": "conflict-details", children: "Both metadata and content have been modified." })), hasMetaChanges && !hasContentChanges && _jsx("p", { "data-testid": "conflict-details", children: "Only metadata has changed." }), !hasMetaChanges && hasContentChanges && _jsx("p", { "data-testid": "conflict-details", children: "Only content has changed." }), !hasMetaChanges && !hasContentChanges && _jsx("p", { "data-testid": "conflict-details", children: "Content unchanged." })] })), conflictDetails?.currentMeta && (_jsxs("div", { className: "mt-4 p-4 bg-azure-11 dark:bg-azure-02 rounded-md", children: [_jsx("h3", { className: "font-semibold mb-2 text-foreground", children: "Current metadata:" }), _jsx("dl", { className: "space-y-1", children: Object.entries(conflictDetails.currentMeta).map(([key, value]) => (_jsxs("div", { className: "flex", children: [_jsxs("dt", { className: "font-medium capitalize mr-2 text-foreground", children: [key, ":"] }), _jsx("dd", { className: "text-foreground", children: key === 'publishAt' && typeof value === 'string'
|
|
24
|
+
? `Publish on ${new Date(value).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}`
|
|
25
|
+
: String(value) })] }, key))) })] }))] }), showReloadConfirm ? (_jsxs("div", { className: "space-y-4", children: [_jsx("p", { className: "text-red-04 font-medium", "data-testid": "conflict-discard-warning", children: "Are you sure you want to reload? You will lose all unsaved changes." }), _jsxs("div", { className: "flex gap-3", children: [_jsx("button", { type: "button", onClick: () => {
|
|
26
|
+
onReload();
|
|
27
|
+
setShowReloadConfirm(false);
|
|
28
|
+
}, className: "px-4 py-2 bg-red-04 text-white rounded-md hover:bg-red-03", children: "Yes, Reload" }), _jsx("button", { type: "button", onClick: () => setShowReloadConfirm(false), className: "px-4 py-2 bg-grey-05 dark:bg-grey-04 text-white rounded-md hover:bg-grey-04 dark:hover:bg-grey-05", children: "Cancel" })] })] })) : (_jsxs("div", { className: "flex gap-3", children: [_jsx("button", { type: "button", onClick: () => setShowReloadConfirm(true), className: "px-4 py-2 bg-yellow-05 text-white rounded-md hover:bg-yellow-04", children: "Reload and Lose Changes" }), conflict.currentEtag && (_jsx("button", { type: "button", onClick: () => onForceSave(conflict.currentEtag), className: "px-4 py-2 bg-azure-04 text-white rounded-md hover:bg-azure-03", children: "Force Save" })), _jsx("button", { type: "button", onClick: onCancel, className: "px-4 py-2 bg-grey-05 dark:bg-grey-04 text-white rounded-md hover:bg-grey-04 dark:hover:bg-grey-05", children: "Cancel" })] }))] }) }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface CreateDataDialogProps {
|
|
2
|
+
collections: string[];
|
|
3
|
+
isPending: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onCreate: (collection: string, values: Record<string, unknown>) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function CreateDataDialog({ collections, isPending, onClose, onCreate }: CreateDataDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=CreateDataDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateDataDialog.d.ts","sourceRoot":"","sources":["../../../src/components/dialogs/CreateDataDialog.tsx"],"names":[],"mappings":"AAKA,UAAU,qBAAqB;IAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CACzE;AAED,wBAAgB,gBAAgB,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,qBAAqB,2CAyDpG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { dataEditableSchema } from '@conloca/content-api-client';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { SchemaForm } from '../forms/SchemaForm';
|
|
5
|
+
import { Button, Select } from '../ui';
|
|
6
|
+
export function CreateDataDialog({ collections, isPending, onClose, onCreate }) {
|
|
7
|
+
const [selectedCollection, setSelectedCollection] = useState(collections[0] || '');
|
|
8
|
+
const [formValues, setFormValues] = useState({ title: '' });
|
|
9
|
+
const handleCreate = () => {
|
|
10
|
+
const title = (formValues.title || '').trim();
|
|
11
|
+
if (!title || !selectedCollection)
|
|
12
|
+
return;
|
|
13
|
+
onCreate(selectedCollection, formValues);
|
|
14
|
+
};
|
|
15
|
+
const isValid = (formValues.title || '').trim() && selectedCollection;
|
|
16
|
+
return (_jsx("div", { className: "fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50", role: "dialog", onKeyDown: (e) => {
|
|
17
|
+
if (e.key === 'Escape')
|
|
18
|
+
onClose();
|
|
19
|
+
}, children: _jsxs("div", { className: "bg-overlay rounded-lg p-6 w-full max-w-md", "data-testid": "create-data-dialog", children: [_jsx("h2", { className: "text-xl font-semibold text-grey-01 dark:text-grey-12 mb-4", children: "Create New Data Entry" }), _jsxs("div", { className: "mb-4", children: [_jsx("label", { htmlFor: "data-collection", className: "block text-sm font-medium mb-2 text-grey-01 dark:text-grey-12", children: "Collection" }), _jsx(Select, { id: "data-collection", value: selectedCollection, onChange: (e) => setSelectedCollection(e.target.value), children: collections.map((col) => (_jsx("option", { value: col, children: col }, col))) })] }), _jsx("div", { className: "mb-4", children: _jsx(SchemaForm, { schema: dataEditableSchema, values: formValues, onChange: setFormValues }) }), _jsxs("div", { className: "flex justify-end gap-3", children: [_jsx(Button, { variant: "outline", onClick: onClose, children: "Cancel" }), _jsx(Button, { variant: "primary", onClick: handleCreate, disabled: !isValid || isPending, "data-testid": "create-data-submit", children: isPending ? 'Creating...' : 'Create' })] })] }) }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface CreateFolderDialogProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
isPending?: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onCreate: (folderName: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function CreateFolderDialog({ open, isPending, onClose, onCreate }: CreateFolderDialogProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=CreateFolderDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateFolderDialog.d.ts","sourceRoot":"","sources":["../../../src/components/dialogs/CreateFolderDialog.tsx"],"names":[],"mappings":"AAGA,UAAU,uBAAuB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,uBAAuB,kDAqEjG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Button, Input } from '../ui';
|
|
4
|
+
export function CreateFolderDialog({ open, isPending, onClose, onCreate }) {
|
|
5
|
+
const [folderName, setFolderName] = useState('');
|
|
6
|
+
const inputRef = useRef(null);
|
|
7
|
+
// Reset and focus input when dialog opens
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (open) {
|
|
10
|
+
setFolderName('');
|
|
11
|
+
// Focus input after a short delay to ensure dialog is rendered
|
|
12
|
+
setTimeout(() => inputRef.current?.focus(), 50);
|
|
13
|
+
}
|
|
14
|
+
}, [open]);
|
|
15
|
+
const handleCreate = () => {
|
|
16
|
+
const name = folderName.trim();
|
|
17
|
+
if (!name)
|
|
18
|
+
return;
|
|
19
|
+
onCreate(name);
|
|
20
|
+
};
|
|
21
|
+
const handleKeyDown = (e) => {
|
|
22
|
+
if (e.key === 'Escape') {
|
|
23
|
+
onClose();
|
|
24
|
+
}
|
|
25
|
+
else if (e.key === 'Enter' && folderName.trim()) {
|
|
26
|
+
handleCreate();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
if (!open)
|
|
30
|
+
return null;
|
|
31
|
+
const isValid = folderName.trim().length > 0;
|
|
32
|
+
return (_jsx("div", { className: "fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50", role: "dialog", onKeyDown: handleKeyDown, children: _jsxs("div", { className: "bg-overlay rounded-lg p-6 w-full max-w-md", "data-testid": "create-folder-dialog", children: [_jsx("h2", { className: "text-xl font-semibold text-grey-01 dark:text-grey-12 mb-4", children: "Create New Folder" }), _jsxs("div", { className: "mb-4", children: [_jsx("label", { htmlFor: "folder-name", className: "block text-sm font-medium text-grey-01 dark:text-grey-12 mb-2", children: "Folder Name" }), _jsx(Input, { ref: inputRef, id: "folder-name", type: "text", value: folderName, onChange: (e) => setFolderName(e.target.value), placeholder: "Enter folder name", "data-testid": "folder-name-input" })] }), _jsxs("div", { className: "flex justify-end gap-3", children: [_jsx(Button, { variant: "outline", onClick: onClose, children: "Cancel" }), _jsx(Button, { variant: "primary", onClick: handleCreate, disabled: !isValid || isPending, "data-testid": "create-folder-submit", children: isPending ? 'Creating...' : 'Create' })] })] }) }));
|
|
33
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CreatePageData } from '../../types';
|
|
2
|
+
interface CreatePageDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange?: (open: boolean) => void;
|
|
5
|
+
onCreatePage?: (data: CreatePageData) => void;
|
|
6
|
+
site?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function CreatePageDialog({ open, onOpenChange, onCreatePage, site }: CreatePageDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=CreatePageDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreatePageDialog.d.ts","sourceRoot":"","sources":["../../../src/components/dialogs/CreatePageDialog.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,UAAU,qBAAqB;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAgBD,wBAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,IAAgB,EAAE,EAAE,qBAAqB,2CA2T7G"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { normalizeAndValidatePathname } from '@conloca/content-api-client';
|
|
3
|
+
import * as Dialog from '@radix-ui/react-dialog';
|
|
4
|
+
import { AlertCircle, X } from 'lucide-react';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
import { getUIConfig } from '../../ui-config';
|
|
7
|
+
import { slugify } from '../../utils/slugify';
|
|
8
|
+
import { Button, IconButton, Input, Select } from '../ui';
|
|
9
|
+
/**
|
|
10
|
+
* Turn a BCP-47 code like 'en' into a human label like 'English' using
|
|
11
|
+
* the browser's built-in language registry. Falls back to the raw code
|
|
12
|
+
* on platforms where Intl.DisplayNames is unavailable or doesn't
|
|
13
|
+
* recognize the code.
|
|
14
|
+
*/
|
|
15
|
+
function formatLocaleLabel(code) {
|
|
16
|
+
try {
|
|
17
|
+
return new Intl.DisplayNames(['en'], { type: 'language' }).of(code) || code;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return code;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function CreatePageDialog({ open, onOpenChange, onCreatePage, site = 'default' }) {
|
|
24
|
+
// Get config once so format/locale defaults can read from it
|
|
25
|
+
const config = getUIConfig();
|
|
26
|
+
const templates = config.templates || {};
|
|
27
|
+
const templateEntries = Object.entries(templates);
|
|
28
|
+
const mdxEnabled = Boolean(config.mdxPagesEnabled);
|
|
29
|
+
const configuredLocales = config.locales?.list ?? ['en'];
|
|
30
|
+
const defaultLocale = config.locales?.defaultLocale ?? configuredLocales[0] ?? 'en';
|
|
31
|
+
const [title, setTitle] = useState('');
|
|
32
|
+
const [path, setPath] = useState('');
|
|
33
|
+
const [template, setTemplate] = useState('blank');
|
|
34
|
+
const [locale, setLocale] = useState(defaultLocale);
|
|
35
|
+
// Format: 'puck' (visual editor) or 'mdx' (document page). Default to
|
|
36
|
+
// 'puck' to match prior behavior; the MDX option only renders when
|
|
37
|
+
// at least one site in `sites.json` declares an `mdxPages` path.
|
|
38
|
+
const [format, setFormat] = useState('puck');
|
|
39
|
+
// Only collected/shown for MDX pages. Optional — leaving it empty is
|
|
40
|
+
// valid; renderers that surface a description use it when present.
|
|
41
|
+
const [description, setDescription] = useState('');
|
|
42
|
+
const [isPathnameAvailable, setIsPathnameAvailable] = useState(true);
|
|
43
|
+
const [pathnameLoading, setPathnameLoading] = useState(false);
|
|
44
|
+
const [showLoadingText, setShowLoadingText] = useState(false);
|
|
45
|
+
const [pathShapeError, setPathShapeError] = useState(null);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!path) {
|
|
48
|
+
setIsPathnameAvailable(true);
|
|
49
|
+
setPathnameLoading(false);
|
|
50
|
+
setShowLoadingText(false);
|
|
51
|
+
setPathShapeError(null);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
// Run shape validation before hitting the network. If the shape is
|
|
55
|
+
// invalid, surface the error inline and skip the availability check —
|
|
56
|
+
// the backend would reject it anyway with the same reason.
|
|
57
|
+
const validation = normalizeAndValidatePathname(path);
|
|
58
|
+
if (!validation.valid) {
|
|
59
|
+
setPathShapeError(validation.message ?? 'Invalid path');
|
|
60
|
+
setIsPathnameAvailable(true);
|
|
61
|
+
setPathnameLoading(false);
|
|
62
|
+
setShowLoadingText(false);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
setPathShapeError(null);
|
|
66
|
+
const normalized = validation.value;
|
|
67
|
+
// Add a small debounce to avoid rapid consecutive requests
|
|
68
|
+
const timeoutId = setTimeout(async () => {
|
|
69
|
+
setPathnameLoading(true);
|
|
70
|
+
// Show loading text after 500ms delay
|
|
71
|
+
const loadingTextTimeout = setTimeout(() => {
|
|
72
|
+
setShowLoadingText(true);
|
|
73
|
+
}, 500);
|
|
74
|
+
try {
|
|
75
|
+
const config = getUIConfig();
|
|
76
|
+
const baseUrl = config.apiBaseUrl || '/__cms/api';
|
|
77
|
+
const url = `${baseUrl}/${site}/pathname-available?pathname=${encodeURIComponent(normalized)}&locale=${locale}`;
|
|
78
|
+
const response = await fetch(url);
|
|
79
|
+
const text = await response.text();
|
|
80
|
+
try {
|
|
81
|
+
const data = JSON.parse(text);
|
|
82
|
+
setIsPathnameAvailable(data.available);
|
|
83
|
+
}
|
|
84
|
+
catch (parseError) {
|
|
85
|
+
console.error('[CreatePageDialog] Failed to parse response:', parseError, 'Text was:', text);
|
|
86
|
+
throw parseError;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error('Failed to check pathname availability:', error);
|
|
91
|
+
setIsPathnameAvailable(true); // Assume available on error
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
clearTimeout(loadingTextTimeout);
|
|
95
|
+
setPathnameLoading(false);
|
|
96
|
+
setShowLoadingText(false);
|
|
97
|
+
}
|
|
98
|
+
}, 100); // 100ms debounce
|
|
99
|
+
return () => clearTimeout(timeoutId);
|
|
100
|
+
}, [path, site, locale]);
|
|
101
|
+
// Auto-generate path from title, including template prefix if applicable.
|
|
102
|
+
// We read `templates` via getUIConfig() inside the effect so the dep array
|
|
103
|
+
// stays stable — using the component-scope `templates` here would re-run the
|
|
104
|
+
// effect on every render (since `config.templates || {}` creates a fresh
|
|
105
|
+
// empty object each time when no templates are configured), which clobbers
|
|
106
|
+
// manual edits to the path.
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
const slug = slugify(title);
|
|
109
|
+
if (!slug) {
|
|
110
|
+
setPath('');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const templateConfig = getUIConfig().templates?.[template];
|
|
114
|
+
if (templateConfig?.pathPrefix) {
|
|
115
|
+
const prefix = templateConfig.pathPrefix.endsWith('/')
|
|
116
|
+
? templateConfig.pathPrefix
|
|
117
|
+
: `${templateConfig.pathPrefix}/`;
|
|
118
|
+
setPath(`${prefix}${slug}`);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
setPath(`/${slug}`);
|
|
122
|
+
}
|
|
123
|
+
}, [title, template]);
|
|
124
|
+
// Template change handler - path update handled by useEffect above
|
|
125
|
+
const handleTemplateChange = (newTemplate) => {
|
|
126
|
+
setTemplate(newTemplate);
|
|
127
|
+
};
|
|
128
|
+
const handleSubmit = (e) => {
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
// Submit the normalized form so silent fixes (missing leading slash,
|
|
131
|
+
// doubled slashes, trailing slash) reach the API.
|
|
132
|
+
const validation = normalizeAndValidatePathname(path);
|
|
133
|
+
if (!validation.valid) {
|
|
134
|
+
setPathShapeError(validation.message ?? 'Invalid path');
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
onCreatePage?.({
|
|
138
|
+
title,
|
|
139
|
+
path: validation.value,
|
|
140
|
+
template,
|
|
141
|
+
locale,
|
|
142
|
+
format,
|
|
143
|
+
// Only forward description when MDX is chosen — Puck pages don't
|
|
144
|
+
// use it today and we want the payload to stay clean.
|
|
145
|
+
...(format === 'mdx' && description ? { description } : {}),
|
|
146
|
+
});
|
|
147
|
+
onOpenChange?.(false);
|
|
148
|
+
};
|
|
149
|
+
const pathError = Boolean(pathShapeError || (!isPathnameAvailable && path));
|
|
150
|
+
return (_jsx(Dialog.Root, { open: open, onOpenChange: onOpenChange, children: _jsxs(Dialog.Portal, { children: [_jsx(Dialog.Overlay, { className: "fixed inset-0 bg-black/50 backdrop-blur-sm" }), _jsxs(Dialog.Content, { className: "fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-overlay rounded-lg shadow-lg p-6 w-full max-w-md mx-4 max-h-[90vh] overflow-y-auto", "data-testid": "create-page-dialog", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsx(Dialog.Title, { className: "text-lg font-semibold", children: "Create New Page" }), _jsx(Dialog.Close, { asChild: true, children: _jsx(IconButton, { icon: X, ariaLabel: "Close", variant: "ghost" }) })] }), _jsxs("form", { onSubmit: handleSubmit, className: "space-y-4", children: [mdxEnabled && (_jsxs("div", { children: [_jsx("span", { className: "block text-sm font-medium mb-1 text-grey-01 dark:text-grey-12", id: "format-label", children: "Format" }), _jsxs("div", { className: "inline-flex rounded-md border border-grey-09 dark:border-grey-05 overflow-hidden", role: "radiogroup", "aria-labelledby": "format-label", "data-testid": "page-format-radiogroup", children: [_jsx("button", { type: "button", role: "radio", "aria-checked": format === 'puck', onClick: () => setFormat('puck'), className: `px-3 py-1.5 text-sm transition-colors ${format === 'puck'
|
|
151
|
+
? 'bg-azure-04 text-white dark:bg-azure-06'
|
|
152
|
+
: 'bg-transparent text-grey-01 dark:text-grey-12 hover:bg-grey-11 dark:hover:bg-grey-04/40'}`, "data-testid": "page-format-puck", children: "Visual page" }), _jsx("button", { type: "button", role: "radio", "aria-checked": format === 'mdx', onClick: () => setFormat('mdx'), className: `px-3 py-1.5 text-sm transition-colors border-l border-grey-09 dark:border-grey-05 ${format === 'mdx'
|
|
153
|
+
? 'bg-azure-04 text-white dark:bg-azure-06'
|
|
154
|
+
: 'bg-transparent text-grey-01 dark:text-grey-12 hover:bg-grey-11 dark:hover:bg-grey-04/40'}`, "data-testid": "page-format-mdx", children: "Document page (MDX)" })] }), _jsx("p", { className: "text-xs text-grey-04 dark:text-grey-07 mt-1", children: format === 'puck' ? 'Drag-and-drop blocks on a canvas.' : 'Markdown page rendered by the host site.' })] })), _jsxs("div", { children: [_jsx("label", { htmlFor: "title", className: "block text-sm font-medium mb-1 text-grey-01 dark:text-grey-12", children: "Title" }), _jsx(Input, { id: "title", type: "text", value: title, onChange: (e) => setTitle(e.currentTarget.value), required: true, "data-testid": "page-title-input" })] }), format === 'mdx' && (_jsxs("div", { children: [_jsxs("label", { htmlFor: "description", className: "block text-sm font-medium mb-1 text-grey-01 dark:text-grey-12", children: ["Description ", _jsx("span", { className: "text-grey-04 dark:text-grey-07 font-normal", children: "(optional)" })] }), _jsx(Input, { id: "description", type: "text", value: description, onChange: (e) => setDescription(e.currentTarget.value), "data-testid": "page-description-input" }), _jsx("p", { className: "text-xs text-grey-04 dark:text-grey-07 mt-1", children: "Shown in search results and at the top of the page. You can edit it later in the frontmatter." })] })), _jsxs("div", { children: [_jsx("label", { htmlFor: "path", className: "block text-sm font-medium mb-1 text-grey-01 dark:text-grey-12", children: "URL Path" }), _jsxs("div", { className: "relative", children: [_jsx(Input, { id: "path", type: "text", value: path, onChange: (e) => setPath(e.target.value), error: pathError, required: true, "data-testid": "page-path-input" }), pathError && (_jsx("div", { className: "absolute right-2 top-1/2 -translate-y-1/2", children: _jsx(AlertCircle, { className: "h-5 w-5 text-red-04" }) }))] }), _jsxs("div", { className: "h-5 mt-1", children: [pathShapeError && _jsx("p", { className: "text-sm text-red-04", children: pathShapeError }), !pathShapeError && !isPathnameAvailable && path && (_jsx("p", { className: "text-sm text-red-04", children: "This pathname is already in use" })), !pathShapeError && pathnameLoading && showLoadingText && path && (_jsx("p", { className: "text-sm text-grey-04 dark:text-grey-07", children: "Checking availability..." }))] })] }), format === 'puck' && (_jsxs("div", { children: [_jsx("label", { htmlFor: "template", className: "block text-sm font-medium mb-1 text-grey-01 dark:text-grey-12", children: "Template" }), _jsxs(Select, { id: "template", value: template, onChange: (e) => handleTemplateChange(e.target.value), children: [_jsx("option", { value: "blank", children: "Blank" }), templateEntries.map(([key, templateConfig]) => (_jsxs("option", { value: key, children: [templateConfig.label, templateConfig.description ? ` - ${templateConfig.description}` : ''] }, key)))] })] })), configuredLocales.length > 1 && (_jsxs("div", { children: [_jsx("label", { htmlFor: "locale", className: "block text-sm font-medium mb-1 text-grey-01 dark:text-grey-12", children: "Primary Locale" }), _jsx(Select, { id: "locale", value: locale, onChange: (e) => setLocale(e.target.value), children: configuredLocales.map((code) => (_jsx("option", { value: code, children: formatLocaleLabel(code) }, code))) })] })), _jsxs("div", { className: "flex gap-2 pt-4", children: [_jsx(Button, { type: "submit", variant: "primary", disabled: Boolean(pathShapeError) || !isPathnameAvailable || pathnameLoading || !title || !path, className: "flex-1", "data-testid": "create-page-submit", children: "Create" }), _jsx(Dialog.Close, { asChild: true, children: _jsx(Button, { variant: "outline", className: "flex-1", children: "Cancel" }) })] })] })] })] }) }));
|
|
155
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type DataEditable } from '@conloca/content-api-client';
|
|
2
|
+
interface DataPropertiesDialogProps {
|
|
3
|
+
initialMeta: DataEditable;
|
|
4
|
+
isPending: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onSave: (meta: DataEditable) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function DataPropertiesDialog({ initialMeta, isPending, onClose, onSave }: DataPropertiesDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=DataPropertiesDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataPropertiesDialog.d.ts","sourceRoot":"","sources":["../../../src/components/dialogs/DataPropertiesDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,6BAA6B,CAAC;AAKpF,UAAU,yBAAyB;IACjC,WAAW,EAAE,YAAY,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,oBAAoB,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,yBAAyB,2CAuE1G"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { dataEditableSchema } from '@conloca/content-api-client';
|
|
3
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { SchemaForm } from '../forms/SchemaForm';
|
|
5
|
+
import { Button } from '../ui';
|
|
6
|
+
export function DataPropertiesDialog({ initialMeta, isPending, onClose, onSave }) {
|
|
7
|
+
// Convert DataMeta to form values
|
|
8
|
+
const initialValues = useMemo(() => ({
|
|
9
|
+
title: initialMeta.title || '',
|
|
10
|
+
description: initialMeta.description || '',
|
|
11
|
+
category: initialMeta.category || '',
|
|
12
|
+
tags: initialMeta.tags || [],
|
|
13
|
+
}), [initialMeta]);
|
|
14
|
+
const [formValues, setFormValues] = useState(initialValues);
|
|
15
|
+
// Reset form when initialMeta changes (e.g., different entry selected)
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setFormValues(initialValues);
|
|
18
|
+
}, [initialValues]);
|
|
19
|
+
const handleSave = () => {
|
|
20
|
+
// SchemaForm returns tags as array directly
|
|
21
|
+
const tags = formValues.tags || [];
|
|
22
|
+
const filteredTags = tags.filter((tag) => tag.trim().length > 0);
|
|
23
|
+
const meta = {
|
|
24
|
+
title: (formValues.title || '').trim(),
|
|
25
|
+
description: (formValues.description || '').trim() || undefined,
|
|
26
|
+
category: (formValues.category || '').trim() || undefined,
|
|
27
|
+
tags: filteredTags.length > 0 ? filteredTags : undefined,
|
|
28
|
+
};
|
|
29
|
+
onSave(meta);
|
|
30
|
+
};
|
|
31
|
+
const handleKeyDown = (e) => {
|
|
32
|
+
if (e.key === 'Escape') {
|
|
33
|
+
onClose();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const canSave = (formValues.title || '').trim().length > 0;
|
|
37
|
+
return (_jsx("div", { className: "fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50", role: "dialog", onKeyDown: handleKeyDown, children: _jsxs("div", { className: "bg-overlay rounded-lg p-6 w-full max-w-md", "data-testid": "properties-dialog", children: [_jsx("h2", { className: "text-xl font-semibold text-grey-01 dark:text-grey-12 mb-4", children: "Edit Data Properties" }), _jsx("div", { className: "mb-4", children: _jsx(SchemaForm, { schema: dataEditableSchema, values: formValues, onChange: setFormValues }) }), _jsxs("div", { className: "flex justify-end gap-3", children: [_jsx(Button, { variant: "outline", onClick: onClose, disabled: isPending, children: "Cancel" }), _jsx(Button, { variant: "primary", onClick: handleSave, disabled: !canSave || isPending, "data-testid": "save-properties-submit", children: isPending ? 'Saving...' : 'Save' })] })] }) }));
|
|
38
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface DeleteConfirmDialogProps {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
onConfirm: () => void;
|
|
4
|
+
onCancel: () => void;
|
|
5
|
+
title: string;
|
|
6
|
+
message?: string;
|
|
7
|
+
itemName?: string;
|
|
8
|
+
isDeleting?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function DeleteConfirmDialog({ isOpen, onConfirm, onCancel, title, message, itemName, isDeleting, }: DeleteConfirmDialogProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=DeleteConfirmDialog.d.ts.map
|