@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
package/dist/windsurf-rules.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# useVyre Rules for Windsurf
|
|
2
|
-
# Version: 1.
|
|
2
|
+
# Version: 1.2.0
|
|
3
3
|
|
|
4
4
|
# useVyre Design System — AI Context
|
|
5
5
|
# Version: 0.2.0
|
|
@@ -308,7 +308,7 @@ import { Button } from "@usevyre/react"
|
|
|
308
308
|
|
|
309
309
|
### Calendar
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
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.
|
|
312
312
|
|
|
313
313
|
```tsx
|
|
314
314
|
import { Calendar } from "@usevyre/react"
|
|
@@ -317,6 +317,7 @@ import { Calendar } from "@usevyre/react"
|
|
|
317
317
|
// value = Date | null
|
|
318
318
|
// onChange = function
|
|
319
319
|
// disabled = boolean (default: false)
|
|
320
|
+
// defaultMonth = Date
|
|
320
321
|
|
|
321
322
|
// Examples:
|
|
322
323
|
const [date, setDate] = useState(null);
|
|
@@ -324,7 +325,39 @@ const [date, setDate] = useState(null);
|
|
|
324
325
|
```
|
|
325
326
|
|
|
326
327
|
**Common mistakes:**
|
|
327
|
-
- ❌ `
|
|
328
|
+
- ❌ `Calendar for an input field that opens a popover` → Use <DatePicker /> (single date) or <DateRangePicker /> (range)
|
|
329
|
+
- ❌ `value as tuple for mode="single"` → Pass value matching mode; use mode="range" for [start,end]
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
### DatePicker
|
|
334
|
+
|
|
335
|
+
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.
|
|
336
|
+
|
|
337
|
+
```tsx
|
|
338
|
+
import { DatePicker } from "@usevyre/react"
|
|
339
|
+
|
|
340
|
+
// Props:
|
|
341
|
+
// value = Date | [Date, Date] | Date[] | null
|
|
342
|
+
// onChange = function
|
|
343
|
+
// mode = "single" | "range" | "multiple" (default: single)
|
|
344
|
+
// placeholder = string (default: Pick a date)
|
|
345
|
+
// showTime = boolean (default: false)
|
|
346
|
+
// minDate = Date
|
|
347
|
+
// maxDate = Date
|
|
348
|
+
// disabled = function
|
|
349
|
+
// weekStartsOn = "0" | "1" (default: 1)
|
|
350
|
+
// inputClassName = string
|
|
351
|
+
|
|
352
|
+
// Examples:
|
|
353
|
+
const [date, setDate] = useState(null);
|
|
354
|
+
<DatePicker value={date} onChange={setDate} placeholder="Pick a date" />
|
|
355
|
+
<DatePicker value={date} onChange={setDate} showTime />
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Common mistakes:**
|
|
359
|
+
- ❌ `DatePicker mode="range" for { from, to } object` → Use <DateRangePicker /> for the { from, to } object API + presets + dual month
|
|
360
|
+
- ❌ `DatePicker without value/onChange` → Provide value and onChange (e.g. from useState)
|
|
328
361
|
|
|
329
362
|
---
|
|
330
363
|
|
|
@@ -384,6 +417,78 @@ import { Checkbox } from "@usevyre/react"
|
|
|
384
417
|
|
|
385
418
|
---
|
|
386
419
|
|
|
420
|
+
### RadioGroup
|
|
421
|
+
|
|
422
|
+
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.
|
|
423
|
+
|
|
424
|
+
```tsx
|
|
425
|
+
import { RadioGroup, Radio } from "@usevyre/react"
|
|
426
|
+
|
|
427
|
+
// Props:
|
|
428
|
+
// value = string
|
|
429
|
+
// defaultValue = string
|
|
430
|
+
// onChange = function
|
|
431
|
+
// name = string
|
|
432
|
+
// disabled = boolean (default: false)
|
|
433
|
+
// size = "sm" | "md" (default: md)
|
|
434
|
+
// orientation = "vertical" | "horizontal" (default: vertical)
|
|
435
|
+
// options = { value: string; label?: string; description?: string; disabled?: boolean }[]
|
|
436
|
+
|
|
437
|
+
// Examples:
|
|
438
|
+
<RadioGroup
|
|
439
|
+
value={plan}
|
|
440
|
+
onChange={setPlan}
|
|
441
|
+
options={[
|
|
442
|
+
{ value: "free", label: "Free", description: "For hobby projects" },
|
|
443
|
+
{ value: "pro", label: "Pro", description: "For teams" },
|
|
444
|
+
]}
|
|
445
|
+
/>
|
|
446
|
+
<RadioGroup value={plan} onChange={setPlan} orientation="horizontal">
|
|
447
|
+
<Radio value="free" label="Free" />
|
|
448
|
+
<Radio value="pro" label="Pro" />
|
|
449
|
+
</RadioGroup>
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
**Common mistakes:**
|
|
453
|
+
- ❌ `<Radio> used outside a <RadioGroup>` → Always wrap <Radio> in <RadioGroup>
|
|
454
|
+
- ❌ `RadioGroup without value/onChange (React) or v-model (Vue)` → Bind value + onChange (React) or v-model (Vue); or defaultValue for uncontrolled in React
|
|
455
|
+
- ❌ `Using Checkbox for mutually-exclusive choices` → Use RadioGroup + Radio (or options) for one-of-many
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
### RichTextEditor
|
|
460
|
+
|
|
461
|
+
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.
|
|
462
|
+
|
|
463
|
+
```tsx
|
|
464
|
+
import { RichTextEditor } from "@usevyre/react"
|
|
465
|
+
|
|
466
|
+
// Props:
|
|
467
|
+
// value = string
|
|
468
|
+
// onChange = function
|
|
469
|
+
// placeholder = string (default: Write something…)
|
|
470
|
+
// disabled = boolean (default: false)
|
|
471
|
+
// readOnly = boolean (default: false)
|
|
472
|
+
// toolbar = RichTextTool[]
|
|
473
|
+
// minHeight = string (default: 10rem)
|
|
474
|
+
|
|
475
|
+
// Examples:
|
|
476
|
+
const [html, setHtml] = useState("<p>Hello <strong>world</strong></p>");
|
|
477
|
+
<RichTextEditor value={html} onChange={setHtml} placeholder="Write…" />
|
|
478
|
+
<RichTextEditor
|
|
479
|
+
value={html}
|
|
480
|
+
onChange={setHtml}
|
|
481
|
+
toolbar={["bold", "italic", "link"]}
|
|
482
|
+
/>
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
**Common mistakes:**
|
|
486
|
+
- ❌ `RichTextEditor without value/onChange (React) or v-model (Vue)` → Keep the HTML string in state and update it in onChange / v-model
|
|
487
|
+
- ❌ `Rendering value as text or with dangerouslySetInnerHTML elsewhere without sanitising` → Sanitise (e.g. DOMPurify) before re-rendering untrusted RTE output
|
|
488
|
+
- ❌ `toolbar="bold" (string)` → Pass an array, e.g. toolbar={["bold","italic","link"]}
|
|
489
|
+
|
|
490
|
+
---
|
|
491
|
+
|
|
387
492
|
### Command
|
|
388
493
|
|
|
389
494
|
Command palette / search dialog. Use for search-first navigation or quick actions.
|
|
@@ -435,7 +540,7 @@ import { DropdownMenu, DropdownItem, DropdownSeparator, DropdownCheckboxItem, Dr
|
|
|
435
540
|
|
|
436
541
|
### Field
|
|
437
542
|
|
|
438
|
-
Form field wrapper
|
|
543
|
+
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.
|
|
439
544
|
|
|
440
545
|
```tsx
|
|
441
546
|
import { Field, Input, Textarea } from "@usevyre/react"
|
|
@@ -453,10 +558,23 @@ import { Field, Input, Textarea } from "@usevyre/react"
|
|
|
453
558
|
<Field label="Search">
|
|
454
559
|
<Input leftElement={<SearchIcon />} placeholder="Search..." />
|
|
455
560
|
</Field>
|
|
561
|
+
<Field>
|
|
562
|
+
<FieldLabel required htmlFor="email">Email</FieldLabel>
|
|
563
|
+
<Input id="email" type="email" />
|
|
564
|
+
<FieldDescription>We\u2019ll never share it.</FieldDescription>
|
|
565
|
+
<FieldError>{errors.email}</FieldError>
|
|
566
|
+
</Field>
|
|
567
|
+
|
|
568
|
+
// Two controls side by side
|
|
569
|
+
<FieldGroup orientation="horizontal">
|
|
570
|
+
<Field label="First name"><Input /></Field>
|
|
571
|
+
<Field label="Last name"><Input /></Field>
|
|
572
|
+
</FieldGroup>
|
|
456
573
|
```
|
|
457
574
|
|
|
458
575
|
**Common mistakes:**
|
|
459
576
|
- ❌ `Applying state prop directly to Input` → Wrap Input in <Field state="error"> to apply validation styling
|
|
577
|
+
- ❌ `Mixing props label/hint AND FieldLabel/FieldError for the same field` → Pick one: either props-based (label/hint/state) OR composable parts
|
|
460
578
|
|
|
461
579
|
---
|
|
462
580
|
|
|
@@ -468,6 +586,7 @@ Text input field. Wrap in Field for labels and validation. Use leftElement/right
|
|
|
468
586
|
import { Input } from "@usevyre/react"
|
|
469
587
|
|
|
470
588
|
// Props:
|
|
589
|
+
// modelValue = string | number
|
|
471
590
|
// size = "sm" | "md" | "lg" (default: md)
|
|
472
591
|
// leftElement = ReactNode
|
|
473
592
|
// rightElement = ReactNode
|
|
@@ -479,6 +598,7 @@ import { Input } from "@usevyre/react"
|
|
|
479
598
|
**Common mistakes:**
|
|
480
599
|
- ❌ `size="icon"` → Use size="sm" | "md" | "lg"
|
|
481
600
|
- ❌ `type="search" for search UI` → Import Command from @usevyre/react for search palettes
|
|
601
|
+
- ❌ `Vue: binding Input/Textarea value without v-model` → Use v-model on <Input>/<Textarea> in Vue; in React use value + onChange
|
|
482
602
|
|
|
483
603
|
---
|
|
484
604
|
|
|
@@ -674,6 +794,8 @@ import { AppLayout, Sidebar, SidebarHeader, SidebarContent, SidebarSection, Side
|
|
|
674
794
|
|
|
675
795
|
// Props:
|
|
676
796
|
// variant = "default" | "floating" (default: default)
|
|
797
|
+
// SidebarTrigger.icon = ReactNode
|
|
798
|
+
// SidebarTrigger.collapsedIcon = ReactNode
|
|
677
799
|
|
|
678
800
|
// Examples:
|
|
679
801
|
<AppLayout>
|
|
@@ -689,8 +811,18 @@ import { AppLayout, Sidebar, SidebarHeader, SidebarContent, SidebarSection, Side
|
|
|
689
811
|
</Sidebar>
|
|
690
812
|
<main>Page content</main>
|
|
691
813
|
</AppLayout>
|
|
814
|
+
<SidebarTrigger icon={<PanelLeftClose />} collapsedIcon={<PanelLeftOpen />} />
|
|
815
|
+
|
|
816
|
+
// Vue:
|
|
817
|
+
// <SidebarTrigger>
|
|
818
|
+
// <template #icon><PanelLeftClose /></template>
|
|
819
|
+
// <template #collapsed-icon><PanelLeftOpen /></template>
|
|
820
|
+
// </SidebarTrigger>
|
|
692
821
|
```
|
|
693
822
|
|
|
823
|
+
**Common mistakes:**
|
|
824
|
+
- ❌ `Vue: passing icon/collapsedIcon as props on SidebarTrigger` → Use <template #icon> and <template #collapsed-icon>; React uses icon / collapsedIcon props
|
|
825
|
+
|
|
694
826
|
---
|
|
695
827
|
|
|
696
828
|
### Skeleton
|
|
@@ -1066,6 +1198,180 @@ import { TagGroup, Tag } from "@usevyre/react"
|
|
|
1066
1198
|
|
|
1067
1199
|
---
|
|
1068
1200
|
|
|
1201
|
+
### Item
|
|
1202
|
+
|
|
1203
|
+
Layout primitive for list rows, settings rows, and notification rows. Denser than Card — use Item (not Card) for repeated list rows.
|
|
1204
|
+
|
|
1205
|
+
```tsx
|
|
1206
|
+
import { Item, ItemMedia, ItemContent, ItemTitle, ItemDescription, ItemActions, ItemGroup } from "@usevyre/react"
|
|
1207
|
+
|
|
1208
|
+
// Props:
|
|
1209
|
+
// variant = "default" | "outlined" | "muted" | "plain" (default: default)
|
|
1210
|
+
// size = "sm" | "md" | "lg" (default: md)
|
|
1211
|
+
// clickable = boolean (default: false)
|
|
1212
|
+
|
|
1213
|
+
// Examples:
|
|
1214
|
+
<Item>
|
|
1215
|
+
<ItemMedia><BellIcon /></ItemMedia>
|
|
1216
|
+
<ItemContent>
|
|
1217
|
+
<ItemTitle>Notifications</ItemTitle>
|
|
1218
|
+
<ItemDescription>Receive an email when someone mentions you.</ItemDescription>
|
|
1219
|
+
</ItemContent>
|
|
1220
|
+
<ItemActions>
|
|
1221
|
+
<Switch defaultChecked />
|
|
1222
|
+
</ItemActions>
|
|
1223
|
+
</Item>
|
|
1224
|
+
<ItemGroup separated>
|
|
1225
|
+
<Item clickable>
|
|
1226
|
+
<ItemContent><ItemTitle>Profile</ItemTitle></ItemContent>
|
|
1227
|
+
</Item>
|
|
1228
|
+
<Item clickable>
|
|
1229
|
+
<ItemContent><ItemTitle>Billing</ItemTitle></ItemContent>
|
|
1230
|
+
</Item>
|
|
1231
|
+
</ItemGroup>
|
|
1232
|
+
```
|
|
1233
|
+
|
|
1234
|
+
**Common mistakes:**
|
|
1235
|
+
- ❌ `Card used for repeated list rows` → Use <Item> (optionally inside <ItemGroup separated>) for list/settings rows
|
|
1236
|
+
- ❌ `Item variant="primary"` → Use variant="default" | "outlined" | "muted"
|
|
1237
|
+
- ❌ `raw text directly inside Item` → Wrap text in <ItemContent><ItemTitle>…</ItemTitle></ItemContent>
|
|
1238
|
+
|
|
1239
|
+
---
|
|
1240
|
+
|
|
1241
|
+
### Kanban
|
|
1242
|
+
|
|
1243
|
+
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.
|
|
1244
|
+
|
|
1245
|
+
```tsx
|
|
1246
|
+
import { Kanban } from "@usevyre/react"
|
|
1247
|
+
|
|
1248
|
+
// Props:
|
|
1249
|
+
// value = KanbanColumn[]
|
|
1250
|
+
// onChange = function
|
|
1251
|
+
// renderCard = function
|
|
1252
|
+
// onCardClick = function
|
|
1253
|
+
|
|
1254
|
+
// Examples:
|
|
1255
|
+
const [columns, setColumns] = useState([
|
|
1256
|
+
{ id: "todo", title: "To Do", cards: [{ id: "1", title: "Spec API" }] },
|
|
1257
|
+
{ id: "doing", title: "In Progress", cards: [] },
|
|
1258
|
+
{ id: "done", title: "Done", cards: [{ id: "2", title: "Kickoff" }] },
|
|
1259
|
+
]);
|
|
1260
|
+
<Kanban value={columns} onChange={setColumns} />
|
|
1261
|
+
<Kanban
|
|
1262
|
+
value={columns}
|
|
1263
|
+
onChange={setColumns}
|
|
1264
|
+
onCardClick={(card) => openDetail(card.id)}
|
|
1265
|
+
renderCard={(card) => (
|
|
1266
|
+
<><strong>{card.title}</strong><Badge>{card.id}</Badge></>
|
|
1267
|
+
)}
|
|
1268
|
+
/>
|
|
1269
|
+
const [cols, setCols] = useState([
|
|
1270
|
+
{ id: "doing", title: "In Progress", color: "teal", cards: [
|
|
1271
|
+
{ id: "t1", title: "OAuth", assignee: "AK", progress: 60, color: "warning" },
|
|
1272
|
+
]},
|
|
1273
|
+
]);
|
|
1274
|
+
<Kanban
|
|
1275
|
+
value={cols}
|
|
1276
|
+
onChange={setCols}
|
|
1277
|
+
renderCard={(card) => (
|
|
1278
|
+
<><strong>{card.title}</strong><Progress value={card.progress} /></>
|
|
1279
|
+
)}
|
|
1280
|
+
/>
|
|
1281
|
+
```
|
|
1282
|
+
|
|
1283
|
+
**Common mistakes:**
|
|
1284
|
+
- ❌ `Kanban without onChange (or ignoring it)` → Store columns in state and setColumns in onChange (v-model in Vue)
|
|
1285
|
+
- ❌ `Duplicate card ids across columns` → Use globally-unique card ids across the entire board
|
|
1286
|
+
- ❌ `Mutating value in place then calling onChange` → Pass the new array Kanban gives you straight to setState / v-model
|
|
1287
|
+
- ❌ `color="blue" (or any non-semantic value)` → Use one of: "default" | "accent" | "teal" | "success" | "warning" | "danger"
|
|
1288
|
+
|
|
1289
|
+
---
|
|
1290
|
+
|
|
1291
|
+
### Conversation
|
|
1292
|
+
|
|
1293
|
+
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.
|
|
1294
|
+
|
|
1295
|
+
```tsx
|
|
1296
|
+
import { Conversation } from "@usevyre/react"
|
|
1297
|
+
|
|
1298
|
+
// Props:
|
|
1299
|
+
// value = ConversationMessage[]
|
|
1300
|
+
// currentUserId = string
|
|
1301
|
+
// composer = boolean (default: false)
|
|
1302
|
+
// onSend = function
|
|
1303
|
+
// placeholder = string (default: Write a message…)
|
|
1304
|
+
// typing = boolean | string (default: false)
|
|
1305
|
+
// allowAttachments = boolean (default: false)
|
|
1306
|
+
// accept = string
|
|
1307
|
+
// renderMessage = function
|
|
1308
|
+
// renderComposer = function
|
|
1309
|
+
|
|
1310
|
+
// Examples:
|
|
1311
|
+
const [messages, setMessages] = useState([
|
|
1312
|
+
{ id: "1", authorId: "sam", authorName: "Sam", text: "Hey!" },
|
|
1313
|
+
{ id: "2", authorId: "me", text: "Hi \ud83d\udc4b", status: "read" },
|
|
1314
|
+
]);
|
|
1315
|
+
<Conversation
|
|
1316
|
+
value={messages}
|
|
1317
|
+
currentUserId="me"
|
|
1318
|
+
composer
|
|
1319
|
+
onSend={(t) => setMessages((m) => [...m, { id: crypto.randomUUID(), authorId: "me", text: t }])}
|
|
1320
|
+
/>
|
|
1321
|
+
<Conversation
|
|
1322
|
+
value={messages}
|
|
1323
|
+
currentUserId="me"
|
|
1324
|
+
typing="Sam is typing"
|
|
1325
|
+
renderMessage={(m) => <strong>{m.text}</strong>}
|
|
1326
|
+
/>
|
|
1327
|
+
const messages = [
|
|
1328
|
+
{ id: "1", authorId: "sam", authorName: "Sam", text: "Moodboard \ud83d\udc47",
|
|
1329
|
+
attachments: [{ kind: "image", url: "/board.png", name: "board.png" }] },
|
|
1330
|
+
{ id: "2", authorId: "me", text: "Specs:", status: "read",
|
|
1331
|
+
attachments: [{ kind: "file", url: "/spec.pdf", name: "spec.pdf", size: "2.4 MB" }] },
|
|
1332
|
+
];
|
|
1333
|
+
<Conversation value={messages} currentUserId="me" />
|
|
1334
|
+
```
|
|
1335
|
+
|
|
1336
|
+
**Common mistakes:**
|
|
1337
|
+
- ❌ `Conversation without currentUserId` → Always pass currentUserId matching one of the message authorId values
|
|
1338
|
+
- ❌ `Expecting Conversation to store/append messages` → Append to your own state in onSend (or @send) and pass it back via value
|
|
1339
|
+
- ❌ `composer without onSend (React) / @send (Vue)` → Provide onSend / @send to append the message to value
|
|
1340
|
+
- ❌ `Treating onSend as (text) only when using allowAttachments` → Handle onSend(text, files) — map files to message attachments and append
|
|
1341
|
+
|
|
1342
|
+
---
|
|
1343
|
+
|
|
1344
|
+
### DateRangePicker
|
|
1345
|
+
|
|
1346
|
+
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.
|
|
1347
|
+
|
|
1348
|
+
```tsx
|
|
1349
|
+
import { DateRangePicker } from "@usevyre/react"
|
|
1350
|
+
|
|
1351
|
+
// Props:
|
|
1352
|
+
// value = { from: Date | null; to: Date | null } | null
|
|
1353
|
+
// onChange = function
|
|
1354
|
+
// placeholder = string (default: Pick a date range)
|
|
1355
|
+
// numberOfMonths = "1" | "2" (default: 2)
|
|
1356
|
+
// presets = boolean | DateRangePreset[] (default: false)
|
|
1357
|
+
// minDate = Date
|
|
1358
|
+
// maxDate = Date
|
|
1359
|
+
// disabled = function
|
|
1360
|
+
// weekStartsOn = "0" | "1" (default: 1)
|
|
1361
|
+
|
|
1362
|
+
// Examples:
|
|
1363
|
+
const [range, setRange] = useState({ from: null, to: null });
|
|
1364
|
+
<DateRangePicker value={range} onChange={setRange} presets />
|
|
1365
|
+
<DateRangePicker value={range} onChange={setRange} numberOfMonths={1} />
|
|
1366
|
+
```
|
|
1367
|
+
|
|
1368
|
+
**Common mistakes:**
|
|
1369
|
+
- ❌ `value={[from, to]}` → Use value={{ from, to }} and read range.from / range.to
|
|
1370
|
+
- ❌ `DateRangePicker for a single date` → Use <DatePicker /> for a single date
|
|
1371
|
+
- ❌ `presets="true" (string)` → Use the bare prop: presets (or presets={true})
|
|
1372
|
+
|
|
1373
|
+
---
|
|
1374
|
+
|
|
1069
1375
|
## Hallucination Guard — Common AI Mistakes
|
|
1070
1376
|
|
|
1071
1377
|
The following prop values and patterns do NOT exist in useVyre.
|
|
@@ -1085,18 +1391,30 @@ If you generate these, you are hallucinating.
|
|
|
1085
1391
|
- ❌ `<Button color="...">` → Use variant prop instead
|
|
1086
1392
|
- ❌ `<Button icon={...}>` → Use leftIcon={...} or rightIcon={...}
|
|
1087
1393
|
- ❌ `<Button size="icon" without aria-label>` → Add aria-label describing the action
|
|
1088
|
-
- ❌ `<Calendar
|
|
1394
|
+
- ❌ `<Calendar Calendar for an input field that opens a popover>` → Use <DatePicker /> (single date) or <DateRangePicker /> (range)
|
|
1395
|
+
- ❌ `<Calendar value as tuple for mode="single">` → Pass value matching mode; use mode="range" for [start,end]
|
|
1396
|
+
- ❌ `<DatePicker DatePicker mode="range" for { from, to } object>` → Use <DateRangePicker /> for the { from, to } object API + presets + dual month
|
|
1397
|
+
- ❌ `<DatePicker DatePicker without value/onChange>` → Provide value and onChange (e.g. from useState)
|
|
1089
1398
|
- ❌ `<Card variant="primary">` → Use variant="elevated" | "outlined" | "ghost" | "accent"
|
|
1090
1399
|
- ❌ `<Checkbox size="lg">` → Use size="md"
|
|
1400
|
+
- ❌ `<RadioGroup <Radio> used outside a <RadioGroup>>` → Always wrap <Radio> in <RadioGroup>
|
|
1401
|
+
- ❌ `<RadioGroup RadioGroup without value/onChange (React) or v-model (Vue)>` → Bind value + onChange (React) or v-model (Vue); or defaultValue for uncontrolled in React
|
|
1402
|
+
- ❌ `<RadioGroup Using Checkbox for mutually-exclusive choices>` → Use RadioGroup + Radio (or options) for one-of-many
|
|
1403
|
+
- ❌ `<RichTextEditor RichTextEditor without value/onChange (React) or v-model (Vue)>` → Keep the HTML string in state and update it in onChange / v-model
|
|
1404
|
+
- ❌ `<RichTextEditor Rendering value as text or with dangerouslySetInnerHTML elsewhere without sanitising>` → Sanitise (e.g. DOMPurify) before re-rendering untrusted RTE output
|
|
1405
|
+
- ❌ `<RichTextEditor toolbar="bold" (string)>` → Pass an array, e.g. toolbar={["bold","italic","link"]}
|
|
1091
1406
|
- ❌ `<Command Using Input type="search" for search UI>` → Use Command + CommandInput + CommandList + CommandItem
|
|
1092
1407
|
- ❌ `<DropdownMenu DropdownItem variant="primary">` → Use variant="danger" for destructive items only
|
|
1093
1408
|
- ❌ `<Field Applying state prop directly to Input>` → Wrap Input in <Field state="error"> to apply validation styling
|
|
1409
|
+
- ❌ `<Field Mixing props label/hint AND FieldLabel/FieldError for the same field>` → Pick one: either props-based (label/hint/state) OR composable parts
|
|
1094
1410
|
- ❌ `<Input size="icon">` → Use size="sm" | "md" | "lg"
|
|
1095
1411
|
- ❌ `<Input type="search" for search UI>` → Import Command from @usevyre/react for search palettes
|
|
1412
|
+
- ❌ `<Input Vue: binding Input/Textarea value without v-model>` → Use v-model on <Input>/<Textarea> in Vue; in React use value + onChange
|
|
1096
1413
|
- ❌ `<Modal size="xl">` → Use size="lg" or size="full"
|
|
1097
1414
|
- ❌ `<Popover placement="top-center">` → Use placement="top" for centered placement
|
|
1098
1415
|
- ❌ `<Progress value > 100>` → Normalize your value to 0–100 range before passing
|
|
1099
1416
|
- ❌ `<Select Passing strings directly as children>` → Pass options={[{ value: 'a', label: 'Option A' }]}
|
|
1417
|
+
- ❌ `<Sidebar Vue: passing icon/collapsedIcon as props on SidebarTrigger>` → Use <template #icon> and <template #collapsed-icon>; React uses icon / collapsedIcon props
|
|
1100
1418
|
- ❌ `<Toast Rendering <Toast> directly in JSX>` → Use: const { toast } = useToast(); then toast({ title, variant })
|
|
1101
1419
|
- ❌ `<Toast variant="error">` → Use variant="danger"
|
|
1102
1420
|
- ❌ `<Toast variant="info">` → Use variant="default"
|
|
@@ -1117,6 +1435,20 @@ If you generate these, you are hallucinating.
|
|
|
1117
1435
|
- ❌ `<Tag Tag size="xl">` → Use size="lg"
|
|
1118
1436
|
- ❌ `<TagGroup TagGroup without Tag children>` → Place <Tag> elements as direct children
|
|
1119
1437
|
- ❌ `<TagGroup Using TagGroup for tag input>` → Use TagsInput for an editable tag field
|
|
1438
|
+
- ❌ `<Item Card used for repeated list rows>` → Use <Item> (optionally inside <ItemGroup separated>) for list/settings rows
|
|
1439
|
+
- ❌ `<Item Item variant="primary">` → Use variant="default" | "outlined" | "muted"
|
|
1440
|
+
- ❌ `<Item raw text directly inside Item>` → Wrap text in <ItemContent><ItemTitle>…</ItemTitle></ItemContent>
|
|
1441
|
+
- ❌ `<Kanban Kanban without onChange (or ignoring it)>` → Store columns in state and setColumns in onChange (v-model in Vue)
|
|
1442
|
+
- ❌ `<Kanban Duplicate card ids across columns>` → Use globally-unique card ids across the entire board
|
|
1443
|
+
- ❌ `<Kanban Mutating value in place then calling onChange>` → Pass the new array Kanban gives you straight to setState / v-model
|
|
1444
|
+
- ❌ `<Kanban color="blue" (or any non-semantic value)>` → Use one of: "default" | "accent" | "teal" | "success" | "warning" | "danger"
|
|
1445
|
+
- ❌ `<Conversation Conversation without currentUserId>` → Always pass currentUserId matching one of the message authorId values
|
|
1446
|
+
- ❌ `<Conversation Expecting Conversation to store/append messages>` → Append to your own state in onSend (or @send) and pass it back via value
|
|
1447
|
+
- ❌ `<Conversation composer without onSend (React) / @send (Vue)>` → Provide onSend / @send to append the message to value
|
|
1448
|
+
- ❌ `<Conversation Treating onSend as (text) only when using allowAttachments>` → Handle onSend(text, files) — map files to message attachments and append
|
|
1449
|
+
- ❌ `<DateRangePicker value={[from, to]}>` → Use value={{ from, to }} and read range.from / range.to
|
|
1450
|
+
- ❌ `<DateRangePicker DateRangePicker for a single date>` → Use <DatePicker /> for a single date
|
|
1451
|
+
- ❌ `<DateRangePicker presets="true" (string)>` → Use the bare prop: presets (or presets={true})
|
|
1120
1452
|
|
|
1121
1453
|
---
|
|
1122
1454
|
|