@salutejs/plasma-new-hope 0.327.0-canary.2022.15754718552.0 → 0.327.0-canary.2024.15730742214.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 +14 -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 +3 -4
- 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 +2 -3
- 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 +1 -2
- package/cjs/components/Popup/Popup.js.map +1 -1
- package/cjs/components/Popup/PopupContext.js +15 -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 +12 -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 +3 -3
- package/emotion/cjs/components/Modal/Modal.js +5 -6
- 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 +20 -14
- package/emotion/es/components/Calendar/CalendarBase/CalendarBase.js +14 -0
- package/emotion/es/components/Calendar/CalendarDouble/CalendarDouble.js +12 -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 +3 -3
- package/emotion/es/components/Modal/Modal.js +3 -4
- 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 +20 -14
- package/es/components/Calendar/CalendarBase/CalendarBase.js +14 -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 +3 -4
- 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 +2 -3
- 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 +1 -2
- package/es/components/Popup/Popup.js.map +1 -1
- package/es/components/Popup/PopupContext.js +16 -14
- package/es/components/Popup/PopupContext.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Calendar/CalendarBase/CalendarBase.js +14 -0
- package/styled-components/cjs/components/Calendar/CalendarDouble/CalendarDouble.js +12 -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 +3 -3
- package/styled-components/cjs/components/Modal/Modal.js +5 -6
- 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 +20 -14
- package/styled-components/es/components/Calendar/CalendarBase/CalendarBase.js +14 -0
- package/styled-components/es/components/Calendar/CalendarDouble/CalendarDouble.js +12 -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 +3 -3
- package/styled-components/es/components/Modal/Modal.js +3 -4
- 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 +20 -14
- 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
@@ -16,9 +16,9 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
17
17
|
|
18
18
|
var POPUP_PORTAL_ID = 'plasma-popup-root';
|
19
|
-
var
|
19
|
+
var items = [];
|
20
20
|
var PopupContext = /*#__PURE__*/React.createContext({
|
21
|
-
items:
|
21
|
+
items: items,
|
22
22
|
rootId: POPUP_PORTAL_ID,
|
23
23
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
24
24
|
register: function register(_info) {
|
@@ -38,7 +38,7 @@ var PopupProvider = function PopupProvider(_ref) {
|
|
38
38
|
var children = _ref.children,
|
39
39
|
UNSAFE_SSR_ENABLED = _ref.UNSAFE_SSR_ENABLED;
|
40
40
|
var prevBodyOverflowY = React.useRef(canUseDOM.canUseDOM ? document.body.style.overflowY : '');
|
41
|
-
var _useState = React.useState(
|
41
|
+
var _useState = React.useState([]),
|
42
42
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
43
43
|
items = _useState2[0],
|
44
44
|
setItems = _useState2[1];
|
@@ -50,13 +50,11 @@ var PopupProvider = function PopupProvider(_ref) {
|
|
50
50
|
}
|
51
51
|
setItems(function (prevItems) {
|
52
52
|
var _info$info;
|
53
|
-
|
54
|
-
if ((_info$info = info.info) !== null && _info$info !== void 0 && _info$info.isModal && !ModalContext.hasModals(Array.from(prevItems.values()))) {
|
53
|
+
if ((_info$info = info.info) !== null && _info$info !== void 0 && _info$info.isModal && !ModalContext.hasModals(prevItems)) {
|
55
54
|
prevBodyOverflowY.current = document.body.style.overflowY;
|
56
55
|
document.body.style.overflowY = 'hidden';
|
57
56
|
}
|
58
|
-
|
59
|
-
return newItems;
|
57
|
+
return [].concat(_rollupPluginBabelHelpers.toConsumableArray(prevItems), [info]);
|
60
58
|
});
|
61
59
|
};
|
62
60
|
var unregister = function unregister(id) {
|
@@ -64,16 +62,20 @@ var PopupProvider = function PopupProvider(_ref) {
|
|
64
62
|
return;
|
65
63
|
}
|
66
64
|
setItems(function (prevItems) {
|
67
|
-
|
65
|
+
var index = prevItems.findIndex(function (item) {
|
66
|
+
return id === item.id;
|
67
|
+
});
|
68
|
+
if (index === -1) {
|
68
69
|
return prevItems;
|
69
70
|
}
|
70
|
-
var
|
71
|
-
|
72
|
-
|
73
|
-
if (prevHasModals && !ModalContext.hasModals(Array.from(newItems.values()))) {
|
71
|
+
var prevHasModals = ModalContext.hasModals(prevItems);
|
72
|
+
prevItems.splice(index, 1);
|
73
|
+
if (prevHasModals && !ModalContext.hasModals(prevItems)) {
|
74
74
|
document.body.style.overflowY = prevBodyOverflowY.current;
|
75
75
|
}
|
76
|
-
|
76
|
+
|
77
|
+
// при return prevItems не обновится контекст
|
78
|
+
return _rollupPluginBabelHelpers.toConsumableArray(prevItems);
|
77
79
|
});
|
78
80
|
};
|
79
81
|
var context = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PopupContext.js","sources":["../../../src/components/Popup/PopupContext.tsx"],"sourcesContent":["import React, { createContext, useState, useContext, FC, PropsWithChildren, useRef } from 'react';\nimport {
|
1
|
+
{"version":3,"file":"PopupContext.js","sources":["../../../src/components/Popup/PopupContext.tsx"],"sourcesContent":["import React, { createContext, useState, useContext, FC, PropsWithChildren, useRef } from 'react';\n\nimport { Portal } from '../Portal';\nimport { hasModals } from '../Modal/ModalContext';\nimport { canUseDOM, safeUseId } from '../../utils';\n\nimport { ClientOnlyPortal } from './ClientOnlyPortal';\nimport type { PopupContextType, PopupInfo } from './Popup.types';\nimport { StyledPortal } from './Popup.styles';\n\nexport const POPUP_PORTAL_ID = 'plasma-popup-root';\n\nconst items: PopupInfo[] = [];\n\nconst PopupContext = createContext<PopupContextType>({\n items,\n rootId: POPUP_PORTAL_ID,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n register(_info: PopupInfo): void {\n throw new Error('Function not implemented. Add PopupProvider');\n },\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n unregister(_id: string): void {\n throw new Error('Function not implemented. Add PopupProvider');\n },\n});\n\nexport const usePopupContext = () => useContext(PopupContext);\n\n// TODO: #1599\nexport const PopupProvider: FC<\n PropsWithChildren & {\n /**\n * @description Только для применения в рамках SSR.\n */\n UNSAFE_SSR_ENABLED?: boolean;\n }\n> = ({ children, UNSAFE_SSR_ENABLED }) => {\n const prevBodyOverflowY = useRef(canUseDOM ? document.body.style.overflowY : '');\n const [items, setItems] = useState<PopupInfo[]>([]);\n\n const uuid = safeUseId();\n const rootId = `${POPUP_PORTAL_ID}-${uuid}`;\n\n const register = (info: PopupInfo) => {\n if (!canUseDOM) {\n return;\n }\n\n setItems((prevItems) => {\n if (info.info?.isModal && !hasModals(prevItems)) {\n prevBodyOverflowY.current = document.body.style.overflowY;\n document.body.style.overflowY = 'hidden';\n }\n\n return [...prevItems, info];\n });\n };\n\n const unregister = (id: string) => {\n if (!canUseDOM) {\n return;\n }\n\n setItems((prevItems) => {\n const index = prevItems.findIndex((item: PopupInfo) => id === item.id);\n\n if (index === -1) {\n return prevItems;\n }\n\n const prevHasModals = hasModals(prevItems);\n prevItems.splice(index, 1);\n\n if (prevHasModals && !hasModals(prevItems)) {\n document.body.style.overflowY = prevBodyOverflowY.current;\n }\n\n // при return prevItems не обновится контекст\n return [...prevItems];\n });\n };\n\n const context = {\n items,\n rootId,\n register,\n unregister,\n };\n\n return (\n <PopupContext.Provider value={context}>\n {children}\n\n {UNSAFE_SSR_ENABLED ? (\n <ClientOnlyPortal>\n <StyledPortal id={rootId} />\n </ClientOnlyPortal>\n ) : (\n <Portal container={document.body}>\n <StyledPortal id={rootId} />\n </Portal>\n )}\n </PopupContext.Provider>\n );\n};\n"],"names":["POPUP_PORTAL_ID","items","PopupContext","createContext","rootId","register","_info","Error","unregister","_id","usePopupContext","useContext","PopupProvider","_ref","children","UNSAFE_SSR_ENABLED","prevBodyOverflowY","useRef","canUseDOM","document","body","style","overflowY","_useState","useState","_useState2","_slicedToArray","setItems","uuid","safeUseId","concat","info","prevItems","_info$info","isModal","hasModals","current","_toConsumableArray","id","index","findIndex","item","prevHasModals","splice","context","React","createElement","Provider","value","ClientOnlyPortal","StyledPortal","Portal","container"],"mappings":"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"}
|
@@ -144,6 +144,19 @@ var calendarBaseRoot = exports.calendarBaseRoot = function calendarBaseRoot(Root
|
|
144
144
|
setPrevType(calendarState);
|
145
145
|
}
|
146
146
|
}, [calendarState]);
|
147
|
+
(0, _react.useEffect)(function () {
|
148
|
+
console.log(type);
|
149
|
+
if (prevType !== type) {
|
150
|
+
dispatch({
|
151
|
+
type: _types.ActionType.UPDATE_CALENDAR_STATE,
|
152
|
+
payload: {
|
153
|
+
calendarState: type,
|
154
|
+
size: _reducer.sizeMap[type].single
|
155
|
+
}
|
156
|
+
});
|
157
|
+
setPrevType(type);
|
158
|
+
}
|
159
|
+
}, [type]);
|
147
160
|
(0, _react.useEffect)(function () {
|
148
161
|
if (value && prevValue && (0, _utils.isValueUpdate)(value, prevValue) || value && !prevValue) {
|
149
162
|
dispatch({
|
@@ -163,6 +176,7 @@ var calendarBaseRoot = exports.calendarBaseRoot = function calendarBaseRoot(Root
|
|
163
176
|
}
|
164
177
|
setPrevValue(value);
|
165
178
|
}, [value]);
|
179
|
+
console.log(calendarState);
|
166
180
|
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
167
181
|
ref: outerRootRef,
|
168
182
|
className: (0, _classnames["default"])(className, _defineProperty({}, _Calendar.classes.stretched, stretched)),
|
@@ -191,6 +191,18 @@ var calendarDoubleRoot = exports.calendarDoubleRoot = function calendarDoubleRoo
|
|
191
191
|
setPrevType(calendarState);
|
192
192
|
}
|
193
193
|
}, [calendarState]);
|
194
|
+
(0, _react.useEffect)(function () {
|
195
|
+
if (prevType !== type) {
|
196
|
+
dispatch({
|
197
|
+
type: _types.ActionType.UPDATE_CALENDAR_STATE,
|
198
|
+
payload: {
|
199
|
+
calendarState: type,
|
200
|
+
size: _reducer.sizeMap[type]["double"]
|
201
|
+
}
|
202
|
+
});
|
203
|
+
setPrevType(type);
|
204
|
+
}
|
205
|
+
}, [type]);
|
194
206
|
(0, _react.useEffect)(function () {
|
195
207
|
if (value && prevValue && (0, _utils.isValueUpdate)(value, prevValue) || value && !prevValue) {
|
196
208
|
var _getBoundaryDates = getBoundaryDates(),
|
@@ -100,6 +100,9 @@ var CalendarDays = exports.CalendarDays = function CalendarDays(_ref) {
|
|
100
100
|
};
|
101
101
|
var getRefs = function getRefs(element, isDayInCurrentMonth, i, j) {
|
102
102
|
if (isDayInCurrentMonth) {
|
103
|
+
if (!outerRefs.current[i + offset]) {
|
104
|
+
outerRefs.current[i + offset] = [];
|
105
|
+
}
|
103
106
|
outerRefs.current[i + offset][j] = element;
|
104
107
|
}
|
105
108
|
};
|
@@ -105,6 +105,9 @@ var CalendarMonths = exports.CalendarMonths = function CalendarMonths(_ref) {
|
|
105
105
|
return onHoverMonth === null || onHoverMonth === void 0 ? void 0 : onHoverMonth(undefined);
|
106
106
|
};
|
107
107
|
var getRefs = (0, _react.useCallback)(function (element, i, j) {
|
108
|
+
if (!outerRefs.current[i + offset]) {
|
109
|
+
outerRefs.current[i + offset] = [];
|
110
|
+
}
|
108
111
|
outerRefs.current[i + offset][j] = element;
|
109
112
|
}, [offset, outerRefs]);
|
110
113
|
(0, _react.useEffect)(function () {
|
@@ -103,6 +103,9 @@ var CalendarQuarters = exports.CalendarQuarters = function CalendarQuarters(_ref
|
|
103
103
|
return onHoverQuarter === null || onHoverQuarter === void 0 ? void 0 : onHoverQuarter(undefined);
|
104
104
|
};
|
105
105
|
var getRefs = (0, _react.useCallback)(function (element, i, j) {
|
106
|
+
if (!outerRefs.current[i + offset]) {
|
107
|
+
outerRefs.current[i + offset] = [];
|
108
|
+
}
|
106
109
|
outerRefs.current[i + offset][j] = element;
|
107
110
|
}, [offset, outerRefs]);
|
108
111
|
(0, _react.useEffect)(function () {
|
@@ -105,6 +105,9 @@ var CalendarYears = exports.CalendarYears = function CalendarYears(_ref) {
|
|
105
105
|
return onHoverYear === null || onHoverYear === void 0 ? void 0 : onHoverYear(undefined);
|
106
106
|
};
|
107
107
|
var getRefs = (0, _react.useCallback)(function (element, i, j) {
|
108
|
+
if (!outerRefs.current[i + offset]) {
|
109
|
+
outerRefs.current[i + offset] = [];
|
110
|
+
}
|
108
111
|
outerRefs.current[i + offset][j] = element;
|
109
112
|
}, [outerRefs]);
|
110
113
|
(0, _react.useEffect)(function () {
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.drawerRoot = exports.drawerConfig = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("react"));
|
9
9
|
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
10
|
-
var _utils = /*#__PURE__*/require("../../utils");
|
11
10
|
var _Popup = /*#__PURE__*/require("../Popup");
|
12
11
|
var _Overlay = /*#__PURE__*/require("../Overlay");
|
13
|
-
var
|
12
|
+
var _utils = /*#__PURE__*/require("../Popup/utils");
|
13
|
+
var _utils2 = /*#__PURE__*/require("../../utils");
|
14
14
|
var _hooks = /*#__PURE__*/require("../../hooks");
|
15
15
|
var _Drawer = /*#__PURE__*/require("./Drawer.tokens");
|
16
16
|
var _base = /*#__PURE__*/require("./variations/_view/base");
|
@@ -65,11 +65,11 @@ var drawerRoot = exports.drawerRoot = function drawerRoot(Root) {
|
|
65
65
|
var trapRef = (0, _hooks.useFocusTrap)(true, initialFocusRef, focusAfterRef);
|
66
66
|
var popupController = (0, _Popup.usePopupContext)();
|
67
67
|
var innerRef = (0, _plasmaCore.useForkRef)(trapRef, outerRef);
|
68
|
-
var uniqId = (0,
|
68
|
+
var uniqId = (0, _plasmaCore.safeUseId)();
|
69
69
|
var innerId = id || uniqId;
|
70
70
|
var overlayBackgroundToken = withBlur ? "var(".concat(_Drawer.tokens.drawerOverlayWithBlurColor, ")") : "var(".concat(_Drawer.tokens.drawerOverlayColor, ")");
|
71
|
-
var innerWidth = width ? (0,
|
72
|
-
var innerHeight = height ? (0,
|
71
|
+
var innerWidth = width ? (0, _utils2.getSizeValueFromProp)(width) : '100%';
|
72
|
+
var innerHeight = height ? (0, _utils2.getSizeValueFromProp)(height) : '100%';
|
73
73
|
var placementClass = placement ? _Drawer.classes["".concat(placement, "Placement")] : undefined;
|
74
74
|
var _useDrawer = (0, _hooks2.useDrawer)({
|
75
75
|
id: innerId,
|
@@ -82,7 +82,7 @@ var drawerRoot = exports.drawerRoot = function drawerRoot(Root) {
|
|
82
82
|
}),
|
83
83
|
drawerInfo = _useDrawer.drawerInfo;
|
84
84
|
var transparent = (0, _react.useMemo)(function () {
|
85
|
-
return (0, _DrawerContext.getIdLastDrawer)(
|
85
|
+
return (0, _DrawerContext.getIdLastDrawer)(popupController.items) !== innerId;
|
86
86
|
}, [innerId, popupController.items]);
|
87
87
|
var onDrawerOverlayKeyDown = function onDrawerOverlayKeyDown(event) {
|
88
88
|
if (onOverlayClick) {
|
@@ -96,7 +96,7 @@ var drawerRoot = exports.drawerRoot = function drawerRoot(Root) {
|
|
96
96
|
return /*#__PURE__*/_react["default"].createElement(_Drawer2.StyledPopup, _extends({
|
97
97
|
id: innerId,
|
98
98
|
ref: asModal ? innerRef : outerRef,
|
99
|
-
className: (0,
|
99
|
+
className: (0, _utils2.cx)(placementClass),
|
100
100
|
opened: innerIsOpen,
|
101
101
|
zIndex: zIndex,
|
102
102
|
placement: placement,
|
@@ -110,7 +110,7 @@ var drawerRoot = exports.drawerRoot = function drawerRoot(Root) {
|
|
110
110
|
view: view
|
111
111
|
}, /*#__PURE__*/_react["default"].createElement(_Overlay.Overlay, {
|
112
112
|
className: _Drawer.classes.overlay,
|
113
|
-
zIndex: zIndex ||
|
113
|
+
zIndex: zIndex || _utils.DEFAULT_Z_INDEX,
|
114
114
|
backgroundColorProperty: overlayBackgroundToken,
|
115
115
|
withBlur: withBlur,
|
116
116
|
transparent: transparent,
|
@@ -33,7 +33,7 @@ var useDrawer = exports.useDrawer = function useDrawer(_ref) {
|
|
33
33
|
if (!closeOnEsc) {
|
34
34
|
return;
|
35
35
|
}
|
36
|
-
if (event.keyCode === ESCAPE_KEYCODE && (0, _DrawerContext.getIdLastDrawer)(
|
36
|
+
if (event.keyCode === ESCAPE_KEYCODE && (0, _DrawerContext.getIdLastDrawer)(popupController.items) === id) {
|
37
37
|
if (onEscKeyDown) {
|
38
38
|
onEscKeyDown(event);
|
39
39
|
return;
|
@@ -64,7 +64,7 @@ var useDrawer = exports.useDrawer = function useDrawer(_ref) {
|
|
64
64
|
if (!_utils.canUseDOM) {
|
65
65
|
return;
|
66
66
|
}
|
67
|
-
if (!isOpen && !(0, _DrawerContext.hasDrawers)(
|
67
|
+
if (!isOpen && !(0, _DrawerContext.hasDrawers)(popupController.items)) {
|
68
68
|
document.body.style.overflow = overflow.current;
|
69
69
|
}
|
70
70
|
}, [isOpen, popupController.items]);
|
@@ -21,11 +21,11 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
21
21
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
22
22
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
23
23
|
var defaultFormatChars = [{
|
24
|
-
str: '*',
|
25
|
-
regexp: /./
|
26
|
-
}, {
|
27
24
|
str: '0',
|
28
25
|
regexp: /[0-9]/
|
26
|
+
}, {
|
27
|
+
str: '*',
|
28
|
+
regexp: /./
|
29
29
|
}, {
|
30
30
|
str: 'a',
|
31
31
|
regexp: /[a-zA-Z]/
|
@@ -7,12 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.modalRoot = exports.modalConfig = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("react"));
|
9
9
|
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
10
|
-
var _utils = /*#__PURE__*/require("../../utils");
|
11
10
|
var _engines = /*#__PURE__*/require("../../engines");
|
12
|
-
var _hooks = /*#__PURE__*/require("../../hooks");
|
13
11
|
var _Popup = /*#__PURE__*/require("../Popup");
|
14
12
|
var _Overlay = /*#__PURE__*/require("../Overlay");
|
15
|
-
var
|
13
|
+
var _utils = /*#__PURE__*/require("../Popup/utils");
|
14
|
+
var _hooks = /*#__PURE__*/require("../../hooks");
|
16
15
|
var _IconClose2 = /*#__PURE__*/require("../_Icon/Icons/IconClose");
|
17
16
|
var _Modal = /*#__PURE__*/require("./Modal.tokens");
|
18
17
|
var _hooks2 = /*#__PURE__*/require("./hooks");
|
@@ -61,7 +60,7 @@ var modalRoot = exports.modalRoot = function modalRoot(Root) {
|
|
61
60
|
var trapRef = (0, _hooks.useFocusTrap)(true, initialFocusRef, focusAfterRef, true);
|
62
61
|
var popupController = (0, _Popup.usePopupContext)();
|
63
62
|
var innerRef = (0, _plasmaCore.useForkRef)(trapRef, outerRootRef);
|
64
|
-
var uniqId = (0,
|
63
|
+
var uniqId = (0, _plasmaCore.safeUseId)();
|
65
64
|
var innerId = id || uniqId;
|
66
65
|
var overlayBackgroundToken = withBlur ? "var(".concat(_Modal.tokens.modalOverlayWithBlurColor, ")") : "var(".concat(_Modal.tokens.modalOverlayColor, ")");
|
67
66
|
var _useModal = (0, _hooks2.useModal)({
|
@@ -74,7 +73,7 @@ var modalRoot = exports.modalRoot = function modalRoot(Root) {
|
|
74
73
|
}),
|
75
74
|
modalInfo = _useModal.modalInfo;
|
76
75
|
var transparent = (0, _react.useMemo)(function () {
|
77
|
-
return (0, _ModalContext.getIdLastModal)(
|
76
|
+
return (0, _ModalContext.getIdLastModal)(popupController.items) !== innerId;
|
78
77
|
}, [innerId, popupController.items]);
|
79
78
|
var onModalOverlayKeyDown = (0, _react.useCallback)(function (event) {
|
80
79
|
if (onOverlayClick) {
|
@@ -87,7 +86,7 @@ var modalRoot = exports.modalRoot = function modalRoot(Root) {
|
|
87
86
|
}, [closeOnOverlayClick, onOverlayClick, onClose]);
|
88
87
|
var overlayNode = /*#__PURE__*/_react["default"].createElement(_Overlay.Overlay, {
|
89
88
|
className: _Modal.classes.overlay,
|
90
|
-
zIndex: zIndex ||
|
89
|
+
zIndex: zIndex || _utils.DEFAULT_Z_INDEX,
|
91
90
|
backgroundColorProperty: overlayBackgroundToken,
|
92
91
|
withBlur: withBlur,
|
93
92
|
transparent: transparent,
|
@@ -28,7 +28,7 @@ var useModal = exports.useModal = function useModal(_ref) {
|
|
28
28
|
if (!closeOnEsc) {
|
29
29
|
return;
|
30
30
|
}
|
31
|
-
if (event.keyCode === ESCAPE_KEYCODE && (0, _ModalContext.getIdLastModal)(
|
31
|
+
if (event.keyCode === ESCAPE_KEYCODE && (0, _ModalContext.getIdLastModal)(popupController.items) === id) {
|
32
32
|
if (onEscKeyDown) {
|
33
33
|
onEscKeyDown(event);
|
34
34
|
return;
|
@@ -109,7 +109,7 @@ var popupRoot = exports.popupRoot = function popupRoot(Root) {
|
|
109
109
|
className = _ref.className,
|
110
110
|
rest = _objectWithoutProperties(_ref, _excluded);
|
111
111
|
var innerIsOpen = isOpen || opened;
|
112
|
-
var uniqId = (0,
|
112
|
+
var uniqId = (0, _plasmaCore.safeUseId)();
|
113
113
|
var innerId = id || uniqId;
|
114
114
|
var _usePopup = (0, _hooks.usePopup)({
|
115
115
|
isOpen: innerIsOpen,
|
@@ -6,13 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.usePopupContext = exports.PopupProvider = exports.POPUP_PORTAL_ID = void 0;
|
8
8
|
var _react = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("react"));
|
9
|
-
var _utils = /*#__PURE__*/require("../../utils");
|
10
9
|
var _Portal = /*#__PURE__*/require("../Portal");
|
11
10
|
var _ModalContext = /*#__PURE__*/require("../Modal/ModalContext");
|
11
|
+
var _utils = /*#__PURE__*/require("../../utils");
|
12
12
|
var _ClientOnlyPortal = /*#__PURE__*/require("./ClientOnlyPortal");
|
13
13
|
var _Popup = /*#__PURE__*/require("./Popup.styles");
|
14
14
|
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); }
|
15
15
|
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; }
|
16
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
17
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
18
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
19
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
16
20
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
17
21
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
18
22
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
@@ -20,9 +24,9 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
20
24
|
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; } }
|
21
25
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
22
26
|
var POPUP_PORTAL_ID = exports.POPUP_PORTAL_ID = 'plasma-popup-root';
|
23
|
-
var
|
27
|
+
var items = [];
|
24
28
|
var PopupContext = /*#__PURE__*/(0, _react.createContext)({
|
25
|
-
items:
|
29
|
+
items: items,
|
26
30
|
rootId: POPUP_PORTAL_ID,
|
27
31
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
28
32
|
register: function register(_info) {
|
@@ -42,7 +46,7 @@ var PopupProvider = exports.PopupProvider = function PopupProvider(_ref) {
|
|
42
46
|
var children = _ref.children,
|
43
47
|
UNSAFE_SSR_ENABLED = _ref.UNSAFE_SSR_ENABLED;
|
44
48
|
var prevBodyOverflowY = (0, _react.useRef)(_utils.canUseDOM ? document.body.style.overflowY : '');
|
45
|
-
var _useState = (0, _react.useState)(
|
49
|
+
var _useState = (0, _react.useState)([]),
|
46
50
|
_useState2 = _slicedToArray(_useState, 2),
|
47
51
|
items = _useState2[0],
|
48
52
|
setItems = _useState2[1];
|
@@ -54,13 +58,11 @@ var PopupProvider = exports.PopupProvider = function PopupProvider(_ref) {
|
|
54
58
|
}
|
55
59
|
setItems(function (prevItems) {
|
56
60
|
var _info$info;
|
57
|
-
|
58
|
-
if ((_info$info = info.info) !== null && _info$info !== void 0 && _info$info.isModal && !(0, _ModalContext.hasModals)(Array.from(prevItems.values()))) {
|
61
|
+
if ((_info$info = info.info) !== null && _info$info !== void 0 && _info$info.isModal && !(0, _ModalContext.hasModals)(prevItems)) {
|
59
62
|
prevBodyOverflowY.current = document.body.style.overflowY;
|
60
63
|
document.body.style.overflowY = 'hidden';
|
61
64
|
}
|
62
|
-
|
63
|
-
return newItems;
|
65
|
+
return [].concat(_toConsumableArray(prevItems), [info]);
|
64
66
|
});
|
65
67
|
};
|
66
68
|
var unregister = function unregister(id) {
|
@@ -68,16 +70,20 @@ var PopupProvider = exports.PopupProvider = function PopupProvider(_ref) {
|
|
68
70
|
return;
|
69
71
|
}
|
70
72
|
setItems(function (prevItems) {
|
71
|
-
|
73
|
+
var index = prevItems.findIndex(function (item) {
|
74
|
+
return id === item.id;
|
75
|
+
});
|
76
|
+
if (index === -1) {
|
72
77
|
return prevItems;
|
73
78
|
}
|
74
|
-
var
|
75
|
-
|
76
|
-
|
77
|
-
if (prevHasModals && !(0, _ModalContext.hasModals)(Array.from(newItems.values()))) {
|
79
|
+
var prevHasModals = (0, _ModalContext.hasModals)(prevItems);
|
80
|
+
prevItems.splice(index, 1);
|
81
|
+
if (prevHasModals && !(0, _ModalContext.hasModals)(prevItems)) {
|
78
82
|
document.body.style.overflowY = prevBodyOverflowY.current;
|
79
83
|
}
|
80
|
-
|
84
|
+
|
85
|
+
// при return prevItems не обновится контекст
|
86
|
+
return _toConsumableArray(prevItems);
|
81
87
|
});
|
82
88
|
};
|
83
89
|
var context = {
|
@@ -135,6 +135,19 @@ export var calendarBaseRoot = function calendarBaseRoot(Root) {
|
|
135
135
|
setPrevType(calendarState);
|
136
136
|
}
|
137
137
|
}, [calendarState]);
|
138
|
+
useEffect(function () {
|
139
|
+
console.log(type);
|
140
|
+
if (prevType !== type) {
|
141
|
+
dispatch({
|
142
|
+
type: ActionType.UPDATE_CALENDAR_STATE,
|
143
|
+
payload: {
|
144
|
+
calendarState: type,
|
145
|
+
size: sizeMap[type].single
|
146
|
+
}
|
147
|
+
});
|
148
|
+
setPrevType(type);
|
149
|
+
}
|
150
|
+
}, [type]);
|
138
151
|
useEffect(function () {
|
139
152
|
if (value && prevValue && isValueUpdate(value, prevValue) || value && !prevValue) {
|
140
153
|
dispatch({
|
@@ -154,6 +167,7 @@ export var calendarBaseRoot = function calendarBaseRoot(Root) {
|
|
154
167
|
}
|
155
168
|
setPrevValue(value);
|
156
169
|
}, [value]);
|
170
|
+
console.log(calendarState);
|
157
171
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
158
172
|
ref: outerRootRef,
|
159
173
|
className: cls(className, _defineProperty({}, classes.stretched, stretched)),
|
@@ -182,6 +182,18 @@ export var calendarDoubleRoot = function calendarDoubleRoot(Root) {
|
|
182
182
|
setPrevType(calendarState);
|
183
183
|
}
|
184
184
|
}, [calendarState]);
|
185
|
+
useEffect(function () {
|
186
|
+
if (prevType !== type) {
|
187
|
+
dispatch({
|
188
|
+
type: ActionType.UPDATE_CALENDAR_STATE,
|
189
|
+
payload: {
|
190
|
+
calendarState: type,
|
191
|
+
size: sizeMap[type]["double"]
|
192
|
+
}
|
193
|
+
});
|
194
|
+
setPrevType(type);
|
195
|
+
}
|
196
|
+
}, [type]);
|
185
197
|
useEffect(function () {
|
186
198
|
if (value && prevValue && isValueUpdate(value, prevValue) || value && !prevValue) {
|
187
199
|
var _getBoundaryDates = getBoundaryDates(),
|
@@ -92,6 +92,9 @@ export var CalendarDays = function CalendarDays(_ref) {
|
|
92
92
|
};
|
93
93
|
var getRefs = function getRefs(element, isDayInCurrentMonth, i, j) {
|
94
94
|
if (isDayInCurrentMonth) {
|
95
|
+
if (!outerRefs.current[i + offset]) {
|
96
|
+
outerRefs.current[i + offset] = [];
|
97
|
+
}
|
95
98
|
outerRefs.current[i + offset][j] = element;
|
96
99
|
}
|
97
100
|
};
|
@@ -98,6 +98,9 @@ export var CalendarMonths = function CalendarMonths(_ref) {
|
|
98
98
|
return onHoverMonth === null || onHoverMonth === void 0 ? void 0 : onHoverMonth(undefined);
|
99
99
|
};
|
100
100
|
var getRefs = useCallback(function (element, i, j) {
|
101
|
+
if (!outerRefs.current[i + offset]) {
|
102
|
+
outerRefs.current[i + offset] = [];
|
103
|
+
}
|
101
104
|
outerRefs.current[i + offset][j] = element;
|
102
105
|
}, [offset, outerRefs]);
|
103
106
|
useEffect(function () {
|
@@ -96,6 +96,9 @@ export var CalendarQuarters = function CalendarQuarters(_ref) {
|
|
96
96
|
return onHoverQuarter === null || onHoverQuarter === void 0 ? void 0 : onHoverQuarter(undefined);
|
97
97
|
};
|
98
98
|
var getRefs = useCallback(function (element, i, j) {
|
99
|
+
if (!outerRefs.current[i + offset]) {
|
100
|
+
outerRefs.current[i + offset] = [];
|
101
|
+
}
|
99
102
|
outerRefs.current[i + offset][j] = element;
|
100
103
|
}, [offset, outerRefs]);
|
101
104
|
useEffect(function () {
|
@@ -98,6 +98,9 @@ export var CalendarYears = function CalendarYears(_ref) {
|
|
98
98
|
return onHoverYear === null || onHoverYear === void 0 ? void 0 : onHoverYear(undefined);
|
99
99
|
};
|
100
100
|
var getRefs = useCallback(function (element, i, j) {
|
101
|
+
if (!outerRefs.current[i + offset]) {
|
102
|
+
outerRefs.current[i + offset] = [];
|
103
|
+
}
|
101
104
|
outerRefs.current[i + offset][j] = element;
|
102
105
|
}, [outerRefs]);
|
103
106
|
useEffect(function () {
|
@@ -3,11 +3,11 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
3
3
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
4
4
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
5
5
|
import React, { forwardRef, useMemo } from 'react';
|
6
|
-
import { useForkRef } from '@salutejs/plasma-core';
|
7
|
-
import { cx, getSizeValueFromProp, safeUseId } from "../../utils";
|
6
|
+
import { useForkRef, safeUseId } from '@salutejs/plasma-core';
|
8
7
|
import { usePopupContext } from "../Popup";
|
9
8
|
import { Overlay } from "../Overlay";
|
10
9
|
import { DEFAULT_Z_INDEX } from "../Popup/utils";
|
10
|
+
import { cx, getSizeValueFromProp } from "../../utils";
|
11
11
|
import { useFocusTrap } from "../../hooks";
|
12
12
|
import { classes, tokens } from "./Drawer.tokens";
|
13
13
|
import { base as viewCSS } from "./variations/_view/base";
|
@@ -74,7 +74,7 @@ export var drawerRoot = function drawerRoot(Root) {
|
|
74
74
|
}),
|
75
75
|
drawerInfo = _useDrawer.drawerInfo;
|
76
76
|
var transparent = useMemo(function () {
|
77
|
-
return getIdLastDrawer(
|
77
|
+
return getIdLastDrawer(popupController.items) !== innerId;
|
78
78
|
}, [innerId, popupController.items]);
|
79
79
|
var onDrawerOverlayKeyDown = function onDrawerOverlayKeyDown(event) {
|
80
80
|
if (onOverlayClick) {
|
@@ -27,7 +27,7 @@ export var useDrawer = function useDrawer(_ref) {
|
|
27
27
|
if (!closeOnEsc) {
|
28
28
|
return;
|
29
29
|
}
|
30
|
-
if (event.keyCode === ESCAPE_KEYCODE && getIdLastDrawer(
|
30
|
+
if (event.keyCode === ESCAPE_KEYCODE && getIdLastDrawer(popupController.items) === id) {
|
31
31
|
if (onEscKeyDown) {
|
32
32
|
onEscKeyDown(event);
|
33
33
|
return;
|
@@ -58,7 +58,7 @@ export var useDrawer = function useDrawer(_ref) {
|
|
58
58
|
if (!canUseDOM) {
|
59
59
|
return;
|
60
60
|
}
|
61
|
-
if (!isOpen && !hasDrawers(
|
61
|
+
if (!isOpen && !hasDrawers(popupController.items)) {
|
62
62
|
document.body.style.overflow = overflow.current;
|
63
63
|
}
|
64
64
|
}, [isOpen, popupController.items]);
|
@@ -11,11 +11,11 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
11
11
|
import React, { forwardRef, useImperativeHandle, useState } from 'react';
|
12
12
|
import maskInputCompose from '@salutejs/react-maskinput';
|
13
13
|
var defaultFormatChars = [{
|
14
|
-
str: '*',
|
15
|
-
regexp: /./
|
16
|
-
}, {
|
17
14
|
str: '0',
|
18
15
|
regexp: /[0-9]/
|
16
|
+
}, {
|
17
|
+
str: '*',
|
18
|
+
regexp: /./
|
19
19
|
}, {
|
20
20
|
str: 'a',
|
21
21
|
regexp: /[a-zA-Z]/
|
@@ -4,13 +4,12 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
4
4
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
5
5
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
6
6
|
import React, { forwardRef, useCallback, useMemo } from 'react';
|
7
|
-
import { useForkRef } from '@salutejs/plasma-core';
|
8
|
-
import { safeUseId } from "../../utils";
|
7
|
+
import { useForkRef, safeUseId } from '@salutejs/plasma-core';
|
9
8
|
import { component } from "../../engines";
|
10
|
-
import { useFocusTrap } from "../../hooks";
|
11
9
|
import { popupConfig, usePopupContext } from "../Popup";
|
12
10
|
import { Overlay } from "../Overlay";
|
13
11
|
import { DEFAULT_Z_INDEX } from "../Popup/utils";
|
12
|
+
import { useFocusTrap } from "../../hooks";
|
14
13
|
import { IconClose } from "../_Icon/Icons/IconClose";
|
15
14
|
import { classes, tokens } from "./Modal.tokens";
|
16
15
|
import { useModal } from "./hooks";
|
@@ -66,7 +65,7 @@ export var modalRoot = function modalRoot(Root) {
|
|
66
65
|
}),
|
67
66
|
modalInfo = _useModal.modalInfo;
|
68
67
|
var transparent = useMemo(function () {
|
69
|
-
return getIdLastModal(
|
68
|
+
return getIdLastModal(popupController.items) !== innerId;
|
70
69
|
}, [innerId, popupController.items]);
|
71
70
|
var onModalOverlayKeyDown = useCallback(function (event) {
|
72
71
|
if (onOverlayClick) {
|
@@ -22,7 +22,7 @@ export var useModal = function useModal(_ref) {
|
|
22
22
|
if (!closeOnEsc) {
|
23
23
|
return;
|
24
24
|
}
|
25
|
-
if (event.keyCode === ESCAPE_KEYCODE && getIdLastModal(
|
25
|
+
if (event.keyCode === ESCAPE_KEYCODE && getIdLastModal(popupController.items) === id) {
|
26
26
|
if (onEscKeyDown) {
|
27
27
|
onEscKeyDown(event);
|
28
28
|
return;
|