@x-plat/design-system 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Chart/index.cjs +5 -4
- package/dist/components/Chart/index.d.cts +9 -0
- package/dist/components/Chart/index.d.ts +9 -0
- package/dist/components/Chart/index.js +5 -4
- package/dist/components/Table/index.cjs +42 -15
- package/dist/components/Table/index.css +31 -5
- package/dist/components/Table/index.js +42 -15
- package/dist/components/index.cjs +47 -19
- package/dist/components/index.css +31 -5
- package/dist/components/index.js +47 -19
- package/dist/index.cjs +47 -19
- package/dist/index.css +31 -5
- package/dist/index.js +47 -19
- package/guidelines/components/chart.md +52 -10
- package/guidelines/components/table.md +23 -0
- package/package.json +1 -1
|
@@ -643,9 +643,9 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, childr
|
|
|
643
643
|
}
|
|
644
644
|
);
|
|
645
645
|
};
|
|
646
|
-
var ChartLegend = ({ data, labels,
|
|
646
|
+
var ChartLegend = ({ data, labels, shape }) => {
|
|
647
647
|
const entries = Object.entries(data);
|
|
648
|
-
if (
|
|
648
|
+
if (shape === "pie" || shape === "doughnut") {
|
|
649
649
|
const values = entries.flatMap(([, v]) => v);
|
|
650
650
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
651
651
|
const firstKey = entries[0]?.[0] ?? "";
|
|
@@ -682,8 +682,9 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
682
682
|
}) });
|
|
683
683
|
};
|
|
684
684
|
var Chart = import_react.default.memo((props) => {
|
|
685
|
-
const { variant, type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
685
|
+
const { variant, type, data, labels, legend, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
686
686
|
const shape = variant ?? type ?? "line";
|
|
687
|
+
const showLegend = legend ?? (shape === "pie" || shape === "doughnut");
|
|
687
688
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
688
689
|
const { width, height } = useChartSize(containerRef);
|
|
689
690
|
const stableData = import_react.default.useMemo(() => data, [JSON.stringify(data)]);
|
|
@@ -697,7 +698,7 @@ var Chart = import_react.default.memo((props) => {
|
|
|
697
698
|
ready && shape === "bar" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
698
699
|
ready && shape === "pie" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
699
700
|
ready && shape === "doughnut" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
700
|
-
ready &&
|
|
701
|
+
ready && showLegend && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartLegend, { data: stableData, labels: stableLabels, shape }),
|
|
701
702
|
tooltip.visible && tooltip.content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
702
703
|
] });
|
|
703
704
|
});
|
|
@@ -13,6 +13,15 @@ interface ChartProps {
|
|
|
13
13
|
data: Record<string, number[]>;
|
|
14
14
|
/** x축 라벨. data 의 값 배열과 길이가 같아야 한다 */
|
|
15
15
|
labels: string[];
|
|
16
|
+
/**
|
|
17
|
+
* 계열 이름·색·합계를 차트 아래에 적는다.
|
|
18
|
+
*
|
|
19
|
+
* 안 주면 **원형·도넛만 켜진다** — 조각에는 제 이름을 적을 데가 없어서다.
|
|
20
|
+
* 선·곡선·막대는 축 라벨이 있어 지금까지 범례 없이 지냈고, 켜면 차트가
|
|
21
|
+
* 범례 높이만큼 길어지므로 기본값을 바꾸지 않는다. 필요한 곳에서 `legend`
|
|
22
|
+
* 를 주면 된다.
|
|
23
|
+
*/
|
|
24
|
+
legend?: boolean;
|
|
16
25
|
/** 마우스를 올렸을 때 값 말풍선을 띄운다 */
|
|
17
26
|
tooltip?: boolean;
|
|
18
27
|
/** 말풍선 배색 */
|
|
@@ -13,6 +13,15 @@ interface ChartProps {
|
|
|
13
13
|
data: Record<string, number[]>;
|
|
14
14
|
/** x축 라벨. data 의 값 배열과 길이가 같아야 한다 */
|
|
15
15
|
labels: string[];
|
|
16
|
+
/**
|
|
17
|
+
* 계열 이름·색·합계를 차트 아래에 적는다.
|
|
18
|
+
*
|
|
19
|
+
* 안 주면 **원형·도넛만 켜진다** — 조각에는 제 이름을 적을 데가 없어서다.
|
|
20
|
+
* 선·곡선·막대는 축 라벨이 있어 지금까지 범례 없이 지냈고, 켜면 차트가
|
|
21
|
+
* 범례 높이만큼 길어지므로 기본값을 바꾸지 않는다. 필요한 곳에서 `legend`
|
|
22
|
+
* 를 주면 된다.
|
|
23
|
+
*/
|
|
24
|
+
legend?: boolean;
|
|
16
25
|
/** 마우스를 올렸을 때 값 말풍선을 띄운다 */
|
|
17
26
|
tooltip?: boolean;
|
|
18
27
|
/** 말풍선 배색 */
|
|
@@ -607,9 +607,9 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, childr
|
|
|
607
607
|
}
|
|
608
608
|
);
|
|
609
609
|
};
|
|
610
|
-
var ChartLegend = ({ data, labels,
|
|
610
|
+
var ChartLegend = ({ data, labels, shape }) => {
|
|
611
611
|
const entries = Object.entries(data);
|
|
612
|
-
if (
|
|
612
|
+
if (shape === "pie" || shape === "doughnut") {
|
|
613
613
|
const values = entries.flatMap(([, v]) => v);
|
|
614
614
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
615
615
|
const firstKey = entries[0]?.[0] ?? "";
|
|
@@ -646,8 +646,9 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
646
646
|
}) });
|
|
647
647
|
};
|
|
648
648
|
var Chart = React.memo((props) => {
|
|
649
|
-
const { variant, type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
649
|
+
const { variant, type, data, labels, legend, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
650
650
|
const shape = variant ?? type ?? "line";
|
|
651
|
+
const showLegend = legend ?? (shape === "pie" || shape === "doughnut");
|
|
651
652
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
652
653
|
const { width, height } = useChartSize(containerRef);
|
|
653
654
|
const stableData = React.useMemo(() => data, [JSON.stringify(data)]);
|
|
@@ -661,7 +662,7 @@ var Chart = React.memo((props) => {
|
|
|
661
662
|
ready && shape === "bar" && /* @__PURE__ */ jsx(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
662
663
|
ready && shape === "pie" && /* @__PURE__ */ jsx(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
663
664
|
ready && shape === "doughnut" && /* @__PURE__ */ jsx(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
664
|
-
ready &&
|
|
665
|
+
ready && showLegend && /* @__PURE__ */ jsx(ChartLegend, { data: stableData, labels: stableLabels, shape }),
|
|
665
666
|
tooltip.visible && tooltip.content && /* @__PURE__ */ jsx(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
666
667
|
] });
|
|
667
668
|
});
|
|
@@ -59,21 +59,32 @@ var import_jsx_runtime = (
|
|
|
59
59
|
*/
|
|
60
60
|
require("react/jsx-runtime")
|
|
61
61
|
);
|
|
62
|
-
var useScrollExtent = (scrollerRef,
|
|
63
|
-
const [scrollable, setScrollable] = import_react2.default.useState(false);
|
|
62
|
+
var useScrollExtent = (scrollerRef, thumbXRef, thumbYRef) => {
|
|
63
|
+
const [scrollable, setScrollable] = import_react2.default.useState({ x: false, y: false });
|
|
64
64
|
import_react2.default.useEffect(() => {
|
|
65
65
|
const el = scrollerRef.current;
|
|
66
66
|
if (!el) return;
|
|
67
|
+
const MIN = 8;
|
|
67
68
|
const update = () => {
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
const maxX = el.scrollWidth - el.clientWidth;
|
|
70
|
+
const maxY = el.scrollHeight - el.clientHeight;
|
|
71
|
+
const canX = maxX > 1;
|
|
72
|
+
const canY = maxY > 1;
|
|
73
|
+
setScrollable(
|
|
74
|
+
(prev) => prev.x === canX && prev.y === canY ? prev : { x: canX, y: canY }
|
|
75
|
+
);
|
|
76
|
+
const thumbX = thumbXRef.current;
|
|
77
|
+
if (thumbX) {
|
|
78
|
+
const w = canX ? Math.max(el.clientWidth / el.scrollWidth * 100, MIN) : 100;
|
|
79
|
+
thumbX.style.width = `${w.toFixed(2)}%`;
|
|
80
|
+
thumbX.style.left = canX ? `${(el.scrollLeft / maxX * (100 - w)).toFixed(2)}%` : "0%";
|
|
81
|
+
}
|
|
82
|
+
const thumbY = thumbYRef.current;
|
|
83
|
+
if (thumbY) {
|
|
84
|
+
const h = canY ? Math.max(el.clientHeight / el.scrollHeight * 100, MIN) : 100;
|
|
85
|
+
thumbY.style.height = `${h.toFixed(2)}%`;
|
|
86
|
+
thumbY.style.top = canY ? `${(el.scrollTop / maxY * (100 - h)).toFixed(2)}%` : "0%";
|
|
87
|
+
}
|
|
77
88
|
};
|
|
78
89
|
update();
|
|
79
90
|
el.addEventListener("scroll", update, { passive: true });
|
|
@@ -85,7 +96,7 @@ var useScrollExtent = (scrollerRef, thumbRef) => {
|
|
|
85
96
|
el.removeEventListener("scroll", update);
|
|
86
97
|
ro.disconnect();
|
|
87
98
|
};
|
|
88
|
-
}, [scrollerRef,
|
|
99
|
+
}, [scrollerRef, thumbXRef, thumbYRef]);
|
|
89
100
|
return scrollable;
|
|
90
101
|
};
|
|
91
102
|
var Table = (props) => {
|
|
@@ -99,8 +110,9 @@ var Table = (props) => {
|
|
|
99
110
|
minWidth
|
|
100
111
|
} = props;
|
|
101
112
|
const scrollerRef = import_react2.default.useRef(null);
|
|
102
|
-
const
|
|
103
|
-
const
|
|
113
|
+
const thumbXRef = import_react2.default.useRef(null);
|
|
114
|
+
const thumbYRef = import_react2.default.useRef(null);
|
|
115
|
+
const scrollable = useScrollExtent(scrollerRef, thumbXRef, thumbYRef);
|
|
104
116
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
105
117
|
"div",
|
|
106
118
|
{
|
|
@@ -129,7 +141,22 @@ var Table = (props) => {
|
|
|
129
141
|
)
|
|
130
142
|
}
|
|
131
143
|
),
|
|
132
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
144
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
className: `lib-xplat-table-scrollbar-y${scrollable.y ? " scrollable" : ""}`,
|
|
148
|
+
"aria-hidden": true,
|
|
149
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: thumbYRef, className: "table-scrollbar-thumb" })
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
className: `lib-xplat-table-scrollbar${scrollable.x ? " scrollable" : ""}`,
|
|
156
|
+
"aria-hidden": true,
|
|
157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: thumbXRef, className: "table-scrollbar-thumb" })
|
|
158
|
+
}
|
|
159
|
+
)
|
|
133
160
|
]
|
|
134
161
|
}
|
|
135
162
|
);
|
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
width: 100%;
|
|
7
7
|
height: 100%;
|
|
8
8
|
position: relative;
|
|
9
|
-
display:
|
|
10
|
-
|
|
9
|
+
display: grid;
|
|
10
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
11
|
+
grid-template-rows: minmax(0, 1fr) auto;
|
|
11
12
|
}
|
|
12
13
|
.lib-xplat-table-wrapper > .lib-xplat-table-scroller {
|
|
13
|
-
|
|
14
|
+
grid-area: 1/1;
|
|
15
|
+
min-width: 0;
|
|
14
16
|
min-height: 0;
|
|
15
17
|
width: 100%;
|
|
16
18
|
overflow: auto;
|
|
@@ -22,13 +24,15 @@
|
|
|
22
24
|
.lib-xplat-table-wrapper {
|
|
23
25
|
}
|
|
24
26
|
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar {
|
|
25
|
-
|
|
27
|
+
grid-area: 2/1;
|
|
28
|
+
height: 0;
|
|
26
29
|
position: relative;
|
|
27
30
|
background-color: var(--semantic-border-primary);
|
|
28
31
|
opacity: 0;
|
|
29
|
-
transition: opacity 0.15s ease;
|
|
32
|
+
transition: height 0.15s ease, opacity 0.15s ease;
|
|
30
33
|
}
|
|
31
34
|
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar.scrollable {
|
|
35
|
+
height: 3px;
|
|
32
36
|
opacity: 1;
|
|
33
37
|
}
|
|
34
38
|
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar > .table-scrollbar-thumb {
|
|
@@ -39,6 +43,28 @@
|
|
|
39
43
|
background-color: var(--semantic-surface-brand-default);
|
|
40
44
|
opacity: 0.55;
|
|
41
45
|
}
|
|
46
|
+
.lib-xplat-table-wrapper {
|
|
47
|
+
}
|
|
48
|
+
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar-y {
|
|
49
|
+
grid-area: 1/2;
|
|
50
|
+
width: 0;
|
|
51
|
+
position: relative;
|
|
52
|
+
background-color: var(--semantic-border-primary);
|
|
53
|
+
opacity: 0;
|
|
54
|
+
transition: width 0.15s ease, opacity 0.15s ease;
|
|
55
|
+
}
|
|
56
|
+
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar-y.scrollable {
|
|
57
|
+
width: 3px;
|
|
58
|
+
opacity: 1;
|
|
59
|
+
}
|
|
60
|
+
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar-y > .table-scrollbar-thumb {
|
|
61
|
+
position: absolute;
|
|
62
|
+
left: 0;
|
|
63
|
+
right: 0;
|
|
64
|
+
border-radius: var(--spacing-radius-full);
|
|
65
|
+
background-color: var(--semantic-surface-brand-default);
|
|
66
|
+
opacity: 0.55;
|
|
67
|
+
}
|
|
42
68
|
.lib-xplat-table-wrapper.sm > .lib-xplat-table > thead > tr > th,
|
|
43
69
|
.lib-xplat-table-wrapper.sm > .lib-xplat-table > thead > tr > td,
|
|
44
70
|
.lib-xplat-table-wrapper.sm > .lib-xplat-table > tbody > tr > th,
|
|
@@ -13,21 +13,32 @@ var TableContext_default = TableContext;
|
|
|
13
13
|
|
|
14
14
|
// src/components/Table/Table.tsx
|
|
15
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
var useScrollExtent = (scrollerRef,
|
|
17
|
-
const [scrollable, setScrollable] = React2.useState(false);
|
|
16
|
+
var useScrollExtent = (scrollerRef, thumbXRef, thumbYRef) => {
|
|
17
|
+
const [scrollable, setScrollable] = React2.useState({ x: false, y: false });
|
|
18
18
|
React2.useEffect(() => {
|
|
19
19
|
const el = scrollerRef.current;
|
|
20
20
|
if (!el) return;
|
|
21
|
+
const MIN = 8;
|
|
21
22
|
const update = () => {
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
const maxX = el.scrollWidth - el.clientWidth;
|
|
24
|
+
const maxY = el.scrollHeight - el.clientHeight;
|
|
25
|
+
const canX = maxX > 1;
|
|
26
|
+
const canY = maxY > 1;
|
|
27
|
+
setScrollable(
|
|
28
|
+
(prev) => prev.x === canX && prev.y === canY ? prev : { x: canX, y: canY }
|
|
29
|
+
);
|
|
30
|
+
const thumbX = thumbXRef.current;
|
|
31
|
+
if (thumbX) {
|
|
32
|
+
const w = canX ? Math.max(el.clientWidth / el.scrollWidth * 100, MIN) : 100;
|
|
33
|
+
thumbX.style.width = `${w.toFixed(2)}%`;
|
|
34
|
+
thumbX.style.left = canX ? `${(el.scrollLeft / maxX * (100 - w)).toFixed(2)}%` : "0%";
|
|
35
|
+
}
|
|
36
|
+
const thumbY = thumbYRef.current;
|
|
37
|
+
if (thumbY) {
|
|
38
|
+
const h = canY ? Math.max(el.clientHeight / el.scrollHeight * 100, MIN) : 100;
|
|
39
|
+
thumbY.style.height = `${h.toFixed(2)}%`;
|
|
40
|
+
thumbY.style.top = canY ? `${(el.scrollTop / maxY * (100 - h)).toFixed(2)}%` : "0%";
|
|
41
|
+
}
|
|
31
42
|
};
|
|
32
43
|
update();
|
|
33
44
|
el.addEventListener("scroll", update, { passive: true });
|
|
@@ -39,7 +50,7 @@ var useScrollExtent = (scrollerRef, thumbRef) => {
|
|
|
39
50
|
el.removeEventListener("scroll", update);
|
|
40
51
|
ro.disconnect();
|
|
41
52
|
};
|
|
42
|
-
}, [scrollerRef,
|
|
53
|
+
}, [scrollerRef, thumbXRef, thumbYRef]);
|
|
43
54
|
return scrollable;
|
|
44
55
|
};
|
|
45
56
|
var Table = (props) => {
|
|
@@ -53,8 +64,9 @@ var Table = (props) => {
|
|
|
53
64
|
minWidth
|
|
54
65
|
} = props;
|
|
55
66
|
const scrollerRef = React2.useRef(null);
|
|
56
|
-
const
|
|
57
|
-
const
|
|
67
|
+
const thumbXRef = React2.useRef(null);
|
|
68
|
+
const thumbYRef = React2.useRef(null);
|
|
69
|
+
const scrollable = useScrollExtent(scrollerRef, thumbXRef, thumbYRef);
|
|
58
70
|
return (
|
|
59
71
|
/**
|
|
60
72
|
* 바깥 이름(`lib-xplat-table-wrapper`)을 그대로 둔다 — 소비처가 이 클래스를
|
|
@@ -88,7 +100,22 @@ var Table = (props) => {
|
|
|
88
100
|
)
|
|
89
101
|
}
|
|
90
102
|
),
|
|
91
|
-
/* @__PURE__ */ jsx(
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
className: `lib-xplat-table-scrollbar-y${scrollable.y ? " scrollable" : ""}`,
|
|
107
|
+
"aria-hidden": true,
|
|
108
|
+
children: /* @__PURE__ */ jsx("div", { ref: thumbYRef, className: "table-scrollbar-thumb" })
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ jsx(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
className: `lib-xplat-table-scrollbar${scrollable.x ? " scrollable" : ""}`,
|
|
115
|
+
"aria-hidden": true,
|
|
116
|
+
children: /* @__PURE__ */ jsx("div", { ref: thumbXRef, className: "table-scrollbar-thumb" })
|
|
117
|
+
}
|
|
118
|
+
)
|
|
92
119
|
]
|
|
93
120
|
}
|
|
94
121
|
)
|
|
@@ -2831,9 +2831,9 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, childr
|
|
|
2831
2831
|
}
|
|
2832
2832
|
);
|
|
2833
2833
|
};
|
|
2834
|
-
var ChartLegend = ({ data, labels,
|
|
2834
|
+
var ChartLegend = ({ data, labels, shape }) => {
|
|
2835
2835
|
const entries = Object.entries(data);
|
|
2836
|
-
if (
|
|
2836
|
+
if (shape === "pie" || shape === "doughnut") {
|
|
2837
2837
|
const values = entries.flatMap(([, v]) => v);
|
|
2838
2838
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
2839
2839
|
const firstKey = entries[0]?.[0] ?? "";
|
|
@@ -2870,8 +2870,9 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
2870
2870
|
}) });
|
|
2871
2871
|
};
|
|
2872
2872
|
var Chart = import_react6.default.memo((props) => {
|
|
2873
|
-
const { variant, type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
2873
|
+
const { variant, type, data, labels, legend, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
2874
2874
|
const shape = variant ?? type ?? "line";
|
|
2875
|
+
const showLegend = legend ?? (shape === "pie" || shape === "doughnut");
|
|
2875
2876
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
2876
2877
|
const { width, height } = useChartSize(containerRef);
|
|
2877
2878
|
const stableData = import_react6.default.useMemo(() => data, [JSON.stringify(data)]);
|
|
@@ -2885,7 +2886,7 @@ var Chart = import_react6.default.memo((props) => {
|
|
|
2885
2886
|
ready && shape === "bar" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2886
2887
|
ready && shape === "pie" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2887
2888
|
ready && shape === "doughnut" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
2888
|
-
ready &&
|
|
2889
|
+
ready && showLegend && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(ChartLegend, { data: stableData, labels: stableLabels, shape }),
|
|
2889
2890
|
tooltip.visible && tooltip.content && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
2890
2891
|
] });
|
|
2891
2892
|
});
|
|
@@ -7062,21 +7063,32 @@ var import_jsx_runtime344 = (
|
|
|
7062
7063
|
*/
|
|
7063
7064
|
require("react/jsx-runtime")
|
|
7064
7065
|
);
|
|
7065
|
-
var useScrollExtent = (scrollerRef,
|
|
7066
|
-
const [scrollable, setScrollable] = import_react36.default.useState(false);
|
|
7066
|
+
var useScrollExtent = (scrollerRef, thumbXRef, thumbYRef) => {
|
|
7067
|
+
const [scrollable, setScrollable] = import_react36.default.useState({ x: false, y: false });
|
|
7067
7068
|
import_react36.default.useEffect(() => {
|
|
7068
7069
|
const el = scrollerRef.current;
|
|
7069
7070
|
if (!el) return;
|
|
7071
|
+
const MIN = 8;
|
|
7070
7072
|
const update = () => {
|
|
7071
|
-
const
|
|
7072
|
-
const
|
|
7073
|
-
|
|
7074
|
-
const
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7073
|
+
const maxX = el.scrollWidth - el.clientWidth;
|
|
7074
|
+
const maxY = el.scrollHeight - el.clientHeight;
|
|
7075
|
+
const canX = maxX > 1;
|
|
7076
|
+
const canY = maxY > 1;
|
|
7077
|
+
setScrollable(
|
|
7078
|
+
(prev) => prev.x === canX && prev.y === canY ? prev : { x: canX, y: canY }
|
|
7079
|
+
);
|
|
7080
|
+
const thumbX = thumbXRef.current;
|
|
7081
|
+
if (thumbX) {
|
|
7082
|
+
const w = canX ? Math.max(el.clientWidth / el.scrollWidth * 100, MIN) : 100;
|
|
7083
|
+
thumbX.style.width = `${w.toFixed(2)}%`;
|
|
7084
|
+
thumbX.style.left = canX ? `${(el.scrollLeft / maxX * (100 - w)).toFixed(2)}%` : "0%";
|
|
7085
|
+
}
|
|
7086
|
+
const thumbY = thumbYRef.current;
|
|
7087
|
+
if (thumbY) {
|
|
7088
|
+
const h = canY ? Math.max(el.clientHeight / el.scrollHeight * 100, MIN) : 100;
|
|
7089
|
+
thumbY.style.height = `${h.toFixed(2)}%`;
|
|
7090
|
+
thumbY.style.top = canY ? `${(el.scrollTop / maxY * (100 - h)).toFixed(2)}%` : "0%";
|
|
7091
|
+
}
|
|
7080
7092
|
};
|
|
7081
7093
|
update();
|
|
7082
7094
|
el.addEventListener("scroll", update, { passive: true });
|
|
@@ -7088,7 +7100,7 @@ var useScrollExtent = (scrollerRef, thumbRef) => {
|
|
|
7088
7100
|
el.removeEventListener("scroll", update);
|
|
7089
7101
|
ro.disconnect();
|
|
7090
7102
|
};
|
|
7091
|
-
}, [scrollerRef,
|
|
7103
|
+
}, [scrollerRef, thumbXRef, thumbYRef]);
|
|
7092
7104
|
return scrollable;
|
|
7093
7105
|
};
|
|
7094
7106
|
var Table = (props) => {
|
|
@@ -7102,8 +7114,9 @@ var Table = (props) => {
|
|
|
7102
7114
|
minWidth
|
|
7103
7115
|
} = props;
|
|
7104
7116
|
const scrollerRef = import_react36.default.useRef(null);
|
|
7105
|
-
const
|
|
7106
|
-
const
|
|
7117
|
+
const thumbXRef = import_react36.default.useRef(null);
|
|
7118
|
+
const thumbYRef = import_react36.default.useRef(null);
|
|
7119
|
+
const scrollable = useScrollExtent(scrollerRef, thumbXRef, thumbYRef);
|
|
7107
7120
|
return /* @__PURE__ */ (0, import_jsx_runtime344.jsxs)(
|
|
7108
7121
|
"div",
|
|
7109
7122
|
{
|
|
@@ -7132,7 +7145,22 @@ var Table = (props) => {
|
|
|
7132
7145
|
)
|
|
7133
7146
|
}
|
|
7134
7147
|
),
|
|
7135
|
-
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
7148
|
+
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
7149
|
+
"div",
|
|
7150
|
+
{
|
|
7151
|
+
className: `lib-xplat-table-scrollbar-y${scrollable.y ? " scrollable" : ""}`,
|
|
7152
|
+
"aria-hidden": true,
|
|
7153
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { ref: thumbYRef, className: "table-scrollbar-thumb" })
|
|
7154
|
+
}
|
|
7155
|
+
),
|
|
7156
|
+
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
7157
|
+
"div",
|
|
7158
|
+
{
|
|
7159
|
+
className: `lib-xplat-table-scrollbar${scrollable.x ? " scrollable" : ""}`,
|
|
7160
|
+
"aria-hidden": true,
|
|
7161
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { ref: thumbXRef, className: "table-scrollbar-thumb" })
|
|
7162
|
+
}
|
|
7163
|
+
)
|
|
7136
7164
|
]
|
|
7137
7165
|
}
|
|
7138
7166
|
);
|
|
@@ -5128,11 +5128,13 @@
|
|
|
5128
5128
|
width: 100%;
|
|
5129
5129
|
height: 100%;
|
|
5130
5130
|
position: relative;
|
|
5131
|
-
display:
|
|
5132
|
-
|
|
5131
|
+
display: grid;
|
|
5132
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
5133
|
+
grid-template-rows: minmax(0, 1fr) auto;
|
|
5133
5134
|
}
|
|
5134
5135
|
.lib-xplat-table-wrapper > .lib-xplat-table-scroller {
|
|
5135
|
-
|
|
5136
|
+
grid-area: 1/1;
|
|
5137
|
+
min-width: 0;
|
|
5136
5138
|
min-height: 0;
|
|
5137
5139
|
width: 100%;
|
|
5138
5140
|
overflow: auto;
|
|
@@ -5144,13 +5146,15 @@
|
|
|
5144
5146
|
.lib-xplat-table-wrapper {
|
|
5145
5147
|
}
|
|
5146
5148
|
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar {
|
|
5147
|
-
|
|
5149
|
+
grid-area: 2/1;
|
|
5150
|
+
height: 0;
|
|
5148
5151
|
position: relative;
|
|
5149
5152
|
background-color: var(--semantic-border-primary);
|
|
5150
5153
|
opacity: 0;
|
|
5151
|
-
transition: opacity 0.15s ease;
|
|
5154
|
+
transition: height 0.15s ease, opacity 0.15s ease;
|
|
5152
5155
|
}
|
|
5153
5156
|
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar.scrollable {
|
|
5157
|
+
height: 3px;
|
|
5154
5158
|
opacity: 1;
|
|
5155
5159
|
}
|
|
5156
5160
|
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar > .table-scrollbar-thumb {
|
|
@@ -5161,6 +5165,28 @@
|
|
|
5161
5165
|
background-color: var(--semantic-surface-brand-default);
|
|
5162
5166
|
opacity: 0.55;
|
|
5163
5167
|
}
|
|
5168
|
+
.lib-xplat-table-wrapper {
|
|
5169
|
+
}
|
|
5170
|
+
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar-y {
|
|
5171
|
+
grid-area: 1/2;
|
|
5172
|
+
width: 0;
|
|
5173
|
+
position: relative;
|
|
5174
|
+
background-color: var(--semantic-border-primary);
|
|
5175
|
+
opacity: 0;
|
|
5176
|
+
transition: width 0.15s ease, opacity 0.15s ease;
|
|
5177
|
+
}
|
|
5178
|
+
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar-y.scrollable {
|
|
5179
|
+
width: 3px;
|
|
5180
|
+
opacity: 1;
|
|
5181
|
+
}
|
|
5182
|
+
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar-y > .table-scrollbar-thumb {
|
|
5183
|
+
position: absolute;
|
|
5184
|
+
left: 0;
|
|
5185
|
+
right: 0;
|
|
5186
|
+
border-radius: var(--spacing-radius-full);
|
|
5187
|
+
background-color: var(--semantic-surface-brand-default);
|
|
5188
|
+
opacity: 0.55;
|
|
5189
|
+
}
|
|
5164
5190
|
.lib-xplat-table-wrapper.sm > .lib-xplat-table > thead > tr > th,
|
|
5165
5191
|
.lib-xplat-table-wrapper.sm > .lib-xplat-table > thead > tr > td,
|
|
5166
5192
|
.lib-xplat-table-wrapper.sm > .lib-xplat-table > tbody > tr > th,
|
package/dist/components/index.js
CHANGED
|
@@ -2728,9 +2728,9 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, childr
|
|
|
2728
2728
|
}
|
|
2729
2729
|
);
|
|
2730
2730
|
};
|
|
2731
|
-
var ChartLegend = ({ data, labels,
|
|
2731
|
+
var ChartLegend = ({ data, labels, shape }) => {
|
|
2732
2732
|
const entries = Object.entries(data);
|
|
2733
|
-
if (
|
|
2733
|
+
if (shape === "pie" || shape === "doughnut") {
|
|
2734
2734
|
const values = entries.flatMap(([, v]) => v);
|
|
2735
2735
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
2736
2736
|
const firstKey = entries[0]?.[0] ?? "";
|
|
@@ -2767,8 +2767,9 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
2767
2767
|
}) });
|
|
2768
2768
|
};
|
|
2769
2769
|
var Chart = React6.memo((props) => {
|
|
2770
|
-
const { variant, type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
2770
|
+
const { variant, type, data, labels, legend, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
2771
2771
|
const shape = variant ?? type ?? "line";
|
|
2772
|
+
const showLegend = legend ?? (shape === "pie" || shape === "doughnut");
|
|
2772
2773
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
2773
2774
|
const { width, height } = useChartSize(containerRef);
|
|
2774
2775
|
const stableData = React6.useMemo(() => data, [JSON.stringify(data)]);
|
|
@@ -2782,7 +2783,7 @@ var Chart = React6.memo((props) => {
|
|
|
2782
2783
|
ready && shape === "bar" && /* @__PURE__ */ jsx306(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2783
2784
|
ready && shape === "pie" && /* @__PURE__ */ jsx306(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2784
2785
|
ready && shape === "doughnut" && /* @__PURE__ */ jsx306(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
2785
|
-
ready &&
|
|
2786
|
+
ready && showLegend && /* @__PURE__ */ jsx306(ChartLegend, { data: stableData, labels: stableLabels, shape }),
|
|
2786
2787
|
tooltip.visible && tooltip.content && /* @__PURE__ */ jsx306(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
2787
2788
|
] });
|
|
2788
2789
|
});
|
|
@@ -6953,21 +6954,32 @@ var TableContext_default = TableContext;
|
|
|
6953
6954
|
|
|
6954
6955
|
// src/components/Table/Table.tsx
|
|
6955
6956
|
import { jsx as jsx344, jsxs as jsxs221 } from "react/jsx-runtime";
|
|
6956
|
-
var useScrollExtent = (scrollerRef,
|
|
6957
|
-
const [scrollable, setScrollable] = React36.useState(false);
|
|
6957
|
+
var useScrollExtent = (scrollerRef, thumbXRef, thumbYRef) => {
|
|
6958
|
+
const [scrollable, setScrollable] = React36.useState({ x: false, y: false });
|
|
6958
6959
|
React36.useEffect(() => {
|
|
6959
6960
|
const el = scrollerRef.current;
|
|
6960
6961
|
if (!el) return;
|
|
6962
|
+
const MIN = 8;
|
|
6961
6963
|
const update = () => {
|
|
6962
|
-
const
|
|
6963
|
-
const
|
|
6964
|
-
|
|
6965
|
-
const
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6964
|
+
const maxX = el.scrollWidth - el.clientWidth;
|
|
6965
|
+
const maxY = el.scrollHeight - el.clientHeight;
|
|
6966
|
+
const canX = maxX > 1;
|
|
6967
|
+
const canY = maxY > 1;
|
|
6968
|
+
setScrollable(
|
|
6969
|
+
(prev) => prev.x === canX && prev.y === canY ? prev : { x: canX, y: canY }
|
|
6970
|
+
);
|
|
6971
|
+
const thumbX = thumbXRef.current;
|
|
6972
|
+
if (thumbX) {
|
|
6973
|
+
const w = canX ? Math.max(el.clientWidth / el.scrollWidth * 100, MIN) : 100;
|
|
6974
|
+
thumbX.style.width = `${w.toFixed(2)}%`;
|
|
6975
|
+
thumbX.style.left = canX ? `${(el.scrollLeft / maxX * (100 - w)).toFixed(2)}%` : "0%";
|
|
6976
|
+
}
|
|
6977
|
+
const thumbY = thumbYRef.current;
|
|
6978
|
+
if (thumbY) {
|
|
6979
|
+
const h = canY ? Math.max(el.clientHeight / el.scrollHeight * 100, MIN) : 100;
|
|
6980
|
+
thumbY.style.height = `${h.toFixed(2)}%`;
|
|
6981
|
+
thumbY.style.top = canY ? `${(el.scrollTop / maxY * (100 - h)).toFixed(2)}%` : "0%";
|
|
6982
|
+
}
|
|
6971
6983
|
};
|
|
6972
6984
|
update();
|
|
6973
6985
|
el.addEventListener("scroll", update, { passive: true });
|
|
@@ -6979,7 +6991,7 @@ var useScrollExtent = (scrollerRef, thumbRef) => {
|
|
|
6979
6991
|
el.removeEventListener("scroll", update);
|
|
6980
6992
|
ro.disconnect();
|
|
6981
6993
|
};
|
|
6982
|
-
}, [scrollerRef,
|
|
6994
|
+
}, [scrollerRef, thumbXRef, thumbYRef]);
|
|
6983
6995
|
return scrollable;
|
|
6984
6996
|
};
|
|
6985
6997
|
var Table = (props) => {
|
|
@@ -6993,8 +7005,9 @@ var Table = (props) => {
|
|
|
6993
7005
|
minWidth
|
|
6994
7006
|
} = props;
|
|
6995
7007
|
const scrollerRef = React36.useRef(null);
|
|
6996
|
-
const
|
|
6997
|
-
const
|
|
7008
|
+
const thumbXRef = React36.useRef(null);
|
|
7009
|
+
const thumbYRef = React36.useRef(null);
|
|
7010
|
+
const scrollable = useScrollExtent(scrollerRef, thumbXRef, thumbYRef);
|
|
6998
7011
|
return (
|
|
6999
7012
|
/**
|
|
7000
7013
|
* 바깥 이름(`lib-xplat-table-wrapper`)을 그대로 둔다 — 소비처가 이 클래스를
|
|
@@ -7028,7 +7041,22 @@ var Table = (props) => {
|
|
|
7028
7041
|
)
|
|
7029
7042
|
}
|
|
7030
7043
|
),
|
|
7031
|
-
/* @__PURE__ */ jsx344(
|
|
7044
|
+
/* @__PURE__ */ jsx344(
|
|
7045
|
+
"div",
|
|
7046
|
+
{
|
|
7047
|
+
className: `lib-xplat-table-scrollbar-y${scrollable.y ? " scrollable" : ""}`,
|
|
7048
|
+
"aria-hidden": true,
|
|
7049
|
+
children: /* @__PURE__ */ jsx344("div", { ref: thumbYRef, className: "table-scrollbar-thumb" })
|
|
7050
|
+
}
|
|
7051
|
+
),
|
|
7052
|
+
/* @__PURE__ */ jsx344(
|
|
7053
|
+
"div",
|
|
7054
|
+
{
|
|
7055
|
+
className: `lib-xplat-table-scrollbar${scrollable.x ? " scrollable" : ""}`,
|
|
7056
|
+
"aria-hidden": true,
|
|
7057
|
+
children: /* @__PURE__ */ jsx344("div", { ref: thumbXRef, className: "table-scrollbar-thumb" })
|
|
7058
|
+
}
|
|
7059
|
+
)
|
|
7032
7060
|
]
|
|
7033
7061
|
}
|
|
7034
7062
|
)
|
package/dist/index.cjs
CHANGED
|
@@ -7230,9 +7230,9 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, childr
|
|
|
7230
7230
|
}
|
|
7231
7231
|
);
|
|
7232
7232
|
};
|
|
7233
|
-
var ChartLegend = ({ data, labels,
|
|
7233
|
+
var ChartLegend = ({ data, labels, shape }) => {
|
|
7234
7234
|
const entries = Object.entries(data);
|
|
7235
|
-
if (
|
|
7235
|
+
if (shape === "pie" || shape === "doughnut") {
|
|
7236
7236
|
const values = entries.flatMap(([, v]) => v);
|
|
7237
7237
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
7238
7238
|
const firstKey = entries[0]?.[0] ?? "";
|
|
@@ -7269,8 +7269,9 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
7269
7269
|
}) });
|
|
7270
7270
|
};
|
|
7271
7271
|
var Chart = import_react6.default.memo((props) => {
|
|
7272
|
-
const { variant, type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
7272
|
+
const { variant, type, data, labels, legend, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
7273
7273
|
const shape = variant ?? type ?? "line";
|
|
7274
|
+
const showLegend = legend ?? (shape === "pie" || shape === "doughnut");
|
|
7274
7275
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
7275
7276
|
const { width, height } = useChartSize(containerRef);
|
|
7276
7277
|
const stableData = import_react6.default.useMemo(() => data, [JSON.stringify(data)]);
|
|
@@ -7284,7 +7285,7 @@ var Chart = import_react6.default.memo((props) => {
|
|
|
7284
7285
|
ready && shape === "bar" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
7285
7286
|
ready && shape === "pie" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
7286
7287
|
ready && shape === "doughnut" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
7287
|
-
ready &&
|
|
7288
|
+
ready && showLegend && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(ChartLegend, { data: stableData, labels: stableLabels, shape }),
|
|
7288
7289
|
tooltip.visible && tooltip.content && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
7289
7290
|
] });
|
|
7290
7291
|
});
|
|
@@ -11474,21 +11475,32 @@ var import_jsx_runtime344 = (
|
|
|
11474
11475
|
*/
|
|
11475
11476
|
require("react/jsx-runtime")
|
|
11476
11477
|
);
|
|
11477
|
-
var useScrollExtent = (scrollerRef,
|
|
11478
|
-
const [scrollable, setScrollable] = import_react36.default.useState(false);
|
|
11478
|
+
var useScrollExtent = (scrollerRef, thumbXRef, thumbYRef) => {
|
|
11479
|
+
const [scrollable, setScrollable] = import_react36.default.useState({ x: false, y: false });
|
|
11479
11480
|
import_react36.default.useEffect(() => {
|
|
11480
11481
|
const el = scrollerRef.current;
|
|
11481
11482
|
if (!el) return;
|
|
11483
|
+
const MIN = 8;
|
|
11482
11484
|
const update = () => {
|
|
11483
|
-
const
|
|
11484
|
-
const
|
|
11485
|
-
|
|
11486
|
-
const
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11485
|
+
const maxX = el.scrollWidth - el.clientWidth;
|
|
11486
|
+
const maxY = el.scrollHeight - el.clientHeight;
|
|
11487
|
+
const canX = maxX > 1;
|
|
11488
|
+
const canY = maxY > 1;
|
|
11489
|
+
setScrollable(
|
|
11490
|
+
(prev) => prev.x === canX && prev.y === canY ? prev : { x: canX, y: canY }
|
|
11491
|
+
);
|
|
11492
|
+
const thumbX = thumbXRef.current;
|
|
11493
|
+
if (thumbX) {
|
|
11494
|
+
const w = canX ? Math.max(el.clientWidth / el.scrollWidth * 100, MIN) : 100;
|
|
11495
|
+
thumbX.style.width = `${w.toFixed(2)}%`;
|
|
11496
|
+
thumbX.style.left = canX ? `${(el.scrollLeft / maxX * (100 - w)).toFixed(2)}%` : "0%";
|
|
11497
|
+
}
|
|
11498
|
+
const thumbY = thumbYRef.current;
|
|
11499
|
+
if (thumbY) {
|
|
11500
|
+
const h = canY ? Math.max(el.clientHeight / el.scrollHeight * 100, MIN) : 100;
|
|
11501
|
+
thumbY.style.height = `${h.toFixed(2)}%`;
|
|
11502
|
+
thumbY.style.top = canY ? `${(el.scrollTop / maxY * (100 - h)).toFixed(2)}%` : "0%";
|
|
11503
|
+
}
|
|
11492
11504
|
};
|
|
11493
11505
|
update();
|
|
11494
11506
|
el.addEventListener("scroll", update, { passive: true });
|
|
@@ -11500,7 +11512,7 @@ var useScrollExtent = (scrollerRef, thumbRef) => {
|
|
|
11500
11512
|
el.removeEventListener("scroll", update);
|
|
11501
11513
|
ro.disconnect();
|
|
11502
11514
|
};
|
|
11503
|
-
}, [scrollerRef,
|
|
11515
|
+
}, [scrollerRef, thumbXRef, thumbYRef]);
|
|
11504
11516
|
return scrollable;
|
|
11505
11517
|
};
|
|
11506
11518
|
var Table = (props) => {
|
|
@@ -11514,8 +11526,9 @@ var Table = (props) => {
|
|
|
11514
11526
|
minWidth
|
|
11515
11527
|
} = props;
|
|
11516
11528
|
const scrollerRef = import_react36.default.useRef(null);
|
|
11517
|
-
const
|
|
11518
|
-
const
|
|
11529
|
+
const thumbXRef = import_react36.default.useRef(null);
|
|
11530
|
+
const thumbYRef = import_react36.default.useRef(null);
|
|
11531
|
+
const scrollable = useScrollExtent(scrollerRef, thumbXRef, thumbYRef);
|
|
11519
11532
|
return /* @__PURE__ */ (0, import_jsx_runtime344.jsxs)(
|
|
11520
11533
|
"div",
|
|
11521
11534
|
{
|
|
@@ -11544,7 +11557,22 @@ var Table = (props) => {
|
|
|
11544
11557
|
)
|
|
11545
11558
|
}
|
|
11546
11559
|
),
|
|
11547
|
-
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
11560
|
+
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
11561
|
+
"div",
|
|
11562
|
+
{
|
|
11563
|
+
className: `lib-xplat-table-scrollbar-y${scrollable.y ? " scrollable" : ""}`,
|
|
11564
|
+
"aria-hidden": true,
|
|
11565
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { ref: thumbYRef, className: "table-scrollbar-thumb" })
|
|
11566
|
+
}
|
|
11567
|
+
),
|
|
11568
|
+
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
11569
|
+
"div",
|
|
11570
|
+
{
|
|
11571
|
+
className: `lib-xplat-table-scrollbar${scrollable.x ? " scrollable" : ""}`,
|
|
11572
|
+
"aria-hidden": true,
|
|
11573
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { ref: thumbXRef, className: "table-scrollbar-thumb" })
|
|
11574
|
+
}
|
|
11575
|
+
)
|
|
11548
11576
|
]
|
|
11549
11577
|
}
|
|
11550
11578
|
);
|
package/dist/index.css
CHANGED
|
@@ -5128,11 +5128,13 @@
|
|
|
5128
5128
|
width: 100%;
|
|
5129
5129
|
height: 100%;
|
|
5130
5130
|
position: relative;
|
|
5131
|
-
display:
|
|
5132
|
-
|
|
5131
|
+
display: grid;
|
|
5132
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
5133
|
+
grid-template-rows: minmax(0, 1fr) auto;
|
|
5133
5134
|
}
|
|
5134
5135
|
.lib-xplat-table-wrapper > .lib-xplat-table-scroller {
|
|
5135
|
-
|
|
5136
|
+
grid-area: 1/1;
|
|
5137
|
+
min-width: 0;
|
|
5136
5138
|
min-height: 0;
|
|
5137
5139
|
width: 100%;
|
|
5138
5140
|
overflow: auto;
|
|
@@ -5144,13 +5146,15 @@
|
|
|
5144
5146
|
.lib-xplat-table-wrapper {
|
|
5145
5147
|
}
|
|
5146
5148
|
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar {
|
|
5147
|
-
|
|
5149
|
+
grid-area: 2/1;
|
|
5150
|
+
height: 0;
|
|
5148
5151
|
position: relative;
|
|
5149
5152
|
background-color: var(--semantic-border-primary);
|
|
5150
5153
|
opacity: 0;
|
|
5151
|
-
transition: opacity 0.15s ease;
|
|
5154
|
+
transition: height 0.15s ease, opacity 0.15s ease;
|
|
5152
5155
|
}
|
|
5153
5156
|
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar.scrollable {
|
|
5157
|
+
height: 3px;
|
|
5154
5158
|
opacity: 1;
|
|
5155
5159
|
}
|
|
5156
5160
|
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar > .table-scrollbar-thumb {
|
|
@@ -5161,6 +5165,28 @@
|
|
|
5161
5165
|
background-color: var(--semantic-surface-brand-default);
|
|
5162
5166
|
opacity: 0.55;
|
|
5163
5167
|
}
|
|
5168
|
+
.lib-xplat-table-wrapper {
|
|
5169
|
+
}
|
|
5170
|
+
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar-y {
|
|
5171
|
+
grid-area: 1/2;
|
|
5172
|
+
width: 0;
|
|
5173
|
+
position: relative;
|
|
5174
|
+
background-color: var(--semantic-border-primary);
|
|
5175
|
+
opacity: 0;
|
|
5176
|
+
transition: width 0.15s ease, opacity 0.15s ease;
|
|
5177
|
+
}
|
|
5178
|
+
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar-y.scrollable {
|
|
5179
|
+
width: 3px;
|
|
5180
|
+
opacity: 1;
|
|
5181
|
+
}
|
|
5182
|
+
.lib-xplat-table-wrapper > .lib-xplat-table-scrollbar-y > .table-scrollbar-thumb {
|
|
5183
|
+
position: absolute;
|
|
5184
|
+
left: 0;
|
|
5185
|
+
right: 0;
|
|
5186
|
+
border-radius: var(--spacing-radius-full);
|
|
5187
|
+
background-color: var(--semantic-surface-brand-default);
|
|
5188
|
+
opacity: 0.55;
|
|
5189
|
+
}
|
|
5164
5190
|
.lib-xplat-table-wrapper.sm > .lib-xplat-table > thead > tr > th,
|
|
5165
5191
|
.lib-xplat-table-wrapper.sm > .lib-xplat-table > thead > tr > td,
|
|
5166
5192
|
.lib-xplat-table-wrapper.sm > .lib-xplat-table > tbody > tr > th,
|
package/dist/index.js
CHANGED
|
@@ -6818,9 +6818,9 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, childr
|
|
|
6818
6818
|
}
|
|
6819
6819
|
);
|
|
6820
6820
|
};
|
|
6821
|
-
var ChartLegend = ({ data, labels,
|
|
6821
|
+
var ChartLegend = ({ data, labels, shape }) => {
|
|
6822
6822
|
const entries = Object.entries(data);
|
|
6823
|
-
if (
|
|
6823
|
+
if (shape === "pie" || shape === "doughnut") {
|
|
6824
6824
|
const values = entries.flatMap(([, v]) => v);
|
|
6825
6825
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
6826
6826
|
const firstKey = entries[0]?.[0] ?? "";
|
|
@@ -6857,8 +6857,9 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
6857
6857
|
}) });
|
|
6858
6858
|
};
|
|
6859
6859
|
var Chart = React6.memo((props) => {
|
|
6860
|
-
const { variant, type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
6860
|
+
const { variant, type, data, labels, legend, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
6861
6861
|
const shape = variant ?? type ?? "line";
|
|
6862
|
+
const showLegend = legend ?? (shape === "pie" || shape === "doughnut");
|
|
6862
6863
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
6863
6864
|
const { width, height } = useChartSize(containerRef);
|
|
6864
6865
|
const stableData = React6.useMemo(() => data, [JSON.stringify(data)]);
|
|
@@ -6872,7 +6873,7 @@ var Chart = React6.memo((props) => {
|
|
|
6872
6873
|
ready && shape === "bar" && /* @__PURE__ */ jsx306(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
6873
6874
|
ready && shape === "pie" && /* @__PURE__ */ jsx306(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
6874
6875
|
ready && shape === "doughnut" && /* @__PURE__ */ jsx306(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
6875
|
-
ready &&
|
|
6876
|
+
ready && showLegend && /* @__PURE__ */ jsx306(ChartLegend, { data: stableData, labels: stableLabels, shape }),
|
|
6876
6877
|
tooltip.visible && tooltip.content && /* @__PURE__ */ jsx306(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
6877
6878
|
] });
|
|
6878
6879
|
});
|
|
@@ -11056,21 +11057,32 @@ var TableContext_default = TableContext;
|
|
|
11056
11057
|
|
|
11057
11058
|
// src/components/Table/Table.tsx
|
|
11058
11059
|
import { jsx as jsx344, jsxs as jsxs221 } from "react/jsx-runtime";
|
|
11059
|
-
var useScrollExtent = (scrollerRef,
|
|
11060
|
-
const [scrollable, setScrollable] = React36.useState(false);
|
|
11060
|
+
var useScrollExtent = (scrollerRef, thumbXRef, thumbYRef) => {
|
|
11061
|
+
const [scrollable, setScrollable] = React36.useState({ x: false, y: false });
|
|
11061
11062
|
React36.useEffect(() => {
|
|
11062
11063
|
const el = scrollerRef.current;
|
|
11063
11064
|
if (!el) return;
|
|
11065
|
+
const MIN = 8;
|
|
11064
11066
|
const update = () => {
|
|
11065
|
-
const
|
|
11066
|
-
const
|
|
11067
|
-
|
|
11068
|
-
const
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
|
|
11072
|
-
|
|
11073
|
-
|
|
11067
|
+
const maxX = el.scrollWidth - el.clientWidth;
|
|
11068
|
+
const maxY = el.scrollHeight - el.clientHeight;
|
|
11069
|
+
const canX = maxX > 1;
|
|
11070
|
+
const canY = maxY > 1;
|
|
11071
|
+
setScrollable(
|
|
11072
|
+
(prev) => prev.x === canX && prev.y === canY ? prev : { x: canX, y: canY }
|
|
11073
|
+
);
|
|
11074
|
+
const thumbX = thumbXRef.current;
|
|
11075
|
+
if (thumbX) {
|
|
11076
|
+
const w = canX ? Math.max(el.clientWidth / el.scrollWidth * 100, MIN) : 100;
|
|
11077
|
+
thumbX.style.width = `${w.toFixed(2)}%`;
|
|
11078
|
+
thumbX.style.left = canX ? `${(el.scrollLeft / maxX * (100 - w)).toFixed(2)}%` : "0%";
|
|
11079
|
+
}
|
|
11080
|
+
const thumbY = thumbYRef.current;
|
|
11081
|
+
if (thumbY) {
|
|
11082
|
+
const h = canY ? Math.max(el.clientHeight / el.scrollHeight * 100, MIN) : 100;
|
|
11083
|
+
thumbY.style.height = `${h.toFixed(2)}%`;
|
|
11084
|
+
thumbY.style.top = canY ? `${(el.scrollTop / maxY * (100 - h)).toFixed(2)}%` : "0%";
|
|
11085
|
+
}
|
|
11074
11086
|
};
|
|
11075
11087
|
update();
|
|
11076
11088
|
el.addEventListener("scroll", update, { passive: true });
|
|
@@ -11082,7 +11094,7 @@ var useScrollExtent = (scrollerRef, thumbRef) => {
|
|
|
11082
11094
|
el.removeEventListener("scroll", update);
|
|
11083
11095
|
ro.disconnect();
|
|
11084
11096
|
};
|
|
11085
|
-
}, [scrollerRef,
|
|
11097
|
+
}, [scrollerRef, thumbXRef, thumbYRef]);
|
|
11086
11098
|
return scrollable;
|
|
11087
11099
|
};
|
|
11088
11100
|
var Table = (props) => {
|
|
@@ -11096,8 +11108,9 @@ var Table = (props) => {
|
|
|
11096
11108
|
minWidth
|
|
11097
11109
|
} = props;
|
|
11098
11110
|
const scrollerRef = React36.useRef(null);
|
|
11099
|
-
const
|
|
11100
|
-
const
|
|
11111
|
+
const thumbXRef = React36.useRef(null);
|
|
11112
|
+
const thumbYRef = React36.useRef(null);
|
|
11113
|
+
const scrollable = useScrollExtent(scrollerRef, thumbXRef, thumbYRef);
|
|
11101
11114
|
return (
|
|
11102
11115
|
/**
|
|
11103
11116
|
* 바깥 이름(`lib-xplat-table-wrapper`)을 그대로 둔다 — 소비처가 이 클래스를
|
|
@@ -11131,7 +11144,22 @@ var Table = (props) => {
|
|
|
11131
11144
|
)
|
|
11132
11145
|
}
|
|
11133
11146
|
),
|
|
11134
|
-
/* @__PURE__ */ jsx344(
|
|
11147
|
+
/* @__PURE__ */ jsx344(
|
|
11148
|
+
"div",
|
|
11149
|
+
{
|
|
11150
|
+
className: `lib-xplat-table-scrollbar-y${scrollable.y ? " scrollable" : ""}`,
|
|
11151
|
+
"aria-hidden": true,
|
|
11152
|
+
children: /* @__PURE__ */ jsx344("div", { ref: thumbYRef, className: "table-scrollbar-thumb" })
|
|
11153
|
+
}
|
|
11154
|
+
),
|
|
11155
|
+
/* @__PURE__ */ jsx344(
|
|
11156
|
+
"div",
|
|
11157
|
+
{
|
|
11158
|
+
className: `lib-xplat-table-scrollbar${scrollable.x ? " scrollable" : ""}`,
|
|
11159
|
+
"aria-hidden": true,
|
|
11160
|
+
children: /* @__PURE__ */ jsx344("div", { ref: thumbXRef, className: "table-scrollbar-thumb" })
|
|
11161
|
+
}
|
|
11162
|
+
)
|
|
11135
11163
|
]
|
|
11136
11164
|
}
|
|
11137
11165
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Chart
|
|
2
2
|
|
|
3
|
-
SVG 기반 차트를 렌더한다. line
|
|
3
|
+
SVG 기반 차트를 렌더한다. `line`·`curve`·`bar`·`pie`·`doughnut` 다섯 모양을 지원한다.
|
|
4
4
|
|
|
5
5
|
```tsx
|
|
6
6
|
import { Chart } from "@x-plat/design-system";
|
|
@@ -8,26 +8,53 @@ import { Chart } from "@x-plat/design-system";
|
|
|
8
8
|
|
|
9
9
|
## Props
|
|
10
10
|
|
|
11
|
+
<!-- props:Chart -->
|
|
11
12
|
| Prop | 타입 | 기본값 | 설명 |
|
|
12
13
|
|------|------|--------|------|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
14
|
+
| data * | `Record<string, number[]>` | - | 계열 이름 → 값 배열. 키 하나가 선/막대 하나가 된다 |
|
|
15
|
+
| labels * | `string[]` | - | x축 라벨. data 의 값 배열과 길이가 같아야 한다 |
|
|
16
|
+
| variant | `"line" \| "curve" \| "bar" \| "pie" \| "doughnut"` | - | 차트 종류 |
|
|
17
|
+
| type | `"line" \| "curve" \| "bar" \| "pie" \| "doughnut"` | - | **@deprecated** 모양 변형은 `variant` 로 받는다. `type` 은 상태 색 전용이다. 기존 사용처가 깨지지 않도록 계속 받는다 — 둘 다 주면 `variant` 가 이긴다. |
|
|
18
|
+
| legend | `boolean` | - | 계열 이름·색·합계를 차트 아래에 적는다. 안 주면 **원형·도넛만 켜진다** — 조각에는 제 이름을 적을 데가 없어서다. 선·곡선·막대는 축 라벨이 있어 지금까지 범례 없이 지냈고, 켜면 차트가 범례 높이만큼 길어지므로 기본값을 바꾸지 않는다. 필요한 곳에서 `legend` 를 주면 된다. |
|
|
19
|
+
| tooltip | `boolean` | `true` | 마우스를 올렸을 때 값 말풍선을 띄운다 |
|
|
20
|
+
| tooltipType | `"dark" \| "light"` | `"light"` | 말풍선 배색 |
|
|
21
|
+
|
|
22
|
+
`*` = 필수
|
|
23
|
+
<!-- /props:Chart -->
|
|
17
24
|
|
|
18
25
|
## 색상
|
|
19
26
|
|
|
20
|
-
semantic categorical
|
|
27
|
+
semantic categorical 토큰으로 계열마다 색을 자동 배정한다. `line`·`curve`·`bar` 는
|
|
28
|
+
`LINE_BAR_PALETTES`, `pie`·`doughnut` 는 `PIE_COLORS` 를 쓴다.
|
|
29
|
+
|
|
30
|
+
계열 색은 **순번과 계열 이름 해시**로 정해진다 — `getPalette(LINE_BAR_PALETTES, 순번, 키)[2]`.
|
|
31
|
+
이름이 같으면 어느 차트에서든 같은 색이 나온다. 범례 점도 같은 식으로 집으므로
|
|
32
|
+
그림과 어긋나지 않는다.
|
|
33
|
+
|
|
34
|
+
## 범례
|
|
35
|
+
|
|
36
|
+
`legend` 를 주면 계열 이름·색·합계를 차트 아래에 적는다.
|
|
37
|
+
|
|
38
|
+
안 주면 **원형·도넛만 켜진다.** 조각에는 제 이름을 적을 데가 없어서다.
|
|
39
|
+
선·곡선·막대는 축 라벨이 있어 지금까지 범례 없이 지냈고, 켜면 차트가 범례
|
|
40
|
+
높이만큼 길어진다 — 그래서 기본값을 바꾸지 않았다. 필요한 곳에서 켜면 된다.
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
<Chart variant="bar" legend labels={…} data={…} /> {/* 켠다 */}
|
|
44
|
+
<Chart variant="pie" legend={false} labels={…} data={…} /> {/* 끈다 */}
|
|
45
|
+
```
|
|
21
46
|
|
|
22
47
|
---
|
|
23
48
|
|
|
24
49
|
## 사용 예시
|
|
25
50
|
|
|
26
|
-
|
|
51
|
+
> 모양은 `variant` 로 준다. `type` 도 아직 받지만 `@deprecated` 다.
|
|
52
|
+
|
|
53
|
+
### Line / Curve
|
|
27
54
|
|
|
28
55
|
```tsx
|
|
29
56
|
<Chart
|
|
30
|
-
|
|
57
|
+
variant="line"
|
|
31
58
|
labels={["1월", "2월", "3월", "4월"]}
|
|
32
59
|
data={{
|
|
33
60
|
매출: [100, 200, 150, 300],
|
|
@@ -36,23 +63,38 @@ semantic categorical 토큰 기반으로 시리즈별 색상을 자동 배정한
|
|
|
36
63
|
/>
|
|
37
64
|
```
|
|
38
65
|
|
|
66
|
+
`variant="curve"` 는 같은 데이터를 곡선으로 잇는다.
|
|
67
|
+
|
|
39
68
|
### Bar
|
|
40
69
|
|
|
41
70
|
```tsx
|
|
42
71
|
<Chart
|
|
43
|
-
|
|
72
|
+
variant="bar"
|
|
44
73
|
labels={["서울", "부산", "대구"]}
|
|
45
74
|
data={{ 방문자: [500, 300, 200] }}
|
|
46
75
|
/>
|
|
47
76
|
```
|
|
48
77
|
|
|
78
|
+
계열이 여럿이라 어느 막대가 무엇인지 적어야 하면 `legend` 를 켠다.
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
<Chart
|
|
82
|
+
variant="bar"
|
|
83
|
+
legend
|
|
84
|
+
labels={["서울", "부산", "대구"]}
|
|
85
|
+
data={{ 방문자: [500, 300, 200], 가입자: [120, 90, 40] }}
|
|
86
|
+
/>
|
|
87
|
+
```
|
|
88
|
+
|
|
49
89
|
### Pie / Doughnut
|
|
50
90
|
|
|
51
91
|
```tsx
|
|
52
92
|
<Chart
|
|
53
|
-
|
|
93
|
+
variant="doughnut"
|
|
54
94
|
labels={["모바일", "데스크톱", "태블릿"]}
|
|
55
95
|
data={{ 점유율: [60, 30, 10] }}
|
|
56
96
|
tooltip={false}
|
|
57
97
|
/>
|
|
58
98
|
```
|
|
99
|
+
|
|
100
|
+
범례는 기본으로 켜져 있다. `legend={false}` 로 끈다.
|
|
@@ -99,6 +99,29 @@
|
|
|
99
99
|
|
|
100
100
|
---
|
|
101
101
|
|
|
102
|
+
## 스크롤 알림
|
|
103
|
+
|
|
104
|
+
표는 네이티브 스크롤바를 **숨긴다**(보기 싫어서). 대신 가로·세로 각각 3px 짜리
|
|
105
|
+
얇은 막대로 알린다. 막대 길이가 곧 "보이는 비율" 이라 얼마나 남았는지도 읽힌다.
|
|
106
|
+
|
|
107
|
+
- **구를 수 있을 때만** 나타나고, **그때만 자리를 차지한다.** 구를 수 없는 표는
|
|
108
|
+
3px 도 안 쓴다.
|
|
109
|
+
- 구르는 동안 계속 보인다. 호버할 때만 나오면 "밀 수 있다" 는 걸 알릴 수 없어서다 —
|
|
110
|
+
이미 의심해야 막대가 나타나는 꼴이 된다.
|
|
111
|
+
- 래퍼가 2×2 격자라 두 막대가 서로의 자리를 안 건드리고, 표 내용도 안 가린다.
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
┌──────────────┬──┐
|
|
115
|
+
│ scroller │세로│
|
|
116
|
+
├──────────────┼──┤
|
|
117
|
+
│ 가로 │ │
|
|
118
|
+
└──────────────┴──┘
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
세로로 구르게 하려면 래퍼에 높이를 주면 된다 — `thead` 의 `headerSticky` 와 같이 쓴다.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
102
125
|
## 올바른 예시
|
|
103
126
|
|
|
104
127
|
```tsx
|