@octohirono/stitch-design-system 0.1.0 → 0.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.
Files changed (43) hide show
  1. package/dist/components/BarChart/BarChart.d.ts +42 -0
  2. package/dist/components/BarChart/BarChart.js +71 -0
  3. package/dist/components/BarChart/bar-chart.module.js +4 -0
  4. package/dist/components/BarChart/index.d.ts +2 -0
  5. package/dist/components/Calendar/Calendar.d.ts +57 -0
  6. package/dist/components/Calendar/Calendar.js +83 -0
  7. package/dist/components/Calendar/calendar.module.js +26 -0
  8. package/dist/components/Calendar/index.d.ts +2 -0
  9. package/dist/components/DatePicker/DatePicker.d.ts +60 -0
  10. package/dist/components/DatePicker/DatePicker.js +75 -0
  11. package/dist/components/DatePicker/datepicker.module.js +17 -0
  12. package/dist/components/DatePicker/index.d.ts +2 -0
  13. package/dist/components/Icon/Icon.d.ts +16 -0
  14. package/dist/components/Icon/Icon.js +26 -1
  15. package/dist/components/LineChart/LineChart.d.ts +48 -0
  16. package/dist/components/LineChart/LineChart.js +110 -0
  17. package/dist/components/LineChart/index.d.ts +2 -0
  18. package/dist/components/LineChart/line-chart.module.js +7 -0
  19. package/dist/components/PieChart/PieChart.d.ts +43 -0
  20. package/dist/components/PieChart/PieChart.js +56 -0
  21. package/dist/components/PieChart/index.d.ts +2 -0
  22. package/dist/components/PieChart/pie-chart.module.js +7 -0
  23. package/dist/components/Stat/Stat.d.ts +71 -0
  24. package/dist/components/Stat/Stat.js +66 -0
  25. package/dist/components/Stat/StatGroup.d.ts +14 -0
  26. package/dist/components/Stat/StatGroup.js +16 -0
  27. package/dist/components/Stat/index.d.ts +4 -0
  28. package/dist/components/Stat/stat.module.js +23 -0
  29. package/dist/components/_internal/dataviz/ChartFrame.d.ts +20 -0
  30. package/dist/components/_internal/dataviz/ChartFrame.js +18 -0
  31. package/dist/components/_internal/dataviz/ChartTooltip.d.ts +23 -0
  32. package/dist/components/_internal/dataviz/ChartTooltip.js +33 -0
  33. package/dist/components/_internal/dataviz/chart-frame.module.js +4 -0
  34. package/dist/components/_internal/dataviz/chart-tooltip.module.js +11 -0
  35. package/dist/components/_internal/dataviz/chartColors.d.ts +12 -0
  36. package/dist/components/_internal/dataviz/chartColors.js +3 -0
  37. package/dist/components/_internal/dataviz/index.d.ts +5 -0
  38. package/dist/index.d.ts +12 -0
  39. package/dist/index.js +28 -21
  40. package/dist/style.css +441 -46
  41. package/dist/themes/seline.css +39 -0
  42. package/dist/themes/steep.css +37 -0
  43. package/package.json +9 -4
@@ -0,0 +1,110 @@
1
+ import { catColor as e } from "../_internal/dataviz/chartColors.js";
2
+ import { ChartFrame as t } from "../_internal/dataviz/ChartFrame.js";
3
+ import { ChartTooltip as n } from "../_internal/dataviz/ChartTooltip.js";
4
+ import r from "./line-chart.module.js";
5
+ import "react";
6
+ import i from "clsx";
7
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
8
+ import { Area as c, AreaChart as l, CartesianGrid as u, LabelList as d, Line as f, LineChart as p, Tooltip as m, XAxis as h, YAxis as g } from "recharts";
9
+ //#region packages/react/src/components/LineChart/LineChart.tsx
10
+ var _ = [
11
+ "0",
12
+ "6 4",
13
+ "2 4",
14
+ "10 4 2 4"
15
+ ], v = (e) => _[(e % _.length + _.length) % _.length], y = ({ data: _, xField: y, series: b, smooth: x = !1, area: S = !1, height: C = 300, valueFormatter: w, ariaLabel: T, className: E }) => {
16
+ let D = x ? "monotone" : "linear", O = { fill: "var(--stitch-text-secondary)" }, k = w ? (e) => w(e) : void 0, A = (e) => {
17
+ let { active: t, label: r, payload: i } = e, a = i?.map((e) => ({
18
+ name: e.name,
19
+ value: w && typeof e.value == "number" ? w(e.value) : e.value,
20
+ color: e.color
21
+ }));
22
+ return /* @__PURE__ */ o(n, {
23
+ active: t,
24
+ label: r,
25
+ payload: a
26
+ });
27
+ }, j = _.length - 1, M = (e) => ({ x: t, y: n, index: i }) => i === j ? /* @__PURE__ */ o("text", {
28
+ x: Number(t) + 8,
29
+ y: Number(n),
30
+ dy: 4,
31
+ className: r.endLabel,
32
+ children: e
33
+ }) : null, N = {
34
+ top: 8,
35
+ right: 56,
36
+ bottom: 4,
37
+ left: 4
38
+ }, P = /* @__PURE__ */ s(a, { children: [
39
+ /* @__PURE__ */ o(u, {
40
+ stroke: "var(--stitch-border)",
41
+ vertical: !1
42
+ }),
43
+ /* @__PURE__ */ o(h, {
44
+ dataKey: y,
45
+ stroke: "var(--stitch-border)",
46
+ tick: O,
47
+ tickLine: !1
48
+ }),
49
+ /* @__PURE__ */ o(g, {
50
+ stroke: "var(--stitch-border)",
51
+ tick: O,
52
+ tickLine: !1,
53
+ tickFormatter: k
54
+ }),
55
+ /* @__PURE__ */ o(m, { content: A })
56
+ ] }), F = S ? /* @__PURE__ */ s(l, {
57
+ data: _,
58
+ margin: N,
59
+ children: [P, b.map((t, n) => {
60
+ let r = e(n), i = t.name ?? t.dataKey;
61
+ return /* @__PURE__ */ o(c, {
62
+ type: D,
63
+ dataKey: t.dataKey,
64
+ name: i,
65
+ stroke: r,
66
+ strokeWidth: 2,
67
+ strokeDasharray: v(n),
68
+ fill: `color-mix(in srgb, ${r}, transparent 88%)`,
69
+ fillOpacity: 1,
70
+ dot: !1,
71
+ activeDot: { r: 4 },
72
+ isAnimationActive: !1,
73
+ children: /* @__PURE__ */ o(d, {
74
+ dataKey: t.dataKey,
75
+ content: M(i)
76
+ })
77
+ }, t.dataKey);
78
+ })]
79
+ }) : /* @__PURE__ */ s(p, {
80
+ data: _,
81
+ margin: N,
82
+ children: [P, b.map((t, n) => {
83
+ let r = t.name ?? t.dataKey;
84
+ return /* @__PURE__ */ o(f, {
85
+ type: D,
86
+ dataKey: t.dataKey,
87
+ name: r,
88
+ stroke: e(n),
89
+ strokeWidth: 2,
90
+ strokeDasharray: v(n),
91
+ dot: !1,
92
+ activeDot: { r: 4 },
93
+ isAnimationActive: !1,
94
+ children: /* @__PURE__ */ o(d, {
95
+ dataKey: t.dataKey,
96
+ content: M(r)
97
+ })
98
+ }, t.dataKey);
99
+ })]
100
+ });
101
+ return /* @__PURE__ */ o(t, {
102
+ ariaLabel: T,
103
+ height: C,
104
+ className: i(r.chart, E),
105
+ children: F
106
+ });
107
+ };
108
+ y.displayName = "LineChart";
109
+ //#endregion
110
+ export { y as LineChart };
@@ -0,0 +1,2 @@
1
+ export { LineChart } from './LineChart';
2
+ export type { LineChartProps, LineChartSeries } from './LineChart';
@@ -0,0 +1,7 @@
1
+ //#region packages/react/src/components/LineChart/line-chart.module.less
2
+ var e = "_chart_bhyb6_1", t = "_endLabel_bhyb6_5", n = {
3
+ chart: e,
4
+ endLabel: t
5
+ };
6
+ //#endregion
7
+ export { e as chart, n as default, t as endLabel };
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ /**
3
+ * 饼 / 环图。扇区色只从契约分类色槽 `var(--stitch-cat-*)` 取、按序号循环,随站换肤整图跟随;
4
+ * 组件内零硬编码主题值、零手写内联 svg(svg 全由 recharts 出),无 emoji。`innerRadius` 挖空
5
+ * 中心即成环形(donut),此时可用 `centerLabel` 在中心放一个值;默认出图例(`Legend`)把
6
+ * 分类名列出,不只靠颜色区分(守 a11y)。整图作一张图对外——`role="img"` + `aria-label`
7
+ * (缺省兜底非空名)。
8
+ */
9
+ export interface PieChartProps {
10
+ /** 数据源,每项一扇区(Ant charts `data` 语义) */
11
+ data: Record<string, unknown>[];
12
+ /** 扇区数值字段——决定扇区角度大小(Ant charts `angleField` 语义) */
13
+ angleField: string;
14
+ /** 扇区分类字段——作图例名与 tooltip 名(Ant charts `colorField` 语义) */
15
+ colorField: string;
16
+ /**
17
+ * 环形内半径占比 0–1(Ant charts `innerRadius` 语义);0 = 实心饼,>0 = 环形 donut
18
+ * @default 0
19
+ */
20
+ innerRadius?: number;
21
+ /** 环形中心值(仅 `innerRadius` > 0 挖空后有空间显示;扇区数值的汇总等) */
22
+ centerLabel?: string | number;
23
+ /**
24
+ * 是否显示图例(把分类名 → 色块显式列出,作不依赖颜色的区分通道)
25
+ * @default true
26
+ */
27
+ legend?: boolean;
28
+ /**
29
+ * 图表高度(px);宽度恒铺满容器
30
+ * @default 300
31
+ */
32
+ height?: number;
33
+ /** 扇区值格式化(如货币 / 百分比);作用于 tooltip 值 */
34
+ valueFormatter?: (value: number) => string;
35
+ /** 图表整体可访问名(`role="img"` 的文本替代);缺省兜底非空名 */
36
+ ariaLabel?: string;
37
+ /** 透传外层容器类名 */
38
+ className?: string;
39
+ }
40
+ /**
41
+ * 把数据画成饼 / 环图,扇区色走契约分类色槽、随站换肤;可挖空成环形并在中心放一个值。
42
+ */
43
+ export declare const PieChart: React.FC<PieChartProps>;
@@ -0,0 +1,56 @@
1
+ import { catColor as e } from "../_internal/dataviz/chartColors.js";
2
+ import { ChartFrame as t } from "../_internal/dataviz/ChartFrame.js";
3
+ import { ChartTooltip as n } from "../_internal/dataviz/ChartTooltip.js";
4
+ import r from "./pie-chart.module.js";
5
+ import "react";
6
+ import i from "clsx";
7
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
8
+ import { Cell as s, Label as c, Legend as l, Pie as u, PieChart as d, Tooltip as f } from "recharts";
9
+ //#region packages/react/src/components/PieChart/PieChart.tsx
10
+ var p = ({ data: p, angleField: m, colorField: h, innerRadius: g = 0, centerLabel: _, legend: v = !0, height: y = 300, valueFormatter: b, ariaLabel: x, className: S }) => {
11
+ let C = (e) => {
12
+ let { active: t, payload: r } = e, i = r?.map((e) => ({
13
+ name: e.name,
14
+ value: b && typeof e.value == "number" ? b(e.value) : e.value,
15
+ color: e.color
16
+ }));
17
+ return /* @__PURE__ */ a(n, {
18
+ active: t,
19
+ payload: i
20
+ });
21
+ }, w = `${Math.max(0, Math.min(1, g)) * 100}%`, T = g > 0 && _ != null && _ !== "";
22
+ return /* @__PURE__ */ a(t, {
23
+ ariaLabel: x,
24
+ height: y,
25
+ className: i(r.chart, S),
26
+ children: /* @__PURE__ */ o(d, {
27
+ margin: {
28
+ top: 8,
29
+ right: 8,
30
+ bottom: 4,
31
+ left: 4
32
+ },
33
+ children: [
34
+ /* @__PURE__ */ a(f, { content: C }),
35
+ v && /* @__PURE__ */ a(l, { wrapperStyle: { color: "var(--stitch-text-primary)" } }),
36
+ /* @__PURE__ */ o(u, {
37
+ data: p,
38
+ dataKey: m,
39
+ nameKey: h,
40
+ innerRadius: w,
41
+ outerRadius: "80%",
42
+ stroke: "var(--stitch-bg-elevated)",
43
+ isAnimationActive: !1,
44
+ children: [p.map((t, n) => /* @__PURE__ */ a(s, { fill: e(n) }, n)), T && /* @__PURE__ */ a(c, {
45
+ position: "center",
46
+ value: _,
47
+ className: r.center
48
+ })]
49
+ })
50
+ ]
51
+ })
52
+ });
53
+ };
54
+ p.displayName = "PieChart";
55
+ //#endregion
56
+ export { p as PieChart };
@@ -0,0 +1,2 @@
1
+ export { PieChart } from './PieChart';
2
+ export type { PieChartProps } from './PieChart';
@@ -0,0 +1,7 @@
1
+ //#region packages/react/src/components/PieChart/pie-chart.module.less
2
+ var e = "_chart_yzp1s_1", t = "_center_yzp1s_5", n = {
3
+ chart: e,
4
+ center: t
5
+ };
6
+ //#endregion
7
+ export { t as center, e as chart, n as default };
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ /** 趋势方向:值往哪走(好/坏由 direction + trendReversed 共同决定,不等于方向本身)。 */
3
+ export type StatTrendDirection = 'up' | 'down';
4
+ /** 趋势描述:一个变化量 + 方向。方向缺省时按 value 正负推断(≥0 视为 up)。 */
5
+ export interface StatTrend {
6
+ /** 变化量(展示为绝对值,方向由箭头/配色承载) */
7
+ value: number;
8
+ /** 方向;缺省按 value 正负推断 */
9
+ direction?: StatTrendDirection;
10
+ }
11
+ /** 状态点语义色调(点色走对应角色变量,缺省 neutral = 弱化中性)。 */
12
+ export type StatStatusTone = 'neutral' | 'success' | 'danger' | 'warning' | 'info';
13
+ /** 状态点:一枚 <Icon name="dot"> + 文案(如 ○ 0 online)。 */
14
+ export interface StatStatus {
15
+ /** 状态文案 */
16
+ text: React.ReactNode;
17
+ /**
18
+ * 点的语义色调(走角色变量)
19
+ * @default 'neutral'
20
+ */
21
+ tone?: StatStatusTone;
22
+ }
23
+ /**
24
+ * 单个指标块:标签 + 大值(可带 prefix/suffix/精度/千分位/自定义 formatter)+ 可选趋势 /
25
+ * 副说明 / 状态点。展示 props 借 Ant `Statistic` 语义。
26
+ *
27
+ * 跨-prop 注意事项:
28
+ * - **只读角色变量**:趋势好/坏色只走 `var(--stitch-success)` / `var(--stitch-danger)`,
29
+ * 状态点色 / 分隔线走 `var(--stitch-*)`——组件内零硬编码绿红、零主题值。
30
+ * - **趋势方向经 `<Icon>`**(内置 `arrow-up-right` / `arrow-down-right`),**禁**内联 svg /
31
+ * emoji / Unicode 箭头。方向(箭头形状)是不依赖颜色的区分通道,配色只叠加好/坏语义。
32
+ * - **`trendReversed`**:给「跌是好事」的指标(Bounce Rate 等)翻转好/坏配色——方向不变、
33
+ * 语义色对调。
34
+ * - **`formatter` 优先**:给出时接管全部数值格式化,`precision` / `groupSeparator` 不再生效。
35
+ * - **Accessibility**:有 `title` 时整块为 `role="group"` + `aria-labelledby`(可访问名 =
36
+ * 标签文案);趋势箭头为装饰(`aria-hidden`),语义由数值文案与箭头形状承载。
37
+ */
38
+ export interface StatProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title' | 'prefix'> {
39
+ /** 指标标签(如 Unique Visitors) */
40
+ title?: React.ReactNode;
41
+ /** 指标值。number 走内置格式化;string 原样展示 */
42
+ value: string | number;
43
+ /** 小数精度(仅 number 值、未给 formatter 时生效) */
44
+ precision?: number;
45
+ /** 值前缀(如 `$`) */
46
+ prefix?: React.ReactNode;
47
+ /** 值后缀(如 `%`) */
48
+ suffix?: React.ReactNode;
49
+ /** 自定义格式化;给出时接管数值格式化,precision / groupSeparator 失效 */
50
+ formatter?: (value: string | number) => React.ReactNode;
51
+ /**
52
+ * 千分位分隔符(仅 number 值、未给 formatter 时生效)
53
+ * @default ','
54
+ */
55
+ groupSeparator?: string;
56
+ /** 趋势涨/跌 */
57
+ trend?: StatTrend;
58
+ /**
59
+ * 反转趋势好坏(「跌是好事」的指标,如 Bounce Rate)
60
+ * @default false
61
+ */
62
+ trendReversed?: boolean;
63
+ /** 副说明(如 vs previous 30 days) */
64
+ caption?: React.ReactNode;
65
+ /** 状态点 + 文案 */
66
+ status?: StatStatus;
67
+ }
68
+ /**
69
+ * 把一个指标画成「标签 + 大值 + 趋势 + 副说明 + 状态点」,趋势色走语义角色变量、方向经 <Icon>。
70
+ */
71
+ export declare const Stat: React.FC<StatProps>;
@@ -0,0 +1,66 @@
1
+ import { Icon as e } from "../Icon/Icon.js";
2
+ import t from "./stat.module.js";
3
+ import { useId as n } from "react";
4
+ import r from "clsx";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ //#region packages/react/src/components/Stat/Stat.tsx
7
+ function o(e, t, n) {
8
+ let [r, i] = (t == null ? String(e) : e.toFixed(t)).split("."), a = r.startsWith("-") ? "-" : "", o = (a ? r.slice(1) : r).replace(/\B(?=(\d{3})+(?!\d))/g, n);
9
+ return i == null ? `${a}${o}` : `${a}${o}.${i}`;
10
+ }
11
+ var s = ({ title: s, value: c, precision: l, prefix: u, suffix: d, formatter: f, groupSeparator: p = ",", trend: m, trendReversed: h = !1, caption: g, status: _, className: v, ...y }) => {
12
+ let b = n(), x = f ? f(c) : typeof c == "number" ? o(c, l, p) : c, S = m?.direction ?? ((m?.value ?? 0) >= 0 ? "up" : "down"), C = h ? S === "down" : S === "up";
13
+ return /* @__PURE__ */ a("div", {
14
+ className: r(t.stat, v),
15
+ ...s == null ? null : {
16
+ role: "group",
17
+ "aria-labelledby": b
18
+ },
19
+ ...y,
20
+ children: [
21
+ s != null && /* @__PURE__ */ i("div", {
22
+ id: b,
23
+ className: t["stat-title"],
24
+ children: s
25
+ }),
26
+ /* @__PURE__ */ a("div", {
27
+ className: t["stat-value-row"],
28
+ children: [/* @__PURE__ */ a("div", {
29
+ className: t["stat-value"],
30
+ children: [
31
+ u != null && /* @__PURE__ */ i("span", {
32
+ className: t["stat-prefix"],
33
+ children: u
34
+ }),
35
+ /* @__PURE__ */ i("span", { children: x }),
36
+ d != null && /* @__PURE__ */ i("span", {
37
+ className: t["stat-suffix"],
38
+ children: d
39
+ })
40
+ ]
41
+ }), m != null && /* @__PURE__ */ a("span", {
42
+ className: r(t["stat-trend"], C ? t["stat-trend-positive"] : t["stat-trend-negative"]),
43
+ children: [/* @__PURE__ */ i(e, {
44
+ name: S === "up" ? "arrow-up-right" : "arrow-down-right",
45
+ size: "1em"
46
+ }), Math.abs(m.value)]
47
+ })]
48
+ }),
49
+ g != null && /* @__PURE__ */ i("div", {
50
+ className: t["stat-caption"],
51
+ children: g
52
+ }),
53
+ _ != null && /* @__PURE__ */ a("div", {
54
+ className: t["stat-status"],
55
+ children: [/* @__PURE__ */ i(e, {
56
+ name: "dot",
57
+ size: "0.6em",
58
+ className: t[`stat-dot-${_.tone ?? "neutral"}`]
59
+ }), _.text]
60
+ })
61
+ ]
62
+ });
63
+ };
64
+ s.displayName = "Stat";
65
+ //#endregion
66
+ export { s as Stat };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ /**
3
+ * 一排指标:把每个子项裹进一格,相邻格之间用发丝线 `var(--stitch-border)` 竖线分隔(首项不带)。
4
+ *
5
+ * 跨-prop 注意事项:
6
+ * - **分隔线只走角色变量** `var(--stitch-border)` + `var(--stitch-border-width)`——零硬编码。
7
+ * - 子项各自成格、等高对齐;换行时靠 flex-wrap,格内间距走 `var(--stitch-spacing-*)`。
8
+ */
9
+ export interface StatGroupProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ /** 一排指标子项(通常是 `<Stat>`) */
11
+ children?: React.ReactNode;
12
+ }
13
+ /** 把一排指标横排,相邻项之间以发丝线分隔。 */
14
+ export declare const StatGroup: React.FC<StatGroupProps>;
@@ -0,0 +1,16 @@
1
+ import e from "./stat.module.js";
2
+ import t from "react";
3
+ import n from "clsx";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ //#region packages/react/src/components/Stat/StatGroup.tsx
6
+ var i = ({ children: i, className: a, ...o }) => /* @__PURE__ */ r("div", {
7
+ className: n(e.group, a),
8
+ ...o,
9
+ children: t.Children.map(i, (t) => t == null || t === !1 ? t : /* @__PURE__ */ r("div", {
10
+ className: e["group-item"],
11
+ children: t
12
+ }))
13
+ });
14
+ i.displayName = "StatGroup";
15
+ //#endregion
16
+ export { i as StatGroup };
@@ -0,0 +1,4 @@
1
+ export { Stat } from './Stat';
2
+ export type { StatProps, StatTrend, StatTrendDirection, StatStatus, StatStatusTone, } from './Stat';
3
+ export { StatGroup } from './StatGroup';
4
+ export type { StatGroupProps } from './StatGroup';
@@ -0,0 +1,23 @@
1
+ //#region packages/react/src/components/Stat/stat.module.less
2
+ var e = "_stat_1wp9y_1", t = "_group_1wp9y_69", n = {
3
+ stat: e,
4
+ "stat-title": "_stat-title_1wp9y_8",
5
+ "stat-value-row": "_stat-value-row_1wp9y_12",
6
+ "stat-value": "_stat-value_1wp9y_12",
7
+ "stat-prefix": "_stat-prefix_1wp9y_25",
8
+ "stat-suffix": "_stat-suffix_1wp9y_26",
9
+ "stat-trend": "_stat-trend_1wp9y_30",
10
+ "stat-trend-positive": "_stat-trend-positive_1wp9y_37",
11
+ "stat-trend-negative": "_stat-trend-negative_1wp9y_40",
12
+ "stat-caption": "_stat-caption_1wp9y_43",
13
+ "stat-status": "_stat-status_1wp9y_47",
14
+ "stat-dot-neutral": "_stat-dot-neutral_1wp9y_54",
15
+ "stat-dot-success": "_stat-dot-success_1wp9y_57",
16
+ "stat-dot-danger": "_stat-dot-danger_1wp9y_60",
17
+ "stat-dot-warning": "_stat-dot-warning_1wp9y_63",
18
+ "stat-dot-info": "_stat-dot-info_1wp9y_66",
19
+ group: t,
20
+ "group-item": "_group-item_1wp9y_74"
21
+ };
22
+ //#endregion
23
+ export { n as default, t as group, e as stat };
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ export interface ChartFrameProps {
3
+ /**
4
+ * 图表整体的可访问名(文本替代)。漏传时兜底 `'图表'`,保证 `role="img"` 永远有名。
5
+ */
6
+ ariaLabel?: string;
7
+ /**
8
+ * 图表高度(px)。图表无内在高度,须由消费者给;宽度恒铺满容器。
9
+ * @default 300
10
+ */
11
+ height?: number;
12
+ /** 单个 recharts 图表元素(LineChart / BarChart / PieChart…)。 */
13
+ children: React.ReactElement;
14
+ /** 透传到外层容器 */
15
+ className?: string;
16
+ }
17
+ /**
18
+ * 把单个 recharts 图表包进响应式容器 + `role="img"` a11y 外壳。
19
+ */
20
+ export declare const ChartFrame: React.FC<ChartFrameProps>;
@@ -0,0 +1,18 @@
1
+ import e from "./chart-frame.module.js";
2
+ import "react";
3
+ import { jsx as t } from "react/jsx-runtime";
4
+ import { ResponsiveContainer as n } from "recharts";
5
+ //#region packages/react/src/components/_internal/dataviz/ChartFrame.tsx
6
+ var r = ({ ariaLabel: r = "图表", height: i = 300, children: a, className: o }) => /* @__PURE__ */ t("div", {
7
+ role: "img",
8
+ "aria-label": r,
9
+ className: o ? `${e.frame} ${o}` : e.frame,
10
+ children: /* @__PURE__ */ t(n, {
11
+ width: "100%",
12
+ height: i,
13
+ children: a
14
+ })
15
+ });
16
+ r.displayName = "ChartFrame";
17
+ //#endregion
18
+ export { r as ChartFrame };
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ /** recharts 运行时注入的单条系列数据(我们用到的最小形状)。 */
3
+ export interface ChartTooltipEntry {
4
+ /** 系列名 */
5
+ name?: React.ReactNode;
6
+ /** 该点的值 */
7
+ value?: React.ReactNode;
8
+ /** 系列色——恒为 chartColors 桥给的 `var(--stitch-cat-*)` 角色变量 */
9
+ color?: string;
10
+ }
11
+ export interface ChartTooltipProps {
12
+ /** 是否命中数据点(recharts 注入);非命中不渲染 */
13
+ active?: boolean;
14
+ /** 命中点的各系列数据(recharts 注入) */
15
+ payload?: ChartTooltipEntry[];
16
+ /** 该点的 x 轴标签(recharts 注入) */
17
+ label?: React.ReactNode;
18
+ }
19
+ /**
20
+ * recharts tooltip 的自定义内容:用 `Card` 作表面,逐系列列出「色块 · 名 · 值」。
21
+ * 非 active 或无数据时返回 `null`(不挡视线)。
22
+ */
23
+ export declare const ChartTooltip: React.FC<ChartTooltipProps>;
@@ -0,0 +1,33 @@
1
+ import { Card as e } from "../../Card/Card.js";
2
+ import t from "./chart-tooltip.module.js";
3
+ import "react";
4
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
+ //#region packages/react/src/components/_internal/dataviz/ChartTooltip.tsx
6
+ var i = ({ active: i, payload: a, label: o }) => !i || !a || a.length === 0 ? null : /* @__PURE__ */ r(e, {
7
+ variant: "elevated",
8
+ className: t.tooltip,
9
+ children: [o != null && o !== "" && /* @__PURE__ */ n("div", {
10
+ className: t.label,
11
+ children: o
12
+ }), a.map((e, i) => /* @__PURE__ */ r("div", {
13
+ className: t.row,
14
+ children: [
15
+ /* @__PURE__ */ n("span", {
16
+ "data-chart-swatch": !0,
17
+ className: t.swatch,
18
+ style: { background: e.color }
19
+ }),
20
+ /* @__PURE__ */ n("span", {
21
+ className: t.name,
22
+ children: e.name
23
+ }),
24
+ /* @__PURE__ */ n("span", {
25
+ className: t.value,
26
+ children: e.value
27
+ })
28
+ ]
29
+ }, i))]
30
+ });
31
+ i.displayName = "ChartTooltip";
32
+ //#endregion
33
+ export { i as ChartTooltip };
@@ -0,0 +1,4 @@
1
+ //#region packages/react/src/components/_internal/dataviz/chart-frame.module.less
2
+ var e = "_frame_o1yrk_1", t = { frame: e };
3
+ //#endregion
4
+ export { t as default, e as frame };
@@ -0,0 +1,11 @@
1
+ //#region packages/react/src/components/_internal/dataviz/chart-tooltip.module.less
2
+ var e = "_tooltip_6t8so_1", t = "_label_6t8so_8", n = "_row_6t8so_12", r = "_swatch_6t8so_18", i = "_name_6t8so_24", a = "_value_6t8so_27", o = {
3
+ tooltip: e,
4
+ label: t,
5
+ row: n,
6
+ swatch: r,
7
+ name: i,
8
+ value: a
9
+ };
10
+ //#endregion
11
+ export { o as default, t as label, i as name, n as row, r as swatch, e as tooltip, a as value };
@@ -0,0 +1,12 @@
1
+ /** 契约分类色槽数量(`--stitch-cat-1..6`,见 contract.css,固定 6,可移植)。 */
2
+ export declare const CAT_SLOT_COUNT = 6;
3
+ /**
4
+ * 系列序号 → 分类色角色变量。序号从 0 起,超出 6 个槽位循环复用
5
+ * (recharts 系列数不限,色槽恒 6)。产出恒为 `var(--stitch-cat-N)`,绝不落 hex。
6
+ */
7
+ export declare const catColor: (index: number) => string;
8
+ /**
9
+ * 一次取一整排系列色,喂给 recharts 的多系列(Line/Bar/Pie 的 N 个系列/扇区)。
10
+ * `seriesColors(n)[i]` === `catColor(i)`。
11
+ */
12
+ export declare const seriesColors: (count: number) => string[];
@@ -0,0 +1,3 @@
1
+ var e = (e) => `var(--stitch-cat-${(e % 6 + 6) % 6 + 1})`;
2
+ //#endregion
3
+ export { e as catColor };
@@ -0,0 +1,5 @@
1
+ export { CAT_SLOT_COUNT, catColor, seriesColors } from './chartColors';
2
+ export { ChartFrame } from './ChartFrame';
3
+ export type { ChartFrameProps } from './ChartFrame';
4
+ export { ChartTooltip } from './ChartTooltip';
5
+ export type { ChartTooltipProps, ChartTooltipEntry } from './ChartTooltip';
package/dist/index.d.ts CHANGED
@@ -40,6 +40,10 @@ export { Label } from './components/Label';
40
40
  export type { LabelProps } from './components/Label';
41
41
  export { Select } from './components/Select';
42
42
  export type { SelectProps, SelectOption, SelectSize, } from './components/Select';
43
+ export { Calendar } from './components/Calendar';
44
+ export type { CalendarProps, CalendarMode, CalendarCaptionLayout, DateRange, } from './components/Calendar';
45
+ export { DatePicker } from './components/DatePicker';
46
+ export type { DatePickerProps, DatePickerSize } from './components/DatePicker';
43
47
  export { Form } from './components/Form';
44
48
  export type { FormProps, FormItemProps, FormInstance, FormLayout, FormLabelAlign, FormSize, FormItemLayout, RequiredMark, ValidateStatus, RuleObject, RuleRender, RuleType, Rules, NamePath, ColProps, FieldData, ValidateError, ValidateInfo, ScrollOptions, StoreValue, FormProviderProps, } from './components/Form';
45
49
  export { Tag } from './components/Tag';
@@ -48,6 +52,14 @@ export { Table } from './components/Table';
48
52
  export type { TableProps, TableColumn } from './components/Table';
49
53
  export { CodeBlock } from './components/CodeBlock';
50
54
  export type { CodeBlockProps } from './components/CodeBlock';
55
+ export { LineChart } from './components/LineChart';
56
+ export type { LineChartProps, LineChartSeries } from './components/LineChart';
57
+ export { BarChart } from './components/BarChart';
58
+ export type { BarChartProps, BarChartSeries } from './components/BarChart';
59
+ export { PieChart } from './components/PieChart';
60
+ export type { PieChartProps } from './components/PieChart';
61
+ export { Stat, StatGroup } from './components/Stat';
62
+ export type { StatProps, StatTrend, StatTrendDirection, StatStatus, StatStatusTone, StatGroupProps, } from './components/Stat';
51
63
  export { Loading } from './components/Loading';
52
64
  export type { LoadingProps, LoadingSize } from './components/Loading';
53
65
  export { Progress } from './components/Progress';