@contember/create 2.0.0-alpha.9 → 2.0.0-beta.2
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
|
@@ -12,7 +12,7 @@ import { ToastContent, useShowToast } from '../../toast'
|
|
|
12
12
|
import { dict } from '../../dict'
|
|
13
13
|
import { MemberDeleteDialog } from './member-delete-dialog'
|
|
14
14
|
import { Dialog, DialogContent, DialogTrigger } from '../../ui/dialog'
|
|
15
|
-
import { UpdateProjectMemberFormFields } from '../forms'
|
|
15
|
+
import { RolesConfig, UpdateProjectMemberFormFields } from '../forms'
|
|
16
16
|
|
|
17
17
|
const perPage = 20
|
|
18
18
|
|
|
@@ -26,13 +26,14 @@ export interface MemberListProps {
|
|
|
26
26
|
tableColumns: (it: ProjectMembersQueryResult[number]) => ReactNode
|
|
27
27
|
tableHeaders: string[]
|
|
28
28
|
controller?: { current?: MemberListController }
|
|
29
|
+
roles?: RolesConfig
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export interface MemberListController {
|
|
32
33
|
refresh: () => void
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export const MemberList = ({ filter, labels, tableColumns, controller, tableHeaders }: MemberListProps) => {
|
|
36
|
+
export const MemberList = ({ filter, labels, tableColumns, controller, tableHeaders, roles }: MemberListProps) => {
|
|
36
37
|
const projectSlug = useProjectSlug()!
|
|
37
38
|
const [page, setPage] = useState(0)
|
|
38
39
|
|
|
@@ -97,7 +98,7 @@ export const MemberList = ({ filter, labels, tableColumns, controller, tableHead
|
|
|
97
98
|
onError={onDeleteError}
|
|
98
99
|
title={labels.deleteConfirmation}
|
|
99
100
|
/>
|
|
100
|
-
<EditMembershipDialog projectSlug={projectSlug} identityId={it.identity.id} onSuccess={refresh} />
|
|
101
|
+
<EditMembershipDialog projectSlug={projectSlug} identityId={it.identity.id} onSuccess={refresh} roles={roles} />
|
|
101
102
|
|
|
102
103
|
</TableCell>
|
|
103
104
|
</TableRow>
|
|
@@ -118,7 +119,7 @@ export const MemberList = ({ filter, labels, tableColumns, controller, tableHead
|
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
const EditMembershipDialog = ({ projectSlug, identityId, onSuccess }: { projectSlug: string; identityId: string; onSuccess: () => void }) => {
|
|
122
|
+
const EditMembershipDialog = ({ projectSlug, identityId, onSuccess, roles }: { projectSlug: string; identityId: string; onSuccess: () => void; roles?: RolesConfig }) => {
|
|
122
123
|
|
|
123
124
|
const showToast = useShowToast()
|
|
124
125
|
const [open, setOpen] = useState(false)
|
|
@@ -138,7 +139,7 @@ const EditMembershipDialog = ({ projectSlug, identityId, onSuccess }: { projectS
|
|
|
138
139
|
}}
|
|
139
140
|
>
|
|
140
141
|
<form className="grid gap-4">
|
|
141
|
-
<UpdateProjectMemberFormFields projectSlug={projectSlug} />
|
|
142
|
+
<UpdateProjectMemberFormFields projectSlug={projectSlug} roles={roles} />
|
|
142
143
|
</form>
|
|
143
144
|
</UpdateProjectMemberForm>
|
|
144
145
|
</DialogContent>
|
|
@@ -3,11 +3,12 @@ import * as React from 'react'
|
|
|
3
3
|
import { TableCell } from '../../ui/table'
|
|
4
4
|
import { dict } from '../../dict'
|
|
5
5
|
import { MemberList, MemberListController } from './member-list'
|
|
6
|
+
import { RolesConfig } from '../forms'
|
|
6
7
|
|
|
7
8
|
const filter: ProjectMembersFilter = {
|
|
8
9
|
memberType: 'PERSON',
|
|
9
10
|
}
|
|
10
|
-
export const PersonList = (props: { controller?: { current?: MemberListController } }) => (
|
|
11
|
+
export const PersonList = (props: { controller?: { current?: MemberListController }; roles?: RolesConfig }) => (
|
|
11
12
|
<MemberList
|
|
12
13
|
{...props}
|
|
13
14
|
filter={filter}
|
|
@@ -2,9 +2,10 @@ import * as React from 'react'
|
|
|
2
2
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
|
|
3
3
|
import { buttonConfig } from './button'
|
|
4
4
|
import { uic } from '../utils'
|
|
5
|
+
import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
export const AlertDialog = AlertDialogPrimitive.Root
|
|
8
|
+
export const { Component: AlertDialog, useOpen: useAlertDialogOpenState } = createComponentOpenHooks(AlertDialogPrimitive.Root)
|
|
8
9
|
|
|
9
10
|
export const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
|
10
11
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible'
|
|
2
|
+
|
|
3
|
+
const Collapsible = CollapsiblePrimitive.Root
|
|
4
|
+
|
|
5
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
|
|
6
|
+
|
|
7
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
|
|
8
|
+
|
|
9
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
|
@@ -2,8 +2,9 @@ import * as React from 'react'
|
|
|
2
2
|
import * as DialogPrimitive from '@radix-ui/react-dialog'
|
|
3
3
|
import { uic } from '../utils/uic'
|
|
4
4
|
import { XIcon } from 'lucide-react'
|
|
5
|
+
import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
|
|
5
6
|
|
|
6
|
-
export const Dialog = DialogPrimitive.Root
|
|
7
|
+
export const { Component: Dialog, useOpen: useDialogOpenState } = createComponentOpenHooks(DialogPrimitive.Root)
|
|
7
8
|
|
|
8
9
|
export const DialogTrigger = DialogPrimitive.Trigger
|
|
9
10
|
|
|
@@ -4,8 +4,9 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
|
|
|
4
4
|
import { Check, ChevronRight, Circle, MoreHorizontalIcon } from 'lucide-react'
|
|
5
5
|
import { cn, uic } from '../utils'
|
|
6
6
|
import { buttonConfig } from './button'
|
|
7
|
+
import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
|
|
7
8
|
|
|
8
|
-
export const DropdownMenu = DropdownMenuPrimitive.Root
|
|
9
|
+
export const { Component: DropdownMenu, useOpen: useDropdownMenuOpenState } = createComponentOpenHooks(DropdownMenuPrimitive.Root)
|
|
9
10
|
|
|
10
11
|
export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
|
11
12
|
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import { uic, uiconfig } from '../utils'
|
|
2
2
|
|
|
3
3
|
export const inputConfig = uiconfig({
|
|
4
|
-
baseClass:
|
|
4
|
+
baseClass: `
|
|
5
|
+
flex w-full bg-background
|
|
6
|
+
file:border-0 file:bg-transparent file:text-sm file:font-medium
|
|
7
|
+
placeholder:text-muted-foreground
|
|
8
|
+
focus-visible:outline-none
|
|
9
|
+
disabled:cursor-not-allowed disabled:opacity-50
|
|
10
|
+
read-only:bg-gray-100
|
|
11
|
+
` /*data-[dirty]:border-yellow-500 focus-visible:data-[dirty]:border-input*/ + `
|
|
12
|
+
data-[invalid]:border-destructive data-[invalid]:ring-destructive
|
|
13
|
+
`,
|
|
5
14
|
variants: {
|
|
6
|
-
variant: {
|
|
7
|
-
default: 'border border-input ring-offset-background focus-visible:ring-2 focus-visible:ring-ring',
|
|
8
|
-
ghost: 'border-none focus-visible:ring-transparent',
|
|
9
|
-
},
|
|
10
15
|
inputSize: {
|
|
11
16
|
default: 'h-10 rounded-md p-2 text-sm',
|
|
12
17
|
sm: 'h-8 rounded p-1 text-sm',
|
|
13
18
|
lg: 'h-12 rounded-lg p-3 text-lg',
|
|
14
19
|
},
|
|
20
|
+
variant: {
|
|
21
|
+
default: 'border border-input ring-offset-background focus-visible:ring-2 focus-visible:ring-ring',
|
|
22
|
+
ghost: 'border-transparent border-b focus-visible:ring-transparent rounded-none',
|
|
23
|
+
},
|
|
15
24
|
},
|
|
16
25
|
defaultVariants: {
|
|
17
26
|
variant: 'default',
|
|
@@ -24,11 +33,6 @@ export const Input = uic('input', {
|
|
|
24
33
|
displayName: 'Input',
|
|
25
34
|
})
|
|
26
35
|
|
|
27
|
-
export const Select = uic('select', {
|
|
28
|
-
baseClass: 'flex w-full h-10 rounded-md p-2 text-sm border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[invalid]:border-destructive data-[invalid]:ring-destructive',
|
|
29
|
-
displayName: 'Select',
|
|
30
|
-
})
|
|
31
|
-
|
|
32
36
|
export const InputLike = uic('div', {
|
|
33
37
|
baseClass: `
|
|
34
38
|
flex items-center min-h-10 w-full rounded-md border border-input bg-background p-2 text-sm ring-offset-background max-w-md
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReactNode } from 'react'
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
3
2
|
import { uic } from '../utils'
|
|
4
|
-
import { RoleCondition, useProjectUserRoles } from '@contember/interface'
|
|
3
|
+
import { type RoleCondition, useProjectUserRoles, Link, type RoutingLinkTarget } from '@contember/interface'
|
|
5
4
|
import { createContext } from '@contember/react-utils'
|
|
6
5
|
|
|
7
6
|
export const MenuItemUI = uic('a', {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import * as PopoverPrimitive from '@radix-ui/react-popover'
|
|
3
3
|
import { cn } from '../utils'
|
|
4
|
+
import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
|
|
4
5
|
|
|
5
|
-
const Popover = PopoverPrimitive.Root
|
|
6
|
+
const { Component: Popover, useOpen: usePopoverOpenstate } = createComponentOpenHooks(PopoverPrimitive.Root)
|
|
6
7
|
|
|
7
8
|
const PopoverTrigger = PopoverPrimitive.Trigger
|
|
8
9
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactNode } from 'react'
|
|
2
|
+
import { uic } from '../utils'
|
|
3
|
+
|
|
4
|
+
export const PropertyList = uic('div', {
|
|
5
|
+
baseClass: 'relative overflow-auto bg-gray-50/50 max-w-lg border rounded-md grid grid-cols-[max-content,1fr]',
|
|
6
|
+
displayName: 'PropertyList',
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
export const PropertyRow = uic('div', {
|
|
10
|
+
baseClass: 'contents group',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const PropertyLabel = uic('div', {
|
|
14
|
+
baseClass: 'text-sm min-w-32 border-b group-last:border-b-none px-4 py-3',
|
|
15
|
+
displayName: 'PropertyLabel',
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export const PropertyValue = uic('div', {
|
|
19
|
+
baseClass: 'text-sm font-semibold border-b group-last:border-b-none px-4 py-3',
|
|
20
|
+
displayName: 'PropertyValue',
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Shortcut for creating a property list item with a label and a value.
|
|
25
|
+
*/
|
|
26
|
+
export const PropertyItem = (({ label, children }: { label: string; children: ReactNode }) => {
|
|
27
|
+
return (
|
|
28
|
+
<PropertyRow>
|
|
29
|
+
<PropertyLabel>{label}</PropertyLabel>
|
|
30
|
+
<PropertyValue>{children}</PropertyValue>
|
|
31
|
+
</PropertyRow>
|
|
32
|
+
)
|
|
33
|
+
})
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as SelectPrimitive from '@radix-ui/react-select'
|
|
2
|
+
import { Check, ChevronDown, ChevronUp } from 'lucide-react'
|
|
3
|
+
import { uic } from '../utils'
|
|
4
|
+
import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
|
|
5
|
+
|
|
6
|
+
export const { Component: Select, useOpen: useSelectOpenState } = createComponentOpenHooks(SelectPrimitive.Root)
|
|
7
|
+
|
|
8
|
+
export const SelectGroup = SelectPrimitive.Group
|
|
9
|
+
|
|
10
|
+
export const SelectValue = SelectPrimitive.Value
|
|
11
|
+
|
|
12
|
+
export const SelectTrigger = uic(SelectPrimitive.Trigger, {
|
|
13
|
+
baseClass:
|
|
14
|
+
'flex gap-1 h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
|
|
15
|
+
afterChildren: (
|
|
16
|
+
<SelectPrimitive.Icon asChild>
|
|
17
|
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
18
|
+
</SelectPrimitive.Icon>
|
|
19
|
+
),
|
|
20
|
+
displayName: SelectPrimitive.Trigger.displayName,
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const SelectScrollUpButton = uic(SelectPrimitive.ScrollUpButton, {
|
|
24
|
+
baseClass: 'flex cursor-default items-center justify-center py-1',
|
|
25
|
+
beforeChildren: <ChevronUp className="h-4 w-4" />,
|
|
26
|
+
displayName: SelectPrimitive.ScrollUpButton.displayName,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export const SelectScrollDownButton = uic(SelectPrimitive.ScrollDownButton, {
|
|
30
|
+
baseClass: 'flex cursor-default items-center justify-center py-1',
|
|
31
|
+
beforeChildren: <ChevronDown className="h-4 w-4" />,
|
|
32
|
+
displayName: SelectPrimitive.ScrollDownButton.displayName,
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
export const SelectContent = uic(SelectPrimitive.Content, {
|
|
36
|
+
baseClass:
|
|
37
|
+
'relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
38
|
+
displayName: SelectPrimitive.Content.displayName,
|
|
39
|
+
variants: {
|
|
40
|
+
position: {
|
|
41
|
+
popper:
|
|
42
|
+
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
position: 'popper',
|
|
47
|
+
},
|
|
48
|
+
wrapInner: ({ children }) => (
|
|
49
|
+
<>
|
|
50
|
+
<SelectScrollUpButton />
|
|
51
|
+
<SelectPrimitive.Viewport className="p-1 h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]">
|
|
52
|
+
{children}
|
|
53
|
+
</SelectPrimitive.Viewport>
|
|
54
|
+
<SelectScrollDownButton />
|
|
55
|
+
</>
|
|
56
|
+
),
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
export const SelectLabel = uic(SelectPrimitive.Label, {
|
|
60
|
+
baseClass: 'py-1.5 pl-8 pr-2 text-sm font-semibold',
|
|
61
|
+
displayName: SelectPrimitive.Label.displayName,
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
export const SelectItem = uic(SelectPrimitive.Item, {
|
|
65
|
+
baseClass:
|
|
66
|
+
'relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
67
|
+
beforeChildren: (
|
|
68
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
69
|
+
<SelectPrimitive.ItemIndicator>
|
|
70
|
+
<Check className="h-4 w-4" />
|
|
71
|
+
</SelectPrimitive.ItemIndicator>
|
|
72
|
+
</span>
|
|
73
|
+
),
|
|
74
|
+
displayName: SelectPrimitive.Item.displayName,
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
export const SelectSeparator = uic(SelectPrimitive.Separator, {
|
|
78
|
+
baseClass: '-mx-1 my-1 h-px bg-muted',
|
|
79
|
+
displayName: SelectPrimitive.Separator.displayName,
|
|
80
|
+
})
|
|
@@ -2,8 +2,9 @@ import * as React from 'react'
|
|
|
2
2
|
import * as SheetPrimitive from '@radix-ui/react-dialog'
|
|
3
3
|
import { uic } from '../utils/uic'
|
|
4
4
|
import { XIcon } from 'lucide-react'
|
|
5
|
+
import { createComponentOpenHooks } from '../utils/createComponentOpenHooks'
|
|
5
6
|
|
|
6
|
-
export const Sheet = SheetPrimitive.Root
|
|
7
|
+
export const { Component: Sheet, useOpen: useSheetOpenState } = createComponentOpenHooks(SheetPrimitive.Root)
|
|
7
8
|
|
|
8
9
|
export const SheetTrigger = SheetPrimitive.Trigger
|
|
9
10
|
|
|
@@ -17,7 +18,7 @@ export const SheetOverlay = uic(SheetPrimitive.Overlay, {
|
|
|
17
18
|
})
|
|
18
19
|
|
|
19
20
|
export const SheetContent = uic(SheetPrimitive.Content, {
|
|
20
|
-
baseClass: 'fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
|
|
21
|
+
baseClass: 'fixed z-50 gap-4 bg-background p-6 shadow-lg overflow-auto transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
|
|
21
22
|
variants: {
|
|
22
23
|
side: {
|
|
23
24
|
top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
|
|
@@ -3,7 +3,15 @@ import { uic } from '../utils'
|
|
|
3
3
|
import { ComponentProps, forwardRef, useRef } from 'react'
|
|
4
4
|
|
|
5
5
|
export const Textarea = uic('textarea', {
|
|
6
|
-
baseClass:
|
|
6
|
+
baseClass: `
|
|
7
|
+
w-full bg-background rounded-md border border-input px-3 py-2 text-sm shadow-sm
|
|
8
|
+
placeholder:text-muted-foreground
|
|
9
|
+
focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring
|
|
10
|
+
disabled:cursor-not-allowed disabled:opacity-50
|
|
11
|
+
read-only:bg-gray-100
|
|
12
|
+
` /*data-[dirty]:border-yellow-500 focus-visible:data-[dirty]:border-input*/ + `
|
|
13
|
+
data-[invalid]:border-destructive data-[invalid]:ring-destructive
|
|
14
|
+
`,
|
|
7
15
|
displayName: 'Textarea',
|
|
8
16
|
})
|
|
9
17
|
|