@usevyre/ai-context 1.1.0 → 1.2.1
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 +186 -4
- package/dist/cheat-sheets/calendar.md +5 -3
- package/dist/cheat-sheets/conversation.md +63 -0
- package/dist/cheat-sheets/datepicker.md +36 -0
- package/dist/cheat-sheets/daterangepicker.md +37 -0
- package/dist/cheat-sheets/field.md +19 -1
- package/dist/cheat-sheets/index.md +9 -2
- package/dist/cheat-sheets/input.md +2 -0
- package/dist/cheat-sheets/item.md +53 -0
- package/dist/cheat-sheets/kanban.md +59 -0
- package/dist/cheat-sheets/radiogroup.md +47 -0
- package/dist/cheat-sheets/richtexteditor.md +41 -0
- package/dist/cheat-sheets/sidebar.md +16 -0
- package/dist/claude-context.md +337 -5
- package/dist/copilot-instructions.md +337 -5
- package/dist/cursor-rules.md +96 -4
- package/dist/full-context.md +336 -4
- package/dist/index.js +2390 -151
- package/dist/schema.json +584 -8
- package/dist/tokens.json +1 -1
- package/dist/tokens.md +1 -1
- package/dist/version-info.json +92 -38
- package/dist/windsurf-rules.md +337 -5
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# RichTextEditor — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**Controlled WYSIWYG editor. value is an HTML string; you own it in state and set it in onChange (React) / v-model (Vue). Native contentEditable + execCommand — zero dependencies. Toolbar: bold, italic, underline, strike, h1-h3, ordered/unordered lists, quote, code block, link, clear formatting.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { RichTextEditor } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `disabled` | `true` \| `false` | `false` |
|
|
15
|
+
| `readOnly` | `true` \| `false` | `false` |
|
|
16
|
+
|
|
17
|
+
## Common AI Mistakes
|
|
18
|
+
|
|
19
|
+
- ❌ `RichTextEditor without value/onChange (React) or v-model (Vue)`
|
|
20
|
+
→ Keep the HTML string in state and update it in onChange / v-model
|
|
21
|
+
- ❌ `Rendering value as text or with dangerouslySetInnerHTML elsewhere without sanitising`
|
|
22
|
+
→ Sanitise (e.g. DOMPurify) before re-rendering untrusted RTE output
|
|
23
|
+
- ❌ `toolbar="bold" (string)`
|
|
24
|
+
→ Pass an array, e.g. toolbar={["bold","italic","link"]}
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
**Controlled editor**
|
|
29
|
+
```tsx
|
|
30
|
+
const [html, setHtml] = useState("<p>Hello <strong>world</strong></p>");
|
|
31
|
+
<RichTextEditor value={html} onChange={setHtml} placeholder="Write…" />
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Minimal toolbar**
|
|
35
|
+
```tsx
|
|
36
|
+
<RichTextEditor
|
|
37
|
+
value={html}
|
|
38
|
+
onChange={setHtml}
|
|
39
|
+
toolbar={["bold", "italic", "link"]}
|
|
40
|
+
/>
|
|
41
|
+
```
|
|
@@ -13,6 +13,11 @@ import { AppLayout, Sidebar, SidebarHeader, SidebarContent, SidebarSection, Side
|
|
|
13
13
|
|------|--------|---------|
|
|
14
14
|
| `variant` | `"default"` \| `"floating"` | `default` |
|
|
15
15
|
|
|
16
|
+
## Common AI Mistakes
|
|
17
|
+
|
|
18
|
+
- ❌ `Vue: passing icon/collapsedIcon as props on SidebarTrigger`
|
|
19
|
+
→ Use <template #icon> and <template #collapsed-icon>; React uses icon / collapsedIcon props
|
|
20
|
+
|
|
16
21
|
## Examples
|
|
17
22
|
|
|
18
23
|
**App layout with sidebar**
|
|
@@ -31,3 +36,14 @@ import { AppLayout, Sidebar, SidebarHeader, SidebarContent, SidebarSection, Side
|
|
|
31
36
|
<main>Page content</main>
|
|
32
37
|
</AppLayout>
|
|
33
38
|
```
|
|
39
|
+
|
|
40
|
+
**SidebarTrigger with distinct open/collapsed icons**
|
|
41
|
+
```tsx
|
|
42
|
+
<SidebarTrigger icon={<PanelLeftClose />} collapsedIcon={<PanelLeftOpen />} />
|
|
43
|
+
|
|
44
|
+
// Vue:
|
|
45
|
+
// <SidebarTrigger>
|
|
46
|
+
// <template #icon><PanelLeftClose /></template>
|
|
47
|
+
// <template #collapsed-icon><PanelLeftOpen /></template>
|
|
48
|
+
// </SidebarTrigger>
|
|
49
|
+
```
|
package/dist/claude-context.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# useVyre Design System Context
|
|
2
|
-
# Version: 1.
|
|
2
|
+
# Version: 1.2.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.
|
|
@@ -311,7 +311,7 @@ import { Button } from "@usevyre/react"
|
|
|
311
311
|
|
|
312
312
|
### Calendar
|
|
313
313
|
|
|
314
|
-
|
|
314
|
+
Inline date-grid widget (always visible, no input). mode: single | range | multiple, optional time picker. For an input + popover use DatePicker; for start/end ranges with presets use DateRangePicker.
|
|
315
315
|
|
|
316
316
|
```tsx
|
|
317
317
|
import { Calendar } from "@usevyre/react"
|
|
@@ -320,6 +320,7 @@ import { Calendar } from "@usevyre/react"
|
|
|
320
320
|
// value = Date | null
|
|
321
321
|
// onChange = function
|
|
322
322
|
// disabled = boolean (default: false)
|
|
323
|
+
// defaultMonth = Date
|
|
323
324
|
|
|
324
325
|
// Examples:
|
|
325
326
|
const [date, setDate] = useState(null);
|
|
@@ -327,7 +328,39 @@ const [date, setDate] = useState(null);
|
|
|
327
328
|
```
|
|
328
329
|
|
|
329
330
|
**Common mistakes:**
|
|
330
|
-
- ❌ `
|
|
331
|
+
- ❌ `Calendar for an input field that opens a popover` → Use <DatePicker /> (single date) or <DateRangePicker /> (range)
|
|
332
|
+
- ❌ `value as tuple for mode="single"` → Pass value matching mode; use mode="range" for [start,end]
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
### DatePicker
|
|
337
|
+
|
|
338
|
+
Input trigger that opens a Calendar in a popover. Same modes as Calendar (single | range | multiple) plus a placeholder. Use this for a compact date field; use Calendar for an always-visible grid, or DateRangePicker for start/end ranges with presets.
|
|
339
|
+
|
|
340
|
+
```tsx
|
|
341
|
+
import { DatePicker } from "@usevyre/react"
|
|
342
|
+
|
|
343
|
+
// Props:
|
|
344
|
+
// value = Date | [Date, Date] | Date[] | null
|
|
345
|
+
// onChange = function
|
|
346
|
+
// mode = "single" | "range" | "multiple" (default: single)
|
|
347
|
+
// placeholder = string (default: Pick a date)
|
|
348
|
+
// showTime = boolean (default: false)
|
|
349
|
+
// minDate = Date
|
|
350
|
+
// maxDate = Date
|
|
351
|
+
// disabled = function
|
|
352
|
+
// weekStartsOn = "0" | "1" (default: 1)
|
|
353
|
+
// inputClassName = string
|
|
354
|
+
|
|
355
|
+
// Examples:
|
|
356
|
+
const [date, setDate] = useState(null);
|
|
357
|
+
<DatePicker value={date} onChange={setDate} placeholder="Pick a date" />
|
|
358
|
+
<DatePicker value={date} onChange={setDate} showTime />
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Common mistakes:**
|
|
362
|
+
- ❌ `DatePicker mode="range" for { from, to } object` → Use <DateRangePicker /> for the { from, to } object API + presets + dual month
|
|
363
|
+
- ❌ `DatePicker without value/onChange` → Provide value and onChange (e.g. from useState)
|
|
331
364
|
|
|
332
365
|
---
|
|
333
366
|
|
|
@@ -387,6 +420,78 @@ import { Checkbox } from "@usevyre/react"
|
|
|
387
420
|
|
|
388
421
|
---
|
|
389
422
|
|
|
423
|
+
### RadioGroup
|
|
424
|
+
|
|
425
|
+
Controlled single-choice group. RadioGroup owns the selected value; render it data-driven via the options array OR with composable <Radio> children for custom content. role=radiogroup with proper labelling. For multi-select use Checkbox; for a compact dropdown use Select.
|
|
426
|
+
|
|
427
|
+
```tsx
|
|
428
|
+
import { RadioGroup, Radio } from "@usevyre/react"
|
|
429
|
+
|
|
430
|
+
// Props:
|
|
431
|
+
// value = string
|
|
432
|
+
// defaultValue = string
|
|
433
|
+
// onChange = function
|
|
434
|
+
// name = string
|
|
435
|
+
// disabled = boolean (default: false)
|
|
436
|
+
// size = "sm" | "md" (default: md)
|
|
437
|
+
// orientation = "vertical" | "horizontal" (default: vertical)
|
|
438
|
+
// options = { value: string; label?: string; description?: string; disabled?: boolean }[]
|
|
439
|
+
|
|
440
|
+
// Examples:
|
|
441
|
+
<RadioGroup
|
|
442
|
+
value={plan}
|
|
443
|
+
onChange={setPlan}
|
|
444
|
+
options={[
|
|
445
|
+
{ value: "free", label: "Free", description: "For hobby projects" },
|
|
446
|
+
{ value: "pro", label: "Pro", description: "For teams" },
|
|
447
|
+
]}
|
|
448
|
+
/>
|
|
449
|
+
<RadioGroup value={plan} onChange={setPlan} orientation="horizontal">
|
|
450
|
+
<Radio value="free" label="Free" />
|
|
451
|
+
<Radio value="pro" label="Pro" />
|
|
452
|
+
</RadioGroup>
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
**Common mistakes:**
|
|
456
|
+
- ❌ `<Radio> used outside a <RadioGroup>` → Always wrap <Radio> in <RadioGroup>
|
|
457
|
+
- ❌ `RadioGroup without value/onChange (React) or v-model (Vue)` → Bind value + onChange (React) or v-model (Vue); or defaultValue for uncontrolled in React
|
|
458
|
+
- ❌ `Using Checkbox for mutually-exclusive choices` → Use RadioGroup + Radio (or options) for one-of-many
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
### RichTextEditor
|
|
463
|
+
|
|
464
|
+
Controlled WYSIWYG editor. value is an HTML string; you own it in state and set it in onChange (React) / v-model (Vue). Native contentEditable + execCommand — zero dependencies. Toolbar: bold, italic, underline, strike, h1-h3, ordered/unordered lists, quote, code block, link, clear formatting.
|
|
465
|
+
|
|
466
|
+
```tsx
|
|
467
|
+
import { RichTextEditor } from "@usevyre/react"
|
|
468
|
+
|
|
469
|
+
// Props:
|
|
470
|
+
// value = string
|
|
471
|
+
// onChange = function
|
|
472
|
+
// placeholder = string (default: Write something…)
|
|
473
|
+
// disabled = boolean (default: false)
|
|
474
|
+
// readOnly = boolean (default: false)
|
|
475
|
+
// toolbar = RichTextTool[]
|
|
476
|
+
// minHeight = string (default: 10rem)
|
|
477
|
+
|
|
478
|
+
// Examples:
|
|
479
|
+
const [html, setHtml] = useState("<p>Hello <strong>world</strong></p>");
|
|
480
|
+
<RichTextEditor value={html} onChange={setHtml} placeholder="Write…" />
|
|
481
|
+
<RichTextEditor
|
|
482
|
+
value={html}
|
|
483
|
+
onChange={setHtml}
|
|
484
|
+
toolbar={["bold", "italic", "link"]}
|
|
485
|
+
/>
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
**Common mistakes:**
|
|
489
|
+
- ❌ `RichTextEditor without value/onChange (React) or v-model (Vue)` → Keep the HTML string in state and update it in onChange / v-model
|
|
490
|
+
- ❌ `Rendering value as text or with dangerouslySetInnerHTML elsewhere without sanitising` → Sanitise (e.g. DOMPurify) before re-rendering untrusted RTE output
|
|
491
|
+
- ❌ `toolbar="bold" (string)` → Pass an array, e.g. toolbar={["bold","italic","link"]}
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
390
495
|
### Command
|
|
391
496
|
|
|
392
497
|
Command palette / search dialog. Use for search-first navigation or quick actions.
|
|
@@ -438,7 +543,7 @@ import { DropdownMenu, DropdownItem, DropdownSeparator, DropdownCheckboxItem, Dr
|
|
|
438
543
|
|
|
439
544
|
### Field
|
|
440
545
|
|
|
441
|
-
Form field wrapper
|
|
546
|
+
Form field wrapper. Two ways to use it (both supported): (1) props-based — pass label/hint/state/required for the common case; (2) composable — use the parts FieldLabel, FieldDescription, FieldError, FieldGroup, FieldSet for richer layouts (multiple controls, custom error placement). The props-based API is unchanged and still works.
|
|
442
547
|
|
|
443
548
|
```tsx
|
|
444
549
|
import { Field, Input, Textarea } from "@usevyre/react"
|
|
@@ -456,10 +561,23 @@ import { Field, Input, Textarea } from "@usevyre/react"
|
|
|
456
561
|
<Field label="Search">
|
|
457
562
|
<Input leftElement={<SearchIcon />} placeholder="Search..." />
|
|
458
563
|
</Field>
|
|
564
|
+
<Field>
|
|
565
|
+
<FieldLabel required htmlFor="email">Email</FieldLabel>
|
|
566
|
+
<Input id="email" type="email" />
|
|
567
|
+
<FieldDescription>We\u2019ll never share it.</FieldDescription>
|
|
568
|
+
<FieldError>{errors.email}</FieldError>
|
|
569
|
+
</Field>
|
|
570
|
+
|
|
571
|
+
// Two controls side by side
|
|
572
|
+
<FieldGroup orientation="horizontal">
|
|
573
|
+
<Field label="First name"><Input /></Field>
|
|
574
|
+
<Field label="Last name"><Input /></Field>
|
|
575
|
+
</FieldGroup>
|
|
459
576
|
```
|
|
460
577
|
|
|
461
578
|
**Common mistakes:**
|
|
462
579
|
- ❌ `Applying state prop directly to Input` → Wrap Input in <Field state="error"> to apply validation styling
|
|
580
|
+
- ❌ `Mixing props label/hint AND FieldLabel/FieldError for the same field` → Pick one: either props-based (label/hint/state) OR composable parts
|
|
463
581
|
|
|
464
582
|
---
|
|
465
583
|
|
|
@@ -471,6 +589,7 @@ Text input field. Wrap in Field for labels and validation. Use leftElement/right
|
|
|
471
589
|
import { Input } from "@usevyre/react"
|
|
472
590
|
|
|
473
591
|
// Props:
|
|
592
|
+
// modelValue = string | number
|
|
474
593
|
// size = "sm" | "md" | "lg" (default: md)
|
|
475
594
|
// leftElement = ReactNode
|
|
476
595
|
// rightElement = ReactNode
|
|
@@ -482,6 +601,7 @@ import { Input } from "@usevyre/react"
|
|
|
482
601
|
**Common mistakes:**
|
|
483
602
|
- ❌ `size="icon"` → Use size="sm" | "md" | "lg"
|
|
484
603
|
- ❌ `type="search" for search UI` → Import Command from @usevyre/react for search palettes
|
|
604
|
+
- ❌ `Vue: binding Input/Textarea value without v-model` → Use v-model on <Input>/<Textarea> in Vue; in React use value + onChange
|
|
485
605
|
|
|
486
606
|
---
|
|
487
607
|
|
|
@@ -677,6 +797,8 @@ import { AppLayout, Sidebar, SidebarHeader, SidebarContent, SidebarSection, Side
|
|
|
677
797
|
|
|
678
798
|
// Props:
|
|
679
799
|
// variant = "default" | "floating" (default: default)
|
|
800
|
+
// SidebarTrigger.icon = ReactNode
|
|
801
|
+
// SidebarTrigger.collapsedIcon = ReactNode
|
|
680
802
|
|
|
681
803
|
// Examples:
|
|
682
804
|
<AppLayout>
|
|
@@ -692,8 +814,18 @@ import { AppLayout, Sidebar, SidebarHeader, SidebarContent, SidebarSection, Side
|
|
|
692
814
|
</Sidebar>
|
|
693
815
|
<main>Page content</main>
|
|
694
816
|
</AppLayout>
|
|
817
|
+
<SidebarTrigger icon={<PanelLeftClose />} collapsedIcon={<PanelLeftOpen />} />
|
|
818
|
+
|
|
819
|
+
// Vue:
|
|
820
|
+
// <SidebarTrigger>
|
|
821
|
+
// <template #icon><PanelLeftClose /></template>
|
|
822
|
+
// <template #collapsed-icon><PanelLeftOpen /></template>
|
|
823
|
+
// </SidebarTrigger>
|
|
695
824
|
```
|
|
696
825
|
|
|
826
|
+
**Common mistakes:**
|
|
827
|
+
- ❌ `Vue: passing icon/collapsedIcon as props on SidebarTrigger` → Use <template #icon> and <template #collapsed-icon>; React uses icon / collapsedIcon props
|
|
828
|
+
|
|
697
829
|
---
|
|
698
830
|
|
|
699
831
|
### Skeleton
|
|
@@ -1069,6 +1201,180 @@ import { TagGroup, Tag } from "@usevyre/react"
|
|
|
1069
1201
|
|
|
1070
1202
|
---
|
|
1071
1203
|
|
|
1204
|
+
### Item
|
|
1205
|
+
|
|
1206
|
+
Layout primitive for list rows, settings rows, and notification rows. Denser than Card — use Item (not Card) for repeated list rows.
|
|
1207
|
+
|
|
1208
|
+
```tsx
|
|
1209
|
+
import { Item, ItemMedia, ItemContent, ItemTitle, ItemDescription, ItemActions, ItemGroup } from "@usevyre/react"
|
|
1210
|
+
|
|
1211
|
+
// Props:
|
|
1212
|
+
// variant = "default" | "outlined" | "muted" | "plain" (default: default)
|
|
1213
|
+
// size = "sm" | "md" | "lg" (default: md)
|
|
1214
|
+
// clickable = boolean (default: false)
|
|
1215
|
+
|
|
1216
|
+
// Examples:
|
|
1217
|
+
<Item>
|
|
1218
|
+
<ItemMedia><BellIcon /></ItemMedia>
|
|
1219
|
+
<ItemContent>
|
|
1220
|
+
<ItemTitle>Notifications</ItemTitle>
|
|
1221
|
+
<ItemDescription>Receive an email when someone mentions you.</ItemDescription>
|
|
1222
|
+
</ItemContent>
|
|
1223
|
+
<ItemActions>
|
|
1224
|
+
<Switch defaultChecked />
|
|
1225
|
+
</ItemActions>
|
|
1226
|
+
</Item>
|
|
1227
|
+
<ItemGroup separated>
|
|
1228
|
+
<Item clickable>
|
|
1229
|
+
<ItemContent><ItemTitle>Profile</ItemTitle></ItemContent>
|
|
1230
|
+
</Item>
|
|
1231
|
+
<Item clickable>
|
|
1232
|
+
<ItemContent><ItemTitle>Billing</ItemTitle></ItemContent>
|
|
1233
|
+
</Item>
|
|
1234
|
+
</ItemGroup>
|
|
1235
|
+
```
|
|
1236
|
+
|
|
1237
|
+
**Common mistakes:**
|
|
1238
|
+
- ❌ `Card used for repeated list rows` → Use <Item> (optionally inside <ItemGroup separated>) for list/settings rows
|
|
1239
|
+
- ❌ `Item variant="primary"` → Use variant="default" | "outlined" | "muted"
|
|
1240
|
+
- ❌ `raw text directly inside Item` → Wrap text in <ItemContent><ItemTitle>…</ItemTitle></ItemContent>
|
|
1241
|
+
|
|
1242
|
+
---
|
|
1243
|
+
|
|
1244
|
+
### Kanban
|
|
1245
|
+
|
|
1246
|
+
Drag-and-drop board: cards move between columns (or reorder within a column). CONTROLLED & data-driven like DataGrid. While dragging, a placeholder shows the exact drop position. Each card is wrapped in a Card (variant="outlined"); renderCard (React) / #card slot (Vue) can render ANY content incl. complex components (Avatar/Badge/Progress). Columns and cards accept an optional semantic color tint. Native HTML5 DnD, zero deps.
|
|
1247
|
+
|
|
1248
|
+
```tsx
|
|
1249
|
+
import { Kanban } from "@usevyre/react"
|
|
1250
|
+
|
|
1251
|
+
// Props:
|
|
1252
|
+
// value = KanbanColumn[]
|
|
1253
|
+
// onChange = function
|
|
1254
|
+
// renderCard = function
|
|
1255
|
+
// onCardClick = function
|
|
1256
|
+
|
|
1257
|
+
// Examples:
|
|
1258
|
+
const [columns, setColumns] = useState([
|
|
1259
|
+
{ id: "todo", title: "To Do", cards: [{ id: "1", title: "Spec API" }] },
|
|
1260
|
+
{ id: "doing", title: "In Progress", cards: [] },
|
|
1261
|
+
{ id: "done", title: "Done", cards: [{ id: "2", title: "Kickoff" }] },
|
|
1262
|
+
]);
|
|
1263
|
+
<Kanban value={columns} onChange={setColumns} />
|
|
1264
|
+
<Kanban
|
|
1265
|
+
value={columns}
|
|
1266
|
+
onChange={setColumns}
|
|
1267
|
+
onCardClick={(card) => openDetail(card.id)}
|
|
1268
|
+
renderCard={(card) => (
|
|
1269
|
+
<><strong>{card.title}</strong><Badge>{card.id}</Badge></>
|
|
1270
|
+
)}
|
|
1271
|
+
/>
|
|
1272
|
+
const [cols, setCols] = useState([
|
|
1273
|
+
{ id: "doing", title: "In Progress", color: "teal", cards: [
|
|
1274
|
+
{ id: "t1", title: "OAuth", assignee: "AK", progress: 60, color: "warning" },
|
|
1275
|
+
]},
|
|
1276
|
+
]);
|
|
1277
|
+
<Kanban
|
|
1278
|
+
value={cols}
|
|
1279
|
+
onChange={setCols}
|
|
1280
|
+
renderCard={(card) => (
|
|
1281
|
+
<><strong>{card.title}</strong><Progress value={card.progress} /></>
|
|
1282
|
+
)}
|
|
1283
|
+
/>
|
|
1284
|
+
```
|
|
1285
|
+
|
|
1286
|
+
**Common mistakes:**
|
|
1287
|
+
- ❌ `Kanban without onChange (or ignoring it)` → Store columns in state and setColumns in onChange (v-model in Vue)
|
|
1288
|
+
- ❌ `Duplicate card ids across columns` → Use globally-unique card ids across the entire board
|
|
1289
|
+
- ❌ `Mutating value in place then calling onChange` → Pass the new array Kanban gives you straight to setState / v-model
|
|
1290
|
+
- ❌ `color="blue" (or any non-semantic value)` → Use one of: "default" | "accent" | "teal" | "success" | "warning" | "danger"
|
|
1291
|
+
|
|
1292
|
+
---
|
|
1293
|
+
|
|
1294
|
+
### Conversation
|
|
1295
|
+
|
|
1296
|
+
Chat / inbox message thread. CONTROLLED & data-driven like Kanban — you own `value` (messages array) and append in your own send handler; Conversation holds no message state. Consecutive messages from the same author are grouped (avatar + name shown once), day separators are inserted on date change, and outgoing messages (authorId === currentUserId) align right.
|
|
1297
|
+
|
|
1298
|
+
```tsx
|
|
1299
|
+
import { Conversation } from "@usevyre/react"
|
|
1300
|
+
|
|
1301
|
+
// Props:
|
|
1302
|
+
// value = ConversationMessage[]
|
|
1303
|
+
// currentUserId = string
|
|
1304
|
+
// composer = boolean (default: false)
|
|
1305
|
+
// onSend = function
|
|
1306
|
+
// placeholder = string (default: Write a message…)
|
|
1307
|
+
// typing = boolean | string (default: false)
|
|
1308
|
+
// allowAttachments = boolean (default: false)
|
|
1309
|
+
// accept = string
|
|
1310
|
+
// renderMessage = function
|
|
1311
|
+
// renderComposer = function
|
|
1312
|
+
|
|
1313
|
+
// Examples:
|
|
1314
|
+
const [messages, setMessages] = useState([
|
|
1315
|
+
{ id: "1", authorId: "sam", authorName: "Sam", text: "Hey!" },
|
|
1316
|
+
{ id: "2", authorId: "me", text: "Hi \ud83d\udc4b", status: "read" },
|
|
1317
|
+
]);
|
|
1318
|
+
<Conversation
|
|
1319
|
+
value={messages}
|
|
1320
|
+
currentUserId="me"
|
|
1321
|
+
composer
|
|
1322
|
+
onSend={(t) => setMessages((m) => [...m, { id: crypto.randomUUID(), authorId: "me", text: t }])}
|
|
1323
|
+
/>
|
|
1324
|
+
<Conversation
|
|
1325
|
+
value={messages}
|
|
1326
|
+
currentUserId="me"
|
|
1327
|
+
typing="Sam is typing"
|
|
1328
|
+
renderMessage={(m) => <strong>{m.text}</strong>}
|
|
1329
|
+
/>
|
|
1330
|
+
const messages = [
|
|
1331
|
+
{ id: "1", authorId: "sam", authorName: "Sam", text: "Moodboard \ud83d\udc47",
|
|
1332
|
+
attachments: [{ kind: "image", url: "/board.png", name: "board.png" }] },
|
|
1333
|
+
{ id: "2", authorId: "me", text: "Specs:", status: "read",
|
|
1334
|
+
attachments: [{ kind: "file", url: "/spec.pdf", name: "spec.pdf", size: "2.4 MB" }] },
|
|
1335
|
+
];
|
|
1336
|
+
<Conversation value={messages} currentUserId="me" />
|
|
1337
|
+
```
|
|
1338
|
+
|
|
1339
|
+
**Common mistakes:**
|
|
1340
|
+
- ❌ `Conversation without currentUserId` → Always pass currentUserId matching one of the message authorId values
|
|
1341
|
+
- ❌ `Expecting Conversation to store/append messages` → Append to your own state in onSend (or @send) and pass it back via value
|
|
1342
|
+
- ❌ `composer without onSend (React) / @send (Vue)` → Provide onSend / @send to append the message to value
|
|
1343
|
+
- ❌ `Treating onSend as (text) only when using allowAttachments` → Handle onSend(text, files) — map files to message attachments and append
|
|
1344
|
+
|
|
1345
|
+
---
|
|
1346
|
+
|
|
1347
|
+
### DateRangePicker
|
|
1348
|
+
|
|
1349
|
+
Start/end date range picker. Built on Calendar (mode=range) with a friendlier { from, to } object API, a two-month side-by-side view, and preset shortcuts. Use this for report/filter date ranges; use DatePicker for a single date.
|
|
1350
|
+
|
|
1351
|
+
```tsx
|
|
1352
|
+
import { DateRangePicker } from "@usevyre/react"
|
|
1353
|
+
|
|
1354
|
+
// Props:
|
|
1355
|
+
// value = { from: Date | null; to: Date | null } | null
|
|
1356
|
+
// onChange = function
|
|
1357
|
+
// placeholder = string (default: Pick a date range)
|
|
1358
|
+
// numberOfMonths = "1" | "2" (default: 2)
|
|
1359
|
+
// presets = boolean | DateRangePreset[] (default: false)
|
|
1360
|
+
// minDate = Date
|
|
1361
|
+
// maxDate = Date
|
|
1362
|
+
// disabled = function
|
|
1363
|
+
// weekStartsOn = "0" | "1" (default: 1)
|
|
1364
|
+
|
|
1365
|
+
// Examples:
|
|
1366
|
+
const [range, setRange] = useState({ from: null, to: null });
|
|
1367
|
+
<DateRangePicker value={range} onChange={setRange} presets />
|
|
1368
|
+
<DateRangePicker value={range} onChange={setRange} numberOfMonths={1} />
|
|
1369
|
+
```
|
|
1370
|
+
|
|
1371
|
+
**Common mistakes:**
|
|
1372
|
+
- ❌ `value={[from, to]}` → Use value={{ from, to }} and read range.from / range.to
|
|
1373
|
+
- ❌ `DateRangePicker for a single date` → Use <DatePicker /> for a single date
|
|
1374
|
+
- ❌ `presets="true" (string)` → Use the bare prop: presets (or presets={true})
|
|
1375
|
+
|
|
1376
|
+
---
|
|
1377
|
+
|
|
1072
1378
|
## Hallucination Guard — Common AI Mistakes
|
|
1073
1379
|
|
|
1074
1380
|
The following prop values and patterns do NOT exist in useVyre.
|
|
@@ -1088,18 +1394,30 @@ If you generate these, you are hallucinating.
|
|
|
1088
1394
|
- ❌ `<Button color="...">` → Use variant prop instead
|
|
1089
1395
|
- ❌ `<Button icon={...}>` → Use leftIcon={...} or rightIcon={...}
|
|
1090
1396
|
- ❌ `<Button size="icon" without aria-label>` → Add aria-label describing the action
|
|
1091
|
-
- ❌ `<Calendar
|
|
1397
|
+
- ❌ `<Calendar Calendar for an input field that opens a popover>` → Use <DatePicker /> (single date) or <DateRangePicker /> (range)
|
|
1398
|
+
- ❌ `<Calendar value as tuple for mode="single">` → Pass value matching mode; use mode="range" for [start,end]
|
|
1399
|
+
- ❌ `<DatePicker DatePicker mode="range" for { from, to } object>` → Use <DateRangePicker /> for the { from, to } object API + presets + dual month
|
|
1400
|
+
- ❌ `<DatePicker DatePicker without value/onChange>` → Provide value and onChange (e.g. from useState)
|
|
1092
1401
|
- ❌ `<Card variant="primary">` → Use variant="elevated" | "outlined" | "ghost" | "accent"
|
|
1093
1402
|
- ❌ `<Checkbox size="lg">` → Use size="md"
|
|
1403
|
+
- ❌ `<RadioGroup <Radio> used outside a <RadioGroup>>` → Always wrap <Radio> in <RadioGroup>
|
|
1404
|
+
- ❌ `<RadioGroup RadioGroup without value/onChange (React) or v-model (Vue)>` → Bind value + onChange (React) or v-model (Vue); or defaultValue for uncontrolled in React
|
|
1405
|
+
- ❌ `<RadioGroup Using Checkbox for mutually-exclusive choices>` → Use RadioGroup + Radio (or options) for one-of-many
|
|
1406
|
+
- ❌ `<RichTextEditor RichTextEditor without value/onChange (React) or v-model (Vue)>` → Keep the HTML string in state and update it in onChange / v-model
|
|
1407
|
+
- ❌ `<RichTextEditor Rendering value as text or with dangerouslySetInnerHTML elsewhere without sanitising>` → Sanitise (e.g. DOMPurify) before re-rendering untrusted RTE output
|
|
1408
|
+
- ❌ `<RichTextEditor toolbar="bold" (string)>` → Pass an array, e.g. toolbar={["bold","italic","link"]}
|
|
1094
1409
|
- ❌ `<Command Using Input type="search" for search UI>` → Use Command + CommandInput + CommandList + CommandItem
|
|
1095
1410
|
- ❌ `<DropdownMenu DropdownItem variant="primary">` → Use variant="danger" for destructive items only
|
|
1096
1411
|
- ❌ `<Field Applying state prop directly to Input>` → Wrap Input in <Field state="error"> to apply validation styling
|
|
1412
|
+
- ❌ `<Field Mixing props label/hint AND FieldLabel/FieldError for the same field>` → Pick one: either props-based (label/hint/state) OR composable parts
|
|
1097
1413
|
- ❌ `<Input size="icon">` → Use size="sm" | "md" | "lg"
|
|
1098
1414
|
- ❌ `<Input type="search" for search UI>` → Import Command from @usevyre/react for search palettes
|
|
1415
|
+
- ❌ `<Input Vue: binding Input/Textarea value without v-model>` → Use v-model on <Input>/<Textarea> in Vue; in React use value + onChange
|
|
1099
1416
|
- ❌ `<Modal size="xl">` → Use size="lg" or size="full"
|
|
1100
1417
|
- ❌ `<Popover placement="top-center">` → Use placement="top" for centered placement
|
|
1101
1418
|
- ❌ `<Progress value > 100>` → Normalize your value to 0–100 range before passing
|
|
1102
1419
|
- ❌ `<Select Passing strings directly as children>` → Pass options={[{ value: 'a', label: 'Option A' }]}
|
|
1420
|
+
- ❌ `<Sidebar Vue: passing icon/collapsedIcon as props on SidebarTrigger>` → Use <template #icon> and <template #collapsed-icon>; React uses icon / collapsedIcon props
|
|
1103
1421
|
- ❌ `<Toast Rendering <Toast> directly in JSX>` → Use: const { toast } = useToast(); then toast({ title, variant })
|
|
1104
1422
|
- ❌ `<Toast variant="error">` → Use variant="danger"
|
|
1105
1423
|
- ❌ `<Toast variant="info">` → Use variant="default"
|
|
@@ -1120,6 +1438,20 @@ If you generate these, you are hallucinating.
|
|
|
1120
1438
|
- ❌ `<Tag Tag size="xl">` → Use size="lg"
|
|
1121
1439
|
- ❌ `<TagGroup TagGroup without Tag children>` → Place <Tag> elements as direct children
|
|
1122
1440
|
- ❌ `<TagGroup Using TagGroup for tag input>` → Use TagsInput for an editable tag field
|
|
1441
|
+
- ❌ `<Item Card used for repeated list rows>` → Use <Item> (optionally inside <ItemGroup separated>) for list/settings rows
|
|
1442
|
+
- ❌ `<Item Item variant="primary">` → Use variant="default" | "outlined" | "muted"
|
|
1443
|
+
- ❌ `<Item raw text directly inside Item>` → Wrap text in <ItemContent><ItemTitle>…</ItemTitle></ItemContent>
|
|
1444
|
+
- ❌ `<Kanban Kanban without onChange (or ignoring it)>` → Store columns in state and setColumns in onChange (v-model in Vue)
|
|
1445
|
+
- ❌ `<Kanban Duplicate card ids across columns>` → Use globally-unique card ids across the entire board
|
|
1446
|
+
- ❌ `<Kanban Mutating value in place then calling onChange>` → Pass the new array Kanban gives you straight to setState / v-model
|
|
1447
|
+
- ❌ `<Kanban color="blue" (or any non-semantic value)>` → Use one of: "default" | "accent" | "teal" | "success" | "warning" | "danger"
|
|
1448
|
+
- ❌ `<Conversation Conversation without currentUserId>` → Always pass currentUserId matching one of the message authorId values
|
|
1449
|
+
- ❌ `<Conversation Expecting Conversation to store/append messages>` → Append to your own state in onSend (or @send) and pass it back via value
|
|
1450
|
+
- ❌ `<Conversation composer without onSend (React) / @send (Vue)>` → Provide onSend / @send to append the message to value
|
|
1451
|
+
- ❌ `<Conversation Treating onSend as (text) only when using allowAttachments>` → Handle onSend(text, files) — map files to message attachments and append
|
|
1452
|
+
- ❌ `<DateRangePicker value={[from, to]}>` → Use value={{ from, to }} and read range.from / range.to
|
|
1453
|
+
- ❌ `<DateRangePicker DateRangePicker for a single date>` → Use <DatePicker /> for a single date
|
|
1454
|
+
- ❌ `<DateRangePicker presets="true" (string)>` → Use the bare prop: presets (or presets={true})
|
|
1123
1455
|
|
|
1124
1456
|
---
|
|
1125
1457
|
|