@x-plat/design-system 0.14.1 → 0.14.3
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/AutoResizeTextArea/index.d.cts +1 -1
- package/dist/components/AutoResizeTextArea/index.d.ts +1 -1
- package/dist/components/Badge/index.d.cts +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/ChatInput/index.d.cts +1 -1
- package/dist/components/ChatInput/index.d.ts +1 -1
- package/dist/components/CheckBox/index.cjs +3 -3
- package/dist/components/CheckBox/index.d.cts +2 -2
- package/dist/components/CheckBox/index.d.ts +2 -2
- package/dist/components/CheckBox/index.js +3 -3
- package/dist/components/DatePicker/index.d.cts +1 -1
- package/dist/components/DatePicker/index.d.ts +1 -1
- package/dist/components/Dropdown/index.cjs +16 -13
- package/dist/components/Dropdown/index.js +16 -13
- package/dist/components/FieldMessage/index.d.cts +1 -1
- package/dist/components/FieldMessage/index.d.ts +1 -1
- package/dist/components/FileUpload/index.d.cts +1 -1
- package/dist/components/FileUpload/index.d.ts +1 -1
- package/dist/components/ImageSelector/index.d.cts +1 -1
- package/dist/components/ImageSelector/index.d.ts +1 -1
- package/dist/components/Input/index.d.cts +1 -1
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/NotificationBadge/index.d.cts +1 -1
- package/dist/components/NotificationBadge/index.d.ts +1 -1
- package/dist/components/Pagination/index.d.cts +1 -1
- package/dist/components/Pagination/index.d.ts +1 -1
- package/dist/components/PopOver/index.cjs +15 -14
- package/dist/components/PopOver/index.js +15 -14
- package/dist/components/Progress/index.d.cts +1 -1
- package/dist/components/Progress/index.d.ts +1 -1
- package/dist/components/Radio/index.d.cts +2 -2
- package/dist/components/Radio/index.d.ts +2 -2
- package/dist/components/Select/index.cjs +16 -12
- package/dist/components/Select/index.d.cts +1 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Select/index.js +16 -12
- package/dist/components/Spinner/index.d.cts +1 -1
- package/dist/components/Spinner/index.d.ts +1 -1
- package/dist/components/Stat/index.d.cts +1 -1
- package/dist/components/Stat/index.d.ts +1 -1
- package/dist/components/Steps/index.d.cts +1 -1
- package/dist/components/Steps/index.d.ts +1 -1
- package/dist/components/Switch/index.d.cts +2 -2
- package/dist/components/Switch/index.d.ts +2 -2
- package/dist/components/TextArea/index.d.cts +1 -1
- package/dist/components/TextArea/index.d.ts +1 -1
- package/dist/components/TimePicker/index.cjs +17 -13
- package/dist/components/TimePicker/index.d.cts +1 -1
- package/dist/components/TimePicker/index.d.ts +1 -1
- package/dist/components/TimePicker/index.js +17 -13
- package/dist/components/index.cjs +22 -22
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +22 -22
- package/dist/index.cjs +24 -22
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +23 -22
- package/dist/layout/Layout/index.d.cts +15 -7
- package/dist/layout/Layout/index.d.ts +15 -7
- package/dist/{status-njWqQWFV.d.cts → status-C70BBv2S.d.cts} +3 -1
- package/dist/{status-njWqQWFV.d.ts → status-C70BBv2S.d.ts} +3 -1
- package/dist/tokens/index.cjs +5 -0
- package/dist/tokens/index.d.cts +3 -0
- package/dist/tokens/index.d.ts +3 -0
- package/dist/tokens/index.js +4 -0
- package/dist/{validation-Dqo1zqhT.d.cts → validation-BYpAI6Ct.d.cts} +1 -1
- package/dist/{validation-Dqo1zqhT.d.ts → validation-BYpAI6Ct.d.ts} +1 -1
- package/guidelines/MIGRATION.md +50 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { T as TextareaAttributes } from '../../attributes-DJIWir_0.cjs';
|
|
3
|
-
import { V as Validation } from '../../validation-
|
|
3
|
+
import { V as Validation } from '../../validation-BYpAI6Ct.cjs';
|
|
4
4
|
|
|
5
5
|
interface AutoResizeTextAreaProps extends TextareaAttributes {
|
|
6
6
|
/** ChatInput 등 내부 임베딩 시 wrapper 없이 textarea만 렌더 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { T as TextareaAttributes } from '../../attributes-DJIWir_0.js';
|
|
3
|
-
import { V as Validation } from '../../validation-
|
|
3
|
+
import { V as Validation } from '../../validation-BYpAI6Ct.js';
|
|
4
4
|
|
|
5
5
|
interface AutoResizeTextAreaProps extends TextareaAttributes {
|
|
6
6
|
/** ChatInput 등 내부 임베딩 시 wrapper 없이 textarea만 렌더 */
|
|
@@ -27,6 +27,9 @@ module.exports = __toCommonJS(CheckBox_exports);
|
|
|
27
27
|
// src/tokens/colors.ts
|
|
28
28
|
var import_tokens_core = require("@x-plat/tokens-core");
|
|
29
29
|
|
|
30
|
+
// src/tokens/interface/status.ts
|
|
31
|
+
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
32
|
+
|
|
30
33
|
// src/tokens/svg/action/CopyIcon.tsx
|
|
31
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
35
|
|
|
@@ -1019,9 +1022,6 @@ var import_jsx_runtime294 = require("react/jsx-runtime");
|
|
|
1019
1022
|
// src/tokens/index.ts
|
|
1020
1023
|
var import_tokens_core2 = require("@x-plat/tokens-core");
|
|
1021
1024
|
|
|
1022
|
-
// src/tokens/interface/status.ts
|
|
1023
|
-
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
1024
|
-
|
|
1025
1025
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
1026
1026
|
function r(e) {
|
|
1027
1027
|
var t, f, n = "";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { I as InputAttributes } from '../../attributes-DJIWir_0.cjs';
|
|
3
|
-
import { L as LegacyStatusType } from '../../status-
|
|
4
|
-
import { V as Validation } from '../../validation-
|
|
3
|
+
import { L as LegacyStatusType } from '../../status-C70BBv2S.cjs';
|
|
4
|
+
import { V as Validation } from '../../validation-BYpAI6Ct.cjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
|
|
7
7
|
type CheckBoxSize = "sm" | "md" | "lg";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { I as InputAttributes } from '../../attributes-DJIWir_0.js';
|
|
3
|
-
import { L as LegacyStatusType } from '../../status-
|
|
4
|
-
import { V as Validation } from '../../validation-
|
|
3
|
+
import { L as LegacyStatusType } from '../../status-C70BBv2S.js';
|
|
4
|
+
import { V as Validation } from '../../validation-BYpAI6Ct.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
|
|
7
7
|
type CheckBoxSize = "sm" | "md" | "lg";
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// src/tokens/colors.ts
|
|
2
2
|
import { semantic } from "@x-plat/tokens-core";
|
|
3
3
|
|
|
4
|
+
// src/tokens/interface/status.ts
|
|
5
|
+
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
6
|
+
|
|
4
7
|
// src/tokens/svg/action/CopyIcon.tsx
|
|
5
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
9
|
|
|
@@ -993,9 +996,6 @@ import { jsx as jsx294, jsxs as jsxs188 } from "react/jsx-runtime";
|
|
|
993
996
|
// src/tokens/index.ts
|
|
994
997
|
import { cssVar } from "@x-plat/tokens-core";
|
|
995
998
|
|
|
996
|
-
// src/tokens/interface/status.ts
|
|
997
|
-
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
998
|
-
|
|
999
999
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
1000
1000
|
function r(e) {
|
|
1001
1001
|
var t, f, n = "";
|
|
@@ -49,23 +49,22 @@ var Portal_default = Portal;
|
|
|
49
49
|
// src/tokens/hooks/useAutoPosition.ts
|
|
50
50
|
var import_react = __toESM(require("react"), 1);
|
|
51
51
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
52
|
-
const [
|
|
53
|
-
|
|
54
|
-
direction: "bottom"
|
|
55
|
-
});
|
|
52
|
+
const [direction, setDirection] = import_react.default.useState("bottom");
|
|
53
|
+
const directionRef = import_react.default.useRef("bottom");
|
|
56
54
|
const calculatePosition = import_react.default.useCallback(() => {
|
|
57
|
-
|
|
55
|
+
const pop = popRef.current;
|
|
56
|
+
if (!triggerRef.current || !pop) return;
|
|
58
57
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
59
|
-
const popW =
|
|
60
|
-
const popH =
|
|
58
|
+
const popW = pop.offsetWidth;
|
|
59
|
+
const popH = pop.offsetHeight;
|
|
61
60
|
const viewportHeight = window.innerHeight;
|
|
62
61
|
const viewportWidth = window.innerWidth;
|
|
63
62
|
if (popH === 0 || popW === 0) return;
|
|
64
|
-
let
|
|
63
|
+
let next = "bottom";
|
|
65
64
|
let top;
|
|
66
65
|
let left;
|
|
67
66
|
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
68
|
-
|
|
67
|
+
next = "top";
|
|
69
68
|
top = triggerRect.top - popH;
|
|
70
69
|
} else {
|
|
71
70
|
top = triggerRect.bottom;
|
|
@@ -75,7 +74,12 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
75
74
|
left = triggerRect.right - popW;
|
|
76
75
|
}
|
|
77
76
|
if (left < 8) left = 8;
|
|
78
|
-
|
|
77
|
+
pop.style.top = `${top}px`;
|
|
78
|
+
pop.style.left = `${left}px`;
|
|
79
|
+
if (next !== directionRef.current) {
|
|
80
|
+
directionRef.current = next;
|
|
81
|
+
setDirection(next);
|
|
82
|
+
}
|
|
79
83
|
}, [triggerRef, popRef]);
|
|
80
84
|
import_react.default.useLayoutEffect(() => {
|
|
81
85
|
if (!enabled) return;
|
|
@@ -106,7 +110,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
106
110
|
window.removeEventListener("scroll", onScrollOrResize, true);
|
|
107
111
|
};
|
|
108
112
|
}, [calculatePosition, enabled]);
|
|
109
|
-
return
|
|
113
|
+
return { direction };
|
|
110
114
|
};
|
|
111
115
|
var useAutoPosition_default = useAutoPosition;
|
|
112
116
|
|
|
@@ -184,7 +188,7 @@ var Dropdown = (props) => {
|
|
|
184
188
|
const [visible, setVisible] = import_react4.default.useState(false);
|
|
185
189
|
const triggerRef = import_react4.default.useRef(null);
|
|
186
190
|
const menuRef = import_react4.default.useRef(null);
|
|
187
|
-
const {
|
|
191
|
+
const { direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
188
192
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
189
193
|
useEscapeKey(isOpen, () => {
|
|
190
194
|
setIsOpen(false);
|
|
@@ -220,7 +224,6 @@ var Dropdown = (props) => {
|
|
|
220
224
|
{
|
|
221
225
|
ref: menuRef,
|
|
222
226
|
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
|
|
223
|
-
style: { top: position.top, left: position.left },
|
|
224
227
|
role: "menu",
|
|
225
228
|
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
226
229
|
"button",
|
|
@@ -13,23 +13,22 @@ var Portal_default = Portal;
|
|
|
13
13
|
// src/tokens/hooks/useAutoPosition.ts
|
|
14
14
|
import React from "react";
|
|
15
15
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
16
|
-
const [
|
|
17
|
-
|
|
18
|
-
direction: "bottom"
|
|
19
|
-
});
|
|
16
|
+
const [direction, setDirection] = React.useState("bottom");
|
|
17
|
+
const directionRef = React.useRef("bottom");
|
|
20
18
|
const calculatePosition = React.useCallback(() => {
|
|
21
|
-
|
|
19
|
+
const pop = popRef.current;
|
|
20
|
+
if (!triggerRef.current || !pop) return;
|
|
22
21
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
23
|
-
const popW =
|
|
24
|
-
const popH =
|
|
22
|
+
const popW = pop.offsetWidth;
|
|
23
|
+
const popH = pop.offsetHeight;
|
|
25
24
|
const viewportHeight = window.innerHeight;
|
|
26
25
|
const viewportWidth = window.innerWidth;
|
|
27
26
|
if (popH === 0 || popW === 0) return;
|
|
28
|
-
let
|
|
27
|
+
let next = "bottom";
|
|
29
28
|
let top;
|
|
30
29
|
let left;
|
|
31
30
|
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
32
|
-
|
|
31
|
+
next = "top";
|
|
33
32
|
top = triggerRect.top - popH;
|
|
34
33
|
} else {
|
|
35
34
|
top = triggerRect.bottom;
|
|
@@ -39,7 +38,12 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
39
38
|
left = triggerRect.right - popW;
|
|
40
39
|
}
|
|
41
40
|
if (left < 8) left = 8;
|
|
42
|
-
|
|
41
|
+
pop.style.top = `${top}px`;
|
|
42
|
+
pop.style.left = `${left}px`;
|
|
43
|
+
if (next !== directionRef.current) {
|
|
44
|
+
directionRef.current = next;
|
|
45
|
+
setDirection(next);
|
|
46
|
+
}
|
|
43
47
|
}, [triggerRef, popRef]);
|
|
44
48
|
React.useLayoutEffect(() => {
|
|
45
49
|
if (!enabled) return;
|
|
@@ -70,7 +74,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
70
74
|
window.removeEventListener("scroll", onScrollOrResize, true);
|
|
71
75
|
};
|
|
72
76
|
}, [calculatePosition, enabled]);
|
|
73
|
-
return
|
|
77
|
+
return { direction };
|
|
74
78
|
};
|
|
75
79
|
var useAutoPosition_default = useAutoPosition;
|
|
76
80
|
|
|
@@ -148,7 +152,7 @@ var Dropdown = (props) => {
|
|
|
148
152
|
const [visible, setVisible] = React4.useState(false);
|
|
149
153
|
const triggerRef = React4.useRef(null);
|
|
150
154
|
const menuRef = React4.useRef(null);
|
|
151
|
-
const {
|
|
155
|
+
const { direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
152
156
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
153
157
|
useEscapeKey(isOpen, () => {
|
|
154
158
|
setIsOpen(false);
|
|
@@ -184,7 +188,6 @@ var Dropdown = (props) => {
|
|
|
184
188
|
{
|
|
185
189
|
ref: menuRef,
|
|
186
190
|
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
|
|
187
|
-
style: { top: position.top, left: position.left },
|
|
188
191
|
role: "menu",
|
|
189
192
|
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
190
193
|
"button",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { V as Validation } from '../../validation-
|
|
3
|
+
import { V as Validation } from '../../validation-BYpAI6Ct.cjs';
|
|
4
4
|
|
|
5
5
|
interface FieldMessageProps {
|
|
6
6
|
/** 표시할 검증 메시지 목록. 비어 있거나 없으면 아무것도 그리지 않는다 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { V as Validation } from '../../validation-
|
|
3
|
+
import { V as Validation } from '../../validation-BYpAI6Ct.js';
|
|
4
4
|
|
|
5
5
|
interface FieldMessageProps {
|
|
6
6
|
/** 표시할 검증 메시지 목록. 비어 있거나 없으면 아무것도 그리지 않는다 */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { I as InputAttributes } from '../../attributes-DJIWir_0.cjs';
|
|
3
|
-
import { V as Validation } from '../../validation-
|
|
3
|
+
import { V as Validation } from '../../validation-BYpAI6Ct.cjs';
|
|
4
4
|
|
|
5
5
|
type InputSize$1 = "sm" | "md" | "lg";
|
|
6
6
|
interface InputProps extends Omit<InputAttributes, "size"> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { I as InputAttributes } from '../../attributes-DJIWir_0.js';
|
|
3
|
-
import { V as Validation } from '../../validation-
|
|
3
|
+
import { V as Validation } from '../../validation-BYpAI6Ct.js';
|
|
4
4
|
|
|
5
5
|
type InputSize$1 = "sm" | "md" | "lg";
|
|
6
6
|
interface InputProps extends Omit<InputAttributes, "size"> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { L as LegacyStatusType } from '../../status-
|
|
3
|
+
import { L as LegacyStatusType } from '../../status-C70BBv2S.cjs';
|
|
4
4
|
|
|
5
5
|
/** NotificationBadge 의 상태 색 */
|
|
6
6
|
type NotificationBadgeType = "primary" | "success" | "error" | "warning" | "info";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { L as LegacyStatusType } from '../../status-
|
|
3
|
+
import { L as LegacyStatusType } from '../../status-C70BBv2S.js';
|
|
4
4
|
|
|
5
5
|
/** NotificationBadge 의 상태 색 */
|
|
6
6
|
type NotificationBadgeType = "primary" | "success" | "error" | "warning" | "info";
|
|
@@ -49,23 +49,22 @@ var Portal_default = Portal;
|
|
|
49
49
|
// src/tokens/hooks/useAutoPosition.ts
|
|
50
50
|
var import_react = __toESM(require("react"), 1);
|
|
51
51
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
52
|
-
const [
|
|
53
|
-
|
|
54
|
-
direction: "bottom"
|
|
55
|
-
});
|
|
52
|
+
const [direction, setDirection] = import_react.default.useState("bottom");
|
|
53
|
+
const directionRef = import_react.default.useRef("bottom");
|
|
56
54
|
const calculatePosition = import_react.default.useCallback(() => {
|
|
57
|
-
|
|
55
|
+
const pop = popRef.current;
|
|
56
|
+
if (!triggerRef.current || !pop) return;
|
|
58
57
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
59
|
-
const popW =
|
|
60
|
-
const popH =
|
|
58
|
+
const popW = pop.offsetWidth;
|
|
59
|
+
const popH = pop.offsetHeight;
|
|
61
60
|
const viewportHeight = window.innerHeight;
|
|
62
61
|
const viewportWidth = window.innerWidth;
|
|
63
62
|
if (popH === 0 || popW === 0) return;
|
|
64
|
-
let
|
|
63
|
+
let next = "bottom";
|
|
65
64
|
let top;
|
|
66
65
|
let left;
|
|
67
66
|
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
68
|
-
|
|
67
|
+
next = "top";
|
|
69
68
|
top = triggerRect.top - popH;
|
|
70
69
|
} else {
|
|
71
70
|
top = triggerRect.bottom;
|
|
@@ -75,7 +74,12 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
75
74
|
left = triggerRect.right - popW;
|
|
76
75
|
}
|
|
77
76
|
if (left < 8) left = 8;
|
|
78
|
-
|
|
77
|
+
pop.style.top = `${top}px`;
|
|
78
|
+
pop.style.left = `${left}px`;
|
|
79
|
+
if (next !== directionRef.current) {
|
|
80
|
+
directionRef.current = next;
|
|
81
|
+
setDirection(next);
|
|
82
|
+
}
|
|
79
83
|
}, [triggerRef, popRef]);
|
|
80
84
|
import_react.default.useLayoutEffect(() => {
|
|
81
85
|
if (!enabled) return;
|
|
@@ -106,7 +110,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
106
110
|
window.removeEventListener("scroll", onScrollOrResize, true);
|
|
107
111
|
};
|
|
108
112
|
}, [calculatePosition, enabled]);
|
|
109
|
-
return
|
|
113
|
+
return { direction };
|
|
110
114
|
};
|
|
111
115
|
var useAutoPosition_default = useAutoPosition;
|
|
112
116
|
|
|
@@ -221,9 +225,6 @@ var PopOver = (props) => {
|
|
|
221
225
|
eventTrigger && "visible"
|
|
222
226
|
),
|
|
223
227
|
ref: popRef,
|
|
224
|
-
style: {
|
|
225
|
-
...position.position
|
|
226
|
-
},
|
|
227
228
|
children: PopOverEl
|
|
228
229
|
}
|
|
229
230
|
) })
|
|
@@ -13,23 +13,22 @@ var Portal_default = Portal;
|
|
|
13
13
|
// src/tokens/hooks/useAutoPosition.ts
|
|
14
14
|
import React from "react";
|
|
15
15
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
16
|
-
const [
|
|
17
|
-
|
|
18
|
-
direction: "bottom"
|
|
19
|
-
});
|
|
16
|
+
const [direction, setDirection] = React.useState("bottom");
|
|
17
|
+
const directionRef = React.useRef("bottom");
|
|
20
18
|
const calculatePosition = React.useCallback(() => {
|
|
21
|
-
|
|
19
|
+
const pop = popRef.current;
|
|
20
|
+
if (!triggerRef.current || !pop) return;
|
|
22
21
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
23
|
-
const popW =
|
|
24
|
-
const popH =
|
|
22
|
+
const popW = pop.offsetWidth;
|
|
23
|
+
const popH = pop.offsetHeight;
|
|
25
24
|
const viewportHeight = window.innerHeight;
|
|
26
25
|
const viewportWidth = window.innerWidth;
|
|
27
26
|
if (popH === 0 || popW === 0) return;
|
|
28
|
-
let
|
|
27
|
+
let next = "bottom";
|
|
29
28
|
let top;
|
|
30
29
|
let left;
|
|
31
30
|
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
32
|
-
|
|
31
|
+
next = "top";
|
|
33
32
|
top = triggerRect.top - popH;
|
|
34
33
|
} else {
|
|
35
34
|
top = triggerRect.bottom;
|
|
@@ -39,7 +38,12 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
39
38
|
left = triggerRect.right - popW;
|
|
40
39
|
}
|
|
41
40
|
if (left < 8) left = 8;
|
|
42
|
-
|
|
41
|
+
pop.style.top = `${top}px`;
|
|
42
|
+
pop.style.left = `${left}px`;
|
|
43
|
+
if (next !== directionRef.current) {
|
|
44
|
+
directionRef.current = next;
|
|
45
|
+
setDirection(next);
|
|
46
|
+
}
|
|
43
47
|
}, [triggerRef, popRef]);
|
|
44
48
|
React.useLayoutEffect(() => {
|
|
45
49
|
if (!enabled) return;
|
|
@@ -70,7 +74,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
70
74
|
window.removeEventListener("scroll", onScrollOrResize, true);
|
|
71
75
|
};
|
|
72
76
|
}, [calculatePosition, enabled]);
|
|
73
|
-
return
|
|
77
|
+
return { direction };
|
|
74
78
|
};
|
|
75
79
|
var useAutoPosition_default = useAutoPosition;
|
|
76
80
|
|
|
@@ -185,9 +189,6 @@ var PopOver = (props) => {
|
|
|
185
189
|
eventTrigger && "visible"
|
|
186
190
|
),
|
|
187
191
|
ref: popRef,
|
|
188
|
-
style: {
|
|
189
|
-
...position.position
|
|
190
|
-
},
|
|
191
192
|
children: PopOverEl
|
|
192
193
|
}
|
|
193
194
|
) })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { I as InputAttributes } from '../../attributes-DJIWir_0.cjs';
|
|
3
|
-
import { L as LegacyStatusType } from '../../status-
|
|
4
|
-
import { V as Validation } from '../../validation-
|
|
3
|
+
import { L as LegacyStatusType } from '../../status-C70BBv2S.cjs';
|
|
4
|
+
import { V as Validation } from '../../validation-BYpAI6Ct.cjs';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
type RadioSize = "sm" | "md" | "lg";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { I as InputAttributes } from '../../attributes-DJIWir_0.js';
|
|
3
|
-
import { L as LegacyStatusType } from '../../status-
|
|
4
|
-
import { V as Validation } from '../../validation-
|
|
3
|
+
import { L as LegacyStatusType } from '../../status-C70BBv2S.js';
|
|
4
|
+
import { V as Validation } from '../../validation-BYpAI6Ct.js';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
type RadioSize = "sm" | "md" | "lg";
|
|
@@ -50,23 +50,22 @@ var Portal_default = Portal;
|
|
|
50
50
|
// src/tokens/hooks/useAutoPosition.ts
|
|
51
51
|
var import_react = __toESM(require("react"), 1);
|
|
52
52
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
53
|
-
const [
|
|
54
|
-
|
|
55
|
-
direction: "bottom"
|
|
56
|
-
});
|
|
53
|
+
const [direction, setDirection] = import_react.default.useState("bottom");
|
|
54
|
+
const directionRef = import_react.default.useRef("bottom");
|
|
57
55
|
const calculatePosition = import_react.default.useCallback(() => {
|
|
58
|
-
|
|
56
|
+
const pop = popRef.current;
|
|
57
|
+
if (!triggerRef.current || !pop) return;
|
|
59
58
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
60
|
-
const popW =
|
|
61
|
-
const popH =
|
|
59
|
+
const popW = pop.offsetWidth;
|
|
60
|
+
const popH = pop.offsetHeight;
|
|
62
61
|
const viewportHeight = window.innerHeight;
|
|
63
62
|
const viewportWidth = window.innerWidth;
|
|
64
63
|
if (popH === 0 || popW === 0) return;
|
|
65
|
-
let
|
|
64
|
+
let next = "bottom";
|
|
66
65
|
let top;
|
|
67
66
|
let left;
|
|
68
67
|
if (triggerRect.bottom + popH > viewportHeight && triggerRect.top - popH > 0) {
|
|
69
|
-
|
|
68
|
+
next = "top";
|
|
70
69
|
top = triggerRect.top - popH;
|
|
71
70
|
} else {
|
|
72
71
|
top = triggerRect.bottom;
|
|
@@ -76,7 +75,12 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
76
75
|
left = triggerRect.right - popW;
|
|
77
76
|
}
|
|
78
77
|
if (left < 8) left = 8;
|
|
79
|
-
|
|
78
|
+
pop.style.top = `${top}px`;
|
|
79
|
+
pop.style.left = `${left}px`;
|
|
80
|
+
if (next !== directionRef.current) {
|
|
81
|
+
directionRef.current = next;
|
|
82
|
+
setDirection(next);
|
|
83
|
+
}
|
|
80
84
|
}, [triggerRef, popRef]);
|
|
81
85
|
import_react.default.useLayoutEffect(() => {
|
|
82
86
|
if (!enabled) return;
|
|
@@ -107,7 +111,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
107
111
|
window.removeEventListener("scroll", onScrollOrResize, true);
|
|
108
112
|
};
|
|
109
113
|
}, [calculatePosition, enabled]);
|
|
110
|
-
return
|
|
114
|
+
return { direction };
|
|
111
115
|
};
|
|
112
116
|
var useAutoPosition_default = useAutoPosition;
|
|
113
117
|
|
|
@@ -1414,7 +1418,7 @@ var SelectRoot = (props) => {
|
|
|
1414
1418
|
{
|
|
1415
1419
|
className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass),
|
|
1416
1420
|
ref: contentRef,
|
|
1417
|
-
style: {
|
|
1421
|
+
style: { width: triggerRef.current?.offsetWidth },
|
|
1418
1422
|
role: "listbox",
|
|
1419
1423
|
children: [
|
|
1420
1424
|
searchable && /* @__PURE__ */ (0, import_jsx_runtime297.jsx)("div", { className: "select-search", children: /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { V as Validation } from '../../validation-
|
|
3
|
+
import { V as Validation } from '../../validation-BYpAI6Ct.cjs';
|
|
4
4
|
|
|
5
5
|
interface SelectItemProps {
|
|
6
6
|
children: React.ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { V as Validation } from '../../validation-
|
|
3
|
+
import { V as Validation } from '../../validation-BYpAI6Ct.js';
|
|
4
4
|
|
|
5
5
|
interface SelectItemProps {
|
|
6
6
|
children: React.ReactNode;
|