@contember/create 2.1.0-alpha.8 → 2.1.0-beta.1
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/development/run.cjs +6 -4
- package/dist/development/run.cjs.map +1 -1
- package/dist/development/run.js +6 -4
- package/dist/development/run.js.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs +37 -23
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.js +37 -23
- package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/development/src/lib/FileSystem.cjs +1 -0
- package/dist/development/src/lib/FileSystem.cjs.map +1 -1
- package/dist/development/src/lib/FileSystem.js +1 -0
- package/dist/development/src/lib/FileSystem.js.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.cjs +28 -12
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js +28 -12
- package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/development/src/lib/packageManagerDetector.cjs +22 -0
- package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -0
- package/dist/development/src/lib/packageManagerDetector.js +22 -0
- package/dist/development/src/lib/packageManagerDetector.js.map +1 -0
- package/dist/development/src/lib/version.cjs.map +1 -1
- package/dist/development/src/lib/version.js.map +1 -1
- package/dist/development/src/paths.cjs.map +1 -1
- package/dist/development/src/paths.js.map +1 -1
- package/dist/production/run.cjs +6 -4
- package/dist/production/run.cjs.map +1 -1
- package/dist/production/run.js +6 -4
- package/dist/production/run.js.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs +37 -23
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.js +37 -23
- package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/production/src/lib/FileSystem.cjs +1 -0
- package/dist/production/src/lib/FileSystem.cjs.map +1 -1
- package/dist/production/src/lib/FileSystem.js +1 -0
- package/dist/production/src/lib/FileSystem.js.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.cjs +28 -12
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js +28 -12
- package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/production/src/lib/packageManagerDetector.cjs +22 -0
- package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -0
- package/dist/production/src/lib/packageManagerDetector.js +22 -0
- package/dist/production/src/lib/packageManagerDetector.js.map +1 -0
- package/dist/production/src/lib/version.cjs.map +1 -1
- package/dist/production/src/lib/version.js.map +1 -1
- package/dist/production/src/paths.cjs.map +1 -1
- package/dist/production/src/paths.js.map +1 -1
- package/dist/types/commands/WorkspaceCreateCommand.d.ts +4 -2
- package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
- package/dist/types/lib/FileSystem.d.ts +1 -0
- package/dist/types/lib/FileSystem.d.ts.map +1 -1
- package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
- package/dist/types/lib/packageManagerDetector.d.ts +3 -0
- package/dist/types/lib/packageManagerDetector.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -6
- package/resources/templates/{template-workspace → default}/.github/workflows/deploy.yaml +1 -1
- package/resources/templates/default/.gitignore.dist +154 -0
- package/resources/templates/default/README.md +98 -0
- package/resources/templates/{template-workspace → default}/admin/.env.development +1 -0
- package/resources/templates/{template-workspace → default}/admin/app/components/layout.tsx +7 -3
- package/resources/templates/default/admin/app/components/navigation.tsx +85 -0
- package/resources/templates/{template-workspace → default}/admin/app/index.tsx +4 -4
- package/resources/templates/default/admin/app/pages/tenant.tsx +160 -0
- package/resources/templates/default/admin/entrypoint/components/layout.tsx +14 -0
- package/resources/templates/default/admin/entrypoint/components/logged-in.tsx +47 -0
- package/resources/templates/default/admin/entrypoint/components/login.tsx +103 -0
- package/resources/templates/default/admin/entrypoint/config.ts +35 -0
- package/resources/templates/default/admin/entrypoint/contexts/login.tsx +18 -0
- package/resources/templates/default/admin/entrypoint/index.tsx +12 -0
- package/resources/templates/default/admin/entrypoint/login-entrypoint.tsx +24 -0
- package/resources/templates/default/admin/entrypoint/pages/index.tsx +48 -0
- package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +56 -0
- package/resources/templates/default/admin/entrypoint/pages/magicLinkSent.tsx +63 -0
- package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +44 -0
- package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +35 -0
- package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +34 -0
- package/resources/templates/default/admin/index.css +94 -0
- package/resources/templates/{template-workspace → default}/admin/index.html +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/binding/binding.tsx +0 -2
- package/resources/templates/{template-workspace → default}/admin/lib/binding/hooks.tsx +14 -8
- package/resources/templates/default/admin/lib/binding/identity.tsx +51 -0
- package/resources/templates/{template-workspace → default}/admin/lib/binding/navigation-guard-dialog.tsx +12 -8
- package/resources/templates/{template-workspace → default}/admin/lib/binding/persist.tsx +7 -5
- package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/block-repeater.tsx +14 -16
- package/resources/templates/{template-workspace → default}/admin/lib/board/board.tsx +61 -47
- package/resources/templates/{template-workspace → default}/admin/lib/buttons/back-button.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/cells.tsx +49 -35
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-header.tsx +47 -38
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/columns.tsx +128 -105
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/elements.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/empty.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/boolean.tsx +1 -4
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/common.tsx +14 -14
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/date.tsx +35 -21
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/defined.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/enum.tsx +24 -30
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/mobile.tsx +2 -3
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/number.tsx +0 -3
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/relation.tsx +36 -30
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/labels.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/loader.tsx +2 -7
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/pagination.tsx +33 -38
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/table.tsx +8 -6
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/tiles.tsx +10 -5
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/toolbar.tsx +10 -7
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/ui.tsx +12 -15
- package/resources/templates/{template-workspace → default}/admin/lib/dev/login-panel.tsx +23 -16
- package/resources/templates/{template-workspace → default}/admin/lib/dict.ts +17 -5
- package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +159 -0
- package/resources/templates/{template-workspace → default}/admin/lib/editor/block-editor.tsx +22 -10
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/baseEditorPlugins.tsx +0 -2
- package/resources/templates/default/admin/lib/editor/common/buttons.tsx +205 -0
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-block-toolbar.tsx +3 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-canvas.tsx +6 -4
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-editable-canvas.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-inline-toolbar.tsx +5 -2
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/AnchorRenderer.tsx +18 -16
- package/resources/templates/default/admin/lib/editor/common/elements/BlockElement.tsx +60 -0
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HeadingRenderer.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableElementRenderer.tsx +2 -7
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +1 -5
- package/resources/templates/{template-workspace → default}/admin/lib/editor/editor-block.tsx +17 -10
- package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text-view.tsx +11 -6
- package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text.tsx +6 -7
- package/resources/templates/default/admin/lib/editor/sortable-block.tsx +57 -0
- package/resources/templates/default/admin/lib/form/container.tsx +72 -0
- package/resources/templates/{template-workspace → default}/admin/lib/form/inputs.tsx +14 -12
- package/resources/templates/{template-workspace → default}/admin/lib/form/select.tsx +93 -51
- package/resources/templates/{template-workspace → default}/admin/lib/form/ui.tsx +1 -1
- package/resources/templates/default/admin/lib/form/upload-repeaters.tsx +221 -0
- package/resources/templates/{template-workspace → default}/admin/lib/form/upload.tsx +61 -62
- package/resources/templates/{template-workspace → default}/admin/lib/labels/enum-labels.ts +6 -3
- package/resources/templates/{template-workspace → default}/admin/lib/labels/field-labels.ts +4 -2
- package/resources/templates/{template-workspace → default}/admin/lib/layout/layout-boxed.tsx +39 -29
- package/resources/templates/{template-workspace → default}/admin/lib/layout/slots.tsx +1 -4
- package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +10 -4
- package/resources/templates/{template-workspace → default}/admin/lib/repeater/repeater.tsx +24 -15
- package/resources/templates/{template-workspace → default}/admin/lib/select/create-new.tsx +0 -3
- package/resources/templates/{template-workspace → default}/admin/lib/select/filter.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/select/list.tsx +33 -28
- package/resources/templates/default/admin/lib/select/multi-select.tsx +92 -0
- package/resources/templates/default/admin/lib/select/select.tsx +109 -0
- package/resources/templates/default/admin/lib/select/sortable-select.tsx +138 -0
- package/resources/templates/{template-workspace → default}/admin/lib/select/ui.tsx +13 -11
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/change-my-password.tsx +21 -8
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/common.tsx +21 -12
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/create-api-key.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/invite.tsx +12 -7
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/login.tsx +26 -7
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/memberships-control.tsx +32 -20
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset-request.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset.tsx +21 -8
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin-init.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin.tsx +25 -12
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/update-project-member.tsx +3 -4
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInviteUser.tsx +2 -3
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/api-key-list.tsx +5 -3
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-delete-dialog.tsx +13 -2
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-list.tsx +17 -11
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/person-list.tsx +6 -4
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/otp-setup.tsx +86 -59
- package/resources/templates/default/admin/lib/toast/toast.tsx +113 -0
- package/resources/templates/{template-workspace → default}/admin/lib/toast/toaster.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/alert-dialog.tsx +4 -3
- package/resources/templates/default/admin/lib/ui/button.tsx +30 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/card.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/dialog.tsx +12 -8
- package/resources/templates/default/admin/lib/ui/dimension.tsx +9 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/dropdown.tsx +18 -15
- package/resources/templates/default/admin/lib/ui/input.tsx +68 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/loader.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/menu.tsx +3 -11
- package/resources/templates/{template-workspace → default}/admin/lib/ui/overlay.tsx +11 -9
- package/resources/templates/{template-workspace → default}/admin/lib/ui/popover.tsx +2 -2
- package/resources/templates/{template-workspace → default}/admin/lib/ui/property-list.tsx +5 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/scroll-area.tsx +11 -11
- package/resources/templates/{template-workspace → default}/admin/lib/ui/select.tsx +4 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sheet.tsx +9 -8
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sidebar.tsx +53 -42
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sortable.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/switch.tsx +11 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/table.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/textarea.tsx +10 -7
- package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle-group.tsx +9 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle.tsx +3 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/tooltip.tsx +4 -3
- package/resources/templates/{template-workspace → default}/admin/lib/upload/dropzone.tsx +14 -10
- package/resources/templates/{template-workspace → default}/admin/lib/upload/repeater.tsx +0 -1
- package/resources/templates/{template-workspace → default}/admin/lib/upload/ui.tsx +4 -8
- package/resources/templates/{template-workspace → default}/admin/lib/upload/upload-progress.tsx +28 -12
- package/resources/templates/{template-workspace → default}/admin/lib/upload/view.tsx +130 -68
- package/resources/templates/{template-workspace → default}/admin/lib/utils/createComponentOpenHooks.tsx +10 -6
- package/resources/templates/{template-workspace → default}/admin/lib/utils/uic.tsx +24 -14
- package/resources/templates/{template-workspace → default}/admin/lib/utils/use-mobile.ts +1 -3
- package/resources/templates/{template-workspace → default}/admin/package.json +6 -4
- package/resources/templates/default/admin/sentry.ts +26 -0
- package/resources/templates/{template-workspace → default}/admin/tsconfig.json +1 -9
- package/resources/templates/default/admin/vite-env.d.ts +12 -0
- package/resources/templates/default/admin/vite.config.ts +11 -0
- package/resources/templates/default/api/README.md +87 -0
- package/resources/templates/{template-workspace → default}/biome.json +1 -1
- package/resources/templates/default/client/README.md +285 -0
- package/resources/templates/{template-workspace → default}/contember.template.yaml +5 -0
- package/resources/templates/{template-workspace → default}/package.json +1 -1
- package/resources/templates/default/scripts/generate-client.sh +7 -0
- package/resources/templates/default/scripts/update-ui-lib.sh +344 -0
- package/src/commands/WorkspaceCreateCommand.ts +41 -25
- package/src/lib/FileSystem.ts +1 -0
- package/src/lib/TemplateInstaller.ts +32 -12
- package/src/lib/packageManagerDetector.ts +24 -0
- package/src/run.ts +8 -7
- package/resources/templates/template-workspace/.gitignore.dist +0 -3
- package/resources/templates/template-workspace/admin/app/components/navigation.tsx +0 -1
- package/resources/templates/template-workspace/admin/index.css +0 -53
- package/resources/templates/template-workspace/admin/index.tsx +0 -268
- package/resources/templates/template-workspace/admin/lib/binding/identity.tsx +0 -50
- package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +0 -135
- package/resources/templates/template-workspace/admin/lib/editor/common/buttons.tsx +0 -83
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/BlockElement.tsx +0 -48
- package/resources/templates/template-workspace/admin/lib/editor/sortable-block.tsx +0 -51
- package/resources/templates/template-workspace/admin/lib/form/container.tsx +0 -59
- package/resources/templates/template-workspace/admin/lib/form/upload-repeaters.tsx +0 -188
- package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +0 -96
- package/resources/templates/template-workspace/admin/lib/select/select.tsx +0 -104
- package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +0 -136
- package/resources/templates/template-workspace/admin/lib/toast/toast.tsx +0 -112
- package/resources/templates/template-workspace/admin/lib/ui/button.tsx +0 -29
- package/resources/templates/template-workspace/admin/lib/ui/input.tsx +0 -69
- package/resources/templates/template-workspace/admin/lib/ui/switch.tsx +0 -9
- package/resources/templates/template-workspace/admin/postcss.config.js +0 -6
- package/resources/templates/template-workspace/admin/tailwind.config.js +0 -73
- package/resources/templates/template-workspace/admin/vite-env.d.ts +0 -7
- package/resources/templates/template-workspace/scripts/generate-client.sh +0 -8
- package/resources/templates/{template-workspace → default}/.github/scripts/setup-actions-variables.sh +0 -0
- package/resources/templates/{template-workspace → default}/admin/app/components/logo.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/app/config.ts +0 -0
- package/resources/templates/{template-workspace → default}/admin/app/index.html +0 -0
- package/resources/templates/{template-workspace → default}/admin/app/pages/index.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/binding/delete.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/binding/index.ts +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/index.ts +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/board/index.ts +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/buttons/index.ts +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/buttons/link-back-button.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-leaf.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/export.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/index.ts +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/text.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/grid.tsx +0 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/index.ts +21 -21
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/layout-switcher.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dev/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dev/todo.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dimensions/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ListItemRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/OrderedListRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ParagraphRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ScrollTargetRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/plugins.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/errors/error-boundary.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/errors/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/errors/use-error-formatter.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/field/formatted-field.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/field/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/labels.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/formatting/formatting.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/formatting/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/images/formatImageResizeUrl.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/images/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/labels/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/layout/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/layout/layout.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/repeater/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/highlight.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInvite.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/toast/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/avatar.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/collapsible.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/divider.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/label.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/progress.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/separator.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/skeleton.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/upload/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/cn.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/public/favicon.png +0 -0
- /package/resources/templates/{template-workspace → default}/api/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/api/migrations/.gitkeep +0 -0
- /package/resources/templates/{template-workspace → default}/api/model/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/api/package.json +0 -0
- /package/resources/templates/{template-workspace → default}/api/tsconfig.json +0 -0
- /package/resources/templates/{template-workspace → default}/client/package.json +0 -0
- /package/resources/templates/{template-workspace → default}/client/src/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/client/tsconfig.json +0 -0
- /package/resources/templates/{template-workspace → default}/docker-compose.yaml +0 -0
- /package/resources/templates/{template-workspace → default}/tsconfig.json +0 -0
- /package/resources/templates/{template-workspace → default}/tsconfig.settings.json +0 -0
|
@@ -3,9 +3,9 @@ import { Loader } from '../ui/loader'
|
|
|
3
3
|
import { GripIcon } from 'lucide-react'
|
|
4
4
|
import { uic } from '../utils/uic'
|
|
5
5
|
|
|
6
|
-
export const UploaderDropzoneWrapperUI = uic('div', { baseClass: 'rounded border p-1 shadow' })
|
|
6
|
+
export const UploaderDropzoneWrapperUI = uic('div', { baseClass: 'rounded-sm border border-gray-200 p-1 shadow-sm' })
|
|
7
7
|
export const UploaderDropzoneAreaUI = uic('div', {
|
|
8
|
-
baseClass: `h-40 w-40 flex flex-col gap-1 justify-center items-center py-4 border-dashed border-2 border-gray-300 rounded relative
|
|
8
|
+
baseClass: `h-40 w-40 flex flex-col gap-1 justify-center items-center py-4 border-dashed border-2 border-gray-300 rounded-sm relative
|
|
9
9
|
transition-colors
|
|
10
10
|
hover:border-gray-300 hover:bg-gray-50 hover:cursor-pointer
|
|
11
11
|
data-[dropzone-accept]:border-green-500 group-data-[dropzone-accept]:bg-green-100
|
|
@@ -21,12 +21,10 @@ export const UploaderDropzoneAreaUI = uic('div', {
|
|
|
21
21
|
},
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
|
|
25
24
|
export const UploaderItemUI = uic('div', {
|
|
26
|
-
baseClass: 'rounded border p-1 shadow bg-gray-100 flex gap-2 relative',
|
|
25
|
+
baseClass: 'rounded-sm border border-gray-200 p-1 shadow-sm bg-gray-100 flex gap-2 relative',
|
|
27
26
|
})
|
|
28
27
|
|
|
29
|
-
|
|
30
28
|
export const UploaderInactiveDropzoneUI = uic('div', {
|
|
31
29
|
baseClass: 'h-40 w-40 flex flex-col pointer-events-none relative',
|
|
32
30
|
beforeChildren: <Loader position="absolute" />,
|
|
@@ -37,11 +35,9 @@ export const UploaderRepeaterItemsWrapperUI = uic('div', {
|
|
|
37
35
|
})
|
|
38
36
|
export const UploaderRepeaterItemUI = UploaderItemUI
|
|
39
37
|
export const UploaderRepeaterDragOverlayUI = uic('div', {
|
|
40
|
-
baseClass: 'rounded border border-gray-300 p-4 relative bg-
|
|
38
|
+
baseClass: 'rounded-sm border border-gray-300 p-4 relative bg-gray-100/60 backdrop-blur-xs',
|
|
41
39
|
})
|
|
42
40
|
export const UploaderRepeaterHandleUI = uic('button', {
|
|
43
41
|
baseClass: 'absolute top-0 left-0 h-6 w-6 inline-flex justify-center align-center opacity-10 hover:opacity-100 transition-opacity z-10',
|
|
44
42
|
beforeChildren: <GripIcon size={16} />,
|
|
45
43
|
})
|
|
46
|
-
|
|
47
|
-
|
package/resources/templates/{template-workspace → default}/admin/lib/upload/upload-progress.tsx
RENAMED
|
@@ -5,11 +5,18 @@ import * as React from 'react'
|
|
|
5
5
|
import { ReactNode, useEffect } from 'react'
|
|
6
6
|
import { Toast } from '../toast'
|
|
7
7
|
import { dict } from '../dict'
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
UploaderEachFile,
|
|
10
|
+
UploaderError,
|
|
11
|
+
UploaderFileStateError,
|
|
12
|
+
UploaderFileStateFinalizing,
|
|
13
|
+
UploaderFileStateSuccess,
|
|
14
|
+
UploaderFileStateSwitch,
|
|
15
|
+
UploaderFileStateUploading,
|
|
16
|
+
} from '@contember/react-uploader'
|
|
9
17
|
import { formatBytes } from '../formatting/formatting'
|
|
10
18
|
import { Loader } from '../ui/loader'
|
|
11
19
|
|
|
12
|
-
|
|
13
20
|
const formatError = (error: unknown) => {
|
|
14
21
|
if (error instanceof UploaderError) {
|
|
15
22
|
return dict.uploader.uploadErrors[error.options.type]
|
|
@@ -18,7 +25,11 @@ const formatError = (error: unknown) => {
|
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
const AbortButton = ({ state: { file: { abortController } } }: { state: UploaderFileStateFinalizing | UploaderFileStateUploading }) => {
|
|
21
|
-
return
|
|
28
|
+
return (
|
|
29
|
+
<Button className="p-1 h-5 text-red-500" variant="ghost" size={'sm'} onClick={() => abortController.abort()}>
|
|
30
|
+
<StopCircleIcon className="h-3 w-3" />
|
|
31
|
+
</Button>
|
|
32
|
+
)
|
|
22
33
|
}
|
|
23
34
|
|
|
24
35
|
const DismissButton = ({ state }: { state: UploaderFileStateSuccess | UploaderFileStateError }) => {
|
|
@@ -29,7 +40,11 @@ const DismissButton = ({ state }: { state: UploaderFileStateSuccess | UploaderFi
|
|
|
29
40
|
return () => clearTimeout(timeout)
|
|
30
41
|
}, [state])
|
|
31
42
|
|
|
32
|
-
return
|
|
43
|
+
return (
|
|
44
|
+
<Button className="p-1 h-5" variant="ghost" size={'sm'} onClick={() => state.dismiss()}>
|
|
45
|
+
<XIcon className="h-3 w-3" />
|
|
46
|
+
</Button>
|
|
47
|
+
)
|
|
33
48
|
}
|
|
34
49
|
|
|
35
50
|
const UploadError = ({ state: { error } }: { state: UploaderFileStateError }) => {
|
|
@@ -40,12 +55,14 @@ const UploadError = ({ state: { error } }: { state: UploaderFileStateError }) =>
|
|
|
40
55
|
return <div className="text-red-700 text-xs font-semibold">{formattedError}</div>
|
|
41
56
|
}
|
|
42
57
|
|
|
43
|
-
export const UploaderFileProgressUI = (
|
|
58
|
+
export const UploaderFileProgressUI = (
|
|
59
|
+
{ file, progress, info, actions }: { file: File; progress?: number; actions?: ReactNode; info?: ReactNode },
|
|
60
|
+
) => {
|
|
44
61
|
const fileName = file.name
|
|
45
62
|
const extension = file.name.split('.').pop()?.toUpperCase()
|
|
46
63
|
|
|
47
64
|
return (
|
|
48
|
-
<div className="border-t p-2 flex-1">
|
|
65
|
+
<div className="border-t border-gray-200 p-2 flex-1">
|
|
49
66
|
<div className="flex items-center gap-2">
|
|
50
67
|
<div className="relative">
|
|
51
68
|
<FileIcon className="w-10 h-10 text-gray-400" />
|
|
@@ -66,7 +83,6 @@ export const UploaderFileProgressUI = ({ file, progress, info, actions }: { file
|
|
|
66
83
|
)
|
|
67
84
|
}
|
|
68
85
|
|
|
69
|
-
|
|
70
86
|
export const UploaderProgress = () => {
|
|
71
87
|
const [open, setOpen] = React.useState(true)
|
|
72
88
|
|
|
@@ -94,12 +110,12 @@ export const UploaderProgress = () => {
|
|
|
94
110
|
file={it.file.file}
|
|
95
111
|
progress={100}
|
|
96
112
|
actions={<AbortButton state={it} />}
|
|
97
|
-
info={
|
|
113
|
+
info={
|
|
98
114
|
<div className="text-gray-400 text-xs inline-flex gap-1 items-center">
|
|
99
115
|
<Loader2Icon className="animate-spin h-3 w-3 inline-block" />
|
|
100
116
|
{formatBytes(it.file.file.size)}
|
|
101
117
|
</div>
|
|
102
|
-
|
|
118
|
+
}
|
|
103
119
|
/>
|
|
104
120
|
)}
|
|
105
121
|
error={it => (
|
|
@@ -114,12 +130,12 @@ export const UploaderProgress = () => {
|
|
|
114
130
|
file={it.file.file}
|
|
115
131
|
progress={100}
|
|
116
132
|
actions={<DismissButton state={it} />}
|
|
117
|
-
info={
|
|
133
|
+
info={
|
|
118
134
|
<div className="flex gap-1 items-center text-green-600 ">
|
|
119
135
|
<CheckIcon className="w-3 h-3" />
|
|
120
|
-
<div className="text-green-600 text-xs ">
|
|
136
|
+
<div className="text-green-600 text-xs ">Done ({formatBytes(it.file.file.size)})</div>
|
|
121
137
|
</div>
|
|
122
|
-
|
|
138
|
+
}
|
|
123
139
|
/>
|
|
124
140
|
)}
|
|
125
141
|
/>
|
|
@@ -23,14 +23,13 @@ export type BaseFileViewProps = {
|
|
|
23
23
|
DestroyAction?: ComponentType<{ children: ReactElement }>
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
27
26
|
export type UploadedImageViewProps =
|
|
28
27
|
& FileUrlDataExtractorProps
|
|
29
28
|
& GenericFileMetadataExtractorProps
|
|
30
29
|
& ImageFileDataExtractorProps
|
|
31
30
|
& BaseFileViewProps
|
|
32
31
|
|
|
33
|
-
export const UploadedImageView = Component<UploadedImageViewProps>(({ DestroyAction, edit, actions, baseField,
|
|
32
|
+
export const UploadedImageView = Component<UploadedImageViewProps>(({ DestroyAction, edit, actions, baseField, ...props }) => (
|
|
34
33
|
<div className="flex items-center justify-center h-40 rounded-md group relative">
|
|
35
34
|
<UploaderBase baseField={baseField}>
|
|
36
35
|
<ImagePreview urlField={props.urlField} />
|
|
@@ -40,9 +39,12 @@ export const UploadedImageView = Component<UploadedImageViewProps>(({ DestroyAct
|
|
|
40
39
|
))
|
|
41
40
|
|
|
42
41
|
const ImagePreview = Component((props: FileUrlDataExtractorProps) => (
|
|
43
|
-
<FieldView<string>
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
<FieldView<string>
|
|
43
|
+
field={props.urlField}
|
|
44
|
+
render={({ value: url }) => (
|
|
45
|
+
!url ? null : <img src={formatImageResizeUrl(url, { width: 400 })} className="max-w-full max-h-full" />
|
|
46
|
+
)}
|
|
47
|
+
/>
|
|
46
48
|
))
|
|
47
49
|
|
|
48
50
|
const ImageMetadata = Component(({ heightField, widthField, ...props }: UploadedImageViewProps) => (
|
|
@@ -51,8 +53,6 @@ const ImageMetadata = Component(({ heightField, widthField, ...props }: Uploaded
|
|
|
51
53
|
</Metadata>
|
|
52
54
|
))
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
56
|
export type UploadedAudioViewProps =
|
|
57
57
|
& FileUrlDataExtractorProps
|
|
58
58
|
& GenericFileMetadataExtractorProps
|
|
@@ -64,15 +64,17 @@ export const UploadedAudioView = Component<UploadedAudioViewProps>(({ DestroyAct
|
|
|
64
64
|
<UploaderBase baseField={baseField}>
|
|
65
65
|
<AudioPreview urlField={props.urlField} />
|
|
66
66
|
</UploaderBase>
|
|
67
|
-
<FileActions baseField={baseField} DestroyAction={DestroyAction} metadata={<AudioMetadata {...props} />} edit={edit}
|
|
68
|
-
actions={actions} />
|
|
67
|
+
<FileActions baseField={baseField} DestroyAction={DestroyAction} metadata={<AudioMetadata {...props} />} edit={edit} actions={actions} />
|
|
69
68
|
</div>
|
|
70
69
|
))
|
|
71
70
|
|
|
72
71
|
const AudioPreview = Component(({ urlField }: FileUrlDataExtractorProps) => (
|
|
73
|
-
<FieldView<string>
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
<FieldView<string>
|
|
73
|
+
field={urlField}
|
|
74
|
+
render={({ value: url }) => (
|
|
75
|
+
!url ? null : <audio src={url} controls className="max-w-full max-h-full" controlsList="nodownload noremoteplayback noplaybackrate" />
|
|
76
|
+
)}
|
|
77
|
+
/>
|
|
76
78
|
))
|
|
77
79
|
|
|
78
80
|
const AudioMetadata = Component(({ durationField, ...props }: UploadedAudioViewProps) => (
|
|
@@ -81,8 +83,6 @@ const AudioMetadata = Component(({ durationField, ...props }: UploadedAudioViewP
|
|
|
81
83
|
</Metadata>
|
|
82
84
|
))
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
86
|
export type UploadedVideoViewProps =
|
|
87
87
|
& FileUrlDataExtractorProps
|
|
88
88
|
& GenericFileMetadataExtractorProps
|
|
@@ -99,9 +99,12 @@ export const UploadedVideoView = Component<UploadedVideoViewProps>(({ DestroyAct
|
|
|
99
99
|
))
|
|
100
100
|
|
|
101
101
|
const VideoPreview = Component(({ urlField }: FileUrlDataExtractorProps) => (
|
|
102
|
-
<FieldView<string>
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
<FieldView<string>
|
|
103
|
+
field={urlField}
|
|
104
|
+
render={({ value: url }) => (
|
|
105
|
+
!url ? null : <video src={url} controls className="max-w-full max-h-full" controlsList="nodownload noremoteplayback noplaybackrate" />
|
|
106
|
+
)}
|
|
107
|
+
/>
|
|
105
108
|
))
|
|
106
109
|
|
|
107
110
|
const VideoMetadata = Component(({ durationField, widthField, heightField, ...props }: UploadedVideoViewProps) => (
|
|
@@ -111,8 +114,6 @@ const VideoMetadata = Component(({ durationField, widthField, heightField, ...pr
|
|
|
111
114
|
</Metadata>
|
|
112
115
|
))
|
|
113
116
|
|
|
114
|
-
|
|
115
|
-
|
|
116
117
|
export type UploadedAnyViewProps =
|
|
117
118
|
& FileUrlDataExtractorProps
|
|
118
119
|
& GenericFileMetadataExtractorProps
|
|
@@ -127,16 +128,43 @@ export const UploadedAnyView = Component<UploadedAnyViewProps>(({ DestroyAction,
|
|
|
127
128
|
</div>
|
|
128
129
|
))
|
|
129
130
|
|
|
130
|
-
const AnyFilePreview = Component(({ urlField, fileNameField }: FileUrlDataExtractorProps & GenericFileMetadataExtractorProps) =>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
const AnyFilePreview = Component(({ urlField, fileNameField }: FileUrlDataExtractorProps & GenericFileMetadataExtractorProps) => (
|
|
132
|
+
<>
|
|
133
|
+
<FieldView<string>
|
|
134
|
+
field={urlField}
|
|
135
|
+
render={({ value: url }) => (
|
|
136
|
+
url
|
|
137
|
+
? (
|
|
138
|
+
<a
|
|
139
|
+
href={url ?? '#'}
|
|
140
|
+
target="_blank"
|
|
141
|
+
rel="noreferrer"
|
|
142
|
+
className="text-blue-600 hover:text-blue-700 underline overflow-hidden whitespace-nowrap text-ellipsis flex flex-col group/anchor flex-1 items-center justify-center"
|
|
143
|
+
>
|
|
144
|
+
<FileIcon className="h-16 w-16 text-gray-400 group-hover/anchor:text-gray-500 transition-all" />
|
|
145
|
+
{fileNameField
|
|
146
|
+
? (
|
|
147
|
+
<span>
|
|
148
|
+
<Field field={fileNameField} />
|
|
149
|
+
</span>
|
|
150
|
+
)
|
|
151
|
+
: null}
|
|
152
|
+
</a>
|
|
153
|
+
)
|
|
154
|
+
: null
|
|
155
|
+
)}
|
|
156
|
+
/>
|
|
157
|
+
<StaticRender>
|
|
158
|
+
{fileNameField
|
|
159
|
+
? (
|
|
160
|
+
<span>
|
|
161
|
+
<Field field={fileNameField} />
|
|
162
|
+
</span>
|
|
163
|
+
)
|
|
164
|
+
: null}
|
|
165
|
+
</StaticRender>
|
|
166
|
+
</>
|
|
167
|
+
))
|
|
140
168
|
|
|
141
169
|
type MetadataProps =
|
|
142
170
|
& FileUrlDataExtractorProps
|
|
@@ -152,12 +180,15 @@ const Metadata = Component(({ children, urlField, fileSizeField, fileNameField,
|
|
|
152
180
|
<MetaField field={fileNameField} label="File name:" />
|
|
153
181
|
{children}
|
|
154
182
|
<MetaField field={lastModifiedField} label="Date:" format={formatDate} />
|
|
155
|
-
<MetaField
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
183
|
+
<MetaField
|
|
184
|
+
field={urlField}
|
|
185
|
+
label="URL:"
|
|
186
|
+
format={url => (
|
|
187
|
+
<a href={url} target="_blank" rel="noreferrer" className="text-blue-600 underline overflow-hidden whitespace-nowrap text-ellipsis">
|
|
188
|
+
{url.replace(/^(.{15}).*(.{15})$/, '$1…$2')}
|
|
189
|
+
</a>
|
|
190
|
+
)}
|
|
191
|
+
/>
|
|
161
192
|
</div>
|
|
162
193
|
))
|
|
163
194
|
|
|
@@ -168,10 +199,17 @@ const DimensionsMeta = Component(({ widthField, heightField }: {
|
|
|
168
199
|
if (!widthField || !heightField) {
|
|
169
200
|
return null
|
|
170
201
|
}
|
|
171
|
-
return
|
|
172
|
-
<
|
|
173
|
-
|
|
174
|
-
|
|
202
|
+
return (
|
|
203
|
+
<FieldView<number, number>
|
|
204
|
+
fields={[widthField, heightField]}
|
|
205
|
+
render={(width, height) => (
|
|
206
|
+
<>
|
|
207
|
+
<span className="font-semibold text-right">Dimensions:</span>
|
|
208
|
+
<span>{width.value} x {height.value} px</span>
|
|
209
|
+
</>
|
|
210
|
+
)}
|
|
211
|
+
/>
|
|
212
|
+
)
|
|
175
213
|
})
|
|
176
214
|
|
|
177
215
|
interface MetaFieldProps {
|
|
@@ -180,47 +218,71 @@ interface MetaFieldProps {
|
|
|
180
218
|
format?: (value: any) => ReactNode
|
|
181
219
|
}
|
|
182
220
|
const MetaField = Component<MetaFieldProps>(({ field, label, format = it => it }) => (
|
|
183
|
-
!field ? null :
|
|
184
|
-
<
|
|
185
|
-
|
|
186
|
-
|
|
221
|
+
!field ? null : (
|
|
222
|
+
<FieldView<any>
|
|
223
|
+
field={field}
|
|
224
|
+
render={value => (
|
|
225
|
+
<>
|
|
226
|
+
<span className="font-semibold text-right">{label}</span>
|
|
227
|
+
<span>{format(value.value)}</span>
|
|
228
|
+
</>
|
|
229
|
+
)}
|
|
230
|
+
/>
|
|
231
|
+
)
|
|
187
232
|
))
|
|
188
233
|
|
|
189
|
-
|
|
190
234
|
const FileActions = Component(({ DestroyAction, metadata, actions, edit, baseField, noDestroy }: {
|
|
191
235
|
metadata?: ReactNode
|
|
192
236
|
} & BaseFileViewProps) => {
|
|
193
237
|
return (
|
|
194
|
-
<div className="absolute -top-2 -right-1 p-0.5 bg-gray-200 border border-gray-300 rounded shadow flex gap-2 opacity-0 transition-opacity group-hover:opacity-100">
|
|
238
|
+
<div className="absolute -top-2 -right-1 p-0.5 bg-gray-200 border border-gray-300 rounded-sm shadow-sm flex gap-2 opacity-0 transition-opacity group-hover:opacity-100">
|
|
195
239
|
{actions}
|
|
196
|
-
{edit &&
|
|
197
|
-
<
|
|
198
|
-
<Button variant={'ghost'} size={'sm'} className={'p-0.5 h-5 w-5'} onClick={e => e.stopPropagation()}>
|
|
199
|
-
<EditIcon className="h-4 w-4" />
|
|
200
|
-
</Button>
|
|
201
|
-
</PopoverTrigger>
|
|
202
|
-
<PopoverContent>
|
|
203
|
-
{edit}
|
|
204
|
-
</PopoverContent>
|
|
205
|
-
</Popover>}
|
|
206
|
-
<UploaderBase baseField={baseField}>
|
|
207
|
-
{metadata && <Popover>
|
|
240
|
+
{edit && (
|
|
241
|
+
<Popover>
|
|
208
242
|
<PopoverTrigger asChild>
|
|
209
|
-
<Button
|
|
210
|
-
|
|
243
|
+
<Button
|
|
244
|
+
variant={'ghost'}
|
|
245
|
+
size={'sm'}
|
|
246
|
+
className={'p-0.5 h-5 w-5'}
|
|
247
|
+
onClick={e => e.stopPropagation()}
|
|
248
|
+
>
|
|
249
|
+
<EditIcon className="h-4 w-4" />
|
|
211
250
|
</Button>
|
|
212
251
|
</PopoverTrigger>
|
|
213
252
|
<PopoverContent>
|
|
214
|
-
|
|
215
|
-
{metadata}
|
|
216
|
-
</div>
|
|
253
|
+
{edit}
|
|
217
254
|
</PopoverContent>
|
|
218
|
-
</Popover>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
255
|
+
</Popover>
|
|
256
|
+
)}
|
|
257
|
+
<UploaderBase baseField={baseField}>
|
|
258
|
+
{metadata && (
|
|
259
|
+
<Popover>
|
|
260
|
+
<PopoverTrigger asChild>
|
|
261
|
+
<Button
|
|
262
|
+
variant={'ghost'}
|
|
263
|
+
size={'sm'}
|
|
264
|
+
className={'p-0.5 h-5 w-5'}
|
|
265
|
+
onClick={e => e.stopPropagation()}
|
|
266
|
+
>
|
|
267
|
+
<InfoIcon className="h-4 w-4" />
|
|
268
|
+
</Button>
|
|
269
|
+
</PopoverTrigger>
|
|
270
|
+
<PopoverContent>
|
|
271
|
+
<div className="text-sm">
|
|
272
|
+
{metadata}
|
|
273
|
+
</div>
|
|
274
|
+
</PopoverContent>
|
|
275
|
+
</Popover>
|
|
276
|
+
)}
|
|
277
|
+
{!noDestroy && DestroyAction
|
|
278
|
+
? (
|
|
279
|
+
<DestroyAction>
|
|
280
|
+
<Button variant={'ghost'} size={'sm'} className={'p-0.5 h-5 w-5 text-red-500'}>
|
|
281
|
+
<TrashIcon className="h-4 w-4" />
|
|
282
|
+
</Button>
|
|
283
|
+
</DestroyAction>
|
|
284
|
+
)
|
|
285
|
+
: null}
|
|
224
286
|
</UploaderBase>
|
|
225
287
|
</div>
|
|
226
288
|
)
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { ComponentType, memo, SetStateAction, useCallback, useState } from 'react'
|
|
2
2
|
import { createRequiredContext } from '@contember/react-utils'
|
|
3
3
|
|
|
4
|
-
export const createComponentOpenHooks = <
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
export const createComponentOpenHooks = <
|
|
5
|
+
P extends {
|
|
6
|
+
open?: boolean
|
|
7
|
+
defaultOpen?: boolean
|
|
8
|
+
onOpenChange?(open: boolean): void
|
|
9
|
+
},
|
|
10
|
+
>(Component: ComponentType<P>): {
|
|
9
11
|
Component: ComponentType<P>
|
|
10
12
|
useOpen: () => [boolean, (value: SetStateAction<boolean>) => void]
|
|
11
13
|
} => {
|
|
12
|
-
const [ctx, useOpen] = createRequiredContext<[boolean, (value: SetStateAction<boolean>) => void]>(
|
|
14
|
+
const [ctx, useOpen] = createRequiredContext<[boolean, (value: SetStateAction<boolean>) => void]>(
|
|
15
|
+
`${Component.displayName ?? 'UnnamedComponent'}OpenContext`,
|
|
16
|
+
)
|
|
13
17
|
const WrappedComponent = memo<P>(({ open: openIn, defaultOpen, onOpenChange, ...props }) => {
|
|
14
18
|
const [open, setOpenInternal] = useState(openIn ?? defaultOpen ?? false)
|
|
15
19
|
if (openIn !== undefined && open !== openIn) {
|
|
@@ -10,12 +10,14 @@ type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T
|
|
|
10
10
|
type ConfigSchema = Record<string, Record<string, ClassValue>>
|
|
11
11
|
|
|
12
12
|
export type ConfigVariants<T extends ConfigSchema | undefined> = T extends ConfigSchema ? {
|
|
13
|
-
|
|
14
|
-
}
|
|
13
|
+
[Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | null | undefined
|
|
14
|
+
}
|
|
15
|
+
: {}
|
|
15
16
|
|
|
16
17
|
type ConfigVariantsMulti<T extends ConfigSchema | undefined> = T extends ConfigSchema ? {
|
|
17
|
-
|
|
18
|
-
}
|
|
18
|
+
[Variant in keyof T]?: StringToBoolean<keyof T[Variant]> | StringToBoolean<keyof T[Variant]>[] | undefined
|
|
19
|
+
}
|
|
20
|
+
: {}
|
|
19
21
|
|
|
20
22
|
type DataAttr<T extends ConfigSchema | undefined> = T extends ConfigSchema ? `data-${keyof T & string}` : never
|
|
21
23
|
type DataAttrValue = boolean | string | number | undefined | null
|
|
@@ -24,9 +26,12 @@ type Config<T extends ConfigSchema | undefined, El extends React.ElementType> =
|
|
|
24
26
|
baseClass?: ClassValue
|
|
25
27
|
variants?: T
|
|
26
28
|
passVariantProps?: string[]
|
|
27
|
-
defaultProps?: Partial<
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
defaultProps?: Partial<
|
|
30
|
+
& React.ComponentProps<El>
|
|
31
|
+
& {
|
|
32
|
+
[K in `data-${string}`]?: DataAttrValue
|
|
33
|
+
}
|
|
34
|
+
>
|
|
30
35
|
defaultVariants?: ConfigVariants<T>
|
|
31
36
|
compoundVariants?: ((ConfigVariants<T> | ConfigVariantsMulti<T>) & { className?: string })[]
|
|
32
37
|
variantsAsDataAttrs?: (keyof ConfigVariants<T>)[]
|
|
@@ -42,7 +47,10 @@ export const uiconfig = <T extends ConfigSchema | undefined>(config: Config<T, C
|
|
|
42
47
|
|
|
43
48
|
export type NoInfer<T> = T & { [K in keyof T]: T[K] }
|
|
44
49
|
|
|
45
|
-
export const uic = <El extends React.ElementType, Variants extends ConfigSchema | undefined = undefined>(
|
|
50
|
+
export const uic = <El extends React.ElementType, Variants extends ConfigSchema | undefined = undefined>(
|
|
51
|
+
Component: El,
|
|
52
|
+
config: Config<Variants, NoInfer<El>>,
|
|
53
|
+
) => {
|
|
46
54
|
const cls = cva<any>(config?.baseClass as any, {
|
|
47
55
|
variants: config?.variants,
|
|
48
56
|
defaultVariants: config?.defaultVariants,
|
|
@@ -50,11 +58,14 @@ export const uic = <El extends React.ElementType, Variants extends ConfigSchema
|
|
|
50
58
|
})
|
|
51
59
|
const passVariantProps = config?.passVariantProps ? new Set(config.passVariantProps) : undefined
|
|
52
60
|
|
|
53
|
-
const component = forwardRef<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
const component = forwardRef<
|
|
62
|
+
React.ComponentRef<El>,
|
|
63
|
+
React.ComponentProps<El> & {
|
|
64
|
+
asChild?: boolean
|
|
65
|
+
children?: ReactNode
|
|
66
|
+
className?: string
|
|
67
|
+
} & ConfigVariants<Variants>
|
|
68
|
+
>((props, ref) => {
|
|
58
69
|
const { className: classNameProp, children: childrenBase, ...rest } = props
|
|
59
70
|
|
|
60
71
|
const variants: Record<string, string> = {}
|
|
@@ -99,7 +110,6 @@ export const uic = <El extends React.ElementType, Variants extends ConfigSchema
|
|
|
99
110
|
]
|
|
100
111
|
}
|
|
101
112
|
|
|
102
|
-
|
|
103
113
|
const innerEl = (
|
|
104
114
|
<FinalComponent
|
|
105
115
|
ref={ref}
|
|
@@ -3,9 +3,7 @@ import { useEffect, useState } from 'react'
|
|
|
3
3
|
const MOBILE_BREAKPOINT = 768
|
|
4
4
|
|
|
5
5
|
export const useIsMobile = () => {
|
|
6
|
-
const [isMobile, setIsMobile] = useState(() =>
|
|
7
|
-
typeof window !== 'undefined' ? window.innerWidth < MOBILE_BREAKPOINT : false,
|
|
8
|
-
)
|
|
6
|
+
const [isMobile, setIsMobile] = useState(() => typeof window !== 'undefined' ? window.innerWidth < MOBILE_BREAKPOINT : false)
|
|
9
7
|
|
|
10
8
|
useEffect(() => {
|
|
11
9
|
if (typeof window === 'undefined') return
|
|
@@ -9,14 +9,13 @@
|
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@contember/vite-plugin": "{version}",
|
|
12
|
+
"@tailwindcss/vite": "^4",
|
|
12
13
|
"@types/react": "^18",
|
|
13
14
|
"@types/react-dom": "^18",
|
|
14
15
|
"@vitejs/plugin-react": "^4.2.1",
|
|
15
|
-
"
|
|
16
|
-
"postcss": "^8",
|
|
17
|
-
"tailwindcss": "^3",
|
|
16
|
+
"tailwindcss": "^4",
|
|
18
17
|
"tailwindcss-animate": "^1.0.7",
|
|
19
|
-
"vite": "^
|
|
18
|
+
"vite": "^7"
|
|
20
19
|
},
|
|
21
20
|
"dependencies": {
|
|
22
21
|
"@contember/client-content": "{version}",
|
|
@@ -37,6 +36,7 @@
|
|
|
37
36
|
"@contember/react-uploader": "{version}",
|
|
38
37
|
"@contember/react-uploader-dropzone": "{version}",
|
|
39
38
|
"@radix-ui/react-alert-dialog": "^1.1.2",
|
|
39
|
+
"@radix-ui/react-avatar": "^1.1.3",
|
|
40
40
|
"@radix-ui/react-dialog": "^1.1.2",
|
|
41
41
|
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
|
42
42
|
"@radix-ui/react-label": "^2.1.0",
|
|
@@ -45,12 +45,14 @@
|
|
|
45
45
|
"@radix-ui/react-progress": "^1.1.0",
|
|
46
46
|
"@radix-ui/react-scroll-area": "^1.2.0",
|
|
47
47
|
"@radix-ui/react-select": "^2.1.2",
|
|
48
|
+
"@radix-ui/react-separator": "^1.1.2",
|
|
48
49
|
"@radix-ui/react-slot": "^1.1.0",
|
|
49
50
|
"@radix-ui/react-switch": "^1.1.1",
|
|
50
51
|
"@radix-ui/react-toast": "^1.2.2",
|
|
51
52
|
"@radix-ui/react-toggle": "^1.1.0",
|
|
52
53
|
"@radix-ui/react-toggle-group": "^1.1.0",
|
|
53
54
|
"@radix-ui/react-tooltip": "^1.1.3",
|
|
55
|
+
"@sentry/react": "^8.47.0",
|
|
54
56
|
"class-variance-authority": "^0.7.0",
|
|
55
57
|
"clsx": "^2.1.1",
|
|
56
58
|
"lucide-react": "^0.451.0",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as Sentry from '@sentry/react'
|
|
2
|
+
|
|
3
|
+
const sentryDsn = import.meta.env.VITE_SENTRY_DSN
|
|
4
|
+
const enableSentry = sentryDsn && import.meta.env.MODE === 'production'
|
|
5
|
+
const projectName = import.meta.env.VITE_CONTEMBER_ADMIN_PROJECT_NAME
|
|
6
|
+
|
|
7
|
+
Sentry.init({
|
|
8
|
+
enabled: enableSentry,
|
|
9
|
+
dsn: sentryDsn,
|
|
10
|
+
integrations: [
|
|
11
|
+
Sentry.browserApiErrorsIntegration(),
|
|
12
|
+
Sentry.browserSessionIntegration(),
|
|
13
|
+
Sentry.browserTracingIntegration(),
|
|
14
|
+
Sentry.captureConsoleIntegration({ levels: ['error'] }),
|
|
15
|
+
Sentry.replayIntegration(),
|
|
16
|
+
],
|
|
17
|
+
initialScope: {
|
|
18
|
+
tags: {
|
|
19
|
+
environment: import.meta.env.MODE,
|
|
20
|
+
projectName: projectName,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
tracesSampleRate: 1,
|
|
24
|
+
replaysSessionSampleRate: 0,
|
|
25
|
+
replaysOnErrorSampleRate: 1,
|
|
26
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
interface ImportMetaEnv {
|
|
4
|
+
readonly VITE_CONTEMBER_ADMIN_API_BASE_URL: string
|
|
5
|
+
readonly VITE_CONTEMBER_ADMIN_SESSION_TOKEN: string
|
|
6
|
+
readonly VITE_CONTEMBER_ADMIN_LOGIN_TOKEN: string
|
|
7
|
+
readonly VITE_CONTEMBER_ADMIN_PROJECT_NAME: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface ImportMeta {
|
|
11
|
+
readonly env: ImportMetaEnv
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import contember from '@contember/vite-plugin'
|
|
2
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
3
|
+
import react from '@vitejs/plugin-react'
|
|
4
|
+
import { defineConfig } from 'vite'
|
|
5
|
+
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
6
|
+
|
|
7
|
+
export default defineConfig(() => {
|
|
8
|
+
return {
|
|
9
|
+
plugins: [tsconfigPaths(), tailwindcss(), react(), contember()],
|
|
10
|
+
}
|
|
11
|
+
})
|