@x-plat/design-system 0.14.0 → 0.14.2
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/Dropdown/index.cjs +5 -15
- package/dist/components/Dropdown/index.css +0 -3
- package/dist/components/Dropdown/index.js +5 -15
- package/dist/components/PopOver/index.cjs +3 -14
- package/dist/components/PopOver/index.css +0 -3
- package/dist/components/PopOver/index.js +3 -14
- package/dist/components/Select/index.cjs +4 -14
- package/dist/components/Select/index.css +0 -3
- package/dist/components/Select/index.js +4 -14
- package/dist/components/TimePicker/index.cjs +4 -14
- package/dist/components/TimePicker/index.css +0 -3
- package/dist/components/TimePicker/index.js +4 -14
- package/dist/components/index.cjs +7 -18
- package/dist/components/index.css +0 -12
- package/dist/components/index.js +7 -18
- package/dist/index.cjs +7 -18
- package/dist/index.css +0 -12
- package/dist/index.js +7 -18
- package/dist/layout/Layout/index.d.cts +15 -7
- package/dist/layout/Layout/index.d.ts +15 -7
- package/guidelines/MIGRATION.md +24 -0
- package/guidelines/components/chip-tag.md +5 -0
- package/package.json +1 -1
|
@@ -51,10 +51,8 @@ var import_react = __toESM(require("react"), 1);
|
|
|
51
51
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
52
52
|
const [position, setPosition] = import_react.default.useState({
|
|
53
53
|
position: {},
|
|
54
|
-
direction: "bottom"
|
|
55
|
-
repositioning: false
|
|
54
|
+
direction: "bottom"
|
|
56
55
|
});
|
|
57
|
-
const placedRef = import_react.default.useRef(false);
|
|
58
56
|
const calculatePosition = import_react.default.useCallback(() => {
|
|
59
57
|
if (!triggerRef.current || !popRef.current) return;
|
|
60
58
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -77,18 +75,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
77
75
|
left = triggerRect.right - popW;
|
|
78
76
|
}
|
|
79
77
|
if (left < 8) left = 8;
|
|
80
|
-
setPosition({
|
|
81
|
-
position: { top, left },
|
|
82
|
-
direction,
|
|
83
|
-
repositioning: placedRef.current
|
|
84
|
-
});
|
|
85
|
-
placedRef.current = true;
|
|
78
|
+
setPosition({ position: { top, left }, direction });
|
|
86
79
|
}, [triggerRef, popRef]);
|
|
87
80
|
import_react.default.useLayoutEffect(() => {
|
|
88
|
-
if (!enabled)
|
|
89
|
-
placedRef.current = false;
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
81
|
+
if (!enabled) return;
|
|
92
82
|
calculatePosition();
|
|
93
83
|
const raf = requestAnimationFrame(calculatePosition);
|
|
94
84
|
return () => cancelAnimationFrame(raf);
|
|
@@ -194,7 +184,7 @@ var Dropdown = (props) => {
|
|
|
194
184
|
const [visible, setVisible] = import_react4.default.useState(false);
|
|
195
185
|
const triggerRef = import_react4.default.useRef(null);
|
|
196
186
|
const menuRef = import_react4.default.useRef(null);
|
|
197
|
-
const { position, direction
|
|
187
|
+
const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
198
188
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
199
189
|
useEscapeKey(isOpen, () => {
|
|
200
190
|
setIsOpen(false);
|
|
@@ -229,7 +219,7 @@ var Dropdown = (props) => {
|
|
|
229
219
|
"div",
|
|
230
220
|
{
|
|
231
221
|
ref: menuRef,
|
|
232
|
-
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }
|
|
222
|
+
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
|
|
233
223
|
style: { top: position.top, left: position.left },
|
|
234
224
|
role: "menu",
|
|
235
225
|
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -15,10 +15,8 @@ import React from "react";
|
|
|
15
15
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
16
16
|
const [position, setPosition] = React.useState({
|
|
17
17
|
position: {},
|
|
18
|
-
direction: "bottom"
|
|
19
|
-
repositioning: false
|
|
18
|
+
direction: "bottom"
|
|
20
19
|
});
|
|
21
|
-
const placedRef = React.useRef(false);
|
|
22
20
|
const calculatePosition = React.useCallback(() => {
|
|
23
21
|
if (!triggerRef.current || !popRef.current) return;
|
|
24
22
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -41,18 +39,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
41
39
|
left = triggerRect.right - popW;
|
|
42
40
|
}
|
|
43
41
|
if (left < 8) left = 8;
|
|
44
|
-
setPosition({
|
|
45
|
-
position: { top, left },
|
|
46
|
-
direction,
|
|
47
|
-
repositioning: placedRef.current
|
|
48
|
-
});
|
|
49
|
-
placedRef.current = true;
|
|
42
|
+
setPosition({ position: { top, left }, direction });
|
|
50
43
|
}, [triggerRef, popRef]);
|
|
51
44
|
React.useLayoutEffect(() => {
|
|
52
|
-
if (!enabled)
|
|
53
|
-
placedRef.current = false;
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
45
|
+
if (!enabled) return;
|
|
56
46
|
calculatePosition();
|
|
57
47
|
const raf = requestAnimationFrame(calculatePosition);
|
|
58
48
|
return () => cancelAnimationFrame(raf);
|
|
@@ -158,7 +148,7 @@ var Dropdown = (props) => {
|
|
|
158
148
|
const [visible, setVisible] = React4.useState(false);
|
|
159
149
|
const triggerRef = React4.useRef(null);
|
|
160
150
|
const menuRef = React4.useRef(null);
|
|
161
|
-
const { position, direction
|
|
151
|
+
const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
162
152
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
163
153
|
useEscapeKey(isOpen, () => {
|
|
164
154
|
setIsOpen(false);
|
|
@@ -193,7 +183,7 @@ var Dropdown = (props) => {
|
|
|
193
183
|
"div",
|
|
194
184
|
{
|
|
195
185
|
ref: menuRef,
|
|
196
|
-
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }
|
|
186
|
+
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
|
|
197
187
|
style: { top: position.top, left: position.left },
|
|
198
188
|
role: "menu",
|
|
199
189
|
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
@@ -51,10 +51,8 @@ var import_react = __toESM(require("react"), 1);
|
|
|
51
51
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
52
52
|
const [position, setPosition] = import_react.default.useState({
|
|
53
53
|
position: {},
|
|
54
|
-
direction: "bottom"
|
|
55
|
-
repositioning: false
|
|
54
|
+
direction: "bottom"
|
|
56
55
|
});
|
|
57
|
-
const placedRef = import_react.default.useRef(false);
|
|
58
56
|
const calculatePosition = import_react.default.useCallback(() => {
|
|
59
57
|
if (!triggerRef.current || !popRef.current) return;
|
|
60
58
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -77,18 +75,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
77
75
|
left = triggerRect.right - popW;
|
|
78
76
|
}
|
|
79
77
|
if (left < 8) left = 8;
|
|
80
|
-
setPosition({
|
|
81
|
-
position: { top, left },
|
|
82
|
-
direction,
|
|
83
|
-
repositioning: placedRef.current
|
|
84
|
-
});
|
|
85
|
-
placedRef.current = true;
|
|
78
|
+
setPosition({ position: { top, left }, direction });
|
|
86
79
|
}, [triggerRef, popRef]);
|
|
87
80
|
import_react.default.useLayoutEffect(() => {
|
|
88
|
-
if (!enabled)
|
|
89
|
-
placedRef.current = false;
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
81
|
+
if (!enabled) return;
|
|
92
82
|
calculatePosition();
|
|
93
83
|
const raf = requestAnimationFrame(calculatePosition);
|
|
94
84
|
return () => cancelAnimationFrame(raf);
|
|
@@ -228,7 +218,6 @@ var PopOver = (props) => {
|
|
|
228
218
|
className: clsx_default(
|
|
229
219
|
"lib-xplat-pop-over-content",
|
|
230
220
|
position.direction,
|
|
231
|
-
position.repositioning && "repositioning",
|
|
232
221
|
eventTrigger && "visible"
|
|
233
222
|
),
|
|
234
223
|
ref: popRef,
|
|
@@ -15,10 +15,8 @@ import React from "react";
|
|
|
15
15
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
16
16
|
const [position, setPosition] = React.useState({
|
|
17
17
|
position: {},
|
|
18
|
-
direction: "bottom"
|
|
19
|
-
repositioning: false
|
|
18
|
+
direction: "bottom"
|
|
20
19
|
});
|
|
21
|
-
const placedRef = React.useRef(false);
|
|
22
20
|
const calculatePosition = React.useCallback(() => {
|
|
23
21
|
if (!triggerRef.current || !popRef.current) return;
|
|
24
22
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -41,18 +39,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
41
39
|
left = triggerRect.right - popW;
|
|
42
40
|
}
|
|
43
41
|
if (left < 8) left = 8;
|
|
44
|
-
setPosition({
|
|
45
|
-
position: { top, left },
|
|
46
|
-
direction,
|
|
47
|
-
repositioning: placedRef.current
|
|
48
|
-
});
|
|
49
|
-
placedRef.current = true;
|
|
42
|
+
setPosition({ position: { top, left }, direction });
|
|
50
43
|
}, [triggerRef, popRef]);
|
|
51
44
|
React.useLayoutEffect(() => {
|
|
52
|
-
if (!enabled)
|
|
53
|
-
placedRef.current = false;
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
45
|
+
if (!enabled) return;
|
|
56
46
|
calculatePosition();
|
|
57
47
|
const raf = requestAnimationFrame(calculatePosition);
|
|
58
48
|
return () => cancelAnimationFrame(raf);
|
|
@@ -192,7 +182,6 @@ var PopOver = (props) => {
|
|
|
192
182
|
className: clsx_default(
|
|
193
183
|
"lib-xplat-pop-over-content",
|
|
194
184
|
position.direction,
|
|
195
|
-
position.repositioning && "repositioning",
|
|
196
185
|
eventTrigger && "visible"
|
|
197
186
|
),
|
|
198
187
|
ref: popRef,
|
|
@@ -52,10 +52,8 @@ var import_react = __toESM(require("react"), 1);
|
|
|
52
52
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
53
53
|
const [position, setPosition] = import_react.default.useState({
|
|
54
54
|
position: {},
|
|
55
|
-
direction: "bottom"
|
|
56
|
-
repositioning: false
|
|
55
|
+
direction: "bottom"
|
|
57
56
|
});
|
|
58
|
-
const placedRef = import_react.default.useRef(false);
|
|
59
57
|
const calculatePosition = import_react.default.useCallback(() => {
|
|
60
58
|
if (!triggerRef.current || !popRef.current) return;
|
|
61
59
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -78,18 +76,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
78
76
|
left = triggerRect.right - popW;
|
|
79
77
|
}
|
|
80
78
|
if (left < 8) left = 8;
|
|
81
|
-
setPosition({
|
|
82
|
-
position: { top, left },
|
|
83
|
-
direction,
|
|
84
|
-
repositioning: placedRef.current
|
|
85
|
-
});
|
|
86
|
-
placedRef.current = true;
|
|
79
|
+
setPosition({ position: { top, left }, direction });
|
|
87
80
|
}, [triggerRef, popRef]);
|
|
88
81
|
import_react.default.useLayoutEffect(() => {
|
|
89
|
-
if (!enabled)
|
|
90
|
-
placedRef.current = false;
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
82
|
+
if (!enabled) return;
|
|
93
83
|
calculatePosition();
|
|
94
84
|
const raf = requestAnimationFrame(calculatePosition);
|
|
95
85
|
return () => cancelAnimationFrame(raf);
|
|
@@ -1422,7 +1412,7 @@ var SelectRoot = (props) => {
|
|
|
1422
1412
|
mounted && /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime297.jsxs)(
|
|
1423
1413
|
"div",
|
|
1424
1414
|
{
|
|
1425
|
-
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass
|
|
1415
|
+
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass),
|
|
1426
1416
|
ref: contentRef,
|
|
1427
1417
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
1428
1418
|
role: "listbox",
|
|
@@ -15,10 +15,8 @@ import React from "react";
|
|
|
15
15
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
16
16
|
const [position, setPosition] = React.useState({
|
|
17
17
|
position: {},
|
|
18
|
-
direction: "bottom"
|
|
19
|
-
repositioning: false
|
|
18
|
+
direction: "bottom"
|
|
20
19
|
});
|
|
21
|
-
const placedRef = React.useRef(false);
|
|
22
20
|
const calculatePosition = React.useCallback(() => {
|
|
23
21
|
if (!triggerRef.current || !popRef.current) return;
|
|
24
22
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -41,18 +39,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
41
39
|
left = triggerRect.right - popW;
|
|
42
40
|
}
|
|
43
41
|
if (left < 8) left = 8;
|
|
44
|
-
setPosition({
|
|
45
|
-
position: { top, left },
|
|
46
|
-
direction,
|
|
47
|
-
repositioning: placedRef.current
|
|
48
|
-
});
|
|
49
|
-
placedRef.current = true;
|
|
42
|
+
setPosition({ position: { top, left }, direction });
|
|
50
43
|
}, [triggerRef, popRef]);
|
|
51
44
|
React.useLayoutEffect(() => {
|
|
52
|
-
if (!enabled)
|
|
53
|
-
placedRef.current = false;
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
45
|
+
if (!enabled) return;
|
|
56
46
|
calculatePosition();
|
|
57
47
|
const raf = requestAnimationFrame(calculatePosition);
|
|
58
48
|
return () => cancelAnimationFrame(raf);
|
|
@@ -1385,7 +1375,7 @@ var SelectRoot = (props) => {
|
|
|
1385
1375
|
mounted && /* @__PURE__ */ jsx297(Portal_default, { children: /* @__PURE__ */ jsxs190(
|
|
1386
1376
|
"div",
|
|
1387
1377
|
{
|
|
1388
|
-
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass
|
|
1378
|
+
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass),
|
|
1389
1379
|
ref: contentRef,
|
|
1390
1380
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
1391
1381
|
role: "listbox",
|
|
@@ -51,10 +51,8 @@ var import_react = __toESM(require("react"), 1);
|
|
|
51
51
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
52
52
|
const [position, setPosition] = import_react.default.useState({
|
|
53
53
|
position: {},
|
|
54
|
-
direction: "bottom"
|
|
55
|
-
repositioning: false
|
|
54
|
+
direction: "bottom"
|
|
56
55
|
});
|
|
57
|
-
const placedRef = import_react.default.useRef(false);
|
|
58
56
|
const calculatePosition = import_react.default.useCallback(() => {
|
|
59
57
|
if (!triggerRef.current || !popRef.current) return;
|
|
60
58
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -77,18 +75,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
77
75
|
left = triggerRect.right - popW;
|
|
78
76
|
}
|
|
79
77
|
if (left < 8) left = 8;
|
|
80
|
-
setPosition({
|
|
81
|
-
position: { top, left },
|
|
82
|
-
direction,
|
|
83
|
-
repositioning: placedRef.current
|
|
84
|
-
});
|
|
85
|
-
placedRef.current = true;
|
|
78
|
+
setPosition({ position: { top, left }, direction });
|
|
86
79
|
}, [triggerRef, popRef]);
|
|
87
80
|
import_react.default.useLayoutEffect(() => {
|
|
88
|
-
if (!enabled)
|
|
89
|
-
placedRef.current = false;
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
81
|
+
if (!enabled) return;
|
|
92
82
|
calculatePosition();
|
|
93
83
|
const raf = requestAnimationFrame(calculatePosition);
|
|
94
84
|
return () => cancelAnimationFrame(raf);
|
|
@@ -427,7 +417,7 @@ var TimePicker = (props) => {
|
|
|
427
417
|
"div",
|
|
428
418
|
{
|
|
429
419
|
ref: contentRef,
|
|
430
|
-
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"
|
|
420
|
+
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"),
|
|
431
421
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
432
422
|
role: "listbox",
|
|
433
423
|
children: options.map((t) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -15,10 +15,8 @@ import React from "react";
|
|
|
15
15
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
16
16
|
const [position, setPosition] = React.useState({
|
|
17
17
|
position: {},
|
|
18
|
-
direction: "bottom"
|
|
19
|
-
repositioning: false
|
|
18
|
+
direction: "bottom"
|
|
20
19
|
});
|
|
21
|
-
const placedRef = React.useRef(false);
|
|
22
20
|
const calculatePosition = React.useCallback(() => {
|
|
23
21
|
if (!triggerRef.current || !popRef.current) return;
|
|
24
22
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -41,18 +39,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
41
39
|
left = triggerRect.right - popW;
|
|
42
40
|
}
|
|
43
41
|
if (left < 8) left = 8;
|
|
44
|
-
setPosition({
|
|
45
|
-
position: { top, left },
|
|
46
|
-
direction,
|
|
47
|
-
repositioning: placedRef.current
|
|
48
|
-
});
|
|
49
|
-
placedRef.current = true;
|
|
42
|
+
setPosition({ position: { top, left }, direction });
|
|
50
43
|
}, [triggerRef, popRef]);
|
|
51
44
|
React.useLayoutEffect(() => {
|
|
52
|
-
if (!enabled)
|
|
53
|
-
placedRef.current = false;
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
45
|
+
if (!enabled) return;
|
|
56
46
|
calculatePosition();
|
|
57
47
|
const raf = requestAnimationFrame(calculatePosition);
|
|
58
48
|
return () => cancelAnimationFrame(raf);
|
|
@@ -391,7 +381,7 @@ var TimePicker = (props) => {
|
|
|
391
381
|
"div",
|
|
392
382
|
{
|
|
393
383
|
ref: contentRef,
|
|
394
|
-
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"
|
|
384
|
+
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"),
|
|
395
385
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
396
386
|
role: "listbox",
|
|
397
387
|
children: options.map((t) => /* @__PURE__ */ jsx5(
|
|
@@ -3978,10 +3978,8 @@ var import_react19 = __toESM(require("react"), 1);
|
|
|
3978
3978
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
3979
3979
|
const [position, setPosition] = import_react19.default.useState({
|
|
3980
3980
|
position: {},
|
|
3981
|
-
direction: "bottom"
|
|
3982
|
-
repositioning: false
|
|
3981
|
+
direction: "bottom"
|
|
3983
3982
|
});
|
|
3984
|
-
const placedRef = import_react19.default.useRef(false);
|
|
3985
3983
|
const calculatePosition = import_react19.default.useCallback(() => {
|
|
3986
3984
|
if (!triggerRef.current || !popRef.current) return;
|
|
3987
3985
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -4004,18 +4002,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
4004
4002
|
left = triggerRect.right - popW;
|
|
4005
4003
|
}
|
|
4006
4004
|
if (left < 8) left = 8;
|
|
4007
|
-
setPosition({
|
|
4008
|
-
position: { top, left },
|
|
4009
|
-
direction,
|
|
4010
|
-
repositioning: placedRef.current
|
|
4011
|
-
});
|
|
4012
|
-
placedRef.current = true;
|
|
4005
|
+
setPosition({ position: { top, left }, direction });
|
|
4013
4006
|
}, [triggerRef, popRef]);
|
|
4014
4007
|
import_react19.default.useLayoutEffect(() => {
|
|
4015
|
-
if (!enabled)
|
|
4016
|
-
placedRef.current = false;
|
|
4017
|
-
return;
|
|
4018
|
-
}
|
|
4008
|
+
if (!enabled) return;
|
|
4019
4009
|
calculatePosition();
|
|
4020
4010
|
const raf = requestAnimationFrame(calculatePosition);
|
|
4021
4011
|
return () => cancelAnimationFrame(raf);
|
|
@@ -4081,7 +4071,7 @@ var Dropdown = (props) => {
|
|
|
4081
4071
|
const [visible, setVisible] = import_react21.default.useState(false);
|
|
4082
4072
|
const triggerRef = import_react21.default.useRef(null);
|
|
4083
4073
|
const menuRef = import_react21.default.useRef(null);
|
|
4084
|
-
const { position, direction
|
|
4074
|
+
const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
4085
4075
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
4086
4076
|
useEscapeKey(isOpen, () => {
|
|
4087
4077
|
setIsOpen(false);
|
|
@@ -4116,7 +4106,7 @@ var Dropdown = (props) => {
|
|
|
4116
4106
|
"div",
|
|
4117
4107
|
{
|
|
4118
4108
|
ref: menuRef,
|
|
4119
|
-
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }
|
|
4109
|
+
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
|
|
4120
4110
|
style: { top: position.top, left: position.left },
|
|
4121
4111
|
role: "menu",
|
|
4122
4112
|
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
|
@@ -6048,7 +6038,6 @@ var PopOver = (props) => {
|
|
|
6048
6038
|
className: clsx_default(
|
|
6049
6039
|
"lib-xplat-pop-over-content",
|
|
6050
6040
|
position.direction,
|
|
6051
|
-
position.repositioning && "repositioning",
|
|
6052
6041
|
eventTrigger && "visible"
|
|
6053
6042
|
),
|
|
6054
6043
|
ref: popRef,
|
|
@@ -6395,7 +6384,7 @@ var SelectRoot = (props) => {
|
|
|
6395
6384
|
mounted && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
|
|
6396
6385
|
"div",
|
|
6397
6386
|
{
|
|
6398
|
-
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass
|
|
6387
|
+
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass),
|
|
6399
6388
|
ref: contentRef,
|
|
6400
6389
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
6401
6390
|
role: "listbox",
|
|
@@ -7288,7 +7277,7 @@ var TimePicker = (props) => {
|
|
|
7288
7277
|
"div",
|
|
7289
7278
|
{
|
|
7290
7279
|
ref: contentRef,
|
|
7291
|
-
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"
|
|
7280
|
+
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"),
|
|
7292
7281
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
7293
7282
|
role: "listbox",
|
|
7294
7283
|
children: options.map((t) => /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
|
@@ -3322,9 +3322,6 @@
|
|
|
3322
3322
|
color: var(--semantic-text-disabled);
|
|
3323
3323
|
cursor: not-allowed;
|
|
3324
3324
|
}
|
|
3325
|
-
.lib-xplat-dropdown-menu.repositioning {
|
|
3326
|
-
transition: none;
|
|
3327
|
-
}
|
|
3328
3325
|
|
|
3329
3326
|
/* src/components/Editor/editor.scss */
|
|
3330
3327
|
.lib-xplat-editor {
|
|
@@ -4183,9 +4180,6 @@
|
|
|
4183
4180
|
opacity: 1;
|
|
4184
4181
|
transform: scale(1);
|
|
4185
4182
|
}
|
|
4186
|
-
.lib-xplat-pop-over-content.repositioning {
|
|
4187
|
-
transition: none;
|
|
4188
|
-
}
|
|
4189
4183
|
|
|
4190
4184
|
/* src/components/Progress/progress.scss */
|
|
4191
4185
|
.lib-xplat-progress {
|
|
@@ -4580,9 +4574,6 @@
|
|
|
4580
4574
|
cursor: not-allowed;
|
|
4581
4575
|
color: var(--semantic-text-disabled);
|
|
4582
4576
|
}
|
|
4583
|
-
.lib-xplat-select-content.repositioning {
|
|
4584
|
-
transition: none;
|
|
4585
|
-
}
|
|
4586
4577
|
|
|
4587
4578
|
/* src/components/Skeleton/skeleton.scss */
|
|
4588
4579
|
.lib-xplat-skeleton {
|
|
@@ -5683,9 +5674,6 @@
|
|
|
5683
5674
|
font-weight: var(--semantic-typo-label-1-m-weight);
|
|
5684
5675
|
letter-spacing: var(--semantic-typo-label-1-m-ls);
|
|
5685
5676
|
}
|
|
5686
|
-
.lib-xplat-time-picker-content.repositioning {
|
|
5687
|
-
transition: none;
|
|
5688
|
-
}
|
|
5689
5677
|
|
|
5690
5678
|
/* src/components/Toast/toast.scss */
|
|
5691
5679
|
.lib-xplat-toast-container {
|
package/dist/components/index.js
CHANGED
|
@@ -3876,10 +3876,8 @@ import React19 from "react";
|
|
|
3876
3876
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
3877
3877
|
const [position, setPosition] = React19.useState({
|
|
3878
3878
|
position: {},
|
|
3879
|
-
direction: "bottom"
|
|
3880
|
-
repositioning: false
|
|
3879
|
+
direction: "bottom"
|
|
3881
3880
|
});
|
|
3882
|
-
const placedRef = React19.useRef(false);
|
|
3883
3881
|
const calculatePosition = React19.useCallback(() => {
|
|
3884
3882
|
if (!triggerRef.current || !popRef.current) return;
|
|
3885
3883
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -3902,18 +3900,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3902
3900
|
left = triggerRect.right - popW;
|
|
3903
3901
|
}
|
|
3904
3902
|
if (left < 8) left = 8;
|
|
3905
|
-
setPosition({
|
|
3906
|
-
position: { top, left },
|
|
3907
|
-
direction,
|
|
3908
|
-
repositioning: placedRef.current
|
|
3909
|
-
});
|
|
3910
|
-
placedRef.current = true;
|
|
3903
|
+
setPosition({ position: { top, left }, direction });
|
|
3911
3904
|
}, [triggerRef, popRef]);
|
|
3912
3905
|
React19.useLayoutEffect(() => {
|
|
3913
|
-
if (!enabled)
|
|
3914
|
-
placedRef.current = false;
|
|
3915
|
-
return;
|
|
3916
|
-
}
|
|
3906
|
+
if (!enabled) return;
|
|
3917
3907
|
calculatePosition();
|
|
3918
3908
|
const raf = requestAnimationFrame(calculatePosition);
|
|
3919
3909
|
return () => cancelAnimationFrame(raf);
|
|
@@ -3979,7 +3969,7 @@ var Dropdown = (props) => {
|
|
|
3979
3969
|
const [visible, setVisible] = React21.useState(false);
|
|
3980
3970
|
const triggerRef = React21.useRef(null);
|
|
3981
3971
|
const menuRef = React21.useRef(null);
|
|
3982
|
-
const { position, direction
|
|
3972
|
+
const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
3983
3973
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
3984
3974
|
useEscapeKey(isOpen, () => {
|
|
3985
3975
|
setIsOpen(false);
|
|
@@ -4014,7 +4004,7 @@ var Dropdown = (props) => {
|
|
|
4014
4004
|
"div",
|
|
4015
4005
|
{
|
|
4016
4006
|
ref: menuRef,
|
|
4017
|
-
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }
|
|
4007
|
+
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
|
|
4018
4008
|
style: { top: position.top, left: position.left },
|
|
4019
4009
|
role: "menu",
|
|
4020
4010
|
children: items.map((item) => /* @__PURE__ */ jsx322(
|
|
@@ -5946,7 +5936,6 @@ var PopOver = (props) => {
|
|
|
5946
5936
|
className: clsx_default(
|
|
5947
5937
|
"lib-xplat-pop-over-content",
|
|
5948
5938
|
position.direction,
|
|
5949
|
-
position.repositioning && "repositioning",
|
|
5950
5939
|
eventTrigger && "visible"
|
|
5951
5940
|
),
|
|
5952
5941
|
ref: popRef,
|
|
@@ -6293,7 +6282,7 @@ var SelectRoot = (props) => {
|
|
|
6293
6282
|
mounted && /* @__PURE__ */ jsx337(Portal_default, { children: /* @__PURE__ */ jsxs216(
|
|
6294
6283
|
"div",
|
|
6295
6284
|
{
|
|
6296
|
-
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass
|
|
6285
|
+
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass),
|
|
6297
6286
|
ref: contentRef,
|
|
6298
6287
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
6299
6288
|
role: "listbox",
|
|
@@ -7186,7 +7175,7 @@ var TimePicker = (props) => {
|
|
|
7186
7175
|
"div",
|
|
7187
7176
|
{
|
|
7188
7177
|
ref: contentRef,
|
|
7189
|
-
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"
|
|
7178
|
+
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"),
|
|
7190
7179
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
7191
7180
|
role: "listbox",
|
|
7192
7181
|
children: options.map((t) => /* @__PURE__ */ jsx351(
|
package/dist/index.cjs
CHANGED
|
@@ -8389,10 +8389,8 @@ var import_react19 = __toESM(require("react"), 1);
|
|
|
8389
8389
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
8390
8390
|
const [position, setPosition] = import_react19.default.useState({
|
|
8391
8391
|
position: {},
|
|
8392
|
-
direction: "bottom"
|
|
8393
|
-
repositioning: false
|
|
8392
|
+
direction: "bottom"
|
|
8394
8393
|
});
|
|
8395
|
-
const placedRef = import_react19.default.useRef(false);
|
|
8396
8394
|
const calculatePosition = import_react19.default.useCallback(() => {
|
|
8397
8395
|
if (!triggerRef.current || !popRef.current) return;
|
|
8398
8396
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -8415,18 +8413,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
8415
8413
|
left = triggerRect.right - popW;
|
|
8416
8414
|
}
|
|
8417
8415
|
if (left < 8) left = 8;
|
|
8418
|
-
setPosition({
|
|
8419
|
-
position: { top, left },
|
|
8420
|
-
direction,
|
|
8421
|
-
repositioning: placedRef.current
|
|
8422
|
-
});
|
|
8423
|
-
placedRef.current = true;
|
|
8416
|
+
setPosition({ position: { top, left }, direction });
|
|
8424
8417
|
}, [triggerRef, popRef]);
|
|
8425
8418
|
import_react19.default.useLayoutEffect(() => {
|
|
8426
|
-
if (!enabled)
|
|
8427
|
-
placedRef.current = false;
|
|
8428
|
-
return;
|
|
8429
|
-
}
|
|
8419
|
+
if (!enabled) return;
|
|
8430
8420
|
calculatePosition();
|
|
8431
8421
|
const raf = requestAnimationFrame(calculatePosition);
|
|
8432
8422
|
return () => cancelAnimationFrame(raf);
|
|
@@ -8492,7 +8482,7 @@ var Dropdown = (props) => {
|
|
|
8492
8482
|
const [visible, setVisible] = import_react21.default.useState(false);
|
|
8493
8483
|
const triggerRef = import_react21.default.useRef(null);
|
|
8494
8484
|
const menuRef = import_react21.default.useRef(null);
|
|
8495
|
-
const { position, direction
|
|
8485
|
+
const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
8496
8486
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
8497
8487
|
useEscapeKey(isOpen, () => {
|
|
8498
8488
|
setIsOpen(false);
|
|
@@ -8527,7 +8517,7 @@ var Dropdown = (props) => {
|
|
|
8527
8517
|
"div",
|
|
8528
8518
|
{
|
|
8529
8519
|
ref: menuRef,
|
|
8530
|
-
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }
|
|
8520
|
+
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
|
|
8531
8521
|
style: { top: position.top, left: position.left },
|
|
8532
8522
|
role: "menu",
|
|
8533
8523
|
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
|
@@ -10459,7 +10449,6 @@ var PopOver = (props) => {
|
|
|
10459
10449
|
className: clsx_default(
|
|
10460
10450
|
"lib-xplat-pop-over-content",
|
|
10461
10451
|
position.direction,
|
|
10462
|
-
position.repositioning && "repositioning",
|
|
10463
10452
|
eventTrigger && "visible"
|
|
10464
10453
|
),
|
|
10465
10454
|
ref: popRef,
|
|
@@ -10806,7 +10795,7 @@ var SelectRoot = (props) => {
|
|
|
10806
10795
|
mounted && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)(
|
|
10807
10796
|
"div",
|
|
10808
10797
|
{
|
|
10809
|
-
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass
|
|
10798
|
+
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass),
|
|
10810
10799
|
ref: contentRef,
|
|
10811
10800
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
10812
10801
|
role: "listbox",
|
|
@@ -11699,7 +11688,7 @@ var TimePicker = (props) => {
|
|
|
11699
11688
|
"div",
|
|
11700
11689
|
{
|
|
11701
11690
|
ref: contentRef,
|
|
11702
|
-
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"
|
|
11691
|
+
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"),
|
|
11703
11692
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
11704
11693
|
role: "listbox",
|
|
11705
11694
|
children: options.map((t) => /* @__PURE__ */ (0, import_jsx_runtime351.jsx)(
|
package/dist/index.css
CHANGED
|
@@ -3322,9 +3322,6 @@
|
|
|
3322
3322
|
color: var(--semantic-text-disabled);
|
|
3323
3323
|
cursor: not-allowed;
|
|
3324
3324
|
}
|
|
3325
|
-
.lib-xplat-dropdown-menu.repositioning {
|
|
3326
|
-
transition: none;
|
|
3327
|
-
}
|
|
3328
3325
|
|
|
3329
3326
|
/* src/components/Editor/editor.scss */
|
|
3330
3327
|
.lib-xplat-editor {
|
|
@@ -4183,9 +4180,6 @@
|
|
|
4183
4180
|
opacity: 1;
|
|
4184
4181
|
transform: scale(1);
|
|
4185
4182
|
}
|
|
4186
|
-
.lib-xplat-pop-over-content.repositioning {
|
|
4187
|
-
transition: none;
|
|
4188
|
-
}
|
|
4189
4183
|
|
|
4190
4184
|
/* src/components/Progress/progress.scss */
|
|
4191
4185
|
.lib-xplat-progress {
|
|
@@ -4580,9 +4574,6 @@
|
|
|
4580
4574
|
cursor: not-allowed;
|
|
4581
4575
|
color: var(--semantic-text-disabled);
|
|
4582
4576
|
}
|
|
4583
|
-
.lib-xplat-select-content.repositioning {
|
|
4584
|
-
transition: none;
|
|
4585
|
-
}
|
|
4586
4577
|
|
|
4587
4578
|
/* src/components/Skeleton/skeleton.scss */
|
|
4588
4579
|
.lib-xplat-skeleton {
|
|
@@ -5683,9 +5674,6 @@
|
|
|
5683
5674
|
font-weight: var(--semantic-typo-label-1-m-weight);
|
|
5684
5675
|
letter-spacing: var(--semantic-typo-label-1-m-ls);
|
|
5685
5676
|
}
|
|
5686
|
-
.lib-xplat-time-picker-content.repositioning {
|
|
5687
|
-
transition: none;
|
|
5688
|
-
}
|
|
5689
5677
|
|
|
5690
5678
|
/* src/components/Toast/toast.scss */
|
|
5691
5679
|
.lib-xplat-toast-container {
|
package/dist/index.js
CHANGED
|
@@ -7979,10 +7979,8 @@ import React19 from "react";
|
|
|
7979
7979
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
7980
7980
|
const [position, setPosition] = React19.useState({
|
|
7981
7981
|
position: {},
|
|
7982
|
-
direction: "bottom"
|
|
7983
|
-
repositioning: false
|
|
7982
|
+
direction: "bottom"
|
|
7984
7983
|
});
|
|
7985
|
-
const placedRef = React19.useRef(false);
|
|
7986
7984
|
const calculatePosition = React19.useCallback(() => {
|
|
7987
7985
|
if (!triggerRef.current || !popRef.current) return;
|
|
7988
7986
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
@@ -8005,18 +8003,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
8005
8003
|
left = triggerRect.right - popW;
|
|
8006
8004
|
}
|
|
8007
8005
|
if (left < 8) left = 8;
|
|
8008
|
-
setPosition({
|
|
8009
|
-
position: { top, left },
|
|
8010
|
-
direction,
|
|
8011
|
-
repositioning: placedRef.current
|
|
8012
|
-
});
|
|
8013
|
-
placedRef.current = true;
|
|
8006
|
+
setPosition({ position: { top, left }, direction });
|
|
8014
8007
|
}, [triggerRef, popRef]);
|
|
8015
8008
|
React19.useLayoutEffect(() => {
|
|
8016
|
-
if (!enabled)
|
|
8017
|
-
placedRef.current = false;
|
|
8018
|
-
return;
|
|
8019
|
-
}
|
|
8009
|
+
if (!enabled) return;
|
|
8020
8010
|
calculatePosition();
|
|
8021
8011
|
const raf = requestAnimationFrame(calculatePosition);
|
|
8022
8012
|
return () => cancelAnimationFrame(raf);
|
|
@@ -8082,7 +8072,7 @@ var Dropdown = (props) => {
|
|
|
8082
8072
|
const [visible, setVisible] = React21.useState(false);
|
|
8083
8073
|
const triggerRef = React21.useRef(null);
|
|
8084
8074
|
const menuRef = React21.useRef(null);
|
|
8085
|
-
const { position, direction
|
|
8075
|
+
const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
8086
8076
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
8087
8077
|
useEscapeKey(isOpen, () => {
|
|
8088
8078
|
setIsOpen(false);
|
|
@@ -8117,7 +8107,7 @@ var Dropdown = (props) => {
|
|
|
8117
8107
|
"div",
|
|
8118
8108
|
{
|
|
8119
8109
|
ref: menuRef,
|
|
8120
|
-
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }
|
|
8110
|
+
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
|
|
8121
8111
|
style: { top: position.top, left: position.left },
|
|
8122
8112
|
role: "menu",
|
|
8123
8113
|
children: items.map((item) => /* @__PURE__ */ jsx322(
|
|
@@ -10049,7 +10039,6 @@ var PopOver = (props) => {
|
|
|
10049
10039
|
className: clsx_default(
|
|
10050
10040
|
"lib-xplat-pop-over-content",
|
|
10051
10041
|
position.direction,
|
|
10052
|
-
position.repositioning && "repositioning",
|
|
10053
10042
|
eventTrigger && "visible"
|
|
10054
10043
|
),
|
|
10055
10044
|
ref: popRef,
|
|
@@ -10396,7 +10385,7 @@ var SelectRoot = (props) => {
|
|
|
10396
10385
|
mounted && /* @__PURE__ */ jsx337(Portal_default, { children: /* @__PURE__ */ jsxs216(
|
|
10397
10386
|
"div",
|
|
10398
10387
|
{
|
|
10399
|
-
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass
|
|
10388
|
+
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass),
|
|
10400
10389
|
ref: contentRef,
|
|
10401
10390
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
10402
10391
|
role: "listbox",
|
|
@@ -11289,7 +11278,7 @@ var TimePicker = (props) => {
|
|
|
11289
11278
|
"div",
|
|
11290
11279
|
{
|
|
11291
11280
|
ref: contentRef,
|
|
11292
|
-
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"
|
|
11281
|
+
className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"),
|
|
11293
11282
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
11294
11283
|
role: "listbox",
|
|
11295
11284
|
children: options.map((t) => /* @__PURE__ */ jsx351(
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Header } from '../Header/index.cjs';
|
|
3
2
|
|
|
4
|
-
interface SidebarChildProps {
|
|
5
|
-
handleSwitchSideBar: () => void;
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
}
|
|
8
3
|
interface LayoutProps {
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 화면 위쪽 머리말. 보통 `Header` 를 넣는다.
|
|
6
|
+
*
|
|
7
|
+
* 한때 `ReactElement<typeof Header>` 로 좁혀 두었는데 그건 잘못된 표기였다 —
|
|
8
|
+
* `ReactElement<P>` 의 `P` 는 **그 엘리먼트의 props** 지 컴포넌트 타입이
|
|
9
|
+
* 아니다. `<Header />` 를 그대로 넘겨도 통과하지 않았다.
|
|
10
|
+
*/
|
|
11
|
+
header?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* 왼쪽 옆띠. 보통 `SideBar` 를 넣는다.
|
|
14
|
+
*
|
|
15
|
+
* 여는·닫는 상태는 `SideBar` 가 자기 안의 컨텍스트로 들고 있다. Layout 은
|
|
16
|
+
* 아무것도 주입하지 않으므로 슬롯을 좁힐 이유가 없다.
|
|
17
|
+
*/
|
|
18
|
+
sideBar?: React.ReactNode;
|
|
11
19
|
children?: React.ReactNode;
|
|
12
20
|
}
|
|
13
21
|
declare const Layout: React.FC<LayoutProps>;
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Header } from '../Header/index.js';
|
|
3
2
|
|
|
4
|
-
interface SidebarChildProps {
|
|
5
|
-
handleSwitchSideBar: () => void;
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
}
|
|
8
3
|
interface LayoutProps {
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 화면 위쪽 머리말. 보통 `Header` 를 넣는다.
|
|
6
|
+
*
|
|
7
|
+
* 한때 `ReactElement<typeof Header>` 로 좁혀 두었는데 그건 잘못된 표기였다 —
|
|
8
|
+
* `ReactElement<P>` 의 `P` 는 **그 엘리먼트의 props** 지 컴포넌트 타입이
|
|
9
|
+
* 아니다. `<Header />` 를 그대로 넘겨도 통과하지 않았다.
|
|
10
|
+
*/
|
|
11
|
+
header?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* 왼쪽 옆띠. 보통 `SideBar` 를 넣는다.
|
|
14
|
+
*
|
|
15
|
+
* 여는·닫는 상태는 `SideBar` 가 자기 안의 컨텍스트로 들고 있다. Layout 은
|
|
16
|
+
* 아무것도 주입하지 않으므로 슬롯을 좁힐 이유가 없다.
|
|
17
|
+
*/
|
|
18
|
+
sideBar?: React.ReactNode;
|
|
11
19
|
children?: React.ReactNode;
|
|
12
20
|
}
|
|
13
21
|
declare const Layout: React.FC<LayoutProps>;
|
package/guidelines/MIGRATION.md
CHANGED
|
@@ -260,6 +260,30 @@ HTML 을 검색 색인에 넣는다면 **닫는 태그를 공백이나 줄바꿈
|
|
|
260
260
|
직접 넘기는 구조라 라벨이 가리킬 대상이 없고, 후자는 `role="menu"` 인 액션
|
|
261
261
|
메뉴라 검증할 값이 없다.
|
|
262
262
|
|
|
263
|
+
## 0.12.0 ~ 0.14.0 — 오버레이 열림/닫힘 애니메이션이 죽어 있었다 (0.14.1 에서 고침)
|
|
264
|
+
|
|
265
|
+
**`e80f4df` 가 넣고 `0.14.1` 이 걷어냈다. 이 구간을 쓰고 있었다면 Select ·
|
|
266
|
+
Dropdown · PopOver · TimePicker 가 전부 애니메이션 없이 툭 튀어나왔다.**
|
|
267
|
+
|
|
268
|
+
0.12.0 에서 "열린 오버레이가 스크롤 중 미끄러진다" 를 고치면서 원인을 둘로
|
|
269
|
+
봤는데 하나가 틀렸다.
|
|
270
|
+
|
|
271
|
+
- **맞았던 것** — 스크롤 이벤트마다 `setState` 가 돌아 팝업이 한 프레임씩
|
|
272
|
+
뒤따라왔다. rAF 로 묶어 고쳤고, 이쪽은 그대로 남아 있다.
|
|
273
|
+
- **틀렸던 것** — "방향이 뒤집히면 열림 애니메이션이 다시 발동한다" 고 보고
|
|
274
|
+
`.repositioning { transition: none }` 을 넣었다. 그런데 자리는 `top`/`left`
|
|
275
|
+
로 옮기는데 전환은 `transform`/`opacity` 에만 걸려 있어 자리 이동은 애초에
|
|
276
|
+
전환을 타지 않고, 방향이 뒤집혀도 `.top.visible` 과 `.bottom.visible` 이
|
|
277
|
+
같은 `transform` 을 주므로 바뀌는 값이 없다.
|
|
278
|
+
|
|
279
|
+
게다가 그 플래그는 첫 계산 직후 켜진 뒤 **닫힐 때까지 꺼지지 않았다.** 여는
|
|
280
|
+
순간 `useLayoutEffect` → `rAF` → `ResizeObserver` 가 연달아 계산하므로 첫
|
|
281
|
+
프레임 안에 `transition: none` 이 붙고, 그 뒤에 `.visible` 이 와도 전환이
|
|
282
|
+
없다. 닫힘(`.exit`)도 같다.
|
|
283
|
+
|
|
284
|
+
**올리기만 하면 된다. 쓰는 쪽에서 고칠 것은 없다.** `.repositioning` 클래스를
|
|
285
|
+
직접 잡는 CSS 를 쓰고 있었다면 그 규칙만 지우면 된다.
|
|
286
|
+
|
|
263
287
|
---
|
|
264
288
|
|
|
265
289
|
## 실제 이관에서 걸린 것 / 안 걸린 것
|
|
@@ -88,6 +88,11 @@ const toggle = (v: string) =>
|
|
|
88
88
|
))}
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
> **곁에 깔린 `Chip` 과 같은 `size` 를 쓸 것.** 고르는 칩은 거의 항상 표시용
|
|
92
|
+
> 칩 옆에 놓이는데, 양쪽 기본값이 `md` 라고 안심하고 두면 앱이 표시용 칩을
|
|
93
|
+
> `sm` 으로 통일해 쓰는 경우 고르는 칩만 한 눈금 커진다. 모양을 맞춰 놔도
|
|
94
|
+
> 크기가 어긋나면 똑같이 겉돈다.
|
|
95
|
+
|
|
91
96
|
`Chip` 과 **같은 알약 모양·같은 크기 눈금**을 쓴다. 두 CSS 가 따로 있는 게
|
|
92
97
|
아니라 `ToggleChip` 이 `.lib-xplat-chip` 을 그대로 입고 상호작용분만 얹으므로
|
|
93
98
|
둘이 따로 놀 수 없다. 거르개 칩 아래에 표시용 `Chip` 이 깔리는 화면에서
|