@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,14 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from "./select";
|
|
4
|
+
|
|
5
|
+
describe('Select Accessibility', () => {
|
|
6
|
+
it('should have no accessibility violations in basic render', async () => {
|
|
7
|
+
const Wrapper = () => (
|
|
8
|
+
<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>
|
|
9
|
+
);
|
|
10
|
+
const { container } = render(<Wrapper />);
|
|
11
|
+
const results = await axe(container);
|
|
12
|
+
expect(results).toHaveNoViolations();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -1,27 +1,68 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client"
|
|
2
2
|
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import
|
|
5
|
-
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Select as SelectPrimitive } from "@base-ui/react/select"
|
|
6
5
|
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react"
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
9
|
+
const SelectContext = React.createContext<{
|
|
10
|
+
registerLabel: (val: any, label: string) => void;
|
|
11
|
+
getLabel: (val: any) => string | undefined;
|
|
12
|
+
} | null>(null);
|
|
14
13
|
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
function Select({ children, ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
15
|
+
const [labels, setLabels] = React.useState<Record<string, string>>({});
|
|
16
|
+
|
|
17
|
+
const registerLabel = React.useCallback((val: any, label: string) => {
|
|
18
|
+
setLabels((prev) => {
|
|
19
|
+
if (prev[val] === label) return prev;
|
|
20
|
+
return { ...prev, [val]: label };
|
|
21
|
+
});
|
|
22
|
+
}, []);
|
|
23
|
+
|
|
24
|
+
const getLabel = React.useCallback((val: any) => labels[val], [labels]);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<SelectContext.Provider value={{ registerLabel, getLabel }}>
|
|
28
|
+
<SelectPrimitive.Root {...props}>
|
|
29
|
+
{children}
|
|
30
|
+
</SelectPrimitive.Root>
|
|
31
|
+
</SelectContext.Provider>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
function SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {
|
|
35
|
+
return (
|
|
36
|
+
<SelectPrimitive.Group
|
|
37
|
+
data-slot="select-group"
|
|
38
|
+
className={cn("scroll-my-1 p-1", className)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
)
|
|
19
42
|
}
|
|
20
43
|
|
|
21
|
-
function SelectValue({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return
|
|
44
|
+
function SelectValue({ className, children, ...props }: SelectPrimitive.Value.Props) {
|
|
45
|
+
const ctx = React.useContext(SelectContext);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<SelectPrimitive.Value
|
|
49
|
+
data-slot="select-value"
|
|
50
|
+
className={cn("flex flex-1 text-left", className)}
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
53
|
+
{children ? children : (val: any) => {
|
|
54
|
+
if (!val) return null;
|
|
55
|
+
if (ctx) {
|
|
56
|
+
if (Array.isArray(val)) {
|
|
57
|
+
return val.map(v => ctx.getLabel(v) || v).join(', ');
|
|
58
|
+
}
|
|
59
|
+
const label = ctx.getLabel(val);
|
|
60
|
+
if (label) return label;
|
|
61
|
+
}
|
|
62
|
+
return val;
|
|
63
|
+
}}
|
|
64
|
+
</SelectPrimitive.Value>
|
|
65
|
+
)
|
|
25
66
|
}
|
|
26
67
|
|
|
27
68
|
function SelectTrigger({
|
|
@@ -29,146 +70,172 @@ function SelectTrigger({
|
|
|
29
70
|
size = "default",
|
|
30
71
|
children,
|
|
31
72
|
...props
|
|
32
|
-
}:
|
|
33
|
-
size?: "sm" | "default"
|
|
73
|
+
}: SelectPrimitive.Trigger.Props & {
|
|
74
|
+
size?: "sm" | "default"
|
|
34
75
|
}) {
|
|
35
76
|
return (
|
|
36
77
|
<SelectPrimitive.Trigger
|
|
37
78
|
data-slot="select-trigger"
|
|
38
79
|
data-size={size}
|
|
39
80
|
className={cn(
|
|
40
|
-
"
|
|
81
|
+
"flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none 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 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
41
82
|
className
|
|
42
83
|
)}
|
|
43
84
|
{...props}
|
|
44
85
|
>
|
|
45
86
|
{children}
|
|
46
|
-
<SelectPrimitive.Icon
|
|
47
|
-
|
|
48
|
-
|
|
87
|
+
<SelectPrimitive.Icon
|
|
88
|
+
render={
|
|
89
|
+
<ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
|
|
90
|
+
}
|
|
91
|
+
/>
|
|
49
92
|
</SelectPrimitive.Trigger>
|
|
50
|
-
)
|
|
93
|
+
)
|
|
51
94
|
}
|
|
52
95
|
|
|
53
96
|
function SelectContent({
|
|
54
97
|
className,
|
|
55
98
|
children,
|
|
56
|
-
|
|
99
|
+
side = "bottom",
|
|
100
|
+
sideOffset = 4,
|
|
101
|
+
align = "center",
|
|
102
|
+
alignOffset = 0,
|
|
103
|
+
alignItemWithTrigger = true,
|
|
57
104
|
...props
|
|
58
|
-
}:
|
|
105
|
+
}: SelectPrimitive.Popup.Props &
|
|
106
|
+
Pick<
|
|
107
|
+
SelectPrimitive.Positioner.Props,
|
|
108
|
+
"align" | "alignOffset" | "side" | "sideOffset" | "alignItemWithTrigger"
|
|
109
|
+
>) {
|
|
59
110
|
return (
|
|
60
111
|
<SelectPrimitive.Portal>
|
|
61
|
-
<SelectPrimitive.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
)}
|
|
69
|
-
position={position}
|
|
70
|
-
{...props}
|
|
112
|
+
<SelectPrimitive.Positioner
|
|
113
|
+
side={side}
|
|
114
|
+
sideOffset={sideOffset}
|
|
115
|
+
align={align}
|
|
116
|
+
alignOffset={alignOffset}
|
|
117
|
+
alignItemWithTrigger={alignItemWithTrigger}
|
|
118
|
+
className="isolate z-50"
|
|
71
119
|
>
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
78
|
-
)}
|
|
120
|
+
<SelectPrimitive.Popup
|
|
121
|
+
data-slot="select-content"
|
|
122
|
+
data-align-trigger={alignItemWithTrigger}
|
|
123
|
+
className={cn("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-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:fade-out-0 data-closed:zoom-out-95", className )}
|
|
124
|
+
{...props}
|
|
79
125
|
>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
126
|
+
<SelectScrollUpButton />
|
|
127
|
+
<SelectPrimitive.List>{children}</SelectPrimitive.List>
|
|
128
|
+
<SelectScrollDownButton />
|
|
129
|
+
</SelectPrimitive.Popup>
|
|
130
|
+
</SelectPrimitive.Positioner>
|
|
84
131
|
</SelectPrimitive.Portal>
|
|
85
|
-
)
|
|
132
|
+
)
|
|
86
133
|
}
|
|
87
134
|
|
|
88
135
|
function SelectLabel({
|
|
89
136
|
className,
|
|
90
137
|
...props
|
|
91
|
-
}:
|
|
138
|
+
}: SelectPrimitive.GroupLabel.Props) {
|
|
92
139
|
return (
|
|
93
|
-
<SelectPrimitive.
|
|
140
|
+
<SelectPrimitive.GroupLabel
|
|
94
141
|
data-slot="select-label"
|
|
95
|
-
className={cn("
|
|
142
|
+
className={cn("px-1.5 py-1 text-xs text-muted-foreground", className)}
|
|
96
143
|
{...props}
|
|
97
144
|
/>
|
|
98
|
-
)
|
|
145
|
+
)
|
|
99
146
|
}
|
|
100
147
|
|
|
101
148
|
function SelectItem({
|
|
102
149
|
className,
|
|
103
150
|
children,
|
|
151
|
+
value,
|
|
104
152
|
...props
|
|
105
|
-
}:
|
|
153
|
+
}: SelectPrimitive.Item.Props) {
|
|
154
|
+
const ctx = React.useContext(SelectContext);
|
|
155
|
+
const textRef = React.useRef<HTMLDivElement>(null);
|
|
156
|
+
|
|
157
|
+
React.useEffect(() => {
|
|
158
|
+
if (value !== undefined && textRef.current && ctx) {
|
|
159
|
+
const text = textRef.current.textContent;
|
|
160
|
+
if (text) {
|
|
161
|
+
ctx.registerLabel(value, text.trim());
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}, [value, ctx, children]);
|
|
165
|
+
|
|
106
166
|
return (
|
|
107
167
|
<SelectPrimitive.Item
|
|
168
|
+
value={value}
|
|
108
169
|
data-slot="select-item"
|
|
109
170
|
className={cn(
|
|
110
|
-
"
|
|
171
|
+
"relative flex w-full 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 not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
111
172
|
className
|
|
112
173
|
)}
|
|
113
174
|
{...props}
|
|
114
175
|
>
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
176
|
+
<SelectPrimitive.ItemText ref={textRef} className="flex flex-1 shrink-0 gap-2 whitespace-nowrap">
|
|
177
|
+
{children}
|
|
178
|
+
</SelectPrimitive.ItemText>
|
|
179
|
+
<SelectPrimitive.ItemIndicator
|
|
180
|
+
render={
|
|
181
|
+
<span className="pointer-events-none absolute right-2 flex size-4 items-center justify-center" />
|
|
182
|
+
}
|
|
183
|
+
>
|
|
184
|
+
<CheckIcon className="pointer-events-none" />
|
|
185
|
+
</SelectPrimitive.ItemIndicator>
|
|
121
186
|
</SelectPrimitive.Item>
|
|
122
|
-
)
|
|
187
|
+
)
|
|
123
188
|
}
|
|
124
189
|
|
|
125
190
|
function SelectSeparator({
|
|
126
191
|
className,
|
|
127
192
|
...props
|
|
128
|
-
}:
|
|
193
|
+
}: SelectPrimitive.Separator.Props) {
|
|
129
194
|
return (
|
|
130
195
|
<SelectPrimitive.Separator
|
|
131
196
|
data-slot="select-separator"
|
|
132
|
-
className={cn("
|
|
197
|
+
className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
|
|
133
198
|
{...props}
|
|
134
199
|
/>
|
|
135
|
-
)
|
|
200
|
+
)
|
|
136
201
|
}
|
|
137
202
|
|
|
138
203
|
function SelectScrollUpButton({
|
|
139
204
|
className,
|
|
140
205
|
...props
|
|
141
|
-
}: React.ComponentProps<typeof SelectPrimitive.
|
|
206
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {
|
|
142
207
|
return (
|
|
143
|
-
<SelectPrimitive.
|
|
208
|
+
<SelectPrimitive.ScrollUpArrow
|
|
144
209
|
data-slot="select-scroll-up-button"
|
|
145
210
|
className={cn(
|
|
146
|
-
"flex cursor-pointer items-center justify-center py-1",
|
|
211
|
+
"top-0 z-10 flex w-full cursor-pointer items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
147
212
|
className
|
|
148
213
|
)}
|
|
149
214
|
{...props}
|
|
150
215
|
>
|
|
151
|
-
<ChevronUpIcon
|
|
152
|
-
|
|
153
|
-
|
|
216
|
+
<ChevronUpIcon
|
|
217
|
+
/>
|
|
218
|
+
</SelectPrimitive.ScrollUpArrow>
|
|
219
|
+
)
|
|
154
220
|
}
|
|
155
221
|
|
|
156
222
|
function SelectScrollDownButton({
|
|
157
223
|
className,
|
|
158
224
|
...props
|
|
159
|
-
}: React.ComponentProps<typeof SelectPrimitive.
|
|
225
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {
|
|
160
226
|
return (
|
|
161
|
-
<SelectPrimitive.
|
|
227
|
+
<SelectPrimitive.ScrollDownArrow
|
|
162
228
|
data-slot="select-scroll-down-button"
|
|
163
229
|
className={cn(
|
|
164
|
-
"flex cursor-pointer items-center justify-center py-1",
|
|
230
|
+
"bottom-0 z-10 flex w-full cursor-pointer items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
|
|
165
231
|
className
|
|
166
232
|
)}
|
|
167
233
|
{...props}
|
|
168
234
|
>
|
|
169
|
-
<ChevronDownIcon
|
|
170
|
-
|
|
171
|
-
|
|
235
|
+
<ChevronDownIcon
|
|
236
|
+
/>
|
|
237
|
+
</SelectPrimitive.ScrollDownArrow>
|
|
238
|
+
)
|
|
172
239
|
}
|
|
173
240
|
|
|
174
241
|
export {
|
|
@@ -182,4 +249,4 @@ export {
|
|
|
182
249
|
SelectSeparator,
|
|
183
250
|
SelectTrigger,
|
|
184
251
|
SelectValue,
|
|
185
|
-
}
|
|
252
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Separator } from "./separator";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Design System/Separator',
|
|
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
|
+
<div><div className="space-y-1"><h4 className="text-sm font-medium leading-none">Radix Primitives</h4><p className="text-sm text-muted-foreground">An open-source UI component library.</p></div><Separator className="my-4" /><div className="flex h-5 items-center space-x-4 text-sm"><div>Blog</div><Separator orientation="vertical" /><div>Docs</div></div></div>
|
|
17
|
+
</div>
|
|
18
|
+
)
|
|
19
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
import { Separator } from "./separator";
|
|
4
|
+
|
|
5
|
+
describe('Separator Accessibility', () => {
|
|
6
|
+
it('should have no accessibility violations in basic render', async () => {
|
|
7
|
+
const Wrapper = () => (
|
|
8
|
+
<div><div className="space-y-1"><h4 className="text-sm font-medium leading-none">Radix Primitives</h4><p className="text-sm text-muted-foreground">An open-source UI component library.</p></div><Separator className="my-4" /><div className="flex h-5 items-center space-x-4 text-sm"><div>Blog</div><Separator orientation="vertical" /><div>Docs</div></div></div>
|
|
9
|
+
);
|
|
10
|
+
const { container } = render(<Wrapper />);
|
|
11
|
+
const results = await axe(container);
|
|
12
|
+
expect(results).toHaveNoViolations();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client"
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
3
|
+
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator"
|
|
5
4
|
|
|
6
|
-
import { cn } from "@/lib/utils"
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
7
6
|
|
|
8
7
|
function Separator({
|
|
9
8
|
className,
|
|
10
9
|
orientation = "horizontal",
|
|
11
|
-
decorative = true,
|
|
12
10
|
...props
|
|
13
|
-
}:
|
|
11
|
+
}: SeparatorPrimitive.Props) {
|
|
14
12
|
return (
|
|
15
|
-
<SeparatorPrimitive
|
|
13
|
+
<SeparatorPrimitive
|
|
16
14
|
data-slot="separator"
|
|
17
|
-
decorative={decorative}
|
|
18
15
|
orientation={orientation}
|
|
19
16
|
className={cn(
|
|
20
|
-
"bg-border
|
|
17
|
+
"shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
|
|
21
18
|
className
|
|
22
19
|
)}
|
|
23
20
|
{...props}
|
|
24
21
|
/>
|
|
25
|
-
)
|
|
22
|
+
)
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
export { Separator }
|
|
25
|
+
export { Separator }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription } from "./sheet";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Design System/Sheet',
|
|
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
|
+
<Sheet><SheetTrigger className="px-4 py-2 border rounded">Open</SheetTrigger><SheetContent><SheetHeader><SheetTitle>Are you sure?</SheetTitle><SheetDescription>This action cannot be undone.</SheetDescription></SheetHeader></SheetContent></Sheet>
|
|
17
|
+
</div>
|
|
18
|
+
)
|
|
19
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { axe } from 'jest-axe';
|
|
3
|
+
import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription } from "./sheet";
|
|
4
|
+
|
|
5
|
+
describe('Sheet Accessibility', () => {
|
|
6
|
+
it('should have no accessibility violations in basic render', async () => {
|
|
7
|
+
const Wrapper = () => (
|
|
8
|
+
<Sheet><SheetTrigger className="px-4 py-2 border rounded">Open</SheetTrigger><SheetContent><SheetHeader><SheetTitle>Are you sure?</SheetTitle><SheetDescription>This action cannot be undone.</SheetDescription></SheetHeader></SheetContent></Sheet>
|
|
9
|
+
);
|
|
10
|
+
const { container } = render(<Wrapper />);
|
|
11
|
+
const results = await axe(container);
|
|
12
|
+
expect(results).toHaveNoViolations();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -1,108 +1,93 @@
|
|
|
1
|
-
"use client"
|
|
1
|
+
"use client"
|
|
2
2
|
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import
|
|
5
|
-
import { XIcon } from "lucide-react";
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Dialog as SheetPrimitive } from "@base-ui/react/dialog"
|
|
6
5
|
|
|
7
|
-
import { cn } from "@/lib/utils"
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
import { Button } from "@/components/ui/button"
|
|
8
|
+
import { XIcon } from "lucide-react"
|
|
8
9
|
|
|
9
|
-
function Sheet({ ...props }:
|
|
10
|
-
return <SheetPrimitive.Root data-slot="sheet" {...props}
|
|
10
|
+
function Sheet({ ...props }: SheetPrimitive.Root.Props) {
|
|
11
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
function SheetTrigger({
|
|
14
|
-
|
|
15
|
-
...props
|
|
16
|
-
}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
17
|
-
return (
|
|
18
|
-
<SheetPrimitive.Trigger
|
|
19
|
-
data-slot="sheet-trigger"
|
|
20
|
-
className={cn("cursor-pointer", className)}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
14
|
+
function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {
|
|
15
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
|
|
24
16
|
}
|
|
25
17
|
|
|
26
|
-
function SheetClose({
|
|
27
|
-
|
|
28
|
-
...props
|
|
29
|
-
}: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
30
|
-
return (
|
|
31
|
-
<SheetPrimitive.Close
|
|
32
|
-
data-slot="sheet-close"
|
|
33
|
-
className={cn("cursor-pointer", className)}
|
|
34
|
-
{...props}
|
|
35
|
-
/>
|
|
36
|
-
);
|
|
18
|
+
function SheetClose({ ...props }: SheetPrimitive.Close.Props) {
|
|
19
|
+
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
|
|
37
20
|
}
|
|
38
21
|
|
|
39
|
-
function SheetPortal({
|
|
40
|
-
...props
|
|
41
|
-
}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
42
|
-
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
|
|
22
|
+
function SheetPortal({ ...props }: SheetPrimitive.Portal.Props) {
|
|
23
|
+
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
|
|
43
24
|
}
|
|
44
25
|
|
|
45
|
-
function SheetOverlay({
|
|
46
|
-
className,
|
|
47
|
-
...props
|
|
48
|
-
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
26
|
+
function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
|
|
49
27
|
return (
|
|
50
|
-
<SheetPrimitive.
|
|
28
|
+
<SheetPrimitive.Backdrop
|
|
51
29
|
data-slot="sheet-overlay"
|
|
52
30
|
className={cn(
|
|
53
|
-
"
|
|
31
|
+
"fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",
|
|
54
32
|
className
|
|
55
33
|
)}
|
|
56
34
|
{...props}
|
|
57
35
|
/>
|
|
58
|
-
)
|
|
36
|
+
)
|
|
59
37
|
}
|
|
60
38
|
|
|
61
39
|
function SheetContent({
|
|
62
40
|
className,
|
|
63
41
|
children,
|
|
64
42
|
side = "right",
|
|
43
|
+
showCloseButton = true,
|
|
65
44
|
...props
|
|
66
|
-
}:
|
|
67
|
-
side?: "top" | "right" | "bottom" | "left"
|
|
45
|
+
}: SheetPrimitive.Popup.Props & {
|
|
46
|
+
side?: "top" | "right" | "bottom" | "left"
|
|
47
|
+
showCloseButton?: boolean
|
|
68
48
|
}) {
|
|
69
49
|
return (
|
|
70
50
|
<SheetPortal>
|
|
71
51
|
<SheetOverlay />
|
|
72
|
-
<SheetPrimitive.
|
|
52
|
+
<SheetPrimitive.Popup
|
|
73
53
|
data-slot="sheet-content"
|
|
54
|
+
data-side={side}
|
|
74
55
|
className={cn(
|
|
75
|
-
"bg-
|
|
76
|
-
side === "right" &&
|
|
77
|
-
"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
|
78
|
-
side === "left" &&
|
|
79
|
-
"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
|
|
80
|
-
side === "top" &&
|
|
81
|
-
"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
82
|
-
side === "bottom" &&
|
|
83
|
-
"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
|
56
|
+
"fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",
|
|
84
57
|
className
|
|
85
58
|
)}
|
|
86
59
|
{...props}
|
|
87
60
|
>
|
|
88
61
|
{children}
|
|
89
|
-
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
62
|
+
{showCloseButton && (
|
|
63
|
+
<SheetPrimitive.Close
|
|
64
|
+
data-slot="sheet-close"
|
|
65
|
+
render={
|
|
66
|
+
<Button
|
|
67
|
+
variant="ghost"
|
|
68
|
+
className="absolute top-3 right-3"
|
|
69
|
+
size="icon-sm"
|
|
70
|
+
/>
|
|
71
|
+
}
|
|
72
|
+
>
|
|
73
|
+
<XIcon
|
|
74
|
+
/>
|
|
75
|
+
<span className="sr-only">Close</span>
|
|
76
|
+
</SheetPrimitive.Close>
|
|
77
|
+
)}
|
|
78
|
+
</SheetPrimitive.Popup>
|
|
94
79
|
</SheetPortal>
|
|
95
|
-
)
|
|
80
|
+
)
|
|
96
81
|
}
|
|
97
82
|
|
|
98
83
|
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
99
84
|
return (
|
|
100
85
|
<div
|
|
101
86
|
data-slot="sheet-header"
|
|
102
|
-
className={cn("flex flex-col gap-
|
|
87
|
+
className={cn("flex flex-col gap-0.5 p-4", className)}
|
|
103
88
|
{...props}
|
|
104
89
|
/>
|
|
105
|
-
)
|
|
90
|
+
)
|
|
106
91
|
}
|
|
107
92
|
|
|
108
93
|
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
@@ -112,33 +97,33 @@ function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
112
97
|
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
113
98
|
{...props}
|
|
114
99
|
/>
|
|
115
|
-
)
|
|
100
|
+
)
|
|
116
101
|
}
|
|
117
102
|
|
|
118
|
-
function SheetTitle({
|
|
119
|
-
className,
|
|
120
|
-
...props
|
|
121
|
-
}: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
103
|
+
function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
|
|
122
104
|
return (
|
|
123
105
|
<SheetPrimitive.Title
|
|
124
106
|
data-slot="sheet-title"
|
|
125
|
-
className={cn(
|
|
107
|
+
className={cn(
|
|
108
|
+
"font-heading text-base font-medium text-foreground",
|
|
109
|
+
className
|
|
110
|
+
)}
|
|
126
111
|
{...props}
|
|
127
112
|
/>
|
|
128
|
-
)
|
|
113
|
+
)
|
|
129
114
|
}
|
|
130
115
|
|
|
131
116
|
function SheetDescription({
|
|
132
117
|
className,
|
|
133
118
|
...props
|
|
134
|
-
}:
|
|
119
|
+
}: SheetPrimitive.Description.Props) {
|
|
135
120
|
return (
|
|
136
121
|
<SheetPrimitive.Description
|
|
137
122
|
data-slot="sheet-description"
|
|
138
|
-
className={cn("text-muted-foreground
|
|
123
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
139
124
|
{...props}
|
|
140
125
|
/>
|
|
141
|
-
)
|
|
126
|
+
)
|
|
142
127
|
}
|
|
143
128
|
|
|
144
129
|
export {
|
|
@@ -150,4 +135,4 @@ export {
|
|
|
150
135
|
SheetFooter,
|
|
151
136
|
SheetTitle,
|
|
152
137
|
SheetDescription,
|
|
153
|
-
}
|
|
138
|
+
}
|