@usevyre/ai-context 1.3.0 → 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.
@@ -4,7 +4,7 @@ alwaysApply: true
4
4
  ---
5
5
 
6
6
  # useVyre Design System — Cursor Rules
7
- # Version: 1.6.0
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.
@@ -528,6 +528,191 @@ Never do:
528
528
  - ❌ Using Box for flex/grid layout → ✅ Use <Stack> or <Grid>
529
529
  - ❌ style={{ width: "100%" }} / style={{ height: 320 }} → ✅ Use the width / height prop: width="full", width="md", height="screen", etc.
530
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
+
531
716
  ## DateRangePicker
532
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.
533
718
  Import: `import { DateRangePicker } from "@usevyre/react"`