@orthacms/workspaces-admin 0.0.0-reserve.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.
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/lib/api/useAddWorkspaceContent/index.d.ts +15 -0
- package/dist/lib/api/useAddWorkspaceContent/index.d.ts.map +1 -0
- package/dist/lib/api/useAddWorkspaceMember/index.d.ts +14 -0
- package/dist/lib/api/useAddWorkspaceMember/index.d.ts.map +1 -0
- package/dist/lib/api/useContentTypes/index.d.ts +10 -0
- package/dist/lib/api/useContentTypes/index.d.ts.map +1 -0
- package/dist/lib/api/useCreateWorkspace/index.d.ts +20 -0
- package/dist/lib/api/useCreateWorkspace/index.d.ts.map +1 -0
- package/dist/lib/api/useDeleteWorkspace/index.d.ts +13 -0
- package/dist/lib/api/useDeleteWorkspace/index.d.ts.map +1 -0
- package/dist/lib/api/useRemoveWorkspaceContent/index.d.ts +15 -0
- package/dist/lib/api/useRemoveWorkspaceContent/index.d.ts.map +1 -0
- package/dist/lib/api/useRemoveWorkspaceMember/index.d.ts +13 -0
- package/dist/lib/api/useRemoveWorkspaceMember/index.d.ts.map +1 -0
- package/dist/lib/api/useSetWorkspaceStatus/index.d.ts +14 -0
- package/dist/lib/api/useSetWorkspaceStatus/index.d.ts.map +1 -0
- package/dist/lib/api/useSlugAvailability/index.d.ts +10 -0
- package/dist/lib/api/useSlugAvailability/index.d.ts.map +1 -0
- package/dist/lib/api/useUpdateWorkspace/index.d.ts +23 -0
- package/dist/lib/api/useUpdateWorkspace/index.d.ts.map +1 -0
- package/dist/lib/api/useUsersSearch/index.d.ts +17 -0
- package/dist/lib/api/useUsersSearch/index.d.ts.map +1 -0
- package/dist/lib/api/useWorkspaceContentCount/index.d.ts +8 -0
- package/dist/lib/api/useWorkspaceContentCount/index.d.ts.map +1 -0
- package/dist/lib/api/useWorkspaceEntryCount/index.d.ts +8 -0
- package/dist/lib/api/useWorkspaceEntryCount/index.d.ts.map +1 -0
- package/dist/lib/api/useWorkspaces/index.d.ts +30 -0
- package/dist/lib/api/useWorkspaces/index.d.ts.map +1 -0
- package/dist/lib/application/useAddWorkspaceContent/index.d.ts +9 -0
- package/dist/lib/application/useAddWorkspaceContent/index.d.ts.map +1 -0
- package/dist/lib/application/useAddWorkspaceContent/index.js +15 -0
- package/dist/lib/application/useAddWorkspaceMember/index.d.ts +8 -0
- package/dist/lib/application/useAddWorkspaceMember/index.d.ts.map +1 -0
- package/dist/lib/application/useAddWorkspaceMember/index.js +14 -0
- package/dist/lib/application/useContentTypes/index.d.ts +9 -0
- package/dist/lib/application/useContentTypes/index.d.ts.map +1 -0
- package/dist/lib/application/useContentTypes/index.js +16 -0
- package/dist/lib/application/useCreateWorkspace/index.d.ts +20 -0
- package/dist/lib/application/useCreateWorkspace/index.d.ts.map +1 -0
- package/dist/lib/application/useCreateWorkspace/index.js +44 -0
- package/dist/lib/application/useCreateWorkspaceFlow/index.d.ts +23 -0
- package/dist/lib/application/useCreateWorkspaceFlow/index.d.ts.map +1 -0
- package/dist/lib/application/useCreateWorkspaceFlow/index.js +81 -0
- package/dist/lib/application/useDeleteWorkspace/index.d.ts +13 -0
- package/dist/lib/application/useDeleteWorkspace/index.d.ts.map +1 -0
- package/dist/lib/application/useDeleteWorkspace/index.js +23 -0
- package/dist/lib/application/useRemoveWorkspaceContent/index.d.ts +9 -0
- package/dist/lib/application/useRemoveWorkspaceContent/index.d.ts.map +1 -0
- package/dist/lib/application/useRemoveWorkspaceContent/index.js +15 -0
- package/dist/lib/application/useRemoveWorkspaceMember/index.d.ts +8 -0
- package/dist/lib/application/useRemoveWorkspaceMember/index.d.ts.map +1 -0
- package/dist/lib/application/useRemoveWorkspaceMember/index.js +14 -0
- package/dist/lib/application/useSetWorkspaceStatus/index.d.ts +9 -0
- package/dist/lib/application/useSetWorkspaceStatus/index.d.ts.map +1 -0
- package/dist/lib/application/useSetWorkspaceStatus/index.js +15 -0
- package/dist/lib/application/useSlugAvailability/index.d.ts +18 -0
- package/dist/lib/application/useSlugAvailability/index.d.ts.map +1 -0
- package/dist/lib/application/useSlugAvailability/index.js +39 -0
- package/dist/lib/application/useUpdateWorkspace/index.d.ts +9 -0
- package/dist/lib/application/useUpdateWorkspace/index.d.ts.map +1 -0
- package/dist/lib/application/useUpdateWorkspace/index.js +15 -0
- package/dist/lib/application/useUsersSearch/index.d.ts +18 -0
- package/dist/lib/application/useUsersSearch/index.d.ts.map +1 -0
- package/dist/lib/application/useUsersSearch/index.js +24 -0
- package/dist/lib/application/useWorkspaceContentCount/index.d.ts +8 -0
- package/dist/lib/application/useWorkspaceContentCount/index.d.ts.map +1 -0
- package/dist/lib/application/useWorkspaceContentCount/index.js +17 -0
- package/dist/lib/application/useWorkspaceEntryCount/index.d.ts +8 -0
- package/dist/lib/application/useWorkspaceEntryCount/index.d.ts.map +1 -0
- package/dist/lib/application/useWorkspaceEntryCount/index.js +17 -0
- package/dist/lib/application/useWorkspaces/index.d.ts +5 -0
- package/dist/lib/application/useWorkspaces/index.d.ts.map +1 -0
- package/dist/lib/application/useWorkspaces/index.js +11 -0
- package/dist/lib/components/BlockingConfirmDialog/index.d.ts +41 -0
- package/dist/lib/components/BlockingConfirmDialog/index.d.ts.map +1 -0
- package/dist/lib/components/ColorSwatchRow/index.d.ts +15 -0
- package/dist/lib/components/ColorSwatchRow/index.d.ts.map +1 -0
- package/dist/lib/components/CreateWorkspaceWizard/ColorSwatchRow/index.d.ts +15 -0
- package/dist/lib/components/CreateWorkspaceWizard/ColorSwatchRow/index.d.ts.map +1 -0
- package/dist/lib/components/CreateWorkspaceWizard/ContentStep/ModeTiles/index.d.ts +11 -0
- package/dist/lib/components/CreateWorkspaceWizard/ContentStep/ModeTiles/index.d.ts.map +1 -0
- package/dist/lib/components/CreateWorkspaceWizard/ContentStep/ResourceSection/index.d.ts +48 -0
- package/dist/lib/components/CreateWorkspaceWizard/ContentStep/ResourceSection/index.d.ts.map +1 -0
- package/dist/lib/components/CreateWorkspaceWizard/ContentStep/index.d.ts +23 -0
- package/dist/lib/components/CreateWorkspaceWizard/ContentStep/index.d.ts.map +1 -0
- package/dist/lib/components/CreateWorkspaceWizard/IdentityFields/index.d.ts +17 -0
- package/dist/lib/components/CreateWorkspaceWizard/IdentityFields/index.d.ts.map +1 -0
- package/dist/lib/components/CreateWorkspaceWizard/MembersStep/MemberRow/index.d.ts +14 -0
- package/dist/lib/components/CreateWorkspaceWizard/MembersStep/MemberRow/index.d.ts.map +1 -0
- package/dist/lib/components/CreateWorkspaceWizard/MembersStep/MemberTypeahead/index.d.ts +15 -0
- package/dist/lib/components/CreateWorkspaceWizard/MembersStep/MemberTypeahead/index.d.ts.map +1 -0
- package/dist/lib/components/CreateWorkspaceWizard/MembersStep/index.d.ts +17 -0
- package/dist/lib/components/CreateWorkspaceWizard/MembersStep/index.d.ts.map +1 -0
- package/dist/lib/components/CreateWorkspaceWizard/Monogram/index.d.ts +17 -0
- package/dist/lib/components/CreateWorkspaceWizard/Monogram/index.d.ts.map +1 -0
- package/dist/lib/components/CreateWorkspaceWizard/SlugField/index.d.ts +23 -0
- package/dist/lib/components/CreateWorkspaceWizard/SlugField/index.d.ts.map +1 -0
- package/dist/lib/components/StatusChip/index.d.ts +9 -0
- package/dist/lib/components/StatusChip/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceAvatar/index.d.ts +20 -0
- package/dist/lib/components/WorkspaceAvatar/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceCard/MemberStack/MemberListPopover/index.d.ts +9 -0
- package/dist/lib/components/WorkspaceCard/MemberStack/MemberListPopover/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceCard/MemberStack/index.d.ts +11 -0
- package/dist/lib/components/WorkspaceCard/MemberStack/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceCard/StatusChip/index.d.ts +9 -0
- package/dist/lib/components/WorkspaceCard/StatusChip/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceCard/index.d.ts +15 -0
- package/dist/lib/components/WorkspaceCard/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceCommands/index.d.ts +8 -0
- package/dist/lib/components/WorkspaceCommands/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceContentSettings/AddContentDialog/index.d.ts +26 -0
- package/dist/lib/components/WorkspaceContentSettings/AddContentDialog/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceContentSettings/GrantedContentGroup/index.d.ts +21 -0
- package/dist/lib/components/WorkspaceContentSettings/GrantedContentGroup/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceContentSettings/GrantedContentRow/index.d.ts +26 -0
- package/dist/lib/components/WorkspaceContentSettings/GrantedContentRow/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceContentSettings/RemoveContentDialog/index.d.ts +25 -0
- package/dist/lib/components/WorkspaceContentSettings/RemoveContentDialog/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceContentSettings/index.d.ts +25 -0
- package/dist/lib/components/WorkspaceContentSettings/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceDangerSettings/DeleteWorkspaceDialog/index.d.ts +22 -0
- package/dist/lib/components/WorkspaceDangerSettings/DeleteWorkspaceDialog/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceDangerSettings/index.d.ts +18 -0
- package/dist/lib/components/WorkspaceDangerSettings/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceGeneralSettings/index.d.ts +18 -0
- package/dist/lib/components/WorkspaceGeneralSettings/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceMembersSettings/MemberDirectorySearch/index.d.ts +18 -0
- package/dist/lib/components/WorkspaceMembersSettings/MemberDirectorySearch/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceMembersSettings/MemberListRow/index.d.ts +17 -0
- package/dist/lib/components/WorkspaceMembersSettings/MemberListRow/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceMembersSettings/index.d.ts +16 -0
- package/dist/lib/components/WorkspaceMembersSettings/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceNav/WorkspaceNavButton/index.d.ts +14 -0
- package/dist/lib/components/WorkspaceNav/WorkspaceNavButton/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceNav/WorkspaceSwitcher/index.d.ts +16 -0
- package/dist/lib/components/WorkspaceNav/WorkspaceSwitcher/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceNav/index.d.ts +14 -0
- package/dist/lib/components/WorkspaceNav/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceSettingsRail/index.d.ts +14 -0
- package/dist/lib/components/WorkspaceSettingsRail/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceSettingsTabs/index.d.ts +14 -0
- package/dist/lib/components/WorkspaceSettingsTabs/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceSettingsTopBar/index.d.ts +8 -0
- package/dist/lib/components/WorkspaceSettingsTopBar/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceShell/NewWorkspaceButton/index.d.ts +7 -0
- package/dist/lib/components/WorkspaceShell/NewWorkspaceButton/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceShell/RailTooltip/index.d.ts +22 -0
- package/dist/lib/components/WorkspaceShell/RailTooltip/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceShell/WorkspaceRail/index.d.ts +17 -0
- package/dist/lib/components/WorkspaceShell/WorkspaceRail/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceShell/WorkspaceSidebarButton/index.d.ts +17 -0
- package/dist/lib/components/WorkspaceShell/WorkspaceSidebarButton/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceShell/WorkspaceSwitcher/WorkspaceSwitcherPopover/index.d.ts +26 -0
- package/dist/lib/components/WorkspaceShell/WorkspaceSwitcher/WorkspaceSwitcherPopover/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceShell/WorkspaceSwitcher/index.d.ts +17 -0
- package/dist/lib/components/WorkspaceShell/WorkspaceSwitcher/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceShell/index.d.ts +16 -0
- package/dist/lib/components/WorkspaceShell/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceStats/index.d.ts +9 -0
- package/dist/lib/components/WorkspaceStats/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspaceToolbar/index.d.ts +22 -0
- package/dist/lib/components/WorkspaceToolbar/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspacesEmpty/index.d.ts +18 -0
- package/dist/lib/components/WorkspacesEmpty/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspacesHomePanel/index.d.ts +7 -0
- package/dist/lib/components/WorkspacesHomePanel/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspacesNavSection/index.d.ts +9 -0
- package/dist/lib/components/WorkspacesNavSection/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspacesSkeleton/index.d.ts +36 -0
- package/dist/lib/components/WorkspacesSkeleton/index.d.ts.map +1 -0
- package/dist/lib/components/WorkspacesTable/index.d.ts +12 -0
- package/dist/lib/components/WorkspacesTable/index.d.ts.map +1 -0
- package/dist/lib/domain/isActiveWorkspace/index.d.ts +9 -0
- package/dist/lib/domain/isActiveWorkspace/index.d.ts.map +1 -0
- package/dist/lib/domain/isActiveWorkspace/index.js +9 -0
- package/dist/lib/domain/permissions/index.d.ts +7 -0
- package/dist/lib/domain/permissions/index.d.ts.map +1 -0
- package/dist/lib/domain/permissions/index.js +6 -0
- package/dist/lib/domain/resourceSelection/index.d.ts +18 -0
- package/dist/lib/domain/resourceSelection/index.d.ts.map +1 -0
- package/dist/lib/domain/resourceSelection/index.js +49 -0
- package/dist/lib/domain/slug/index.d.ts +25 -0
- package/dist/lib/domain/slug/index.d.ts.map +1 -0
- package/dist/lib/domain/slug/index.js +45 -0
- package/dist/lib/domain/types/wizard/index.d.ts +126 -0
- package/dist/lib/domain/types/wizard/index.d.ts.map +1 -0
- package/dist/lib/domain/types/wizard/index.js +21 -0
- package/dist/lib/domain/types/workspace/index.d.ts +42 -0
- package/dist/lib/domain/types/workspace/index.d.ts.map +1 -0
- package/dist/lib/domain/types/workspace/index.js +1 -0
- package/dist/lib/domain/workspaceLimits/index.d.ts +23 -0
- package/dist/lib/domain/workspaceLimits/index.d.ts.map +1 -0
- package/dist/lib/domain/workspaceLimits/index.js +22 -0
- package/dist/lib/hooks/useBasicsSchema/index.d.ts +14 -0
- package/dist/lib/hooks/useBasicsSchema/index.d.ts.map +1 -0
- package/dist/lib/hooks/useResourceSelection/index.d.ts +21 -0
- package/dist/lib/hooks/useResourceSelection/index.d.ts.map +1 -0
- package/dist/lib/hooks/useSlug/index.d.ts +28 -0
- package/dist/lib/hooks/useSlug/index.d.ts.map +1 -0
- package/dist/lib/hooks/useWizard/index.d.ts +57 -0
- package/dist/lib/hooks/useWizard/index.d.ts.map +1 -0
- package/dist/lib/hooks/useWorkspaceProfileSchema/index.d.ts +13 -0
- package/dist/lib/hooks/useWorkspaceProfileSchema/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/buildCreateWorkspaceBody/index.d.ts +12 -0
- package/dist/lib/infrastructure/buildCreateWorkspaceBody/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/buildCreateWorkspaceBody/index.js +27 -0
- package/dist/lib/infrastructure/httpWorkspaceGateway/index.d.ts +10 -0
- package/dist/lib/infrastructure/httpWorkspaceGateway/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/httpWorkspaceGateway/index.js +149 -0
- package/dist/lib/infrastructure/isConflict/index.d.ts +8 -0
- package/dist/lib/infrastructure/isConflict/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/isConflict/index.js +12 -0
- package/dist/lib/infrastructure/workspaceGateway/index.d.ts +90 -0
- package/dist/lib/infrastructure/workspaceGateway/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/workspaceGateway/index.js +1 -0
- package/dist/lib/infrastructure/workspaceMapper/index.d.ts +28 -0
- package/dist/lib/infrastructure/workspaceMapper/index.d.ts.map +1 -0
- package/dist/lib/infrastructure/workspaceMapper/index.js +36 -0
- package/dist/lib/pages/CreateWorkspacePage/index.d.ts +7 -0
- package/dist/lib/pages/CreateWorkspacePage/index.d.ts.map +1 -0
- package/dist/lib/pages/WorkspaceSettingsPage/index.d.ts +12 -0
- package/dist/lib/pages/WorkspaceSettingsPage/index.d.ts.map +1 -0
- package/dist/lib/pages/WorkspacesPage/index.d.ts +7 -0
- package/dist/lib/pages/WorkspacesPage/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/BlockingConfirmDialog/index.d.ts +41 -0
- package/dist/lib/presentation/components/BlockingConfirmDialog/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/BlockingConfirmDialog/index.js +17 -0
- package/dist/lib/presentation/components/ColorSwatchRow/index.d.ts +22 -0
- package/dist/lib/presentation/components/ColorSwatchRow/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/ColorSwatchRow/index.js +70 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/ContentStep/ModeTiles/index.d.ts +11 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/ContentStep/ModeTiles/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/ContentStep/ModeTiles/index.js +47 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/ContentStep/ResourceSection/index.d.ts +48 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/ContentStep/ResourceSection/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/ContentStep/ResourceSection/index.js +32 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/ContentStep/index.d.ts +23 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/ContentStep/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/ContentStep/index.js +128 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/IdentityFields/index.d.ts +17 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/IdentityFields/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/IdentityFields/index.js +70 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/MembersStep/MemberRow/index.d.ts +14 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/MembersStep/MemberRow/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/MembersStep/MemberRow/index.js +25 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/MembersStep/MemberTypeahead/index.d.ts +15 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/MembersStep/MemberTypeahead/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/MembersStep/MemberTypeahead/index.js +112 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/MembersStep/index.d.ts +17 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/MembersStep/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/MembersStep/index.js +35 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/Monogram/index.d.ts +17 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/Monogram/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/Monogram/index.js +11 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/SlugField/index.d.ts +23 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/SlugField/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/CreateWorkspaceWizard/SlugField/index.js +68 -0
- package/dist/lib/presentation/components/StatusChip/index.d.ts +9 -0
- package/dist/lib/presentation/components/StatusChip/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/StatusChip/index.js +23 -0
- package/dist/lib/presentation/components/WorkspaceAvatar/index.d.ts +20 -0
- package/dist/lib/presentation/components/WorkspaceAvatar/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceAvatar/index.js +10 -0
- package/dist/lib/presentation/components/WorkspaceCommands/index.d.ts +8 -0
- package/dist/lib/presentation/components/WorkspaceCommands/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceCommands/index.js +34 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/AddContentDialog/index.d.ts +26 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/AddContentDialog/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/AddContentDialog/index.js +89 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/GrantedContentGroup/index.d.ts +21 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/GrantedContentGroup/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/GrantedContentGroup/index.js +11 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/GrantedContentRow/index.d.ts +26 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/GrantedContentRow/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/GrantedContentRow/index.js +31 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/RemoveContentDialog/index.d.ts +25 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/RemoveContentDialog/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/RemoveContentDialog/index.js +48 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/index.d.ts +25 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceContentSettings/index.js +173 -0
- package/dist/lib/presentation/components/WorkspaceDangerSettings/DeleteWorkspaceDialog/index.d.ts +22 -0
- package/dist/lib/presentation/components/WorkspaceDangerSettings/DeleteWorkspaceDialog/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceDangerSettings/DeleteWorkspaceDialog/index.js +52 -0
- package/dist/lib/presentation/components/WorkspaceDangerSettings/index.d.ts +18 -0
- package/dist/lib/presentation/components/WorkspaceDangerSettings/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceDangerSettings/index.js +150 -0
- package/dist/lib/presentation/components/WorkspaceGeneralSettings/WorkspaceIdField/index.d.ts +19 -0
- package/dist/lib/presentation/components/WorkspaceGeneralSettings/WorkspaceIdField/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceGeneralSettings/WorkspaceIdField/index.js +72 -0
- package/dist/lib/presentation/components/WorkspaceGeneralSettings/index.d.ts +18 -0
- package/dist/lib/presentation/components/WorkspaceGeneralSettings/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceGeneralSettings/index.js +131 -0
- package/dist/lib/presentation/components/WorkspaceMembersSettings/MemberDirectorySearch/index.d.ts +18 -0
- package/dist/lib/presentation/components/WorkspaceMembersSettings/MemberDirectorySearch/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceMembersSettings/MemberDirectorySearch/index.js +65 -0
- package/dist/lib/presentation/components/WorkspaceMembersSettings/MemberListRow/index.d.ts +17 -0
- package/dist/lib/presentation/components/WorkspaceMembersSettings/MemberListRow/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceMembersSettings/MemberListRow/index.js +22 -0
- package/dist/lib/presentation/components/WorkspaceMembersSettings/index.d.ts +16 -0
- package/dist/lib/presentation/components/WorkspaceMembersSettings/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceMembersSettings/index.js +127 -0
- package/dist/lib/presentation/components/WorkspaceNav/WorkspaceNavButton/index.d.ts +14 -0
- package/dist/lib/presentation/components/WorkspaceNav/WorkspaceNavButton/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceNav/WorkspaceNavButton/index.js +30 -0
- package/dist/lib/presentation/components/WorkspaceNav/WorkspaceSwitcher/index.d.ts +16 -0
- package/dist/lib/presentation/components/WorkspaceNav/WorkspaceSwitcher/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceNav/WorkspaceSwitcher/index.js +81 -0
- package/dist/lib/presentation/components/WorkspaceNav/index.d.ts +14 -0
- package/dist/lib/presentation/components/WorkspaceNav/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceNav/index.js +51 -0
- package/dist/lib/presentation/components/WorkspaceSettingsTabs/index.d.ts +14 -0
- package/dist/lib/presentation/components/WorkspaceSettingsTabs/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceSettingsTabs/index.js +66 -0
- package/dist/lib/presentation/components/WorkspaceSettingsTopBar/index.d.ts +8 -0
- package/dist/lib/presentation/components/WorkspaceSettingsTopBar/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceSettingsTopBar/index.js +57 -0
- package/dist/lib/presentation/components/WorkspaceShell/index.d.ts +16 -0
- package/dist/lib/presentation/components/WorkspaceShell/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceShell/index.js +100 -0
- package/dist/lib/presentation/components/WorkspaceStats/index.d.ts +9 -0
- package/dist/lib/presentation/components/WorkspaceStats/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceStats/index.js +48 -0
- package/dist/lib/presentation/components/WorkspaceToolbar/index.d.ts +22 -0
- package/dist/lib/presentation/components/WorkspaceToolbar/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspaceToolbar/index.js +73 -0
- package/dist/lib/presentation/components/WorkspacesEmpty/index.d.ts +18 -0
- package/dist/lib/presentation/components/WorkspacesEmpty/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspacesEmpty/index.js +42 -0
- package/dist/lib/presentation/components/WorkspacesHomePanel/index.d.ts +7 -0
- package/dist/lib/presentation/components/WorkspacesHomePanel/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspacesHomePanel/index.js +50 -0
- package/dist/lib/presentation/components/WorkspacesNavSection/index.d.ts +15 -0
- package/dist/lib/presentation/components/WorkspacesNavSection/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspacesNavSection/index.js +76 -0
- package/dist/lib/presentation/components/WorkspacesSkeleton/index.d.ts +49 -0
- package/dist/lib/presentation/components/WorkspacesSkeleton/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspacesSkeleton/index.js +94 -0
- package/dist/lib/presentation/components/WorkspacesTable/index.d.ts +12 -0
- package/dist/lib/presentation/components/WorkspacesTable/index.d.ts.map +1 -0
- package/dist/lib/presentation/components/WorkspacesTable/index.js +58 -0
- package/dist/lib/presentation/currentWorkspace/index.d.ts +17 -0
- package/dist/lib/presentation/currentWorkspace/index.d.ts.map +1 -0
- package/dist/lib/presentation/currentWorkspace/index.js +44 -0
- package/dist/lib/presentation/hooks/useBasicsSchema/index.d.ts +17 -0
- package/dist/lib/presentation/hooks/useBasicsSchema/index.d.ts.map +1 -0
- package/dist/lib/presentation/hooks/useBasicsSchema/index.js +71 -0
- package/dist/lib/presentation/hooks/useComboboxList/index.d.ts +44 -0
- package/dist/lib/presentation/hooks/useComboboxList/index.d.ts.map +1 -0
- package/dist/lib/presentation/hooks/useComboboxList/index.js +62 -0
- package/dist/lib/presentation/hooks/useRedirectNotice/index.d.ts +24 -0
- package/dist/lib/presentation/hooks/useRedirectNotice/index.d.ts.map +1 -0
- package/dist/lib/presentation/hooks/useRedirectNotice/index.js +37 -0
- package/dist/lib/presentation/hooks/useResourceSelection/index.d.ts +21 -0
- package/dist/lib/presentation/hooks/useResourceSelection/index.d.ts.map +1 -0
- package/dist/lib/presentation/hooks/useResourceSelection/index.js +16 -0
- package/dist/lib/presentation/hooks/useSlug/index.d.ts +28 -0
- package/dist/lib/presentation/hooks/useSlug/index.d.ts.map +1 -0
- package/dist/lib/presentation/hooks/useSlug/index.js +18 -0
- package/dist/lib/presentation/hooks/useWizard/index.d.ts +60 -0
- package/dist/lib/presentation/hooks/useWizard/index.d.ts.map +1 -0
- package/dist/lib/presentation/hooks/useWizard/index.js +93 -0
- package/dist/lib/presentation/hooks/useWorkspaceProfileSchema/index.d.ts +16 -0
- package/dist/lib/presentation/hooks/useWorkspaceProfileSchema/index.d.ts.map +1 -0
- package/dist/lib/presentation/hooks/useWorkspaceProfileSchema/index.js +53 -0
- package/dist/lib/presentation/pages/CreateWorkspacePage/index.d.ts +7 -0
- package/dist/lib/presentation/pages/CreateWorkspacePage/index.d.ts.map +1 -0
- package/dist/lib/presentation/pages/CreateWorkspacePage/index.js +248 -0
- package/dist/lib/presentation/pages/WorkspaceSettingsPage/index.d.ts +12 -0
- package/dist/lib/presentation/pages/WorkspaceSettingsPage/index.d.ts.map +1 -0
- package/dist/lib/presentation/pages/WorkspaceSettingsPage/index.js +69 -0
- package/dist/lib/presentation/pages/WorkspacesPage/index.d.ts +7 -0
- package/dist/lib/presentation/pages/WorkspacesPage/index.d.ts.map +1 -0
- package/dist/lib/presentation/pages/WorkspacesPage/index.js +112 -0
- package/dist/lib/presentation/slots/workspaceSlots/index.d.ts +101 -0
- package/dist/lib/presentation/slots/workspaceSlots/index.d.ts.map +1 -0
- package/dist/lib/presentation/slots/workspaceSlots/index.js +25 -0
- package/dist/lib/presentation/workspacesPlugin/index.d.ts +31 -0
- package/dist/lib/presentation/workspacesPlugin/index.d.ts.map +1 -0
- package/dist/lib/presentation/workspacesPlugin/index.js +151 -0
- package/dist/lib/slots/workspaceSlots/index.d.ts +101 -0
- package/dist/lib/slots/workspaceSlots/index.d.ts.map +1 -0
- package/dist/lib/types/wizard/index.d.ts +119 -0
- package/dist/lib/types/wizard/index.d.ts.map +1 -0
- package/dist/lib/types/workspace/index.d.ts +42 -0
- package/dist/lib/types/workspace/index.d.ts.map +1 -0
- package/dist/lib/utils/buildCreateWorkspaceBody/index.d.ts +12 -0
- package/dist/lib/utils/buildCreateWorkspaceBody/index.d.ts.map +1 -0
- package/dist/lib/utils/currentWorkspace/index.d.ts +17 -0
- package/dist/lib/utils/currentWorkspace/index.d.ts.map +1 -0
- package/dist/lib/utils/isActiveWorkspace/index.d.ts +9 -0
- package/dist/lib/utils/isActiveWorkspace/index.d.ts.map +1 -0
- package/dist/lib/utils/isConflict/index.d.ts +8 -0
- package/dist/lib/utils/isConflict/index.d.ts.map +1 -0
- package/dist/lib/utils/permissions/index.d.ts +7 -0
- package/dist/lib/utils/permissions/index.d.ts.map +1 -0
- package/dist/lib/utils/radioGroupKeydown/index.d.ts +15 -0
- package/dist/lib/utils/radioGroupKeydown/index.d.ts.map +1 -0
- package/dist/lib/utils/resourceSelection/index.d.ts +18 -0
- package/dist/lib/utils/resourceSelection/index.d.ts.map +1 -0
- package/dist/lib/utils/workspacesPlugin/index.d.ts +31 -0
- package/dist/lib/utils/workspacesPlugin/index.d.ts.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Workspace } from '../../domain/types/workspace';
|
|
3
|
+
type CurrentWorkspaceProviderProps = {
|
|
4
|
+
/** The resolved workspace to expose to the subtree. */
|
|
5
|
+
workspace: Workspace;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
/** Provides the open workspace to everything rendered inside the shell. */
|
|
9
|
+
export declare function CurrentWorkspaceProvider({ workspace, children }: CurrentWorkspaceProviderProps): import("react").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the workspace currently open in the shell. Throws when called outside
|
|
12
|
+
* a {@link WorkspaceShell} — a workspace page is always mounted inside one, so a
|
|
13
|
+
* missing provider is a wiring bug, not a runtime state to handle.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useCurrentWorkspace(): Workspace;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/presentation/currentWorkspace/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAW9D,KAAK,6BAA6B,GAAG;IACjC,uDAAuD;IACvD,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,2EAA2E;AAC3E,wBAAgB,wBAAwB,CAAC,EACrC,SAAS,EACT,QAAQ,EACX,EAAE,6BAA6B,+BAyB/B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,SAAS,CAQ/C"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect } from 'react';
|
|
3
|
+
import { setActiveWorkspaceId } from '@orthacms/utils-admin';
|
|
4
|
+
/**
|
|
5
|
+
* The workspace currently open in the shell. Provided by {@link WorkspaceShell}
|
|
6
|
+
* once it has resolved the `:id` route param against the workspaces list, and
|
|
7
|
+
* read by any page or rail button mounted inside the shell via
|
|
8
|
+
* {@link useCurrentWorkspace} — so a feature plugin never has to re-read the
|
|
9
|
+
* `:id` param or re-fetch the workspace itself.
|
|
10
|
+
*/
|
|
11
|
+
const CurrentWorkspaceContext = createContext(null);
|
|
12
|
+
/** Provides the open workspace to everything rendered inside the shell. */
|
|
13
|
+
export function CurrentWorkspaceProvider({ workspace, children }) {
|
|
14
|
+
// Sync the shared apiClient's workspace header during render — the parent
|
|
15
|
+
// renders before its children, so the header is set before any child's
|
|
16
|
+
// data hook fires its first request (a useEffect here runs *after* those
|
|
17
|
+
// child effects, leaving the first request unscoped). Idempotent.
|
|
18
|
+
setActiveWorkspaceId(workspace.id);
|
|
19
|
+
// Re-assert on mount and whenever the open workspace changes, so switching
|
|
20
|
+
// workspaces re-scopes the shared header. There is deliberately **no unmount
|
|
21
|
+
// cleanup**: nulling the header on unmount races with in-flight/background
|
|
22
|
+
// refetches (e.g. a window-focus refetch of a content list after navigating
|
|
23
|
+
// to the workspaces grid), which would then fire with no `X-Workspace-Id` and
|
|
24
|
+
// 400 at the guard. A lingering id is harmless — the header is only honored by
|
|
25
|
+
// workspace-scoped routes, which always live inside a shell that re-sets it on
|
|
26
|
+
// entry (render-time set above + this effect) before any request runs. This
|
|
27
|
+
// also sidesteps the StrictMode setup → cleanup → setup interim-null window.
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
setActiveWorkspaceId(workspace.id);
|
|
30
|
+
}, [workspace.id]);
|
|
31
|
+
return (_jsx(CurrentWorkspaceContext.Provider, { value: workspace, children: children }));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns the workspace currently open in the shell. Throws when called outside
|
|
35
|
+
* a {@link WorkspaceShell} — a workspace page is always mounted inside one, so a
|
|
36
|
+
* missing provider is a wiring bug, not a runtime state to handle.
|
|
37
|
+
*/
|
|
38
|
+
export function useCurrentWorkspace() {
|
|
39
|
+
const workspace = useContext(CurrentWorkspaceContext);
|
|
40
|
+
if (!workspace) {
|
|
41
|
+
throw new Error('useCurrentWorkspace must be used inside a WorkspaceShell route.');
|
|
42
|
+
}
|
|
43
|
+
return workspace;
|
|
44
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the basics-step Zod schema with localized messages. Mirrors the
|
|
4
|
+
* server `CreateWorkspaceDto` through the shared {@link NAME_MAX} /
|
|
5
|
+
* {@link DESCRIPTION_MAX} constants (name required, ≤120; slug required, matching
|
|
6
|
+
* the {@link Slug} value object's rule; description ≤2000). The slug shape check
|
|
7
|
+
* delegates to the shared {@link Slug} VO so it can't drift from the availability
|
|
8
|
+
* hook or the server. Rebuilt when the locale changes so the copy stays in sync
|
|
9
|
+
* with the UI. Slug *availability* is checked separately by `useSlugAvailability`
|
|
10
|
+
* — this only validates shape.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useBasicsSchema(): z.ZodObject<{
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
slug: z.ZodString;
|
|
15
|
+
description: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/presentation/hooks/useBasicsSchema/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4BxB;;;;;;;;;GASG;AACH,wBAAgB,eAAe;;;;kBAwC9B"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { Slug } from '../../../domain/slug';
|
|
5
|
+
import { DESCRIPTION_MAX, NAME_MAX } from '../../../domain/workspaceLimits';
|
|
6
|
+
/** Validation copy for the basics step, co-located with the schema. */
|
|
7
|
+
const messages = defineMessages({
|
|
8
|
+
nameRequired: {
|
|
9
|
+
id: 'workspaces.create.basics.nameRequired',
|
|
10
|
+
defaultMessage: 'Workspace name is required.'
|
|
11
|
+
},
|
|
12
|
+
nameTooLong: {
|
|
13
|
+
id: 'workspaces.create.basics.nameTooLong',
|
|
14
|
+
defaultMessage: 'Name must be at most {max} characters.'
|
|
15
|
+
},
|
|
16
|
+
slugRequired: {
|
|
17
|
+
id: 'workspaces.create.basics.slugRequired',
|
|
18
|
+
defaultMessage: 'Slug is required.'
|
|
19
|
+
},
|
|
20
|
+
slugPattern: {
|
|
21
|
+
id: 'workspaces.create.basics.slugPattern',
|
|
22
|
+
defaultMessage: 'Use lowercase letters, numbers, and hyphens only.'
|
|
23
|
+
},
|
|
24
|
+
descriptionTooLong: {
|
|
25
|
+
id: 'workspaces.create.basics.descriptionTooLong',
|
|
26
|
+
defaultMessage: 'Description must be at most {max} characters.'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Builds the basics-step Zod schema with localized messages. Mirrors the
|
|
31
|
+
* server `CreateWorkspaceDto` through the shared {@link NAME_MAX} /
|
|
32
|
+
* {@link DESCRIPTION_MAX} constants (name required, ≤120; slug required, matching
|
|
33
|
+
* the {@link Slug} value object's rule; description ≤2000). The slug shape check
|
|
34
|
+
* delegates to the shared {@link Slug} VO so it can't drift from the availability
|
|
35
|
+
* hook or the server. Rebuilt when the locale changes so the copy stays in sync
|
|
36
|
+
* with the UI. Slug *availability* is checked separately by `useSlugAvailability`
|
|
37
|
+
* — this only validates shape.
|
|
38
|
+
*/
|
|
39
|
+
export function useBasicsSchema() {
|
|
40
|
+
const intl = useIntl();
|
|
41
|
+
return useMemo(() => z.object({
|
|
42
|
+
name: z
|
|
43
|
+
.string()
|
|
44
|
+
.trim()
|
|
45
|
+
.min(1, {
|
|
46
|
+
message: intl.formatMessage(messages.nameRequired)
|
|
47
|
+
})
|
|
48
|
+
.max(NAME_MAX, {
|
|
49
|
+
message: intl.formatMessage(messages.nameTooLong, {
|
|
50
|
+
max: NAME_MAX
|
|
51
|
+
})
|
|
52
|
+
}),
|
|
53
|
+
slug: z
|
|
54
|
+
.string()
|
|
55
|
+
.trim()
|
|
56
|
+
.min(1, {
|
|
57
|
+
message: intl.formatMessage(messages.slugRequired)
|
|
58
|
+
})
|
|
59
|
+
.refine((value) => Slug.isValid(value), {
|
|
60
|
+
message: intl.formatMessage(messages.slugPattern)
|
|
61
|
+
}),
|
|
62
|
+
description: z
|
|
63
|
+
.string()
|
|
64
|
+
.trim()
|
|
65
|
+
.max(DESCRIPTION_MAX, {
|
|
66
|
+
message: intl.formatMessage(messages.descriptionTooLong, {
|
|
67
|
+
max: DESCRIPTION_MAX
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
}), [intl]);
|
|
71
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type KeyboardEvent } from 'react';
|
|
2
|
+
/** Arguments for {@link useComboboxList}. */
|
|
3
|
+
export type UseComboboxListArgs = {
|
|
4
|
+
/** How many options the popover is currently showing. */
|
|
5
|
+
count: number;
|
|
6
|
+
/** Whether the popover is open (a closed list has no active option). */
|
|
7
|
+
open: boolean;
|
|
8
|
+
/** Commit the option at `index` — called on Enter. */
|
|
9
|
+
onSelect: (index: number) => void;
|
|
10
|
+
/** Close the popover — called on Escape. */
|
|
11
|
+
onDismiss?: () => void;
|
|
12
|
+
};
|
|
13
|
+
/** What {@link useComboboxList} returns. */
|
|
14
|
+
export type UseComboboxListResult = {
|
|
15
|
+
/** `id` for the `role="listbox"` element, wired to `aria-controls`. */
|
|
16
|
+
listboxId: string;
|
|
17
|
+
/** `id` for the option at `index`, wired to `aria-activedescendant`. */
|
|
18
|
+
optionId: (index: number) => string;
|
|
19
|
+
/** The active option's id, or `undefined` when nothing is active. */
|
|
20
|
+
activeId: string | undefined;
|
|
21
|
+
/** Index of the visually-active option. */
|
|
22
|
+
activeIndex: number;
|
|
23
|
+
/** Point the active option at `index` (e.g. on pointer hover). */
|
|
24
|
+
setActiveIndex: (index: number) => void;
|
|
25
|
+
/** ↓/↑/Home/End/Enter/Escape handler for the combobox input. */
|
|
26
|
+
onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The keyboard half of the ARIA 1.2 **combobox** pattern for a search input with
|
|
30
|
+
* a popover list of results.
|
|
31
|
+
*
|
|
32
|
+
* Focus deliberately stays in the input — the list is driven by
|
|
33
|
+
* `aria-activedescendant`, not by moving DOM focus — because a search field the
|
|
34
|
+
* user is still typing into must not lose focus when results arrive. That is
|
|
35
|
+
* what lets ↓/↑ walk the options while typing continues to work, and it is the
|
|
36
|
+
* affordance both typeaheads were missing: previously the only route to a result
|
|
37
|
+
* was Tab *out of* the input into the popover, which is not what anyone expects
|
|
38
|
+
* from a search box.
|
|
39
|
+
*
|
|
40
|
+
* The caller owns rendering and the `count → action` mapping; this owns the
|
|
41
|
+
* active index, the id wiring, and the key handling.
|
|
42
|
+
*/
|
|
43
|
+
export declare function useComboboxList({ count, open, onSelect, onDismiss }: UseComboboxListArgs): UseComboboxListResult;
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/presentation/hooks/useComboboxList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,KAAK,aAAa,EACrB,MAAM,OAAO,CAAC;AAEf,6CAA6C;AAC7C,MAAM,MAAM,mBAAmB,GAAG;IAC9B,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,IAAI,EAAE,OAAO,CAAC;IACd,sDAAsD;IACtD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,qBAAqB,GAAG;IAChC,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC,qEAAqE;IACrE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,gEAAgE;IAChE,SAAS,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC/D,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,EAC5B,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,SAAS,EACZ,EAAE,mBAAmB,GAAG,qBAAqB,CAuD7C"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useCallback, useEffect, useId, useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The keyboard half of the ARIA 1.2 **combobox** pattern for a search input with
|
|
4
|
+
* a popover list of results.
|
|
5
|
+
*
|
|
6
|
+
* Focus deliberately stays in the input — the list is driven by
|
|
7
|
+
* `aria-activedescendant`, not by moving DOM focus — because a search field the
|
|
8
|
+
* user is still typing into must not lose focus when results arrive. That is
|
|
9
|
+
* what lets ↓/↑ walk the options while typing continues to work, and it is the
|
|
10
|
+
* affordance both typeaheads were missing: previously the only route to a result
|
|
11
|
+
* was Tab *out of* the input into the popover, which is not what anyone expects
|
|
12
|
+
* from a search box.
|
|
13
|
+
*
|
|
14
|
+
* The caller owns rendering and the `count → action` mapping; this owns the
|
|
15
|
+
* active index, the id wiring, and the key handling.
|
|
16
|
+
*/
|
|
17
|
+
export function useComboboxList({ count, open, onSelect, onDismiss }) {
|
|
18
|
+
const listboxId = useId();
|
|
19
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
20
|
+
// Results change under the cursor as the query narrows, so the active option
|
|
21
|
+
// has to snap back rather than point past the end of a shorter list.
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setActiveIndex(0);
|
|
24
|
+
}, [count, open]);
|
|
25
|
+
const optionId = useCallback((index) => `${listboxId}-option-${index}`, [listboxId]);
|
|
26
|
+
const onKeyDown = useCallback((event) => {
|
|
27
|
+
if (event.key === 'Escape') {
|
|
28
|
+
onDismiss?.();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!open || count === 0)
|
|
32
|
+
return;
|
|
33
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
const delta = event.key === 'ArrowDown' ? 1 : -1;
|
|
36
|
+
setActiveIndex((i) => (i + delta + count) % count);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (event.key === 'Home') {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
setActiveIndex(0);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (event.key === 'End') {
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
setActiveIndex(count - 1);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (event.key === 'Enter') {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
onSelect(activeIndex);
|
|
52
|
+
}
|
|
53
|
+
}, [activeIndex, count, onDismiss, onSelect, open]);
|
|
54
|
+
return {
|
|
55
|
+
listboxId,
|
|
56
|
+
optionId,
|
|
57
|
+
activeId: open && count > 0 ? optionId(activeIndex) : undefined,
|
|
58
|
+
activeIndex,
|
|
59
|
+
setActiveIndex,
|
|
60
|
+
onKeyDown
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router state a gated `<Navigate>` carries to the page it lands on, so the
|
|
3
|
+
* destination can explain why the user is not where they asked to be.
|
|
4
|
+
*/
|
|
5
|
+
export type RedirectNoticeState = {
|
|
6
|
+
/** Discriminator for the refusal; the destination owns the copy. */
|
|
7
|
+
redirectNotice?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Handles the arrival half of a permission redirect.
|
|
11
|
+
*
|
|
12
|
+
* A `<Navigate replace>` swaps the page without moving focus or saying
|
|
13
|
+
* anything: focus stays on `<body>`, so the next Tab restarts at the very top
|
|
14
|
+
* of the document — above the whole sidebar — and a screen-reader user hears
|
|
15
|
+
* silence and has to explore to work out where they ended up. This is the SPA
|
|
16
|
+
* analogue of a silent redirect.
|
|
17
|
+
*
|
|
18
|
+
* On arrival it moves focus to the shell's `<main>` (already focusable for the
|
|
19
|
+
* skip link, so no new markup is needed) and returns the notice key once, for
|
|
20
|
+
* the caller to render in a `role="status"` region. The router state is then
|
|
21
|
+
* cleared so a reload or a Back/Forward doesn't replay the announcement.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useRedirectNotice(): string | null;
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/presentation/hooks/useRedirectNotice/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAKF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAsBjD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { useLocation, useNavigate } from 'react-router-dom';
|
|
3
|
+
/** The shell's `<main>`, which is already `tabIndex={-1}` for the skip link. */
|
|
4
|
+
const MAIN_CONTENT_ID = 'main-content';
|
|
5
|
+
/**
|
|
6
|
+
* Handles the arrival half of a permission redirect.
|
|
7
|
+
*
|
|
8
|
+
* A `<Navigate replace>` swaps the page without moving focus or saying
|
|
9
|
+
* anything: focus stays on `<body>`, so the next Tab restarts at the very top
|
|
10
|
+
* of the document — above the whole sidebar — and a screen-reader user hears
|
|
11
|
+
* silence and has to explore to work out where they ended up. This is the SPA
|
|
12
|
+
* analogue of a silent redirect.
|
|
13
|
+
*
|
|
14
|
+
* On arrival it moves focus to the shell's `<main>` (already focusable for the
|
|
15
|
+
* skip link, so no new markup is needed) and returns the notice key once, for
|
|
16
|
+
* the caller to render in a `role="status"` region. The router state is then
|
|
17
|
+
* cleared so a reload or a Back/Forward doesn't replay the announcement.
|
|
18
|
+
*/
|
|
19
|
+
export function useRedirectNotice() {
|
|
20
|
+
const location = useLocation();
|
|
21
|
+
const navigate = useNavigate();
|
|
22
|
+
const incoming = location.state?.redirectNotice ?? null;
|
|
23
|
+
const [notice, setNotice] = useState(incoming);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!incoming)
|
|
26
|
+
return;
|
|
27
|
+
setNotice(incoming);
|
|
28
|
+
document.getElementById(MAIN_CONTENT_ID)?.focus();
|
|
29
|
+
// Drop the state so the message is a one-shot: it explains *this*
|
|
30
|
+
// navigation, not every later visit to the same URL.
|
|
31
|
+
navigate(location.pathname + location.search, {
|
|
32
|
+
replace: true,
|
|
33
|
+
state: null
|
|
34
|
+
});
|
|
35
|
+
}, [incoming, location.pathname, location.search, navigate]);
|
|
36
|
+
return notice;
|
|
37
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ResourceSelection } from '../../../domain/types/wizard';
|
|
2
|
+
/** Bound helpers returned by {@link useResourceSelection}. */
|
|
3
|
+
export type ResourceSelectionController = {
|
|
4
|
+
/** Whether `id` is selected in the current mode. */
|
|
5
|
+
isSelected: (id: string) => boolean;
|
|
6
|
+
/** Toggle one id (include list in `specific`, exclude list in `all`). */
|
|
7
|
+
toggle: (id: string) => void;
|
|
8
|
+
/** Switch the whole resource to "all" or back to an empty "specific" list. */
|
|
9
|
+
setAll: (all: boolean) => void;
|
|
10
|
+
/** Whether the resource is in "all" mode. */
|
|
11
|
+
isAll: boolean;
|
|
12
|
+
/** Count of selected items given the total available. */
|
|
13
|
+
count: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Controlled wrapper over the pure `resourceSelection` helpers. State lives in
|
|
17
|
+
* the caller (the wizard); this binds the selection + `onChange` into ready
|
|
18
|
+
* handlers for a selection panel, and derives the selected `count` from `total`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useResourceSelection(selection: ResourceSelection, onChange: (next: ResourceSelection) => void, total: number): ResourceSelectionController;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/presentation/hooks/useResourceSelection/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAQtE,8DAA8D;AAC9D,MAAM,MAAM,2BAA2B,GAAG;IACtC,oDAAoD;IACpD,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,yEAAyE;IACzE,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,8EAA8E;IAC9E,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/B,6CAA6C;IAC7C,KAAK,EAAE,OAAO,CAAC;IACf,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAChC,SAAS,EAAE,iBAAiB,EAC5B,QAAQ,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,EAC3C,KAAK,EAAE,MAAM,GACd,2BAA2B,CAW7B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { count as countSelected, isSelected as isSelectedIn, setAll as setAllMode, toggle as toggleId } from '../../../domain/resourceSelection';
|
|
3
|
+
/**
|
|
4
|
+
* Controlled wrapper over the pure `resourceSelection` helpers. State lives in
|
|
5
|
+
* the caller (the wizard); this binds the selection + `onChange` into ready
|
|
6
|
+
* handlers for a selection panel, and derives the selected `count` from `total`.
|
|
7
|
+
*/
|
|
8
|
+
export function useResourceSelection(selection, onChange, total) {
|
|
9
|
+
return useMemo(() => ({
|
|
10
|
+
isSelected: (id) => isSelectedIn(selection, id),
|
|
11
|
+
toggle: (id) => onChange(toggleId(selection, id)),
|
|
12
|
+
setAll: (all) => onChange(setAllMode(all)),
|
|
13
|
+
isAll: selection.mode === 'all',
|
|
14
|
+
count: countSelected(selection, total)
|
|
15
|
+
}), [selection, onChange, total]);
|
|
16
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { SlugStatus, WizardData } from '../../../domain/types/wizard';
|
|
2
|
+
/** Arguments for {@link useSlug}. */
|
|
3
|
+
export type UseSlugArgs = {
|
|
4
|
+
/** Current basics data (reads `name`, `slug`, `slugEdited`). */
|
|
5
|
+
data: WizardData;
|
|
6
|
+
/** Merge a partial patch into the basics data. */
|
|
7
|
+
update: (patch: Partial<WizardData>) => void;
|
|
8
|
+
};
|
|
9
|
+
/** What {@link useSlug} returns. */
|
|
10
|
+
export type UseSlugResult = {
|
|
11
|
+
/** Live availability status of the current slug. */
|
|
12
|
+
status: SlugStatus;
|
|
13
|
+
/** Name change handler: also auto-fills the slug until it's been edited. */
|
|
14
|
+
onNameChange: (name: string) => void;
|
|
15
|
+
/** Direct slug edit — marks the slug as user-owned. */
|
|
16
|
+
onSlugChange: (slug: string) => void;
|
|
17
|
+
/** Re-derive the slug from the name and resume auto-fill. */
|
|
18
|
+
regenerate: () => void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Wires the name → slug relationship for the basics step. The slug auto-fills
|
|
22
|
+
* from the name (via {@link slugify}) until the user edits it; from then on it
|
|
23
|
+
* is left alone and a regenerate action restores auto-fill. Availability is
|
|
24
|
+
* tracked by {@link useSlugAvailability}. State lives in the wizard — this only
|
|
25
|
+
* supplies handlers and the live status.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useSlug({ data, update }: UseSlugArgs): UseSlugResult;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/presentation/hooks/useSlug/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE3E,qCAAqC;AACrC,MAAM,MAAM,WAAW,GAAG;IACtB,gEAAgE;IAChE,IAAI,EAAE,UAAU,CAAC;IACjB,kDAAkD;IAClD,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,oCAAoC;AACpC,MAAM,MAAM,aAAa,GAAG;IACxB,oDAAoD;IACpD,MAAM,EAAE,UAAU,CAAC;IACnB,4EAA4E;IAC5E,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,uDAAuD;IACvD,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,6DAA6D;IAC7D,UAAU,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,WAAW,GAAG,aAAa,CAWpE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { slugify } from '@orthacms/utils-admin';
|
|
2
|
+
import { useSlugAvailability } from '../../../application/useSlugAvailability';
|
|
3
|
+
/**
|
|
4
|
+
* Wires the name → slug relationship for the basics step. The slug auto-fills
|
|
5
|
+
* from the name (via {@link slugify}) until the user edits it; from then on it
|
|
6
|
+
* is left alone and a regenerate action restores auto-fill. Availability is
|
|
7
|
+
* tracked by {@link useSlugAvailability}. State lives in the wizard — this only
|
|
8
|
+
* supplies handlers and the live status.
|
|
9
|
+
*/
|
|
10
|
+
export function useSlug({ data, update }) {
|
|
11
|
+
const status = useSlugAvailability(data.slug);
|
|
12
|
+
return {
|
|
13
|
+
status,
|
|
14
|
+
onNameChange: (name) => update(data.slugEdited ? { name } : { name, slug: slugify(name) }),
|
|
15
|
+
onSlugChange: (slug) => update({ slug, slugEdited: true }),
|
|
16
|
+
regenerate: () => update({ slug: slugify(data.name), slugEdited: false })
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ContentMode, MemberDraft, ResourceSelection, WizardData, WizardSnapshot } from '../../../domain/types/wizard';
|
|
2
|
+
/** The full controller returned by {@link useWizard}. */
|
|
3
|
+
export type WizardController = {
|
|
4
|
+
/** Active step (1–3), mirrored to `?step=` and clamped. */
|
|
5
|
+
step: number;
|
|
6
|
+
/** Highest step the user has reached (gates rail navigation). */
|
|
7
|
+
maxReached: number;
|
|
8
|
+
/** Step 1 basics. */
|
|
9
|
+
data: WizardData;
|
|
10
|
+
/** Added members (excludes the implied owner). */
|
|
11
|
+
members: MemberDraft[];
|
|
12
|
+
/** Page-level content decision. */
|
|
13
|
+
contentMode: ContentMode;
|
|
14
|
+
/** Collection selection. */
|
|
15
|
+
collections: ResourceSelection;
|
|
16
|
+
/** Page selection. */
|
|
17
|
+
pages: ResourceSelection;
|
|
18
|
+
/** Whether the content-types list is still loading. */
|
|
19
|
+
ctLoading: boolean;
|
|
20
|
+
/** Whether the content-types list failed to load. */
|
|
21
|
+
ctError: boolean;
|
|
22
|
+
/** Navigate to a step (clamped); bumps {@link maxReached}. */
|
|
23
|
+
goStep: (next: number) => void;
|
|
24
|
+
/** Merge a partial patch into the basics data. */
|
|
25
|
+
update: (patch: Partial<WizardData>) => void;
|
|
26
|
+
/** Add a member if not already present. */
|
|
27
|
+
addMember: (member: MemberDraft) => void;
|
|
28
|
+
/** Remove a member by id. */
|
|
29
|
+
removeMember: (id: string) => void;
|
|
30
|
+
/** Set the page-level content mode. */
|
|
31
|
+
setContentMode: (mode: ContentMode) => void;
|
|
32
|
+
/** Replace the collection selection. */
|
|
33
|
+
setCollections: (selection: ResourceSelection) => void;
|
|
34
|
+
/** Replace the page selection. */
|
|
35
|
+
setPages: (selection: ResourceSelection) => void;
|
|
36
|
+
/** Whether the basics step passes shape validation (not availability). */
|
|
37
|
+
basicsValid: boolean;
|
|
38
|
+
/** Total members including the owner. */
|
|
39
|
+
memberCount: number;
|
|
40
|
+
/** Number of selected collections. */
|
|
41
|
+
collectionCount: number;
|
|
42
|
+
/** Number of selected pages. */
|
|
43
|
+
pageCount: number;
|
|
44
|
+
/**
|
|
45
|
+
* The full current wizard state as a submittable snapshot. The page hands
|
|
46
|
+
* this (optionally spread with an override, e.g. empty content for "Skip &
|
|
47
|
+
* create") to the create use-case hook without mutating wizard state.
|
|
48
|
+
*/
|
|
49
|
+
snapshot: WizardSnapshot;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Single source of truth for the create-workspace wizard: step (mirrored to the
|
|
53
|
+
* `?step=` query param and clamped), the per-step form state, and derived
|
|
54
|
+
* validity and counts. Step bodies are presentational and read everything from
|
|
55
|
+
* here, so state survives navigating between steps. Submission itself lives in
|
|
56
|
+
* the `useCreateWorkspaceFlow` use-case hook — this only exposes the
|
|
57
|
+
* {@link WizardController.snapshot} it consumes.
|
|
58
|
+
*/
|
|
59
|
+
export declare function useWizard(): WizardController;
|
|
60
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/presentation/hooks/useWizard/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACR,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,cAAc,EACjB,MAAM,8BAA8B,CAAC;AAsBtC,yDAAyD;AACzD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,kDAAkD;IAClD,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,mCAAmC;IACnC,WAAW,EAAE,WAAW,CAAC;IACzB,4BAA4B;IAC5B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,sBAAsB;IACtB,KAAK,EAAE,iBAAiB,CAAC;IACzB,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,8DAA8D;IAC9D,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,kDAAkD;IAClD,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IAC7C,2CAA2C;IAC3C,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,6BAA6B;IAC7B,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,uCAAuC;IACvC,cAAc,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC5C,wCAAwC;IACxC,cAAc,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACvD,kCAAkC;IAClC,QAAQ,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjD,0EAA0E;IAC1E,WAAW,EAAE,OAAO,CAAC;IACrB,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,eAAe,EAAE,MAAM,CAAC;IACxB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,QAAQ,EAAE,cAAc,CAAC;CAC5B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,gBAAgB,CA4F5C"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { useSearchParams } from 'react-router-dom';
|
|
3
|
+
import { useContentTypes } from '../../../application/useContentTypes';
|
|
4
|
+
import { count, EMPTY_SELECTION } from '../../../domain/resourceSelection';
|
|
5
|
+
import { useBasicsSchema } from '../useBasicsSchema';
|
|
6
|
+
const STEP_PARAM = 'step';
|
|
7
|
+
const MIN_STEP = 1;
|
|
8
|
+
const MAX_STEP = 3;
|
|
9
|
+
/** Default accent color for a new workspace. */
|
|
10
|
+
const DEFAULT_COLOR = 'slate';
|
|
11
|
+
const INITIAL_DATA = {
|
|
12
|
+
name: '',
|
|
13
|
+
slug: '',
|
|
14
|
+
slugEdited: false,
|
|
15
|
+
description: '',
|
|
16
|
+
color: DEFAULT_COLOR
|
|
17
|
+
};
|
|
18
|
+
const clampStep = (n) => Math.min(MAX_STEP, Math.max(MIN_STEP, Number.isFinite(n) ? n : MIN_STEP));
|
|
19
|
+
/**
|
|
20
|
+
* Single source of truth for the create-workspace wizard: step (mirrored to the
|
|
21
|
+
* `?step=` query param and clamped), the per-step form state, and derived
|
|
22
|
+
* validity and counts. Step bodies are presentational and read everything from
|
|
23
|
+
* here, so state survives navigating between steps. Submission itself lives in
|
|
24
|
+
* the `useCreateWorkspaceFlow` use-case hook — this only exposes the
|
|
25
|
+
* {@link WizardController.snapshot} it consumes.
|
|
26
|
+
*/
|
|
27
|
+
export function useWizard() {
|
|
28
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
29
|
+
const requestedStep = clampStep(Number(searchParams.get(STEP_PARAM) ?? MIN_STEP));
|
|
30
|
+
const [data, setData] = useState(INITIAL_DATA);
|
|
31
|
+
const [members, setMembers] = useState([]);
|
|
32
|
+
const [contentMode, setContentMode] = useState('all');
|
|
33
|
+
const [collections, setCollections] = useState(EMPTY_SELECTION);
|
|
34
|
+
const [pages, setPages] = useState(EMPTY_SELECTION);
|
|
35
|
+
const basicsSchema = useBasicsSchema();
|
|
36
|
+
const contentTypes = useContentTypes();
|
|
37
|
+
const basicsValid = basicsSchema.safeParse({
|
|
38
|
+
name: data.name,
|
|
39
|
+
slug: data.slug,
|
|
40
|
+
description: data.description
|
|
41
|
+
}).success;
|
|
42
|
+
// The basics gate is enforced on the *state*, not just on the transition.
|
|
43
|
+
// All wizard state is in-memory, so a deep link or a reload lands on a later
|
|
44
|
+
// step with an empty step 1 — previously rendering a live "Create workspace"
|
|
45
|
+
// button whose only possible outcome was a generic failure toast. Falling
|
|
46
|
+
// back to step 1 makes the wizard self-healing: the user sees exactly what
|
|
47
|
+
// is missing instead of a dead end. Steps 2 and 3 hold no basics fields, so
|
|
48
|
+
// this can never yank a user backwards mid-flow.
|
|
49
|
+
const step = basicsValid ? requestedStep : MIN_STEP;
|
|
50
|
+
const [maxReached, setMaxReached] = useState(step);
|
|
51
|
+
// Keep maxReached monotonic across deep-links and browser back/forward.
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
setMaxReached((m) => Math.max(m, step));
|
|
54
|
+
}, [step]);
|
|
55
|
+
const allTypes = contentTypes.data ?? [];
|
|
56
|
+
const collectionsTotal = allTypes.filter((ct) => ct.kind === 'collection').length;
|
|
57
|
+
const pagesTotal = allTypes.filter((ct) => ct.kind === 'single').length;
|
|
58
|
+
const goStep = useCallback((next) => {
|
|
59
|
+
const clamped = clampStep(next);
|
|
60
|
+
setMaxReached((m) => Math.max(m, clamped));
|
|
61
|
+
setSearchParams({ [STEP_PARAM]: String(clamped) });
|
|
62
|
+
}, [setSearchParams]);
|
|
63
|
+
const update = useCallback((patch) => setData((prev) => ({ ...prev, ...patch })), []);
|
|
64
|
+
const addMember = useCallback((member) => {
|
|
65
|
+
setMembers((prev) => prev.some((m) => m.id === member.id) ? prev : [...prev, member]);
|
|
66
|
+
}, []);
|
|
67
|
+
const removeMember = useCallback((id) => {
|
|
68
|
+
setMembers((prev) => prev.filter((m) => m.id !== id));
|
|
69
|
+
}, []);
|
|
70
|
+
return {
|
|
71
|
+
step,
|
|
72
|
+
maxReached,
|
|
73
|
+
data,
|
|
74
|
+
members,
|
|
75
|
+
contentMode,
|
|
76
|
+
collections,
|
|
77
|
+
pages,
|
|
78
|
+
ctLoading: contentTypes.isPending,
|
|
79
|
+
ctError: contentTypes.isError,
|
|
80
|
+
goStep,
|
|
81
|
+
update,
|
|
82
|
+
addMember,
|
|
83
|
+
removeMember,
|
|
84
|
+
setContentMode,
|
|
85
|
+
setCollections,
|
|
86
|
+
setPages,
|
|
87
|
+
basicsValid,
|
|
88
|
+
memberCount: members.length + 1,
|
|
89
|
+
collectionCount: count(collections, collectionsTotal),
|
|
90
|
+
pageCount: count(pages, pagesTotal),
|
|
91
|
+
snapshot: { data, members, contentMode, collections, pages }
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the settings General-tab Zod schema with localized messages. Mirrors
|
|
4
|
+
* the server `UpdateWorkspaceDto` through the shared {@link NAME_MAX} /
|
|
5
|
+
* {@link DESCRIPTION_MAX} constants (name required, ≤120; description ≤2000),
|
|
6
|
+
* rather than restating the numbers here — which is how they previously drifted
|
|
7
|
+
* to 100/500 and locked long-named workspaces out of the whole form. The slug is
|
|
8
|
+
* intentionally absent — it's the workspace's immutable URL identifier and isn't
|
|
9
|
+
* editable from settings. Rebuilt when the locale changes so the copy stays in
|
|
10
|
+
* sync with the UI.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useWorkspaceProfileSchema(): z.ZodObject<{
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
description: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/presentation/hooks/useWorkspaceProfileSchema/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB;;;kBA+BxC"}
|