@salutejs/plasma-new-hope 0.327.0-canary.2022.15704348481.0 → 0.327.0-canary.2022.15754718552.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/Mask/Mask.js +3 -3
- package/cjs/components/Mask/Mask.js.map +1 -1
- package/cjs/components/Popup/PopupContext.js +1 -1
- package/cjs/components/Popup/PopupContext.js.map +1 -1
- package/emotion/cjs/components/Mask/Mask.js +3 -3
- package/emotion/cjs/components/Popup/PopupContext.js +1 -1
- package/emotion/es/components/Mask/Mask.js +3 -3
- package/emotion/es/components/Popup/PopupContext.js +1 -1
- package/es/components/Mask/Mask.js +3 -3
- package/es/components/Mask/Mask.js.map +1 -1
- package/es/components/Popup/PopupContext.js +1 -1
- package/es/components/Popup/PopupContext.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Mask/Mask.js +3 -3
- package/styled-components/cjs/components/Popup/PopupContext.js +1 -1
- package/styled-components/es/components/Mask/Mask.js +3 -3
- package/styled-components/es/components/Popup/PopupContext.js +1 -1
@@ -13,11 +13,11 @@ var maskInputCompose__default = /*#__PURE__*/_interopDefault(maskInputCompose);
|
|
13
13
|
|
14
14
|
var _excluded = ["mask", "maskFormat"];
|
15
15
|
var defaultFormatChars = [{
|
16
|
-
str: '0',
|
17
|
-
regexp: /[0-9]/
|
18
|
-
}, {
|
19
16
|
str: '*',
|
20
17
|
regexp: /./
|
18
|
+
}, {
|
19
|
+
str: '0',
|
20
|
+
regexp: /[0-9]/
|
21
21
|
}, {
|
22
22
|
str: 'a',
|
23
23
|
regexp: /[a-zA-Z]/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Mask.js","sources":["../../../src/components/Mask/Mask.tsx"],"sourcesContent":["import React, { forwardRef, useImperativeHandle, useState } from 'react';\nimport type { FC } from 'react';\nimport maskInputCompose from '@salutejs/react-maskinput';\n\nimport type { CustomInputProps, MaskProps } from './Mask.types';\n\nconst defaultFormatChars = [\n {\n str: '
|
1
|
+
{"version":3,"file":"Mask.js","sources":["../../../src/components/Mask/Mask.tsx"],"sourcesContent":["import React, { forwardRef, useImperativeHandle, useState } from 'react';\nimport type { FC } from 'react';\nimport maskInputCompose from '@salutejs/react-maskinput';\n\nimport type { CustomInputProps, MaskProps } from './Mask.types';\n\nconst defaultFormatChars = [\n {\n str: '*',\n regexp: /./,\n },\n {\n str: '0',\n regexp: /[0-9]/,\n },\n {\n str: 'a',\n regexp: /[a-zA-Z]/,\n },\n {\n str: 'я',\n regexp: /[а-яА-ЯёЁ]/,\n },\n];\n\nexport const composeMask = <T extends CustomInputProps>(InputComponent: FC<T>) => {\n const MaskedInput = maskInputCompose(InputComponent);\n\n return forwardRef<HTMLInputElement, T & MaskProps>(\n ({ mask, maskFormat = defaultFormatChars, ...rest }, outerRef) => {\n // TODO: replace inside react-maskinput 'getReference' on 'forwardRef'\n const [ref, setRef] = useState<HTMLInputElement | null>(null);\n\n useImperativeHandle(outerRef, () => ref as HTMLInputElement, [ref]);\n\n if (!mask) {\n return <InputComponent ref={setRef} {...(rest as T)} />;\n }\n\n return <MaskedInput getReference={setRef} mask={mask} maskFormat={maskFormat} {...(rest as T)} />;\n },\n );\n};\n"],"names":["defaultFormatChars","str","regexp","composeMask","InputComponent","MaskedInput","maskInputCompose","forwardRef","_ref","outerRef","mask","_ref$maskFormat","maskFormat","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","ref","setRef","useImperativeHandle","React","createElement","_extends","getReference"],"mappings":";;;;;;;;;;;;;;AAMA,IAAMA,kBAAkB,GAAG,CACvB;AACIC,EAAAA,GAAG,EAAE,GAAG;AACRC,EAAAA,MAAM,EAAE,GAAA;AACZ,CAAC,EACD;AACID,EAAAA,GAAG,EAAE,GAAG;AACRC,EAAAA,MAAM,EAAE,OAAA;AACZ,CAAC,EACD;AACID,EAAAA,GAAG,EAAE,GAAG;AACRC,EAAAA,MAAM,EAAE,UAAA;AACZ,CA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AAA,UAAU,EAAEA,UAAAA;KAAiBC,EAAAA,IAAI,CAAS,CAAC,CAAA;AACrG,GACJ,CAAC,CAAA;AACL;;;;"}
|
@@ -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(initialItems),
|
42
42
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
43
43
|
items = _useState2[0],
|
44
44
|
setItems = _useState2[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 { canUseDOM, safeUseId } from 'src/utils';\n\nimport { Portal } from '../Portal';\nimport { hasModals } from '../Modal/ModalContext';\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 initialItems = new Map<string, PopupInfo>();\n\nconst PopupContext = createContext<PopupContextType>({\n items: initialItems,\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
|
1
|
+
{"version":3,"file":"PopupContext.js","sources":["../../../src/components/Popup/PopupContext.tsx"],"sourcesContent":["import React, { createContext, useState, useContext, FC, PropsWithChildren, useRef } from 'react';\nimport { canUseDOM, safeUseId } from 'src/utils';\n\nimport { Portal } from '../Portal';\nimport { hasModals } from '../Modal/ModalContext';\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 initialItems = new Map<string, PopupInfo>();\n\nconst PopupContext = createContext<PopupContextType>({\n items: initialItems,\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(initialItems);\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 const newItems = new Map(prevItems);\n\n if (info.info?.isModal && !hasModals(Array.from(prevItems.values()))) {\n prevBodyOverflowY.current = document.body.style.overflowY;\n document.body.style.overflowY = 'hidden';\n }\n\n newItems.set(info.id, info);\n return newItems;\n });\n };\n\n const unregister = (id: string) => {\n if (!canUseDOM) {\n return;\n }\n\n setItems((prevItems) => {\n if (!prevItems.has(id)) {\n return prevItems;\n }\n\n const newItems = new Map(prevItems);\n const prevHasModals = hasModals(Array.from(newItems.values()));\n\n newItems.delete(id);\n\n if (prevHasModals && !hasModals(Array.from(newItems.values()))) {\n document.body.style.overflowY = prevBodyOverflowY.current;\n }\n\n return newItems;\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","initialItems","Map","PopupContext","createContext","items","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","newItems","isModal","hasModals","Array","from","values","current","set","id","has","prevHasModals","context","React","createElement","Provider","value","ClientOnlyPortal","StyledPortal","Portal","container"],"mappings":";;;;;;;;;;;;;;;;;AAUO,IAAMA,eAAe,GAAG,oBAAmB;AAElD,IAAMC,YAAY,gBAAG,IAAIC,GAAG,EAAqB,CAAA;AAEjD,IAAMC,YAAY,gBAAGC,mBAAa,CAAmB;AACjDC,EAAAA,KAAK,EAAEJ,YAAY;AACnBK,EAAAA,MAAM,EAAEN,eAAe;AACvB;EACAO,QAAQ,EAAA,SAAAA,QAACC,CAAAA,KAAgB,EAAQ;AAC7B,IAAA,MAAM,IAAIC,KAAK,CAAC,6CAA6C,CAAC,CAAA;GACjE;AACD;EACAC,UAAU,EAAA,SAAAA,UAACC,CAAAA,GAAW,EAAQ;AAC1B,IAAA,MAAM,IAAIF,KAAK,CAAC,6CAA6C,CAAC,CAAA;AAClE,GA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AO,GAAG;AACZ1C,IAAAA,KAAK,EAALA,KAAK;AACLC,IAAAA,MAAM,EAANA,MAAM;AACNC,IAAAA,QAAQ,EAARA,QAAQ;AACRG,IAAAA,UAAU,EAAVA,UAAAA;GACH,CAAA;AAED,EAAA,oBACIsC,sBAAA,CAAAC,aAAA,CAAC9C,YAAY,CAAC+C,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAEJ,OAAAA;AAAQ,GAAA,EACjC/B,QAAQ,EAERC,kBAAkB,gBACf+B,sBAAA,CAAAC,aAAA,CAACG,iCAAgB,EACbJ,IAAAA,eAAAA,sBAAA,CAAAC,aAAA,CAACI,yBAAY,EAAA;AAACT,IAAAA,EAAE,EAAEtC,MAAAA;AAAO,GAAE,CACb,CAAC,gBAEnB0C,sBAAA,CAAAC,aAAA,CAACK,aAAM,EAAA;IAACC,SAAS,EAAElC,QAAQ,CAACC,IAAAA;AAAK,GAAA,eAC7B0B,sBAAA,CAAAC,aAAA,CAACI,yBAAY,EAAA;AAACT,IAAAA,EAAE,EAAEtC,MAAAA;GAAS,CACvB,CAEO,CAAC,CAAA;AAEhC;;;;;;"}
|
@@ -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: '0',
|
25
|
-
regexp: /[0-9]/
|
26
|
-
}, {
|
27
24
|
str: '*',
|
28
25
|
regexp: /./
|
26
|
+
}, {
|
27
|
+
str: '0',
|
28
|
+
regexp: /[0-9]/
|
29
29
|
}, {
|
30
30
|
str: 'a',
|
31
31
|
regexp: /[a-zA-Z]/
|
@@ -42,7 +42,7 @@ var PopupProvider = exports.PopupProvider = function PopupProvider(_ref) {
|
|
42
42
|
var children = _ref.children,
|
43
43
|
UNSAFE_SSR_ENABLED = _ref.UNSAFE_SSR_ENABLED;
|
44
44
|
var prevBodyOverflowY = (0, _react.useRef)(_utils.canUseDOM ? document.body.style.overflowY : '');
|
45
|
-
var _useState = (0, _react.useState)(
|
45
|
+
var _useState = (0, _react.useState)(initialItems),
|
46
46
|
_useState2 = _slicedToArray(_useState, 2),
|
47
47
|
items = _useState2[0],
|
48
48
|
setItems = _useState2[1];
|
@@ -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: '0',
|
15
|
-
regexp: /[0-9]/
|
16
|
-
}, {
|
17
14
|
str: '*',
|
18
15
|
regexp: /./
|
16
|
+
}, {
|
17
|
+
str: '0',
|
18
|
+
regexp: /[0-9]/
|
19
19
|
}, {
|
20
20
|
str: 'a',
|
21
21
|
regexp: /[a-zA-Z]/
|
@@ -33,7 +33,7 @@ export var PopupProvider = function PopupProvider(_ref) {
|
|
33
33
|
var children = _ref.children,
|
34
34
|
UNSAFE_SSR_ENABLED = _ref.UNSAFE_SSR_ENABLED;
|
35
35
|
var prevBodyOverflowY = useRef(canUseDOM ? document.body.style.overflowY : '');
|
36
|
-
var _useState = useState(
|
36
|
+
var _useState = useState(initialItems),
|
37
37
|
_useState2 = _slicedToArray(_useState, 2),
|
38
38
|
items = _useState2[0],
|
39
39
|
setItems = _useState2[1];
|
@@ -4,11 +4,11 @@ import maskInputCompose from '@salutejs/react-maskinput';
|
|
4
4
|
|
5
5
|
var _excluded = ["mask", "maskFormat"];
|
6
6
|
var defaultFormatChars = [{
|
7
|
-
str: '0',
|
8
|
-
regexp: /[0-9]/
|
9
|
-
}, {
|
10
7
|
str: '*',
|
11
8
|
regexp: /./
|
9
|
+
}, {
|
10
|
+
str: '0',
|
11
|
+
regexp: /[0-9]/
|
12
12
|
}, {
|
13
13
|
str: 'a',
|
14
14
|
regexp: /[a-zA-Z]/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Mask.js","sources":["../../../src/components/Mask/Mask.tsx"],"sourcesContent":["import React, { forwardRef, useImperativeHandle, useState } from 'react';\nimport type { FC } from 'react';\nimport maskInputCompose from '@salutejs/react-maskinput';\n\nimport type { CustomInputProps, MaskProps } from './Mask.types';\n\nconst defaultFormatChars = [\n {\n str: '
|
1
|
+
{"version":3,"file":"Mask.js","sources":["../../../src/components/Mask/Mask.tsx"],"sourcesContent":["import React, { forwardRef, useImperativeHandle, useState } from 'react';\nimport type { FC } from 'react';\nimport maskInputCompose from '@salutejs/react-maskinput';\n\nimport type { CustomInputProps, MaskProps } from './Mask.types';\n\nconst defaultFormatChars = [\n {\n str: '*',\n regexp: /./,\n },\n {\n str: '0',\n regexp: /[0-9]/,\n },\n {\n str: 'a',\n regexp: /[a-zA-Z]/,\n },\n {\n str: 'я',\n regexp: /[а-яА-ЯёЁ]/,\n },\n];\n\nexport const composeMask = <T extends CustomInputProps>(InputComponent: FC<T>) => {\n const MaskedInput = maskInputCompose(InputComponent);\n\n return forwardRef<HTMLInputElement, T & MaskProps>(\n ({ mask, maskFormat = defaultFormatChars, ...rest }, outerRef) => {\n // TODO: replace inside react-maskinput 'getReference' on 'forwardRef'\n const [ref, setRef] = useState<HTMLInputElement | null>(null);\n\n useImperativeHandle(outerRef, () => ref as HTMLInputElement, [ref]);\n\n if (!mask) {\n return <InputComponent ref={setRef} {...(rest as T)} />;\n }\n\n return <MaskedInput getReference={setRef} mask={mask} maskFormat={maskFormat} {...(rest as T)} />;\n },\n );\n};\n"],"names":["defaultFormatChars","str","regexp","composeMask","InputComponent","MaskedInput","maskInputCompose","forwardRef","_ref","outerRef","mask","_ref$maskFormat","maskFormat","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","ref","setRef","useImperativeHandle","React","createElement","_extends","getReference"],"mappings":";;;;;AAMA,IAAMA,kBAAkB,GAAG,CACvB;AACIC,EAAAA,GAAG,EAAE,GAAG;AACRC,EAAAA,MAAM,EAAE,GAAA;AACZ,CAAC,EACD;AACID,EAAAA,GAAG,EAAE,GAAG;AACRC,EAAAA,MAAM,EAAE,OAAA;AACZ,CAAC,EACD;AACID,EAAAA,GAAG,EAAE,GAAG;AACRC,EAAAA,MAAM,EAAE,UAAA;AACZ,CAAC,EACD;AACID,EAAAA,GAAG,EAAE,GAAG;AACRC,EAAAA,MAAM,EAAE,YAAA;AACZ,CAAC,CACJ,CAAA;IAEYC,WAAW,GAAG,SAAdA,WAAWA,CAAgCC,cAAqB,EAAK;AAC9E,EAAA,IAAMC,WAAW,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;AAEpD,EAAA,oBAAOG,UAAU,CACb,UAAAC,IAAA,EAAqDC,QAAQ,EAAK;AAAA,IAAA,IAA/DC,IAAI,GAAAF,IAAA,CAAJE,IAAI;MAAAC,eAAA,GAAAH,IAAA,CAAEI,UAAU;AAAVA,MAAAA,UAAU,GAAAD,eAAA,KAAGX,KAAAA,CAAAA,GAAAA,kBAAkB,GAAAW,eAAA;AAAKE,MAAAA,IAAI,GAAAC,wBAAA,CAAAN,IAAA,EAAAO,SAAA,CAAA,CAAA;AAC7C;AACA,IAAA,IAAAC,SAAA,GAAsBC,QAAQ,CAA0B,IAAI,CAAC;MAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAtDI,MAAAA,GAAG,GAAAF,UAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,MAAM,GAAAH,UAAA,CAAA,CAAA,CAAA,CAAA;IAElBI,mBAAmB,CAACb,QAAQ,EAAE,YAAA;AAAA,MAAA,OAAMW,GAAG,CAAA;AAAA,KAAoB,EAAE,CAACA,GAAG,CAAC,CAAC,CAAA;IAEnE,IAAI,CAACV,IAAI,EAAE;AACP,MAAA,oBAAOa,KAAA,CAAAC,aAAA,CAACpB,cAAc,EAAAqB,QAAA,CAAA;AAACL,QAAAA,GAAG,EAAEC,MAAAA;OAAaR,EAAAA,IAAI,CAAS,CAAC,CAAA;AAC3D,KAAA;AAEA,IAAA,oBAAOU,KAAA,CAAAC,aAAA,CAACnB,WAAW,EAAAoB,QAAA,CAAA;AAACC,MAAAA,YAAY,EAAEL,MAAO;AAACX,MAAAA,IAAI,EAAEA,IAAK;AAACE,MAAAA,UAAU,EAAEA,UAAAA;KAAiBC,EAAAA,IAAI,CAAS,CAAC,CAAA;AACrG,GACJ,CAAC,CAAA;AACL;;;;"}
|
@@ -30,7 +30,7 @@ var PopupProvider = function PopupProvider(_ref) {
|
|
30
30
|
var children = _ref.children,
|
31
31
|
UNSAFE_SSR_ENABLED = _ref.UNSAFE_SSR_ENABLED;
|
32
32
|
var prevBodyOverflowY = useRef(canUseDOM ? document.body.style.overflowY : '');
|
33
|
-
var _useState = useState(
|
33
|
+
var _useState = useState(initialItems),
|
34
34
|
_useState2 = _slicedToArray(_useState, 2),
|
35
35
|
items = _useState2[0],
|
36
36
|
setItems = _useState2[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 { canUseDOM, safeUseId } from 'src/utils';\n\nimport { Portal } from '../Portal';\nimport { hasModals } from '../Modal/ModalContext';\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 initialItems = new Map<string, PopupInfo>();\n\nconst PopupContext = createContext<PopupContextType>({\n items: initialItems,\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
|
1
|
+
{"version":3,"file":"PopupContext.js","sources":["../../../src/components/Popup/PopupContext.tsx"],"sourcesContent":["import React, { createContext, useState, useContext, FC, PropsWithChildren, useRef } from 'react';\nimport { canUseDOM, safeUseId } from 'src/utils';\n\nimport { Portal } from '../Portal';\nimport { hasModals } from '../Modal/ModalContext';\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 initialItems = new Map<string, PopupInfo>();\n\nconst PopupContext = createContext<PopupContextType>({\n items: initialItems,\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(initialItems);\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 const newItems = new Map(prevItems);\n\n if (info.info?.isModal && !hasModals(Array.from(prevItems.values()))) {\n prevBodyOverflowY.current = document.body.style.overflowY;\n document.body.style.overflowY = 'hidden';\n }\n\n newItems.set(info.id, info);\n return newItems;\n });\n };\n\n const unregister = (id: string) => {\n if (!canUseDOM) {\n return;\n }\n\n setItems((prevItems) => {\n if (!prevItems.has(id)) {\n return prevItems;\n }\n\n const newItems = new Map(prevItems);\n const prevHasModals = hasModals(Array.from(newItems.values()));\n\n newItems.delete(id);\n\n if (prevHasModals && !hasModals(Array.from(newItems.values()))) {\n document.body.style.overflowY = prevBodyOverflowY.current;\n }\n\n return newItems;\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","initialItems","Map","PopupContext","createContext","items","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","newItems","isModal","hasModals","Array","from","values","current","set","id","has","prevHasModals","context","React","createElement","Provider","value","ClientOnlyPortal","StyledPortal","Portal","container"],"mappings":";;;;;;;;;AAUO,IAAMA,eAAe,GAAG,oBAAmB;AAElD,IAA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.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": "73cd1f8a32e8e2fc47377e0cb20cd42aac6fc6d4"
|
141
141
|
}
|
@@ -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: '0',
|
25
|
-
regexp: /[0-9]/
|
26
|
-
}, {
|
27
24
|
str: '*',
|
28
25
|
regexp: /./
|
26
|
+
}, {
|
27
|
+
str: '0',
|
28
|
+
regexp: /[0-9]/
|
29
29
|
}, {
|
30
30
|
str: 'a',
|
31
31
|
regexp: /[a-zA-Z]/
|
@@ -42,7 +42,7 @@ var PopupProvider = exports.PopupProvider = function PopupProvider(_ref) {
|
|
42
42
|
var children = _ref.children,
|
43
43
|
UNSAFE_SSR_ENABLED = _ref.UNSAFE_SSR_ENABLED;
|
44
44
|
var prevBodyOverflowY = (0, _react.useRef)(_utils.canUseDOM ? document.body.style.overflowY : '');
|
45
|
-
var _useState = (0, _react.useState)(
|
45
|
+
var _useState = (0, _react.useState)(initialItems),
|
46
46
|
_useState2 = _slicedToArray(_useState, 2),
|
47
47
|
items = _useState2[0],
|
48
48
|
setItems = _useState2[1];
|
@@ -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: '0',
|
15
|
-
regexp: /[0-9]/
|
16
|
-
}, {
|
17
14
|
str: '*',
|
18
15
|
regexp: /./
|
16
|
+
}, {
|
17
|
+
str: '0',
|
18
|
+
regexp: /[0-9]/
|
19
19
|
}, {
|
20
20
|
str: 'a',
|
21
21
|
regexp: /[a-zA-Z]/
|
@@ -33,7 +33,7 @@ export var PopupProvider = function PopupProvider(_ref) {
|
|
33
33
|
var children = _ref.children,
|
34
34
|
UNSAFE_SSR_ENABLED = _ref.UNSAFE_SSR_ENABLED;
|
35
35
|
var prevBodyOverflowY = useRef(canUseDOM ? document.body.style.overflowY : '');
|
36
|
-
var _useState = useState(
|
36
|
+
var _useState = useState(initialItems),
|
37
37
|
_useState2 = _slicedToArray(_useState, 2),
|
38
38
|
items = _useState2[0],
|
39
39
|
setItems = _useState2[1];
|