@salutejs/plasma-new-hope 0.327.0-canary.2022.15758717316.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 +2 -0
- package/cjs/components/Calendar/CalendarBase/CalendarBase.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 +2 -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 +2 -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 +2 -0
- package/es/components/Calendar/CalendarBase/CalendarBase.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 +2 -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 +2 -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/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
@@ -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":";;;;;;;;;AAUO,IAAMA,eAAe,GAAG,oBAAmB;AAElD,IAAMC,KAAkB,GAAG,EAAE,CAAA;AAE7B,IAAMC,YAAY,gBAAGC,aA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CAACC,SAAS,GAAGN,iBAAiB,CAACoB,OAAO,CAAA;AAC7D,OAAA;;AAEA;MACA,OAAAC,kBAAA,CAAWL,SAAS,CAAA,CAAA;AACxB,KAAC,CAAC,CAAA;GACL,CAAA;AAED,EAAA,IAAMY,OAAO,GAAG;AACZ3C,IAAAA,KAAK,EAALA,KAAK;AACLG,IAAAA,MAAM,EAANA,MAAM;AACNC,IAAAA,QAAQ,EAARA,QAAQ;AACRG,IAAAA,UAAU,EAAVA,UAAAA;GACH,CAAA;AAED,EAAA,oBACIqC,KAAA,CAAAC,aAAA,CAAC5C,YAAY,CAAC6C,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAEJ,OAAAA;AAAQ,GAAA,EACjC9B,QAAQ,EAERC,kBAAkB,gBACf8B,KAAA,CAAAC,aAAA,CAACG,gBAAgB,EACbJ,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAACI,YAAY,EAAA;AAACZ,IAAAA,EAAE,EAAElC,MAAAA;AAAO,GAAE,CACb,CAAC,gBAEnByC,KAAA,CAAAC,aAAA,CAACK,MAAM,EAAA;IAACC,SAAS,EAAEjC,QAAQ,CAACC,IAAAA;AAAK,GAAA,eAC7ByB,KAAA,CAAAC,aAAA,CAACI,YAAY,EAAA;AAACZ,IAAAA,EAAE,EAAElC,MAAAA;GAAS,CACvB,CAEO,CAAC,CAAA;AAEhC;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.327.0-canary.
|
3
|
+
"version": "0.327.0-canary.2024.15730742214.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -137,5 +137,5 @@
|
|
137
137
|
"sideEffects": [
|
138
138
|
"*.css"
|
139
139
|
],
|
140
|
-
"gitHead": "
|
140
|
+
"gitHead": "84a3229645856a5f9e765bb38ea3c19625696d81"
|
141
141
|
}
|
@@ -145,6 +145,7 @@ var calendarBaseRoot = exports.calendarBaseRoot = function calendarBaseRoot(Root
|
|
145
145
|
}
|
146
146
|
}, [calendarState]);
|
147
147
|
(0, _react.useEffect)(function () {
|
148
|
+
console.log(type);
|
148
149
|
if (prevType !== type) {
|
149
150
|
dispatch({
|
150
151
|
type: _types.ActionType.UPDATE_CALENDAR_STATE,
|
@@ -175,6 +176,7 @@ var calendarBaseRoot = exports.calendarBaseRoot = function calendarBaseRoot(Root
|
|
175
176
|
}
|
176
177
|
setPrevValue(value);
|
177
178
|
}, [value]);
|
179
|
+
console.log(calendarState);
|
178
180
|
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
179
181
|
ref: outerRootRef,
|
180
182
|
className: (0, _classnames["default"])(className, _defineProperty({}, _Calendar.classes.stretched, stretched)),
|
@@ -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 = {
|
@@ -136,6 +136,7 @@ export var calendarBaseRoot = function calendarBaseRoot(Root) {
|
|
136
136
|
}
|
137
137
|
}, [calendarState]);
|
138
138
|
useEffect(function () {
|
139
|
+
console.log(type);
|
139
140
|
if (prevType !== type) {
|
140
141
|
dispatch({
|
141
142
|
type: ActionType.UPDATE_CALENDAR_STATE,
|
@@ -166,6 +167,7 @@ export var calendarBaseRoot = function calendarBaseRoot(Root) {
|
|
166
167
|
}
|
167
168
|
setPrevValue(value);
|
168
169
|
}, [value]);
|
170
|
+
console.log(calendarState);
|
169
171
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
170
172
|
ref: outerRootRef,
|
171
173
|
className: cls(className, _defineProperty({}, classes.stretched, stretched)),
|
@@ -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;
|
@@ -9,8 +9,8 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
9
9
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
10
10
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
11
11
|
import React, { forwardRef, useRef } from 'react';
|
12
|
-
import { useForkRef } from '@salutejs/plasma-core';
|
13
|
-
import { canUseDOM, cx
|
12
|
+
import { useForkRef, safeUseId } from '@salutejs/plasma-core';
|
13
|
+
import { canUseDOM, cx } from "../../utils";
|
14
14
|
import { Portal } from "../Portal";
|
15
15
|
import { PopupRoot } from "./PopupRoot";
|
16
16
|
import { usePopup } from "./hooks";
|
@@ -1,3 +1,7 @@
|
|
1
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
2
|
+
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."); }
|
3
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
4
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
1
5
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
2
6
|
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."); }
|
3
7
|
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; } }
|
@@ -5,15 +9,15 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
5
9
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
6
10
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
7
11
|
import React, { createContext, useState, useContext, useRef } from 'react';
|
8
|
-
import { canUseDOM, safeUseId } from "../../utils";
|
9
12
|
import { Portal } from "../Portal";
|
10
13
|
import { hasModals } from "../Modal/ModalContext";
|
14
|
+
import { canUseDOM, safeUseId } from "../../utils";
|
11
15
|
import { ClientOnlyPortal } from "./ClientOnlyPortal";
|
12
16
|
import { StyledPortal } from "./Popup.styles";
|
13
17
|
export var POPUP_PORTAL_ID = 'plasma-popup-root';
|
14
|
-
var
|
18
|
+
var items = [];
|
15
19
|
var PopupContext = /*#__PURE__*/createContext({
|
16
|
-
items:
|
20
|
+
items: items,
|
17
21
|
rootId: POPUP_PORTAL_ID,
|
18
22
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
19
23
|
register: function register(_info) {
|
@@ -33,7 +37,7 @@ export var PopupProvider = function PopupProvider(_ref) {
|
|
33
37
|
var children = _ref.children,
|
34
38
|
UNSAFE_SSR_ENABLED = _ref.UNSAFE_SSR_ENABLED;
|
35
39
|
var prevBodyOverflowY = useRef(canUseDOM ? document.body.style.overflowY : '');
|
36
|
-
var _useState = useState(
|
40
|
+
var _useState = useState([]),
|
37
41
|
_useState2 = _slicedToArray(_useState, 2),
|
38
42
|
items = _useState2[0],
|
39
43
|
setItems = _useState2[1];
|
@@ -45,13 +49,11 @@ export var PopupProvider = function PopupProvider(_ref) {
|
|
45
49
|
}
|
46
50
|
setItems(function (prevItems) {
|
47
51
|
var _info$info;
|
48
|
-
|
49
|
-
if ((_info$info = info.info) !== null && _info$info !== void 0 && _info$info.isModal && !hasModals(Array.from(prevItems.values()))) {
|
52
|
+
if ((_info$info = info.info) !== null && _info$info !== void 0 && _info$info.isModal && !hasModals(prevItems)) {
|
50
53
|
prevBodyOverflowY.current = document.body.style.overflowY;
|
51
54
|
document.body.style.overflowY = 'hidden';
|
52
55
|
}
|
53
|
-
|
54
|
-
return newItems;
|
56
|
+
return [].concat(_toConsumableArray(prevItems), [info]);
|
55
57
|
});
|
56
58
|
};
|
57
59
|
var unregister = function unregister(id) {
|
@@ -59,16 +61,20 @@ export var PopupProvider = function PopupProvider(_ref) {
|
|
59
61
|
return;
|
60
62
|
}
|
61
63
|
setItems(function (prevItems) {
|
62
|
-
|
64
|
+
var index = prevItems.findIndex(function (item) {
|
65
|
+
return id === item.id;
|
66
|
+
});
|
67
|
+
if (index === -1) {
|
63
68
|
return prevItems;
|
64
69
|
}
|
65
|
-
var
|
66
|
-
|
67
|
-
|
68
|
-
if (prevHasModals && !hasModals(Array.from(newItems.values()))) {
|
70
|
+
var prevHasModals = hasModals(prevItems);
|
71
|
+
prevItems.splice(index, 1);
|
72
|
+
if (prevHasModals && !hasModals(prevItems)) {
|
69
73
|
document.body.style.overflowY = prevBodyOverflowY.current;
|
70
74
|
}
|
71
|
-
|
75
|
+
|
76
|
+
// при return prevItems не обновится контекст
|
77
|
+
return _toConsumableArray(prevItems);
|
72
78
|
});
|
73
79
|
};
|
74
80
|
var context = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CalendarBase.d.ts","sourceRoot":"","sources":["../../../../src/components/Calendar/CalendarBase/CalendarBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMV,cAAc,EAGjB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAc,MAAM,mBAAmB,CAAC;AAMnF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAO7C,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,mBAAmB,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,gBAAgB,SAAU,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC,
|
1
|
+
{"version":3,"file":"CalendarBase.d.ts","sourceRoot":"","sources":["../../../../src/components/Calendar/CalendarBase/CalendarBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAMV,cAAc,EAGjB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAc,MAAM,mBAAmB,CAAC;AAMnF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAO7C,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,mBAAmB,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,gBAAgB,SAAU,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC,0GAgO3F,CAAC;AAEN,eAAO,MAAM,kBAAkB;;;mBAlOQ,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;;;;;;;;;;;;;;CAmP/F,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import type { RootProps } from '
|
2
|
+
import type { RootProps } from '../../engines';
|
3
3
|
import type { DrawerProps } from './Drawer.types';
|
4
4
|
export declare const drawerRoot: (Root: RootProps<HTMLDivElement, DrawerProps>) => React.ForwardRefExoticComponent<import("../Popup").PopupProps & import("../Panel").PanelProps & {
|
5
5
|
placement?: import("./Drawer.types").DrawerPlacement;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAQ/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAUlD,eAAO,MAAM,UAAU,SAAU,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC;;;;;;;;;6BAiC/D,MACI,UAAF;sBAGE,MAAE,SAAS;oBAMX,MAAM,SAAS;;wCAmFtB,CAAC;AAEN,eAAO,MAAM,YAAY;;;mBAhIQ,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC;;;;;;;;;iCAiC/D,MACI,UAAF;0BAGE,MAAE,SAAS;wBAMX,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;CA0G1B,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useDrawer.d.ts","sourceRoot":"","sources":["../../../../src/components/Drawer/hooks/useDrawer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAA+B,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMjD,eAAO,MAAM,SAAS,iFAQnB,cAAc;;
|
1
|
+
{"version":3,"file":"useDrawer.d.ts","sourceRoot":"","sources":["../../../../src/components/Drawer/hooks/useDrawer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAA+B,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMjD,eAAO,MAAM,SAAS,iFAQnB,cAAc;;CA+DhB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAE,SAAS,EAAa,MAAM,
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAE,SAAS,EAAa,MAAM,eAAe,CAAC;AAQrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAS3C;;;GAGG;AACH,eAAO,MAAM,SAAS,SAAU,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,sFA6GhE,CAAC;AAEN,eAAO,MAAM,WAAW;;;mBA/GQ,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC;;;;;;;;;;CA4HpE,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { RootProps } from '
|
2
|
+
import { RootProps } from '../../engines/types';
|
3
3
|
import type { PopupPlacement, PopupPositionType, PopupProps } from './Popup.types';
|
4
4
|
export declare const handlePosition: (placement: PopupPlacement, offset: [number, number] | [string, string]) => PopupPositionType;
|
5
5
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../src/components/Popup/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../src/components/Popup/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIhD,OAAO,KAAK,EAAuB,cAAc,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAMxG,eAAO,MAAM,cAAc,cACZ,cAAc,UACjB,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KAC5C,iBA8DF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,SAAU,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,sFAwFhE,CAAC;AAEN,eAAO,MAAM,WAAW;;;mBA1FQ,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC;;;;CAiGpE,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Popup.types.d.ts","sourceRoot":"","sources":["../../../src/components/Popup/Popup.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AACjF,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,UAAU,GAAG,cAAc,GAAG,aAAa,CAAC;AAC5F,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG,mBAA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EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC9F,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,iBAAiB,CAAC;CAC/B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PopupContext.d.ts","sourceRoot":"","sources":["../../../src/components/Popup/PopupContext.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuC,EAAE,EAAE,iBAAiB,EAAU,MAAM,OAAO,CAAC;AAOlG,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,eAAe,CAAC;AAGjE,eAAO,MAAM,eAAe,sBAAsB,CAAC;AAiBnD,eAAO,MAAM,eAAe,wBAAiC,CAAC;AAG9D,eAAO,MAAM,aAAa,EAAE,EAAE,CAC1B,iBAAiB,GAAG;IAChB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC,
|
1
|
+
{"version":3,"file":"PopupContext.d.ts","sourceRoot":"","sources":["../../../src/components/Popup/PopupContext.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAuC,EAAE,EAAE,iBAAiB,EAAU,MAAM,OAAO,CAAC;AAOlG,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,eAAe,CAAC;AAGjE,eAAO,MAAM,eAAe,sBAAsB,CAAC;AAiBnD,eAAO,MAAM,eAAe,wBAAiC,CAAC;AAG9D,eAAO,MAAM,aAAa,EAAE,EAAE,CAC1B,iBAAiB,GAAG;IAChB;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC,CAqEJ,CAAC"}
|