@auto-engineer/generate-react-client 1.34.0 → 1.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/dist/starter/package.json +2 -1
- package/dist/starter/scripts/build-component-db.ts +157 -0
- package/dist/starter/src/components/ui/Accordion.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Accordion.tsx +4 -0
- package/dist/starter/src/components/ui/Alert.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Alert.tsx +7 -0
- package/dist/starter/src/components/ui/AlertDialog.stories.tsx +2 -0
- package/dist/starter/src/components/ui/AlertDialog.tsx +15 -0
- package/dist/starter/src/components/ui/AspectRatio.stories.tsx +2 -0
- package/dist/starter/src/components/ui/AspectRatio.tsx +4 -0
- package/dist/starter/src/components/ui/Avatar.stories.tsx +3 -0
- package/dist/starter/src/components/ui/Avatar.tsx +11 -0
- package/dist/starter/src/components/ui/Badge.stories.tsx +5 -0
- package/dist/starter/src/components/ui/Badge.tsx +5 -0
- package/dist/starter/src/components/ui/Breadcrumb.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Breadcrumb.tsx +12 -0
- package/dist/starter/src/components/ui/Button.stories.tsx +10 -0
- package/dist/starter/src/components/ui/Button.tsx +5 -0
- package/dist/starter/src/components/ui/ButtonGroup.stories.tsx +2 -0
- package/dist/starter/src/components/ui/ButtonGroup.tsx +6 -0
- package/dist/starter/src/components/ui/Calendar.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Calendar.tsx +6 -0
- package/dist/starter/src/components/ui/Card.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Card.tsx +10 -0
- package/dist/starter/src/components/ui/Carousel.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Carousel.tsx +9 -0
- package/dist/starter/src/components/ui/Chart.stories.tsx +1 -0
- package/dist/starter/src/components/ui/Chart.tsx +9 -0
- package/dist/starter/src/components/ui/Checkbox.stories.tsx +4 -0
- package/dist/starter/src/components/ui/Checkbox.tsx +1 -0
- package/dist/starter/src/components/ui/Collapsible.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Collapsible.tsx +3 -0
- package/dist/starter/src/components/ui/Combobox.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Combobox.tsx +29 -0
- package/dist/starter/src/components/ui/Command.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Command.tsx +20 -0
- package/dist/starter/src/components/ui/ContextMenu.stories.tsx +2 -0
- package/dist/starter/src/components/ui/ContextMenu.tsx +20 -0
- package/dist/starter/src/components/ui/Dialog.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Dialog.tsx +18 -0
- package/dist/starter/src/components/ui/Direction.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Direction.tsx +6 -0
- package/dist/starter/src/components/ui/Drawer.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Drawer.tsx +18 -0
- package/dist/starter/src/components/ui/DropdownMenu.stories.tsx +2 -0
- package/dist/starter/src/components/ui/DropdownMenu.tsx +20 -0
- package/dist/starter/src/components/ui/Empty.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Empty.tsx +13 -0
- package/dist/starter/src/components/ui/Field.stories.tsx +3 -0
- package/dist/starter/src/components/ui/Field.tsx +25 -0
- package/dist/starter/src/components/ui/Form.stories.tsx +1 -0
- package/dist/starter/src/components/ui/Form.tsx +15 -3
- package/dist/starter/src/components/ui/HoverCard.stories.tsx +2 -0
- package/dist/starter/src/components/ui/HoverCard.tsx +3 -0
- package/dist/starter/src/components/ui/Input.stories.tsx +4 -0
- package/dist/starter/src/components/ui/Input.tsx +1 -0
- package/dist/starter/src/components/ui/InputGroup.stories.tsx +3 -0
- package/dist/starter/src/components/ui/InputGroup.tsx +6 -0
- package/dist/starter/src/components/ui/InputOTP.stories.tsx +2 -0
- package/dist/starter/src/components/ui/InputOTP.tsx +4 -0
- package/dist/starter/src/components/ui/Item.stories.tsx +3 -0
- package/dist/starter/src/components/ui/Item.tsx +10 -0
- package/dist/starter/src/components/ui/Kbd.stories.tsx +5 -0
- package/dist/starter/src/components/ui/Kbd.tsx +4 -0
- package/dist/starter/src/components/ui/Label.stories.tsx +5 -0
- package/dist/starter/src/components/ui/Label.tsx +4 -0
- package/dist/starter/src/components/ui/Menubar.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Menubar.tsx +15 -0
- package/dist/starter/src/components/ui/NativeSelect.stories.tsx +3 -0
- package/dist/starter/src/components/ui/NativeSelect.tsx +6 -0
- package/dist/starter/src/components/ui/NavigationMenu.stories.tsx +2 -0
- package/dist/starter/src/components/ui/NavigationMenu.tsx +10 -0
- package/dist/starter/src/components/ui/Pagination.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Pagination.tsx +8 -0
- package/dist/starter/src/components/ui/Popover.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Popover.tsx +5 -0
- package/dist/starter/src/components/ui/Progress.stories.tsx +4 -0
- package/dist/starter/src/components/ui/Progress.tsx +1 -0
- package/dist/starter/src/components/ui/RadioGroup.stories.tsx +2 -0
- package/dist/starter/src/components/ui/RadioGroup.tsx +5 -0
- package/dist/starter/src/components/ui/Resizable.stories.tsx +3 -0
- package/dist/starter/src/components/ui/Resizable.tsx +7 -0
- package/dist/starter/src/components/ui/ScrollArea.stories.tsx +2 -0
- package/dist/starter/src/components/ui/ScrollArea.tsx +5 -0
- package/dist/starter/src/components/ui/Select.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Select.tsx +9 -0
- package/dist/starter/src/components/ui/Separator.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Separator.tsx +1 -0
- package/dist/starter/src/components/ui/Sheet.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Sheet.tsx +8 -0
- package/dist/starter/src/components/ui/Sidebar.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Sidebar.tsx +20 -0
- package/dist/starter/src/components/ui/Skeleton.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Skeleton.tsx +4 -0
- package/dist/starter/src/components/ui/Slider.stories.tsx +3 -0
- package/dist/starter/src/components/ui/Slider.tsx +1 -0
- package/dist/starter/src/components/ui/Sonner.stories.tsx +1 -0
- package/dist/starter/src/components/ui/Sonner.tsx +4 -0
- package/dist/starter/src/components/ui/Spinner.stories.tsx +3 -0
- package/dist/starter/src/components/ui/Spinner.tsx +4 -0
- package/dist/starter/src/components/ui/Switch.stories.tsx +4 -0
- package/dist/starter/src/components/ui/Switch.tsx +2 -0
- package/dist/starter/src/components/ui/Table.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Table.tsx +11 -0
- package/dist/starter/src/components/ui/Tabs.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Tabs.tsx +6 -0
- package/dist/starter/src/components/ui/Textarea.stories.tsx +3 -0
- package/dist/starter/src/components/ui/Textarea.tsx +4 -0
- package/dist/starter/src/components/ui/Toast.stories.tsx +4 -0
- package/dist/starter/src/components/ui/Toast.tsx +9 -0
- package/dist/starter/src/components/ui/Toaster.tsx +4 -0
- package/dist/starter/src/components/ui/Toggle.stories.tsx +4 -0
- package/dist/starter/src/components/ui/Toggle.tsx +1 -0
- package/dist/starter/src/components/ui/ToggleGroup.stories.tsx +3 -0
- package/dist/starter/src/components/ui/ToggleGroup.tsx +3 -0
- package/dist/starter/src/components/ui/Tooltip.stories.tsx +2 -0
- package/dist/starter/src/components/ui/Tooltip.tsx +6 -0
- package/package.json +2 -2
|
@@ -16,6 +16,7 @@ const meta: Meta<typeof Pagination> = {
|
|
|
16
16
|
export default meta;
|
|
17
17
|
type Story = StoryObj<typeof Pagination>;
|
|
18
18
|
|
|
19
|
+
/** Shows a full pagination bar with previous/next, numbered links, and an ellipsis. */
|
|
19
20
|
export const Default: Story = {
|
|
20
21
|
render: () => (
|
|
21
22
|
<Pagination>
|
|
@@ -48,6 +49,7 @@ export const Default: Story = {
|
|
|
48
49
|
),
|
|
49
50
|
};
|
|
50
51
|
|
|
52
|
+
/** Shows a compact pagination for a small number of pages without ellipsis. */
|
|
51
53
|
export const FewPages: Story = {
|
|
52
54
|
render: () => (
|
|
53
55
|
<Pagination>
|
|
@@ -4,6 +4,10 @@ import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from 'lucide-re
|
|
|
4
4
|
import { cn } from '@/lib/utils';
|
|
5
5
|
import { buttonVariants, type Button } from '@/components/ui/Button';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* A navigation component for paginated content, rendered as a semantic nav element.
|
|
9
|
+
* Compose with PaginationContent, PaginationItem, PaginationLink, PaginationPrevious, PaginationNext, and PaginationEllipsis.
|
|
10
|
+
*/
|
|
7
11
|
function Pagination({ className, ...props }: React.ComponentProps<'nav'>) {
|
|
8
12
|
return (
|
|
9
13
|
<nav
|
|
@@ -29,6 +33,7 @@ type PaginationLinkProps = {
|
|
|
29
33
|
} & Pick<React.ComponentProps<typeof Button>, 'size'> &
|
|
30
34
|
React.ComponentProps<'a'>;
|
|
31
35
|
|
|
36
|
+
/** A page number link that renders as outlined when active and ghost when inactive. */
|
|
32
37
|
function PaginationLink({ className, isActive, size = 'icon', ...props }: PaginationLinkProps) {
|
|
33
38
|
return (
|
|
34
39
|
<a
|
|
@@ -47,6 +52,7 @@ function PaginationLink({ className, isActive, size = 'icon', ...props }: Pagina
|
|
|
47
52
|
);
|
|
48
53
|
}
|
|
49
54
|
|
|
55
|
+
/** A "Previous" link with a left chevron icon for navigating to the prior page. */
|
|
50
56
|
function PaginationPrevious({ className, ...props }: React.ComponentProps<typeof PaginationLink>) {
|
|
51
57
|
return (
|
|
52
58
|
<PaginationLink
|
|
@@ -61,6 +67,7 @@ function PaginationPrevious({ className, ...props }: React.ComponentProps<typeof
|
|
|
61
67
|
);
|
|
62
68
|
}
|
|
63
69
|
|
|
70
|
+
/** A "Next" link with a right chevron icon for navigating to the following page. */
|
|
64
71
|
function PaginationNext({ className, ...props }: React.ComponentProps<typeof PaginationLink>) {
|
|
65
72
|
return (
|
|
66
73
|
<PaginationLink
|
|
@@ -75,6 +82,7 @@ function PaginationNext({ className, ...props }: React.ComponentProps<typeof Pag
|
|
|
75
82
|
);
|
|
76
83
|
}
|
|
77
84
|
|
|
85
|
+
/** A visual ellipsis indicator representing skipped page numbers. */
|
|
78
86
|
function PaginationEllipsis({ className, ...props }: React.ComponentProps<'span'>) {
|
|
79
87
|
return (
|
|
80
88
|
<span
|
|
@@ -9,6 +9,7 @@ const meta: Meta<typeof Popover> = {
|
|
|
9
9
|
export default meta;
|
|
10
10
|
type Story = StoryObj<typeof Popover>;
|
|
11
11
|
|
|
12
|
+
/** Shows a popover with form inputs for setting dimensions. */
|
|
12
13
|
export const Default: Story = {
|
|
13
14
|
render: () => (
|
|
14
15
|
<Popover>
|
|
@@ -37,6 +38,7 @@ export const Default: Story = {
|
|
|
37
38
|
),
|
|
38
39
|
};
|
|
39
40
|
|
|
41
|
+
/** Shows a popover with simple informational text content. */
|
|
40
42
|
export const SimpleText: Story = {
|
|
41
43
|
render: () => (
|
|
42
44
|
<Popover>
|
|
@@ -3,14 +3,17 @@ import { Popover as PopoverPrimitive } from 'radix-ui';
|
|
|
3
3
|
|
|
4
4
|
import { cn } from '@/lib/utils';
|
|
5
5
|
|
|
6
|
+
/** A floating panel anchored to a trigger for rich content on click. */
|
|
6
7
|
function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
7
8
|
return <PopoverPrimitive.Root data-slot="popover" {...props} />;
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
/** The element that toggles the popover open and closed when clicked. */
|
|
10
12
|
function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
11
13
|
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
|
|
12
14
|
}
|
|
13
15
|
|
|
16
|
+
/** The floating content panel rendered via a portal with animated enter/exit transitions. */
|
|
14
17
|
function PopoverContent({
|
|
15
18
|
className,
|
|
16
19
|
align = 'center',
|
|
@@ -33,10 +36,12 @@ function PopoverContent({
|
|
|
33
36
|
);
|
|
34
37
|
}
|
|
35
38
|
|
|
39
|
+
/** An optional custom anchor element to position the popover relative to instead of the trigger. */
|
|
36
40
|
function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
37
41
|
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
|
|
38
42
|
}
|
|
39
43
|
|
|
44
|
+
/** A layout wrapper for the popover's title and description. */
|
|
40
45
|
function PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
41
46
|
return <div data-slot="popover-header" className={cn('flex flex-col gap-1 text-sm', className)} {...props} />;
|
|
42
47
|
}
|
|
@@ -8,6 +8,7 @@ const meta: Meta<typeof Progress> = {
|
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Progress>;
|
|
10
10
|
|
|
11
|
+
/** Shows the progress bar at 50% with an adjustable value control. */
|
|
11
12
|
export const Default: Story = {
|
|
12
13
|
args: {
|
|
13
14
|
value: 50,
|
|
@@ -15,14 +16,17 @@ export const Default: Story = {
|
|
|
15
16
|
render: (args) => <Progress {...args} className="w-[60%]" />,
|
|
16
17
|
};
|
|
17
18
|
|
|
19
|
+
/** Shows the progress bar at 0% (empty state). */
|
|
18
20
|
export const Empty: Story = {
|
|
19
21
|
render: () => <Progress value={0} className="w-[60%]" />,
|
|
20
22
|
};
|
|
21
23
|
|
|
24
|
+
/** Shows the progress bar at 50%. */
|
|
22
25
|
export const Half: Story = {
|
|
23
26
|
render: () => <Progress value={50} className="w-[60%]" />,
|
|
24
27
|
};
|
|
25
28
|
|
|
29
|
+
/** Shows the progress bar at 100% (complete state). */
|
|
26
30
|
export const Full: Story = {
|
|
27
31
|
render: () => <Progress value={100} className="w-[60%]" />,
|
|
28
32
|
};
|
|
@@ -5,6 +5,7 @@ import { Progress as ProgressPrimitive } from 'radix-ui';
|
|
|
5
5
|
|
|
6
6
|
import { cn } from '@/lib/utils';
|
|
7
7
|
|
|
8
|
+
/** A horizontal progress bar. Set `value` (0-100) to control fill level. */
|
|
8
9
|
function Progress({ className, value, ...props }: React.ComponentProps<typeof ProgressPrimitive.Root>) {
|
|
9
10
|
return (
|
|
10
11
|
<ProgressPrimitive.Root
|
|
@@ -9,6 +9,7 @@ const meta: Meta<typeof RadioGroup> = {
|
|
|
9
9
|
export default meta;
|
|
10
10
|
type Story = StoryObj<typeof RadioGroup>;
|
|
11
11
|
|
|
12
|
+
/** Shows a vertical radio group with three options and a pre-selected value. */
|
|
12
13
|
export const Default: Story = {
|
|
13
14
|
render: () => (
|
|
14
15
|
<RadioGroup defaultValue="comfortable">
|
|
@@ -28,6 +29,7 @@ export const Default: Story = {
|
|
|
28
29
|
),
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
/** Shows a horizontally laid out radio group. */
|
|
31
33
|
export const Horizontal: Story = {
|
|
32
34
|
render: () => (
|
|
33
35
|
<RadioGroup defaultValue="medium" className="flex flex-row gap-4">
|
|
@@ -4,10 +4,15 @@ import { RadioGroup as RadioGroupPrimitive } from 'radix-ui';
|
|
|
4
4
|
|
|
5
5
|
import { cn } from '@/lib/utils';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* A set of mutually exclusive radio options built on Radix UI RadioGroup primitive.
|
|
9
|
+
* Compose with RadioGroupItem and Label to create accessible radio button groups.
|
|
10
|
+
*/
|
|
7
11
|
function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
|
|
8
12
|
return <RadioGroupPrimitive.Root data-slot="radio-group" className={cn('grid gap-3', className)} {...props} />;
|
|
9
13
|
}
|
|
10
14
|
|
|
15
|
+
/** An individual radio button that displays a filled dot when selected. */
|
|
11
16
|
function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
|
|
12
17
|
return (
|
|
13
18
|
<RadioGroupPrimitive.Item
|
|
@@ -8,6 +8,7 @@ const meta: Meta<typeof ResizablePanelGroup> = {
|
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof ResizablePanelGroup>;
|
|
10
10
|
|
|
11
|
+
/** Shows two resizable panels split equally with a minimal divider. */
|
|
11
12
|
export const Default: Story = {
|
|
12
13
|
render: () => (
|
|
13
14
|
<ResizablePanelGroup orientation="horizontal" className="min-h-[200px] max-w-md rounded-lg border">
|
|
@@ -26,6 +27,7 @@ export const Default: Story = {
|
|
|
26
27
|
),
|
|
27
28
|
};
|
|
28
29
|
|
|
30
|
+
/** Shows two panels with a visible grip handle on the divider. */
|
|
29
31
|
export const WithHandle: Story = {
|
|
30
32
|
render: () => (
|
|
31
33
|
<ResizablePanelGroup orientation="horizontal" className="min-h-[200px] max-w-md rounded-lg border">
|
|
@@ -44,6 +46,7 @@ export const WithHandle: Story = {
|
|
|
44
46
|
),
|
|
45
47
|
};
|
|
46
48
|
|
|
49
|
+
/** Shows three resizable panels with grip handles between them. */
|
|
47
50
|
export const ThreePanels: Story = {
|
|
48
51
|
render: () => (
|
|
49
52
|
<ResizablePanelGroup orientation="horizontal" className="min-h-[200px] max-w-lg rounded-lg border">
|
|
@@ -5,6 +5,10 @@ import * as ResizablePrimitive from 'react-resizable-panels';
|
|
|
5
5
|
|
|
6
6
|
import { cn } from '@/lib/utils';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A container for resizable panels that can be dragged to adjust their sizes.
|
|
10
|
+
* Built on react-resizable-panels. Compose with ResizablePanel and ResizableHandle.
|
|
11
|
+
*/
|
|
8
12
|
function ResizablePanelGroup({ className, ...props }: ResizablePrimitive.GroupProps) {
|
|
9
13
|
return (
|
|
10
14
|
<ResizablePrimitive.Group
|
|
@@ -15,11 +19,14 @@ function ResizablePanelGroup({ className, ...props }: ResizablePrimitive.GroupPr
|
|
|
15
19
|
);
|
|
16
20
|
}
|
|
17
21
|
|
|
22
|
+
/** A panel within a ResizablePanelGroup whose size can be adjusted by dragging adjacent handles. */
|
|
18
23
|
function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
|
|
19
24
|
return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />;
|
|
20
25
|
}
|
|
21
26
|
|
|
27
|
+
/** A draggable divider between resizable panels. Set withHandle to show a visible grip icon. */
|
|
22
28
|
function ResizableHandle({
|
|
29
|
+
/** When true, renders a visible grip icon on the handle for better discoverability. */
|
|
23
30
|
withHandle,
|
|
24
31
|
className,
|
|
25
32
|
...props
|
|
@@ -11,6 +11,7 @@ type Story = StoryObj<typeof ScrollArea>;
|
|
|
11
11
|
|
|
12
12
|
const tags = Array.from({ length: 50 }, (_, i) => `Item ${i + 1}`);
|
|
13
13
|
|
|
14
|
+
/** Shows a vertical scroll area with a long list of items. */
|
|
14
15
|
export const Default: Story = {
|
|
15
16
|
render: () => (
|
|
16
17
|
<ScrollArea className="h-72 w-48 rounded-md border">
|
|
@@ -27,6 +28,7 @@ export const Default: Story = {
|
|
|
27
28
|
),
|
|
28
29
|
};
|
|
29
30
|
|
|
31
|
+
/** Shows a horizontal scroll area with a row of cards. */
|
|
30
32
|
export const Horizontal: Story = {
|
|
31
33
|
render: () => (
|
|
32
34
|
<ScrollArea className="w-96 whitespace-nowrap rounded-md border">
|
|
@@ -3,6 +3,10 @@ import { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';
|
|
|
3
3
|
|
|
4
4
|
import { cn } from '@/lib/utils';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* A custom scrollable container with styled scrollbars, built on Radix UI ScrollArea primitive.
|
|
8
|
+
* Replaces native browser scrollbars with consistent cross-platform styled scrollbars.
|
|
9
|
+
*/
|
|
6
10
|
function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
|
|
7
11
|
return (
|
|
8
12
|
<ScrollAreaPrimitive.Root data-slot="scroll-area" className={cn('relative', className)} {...props}>
|
|
@@ -18,6 +22,7 @@ function ScrollArea({ className, children, ...props }: React.ComponentProps<type
|
|
|
18
22
|
);
|
|
19
23
|
}
|
|
20
24
|
|
|
25
|
+
/** A styled scrollbar track and thumb. Defaults to vertical; set orientation="horizontal" for horizontal scrolling. */
|
|
21
26
|
function ScrollBar({
|
|
22
27
|
className,
|
|
23
28
|
orientation = 'vertical',
|
|
@@ -16,6 +16,7 @@ const meta: Meta<typeof Select> = {
|
|
|
16
16
|
export default meta;
|
|
17
17
|
type Story = StoryObj<typeof Select>;
|
|
18
18
|
|
|
19
|
+
/** Shows a basic select with a list of fruit options. */
|
|
19
20
|
export const Default: Story = {
|
|
20
21
|
render: () => (
|
|
21
22
|
<Select>
|
|
@@ -33,6 +34,7 @@ export const Default: Story = {
|
|
|
33
34
|
),
|
|
34
35
|
};
|
|
35
36
|
|
|
37
|
+
/** Shows options organized into labeled groups for categorized selection. */
|
|
36
38
|
export const Grouped: Story = {
|
|
37
39
|
render: () => (
|
|
38
40
|
<Select>
|
|
@@ -6,6 +6,10 @@ import { Select as SelectPrimitive } from 'radix-ui';
|
|
|
6
6
|
|
|
7
7
|
import { cn } from '@/lib/utils';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* A custom dropdown select menu built on Radix UI Select primitive.
|
|
11
|
+
* Compose with SelectTrigger, SelectValue, SelectContent, and SelectItem for a fully accessible select experience.
|
|
12
|
+
*/
|
|
9
13
|
function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
10
14
|
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
|
11
15
|
}
|
|
@@ -18,8 +22,10 @@ function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.V
|
|
|
18
22
|
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
|
19
23
|
}
|
|
20
24
|
|
|
25
|
+
/** The button that opens the select dropdown, displaying the currently selected value. */
|
|
21
26
|
function SelectTrigger({
|
|
22
27
|
className,
|
|
28
|
+
/** Controls the height: "default" (36px) or "sm" (32px). */
|
|
23
29
|
size = 'default',
|
|
24
30
|
children,
|
|
25
31
|
...props
|
|
@@ -44,6 +50,7 @@ function SelectTrigger({
|
|
|
44
50
|
);
|
|
45
51
|
}
|
|
46
52
|
|
|
53
|
+
/** The dropdown panel containing the list of select options, rendered via a portal. */
|
|
47
54
|
function SelectContent({
|
|
48
55
|
className,
|
|
49
56
|
children,
|
|
@@ -81,6 +88,7 @@ function SelectContent({
|
|
|
81
88
|
);
|
|
82
89
|
}
|
|
83
90
|
|
|
91
|
+
/** A non-interactive label used to title a group of select options within SelectGroup. */
|
|
84
92
|
function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
85
93
|
return (
|
|
86
94
|
<SelectPrimitive.Label
|
|
@@ -91,6 +99,7 @@ function SelectLabel({ className, ...props }: React.ComponentProps<typeof Select
|
|
|
91
99
|
);
|
|
92
100
|
}
|
|
93
101
|
|
|
102
|
+
/** A selectable option within the dropdown that shows a checkmark when selected. */
|
|
94
103
|
function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
95
104
|
return (
|
|
96
105
|
<SelectPrimitive.Item
|
|
@@ -8,6 +8,7 @@ const meta: Meta<typeof Separator> = {
|
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Separator>;
|
|
10
10
|
|
|
11
|
+
/** Shows both horizontal and vertical separators dividing content sections. */
|
|
11
12
|
export const Default: Story = {
|
|
12
13
|
render: () => (
|
|
13
14
|
<div>
|
|
@@ -27,6 +28,7 @@ export const Default: Story = {
|
|
|
27
28
|
),
|
|
28
29
|
};
|
|
29
30
|
|
|
31
|
+
/** Shows vertical separators between inline text items. */
|
|
30
32
|
export const Vertical: Story = {
|
|
31
33
|
render: () => (
|
|
32
34
|
<div className="flex h-12 items-center space-x-4 text-sm">
|
|
@@ -3,6 +3,7 @@ import { Separator as SeparatorPrimitive } from 'radix-ui';
|
|
|
3
3
|
|
|
4
4
|
import { cn } from '@/lib/utils';
|
|
5
5
|
|
|
6
|
+
/** A visual divider between content sections. Renders as horizontal or vertical line. Decorative by default (hidden from screen readers). */
|
|
6
7
|
function Separator({
|
|
7
8
|
className,
|
|
8
9
|
orientation = 'horizontal',
|
|
@@ -9,6 +9,7 @@ const meta: Meta<typeof Sheet> = {
|
|
|
9
9
|
export default meta;
|
|
10
10
|
type Story = StoryObj<typeof Sheet>;
|
|
11
11
|
|
|
12
|
+
/** Shows a sheet sliding in from the right with a profile editing form. */
|
|
12
13
|
export const Default: Story = {
|
|
13
14
|
render: () => (
|
|
14
15
|
<Sheet>
|
|
@@ -35,6 +36,7 @@ export const Default: Story = {
|
|
|
35
36
|
),
|
|
36
37
|
};
|
|
37
38
|
|
|
39
|
+
/** Shows a sheet sliding in from the left with navigation links. */
|
|
38
40
|
export const LeftSide: Story = {
|
|
39
41
|
render: () => (
|
|
40
42
|
<Sheet>
|
|
@@ -6,6 +6,11 @@ import { Dialog as SheetPrimitive } from 'radix-ui';
|
|
|
6
6
|
|
|
7
7
|
import { cn } from '@/lib/utils';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* A panel that slides in from an edge of the screen, built on Radix UI Dialog primitive.
|
|
11
|
+
* Use for secondary content like navigation, filters, or forms that don't warrant a full page.
|
|
12
|
+
* Compose with SheetTrigger, SheetContent, SheetHeader, SheetTitle, and SheetDescription.
|
|
13
|
+
*/
|
|
9
14
|
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
10
15
|
return <SheetPrimitive.Root data-slot="sheet" {...props} />;
|
|
11
16
|
}
|
|
@@ -35,10 +40,13 @@ function SheetOverlay({ className, ...props }: React.ComponentProps<typeof Sheet
|
|
|
35
40
|
);
|
|
36
41
|
}
|
|
37
42
|
|
|
43
|
+
/** The sliding panel content. Use the side prop to control which edge it slides from (top, right, bottom, left). */
|
|
38
44
|
function SheetContent({
|
|
39
45
|
className,
|
|
40
46
|
children,
|
|
47
|
+
/** Which edge the panel slides from: top, right, bottom, or left. */
|
|
41
48
|
side = 'right',
|
|
49
|
+
/** Whether to show the X close button in the top-right corner. */
|
|
42
50
|
showCloseButton = true,
|
|
43
51
|
...props
|
|
44
52
|
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
@@ -28,6 +28,7 @@ const menuItems = [
|
|
|
28
28
|
{ label: 'Settings', icon: SettingsIcon },
|
|
29
29
|
];
|
|
30
30
|
|
|
31
|
+
/** Shows a complete sidebar with header, navigation group, footer, and a toggle trigger in the main area. */
|
|
31
32
|
export const Default: Story = {
|
|
32
33
|
render: () => (
|
|
33
34
|
<SidebarProvider>
|
|
@@ -62,6 +63,7 @@ export const Default: Story = {
|
|
|
62
63
|
),
|
|
63
64
|
};
|
|
64
65
|
|
|
66
|
+
/** Shows the sidebar with the first menu item highlighted as the active page. */
|
|
65
67
|
export const WithActiveItem: Story = {
|
|
66
68
|
render: () => (
|
|
67
69
|
<SidebarProvider>
|
|
@@ -40,6 +40,10 @@ function useSidebar() {
|
|
|
40
40
|
return context;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Context provider that manages sidebar open/collapsed state, mobile responsiveness, and keyboard shortcut (Cmd+B).
|
|
45
|
+
* Wrap your layout with this to enable sidebar state management for all child Sidebar components.
|
|
46
|
+
*/
|
|
43
47
|
function SidebarProvider({
|
|
44
48
|
defaultOpen = true,
|
|
45
49
|
open: openProp,
|
|
@@ -132,9 +136,16 @@ function SidebarProvider({
|
|
|
132
136
|
);
|
|
133
137
|
}
|
|
134
138
|
|
|
139
|
+
/**
|
|
140
|
+
* A responsive sidebar navigation panel that collapses on mobile into a Sheet overlay.
|
|
141
|
+
* Supports left/right placement, multiple visual variants (sidebar, floating, inset), and collapsible modes (offcanvas, icon, none).
|
|
142
|
+
*/
|
|
135
143
|
function Sidebar({
|
|
144
|
+
/** Which edge of the viewport the sidebar is placed on. */
|
|
136
145
|
side = 'left',
|
|
146
|
+
/** Visual style: "sidebar" (bordered), "floating" (rounded with shadow), or "inset" (embedded). */
|
|
137
147
|
variant = 'sidebar',
|
|
148
|
+
/** Collapse behavior: "offcanvas" (slides off-screen), "icon" (collapses to icon width), or "none" (always visible). */
|
|
138
149
|
collapsible = 'offcanvas',
|
|
139
150
|
className,
|
|
140
151
|
children,
|
|
@@ -231,6 +242,7 @@ function Sidebar({
|
|
|
231
242
|
);
|
|
232
243
|
}
|
|
233
244
|
|
|
245
|
+
/** A button that toggles the sidebar open/closed state. */
|
|
234
246
|
function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {
|
|
235
247
|
const { toggleSidebar } = useSidebar();
|
|
236
248
|
|
|
@@ -253,6 +265,7 @@ function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<t
|
|
|
253
265
|
);
|
|
254
266
|
}
|
|
255
267
|
|
|
268
|
+
/** A thin hover-activated rail along the sidebar edge that toggles collapse on click. */
|
|
256
269
|
function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
|
|
257
270
|
const { toggleSidebar } = useSidebar();
|
|
258
271
|
|
|
@@ -278,6 +291,7 @@ function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
|
|
|
278
291
|
);
|
|
279
292
|
}
|
|
280
293
|
|
|
294
|
+
/** The main content area that sits alongside the sidebar, adjusting its margin based on sidebar state. */
|
|
281
295
|
function SidebarInset({ className, ...props }: React.ComponentProps<'main'>) {
|
|
282
296
|
return (
|
|
283
297
|
<main
|
|
@@ -336,6 +350,7 @@ function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof S
|
|
|
336
350
|
);
|
|
337
351
|
}
|
|
338
352
|
|
|
353
|
+
/** The scrollable main body area of the sidebar that holds SidebarGroup sections. */
|
|
339
354
|
function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
340
355
|
return (
|
|
341
356
|
<div
|
|
@@ -350,6 +365,7 @@ function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
350
365
|
);
|
|
351
366
|
}
|
|
352
367
|
|
|
368
|
+
/** A logical grouping of sidebar menu items, optionally with a label and action button. */
|
|
353
369
|
function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
354
370
|
return (
|
|
355
371
|
<div
|
|
@@ -361,6 +377,7 @@ function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
361
377
|
);
|
|
362
378
|
}
|
|
363
379
|
|
|
380
|
+
/** A small heading label for a SidebarGroup. Hidden when the sidebar is collapsed to icon mode. */
|
|
364
381
|
function SidebarGroupLabel({
|
|
365
382
|
className,
|
|
366
383
|
asChild = false,
|
|
@@ -460,6 +477,7 @@ const sidebarMenuButtonVariants = cva(
|
|
|
460
477
|
},
|
|
461
478
|
);
|
|
462
479
|
|
|
480
|
+
/** An interactive menu item button with optional tooltip support when collapsed. Supports active state highlighting and size variants. */
|
|
463
481
|
function SidebarMenuButton({
|
|
464
482
|
asChild = false,
|
|
465
483
|
isActive = false,
|
|
@@ -505,6 +523,7 @@ function SidebarMenuButton({
|
|
|
505
523
|
);
|
|
506
524
|
}
|
|
507
525
|
|
|
526
|
+
/** An action button (e.g., delete, settings) positioned to the right of a SidebarMenuButton. */
|
|
508
527
|
function SidebarMenuAction({
|
|
509
528
|
className,
|
|
510
529
|
asChild = false,
|
|
@@ -589,6 +608,7 @@ function SidebarMenuSkeleton({
|
|
|
589
608
|
);
|
|
590
609
|
}
|
|
591
610
|
|
|
611
|
+
/** A nested sub-menu list indented under a parent menu item with a left border. */
|
|
592
612
|
function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>) {
|
|
593
613
|
return (
|
|
594
614
|
<ul
|
|
@@ -8,6 +8,7 @@ const meta: Meta<typeof Skeleton> = {
|
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Skeleton>;
|
|
10
10
|
|
|
11
|
+
/** Shows a skeleton mimicking a user profile layout with an avatar circle and two text lines. */
|
|
11
12
|
export const Default: Story = {
|
|
12
13
|
render: () => (
|
|
13
14
|
<div className="flex items-center space-x-4">
|
|
@@ -20,6 +21,7 @@ export const Default: Story = {
|
|
|
20
21
|
),
|
|
21
22
|
};
|
|
22
23
|
|
|
24
|
+
/** Shows a skeleton mimicking a full card layout with image, text, and avatar placeholders. */
|
|
23
25
|
export const CardSkeleton: Story = {
|
|
24
26
|
render: () => (
|
|
25
27
|
<div className="w-[300px] space-y-4 rounded-lg border p-4">
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { cn } from '@/lib/utils';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A placeholder element that animates with a pulse effect to indicate content is loading.
|
|
5
|
+
* Use to mirror the shape of upcoming content (e.g., text lines, avatars, cards) and reduce perceived load time.
|
|
6
|
+
*/
|
|
3
7
|
function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {
|
|
4
8
|
return <div data-slot="skeleton" className={cn('bg-accent animate-pulse rounded-md', className)} {...props} />;
|
|
5
9
|
}
|
|
@@ -8,14 +8,17 @@ const meta: Meta<typeof Slider> = {
|
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Slider>;
|
|
10
10
|
|
|
11
|
+
/** Shows a single-thumb slider at 50% of a 0-100 range. */
|
|
11
12
|
export const Default: Story = {
|
|
12
13
|
render: () => <Slider defaultValue={[50]} max={100} step={1} className="w-[60%]" />,
|
|
13
14
|
};
|
|
14
15
|
|
|
16
|
+
/** Demonstrates a dual-thumb range slider for selecting a value range between 25 and 75. */
|
|
15
17
|
export const Range: Story = {
|
|
16
18
|
render: () => <Slider defaultValue={[25, 75]} max={100} step={1} className="w-[60%]" />,
|
|
17
19
|
};
|
|
18
20
|
|
|
21
|
+
/** Shows a slider with discrete step increments of 10. */
|
|
19
22
|
export const WithSteps: Story = {
|
|
20
23
|
render: () => <Slider defaultValue={[20]} max={100} step={10} className="w-[60%]" />,
|
|
21
24
|
};
|
|
@@ -3,6 +3,7 @@ import { Slider as SliderPrimitive } from 'radix-ui';
|
|
|
3
3
|
|
|
4
4
|
import { cn } from '@/lib/utils';
|
|
5
5
|
|
|
6
|
+
/** A draggable range input. Supports single or multiple thumbs (range selection), keyboard navigation, and vertical orientation. */
|
|
6
7
|
function Slider({
|
|
7
8
|
className,
|
|
8
9
|
defaultValue,
|
|
@@ -18,6 +18,7 @@ const meta: Meta<typeof Toaster> = {
|
|
|
18
18
|
export default meta;
|
|
19
19
|
type Story = StoryObj<typeof Toaster>;
|
|
20
20
|
|
|
21
|
+
/** Demonstrates all toast variants (default, success, error, warning, info) triggered by buttons. */
|
|
21
22
|
export const Default: Story = {
|
|
22
23
|
render: () => (
|
|
23
24
|
<div>
|
|
@@ -4,6 +4,10 @@ import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon
|
|
|
4
4
|
import { useTheme } from 'next-themes';
|
|
5
5
|
import { Toaster as Sonner, type ToasterProps } from 'sonner';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* A pre-configured Sonner toast container that integrates with the app's theme system.
|
|
9
|
+
* Provides styled icons for success, info, warning, error, and loading states. Place once at the app root and trigger toasts via the `toast()` function from sonner.
|
|
10
|
+
*/
|
|
7
11
|
const Toaster = ({ ...props }: ToasterProps) => {
|
|
8
12
|
const { theme = 'system' } = useTheme();
|
|
9
13
|
|
|
@@ -8,14 +8,17 @@ const meta: Meta<typeof Spinner> = {
|
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Spinner>;
|
|
10
10
|
|
|
11
|
+
/** Shows the spinner at its default size (16px). */
|
|
11
12
|
export const Default: Story = {};
|
|
12
13
|
|
|
14
|
+
/** Shows a smaller 12px spinner for inline or compact contexts. */
|
|
13
15
|
export const Small: Story = {
|
|
14
16
|
args: {
|
|
15
17
|
className: 'size-3',
|
|
16
18
|
},
|
|
17
19
|
};
|
|
18
20
|
|
|
21
|
+
/** Shows a larger 32px spinner for full-page or section-level loading states. */
|
|
19
22
|
export const Large: Story = {
|
|
20
23
|
args: {
|
|
21
24
|
className: 'size-8',
|
|
@@ -2,6 +2,10 @@ import { Loader2Icon } from 'lucide-react';
|
|
|
2
2
|
|
|
3
3
|
import { cn } from '@/lib/utils';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* An animated spinning loader icon that indicates an in-progress operation.
|
|
7
|
+
* Includes role="status" and an aria-label for accessibility. Resize via className (e.g., "size-8").
|
|
8
|
+
*/
|
|
5
9
|
function Spinner({ className, ...props }: React.ComponentProps<'svg'>) {
|
|
6
10
|
return <Loader2Icon role="status" aria-label="Loading" className={cn('size-4 animate-spin', className)} {...props} />;
|
|
7
11
|
}
|
|
@@ -9,20 +9,24 @@ const meta: Meta<typeof Switch> = {
|
|
|
9
9
|
export default meta;
|
|
10
10
|
type Story = StoryObj<typeof Switch>;
|
|
11
11
|
|
|
12
|
+
/** Shows the switch in its default unchecked state. */
|
|
12
13
|
export const Default: Story = {};
|
|
13
14
|
|
|
15
|
+
/** Shows the switch in its checked (on) state. */
|
|
14
16
|
export const Checked: Story = {
|
|
15
17
|
args: {
|
|
16
18
|
defaultChecked: true,
|
|
17
19
|
},
|
|
18
20
|
};
|
|
19
21
|
|
|
22
|
+
/** Shows a disabled switch that cannot be interacted with. */
|
|
20
23
|
export const Disabled: Story = {
|
|
21
24
|
args: {
|
|
22
25
|
disabled: true,
|
|
23
26
|
},
|
|
24
27
|
};
|
|
25
28
|
|
|
29
|
+
/** Shows the switch paired with an associated label element for accessible labeling. */
|
|
26
30
|
export const WithLabel: Story = {
|
|
27
31
|
render: () => (
|
|
28
32
|
<div className="flex items-center gap-2">
|
|
@@ -3,8 +3,10 @@ import { Switch as SwitchPrimitive } from 'radix-ui';
|
|
|
3
3
|
|
|
4
4
|
import { cn } from '@/lib/utils';
|
|
5
5
|
|
|
6
|
+
/** A sliding on/off toggle control with WAI-ARIA switch role and keyboard support. */
|
|
6
7
|
function Switch({
|
|
7
8
|
className,
|
|
9
|
+
/** Controls the physical dimensions of the switch track and thumb. */
|
|
8
10
|
size = 'default',
|
|
9
11
|
...props
|
|
10
12
|
}: React.ComponentProps<typeof SwitchPrimitive.Root> & {
|