@zabuti/components-mcp 0.0.0-stage → 0.1.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 (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -2
  3. package/dist/index.js +527 -0
  4. package/dist/project-setup.js +424 -0
  5. package/dist/registry.js +73 -0
  6. package/dist/source.js +19 -0
  7. package/package.json +41 -4
  8. package/payload/registry.json +801 -0
  9. package/payload/src/components/ui/accordion.tsx +75 -0
  10. package/payload/src/components/ui/alert-dialog.tsx +151 -0
  11. package/payload/src/components/ui/alert.tsx +69 -0
  12. package/payload/src/components/ui/avatar.tsx +59 -0
  13. package/payload/src/components/ui/badge.tsx +57 -0
  14. package/payload/src/components/ui/breadcrumb.tsx +109 -0
  15. package/payload/src/components/ui/button.tsx +76 -0
  16. package/payload/src/components/ui/calendar.tsx +117 -0
  17. package/payload/src/components/ui/card.tsx +120 -0
  18. package/payload/src/components/ui/chart.tsx +249 -0
  19. package/payload/src/components/ui/checkbox.tsx +38 -0
  20. package/payload/src/components/ui/collapsible.tsx +30 -0
  21. package/payload/src/components/ui/combobox.tsx +127 -0
  22. package/payload/src/components/ui/command.tsx +186 -0
  23. package/payload/src/components/ui/context-menu.tsx +261 -0
  24. package/payload/src/components/ui/date-picker.tsx +140 -0
  25. package/payload/src/components/ui/dialog.tsx +176 -0
  26. package/payload/src/components/ui/dropdown-menu.tsx +277 -0
  27. package/payload/src/components/ui/form.tsx +151 -0
  28. package/payload/src/components/ui/hover-card.tsx +46 -0
  29. package/payload/src/components/ui/input-group.tsx +127 -0
  30. package/payload/src/components/ui/input.tsx +25 -0
  31. package/payload/src/components/ui/label.tsx +28 -0
  32. package/payload/src/components/ui/pagination.tsx +130 -0
  33. package/payload/src/components/ui/popover.tsx +97 -0
  34. package/payload/src/components/ui/progress.tsx +35 -0
  35. package/payload/src/components/ui/radio-group.tsx +49 -0
  36. package/payload/src/components/ui/scroll-area.tsx +67 -0
  37. package/payload/src/components/ui/select.tsx +199 -0
  38. package/payload/src/components/ui/separator.tsx +32 -0
  39. package/payload/src/components/ui/sheet.tsx +155 -0
  40. package/payload/src/components/ui/skeleton.tsx +21 -0
  41. package/payload/src/components/ui/slider.tsx +61 -0
  42. package/payload/src/components/ui/sonner.tsx +31 -0
  43. package/payload/src/components/ui/switch.tsx +40 -0
  44. package/payload/src/components/ui/table.tsx +108 -0
  45. package/payload/src/components/ui/tabs.tsx +98 -0
  46. package/payload/src/components/ui/textarea.tsx +24 -0
  47. package/payload/src/components/ui/toggle-group.tsx +72 -0
  48. package/payload/src/components/ui/toggle.tsx +54 -0
  49. package/payload/src/components/ui/tooltip.tsx +65 -0
  50. package/payload/src/lib/utils.ts +1 -0
  51. package/payload/src/themes/manifest.json +12 -0
  52. package/payload/src/themes/zabuti-ui-sky.css +14 -0
  53. package/payload/src/themes/zabuti-ui-teal.css +14 -0
  54. package/payload/src/zabuti-ui.css +272 -0
@@ -0,0 +1,117 @@
1
+ "use client"
2
+
3
+ /**
4
+ * Calendar — Zabuti UI primitive.
5
+ *
6
+ * `react-day-picker` styled over the `zabuti-ui.css` token layer, composing the
7
+ * Button primitive for the day cells and nav. Zabuti-owned, no shadcn
8
+ * dependency; `react-day-picker` is a peer dependency and owns the date logic.
9
+ *
10
+ * For a report calendar view (events on a month grid) use the Grid Reports
11
+ * feature component's Calendar tab instead — this is the date-picker input.
12
+ */
13
+ import * as React from "react"
14
+ import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"
15
+ import { DayButton, DayPicker, getDefaultClassNames } from "react-day-picker"
16
+ import { cn } from "cn"
17
+
18
+ import { Button, buttonVariants } from "@/components/ui/button"
19
+
20
+ function Calendar({
21
+ className,
22
+ classNames,
23
+ showOutsideDays = true,
24
+ captionLayout = "label",
25
+ components,
26
+ ...props
27
+ }: React.ComponentProps<typeof DayPicker>) {
28
+ const defaultClassNames = getDefaultClassNames()
29
+
30
+ return (
31
+ <DayPicker
32
+ showOutsideDays={showOutsideDays}
33
+ captionLayout={captionLayout}
34
+ className={cn("group/calendar p-3", className)}
35
+ classNames={{
36
+ root: cn("w-fit", defaultClassNames.root),
37
+ months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
38
+ month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
39
+ nav: cn(
40
+ "absolute inset-x-0 top-0 flex items-center justify-between",
41
+ defaultClassNames.nav
42
+ ),
43
+ button_previous: cn(
44
+ buttonVariants({ variant: "ghost", size: "icon-sm" }),
45
+ "text-muted-foreground",
46
+ defaultClassNames.button_previous
47
+ ),
48
+ button_next: cn(
49
+ buttonVariants({ variant: "ghost", size: "icon-sm" }),
50
+ "text-muted-foreground",
51
+ defaultClassNames.button_next
52
+ ),
53
+ month_caption: cn(
54
+ "flex h-8 items-center justify-center px-8 text-sm font-medium",
55
+ defaultClassNames.month_caption
56
+ ),
57
+ weekdays: cn("flex", defaultClassNames.weekdays),
58
+ weekday: cn(
59
+ "flex-1 rounded-md text-[0.8rem] font-normal text-muted-foreground select-none",
60
+ defaultClassNames.weekday
61
+ ),
62
+ week: cn("mt-2 flex w-full", defaultClassNames.week),
63
+ day: cn(
64
+ "group/day relative aspect-square h-full w-full p-0 text-center select-none",
65
+ defaultClassNames.day
66
+ ),
67
+ today: cn(
68
+ "rounded-md bg-muted text-foreground data-[selected=true]:bg-transparent",
69
+ defaultClassNames.today
70
+ ),
71
+ outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
72
+ disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
73
+ hidden: cn("invisible", defaultClassNames.hidden),
74
+ ...classNames,
75
+ }}
76
+ components={{
77
+ Chevron: ({ className: chevClassName, orientation, ...chevProps }) => {
78
+ const Icon = orientation === "left" ? ChevronLeftIcon : ChevronRightIcon
79
+ return <Icon className={cn("size-4", chevClassName)} {...chevProps} />
80
+ },
81
+ DayButton: CalendarDayButton,
82
+ ...components,
83
+ }}
84
+ {...props}
85
+ />
86
+ )
87
+ }
88
+
89
+ function CalendarDayButton({
90
+ className,
91
+ day,
92
+ modifiers,
93
+ ...props
94
+ }: React.ComponentProps<typeof DayButton>) {
95
+ const ref = React.useRef<HTMLButtonElement>(null)
96
+ React.useEffect(() => {
97
+ if (modifiers.focused) ref.current?.focus()
98
+ }, [modifiers.focused])
99
+
100
+ return (
101
+ <Button
102
+ ref={ref}
103
+ variant="ghost"
104
+ size="icon-sm"
105
+ data-day={day.date.toLocaleDateString()}
106
+ data-selected={modifiers.selected || undefined}
107
+ className={cn(
108
+ "size-8 w-full font-normal data-[selected=true]:bg-primary data-[selected=true]:text-primary-foreground data-[selected=true]:hover:bg-primary/90 data-[disabled=true]:opacity-50",
109
+ modifiers.outside && "text-muted-foreground",
110
+ className
111
+ )}
112
+ {...props}
113
+ />
114
+ )
115
+ }
116
+
117
+ export { Calendar, CalendarDayButton }
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Card — Zabuti UI primitive.
3
+ *
4
+ * Presentational only — plain elements + Tailwind over the `zabuti-ui.css`
5
+ * token layer. No Radix, server-safe. Zabuti-owned, no shadcn dependency.
6
+ *
7
+ * `size="sm"` tightens the `--card-spacing` rhythm; slots: header / title /
8
+ * description / action / content / footer.
9
+ *
10
+ * `CardTitle` is a real heading (`h3` by default, `level` to fit the page's
11
+ * outline), so screen-reader users and tests can find a card by its title.
12
+ * Visually it's unchanged: Tailwind's preflight resets heading styles.
13
+ */
14
+ import * as React from "react"
15
+ import { cn } from "cn"
16
+
17
+ function Card({
18
+ className,
19
+ size = "default",
20
+ ...props
21
+ }: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {
22
+ return (
23
+ <div
24
+ data-slot="card"
25
+ data-size={size}
26
+ className={cn(
27
+ "group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
28
+ className
29
+ )}
30
+ {...props}
31
+ />
32
+ )
33
+ }
34
+
35
+ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
36
+ return (
37
+ <div
38
+ data-slot="card-header"
39
+ className={cn(
40
+ "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",
41
+ className
42
+ )}
43
+ {...props}
44
+ />
45
+ )
46
+ }
47
+
48
+ function CardTitle({
49
+ className,
50
+ level = 3,
51
+ ...props
52
+ }: React.ComponentProps<"h3"> & { level?: 2 | 3 | 4 | 5 | 6 }) {
53
+ const Heading = `h${level}` as "h3"
54
+ return (
55
+ <Heading
56
+ data-slot="card-title"
57
+ className={cn(
58
+ "font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
59
+ className
60
+ )}
61
+ {...props}
62
+ />
63
+ )
64
+ }
65
+
66
+ function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
67
+ return (
68
+ <div
69
+ data-slot="card-description"
70
+ className={cn("text-sm text-muted-foreground", className)}
71
+ {...props}
72
+ />
73
+ )
74
+ }
75
+
76
+ function CardAction({ className, ...props }: React.ComponentProps<"div">) {
77
+ return (
78
+ <div
79
+ data-slot="card-action"
80
+ className={cn(
81
+ "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
82
+ className
83
+ )}
84
+ {...props}
85
+ />
86
+ )
87
+ }
88
+
89
+ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
90
+ return (
91
+ <div
92
+ data-slot="card-content"
93
+ className={cn("px-(--card-spacing)", className)}
94
+ {...props}
95
+ />
96
+ )
97
+ }
98
+
99
+ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
100
+ return (
101
+ <div
102
+ data-slot="card-footer"
103
+ className={cn(
104
+ "flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",
105
+ className
106
+ )}
107
+ {...props}
108
+ />
109
+ )
110
+ }
111
+
112
+ export {
113
+ Card,
114
+ CardHeader,
115
+ CardFooter,
116
+ CardTitle,
117
+ CardAction,
118
+ CardDescription,
119
+ CardContent,
120
+ }
@@ -0,0 +1,249 @@
1
+ "use client"
2
+
3
+ /**
4
+ * Chart — Zabuti UI primitive.
5
+ *
6
+ * Composable chart chrome over Recharts: `ChartContainer` sizes the plot and
7
+ * exposes each series as a `var(--color-<key>)` custom property; `ChartTooltip`
8
+ * / `ChartTooltipContent` and `ChartLegend` / `ChartLegendContent` render the
9
+ * shared hover and identity chrome. Zabuti-owned; Recharts is the behavioural
10
+ * base only — bring your own `<LineChart>` / `<BarChart>` / `<AreaChart>` etc.
11
+ * from `recharts` and drop these around it.
12
+ *
13
+ * A `ChartConfig` maps each series key to a `label` and either a `color` or a
14
+ * light/dark `theme` pair. A series that gives neither falls back to the
15
+ * `--zbti-chart-1..6` categorical palette (zabuti-ui.css) in declaration
16
+ * order — the dataviz-validated fixed hue sequence. Don't exceed 6 series on
17
+ * one chart; fold the rest into "Other" instead of letting the fallback wrap.
18
+ */
19
+ import * as React from "react"
20
+ import { cn } from "cn"
21
+ import * as RechartsPrimitive from "recharts"
22
+
23
+ const CATEGORICAL_SLOTS = 6
24
+
25
+ type ChartConfig = Record<
26
+ string,
27
+ {
28
+ label?: React.ReactNode
29
+ icon?: React.ComponentType
30
+ } & ({ color?: string; theme?: never } | { color?: never; theme: Record<"light" | "dark", string> })
31
+ >
32
+
33
+ const ChartContext = React.createContext<{ config: ChartConfig } | null>(null)
34
+
35
+ function useChart() {
36
+ const context = React.useContext(ChartContext)
37
+ if (!context) throw new Error("Chart components must be used within a <ChartContainer />")
38
+ return context
39
+ }
40
+
41
+ function ChartContainer({
42
+ id,
43
+ className,
44
+ children,
45
+ config,
46
+ ...props
47
+ }: Omit<React.ComponentProps<"div">, "children"> & {
48
+ config: ChartConfig
49
+ children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"]
50
+ }) {
51
+ const uniqueId = React.useId()
52
+ const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`
53
+
54
+ return (
55
+ <ChartContext.Provider value={{ config }}>
56
+ <div
57
+ data-slot="chart"
58
+ data-chart={chartId}
59
+ className={cn(
60
+ "aspect-video justify-center text-xs",
61
+ "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground",
62
+ "[&_.recharts-cartesian-grid_line]:stroke-border",
63
+ "[&_.recharts-curve.recharts-tooltip-cursor]:stroke-border",
64
+ "[&_.recharts-dot]:stroke-transparent",
65
+ "[&_.recharts-layer]:outline-hidden",
66
+ "[&_.recharts-polar-angle-axis-tick_text]:fill-muted-foreground",
67
+ "[&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border",
68
+ "[&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted",
69
+ "[&_.recharts-sector]:outline-hidden [&_.recharts-sector]:stroke-transparent",
70
+ "[&_.recharts-surface]:outline-hidden",
71
+ className
72
+ )}
73
+ {...props}
74
+ >
75
+ <ChartStyle id={chartId} config={config} />
76
+ <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>
77
+ </div>
78
+ </ChartContext.Provider>
79
+ )
80
+ }
81
+
82
+ function ChartStyle({ id, config }: { id: string; config: ChartConfig }) {
83
+ const entries = Object.entries(config)
84
+ if (!entries.length) return null
85
+
86
+ const colorFor = (mode: "light" | "dark", itemConfig: ChartConfig[string], index: number) =>
87
+ itemConfig.theme?.[mode] ?? itemConfig.color ?? `var(--zbti-chart-${(index % CATEGORICAL_SLOTS) + 1})`
88
+
89
+ const block = (mode: "light" | "dark") =>
90
+ `${mode === "dark" ? ".dark " : ""}[data-chart=${id}] {\n${entries
91
+ .map(([key, itemConfig], index) => ` --color-${key}: ${colorFor(mode, itemConfig, index)};`)
92
+ .join("\n")}\n}`
93
+
94
+ return <style dangerouslySetInnerHTML={{ __html: `${block("light")}\n${block("dark")}` }} />
95
+ }
96
+
97
+ /** Resolve a Recharts payload entry against the chart config (checks the entry itself, then its nested `payload`). */
98
+ function getPayloadConfig(config: ChartConfig, item: unknown, key: string): ChartConfig[string] | undefined {
99
+ if (typeof item !== "object" || item === null) return config[key]
100
+ const record = item as Record<string, unknown>
101
+ const nested =
102
+ "payload" in record && typeof record.payload === "object" && record.payload !== null
103
+ ? (record.payload as Record<string, unknown>)
104
+ : undefined
105
+
106
+ let resolvedKey = key
107
+ if (typeof record[key] === "string") resolvedKey = record[key] as string
108
+ else if (nested && typeof nested[key] === "string") resolvedKey = nested[key] as string
109
+
110
+ return config[resolvedKey] ?? config[key]
111
+ }
112
+
113
+ const ChartTooltip = RechartsPrimitive.Tooltip
114
+
115
+ function ChartTooltipContent({
116
+ active,
117
+ payload,
118
+ label,
119
+ className,
120
+ indicator = "dot",
121
+ hideLabel = false,
122
+ hideIndicator = false,
123
+ labelFormatter,
124
+ labelClassName,
125
+ formatter,
126
+ color,
127
+ nameKey,
128
+ labelKey,
129
+ }: Partial<RechartsPrimitive.TooltipContentProps> & {
130
+ className?: string
131
+ indicator?: "line" | "dot" | "dashed"
132
+ hideLabel?: boolean
133
+ hideIndicator?: boolean
134
+ color?: string
135
+ nameKey?: string
136
+ labelKey?: string
137
+ }) {
138
+ const { config } = useChart()
139
+
140
+ if (!active || !payload?.length) return null
141
+
142
+ const [first] = payload
143
+ const labelConfigKey = labelKey ?? String(first?.dataKey ?? first?.name ?? "")
144
+ const itemConfig = getPayloadConfig(config, first, labelConfigKey)
145
+ const resolvedLabel =
146
+ !labelKey && typeof label === "string" ? (config[label]?.label ?? label) : itemConfig?.label
147
+ const tooltipLabel = hideLabel ? null : (
148
+ <div className={cn("font-medium text-foreground", labelClassName)}>
149
+ {labelFormatter ? labelFormatter(resolvedLabel, payload) : resolvedLabel}
150
+ </div>
151
+ )
152
+
153
+ return (
154
+ <div
155
+ data-slot="chart-tooltip-content"
156
+ className={cn(
157
+ "grid min-w-36 gap-1.5 rounded-lg bg-popover px-2.5 py-1.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10",
158
+ className
159
+ )}
160
+ >
161
+ {tooltipLabel}
162
+ <div className="grid gap-1.5">
163
+ {payload.map((item, index) => {
164
+ const key = nameKey ?? String(item.dataKey ?? item.name ?? "value")
165
+ const itemCfg = getPayloadConfig(config, item, key)
166
+ const swatch = color ?? item.color ?? item.fill
167
+
168
+ return (
169
+ <div
170
+ key={item.dataKey ? String(item.dataKey) : index}
171
+ className="flex w-full items-center gap-2 [&>svg]:size-2.5 [&>svg]:text-muted-foreground"
172
+ >
173
+ {!hideIndicator &&
174
+ (itemCfg?.icon ? (
175
+ <itemCfg.icon />
176
+ ) : (
177
+ <span
178
+ className={cn("shrink-0 rounded-[2px]", {
179
+ "size-2.5": indicator === "dot",
180
+ "h-0.5 w-3.5 rounded-full": indicator === "line",
181
+ "h-0 w-3.5 border-t-[1.5px] border-dashed": indicator === "dashed",
182
+ })}
183
+ style={{ backgroundColor: indicator === "dashed" ? undefined : swatch, borderColor: swatch }}
184
+ />
185
+ ))}
186
+ <div className="flex flex-1 items-center justify-between gap-4 leading-none">
187
+ <span className="text-muted-foreground">{itemCfg?.label ?? item.name}</span>
188
+ {item.value !== undefined && (
189
+ <span className="font-mono font-medium tabular-nums text-foreground">
190
+ {formatter
191
+ ? formatter(item.value, item.name, item, index, payload)
192
+ : typeof item.value === "number"
193
+ ? item.value.toLocaleString()
194
+ : item.value}
195
+ </span>
196
+ )}
197
+ </div>
198
+ </div>
199
+ )
200
+ })}
201
+ </div>
202
+ </div>
203
+ )
204
+ }
205
+
206
+ const ChartLegend = RechartsPrimitive.Legend
207
+
208
+ function ChartLegendContent({
209
+ className,
210
+ hideIcon = false,
211
+ payload,
212
+ verticalAlign = "bottom",
213
+ nameKey,
214
+ }: React.ComponentProps<"div"> & {
215
+ payload?: readonly RechartsPrimitive.LegendPayload[]
216
+ verticalAlign?: "top" | "bottom" | "middle"
217
+ hideIcon?: boolean
218
+ nameKey?: string
219
+ }) {
220
+ const { config } = useChart()
221
+
222
+ if (!payload?.length) return null
223
+
224
+ return (
225
+ <div
226
+ data-slot="chart-legend-content"
227
+ className={cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className)}
228
+ >
229
+ {payload.map((item, index) => {
230
+ const key = nameKey ?? String(item.dataKey ?? item.value ?? index)
231
+ const itemCfg = getPayloadConfig(config, item, key)
232
+
233
+ return (
234
+ <div key={item.value ?? index} className="flex items-center gap-1.5 [&>svg]:size-3 [&>svg]:text-muted-foreground">
235
+ {itemCfg?.icon && !hideIcon ? (
236
+ <itemCfg.icon />
237
+ ) : (
238
+ <span className="size-2 shrink-0 rounded-[2px]" style={{ backgroundColor: item.color }} />
239
+ )}
240
+ <span className="text-muted-foreground">{itemCfg?.label ?? item.value}</span>
241
+ </div>
242
+ )
243
+ })}
244
+ </div>
245
+ )
246
+ }
247
+
248
+ export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, useChart }
249
+ export type { ChartConfig }
@@ -0,0 +1,38 @@
1
+ "use client"
2
+
3
+ /**
4
+ * Checkbox — Zabuti UI primitive.
5
+ *
6
+ * Radix Checkbox + Tailwind over the `zabuti-ui.css` token layer, lucide
7
+ * `CheckIcon` indicator. Zabuti-owned, no shadcn dependency; Radix is the
8
+ * behavioural base only.
9
+ */
10
+ import * as React from "react"
11
+ import { cn } from "cn"
12
+ import { Checkbox as CheckboxPrimitive } from "radix-ui"
13
+ import { CheckIcon } from "lucide-react"
14
+
15
+ function Checkbox({
16
+ className,
17
+ ...props
18
+ }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
19
+ return (
20
+ <CheckboxPrimitive.Root
21
+ data-slot="checkbox"
22
+ className={cn(
23
+ "peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",
24
+ className
25
+ )}
26
+ {...props}
27
+ >
28
+ <CheckboxPrimitive.Indicator
29
+ data-slot="checkbox-indicator"
30
+ className="grid place-content-center text-current transition-none [&>svg]:size-3.5"
31
+ >
32
+ <CheckIcon />
33
+ </CheckboxPrimitive.Indicator>
34
+ </CheckboxPrimitive.Root>
35
+ )
36
+ }
37
+
38
+ export { Checkbox }
@@ -0,0 +1,30 @@
1
+ "use client"
2
+
3
+ /**
4
+ * Collapsible — Zabuti UI primitive.
5
+ *
6
+ * Radix Collapsible — a single open/closed region. Thin `data-slot` passthroughs;
7
+ * styling is left to the caller (the animation keyframes, if wanted, come from
8
+ * `tw-animate-css`). Zabuti-owned, no shadcn dependency; Radix is the
9
+ * behavioural base only.
10
+ */
11
+ import * as React from "react"
12
+ import { Collapsible as CollapsiblePrimitive } from "radix-ui"
13
+
14
+ function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
15
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
16
+ }
17
+
18
+ function CollapsibleTrigger({
19
+ ...props
20
+ }: React.ComponentProps<typeof CollapsiblePrimitive.Trigger>) {
21
+ return <CollapsiblePrimitive.Trigger data-slot="collapsible-trigger" {...props} />
22
+ }
23
+
24
+ function CollapsibleContent({
25
+ ...props
26
+ }: React.ComponentProps<typeof CollapsiblePrimitive.Content>) {
27
+ return <CollapsiblePrimitive.Content data-slot="collapsible-content" {...props} />
28
+ }
29
+
30
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent }
@@ -0,0 +1,127 @@
1
+ "use client"
2
+
3
+ /**
4
+ * Combobox — Zabuti UI primitive.
5
+ *
6
+ * A finished typeahead select: the `command` list (cmdk filtering + keyboard)
7
+ * dropped into a `popover`, behind a `button` trigger. Pass `options`, read
8
+ * `value` / `onValueChange` — the wiring shadcn leaves as a copy-paste pattern
9
+ * is done here. Zabuti-owned; `cmdk` + Radix are the behavioural base.
10
+ *
11
+ * Controlled (`value` + `onValueChange`) or uncontrolled (`defaultValue`).
12
+ * Selecting the current value again clears it.
13
+ */
14
+ import * as React from "react"
15
+ import { cn } from "cn"
16
+ import { CheckIcon, ChevronsUpDownIcon } from "lucide-react"
17
+
18
+ import { Button } from "@/components/ui/button"
19
+ import {
20
+ Command,
21
+ CommandEmpty,
22
+ CommandGroup,
23
+ CommandInput,
24
+ CommandItem,
25
+ CommandList,
26
+ } from "@/components/ui/command"
27
+ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
28
+
29
+ interface ComboboxOption {
30
+ value: string
31
+ label: string
32
+ disabled?: boolean
33
+ }
34
+
35
+ interface ComboboxProps {
36
+ options: ComboboxOption[]
37
+ value?: string
38
+ defaultValue?: string
39
+ onValueChange?: (value: string) => void
40
+ /** Trigger text when nothing is selected. */
41
+ placeholder?: string
42
+ /** Search field placeholder. */
43
+ searchPlaceholder?: string
44
+ /** Shown when the filter matches nothing. */
45
+ emptyText?: string
46
+ disabled?: boolean
47
+ /** Width / classes for the trigger button. */
48
+ className?: string
49
+ id?: string
50
+ }
51
+
52
+ function Combobox({
53
+ options,
54
+ value,
55
+ defaultValue = "",
56
+ onValueChange,
57
+ placeholder = "Select…",
58
+ searchPlaceholder = "Search…",
59
+ emptyText = "No results.",
60
+ disabled,
61
+ className,
62
+ id,
63
+ }: ComboboxProps) {
64
+ const [open, setOpen] = React.useState(false)
65
+ const [internal, setInternal] = React.useState(defaultValue)
66
+ // `value` (when provided) wins; `internal` is the uncontrolled fallback and is
67
+ // harmlessly shadowed while controlled.
68
+ const current = value !== undefined ? value : internal
69
+
70
+ function commit(next: string) {
71
+ setInternal(next)
72
+ onValueChange?.(next)
73
+ }
74
+
75
+ const selected = options.find((o) => o.value === current)
76
+
77
+ return (
78
+ <Popover open={open} onOpenChange={setOpen}>
79
+ <PopoverTrigger asChild>
80
+ <Button
81
+ id={id}
82
+ type="button"
83
+ variant="outline"
84
+ role="combobox"
85
+ aria-expanded={open}
86
+ disabled={disabled}
87
+ className={cn("justify-between font-normal", !selected && "text-muted-foreground", className)}
88
+ >
89
+ {selected ? selected.label : placeholder}
90
+ <ChevronsUpDownIcon className="ml-2 size-4 shrink-0 opacity-50" />
91
+ </Button>
92
+ </PopoverTrigger>
93
+ <PopoverContent className="w-(--radix-popover-trigger-width) p-0">
94
+ <Command>
95
+ <CommandInput placeholder={searchPlaceholder} />
96
+ <CommandList>
97
+ <CommandEmpty>{emptyText}</CommandEmpty>
98
+ <CommandGroup>
99
+ {options.map((option) => (
100
+ <CommandItem
101
+ key={option.value}
102
+ value={option.label}
103
+ disabled={option.disabled}
104
+ onSelect={() => {
105
+ commit(option.value === current ? "" : option.value)
106
+ setOpen(false)
107
+ }}
108
+ >
109
+ <CheckIcon
110
+ className={cn(
111
+ "size-4",
112
+ option.value === current ? "opacity-100" : "opacity-0"
113
+ )}
114
+ />
115
+ {option.label}
116
+ </CommandItem>
117
+ ))}
118
+ </CommandGroup>
119
+ </CommandList>
120
+ </Command>
121
+ </PopoverContent>
122
+ </Popover>
123
+ )
124
+ }
125
+
126
+ export { Combobox }
127
+ export type { ComboboxOption, ComboboxProps }