@salutejs/plasma-new-hope 0.327.0-canary.1741.15743877104.0 → 0.327.0-canary.1741.15775036215.0

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.
Files changed (121) hide show
  1. package/cjs/components/Calendar/CalendarBase/CalendarBase.js +12 -0
  2. package/cjs/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
  3. package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +12 -0
  4. package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
  5. package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -0
  6. package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
  7. package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +3 -0
  8. package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
  9. package/cjs/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +3 -0
  10. package/cjs/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js.map +1 -1
  11. package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +3 -0
  12. package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
  13. package/cjs/components/Drawer/Drawer.js +4 -3
  14. package/cjs/components/Drawer/Drawer.js.map +1 -1
  15. package/cjs/components/Drawer/hooks/useDrawer.js +2 -2
  16. package/cjs/components/Drawer/hooks/useDrawer.js.map +1 -1
  17. package/cjs/components/Mask/Mask.js +3 -3
  18. package/cjs/components/Mask/Mask.js.map +1 -1
  19. package/cjs/components/Modal/Modal.js +3 -2
  20. package/cjs/components/Modal/Modal.js.map +1 -1
  21. package/cjs/components/Modal/hooks/useModal.js +1 -1
  22. package/cjs/components/Modal/hooks/useModal.js.map +1 -1
  23. package/cjs/components/Popup/Popup.js +2 -1
  24. package/cjs/components/Popup/Popup.js.map +1 -1
  25. package/cjs/components/Popup/PopupContext.js +13 -13
  26. package/cjs/components/Popup/PopupContext.js.map +1 -1
  27. package/emotion/cjs/components/Calendar/CalendarBase/CalendarBase.js +14 -0
  28. package/emotion/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +14 -0
  29. package/emotion/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -0
  30. package/emotion/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +3 -0
  31. package/emotion/cjs/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +3 -0
  32. package/emotion/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +3 -0
  33. package/emotion/cjs/components/Drawer/Drawer.js +8 -8
  34. package/emotion/cjs/components/Drawer/hooks/useDrawer.js +2 -2
  35. package/emotion/cjs/components/Mask/Mask.js +4 -4
  36. package/emotion/cjs/components/Modal/Modal.js +6 -5
  37. package/emotion/cjs/components/Modal/hooks/useModal.js +1 -1
  38. package/emotion/cjs/components/Popup/Popup.js +1 -1
  39. package/emotion/cjs/components/Popup/PopupContext.js +14 -29
  40. package/emotion/es/components/Calendar/CalendarBase/CalendarBase.js +14 -0
  41. package/emotion/es/components/Calendar/CalendarDouble/CalendarDouble.js +14 -0
  42. package/emotion/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -0
  43. package/emotion/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +3 -0
  44. package/emotion/es/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +3 -0
  45. package/emotion/es/components/Calendar/ui/CalendarYears/CalendarYears.js +3 -0
  46. package/emotion/es/components/Drawer/Drawer.js +3 -3
  47. package/emotion/es/components/Drawer/hooks/useDrawer.js +2 -2
  48. package/emotion/es/components/Mask/Mask.js +4 -4
  49. package/emotion/es/components/Modal/Modal.js +4 -3
  50. package/emotion/es/components/Modal/hooks/useModal.js +1 -1
  51. package/emotion/es/components/Popup/Popup.js +2 -2
  52. package/emotion/es/components/Popup/PopupContext.js +14 -29
  53. package/es/components/Calendar/CalendarBase/CalendarBase.js +12 -0
  54. package/es/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
  55. package/es/components/Calendar/CalendarDouble/CalendarDouble.js +12 -0
  56. package/es/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
  57. package/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -0
  58. package/es/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
  59. package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +3 -0
  60. package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
  61. package/es/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +3 -0
  62. package/es/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js.map +1 -1
  63. package/es/components/Calendar/ui/CalendarYears/CalendarYears.js +3 -0
  64. package/es/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
  65. package/es/components/Drawer/Drawer.js +4 -3
  66. package/es/components/Drawer/Drawer.js.map +1 -1
  67. package/es/components/Drawer/hooks/useDrawer.js +2 -2
  68. package/es/components/Drawer/hooks/useDrawer.js.map +1 -1
  69. package/es/components/Mask/Mask.js +3 -3
  70. package/es/components/Mask/Mask.js.map +1 -1
  71. package/es/components/Modal/Modal.js +3 -2
  72. package/es/components/Modal/Modal.js.map +1 -1
  73. package/es/components/Modal/hooks/useModal.js +1 -1
  74. package/es/components/Modal/hooks/useModal.js.map +1 -1
  75. package/es/components/Popup/Popup.js +2 -1
  76. package/es/components/Popup/Popup.js.map +1 -1
  77. package/es/components/Popup/PopupContext.js +13 -13
  78. package/es/components/Popup/PopupContext.js.map +1 -1
  79. package/package.json +4 -4
  80. package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.js +14 -0
  81. package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +14 -0
  82. package/styled-components/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -0
  83. package/styled-components/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +3 -0
  84. package/styled-components/cjs/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +3 -0
  85. package/styled-components/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +3 -0
  86. package/styled-components/cjs/components/Drawer/Drawer.js +8 -8
  87. package/styled-components/cjs/components/Drawer/hooks/useDrawer.js +2 -2
  88. package/styled-components/cjs/components/Mask/Mask.js +4 -4
  89. package/styled-components/cjs/components/Modal/Modal.js +6 -5
  90. package/styled-components/cjs/components/Modal/hooks/useModal.js +1 -1
  91. package/styled-components/cjs/components/Popup/Popup.js +1 -1
  92. package/styled-components/cjs/components/Popup/PopupContext.js +14 -29
  93. package/styled-components/es/components/Calendar/CalendarBase/CalendarBase.js +14 -0
  94. package/styled-components/es/components/Calendar/CalendarDouble/CalendarDouble.js +14 -0
  95. package/styled-components/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -0
  96. package/styled-components/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +3 -0
  97. package/styled-components/es/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +3 -0
  98. package/styled-components/es/components/Calendar/ui/CalendarYears/CalendarYears.js +3 -0
  99. package/styled-components/es/components/Drawer/Drawer.js +3 -3
  100. package/styled-components/es/components/Drawer/hooks/useDrawer.js +2 -2
  101. package/styled-components/es/components/Mask/Mask.js +4 -4
  102. package/styled-components/es/components/Modal/Modal.js +4 -3
  103. package/styled-components/es/components/Modal/hooks/useModal.js +1 -1
  104. package/styled-components/es/components/Popup/Popup.js +2 -2
  105. package/styled-components/es/components/Popup/PopupContext.js +14 -29
  106. package/types/components/Calendar/CalendarBase/CalendarBase.d.ts.map +1 -1
  107. package/types/components/Calendar/CalendarDouble/CalendarDouble.d.ts.map +1 -1
  108. package/types/components/Calendar/ui/CalendarDays/CalendarDays.d.ts.map +1 -1
  109. package/types/components/Calendar/ui/CalendarMonths/CalendarMonths.d.ts.map +1 -1
  110. package/types/components/Calendar/ui/CalendarQuarters/CalendarQuarters.d.ts.map +1 -1
  111. package/types/components/Calendar/ui/CalendarYears/CalendarYears.d.ts.map +1 -1
  112. package/types/components/Drawer/Drawer.d.ts +1 -1
  113. package/types/components/Drawer/Drawer.d.ts.map +1 -1
  114. package/types/components/Drawer/hooks/useDrawer.d.ts.map +1 -1
  115. package/types/components/Modal/Modal.d.ts +1 -1
  116. package/types/components/Modal/Modal.d.ts.map +1 -1
  117. package/types/components/Popup/Popup.d.ts +1 -1
  118. package/types/components/Popup/Popup.d.ts.map +1 -1
  119. package/types/components/Popup/Popup.types.d.ts +1 -1
  120. package/types/components/Popup/Popup.types.d.ts.map +1 -1
  121. package/types/components/Popup/PopupContext.d.ts.map +1 -1
@@ -183,6 +183,9 @@ var CalendarDays = function(param) {
183
183
  };
184
184
  var getRefs = function(element, isDayInCurrentMonth, i, j) {
185
185
  if (isDayInCurrentMonth) {
186
+ if (!outerRefs.current[i + offset]) {
187
+ outerRefs.current[i + offset] = [];
188
+ }
186
189
  outerRefs.current[i + offset][j] = element;
187
190
  }
188
191
  };
@@ -189,6 +189,9 @@ var CalendarMonths = function(param) {
189
189
  return onHoverMonth === null || onHoverMonth === void 0 ? void 0 : onHoverMonth(undefined);
190
190
  };
191
191
  var getRefs = (0, _react.useCallback)(function(element, i, j) {
192
+ if (!outerRefs.current[i + offset]) {
193
+ outerRefs.current[i + offset] = [];
194
+ }
192
195
  outerRefs.current[i + offset][j] = element;
193
196
  }, [
194
197
  offset,
@@ -188,6 +188,9 @@ var CalendarQuarters = function(param) {
188
188
  return onHoverQuarter === null || onHoverQuarter === void 0 ? void 0 : onHoverQuarter(undefined);
189
189
  };
190
190
  var getRefs = (0, _react.useCallback)(function(element, i, j) {
191
+ if (!outerRefs.current[i + offset]) {
192
+ outerRefs.current[i + offset] = [];
193
+ }
191
194
  outerRefs.current[i + offset][j] = element;
192
195
  }, [
193
196
  offset,
@@ -189,6 +189,9 @@ var CalendarYears = function(param) {
189
189
  return onHoverYear === null || onHoverYear === void 0 ? void 0 : onHoverYear(undefined);
190
190
  };
191
191
  var getRefs = (0, _react.useCallback)(function(element, i, j) {
192
+ if (!outerRefs.current[i + offset]) {
193
+ outerRefs.current[i + offset] = [];
194
+ }
192
195
  outerRefs.current[i + offset][j] = element;
193
196
  }, [
194
197
  outerRefs
@@ -18,10 +18,10 @@ _export(exports, {
18
18
  });
19
19
  var _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
20
20
  var _plasmacore = require("@salutejs/plasma-core");
21
+ var _utils = require("../../utils");
21
22
  var _Popup = require("../Popup");
22
23
  var _Overlay = require("../Overlay");
23
- var _utils = require("../Popup/utils");
24
- var _utils1 = require("../../utils");
24
+ var _utils1 = require("../Popup/utils");
25
25
  var _hooks = require("../../hooks");
26
26
  var _Drawertokens = require("./Drawer.tokens");
27
27
  var _base = require("./variations/_view/base");
@@ -160,11 +160,11 @@ var drawerRoot = function(Root) {
160
160
  var trapRef = (0, _hooks.useFocusTrap)(true, initialFocusRef, focusAfterRef);
161
161
  var popupController = (0, _Popup.usePopupContext)();
162
162
  var innerRef = (0, _plasmacore.useForkRef)(trapRef, outerRef);
163
- var uniqId = (0, _plasmacore.safeUseId)();
163
+ var uniqId = (0, _utils.safeUseId)();
164
164
  var innerId = id || uniqId;
165
165
  var overlayBackgroundToken = withBlur ? "var(".concat(_Drawertokens.tokens.drawerOverlayWithBlurColor, ")") : "var(".concat(_Drawertokens.tokens.drawerOverlayColor, ")");
166
- var innerWidth = width ? (0, _utils1.getSizeValueFromProp)(width) : '100%';
167
- var innerHeight = height ? (0, _utils1.getSizeValueFromProp)(height) : '100%';
166
+ var innerWidth = width ? (0, _utils.getSizeValueFromProp)(width) : '100%';
167
+ var innerHeight = height ? (0, _utils.getSizeValueFromProp)(height) : '100%';
168
168
  var placementClass = placement ? _Drawertokens.classes["".concat(placement, "Placement")] : undefined;
169
169
  var drawerInfo = (0, _hooks1.useDrawer)({
170
170
  id: innerId,
@@ -176,7 +176,7 @@ var drawerRoot = function(Root) {
176
176
  disableScroll: asModal
177
177
  }).drawerInfo;
178
178
  var transparent = (0, _react.useMemo)(function() {
179
- return (0, _DrawerContext.getIdLastDrawer)(popupController.items) !== innerId;
179
+ return (0, _DrawerContext.getIdLastDrawer)(Array.from(popupController.items.values())) !== innerId;
180
180
  }, [
181
181
  innerId,
182
182
  popupController.items
@@ -193,7 +193,7 @@ var drawerRoot = function(Root) {
193
193
  return /*#__PURE__*/ _react.default.createElement(_Drawerstyles.StyledPopup, _object_spread({
194
194
  id: innerId,
195
195
  ref: asModal ? innerRef : outerRef,
196
- className: (0, _utils1.cx)(placementClass),
196
+ className: (0, _utils.cx)(placementClass),
197
197
  opened: innerIsOpen,
198
198
  zIndex: zIndex,
199
199
  placement: placement,
@@ -207,7 +207,7 @@ var drawerRoot = function(Root) {
207
207
  view: view
208
208
  }, /*#__PURE__*/ _react.default.createElement(_Overlay.Overlay, {
209
209
  className: _Drawertokens.classes.overlay,
210
- zIndex: zIndex || _utils.DEFAULT_Z_INDEX,
210
+ zIndex: zIndex || _utils1.DEFAULT_Z_INDEX,
211
211
  backgroundColorProperty: overlayBackgroundToken,
212
212
  withBlur: withBlur,
213
213
  transparent: transparent,
@@ -50,7 +50,7 @@ var useDrawer = function(param) {
50
50
  if (!closeOnEsc) {
51
51
  return;
52
52
  }
53
- if (event.keyCode === ESCAPE_KEYCODE && (0, _DrawerContext.getIdLastDrawer)(popupController.items) === id) {
53
+ if (event.keyCode === ESCAPE_KEYCODE && (0, _DrawerContext.getIdLastDrawer)(Array.from(popupController.items.values())) === id) {
54
54
  if (onEscKeyDown) {
55
55
  onEscKeyDown(event);
56
56
  return;
@@ -90,7 +90,7 @@ var useDrawer = function(param) {
90
90
  if (!_utils.canUseDOM) {
91
91
  return;
92
92
  }
93
- if (!isOpen && !(0, _DrawerContext.hasDrawers)(popupController.items)) {
93
+ if (!isOpen && !(0, _DrawerContext.hasDrawers)(Array.from(popupController.items.values()))) {
94
94
  document.body.style.overflow = overflow.current;
95
95
  }
96
96
  }, [
@@ -158,14 +158,14 @@ function _unsupported_iterable_to_array(o, minLen) {
158
158
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
159
159
  }
160
160
  var defaultFormatChars = [
161
- {
162
- str: '0',
163
- regexp: /[0-9]/
164
- },
165
161
  {
166
162
  str: '*',
167
163
  regexp: /./
168
164
  },
165
+ {
166
+ str: '0',
167
+ regexp: /[0-9]/
168
+ },
169
169
  {
170
170
  str: 'a',
171
171
  regexp: /[a-zA-Z]/
@@ -18,11 +18,12 @@ _export(exports, {
18
18
  });
19
19
  var _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
20
20
  var _plasmacore = require("@salutejs/plasma-core");
21
+ var _utils = require("../../utils");
21
22
  var _engines = require("../../engines");
23
+ var _hooks = require("../../hooks");
22
24
  var _Popup = require("../Popup");
23
25
  var _Overlay = require("../Overlay");
24
- var _utils = require("../Popup/utils");
25
- var _hooks = require("../../hooks");
26
+ var _utils1 = require("../Popup/utils");
26
27
  var _IconClose = require("../_Icon/Icons/IconClose");
27
28
  var _Modaltokens = require("./Modal.tokens");
28
29
  var _hooks1 = require("./hooks");
@@ -154,7 +155,7 @@ var modalRoot = function(Root) {
154
155
  var trapRef = (0, _hooks.useFocusTrap)(true, initialFocusRef, focusAfterRef, true);
155
156
  var popupController = (0, _Popup.usePopupContext)();
156
157
  var innerRef = (0, _plasmacore.useForkRef)(trapRef, outerRootRef);
157
- var uniqId = (0, _plasmacore.safeUseId)();
158
+ var uniqId = (0, _utils.safeUseId)();
158
159
  var innerId = id || uniqId;
159
160
  var overlayBackgroundToken = withBlur ? "var(".concat(_Modaltokens.tokens.modalOverlayWithBlurColor, ")") : "var(".concat(_Modaltokens.tokens.modalOverlayColor, ")");
160
161
  var modalInfo = (0, _hooks1.useModal)({
@@ -166,7 +167,7 @@ var modalRoot = function(Root) {
166
167
  popupInfo: popupInfo
167
168
  }).modalInfo;
168
169
  var transparent = (0, _react.useMemo)(function() {
169
- return (0, _ModalContext.getIdLastModal)(popupController.items) !== innerId;
170
+ return (0, _ModalContext.getIdLastModal)(Array.from(popupController.items.values())) !== innerId;
170
171
  }, [
171
172
  innerId,
172
173
  popupController.items
@@ -186,7 +187,7 @@ var modalRoot = function(Root) {
186
187
  ]);
187
188
  var overlayNode = /*#__PURE__*/ _react.default.createElement(_Overlay.Overlay, {
188
189
  className: _Modaltokens.classes.overlay,
189
- zIndex: zIndex || _utils.DEFAULT_Z_INDEX,
190
+ zIndex: zIndex || _utils1.DEFAULT_Z_INDEX,
190
191
  backgroundColorProperty: overlayBackgroundToken,
191
192
  withBlur: withBlur,
192
193
  transparent: transparent,
@@ -48,7 +48,7 @@ var useModal = function(param) {
48
48
  if (!closeOnEsc) {
49
49
  return;
50
50
  }
51
- if (event.keyCode === ESCAPE_KEYCODE && (0, _ModalContext.getIdLastModal)(popupController.items) === id) {
51
+ if (event.keyCode === ESCAPE_KEYCODE && (0, _ModalContext.getIdLastModal)(Array.from(popupController.items.values())) === id) {
52
52
  if (onEscKeyDown) {
53
53
  onEscKeyDown(event);
54
54
  return;
@@ -246,7 +246,7 @@ var popupRoot = function(Root) {
246
246
  "className"
247
247
  ]);
248
248
  var innerIsOpen = isOpen || opened;
249
- var uniqId = (0, _plasmacore.safeUseId)();
249
+ var uniqId = (0, _utils.safeUseId)();
250
250
  var innerId = id || uniqId;
251
251
  var _usePopup = (0, _hooks.usePopup)({
252
252
  isOpen: innerIsOpen,
@@ -20,9 +20,9 @@ _export(exports, {
20
20
  }
21
21
  });
22
22
  var _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
23
+ var _utils = require("../../utils");
23
24
  var _Portal = require("../Portal");
24
25
  var _ModalContext = require("../Modal/ModalContext");
25
- var _utils = require("../../utils");
26
26
  var _ClientOnlyPortal = require("./ClientOnlyPortal");
27
27
  var _Popupstyles = require("./Popup.styles");
28
28
  function _array_like_to_array(arr, len) {
@@ -33,9 +33,6 @@ function _array_like_to_array(arr, len) {
33
33
  function _array_with_holes(arr) {
34
34
  if (Array.isArray(arr)) return arr;
35
35
  }
36
- function _array_without_holes(arr) {
37
- if (Array.isArray(arr)) return _array_like_to_array(arr);
38
- }
39
36
  function _getRequireWildcardCache(nodeInterop) {
40
37
  if (typeof WeakMap !== "function") return null;
41
38
  var cacheBabelInterop = new WeakMap();
@@ -77,9 +74,6 @@ function _interop_require_wildcard(obj, nodeInterop) {
77
74
  }
78
75
  return newObj;
79
76
  }
80
- function _iterable_to_array(iter) {
81
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
82
- }
83
77
  function _iterable_to_array_limit(arr, i) {
84
78
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
85
79
  if (_i == null) return;
@@ -107,15 +101,9 @@ function _iterable_to_array_limit(arr, i) {
107
101
  function _non_iterable_rest() {
108
102
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
109
103
  }
110
- function _non_iterable_spread() {
111
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
112
- }
113
104
  function _sliced_to_array(arr, i) {
114
105
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
115
106
  }
116
- function _to_consumable_array(arr) {
117
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
118
- }
119
107
  function _unsupported_iterable_to_array(o, minLen) {
120
108
  if (!o) return;
121
109
  if (typeof o === "string") return _array_like_to_array(o, minLen);
@@ -125,9 +113,9 @@ function _unsupported_iterable_to_array(o, minLen) {
125
113
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
126
114
  }
127
115
  var POPUP_PORTAL_ID = 'plasma-popup-root';
128
- var items = [];
116
+ var initialItems = new Map();
129
117
  var PopupContext = /*#__PURE__*/ (0, _react.createContext)({
130
- items: items,
118
+ items: initialItems,
131
119
  rootId: POPUP_PORTAL_ID,
132
120
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
133
121
  register: function register(_info) {
@@ -144,7 +132,7 @@ var usePopupContext = function() {
144
132
  var PopupProvider = function(param) {
145
133
  var children = param.children, UNSAFE_SSR_ENABLED = param.UNSAFE_SSR_ENABLED;
146
134
  var prevBodyOverflowY = (0, _react.useRef)(_utils.canUseDOM ? document.body.style.overflowY : '');
147
- var _useState = _sliced_to_array((0, _react.useState)([]), 2), items = _useState[0], setItems = _useState[1];
135
+ var _useState = _sliced_to_array((0, _react.useState)(initialItems), 2), items = _useState[0], setItems = _useState[1];
148
136
  var uuid = (0, _utils.safeUseId)();
149
137
  var rootId = "".concat(POPUP_PORTAL_ID, "-").concat(uuid);
150
138
  var register = function(info) {
@@ -153,13 +141,13 @@ var PopupProvider = function(param) {
153
141
  }
154
142
  setItems(function(prevItems) {
155
143
  var _info_info;
156
- if (((_info_info = info.info) === null || _info_info === void 0 ? void 0 : _info_info.isModal) && !(0, _ModalContext.hasModals)(prevItems)) {
144
+ var newItems = new Map(prevItems);
145
+ if (((_info_info = info.info) === null || _info_info === void 0 ? void 0 : _info_info.isModal) && !(0, _ModalContext.hasModals)(Array.from(prevItems.values()))) {
157
146
  prevBodyOverflowY.current = document.body.style.overflowY;
158
147
  document.body.style.overflowY = 'hidden';
159
148
  }
160
- return _to_consumable_array(prevItems).concat([
161
- info
162
- ]);
149
+ newItems.set(info.id, info);
150
+ return newItems;
163
151
  });
164
152
  };
165
153
  var unregister = function(id) {
@@ -167,19 +155,16 @@ var PopupProvider = function(param) {
167
155
  return;
168
156
  }
169
157
  setItems(function(prevItems) {
170
- var index = prevItems.findIndex(function(item) {
171
- return id === item.id;
172
- });
173
- if (index === -1) {
158
+ if (!prevItems.has(id)) {
174
159
  return prevItems;
175
160
  }
176
- var prevHasModals = (0, _ModalContext.hasModals)(prevItems);
177
- prevItems.splice(index, 1);
178
- if (prevHasModals && !(0, _ModalContext.hasModals)(prevItems)) {
161
+ var newItems = new Map(prevItems);
162
+ var prevHasModals = (0, _ModalContext.hasModals)(Array.from(newItems.values()));
163
+ newItems.delete(id);
164
+ if (prevHasModals && !(0, _ModalContext.hasModals)(Array.from(newItems.values()))) {
179
165
  document.body.style.overflowY = prevBodyOverflowY.current;
180
166
  }
181
- // при return prevItems не обновится контекст
182
- return _to_consumable_array(prevItems);
167
+ return newItems;
183
168
  });
184
169
  };
185
170
  var context = {
@@ -193,6 +193,20 @@ import { IsOutOfRange, StyledCalendar } from "./CalendarBase.styles";
193
193
  }, [
194
194
  calendarState
195
195
  ]);
196
+ useEffect(function() {
197
+ if (prevType !== type) {
198
+ dispatch({
199
+ type: ActionType.UPDATE_CALENDAR_STATE,
200
+ payload: {
201
+ calendarState: type,
202
+ size: sizeMap[type].single
203
+ }
204
+ });
205
+ setPrevType(type);
206
+ }
207
+ }, [
208
+ type
209
+ ]);
196
210
  useEffect(function() {
197
211
  if (value && prevValue && isValueUpdate(value, prevValue) || value && !prevValue) {
198
212
  dispatch({
@@ -239,6 +239,20 @@ import { StyledCalendar, StyledSeparator, StyledWrapper } from "./CalendarDouble
239
239
  }, [
240
240
  calendarState
241
241
  ]);
242
+ useEffect(function() {
243
+ if (prevType !== type) {
244
+ dispatch({
245
+ type: ActionType.UPDATE_CALENDAR_STATE,
246
+ payload: {
247
+ calendarState: type,
248
+ size: sizeMap[type].double
249
+ }
250
+ });
251
+ setPrevType(type);
252
+ }
253
+ }, [
254
+ type
255
+ ]);
242
256
  useEffect(function() {
243
257
  if (value && prevValue && isValueUpdate(value, prevValue) || value && !prevValue) {
244
258
  var _getBoundaryDates = _sliced_to_array(getBoundaryDates(), 2), minVisibleDate = _getBoundaryDates[0], maxVisibleDate = _getBoundaryDates[1];
@@ -134,6 +134,9 @@ import { StyledCalendarDays, StyledCalendarDaysHint } from "./CalendarDays.style
134
134
  };
135
135
  var getRefs = function(element, isDayInCurrentMonth, i, j) {
136
136
  if (isDayInCurrentMonth) {
137
+ if (!outerRefs.current[i + offset]) {
138
+ outerRefs.current[i + offset] = [];
139
+ }
137
140
  outerRefs.current[i + offset][j] = element;
138
141
  }
139
142
  };
@@ -140,6 +140,9 @@ import { StyledCalendarMonths } from "./CalendarMonths.styles";
140
140
  return onHoverMonth === null || onHoverMonth === void 0 ? void 0 : onHoverMonth(undefined);
141
141
  };
142
142
  var getRefs = useCallback(function(element, i, j) {
143
+ if (!outerRefs.current[i + offset]) {
144
+ outerRefs.current[i + offset] = [];
145
+ }
143
146
  outerRefs.current[i + offset][j] = element;
144
147
  }, [
145
148
  offset,
@@ -139,6 +139,9 @@ import { StyledCalendarQuarters } from "./CalendarQuarters.styles";
139
139
  return onHoverQuarter === null || onHoverQuarter === void 0 ? void 0 : onHoverQuarter(undefined);
140
140
  };
141
141
  var getRefs = useCallback(function(element, i, j) {
142
+ if (!outerRefs.current[i + offset]) {
143
+ outerRefs.current[i + offset] = [];
144
+ }
142
145
  outerRefs.current[i + offset][j] = element;
143
146
  }, [
144
147
  offset,
@@ -140,6 +140,9 @@ import { StyledCalendarYears } from "./CalendarYears.styles";
140
140
  return onHoverYear === null || onHoverYear === void 0 ? void 0 : onHoverYear(undefined);
141
141
  };
142
142
  var getRefs = useCallback(function(element, i, j) {
143
+ if (!outerRefs.current[i + offset]) {
144
+ outerRefs.current[i + offset] = [];
145
+ }
143
146
  outerRefs.current[i + offset][j] = element;
144
147
  }, [
145
148
  outerRefs
@@ -54,11 +54,11 @@ function _object_without_properties_loose(source, excluded) {
54
54
  return target;
55
55
  }
56
56
  import React, { forwardRef, useMemo } from "react";
57
- import { useForkRef, safeUseId } from "@salutejs/plasma-core";
57
+ import { useForkRef } from "@salutejs/plasma-core";
58
+ import { cx, getSizeValueFromProp, safeUseId } from "../../utils";
58
59
  import { usePopupContext } from "../Popup";
59
60
  import { Overlay } from "../Overlay";
60
61
  import { DEFAULT_Z_INDEX } from "../Popup/utils";
61
- import { cx, getSizeValueFromProp } from "../../utils";
62
62
  import { useFocusTrap } from "../../hooks";
63
63
  import { classes, tokens } from "./Drawer.tokens";
64
64
  import { base as viewCSS } from "./variations/_view/base";
@@ -118,7 +118,7 @@ export var drawerRoot = function(Root) {
118
118
  disableScroll: asModal
119
119
  }).drawerInfo;
120
120
  var transparent = useMemo(function() {
121
- return getIdLastDrawer(popupController.items) !== innerId;
121
+ return getIdLastDrawer(Array.from(popupController.items.values())) !== innerId;
122
122
  }, [
123
123
  innerId,
124
124
  popupController.items
@@ -40,7 +40,7 @@ export var useDrawer = function(param) {
40
40
  if (!closeOnEsc) {
41
41
  return;
42
42
  }
43
- if (event.keyCode === ESCAPE_KEYCODE && getIdLastDrawer(popupController.items) === id) {
43
+ if (event.keyCode === ESCAPE_KEYCODE && getIdLastDrawer(Array.from(popupController.items.values())) === id) {
44
44
  if (onEscKeyDown) {
45
45
  onEscKeyDown(event);
46
46
  return;
@@ -80,7 +80,7 @@ export var useDrawer = function(param) {
80
80
  if (!canUseDOM) {
81
81
  return;
82
82
  }
83
- if (!isOpen && !hasDrawers(popupController.items)) {
83
+ if (!isOpen && !hasDrawers(Array.from(popupController.items.values()))) {
84
84
  document.body.style.overflow = overflow.current;
85
85
  }
86
86
  }, [
@@ -102,14 +102,14 @@ function _unsupported_iterable_to_array(o, minLen) {
102
102
  import React, { forwardRef, useImperativeHandle, useState } from "react";
103
103
  import maskInputCompose from "@salutejs/react-maskinput";
104
104
  var defaultFormatChars = [
105
- {
106
- str: '0',
107
- regexp: /[0-9]/
108
- },
109
105
  {
110
106
  str: '*',
111
107
  regexp: /./
112
108
  },
109
+ {
110
+ str: '0',
111
+ regexp: /[0-9]/
112
+ },
113
113
  {
114
114
  str: 'a',
115
115
  regexp: /[a-zA-Z]/
@@ -54,12 +54,13 @@ function _object_without_properties_loose(source, excluded) {
54
54
  return target;
55
55
  }
56
56
  import React, { forwardRef, useCallback, useMemo } from "react";
57
- import { useForkRef, safeUseId } from "@salutejs/plasma-core";
57
+ import { useForkRef } from "@salutejs/plasma-core";
58
+ import { safeUseId } from "../../utils";
58
59
  import { component } from "../../engines";
60
+ import { useFocusTrap } from "../../hooks";
59
61
  import { popupConfig, usePopupContext } from "../Popup";
60
62
  import { Overlay } from "../Overlay";
61
63
  import { DEFAULT_Z_INDEX } from "../Popup/utils";
62
- import { useFocusTrap } from "../../hooks";
63
64
  import { IconClose } from "../_Icon/Icons/IconClose";
64
65
  import { classes, tokens } from "./Modal.tokens";
65
66
  import { useModal } from "./hooks";
@@ -110,7 +111,7 @@ var Popup = component(popupConfig);
110
111
  popupInfo: popupInfo
111
112
  }).modalInfo;
112
113
  var transparent = useMemo(function() {
113
- return getIdLastModal(popupController.items) !== innerId;
114
+ return getIdLastModal(Array.from(popupController.items.values())) !== innerId;
114
115
  }, [
115
116
  innerId,
116
117
  popupController.items
@@ -38,7 +38,7 @@ export var useModal = function(param) {
38
38
  if (!closeOnEsc) {
39
39
  return;
40
40
  }
41
- if (event.keyCode === ESCAPE_KEYCODE && getIdLastModal(popupController.items) === id) {
41
+ if (event.keyCode === ESCAPE_KEYCODE && getIdLastModal(Array.from(popupController.items.values())) === id) {
42
42
  if (onEscKeyDown) {
43
43
  onEscKeyDown(event);
44
44
  return;
@@ -100,8 +100,8 @@ function _unsupported_iterable_to_array(o, minLen) {
100
100
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
101
101
  }
102
102
  import React, { forwardRef, useRef } from "react";
103
- import { useForkRef, safeUseId } from "@salutejs/plasma-core";
104
- import { canUseDOM, cx } from "../../utils";
103
+ import { useForkRef } from "@salutejs/plasma-core";
104
+ import { canUseDOM, cx, safeUseId } from "../../utils";
105
105
  import { Portal } from "../Portal";
106
106
  import { PopupRoot } from "./PopupRoot";
107
107
  import { usePopup } from "./hooks";
@@ -6,12 +6,6 @@ function _array_like_to_array(arr, len) {
6
6
  function _array_with_holes(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
- function _array_without_holes(arr) {
10
- if (Array.isArray(arr)) return _array_like_to_array(arr);
11
- }
12
- function _iterable_to_array(iter) {
13
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
14
- }
15
9
  function _iterable_to_array_limit(arr, i) {
16
10
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
17
11
  if (_i == null) return;
@@ -39,15 +33,9 @@ function _iterable_to_array_limit(arr, i) {
39
33
  function _non_iterable_rest() {
40
34
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
41
35
  }
42
- function _non_iterable_spread() {
43
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44
- }
45
36
  function _sliced_to_array(arr, i) {
46
37
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
47
38
  }
48
- function _to_consumable_array(arr) {
49
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
50
- }
51
39
  function _unsupported_iterable_to_array(o, minLen) {
52
40
  if (!o) return;
53
41
  if (typeof o === "string") return _array_like_to_array(o, minLen);
@@ -57,15 +45,15 @@ function _unsupported_iterable_to_array(o, minLen) {
57
45
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
58
46
  }
59
47
  import React, { createContext, useState, useContext, useRef } from "react";
48
+ import { canUseDOM, safeUseId } from "../../utils";
60
49
  import { Portal } from "../Portal";
61
50
  import { hasModals } from "../Modal/ModalContext";
62
- import { canUseDOM, safeUseId } from "../../utils";
63
51
  import { ClientOnlyPortal } from "./ClientOnlyPortal";
64
52
  import { StyledPortal } from "./Popup.styles";
65
53
  export var POPUP_PORTAL_ID = 'plasma-popup-root';
66
- var items = [];
54
+ var initialItems = new Map();
67
55
  var PopupContext = /*#__PURE__*/ createContext({
68
- items: items,
56
+ items: initialItems,
69
57
  rootId: POPUP_PORTAL_ID,
70
58
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
71
59
  register: function register(_info) {
@@ -83,7 +71,7 @@ export var usePopupContext = function() {
83
71
  export var PopupProvider = function(param) {
84
72
  var children = param.children, UNSAFE_SSR_ENABLED = param.UNSAFE_SSR_ENABLED;
85
73
  var prevBodyOverflowY = useRef(canUseDOM ? document.body.style.overflowY : '');
86
- var _useState = _sliced_to_array(useState([]), 2), items = _useState[0], setItems = _useState[1];
74
+ var _useState = _sliced_to_array(useState(initialItems), 2), items = _useState[0], setItems = _useState[1];
87
75
  var uuid = safeUseId();
88
76
  var rootId = "".concat(POPUP_PORTAL_ID, "-").concat(uuid);
89
77
  var register = function(info) {
@@ -92,13 +80,13 @@ export var PopupProvider = function(param) {
92
80
  }
93
81
  setItems(function(prevItems) {
94
82
  var _info_info;
95
- if (((_info_info = info.info) === null || _info_info === void 0 ? void 0 : _info_info.isModal) && !hasModals(prevItems)) {
83
+ var newItems = new Map(prevItems);
84
+ if (((_info_info = info.info) === null || _info_info === void 0 ? void 0 : _info_info.isModal) && !hasModals(Array.from(prevItems.values()))) {
96
85
  prevBodyOverflowY.current = document.body.style.overflowY;
97
86
  document.body.style.overflowY = 'hidden';
98
87
  }
99
- return _to_consumable_array(prevItems).concat([
100
- info
101
- ]);
88
+ newItems.set(info.id, info);
89
+ return newItems;
102
90
  });
103
91
  };
104
92
  var unregister = function(id) {
@@ -106,19 +94,16 @@ export var PopupProvider = function(param) {
106
94
  return;
107
95
  }
108
96
  setItems(function(prevItems) {
109
- var index = prevItems.findIndex(function(item) {
110
- return id === item.id;
111
- });
112
- if (index === -1) {
97
+ if (!prevItems.has(id)) {
113
98
  return prevItems;
114
99
  }
115
- var prevHasModals = hasModals(prevItems);
116
- prevItems.splice(index, 1);
117
- if (prevHasModals && !hasModals(prevItems)) {
100
+ var newItems = new Map(prevItems);
101
+ var prevHasModals = hasModals(Array.from(newItems.values()));
102
+ newItems.delete(id);
103
+ if (prevHasModals && !hasModals(Array.from(newItems.values()))) {
118
104
  document.body.style.overflowY = prevBodyOverflowY.current;
119
105
  }
120
- // при return prevItems не обновится контекст
121
- return _to_consumable_array(prevItems);
106
+ return newItems;
122
107
  });
123
108
  };
124
109
  var context = {
@@ -104,6 +104,18 @@ const calendarBaseRoot = Root => /*#__PURE__*/forwardRef(({
104
104
  setPrevType(calendarState);
105
105
  }
106
106
  }, [calendarState]);
107
+ useEffect(() => {
108
+ if (prevType !== type) {
109
+ dispatch({
110
+ type: ActionType.UPDATE_CALENDAR_STATE,
111
+ payload: {
112
+ calendarState: type,
113
+ size: sizeMap[type].single
114
+ }
115
+ });
116
+ setPrevType(type);
117
+ }
118
+ }, [type]);
107
119
  useEffect(() => {
108
120
  if (value && prevValue && isValueUpdate(value, prevValue) || value && !prevValue) {
109
121
  dispatch({