@foundrykit/components 2.1.1 → 2.1.4

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 (34) hide show
  1. package/.turbo/turbo-build.log +14 -14
  2. package/.turbo/turbo-type-check.log +1 -1
  3. package/CHANGELOG.md +26 -0
  4. package/README.md +49 -145
  5. package/dist/index.d.ts +270 -60
  6. package/dist/index.js +2137 -1447
  7. package/dist/index.js.map +1 -1
  8. package/package.json +16 -9
  9. package/src/components/advanced-search-bar/index.tsx +121 -122
  10. package/src/components/calendar/config.ts +1 -1
  11. package/src/components/calendar/index.tsx +37 -25
  12. package/src/components/carousel/config.ts +28 -0
  13. package/src/components/carousel/index.tsx +258 -0
  14. package/src/components/chart/config.ts +28 -0
  15. package/src/components/chart/index.tsx +365 -0
  16. package/src/components/combobox/config.ts +28 -0
  17. package/src/components/combobox/index.tsx +101 -0
  18. package/src/components/command/config.ts +1 -1
  19. package/src/components/command/index.tsx +23 -12
  20. package/src/components/data-table/config.ts +28 -0
  21. package/src/components/data-table/index.tsx +124 -0
  22. package/src/components/date-picker/config.ts +1 -1
  23. package/src/components/date-picker/index.tsx +119 -51
  24. package/src/components/form/index.tsx +29 -11
  25. package/src/components/input-otp/config.ts +28 -0
  26. package/src/components/input-otp/index.tsx +92 -0
  27. package/src/components/pagination/config.ts +1 -1
  28. package/src/components/pagination/index.tsx +16 -8
  29. package/src/components/search-bar/config.ts +1 -1
  30. package/src/components/search-bar/index.tsx +9 -3
  31. package/src/components/sidebar/index.tsx +22 -25
  32. package/src/components/theme-toggle/index.tsx +2 -3
  33. package/src/index.ts +66 -37
  34. package/eslint.config.js +0 -4
@@ -0,0 +1,258 @@
1
+ 'use client';
2
+
3
+ import { Button } from '@foundrykit/primitives';
4
+ import { cn } from '@foundrykit/utils';
5
+ import useEmblaCarousel, {
6
+ type UseEmblaCarouselType,
7
+ } from 'embla-carousel-react';
8
+ import { ArrowLeftIcon, ArrowRightIcon } from 'lucide-react';
9
+ import * as React from 'react';
10
+
11
+ type CarouselApi = UseEmblaCarouselType[1];
12
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
13
+ type CarouselOptions = UseCarouselParameters[0];
14
+ type CarouselPlugin = UseCarouselParameters[1];
15
+
16
+ type CarouselProps = {
17
+ opts?: CarouselOptions;
18
+ plugins?: CarouselPlugin;
19
+ orientation?: 'horizontal' | 'vertical';
20
+ setApi?: (api: CarouselApi) => void;
21
+ };
22
+
23
+ type CarouselContextProps = {
24
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0];
25
+ api: ReturnType<typeof useEmblaCarousel>[1];
26
+ scrollPrev: () => void;
27
+ scrollNext: () => void;
28
+ canScrollPrev: boolean;
29
+ canScrollNext: boolean;
30
+ } & CarouselProps;
31
+
32
+ const CarouselContext = React.createContext<CarouselContextProps | null>(null);
33
+
34
+ function useCarousel() {
35
+ const context = React.useContext(CarouselContext);
36
+
37
+ if (!context) {
38
+ throw new Error('useCarousel must be used within a <Carousel />');
39
+ }
40
+
41
+ return context;
42
+ }
43
+
44
+ /**
45
+ * Carousel root that provides Embla state to its parts.
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * <Carousel>
50
+ * <CarouselContent>
51
+ * <CarouselItem>Slide 1</CarouselItem>
52
+ * </CarouselContent>
53
+ * <CarouselPrevious />
54
+ * <CarouselNext />
55
+ * </Carousel>
56
+ * ```
57
+ */
58
+ function Carousel({
59
+ orientation = 'horizontal',
60
+ opts,
61
+ setApi,
62
+ plugins,
63
+ className,
64
+ children,
65
+ ...props
66
+ }: React.ComponentProps<'div'> & CarouselProps) {
67
+ const [carouselRef, api] = useEmblaCarousel(
68
+ {
69
+ ...opts,
70
+ axis: orientation === 'horizontal' ? 'x' : 'y',
71
+ },
72
+ plugins
73
+ );
74
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false);
75
+ const [canScrollNext, setCanScrollNext] = React.useState(false);
76
+
77
+ const onSelect = React.useCallback((api: CarouselApi) => {
78
+ if (!api) return;
79
+ setCanScrollPrev(api.canScrollPrev());
80
+ setCanScrollNext(api.canScrollNext());
81
+ }, []);
82
+
83
+ const scrollPrev = React.useCallback(() => {
84
+ api?.scrollPrev();
85
+ }, [api]);
86
+
87
+ const scrollNext = React.useCallback(() => {
88
+ api?.scrollNext();
89
+ }, [api]);
90
+
91
+ const handleKeyDown = React.useCallback(
92
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
93
+ if (event.key === 'ArrowLeft') {
94
+ event.preventDefault();
95
+ scrollPrev();
96
+ } else if (event.key === 'ArrowRight') {
97
+ event.preventDefault();
98
+ scrollNext();
99
+ }
100
+ },
101
+ [scrollPrev, scrollNext]
102
+ );
103
+
104
+ React.useEffect(() => {
105
+ if (!api || !setApi) return;
106
+ setApi(api);
107
+ }, [api, setApi]);
108
+
109
+ React.useEffect(() => {
110
+ if (!api) return;
111
+ onSelect(api);
112
+ api.on('reInit', onSelect);
113
+ api.on('select', onSelect);
114
+
115
+ return () => {
116
+ api?.off('select', onSelect);
117
+ };
118
+ }, [api, onSelect]);
119
+
120
+ return (
121
+ <CarouselContext.Provider
122
+ value={{
123
+ carouselRef,
124
+ api,
125
+ opts,
126
+ orientation:
127
+ orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),
128
+ scrollPrev,
129
+ scrollNext,
130
+ canScrollPrev,
131
+ canScrollNext,
132
+ }}
133
+ >
134
+ <div
135
+ data-slot='carousel'
136
+ onKeyDownCapture={handleKeyDown}
137
+ className={cn('relative', className)}
138
+ role='region'
139
+ aria-roledescription='carousel'
140
+ {...props}
141
+ >
142
+ {children}
143
+ </div>
144
+ </CarouselContext.Provider>
145
+ );
146
+ }
147
+
148
+ /** Scrollable track that holds the carousel items. */
149
+ function CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {
150
+ const { carouselRef, orientation } = useCarousel();
151
+
152
+ return (
153
+ <div
154
+ ref={carouselRef}
155
+ data-slot='carousel-content'
156
+ className='overflow-hidden'
157
+ >
158
+ <div
159
+ className={cn(
160
+ 'flex',
161
+ orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col',
162
+ className
163
+ )}
164
+ {...props}
165
+ />
166
+ </div>
167
+ );
168
+ }
169
+
170
+ /** A single slide within a {@link CarouselContent}. */
171
+ function CarouselItem({ className, ...props }: React.ComponentProps<'div'>) {
172
+ const { orientation } = useCarousel();
173
+
174
+ return (
175
+ <div
176
+ data-slot='carousel-item'
177
+ role='group'
178
+ aria-roledescription='slide'
179
+ className={cn(
180
+ 'min-w-0 shrink-0 grow-0 basis-full',
181
+ orientation === 'horizontal' ? 'pl-4' : 'pt-4',
182
+ className
183
+ )}
184
+ {...props}
185
+ />
186
+ );
187
+ }
188
+
189
+ /** Button that scrolls the carousel to the previous slide. */
190
+ function CarouselPrevious({
191
+ className,
192
+ variant = 'outline',
193
+ size = 'icon',
194
+ ...props
195
+ }: React.ComponentProps<typeof Button>) {
196
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel();
197
+
198
+ return (
199
+ <Button
200
+ data-slot='carousel-previous'
201
+ variant={variant}
202
+ size={size}
203
+ className={cn(
204
+ 'absolute size-8 rounded-full',
205
+ orientation === 'horizontal'
206
+ ? 'top-1/2 -left-12 -translate-y-1/2'
207
+ : '-top-12 left-1/2 -translate-x-1/2 rotate-90',
208
+ className
209
+ )}
210
+ disabled={!canScrollPrev}
211
+ onClick={scrollPrev}
212
+ {...props}
213
+ >
214
+ <ArrowLeftIcon />
215
+ <span className='sr-only'>Previous slide</span>
216
+ </Button>
217
+ );
218
+ }
219
+
220
+ /** Button that scrolls the carousel to the next slide. */
221
+ function CarouselNext({
222
+ className,
223
+ variant = 'outline',
224
+ size = 'icon',
225
+ ...props
226
+ }: React.ComponentProps<typeof Button>) {
227
+ const { orientation, scrollNext, canScrollNext } = useCarousel();
228
+
229
+ return (
230
+ <Button
231
+ data-slot='carousel-next'
232
+ variant={variant}
233
+ size={size}
234
+ className={cn(
235
+ 'absolute size-8 rounded-full',
236
+ orientation === 'horizontal'
237
+ ? 'top-1/2 -right-12 -translate-y-1/2'
238
+ : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',
239
+ className
240
+ )}
241
+ disabled={!canScrollNext}
242
+ onClick={scrollNext}
243
+ {...props}
244
+ >
245
+ <ArrowRightIcon />
246
+ <span className='sr-only'>Next slide</span>
247
+ </Button>
248
+ );
249
+ }
250
+
251
+ export {
252
+ Carousel,
253
+ type CarouselApi,
254
+ CarouselContent,
255
+ CarouselItem,
256
+ CarouselNext,
257
+ CarouselPrevious,
258
+ };
@@ -0,0 +1,28 @@
1
+ import type { ComponentConfig } from '@foundrykit/types';
2
+
3
+ export const ChartConfig: ComponentConfig = {
4
+ name: 'Chart',
5
+ description:
6
+ 'A set of composable chart primitives built on Recharts with themeable colors, tooltips, and legends.',
7
+ category: 'components',
8
+ tags: ['chart', 'graph', 'recharts', 'data', 'visualization'],
9
+ preview: {
10
+ type: 'static',
11
+ html: '<div class="flex h-24 w-full items-end justify-center gap-2 rounded-md border border-gray-300 bg-gray-100 p-3"><div class="h-8 w-4 rounded-sm bg-gray-400"></div><div class="h-16 w-4 rounded-sm bg-gray-500"></div><div class="h-12 w-4 rounded-sm bg-gray-400"></div><div class="h-20 w-4 rounded-sm bg-gray-600"></div></div>',
12
+ },
13
+ variants: [
14
+ {
15
+ name: 'Default',
16
+ description: 'A bar chart rendered inside a ChartContainer',
17
+ code: '<ChartContainer config={config}><BarChart data={data}><Bar dataKey="total" /></BarChart></ChartContainer>',
18
+ preview: {
19
+ type: 'component',
20
+ component: 'ChartContainer',
21
+ props: {},
22
+ },
23
+ },
24
+ ],
25
+ dependencies: ['utils'],
26
+ packageDependencies: ['recharts'],
27
+ files: ['components/chart/index.tsx'],
28
+ };
@@ -0,0 +1,365 @@
1
+ 'use client';
2
+
3
+ import { cn } from '@foundrykit/utils';
4
+ import * as React from 'react';
5
+ import * as RechartsPrimitive from 'recharts';
6
+
7
+ // Format: { THEME_NAME: CSS_SELECTOR }
8
+ const THEMES = { light: '', dark: '.dark' } as const;
9
+
10
+ export type ChartConfig = {
11
+ [k in string]: {
12
+ label?: React.ReactNode;
13
+ icon?: React.ComponentType;
14
+ } & (
15
+ | { color?: string; theme?: never }
16
+ | { color?: never; theme: Record<keyof typeof THEMES, string> }
17
+ );
18
+ };
19
+
20
+ type ChartContextProps = {
21
+ config: ChartConfig;
22
+ };
23
+
24
+ const ChartContext = React.createContext<ChartContextProps | null>(null);
25
+
26
+ function useChart() {
27
+ const context = React.useContext(ChartContext);
28
+
29
+ if (!context) {
30
+ throw new Error('useChart must be used within a <ChartContainer />');
31
+ }
32
+
33
+ return context;
34
+ }
35
+
36
+ /**
37
+ * Responsive chart wrapper that shares config (labels, colors) with its parts.
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * <ChartContainer config={config}>
42
+ * <BarChart data={data}>
43
+ * <Bar dataKey='total' fill='var(--color-total)' />
44
+ * </BarChart>
45
+ * </ChartContainer>
46
+ * ```
47
+ */
48
+ function ChartContainer({
49
+ id,
50
+ className,
51
+ children,
52
+ config,
53
+ ...props
54
+ }: React.ComponentProps<'div'> & {
55
+ config: ChartConfig;
56
+ children: React.ComponentProps<
57
+ typeof RechartsPrimitive.ResponsiveContainer
58
+ >['children'];
59
+ }) {
60
+ const uniqueId = React.useId();
61
+ const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`;
62
+
63
+ return (
64
+ <ChartContext.Provider value={{ config }}>
65
+ <div
66
+ data-slot='chart'
67
+ data-chart={chartId}
68
+ className={cn(
69
+ "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
70
+ className
71
+ )}
72
+ {...props}
73
+ >
74
+ <ChartStyle id={chartId} config={config} />
75
+ <RechartsPrimitive.ResponsiveContainer>
76
+ {children}
77
+ </RechartsPrimitive.ResponsiveContainer>
78
+ </div>
79
+ </ChartContext.Provider>
80
+ );
81
+ }
82
+
83
+ function ChartStyle({ id, config }: { id: string; config: ChartConfig }) {
84
+ const colorConfig = Object.entries(config).filter(
85
+ ([, itemConfig]) => itemConfig.theme || itemConfig.color
86
+ );
87
+
88
+ if (!colorConfig.length) {
89
+ return null;
90
+ }
91
+
92
+ return (
93
+ <style
94
+ dangerouslySetInnerHTML={{
95
+ __html: Object.entries(THEMES)
96
+ .map(
97
+ ([theme, prefix]) => `
98
+ ${prefix} [data-chart=${id}] {
99
+ ${colorConfig
100
+ .map(([key, itemConfig]) => {
101
+ const color =
102
+ itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
103
+ itemConfig.color;
104
+ return color ? ` --color-${key}: ${color};` : null;
105
+ })
106
+ .join('\n')}
107
+ }
108
+ `
109
+ )
110
+ .join('\n'),
111
+ }}
112
+ />
113
+ );
114
+ }
115
+
116
+ const ChartTooltip = RechartsPrimitive.Tooltip;
117
+
118
+ function ChartTooltipContent({
119
+ active,
120
+ payload,
121
+ className,
122
+ indicator = 'dot',
123
+ hideLabel = false,
124
+ hideIndicator = false,
125
+ label,
126
+ labelFormatter,
127
+ labelClassName,
128
+ formatter,
129
+ color,
130
+ nameKey,
131
+ labelKey,
132
+ }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
133
+ React.ComponentProps<'div'> & {
134
+ hideLabel?: boolean;
135
+ hideIndicator?: boolean;
136
+ indicator?: 'line' | 'dot' | 'dashed';
137
+ nameKey?: string;
138
+ labelKey?: string;
139
+ }) {
140
+ const { config } = useChart();
141
+
142
+ const tooltipLabel = React.useMemo(() => {
143
+ if (hideLabel || !payload?.length) {
144
+ return null;
145
+ }
146
+
147
+ const [item] = payload;
148
+ const key = `${labelKey || item?.dataKey || item?.name || 'value'}`;
149
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
150
+ const value =
151
+ !labelKey && typeof label === 'string'
152
+ ? config[label as keyof typeof config]?.label || label
153
+ : itemConfig?.label;
154
+
155
+ if (labelFormatter) {
156
+ return (
157
+ <div className={cn('font-medium', labelClassName)}>
158
+ {labelFormatter(value, payload)}
159
+ </div>
160
+ );
161
+ }
162
+
163
+ if (!value) {
164
+ return null;
165
+ }
166
+
167
+ return <div className={cn('font-medium', labelClassName)}>{value}</div>;
168
+ }, [
169
+ label,
170
+ labelFormatter,
171
+ payload,
172
+ hideLabel,
173
+ labelClassName,
174
+ config,
175
+ labelKey,
176
+ ]);
177
+
178
+ if (!active || !payload?.length) {
179
+ return null;
180
+ }
181
+
182
+ const nestLabel = payload.length === 1 && indicator !== 'dot';
183
+
184
+ return (
185
+ <div
186
+ data-slot='chart-tooltip-content'
187
+ className={cn(
188
+ 'border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl',
189
+ className
190
+ )}
191
+ >
192
+ {!nestLabel ? tooltipLabel : null}
193
+ <div className='grid gap-1.5'>
194
+ {payload.map((item, index) => {
195
+ const key = `${nameKey || item.name || item.dataKey || 'value'}`;
196
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
197
+ const indicatorColor = color || item.payload.fill || item.color;
198
+
199
+ return (
200
+ <div
201
+ key={item.dataKey}
202
+ className={cn(
203
+ '[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5',
204
+ indicator === 'dot' && 'items-center'
205
+ )}
206
+ >
207
+ {formatter && item?.value !== undefined && item.name ? (
208
+ formatter(item.value, item.name, item, index, item.payload)
209
+ ) : (
210
+ <>
211
+ {itemConfig?.icon ? (
212
+ <itemConfig.icon />
213
+ ) : (
214
+ !hideIndicator && (
215
+ <div
216
+ className={cn(
217
+ 'shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)',
218
+ {
219
+ 'h-2.5 w-2.5': indicator === 'dot',
220
+ 'w-1': indicator === 'line',
221
+ 'w-0 border-[1.5px] border-dashed bg-transparent':
222
+ indicator === 'dashed',
223
+ 'my-0.5': nestLabel && indicator === 'dashed',
224
+ }
225
+ )}
226
+ style={
227
+ {
228
+ '--color-bg': indicatorColor,
229
+ '--color-border': indicatorColor,
230
+ } as React.CSSProperties
231
+ }
232
+ />
233
+ )
234
+ )}
235
+ <div
236
+ className={cn(
237
+ 'flex flex-1 justify-between leading-none',
238
+ nestLabel ? 'items-end' : 'items-center'
239
+ )}
240
+ >
241
+ <div className='grid gap-1.5'>
242
+ {nestLabel ? tooltipLabel : null}
243
+ <span className='text-muted-foreground'>
244
+ {itemConfig?.label || item.name}
245
+ </span>
246
+ </div>
247
+ {item.value && (
248
+ <span className='text-foreground font-mono font-medium tabular-nums'>
249
+ {item.value.toLocaleString()}
250
+ </span>
251
+ )}
252
+ </div>
253
+ </>
254
+ )}
255
+ </div>
256
+ );
257
+ })}
258
+ </div>
259
+ </div>
260
+ );
261
+ }
262
+
263
+ const ChartLegend = RechartsPrimitive.Legend;
264
+
265
+ function ChartLegendContent({
266
+ className,
267
+ hideIcon = false,
268
+ payload,
269
+ verticalAlign = 'bottom',
270
+ nameKey,
271
+ }: React.ComponentProps<'div'> &
272
+ Pick<RechartsPrimitive.LegendProps, 'payload' | 'verticalAlign'> & {
273
+ hideIcon?: boolean;
274
+ nameKey?: string;
275
+ }) {
276
+ const { config } = useChart();
277
+
278
+ if (!payload?.length) {
279
+ return null;
280
+ }
281
+
282
+ return (
283
+ <div
284
+ data-slot='chart-legend-content'
285
+ className={cn(
286
+ 'flex items-center justify-center gap-4',
287
+ verticalAlign === 'top' ? 'pb-3' : 'pt-3',
288
+ className
289
+ )}
290
+ >
291
+ {payload.map(item => {
292
+ const key = `${nameKey || item.dataKey || 'value'}`;
293
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
294
+
295
+ return (
296
+ <div
297
+ key={item.value}
298
+ className={cn(
299
+ '[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3'
300
+ )}
301
+ >
302
+ {itemConfig?.icon && !hideIcon ? (
303
+ <itemConfig.icon />
304
+ ) : (
305
+ <div
306
+ className='h-2 w-2 shrink-0 rounded-[2px]'
307
+ style={{ backgroundColor: item.color }}
308
+ />
309
+ )}
310
+ {itemConfig?.label}
311
+ </div>
312
+ );
313
+ })}
314
+ </div>
315
+ );
316
+ }
317
+
318
+ // Helper to extract item config from a payload.
319
+ function getPayloadConfigFromPayload(
320
+ config: ChartConfig,
321
+ payload: unknown,
322
+ key: string
323
+ ) {
324
+ if (typeof payload !== 'object' || payload === null) {
325
+ return undefined;
326
+ }
327
+
328
+ const payloadPayload =
329
+ 'payload' in payload &&
330
+ typeof payload.payload === 'object' &&
331
+ payload.payload !== null
332
+ ? payload.payload
333
+ : undefined;
334
+
335
+ let configLabelKey: string = key;
336
+
337
+ if (
338
+ key in payload &&
339
+ typeof payload[key as keyof typeof payload] === 'string'
340
+ ) {
341
+ configLabelKey = payload[key as keyof typeof payload] as string;
342
+ } else if (
343
+ payloadPayload &&
344
+ key in payloadPayload &&
345
+ typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'
346
+ ) {
347
+ configLabelKey = payloadPayload[
348
+ key as keyof typeof payloadPayload
349
+ ] as string;
350
+ }
351
+
352
+ return configLabelKey in config
353
+ ? config[configLabelKey]
354
+ : config[key as keyof typeof config];
355
+ }
356
+
357
+ export {
358
+ ChartContainer,
359
+ ChartLegend,
360
+ ChartLegendContent,
361
+ ChartStyle,
362
+ ChartTooltip,
363
+ ChartTooltipContent,
364
+ useChart,
365
+ };
@@ -0,0 +1,28 @@
1
+ import type { ComponentConfig } from '@foundrykit/types';
2
+
3
+ export const ComboboxConfig: ComponentConfig = {
4
+ name: 'Combobox',
5
+ description:
6
+ 'A searchable single-select input that combines a popover with a filterable command list.',
7
+ category: 'components',
8
+ tags: ['combobox', 'select', 'search', 'interactive', 'form'],
9
+ preview: {
10
+ type: 'static',
11
+ html: '<div class="flex h-9 w-[200px] items-center justify-between rounded-md border border-gray-300 bg-white px-3"><span class="text-sm text-gray-600">Select framework...</span><div class="h-4 w-4 opacity-50">⇅</div></div>',
12
+ },
13
+ variants: [
14
+ {
15
+ name: 'Default',
16
+ description: 'Default combobox with searchable options',
17
+ code: '<Combobox options={[{ value: "next", label: "Next.js" }]} placeholder="Select framework..." />',
18
+ preview: {
19
+ type: 'component',
20
+ component: 'Combobox',
21
+ props: {},
22
+ },
23
+ },
24
+ ],
25
+ dependencies: ['utils', 'primitives', 'command'],
26
+ packageDependencies: ['lucide-react'],
27
+ files: ['components/combobox/index.tsx'],
28
+ };