flarecms 0.1.0

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.
Files changed (110) hide show
  1. package/README.md +73 -0
  2. package/dist/auth/index.js +40 -0
  3. package/dist/cli/commands.js +389 -0
  4. package/dist/cli/index.js +403 -0
  5. package/dist/cli/mcp.js +209 -0
  6. package/dist/db/index.js +164 -0
  7. package/dist/index.js +17626 -0
  8. package/package.json +105 -0
  9. package/scripts/fix-api-paths.mjs +32 -0
  10. package/scripts/fix-imports.mjs +38 -0
  11. package/scripts/prefix-css.mjs +45 -0
  12. package/src/api/lib/cache.ts +45 -0
  13. package/src/api/lib/response.ts +40 -0
  14. package/src/api/middlewares/auth.ts +186 -0
  15. package/src/api/middlewares/cors.ts +10 -0
  16. package/src/api/middlewares/rbac.ts +85 -0
  17. package/src/api/routes/auth.ts +377 -0
  18. package/src/api/routes/collections.ts +205 -0
  19. package/src/api/routes/content.ts +175 -0
  20. package/src/api/routes/device.ts +160 -0
  21. package/src/api/routes/magic.ts +150 -0
  22. package/src/api/routes/mcp.ts +273 -0
  23. package/src/api/routes/oauth.ts +160 -0
  24. package/src/api/routes/settings.ts +43 -0
  25. package/src/api/routes/setup.ts +307 -0
  26. package/src/api/routes/tokens.ts +80 -0
  27. package/src/api/schemas/auth.ts +15 -0
  28. package/src/api/schemas/index.ts +51 -0
  29. package/src/api/schemas/tokens.ts +24 -0
  30. package/src/auth/index.ts +28 -0
  31. package/src/cli/commands.ts +217 -0
  32. package/src/cli/index.ts +21 -0
  33. package/src/cli/mcp.ts +210 -0
  34. package/src/cli/tests/cli.test.ts +40 -0
  35. package/src/cli/tests/create.test.ts +87 -0
  36. package/src/client/FlareAdminRouter.tsx +47 -0
  37. package/src/client/app.tsx +175 -0
  38. package/src/client/components/app-sidebar.tsx +227 -0
  39. package/src/client/components/collection-modal.tsx +215 -0
  40. package/src/client/components/content-list.tsx +247 -0
  41. package/src/client/components/dynamic-form.tsx +190 -0
  42. package/src/client/components/field-modal.tsx +221 -0
  43. package/src/client/components/settings/api-token-section.tsx +400 -0
  44. package/src/client/components/settings/general-section.tsx +224 -0
  45. package/src/client/components/settings/security-section.tsx +154 -0
  46. package/src/client/components/settings/seo-section.tsx +200 -0
  47. package/src/client/components/settings/signup-section.tsx +257 -0
  48. package/src/client/components/ui/accordion.tsx +78 -0
  49. package/src/client/components/ui/avatar.tsx +107 -0
  50. package/src/client/components/ui/badge.tsx +52 -0
  51. package/src/client/components/ui/button.tsx +60 -0
  52. package/src/client/components/ui/card.tsx +103 -0
  53. package/src/client/components/ui/checkbox.tsx +27 -0
  54. package/src/client/components/ui/collapsible.tsx +19 -0
  55. package/src/client/components/ui/dialog.tsx +162 -0
  56. package/src/client/components/ui/icon-picker.tsx +485 -0
  57. package/src/client/components/ui/icons-data.ts +8476 -0
  58. package/src/client/components/ui/input.tsx +20 -0
  59. package/src/client/components/ui/label.tsx +20 -0
  60. package/src/client/components/ui/popover.tsx +91 -0
  61. package/src/client/components/ui/select.tsx +204 -0
  62. package/src/client/components/ui/separator.tsx +23 -0
  63. package/src/client/components/ui/sheet.tsx +141 -0
  64. package/src/client/components/ui/sidebar.tsx +722 -0
  65. package/src/client/components/ui/skeleton.tsx +13 -0
  66. package/src/client/components/ui/sonner.tsx +47 -0
  67. package/src/client/components/ui/switch.tsx +30 -0
  68. package/src/client/components/ui/table.tsx +116 -0
  69. package/src/client/components/ui/tabs.tsx +80 -0
  70. package/src/client/components/ui/textarea.tsx +18 -0
  71. package/src/client/components/ui/tooltip.tsx +68 -0
  72. package/src/client/hooks/use-mobile.ts +19 -0
  73. package/src/client/index.css +149 -0
  74. package/src/client/index.ts +7 -0
  75. package/src/client/layouts/admin-layout.tsx +93 -0
  76. package/src/client/layouts/settings-layout.tsx +104 -0
  77. package/src/client/lib/api.ts +72 -0
  78. package/src/client/lib/utils.ts +6 -0
  79. package/src/client/main.tsx +10 -0
  80. package/src/client/pages/collection-detail.tsx +634 -0
  81. package/src/client/pages/collections.tsx +180 -0
  82. package/src/client/pages/dashboard.tsx +133 -0
  83. package/src/client/pages/device.tsx +66 -0
  84. package/src/client/pages/document-detail-page.tsx +139 -0
  85. package/src/client/pages/documents-page.tsx +103 -0
  86. package/src/client/pages/login.tsx +345 -0
  87. package/src/client/pages/settings.tsx +65 -0
  88. package/src/client/pages/setup.tsx +129 -0
  89. package/src/client/pages/signup.tsx +188 -0
  90. package/src/client/store/auth.ts +30 -0
  91. package/src/client/store/collections.ts +13 -0
  92. package/src/client/store/config.ts +12 -0
  93. package/src/client/store/fetcher.ts +30 -0
  94. package/src/client/store/router.ts +95 -0
  95. package/src/client/store/schema.ts +39 -0
  96. package/src/client/store/settings.ts +31 -0
  97. package/src/client/types.ts +34 -0
  98. package/src/db/dynamic.ts +70 -0
  99. package/src/db/index.ts +16 -0
  100. package/src/db/migrations/001_initial_schema.ts +57 -0
  101. package/src/db/migrations/002_auth_tables.ts +84 -0
  102. package/src/db/migrator.ts +61 -0
  103. package/src/db/schema.ts +142 -0
  104. package/src/index.ts +12 -0
  105. package/src/server/index.ts +66 -0
  106. package/src/types.ts +20 -0
  107. package/style.css.d.ts +8 -0
  108. package/tests/css.test.ts +21 -0
  109. package/tests/modular.test.ts +29 -0
  110. package/tsconfig.json +10 -0
@@ -0,0 +1,20 @@
1
+ import * as React from "react"
2
+ import { Input as InputPrimitive } from "@base-ui/react/input"
3
+
4
+ import { cn } from "../../lib/utils"
5
+
6
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
7
+ return (
8
+ <InputPrimitive
9
+ type={type}
10
+ data-slot="input"
11
+ className={cn(
12
+ "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 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-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
13
+ className
14
+ )}
15
+ {...props}
16
+ />
17
+ )
18
+ }
19
+
20
+ export { Input }
@@ -0,0 +1,20 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+
5
+ import { cn } from "../../lib/utils"
6
+
7
+ function Label({ className, ...props }: React.ComponentProps<"label">) {
8
+ return (
9
+ <label
10
+ data-slot="label"
11
+ className={cn(
12
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
13
+ className
14
+ )}
15
+ {...props}
16
+ />
17
+ )
18
+ }
19
+
20
+ export { Label }
@@ -0,0 +1,91 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { Popover as PopoverPrimitive } from 'radix-ui';
5
+
6
+ import { cn } from '../../lib/utils';
7
+
8
+ function Popover({
9
+ ...props
10
+ }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
11
+ return <PopoverPrimitive.Root data-slot="popover" {...props} />;
12
+ }
13
+
14
+ function PopoverTrigger({
15
+ ...props
16
+ }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
17
+ return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
18
+ }
19
+
20
+ function PopoverContent({
21
+ className,
22
+ align = 'center',
23
+ sideOffset = 4,
24
+ ...props
25
+ }: React.ComponentProps<typeof PopoverPrimitive.Content>) {
26
+ return (
27
+ <PopoverPrimitive.Portal>
28
+ <div className="flare-admin text-foreground">
29
+ <PopoverPrimitive.Content
30
+ data-slot="popover-content"
31
+ align={align}
32
+ sideOffset={sideOffset}
33
+ className={cn(
34
+ 'z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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 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',
35
+ className,
36
+ )}
37
+ {...props}
38
+ />
39
+ </div>
40
+ </PopoverPrimitive.Portal>
41
+ );
42
+ }
43
+
44
+ function PopoverAnchor({
45
+ ...props
46
+ }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
47
+ return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
48
+ }
49
+
50
+ function PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {
51
+ return (
52
+ <div
53
+ data-slot="popover-header"
54
+ className={cn('flex flex-col gap-0.5 text-sm', className)}
55
+ {...props}
56
+ />
57
+ );
58
+ }
59
+
60
+ function PopoverTitle({ className, ...props }: React.ComponentProps<'h2'>) {
61
+ return (
62
+ <div
63
+ data-slot="popover-title"
64
+ className={cn('cn-font-heading font-medium', className)}
65
+ {...props}
66
+ />
67
+ );
68
+ }
69
+
70
+ function PopoverDescription({
71
+ className,
72
+ ...props
73
+ }: React.ComponentProps<'p'>) {
74
+ return (
75
+ <p
76
+ data-slot="popover-description"
77
+ className={cn('text-muted-foreground', className)}
78
+ {...props}
79
+ />
80
+ );
81
+ }
82
+
83
+ export {
84
+ Popover,
85
+ PopoverAnchor,
86
+ PopoverContent,
87
+ PopoverDescription,
88
+ PopoverHeader,
89
+ PopoverTitle,
90
+ PopoverTrigger,
91
+ };
@@ -0,0 +1,204 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { Select as SelectPrimitive } from '@base-ui/react/select';
5
+
6
+ import { cn } from '../../lib/utils';
7
+ import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from 'lucide-react';
8
+
9
+ const Select = SelectPrimitive.Root;
10
+
11
+ function SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {
12
+ return (
13
+ <SelectPrimitive.Group
14
+ data-slot="select-group"
15
+ className={cn('scroll-my-1 p-1', className)}
16
+ {...props}
17
+ />
18
+ );
19
+ }
20
+
21
+ function SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {
22
+ return (
23
+ <SelectPrimitive.Value
24
+ data-slot="select-value"
25
+ className={cn('flex flex-1 text-left', className)}
26
+ {...props}
27
+ />
28
+ );
29
+ }
30
+
31
+ function SelectTrigger({
32
+ className,
33
+ size = 'default',
34
+ children,
35
+ ...props
36
+ }: SelectPrimitive.Trigger.Props & {
37
+ size?: 'sm' | 'default';
38
+ }) {
39
+ return (
40
+ <SelectPrimitive.Trigger
41
+ data-slot="select-trigger"
42
+ data-size={size}
43
+ className={cn(
44
+ "flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
45
+ className,
46
+ )}
47
+ {...props}
48
+ >
49
+ {children}
50
+ <SelectPrimitive.Icon
51
+ render={
52
+ <ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
53
+ }
54
+ />
55
+ </SelectPrimitive.Trigger>
56
+ );
57
+ }
58
+
59
+ function SelectContent({
60
+ className,
61
+ children,
62
+ side = 'bottom',
63
+ sideOffset = 4,
64
+ align = 'center',
65
+ alignOffset = 0,
66
+ alignItemWithTrigger = true,
67
+ ...props
68
+ }: SelectPrimitive.Popup.Props &
69
+ Pick<
70
+ SelectPrimitive.Positioner.Props,
71
+ 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'alignItemWithTrigger'
72
+ >) {
73
+ return (
74
+ <SelectPrimitive.Portal>
75
+ <div className="flare-admin text-foreground">
76
+ <SelectPrimitive.Positioner
77
+ side={side}
78
+ sideOffset={sideOffset}
79
+ align={align}
80
+ alignOffset={alignOffset}
81
+ alignItemWithTrigger={alignItemWithTrigger}
82
+ className="isolate z-50"
83
+ >
84
+ <SelectPrimitive.Popup
85
+ data-slot="select-content"
86
+ data-align-trigger={alignItemWithTrigger}
87
+ className={cn(
88
+ 'relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 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',
89
+ className,
90
+ )}
91
+ {...props}
92
+ >
93
+ <SelectScrollUpButton />
94
+ <SelectPrimitive.List>{children}</SelectPrimitive.List>
95
+ <SelectScrollDownButton />
96
+ </SelectPrimitive.Popup>
97
+ </SelectPrimitive.Positioner>
98
+ </div>
99
+ </SelectPrimitive.Portal>
100
+ );
101
+ }
102
+
103
+ function SelectLabel({
104
+ className,
105
+ ...props
106
+ }: SelectPrimitive.GroupLabel.Props) {
107
+ return (
108
+ <SelectPrimitive.GroupLabel
109
+ data-slot="select-label"
110
+ className={cn('px-1.5 py-1 text-xs text-muted-foreground', className)}
111
+ {...props}
112
+ />
113
+ );
114
+ }
115
+
116
+ function SelectItem({
117
+ className,
118
+ children,
119
+ ...props
120
+ }: SelectPrimitive.Item.Props) {
121
+ return (
122
+ <SelectPrimitive.Item
123
+ data-slot="select-item"
124
+ className={cn(
125
+ "relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
126
+ className,
127
+ )}
128
+ {...props}
129
+ >
130
+ <SelectPrimitive.ItemText className="flex flex-1 shrink-0 gap-2 whitespace-nowrap">
131
+ {children}
132
+ </SelectPrimitive.ItemText>
133
+ <SelectPrimitive.ItemIndicator
134
+ render={
135
+ <span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
136
+ }
137
+ >
138
+ <CheckIcon className="pointer-events-none" />
139
+ </SelectPrimitive.ItemIndicator>
140
+ </SelectPrimitive.Item>
141
+ );
142
+ }
143
+
144
+ function SelectSeparator({
145
+ className,
146
+ ...props
147
+ }: SelectPrimitive.Separator.Props) {
148
+ return (
149
+ <SelectPrimitive.Separator
150
+ data-slot="select-separator"
151
+ className={cn('pointer-events-none -mx-1 my-1 h-px bg-border', className)}
152
+ {...props}
153
+ />
154
+ );
155
+ }
156
+
157
+ function SelectScrollUpButton({
158
+ className,
159
+ ...props
160
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {
161
+ return (
162
+ <SelectPrimitive.ScrollUpArrow
163
+ data-slot="select-scroll-up-button"
164
+ className={cn(
165
+ "top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
166
+ className,
167
+ )}
168
+ {...props}
169
+ >
170
+ <ChevronUpIcon />
171
+ </SelectPrimitive.ScrollUpArrow>
172
+ );
173
+ }
174
+
175
+ function SelectScrollDownButton({
176
+ className,
177
+ ...props
178
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {
179
+ return (
180
+ <SelectPrimitive.ScrollDownArrow
181
+ data-slot="select-scroll-down-button"
182
+ className={cn(
183
+ "bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
184
+ className,
185
+ )}
186
+ {...props}
187
+ >
188
+ <ChevronDownIcon />
189
+ </SelectPrimitive.ScrollDownArrow>
190
+ );
191
+ }
192
+
193
+ export {
194
+ Select,
195
+ SelectContent,
196
+ SelectGroup,
197
+ SelectItem,
198
+ SelectLabel,
199
+ SelectScrollDownButton,
200
+ SelectScrollUpButton,
201
+ SelectSeparator,
202
+ SelectTrigger,
203
+ SelectValue,
204
+ };
@@ -0,0 +1,23 @@
1
+ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
2
+
3
+ import { cn } from "../../lib/utils"
4
+
5
+ function Separator({
6
+ className,
7
+ orientation = "horizontal",
8
+ ...props
9
+ }: SeparatorPrimitive.Props) {
10
+ return (
11
+ <SeparatorPrimitive
12
+ data-slot="separator"
13
+ orientation={orientation}
14
+ className={cn(
15
+ "shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
16
+ className
17
+ )}
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ export { Separator }
@@ -0,0 +1,141 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { Dialog as SheetPrimitive } from '@base-ui/react/dialog';
5
+
6
+ import { cn } from '../../lib/utils';
7
+ import { Button } from './button';
8
+ import { XIcon } from 'lucide-react';
9
+
10
+ function Sheet({ ...props }: SheetPrimitive.Root.Props) {
11
+ return <SheetPrimitive.Root data-slot="sheet" {...props} />;
12
+ }
13
+
14
+ function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {
15
+ return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
16
+ }
17
+
18
+ function SheetClose({ ...props }: SheetPrimitive.Close.Props) {
19
+ return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
20
+ }
21
+
22
+ function SheetPortal({ children, ...props }: SheetPrimitive.Portal.Props) {
23
+ return (
24
+ <SheetPrimitive.Portal data-slot="sheet-portal" {...props}>
25
+ <div className="flare-admin text-foreground">{children}</div>
26
+ </SheetPrimitive.Portal>
27
+ );
28
+ }
29
+
30
+ function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
31
+ return (
32
+ <SheetPrimitive.Backdrop
33
+ data-slot="sheet-overlay"
34
+ className={cn(
35
+ 'fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs',
36
+ className,
37
+ )}
38
+ {...props}
39
+ />
40
+ );
41
+ }
42
+
43
+ function SheetContent({
44
+ className,
45
+ children,
46
+ side = 'right',
47
+ showCloseButton = true,
48
+ ...props
49
+ }: SheetPrimitive.Popup.Props & {
50
+ side?: 'top' | 'right' | 'bottom' | 'left';
51
+ showCloseButton?: boolean;
52
+ }) {
53
+ return (
54
+ <SheetPortal>
55
+ <SheetOverlay />
56
+ <SheetPrimitive.Popup
57
+ data-slot="sheet-content"
58
+ data-side={side}
59
+ className={cn(
60
+ 'fixed z-50 flex flex-col gap-4 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] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm',
61
+ className,
62
+ )}
63
+ {...props}
64
+ >
65
+ {children}
66
+ {showCloseButton && (
67
+ <SheetPrimitive.Close
68
+ data-slot="sheet-close"
69
+ render={
70
+ <Button
71
+ variant="ghost"
72
+ className="absolute top-3 right-3"
73
+ size="icon-sm"
74
+ />
75
+ }
76
+ >
77
+ <XIcon />
78
+ <span className="sr-only">Close</span>
79
+ </SheetPrimitive.Close>
80
+ )}
81
+ </SheetPrimitive.Popup>
82
+ </SheetPortal>
83
+ );
84
+ }
85
+
86
+ function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
87
+ return (
88
+ <div
89
+ data-slot="sheet-header"
90
+ className={cn('flex flex-col gap-0.5 p-4', className)}
91
+ {...props}
92
+ />
93
+ );
94
+ }
95
+
96
+ function SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {
97
+ return (
98
+ <div
99
+ data-slot="sheet-footer"
100
+ className={cn('mt-auto flex flex-col gap-2 p-4', className)}
101
+ {...props}
102
+ />
103
+ );
104
+ }
105
+
106
+ function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
107
+ return (
108
+ <SheetPrimitive.Title
109
+ data-slot="sheet-title"
110
+ className={cn(
111
+ 'font-heading text-base font-medium text-foreground',
112
+ className,
113
+ )}
114
+ {...props}
115
+ />
116
+ );
117
+ }
118
+
119
+ function SheetDescription({
120
+ className,
121
+ ...props
122
+ }: SheetPrimitive.Description.Props) {
123
+ return (
124
+ <SheetPrimitive.Description
125
+ data-slot="sheet-description"
126
+ className={cn('text-sm text-muted-foreground', className)}
127
+ {...props}
128
+ />
129
+ );
130
+ }
131
+
132
+ export {
133
+ Sheet,
134
+ SheetTrigger,
135
+ SheetClose,
136
+ SheetContent,
137
+ SheetHeader,
138
+ SheetFooter,
139
+ SheetTitle,
140
+ SheetDescription,
141
+ };