@hex-core/components 1.3.1 → 1.5.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/README.md +183 -9
- package/dist/_tsup-dts-rollup.d.ts +3105 -0
- package/dist/accordion.d.ts +4 -0
- package/dist/accordion.js +62 -0
- package/dist/accordion.js.map +1 -0
- package/dist/alert-dialog.d.ts +11 -0
- package/dist/alert-dialog.js +125 -0
- package/dist/alert-dialog.js.map +1 -0
- package/dist/alert.d.ts +4 -0
- package/dist/alert.js +54 -0
- package/dist/alert.js.map +1 -0
- package/dist/aspect-ratio.d.ts +1 -0
- package/dist/aspect-ratio.js +8 -0
- package/dist/aspect-ratio.js.map +1 -0
- package/dist/avatar.d.ts +3 -0
- package/dist/avatar.js +44 -0
- package/dist/avatar.js.map +1 -0
- package/dist/badge.d.ts +3 -0
- package/dist/badge.js +36 -0
- package/dist/badge.js.map +1 -0
- package/dist/breadcrumb.d.ts +7 -0
- package/dist/breadcrumb.js +120 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/button.d.ts +3 -0
- package/dist/button.js +113 -0
- package/dist/button.js.map +1 -0
- package/dist/calendar.d.ts +1 -0
- package/dist/calendar.js +126 -0
- package/dist/calendar.js.map +1 -0
- package/dist/card.d.ts +6 -0
- package/dist/card.js +68 -0
- package/dist/card.js.map +1 -0
- package/dist/checkbox.d.ts +2 -0
- package/dist/checkbox.js +65 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/citation.d.ts +2 -0
- package/dist/citation.js +70 -0
- package/dist/citation.js.map +1 -0
- package/dist/cluster.d.ts +3 -0
- package/dist/cluster.js +50 -0
- package/dist/cluster.js.map +1 -0
- package/dist/code-block-copy.d.ts +2 -0
- package/dist/code-block-copy.js +108 -0
- package/dist/code-block-copy.js.map +1 -0
- package/dist/code-block.d.ts +3 -0
- package/dist/code-block.js +90 -0
- package/dist/code-block.js.map +1 -0
- package/dist/collapsible.d.ts +3 -0
- package/dist/collapsible.js +10 -0
- package/dist/collapsible.js.map +1 -0
- package/dist/color-picker.d.ts +2 -0
- package/dist/color-picker.js +321 -0
- package/dist/color-picker.js.map +1 -0
- package/dist/combobox.d.ts +3 -0
- package/dist/combobox.js +226 -0
- package/dist/combobox.js.map +1 -0
- package/dist/command.d.ts +9 -0
- package/dist/command.js +232 -0
- package/dist/command.js.map +1 -0
- package/dist/composer.d.ts +2 -0
- package/dist/composer.js +75 -0
- package/dist/composer.js.map +1 -0
- package/dist/container.d.ts +3 -0
- package/dist/container.js +39 -0
- package/dist/container.js.map +1 -0
- package/dist/context-menu.d.ts +12 -0
- package/dist/context-menu.js +130 -0
- package/dist/context-menu.js.map +1 -0
- package/dist/data-table.d.ts +2 -0
- package/dist/data-table.js +103 -0
- package/dist/data-table.js.map +1 -0
- package/dist/date-picker.d.ts +2 -0
- package/dist/date-picker.js +221 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/dialog.d.ts +11 -0
- package/dist/dialog.js +125 -0
- package/dist/dialog.js.map +1 -0
- package/dist/drawer.d.ts +10 -0
- package/dist/drawer.js +82 -0
- package/dist/drawer.js.map +1 -0
- package/dist/dropdown-menu.d.ts +13 -0
- package/dist/dropdown-menu.js +133 -0
- package/dist/dropdown-menu.js.map +1 -0
- package/dist/dropzone.d.ts +3 -0
- package/dist/dropzone.js +194 -0
- package/dist/dropzone.js.map +1 -0
- package/dist/file-tree.d.ts +3 -0
- package/dist/file-tree.js +322 -0
- package/dist/file-tree.js.map +1 -0
- package/dist/form.d.ts +8 -0
- package/dist/form.js +114 -0
- package/dist/form.js.map +1 -0
- package/dist/grid.d.ts +3 -0
- package/dist/grid.js +58 -0
- package/dist/grid.js.map +1 -0
- package/dist/hover-card.d.ts +3 -0
- package/dist/hover-card.js +34 -0
- package/dist/hover-card.js.map +1 -0
- package/dist/index.d.ts +298 -1652
- package/dist/index.js +1157 -5493
- package/dist/index.js.map +1 -1
- package/dist/input-otp.d.ts +5 -0
- package/dist/input-otp.js +71 -0
- package/dist/input-otp.js.map +1 -0
- package/dist/input.d.ts +2 -0
- package/dist/input.js +40 -0
- package/dist/input.js.map +1 -0
- package/dist/label.d.ts +2 -0
- package/dist/label.js +22 -0
- package/dist/label.js.map +1 -0
- package/dist/loading-indicator.d.ts +3 -0
- package/dist/loading-indicator.js +64 -0
- package/dist/loading-indicator.js.map +1 -0
- package/dist/markdown.d.ts +2 -0
- package/dist/markdown.js +28 -0
- package/dist/markdown.js.map +1 -0
- package/dist/menubar.d.ts +11 -0
- package/dist/menubar.js +106 -0
- package/dist/menubar.js.map +1 -0
- package/dist/message-actions.d.ts +2 -0
- package/dist/message-actions.js +28 -0
- package/dist/message-actions.js.map +1 -0
- package/dist/message-list.d.ts +2 -0
- package/dist/message-list.js +49 -0
- package/dist/message-list.js.map +1 -0
- package/dist/message.d.ts +3 -0
- package/dist/message.js +35 -0
- package/dist/message.js.map +1 -0
- package/dist/multi-combobox.d.ts +3 -0
- package/dist/multi-combobox.js +258 -0
- package/dist/multi-combobox.js.map +1 -0
- package/dist/navigation-menu.d.ts +9 -0
- package/dist/navigation-menu.js +108 -0
- package/dist/navigation-menu.js.map +1 -0
- package/dist/pagination.d.ts +7 -0
- package/dist/pagination.js +195 -0
- package/dist/pagination.js.map +1 -0
- package/dist/popover.d.ts +4 -0
- package/dist/popover.js +35 -0
- package/dist/popover.js.map +1 -0
- package/dist/progress.d.ts +1 -0
- package/dist/progress.js +38 -0
- package/dist/progress.js.map +1 -0
- package/dist/radio-group.d.ts +2 -0
- package/dist/radio-group.js +44 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/reasoning.d.ts +2 -0
- package/dist/reasoning.js +90 -0
- package/dist/reasoning.js.map +1 -0
- package/dist/resizable.d.ts +3 -0
- package/dist/resizable.js +66 -0
- package/dist/resizable.js.map +1 -0
- package/dist/schemas.d.ts +72 -0
- package/dist/schemas.js +5491 -0
- package/dist/schemas.js.map +1 -0
- package/dist/scroll-area.d.ts +3 -0
- package/dist/scroll-area.js +55 -0
- package/dist/scroll-area.js.map +1 -0
- package/dist/select.d.ts +8 -0
- package/dist/select.js +136 -0
- package/dist/select.js.map +1 -0
- package/dist/separator.d.ts +2 -0
- package/dist/separator.js +29 -0
- package/dist/separator.js.map +1 -0
- package/dist/sheet.d.ts +10 -0
- package/dist/sheet.js +140 -0
- package/dist/sheet.js.map +1 -0
- package/dist/sidebar.d.ts +8 -0
- package/dist/sidebar.js +201 -0
- package/dist/sidebar.js.map +1 -0
- package/dist/skeleton.d.ts +1 -0
- package/dist/skeleton.js +21 -0
- package/dist/skeleton.js.map +1 -0
- package/dist/slider.d.ts +2 -0
- package/dist/slider.js +55 -0
- package/dist/slider.js.map +1 -0
- package/dist/sonner.d.ts +2 -0
- package/dist/sonner.js +27 -0
- package/dist/sonner.js.map +1 -0
- package/dist/spacer.d.ts +3 -0
- package/dist/spacer.js +43 -0
- package/dist/spacer.js.map +1 -0
- package/dist/stack.d.ts +3 -0
- package/dist/stack.js +49 -0
- package/dist/stack.js.map +1 -0
- package/dist/stepper.d.ts +4 -0
- package/dist/stepper.js +226 -0
- package/dist/stepper.js.map +1 -0
- package/dist/suggestion.d.ts +2 -0
- package/dist/suggestion.js +55 -0
- package/dist/suggestion.js.map +1 -0
- package/dist/switch.d.ts +2 -0
- package/dist/switch.js +47 -0
- package/dist/switch.js.map +1 -0
- package/dist/table.d.ts +8 -0
- package/dist/table.js +85 -0
- package/dist/table.js.map +1 -0
- package/dist/tabs.d.ts +4 -0
- package/dist/tabs.js +57 -0
- package/dist/tabs.js.map +1 -0
- package/dist/textarea.d.ts +2 -0
- package/dist/textarea.js +36 -0
- package/dist/textarea.js.map +1 -0
- package/dist/time-picker.d.ts +2 -0
- package/dist/time-picker.js +50 -0
- package/dist/time-picker.js.map +1 -0
- package/dist/timeline.d.ts +4 -0
- package/dist/timeline.js +84 -0
- package/dist/timeline.js.map +1 -0
- package/dist/toggle-group.d.ts +2 -0
- package/dist/toggle-group.js +83 -0
- package/dist/toggle-group.js.map +1 -0
- package/dist/toggle.d.ts +2 -0
- package/dist/toggle.js +49 -0
- package/dist/toggle.js.map +1 -0
- package/dist/tool-call.d.ts +2 -0
- package/dist/tool-call.js +133 -0
- package/dist/tool-call.js.map +1 -0
- package/dist/tooltip.d.ts +4 -0
- package/dist/tooltip.js +33 -0
- package/dist/tooltip.js.map +1 -0
- package/package.json +71 -16
package/README.md
CHANGED
|
@@ -29,14 +29,30 @@ pnpm add @hex-core/components
|
|
|
29
29
|
|
|
30
30
|
Without it, classes like `inset-ring-foreground/[0.06]` (used by Button outline, Input, Card, etc.) appear in the rendered HTML but have no CSS rule, and components render unstyled. Tailwind v4 doesn't auto-scan `node_modules`.
|
|
31
31
|
|
|
32
|
+
## Imports — barrel vs deep (RSC)
|
|
33
|
+
|
|
32
34
|
```tsx
|
|
33
|
-
import
|
|
35
|
+
// Deep import — RSC-safe for visual primitives, tree-shake friendly
|
|
36
|
+
import { Badge } from "@hex-core/components/badge";
|
|
37
|
+
import { Card, CardContent } from "@hex-core/components/card";
|
|
38
|
+
import { Stack } from "@hex-core/components/stack";
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
40
|
+
// Barrel import — convenience, but always client-side
|
|
41
|
+
import { Button, Card, Stack } from "@hex-core/components";
|
|
38
42
|
```
|
|
39
43
|
|
|
44
|
+
Each component file declares its own `"use client"` directive — and only when it needs one. Deep imports of visual primitives (`Badge`, `Card`, `Stack`, …) render directly inside Next.js Server Components without forcing the subtree client-side. Deep imports of stateful components (`Dialog`, `Form`, `Calendar`, …) carry the directive automatically.
|
|
45
|
+
|
|
46
|
+
The barrel re-exports everything together, so it's marked client. Existing barrel imports keep working — but if you want RSC + tree-shake, prefer deep imports.
|
|
47
|
+
|
|
48
|
+
### RSC-safe components (no `"use client"` needed)
|
|
49
|
+
|
|
50
|
+
`Alert`, `Badge`, `Card`, `Cluster`, `Grid`, `Input`, `Pagination`, `Skeleton`, `Spacer`, `Stack`, `Table`, `Textarea`, `Timeline`.
|
|
51
|
+
|
|
52
|
+
### Client-only components
|
|
53
|
+
|
|
54
|
+
Everything else — anything backed by Radix portals/triggers, hooks, `react-hook-form`, `cmdk`, `vaul`, `sonner`, `react-day-picker`, `input-otp`, or `react-resizable-panels`. Each of those modules ships with its own `"use client"` so importing it from a Server Component still works (Next.js sees the directive at the import boundary).
|
|
55
|
+
|
|
40
56
|
## What's inside
|
|
41
57
|
|
|
42
58
|
47 components across primitives (Button, Input, Checkbox, …) and compounds (Combobox, DataTable, Command, …). Every component ships with:
|
|
@@ -47,12 +63,170 @@ export default function Page() {
|
|
|
47
63
|
- HSL design tokens — override via CSS vars, no JS config needed
|
|
48
64
|
- A matching `.schema.ts` with AI hints (`whenToUse`, `whenNotToUse`, `commonMistakes`, `accessibilityNotes`, `tokenBudget`)
|
|
49
65
|
|
|
50
|
-
##
|
|
66
|
+
## Color utilities
|
|
67
|
+
|
|
68
|
+
Tailwind v4 generates utilities from `@theme {}` automatically. The bundled `tailwind.css` exposes the full semantic palette — use the short class names directly, no `text-[color:var(...)]` workaround required.
|
|
69
|
+
|
|
70
|
+
| Class | Token |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| `bg-background` / `text-background` | `--color-background` |
|
|
73
|
+
| `bg-foreground` / `text-foreground` | `--color-foreground` |
|
|
74
|
+
| `bg-card` / `text-card-foreground` | `--color-card` / `--color-card-foreground` |
|
|
75
|
+
| `bg-popover` / `text-popover-foreground` | `--color-popover` |
|
|
76
|
+
| `bg-primary` / `text-primary` / `text-primary-foreground` | `--color-primary` |
|
|
77
|
+
| `bg-secondary` / `text-secondary-foreground` | `--color-secondary` |
|
|
78
|
+
| `bg-muted` / `text-muted-foreground` | `--color-muted` |
|
|
79
|
+
| `bg-accent` / `text-accent-foreground` | `--color-accent` |
|
|
80
|
+
| `bg-destructive` / `text-destructive-foreground` | `--color-destructive` |
|
|
81
|
+
| `border-input` / `border-border` / `border-ring` | `--color-input` / `--color-border` / `--color-ring` |
|
|
82
|
+
|
|
83
|
+
Both forms produce identical output:
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
// Preferred — short and stable
|
|
87
|
+
<p className="text-muted-foreground">Helper</p>
|
|
88
|
+
|
|
89
|
+
// Equivalent — only use this if a class name is dynamically composed
|
|
90
|
+
<p className="text-[color:var(--color-muted-foreground)]">Helper</p>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Setup: Toaster
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
// app/layout.tsx (Server Component is fine — Toaster declares its own "use client")
|
|
97
|
+
import { Toaster } from "@hex-core/components/sonner";
|
|
98
|
+
|
|
99
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
100
|
+
return (
|
|
101
|
+
<html lang="en">
|
|
102
|
+
<body>
|
|
103
|
+
{children}
|
|
104
|
+
<Toaster />
|
|
105
|
+
</body>
|
|
106
|
+
</html>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
// any client component
|
|
113
|
+
"use client";
|
|
114
|
+
import { toast } from "sonner";
|
|
115
|
+
|
|
116
|
+
export function SaveButton() {
|
|
117
|
+
return <button onClick={() => toast.success("Saved!")}>Save</button>;
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`sonner` is an optional peer — install it if you use the toaster: `pnpm add sonner`.
|
|
122
|
+
|
|
123
|
+
## Setup: Form (`react-hook-form` integration)
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
"use client";
|
|
127
|
+
import { useForm } from "react-hook-form";
|
|
128
|
+
import {
|
|
129
|
+
Form,
|
|
130
|
+
FormField,
|
|
131
|
+
FormItem,
|
|
132
|
+
FormLabel,
|
|
133
|
+
FormControl,
|
|
134
|
+
FormMessage,
|
|
135
|
+
} from "@hex-core/components/form";
|
|
136
|
+
import { Input } from "@hex-core/components/input";
|
|
137
|
+
import { Button } from "@hex-core/components/button";
|
|
138
|
+
|
|
139
|
+
export function ContactForm() {
|
|
140
|
+
const form = useForm<{ email: string }>({ defaultValues: { email: "" } });
|
|
141
|
+
return (
|
|
142
|
+
<Form {...form}>
|
|
143
|
+
<form onSubmit={form.handleSubmit((v) => console.log(v))} className="space-y-4">
|
|
144
|
+
<FormField
|
|
145
|
+
control={form.control}
|
|
146
|
+
name="email"
|
|
147
|
+
render={({ field }) => (
|
|
148
|
+
<FormItem>
|
|
149
|
+
<FormLabel>Email</FormLabel>
|
|
150
|
+
<FormControl>
|
|
151
|
+
<Input type="email" {...field} />
|
|
152
|
+
</FormControl>
|
|
153
|
+
<FormMessage />
|
|
154
|
+
</FormItem>
|
|
155
|
+
)}
|
|
156
|
+
/>
|
|
157
|
+
<Button type="submit">Submit</Button>
|
|
158
|
+
</form>
|
|
159
|
+
</Form>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`react-hook-form` is an optional peer — install it if you use `<Form>`: `pnpm add react-hook-form`.
|
|
165
|
+
|
|
166
|
+
## Layout primitives
|
|
167
|
+
|
|
168
|
+
Don't reach for `<div className="flex …">` — the layout primitives are typed and document their own intent.
|
|
169
|
+
|
|
170
|
+
| Instead of | Use |
|
|
171
|
+
| --- | --- |
|
|
172
|
+
| `<div className="flex flex-col gap-4">` | `<Stack gap="4">` |
|
|
173
|
+
| `<div className="flex items-center gap-2">` | `<Cluster gap="2">` |
|
|
174
|
+
| `<div className="grid grid-cols-3 gap-4">` | `<Grid cols={3} gap="4">` |
|
|
175
|
+
| `<div className="max-w-7xl mx-auto px-6">` | `<Container size="xl">` |
|
|
176
|
+
| `<div className="h-8" />` | `<Spacer size="8">` |
|
|
177
|
+
| `<div className="aspect-video">` | `<AspectRatio ratio={16 / 9}>` |
|
|
178
|
+
|
|
179
|
+
All layout primitives are RSC-safe — pure visual, zero hooks.
|
|
180
|
+
|
|
181
|
+
## Card composition
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@hex-core/components/card";
|
|
185
|
+
|
|
186
|
+
<Card>
|
|
187
|
+
<CardHeader>
|
|
188
|
+
<CardTitle>Quarterly review</CardTitle>
|
|
189
|
+
<CardDescription>Q3 2025 — North America</CardDescription>
|
|
190
|
+
</CardHeader>
|
|
191
|
+
<CardContent>{/* body */}</CardContent>
|
|
192
|
+
<CardFooter>{/* actions */}</CardFooter>
|
|
193
|
+
</Card>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
`Card` and family are RSC-safe.
|
|
197
|
+
|
|
198
|
+
## Schemas (tooling)
|
|
199
|
+
|
|
200
|
+
If you're building tooling that consumes the component manifest (an MCP server, a docs prop-table renderer, an AI assistant), import schemas from the dedicated subpath:
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
import { buttonSchema, cardSchema } from "@hex-core/components/schemas";
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The schemas reference `ComponentSchemaDefinition` from `@hex-core/registry`, so install that as a dev dep alongside:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
pnpm add -D @hex-core/registry
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
This entry is intentionally separate from the runtime barrel — `import { Button } from "@hex-core/components"` does NOT pull in registry types.
|
|
213
|
+
|
|
214
|
+
## Peer dependency matrix
|
|
215
|
+
|
|
216
|
+
`@hex-core/components` keeps its install footprint small by listing optional dependencies as peers. Install only the ones backing the components you actually use.
|
|
217
|
+
|
|
218
|
+
| Component | Optional peer to install |
|
|
219
|
+
| --- | --- |
|
|
220
|
+
| `<Calendar>`, `<DatePicker>` | `react-day-picker`, `date-fns` |
|
|
221
|
+
| `<Toaster>`, `toast()` | `sonner` |
|
|
222
|
+
| `<Combobox>`, `<MultiCombobox>`, `<Command>` | `cmdk` |
|
|
223
|
+
| `<Drawer>` | `vaul` |
|
|
224
|
+
| `<InputOTP>` | `input-otp` |
|
|
225
|
+
| `<ResizableHandle>`, `<ResizablePanel>`, `<ResizablePanelGroup>` | `react-resizable-panels` |
|
|
226
|
+
| `<Form>`, `<FormField>`, `<FormItem>` | `react-hook-form` |
|
|
227
|
+
| `<DataTable>` | `@tanstack/react-table` |
|
|
51
228
|
|
|
52
|
-
|
|
53
|
-
- `react-dom` 18 or 19
|
|
54
|
-
- `react-hook-form` (only needed by `<Form>` — tree-shaken if unused)
|
|
55
|
-
- `@tanstack/react-table` (only needed by `<DataTable>`)
|
|
229
|
+
Hard peers: `react` 18+/19, `react-dom` 18+/19.
|
|
56
230
|
|
|
57
231
|
## Docs
|
|
58
232
|
|