@hh.ru/magritte-ui-drop 7.2.7 → 7.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Drop.js CHANGED
@@ -5,7 +5,7 @@ import classnames from 'classnames';
5
5
  import { DropBase } from '@hh.ru/magritte-internal-drop-base';
6
6
  import { InternalLayerName } from '@hh.ru/magritte-internal-layer-name';
7
7
  import { useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';
8
- import { s as styles, D as DropContainer } from './DropContainer-B4bDnL97.js';
8
+ import { s as styles, D as DropContainer } from './DropContainer-Cdusp6r1.js';
9
9
  import { PureChildren } from './PureChildren.js';
10
10
  import { Layer } from '@hh.ru/magritte-ui-layer';
11
11
  import '@hh.ru/magritte-common-use-multiple-refs';
@@ -4,7 +4,7 @@ import { forwardRef, useRef, useCallback, useEffect } from 'react';
4
4
  import { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';
5
5
  import { Divider } from '@hh.ru/magritte-ui-divider';
6
6
 
7
- var styles = {"drop":"magritte-drop___Z10P4_7-2-7","drop-container":"magritte-drop-container___dbMt9_7-2-7","dropContainer":"magritte-drop-container___dbMt9_7-2-7","divider-container":"magritte-divider-container___ZCdDW_7-2-7","dividerContainer":"magritte-divider-container___ZCdDW_7-2-7","drop-footer":"magritte-drop-footer___v8ZEO_7-2-7","dropFooter":"magritte-drop-footer___v8ZEO_7-2-7","drop-space-300":"magritte-drop-space-300___41acH_7-2-7","dropSpace300":"magritte-drop-space-300___41acH_7-2-7","drop-space-400":"magritte-drop-space-400___XX1RM_7-2-7","dropSpace400":"magritte-drop-space-400___XX1RM_7-2-7","drop-padding":"magritte-drop-padding___xBiJO_7-2-7","dropPadding":"magritte-drop-padding___xBiJO_7-2-7","drop-space-600":"magritte-drop-space-600___6B1i0_7-2-7","dropSpace600":"magritte-drop-space-600___6B1i0_7-2-7","drop-with-footer":"magritte-drop-with-footer___CgBIV_7-2-7","dropWithFooter":"magritte-drop-with-footer___CgBIV_7-2-7","drop-enter":"magritte-drop-enter___4vEuH_7-2-7","dropEnter":"magritte-drop-enter___4vEuH_7-2-7","drop-exit":"magritte-drop-exit___brFjz_7-2-7","dropExit":"magritte-drop-exit___brFjz_7-2-7","drop-enter-active":"magritte-drop-enter-active___SQUog_7-2-7","dropEnterActive":"magritte-drop-enter-active___SQUog_7-2-7","drop-exit-active":"magritte-drop-exit-active___GB0ET_7-2-7","dropExitActive":"magritte-drop-exit-active___GB0ET_7-2-7","drop-animation-timeout":"magritte-drop-animation-timeout___uO7LF_7-2-7","dropAnimationTimeout":"magritte-drop-animation-timeout___uO7LF_7-2-7"};
7
+ var styles = {"drop":"magritte-drop___Z10P4_7-2-8","drop-container":"magritte-drop-container___dbMt9_7-2-8","dropContainer":"magritte-drop-container___dbMt9_7-2-8","divider-container":"magritte-divider-container___ZCdDW_7-2-8","dividerContainer":"magritte-divider-container___ZCdDW_7-2-8","drop-footer":"magritte-drop-footer___v8ZEO_7-2-8","dropFooter":"magritte-drop-footer___v8ZEO_7-2-8","drop-space-300":"magritte-drop-space-300___41acH_7-2-8","dropSpace300":"magritte-drop-space-300___41acH_7-2-8","drop-space-400":"magritte-drop-space-400___XX1RM_7-2-8","dropSpace400":"magritte-drop-space-400___XX1RM_7-2-8","drop-padding":"magritte-drop-padding___xBiJO_7-2-8","dropPadding":"magritte-drop-padding___xBiJO_7-2-8","drop-space-600":"magritte-drop-space-600___6B1i0_7-2-8","dropSpace600":"magritte-drop-space-600___6B1i0_7-2-8","drop-with-footer":"magritte-drop-with-footer___CgBIV_7-2-8","dropWithFooter":"magritte-drop-with-footer___CgBIV_7-2-8","drop-enter":"magritte-drop-enter___4vEuH_7-2-8","dropEnter":"magritte-drop-enter___4vEuH_7-2-8","drop-exit":"magritte-drop-exit___brFjz_7-2-8","dropExit":"magritte-drop-exit___brFjz_7-2-8","drop-enter-active":"magritte-drop-enter-active___SQUog_7-2-8","dropEnterActive":"magritte-drop-enter-active___SQUog_7-2-8","drop-exit-active":"magritte-drop-exit-active___GB0ET_7-2-8","dropExitActive":"magritte-drop-exit-active___GB0ET_7-2-8","drop-animation-timeout":"magritte-drop-animation-timeout___uO7LF_7-2-8","dropAnimationTimeout":"magritte-drop-animation-timeout___uO7LF_7-2-8"};
8
8
 
9
9
  const DropContainer = forwardRef(({ children, dividerState }, ref) => {
10
10
  const dividerRef = useRef(null);
@@ -55,4 +55,4 @@ const DropContainer = forwardRef(({ children, dividerState }, ref) => {
55
55
  DropContainer.displayName = 'DropContainer';
56
56
 
57
57
  export { DropContainer as D, styles as s };
58
- //# sourceMappingURL=DropContainer-B4bDnL97.js.map
58
+ //# sourceMappingURL=DropContainer-Cdusp6r1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropContainer-B4bDnL97.js","sources":["../src/DropContainer.tsx"],"sourcesContent":["import { useRef, type PropsWithChildren, useEffect, useCallback, forwardRef } from 'react';\n\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { Divider } from '@hh.ru/magritte-ui-divider';\nimport type { DividerState } from '@hh.ru/magritte-ui-drop/types';\n\nimport styles from './drop.less';\n\nexport const DropContainer = forwardRef<\n HTMLDivElement,\n PropsWithChildren<{\n dividerState: DividerState;\n }>\n>(({ children, dividerState }, ref) => {\n const dividerRef = useRef<HTMLDivElement>(null);\n const showDividerRef = useRef(false);\n showDividerRef.current = dividerState !== 'hide';\n const contentContainerRef = useRef<HTMLDivElement>(null);\n const contentContainerRefMulti = useMultipleRefs(contentContainerRef, ref);\n\n const updateDividerVisibility = useCallback(\n (showDivider: boolean) => {\n if (!contentContainerRef.current || !dividerRef.current) {\n return;\n }\n if (!showDivider) {\n dividerRef.current.style.visibility = 'hidden';\n return;\n }\n if (contentContainerRef?.current !== null && dividerRef.current) {\n const hasScroll =\n contentContainerRef.current.scrollHeight - contentContainerRef.current.clientHeight > 0;\n dividerRef.current.style.visibility = hasScroll ? 'visible' : 'hidden';\n }\n },\n [contentContainerRef, dividerRef]\n );\n\n useEffect(() => {\n const observer = new ResizeObserver(() => {\n updateDividerVisibility(showDividerRef.current);\n });\n observer.observe(contentContainerRef.current as Element);\n return () => observer.disconnect();\n }, [updateDividerVisibility]);\n\n useEffect(() => {\n updateDividerVisibility(showDividerRef.current);\n // eslint-disable-next-line disable-autofix/react-hooks/exhaustive-deps\n }, [updateDividerVisibility, showDividerRef.current]);\n\n const props = showDividerRef.current\n ? {\n onScroll: ({ target }: { target: EventTarget }) => {\n const scrollableContainer = target as HTMLDivElement;\n\n if (dividerRef.current && dividerState !== 'showWhenFullyScrolled') {\n const scrollEnded =\n scrollableContainer.scrollTop +\n scrollableContainer.offsetHeight -\n scrollableContainer.scrollHeight ===\n 0;\n\n dividerRef.current.style.visibility = scrollEnded ? 'hidden' : 'visible';\n }\n },\n }\n : {};\n\n return (\n <>\n <div ref={contentContainerRefMulti} className={styles.dropContainer} {...props}>\n {children}\n </div>\n <div ref={dividerRef} className={styles.dividerContainer} data-qa=\"drop-divider\">\n <Divider />\n </div>\n </>\n );\n});\n\nDropContainer.displayName = 'DropContainer';\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;AAQO,MAAM,aAAa,GAAG,UAAU,CAKrC,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,GAAG,KAAI;AAClC,IAAA,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AAChD,IAAA,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AACrC,IAAA,cAAc,CAAC,OAAO,GAAG,YAAY,KAAK,MAAM,CAAC;AACjD,IAAA,MAAM,mBAAmB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IACzD,MAAM,wBAAwB,GAAG,eAAe,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;AAE3E,IAAA,MAAM,uBAAuB,GAAG,WAAW,CACvC,CAAC,WAAoB,KAAI;QACrB,IAAI,CAAC,mBAAmB,CAAC,OAAO,IA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AChE,oBAAA,MAAM,WAAW,GACb,mBAAmB,CAAC,SAAS;AACzB,wBAAA,mBAAmB,CAAC,YAAY;AAChC,wBAAA,mBAAmB,CAAC,YAAY;AACpC,wBAAA,CAAC,CAAC;AAEN,oBAAA,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;iBAC5E;aACJ;AACJ,SAAA;UACD,EAAE,CAAC;AAET,IAAA,QACIA,IACI,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CAAAC,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,CAAC,aAAa,EAAA,GAAM,KAAK,EAAA,QAAA,EACzE,QAAQ,EACP,CAAA,EACNA,GAAK,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,gBAAgB,EAAU,SAAA,EAAA,cAAc,YAC5EA,GAAC,CAAA,OAAO,KAAG,EACT,CAAA,CAAA,EAAA,CACP,EACL;AACN,CAAC,EAAE;AAEH,aAAa,CAAC,WAAW,GAAG,eAAe;;;;"}
1
+ {"version":3,"file":"DropContainer-Cdusp6r1.js","sources":["../src/DropContainer.tsx"],"sourcesContent":["import { useRef, type PropsWithChildren, useEffect, useCallback, forwardRef } from 'react';\n\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { Divider } from '@hh.ru/magritte-ui-divider';\nimport type { DividerState } from '@hh.ru/magritte-ui-drop/types';\n\nimport styles from './drop.less';\n\nexport const DropContainer = forwardRef<\n HTMLDivElement,\n PropsWithChildren<{\n dividerState: DividerState;\n }>\n>(({ children, dividerState }, ref) => {\n const dividerRef = useRef<HTMLDivElement>(null);\n const showDividerRef = useRef(false);\n showDividerRef.current = dividerState !== 'hide';\n const contentContainerRef = useRef<HTMLDivElement>(null);\n const contentContainerRefMulti = useMultipleRefs(contentContainerRef, ref);\n\n const updateDividerVisibility = useCallback(\n (showDivider: boolean) => {\n if (!contentContainerRef.current || !dividerRef.current) {\n return;\n }\n if (!showDivider) {\n dividerRef.current.style.visibility = 'hidden';\n return;\n }\n if (contentContainerRef?.current !== null && dividerRef.current) {\n const hasScroll =\n contentContainerRef.current.scrollHeight - contentContainerRef.current.clientHeight > 0;\n dividerRef.current.style.visibility = hasScroll ? 'visible' : 'hidden';\n }\n },\n [contentContainerRef, dividerRef]\n );\n\n useEffect(() => {\n const observer = new ResizeObserver(() => {\n updateDividerVisibility(showDividerRef.current);\n });\n observer.observe(contentContainerRef.current as Element);\n return () => observer.disconnect();\n }, [updateDividerVisibility]);\n\n useEffect(() => {\n updateDividerVisibility(showDividerRef.current);\n // eslint-disable-next-line disable-autofix/react-hooks/exhaustive-deps\n }, [updateDividerVisibility, showDividerRef.current]);\n\n const props = showDividerRef.current\n ? {\n onScroll: ({ target }: { target: EventTarget }) => {\n const scrollableContainer = target as HTMLDivElement;\n\n if (dividerRef.current && dividerState !== 'showWhenFullyScrolled') {\n const scrollEnded =\n scrollableContainer.scrollTop +\n scrollableContainer.offsetHeight -\n scrollableContainer.scrollHeight ===\n 0;\n\n dividerRef.current.style.visibility = scrollEnded ? 'hidden' : 'visible';\n }\n },\n }\n : {};\n\n return (\n <>\n <div ref={contentContainerRefMulti} className={styles.dropContainer} {...props}>\n {children}\n </div>\n <div ref={dividerRef} className={styles.dividerContainer} data-qa=\"drop-divider\">\n <Divider />\n </div>\n </>\n );\n});\n\nDropContainer.displayName = 'DropContainer';\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;AAQO,MAAM,aAAa,GAAG,UAAU,CAKrC,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,GAAG,KAAI;AAClC,IAAA,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AAChD,IAAA,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AACrC,IAAA,cAAc,CAA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AAC,uBAAuB,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;AAEtD,IAAA,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO;AAChC,UAAE;AACI,YAAA,QAAQ,EAAE,CAAC,EAAE,MAAM,EAA2B,KAAI;gBAC9C,MAAM,mBAAmB,GAAG,MAAwB,CAAC;gBAErD,IAAI,UAAU,CAAC,OAAO,IAAI,YAAY,KAAK,uBAAuB,EAAE;AAChE,oBAAA,MAAM,WAAW,GACb,mBAAmB,CAAC,SAAS;AACzB,wBAAA,mBAAmB,CAAC,YAAY;AAChC,wBAAA,mBAAmB,CAAC,YAAY;AACpC,wBAAA,CAAC,CAAC;AAEN,oBAAA,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;iBAC5E;aACJ;AACJ,SAAA;UACD,EAAE,CAAC;AAET,IAAA,QACIA,IACI,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CAAAC,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,CAAC,aAAa,EAAA,GAAM,KAAK,EAAA,QAAA,EACzE,QAAQ,EACP,CAAA,EACNA,GAAK,CAAA,KAAA,EAAA,EAAA,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,gBAAgB,EAAU,SAAA,EAAA,cAAc,YAC5EA,GAAC,CAAA,OAAO,KAAG,EACT,CAAA,CAAA,EAAA,CACP,EACL;AACN,CAAC,EAAE;AAEH,aAAa,CAAC,WAAW,GAAG,eAAe;;;;"}
package/DropContainer.js CHANGED
@@ -3,5 +3,5 @@ import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import '@hh.ru/magritte-common-use-multiple-refs';
5
5
  import '@hh.ru/magritte-ui-divider';
6
- export { D as DropContainer } from './DropContainer-B4bDnL97.js';
6
+ export { D as DropContainer } from './DropContainer-Cdusp6r1.js';
7
7
  //# sourceMappingURL=DropContainer.js.map