@x-plat/design-system 0.19.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.
@@ -59,21 +59,32 @@ var import_jsx_runtime = (
59
59
  */
60
60
  require("react/jsx-runtime")
61
61
  );
62
- var useScrollExtent = (scrollerRef, thumbRef) => {
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 max = el.scrollWidth - el.clientWidth;
69
- const can = max > 1;
70
- setScrollable(can);
71
- const thumb = thumbRef.current;
72
- if (!thumb) return;
73
- const ratio = can ? el.clientWidth / el.scrollWidth : 1;
74
- const w = Math.max(ratio * 100, 8);
75
- thumb.style.width = `${w.toFixed(2)}%`;
76
- thumb.style.left = can ? `${(el.scrollLeft / max * (100 - w)).toFixed(2)}%` : "0%";
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, thumbRef]);
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 thumbRef = import_react2.default.useRef(null);
103
- const scrollable = useScrollExtent(scrollerRef, thumbRef);
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)("div", { className: `lib-xplat-table-scrollbar${scrollable ? " scrollable" : ""}`, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: thumbRef, className: "table-scrollbar-thumb" }) })
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: flex;
10
- flex-direction: column;
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
- flex: 1 1 auto;
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
- flex: 0 0 3px;
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, thumbRef) => {
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 max = el.scrollWidth - el.clientWidth;
23
- const can = max > 1;
24
- setScrollable(can);
25
- const thumb = thumbRef.current;
26
- if (!thumb) return;
27
- const ratio = can ? el.clientWidth / el.scrollWidth : 1;
28
- const w = Math.max(ratio * 100, 8);
29
- thumb.style.width = `${w.toFixed(2)}%`;
30
- thumb.style.left = can ? `${(el.scrollLeft / max * (100 - w)).toFixed(2)}%` : "0%";
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, thumbRef]);
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 thumbRef = React2.useRef(null);
57
- const scrollable = useScrollExtent(scrollerRef, thumbRef);
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("div", { className: `lib-xplat-table-scrollbar${scrollable ? " scrollable" : ""}`, "aria-hidden": true, children: /* @__PURE__ */ jsx("div", { ref: thumbRef, className: "table-scrollbar-thumb" }) })
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
  )
@@ -7063,21 +7063,32 @@ var import_jsx_runtime344 = (
7063
7063
  */
7064
7064
  require("react/jsx-runtime")
7065
7065
  );
7066
- var useScrollExtent = (scrollerRef, thumbRef) => {
7067
- 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 });
7068
7068
  import_react36.default.useEffect(() => {
7069
7069
  const el = scrollerRef.current;
7070
7070
  if (!el) return;
7071
+ const MIN = 8;
7071
7072
  const update = () => {
7072
- const max = el.scrollWidth - el.clientWidth;
7073
- const can = max > 1;
7074
- setScrollable(can);
7075
- const thumb = thumbRef.current;
7076
- if (!thumb) return;
7077
- const ratio = can ? el.clientWidth / el.scrollWidth : 1;
7078
- const w = Math.max(ratio * 100, 8);
7079
- thumb.style.width = `${w.toFixed(2)}%`;
7080
- thumb.style.left = can ? `${(el.scrollLeft / max * (100 - w)).toFixed(2)}%` : "0%";
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
+ }
7081
7092
  };
7082
7093
  update();
7083
7094
  el.addEventListener("scroll", update, { passive: true });
@@ -7089,7 +7100,7 @@ var useScrollExtent = (scrollerRef, thumbRef) => {
7089
7100
  el.removeEventListener("scroll", update);
7090
7101
  ro.disconnect();
7091
7102
  };
7092
- }, [scrollerRef, thumbRef]);
7103
+ }, [scrollerRef, thumbXRef, thumbYRef]);
7093
7104
  return scrollable;
7094
7105
  };
7095
7106
  var Table = (props) => {
@@ -7103,8 +7114,9 @@ var Table = (props) => {
7103
7114
  minWidth
7104
7115
  } = props;
7105
7116
  const scrollerRef = import_react36.default.useRef(null);
7106
- const thumbRef = import_react36.default.useRef(null);
7107
- const scrollable = useScrollExtent(scrollerRef, thumbRef);
7117
+ const thumbXRef = import_react36.default.useRef(null);
7118
+ const thumbYRef = import_react36.default.useRef(null);
7119
+ const scrollable = useScrollExtent(scrollerRef, thumbXRef, thumbYRef);
7108
7120
  return /* @__PURE__ */ (0, import_jsx_runtime344.jsxs)(
7109
7121
  "div",
7110
7122
  {
@@ -7133,7 +7145,22 @@ var Table = (props) => {
7133
7145
  )
7134
7146
  }
7135
7147
  ),
7136
- /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { className: `lib-xplat-table-scrollbar${scrollable ? " scrollable" : ""}`, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { ref: thumbRef, className: "table-scrollbar-thumb" }) })
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
+ )
7137
7164
  ]
7138
7165
  }
7139
7166
  );
@@ -5128,11 +5128,13 @@
5128
5128
  width: 100%;
5129
5129
  height: 100%;
5130
5130
  position: relative;
5131
- display: flex;
5132
- flex-direction: column;
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
- flex: 1 1 auto;
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
- flex: 0 0 3px;
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,
@@ -6954,21 +6954,32 @@ var TableContext_default = TableContext;
6954
6954
 
6955
6955
  // src/components/Table/Table.tsx
6956
6956
  import { jsx as jsx344, jsxs as jsxs221 } from "react/jsx-runtime";
6957
- var useScrollExtent = (scrollerRef, thumbRef) => {
6958
- const [scrollable, setScrollable] = React36.useState(false);
6957
+ var useScrollExtent = (scrollerRef, thumbXRef, thumbYRef) => {
6958
+ const [scrollable, setScrollable] = React36.useState({ x: false, y: false });
6959
6959
  React36.useEffect(() => {
6960
6960
  const el = scrollerRef.current;
6961
6961
  if (!el) return;
6962
+ const MIN = 8;
6962
6963
  const update = () => {
6963
- const max = el.scrollWidth - el.clientWidth;
6964
- const can = max > 1;
6965
- setScrollable(can);
6966
- const thumb = thumbRef.current;
6967
- if (!thumb) return;
6968
- const ratio = can ? el.clientWidth / el.scrollWidth : 1;
6969
- const w = Math.max(ratio * 100, 8);
6970
- thumb.style.width = `${w.toFixed(2)}%`;
6971
- thumb.style.left = can ? `${(el.scrollLeft / max * (100 - w)).toFixed(2)}%` : "0%";
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
+ }
6972
6983
  };
6973
6984
  update();
6974
6985
  el.addEventListener("scroll", update, { passive: true });
@@ -6980,7 +6991,7 @@ var useScrollExtent = (scrollerRef, thumbRef) => {
6980
6991
  el.removeEventListener("scroll", update);
6981
6992
  ro.disconnect();
6982
6993
  };
6983
- }, [scrollerRef, thumbRef]);
6994
+ }, [scrollerRef, thumbXRef, thumbYRef]);
6984
6995
  return scrollable;
6985
6996
  };
6986
6997
  var Table = (props) => {
@@ -6994,8 +7005,9 @@ var Table = (props) => {
6994
7005
  minWidth
6995
7006
  } = props;
6996
7007
  const scrollerRef = React36.useRef(null);
6997
- const thumbRef = React36.useRef(null);
6998
- const scrollable = useScrollExtent(scrollerRef, thumbRef);
7008
+ const thumbXRef = React36.useRef(null);
7009
+ const thumbYRef = React36.useRef(null);
7010
+ const scrollable = useScrollExtent(scrollerRef, thumbXRef, thumbYRef);
6999
7011
  return (
7000
7012
  /**
7001
7013
  * 바깥 이름(`lib-xplat-table-wrapper`)을 그대로 둔다 — 소비처가 이 클래스를
@@ -7029,7 +7041,22 @@ var Table = (props) => {
7029
7041
  )
7030
7042
  }
7031
7043
  ),
7032
- /* @__PURE__ */ jsx344("div", { className: `lib-xplat-table-scrollbar${scrollable ? " scrollable" : ""}`, "aria-hidden": true, children: /* @__PURE__ */ jsx344("div", { ref: thumbRef, className: "table-scrollbar-thumb" }) })
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
+ )
7033
7060
  ]
7034
7061
  }
7035
7062
  )
package/dist/index.cjs CHANGED
@@ -11475,21 +11475,32 @@ var import_jsx_runtime344 = (
11475
11475
  */
11476
11476
  require("react/jsx-runtime")
11477
11477
  );
11478
- var useScrollExtent = (scrollerRef, thumbRef) => {
11479
- 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 });
11480
11480
  import_react36.default.useEffect(() => {
11481
11481
  const el = scrollerRef.current;
11482
11482
  if (!el) return;
11483
+ const MIN = 8;
11483
11484
  const update = () => {
11484
- const max = el.scrollWidth - el.clientWidth;
11485
- const can = max > 1;
11486
- setScrollable(can);
11487
- const thumb = thumbRef.current;
11488
- if (!thumb) return;
11489
- const ratio = can ? el.clientWidth / el.scrollWidth : 1;
11490
- const w = Math.max(ratio * 100, 8);
11491
- thumb.style.width = `${w.toFixed(2)}%`;
11492
- thumb.style.left = can ? `${(el.scrollLeft / max * (100 - w)).toFixed(2)}%` : "0%";
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
+ }
11493
11504
  };
11494
11505
  update();
11495
11506
  el.addEventListener("scroll", update, { passive: true });
@@ -11501,7 +11512,7 @@ var useScrollExtent = (scrollerRef, thumbRef) => {
11501
11512
  el.removeEventListener("scroll", update);
11502
11513
  ro.disconnect();
11503
11514
  };
11504
- }, [scrollerRef, thumbRef]);
11515
+ }, [scrollerRef, thumbXRef, thumbYRef]);
11505
11516
  return scrollable;
11506
11517
  };
11507
11518
  var Table = (props) => {
@@ -11515,8 +11526,9 @@ var Table = (props) => {
11515
11526
  minWidth
11516
11527
  } = props;
11517
11528
  const scrollerRef = import_react36.default.useRef(null);
11518
- const thumbRef = import_react36.default.useRef(null);
11519
- const scrollable = useScrollExtent(scrollerRef, thumbRef);
11529
+ const thumbXRef = import_react36.default.useRef(null);
11530
+ const thumbYRef = import_react36.default.useRef(null);
11531
+ const scrollable = useScrollExtent(scrollerRef, thumbXRef, thumbYRef);
11520
11532
  return /* @__PURE__ */ (0, import_jsx_runtime344.jsxs)(
11521
11533
  "div",
11522
11534
  {
@@ -11545,7 +11557,22 @@ var Table = (props) => {
11545
11557
  )
11546
11558
  }
11547
11559
  ),
11548
- /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { className: `lib-xplat-table-scrollbar${scrollable ? " scrollable" : ""}`, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { ref: thumbRef, className: "table-scrollbar-thumb" }) })
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
+ )
11549
11576
  ]
11550
11577
  }
11551
11578
  );
package/dist/index.css CHANGED
@@ -5128,11 +5128,13 @@
5128
5128
  width: 100%;
5129
5129
  height: 100%;
5130
5130
  position: relative;
5131
- display: flex;
5132
- flex-direction: column;
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
- flex: 1 1 auto;
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
- flex: 0 0 3px;
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
@@ -11057,21 +11057,32 @@ var TableContext_default = TableContext;
11057
11057
 
11058
11058
  // src/components/Table/Table.tsx
11059
11059
  import { jsx as jsx344, jsxs as jsxs221 } from "react/jsx-runtime";
11060
- var useScrollExtent = (scrollerRef, thumbRef) => {
11061
- const [scrollable, setScrollable] = React36.useState(false);
11060
+ var useScrollExtent = (scrollerRef, thumbXRef, thumbYRef) => {
11061
+ const [scrollable, setScrollable] = React36.useState({ x: false, y: false });
11062
11062
  React36.useEffect(() => {
11063
11063
  const el = scrollerRef.current;
11064
11064
  if (!el) return;
11065
+ const MIN = 8;
11065
11066
  const update = () => {
11066
- const max = el.scrollWidth - el.clientWidth;
11067
- const can = max > 1;
11068
- setScrollable(can);
11069
- const thumb = thumbRef.current;
11070
- if (!thumb) return;
11071
- const ratio = can ? el.clientWidth / el.scrollWidth : 1;
11072
- const w = Math.max(ratio * 100, 8);
11073
- thumb.style.width = `${w.toFixed(2)}%`;
11074
- thumb.style.left = can ? `${(el.scrollLeft / max * (100 - w)).toFixed(2)}%` : "0%";
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
+ }
11075
11086
  };
11076
11087
  update();
11077
11088
  el.addEventListener("scroll", update, { passive: true });
@@ -11083,7 +11094,7 @@ var useScrollExtent = (scrollerRef, thumbRef) => {
11083
11094
  el.removeEventListener("scroll", update);
11084
11095
  ro.disconnect();
11085
11096
  };
11086
- }, [scrollerRef, thumbRef]);
11097
+ }, [scrollerRef, thumbXRef, thumbYRef]);
11087
11098
  return scrollable;
11088
11099
  };
11089
11100
  var Table = (props) => {
@@ -11097,8 +11108,9 @@ var Table = (props) => {
11097
11108
  minWidth
11098
11109
  } = props;
11099
11110
  const scrollerRef = React36.useRef(null);
11100
- const thumbRef = React36.useRef(null);
11101
- const scrollable = useScrollExtent(scrollerRef, thumbRef);
11111
+ const thumbXRef = React36.useRef(null);
11112
+ const thumbYRef = React36.useRef(null);
11113
+ const scrollable = useScrollExtent(scrollerRef, thumbXRef, thumbYRef);
11102
11114
  return (
11103
11115
  /**
11104
11116
  * 바깥 이름(`lib-xplat-table-wrapper`)을 그대로 둔다 — 소비처가 이 클래스를
@@ -11132,7 +11144,22 @@ var Table = (props) => {
11132
11144
  )
11133
11145
  }
11134
11146
  ),
11135
- /* @__PURE__ */ jsx344("div", { className: `lib-xplat-table-scrollbar${scrollable ? " scrollable" : ""}`, "aria-hidden": true, children: /* @__PURE__ */ jsx344("div", { ref: thumbRef, className: "table-scrollbar-thumb" }) })
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
+ )
11136
11163
  ]
11137
11164
  }
11138
11165
  )
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-plat/design-system",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "XPLAT UI Design System",
5
5
  "author": "XPLAT WOONG",
6
6
  "main": "dist/index.cjs",