@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
|
@@ -8,12 +8,14 @@ const meta: Meta<typeof Button> = {
|
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof Button>;
|
|
10
10
|
|
|
11
|
+
/** Shows the primary filled button variant. */
|
|
11
12
|
export const Default: Story = {
|
|
12
13
|
args: {
|
|
13
14
|
children: 'Button',
|
|
14
15
|
},
|
|
15
16
|
};
|
|
16
17
|
|
|
18
|
+
/** Shows the secondary button variant with muted styling. */
|
|
17
19
|
export const Secondary: Story = {
|
|
18
20
|
args: {
|
|
19
21
|
variant: 'secondary',
|
|
@@ -21,6 +23,7 @@ export const Secondary: Story = {
|
|
|
21
23
|
},
|
|
22
24
|
};
|
|
23
25
|
|
|
26
|
+
/** Shows the destructive button variant for dangerous actions like delete. */
|
|
24
27
|
export const Destructive: Story = {
|
|
25
28
|
args: {
|
|
26
29
|
variant: 'destructive',
|
|
@@ -28,6 +31,7 @@ export const Destructive: Story = {
|
|
|
28
31
|
},
|
|
29
32
|
};
|
|
30
33
|
|
|
34
|
+
/** Shows the outline button variant with a border and transparent background. */
|
|
31
35
|
export const Outline: Story = {
|
|
32
36
|
args: {
|
|
33
37
|
variant: 'outline',
|
|
@@ -35,6 +39,7 @@ export const Outline: Story = {
|
|
|
35
39
|
},
|
|
36
40
|
};
|
|
37
41
|
|
|
42
|
+
/** Shows the ghost button variant with no background until hovered. */
|
|
38
43
|
export const Ghost: Story = {
|
|
39
44
|
args: {
|
|
40
45
|
variant: 'ghost',
|
|
@@ -42,6 +47,7 @@ export const Ghost: Story = {
|
|
|
42
47
|
},
|
|
43
48
|
};
|
|
44
49
|
|
|
50
|
+
/** Shows the link button variant styled as an inline text link with underline on hover. */
|
|
45
51
|
export const Link: Story = {
|
|
46
52
|
args: {
|
|
47
53
|
variant: 'link',
|
|
@@ -49,6 +55,7 @@ export const Link: Story = {
|
|
|
49
55
|
},
|
|
50
56
|
};
|
|
51
57
|
|
|
58
|
+
/** Shows a compact small-sized button. */
|
|
52
59
|
export const Small: Story = {
|
|
53
60
|
args: {
|
|
54
61
|
size: 'sm',
|
|
@@ -56,6 +63,7 @@ export const Small: Story = {
|
|
|
56
63
|
},
|
|
57
64
|
};
|
|
58
65
|
|
|
66
|
+
/** Shows a larger button with more padding. */
|
|
59
67
|
export const Large: Story = {
|
|
60
68
|
args: {
|
|
61
69
|
size: 'lg',
|
|
@@ -63,6 +71,7 @@ export const Large: Story = {
|
|
|
63
71
|
},
|
|
64
72
|
};
|
|
65
73
|
|
|
74
|
+
/** Shows an icon-only square button. */
|
|
66
75
|
export const Icon: Story = {
|
|
67
76
|
args: {
|
|
68
77
|
size: 'icon',
|
|
@@ -70,6 +79,7 @@ export const Icon: Story = {
|
|
|
70
79
|
},
|
|
71
80
|
};
|
|
72
81
|
|
|
82
|
+
/** Displays all button variants and sizes side by side for visual comparison. */
|
|
73
83
|
export const AllVariants: Story = {
|
|
74
84
|
render: () => (
|
|
75
85
|
<div className="flex flex-col gap-4">
|
|
@@ -36,10 +36,15 @@ const buttonVariants = cva(
|
|
|
36
36
|
},
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* A clickable element that triggers an action or navigation.
|
|
41
|
+
* Supports six visual variants (default, secondary, destructive, outline, ghost, link) and multiple sizes including icon-only modes.
|
|
42
|
+
*/
|
|
39
43
|
function Button({
|
|
40
44
|
className,
|
|
41
45
|
variant = 'default',
|
|
42
46
|
size = 'default',
|
|
47
|
+
/** Merges props onto the child element instead of rendering a button. Use with Link or anchor components for navigation. */
|
|
43
48
|
asChild = false,
|
|
44
49
|
...props
|
|
45
50
|
}: React.ComponentProps<'button'> &
|
|
@@ -9,6 +9,7 @@ const meta: Meta<typeof ButtonGroup> = {
|
|
|
9
9
|
export default meta;
|
|
10
10
|
type Story = StoryObj<typeof ButtonGroup>;
|
|
11
11
|
|
|
12
|
+
/** Shows a horizontal group of three outline buttons with connected borders. */
|
|
12
13
|
export const Default: Story = {
|
|
13
14
|
render: () => (
|
|
14
15
|
<ButtonGroup>
|
|
@@ -19,6 +20,7 @@ export const Default: Story = {
|
|
|
19
20
|
),
|
|
20
21
|
};
|
|
21
22
|
|
|
23
|
+
/** Shows a vertically stacked button group. */
|
|
22
24
|
export const Vertical: Story = {
|
|
23
25
|
render: () => (
|
|
24
26
|
<ButtonGroup orientation="vertical">
|
|
@@ -21,6 +21,10 @@ const buttonGroupVariants = cva(
|
|
|
21
21
|
},
|
|
22
22
|
);
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Groups multiple Buttons together with connected borders, removing inner border-radius between siblings.
|
|
26
|
+
* Supports horizontal (default) and vertical orientation.
|
|
27
|
+
*/
|
|
24
28
|
function ButtonGroup({
|
|
25
29
|
className,
|
|
26
30
|
orientation,
|
|
@@ -37,6 +41,7 @@ function ButtonGroup({
|
|
|
37
41
|
);
|
|
38
42
|
}
|
|
39
43
|
|
|
44
|
+
/** A non-interactive text label or addon segment within a ButtonGroup, styled to match adjacent buttons. */
|
|
40
45
|
function ButtonGroupText({
|
|
41
46
|
className,
|
|
42
47
|
asChild = false,
|
|
@@ -57,6 +62,7 @@ function ButtonGroupText({
|
|
|
57
62
|
);
|
|
58
63
|
}
|
|
59
64
|
|
|
65
|
+
/** A visual divider between buttons in a ButtonGroup, rendered as a Separator. */
|
|
60
66
|
function ButtonGroupSeparator({
|
|
61
67
|
className,
|
|
62
68
|
orientation = 'vertical',
|
|
@@ -14,6 +14,7 @@ function CalendarDemo() {
|
|
|
14
14
|
return <Calendar mode="single" selected={date} onSelect={setDate} className="rounded-md border" />;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/** Shows a single-date selection calendar with controlled state. */
|
|
17
18
|
export const Default: Story = {
|
|
18
19
|
render: () => <CalendarDemo />,
|
|
19
20
|
};
|
|
@@ -33,6 +34,7 @@ function CalendarRangeDemo() {
|
|
|
33
34
|
);
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
/** Demonstrates date range selection across two side-by-side months. */
|
|
36
38
|
export const RangeSelection: Story = {
|
|
37
39
|
render: () => <CalendarRangeDemo />,
|
|
38
40
|
};
|
|
@@ -5,11 +5,16 @@ import { DayPicker, getDefaultClassNames, type DayButton } from 'react-day-picke
|
|
|
5
5
|
import { cn } from '@/lib/utils';
|
|
6
6
|
import { Button, buttonVariants } from '@/components/ui/Button';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A date picker component built on react-day-picker supporting single date, multiple date, and date range selection.
|
|
10
|
+
* Supports month/year dropdowns, outside days visibility, keyboard navigation, and multi-month layouts.
|
|
11
|
+
*/
|
|
8
12
|
function Calendar({
|
|
9
13
|
className,
|
|
10
14
|
classNames,
|
|
11
15
|
showOutsideDays = true,
|
|
12
16
|
captionLayout = 'label',
|
|
17
|
+
/** The Button variant used for navigation arrows. Defaults to `"ghost"`. */
|
|
13
18
|
buttonVariant = 'ghost',
|
|
14
19
|
formatters,
|
|
15
20
|
components,
|
|
@@ -126,6 +131,7 @@ function Calendar({
|
|
|
126
131
|
);
|
|
127
132
|
}
|
|
128
133
|
|
|
134
|
+
/** Internal button rendered for each day cell, handling selection states, range highlighting, and focus management. */
|
|
129
135
|
function CalendarDayButton({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>) {
|
|
130
136
|
const defaultClassNames = getDefaultClassNames();
|
|
131
137
|
|
|
@@ -9,6 +9,7 @@ const meta: Meta<typeof Card> = {
|
|
|
9
9
|
export default meta;
|
|
10
10
|
type Story = StoryObj<typeof Card>;
|
|
11
11
|
|
|
12
|
+
/** Shows a full card with header, content, and footer containing action buttons. */
|
|
12
13
|
export const Default: Story = {
|
|
13
14
|
render: () => (
|
|
14
15
|
<Card className="w-[350px]">
|
|
@@ -27,6 +28,7 @@ export const Default: Story = {
|
|
|
27
28
|
),
|
|
28
29
|
};
|
|
29
30
|
|
|
31
|
+
/** Shows a minimal card with only a header and content, without a footer. */
|
|
30
32
|
export const Simple: Story = {
|
|
31
33
|
render: () => (
|
|
32
34
|
<Card className="w-[350px]">
|
|
@@ -2,6 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { cn } from '@/lib/utils';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* A flexible container for grouping related content with a border, shadow, and rounded corners.
|
|
7
|
+
* Compose with CardHeader, CardTitle, CardDescription, CardContent, CardFooter, and CardAction.
|
|
8
|
+
*/
|
|
5
9
|
function Card({ className, ...props }: React.ComponentProps<'div'>) {
|
|
6
10
|
return (
|
|
7
11
|
<div
|
|
@@ -12,6 +16,7 @@ function Card({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
12
16
|
);
|
|
13
17
|
}
|
|
14
18
|
|
|
19
|
+
/** The top section of a Card, containing the title, description, and optional action slot. */
|
|
15
20
|
function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
16
21
|
return (
|
|
17
22
|
<div
|
|
@@ -25,14 +30,17 @@ function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
25
30
|
);
|
|
26
31
|
}
|
|
27
32
|
|
|
33
|
+
/** The primary heading of a Card, rendered as semibold text. */
|
|
28
34
|
function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
29
35
|
return <div data-slot="card-title" className={cn('leading-none font-semibold', className)} {...props} />;
|
|
30
36
|
}
|
|
31
37
|
|
|
38
|
+
/** A short summary below the CardTitle, styled in muted foreground. */
|
|
32
39
|
function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
|
33
40
|
return <div data-slot="card-description" className={cn('text-muted-foreground text-sm', className)} {...props} />;
|
|
34
41
|
}
|
|
35
42
|
|
|
43
|
+
/** An optional action element (e.g., a button or menu) aligned to the top-right of the CardHeader. */
|
|
36
44
|
function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
|
|
37
45
|
return (
|
|
38
46
|
<div
|
|
@@ -43,10 +51,12 @@ function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
43
51
|
);
|
|
44
52
|
}
|
|
45
53
|
|
|
54
|
+
/** The main body area of a Card for arbitrary content. */
|
|
46
55
|
function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
47
56
|
return <div data-slot="card-content" className={cn('px-6', className)} {...props} />;
|
|
48
57
|
}
|
|
49
58
|
|
|
59
|
+
/** The bottom section of a Card, typically used for action buttons or metadata. */
|
|
50
60
|
function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
51
61
|
return (
|
|
52
62
|
<div data-slot="card-footer" className={cn('flex items-center px-6 [.border-t]:pt-6', className)} {...props} />
|
|
@@ -9,6 +9,7 @@ const meta: Meta<typeof Carousel> = {
|
|
|
9
9
|
export default meta;
|
|
10
10
|
type Story = StoryObj<typeof Carousel>;
|
|
11
11
|
|
|
12
|
+
/** Shows a basic carousel with one full-width slide visible at a time and navigation arrows. */
|
|
12
13
|
export const Default: Story = {
|
|
13
14
|
render: () => (
|
|
14
15
|
<div className="w-full max-w-xs mx-auto">
|
|
@@ -31,6 +32,7 @@ export const Default: Story = {
|
|
|
31
32
|
),
|
|
32
33
|
};
|
|
33
34
|
|
|
35
|
+
/** Demonstrates showing three slides simultaneously using `basis-1/3` on each CarouselItem. */
|
|
34
36
|
export const ThirdWidth: Story = {
|
|
35
37
|
render: () => (
|
|
36
38
|
<div className="w-full max-w-sm mx-auto">
|
|
@@ -40,6 +40,11 @@ function useCarousel() {
|
|
|
40
40
|
return context;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* A slideshow component for cycling through content panels with arrow-key navigation.
|
|
45
|
+
* Built on Embla Carousel. Compose with CarouselContent, CarouselItem, CarouselPrevious, and CarouselNext.
|
|
46
|
+
* Supports horizontal and vertical orientation, and accepts Embla plugins (e.g., autoplay).
|
|
47
|
+
*/
|
|
43
48
|
function Carousel({
|
|
44
49
|
orientation = 'horizontal',
|
|
45
50
|
opts,
|
|
@@ -129,6 +134,7 @@ function Carousel({
|
|
|
129
134
|
);
|
|
130
135
|
}
|
|
131
136
|
|
|
137
|
+
/** The scrollable container for carousel slides. Wraps CarouselItem children in a flex layout. */
|
|
132
138
|
function CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
133
139
|
const { carouselRef, orientation } = useCarousel();
|
|
134
140
|
|
|
@@ -139,6 +145,7 @@ function CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
139
145
|
);
|
|
140
146
|
}
|
|
141
147
|
|
|
148
|
+
/** A single slide within the carousel. Takes full width by default; use `basis-*` classes to show multiple slides. */
|
|
142
149
|
function CarouselItem({ className, ...props }: React.ComponentProps<'div'>) {
|
|
143
150
|
const { orientation } = useCarousel();
|
|
144
151
|
|
|
@@ -153,6 +160,7 @@ function CarouselItem({ className, ...props }: React.ComponentProps<'div'>) {
|
|
|
153
160
|
);
|
|
154
161
|
}
|
|
155
162
|
|
|
163
|
+
/** Navigation button to scroll to the previous slide, automatically disabled at the beginning. */
|
|
156
164
|
function CarouselPrevious({
|
|
157
165
|
className,
|
|
158
166
|
variant = 'outline',
|
|
@@ -183,6 +191,7 @@ function CarouselPrevious({
|
|
|
183
191
|
);
|
|
184
192
|
}
|
|
185
193
|
|
|
194
|
+
/** Navigation button to scroll to the next slide, automatically disabled at the end. */
|
|
186
195
|
function CarouselNext({
|
|
187
196
|
className,
|
|
188
197
|
variant = 'outline',
|
|
@@ -23,6 +23,7 @@ const chartConfig = {
|
|
|
23
23
|
mobile: { label: 'Mobile', color: 'var(--chart-2)' },
|
|
24
24
|
} satisfies ChartConfig;
|
|
25
25
|
|
|
26
|
+
/** Shows a grouped bar chart with desktop and mobile data series, tooltips, and themed colors. */
|
|
26
27
|
export const Default: Story = {
|
|
27
28
|
render: () => (
|
|
28
29
|
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
|
|
@@ -29,6 +29,10 @@ function useChart() {
|
|
|
29
29
|
return context;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* A themed wrapper for Recharts charts that provides responsive sizing, CSS custom property-based color theming, and a chart context for tooltips and legends.
|
|
34
|
+
* Pass a `config` object mapping data keys to labels, colors, and optional icons.
|
|
35
|
+
*/
|
|
32
36
|
function ChartContainer({
|
|
33
37
|
id,
|
|
34
38
|
className,
|
|
@@ -91,6 +95,10 @@ ${colorConfig
|
|
|
91
95
|
|
|
92
96
|
const ChartTooltip = RechartsPrimitive.Tooltip;
|
|
93
97
|
|
|
98
|
+
/**
|
|
99
|
+
* A styled tooltip content component for Recharts that reads labels and colors from ChartConfig.
|
|
100
|
+
* Supports dot, line, and dashed indicator styles.
|
|
101
|
+
*/
|
|
94
102
|
function ChartTooltipContent({
|
|
95
103
|
active,
|
|
96
104
|
payload,
|
|
@@ -219,6 +227,7 @@ function ChartTooltipContent({
|
|
|
219
227
|
|
|
220
228
|
const ChartLegend = RechartsPrimitive.Legend;
|
|
221
229
|
|
|
230
|
+
/** A styled legend content component for Recharts that reads labels, colors, and icons from ChartConfig. */
|
|
222
231
|
function ChartLegendContent({
|
|
223
232
|
className,
|
|
224
233
|
hideIcon = false,
|
|
@@ -9,18 +9,22 @@ const meta: Meta<typeof Checkbox> = {
|
|
|
9
9
|
export default meta;
|
|
10
10
|
type Story = StoryObj<typeof Checkbox>;
|
|
11
11
|
|
|
12
|
+
/** Shows an unchecked checkbox in its default state. */
|
|
12
13
|
export const Default: Story = {
|
|
13
14
|
render: () => <Checkbox />,
|
|
14
15
|
};
|
|
15
16
|
|
|
17
|
+
/** Shows a checkbox that starts in the checked state. */
|
|
16
18
|
export const Checked: Story = {
|
|
17
19
|
render: () => <Checkbox defaultChecked />,
|
|
18
20
|
};
|
|
19
21
|
|
|
22
|
+
/** Shows a disabled checkbox that cannot be interacted with. */
|
|
20
23
|
export const Disabled: Story = {
|
|
21
24
|
render: () => <Checkbox disabled />,
|
|
22
25
|
};
|
|
23
26
|
|
|
27
|
+
/** Shows a checkbox paired with a Label component for accessible form usage. */
|
|
24
28
|
export const WithLabel: Story = {
|
|
25
29
|
render: () => (
|
|
26
30
|
<div className="flex items-center space-x-2">
|
|
@@ -6,6 +6,7 @@ import { Checkbox as CheckboxPrimitive } from 'radix-ui';
|
|
|
6
6
|
|
|
7
7
|
import { cn } from '@/lib/utils';
|
|
8
8
|
|
|
9
|
+
/** A toggleable boolean input with check icon. Supports checked, unchecked, and indeterminate states. Pair with Label for forms. */
|
|
9
10
|
function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
|
|
10
11
|
return (
|
|
11
12
|
<CheckboxPrimitive.Root
|
|
@@ -31,10 +31,12 @@ function CollapsibleDemo() {
|
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/** Shows a controlled collapsible section that starts closed and can be toggled with a button. */
|
|
34
35
|
export const Default: Story = {
|
|
35
36
|
render: () => <CollapsibleDemo />,
|
|
36
37
|
};
|
|
37
38
|
|
|
39
|
+
/** Shows a collapsible section that starts in the open state using `defaultOpen`. */
|
|
38
40
|
export const DefaultOpen: Story = {
|
|
39
41
|
render: () => (
|
|
40
42
|
<Collapsible defaultOpen className="w-[350px] space-y-2">
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { Collapsible as CollapsiblePrimitive } from 'radix-ui';
|
|
2
2
|
|
|
3
|
+
/** A disclosure widget that toggles content visibility. Compose with CollapsibleTrigger and CollapsibleContent. */
|
|
3
4
|
function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
|
4
5
|
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
|
|
5
6
|
}
|
|
6
7
|
|
|
8
|
+
/** The interactive element that toggles the CollapsibleContent open or closed. */
|
|
7
9
|
function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
|
8
10
|
return <CollapsiblePrimitive.CollapsibleTrigger data-slot="collapsible-trigger" {...props} />;
|
|
9
11
|
}
|
|
10
12
|
|
|
13
|
+
/** The content region that is shown or hidden when the Collapsible is toggled. */
|
|
11
14
|
function CollapsibleContent({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
|
12
15
|
return <CollapsiblePrimitive.CollapsibleContent data-slot="collapsible-content" {...props} />;
|
|
13
16
|
}
|
|
@@ -64,10 +64,12 @@ const meta: Meta = {
|
|
|
64
64
|
export default meta;
|
|
65
65
|
type Story = StoryObj;
|
|
66
66
|
|
|
67
|
+
/** Shows a searchable combobox with type-ahead filtering of framework options. */
|
|
67
68
|
export const Default: Story = {
|
|
68
69
|
render: () => <SearchableCombobox />,
|
|
69
70
|
};
|
|
70
71
|
|
|
72
|
+
/** Demonstrates the combobox with a clear button that resets the selection. */
|
|
71
73
|
export const WithClear: Story = {
|
|
72
74
|
render: () => <ClearableCombobox />,
|
|
73
75
|
};
|
|
@@ -8,12 +8,22 @@ import { cn } from '@/lib/utils';
|
|
|
8
8
|
import { Button } from '@/components/ui/Button';
|
|
9
9
|
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from '@/components/ui/InputGroup';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* An autocomplete input that combines a text field with a filterable dropdown list.
|
|
13
|
+
* Built on Base UI Combobox primitive. Supports single and multi-select with chips,
|
|
14
|
+
* custom filtering, grouped options, and clearable selections.
|
|
15
|
+
*
|
|
16
|
+
* Compose with ComboboxInput, ComboboxContent, ComboboxList, and ComboboxItem.
|
|
17
|
+
* For multi-select, use ComboboxChips, ComboboxChip, and ComboboxChipsInput.
|
|
18
|
+
*/
|
|
11
19
|
const Combobox = ComboboxPrimitive.Root;
|
|
12
20
|
|
|
21
|
+
/** Renders the display text for the currently selected combobox value. */
|
|
13
22
|
function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props) {
|
|
14
23
|
return <ComboboxPrimitive.Value data-slot="combobox-value" {...props} />;
|
|
15
24
|
}
|
|
16
25
|
|
|
26
|
+
/** Button that toggles the combobox dropdown open/closed. Renders a chevron icon automatically. */
|
|
17
27
|
function ComboboxTrigger({ className, children, ...props }: ComboboxPrimitive.Trigger.Props) {
|
|
18
28
|
return (
|
|
19
29
|
<ComboboxPrimitive.Trigger
|
|
@@ -27,6 +37,7 @@ function ComboboxTrigger({ className, children, ...props }: ComboboxPrimitive.Tr
|
|
|
27
37
|
);
|
|
28
38
|
}
|
|
29
39
|
|
|
40
|
+
/** Button that clears the current combobox selection. Renders an X icon. */
|
|
30
41
|
function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {
|
|
31
42
|
return (
|
|
32
43
|
<ComboboxPrimitive.Clear
|
|
@@ -40,11 +51,16 @@ function ComboboxClear({ className, ...props }: ComboboxPrimitive.Clear.Props) {
|
|
|
40
51
|
);
|
|
41
52
|
}
|
|
42
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Text input for filtering combobox options, wrapped in an InputGroup with optional trigger and clear buttons.
|
|
56
|
+
*/
|
|
43
57
|
function ComboboxInput({
|
|
44
58
|
className,
|
|
45
59
|
children,
|
|
46
60
|
disabled = false,
|
|
61
|
+
/** Whether to show the dropdown toggle chevron button. */
|
|
47
62
|
showTrigger = true,
|
|
63
|
+
/** Whether to show a clear button when a value is selected. */
|
|
48
64
|
showClear = false,
|
|
49
65
|
...props
|
|
50
66
|
}: ComboboxPrimitive.Input.Props & {
|
|
@@ -74,6 +90,7 @@ function ComboboxInput({
|
|
|
74
90
|
);
|
|
75
91
|
}
|
|
76
92
|
|
|
93
|
+
/** Positioned popover that contains the combobox dropdown list. Portals to the document body. */
|
|
77
94
|
function ComboboxContent({
|
|
78
95
|
className,
|
|
79
96
|
side = 'bottom',
|
|
@@ -108,6 +125,7 @@ function ComboboxContent({
|
|
|
108
125
|
);
|
|
109
126
|
}
|
|
110
127
|
|
|
128
|
+
/** Scrollable container for combobox option items. */
|
|
111
129
|
function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {
|
|
112
130
|
return (
|
|
113
131
|
<ComboboxPrimitive.List
|
|
@@ -121,6 +139,7 @@ function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props) {
|
|
|
121
139
|
);
|
|
122
140
|
}
|
|
123
141
|
|
|
142
|
+
/** A selectable option within the combobox list. Shows a check indicator when selected. */
|
|
124
143
|
function ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.Props) {
|
|
125
144
|
return (
|
|
126
145
|
<ComboboxPrimitive.Item
|
|
@@ -142,10 +161,12 @@ function ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.
|
|
|
142
161
|
);
|
|
143
162
|
}
|
|
144
163
|
|
|
164
|
+
/** Groups related combobox items together, typically with a ComboboxLabel. */
|
|
145
165
|
function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props) {
|
|
146
166
|
return <ComboboxPrimitive.Group data-slot="combobox-group" className={cn(className)} {...props} />;
|
|
147
167
|
}
|
|
148
168
|
|
|
169
|
+
/** Non-interactive label heading for a ComboboxGroup. */
|
|
149
170
|
function ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Props) {
|
|
150
171
|
return (
|
|
151
172
|
<ComboboxPrimitive.GroupLabel
|
|
@@ -159,10 +180,12 @@ function ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Pro
|
|
|
159
180
|
);
|
|
160
181
|
}
|
|
161
182
|
|
|
183
|
+
/** Provides the collection of items for virtual scrolling or dynamic option sets. */
|
|
162
184
|
function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props) {
|
|
163
185
|
return <ComboboxPrimitive.Collection data-slot="combobox-collection" {...props} />;
|
|
164
186
|
}
|
|
165
187
|
|
|
188
|
+
/** Displayed when no combobox items match the current filter query. */
|
|
166
189
|
function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
|
|
167
190
|
return (
|
|
168
191
|
<ComboboxPrimitive.Empty
|
|
@@ -176,6 +199,7 @@ function ComboboxEmpty({ className, ...props }: ComboboxPrimitive.Empty.Props) {
|
|
|
176
199
|
);
|
|
177
200
|
}
|
|
178
201
|
|
|
202
|
+
/** Visual divider between groups of combobox items. */
|
|
179
203
|
function ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.Props) {
|
|
180
204
|
return (
|
|
181
205
|
<ComboboxPrimitive.Separator
|
|
@@ -186,6 +210,7 @@ function ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.
|
|
|
186
210
|
);
|
|
187
211
|
}
|
|
188
212
|
|
|
213
|
+
/** Container for multi-select chips, styled as a form input. Use with ComboboxChip and ComboboxChipsInput. */
|
|
189
214
|
function ComboboxChips({
|
|
190
215
|
className,
|
|
191
216
|
...props
|
|
@@ -202,9 +227,11 @@ function ComboboxChips({
|
|
|
202
227
|
);
|
|
203
228
|
}
|
|
204
229
|
|
|
230
|
+
/** Individual chip representing a selected value in multi-select mode. Optionally includes a remove button. */
|
|
205
231
|
function ComboboxChip({
|
|
206
232
|
className,
|
|
207
233
|
children,
|
|
234
|
+
/** Whether to show the remove (X) button on the chip. */
|
|
208
235
|
showRemove = true,
|
|
209
236
|
...props
|
|
210
237
|
}: ComboboxPrimitive.Chip.Props & {
|
|
@@ -233,6 +260,7 @@ function ComboboxChip({
|
|
|
233
260
|
);
|
|
234
261
|
}
|
|
235
262
|
|
|
263
|
+
/** Inline text input rendered alongside chips for multi-select filtering. */
|
|
236
264
|
function ComboboxChipsInput({ className, children, ...props }: ComboboxPrimitive.Input.Props) {
|
|
237
265
|
return (
|
|
238
266
|
<ComboboxPrimitive.Input
|
|
@@ -243,6 +271,7 @@ function ComboboxChipsInput({ className, children, ...props }: ComboboxPrimitive
|
|
|
243
271
|
);
|
|
244
272
|
}
|
|
245
273
|
|
|
274
|
+
/** Returns a ref to use as the anchor element for positioning the combobox popup (e.g. for chips layout). */
|
|
246
275
|
function useComboboxAnchor() {
|
|
247
276
|
return React.useRef<HTMLDivElement | null>(null);
|
|
248
277
|
}
|
|
@@ -18,6 +18,7 @@ const meta: Meta<typeof Command> = {
|
|
|
18
18
|
export default meta;
|
|
19
19
|
type Story = StoryObj<typeof Command>;
|
|
20
20
|
|
|
21
|
+
/** Shows the command palette with grouped items, icons, keyboard shortcuts, and a search input. */
|
|
21
22
|
export const Default: Story = {
|
|
22
23
|
render: () => (
|
|
23
24
|
<Command className="rounded-lg border shadow-md md:min-w-[450px]">
|
|
@@ -57,6 +58,7 @@ export const Default: Story = {
|
|
|
57
58
|
),
|
|
58
59
|
};
|
|
59
60
|
|
|
61
|
+
/** Shows the empty state when no items match the search query. */
|
|
60
62
|
export const WithNoResults: Story = {
|
|
61
63
|
render: () => (
|
|
62
64
|
<Command className="rounded-lg border shadow-md md:min-w-[450px]">
|
|
@@ -7,6 +7,12 @@ import { SearchIcon } from 'lucide-react';
|
|
|
7
7
|
import { cn } from '@/lib/utils';
|
|
8
8
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/Dialog';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* A command palette / search interface for filtering and selecting from a list of actions or items.
|
|
12
|
+
* Built on cmdk with keyboard navigation, grouping, and search filtering.
|
|
13
|
+
*
|
|
14
|
+
* Compose with CommandInput, CommandList, CommandGroup, CommandItem, and CommandEmpty.
|
|
15
|
+
*/
|
|
10
16
|
function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
|
|
11
17
|
return (
|
|
12
18
|
<CommandPrimitive
|
|
@@ -20,11 +26,18 @@ function Command({ className, ...props }: React.ComponentProps<typeof CommandPri
|
|
|
20
26
|
);
|
|
21
27
|
}
|
|
22
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Wraps Command in a modal Dialog for use as a keyboard-triggered command palette (e.g. Ctrl+K).
|
|
31
|
+
* Provides accessible title and description via screen-reader-only DialogHeader.
|
|
32
|
+
*/
|
|
23
33
|
function CommandDialog({
|
|
34
|
+
/** Accessible title for screen readers. */
|
|
24
35
|
title = 'Command Palette',
|
|
36
|
+
/** Accessible description for screen readers. */
|
|
25
37
|
description = 'Search for a command to run...',
|
|
26
38
|
children,
|
|
27
39
|
className,
|
|
40
|
+
/** Whether to show the X close button. */
|
|
28
41
|
showCloseButton = true,
|
|
29
42
|
...props
|
|
30
43
|
}: React.ComponentProps<typeof Dialog> & {
|
|
@@ -48,6 +61,7 @@ function CommandDialog({
|
|
|
48
61
|
);
|
|
49
62
|
}
|
|
50
63
|
|
|
64
|
+
/** Search input with a built-in search icon for filtering command items. */
|
|
51
65
|
function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
52
66
|
return (
|
|
53
67
|
<div data-slot="command-input-wrapper" className="flex h-9 items-center gap-2 border-b px-3">
|
|
@@ -64,6 +78,7 @@ function CommandInput({ className, ...props }: React.ComponentProps<typeof Comma
|
|
|
64
78
|
);
|
|
65
79
|
}
|
|
66
80
|
|
|
81
|
+
/** Scrollable container for command results. */
|
|
67
82
|
function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
68
83
|
return (
|
|
69
84
|
<CommandPrimitive.List
|
|
@@ -74,10 +89,12 @@ function CommandList({ className, ...props }: React.ComponentProps<typeof Comman
|
|
|
74
89
|
);
|
|
75
90
|
}
|
|
76
91
|
|
|
92
|
+
/** Displayed when no command items match the search query. */
|
|
77
93
|
function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
78
94
|
return <CommandPrimitive.Empty data-slot="command-empty" className="py-6 text-center text-sm" {...props} />;
|
|
79
95
|
}
|
|
80
96
|
|
|
97
|
+
/** Groups related command items under a heading label. */
|
|
81
98
|
function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
82
99
|
return (
|
|
83
100
|
<CommandPrimitive.Group
|
|
@@ -91,6 +108,7 @@ function CommandGroup({ className, ...props }: React.ComponentProps<typeof Comma
|
|
|
91
108
|
);
|
|
92
109
|
}
|
|
93
110
|
|
|
111
|
+
/** Visual divider between command groups. */
|
|
94
112
|
function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
95
113
|
return (
|
|
96
114
|
<CommandPrimitive.Separator
|
|
@@ -101,6 +119,7 @@ function CommandSeparator({ className, ...props }: React.ComponentProps<typeof C
|
|
|
101
119
|
);
|
|
102
120
|
}
|
|
103
121
|
|
|
122
|
+
/** A selectable action or item within a command list. Supports icons and keyboard shortcuts via CommandShortcut. */
|
|
104
123
|
function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
105
124
|
return (
|
|
106
125
|
<CommandPrimitive.Item
|
|
@@ -114,6 +133,7 @@ function CommandItem({ className, ...props }: React.ComponentProps<typeof Comman
|
|
|
114
133
|
);
|
|
115
134
|
}
|
|
116
135
|
|
|
136
|
+
/** Displays a keyboard shortcut hint aligned to the right side of a CommandItem. */
|
|
117
137
|
function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>) {
|
|
118
138
|
return (
|
|
119
139
|
<span
|
|
@@ -18,6 +18,7 @@ const meta: Meta<typeof ContextMenu> = {
|
|
|
18
18
|
export default meta;
|
|
19
19
|
type Story = StoryObj<typeof ContextMenu>;
|
|
20
20
|
|
|
21
|
+
/** Shows a context menu with shortcuts, submenus, separators, and a destructive action. */
|
|
21
22
|
export const Default: Story = {
|
|
22
23
|
render: () => (
|
|
23
24
|
<ContextMenu>
|
|
@@ -50,6 +51,7 @@ export const Default: Story = {
|
|
|
50
51
|
),
|
|
51
52
|
};
|
|
52
53
|
|
|
54
|
+
/** Shows a minimal context menu with basic cut/copy/paste actions. */
|
|
53
55
|
export const Simple: Story = {
|
|
54
56
|
render: () => (
|
|
55
57
|
<ContextMenu>
|