@x-plat/design-system 0.5.11 → 0.5.12

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.
@@ -35,7 +35,7 @@ __export(Dropdown_exports, {
35
35
  module.exports = __toCommonJS(Dropdown_exports);
36
36
 
37
37
  // src/components/Dropdown/Dropdown.tsx
38
- var import_react3 = __toESM(require("react"), 1);
38
+ var import_react4 = __toESM(require("react"), 1);
39
39
 
40
40
  // src/tokens/hooks/useAutoPosition.ts
41
41
  var import_react = __toESM(require("react"), 1);
@@ -70,10 +70,13 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
70
70
  }, [triggerRef, popRef]);
71
71
  import_react.default.useEffect(() => {
72
72
  if (!enabled) return;
73
- calculatePosition();
73
+ const raf = requestAnimationFrame(() => {
74
+ calculatePosition();
75
+ });
74
76
  window.addEventListener("resize", calculatePosition);
75
77
  window.addEventListener("scroll", calculatePosition, true);
76
78
  return () => {
79
+ cancelAnimationFrame(raf);
77
80
  window.removeEventListener("resize", calculatePosition);
78
81
  window.removeEventListener("scroll", calculatePosition, true);
79
82
  };
@@ -107,6 +110,24 @@ var useClickOutside = (refs, handler, enabled = true) => {
107
110
  };
108
111
  var useClickOutside_default = useClickOutside;
109
112
 
113
+ // src/tokens/hooks/Portal.tsx
114
+ var import_react3 = __toESM(require("react"), 1);
115
+ var import_react_dom = __toESM(require("react-dom"), 1);
116
+ var import_jsx_runtime = require("react/jsx-runtime");
117
+ var PortalContainerContext = import_react3.default.createContext(null);
118
+ var Portal = ({ children }) => {
119
+ const contextContainer = import_react3.default.useContext(PortalContainerContext);
120
+ const [fallback, setFallback] = import_react3.default.useState(null);
121
+ import_react3.default.useEffect(() => {
122
+ if (!contextContainer) setFallback(document.body);
123
+ }, [contextContainer]);
124
+ const container = contextContainer ?? fallback;
125
+ if (!container) return null;
126
+ return import_react_dom.default.createPortal(children, container);
127
+ };
128
+ Portal.displayName = "Portal";
129
+ var Portal_default = Portal;
130
+
110
131
  // ../../node_modules/clsx/dist/clsx.mjs
111
132
  function r(e) {
112
133
  var t, f, n = "";
@@ -124,17 +145,17 @@ function clsx() {
124
145
  var clsx_default = clsx;
125
146
 
126
147
  // src/components/Dropdown/Dropdown.tsx
127
- var import_jsx_runtime = require("react/jsx-runtime");
148
+ var import_jsx_runtime2 = require("react/jsx-runtime");
128
149
  var Dropdown = (props) => {
129
150
  const { items, children } = props;
130
- const [isOpen, setIsOpen] = import_react3.default.useState(false);
131
- const [mounted, setMounted] = import_react3.default.useState(false);
132
- const [visible, setVisible] = import_react3.default.useState(false);
133
- const triggerRef = import_react3.default.useRef(null);
134
- const menuRef = import_react3.default.useRef(null);
135
- const { position, direction } = useAutoPosition_default(triggerRef, menuRef, isOpen);
136
- useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false));
137
- import_react3.default.useEffect(() => {
151
+ const [isOpen, setIsOpen] = import_react4.default.useState(false);
152
+ const [mounted, setMounted] = import_react4.default.useState(false);
153
+ const [visible, setVisible] = import_react4.default.useState(false);
154
+ const triggerRef = import_react4.default.useRef(null);
155
+ const menuRef = import_react4.default.useRef(null);
156
+ const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
157
+ useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
158
+ import_react4.default.useEffect(() => {
138
159
  if (isOpen) {
139
160
  setMounted(true);
140
161
  const t2 = setTimeout(() => setVisible(true), 1);
@@ -149,8 +170,8 @@ var Dropdown = (props) => {
149
170
  item.onClick?.();
150
171
  setIsOpen(false);
151
172
  };
152
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "lib-xplat-dropdown", children: [
153
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
173
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "lib-xplat-dropdown", children: [
174
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
154
175
  "div",
155
176
  {
156
177
  ref: triggerRef,
@@ -159,14 +180,14 @@ var Dropdown = (props) => {
159
180
  children
160
181
  }
161
182
  ),
162
- mounted && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
183
+ mounted && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
163
184
  "div",
164
185
  {
165
186
  ref: menuRef,
166
- className: clsx_default("dropdown-menu", direction, { visible }),
187
+ className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
167
188
  style: { top: position.top, left: position.left },
168
189
  role: "menu",
169
- children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
190
+ children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
170
191
  "button",
171
192
  {
172
193
  className: clsx_default("dropdown-item", {
@@ -181,7 +202,7 @@ var Dropdown = (props) => {
181
202
  item.key
182
203
  ))
183
204
  }
184
- )
205
+ ) })
185
206
  ] });
186
207
  };
187
208
  Dropdown.displayName = "Dropdown";
@@ -7,9 +7,9 @@
7
7
  .lib-xplat-dropdown .dropdown-trigger {
8
8
  cursor: pointer;
9
9
  }
10
- .lib-xplat-dropdown .dropdown-menu {
10
+ .lib-xplat-dropdown-menu {
11
11
  position: fixed;
12
- z-index: 100;
12
+ z-index: 1000;
13
13
  min-width: 160px;
14
14
  background: var(--semantic-surface-neutral-default);
15
15
  border: 1px solid var(--semantic-border-default);
@@ -20,14 +20,14 @@
20
20
  transform: translateY(-4px);
21
21
  transition: opacity 0.15s ease, transform 0.15s ease;
22
22
  }
23
- .lib-xplat-dropdown .dropdown-menu.bottom {
23
+ .lib-xplat-dropdown-menu.bottom {
24
24
  transform: translateY(4px);
25
25
  }
26
- .lib-xplat-dropdown .dropdown-menu.visible {
26
+ .lib-xplat-dropdown-menu.visible {
27
27
  opacity: 1;
28
28
  transform: translateY(0);
29
29
  }
30
- .lib-xplat-dropdown .dropdown-item {
30
+ .lib-xplat-dropdown-menu .dropdown-item {
31
31
  display: flex;
32
32
  align-items: center;
33
33
  width: 100%;
@@ -40,16 +40,16 @@
40
40
  text-align: left;
41
41
  transition: background-color 0.15s;
42
42
  }
43
- .lib-xplat-dropdown .dropdown-item:hover:not(:disabled) {
43
+ .lib-xplat-dropdown-menu .dropdown-item:hover:not(:disabled) {
44
44
  background-color: var(--semantic-surface-neutral-subtle);
45
45
  }
46
- .lib-xplat-dropdown .dropdown-item.danger {
46
+ .lib-xplat-dropdown-menu .dropdown-item.danger {
47
47
  color: var(--semantic-text-error);
48
48
  }
49
- .lib-xplat-dropdown .dropdown-item.danger:hover:not(:disabled) {
49
+ .lib-xplat-dropdown-menu .dropdown-item.danger:hover:not(:disabled) {
50
50
  background-color: var(--semantic-surface-error-subtle);
51
51
  }
52
- .lib-xplat-dropdown .dropdown-item:disabled {
52
+ .lib-xplat-dropdown-menu .dropdown-item:disabled {
53
53
  color: var(--semantic-text-disabled);
54
54
  cursor: not-allowed;
55
55
  }
@@ -1,5 +1,5 @@
1
1
  // src/components/Dropdown/Dropdown.tsx
2
- import React3 from "react";
2
+ import React4 from "react";
3
3
 
4
4
  // src/tokens/hooks/useAutoPosition.ts
5
5
  import React from "react";
@@ -34,10 +34,13 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
34
34
  }, [triggerRef, popRef]);
35
35
  React.useEffect(() => {
36
36
  if (!enabled) return;
37
- calculatePosition();
37
+ const raf = requestAnimationFrame(() => {
38
+ calculatePosition();
39
+ });
38
40
  window.addEventListener("resize", calculatePosition);
39
41
  window.addEventListener("scroll", calculatePosition, true);
40
42
  return () => {
43
+ cancelAnimationFrame(raf);
41
44
  window.removeEventListener("resize", calculatePosition);
42
45
  window.removeEventListener("scroll", calculatePosition, true);
43
46
  };
@@ -71,6 +74,24 @@ var useClickOutside = (refs, handler, enabled = true) => {
71
74
  };
72
75
  var useClickOutside_default = useClickOutside;
73
76
 
77
+ // src/tokens/hooks/Portal.tsx
78
+ import React3 from "react";
79
+ import ReactDOM from "react-dom";
80
+ import { jsx } from "react/jsx-runtime";
81
+ var PortalContainerContext = React3.createContext(null);
82
+ var Portal = ({ children }) => {
83
+ const contextContainer = React3.useContext(PortalContainerContext);
84
+ const [fallback, setFallback] = React3.useState(null);
85
+ React3.useEffect(() => {
86
+ if (!contextContainer) setFallback(document.body);
87
+ }, [contextContainer]);
88
+ const container = contextContainer ?? fallback;
89
+ if (!container) return null;
90
+ return ReactDOM.createPortal(children, container);
91
+ };
92
+ Portal.displayName = "Portal";
93
+ var Portal_default = Portal;
94
+
74
95
  // ../../node_modules/clsx/dist/clsx.mjs
75
96
  function r(e) {
76
97
  var t, f, n = "";
@@ -88,17 +109,17 @@ function clsx() {
88
109
  var clsx_default = clsx;
89
110
 
90
111
  // src/components/Dropdown/Dropdown.tsx
91
- import { jsx, jsxs } from "react/jsx-runtime";
112
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
92
113
  var Dropdown = (props) => {
93
114
  const { items, children } = props;
94
- const [isOpen, setIsOpen] = React3.useState(false);
95
- const [mounted, setMounted] = React3.useState(false);
96
- const [visible, setVisible] = React3.useState(false);
97
- const triggerRef = React3.useRef(null);
98
- const menuRef = React3.useRef(null);
99
- const { position, direction } = useAutoPosition_default(triggerRef, menuRef, isOpen);
100
- useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false));
101
- React3.useEffect(() => {
115
+ const [isOpen, setIsOpen] = React4.useState(false);
116
+ const [mounted, setMounted] = React4.useState(false);
117
+ const [visible, setVisible] = React4.useState(false);
118
+ const triggerRef = React4.useRef(null);
119
+ const menuRef = React4.useRef(null);
120
+ const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
121
+ useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
122
+ React4.useEffect(() => {
102
123
  if (isOpen) {
103
124
  setMounted(true);
104
125
  const t2 = setTimeout(() => setVisible(true), 1);
@@ -114,7 +135,7 @@ var Dropdown = (props) => {
114
135
  setIsOpen(false);
115
136
  };
116
137
  return /* @__PURE__ */ jsxs("div", { className: "lib-xplat-dropdown", children: [
117
- /* @__PURE__ */ jsx(
138
+ /* @__PURE__ */ jsx2(
118
139
  "div",
119
140
  {
120
141
  ref: triggerRef,
@@ -123,14 +144,14 @@ var Dropdown = (props) => {
123
144
  children
124
145
  }
125
146
  ),
126
- mounted && /* @__PURE__ */ jsx(
147
+ mounted && /* @__PURE__ */ jsx2(Portal_default, { children: /* @__PURE__ */ jsx2(
127
148
  "div",
128
149
  {
129
150
  ref: menuRef,
130
- className: clsx_default("dropdown-menu", direction, { visible }),
151
+ className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
131
152
  style: { top: position.top, left: position.left },
132
153
  role: "menu",
133
- children: items.map((item) => /* @__PURE__ */ jsx(
154
+ children: items.map((item) => /* @__PURE__ */ jsx2(
134
155
  "button",
135
156
  {
136
157
  className: clsx_default("dropdown-item", {
@@ -145,7 +166,7 @@ var Dropdown = (props) => {
145
166
  item.key
146
167
  ))
147
168
  }
148
- )
169
+ ) })
149
170
  ] });
150
171
  };
151
172
  Dropdown.displayName = "Dropdown";
@@ -35,8 +35,26 @@ __export(Modal_exports, {
35
35
  module.exports = __toCommonJS(Modal_exports);
36
36
 
37
37
  // src/components/Modal/Modal.tsx
38
+ var import_react2 = __toESM(require("react"), 1);
39
+ var import_react_dom2 = require("react-dom");
40
+
41
+ // src/tokens/hooks/Portal.tsx
38
42
  var import_react = __toESM(require("react"), 1);
39
- var import_react_dom = require("react-dom");
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 PortalProvider = ({ container, children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalContainerContext.Provider, { value: container, children });
47
+ var Portal = ({ children }) => {
48
+ const contextContainer = import_react.default.useContext(PortalContainerContext);
49
+ const [fallback, setFallback] = import_react.default.useState(null);
50
+ import_react.default.useEffect(() => {
51
+ if (!contextContainer) setFallback(document.body);
52
+ }, [contextContainer]);
53
+ const container = contextContainer ?? fallback;
54
+ if (!container) return null;
55
+ return import_react_dom.default.createPortal(children, container);
56
+ };
57
+ Portal.displayName = "Portal";
40
58
 
41
59
  // ../../node_modules/clsx/dist/clsx.mjs
42
60
  function r(e) {
@@ -55,13 +73,14 @@ function clsx() {
55
73
  var clsx_default = clsx;
56
74
 
57
75
  // src/components/Modal/Modal.tsx
58
- var import_jsx_runtime = require("react/jsx-runtime");
76
+ var import_jsx_runtime2 = require("react/jsx-runtime");
59
77
  var ANIMATION_DURATION_MS = 200;
60
78
  var Modal = (props) => {
61
79
  const { isOpen, onClose, children } = props;
62
- const [mounted, setMounted] = import_react.default.useState(false);
63
- const [visible, setVisible] = import_react.default.useState(false);
64
- import_react.default.useEffect(() => {
80
+ const [mounted, setMounted] = import_react2.default.useState(false);
81
+ const [visible, setVisible] = import_react2.default.useState(false);
82
+ const boxRef = import_react2.default.useRef(null);
83
+ import_react2.default.useEffect(() => {
65
84
  if (isOpen) {
66
85
  setMounted(true);
67
86
  const t2 = setTimeout(() => setVisible(true), 1);
@@ -74,20 +93,21 @@ var Modal = (props) => {
74
93
  if (typeof document === "undefined") return null;
75
94
  if (!mounted) return null;
76
95
  const stateClass = visible ? "enter" : "exit";
77
- return (0, import_react_dom.createPortal)(
78
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
96
+ return (0, import_react_dom2.createPortal)(
97
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
79
98
  "div",
80
99
  {
81
100
  className: clsx_default("lib-xplat-modal", "dim", stateClass),
82
101
  onClick: onClose,
83
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
102
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
84
103
  "div",
85
104
  {
105
+ ref: boxRef,
86
106
  className: clsx_default("lib-xplat-modal", "modal-box", stateClass),
87
107
  role: "dialog",
88
108
  "aria-modal": "true",
89
109
  onClick: (e) => e.stopPropagation(),
90
- children
110
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PortalProvider, { container: boxRef.current, children })
91
111
  }
92
112
  )
93
113
  }
@@ -2,9 +2,6 @@ import React from 'react';
2
2
 
3
3
  interface ModalProps {
4
4
  isOpen: boolean;
5
- /**
6
- * open 값 false 로 변경 필수
7
- */
8
5
  onClose: () => void;
9
6
  children?: React.ReactNode;
10
7
  }
@@ -2,9 +2,6 @@ import React from 'react';
2
2
 
3
3
  interface ModalProps {
4
4
  isOpen: boolean;
5
- /**
6
- * open 값 false 로 변경 필수
7
- */
8
5
  onClose: () => void;
9
6
  children?: React.ReactNode;
10
7
  }
@@ -1,7 +1,25 @@
1
1
  // src/components/Modal/Modal.tsx
2
- import React from "react";
2
+ import React2 from "react";
3
3
  import { createPortal } from "react-dom";
4
4
 
5
+ // src/tokens/hooks/Portal.tsx
6
+ import React from "react";
7
+ import ReactDOM from "react-dom";
8
+ import { jsx } from "react/jsx-runtime";
9
+ var PortalContainerContext = React.createContext(null);
10
+ var PortalProvider = ({ container, children }) => /* @__PURE__ */ jsx(PortalContainerContext.Provider, { value: container, children });
11
+ var Portal = ({ children }) => {
12
+ const contextContainer = React.useContext(PortalContainerContext);
13
+ const [fallback, setFallback] = React.useState(null);
14
+ React.useEffect(() => {
15
+ if (!contextContainer) setFallback(document.body);
16
+ }, [contextContainer]);
17
+ const container = contextContainer ?? fallback;
18
+ if (!container) return null;
19
+ return ReactDOM.createPortal(children, container);
20
+ };
21
+ Portal.displayName = "Portal";
22
+
5
23
  // ../../node_modules/clsx/dist/clsx.mjs
6
24
  function r(e) {
7
25
  var t, f, n = "";
@@ -19,13 +37,14 @@ function clsx() {
19
37
  var clsx_default = clsx;
20
38
 
21
39
  // src/components/Modal/Modal.tsx
22
- import { jsx } from "react/jsx-runtime";
40
+ import { jsx as jsx2 } from "react/jsx-runtime";
23
41
  var ANIMATION_DURATION_MS = 200;
24
42
  var Modal = (props) => {
25
43
  const { isOpen, onClose, children } = props;
26
- const [mounted, setMounted] = React.useState(false);
27
- const [visible, setVisible] = React.useState(false);
28
- React.useEffect(() => {
44
+ const [mounted, setMounted] = React2.useState(false);
45
+ const [visible, setVisible] = React2.useState(false);
46
+ const boxRef = React2.useRef(null);
47
+ React2.useEffect(() => {
29
48
  if (isOpen) {
30
49
  setMounted(true);
31
50
  const t2 = setTimeout(() => setVisible(true), 1);
@@ -39,19 +58,20 @@ var Modal = (props) => {
39
58
  if (!mounted) return null;
40
59
  const stateClass = visible ? "enter" : "exit";
41
60
  return createPortal(
42
- /* @__PURE__ */ jsx(
61
+ /* @__PURE__ */ jsx2(
43
62
  "div",
44
63
  {
45
64
  className: clsx_default("lib-xplat-modal", "dim", stateClass),
46
65
  onClick: onClose,
47
- children: /* @__PURE__ */ jsx(
66
+ children: /* @__PURE__ */ jsx2(
48
67
  "div",
49
68
  {
69
+ ref: boxRef,
50
70
  className: clsx_default("lib-xplat-modal", "modal-box", stateClass),
51
71
  role: "dialog",
52
72
  "aria-modal": "true",
53
73
  onClick: (e) => e.stopPropagation(),
54
- children
74
+ children: /* @__PURE__ */ jsx2(PortalProvider, { container: boxRef.current, children })
55
75
  }
56
76
  )
57
77
  }
@@ -35,7 +35,7 @@ __export(PopOver_exports, {
35
35
  module.exports = __toCommonJS(PopOver_exports);
36
36
 
37
37
  // src/components/PopOver/PopOver.tsx
38
- var import_react3 = __toESM(require("react"), 1);
38
+ var import_react4 = __toESM(require("react"), 1);
39
39
 
40
40
  // src/tokens/hooks/useAutoPosition.ts
41
41
  var import_react = __toESM(require("react"), 1);
@@ -70,10 +70,13 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
70
70
  }, [triggerRef, popRef]);
71
71
  import_react.default.useEffect(() => {
72
72
  if (!enabled) return;
73
- calculatePosition();
73
+ const raf = requestAnimationFrame(() => {
74
+ calculatePosition();
75
+ });
74
76
  window.addEventListener("resize", calculatePosition);
75
77
  window.addEventListener("scroll", calculatePosition, true);
76
78
  return () => {
79
+ cancelAnimationFrame(raf);
77
80
  window.removeEventListener("resize", calculatePosition);
78
81
  window.removeEventListener("scroll", calculatePosition, true);
79
82
  };
@@ -107,6 +110,24 @@ var useClickOutside = (refs, handler, enabled = true) => {
107
110
  };
108
111
  var useClickOutside_default = useClickOutside;
109
112
 
113
+ // src/tokens/hooks/Portal.tsx
114
+ var import_react3 = __toESM(require("react"), 1);
115
+ var import_react_dom = __toESM(require("react-dom"), 1);
116
+ var import_jsx_runtime = require("react/jsx-runtime");
117
+ var PortalContainerContext = import_react3.default.createContext(null);
118
+ var Portal = ({ children }) => {
119
+ const contextContainer = import_react3.default.useContext(PortalContainerContext);
120
+ const [fallback, setFallback] = import_react3.default.useState(null);
121
+ import_react3.default.useEffect(() => {
122
+ if (!contextContainer) setFallback(document.body);
123
+ }, [contextContainer]);
124
+ const container = contextContainer ?? fallback;
125
+ if (!container) return null;
126
+ return import_react_dom.default.createPortal(children, container);
127
+ };
128
+ Portal.displayName = "Portal";
129
+ var Portal_default = Portal;
130
+
110
131
  // ../../node_modules/clsx/dist/clsx.mjs
111
132
  function r(e) {
112
133
  var t, f, n = "";
@@ -124,16 +145,16 @@ function clsx() {
124
145
  var clsx_default = clsx;
125
146
 
126
147
  // src/components/PopOver/PopOver.tsx
127
- var import_jsx_runtime = require("react/jsx-runtime");
148
+ var import_jsx_runtime2 = require("react/jsx-runtime");
128
149
  var PopOver = (props) => {
129
150
  const { children, isOpen, onClose, PopOverEl } = props;
130
- const popRef = import_react3.default.useRef(null);
131
- const triggerRef = import_react3.default.useRef(null);
132
- const [localOpen, setLocalOpen] = import_react3.default.useState(false);
133
- const [eventTrigger, setEventTrigger] = import_react3.default.useState(false);
151
+ const popRef = import_react4.default.useRef(null);
152
+ const triggerRef = import_react4.default.useRef(null);
153
+ const [localOpen, setLocalOpen] = import_react4.default.useState(false);
154
+ const [eventTrigger, setEventTrigger] = import_react4.default.useState(false);
134
155
  useClickOutside_default([popRef, triggerRef], onClose, isOpen);
135
156
  const position = useAutoPosition_default(triggerRef, popRef, localOpen);
136
- import_react3.default.useEffect(() => {
157
+ import_react4.default.useEffect(() => {
137
158
  if (isOpen) {
138
159
  setLocalOpen(isOpen);
139
160
  setTimeout(() => {
@@ -146,7 +167,7 @@ var PopOver = (props) => {
146
167
  }, 200);
147
168
  }
148
169
  }, [isOpen]);
149
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
170
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
150
171
  "div",
151
172
  {
152
173
  className: "lib-xplat-pop-over",
@@ -156,11 +177,11 @@ var PopOver = (props) => {
156
177
  },
157
178
  children: [
158
179
  children,
159
- localOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
180
+ localOpen && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
160
181
  "div",
161
182
  {
162
183
  className: clsx_default(
163
- "content-wrap",
184
+ "lib-xplat-pop-over-content",
164
185
  position.direction,
165
186
  eventTrigger && "visible"
166
187
  ),
@@ -170,7 +191,7 @@ var PopOver = (props) => {
170
191
  },
171
192
  children: PopOverEl
172
193
  }
173
- )
194
+ ) })
174
195
  ]
175
196
  }
176
197
  );
@@ -1,31 +1,28 @@
1
1
  /* src/components/PopOver/popOver.scss */
2
2
  .lib-xplat-pop-over {
3
3
  position: relative;
4
- z-index: 10;
5
4
  width: fit-content;
6
5
  cursor: pointer;
7
6
  user-select: none;
8
7
  }
9
- .lib-xplat-pop-over > .content-wrap {
8
+ .lib-xplat-pop-over-content {
10
9
  position: fixed;
10
+ z-index: 1000;
11
11
  cursor: default;
12
12
  transition: transform 0.2s ease, opacity 0.2s ease;
13
- background: white;
13
+ background: var(--semantic-surface-neutral-default);
14
14
  border-radius: var(--spacing-radius-md);
15
15
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
16
- z-index: 10;
17
16
  opacity: 0;
18
17
  transform: scale(0.8);
19
18
  }
20
- .lib-xplat-pop-over > .content-wrap.top {
19
+ .lib-xplat-pop-over-content.top {
21
20
  transform-origin: bottom;
22
- margin-bottom: var(--spacing-space-2);
23
21
  }
24
- .lib-xplat-pop-over > .content-wrap.bottom {
22
+ .lib-xplat-pop-over-content.bottom {
25
23
  transform-origin: top;
26
- margin-top: var(--spacing-space-2);
27
24
  }
28
- .lib-xplat-pop-over > .content-wrap.visible {
25
+ .lib-xplat-pop-over-content.visible {
29
26
  opacity: 1;
30
27
  transform: scale(1);
31
28
  }
@@ -1,5 +1,5 @@
1
1
  // src/components/PopOver/PopOver.tsx
2
- import React3 from "react";
2
+ import React4 from "react";
3
3
 
4
4
  // src/tokens/hooks/useAutoPosition.ts
5
5
  import React from "react";
@@ -34,10 +34,13 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
34
34
  }, [triggerRef, popRef]);
35
35
  React.useEffect(() => {
36
36
  if (!enabled) return;
37
- calculatePosition();
37
+ const raf = requestAnimationFrame(() => {
38
+ calculatePosition();
39
+ });
38
40
  window.addEventListener("resize", calculatePosition);
39
41
  window.addEventListener("scroll", calculatePosition, true);
40
42
  return () => {
43
+ cancelAnimationFrame(raf);
41
44
  window.removeEventListener("resize", calculatePosition);
42
45
  window.removeEventListener("scroll", calculatePosition, true);
43
46
  };
@@ -71,6 +74,24 @@ var useClickOutside = (refs, handler, enabled = true) => {
71
74
  };
72
75
  var useClickOutside_default = useClickOutside;
73
76
 
77
+ // src/tokens/hooks/Portal.tsx
78
+ import React3 from "react";
79
+ import ReactDOM from "react-dom";
80
+ import { jsx } from "react/jsx-runtime";
81
+ var PortalContainerContext = React3.createContext(null);
82
+ var Portal = ({ children }) => {
83
+ const contextContainer = React3.useContext(PortalContainerContext);
84
+ const [fallback, setFallback] = React3.useState(null);
85
+ React3.useEffect(() => {
86
+ if (!contextContainer) setFallback(document.body);
87
+ }, [contextContainer]);
88
+ const container = contextContainer ?? fallback;
89
+ if (!container) return null;
90
+ return ReactDOM.createPortal(children, container);
91
+ };
92
+ Portal.displayName = "Portal";
93
+ var Portal_default = Portal;
94
+
74
95
  // ../../node_modules/clsx/dist/clsx.mjs
75
96
  function r(e) {
76
97
  var t, f, n = "";
@@ -88,16 +109,16 @@ function clsx() {
88
109
  var clsx_default = clsx;
89
110
 
90
111
  // src/components/PopOver/PopOver.tsx
91
- import { jsx, jsxs } from "react/jsx-runtime";
112
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
92
113
  var PopOver = (props) => {
93
114
  const { children, isOpen, onClose, PopOverEl } = props;
94
- const popRef = React3.useRef(null);
95
- const triggerRef = React3.useRef(null);
96
- const [localOpen, setLocalOpen] = React3.useState(false);
97
- const [eventTrigger, setEventTrigger] = React3.useState(false);
115
+ const popRef = React4.useRef(null);
116
+ const triggerRef = React4.useRef(null);
117
+ const [localOpen, setLocalOpen] = React4.useState(false);
118
+ const [eventTrigger, setEventTrigger] = React4.useState(false);
98
119
  useClickOutside_default([popRef, triggerRef], onClose, isOpen);
99
120
  const position = useAutoPosition_default(triggerRef, popRef, localOpen);
100
- React3.useEffect(() => {
121
+ React4.useEffect(() => {
101
122
  if (isOpen) {
102
123
  setLocalOpen(isOpen);
103
124
  setTimeout(() => {
@@ -120,11 +141,11 @@ var PopOver = (props) => {
120
141
  },
121
142
  children: [
122
143
  children,
123
- localOpen && /* @__PURE__ */ jsx(
144
+ localOpen && /* @__PURE__ */ jsx2(Portal_default, { children: /* @__PURE__ */ jsx2(
124
145
  "div",
125
146
  {
126
147
  className: clsx_default(
127
- "content-wrap",
148
+ "lib-xplat-pop-over-content",
128
149
  position.direction,
129
150
  eventTrigger && "visible"
130
151
  ),
@@ -134,7 +155,7 @@ var PopOver = (props) => {
134
155
  },
135
156
  children: PopOverEl
136
157
  }
137
- )
158
+ ) })
138
159
  ]
139
160
  }
140
161
  );