{"version":3,"file":"Drawer.mjs","names":[],"sources":["../../../src/drawer/Drawer.tsx"],"sourcesContent":["/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n  FloatingFocusManager,\n  FloatingOverlay,\n  FloatingPortal,\n  useDismiss,\n  useFloating,\n  useInteractions,\n  useMergeRefs,\n  useRole,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { Resizable, type ResizableProps } from 're-resizable';\nimport type React from 'react';\nimport {\n  type ComponentProps,\n  useCallback,\n  useEffect,\n  useMemo,\n  useRef,\n  useState,\n} from 'react';\n\nimport {\n  type HtmlAttributes,\n  type PolymorphicCommonProps,\n} from '../_common/types';\nimport { needleWarningMessage } from '../_common/utils';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n\ntype DrawerPosition = 'left' | 'right';\n\ntype DrawerType = 'overlay' | 'push' | 'modal';\n\n/**\n * @remarks\n * Where `ResizableProps` is the props for the `re-resizable` library. For more information, see the [re-resizable documentation](https://github.com/bokuweb/re-resizable).\n *\n * @remarks\n * Where `FloatingPortalProps` is the props for the `@floating-ui/react` library. For more information, see the [FloatingPortal documentation](https://floating-ui.com/docs/floatingportal).\n */\ntype DrawerProps = {\n  /** Controls whether the drawer is open (expanded) or closed (collapsed). */\n  isExpanded: boolean;\n\n  /** Callback fired when the drawer's expanded state changes (close button, Escape, click outside, or programmatic change). */\n  onExpandedChange?: (expanded: boolean) => void;\n\n  /** Position where the drawer appears on screen. By default, it appears from the left. */\n  position?: DrawerPosition;\n\n  /** How the drawer affects the layout of sibling content. By default, it overlays content. */\n  type?: DrawerType;\n\n  /** Enables horizontal resizing of the drawer, by default it is not resizable. */\n  isResizeable?: boolean;\n\n  /** To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable\n   * The property enable has default values set for bottom, bottomLeft etc based on the position prop.\n   */\n  resizeableProps?: ResizableProps;\n\n  /** Whether a close button (X) is displayed in the drawer. */\n  isCloseable?: boolean;\n\n  /** Whether to portal the content. Only applies when type is \"overlay\". Type \"modal\" is always portaled. */\n  isPortaled?: boolean;\n\n  /**\n   * Whether pressing Escape closes the drawer. Should be set to true for overlay drawers.\n   * - When type is \"modal\", this defaults to true.\n   * - When type is \"overlay\", this defaults to true.\n   * - When type is \"push\", no effect.\n   */\n  shouldCloseOnEscape?: boolean;\n\n  // TODO: this should maybe be default on overlay in the future.\n  /**\n   * When type is \"overlay\", whether clicking outside the drawer closes it. Should be set to true for overlay drawers.\n   * - When type is \"overlay\" or \"modal\", this defaults to false.\n   * - When type is \"push\", no effect.\n   */\n  shouldCloseOnClickOutside?: boolean;\n\n  /** The content to display within the drawer. */\n  children: React.ReactNode;\n\n  /**\n   * Props to pass to the portal from `@floating-ui/react` FloatingPortal\n   * Only applies when type is \"overlay\" and isPortaled is true, or if type is \"modal\".\n   * @see https://floating-ui.com/docs/floatingportal\n   */\n  portalProps?: ComponentProps<typeof FloatingPortal>;\n} & (\n  | {\n      // `type` is optional on this branch so that omitting it types as 'overlay' which matches the default value and requires `ariaLabel`.\n      type?: 'modal' | 'overlay';\n      /** The aria-label to apply to the drawer. Required for accessibility when type is \"modal\" or \"overlay\". */\n      ariaLabel: string;\n    }\n  | {\n      type: 'push';\n      ariaLabel?: string;\n    }\n);\n\nconst KEYBOARD_RESIZE_STEP_PX = 16;\n\nfunction parsePixelSize(\n  value: string | number | undefined,\n): number | undefined {\n  if (value === undefined) {\n    return undefined;\n  }\n  if (typeof value === 'number') {\n    return value;\n  }\n  if (/^\\d+(\\.\\d+)?px$/i.test(value)) {\n    return parseFloat(value);\n  }\n  return undefined;\n}\n\nfunction parsePercentage(\n  value: string | number | undefined,\n  referenceWidth: number | undefined,\n): number | undefined {\n  if (\n    typeof value !== 'string' ||\n    !value.endsWith('%') ||\n    referenceWidth === undefined\n  ) {\n    return undefined;\n  }\n  const percent = parseFloat(value);\n  return Number.isNaN(percent) ? undefined : (percent / 100) * referenceWidth;\n}\n\ntype DrawerResizeHandleProps = {\n  /** Which edge this handle resizes (right = drawer’s right edge, left = drawer’s left edge). */\n  handleSide: 'left' | 'right';\n  /** Called with a pixel delta to apply to the drawer width (positive = wider). */\n  onResizeBy: (delta: number) => void;\n  onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;\n  /** Current width in pixels (for aria-valuenow). */\n  valueNow?: number;\n  /** Minimum width in pixels (for aria-valuemin). */\n  valueMin?: number;\n  /** Maximum width in pixels (for aria-valuemax). */\n  valueMax?: number;\n};\n\nfunction DrawerResizeHandle({\n  handleSide,\n  onResizeBy,\n  valueMax,\n  valueMin,\n  valueNow,\n}: DrawerResizeHandleProps) {\n  const handleKeyDown = useCallback(\n    (event: React.KeyboardEvent<HTMLDivElement>) => {\n      const isArrowKey =\n        event.key === 'ArrowLeft' || event.key === 'ArrowRight';\n      if (isArrowKey) {\n        event.preventDefault();\n        const delta =\n          handleSide === 'right'\n            ? event.key === 'ArrowRight'\n              ? KEYBOARD_RESIZE_STEP_PX\n              : -KEYBOARD_RESIZE_STEP_PX\n            : event.key === 'ArrowLeft'\n              ? KEYBOARD_RESIZE_STEP_PX\n              : -KEYBOARD_RESIZE_STEP_PX;\n        onResizeBy(delta);\n      }\n    },\n    [handleSide, onResizeBy],\n  );\n\n  return (\n    /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- Resize handle is focusable for keyboard resize. */\n    <div\n      aria-label={`Resize drawer with arrow keys. Handle on ${handleSide}.`}\n      aria-orientation=\"vertical\"\n      aria-valuemax={valueMax}\n      aria-valuemin={valueMin}\n      aria-valuenow={valueNow ?? 0}\n      aria-valuetext={`drawer width ${valueNow ?? 0}px`}\n      className=\"ndl-drawer-resize-handle\"\n      data-drawer-handle={handleSide}\n      onKeyDown={handleKeyDown}\n      role=\"separator\"\n      style={{ height: '100%', width: '100%' }}\n      // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- Resize handle is focusable for keyboard resize.\n      tabIndex={0}\n    />\n  );\n}\n\nconst DrawerComponent = function DrawerComponent<\n  T extends React.ElementType = 'div',\n>({\n  children,\n  className = '',\n  isExpanded,\n  onExpandedChange,\n  position = 'left',\n  type = 'overlay',\n  isResizeable = false,\n  resizeableProps,\n  isCloseable = true,\n  isPortaled = false,\n  portalProps = {},\n  shouldCloseOnEscape = type === 'push' ? false : true,\n  shouldCloseOnClickOutside = false,\n  ariaLabel,\n  htmlAttributes,\n  style,\n  ref,\n  as,\n  ...restProps\n}: PolymorphicCommonProps<T, DrawerProps>) {\n  const resizableRef = useRef<Resizable | null>(null);\n  const [resizeWidth, setResizeWidth] = useState<number>(0);\n\n  if ((type === 'modal' || type === 'overlay') && !ariaLabel) {\n    needleWarningMessage(\n      'A Drawer should have an aria-label when type is \"modal\" or \"overlay\" to be accessible.',\n    );\n  }\n\n  const { refs, context } = useFloating({\n    onOpenChange: onExpandedChange,\n    open: isExpanded,\n  });\n\n  /** Dismiss (escape + click outside) applies to portaled overlay and to non-portaled overlay. */\n  const shouldUseDismiss =\n    type === 'modal' ||\n    (type === 'overlay' && !isPortaled && isExpanded) ||\n    (type === 'overlay' && isPortaled);\n\n  const dismiss = useDismiss(context, {\n    enabled: shouldUseDismiss,\n    escapeKey: shouldCloseOnEscape && type !== 'push',\n    outsidePress: shouldCloseOnClickOutside && type !== 'push',\n  });\n  const role = useRole(context, {\n    enabled: type === 'modal' || type === 'overlay',\n    role: 'dialog',\n  });\n  const { getFloatingProps } = useInteractions([dismiss, role]);\n\n  const resizableMergedRef = useMergeRefs([resizableRef, ref]);\n\n  const handleResizeBy = useCallback(\n    (delta: number) => {\n      if (!resizableRef.current) {\n        return;\n      }\n      const current = resizableRef.current.size;\n      const parentWidth =\n        resizableRef.current.resizable?.parentElement?.offsetWidth;\n      const min =\n        parsePixelSize(resizeableProps?.minWidth) ??\n        parsePercentage(resizeableProps?.minWidth, parentWidth);\n      const max =\n        parsePixelSize(resizeableProps?.maxWidth) ??\n        parsePercentage(resizeableProps?.maxWidth, parentWidth);\n      const newWidth = Math.max(\n        min ?? 0,\n        Math.min(max ?? Number.POSITIVE_INFINITY, current.width + delta),\n      );\n      resizableRef.current.updateSize({\n        height: '100%',\n        width: newWidth,\n      });\n      setResizeWidth(newWidth);\n    },\n    [resizeableProps?.minWidth, resizeableProps?.maxWidth],\n  );\n\n  const handleResize = useCallback(\n    (\n      event: MouseEvent | TouchEvent,\n      direction: Parameters<NonNullable<ResizableProps['onResize']>>[1],\n      elementRef: HTMLElement,\n      delta: { width: number; height: number },\n    ) => {\n      setResizeWidth(elementRef.offsetWidth);\n      resizeableProps?.onResize?.(event, direction, elementRef, delta);\n    },\n    [resizeableProps],\n  );\n\n  useEffect(() => {\n    if (!isResizeable || !resizableRef.current) {\n      return;\n    }\n    const width = resizableRef.current.size.width;\n    if (width > 0) {\n      setResizeWidth(width);\n    }\n  }, [isResizeable]);\n\n  const classes = classNames('ndl-drawer', className, {\n    'ndl-drawer-expanded': isExpanded,\n    'ndl-drawer-left': position === 'left',\n    'ndl-drawer-modal': type === 'modal',\n    'ndl-drawer-overlay': type === 'overlay',\n    'ndl-drawer-portaled': isPortaled && type === 'overlay',\n    'ndl-drawer-push': type === 'push',\n    'ndl-drawer-right': position === 'right',\n  });\n\n  const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';\n  const Component = as ?? 'div';\n\n  const handleClose = useCallback(() => {\n    onExpandedChange?.(false);\n  }, [onExpandedChange]);\n\n  const closeButton = useMemo(\n    () =>\n      isCloseable || type === 'modal' ? (\n        <CleanIconButton\n          className=\"ndl-drawer-close-button\"\n          onClick={handleClose}\n          description={null}\n          size=\"medium\"\n          htmlAttributes={{\n            'aria-label': 'Close',\n          }}\n        >\n          <XMarkIconOutline />\n        </CleanIconButton>\n      ) : null,\n    [handleClose, isCloseable, type],\n  );\n\n  const resizableContent = (\n    <Resizable\n      as={Component}\n      defaultSize={{\n        height: '100%',\n        width: 'auto',\n      }}\n      {...resizeableProps}\n      className={classes}\n      style={{\n        position: resizableStylePosition,\n        ...style,\n        ...resizeableProps?.style,\n      }}\n      boundsByDirection={true}\n      bounds={resizeableProps?.bounds ?? 'parent'}\n      handleStyles={{\n        /*\n         * Small offset so the handle is easier to hit when the drawer content is scrollable.\n         */\n        ...(position === 'left' && { right: { right: '-8px' } }),\n        ...(position === 'right' && { left: { left: '-8px' } }),\n      }}\n      enable={{\n        bottom: false,\n        bottomLeft: false,\n        bottomRight: false,\n        left: position === 'right',\n        right: position === 'left',\n        top: false,\n        topLeft: false,\n        topRight: false,\n      }}\n      handleComponent={\n        position === 'left'\n          ? {\n              right: (\n                <DrawerResizeHandle\n                  handleSide=\"right\"\n                  onResizeBy={handleResizeBy}\n                  valueMax={parsePixelSize(resizeableProps?.maxWidth)}\n                  valueMin={parsePixelSize(resizeableProps?.minWidth)}\n                  valueNow={resizeWidth}\n                />\n              ),\n            }\n          : {\n              left: (\n                <DrawerResizeHandle\n                  handleSide=\"left\"\n                  onResizeBy={handleResizeBy}\n                  valueMax={parsePixelSize(resizeableProps?.maxWidth)}\n                  valueMin={parsePixelSize(resizeableProps?.minWidth)}\n                  valueNow={resizeWidth}\n                />\n              ),\n            }\n      }\n      onResize={handleResize}\n      ref={resizableMergedRef}\n      {...restProps}\n      {...htmlAttributes}\n    >\n      {closeButton}\n      {children}\n    </Resizable>\n  );\n\n  const regularContent = (\n    <Component\n      className={classNames(classes)}\n      style={style}\n      ref={ref}\n      {...restProps}\n      {...htmlAttributes}\n    >\n      {closeButton}\n      {children}\n    </Component>\n  );\n\n  /** what content to render */\n  const content = isResizeable ? resizableContent : regularContent;\n\n  // const floatingRefs = useMergeRefs([refs.setFloating, refs.setReference]);\n\n  /** modal behavior */\n  if (type === 'modal' && isExpanded) {\n    return (\n      <FloatingPortal {...portalProps}>\n        <FloatingOverlay\n          className=\"ndl-drawer-overlay-root\"\n          lockScroll={true}\n        />\n        <FloatingFocusManager context={context} modal={true} returnFocus={true}>\n          <div\n            ref={refs.setFloating}\n            {...getFloatingProps()}\n            aria-label={ariaLabel}\n            aria-modal=\"true\"\n          >\n            {content}\n          </div>\n        </FloatingFocusManager>\n      </FloatingPortal>\n    );\n  }\n\n  if (type === 'overlay' && isExpanded) {\n    return (\n      <ConditionalWrap\n        shouldWrap={isPortaled}\n        wrap={(wrapChildren) => (\n          <FloatingPortal preserveTabOrder={true} {...portalProps}>\n            {wrapChildren}\n          </FloatingPortal>\n        )}\n      >\n        <FloatingFocusManager\n          disabled={!isExpanded}\n          context={context}\n          modal={true}\n          returnFocus={true}\n        >\n          <div\n            ref={refs.setFloating}\n            {...getFloatingProps()}\n            aria-label={ariaLabel}\n            aria-modal=\"true\"\n          >\n            {content}\n          </div>\n        </FloatingFocusManager>\n      </ConditionalWrap>\n    );\n  }\n\n  return content;\n};\n\nDrawerComponent.displayName = 'Drawer';\n\ntype DrawerHeaderProps = {\n  children: React.ReactNode;\n};\n\nconst DrawerHeader = <T extends React.ElementType = 'div'>({\n  as,\n  children,\n  className = '',\n  style,\n  htmlAttributes,\n  ref,\n  ...restProps\n}: PolymorphicCommonProps<T, DrawerHeaderProps>) => {\n  const classes = classNames('ndl-drawer-header', className);\n  const Component: React.ElementType = as ?? 'div';\n\n  if (typeof children === 'string' || typeof children === 'number') {\n    return (\n      <Typography\n        as={Component}\n        className={classes}\n        ref={ref}\n        style={style}\n        variant=\"title-3\"\n        {...restProps}\n        {...htmlAttributes}\n      >\n        {children}\n      </Typography>\n    );\n  }\n\n  return (\n    <Component\n      className={classes}\n      ref={ref}\n      style={style}\n      {...restProps}\n      {...htmlAttributes}\n    >\n      {children}\n    </Component>\n  );\n};\n\ntype DrawerActionsProps = {\n  children: React.ReactNode;\n  className?: string;\n  htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerActions = ({\n  children,\n  className = '',\n  htmlAttributes,\n  ...restProps\n}: DrawerActionsProps) => {\n  const classes = classNames('ndl-drawer-actions', className);\n\n  return (\n    <div className={classes} {...restProps} {...htmlAttributes}>\n      {children}\n    </div>\n  );\n};\n\ntype DrawerBodyProps = {\n  children: React.ReactNode;\n  className?: string;\n  htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerBody = ({\n  children,\n  className = '',\n  htmlAttributes,\n  ...restProps\n}: DrawerBodyProps) => {\n  const classes = classNames('ndl-drawer-body', className);\n\n  return (\n    <div className=\"ndl-drawer-body-wrapper\">\n      <div className={classes} {...restProps} {...htmlAttributes}>\n        {children}\n      </div>\n    </div>\n  );\n};\n\nconst Drawer = Object.assign(DrawerComponent, {\n  Actions: DrawerActions,\n  Body: DrawerBody,\n  Header: DrawerHeader,\n});\n\nexport { Drawer };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgOE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA4QA;CACA;CACA;CACA;CACA;CACA;;;CA0CA;CACA;CACA;;;CAmBA;CACA;CACA;;AAncF,MAAM,0BAA0B;AAEhC,SAAS,eACP,OACoB;CACpB,IAAI,UAAU,KAAA,GACZ;CAEF,IAAI,OAAO,UAAU,UACnB,OAAO;CAET,IAAI,mBAAmB,KAAK,KAAK,GAC/B,OAAO,WAAW,KAAK;AAG3B;AAEA,SAAS,gBACP,OACA,gBACoB;CACpB,IACE,OAAO,UAAU,YACjB,CA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