@usevyre/react 1.2.1 → 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/components/Carousel/Carousel.d.ts +52 -0
- package/dist/components/EmptyState/EmptyState.d.ts +50 -0
- package/dist/components/Form/Form.d.ts +96 -0
- package/dist/components/Layout/Layout.d.ts +184 -0
- package/dist/components/NumberInput/NumberInput.d.ts +52 -0
- package/dist/components/OTPInput/OTPInput.d.ts +55 -0
- package/dist/components/Stat/Stat.d.ts +55 -0
- package/dist/components/Stepper/Stepper.d.ts +76 -0
- package/dist/components/Timeline/Timeline.d.ts +70 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +79 -0
- package/dist/components/Tree/Tree.d.ts +62 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +35 -0
- package/dist/index.js +3437 -2219
- package/dist/styles/components.css +930 -0
- package/package.json +1 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @usevyre/react — Timeline + TimelineItem
|
|
3
|
+
*
|
|
4
|
+
* AI CONTEXT:
|
|
5
|
+
* ┌──────────────────────────────────────────────────────────────────┐
|
|
6
|
+
* │ Component: Timeline (+ TimelineItem) │
|
|
7
|
+
* │ Import: import { Timeline, TimelineItem } from "@usevyre/react"│
|
|
8
|
+
* │ │
|
|
9
|
+
* │ Vertical activity feed for audit logs / history. Presentational. │
|
|
10
|
+
* │ A marker dot per item + a connector line between them. │
|
|
11
|
+
* │ │
|
|
12
|
+
* │ <Timeline items={[{ title, time?, description?, status?, │
|
|
13
|
+
* │ icon? }]} /> │
|
|
14
|
+
* │ — OR — │
|
|
15
|
+
* │ <Timeline> │
|
|
16
|
+
* │ <TimelineItem title="…" time="…" status="success"> │
|
|
17
|
+
* │ rich content (links, badges, …) │
|
|
18
|
+
* │ </TimelineItem> │
|
|
19
|
+
* │ </Timeline> │
|
|
20
|
+
* │ │
|
|
21
|
+
* │ status = "default"|"success"|"warning"|"danger"|"info" │
|
|
22
|
+
* │ (colors the dot) │
|
|
23
|
+
* │ icon = ReactNode (overrides the dot) │
|
|
24
|
+
* │ │
|
|
25
|
+
* │ Use `items` for plain logs; use TimelineItem children for rich │
|
|
26
|
+
* │ per-item content. Newest-first or oldest-first is up to you — │
|
|
27
|
+
* │ Timeline does not reorder. │
|
|
28
|
+
* └──────────────────────────────────────────────────────────────────┘
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* <Timeline
|
|
32
|
+
* items={[
|
|
33
|
+
* { title: "Deployed v2.1", time: "2m ago", status: "success" },
|
|
34
|
+
* { title: "Build started", time: "5m ago", status: "info" },
|
|
35
|
+
* { title: "Push to main", time: "6m ago" },
|
|
36
|
+
* ]}
|
|
37
|
+
* />
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* <Timeline>
|
|
41
|
+
* <TimelineItem title="Invoice paid" time="Apr 2" status="success">
|
|
42
|
+
* <Text size="sm">$1,200 — <a href="#">view receipt</a></Text>
|
|
43
|
+
* </TimelineItem>
|
|
44
|
+
* </Timeline>
|
|
45
|
+
*/
|
|
46
|
+
import React from "react";
|
|
47
|
+
import type { BaseProps } from "../../types";
|
|
48
|
+
export type TimelineStatus = "default" | "success" | "warning" | "danger" | "info";
|
|
49
|
+
export interface TimelineItemData {
|
|
50
|
+
title: React.ReactNode;
|
|
51
|
+
time?: React.ReactNode;
|
|
52
|
+
description?: React.ReactNode;
|
|
53
|
+
status?: TimelineStatus;
|
|
54
|
+
icon?: React.ReactNode;
|
|
55
|
+
}
|
|
56
|
+
export interface TimelineProps extends React.HTMLAttributes<HTMLOListElement>, BaseProps {
|
|
57
|
+
/** Plain items — alternative to TimelineItem children */
|
|
58
|
+
items?: TimelineItemData[];
|
|
59
|
+
children?: React.ReactNode;
|
|
60
|
+
}
|
|
61
|
+
export declare const Timeline: React.ForwardRefExoticComponent<TimelineProps & React.RefAttributes<HTMLOListElement>>;
|
|
62
|
+
export interface TimelineItemProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, "title">, BaseProps {
|
|
63
|
+
title: React.ReactNode;
|
|
64
|
+
time?: React.ReactNode;
|
|
65
|
+
status?: TimelineStatus;
|
|
66
|
+
/** Overrides the status dot */
|
|
67
|
+
icon?: React.ReactNode;
|
|
68
|
+
children?: React.ReactNode;
|
|
69
|
+
}
|
|
70
|
+
export declare const TimelineItem: React.ForwardRefExoticComponent<TimelineItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @usevyre/react — ToggleGroup + ToggleItem
|
|
3
|
+
*
|
|
4
|
+
* AI CONTEXT:
|
|
5
|
+
* ┌──────────────────────────────────────────────────────────────────┐
|
|
6
|
+
* │ Component: ToggleGroup (+ ToggleItem) │
|
|
7
|
+
* │ Import: import { ToggleGroup, ToggleItem } from "@usevyre/react"│
|
|
8
|
+
* │ │
|
|
9
|
+
* │ Segmented control. CONTROLLED — the group owns the value. │
|
|
10
|
+
* │ onChange emits the VALUE (string|null or string[]), not an event. │
|
|
11
|
+
* │ │
|
|
12
|
+
* │ type = "single"(default) | "multiple" │
|
|
13
|
+
* │ single → value: string | null, onChange(string | null) │
|
|
14
|
+
* │ multiple → value: string[], onChange(string[]) │
|
|
15
|
+
* │ options? = { value; label?; icon?; disabled? }[] │
|
|
16
|
+
* │ size = "sm" | "md"(default) | "lg" │
|
|
17
|
+
* │ disabled = boolean (disables the whole group) │
|
|
18
|
+
* │ │
|
|
19
|
+
* │ Use `options` for simple lists, or <ToggleItem value> children │
|
|
20
|
+
* │ for custom content. Keyboard: arrows move, Space/Enter toggles. │
|
|
21
|
+
* │ │
|
|
22
|
+
* │ NOT Switch (boolean), NOT ButtonGroup (layout only), │
|
|
23
|
+
* │ NOT RadioGroup (form radios, single only). │
|
|
24
|
+
* └──────────────────────────────────────────────────────────────────┘
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* const [view, setView] = useState<string | null>("grid");
|
|
28
|
+
* <ToggleGroup
|
|
29
|
+
* value={view}
|
|
30
|
+
* onChange={setView}
|
|
31
|
+
* options={[
|
|
32
|
+
* { value: "grid", label: "Grid" },
|
|
33
|
+
* { value: "list", label: "List" },
|
|
34
|
+
* ]}
|
|
35
|
+
* />
|
|
36
|
+
*
|
|
37
|
+
* @example // multiple, composable
|
|
38
|
+
* const [fmt, setFmt] = useState<string[]>(["bold"]);
|
|
39
|
+
* <ToggleGroup type="multiple" value={fmt} onChange={setFmt}>
|
|
40
|
+
* <ToggleItem value="bold">B</ToggleItem>
|
|
41
|
+
* <ToggleItem value="italic">I</ToggleItem>
|
|
42
|
+
* </ToggleGroup>
|
|
43
|
+
*/
|
|
44
|
+
import React from "react";
|
|
45
|
+
import type { BaseProps } from "../../types";
|
|
46
|
+
export interface ToggleOption {
|
|
47
|
+
value: string;
|
|
48
|
+
label?: React.ReactNode;
|
|
49
|
+
icon?: React.ReactNode;
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
}
|
|
52
|
+
type ToggleSize = "sm" | "md" | "lg";
|
|
53
|
+
type SingleProps = {
|
|
54
|
+
type?: "single";
|
|
55
|
+
value?: string | null;
|
|
56
|
+
onChange?: (value: string | null) => void;
|
|
57
|
+
};
|
|
58
|
+
type MultipleProps = {
|
|
59
|
+
type: "multiple";
|
|
60
|
+
value?: string[];
|
|
61
|
+
onChange?: (value: string[]) => void;
|
|
62
|
+
};
|
|
63
|
+
export type ToggleGroupProps = (SingleProps | MultipleProps) & BaseProps & {
|
|
64
|
+
options?: ToggleOption[];
|
|
65
|
+
size?: ToggleSize;
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
orientation?: "horizontal" | "vertical";
|
|
68
|
+
/** Accessible label for the group */
|
|
69
|
+
"aria-label"?: string;
|
|
70
|
+
children?: React.ReactNode;
|
|
71
|
+
};
|
|
72
|
+
export declare const ToggleGroup: React.ForwardRefExoticComponent<ToggleGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
73
|
+
export interface ToggleItemProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "value"> {
|
|
74
|
+
value: string;
|
|
75
|
+
icon?: React.ReactNode;
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export declare const ToggleItem: React.ForwardRefExoticComponent<ToggleItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @usevyre/react — Tree
|
|
3
|
+
*
|
|
4
|
+
* AI CONTEXT:
|
|
5
|
+
* ┌──────────────────────────────────────────────────────────────────┐
|
|
6
|
+
* │ Component: Tree │
|
|
7
|
+
* │ Import: import { Tree } from "@usevyre/react" │
|
|
8
|
+
* │ │
|
|
9
|
+
* │ Hierarchical tree view (file explorer / nested nav). DATA-DRIVEN │
|
|
10
|
+
* │ and CONTROLLED. Pass a nested array; the Tree renders recursively.│
|
|
11
|
+
* │ │
|
|
12
|
+
* │ data = TreeNode[] where TreeNode = { │
|
|
13
|
+
* │ id: string; label: ReactNode; │
|
|
14
|
+
* │ icon?: ReactNode; disabled?: boolean; │
|
|
15
|
+
* │ children?: TreeNode[] │
|
|
16
|
+
* │ } │
|
|
17
|
+
* │ expandedIds? = string[] (controlled) │
|
|
18
|
+
* │ defaultExpandedIds = string[] (uncontrolled) │
|
|
19
|
+
* │ onExpandedChange? = (ids: string[]) => void │
|
|
20
|
+
* │ selectedId? = string | null (controlled) │
|
|
21
|
+
* │ defaultSelectedId = string | null (uncontrolled) │
|
|
22
|
+
* │ onSelect? = (id: string) => void │
|
|
23
|
+
* │ │
|
|
24
|
+
* │ Single selection. A node with `children` is a folder (toggles │
|
|
25
|
+
* │ expand on click); a leaf fires onSelect. Keyboard: ↑/↓ move, │
|
|
26
|
+
* │ →/← expand/collapse, Enter/Space select. │
|
|
27
|
+
* └──────────────────────────────────────────────────────────────────┘
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const [sel, setSel] = useState<string | null>("a/b.ts");
|
|
31
|
+
* <Tree
|
|
32
|
+
* data={[
|
|
33
|
+
* { id: "src", label: "src", children: [
|
|
34
|
+
* { id: "a.ts", label: "a.ts" },
|
|
35
|
+
* { id: "b", label: "b", children: [{ id: "b/c.ts", label: "c.ts" }] },
|
|
36
|
+
* ]},
|
|
37
|
+
* { id: "readme", label: "README.md" },
|
|
38
|
+
* ]}
|
|
39
|
+
* selectedId={sel}
|
|
40
|
+
* onSelect={setSel}
|
|
41
|
+
* defaultExpandedIds={["src"]}
|
|
42
|
+
* />
|
|
43
|
+
*/
|
|
44
|
+
import React from "react";
|
|
45
|
+
import type { BaseProps } from "../../types";
|
|
46
|
+
export interface TreeNode {
|
|
47
|
+
id: string;
|
|
48
|
+
label: React.ReactNode;
|
|
49
|
+
icon?: React.ReactNode;
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
children?: TreeNode[];
|
|
52
|
+
}
|
|
53
|
+
export interface TreeProps extends Omit<React.HTMLAttributes<HTMLUListElement>, "onSelect">, BaseProps {
|
|
54
|
+
data: TreeNode[];
|
|
55
|
+
expandedIds?: string[];
|
|
56
|
+
defaultExpandedIds?: string[];
|
|
57
|
+
onExpandedChange?: (ids: string[]) => void;
|
|
58
|
+
selectedId?: string | null;
|
|
59
|
+
defaultSelectedId?: string | null;
|
|
60
|
+
onSelect?: (id: string) => void;
|
|
61
|
+
}
|
|
62
|
+
export declare const Tree: React.ForwardRefExoticComponent<TreeProps & React.RefAttributes<HTMLUListElement>>;
|