@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.
@@ -1,5 +1,5 @@
1
1
  # useVyre Rules for Windsurf
2
- # Version: 1.6.0
2
+ # Version: 1.16.0
3
3
 
4
4
  # useVyre Design System — AI Context
5
5
  # Version: 0.2.0
@@ -1534,6 +1534,565 @@ import { Box } from "@usevyre/react"
1534
1534
 
1535
1535
  ---
1536
1536
 
1537
+ ### Form
1538
+
1539
+ 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.
1540
+
1541
+ ```tsx
1542
+ import { Form, FormField } from "@usevyre/react"
1543
+
1544
+ // Props:
1545
+ // values = Record<string, any>
1546
+ // defaultValues = Record<string, any>
1547
+ // onChange = function
1548
+ // onSubmit = function
1549
+ // onInvalid = function
1550
+
1551
+ // Examples:
1552
+ const [values, setValues] = useState({ email: "", password: "" });
1553
+
1554
+ <Form values={values} onChange={setValues} onSubmit={(v) => signIn(v)}>
1555
+ <FormField name="email" label="Email" rules={{ required: true, email: true }}>
1556
+ <Input type="email" />
1557
+ </FormField>
1558
+ <FormField name="password" label="Password" rules={{ required: true, minLength: 8 }}>
1559
+ <Input type="password" />
1560
+ </FormField>
1561
+ <Button type="submit" variant="primary">Sign in</Button>
1562
+ </Form>
1563
+ <FormField
1564
+ name="confirm"
1565
+ label="Confirm password"
1566
+ rules={{
1567
+ required: true,
1568
+ validate: (v, all) => v === all.password ? null : "Passwords do not match",
1569
+ }}
1570
+ >
1571
+ <Input type="password" />
1572
+ </FormField>
1573
+ ```
1574
+
1575
+ **Common mistakes:**
1576
+ - ❌ `Manually tracking each field's error state with useState` → Wrap controls in <FormField name rules> and let Form manage errors
1577
+ - ❌ `Adding a validation library (zod/yup) just for basic rules` → Use rules={{ required, minLength, pattern, email, validate }}
1578
+ - ❌ `<FormField> with multiple control children` → Use one control per FormField (Input/Textarea/Select/etc.)
1579
+ - ❌ `<FormField> outside a <Form>` → Always nest FormField inside <Form>
1580
+
1581
+ ---
1582
+
1583
+ ### FormField
1584
+
1585
+ 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).
1586
+
1587
+ ```tsx
1588
+ import { FormField } from "@usevyre/react"
1589
+
1590
+ // Props:
1591
+ // name = string
1592
+ // label = string
1593
+ // hint = string
1594
+ // rules = object
1595
+
1596
+ // Examples:
1597
+ <FormField name="bio" label="Bio" hint="Max 200 characters" rules={{ maxLength: 200 }}>
1598
+ <Textarea />
1599
+ </FormField>
1600
+ ```
1601
+
1602
+ **Common mistakes:**
1603
+ - ❌ `Putting onChange/value manually on the control inside FormField` → Let FormField wire the control; only pass static props (type, placeholder)
1604
+
1605
+ ---
1606
+
1607
+ ### NumberInput
1608
+
1609
+ 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.
1610
+
1611
+ ```tsx
1612
+ import { NumberInput } from "@usevyre/react"
1613
+
1614
+ // Props:
1615
+ // value = number | null
1616
+ // defaultValue = number | null (default: null)
1617
+ // onChange = function
1618
+ // min = number
1619
+ // max = number
1620
+ // step = number (default: 1)
1621
+ // precision = number
1622
+ // size = "sm" | "md" | "lg" (default: md)
1623
+ // disabled = boolean (default: false)
1624
+ // readOnly = boolean (default: false)
1625
+
1626
+ // Examples:
1627
+ const [qty, setQty] = useState<number | null>(1);
1628
+
1629
+ <NumberInput value={qty} onChange={setQty} min={1} max={99} />
1630
+ <FormField name="age" label="Age" rules={{ required: true, min: 18 }}>
1631
+ <NumberInput min={0} max={120} />
1632
+ </FormField>
1633
+ ```
1634
+
1635
+ **Common mistakes:**
1636
+ - ❌ `onChange={(e) => set(e.target.value)}` → onChange={(value) => set(value)} — value is number | null
1637
+ - ❌ `Using <Input type="number"> for numeric fields` → Use <NumberInput value onChange min max step />
1638
+ - ❌ `Parsing the value with Number() in form state` → Store the value directly; it is already number | null
1639
+
1640
+ ---
1641
+
1642
+ ### ToggleGroup
1643
+
1644
+ 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).
1645
+
1646
+ ```tsx
1647
+ import { ToggleGroup, ToggleItem } from "@usevyre/react"
1648
+
1649
+ // Props:
1650
+ // type = "single" | "multiple" (default: single)
1651
+ // value = string | null | string[]
1652
+ // onChange = function
1653
+ // options = array
1654
+ // size = "sm" | "md" | "lg" (default: md)
1655
+ // orientation = "horizontal" | "vertical" (default: horizontal)
1656
+ // disabled = boolean (default: false)
1657
+
1658
+ // Examples:
1659
+ const [view, setView] = useState<string | null>("grid");
1660
+
1661
+ <ToggleGroup
1662
+ value={view}
1663
+ onChange={setView}
1664
+ options={[
1665
+ { value: "grid", label: "Grid" },
1666
+ { value: "list", label: "List" },
1667
+ ]}
1668
+ />
1669
+ const [fmt, setFmt] = useState<string[]>(["bold"]);
1670
+
1671
+ <ToggleGroup type="multiple" value={fmt} onChange={setFmt}>
1672
+ <ToggleItem value="bold">B</ToggleItem>
1673
+ <ToggleItem value="italic">I</ToggleItem>
1674
+ <ToggleItem value="underline">U</ToggleItem>
1675
+ </ToggleGroup>
1676
+ ```
1677
+
1678
+ **Common mistakes:**
1679
+ - ❌ `onChange={(e) => set(e.target.value)}` → onChange={(value) => set(value)} — string|null (single) or string[] (multiple)
1680
+ - ❌ `Using ToggleGroup for a single on/off setting` → Use <Switch> for on/off; ToggleGroup is for choosing among options
1681
+ - ❌ `type="multiple" with a string value` → value={['a','b']} and onChange receives string[]
1682
+ - ❌ `<ToggleItem> outside <ToggleGroup>` → Always nest ToggleItem inside ToggleGroup (or use options)
1683
+
1684
+ ---
1685
+
1686
+ ### ToggleItem
1687
+
1688
+ A single toggle button inside <ToggleGroup>. Reads selection state from the group via context.
1689
+
1690
+ ```tsx
1691
+ import { ToggleItem } from "@usevyre/react"
1692
+
1693
+ // Props:
1694
+ // value = string
1695
+ // icon = ReactNode
1696
+ // disabled = boolean (default: false)
1697
+
1698
+ // Examples:
1699
+ <ToggleGroup value={v} onChange={setV}>
1700
+ <ToggleItem value="left">Left</ToggleItem>
1701
+ <ToggleItem value="center">Center</ToggleItem>
1702
+ </ToggleGroup>
1703
+ ```
1704
+
1705
+ **Common mistakes:**
1706
+ - ❌ `Tracking selected state on ToggleItem yourself` → Only set value; the group controls selected state
1707
+
1708
+ ---
1709
+
1710
+ ### Stepper
1711
+
1712
+ 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.
1713
+
1714
+ ```tsx
1715
+ import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"
1716
+
1717
+ // Props:
1718
+ // value = number
1719
+ // defaultValue = number (default: 0)
1720
+ // onChange = function
1721
+ // orientation = "horizontal" | "vertical" (default: horizontal)
1722
+ // clickable = boolean (default: false)
1723
+
1724
+ // Examples:
1725
+ const [step, setStep] = useState(0);
1726
+
1727
+ <Stepper value={step} onChange={setStep}>
1728
+ <StepperNav>
1729
+ <Step index={0} label="Account" />
1730
+ <Step index={1} label="Profile" />
1731
+ <Step index={2} label="Done" />
1732
+ </StepperNav>
1733
+ <StepPanel index={0}><AccountForm /></StepPanel>
1734
+ <StepPanel index={1}><ProfileForm /></StepPanel>
1735
+ <StepPanel index={2}><Summary /></StepPanel>
1736
+ <Stack direction="row" gap="sm" justify="between">
1737
+ <Button onClick={() => setStep((s) => s - 1)} disabled={step === 0}>Back</Button>
1738
+ <Button variant="primary" onClick={() => setStep((s) => s + 1)}>Next</Button>
1739
+ </Stack>
1740
+ </Stepper>
1741
+ <Stepper orientation="vertical" defaultValue={1}>
1742
+ <StepperNav>
1743
+ <Step index={0} label="Cart" description="2 items" />
1744
+ <Step index={1} label="Shipping" description="Enter address" />
1745
+ <Step index={2} label="Payment" />
1746
+ </StepperNav>
1747
+ </Stepper>
1748
+ ```
1749
+
1750
+ **Common mistakes:**
1751
+ - ❌ `Using Tabs for a wizard / checkout flow` → Use <Stepper> with StepperNav + Step + StepPanel
1752
+ - ❌ `onChange={(e) => set(e.target.value)}` → onChange={(index) => setStep(index)}
1753
+ - ❌ `Manually toggling which panel is visible` → Give each StepPanel an index; Stepper shows the active one
1754
+ - ❌ `<Step> or <StepPanel> outside <Stepper>` → Nest Step inside StepperNav, StepPanel inside Stepper
1755
+
1756
+ ---
1757
+
1758
+ ### StepperNav
1759
+
1760
+ Container for Step indicators inside <Stepper>. Lays them out per the Stepper's orientation.
1761
+
1762
+ ```tsx
1763
+ import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"
1764
+
1765
+ ```
1766
+
1767
+ ---
1768
+
1769
+ ### Step
1770
+
1771
+ One step indicator inside <StepperNav>. State (completed/current/upcoming) derives from the Stepper's active index automatically.
1772
+
1773
+ ```tsx
1774
+ import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"
1775
+
1776
+ // Props:
1777
+ // index = number
1778
+ // label = ReactNode
1779
+ // description = ReactNode
1780
+ // icon = ReactNode
1781
+
1782
+ ```
1783
+
1784
+ ---
1785
+
1786
+ ### StepPanel
1787
+
1788
+ Content for one step. Renders its children only when its index equals the Stepper's active step.
1789
+
1790
+ ```tsx
1791
+ import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"
1792
+
1793
+ // Props:
1794
+ // index = number
1795
+
1796
+ ```
1797
+
1798
+ ---
1799
+
1800
+ ### EmptyState
1801
+
1802
+ 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.
1803
+
1804
+ ```tsx
1805
+ import { EmptyState } from "@usevyre/react"
1806
+
1807
+ // Props:
1808
+ // title = string
1809
+ // description = string
1810
+ // variant = "default" | "search" | "error" (default: default)
1811
+ // icon = ReactNode
1812
+ // size = "sm" | "md" | "lg" (default: md)
1813
+ // children = ReactNode
1814
+
1815
+ // Examples:
1816
+ <EmptyState
1817
+ variant="search"
1818
+ title="No results"
1819
+ description="Try a different search term."
1820
+ >
1821
+ <Button variant="secondary" onClick={reset}>Clear filters</Button>
1822
+ </EmptyState>
1823
+ <EmptyState
1824
+ size="lg"
1825
+ title="No projects yet"
1826
+ description="Create your first project to get started."
1827
+ >
1828
+ <Button variant="primary">New project</Button>
1829
+ </EmptyState>
1830
+ ```
1831
+
1832
+ **Common mistakes:**
1833
+ - ❌ `Building an empty placeholder with a bare <div> + centered text` → Use <EmptyState title description variant>
1834
+ - ❌ `action / cta prop` → Put the Button as children of EmptyState
1835
+ - ❌ `Using EmptyState for a loading state` → Use <Skeleton> while loading; EmptyState when the result set is empty
1836
+
1837
+ ---
1838
+
1839
+ ### Stat
1840
+
1841
+ 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.
1842
+
1843
+ ```tsx
1844
+ import { Stat, StatGroup } from "@usevyre/react"
1845
+
1846
+ // Props:
1847
+ // label = string
1848
+ // value = string | number
1849
+ // delta = string | number
1850
+ // trend = "up" | "down" | "neutral" (default: neutral)
1851
+ // deltaLabel = string
1852
+ // icon = ReactNode
1853
+ // size = "sm" | "md" | "lg" (default: md)
1854
+
1855
+ // Examples:
1856
+ <StatGroup>
1857
+ <Stat label="Revenue" value="$48.2k" delta="+12%" trend="up" deltaLabel="vs last month" />
1858
+ <Stat label="Churn" value="2.1%" delta="-0.4%" trend="up" deltaLabel="lower is better" />
1859
+ <Stat label="Orders" value="1,204" delta="0%" trend="neutral" />
1860
+ </StatGroup>
1861
+ <Stat label="Active users" value="12,840" delta="+3.2%" trend="up"
1862
+ icon={<UsersIcon />} size="lg" />
1863
+ ```
1864
+
1865
+ **Common mistakes:**
1866
+ - ❌ `Assuming trend flips the arrow direction` → delta="-0.4%" always shows a down arrow; trend="up" just colors it green
1867
+ - ❌ `Building a KPI card with Card + manual layout` → Use <Stat label value delta trend />
1868
+ - ❌ `Laying out a KPI row with custom flex + dividers` → Wrap the Stats in <StatGroup>
1869
+
1870
+ ---
1871
+
1872
+ ### StatGroup
1873
+
1874
+ Evenly-split row of <Stat> with subtle dividers between items. Each Stat flexes to equal width.
1875
+
1876
+ ```tsx
1877
+ import { Stat, StatGroup } from "@usevyre/react"
1878
+
1879
+ // Examples:
1880
+ <StatGroup>
1881
+ <Stat label="MRR" value="$9.6k" delta="+5%" trend="up" />
1882
+ <Stat label="Refunds" value="32" delta="+8" trend="down" />
1883
+ </StatGroup>
1884
+ ```
1885
+
1886
+ **Common mistakes:**
1887
+ - ❌ `Putting non-Stat children in StatGroup` → Only place <Stat> elements inside StatGroup
1888
+
1889
+ ---
1890
+
1891
+ ### Timeline
1892
+
1893
+ 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.
1894
+
1895
+ ```tsx
1896
+ import { Timeline, TimelineItem } from "@usevyre/react"
1897
+
1898
+ // Props:
1899
+ // items = array
1900
+ // children = ReactNode
1901
+
1902
+ // Examples:
1903
+ <Timeline
1904
+ items={[
1905
+ { title: "Deployed v2.1", time: "2m ago", status: "success" },
1906
+ { title: "Build started", time: "5m ago", status: "info" },
1907
+ { title: "Push to main", time: "6m ago" },
1908
+ ]}
1909
+ />
1910
+ <Timeline>
1911
+ <TimelineItem title="Invoice paid" time="Apr 2" status="success">
1912
+ <Text size="sm">$1,200 — <a href="#">view receipt</a></Text>
1913
+ </TimelineItem>
1914
+ <TimelineItem title="Invoice sent" time="Mar 28" status="info" />
1915
+ </Timeline>
1916
+ ```
1917
+
1918
+ **Common mistakes:**
1919
+ - ❌ `Building an activity log with a <ul> + manual dots/lines` → Use <Timeline items={[...]} /> or TimelineItem children
1920
+ - ❌ `Using Stepper for a history/audit feed` → Use <Timeline> for logs/history; Stepper for wizards
1921
+ - ❌ `Expecting Timeline to sort by time` → Sort the array yourself (newest- or oldest-first)
1922
+
1923
+ ---
1924
+
1925
+ ### TimelineItem
1926
+
1927
+ One entry in a <Timeline>. Renders a status-colored dot (or a custom icon), a title, an optional time, and optional rich content.
1928
+
1929
+ ```tsx
1930
+ import { Timeline, TimelineItem } from "@usevyre/react"
1931
+
1932
+ // Props:
1933
+ // title = ReactNode
1934
+ // time = ReactNode
1935
+ // status = "default" | "success" | "warning" | "danger" | "info" (default: default)
1936
+ // icon = ReactNode
1937
+ // children = ReactNode
1938
+
1939
+ // Examples:
1940
+ <TimelineItem title="Comment added" time="1h ago" status="default">
1941
+ <Text size="sm">“Looks good to me 👍”</Text>
1942
+ </TimelineItem>
1943
+ ```
1944
+
1945
+ **Common mistakes:**
1946
+ - ❌ `<TimelineItem> outside <Timeline>` → Always nest TimelineItem inside Timeline
1947
+
1948
+ ---
1949
+
1950
+ ### Tree
1951
+
1952
+ 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.
1953
+
1954
+ ```tsx
1955
+ import { Tree } from "@usevyre/react"
1956
+
1957
+ // Props:
1958
+ // data = TreeNode[]
1959
+ // expandedIds = string[]
1960
+ // defaultExpandedIds = string[] (default: [])
1961
+ // onExpandedChange = function
1962
+ // selectedId = string | null
1963
+ // defaultSelectedId = string | null (default: null)
1964
+ // onSelect = function
1965
+
1966
+ // Examples:
1967
+ const [sel, setSel] = useState<string | null>("src/a.ts");
1968
+
1969
+ <Tree
1970
+ data={[
1971
+ { id: "src", label: "src", children: [
1972
+ { id: "src/a.ts", label: "a.ts" },
1973
+ { id: "src/b", label: "b", children: [
1974
+ { id: "src/b/c.ts", label: "c.ts" },
1975
+ ]},
1976
+ ]},
1977
+ { id: "README.md", label: "README.md" },
1978
+ ]}
1979
+ selectedId={sel}
1980
+ onSelect={setSel}
1981
+ defaultExpandedIds={["src"]}
1982
+ />
1983
+ const [open, setOpen] = useState<string[]>(["root"]);
1984
+
1985
+ <Tree data={tree} expandedIds={open} onExpandedChange={setOpen} />
1986
+ ```
1987
+
1988
+ **Common mistakes:**
1989
+ - ❌ `Rendering a nested <ul> tree by hand with manual expand state` → Pass a nested `data` array to <Tree> and control expandedIds/selectedId
1990
+ - ❌ `onSelect={(e) => ...}` → onSelect={(id) => setSelected(id)}
1991
+ - ❌ `Mutating the data array to expand/collapse` → Track expandedIds in state (or use defaultExpandedIds)
1992
+ - ❌ `Using DropdownMenu submenus for a file tree` → Use <Tree> for file explorers / nested nav
1993
+
1994
+ ---
1995
+
1996
+ ### OTPInput
1997
+
1998
+ 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>.
1999
+
2000
+ ```tsx
2001
+ import { OTPInput } from "@usevyre/react"
2002
+
2003
+ // Props:
2004
+ // value = string
2005
+ // defaultValue = string (default: "")
2006
+ // onChange = function
2007
+ // onComplete = function
2008
+ // length = number (default: 6)
2009
+ // type = "numeric" | "alphanumeric" (default: numeric)
2010
+ // mask = boolean (default: false)
2011
+ // size = "sm" | "md" | "lg" (default: md)
2012
+ // disabled = boolean (default: false)
2013
+ // autoFocus = boolean (default: false)
2014
+
2015
+ // Examples:
2016
+ const [code, setCode] = useState("");
2017
+
2018
+ <OTPInput
2019
+ value={code}
2020
+ onChange={setCode}
2021
+ onComplete={(c) => verify(c)}
2022
+ autoFocus
2023
+ />
2024
+ <FormField name="otp" label="Verification code"
2025
+ rules={{ required: true, minLength: 6 }}>
2026
+ <OTPInput length={6} />
2027
+ </FormField>
2028
+ ```
2029
+
2030
+ **Common mistakes:**
2031
+ - ❌ `onChange={(e) => set(e.target.value)}` → onChange={(value) => setCode(value)}
2032
+ - ❌ `Six separate <Input> boxes wired by hand` → Use <OTPInput length={6} value onChange />
2033
+ - ❌ `Reading completion by comparing length yourself` → Use onComplete={(code) => verify(code)}
2034
+ - ❌ `type="password" to hide digits` → Use mask (type stays numeric/alphanumeric)
2035
+
2036
+ ---
2037
+
2038
+ ### Carousel
2039
+
2040
+ 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).
2041
+
2042
+ ```tsx
2043
+ import { Carousel, CarouselSlide } from "@usevyre/react"
2044
+
2045
+ // Props:
2046
+ // value = number
2047
+ // defaultValue = number (default: 0)
2048
+ // onChange = function
2049
+ // loop = boolean (default: false)
2050
+ // autoPlay = boolean (default: false)
2051
+ // interval = number (default: 5000)
2052
+ // showArrows = boolean (default: true)
2053
+ // showIndicators = boolean (default: true)
2054
+
2055
+ // Examples:
2056
+ const [i, setI] = useState(0);
2057
+
2058
+ <Carousel value={i} onChange={setI} loop>
2059
+ <CarouselSlide><img src="/a.jpg" alt="A" /></CarouselSlide>
2060
+ <CarouselSlide><img src="/b.jpg" alt="B" /></CarouselSlide>
2061
+ <CarouselSlide><img src="/c.jpg" alt="C" /></CarouselSlide>
2062
+ </Carousel>
2063
+ <Carousel autoPlay interval={4000} showArrows={false}>
2064
+ <CarouselSlide><Welcome /></CarouselSlide>
2065
+ <CarouselSlide><Features /></CarouselSlide>
2066
+ <CarouselSlide><GetStarted /></CarouselSlide>
2067
+ </Carousel>
2068
+ ```
2069
+
2070
+ **Common mistakes:**
2071
+ - ❌ `onChange={(e) => set(e.target.value)}` → onChange={(index) => setIndex(index)}
2072
+ - ❌ `Putting raw elements directly in Carousel` → Wrap each slide in <CarouselSlide>
2073
+ - ❌ `Building a slider with manual scroll + dot state` → Use <Carousel> with CarouselSlide children
2074
+ - ❌ `autoPlay without considering reduced motion / pausing` → Carousel already pauses on hover/focus; keep interval reasonable or omit autoPlay
2075
+
2076
+ ---
2077
+
2078
+ ### CarouselSlide
2079
+
2080
+ One slide inside <Carousel>. Holds arbitrary content (image, Card, testimonial). Slide order determines its index.
2081
+
2082
+ ```tsx
2083
+ import { Carousel, CarouselSlide } from "@usevyre/react"
2084
+
2085
+ // Examples:
2086
+ <CarouselSlide>
2087
+ <Card><CardBody>“Best tool ever.” — Ada</CardBody></Card>
2088
+ </CarouselSlide>
2089
+ ```
2090
+
2091
+ **Common mistakes:**
2092
+ - ❌ `<CarouselSlide> outside <Carousel>` → Always nest CarouselSlide inside Carousel
2093
+
2094
+ ---
2095
+
1537
2096
  ### DateRangePicker
1538
2097
 
1539
2098
  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.
@@ -1657,6 +2216,47 @@ If you generate these, you are hallucinating.
1657
2216
  - ❌ `<Box <Box style={{ padding: 16 }}>>` → Use <Box padding="md"> (or paddingX/paddingTop/...)
1658
2217
  - ❌ `<Box Using Box for flex/grid layout>` → Use <Stack> or <Grid>
1659
2218
  - ❌ `<Box style={{ width: "100%" }} / style={{ height: 320 }}>` → Use the width / height prop: width="full", width="md", height="screen", etc.
2219
+ - ❌ `<Form Manually tracking each field's error state with useState>` → Wrap controls in <FormField name rules> and let Form manage errors
2220
+ - ❌ `<Form Adding a validation library (zod/yup) just for basic rules>` → Use rules={{ required, minLength, pattern, email, validate }}
2221
+ - ❌ `<Form <FormField> with multiple control children>` → Use one control per FormField (Input/Textarea/Select/etc.)
2222
+ - ❌ `<Form <FormField> outside a <Form>>` → Always nest FormField inside <Form>
2223
+ - ❌ `<FormField Putting onChange/value manually on the control inside FormField>` → Let FormField wire the control; only pass static props (type, placeholder)
2224
+ - ❌ `<NumberInput onChange={(e) => set(e.target.value)}>` → onChange={(value) => set(value)} — value is number | null
2225
+ - ❌ `<NumberInput Using <Input type="number"> for numeric fields>` → Use <NumberInput value onChange min max step />
2226
+ - ❌ `<NumberInput Parsing the value with Number() in form state>` → Store the value directly; it is already number | null
2227
+ - ❌ `<ToggleGroup onChange={(e) => set(e.target.value)}>` → onChange={(value) => set(value)} — string|null (single) or string[] (multiple)
2228
+ - ❌ `<ToggleGroup Using ToggleGroup for a single on/off setting>` → Use <Switch> for on/off; ToggleGroup is for choosing among options
2229
+ - ❌ `<ToggleGroup type="multiple" with a string value>` → value={['a','b']} and onChange receives string[]
2230
+ - ❌ `<ToggleGroup <ToggleItem> outside <ToggleGroup>>` → Always nest ToggleItem inside ToggleGroup (or use options)
2231
+ - ❌ `<ToggleItem Tracking selected state on ToggleItem yourself>` → Only set value; the group controls selected state
2232
+ - ❌ `<Stepper Using Tabs for a wizard / checkout flow>` → Use <Stepper> with StepperNav + Step + StepPanel
2233
+ - ❌ `<Stepper onChange={(e) => set(e.target.value)}>` → onChange={(index) => setStep(index)}
2234
+ - ❌ `<Stepper Manually toggling which panel is visible>` → Give each StepPanel an index; Stepper shows the active one
2235
+ - ❌ `<Stepper <Step> or <StepPanel> outside <Stepper>>` → Nest Step inside StepperNav, StepPanel inside Stepper
2236
+ - ❌ `<EmptyState Building an empty placeholder with a bare <div> + centered text>` → Use <EmptyState title description variant>
2237
+ - ❌ `<EmptyState action / cta prop>` → Put the Button as children of EmptyState
2238
+ - ❌ `<EmptyState Using EmptyState for a loading state>` → Use <Skeleton> while loading; EmptyState when the result set is empty
2239
+ - ❌ `<Stat Assuming trend flips the arrow direction>` → delta="-0.4%" always shows a down arrow; trend="up" just colors it green
2240
+ - ❌ `<Stat Building a KPI card with Card + manual layout>` → Use <Stat label value delta trend />
2241
+ - ❌ `<Stat Laying out a KPI row with custom flex + dividers>` → Wrap the Stats in <StatGroup>
2242
+ - ❌ `<StatGroup Putting non-Stat children in StatGroup>` → Only place <Stat> elements inside StatGroup
2243
+ - ❌ `<Timeline Building an activity log with a <ul> + manual dots/lines>` → Use <Timeline items={[...]} /> or TimelineItem children
2244
+ - ❌ `<Timeline Using Stepper for a history/audit feed>` → Use <Timeline> for logs/history; Stepper for wizards
2245
+ - ❌ `<Timeline Expecting Timeline to sort by time>` → Sort the array yourself (newest- or oldest-first)
2246
+ - ❌ `<TimelineItem <TimelineItem> outside <Timeline>>` → Always nest TimelineItem inside Timeline
2247
+ - ❌ `<Tree Rendering a nested <ul> tree by hand with manual expand state>` → Pass a nested `data` array to <Tree> and control expandedIds/selectedId
2248
+ - ❌ `<Tree onSelect={(e) => ...}>` → onSelect={(id) => setSelected(id)}
2249
+ - ❌ `<Tree Mutating the data array to expand/collapse>` → Track expandedIds in state (or use defaultExpandedIds)
2250
+ - ❌ `<Tree Using DropdownMenu submenus for a file tree>` → Use <Tree> for file explorers / nested nav
2251
+ - ❌ `<OTPInput onChange={(e) => set(e.target.value)}>` → onChange={(value) => setCode(value)}
2252
+ - ❌ `<OTPInput Six separate <Input> boxes wired by hand>` → Use <OTPInput length={6} value onChange />
2253
+ - ❌ `<OTPInput Reading completion by comparing length yourself>` → Use onComplete={(code) => verify(code)}
2254
+ - ❌ `<OTPInput type="password" to hide digits>` → Use mask (type stays numeric/alphanumeric)
2255
+ - ❌ `<Carousel onChange={(e) => set(e.target.value)}>` → onChange={(index) => setIndex(index)}
2256
+ - ❌ `<Carousel Putting raw elements directly in Carousel>` → Wrap each slide in <CarouselSlide>
2257
+ - ❌ `<Carousel Building a slider with manual scroll + dot state>` → Use <Carousel> with CarouselSlide children
2258
+ - ❌ `<Carousel autoPlay without considering reduced motion / pausing>` → Carousel already pauses on hover/focus; keep interval reasonable or omit autoPlay
2259
+ - ❌ `<CarouselSlide <CarouselSlide> outside <Carousel>>` → Always nest CarouselSlide inside Carousel
1660
2260
  - ❌ `<DateRangePicker value={[from, to]}>` → Use value={{ from, to }} and read range.from / range.to
1661
2261
  - ❌ `<DateRangePicker DateRangePicker for a single date>` → Use <DatePicker /> for a single date
1662
2262
  - ❌ `<DateRangePicker presets="true" (string)>` → Use the bare prop: presets (or presets={true})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usevyre/ai-context",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "useVyre AI context — inject into LLM system prompts to eliminate UI hallucinations",
5
5
  "keywords": [
6
6
  "design-system",