@hh.ru/magritte-ui-drop 12.2.7 → 12.3.1

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
@@ -4,7 +4,7 @@ import { forwardRef, useState, useRef, useEffect, useCallback, cloneElement } fr
4
4
  import { usePlacement, DropBase } from '@hh.ru/magritte-internal-drop-base';
5
5
  import { isActionBarComponent } from '@hh.ru/magritte-ui-action-bar';
6
6
  import { useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';
7
- import { s as styles, D as DropContainer } from './DropContainer-DjZXAOhn.js';
7
+ import { s as styles, D as DropContainer } from './DropContainer-BsCBPTyL.js';
8
8
  import { Layer } from '@hh.ru/magritte-ui-layer';
9
9
  import 'classnames';
10
10
  import '@hh.ru/magritte-common-use-multiple-refs';
@@ -115,7 +115,7 @@ const DropComponent = ({ visible, activatorRef, onClose, maxWidth = 320, minHeig
115
115
  Top: paddingFooterTop,
116
116
  Bottom: paddingFooterBottom,
117
117
  });
118
- return (jsx(Layer, { layer: "drop", children: jsx(DropBase, { ...props, visible: visible, placement: placementsList, activatorRef: activatorRef, closeByClickOutside: closeByClickOutside, onClose: onClose, autoFocusWhenOpened: autoFocusWhenOpened ?? role !== 'status', animationClassNames: {
118
+ return (jsx(Layer, { layer: "drop", children: jsx(DropBase, { ...props, role: role, visible: visible, placement: placementsList, activatorRef: activatorRef, closeByClickOutside: closeByClickOutside, onClose: onClose, autoFocusWhenOpened: autoFocusWhenOpened ?? role !== 'status', animationClassNames: {
119
119
  enter: styles.dropEnter,
120
120
  enterActive: styles.dropEnterActive,
121
121
  exit: styles.dropExit,
package/Drop.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Drop.js","sources":["src/Drop.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type FocusEvent,\n type ForwardedRef,\n type ReactElement,\n type RefObject,\n cloneElement,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { DropBase, type Placement, usePlacement } from '@hh.ru/magritte-internal-drop-base';\nimport { isActionBarComponent } from '@hh.ru/magritte-ui-action-bar';\nimport { useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';\nimport { DropContainer } from '@hh.ru/magritte-ui-drop/DropContainer';\nimport type { DropProps, DropPadding } from '@hh.ru/magritte-ui-drop/types';\nimport { Layer } from '@hh.ru/magritte-ui-layer';\n\nimport styles from './drop.less';\n\nconst AVAILABLE_PLACEMENTS_LIST: Set<Placement> = new Set([\n 'left-top',\n 'left-bottom',\n 'right-top',\n 'right-bottom',\n 'top-left',\n 'top-right',\n 'bottom-left',\n 'bottom-right',\n]);\n\nconst genPaddingProps = (paddingProps: {\n Left?: DropPadding;\n Right?: DropPadding;\n Top?: DropPadding;\n Bottom?: DropPadding;\n}) =>\n Object.entries(paddingProps).reduce<Record<string, number>>(\n (acc, [key, value]) => (value !== undefined ? { ...acc, [`padding${key}`]: value } : acc),\n {}\n );\n\nconst isKeyboardInput = (element: HTMLElement): boolean => {\n const tagName = element.tagName.toLowerCase();\n const keyboardInputTypes = ['text', 'password', 'email', 'number', 'tel', 'url', 'search'];\n return (\n (tagName === 'input' && keyboardInputTypes.includes((element as HTMLInputElement).type)) ||\n tagName === 'textarea' ||\n element.hasAttribute('contenteditable')\n );\n};\n\nconst DropComponent = (\n {\n visible,\n activatorRef,\n onClose,\n maxWidth = 320,\n minHeight = 200,\n width,\n children,\n footer,\n role = 'dialog',\n showDivider = 'with-scroll',\n widthEqualToActivator = false,\n allowShrinkHeightToFitIntoViewport = true,\n autoFocusWhenOpened,\n closeByClickOutside = true,\n 'data-qa': dataQA = 'drop',\n onAppear,\n onBeforeExit,\n onAfterExit: _onAfterExit,\n placement,\n forcePlacement,\n ignoreIntersections,\n lockPlacement = false,\n padding = 24,\n paddingLeft,\n paddingRight,\n paddingTop,\n paddingBottom,\n paddingFooter,\n paddingFooterLeft,\n paddingFooterRight,\n paddingFooterBottom,\n paddingFooterTop,\n keyboardNavigationMode = 'loop',\n returnFocusOnClose = true,\n ...props\n }: DropProps,\n ref: ForwardedRef<HTMLElement>\n): ReactElement | null => {\n const { isMobile } = useBreakpoint();\n const [animationTimeout, setAnimationTimeout] = useState(200);\n const [isPlacementLockedByFocus, setPlacementLockedByFocus] = useState(false);\n const forceUpdateDropMetricsRef = useRef<VoidFunction>();\n\n const actualIgnoreIntersections =\n ignoreIntersections === undefined ? !allowShrinkHeightToFitIntoViewport : ignoreIntersections;\n\n const placementsList = usePlacement(placement as Placement, AVAILABLE_PLACEMENTS_LIST, !!forcePlacement);\n\n useEffect(() => {\n const animationTimeoutElement = document.createElement('div');\n animationTimeoutElement.classList.add(styles.dropAnimationTimeout);\n document.body.appendChild(animationTimeoutElement);\n const style = window.getComputedStyle(animationTimeoutElement);\n const animationTimeout = parseInt(style.getPropertyValue(`--animation-duration`), 10);\n if (Number.isInteger(animationTimeout)) {\n setAnimationTimeout(animationTimeout);\n }\n document.body.removeChild(animationTimeoutElement);\n }, []);\n\n useEffect(() => {\n forceUpdateDropMetricsRef.current?.();\n }, [\n maxWidth,\n padding,\n paddingLeft,\n paddingRight,\n paddingTop,\n paddingBottom,\n paddingFooter,\n paddingFooterLeft,\n paddingFooterRight,\n paddingFooterTop,\n paddingFooterBottom,\n footer,\n ]);\n\n const focusHandler = (event: Event | FocusEvent) => {\n const target = event.target;\n if (!target || !isKeyboardInput(target as HTMLElement)) {\n return;\n }\n setPlacementLockedByFocus(true);\n };\n const blurHandler = () => setPlacementLockedByFocus(false);\n\n useEffect(() => {\n if (!visible || isMobile || !activatorRef.current) {\n return void 0;\n }\n\n const activatorElement = activatorRef.current;\n activatorElement.addEventListener('focus', focusHandler);\n activatorElement.addEventListener('blur', blurHandler);\n return () => {\n activatorElement.removeEventListener('focus', focusHandler);\n activatorElement.removeEventListener('blur', blurHandler);\n };\n }, [visible, activatorRef, isMobile]);\n\n const onAfterExit = useCallback(() => {\n if (returnFocusOnClose && activatorRef.current !== null && document.contains(activatorRef.current)) {\n activatorRef.current.focus();\n }\n _onAfterExit?.();\n }, [returnFocusOnClose, activatorRef, _onAfterExit]);\n\n if (isMobile) {\n return null;\n }\n\n let widthStyle: CSSProperties;\n if (widthEqualToActivator) {\n widthStyle = { width: '100%' };\n } else {\n widthStyle = width ? { width } : { maxWidth };\n }\n\n let currentPaddingBottom = paddingBottom;\n if (footer && currentPaddingBottom === undefined) {\n currentPaddingBottom = 0;\n }\n\n const contentPaddingProps = genPaddingProps({\n Left: paddingLeft,\n Right: paddingRight,\n Top: paddingTop,\n Bottom: currentPaddingBottom,\n });\n\n const footerPaddingProps = genPaddingProps({\n Left: paddingFooterLeft,\n Right: paddingFooterRight,\n Top: paddingFooterTop,\n Bottom: paddingFooterBottom,\n });\n\n return (\n <Layer layer=\"drop\">\n <DropBase\n {...props}\n visible={visible}\n placement={placementsList}\n activatorRef={activatorRef}\n closeByClickOutside={closeByClickOutside}\n onClose={onClose}\n autoFocusWhenOpened={autoFocusWhenOpened ?? role !== 'status'}\n animationClassNames={{\n enter: styles.dropEnter,\n enterActive: styles.dropEnterActive,\n exit: styles.dropExit,\n exitActive: styles.dropExitActive,\n }}\n animationTimeout={animationTimeout}\n widthEqualToActivator={widthEqualToActivator}\n allowShrinkHeightToFitIntoViewport={allowShrinkHeightToFitIntoViewport}\n ignoreIntersections={actualIgnoreIntersections}\n minHeight={minHeight}\n ref={ref}\n onAppear={onAppear}\n onBeforeExit={onBeforeExit}\n onAfterExit={onAfterExit}\n forceDropMetricsUpdate={forceUpdateDropMetricsRef as RefObject<VoidFunction>}\n lockPlacement={isPlacementLockedByFocus || lockPlacement}\n keyboardNavigationMode={keyboardNavigationMode}\n >\n {(resizeRefCallbackFactory) => (\n <div\n className={styles.drop}\n style={widthStyle}\n data-qa={dataQA}\n key=\"drop-outer-container\"\n onFocus={focusHandler}\n onBlur={blurHandler}\n >\n <DropContainer\n key=\"drop-container\"\n showDivider={footer ? showDivider : false}\n ref={resizeRefCallbackFactory('scroll-container', false, true)}\n padding={{ padding, ...contentPaddingProps }}\n withFooter={Boolean(footer)}\n >\n <div ref={resizeRefCallbackFactory('drop-content')}>{children}</div>\n </DropContainer>\n {footer && (\n <div\n ref={resizeRefCallbackFactory('drop-footer')}\n data-qa=\"drop-footer\"\n style={{ padding: paddingFooter ?? padding, ...footerPaddingProps }}\n >\n {isActionBarComponent(footer)\n ? cloneElement(footer, {\n type: footer.props.type || 'vertical',\n padding: footer.props.padding || 0,\n showDivider: false,\n })\n : footer}\n </div>\n )}\n <div className={styles.dropBorder} />\n </div>\n )}\n </DropBase>\n </Layer>\n );\n};\n\nconst Drop = forwardRef<HTMLElement, DropProps>(DropComponent);\nexport { Drop };\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;AAuBA,MAAM,yBAAyB,GAAmB,IAAI,GAAG,CAAC;IACtD,UAAU;IACV,aAAa;IACb,WAAW;IACX,cAAc;IACd,UAAU;IACV,WAAW;IACX,aAAa;IACb,cAAc;AACjB,CAAA,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,CAAC,YAKxB,KACG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,MAAM,CAC/B,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,KAAK,KAAK,SAAS,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC,CAAU,OAAA,EAAA,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,GAAG,CAAC,EACzF,EAAE,CACL,CAAC;AAEN,MAAM,eAAe,GAAG,CAAC,OAAoB,KAAa;IACtD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;AAC9C,IAAA,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC3F,IAAA,QACI,CAAC,OAAO,KAAK,OAAO,IAAI,kBAAkB,CAAC,QAAQ,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sBAAsB,CA6BxB,CACT,EACM,CAAA,EAAA,CACP,EACV;AACN,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,UAAU,CAAyB,aAAa;;;;"}
1
+ {"version":3,"file":"Drop.js","sources":["src/Drop.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type FocusEvent,\n type ForwardedRef,\n type ReactElement,\n type RefObject,\n cloneElement,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { DropBase, type Placement, usePlacement } from '@hh.ru/magritte-internal-drop-base';\nimport { isActionBarComponent } from '@hh.ru/magritte-ui-action-bar';\nimport { useBreakpoint } from '@hh.ru/magritte-ui-breakpoint';\nimport { DropContainer } from '@hh.ru/magritte-ui-drop/DropContainer';\nimport type { DropProps, DropPadding } from '@hh.ru/magritte-ui-drop/types';\nimport { Layer } from '@hh.ru/magritte-ui-layer';\n\nimport styles from './drop.less';\n\nconst AVAILABLE_PLACEMENTS_LIST: Set<Placement> = new Set([\n 'left-top',\n 'left-bottom',\n 'right-top',\n 'right-bottom',\n 'top-left',\n 'top-right',\n 'bottom-left',\n 'bottom-right',\n]);\n\nconst genPaddingProps = (paddingProps: {\n Left?: DropPadding;\n Right?: DropPadding;\n Top?: DropPadding;\n Bottom?: DropPadding;\n}) =>\n Object.entries(paddingProps).reduce<Record<string, number>>(\n (acc, [key, value]) => (value !== undefined ? { ...acc, [`padding${key}`]: value } : acc),\n {}\n );\n\nconst isKeyboardInput = (element: HTMLElement): boolean => {\n const tagName = element.tagName.toLowerCase();\n const keyboardInputTypes = ['text', 'password', 'email', 'number', 'tel', 'url', 'search'];\n return (\n (tagName === 'input' && keyboardInputTypes.includes((element as HTMLInputElement).type)) ||\n tagName === 'textarea' ||\n element.hasAttribute('contenteditable')\n );\n};\n\nconst DropComponent = (\n {\n visible,\n activatorRef,\n onClose,\n maxWidth = 320,\n minHeight = 200,\n width,\n children,\n footer,\n role = 'dialog',\n showDivider = 'with-scroll',\n widthEqualToActivator = false,\n allowShrinkHeightToFitIntoViewport = true,\n autoFocusWhenOpened,\n closeByClickOutside = true,\n 'data-qa': dataQA = 'drop',\n onAppear,\n onBeforeExit,\n onAfterExit: _onAfterExit,\n placement,\n forcePlacement,\n ignoreIntersections,\n lockPlacement = false,\n padding = 24,\n paddingLeft,\n paddingRight,\n paddingTop,\n paddingBottom,\n paddingFooter,\n paddingFooterLeft,\n paddingFooterRight,\n paddingFooterBottom,\n paddingFooterTop,\n keyboardNavigationMode = 'loop',\n returnFocusOnClose = true,\n ...props\n }: DropProps,\n ref: ForwardedRef<HTMLElement>\n): ReactElement | null => {\n const { isMobile } = useBreakpoint();\n const [animationTimeout, setAnimationTimeout] = useState(200);\n const [isPlacementLockedByFocus, setPlacementLockedByFocus] = useState(false);\n const forceUpdateDropMetricsRef = useRef<VoidFunction>();\n\n const actualIgnoreIntersections =\n ignoreIntersections === undefined ? !allowShrinkHeightToFitIntoViewport : ignoreIntersections;\n\n const placementsList = usePlacement(placement as Placement, AVAILABLE_PLACEMENTS_LIST, !!forcePlacement);\n\n useEffect(() => {\n const animationTimeoutElement = document.createElement('div');\n animationTimeoutElement.classList.add(styles.dropAnimationTimeout);\n document.body.appendChild(animationTimeoutElement);\n const style = window.getComputedStyle(animationTimeoutElement);\n const animationTimeout = parseInt(style.getPropertyValue(`--animation-duration`), 10);\n if (Number.isInteger(animationTimeout)) {\n setAnimationTimeout(animationTimeout);\n }\n document.body.removeChild(animationTimeoutElement);\n }, []);\n\n useEffect(() => {\n forceUpdateDropMetricsRef.current?.();\n }, [\n maxWidth,\n padding,\n paddingLeft,\n paddingRight,\n paddingTop,\n paddingBottom,\n paddingFooter,\n paddingFooterLeft,\n paddingFooterRight,\n paddingFooterTop,\n paddingFooterBottom,\n footer,\n ]);\n\n const focusHandler = (event: Event | FocusEvent) => {\n const target = event.target;\n if (!target || !isKeyboardInput(target as HTMLElement)) {\n return;\n }\n setPlacementLockedByFocus(true);\n };\n const blurHandler = () => setPlacementLockedByFocus(false);\n\n useEffect(() => {\n if (!visible || isMobile || !activatorRef.current) {\n return void 0;\n }\n\n const activatorElement = activatorRef.current;\n activatorElement.addEventListener('focus', focusHandler);\n activatorElement.addEventListener('blur', blurHandler);\n return () => {\n activatorElement.removeEventListener('focus', focusHandler);\n activatorElement.removeEventListener('blur', blurHandler);\n };\n }, [visible, activatorRef, isMobile]);\n\n const onAfterExit = useCallback(() => {\n if (returnFocusOnClose && activatorRef.current !== null && document.contains(activatorRef.current)) {\n activatorRef.current.focus();\n }\n _onAfterExit?.();\n }, [returnFocusOnClose, activatorRef, _onAfterExit]);\n\n if (isMobile) {\n return null;\n }\n\n let widthStyle: CSSProperties;\n if (widthEqualToActivator) {\n widthStyle = { width: '100%' };\n } else {\n widthStyle = width ? { width } : { maxWidth };\n }\n\n let currentPaddingBottom = paddingBottom;\n if (footer && currentPaddingBottom === undefined) {\n currentPaddingBottom = 0;\n }\n\n const contentPaddingProps = genPaddingProps({\n Left: paddingLeft,\n Right: paddingRight,\n Top: paddingTop,\n Bottom: currentPaddingBottom,\n });\n\n const footerPaddingProps = genPaddingProps({\n Left: paddingFooterLeft,\n Right: paddingFooterRight,\n Top: paddingFooterTop,\n Bottom: paddingFooterBottom,\n });\n\n return (\n <Layer layer=\"drop\">\n <DropBase\n {...props}\n role={role}\n visible={visible}\n placement={placementsList}\n activatorRef={activatorRef}\n closeByClickOutside={closeByClickOutside}\n onClose={onClose}\n autoFocusWhenOpened={autoFocusWhenOpened ?? role !== 'status'}\n animationClassNames={{\n enter: styles.dropEnter,\n enterActive: styles.dropEnterActive,\n exit: styles.dropExit,\n exitActive: styles.dropExitActive,\n }}\n animationTimeout={animationTimeout}\n widthEqualToActivator={widthEqualToActivator}\n allowShrinkHeightToFitIntoViewport={allowShrinkHeightToFitIntoViewport}\n ignoreIntersections={actualIgnoreIntersections}\n minHeight={minHeight}\n ref={ref}\n onAppear={onAppear}\n onBeforeExit={onBeforeExit}\n onAfterExit={onAfterExit}\n forceDropMetricsUpdate={forceUpdateDropMetricsRef as RefObject<VoidFunction>}\n lockPlacement={isPlacementLockedByFocus || lockPlacement}\n keyboardNavigationMode={keyboardNavigationMode}\n >\n {(resizeRefCallbackFactory) => (\n <div\n className={styles.drop}\n style={widthStyle}\n data-qa={dataQA}\n key=\"drop-outer-container\"\n onFocus={focusHandler}\n onBlur={blurHandler}\n >\n <DropContainer\n key=\"drop-container\"\n showDivider={footer ? showDivider : false}\n ref={resizeRefCallbackFactory('scroll-container', false, true)}\n padding={{ padding, ...contentPaddingProps }}\n withFooter={Boolean(footer)}\n >\n <div ref={resizeRefCallbackFactory('drop-content')}>{children}</div>\n </DropContainer>\n {footer && (\n <div\n ref={resizeRefCallbackFactory('drop-footer')}\n data-qa=\"drop-footer\"\n style={{ padding: paddingFooter ?? padding, ...footerPaddingProps }}\n >\n {isActionBarComponent(footer)\n ? cloneElement(footer, {\n type: footer.props.type || 'vertical',\n padding: footer.props.padding || 0,\n showDivider: false,\n })\n : footer}\n </div>\n )}\n <div className={styles.dropBorder} />\n </div>\n )}\n </DropBase>\n </Layer>\n );\n};\n\nconst Drop = forwardRef<HTMLElement, DropProps>(DropComponent);\nexport { Drop };\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;AAuBA,MAAM,yBAAyB,GAAmB,IAAI,GAAG,CAAC;IACtD,UAAU;IACV,aAAa;IACb,WAAW;IACX,cAAc;IACd,UAAU;IACV,WAAW;IACX,aAAa;IACb,cAAc;AACjB,CAAA,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,CAAC,YAKxB,KACG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,MAAM,CAC/B,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,KAAK,KAAK,SAAS,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC,CAAU,OAAA,EAAA,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,GAAG,CAAC,EACzF,EAAE,CACL,CAAC;AAEN,MAAM,eA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A,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,IAAI,UAAU;AACrC,gCAAA,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC;AAClC,gCAAA,WAAW,EAAE,KAAK;6BACrB,CAAC;AACJ,8BAAE,MAAM,EAAA,CACV,CACT,EACDA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,MAAM,CAAC,UAAU,EAAA,CAAI,KA5BjC,sBAAsB,CA6BxB,CACT,EACM,CAAA,EAAA,CACP,EACV;AACN,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,UAAU,CAAyB,aAAa;;;;"}
@@ -6,7 +6,7 @@ import { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';
6
6
  import { Divider } from '@hh.ru/magritte-ui-divider';
7
7
  import { useScrollbar, Scrollbar } from '@hh.ru/magritte-ui-scrollbar';
8
8
 
9
- var styles = {"drop":"magritte-drop___Z10P4_12-2-7","drop-border":"magritte-drop-border___UDWjW_12-2-7","dropBorder":"magritte-drop-border___UDWjW_12-2-7","drop-container-wrapper":"magritte-drop-container-wrapper___o-ySf_12-2-7","dropContainerWrapper":"magritte-drop-container-wrapper___o-ySf_12-2-7","drop-container-wrapper-with-footer":"magritte-drop-container-wrapper-with-footer___-6tNU_12-2-7","dropContainerWrapperWithFooter":"magritte-drop-container-wrapper-with-footer___-6tNU_12-2-7","drop-container":"magritte-drop-container___dbMt9_12-2-7","dropContainer":"magritte-drop-container___dbMt9_12-2-7","divider-container":"magritte-divider-container___ZCdDW_12-2-7","dividerContainer":"magritte-divider-container___ZCdDW_12-2-7","drop-enter":"magritte-drop-enter___4vEuH_12-2-7","dropEnter":"magritte-drop-enter___4vEuH_12-2-7","drop-exit":"magritte-drop-exit___brFjz_12-2-7","dropExit":"magritte-drop-exit___brFjz_12-2-7","drop-enter-active":"magritte-drop-enter-active___SQUog_12-2-7","dropEnterActive":"magritte-drop-enter-active___SQUog_12-2-7","drop-exit-active":"magritte-drop-exit-active___GB0ET_12-2-7","dropExitActive":"magritte-drop-exit-active___GB0ET_12-2-7","drop-animation-timeout":"magritte-drop-animation-timeout___uO7LF_12-2-7","dropAnimationTimeout":"magritte-drop-animation-timeout___uO7LF_12-2-7"};
9
+ var styles = {"drop":"magritte-drop___Z10P4_12-3-1","drop-border":"magritte-drop-border___UDWjW_12-3-1","dropBorder":"magritte-drop-border___UDWjW_12-3-1","drop-container-wrapper":"magritte-drop-container-wrapper___o-ySf_12-3-1","dropContainerWrapper":"magritte-drop-container-wrapper___o-ySf_12-3-1","drop-container-wrapper-with-footer":"magritte-drop-container-wrapper-with-footer___-6tNU_12-3-1","dropContainerWrapperWithFooter":"magritte-drop-container-wrapper-with-footer___-6tNU_12-3-1","drop-container":"magritte-drop-container___dbMt9_12-3-1","dropContainer":"magritte-drop-container___dbMt9_12-3-1","divider-container":"magritte-divider-container___ZCdDW_12-3-1","dividerContainer":"magritte-divider-container___ZCdDW_12-3-1","drop-enter":"magritte-drop-enter___4vEuH_12-3-1","dropEnter":"magritte-drop-enter___4vEuH_12-3-1","drop-exit":"magritte-drop-exit___brFjz_12-3-1","dropExit":"magritte-drop-exit___brFjz_12-3-1","drop-enter-active":"magritte-drop-enter-active___SQUog_12-3-1","dropEnterActive":"magritte-drop-enter-active___SQUog_12-3-1","drop-exit-active":"magritte-drop-exit-active___GB0ET_12-3-1","dropExitActive":"magritte-drop-exit-active___GB0ET_12-3-1","drop-animation-timeout":"magritte-drop-animation-timeout___uO7LF_12-3-1","dropAnimationTimeout":"magritte-drop-animation-timeout___uO7LF_12-3-1"};
10
10
 
11
11
  const DropContainer = forwardRef(({ children, showDivider, padding, withFooter }, ref) => {
12
12
  const dividerRef = useRef(null);
@@ -60,4 +60,4 @@ const DropContainer = forwardRef(({ children, showDivider, padding, withFooter }
60
60
  DropContainer.displayName = 'DropContainer';
61
61
 
62
62
  export { DropContainer as D, styles as s };
63
- //# sourceMappingURL=DropContainer-DjZXAOhn.js.map
63
+ //# sourceMappingURL=DropContainer-BsCBPTyL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropContainer-DjZXAOhn.js","sources":["src/DropContainer.tsx"],"sourcesContent":["import { useRef, type PropsWithChildren, useEffect, useCallback, forwardRef, CSSProperties } from 'react';\nimport classnames from 'classnames';\n\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { Divider, type ShowDivider } from '@hh.ru/magritte-ui-divider';\nimport { Scrollbar, useScrollbar } from '@hh.ru/magritte-ui-scrollbar';\n\nimport styles from './drop.less';\n\nexport const DropContainer = forwardRef<\n HTMLDivElement,\n PropsWithChildren<{\n showDivider: ShowDivider;\n padding: CSSProperties;\n withFooter: boolean;\n }>\n>(({ children, showDivider, padding, withFooter }, ref) => {\n const dividerRef = useRef<HTMLDivElement>(null);\n const showDividerRef = useRef(showDivider);\n showDividerRef.current = showDivider;\n const contentContainerRef = useRef<HTMLDivElement>(null);\n const { hasVerticalScroll, verticalScrollbarProps, ...scrollbar } = useScrollbar({ axis: 'vertical' });\n const contentContainerRefMulti = useMultipleRefs(contentContainerRef, ref, scrollbar.scrollContainerRef);\n\n const updateDividerVisibility = useCallback(\n (showDivider: ShowDivider) => {\n const scrollableContainer = contentContainerRef.current;\n const divider = dividerRef.current;\n if (!scrollableContainer || !divider) {\n return;\n }\n\n if (showDivider === 'always') {\n divider.style.visibility = 'visible';\n }\n\n if (showDivider === 'with-scroll') {\n const isNotScrolledToEnd =\n scrollableContainer.scrollHeight - scrollableContainer.scrollTop > scrollableContainer.offsetHeight;\n divider.style.visibility = isNotScrolledToEnd ? 'visible' : 'hidden';\n }\n\n if (showDivider === false) {\n divider.style.visibility = '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 =\n showDividerRef.current === 'with-scroll'\n ? {\n onScroll: ({ target }: { target: EventTarget }) => {\n const scrollableContainer = target as HTMLDivElement;\n\n if (dividerRef.current) {\n const isNotScrolledToEnd =\n scrollableContainer.scrollHeight - scrollableContainer.scrollTop >\n scrollableContainer.offsetHeight;\n dividerRef.current.style.visibility = isNotScrolledToEnd ? 'visible' : 'hidden';\n }\n },\n }\n : {};\n\n return (\n <>\n <div\n className={classnames(\n styles.dropContainerWrapper,\n { [styles.dropContainerWrapperWithFooter]: withFooter },\n scrollbar.hoverContainerCssClass\n )}\n >\n <div ref={contentContainerRefMulti} className={styles.dropContainer} {...props} style={padding}>\n {children}\n </div>\n {hasVerticalScroll && <Scrollbar {...verticalScrollbarProps} />}\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":";;;;;;;;;AASa,MAAA,aAAa,GAAG,UAAU,CAOrC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,GAAG,KAAI;AACtD,IAAA,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AAChD,IAAA,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAC3C,IAAA,cAAc,CAAC,OAAO,GAAG,WAAW,CAAC;AACrC,IAAA,MAAM,mBAAmB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AACzD,IAAA,MAAM,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,GAAG,SAAS,EAAE,GAAG,YAAY,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;AACvG,IAAA,MAAM,wBAAwB,GAAG,eAAe,CAAC,mBAAmB,E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CACP,EACL;AACN,CAAC,EAAE;AAEH,aAAa,CAAC,WAAW,GAAG,eAAe;;;;"}
1
+ {"version":3,"file":"DropContainer-BsCBPTyL.js","sources":["src/DropContainer.tsx"],"sourcesContent":["import { useRef, type PropsWithChildren, useEffect, useCallback, forwardRef, CSSProperties } from 'react';\nimport classnames from 'classnames';\n\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { Divider, type ShowDivider } from '@hh.ru/magritte-ui-divider';\nimport { Scrollbar, useScrollbar } from '@hh.ru/magritte-ui-scrollbar';\n\nimport styles from './drop.less';\n\nexport const DropContainer = forwardRef<\n HTMLDivElement,\n PropsWithChildren<{\n showDivider: ShowDivider;\n padding: CSSProperties;\n withFooter: boolean;\n }>\n>(({ children, showDivider, padding, withFooter }, ref) => {\n const dividerRef = useRef<HTMLDivElement>(null);\n const showDividerRef = useRef(showDivider);\n showDividerRef.current = showDivider;\n const contentContainerRef = useRef<HTMLDivElement>(null);\n const { hasVerticalScroll, verticalScrollbarProps, ...scrollbar } = useScrollbar({ axis: 'vertical' });\n const contentContainerRefMulti = useMultipleRefs(contentContainerRef, ref, scrollbar.scrollContainerRef);\n\n const updateDividerVisibility = useCallback(\n (showDivider: ShowDivider) => {\n const scrollableContainer = contentContainerRef.current;\n const divider = dividerRef.current;\n if (!scrollableContainer || !divider) {\n return;\n }\n\n if (showDivider === 'always') {\n divider.style.visibility = 'visible';\n }\n\n if (showDivider === 'with-scroll') {\n const isNotScrolledToEnd =\n scrollableContainer.scrollHeight - scrollableContainer.scrollTop > scrollableContainer.offsetHeight;\n divider.style.visibility = isNotScrolledToEnd ? 'visible' : 'hidden';\n }\n\n if (showDivider === false) {\n divider.style.visibility = '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 =\n showDividerRef.current === 'with-scroll'\n ? {\n onScroll: ({ target }: { target: EventTarget }) => {\n const scrollableContainer = target as HTMLDivElement;\n\n if (dividerRef.current) {\n const isNotScrolledToEnd =\n scrollableContainer.scrollHeight - scrollableContainer.scrollTop >\n scrollableContainer.offsetHeight;\n dividerRef.current.style.visibility = isNotScrolledToEnd ? 'visible' : 'hidden';\n }\n },\n }\n : {};\n\n return (\n <>\n <div\n className={classnames(\n styles.dropContainerWrapper,\n { [styles.dropContainerWrapperWithFooter]: withFooter },\n scrollbar.hoverContainerCssClass\n )}\n >\n <div ref={contentContainerRefMulti} className={styles.dropContainer} {...props} style={padding}>\n {children}\n </div>\n {hasVerticalScroll && <Scrollbar {...verticalScrollbarProps} />}\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":";;;;;;;;;AASa,MAAA,aAAa,GAAG,UAAU,CAOrC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,GAAG,KAAI;AACtD,IAAA,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AAChD,IAAA,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAC3C,IAAA,cAAc,CAAC,OAAO,GAAG,WAAW,CAAC;AACrC,IAAA,MAAM,mBAAmB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;AACzD,IAAA,MAAM,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,GAAG,SAAS,EAAE,GAAG,YAAY,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;AACvG,IAAA,MAAM,wBAAwB,GAAG,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ACT,CAAA,CAAA,EAAA,CACP,EACL;AACN,CAAC,EAAE;AAEH,aAAa,CAAC,WAAW,GAAG,eAAe;;;;"}
package/DropContainer.js CHANGED
@@ -5,5 +5,5 @@ import 'classnames';
5
5
  import '@hh.ru/magritte-common-use-multiple-refs';
6
6
  import '@hh.ru/magritte-ui-divider';
7
7
  import '@hh.ru/magritte-ui-scrollbar';
8
- export { D as DropContainer } from './DropContainer-DjZXAOhn.js';
8
+ export { D as DropContainer } from './DropContainer-BsCBPTyL.js';
9
9
  //# sourceMappingURL=DropContainer.js.map
package/index.css CHANGED
@@ -19,7 +19,7 @@
19
19
  --magritte-color-component-drop-background-content-v24-5-0:#1B1B1B;
20
20
  --magritte-shadow-level-2-color-v24-5-0:#0000003d;
21
21
  }
22
- .magritte-drop___Z10P4_12-2-7{
22
+ .magritte-drop___Z10P4_12-3-1{
23
23
  position:relative;
24
24
  display:flex;
25
25
  flex-direction:column;
@@ -30,7 +30,7 @@
30
30
  height:100%;
31
31
  overflow:hidden;
32
32
  }
33
- .magritte-drop-border___UDWjW_12-2-7{
33
+ .magritte-drop-border___UDWjW_12-3-1{
34
34
  box-shadow:inset 0 0 0 1px var(--magritte-color-stroke-neutral-v24-5-0);
35
35
  position:absolute;
36
36
  border-radius:24px;
@@ -38,16 +38,16 @@
38
38
  inset:0;
39
39
  z-index:1;
40
40
  }
41
- .magritte-drop-container-wrapper___o-ySf_12-2-7{
41
+ .magritte-drop-container-wrapper___o-ySf_12-3-1{
42
42
  position:relative;
43
43
  overflow:hidden;
44
44
  --magritte-ui-scrollbar-border-radius:24px;
45
45
  }
46
- .magritte-drop-container-wrapper-with-footer___-6tNU_12-2-7{
46
+ .magritte-drop-container-wrapper-with-footer___-6tNU_12-3-1{
47
47
  --magritte-ui-scrollbar-border-bottom-left-radius:0;
48
48
  --magritte-ui-scrollbar-border-bottom-right-radius:0;
49
49
  }
50
- .magritte-drop-container___dbMt9_12-2-7{
50
+ .magritte-drop-container___dbMt9_12-3-1{
51
51
  width:100%;
52
52
  height:100%;
53
53
  box-sizing:border-box;
@@ -55,74 +55,74 @@
55
55
  overscroll-behavior:contain;
56
56
  scrollbar-width:none;
57
57
  }
58
- .magritte-drop-container___dbMt9_12-2-7::-webkit-scrollbar{
58
+ .magritte-drop-container___dbMt9_12-3-1::-webkit-scrollbar{
59
59
  display:none;
60
60
  }
61
- .magritte-divider-container___ZCdDW_12-2-7{
61
+ .magritte-divider-container___ZCdDW_12-3-1{
62
62
  visibility:hidden;
63
63
  }
64
64
  @media (prefers-reduced-motion: no-preference){
65
- .magritte-drop-enter___4vEuH_12-2-7 .magritte-drop___Z10P4_12-2-7{
65
+ .magritte-drop-enter___4vEuH_12-3-1 .magritte-drop___Z10P4_12-3-1{
66
66
  opacity:0;
67
67
  }
68
- .magritte-drop-exit___brFjz_12-2-7 .magritte-drop___Z10P4_12-2-7,
69
- .magritte-drop-enter-active___SQUog_12-2-7 .magritte-drop___Z10P4_12-2-7{
68
+ .magritte-drop-exit___brFjz_12-3-1 .magritte-drop___Z10P4_12-3-1,
69
+ .magritte-drop-enter-active___SQUog_12-3-1 .magritte-drop___Z10P4_12-3-1{
70
70
  opacity:1;
71
71
  }
72
- .magritte-drop-exit-active___GB0ET_12-2-7 .magritte-drop___Z10P4_12-2-7{
72
+ .magritte-drop-exit-active___GB0ET_12-3-1 .magritte-drop___Z10P4_12-3-1{
73
73
  opacity:0;
74
74
  }
75
- .magritte-drop-animation-timeout___uO7LF_12-2-7,
76
- .magritte-drop-enter-active___SQUog_12-2-7 .magritte-drop___Z10P4_12-2-7{
75
+ .magritte-drop-animation-timeout___uO7LF_12-3-1,
76
+ .magritte-drop-enter-active___SQUog_12-3-1 .magritte-drop___Z10P4_12-3-1{
77
77
  transition-property:opacity, transform;
78
78
  transition-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v24-5-0);
79
79
  transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v24-5-0);
80
80
  --animation-duration:var(--magritte-semantic-animation-ease-in-out-200-duration-v24-5-0);
81
81
  }
82
- .magritte-drop-animation-timeout___uO7LF_12-2-7,
83
- .magritte-drop-exit-active___GB0ET_12-2-7 .magritte-drop___Z10P4_12-2-7{
82
+ .magritte-drop-animation-timeout___uO7LF_12-3-1,
83
+ .magritte-drop-exit-active___GB0ET_12-3-1 .magritte-drop___Z10P4_12-3-1{
84
84
  transition-property:opacity, transform;
85
85
  transition-duration:var(--magritte-semantic-animation-ease-in-out-100-duration-v24-5-0);
86
86
  transition-timing-function:var(--magritte-semantic-animation-ease-in-out-200-timing-function-v24-5-0);
87
87
  }
88
- .magritte-drop-enter___4vEuH_12-2-7[data-magritte-drop-base-direction='top'] .magritte-drop___Z10P4_12-2-7{
88
+ .magritte-drop-enter___4vEuH_12-3-1[data-magritte-drop-base-direction='top'] .magritte-drop___Z10P4_12-3-1{
89
89
  transform:translateY(-4px);
90
90
  }
91
- .magritte-drop-exit-active___GB0ET_12-2-7[data-magritte-drop-base-direction='top'] .magritte-drop___Z10P4_12-2-7{
91
+ .magritte-drop-exit-active___GB0ET_12-3-1[data-magritte-drop-base-direction='top'] .magritte-drop___Z10P4_12-3-1{
92
92
  transform:translateY(-4px);
93
93
  }
94
- .magritte-drop-enter___4vEuH_12-2-7[data-magritte-drop-base-direction='bottom'] .magritte-drop___Z10P4_12-2-7{
94
+ .magritte-drop-enter___4vEuH_12-3-1[data-magritte-drop-base-direction='bottom'] .magritte-drop___Z10P4_12-3-1{
95
95
  transform:translateY(4px);
96
96
  }
97
- .magritte-drop-exit-active___GB0ET_12-2-7[data-magritte-drop-base-direction='bottom'] .magritte-drop___Z10P4_12-2-7{
97
+ .magritte-drop-exit-active___GB0ET_12-3-1[data-magritte-drop-base-direction='bottom'] .magritte-drop___Z10P4_12-3-1{
98
98
  transform:translateY(4px);
99
99
  }
100
- .magritte-drop-enter___4vEuH_12-2-7[data-magritte-drop-base-direction='left'] .magritte-drop___Z10P4_12-2-7{
100
+ .magritte-drop-enter___4vEuH_12-3-1[data-magritte-drop-base-direction='left'] .magritte-drop___Z10P4_12-3-1{
101
101
  transform:translateX(-4px);
102
102
  }
103
- .magritte-drop-exit-active___GB0ET_12-2-7[data-magritte-drop-base-direction='left'] .magritte-drop___Z10P4_12-2-7{
103
+ .magritte-drop-exit-active___GB0ET_12-3-1[data-magritte-drop-base-direction='left'] .magritte-drop___Z10P4_12-3-1{
104
104
  transform:translateX(4px);
105
105
  }
106
- .magritte-drop-enter___4vEuH_12-2-7[data-magritte-drop-base-direction='right'] .magritte-drop___Z10P4_12-2-7{
106
+ .magritte-drop-enter___4vEuH_12-3-1[data-magritte-drop-base-direction='right'] .magritte-drop___Z10P4_12-3-1{
107
107
  transform:translateX(4px);
108
108
  }
109
- .magritte-drop-exit-active___GB0ET_12-2-7[data-magritte-drop-base-direction='right'] .magritte-drop___Z10P4_12-2-7{
109
+ .magritte-drop-exit-active___GB0ET_12-3-1[data-magritte-drop-base-direction='right'] .magritte-drop___Z10P4_12-3-1{
110
110
  transform:translateX(4px);
111
111
  }
112
- .magritte-drop-exit___brFjz_12-2-7[data-magritte-drop-base-direction='left'] .magritte-drop___Z10P4_12-2-7,
113
- .magritte-drop-enter-active___SQUog_12-2-7[data-magritte-drop-base-direction='left'] .magritte-drop___Z10P4_12-2-7{
112
+ .magritte-drop-exit___brFjz_12-3-1[data-magritte-drop-base-direction='left'] .magritte-drop___Z10P4_12-3-1,
113
+ .magritte-drop-enter-active___SQUog_12-3-1[data-magritte-drop-base-direction='left'] .magritte-drop___Z10P4_12-3-1{
114
114
  transform:translateX(0%);
115
115
  }
116
- .magritte-drop-exit___brFjz_12-2-7[data-magritte-drop-base-direction='bottom'] .magritte-drop___Z10P4_12-2-7,
117
- .magritte-drop-enter-active___SQUog_12-2-7[data-magritte-drop-base-direction='bottom'] .magritte-drop___Z10P4_12-2-7{
116
+ .magritte-drop-exit___brFjz_12-3-1[data-magritte-drop-base-direction='bottom'] .magritte-drop___Z10P4_12-3-1,
117
+ .magritte-drop-enter-active___SQUog_12-3-1[data-magritte-drop-base-direction='bottom'] .magritte-drop___Z10P4_12-3-1{
118
118
  transform:translateY(0%);
119
119
  }
120
- .magritte-drop-exit___brFjz_12-2-7[data-magritte-drop-base-direction='right'] .magritte-drop___Z10P4_12-2-7,
121
- .magritte-drop-enter-active___SQUog_12-2-7[data-magritte-drop-base-direction='right'] .magritte-drop___Z10P4_12-2-7{
120
+ .magritte-drop-exit___brFjz_12-3-1[data-magritte-drop-base-direction='right'] .magritte-drop___Z10P4_12-3-1,
121
+ .magritte-drop-enter-active___SQUog_12-3-1[data-magritte-drop-base-direction='right'] .magritte-drop___Z10P4_12-3-1{
122
122
  transform:translateX(0%);
123
123
  }
124
- .magritte-drop-exit___brFjz_12-2-7[data-magritte-drop-base-direction='top'] .magritte-drop___Z10P4_12-2-7,
125
- .magritte-drop-enter-active___SQUog_12-2-7[data-magritte-drop-base-direction='top'] .magritte-drop___Z10P4_12-2-7{
124
+ .magritte-drop-exit___brFjz_12-3-1[data-magritte-drop-base-direction='top'] .magritte-drop___Z10P4_12-3-1,
125
+ .magritte-drop-enter-active___SQUog_12-3-1[data-magritte-drop-base-direction='top'] .magritte-drop___Z10P4_12-3-1{
126
126
  transform:translateY(0%);
127
127
  }
128
128
  }
package/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from '@hh.ru/magritte-ui-drop/Drop';
2
- export type { DropProps } from '@hh.ru/magritte-ui-drop/types';
2
+ export type { DropProps, DropRole } from '@hh.ru/magritte-ui-drop/types';
package/index.js CHANGED
@@ -5,7 +5,7 @@ import 'react';
5
5
  import '@hh.ru/magritte-internal-drop-base';
6
6
  import '@hh.ru/magritte-ui-action-bar';
7
7
  import '@hh.ru/magritte-ui-breakpoint';
8
- import './DropContainer-DjZXAOhn.js';
8
+ import './DropContainer-BsCBPTyL.js';
9
9
  import 'classnames';
10
10
  import '@hh.ru/magritte-common-use-multiple-refs';
11
11
  import '@hh.ru/magritte-ui-divider';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hh.ru/magritte-ui-drop",
3
- "version": "12.2.7",
3
+ "version": "12.3.1",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "sideEffects": [
@@ -21,9 +21,9 @@
21
21
  "dependencies": {
22
22
  "@hh.ru/magritte-common-use-multiple-refs": "1.1.11",
23
23
  "@hh.ru/magritte-design-tokens": "24.5.0",
24
- "@hh.ru/magritte-internal-drop-base": "7.1.20",
24
+ "@hh.ru/magritte-internal-drop-base": "7.2.0",
25
25
  "@hh.ru/magritte-internal-layer-name": "3.4.1",
26
- "@hh.ru/magritte-ui-action-bar": "5.3.8",
26
+ "@hh.ru/magritte-ui-action-bar": "5.3.9",
27
27
  "@hh.ru/magritte-ui-breakpoint": "6.0.8",
28
28
  "@hh.ru/magritte-ui-divider": "3.0.19",
29
29
  "@hh.ru/magritte-ui-layer": "3.2.2",
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "0d147efb00e0803c03ee0ac99525211ce44788e1"
39
+ "gitHead": "e019f700cfff466975b65b96124aaac592268720"
40
40
  }
package/types.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { Placement, DropBasePermanentProps } from '@hh.ru/magritte-internal
3
3
  import type { ShowDivider } from '@hh.ru/magritte-ui-divider';
4
4
  export type DropPlacement = Omit<Placement, 'top-center' | 'bottom-center' | 'left-center' | 'right-center'>;
5
5
  export type DropPadding = 0 | 12 | 16 | 24;
6
+ export type DropRole = Extract<React.AriaRole, 'alertdialog' | 'combobox' | 'dialog' | 'listbox' | 'menu' | 'menubar' | 'status'>;
6
7
  export interface DropPropsOnly {
7
8
  /** Показывать ли разделитель между дропом и футером */
8
9
  showDivider?: ShowDivider;
@@ -13,7 +14,7 @@ export interface DropPropsOnly {
13
14
  /** Минимальная высота Drop */
14
15
  minHeight?: number;
15
16
  /** Роли для доступности */
16
- role?: Extract<React.AriaRole, 'alertdialog' | 'combobox' | 'dialog' | 'listbox' | 'menu' | 'menubar' | 'status'>;
17
+ role?: DropRole;
17
18
  /** Содержимое нижнего контейнера */
18
19
  footer?: ReactNode;
19
20
  /** Размер паддинга */