@consta/uikit 5.22.0 → 5.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/__internal__/src/components/ContextMenu/helpers.d.ts +2 -2
  2. package/__internal__/src/components/Modal/Modal.js +1 -1
  3. package/__internal__/src/components/Modal/Modal.js.map +1 -1
  4. package/__internal__/src/components/Popover/Popover.js +1 -1
  5. package/__internal__/src/components/Popover/Popover.js.map +1 -1
  6. package/__internal__/src/components/PortalWithTheme/PortalWithTheme.d.ts +1 -1
  7. package/__internal__/src/components/PortalWithTheme/PortalWithTheme.js +1 -1
  8. package/__internal__/src/components/PortalWithTheme/PortalWithTheme.js.map +1 -1
  9. package/__internal__/src/components/PortalWithTheme/PortalWithThemeConsumer/PortalWithThemeConsumer.d.ts +10 -0
  10. package/__internal__/src/components/PortalWithTheme/PortalWithThemeConsumer/PortalWithThemeConsumer.js +2 -0
  11. package/__internal__/src/components/PortalWithTheme/PortalWithThemeConsumer/PortalWithThemeConsumer.js.map +1 -0
  12. package/__internal__/src/components/PortalWithTheme/PortalWithThemeConsumer/index.d.ts +1 -0
  13. package/__internal__/src/components/PortalWithTheme/PortalWithThemeConsumer/index.js +2 -0
  14. package/__internal__/src/components/PortalWithTheme/PortalWithThemeConsumer/index.js.map +1 -0
  15. package/__internal__/src/components/PortalWithTheme/index.d.ts +1 -0
  16. package/__internal__/src/components/PortalWithTheme/index.js +1 -1
  17. package/__internal__/src/components/PortalWithTheme/index.js.map +1 -1
  18. package/__internal__/src/components/Sidebar/Sidebar.js +1 -1
  19. package/__internal__/src/components/Sidebar/Sidebar.js.map +1 -1
  20. package/__internal__/src/docs/start/start.stand.d.ts +1 -1
  21. package/__internal__/src/stand/standConfig.d.ts +1 -1
  22. package/package.json +1 -1
@@ -19,7 +19,7 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevels
19
19
  } & import("./types").MappersItem<ITEM> & import("./types").MappersGroup<GROUP> & {
20
20
  anchorRef: React.RefObject<HTMLElement>;
21
21
  position?: never;
22
- } & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "items" | "groups" | "position" | "direction" | "onItemClick" | "sortGroup" | "offset" | "possibleDirections" | "spareDirection" | "onClickOutside" | "onSetDirection" | "anchorRef" | "isOpen" | "subMenuDirection" | "isMobile" | "onEsc" | keyof import("./types").MappersItem<ITEM_1> | keyof import("./types").MappersGroup<GROUP_1>> & import("react").RefAttributes<HTMLDivElement> & (GROUP extends {
22
+ } & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "items" | "groups" | "position" | "direction" | "onItemClick" | "sortGroup" | "onClickOutside" | "offset" | "possibleDirections" | "spareDirection" | "onSetDirection" | "anchorRef" | "isOpen" | "subMenuDirection" | "isMobile" | "onEsc" | keyof import("./types").MappersItem<ITEM_1> | keyof import("./types").MappersGroup<GROUP_1>> & import("react").RefAttributes<HTMLDivElement> & (GROUP extends {
23
23
  id: ContextMenuGroupDefault["id"] | unknown;
24
24
  } ? {} : {
25
25
  getGroupId: ContextMenuPropGetGroupId<GROUP>;
@@ -66,7 +66,7 @@ export declare function withDefaultGetters<ITEM, GROUP>(props: ContextMenuLevels
66
66
  } & import("./types").MappersItem<ITEM> & import("./types").MappersGroup<GROUP> & {
67
67
  anchorRef?: never;
68
68
  position: import("../Popover").Position;
69
- } & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "items" | "groups" | "position" | "direction" | "onItemClick" | "sortGroup" | "offset" | "possibleDirections" | "spareDirection" | "onClickOutside" | "onSetDirection" | "anchorRef" | "isOpen" | "subMenuDirection" | "isMobile" | "onEsc" | keyof import("./types").MappersItem<ITEM_1> | keyof import("./types").MappersGroup<GROUP_1>> & import("react").RefAttributes<HTMLDivElement> & (GROUP extends {
69
+ } & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "size" | "form" | "items" | "groups" | "position" | "direction" | "onItemClick" | "sortGroup" | "onClickOutside" | "offset" | "possibleDirections" | "spareDirection" | "onSetDirection" | "anchorRef" | "isOpen" | "subMenuDirection" | "isMobile" | "onEsc" | keyof import("./types").MappersItem<ITEM_1> | keyof import("./types").MappersGroup<GROUP_1>> & import("react").RefAttributes<HTMLDivElement> & (GROUP extends {
70
70
  id: ContextMenuGroupDefault["id"] | unknown;
71
71
  } ? {} : {
72
72
  getGroupId: ContextMenuPropGetGroupId<GROUP>;
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";var _excluded=["isOpen","onClose","onOpen","hasOverlay","onOverlayClick","onClickOutside","onEsc","className","width","position","children","container","refsForExcludeClickOutside","rootClassName","afterClose","style"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./Modal.css";import React,{useEffect,useRef}from"react";import{Transition}from"react-transition-group";import{PortalWithTheme,usePortalContext}from"../PortalWithTheme";import{useTheme}from"../Theme/Theme";import{useClickOutside}from"../../hooks/useClickOutside";import{useGlobalKeys}from"../../hooks/useGlobalKeys";import{animateTimeout,cnMixPopoverAnimate}from"../../mixs/MixPopoverAnimate";import{cnMixScrollBar}from"../../mixs/MixScrollBar";import{cn}from"../../utils/bem";var modalPropWidth=["auto"],modalPropWidthDefault=modalPropWidth[0],modalPropPosition=["center","top"],modalPropPositionDefault=modalPropPosition[0],cnModal=cn("Modal"),ContextConsumer=function(a){var b=a.onClickOutside,c=a.children,d=a.ignoreClicksInsideRefs,e=usePortalContext(),f=e.refs;return useClickOutside({isActive:!!b,ignoreClicksInsideRefs:[].concat(_toConsumableArray(d||[]),_toConsumableArray(f||[])),handler:b}),c};export var Modal=function(a){var b=a.isOpen,c=a.onClose,d=a.onOpen,e=a.hasOverlay,f=void 0===e||e,g=a.onOverlayClick,h=a.onClickOutside,i=a.onEsc,j=a.className,k=a.width,l=void 0===k?modalPropWidthDefault:k,m=a.position,n=void 0===m?modalPropPositionDefault:m,o=a.children,p=a.container,q=void 0===p?window.document.body:p,r=a.refsForExcludeClickOutside,s=a.rootClassName,t=a.afterClose,u=a.style,v=_objectWithoutProperties(a,_excluded),w=useRef(null),x=useRef(null),y=useTheme(),z=y.theme;return useEffect(function(){b?null===d||void 0===d?void 0:d():null===c||void 0===c?void 0:c()},[b]),useGlobalKeys({Escape:function Escape(a){return b&&i&&i(a)}}),React.createElement(Transition,{in:b,unmountOnExit:!0,nodeRef:x,timeout:animateTimeout,onExited:t},function(a){return React.createElement(PortalWithTheme,{preset:z,container:q,className:cnModal({hasOverlay:f},[s]),ref:x,style:"number"==typeof(null===u||void 0===u?void 0:u.zIndex)?{zIndex:u.zIndex}:void 0},f&&React.createElement("div",{className:cnModal("Overlay",{animate:a}),"aria-label":"Overlay"}),React.createElement("div",Object.assign({},v,{style:_objectSpread(_objectSpread({},u),{},{zIndex:void 0}),className:cnModal("Window",{width:l,position:n},[cnMixPopoverAnimate({animate:a}),j,cnMixScrollBar()]),ref:w}),React.createElement(ContextConsumer,{onClickOutside:h||g,ignoreClicksInsideRefs:[].concat(_toConsumableArray(r||[]),[w])},o)))})};
1
+ import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["isOpen","onClose","onOpen","hasOverlay","onOverlayClick","onClickOutside","onEsc","className","width","position","children","container","refsForExcludeClickOutside","rootClassName","afterClose","style"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./Modal.css";import React,{useEffect,useRef}from"react";import{Transition}from"react-transition-group";import{PortalWithTheme,PortalWithThemeConsumer}from"../PortalWithTheme";import{useTheme}from"../Theme/Theme";import{useGlobalKeys}from"../../hooks/useGlobalKeys";import{animateTimeout,cnMixPopoverAnimate}from"../../mixs/MixPopoverAnimate";import{cnMixScrollBar}from"../../mixs/MixScrollBar";import{cn}from"../../utils/bem";var modalPropWidth=["auto"],modalPropWidthDefault=modalPropWidth[0],modalPropPosition=["center","top"],modalPropPositionDefault=modalPropPosition[0],cnModal=cn("Modal");export var Modal=function(a){var b=a.isOpen,c=a.onClose,d=a.onOpen,e=a.hasOverlay,f=void 0===e||e,g=a.onOverlayClick,h=a.onClickOutside,i=a.onEsc,j=a.className,k=a.width,l=void 0===k?modalPropWidthDefault:k,m=a.position,n=void 0===m?modalPropPositionDefault:m,o=a.children,p=a.container,q=void 0===p?window.document.body:p,r=a.refsForExcludeClickOutside,s=a.rootClassName,t=a.afterClose,u=a.style,v=_objectWithoutProperties(a,_excluded),w=useRef(null),x=useRef(null),y=useTheme(),z=y.theme;return useEffect(function(){b?null===d||void 0===d?void 0:d():null===c||void 0===c?void 0:c()},[b]),useGlobalKeys({Escape:function Escape(a){return b&&i&&i(a)}}),React.createElement(Transition,{in:b,unmountOnExit:!0,nodeRef:x,timeout:animateTimeout,onExited:t},function(a){return React.createElement(PortalWithTheme,{preset:z,container:q,className:cnModal({hasOverlay:f},[s]),ref:x,style:"number"==typeof(null===u||void 0===u?void 0:u.zIndex)?{zIndex:u.zIndex}:void 0},f&&React.createElement("div",{className:cnModal("Overlay",{animate:a}),"aria-label":"Overlay"}),React.createElement("div",Object.assign({},v,{style:_objectSpread(_objectSpread({},u),{},{zIndex:void 0}),className:cnModal("Window",{width:l,position:n},[cnMixPopoverAnimate({animate:a}),j,cnMixScrollBar()]),ref:w}),React.createElement(PortalWithThemeConsumer,{onClickOutside:h||g,ignoreClicksInsideRefs:[].concat(_toConsumableArray(r||[]),[w])},o)))})};
2
2
  //# sourceMappingURL=Modal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","names":["React","useEffect","useRef","Transition","PortalWithTheme","usePortalContext","useTheme","useClickOutside","useGlobalKeys","animateTimeout","cnMixPopoverAnimate","cnMixScrollBar","cn","modalPropWidth","modalPropWidthDefault","modalPropPosition","modalPropPositionDefault","cnModal","ContextConsumer","onClickOutside","children","ignoreClicksInsideRefs","refs","isActive","handler","Modal","props","isOpen","onClose","onOpen","hasOverlay","onOverlayClick","onEsc","className","width","position","container","window","document","body","refsForExcludeClickOutside","rootClassName","afterClose","style","otherProps","ref","portalRef","theme","Escape","e","animate","zIndex"],"sources":["../../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import './Modal.css';\n\nimport React, { useEffect, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n PortalWithTheme,\n usePortalContext,\n} from '##/components/PortalWithTheme';\nimport { useTheme } from '##/components/Theme/Theme';\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useGlobalKeys } from '##/hooks/useGlobalKeys';\nimport { animateTimeout, cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cnMixScrollBar } from '##/mixs/MixScrollBar';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\nconst modalPropWidth = ['auto'] as const;\ntype ModalPropWidth = typeof modalPropWidth[number];\nconst modalPropWidthDefault: ModalPropWidth = modalPropWidth[0];\n\nconst modalPropPosition = ['center', 'top'] as const;\ntype ModalPropPosition = typeof modalPropPosition[number];\nconst modalPropPositionDefault: ModalPropPosition = modalPropPosition[0];\n\ntype ModalProps = PropsWithHTMLAttributes<\n {\n isOpen?: boolean;\n onClose?: () => void;\n onOpen?: () => void;\n hasOverlay?: boolean;\n /** @deprecated use onClickOutside */\n onOverlayClick?: (event: MouseEvent) => void;\n onClickOutside?: (event: MouseEvent) => void;\n onEsc?: (event: KeyboardEvent) => void;\n rootClassName?: string;\n width?: ModalPropWidth;\n position?: ModalPropPosition;\n children?: React.ReactNode;\n container?: HTMLDivElement | undefined;\n afterClose?: () => void;\n refsForExcludeClickOutside?: React.RefObject<HTMLElement>[];\n },\n HTMLDivElement\n>;\n\nconst cnModal = cn('Modal');\n\n/**\n * Подписчик на PortalWithThemeProvider\n * получает рефы всех вложенных порталов во всплывающем окне\n * для дальнейшего исключения их из useClickOutside\n */\nconst ContextConsumer: React.FC<{\n onClickOutside?: (event: MouseEvent) => void;\n ignoreClicksInsideRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;\n children: React.ReactNode;\n}> = ({ onClickOutside, children, ignoreClicksInsideRefs }) => {\n const { refs } = usePortalContext();\n\n useClickOutside({\n isActive: !!onClickOutside,\n ignoreClicksInsideRefs: [\n ...(ignoreClicksInsideRefs || []),\n ...(refs || []),\n ],\n handler: onClickOutside,\n });\n\n return children as React.ReactNode;\n};\n\nexport const Modal: React.FC<ModalProps> = (props) => {\n const {\n isOpen,\n onClose,\n onOpen,\n hasOverlay = true,\n onOverlayClick,\n onClickOutside,\n onEsc,\n className,\n width = modalPropWidthDefault,\n position = modalPropPositionDefault,\n children,\n container = window.document.body,\n refsForExcludeClickOutside,\n rootClassName,\n afterClose,\n style,\n ...otherProps\n } = props;\n\n const ref = useRef<HTMLDivElement | null>(null);\n const portalRef = useRef<HTMLDivElement | null>(null);\n const { theme } = useTheme();\n\n useEffect(() => {\n if (isOpen) {\n onOpen?.();\n } else {\n onClose?.();\n }\n }, [isOpen]);\n\n useGlobalKeys({\n Escape: (e: KeyboardEvent) => isOpen && onEsc && onEsc(e),\n });\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n nodeRef={portalRef}\n timeout={animateTimeout}\n onExited={afterClose}\n >\n {(animate) => (\n <PortalWithTheme\n preset={theme}\n container={container}\n className={cnModal({ hasOverlay }, [rootClassName])}\n ref={portalRef}\n style={\n typeof style?.zIndex === 'number'\n ? { zIndex: style.zIndex }\n : undefined\n }\n >\n {hasOverlay && (\n <div\n className={cnModal('Overlay', { animate })}\n aria-label=\"Overlay\"\n />\n )}\n <div\n {...otherProps}\n style={{\n ...style,\n zIndex: undefined,\n }}\n className={cnModal('Window', { width, position }, [\n cnMixPopoverAnimate({ animate }),\n className,\n cnMixScrollBar(),\n ])}\n ref={ref}\n >\n <ContextConsumer\n onClickOutside={onClickOutside || onOverlayClick}\n ignoreClicksInsideRefs={[\n ...(refsForExcludeClickOutside || []),\n ref,\n ]}\n >\n {children}\n </ContextConsumer>\n </div>\n </PortalWithTheme>\n )}\n </Transition>\n );\n};\n"],"mappings":"8hCAAA,oBAEA,MAAOA,MAAP,EAAgBC,SAAhB,CAA2BC,MAA3B,KAAyC,OAAzC,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OACEC,eADF,CAEEC,gBAFF,0BAIA,OAASC,QAAT,sBACA,OAASC,eAAT,mCACA,OAASC,aAAT,iCACA,OAASC,cAAT,CAAyBC,mBAAzB,oCACA,OAASC,cAAT,+BACA,OAASC,EAAT,uB,GAGMC,eAAc,CAAG,CAAC,MAAD,C,CAEjBC,qBAAqC,CAAGD,cAAc,CAAC,CAAD,C,CAEtDE,iBAAiB,CAAG,CAAC,QAAD,CAAW,KAAX,C,CAEpBC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E,aAAW,SAFb,EAZJ,CAiBE,2CACMN,CADN,EAEE,KAAK,gCACAD,CADA,MAEHQ,MAAM,OAFH,EAFP,CAME,SAAS,CAAElC,OAAO,CAAC,QAAD,CAAW,CAAEiB,KAAK,CAALA,CAAF,CAASC,QAAQ,CAARA,CAAT,CAAX,CAAgC,CAChDzB,mBAAmB,CAAC,CAAEwC,OAAO,CAAPA,CAAF,CAAD,CAD6B,CAEhDjB,CAFgD,CAGhDtB,cAAc,EAHkC,CAAhC,CANpB,CAWE,GAAG,CAAEkC,CAXP,GAaE,oBAAC,eAAD,EACE,cAAc,CAAE1B,CAAc,EAAIY,CADpC,CAEE,sBAAsB,8BAChBS,CAA0B,EAAI,EADd,GAEpBK,CAFoB,EAFxB,EAOGzB,CAPH,CAbF,CAjBF,CADD,CAPH,CAoDH,CA1FM"}
1
+ {"version":3,"file":"Modal.js","names":["React","useEffect","useRef","Transition","PortalWithTheme","PortalWithThemeConsumer","useTheme","useGlobalKeys","animateTimeout","cnMixPopoverAnimate","cnMixScrollBar","cn","modalPropWidth","modalPropWidthDefault","modalPropPosition","modalPropPositionDefault","cnModal","Modal","props","isOpen","onClose","onOpen","hasOverlay","onOverlayClick","onClickOutside","onEsc","className","width","position","children","container","window","document","body","refsForExcludeClickOutside","rootClassName","afterClose","style","otherProps","ref","portalRef","theme","Escape","e","animate","zIndex"],"sources":["../../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import './Modal.css';\n\nimport React, { useEffect, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n PortalWithTheme,\n PortalWithThemeConsumer,\n} from '##/components/PortalWithTheme';\nimport { useTheme } from '##/components/Theme/Theme';\nimport { useGlobalKeys } from '##/hooks/useGlobalKeys';\nimport { animateTimeout, cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cnMixScrollBar } from '##/mixs/MixScrollBar';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\nconst modalPropWidth = ['auto'] as const;\ntype ModalPropWidth = typeof modalPropWidth[number];\nconst modalPropWidthDefault: ModalPropWidth = modalPropWidth[0];\n\nconst modalPropPosition = ['center', 'top'] as const;\ntype ModalPropPosition = typeof modalPropPosition[number];\nconst modalPropPositionDefault: ModalPropPosition = modalPropPosition[0];\n\ntype ModalProps = PropsWithHTMLAttributes<\n {\n isOpen?: boolean;\n onClose?: () => void;\n onOpen?: () => void;\n hasOverlay?: boolean;\n /** @deprecated use onClickOutside */\n onOverlayClick?: (event: MouseEvent) => void;\n onClickOutside?: (event: MouseEvent) => void;\n onEsc?: (event: KeyboardEvent) => void;\n rootClassName?: string;\n width?: ModalPropWidth;\n position?: ModalPropPosition;\n children?: React.ReactNode;\n container?: HTMLDivElement | undefined;\n afterClose?: () => void;\n refsForExcludeClickOutside?: React.RefObject<HTMLElement>[];\n },\n HTMLDivElement\n>;\n\nconst cnModal = cn('Modal');\n\nexport const Modal: React.FC<ModalProps> = (props) => {\n const {\n isOpen,\n onClose,\n onOpen,\n hasOverlay = true,\n onOverlayClick,\n onClickOutside,\n onEsc,\n className,\n width = modalPropWidthDefault,\n position = modalPropPositionDefault,\n children,\n container = window.document.body,\n refsForExcludeClickOutside,\n rootClassName,\n afterClose,\n style,\n ...otherProps\n } = props;\n\n const ref = useRef<HTMLDivElement | null>(null);\n const portalRef = useRef<HTMLDivElement | null>(null);\n const { theme } = useTheme();\n\n useEffect(() => {\n if (isOpen) {\n onOpen?.();\n } else {\n onClose?.();\n }\n }, [isOpen]);\n\n useGlobalKeys({\n Escape: (e: KeyboardEvent) => isOpen && onEsc && onEsc(e),\n });\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n nodeRef={portalRef}\n timeout={animateTimeout}\n onExited={afterClose}\n >\n {(animate) => (\n <PortalWithTheme\n preset={theme}\n container={container}\n className={cnModal({ hasOverlay }, [rootClassName])}\n ref={portalRef}\n style={\n typeof style?.zIndex === 'number'\n ? { zIndex: style.zIndex }\n : undefined\n }\n >\n {hasOverlay && (\n <div\n className={cnModal('Overlay', { animate })}\n aria-label=\"Overlay\"\n />\n )}\n <div\n {...otherProps}\n style={{\n ...style,\n zIndex: undefined,\n }}\n className={cnModal('Window', { width, position }, [\n cnMixPopoverAnimate({ animate }),\n className,\n cnMixScrollBar(),\n ])}\n ref={ref}\n >\n <PortalWithThemeConsumer\n onClickOutside={onClickOutside || onOverlayClick}\n ignoreClicksInsideRefs={[\n ...(refsForExcludeClickOutside || []),\n ref,\n ]}\n >\n {children}\n </PortalWithThemeConsumer>\n </div>\n </PortalWithTheme>\n )}\n </Transition>\n );\n};\n"],"mappings":"8hCAAA,oBAEA,MAAOA,MAAP,EAAgBC,SAAhB,CAA2BC,MAA3B,KAAyC,OAAzC,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OACEC,eADF,CAEEC,uBAFF,0BAIA,OAASC,QAAT,sBACA,OAASC,aAAT,iCACA,OAASC,cAAT,CAAyBC,mBAAzB,oCACA,OAASC,cAAT,+BACA,OAASC,EAAT,uB,GAGMC,eAAc,CAAG,CAAC,MAAD,C,CAEjBC,qBAAqC,CAAGD,cAAc,CAAC,CAAD,C,CAEtDE,iBAAiB,CAAG,CAAC,QAAD,CAAW,KAAX,C,CAEpBC,wBAA2C,CAAGD,iBAAiB,CAAC,CAAD,C,CAuB/DE,OAAO,CAAGL,EAAE,CAAC,OAAD,C,CAElB,MAAO,IAAMM,MAA2B,CAAG,SAACC,CAAD,CAAW,IAElDC,EAFkD,CAmBhDD,CAnBgD,CAElDC,MAFkD,CAGlDC,CAHkD,CAmBhDF,CAnBgD,CAGlDE,OAHkD,CAIlDC,CAJkD,CAmBhDH,CAnBgD,CAIlDG,MAJkD,GAmBhDH,CAnBgD,CAKlDI,UALkD,CAKlDA,CALkD,eAMlDC,CANkD,CAmBhDL,CAnBgD,CAMlDK,cANkD,CAOlDC,CAPkD,CAmBhDN,CAnBgD,CAOlDM,cAPkD,CAQlDC,CARkD,CAmBhDP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C,eAAD,EACE,MAAM,CAAEH,CADV,CAEE,SAAS,CAAEX,CAFb,CAGE,SAAS,CAAEd,OAAO,CAAC,CAAEM,UAAU,CAAVA,CAAF,CAAD,CAAiB,CAACa,CAAD,CAAjB,CAHpB,CAIE,GAAG,CAAEK,CAJP,CAKE,KAAK,CACsB,QAAzB,gBAAOH,CAAP,WAAOA,CAAP,QAAOA,CAAK,CAAEQ,MAAd,EACI,CAAEA,MAAM,CAAER,CAAK,CAACQ,MAAhB,CADJ,OANJ,EAWGvB,CAAU,EACT,2BACE,SAAS,CAAEN,OAAO,CAAC,SAAD,CAAY,CAAE4B,OAAO,CAAPA,CAAF,CAAZ,CADpB,CAEE,aAAW,SAFb,EAZJ,CAiBE,2CACMN,CADN,EAEE,KAAK,gCACAD,CADA,MAEHQ,MAAM,OAFH,EAFP,CAME,SAAS,CAAE7B,OAAO,CAAC,QAAD,CAAW,CAAEW,KAAK,CAALA,CAAF,CAASC,QAAQ,CAARA,CAAT,CAAX,CAAgC,CAChDnB,mBAAmB,CAAC,CAAEmC,OAAO,CAAPA,CAAF,CAAD,CAD6B,CAEhDlB,CAFgD,CAGhDhB,cAAc,EAHkC,CAAhC,CANpB,CAWE,GAAG,CAAE6B,CAXP,GAaE,oBAAC,uBAAD,EACE,cAAc,CAAEf,CAAc,EAAID,CADpC,CAEE,sBAAsB,8BAChBW,CAA0B,EAAI,EADd,GAEpBK,CAFoB,EAFxB,EAOGV,CAPH,CAbF,CAjBF,CADD,CAPH,CAoDH,CA1FM"}
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";var _excluded=["children","direction","offset","arrowOffset","possibleDirections","isInteractive","onClickOutside","spareDirection","style","className","position","anchorRef","equalAnchorWidth","onSetDirection","viewportRef","container"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./Popover.css";import React,{forwardRef,useEffect,useLayoutEffect,useMemo}from"react";import{PortalWithTheme,usePortalContext}from"../PortalWithTheme";import{useTheme}from"../Theme/Theme";import{useClickOutside}from"../../hooks/useClickOutside";import{useComponentSize}from"../../hooks/useComponentSize";import{useForkRef}from"../../hooks/useForkRef";import{cn}from"../../utils/bem";import{isRenderProp}from"../../utils/isRenderProp";import{isNumber,isString}from"../../utils/type-guards";import{getComputedPositionAndDirection,getPointPosition,getRenderPosition}from"./helpers";import{usePopoverReposition}from"./usePopoverReposition";export var directionsStartCenter=["downCenter","upCenter","downRight","downLeft","upRight","upLeft","leftUp","leftCenter","leftDown","rightUp","rightCenter","rightDown"];export var directionsStartEdge=["downStartLeft","upStartLeft","downStartRight","upStartRight","leftStartUp","leftStartDown","rightStartUp","rightStartDown"];export var popoverPropOffset=["3xs","2xs","xs","s","m","l","xl","2xl","3xl","4xl","5xl","6xl"];export var directions=[].concat(directionsStartCenter,directionsStartEdge);var getOffset=function(a,b){if(isNumber(b))return b;if(isString(b)&&a.current){var g=getComputedStyle(a.current).getPropertyValue("--space-".concat(b));if(g&&/px$/.test(g))return+g.slice(0,g.length-2);if(g&&/rem$/.test(g)){var c=parseFloat(getComputedStyle(document.documentElement).fontSize),d=+g.slice(0,g.length-3);return c*d}if(g&&/em$/.test(g)){var e=parseFloat(getComputedStyle(a.current).fontSize),f=+g.slice(0,g.length-2);return e*f}return 0}return 0},ContextConsumer=function(a){var b=a.onClickOutside,c=a.children,d=a.ignoreClicksInsideRefs,e=usePortalContext(),f=e.refs;return useClickOutside({isActive:!!b,ignoreClicksInsideRefs:[].concat(_toConsumableArray(d||[]),_toConsumableArray(f||[])),handler:b}),c},cnPopover=cn("Popover");export var Popover=forwardRef(function(a,b){var c,d=a.children,e=a.direction,f=void 0===e?"upCenter":e,g=a.offset,h=void 0===g?0:g,i=a.arrowOffset,j=a.possibleDirections,k=void 0===j?directions:j,l=a.isInteractive,m=a.onClickOutside,n=a.spareDirection,o=void 0===n?"downStartLeft":n,p=a.style,q=a.className,r=a.position,s=a.anchorRef,t=a.equalAnchorWidth,u=a.onSetDirection,v=a.viewportRef,w=a.container,x=void 0===w?window.document.body:w,y=_objectWithoutProperties(a,_excluded),z=(null===v||void 0===v?void 0:v.current)||document.documentElement,A=React.useRef(null),B=useTheme(),C=B.theme,D=React.useState(),E=_slicedToArray(D,2),F=E[0],G=E[1],H=useComponentSize(A),I=H.width,J=H.height,K=useComponentSize(s||{current:null}),L=React.useRef(null),M=React.useState([]),N=_slicedToArray(M,2),O=N[0],P=N[1],Q=function(){P(function(a){return a.length?[]:a}),L.current=null},R=function(){var a;return G(null===s||void 0===s||null===(a=s.current)||void 0===a?void 0:a.getBoundingClientRect())},S=useMemo(function(){return getOffset(A,h)},[h,!!A.current]),T=getComputedPositionAndDirection({contentSize:{width:I,height:J},viewportSize:{width:z.clientWidth,height:z.clientHeight},arrowOffset:i,offset:S,direction:f,possibleDirections:k,bannedDirections:O,position:getPointPosition(z,F?{x:F.left,y:F.top}:r,!!(null!==v&&void 0!==v&&v.current)),anchorSize:K,spareDirection:o}),U=T.position,V=T.direction;useEffect(function(){return null===u||void 0===u?void 0:u(V)},[V]),useEffect(R,[K]),usePopoverReposition({isActive:!0,scrollAnchorRef:s||{current:null},onRequestReposition:function onRequestReposition(){Q(),R()}}),useLayoutEffect(function(){L.current!==V&&(L.current&&!O.includes(L.current)&&!O.includes(V)&&V!==o&&P(function(a){return L.current?[].concat(_toConsumableArray(a),[L.current]):a}),L.current=V)},[V]),useLayoutEffect(Q,[a]);var W=getRenderPosition(z,U,!!(null!==v&&void 0!==v&&v.current),I,J),X=!W||!J||!I;return React.createElement(PortalWithTheme,Object.assign({},y,{preset:C,className:cnPopover({direction:V,notVisible:X},[q]),container:x,ref:useForkRef([A,b]),style:_objectSpread(_objectSpread({},p),X?{}:(c={},_defineProperty(c,"--popover-left","".concat(W.x,"px")),_defineProperty(c,"--popover-top","".concat(W.y,"px")),_defineProperty(c,"--popover-width",t?"".concat(K.width,"px"):void 0),_defineProperty(c,"--popover-pointer-events",!(void 0!==l)||l?void 0:"none"),_defineProperty(c,"--popover-visibility",U?void 0:"hidden"),c))}),React.createElement(ContextConsumer,{onClickOutside:m,ignoreClicksInsideRefs:[A,s||{current:null}]},isRenderProp(d)?d(V):d))});
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["children","direction","offset","arrowOffset","possibleDirections","isInteractive","onClickOutside","spareDirection","style","className","position","anchorRef","equalAnchorWidth","onSetDirection","viewportRef","container"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./Popover.css";import React,{forwardRef,useEffect,useLayoutEffect,useMemo}from"react";import{PortalWithTheme,PortalWithThemeConsumer}from"../PortalWithTheme";import{useTheme}from"../Theme/Theme";import{useComponentSize}from"../../hooks/useComponentSize";import{useForkRef}from"../../hooks/useForkRef";import{cn}from"../../utils/bem";import{isRenderProp}from"../../utils/isRenderProp";import{isNumber,isString}from"../../utils/type-guards";import{getComputedPositionAndDirection,getPointPosition,getRenderPosition}from"./helpers";import{usePopoverReposition}from"./usePopoverReposition";export var directionsStartCenter=["downCenter","upCenter","downRight","downLeft","upRight","upLeft","leftUp","leftCenter","leftDown","rightUp","rightCenter","rightDown"];export var directionsStartEdge=["downStartLeft","upStartLeft","downStartRight","upStartRight","leftStartUp","leftStartDown","rightStartUp","rightStartDown"];export var popoverPropOffset=["3xs","2xs","xs","s","m","l","xl","2xl","3xl","4xl","5xl","6xl"];export var directions=[].concat(directionsStartCenter,directionsStartEdge);var getOffset=function(a,b){if(isNumber(b))return b;if(isString(b)&&a.current){var g=getComputedStyle(a.current).getPropertyValue("--space-".concat(b));if(g&&/px$/.test(g))return+g.slice(0,g.length-2);if(g&&/rem$/.test(g)){var c=parseFloat(getComputedStyle(document.documentElement).fontSize),d=+g.slice(0,g.length-3);return c*d}if(g&&/em$/.test(g)){var e=parseFloat(getComputedStyle(a.current).fontSize),f=+g.slice(0,g.length-2);return e*f}return 0}return 0},cnPopover=cn("Popover");export var Popover=forwardRef(function(a,b){var c,d=a.children,e=a.direction,f=void 0===e?"upCenter":e,g=a.offset,h=void 0===g?0:g,i=a.arrowOffset,j=a.possibleDirections,k=void 0===j?directions:j,l=a.isInteractive,m=a.onClickOutside,n=a.spareDirection,o=void 0===n?"downStartLeft":n,p=a.style,q=a.className,r=a.position,s=a.anchorRef,t=a.equalAnchorWidth,u=a.onSetDirection,v=a.viewportRef,w=a.container,x=void 0===w?window.document.body:w,y=_objectWithoutProperties(a,_excluded),z=(null===v||void 0===v?void 0:v.current)||document.documentElement,A=React.useRef(null),B=useTheme(),C=B.theme,D=React.useState(),E=_slicedToArray(D,2),F=E[0],G=E[1],H=useComponentSize(A),I=H.width,J=H.height,K=useComponentSize(s||{current:null}),L=React.useRef(null),M=React.useState([]),N=_slicedToArray(M,2),O=N[0],P=N[1],Q=function(){P(function(a){return a.length?[]:a}),L.current=null},R=function(){var a;return G(null===s||void 0===s||null===(a=s.current)||void 0===a?void 0:a.getBoundingClientRect())},S=useMemo(function(){return getOffset(A,h)},[h,!!A.current]),T=getComputedPositionAndDirection({contentSize:{width:I,height:J},viewportSize:{width:z.clientWidth,height:z.clientHeight},arrowOffset:i,offset:S,direction:f,possibleDirections:k,bannedDirections:O,position:getPointPosition(z,F?{x:F.left,y:F.top}:r,!!(null!==v&&void 0!==v&&v.current)),anchorSize:K,spareDirection:o}),U=T.position,V=T.direction;useEffect(function(){return null===u||void 0===u?void 0:u(V)},[V]),useEffect(R,[K]),usePopoverReposition({isActive:!0,scrollAnchorRef:s||{current:null},onRequestReposition:function onRequestReposition(){Q(),R()}}),useLayoutEffect(function(){L.current!==V&&(L.current&&!O.includes(L.current)&&!O.includes(V)&&V!==o&&P(function(a){return L.current?[].concat(_toConsumableArray(a),[L.current]):a}),L.current=V)},[V]),useLayoutEffect(Q,[a]);var W=getRenderPosition(z,U,!!(null!==v&&void 0!==v&&v.current),I,J),X=!W||!J||!I;return React.createElement(PortalWithTheme,Object.assign({},y,{preset:C,className:cnPopover({direction:V,notVisible:X},[q]),container:x,ref:useForkRef([A,b]),style:_objectSpread(_objectSpread({},p),X?{}:(c={},_defineProperty(c,"--popover-left","".concat(W.x,"px")),_defineProperty(c,"--popover-top","".concat(W.y,"px")),_defineProperty(c,"--popover-width",t?"".concat(K.width,"px"):void 0),_defineProperty(c,"--popover-pointer-events",!(void 0!==l)||l?void 0:"none"),_defineProperty(c,"--popover-visibility",U?void 0:"hidden"),c))}),React.createElement(PortalWithThemeConsumer,{onClickOutside:m,ignoreClicksInsideRefs:[A,s||{current:null}]},isRenderProp(d)?d(V):d))});
2
2
  //# sourceMappingURL=Popover.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","names":["React","forwardRef","useEffect","useLayoutEffect","useMemo","PortalWithTheme","usePortalContext","useTheme","useClickOutside","useComponentSize","useForkRef","cn","isRenderProp","isNumber","isString","getComputedPositionAndDirection","getPointPosition","getRenderPosition","usePopoverReposition","directionsStartCenter","directionsStartEdge","popoverPropOffset","directions","getOffset","ref","propOffset","current","cssVar","getComputedStyle","getPropertyValue","test","slice","length","fontSize","parseFloat","document","documentElement","rem","em","ContextConsumer","onClickOutside","children","ignoreClicksInsideRefs","refs","isActive","handler","cnPopover","Popover","props","componentRef","direction","passedDirection","offset","arrowOffset","possibleDirections","isInteractive","spareDirection","style","className","passedPosition","position","anchorRef","equalAnchorWidth","onSetDirection","viewportRef","container","window","body","otherProps","viewportElement","useRef","theme","useState","anchorClientRect","setAnchorClientRect","width","height","anchorSize","previousDirectionRef","bannedDirections","setBannedDirections","resetBannedDirections","state","updateAnchorClientRect","getBoundingClientRect","contentSize","viewportSize","clientWidth","clientHeight","x","left","y","top","scrollAnchorRef","onRequestReposition","includes","renderPosition","notVisible"],"sources":["../../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import './Popover.css';\n\nimport React, { forwardRef, useEffect, useLayoutEffect, useMemo } from 'react';\n\nimport {\n PortalWithTheme,\n usePortalContext,\n} from '##/components/PortalWithTheme';\nimport { useTheme } from '##/components/Theme/Theme';\nimport { ClickOutsideHandler, useClickOutside } from '##/hooks/useClickOutside';\nimport { useComponentSize } from '##/hooks/useComponentSize';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { cn } from '##/utils/bem';\nimport { isRenderProp } from '##/utils/isRenderProp';\nimport { isNumber, isString } from '##/utils/type-guards';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nimport {\n getComputedPositionAndDirection,\n getPointPosition,\n getRenderPosition,\n} from './helpers';\nimport { usePopoverReposition } from './usePopoverReposition';\n\n/**\n * Стороны упорядочены по приоритету:\n * Используется первая сторона, в которую смог вписаться поповер.\n */\nexport const directionsStartCenter = [\n 'downCenter',\n 'upCenter',\n\n 'downRight',\n 'downLeft',\n 'upRight',\n 'upLeft',\n\n 'leftUp',\n 'leftCenter',\n 'leftDown',\n\n 'rightUp',\n 'rightCenter',\n 'rightDown',\n] as const;\n\nexport const directionsStartEdge = [\n 'downStartLeft',\n 'upStartLeft',\n\n 'downStartRight',\n 'upStartRight',\n\n 'leftStartUp',\n 'leftStartDown',\n\n 'rightStartUp',\n 'rightStartDown',\n] as const;\n\nexport const popoverPropOffset = [\n '3xs',\n '2xs',\n 'xs',\n 's',\n 'm',\n 'l',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl',\n] as const;\nexport type PopoverPropOffset = typeof popoverPropOffset[number] | number;\n\nexport const directions = [...directionsStartCenter, ...directionsStartEdge];\n\nexport type Direction = typeof directions[number];\n\nexport type Position = { x: number; y: number } | undefined;\n\nexport type PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n equalAnchorWidth?: boolean;\n position?: never;\n }\n | {\n anchorRef?: never;\n equalAnchorWidth?: never;\n position: Position;\n };\n\ntype ChildrenRenderProp = (direction: Direction) => React.ReactNode;\n\nexport type PopoverProps = PropsWithJsxAttributes<\n {\n direction?: Direction;\n spareDirection?: Direction;\n offset?: PopoverPropOffset;\n arrowOffset?: number;\n possibleDirections?: readonly Direction[];\n isInteractive?: boolean;\n children: React.ReactNode | ChildrenRenderProp;\n onClickOutside?: ClickOutsideHandler;\n onSetDirection?: (direction: Direction) => void;\n viewportRef?: React.RefObject<HTMLElement>;\n container?: Element;\n } & PositioningProps\n>;\n\nexport type Props = PopoverProps; // удалить при мажоре\n\nconst getOffset = (\n ref: React.RefObject<HTMLDivElement>,\n propOffset: PopoverPropOffset,\n) => {\n if (isNumber(propOffset)) {\n return propOffset;\n }\n\n if (isString(propOffset) && ref.current) {\n const cssVar = getComputedStyle(ref.current).getPropertyValue(\n `--space-${propOffset}`,\n );\n\n if (cssVar && /px$/.test(cssVar)) {\n return Number(cssVar.slice(0, cssVar.length - 2));\n }\n\n if (cssVar && /rem$/.test(cssVar)) {\n const fontSize = parseFloat(\n getComputedStyle(document.documentElement).fontSize,\n );\n const rem = Number(cssVar.slice(0, cssVar.length - 3));\n\n return fontSize * rem;\n }\n\n if (cssVar && /em$/.test(cssVar)) {\n const fontSize = parseFloat(getComputedStyle(ref.current).fontSize);\n const em = Number(cssVar.slice(0, cssVar.length - 2));\n\n return fontSize * em;\n }\n\n return 0;\n }\n\n return 0;\n};\n\n/**\n * Подписчик на PortalWithThemeProvider\n * получает рефы всех вложенных порталов во всплывающем окне\n * для дальнейшего исключения их из useClickOutside\n */\nconst ContextConsumer: React.FC<{\n onClickOutside?: (event: MouseEvent) => void;\n ignoreClicksInsideRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;\n children: React.ReactNode;\n}> = ({ onClickOutside, children, ignoreClicksInsideRefs }) => {\n const { refs } = usePortalContext();\n\n useClickOutside({\n isActive: !!onClickOutside,\n ignoreClicksInsideRefs: [\n ...(ignoreClicksInsideRefs || []),\n ...(refs || []),\n ],\n handler: onClickOutside,\n });\n\n return children as React.ReactNode;\n};\n\nconst cnPopover = cn('Popover');\n\nexport const Popover = forwardRef<HTMLDivElement, PopoverProps>(\n (props, componentRef) => {\n const {\n children,\n direction: passedDirection = 'upCenter',\n offset: propOffset = 0,\n arrowOffset,\n possibleDirections = directions,\n isInteractive = true,\n onClickOutside,\n spareDirection = 'downStartLeft',\n style,\n className,\n position: passedPosition,\n anchorRef,\n equalAnchorWidth,\n onSetDirection,\n viewportRef,\n container = window.document.body,\n ...otherProps\n } = props;\n\n const viewportElement = viewportRef?.current || document.documentElement;\n\n const ref = React.useRef<HTMLDivElement>(null);\n const { theme } = useTheme();\n\n const [anchorClientRect, setAnchorClientRect] = React.useState<\n DOMRect | undefined\n >();\n const { width, height } = useComponentSize(ref);\n const anchorSize = useComponentSize(anchorRef || { current: null });\n const previousDirectionRef = React.useRef<Direction | null>(null);\n const [bannedDirections, setBannedDirections] = React.useState<\n readonly Direction[]\n >([]);\n\n const resetBannedDirections = () => {\n setBannedDirections((state) => (state.length ? [] : state));\n previousDirectionRef.current = null;\n };\n\n const updateAnchorClientRect = () =>\n setAnchorClientRect(anchorRef?.current?.getBoundingClientRect());\n\n const offset = useMemo(\n () => getOffset(ref, propOffset),\n [propOffset, Boolean(ref.current)],\n );\n\n const { position, direction } = getComputedPositionAndDirection({\n contentSize: { width, height },\n viewportSize: {\n // Размер вьюпорта без скроллбаров\n width: viewportElement.clientWidth,\n height: viewportElement.clientHeight,\n },\n arrowOffset,\n offset,\n direction: passedDirection,\n possibleDirections,\n bannedDirections,\n position: getPointPosition(\n viewportElement,\n anchorClientRect\n ? { x: anchorClientRect.left, y: anchorClientRect.top }\n : passedPosition,\n !!viewportRef?.current,\n ),\n anchorSize,\n spareDirection,\n });\n\n useEffect(() => onSetDirection?.(direction), [direction]);\n\n useEffect(updateAnchorClientRect, [anchorSize]);\n\n usePopoverReposition({\n isActive: true,\n scrollAnchorRef: anchorRef || { current: null },\n onRequestReposition: () => {\n resetBannedDirections();\n updateAnchorClientRect();\n },\n });\n\n /**\n * Может возникнуть ситуация, когда перерасчет поповера всегда будет выдавать 2 направления\n * и бесконечно зацикливать себя. Для избежания таких кейсов мы запоминаем стороны,\n * которые не подошли, чтобы не возвращаться к ним и предотвратить бесконечный ререндер.\n * См. PopoverBannedPositionsStory\n */\n\n useLayoutEffect(() => {\n if (previousDirectionRef.current !== direction) {\n if (\n previousDirectionRef.current &&\n !bannedDirections.includes(previousDirectionRef.current) &&\n !bannedDirections.includes(direction) &&\n direction !== spareDirection\n ) {\n setBannedDirections((state) =>\n previousDirectionRef.current\n ? [...state, previousDirectionRef.current]\n : state,\n );\n }\n previousDirectionRef.current = direction;\n }\n }, [direction]);\n\n // Сбрасываем при любом изменении пропсов, чтобы заново начать перебор направлений\n // Главное не сбрасывать при изменении размеров поповера, т.к. именно оно может вызвать бесконечный перебор\n\n useLayoutEffect(resetBannedDirections, [props]);\n\n const renderPosition = getRenderPosition(\n viewportElement,\n position,\n !!viewportRef?.current,\n width,\n height,\n );\n\n const notVisible = !renderPosition || !height || !width;\n\n return (\n <PortalWithTheme\n {...otherProps}\n preset={theme}\n className={cnPopover({ direction, notVisible }, [className])}\n container={container}\n ref={useForkRef([ref, componentRef])}\n style={{\n ...style,\n ...(notVisible\n ? {}\n : {\n ['--popover-left' as string]: `${renderPosition.x}px`,\n ['--popover-top' as string]: `${renderPosition.y}px`,\n [`--popover-width` as string]: equalAnchorWidth\n ? `${anchorSize.width}px`\n : undefined,\n [`--popover-pointer-events` as string]: isInteractive\n ? undefined\n : 'none',\n [`--popover-visibility` as string]: position\n ? undefined\n : 'hidden',\n }),\n }}\n >\n <ContextConsumer\n onClickOutside={onClickOutside}\n ignoreClicksInsideRefs={[ref, anchorRef || { current: null }]}\n >\n {isRenderProp(children) ? children(direction) : children}\n </ContextConsumer>\n </PortalWithTheme>\n );\n },\n);\n"],"mappings":"knCAAA,sBAEA,MAAOA,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,eAAvC,CAAwDC,OAAxD,KAAuE,OAAvE,CAEA,OACEC,eADF,CAEEC,gBAFF,0BAIA,OAASC,QAAT,sBACA,OAA8BC,eAA9B,mCACA,OAASC,gBAAT,oCACA,OAASC,UAAT,8BACA,OAASC,EAAT,uBACA,OAASC,YAAT,gCACA,OAASC,QAAT,CAAmBC,QAAnB,+BAGA,OACEC,+BADF,CAEEC,gBAFF,CAGEC,iBAHF,iBAKA,OAASC,oBAAT,8BAMA,MAAO,IAAMC,sBAAqB,CAAG,CACnC,YADmC,CAEnC,UAFmC,CAInC,WAJmC,CAKnC,UALmC,CAMnC,SANmC,CAOnC,QAPmC,CASnC,QATmC,CAUnC,YAVmC,CAWnC,UAXmC,CAanC,SAbmC,CAcnC,aAdmC,CAenC,WAfmC,CAA9B,CAkBP,MAAO,IAAMC,oBAAmB,CAAG,CACjC,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vD,UAAU,CAAC,CAACc,CAAD,CAAMyB,CAAN,CAAD,CALjB,CAME,KAAK,gCACAQ,CADA,EAECwC,CAAU,CACV,EADU,yBAGP,gBAHO,WAGyBD,CAAc,CAACP,CAHxC,0BAIP,eAJO,WAIwBO,CAAc,CAACL,CAJvC,4CAKuB7B,CAAgB,WACxCe,CAAU,CAACF,KAD6B,aALvC,+CAQgC,wBAEpC,MAVI,2CAW4Bf,CAAQ,QAExC,QAbI,IAFX,CANP,GAyBE,oBAAC,eAAD,EACE,cAAc,CAAEpB,CADlB,CAEE,sBAAsB,CAAE,CAAChB,CAAD,CAAMqC,CAAS,EAAI,CAAEnC,OAAO,CAAE,IAAX,CAAnB,CAF1B,EAIGd,YAAY,CAAC6B,CAAD,CAAZ,CAAyBA,CAAQ,CAACS,CAAD,CAAjC,CAA+CT,CAJlD,CAzBF,CAiCH,CAhK8B,CAA1B"}
1
+ {"version":3,"file":"Popover.js","names":["React","forwardRef","useEffect","useLayoutEffect","useMemo","PortalWithTheme","PortalWithThemeConsumer","useTheme","useComponentSize","useForkRef","cn","isRenderProp","isNumber","isString","getComputedPositionAndDirection","getPointPosition","getRenderPosition","usePopoverReposition","directionsStartCenter","directionsStartEdge","popoverPropOffset","directions","getOffset","ref","propOffset","current","cssVar","getComputedStyle","getPropertyValue","test","slice","length","fontSize","parseFloat","document","documentElement","rem","em","cnPopover","Popover","props","componentRef","children","direction","passedDirection","offset","arrowOffset","possibleDirections","isInteractive","onClickOutside","spareDirection","style","className","passedPosition","position","anchorRef","equalAnchorWidth","onSetDirection","viewportRef","container","window","body","otherProps","viewportElement","useRef","theme","useState","anchorClientRect","setAnchorClientRect","width","height","anchorSize","previousDirectionRef","bannedDirections","setBannedDirections","resetBannedDirections","state","updateAnchorClientRect","getBoundingClientRect","contentSize","viewportSize","clientWidth","clientHeight","x","left","y","top","isActive","scrollAnchorRef","onRequestReposition","includes","renderPosition","notVisible"],"sources":["../../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import './Popover.css';\n\nimport React, { forwardRef, useEffect, useLayoutEffect, useMemo } from 'react';\n\nimport {\n PortalWithTheme,\n PortalWithThemeConsumer,\n} from '##/components/PortalWithTheme';\nimport { useTheme } from '##/components/Theme/Theme';\nimport { ClickOutsideHandler } from '##/hooks/useClickOutside';\nimport { useComponentSize } from '##/hooks/useComponentSize';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { cn } from '##/utils/bem';\nimport { isRenderProp } from '##/utils/isRenderProp';\nimport { isNumber, isString } from '##/utils/type-guards';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nimport {\n getComputedPositionAndDirection,\n getPointPosition,\n getRenderPosition,\n} from './helpers';\nimport { usePopoverReposition } from './usePopoverReposition';\n\n/**\n * Стороны упорядочены по приоритету:\n * Используется первая сторона, в которую смог вписаться поповер.\n */\nexport const directionsStartCenter = [\n 'downCenter',\n 'upCenter',\n\n 'downRight',\n 'downLeft',\n 'upRight',\n 'upLeft',\n\n 'leftUp',\n 'leftCenter',\n 'leftDown',\n\n 'rightUp',\n 'rightCenter',\n 'rightDown',\n] as const;\n\nexport const directionsStartEdge = [\n 'downStartLeft',\n 'upStartLeft',\n\n 'downStartRight',\n 'upStartRight',\n\n 'leftStartUp',\n 'leftStartDown',\n\n 'rightStartUp',\n 'rightStartDown',\n] as const;\n\nexport const popoverPropOffset = [\n '3xs',\n '2xs',\n 'xs',\n 's',\n 'm',\n 'l',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl',\n] as const;\nexport type PopoverPropOffset = typeof popoverPropOffset[number] | number;\n\nexport const directions = [...directionsStartCenter, ...directionsStartEdge];\n\nexport type Direction = typeof directions[number];\n\nexport type Position = { x: number; y: number } | undefined;\n\nexport type PositioningProps =\n | {\n anchorRef: React.RefObject<HTMLElement>;\n equalAnchorWidth?: boolean;\n position?: never;\n }\n | {\n anchorRef?: never;\n equalAnchorWidth?: never;\n position: Position;\n };\n\ntype ChildrenRenderProp = (direction: Direction) => React.ReactNode;\n\nexport type PopoverProps = PropsWithJsxAttributes<\n {\n direction?: Direction;\n spareDirection?: Direction;\n offset?: PopoverPropOffset;\n arrowOffset?: number;\n possibleDirections?: readonly Direction[];\n isInteractive?: boolean;\n children: React.ReactNode | ChildrenRenderProp;\n onClickOutside?: ClickOutsideHandler;\n onSetDirection?: (direction: Direction) => void;\n viewportRef?: React.RefObject<HTMLElement>;\n container?: Element;\n } & PositioningProps\n>;\n\nexport type Props = PopoverProps; // удалить при мажоре\n\nconst getOffset = (\n ref: React.RefObject<HTMLDivElement>,\n propOffset: PopoverPropOffset,\n) => {\n if (isNumber(propOffset)) {\n return propOffset;\n }\n\n if (isString(propOffset) && ref.current) {\n const cssVar = getComputedStyle(ref.current).getPropertyValue(\n `--space-${propOffset}`,\n );\n\n if (cssVar && /px$/.test(cssVar)) {\n return Number(cssVar.slice(0, cssVar.length - 2));\n }\n\n if (cssVar && /rem$/.test(cssVar)) {\n const fontSize = parseFloat(\n getComputedStyle(document.documentElement).fontSize,\n );\n const rem = Number(cssVar.slice(0, cssVar.length - 3));\n\n return fontSize * rem;\n }\n\n if (cssVar && /em$/.test(cssVar)) {\n const fontSize = parseFloat(getComputedStyle(ref.current).fontSize);\n const em = Number(cssVar.slice(0, cssVar.length - 2));\n\n return fontSize * em;\n }\n\n return 0;\n }\n\n return 0;\n};\n\nconst cnPopover = cn('Popover');\n\nexport const Popover = forwardRef<HTMLDivElement, PopoverProps>(\n (props, componentRef) => {\n const {\n children,\n direction: passedDirection = 'upCenter',\n offset: propOffset = 0,\n arrowOffset,\n possibleDirections = directions,\n isInteractive = true,\n onClickOutside,\n spareDirection = 'downStartLeft',\n style,\n className,\n position: passedPosition,\n anchorRef,\n equalAnchorWidth,\n onSetDirection,\n viewportRef,\n container = window.document.body,\n ...otherProps\n } = props;\n\n const viewportElement = viewportRef?.current || document.documentElement;\n\n const ref = React.useRef<HTMLDivElement>(null);\n const { theme } = useTheme();\n\n const [anchorClientRect, setAnchorClientRect] = React.useState<\n DOMRect | undefined\n >();\n const { width, height } = useComponentSize(ref);\n const anchorSize = useComponentSize(anchorRef || { current: null });\n const previousDirectionRef = React.useRef<Direction | null>(null);\n const [bannedDirections, setBannedDirections] = React.useState<\n readonly Direction[]\n >([]);\n\n const resetBannedDirections = () => {\n setBannedDirections((state) => (state.length ? [] : state));\n previousDirectionRef.current = null;\n };\n\n const updateAnchorClientRect = () =>\n setAnchorClientRect(anchorRef?.current?.getBoundingClientRect());\n\n const offset = useMemo(\n () => getOffset(ref, propOffset),\n [propOffset, Boolean(ref.current)],\n );\n\n const { position, direction } = getComputedPositionAndDirection({\n contentSize: { width, height },\n viewportSize: {\n // Размер вьюпорта без скроллбаров\n width: viewportElement.clientWidth,\n height: viewportElement.clientHeight,\n },\n arrowOffset,\n offset,\n direction: passedDirection,\n possibleDirections,\n bannedDirections,\n position: getPointPosition(\n viewportElement,\n anchorClientRect\n ? { x: anchorClientRect.left, y: anchorClientRect.top }\n : passedPosition,\n !!viewportRef?.current,\n ),\n anchorSize,\n spareDirection,\n });\n\n useEffect(() => onSetDirection?.(direction), [direction]);\n\n useEffect(updateAnchorClientRect, [anchorSize]);\n\n usePopoverReposition({\n isActive: true,\n scrollAnchorRef: anchorRef || { current: null },\n onRequestReposition: () => {\n resetBannedDirections();\n updateAnchorClientRect();\n },\n });\n\n /**\n * Может возникнуть ситуация, когда перерасчет поповера всегда будет выдавать 2 направления\n * и бесконечно зацикливать себя. Для избежания таких кейсов мы запоминаем стороны,\n * которые не подошли, чтобы не возвращаться к ним и предотвратить бесконечный ререндер.\n * См. PopoverBannedPositionsStory\n */\n\n useLayoutEffect(() => {\n if (previousDirectionRef.current !== direction) {\n if (\n previousDirectionRef.current &&\n !bannedDirections.includes(previousDirectionRef.current) &&\n !bannedDirections.includes(direction) &&\n direction !== spareDirection\n ) {\n setBannedDirections((state) =>\n previousDirectionRef.current\n ? [...state, previousDirectionRef.current]\n : state,\n );\n }\n previousDirectionRef.current = direction;\n }\n }, [direction]);\n\n // Сбрасываем при любом изменении пропсов, чтобы заново начать перебор направлений\n // Главное не сбрасывать при изменении размеров поповера, т.к. именно оно может вызвать бесконечный перебор\n\n useLayoutEffect(resetBannedDirections, [props]);\n\n const renderPosition = getRenderPosition(\n viewportElement,\n position,\n !!viewportRef?.current,\n width,\n height,\n );\n\n const notVisible = !renderPosition || !height || !width;\n\n return (\n <PortalWithTheme\n {...otherProps}\n preset={theme}\n className={cnPopover({ direction, notVisible }, [className])}\n container={container}\n ref={useForkRef([ref, componentRef])}\n style={{\n ...style,\n ...(notVisible\n ? {}\n : {\n ['--popover-left' as string]: `${renderPosition.x}px`,\n ['--popover-top' as string]: `${renderPosition.y}px`,\n [`--popover-width` as string]: equalAnchorWidth\n ? `${anchorSize.width}px`\n : undefined,\n [`--popover-pointer-events` as string]: isInteractive\n ? undefined\n : 'none',\n [`--popover-visibility` as string]: position\n ? undefined\n : 'hidden',\n }),\n }}\n >\n <PortalWithThemeConsumer\n onClickOutside={onClickOutside}\n ignoreClicksInsideRefs={[ref, anchorRef || { current: null }]}\n >\n {isRenderProp(children) ? children(direction) : children}\n </PortalWithThemeConsumer>\n </PortalWithTheme>\n );\n },\n);\n"],"mappings":"knCAAA,sBAEA,MAAOA,MAAP,EAAgBC,UAAhB,CAA4BC,SAA5B,CAAuCC,eAAvC,CAAwDC,OAAxD,KAAuE,OAAvE,CAEA,OACEC,eADF,CAEEC,uBAFF,0BAIA,OAASC,QAAT,sBAEA,OAASC,gBAAT,oCACA,OAASC,UAAT,8BACA,OAASC,EAAT,uBACA,OAASC,YAAT,gCACA,OAASC,QAAT,CAAmBC,QAAnB,+BAGA,OACEC,+BADF,CAEEC,gBAFF,CAGEC,iBAHF,iBAKA,OAASC,oBAAT,8BAMA,MAAO,IAAMC,sBAAqB,CAAG,CACnC,YADmC,CAEnC,UAFmC,CAInC,WAJmC,CAKnC,UALmC,CAMnC,SANmC,CAOnC,QAPmC,CASnC,QATmC,CAUnC,YAVmC,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AVI,2CAW4Bf,CAAQ,QAExC,QAbI,IAFX,CANP,GAyBE,oBAAC,uBAAD,EACE,cAAc,CAAEL,CADlB,CAEE,sBAAsB,CAAE,CAAC1B,CAAD,CAAMgC,CAAS,EAAI,CAAE9B,OAAO,CAAE,IAAX,CAAnB,CAF1B,EAIGd,YAAY,CAAC+B,CAAD,CAAZ,CAAyBA,CAAQ,CAACC,CAAD,CAAjC,CAA+CD,CAJlD,CAzBF,CAiCH,CAhK8B,CAA1B"}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { usePortalContext } from './PortalWithThemeContext/PortalWithThemeContext';
3
3
  export { usePortalContext };
4
4
  export declare const PortalWithTheme: React.ForwardRefExoticComponent<{
5
- container?: Element;
5
+ container?: Element | React.RefObject<HTMLElement>;
6
6
  } & {
7
7
  preset: import("../Theme/Theme").ThemePreset;
8
8
  } & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "preset"> & React.RefAttributes<HTMLDivElement>>;
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["children","container","style"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{useEffect,useRef}from"react";import ReactDOM from"react-dom";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{Theme}from"../Theme/Theme";import{PortalWithThemeProvider,usePortalContext}from"./PortalWithThemeContext/PortalWithThemeContext";export{usePortalContext};var getZIndex=function(a,b){return"number"==typeof b?b:a?a+1:void 0};export var PortalWithTheme=React.forwardRef(function(a,b){var c=a.children,d=a.container,e=void 0===d?window.document.body:d,f=a.style,g=_objectWithoutProperties(a,_excluded),h=usePortalContext(),i=h.addRefs,j=h.zIndex,k=useRef(null),l=getZIndex(j,null===f||void 0===f?void 0:f.zIndex),m=_objectSpread(_objectSpread({},f),{},{zIndex:l});return useEffect(function(){i&&i([k])},[k]),ReactDOM.createPortal(React.createElement(PortalWithThemeProvider,{zIndex:l},React.createElement(Theme,Object.assign({},g,{ref:useForkRef([k,b]),style:m}),c)),e)});
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["children","container","style"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import React,{useEffect,useRef,useState}from"react";import ReactDOM from"react-dom";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{Theme}from"../Theme/Theme";import{PortalWithThemeProvider,usePortalContext}from"./PortalWithThemeContext/PortalWithThemeContext";export{usePortalContext};var getZIndex=function(a,b){return"number"==typeof b?b:a?a+1:void 0},isRef=function(a){return!!a&&"current"in a&&a.current instanceof HTMLElement},getElement=function(a){return isRef(a)?a.current:a};export var PortalWithTheme=React.forwardRef(function(a,b){var c=a.children,d=a.container,e=void 0===d?window.document.body:d,f=a.style,g=_objectWithoutProperties(a,_excluded),h=usePortalContext(),i=h.addRefs,j=h.zIndex,k=useState(getElement(e)),l=_slicedToArray(k,2),m=l[0],n=l[1],o=useRef(null),p=getZIndex(j,null===f||void 0===f?void 0:f.zIndex),q=useForkRef([o,b]);return useEffect(function(){i&&i([o])},[o]),useEffect(function(){n(getElement(e))},[getElement(e)]),m?ReactDOM.createPortal(React.createElement(PortalWithThemeProvider,{zIndex:p},React.createElement(Theme,Object.assign({},g,{ref:q,style:_objectSpread(_objectSpread({},f),{},{zIndex:p})}),c)),m):null});
2
2
  //# sourceMappingURL=PortalWithTheme.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PortalWithTheme.js","names":["React","useEffect","useRef","ReactDOM","useForkRef","Theme","PortalWithThemeProvider","usePortalContext","getZIndex","contextZIndex","propZIndex","PortalWithTheme","forwardRef","ref","children","container","window","document","body","styleProp","style","rest","addRefs","zIndexContext","zIndex","themeRef","createPortal"],"sources":["../../../../../src/components/PortalWithTheme/PortalWithTheme.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { Theme, ThemeProps } from '../Theme/Theme';\nimport {\n PortalWithThemeProvider,\n usePortalContext,\n} from './PortalWithThemeContext/PortalWithThemeContext';\n\nexport { usePortalContext };\n\ntype Props = {\n container?: Element;\n} & ThemeProps;\n\nconst getZIndex = (contextZIndex?: number, propZIndex?: number | string) => {\n if (typeof propZIndex === 'number') {\n return propZIndex;\n }\n\n if (contextZIndex) {\n return contextZIndex + 1;\n }\n\n return undefined;\n};\n\nexport const PortalWithTheme = React.forwardRef<HTMLDivElement, Props>(\n (\n { children, container = window.document.body, style: styleProp, ...rest },\n ref,\n ) => {\n const { addRefs, zIndex: zIndexContext } = usePortalContext();\n\n const themeRef = useRef(null);\n\n const zIndex = getZIndex(zIndexContext, styleProp?.zIndex);\n\n const style = {\n ...styleProp,\n zIndex,\n };\n\n useEffect(() => {\n addRefs && addRefs([themeRef]);\n }, [themeRef]);\n\n return ReactDOM.createPortal(\n <PortalWithThemeProvider zIndex={zIndex}>\n <Theme {...rest} ref={useForkRef([themeRef, ref])} style={style}>\n {children}\n </Theme>\n </PortalWithThemeProvider>,\n container,\n );\n },\n);\n"],"mappings":"yyBAAA,MAAOA,MAAP,EAAgBC,SAAhB,CAA2BC,MAA3B,KAAyC,OAAzC,CACA,MAAOC,SAAP,KAAqB,WAArB,CAEA,OAASC,UAAT,yCACA,OAASC,KAAT,sBACA,OACEC,uBADF,CAEEC,gBAFF,uDAKA,OAASA,gBAAT,EAMA,GAAMC,UAAS,CAAG,SAACC,CAAD,CAAyBC,CAAzB,CAA0D,OAChD,QAAtB,QAAOA,EAD+D,CAEjEA,CAFiE,CAKtED,CALsE,CAMjEA,CAAa,CAAG,CANiD,OAU3E,CAVD,CAYA,MAAO,IAAME,gBAAe,CAAGX,KAAK,CAACY,UAAN,CAC7B,WAEEC,CAFF,CAGK,IAFDC,EAEC,GAFDA,QAEC,KAFSC,SAET,CAFSA,CAET,YAFqBC,MAAM,CAACC,QAAP,CAAgBC,IAErC,GAFkDC,CAElD,GAF2CC,KAE3C,CAFgEC,CAEhE,yCACwCd,gBAAgB,EADxD,CACKe,CADL,GACKA,OADL,CACsBC,CADtB,GACcC,MADd,CAGGC,CAAQ,CAAGvB,MAAM,CAAC,IAAD,CAHpB,CAKGsB,CAAM,CAAGhB,SAAS,CAACe,CAAD,QAAgBJ,CAAhB,WAAgBA,CAAhB,QAAgBA,CAAS,CAAEK,MAA3B,CALrB,CAOGJ,CAAK,gCACND,CADM,MAETK,MAAM,CAANA,CAFS,EAPR,CAgBH,MAJAvB,UAAS,CAAC,UAAM,CACdqB,CAAO,EAAIA,CAAO,CAAC,CAACG,CAAD,CAAD,CACnB,CAFQ,CAEN,CAACA,CAAD,CAFM,CAIT,CAAOtB,QAAQ,CAACuB,YAAT,CACL,oBAAC,uBAAD,EAAyB,MAAM,CAAEF,CAAjC,EACE,oBAAC,KAAD,kBAAWH,CAAX,EAAiB,GAAG,CAAEjB,UAAU,CAAC,CAACqB,CAAD,CAAWZ,CAAX,CAAD,CAAhC,CAAmD,KAAK,CAAEO,CAA1D,GACGN,CADH,CADF,CADK,CAMLC,CANK,CAQR,CA5B4B,CAAxB"}
1
+ {"version":3,"file":"PortalWithTheme.js","names":["React","useEffect","useRef","useState","ReactDOM","useForkRef","Theme","PortalWithThemeProvider","usePortalContext","getZIndex","contextZIndex","propZIndex","isRef","ref","current","HTMLElement","getElement","PortalWithTheme","forwardRef","children","container","window","document","body","styleProp","style","rest","addRefs","zIndexContext","zIndex","portalContainer","setPortalContainer","themeRef","themeRefForked","createPortal"],"sources":["../../../../../src/components/PortalWithTheme/PortalWithTheme.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { Theme, ThemeProps } from '../Theme/Theme';\nimport {\n PortalWithThemeProvider,\n usePortalContext,\n} from './PortalWithThemeContext/PortalWithThemeContext';\n\nexport { usePortalContext };\n\ntype Props = {\n container?: Element | React.RefObject<HTMLElement>;\n} & ThemeProps;\n\nconst getZIndex = (contextZIndex?: number, propZIndex?: number | string) => {\n if (typeof propZIndex === 'number') {\n return propZIndex;\n }\n\n if (contextZIndex) {\n return contextZIndex + 1;\n }\n\n return undefined;\n};\n\nconst isRef = (\n ref: React.RefObject<HTMLElement> | Element | undefined,\n): ref is React.RefObject<HTMLElement> =>\n !!ref && 'current' in ref && ref.current instanceof HTMLElement;\n\nconst getElement = (ref: React.RefObject<HTMLElement> | Element) =>\n isRef(ref) ? ref.current : ref;\n\nexport const PortalWithTheme = React.forwardRef<HTMLDivElement, Props>(\n (\n { children, container = window.document.body, style: styleProp, ...rest },\n ref,\n ) => {\n const { addRefs, zIndex: zIndexContext } = usePortalContext();\n const [portalContainer, setPortalContainer] = useState<Element | null>(\n getElement(container),\n );\n\n const themeRef = useRef(null);\n\n const zIndex = getZIndex(zIndexContext, styleProp?.zIndex);\n\n const themeRefForked = useForkRef([themeRef, ref]);\n\n useEffect(() => {\n addRefs && addRefs([themeRef]);\n }, [themeRef]);\n\n useEffect(() => {\n setPortalContainer(getElement(container));\n }, [getElement(container)]);\n\n if (!portalContainer) {\n return null;\n }\n\n return ReactDOM.createPortal(\n <PortalWithThemeProvider zIndex={zIndex}>\n <Theme\n {...rest}\n ref={themeRefForked}\n style={{\n ...styleProp,\n zIndex,\n }}\n >\n {children}\n </Theme>\n </PortalWithThemeProvider>,\n portalContainer,\n );\n },\n);\n"],"mappings":"02BAAA,MAAOA,MAAP,EAAgBC,SAAhB,CAA2BC,MAA3B,CAAmCC,QAAnC,KAAmD,OAAnD,CACA,MAAOC,SAAP,KAAqB,WAArB,CAEA,OAASC,UAAT,yCACA,OAASC,KAAT,sBACA,OACEC,uBADF,CAEEC,gBAFF,uDAKA,OAASA,gBAAT,E,GAMMC,UAAS,CAAG,SAACC,CAAD,CAAyBC,CAAzB,CAA0D,OAChD,QAAtB,QAAOA,EAD+D,CAEjEA,CAFiE,CAKtED,CALsE,CAMjEA,CAAa,CAAG,CANiD,OAU3E,C,CAEKE,KAAK,CAAG,SACZC,CADY,QAGZ,CAAC,CAACA,CAAF,EAAS,WAAaA,EAAtB,EAA6BA,CAAG,CAACC,OAAJ,WAAuBC,YAHxC,C,CAKRC,UAAU,CAAG,SAACH,CAAD,QACjBD,MAAK,CAACC,CAAD,CAAL,CAAaA,CAAG,CAACC,OAAjB,CAA2BD,CADV,C,CAGnB,MAAO,IAAMI,gBAAe,CAAGjB,KAAK,CAACkB,UAAN,CAC7B,WAEEL,CAFF,CAGK,IAFDM,EAEC,GAFDA,QAEC,KAFSC,SAET,CAFSA,CAET,YAFqBC,MAAM,CAACC,QAAP,CAAgBC,IAErC,GAFkDC,CAElD,GAF2CC,KAE3C,CAFgEC,CAEhE,yCACwClB,gBAAgB,EADxD,CACKmB,CADL,GACKA,OADL,CACsBC,CADtB,GACcC,MADd,GAE2C1B,QAAQ,CACpDa,UAAU,CAACI,CAAD,CAD0C,CAFnD,uBAEIU,CAFJ,MAEqBC,CAFrB,MAMGC,CAAQ,CAAG9B,MAAM,CAAC,IAAD,CANpB,CAQG2B,CAAM,CAAGpB,SAAS,CAACmB,CAAD,QAAgBJ,CAAhB,WAAgBA,CAAhB,QAAgBA,CAAS,CAAEK,MAA3B,CARrB,CAUGI,CAAc,CAAG5B,UAAU,CAAC,CAAC2B,CAAD,CAAWnB,CAAX,CAAD,CAV9B,OAYHZ,UAAS,CAAC,UAAM,CACd0B,CAAO,EAAIA,CAAO,CAAC,CAACK,CAAD,CAAD,CACnB,CAFQ,CAEN,CAACA,CAAD,CAFM,CAZN,CAgBH/B,SAAS,CAAC,UAAM,CACd8B,CAAkB,CAACf,UAAU,CAACI,CAAD,CAAX,CACnB,CAFQ,CAEN,CAACJ,UAAU,CAACI,CAAD,CAAX,CAFM,CAhBN,CAoBEU,CApBF,CAwBI1B,QAAQ,CAAC8B,YAAT,CACL,oBAAC,uBAAD,EAAyB,MAAM,CAAEL,CAAjC,EACE,oBAAC,KAAD,kBACMH,CADN,EAEE,GAAG,CAAEO,CAFP,CAGE,KAAK,gCACAT,CADA,MAEHK,MAAM,CAANA,CAFG,EAHP,GAQGV,CARH,CADF,CADK,CAaLW,CAbK,CAxBJ,CAqBM,IAkBV,CA3C4B,CAAxB"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Подписчик на PortalWithThemeProvider
3
+ * получает рефы всех вложенных порталов во всплывающем окне
4
+ * для дальнейшего исключения их из useClickOutside
5
+ */
6
+ export declare const PortalWithThemeConsumer: React.FC<{
7
+ onClickOutside?: (event: MouseEvent) => void;
8
+ ignoreClicksInsideRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;
9
+ children: React.ReactNode;
10
+ }>;
@@ -0,0 +1,2 @@
1
+ import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import{useClickOutside}from"../../../hooks/useClickOutside";import{usePortalContext}from"../PortalWithTheme";export var PortalWithThemeConsumer=function(a){var b=a.onClickOutside,c=a.children,d=a.ignoreClicksInsideRefs,e=usePortalContext(),f=e.refs;return useClickOutside({isActive:!!b,ignoreClicksInsideRefs:[].concat(_toConsumableArray(d||[]),_toConsumableArray(f||[])),handler:b}),c};
2
+ //# sourceMappingURL=PortalWithThemeConsumer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PortalWithThemeConsumer.js","names":["useClickOutside","usePortalContext","PortalWithThemeConsumer","onClickOutside","children","ignoreClicksInsideRefs","refs","isActive","handler"],"sources":["../../../../../../src/components/PortalWithTheme/PortalWithThemeConsumer/PortalWithThemeConsumer.tsx"],"sourcesContent":["import { useClickOutside } from '##/hooks/useClickOutside';\n\nimport { usePortalContext } from '../PortalWithTheme';\n\n/**\n * Подписчик на PortalWithThemeProvider\n * получает рефы всех вложенных порталов во всплывающем окне\n * для дальнейшего исключения их из useClickOutside\n */\nexport const PortalWithThemeConsumer: React.FC<{\n onClickOutside?: (event: MouseEvent) => void;\n ignoreClicksInsideRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;\n children: React.ReactNode;\n}> = ({ onClickOutside, children, ignoreClicksInsideRefs }) => {\n const { refs } = usePortalContext();\n\n useClickOutside({\n isActive: !!onClickOutside,\n ignoreClicksInsideRefs: [\n ...(ignoreClicksInsideRefs || []),\n ...(refs || []),\n ],\n handler: onClickOutside,\n });\n\n return children as React.ReactNode;\n};\n"],"mappings":"yEAAA,OAASA,eAAT,sCAEA,OAASC,gBAAT,0BAOA,MAAO,IAAMC,wBAIX,CAAG,WAA0D,IAAvDC,EAAuD,GAAvDA,cAAuD,CAAvCC,CAAuC,GAAvCA,QAAuC,CAA7BC,CAA6B,GAA7BA,sBAA6B,GAC5CJ,gBAAgB,EAD4B,CACrDK,CADqD,GACrDA,IADqD,CAY7D,MATAN,gBAAe,CAAC,CACdO,QAAQ,CAAE,CAAC,CAACJ,CADE,CAEdE,sBAAsB,8BAChBA,CAAsB,EAAI,EADV,qBAEhBC,CAAI,EAAI,EAFQ,EAFR,CAMdE,OAAO,CAAEL,CANK,CAAD,CASf,CAAOC,CACR,CAjBM"}
@@ -0,0 +1 @@
1
+ export * from './PortalWithThemeConsumer';
@@ -0,0 +1,2 @@
1
+ export*from"./PortalWithThemeConsumer";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/PortalWithTheme/PortalWithThemeConsumer/index.ts"],"sourcesContent":["export * from './PortalWithThemeConsumer';\n"],"mappings":"AAAA"}
@@ -1 +1,2 @@
1
1
  export * from './PortalWithTheme';
2
+ export * from './PortalWithThemeConsumer';
@@ -1,2 +1,2 @@
1
- export*from"./PortalWithTheme";
1
+ export*from"./PortalWithTheme";export*from"./PortalWithThemeConsumer";
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/PortalWithTheme/index.ts"],"sourcesContent":["export * from './PortalWithTheme';\n"],"mappings":"AAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/PortalWithTheme/index.ts"],"sourcesContent":["export * from './PortalWithTheme';\nexport * from './PortalWithThemeConsumer';\n"],"mappings":"AAAA,+BACA"}
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","children"],_excluded2=["className","children"],_excluded3=["isOpen","onClose","onOpen","hasOverlay","onClickOutside","onEsc","position","size","className","children","container","style","rootClassName","afterClose"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./Sidebar.css";import React,{useEffect,useRef}from"react";import{Transition}from"react-transition-group";import{PortalWithTheme,usePortalContext}from"../PortalWithTheme";import{useTheme}from"../Theme/Theme";import{useClickOutside}from"../../hooks/useClickOutside";import{useGlobalKeys}from"../../hooks/useGlobalKeys";import{cnMixScrollBar}from"../../mixs/MixScrollBar";import{cn}from"../../utils/bem";var sidebarPropPosition=["right","bottom","left","top"],sidebarPropPositionDefault=sidebarPropPosition[0];export var sidebarPropSize=["s","m","l","full","1/2","1/3","1/4","2/3","3/4"];var sidebarPropSizeDefault=sidebarPropSize[1];export var cnSidebar=cn("Sidebar");var SidebarContent=function(a){var b=a.className,c=a.children,d=_objectWithoutProperties(a,_excluded);return React.createElement("div",Object.assign({className:cnSidebar("Content",[b,cnMixScrollBar()])},d),c)},SidebarActions=function(a){var b=a.className,c=a.children,d=_objectWithoutProperties(a,_excluded2);return React.createElement("div",Object.assign({className:cnSidebar("Actions",[b])},d),c)},ContextConsumer=function(a){var b=a.onClickOutside,c=a.children,d=a.ignoreClicksInsideRefs,e=usePortalContext(),f=e.refs;return useClickOutside({isActive:!!b,ignoreClicksInsideRefs:[].concat(_toConsumableArray(d||[]),_toConsumableArray(f||[])),handler:b}),c};export var Sidebar=function(a){var b=a.isOpen,c=a.onClose,d=a.onOpen,e=a.hasOverlay,f=void 0===e||e,g=a.onClickOutside,h=a.onEsc,i=a.position,j=void 0===i?sidebarPropPositionDefault:i,k=a.size,l=void 0===k?sidebarPropSizeDefault:k,m=a.className,n=a.children,o=a.container,p=void 0===o?window.document.body:o,q=a.style,r=a.rootClassName,s=a.afterClose,t=_objectWithoutProperties(a,_excluded3),u=useRef(null),v=useRef(null),w=useTheme(),x=w.theme;return useEffect(function(){b?null===d||void 0===d?void 0:d():null===c||void 0===c?void 0:c()},[b]),useGlobalKeys({Escape:function Escape(a){return b&&h&&h(a)}}),React.createElement(Transition,{in:b,unmountOnExit:!0,timeout:240,nodeRef:v,onExiting:s},function(a){return React.createElement(PortalWithTheme,{preset:x,ref:v,container:p,className:cnSidebar({position:j,hasOverlay:f},[r]),style:"number"==typeof(null===q||void 0===q?void 0:q.zIndex)?{zIndex:q.zIndex}:void 0},f&&React.createElement("div",{className:cnSidebar("Overlay",{animate:a}),"aria-label":"Overlay"}),React.createElement("div",Object.assign({},t,{style:_objectSpread(_objectSpread({},q),{},{zIndex:void 0}),className:cnSidebar("Window",{size:l,position:j,animate:a},[m]),ref:u}),React.createElement(ContextConsumer,{onClickOutside:g,ignoreClicksInsideRefs:[u]},n)))})};Sidebar.Content=SidebarContent,Sidebar.Actions=SidebarActions;
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","children"],_excluded2=["className","children"],_excluded3=["isOpen","onClose","onOpen","hasOverlay","onClickOutside","onEsc","position","size","className","children","container","style","rootClassName","afterClose"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./Sidebar.css";import React,{useEffect,useRef}from"react";import{Transition}from"react-transition-group";import{PortalWithTheme,PortalWithThemeConsumer}from"../PortalWithTheme";import{useTheme}from"../Theme/Theme";import{useGlobalKeys}from"../../hooks/useGlobalKeys";import{cnMixScrollBar}from"../../mixs/MixScrollBar";import{cn}from"../../utils/bem";var sidebarPropPosition=["right","bottom","left","top"],sidebarPropPositionDefault=sidebarPropPosition[0];export var sidebarPropSize=["s","m","l","full","1/2","1/3","1/4","2/3","3/4"];var sidebarPropSizeDefault=sidebarPropSize[1];export var cnSidebar=cn("Sidebar");var SidebarContent=function(a){var b=a.className,c=a.children,d=_objectWithoutProperties(a,_excluded);return React.createElement("div",Object.assign({className:cnSidebar("Content",[b,cnMixScrollBar()])},d),c)},SidebarActions=function(a){var b=a.className,c=a.children,d=_objectWithoutProperties(a,_excluded2);return React.createElement("div",Object.assign({className:cnSidebar("Actions",[b])},d),c)};export var Sidebar=function(a){var b=a.isOpen,c=a.onClose,d=a.onOpen,e=a.hasOverlay,f=void 0===e||e,g=a.onClickOutside,h=a.onEsc,i=a.position,j=void 0===i?sidebarPropPositionDefault:i,k=a.size,l=void 0===k?sidebarPropSizeDefault:k,m=a.className,n=a.children,o=a.container,p=void 0===o?window.document.body:o,q=a.style,r=a.rootClassName,s=a.afterClose,t=_objectWithoutProperties(a,_excluded3),u=useRef(null),v=useRef(null),w=useTheme(),x=w.theme;return useEffect(function(){b?null===d||void 0===d?void 0:d():null===c||void 0===c?void 0:c()},[b]),useGlobalKeys({Escape:function Escape(a){return b&&h&&h(a)}}),React.createElement(Transition,{in:b,unmountOnExit:!0,timeout:240,nodeRef:v,onExiting:s},function(a){return React.createElement(PortalWithTheme,{preset:x,ref:v,container:p,className:cnSidebar({position:j,hasOverlay:f},[r]),style:"number"==typeof(null===q||void 0===q?void 0:q.zIndex)?{zIndex:q.zIndex}:void 0},f&&React.createElement("div",{className:cnSidebar("Overlay",{animate:a}),"aria-label":"Overlay"}),React.createElement("div",Object.assign({},t,{style:_objectSpread(_objectSpread({},q),{},{zIndex:void 0}),className:cnSidebar("Window",{size:l,position:j,animate:a},[m]),ref:u}),React.createElement(PortalWithThemeConsumer,{onClickOutside:g,ignoreClicksInsideRefs:[u]},n)))})};Sidebar.Content=SidebarContent,Sidebar.Actions=SidebarActions;
2
2
  //# sourceMappingURL=Sidebar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.js","names":["React","useEffect","useRef","Transition","PortalWithTheme","usePortalContext","useTheme","useClickOutside","useGlobalKeys","cnMixScrollBar","cn","sidebarPropPosition","sidebarPropPositionDefault","sidebarPropSize","sidebarPropSizeDefault","cnSidebar","SidebarContent","className","children","rest","SidebarActions","ContextConsumer","onClickOutside","ignoreClicksInsideRefs","refs","isActive","handler","Sidebar","props","isOpen","onClose","onOpen","hasOverlay","onEsc","position","size","container","window","document","body","style","rootClassName","afterClose","otherProps","ref","portalRef","theme","Escape","e","animate","zIndex","Content","Actions"],"sources":["../../../../../src/components/Sidebar/Sidebar.tsx"],"sourcesContent":["import './Sidebar.css';\n\nimport React, { useEffect, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n PortalWithTheme,\n usePortalContext,\n} from '##/components/PortalWithTheme';\nimport { useTheme } from '##/components/Theme/Theme';\nimport { useClickOutside } from '##/hooks/useClickOutside';\nimport { useGlobalKeys } from '##/hooks/useGlobalKeys';\nimport { cnMixScrollBar } from '##/mixs/MixScrollBar';\nimport { cn } from '##/utils/bem';\nimport { AsTagAttribute } from '##/utils/types/AsTags';\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\nconst sidebarPropPosition = ['right', 'bottom', 'left', 'top'] as const;\ntype SidebarPropPosition = typeof sidebarPropPosition[number];\nconst sidebarPropPositionDefault: SidebarPropPosition = sidebarPropPosition[0];\n\nexport const sidebarPropSize = [\n 's',\n 'm',\n 'l',\n 'full',\n '1/2',\n '1/3',\n '1/4',\n '2/3',\n '3/4',\n] as const;\n\nexport type SidebarPropSize = typeof sidebarPropSize[number];\nconst sidebarPropSizeDefault: SidebarPropSize = sidebarPropSize[1];\n\ntype SidebarProps = PropsWithHTMLAttributes<\n {\n isOpen?: boolean;\n onClose?: () => void;\n onOpen?: () => void;\n hasOverlay?: boolean;\n onClickOutside?: (event: MouseEvent) => void;\n onEsc?: (event: KeyboardEvent) => void;\n position?: SidebarPropPosition;\n size?: SidebarPropSize;\n rootClassName?: string;\n children?: React.ReactNode;\n container?: HTMLDivElement | undefined;\n afterClose?: () => void;\n },\n HTMLDivElement\n>;\n\ntype SidebarContentProps = {\n className?: string;\n children: React.ReactNode;\n};\n\ntype SidebarActionsProps = {\n className?: string;\n children: React.ReactNode;\n};\n\nexport const cnSidebar = cn('Sidebar');\n\nconst SidebarContent: React.FC<SidebarContentProps> = ({\n className,\n children,\n ...rest\n}) => (\n <div\n className={cnSidebar('Content', [className, cnMixScrollBar()])}\n {...rest}\n >\n {children}\n </div>\n);\n\nconst SidebarActions: React.FC<SidebarActionsProps> = ({\n className,\n children,\n ...rest\n}) => (\n <div className={cnSidebar('Actions', [className])} {...rest}>\n {children}\n </div>\n);\n\nconst ContextConsumer: React.FC<{\n onClickOutside?: (event: MouseEvent) => void;\n ignoreClicksInsideRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;\n children: React.ReactNode;\n}> = ({ onClickOutside, children, ignoreClicksInsideRefs }) => {\n const { refs } = usePortalContext();\n\n useClickOutside({\n isActive: !!onClickOutside,\n ignoreClicksInsideRefs: [\n ...(ignoreClicksInsideRefs || []),\n ...(refs || []),\n ],\n handler: onClickOutside,\n });\n\n return children as React.ReactNode;\n};\n\ninterface SidebarComponent\n extends React.FC<SidebarProps>,\n AsTagAttribute<'div'> {\n Content: typeof SidebarContent;\n Actions: typeof SidebarActions;\n}\n\nexport const Sidebar: SidebarComponent = (props) => {\n const {\n isOpen,\n onClose,\n onOpen,\n hasOverlay = true,\n onClickOutside,\n onEsc,\n position = sidebarPropPositionDefault,\n size = sidebarPropSizeDefault,\n className,\n children,\n container = window.document.body,\n style,\n rootClassName,\n afterClose,\n ...otherProps\n } = props;\n\n const ref = useRef<HTMLDivElement | null>(null);\n\n const portalRef = useRef<HTMLDivElement>(null);\n\n const { theme } = useTheme();\n\n useEffect(() => {\n if (isOpen) {\n onOpen?.();\n } else {\n onClose?.();\n }\n }, [isOpen]);\n\n useGlobalKeys({\n Escape: (e) => isOpen && onEsc && onEsc(e),\n });\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n timeout={240}\n nodeRef={portalRef}\n onExiting={afterClose}\n >\n {(animate) => (\n <PortalWithTheme\n preset={theme}\n ref={portalRef}\n container={container}\n className={cnSidebar({ position, hasOverlay }, [rootClassName])}\n style={\n typeof style?.zIndex === 'number'\n ? { zIndex: style.zIndex }\n : undefined\n }\n >\n {hasOverlay && (\n <div\n className={cnSidebar('Overlay', { animate })}\n aria-label=\"Overlay\"\n />\n )}\n <div\n {...otherProps}\n style={{\n ...style,\n zIndex: undefined,\n }}\n className={cnSidebar('Window', { size, position, animate }, [\n className,\n ])}\n ref={ref}\n >\n <ContextConsumer\n onClickOutside={onClickOutside}\n ignoreClicksInsideRefs={[ref]}\n >\n {children}\n </ContextConsumer>\n </div>\n </PortalWithTheme>\n )}\n </Transition>\n );\n};\n\nSidebar.Content = SidebarContent;\nSidebar.Actions = SidebarActions;\n"],"mappings":"ujCAAA,sBAEA,MAAOA,MAAP,EAAgBC,SAAhB,CAA2BC,MAA3B,KAAyC,OAAzC,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OACEC,eADF,CAEEC,gBAFF,0BAIA,OAASC,QAAT,sBACA,OAASC,eAAT,mCACA,OAASC,aAAT,iCACA,OAASC,cAAT,+BACA,OAASC,EAAT,uB,GAIMC,oBAAmB,CAAG,CAAC,OAAD,CAAU,QAAV,CAAoB,MAApB,CAA4B,KAA5B,C,CAEtBC,0BAA+C,CAAGD,mBAAmB,CAAC,CAAD,C,CAE3E,MAAO,IAAME,gBAAe,CAAG,CAC7B,GAD6B,CAE7B,GAF6B,CAG7B,GAH6B,CAI7B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AAD,QACC,qBAAC,eAAD,EACE,MAAM,CAAEH,CADV,CAEE,GAAG,CAAED,CAFP,CAGE,SAAS,CAAET,CAHb,CAIE,SAAS,CAAErB,SAAS,CAAC,CAAEmB,QAAQ,CAARA,CAAF,CAAYF,UAAU,CAAVA,CAAZ,CAAD,CAA2B,CAACS,CAAD,CAA3B,CAJtB,CAKE,KAAK,CACsB,QAAzB,gBAAOD,CAAP,WAAOA,CAAP,QAAOA,CAAK,CAAEU,MAAd,EACI,CAAEA,MAAM,CAAEV,CAAK,CAACU,MAAhB,CADJ,OANJ,EAWGlB,CAAU,EACT,2BACE,SAAS,CAAEjB,SAAS,CAAC,SAAD,CAAY,CAAEkC,OAAO,CAAPA,CAAF,CAAZ,CADtB,CAEE,aAAW,SAFb,EAZJ,CAiBE,2CACMN,CADN,EAEE,KAAK,gCACAH,CADA,MAEHU,MAAM,OAFH,EAFP,CAME,SAAS,CAAEnC,SAAS,CAAC,QAAD,CAAW,CAAEoB,IAAI,CAAJA,CAAF,CAAQD,QAAQ,CAARA,CAAR,CAAkBe,OAAO,CAAPA,CAAlB,CAAX,CAAwC,CAC1DhC,CAD0D,CAAxC,CANtB,CASE,GAAG,CAAE2B,CATP,GAWE,oBAAC,eAAD,EACE,cAAc,CAAEtB,CADlB,CAEE,sBAAsB,CAAE,CAACsB,CAAD,CAF1B,EAIG1B,CAJH,CAXF,CAjBF,CADD,CAPH,CA+CH,CArFM,CAuFPS,OAAO,CAACwB,OAAR,CAAkBnC,c,CAClBW,OAAO,CAACyB,OAAR,CAAkBhC,c"}
1
+ {"version":3,"file":"Sidebar.js","names":["React","useEffect","useRef","Transition","PortalWithTheme","PortalWithThemeConsumer","useTheme","useGlobalKeys","cnMixScrollBar","cn","sidebarPropPosition","sidebarPropPositionDefault","sidebarPropSize","sidebarPropSizeDefault","cnSidebar","SidebarContent","className","children","rest","SidebarActions","Sidebar","props","isOpen","onClose","onOpen","hasOverlay","onClickOutside","onEsc","position","size","container","window","document","body","style","rootClassName","afterClose","otherProps","ref","portalRef","theme","Escape","e","animate","zIndex","Content","Actions"],"sources":["../../../../../src/components/Sidebar/Sidebar.tsx"],"sourcesContent":["import './Sidebar.css';\n\nimport React, { useEffect, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n PortalWithTheme,\n PortalWithThemeConsumer,\n} from '##/components/PortalWithTheme';\nimport { useTheme } from '##/components/Theme/Theme';\nimport { useGlobalKeys } from '##/hooks/useGlobalKeys';\nimport { cnMixScrollBar } from '##/mixs/MixScrollBar';\nimport { cn } from '##/utils/bem';\nimport { AsTagAttribute } from '##/utils/types/AsTags';\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\nconst sidebarPropPosition = ['right', 'bottom', 'left', 'top'] as const;\ntype SidebarPropPosition = typeof sidebarPropPosition[number];\nconst sidebarPropPositionDefault: SidebarPropPosition = sidebarPropPosition[0];\n\nexport const sidebarPropSize = [\n 's',\n 'm',\n 'l',\n 'full',\n '1/2',\n '1/3',\n '1/4',\n '2/3',\n '3/4',\n] as const;\n\nexport type SidebarPropSize = typeof sidebarPropSize[number];\nconst sidebarPropSizeDefault: SidebarPropSize = sidebarPropSize[1];\n\ntype SidebarProps = PropsWithHTMLAttributes<\n {\n isOpen?: boolean;\n onClose?: () => void;\n onOpen?: () => void;\n hasOverlay?: boolean;\n onClickOutside?: (event: MouseEvent) => void;\n onEsc?: (event: KeyboardEvent) => void;\n position?: SidebarPropPosition;\n size?: SidebarPropSize;\n rootClassName?: string;\n children?: React.ReactNode;\n container?: HTMLDivElement | undefined;\n afterClose?: () => void;\n },\n HTMLDivElement\n>;\n\ntype SidebarContentProps = {\n className?: string;\n children: React.ReactNode;\n};\n\ntype SidebarActionsProps = {\n className?: string;\n children: React.ReactNode;\n};\n\nexport const cnSidebar = cn('Sidebar');\n\nconst SidebarContent: React.FC<SidebarContentProps> = ({\n className,\n children,\n ...rest\n}) => (\n <div\n className={cnSidebar('Content', [className, cnMixScrollBar()])}\n {...rest}\n >\n {children}\n </div>\n);\n\nconst SidebarActions: React.FC<SidebarActionsProps> = ({\n className,\n children,\n ...rest\n}) => (\n <div className={cnSidebar('Actions', [className])} {...rest}>\n {children}\n </div>\n);\n\ninterface SidebarComponent\n extends React.FC<SidebarProps>,\n AsTagAttribute<'div'> {\n Content: typeof SidebarContent;\n Actions: typeof SidebarActions;\n}\n\nexport const Sidebar: SidebarComponent = (props) => {\n const {\n isOpen,\n onClose,\n onOpen,\n hasOverlay = true,\n onClickOutside,\n onEsc,\n position = sidebarPropPositionDefault,\n size = sidebarPropSizeDefault,\n className,\n children,\n container = window.document.body,\n style,\n rootClassName,\n afterClose,\n ...otherProps\n } = props;\n\n const ref = useRef<HTMLDivElement | null>(null);\n\n const portalRef = useRef<HTMLDivElement>(null);\n\n const { theme } = useTheme();\n\n useEffect(() => {\n if (isOpen) {\n onOpen?.();\n } else {\n onClose?.();\n }\n }, [isOpen]);\n\n useGlobalKeys({\n Escape: (e) => isOpen && onEsc && onEsc(e),\n });\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n timeout={240}\n nodeRef={portalRef}\n onExiting={afterClose}\n >\n {(animate) => (\n <PortalWithTheme\n preset={theme}\n ref={portalRef}\n container={container}\n className={cnSidebar({ position, hasOverlay }, [rootClassName])}\n style={\n typeof style?.zIndex === 'number'\n ? { zIndex: style.zIndex }\n : undefined\n }\n >\n {hasOverlay && (\n <div\n className={cnSidebar('Overlay', { animate })}\n aria-label=\"Overlay\"\n />\n )}\n <div\n {...otherProps}\n style={{\n ...style,\n zIndex: undefined,\n }}\n className={cnSidebar('Window', { size, position, animate }, [\n className,\n ])}\n ref={ref}\n >\n <PortalWithThemeConsumer\n onClickOutside={onClickOutside}\n ignoreClicksInsideRefs={[ref]}\n >\n {children}\n </PortalWithThemeConsumer>\n </div>\n </PortalWithTheme>\n )}\n </Transition>\n );\n};\n\nSidebar.Content = SidebarContent;\nSidebar.Actions = SidebarActions;\n"],"mappings":"8+BAAA,sBAE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,CAKE,SAAS,CAAEH,CALb,EAOG,SAACO,CAAD,QACC,qBAAC,eAAD,EACE,MAAM,CAAEH,CADV,CAEE,GAAG,CAAED,CAFP,CAGE,SAAS,CAAET,CAHb,CAIE,SAAS,CAAEhB,SAAS,CAAC,CAAEc,QAAQ,CAARA,CAAF,CAAYH,UAAU,CAAVA,CAAZ,CAAD,CAA2B,CAACU,CAAD,CAA3B,CAJtB,CAKE,KAAK,CACsB,QAAzB,gBAAOD,CAAP,WAAOA,CAAP,QAAOA,CAAK,CAAEU,MAAd,EACI,CAAEA,MAAM,CAAEV,CAAK,CAACU,MAAhB,CADJ,OANJ,EAWGnB,CAAU,EACT,2BACE,SAAS,CAAEX,SAAS,CAAC,SAAD,CAAY,CAAE6B,OAAO,CAAPA,CAAF,CAAZ,CADtB,CAEE,aAAW,SAFb,EAZJ,CAiBE,2CACMN,CADN,EAEE,KAAK,gCACAH,CADA,MAEHU,MAAM,OAFH,EAFP,CAME,SAAS,CAAE9B,SAAS,CAAC,QAAD,CAAW,CAAEe,IAAI,CAAJA,CAAF,CAAQD,QAAQ,CAARA,CAAR,CAAkBe,OAAO,CAAPA,CAAlB,CAAX,CAAwC,CAC1D3B,CAD0D,CAAxC,CANtB,CASE,GAAG,CAAEsB,CATP,GAWE,oBAAC,uBAAD,EACE,cAAc,CAAEZ,CADlB,CAEE,sBAAsB,CAAE,CAACY,CAAD,CAF1B,EAIGrB,CAJH,CAXF,CAjBF,CADD,CAPH,CA+CH,CArFM,CAuFPG,OAAO,CAACyB,OAAR,CAAkB9B,c,CAClBK,OAAO,CAAC0B,OAAR,CAAkB3B,c"}
@@ -1,2 +1,2 @@
1
- declare const _default: CreatedStand;
1
+ declare const _default: import("@consta/stand").CreatedStand;
2
2
  export default _default;
@@ -1 +1 @@
1
- export declare const createStand: (standProps: Stand<GROUP["id"]>) => CreatedStand;
1
+ export declare const createStand: (standProps: import("@consta/stand").Stand<string>) => import("@consta/stand").CreatedStand;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@consta/uikit",
3
- "version": "5.22.0",
3
+ "version": "5.23.0",
4
4
  "keywords": [
5
5
  "ui-kit",
6
6
  "design-system",