@inspirare/design-system 0.0.23 → 0.0.24
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/README.md +82 -61
- package/dist/book-logo-filled.svg +55 -0
- package/dist/components/ui/accessibility-improvements.js +26 -23
- package/dist/components/ui/accordion.js +34 -24
- package/dist/components/ui/alert-dialog.js +91 -57
- package/dist/components/ui/alert.js +38 -26
- package/dist/components/ui/aspect-ratio.js +11 -3
- package/dist/components/ui/avatar.js +30 -8
- package/dist/components/ui/badge.js +20 -14
- package/dist/components/ui/breadcrumb.js +69 -56
- package/dist/components/ui/button-group.js +17 -13
- package/dist/components/ui/button.js +19 -15
- package/dist/components/ui/calendar.js +63 -59
- package/dist/components/ui/card.js +11 -9
- package/dist/components/ui/carousel.js +70 -75
- package/dist/components/ui/chart.js +75 -72
- package/dist/components/ui/checkbox.js +4 -5
- package/dist/components/ui/collapsible.js +12 -14
- package/dist/components/ui/color-picker.js +60 -80
- package/dist/components/ui/combobox.js +153 -33
- package/dist/components/ui/command.js +50 -48
- package/dist/components/ui/context-menu.js +129 -68
- package/dist/components/ui/dialog.js +65 -60
- package/dist/components/ui/drawer.js +81 -40
- package/dist/components/ui/dropdown-menu.js +100 -87
- package/dist/components/ui/empty.js +7 -6
- package/dist/components/ui/field.js +44 -47
- package/dist/components/ui/form.js +22 -23
- package/dist/components/ui/hover-card.js +14 -11
- package/dist/components/ui/input-group.js +16 -13
- package/dist/components/ui/input-otp.js +37 -32
- package/dist/components/ui/input.js +9 -7
- package/dist/components/ui/item.js +42 -36
- package/dist/components/ui/kbd.js +2 -1
- package/dist/components/ui/label.js +6 -7
- package/dist/components/ui/menubar.js +124 -93
- package/dist/components/ui/navigation-menu.js +79 -54
- package/dist/components/ui/pagination.js +78 -58
- package/dist/components/ui/popover.js +35 -16
- package/dist/components/ui/progress.js +37 -13
- package/dist/components/ui/radio-group.js +14 -14
- package/dist/components/ui/resizable.js +24 -15
- package/dist/components/ui/scroll-area.js +29 -11
- package/dist/components/ui/select.js +98 -56
- package/dist/components/ui/separator.js +5 -7
- package/dist/components/ui/sheet.js +47 -42
- package/dist/components/ui/sidebar.js +279 -248
- package/dist/components/ui/skeleton.js +4 -40
- package/dist/components/ui/slider.js +27 -29
- package/dist/components/ui/sonner.js +27 -10
- package/dist/components/ui/spinner.js +2 -0
- package/dist/components/ui/switch.js +3 -4
- package/dist/components/ui/table.js +6 -6
- package/dist/components/ui/tabs.js +45 -22
- package/dist/components/ui/textarea.js +3 -2
- package/dist/components/ui/theme-toggle.js +38 -41
- package/dist/components/ui/toggle-group.js +30 -21
- package/dist/components/ui/toggle.js +8 -9
- package/dist/components/ui/tooltip.js +28 -23
- package/dist/index.css +1 -1
- package/dist/index.d.ts +446 -468
- package/dist/index.js +58 -58
- package/package.json +38 -37
- package/src/App.tsx +28 -34
- package/src/components/branding/assets/book-logo-filled.svg +55 -0
- package/src/components/branding/logo/logo.tsx +56 -0
- package/src/components/ui/accessibility-improvements.stories.tsx +18 -0
- package/src/components/ui/accessibility-improvements.test.tsx +13 -0
- package/src/components/ui/accessibility-improvements.tsx +16 -6
- package/src/components/ui/accordion.stories.tsx +19 -0
- package/src/components/ui/accordion.test.tsx +14 -0
- package/src/components/ui/accordion.tsx +28 -20
- package/src/components/ui/alert-dialog.stories.tsx +19 -0
- package/src/components/ui/alert-dialog.test.tsx +14 -0
- package/src/components/ui/alert-dialog.tsx +159 -123
- package/src/components/ui/alert.stories.tsx +19 -0
- package/src/components/ui/alert.test.tsx +14 -0
- package/src/components/ui/alert.tsx +60 -41
- package/src/components/ui/aspect-ratio.stories.tsx +19 -0
- package/src/components/ui/aspect-ratio.test.tsx +14 -0
- package/src/components/ui/aspect-ratio.tsx +19 -2
- package/src/components/ui/attachment.stories.tsx +19 -0
- package/src/components/ui/attachment.test.tsx +14 -0
- package/src/components/ui/attachment.tsx +209 -0
- package/src/components/ui/avatar.stories.tsx +19 -0
- package/src/components/ui/avatar.test.tsx +14 -0
- package/src/components/ui/avatar.tsx +73 -17
- package/src/components/ui/badge.stories.tsx +19 -0
- package/src/components/ui/badge.test.tsx +14 -0
- package/src/components/ui/badge.tsx +33 -25
- package/src/components/ui/breadcrumb.stories.tsx +19 -0
- package/src/components/ui/breadcrumb.test.tsx +14 -0
- package/src/components/ui/breadcrumb.tsx +98 -86
- package/src/components/ui/bubble.stories.tsx +19 -0
- package/src/components/ui/bubble.test.tsx +14 -0
- package/src/components/ui/bubble.tsx +130 -0
- package/src/components/ui/button-group.stories.tsx +19 -0
- package/src/components/ui/button-group.test.tsx +14 -0
- package/src/components/ui/button-group.tsx +26 -20
- package/src/components/ui/button.stories.tsx +19 -0
- package/src/components/ui/button.test.tsx +14 -0
- package/src/components/ui/button.tsx +30 -31
- package/src/components/ui/calendar.stories.tsx +19 -0
- package/src/components/ui/calendar.test.tsx +14 -0
- package/src/components/ui/calendar.tsx +28 -26
- package/src/components/ui/card.stories.tsx +19 -0
- package/src/components/ui/card.test.tsx +14 -0
- package/src/components/ui/card.tsx +30 -17
- package/src/components/ui/carousel.stories.tsx +19 -0
- package/src/components/ui/carousel.test.tsx +14 -0
- package/src/components/ui/carousel.tsx +115 -135
- package/src/components/ui/chart.stories.tsx +18 -0
- package/src/components/ui/chart.test.tsx +13 -0
- package/src/components/ui/chart.tsx +220 -216
- package/src/components/ui/checkbox.stories.tsx +19 -0
- package/src/components/ui/checkbox.test.tsx +14 -0
- package/src/components/ui/checkbox.tsx +7 -10
- package/src/components/ui/collapsible.stories.tsx +19 -0
- package/src/components/ui/collapsible.test.tsx +14 -0
- package/src/components/ui/collapsible.tsx +11 -26
- package/src/components/ui/color-picker.stories.tsx +19 -0
- package/src/components/ui/color-picker.test.tsx +14 -0
- package/src/components/ui/color-picker.tsx +36 -26
- package/src/components/ui/combobox.stories.tsx +19 -0
- package/src/components/ui/combobox.test.tsx +14 -0
- package/src/components/ui/combobox.tsx +281 -96
- package/src/components/ui/command.stories.tsx +19 -0
- package/src/components/ui/command.test.tsx +14 -0
- package/src/components/ui/command.tsx +59 -47
- package/src/components/ui/context-menu.stories.tsx +19 -0
- package/src/components/ui/context-menu.test.tsx +14 -0
- package/src/components/ui/context-menu.tsx +231 -160
- package/src/components/ui/dialog.stories.tsx +19 -0
- package/src/components/ui/dialog.test.tsx +14 -0
- package/src/components/ui/dialog.tsx +81 -72
- package/src/components/ui/direction.stories.tsx +19 -0
- package/src/components/ui/direction.test.tsx +14 -0
- package/src/components/ui/direction.tsx +6 -0
- package/src/components/ui/drawer.stories.tsx +19 -0
- package/src/components/ui/drawer.test.tsx +14 -0
- package/src/components/ui/drawer.tsx +143 -64
- package/src/components/ui/dropdown-menu.stories.tsx +19 -0
- package/src/components/ui/dropdown-menu.test.tsx +14 -0
- package/src/components/ui/dropdown-menu.tsx +199 -153
- package/src/components/ui/empty.stories.tsx +18 -0
- package/src/components/ui/empty.test.tsx +13 -0
- package/src/components/ui/empty.tsx +11 -9
- package/src/components/ui/field.stories.tsx +18 -0
- package/src/components/ui/field.test.tsx +13 -0
- package/src/components/ui/field.tsx +26 -32
- package/src/components/ui/form.stories.tsx +22 -0
- package/src/components/ui/form.test.tsx +15 -0
- package/src/components/ui/form.tsx +1 -2
- package/src/components/ui/hover-card.stories.tsx +19 -0
- package/src/components/ui/hover-card.test.tsx +14 -0
- package/src/components/ui/hover-card.tsx +34 -32
- package/src/components/ui/input-group.stories.tsx +18 -0
- package/src/components/ui/input-group.test.tsx +13 -0
- package/src/components/ui/input-group.tsx +21 -28
- package/src/components/ui/input-otp.stories.tsx +19 -0
- package/src/components/ui/input-otp.test.tsx +14 -0
- package/src/components/ui/input-otp.tsx +58 -42
- package/src/components/ui/input.stories.tsx +19 -0
- package/src/components/ui/input.test.tsx +14 -0
- package/src/components/ui/input.tsx +9 -8
- package/src/components/ui/item.stories.tsx +18 -0
- package/src/components/ui/item.test.tsx +13 -0
- package/src/components/ui/item.tsx +38 -28
- package/src/components/ui/kbd.stories.tsx +18 -0
- package/src/components/ui/kbd.test.tsx +13 -0
- package/src/components/ui/kbd.tsx +3 -3
- package/src/components/ui/label.stories.tsx +18 -0
- package/src/components/ui/label.test.tsx +13 -0
- package/src/components/ui/label.tsx +7 -11
- package/src/components/ui/marker.stories.tsx +19 -0
- package/src/components/ui/marker.test.tsx +14 -0
- package/src/components/ui/marker.tsx +73 -0
- package/src/components/ui/menubar.stories.tsx +19 -0
- package/src/components/ui/menubar.test.tsx +14 -0
- package/src/components/ui/menubar.tsx +226 -202
- package/src/components/ui/message-scroller.stories.tsx +19 -0
- package/src/components/ui/message-scroller.test.tsx +14 -0
- package/src/components/ui/message-scroller.tsx +131 -0
- package/src/components/ui/message.stories.tsx +19 -0
- package/src/components/ui/message.test.tsx +14 -0
- package/src/components/ui/message.tsx +94 -0
- package/src/components/ui/native-select.stories.tsx +18 -0
- package/src/components/ui/native-select.test.tsx +13 -0
- package/src/components/ui/native-select.tsx +63 -0
- package/src/components/ui/navigation-menu.stories.tsx +19 -0
- package/src/components/ui/navigation-menu.test.tsx +14 -0
- package/src/components/ui/navigation-menu.tsx +145 -103
- package/src/components/ui/pagination.stories.tsx +19 -0
- package/src/components/ui/pagination.test.tsx +14 -0
- package/src/components/ui/pagination.tsx +114 -83
- package/src/components/ui/popover.stories.tsx +19 -0
- package/src/components/ui/popover.test.tsx +14 -0
- package/src/components/ui/popover.tsx +68 -33
- package/src/components/ui/progress.stories.tsx +19 -0
- package/src/components/ui/progress.test.tsx +14 -0
- package/src/components/ui/progress.tsx +67 -15
- package/src/components/ui/questionnaire.stories.tsx +19 -0
- package/src/components/ui/questionnaire.test.tsx +14 -0
- package/src/components/ui/questionnaire.tsx +324 -0
- package/src/components/ui/radio-group.stories.tsx +19 -0
- package/src/components/ui/radio-group.test.tsx +14 -0
- package/src/components/ui/radio-group.tsx +15 -20
- package/src/components/ui/resizable.stories.tsx +19 -0
- package/src/components/ui/resizable.test.tsx +14 -0
- package/src/components/ui/resizable.tsx +37 -30
- package/src/components/ui/scroll-area.stories.tsx +19 -0
- package/src/components/ui/scroll-area.test.tsx +14 -0
- package/src/components/ui/scroll-area.tsx +41 -19
- package/src/components/ui/select.stories.tsx +19 -0
- package/src/components/ui/select.test.tsx +14 -0
- package/src/components/ui/select.tsx +145 -78
- package/src/components/ui/separator.stories.tsx +19 -0
- package/src/components/ui/separator.test.tsx +14 -0
- package/src/components/ui/separator.tsx +8 -11
- package/src/components/ui/sheet.stories.tsx +19 -0
- package/src/components/ui/sheet.test.tsx +14 -0
- package/src/components/ui/sheet.tsx +56 -71
- package/src/components/ui/sidebar.stories.tsx +18 -0
- package/src/components/ui/sidebar.test.tsx +13 -0
- package/src/components/ui/sidebar.tsx +469 -513
- package/src/components/ui/skeleton.stories.tsx +19 -0
- package/src/components/ui/skeleton.test.tsx +14 -0
- package/src/components/ui/skeleton.tsx +8 -114
- package/src/components/ui/slider.stories.tsx +19 -0
- package/src/components/ui/slider.test.tsx +14 -0
- package/src/components/ui/slider.tsx +31 -40
- package/src/components/ui/sonner.stories.tsx +19 -0
- package/src/components/ui/sonner.test.tsx +14 -0
- package/src/components/ui/sonner.tsx +39 -7
- package/src/components/ui/spinner.stories.tsx +18 -0
- package/src/components/ui/spinner.test.tsx +13 -0
- package/src/components/ui/spinner.tsx +3 -7
- package/src/components/ui/switch.stories.tsx +19 -0
- package/src/components/ui/switch.test.tsx +14 -0
- package/src/components/ui/switch.tsx +4 -7
- package/src/components/ui/table.stories.tsx +19 -0
- package/src/components/ui/table.test.tsx +14 -0
- package/src/components/ui/table.tsx +17 -17
- package/src/components/ui/tabs.stories.tsx +19 -0
- package/src/components/ui/tabs.test.tsx +14 -0
- package/src/components/ui/tabs.tsx +71 -31
- package/src/components/ui/textarea.stories.tsx +19 -0
- package/src/components/ui/textarea.test.tsx +14 -0
- package/src/components/ui/textarea.tsx +7 -5
- package/src/components/ui/theme-toggle.stories.tsx +18 -0
- package/src/components/ui/theme-toggle.test.tsx +13 -0
- package/src/components/ui/theme-toggle.tsx +35 -37
- package/src/components/ui/toggle-group.stories.tsx +19 -0
- package/src/components/ui/toggle-group.test.tsx +14 -0
- package/src/components/ui/toggle-group.tsx +41 -25
- package/src/components/ui/toggle.stories.tsx +19 -0
- package/src/components/ui/toggle.test.tsx +14 -0
- package/src/components/ui/toggle.tsx +17 -19
- package/src/components/ui/tooltip.stories.tsx +19 -0
- package/src/components/ui/tooltip.test.tsx +14 -0
- package/src/components/ui/tooltip.tsx +53 -44
- package/src/demo/AIDemo.tsx +50 -0
- package/src/demo/ButtonsDemo.tsx +41 -18
- package/src/demo/CalendarDemo.tsx +1 -1
- package/src/demo/FeedbackDemo.tsx +4 -6
- package/src/demo/FormsDemo.tsx +34 -11
- package/src/demo/NavigationDemo.tsx +38 -13
- package/src/demo/OverlaysDemo.tsx +22 -36
- package/src/demo/update-demos.js +82 -0
- package/src/index.css +66 -46
- package/src/lib/utils.ts +3 -3
- package/src/stories/Button.stories.ts +54 -0
- package/src/stories/Button.tsx +36 -0
- package/src/stories/Configure.mdx +388 -0
- package/src/stories/Header.stories.ts +34 -0
- package/src/stories/Header.tsx +55 -0
- package/src/stories/Page.stories.ts +33 -0
- package/src/stories/Page.tsx +73 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +68 -0
|
@@ -1,181 +1,273 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client"
|
|
2
2
|
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import
|
|
5
|
-
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Menu as MenuPrimitive } from "@base-ui/react/menu"
|
|
6
5
|
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
import { ChevronRightIcon, CheckIcon } from "lucide-react"
|
|
8
8
|
|
|
9
|
-
function DropdownMenu({
|
|
10
|
-
...props
|
|
11
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
|
|
12
|
-
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
|
|
9
|
+
function DropdownMenu({ ...props }: MenuPrimitive.Root.Props) {
|
|
10
|
+
return <MenuPrimitive.Root data-slot="dropdown-menu" {...props} />
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
function DropdownMenuPortal({
|
|
16
|
-
...props
|
|
17
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
|
|
18
|
-
return (
|
|
19
|
-
<DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
|
|
20
|
-
);
|
|
13
|
+
function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props) {
|
|
14
|
+
return <MenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
|
|
21
15
|
}
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}:
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
className={cn("cursor-pointer", className)}
|
|
31
|
-
{...props}
|
|
32
|
-
/>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
17
|
+
const DropdownMenuTrigger = React.forwardRef<
|
|
18
|
+
React.ElementRef<"button">,
|
|
19
|
+
MenuPrimitive.Trigger.Props
|
|
20
|
+
>(({ ...props }: MenuPrimitive.Trigger.Props, ref) => {
|
|
21
|
+
return <MenuPrimitive.Trigger ref={ref} data-slot="dropdown-menu-trigger" {...props} />
|
|
22
|
+
})
|
|
23
|
+
DropdownMenuTrigger.displayName = "DropdownMenuTrigger"
|
|
35
24
|
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
const DropdownMenuContent = React.forwardRef<
|
|
26
|
+
React.ElementRef<typeof MenuPrimitive.Portal>,
|
|
27
|
+
MenuPrimitive.Popup.Props &
|
|
28
|
+
Pick<
|
|
29
|
+
MenuPrimitive.Positioner.Props,
|
|
30
|
+
"align" | "alignOffset" | "side" | "sideOffset"
|
|
31
|
+
>
|
|
32
|
+
>(({
|
|
33
|
+
align = "start",
|
|
34
|
+
alignOffset = 0,
|
|
35
|
+
side = "bottom",
|
|
38
36
|
sideOffset = 4,
|
|
37
|
+
className,
|
|
39
38
|
...props
|
|
40
|
-
}:
|
|
39
|
+
}: MenuPrimitive.Popup.Props &
|
|
40
|
+
Pick<
|
|
41
|
+
MenuPrimitive.Positioner.Props,
|
|
42
|
+
"align" | "alignOffset" | "side" | "sideOffset"
|
|
43
|
+
>, ref) => {
|
|
41
44
|
return (
|
|
42
|
-
<
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
+
<MenuPrimitive.Portal>
|
|
46
|
+
<MenuPrimitive.Positioner
|
|
47
|
+
className="isolate z-50 outline-none"
|
|
48
|
+
align={align}
|
|
49
|
+
alignOffset={alignOffset}
|
|
50
|
+
side={side}
|
|
45
51
|
sideOffset={sideOffset}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
>
|
|
53
|
+
<MenuPrimitive.Popup
|
|
54
|
+
ref={ref}
|
|
55
|
+
data-slot="dropdown-menu-content"
|
|
56
|
+
className={cn("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-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:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95", className )}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
</MenuPrimitive.Positioner>
|
|
60
|
+
</MenuPrimitive.Portal>
|
|
61
|
+
)
|
|
62
|
+
})
|
|
63
|
+
DropdownMenuContent.displayName = "DropdownMenuContent"
|
|
64
|
+
|
|
65
|
+
function DropdownMenuGroup({ ...props }: MenuPrimitive.Group.Props) {
|
|
66
|
+
return <MenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
|
|
54
67
|
}
|
|
55
68
|
|
|
56
|
-
function
|
|
69
|
+
function DropdownMenuLabel({
|
|
70
|
+
className,
|
|
71
|
+
inset,
|
|
57
72
|
...props
|
|
58
|
-
}:
|
|
73
|
+
}: MenuPrimitive.GroupLabel.Props & {
|
|
74
|
+
inset?: boolean
|
|
75
|
+
}) {
|
|
59
76
|
return (
|
|
60
|
-
<
|
|
61
|
-
|
|
77
|
+
<MenuPrimitive.GroupLabel
|
|
78
|
+
data-slot="dropdown-menu-label"
|
|
79
|
+
data-inset={inset}
|
|
80
|
+
className={cn(
|
|
81
|
+
"px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",
|
|
82
|
+
className
|
|
83
|
+
)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
)
|
|
62
87
|
}
|
|
63
88
|
|
|
64
|
-
|
|
89
|
+
const DropdownMenuItem = React.forwardRef<
|
|
90
|
+
React.ElementRef<typeof MenuPrimitive.Item>,
|
|
91
|
+
MenuPrimitive.Item.Props & {
|
|
92
|
+
inset?: boolean
|
|
93
|
+
variant?: "default" | "destructive"
|
|
94
|
+
}
|
|
95
|
+
>(({
|
|
65
96
|
className,
|
|
66
97
|
inset,
|
|
67
98
|
variant = "default",
|
|
68
99
|
...props
|
|
69
|
-
}:
|
|
70
|
-
inset?: boolean
|
|
71
|
-
variant?: "default" | "destructive"
|
|
72
|
-
}) {
|
|
73
|
-
return (
|
|
74
|
-
<DropdownMenuPrimitive.Item
|
|
100
|
+
}: MenuPrimitive.Item.Props & {
|
|
101
|
+
inset?: boolean
|
|
102
|
+
variant?: "default" | "destructive"
|
|
103
|
+
}, ref) => {
|
|
104
|
+
return ( <MenuPrimitive.Item ref={ref}
|
|
75
105
|
data-slot="dropdown-menu-item"
|
|
76
106
|
data-inset={inset}
|
|
77
107
|
data-variant={variant}
|
|
78
108
|
className={cn(
|
|
79
|
-
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-
|
|
109
|
+
"group/dropdown-menu-item relative flex cursor-pointer items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
|
|
80
110
|
className
|
|
81
111
|
)}
|
|
82
112
|
{...props}
|
|
83
113
|
/>
|
|
84
|
-
)
|
|
114
|
+
)
|
|
115
|
+
})
|
|
116
|
+
DropdownMenuItem.displayName = "DropdownMenuItem"
|
|
117
|
+
|
|
118
|
+
function DropdownMenuSub({ ...props }: MenuPrimitive.SubmenuRoot.Props) {
|
|
119
|
+
return <MenuPrimitive.SubmenuRoot data-slot="dropdown-menu-sub" {...props} />
|
|
85
120
|
}
|
|
86
121
|
|
|
87
|
-
|
|
122
|
+
const DropdownMenuSubTrigger = React.forwardRef<
|
|
123
|
+
React.ElementRef<typeof MenuPrimitive.SubmenuTrigger>,
|
|
124
|
+
MenuPrimitive.SubmenuTrigger.Props & {
|
|
125
|
+
inset?: boolean
|
|
126
|
+
}
|
|
127
|
+
>(({
|
|
88
128
|
className,
|
|
129
|
+
inset,
|
|
89
130
|
children,
|
|
90
|
-
checked,
|
|
91
131
|
...props
|
|
92
|
-
}:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
132
|
+
}: MenuPrimitive.SubmenuTrigger.Props & {
|
|
133
|
+
inset?: boolean
|
|
134
|
+
}, ref) => {
|
|
135
|
+
return ( <MenuPrimitive.SubmenuTrigger ref={ref}
|
|
136
|
+
data-slot="dropdown-menu-sub-trigger"
|
|
137
|
+
data-inset={inset}
|
|
96
138
|
className={cn(
|
|
97
|
-
"
|
|
139
|
+
"flex cursor-pointer items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
98
140
|
className
|
|
99
141
|
)}
|
|
100
|
-
checked={checked}
|
|
101
142
|
{...props}
|
|
102
143
|
>
|
|
103
|
-
<span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
|
|
104
|
-
<DropdownMenuPrimitive.ItemIndicator>
|
|
105
|
-
<CheckIcon className="size-4" />
|
|
106
|
-
</DropdownMenuPrimitive.ItemIndicator>
|
|
107
|
-
</span>
|
|
108
144
|
{children}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
145
|
+
<ChevronRightIcon className="ml-auto" />
|
|
146
|
+
</MenuPrimitive.SubmenuTrigger>
|
|
147
|
+
)
|
|
148
|
+
})
|
|
149
|
+
DropdownMenuSubTrigger.displayName = "DropdownMenuSubTrigger"
|
|
112
150
|
|
|
113
|
-
|
|
151
|
+
const DropdownMenuSubContent = React.forwardRef<
|
|
152
|
+
React.ElementRef<typeof DropdownMenuContent>,
|
|
153
|
+
React.ComponentProps<typeof DropdownMenuContent>
|
|
154
|
+
>(({
|
|
155
|
+
align = "start",
|
|
156
|
+
alignOffset = -3,
|
|
157
|
+
side = "right",
|
|
158
|
+
sideOffset = 0,
|
|
159
|
+
className,
|
|
114
160
|
...props
|
|
115
|
-
}: React.ComponentProps<typeof
|
|
116
|
-
return (
|
|
117
|
-
|
|
118
|
-
data-
|
|
161
|
+
}: React.ComponentProps<typeof DropdownMenuContent>, ref) => {
|
|
162
|
+
return ( <DropdownMenuContent ref={ref}
|
|
163
|
+
data-slot="dropdown-menu-sub-content"
|
|
164
|
+
className={cn("w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 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", className )}
|
|
165
|
+
align={align}
|
|
166
|
+
alignOffset={alignOffset}
|
|
167
|
+
side={side}
|
|
168
|
+
sideOffset={sideOffset}
|
|
119
169
|
{...props}
|
|
120
170
|
/>
|
|
121
|
-
)
|
|
122
|
-
}
|
|
171
|
+
)
|
|
172
|
+
})
|
|
173
|
+
DropdownMenuSubContent.displayName = "DropdownMenuSubContent"
|
|
123
174
|
|
|
124
|
-
|
|
175
|
+
const DropdownMenuCheckboxItem = React.forwardRef<
|
|
176
|
+
React.ElementRef<typeof MenuPrimitive.CheckboxItem>,
|
|
177
|
+
MenuPrimitive.CheckboxItem.Props & {
|
|
178
|
+
inset?: boolean
|
|
179
|
+
}
|
|
180
|
+
>(({
|
|
125
181
|
className,
|
|
126
182
|
children,
|
|
183
|
+
checked,
|
|
184
|
+
inset,
|
|
127
185
|
...props
|
|
128
|
-
}:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
186
|
+
}: MenuPrimitive.CheckboxItem.Props & {
|
|
187
|
+
inset?: boolean
|
|
188
|
+
}, ref) => {
|
|
189
|
+
return ( <MenuPrimitive.CheckboxItem ref={ref}
|
|
190
|
+
data-slot="dropdown-menu-checkbox-item"
|
|
191
|
+
data-inset={inset}
|
|
132
192
|
className={cn(
|
|
133
|
-
"
|
|
193
|
+
"relative flex cursor-pointer 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 focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
134
194
|
className
|
|
135
195
|
)}
|
|
196
|
+
checked={checked}
|
|
136
197
|
{...props}
|
|
137
198
|
>
|
|
138
|
-
<span
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
199
|
+
<span
|
|
200
|
+
className="pointer-events-none absolute right-2 flex items-center justify-center"
|
|
201
|
+
data-slot="dropdown-menu-checkbox-item-indicator"
|
|
202
|
+
>
|
|
203
|
+
<MenuPrimitive.CheckboxItemIndicator>
|
|
204
|
+
<CheckIcon
|
|
205
|
+
/>
|
|
206
|
+
</MenuPrimitive.CheckboxItemIndicator>
|
|
142
207
|
</span>
|
|
143
208
|
{children}
|
|
144
|
-
</
|
|
145
|
-
)
|
|
209
|
+
</MenuPrimitive.CheckboxItem>
|
|
210
|
+
)
|
|
211
|
+
})
|
|
212
|
+
DropdownMenuCheckboxItem.displayName = "DropdownMenuCheckboxItem"
|
|
213
|
+
|
|
214
|
+
function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) {
|
|
215
|
+
return (
|
|
216
|
+
<MenuPrimitive.RadioGroup
|
|
217
|
+
data-slot="dropdown-menu-radio-group"
|
|
218
|
+
{...props}
|
|
219
|
+
/>
|
|
220
|
+
)
|
|
146
221
|
}
|
|
147
222
|
|
|
148
|
-
|
|
223
|
+
const DropdownMenuRadioItem = React.forwardRef<
|
|
224
|
+
React.ElementRef<typeof MenuPrimitive.RadioItem>,
|
|
225
|
+
MenuPrimitive.RadioItem.Props & {
|
|
226
|
+
inset?: boolean
|
|
227
|
+
}
|
|
228
|
+
>(({
|
|
149
229
|
className,
|
|
230
|
+
children,
|
|
150
231
|
inset,
|
|
151
232
|
...props
|
|
152
|
-
}:
|
|
153
|
-
inset?: boolean
|
|
154
|
-
}) {
|
|
155
|
-
return (
|
|
156
|
-
|
|
157
|
-
data-slot="dropdown-menu-label"
|
|
233
|
+
}: MenuPrimitive.RadioItem.Props & {
|
|
234
|
+
inset?: boolean
|
|
235
|
+
}, ref) => {
|
|
236
|
+
return ( <MenuPrimitive.RadioItem ref={ref}
|
|
237
|
+
data-slot="dropdown-menu-radio-item"
|
|
158
238
|
data-inset={inset}
|
|
159
239
|
className={cn(
|
|
160
|
-
"
|
|
240
|
+
"relative flex cursor-pointer 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 focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
161
241
|
className
|
|
162
242
|
)}
|
|
163
243
|
{...props}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
244
|
+
>
|
|
245
|
+
<span
|
|
246
|
+
className="pointer-events-none absolute right-2 flex items-center justify-center"
|
|
247
|
+
data-slot="dropdown-menu-radio-item-indicator"
|
|
248
|
+
>
|
|
249
|
+
<MenuPrimitive.RadioItemIndicator>
|
|
250
|
+
<CheckIcon
|
|
251
|
+
/>
|
|
252
|
+
</MenuPrimitive.RadioItemIndicator>
|
|
253
|
+
</span>
|
|
254
|
+
{children}
|
|
255
|
+
</MenuPrimitive.RadioItem>
|
|
256
|
+
)
|
|
257
|
+
})
|
|
258
|
+
DropdownMenuRadioItem.displayName = "DropdownMenuRadioItem"
|
|
167
259
|
|
|
168
260
|
function DropdownMenuSeparator({
|
|
169
261
|
className,
|
|
170
262
|
...props
|
|
171
|
-
}:
|
|
263
|
+
}: MenuPrimitive.Separator.Props) {
|
|
172
264
|
return (
|
|
173
|
-
<
|
|
265
|
+
<MenuPrimitive.Separator
|
|
174
266
|
data-slot="dropdown-menu-separator"
|
|
175
|
-
className={cn("
|
|
267
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
176
268
|
{...props}
|
|
177
269
|
/>
|
|
178
|
-
)
|
|
270
|
+
)
|
|
179
271
|
}
|
|
180
272
|
|
|
181
273
|
function DropdownMenuShortcut({
|
|
@@ -186,58 +278,12 @@ function DropdownMenuShortcut({
|
|
|
186
278
|
<span
|
|
187
279
|
data-slot="dropdown-menu-shortcut"
|
|
188
280
|
className={cn(
|
|
189
|
-
"
|
|
281
|
+
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",
|
|
190
282
|
className
|
|
191
283
|
)}
|
|
192
284
|
{...props}
|
|
193
285
|
/>
|
|
194
|
-
)
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function DropdownMenuSub({
|
|
198
|
-
...props
|
|
199
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
|
|
200
|
-
return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
function DropdownMenuSubTrigger({
|
|
204
|
-
className,
|
|
205
|
-
inset,
|
|
206
|
-
children,
|
|
207
|
-
...props
|
|
208
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
209
|
-
inset?: boolean;
|
|
210
|
-
}) {
|
|
211
|
-
return (
|
|
212
|
-
<DropdownMenuPrimitive.SubTrigger
|
|
213
|
-
data-slot="dropdown-menu-sub-trigger"
|
|
214
|
-
data-inset={inset}
|
|
215
|
-
className={cn(
|
|
216
|
-
"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-pointer items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",
|
|
217
|
-
className
|
|
218
|
-
)}
|
|
219
|
-
{...props}
|
|
220
|
-
>
|
|
221
|
-
{children}
|
|
222
|
-
<ChevronRightIcon className="ml-auto size-4" />
|
|
223
|
-
</DropdownMenuPrimitive.SubTrigger>
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function DropdownMenuSubContent({
|
|
228
|
-
className,
|
|
229
|
-
...props
|
|
230
|
-
}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
|
|
231
|
-
return (
|
|
232
|
-
<DropdownMenuPrimitive.SubContent
|
|
233
|
-
data-slot="dropdown-menu-sub-content"
|
|
234
|
-
className={cn(
|
|
235
|
-
"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",
|
|
236
|
-
className
|
|
237
|
-
)}
|
|
238
|
-
{...props}
|
|
239
|
-
/>
|
|
240
|
-
);
|
|
286
|
+
)
|
|
241
287
|
}
|
|
242
288
|
|
|
243
289
|
export {
|
|
@@ -256,4 +302,4 @@ export {
|
|
|
256
302
|
DropdownMenuSub,
|
|
257
303
|
DropdownMenuSubTrigger,
|
|
258
304
|
DropdownMenuSubContent,
|
|
259
|
-
}
|
|
305
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Empty',
|
|
5
|
+
parameters: { layout: 'centered' },
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
} satisfies Meta;
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
|
|
12
|
+
export const Default: Story = {
|
|
13
|
+
render: () => (
|
|
14
|
+
<div className="p-4 w-full h-full flex items-center justify-center">
|
|
15
|
+
<div className="p-4 border rounded bg-muted/50 text-muted-foreground text-sm">Empty — needs manual template</div>
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
|
|
4
|
+
describe('Empty Accessibility', () => {
|
|
5
|
+
it('should have no accessibility violations in basic render', async () => {
|
|
6
|
+
const Wrapper = () => (
|
|
7
|
+
<div className="p-4 border rounded bg-muted/50 text-muted-foreground text-sm">Empty — needs manual template</div>
|
|
8
|
+
);
|
|
9
|
+
const { container } = render(<Wrapper />);
|
|
10
|
+
const results = await axe(container);
|
|
11
|
+
expect(results).toHaveNoViolations();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
1
3
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
2
4
|
|
|
3
5
|
import { cn } from "@/lib/utils"
|
|
@@ -7,7 +9,7 @@ function Empty({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
7
9
|
<div
|
|
8
10
|
data-slot="empty"
|
|
9
11
|
className={cn(
|
|
10
|
-
"flex min-w-0 flex-1 flex-col items-center justify-center gap-
|
|
12
|
+
"flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",
|
|
11
13
|
className
|
|
12
14
|
)}
|
|
13
15
|
{...props}
|
|
@@ -19,10 +21,7 @@ function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
19
21
|
return (
|
|
20
22
|
<div
|
|
21
23
|
data-slot="empty-header"
|
|
22
|
-
className={cn(
|
|
23
|
-
"flex max-w-sm flex-col items-center gap-2 text-center",
|
|
24
|
-
className
|
|
25
|
-
)}
|
|
24
|
+
className={cn("flex max-w-sm flex-col items-center gap-2", className)}
|
|
26
25
|
{...props}
|
|
27
26
|
/>
|
|
28
27
|
)
|
|
@@ -34,7 +33,7 @@ const emptyMediaVariants = cva(
|
|
|
34
33
|
variants: {
|
|
35
34
|
variant: {
|
|
36
35
|
default: "bg-transparent",
|
|
37
|
-
icon: "
|
|
36
|
+
icon: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4",
|
|
38
37
|
},
|
|
39
38
|
},
|
|
40
39
|
defaultVariants: {
|
|
@@ -62,7 +61,10 @@ function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
62
61
|
return (
|
|
63
62
|
<div
|
|
64
63
|
data-slot="empty-title"
|
|
65
|
-
className={cn(
|
|
64
|
+
className={cn(
|
|
65
|
+
"font-heading text-sm font-medium tracking-tight",
|
|
66
|
+
className
|
|
67
|
+
)}
|
|
66
68
|
{...props}
|
|
67
69
|
/>
|
|
68
70
|
)
|
|
@@ -73,7 +75,7 @@ function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
|
73
75
|
<div
|
|
74
76
|
data-slot="empty-description"
|
|
75
77
|
className={cn(
|
|
76
|
-
"text-muted-foreground [&>a
|
|
78
|
+
"text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
77
79
|
className
|
|
78
80
|
)}
|
|
79
81
|
{...props}
|
|
@@ -86,7 +88,7 @@ function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
86
88
|
<div
|
|
87
89
|
data-slot="empty-content"
|
|
88
90
|
className={cn(
|
|
89
|
-
"flex w-full
|
|
91
|
+
"flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance",
|
|
90
92
|
className
|
|
91
93
|
)}
|
|
92
94
|
{...props}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Design System/Field',
|
|
5
|
+
parameters: { layout: 'centered' },
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
} satisfies Meta;
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
|
|
12
|
+
export const Default: Story = {
|
|
13
|
+
render: () => (
|
|
14
|
+
<div className="p-4 w-full h-full flex items-center justify-center">
|
|
15
|
+
<div className="p-4 border rounded bg-muted/50 text-muted-foreground text-sm">Field — needs manual template</div>
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
|
|
4
|
+
describe('Field Accessibility', () => {
|
|
5
|
+
it('should have no accessibility violations in basic render', async () => {
|
|
6
|
+
const Wrapper = () => (
|
|
7
|
+
<div className="p-4 border rounded bg-muted/50 text-muted-foreground text-sm">Field — needs manual template</div>
|
|
8
|
+
);
|
|
9
|
+
const { container } = render(<Wrapper />);
|
|
10
|
+
const results = await axe(container);
|
|
11
|
+
expect(results).toHaveNoViolations();
|
|
12
|
+
});
|
|
13
|
+
});
|