@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.
- package/cjs/components/Calendar/CalendarBase/CalendarBase.js +12 -0
- package/cjs/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
- package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +12 -0
- package/cjs/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -0
- package/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +3 -0
- package/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +3 -0
- package/cjs/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js.map +1 -1
- package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +3 -0
- package/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
- package/cjs/components/Drawer/Drawer.js +4 -3
- package/cjs/components/Drawer/Drawer.js.map +1 -1
- package/cjs/components/Drawer/hooks/useDrawer.js +2 -2
- package/cjs/components/Drawer/hooks/useDrawer.js.map +1 -1
- package/cjs/components/Mask/Mask.js +3 -3
- package/cjs/components/Mask/Mask.js.map +1 -1
- package/cjs/components/Modal/Modal.js +3 -2
- package/cjs/components/Modal/Modal.js.map +1 -1
- package/cjs/components/Modal/hooks/useModal.js +1 -1
- package/cjs/components/Modal/hooks/useModal.js.map +1 -1
- package/cjs/components/Popup/Popup.js +2 -1
- package/cjs/components/Popup/Popup.js.map +1 -1
- package/cjs/components/Popup/PopupContext.js +13 -13
- package/cjs/components/Popup/PopupContext.js.map +1 -1
- package/emotion/cjs/components/Calendar/CalendarBase/CalendarBase.js +14 -0
- package/emotion/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +14 -0
- package/emotion/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -0
- package/emotion/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +3 -0
- package/emotion/cjs/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +3 -0
- package/emotion/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +3 -0
- package/emotion/cjs/components/Drawer/Drawer.js +8 -8
- package/emotion/cjs/components/Drawer/hooks/useDrawer.js +2 -2
- package/emotion/cjs/components/Mask/Mask.js +4 -4
- package/emotion/cjs/components/Modal/Modal.js +6 -5
- package/emotion/cjs/components/Modal/hooks/useModal.js +1 -1
- package/emotion/cjs/components/Popup/Popup.js +1 -1
- package/emotion/cjs/components/Popup/PopupContext.js +14 -29
- package/emotion/es/components/Calendar/CalendarBase/CalendarBase.js +14 -0
- package/emotion/es/components/Calendar/CalendarDouble/CalendarDouble.js +14 -0
- package/emotion/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -0
- package/emotion/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +3 -0
- package/emotion/es/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +3 -0
- package/emotion/es/components/Calendar/ui/CalendarYears/CalendarYears.js +3 -0
- package/emotion/es/components/Drawer/Drawer.js +3 -3
- package/emotion/es/components/Drawer/hooks/useDrawer.js +2 -2
- package/emotion/es/components/Mask/Mask.js +4 -4
- package/emotion/es/components/Modal/Modal.js +4 -3
- package/emotion/es/components/Modal/hooks/useModal.js +1 -1
- package/emotion/es/components/Popup/Popup.js +2 -2
- package/emotion/es/components/Popup/PopupContext.js +14 -29
- package/es/components/Calendar/CalendarBase/CalendarBase.js +12 -0
- package/es/components/Calendar/CalendarBase/CalendarBase.js.map +1 -1
- package/es/components/Calendar/CalendarDouble/CalendarDouble.js +12 -0
- package/es/components/Calendar/CalendarDouble/CalendarDouble.js.map +1 -1
- package/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -0
- package/es/components/Calendar/ui/CalendarDays/CalendarDays.js.map +1 -1
- package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +3 -0
- package/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js.map +1 -1
- package/es/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +3 -0
- package/es/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js.map +1 -1
- package/es/components/Calendar/ui/CalendarYears/CalendarYears.js +3 -0
- package/es/components/Calendar/ui/CalendarYears/CalendarYears.js.map +1 -1
- package/es/components/Drawer/Drawer.js +4 -3
- package/es/components/Drawer/Drawer.js.map +1 -1
- package/es/components/Drawer/hooks/useDrawer.js +2 -2
- package/es/components/Drawer/hooks/useDrawer.js.map +1 -1
- package/es/components/Mask/Mask.js +3 -3
- package/es/components/Mask/Mask.js.map +1 -1
- package/es/components/Modal/Modal.js +3 -2
- package/es/components/Modal/Modal.js.map +1 -1
- package/es/components/Modal/hooks/useModal.js +1 -1
- package/es/components/Modal/hooks/useModal.js.map +1 -1
- package/es/components/Popup/Popup.js +2 -1
- package/es/components/Popup/Popup.js.map +1 -1
- package/es/components/Popup/PopupContext.js +13 -13
- package/es/components/Popup/PopupContext.js.map +1 -1
- package/package.json +4 -4
- package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.js +14 -0
- package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +14 -0
- package/styled-components/cjs/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -0
- package/styled-components/cjs/components/Calendar/ui/CalendarMonths/CalendarMonths.js +3 -0
- package/styled-components/cjs/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +3 -0
- package/styled-components/cjs/components/Calendar/ui/CalendarYears/CalendarYears.js +3 -0
- package/styled-components/cjs/components/Drawer/Drawer.js +8 -8
- package/styled-components/cjs/components/Drawer/hooks/useDrawer.js +2 -2
- package/styled-components/cjs/components/Mask/Mask.js +4 -4
- package/styled-components/cjs/components/Modal/Modal.js +6 -5
- package/styled-components/cjs/components/Modal/hooks/useModal.js +1 -1
- package/styled-components/cjs/components/Popup/Popup.js +1 -1
- package/styled-components/cjs/components/Popup/PopupContext.js +14 -29
- package/styled-components/es/components/Calendar/CalendarBase/CalendarBase.js +14 -0
- package/styled-components/es/components/Calendar/CalendarDouble/CalendarDouble.js +14 -0
- package/styled-components/es/components/Calendar/ui/CalendarDays/CalendarDays.js +3 -0
- package/styled-components/es/components/Calendar/ui/CalendarMonths/CalendarMonths.js +3 -0
- package/styled-components/es/components/Calendar/ui/CalendarQuarters/CalendarQuarters.js +3 -0
- package/styled-components/es/components/Calendar/ui/CalendarYears/CalendarYears.js +3 -0
- package/styled-components/es/components/Drawer/Drawer.js +3 -3
- package/styled-components/es/components/Drawer/hooks/useDrawer.js +2 -2
- package/styled-components/es/components/Mask/Mask.js +4 -4
- package/styled-components/es/components/Modal/Modal.js +4 -3
- package/styled-components/es/components/Modal/hooks/useModal.js +1 -1
- package/styled-components/es/components/Popup/Popup.js +2 -2
- package/styled-components/es/components/Popup/PopupContext.js +14 -29
- package/types/components/Calendar/CalendarBase/CalendarBase.d.ts.map +1 -1
- package/types/components/Calendar/CalendarDouble/CalendarDouble.d.ts.map +1 -1
- package/types/components/Calendar/ui/CalendarDays/CalendarDays.d.ts.map +1 -1
- package/types/components/Calendar/ui/CalendarMonths/CalendarMonths.d.ts.map +1 -1
- package/types/components/Calendar/ui/CalendarQuarters/CalendarQuarters.d.ts.map +1 -1
- package/types/components/Calendar/ui/CalendarYears/CalendarYears.d.ts.map +1 -1
- package/types/components/Drawer/Drawer.d.ts +1 -1
- package/types/components/Drawer/Drawer.d.ts.map +1 -1
- package/types/components/Drawer/hooks/useDrawer.d.ts.map +1 -1
- package/types/components/Modal/Modal.d.ts +1 -1
- package/types/components/Modal/Modal.d.ts.map +1 -1
- package/types/components/Popup/Popup.d.ts +1 -1
- package/types/components/Popup/Popup.d.ts.map +1 -1
- package/types/components/Popup/Popup.types.d.ts +1 -1
- package/types/components/Popup/Popup.types.d.ts.map +1 -1
- 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
|
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,
|
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,
|
167
|
-
var innerHeight = height ? (0,
|
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,
|
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 ||
|
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
|
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,
|
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 ||
|
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,
|
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
|
116
|
+
var initialItems = new Map();
|
129
117
|
var PopupContext = /*#__PURE__*/ (0, _react.createContext)({
|
130
|
-
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)(
|
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
|
-
|
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
|
-
|
161
|
-
|
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
|
-
|
171
|
-
return id === item.id;
|
172
|
-
});
|
173
|
-
if (index === -1) {
|
158
|
+
if (!prevItems.has(id)) {
|
174
159
|
return prevItems;
|
175
160
|
}
|
176
|
-
var
|
177
|
-
|
178
|
-
|
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
|
-
|
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
|
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
|
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
|
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
|
54
|
+
var initialItems = new Map();
|
67
55
|
var PopupContext = /*#__PURE__*/ createContext({
|
68
|
-
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(
|
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
|
-
|
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
|
-
|
100
|
-
|
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
|
-
|
110
|
-
return id === item.id;
|
111
|
-
});
|
112
|
-
if (index === -1) {
|
97
|
+
if (!prevItems.has(id)) {
|
113
98
|
return prevItems;
|
114
99
|
}
|
115
|
-
var
|
116
|
-
|
117
|
-
|
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
|
-
|
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({
|