@usevyre/ai-context 1.2.2 → 1.4.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 +393 -1
- package/dist/cheat-sheets/box.md +52 -0
- package/dist/cheat-sheets/button.md +2 -0
- package/dist/cheat-sheets/card.md +2 -0
- package/dist/cheat-sheets/carousel.md +50 -0
- package/dist/cheat-sheets/carouselslide.md +22 -0
- package/dist/cheat-sheets/emptystate.md +48 -0
- package/dist/cheat-sheets/form.md +50 -0
- package/dist/cheat-sheets/formfield.md +22 -0
- package/dist/cheat-sheets/grid.md +50 -0
- package/dist/cheat-sheets/griditem.md +24 -0
- package/dist/cheat-sheets/index.md +22 -0
- package/dist/cheat-sheets/input.md +2 -0
- package/dist/cheat-sheets/numberinput.md +41 -0
- package/dist/cheat-sheets/otpinput.md +51 -0
- package/dist/cheat-sheets/stack.md +55 -0
- package/dist/cheat-sheets/stat.md +41 -0
- package/dist/cheat-sheets/statgroup.md +23 -0
- package/dist/cheat-sheets/step.md +8 -0
- package/dist/cheat-sheets/steppanel.md +8 -0
- package/dist/cheat-sheets/stepper.md +59 -0
- package/dist/cheat-sheets/steppernav.md +8 -0
- package/dist/cheat-sheets/timeline.md +40 -0
- package/dist/cheat-sheets/timelineitem.md +28 -0
- package/dist/cheat-sheets/togglegroup.md +55 -0
- package/dist/cheat-sheets/toggleitem.md +29 -0
- package/dist/cheat-sheets/tree.md +48 -0
- package/dist/claude-context.md +770 -1
- package/dist/copilot-instructions.md +770 -1
- package/dist/cursor-rules.md +269 -1
- package/dist/full-context.md +769 -0
- package/dist/index.js +10427 -4763
- package/dist/schema.json +1680 -3
- package/dist/tokens.json +1 -1
- package/dist/tokens.md +1 -1
- package/dist/version-info.json +320 -91
- package/dist/windsurf-rules.md +770 -1
- package/package.json +1 -1
package/dist/cursor-rules.md
CHANGED
|
@@ -4,7 +4,7 @@ alwaysApply: true
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# useVyre Design System — Cursor Rules
|
|
7
|
-
# Version: 1.
|
|
7
|
+
# Version: 1.16.0
|
|
8
8
|
|
|
9
9
|
You are working in a project using the useVyre design system (@usevyre/react).
|
|
10
10
|
Follow these rules strictly when generating any UI code.
|
|
@@ -93,6 +93,7 @@ Never do:
|
|
|
93
93
|
- ❌ color="..." → ✅ Use variant prop instead
|
|
94
94
|
- ❌ icon={...} → ✅ Use leftIcon={...} or rightIcon={...}
|
|
95
95
|
- ❌ size="icon" without aria-label → ✅ Add aria-label describing the action
|
|
96
|
+
- ❌ padding / margin / marginTop (any spacing prop) on a useVyre component → ✅ Space BETWEEN components with <Stack gap> / <Grid gap>; space AROUND a block with <Box padding/margin> wrapping it
|
|
96
97
|
|
|
97
98
|
## Calendar
|
|
98
99
|
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.
|
|
@@ -125,6 +126,7 @@ Valid props:
|
|
|
125
126
|
|
|
126
127
|
Never do:
|
|
127
128
|
- ❌ variant="primary" → ✅ Use variant="elevated" | "outlined" | "ghost" | "accent"
|
|
129
|
+
- ❌ padding / margin / marginTop (any spacing prop) on a useVyre component → ✅ Space BETWEEN components with <Stack gap> / <Grid gap>; space AROUND a block with <Box padding/margin> wrapping it
|
|
128
130
|
|
|
129
131
|
## Checkbox
|
|
130
132
|
Binary toggle for boolean form values.
|
|
@@ -198,6 +200,7 @@ Never do:
|
|
|
198
200
|
- ❌ size="icon" → ✅ Use size="sm" | "md" | "lg"
|
|
199
201
|
- ❌ type="search" for search UI → ✅ Import Command from @usevyre/react for search palettes
|
|
200
202
|
- ❌ Vue: binding Input/Textarea value without v-model → ✅ Use v-model on <Input>/<Textarea> in Vue; in React use value + onChange
|
|
203
|
+
- ❌ padding / margin / marginTop (any spacing prop) on a useVyre component → ✅ Space BETWEEN components with <Stack gap> / <Grid gap>; space AROUND a block with <Box padding/margin> wrapping it
|
|
201
204
|
|
|
202
205
|
## Label
|
|
203
206
|
Accessible form label. Associate with input via htmlFor.
|
|
@@ -445,6 +448,271 @@ Never do:
|
|
|
445
448
|
- ❌ composer without onSend (React) / @send (Vue) → ✅ Provide onSend / @send to append the message to value
|
|
446
449
|
- ❌ Treating onSend as (text) only when using allowAttachments → ✅ Handle onSend(text, files) — map files to message attachments and append
|
|
447
450
|
|
|
451
|
+
## Stack
|
|
452
|
+
Full one-dimensional flex layout primitive. USE INSTEAD OF <div style={{display:'flex'}}>. Covers the whole CSS flexbox surface (direction incl. reverse, wrap, align/justify/alignContent/alignSelf, grow/shrink/basis, per-axis gap) with token-locked spacing. Renders a plain <div> (or `as`).
|
|
453
|
+
Import: `import { Stack } from "@usevyre/react"`
|
|
454
|
+
|
|
455
|
+
Valid props:
|
|
456
|
+
- direction: "row" | "column" | "row-reverse" | "column-reverse" [default: row]
|
|
457
|
+
- gap: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" [default: md]
|
|
458
|
+
- rowGap: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
459
|
+
- columnGap: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
460
|
+
- align: "start" | "center" | "end" | "stretch" | "baseline" [default: stretch]
|
|
461
|
+
- justify: "start" | "center" | "end" | "between" | "around" | "evenly" [default: start]
|
|
462
|
+
- alignContent: "start" | "center" | "end" | "stretch" | "between" | "around" | "evenly"
|
|
463
|
+
- alignSelf: "auto" | "start" | "center" | "end" | "stretch" | "baseline"
|
|
464
|
+
- wrap: "nowrap" | "wrap" | "wrap-reverse" [default: nowrap]
|
|
465
|
+
- basis: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "auto" | "content" | "0"
|
|
466
|
+
- width: "auto" | "full" | "fit" | "screen" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
467
|
+
- height: "auto" | "full" | "fit" | "screen" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
468
|
+
|
|
469
|
+
Never do:
|
|
470
|
+
- ❌ <div style={{ display: 'flex', gap: 12 }}> → ✅ Use <Stack gap="md"> — gap is a token
|
|
471
|
+
- ❌ gap={12} or gap="12px" → ✅ Use gap="none|xs|sm|md|lg|xl|2xl"
|
|
472
|
+
- ❌ direction="vertical" / "horizontal" → ✅ Use direction="row" or "column" (also row-reverse / column-reverse)
|
|
473
|
+
- ❌ style={{ width: "100%" }} / style={{ height: 320 }} → ✅ Use the width / height prop: width="full", width="md", height="screen", etc.
|
|
474
|
+
|
|
475
|
+
## Grid
|
|
476
|
+
Two-dimensional CSS grid primitive. Explicit column/row counts (or auto-fit), auto-flow control, token gap. Pair with GridItem for cell spanning/placement. Renders a plain <div> (or `as`).
|
|
477
|
+
Import: `import { Grid, GridItem } from "@usevyre/react"`
|
|
478
|
+
|
|
479
|
+
Valid props:
|
|
480
|
+
- flow: "row" | "column" | "dense" | "row-dense" | "column-dense"
|
|
481
|
+
- gap: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" [default: md]
|
|
482
|
+
- rowGap: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
483
|
+
- columnGap: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
484
|
+
- align: "start" | "center" | "end" | "stretch" [default: stretch]
|
|
485
|
+
- justify: "start" | "center" | "end" | "stretch"
|
|
486
|
+
- width: "auto" | "full" | "fit" | "screen" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
487
|
+
- height: "auto" | "full" | "fit" | "screen" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
488
|
+
|
|
489
|
+
Never do:
|
|
490
|
+
- ❌ <div style={{ display:'grid', gridTemplateColumns:'1fr 1fr 1fr' }}> → ✅ Use <Grid columns={3} gap="md">
|
|
491
|
+
- ❌ columns="3" (string) → ✅ Use columns={3} or columns="auto-fit"
|
|
492
|
+
- ❌ Nested div with inline grid-column for spanning → ✅ Wrap the cell in <GridItem colSpan={2}>
|
|
493
|
+
- ❌ style={{ width: "100%" }} / style={{ height: 320 }} → ✅ Use the width / height prop: width="full", width="md", height="screen", etc.
|
|
494
|
+
|
|
495
|
+
## GridItem
|
|
496
|
+
Child placement inside <Grid>. Sets column/row span and start lines. Renders a plain <div> (or `as`).
|
|
497
|
+
Import: `import { GridItem } from "@usevyre/react"`
|
|
498
|
+
|
|
499
|
+
Valid props:
|
|
500
|
+
|
|
501
|
+
Never do:
|
|
502
|
+
- ❌ GridItem outside a Grid → ✅ Place <GridItem> directly inside <Grid>
|
|
503
|
+
|
|
504
|
+
## Box
|
|
505
|
+
Spacing-only container plus a controlled escape hatch. Token padding/margin with shorthand, per-axis (X/Y) and per-side (Top/Right/Bottom/Left) overrides. The `style` prop is an explicit anti-pattern escape hatch. Renders a plain <div> (or `as`).
|
|
506
|
+
Import: `import { Box } from "@usevyre/react"`
|
|
507
|
+
|
|
508
|
+
Valid props:
|
|
509
|
+
- padding: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
510
|
+
- paddingX: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
511
|
+
- paddingY: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
512
|
+
- paddingTop: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
513
|
+
- paddingRight: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
514
|
+
- paddingBottom: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
515
|
+
- paddingLeft: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
516
|
+
- margin: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
517
|
+
- marginX: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
518
|
+
- marginY: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
519
|
+
- marginTop: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
520
|
+
- marginRight: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
521
|
+
- marginBottom: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
522
|
+
- marginLeft: "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
523
|
+
- width: "auto" | "full" | "fit" | "screen" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
524
|
+
- height: "auto" | "full" | "fit" | "screen" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl"
|
|
525
|
+
|
|
526
|
+
Never do:
|
|
527
|
+
- ❌ <Box style={{ padding: 16 }}> → ✅ Use <Box padding="md"> (or paddingX/paddingTop/...)
|
|
528
|
+
- ❌ Using Box for flex/grid layout → ✅ Use <Stack> or <Grid>
|
|
529
|
+
- ❌ style={{ width: "100%" }} / style={{ height: 320 }} → ✅ Use the width / height prop: width="full", width="md", height="screen", etc.
|
|
530
|
+
|
|
531
|
+
## Form
|
|
532
|
+
Controlled, data-driven form. Zero dependencies. Validation runs on submit and (after the first submit) on blur. Errors map into the wrapped Field automatically (state=error + hint=message). Compose with FormField, which wires name/value/onChange/onBlur into a single control child.
|
|
533
|
+
Import: `import { Form, FormField } from "@usevyre/react"`
|
|
534
|
+
|
|
535
|
+
Valid props:
|
|
536
|
+
|
|
537
|
+
Never do:
|
|
538
|
+
- ❌ Manually tracking each field's error state with useState → ✅ Wrap controls in <FormField name rules> and let Form manage errors
|
|
539
|
+
- ❌ Adding a validation library (zod/yup) just for basic rules → ✅ Use rules={{ required, minLength, pattern, email, validate }}
|
|
540
|
+
- ❌ <FormField> with multiple control children → ✅ Use one control per FormField (Input/Textarea/Select/etc.)
|
|
541
|
+
- ❌ <FormField> outside a <Form> → ✅ Always nest FormField inside <Form>
|
|
542
|
+
|
|
543
|
+
## FormField
|
|
544
|
+
A single labelled, validated field inside <Form>. Injects name/value/onChange/onBlur into its one control child and wraps it in <Field> (label + error state + hint).
|
|
545
|
+
Import: `import { FormField } from "@usevyre/react"`
|
|
546
|
+
|
|
547
|
+
Valid props:
|
|
548
|
+
|
|
549
|
+
Never do:
|
|
550
|
+
- ❌ Putting onChange/value manually on the control inside FormField → ✅ Let FormField wire the control; only pass static props (type, placeholder)
|
|
551
|
+
|
|
552
|
+
## NumberInput
|
|
553
|
+
Controlled numeric input with −/+ stepper buttons. onChange emits a NUMBER (or null when empty) — NOT an event. Drops straight into <FormField> (Form handles the non-event value). Clamps to min/max on blur; keyboard ArrowUp/Down ±step, Shift+Arrow ±step×10.
|
|
554
|
+
Import: `import { NumberInput } from "@usevyre/react"`
|
|
555
|
+
|
|
556
|
+
Valid props:
|
|
557
|
+
- size: "sm" | "md" | "lg" [default: md]
|
|
558
|
+
|
|
559
|
+
Never do:
|
|
560
|
+
- ❌ onChange={(e) => set(e.target.value)} → ✅ onChange={(value) => set(value)} — value is number | null
|
|
561
|
+
- ❌ Using <Input type="number"> for numeric fields → ✅ Use <NumberInput value onChange min max step />
|
|
562
|
+
- ❌ Parsing the value with Number() in form state → ✅ Store the value directly; it is already number | null
|
|
563
|
+
|
|
564
|
+
## ToggleGroup
|
|
565
|
+
Segmented control. CONTROLLED — the group owns the value. onChange emits the VALUE (not an event). type=single → value:string|null; type=multiple → value:string[]. Provide options[] for simple lists or <ToggleItem value> children for custom content. Distinct from Switch (boolean), ButtonGroup (layout only), RadioGroup (form radios, single only).
|
|
566
|
+
Import: `import { ToggleGroup, ToggleItem } from "@usevyre/react"`
|
|
567
|
+
|
|
568
|
+
Valid props:
|
|
569
|
+
- type: "single" | "multiple" [default: single]
|
|
570
|
+
- size: "sm" | "md" | "lg" [default: md]
|
|
571
|
+
- orientation: "horizontal" | "vertical" [default: horizontal]
|
|
572
|
+
|
|
573
|
+
Never do:
|
|
574
|
+
- ❌ onChange={(e) => set(e.target.value)} → ✅ onChange={(value) => set(value)} — string|null (single) or string[] (multiple)
|
|
575
|
+
- ❌ Using ToggleGroup for a single on/off setting → ✅ Use <Switch> for on/off; ToggleGroup is for choosing among options
|
|
576
|
+
- ❌ type="multiple" with a string value → ✅ value={['a','b']} and onChange receives string[]
|
|
577
|
+
- ❌ <ToggleItem> outside <ToggleGroup> → ✅ Always nest ToggleItem inside ToggleGroup (or use options)
|
|
578
|
+
|
|
579
|
+
## ToggleItem
|
|
580
|
+
A single toggle button inside <ToggleGroup>. Reads selection state from the group via context.
|
|
581
|
+
Import: `import { ToggleItem } from "@usevyre/react"`
|
|
582
|
+
|
|
583
|
+
Valid props:
|
|
584
|
+
|
|
585
|
+
Never do:
|
|
586
|
+
- ❌ Tracking selected state on ToggleItem yourself → ✅ Only set value; the group controls selected state
|
|
587
|
+
|
|
588
|
+
## Stepper
|
|
589
|
+
Multi-step flow indicator + controller (onboarding/checkout/wizard). CONTROLLED by a 0-based index. Compose StepperNav (with Step indicators) and StepPanel (content shown when its index == active). Step/StepPanel take an explicit 0-based `index`. Not Tabs — Stepper is an ORDERED linear flow with completed/current/upcoming states.
|
|
590
|
+
Import: `import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"`
|
|
591
|
+
|
|
592
|
+
Valid props:
|
|
593
|
+
- orientation: "horizontal" | "vertical" [default: horizontal]
|
|
594
|
+
|
|
595
|
+
Never do:
|
|
596
|
+
- ❌ Using Tabs for a wizard / checkout flow → ✅ Use <Stepper> with StepperNav + Step + StepPanel
|
|
597
|
+
- ❌ onChange={(e) => set(e.target.value)} → ✅ onChange={(index) => setStep(index)}
|
|
598
|
+
- ❌ Manually toggling which panel is visible → ✅ Give each StepPanel an index; Stepper shows the active one
|
|
599
|
+
- ❌ <Step> or <StepPanel> outside <Stepper> → ✅ Nest Step inside StepperNav, StepPanel inside Stepper
|
|
600
|
+
|
|
601
|
+
## StepperNav
|
|
602
|
+
Container for Step indicators inside <Stepper>. Lays them out per the Stepper's orientation.
|
|
603
|
+
Import: `import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"`
|
|
604
|
+
|
|
605
|
+
## Step
|
|
606
|
+
One step indicator inside <StepperNav>. State (completed/current/upcoming) derives from the Stepper's active index automatically.
|
|
607
|
+
Import: `import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"`
|
|
608
|
+
|
|
609
|
+
Valid props:
|
|
610
|
+
|
|
611
|
+
## StepPanel
|
|
612
|
+
Content for one step. Renders its children only when its index equals the Stepper's active step.
|
|
613
|
+
Import: `import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"`
|
|
614
|
+
|
|
615
|
+
Valid props:
|
|
616
|
+
|
|
617
|
+
## EmptyState
|
|
618
|
+
Presentational placeholder for empty lists, tables, and search results. No state. title/description/variant/size are props; the optional call-to-action goes in children (React) or the default slot (Vue). variant picks a preset icon (default=box, search=magnifier, error=warning); pass `icon` (or #icon slot) to override.
|
|
619
|
+
Import: `import { EmptyState } from "@usevyre/react"`
|
|
620
|
+
|
|
621
|
+
Valid props:
|
|
622
|
+
- variant: "default" | "search" | "error" [default: default]
|
|
623
|
+
- size: "sm" | "md" | "lg" [default: md]
|
|
624
|
+
|
|
625
|
+
Never do:
|
|
626
|
+
- ❌ Building an empty placeholder with a bare <div> + centered text → ✅ Use <EmptyState title description variant>
|
|
627
|
+
- ❌ action / cta prop → ✅ Put the Button as children of EmptyState
|
|
628
|
+
- ❌ Using EmptyState for a loading state → ✅ Use <Skeleton> while loading; EmptyState when the result set is empty
|
|
629
|
+
|
|
630
|
+
## Stat
|
|
631
|
+
Presentational dashboard KPI. No state. The arrow DIRECTION follows the sign of `delta` (the actual change: -0.4% → down arrow). The arrow/delta COLOR is set explicitly by `trend` (up=success, down=danger, neutral=muted) — so 'churn -0.4%, trend=up' shows a green DOWN arrow. Wrap several in StatGroup for an evenly-split row with dividers.
|
|
632
|
+
Import: `import { Stat, StatGroup } from "@usevyre/react"`
|
|
633
|
+
|
|
634
|
+
Valid props:
|
|
635
|
+
- trend: "up" | "down" | "neutral" [default: neutral]
|
|
636
|
+
- size: "sm" | "md" | "lg" [default: md]
|
|
637
|
+
|
|
638
|
+
Never do:
|
|
639
|
+
- ❌ Assuming trend flips the arrow direction → ✅ delta="-0.4%" always shows a down arrow; trend="up" just colors it green
|
|
640
|
+
- ❌ Building a KPI card with Card + manual layout → ✅ Use <Stat label value delta trend />
|
|
641
|
+
- ❌ Laying out a KPI row with custom flex + dividers → ✅ Wrap the Stats in <StatGroup>
|
|
642
|
+
|
|
643
|
+
## StatGroup
|
|
644
|
+
Evenly-split row of <Stat> with subtle dividers between items. Each Stat flexes to equal width.
|
|
645
|
+
Import: `import { Stat, StatGroup } from "@usevyre/react"`
|
|
646
|
+
|
|
647
|
+
Never do:
|
|
648
|
+
- ❌ Putting non-Stat children in StatGroup → ✅ Only place <Stat> elements inside StatGroup
|
|
649
|
+
|
|
650
|
+
## Timeline
|
|
651
|
+
Vertical activity feed for audit logs and history. Presentational — a status dot per item plus a connector line. Pass `items` for plain logs, or TimelineItem children for rich per-item content. Timeline does NOT reorder; pass items in the order you want shown.
|
|
652
|
+
Import: `import { Timeline, TimelineItem } from "@usevyre/react"`
|
|
653
|
+
|
|
654
|
+
Valid props:
|
|
655
|
+
|
|
656
|
+
Never do:
|
|
657
|
+
- ❌ Building an activity log with a <ul> + manual dots/lines → ✅ Use <Timeline items={[...]} /> or TimelineItem children
|
|
658
|
+
- ❌ Using Stepper for a history/audit feed → ✅ Use <Timeline> for logs/history; Stepper for wizards
|
|
659
|
+
- ❌ Expecting Timeline to sort by time → ✅ Sort the array yourself (newest- or oldest-first)
|
|
660
|
+
|
|
661
|
+
## TimelineItem
|
|
662
|
+
One entry in a <Timeline>. Renders a status-colored dot (or a custom icon), a title, an optional time, and optional rich content.
|
|
663
|
+
Import: `import { Timeline, TimelineItem } from "@usevyre/react"`
|
|
664
|
+
|
|
665
|
+
Valid props:
|
|
666
|
+
- status: "default" | "success" | "warning" | "danger" | "info" [default: default]
|
|
667
|
+
|
|
668
|
+
Never do:
|
|
669
|
+
- ❌ <TimelineItem> outside <Timeline> → ✅ Always nest TimelineItem inside Timeline
|
|
670
|
+
|
|
671
|
+
## Tree
|
|
672
|
+
Hierarchical tree view for file explorers and nested navigation. DATA-DRIVEN and CONTROLLED — pass a nested `data` array; the Tree renders recursively. Single selection. A node WITH children is a folder (click toggles expand); a leaf fires onSelect. Keyboard: ArrowUp/Down move, ArrowRight/Left expand/collapse, Enter/Space select.
|
|
673
|
+
Import: `import { Tree } from "@usevyre/react"`
|
|
674
|
+
|
|
675
|
+
Valid props:
|
|
676
|
+
|
|
677
|
+
Never do:
|
|
678
|
+
- ❌ Rendering a nested <ul> tree by hand with manual expand state → ✅ Pass a nested `data` array to <Tree> and control expandedIds/selectedId
|
|
679
|
+
- ❌ onSelect={(e) => ...} → ✅ onSelect={(id) => setSelected(id)}
|
|
680
|
+
- ❌ Mutating the data array to expand/collapse → ✅ Track expandedIds in state (or use defaultExpandedIds)
|
|
681
|
+
- ❌ Using DropdownMenu submenus for a file tree → ✅ Use <Tree> for file explorers / nested nav
|
|
682
|
+
|
|
683
|
+
## OTPInput
|
|
684
|
+
Segmented one-time-code input for verification / 2FA. CONTROLLED. onChange emits the STRING value (not an event), and onComplete fires once when every slot is filled. Paste-aware (pasting a full code fills all slots), auto-advance on input, backspace moves to the previous slot, arrow keys navigate. Drops straight into <FormField>.
|
|
685
|
+
Import: `import { OTPInput } from "@usevyre/react"`
|
|
686
|
+
|
|
687
|
+
Valid props:
|
|
688
|
+
- type: "numeric" | "alphanumeric" [default: numeric]
|
|
689
|
+
- size: "sm" | "md" | "lg" [default: md]
|
|
690
|
+
|
|
691
|
+
Never do:
|
|
692
|
+
- ❌ onChange={(e) => set(e.target.value)} → ✅ onChange={(value) => setCode(value)}
|
|
693
|
+
- ❌ Six separate <Input> boxes wired by hand → ✅ Use <OTPInput length={6} value onChange />
|
|
694
|
+
- ❌ Reading completion by comparing length yourself → ✅ Use onComplete={(code) => verify(code)}
|
|
695
|
+
- ❌ type="password" to hide digits → ✅ Use mask (type stays numeric/alphanumeric)
|
|
696
|
+
|
|
697
|
+
## Carousel
|
|
698
|
+
Accessible content slider for galleries, onboarding, and testimonials. CONTROLLED by a 0-based slide index. Compose CarouselSlide children (slide order = index). Snap scrolling, clickable dot indicators, prev/next arrows, ArrowLeft/Right keyboard, optional loop and autoPlay (autoplay pauses on hover/focus). onChange emits the index (not an event).
|
|
699
|
+
Import: `import { Carousel, CarouselSlide } from "@usevyre/react"`
|
|
700
|
+
|
|
701
|
+
Valid props:
|
|
702
|
+
|
|
703
|
+
Never do:
|
|
704
|
+
- ❌ onChange={(e) => set(e.target.value)} → ✅ onChange={(index) => setIndex(index)}
|
|
705
|
+
- ❌ Putting raw elements directly in Carousel → ✅ Wrap each slide in <CarouselSlide>
|
|
706
|
+
- ❌ Building a slider with manual scroll + dot state → ✅ Use <Carousel> with CarouselSlide children
|
|
707
|
+
- ❌ autoPlay without considering reduced motion / pausing → ✅ Carousel already pauses on hover/focus; keep interval reasonable or omit autoPlay
|
|
708
|
+
|
|
709
|
+
## CarouselSlide
|
|
710
|
+
One slide inside <Carousel>. Holds arbitrary content (image, Card, testimonial). Slide order determines its index.
|
|
711
|
+
Import: `import { Carousel, CarouselSlide } from "@usevyre/react"`
|
|
712
|
+
|
|
713
|
+
Never do:
|
|
714
|
+
- ❌ <CarouselSlide> outside <Carousel> → ✅ Always nest CarouselSlide inside Carousel
|
|
715
|
+
|
|
448
716
|
## DateRangePicker
|
|
449
717
|
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.
|
|
450
718
|
Import: `import { DateRangePicker } from "@usevyre/react"`
|