@tensor_1/react 2.0.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/chart.cjs +127 -0
- package/dist/chart.d.cts +24 -0
- package/dist/chart.d.ts +3 -0
- package/dist/chart.js +5 -0
- package/dist/components/Alert.d.ts +13 -0
- package/dist/components/Alert.js +14 -0
- package/dist/components/AppShell.d.ts +12 -0
- package/dist/components/AppShell.js +12 -0
- package/dist/components/Avatar.d.ts +30 -0
- package/dist/components/Avatar.js +26 -0
- package/dist/components/Button.d.ts +18 -0
- package/dist/components/Button.js +30 -0
- package/dist/components/Card.d.ts +13 -0
- package/dist/components/Card.js +19 -0
- package/dist/components/Chart.d.ts +24 -0
- package/dist/components/Chart.js +83 -0
- package/dist/components/Checkbox.d.ts +10 -0
- package/dist/components/Checkbox.js +35 -0
- package/dist/components/CommandPalette.d.ts +30 -0
- package/dist/components/CommandPalette.js +26 -0
- package/dist/components/Comments.d.ts +19 -0
- package/dist/components/Comments.js +22 -0
- package/dist/components/DetailLayout.d.ts +16 -0
- package/dist/components/DetailLayout.js +11 -0
- package/dist/components/Drawer.d.ts +14 -0
- package/dist/components/Drawer.js +27 -0
- package/dist/components/Field.d.ts +16 -0
- package/dist/components/Field.js +14 -0
- package/dist/components/Input.d.ts +18 -0
- package/dist/components/Input.js +38 -0
- package/dist/components/Kanban.d.ts +21 -0
- package/dist/components/Kanban.js +26 -0
- package/dist/components/Label.d.ts +13 -0
- package/dist/components/Label.js +12 -0
- package/dist/components/List.d.ts +21 -0
- package/dist/components/List.js +21 -0
- package/dist/components/Modal.d.ts +15 -0
- package/dist/components/Modal.js +19 -0
- package/dist/components/PageHeader.d.ts +18 -0
- package/dist/components/PageHeader.js +15 -0
- package/dist/components/Pagination.d.ts +11 -0
- package/dist/components/Pagination.js +53 -0
- package/dist/components/Peek.d.ts +17 -0
- package/dist/components/Peek.js +34 -0
- package/dist/components/Popover.d.ts +18 -0
- package/dist/components/Popover.js +9 -0
- package/dist/components/Progress.d.ts +14 -0
- package/dist/components/Progress.js +20 -0
- package/dist/components/Prose.d.ts +21 -0
- package/dist/components/Prose.js +15 -0
- package/dist/components/Radio.d.ts +14 -0
- package/dist/components/Radio.js +18 -0
- package/dist/components/Select.d.ts +9 -0
- package/dist/components/Select.js +17 -0
- package/dist/components/Sidebar.d.ts +39 -0
- package/dist/components/Sidebar.js +89 -0
- package/dist/components/Spinner.d.ts +10 -0
- package/dist/components/Spinner.js +16 -0
- package/dist/components/Stat.d.ts +21 -0
- package/dist/components/Stat.js +18 -0
- package/dist/components/States.d.ts +38 -0
- package/dist/components/States.js +43 -0
- package/dist/components/StatusPill.d.ts +15 -0
- package/dist/components/StatusPill.js +18 -0
- package/dist/components/Switch.d.ts +9 -0
- package/dist/components/Switch.js +14 -0
- package/dist/components/Table.d.ts +34 -0
- package/dist/components/Table.js +62 -0
- package/dist/components/Tabs.d.ts +19 -0
- package/dist/components/Tabs.js +31 -0
- package/dist/components/Textarea.d.ts +9 -0
- package/dist/components/Textarea.js +18 -0
- package/dist/components/Timeline.d.ts +16 -0
- package/dist/components/Timeline.js +21 -0
- package/dist/components/Toast.d.ts +19 -0
- package/dist/components/Toast.js +29 -0
- package/dist/components/Tooltip.d.ts +16 -0
- package/dist/components/Tooltip.js +7 -0
- package/dist/components/Tree.d.ts +28 -0
- package/dist/components/Tree.js +69 -0
- package/dist/cx.d.ts +3 -0
- package/dist/cx.js +6 -0
- package/dist/hooks/useDialog.d.ts +3 -0
- package/dist/hooks/useDialog.js +21 -0
- package/dist/index.cjs +1040 -0
- package/dist/index.d.cts +534 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +106 -0
- package/package.json +47 -0
package/dist/chart.cjs
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/chart.ts
|
|
31
|
+
var chart_exports = {};
|
|
32
|
+
__export(chart_exports, {
|
|
33
|
+
Chart: () => Chart,
|
|
34
|
+
uixChartPalette: () => uixChartPalette
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(chart_exports);
|
|
37
|
+
|
|
38
|
+
// src/components/Chart.tsx
|
|
39
|
+
var import_react = require("react");
|
|
40
|
+
var echarts = __toESM(require("echarts"), 1);
|
|
41
|
+
|
|
42
|
+
// src/cx.ts
|
|
43
|
+
function cx(...args) {
|
|
44
|
+
return args.filter(Boolean).join(" ");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// src/components/Chart.tsx
|
|
48
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
|
+
function readToken(name) {
|
|
50
|
+
if (typeof getComputedStyle === "undefined") return "";
|
|
51
|
+
return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
52
|
+
}
|
|
53
|
+
function uixChartPalette() {
|
|
54
|
+
return [1, 2, 3, 4, 5, 6, 7, 8].map((i) => readToken(`--uix-chart-${i}`));
|
|
55
|
+
}
|
|
56
|
+
function Chart({
|
|
57
|
+
option,
|
|
58
|
+
title,
|
|
59
|
+
subtitle,
|
|
60
|
+
height = 280,
|
|
61
|
+
className,
|
|
62
|
+
style,
|
|
63
|
+
ariaLabel,
|
|
64
|
+
tableData,
|
|
65
|
+
tableHeaders,
|
|
66
|
+
onReady,
|
|
67
|
+
header
|
|
68
|
+
}) {
|
|
69
|
+
const containerRef = (0, import_react.useRef)(null);
|
|
70
|
+
const chartRef = (0, import_react.useRef)(null);
|
|
71
|
+
const tableId = (0, import_react.useId)();
|
|
72
|
+
(0, import_react.useEffect)(() => {
|
|
73
|
+
const el = containerRef.current;
|
|
74
|
+
if (!el) return;
|
|
75
|
+
const chart = echarts.init(el, null, { renderer: "svg" });
|
|
76
|
+
chartRef.current = chart;
|
|
77
|
+
chart.setOption(option);
|
|
78
|
+
onReady?.(chart);
|
|
79
|
+
const ro = new ResizeObserver(() => chart.resize());
|
|
80
|
+
ro.observe(el);
|
|
81
|
+
return () => {
|
|
82
|
+
ro.disconnect();
|
|
83
|
+
chart.dispose();
|
|
84
|
+
chartRef.current = null;
|
|
85
|
+
};
|
|
86
|
+
}, []);
|
|
87
|
+
(0, import_react.useEffect)(() => {
|
|
88
|
+
chartRef.current?.setOption(option, { notMerge: false });
|
|
89
|
+
}, [option]);
|
|
90
|
+
const heightVal = typeof height === "number" ? `${height}px` : height;
|
|
91
|
+
const effectiveAriaLabel = ariaLabel ?? title ?? "Chart";
|
|
92
|
+
const hasTable = tableData && tableData.length > 0 && tableHeaders && tableHeaders.length > 0;
|
|
93
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: cx("uix-chart", className), style, children: [
|
|
94
|
+
(title != null || subtitle != null || header != null) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
95
|
+
header,
|
|
96
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "uix-chart__title", children: title }),
|
|
97
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "uix-chart__subtitle", children: subtitle })
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
ref: containerRef,
|
|
103
|
+
style: { height: heightVal },
|
|
104
|
+
role: "img",
|
|
105
|
+
"aria-label": effectiveAriaLabel,
|
|
106
|
+
"aria-describedby": hasTable ? tableId : void 0
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
hasTable && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
110
|
+
"table",
|
|
111
|
+
{
|
|
112
|
+
id: tableId,
|
|
113
|
+
className: "sr-only",
|
|
114
|
+
"aria-label": `${effectiveAriaLabel} \u2014 data table`,
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: tableHeaders.map((h) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: h }, h)) }) }),
|
|
117
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: tableData.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: tableHeaders.map((h) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: row[h] }, h)) }, i)) })
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] });
|
|
122
|
+
}
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
Chart,
|
|
126
|
+
uixChartPalette
|
|
127
|
+
});
|
package/dist/chart.d.cts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { EChartsOption, ECharts } from 'echarts';
|
|
4
|
+
|
|
5
|
+
declare function uixChartPalette(): string[];
|
|
6
|
+
interface ChartTableRow {
|
|
7
|
+
[key: string]: string | number;
|
|
8
|
+
}
|
|
9
|
+
interface ChartProps {
|
|
10
|
+
option: EChartsOption;
|
|
11
|
+
title?: string;
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
height?: string | number;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
ariaLabel?: string;
|
|
17
|
+
tableData?: ChartTableRow[];
|
|
18
|
+
tableHeaders?: string[];
|
|
19
|
+
onReady?: (chart: ECharts) => void;
|
|
20
|
+
header?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
declare function Chart({ option, title, subtitle, height, className, style, ariaLabel, tableData, tableHeaders, onReady, header, }: ChartProps): react.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { Chart, type ChartProps, type ChartTableRow, uixChartPalette };
|
package/dist/chart.d.ts
ADDED
package/dist/chart.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type AlertTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
5
|
+
interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
6
|
+
tone?: AlertTone;
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function Alert({ tone, title, icon, children, className, ...props }: AlertProps): react.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { Alert, type AlertProps, type AlertTone };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function Alert({ tone, title, icon, children, className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-alert", tone && tone !== "neutral" && `uix-alert--${tone}`, className), ...props, children: [
|
|
5
|
+
icon && /* @__PURE__ */ jsx("div", { className: "uix-alert__icon", children: icon }),
|
|
6
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
7
|
+
title && /* @__PURE__ */ jsx("div", { className: "uix-alert__title", children: title }),
|
|
8
|
+
children && /* @__PURE__ */ jsx("div", { className: "uix-alert__body", children })
|
|
9
|
+
] })
|
|
10
|
+
] });
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
Alert
|
|
14
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface AppShellProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
collapsed?: boolean;
|
|
6
|
+
sidebar?: ReactNode;
|
|
7
|
+
topbar?: ReactNode;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare function AppShell({ collapsed, sidebar, topbar, children, className, ...props }: AppShellProps): react.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { AppShell, type AppShellProps };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function AppShell({ collapsed, sidebar, topbar, children, className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-shell", className), "data-collapsed": collapsed || void 0, ...props, children: [
|
|
5
|
+
sidebar && /* @__PURE__ */ jsx("div", { className: "uix-shell__sidebar", children: sidebar }),
|
|
6
|
+
topbar && /* @__PURE__ */ jsx("div", { className: "uix-shell__topbar", children: topbar }),
|
|
7
|
+
/* @__PURE__ */ jsx("main", { className: "uix-shell__main", children })
|
|
8
|
+
] });
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
AppShell
|
|
12
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
|
|
5
|
+
size?: 'sm' | 'md' | 'lg';
|
|
6
|
+
src?: string;
|
|
7
|
+
alt?: string;
|
|
8
|
+
/** Initials / fallback shown when there is no `src`. */
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
/** Online status dot. */
|
|
11
|
+
status?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Avatar over `.uix-avatar`. Renders an image when `src` is set, else children (initials). */
|
|
14
|
+
declare function Avatar({ size, src, alt, children, status, className, ...props }: AvatarProps): react.JSX.Element;
|
|
15
|
+
interface AvatarGroupProps extends HTMLAttributes<HTMLSpanElement> {
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/** Overlapping avatar stack over `.uix-avatar-group`. */
|
|
19
|
+
declare function AvatarGroup({ children, className, ...props }: AvatarGroupProps): react.JSX.Element;
|
|
20
|
+
interface UserChipProps extends HTMLAttributes<HTMLSpanElement> {
|
|
21
|
+
/** Usually an `<Avatar />`. */
|
|
22
|
+
avatar?: ReactNode;
|
|
23
|
+
name?: ReactNode;
|
|
24
|
+
/** Secondary line (role, email). */
|
|
25
|
+
sub?: ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/** Avatar + name (+ optional sub-line) over `.uix-user-chip`. */
|
|
28
|
+
declare function UserChip({ avatar, name, sub, className, children, ...props }: UserChipProps): react.JSX.Element;
|
|
29
|
+
|
|
30
|
+
export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, UserChip, type UserChipProps };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function Avatar({ size = "md", src, alt, children, status, className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("span", { className: cx("uix-avatar", size !== "md" && `uix-avatar--${size}`, className), ...props, children: [
|
|
5
|
+
src ? /* @__PURE__ */ jsx("img", { src, alt: alt ?? "" }) : children,
|
|
6
|
+
status && /* @__PURE__ */ jsx("span", { className: "uix-avatar__status" })
|
|
7
|
+
] });
|
|
8
|
+
}
|
|
9
|
+
function AvatarGroup({ children, className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx("span", { className: cx("uix-avatar-group", className), ...props, children });
|
|
11
|
+
}
|
|
12
|
+
function UserChip({ avatar, name, sub, className, children, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsxs("span", { className: cx("uix-user-chip", className), ...props, children: [
|
|
14
|
+
avatar,
|
|
15
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
16
|
+
name != null && /* @__PURE__ */ jsx("span", { className: "uix-user-chip__name", children: name }),
|
|
17
|
+
sub != null && /* @__PURE__ */ jsx("span", { className: "uix-user-chip__sub", style: { display: "block" }, children: sub })
|
|
18
|
+
] }),
|
|
19
|
+
children
|
|
20
|
+
] });
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
Avatar,
|
|
24
|
+
AvatarGroup,
|
|
25
|
+
UserChip
|
|
26
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'link';
|
|
6
|
+
size?: 'sm' | 'md' | 'lg';
|
|
7
|
+
icon?: boolean;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
interface ButtonGroupProps {
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
declare function ButtonGroup({ children, className }: ButtonGroupProps): react.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { Button, ButtonGroup, type ButtonGroupProps, type ButtonProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cx } from "../cx.js";
|
|
4
|
+
const Button = forwardRef(
|
|
5
|
+
({ variant = "secondary", size = "md", icon = false, loading = false, className, children, disabled, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
6
|
+
"button",
|
|
7
|
+
{
|
|
8
|
+
ref,
|
|
9
|
+
className: cx(
|
|
10
|
+
"uix-btn",
|
|
11
|
+
`uix-btn--${variant}`,
|
|
12
|
+
size !== "md" && `uix-btn--${size}`,
|
|
13
|
+
icon && "uix-btn--icon",
|
|
14
|
+
className
|
|
15
|
+
),
|
|
16
|
+
disabled: disabled || loading,
|
|
17
|
+
"data-loading": loading || void 0,
|
|
18
|
+
...props,
|
|
19
|
+
children
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
Button.displayName = "Button";
|
|
24
|
+
function ButtonGroup({ children, className }) {
|
|
25
|
+
return /* @__PURE__ */ jsx("div", { className: cx("uix-btn-group", className), children });
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
Button,
|
|
29
|
+
ButtonGroup
|
|
30
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
subtitle?: ReactNode;
|
|
7
|
+
headerAction?: ReactNode;
|
|
8
|
+
footer?: ReactNode;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function Card({ title, subtitle, headerAction, footer, children, className, ...props }: CardProps): react.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { Card, type CardProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function Card({ title, subtitle, headerAction, footer, children, className, ...props }) {
|
|
4
|
+
const hasHeader = title != null || subtitle != null || headerAction != null;
|
|
5
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-card", className), ...props, children: [
|
|
6
|
+
hasHeader && /* @__PURE__ */ jsxs("div", { className: "uix-card__header", children: [
|
|
7
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
|
|
8
|
+
title && /* @__PURE__ */ jsx("div", { className: "uix-card__title", children: title }),
|
|
9
|
+
subtitle && /* @__PURE__ */ jsx("div", { className: "uix-card__subtitle", children: subtitle })
|
|
10
|
+
] }),
|
|
11
|
+
headerAction
|
|
12
|
+
] }),
|
|
13
|
+
children != null && /* @__PURE__ */ jsx("div", { className: "uix-card__body", children }),
|
|
14
|
+
footer != null && /* @__PURE__ */ jsx("div", { className: "uix-card__footer", children: footer })
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
Card
|
|
19
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { EChartsOption, ECharts } from 'echarts';
|
|
4
|
+
|
|
5
|
+
declare function uixChartPalette(): string[];
|
|
6
|
+
interface ChartTableRow {
|
|
7
|
+
[key: string]: string | number;
|
|
8
|
+
}
|
|
9
|
+
interface ChartProps {
|
|
10
|
+
option: EChartsOption;
|
|
11
|
+
title?: string;
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
height?: string | number;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
ariaLabel?: string;
|
|
17
|
+
tableData?: ChartTableRow[];
|
|
18
|
+
tableHeaders?: string[];
|
|
19
|
+
onReady?: (chart: ECharts) => void;
|
|
20
|
+
header?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
declare function Chart({ option, title, subtitle, height, className, style, ariaLabel, tableData, tableHeaders, onReady, header, }: ChartProps): react.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { Chart, type ChartProps, type ChartTableRow, uixChartPalette };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useEffect, useId } from "react";
|
|
4
|
+
import * as echarts from "echarts";
|
|
5
|
+
import { cx } from "../cx.js";
|
|
6
|
+
function readToken(name) {
|
|
7
|
+
if (typeof getComputedStyle === "undefined") return "";
|
|
8
|
+
return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
9
|
+
}
|
|
10
|
+
function uixChartPalette() {
|
|
11
|
+
return [1, 2, 3, 4, 5, 6, 7, 8].map((i) => readToken(`--uix-chart-${i}`));
|
|
12
|
+
}
|
|
13
|
+
function Chart({
|
|
14
|
+
option,
|
|
15
|
+
title,
|
|
16
|
+
subtitle,
|
|
17
|
+
height = 280,
|
|
18
|
+
className,
|
|
19
|
+
style,
|
|
20
|
+
ariaLabel,
|
|
21
|
+
tableData,
|
|
22
|
+
tableHeaders,
|
|
23
|
+
onReady,
|
|
24
|
+
header
|
|
25
|
+
}) {
|
|
26
|
+
const containerRef = useRef(null);
|
|
27
|
+
const chartRef = useRef(null);
|
|
28
|
+
const tableId = useId();
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const el = containerRef.current;
|
|
31
|
+
if (!el) return;
|
|
32
|
+
const chart = echarts.init(el, null, { renderer: "svg" });
|
|
33
|
+
chartRef.current = chart;
|
|
34
|
+
chart.setOption(option);
|
|
35
|
+
onReady?.(chart);
|
|
36
|
+
const ro = new ResizeObserver(() => chart.resize());
|
|
37
|
+
ro.observe(el);
|
|
38
|
+
return () => {
|
|
39
|
+
ro.disconnect();
|
|
40
|
+
chart.dispose();
|
|
41
|
+
chartRef.current = null;
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
chartRef.current?.setOption(option, { notMerge: false });
|
|
46
|
+
}, [option]);
|
|
47
|
+
const heightVal = typeof height === "number" ? `${height}px` : height;
|
|
48
|
+
const effectiveAriaLabel = ariaLabel ?? title ?? "Chart";
|
|
49
|
+
const hasTable = tableData && tableData.length > 0 && tableHeaders && tableHeaders.length > 0;
|
|
50
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-chart", className), style, children: [
|
|
51
|
+
(title != null || subtitle != null || header != null) && /* @__PURE__ */ jsxs("div", { children: [
|
|
52
|
+
header,
|
|
53
|
+
title && /* @__PURE__ */ jsx("div", { className: "uix-chart__title", children: title }),
|
|
54
|
+
subtitle && /* @__PURE__ */ jsx("div", { className: "uix-chart__subtitle", children: subtitle })
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
ref: containerRef,
|
|
60
|
+
style: { height: heightVal },
|
|
61
|
+
role: "img",
|
|
62
|
+
"aria-label": effectiveAriaLabel,
|
|
63
|
+
"aria-describedby": hasTable ? tableId : void 0
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
hasTable && /* @__PURE__ */ jsxs(
|
|
67
|
+
"table",
|
|
68
|
+
{
|
|
69
|
+
id: tableId,
|
|
70
|
+
className: "sr-only",
|
|
71
|
+
"aria-label": `${effectiveAriaLabel} \u2014 data table`,
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: tableHeaders.map((h) => /* @__PURE__ */ jsx("th", { scope: "col", children: h }, h)) }) }),
|
|
74
|
+
/* @__PURE__ */ jsx("tbody", { children: tableData.map((row, i) => /* @__PURE__ */ jsx("tr", { children: tableHeaders.map((h) => /* @__PURE__ */ jsx("td", { children: row[h] }, h)) }, i)) })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
Chart,
|
|
82
|
+
uixChartPalette
|
|
83
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { InputHTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
indeterminate?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
|
|
9
|
+
|
|
10
|
+
export { Checkbox, type CheckboxProps };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useEffect, useRef } from "react";
|
|
4
|
+
import { cx } from "../cx.js";
|
|
5
|
+
const CheckIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("polyline", { points: "1.5,6 4.5,9 10.5,3" }) });
|
|
6
|
+
const IndeterminateIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx("rect", { x: "2", y: "5", width: "8", height: "2", rx: "1", fill: "currentColor" }) });
|
|
7
|
+
const Checkbox = forwardRef(
|
|
8
|
+
({ label, indeterminate, className, ...props }, forwardedRef) => {
|
|
9
|
+
const innerRef = useRef(null);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const el = innerRef.current;
|
|
12
|
+
if (el) el.indeterminate = !!indeterminate;
|
|
13
|
+
}, [indeterminate]);
|
|
14
|
+
return /* @__PURE__ */ jsxs("label", { className: cx("uix-checkbox", className), children: [
|
|
15
|
+
/* @__PURE__ */ jsx(
|
|
16
|
+
"input",
|
|
17
|
+
{
|
|
18
|
+
type: "checkbox",
|
|
19
|
+
ref: (node) => {
|
|
20
|
+
innerRef.current = node;
|
|
21
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
22
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
23
|
+
},
|
|
24
|
+
...props
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ jsx("span", { className: "uix-checkbox__box", children: indeterminate ? /* @__PURE__ */ jsx(IndeterminateIcon, {}) : /* @__PURE__ */ jsx(CheckIcon, {}) }),
|
|
28
|
+
label
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
Checkbox.displayName = "Checkbox";
|
|
33
|
+
export {
|
|
34
|
+
Checkbox
|
|
35
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, HTMLAttributes, InputHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
interface CommandPaletteProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** Props for the search input (value/onChange/placeholder wired by the consumer). */
|
|
6
|
+
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* ⌘K command palette surface over `.uix-cmdk`. Presentational: mount it inside a
|
|
11
|
+
* Modal/Popover and wire search + keyboard selection in the consumer.
|
|
12
|
+
*/
|
|
13
|
+
declare function CommandPalette({ inputProps, children, className, ...props }: CommandPaletteProps): react.JSX.Element;
|
|
14
|
+
interface CommandGroupProps {
|
|
15
|
+
label?: ReactNode;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/** A labeled group of command items. */
|
|
19
|
+
declare function CommandGroup({ label, children }: CommandGroupProps): react.JSX.Element;
|
|
20
|
+
interface CommandItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
/** Trailing shortcut hint (e.g. a `.uix-kbd`). */
|
|
23
|
+
shortcut?: ReactNode;
|
|
24
|
+
active?: boolean;
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/** A single command row over `.uix-cmdk__item`. */
|
|
28
|
+
declare function CommandItem({ icon, shortcut, active, children, className, ...props }: CommandItemProps): react.JSX.Element;
|
|
29
|
+
|
|
30
|
+
export { CommandGroup, type CommandGroupProps, CommandItem, type CommandItemProps, CommandPalette, type CommandPaletteProps };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function CommandPalette({ inputProps, children, className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-cmdk", className), ...props, children: [
|
|
5
|
+
/* @__PURE__ */ jsx("input", { className: "uix-cmdk__input", ...inputProps }),
|
|
6
|
+
/* @__PURE__ */ jsx("div", { className: "uix-cmdk__list", children })
|
|
7
|
+
] });
|
|
8
|
+
}
|
|
9
|
+
function CommandGroup({ label, children }) {
|
|
10
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11
|
+
label != null && /* @__PURE__ */ jsx("div", { className: "uix-cmdk__group", children: label }),
|
|
12
|
+
children
|
|
13
|
+
] });
|
|
14
|
+
}
|
|
15
|
+
function CommandItem({ icon, shortcut, active, children, className, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-cmdk__item", className), "data-active": active || void 0, ...props, children: [
|
|
17
|
+
icon,
|
|
18
|
+
/* @__PURE__ */ jsx("span", { children }),
|
|
19
|
+
shortcut
|
|
20
|
+
] });
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
CommandGroup,
|
|
24
|
+
CommandItem,
|
|
25
|
+
CommandPalette
|
|
26
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface CommentsProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/** Comment thread container over `.uix-comments`. */
|
|
8
|
+
declare function Comments({ children, className, ...props }: CommentsProps): react.JSX.Element;
|
|
9
|
+
interface CommentProps extends HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/** Usually an `<Avatar />` (the grid reserves the leading column). */
|
|
11
|
+
avatar?: ReactNode;
|
|
12
|
+
author?: ReactNode;
|
|
13
|
+
meta?: ReactNode;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/** A single comment over `.uix-comment` (avatar column + body). */
|
|
17
|
+
declare function Comment({ avatar, author, meta, children, className, ...props }: CommentProps): react.JSX.Element;
|
|
18
|
+
|
|
19
|
+
export { Comment, type CommentProps, Comments, type CommentsProps };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function Comments({ children, className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsx("div", { className: cx("uix-comments", className), ...props, children });
|
|
5
|
+
}
|
|
6
|
+
function Comment({ avatar, author, meta, children, className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-comment", className), ...props, children: [
|
|
8
|
+
avatar ?? /* @__PURE__ */ jsx("span", { "aria-hidden": "true" }),
|
|
9
|
+
/* @__PURE__ */ jsxs("div", { className: "uix-comment__body", children: [
|
|
10
|
+
(author != null || meta != null) && /* @__PURE__ */ jsxs("div", { className: "uix-comment__meta", children: [
|
|
11
|
+
author != null && /* @__PURE__ */ jsx("span", { className: "uix-comment__author", children: author }),
|
|
12
|
+
author != null && meta != null ? " \xB7 " : null,
|
|
13
|
+
meta
|
|
14
|
+
] }),
|
|
15
|
+
children
|
|
16
|
+
] })
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
Comment,
|
|
21
|
+
Comments
|
|
22
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface DetailLayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** The narrow trailing column (record meta, side panels). */
|
|
6
|
+
side?: ReactNode;
|
|
7
|
+
/** The main column content. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Two-column record layout over `.uix-detail` (main + side meta).
|
|
12
|
+
* Collapses to a single column below 820px.
|
|
13
|
+
*/
|
|
14
|
+
declare function DetailLayout({ side, children, className, ...props }: DetailLayoutProps): react.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { DetailLayout, type DetailLayoutProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cx } from "../cx.js";
|
|
3
|
+
function DetailLayout({ side, children, className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("uix-detail", className), ...props, children: [
|
|
5
|
+
/* @__PURE__ */ jsx("div", { className: "uix-detail__main", children }),
|
|
6
|
+
side != null && /* @__PURE__ */ jsx("div", { className: "uix-detail__side", children: side })
|
|
7
|
+
] });
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
DetailLayout
|
|
11
|
+
};
|