@usevyre/react 1.0.3 → 1.2.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.
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @usevyre/react — Radio
3
+ *
4
+ * AI CONTEXT:
5
+ * ┌─────────────────────────────────────────────────────────────────┐
6
+ * │ Component: RadioGroup + Radio │
7
+ * │ Import: import { RadioGroup, Radio } from "@usevyre/react" │
8
+ * │ │
9
+ * │ CONTROLLED. RadioGroup owns the selected value. │
10
+ * │ │
11
+ * │ RadioGroup props: │
12
+ * │ value = string (controlled selected value) │
13
+ * │ defaultValue = string (uncontrolled) │
14
+ * │ onChange = (value: string) => void │
15
+ * │ name? = string (radio group name; auto if omitted) │
16
+ * │ disabled? = boolean (disables the whole group) │
17
+ * │ size? = "sm" | "md"(default) │
18
+ * │ orientation? = "vertical"(default) | "horizontal" │
19
+ * │ options? = { value; label; description?; disabled? }[] │
20
+ * │ → data-driven; OR pass <Radio> children for custom layout │
21
+ * │ │
22
+ * │ Radio props (inside RadioGroup): │
23
+ * │ value = string (required) │
24
+ * │ label? = string │
25
+ * │ description? = string │
26
+ * │ disabled? = boolean │
27
+ * │ │
28
+ * │ Use options for simple lists; use <Radio> children when you │
29
+ * │ need custom content. role="radiogroup" + arrow-key roving focus. │
30
+ * └─────────────────────────────────────────────────────────────────┘
31
+ *
32
+ * @example
33
+ * // Data-driven
34
+ * <RadioGroup
35
+ * value={plan}
36
+ * onChange={setPlan}
37
+ * options={[
38
+ * { value: "free", label: "Free", description: "For hobby projects" },
39
+ * { value: "pro", label: "Pro", description: "For teams" },
40
+ * ]}
41
+ * />
42
+ *
43
+ * // Composable
44
+ * <RadioGroup value={plan} onChange={setPlan}>
45
+ * <Radio value="free" label="Free" />
46
+ * <Radio value="pro" label="Pro" />
47
+ * </RadioGroup>
48
+ */
49
+ import React from "react";
50
+ import type { BaseProps } from "../../types";
51
+ export interface RadioOption {
52
+ value: string;
53
+ label?: string;
54
+ description?: string;
55
+ disabled?: boolean;
56
+ }
57
+ type RadioSize = "sm" | "md";
58
+ export interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange">, BaseProps {
59
+ value?: string;
60
+ defaultValue?: string;
61
+ onChange?: (value: string) => void;
62
+ name?: string;
63
+ disabled?: boolean;
64
+ size?: RadioSize;
65
+ orientation?: "vertical" | "horizontal";
66
+ /** Data-driven options. Omit to pass <Radio> children instead. */
67
+ options?: RadioOption[];
68
+ }
69
+ export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
70
+ export interface RadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "size" | "value" | "type">, BaseProps {
71
+ value: string;
72
+ label?: string;
73
+ description?: string;
74
+ disabled?: boolean;
75
+ }
76
+ export declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>>;
77
+ export {};
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @usevyre/react — RichTextEditor
3
+ *
4
+ * AI CONTEXT:
5
+ * ┌─────────────────────────────────────────────────────────────────┐
6
+ * │ Component: RichTextEditor (WYSIWYG, contentEditable) │
7
+ * │ Import: import { RichTextEditor } from "@usevyre/react" │
8
+ * │ │
9
+ * │ CONTROLLED. value is an HTML string; onChange gives next HTML. │
10
+ * │ Zero dependencies — native contentEditable + execCommand. │
11
+ * │ │
12
+ * │ Props: │
13
+ * │ value = string (HTML, controlled) │
14
+ * │ onChange = (html: string) => void │
15
+ * │ placeholder?= string (shown when empty) │
16
+ * │ disabled? = boolean (not editable, dimmed) │
17
+ * │ readOnly? = boolean (not editable, no toolbar) │
18
+ * │ toolbar? = RichTextTool[] (which buttons; default = all) │
19
+ * │ minHeight? = string (CSS, default "10rem") │
20
+ * │ │
21
+ * │ RichTextTool = "bold"|"italic"|"underline"|"strike"| │
22
+ * │ "h1"|"h2"|"h3"|"ul"|"ol"|"quote"|"code"|"link"|"clear" │
23
+ * │ │
24
+ * │ Controlled: store value in state and set it in onChange. │
25
+ * │ Output is sanitised-friendly semantic HTML (no inline styles). │
26
+ * └─────────────────────────────────────────────────────────────────┘
27
+ *
28
+ * @example
29
+ * const [html, setHtml] = useState("<p>Hello <strong>world</strong></p>");
30
+ * <RichTextEditor value={html} onChange={setHtml} placeholder="Write…" />
31
+ */
32
+ import React from "react";
33
+ import type { BaseProps } from "../../types";
34
+ export type RichTextTool = "bold" | "italic" | "underline" | "strike" | "h1" | "h2" | "h3" | "ul" | "ol" | "quote" | "code" | "link" | "clear";
35
+ export interface RichTextEditorProps extends BaseProps {
36
+ value: string;
37
+ onChange: (html: string) => void;
38
+ placeholder?: string;
39
+ disabled?: boolean;
40
+ readOnly?: boolean;
41
+ toolbar?: RichTextTool[];
42
+ minHeight?: string;
43
+ }
44
+ export declare const RichTextEditor: React.ForwardRefExoticComponent<RichTextEditorProps & 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 {};