@contember/create 2.1.0-alpha.9 → 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 +3 -2
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.js +3 -2
- 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 +26 -8
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js +26 -8
- package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -1
- package/dist/development/src/lib/packageManagerDetector.js.map +1 -1
- 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 +3 -2
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.js +3 -2
- 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 +26 -8
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js +26 -8
- package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -1
- package/dist/production/src/lib/packageManagerDetector.js.map +1 -1
- 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/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/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -5
- package/resources/templates/default/.github/workflows/deploy.yaml +1 -1
- package/resources/templates/default/admin/app/pages/tenant.tsx +2 -2
- package/resources/templates/default/admin/lib/binding/binding.tsx +0 -2
- package/resources/templates/default/admin/lib/binding/hooks.tsx +14 -8
- package/resources/templates/default/admin/lib/binding/identity.tsx +31 -30
- package/resources/templates/default/admin/lib/binding/navigation-guard-dialog.tsx +12 -8
- package/resources/templates/default/admin/lib/binding/persist.tsx +7 -5
- package/resources/templates/default/admin/lib/block-repeater/block-repeater.tsx +10 -12
- package/resources/templates/default/admin/lib/board/board.tsx +59 -45
- package/resources/templates/default/admin/lib/buttons/back-button.tsx +1 -1
- package/resources/templates/default/admin/lib/datagrid/cells.tsx +49 -35
- package/resources/templates/default/admin/lib/datagrid/column-header.tsx +47 -38
- package/resources/templates/default/admin/lib/datagrid/columns.tsx +128 -105
- package/resources/templates/default/admin/lib/datagrid/elements.tsx +8 -4
- package/resources/templates/default/admin/lib/datagrid/filters/boolean.tsx +1 -4
- package/resources/templates/default/admin/lib/datagrid/filters/common.tsx +14 -14
- package/resources/templates/default/admin/lib/datagrid/filters/date.tsx +34 -20
- package/resources/templates/default/admin/lib/datagrid/filters/defined.tsx +0 -1
- package/resources/templates/default/admin/lib/datagrid/filters/enum.tsx +24 -30
- package/resources/templates/default/admin/lib/datagrid/filters/mobile.tsx +2 -3
- package/resources/templates/default/admin/lib/datagrid/filters/number.tsx +0 -3
- package/resources/templates/default/admin/lib/datagrid/filters/relation.tsx +35 -29
- package/resources/templates/default/admin/lib/datagrid/index.ts +21 -21
- package/resources/templates/default/admin/lib/datagrid/labels.tsx +0 -1
- package/resources/templates/default/admin/lib/datagrid/loader.tsx +2 -7
- package/resources/templates/default/admin/lib/datagrid/pagination.tsx +32 -37
- package/resources/templates/default/admin/lib/datagrid/table.tsx +7 -5
- package/resources/templates/default/admin/lib/datagrid/tiles.tsx +10 -5
- package/resources/templates/default/admin/lib/datagrid/toolbar.tsx +10 -7
- package/resources/templates/default/admin/lib/datagrid/ui.tsx +10 -13
- package/resources/templates/default/admin/lib/dev/login-panel.tsx +23 -16
- package/resources/templates/default/admin/lib/dict.ts +17 -5
- package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +84 -60
- package/resources/templates/default/admin/lib/editor/block-editor.tsx +22 -10
- package/resources/templates/default/admin/lib/editor/common/baseEditorPlugins.tsx +0 -2
- package/resources/templates/default/admin/lib/editor/common/buttons.tsx +155 -33
- package/resources/templates/default/admin/lib/editor/common/editor-block-toolbar.tsx +3 -1
- package/resources/templates/default/admin/lib/editor/common/editor-canvas.tsx +5 -3
- package/resources/templates/default/admin/lib/editor/common/editor-editable-canvas.tsx +0 -1
- package/resources/templates/default/admin/lib/editor/common/editor-inline-toolbar.tsx +4 -1
- package/resources/templates/default/admin/lib/editor/common/elements/AnchorRenderer.tsx +18 -16
- package/resources/templates/default/admin/lib/editor/common/elements/BlockElement.tsx +46 -34
- package/resources/templates/default/admin/lib/editor/common/elements/HeadingRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/TableElementRenderer.tsx +2 -7
- package/resources/templates/default/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +1 -5
- package/resources/templates/default/admin/lib/editor/editor-block.tsx +16 -9
- package/resources/templates/default/admin/lib/editor/rich-text-view.tsx +11 -6
- package/resources/templates/default/admin/lib/editor/rich-text.tsx +6 -7
- package/resources/templates/default/admin/lib/editor/sortable-block.tsx +31 -25
- package/resources/templates/default/admin/lib/form/container.tsx +51 -38
- package/resources/templates/default/admin/lib/form/inputs.tsx +14 -12
- package/resources/templates/default/admin/lib/form/select.tsx +93 -51
- package/resources/templates/default/admin/lib/form/ui.tsx +1 -1
- package/resources/templates/default/admin/lib/form/upload-repeaters.tsx +105 -72
- package/resources/templates/default/admin/lib/form/upload.tsx +61 -62
- package/resources/templates/default/admin/lib/labels/enum-labels.ts +6 -3
- package/resources/templates/default/admin/lib/labels/field-labels.ts +4 -2
- package/resources/templates/default/admin/lib/layout/layout-boxed.tsx +36 -26
- package/resources/templates/default/admin/lib/layout/slots.tsx +1 -4
- package/resources/templates/default/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +10 -4
- package/resources/templates/default/admin/lib/repeater/repeater.tsx +21 -12
- package/resources/templates/default/admin/lib/select/create-new.tsx +0 -3
- package/resources/templates/default/admin/lib/select/filter.tsx +0 -1
- package/resources/templates/default/admin/lib/select/list.tsx +33 -28
- package/resources/templates/default/admin/lib/select/multi-select.tsx +66 -70
- package/resources/templates/default/admin/lib/select/select.tsx +77 -72
- package/resources/templates/default/admin/lib/select/sortable-select.tsx +84 -82
- package/resources/templates/default/admin/lib/select/ui.tsx +8 -6
- package/resources/templates/default/admin/lib/tenant/forms/change-my-password.tsx +21 -8
- package/resources/templates/default/admin/lib/tenant/forms/common.tsx +21 -12
- package/resources/templates/default/admin/lib/tenant/forms/create-api-key.tsx +9 -5
- package/resources/templates/default/admin/lib/tenant/forms/invite.tsx +12 -7
- package/resources/templates/default/admin/lib/tenant/forms/login.tsx +26 -7
- package/resources/templates/default/admin/lib/tenant/forms/memberships-control.tsx +31 -19
- package/resources/templates/default/admin/lib/tenant/forms/password-reset-request.tsx +9 -5
- package/resources/templates/default/admin/lib/tenant/forms/password-reset.tsx +21 -8
- package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin-init.tsx +9 -5
- package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin.tsx +25 -12
- package/resources/templates/default/admin/lib/tenant/forms/update-project-member.tsx +3 -4
- package/resources/templates/default/admin/lib/tenant/hooks/useInviteUser.tsx +2 -3
- package/resources/templates/default/admin/lib/tenant/listing/api-key-list.tsx +5 -3
- package/resources/templates/default/admin/lib/tenant/listing/member-delete-dialog.tsx +13 -2
- package/resources/templates/default/admin/lib/tenant/listing/member-list.tsx +17 -11
- package/resources/templates/default/admin/lib/tenant/listing/person-list.tsx +6 -4
- package/resources/templates/default/admin/lib/tenant/otp/otp-setup.tsx +86 -59
- package/resources/templates/default/admin/lib/toast/toast.tsx +24 -22
- package/resources/templates/default/admin/lib/toast/toaster.tsx +0 -1
- package/resources/templates/default/admin/lib/ui/alert-dialog.tsx +4 -3
- package/resources/templates/default/admin/lib/ui/button.tsx +2 -1
- package/resources/templates/default/admin/lib/ui/dialog.tsx +12 -8
- package/resources/templates/default/admin/lib/ui/dimension.tsx +9 -0
- package/resources/templates/default/admin/lib/ui/dropdown.tsx +17 -14
- package/resources/templates/default/admin/lib/ui/input.tsx +18 -19
- package/resources/templates/default/admin/lib/ui/loader.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/menu.tsx +3 -11
- package/resources/templates/default/admin/lib/ui/overlay.tsx +11 -9
- package/resources/templates/default/admin/lib/ui/popover.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/property-list.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/scroll-area.tsx +11 -11
- package/resources/templates/default/admin/lib/ui/select.tsx +1 -2
- package/resources/templates/default/admin/lib/ui/sheet.tsx +6 -5
- package/resources/templates/default/admin/lib/ui/sidebar.tsx +41 -30
- package/resources/templates/default/admin/lib/ui/switch.tsx +5 -3
- package/resources/templates/default/admin/lib/ui/textarea.tsx +7 -4
- package/resources/templates/default/admin/lib/ui/toggle-group.tsx +9 -5
- package/resources/templates/default/admin/lib/ui/toggle.tsx +3 -4
- package/resources/templates/default/admin/lib/ui/tooltip.tsx +2 -1
- package/resources/templates/default/admin/lib/upload/dropzone.tsx +14 -10
- package/resources/templates/default/admin/lib/upload/repeater.tsx +0 -1
- package/resources/templates/default/admin/lib/upload/ui.tsx +0 -4
- package/resources/templates/default/admin/lib/upload/upload-progress.tsx +27 -11
- package/resources/templates/default/admin/lib/upload/view.tsx +129 -67
- package/resources/templates/default/admin/lib/utils/createComponentOpenHooks.tsx +10 -6
- package/resources/templates/default/admin/lib/utils/uic.tsx +24 -14
- package/resources/templates/default/admin/lib/utils/use-mobile.ts +1 -3
- package/resources/templates/default/admin/package.json +2 -3
- package/resources/templates/default/admin/vite.config.ts +1 -1
- package/src/commands/WorkspaceCreateCommand.ts +3 -3
- package/src/lib/FileSystem.ts +1 -0
- package/src/lib/TemplateInstaller.ts +26 -8
- package/src/run.ts +8 -7
- package/resources/templates/default/admin/postcss.config.js +0 -5
- /package/resources/templates/default/admin/entrypoint/pages/{magicLintSent.tsx → magicLinkSent.tsx} +0 -0
|
@@ -26,79 +26,84 @@ import { DataViewSortingDirections, DataViewUnionFilterFields } from '@contember
|
|
|
26
26
|
import { useFormFieldId } from '@contember/react-form'
|
|
27
27
|
import { dict } from '../dict'
|
|
28
28
|
|
|
29
|
-
export type SelectInputProps =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
29
|
+
export type SelectInputProps = {
|
|
30
|
+
field: SugaredRelativeSingleEntity['field']
|
|
31
|
+
children: ReactNode
|
|
32
|
+
options?: SugaredQualifiedEntityList['entities']
|
|
33
|
+
placeholder?: ReactNode
|
|
34
|
+
createNewForm?: ReactNode
|
|
35
|
+
queryField?: DataViewUnionFilterFields
|
|
36
|
+
initialSorting?: DataViewSortingDirections
|
|
37
|
+
required?: boolean
|
|
38
|
+
}
|
|
40
39
|
|
|
40
|
+
export const SelectInput = Component<SelectInputProps>(
|
|
41
|
+
({ field, queryField, options, children, placeholder, createNewForm, initialSorting, required }) => {
|
|
42
|
+
const [open, setOpen] = React.useState(false)
|
|
43
|
+
const id = useFormFieldId()
|
|
44
|
+
const getEntity = useEntity().getAccessor
|
|
45
|
+
useEntityBeforePersist(useCallback(() => {
|
|
46
|
+
if (!required) {
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
const entity = getEntity().getEntity({ field })
|
|
50
|
+
if (!entity.existsOnServer && !entity.hasUnpersistedChanges) {
|
|
51
|
+
entity.addError(dict.errors.required)
|
|
52
|
+
}
|
|
53
|
+
}, [field, getEntity, required]))
|
|
41
54
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<Select field={field} onSelect={() => setOpen(false)} options={options}>
|
|
58
|
-
<div className="flex gap-1 items-center">
|
|
59
|
-
<Popover open={open} onOpenChange={setOpen}>
|
|
60
|
-
<SelectInputWrapperUI>
|
|
61
|
-
<PopoverTrigger asChild>
|
|
62
|
-
<SelectInputUI id={id ? `${id}-input` : undefined}>
|
|
63
|
-
<SelectPlaceholder>
|
|
64
|
-
{placeholder ?? <SelectDefaultPlaceholderUI />}
|
|
65
|
-
</SelectPlaceholder>
|
|
66
|
-
<SelectEachValue>
|
|
67
|
-
{children}
|
|
68
|
-
</SelectEachValue>
|
|
69
|
-
<SelectInputActionsUI>
|
|
55
|
+
return (
|
|
56
|
+
<Select
|
|
57
|
+
field={field}
|
|
58
|
+
onSelect={() => setOpen(false)}
|
|
59
|
+
options={options}
|
|
60
|
+
>
|
|
61
|
+
<div className="flex gap-1 items-center">
|
|
62
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
63
|
+
<SelectInputWrapperUI>
|
|
64
|
+
<PopoverTrigger asChild>
|
|
65
|
+
<SelectInputUI id={id ? `${id}-input` : undefined}>
|
|
66
|
+
<SelectPlaceholder>
|
|
67
|
+
{placeholder ?? <SelectDefaultPlaceholderUI />}
|
|
68
|
+
</SelectPlaceholder>
|
|
70
69
|
<SelectEachValue>
|
|
71
|
-
|
|
72
|
-
<Button size="xs" variant="ghost" onClick={event => event.stopPropagation()}>
|
|
73
|
-
<XIcon className="w-4 h-4" />
|
|
74
|
-
</Button>
|
|
75
|
-
</SelectItemTrigger>
|
|
70
|
+
{children}
|
|
76
71
|
</SelectEachValue>
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
<
|
|
91
|
-
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
72
|
+
<SelectInputActionsUI>
|
|
73
|
+
<SelectEachValue>
|
|
74
|
+
<SelectItemTrigger>
|
|
75
|
+
<Button size="xs" variant="ghost" onClick={event => event.stopPropagation()}>
|
|
76
|
+
<XIcon className="w-4 h-4" />
|
|
77
|
+
</Button>
|
|
78
|
+
</SelectItemTrigger>
|
|
79
|
+
</SelectEachValue>
|
|
80
|
+
<ChevronDownIcon className="w-4 h-4" />
|
|
81
|
+
</SelectInputActionsUI>
|
|
82
|
+
</SelectInputUI>
|
|
83
|
+
</PopoverTrigger>
|
|
84
|
+
</SelectInputWrapperUI>
|
|
85
|
+
<SelectPopoverContent>
|
|
86
|
+
<DefaultSelectDataView initialSorting={initialSorting} queryField={queryField}>
|
|
87
|
+
{children}
|
|
88
|
+
</DefaultSelectDataView>
|
|
89
|
+
</SelectPopoverContent>
|
|
90
|
+
</Popover>
|
|
91
|
+
{createNewForm && (
|
|
92
|
+
<RecursionTerminatorPortal field={{ field, kind: 'hasOne' }}>
|
|
93
|
+
<CreateEntityDialog trigger={<SelectCreateNewTrigger />}>
|
|
94
|
+
{createNewForm}
|
|
95
|
+
</CreateEntityDialog>
|
|
96
|
+
</RecursionTerminatorPortal>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
</Select>
|
|
100
|
+
)
|
|
101
|
+
},
|
|
102
|
+
({ field, children, options }) => {
|
|
103
|
+
return (
|
|
104
|
+
<Select field={field} options={options}>
|
|
105
|
+
{children}
|
|
106
|
+
</Select>
|
|
107
|
+
)
|
|
108
|
+
},
|
|
109
|
+
)
|
|
@@ -46,91 +46,93 @@ const MultiSortableSelectDropIndicator = ({ position }: { position: 'before' | '
|
|
|
46
46
|
</div>
|
|
47
47
|
)
|
|
48
48
|
|
|
49
|
-
export type SortableMultiSelectInputProps =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
49
|
+
export type SortableMultiSelectInputProps = {
|
|
50
|
+
field: SugaredRelativeEntityList['field']
|
|
51
|
+
sortableBy: SugaredRelativeSingleField['field']
|
|
52
|
+
connectAt: SugaredRelativeSingleEntity['field']
|
|
53
|
+
children: ReactNode
|
|
54
|
+
options?: SugaredQualifiedEntityList['entities']
|
|
55
|
+
placeholder?: ReactNode
|
|
56
|
+
createNewForm?: ReactNode
|
|
57
|
+
queryField?: DataViewUnionFilterFields
|
|
58
|
+
initialSorting?: DataViewSortingDirections
|
|
59
|
+
}
|
|
61
60
|
|
|
62
|
-
export const SortableMultiSelectInput = Component<SortableMultiSelectInputProps>(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
export const SortableMultiSelectInput = Component<SortableMultiSelectInputProps>(
|
|
62
|
+
({ field, queryField, options, children, sortableBy, connectAt, placeholder, createNewForm, initialSorting }) => {
|
|
63
|
+
const id = useFormFieldId()
|
|
64
|
+
return (
|
|
65
|
+
<SortableMultiSelect field={field} sortableBy={sortableBy} connectAt={connectAt} options={options}>
|
|
66
|
+
<div className="flex gap-1 items-center">
|
|
67
|
+
<Popover>
|
|
68
|
+
<SelectInputWrapperUI>
|
|
69
|
+
<PopoverTrigger asChild>
|
|
70
|
+
<SelectInputUI id={id ? `${id}-input` : undefined}>
|
|
71
|
+
<SelectPlaceholder>
|
|
72
|
+
{placeholder ?? <SelectDefaultPlaceholderUI />}
|
|
73
|
+
</SelectPlaceholder>
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
<MultiSelectItemWrapperUI>
|
|
76
|
+
<RepeaterSortable>
|
|
77
|
+
<RepeaterSortableEachItem>
|
|
78
|
+
<div className={'flex'}>
|
|
79
|
+
<MultiSortableSelectDropIndicator position={'before'} />
|
|
80
|
+
<RepeaterSortableItemNode>
|
|
81
|
+
<MultiSelectItemUI>
|
|
82
|
+
<HasOne field={connectAt}>
|
|
83
|
+
<RepeaterSortableItemActivator>
|
|
84
|
+
<MultiSelectSortableItemContentUI>
|
|
85
|
+
{children}
|
|
86
|
+
</MultiSelectSortableItemContentUI>
|
|
87
|
+
</RepeaterSortableItemActivator>
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
<SelectItemTrigger>
|
|
90
|
+
<MultiSelectItemRemoveButtonUI onClick={e => e.stopPropagation()} />
|
|
91
|
+
</SelectItemTrigger>
|
|
92
|
+
</HasOne>
|
|
93
|
+
</MultiSelectItemUI>
|
|
94
|
+
</RepeaterSortableItemNode>
|
|
95
|
+
<MultiSortableSelectDropIndicator position={'after'} />
|
|
96
|
+
</div>
|
|
97
|
+
</RepeaterSortableEachItem>
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
<RepeaterSortableDragOverlay>
|
|
100
|
+
<MultiSelectItemDragOverlayUI>
|
|
101
|
+
<HasOne field={connectAt}>
|
|
102
|
+
{children}
|
|
103
|
+
</HasOne>
|
|
104
|
+
</MultiSelectItemDragOverlayUI>
|
|
105
|
+
</RepeaterSortableDragOverlay>
|
|
106
|
+
</RepeaterSortable>
|
|
107
|
+
</MultiSelectItemWrapperUI>
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
109
|
+
<SelectInputActionsUI>
|
|
110
|
+
<ChevronDownIcon className={'w-4 h-4'} />
|
|
111
|
+
</SelectInputActionsUI>
|
|
112
|
+
</SelectInputUI>
|
|
113
|
+
</PopoverTrigger>
|
|
114
|
+
</SelectInputWrapperUI>
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
{
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
116
|
+
<SelectPopoverContent>
|
|
117
|
+
<DefaultSelectDataView initialSorting={initialSorting} queryField={queryField}>
|
|
118
|
+
{children}
|
|
119
|
+
</DefaultSelectDataView>
|
|
120
|
+
</SelectPopoverContent>
|
|
121
|
+
</Popover>
|
|
122
|
+
{createNewForm && (
|
|
123
|
+
<CreateEntityDialog trigger={<SelectCreateNewTrigger />}>
|
|
124
|
+
{createNewForm}
|
|
125
|
+
</CreateEntityDialog>
|
|
126
|
+
)}
|
|
127
|
+
</div>
|
|
128
|
+
</SortableMultiSelect>
|
|
129
|
+
)
|
|
130
|
+
},
|
|
131
|
+
({ children, field, sortableBy, connectAt, options }) => {
|
|
132
|
+
return (
|
|
133
|
+
<SortableMultiSelect field={field} sortableBy={sortableBy} connectAt={connectAt} options={options}>
|
|
134
|
+
{children}
|
|
135
|
+
</SortableMultiSelect>
|
|
136
|
+
)
|
|
137
|
+
},
|
|
138
|
+
)
|
|
@@ -6,7 +6,6 @@ import { CheckIcon, PlusIcon, XIcon } from 'lucide-react'
|
|
|
6
6
|
import { PopoverContent } from '../ui/popover'
|
|
7
7
|
import { dict } from '../dict'
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
export const SelectInputWrapperUI = uic('div', {
|
|
11
10
|
baseClass: 'w-full max-w-md relative',
|
|
12
11
|
})
|
|
@@ -36,7 +35,7 @@ export const SelectListItemUI = uic(Button, {
|
|
|
36
35
|
variant: 'ghost',
|
|
37
36
|
size: 'sm',
|
|
38
37
|
},
|
|
39
|
-
afterChildren: <CheckIcon className="h-3 w-3 opacity-0 group-data-[selected]:opacity-100 ml-auto"/>,
|
|
38
|
+
afterChildren: <CheckIcon className="h-3 w-3 opacity-0 group-data-[selected]:opacity-100 ml-auto" />,
|
|
40
39
|
})
|
|
41
40
|
|
|
42
41
|
export const SelectDefaultPlaceholderUI = () => <span className={'text-gray-400'}>{dict.select.placeholder}</span>
|
|
@@ -57,8 +56,8 @@ export const MultiSelectItemDragOverlayUI = uic('span', {
|
|
|
57
56
|
})
|
|
58
57
|
|
|
59
58
|
export const MultiSelectItemRemoveButtonUI = uic('span', {
|
|
60
|
-
baseClass: 'bg-gray-100 border-l py-1 px-2 rounded-r text-black inline-flex items-center justify-center hover:bg-gray-300',
|
|
61
|
-
afterChildren: <XIcon className={'w-3 h-3'}/>,
|
|
59
|
+
baseClass: 'bg-gray-100 border-l border-gray-200 py-1 px-2 rounded-r text-black inline-flex items-center justify-center hover:bg-gray-300',
|
|
60
|
+
afterChildren: <XIcon className={'w-3 h-3'} />,
|
|
62
61
|
defaultProps: {
|
|
63
62
|
tabIndex: 0,
|
|
64
63
|
role: 'button',
|
|
@@ -78,5 +77,8 @@ export const SelectPopoverContent = uic(PopoverContent, {
|
|
|
78
77
|
},
|
|
79
78
|
})
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
export const SelectCreateNewTrigger = forwardRef<HTMLButtonElement, {}>((props, ref) => (
|
|
81
|
+
<Button variant="outline" size="icon" ref={ref} {...props}>
|
|
82
|
+
<PlusIcon className="w-3 h-3" />
|
|
83
|
+
</Button>
|
|
84
|
+
))
|
|
@@ -4,30 +4,43 @@ import { Loader } from '../../ui/loader'
|
|
|
4
4
|
import { TenantFormError, TenantFormField } from './common'
|
|
5
5
|
import { dict } from '../../dict'
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
export const ChangeMyPasswordFormFields = () => {
|
|
9
8
|
const form = useChangeMyPasswordForm()
|
|
10
9
|
return (
|
|
11
10
|
<div className="relative flex flex-col gap-2">
|
|
12
11
|
{form.state === 'submitting' ? <Loader position="absolute" /> : null}
|
|
13
12
|
<TenantFormError
|
|
14
|
-
form={form}
|
|
13
|
+
form={form}
|
|
14
|
+
messages={dict.tenant.changePassword.errorMessages}
|
|
15
15
|
/>
|
|
16
16
|
<TenantFormField
|
|
17
|
-
form={form}
|
|
18
|
-
|
|
17
|
+
form={form}
|
|
18
|
+
messages={dict.tenant.changePassword.errorMessages}
|
|
19
|
+
field="currentPassword"
|
|
20
|
+
type="password"
|
|
21
|
+
required
|
|
22
|
+
autoFocus
|
|
23
|
+
autoComplete="current-password"
|
|
19
24
|
>
|
|
20
25
|
{dict.tenant.changePassword.currentPassword}
|
|
21
26
|
</TenantFormField>
|
|
22
27
|
<TenantFormField
|
|
23
|
-
form={form}
|
|
24
|
-
|
|
28
|
+
form={form}
|
|
29
|
+
messages={dict.tenant.changePassword.errorMessages}
|
|
30
|
+
field="newPassword"
|
|
31
|
+
type="password"
|
|
32
|
+
required
|
|
33
|
+
autoComplete="new-password"
|
|
25
34
|
>
|
|
26
35
|
{dict.tenant.changePassword.newPassword}
|
|
27
36
|
</TenantFormField>
|
|
28
37
|
<TenantFormField
|
|
29
|
-
form={form}
|
|
30
|
-
|
|
38
|
+
form={form}
|
|
39
|
+
messages={dict.tenant.changePassword.errorMessages}
|
|
40
|
+
field="passwordConfirmation"
|
|
41
|
+
type="password"
|
|
42
|
+
required
|
|
43
|
+
autoComplete="new-password"
|
|
31
44
|
>
|
|
32
45
|
{dict.tenant.changePassword.confirmPassword}
|
|
33
46
|
</TenantFormField>
|
|
@@ -5,10 +5,15 @@ import { HTMLInputTypeAttribute, useState } from 'react'
|
|
|
5
5
|
import { dataAttribute } from '@contember/utilities'
|
|
6
6
|
import { Label } from '../../ui/label'
|
|
7
7
|
|
|
8
|
+
type FormErrorMessages<CtxValue extends FormContextValue<any, any, any>> = Record<
|
|
9
|
+
(CtxValue extends FormContextValue<any, infer E> ? E : never) & string,
|
|
10
|
+
string | undefined
|
|
11
|
+
>
|
|
12
|
+
|
|
8
13
|
export interface TenantFormErrorsProps<CtxValue extends FormContextValue<any, any, any>> {
|
|
9
14
|
form: CtxValue
|
|
10
15
|
field?: keyof CtxValue['values']
|
|
11
|
-
messages:
|
|
16
|
+
messages: FormErrorMessages<CtxValue>
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
export const TenantFormError = <CtxValue extends FormContextValue<any, any, any>>({ form, field, messages }: TenantFormErrorsProps<CtxValue>) => {
|
|
@@ -19,7 +24,7 @@ export const TenantFormError = <CtxValue extends FormContextValue<any, any, any>
|
|
|
19
24
|
.filter(it => !(it.code in messages && ((messages as any)[it.code] === undefined)))
|
|
20
25
|
.map(error => [error.code, { error: (messages as any)[error.code] || 'Unknown error', developerMessage: error.developerMessage }])
|
|
21
26
|
.map(([code, error]) => {
|
|
22
|
-
return
|
|
27
|
+
return <TenantFormSingleError key={code} {...error} />
|
|
23
28
|
})}
|
|
24
29
|
</div>
|
|
25
30
|
)
|
|
@@ -27,14 +32,16 @@ export const TenantFormError = <CtxValue extends FormContextValue<any, any, any>
|
|
|
27
32
|
|
|
28
33
|
const TenantFormSingleError = ({ error, developerMessage }: { error: string; developerMessage?: string }) => {
|
|
29
34
|
const [showDeveloperMessage, setShowDeveloperMessage] = useState(false)
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<FormErrorUI>{error}</FormErrorUI>
|
|
38
|
+
{/*{developerMessage && <div>*/}
|
|
39
|
+
{/* {showDeveloperMessage*/}
|
|
40
|
+
{/* ? <div className="mt-1 text-xs font-light font-mono bg-gray-50 shadow-inner p-2 rounded-sm border">{developerMessage}</div>*/}
|
|
41
|
+
{/* : <button className="text-xs underline" onClick={() => setShowDeveloperMessage(!showDeveloperMessage)}>Show details</button>}*/}
|
|
42
|
+
{/*</div>}*/}
|
|
43
|
+
</>
|
|
44
|
+
)
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
export type TenantFormInputProps<CtxValue extends FormContextValue<any, any, any>> =
|
|
@@ -79,11 +86,13 @@ export type TenantFormFieldProps<CtxValue extends FormContextValue<any, any, any
|
|
|
79
86
|
form: CtxValue
|
|
80
87
|
field: keyof CtxValue['values'] & string
|
|
81
88
|
type: HTMLInputTypeAttribute
|
|
82
|
-
messages:
|
|
89
|
+
messages: FormErrorMessages<CtxValue>
|
|
83
90
|
}
|
|
84
91
|
& Omit<Partial<React.InputHTMLAttributes<HTMLInputElement>>, 'form' | 'field'>
|
|
85
92
|
|
|
86
|
-
export const TenantFormField = <CtxValue extends FormContextValue<any, any, any>>(
|
|
93
|
+
export const TenantFormField = <CtxValue extends FormContextValue<any, any, any>>(
|
|
94
|
+
{ form, field, type, messages, children, ...props }: TenantFormFieldProps<CtxValue>,
|
|
95
|
+
) => {
|
|
87
96
|
return (
|
|
88
97
|
<div className="flex flex-col gap-2">
|
|
89
98
|
<TenantFormLabel form={form} field={field}>{children}</TenantFormLabel>
|
|
@@ -5,20 +5,24 @@ import { TenantFormError, TenantFormField, TenantFormLabel } from './common'
|
|
|
5
5
|
import { MembershipsControl, useIntrospectionRolesConfig } from './memberships-control'
|
|
6
6
|
import { dict } from '../../dict'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
export const CreateApiKeyFormFields = ({ projectSlug }: {projectSlug: string}) => {
|
|
8
|
+
export const CreateApiKeyFormFields = ({ projectSlug }: { projectSlug: string }) => {
|
|
10
9
|
const form = useCreateApiKeyForm()
|
|
11
10
|
return (
|
|
12
11
|
<div className="relative flex flex-col gap-2">
|
|
13
12
|
{form.state === 'submitting' ? <Loader position="absolute" /> : null}
|
|
14
13
|
|
|
15
14
|
<TenantFormError
|
|
16
|
-
form={form}
|
|
15
|
+
form={form}
|
|
16
|
+
messages={dict.tenant.createApiKey.errorMessages}
|
|
17
17
|
/>
|
|
18
18
|
|
|
19
19
|
<TenantFormField
|
|
20
|
-
form={form}
|
|
21
|
-
|
|
20
|
+
form={form}
|
|
21
|
+
messages={dict.tenant.createApiKey.errorMessages}
|
|
22
|
+
field="description"
|
|
23
|
+
type="text"
|
|
24
|
+
required
|
|
25
|
+
autoFocus
|
|
22
26
|
>
|
|
23
27
|
{dict.tenant.createApiKey.description}
|
|
24
28
|
</TenantFormField>
|
|
@@ -5,28 +5,33 @@ import { TenantFormError, TenantFormField, TenantFormLabel } from './common'
|
|
|
5
5
|
import { MembershipsControl, RolesConfig, useIntrospectionRolesConfig } from './memberships-control'
|
|
6
6
|
import { dict } from '../../dict'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
export const InviteFormFields = ({ projectSlug, roles }: {projectSlug: string; roles?: RolesConfig}) => {
|
|
8
|
+
export const InviteFormFields = ({ projectSlug, roles }: { projectSlug: string; roles?: RolesConfig }) => {
|
|
10
9
|
const form = useInviteForm()
|
|
11
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
12
10
|
const rolesResolved = roles ?? useIntrospectionRolesConfig(projectSlug)
|
|
13
11
|
return (
|
|
14
12
|
<div className="relative flex flex-col gap-2">
|
|
15
13
|
{form.state === 'submitting' ? <Loader position="absolute" /> : null}
|
|
16
14
|
|
|
17
15
|
<TenantFormError
|
|
18
|
-
form={form}
|
|
16
|
+
form={form}
|
|
17
|
+
messages={dict.tenant.invite.errorMessages}
|
|
19
18
|
/>
|
|
20
19
|
|
|
21
20
|
<TenantFormField
|
|
22
|
-
form={form}
|
|
23
|
-
|
|
21
|
+
form={form}
|
|
22
|
+
messages={dict.tenant.invite.errorMessages}
|
|
23
|
+
field="email"
|
|
24
|
+
type="email"
|
|
25
|
+
required
|
|
26
|
+
autoFocus
|
|
24
27
|
>
|
|
25
28
|
{dict.tenant.invite.email}
|
|
26
29
|
</TenantFormField>
|
|
27
30
|
|
|
28
31
|
<TenantFormField
|
|
29
|
-
form={form}
|
|
32
|
+
form={form}
|
|
33
|
+
messages={dict.tenant.invite.errorMessages}
|
|
34
|
+
field="name"
|
|
30
35
|
type="text"
|
|
31
36
|
>
|
|
32
37
|
{dict.tenant.invite.name}
|
|
@@ -13,19 +13,32 @@ export const LoginFormFields = () => {
|
|
|
13
13
|
{form.state === 'success' || form.state === 'submitting' ? <Loader position="absolute" /> : null}
|
|
14
14
|
|
|
15
15
|
<TenantFormError
|
|
16
|
-
form={form}
|
|
16
|
+
form={form}
|
|
17
|
+
messages={dict.tenant.login.errorMessages}
|
|
17
18
|
/>
|
|
18
19
|
|
|
19
20
|
<TenantFormField
|
|
20
|
-
form={form}
|
|
21
|
-
|
|
21
|
+
form={form}
|
|
22
|
+
messages={dict.tenant.login.errorMessages}
|
|
23
|
+
field="email"
|
|
24
|
+
type="email"
|
|
25
|
+
required
|
|
26
|
+
autoFocus={form.state === 'initial'}
|
|
27
|
+
readOnly={form.state === 'otp-required'}
|
|
28
|
+
placeholder="me@example.com"
|
|
29
|
+
autoComplete="email"
|
|
22
30
|
>
|
|
23
31
|
{dict.tenant.login.email}
|
|
24
32
|
</TenantFormField>
|
|
25
33
|
|
|
26
34
|
<TenantFormField
|
|
27
|
-
form={form}
|
|
28
|
-
|
|
35
|
+
form={form}
|
|
36
|
+
messages={dict.tenant.login.errorMessages}
|
|
37
|
+
field="password"
|
|
38
|
+
autoComplete="current-password"
|
|
39
|
+
type="password"
|
|
40
|
+
required
|
|
41
|
+
readOnly={form.state === 'otp-required'}
|
|
29
42
|
>
|
|
30
43
|
{dict.tenant.login.password}
|
|
31
44
|
<Link to="resetRequest">
|
|
@@ -37,8 +50,14 @@ export const LoginFormFields = () => {
|
|
|
37
50
|
|
|
38
51
|
{(form.state === 'otp-required' || fieldErrors.includes('otpToken')) && (
|
|
39
52
|
<TenantFormField
|
|
40
|
-
form={form}
|
|
41
|
-
|
|
53
|
+
form={form}
|
|
54
|
+
messages={dict.tenant.login.errorMessages}
|
|
55
|
+
field="otpToken"
|
|
56
|
+
autoComplete="one-time-code"
|
|
57
|
+
type="text"
|
|
58
|
+
required
|
|
59
|
+
autoFocus
|
|
60
|
+
maxLength={6}
|
|
42
61
|
>
|
|
43
62
|
{dict.tenant.login.otpToken}
|
|
44
63
|
</TenantFormField>
|