@salutejs/plasma-new-hope 0.141.1-dev.0 → 0.141.2-canary.1412.10789995138.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. package/cjs/components/Drawer/Drawer.css +4 -3
  2. package/cjs/components/Drawer/Drawer.js +1 -1
  3. package/cjs/components/Drawer/hooks/useDrawer.js +1 -1
  4. package/cjs/components/Modal/Modal.css +4 -3
  5. package/cjs/components/Modal/hooks/useModal.js +1 -1
  6. package/cjs/components/Notification/NotificationsProvider.css +4 -3
  7. package/cjs/components/Popup/Popup.css +4 -3
  8. package/cjs/components/Popup/Popup.js +159 -38
  9. package/cjs/components/Popup/Popup.js.map +1 -1
  10. package/cjs/components/Popup/Popup.styles.js +21 -9
  11. package/cjs/components/Popup/Popup.styles.js.map +1 -1
  12. package/cjs/components/Popup/Popup.styles_8h77g1.css +4 -0
  13. package/cjs/components/Popup/PopupContext.js +3 -0
  14. package/cjs/components/Popup/PopupContext.js.map +1 -1
  15. package/cjs/components/Popup/hooks/usePopup.js +1 -1
  16. package/cjs/components/Popup/hooks/usePopup.js.map +1 -1
  17. package/cjs/index.css +4 -3
  18. package/emotion/cjs/components/Popup/Popup.js +160 -38
  19. package/emotion/cjs/components/Popup/Popup.styles.js +25 -5
  20. package/emotion/cjs/components/Popup/PopupContext.js +3 -0
  21. package/emotion/cjs/components/Popup/hooks/usePopup.js +1 -1
  22. package/emotion/cjs/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -1
  23. package/emotion/cjs/examples/plasma_b2c/components/Popup/Popup.stories.tsx +1 -1
  24. package/emotion/cjs/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -1
  25. package/emotion/cjs/examples/plasma_web/components/Popup/Popup.stories.tsx +1 -1
  26. package/emotion/es/components/Popup/Popup.js +160 -39
  27. package/emotion/es/components/Popup/Popup.styles.js +24 -4
  28. package/emotion/es/components/Popup/PopupContext.js +3 -0
  29. package/emotion/es/components/Popup/hooks/usePopup.js +1 -1
  30. package/emotion/es/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -1
  31. package/emotion/es/examples/plasma_b2c/components/Popup/Popup.stories.tsx +1 -1
  32. package/emotion/es/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -1
  33. package/emotion/es/examples/plasma_web/components/Popup/Popup.stories.tsx +1 -1
  34. package/es/components/Drawer/Drawer.css +4 -3
  35. package/es/components/Drawer/Drawer.js +1 -1
  36. package/es/components/Drawer/hooks/useDrawer.js +1 -1
  37. package/es/components/Modal/Modal.css +4 -3
  38. package/es/components/Modal/hooks/useModal.js +1 -1
  39. package/es/components/Notification/NotificationsProvider.css +4 -3
  40. package/es/components/Popup/Popup.css +4 -3
  41. package/es/components/Popup/Popup.js +161 -40
  42. package/es/components/Popup/Popup.js.map +1 -1
  43. package/es/components/Popup/Popup.styles.js +20 -10
  44. package/es/components/Popup/Popup.styles.js.map +1 -1
  45. package/es/components/Popup/Popup.styles_8h77g1.css +4 -0
  46. package/es/components/Popup/PopupContext.js +3 -0
  47. package/es/components/Popup/PopupContext.js.map +1 -1
  48. package/es/components/Popup/hooks/usePopup.js +1 -1
  49. package/es/components/Popup/hooks/usePopup.js.map +1 -1
  50. package/es/index.css +4 -3
  51. package/package.json +3 -3
  52. package/styled-components/cjs/components/Popup/Popup.js +160 -38
  53. package/styled-components/cjs/components/Popup/Popup.styles.js +7 -4
  54. package/styled-components/cjs/components/Popup/PopupContext.js +3 -0
  55. package/styled-components/cjs/components/Popup/hooks/usePopup.js +1 -1
  56. package/styled-components/cjs/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -1
  57. package/styled-components/cjs/examples/plasma_b2c/components/Popup/Popup.stories.tsx +1 -1
  58. package/styled-components/cjs/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -1
  59. package/styled-components/cjs/examples/plasma_web/components/Popup/Popup.stories.tsx +1 -1
  60. package/styled-components/es/components/Popup/Popup.js +160 -39
  61. package/styled-components/es/components/Popup/Popup.styles.js +6 -3
  62. package/styled-components/es/components/Popup/PopupContext.js +3 -0
  63. package/styled-components/es/components/Popup/hooks/usePopup.js +1 -1
  64. package/styled-components/es/examples/plasma_b2c/components/Modal/Modal.stories.tsx +1 -1
  65. package/styled-components/es/examples/plasma_b2c/components/Popup/Popup.stories.tsx +1 -1
  66. package/styled-components/es/examples/plasma_web/components/Modal/Modal.stories.tsx +1 -1
  67. package/styled-components/es/examples/plasma_web/components/Popup/Popup.stories.tsx +1 -1
  68. package/types/components/Popup/Popup.d.ts +1 -1
  69. package/types/components/Popup/Popup.d.ts.map +1 -1
  70. package/types/components/Popup/Popup.styles.d.ts +1 -0
  71. package/types/components/Popup/Popup.styles.d.ts.map +1 -1
  72. package/types/components/Popup/PopupContext.d.ts.map +1 -1
  73. package/cjs/components/Popup/Popup.styles_141jyqa.css +0 -3
  74. package/es/components/Popup/Popup.styles_141jyqa.css +0 -3
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.popupRoot = exports.popupConfig = exports.handlePosition = void 0;
8
8
  var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
9
+ var _reactDom = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("react-dom"));
9
10
  var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
10
11
  var _utils = /*#__PURE__*/require("../../utils");
11
12
  var _Portal = /*#__PURE__*/require("../Portal");
@@ -13,7 +14,9 @@ var _PopupContext = /*#__PURE__*/require("./PopupContext");
13
14
  var _PopupRoot = /*#__PURE__*/require("./PopupRoot");
14
15
  var _hooks = /*#__PURE__*/require("./hooks");
15
16
  var _Popup = /*#__PURE__*/require("./Popup.tokens");
17
+ var _Popup2 = /*#__PURE__*/require("./Popup.styles");
16
18
  var _excluded = ["id", "isOpen", "opened", "placement", "offset", "frame", "children", "overlay", "role", "zIndex", "popupInfo", "withAnimation", "className"];
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
18
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
19
22
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -48,8 +51,8 @@ var handlePosition = exports.handlePosition = function handlePosition(placement,
48
51
  var bottom;
49
52
  var transform;
50
53
  var placements = placement.split('-');
51
- placements.forEach(function (placement) {
52
- switch (placement) {
54
+ placements.forEach(function (placementValue) {
55
+ switch (placementValue) {
53
56
  case 'left':
54
57
  left = x;
55
58
  break;
@@ -82,9 +85,139 @@ var handlePosition = exports.handlePosition = function handlePosition(placement,
82
85
  transform: transform
83
86
  };
84
87
  };
88
+ /*
89
+ const getPortalParent = (frame: 'document' | string | React.RefObject<HTMLElement>, portalRef) => {
90
+ if (typeof frame !== 'string' && frame && frame.current) {
91
+ portalRef.current = frame.current;
92
+ return;
93
+ }
94
+
95
+ if (typeof frame === 'string' && frame !== 'document') {
96
+ const element = document.getElementById(frame);
97
+ if (element) {
98
+ const portal = document.createElement('div');
99
+ portal.className = 'frame-portal';
100
+ portal.style.position = 'relative';
101
+ portal.style.width = '0';
102
+
103
+ element.appendChild(portal);
104
+ portalRef.current = portal;
105
+
106
+ return;
107
+ //
108
+ // const portal = document?.querySelector('.frame-portal');
109
+ // if (!portal) {
110
+ // portal = document.createElement('div');
111
+ // document.getElementById(frame)?.appendChild(portal);
112
+ // }
113
+ // return portal;
114
+ }
115
+ }
116
+
117
+ const portal = document.getElementById(POPUP_PORTAL_ID);
118
+
119
+ if (!portal) {
120
+ ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
121
+ }
122
+
123
+ portalRef.current = portal;
124
+
125
+ let portal;
126
+
127
+ const hasFrame = typeof frame !== 'string' && frame && frame.current;
128
+ if (hasFrame) {
129
+ portal = frame.current;
130
+ } else {
131
+ // ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
132
+
133
+ portal = document.getElementById(POPUP_PORTAL_ID);
134
+
135
+ if (!portal) {
136
+ if (typeof frame === 'string' && frame !== 'document') {
137
+ portal = document.createElement('div');
138
+ document.getElementById(frame)?.appendChild(portal);
139
+ } else {
140
+ portal.className('frame-portal');
141
+ document.body.appendChild(portal);
142
+ // ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
143
+ }
144
+ }
145
+ }
146
+
147
+ };
148
+
149
+ const usePortalContainer = (frame: 'document' | string | React.RefObject<HTMLElement>) => {
150
+ const portalRef = useRef<HTMLDivElement | null>(null);
151
+
152
+ if (typeof frame !== 'string' && frame && frame.current) {
153
+ return frame.current;
154
+ }
155
+
156
+ if (typeof frame === 'string' && frame !== 'document') {
157
+ const element = document.getElementById(frame);
158
+
159
+ const portal = document?.querySelector('.frame-portal');
160
+
161
+ if (portal) {
162
+ return portal;
163
+ }
164
+
165
+ if (element) {
166
+ const portal = document.createElement('div');
167
+ portal.className = 'frame-portal';
168
+ portal.style.position = 'relative';
169
+ // portal.style.width = '0';
170
+
171
+ element.appendChild(portal);
172
+ return portal;
173
+ //
174
+ // const portal = document?.querySelector('.frame-portal');
175
+ // if (!portal) {
176
+ // portal = document.createElement('div');
177
+ // document.getElementById(frame)?.appendChild(portal);
178
+ // }
179
+ // return portal;
180
+ }
181
+ }
182
+
183
+ const portal = document.getElementById(POPUP_PORTAL_ID);
184
+
185
+ if (!portal) {
186
+ const res = ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
187
+
188
+ console.log('!!! res', res);
189
+ }
190
+
191
+ console.log('!!!! portalRef.current', portalRef.current, document.getElementById(POPUP_PORTAL_ID));
192
+ return portalRef.current;
193
+
194
+ let portal;
195
+
196
+ const hasFrame = typeof frame !== 'string' && frame && frame.current;
197
+ if (hasFrame) {
198
+ portal = frame.current;
199
+ } else {
200
+ // ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
201
+
202
+ portal = document.getElementById(POPUP_PORTAL_ID);
203
+
204
+ if (!portal) {
205
+ if (typeof frame === 'string' && frame !== 'document') {
206
+ portal = document.createElement('div');
207
+ document.getElementById(frame)?.appendChild(portal);
208
+ } else {
209
+ portal.className('frame-portal');
210
+ document.body.appendChild(portal);
211
+ // ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
212
+ }
213
+ }
214
+ }
215
+
216
+ };
217
+ */
85
218
 
86
219
  /**
87
- * Базовый копмонент Popup.
220
+ * Базовый компонент Popup.
88
221
  */
89
222
  var popupRoot = exports.popupRoot = function popupRoot(Root) {
90
223
  return /*#__PURE__*/(0, _react.forwardRef)(function (_ref, outerRootRef) {
@@ -120,47 +253,16 @@ var popupRoot = exports.popupRoot = function popupRoot(Root) {
120
253
  isVisible = _usePopup.isVisible,
121
254
  animationInfo = _usePopup.animationInfo,
122
255
  setVisible = _usePopup.setVisible;
256
+
257
+ // const container = usePortalContainer(frame);
123
258
  var portalRef = (0, _react.useRef)(null);
124
259
  var contentRef = (0, _react.useRef)(null);
125
260
  var innerRef = (0, _plasmaCore.useForkRef)(contentRef, outerRootRef);
126
- var _useState = (0, _react.useState)(false),
127
- _useState2 = _slicedToArray(_useState, 2),
128
- forceRender = _useState2[1];
129
- (0, _react.useEffect)(function () {
130
- var portal = document.getElementById(_PopupContext.POPUP_PORTAL_ID);
131
- if (typeof frame !== 'string' && frame && frame.current) {
132
- portal = frame.current;
133
- }
134
- if (!portal) {
135
- portal = document.createElement('div');
136
- portal.setAttribute('id', _PopupContext.POPUP_PORTAL_ID);
137
- /**
138
- * Нужно для того, чтобы во фрейме не происходило скачков контента
139
- * при анимации через transform, если есть элемент с шириной/высотой в 100% (Overlay)
140
- */
141
- portal.style.width = '0';
142
- if (typeof frame === 'string' && frame !== 'document') {
143
- var _document$getElementB;
144
- (_document$getElementB = document.getElementById(frame)) === null || _document$getElementB === void 0 || _document$getElementB.appendChild(portal);
145
- } else {
146
- document.body.appendChild(portal);
147
- }
148
- }
149
- portalRef.current = portal;
150
-
151
- /**
152
- * Изменение стейта нужно для того, чтобы Popup
153
- * отобразился после записи DOM элемента в portalRef.current
154
- */
155
- forceRender(true);
156
- }, []);
157
261
  if (!isVisible && !innerIsOpen) {
158
262
  return null;
159
263
  }
160
264
  var cls = (0, _utils.cx)(className, animationInfo !== null && animationInfo !== void 0 && animationInfo.endAnimation ? _Popup.classes.endAnimation : '', animationInfo !== null && animationInfo !== void 0 && animationInfo.endTransition ? _Popup.classes.endTransition : '');
161
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, portalRef.current && /*#__PURE__*/_react["default"].createElement(_Portal.Portal, {
162
- container: portalRef.current
163
- }, /*#__PURE__*/_react["default"].createElement(Root, _extends({
265
+ var rootNode = /*#__PURE__*/_react["default"].createElement(Root, _extends({
164
266
  className: cls
165
267
  }, rest), overlay, /*#__PURE__*/_react["default"].createElement(_PopupRoot.PopupRoot, {
166
268
  id: innerId,
@@ -170,7 +272,27 @@ var popupRoot = exports.popupRoot = function popupRoot(Root) {
170
272
  zIndex: zIndex,
171
273
  animationInfo: animationInfo,
172
274
  setVisible: setVisible
173
- }, children))));
275
+ }, children));
276
+ if (typeof frame !== 'string' && frame && frame.current) {
277
+ return /*#__PURE__*/_react["default"].createElement(_Portal.Portal, {
278
+ container: frame.current
279
+ }, rootNode);
280
+ }
281
+ var withFrameId = typeof frame === 'string' && frame !== 'document';
282
+ var containerElement = withFrameId && document.getElementById(frame);
283
+ if (containerElement) {
284
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_reactDom["default"].createPortal( /*#__PURE__*/_react["default"].createElement(_Popup2.StyledPortalContainer, {
285
+ ref: portalRef
286
+ }, portalRef.current && /*#__PURE__*/_react["default"].createElement(_Portal.Portal, {
287
+ container: portalRef.current
288
+ }, rootNode)), containerElement));
289
+ }
290
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_reactDom["default"].createPortal( /*#__PURE__*/_react["default"].createElement(_Popup2.StyledPortal, {
291
+ id: _PopupContext.POPUP_PORTAL_ID,
292
+ ref: portalRef
293
+ }, portalRef.current && /*#__PURE__*/_react["default"].createElement(_Portal.Portal, {
294
+ container: portalRef.current
295
+ }, rootNode)), document.body));
174
296
  });
175
297
  };
176
298
  var popupConfig = exports.popupConfig = {
@@ -3,15 +3,35 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyledPortal = exports.PopupView = exports.PopupRootContainer = void 0;
6
+ exports.StyledPortalContainer = exports.StyledPortal = exports.PopupView = exports.PopupRootContainer = void 0;
7
7
  var _base = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("@emotion/styled/base"));
8
8
  var _utils = /*#__PURE__*/require("./utils");
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
10
  function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
11
11
  var StyledPortal = exports.StyledPortal = /*#__PURE__*/(0, _base["default"])("div", {
12
- target: "eaqy7mk2",
12
+ target: "eaqy7mk3",
13
13
  label: "plasma-new-hope__StyledPortal"
14
- })(process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUG9wdXAvUG9wdXAuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtzQyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1BvcHVwL1BvcHVwLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuaW1wb3J0IHR5cGUgeyBQb3B1cFJvb3RDb250YWluZXJQcm9wcyB9IGZyb20gJy4vUG9wdXAudHlwZXMnO1xuaW1wb3J0IHsgREVGQVVMVF9aX0lOREVYIH0gZnJvbSAnLi91dGlscyc7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQb3J0YWwgPSBzdHlsZWQuZGl2YGA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFZpZXcgPSBzdHlsZWQuZGl2YFxuICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgcG9pbnRlci1ldmVudHM6IGFsbDtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFJvb3RDb250YWluZXIgPSBzdHlsZWQuZGl2PFBvcHVwUm9vdENvbnRhaW5lclByb3BzPmBcbiAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgei1pbmRleDogJHsoeyB6SW5kZXggfSkgPT4gekluZGV4IHx8IERFRkFVTFRfWl9JTkRFWH07XG4gICAgbGVmdDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5sZWZ0IHx8ICcnfTtcbiAgICByaWdodDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5yaWdodCB8fCAnJ307XG4gICAgdG9wOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRvcCB8fCAnJ307XG4gICAgYm90dG9tOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLmJvdHRvbSB8fCAnJ307XG4gICAgdHJhbnNmb3JtOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRyYW5zZm9ybSB8fCAnJ307XG5gO1xuIl19 */");
14
+ })(process.env.NODE_ENV === "production" ? {
15
+ name: "14er37y",
16
+ styles: "position:fixed;top:0;left:0;right:0;bottom:0;:empty{width:0;pointer-events:none;}:not(:empty){width:auto;pointer-events:auto;}"
17
+ } : {
18
+ name: "14er37y",
19
+ styles: "position:fixed;top:0;left:0;right:0;bottom:0;:empty{width:0;pointer-events:none;}:not(:empty){width:auto;pointer-events:auto;}",
20
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUG9wdXAvUG9wdXAuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtzQyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1BvcHVwL1BvcHVwLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuaW1wb3J0IHR5cGUgeyBQb3B1cFJvb3RDb250YWluZXJQcm9wcyB9IGZyb20gJy4vUG9wdXAudHlwZXMnO1xuaW1wb3J0IHsgREVGQVVMVF9aX0lOREVYIH0gZnJvbSAnLi91dGlscyc7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQb3J0YWwgPSBz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c2Zvcm06ICR7KHsgcG9zaXRpb24gfSkgPT4gcG9zaXRpb24udHJhbnNmb3JtIHx8ICcnfTtcbmA7XG4iXX0= */",
21
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
22
+ });
23
+ var StyledPortalContainer = exports.StyledPortalContainer = /*#__PURE__*/(0, _base["default"])("div", {
24
+ target: "eaqy7mk2",
25
+ label: "plasma-new-hope__StyledPortalContainer"
26
+ })(process.env.NODE_ENV === "production" ? {
27
+ name: "k2uqvh",
28
+ styles: "width:0"
29
+ } : {
30
+ name: "k2uqvh",
31
+ styles: "width:0",
32
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUG9wdXAvUG9wdXAuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXVCK0MiLCJmaWxlIjoiLi4vLi4vLi4vLi4vc3JjLWVtb3Rpb24vY29tcG9uZW50cy9Qb3B1cC9Qb3B1cC5zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbmltcG9ydCB0eXBlIHsgUG9wdXBSb290Q29udGFpbmVyUHJvcHMgfSBmcm9tICcuL1BvcHVwLnR5cGVzJztcbmltcG9ydCB7IERFRkFVTFRfWl9JTkRFWCB9IGZyb20gJy4vdXRpbHMnO1xuXG5leHBvcnQgY29uc3QgU3R5bGVkUG9ydGFsID0gc3R5bGVkLmRpdmBcbiAgICBwb3NpdGlvbjogZml4ZWQ7XG4gICAgdG9wOiAwO1xuICAgIGxlZnQ6IDA7XG4gICAgcmlnaHQ6IDA7XG4gICAgYm90dG9tOiAwO1xuXG4gICAgOmVtcHR5IHtcbiAgICAgICAgd2lkdGg6IDA7XG4gICAgICAgIHBvaW50ZXItZXZlbnRzOiBub25lO1xuICAgIH1cblxuICAgIDpub3QoOmVtcHR5KSB7XG4gICAgICAgIHdpZHRoOiBhdXRvO1xuICAgICAgICBwb2ludGVyLWV2ZW50czogYXV0bztcbiAgICB9XG5gO1xuXG5leHBvcnQgY29uc3QgU3R5bGVkUG9ydGFsQ29udGFpbmVyID0gc3R5bGVkLmRpdmBcbiAgICB3aWR0aDogMDtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFZpZXcgPSBzdHlsZWQuZGl2YFxuICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgcG9pbnRlci1ldmVudHM6IGFsbDtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFJvb3RDb250YWluZXIgPSBzdHlsZWQuZGl2PFBvcHVwUm9vdENvbnRhaW5lclByb3BzPmBcbiAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgei1pbmRleDogJHsoeyB6SW5kZXggfSkgPT4gekluZGV4IHx8IERFRkFVTFRfWl9JTkRFWH07XG4gICAgbGVmdDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5sZWZ0IHx8ICcnfTtcbiAgICByaWdodDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5yaWdodCB8fCAnJ307XG4gICAgdG9wOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRvcCB8fCAnJ307XG4gICAgYm90dG9tOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLmJvdHRvbSB8fCAnJ307XG4gICAgdHJhbnNmb3JtOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRyYW5zZm9ybSB8fCAnJ307XG5gO1xuIl19 */",
33
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
34
+ });
15
35
  var PopupView = exports.PopupView = /*#__PURE__*/(0, _base["default"])("div", {
16
36
  target: "eaqy7mk1",
17
37
  label: "plasma-new-hope__PopupView"
@@ -21,7 +41,7 @@ var PopupView = exports.PopupView = /*#__PURE__*/(0, _base["default"])("div", {
21
41
  } : {
22
42
  name: "1m82nn4",
23
43
  styles: "position:relative;max-width:100%;pointer-events:all",
24
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUG9wdXAvUG9wdXAuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9tQyIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1BvcHVwL1BvcHVwLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuaW1wb3J0IHR5cGUgeyBQb3B1cFJvb3RDb250YWluZXJQcm9wcyB9IGZyb20gJy4vUG9wdXAudHlwZXMnO1xuaW1wb3J0IHsgREVGQVVMVF9aX0lOREVYIH0gZnJvbSAnLi91dGlscyc7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQb3J0YWwgPSBzdHlsZWQuZGl2YGA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFZpZXcgPSBzdHlsZWQuZGl2YFxuICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgcG9pbnRlci1ldmVudHM6IGFsbDtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFJvb3RDb250YWluZXIgPSBzdHlsZWQuZGl2PFBvcHVwUm9vdENvbnRhaW5lclByb3BzPmBcbiAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgei1pbmRleDogJHsoeyB6SW5kZXggfSkgPT4gekluZGV4IHx8IERFRkFVTFRfWl9JTkRFWH07XG4gICAgbGVmdDogJHsoeyBwb3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6IDA7XG4gICAgICAgIHBvaW50ZXItZXZlbnRzOiBub25lO1xuICAgIH1cblxuICAgIDpub3QoOmVtcHR5KSB7XG4gICAgICAgIHdpZHRoOiBhdXRvO1xuICAgICAgICBwb2ludGVyLWV2ZW50czogYXV0bztcbiAgICB9XG5gO1xuXG5leHBvcnQgY29uc3QgU3R5bGVkUG9ydGFsQ29udGFpbmVyID0gc3R5bGVkLmRpdmBcbiAgICB3aWR0aDogMDtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFZpZXcgPSBzdHlsZWQuZGl2YFxuICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgcG9pbnRlci1ldmVudHM6IGFsbDtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFJvb3RDb250YWluZXIgPSBzdHlsZWQuZGl2PFBvcHVwUm9vdENvbnRhaW5lclByb3BzPmBcbiAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgei1pbmRleDogJHsoeyB6SW5kZXggfSkgPT4gekluZGV4IHx8IERFRkFVTFRfWl9JTkRFWH07XG4gICAgbGVmdDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5sZWZ0IHx8ICcnfTtcbiAgICByaWdodDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5yaWdodCB8fCAnJ307XG4gICAgdG9wOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRvcCB8fCAnJ307XG4gICAgYm90dG9tOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLmJvdHRvbSB8fCAnJ307XG4gICAgdHJhbnNmb3JtOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRyYW5zZm9ybSB8fCAnJ307XG5gO1xuIl19 */",
25
45
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
26
46
  });
27
47
  var PopupRootContainer = exports.PopupRootContainer = /*#__PURE__*/(0, _base["default"])("div", {
@@ -45,4 +65,4 @@ var PopupRootContainer = exports.PopupRootContainer = /*#__PURE__*/(0, _base["de
45
65
  }, ";transform:", function (_ref6) {
46
66
  var position = _ref6.position;
47
67
  return position.transform || '';
48
- }, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUG9wdXAvUG9wdXAuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWFxRSIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1BvcHVwL1BvcHVwLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuaW1wb3J0IHR5cGUgeyBQb3B1cFJvb3RDb250YWluZXJQcm9wcyB9IGZyb20gJy4vUG9wdXAudHlwZXMnO1xuaW1wb3J0IHsgREVGQVVMVF9aX0lOREVYIH0gZnJvbSAnLi91dGlscyc7XG5cbmV4cG9ydCBjb25zdCBTdHlsZWRQb3J0YWwgPSBzdHlsZWQuZGl2YGA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFZpZXcgPSBzdHlsZWQuZGl2YFxuICAgIHBvc2l0aW9uOiByZWxhdGl2ZTtcbiAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgcG9pbnRlci1ldmVudHM6IGFsbDtcbmA7XG5cbmV4cG9ydCBjb25zdCBQb3B1cFJvb3RDb250YWluZXIgPSBzdHlsZWQuZGl2PFBvcHVwUm9vdENvbnRhaW5lclByb3BzPmBcbiAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgei1pbmRleDogJHsoeyB6SW5kZXggfSkgPT4gekluZGV4IHx8IERFRkFVTFRfWl9JTkRFWH07XG4gICAgbGVmdDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5sZWZ0IHx8ICcnfTtcbiAgICByaWdodDogJHsoeyBwb3NpdGlvbiB9KSA9PiBwb3NpdGlvbi5yaWdodCB8fCAnJ307XG4gICAgdG9wOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRvcCB8fCAnJ307XG4gICAgYm90dG9tOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLmJvdHRvbSB8fCAnJ307XG4gICAgdHJhbnNmb3JtOiAkeyh7IHBvc2l0aW9uIH0pID0+IHBvc2l0aW9uLnRyYW5zZm9ybSB8fCAnJ307XG5gO1xuIl19 */"));
68
+ }, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvUG9wdXAvUG9wdXAuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWlDcUUiLCJmaWxlIjoiLi4vLi4vLi4vLi4vc3JjLWVtb3Rpb24vY29tcG9uZW50cy9Qb3B1cC9Qb3B1cC5zdHlsZXMudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbmltcG9ydCB0eXBlIHsgUG9wdXBSb290Q29udGFpbmVyUHJvcHMgfSBmcm9tICcuL1BvcHVwLnR5cGVzJztcbmltcG9ydCB7IERFRkFVTFRfWl9JTkRFWCB9IGZyb20gJy4vdXRpbHMnO1xuXG5leHBvcnQgY29uc3QgU3R5bGVkUG9ydGFsID0gc3R5bGVkLmRpdmBcbiAgICBwb3NpdGlvbjogZml4ZWQ7XG4gICAgdG9wOiAwO1xuICAgIGxlZnQ6IDA7XG4gICAgcmlnaHQ6IDA7X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 @@ var POPUP_PORTAL_ID = exports.POPUP_PORTAL_ID = 'plasma-popup-root';
23
23
  var items = [];
24
24
  var PopupContext = /*#__PURE__*/(0, _react.createContext)({
25
25
  items: items,
26
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
26
27
  register: function register(_info) {
27
28
  throw new Error('Function not implemented. Add PopupProvider');
28
29
  },
30
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
29
31
  unregister: function unregister(_id) {
30
32
  throw new Error('Function not implemented. Add PopupProvider');
31
33
  }
@@ -36,6 +38,7 @@ var usePopupContext = exports.usePopupContext = function usePopupContext() {
36
38
  var PopupProvider = exports.PopupProvider = function PopupProvider(_ref) {
37
39
  var children = _ref.children;
38
40
  var prevBodyOverflowY = (0, _react.useRef)(typeof document !== 'undefined' ? document.body.style.overflowY : '');
41
+ // eslint-disable-next-line no-shadow
39
42
  var _useState = (0, _react.useState)([]),
40
43
  _useState2 = _slicedToArray(_useState, 2),
41
44
  items = _useState2[0],
@@ -18,7 +18,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
18
18
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
19
19
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
20
20
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
- // Хук для поключения анимации
21
+ // Хук для подключения анимации
22
22
  var usePopupAnimation = function usePopupAnimation() {
23
23
  var _useState = (0, _react.useState)(false),
24
24
  _useState2 = _slicedToArray(_useState, 2),
@@ -80,7 +80,7 @@ const StyledButton = styled(Button)`
80
80
  `;
81
81
 
82
82
  const StyledWrapper = styled.div`
83
- height: 1200px;
83
+ height: 300px;
84
84
  `;
85
85
 
86
86
  const Content = styled.div`
@@ -55,7 +55,7 @@ const StyledButton = styled(Button)`
55
55
  `;
56
56
 
57
57
  const StyledWrapper = styled.div`
58
- height: 1200px;
58
+ height: 600px;
59
59
  `;
60
60
 
61
61
  const OtherContent = styled.div`
@@ -80,7 +80,7 @@ const StyledButton = styled(Button)`
80
80
  `;
81
81
 
82
82
  const StyledWrapper = styled.div`
83
- height: 1200px;
83
+ height: 300px;
84
84
  `;
85
85
 
86
86
  const Content = styled.div`
@@ -55,7 +55,7 @@ const StyledButton = styled(Button)`
55
55
  `;
56
56
 
57
57
  const StyledWrapper = styled.div`
58
- height: 1200px;
58
+ height: 600px;
59
59
  `;
60
60
 
61
61
  const OtherContent = styled.div`
@@ -8,7 +8,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
9
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import React, { forwardRef, useEffect, useRef, useState } from 'react';
11
+ import React, { forwardRef, useRef } from 'react';
12
+ import ReactDOM from 'react-dom';
12
13
  import { useForkRef, safeUseId } from '@salutejs/plasma-core';
13
14
  import { cx } from '../../utils';
14
15
  import { Portal } from '../Portal';
@@ -16,6 +17,7 @@ import { POPUP_PORTAL_ID } from './PopupContext';
16
17
  import { PopupRoot } from './PopupRoot';
17
18
  import { usePopup } from './hooks';
18
19
  import { classes } from './Popup.tokens';
20
+ import { StyledPortal, StyledPortalContainer } from './Popup.styles';
19
21
  export var handlePosition = function handlePosition(placement, offset) {
20
22
  var x = '0rem';
21
23
  var y = '0rem';
@@ -39,8 +41,8 @@ export var handlePosition = function handlePosition(placement, offset) {
39
41
  var bottom;
40
42
  var transform;
41
43
  var placements = placement.split('-');
42
- placements.forEach(function (placement) {
43
- switch (placement) {
44
+ placements.forEach(function (placementValue) {
45
+ switch (placementValue) {
44
46
  case 'left':
45
47
  left = x;
46
48
  break;
@@ -73,9 +75,139 @@ export var handlePosition = function handlePosition(placement, offset) {
73
75
  transform: transform
74
76
  };
75
77
  };
78
+ /*
79
+ const getPortalParent = (frame: 'document' | string | React.RefObject<HTMLElement>, portalRef) => {
80
+ if (typeof frame !== 'string' && frame && frame.current) {
81
+ portalRef.current = frame.current;
82
+ return;
83
+ }
84
+
85
+ if (typeof frame === 'string' && frame !== 'document') {
86
+ const element = document.getElementById(frame);
87
+ if (element) {
88
+ const portal = document.createElement('div');
89
+ portal.className = 'frame-portal';
90
+ portal.style.position = 'relative';
91
+ portal.style.width = '0';
92
+
93
+ element.appendChild(portal);
94
+ portalRef.current = portal;
95
+
96
+ return;
97
+ //
98
+ // const portal = document?.querySelector('.frame-portal');
99
+ // if (!portal) {
100
+ // portal = document.createElement('div');
101
+ // document.getElementById(frame)?.appendChild(portal);
102
+ // }
103
+ // return portal;
104
+ }
105
+ }
106
+
107
+ const portal = document.getElementById(POPUP_PORTAL_ID);
108
+
109
+ if (!portal) {
110
+ ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
111
+ }
112
+
113
+ portalRef.current = portal;
114
+
115
+ let portal;
116
+
117
+ const hasFrame = typeof frame !== 'string' && frame && frame.current;
118
+ if (hasFrame) {
119
+ portal = frame.current;
120
+ } else {
121
+ // ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
122
+
123
+ portal = document.getElementById(POPUP_PORTAL_ID);
124
+
125
+ if (!portal) {
126
+ if (typeof frame === 'string' && frame !== 'document') {
127
+ portal = document.createElement('div');
128
+ document.getElementById(frame)?.appendChild(portal);
129
+ } else {
130
+ portal.className('frame-portal');
131
+ document.body.appendChild(portal);
132
+ // ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
133
+ }
134
+ }
135
+ }
136
+
137
+ };
138
+
139
+ const usePortalContainer = (frame: 'document' | string | React.RefObject<HTMLElement>) => {
140
+ const portalRef = useRef<HTMLDivElement | null>(null);
141
+
142
+ if (typeof frame !== 'string' && frame && frame.current) {
143
+ return frame.current;
144
+ }
145
+
146
+ if (typeof frame === 'string' && frame !== 'document') {
147
+ const element = document.getElementById(frame);
148
+
149
+ const portal = document?.querySelector('.frame-portal');
150
+
151
+ if (portal) {
152
+ return portal;
153
+ }
154
+
155
+ if (element) {
156
+ const portal = document.createElement('div');
157
+ portal.className = 'frame-portal';
158
+ portal.style.position = 'relative';
159
+ // portal.style.width = '0';
160
+
161
+ element.appendChild(portal);
162
+ return portal;
163
+ //
164
+ // const portal = document?.querySelector('.frame-portal');
165
+ // if (!portal) {
166
+ // portal = document.createElement('div');
167
+ // document.getElementById(frame)?.appendChild(portal);
168
+ // }
169
+ // return portal;
170
+ }
171
+ }
172
+
173
+ const portal = document.getElementById(POPUP_PORTAL_ID);
174
+
175
+ if (!portal) {
176
+ const res = ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
177
+
178
+ console.log('!!! res', res);
179
+ }
180
+
181
+ console.log('!!!! portalRef.current', portalRef.current, document.getElementById(POPUP_PORTAL_ID));
182
+ return portalRef.current;
183
+
184
+ let portal;
185
+
186
+ const hasFrame = typeof frame !== 'string' && frame && frame.current;
187
+ if (hasFrame) {
188
+ portal = frame.current;
189
+ } else {
190
+ // ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
191
+
192
+ portal = document.getElementById(POPUP_PORTAL_ID);
193
+
194
+ if (!portal) {
195
+ if (typeof frame === 'string' && frame !== 'document') {
196
+ portal = document.createElement('div');
197
+ document.getElementById(frame)?.appendChild(portal);
198
+ } else {
199
+ portal.className('frame-portal');
200
+ document.body.appendChild(portal);
201
+ // ReactDOM.createPortal(<StyledPortal id={POPUP_PORTAL_ID} ref={portalRef} />, document.body);
202
+ }
203
+ }
204
+ }
205
+
206
+ };
207
+ */
76
208
 
77
209
  /**
78
- * Базовый копмонент Popup.
210
+ * Базовый компонент Popup.
79
211
  */
80
212
  export var popupRoot = function popupRoot(Root) {
81
213
  return /*#__PURE__*/forwardRef(function (_ref, outerRootRef) {
@@ -111,47 +243,16 @@ export var popupRoot = function popupRoot(Root) {
111
243
  isVisible = _usePopup.isVisible,
112
244
  animationInfo = _usePopup.animationInfo,
113
245
  setVisible = _usePopup.setVisible;
246
+
247
+ // const container = usePortalContainer(frame);
114
248
  var portalRef = useRef(null);
115
249
  var contentRef = useRef(null);
116
250
  var innerRef = useForkRef(contentRef, outerRootRef);
117
- var _useState = useState(false),
118
- _useState2 = _slicedToArray(_useState, 2),
119
- forceRender = _useState2[1];
120
- useEffect(function () {
121
- var portal = document.getElementById(POPUP_PORTAL_ID);
122
- if (typeof frame !== 'string' && frame && frame.current) {
123
- portal = frame.current;
124
- }
125
- if (!portal) {
126
- portal = document.createElement('div');
127
- portal.setAttribute('id', POPUP_PORTAL_ID);
128
- /**
129
- * Нужно для того, чтобы во фрейме не происходило скачков контента
130
- * при анимации через transform, если есть элемент с шириной/высотой в 100% (Overlay)
131
- */
132
- portal.style.width = '0';
133
- if (typeof frame === 'string' && frame !== 'document') {
134
- var _document$getElementB;
135
- (_document$getElementB = document.getElementById(frame)) === null || _document$getElementB === void 0 || _document$getElementB.appendChild(portal);
136
- } else {
137
- document.body.appendChild(portal);
138
- }
139
- }
140
- portalRef.current = portal;
141
-
142
- /**
143
- * Изменение стейта нужно для того, чтобы Popup
144
- * отобразился после записи DOM элемента в portalRef.current
145
- */
146
- forceRender(true);
147
- }, []);
148
251
  if (!isVisible && !innerIsOpen) {
149
252
  return null;
150
253
  }
151
254
  var cls = cx(className, animationInfo !== null && animationInfo !== void 0 && animationInfo.endAnimation ? classes.endAnimation : '', animationInfo !== null && animationInfo !== void 0 && animationInfo.endTransition ? classes.endTransition : '');
152
- return /*#__PURE__*/React.createElement(React.Fragment, null, portalRef.current && /*#__PURE__*/React.createElement(Portal, {
153
- container: portalRef.current
154
- }, /*#__PURE__*/React.createElement(Root, _extends({
255
+ var rootNode = /*#__PURE__*/React.createElement(Root, _extends({
155
256
  className: cls
156
257
  }, rest), overlay, /*#__PURE__*/React.createElement(PopupRoot, {
157
258
  id: innerId,
@@ -161,7 +262,27 @@ export var popupRoot = function popupRoot(Root) {
161
262
  zIndex: zIndex,
162
263
  animationInfo: animationInfo,
163
264
  setVisible: setVisible
164
- }, children))));
265
+ }, children));
266
+ if (typeof frame !== 'string' && frame && frame.current) {
267
+ return /*#__PURE__*/React.createElement(Portal, {
268
+ container: frame.current
269
+ }, rootNode);
270
+ }
271
+ var withFrameId = typeof frame === 'string' && frame !== 'document';
272
+ var containerElement = withFrameId && document.getElementById(frame);
273
+ if (containerElement) {
274
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(StyledPortalContainer, {
275
+ ref: portalRef
276
+ }, portalRef.current && /*#__PURE__*/React.createElement(Portal, {
277
+ container: portalRef.current
278
+ }, rootNode)), containerElement));
279
+ }
280
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(StyledPortal, {
281
+ id: POPUP_PORTAL_ID,
282
+ ref: portalRef
283
+ }, portalRef.current && /*#__PURE__*/React.createElement(Portal, {
284
+ container: portalRef.current
285
+ }, rootNode)), document.body));
165
286
  });
166
287
  };
167
288
  export var popupConfig = {