@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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# FormField — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**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).**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { FormField } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Common AI Mistakes
|
|
11
|
+
|
|
12
|
+
- ❌ `Putting onChange/value manually on the control inside FormField`
|
|
13
|
+
→ Let FormField wire the control; only pass static props (type, placeholder)
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
**Field with a hint**
|
|
18
|
+
```tsx
|
|
19
|
+
<FormField name="bio" label="Bio" hint="Max 200 characters" rules={{ maxLength: 200 }}>
|
|
20
|
+
<Textarea />
|
|
21
|
+
</FormField>
|
|
22
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Grid — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**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`).**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Grid, GridItem } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `flow` | `"row"` \| `"column"` \| `"dense"` \| `"row-dense"` \| `"column-dense"` | — |
|
|
15
|
+
| `gap` | `"none"` \| `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` \| `"2xl"` | `md` |
|
|
16
|
+
| `rowGap` | `"none"` \| `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` \| `"2xl"` | — |
|
|
17
|
+
| `columnGap` | `"none"` \| `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` \| `"2xl"` | — |
|
|
18
|
+
| `align` | `"start"` \| `"center"` \| `"end"` \| `"stretch"` | `stretch` |
|
|
19
|
+
| `justify` | `"start"` \| `"center"` \| `"end"` \| `"stretch"` | — |
|
|
20
|
+
| `width` | `"auto"` \| `"full"` \| `"fit"` \| `"screen"` \| `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` \| `"2xl"` | — |
|
|
21
|
+
| `height` | `"auto"` \| `"full"` \| `"fit"` \| `"screen"` \| `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` \| `"2xl"` | — |
|
|
22
|
+
|
|
23
|
+
## Common AI Mistakes
|
|
24
|
+
|
|
25
|
+
- ❌ `<div style={{ display:'grid', gridTemplateColumns:'1fr 1fr 1fr' }}>`
|
|
26
|
+
→ Use <Grid columns={3} gap="md">
|
|
27
|
+
- ❌ `columns="3" (string)`
|
|
28
|
+
→ Use columns={3} or columns="auto-fit"
|
|
29
|
+
- ❌ `Nested div with inline grid-column for spanning`
|
|
30
|
+
→ Wrap the cell in <GridItem colSpan={2}>
|
|
31
|
+
- ❌ `style={{ width: "100%" }} / style={{ height: 320 }}`
|
|
32
|
+
→ Use the width / height prop: width="full", width="md", height="screen", etc.
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
**Three-column grid with a wide first cell**
|
|
37
|
+
```tsx
|
|
38
|
+
<Grid columns={3} gap="lg">
|
|
39
|
+
<GridItem colSpan={2}><Card>Wide</Card></GridItem>
|
|
40
|
+
<Card>Two</Card>
|
|
41
|
+
<Card>Three</Card>
|
|
42
|
+
</Grid>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Responsive auto-fit grid**
|
|
46
|
+
```tsx
|
|
47
|
+
<Grid columns="auto-fit" gap="md">
|
|
48
|
+
{items.map((i) => <Card key={i.id}>{i.title}</Card>)}
|
|
49
|
+
</Grid>
|
|
50
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# GridItem — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**Child placement inside <Grid>. Sets column/row span and start lines. Renders a plain <div> (or `as`).**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { GridItem } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Common AI Mistakes
|
|
11
|
+
|
|
12
|
+
- ❌ `GridItem outside a Grid`
|
|
13
|
+
→ Place <GridItem> directly inside <Grid>
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
**Span two columns**
|
|
18
|
+
```tsx
|
|
19
|
+
<Grid columns={4} gap="md">
|
|
20
|
+
<GridItem colSpan={2}>Featured</GridItem>
|
|
21
|
+
<div>a</div>
|
|
22
|
+
<div>b</div>
|
|
23
|
+
</Grid>
|
|
24
|
+
```
|
|
@@ -45,4 +45,26 @@ Quick reference for AI agents — one file per component.
|
|
|
45
45
|
- [Item](item.md) — Layout primitive for list rows, settings rows, and notification rows. Denser than Card — use Item (not Card) for repeated list rows.
|
|
46
46
|
- [Kanban](kanban.md) — 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.
|
|
47
47
|
- [Conversation](conversation.md) — 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.
|
|
48
|
+
- [Stack](stack.md) — 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`).
|
|
49
|
+
- [Grid](grid.md) — 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`).
|
|
50
|
+
- [GridItem](griditem.md) — Child placement inside <Grid>. Sets column/row span and start lines. Renders a plain <div> (or `as`).
|
|
51
|
+
- [Box](box.md) — 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`).
|
|
52
|
+
- [Form](form.md) — 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.
|
|
53
|
+
- [FormField](formfield.md) — 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).
|
|
54
|
+
- [NumberInput](numberinput.md) — 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.
|
|
55
|
+
- [ToggleGroup](togglegroup.md) — 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).
|
|
56
|
+
- [ToggleItem](toggleitem.md) — A single toggle button inside <ToggleGroup>. Reads selection state from the group via context.
|
|
57
|
+
- [Stepper](stepper.md) — 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.
|
|
58
|
+
- [StepperNav](steppernav.md) — Container for Step indicators inside <Stepper>. Lays them out per the Stepper's orientation.
|
|
59
|
+
- [Step](step.md) — One step indicator inside <StepperNav>. State (completed/current/upcoming) derives from the Stepper's active index automatically.
|
|
60
|
+
- [StepPanel](steppanel.md) — Content for one step. Renders its children only when its index equals the Stepper's active step.
|
|
61
|
+
- [EmptyState](emptystate.md) — 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.
|
|
62
|
+
- [Stat](stat.md) — 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.
|
|
63
|
+
- [StatGroup](statgroup.md) — Evenly-split row of <Stat> with subtle dividers between items. Each Stat flexes to equal width.
|
|
64
|
+
- [Timeline](timeline.md) — 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.
|
|
65
|
+
- [TimelineItem](timelineitem.md) — One entry in a <Timeline>. Renders a status-colored dot (or a custom icon), a title, an optional time, and optional rich content.
|
|
66
|
+
- [Tree](tree.md) — 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.
|
|
67
|
+
- [OTPInput](otpinput.md) — 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>.
|
|
68
|
+
- [Carousel](carousel.md) — 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).
|
|
69
|
+
- [CarouselSlide](carouselslide.md) — One slide inside <Carousel>. Holds arbitrary content (image, Card, testimonial). Slide order determines its index.
|
|
48
70
|
- [DateRangePicker](daterangepicker.md) — 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.
|
|
@@ -21,6 +21,8 @@ import { Input } from "@usevyre/react"
|
|
|
21
21
|
→ Import Command from @usevyre/react for search palettes
|
|
22
22
|
- ❌ `Vue: binding Input/Textarea value without v-model`
|
|
23
23
|
→ Use v-model on <Input>/<Textarea> in Vue; in React use value + onChange
|
|
24
|
+
- ❌ `padding / margin / marginTop (any spacing prop) on a useVyre component`
|
|
25
|
+
→ Space BETWEEN components with <Stack gap> / <Grid gap>; space AROUND a block with <Box padding/margin> wrapping it
|
|
24
26
|
|
|
25
27
|
## Examples
|
|
26
28
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# NumberInput — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**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.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { NumberInput } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `size` | `"sm"` \| `"md"` \| `"lg"` | `md` |
|
|
15
|
+
| `disabled` | `true` \| `false` | `false` |
|
|
16
|
+
| `readOnly` | `true` \| `false` | `false` |
|
|
17
|
+
|
|
18
|
+
## Common AI Mistakes
|
|
19
|
+
|
|
20
|
+
- ❌ `onChange={(e) => set(e.target.value)}`
|
|
21
|
+
→ onChange={(value) => set(value)} — value is number | null
|
|
22
|
+
- ❌ `Using <Input type="number"> for numeric fields`
|
|
23
|
+
→ Use <NumberInput value onChange min max step />
|
|
24
|
+
- ❌ `Parsing the value with Number() in form state`
|
|
25
|
+
→ Store the value directly; it is already number | null
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
**Quantity selector**
|
|
30
|
+
```tsx
|
|
31
|
+
const [qty, setQty] = useState<number | null>(1);
|
|
32
|
+
|
|
33
|
+
<NumberInput value={qty} onChange={setQty} min={1} max={99} />
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Inside a Form**
|
|
37
|
+
```tsx
|
|
38
|
+
<FormField name="age" label="Age" rules={{ required: true, min: 18 }}>
|
|
39
|
+
<NumberInput min={0} max={120} />
|
|
40
|
+
</FormField>
|
|
41
|
+
```
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# OTPInput — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**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>.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { OTPInput } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `type` | `"numeric"` \| `"alphanumeric"` | `numeric` |
|
|
15
|
+
| `size` | `"sm"` \| `"md"` \| `"lg"` | `md` |
|
|
16
|
+
| `mask` | `true` \| `false` | `false` |
|
|
17
|
+
| `disabled` | `true` \| `false` | `false` |
|
|
18
|
+
| `autoFocus` | `true` \| `false` | `false` |
|
|
19
|
+
|
|
20
|
+
## Common AI Mistakes
|
|
21
|
+
|
|
22
|
+
- ❌ `onChange={(e) => set(e.target.value)}`
|
|
23
|
+
→ onChange={(value) => setCode(value)}
|
|
24
|
+
- ❌ `Six separate <Input> boxes wired by hand`
|
|
25
|
+
→ Use <OTPInput length={6} value onChange />
|
|
26
|
+
- ❌ `Reading completion by comparing length yourself`
|
|
27
|
+
→ Use onComplete={(code) => verify(code)}
|
|
28
|
+
- ❌ `type="password" to hide digits`
|
|
29
|
+
→ Use mask (type stays numeric/alphanumeric)
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
**2FA code with verify on complete**
|
|
34
|
+
```tsx
|
|
35
|
+
const [code, setCode] = useState("");
|
|
36
|
+
|
|
37
|
+
<OTPInput
|
|
38
|
+
value={code}
|
|
39
|
+
onChange={setCode}
|
|
40
|
+
onComplete={(c) => verify(c)}
|
|
41
|
+
autoFocus
|
|
42
|
+
/>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Inside a Form**
|
|
46
|
+
```tsx
|
|
47
|
+
<FormField name="otp" label="Verification code"
|
|
48
|
+
rules={{ required: true, minLength: 6 }}>
|
|
49
|
+
<OTPInput length={6} />
|
|
50
|
+
</FormField>
|
|
51
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Stack — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**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`).**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Stack } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `direction` | `"row"` \| `"column"` \| `"row-reverse"` \| `"column-reverse"` | `row` |
|
|
15
|
+
| `gap` | `"none"` \| `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` \| `"2xl"` | `md` |
|
|
16
|
+
| `rowGap` | `"none"` \| `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` \| `"2xl"` | — |
|
|
17
|
+
| `columnGap` | `"none"` \| `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` \| `"2xl"` | — |
|
|
18
|
+
| `align` | `"start"` \| `"center"` \| `"end"` \| `"stretch"` \| `"baseline"` | `stretch` |
|
|
19
|
+
| `justify` | `"start"` \| `"center"` \| `"end"` \| `"between"` \| `"around"` \| `"evenly"` | `start` |
|
|
20
|
+
| `alignContent` | `"start"` \| `"center"` \| `"end"` \| `"stretch"` \| `"between"` \| `"around"` \| `"evenly"` | — |
|
|
21
|
+
| `alignSelf` | `"auto"` \| `"start"` \| `"center"` \| `"end"` \| `"stretch"` \| `"baseline"` | — |
|
|
22
|
+
| `wrap` | `"nowrap"` \| `"wrap"` \| `"wrap-reverse"` | `nowrap` |
|
|
23
|
+
| `basis` | `"none"` \| `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` \| `"2xl"` \| `"auto"` \| `"content"` \| `"0"` | — |
|
|
24
|
+
| `width` | `"auto"` \| `"full"` \| `"fit"` \| `"screen"` \| `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` \| `"2xl"` | — |
|
|
25
|
+
| `height` | `"auto"` \| `"full"` \| `"fit"` \| `"screen"` \| `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` \| `"2xl"` | — |
|
|
26
|
+
| `inline` | `true` \| `false` | `false` |
|
|
27
|
+
|
|
28
|
+
## Common AI Mistakes
|
|
29
|
+
|
|
30
|
+
- ❌ `<div style={{ display: 'flex', gap: 12 }}>`
|
|
31
|
+
→ Use <Stack gap="md"> — gap is a token
|
|
32
|
+
- ❌ `gap={12} or gap="12px"`
|
|
33
|
+
→ Use gap="none|xs|sm|md|lg|xl|2xl"
|
|
34
|
+
- ❌ `direction="vertical" / "horizontal"`
|
|
35
|
+
→ Use direction="row" or "column" (also row-reverse / column-reverse)
|
|
36
|
+
- ❌ `style={{ width: "100%" }} / style={{ height: 320 }}`
|
|
37
|
+
→ Use the width / height prop: width="full", width="md", height="screen", etc.
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
**Row, vertically centered, spaced apart**
|
|
42
|
+
```tsx
|
|
43
|
+
<Stack direction="row" gap="md" align="center" justify="between">
|
|
44
|
+
<Avatar src={user.avatar} />
|
|
45
|
+
<Text>{user.name}</Text>
|
|
46
|
+
<Button>Edit</Button>
|
|
47
|
+
</Stack>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Wrapping grid-ish gallery with per-axis gap**
|
|
51
|
+
```tsx
|
|
52
|
+
<Stack wrap="wrap" rowGap="lg" columnGap="md">
|
|
53
|
+
{tags.map((t) => <Tag key={t}>{t}</Tag>)}
|
|
54
|
+
</Stack>
|
|
55
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Stat — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**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.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Stat, StatGroup } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `trend` | `"up"` \| `"down"` \| `"neutral"` | `neutral` |
|
|
15
|
+
| `size` | `"sm"` \| `"md"` \| `"lg"` | `md` |
|
|
16
|
+
|
|
17
|
+
## Common AI Mistakes
|
|
18
|
+
|
|
19
|
+
- ❌ `Assuming trend flips the arrow direction`
|
|
20
|
+
→ delta="-0.4%" always shows a down arrow; trend="up" just colors it green
|
|
21
|
+
- ❌ `Building a KPI card with Card + manual layout`
|
|
22
|
+
→ Use <Stat label value delta trend />
|
|
23
|
+
- ❌ `Laying out a KPI row with custom flex + dividers`
|
|
24
|
+
→ Wrap the Stats in <StatGroup>
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
**KPI row; note churn stays green while going down**
|
|
29
|
+
```tsx
|
|
30
|
+
<StatGroup>
|
|
31
|
+
<Stat label="Revenue" value="$48.2k" delta="+12%" trend="up" deltaLabel="vs last month" />
|
|
32
|
+
<Stat label="Churn" value="2.1%" delta="-0.4%" trend="up" deltaLabel="lower is better" />
|
|
33
|
+
<Stat label="Orders" value="1,204" delta="0%" trend="neutral" />
|
|
34
|
+
</StatGroup>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Single stat with icon**
|
|
38
|
+
```tsx
|
|
39
|
+
<Stat label="Active users" value="12,840" delta="+3.2%" trend="up"
|
|
40
|
+
icon={<UsersIcon />} size="lg" />
|
|
41
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# StatGroup — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**Evenly-split row of <Stat> with subtle dividers between items. Each Stat flexes to equal width.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Stat, StatGroup } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Common AI Mistakes
|
|
11
|
+
|
|
12
|
+
- ❌ `Putting non-Stat children in StatGroup`
|
|
13
|
+
→ Only place <Stat> elements inside StatGroup
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
**Three KPIs in a row**
|
|
18
|
+
```tsx
|
|
19
|
+
<StatGroup>
|
|
20
|
+
<Stat label="MRR" value="$9.6k" delta="+5%" trend="up" />
|
|
21
|
+
<Stat label="Refunds" value="32" delta="+8" trend="down" />
|
|
22
|
+
</StatGroup>
|
|
23
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Step — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**One step indicator inside <StepperNav>. State (completed/current/upcoming) derives from the Stepper's active index automatically.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"
|
|
8
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# StepPanel — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**Content for one step. Renders its children only when its index equals the Stepper's active step.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"
|
|
8
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Stepper — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**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.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `orientation` | `"horizontal"` \| `"vertical"` | `horizontal` |
|
|
15
|
+
| `clickable` | `true` \| `false` | `false` |
|
|
16
|
+
|
|
17
|
+
## Common AI Mistakes
|
|
18
|
+
|
|
19
|
+
- ❌ `Using Tabs for a wizard / checkout flow`
|
|
20
|
+
→ Use <Stepper> with StepperNav + Step + StepPanel
|
|
21
|
+
- ❌ `onChange={(e) => set(e.target.value)}`
|
|
22
|
+
→ onChange={(index) => setStep(index)}
|
|
23
|
+
- ❌ `Manually toggling which panel is visible`
|
|
24
|
+
→ Give each StepPanel an index; Stepper shows the active one
|
|
25
|
+
- ❌ `<Step> or <StepPanel> outside <Stepper>`
|
|
26
|
+
→ Nest Step inside StepperNav, StepPanel inside Stepper
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
**Three-step wizard with Back/Next**
|
|
31
|
+
```tsx
|
|
32
|
+
const [step, setStep] = useState(0);
|
|
33
|
+
|
|
34
|
+
<Stepper value={step} onChange={setStep}>
|
|
35
|
+
<StepperNav>
|
|
36
|
+
<Step index={0} label="Account" />
|
|
37
|
+
<Step index={1} label="Profile" />
|
|
38
|
+
<Step index={2} label="Done" />
|
|
39
|
+
</StepperNav>
|
|
40
|
+
<StepPanel index={0}><AccountForm /></StepPanel>
|
|
41
|
+
<StepPanel index={1}><ProfileForm /></StepPanel>
|
|
42
|
+
<StepPanel index={2}><Summary /></StepPanel>
|
|
43
|
+
<Stack direction="row" gap="sm" justify="between">
|
|
44
|
+
<Button onClick={() => setStep((s) => s - 1)} disabled={step === 0}>Back</Button>
|
|
45
|
+
<Button variant="primary" onClick={() => setStep((s) => s + 1)}>Next</Button>
|
|
46
|
+
</Stack>
|
|
47
|
+
</Stepper>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Vertical with descriptions**
|
|
51
|
+
```tsx
|
|
52
|
+
<Stepper orientation="vertical" defaultValue={1}>
|
|
53
|
+
<StepperNav>
|
|
54
|
+
<Step index={0} label="Cart" description="2 items" />
|
|
55
|
+
<Step index={1} label="Shipping" description="Enter address" />
|
|
56
|
+
<Step index={2} label="Payment" />
|
|
57
|
+
</StepperNav>
|
|
58
|
+
</Stepper>
|
|
59
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# StepperNav — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**Container for Step indicators inside <Stepper>. Lays them out per the Stepper's orientation.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Stepper, StepperNav, Step, StepPanel } from "@usevyre/react"
|
|
8
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Timeline — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**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.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Timeline, TimelineItem } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Common AI Mistakes
|
|
11
|
+
|
|
12
|
+
- ❌ `Building an activity log with a <ul> + manual dots/lines`
|
|
13
|
+
→ Use <Timeline items={[...]} /> or TimelineItem children
|
|
14
|
+
- ❌ `Using Stepper for a history/audit feed`
|
|
15
|
+
→ Use <Timeline> for logs/history; Stepper for wizards
|
|
16
|
+
- ❌ `Expecting Timeline to sort by time`
|
|
17
|
+
→ Sort the array yourself (newest- or oldest-first)
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
**Plain audit log via items**
|
|
22
|
+
```tsx
|
|
23
|
+
<Timeline
|
|
24
|
+
items={[
|
|
25
|
+
{ title: "Deployed v2.1", time: "2m ago", status: "success" },
|
|
26
|
+
{ title: "Build started", time: "5m ago", status: "info" },
|
|
27
|
+
{ title: "Push to main", time: "6m ago" },
|
|
28
|
+
]}
|
|
29
|
+
/>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Rich content via children**
|
|
33
|
+
```tsx
|
|
34
|
+
<Timeline>
|
|
35
|
+
<TimelineItem title="Invoice paid" time="Apr 2" status="success">
|
|
36
|
+
<Text size="sm">$1,200 — <a href="#">view receipt</a></Text>
|
|
37
|
+
</TimelineItem>
|
|
38
|
+
<TimelineItem title="Invoice sent" time="Mar 28" status="info" />
|
|
39
|
+
</Timeline>
|
|
40
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# TimelineItem — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**One entry in a <Timeline>. Renders a status-colored dot (or a custom icon), a title, an optional time, and optional rich content.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Timeline, TimelineItem } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `status` | `"default"` \| `"success"` \| `"warning"` \| `"danger"` \| `"info"` | `default` |
|
|
15
|
+
|
|
16
|
+
## Common AI Mistakes
|
|
17
|
+
|
|
18
|
+
- ❌ `<TimelineItem> outside <Timeline>`
|
|
19
|
+
→ Always nest TimelineItem inside Timeline
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
**Item with rich content**
|
|
24
|
+
```tsx
|
|
25
|
+
<TimelineItem title="Comment added" time="1h ago" status="default">
|
|
26
|
+
<Text size="sm">“Looks good to me 👍”</Text>
|
|
27
|
+
</TimelineItem>
|
|
28
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# ToggleGroup — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**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).**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { ToggleGroup, ToggleItem } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `type` | `"single"` \| `"multiple"` | `single` |
|
|
15
|
+
| `size` | `"sm"` \| `"md"` \| `"lg"` | `md` |
|
|
16
|
+
| `orientation` | `"horizontal"` \| `"vertical"` | `horizontal` |
|
|
17
|
+
| `disabled` | `true` \| `false` | `false` |
|
|
18
|
+
|
|
19
|
+
## Common AI Mistakes
|
|
20
|
+
|
|
21
|
+
- ❌ `onChange={(e) => set(e.target.value)}`
|
|
22
|
+
→ onChange={(value) => set(value)} — string|null (single) or string[] (multiple)
|
|
23
|
+
- ❌ `Using ToggleGroup for a single on/off setting`
|
|
24
|
+
→ Use <Switch> for on/off; ToggleGroup is for choosing among options
|
|
25
|
+
- ❌ `type="multiple" with a string value`
|
|
26
|
+
→ value={['a','b']} and onChange receives string[]
|
|
27
|
+
- ❌ `<ToggleItem> outside <ToggleGroup>`
|
|
28
|
+
→ Always nest ToggleItem inside ToggleGroup (or use options)
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
**Single-select view switcher (options)**
|
|
33
|
+
```tsx
|
|
34
|
+
const [view, setView] = useState<string | null>("grid");
|
|
35
|
+
|
|
36
|
+
<ToggleGroup
|
|
37
|
+
value={view}
|
|
38
|
+
onChange={setView}
|
|
39
|
+
options={[
|
|
40
|
+
{ value: "grid", label: "Grid" },
|
|
41
|
+
{ value: "list", label: "List" },
|
|
42
|
+
]}
|
|
43
|
+
/>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Multiple-select formatting (composable)**
|
|
47
|
+
```tsx
|
|
48
|
+
const [fmt, setFmt] = useState<string[]>(["bold"]);
|
|
49
|
+
|
|
50
|
+
<ToggleGroup type="multiple" value={fmt} onChange={setFmt}>
|
|
51
|
+
<ToggleItem value="bold">B</ToggleItem>
|
|
52
|
+
<ToggleItem value="italic">I</ToggleItem>
|
|
53
|
+
<ToggleItem value="underline">U</ToggleItem>
|
|
54
|
+
</ToggleGroup>
|
|
55
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ToggleItem — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**A single toggle button inside <ToggleGroup>. Reads selection state from the group via context.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { ToggleItem } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Valid Props
|
|
11
|
+
|
|
12
|
+
| Prop | Values | Default |
|
|
13
|
+
|------|--------|---------|
|
|
14
|
+
| `disabled` | `true` \| `false` | `false` |
|
|
15
|
+
|
|
16
|
+
## Common AI Mistakes
|
|
17
|
+
|
|
18
|
+
- ❌ `Tracking selected state on ToggleItem yourself`
|
|
19
|
+
→ Only set value; the group controls selected state
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
**Composable items**
|
|
24
|
+
```tsx
|
|
25
|
+
<ToggleGroup value={v} onChange={setV}>
|
|
26
|
+
<ToggleItem value="left">Left</ToggleItem>
|
|
27
|
+
<ToggleItem value="center">Center</ToggleItem>
|
|
28
|
+
</ToggleGroup>
|
|
29
|
+
```
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Tree — AI Cheat Sheet
|
|
2
|
+
> Quick reference for Claude / Cursor / Copilot
|
|
3
|
+
|
|
4
|
+
**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.**
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { Tree } from "@usevyre/react"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Common AI Mistakes
|
|
11
|
+
|
|
12
|
+
- ❌ `Rendering a nested <ul> tree by hand with manual expand state`
|
|
13
|
+
→ Pass a nested `data` array to <Tree> and control expandedIds/selectedId
|
|
14
|
+
- ❌ `onSelect={(e) => ...}`
|
|
15
|
+
→ onSelect={(id) => setSelected(id)}
|
|
16
|
+
- ❌ `Mutating the data array to expand/collapse`
|
|
17
|
+
→ Track expandedIds in state (or use defaultExpandedIds)
|
|
18
|
+
- ❌ `Using DropdownMenu submenus for a file tree`
|
|
19
|
+
→ Use <Tree> for file explorers / nested nav
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
**File explorer, controlled selection**
|
|
24
|
+
```tsx
|
|
25
|
+
const [sel, setSel] = useState<string | null>("src/a.ts");
|
|
26
|
+
|
|
27
|
+
<Tree
|
|
28
|
+
data={[
|
|
29
|
+
{ id: "src", label: "src", children: [
|
|
30
|
+
{ id: "src/a.ts", label: "a.ts" },
|
|
31
|
+
{ id: "src/b", label: "b", children: [
|
|
32
|
+
{ id: "src/b/c.ts", label: "c.ts" },
|
|
33
|
+
]},
|
|
34
|
+
]},
|
|
35
|
+
{ id: "README.md", label: "README.md" },
|
|
36
|
+
]}
|
|
37
|
+
selectedId={sel}
|
|
38
|
+
onSelect={setSel}
|
|
39
|
+
defaultExpandedIds={["src"]}
|
|
40
|
+
/>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Fully controlled expansion**
|
|
44
|
+
```tsx
|
|
45
|
+
const [open, setOpen] = useState<string[]>(["root"]);
|
|
46
|
+
|
|
47
|
+
<Tree data={tree} expandedIds={open} onExpandedChange={setOpen} />
|
|
48
|
+
```
|