@trycompai/design-system 1.0.0 → 1.0.1
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/package.json +2 -2
- package/src/components/atoms/index.ts +19 -0
- package/src/components/atoms/kbd.tsx +21 -0
- package/src/components/{ui → atoms}/slider.tsx +4 -4
- package/src/components/{ui → atoms}/textarea.tsx +8 -2
- package/src/components/{ui → atoms}/toggle.tsx +2 -5
- package/src/components/{ui → molecules}/breadcrumb.tsx +1 -1
- package/src/components/molecules/empty.tsx +82 -0
- package/src/components/{ui → molecules}/field.tsx +16 -37
- package/src/components/{ui → molecules}/hover-card.tsx +2 -8
- package/src/components/molecules/index.ts +26 -0
- package/src/components/{ui → molecules}/input-group.tsx +1 -1
- package/src/components/molecules/input-otp.tsx +70 -0
- package/src/components/{ui → molecules}/item.tsx +18 -36
- package/src/components/{ui → molecules}/page-header.tsx +2 -2
- package/src/components/{ui → molecules}/pagination.tsx +10 -19
- package/src/components/{ui → molecules}/radio-group.tsx +4 -8
- package/src/components/{ui → molecules}/scroll-area.tsx +8 -11
- package/src/components/{ui → molecules}/section.tsx +2 -2
- package/src/components/{ui → molecules}/select.tsx +17 -5
- package/src/components/{ui → molecules}/table.tsx +11 -2
- package/src/components/{ui → molecules}/toggle-group.tsx +1 -1
- package/src/components/organisms/alert-dialog.tsx +135 -0
- package/src/components/{ui → organisms}/calendar.tsx +2 -3
- package/src/components/{ui → organisms}/carousel.tsx +6 -8
- package/src/components/{ui → organisms}/chart.tsx +9 -24
- package/src/components/{ui → organisms}/combobox.tsx +2 -2
- package/src/components/{ui → organisms}/context-menu.tsx +19 -49
- package/src/components/{ui → organisms}/dialog.tsx +1 -1
- package/src/components/organisms/index.ts +16 -0
- package/src/components/organisms/navigation-menu.tsx +137 -0
- package/src/components/{ui → organisms}/sheet.tsx +6 -6
- package/src/components/{ui → organisms}/sidebar.tsx +42 -83
- package/src/components/{ui → organisms}/sonner.tsx +7 -9
- package/src/components/ui/index.ts +3 -61
- package/src/styles/globals.css +12 -0
- package/src/components/ui/alert-dialog.tsx +0 -161
- package/src/components/ui/empty.tsx +0 -94
- package/src/components/ui/input-otp.tsx +0 -84
- package/src/components/ui/kbd.tsx +0 -26
- package/src/components/ui/navigation-menu.tsx +0 -147
- /package/src/components/{ui → atoms}/aspect-ratio.tsx +0 -0
- /package/src/components/{ui → atoms}/avatar.tsx +0 -0
- /package/src/components/{ui → atoms}/badge.tsx +0 -0
- /package/src/components/{ui → atoms}/button.tsx +0 -0
- /package/src/components/{ui → atoms}/checkbox.tsx +0 -0
- /package/src/components/{ui → atoms}/container.tsx +0 -0
- /package/src/components/{ui → atoms}/heading.tsx +0 -0
- /package/src/components/{ui → atoms}/input.tsx +0 -0
- /package/src/components/{ui → atoms}/label.tsx +0 -0
- /package/src/components/{ui → atoms}/progress.tsx +0 -0
- /package/src/components/{ui → atoms}/separator.tsx +0 -0
- /package/src/components/{ui → atoms}/skeleton.tsx +0 -0
- /package/src/components/{ui → atoms}/spinner.tsx +0 -0
- /package/src/components/{ui → atoms}/switch.tsx +0 -0
- /package/src/components/{ui → atoms}/text.tsx +0 -0
- /package/src/components/{ui → molecules}/accordion.tsx +0 -0
- /package/src/components/{ui → molecules}/alert.tsx +0 -0
- /package/src/components/{ui → molecules}/button-group.tsx +0 -0
- /package/src/components/{ui → molecules}/card.tsx +0 -0
- /package/src/components/{ui → molecules}/collapsible.tsx +0 -0
- /package/src/components/{ui → molecules}/grid.tsx +0 -0
- /package/src/components/{ui → molecules}/popover.tsx +0 -0
- /package/src/components/{ui → molecules}/resizable.tsx +0 -0
- /package/src/components/{ui → molecules}/stack.tsx +0 -0
- /package/src/components/{ui → molecules}/tabs.tsx +0 -0
- /package/src/components/{ui → molecules}/tooltip.tsx +0 -0
- /package/src/components/{ui → organisms}/command.tsx +0 -0
- /package/src/components/{ui → organisms}/drawer.tsx +0 -0
- /package/src/components/{ui → organisms}/dropdown-menu.tsx +0 -0
- /package/src/components/{ui → organisms}/menubar.tsx +0 -0
- /package/src/components/{ui → organisms}/page-layout.tsx +0 -0
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ContextMenu as ContextMenuPrimitive } from '@base-ui/react/context-menu';
|
|
2
|
-
import * as React from 'react';
|
|
3
2
|
|
|
4
3
|
import { CheckIcon, ChevronRightIcon } from 'lucide-react';
|
|
5
|
-
import { cn } from '../../../lib/utils';
|
|
6
4
|
|
|
7
5
|
function ContextMenu({ ...props }: ContextMenuPrimitive.Root.Props) {
|
|
8
6
|
return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />;
|
|
@@ -12,24 +10,23 @@ function ContextMenuPortal({ ...props }: ContextMenuPrimitive.Portal.Props) {
|
|
|
12
10
|
return <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />;
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
function ContextMenuTrigger({
|
|
13
|
+
function ContextMenuTrigger({ ...props }: Omit<ContextMenuPrimitive.Trigger.Props, 'className'>) {
|
|
16
14
|
return (
|
|
17
15
|
<ContextMenuPrimitive.Trigger
|
|
18
16
|
data-slot="context-menu-trigger"
|
|
19
|
-
className=
|
|
17
|
+
className="select-none"
|
|
20
18
|
{...props}
|
|
21
19
|
/>
|
|
22
20
|
);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
function ContextMenuContent({
|
|
26
|
-
className,
|
|
27
24
|
align = 'start',
|
|
28
25
|
alignOffset = 4,
|
|
29
26
|
side = 'right',
|
|
30
27
|
sideOffset = 0,
|
|
31
28
|
...props
|
|
32
|
-
}: ContextMenuPrimitive.Popup.Props &
|
|
29
|
+
}: Omit<ContextMenuPrimitive.Popup.Props, 'className'> &
|
|
33
30
|
Pick<ContextMenuPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {
|
|
34
31
|
return (
|
|
35
32
|
<ContextMenuPrimitive.Portal>
|
|
@@ -42,10 +39,7 @@ function ContextMenuContent({
|
|
|
42
39
|
>
|
|
43
40
|
<ContextMenuPrimitive.Popup
|
|
44
41
|
data-slot="context-menu-content"
|
|
45
|
-
className=
|
|
46
|
-
'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 bg-popover text-popover-foreground min-w-36 rounded-md p-1 shadow-md ring-1 duration-100 z-50 max-h-(--available-height) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none',
|
|
47
|
-
className,
|
|
48
|
-
)}
|
|
42
|
+
className="data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 bg-popover text-popover-foreground min-w-36 rounded-md p-1 shadow-md ring-1 duration-100 z-50 max-h-(--available-height) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none"
|
|
49
43
|
{...props}
|
|
50
44
|
/>
|
|
51
45
|
</ContextMenuPrimitive.Positioner>
|
|
@@ -58,31 +52,26 @@ function ContextMenuGroup({ ...props }: ContextMenuPrimitive.Group.Props) {
|
|
|
58
52
|
}
|
|
59
53
|
|
|
60
54
|
function ContextMenuLabel({
|
|
61
|
-
className,
|
|
62
55
|
inset,
|
|
63
56
|
...props
|
|
64
|
-
}: ContextMenuPrimitive.GroupLabel.Props & {
|
|
57
|
+
}: Omit<ContextMenuPrimitive.GroupLabel.Props, 'className'> & {
|
|
65
58
|
inset?: boolean;
|
|
66
59
|
}) {
|
|
67
60
|
return (
|
|
68
61
|
<ContextMenuPrimitive.GroupLabel
|
|
69
62
|
data-slot="context-menu-label"
|
|
70
63
|
data-inset={inset}
|
|
71
|
-
className=
|
|
72
|
-
'text-muted-foreground px-2 py-1.5 text-xs font-medium data-[inset]:pl-8',
|
|
73
|
-
className,
|
|
74
|
-
)}
|
|
64
|
+
className="text-muted-foreground px-2 py-1.5 text-xs font-medium data-[inset]:pl-8"
|
|
75
65
|
{...props}
|
|
76
66
|
/>
|
|
77
67
|
);
|
|
78
68
|
}
|
|
79
69
|
|
|
80
70
|
function ContextMenuItem({
|
|
81
|
-
className,
|
|
82
71
|
inset,
|
|
83
72
|
variant = 'default',
|
|
84
73
|
...props
|
|
85
|
-
}: ContextMenuPrimitive.Item.Props & {
|
|
74
|
+
}: Omit<ContextMenuPrimitive.Item.Props, 'className'> & {
|
|
86
75
|
inset?: boolean;
|
|
87
76
|
variant?: 'default' | 'destructive';
|
|
88
77
|
}) {
|
|
@@ -91,10 +80,7 @@ function ContextMenuItem({
|
|
|
91
80
|
data-slot="context-menu-item"
|
|
92
81
|
data-inset={inset}
|
|
93
82
|
data-variant={variant}
|
|
94
|
-
className=
|
|
95
|
-
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive focus:*:[svg]:text-accent-foreground gap-2 rounded-sm px-2 py-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
96
|
-
className,
|
|
97
|
-
)}
|
|
83
|
+
className="focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive focus:*:[svg]:text-accent-foreground gap-2 rounded-sm px-2 py-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
98
84
|
{...props}
|
|
99
85
|
/>
|
|
100
86
|
);
|
|
@@ -105,21 +91,17 @@ function ContextMenuSub({ ...props }: ContextMenuPrimitive.SubmenuRoot.Props) {
|
|
|
105
91
|
}
|
|
106
92
|
|
|
107
93
|
function ContextMenuSubTrigger({
|
|
108
|
-
className,
|
|
109
94
|
inset,
|
|
110
95
|
children,
|
|
111
96
|
...props
|
|
112
|
-
}: ContextMenuPrimitive.SubmenuTrigger.Props & {
|
|
97
|
+
}: Omit<ContextMenuPrimitive.SubmenuTrigger.Props, 'className'> & {
|
|
113
98
|
inset?: boolean;
|
|
114
99
|
}) {
|
|
115
100
|
return (
|
|
116
101
|
<ContextMenuPrimitive.SubmenuTrigger
|
|
117
102
|
data-slot="context-menu-sub-trigger"
|
|
118
103
|
data-inset={inset}
|
|
119
|
-
className=
|
|
120
|
-
"focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground rounded-sm px-2 py-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
121
|
-
className,
|
|
122
|
-
)}
|
|
104
|
+
className="focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground rounded-sm px-2 py-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
123
105
|
{...props}
|
|
124
106
|
>
|
|
125
107
|
{children}
|
|
@@ -128,11 +110,10 @@ function ContextMenuSubTrigger({
|
|
|
128
110
|
);
|
|
129
111
|
}
|
|
130
112
|
|
|
131
|
-
function ContextMenuSubContent({ ...props }: React.ComponentProps<typeof ContextMenuContent>) {
|
|
113
|
+
function ContextMenuSubContent({ ...props }: Omit<React.ComponentProps<typeof ContextMenuContent>, 'className'>) {
|
|
132
114
|
return (
|
|
133
115
|
<ContextMenuContent
|
|
134
116
|
data-slot="context-menu-sub-content"
|
|
135
|
-
className="shadow-lg"
|
|
136
117
|
side="right"
|
|
137
118
|
{...props}
|
|
138
119
|
/>
|
|
@@ -140,18 +121,14 @@ function ContextMenuSubContent({ ...props }: React.ComponentProps<typeof Context
|
|
|
140
121
|
}
|
|
141
122
|
|
|
142
123
|
function ContextMenuCheckboxItem({
|
|
143
|
-
className,
|
|
144
124
|
children,
|
|
145
125
|
checked,
|
|
146
126
|
...props
|
|
147
|
-
}: ContextMenuPrimitive.CheckboxItem.Props) {
|
|
127
|
+
}: Omit<ContextMenuPrimitive.CheckboxItem.Props, 'className'>) {
|
|
148
128
|
return (
|
|
149
129
|
<ContextMenuPrimitive.CheckboxItem
|
|
150
130
|
data-slot="context-menu-checkbox-item"
|
|
151
|
-
className=
|
|
152
|
-
"focus:bg-accent focus:text-accent-foreground gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
153
|
-
className,
|
|
154
|
-
)}
|
|
131
|
+
className="focus:bg-accent focus:text-accent-foreground gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
155
132
|
checked={checked}
|
|
156
133
|
{...props}
|
|
157
134
|
>
|
|
@@ -170,17 +147,13 @@ function ContextMenuRadioGroup({ ...props }: ContextMenuPrimitive.RadioGroup.Pro
|
|
|
170
147
|
}
|
|
171
148
|
|
|
172
149
|
function ContextMenuRadioItem({
|
|
173
|
-
className,
|
|
174
150
|
children,
|
|
175
151
|
...props
|
|
176
|
-
}: ContextMenuPrimitive.RadioItem.Props) {
|
|
152
|
+
}: Omit<ContextMenuPrimitive.RadioItem.Props, 'className'>) {
|
|
177
153
|
return (
|
|
178
154
|
<ContextMenuPrimitive.RadioItem
|
|
179
155
|
data-slot="context-menu-radio-item"
|
|
180
|
-
className=
|
|
181
|
-
"focus:bg-accent focus:text-accent-foreground gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
182
|
-
className,
|
|
183
|
-
)}
|
|
156
|
+
className="focus:bg-accent focus:text-accent-foreground gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
184
157
|
{...props}
|
|
185
158
|
>
|
|
186
159
|
<span className="absolute right-2 pointer-events-none">
|
|
@@ -193,24 +166,21 @@ function ContextMenuRadioItem({
|
|
|
193
166
|
);
|
|
194
167
|
}
|
|
195
168
|
|
|
196
|
-
function ContextMenuSeparator({
|
|
169
|
+
function ContextMenuSeparator({ ...props }: Omit<ContextMenuPrimitive.Separator.Props, 'className'>) {
|
|
197
170
|
return (
|
|
198
171
|
<ContextMenuPrimitive.Separator
|
|
199
172
|
data-slot="context-menu-separator"
|
|
200
|
-
className=
|
|
173
|
+
className="bg-border -mx-1 my-1 h-px"
|
|
201
174
|
{...props}
|
|
202
175
|
/>
|
|
203
176
|
);
|
|
204
177
|
}
|
|
205
178
|
|
|
206
|
-
function ContextMenuShortcut({
|
|
179
|
+
function ContextMenuShortcut({ ...props }: Omit<React.ComponentProps<'span'>, 'className'>) {
|
|
207
180
|
return (
|
|
208
181
|
<span
|
|
209
182
|
data-slot="context-menu-shortcut"
|
|
210
|
-
className=
|
|
211
|
-
'text-muted-foreground group-focus/context-menu-item:text-accent-foreground ml-auto text-xs tracking-widest',
|
|
212
|
-
className,
|
|
213
|
-
)}
|
|
183
|
+
className="text-muted-foreground group-focus/context-menu-item:text-accent-foreground ml-auto text-xs tracking-widest"
|
|
214
184
|
{...props}
|
|
215
185
|
/>
|
|
216
186
|
);
|
|
@@ -4,7 +4,7 @@ import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
|
|
6
6
|
import { XIcon } from 'lucide-react';
|
|
7
|
-
import { Button } from '
|
|
7
|
+
import { Button } from '../atoms/button';
|
|
8
8
|
|
|
9
9
|
function Dialog({ ...props }: DialogPrimitive.Root.Props) {
|
|
10
10
|
return <DialogPrimitive.Root data-slot="dialog" {...props} />;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './alert-dialog';
|
|
2
|
+
export * from './calendar';
|
|
3
|
+
export * from './carousel';
|
|
4
|
+
export * from './chart';
|
|
5
|
+
export * from './combobox';
|
|
6
|
+
export * from './command';
|
|
7
|
+
export * from './context-menu';
|
|
8
|
+
export * from './dialog';
|
|
9
|
+
export * from './drawer';
|
|
10
|
+
export * from './dropdown-menu';
|
|
11
|
+
export * from './menubar';
|
|
12
|
+
export * from './navigation-menu';
|
|
13
|
+
export * from './page-layout';
|
|
14
|
+
export * from './sheet';
|
|
15
|
+
export * from './sidebar';
|
|
16
|
+
export * from './sonner';
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { NavigationMenu as NavigationMenuPrimitive } from '@base-ui/react/navigation-menu';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
|
|
4
|
+
import { ChevronDownIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from '../../../lib/utils';
|
|
6
|
+
|
|
7
|
+
function NavigationMenu({
|
|
8
|
+
children,
|
|
9
|
+
...props
|
|
10
|
+
}: Omit<NavigationMenuPrimitive.Root.Props, 'className'>) {
|
|
11
|
+
return (
|
|
12
|
+
<NavigationMenuPrimitive.Root
|
|
13
|
+
data-slot="navigation-menu"
|
|
14
|
+
className="max-w-max group/navigation-menu relative flex max-w-max flex-1 items-center justify-center"
|
|
15
|
+
{...props}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
<NavigationMenuPositioner />
|
|
19
|
+
</NavigationMenuPrimitive.Root>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function NavigationMenuList({ ...props }: Omit<NavigationMenuPrimitive.List.Props, 'className'>) {
|
|
24
|
+
return (
|
|
25
|
+
<NavigationMenuPrimitive.List
|
|
26
|
+
data-slot="navigation-menu-list"
|
|
27
|
+
className="gap-0 group flex flex-1 list-none items-center justify-center"
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function NavigationMenuItem({ ...props }: Omit<NavigationMenuPrimitive.Item.Props, 'className'>) {
|
|
34
|
+
return (
|
|
35
|
+
<NavigationMenuPrimitive.Item
|
|
36
|
+
data-slot="navigation-menu-item"
|
|
37
|
+
className="relative"
|
|
38
|
+
{...props}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const navigationMenuTriggerStyle = cva(
|
|
44
|
+
'bg-background hover:bg-muted focus:bg-muted data-open:hover:bg-muted data-open:focus:bg-muted data-open:bg-muted/50 focus-visible:ring-ring/50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted rounded-md px-4 py-2 text-sm font-medium transition-all focus-visible:ring-[3px] focus-visible:outline-1 disabled:opacity-50 group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center disabled:pointer-events-none outline-none',
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
function NavigationMenuTrigger({
|
|
48
|
+
children,
|
|
49
|
+
...props
|
|
50
|
+
}: Omit<NavigationMenuPrimitive.Trigger.Props, 'className'>) {
|
|
51
|
+
return (
|
|
52
|
+
<NavigationMenuPrimitive.Trigger
|
|
53
|
+
data-slot="navigation-menu-trigger"
|
|
54
|
+
className={cn(navigationMenuTriggerStyle(), 'group')}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
{children}{' '}
|
|
58
|
+
<ChevronDownIcon
|
|
59
|
+
className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-open/navigation-menu-trigger:rotate-180 group-data-popup-open/navigation-menu-trigger:rotate-180"
|
|
60
|
+
aria-hidden="true"
|
|
61
|
+
/>
|
|
62
|
+
</NavigationMenuPrimitive.Trigger>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function NavigationMenuContent({
|
|
67
|
+
...props
|
|
68
|
+
}: Omit<NavigationMenuPrimitive.Content.Props, 'className'>) {
|
|
69
|
+
return (
|
|
70
|
+
<NavigationMenuPrimitive.Content
|
|
71
|
+
data-slot="navigation-menu-content"
|
|
72
|
+
className="data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:ring-foreground/10 p-2 pr-2.5 ease-[cubic-bezier(0.22,1,0.36,1)] group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:ring-1 group-data-[viewport=false]/navigation-menu:duration-300 h-full w-auto **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none"
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function NavigationMenuPositioner({
|
|
79
|
+
side = 'bottom',
|
|
80
|
+
sideOffset = 8,
|
|
81
|
+
align = 'start',
|
|
82
|
+
alignOffset = 0,
|
|
83
|
+
...props
|
|
84
|
+
}: Omit<NavigationMenuPrimitive.Positioner.Props, 'className'>) {
|
|
85
|
+
return (
|
|
86
|
+
<NavigationMenuPrimitive.Portal>
|
|
87
|
+
<NavigationMenuPrimitive.Positioner
|
|
88
|
+
side={side}
|
|
89
|
+
sideOffset={sideOffset}
|
|
90
|
+
align={align}
|
|
91
|
+
alignOffset={alignOffset}
|
|
92
|
+
className="transition-[top,left,right,bottom] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] data-[side=bottom]:before:top-[-10px] data-[side=bottom]:before:right-0 data-[side=bottom]:before:left-0 isolate z-50 h-[var(--positioner-height)] w-[var(--positioner-width)] max-w-[var(--available-width)] data-[instant]:transition-none"
|
|
93
|
+
{...props}
|
|
94
|
+
>
|
|
95
|
+
<NavigationMenuPrimitive.Popup className="bg-popover text-popover-foreground ring-foreground/10 rounded-lg shadow ring-1 transition-all ease-[cubic-bezier(0.22,1,0.36,1)] outline-none data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[ending-style]:duration-150 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 xs:w-(--popup-width) relative h-(--popup-height) w-(--popup-width) origin-(--transform-origin)">
|
|
96
|
+
<NavigationMenuPrimitive.Viewport className="relative size-full overflow-hidden" />
|
|
97
|
+
</NavigationMenuPrimitive.Popup>
|
|
98
|
+
</NavigationMenuPrimitive.Positioner>
|
|
99
|
+
</NavigationMenuPrimitive.Portal>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function NavigationMenuLink({ ...props }: Omit<NavigationMenuPrimitive.Link.Props, 'className'>) {
|
|
104
|
+
return (
|
|
105
|
+
<NavigationMenuPrimitive.Link
|
|
106
|
+
data-slot="navigation-menu-link"
|
|
107
|
+
className="data-[active=true]:focus:bg-muted data-[active=true]:hover:bg-muted data-[active=true]:bg-muted/50 focus-visible:ring-ring/50 hover:bg-muted focus:bg-muted flex items-center gap-1.5 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4"
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function NavigationMenuIndicator({
|
|
114
|
+
...props
|
|
115
|
+
}: Omit<NavigationMenuPrimitive.Icon.Props, 'className'>) {
|
|
116
|
+
return (
|
|
117
|
+
<NavigationMenuPrimitive.Icon
|
|
118
|
+
data-slot="navigation-menu-indicator"
|
|
119
|
+
className="data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden"
|
|
120
|
+
{...props}
|
|
121
|
+
>
|
|
122
|
+
<div className="bg-border rounded-tl-sm shadow-md relative top-[60%] h-2 w-2 rotate-45" />
|
|
123
|
+
</NavigationMenuPrimitive.Icon>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export {
|
|
128
|
+
NavigationMenu,
|
|
129
|
+
NavigationMenuContent,
|
|
130
|
+
NavigationMenuIndicator,
|
|
131
|
+
NavigationMenuItem,
|
|
132
|
+
NavigationMenuLink,
|
|
133
|
+
NavigationMenuList,
|
|
134
|
+
NavigationMenuPositioner,
|
|
135
|
+
NavigationMenuTrigger,
|
|
136
|
+
navigationMenuTriggerStyle,
|
|
137
|
+
};
|
|
@@ -2,7 +2,7 @@ import { Dialog as SheetPrimitive } from '@base-ui/react/dialog';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
import { XIcon } from 'lucide-react';
|
|
5
|
-
import { Button } from '
|
|
5
|
+
import { Button } from '../atoms/button';
|
|
6
6
|
|
|
7
7
|
function Sheet({ ...props }: SheetPrimitive.Root.Props) {
|
|
8
8
|
return <SheetPrimitive.Root data-slot="sheet" {...props} />;
|
|
@@ -45,7 +45,7 @@ function SheetContent({
|
|
|
45
45
|
<SheetPrimitive.Popup
|
|
46
46
|
data-slot="sheet-content"
|
|
47
47
|
data-side={side}
|
|
48
|
-
className="bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t 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=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=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm"
|
|
48
|
+
className="bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col gap-4 px-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t 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=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=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm"
|
|
49
49
|
{...props}
|
|
50
50
|
>
|
|
51
51
|
{children}
|
|
@@ -53,9 +53,9 @@ function SheetContent({
|
|
|
53
53
|
<SheetPrimitive.Close
|
|
54
54
|
data-slot="sheet-close"
|
|
55
55
|
render={<Button variant="ghost" size="icon-sm" />}
|
|
56
|
-
className="absolute top-
|
|
56
|
+
className="absolute top-4 right-4"
|
|
57
57
|
>
|
|
58
|
-
<XIcon />
|
|
58
|
+
<XIcon className="size-4" />
|
|
59
59
|
<span className="sr-only">Close</span>
|
|
60
60
|
</SheetPrimitive.Close>
|
|
61
61
|
)}
|
|
@@ -65,11 +65,11 @@ function SheetContent({
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
function SheetHeader({ ...props }: Omit<React.ComponentProps<'div'>, 'className'>) {
|
|
68
|
-
return <div data-slot="sheet-header" className="gap-0.5
|
|
68
|
+
return <div data-slot="sheet-header" className="gap-0.5 pt-4 flex flex-col" {...props} />;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
function SheetFooter({ ...props }: Omit<React.ComponentProps<'div'>, 'className'>) {
|
|
72
|
-
return <div data-slot="sheet-footer" className="gap-2
|
|
72
|
+
return <div data-slot="sheet-footer" className="gap-2 pb-4 mt-auto flex flex-col" {...props} />;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
function SheetTitle({ ...props }: Omit<SheetPrimitive.Title.Props, 'className'>) {
|