@salutejs/plasma-new-hope 0.178.0-canary.1514.11575933383.0 → 0.178.1-canary.1515.11581730946.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. package/cjs/components/Counter/Counter.css +1 -1
  2. package/cjs/components/Counter/Counter.js +3 -13
  3. package/cjs/components/Counter/Counter.js.map +1 -1
  4. package/cjs/components/Counter/Counter.tokens.js +0 -4
  5. package/cjs/components/Counter/Counter.tokens.js.map +1 -1
  6. package/cjs/components/Counter/variations/_size/base.js +1 -1
  7. package/cjs/components/Counter/variations/_size/base.js.map +1 -1
  8. package/cjs/components/Counter/variations/_size/{base_4mz17d.css → base_1z0ohiy.css} +1 -1
  9. package/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
  10. package/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js.map +1 -1
  11. package/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
  12. package/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js.map +1 -1
  13. package/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
  14. package/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js.map +1 -1
  15. package/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
  16. package/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js.map +1 -1
  17. package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +4 -2
  18. package/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js.map +1 -1
  19. package/cjs/components/Popover/Popover.js +2 -1
  20. package/cjs/components/Popover/Popover.js.map +1 -1
  21. package/cjs/components/Popup/Popup.js +2 -2
  22. package/cjs/components/Popup/Popup.js.map +1 -1
  23. package/cjs/components/Popup/PopupContext.js +1 -1
  24. package/cjs/components/Popup/PopupContext.js.map +1 -1
  25. package/cjs/components/Portal/Portal.js +4 -0
  26. package/cjs/components/Portal/Portal.js.map +1 -1
  27. package/cjs/index.css +1 -1
  28. package/emotion/cjs/components/Counter/Counter.js +3 -13
  29. package/emotion/cjs/components/Counter/Counter.template-doc.mdx +2 -2
  30. package/emotion/cjs/components/Counter/Counter.tokens.js +1 -4
  31. package/emotion/cjs/components/Counter/variations/_size/base.js +1 -1
  32. package/emotion/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
  33. package/emotion/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
  34. package/emotion/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
  35. package/emotion/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
  36. package/emotion/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +6 -4
  37. package/emotion/cjs/components/Popover/Popover.js +2 -1
  38. package/emotion/cjs/components/Popup/Popup.js +1 -1
  39. package/emotion/cjs/components/Popup/PopupContext.js +1 -1
  40. package/emotion/cjs/components/Portal/Portal.js +4 -0
  41. package/emotion/cjs/examples/plasma_b2c/components/Counter/Counter.config.js +9 -12
  42. package/emotion/cjs/examples/plasma_b2c/components/Counter/Counter.stories.tsx +5 -7
  43. package/emotion/cjs/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +9 -6
  44. package/emotion/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +10 -6
  45. package/emotion/cjs/examples/plasma_web/components/Counter/Counter.config.js +9 -12
  46. package/emotion/cjs/examples/plasma_web/components/Counter/Counter.stories.tsx +5 -7
  47. package/emotion/cjs/examples/plasma_web/components/TextArea/TextArea.stories.tsx +9 -6
  48. package/emotion/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +10 -6
  49. package/emotion/es/components/Counter/Counter.js +3 -13
  50. package/emotion/es/components/Counter/Counter.template-doc.mdx +2 -2
  51. package/emotion/es/components/Counter/Counter.tokens.js +0 -3
  52. package/emotion/es/components/Counter/variations/_size/base.js +2 -2
  53. package/emotion/es/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
  54. package/emotion/es/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
  55. package/emotion/es/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
  56. package/emotion/es/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
  57. package/emotion/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +4 -2
  58. package/emotion/es/components/Popover/Popover.js +2 -1
  59. package/emotion/es/components/Popup/Popup.js +1 -1
  60. package/emotion/es/components/Popup/PopupContext.js +1 -1
  61. package/emotion/es/components/Portal/Portal.js +4 -0
  62. package/emotion/es/examples/plasma_b2c/components/Counter/Counter.config.js +9 -12
  63. package/emotion/es/examples/plasma_b2c/components/Counter/Counter.stories.tsx +5 -7
  64. package/emotion/es/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +9 -6
  65. package/emotion/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +10 -6
  66. package/emotion/es/examples/plasma_web/components/Counter/Counter.config.js +9 -12
  67. package/emotion/es/examples/plasma_web/components/Counter/Counter.stories.tsx +5 -7
  68. package/emotion/es/examples/plasma_web/components/TextArea/TextArea.stories.tsx +9 -6
  69. package/emotion/es/examples/plasma_web/components/TextField/TextField.stories.tsx +10 -6
  70. package/es/components/Counter/Counter.css +1 -1
  71. package/es/components/Counter/Counter.js +3 -13
  72. package/es/components/Counter/Counter.js.map +1 -1
  73. package/es/components/Counter/Counter.tokens.js +1 -4
  74. package/es/components/Counter/Counter.tokens.js.map +1 -1
  75. package/es/components/Counter/variations/_size/base.js +1 -1
  76. package/es/components/Counter/variations/_size/base.js.map +1 -1
  77. package/es/components/Counter/variations/_size/{base_4mz17d.css → base_1z0ohiy.css} +1 -1
  78. package/es/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
  79. package/es/components/Dropdown/ui/DropdownDivider/DropdownDivider.js.map +1 -1
  80. package/es/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
  81. package/es/components/Dropdown/ui/DropdownFooter/DropdownFooter.js.map +1 -1
  82. package/es/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
  83. package/es/components/Dropdown/ui/DropdownGroup/DropdownGroup.js.map +1 -1
  84. package/es/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
  85. package/es/components/Dropdown/ui/DropdownHeader/DropdownHeader.js.map +1 -1
  86. package/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +4 -2
  87. package/es/components/Dropdown/ui/DropdownOld/DropdownOld.js.map +1 -1
  88. package/es/components/Popover/Popover.js +2 -1
  89. package/es/components/Popover/Popover.js.map +1 -1
  90. package/es/components/Popup/Popup.js +2 -2
  91. package/es/components/Popup/Popup.js.map +1 -1
  92. package/es/components/Popup/PopupContext.js +1 -1
  93. package/es/components/Popup/PopupContext.js.map +1 -1
  94. package/es/components/Portal/Portal.js +4 -0
  95. package/es/components/Portal/Portal.js.map +1 -1
  96. package/es/index.css +1 -1
  97. package/package.json +4 -4
  98. package/styled-components/cjs/components/Counter/Counter.js +3 -13
  99. package/styled-components/cjs/components/Counter/Counter.template-doc.mdx +2 -2
  100. package/styled-components/cjs/components/Counter/Counter.tokens.js +1 -4
  101. package/styled-components/cjs/components/Counter/variations/_size/base.js +1 -1
  102. package/styled-components/cjs/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
  103. package/styled-components/cjs/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
  104. package/styled-components/cjs/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
  105. package/styled-components/cjs/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
  106. package/styled-components/cjs/components/Dropdown/ui/DropdownOld/DropdownOld.js +6 -4
  107. package/styled-components/cjs/components/Popover/Popover.js +2 -1
  108. package/styled-components/cjs/components/Popup/Popup.js +1 -1
  109. package/styled-components/cjs/components/Popup/PopupContext.js +1 -1
  110. package/styled-components/cjs/components/Portal/Portal.js +4 -0
  111. package/styled-components/cjs/examples/plasma_b2c/components/Counter/Counter.config.js +2 -5
  112. package/styled-components/cjs/examples/plasma_b2c/components/Counter/Counter.stories.tsx +5 -7
  113. package/styled-components/cjs/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +9 -6
  114. package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +10 -6
  115. package/styled-components/cjs/examples/plasma_web/components/Counter/Counter.config.js +2 -5
  116. package/styled-components/cjs/examples/plasma_web/components/Counter/Counter.stories.tsx +5 -7
  117. package/styled-components/cjs/examples/plasma_web/components/TextArea/TextArea.stories.tsx +9 -6
  118. package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +10 -6
  119. package/styled-components/es/components/Counter/Counter.js +3 -13
  120. package/styled-components/es/components/Counter/Counter.template-doc.mdx +2 -2
  121. package/styled-components/es/components/Counter/Counter.tokens.js +0 -3
  122. package/styled-components/es/components/Counter/variations/_size/base.js +2 -2
  123. package/styled-components/es/components/Dropdown/ui/DropdownDivider/DropdownDivider.js +2 -2
  124. package/styled-components/es/components/Dropdown/ui/DropdownFooter/DropdownFooter.js +2 -2
  125. package/styled-components/es/components/Dropdown/ui/DropdownGroup/DropdownGroup.js +2 -2
  126. package/styled-components/es/components/Dropdown/ui/DropdownHeader/DropdownHeader.js +2 -2
  127. package/styled-components/es/components/Dropdown/ui/DropdownOld/DropdownOld.js +4 -2
  128. package/styled-components/es/components/Popover/Popover.js +2 -1
  129. package/styled-components/es/components/Popup/Popup.js +1 -1
  130. package/styled-components/es/components/Popup/PopupContext.js +1 -1
  131. package/styled-components/es/components/Portal/Portal.js +4 -0
  132. package/styled-components/es/examples/plasma_b2c/components/Counter/Counter.config.js +2 -5
  133. package/styled-components/es/examples/plasma_b2c/components/Counter/Counter.stories.tsx +5 -7
  134. package/styled-components/es/examples/plasma_b2c/components/TextArea/TextArea.stories.tsx +9 -6
  135. package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +10 -6
  136. package/styled-components/es/examples/plasma_web/components/Counter/Counter.config.js +2 -5
  137. package/styled-components/es/examples/plasma_web/components/Counter/Counter.stories.tsx +5 -7
  138. package/styled-components/es/examples/plasma_web/components/TextArea/TextArea.stories.tsx +9 -6
  139. package/styled-components/es/examples/plasma_web/components/TextField/TextField.stories.tsx +10 -6
  140. package/types/components/Counter/Counter.d.ts.map +1 -1
  141. package/types/components/Counter/Counter.tokens.d.ts +0 -3
  142. package/types/components/Counter/Counter.tokens.d.ts.map +1 -1
  143. package/types/components/Counter/Counter.types.d.ts +2 -2
  144. package/types/components/Counter/variations/_size/base.d.ts.map +1 -1
  145. package/types/components/Dropdown/ui/DropdownDivider/DropdownDivider.d.ts.map +1 -1
  146. package/types/components/Dropdown/ui/DropdownFooter/DropdownFooter.d.ts.map +1 -1
  147. package/types/components/Dropdown/ui/DropdownGroup/DropdownGroup.d.ts.map +1 -1
  148. package/types/components/Dropdown/ui/DropdownHeader/DropdownHeader.d.ts.map +1 -1
  149. package/types/components/Dropdown/ui/DropdownOld/DropdownOld.d.ts.map +1 -1
  150. package/types/components/Popover/Popover.d.ts.map +1 -1
  151. package/types/components/Popup/PopupContext.d.ts.map +1 -1
  152. package/types/components/Portal/Portal.d.ts.map +1 -1
  153. package/types/examples/plasma_b2c/components/Counter/Counter.config.d.ts +0 -3
  154. package/types/examples/plasma_b2c/components/Counter/Counter.config.d.ts.map +1 -1
  155. package/types/examples/plasma_b2c/components/Counter/Counter.d.ts +0 -3
  156. package/types/examples/plasma_b2c/components/Counter/Counter.d.ts.map +1 -1
  157. package/types/examples/plasma_web/components/Counter/Counter.config.d.ts +0 -3
  158. package/types/examples/plasma_web/components/Counter/Counter.config.d.ts.map +1 -1
  159. package/types/examples/plasma_web/components/Counter/Counter.d.ts +0 -3
  160. package/types/examples/plasma_web/components/Counter/Counter.d.ts.map +1 -1
@@ -79,7 +79,7 @@ var PopupProvider = function PopupProvider(_ref) {
79
79
  };
80
80
  return /*#__PURE__*/React.createElement(PopupContext.Provider, {
81
81
  value: context
82
- }, children, /*#__PURE__*/React.createElement(Portal.Portal, {
82
+ }, children, canUseDOM.canUseDOM && /*#__PURE__*/React.createElement(Portal.Portal, {
83
83
  container: document.body
84
84
  }, /*#__PURE__*/React.createElement(Popup_styles.StyledPortal, {
85
85
  id: rootId
@@ -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';\n\nimport { hasModals } from '../Modal/ModalContext';\nimport { canUseDOM, safeUseId } from '../../utils';\nimport { Portal } from '../Portal';\n\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\nexport const PopupProvider: FC<PropsWithChildren> = ({ children }) => {\n const prevBodyOverflowY = useRef(canUseDOM ? document.body.style.overflowY : '');\n // eslint-disable-next-line no-shadow\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 <Portal container={document.body}>\n <StyledPortal id={rootId} />\n </Portal>\n </PopupContext.Provider>\n );\n};\n"],"names":["POPUP_PORTAL_ID","items","PopupContext","createContext","rootId","register","_info","Error","unregister","_id","usePopupContext","useContext","PopupProvider","_ref","children","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","Portal","container","StyledPortal"],"mappings":";;;;;;;;;;;;AASO,IAAMA,eAAe,GAAG,oBAAmB;AAElD,IAAMC,KAAkB,GAAG,EAAE,CAAA;AAE7B,IAAMC,YAAY,gBAAGC,mBAAa,CAAmB;AACjDF,EAAAA,KAAK,EAALA,KAAK;AACLG,EAAAA,MAAM,EAAEJ,eAAe;AACvB;EACAK,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,GAAA;AACJ,CAAC,CAAC,CAAA;AAEWG,IAAAA,eAAe,GAAG,SAAlBA,eAAeA,GAAA;EAAA,OAASC,gBAAU,CAACT,YAAY,CAAC,CAAA;AAAA,EAAA;IAEhDU,aAAoC,GAAG,SAAvCA,aAAoCA,CAAAC,IAAA,EAAqB;AAAA,EAAA,IAAfC,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CAAAC,aAAA,CAACK,yBAAY,EAAA;AAACb,IAAAA,EAAE,EAAEjC,MAAAA;GAAS,CACvB,CACW,CAAC,CAAA;AAEhC;;;;;;"}
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 { hasModals } from '../Modal/ModalContext';\nimport { canUseDOM, safeUseId } from '../../utils';\nimport { Portal } from '../Portal';\n\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\nexport const PopupProvider: FC<PropsWithChildren> = ({ children }) => {\n const prevBodyOverflowY = useRef(canUseDOM ? document.body.style.overflowY : '');\n // eslint-disable-next-line no-shadow\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 {canUseDOM && (\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","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","Portal","container","StyledPortal"],"mappings":";;;;;;;;;;;;AASO,IAAMA,eAAe,GAAG,oBAAmB;AAElD,IAAMC,KAAkB,GAAG,EAAE,CAAA;AAE7B,IAAMC,YAAY,gBAAGC,mBAAa,CAAmB;AACjDF,EAAAA,KAAK,EAALA,KAAK;AACLG,EAAAA,MAAM,EAAEJ,eAAe;AACvB;EACAK,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,GAAA;AACJ,CAAC,CAAC,CAAA;AAEWG,IAAAA,eAAe,GAAG,SAAlBA,eAAeA,GAAA;EAAA,OAASC,gBAAU,CAACT,YAAY,CAAC,CAAA;AAAA,EAAA;IAEhDU,aAAoC,GAAG,SAAvCA,aAAoCA,CAAAC,IAAA,EAAqB;AAAA,EAAA,IAAfC,QAAQ,GAAAD,IAAA,CAARC,QAAQ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Y,EAAA;AAACb,IAAAA,EAAE,EAAEjC,MAAAA;GAAS,CACvB,CAEO,CAAC,CAAA;AAEhC;;;;;;"}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var ReactDOM = require('react-dom');
7
+ var canUseDOM = require('../../utils/canUseDOM.js');
7
8
 
8
9
  /**
9
10
  * Вспомогательный компонент. Используется в Popup, Popover.
@@ -14,6 +15,9 @@ var Portal = function Portal(_ref) {
14
15
  container = _ref.container,
15
16
  _ref$disabled = _ref.disabled,
16
17
  disabled = _ref$disabled === void 0 ? false : _ref$disabled;
18
+ if (!canUseDOM.canUseDOM) {
19
+ return null;
20
+ }
17
21
  var portalContainer = typeof container === 'function' ? container() : container;
18
22
  return /*#__PURE__*/React.createElement(React.Fragment, null, disabled && children, !disabled && /*#__PURE__*/ReactDOM.createPortal(children, portalContainer));
19
23
  };
@@ -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 { 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;;;;"}
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,mBAAS,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;;;;"}
package/cjs/index.css CHANGED
@@ -475,7 +475,7 @@
475
475
 
476
476
  .base_1vjakah_b15waymg__f123ad8a{color:var(--plasma-counter-color);background-color:var(--plasma-counter-background);}
477
477
 
478
- .base_4mz17d_b1t6e429__b5e2cba4{font-family:var(--plasma-counter-font-family);font-size:var(--plasma-counter-font-size);font-style:var(--plasma-counter-font-style);font-weight:var(--plasma-counter-font-weight);-webkit-letter-spacing:var(--plasma-counter-letter-spacing);-moz-letter-spacing:var(--plasma-counter-letter-spacing);-ms-letter-spacing:var(--plasma-counter-letter-spacing);letter-spacing:var(--plasma-counter-letter-spacing);line-height:var(--plasma-counter-lineheight);border-radius:var(--plasma-counter-border-radius);height:var(--plasma-counter-height);padding-top:var(--plasma-counter-padding-top);padding-right:var(--plasma-counter-padding-right);padding-bottom:var(--plasma-counter-padding-bottom);padding-left:var(--plasma-counter-padding-left);}.base_4mz17d_b1t6e429__b5e2cba4.base_4mz17d__PlasmaCounterRound__b5e2cba4{width:var(--plasma-counter-height);}
478
+ .base_1z0ohiy_b1t6e429__9712bb45{font-family:var(--plasma-counter-font-family);font-size:var(--plasma-counter-font-size);font-style:var(--plasma-counter-font-style);font-weight:var(--plasma-counter-font-weight);-webkit-letter-spacing:var(--plasma-counter-letter-spacing);-moz-letter-spacing:var(--plasma-counter-letter-spacing);-ms-letter-spacing:var(--plasma-counter-letter-spacing);letter-spacing:var(--plasma-counter-letter-spacing);line-height:var(--plasma-counter-lineheight);border-radius:var(--plasma-counter-border-radius);height:var(--plasma-counter-height);padding-top:var(--plasma-counter-padding-top);padding-right:var(--plasma-counter-padding-right);padding-bottom:var(--plasma-counter-padding-bottom);padding-left:var(--plasma-counter-padding-left);}
479
479
 
480
480
  .Counter_styles_1uue90v_b1dqw7l5__00d0b847{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;box-sizing:border-box;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;width:-webkit-max-content;width:-moz-max-content;width:max-content;}
481
481
 
@@ -6,38 +6,28 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.counterRoot = exports.counterConfig = void 0;
8
8
  var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
9
- var _utils = /*#__PURE__*/require("../../utils");
10
9
  var _base = /*#__PURE__*/require("./variations/_view/base");
11
10
  var _base2 = /*#__PURE__*/require("./variations/_size/base");
12
11
  var _Counter = /*#__PURE__*/require("./Counter.styles");
13
- var _Counter2 = /*#__PURE__*/require("./Counter.tokens");
14
- var _excluded = ["count", "maxCount", "size", "view", "className"];
12
+ var _excluded = ["count", "maxCount", "size", "view"];
15
13
  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
14
  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; }
17
15
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
18
16
  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; }
19
17
  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; }
20
- var MIN_COUNT = 1;
21
18
  var counterRoot = exports.counterRoot = function counterRoot(Root) {
22
19
  return /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
23
20
  var count = props.count,
24
21
  maxCount = props.maxCount,
25
22
  size = props.size,
26
23
  view = props.view,
27
- className = props.className,
28
24
  rest = _objectWithoutProperties(props, _excluded);
29
- var currentCount = count < MIN_COUNT ? MIN_COUNT : count;
30
- var currentMaxCount = maxCount && maxCount < MIN_COUNT ? MIN_COUNT : maxCount;
31
- var isCurrentCountOneDigit = currentCount >= 0 && currentCount < 10;
32
- var isCurrentMaxCountExceeded = currentMaxCount && currentCount > currentMaxCount;
33
- var content = isCurrentMaxCountExceeded ? "".concat(currentMaxCount, "+") : currentCount;
34
- var roundClass = !isCurrentMaxCountExceeded && isCurrentCountOneDigit ? _Counter2.classes.round : undefined;
25
+ var content = maxCount && count > maxCount ? "".concat(maxCount, "+") : count;
35
26
  return /*#__PURE__*/_react["default"].createElement(Root, _extends({
36
27
  ref: ref,
37
28
  view: view,
38
29
  size: size,
39
- count: count,
40
- className: (0, _utils.cx)(roundClass, className)
30
+ count: count
41
31
  }, rest), content);
42
32
  });
43
33
  };
@@ -12,7 +12,7 @@ import { PropsTable, Description } from '@site/src/components';
12
12
  ## Примеры
13
13
 
14
14
  ### Максимальное значение числового badge
15
- Задается с помощью свойства `maxCount`. Как и `count`, не может быть меньше 1.
15
+ Задается с помощью свойства `maxCount`.
16
16
 
17
17
  ```tsx live
18
18
  import React from 'react';
@@ -29,7 +29,7 @@ export function App() {
29
29
  ```
30
30
 
31
31
  ### Размер числового badge
32
- Размер задается с помощью свойства `size`. Возможные значения свойства: `xxs`, `xs`, `s`, `m`, `l`.
32
+ Размер задается с помощью свойства `size`. Возможные значения свойства: `"xs"` или `"xxs"`.
33
33
 
34
34
  ```tsx live
35
35
  import React from 'react';
@@ -3,10 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.tokens = exports.classes = void 0;
7
- var classes = exports.classes = {
8
- round: '--plasma-counter-round'
9
- };
6
+ exports.tokens = void 0;
10
7
  var tokens = exports.tokens = {
11
8
  background: '--plasma-counter-background',
12
9
  color: '--plasma-counter-color',
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.base = void 0;
7
7
  var _react = /*#__PURE__*/require("@emotion/react");
8
8
  var _Counter = /*#__PURE__*/require("../../Counter.tokens");
9
- var base = exports.base = /*#__PURE__*/(0, _react.css)("font-family:var(", _Counter.tokens.fontFamily, ");font-size:var(", _Counter.tokens.fontSize, ");font-style:var(", _Counter.tokens.fontStyle, ");font-weight:var(", _Counter.tokens.fontWeight, ");letter-spacing:var(", _Counter.tokens.letterSpacing, ");line-height:var(", _Counter.tokens.lineHeight, ");border-radius:var(", _Counter.tokens.borderRadius, ");height:var(", _Counter.tokens.height, ");padding-top:var(", _Counter.tokens.paddingTop, ");padding-right:var(", _Counter.tokens.paddingRight, ");padding-bottom:var(", _Counter.tokens.paddingBottom, ");padding-left:var(", _Counter.tokens.paddingLeft, ");&.", _Counter.classes.round, "{width:var(", _Counter.tokens.height, ");};label:plasma-new-hope__base;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ291bnRlci92YXJpYXRpb25zL19zaXplL2Jhc2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSXVCIiwiZmlsZSI6Ii4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ291bnRlci92YXJpYXRpb25zL19zaXplL2Jhc2UudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmltcG9ydCB7IGNsYXNzZXMsIHRva2VucyB9IGZyb20gJy4uLy4uL0NvdW50ZXIudG9rZW5zJztcblxuZXhwb3J0IGNvbnN0IGJhc2UgPSBjc3NgXG4gICAgZm9udC1mYW1pbHk6IHZhcigke3Rva2Vucy5mb250RmFtaWx5fSk7XG4gICAgZm9udC1zaXplOiB2YXIoJHt0b2tlbnMuZm9udFNpemV9KTtcbiAgICBmb250LXN0eWxlOiB2YXIoJHt0b2tlbnMuZm9udFN0eWxlfSk7XG4gICAgZm9udC13ZWlnaHQ6IHZhcigke3Rva2Vucy5mb250V2VpZ2h0fSk7XG4gICAgbGV0dGVyLXNwYWNpbmc6IHZhcigke3Rva2Vucy5sZXR0ZXJTcGFjaW5nfSk7XG4gICAgbGluZS1oZWlnaHQ6IHZhcigke3Rva2Vucy5saW5lSGVpZ2h0fSk7XG5cbiAgICBib3JkZXItcmFkaXVzOiB2YXIoJHt0b2tlbnMuYm9yZGVyUmFkaXVzfSk7XG5cbiAgICBoZWlnaHQ6IHZhcigke3Rva2Vucy5oZWlnaHR9KTtcblxuICAgIHBhZGRpbmctdG9wOiB2YXIoJHt0b2tlbnMucGFkZGluZ1RvcH0pO1xuICAgIHBhZGRpbmctcmlnaHQ6IHZhcigke3Rva2Vucy5wYWRkaW5nUmlnaHR9KTtcbiAgICBwYWRkaW5nLWJvdHRvbTogdmFyKCR7dG9rZW5zLnBhZGRpbmdCb3R0b219KTtcbiAgICBwYWRkaW5nLWxlZnQ6IHZhcigke3Rva2Vucy5wYWRkaW5nTGVmdH0pO1xuXG4gICAgJi4ke2NsYXNzZXMucm91bmR9IHtcbiAgICAgICAgd2lkdGg6IHZhcigke3Rva2Vucy5oZWlnaHR9KTtcbiAgICB9XG5gO1xuIl19 */"));
9
+ var base = exports.base = /*#__PURE__*/(0, _react.css)("font-family:var(", _Counter.tokens.fontFamily, ");font-size:var(", _Counter.tokens.fontSize, ");font-style:var(", _Counter.tokens.fontStyle, ");font-weight:var(", _Counter.tokens.fontWeight, ");letter-spacing:var(", _Counter.tokens.letterSpacing, ");line-height:var(", _Counter.tokens.lineHeight, ");border-radius:var(", _Counter.tokens.borderRadius, ");height:var(", _Counter.tokens.height, ");padding-top:var(", _Counter.tokens.paddingTop, ");padding-right:var(", _Counter.tokens.paddingRight, ");padding-bottom:var(", _Counter.tokens.paddingBottom, ");padding-left:var(", _Counter.tokens.paddingLeft, ");;label:plasma-new-hope__base;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ291bnRlci92YXJpYXRpb25zL19zaXplL2Jhc2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSXVCIiwiZmlsZSI6Ii4uLy4uLy4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvQ291bnRlci92YXJpYXRpb25zL19zaXplL2Jhc2UudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmltcG9ydCB7IHRva2VucyB9IGZyb20gJy4uLy4uL0NvdW50ZXIudG9rZW5zJztcblxuZXhwb3J0IGNvbnN0IGJhc2UgPSBjc3NgXG4gICAgZm9udC1mYW1pbHk6IHZhcigke3Rva2Vucy5mb250RmFtaWx5fSk7XG4gICAgZm9udC1zaXplOiB2YXIoJHt0b2tlbnMuZm9udFNpemV9KTtcbiAgICBmb250LXN0eWxlOiB2YXIoJHt0b2tlbnMuZm9udFN0eWxlfSk7XG4gICAgZm9udC13ZWlnaHQ6IHZhcigke3Rva2Vucy5mb250V2VpZ2h0fSk7XG4gICAgbGV0dGVyLXNwYWNpbmc6IHZhcigke3Rva2Vucy5sZXR0ZXJTcGFjaW5nfSk7XG4gICAgbGluZS1oZWlnaHQ6IHZhcigke3Rva2Vucy5saW5lSGVpZ2h0fSk7XG5cbiAgICBib3JkZXItcmFkaXVzOiB2YXIoJHt0b2tlbnMuYm9yZGVyUmFkaXVzfSk7XG5cbiAgICBoZWlnaHQ6IHZhcigke3Rva2Vucy5oZWlnaHR9KTtcblxuICAgIHBhZGRpbmctdG9wOiB2YXIoJHt0b2tlbnMucGFkZGluZ1RvcH0pO1xuICAgIHBhZGRpbmctcmlnaHQ6IHZhcigke3Rva2Vucy5wYWRkaW5nUmlnaHR9KTtcbiAgICBwYWRkaW5nLWJvdHRvbTogdmFyKCR7dG9rZW5zLnBhZGRpbmdCb3R0b219KTtcbiAgICBwYWRkaW5nLWxlZnQ6IHZhcigke3Rva2Vucy5wYWRkaW5nTGVmdH0pO1xuYDtcbiJdfQ== */"));
@@ -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) {
142
+ if (typeof frame !== 'string' && frame && frame.current && _utils.canUseDOM) {
143
143
  return /*#__PURE__*/_react["default"].createElement(_Portal.Portal, {
144
144
  container: frame.current
145
145
  }, rootNode);
@@ -91,7 +91,7 @@ var PopupProvider = exports.PopupProvider = function PopupProvider(_ref) {
91
91
  };
92
92
  return /*#__PURE__*/_react["default"].createElement(PopupContext.Provider, {
93
93
  value: context
94
- }, children, /*#__PURE__*/_react["default"].createElement(_Portal.Portal, {
94
+ }, children, _utils.canUseDOM && /*#__PURE__*/_react["default"].createElement(_Portal.Portal, {
95
95
  container: document.body
96
96
  }, /*#__PURE__*/_react["default"].createElement(_Popup.StyledPortal, {
97
97
  id: rootId
@@ -6,6 +6,7 @@ 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");
9
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
11
  /**
11
12
  * Вспомогательный компонент. Используется в Popup, Popover.
@@ -16,6 +17,9 @@ var Portal = exports.Portal = function Portal(_ref) {
16
17
  container = _ref.container,
17
18
  _ref$disabled = _ref.disabled,
18
19
  disabled = _ref$disabled === void 0 ? false : _ref$disabled;
20
+ if (!_utils.canUseDOM) {
21
+ return null;
22
+ }
19
23
  var portalContainer = typeof container === 'function' ? container() : container;
20
24
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, disabled && children, !disabled && /*#__PURE__*/_reactDom["default"].createPortal(children, portalContainer));
21
25
  };