@salutejs/plasma-new-hope 0.177.1-canary.1515.11575336640.0 → 0.177.1-dev.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
  2. package/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js.map +1 -1
  3. package/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
  4. package/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js.map +1 -1
  5. package/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
  6. package/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js.map +1 -1
  7. package/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
  8. package/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js.map +1 -1
  9. package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +4 -2
  10. package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js.map +1 -1
  11. package/cjs/components/Popover/Popover.js +2 -1
  12. package/cjs/components/Popover/Popover.js.map +1 -1
  13. package/cjs/components/Popup/Popup.js +2 -2
  14. package/cjs/components/Popup/Popup.js.map +1 -1
  15. package/cjs/components/Portal/Portal.js +0 -4
  16. package/cjs/components/Portal/Portal.js.map +1 -1
  17. package/emotion/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
  18. package/emotion/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
  19. package/emotion/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
  20. package/emotion/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
  21. package/emotion/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +6 -4
  22. package/emotion/cjs/components/Popover/Popover.js +2 -1
  23. package/emotion/cjs/components/Popup/Popup.js +1 -1
  24. package/emotion/cjs/components/Portal/Portal.js +0 -4
  25. package/emotion/es/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
  26. package/emotion/es/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
  27. package/emotion/es/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
  28. package/emotion/es/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
  29. package/emotion/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +4 -2
  30. package/emotion/es/components/Popover/Popover.js +2 -1
  31. package/emotion/es/components/Popup/Popup.js +1 -1
  32. package/emotion/es/components/Portal/Portal.js +0 -4
  33. package/es/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
  34. package/es/components/Dropdown/ui/DropdownDivider/DropdownDivider.js.map +1 -1
  35. package/es/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
  36. package/es/components/Dropdown/ui/DropdownFooter/DropdownFooter.js.map +1 -1
  37. package/es/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
  38. package/es/components/Dropdown/ui/DropdownGroup/DropdownGroup.js.map +1 -1
  39. package/es/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
  40. package/es/components/Dropdown/ui/DropdownHeader/DropdownHeader.js.map +1 -1
  41. package/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +4 -2
  42. package/es/components/Dropdown/ui/DropdownOld/DropdownOld.js.map +1 -1
  43. package/es/components/Popover/Popover.js +2 -1
  44. package/es/components/Popover/Popover.js.map +1 -1
  45. package/es/components/Popup/Popup.js +2 -2
  46. package/es/components/Popup/Popup.js.map +1 -1
  47. package/es/components/Portal/Portal.js +0 -4
  48. package/es/components/Portal/Portal.js.map +1 -1
  49. package/package.json +4 -4
  50. package/styled-components/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
  51. package/styled-components/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
  52. package/styled-components/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
  53. package/styled-components/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
  54. package/styled-components/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +6 -4
  55. package/styled-components/cjs/components/Popover/Popover.js +2 -1
  56. package/styled-components/cjs/components/Popup/Popup.js +1 -1
  57. package/styled-components/cjs/components/Portal/Portal.js +0 -4
  58. package/styled-components/es/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
  59. package/styled-components/es/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
  60. package/styled-components/es/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
  61. package/styled-components/es/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
  62. package/styled-components/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +4 -2
  63. package/styled-components/es/components/Popover/Popover.js +2 -1
  64. package/styled-components/es/components/Popup/Popup.js +1 -1
  65. package/styled-components/es/components/Portal/Portal.js +0 -4
  66. package/types/components/Dropdown/ui/DropdownDivider/DropdownDivider.d.ts.map +1 -1
  67. package/types/components/Dropdown/ui/DropdownFooter/DropdownFooter.d.ts.map +1 -1
  68. package/types/components/Dropdown/ui/DropdownGroup/DropdownGroup.d.ts.map +1 -1
  69. package/types/components/Dropdown/ui/DropdownHeader/DropdownHeader.d.ts.map +1 -1
  70. package/types/components/Dropdown/ui/DropdownOld/DropdownOld.d.ts.map +1 -1
  71. package/types/components/Popover/Popover.d.ts.map +1 -1
  72. package/types/components/Portal/Portal.d.ts.map +1 -1
@@ -6,8 +6,8 @@ import { PopupRoot } from './PopupRoot.js';
6
6
  import { classes } from './Popup.tokens.js';
7
7
  import { StyledPortalContainer } from './Popup.styles.js';
8
8
  import { usePopup } from './hooks/usePopup.js';
9
- import { canUseDOM } from '../../utils/canUseDOM.js';
10
9
  import { Portal } from '../Portal/Portal.js';
10
+ import { canUseDOM } from '../../utils/canUseDOM.js';
11
11
 
12
12
  var _excluded = ["id", "isOpen", "opened", "placement", "offset", "frame", "children", "overlay", "role", "zIndex", "popupInfo", "withAnimation", "className"];
13
13
  var handlePosition = function handlePosition(placement, offset) {
@@ -121,7 +121,7 @@ var popupRoot = function popupRoot(Root) {
121
121
  animationInfo: animationInfo,
122
122
  setVisible: setVisible
123
123
  }, children));
124
- if (typeof frame !== 'string' && frame && frame.current && canUseDOM) {
124
+ if (typeof frame !== 'string' && frame && frame.current) {
125
125
  return /*#__PURE__*/React.createElement(Portal, {
126
126
  container: frame.current
127
127
  }, rootNode);
@@ -1 +1 @@
1
- {"version":3,"file":"Popup.js","sources":["../../../src/components/Popup/Popup.tsx"],"sourcesContent":["import React, { forwardRef, useRef } from 'react';\nimport { useForkRef, safeUseId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines/types';\nimport { canUseDOM, cx } from '../../utils';\nimport { Portal } from '../Portal';\n\nimport type { PopupPlacementBasic, PopupPlacement, PopupPositionType, PopupProps } from './Popup.types';\nimport { PopupRoot } from './PopupRoot';\nimport { usePopup } from './hooks';\nimport { classes } from './Popup.tokens';\nimport { StyledPortalContainer } from './Popup.styles';\n\nexport const handlePosition = (\n placement: PopupPlacement,\n offset: [number, number] | [string, string],\n): PopupPositionType => {\n let x = '0rem';\n let y = '0rem';\n\n if (offset) {\n const [_x, _y] = offset;\n x = typeof _x === 'number' ? `${_x}rem` : _x;\n y = typeof _y === 'number' ? `${_y}rem` : _y;\n }\n\n if (!placement || placement === 'center') {\n return {\n left: `calc(50% + ${x})`,\n top: `calc(50% - ${y})`,\n transform: 'translate(-50%, -50%)',\n };\n }\n\n let left;\n let right;\n let top;\n let bottom;\n let transform;\n const placements = placement.split('-') as PopupPlacementBasic[];\n\n placements.forEach((placementValue: PopupPlacementBasic) => {\n switch (placementValue) {\n case 'left':\n left = x;\n break;\n case 'right':\n right = x;\n break;\n case 'top':\n top = y;\n break;\n case 'bottom':\n bottom = y;\n break;\n default:\n break;\n }\n });\n\n const isCenteredX = left === undefined && right === undefined;\n const isCenteredY = top === undefined && bottom === undefined;\n\n if (isCenteredX) {\n transform = 'translateX(-50%)';\n }\n\n if (isCenteredY) {\n transform = 'translateY(-50%)';\n }\n\n return {\n left: isCenteredX ? `calc(50% + ${x})` : left,\n right,\n top: isCenteredY ? `calc(50% - ${y})` : top,\n bottom,\n transform,\n };\n};\n\n/**\n * Базовый компонент Popup.\n */\nexport const popupRoot = (Root: RootProps<HTMLDivElement, PopupProps>) =>\n forwardRef<HTMLDivElement, PopupProps>(\n (\n {\n id,\n isOpen = false,\n opened = false,\n placement = 'center',\n offset = [0, 0],\n frame = 'document',\n children,\n overlay,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n role,\n zIndex,\n popupInfo,\n withAnimation = false,\n className,\n ...rest\n },\n outerRootRef,\n ) => {\n const innerIsOpen = isOpen || opened;\n\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n\n const { isVisible, animationInfo, setVisible, rootId } = usePopup({\n isOpen: innerIsOpen,\n id: innerId,\n popupInfo,\n withAnimation,\n });\n\n const portalRef = useRef<HTMLDivElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n const innerRef = useForkRef<HTMLDivElement>(contentRef, outerRootRef);\n\n if (!isVisible && !innerIsOpen) {\n return null;\n }\n\n const cls = cx(\n className,\n animationInfo?.endAnimation ? classes.endAnimation : '',\n animationInfo?.endTransition ? classes.endTransition : '',\n );\n\n const rootNode = (\n <Root className={cls} {...rest}>\n {overlay}\n <PopupRoot\n id={innerId}\n ref={innerRef}\n position={handlePosition(placement, offset)}\n zIndex={zIndex}\n frame={frame}\n animationInfo={animationInfo}\n setVisible={setVisible}\n >\n {children}\n </PopupRoot>\n </Root>\n );\n\n if (typeof frame !== 'string' && frame && frame.current && canUseDOM) {\n return <Portal container={frame.current}>{rootNode}</Portal>;\n }\n\n const withFrameId = typeof frame === 'string' && frame !== 'document';\n const containerElement = withFrameId && canUseDOM && document.getElementById(frame as string);\n\n if (containerElement) {\n return (\n <Portal container={containerElement}>\n <StyledPortalContainer ref={portalRef}>\n {portalRef.current && <Portal container={portalRef.current}>{rootNode}</Portal>}\n </StyledPortalContainer>{' '}\n </Portal>\n );\n }\n\n const globalPortal = canUseDOM && document.getElementById(rootId);\n\n return <>{globalPortal && <Portal container={globalPortal}>{rootNode}</Portal>}</>;\n },\n );\n\nexport const popupConfig = {\n name: 'Popup',\n tag: 'div',\n layout: popupRoot,\n base: '',\n variations: {},\n defaults: {},\n};\n"],"names":["handlePosition","placement","offset","x","y","_offset","_slicedToArray","_x","_y","concat","left","top","transform","right","bottom","placements","split","forEach","placementValue","isCenteredX","undefined","isCenteredY","popupRoot","Root","forwardRef","_ref","outerRootRef","id","_ref$isOpen","isOpen","_ref$opened","opened","_ref$placement","_ref$offset","_ref$frame","frame","children","overlay","zIndex","popupInfo","_ref$withAnimation","withAnimation","className","rest","_objectWithoutProperties","_excluded","innerIsOpen","uniqId","safeUseId","innerId","_usePopup","usePopup","isVisible","animationInfo","setVisible","rootId","portalRef","useRef","contentRef","innerRef","useForkRef","cls","cx","endAnimation","classes","endTransition","rootNode","React","createElement","_extends","PopupRoot","ref","position","current","canUseDOM","Portal","container","withFrameId","containerElement","document","getElementById","StyledPortalContainer","globalPortal","Fragment","popupConfig","name","tag","layout","base","variations","defaults"],"mappings":";;;;;;;;;;;;AAaO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CACvBC,SAAyB,EACzBC,MAA2C,EACvB;EACpB,IAAIC,CAAC,GAAG,MAAM,CAAA;EACd,IAAIC,CAAC,GAAG,MAAM,CAAA;AAEd,EAAA,IAAIF,MAAM,EAAE;AACR,IAAA,IAAAG,OAAA,GAAAC,cAAA,CAAiBJ,MAAM,EAAA,CAAA,CAAA;AAAhBK,MAAAA,EAAE,GAAAF,OAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,EAAE,GAAAH,OAAA,CAAA,CAAA,CAAA,CAAA;IACbF,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAE,MAAA,CAAMF,EAAE,EAAA,KAAA,CAAA,G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useRef } from 'react';\nimport { useForkRef, safeUseId } from '@salutejs/plasma-core';\n\nimport { RootProps } from '../../engines/types';\nimport { canUseDOM, cx } from '../../utils';\nimport { Portal } from '../Portal';\n\nimport type { PopupPlacementBasic, PopupPlacement, PopupPositionType, PopupProps } from './Popup.types';\nimport { PopupRoot } from './PopupRoot';\nimport { usePopup } from './hooks';\nimport { classes } from './Popup.tokens';\nimport { StyledPortalContainer } from './Popup.styles';\n\nexport const handlePosition = (\n placement: PopupPlacement,\n offset: [number, number] | [string, string],\n): PopupPositionType => {\n let x = '0rem';\n let y = '0rem';\n\n if (offset) {\n const [_x, _y] = offset;\n x = typeof _x === 'number' ? `${_x}rem` : _x;\n y = typeof _y === 'number' ? `${_y}rem` : _y;\n }\n\n if (!placement || placement === 'center') {\n return {\n left: `calc(50% + ${x})`,\n top: `calc(50% - ${y})`,\n transform: 'translate(-50%, -50%)',\n };\n }\n\n let left;\n let right;\n let top;\n let bottom;\n let transform;\n const placements = placement.split('-') as PopupPlacementBasic[];\n\n placements.forEach((placementValue: PopupPlacementBasic) => {\n switch (placementValue) {\n case 'left':\n left = x;\n break;\n case 'right':\n right = x;\n break;\n case 'top':\n top = y;\n break;\n case 'bottom':\n bottom = y;\n break;\n default:\n break;\n }\n });\n\n const isCenteredX = left === undefined && right === undefined;\n const isCenteredY = top === undefined && bottom === undefined;\n\n if (isCenteredX) {\n transform = 'translateX(-50%)';\n }\n\n if (isCenteredY) {\n transform = 'translateY(-50%)';\n }\n\n return {\n left: isCenteredX ? `calc(50% + ${x})` : left,\n right,\n top: isCenteredY ? `calc(50% - ${y})` : top,\n bottom,\n transform,\n };\n};\n\n/**\n * Базовый компонент Popup.\n */\nexport const popupRoot = (Root: RootProps<HTMLDivElement, PopupProps>) =>\n forwardRef<HTMLDivElement, PopupProps>(\n (\n {\n id,\n isOpen = false,\n opened = false,\n placement = 'center',\n offset = [0, 0],\n frame = 'document',\n children,\n overlay,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n role,\n zIndex,\n popupInfo,\n withAnimation = false,\n className,\n ...rest\n },\n outerRootRef,\n ) => {\n const innerIsOpen = isOpen || opened;\n\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n\n const { isVisible, animationInfo, setVisible, rootId } = usePopup({\n isOpen: innerIsOpen,\n id: innerId,\n popupInfo,\n withAnimation,\n });\n\n const portalRef = useRef<HTMLDivElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n const innerRef = useForkRef<HTMLDivElement>(contentRef, outerRootRef);\n\n if (!isVisible && !innerIsOpen) {\n return null;\n }\n\n const cls = cx(\n className,\n animationInfo?.endAnimation ? classes.endAnimation : '',\n animationInfo?.endTransition ? classes.endTransition : '',\n );\n\n const rootNode = (\n <Root className={cls} {...rest}>\n {overlay}\n <PopupRoot\n id={innerId}\n ref={innerRef}\n position={handlePosition(placement, offset)}\n zIndex={zIndex}\n frame={frame}\n animationInfo={animationInfo}\n setVisible={setVisible}\n >\n {children}\n </PopupRoot>\n </Root>\n );\n\n if (typeof frame !== 'string' && frame && frame.current) {\n return <Portal container={frame.current}>{rootNode}</Portal>;\n }\n\n const withFrameId = typeof frame === 'string' && frame !== 'document';\n const containerElement = withFrameId && canUseDOM && document.getElementById(frame as string);\n\n if (containerElement) {\n return (\n <Portal container={containerElement}>\n <StyledPortalContainer ref={portalRef}>\n {portalRef.current && <Portal container={portalRef.current}>{rootNode}</Portal>}\n </StyledPortalContainer>{' '}\n </Portal>\n );\n }\n\n const globalPortal = canUseDOM && document.getElementById(rootId);\n\n return <>{globalPortal && <Portal container={globalPortal}>{rootNode}</Portal>}</>;\n },\n );\n\nexport const popupConfig = {\n name: 'Popup',\n tag: 'div',\n layout: popupRoot,\n base: '',\n variations: {},\n defaults: {},\n};\n"],"names":["handlePosition","placement","offset","x","y","_offset","_slicedToArray","_x","_y","concat","left","top","transform","right","bottom","placements","split","forEach","placementValue","isCenteredX","undefined","isCenteredY","popupRoot","Root","forwardRef","_ref","outerRootRef","id","_ref$isOpen","isOpen","_ref$opened","opened","_ref$placement","_ref$offset","_ref$frame","frame","children","overlay","zIndex","popupInfo","_ref$withAnimation","withAnimation","className","rest","_objectWithoutProperties","_excluded","innerIsOpen","uniqId","safeUseId","innerId","_usePopup","usePopup","isVisible","animationInfo","setVisible","rootId","portalRef","useRef","contentRef","innerRef","useForkRef","cls","cx","endAnimation","classes","endTransition","rootNode","React","createElement","_extends","PopupRoot","ref","position","current","Portal","container","withFrameId","containerElement","canUseDOM","document","getElementById","StyledPortalContainer","globalPortal","Fragment","popupConfig","name","tag","layout","base","variations","defaults"],"mappings":";;;;;;;;;;;;AAaO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CACvBC,SAAyB,EACzBC,MAA2C,EACvB;EACpB,IAAIC,CAAC,GAAG,MAAM,CAAA;EACd,IAAIC,CAAC,GAAG,MAAM,CAAA;AAEd,EAAA,IAAIF,MAAM,EAAE;AACR,IAAA,IAAAG,OAAA,GAAAC,cAAA,CAAiBJ,MAAM,EAAA,CAAA,CAAA;AAAhBK,MAAAA,EAAE,GAAAF,OAAA,CAAA,CAAA,CAAA;AAAEG,MAAAA,EAAE,GAAAH,OAAA,CAAA,CAAA,CAAA,CAAA;IACbF,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAE,MAAA,CAAMF,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CAAA;IAC5CH,CAAC,GAAG,OAAOI,EAAE,KAAK,QAAQ,MAAAC,MAAA,CAAMD,EAAE,EAAA,KAAA,CAAA,GAAQA,EAAE,CAAA;AAChD,GAAA;AAEA,EAAA,IAAI,CAACP,SAAS,IAAIA,SAAS,KAAK,QAAQ,EAAE;IACtC,OAAO;AACHS,MAAAA,IAAI,EAAAD,aAAAA,CAAAA,MAAA,CAAgBN,CAAC,EAAG,GAAA,CAAA;AACxBQ,MAAAA,GAAG,EAAAF,aAAAA,CAAAA,MAAA,CAAgBL,CAAC,EAAG,GAAA,CAAA;AACvBQ,MAAAA,SA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AACiB,OAAO,iBAAIN,KAAA,CAAAC,aAAA,CAACM,MAAM,EAAA;QAACC,SAAS,EAAEnB,SAAS,CAACiB,OAAAA;AAAQ,OAAA,EAAEP,QAAiB,CAC3D,CAAC,EAAC,GACrB,CAAC,CAAA;AAEjB,KAAA;IAEA,IAAMgB,YAAY,GAAGJ,SAAS,IAAIC,QAAQ,CAACC,cAAc,CAACzB,MAAM,CAAC,CAAA;AAEjE,IAAA,oBAAOY,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAgB,QAAA,EAAGD,IAAAA,EAAAA,YAAY,iBAAIf,KAAA,CAAAC,aAAA,CAACM,MAAM,EAAA;AAACC,MAAAA,SAAS,EAAEO,YAAAA;KAAehB,EAAAA,QAAiB,CAAI,CAAC,CAAA;AACtF,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMkB,WAAW,GAAG;AACvBC,EAAAA,IAAI,EAAE,OAAO;AACbC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEjE,SAAS;AACjBkE,EAAAA,IAAI,EAAE,EAAE;EACRC,UAAU,EAAE,EAAE;AACdC,EAAAA,QAAQ,EAAE,EAAC;AACf;;;;"}
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import ReactDOM from 'react-dom';
3
- import { canUseDOM } from '../../utils/canUseDOM.js';
4
3
 
5
4
  /**
6
5
  * Вспомогательный компонент. Используется в Popup, Popover.
@@ -11,9 +10,6 @@ var Portal = function Portal(_ref) {
11
10
  container = _ref.container,
12
11
  _ref$disabled = _ref.disabled,
13
12
  disabled = _ref$disabled === void 0 ? false : _ref$disabled;
14
- if (!canUseDOM) {
15
- return null;
16
- }
17
13
  var portalContainer = typeof container === 'function' ? container() : container;
18
14
  return /*#__PURE__*/React.createElement(React.Fragment, null, disabled && children, !disabled && /*#__PURE__*/ReactDOM.createPortal(children, portalContainer));
19
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Portal.js","sources":["../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { canUseDOM } from '../../utils';\n\nimport { PortalProps } from './Portal.types';\n\n/**\n * Вспомогательный компонент. Используется в Popup, Popover.\n * Представляет собой ReactDOM.createPortal() в форме компонента.\n */\nexport const Portal: FC<PortalProps> = ({ children, container, disabled = false }) => {\n if (!canUseDOM) {\n return null;\n }\n\n const portalContainer = typeof container === 'function' ? container() : container;\n\n return (\n <>\n {disabled && children}\n {!disabled && ReactDOM.createPortal(children, portalContainer)}\n </>\n );\n};\n"],"names":["Portal","_ref","children","container","_ref$disabled","disabled","canUseDOM","portalContainer","React","createElement","Fragment","ReactDOM","createPortal"],"mappings":";;;;AAOA;AACA;AACA;AACA;IACaA,MAAuB,GAAG,SAA1BA,MAAuBA,CAAAC,IAAA,EAAkD;AAAA,EAAA,IAA5CC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS;IAAAC,aAAA,GAAAH,IAAA,CAAEI,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA,CAAA;EAC3E,IAAI,CAACE,SAAS,EAAE;AACZ,IAAA,OAAO,IAAI,CAAA;AACf,GAAA;EAEA,IAAMC,eAAe,GAAG,OAAOJ,SAAS,KAAK,UAAU,GAAGA,SAAS,EAAE,GAAGA,SAAS,CAAA;EAEjF,oBACIK,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAE,QAAA,EACKL,IAAAA,EAAAA,QAAQ,IAAIH,QAAQ,EACpB,CAACG,QAAQ,iBAAIM,QAAQ,CAACC,YAAY,CAACV,QAAQ,EAAEK,eAAe,CAC/D,CAAC,CAAA;AAEX;;;;"}
1
+ {"version":3,"file":"Portal.js","sources":["../../../src/components/Portal/Portal.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { PortalProps } from './Portal.types';\n\n/**\n * Вспомогательный компонент. Используется в Popup, Popover.\n * Представляет собой ReactDOM.createPortal() в форме компонента.\n */\nexport const Portal: FC<PortalProps> = ({ children, container, disabled = false }) => {\n const portalContainer = typeof container === 'function' ? container() : container;\n\n return (\n <>\n {disabled && children}\n {!disabled && ReactDOM.createPortal(children, portalContainer)}\n </>\n );\n};\n"],"names":["Portal","_ref","children","container","_ref$disabled","disabled","portalContainer","React","createElement","Fragment","ReactDOM","createPortal"],"mappings":";;;AAKA;AACA;AACA;AACA;IACaA,MAAuB,GAAG,SAA1BA,MAAuBA,CAAAC,IAAA,EAAkD;AAAA,EAAA,IAA5CC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS;IAAAC,aAAA,GAAAH,IAAA,CAAEI,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA,CAAA;EAC3E,IAAME,eAAe,GAAG,OAAOH,SAAS,KAAK,UAAU,GAAGA,SAAS,EAAE,GAAGA,SAAS,CAAA;EAEjF,oBACII,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAE,QAAA,EACKJ,IAAAA,EAAAA,QAAQ,IAAIH,QAAQ,EACpB,CAACG,QAAQ,iBAAIK,QAAQ,CAACC,YAAY,CAACT,QAAQ,EAAEI,eAAe,CAC/D,CAAC,CAAA;AAEX;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salutejs/plasma-new-hope",
3
- "version": "0.177.1-canary.1515.11575336640.0",
3
+ "version": "0.177.1-dev.0",
4
4
  "description": "Salute Design System blueprint",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",
@@ -80,7 +80,7 @@
80
80
  "@rollup/plugin-babel": "^6.0.4",
81
81
  "@rollup/plugin-commonjs": "^25.0.4",
82
82
  "@rollup/plugin-node-resolve": "^15.1.0",
83
- "@salutejs/plasma-sb-utils": "0.181.1-canary.1515.11575336640.0",
83
+ "@salutejs/plasma-sb-utils": "0.181.1-dev.0",
84
84
  "@salutejs/plasma-themes": "0.22.0-dev.0",
85
85
  "@storybook/addon-docs": "^7.6.17",
86
86
  "@storybook/addon-essentials": "^7.6.17",
@@ -115,7 +115,7 @@
115
115
  "@linaria/react": "5.0.3",
116
116
  "@popperjs/core": "2.11.8",
117
117
  "@salutejs/input-core": "2.1.2",
118
- "@salutejs/plasma-core": "1.183.1-canary.1515.11575336640.0",
118
+ "@salutejs/plasma-core": "1.183.1-dev.0",
119
119
  "@salutejs/react-maskinput": "3.2.6",
120
120
  "classnames": "2.5.1",
121
121
  "dayjs": "1.11.11",
@@ -128,5 +128,5 @@
128
128
  "sideEffects": [
129
129
  "*.css"
130
130
  ],
131
- "gitHead": "b7aa62d39799ec8ee26412253f20054c169b9222"
131
+ "gitHead": "e688b9d65ede18d2cd4e3dc05e0435c57c88e94b"
132
132
  }
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.dropdownDividerRoot = exports.dropdownDividerConfig = void 0;
8
8
  var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
9
- var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
9
+ var _utils = /*#__PURE__*/require("../../../../utils");
10
10
  var _base = /*#__PURE__*/require("./variations/_view/base");
11
11
  var _base2 = /*#__PURE__*/require("./variations/_size/base");
12
12
  var _DropdownDivider = /*#__PURE__*/require("./DropdownDivider.styles");
@@ -26,7 +26,7 @@ var dropdownDividerRoot = exports.dropdownDividerRoot = function dropdownDivider
26
26
  view = _ref.view,
27
27
  size = _ref.size,
28
28
  rest = _objectWithoutProperties(_ref, _excluded);
29
- var uniqId = (0, _plasmaCore.useUniqId)();
29
+ var uniqId = (0, _utils.safeUseId)();
30
30
  var innerId = id || uniqId;
31
31
  return /*#__PURE__*/_react["default"].createElement(Root, {
32
32
  id: innerId,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.dropdownFooterRoot = exports.dropdownFooterConfig = void 0;
8
8
  var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
9
- var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
9
+ var _utils = /*#__PURE__*/require("../../../../utils");
10
10
  var _base = /*#__PURE__*/require("./variations/_view/base");
11
11
  var _base2 = /*#__PURE__*/require("./variations/_size/base");
12
12
  var _DropdownFooter = /*#__PURE__*/require("./DropdownFooter.styles");
@@ -27,7 +27,7 @@ var dropdownFooterRoot = exports.dropdownFooterRoot = function dropdownFooterRoo
27
27
  view = _ref.view,
28
28
  size = _ref.size,
29
29
  rest = _objectWithoutProperties(_ref, _excluded);
30
- var uniqId = (0, _plasmaCore.useUniqId)();
30
+ var uniqId = (0, _utils.safeUseId)();
31
31
  var innerId = id || uniqId;
32
32
  return /*#__PURE__*/_react["default"].createElement(Root, {
33
33
  id: innerId,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.dropdownGroupRoot = exports.dropdownGroupConfig = void 0;
8
8
  var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
9
- var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
9
+ var _utils = /*#__PURE__*/require("../../../../utils");
10
10
  var _base = /*#__PURE__*/require("./variations/_view/base");
11
11
  var _base2 = /*#__PURE__*/require("./variations/_size/base");
12
12
  var _DropdownGroup = /*#__PURE__*/require("./DropdownGroup.styles");
@@ -30,7 +30,7 @@ var dropdownGroupRoot = exports.dropdownGroupRoot = function dropdownGroupRoot(R
30
30
  view = _ref.view,
31
31
  size = _ref.size,
32
32
  rest = _objectWithoutProperties(_ref, _excluded);
33
- var uniqId = (0, _plasmaCore.useUniqId)();
33
+ var uniqId = (0, _utils.safeUseId)();
34
34
  var innerId = id || uniqId;
35
35
  return /*#__PURE__*/_react["default"].createElement(Root, {
36
36
  id: innerId,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.dropdownHeaderRoot = exports.dropdownHeaderConfig = void 0;
8
8
  var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
9
- var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
9
+ var _utils = /*#__PURE__*/require("../../../../utils");
10
10
  var _base = /*#__PURE__*/require("./variations/_view/base");
11
11
  var _base2 = /*#__PURE__*/require("./variations/_size/base");
12
12
  var _DropdownHeader = /*#__PURE__*/require("./DropdownHeader.styles");
@@ -27,7 +27,7 @@ var dropdownHeaderRoot = exports.dropdownHeaderRoot = function dropdownHeaderRoo
27
27
  size = _ref.size,
28
28
  children = _ref.children,
29
29
  rest = _objectWithoutProperties(_ref, _excluded);
30
- var uniqId = (0, _plasmaCore.useUniqId)();
30
+ var uniqId = (0, _utils.safeUseId)();
31
31
  var innerId = id || uniqId;
32
32
  return /*#__PURE__*/_react["default"].createElement(Root, {
33
33
  id: innerId,
@@ -7,10 +7,12 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.dropdownOldRoot = exports.dropdownOldConfig = void 0;
8
8
  var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
9
9
  var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
10
+ var _hooks = /*#__PURE__*/require("../../../../hooks");
11
+ var _utils = /*#__PURE__*/require("../../../../utils");
10
12
  var _base = /*#__PURE__*/require("./variations/_view/base");
11
13
  var _base2 = /*#__PURE__*/require("./variations/_size/base");
12
14
  var _Dropdown = /*#__PURE__*/require("./Dropdown.styles");
13
- var _utils = /*#__PURE__*/require("./utils");
15
+ var _utils2 = /*#__PURE__*/require("./utils");
14
16
  var _excluded = ["id", "target", "children", "hasArrow", "role", "view", "size", "frame", "onToggle", "isFocusTrapped", "isOpen", "opened", "placement", "trigger", "offset", "preventOverflow", "closeOnOverlayClick", "closeOnEsc"];
15
17
  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); }
16
18
  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; }
@@ -51,12 +53,12 @@ var dropdownOldRoot = exports.dropdownOldRoot = function dropdownOldRoot(Root) {
51
53
  closeOnEsc = _ref$closeOnEsc === void 0 ? false : _ref$closeOnEsc,
52
54
  rest = _objectWithoutProperties(_ref, _excluded);
53
55
  var innerIsOpen = Boolean(isOpen || opened);
54
- var uniqId = (0, _plasmaCore.useUniqId)();
56
+ var uniqId = (0, _utils.safeUseId)();
55
57
  var innerId = id || uniqId;
56
58
  var rootRef = (0, _react.useRef)(null);
57
59
  var dropdownRef = (0, _react.useRef)(null);
58
60
  var handleRef = (0, _plasmaCore.useForkRef)(rootRef, outerRootRef);
59
- var trapRef = (0, _plasmaCore.useFocusTrap)(innerIsOpen && isFocusTrapped);
61
+ var trapRef = (0, _hooks.useFocusTrap)(innerIsOpen && isFocusTrapped);
60
62
  var dropdownForkRef = (0, _plasmaCore.useForkRef)(dropdownRef, trapRef);
61
63
  return /*#__PURE__*/_react["default"].createElement(_Dropdown.StyledPopover, {
62
64
  role: role,
@@ -71,7 +73,7 @@ var dropdownOldRoot = exports.dropdownOldRoot = function dropdownOldRoot(Root) {
71
73
  offset: offset,
72
74
  preventOverflow: preventOverflow,
73
75
  hasArrow: hasArrow,
74
- placement: (0, _utils.getPlacements)(placement),
76
+ placement: (0, _utils2.getPlacements)(placement),
75
77
  trigger: trigger,
76
78
  closeOnOverlayClick: closeOnOverlayClick,
77
79
  closeOnEsc: closeOnEsc,
@@ -8,6 +8,7 @@ exports.popoverRoot = exports.popoverConfig = exports.POPOVER_PORTAL_ID = export
8
8
  var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
9
9
  var _reactPopper = /*#__PURE__*/require("react-popper");
10
10
  var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
11
+ var _hooks = /*#__PURE__*/require("../../hooks");
11
12
  var _utils = /*#__PURE__*/require("../../utils");
12
13
  var _Portal = /*#__PURE__*/require("../Portal");
13
14
  var _base = /*#__PURE__*/require("./variations/_view/base");
@@ -72,7 +73,7 @@ var popoverRoot = exports.popoverRoot = function popoverRoot(Root) {
72
73
  var popoverRef = (0, _react.useRef)(null);
73
74
  var handleRef = (0, _plasmaCore.useForkRef)(rootRef, outerRootRef);
74
75
  var portalRef = (0, _react.useRef)(null);
75
- var trapRef = (0, _plasmaCore.useFocusTrap)(innerIsOpen && isFocusTrapped);
76
+ var trapRef = (0, _hooks.useFocusTrap)(innerIsOpen && isFocusTrapped);
76
77
  var popoverForkRef = (0, _plasmaCore.useForkRef)(popoverRef, trapRef);
77
78
  var _useState = (0, _react.useState)(null),
78
79
  _useState2 = _slicedToArray(_useState, 2),
@@ -139,7 +139,7 @@ var popupRoot = exports.popupRoot = function popupRoot(Root) {
139
139
  animationInfo: animationInfo,
140
140
  setVisible: setVisible
141
141
  }, children));
142
- if (typeof frame !== 'string' && frame && frame.current && _utils.canUseDOM) {
142
+ if (typeof frame !== 'string' && frame && frame.current) {
143
143
  return /*#__PURE__*/_react["default"].createElement(_Portal.Portal, {
144
144
  container: frame.current
145
145
  }, rootNode);
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.Portal = void 0;
7
7
  var _react = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("react"));
8
8
  var _reactDom = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("react-dom"));
9
- var _utils = /*#__PURE__*/require("../../utils");
10
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
10
  /**
12
11
  * Вспомогательный компонент. Используется в Popup, Popover.
@@ -17,9 +16,6 @@ var Portal = exports.Portal = function Portal(_ref) {
17
16
  container = _ref.container,
18
17
  _ref$disabled = _ref.disabled,
19
18
  disabled = _ref$disabled === void 0 ? false : _ref$disabled;
20
- if (!_utils.canUseDOM) {
21
- return null;
22
- }
23
19
  var portalContainer = typeof container === 'function' ? container() : container;
24
20
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, disabled && children, !disabled && /*#__PURE__*/_reactDom["default"].createPortal(children, portalContainer));
25
21
  };
@@ -3,7 +3,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
5
  import React, { forwardRef } from 'react';
6
- import { useUniqId } from '@salutejs/plasma-core';
6
+ import { safeUseId } from '../../../../utils';
7
7
  import { base as viewCSS } from './variations/_view/base';
8
8
  import { base as sizeCSS } from './variations/_size/base';
9
9
  import { StyledDropdownDivider } from './DropdownDivider.styles';
@@ -17,7 +17,7 @@ export var dropdownDividerRoot = function dropdownDividerRoot(Root) {
17
17
  view = _ref.view,
18
18
  size = _ref.size,
19
19
  rest = _objectWithoutProperties(_ref, _excluded);
20
- var uniqId = useUniqId();
20
+ var uniqId = safeUseId();
21
21
  var innerId = id || uniqId;
22
22
  return /*#__PURE__*/React.createElement(Root, {
23
23
  id: innerId,
@@ -3,7 +3,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
5
  import React, { forwardRef } from 'react';
6
- import { useUniqId } from '@salutejs/plasma-core';
6
+ import { safeUseId } from '../../../../utils';
7
7
  import { base as viewCSS } from './variations/_view/base';
8
8
  import { base as sizeCSS } from './variations/_size/base';
9
9
  import { StyledDropdownFooter } from './DropdownFooter.styles';
@@ -18,7 +18,7 @@ export var dropdownFooterRoot = function dropdownFooterRoot(Root) {
18
18
  view = _ref.view,
19
19
  size = _ref.size,
20
20
  rest = _objectWithoutProperties(_ref, _excluded);
21
- var uniqId = useUniqId();
21
+ var uniqId = safeUseId();
22
22
  var innerId = id || uniqId;
23
23
  return /*#__PURE__*/React.createElement(Root, {
24
24
  id: innerId,
@@ -3,7 +3,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
5
  import React, { forwardRef } from 'react';
6
- import { useUniqId } from '@salutejs/plasma-core';
6
+ import { safeUseId } from '../../../../utils';
7
7
  import { base as viewCSS } from './variations/_view/base';
8
8
  import { base as sizeCSS } from './variations/_size/base';
9
9
  import { StyledDropdownGroup, StyledDropdownLabel } from './DropdownGroup.styles';
@@ -21,7 +21,7 @@ export var dropdownGroupRoot = function dropdownGroupRoot(Root) {
21
21
  view = _ref.view,
22
22
  size = _ref.size,
23
23
  rest = _objectWithoutProperties(_ref, _excluded);
24
- var uniqId = useUniqId();
24
+ var uniqId = safeUseId();
25
25
  var innerId = id || uniqId;
26
26
  return /*#__PURE__*/React.createElement(Root, {
27
27
  id: innerId,
@@ -3,7 +3,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
5
  import React, { forwardRef } from 'react';
6
- import { useUniqId } from '@salutejs/plasma-core';
6
+ import { safeUseId } from '../../../../utils';
7
7
  import { base as viewCSS } from './variations/_view/base';
8
8
  import { base as sizeCSS } from './variations/_size/base';
9
9
  import { StyledDropdownHeader } from './DropdownHeader.styles';
@@ -18,7 +18,7 @@ export var dropdownHeaderRoot = function dropdownHeaderRoot(Root) {
18
18
  size = _ref.size,
19
19
  children = _ref.children,
20
20
  rest = _objectWithoutProperties(_ref, _excluded);
21
- var uniqId = useUniqId();
21
+ var uniqId = safeUseId();
22
22
  var innerId = id || uniqId;
23
23
  return /*#__PURE__*/React.createElement(Root, {
24
24
  id: innerId,
@@ -3,7 +3,9 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
5
  import React, { forwardRef, useRef } from 'react';
6
- import { useFocusTrap, useForkRef, useUniqId } from '@salutejs/plasma-core';
6
+ import { useForkRef } from '@salutejs/plasma-core';
7
+ import { useFocusTrap } from '../../../../hooks';
8
+ import { safeUseId } from '../../../../utils';
7
9
  import { base as viewCSS } from './variations/_view/base';
8
10
  import { base as sizeCSS } from './variations/_size/base';
9
11
  import { StyledDropdown, StyledPopover } from './Dropdown.styles';
@@ -42,7 +44,7 @@ export var dropdownOldRoot = function dropdownOldRoot(Root) {
42
44
  closeOnEsc = _ref$closeOnEsc === void 0 ? false : _ref$closeOnEsc,
43
45
  rest = _objectWithoutProperties(_ref, _excluded);
44
46
  var innerIsOpen = Boolean(isOpen || opened);
45
- var uniqId = useUniqId();
47
+ var uniqId = safeUseId();
46
48
  var innerId = id || uniqId;
47
49
  var rootRef = useRef(null);
48
50
  var dropdownRef = useRef(null);
@@ -16,7 +16,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
16
16
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
17
  import React, { useRef, useCallback, useEffect, useState, forwardRef } from 'react';
18
18
  import { usePopper } from 'react-popper';
19
- import { useFocusTrap, useForkRef } from '@salutejs/plasma-core';
19
+ import { useForkRef } from '@salutejs/plasma-core';
20
+ import { useFocusTrap } from '../../hooks';
20
21
  import { cx } from '../../utils';
21
22
  import { Portal } from '../Portal';
22
23
  import { base as viewCSS } from './variations/_view/base';
@@ -130,7 +130,7 @@ export var popupRoot = function popupRoot(Root) {
130
130
  animationInfo: animationInfo,
131
131
  setVisible: setVisible
132
132
  }, children));
133
- if (typeof frame !== 'string' && frame && frame.current && canUseDOM) {
133
+ if (typeof frame !== 'string' && frame && frame.current) {
134
134
  return /*#__PURE__*/React.createElement(Portal, {
135
135
  container: frame.current
136
136
  }, rootNode);
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import ReactDOM from 'react-dom';
3
- import { canUseDOM } from '../../utils';
4
3
  /**
5
4
  * Вспомогательный компонент. Используется в Popup, Popover.
6
5
  * Представляет собой ReactDOM.createPortal() в форме компонента.
@@ -10,9 +9,6 @@ export var Portal = function Portal(_ref) {
10
9
  container = _ref.container,
11
10
  _ref$disabled = _ref.disabled,
12
11
  disabled = _ref$disabled === void 0 ? false : _ref$disabled;
13
- if (!canUseDOM) {
14
- return null;
15
- }
16
12
  var portalContainer = typeof container === 'function' ? container() : container;
17
13
  return /*#__PURE__*/React.createElement(React.Fragment, null, disabled && children, !disabled && /*#__PURE__*/ReactDOM.createPortal(children, portalContainer));
18
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownDivider.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/ui/DropdownDivider/DropdownDivider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,mBAAmB,SAAU,UAAU,cAAc,EAAE,oBAAoB,CAAC;;;;wCAUnF,CAAC;AAEP,eAAO,MAAM,qBAAqB;;;mBAZQ,UAAU,cAAc,EAAE,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;CA6BxF,CAAC"}
1
+ {"version":3,"file":"DropdownDivider.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/ui/DropdownDivider/DropdownDivider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,mBAAmB,SAAU,UAAU,cAAc,EAAE,oBAAoB,CAAC;;;;wCAUnF,CAAC;AAEP,eAAO,MAAM,qBAAqB;;;mBAZQ,UAAU,cAAc,EAAE,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;CA6BxF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownFooter.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/ui/DropdownFooter/DropdownFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,kBAAkB,SAAU,UAAU,cAAc,EAAE,mBAAmB,CAAC;;;;wCAclF,CAAC;AAEN,eAAO,MAAM,oBAAoB;;;mBAhBQ,UAAU,cAAc,EAAE,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;CAiCtF,CAAC"}
1
+ {"version":3,"file":"DropdownFooter.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/ui/DropdownFooter/DropdownFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,kBAAkB,SAAU,UAAU,cAAc,EAAE,mBAAmB,CAAC;;;;wCAclF,CAAC;AAEN,eAAO,MAAM,oBAAoB;;;mBAhBQ,UAAU,cAAc,EAAE,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;CAiCtF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownGroup.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/ui/DropdownGroup/DropdownGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,iBAAiB,SAAU,UAAU,cAAc,EAAE,kBAAkB,CAAC;;;;;;;;wCAehF,CAAC;AAEN,eAAO,MAAM,mBAAmB;;;mBAjBQ,UAAU,cAAc,EAAE,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;CAkCpF,CAAC"}
1
+ {"version":3,"file":"DropdownGroup.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/ui/DropdownGroup/DropdownGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D;;GAEG;AACH,eAAO,MAAM,iBAAiB,SAAU,UAAU,cAAc,EAAE,kBAAkB,CAAC;;;;;;;;wCAehF,CAAC;AAEN,eAAO,MAAM,mBAAmB;;;mBAjBQ,UAAU,cAAc,EAAE,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;CAkCpF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownHeader.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/ui/DropdownHeader/DropdownHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,kBAAkB,SAAU,UAAU,cAAc,EAAE,mBAAmB,CAAC;;;;wCAclF,CAAC;AAEN,eAAO,MAAM,oBAAoB;;;mBAhBQ,UAAU,cAAc,EAAE,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;CAiCtF,CAAC"}
1
+ {"version":3,"file":"DropdownHeader.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/ui/DropdownHeader/DropdownHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,kBAAkB,SAAU,UAAU,cAAc,EAAE,mBAAmB,CAAC;;;;wCAclF,CAAC;AAEN,eAAO,MAAM,oBAAoB;;;mBAhBQ,UAAU,cAAc,EAAE,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;CAiCtF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownOld.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/ui/DropdownOld/DropdownOld.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,eAAe,SAAU,UAAU,cAAc,EAAE,aAAa,CAAC,iKAgEzE,CAAC;AAEN,eAAO,MAAM,iBAAiB;;;mBAlEQ,UAAU,cAAc,EAAE,aAAa,CAAC;;;;;;;;;;;;;;CAmF7E,CAAC"}
1
+ {"version":3,"file":"DropdownOld.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/ui/DropdownOld/DropdownOld.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,eAAe,SAAU,UAAU,cAAc,EAAE,aAAa,CAAC,iKAgEzE,CAAC;AAEN,eAAO,MAAM,iBAAiB;;;mBAlEQ,UAAU,cAAc,EAAE,aAAa,CAAC;;;;;;;;;;;;;;CAmF7E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAKpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKrD,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAItE,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,WAAW,SAAU,UAAU,cAAc,EAAE,YAAY,CAAC,+JA2PpE,CAAC;AAEN,eAAO,MAAM,aAAa;;;mBA7PQ,UAAU,cAAc,EAAE,YAAY,CAAC;;;;;;;;;;CA0QxE,CAAC"}
1
+ {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAKpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMrD,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAItE,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,WAAW,SAAU,UAAU,cAAc,EAAE,YAAY,CAAC,+JA2PpE,CAAC;AAEN,eAAO,MAAM,aAAa;;;mBA7PQ,UAAU,cAAc,EAAE,YAAY,CAAC;;;;;;;;;;CA0QxE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../../src/components/Portal/Portal.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAalC,CAAC"}
1
+ {"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../../src/components/Portal/Portal.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CASlC,CAAC"}