@usevyre/ai-context 1.0.0 → 1.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.
- package/dist/anti-patterns.json +106 -1
- package/dist/cheat-sheets/buttongroup.md +42 -0
- package/dist/cheat-sheets/combobox.md +37 -0
- package/dist/cheat-sheets/datagrid.md +44 -0
- package/dist/cheat-sheets/index.md +6 -0
- package/dist/cheat-sheets/tag.md +46 -0
- package/dist/cheat-sheets/taggroup.md +33 -0
- package/dist/cheat-sheets/tagsinput.md +35 -0
- package/dist/claude-context.md +198 -1
- package/dist/copilot-instructions.md +198 -1
- package/dist/cursor-rules.md +72 -1
- package/dist/full-context.md +197 -0
- package/dist/index.js +1504 -114
- package/dist/schema.json +373 -5
- package/dist/tokens.json +1 -1
- package/dist/tokens.md +1 -1
- package/dist/version-info.json +117 -65
- package/dist/windsurf-rules.md +198 -1
- package/package.json +1 -1
package/dist/anti-patterns.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "1.1.0",
|
|
3
3
|
"rules": [
|
|
4
4
|
{
|
|
5
5
|
"component": "Accordion",
|
|
@@ -217,6 +217,111 @@
|
|
|
217
217
|
"reason": "Typography components apply the correct token-based styles",
|
|
218
218
|
"fix": "Use <Heading>, <Text>, <Lead> from @usevyre/react",
|
|
219
219
|
"severity": "error"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"component": "ButtonGroup",
|
|
223
|
+
"pattern": "ButtonGroup variant=\"...\"",
|
|
224
|
+
"reason": "ButtonGroup has no variant prop — variant goes on each child Button",
|
|
225
|
+
"fix": "Set variant on each <Button> inside the group",
|
|
226
|
+
"severity": "error"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"component": "ButtonGroup",
|
|
230
|
+
"pattern": "ButtonGroup without Button children",
|
|
231
|
+
"reason": "ButtonGroup is a layout wrapper for Button elements",
|
|
232
|
+
"fix": "Place <Button> elements as direct children",
|
|
233
|
+
"severity": "error"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"component": "TagsInput",
|
|
237
|
+
"pattern": "TagsInput value={string}",
|
|
238
|
+
"reason": "value must be a string array, not a string",
|
|
239
|
+
"fix": "Pass an array: value={['react','vue']}",
|
|
240
|
+
"severity": "error"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"component": "TagsInput",
|
|
244
|
+
"pattern": "TagsInput without onChange",
|
|
245
|
+
"reason": "TagsInput is controlled — it needs onChange to update",
|
|
246
|
+
"fix": "Provide value and onChange (React) or v-model (Vue)",
|
|
247
|
+
"severity": "error"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"component": "Combobox",
|
|
251
|
+
"pattern": "Combobox value=\"\"",
|
|
252
|
+
"reason": "Empty selection must be null, not empty string",
|
|
253
|
+
"fix": "Use value={null} for no selection",
|
|
254
|
+
"severity": "error"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"component": "Combobox",
|
|
258
|
+
"pattern": "Combobox options={string[]}",
|
|
259
|
+
"reason": "options must be objects with value and label",
|
|
260
|
+
"fix": "Use [{ value: 'ts', label: 'TypeScript' }]",
|
|
261
|
+
"severity": "error"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"component": "Combobox",
|
|
265
|
+
"pattern": "Using Combobox for command palette",
|
|
266
|
+
"reason": "Combobox is single-value select, not an action palette",
|
|
267
|
+
"fix": "Use Command for command palettes",
|
|
268
|
+
"severity": "error"
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"component": "DataGrid",
|
|
272
|
+
"pattern": "DataGrid expecting built-in pagination",
|
|
273
|
+
"reason": "DataGrid does not paginate — it only sorts",
|
|
274
|
+
"fix": "Slice rows yourself and use the Pagination component",
|
|
275
|
+
"severity": "error"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"component": "DataGrid",
|
|
279
|
+
"pattern": "DataGrid expecting built-in filtering",
|
|
280
|
+
"reason": "DataGrid does not filter rows",
|
|
281
|
+
"fix": "Filter the rows array before passing it in",
|
|
282
|
+
"severity": "error"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"component": "DataGrid",
|
|
286
|
+
"pattern": "sortable without onSort",
|
|
287
|
+
"reason": "Sorting is controlled — the grid does not sort data itself",
|
|
288
|
+
"fix": "Handle onSort and sort the rows array in your state",
|
|
289
|
+
"severity": "error"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"component": "Tag",
|
|
293
|
+
"pattern": "Tag variant=\"success\"",
|
|
294
|
+
"reason": "Tag only has default, accent, danger variants (unlike Badge which has more)",
|
|
295
|
+
"fix": "Use Badge for success/warning/teal status colors; Tag is for categories/filters",
|
|
296
|
+
"severity": "error"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"component": "Tag",
|
|
300
|
+
"pattern": "Using Tag for tag input",
|
|
301
|
+
"reason": "Tag is display-only, it does not accept typed input",
|
|
302
|
+
"fix": "Use TagsInput for adding/removing tags via keyboard",
|
|
303
|
+
"severity": "error"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"component": "Tag",
|
|
307
|
+
"pattern": "Tag size=\"xl\"",
|
|
308
|
+
"reason": "Maximum size is 'lg'",
|
|
309
|
+
"fix": "Use size=\"lg\"",
|
|
310
|
+
"severity": "error"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"component": "TagGroup",
|
|
314
|
+
"pattern": "TagGroup without Tag children",
|
|
315
|
+
"reason": "TagGroup is a layout wrapper for Tag elements",
|
|
316
|
+
"fix": "Place <Tag> elements as direct children",
|
|
317
|
+
"severity": "error"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"component": "TagGroup",
|
|
321
|
+
"pattern": "Using TagGroup for tag input",
|
|
322
|
+
"reason": "TagGroup is display-only",
|
|
323
|
+
"fix": "Use TagsInput for an editable tag field",
|
|
324
|
+
"severity": "error"
|
|
220
325
|
}
|
|
221
326
|
]
|
|
222
327
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# ButtonGroup — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**Groups multiple Button components into one visual unit (toolbar, segmented control). Pure layout — no internal state.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { ButtonGroup, Button } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `orientation` | `"horizontal"` \| `"vertical"` | `horizontal` |
|
|
15
|
+
| `size` | `"sm"` \| `"md"` \| `"lg"` \| `"icon"` | — |
|
|
16
|
+
| `attached` | `true` \| `false` | `false` |
|
|
17
|
+
|
|
18
|
+
## Common AI Mistakes
|
|
19
|
+
|
|
20
|
+
- ❌ `ButtonGroup variant="..."`
|
|
21
|
+
→ Set variant on each <Button> inside the group
|
|
22
|
+
- ❌ `ButtonGroup without Button children`
|
|
23
|
+
→ Place <Button> elements as direct children
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
**Segmented control**
|
|
28
|
+
```tsx
|
|
29
|
+
<ButtonGroup attached>
|
|
30
|
+
<Button variant="secondary">Day</Button>
|
|
31
|
+
<Button variant="secondary">Week</Button>
|
|
32
|
+
<Button variant="secondary">Month</Button>
|
|
33
|
+
</ButtonGroup>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Vertical group**
|
|
37
|
+
```tsx
|
|
38
|
+
<ButtonGroup orientation="vertical" attached>
|
|
39
|
+
<Button variant="secondary">Top</Button>
|
|
40
|
+
<Button variant="secondary">Bottom</Button>
|
|
41
|
+
</ButtonGroup>
|
|
42
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Combobox — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**Searchable single-select dropdown with typeahead filtering and keyboard navigation. Use when the list is long enough to need search. Differs from Select (no search) and Command (palette).**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Combobox } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `size` | `"sm"` \| `"md"` \| `"lg"` | `md` |
|
|
15
|
+
| `disabled` | `true` \| `false` | `false` |
|
|
16
|
+
|
|
17
|
+
## Common AI Mistakes
|
|
18
|
+
|
|
19
|
+
- ❌ `Combobox value=""`
|
|
20
|
+
→ Use value={null} for no selection
|
|
21
|
+
- ❌ `Combobox options={string[]}`
|
|
22
|
+
→ Use [{ value: 'ts', label: 'TypeScript' }]
|
|
23
|
+
- ❌ `Using Combobox for command palette`
|
|
24
|
+
→ Use Command for command palettes
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
**Searchable language picker**
|
|
29
|
+
```tsx
|
|
30
|
+
const [lang, setLang] = useState<string | null>(null);
|
|
31
|
+
<Combobox
|
|
32
|
+
options={[{ value: "ts", label: "TypeScript" }, { value: "go", label: "Go" }]}
|
|
33
|
+
value={lang}
|
|
34
|
+
onChange={setLang}
|
|
35
|
+
placeholder="Search language…"
|
|
36
|
+
/>
|
|
37
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# DataGrid — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**Table with built-in column sorting, loading skeletons, and empty state. Filtering and pagination are out of scope — compose with the Pagination component.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { DataGrid } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `sortDir` | `"asc"` \| `"desc"` | — |
|
|
15
|
+
| `loading` | `true` \| `false` | `false` |
|
|
16
|
+
| `stickyHeader` | `true` \| `false` | `false` |
|
|
17
|
+
|
|
18
|
+
## Common AI Mistakes
|
|
19
|
+
|
|
20
|
+
- ❌ `DataGrid expecting built-in pagination`
|
|
21
|
+
→ Slice rows yourself and use the Pagination component
|
|
22
|
+
- ❌ `DataGrid expecting built-in filtering`
|
|
23
|
+
→ Filter the rows array before passing it in
|
|
24
|
+
- ❌ `sortable without onSort`
|
|
25
|
+
→ Handle onSort and sort the rows array in your state
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
**Sortable grid**
|
|
30
|
+
```tsx
|
|
31
|
+
const cols = [{ key: "name", label: "Name", sortable: true }];
|
|
32
|
+
<DataGrid
|
|
33
|
+
columns={cols}
|
|
34
|
+
rows={people}
|
|
35
|
+
sortKey={sortKey}
|
|
36
|
+
sortDir={sortDir}
|
|
37
|
+
onSort={(k, d) => { setSortKey(k); setSortDir(d); }}
|
|
38
|
+
/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Loading state**
|
|
42
|
+
```tsx
|
|
43
|
+
<DataGrid columns={cols} rows={[]} loading />
|
|
44
|
+
```
|
|
@@ -32,3 +32,9 @@ Quick reference for AI agents — one file per component.
|
|
|
32
32
|
- [Toast](toast.md) — Transient notification. Use the useToast hook to trigger toasts imperatively. React: wrap app in <ToastProvider>. Vue: place <ToastViewport /> once in app root.
|
|
33
33
|
- [Tooltip](tooltip.md) — Short label that appears on hover/focus. For rich content use Popover instead.
|
|
34
34
|
- [Typography](typography.md) — Text rendering components with semantic scale. Includes Text, Heading, Lead, Code, Blockquote.
|
|
35
|
+
- [ButtonGroup](buttongroup.md) — Groups multiple Button components into one visual unit (toolbar, segmented control). Pure layout — no internal state.
|
|
36
|
+
- [TagsInput](tagsinput.md) — Multi-tag input. Type and press Enter or comma to add a tag, click x to remove, Backspace on empty input removes the last tag. Controlled.
|
|
37
|
+
- [Combobox](combobox.md) — Searchable single-select dropdown with typeahead filtering and keyboard navigation. Use when the list is long enough to need search. Differs from Select (no search) and Command (palette).
|
|
38
|
+
- [DataGrid](datagrid.md) — Table with built-in column sorting, loading skeletons, and empty state. Filtering and pagination are out of scope — compose with the Pagination component.
|
|
39
|
+
- [Tag](tag.md) — Standalone display tag/chip for categories, labels, or filter chips. NOT an input — for tag input use TagsInput. Group multiple with TagGroup.
|
|
40
|
+
- [TagGroup](taggroup.md) — Read-only container that lays out multiple Tag elements with automatic wrapping and consistent spacing. For tag input use TagsInput.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Tag — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**Standalone display tag/chip for categories, labels, or filter chips. NOT an input — for tag input use TagsInput. Group multiple with TagGroup.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Tag } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `variant` | `"default"` \| `"accent"` \| `"danger"` | `default` |
|
|
15
|
+
| `size` | `"sm"` \| `"md"` \| `"lg"` | `md` |
|
|
16
|
+
| `disabled` | `true` \| `false` | `false` |
|
|
17
|
+
|
|
18
|
+
## Common AI Mistakes
|
|
19
|
+
|
|
20
|
+
- ❌ `Tag variant="success"`
|
|
21
|
+
→ Use Badge for success/warning/teal status colors; Tag is for categories/filters
|
|
22
|
+
- ❌ `Using Tag for tag input`
|
|
23
|
+
→ Use TagsInput for adding/removing tags via keyboard
|
|
24
|
+
- ❌ `Tag size="xl"`
|
|
25
|
+
→ Use size="lg"
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
**Category tags in a group**
|
|
30
|
+
```tsx
|
|
31
|
+
<TagGroup>
|
|
32
|
+
<Tag>Design</Tag>
|
|
33
|
+
<Tag variant="accent">Featured</Tag>
|
|
34
|
+
<Tag>Engineering</Tag>
|
|
35
|
+
</TagGroup>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Removable filter chip (React)**
|
|
39
|
+
```tsx
|
|
40
|
+
<Tag onRemove={() => removeFilter("react")}>react</Tag>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Clickable toggle tag (React)**
|
|
44
|
+
```tsx
|
|
45
|
+
<Tag onClick={() => toggleFilter("vue")}>vue</Tag>
|
|
46
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# TagGroup — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**Read-only container that lays out multiple Tag elements with automatic wrapping and consistent spacing. For tag input use TagsInput.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { TagGroup, Tag } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `gap` | `"sm"` \| `"md"` \| `"lg"` | `md` |
|
|
15
|
+
| `wrap` | `true` \| `false` | `true` |
|
|
16
|
+
|
|
17
|
+
## Common AI Mistakes
|
|
18
|
+
|
|
19
|
+
- ❌ `TagGroup without Tag children`
|
|
20
|
+
→ Place <Tag> elements as direct children
|
|
21
|
+
- ❌ `Using TagGroup for tag input`
|
|
22
|
+
→ Use TagsInput for an editable tag field
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
**Tag group with mixed variants**
|
|
27
|
+
```tsx
|
|
28
|
+
<TagGroup gap="sm">
|
|
29
|
+
<Tag>React</Tag>
|
|
30
|
+
<Tag>Vue</Tag>
|
|
31
|
+
<Tag variant="accent">TypeScript</Tag>
|
|
32
|
+
</TagGroup>
|
|
33
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# TagsInput — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**Multi-tag input. Type and press Enter or comma to add a tag, click x to remove, Backspace on empty input removes the last tag. Controlled.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { TagsInput } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `size` | `"sm"` \| `"md"` \| `"lg"` | `md` |
|
|
15
|
+
| `disabled` | `true` \| `false` | `false` |
|
|
16
|
+
|
|
17
|
+
## Common AI Mistakes
|
|
18
|
+
|
|
19
|
+
- ❌ `TagsInput value={string}`
|
|
20
|
+
→ Pass an array: value={['react','vue']}
|
|
21
|
+
- ❌ `TagsInput without onChange`
|
|
22
|
+
→ Provide value and onChange (React) or v-model (Vue)
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
**Basic tags input**
|
|
27
|
+
```tsx
|
|
28
|
+
const [tags, setTags] = useState<string[]>([]);
|
|
29
|
+
<TagsInput value={tags} onChange={setTags} placeholder="Add a tag…" />
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Limited to 5 tags**
|
|
33
|
+
```tsx
|
|
34
|
+
<TagsInput value={tags} onChange={setTags} max={5} />
|
|
35
|
+
```
|
package/dist/claude-context.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# useVyre Design System Context
|
|
2
|
-
# Version:
|
|
2
|
+
# Version: 1.1.0
|
|
3
3
|
|
|
4
4
|
You are working in a codebase that uses the useVyre design system.
|
|
5
5
|
Follow the rules below strictly when writing any UI code.
|
|
@@ -887,6 +887,188 @@ import { Text, Heading, Lead, Code, Blockquote } from "@usevyre/react"
|
|
|
887
887
|
|
|
888
888
|
---
|
|
889
889
|
|
|
890
|
+
### ButtonGroup
|
|
891
|
+
|
|
892
|
+
Groups multiple Button components into one visual unit (toolbar, segmented control). Pure layout — no internal state.
|
|
893
|
+
|
|
894
|
+
```tsx
|
|
895
|
+
import { ButtonGroup, Button } from "@usevyre/react"
|
|
896
|
+
|
|
897
|
+
// Props:
|
|
898
|
+
// orientation = "horizontal" | "vertical" (default: horizontal)
|
|
899
|
+
// attached = boolean (default: false)
|
|
900
|
+
// size = "sm" | "md" | "lg" | "icon"
|
|
901
|
+
|
|
902
|
+
// Examples:
|
|
903
|
+
<ButtonGroup attached>
|
|
904
|
+
<Button variant="secondary">Day</Button>
|
|
905
|
+
<Button variant="secondary">Week</Button>
|
|
906
|
+
<Button variant="secondary">Month</Button>
|
|
907
|
+
</ButtonGroup>
|
|
908
|
+
<ButtonGroup orientation="vertical" attached>
|
|
909
|
+
<Button variant="secondary">Top</Button>
|
|
910
|
+
<Button variant="secondary">Bottom</Button>
|
|
911
|
+
</ButtonGroup>
|
|
912
|
+
```
|
|
913
|
+
|
|
914
|
+
**Common mistakes:**
|
|
915
|
+
- ❌ `ButtonGroup variant="..."` → Set variant on each <Button> inside the group
|
|
916
|
+
- ❌ `ButtonGroup without Button children` → Place <Button> elements as direct children
|
|
917
|
+
|
|
918
|
+
---
|
|
919
|
+
|
|
920
|
+
### TagsInput
|
|
921
|
+
|
|
922
|
+
Multi-tag input. Type and press Enter or comma to add a tag, click x to remove, Backspace on empty input removes the last tag. Controlled.
|
|
923
|
+
|
|
924
|
+
```tsx
|
|
925
|
+
import { TagsInput } from "@usevyre/react"
|
|
926
|
+
|
|
927
|
+
// Props:
|
|
928
|
+
// value = string[]
|
|
929
|
+
// onChange = (tags: string[]) => void
|
|
930
|
+
// placeholder = string
|
|
931
|
+
// disabled = boolean (default: false)
|
|
932
|
+
// max = number
|
|
933
|
+
// size = "sm" | "md" | "lg" (default: md)
|
|
934
|
+
|
|
935
|
+
// Examples:
|
|
936
|
+
const [tags, setTags] = useState<string[]>([]);
|
|
937
|
+
<TagsInput value={tags} onChange={setTags} placeholder="Add a tag…" />
|
|
938
|
+
<TagsInput value={tags} onChange={setTags} max={5} />
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
**Common mistakes:**
|
|
942
|
+
- ❌ `TagsInput value={string}` → Pass an array: value={['react','vue']}
|
|
943
|
+
- ❌ `TagsInput without onChange` → Provide value and onChange (React) or v-model (Vue)
|
|
944
|
+
|
|
945
|
+
---
|
|
946
|
+
|
|
947
|
+
### Combobox
|
|
948
|
+
|
|
949
|
+
Searchable single-select dropdown with typeahead filtering and keyboard navigation. Use when the list is long enough to need search. Differs from Select (no search) and Command (palette).
|
|
950
|
+
|
|
951
|
+
```tsx
|
|
952
|
+
import { Combobox } from "@usevyre/react"
|
|
953
|
+
|
|
954
|
+
// Props:
|
|
955
|
+
// options = { value: string; label: string; disabled?: boolean }[]
|
|
956
|
+
// value = string | null
|
|
957
|
+
// onChange = (value: string | null) => void
|
|
958
|
+
// placeholder = string (default: "Search…")
|
|
959
|
+
// disabled = boolean (default: false)
|
|
960
|
+
// size = "sm" | "md" | "lg" (default: md)
|
|
961
|
+
// emptyText = string (default: "No results")
|
|
962
|
+
|
|
963
|
+
// Examples:
|
|
964
|
+
const [lang, setLang] = useState<string | null>(null);
|
|
965
|
+
<Combobox
|
|
966
|
+
options={[{ value: "ts", label: "TypeScript" }, { value: "go", label: "Go" }]}
|
|
967
|
+
value={lang}
|
|
968
|
+
onChange={setLang}
|
|
969
|
+
placeholder="Search language…"
|
|
970
|
+
/>
|
|
971
|
+
```
|
|
972
|
+
|
|
973
|
+
**Common mistakes:**
|
|
974
|
+
- ❌ `Combobox value=""` → Use value={null} for no selection
|
|
975
|
+
- ❌ `Combobox options={string[]}` → Use [{ value: 'ts', label: 'TypeScript' }]
|
|
976
|
+
- ❌ `Using Combobox for command palette` → Use Command for command palettes
|
|
977
|
+
|
|
978
|
+
---
|
|
979
|
+
|
|
980
|
+
### DataGrid
|
|
981
|
+
|
|
982
|
+
Table with built-in column sorting, loading skeletons, and empty state. Filtering and pagination are out of scope — compose with the Pagination component.
|
|
983
|
+
|
|
984
|
+
```tsx
|
|
985
|
+
import { DataGrid } from "@usevyre/react"
|
|
986
|
+
|
|
987
|
+
// Props:
|
|
988
|
+
// columns = { key: string; label: string; sortable?: boolean; width?: string }[]
|
|
989
|
+
// rows = Record<string, unknown>[]
|
|
990
|
+
// sortKey = string
|
|
991
|
+
// sortDir = "asc" | "desc"
|
|
992
|
+
// onSort = (key: string, dir: 'asc' | 'desc') => void
|
|
993
|
+
// loading = boolean (default: false)
|
|
994
|
+
// emptyText = string (default: "No data")
|
|
995
|
+
// stickyHeader = boolean (default: false)
|
|
996
|
+
|
|
997
|
+
// Examples:
|
|
998
|
+
const cols = [{ key: "name", label: "Name", sortable: true }];
|
|
999
|
+
<DataGrid
|
|
1000
|
+
columns={cols}
|
|
1001
|
+
rows={people}
|
|
1002
|
+
sortKey={sortKey}
|
|
1003
|
+
sortDir={sortDir}
|
|
1004
|
+
onSort={(k, d) => { setSortKey(k); setSortDir(d); }}
|
|
1005
|
+
/>
|
|
1006
|
+
<DataGrid columns={cols} rows={[]} loading />
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
**Common mistakes:**
|
|
1010
|
+
- ❌ `DataGrid expecting built-in pagination` → Slice rows yourself and use the Pagination component
|
|
1011
|
+
- ❌ `DataGrid expecting built-in filtering` → Filter the rows array before passing it in
|
|
1012
|
+
- ❌ `sortable without onSort` → Handle onSort and sort the rows array in your state
|
|
1013
|
+
|
|
1014
|
+
---
|
|
1015
|
+
|
|
1016
|
+
### Tag
|
|
1017
|
+
|
|
1018
|
+
Standalone display tag/chip for categories, labels, or filter chips. NOT an input — for tag input use TagsInput. Group multiple with TagGroup.
|
|
1019
|
+
|
|
1020
|
+
```tsx
|
|
1021
|
+
import { Tag } from "@usevyre/react"
|
|
1022
|
+
|
|
1023
|
+
// Props:
|
|
1024
|
+
// variant = "default" | "accent" | "danger" (default: default)
|
|
1025
|
+
// size = "sm" | "md" | "lg" (default: md)
|
|
1026
|
+
// onRemove = () => void
|
|
1027
|
+
// onClick = () => void
|
|
1028
|
+
// disabled = boolean (default: false)
|
|
1029
|
+
|
|
1030
|
+
// Examples:
|
|
1031
|
+
<TagGroup>
|
|
1032
|
+
<Tag>Design</Tag>
|
|
1033
|
+
<Tag variant="accent">Featured</Tag>
|
|
1034
|
+
<Tag>Engineering</Tag>
|
|
1035
|
+
</TagGroup>
|
|
1036
|
+
<Tag onRemove={() => removeFilter("react")}>react</Tag>
|
|
1037
|
+
<Tag onClick={() => toggleFilter("vue")}>vue</Tag>
|
|
1038
|
+
```
|
|
1039
|
+
|
|
1040
|
+
**Common mistakes:**
|
|
1041
|
+
- ❌ `Tag variant="success"` → Use Badge for success/warning/teal status colors; Tag is for categories/filters
|
|
1042
|
+
- ❌ `Using Tag for tag input` → Use TagsInput for adding/removing tags via keyboard
|
|
1043
|
+
- ❌ `Tag size="xl"` → Use size="lg"
|
|
1044
|
+
|
|
1045
|
+
---
|
|
1046
|
+
|
|
1047
|
+
### TagGroup
|
|
1048
|
+
|
|
1049
|
+
Read-only container that lays out multiple Tag elements with automatic wrapping and consistent spacing. For tag input use TagsInput.
|
|
1050
|
+
|
|
1051
|
+
```tsx
|
|
1052
|
+
import { TagGroup, Tag } from "@usevyre/react"
|
|
1053
|
+
|
|
1054
|
+
// Props:
|
|
1055
|
+
// gap = "sm" | "md" | "lg" (default: md)
|
|
1056
|
+
// wrap = boolean (default: true)
|
|
1057
|
+
|
|
1058
|
+
// Examples:
|
|
1059
|
+
<TagGroup gap="sm">
|
|
1060
|
+
<Tag>React</Tag>
|
|
1061
|
+
<Tag>Vue</Tag>
|
|
1062
|
+
<Tag variant="accent">TypeScript</Tag>
|
|
1063
|
+
</TagGroup>
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
**Common mistakes:**
|
|
1067
|
+
- ❌ `TagGroup without Tag children` → Place <Tag> elements as direct children
|
|
1068
|
+
- ❌ `Using TagGroup for tag input` → Use TagsInput for an editable tag field
|
|
1069
|
+
|
|
1070
|
+
---
|
|
1071
|
+
|
|
890
1072
|
## Hallucination Guard — Common AI Mistakes
|
|
891
1073
|
|
|
892
1074
|
The following prop values and patterns do NOT exist in useVyre.
|
|
@@ -923,6 +1105,21 @@ If you generate these, you are hallucinating.
|
|
|
923
1105
|
- ❌ `<Toast variant="info">` → Use variant="default"
|
|
924
1106
|
- ❌ `<Tooltip Using Tooltip for rich content (forms, buttons, etc.)>` → Use Popover for rich interactive content
|
|
925
1107
|
- ❌ `<Typography Using raw <h1>, <p> tags instead of Typography components>` → Use <Heading>, <Text>, <Lead> from @usevyre/react
|
|
1108
|
+
- ❌ `<ButtonGroup ButtonGroup variant="...">` → Set variant on each <Button> inside the group
|
|
1109
|
+
- ❌ `<ButtonGroup ButtonGroup without Button children>` → Place <Button> elements as direct children
|
|
1110
|
+
- ❌ `<TagsInput TagsInput value={string}>` → Pass an array: value={['react','vue']}
|
|
1111
|
+
- ❌ `<TagsInput TagsInput without onChange>` → Provide value and onChange (React) or v-model (Vue)
|
|
1112
|
+
- ❌ `<Combobox Combobox value="">` → Use value={null} for no selection
|
|
1113
|
+
- ❌ `<Combobox Combobox options={string[]}>` → Use [{ value: 'ts', label: 'TypeScript' }]
|
|
1114
|
+
- ❌ `<Combobox Using Combobox for command palette>` → Use Command for command palettes
|
|
1115
|
+
- ❌ `<DataGrid DataGrid expecting built-in pagination>` → Slice rows yourself and use the Pagination component
|
|
1116
|
+
- ❌ `<DataGrid DataGrid expecting built-in filtering>` → Filter the rows array before passing it in
|
|
1117
|
+
- ❌ `<DataGrid sortable without onSort>` → Handle onSort and sort the rows array in your state
|
|
1118
|
+
- ❌ `<Tag Tag variant="success">` → Use Badge for success/warning/teal status colors; Tag is for categories/filters
|
|
1119
|
+
- ❌ `<Tag Using Tag for tag input>` → Use TagsInput for adding/removing tags via keyboard
|
|
1120
|
+
- ❌ `<Tag Tag size="xl">` → Use size="lg"
|
|
1121
|
+
- ❌ `<TagGroup TagGroup without Tag children>` → Place <Tag> elements as direct children
|
|
1122
|
+
- ❌ `<TagGroup Using TagGroup for tag input>` → Use TagsInput for an editable tag field
|
|
926
1123
|
|
|
927
1124
|
---
|
|
928
1125
|
|