@inspirare/design-system 0.0.22 → 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 +42 -41
- 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
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Questionnaire as QuestionnairePrimitive } from "@shadcn/react/questionnaire"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
import { buttonVariants, type Button } from "@/components/ui/button"
|
|
8
|
+
import { CheckIcon } from "lucide-react"
|
|
9
|
+
|
|
10
|
+
function Questionnaire({
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Root>) {
|
|
14
|
+
return (
|
|
15
|
+
<QuestionnairePrimitive.Root
|
|
16
|
+
data-slot="questionnaire"
|
|
17
|
+
className={cn("flex w-full min-w-0 flex-col gap-4", className)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function QuestionnaireProgress({
|
|
24
|
+
className,
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Progress>) {
|
|
27
|
+
return (
|
|
28
|
+
<QuestionnairePrimitive.Progress
|
|
29
|
+
data-slot="questionnaire-progress"
|
|
30
|
+
className={cn(
|
|
31
|
+
"min-h-[1lh] w-fit min-w-[14ch] text-xs font-medium text-muted-foreground tabular-nums",
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function QuestionnaireItem({
|
|
40
|
+
className,
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Item>) {
|
|
43
|
+
return (
|
|
44
|
+
<QuestionnairePrimitive.Item
|
|
45
|
+
data-slot="questionnaire-item"
|
|
46
|
+
className={cn(
|
|
47
|
+
"flex min-w-0 flex-col gap-4 border-0 p-0 outline-none",
|
|
48
|
+
className
|
|
49
|
+
)}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function QuestionnaireTitle({
|
|
56
|
+
className,
|
|
57
|
+
...props
|
|
58
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Title>) {
|
|
59
|
+
return (
|
|
60
|
+
<QuestionnairePrimitive.Title
|
|
61
|
+
data-slot="questionnaire-title"
|
|
62
|
+
className={cn(
|
|
63
|
+
"font-heading text-base leading-snug font-medium text-pretty [&:not(:has(~[data-slot=questionnaire-description]))]:mb-4",
|
|
64
|
+
className
|
|
65
|
+
)}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function QuestionnaireDescription({
|
|
72
|
+
className,
|
|
73
|
+
...props
|
|
74
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Description>) {
|
|
75
|
+
return (
|
|
76
|
+
<QuestionnairePrimitive.Description
|
|
77
|
+
data-slot="questionnaire-description"
|
|
78
|
+
className={cn("text-sm text-pretty text-muted-foreground", className)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function QuestionnaireChoices({
|
|
85
|
+
className,
|
|
86
|
+
...props
|
|
87
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Choices>) {
|
|
88
|
+
return (
|
|
89
|
+
<QuestionnairePrimitive.Choices
|
|
90
|
+
data-slot="questionnaire-choices"
|
|
91
|
+
className={cn(
|
|
92
|
+
"group/questionnaire-choices grid min-w-0 gap-2",
|
|
93
|
+
className
|
|
94
|
+
)}
|
|
95
|
+
{...props}
|
|
96
|
+
/>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function QuestionnaireChoice({
|
|
101
|
+
children,
|
|
102
|
+
className,
|
|
103
|
+
...props
|
|
104
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Choice>) {
|
|
105
|
+
return (
|
|
106
|
+
<QuestionnairePrimitive.Choice
|
|
107
|
+
data-slot="questionnaire-choice"
|
|
108
|
+
className={cn(
|
|
109
|
+
"group/questionnaire-choice relative flex min-h-11 cursor-pointer items-start gap-2.5 rounded-lg border border-input bg-transparent px-3 py-2.5 text-start text-sm transition-colors outline-none select-none hover:bg-muted/50 has-[>input:focus-visible]:border-ring has-[>input:focus-visible]:ring-3 has-[>input:focus-visible]:ring-ring/50 data-invalid:border-destructive dark:bg-input/20 data-checked:border-primary/40 data-checked:bg-muted dark:data-checked:bg-muted",
|
|
110
|
+
"data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
111
|
+
className
|
|
112
|
+
)}
|
|
113
|
+
{...props}
|
|
114
|
+
>
|
|
115
|
+
<QuestionnairePrimitive.ChoiceInput
|
|
116
|
+
data-slot="questionnaire-choice-input"
|
|
117
|
+
className="absolute inset-0 z-10 size-full cursor-pointer opacity-0"
|
|
118
|
+
/>
|
|
119
|
+
<span
|
|
120
|
+
aria-hidden="true"
|
|
121
|
+
data-slot="questionnaire-choice-indicator"
|
|
122
|
+
className="pointer-events-none relative flex size-4 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-[4px] border border-input group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5 group-data-[type=radio]/questionnaire-choice:rounded-full group-data-checked/questionnaire-choice:border-primary group-data-checked/questionnaire-choice:bg-primary group-data-checked/questionnaire-choice:text-primary-foreground dark:bg-input/30 dark:group-data-checked/questionnaire-choice:bg-primary"
|
|
123
|
+
>
|
|
124
|
+
<span
|
|
125
|
+
data-slot="questionnaire-choice-indicator-dot"
|
|
126
|
+
className="hidden size-2 rounded-full bg-primary-foreground group-data-[type=checkbox]/questionnaire-choice:hidden group-data-checked/questionnaire-choice:block"
|
|
127
|
+
/>
|
|
128
|
+
<CheckIcon data-slot="questionnaire-choice-indicator-check" className="hidden size-3.5 group-data-[type=radio]/questionnaire-choice:hidden group-data-checked/questionnaire-choice:block" />
|
|
129
|
+
</span>
|
|
130
|
+
<QuestionnairePrimitive.ChoiceLabel
|
|
131
|
+
data-slot="questionnaire-choice-label"
|
|
132
|
+
className="flex min-w-0 flex-1 flex-col gap-0.5 leading-snug"
|
|
133
|
+
>
|
|
134
|
+
{children}
|
|
135
|
+
</QuestionnairePrimitive.ChoiceLabel>
|
|
136
|
+
<QuestionnairePrimitive.ChoiceShortcut
|
|
137
|
+
data-slot="questionnaire-choice-shortcut"
|
|
138
|
+
className="pointer-events-none ms-auto hidden size-5 shrink-0 translate-y-[--spacing(0.45)] items-center justify-center rounded-md border border-input bg-background font-mono text-[0.625rem] leading-none font-medium text-muted-foreground group-has-data-[slot=questionnaire-choice-description]/questionnaire-choice:translate-y-0.5 group-data-[shortcut]/questionnaire-choice:inline-flex"
|
|
139
|
+
/>
|
|
140
|
+
</QuestionnairePrimitive.Choice>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function QuestionnaireChoiceDescription({
|
|
145
|
+
className,
|
|
146
|
+
...props
|
|
147
|
+
}: React.ComponentProps<"span">) {
|
|
148
|
+
return (
|
|
149
|
+
<span
|
|
150
|
+
data-slot="questionnaire-choice-description"
|
|
151
|
+
className={cn("text-muted-foreground", className)}
|
|
152
|
+
{...props}
|
|
153
|
+
/>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function QuestionnaireInput({
|
|
158
|
+
className,
|
|
159
|
+
...props
|
|
160
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Input>) {
|
|
161
|
+
return (
|
|
162
|
+
<div
|
|
163
|
+
data-slot="questionnaire-input-wrapper"
|
|
164
|
+
className="group/questionnaire-input relative w-full min-w-0"
|
|
165
|
+
>
|
|
166
|
+
<QuestionnairePrimitive.Input
|
|
167
|
+
data-slot="questionnaire-input"
|
|
168
|
+
className={cn(
|
|
169
|
+
"h-8 min-h-11 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-[color,box-shadow,background-color] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 sm:min-h-0 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
170
|
+
"selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground",
|
|
171
|
+
className
|
|
172
|
+
)}
|
|
173
|
+
{...props}
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function QuestionnaireError({
|
|
180
|
+
className,
|
|
181
|
+
...props
|
|
182
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Error>) {
|
|
183
|
+
return (
|
|
184
|
+
<QuestionnairePrimitive.Error
|
|
185
|
+
data-slot="questionnaire-error"
|
|
186
|
+
className={cn("mt-2 text-sm text-destructive", className)}
|
|
187
|
+
{...props}
|
|
188
|
+
/>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function QuestionnaireActions({
|
|
193
|
+
className,
|
|
194
|
+
...props
|
|
195
|
+
}: React.ComponentProps<"div">) {
|
|
196
|
+
return (
|
|
197
|
+
<div
|
|
198
|
+
data-slot="questionnaire-actions"
|
|
199
|
+
className={cn(
|
|
200
|
+
"grid min-h-11 w-full grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-2 sm:min-h-8",
|
|
201
|
+
className
|
|
202
|
+
)}
|
|
203
|
+
{...props}
|
|
204
|
+
/>
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function QuestionnairePrevious({
|
|
209
|
+
children,
|
|
210
|
+
className,
|
|
211
|
+
size = "default",
|
|
212
|
+
variant = "outline",
|
|
213
|
+
...props
|
|
214
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Previous> &
|
|
215
|
+
Pick<React.ComponentProps<typeof Button>, "size" | "variant">) {
|
|
216
|
+
return (
|
|
217
|
+
<QuestionnairePrimitive.Previous
|
|
218
|
+
data-slot="questionnaire-previous"
|
|
219
|
+
data-size={size}
|
|
220
|
+
data-variant={variant}
|
|
221
|
+
className={cn(
|
|
222
|
+
buttonVariants({ size, variant }),
|
|
223
|
+
"col-start-1 row-start-1 min-h-11 justify-self-start sm:min-h-0",
|
|
224
|
+
className
|
|
225
|
+
)}
|
|
226
|
+
{...props}
|
|
227
|
+
>
|
|
228
|
+
{children ?? "Previous"}
|
|
229
|
+
</QuestionnairePrimitive.Previous>
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function QuestionnaireSkip({
|
|
234
|
+
children,
|
|
235
|
+
className,
|
|
236
|
+
size = "default",
|
|
237
|
+
variant = "outline",
|
|
238
|
+
...props
|
|
239
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Skip> &
|
|
240
|
+
Pick<React.ComponentProps<typeof Button>, "size" | "variant">) {
|
|
241
|
+
return (
|
|
242
|
+
<QuestionnairePrimitive.Skip
|
|
243
|
+
data-slot="questionnaire-skip"
|
|
244
|
+
data-size={size}
|
|
245
|
+
data-variant={variant}
|
|
246
|
+
className={cn(
|
|
247
|
+
buttonVariants({ size, variant }),
|
|
248
|
+
"col-start-2 row-start-1 min-h-11 justify-self-end sm:min-h-0",
|
|
249
|
+
className
|
|
250
|
+
)}
|
|
251
|
+
{...props}
|
|
252
|
+
>
|
|
253
|
+
{children ?? "Skip"}
|
|
254
|
+
</QuestionnairePrimitive.Skip>
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function QuestionnaireNext({
|
|
259
|
+
children,
|
|
260
|
+
className,
|
|
261
|
+
size = "default",
|
|
262
|
+
variant = "default",
|
|
263
|
+
...props
|
|
264
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Next> &
|
|
265
|
+
Pick<React.ComponentProps<typeof Button>, "size" | "variant">) {
|
|
266
|
+
return (
|
|
267
|
+
<QuestionnairePrimitive.Next
|
|
268
|
+
data-slot="questionnaire-next"
|
|
269
|
+
data-size={size}
|
|
270
|
+
data-variant={variant}
|
|
271
|
+
className={cn(
|
|
272
|
+
buttonVariants({ size, variant }),
|
|
273
|
+
"col-start-3 row-start-1 min-h-11 justify-self-end sm:min-h-0",
|
|
274
|
+
className
|
|
275
|
+
)}
|
|
276
|
+
{...props}
|
|
277
|
+
>
|
|
278
|
+
{children ?? "Next"}
|
|
279
|
+
</QuestionnairePrimitive.Next>
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function QuestionnaireSubmit({
|
|
284
|
+
children,
|
|
285
|
+
className,
|
|
286
|
+
size = "default",
|
|
287
|
+
variant = "default",
|
|
288
|
+
...props
|
|
289
|
+
}: React.ComponentProps<typeof QuestionnairePrimitive.Submit> &
|
|
290
|
+
Pick<React.ComponentProps<typeof Button>, "size" | "variant">) {
|
|
291
|
+
return (
|
|
292
|
+
<QuestionnairePrimitive.Submit
|
|
293
|
+
data-slot="questionnaire-submit"
|
|
294
|
+
data-size={size}
|
|
295
|
+
data-variant={variant}
|
|
296
|
+
className={cn(
|
|
297
|
+
buttonVariants({ size, variant }),
|
|
298
|
+
"col-start-3 row-start-1 min-h-11 justify-self-end sm:min-h-0",
|
|
299
|
+
className
|
|
300
|
+
)}
|
|
301
|
+
{...props}
|
|
302
|
+
>
|
|
303
|
+
{children ?? "Submit"}
|
|
304
|
+
</QuestionnairePrimitive.Submit>
|
|
305
|
+
)
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export {
|
|
309
|
+
Questionnaire,
|
|
310
|
+
QuestionnaireActions,
|
|
311
|
+
QuestionnaireChoice,
|
|
312
|
+
QuestionnaireChoiceDescription,
|
|
313
|
+
QuestionnaireChoices,
|
|
314
|
+
QuestionnaireDescription,
|
|
315
|
+
QuestionnaireError,
|
|
316
|
+
QuestionnaireInput,
|
|
317
|
+
QuestionnaireItem,
|
|
318
|
+
QuestionnaireNext,
|
|
319
|
+
QuestionnairePrevious,
|
|
320
|
+
QuestionnaireProgress,
|
|
321
|
+
QuestionnaireSkip,
|
|
322
|
+
QuestionnaireSubmit,
|
|
323
|
+
QuestionnaireTitle,
|
|
324
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { RadioGroup, RadioGroupItem } from "./radio-group"; import { Label } from "./label";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Design System/RadioGroup',
|
|
6
|
+
parameters: { layout: 'centered' },
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta;
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
|
|
13
|
+
export const Default: Story = {
|
|
14
|
+
render: () => (
|
|
15
|
+
<div className="p-4 w-full h-full flex items-center justify-center">
|
|
16
|
+
<RadioGroup defaultValue="option-one"><div className="flex items-center space-x-2"><RadioGroupItem value="option-one" id="option-one" /><Label htmlFor="option-one">Option One</Label></div><div className="flex items-center space-x-2"><RadioGroupItem value="option-two" id="option-two" /><Label htmlFor="option-two">Option Two</Label></div></RadioGroup>
|
|
17
|
+
</div>
|
|
18
|
+
)
|
|
19
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
import { RadioGroup, RadioGroupItem } from "./radio-group"; import { Label } from "./label";
|
|
4
|
+
|
|
5
|
+
describe('RadioGroup Accessibility', () => {
|
|
6
|
+
it('should have no accessibility violations in basic render', async () => {
|
|
7
|
+
const Wrapper = () => (
|
|
8
|
+
<RadioGroup defaultValue="option-one"><div className="flex items-center space-x-2"><RadioGroupItem value="option-one" id="option-one" /><Label htmlFor="option-one">Option One</Label></div><div className="flex items-center space-x-2"><RadioGroupItem value="option-two" id="option-two" /><Label htmlFor="option-two">Option Two</Label></div></RadioGroup>
|
|
9
|
+
);
|
|
10
|
+
const { container } = render(<Wrapper />);
|
|
11
|
+
const results = await axe(container);
|
|
12
|
+
expect(results).toHaveNoViolations();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -1,42 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Radio as RadioPrimitive } from "@base-ui/react/radio"
|
|
4
|
+
import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group"
|
|
4
5
|
|
|
5
6
|
import { cn } from "@/lib/utils"
|
|
6
7
|
|
|
7
|
-
function RadioGroup({
|
|
8
|
-
className,
|
|
9
|
-
...props
|
|
10
|
-
}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
|
|
8
|
+
function RadioGroup({ className, ...props }: RadioGroupPrimitive.Props) {
|
|
11
9
|
return (
|
|
12
|
-
<RadioGroupPrimitive
|
|
10
|
+
<RadioGroupPrimitive
|
|
13
11
|
data-slot="radio-group"
|
|
14
|
-
className={cn("grid gap-
|
|
12
|
+
className={cn("grid w-full gap-2", className)}
|
|
15
13
|
{...props}
|
|
16
14
|
/>
|
|
17
15
|
)
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
function RadioGroupItem({
|
|
21
|
-
className,
|
|
22
|
-
...props
|
|
23
|
-
}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
|
|
18
|
+
function RadioGroupItem({ className, ...props }: RadioPrimitive.Root.Props) {
|
|
24
19
|
return (
|
|
25
|
-
<
|
|
20
|
+
<RadioPrimitive.Root
|
|
26
21
|
data-slot="radio-group-item"
|
|
27
22
|
className={cn(
|
|
28
|
-
"aspect-square size-4 shrink-0 rounded-full border border-input
|
|
23
|
+
"group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary cursor-pointer cursor-pointer",
|
|
29
24
|
className
|
|
30
25
|
)}
|
|
31
26
|
{...props}
|
|
32
27
|
>
|
|
33
|
-
<
|
|
28
|
+
<RadioPrimitive.Indicator
|
|
34
29
|
data-slot="radio-group-indicator"
|
|
35
|
-
className="
|
|
30
|
+
className="flex size-4 items-center justify-center"
|
|
36
31
|
>
|
|
37
|
-
<
|
|
38
|
-
</
|
|
39
|
-
</
|
|
32
|
+
<span className="absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground" />
|
|
33
|
+
</RadioPrimitive.Indicator>
|
|
34
|
+
</RadioPrimitive.Root>
|
|
40
35
|
)
|
|
41
36
|
}
|
|
42
37
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from "./resizable";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Design System/Resizable',
|
|
6
|
+
parameters: { layout: 'centered' },
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta;
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
|
|
13
|
+
export const Default: Story = {
|
|
14
|
+
render: () => (
|
|
15
|
+
<div className="p-4 w-full h-full flex items-center justify-center">
|
|
16
|
+
<ResizablePanelGroup className="max-w-md rounded-lg border"><ResizablePanel defaultSize={50}><div className="flex h-[200px] items-center justify-center p-6">One</div></ResizablePanel><ResizableHandle /><ResizablePanel defaultSize={50}><div className="flex h-[200px] items-center justify-center p-6">Two</div></ResizablePanel></ResizablePanelGroup>
|
|
17
|
+
</div>
|
|
18
|
+
)
|
|
19
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from "./resizable";
|
|
4
|
+
|
|
5
|
+
describe('Resizable Accessibility', () => {
|
|
6
|
+
it('should have no accessibility violations in basic render', async () => {
|
|
7
|
+
const Wrapper = () => (
|
|
8
|
+
<ResizablePanelGroup className="max-w-md rounded-lg border"><ResizablePanel defaultSize={50}><div className="flex h-[200px] items-center justify-center p-6">One</div></ResizablePanel><ResizableHandle /><ResizablePanel defaultSize={50}><div className="flex h-[200px] items-center justify-center p-6">Two</div></ResizablePanel></ResizablePanelGroup>
|
|
9
|
+
);
|
|
10
|
+
const { container } = render(<Wrapper />);
|
|
11
|
+
const results = await axe(container);
|
|
12
|
+
expect(results).toHaveNoViolations();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -1,43 +1,50 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import { GripVertical } from "lucide-react"
|
|
4
3
|
import * as ResizablePrimitive from "react-resizable-panels"
|
|
5
4
|
|
|
6
5
|
import { cn } from "@/lib/utils"
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
function ResizablePanelGroup({
|
|
9
8
|
className,
|
|
10
9
|
...props
|
|
11
|
-
}:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
className
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
}: ResizablePrimitive.GroupProps) {
|
|
11
|
+
return (
|
|
12
|
+
<ResizablePrimitive.Group
|
|
13
|
+
data-slot="resizable-panel-group"
|
|
14
|
+
className={cn(
|
|
15
|
+
"flex h-full w-full aria-[orientation=vertical]:flex-col",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
|
|
24
|
+
return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
|
|
25
|
+
}
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
function ResizableHandle({
|
|
28
|
+
withHandle,
|
|
25
29
|
className,
|
|
26
30
|
...props
|
|
27
|
-
}:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
)
|
|
31
|
+
}: ResizablePrimitive.SeparatorProps & {
|
|
32
|
+
withHandle?: boolean
|
|
33
|
+
}) {
|
|
34
|
+
return (
|
|
35
|
+
<ResizablePrimitive.Separator
|
|
36
|
+
data-slot="resizable-handle"
|
|
37
|
+
className={cn(
|
|
38
|
+
"relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
{withHandle && (
|
|
44
|
+
<div className="z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border" />
|
|
45
|
+
)}
|
|
46
|
+
</ResizablePrimitive.Separator>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
42
49
|
|
|
43
|
-
export {
|
|
50
|
+
export { ResizableHandle, ResizablePanel, ResizablePanelGroup }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { ScrollArea } from "./scroll-area";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Design System/ScrollArea',
|
|
6
|
+
parameters: { layout: 'centered' },
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta;
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
|
|
13
|
+
export const Default: Story = {
|
|
14
|
+
render: () => (
|
|
15
|
+
<div className="p-4 w-full h-full flex items-center justify-center">
|
|
16
|
+
<ScrollArea className="h-[200px] w-[350px] rounded-md border p-4">Jokester began sneaking into the castle in the middle of the night and leaving jokes all over the place.</ScrollArea>
|
|
17
|
+
</div>
|
|
18
|
+
)
|
|
19
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
import { ScrollArea } from "./scroll-area";
|
|
4
|
+
|
|
5
|
+
describe('ScrollArea Accessibility', () => {
|
|
6
|
+
it('should have no accessibility violations in basic render', async () => {
|
|
7
|
+
const Wrapper = () => (
|
|
8
|
+
<ScrollArea className="h-[200px] w-[350px] rounded-md border p-4">Jokester began sneaking into the castle in the middle of the night and leaving jokes all over the place.</ScrollArea>
|
|
9
|
+
);
|
|
10
|
+
const { container } = render(<Wrapper />);
|
|
11
|
+
const results = await axe(container);
|
|
12
|
+
expect(results).toHaveNoViolations();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -1,32 +1,54 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client"
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import * as React from "react";
|
|
3
|
+
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
className?: string;
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
};
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
function ScrollArea({
|
|
12
8
|
className,
|
|
13
9
|
children,
|
|
14
|
-
|
|
10
|
+
...props
|
|
11
|
+
}: ScrollAreaPrimitive.Root.Props) {
|
|
15
12
|
return (
|
|
16
|
-
<
|
|
13
|
+
<ScrollAreaPrimitive.Root
|
|
17
14
|
data-slot="scroll-area"
|
|
18
|
-
className={cn("relative
|
|
15
|
+
className={cn("relative", className)}
|
|
16
|
+
{...props}
|
|
19
17
|
>
|
|
20
|
-
<
|
|
18
|
+
<ScrollAreaPrimitive.Viewport
|
|
21
19
|
data-slot="scroll-area-viewport"
|
|
22
|
-
className="size-full rounded-[inherit]"
|
|
20
|
+
className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
|
|
23
21
|
>
|
|
24
22
|
{children}
|
|
25
|
-
</
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
</ScrollAreaPrimitive.Viewport>
|
|
24
|
+
<ScrollBar />
|
|
25
|
+
<ScrollAreaPrimitive.Corner />
|
|
26
|
+
</ScrollAreaPrimitive.Root>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
function ScrollBar({
|
|
31
|
+
className,
|
|
32
|
+
orientation = "vertical",
|
|
33
|
+
...props
|
|
34
|
+
}: ScrollAreaPrimitive.Scrollbar.Props) {
|
|
35
|
+
return (
|
|
36
|
+
<ScrollAreaPrimitive.Scrollbar
|
|
37
|
+
data-slot="scroll-area-scrollbar"
|
|
38
|
+
data-orientation={orientation}
|
|
39
|
+
orientation={orientation}
|
|
40
|
+
className={cn(
|
|
41
|
+
"flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",
|
|
42
|
+
className
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
>
|
|
46
|
+
<ScrollAreaPrimitive.Thumb
|
|
47
|
+
data-slot="scroll-area-thumb"
|
|
48
|
+
className="relative flex-1 rounded-full bg-border"
|
|
49
|
+
/>
|
|
50
|
+
</ScrollAreaPrimitive.Scrollbar>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
31
53
|
|
|
32
|
-
export { ScrollArea, ScrollBar }
|
|
54
|
+
export { ScrollArea, ScrollBar }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from "./select";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Design System/Select',
|
|
6
|
+
parameters: { layout: 'centered' },
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
} satisfies Meta;
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
|
|
13
|
+
export const Default: Story = {
|
|
14
|
+
render: () => (
|
|
15
|
+
<div className="p-4 w-full h-full flex items-center justify-center">
|
|
16
|
+
<Select><SelectTrigger aria-label="Select a theme" className="w-[180px]"><SelectValue placeholder="Theme" /></SelectTrigger><SelectContent><SelectItem value="light">Light</SelectItem><SelectItem value="dark">Dark</SelectItem><SelectItem value="system">System</SelectItem></SelectContent></Select>
|
|
17
|
+
</div>
|
|
18
|
+
)
|
|
19
|
+
};
|