@contember/create 2.0.0-alpha.8 → 2.0.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 +0 -2
- package/dist/development/run.cjs.map +1 -1
- package/dist/development/run.js +0 -2
- package/dist/development/run.js.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/development/src/lib/FileSystem.cjs.map +1 -1
- package/dist/development/src/lib/FileSystem.js.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.cjs +1 -8
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js +2 -9
- package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/development/src/lib/version.cjs.map +1 -1
- package/dist/development/src/paths.cjs +3 -1
- package/dist/development/src/paths.cjs.map +1 -1
- package/dist/development/src/paths.js +4 -2
- package/dist/development/src/paths.js.map +1 -1
- package/dist/production/run.cjs +0 -2
- package/dist/production/run.cjs.map +1 -1
- package/dist/production/run.js +0 -2
- package/dist/production/run.js.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/production/src/lib/FileSystem.cjs.map +1 -1
- package/dist/production/src/lib/FileSystem.js.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.cjs +1 -8
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js +2 -9
- package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/production/src/lib/version.cjs.map +1 -1
- package/dist/production/src/paths.cjs +3 -1
- package/dist/production/src/paths.cjs.map +1 -1
- package/dist/production/src/paths.js +4 -2
- package/dist/production/src/paths.js.map +1 -1
- package/dist/types/lib/TemplateInstaller.d.ts +1 -3
- package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
- package/dist/types/paths.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -31
- package/resources/templates/template-workspace/.github/scripts/setup-actions-variables.sh +36 -0
- package/resources/templates/template-workspace/.github/workflows/deploy.yaml +23 -0
- package/resources/templates/template-workspace/admin/lib/binding/binding.tsx +12 -2
- package/resources/templates/template-workspace/admin/lib/binding/delete.tsx +34 -23
- package/resources/templates/template-workspace/admin/lib/binding/hooks.tsx +5 -6
- package/resources/templates/template-workspace/admin/lib/binding/identity.tsx +34 -3
- package/resources/templates/template-workspace/admin/lib/binding/navigation-guard-dialog.tsx +39 -0
- package/resources/templates/template-workspace/admin/lib/binding/persist.tsx +10 -60
- package/resources/templates/template-workspace/admin/lib/block-repeater/block-repeater.tsx +109 -39
- package/resources/templates/template-workspace/admin/lib/buttons/link-back-button.tsx +1 -1
- package/resources/templates/template-workspace/admin/lib/datagrid/cells.tsx +90 -10
- package/resources/templates/template-workspace/admin/lib/datagrid/column-header.tsx +12 -4
- package/resources/templates/template-workspace/admin/lib/datagrid/column-leaf.tsx +21 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/columns.tsx +367 -36
- package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +6 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/export.tsx +9 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/boolean.tsx +22 -5
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/common.tsx +3 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/date.tsx +25 -2
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/defined.tsx +103 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/enum.tsx +83 -27
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/index.ts +1 -1
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/mobile.tsx +0 -1
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/number.tsx +21 -5
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/relation.tsx +170 -43
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/text.tsx +48 -5
- package/resources/templates/template-workspace/admin/lib/datagrid/grid.tsx +97 -25
- package/resources/templates/template-workspace/admin/lib/datagrid/index.ts +30 -4
- package/resources/templates/template-workspace/admin/lib/datagrid/labels.tsx +31 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/layout-switcher.tsx +3 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/loader.tsx +44 -2
- package/resources/templates/template-workspace/admin/lib/datagrid/pagination.tsx +8 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/table.tsx +15 -1
- package/resources/templates/template-workspace/admin/lib/datagrid/tiles.tsx +13 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/toolbar.tsx +27 -2
- package/resources/templates/template-workspace/admin/lib/dict.ts +54 -5
- package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +1 -1
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-canvas.tsx +2 -2
- package/resources/templates/template-workspace/admin/lib/editor/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/editor/rich-text-view.tsx +17 -0
- package/resources/templates/template-workspace/admin/lib/field/formatted-field.tsx +10 -0
- package/resources/templates/template-workspace/admin/lib/field/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/form/container.tsx +43 -45
- package/resources/templates/template-workspace/admin/lib/form/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/form/inputs.tsx +56 -23
- package/resources/templates/template-workspace/admin/lib/form/select.tsx +61 -30
- package/resources/templates/template-workspace/admin/lib/form/ui.tsx +11 -2
- package/resources/templates/template-workspace/admin/lib/form/upload-repeaters.tsx +188 -0
- package/resources/templates/template-workspace/admin/lib/form/upload.tsx +57 -242
- package/resources/templates/template-workspace/admin/lib/formatting/formatting.ts +23 -0
- package/resources/templates/template-workspace/admin/lib/labels/enum-labels.ts +9 -0
- package/resources/templates/template-workspace/admin/lib/labels/field-labels.ts +7 -0
- package/resources/templates/template-workspace/admin/lib/labels/index.ts +2 -0
- package/resources/templates/template-workspace/admin/lib/layout/layout.tsx +3 -3
- package/resources/templates/template-workspace/admin/lib/repeater/repeater.tsx +97 -64
- package/resources/templates/template-workspace/admin/lib/select/filter.tsx +3 -2
- package/resources/templates/template-workspace/admin/lib/select/index.ts +0 -1
- package/resources/templates/template-workspace/admin/lib/select/list.tsx +78 -26
- package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +12 -19
- package/resources/templates/template-workspace/admin/lib/select/select.tsx +40 -23
- package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +23 -18
- package/resources/templates/template-workspace/admin/lib/select/ui.tsx +3 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/invite.tsx +5 -3
- package/resources/templates/template-workspace/admin/lib/tenant/forms/memberships-control.tsx +28 -16
- package/resources/templates/template-workspace/admin/lib/tenant/forms/password-reset.tsx +9 -6
- package/resources/templates/template-workspace/admin/lib/tenant/forms/passwordless-signin-init.tsx +31 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/passwordless-signin.tsx +59 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/update-project-member.tsx +5 -3
- package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInvite.ts +1 -1
- package/resources/templates/template-workspace/admin/lib/tenant/listing/member-list.tsx +6 -5
- package/resources/templates/template-workspace/admin/lib/tenant/listing/person-list.tsx +2 -1
- package/resources/templates/template-workspace/admin/lib/ui/alert-dialog.tsx +2 -1
- package/resources/templates/template-workspace/admin/lib/ui/collapsible.tsx +9 -0
- package/resources/templates/template-workspace/admin/lib/ui/dialog.tsx +2 -1
- package/resources/templates/template-workspace/admin/lib/ui/dropdown.tsx +2 -1
- package/resources/templates/template-workspace/admin/lib/ui/input.tsx +14 -10
- package/resources/templates/template-workspace/admin/lib/ui/menu.tsx +2 -3
- package/resources/templates/template-workspace/admin/lib/ui/popover.tsx +2 -1
- package/resources/templates/template-workspace/admin/lib/ui/property-list.tsx +33 -0
- package/resources/templates/template-workspace/admin/lib/ui/select.tsx +80 -0
- package/resources/templates/template-workspace/admin/lib/ui/sheet.tsx +3 -2
- package/resources/templates/template-workspace/admin/lib/ui/textarea.tsx +9 -1
- package/resources/templates/template-workspace/admin/lib/upload/view.tsx +160 -165
- package/resources/templates/template-workspace/admin/lib/utils/createComponentOpenHooks.tsx +38 -0
- package/resources/templates/template-workspace/admin/lib/utils/uic.tsx +3 -3
- package/resources/templates/template-workspace/admin/package.json +21 -20
- package/resources/templates/template-workspace/package.json +3 -3
- package/src/lib/TemplateInstaller.ts +2 -9
- package/src/paths.ts +4 -3
- package/src/run.ts +0 -2
- package/tsconfig.settings.json +0 -4
- package/dist/development/src/lib/PackageDownloader.cjs +0 -33
- package/dist/development/src/lib/PackageDownloader.cjs.map +0 -1
- package/dist/development/src/lib/PackageDownloader.js +0 -33
- package/dist/development/src/lib/PackageDownloader.js.map +0 -1
- package/dist/production/src/lib/PackageDownloader.cjs +0 -33
- package/dist/production/src/lib/PackageDownloader.cjs.map +0 -1
- package/dist/production/src/lib/PackageDownloader.js +0 -33
- package/dist/production/src/lib/PackageDownloader.js.map +0 -1
- package/dist/types/lib/PackageDownloader.d.ts +0 -7
- package/dist/types/lib/PackageDownloader.d.ts.map +0 -1
- package/resources/templates/template-workspace/admin/.env.production +0 -3
- package/resources/templates/template-workspace/admin/lib/select/pagination.tsx +0 -48
- package/src/lib/PackageDownloader.ts +0 -33
- package/types/download-tarball/index.d.ts +0 -7
- package/types/get-package-json-from-registry/index.d.ts +0 -3
- package/types/registry-info/index.d.ts +0 -7
|
@@ -1,10 +1,52 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
+
import { ReactNode } from 'react'
|
|
2
3
|
import { Loader } from '../ui/loader'
|
|
4
|
+
import { DataViewLoaderState } from '@contember/react-dataview'
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Props for the {@link DataGridLoader} component.
|
|
8
|
+
*/
|
|
9
|
+
export interface DataGridLoaderProps {
|
|
10
|
+
children: ReactNode
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A component that provides a loading state for a data grid.
|
|
15
|
+
* It displays different loaders based on the current loading state.
|
|
16
|
+
*
|
|
17
|
+
* ## Example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <DataGridLoader>
|
|
20
|
+
* <DataGridTable>
|
|
21
|
+
* <DataGridTextColumn header="Title" field="title" />
|
|
22
|
+
* </DataGridTable>
|
|
23
|
+
* </DataGridLoader>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export const DataGridLoader = ({ children }: { children: ReactNode }) => (
|
|
27
|
+
<>
|
|
28
|
+
<DataViewLoaderState refreshing loaded>
|
|
29
|
+
<div className="relative">
|
|
30
|
+
<DataViewLoaderState refreshing>
|
|
31
|
+
<DataGridOverlayLoader />
|
|
32
|
+
</DataViewLoaderState>
|
|
33
|
+
{children}
|
|
34
|
+
</div>
|
|
35
|
+
</DataViewLoaderState>
|
|
36
|
+
<DataViewLoaderState initial>
|
|
37
|
+
<DataGridInitialLoader />
|
|
38
|
+
</DataViewLoaderState>
|
|
39
|
+
<DataViewLoaderState failed>
|
|
40
|
+
<div>Failed to load data</div>
|
|
41
|
+
</DataViewLoaderState>
|
|
42
|
+
</>
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
const DataGridOverlayLoader = () => (
|
|
5
47
|
<Loader position={'absolute'} />
|
|
6
48
|
)
|
|
7
49
|
|
|
8
|
-
|
|
50
|
+
const DataGridInitialLoader = () => (
|
|
9
51
|
<Loader position={'static'} />
|
|
10
52
|
)
|
|
@@ -7,6 +7,14 @@ import { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../u
|
|
|
7
7
|
import { dictFormat } from '../dict'
|
|
8
8
|
import { dict } from '../dict'
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Pagination controls UI for DataView.
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <DataGridPagination />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
10
18
|
export const DataGridPagination = () => (
|
|
11
19
|
<div className="flex gap-6 lg:gap-8 justify-between mt-4">
|
|
12
20
|
<div className="">
|
|
@@ -6,12 +6,26 @@ import { DataViewEachRow, DataViewEmpty, DataViewLayout, DataViewNonEmpty } from
|
|
|
6
6
|
import { SheetIcon } from 'lucide-react'
|
|
7
7
|
import { dict } from '../dict'
|
|
8
8
|
import { ChildrenAnalyzer, Leaf } from '@contember/react-multipass-rendering'
|
|
9
|
-
import { DataGridColumnLeaf, DataGridColumnLeafProps } from './columns'
|
|
10
9
|
|
|
10
|
+
import { DataGridColumnLeaf, DataGridColumnLeafProps } from './column-leaf'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Props for the {@link DataGridTable} component.
|
|
14
|
+
*/
|
|
11
15
|
export interface DataViewTableProps {
|
|
12
16
|
children: ReactNode
|
|
13
17
|
}
|
|
14
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Table layout for DataView.
|
|
21
|
+
*
|
|
22
|
+
* ## Example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <DataGridTable>
|
|
25
|
+
* <DataGridTextColumn header="Title" field="title" />
|
|
26
|
+
* </DataGridTable>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
15
29
|
export const DataGridTable = Component<DataViewTableProps>(({ children }) => {
|
|
16
30
|
return (
|
|
17
31
|
<DataViewLayout name="table" label={<>
|
|
@@ -5,11 +5,24 @@ import { dict } from '../dict'
|
|
|
5
5
|
import { LayoutGridIcon } from 'lucide-react'
|
|
6
6
|
import { cn } from '../utils'
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Props for the {@link DataGridTiles} component.
|
|
10
|
+
*/
|
|
8
11
|
export interface DataGridTilesProps {
|
|
9
12
|
children: React.ReactNode
|
|
10
13
|
className?: string
|
|
11
14
|
}
|
|
12
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Simple grid layout for DataView.
|
|
18
|
+
*
|
|
19
|
+
* ## Example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <DataGridTiles>
|
|
22
|
+
* <MyCustomTile />
|
|
23
|
+
* </DataGridTiles>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
13
26
|
export const DataGridTiles = Component< DataGridTilesProps>(({ children, className }) => {
|
|
14
27
|
return (
|
|
15
28
|
<DataViewLayout name={'grid'} label={<>
|
|
@@ -4,7 +4,7 @@ import { ReactNode } from 'react'
|
|
|
4
4
|
import { DataGridShowFiltersContext } from './filters/mobile'
|
|
5
5
|
import { DataGridToolbarUI } from './ui'
|
|
6
6
|
import { Button } from '../ui/button'
|
|
7
|
-
import { FilterIcon, SettingsIcon } from 'lucide-react'
|
|
7
|
+
import { FilterIcon, RefreshCcwIcon, SettingsIcon } from 'lucide-react'
|
|
8
8
|
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'
|
|
9
9
|
import { DataGridLayoutSwitcher } from './layout-switcher'
|
|
10
10
|
import { DataGridPerPageSelector } from './pagination'
|
|
@@ -13,11 +13,31 @@ import { dataAttribute } from '@contember/utilities'
|
|
|
13
13
|
import { dict } from '../dict'
|
|
14
14
|
import { DataGridAutoExport } from './export'
|
|
15
15
|
import { DataGridToolbarVisibleElements } from './elements'
|
|
16
|
+
import { DataViewReloadTrigger } from '@contember/react-dataview'
|
|
16
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Props for the {@link DataGridToolbar} component.
|
|
20
|
+
*/
|
|
17
21
|
export interface DataGridToolbarProps {
|
|
18
22
|
children?: ReactNode
|
|
19
23
|
}
|
|
20
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Toolbar for DataGrid with default UI.
|
|
27
|
+
* It contains
|
|
28
|
+
* - filters (with default DataGridQueryFilter, which can be replaced by custom filters in children)
|
|
29
|
+
* - settings (layout switcher, visible elements, per page selector)
|
|
30
|
+
* - export button
|
|
31
|
+
* - reload button
|
|
32
|
+
*
|
|
33
|
+
* ## Example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <DataGridToolbar>
|
|
36
|
+
* <DataGridQueryFilter />
|
|
37
|
+
* <DataGridTextFilter field={'name'} label="Name" />
|
|
38
|
+
* </DataGridToolbar>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
21
41
|
export const DataGridToolbar = Component<DataGridToolbarProps>(({ children }) => {
|
|
22
42
|
const [showFilters, setShowFilters] = React.useState(false)
|
|
23
43
|
return (
|
|
@@ -35,7 +55,7 @@ export const DataGridToolbar = Component<DataGridToolbarProps>(({ children }) =>
|
|
|
35
55
|
</Button>
|
|
36
56
|
|
|
37
57
|
<Popover>
|
|
38
|
-
<PopoverTrigger>
|
|
58
|
+
<PopoverTrigger asChild>
|
|
39
59
|
<Button variant={'outline'} size={'sm'} className={'gap-2'}>
|
|
40
60
|
<SettingsIcon className={'w-4 h-4'} />
|
|
41
61
|
</Button>
|
|
@@ -51,6 +71,11 @@ export const DataGridToolbar = Component<DataGridToolbarProps>(({ children }) =>
|
|
|
51
71
|
</Popover>
|
|
52
72
|
|
|
53
73
|
<DataGridAutoExport />
|
|
74
|
+
<DataViewReloadTrigger>
|
|
75
|
+
<Button variant={'outline'} size={'sm'} className={'group gap-2'}>
|
|
76
|
+
<RefreshCcwIcon className={'w-4 h-4 group-data-[state=refreshing]:animate-spin '} />
|
|
77
|
+
</Button>
|
|
78
|
+
</DataViewReloadTrigger>
|
|
54
79
|
</div>
|
|
55
80
|
|
|
56
81
|
<div className="flex flex-1 flex-wrap gap-2">
|
|
@@ -2,7 +2,8 @@ import { TextFilterArtifactsMatchMode } from '@contember/react-dataview'
|
|
|
2
2
|
import { InviteErrorCodes } from './tenant/hooks/useInvite'
|
|
3
3
|
import { UploaderErrorType } from '@contember/react-uploader'
|
|
4
4
|
import { ChangeMyPasswordFormErrorCode, CreateApiKeyFormErrorCode } from '@contember/interface'
|
|
5
|
-
import { InviteFormErrorCode, LoginFormErrorCode, OtpPrepareFormErrorCode, OtpConfirmFormErrorCode, PasswordResetFormErrorCode, PasswordResetRequestFormErrorCode, UpdateProjectMemberFormErrorCode } from '@contember/react-identity'
|
|
5
|
+
import { InviteFormErrorCode, LoginFormErrorCode, OtpPrepareFormErrorCode, OtpConfirmFormErrorCode, PasswordResetFormErrorCode, PasswordResetRequestFormErrorCode, UpdateProjectMemberFormErrorCode, PasswordlessSignInInitFormErrorCode, PasswordlessSignInFormErrorCode } from '@contember/react-identity'
|
|
6
|
+
import { ActivatePasswordlessOtpErrorCode } from '@contember/graphql-client-tenant'
|
|
6
7
|
|
|
7
8
|
export const dict = {
|
|
8
9
|
deleteEntityDialog: {
|
|
@@ -25,6 +26,9 @@ export const dict = {
|
|
|
25
26
|
toast: {
|
|
26
27
|
showDetails: 'Show details',
|
|
27
28
|
},
|
|
29
|
+
input: {
|
|
30
|
+
noValue: 'No value',
|
|
31
|
+
},
|
|
28
32
|
datagrid: {
|
|
29
33
|
na: 'N/A',
|
|
30
34
|
dateStart: 'From',
|
|
@@ -69,8 +73,6 @@ export const dict = {
|
|
|
69
73
|
confirmNew: 'Confirm',
|
|
70
74
|
cancelNew: 'Cancel',
|
|
71
75
|
search: 'Search',
|
|
72
|
-
paginationPreviousPage: 'Previous page',
|
|
73
|
-
paginationNextPage: 'Next page',
|
|
74
76
|
placeholder: 'Select',
|
|
75
77
|
},
|
|
76
78
|
backButton: {
|
|
@@ -78,6 +80,7 @@ export const dict = {
|
|
|
78
80
|
},
|
|
79
81
|
|
|
80
82
|
errors: {
|
|
83
|
+
required: 'This field is required',
|
|
81
84
|
unique: 'This value is already taken',
|
|
82
85
|
unknown: 'An unknown error has occurred',
|
|
83
86
|
},
|
|
@@ -162,6 +165,7 @@ export const dict = {
|
|
|
162
165
|
name: 'Name',
|
|
163
166
|
roles: 'Roles',
|
|
164
167
|
submit: 'Invite',
|
|
168
|
+
addRole: 'Add new role',
|
|
165
169
|
errorMessages: {
|
|
166
170
|
'FIELD_REQUIRED': 'This field is required',
|
|
167
171
|
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
@@ -193,7 +197,7 @@ export const dict = {
|
|
|
193
197
|
login: {
|
|
194
198
|
email: 'Email',
|
|
195
199
|
password: 'Password',
|
|
196
|
-
otpToken: 'OTP token',
|
|
200
|
+
otpToken: '2FA OTP token',
|
|
197
201
|
forgotPassword: 'Forgot password?',
|
|
198
202
|
login: 'Login',
|
|
199
203
|
errorMessages: {
|
|
@@ -274,13 +278,14 @@ export const dict = {
|
|
|
274
278
|
'TOKEN_EXPIRED': 'Token expired',
|
|
275
279
|
'TOKEN_NOT_FOUND': 'Token not found',
|
|
276
280
|
'TOKEN_USED': 'Token already used',
|
|
281
|
+
'TOKEN_INVALID': 'Invalid token',
|
|
277
282
|
} satisfies Record<PasswordResetFormErrorCode, string>,
|
|
278
283
|
title: 'Reset password',
|
|
279
284
|
description: 'Enter new password below',
|
|
280
285
|
success: 'Password has been reset',
|
|
281
286
|
},
|
|
282
287
|
passwordResetRequest: {
|
|
283
|
-
email: '
|
|
288
|
+
email: 'E-mail',
|
|
284
289
|
submit: 'Request reset code',
|
|
285
290
|
errorMessages: {
|
|
286
291
|
'FIELD_REQUIRED': 'This field is required',
|
|
@@ -294,6 +299,50 @@ export const dict = {
|
|
|
294
299
|
checkMail: 'Please check your mailbox for instructions on how to reset your password.',
|
|
295
300
|
entryCode: 'Or enter the reset code directly.',
|
|
296
301
|
},
|
|
302
|
+
passwordlessSignInInit: {
|
|
303
|
+
email: 'E-mail',
|
|
304
|
+
submit: 'Send magic link',
|
|
305
|
+
errorMessages: {
|
|
306
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
307
|
+
'INVALID_VALUE': 'Invalid value',
|
|
308
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
309
|
+
'PERSON_NOT_FOUND': 'Unknown email',
|
|
310
|
+
'PASSWORDLESS_DISABLED': 'Passwordless sign-in is not available',
|
|
311
|
+
} satisfies Record<PasswordlessSignInInitFormErrorCode, string>,
|
|
312
|
+
title: 'Sign in',
|
|
313
|
+
description: 'Enter your email below to sign in to your account',
|
|
314
|
+
success: 'Magic link has been sent',
|
|
315
|
+
checkMail: 'Please check your mailbox for instructions on how to sign in.',
|
|
316
|
+
entryCode: 'Or enter the reset code directly.',
|
|
317
|
+
},
|
|
318
|
+
passwordlessSignIn: {
|
|
319
|
+
token: 'Verification code',
|
|
320
|
+
otpToken: '2FA OTP token',
|
|
321
|
+
submit: 'Sign in',
|
|
322
|
+
errorMessages: {
|
|
323
|
+
'FIELD_REQUIRED': 'This field is required',
|
|
324
|
+
'INVALID_VALUE': 'Invalid value',
|
|
325
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
326
|
+
'INVALID_OTP_TOKEN': 'Invalid OTP token',
|
|
327
|
+
'OTP_REQUIRED': undefined,
|
|
328
|
+
'PERSON_DISABLED': 'Person disabled',
|
|
329
|
+
'TOKEN_EXPIRED': 'Token expired',
|
|
330
|
+
'TOKEN_NOT_FOUND': 'Token not found',
|
|
331
|
+
'TOKEN_USED': 'Token already used',
|
|
332
|
+
'TOKEN_INVALID': 'Invalid token',
|
|
333
|
+
} satisfies Record<PasswordlessSignInFormErrorCode, string | undefined>,
|
|
334
|
+
title: 'Sign in',
|
|
335
|
+
},
|
|
336
|
+
otpActivation: {
|
|
337
|
+
errorMessages: {
|
|
338
|
+
'TOKEN_INVALID': 'This token is not valid. Please try again.',
|
|
339
|
+
'TOKEN_USED': 'Token already used',
|
|
340
|
+
'TOKEN_NOT_FOUND': 'Token not found',
|
|
341
|
+
'TOKEN_EXPIRED': 'Token expired',
|
|
342
|
+
'UNKNOWN_ERROR': 'Something went wrong. Please try again later',
|
|
343
|
+
} satisfies Record<ActivatePasswordlessOtpErrorCode | 'UNKNOWN_ERROR', string>,
|
|
344
|
+
},
|
|
345
|
+
|
|
297
346
|
updateProjectMember: {
|
|
298
347
|
updateSuccess: 'Roles updated',
|
|
299
348
|
roles: 'Roles',
|
|
@@ -39,7 +39,7 @@ export const DimensionsSwitcher = Component(({ options, dimension, children, slu
|
|
|
39
39
|
<DataViewLoaderState loaded>
|
|
40
40
|
|
|
41
41
|
<Popover>
|
|
42
|
-
<PopoverTrigger>
|
|
42
|
+
<PopoverTrigger asChild>
|
|
43
43
|
<Button variant={'outline'} size="sm">
|
|
44
44
|
<DimensionSwitcherCurrentValues dimension={dimension} slugField={slugField}>
|
|
45
45
|
{children}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { dataAttribute } from '@contember/utilities'
|
|
2
|
-
import { memo, ReactElement, ReactNode, TextareaHTMLAttributes } from 'react'
|
|
2
|
+
import { ComponentType, memo, ReactElement, ReactNode, TextareaHTMLAttributes } from 'react'
|
|
3
3
|
|
|
4
4
|
export interface HTMLTextAreaDivTargetProps extends TextareaHTMLAttributes<HTMLDivElement> { }
|
|
5
5
|
|
|
6
6
|
export interface EditorCanvasProps<P extends HTMLTextAreaDivTargetProps> {
|
|
7
|
-
underlyingComponent:
|
|
7
|
+
underlyingComponent: ComponentType<P>
|
|
8
8
|
componentProps: P
|
|
9
9
|
focusRing?: boolean
|
|
10
10
|
children?: ReactNode
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component, FieldView, SugaredRelativeSingleField } from '@contember/interface'
|
|
2
|
+
import { RichTextFieldRenderer, RichTextFieldRendererProps } from '@contember/react-client'
|
|
3
|
+
|
|
4
|
+
export type RichTextRendererProps =
|
|
5
|
+
& {
|
|
6
|
+
field: SugaredRelativeSingleField['field']
|
|
7
|
+
}
|
|
8
|
+
& Omit<RichTextFieldRendererProps, 'source'>
|
|
9
|
+
|
|
10
|
+
export const RichTextView = Component<RichTextRendererProps>(({ field, ...props }) => {
|
|
11
|
+
return <FieldView<string> field={field} render={it => {
|
|
12
|
+
if (!it.value) {
|
|
13
|
+
return null
|
|
14
|
+
}
|
|
15
|
+
return <RichTextFieldRenderer source={JSON.parse(it.value)} {...props} />
|
|
16
|
+
}} />
|
|
17
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Component, FieldView, SugaredRelativeSingleField } from '@contember/interface'
|
|
2
|
+
import { getFormatter } from '../formatting'
|
|
3
|
+
|
|
4
|
+
export interface FormattedFieldProps {
|
|
5
|
+
field: SugaredRelativeSingleField['field']
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const FormattedField = Component<FormattedFieldProps>(({ field }) => {
|
|
9
|
+
return <FieldView field={field} render={it => getFormatter(it.schema)(it.value)} />
|
|
10
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './formatted-field'
|
|
@@ -2,62 +2,60 @@ import * as React from 'react'
|
|
|
2
2
|
import { ReactNode } from 'react'
|
|
3
3
|
import { FormContainerUI, FormDescriptionUI, FormErrorUI, FormLabelUI, FormLabelWrapperUI } from './ui'
|
|
4
4
|
import { useErrorFormatter } from '../errors'
|
|
5
|
-
import { Component } from '@contember/interface'
|
|
6
|
-
import { FormError, FormLabel } from '@contember/react-form'
|
|
5
|
+
import { Component, ErrorAccessor } from '@contember/interface'
|
|
6
|
+
import { FormError, FormFieldStateProvider, FormLabel, useFormFieldState } from '@contember/react-form'
|
|
7
|
+
import { useFieldLabelFormatter } from '../labels'
|
|
7
8
|
|
|
8
9
|
export interface FormContainerProps {
|
|
9
10
|
label?: ReactNode
|
|
10
11
|
description?: ReactNode
|
|
11
12
|
children: ReactNode
|
|
12
|
-
errors?: ReactNode
|
|
13
|
+
errors?: ErrorAccessor.Error[] | ReactNode
|
|
14
|
+
required?: boolean
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
|
|
16
|
-
export const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
</FormLabelUI>
|
|
23
|
-
}
|
|
24
|
-
</FormLabelWrapperUI>
|
|
25
|
-
<div>
|
|
26
|
-
{children}
|
|
27
|
-
</div>
|
|
28
|
-
<div>
|
|
29
|
-
{description && <FormDescriptionUI>
|
|
30
|
-
{description}
|
|
31
|
-
</FormDescriptionUI>}
|
|
32
|
-
{errors}
|
|
33
|
-
</div>
|
|
34
|
-
</FormContainerUI>
|
|
35
|
-
)
|
|
18
|
+
export const FormContainer = Component(({ children, description, label, required, errors }: FormContainerProps) => {
|
|
19
|
+
const errorsNode = Array.isArray(errors) ? undefined : errors
|
|
20
|
+
const errorsList = Array.isArray(errors) ? errors : []
|
|
21
|
+
const state = useFormFieldState()
|
|
22
|
+
const fieldLabelFormatter = useFieldLabelFormatter()
|
|
23
|
+
label ??= state?.field ? fieldLabelFormatter(state.field.entityName, state.field.fieldName) : undefined
|
|
36
24
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
25
|
+
const inner = <>
|
|
26
|
+
<FormContainerUI>
|
|
27
|
+
<FormLabelWrapperUI>
|
|
28
|
+
{label && <FormLabel>
|
|
29
|
+
<FormLabelUI required={required}>
|
|
30
|
+
{label}
|
|
31
|
+
</FormLabelUI>
|
|
32
|
+
</FormLabel>}
|
|
33
|
+
</FormLabelWrapperUI>
|
|
34
|
+
<div>
|
|
35
|
+
{children}
|
|
36
|
+
</div>
|
|
37
|
+
<div>
|
|
38
|
+
{description && <FormDescriptionUI>
|
|
39
|
+
{description}
|
|
40
|
+
</FormDescriptionUI>}
|
|
53
41
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
<FormError formatter={useErrorFormatter()}>
|
|
43
|
+
<FormErrorUI />
|
|
44
|
+
</FormError>
|
|
45
|
+
{errorsNode}
|
|
46
|
+
</div>
|
|
47
|
+
</FormContainerUI>
|
|
48
|
+
</>
|
|
49
|
+
return state !== undefined
|
|
50
|
+
? inner
|
|
51
|
+
: <FormFieldStateProvider required={required} errors={errorsList} dirty={false}>{inner}</FormFieldStateProvider>
|
|
52
|
+
}, ({ children, label, description }) => <>
|
|
60
53
|
{label}
|
|
61
54
|
{children}
|
|
62
55
|
{description}
|
|
63
56
|
</>)
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated use `FormContainer` instead
|
|
60
|
+
*/
|
|
61
|
+
export const StandaloneFormContainer = FormContainer
|
|
@@ -4,9 +4,20 @@ import { CheckboxInput, Input, RadioInput } from '../ui/input'
|
|
|
4
4
|
import { cn } from '../utils'
|
|
5
5
|
import { TextareaAutosize } from '../ui/textarea'
|
|
6
6
|
import { FormLabelUI } from './ui'
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
FormCheckbox,
|
|
9
|
+
FormCheckboxProps,
|
|
10
|
+
FormFieldScope,
|
|
11
|
+
FormInput,
|
|
12
|
+
FormInputProps,
|
|
13
|
+
FormLabel,
|
|
14
|
+
FormRadioInput,
|
|
15
|
+
FormRadioItemProps,
|
|
16
|
+
useFormFieldState,
|
|
17
|
+
} from '@contember/react-form'
|
|
8
18
|
import { FormContainer, FormContainerProps } from './container'
|
|
9
|
-
import { Component } from '@contember/interface'
|
|
19
|
+
import { Component, Field } from '@contember/interface'
|
|
20
|
+
import { useEnumOptionsFormatter } from '../labels'
|
|
10
21
|
|
|
11
22
|
|
|
12
23
|
export type InputFieldProps =
|
|
@@ -19,7 +30,7 @@ export type InputFieldProps =
|
|
|
19
30
|
|
|
20
31
|
export const InputField = Component(({ field, label, description, inputProps, isNonbearing, defaultValue, required }: InputFieldProps) => (
|
|
21
32
|
<FormFieldScope field={field}>
|
|
22
|
-
<FormContainer description={description} label={label}>
|
|
33
|
+
<FormContainer description={description} label={label} required={required}>
|
|
23
34
|
<FormInput field={field} isNonbearing={isNonbearing} defaultValue={defaultValue}>
|
|
24
35
|
<Input required={required} {...(inputProps ?? {})} className={cn('max-w-md', inputProps?.className)} />
|
|
25
36
|
</FormInput>
|
|
@@ -31,14 +42,15 @@ export type TextareaFieldProps =
|
|
|
31
42
|
& Omit<FormInputProps, 'children'>
|
|
32
43
|
& Omit<FormContainerProps, 'children'>
|
|
33
44
|
& {
|
|
45
|
+
required?: boolean
|
|
34
46
|
inputProps?: ComponentProps<typeof TextareaAutosize>
|
|
35
47
|
}
|
|
36
48
|
|
|
37
|
-
export const TextareaField = Component(({ field, label, description, inputProps, isNonbearing, defaultValue }: TextareaFieldProps) => (
|
|
49
|
+
export const TextareaField = Component(({ field, label, description, inputProps, isNonbearing, defaultValue, required }: TextareaFieldProps) => (
|
|
38
50
|
<FormFieldScope field={field}>
|
|
39
|
-
<FormContainer description={description} label={label}>
|
|
51
|
+
<FormContainer description={description} label={label} required={required}>
|
|
40
52
|
<FormInput field={field} isNonbearing={isNonbearing} defaultValue={defaultValue}>
|
|
41
|
-
<TextareaAutosize {...(inputProps ?? {})} className={cn('max-w-md', inputProps?.className)} />
|
|
53
|
+
<TextareaAutosize required={required} {...(inputProps ?? {})} className={cn('max-w-md', inputProps?.className)} />
|
|
42
54
|
</FormInput>
|
|
43
55
|
</FormContainer>
|
|
44
56
|
</FormFieldScope>
|
|
@@ -49,18 +61,19 @@ export type CheckboxFieldProps =
|
|
|
49
61
|
& Omit<FormCheckboxProps, 'children'>
|
|
50
62
|
& Omit<FormContainerProps, 'children'>
|
|
51
63
|
& {
|
|
64
|
+
required?: boolean
|
|
52
65
|
inputProps?: Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue'>
|
|
53
66
|
}
|
|
54
67
|
|
|
55
|
-
export const CheckboxField = Component(({ field, label, description, inputProps, isNonbearing, defaultValue }: CheckboxFieldProps) => (
|
|
68
|
+
export const CheckboxField = Component(({ field, label, description, inputProps, isNonbearing, defaultValue, required }: CheckboxFieldProps) => (
|
|
56
69
|
<FormFieldScope field={field}>
|
|
57
70
|
<FormContainer description={description} label={undefined}>
|
|
58
71
|
<div className="flex gap-2 items-center">
|
|
59
72
|
<FormCheckbox field={field} isNonbearing={isNonbearing} defaultValue={defaultValue}>
|
|
60
|
-
<CheckboxInput {...inputProps} />
|
|
73
|
+
<CheckboxInput required={required} {...inputProps} />
|
|
61
74
|
</FormCheckbox>
|
|
62
75
|
{label && <FormLabel>
|
|
63
|
-
<FormLabelUI>
|
|
76
|
+
<FormLabelUI required={required}>
|
|
64
77
|
{label}
|
|
65
78
|
</FormLabelUI>
|
|
66
79
|
</FormLabel>}
|
|
@@ -74,26 +87,46 @@ export type RadioEnumFieldProps =
|
|
|
74
87
|
& Omit<FormRadioItemProps, 'children' | 'value'>
|
|
75
88
|
& Omit<FormContainerProps, 'children'>
|
|
76
89
|
& {
|
|
77
|
-
|
|
90
|
+
required?: boolean
|
|
91
|
+
options?: Record<string, ReactNode> | Array<{ value: null | string | number | boolean; label: React.ReactNode }>
|
|
78
92
|
orientation?: 'horizontal' | 'vertical'
|
|
79
93
|
inputProps?: Omit<React.InputHTMLAttributes<HTMLInputElement>, 'defaultValue'>
|
|
80
94
|
}
|
|
81
95
|
|
|
82
|
-
export const RadioEnumField = Component<RadioEnumFieldProps>(({ field, label, description,
|
|
96
|
+
export const RadioEnumField = Component<RadioEnumFieldProps>(({ field, label, description, required, ...rest }) => {
|
|
83
97
|
return (
|
|
84
98
|
<FormFieldScope field={field}>
|
|
85
|
-
<FormContainer description={description} label={label}>
|
|
86
|
-
<
|
|
87
|
-
{Object.entries(options).map(([value, label]) => (
|
|
88
|
-
<FormLabelUI className="flex gap-2 items-center font-normal" key={value}>
|
|
89
|
-
<FormRadioInput field={field} value={value} defaultValue={defaultValue} isNonbearing={isNonbearing}>
|
|
90
|
-
<RadioInput {...inputProps} />
|
|
91
|
-
</FormRadioInput>
|
|
92
|
-
{label}
|
|
93
|
-
</FormLabelUI>
|
|
94
|
-
))}
|
|
95
|
-
</div>
|
|
99
|
+
<FormContainer description={description} label={label} required={required}>
|
|
100
|
+
<RadioEnumFieldInner field={field} required={required} {...rest} />
|
|
96
101
|
</FormContainer>
|
|
97
102
|
</FormFieldScope>
|
|
98
103
|
)
|
|
99
|
-
})
|
|
104
|
+
}, ({ field, isNonbearing, defaultValue }) => <Field field={field} isNonbearing={isNonbearing} defaultValue={defaultValue} />)
|
|
105
|
+
|
|
106
|
+
type RadioEnumFieldInnerProps = Pick<RadioEnumFieldProps, 'field' | 'options' | 'orientation' | 'inputProps' | 'defaultValue' | 'isNonbearing' | 'required'>
|
|
107
|
+
|
|
108
|
+
const RadioEnumFieldInner: React.FC<RadioEnumFieldInnerProps> = ({ field, inputProps, isNonbearing, required, options, orientation, defaultValue }) => {
|
|
109
|
+
const enumLabelsFormatter = useEnumOptionsFormatter()
|
|
110
|
+
const enumName = useFormFieldState()?.field?.enumName
|
|
111
|
+
options ??= enumName ? enumLabelsFormatter(enumName) : undefined
|
|
112
|
+
if (!options) {
|
|
113
|
+
throw new Error('RadioEnumField: options are required')
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const normalizedOptions = React.useMemo(() => {
|
|
117
|
+
return Array.isArray(options) ? options : Object.entries(options).map(([value, label]) => ({ value, label }))
|
|
118
|
+
}, [options])
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<div className={'flex flex-wrap gap-3 data-[orientation=vertical]:flex-col'} data-orientation={orientation ?? 'vertical'}>
|
|
122
|
+
{normalizedOptions.map(({ value, label }) => (
|
|
123
|
+
<FormLabelUI className="flex gap-2 items-center font-normal" key={value?.toString()}>
|
|
124
|
+
<FormRadioInput field={field} value={value} defaultValue={defaultValue} isNonbearing={isNonbearing}>
|
|
125
|
+
<RadioInput required={required} {...inputProps} />
|
|
126
|
+
</FormRadioInput>
|
|
127
|
+
{label}
|
|
128
|
+
</FormLabelUI>
|
|
129
|
+
))}
|
|
130
|
+
</div>
|
|
131
|
+
)
|
|
132
|
+
}
|