@mzc-fe/design-system 0.0.1 → 0.0.2-rc.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.
- package/dist/components/accordion.d.ts +7 -0
- package/dist/components/alert-dialog.d.ts +14 -0
- package/dist/components/alert.d.ts +9 -0
- package/dist/components/aspect-ratio.d.ts +3 -0
- package/dist/components/avatar.d.ts +6 -0
- package/dist/components/badge.d.ts +9 -0
- package/dist/components/breadcrumb.d.ts +11 -0
- package/dist/components/button-group.d.ts +11 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/calendar.d.ts +8 -0
- package/dist/components/card.d.ts +9 -0
- package/dist/components/carousel.d.ts +19 -0
- package/dist/components/chart.d.ts +40 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/collapsible.d.ts +5 -0
- package/dist/components/command.d.ts +18 -0
- package/dist/components/context-menu.d.ts +25 -0
- package/dist/components/dialog.d.ts +15 -0
- package/dist/components/drawer.d.ts +13 -0
- package/dist/components/dropdown-menu.d.ts +25 -0
- package/dist/components/empty.d.ts +11 -0
- package/dist/components/field.d.ts +24 -0
- package/dist/components/form.d.ts +24 -0
- package/dist/components/hover-card.d.ts +6 -0
- package/dist/components/input-group.d.ts +16 -0
- package/dist/components/input-otp.d.ts +11 -0
- package/dist/components/input.d.ts +3 -0
- package/dist/components/item.d.ts +23 -0
- package/dist/components/kbd.d.ts +3 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/menubar.d.ts +26 -0
- package/dist/components/navigation-menu.d.ts +14 -0
- package/dist/components/pagination.d.ts +13 -0
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/progress.d.ts +4 -0
- package/dist/components/radio-group.d.ts +5 -0
- package/dist/components/resizable.d.ts +8 -0
- package/dist/components/scroll-area.d.ts +5 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/separator.d.ts +4 -0
- package/dist/components/sheet.d.ts +13 -0
- package/dist/components/sidebar.d.ts +69 -0
- package/dist/components/skeleton.d.ts +2 -0
- package/dist/components/slider.d.ts +4 -0
- package/dist/components/sonner.d.ts +3 -0
- package/dist/components/spinner.d.ts +2 -0
- package/dist/components/switch.d.ts +4 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/tabs.d.ts +7 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/toggle-group.d.ts +9 -0
- package/dist/components/toggle.d.ts +9 -0
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/design-system.css +1 -0
- package/dist/design-system.es.js +30200 -0
- package/dist/design-system.umd.js +260 -0
- package/dist/foundations/ThemeProvider.d.ts +13 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/lib/utils.d.ts +2 -0
- package/package.json +14 -1
- package/.husky/pre-push +0 -21
- package/.storybook/main.ts +0 -11
- package/.storybook/preview.tsx +0 -30
- package/.vscode/settings.json +0 -12
- package/.vscode/tailwind.json +0 -105
- package/bitbucket-pipelines.yml +0 -50
- package/components.json +0 -21
- package/eslint.config.js +0 -38
- package/src/components/accordion.stories.tsx +0 -258
- package/src/components/accordion.test.tsx +0 -390
- package/src/components/accordion.tsx +0 -64
- package/src/components/alert-dialog.stories.tsx +0 -213
- package/src/components/alert-dialog.test.tsx +0 -80
- package/src/components/alert-dialog.tsx +0 -155
- package/src/components/alert.stories.tsx +0 -84
- package/src/components/alert.test.tsx +0 -35
- package/src/components/alert.tsx +0 -66
- package/src/components/aspect-ratio.stories.tsx +0 -97
- package/src/components/aspect-ratio.test.tsx +0 -47
- package/src/components/aspect-ratio.tsx +0 -11
- package/src/components/avatar.stories.tsx +0 -76
- package/src/components/avatar.test.tsx +0 -50
- package/src/components/avatar.tsx +0 -51
- package/src/components/badge.stories.tsx +0 -64
- package/src/components/badge.test.tsx +0 -34
- package/src/components/badge.tsx +0 -46
- package/src/components/breadcrumb.stories.tsx +0 -86
- package/src/components/breadcrumb.test.tsx +0 -74
- package/src/components/breadcrumb.tsx +0 -109
- package/src/components/button-group.stories.tsx +0 -62
- package/src/components/button-group.tsx +0 -83
- package/src/components/button.stories.tsx +0 -118
- package/src/components/button.test.tsx +0 -64
- package/src/components/button.tsx +0 -62
- package/src/components/calendar.stories.tsx +0 -81
- package/src/components/calendar.tsx +0 -220
- package/src/components/card.stories.tsx +0 -110
- package/src/components/card.test.tsx +0 -56
- package/src/components/card.tsx +0 -92
- package/src/components/carousel.stories.tsx +0 -90
- package/src/components/carousel.tsx +0 -239
- package/src/components/chart.tsx +0 -357
- package/src/components/checkbox.stories.tsx +0 -108
- package/src/components/checkbox.test.tsx +0 -67
- package/src/components/checkbox.tsx +0 -32
- package/src/components/collapsible.stories.tsx +0 -106
- package/src/components/collapsible.test.tsx +0 -92
- package/src/components/collapsible.tsx +0 -31
- package/src/components/command.stories.tsx +0 -90
- package/src/components/command.tsx +0 -182
- package/src/components/context-menu.stories.tsx +0 -63
- package/src/components/context-menu.tsx +0 -252
- package/src/components/dialog.stories.tsx +0 -128
- package/src/components/dialog.tsx +0 -141
- package/src/components/drawer.stories.tsx +0 -104
- package/src/components/drawer.tsx +0 -135
- package/src/components/dropdown-menu.stories.tsx +0 -97
- package/src/components/dropdown-menu.tsx +0 -255
- package/src/components/empty.stories.tsx +0 -90
- package/src/components/empty.test.tsx +0 -55
- package/src/components/empty.tsx +0 -104
- package/src/components/field.tsx +0 -246
- package/src/components/form.tsx +0 -168
- package/src/components/hover-card.stories.tsx +0 -66
- package/src/components/hover-card.tsx +0 -44
- package/src/components/input-group.stories.tsx +0 -57
- package/src/components/input-group.test.tsx +0 -40
- package/src/components/input-group.tsx +0 -170
- package/src/components/input-otp.stories.tsx +0 -94
- package/src/components/input-otp.test.tsx +0 -60
- package/src/components/input-otp.tsx +0 -75
- package/src/components/input.stories.tsx +0 -94
- package/src/components/input.test.tsx +0 -53
- package/src/components/input.tsx +0 -21
- package/src/components/item.tsx +0 -193
- package/src/components/kbd.stories.tsx +0 -100
- package/src/components/kbd.test.tsx +0 -28
- package/src/components/kbd.tsx +0 -28
- package/src/components/label.stories.tsx +0 -48
- package/src/components/label.test.tsx +0 -28
- package/src/components/label.tsx +0 -24
- package/src/components/menubar.tsx +0 -274
- package/src/components/navigation-menu.tsx +0 -168
- package/src/components/pagination.stories.tsx +0 -107
- package/src/components/pagination.tsx +0 -127
- package/src/components/popover.stories.tsx +0 -102
- package/src/components/popover.tsx +0 -48
- package/src/components/progress.stories.tsx +0 -76
- package/src/components/progress.test.tsx +0 -36
- package/src/components/progress.tsx +0 -29
- package/src/components/radio-group.stories.tsx +0 -73
- package/src/components/radio-group.test.tsx +0 -74
- package/src/components/radio-group.tsx +0 -45
- package/src/components/resizable.stories.tsx +0 -120
- package/src/components/resizable.tsx +0 -54
- package/src/components/scroll-area.stories.tsx +0 -64
- package/src/components/scroll-area.test.tsx +0 -46
- package/src/components/scroll-area.tsx +0 -58
- package/src/components/select.stories.tsx +0 -111
- package/src/components/select.test.tsx +0 -90
- package/src/components/select.tsx +0 -188
- package/src/components/separator.stories.tsx +0 -76
- package/src/components/separator.test.tsx +0 -24
- package/src/components/separator.tsx +0 -28
- package/src/components/sheet.stories.tsx +0 -122
- package/src/components/sheet.tsx +0 -137
- package/src/components/sidebar.tsx +0 -726
- package/src/components/skeleton.stories.tsx +0 -53
- package/src/components/skeleton.test.tsx +0 -24
- package/src/components/skeleton.tsx +0 -13
- package/src/components/slider.stories.tsx +0 -97
- package/src/components/slider.test.tsx +0 -49
- package/src/components/slider.tsx +0 -63
- package/src/components/sonner.stories.tsx +0 -96
- package/src/components/sonner.tsx +0 -38
- package/src/components/spinner.stories.tsx +0 -54
- package/src/components/spinner.test.tsx +0 -30
- package/src/components/spinner.tsx +0 -16
- package/src/components/switch.stories.tsx +0 -108
- package/src/components/switch.test.tsx +0 -62
- package/src/components/switch.tsx +0 -31
- package/src/components/table.stories.tsx +0 -139
- package/src/components/table.test.tsx +0 -85
- package/src/components/table.tsx +0 -114
- package/src/components/tabs.stories.tsx +0 -99
- package/src/components/tabs.test.tsx +0 -64
- package/src/components/tabs.tsx +0 -66
- package/src/components/textarea.stories.tsx +0 -89
- package/src/components/textarea.test.tsx +0 -53
- package/src/components/textarea.tsx +0 -18
- package/src/components/toggle-group.stories.tsx +0 -108
- package/src/components/toggle-group.test.tsx +0 -66
- package/src/components/toggle-group.tsx +0 -81
- package/src/components/toggle.stories.tsx +0 -98
- package/src/components/toggle.test.tsx +0 -42
- package/src/components/toggle.tsx +0 -45
- package/src/components/tooltip.stories.tsx +0 -111
- package/src/components/tooltip.tsx +0 -61
- package/src/foundations/README.md +0 -141
- package/src/foundations/ThemeProvider.tsx +0 -77
- package/src/foundations/color.css +0 -232
- package/src/foundations/color.stories.tsx +0 -719
- package/src/foundations/palette.css +0 -249
- package/src/foundations/spacing.css +0 -8
- package/src/foundations/typography.css +0 -143
- package/src/foundations/typography.stories.tsx +0 -17
- package/src/hooks/use-mobile.ts +0 -19
- package/src/index.css +0 -176
- package/src/index.ts +0 -336
- package/src/lib/utils.ts +0 -6
- package/src/test/setup.ts +0 -8
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.app.json +0 -33
- package/tsconfig.json +0 -13
- package/tsconfig.node.json +0 -25
- package/vite.config.ts +0 -30
- package/vitest.config.ts +0 -25
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { Drawer as DrawerPrimitive } from "vaul"
|
|
5
|
-
|
|
6
|
-
import { cn } from "@/lib/utils"
|
|
7
|
-
|
|
8
|
-
function Drawer({
|
|
9
|
-
...props
|
|
10
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
|
|
11
|
-
return <DrawerPrimitive.Root data-slot="drawer" {...props} />
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function DrawerTrigger({
|
|
15
|
-
...props
|
|
16
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
17
|
-
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function DrawerPortal({
|
|
21
|
-
...props
|
|
22
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
23
|
-
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function DrawerClose({
|
|
27
|
-
...props
|
|
28
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
29
|
-
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function DrawerOverlay({
|
|
33
|
-
className,
|
|
34
|
-
...props
|
|
35
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
|
|
36
|
-
return (
|
|
37
|
-
<DrawerPrimitive.Overlay
|
|
38
|
-
data-slot="drawer-overlay"
|
|
39
|
-
className={cn(
|
|
40
|
-
"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",
|
|
41
|
-
className
|
|
42
|
-
)}
|
|
43
|
-
{...props}
|
|
44
|
-
/>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function DrawerContent({
|
|
49
|
-
className,
|
|
50
|
-
children,
|
|
51
|
-
...props
|
|
52
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
|
|
53
|
-
return (
|
|
54
|
-
<DrawerPortal data-slot="drawer-portal">
|
|
55
|
-
<DrawerOverlay />
|
|
56
|
-
<DrawerPrimitive.Content
|
|
57
|
-
data-slot="drawer-content"
|
|
58
|
-
className={cn(
|
|
59
|
-
"group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
|
|
60
|
-
"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
|
|
61
|
-
"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
|
|
62
|
-
"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
|
|
63
|
-
"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
|
|
64
|
-
className
|
|
65
|
-
)}
|
|
66
|
-
{...props}
|
|
67
|
-
>
|
|
68
|
-
<div className="bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
|
|
69
|
-
{children}
|
|
70
|
-
</DrawerPrimitive.Content>
|
|
71
|
-
</DrawerPortal>
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
76
|
-
return (
|
|
77
|
-
<div
|
|
78
|
-
data-slot="drawer-header"
|
|
79
|
-
className={cn(
|
|
80
|
-
"flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
|
|
81
|
-
className
|
|
82
|
-
)}
|
|
83
|
-
{...props}
|
|
84
|
-
/>
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
89
|
-
return (
|
|
90
|
-
<div
|
|
91
|
-
data-slot="drawer-footer"
|
|
92
|
-
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
93
|
-
{...props}
|
|
94
|
-
/>
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function DrawerTitle({
|
|
99
|
-
className,
|
|
100
|
-
...props
|
|
101
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
|
|
102
|
-
return (
|
|
103
|
-
<DrawerPrimitive.Title
|
|
104
|
-
data-slot="drawer-title"
|
|
105
|
-
className={cn("text-foreground font-semibold", className)}
|
|
106
|
-
{...props}
|
|
107
|
-
/>
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function DrawerDescription({
|
|
112
|
-
className,
|
|
113
|
-
...props
|
|
114
|
-
}: React.ComponentProps<typeof DrawerPrimitive.Description>) {
|
|
115
|
-
return (
|
|
116
|
-
<DrawerPrimitive.Description
|
|
117
|
-
data-slot="drawer-description"
|
|
118
|
-
className={cn("text-muted-foreground text-sm", className)}
|
|
119
|
-
{...props}
|
|
120
|
-
/>
|
|
121
|
-
)
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export {
|
|
125
|
-
Drawer,
|
|
126
|
-
DrawerPortal,
|
|
127
|
-
DrawerOverlay,
|
|
128
|
-
DrawerTrigger,
|
|
129
|
-
DrawerClose,
|
|
130
|
-
DrawerContent,
|
|
131
|
-
DrawerHeader,
|
|
132
|
-
DrawerFooter,
|
|
133
|
-
DrawerTitle,
|
|
134
|
-
DrawerDescription,
|
|
135
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import {
|
|
4
|
-
DropdownMenu,
|
|
5
|
-
DropdownMenuContent,
|
|
6
|
-
DropdownMenuItem,
|
|
7
|
-
DropdownMenuLabel,
|
|
8
|
-
DropdownMenuSeparator,
|
|
9
|
-
DropdownMenuTrigger,
|
|
10
|
-
DropdownMenuCheckboxItem,
|
|
11
|
-
DropdownMenuRadioGroup,
|
|
12
|
-
DropdownMenuRadioItem,
|
|
13
|
-
} from "./dropdown-menu";
|
|
14
|
-
import { Button } from "./button";
|
|
15
|
-
|
|
16
|
-
const meta = {
|
|
17
|
-
title: "Components/DropdownMenu",
|
|
18
|
-
component: DropdownMenu,
|
|
19
|
-
parameters: {
|
|
20
|
-
layout: "padded",
|
|
21
|
-
},
|
|
22
|
-
tags: ["autodocs"],
|
|
23
|
-
} satisfies Meta<typeof DropdownMenu>;
|
|
24
|
-
|
|
25
|
-
export default meta;
|
|
26
|
-
type Story = StoryObj<typeof meta>;
|
|
27
|
-
|
|
28
|
-
export const Default: Story = {
|
|
29
|
-
render: () => (
|
|
30
|
-
<DropdownMenu>
|
|
31
|
-
<DropdownMenuTrigger asChild>
|
|
32
|
-
<Button variant="outline">Open Menu</Button>
|
|
33
|
-
</DropdownMenuTrigger>
|
|
34
|
-
<DropdownMenuContent>
|
|
35
|
-
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
|
36
|
-
<DropdownMenuSeparator />
|
|
37
|
-
<DropdownMenuItem>Profile</DropdownMenuItem>
|
|
38
|
-
<DropdownMenuItem>Billing</DropdownMenuItem>
|
|
39
|
-
<DropdownMenuItem>Team</DropdownMenuItem>
|
|
40
|
-
<DropdownMenuItem>Subscription</DropdownMenuItem>
|
|
41
|
-
</DropdownMenuContent>
|
|
42
|
-
</DropdownMenu>
|
|
43
|
-
),
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const WithCheckboxes: Story = {
|
|
47
|
-
render: () => {
|
|
48
|
-
const [showStatusBar, setShowStatusBar] = useState(true);
|
|
49
|
-
const [showActivityBar, setShowActivityBar] = useState(false);
|
|
50
|
-
return (
|
|
51
|
-
<DropdownMenu>
|
|
52
|
-
<DropdownMenuTrigger asChild>
|
|
53
|
-
<Button variant="outline">View Options</Button>
|
|
54
|
-
</DropdownMenuTrigger>
|
|
55
|
-
<DropdownMenuContent className="w-56">
|
|
56
|
-
<DropdownMenuLabel>Appearance</DropdownMenuLabel>
|
|
57
|
-
<DropdownMenuSeparator />
|
|
58
|
-
<DropdownMenuCheckboxItem
|
|
59
|
-
checked={showStatusBar}
|
|
60
|
-
onCheckedChange={setShowStatusBar}
|
|
61
|
-
>
|
|
62
|
-
Status Bar
|
|
63
|
-
</DropdownMenuCheckboxItem>
|
|
64
|
-
<DropdownMenuCheckboxItem
|
|
65
|
-
checked={showActivityBar}
|
|
66
|
-
onCheckedChange={setShowActivityBar}
|
|
67
|
-
>
|
|
68
|
-
Activity Bar
|
|
69
|
-
</DropdownMenuCheckboxItem>
|
|
70
|
-
</DropdownMenuContent>
|
|
71
|
-
</DropdownMenu>
|
|
72
|
-
);
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const WithRadioGroup: Story = {
|
|
77
|
-
render: () => {
|
|
78
|
-
const [position, setPosition] = useState("bottom");
|
|
79
|
-
return (
|
|
80
|
-
<DropdownMenu>
|
|
81
|
-
<DropdownMenuTrigger asChild>
|
|
82
|
-
<Button variant="outline">Position</Button>
|
|
83
|
-
</DropdownMenuTrigger>
|
|
84
|
-
<DropdownMenuContent className="w-56">
|
|
85
|
-
<DropdownMenuLabel>Panel Position</DropdownMenuLabel>
|
|
86
|
-
<DropdownMenuSeparator />
|
|
87
|
-
<DropdownMenuRadioGroup value={position} onValueChange={setPosition}>
|
|
88
|
-
<DropdownMenuRadioItem value="top">Top</DropdownMenuRadioItem>
|
|
89
|
-
<DropdownMenuRadioItem value="bottom">Bottom</DropdownMenuRadioItem>
|
|
90
|
-
<DropdownMenuRadioItem value="right">Right</DropdownMenuRadioItem>
|
|
91
|
-
</DropdownMenuRadioGroup>
|
|
92
|
-
</DropdownMenuContent>
|
|
93
|
-
</DropdownMenu>
|
|
94
|
-
);
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
|
3
|
-
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
|
|
4
|
-
|
|
5
|
-
import { cn } from "@/lib/utils"
|
|
6
|
-
|
|
7
|
-
function DropdownMenu({
|
|
8
|
-
...props
|
|
9
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
|
|
10
|
-
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function DropdownMenuPortal({
|
|
14
|
-
...props
|
|
15
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
|
|
16
|
-
return (
|
|
17
|
-
<DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function DropdownMenuTrigger({
|
|
22
|
-
...props
|
|
23
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
|
|
24
|
-
return (
|
|
25
|
-
<DropdownMenuPrimitive.Trigger
|
|
26
|
-
data-slot="dropdown-menu-trigger"
|
|
27
|
-
{...props}
|
|
28
|
-
/>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function DropdownMenuContent({
|
|
33
|
-
className,
|
|
34
|
-
sideOffset = 4,
|
|
35
|
-
...props
|
|
36
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
|
|
37
|
-
return (
|
|
38
|
-
<DropdownMenuPrimitive.Portal>
|
|
39
|
-
<DropdownMenuPrimitive.Content
|
|
40
|
-
data-slot="dropdown-menu-content"
|
|
41
|
-
sideOffset={sideOffset}
|
|
42
|
-
className={cn(
|
|
43
|
-
"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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
44
|
-
className
|
|
45
|
-
)}
|
|
46
|
-
{...props}
|
|
47
|
-
/>
|
|
48
|
-
</DropdownMenuPrimitive.Portal>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function DropdownMenuGroup({
|
|
53
|
-
...props
|
|
54
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
|
|
55
|
-
return (
|
|
56
|
-
<DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function DropdownMenuItem({
|
|
61
|
-
className,
|
|
62
|
-
inset,
|
|
63
|
-
variant = "default",
|
|
64
|
-
...props
|
|
65
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
66
|
-
inset?: boolean
|
|
67
|
-
variant?: "default" | "destructive"
|
|
68
|
-
}) {
|
|
69
|
-
return (
|
|
70
|
-
<DropdownMenuPrimitive.Item
|
|
71
|
-
data-slot="dropdown-menu-item"
|
|
72
|
-
data-inset={inset}
|
|
73
|
-
data-variant={variant}
|
|
74
|
-
className={cn(
|
|
75
|
-
"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 [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
76
|
-
className
|
|
77
|
-
)}
|
|
78
|
-
{...props}
|
|
79
|
-
/>
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function DropdownMenuCheckboxItem({
|
|
84
|
-
className,
|
|
85
|
-
children,
|
|
86
|
-
checked,
|
|
87
|
-
...props
|
|
88
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
|
|
89
|
-
return (
|
|
90
|
-
<DropdownMenuPrimitive.CheckboxItem
|
|
91
|
-
data-slot="dropdown-menu-checkbox-item"
|
|
92
|
-
className={cn(
|
|
93
|
-
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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",
|
|
94
|
-
className
|
|
95
|
-
)}
|
|
96
|
-
checked={checked}
|
|
97
|
-
{...props}
|
|
98
|
-
>
|
|
99
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
100
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
101
|
-
<CheckIcon className="size-4" />
|
|
102
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
103
|
-
</span>
|
|
104
|
-
{children}
|
|
105
|
-
</DropdownMenuPrimitive.CheckboxItem>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function DropdownMenuRadioGroup({
|
|
110
|
-
...props
|
|
111
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
|
|
112
|
-
return (
|
|
113
|
-
<DropdownMenuPrimitive.RadioGroup
|
|
114
|
-
data-slot="dropdown-menu-radio-group"
|
|
115
|
-
{...props}
|
|
116
|
-
/>
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function DropdownMenuRadioItem({
|
|
121
|
-
className,
|
|
122
|
-
children,
|
|
123
|
-
...props
|
|
124
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
|
|
125
|
-
return (
|
|
126
|
-
<DropdownMenuPrimitive.RadioItem
|
|
127
|
-
data-slot="dropdown-menu-radio-item"
|
|
128
|
-
className={cn(
|
|
129
|
-
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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",
|
|
130
|
-
className
|
|
131
|
-
)}
|
|
132
|
-
{...props}
|
|
133
|
-
>
|
|
134
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
135
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
136
|
-
<CircleIcon className="size-2 fill-current" />
|
|
137
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
138
|
-
</span>
|
|
139
|
-
{children}
|
|
140
|
-
</DropdownMenuPrimitive.RadioItem>
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function DropdownMenuLabel({
|
|
145
|
-
className,
|
|
146
|
-
inset,
|
|
147
|
-
...props
|
|
148
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
149
|
-
inset?: boolean
|
|
150
|
-
}) {
|
|
151
|
-
return (
|
|
152
|
-
<DropdownMenuPrimitive.Label
|
|
153
|
-
data-slot="dropdown-menu-label"
|
|
154
|
-
data-inset={inset}
|
|
155
|
-
className={cn(
|
|
156
|
-
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
157
|
-
className
|
|
158
|
-
)}
|
|
159
|
-
{...props}
|
|
160
|
-
/>
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function DropdownMenuSeparator({
|
|
165
|
-
className,
|
|
166
|
-
...props
|
|
167
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
|
168
|
-
return (
|
|
169
|
-
<DropdownMenuPrimitive.Separator
|
|
170
|
-
data-slot="dropdown-menu-separator"
|
|
171
|
-
className={cn("bg-border -mx-1 my-1 h-px", className)}
|
|
172
|
-
{...props}
|
|
173
|
-
/>
|
|
174
|
-
)
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function DropdownMenuShortcut({
|
|
178
|
-
className,
|
|
179
|
-
...props
|
|
180
|
-
}: React.ComponentProps<"span">) {
|
|
181
|
-
return (
|
|
182
|
-
<span
|
|
183
|
-
data-slot="dropdown-menu-shortcut"
|
|
184
|
-
className={cn(
|
|
185
|
-
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
186
|
-
className
|
|
187
|
-
)}
|
|
188
|
-
{...props}
|
|
189
|
-
/>
|
|
190
|
-
)
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function DropdownMenuSub({
|
|
194
|
-
...props
|
|
195
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
|
|
196
|
-
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function DropdownMenuSubTrigger({
|
|
200
|
-
className,
|
|
201
|
-
inset,
|
|
202
|
-
children,
|
|
203
|
-
...props
|
|
204
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
205
|
-
inset?: boolean
|
|
206
|
-
}) {
|
|
207
|
-
return (
|
|
208
|
-
<DropdownMenuPrimitive.SubTrigger
|
|
209
|
-
data-slot="dropdown-menu-sub-trigger"
|
|
210
|
-
data-inset={inset}
|
|
211
|
-
className={cn(
|
|
212
|
-
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
213
|
-
className
|
|
214
|
-
)}
|
|
215
|
-
{...props}
|
|
216
|
-
>
|
|
217
|
-
{children}
|
|
218
|
-
<ChevronRightIcon className="ml-auto size-4" />
|
|
219
|
-
</DropdownMenuPrimitive.SubTrigger>
|
|
220
|
-
)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function DropdownMenuSubContent({
|
|
224
|
-
className,
|
|
225
|
-
...props
|
|
226
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
|
227
|
-
return (
|
|
228
|
-
<DropdownMenuPrimitive.SubContent
|
|
229
|
-
data-slot="dropdown-menu-sub-content"
|
|
230
|
-
className={cn(
|
|
231
|
-
"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 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
|
|
232
|
-
className
|
|
233
|
-
)}
|
|
234
|
-
{...props}
|
|
235
|
-
/>
|
|
236
|
-
)
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
export {
|
|
240
|
-
DropdownMenu,
|
|
241
|
-
DropdownMenuPortal,
|
|
242
|
-
DropdownMenuTrigger,
|
|
243
|
-
DropdownMenuContent,
|
|
244
|
-
DropdownMenuGroup,
|
|
245
|
-
DropdownMenuLabel,
|
|
246
|
-
DropdownMenuItem,
|
|
247
|
-
DropdownMenuCheckboxItem,
|
|
248
|
-
DropdownMenuRadioGroup,
|
|
249
|
-
DropdownMenuRadioItem,
|
|
250
|
-
DropdownMenuSeparator,
|
|
251
|
-
DropdownMenuShortcut,
|
|
252
|
-
DropdownMenuSub,
|
|
253
|
-
DropdownMenuSubTrigger,
|
|
254
|
-
DropdownMenuSubContent,
|
|
255
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import {
|
|
3
|
-
Empty,
|
|
4
|
-
EmptyHeader,
|
|
5
|
-
EmptyTitle,
|
|
6
|
-
EmptyDescription,
|
|
7
|
-
EmptyContent,
|
|
8
|
-
EmptyMedia,
|
|
9
|
-
} from "./empty";
|
|
10
|
-
import { InboxIcon } from "lucide-react";
|
|
11
|
-
import { Button } from "./button";
|
|
12
|
-
|
|
13
|
-
const meta = {
|
|
14
|
-
title: "Components/Empty",
|
|
15
|
-
component: Empty,
|
|
16
|
-
parameters: {
|
|
17
|
-
layout: "padded",
|
|
18
|
-
},
|
|
19
|
-
tags: ["autodocs"],
|
|
20
|
-
} satisfies Meta<typeof Empty>;
|
|
21
|
-
|
|
22
|
-
export default meta;
|
|
23
|
-
type Story = StoryObj<typeof meta>;
|
|
24
|
-
|
|
25
|
-
export const Default: Story = {
|
|
26
|
-
render: () => (
|
|
27
|
-
<Empty>
|
|
28
|
-
<EmptyHeader>
|
|
29
|
-
<EmptyMedia>
|
|
30
|
-
<InboxIcon />
|
|
31
|
-
</EmptyMedia>
|
|
32
|
-
<EmptyTitle>No items found</EmptyTitle>
|
|
33
|
-
<EmptyDescription>
|
|
34
|
-
Get started by creating a new item.
|
|
35
|
-
</EmptyDescription>
|
|
36
|
-
</EmptyHeader>
|
|
37
|
-
<EmptyContent>
|
|
38
|
-
<Button>Create Item</Button>
|
|
39
|
-
</EmptyContent>
|
|
40
|
-
</Empty>
|
|
41
|
-
),
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const WithIcon: Story = {
|
|
45
|
-
render: () => (
|
|
46
|
-
<Empty>
|
|
47
|
-
<EmptyHeader>
|
|
48
|
-
<EmptyMedia variant="icon">
|
|
49
|
-
<InboxIcon />
|
|
50
|
-
</EmptyMedia>
|
|
51
|
-
<EmptyTitle>No messages</EmptyTitle>
|
|
52
|
-
<EmptyDescription>
|
|
53
|
-
You don't have any messages yet. Start a conversation!
|
|
54
|
-
</EmptyDescription>
|
|
55
|
-
</EmptyHeader>
|
|
56
|
-
</Empty>
|
|
57
|
-
),
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const Simple: Story = {
|
|
61
|
-
render: () => (
|
|
62
|
-
<Empty>
|
|
63
|
-
<EmptyHeader>
|
|
64
|
-
<EmptyTitle>Nothing here</EmptyTitle>
|
|
65
|
-
<EmptyDescription>This area is empty.</EmptyDescription>
|
|
66
|
-
</EmptyHeader>
|
|
67
|
-
</Empty>
|
|
68
|
-
),
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const WithAction: Story = {
|
|
72
|
-
render: () => (
|
|
73
|
-
<Empty>
|
|
74
|
-
<EmptyHeader>
|
|
75
|
-
<EmptyMedia>
|
|
76
|
-
<InboxIcon />
|
|
77
|
-
</EmptyMedia>
|
|
78
|
-
<EmptyTitle>No projects</EmptyTitle>
|
|
79
|
-
<EmptyDescription>
|
|
80
|
-
Create a new project to get started.
|
|
81
|
-
</EmptyDescription>
|
|
82
|
-
</EmptyHeader>
|
|
83
|
-
<EmptyContent>
|
|
84
|
-
<Button>New Project</Button>
|
|
85
|
-
<Button variant="outline">Import</Button>
|
|
86
|
-
</EmptyContent>
|
|
87
|
-
</Empty>
|
|
88
|
-
),
|
|
89
|
-
};
|
|
90
|
-
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { render } from "@testing-library/react";
|
|
3
|
-
import {
|
|
4
|
-
Empty,
|
|
5
|
-
EmptyHeader,
|
|
6
|
-
EmptyTitle,
|
|
7
|
-
EmptyDescription,
|
|
8
|
-
EmptyContent,
|
|
9
|
-
EmptyMedia,
|
|
10
|
-
} from "./empty";
|
|
11
|
-
|
|
12
|
-
describe("Empty", () => {
|
|
13
|
-
it("should render empty component", () => {
|
|
14
|
-
const { container } = render(<Empty>Content</Empty>);
|
|
15
|
-
const empty = container.querySelector('[data-slot="empty"]');
|
|
16
|
-
expect(empty).toBeInTheDocument();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("should render empty header with title and description", () => {
|
|
20
|
-
const { getByText } = render(
|
|
21
|
-
<Empty>
|
|
22
|
-
<EmptyHeader>
|
|
23
|
-
<EmptyTitle>No items</EmptyTitle>
|
|
24
|
-
<EmptyDescription>No items found</EmptyDescription>
|
|
25
|
-
</EmptyHeader>
|
|
26
|
-
</Empty>
|
|
27
|
-
);
|
|
28
|
-
expect(getByText("No items")).toBeInTheDocument();
|
|
29
|
-
expect(getByText("No items found")).toBeInTheDocument();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("should render empty media", () => {
|
|
33
|
-
const { container } = render(
|
|
34
|
-
<Empty>
|
|
35
|
-
<EmptyHeader>
|
|
36
|
-
<EmptyMedia>Icon</EmptyMedia>
|
|
37
|
-
</EmptyHeader>
|
|
38
|
-
</Empty>
|
|
39
|
-
);
|
|
40
|
-
const media = container.querySelector('[data-slot="empty-icon"]');
|
|
41
|
-
expect(media).toBeInTheDocument();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("should render empty content", () => {
|
|
45
|
-
const { getByText } = render(
|
|
46
|
-
<Empty>
|
|
47
|
-
<EmptyContent>
|
|
48
|
-
<button>Action</button>
|
|
49
|
-
</EmptyContent>
|
|
50
|
-
</Empty>
|
|
51
|
-
);
|
|
52
|
-
expect(getByText("Action")).toBeInTheDocument();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|