@usevyre/react 1.0.3 → 1.1.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/ButtonGroup/ButtonGroup.d.ts +50 -0
- package/dist/components/Combobox/Combobox.d.ts +66 -0
- package/dist/components/DataGrid/DataGrid.d.ts +66 -0
- package/dist/components/Tag/Tag.d.ts +41 -0
- package/dist/components/Tag/TagGroup.d.ts +34 -0
- package/dist/components/TagsInput/TagsInput.d.ts +51 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1515 -1052
- package/dist/styles/components.css +504 -0
- package/package.json +1 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @usevyre/react — ButtonGroup
|
|
3
|
+
*
|
|
4
|
+
* AI CONTEXT:
|
|
5
|
+
* ┌─────────────────────────────────────────────────────────┐
|
|
6
|
+
* │ Component: ButtonGroup │
|
|
7
|
+
* │ Import: import { ButtonGroup } from "@usevyre/react"│
|
|
8
|
+
* │ │
|
|
9
|
+
* │ Props: │
|
|
10
|
+
* │ orientation = "horizontal"(default)|"vertical" │
|
|
11
|
+
* │ attached = boolean (default: false) │
|
|
12
|
+
* │ If true, buttons share borders (no gap) │
|
|
13
|
+
* │ size = "sm"|"md"|"lg"|"icon" │
|
|
14
|
+
* │ Propagated to children via data-size attr │
|
|
15
|
+
* │ │
|
|
16
|
+
* │ Semantics: role="group" wrapper div │
|
|
17
|
+
* └─────────────────────────────────────────────────────────┘
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Horizontal toolbar
|
|
21
|
+
* <ButtonGroup>
|
|
22
|
+
* <Button variant="secondary">Cut</Button>
|
|
23
|
+
* <Button variant="secondary">Copy</Button>
|
|
24
|
+
* <Button variant="secondary">Paste</Button>
|
|
25
|
+
* </ButtonGroup>
|
|
26
|
+
*
|
|
27
|
+
* // Attached segmented control
|
|
28
|
+
* <ButtonGroup attached>
|
|
29
|
+
* <Button variant="primary">Day</Button>
|
|
30
|
+
* <Button variant="secondary">Week</Button>
|
|
31
|
+
* <Button variant="secondary">Month</Button>
|
|
32
|
+
* </ButtonGroup>
|
|
33
|
+
*
|
|
34
|
+
* // Vertical stack
|
|
35
|
+
* <ButtonGroup orientation="vertical">
|
|
36
|
+
* <Button variant="ghost">Option A</Button>
|
|
37
|
+
* <Button variant="ghost">Option B</Button>
|
|
38
|
+
* </ButtonGroup>
|
|
39
|
+
*/
|
|
40
|
+
import React from "react";
|
|
41
|
+
import type { Size, BaseProps } from "../../types";
|
|
42
|
+
export interface ButtonGroupProps extends React.HTMLAttributes<HTMLDivElement>, BaseProps {
|
|
43
|
+
/** Layout direction of grouped buttons */
|
|
44
|
+
orientation?: "horizontal" | "vertical";
|
|
45
|
+
/** Remove gap — buttons share collapsed borders */
|
|
46
|
+
attached?: boolean;
|
|
47
|
+
/** Size forwarded to child buttons via data-group-size attribute */
|
|
48
|
+
size?: Size;
|
|
49
|
+
}
|
|
50
|
+
export declare const ButtonGroup: React.ForwardRefExoticComponent<ButtonGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @usevyre/react — Combobox
|
|
3
|
+
*
|
|
4
|
+
* AI CONTEXT:
|
|
5
|
+
* ┌─────────────────────────────────────────────────────────┐
|
|
6
|
+
* │ Component: Combobox │
|
|
7
|
+
* │ Import: import { Combobox } from "@usevyre/react" │
|
|
8
|
+
* │ │
|
|
9
|
+
* │ Props: │
|
|
10
|
+
* │ options = { value: string; label: string; │
|
|
11
|
+
* │ disabled?: boolean }[] │
|
|
12
|
+
* │ value = string | null (controlled) │
|
|
13
|
+
* │ onChange = (value: string | null) => void │
|
|
14
|
+
* │ placeholder = string │
|
|
15
|
+
* │ disabled = boolean │
|
|
16
|
+
* │ size = "sm"|"md"(default)|"lg" │
|
|
17
|
+
* │ emptyText = string (default: "No results") │
|
|
18
|
+
* │ │
|
|
19
|
+
* │ Behavior: │
|
|
20
|
+
* │ Click input → show all options │
|
|
21
|
+
* │ Type → filter by case-insensitive contains │
|
|
22
|
+
* │ Select → close, update value, clear search │
|
|
23
|
+
* │ Escape → close dropdown │
|
|
24
|
+
* │ Click outside → close dropdown │
|
|
25
|
+
* │ ArrowUp/Down → keyboard navigation │
|
|
26
|
+
* │ Enter → select highlighted option │
|
|
27
|
+
* │ │
|
|
28
|
+
* │ Differs from Select: has searchable text input │
|
|
29
|
+
* │ Differs from Command: single-value pick, not palette │
|
|
30
|
+
* └─────────────────────────────────────────────────────────┘
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* const [lang, setLang] = useState<string | null>(null);
|
|
34
|
+
* <Combobox
|
|
35
|
+
* options={[
|
|
36
|
+
* { value: "ts", label: "TypeScript" },
|
|
37
|
+
* { value: "rs", label: "Rust" },
|
|
38
|
+
* ]}
|
|
39
|
+
* value={lang}
|
|
40
|
+
* onChange={setLang}
|
|
41
|
+
* placeholder="Search language…"
|
|
42
|
+
* />
|
|
43
|
+
*
|
|
44
|
+
* // Clear selection
|
|
45
|
+
* <Combobox value={val} onChange={(v) => setVal(v)} options={options} />
|
|
46
|
+
* // Pass null to onChange to clear
|
|
47
|
+
*/
|
|
48
|
+
import React from "react";
|
|
49
|
+
import type { BaseProps } from "../../types";
|
|
50
|
+
type ComboboxSize = "sm" | "md" | "lg";
|
|
51
|
+
export interface ComboboxOption {
|
|
52
|
+
value: string;
|
|
53
|
+
label: string;
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface ComboboxProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange">, BaseProps {
|
|
57
|
+
options: ComboboxOption[];
|
|
58
|
+
value: string | null;
|
|
59
|
+
onChange: (value: string | null) => void;
|
|
60
|
+
placeholder?: string;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
size?: ComboboxSize;
|
|
63
|
+
emptyText?: string;
|
|
64
|
+
}
|
|
65
|
+
export declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLDivElement>>;
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @usevyre/react — DataGrid
|
|
3
|
+
*
|
|
4
|
+
* AI CONTEXT:
|
|
5
|
+
* ┌─────────────────────────────────────────────────────────┐
|
|
6
|
+
* │ Component: DataGrid │
|
|
7
|
+
* │ Import: import { DataGrid } from "@usevyre/react" │
|
|
8
|
+
* │ │
|
|
9
|
+
* │ Props: │
|
|
10
|
+
* │ columns = { key: string; label: string; │
|
|
11
|
+
* │ sortable?: boolean; │
|
|
12
|
+
* │ width?: string }[] │
|
|
13
|
+
* │ rows = Record<string, unknown>[] │
|
|
14
|
+
* │ sortKey? = string (controlled) │
|
|
15
|
+
* │ sortDir? = "asc"|"desc" (controlled) │
|
|
16
|
+
* │ onSort? = (key: string, dir: "asc"|"desc") => │
|
|
17
|
+
* │ void │
|
|
18
|
+
* │ loading? = boolean — shows 5 skeleton rows │
|
|
19
|
+
* │ emptyText? = string (default: "No data") │
|
|
20
|
+
* │ stickyHeader? = boolean (default: false) │
|
|
21
|
+
* │ │
|
|
22
|
+
* │ Sort icons: ↕ unsorted, ↑ asc, ↓ desc │
|
|
23
|
+
* │ Intentionally excludes: filtering, pagination │
|
|
24
|
+
* │ → Use Pagination component for page navigation │
|
|
25
|
+
* └─────────────────────────────────────────────────────────┘
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const [sortKey, setSortKey] = useState<string | undefined>();
|
|
29
|
+
* const [sortDir, setSortDir] = useState<"asc" | "desc">("asc");
|
|
30
|
+
*
|
|
31
|
+
* <DataGrid
|
|
32
|
+
* columns={[
|
|
33
|
+
* { key: "name", label: "Name", sortable: true },
|
|
34
|
+
* { key: "email", label: "Email", sortable: true },
|
|
35
|
+
* { key: "status", label: "Status", width: "120px" },
|
|
36
|
+
* ]}
|
|
37
|
+
* rows={users}
|
|
38
|
+
* sortKey={sortKey}
|
|
39
|
+
* sortDir={sortDir}
|
|
40
|
+
* onSort={(key, dir) => { setSortKey(key); setSortDir(dir); }}
|
|
41
|
+
* stickyHeader
|
|
42
|
+
* />
|
|
43
|
+
*
|
|
44
|
+
* // With Pagination (filtering/pagination intentionally out of scope)
|
|
45
|
+
* <DataGrid columns={columns} rows={pageRows} loading={isLoading} />
|
|
46
|
+
* <Pagination page={page} totalPages={total} onChange={setPage} />
|
|
47
|
+
*/
|
|
48
|
+
import React from "react";
|
|
49
|
+
import type { BaseProps } from "../../types";
|
|
50
|
+
export interface DataGridColumn {
|
|
51
|
+
key: string;
|
|
52
|
+
label: string;
|
|
53
|
+
sortable?: boolean;
|
|
54
|
+
width?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface DataGridProps extends BaseProps {
|
|
57
|
+
columns: DataGridColumn[];
|
|
58
|
+
rows: Record<string, unknown>[];
|
|
59
|
+
sortKey?: string;
|
|
60
|
+
sortDir?: "asc" | "desc";
|
|
61
|
+
onSort?: (key: string, dir: "asc" | "desc") => void;
|
|
62
|
+
loading?: boolean;
|
|
63
|
+
emptyText?: string;
|
|
64
|
+
stickyHeader?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export declare const DataGrid: React.ForwardRefExoticComponent<DataGridProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @usevyre/react — Tag
|
|
3
|
+
*
|
|
4
|
+
* AI CONTEXT:
|
|
5
|
+
* ┌─────────────────────────────────────────────────────────┐
|
|
6
|
+
* │ Component: Tag │
|
|
7
|
+
* │ Import: import { Tag } from "@usevyre/react" │
|
|
8
|
+
* │ │
|
|
9
|
+
* │ Props: │
|
|
10
|
+
* │ variant = "default"(default)|"accent"|"danger" │
|
|
11
|
+
* │ size = "sm"|"md"(default)|"lg" │
|
|
12
|
+
* │ onRemove = () => void (renders × remove button) │
|
|
13
|
+
* │ onClick = () => void (makes the tag interactive) │
|
|
14
|
+
* │ │
|
|
15
|
+
* │ Standalone display tag/chip. NOT an input — for tag │
|
|
16
|
+
* │ INPUT use TagsInput. Group multiple with TagGroup. │
|
|
17
|
+
* └─────────────────────────────────────────────────────────┘
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <Tag>Design</Tag>
|
|
21
|
+
* <Tag variant="accent" size="lg">Featured</Tag>
|
|
22
|
+
* <Tag onRemove={() => removeFilter("react")}>react</Tag>
|
|
23
|
+
* <Tag onClick={() => toggleFilter("vue")}>vue</Tag>
|
|
24
|
+
*/
|
|
25
|
+
import React from "react";
|
|
26
|
+
import type { BaseProps } from "../../types";
|
|
27
|
+
export type TagVariant = "default" | "accent" | "danger";
|
|
28
|
+
export type TagSize = "sm" | "md" | "lg";
|
|
29
|
+
export interface TagProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "onClick">, BaseProps {
|
|
30
|
+
/** Visual style */
|
|
31
|
+
variant?: TagVariant;
|
|
32
|
+
/** Size scale */
|
|
33
|
+
size?: TagSize;
|
|
34
|
+
/** When provided, renders a × button that calls this on click */
|
|
35
|
+
onRemove?: () => void;
|
|
36
|
+
/** When provided, makes the whole tag interactive (button-like) */
|
|
37
|
+
onClick?: () => void;
|
|
38
|
+
/** Disable interaction (only relevant with onClick or onRemove) */
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare const Tag: React.ForwardRefExoticComponent<TagProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @usevyre/react — TagGroup
|
|
3
|
+
*
|
|
4
|
+
* AI CONTEXT:
|
|
5
|
+
* ┌─────────────────────────────────────────────────────────┐
|
|
6
|
+
* │ Component: TagGroup │
|
|
7
|
+
* │ Import: import { TagGroup, Tag } from "@usevyre/react"│
|
|
8
|
+
* │ │
|
|
9
|
+
* │ Props: │
|
|
10
|
+
* │ gap = "sm"|"md"(default)|"lg" │
|
|
11
|
+
* │ wrap = boolean (default: true) │
|
|
12
|
+
* │ │
|
|
13
|
+
* │ Read-only container that lays out multiple <Tag> │
|
|
14
|
+
* │ elements with wrapping + spacing. For tag INPUT use │
|
|
15
|
+
* │ TagsInput instead. │
|
|
16
|
+
* └─────────────────────────────────────────────────────────┘
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <TagGroup>
|
|
20
|
+
* <Tag>React</Tag>
|
|
21
|
+
* <Tag>Vue</Tag>
|
|
22
|
+
* <Tag variant="accent">TypeScript</Tag>
|
|
23
|
+
* </TagGroup>
|
|
24
|
+
*/
|
|
25
|
+
import React from "react";
|
|
26
|
+
import type { BaseProps } from "../../types";
|
|
27
|
+
export type TagGroupGap = "sm" | "md" | "lg";
|
|
28
|
+
export interface TagGroupProps extends React.HTMLAttributes<HTMLDivElement>, BaseProps {
|
|
29
|
+
/** Spacing between tags */
|
|
30
|
+
gap?: TagGroupGap;
|
|
31
|
+
/** Wrap tags onto multiple lines when they overflow */
|
|
32
|
+
wrap?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const TagGroup: React.ForwardRefExoticComponent<TagGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @usevyre/react — TagsInput
|
|
3
|
+
*
|
|
4
|
+
* AI CONTEXT:
|
|
5
|
+
* ┌─────────────────────────────────────────────────────────┐
|
|
6
|
+
* │ Component: TagsInput │
|
|
7
|
+
* │ Import: import { TagsInput } from "@usevyre/react" │
|
|
8
|
+
* │ │
|
|
9
|
+
* │ Props: │
|
|
10
|
+
* │ value = string[] (controlled) │
|
|
11
|
+
* │ onChange = (tags: string[]) => void │
|
|
12
|
+
* │ placeholder = string │
|
|
13
|
+
* │ disabled = boolean │
|
|
14
|
+
* │ max = number — max tag count │
|
|
15
|
+
* │ size = "sm"|"md"(default)|"lg" │
|
|
16
|
+
* │ │
|
|
17
|
+
* │ Behavior: │
|
|
18
|
+
* │ Enter / comma → add tag (trim, dedupe, skip empty) │
|
|
19
|
+
* │ Backspace on empty input → remove last tag │
|
|
20
|
+
* │ × button on tag → remove that tag │
|
|
21
|
+
* │ When max reached, input is disabled │
|
|
22
|
+
* └─────────────────────────────────────────────────────────┘
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const [tags, setTags] = useState(["react", "typescript"]);
|
|
26
|
+
* <TagsInput value={tags} onChange={setTags} placeholder="Add tag…" max={5} />
|
|
27
|
+
*
|
|
28
|
+
* // Inside a Field
|
|
29
|
+
* <Field label="Skills">
|
|
30
|
+
* <TagsInput value={skills} onChange={setSkills} />
|
|
31
|
+
* </Field>
|
|
32
|
+
*/
|
|
33
|
+
import React from "react";
|
|
34
|
+
import type { BaseProps } from "../../types";
|
|
35
|
+
type TagsInputSize = "sm" | "md" | "lg";
|
|
36
|
+
export interface TagsInputProps extends BaseProps {
|
|
37
|
+
/** Controlled tag list */
|
|
38
|
+
value: string[];
|
|
39
|
+
/** Called with new tag array on every change */
|
|
40
|
+
onChange: (tags: string[]) => void;
|
|
41
|
+
/** Input placeholder (hidden when max reached) */
|
|
42
|
+
placeholder?: string;
|
|
43
|
+
/** Disable all interactions */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** Maximum number of tags allowed */
|
|
46
|
+
max?: number;
|
|
47
|
+
/** Size scale */
|
|
48
|
+
size?: TagsInputSize;
|
|
49
|
+
}
|
|
50
|
+
export declare const TagsInput: React.ForwardRefExoticComponent<TagsInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
51
|
+
export {};
|