ui-foundations 0.4.1 → 0.7.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/LICENSE +73 -0
- package/README.md +49 -13
- package/dist/core/index.css +1 -0
- package/dist/macros/ui.njk +94 -0
- package/dist/main.css +723 -138
- package/dist/react/accordion.js +36 -0
- package/dist/react/avatar.js +34 -0
- package/dist/react/button.js +1 -12
- package/dist/react/checkbox.js +3 -20
- package/dist/react/divider.js +31 -0
- package/dist/react/form.js +111 -0
- package/dist/react/icon.js +1 -12
- package/dist/react/index.js +7 -0
- package/dist/react/input.js +7 -0
- package/dist/react/radio.js +3 -20
- package/dist/react/switch.js +3 -20
- package/dist/react/tabs.js +72 -0
- package/dist/react/textarea.js +45 -0
- package/dist/react/tooltip.js +25 -0
- package/dist/react/warn-dev.js +15 -0
- package/dist/tokens/css/appearance-modes.tokens.mode-dark.css +12 -6
- package/dist/tokens/css/appearance-modes.tokens.mode-light.css +7 -1
- package/dist/tokens/css/components-ui.tokens.css +93 -73
- package/dist/tokens/css/core-primitives.tokens.css +72 -1
- package/dist/tokens/css/semantics-roles.tokens.css +1 -1
- package/dist/tokens/css/themes-brands.tokens.brand-a.css +11 -11
- package/dist/tokens/css/themes-brands.tokens.brand-b.css +1 -1
- package/dist/tokens/css/themes-brands.tokens.brand-c.css +22 -0
- package/dist/tokens/json/appearance-modes.tokens.mode-dark.json +24 -0
- package/dist/tokens/json/appearance-modes.tokens.mode-light.json +24 -0
- package/dist/tokens/json/components-ui.tokens.json +403 -269
- package/dist/tokens/json/core-primitives.tokens.json +302 -0
- package/dist/tokens/json/themes-brands.tokens.brand-a.json +10 -10
- package/dist/tokens/json/themes-brands.tokens.brand-b.json +10 -10
- package/dist/tokens/json/themes-brands.tokens.brand-c.json +81 -0
- package/dist/tokens/tokens.yaml +2138 -578
- package/dist/tokens/ts/appearance-modes.tokens.mode-dark.ts +12 -6
- package/dist/tokens/ts/appearance-modes.tokens.mode-light.ts +7 -1
- package/dist/tokens/ts/components-ui.tokens.ts +94 -74
- package/dist/tokens/ts/core-primitives.tokens.ts +73 -2
- package/dist/tokens/ts/semantics-roles.tokens.ts +1 -1
- package/dist/tokens/ts/themes-brands.tokens.brand-a.ts +11 -11
- package/dist/tokens/ts/themes-brands.tokens.brand-b.ts +1 -1
- package/dist/tokens/ts/themes-brands.tokens.brand-c.ts +32 -0
- package/dist/ui/index.css +7 -0
- package/dist/ui/patterns/accordion.css +81 -0
- package/dist/ui/patterns/avatar.css +57 -0
- package/dist/ui/patterns/button.css +3 -3
- package/dist/ui/patterns/checkbox.css +28 -28
- package/dist/ui/patterns/divider.css +25 -0
- package/dist/ui/patterns/form.css +112 -0
- package/dist/ui/patterns/input.css +12 -12
- package/dist/ui/patterns/label.css +1 -1
- package/dist/ui/patterns/tabs.css +71 -0
- package/dist/ui/patterns/textarea.css +50 -0
- package/dist/ui/patterns/tooltip.css +64 -0
- package/docs/agentic/README.md +1 -0
- package/docs/agentic/skills/component-accessibility-audit.md +132 -0
- package/docs/foundations/foundation-007-typography-selectors-and-specificity.md +1 -1
- package/package.json +15 -3
- package/dist/tokens/missing-tokens.json +0 -43
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Accordion — expandable/collapsible content sections using native details/summary.
|
|
5
|
+
*
|
|
6
|
+
* @param {object} props
|
|
7
|
+
* @param {string} [props.className=""] - Additional CSS classes
|
|
8
|
+
*/
|
|
9
|
+
export function Accordion({ className = "", children, ...props }) {
|
|
10
|
+
const classes = ["accordion"];
|
|
11
|
+
if (className) classes.push(className);
|
|
12
|
+
|
|
13
|
+
return React.createElement("div", { className: classes.join(" "), ...props }, children);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* AccordionItem — single expandable section.
|
|
18
|
+
*
|
|
19
|
+
* @param {object} props
|
|
20
|
+
* @param {string} props.title - Summary/trigger text
|
|
21
|
+
* @param {boolean} [props.open=false] - Whether expanded
|
|
22
|
+
* @param {boolean} [props.disabled=false] - Whether disabled
|
|
23
|
+
* @param {string} [props.className=""] - Additional CSS classes
|
|
24
|
+
*/
|
|
25
|
+
export function AccordionItem({ title, open = false, disabled = false, className = "", children, ...props }) {
|
|
26
|
+
const classes = ["accordion-item"];
|
|
27
|
+
if (disabled) classes.push("is-disabled");
|
|
28
|
+
if (className) classes.push(className);
|
|
29
|
+
|
|
30
|
+
return React.createElement(
|
|
31
|
+
"details",
|
|
32
|
+
{ className: classes.join(" "), open, ...props },
|
|
33
|
+
React.createElement("summary", null, title),
|
|
34
|
+
React.createElement("div", { className: "accordion-item__content" }, children)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Avatar — thumbnail representation of a user or entity.
|
|
5
|
+
*
|
|
6
|
+
* @param {object} props
|
|
7
|
+
* @param {string} [props.src] - Image URL
|
|
8
|
+
* @param {string} [props.alt=""] - Alt text for image
|
|
9
|
+
* @param {string} [props.initials=""] - Fallback initials when no image
|
|
10
|
+
* @param {"xs"|"sm"|"md"|"lg"|"xl"} [props.size="md"] - Size variant
|
|
11
|
+
* @param {string} [props.className=""] - Additional CSS classes
|
|
12
|
+
*/
|
|
13
|
+
export function Avatar({
|
|
14
|
+
src,
|
|
15
|
+
alt = "",
|
|
16
|
+
initials = "",
|
|
17
|
+
size = "md",
|
|
18
|
+
className = "",
|
|
19
|
+
...props
|
|
20
|
+
}) {
|
|
21
|
+
const classes = ["avatar"];
|
|
22
|
+
if (size && size !== "md") classes.push(size);
|
|
23
|
+
if (className) classes.push(className);
|
|
24
|
+
|
|
25
|
+
const children = src
|
|
26
|
+
? React.createElement("img", { src, alt })
|
|
27
|
+
: React.createElement("span", { className: "avatar__initials" }, initials);
|
|
28
|
+
|
|
29
|
+
return React.createElement(
|
|
30
|
+
"span",
|
|
31
|
+
{ className: classes.join(" "), role: "img", "aria-label": alt || initials, ...props },
|
|
32
|
+
children
|
|
33
|
+
);
|
|
34
|
+
}
|
package/dist/react/button.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { LabelContent, hasTextContent } from "./label.js";
|
|
3
|
+
import { warnDev } from "./warn-dev.js";
|
|
3
4
|
|
|
4
5
|
function normalizeOrientation(value) {
|
|
5
6
|
return value === "vertical" ? "vertical" : "horizontal";
|
|
@@ -9,18 +10,6 @@ function normalizeJustify(value) {
|
|
|
9
10
|
return value === "stretch" ? "stretch" : "start";
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
function warnDev(message) {
|
|
13
|
-
if (
|
|
14
|
-
typeof process !== "undefined" &&
|
|
15
|
-
process.env &&
|
|
16
|
-
process.env.NODE_ENV === "production"
|
|
17
|
-
) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
console.warn(message);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
13
|
export function Button({
|
|
25
14
|
variant = "solid",
|
|
26
15
|
className = "",
|
package/dist/react/checkbox.js
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (value === null || value === undefined || value === false) return false;
|
|
5
|
-
if (typeof value === "string") return value.trim().length > 0;
|
|
6
|
-
if (Array.isArray(value)) return value.some(hasLabelContent);
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function warnDev(message) {
|
|
11
|
-
if (
|
|
12
|
-
typeof process !== "undefined" &&
|
|
13
|
-
process.env &&
|
|
14
|
-
process.env.NODE_ENV === "production"
|
|
15
|
-
) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
console.warn(message);
|
|
20
|
-
}
|
|
2
|
+
import { hasTextContent } from "./label.js";
|
|
3
|
+
import { warnDev } from "./warn-dev.js";
|
|
21
4
|
|
|
22
5
|
export function Checkbox({
|
|
23
6
|
className = "",
|
|
@@ -32,7 +15,7 @@ export function Checkbox({
|
|
|
32
15
|
if (className) classes.push(className);
|
|
33
16
|
|
|
34
17
|
const content = children ?? label;
|
|
35
|
-
const hasLabel =
|
|
18
|
+
const hasLabel = hasTextContent(content);
|
|
36
19
|
const disabled = Boolean(props.disabled);
|
|
37
20
|
const inputRef = React.useRef(null);
|
|
38
21
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Divider — visual separator between content sections.
|
|
5
|
+
*
|
|
6
|
+
* @param {object} props
|
|
7
|
+
* @param {"horizontal"|"vertical"} [props.orientation="horizontal"] - Orientation
|
|
8
|
+
* @param {"subtle"|""} [props.variant=""] - Color variant
|
|
9
|
+
* @param {string} [props.className=""] - Additional CSS classes
|
|
10
|
+
*/
|
|
11
|
+
export function Divider({
|
|
12
|
+
orientation = "horizontal",
|
|
13
|
+
variant = "",
|
|
14
|
+
className = "",
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
const classes = ["divider"];
|
|
18
|
+
if (variant) classes.push(variant);
|
|
19
|
+
if (className) classes.push(className);
|
|
20
|
+
|
|
21
|
+
const elementProps = {
|
|
22
|
+
className: classes.join(" "),
|
|
23
|
+
...props,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
if (orientation === "vertical") {
|
|
27
|
+
elementProps["aria-orientation"] = "vertical";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return React.createElement("hr", elementProps);
|
|
31
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Form — layout container for form fields.
|
|
5
|
+
*
|
|
6
|
+
* @param {object} props
|
|
7
|
+
* @param {boolean} [props.borderless=false] - Remove border and background
|
|
8
|
+
* @param {string} [props.className=""] - Additional class names
|
|
9
|
+
* @param {React.ReactNode} props.children - Form content
|
|
10
|
+
*/
|
|
11
|
+
export function Form({
|
|
12
|
+
borderless = false,
|
|
13
|
+
className = "",
|
|
14
|
+
children,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
const classes = ["form"];
|
|
18
|
+
if (borderless) classes.push("borderless");
|
|
19
|
+
if (className) classes.push(className);
|
|
20
|
+
|
|
21
|
+
return React.createElement(
|
|
22
|
+
"form",
|
|
23
|
+
{ className: classes.join(" "), noValidate: true, ...props },
|
|
24
|
+
children,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* FormGroup — groups related fields with an optional title.
|
|
30
|
+
*
|
|
31
|
+
* @param {object} props
|
|
32
|
+
* @param {string} [props.title=""] - Group legend
|
|
33
|
+
* @param {string} [props.className=""] - Additional class names
|
|
34
|
+
* @param {React.ReactNode} props.children - Grouped fields
|
|
35
|
+
*/
|
|
36
|
+
export function FormGroup({ title = "", className = "", children, ...props }) {
|
|
37
|
+
const classes = ["form-group"];
|
|
38
|
+
if (className) classes.push(className);
|
|
39
|
+
|
|
40
|
+
return React.createElement(
|
|
41
|
+
"fieldset",
|
|
42
|
+
{ className: classes.join(" "), ...props },
|
|
43
|
+
title
|
|
44
|
+
? React.createElement("legend", { className: "form-group__title" }, title)
|
|
45
|
+
: null,
|
|
46
|
+
children,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* FormField — single field wrapper with optional side label layout.
|
|
52
|
+
*
|
|
53
|
+
* @param {object} props
|
|
54
|
+
* @param {"top"|"side"} [props.labelPosition="top"] - Label placement
|
|
55
|
+
* @param {boolean} [props.invalid=false] - Show invalid state
|
|
56
|
+
* @param {string} [props.className=""] - Additional class names
|
|
57
|
+
* @param {React.ReactNode} props.children - Label + input + helper
|
|
58
|
+
*/
|
|
59
|
+
export function FormField({
|
|
60
|
+
labelPosition = "top",
|
|
61
|
+
invalid = false,
|
|
62
|
+
className = "",
|
|
63
|
+
children,
|
|
64
|
+
...props
|
|
65
|
+
}) {
|
|
66
|
+
const classes = ["form-field"];
|
|
67
|
+
if (invalid) classes.push("is-invalid");
|
|
68
|
+
if (className) classes.push(className);
|
|
69
|
+
|
|
70
|
+
const attrs = { className: classes.join(" "), ...props };
|
|
71
|
+
if (labelPosition === "side") attrs["data-label-position"] = "side";
|
|
72
|
+
|
|
73
|
+
return React.createElement("div", attrs, children);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* FormHelper — helper or error text below a field.
|
|
78
|
+
*
|
|
79
|
+
* @param {object} props
|
|
80
|
+
* @param {string} props.text - Helper message
|
|
81
|
+
*/
|
|
82
|
+
export function FormHelper({ text, ...props }) {
|
|
83
|
+
return React.createElement(
|
|
84
|
+
"p",
|
|
85
|
+
{ className: "form-field__helper", ...props },
|
|
86
|
+
text,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* FormActions — button area at the bottom of a form.
|
|
92
|
+
*
|
|
93
|
+
* @param {object} props
|
|
94
|
+
* @param {"start"|"end"|"stretch"} [props.align="end"] - Button alignment
|
|
95
|
+
* @param {string} [props.className=""] - Additional class names
|
|
96
|
+
* @param {React.ReactNode} props.children - Action buttons
|
|
97
|
+
*/
|
|
98
|
+
export function FormActions({
|
|
99
|
+
align = "end",
|
|
100
|
+
className = "",
|
|
101
|
+
children,
|
|
102
|
+
...props
|
|
103
|
+
}) {
|
|
104
|
+
const classes = ["form-actions"];
|
|
105
|
+
if (className) classes.push(className);
|
|
106
|
+
|
|
107
|
+
const attrs = { className: classes.join(" "), ...props };
|
|
108
|
+
if (align !== "end") attrs["data-align"] = align;
|
|
109
|
+
|
|
110
|
+
return React.createElement("div", attrs, children);
|
|
111
|
+
}
|
package/dist/react/icon.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { warnDev } from "./warn-dev.js";
|
|
2
3
|
|
|
3
4
|
function resolveIconUrl(name, folder, src) {
|
|
4
5
|
if (src) return src;
|
|
@@ -11,18 +12,6 @@ function humanizeName(name) {
|
|
|
11
12
|
.trim();
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
function warnDev(message) {
|
|
15
|
-
if (
|
|
16
|
-
typeof process !== "undefined" &&
|
|
17
|
-
process.env &&
|
|
18
|
-
process.env.NODE_ENV === "production"
|
|
19
|
-
) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
console.warn(message);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
15
|
export function Icon({
|
|
27
16
|
name,
|
|
28
17
|
src,
|
package/dist/react/index.js
CHANGED
|
@@ -6,3 +6,10 @@ export { LabelContent, FieldLabel } from "./label.js";
|
|
|
6
6
|
export { Radio } from "./radio.js";
|
|
7
7
|
export { Switch } from "./switch.js";
|
|
8
8
|
export { Badge } from "./badge.js";
|
|
9
|
+
export { Divider } from "./divider.js";
|
|
10
|
+
export { TextArea } from "./textarea.js";
|
|
11
|
+
export { Avatar } from "./avatar.js";
|
|
12
|
+
export { Accordion, AccordionItem } from "./accordion.js";
|
|
13
|
+
export { TabList, Tab, TabPanel } from "./tabs.js";
|
|
14
|
+
export { Tooltip } from "./tooltip.js";
|
|
15
|
+
export { Form, FormGroup, FormField, FormHelper, FormActions } from "./form.js";
|
package/dist/react/input.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { warnDev } from "./warn-dev.js";
|
|
2
3
|
|
|
3
4
|
export function Input({ className = "", type = "text", ...props }) {
|
|
4
5
|
const classes = ["input"];
|
|
5
6
|
if (className) classes.push(className);
|
|
6
7
|
|
|
8
|
+
if (!props["aria-label"] && !props["aria-labelledby"] && !props.id) {
|
|
9
|
+
warnDev(
|
|
10
|
+
"[ui-foundations] Input should be associated with a label via `id`, or include `aria-label`/`aria-labelledby`.",
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
return React.createElement("input", {
|
|
8
15
|
type,
|
|
9
16
|
className: classes.join(" "),
|
package/dist/react/radio.js
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (value === null || value === undefined || value === false) return false;
|
|
5
|
-
if (typeof value === "string") return value.trim().length > 0;
|
|
6
|
-
if (Array.isArray(value)) return value.some(hasLabelContent);
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function warnDev(message) {
|
|
11
|
-
if (
|
|
12
|
-
typeof process !== "undefined" &&
|
|
13
|
-
process.env &&
|
|
14
|
-
process.env.NODE_ENV === "production"
|
|
15
|
-
) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
console.warn(message);
|
|
20
|
-
}
|
|
2
|
+
import { hasTextContent } from "./label.js";
|
|
3
|
+
import { warnDev } from "./warn-dev.js";
|
|
21
4
|
|
|
22
5
|
export function Radio({
|
|
23
6
|
className = "",
|
|
@@ -30,7 +13,7 @@ export function Radio({
|
|
|
30
13
|
if (className) classes.push(className);
|
|
31
14
|
|
|
32
15
|
const content = children ?? label;
|
|
33
|
-
const hasLabel =
|
|
16
|
+
const hasLabel = hasTextContent(content);
|
|
34
17
|
const disabled = Boolean(props.disabled);
|
|
35
18
|
|
|
36
19
|
const input = React.createElement("input", {
|
package/dist/react/switch.js
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (value === null || value === undefined || value === false) return false;
|
|
5
|
-
if (typeof value === "string") return value.trim().length > 0;
|
|
6
|
-
if (Array.isArray(value)) return value.some(hasLabelContent);
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function warnDev(message) {
|
|
11
|
-
if (
|
|
12
|
-
typeof process !== "undefined" &&
|
|
13
|
-
process.env &&
|
|
14
|
-
process.env.NODE_ENV === "production"
|
|
15
|
-
) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
console.warn(message);
|
|
20
|
-
}
|
|
2
|
+
import { hasTextContent } from "./label.js";
|
|
3
|
+
import { warnDev } from "./warn-dev.js";
|
|
21
4
|
|
|
22
5
|
export function Switch({
|
|
23
6
|
className = "",
|
|
@@ -31,7 +14,7 @@ export function Switch({
|
|
|
31
14
|
if (className) classes.push(className);
|
|
32
15
|
|
|
33
16
|
const content = children ?? label;
|
|
34
|
-
const hasLabel =
|
|
17
|
+
const hasLabel = hasTextContent(content);
|
|
35
18
|
const disabled = Boolean(props.disabled);
|
|
36
19
|
const input = React.createElement("input", {
|
|
37
20
|
type: "checkbox",
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TabList — container for tab buttons.
|
|
5
|
+
*
|
|
6
|
+
* @param {object} props
|
|
7
|
+
* @param {"horizontal"|"vertical"} [props.orientation="horizontal"]
|
|
8
|
+
* @param {string} [props.ariaLabel=""] - Accessible label
|
|
9
|
+
* @param {string} [props.className=""] - Additional CSS classes
|
|
10
|
+
*/
|
|
11
|
+
export function TabList({ orientation = "horizontal", ariaLabel = "", className = "", children, ...props }) {
|
|
12
|
+
const classes = ["tab-list"];
|
|
13
|
+
if (className) classes.push(className);
|
|
14
|
+
|
|
15
|
+
const elementProps = {
|
|
16
|
+
className: classes.join(" "),
|
|
17
|
+
role: "tablist",
|
|
18
|
+
"aria-orientation": orientation,
|
|
19
|
+
...props,
|
|
20
|
+
};
|
|
21
|
+
if (ariaLabel) elementProps["aria-label"] = ariaLabel;
|
|
22
|
+
|
|
23
|
+
return React.createElement("div", elementProps, children);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Tab — individual tab button.
|
|
28
|
+
*
|
|
29
|
+
* @param {object} props
|
|
30
|
+
* @param {string} props.label - Tab label text
|
|
31
|
+
* @param {boolean} [props.selected=false] - Whether active
|
|
32
|
+
* @param {boolean} [props.disabled=false] - Whether disabled
|
|
33
|
+
* @param {string} [props.controls=""] - ID of controlled panel
|
|
34
|
+
* @param {string} [props.className=""] - Additional CSS classes
|
|
35
|
+
*/
|
|
36
|
+
export function Tab({ label, selected = false, disabled = false, controls = "", className = "", ...props }) {
|
|
37
|
+
const classes = ["tab"];
|
|
38
|
+
if (className) classes.push(className);
|
|
39
|
+
|
|
40
|
+
return React.createElement("button", {
|
|
41
|
+
className: classes.join(" "),
|
|
42
|
+
role: "tab",
|
|
43
|
+
type: "button",
|
|
44
|
+
"aria-selected": String(selected),
|
|
45
|
+
"aria-controls": controls || undefined,
|
|
46
|
+
disabled,
|
|
47
|
+
tabIndex: selected ? 0 : -1,
|
|
48
|
+
...props,
|
|
49
|
+
}, label);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* TabPanel — content panel associated with a tab.
|
|
54
|
+
*
|
|
55
|
+
* @param {object} props
|
|
56
|
+
* @param {string} [props.id=""] - Panel ID (referenced by tab's aria-controls)
|
|
57
|
+
* @param {boolean} [props.hidden=false] - Whether hidden
|
|
58
|
+
* @param {string} [props.className=""] - Additional CSS classes
|
|
59
|
+
*/
|
|
60
|
+
export function TabPanel({ id = "", hidden = false, className = "", children, ...props }) {
|
|
61
|
+
const classes = ["tab-panel"];
|
|
62
|
+
if (className) classes.push(className);
|
|
63
|
+
|
|
64
|
+
return React.createElement("div", {
|
|
65
|
+
className: classes.join(" "),
|
|
66
|
+
role: "tabpanel",
|
|
67
|
+
id: id || undefined,
|
|
68
|
+
hidden,
|
|
69
|
+
tabIndex: 0,
|
|
70
|
+
...props,
|
|
71
|
+
}, children);
|
|
72
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { warnDev } from "./warn-dev.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* TextArea — multi-line text input.
|
|
6
|
+
*
|
|
7
|
+
* @param {object} props
|
|
8
|
+
* @param {string} [props.placeholder=""] - Placeholder text
|
|
9
|
+
* @param {string} [props.value] - Controlled value
|
|
10
|
+
* @param {boolean} [props.disabled=false] - Disabled state
|
|
11
|
+
* @param {boolean} [props.readonly=false] - Readonly state
|
|
12
|
+
* @param {number} [props.rows] - Visible rows
|
|
13
|
+
* @param {string} [props.className=""] - Additional CSS classes
|
|
14
|
+
*/
|
|
15
|
+
export function TextArea({
|
|
16
|
+
placeholder = "",
|
|
17
|
+
value,
|
|
18
|
+
disabled = false,
|
|
19
|
+
readonly = false,
|
|
20
|
+
rows,
|
|
21
|
+
className = "",
|
|
22
|
+
...props
|
|
23
|
+
}) {
|
|
24
|
+
const classes = ["textarea"];
|
|
25
|
+
if (className) classes.push(className);
|
|
26
|
+
|
|
27
|
+
if (!props["aria-label"] && !props["aria-labelledby"] && !props.id) {
|
|
28
|
+
warnDev(
|
|
29
|
+
"[ui-foundations] TextArea should be associated with a label via `id`, or include `aria-label`/`aria-labelledby`.",
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const elementProps = {
|
|
34
|
+
className: classes.join(" "),
|
|
35
|
+
placeholder,
|
|
36
|
+
disabled,
|
|
37
|
+
readOnly: readonly,
|
|
38
|
+
...props,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
if (value !== undefined) elementProps.value = value;
|
|
42
|
+
if (rows) elementProps.rows = rows;
|
|
43
|
+
|
|
44
|
+
return React.createElement("textarea", elementProps);
|
|
45
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Tooltip — contextual help text on hover/focus.
|
|
5
|
+
*
|
|
6
|
+
* @param {object} props
|
|
7
|
+
* @param {string} props.text - Tooltip content
|
|
8
|
+
* @param {"top"|"bottom"|"left"|"right"} [props.placement="top"] - Position
|
|
9
|
+
* @param {string} [props.className=""] - Additional CSS classes
|
|
10
|
+
*/
|
|
11
|
+
export function Tooltip({ text, placement = "top", className = "", children, ...props }) {
|
|
12
|
+
const triggerClasses = ["tooltip-trigger"];
|
|
13
|
+
if (className) triggerClasses.push(className);
|
|
14
|
+
|
|
15
|
+
return React.createElement(
|
|
16
|
+
"span",
|
|
17
|
+
{ className: triggerClasses.join(" "), ...props },
|
|
18
|
+
children,
|
|
19
|
+
React.createElement(
|
|
20
|
+
"span",
|
|
21
|
+
{ className: "tooltip", role: "tooltip", "data-placement": placement },
|
|
22
|
+
text
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log a warning in non-production environments.
|
|
3
|
+
* Shared across React wrappers to avoid copy-pasting the same guard.
|
|
4
|
+
*/
|
|
5
|
+
export function warnDev(message) {
|
|
6
|
+
if (
|
|
7
|
+
typeof process !== "undefined" &&
|
|
8
|
+
process.env &&
|
|
9
|
+
process.env.NODE_ENV === "production"
|
|
10
|
+
) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
console.warn(message);
|
|
15
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Auto-generated design tokens from Figma */
|
|
2
|
-
/* Generated on 2026-
|
|
2
|
+
/* Generated on 2026-06-06T14:29:01.170Z */
|
|
3
3
|
|
|
4
4
|
:root[data-mode="dark"] {
|
|
5
5
|
--color-text-default: var(--color-neutral-800);
|
|
@@ -10,9 +10,15 @@
|
|
|
10
10
|
--color-text-strong: var(--color-neutral-1000);
|
|
11
11
|
--color-text-danger: var(--brand-color-functional-danger);
|
|
12
12
|
--color-text-success: var(--brand-color-functional-success);
|
|
13
|
+
--color-text-on-brand: var(--color-neutral-000);
|
|
14
|
+
--color-text-on-danger: var(--color-neutral-000);
|
|
15
|
+
--color-text-on-success: var(--color-neutral-000);
|
|
16
|
+
--color-text-on-subtle: var(--brand-color-primary-dark);
|
|
17
|
+
--color-text-on-active: var(--color-neutral-000);
|
|
18
|
+
--color-text-on-disabled: var(--color-neutral-800);
|
|
13
19
|
--color-fill-surface: var(--color-neutral-1000);
|
|
14
20
|
--color-fill-disabled: var(--color-neutral-300);
|
|
15
|
-
--color-fill-hover: var(--color-neutral-alpha-
|
|
21
|
+
--color-fill-hover: var(--color-neutral-alpha-inverse-100);
|
|
16
22
|
--color-fill-brand: var(--brand-color-primary);
|
|
17
23
|
--color-fill-subtle: var(--brand-color-subtle);
|
|
18
24
|
--color-fill-active: var(--brand-color-accent);
|
|
@@ -24,9 +30,9 @@
|
|
|
24
30
|
--color-border-brand: var(--brand-color-primary);
|
|
25
31
|
--color-border-disabled: var(--color-neutral-500);
|
|
26
32
|
--color-border-danger: var(--brand-color-functional-danger);
|
|
27
|
-
--color-overlay-backdrop: var(--color-neutral-alpha-400);
|
|
28
|
-
--color-overlay-hover: var(--color-neutral-alpha-
|
|
29
|
-
--color-overlay-active: var(--color-neutral-alpha-
|
|
30
|
-
--color-overlay-selected: var(--color-neutral-alpha-
|
|
33
|
+
--color-overlay-backdrop: var(--color-neutral-alpha-inverse-400);
|
|
34
|
+
--color-overlay-hover: var(--color-neutral-alpha-inverse-100);
|
|
35
|
+
--color-overlay-active: var(--color-neutral-alpha-inverse-200);
|
|
36
|
+
--color-overlay-selected: var(--color-neutral-alpha-inverse-300);
|
|
31
37
|
--color-focus: var(--brand-color-primary-dark);
|
|
32
38
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Auto-generated design tokens from Figma */
|
|
2
|
-
/* Generated on 2026-
|
|
2
|
+
/* Generated on 2026-06-06T14:29:01.166Z */
|
|
3
3
|
|
|
4
4
|
:root {
|
|
5
5
|
--color-text-default: var(--color-neutral-800);
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
--color-text-strong: var(--color-neutral-1000);
|
|
11
11
|
--color-text-danger: var(--brand-color-functional-danger);
|
|
12
12
|
--color-text-success: var(--brand-color-functional-success);
|
|
13
|
+
--color-text-on-brand: var(--color-neutral-000);
|
|
14
|
+
--color-text-on-danger: var(--color-neutral-000);
|
|
15
|
+
--color-text-on-success: var(--color-neutral-000);
|
|
16
|
+
--color-text-on-subtle: var(--brand-color-primary);
|
|
17
|
+
--color-text-on-active: var(--color-neutral-000);
|
|
18
|
+
--color-text-on-disabled: var(--color-neutral-800);
|
|
13
19
|
--color-fill-surface: var(--color-neutral-000);
|
|
14
20
|
--color-fill-disabled: var(--color-neutral-300);
|
|
15
21
|
--color-fill-hover: var(--color-neutral-alpha-500);
|