@x-plat/design-system 0.5.42 → 0.5.44
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 +22 -22
- package/dist/components/Dropdown/index.js +22 -22
- package/dist/components/PopOver/index.cjs +22 -22
- package/dist/components/PopOver/index.js +22 -22
- package/dist/components/Select/index.cjs +22 -22
- package/dist/components/Select/index.js +22 -22
- package/dist/components/Video/index.cjs +201 -201
- package/dist/components/Video/index.js +243 -243
- package/dist/components/index.cjs +278 -278
- package/dist/components/index.css +700 -188
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +278 -278
- package/dist/index.cjs +278 -278
- package/dist/index.css +700 -188
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +278 -278
- package/dist/layout/index.css +520 -8
- package/guidelines/AGENT_PROMPT.md +248 -0
- package/guidelines/Guidelines.md +8 -0
- package/guidelines/composition/layout.md +87 -16
- package/guidelines/setup.md +11 -2
- package/package.json +1 -1
|
@@ -37,14 +37,28 @@ module.exports = __toCommonJS(Dropdown_exports);
|
|
|
37
37
|
// src/components/Dropdown/Dropdown.tsx
|
|
38
38
|
var import_react4 = __toESM(require("react"), 1);
|
|
39
39
|
|
|
40
|
-
// src/tokens/hooks/
|
|
40
|
+
// src/tokens/hooks/Portal.tsx
|
|
41
41
|
var import_react = __toESM(require("react"), 1);
|
|
42
|
+
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
+
var PortalContainerContext = import_react.default.createContext(null);
|
|
45
|
+
var Portal = ({ children }) => {
|
|
46
|
+
const contextContainer = import_react.default.useContext(PortalContainerContext);
|
|
47
|
+
if (typeof document === "undefined") return null;
|
|
48
|
+
const container = contextContainer ?? document.body;
|
|
49
|
+
return import_react_dom.default.createPortal(children, container);
|
|
50
|
+
};
|
|
51
|
+
Portal.displayName = "Portal";
|
|
52
|
+
var Portal_default = Portal;
|
|
53
|
+
|
|
54
|
+
// src/tokens/hooks/useAutoPosition.ts
|
|
55
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
42
56
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
43
|
-
const [position, setPosition] =
|
|
57
|
+
const [position, setPosition] = import_react2.default.useState({
|
|
44
58
|
position: {},
|
|
45
59
|
direction: "bottom"
|
|
46
60
|
});
|
|
47
|
-
const calculatePosition =
|
|
61
|
+
const calculatePosition = import_react2.default.useCallback(() => {
|
|
48
62
|
if (!triggerRef.current || !popRef.current) return;
|
|
49
63
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
50
64
|
const popW = popRef.current.offsetWidth;
|
|
@@ -71,13 +85,13 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
71
85
|
direction
|
|
72
86
|
});
|
|
73
87
|
}, [triggerRef, popRef]);
|
|
74
|
-
|
|
88
|
+
import_react2.default.useLayoutEffect(() => {
|
|
75
89
|
if (!enabled) return;
|
|
76
90
|
calculatePosition();
|
|
77
91
|
const raf = requestAnimationFrame(calculatePosition);
|
|
78
92
|
return () => cancelAnimationFrame(raf);
|
|
79
93
|
}, [calculatePosition, enabled]);
|
|
80
|
-
|
|
94
|
+
import_react2.default.useEffect(() => {
|
|
81
95
|
if (!enabled || !popRef.current) return;
|
|
82
96
|
const observer = new ResizeObserver(() => {
|
|
83
97
|
calculatePosition();
|
|
@@ -85,7 +99,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
85
99
|
observer.observe(popRef.current);
|
|
86
100
|
return () => observer.disconnect();
|
|
87
101
|
}, [calculatePosition, enabled, popRef]);
|
|
88
|
-
|
|
102
|
+
import_react2.default.useEffect(() => {
|
|
89
103
|
if (!enabled) return;
|
|
90
104
|
window.addEventListener("resize", calculatePosition);
|
|
91
105
|
window.addEventListener("scroll", calculatePosition, true);
|
|
@@ -99,9 +113,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
99
113
|
var useAutoPosition_default = useAutoPosition;
|
|
100
114
|
|
|
101
115
|
// src/tokens/hooks/useClickOutside.ts
|
|
102
|
-
var
|
|
116
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
103
117
|
var useClickOutside = (refs, handler, enabled = true) => {
|
|
104
|
-
|
|
118
|
+
import_react3.default.useEffect(() => {
|
|
105
119
|
if (!enabled) return;
|
|
106
120
|
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
107
121
|
const listener = (event) => {
|
|
@@ -123,20 +137,6 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
123
137
|
};
|
|
124
138
|
var useClickOutside_default = useClickOutside;
|
|
125
139
|
|
|
126
|
-
// src/tokens/hooks/Portal.tsx
|
|
127
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
128
|
-
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
129
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
130
|
-
var PortalContainerContext = import_react3.default.createContext(null);
|
|
131
|
-
var Portal = ({ children }) => {
|
|
132
|
-
const contextContainer = import_react3.default.useContext(PortalContainerContext);
|
|
133
|
-
if (typeof document === "undefined") return null;
|
|
134
|
-
const container = contextContainer ?? document.body;
|
|
135
|
-
return import_react_dom.default.createPortal(children, container);
|
|
136
|
-
};
|
|
137
|
-
Portal.displayName = "Portal";
|
|
138
|
-
var Portal_default = Portal;
|
|
139
|
-
|
|
140
140
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
141
141
|
function r(e) {
|
|
142
142
|
var t, f, n = "";
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
// src/components/Dropdown/Dropdown.tsx
|
|
2
2
|
import React4 from "react";
|
|
3
3
|
|
|
4
|
-
// src/tokens/hooks/
|
|
4
|
+
// src/tokens/hooks/Portal.tsx
|
|
5
5
|
import React from "react";
|
|
6
|
+
import ReactDOM from "react-dom";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var PortalContainerContext = React.createContext(null);
|
|
9
|
+
var Portal = ({ children }) => {
|
|
10
|
+
const contextContainer = React.useContext(PortalContainerContext);
|
|
11
|
+
if (typeof document === "undefined") return null;
|
|
12
|
+
const container = contextContainer ?? document.body;
|
|
13
|
+
return ReactDOM.createPortal(children, container);
|
|
14
|
+
};
|
|
15
|
+
Portal.displayName = "Portal";
|
|
16
|
+
var Portal_default = Portal;
|
|
17
|
+
|
|
18
|
+
// src/tokens/hooks/useAutoPosition.ts
|
|
19
|
+
import React2 from "react";
|
|
6
20
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
7
|
-
const [position, setPosition] =
|
|
21
|
+
const [position, setPosition] = React2.useState({
|
|
8
22
|
position: {},
|
|
9
23
|
direction: "bottom"
|
|
10
24
|
});
|
|
11
|
-
const calculatePosition =
|
|
25
|
+
const calculatePosition = React2.useCallback(() => {
|
|
12
26
|
if (!triggerRef.current || !popRef.current) return;
|
|
13
27
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
14
28
|
const popW = popRef.current.offsetWidth;
|
|
@@ -35,13 +49,13 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
35
49
|
direction
|
|
36
50
|
});
|
|
37
51
|
}, [triggerRef, popRef]);
|
|
38
|
-
|
|
52
|
+
React2.useLayoutEffect(() => {
|
|
39
53
|
if (!enabled) return;
|
|
40
54
|
calculatePosition();
|
|
41
55
|
const raf = requestAnimationFrame(calculatePosition);
|
|
42
56
|
return () => cancelAnimationFrame(raf);
|
|
43
57
|
}, [calculatePosition, enabled]);
|
|
44
|
-
|
|
58
|
+
React2.useEffect(() => {
|
|
45
59
|
if (!enabled || !popRef.current) return;
|
|
46
60
|
const observer = new ResizeObserver(() => {
|
|
47
61
|
calculatePosition();
|
|
@@ -49,7 +63,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
49
63
|
observer.observe(popRef.current);
|
|
50
64
|
return () => observer.disconnect();
|
|
51
65
|
}, [calculatePosition, enabled, popRef]);
|
|
52
|
-
|
|
66
|
+
React2.useEffect(() => {
|
|
53
67
|
if (!enabled) return;
|
|
54
68
|
window.addEventListener("resize", calculatePosition);
|
|
55
69
|
window.addEventListener("scroll", calculatePosition, true);
|
|
@@ -63,9 +77,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
63
77
|
var useAutoPosition_default = useAutoPosition;
|
|
64
78
|
|
|
65
79
|
// src/tokens/hooks/useClickOutside.ts
|
|
66
|
-
import
|
|
80
|
+
import React3 from "react";
|
|
67
81
|
var useClickOutside = (refs, handler, enabled = true) => {
|
|
68
|
-
|
|
82
|
+
React3.useEffect(() => {
|
|
69
83
|
if (!enabled) return;
|
|
70
84
|
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
71
85
|
const listener = (event) => {
|
|
@@ -87,20 +101,6 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
87
101
|
};
|
|
88
102
|
var useClickOutside_default = useClickOutside;
|
|
89
103
|
|
|
90
|
-
// src/tokens/hooks/Portal.tsx
|
|
91
|
-
import React3 from "react";
|
|
92
|
-
import ReactDOM from "react-dom";
|
|
93
|
-
import { jsx } from "react/jsx-runtime";
|
|
94
|
-
var PortalContainerContext = React3.createContext(null);
|
|
95
|
-
var Portal = ({ children }) => {
|
|
96
|
-
const contextContainer = React3.useContext(PortalContainerContext);
|
|
97
|
-
if (typeof document === "undefined") return null;
|
|
98
|
-
const container = contextContainer ?? document.body;
|
|
99
|
-
return ReactDOM.createPortal(children, container);
|
|
100
|
-
};
|
|
101
|
-
Portal.displayName = "Portal";
|
|
102
|
-
var Portal_default = Portal;
|
|
103
|
-
|
|
104
104
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
105
105
|
function r(e) {
|
|
106
106
|
var t, f, n = "";
|
|
@@ -37,14 +37,28 @@ module.exports = __toCommonJS(PopOver_exports);
|
|
|
37
37
|
// src/components/PopOver/PopOver.tsx
|
|
38
38
|
var import_react4 = __toESM(require("react"), 1);
|
|
39
39
|
|
|
40
|
-
// src/tokens/hooks/
|
|
40
|
+
// src/tokens/hooks/Portal.tsx
|
|
41
41
|
var import_react = __toESM(require("react"), 1);
|
|
42
|
+
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
+
var PortalContainerContext = import_react.default.createContext(null);
|
|
45
|
+
var Portal = ({ children }) => {
|
|
46
|
+
const contextContainer = import_react.default.useContext(PortalContainerContext);
|
|
47
|
+
if (typeof document === "undefined") return null;
|
|
48
|
+
const container = contextContainer ?? document.body;
|
|
49
|
+
return import_react_dom.default.createPortal(children, container);
|
|
50
|
+
};
|
|
51
|
+
Portal.displayName = "Portal";
|
|
52
|
+
var Portal_default = Portal;
|
|
53
|
+
|
|
54
|
+
// src/tokens/hooks/useAutoPosition.ts
|
|
55
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
42
56
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
43
|
-
const [position, setPosition] =
|
|
57
|
+
const [position, setPosition] = import_react2.default.useState({
|
|
44
58
|
position: {},
|
|
45
59
|
direction: "bottom"
|
|
46
60
|
});
|
|
47
|
-
const calculatePosition =
|
|
61
|
+
const calculatePosition = import_react2.default.useCallback(() => {
|
|
48
62
|
if (!triggerRef.current || !popRef.current) return;
|
|
49
63
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
50
64
|
const popW = popRef.current.offsetWidth;
|
|
@@ -71,13 +85,13 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
71
85
|
direction
|
|
72
86
|
});
|
|
73
87
|
}, [triggerRef, popRef]);
|
|
74
|
-
|
|
88
|
+
import_react2.default.useLayoutEffect(() => {
|
|
75
89
|
if (!enabled) return;
|
|
76
90
|
calculatePosition();
|
|
77
91
|
const raf = requestAnimationFrame(calculatePosition);
|
|
78
92
|
return () => cancelAnimationFrame(raf);
|
|
79
93
|
}, [calculatePosition, enabled]);
|
|
80
|
-
|
|
94
|
+
import_react2.default.useEffect(() => {
|
|
81
95
|
if (!enabled || !popRef.current) return;
|
|
82
96
|
const observer = new ResizeObserver(() => {
|
|
83
97
|
calculatePosition();
|
|
@@ -85,7 +99,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
85
99
|
observer.observe(popRef.current);
|
|
86
100
|
return () => observer.disconnect();
|
|
87
101
|
}, [calculatePosition, enabled, popRef]);
|
|
88
|
-
|
|
102
|
+
import_react2.default.useEffect(() => {
|
|
89
103
|
if (!enabled) return;
|
|
90
104
|
window.addEventListener("resize", calculatePosition);
|
|
91
105
|
window.addEventListener("scroll", calculatePosition, true);
|
|
@@ -99,9 +113,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
99
113
|
var useAutoPosition_default = useAutoPosition;
|
|
100
114
|
|
|
101
115
|
// src/tokens/hooks/useClickOutside.ts
|
|
102
|
-
var
|
|
116
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
103
117
|
var useClickOutside = (refs, handler, enabled = true) => {
|
|
104
|
-
|
|
118
|
+
import_react3.default.useEffect(() => {
|
|
105
119
|
if (!enabled) return;
|
|
106
120
|
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
107
121
|
const listener = (event) => {
|
|
@@ -123,20 +137,6 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
123
137
|
};
|
|
124
138
|
var useClickOutside_default = useClickOutside;
|
|
125
139
|
|
|
126
|
-
// src/tokens/hooks/Portal.tsx
|
|
127
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
128
|
-
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
129
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
130
|
-
var PortalContainerContext = import_react3.default.createContext(null);
|
|
131
|
-
var Portal = ({ children }) => {
|
|
132
|
-
const contextContainer = import_react3.default.useContext(PortalContainerContext);
|
|
133
|
-
if (typeof document === "undefined") return null;
|
|
134
|
-
const container = contextContainer ?? document.body;
|
|
135
|
-
return import_react_dom.default.createPortal(children, container);
|
|
136
|
-
};
|
|
137
|
-
Portal.displayName = "Portal";
|
|
138
|
-
var Portal_default = Portal;
|
|
139
|
-
|
|
140
140
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
141
141
|
function r(e) {
|
|
142
142
|
var t, f, n = "";
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
// src/components/PopOver/PopOver.tsx
|
|
2
2
|
import React4 from "react";
|
|
3
3
|
|
|
4
|
-
// src/tokens/hooks/
|
|
4
|
+
// src/tokens/hooks/Portal.tsx
|
|
5
5
|
import React from "react";
|
|
6
|
+
import ReactDOM from "react-dom";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var PortalContainerContext = React.createContext(null);
|
|
9
|
+
var Portal = ({ children }) => {
|
|
10
|
+
const contextContainer = React.useContext(PortalContainerContext);
|
|
11
|
+
if (typeof document === "undefined") return null;
|
|
12
|
+
const container = contextContainer ?? document.body;
|
|
13
|
+
return ReactDOM.createPortal(children, container);
|
|
14
|
+
};
|
|
15
|
+
Portal.displayName = "Portal";
|
|
16
|
+
var Portal_default = Portal;
|
|
17
|
+
|
|
18
|
+
// src/tokens/hooks/useAutoPosition.ts
|
|
19
|
+
import React2 from "react";
|
|
6
20
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
7
|
-
const [position, setPosition] =
|
|
21
|
+
const [position, setPosition] = React2.useState({
|
|
8
22
|
position: {},
|
|
9
23
|
direction: "bottom"
|
|
10
24
|
});
|
|
11
|
-
const calculatePosition =
|
|
25
|
+
const calculatePosition = React2.useCallback(() => {
|
|
12
26
|
if (!triggerRef.current || !popRef.current) return;
|
|
13
27
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
14
28
|
const popW = popRef.current.offsetWidth;
|
|
@@ -35,13 +49,13 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
35
49
|
direction
|
|
36
50
|
});
|
|
37
51
|
}, [triggerRef, popRef]);
|
|
38
|
-
|
|
52
|
+
React2.useLayoutEffect(() => {
|
|
39
53
|
if (!enabled) return;
|
|
40
54
|
calculatePosition();
|
|
41
55
|
const raf = requestAnimationFrame(calculatePosition);
|
|
42
56
|
return () => cancelAnimationFrame(raf);
|
|
43
57
|
}, [calculatePosition, enabled]);
|
|
44
|
-
|
|
58
|
+
React2.useEffect(() => {
|
|
45
59
|
if (!enabled || !popRef.current) return;
|
|
46
60
|
const observer = new ResizeObserver(() => {
|
|
47
61
|
calculatePosition();
|
|
@@ -49,7 +63,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
49
63
|
observer.observe(popRef.current);
|
|
50
64
|
return () => observer.disconnect();
|
|
51
65
|
}, [calculatePosition, enabled, popRef]);
|
|
52
|
-
|
|
66
|
+
React2.useEffect(() => {
|
|
53
67
|
if (!enabled) return;
|
|
54
68
|
window.addEventListener("resize", calculatePosition);
|
|
55
69
|
window.addEventListener("scroll", calculatePosition, true);
|
|
@@ -63,9 +77,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
63
77
|
var useAutoPosition_default = useAutoPosition;
|
|
64
78
|
|
|
65
79
|
// src/tokens/hooks/useClickOutside.ts
|
|
66
|
-
import
|
|
80
|
+
import React3 from "react";
|
|
67
81
|
var useClickOutside = (refs, handler, enabled = true) => {
|
|
68
|
-
|
|
82
|
+
React3.useEffect(() => {
|
|
69
83
|
if (!enabled) return;
|
|
70
84
|
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
71
85
|
const listener = (event) => {
|
|
@@ -87,20 +101,6 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
87
101
|
};
|
|
88
102
|
var useClickOutside_default = useClickOutside;
|
|
89
103
|
|
|
90
|
-
// src/tokens/hooks/Portal.tsx
|
|
91
|
-
import React3 from "react";
|
|
92
|
-
import ReactDOM from "react-dom";
|
|
93
|
-
import { jsx } from "react/jsx-runtime";
|
|
94
|
-
var PortalContainerContext = React3.createContext(null);
|
|
95
|
-
var Portal = ({ children }) => {
|
|
96
|
-
const contextContainer = React3.useContext(PortalContainerContext);
|
|
97
|
-
if (typeof document === "undefined") return null;
|
|
98
|
-
const container = contextContainer ?? document.body;
|
|
99
|
-
return ReactDOM.createPortal(children, container);
|
|
100
|
-
};
|
|
101
|
-
Portal.displayName = "Portal";
|
|
102
|
-
var Portal_default = Portal;
|
|
103
|
-
|
|
104
104
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
105
105
|
function r(e) {
|
|
106
106
|
var t, f, n = "";
|
|
@@ -38,14 +38,28 @@ module.exports = __toCommonJS(Select_exports);
|
|
|
38
38
|
// src/components/Select/Select.tsx
|
|
39
39
|
var import_react6 = __toESM(require("react"), 1);
|
|
40
40
|
|
|
41
|
-
// src/tokens/hooks/
|
|
41
|
+
// src/tokens/hooks/Portal.tsx
|
|
42
42
|
var import_react = __toESM(require("react"), 1);
|
|
43
|
+
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
44
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
+
var PortalContainerContext = import_react.default.createContext(null);
|
|
46
|
+
var Portal = ({ children }) => {
|
|
47
|
+
const contextContainer = import_react.default.useContext(PortalContainerContext);
|
|
48
|
+
if (typeof document === "undefined") return null;
|
|
49
|
+
const container = contextContainer ?? document.body;
|
|
50
|
+
return import_react_dom.default.createPortal(children, container);
|
|
51
|
+
};
|
|
52
|
+
Portal.displayName = "Portal";
|
|
53
|
+
var Portal_default = Portal;
|
|
54
|
+
|
|
55
|
+
// src/tokens/hooks/useAutoPosition.ts
|
|
56
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
43
57
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
44
|
-
const [position, setPosition] =
|
|
58
|
+
const [position, setPosition] = import_react2.default.useState({
|
|
45
59
|
position: {},
|
|
46
60
|
direction: "bottom"
|
|
47
61
|
});
|
|
48
|
-
const calculatePosition =
|
|
62
|
+
const calculatePosition = import_react2.default.useCallback(() => {
|
|
49
63
|
if (!triggerRef.current || !popRef.current) return;
|
|
50
64
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
51
65
|
const popW = popRef.current.offsetWidth;
|
|
@@ -72,13 +86,13 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
72
86
|
direction
|
|
73
87
|
});
|
|
74
88
|
}, [triggerRef, popRef]);
|
|
75
|
-
|
|
89
|
+
import_react2.default.useLayoutEffect(() => {
|
|
76
90
|
if (!enabled) return;
|
|
77
91
|
calculatePosition();
|
|
78
92
|
const raf = requestAnimationFrame(calculatePosition);
|
|
79
93
|
return () => cancelAnimationFrame(raf);
|
|
80
94
|
}, [calculatePosition, enabled]);
|
|
81
|
-
|
|
95
|
+
import_react2.default.useEffect(() => {
|
|
82
96
|
if (!enabled || !popRef.current) return;
|
|
83
97
|
const observer = new ResizeObserver(() => {
|
|
84
98
|
calculatePosition();
|
|
@@ -86,7 +100,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
86
100
|
observer.observe(popRef.current);
|
|
87
101
|
return () => observer.disconnect();
|
|
88
102
|
}, [calculatePosition, enabled, popRef]);
|
|
89
|
-
|
|
103
|
+
import_react2.default.useEffect(() => {
|
|
90
104
|
if (!enabled) return;
|
|
91
105
|
window.addEventListener("resize", calculatePosition);
|
|
92
106
|
window.addEventListener("scroll", calculatePosition, true);
|
|
@@ -100,9 +114,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
100
114
|
var useAutoPosition_default = useAutoPosition;
|
|
101
115
|
|
|
102
116
|
// src/tokens/hooks/useClickOutside.ts
|
|
103
|
-
var
|
|
117
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
104
118
|
var useClickOutside = (refs, handler, enabled = true) => {
|
|
105
|
-
|
|
119
|
+
import_react3.default.useEffect(() => {
|
|
106
120
|
if (!enabled) return;
|
|
107
121
|
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
108
122
|
const listener = (event) => {
|
|
@@ -124,20 +138,6 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
124
138
|
};
|
|
125
139
|
var useClickOutside_default = useClickOutside;
|
|
126
140
|
|
|
127
|
-
// src/tokens/hooks/Portal.tsx
|
|
128
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
129
|
-
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
130
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
131
|
-
var PortalContainerContext = import_react3.default.createContext(null);
|
|
132
|
-
var Portal = ({ children }) => {
|
|
133
|
-
const contextContainer = import_react3.default.useContext(PortalContainerContext);
|
|
134
|
-
if (typeof document === "undefined") return null;
|
|
135
|
-
const container = contextContainer ?? document.body;
|
|
136
|
-
return import_react_dom.default.createPortal(children, container);
|
|
137
|
-
};
|
|
138
|
-
Portal.displayName = "Portal";
|
|
139
|
-
var Portal_default = Portal;
|
|
140
|
-
|
|
141
141
|
// src/tokens/svg/action/CopyIcon.tsx
|
|
142
142
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
143
143
|
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
// src/components/Select/Select.tsx
|
|
2
2
|
import React6 from "react";
|
|
3
3
|
|
|
4
|
-
// src/tokens/hooks/
|
|
4
|
+
// src/tokens/hooks/Portal.tsx
|
|
5
5
|
import React from "react";
|
|
6
|
+
import ReactDOM from "react-dom";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var PortalContainerContext = React.createContext(null);
|
|
9
|
+
var Portal = ({ children }) => {
|
|
10
|
+
const contextContainer = React.useContext(PortalContainerContext);
|
|
11
|
+
if (typeof document === "undefined") return null;
|
|
12
|
+
const container = contextContainer ?? document.body;
|
|
13
|
+
return ReactDOM.createPortal(children, container);
|
|
14
|
+
};
|
|
15
|
+
Portal.displayName = "Portal";
|
|
16
|
+
var Portal_default = Portal;
|
|
17
|
+
|
|
18
|
+
// src/tokens/hooks/useAutoPosition.ts
|
|
19
|
+
import React2 from "react";
|
|
6
20
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
7
|
-
const [position, setPosition] =
|
|
21
|
+
const [position, setPosition] = React2.useState({
|
|
8
22
|
position: {},
|
|
9
23
|
direction: "bottom"
|
|
10
24
|
});
|
|
11
|
-
const calculatePosition =
|
|
25
|
+
const calculatePosition = React2.useCallback(() => {
|
|
12
26
|
if (!triggerRef.current || !popRef.current) return;
|
|
13
27
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
14
28
|
const popW = popRef.current.offsetWidth;
|
|
@@ -35,13 +49,13 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
35
49
|
direction
|
|
36
50
|
});
|
|
37
51
|
}, [triggerRef, popRef]);
|
|
38
|
-
|
|
52
|
+
React2.useLayoutEffect(() => {
|
|
39
53
|
if (!enabled) return;
|
|
40
54
|
calculatePosition();
|
|
41
55
|
const raf = requestAnimationFrame(calculatePosition);
|
|
42
56
|
return () => cancelAnimationFrame(raf);
|
|
43
57
|
}, [calculatePosition, enabled]);
|
|
44
|
-
|
|
58
|
+
React2.useEffect(() => {
|
|
45
59
|
if (!enabled || !popRef.current) return;
|
|
46
60
|
const observer = new ResizeObserver(() => {
|
|
47
61
|
calculatePosition();
|
|
@@ -49,7 +63,7 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
49
63
|
observer.observe(popRef.current);
|
|
50
64
|
return () => observer.disconnect();
|
|
51
65
|
}, [calculatePosition, enabled, popRef]);
|
|
52
|
-
|
|
66
|
+
React2.useEffect(() => {
|
|
53
67
|
if (!enabled) return;
|
|
54
68
|
window.addEventListener("resize", calculatePosition);
|
|
55
69
|
window.addEventListener("scroll", calculatePosition, true);
|
|
@@ -63,9 +77,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
63
77
|
var useAutoPosition_default = useAutoPosition;
|
|
64
78
|
|
|
65
79
|
// src/tokens/hooks/useClickOutside.ts
|
|
66
|
-
import
|
|
80
|
+
import React3 from "react";
|
|
67
81
|
var useClickOutside = (refs, handler, enabled = true) => {
|
|
68
|
-
|
|
82
|
+
React3.useEffect(() => {
|
|
69
83
|
if (!enabled) return;
|
|
70
84
|
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
71
85
|
const listener = (event) => {
|
|
@@ -87,20 +101,6 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
87
101
|
};
|
|
88
102
|
var useClickOutside_default = useClickOutside;
|
|
89
103
|
|
|
90
|
-
// src/tokens/hooks/Portal.tsx
|
|
91
|
-
import React3 from "react";
|
|
92
|
-
import ReactDOM from "react-dom";
|
|
93
|
-
import { jsx } from "react/jsx-runtime";
|
|
94
|
-
var PortalContainerContext = React3.createContext(null);
|
|
95
|
-
var Portal = ({ children }) => {
|
|
96
|
-
const contextContainer = React3.useContext(PortalContainerContext);
|
|
97
|
-
if (typeof document === "undefined") return null;
|
|
98
|
-
const container = contextContainer ?? document.body;
|
|
99
|
-
return ReactDOM.createPortal(children, container);
|
|
100
|
-
};
|
|
101
|
-
Portal.displayName = "Portal";
|
|
102
|
-
var Portal_default = Portal;
|
|
103
|
-
|
|
104
104
|
// src/tokens/svg/action/CopyIcon.tsx
|
|
105
105
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
106
106
|
|