@contember/create 1.4.0-rc.4 → 1.4.0-rc.5
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/src/commands/WorkspaceCreateCommand.d.ts +4 -3
- package/dist/src/commands/WorkspaceCreateCommand.d.ts.map +1 -1
- package/dist/src/commands/WorkspaceCreateCommand.js +10 -4
- package/dist/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/src/lib/FileSystem.d.ts +14 -0
- package/dist/src/lib/FileSystem.d.ts.map +1 -0
- package/dist/src/lib/FileSystem.js +54 -0
- package/dist/src/lib/FileSystem.js.map +1 -0
- package/dist/src/lib/PackageDownloader.d.ts +7 -0
- package/dist/src/lib/PackageDownloader.d.ts.map +1 -0
- package/dist/src/lib/PackageDownloader.js +32 -0
- package/dist/src/lib/PackageDownloader.js.map +1 -0
- package/dist/src/lib/TemplateInstaller.d.ts +13 -0
- package/dist/src/lib/TemplateInstaller.d.ts.map +1 -0
- package/dist/src/lib/TemplateInstaller.js +75 -0
- package/dist/src/lib/TemplateInstaller.js.map +1 -0
- package/dist/src/lib/pathUtils.d.ts +3 -0
- package/dist/src/lib/pathUtils.d.ts.map +1 -0
- package/dist/src/lib/pathUtils.js +7 -0
- package/dist/src/lib/pathUtils.js.map +1 -0
- package/dist/src/run.js +7 -3
- package/dist/src/run.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -3
- package/resources/templates/template-workspace/.gitignore.dist +3 -0
- package/resources/templates/template-workspace/admin/.env.development +3 -0
- package/resources/templates/template-workspace/admin/.env.production +3 -0
- package/resources/templates/template-workspace/admin/app/components/layout.tsx +32 -0
- package/resources/templates/template-workspace/admin/app/components/logo.tsx +16 -0
- package/resources/templates/template-workspace/admin/app/components/navigation.tsx +1 -0
- package/resources/templates/template-workspace/admin/app/config.ts +27 -0
- package/resources/templates/template-workspace/admin/app/index.html +15 -0
- package/resources/templates/template-workspace/admin/app/index.tsx +40 -0
- package/resources/templates/template-workspace/admin/app/pages/index.tsx +5 -0
- package/resources/templates/template-workspace/admin/index.css +53 -0
- package/resources/templates/template-workspace/admin/index.html +13 -0
- package/resources/templates/template-workspace/admin/index.tsx +268 -0
- package/resources/templates/template-workspace/admin/lib/binding/binding.tsx +45 -0
- package/resources/templates/template-workspace/admin/lib/binding/delete.tsx +43 -0
- package/resources/templates/template-workspace/admin/lib/binding/hooks.tsx +71 -0
- package/resources/templates/template-workspace/admin/lib/binding/identity.tsx +19 -0
- package/resources/templates/template-workspace/admin/lib/binding/index.ts +5 -0
- package/resources/templates/template-workspace/admin/lib/binding/persist.tsx +70 -0
- package/resources/templates/template-workspace/admin/lib/block-repeater/block-repeater.tsx +224 -0
- package/resources/templates/template-workspace/admin/lib/block-repeater/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/board/board.tsx +240 -0
- package/resources/templates/template-workspace/admin/lib/board/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/buttons/back-button.tsx +20 -0
- package/resources/templates/template-workspace/admin/lib/buttons/index.ts +2 -0
- package/resources/templates/template-workspace/admin/lib/buttons/link-back-button.tsx +21 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/cells.tsx +64 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/column-header.tsx +65 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/columns.tsx +166 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +42 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/empty.tsx +8 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/export.tsx +17 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/boolean.tsx +76 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/common.tsx +29 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/date.tsx +153 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/enum.tsx +115 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/index.ts +7 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/mobile.tsx +19 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/number.tsx +100 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/relation.tsx +180 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/filters/text.tsx +121 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/grid.tsx +61 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/index.ts +16 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/layout-switcher.tsx +32 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/loader.tsx +10 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/pagination.tsx +103 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/table.tsx +69 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/tiles.tsx +24 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/toolbar.tsx +66 -0
- package/resources/templates/template-workspace/admin/lib/datagrid/ui.tsx +153 -0
- package/resources/templates/template-workspace/admin/lib/dev/index.ts +2 -0
- package/resources/templates/template-workspace/admin/lib/dev/login-panel.tsx +56 -0
- package/resources/templates/template-workspace/admin/lib/dev/todo.tsx +14 -0
- package/resources/templates/template-workspace/admin/lib/dict.ts +324 -0
- package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +135 -0
- package/resources/templates/template-workspace/admin/lib/dimensions/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/editor/block-editor.tsx +111 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/baseEditorPlugins.tsx +66 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/buttons.tsx +83 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-block-toolbar.tsx +17 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-canvas.tsx +30 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-editable-canvas.tsx +50 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/editor-inline-toolbar.tsx +63 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/AnchorRenderer.tsx +36 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/BlockElement.tsx +48 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/HeadingRenderer.tsx +48 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +28 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/ListItemRenderer.tsx +13 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/OrderedListRenderer.tsx +13 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/ParagraphRenderer.tsx +15 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/ScrollTargetRenderer.tsx +30 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +20 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableElementRenderer.tsx +96 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +15 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +13 -0
- package/resources/templates/template-workspace/admin/lib/editor/common/index.ts +6 -0
- package/resources/templates/template-workspace/admin/lib/editor/editor-block.tsx +96 -0
- package/resources/templates/template-workspace/admin/lib/editor/index.ts +5 -0
- package/resources/templates/template-workspace/admin/lib/editor/plugins.tsx +36 -0
- package/resources/templates/template-workspace/admin/lib/editor/rich-text.tsx +54 -0
- package/resources/templates/template-workspace/admin/lib/editor/sortable-block.tsx +51 -0
- package/resources/templates/template-workspace/admin/lib/errors/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/errors/use-error-formatter.ts +26 -0
- package/resources/templates/template-workspace/admin/lib/form/container.tsx +63 -0
- package/resources/templates/template-workspace/admin/lib/form/index.ts +5 -0
- package/resources/templates/template-workspace/admin/lib/form/inputs.tsx +99 -0
- package/resources/templates/template-workspace/admin/lib/form/select.tsx +123 -0
- package/resources/templates/template-workspace/admin/lib/form/ui.tsx +29 -0
- package/resources/templates/template-workspace/admin/lib/form/upload.tsx +243 -0
- package/resources/templates/template-workspace/admin/lib/formatting/formatting.ts +62 -0
- package/resources/templates/template-workspace/admin/lib/formatting/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/images/formatImageResizeUrl.ts +23 -0
- package/resources/templates/template-workspace/admin/lib/images/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/layout/index.ts +2 -0
- package/resources/templates/template-workspace/admin/lib/layout/layout.tsx +167 -0
- package/resources/templates/template-workspace/admin/lib/layout/slots.tsx +24 -0
- package/resources/templates/template-workspace/admin/lib/outdated-application-dialog/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +41 -0
- package/resources/templates/template-workspace/admin/lib/repeater/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/repeater/repeater.tsx +142 -0
- package/resources/templates/template-workspace/admin/lib/select/create-new.tsx +34 -0
- package/resources/templates/template-workspace/admin/lib/select/filter.tsx +13 -0
- package/resources/templates/template-workspace/admin/lib/select/highlight.tsx +16 -0
- package/resources/templates/template-workspace/admin/lib/select/index.ts +7 -0
- package/resources/templates/template-workspace/admin/lib/select/list.tsx +49 -0
- package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +95 -0
- package/resources/templates/template-workspace/admin/lib/select/pagination.tsx +48 -0
- package/resources/templates/template-workspace/admin/lib/select/select.tsx +87 -0
- package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +129 -0
- package/resources/templates/template-workspace/admin/lib/select/ui.tsx +80 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/change-my-password.tsx +40 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/common.tsx +94 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/create-api-key.tsx +39 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/index.ts +8 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/invite.tsx +46 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/login.tsx +52 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/memberships-control.tsx +128 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/password-reset-request.tsx +31 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/password-reset.tsx +44 -0
- package/resources/templates/template-workspace/admin/lib/tenant/forms/update-project-member.tsx +32 -0
- package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInvite.ts +28 -0
- package/resources/templates/template-workspace/admin/lib/tenant/hooks/useInviteUser.tsx +45 -0
- package/resources/templates/template-workspace/admin/lib/tenant/index.ts +3 -0
- package/resources/templates/template-workspace/admin/lib/tenant/listing/api-key-list.tsx +25 -0
- package/resources/templates/template-workspace/admin/lib/tenant/listing/index.ts +4 -0
- package/resources/templates/template-workspace/admin/lib/tenant/listing/member-delete-dialog.tsx +38 -0
- package/resources/templates/template-workspace/admin/lib/tenant/listing/member-list.tsx +147 -0
- package/resources/templates/template-workspace/admin/lib/tenant/listing/person-list.tsx +25 -0
- package/resources/templates/template-workspace/admin/lib/tenant/otp/index.ts +1 -0
- package/resources/templates/template-workspace/admin/lib/tenant/otp/otp-setup.tsx +146 -0
- package/resources/templates/template-workspace/admin/lib/toast/index.ts +2 -0
- package/resources/templates/template-workspace/admin/lib/toast/toast.tsx +112 -0
- package/resources/templates/template-workspace/admin/lib/toast/toaster.tsx +104 -0
- package/resources/templates/template-workspace/admin/lib/ui/alert-dialog.tsx +59 -0
- package/resources/templates/template-workspace/admin/lib/ui/button.tsx +29 -0
- package/resources/templates/template-workspace/admin/lib/ui/card.tsx +25 -0
- package/resources/templates/template-workspace/admin/lib/ui/dialog.tsx +51 -0
- package/resources/templates/template-workspace/admin/lib/ui/divider.tsx +11 -0
- package/resources/templates/template-workspace/admin/lib/ui/dropdown.tsx +108 -0
- package/resources/templates/template-workspace/admin/lib/ui/input.tsx +62 -0
- package/resources/templates/template-workspace/admin/lib/ui/label.tsx +7 -0
- package/resources/templates/template-workspace/admin/lib/ui/loader.tsx +30 -0
- package/resources/templates/template-workspace/admin/lib/ui/menu.tsx +103 -0
- package/resources/templates/template-workspace/admin/lib/ui/overlay.tsx +33 -0
- package/resources/templates/template-workspace/admin/lib/ui/popover.tsx +31 -0
- package/resources/templates/template-workspace/admin/lib/ui/progress.tsx +25 -0
- package/resources/templates/template-workspace/admin/lib/ui/scroll-area.tsx +45 -0
- package/resources/templates/template-workspace/admin/lib/ui/sheet.tsx +67 -0
- package/resources/templates/template-workspace/admin/lib/ui/sortable.tsx +13 -0
- package/resources/templates/template-workspace/admin/lib/ui/switch.tsx +10 -0
- package/resources/templates/template-workspace/admin/lib/ui/table.tsx +46 -0
- package/resources/templates/template-workspace/admin/lib/ui/textarea.tsx +18 -0
- package/resources/templates/template-workspace/admin/lib/ui/toggle-group.tsx +44 -0
- package/resources/templates/template-workspace/admin/lib/ui/toggle.tsx +29 -0
- package/resources/templates/template-workspace/admin/lib/ui/tooltip.tsx +24 -0
- package/resources/templates/template-workspace/admin/lib/upload/dropzone.tsx +21 -0
- package/resources/templates/template-workspace/admin/lib/upload/index.ts +3 -0
- package/resources/templates/template-workspace/admin/lib/upload/repeater.tsx +12 -0
- package/resources/templates/template-workspace/admin/lib/upload/ui.tsx +57 -0
- package/resources/templates/template-workspace/admin/lib/upload/upload-progress.tsx +130 -0
- package/resources/templates/template-workspace/admin/lib/upload/view.tsx +219 -0
- package/resources/templates/template-workspace/admin/lib/utils/cn.ts +4 -0
- package/resources/templates/template-workspace/admin/lib/utils/dict-format.tsx +3 -0
- package/resources/templates/template-workspace/admin/lib/utils/format-image-resize-url.ts +17 -0
- package/resources/templates/template-workspace/admin/lib/utils/formatting.ts +60 -0
- package/resources/templates/template-workspace/admin/lib/utils/index.ts +2 -0
- package/resources/templates/template-workspace/admin/lib/utils/uic.tsx +79 -0
- package/resources/templates/template-workspace/admin/package.json +63 -0
- package/resources/templates/template-workspace/admin/postcss.config.js +6 -0
- package/resources/templates/template-workspace/admin/public/favicon.png +0 -0
- package/resources/templates/template-workspace/admin/tailwind.config.js +73 -0
- package/resources/templates/template-workspace/admin/tsconfig.json +23 -0
- package/resources/templates/template-workspace/admin/vite-env.d.ts +7 -0
- package/resources/templates/template-workspace/admin/vite.config.ts +39 -0
- package/resources/templates/template-workspace/api/index.ts +7 -0
- package/resources/templates/template-workspace/api/migrations/.gitkeep +1 -0
- package/resources/templates/template-workspace/api/model/index.ts +1 -0
- package/resources/templates/template-workspace/api/package.json +16 -0
- package/resources/templates/template-workspace/api/tsconfig.json +10 -0
- package/resources/templates/template-workspace/biome.json +45 -0
- package/resources/templates/template-workspace/client/package.json +16 -0
- package/resources/templates/template-workspace/client/src/index.ts +1 -0
- package/resources/templates/template-workspace/client/tsconfig.json +9 -0
- package/resources/templates/template-workspace/contember.template.yaml +7 -0
- package/resources/templates/template-workspace/docker-compose.yaml +124 -0
- package/resources/templates/template-workspace/package.json +32 -0
- package/resources/templates/template-workspace/scripts/generate-client.sh +8 -0
- package/resources/templates/template-workspace/tsconfig.json +9 -0
- package/resources/templates/template-workspace/tsconfig.settings.json +15 -0
- package/src/commands/WorkspaceCreateCommand.ts +15 -6
- package/src/lib/FileSystem.ts +24 -0
- package/src/lib/PackageDownloader.ts +33 -0
- package/src/lib/TemplateInstaller.ts +102 -0
- package/src/lib/pathUtils.ts +4 -0
- package/src/run.ts +14 -5
- package/tsconfig.settings.json +5 -1
- package/types/download-tarball/index.d.ts +7 -0
- package/types/get-package-json-from-registry/index.d.ts +3 -0
- package/types/registry-info/index.d.ts +7 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { uic, uiconfig } from '../utils'
|
|
2
|
+
|
|
3
|
+
export const buttonConfig = uiconfig({
|
|
4
|
+
baseClass: 'inline-flex items-center justify-center rounded-md text-sm font-medium whitespace-nowrap transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 transition-all',
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90',
|
|
8
|
+
destructive: 'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
|
|
9
|
+
outline: 'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
|
|
10
|
+
secondary: 'bg-secondary border border-input text-secondary-foreground shadow-sm hover:bg-secondary/80',
|
|
11
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
12
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
default: 'h-9 px-4 py-2',
|
|
16
|
+
xs: 'h-6 rounded px-2 text-xs',
|
|
17
|
+
sm: 'h-8 rounded-md px-3 text-xs',
|
|
18
|
+
lg: 'h-10 rounded-md px-8',
|
|
19
|
+
icon: 'h-9 w-9',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: 'default',
|
|
24
|
+
size: 'default',
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export const Button = uic('button', buttonConfig)
|
|
29
|
+
export const AnchorButton = uic('a', buttonConfig)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { uic } from '../utils'
|
|
2
|
+
|
|
3
|
+
export const Card = uic('div', {
|
|
4
|
+
baseClass: 'rounded-xl border bg-card text-card-foreground shadow',
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
export const CardHeader = uic('div', {
|
|
8
|
+
baseClass: 'flex flex-col space-y-1.5 p-6',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const CardTitle = uic('h3', {
|
|
12
|
+
baseClass: 'font-semibold leading-none tracking-tight',
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export const CardDescription = uic('p', {
|
|
16
|
+
baseClass: 'text-sm text-muted-foreground',
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const CardContent = uic('div', {
|
|
20
|
+
baseClass: 'p-6 pt-0 space-y-2 first:pt-6',
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const CardFooter = uic('div', {
|
|
24
|
+
baseClass: 'flex items-center p-6 pt-0',
|
|
25
|
+
})
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog'
|
|
3
|
+
import { uic } from '../utils/uic'
|
|
4
|
+
import { XIcon } from 'lucide-react'
|
|
5
|
+
|
|
6
|
+
export const Dialog = DialogPrimitive.Root
|
|
7
|
+
|
|
8
|
+
export const DialogTrigger = DialogPrimitive.Trigger
|
|
9
|
+
|
|
10
|
+
export const DialogPortal = DialogPrimitive.Portal
|
|
11
|
+
|
|
12
|
+
export const DialogClose = DialogPrimitive.Close
|
|
13
|
+
|
|
14
|
+
export const DialogOverlay = uic(DialogPrimitive.DialogOverlay, {
|
|
15
|
+
baseClass: 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
16
|
+
displayName: 'DialogOverlay',
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const DialogContent = uic(DialogPrimitive.Content, {
|
|
20
|
+
baseClass: 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
|
|
21
|
+
wrapOuter: props => (
|
|
22
|
+
<DialogPortal>
|
|
23
|
+
<DialogOverlay />
|
|
24
|
+
{props.children}
|
|
25
|
+
</DialogPortal>
|
|
26
|
+
),
|
|
27
|
+
afterChildren: <>
|
|
28
|
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
|
29
|
+
<XIcon className="h-4 w-4" />
|
|
30
|
+
<span className="sr-only">Close</span>
|
|
31
|
+
</DialogPrimitive.Close>
|
|
32
|
+
</>,
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
export const DialogHeader = uic('div', {
|
|
36
|
+
baseClass: 'flex flex-col space-y-1.5 text-center sm:text-left',
|
|
37
|
+
displayName: 'DialogHeader',
|
|
38
|
+
})
|
|
39
|
+
export const DialogFooter = uic('div', {
|
|
40
|
+
baseClass: 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
|
|
41
|
+
displayName: 'DialogFooter',
|
|
42
|
+
})
|
|
43
|
+
export const DialogTitle = uic(DialogPrimitive.Title, {
|
|
44
|
+
baseClass: 'text-lg font-semibold leading-none tracking-tight',
|
|
45
|
+
displayName: 'DialogTitle',
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
export const DialogDescription = uic(DialogPrimitive.Description, {
|
|
49
|
+
baseClass: 'text-sm text-muted-foreground',
|
|
50
|
+
displayName: 'DialogDescription',
|
|
51
|
+
})
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { ReactNode } from 'react'
|
|
3
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
|
|
4
|
+
import { Check, ChevronRight, Circle, MoreHorizontalIcon } from 'lucide-react'
|
|
5
|
+
import { cn, uic } from '../utils'
|
|
6
|
+
import { buttonConfig } from './button'
|
|
7
|
+
|
|
8
|
+
export const DropdownMenu = DropdownMenuPrimitive.Root
|
|
9
|
+
|
|
10
|
+
export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
|
|
11
|
+
|
|
12
|
+
export const DropdownMenuGroup = DropdownMenuPrimitive.Group
|
|
13
|
+
|
|
14
|
+
export const DropdownMenuPortal = DropdownMenuPrimitive.Portal
|
|
15
|
+
|
|
16
|
+
export const DropdownMenuSub = DropdownMenuPrimitive.Sub
|
|
17
|
+
|
|
18
|
+
export const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export const DropdownMenuSubTrigger = uic(DropdownMenuPrimitive.SubTrigger, {
|
|
22
|
+
baseClass: 'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent',
|
|
23
|
+
beforeChildren: (
|
|
24
|
+
<ChevronRight className="ml-auto h-4 w-4" />
|
|
25
|
+
),
|
|
26
|
+
displayName: 'DropdownMenuSubTrigger',
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export const DropdownMenuSubContent = uic(DropdownMenuPrimitive.SubContent, {
|
|
30
|
+
baseClass: 'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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',
|
|
31
|
+
displayName: 'DropdownMenuSubContent',
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
export const DropdownMenuContent = uic(DropdownMenuPrimitive.DropdownMenuContent, {
|
|
35
|
+
wrapOuter: ({ children }) => <DropdownMenuPrimitive.Portal>{children}</DropdownMenuPrimitive.Portal>,
|
|
36
|
+
baseClass: 'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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',
|
|
37
|
+
displayName: 'DropdownMenuContent',
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
export const DropdownMenuItem = uic(DropdownMenuPrimitive.Item, {
|
|
41
|
+
baseClass: 'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
42
|
+
displayName: 'DropdownMenuItem',
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
export const DropdownMenuCheckboxItem = uic(DropdownMenuPrimitive.CheckboxItem, {
|
|
46
|
+
baseClass: 'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
47
|
+
beforeChildren: (
|
|
48
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
49
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
50
|
+
<Check className="h-4 w-4" />
|
|
51
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
52
|
+
</span>
|
|
53
|
+
),
|
|
54
|
+
displayName: 'DropdownMenuCheckboxItem',
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
export const DropdownMenuRadioItem = uic(DropdownMenuPrimitive.RadioItem, {
|
|
58
|
+
baseClass: 'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
59
|
+
beforeChildren: (
|
|
60
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
61
|
+
<DropdownMenuPrimitive.ItemIndicator>
|
|
62
|
+
<Circle className="h-2 w-2 fill-current" />
|
|
63
|
+
</DropdownMenuPrimitive.ItemIndicator>
|
|
64
|
+
</span>
|
|
65
|
+
),
|
|
66
|
+
displayName: 'DropdownMenuRadioItem',
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
export const DropdownMenuLabel = uic(DropdownMenuPrimitive.Label, {
|
|
71
|
+
baseClass: 'px-2 py-1.5 text-sm font-semibold',
|
|
72
|
+
displayName: 'DropdownMenuLabel',
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
export const DropdownMenuSeparator = uic(DropdownMenuPrimitive.Separator, {
|
|
76
|
+
baseClass: '-mx-1 my-1 h-px bg-muted',
|
|
77
|
+
displayName: 'DropdownMenuSeparator',
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
export const DropdownMenuShortcut = uic('span', {
|
|
81
|
+
baseClass: 'ml-auto text-xs tracking-widest opacity-60',
|
|
82
|
+
displayName: 'DropdownMenuShortcut',
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
export const DropDownTriggerButton = uic('button', {
|
|
86
|
+
...buttonConfig,
|
|
87
|
+
baseClass: cn(buttonConfig.baseClass, ' flex h-8 w-8 p-0 data-[state=open]:bg-muted'),
|
|
88
|
+
defaultVariants: {
|
|
89
|
+
variant: 'ghost',
|
|
90
|
+
},
|
|
91
|
+
displayName: 'DropDownTriggerButton',
|
|
92
|
+
beforeChildren: <>
|
|
93
|
+
<MoreHorizontalIcon className="h-4 w-4" />
|
|
94
|
+
<span className="sr-only">Open menu</span>
|
|
95
|
+
</>,
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
export const DefaultDropdown = ({ children }: {
|
|
99
|
+
children: ReactNode
|
|
100
|
+
}) => (<DropdownMenu>
|
|
101
|
+
<DropdownMenuTrigger asChild>
|
|
102
|
+
<DropDownTriggerButton />
|
|
103
|
+
</DropdownMenuTrigger>
|
|
104
|
+
<DropdownMenuContent className="w-[160px]">
|
|
105
|
+
{children}
|
|
106
|
+
</DropdownMenuContent>
|
|
107
|
+
</DropdownMenu>
|
|
108
|
+
)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { uic, uiconfig } from '../utils'
|
|
2
|
+
|
|
3
|
+
export const inputConfig = uiconfig({
|
|
4
|
+
baseClass: 'flex w-full border bg-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[invalid]:border-destructive data-[invalid]:ring-destructive read-only:bg-gray-100',
|
|
5
|
+
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
|
+
inputSize: {
|
|
11
|
+
default: 'h-10 rounded-md p-2 text-sm',
|
|
12
|
+
sm: 'h-8 rounded p-1 text-sm',
|
|
13
|
+
lg: 'h-12 rounded-lg p-3 text-lg',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: 'default',
|
|
18
|
+
inputSize: 'default',
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export const Input = uic('input', {
|
|
23
|
+
...inputConfig,
|
|
24
|
+
displayName: 'Input',
|
|
25
|
+
})
|
|
26
|
+
|
|
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
|
+
export const InputLike = uic('div', {
|
|
33
|
+
baseClass: `
|
|
34
|
+
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
|
|
35
|
+
file:border-0 file:bg-transparent file:text-sm file:font-medium
|
|
36
|
+
placeholder:text-muted-foreground
|
|
37
|
+
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
|
|
38
|
+
disabled:cursor-not-allowed
|
|
39
|
+
disabled:opacity-50
|
|
40
|
+
`,
|
|
41
|
+
displayName: 'InputLike',
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* without any styling, without ring, border etc; so it must be resetted
|
|
46
|
+
*/
|
|
47
|
+
export const InputBare = uic('input', {
|
|
48
|
+
baseClass: 'w-full h-full focus-visible:outline-none',
|
|
49
|
+
displayName: 'InputBare',
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
export const CheckboxInput = uic('input', {
|
|
54
|
+
baseClass: 'w-4 h-4',
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
export const RadioInput = uic('input', {
|
|
58
|
+
baseClass: `
|
|
59
|
+
appearance-none bg-white rounded-full w-4 h-4 ring-1 ring-gray-400 hover:ring-gray-600 grid place-items-center
|
|
60
|
+
before:rounded-full before:bg-gray-600 before:w-2 before:h-2 before:ring-2 before:ring-white before:content-[''] before:transform before:transition-all before:scale-0 checked:before:scale-100
|
|
61
|
+
`,
|
|
62
|
+
})
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as LabelPrimitive from '@radix-ui/react-label'
|
|
2
|
+
import { uic } from '../utils'
|
|
3
|
+
|
|
4
|
+
export const Label = uic(LabelPrimitive.Root, {
|
|
5
|
+
baseClass: 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 data-[invalid]:text-destructive',
|
|
6
|
+
displayName: 'Label',
|
|
7
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { uic } from '../utils'
|
|
3
|
+
import { Loader2Icon } from 'lucide-react'
|
|
4
|
+
import { Overlay, OverlayProps } from './overlay'
|
|
5
|
+
|
|
6
|
+
export interface LoaderProps extends Omit<OverlayProps, 'children'> {
|
|
7
|
+
size?: 'sm' | 'md' | 'lg'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const LoaderIcon = uic(Loader2Icon, {
|
|
11
|
+
baseClass: 'animate-spin text-gray-500',
|
|
12
|
+
variants: {
|
|
13
|
+
size: {
|
|
14
|
+
sm: 'h-6 w-6',
|
|
15
|
+
md: 'h-12 w-12',
|
|
16
|
+
lg: 'h-24 w-24',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
size: 'lg',
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
export const Loader = ({ size, ...props }: LoaderProps) => {
|
|
25
|
+
return (
|
|
26
|
+
<Overlay {...props}>
|
|
27
|
+
<LoaderIcon size={size} />
|
|
28
|
+
</Overlay>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Link, RoutingLinkTarget } from '@contember/react-routing'
|
|
2
|
+
import { ReactNode } from 'react'
|
|
3
|
+
import { uic } from '../utils'
|
|
4
|
+
import { RoleCondition, useProjectUserRoles } from '@contember/interface'
|
|
5
|
+
import { createContext } from '@contember/react-utils'
|
|
6
|
+
|
|
7
|
+
export const MenuItemUI = uic('a', {
|
|
8
|
+
baseClass: 'flex justify-start py-2.5 px-2.5 w-full gap-2 rounded text-sm items-center transition-all duration-200',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const MenuItemIconUI = uic('span', {
|
|
12
|
+
baseClass: 'w-4 text-gray-400 inline-flex items-center justify-center',
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export const MenuSubMenuUI = uic('div', {
|
|
16
|
+
baseClass: 'ml-2',
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export type MenuItem = {
|
|
20
|
+
icon?: ReactNode
|
|
21
|
+
label: ReactNode
|
|
22
|
+
to?: RoutingLinkTarget
|
|
23
|
+
/** @deprecated use children instead */
|
|
24
|
+
subItems?: MenuItem[]
|
|
25
|
+
lvl?: number
|
|
26
|
+
role?: RoleCondition
|
|
27
|
+
children?: ReactNode
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface MenuContextValue {
|
|
31
|
+
level: number
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const [MenuContext, useMenuContext] = createContext<MenuContextValue | null>('MenuContext', null)
|
|
35
|
+
export const Menu = ({ children }: {
|
|
36
|
+
children?: ReactNode
|
|
37
|
+
}) => {
|
|
38
|
+
return (
|
|
39
|
+
<MenuContext.Provider value={{ level: 0 }}>
|
|
40
|
+
<div className={'flex flex-col'}>
|
|
41
|
+
{children}
|
|
42
|
+
</div>
|
|
43
|
+
</MenuContext.Provider>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface MenuListProps {
|
|
48
|
+
items: MenuItem[]
|
|
49
|
+
lvl?: number
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated use Menu instead
|
|
54
|
+
*/
|
|
55
|
+
export const MenuList = ({ items, lvl = 0 }: MenuListProps) => {
|
|
56
|
+
return (
|
|
57
|
+
<div className={'flex flex-col'}>
|
|
58
|
+
{items.map((item, index) => (
|
|
59
|
+
<MenuItem key={index} {...item} lvl={lvl} />
|
|
60
|
+
))}
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const MenuItem = ({ icon, label, to, subItems, lvl, role, children }: MenuItem) => {
|
|
66
|
+
const projectRoles = useProjectUserRoles()
|
|
67
|
+
const menu = useMenuContext()
|
|
68
|
+
lvl ??= menu?.level ?? 0
|
|
69
|
+
if (role && !(typeof role === 'string' ? projectRoles.has(role) : role(projectRoles))) {
|
|
70
|
+
return null
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<div>
|
|
75
|
+
{to ? (
|
|
76
|
+
<Link to={to}>
|
|
77
|
+
<MenuItemUI className={'hover:bg-gray-100 cursor-pointer'}>
|
|
78
|
+
<MenuItemIconUI>{icon}</MenuItemIconUI>
|
|
79
|
+
<span className={lvl === 0 ? 'font-medium' : ''}>{label}</span>
|
|
80
|
+
</MenuItemUI>
|
|
81
|
+
</Link>
|
|
82
|
+
) : (
|
|
83
|
+
<MenuItemUI>
|
|
84
|
+
<MenuItemIconUI>{icon}</MenuItemIconUI>
|
|
85
|
+
<span className={lvl === 0 ? 'font-medium' : ''}>{label}</span>
|
|
86
|
+
</MenuItemUI>
|
|
87
|
+
)}
|
|
88
|
+
{subItems && (
|
|
89
|
+
<MenuSubMenuUI>
|
|
90
|
+
<MenuList items={subItems} lvl={lvl + 1}/>
|
|
91
|
+
</MenuSubMenuUI>
|
|
92
|
+
)}
|
|
93
|
+
|
|
94
|
+
{children && (
|
|
95
|
+
<MenuSubMenuUI>
|
|
96
|
+
<MenuContext.Provider value={{ level: lvl + 1 }}>
|
|
97
|
+
{children}
|
|
98
|
+
</MenuContext.Provider>
|
|
99
|
+
</MenuSubMenuUI>
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { cn } from '../utils'
|
|
3
|
+
|
|
4
|
+
export interface OverlayProps {
|
|
5
|
+
position?: 'fixed' | 'absolute' | 'static'
|
|
6
|
+
className?: string
|
|
7
|
+
children?: React.ReactNode
|
|
8
|
+
showImmediately?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Overlay = ({ position = 'fixed', className, children, showImmediately }: OverlayProps) => {
|
|
12
|
+
const [show, setShow] = React.useState(showImmediately ?? false)
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
requestAnimationFrame(() => {
|
|
15
|
+
setShow(true)
|
|
16
|
+
})
|
|
17
|
+
}, [])
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className={cn(
|
|
21
|
+
'z-50 bg-white bg-opacity-50 backdrop-blur-sm transition-all duration-300 delay-200',
|
|
22
|
+
show ? 'opacity-100' : 'opacity-0',
|
|
23
|
+
position === 'fixed' && 'w-full h-full fixed top-0 left-0',
|
|
24
|
+
position === 'absolute' && 'w-full h-full absolute top-0 left-0',
|
|
25
|
+
position === 'static' && '',
|
|
26
|
+
className,
|
|
27
|
+
)}>
|
|
28
|
+
<div className="flex justify-center items-center h-full w-full">
|
|
29
|
+
{children}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover'
|
|
3
|
+
import { cn } from '../utils'
|
|
4
|
+
|
|
5
|
+
const Popover = PopoverPrimitive.Root
|
|
6
|
+
|
|
7
|
+
const PopoverTrigger = PopoverPrimitive.Trigger
|
|
8
|
+
|
|
9
|
+
const PopoverAnchor = PopoverPrimitive.Anchor
|
|
10
|
+
|
|
11
|
+
const PopoverContent = React.forwardRef<
|
|
12
|
+
React.ElementRef<typeof PopoverPrimitive.Content>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
|
|
14
|
+
>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (
|
|
15
|
+
<PopoverPrimitive.Portal>
|
|
16
|
+
<PopoverPrimitive.Content
|
|
17
|
+
ref={ref}
|
|
18
|
+
align={align}
|
|
19
|
+
sideOffset={sideOffset}
|
|
20
|
+
className={cn(
|
|
21
|
+
'z-50 min-w-40 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none',
|
|
22
|
+
'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',
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
</PopoverPrimitive.Portal>
|
|
28
|
+
))
|
|
29
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName
|
|
30
|
+
|
|
31
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress'
|
|
3
|
+
import { cn } from '../utils/cn'
|
|
4
|
+
|
|
5
|
+
const Progress = React.forwardRef<
|
|
6
|
+
React.ElementRef<typeof ProgressPrimitive.Root>,
|
|
7
|
+
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
|
|
8
|
+
>(({ className, value, ...props }, ref) => (
|
|
9
|
+
<ProgressPrimitive.Root
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn(
|
|
12
|
+
'relative h-1.5 w-full overflow-hidden rounded-full bg-primary/20',
|
|
13
|
+
className,
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
>
|
|
17
|
+
<ProgressPrimitive.Indicator
|
|
18
|
+
className="h-full w-full flex-1 transition-all bg-gradient-to-b from-blue-500 to-blue-400"
|
|
19
|
+
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
|
|
20
|
+
/>
|
|
21
|
+
</ProgressPrimitive.Root>
|
|
22
|
+
))
|
|
23
|
+
Progress.displayName = ProgressPrimitive.Root.displayName
|
|
24
|
+
|
|
25
|
+
export { Progress }
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'
|
|
3
|
+
import { cn } from '../utils'
|
|
4
|
+
|
|
5
|
+
const ScrollArea = React.forwardRef<
|
|
6
|
+
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
|
7
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
|
8
|
+
>(({ className, children, ...props }, ref) => (
|
|
9
|
+
<ScrollAreaPrimitive.Root
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={'relative overflow-hidden'}
|
|
12
|
+
{...props}
|
|
13
|
+
>
|
|
14
|
+
<ScrollAreaPrimitive.Viewport className={cn('h-full w-full rounded-[inherit]', className)}>
|
|
15
|
+
{children}
|
|
16
|
+
</ScrollAreaPrimitive.Viewport>
|
|
17
|
+
<ScrollBar/>
|
|
18
|
+
<ScrollAreaPrimitive.Corner/>
|
|
19
|
+
</ScrollAreaPrimitive.Root>
|
|
20
|
+
))
|
|
21
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
|
|
22
|
+
|
|
23
|
+
const ScrollBar = React.forwardRef<
|
|
24
|
+
React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
|
25
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
26
|
+
>(({ className, orientation = 'vertical', ...props }, ref) => (
|
|
27
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
|
28
|
+
ref={ref}
|
|
29
|
+
orientation={orientation}
|
|
30
|
+
className={cn(
|
|
31
|
+
'flex touch-none select-none transition-colors',
|
|
32
|
+
orientation === 'vertical' &&
|
|
33
|
+
'h-full w-2.5 border-l border-l-transparent p-[1px]',
|
|
34
|
+
orientation === 'horizontal' &&
|
|
35
|
+
'h-2.5 flex-col border-t border-t-transparent p-[1px]',
|
|
36
|
+
className,
|
|
37
|
+
)}
|
|
38
|
+
{...props}
|
|
39
|
+
>
|
|
40
|
+
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border"/>
|
|
41
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
|
42
|
+
))
|
|
43
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
|
|
44
|
+
|
|
45
|
+
export { ScrollArea, ScrollBar }
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import * as SheetPrimitive from '@radix-ui/react-dialog'
|
|
5
|
+
import { uic } from '../utils/uic'
|
|
6
|
+
import { XIcon } from 'lucide-react'
|
|
7
|
+
|
|
8
|
+
export const Sheet = SheetPrimitive.Root
|
|
9
|
+
|
|
10
|
+
export const SheetTrigger = SheetPrimitive.Trigger
|
|
11
|
+
|
|
12
|
+
export const SheetClose = SheetPrimitive.Close
|
|
13
|
+
|
|
14
|
+
export const SheetPortal = SheetPrimitive.Portal
|
|
15
|
+
|
|
16
|
+
export const SheetOverlay = uic(SheetPrimitive.Overlay, {
|
|
17
|
+
baseClass: 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
18
|
+
displayName: 'SheetOverlay',
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export const SheetContent = uic(SheetPrimitive.Content, {
|
|
22
|
+
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',
|
|
23
|
+
variants: {
|
|
24
|
+
side: {
|
|
25
|
+
top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
|
|
26
|
+
bottom: 'inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',
|
|
27
|
+
left: 'inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm',
|
|
28
|
+
right: 'inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
side: 'right',
|
|
33
|
+
},
|
|
34
|
+
displayName: 'SheetContent',
|
|
35
|
+
wrapOuter: props => (
|
|
36
|
+
<SheetPortal>
|
|
37
|
+
{/*<SheetOverlay />*/}
|
|
38
|
+
{props.children}
|
|
39
|
+
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary">
|
|
40
|
+
<XIcon className="h-4 w-4" />
|
|
41
|
+
<span className="sr-only">Close</span>
|
|
42
|
+
</SheetPrimitive.Close>
|
|
43
|
+
</SheetPortal>
|
|
44
|
+
),
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
export const SheetHeader = uic('div', {
|
|
49
|
+
baseClass: 'flex flex-col space-y-2 text-center sm:text-left',
|
|
50
|
+
displayName: 'SheetHeader',
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export const SheetFooter = uic('div', {
|
|
55
|
+
baseClass: 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
|
|
56
|
+
displayName: 'SheetFooter',
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
export const SheetTitle = uic(SheetPrimitive.Title, {
|
|
60
|
+
baseClass: 'text-lg font-semibold text-foreground',
|
|
61
|
+
displayName: 'SheetTitle',
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
export const SheetDescription = uic(SheetPrimitive.Description, {
|
|
65
|
+
baseClass: 'text-sm text-muted-foreground',
|
|
66
|
+
displayName: 'SheetDescription',
|
|
67
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { uic } from '../utils'
|
|
2
|
+
|
|
3
|
+
export const DropIndicator = uic('div', {
|
|
4
|
+
baseClass: 'bg-blue-300 rounded shadow-lg shadow-blue-700 absolute',
|
|
5
|
+
variants: {
|
|
6
|
+
placement: {
|
|
7
|
+
top: 'w-full h-1 -top-1',
|
|
8
|
+
bottom: 'w-full h-1 bottom-0',
|
|
9
|
+
left: 'w-1 h-full -left-1',
|
|
10
|
+
right: 'w-1 h-full right-0',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import * as SwitchPrimitives from '@radix-ui/react-switch'
|
|
3
|
+
import { uic } from '../utils/uic'
|
|
4
|
+
|
|
5
|
+
export const Switch = uic(SwitchPrimitives.Root, {
|
|
6
|
+
baseClass: 'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',
|
|
7
|
+
afterChildren: <SwitchPrimitives.Thumb
|
|
8
|
+
className={'pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0'}
|
|
9
|
+
/>,
|
|
10
|
+
})
|