startx 0.1.5 → 0.2.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 (67) hide show
  1. package/.editorconfig +20 -20
  2. package/.github/workflows/publish.yml +48 -0
  3. package/LICENSE +21 -21
  4. package/configs/eslint-config/plugins.d.ts +1 -1
  5. package/configs/eslint-config/src/rules/no-argument-spread.ts +96 -96
  6. package/configs/eslint-config/src/rules/no-internal-package-import.ts +40 -40
  7. package/configs/eslint-config/src/rules/no-interpolation-in-regular-string.ts +32 -32
  8. package/configs/eslint-config/src/rules/no-skipped-tests.ts +61 -61
  9. package/configs/eslint-config/src/rules/no-top-level-relative-imports-in-backend-module.ts +27 -27
  10. package/configs/eslint-config/src/rules/no-type-unsafe-event-emitter.ts +33 -33
  11. package/configs/eslint-config/src/rules/no-uncaught-json-parse.test.ts +21 -21
  12. package/configs/eslint-config/src/rules/no-untyped-config-class-field.ts +26 -26
  13. package/configs/eslint-config/src/rules/no-unused-param-catch-clause.ts +33 -33
  14. package/configs/eslint-config/src/rules/no-useless-catch-throw.test.ts +34 -34
  15. package/configs/eslint-config/src/rules/no-useless-catch-throw.ts +47 -47
  16. package/configs/eslint-config/src/utils/json.ts +21 -21
  17. package/package.json +34 -35
  18. package/packages/@repo/constants/src/api.ts +1 -1
  19. package/packages/@repo/constants/src/time.ts +23 -23
  20. package/packages/@repo/db/src/schema/index.ts +1 -1
  21. package/packages/@repo/lib/src/error-handlers-module/index.ts +11 -11
  22. package/packages/cli/dist/index.mjs +2 -2
  23. package/packages/cli/tsdown.config.ts +1 -0
  24. package/packages/ui/src/components/custom/grid-component.tsx +23 -23
  25. package/packages/ui/src/components/custom/hover-tool.tsx +38 -38
  26. package/packages/ui/src/components/custom/image-picker.tsx +109 -109
  27. package/packages/ui/src/components/custom/no-content.tsx +37 -37
  28. package/packages/ui/src/components/custom/page-container.tsx +24 -24
  29. package/packages/ui/src/components/custom/simple-popover.tsx +29 -29
  30. package/packages/ui/src/components/custom/switch-component.tsx +20 -20
  31. package/packages/ui/src/components/custom/theme-provider.tsx +74 -74
  32. package/packages/ui/src/components/hooks/event/use-click.tsx +39 -39
  33. package/packages/ui/src/components/hooks/time/useDebounce.tsx +21 -21
  34. package/packages/ui/src/components/hooks/time/useInterval.tsx +35 -35
  35. package/packages/ui/src/components/hooks/time/useTimeout.tsx +19 -19
  36. package/packages/ui/src/components/hooks/time/useTimer.tsx +51 -51
  37. package/packages/ui/src/components/hooks/use-media-query.tsx +19 -19
  38. package/packages/ui/src/components/hooks/use-persistent-storage.tsx +52 -52
  39. package/packages/ui/src/components/hooks/use-window-dimension.tsx +30 -30
  40. package/packages/ui/src/components/sonner.tsx +1 -1
  41. package/packages/ui/src/components/ui/button.tsx +96 -96
  42. package/packages/ui/src/components/ui/dropdown-menu.tsx +226 -226
  43. package/packages/ui/src/components/ui/label.tsx +24 -24
  44. package/packages/ui/src/components/ui/popover.tsx +42 -42
  45. package/packages/ui/src/components/ui/select.tsx +170 -170
  46. package/packages/ui/src/components/ui/separator.tsx +28 -28
  47. package/packages/ui/src/components/ui/sheet.tsx +130 -130
  48. package/packages/ui/src/components/ui/skeleton.tsx +13 -13
  49. package/packages/ui/src/components/ui/spinner.tsx +16 -16
  50. package/packages/ui/src/components/ui/switch.tsx +28 -28
  51. package/packages/ui/src/components/ui/tabs.tsx +54 -54
  52. package/packages/ui/src/components/ui/tooltip.tsx +30 -30
  53. package/packages/ui/src/components/util/n-formattor.ts +22 -22
  54. package/packages/ui/src/components/util/storage.ts +37 -37
  55. package/packages/ui/src/globals.css +87 -87
  56. package/configs/vitest-config/dist/base.mjs +0 -1
  57. package/configs/vitest-config/dist/frontend.mjs +0 -1
  58. package/configs/vitest-config/dist/node.mjs +0 -1
  59. package/packages/@repo/redis/dist/index.d.mts +0 -3
  60. package/packages/@repo/redis/dist/index.mjs +0 -5
  61. package/packages/@repo/redis/dist/lib/redis-client.d.mts +0 -7
  62. package/packages/@repo/redis/dist/lib/redis-client.mjs +0 -25
  63. package/packages/@repo/redis/dist/lib/redis-client.mjs.map +0 -1
  64. package/packages/@repo/redis/dist/lib/redis-module.d.mts +0 -5
  65. package/packages/@repo/redis/dist/lib/redis-module.mjs +0 -6
  66. package/packages/@repo/redis/dist/lib/redis-module.mjs.map +0 -1
  67. /package/{apps/core-server/.env.example → .env.example} +0 -0
@@ -1,170 +1,170 @@
1
- "use client";
2
-
3
- import * as SelectPrimitive from "@radix-ui/react-select";
4
- import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
5
- import type * as React from "react";
6
-
7
- import { cn } from "../lib/utils";
8
-
9
- function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
10
- return <SelectPrimitive.Root data-slot="select" {...props} />;
11
- }
12
-
13
- function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
14
- return <SelectPrimitive.Group data-slot="select-group" {...props} />;
15
- }
16
-
17
- function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
18
- return <SelectPrimitive.Value data-slot="select-value" {...props} />;
19
- }
20
-
21
- function SelectTrigger({
22
- className,
23
- size = "default",
24
- children,
25
- ...props
26
- }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
27
- size?: "sm" | "default";
28
- }) {
29
- return (
30
- <SelectPrimitive.Trigger
31
- data-slot="select-trigger"
32
- data-size={size}
33
- className={cn(
34
- "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
35
- className
36
- )}
37
- {...props}
38
- >
39
- {children}
40
- <SelectPrimitive.Icon asChild>
41
- <ChevronDownIcon className="size-4 opacity-50" />
42
- </SelectPrimitive.Icon>
43
- </SelectPrimitive.Trigger>
44
- );
45
- }
46
-
47
- function SelectContent({
48
- className,
49
- children,
50
- position = "popper",
51
- ...props
52
- }: React.ComponentProps<typeof SelectPrimitive.Content>) {
53
- return (
54
- <SelectPrimitive.Portal>
55
- <SelectPrimitive.Content
56
- data-slot="select-content"
57
- className={cn(
58
- "bg-popover text-popover-foreground 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
59
- position === "popper" &&
60
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
61
- className
62
- )}
63
- position={position}
64
- {...props}
65
- >
66
- <SelectScrollUpButton />
67
- <SelectPrimitive.Viewport
68
- className={cn(
69
- "p-1",
70
- position === "popper" &&
71
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
72
- )}
73
- >
74
- {children}
75
- </SelectPrimitive.Viewport>
76
- <SelectScrollDownButton />
77
- </SelectPrimitive.Content>
78
- </SelectPrimitive.Portal>
79
- );
80
- }
81
-
82
- function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
83
- return (
84
- <SelectPrimitive.Label
85
- data-slot="select-label"
86
- className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
87
- {...props}
88
- />
89
- );
90
- }
91
-
92
- function SelectItem({
93
- className,
94
- children,
95
- ...props
96
- }: React.ComponentProps<typeof SelectPrimitive.Item>) {
97
- return (
98
- <SelectPrimitive.Item
99
- data-slot="select-item"
100
- className={cn(
101
- "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none 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",
102
- className
103
- )}
104
- {...props}
105
- >
106
- <span className="absolute right-2 flex size-3.5 items-center justify-center">
107
- <SelectPrimitive.ItemIndicator>
108
- <CheckIcon className="size-4" />
109
- </SelectPrimitive.ItemIndicator>
110
- </span>
111
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
112
- </SelectPrimitive.Item>
113
- );
114
- }
115
-
116
- function SelectSeparator({
117
- className,
118
- ...props
119
- }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
120
- return (
121
- <SelectPrimitive.Separator
122
- data-slot="select-separator"
123
- className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
124
- {...props}
125
- />
126
- );
127
- }
128
-
129
- function SelectScrollUpButton({
130
- className,
131
- ...props
132
- }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
133
- return (
134
- <SelectPrimitive.ScrollUpButton
135
- data-slot="select-scroll-up-button"
136
- className={cn("flex cursor-default items-center justify-center py-1", className)}
137
- {...props}
138
- >
139
- <ChevronUpIcon className="size-4" />
140
- </SelectPrimitive.ScrollUpButton>
141
- );
142
- }
143
-
144
- function SelectScrollDownButton({
145
- className,
146
- ...props
147
- }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
148
- return (
149
- <SelectPrimitive.ScrollDownButton
150
- data-slot="select-scroll-down-button"
151
- className={cn("flex cursor-default items-center justify-center py-1", className)}
152
- {...props}
153
- >
154
- <ChevronDownIcon className="size-4" />
155
- </SelectPrimitive.ScrollDownButton>
156
- );
157
- }
158
-
159
- export {
160
- Select,
161
- SelectContent,
162
- SelectGroup,
163
- SelectItem,
164
- SelectLabel,
165
- SelectScrollDownButton,
166
- SelectScrollUpButton,
167
- SelectSeparator,
168
- SelectTrigger,
169
- SelectValue,
170
- };
1
+ "use client";
2
+
3
+ import * as SelectPrimitive from "@radix-ui/react-select";
4
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
5
+ import type * as React from "react";
6
+
7
+ import { cn } from "../lib/utils";
8
+
9
+ function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
10
+ return <SelectPrimitive.Root data-slot="select" {...props} />;
11
+ }
12
+
13
+ function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
14
+ return <SelectPrimitive.Group data-slot="select-group" {...props} />;
15
+ }
16
+
17
+ function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
18
+ return <SelectPrimitive.Value data-slot="select-value" {...props} />;
19
+ }
20
+
21
+ function SelectTrigger({
22
+ className,
23
+ size = "default",
24
+ children,
25
+ ...props
26
+ }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
27
+ size?: "sm" | "default";
28
+ }) {
29
+ return (
30
+ <SelectPrimitive.Trigger
31
+ data-slot="select-trigger"
32
+ data-size={size}
33
+ className={cn(
34
+ "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
35
+ className
36
+ )}
37
+ {...props}
38
+ >
39
+ {children}
40
+ <SelectPrimitive.Icon asChild>
41
+ <ChevronDownIcon className="size-4 opacity-50" />
42
+ </SelectPrimitive.Icon>
43
+ </SelectPrimitive.Trigger>
44
+ );
45
+ }
46
+
47
+ function SelectContent({
48
+ className,
49
+ children,
50
+ position = "popper",
51
+ ...props
52
+ }: React.ComponentProps<typeof SelectPrimitive.Content>) {
53
+ return (
54
+ <SelectPrimitive.Portal>
55
+ <SelectPrimitive.Content
56
+ data-slot="select-content"
57
+ className={cn(
58
+ "bg-popover text-popover-foreground 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
59
+ position === "popper" &&
60
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
61
+ className
62
+ )}
63
+ position={position}
64
+ {...props}
65
+ >
66
+ <SelectScrollUpButton />
67
+ <SelectPrimitive.Viewport
68
+ className={cn(
69
+ "p-1",
70
+ position === "popper" &&
71
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
72
+ )}
73
+ >
74
+ {children}
75
+ </SelectPrimitive.Viewport>
76
+ <SelectScrollDownButton />
77
+ </SelectPrimitive.Content>
78
+ </SelectPrimitive.Portal>
79
+ );
80
+ }
81
+
82
+ function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
83
+ return (
84
+ <SelectPrimitive.Label
85
+ data-slot="select-label"
86
+ className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
87
+ {...props}
88
+ />
89
+ );
90
+ }
91
+
92
+ function SelectItem({
93
+ className,
94
+ children,
95
+ ...props
96
+ }: React.ComponentProps<typeof SelectPrimitive.Item>) {
97
+ return (
98
+ <SelectPrimitive.Item
99
+ data-slot="select-item"
100
+ className={cn(
101
+ "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none 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",
102
+ className
103
+ )}
104
+ {...props}
105
+ >
106
+ <span className="absolute right-2 flex size-3.5 items-center justify-center">
107
+ <SelectPrimitive.ItemIndicator>
108
+ <CheckIcon className="size-4" />
109
+ </SelectPrimitive.ItemIndicator>
110
+ </span>
111
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
112
+ </SelectPrimitive.Item>
113
+ );
114
+ }
115
+
116
+ function SelectSeparator({
117
+ className,
118
+ ...props
119
+ }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
120
+ return (
121
+ <SelectPrimitive.Separator
122
+ data-slot="select-separator"
123
+ className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
124
+ {...props}
125
+ />
126
+ );
127
+ }
128
+
129
+ function SelectScrollUpButton({
130
+ className,
131
+ ...props
132
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
133
+ return (
134
+ <SelectPrimitive.ScrollUpButton
135
+ data-slot="select-scroll-up-button"
136
+ className={cn("flex cursor-default items-center justify-center py-1", className)}
137
+ {...props}
138
+ >
139
+ <ChevronUpIcon className="size-4" />
140
+ </SelectPrimitive.ScrollUpButton>
141
+ );
142
+ }
143
+
144
+ function SelectScrollDownButton({
145
+ className,
146
+ ...props
147
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
148
+ return (
149
+ <SelectPrimitive.ScrollDownButton
150
+ data-slot="select-scroll-down-button"
151
+ className={cn("flex cursor-default items-center justify-center py-1", className)}
152
+ {...props}
153
+ >
154
+ <ChevronDownIcon className="size-4" />
155
+ </SelectPrimitive.ScrollDownButton>
156
+ );
157
+ }
158
+
159
+ export {
160
+ Select,
161
+ SelectContent,
162
+ SelectGroup,
163
+ SelectItem,
164
+ SelectLabel,
165
+ SelectScrollDownButton,
166
+ SelectScrollUpButton,
167
+ SelectSeparator,
168
+ SelectTrigger,
169
+ SelectValue,
170
+ };
@@ -1,28 +1,28 @@
1
- 'use client';
2
-
3
- import * as SeparatorPrimitive from '@radix-ui/react-separator';
4
- import type * as React from 'react';
5
-
6
- import { cn } from '../lib/utils';
7
-
8
- function Separator({
9
- className,
10
- orientation = 'horizontal',
11
- decorative = true,
12
- ...props
13
- }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
14
- return (
15
- <SeparatorPrimitive.Root
16
- data-slot="separator-root"
17
- decorative={decorative}
18
- orientation={orientation}
19
- className={cn(
20
- 'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
21
- className,
22
- )}
23
- {...props}
24
- />
25
- );
26
- }
27
-
28
- export { Separator };
1
+ 'use client';
2
+
3
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
4
+ import type * as React from 'react';
5
+
6
+ import { cn } from '../lib/utils';
7
+
8
+ function Separator({
9
+ className,
10
+ orientation = 'horizontal',
11
+ decorative = true,
12
+ ...props
13
+ }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
14
+ return (
15
+ <SeparatorPrimitive.Root
16
+ data-slot="separator-root"
17
+ decorative={decorative}
18
+ orientation={orientation}
19
+ className={cn(
20
+ 'bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
21
+ className,
22
+ )}
23
+ {...props}
24
+ />
25
+ );
26
+ }
27
+
28
+ export { Separator };
@@ -1,130 +1,130 @@
1
- 'use client';
2
-
3
- import * as SheetPrimitive from '@radix-ui/react-dialog';
4
- import { XIcon } from 'lucide-react';
5
- import type * as React from 'react';
6
-
7
- import { cn } from '../lib/utils';
8
-
9
- function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
10
- return <SheetPrimitive.Root data-slot="sheet" {...props} />;
11
- }
12
-
13
- function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
14
- return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
15
- }
16
-
17
- function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>) {
18
- return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
19
- }
20
-
21
- function SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
22
- return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
23
- }
24
-
25
- function SheetOverlay({
26
- className,
27
- ...props
28
- }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
29
- return (
30
- <SheetPrimitive.Overlay
31
- data-slot="sheet-overlay"
32
- className={cn(
33
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
34
- className,
35
- )}
36
- {...props}
37
- />
38
- );
39
- }
40
-
41
- function SheetContent({
42
- className,
43
- children,
44
- side = 'right',
45
- ...props
46
- }: React.ComponentProps<typeof SheetPrimitive.Content> & {
47
- side?: 'top' | 'right' | 'bottom' | 'left';
48
- }) {
49
- return (
50
- <SheetPortal>
51
- <SheetOverlay />
52
- <SheetPrimitive.Content
53
- data-slot="sheet-content"
54
- className={cn(
55
- 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
56
- side === 'right' &&
57
- 'data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm',
58
- side === 'left' &&
59
- 'data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm',
60
- side === 'top' &&
61
- 'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',
62
- side === 'bottom' &&
63
- 'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
64
- className,
65
- )}
66
- {...props}
67
- >
68
- {children}
69
- <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
70
- <XIcon className="size-4" />
71
- <span className="sr-only">Close</span>
72
- </SheetPrimitive.Close>
73
- </SheetPrimitive.Content>
74
- </SheetPortal>
75
- );
76
- }
77
-
78
- function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
79
- return (
80
- <div
81
- data-slot="sheet-header"
82
- className={cn('flex flex-col gap-1.5 p-4', className)}
83
- {...props}
84
- />
85
- );
86
- }
87
-
88
- function SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {
89
- return (
90
- <div
91
- data-slot="sheet-footer"
92
- className={cn('mt-auto flex flex-col gap-2 p-4', className)}
93
- {...props}
94
- />
95
- );
96
- }
97
-
98
- function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {
99
- return (
100
- <SheetPrimitive.Title
101
- data-slot="sheet-title"
102
- className={cn('text-foreground font-semibold', className)}
103
- {...props}
104
- />
105
- );
106
- }
107
-
108
- function SheetDescription({
109
- className,
110
- ...props
111
- }: React.ComponentProps<typeof SheetPrimitive.Description>) {
112
- return (
113
- <SheetPrimitive.Description
114
- data-slot="sheet-description"
115
- className={cn('text-muted-foreground text-sm', className)}
116
- {...props}
117
- />
118
- );
119
- }
120
-
121
- export {
122
- Sheet,
123
- SheetTrigger,
124
- SheetClose,
125
- SheetContent,
126
- SheetHeader,
127
- SheetFooter,
128
- SheetTitle,
129
- SheetDescription,
130
- };
1
+ 'use client';
2
+
3
+ import * as SheetPrimitive from '@radix-ui/react-dialog';
4
+ import { XIcon } from 'lucide-react';
5
+ import type * as React from 'react';
6
+
7
+ import { cn } from '../lib/utils';
8
+
9
+ function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
10
+ return <SheetPrimitive.Root data-slot="sheet" {...props} />;
11
+ }
12
+
13
+ function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
14
+ return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
15
+ }
16
+
17
+ function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>) {
18
+ return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
19
+ }
20
+
21
+ function SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
22
+ return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
23
+ }
24
+
25
+ function SheetOverlay({
26
+ className,
27
+ ...props
28
+ }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
29
+ return (
30
+ <SheetPrimitive.Overlay
31
+ data-slot="sheet-overlay"
32
+ className={cn(
33
+ 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
34
+ className,
35
+ )}
36
+ {...props}
37
+ />
38
+ );
39
+ }
40
+
41
+ function SheetContent({
42
+ className,
43
+ children,
44
+ side = 'right',
45
+ ...props
46
+ }: React.ComponentProps<typeof SheetPrimitive.Content> & {
47
+ side?: 'top' | 'right' | 'bottom' | 'left';
48
+ }) {
49
+ return (
50
+ <SheetPortal>
51
+ <SheetOverlay />
52
+ <SheetPrimitive.Content
53
+ data-slot="sheet-content"
54
+ className={cn(
55
+ 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
56
+ side === 'right' &&
57
+ 'data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm',
58
+ side === 'left' &&
59
+ 'data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm',
60
+ side === 'top' &&
61
+ 'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',
62
+ side === 'bottom' &&
63
+ 'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
64
+ className,
65
+ )}
66
+ {...props}
67
+ >
68
+ {children}
69
+ <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
70
+ <XIcon className="size-4" />
71
+ <span className="sr-only">Close</span>
72
+ </SheetPrimitive.Close>
73
+ </SheetPrimitive.Content>
74
+ </SheetPortal>
75
+ );
76
+ }
77
+
78
+ function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
79
+ return (
80
+ <div
81
+ data-slot="sheet-header"
82
+ className={cn('flex flex-col gap-1.5 p-4', className)}
83
+ {...props}
84
+ />
85
+ );
86
+ }
87
+
88
+ function SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {
89
+ return (
90
+ <div
91
+ data-slot="sheet-footer"
92
+ className={cn('mt-auto flex flex-col gap-2 p-4', className)}
93
+ {...props}
94
+ />
95
+ );
96
+ }
97
+
98
+ function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {
99
+ return (
100
+ <SheetPrimitive.Title
101
+ data-slot="sheet-title"
102
+ className={cn('text-foreground font-semibold', className)}
103
+ {...props}
104
+ />
105
+ );
106
+ }
107
+
108
+ function SheetDescription({
109
+ className,
110
+ ...props
111
+ }: React.ComponentProps<typeof SheetPrimitive.Description>) {
112
+ return (
113
+ <SheetPrimitive.Description
114
+ data-slot="sheet-description"
115
+ className={cn('text-muted-foreground text-sm', className)}
116
+ {...props}
117
+ />
118
+ );
119
+ }
120
+
121
+ export {
122
+ Sheet,
123
+ SheetTrigger,
124
+ SheetClose,
125
+ SheetContent,
126
+ SheetHeader,
127
+ SheetFooter,
128
+ SheetTitle,
129
+ SheetDescription,
130
+ };