@auto-engineer/generate-react-client 1.33.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.
Files changed (135) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/starter/.storybook/main.ts +4 -1
  3. package/dist/starter/.storybook/manager.ts +4 -5
  4. package/dist/starter/codegen.ts +17 -0
  5. package/dist/starter/package.json +8 -4
  6. package/dist/starter/pnpm-lock.yaml +2643 -69
  7. package/dist/starter/scripts/build-component-db.ts +157 -0
  8. package/dist/starter/src/components/ui/Accordion.stories.tsx +2 -0
  9. package/dist/starter/src/components/ui/Accordion.tsx +4 -0
  10. package/dist/starter/src/components/ui/Alert.stories.tsx +2 -0
  11. package/dist/starter/src/components/ui/Alert.tsx +7 -0
  12. package/dist/starter/src/components/ui/AlertDialog.stories.tsx +2 -0
  13. package/dist/starter/src/components/ui/AlertDialog.tsx +15 -0
  14. package/dist/starter/src/components/ui/AspectRatio.stories.tsx +2 -0
  15. package/dist/starter/src/components/ui/AspectRatio.tsx +4 -0
  16. package/dist/starter/src/components/ui/Avatar.stories.tsx +3 -0
  17. package/dist/starter/src/components/ui/Avatar.tsx +11 -0
  18. package/dist/starter/src/components/ui/Badge.stories.tsx +5 -0
  19. package/dist/starter/src/components/ui/Badge.tsx +5 -0
  20. package/dist/starter/src/components/ui/Breadcrumb.stories.tsx +2 -0
  21. package/dist/starter/src/components/ui/Breadcrumb.tsx +12 -0
  22. package/dist/starter/src/components/ui/Button.stories.tsx +10 -0
  23. package/dist/starter/src/components/ui/Button.tsx +5 -0
  24. package/dist/starter/src/components/ui/ButtonGroup.stories.tsx +2 -0
  25. package/dist/starter/src/components/ui/ButtonGroup.tsx +6 -0
  26. package/dist/starter/src/components/ui/Calendar.stories.tsx +2 -0
  27. package/dist/starter/src/components/ui/Calendar.tsx +6 -0
  28. package/dist/starter/src/components/ui/Card.stories.tsx +2 -0
  29. package/dist/starter/src/components/ui/Card.tsx +10 -0
  30. package/dist/starter/src/components/ui/Carousel.stories.tsx +2 -0
  31. package/dist/starter/src/components/ui/Carousel.tsx +9 -0
  32. package/dist/starter/src/components/ui/Chart.stories.tsx +1 -0
  33. package/dist/starter/src/components/ui/Chart.tsx +9 -0
  34. package/dist/starter/src/components/ui/Checkbox.stories.tsx +4 -0
  35. package/dist/starter/src/components/ui/Checkbox.tsx +1 -0
  36. package/dist/starter/src/components/ui/Collapsible.stories.tsx +2 -0
  37. package/dist/starter/src/components/ui/Collapsible.tsx +3 -0
  38. package/dist/starter/src/components/ui/Combobox.stories.tsx +2 -0
  39. package/dist/starter/src/components/ui/Combobox.tsx +29 -0
  40. package/dist/starter/src/components/ui/Command.stories.tsx +2 -0
  41. package/dist/starter/src/components/ui/Command.tsx +20 -0
  42. package/dist/starter/src/components/ui/ContextMenu.stories.tsx +2 -0
  43. package/dist/starter/src/components/ui/ContextMenu.tsx +20 -0
  44. package/dist/starter/src/components/ui/DesignSystem-Colors.stories.tsx +1 -0
  45. package/dist/starter/src/components/ui/DesignSystem-Layout.stories.tsx +1 -0
  46. package/dist/starter/src/components/ui/DesignSystem-Overview.stories.tsx +1 -0
  47. package/dist/starter/src/components/ui/DesignSystem-Typography.stories.tsx +1 -0
  48. package/dist/starter/src/components/ui/Dialog.stories.tsx +2 -0
  49. package/dist/starter/src/components/ui/Dialog.tsx +18 -0
  50. package/dist/starter/src/components/ui/Direction.stories.tsx +2 -0
  51. package/dist/starter/src/components/ui/Direction.tsx +6 -0
  52. package/dist/starter/src/components/ui/Drawer.stories.tsx +2 -0
  53. package/dist/starter/src/components/ui/Drawer.tsx +18 -0
  54. package/dist/starter/src/components/ui/DropdownMenu.stories.tsx +2 -0
  55. package/dist/starter/src/components/ui/DropdownMenu.tsx +20 -0
  56. package/dist/starter/src/components/ui/Empty.stories.tsx +2 -0
  57. package/dist/starter/src/components/ui/Empty.tsx +13 -0
  58. package/dist/starter/src/components/ui/Field.stories.tsx +3 -0
  59. package/dist/starter/src/components/ui/Field.tsx +25 -0
  60. package/dist/starter/src/components/ui/Form.stories.tsx +1 -0
  61. package/dist/starter/src/components/ui/Form.tsx +15 -3
  62. package/dist/starter/src/components/ui/HoverCard.stories.tsx +2 -0
  63. package/dist/starter/src/components/ui/HoverCard.tsx +3 -0
  64. package/dist/starter/src/components/ui/Input.stories.tsx +4 -0
  65. package/dist/starter/src/components/ui/Input.tsx +1 -0
  66. package/dist/starter/src/components/ui/InputGroup.stories.tsx +3 -0
  67. package/dist/starter/src/components/ui/InputGroup.tsx +6 -0
  68. package/dist/starter/src/components/ui/InputOTP.stories.tsx +2 -0
  69. package/dist/starter/src/components/ui/InputOTP.tsx +4 -0
  70. package/dist/starter/src/components/ui/Item.stories.tsx +3 -0
  71. package/dist/starter/src/components/ui/Item.tsx +10 -0
  72. package/dist/starter/src/components/ui/Kbd.stories.tsx +5 -0
  73. package/dist/starter/src/components/ui/Kbd.tsx +4 -0
  74. package/dist/starter/src/components/ui/Label.stories.tsx +5 -0
  75. package/dist/starter/src/components/ui/Label.tsx +4 -0
  76. package/dist/starter/src/components/ui/Menubar.stories.tsx +2 -0
  77. package/dist/starter/src/components/ui/Menubar.tsx +15 -0
  78. package/dist/starter/src/components/ui/NativeSelect.stories.tsx +3 -0
  79. package/dist/starter/src/components/ui/NativeSelect.tsx +6 -0
  80. package/dist/starter/src/components/ui/NavigationMenu.stories.tsx +2 -0
  81. package/dist/starter/src/components/ui/NavigationMenu.tsx +10 -0
  82. package/dist/starter/src/components/ui/Pagination.stories.tsx +2 -0
  83. package/dist/starter/src/components/ui/Pagination.tsx +8 -0
  84. package/dist/starter/src/components/ui/Popover.stories.tsx +2 -0
  85. package/dist/starter/src/components/ui/Popover.tsx +5 -0
  86. package/dist/starter/src/components/ui/Progress.stories.tsx +4 -0
  87. package/dist/starter/src/components/ui/Progress.tsx +1 -0
  88. package/dist/starter/src/components/ui/RadioGroup.stories.tsx +2 -0
  89. package/dist/starter/src/components/ui/RadioGroup.tsx +5 -0
  90. package/dist/starter/src/components/ui/Resizable.stories.tsx +3 -0
  91. package/dist/starter/src/components/ui/Resizable.tsx +7 -0
  92. package/dist/starter/src/components/ui/ScrollArea.stories.tsx +2 -0
  93. package/dist/starter/src/components/ui/ScrollArea.tsx +5 -0
  94. package/dist/starter/src/components/ui/Select.stories.tsx +2 -0
  95. package/dist/starter/src/components/ui/Select.tsx +9 -0
  96. package/dist/starter/src/components/ui/Separator.stories.tsx +2 -0
  97. package/dist/starter/src/components/ui/Separator.tsx +1 -0
  98. package/dist/starter/src/components/ui/Sheet.stories.tsx +2 -0
  99. package/dist/starter/src/components/ui/Sheet.tsx +8 -0
  100. package/dist/starter/src/components/ui/Sidebar.stories.tsx +2 -0
  101. package/dist/starter/src/components/ui/Sidebar.tsx +20 -0
  102. package/dist/starter/src/components/ui/Skeleton.stories.tsx +2 -0
  103. package/dist/starter/src/components/ui/Skeleton.tsx +4 -0
  104. package/dist/starter/src/components/ui/Slider.stories.tsx +3 -0
  105. package/dist/starter/src/components/ui/Slider.tsx +1 -0
  106. package/dist/starter/src/components/ui/Sonner.stories.tsx +1 -0
  107. package/dist/starter/src/components/ui/Sonner.tsx +4 -0
  108. package/dist/starter/src/components/ui/Spinner.stories.tsx +3 -0
  109. package/dist/starter/src/components/ui/Spinner.tsx +4 -0
  110. package/dist/starter/src/components/ui/Switch.stories.tsx +4 -0
  111. package/dist/starter/src/components/ui/Switch.tsx +2 -0
  112. package/dist/starter/src/components/ui/Table.stories.tsx +2 -0
  113. package/dist/starter/src/components/ui/Table.tsx +11 -0
  114. package/dist/starter/src/components/ui/Tabs.stories.tsx +2 -0
  115. package/dist/starter/src/components/ui/Tabs.tsx +6 -0
  116. package/dist/starter/src/components/ui/Textarea.stories.tsx +3 -0
  117. package/dist/starter/src/components/ui/Textarea.tsx +4 -0
  118. package/dist/starter/src/components/ui/Toast.stories.tsx +4 -0
  119. package/dist/starter/src/components/ui/Toast.tsx +9 -0
  120. package/dist/starter/src/components/ui/Toaster.tsx +4 -0
  121. package/dist/starter/src/components/ui/Toggle.stories.tsx +4 -0
  122. package/dist/starter/src/components/ui/Toggle.tsx +1 -0
  123. package/dist/starter/src/components/ui/ToggleGroup.stories.tsx +3 -0
  124. package/dist/starter/src/components/ui/ToggleGroup.tsx +3 -0
  125. package/dist/starter/src/components/ui/Tooltip.stories.tsx +2 -0
  126. package/dist/starter/src/components/ui/Tooltip.tsx +6 -0
  127. package/dist/starter/src/gql/execute.ts +11 -0
  128. package/dist/starter/src/gql/fragment-masking.ts +83 -0
  129. package/dist/starter/src/gql/gql.ts +9 -0
  130. package/dist/starter/src/gql/graphql.ts +182 -0
  131. package/dist/starter/src/gql/index.ts +2 -0
  132. package/dist/starter/src/graphql/mutations.ts +0 -0
  133. package/dist/starter/src/graphql/queries.ts +0 -0
  134. package/dist/starter/tsconfig.json +6 -0
  135. package/package.json +2 -2
@@ -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>
@@ -6,30 +6,37 @@ import { ContextMenu as ContextMenuPrimitive } from 'radix-ui';
6
6
 
7
7
  import { cn } from '@/lib/utils';
8
8
 
9
+ /** Right-click menu with keyboard navigation. Supports submenus, checkbox/radio items, separators, and shortcuts. */
9
10
  function ContextMenu({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
10
11
  return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />;
11
12
  }
12
13
 
14
+ /** The element that opens the context menu on right-click. Wraps its children. */
13
15
  function ContextMenuTrigger({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
14
16
  return <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />;
15
17
  }
16
18
 
19
+ /** Groups related context menu items for accessibility. */
17
20
  function ContextMenuGroup({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
18
21
  return <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />;
19
22
  }
20
23
 
24
+ /** Renders context menu content into a React portal. */
21
25
  function ContextMenuPortal({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
22
26
  return <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />;
23
27
  }
24
28
 
29
+ /** Container for a submenu within the context menu. */
25
30
  function ContextMenuSub({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
26
31
  return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />;
27
32
  }
28
33
 
34
+ /** Groups radio items for single-selection within the context menu. */
29
35
  function ContextMenuRadioGroup({ ...props }: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
30
36
  return <ContextMenuPrimitive.RadioGroup data-slot="context-menu-radio-group" {...props} />;
31
37
  }
32
38
 
39
+ /** Menu item that opens a nested submenu on hover or keyboard navigation. Shows a chevron indicator. */
33
40
  function ContextMenuSubTrigger({
34
41
  className,
35
42
  inset,
@@ -54,6 +61,7 @@ function ContextMenuSubTrigger({
54
61
  );
55
62
  }
56
63
 
64
+ /** Popup content for a nested submenu. */
57
65
  function ContextMenuSubContent({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
58
66
  return (
59
67
  <ContextMenuPrimitive.SubContent
@@ -67,6 +75,7 @@ function ContextMenuSubContent({ className, ...props }: React.ComponentProps<typ
67
75
  );
68
76
  }
69
77
 
78
+ /** The positioned popup container for context menu items. Portals to the document body. */
70
79
  function ContextMenuContent({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
71
80
  return (
72
81
  <ContextMenuPrimitive.Portal>
@@ -82,9 +91,15 @@ function ContextMenuContent({ className, ...props }: React.ComponentProps<typeof
82
91
  );
83
92
  }
84
93
 
94
+ /**
95
+ * A selectable action within the context menu.
96
+ * Use variant="destructive" for dangerous actions like delete.
97
+ */
85
98
  function ContextMenuItem({
86
99
  className,
100
+ /** Adds left padding to align with items that have icons or indicators. */
87
101
  inset,
102
+ /** Use "destructive" for dangerous actions. */
88
103
  variant = 'default',
89
104
  ...props
90
105
  }: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
@@ -105,6 +120,7 @@ function ContextMenuItem({
105
120
  );
106
121
  }
107
122
 
123
+ /** A toggleable checkbox item within the context menu. Shows a check indicator when active. */
108
124
  function ContextMenuCheckboxItem({
109
125
  className,
110
126
  children,
@@ -131,6 +147,7 @@ function ContextMenuCheckboxItem({
131
147
  );
132
148
  }
133
149
 
150
+ /** A radio-selectable item within a ContextMenuRadioGroup. Shows a dot indicator when selected. */
134
151
  function ContextMenuRadioItem({
135
152
  className,
136
153
  children,
@@ -155,6 +172,7 @@ function ContextMenuRadioItem({
155
172
  );
156
173
  }
157
174
 
175
+ /** Non-interactive label within a context menu, used for section headings. */
158
176
  function ContextMenuLabel({
159
177
  className,
160
178
  inset,
@@ -172,6 +190,7 @@ function ContextMenuLabel({
172
190
  );
173
191
  }
174
192
 
193
+ /** Visual divider between groups of context menu items. */
175
194
  function ContextMenuSeparator({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
176
195
  return (
177
196
  <ContextMenuPrimitive.Separator
@@ -182,6 +201,7 @@ function ContextMenuSeparator({ className, ...props }: React.ComponentProps<type
182
201
  );
183
202
  }
184
203
 
204
+ /** Displays a keyboard shortcut hint aligned to the right side of a context menu item. */
185
205
  function ContextMenuShortcut({ className, ...props }: React.ComponentProps<'span'>) {
186
206
  return (
187
207
  <span