{"version":3,"file":"Tabs.mjs","names":[],"sources":["../../../src/tabs/Tabs.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 { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport React, {\n  useCallback,\n  useContext,\n  useEffect,\n  useRef,\n  useState,\n} from 'react';\n\nimport {\n  type CommonProps,\n  type PolymorphicCommonProps,\n  type TooltipObjectProps,\n} from '../_common/types';\nimport { ArrowLeftCircleIconOutline } from '../icons/generated/heroIcons/ArrowLeftCircleIconOutline';\nimport { ArrowRightCircleIconOutline } from '../icons/generated/heroIcons/ArrowRightCircleIconOutline';\nimport { Tooltip } from '../tooltip';\nimport { Typography } from '../typography';\nimport { useTabsScrollOverflow } from './use-tabs-scroll-overflow';\n\n// Reusable scroll button component\nconst ScrollButton = ({\n  direction,\n  isVisible,\n  onClick,\n  onBackground,\n}: {\n  direction: 'left' | 'right';\n  isVisible: boolean;\n  onClick: () => void;\n  onBackground: React.ComponentProps<typeof TabsComponent>['onBackground'];\n}) => {\n  const Icon =\n    direction === 'left'\n      ? ArrowLeftCircleIconOutline\n      : ArrowRightCircleIconOutline;\n  const positionClass =\n    direction === 'left' ? 'ndl-scroll-left-item' : 'ndl-scroll-right-item';\n\n  return (\n    <div\n      className={classNames('ndl-scroll-item', positionClass, {\n        'ndl-scroll-item-hidden': !isVisible,\n        'ndl-scroll-item-on-background-default': onBackground === 'default',\n        'ndl-scroll-item-on-background-weak': onBackground === 'weak',\n      })}\n    >\n      <button\n        type=\"button\"\n        tabIndex={-1}\n        className=\"ndl-scroll-icon-wrapper\"\n        onClick={onClick}\n        aria-hidden=\"true\"\n      >\n        <Icon className=\"ndl-scroll-icon\" />\n      </button>\n    </div>\n  );\n};\n\ntype TabId = string;\ntype Size = 'small' | 'large';\ntype Fill = 'underline' | 'filled';\n\ntype BaseTabsProps<T extends TabId> = {\n  /** The currently active tabId */\n  value: T;\n  /** Callback function triggered when a new tab is selected */\n  onChange: (event: T) => void;\n  /** The content dislayed in the tabs */\n  children: React.ReactNode | string;\n  /** The fill type of the tabs */\n  fill?: Fill;\n  /**  The size of the tabs */\n  size?: Size;\n  /** What background the Tabs is placed on. This affects the gradient background of the scroll navigation buttons. */\n  onBackground?: 'weak' | 'default';\n};\n\ntype TabsContextType<T extends TabId> = Required<\n  Pick<BaseTabsProps<T>, 'fill' | 'size' | 'onChange' | 'value'>\n> & {\n  registerTab: (tabId: T, ref: React.RefObject<HTMLElement | null>) => void;\n  unregisterTab: (tabId: T) => void;\n  scrollTabIntoView: (tabId: T) => void;\n  firstTabId: T | null;\n  isValuePresent: boolean;\n};\n\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nconst TabsContext = React.createContext<TabsContextType<any> | null>(null);\n\nconst useTabsContext = () => {\n  const context = useContext(TabsContext);\n\n  if (context === null) {\n    throw new Error('Tab used without context');\n  }\n\n  return context;\n};\n\nconst getTabPanelId = (tabId: TabId) => `tabpanel-${tabId}`;\n\nconst getGeneralTabClasses = (size: Size, fill: Fill) => {\n  return {\n    'ndl-filled-tab': fill === 'filled',\n    'ndl-large': size === 'large',\n    'ndl-small': size === 'small',\n    'ndl-underline-tab': fill === 'underline',\n  };\n};\n\nconst TabsComponent = <U extends TabId, T extends React.ElementType = 'div'>({\n  children,\n  size = 'large',\n  fill = 'underline',\n  onChange,\n  value,\n  onBackground = 'weak',\n  className,\n  style,\n  as,\n  htmlAttributes,\n  ref,\n  ...restProps\n}: PolymorphicCommonProps<T, BaseTabsProps<U>>) => {\n  const tabRefs = useRef<Map<U, React.RefObject<HTMLElement | null>>>(\n    new Map(),\n  );\n  const containerRef = useRef<HTMLElement>(null);\n  const scrollContainerRef = useRef<HTMLDivElement>(null);\n  const mergedRef = useMergeRefs([containerRef, ref]);\n  const [firstTabId, setFirstTabId] = useState<U | null>(null);\n  const [isValuePresent, setIsValuePresent] = useState(false);\n  const valueRef = useRef(value);\n\n  // Use the custom hook for scroll overflow behavior\n  const { scrollState, scrollToNextItem, checkOverflow } =\n    useTabsScrollOverflow(scrollContainerRef);\n\n  useEffect(() => {\n    valueRef.current = value;\n    setIsValuePresent(tabRefs.current.has(value));\n  }, [value]);\n\n  const registerTab = useCallback(\n    (tabId: U, tabRef: React.RefObject<HTMLElement | null>) => {\n      tabRefs.current.set(tabId, tabRef);\n      const first = tabRefs.current.keys().next().value ?? null;\n      setFirstTabId((prev) => (prev === first ? prev : first));\n\n      if (tabId === valueRef.current) {\n        setIsValuePresent(true);\n      }\n    },\n    [],\n  );\n\n  const unregisterTab = useCallback((tabId: U) => {\n    tabRefs.current.delete(tabId);\n    const first = tabRefs.current.keys().next().value ?? null;\n    setFirstTabId((prev) => (prev === first ? prev : first));\n\n    if (tabId === valueRef.current) {\n      setIsValuePresent(false);\n    }\n  }, []);\n\n  // Check overflow when children change\n  useEffect(() => {\n    checkOverflow();\n  }, [checkOverflow, children]);\n\n  const scrollTabIntoView = useCallback((tabId: U) => {\n    const tabRef = tabRefs.current.get(tabId);\n    const scrollContainer = scrollContainerRef.current;\n\n    if (tabRef?.current && scrollContainer) {\n      const tabRect = tabRef.current.getBoundingClientRect();\n      const containerRect = scrollContainer.getBoundingClientRect();\n      const containerCenter = containerRect.left + containerRect.width / 2;\n\n      const targetScrollLeft =\n        scrollContainer.scrollLeft +\n        (tabRect.left - containerCenter + tabRect.width / 2);\n\n      scrollContainer.scrollTo({\n        behavior: 'smooth',\n        left: targetScrollLeft,\n      });\n    }\n  }, []);\n\n  const handleKeyDown = useCallback(\n    (event: React.KeyboardEvent) => {\n      if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') {\n        return;\n      }\n\n      event.preventDefault();\n\n      const tabIds = Array.from(tabRefs.current.keys());\n      const focusedElement = document.activeElement;\n\n      // Find the currently focused tab\n      let currentIndex = -1;\n      for (let index = 0; index < tabIds.length; index++) {\n        const tabRef = tabRefs.current.get(tabIds[index]);\n        if (tabRef?.current === focusedElement) {\n          currentIndex = index;\n          break;\n        }\n      }\n\n      // If no tab is focused, focus the active tab. Or the first tab if the active tab is not present.\n      if (currentIndex === -1) {\n        const activeTabRef = tabRefs.current.get(value);\n        if (activeTabRef?.current) {\n          activeTabRef.current.focus();\n        } else if (!isValuePresent && firstTabId !== null) {\n          const firstTabRef = tabRefs.current.get(firstTabId);\n          if (firstTabRef?.current) {\n            firstTabRef.current.focus();\n          }\n        }\n        return;\n      }\n\n      let nextIndex: number;\n\n      if (event.key === 'ArrowRight') {\n        nextIndex = currentIndex === tabIds.length - 1 ? 0 : currentIndex + 1;\n      } else {\n        nextIndex = currentIndex === 0 ? tabIds.length - 1 : currentIndex - 1;\n      }\n\n      const nextTabId = tabIds[nextIndex];\n      const nextTabRef = tabRefs.current.get(nextTabId);\n\n      if (nextTabRef?.current) {\n        nextTabRef.current.focus();\n        scrollTabIntoView(nextTabId);\n      }\n    },\n    [value, scrollTabIntoView, firstTabId, isValuePresent],\n  );\n\n  const classes = classNames(\n    'ndl-tabs',\n    getGeneralTabClasses(size, fill),\n    className,\n  );\n\n  const Component: React.ElementType = as ?? 'div';\n\n  return (\n    <Component\n      className={classes}\n      style={style}\n      role=\"tablist\"\n      aria-orientation=\"horizontal\"\n      onKeyDown={handleKeyDown}\n      ref={mergedRef}\n      {...restProps}\n      {...htmlAttributes}\n    >\n      <ScrollButton\n        direction=\"left\"\n        isVisible={scrollState.isLeftVisible}\n        onClick={() => scrollToNextItem('left')}\n        onBackground={onBackground}\n      />\n      <ScrollButton\n        direction=\"right\"\n        isVisible={scrollState.isRightVisible}\n        onClick={() => scrollToNextItem('right')}\n        onBackground={onBackground}\n      />\n      <TabsContext.Provider\n        value={{\n          fill,\n          firstTabId,\n          isValuePresent,\n          onChange,\n          registerTab,\n          scrollTabIntoView,\n          size,\n          unregisterTab,\n          value,\n        }}\n      >\n        <div className=\"ndl-tabs-container\" ref={scrollContainerRef}>\n          {children}\n        </div>\n      </TabsContext.Provider>\n    </Component>\n  );\n};\n\nTabsComponent.displayName = 'Tabs';\n\n/**\n * @remarks\n * When the `description` prop is set, hovering over the tab will show a tooltip with the text provided in the `description` prop. `tooltipProps` can be used to customize the tooltip appearance. The `TooltipObjectProps` type is defined as: `{ root?: Partial<React.ComponentProps<typeof Tooltip>>; trigger?: Partial<React.ComponentProps<typeof Tooltip.Trigger>>; content?: Partial<React.ComponentProps<typeof Tooltip.Content>>; }`, see the Tooltip component for more details.\n */\ntype TabProps<T extends TabId> = {\n  /** The id of the tab */\n  id: T;\n  /** The content of the tab */\n  children: React.ReactNode | string;\n  /** A string that will be shown as a tooltip when hovering over the button  it also acts as an aria-label- {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label} */\n  description?: string;\n  /** Props for the tooltip component. */\n  tooltipProps?: TooltipObjectProps;\n  /** Trailing content that will be rendered after the tab content. Badges belong here. */\n  trailingContent?: React.ReactNode;\n  /** Additional class name */\n  className?: string;\n  /** Whether the tab is disabled */\n  isDisabled?: boolean;\n};\n\nconst TabsTab = <\n  U extends TabId = TabId,\n  T extends React.ElementType = 'button',\n>({\n  children,\n  id: tabId,\n  isDisabled = false,\n  className,\n  description,\n  tooltipProps,\n  style,\n  as,\n  htmlAttributes,\n  ref,\n  trailingContent,\n  ...restProps\n}: PolymorphicCommonProps<T, TabProps<U>>) => {\n  const {\n    size,\n    fill,\n    value,\n    onChange,\n    registerTab,\n    unregisterTab,\n    scrollTabIntoView,\n    firstTabId,\n    isValuePresent,\n  } = useTabsContext();\n  const internalRef = useRef<HTMLElement>(null);\n\n  // Create a merged ref that handles both ref objects and ref functions\n  const mergedRef = useMergeRefs([\n    internalRef as React.RefObject<HTMLElement>,\n    ref as React.RefObject<HTMLElement>,\n  ]);\n\n  // Register/unregister tab for keyboard navigation\n  useEffect(() => {\n    registerTab(tabId, internalRef);\n\n    return () => {\n      unregisterTab(tabId);\n    };\n  }, [tabId, registerTab, unregisterTab]);\n\n  const baseClasses = classNames({\n    ...getGeneralTabClasses(size, fill),\n    'ndl-disabled': isDisabled,\n    'ndl-selected': value === tabId,\n  });\n\n  const Component: React.ElementType = as ?? 'button';\n\n  const classes = classNames('ndl-tab', baseClasses, className);\n\n  // Only the active tab should be in the tab sequence initially\n  // Other tabs can be focused via arrow keys but are not in tab sequence\n  const tabIndex =\n    value === tabId || (!isValuePresent && tabId === firstTabId) ? 0 : -1;\n\n  return (\n    <Tooltip\n      type=\"simple\"\n      {...tooltipProps?.root}\n      isDisabled={description === undefined}\n    >\n      <Tooltip.Trigger {...tooltipProps?.trigger} hasButtonWrapper>\n        <Component\n          className={classes}\n          style={style}\n          onClick={() => {\n            if (!isDisabled) {\n              onChange(tabId);\n              scrollTabIntoView(tabId);\n            }\n          }}\n          role=\"tab\"\n          id={tabId}\n          aria-disabled={isDisabled}\n          aria-label={description}\n          aria-selected={value === tabId}\n          aria-controls={getTabPanelId(tabId)}\n          tabIndex={tabIndex}\n          ref={mergedRef}\n          {...restProps}\n          {...htmlAttributes}\n        >\n          <span className=\"ndl-tab-content\">{children}</span>\n          {trailingContent}\n          {fill === 'underline' && <span className=\"ndl-tab-underline\" />}\n        </Component>\n      </Tooltip.Trigger>\n      <Tooltip.Content {...tooltipProps?.content}>\n        {description}\n      </Tooltip.Content>\n    </Tooltip>\n  );\n};\n\nTabsTab.displayName = 'Tabs.Tab';\n\ntype TabPanelProps = {\n  /** The content displayed in the tab panel */\n  children: React.ReactNode;\n  /** The currently selected tabId. The tab is visible if the value is equal to the tabId */\n  value: TabId;\n  /** The id of the tab panel */\n  tabId: TabId;\n  /** Additional class name */\n  className?: string;\n};\n\nconst TabsTabPanel = <T extends React.ElementType = 'div'>({\n  as,\n  children,\n  value,\n  tabId,\n  style,\n  className,\n  htmlAttributes,\n  ref,\n  ...restProps\n}: PolymorphicCommonProps<T, TabPanelProps>) => {\n  const Component: React.ElementType = as ?? 'div';\n\n  return (\n    <>\n      {value === tabId ? (\n        <Component\n          role=\"tabpanel\"\n          id={getTabPanelId(tabId)}\n          aria-labelledby={tabId}\n          style={style}\n          className={classNames(className)}\n          ref={ref}\n          {...restProps}\n          {...htmlAttributes}\n        >\n          {children}\n        </Component>\n      ) : null}\n    </>\n  );\n};\n\nTabsTabPanel.displayName = 'Tabs.TabPanel';\n\ntype TabBadgeProps = {\n  /** The content of the badge */\n  children: React.ReactNode;\n};\n\nconst TabBadge = ({\n  children,\n  ref,\n  htmlAttributes,\n  style,\n  className,\n  ...restProps\n}: CommonProps<'span', TabBadgeProps>) => {\n  const classes = classNames('ndl-tab-badge', className);\n  return (\n    <Typography\n      ref={ref}\n      variant=\"subheading-small\"\n      className={classes}\n      style={style}\n      htmlAttributes={htmlAttributes}\n      {...restProps}\n    >\n      {children}\n    </Typography>\n  );\n};\n\nconst Tabs = Object.assign(TabsComponent, {\n  Badge: TabBadge,\n  Tab: TabsTab,\n  TabPanel: TabsTabPanel,\n});\n\nexport { Tabs };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuIE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA2MA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CAmGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CAiCA;CACA;CACA;CACA;CACA;;AA3cF,MAAM,gBAAgB,EACpB,WACA,WACA,SACA,mBAMI;CACJ,MAAM,OACJ,cAAc,SACV,6BACA;CAIN,OACE,oBAAC,OAAD;EACE,WAAW,WAAW,mB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