betterstart-cli 0.0.110 → 0.0.111
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/assets/adapters/next/templates/init/components/shared/dev-mode-integrate.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/components/shared/entity-filters-bar.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/shared/entity-versions/entity-versions-drawer.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-filters-bar.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-gallery-dialog.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-preview.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-color-highlight.ts +1 -3
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor-media-insertion.ts +1 -3
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor.ts +2 -6
- package/dist/assets/adapters/next/templates/init/pages/account-shell.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/auth-gate.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/forgot-password-form.tsx +4 -4
- package/dist/assets/adapters/next/templates/init/pages/forgot-password-page-skeleton.tsx +3 -3
- package/dist/assets/adapters/next/templates/init/pages/forgot-password-page.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/pages/login-form.tsx +4 -4
- package/dist/assets/adapters/next/templates/init/pages/login-page-skeleton.tsx +3 -3
- package/dist/assets/adapters/next/templates/init/pages/login-page.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/pages/media/media-page-content.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/reset-password-form.tsx +8 -8
- package/dist/assets/adapters/next/templates/init/pages/reset-password-page-skeleton.tsx +3 -3
- package/dist/assets/adapters/next/templates/init/pages/reset-password-page.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/pages/settings/audit-log/audit-log-detail-drawer.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/audit-log/audit-log-page.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/forms/form-notifications-drawer.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/forms/forms-settings-page.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/delete-webhook-dialog.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhook-endpoint-dialog.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhooks-logs-page.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhooks-page.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/users/change-password-dialog.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/users/create-user-dialog.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/users/edit-role-dialog.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/custom/content-editor/index.tsx +5 -30
- package/dist/assets/shared-assets/react-admin/custom/content-editor/main-toolbar-content.tsx +6 -28
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-node/removable-image-node/removable-image-node.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/custom/gallery-field.tsx +3 -3
- package/dist/assets/shared-assets/react-admin/ui/alert-dialog.tsx +6 -6
- package/dist/assets/shared-assets/react-admin/ui/alert.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/breadcrumb.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/calendar.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/card.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/dialog.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/drawer.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/field.tsx +2 -4
- package/dist/assets/shared-assets/react-admin/ui/input.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/pagination.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/sheet.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/sidebar.tsx +13 -63
- package/dist/assets/shared-assets/react-admin/ui/textarea.tsx +1 -1
- package/dist/cli.js +45 -113
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor-mobile-toolbar.ts +0 -17
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-is-breakpoint.ts +0 -24
- package/dist/assets/adapters/next/templates/init/hooks/use-mobile.ts +0 -19
- package/dist/assets/shared-assets/react-admin/custom/content-editor/mobile-toolbar-content.tsx +0 -56
|
@@ -189,7 +189,7 @@ export function GalleryField({
|
|
|
189
189
|
>
|
|
190
190
|
<CarouselContent className="-ml-3">
|
|
191
191
|
{canAdd && !disabled ? (
|
|
192
|
-
<CarouselItem className="basis-[
|
|
192
|
+
<CarouselItem className="basis-[184px] pl-3">
|
|
193
193
|
<Card className="h-full" onClick={() => setOpen(true)}>
|
|
194
194
|
<CardContent className="flex cursor-pointer flex-col p-2">
|
|
195
195
|
<div className="flex aspect-square size-full flex-col items-center justify-center gap-1 overflow-hidden rounded-sm border border-border bg-background text-muted-foreground transition-colors hover:text-foreground">
|
|
@@ -208,7 +208,7 @@ export function GalleryField({
|
|
|
208
208
|
{value.map((id) => {
|
|
209
209
|
const item = mediaMap.get(id)
|
|
210
210
|
return (
|
|
211
|
-
<CarouselItem key={id} className="basis-[
|
|
211
|
+
<CarouselItem key={id} className="basis-[184px] pl-3">
|
|
212
212
|
<SortableGalleryItem id={id} disabled={disabled}>
|
|
213
213
|
{item ? (
|
|
214
214
|
<MediaField
|
|
@@ -243,7 +243,7 @@ export function GalleryField({
|
|
|
243
243
|
</div>
|
|
244
244
|
<DragOverlay>
|
|
245
245
|
{activeId ? (
|
|
246
|
-
<div className="w-[
|
|
246
|
+
<div className="w-[184px] scale-[0.98] cursor-grabbing opacity-95">
|
|
247
247
|
{activeItem ? (
|
|
248
248
|
<MediaField
|
|
249
249
|
value={activeId}
|
|
@@ -44,7 +44,7 @@ function AlertDialogContent({
|
|
|
44
44
|
data-slot="alert-dialog-content"
|
|
45
45
|
data-size={size}
|
|
46
46
|
className={cn(
|
|
47
|
-
'group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-4xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/5 duration-100 outline-none data-[size=default]:max-w-
|
|
47
|
+
'group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-4xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/5 duration-100 outline-none data-[size=default]:max-w-md data-[size=sm]:max-w-xs data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
48
48
|
className
|
|
49
49
|
)}
|
|
50
50
|
{...props}
|
|
@@ -58,7 +58,7 @@ function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>)
|
|
|
58
58
|
<div
|
|
59
59
|
data-slot="alert-dialog-header"
|
|
60
60
|
className={cn(
|
|
61
|
-
'grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center
|
|
61
|
+
'grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center group-data-[size=default]/alert-dialog-content:place-items-start group-data-[size=default]/alert-dialog-content:text-left has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]',
|
|
62
62
|
className
|
|
63
63
|
)}
|
|
64
64
|
{...props}
|
|
@@ -81,7 +81,7 @@ function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>)
|
|
|
81
81
|
<div
|
|
82
82
|
data-slot="alert-dialog-footer"
|
|
83
83
|
className={cn(
|
|
84
|
-
'flex flex-
|
|
84
|
+
'flex flex-row justify-end gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2',
|
|
85
85
|
className
|
|
86
86
|
)}
|
|
87
87
|
{...props}
|
|
@@ -94,7 +94,7 @@ function AlertDialogMedia({ className, ...props }: React.ComponentProps<'div'>)
|
|
|
94
94
|
<div
|
|
95
95
|
data-slot="alert-dialog-media"
|
|
96
96
|
className={cn(
|
|
97
|
-
"mb-2 inline-flex size-16 items-center justify-center rounded-full bg-muted
|
|
97
|
+
"mb-2 inline-flex size-16 items-center justify-center rounded-full bg-muted group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",
|
|
98
98
|
className
|
|
99
99
|
)}
|
|
100
100
|
{...props}
|
|
@@ -110,7 +110,7 @@ function AlertDialogTitle({
|
|
|
110
110
|
<AlertDialogPrimitive.Title
|
|
111
111
|
data-slot="alert-dialog-title"
|
|
112
112
|
className={cn(
|
|
113
|
-
'cn-font-heading text-lg font-medium
|
|
113
|
+
'cn-font-heading text-lg font-medium group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2',
|
|
114
114
|
className
|
|
115
115
|
)}
|
|
116
116
|
{...props}
|
|
@@ -126,7 +126,7 @@ function AlertDialogDescription({
|
|
|
126
126
|
<AlertDialogPrimitive.Description
|
|
127
127
|
data-slot="alert-dialog-description"
|
|
128
128
|
className={cn(
|
|
129
|
-
'text-sm text-
|
|
129
|
+
'text-sm text-pretty text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',
|
|
130
130
|
className
|
|
131
131
|
)}
|
|
132
132
|
{...props}
|
|
@@ -52,7 +52,7 @@ function AlertDescription({ className, ...props }: React.ComponentProps<'div'>)
|
|
|
52
52
|
<div
|
|
53
53
|
data-slot="alert-description"
|
|
54
54
|
className={cn(
|
|
55
|
-
'text-sm text-
|
|
55
|
+
'text-sm text-pretty text-muted-foreground [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4',
|
|
56
56
|
className
|
|
57
57
|
)}
|
|
58
58
|
{...props}
|
|
@@ -13,7 +13,7 @@ function BreadcrumbList({ className, ...props }: React.ComponentProps<'ol'>) {
|
|
|
13
13
|
<ol
|
|
14
14
|
data-slot="breadcrumb-list"
|
|
15
15
|
className={cn(
|
|
16
|
-
'flex flex-wrap items-center gap-
|
|
16
|
+
'flex flex-wrap items-center gap-2.5 text-sm wrap-break-word text-muted-foreground',
|
|
17
17
|
className
|
|
18
18
|
)}
|
|
19
19
|
{...props}
|
|
@@ -39,7 +39,7 @@ function Calendar({
|
|
|
39
39
|
}}
|
|
40
40
|
classNames={{
|
|
41
41
|
root: cn('w-fit', defaultClassNames.root),
|
|
42
|
-
months: cn('relative flex flex-
|
|
42
|
+
months: cn('relative flex flex-row gap-4', defaultClassNames.months),
|
|
43
43
|
month: cn('flex w-full flex-col gap-4', defaultClassNames.month),
|
|
44
44
|
nav: cn(
|
|
45
45
|
'absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1',
|
|
@@ -24,7 +24,7 @@ function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
24
24
|
<div
|
|
25
25
|
data-slot="card-header"
|
|
26
26
|
className={cn(
|
|
27
|
-
'group/card-header
|
|
27
|
+
'group/card-header grid auto-rows-min items-start gap-2 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)',
|
|
28
28
|
className
|
|
29
29
|
)}
|
|
30
30
|
{...props}
|
|
@@ -49,7 +49,7 @@ function DialogContent({
|
|
|
49
49
|
<DialogPrimitive.Popup
|
|
50
50
|
data-slot="dialog-content"
|
|
51
51
|
className={cn(
|
|
52
|
-
'fixed top-1/2 left-1/2 z-50 grid w-full max-w-
|
|
52
|
+
'fixed top-1/2 left-1/2 z-50 grid w-full max-w-md -translate-x-1/2 -translate-y-1/2 gap-6 rounded-4xl bg-popover p-6 text-sm text-popover-foreground ring-1 ring-foreground/5 duration-100 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
53
53
|
className
|
|
54
54
|
)}
|
|
55
55
|
{...props}
|
|
@@ -90,7 +90,7 @@ function DialogFooter({
|
|
|
90
90
|
return (
|
|
91
91
|
<div
|
|
92
92
|
data-slot="dialog-footer"
|
|
93
|
-
className={cn('flex flex-
|
|
93
|
+
className={cn('flex flex-row justify-end gap-2', className)}
|
|
94
94
|
{...props}
|
|
95
95
|
>
|
|
96
96
|
{children}
|
|
@@ -117,7 +117,7 @@ function DrawerContent({ className, children, ...props }: DrawerPrimitive.Popup.
|
|
|
117
117
|
// Bleed.
|
|
118
118
|
'after:pointer-events-none after:absolute after:bg-(--drawer-bleed-background,var(--color-popover)) data-[swipe-axis=x]:after:inset-y-0 data-[swipe-axis=x]:after:w-(--bleed) data-[swipe-axis=y]:after:inset-x-0 data-[swipe-axis=y]:after:h-(--bleed) data-[swipe-direction=down]:after:top-full data-[swipe-direction=left]:after:right-full data-[swipe-direction=right]:after:left-full data-[swipe-direction=up]:after:bottom-full',
|
|
119
119
|
// Sizing.
|
|
120
|
-
'[--drawer-content-height:var(--drawer-height,auto)] data-[swipe-axis=x]:[--drawer-content-width:
|
|
120
|
+
'[--drawer-content-height:var(--drawer-height,auto)] data-[swipe-axis=x]:[--drawer-content-width:24rem] data-[swipe-axis=y]:[--drawer-content-max-height:calc(100dvh-6rem)] data-[swipe-axis=y]:data-snap-points:[--drawer-content-height:100dvh]',
|
|
121
121
|
// Stack.
|
|
122
122
|
'[--bleed:3rem] [--peek:1rem] [--stack-height:var(--drawer-frontmost-height,var(--drawer-height,0px))] [--stack-peek-offset:max(0px,calc((var(--nested-drawers)-var(--stack-progress))*var(--peek)))] [--stack-progress:clamp(0,var(--drawer-swipe-progress),1)] [--stack-scale-base:max(0,calc(1-(var(--nested-drawers)*var(--stack-step))))] [--stack-scale:clamp(0,calc(var(--stack-scale-base)+(var(--stack-step)*var(--stack-progress))),1)] [--stack-shrink:calc(1-var(--stack-scale))] [--stack-step:0.05]',
|
|
123
123
|
// Transitions.
|
|
@@ -158,7 +158,7 @@ function DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
158
158
|
<div
|
|
159
159
|
data-slot="drawer-header"
|
|
160
160
|
className={cn(
|
|
161
|
-
'flex shrink-0 flex-col gap-
|
|
161
|
+
'flex shrink-0 flex-col gap-1.5 p-4 pb-0 text-left group-data-[swipe-axis=y]/drawer-popup:text-center',
|
|
162
162
|
className
|
|
163
163
|
)}
|
|
164
164
|
{...props}
|
|
@@ -43,7 +43,7 @@ function FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
43
43
|
<div
|
|
44
44
|
data-slot="field-group"
|
|
45
45
|
className={cn(
|
|
46
|
-
'group/field-group
|
|
46
|
+
'group/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',
|
|
47
47
|
className
|
|
48
48
|
)}
|
|
49
49
|
{...props}
|
|
@@ -56,9 +56,7 @@ const fieldVariants = cva('group/field flex w-full gap-3 data-[invalid=true]:tex
|
|
|
56
56
|
orientation: {
|
|
57
57
|
vertical: 'flex-col *:w-full [&>.sr-only]:w-auto',
|
|
58
58
|
horizontal:
|
|
59
|
-
'flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'
|
|
60
|
-
responsive:
|
|
61
|
-
'flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'
|
|
59
|
+
'flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'
|
|
62
60
|
}
|
|
63
61
|
},
|
|
64
62
|
defaultVariants: {
|
|
@@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
|
|
8
8
|
type={type}
|
|
9
9
|
data-slot="input"
|
|
10
10
|
className={cn(
|
|
11
|
-
'h-9 w-full min-w-0 rounded-4xl border border-input bg-input/30 px-3 py-1 text-
|
|
11
|
+
'h-9 w-full min-w-0 rounded-4xl border border-input bg-input/30 px-3 py-1 text-sm transition-colors outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20',
|
|
12
12
|
className
|
|
13
13
|
)}
|
|
14
14
|
{...props}
|
|
@@ -66,7 +66,7 @@ function PaginationPrevious({
|
|
|
66
66
|
{...props}
|
|
67
67
|
>
|
|
68
68
|
<ChevronLeftIcon data-icon="inline-start" className="cn-rtl-flip" />
|
|
69
|
-
<span className="
|
|
69
|
+
<span className="block">{text}</span>
|
|
70
70
|
</PaginationLink>
|
|
71
71
|
)
|
|
72
72
|
}
|
|
@@ -83,7 +83,7 @@ function PaginationNext({
|
|
|
83
83
|
className={cn('pr-2!', className)}
|
|
84
84
|
{...props}
|
|
85
85
|
>
|
|
86
|
-
<span className="
|
|
86
|
+
<span className="block">{text}</span>
|
|
87
87
|
<ChevronRightIcon data-icon="inline-end" className="cn-rtl-flip" />
|
|
88
88
|
</PaginationLink>
|
|
89
89
|
)
|
|
@@ -52,7 +52,7 @@ function SheetContent({
|
|
|
52
52
|
data-slot="sheet-content"
|
|
53
53
|
data-side={side}
|
|
54
54
|
className={cn(
|
|
55
|
-
'fixed z-50 flex flex-col bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem]
|
|
55
|
+
'fixed z-50 flex flex-col bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:max-w-sm data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:max-w-sm data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem]',
|
|
56
56
|
className
|
|
57
57
|
)}
|
|
58
58
|
{...props}
|
|
@@ -5,16 +5,8 @@ import type { VariantProps } from 'class-variance-authority'
|
|
|
5
5
|
import { Button } from '@admin/components/ui/button'
|
|
6
6
|
import { Input } from '@admin/components/ui/input'
|
|
7
7
|
import { Separator } from '@admin/components/ui/separator'
|
|
8
|
-
import {
|
|
9
|
-
Sheet,
|
|
10
|
-
SheetContent,
|
|
11
|
-
SheetDescription,
|
|
12
|
-
SheetHeader,
|
|
13
|
-
SheetTitle
|
|
14
|
-
} from '@admin/components/ui/sheet'
|
|
15
8
|
import { Skeleton } from '@admin/components/ui/skeleton'
|
|
16
9
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@admin/components/ui/tooltip'
|
|
17
|
-
import { useIsMobile } from '@admin/hooks/use-mobile'
|
|
18
10
|
import { cn } from '@admin/utils/shared/cn'
|
|
19
11
|
import { mergeProps } from '@base-ui/react/merge-props'
|
|
20
12
|
import { useRender } from '@base-ui/react/use-render'
|
|
@@ -24,7 +16,6 @@ import { PanelLeftIcon } from 'lucide-react'
|
|
|
24
16
|
const SIDEBAR_COOKIE_NAME = 'sidebar_state'
|
|
25
17
|
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
|
|
26
18
|
const SIDEBAR_WIDTH = '16rem'
|
|
27
|
-
const SIDEBAR_WIDTH_MOBILE = '18rem'
|
|
28
19
|
const SIDEBAR_WIDTH_ICON = '3rem'
|
|
29
20
|
const SIDEBAR_KEYBOARD_SHORTCUT = 'b'
|
|
30
21
|
|
|
@@ -32,9 +23,6 @@ type SidebarContextProps = {
|
|
|
32
23
|
state: 'expanded' | 'collapsed'
|
|
33
24
|
open: boolean
|
|
34
25
|
setOpen: (open: boolean) => void
|
|
35
|
-
openMobile: boolean
|
|
36
|
-
setOpenMobile: (open: boolean) => void
|
|
37
|
-
isMobile: boolean
|
|
38
26
|
toggleSidebar: () => void
|
|
39
27
|
}
|
|
40
28
|
|
|
@@ -62,9 +50,6 @@ function SidebarProvider({
|
|
|
62
50
|
open?: boolean
|
|
63
51
|
onOpenChange?: (open: boolean) => void
|
|
64
52
|
}) {
|
|
65
|
-
const isMobile = useIsMobile()
|
|
66
|
-
const [openMobile, setOpenMobile] = React.useState(false)
|
|
67
|
-
|
|
68
53
|
// This is the internal state of the sidebar.
|
|
69
54
|
// We use openProp and setOpenProp for control from outside the component.
|
|
70
55
|
const [_open, _setOpen] = React.useState(defaultOpen)
|
|
@@ -86,8 +71,8 @@ function SidebarProvider({
|
|
|
86
71
|
|
|
87
72
|
// Helper to toggle the sidebar.
|
|
88
73
|
const toggleSidebar = React.useCallback(() => {
|
|
89
|
-
return
|
|
90
|
-
}, [
|
|
74
|
+
return setOpen((open) => !open)
|
|
75
|
+
}, [setOpen])
|
|
91
76
|
|
|
92
77
|
// Adds a keyboard shortcut to toggle the sidebar.
|
|
93
78
|
React.useEffect(() => {
|
|
@@ -111,12 +96,9 @@ function SidebarProvider({
|
|
|
111
96
|
state,
|
|
112
97
|
open,
|
|
113
98
|
setOpen,
|
|
114
|
-
isMobile,
|
|
115
|
-
openMobile,
|
|
116
|
-
setOpenMobile,
|
|
117
99
|
toggleSidebar
|
|
118
100
|
}),
|
|
119
|
-
[state, open, setOpen,
|
|
101
|
+
[state, open, setOpen, toggleSidebar]
|
|
120
102
|
)
|
|
121
103
|
|
|
122
104
|
return (
|
|
@@ -148,14 +130,13 @@ function Sidebar({
|
|
|
148
130
|
collapsible = 'offcanvas',
|
|
149
131
|
className,
|
|
150
132
|
children,
|
|
151
|
-
dir,
|
|
152
133
|
...props
|
|
153
134
|
}: React.ComponentProps<'div'> & {
|
|
154
135
|
side?: 'left' | 'right'
|
|
155
136
|
variant?: 'sidebar' | 'floating' | 'inset'
|
|
156
137
|
collapsible?: 'offcanvas' | 'icon' | 'none'
|
|
157
138
|
}) {
|
|
158
|
-
const {
|
|
139
|
+
const { state } = useSidebar()
|
|
159
140
|
|
|
160
141
|
if (collapsible === 'none') {
|
|
161
142
|
return (
|
|
@@ -172,35 +153,9 @@ function Sidebar({
|
|
|
172
153
|
)
|
|
173
154
|
}
|
|
174
155
|
|
|
175
|
-
if (isMobile) {
|
|
176
|
-
return (
|
|
177
|
-
<Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
|
|
178
|
-
<SheetContent
|
|
179
|
-
dir={dir}
|
|
180
|
-
data-sidebar="sidebar"
|
|
181
|
-
data-slot="sidebar"
|
|
182
|
-
data-mobile="true"
|
|
183
|
-
className="w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
|
|
184
|
-
style={
|
|
185
|
-
{
|
|
186
|
-
'--sidebar-width': SIDEBAR_WIDTH_MOBILE
|
|
187
|
-
} as React.CSSProperties
|
|
188
|
-
}
|
|
189
|
-
side={side}
|
|
190
|
-
>
|
|
191
|
-
<SheetHeader className="sr-only">
|
|
192
|
-
<SheetTitle>Sidebar</SheetTitle>
|
|
193
|
-
<SheetDescription>Displays the mobile sidebar.</SheetDescription>
|
|
194
|
-
</SheetHeader>
|
|
195
|
-
<div className="flex h-full w-full flex-col">{children}</div>
|
|
196
|
-
</SheetContent>
|
|
197
|
-
</Sheet>
|
|
198
|
-
)
|
|
199
|
-
}
|
|
200
|
-
|
|
201
156
|
return (
|
|
202
157
|
<div
|
|
203
|
-
className="group peer
|
|
158
|
+
className="group peer block text-sidebar-foreground"
|
|
204
159
|
data-state={state}
|
|
205
160
|
data-collapsible={state === 'collapsed' ? collapsible : ''}
|
|
206
161
|
data-variant={variant}
|
|
@@ -226,7 +181,7 @@ function Sidebar({
|
|
|
226
181
|
data-slot="sidebar-container"
|
|
227
182
|
data-side={side}
|
|
228
183
|
className={cn(
|
|
229
|
-
'fixed inset-y-0 z-10
|
|
184
|
+
'fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
|
|
230
185
|
{
|
|
231
186
|
'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]':
|
|
232
187
|
variant === 'floating' || variant === 'inset',
|
|
@@ -283,7 +238,7 @@ function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
|
|
|
283
238
|
onClick={toggleSidebar}
|
|
284
239
|
title="Toggle Sidebar"
|
|
285
240
|
className={cn(
|
|
286
|
-
'absolute inset-y-0 z-20
|
|
241
|
+
'absolute inset-y-0 z-20 flex w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border ltr:-translate-x-1/2 rtl:-translate-x-1/2',
|
|
287
242
|
'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize',
|
|
288
243
|
'[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
|
|
289
244
|
'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar',
|
|
@@ -301,7 +256,7 @@ function SidebarInset({ className, ...props }: React.ComponentProps<'main'>) {
|
|
|
301
256
|
<main
|
|
302
257
|
data-slot="sidebar-inset"
|
|
303
258
|
className={cn(
|
|
304
|
-
'relative flex w-full flex-1 flex-col bg-background
|
|
259
|
+
'relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2',
|
|
305
260
|
className
|
|
306
261
|
)}
|
|
307
262
|
{...props}
|
|
@@ -412,7 +367,7 @@ function SidebarGroupAction({
|
|
|
412
367
|
props: mergeProps<'button'>(
|
|
413
368
|
{
|
|
414
369
|
className: cn(
|
|
415
|
-
'absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden
|
|
370
|
+
'absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
416
371
|
className
|
|
417
372
|
)
|
|
418
373
|
},
|
|
@@ -494,7 +449,7 @@ function SidebarMenuButton({
|
|
|
494
449
|
isActive?: boolean
|
|
495
450
|
tooltip?: string | React.ComponentProps<typeof TooltipContent>
|
|
496
451
|
} & VariantProps<typeof sidebarMenuButtonVariants>) {
|
|
497
|
-
const {
|
|
452
|
+
const { state } = useSidebar()
|
|
498
453
|
const comp = useRender({
|
|
499
454
|
defaultTagName: 'button',
|
|
500
455
|
props: mergeProps<'button'>(
|
|
@@ -525,12 +480,7 @@ function SidebarMenuButton({
|
|
|
525
480
|
return (
|
|
526
481
|
<Tooltip>
|
|
527
482
|
{comp}
|
|
528
|
-
<TooltipContent
|
|
529
|
-
side="right"
|
|
530
|
-
align="center"
|
|
531
|
-
hidden={state !== 'collapsed' || isMobile}
|
|
532
|
-
{...tooltip}
|
|
533
|
-
/>
|
|
483
|
+
<TooltipContent side="right" align="center" hidden={state !== 'collapsed'} {...tooltip} />
|
|
534
484
|
</Tooltip>
|
|
535
485
|
)
|
|
536
486
|
}
|
|
@@ -549,9 +499,9 @@ function SidebarMenuAction({
|
|
|
549
499
|
props: mergeProps<'button'>(
|
|
550
500
|
{
|
|
551
501
|
className: cn(
|
|
552
|
-
'absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-2 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1
|
|
502
|
+
'absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-2 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
553
503
|
{
|
|
554
|
-
'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100
|
|
504
|
+
'opacity-0 group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100':
|
|
555
505
|
showOnHover
|
|
556
506
|
},
|
|
557
507
|
className
|
|
@@ -6,7 +6,7 @@ function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {
|
|
|
6
6
|
<textarea
|
|
7
7
|
data-slot="textarea"
|
|
8
8
|
className={cn(
|
|
9
|
-
'flex field-sizing-content min-h-16 w-full resize-none rounded-xl border border-input bg-input/30 px-3 py-3 text-
|
|
9
|
+
'flex field-sizing-content min-h-16 w-full resize-none rounded-xl border border-input bg-input/30 px-3 py-3 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20',
|
|
10
10
|
className
|
|
11
11
|
)}
|
|
12
12
|
{...props}
|