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AW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,iBACA,6BACA,8BACA;YACE,wBAAwB;YACxB,CAAC,yBAAyB,EAAE,YAAY;YACxC,6BAA6B;QAC/B,GACA;QAEF,OAAO;QACP,eAAa,UAAU,YAAY;qBACnC,0DAAC,CAAA,GAAA,sCAAW;QACV,OAAO;YACL,MAAM;gBACJ,MAAM;gBACN,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;YACA,QAAQ;gBACN,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACrC;QACF;qBACA,0DAAC,CAAA,GAAA,gCAAK;QACH,GAAG,WAAW;QACf,IAAI;QACJ,OAAO;QACP,KAAK;QACL,SAAA;QACA,YAAY,CAAC,WAAW;QACxB,aAAa,MAAM,WAAW;QAC9B,cAAc,MAAM,YAAY;QAChC,mBAAmB,CAAA;YACjB,IAAI,OAAO,MACT,MAAM,cAAc,CAAC;QAEzB;QACA,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OACpC,CAAA,qBAAQ,0DAAC,CAAA,GAAA,4BAAG,GAAM,KAAK,KAAK,EAAG,KAAK,QAAQ,IAE9C,4BACC,0DAAC;QACC,aAAY;QACZ,aAAa;QACb,aAAa,MAAM,WAAW;;AAM1C","sources":["packages/@adobe/react-spectrum/src/tabs/Tabs.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n  AriaLabelingProps,\n  CollectionChildren,\n  DOMProps,\n  DOMRef,\n  DOMRefValue,\n  Key,\n  Node,\n  Orientation,\n  RefObject,\n  SingleSelection,\n  StyleProps\n} from '@react-types/shared';\nimport {AriaTabPanelProps, useTab, useTabList, useTabPanel} from 'react-aria/useTabList';\nimport {classNames} from '../utils/classNames';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {Item} from 'react-stately/Item';\nimport {ListCollection} from 'react-stately/private/list/ListCollection';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {Picker, SpectrumPickerProps} from '../picker/Picker';\nimport React, {\n  CSSProperties,\n  HTMLAttributes,\n  ReactElement,\n  ReactNode,\n  useCallback,\n  useContext,\n  useEffect,\n  useRef,\n  useState\n} from 'react';\nimport {SlotProvider} from '../utils/Slots';\nimport styles from '@adobe/spectrum-css-temp/components/tabs/vars.css';\nimport {TabListState, useTabListState} from 'react-stately/useTabListState';\nimport {Text} from '../text/Text';\nimport {unwrapDOMRef, useDOMRef} from '../utils/useDOMRef';\nimport {useCollection} from 'react-stately/private/collections/useCollection';\nimport {useHover} from 'react-aria/useHover';\nimport {useId} from 'react-aria/useId';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useProvider, useProviderProps} from '../provider/Provider';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\nimport {useStyleProps} from '../utils/styleProps';\n\nexport interface SpectrumTabsProps<T>\n  extends\n    Omit<\n      SingleSelection,\n      | 'onSelectionChange'\n      | 'disallowEmptySelection'\n      | 'selectedKey'\n      | 'defaultSelectedKey'\n      | 'onSelectionChange'\n    >,\n    AriaLabelingProps,\n    DOMProps,\n    StyleProps {\n  /** The children of the `<Tabs>` element. Should include `<TabList>` and `<TabPanels>` elements. */\n  children: ReactNode;\n  /** The item objects for each tab, for dynamic collections. */\n  items?: Iterable<T>;\n  /**\n   * The keys of the tabs that are disabled. These tabs cannot be selected, focused, or otherwise\n   * interacted with.\n   */\n  disabledKeys?: Iterable<Key>;\n  /** Whether the Tabs are disabled. */\n  isDisabled?: boolean;\n  /** Whether the tabs are displayed in a quiet style. */\n  isQuiet?: boolean;\n  /** Whether the tabs are displayed in an emphasized style. */\n  isEmphasized?: boolean;\n  /** The amount of space between the tabs. */\n  density?: 'compact' | 'regular';\n  /** The currently selected key in the collection (controlled). */\n  selectedKey?: Key;\n  /** The initial selected keys in the collection (uncontrolled). */\n  defaultSelectedKey?: Key;\n  /** Handler that is called when the selection changes. */\n  onSelectionChange?: (key: Key) => void;\n  /**\n   * Whether tabs are activated automatically on focus or manually.\n   *\n   * @default 'automatic'\n   */\n  keyboardActivation?: 'automatic' | 'manual';\n  /**\n   * The orientation of the tabs.\n   *\n   * @default 'horizontal'\n   */\n  orientation?: Orientation;\n}\n\ninterface TabsContext<T> {\n  tabProps: SpectrumTabsProps<T>;\n  tabState: {\n    tabListState: TabListState<T> | null;\n    setTabListState: (state: TabListState<T>) => void;\n    selectedTab: HTMLElement | null;\n    collapsed: boolean;\n  };\n  refs: {\n    wrapperRef: RefObject<HTMLDivElement | null>;\n    tablistRef: RefObject<HTMLDivElement | null>;\n  };\n  tabPanelProps: HTMLAttributes<HTMLElement>;\n  tabLineState: Array<DOMRect>;\n}\n\nconst TabContext = React.createContext<TabsContext<any> | null>(null);\n\n/**\n * Tabs organize content into multiple sections and allow users to navigate between them. The\n * content under the set of tabs should be related and form a coherent unit.\n */\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\nexport const Tabs = React.forwardRef(function Tabs<T extends object>(\n  props: SpectrumTabsProps<T>,\n  ref: DOMRef<HTMLDivElement>\n) {\n  props = useProviderProps(props);\n  let {\n    orientation = 'horizontal' as Orientation,\n    density = 'regular',\n    children,\n    ...otherProps\n  } = props;\n\n  let domRef = useDOMRef(ref);\n  let tablistRef = useRef<HTMLDivElement>(null);\n  let wrapperRef = useRef<HTMLDivElement>(null);\n\n  let {direction} = useLocale();\n  let {styleProps} = useStyleProps(otherProps);\n  let [collapsed, setCollapsed] = useState(false);\n  let [selectedTab, setSelectedTab] = useState<HTMLElement | null>(null);\n  const [tabListState, setTabListState] = useState<TabListState<T> | null>(null);\n  let [tabPositions, setTabPositions] = useState<DOMRect[]>([]);\n  let prevTabPositions = useRef<DOMRect[]>(tabPositions);\n\n  useEffect(() => {\n    if (tablistRef.current) {\n      let selectedTab: HTMLElement | null = tablistRef.current.querySelector(\n        `[data-key=\"${CSS.escape(tabListState?.selectedKey?.toString() ?? '')}\"]`\n      );\n\n      if (selectedTab != null) {\n        setSelectedTab(selectedTab);\n      }\n    }\n    // collapse is in the dep array so selectedTab can be updated for TabLine positioning\n  }, [children, tabListState?.selectedKey, collapsed, tablistRef]);\n\n  let checkShouldCollapse = useCallback(() => {\n    if (wrapperRef.current && orientation !== 'vertical') {\n      let tabsComponent = wrapperRef.current;\n      let tabs: NodeListOf<Element> =\n        tablistRef.current?.querySelectorAll('[role=\"tab\"]') ??\n        (new NodeList() as NodeListOf<Element>);\n      let tabDimensions = [...tabs].map((tab: Element) => tab.getBoundingClientRect());\n\n      let end = direction === 'rtl' ? 'left' : 'right';\n      let farEdgeTabList = tabsComponent.getBoundingClientRect()[end];\n      let farEdgeLastTab = tabDimensions[tabDimensions.length - 1][end];\n      let shouldCollapse =\n        direction === 'rtl' ? farEdgeLastTab < farEdgeTabList : farEdgeTabList < farEdgeLastTab;\n      setCollapsed(shouldCollapse);\n      if (\n        tabDimensions.length !== prevTabPositions.current.length ||\n        tabDimensions.some(\n          (box, index) =>\n            box?.left !== prevTabPositions.current[index]?.left ||\n            box?.right !== prevTabPositions.current[index]?.right\n        )\n      ) {\n        setTabPositions(tabDimensions);\n        prevTabPositions.current = tabDimensions;\n      }\n    }\n  }, [\n    tablistRef,\n    wrapperRef,\n    direction,\n    orientation,\n    setCollapsed,\n    prevTabPositions,\n    setTabPositions\n  ]);\n\n  useLayoutEffect(() => {\n    checkShouldCollapse();\n  }, [children, checkShouldCollapse]);\n\n  useResizeObserver({ref: wrapperRef, onResize: checkShouldCollapse});\n\n  let tabPanelProps: HTMLAttributes<HTMLElement> = {\n    'aria-labelledby': undefined\n  };\n\n  // When the tabs are collapsed, the tabPanel should be labelled by the Picker button element.\n  let collapsibleTabListId = useId();\n  if (collapsed && orientation !== 'vertical') {\n    tabPanelProps['aria-labelledby'] = collapsibleTabListId;\n  }\n  return (\n    <TabContext.Provider\n      value={{\n        tabProps: {...props, orientation, density},\n        tabState: {tabListState, setTabListState, selectedTab, collapsed},\n        refs: {tablistRef, wrapperRef},\n        tabPanelProps,\n        tabLineState: tabPositions\n      }}>\n      <div\n        {...filterDOMProps(otherProps)}\n        {...styleProps}\n        ref={domRef}\n        className={classNames(\n          styles,\n          'spectrum-TabsPanel',\n          `spectrum-TabsPanel--${orientation}`,\n          styleProps.className\n        )}>\n        {props.children}\n      </div>\n    </TabContext.Provider>\n  );\n}) as <T>(props: SpectrumTabsProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\n\ninterface TabProps<T> extends DOMProps {\n  item: Node<T>;\n  state: TabListState<T>;\n  isDisabled?: boolean;\n  orientation?: Orientation;\n}\n\n// @private\nfunction Tab<T>(props: TabProps<T>) {\n  let {item, state} = props;\n  let {key, rendered} = item;\n\n  let ref = useRef<any>(undefined);\n  let {tabProps, isSelected, isDisabled} = useTab({key}, state, ref);\n\n  let {hoverProps, isHovered} = useHover({\n    ...props\n  });\n  let ElementType: React.ElementType = item.props.href ? 'a' : 'div';\n\n  return (\n    <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n      <ElementType\n        {...mergeProps(tabProps, hoverProps)}\n        ref={ref}\n        className={classNames(styles, 'spectrum-Tabs-item', {\n          'is-selected': isSelected,\n          'is-disabled': isDisabled,\n          'is-hovered': isHovered\n        })}>\n        <SlotProvider\n          slots={{\n            icon: {\n              size: 'S',\n              UNSAFE_className: classNames(styles, 'spectrum-Icon')\n            },\n            text: {\n              UNSAFE_className: classNames(styles, 'spectrum-Tabs-itemLabel')\n            }\n          }}>\n          {typeof rendered === 'string' ? <Text>{rendered}</Text> : rendered}\n        </SlotProvider>\n      </ElementType>\n    </FocusRing>\n  );\n}\n\ninterface TabLineProps {\n  orientation?: Orientation;\n  selectedTab?: HTMLElement | null;\n  selectedKey?: Key | null;\n}\n\n// @private\nfunction TabLine(props: TabLineProps) {\n  let {\n    orientation,\n    // Is either the tab node (non-collapsed) or the picker node (collapsed)\n    selectedTab,\n    // selectedKey is provided so that the TabLine styles are updated when the TabPicker's width updates from a selection change\n    selectedKey\n  } = props;\n\n  let {direction} = useLocale();\n  let {scale} = useProvider();\n  let {tabLineState} = useContext(TabContext)!;\n\n  let [style, setStyle] = useState<CSSProperties>({\n    width: undefined,\n    height: undefined\n  });\n\n  let onResize = useCallback(() => {\n    if (selectedTab) {\n      let styleObj: CSSProperties = {transform: undefined, width: undefined, height: undefined};\n      // In RTL, calculate the transform from the right edge of the tablist so that resizing the window doesn't break the Tabline position due to offsetLeft changes\n      let offset =\n        direction === 'rtl'\n          ? -1 *\n            ((selectedTab.offsetParent as HTMLElement)?.offsetWidth -\n              selectedTab.offsetWidth -\n              selectedTab.offsetLeft)\n          : selectedTab.offsetLeft;\n      styleObj.transform =\n        orientation === 'vertical'\n          ? `translateY(${selectedTab.offsetTop}px)`\n          : `translateX(${offset}px)`;\n\n      if (orientation === 'horizontal') {\n        styleObj.width = `${selectedTab.offsetWidth}px`;\n      } else {\n        styleObj.height = `${selectedTab.offsetHeight}px`;\n      }\n      setStyle(styleObj);\n    }\n  }, [direction, setStyle, selectedTab, orientation]);\n\n  useLayoutEffect(() => {\n    onResize();\n  }, [onResize, scale, selectedKey, tabLineState]);\n\n  return (\n    <div\n      className={classNames(styles, 'spectrum-Tabs-selectionIndicator')}\n      role=\"presentation\"\n      style={style}\n    />\n  );\n}\n\nexport interface SpectrumTabListProps<T> extends DOMProps, StyleProps {\n  /**\n   * The tab items to display. Item keys should match the key of the corresponding `<Item>` within\n   * the `<TabPanels>` element.\n   */\n  children: CollectionChildren<T>;\n}\n\n/**\n * A TabList is used within Tabs to group tabs that a user can switch between. The keys of the items\n * within the <TabList> must match up with a corresponding item inside the <TabPanels>.\n */\nexport function TabList<T>(props: SpectrumTabListProps<T>): ReactElement {\n  const tabContext = useContext(TabContext)!;\n  const {refs, tabState, tabProps, tabPanelProps} = tabContext;\n  const {isQuiet, density, isEmphasized, orientation} = tabProps;\n  const {selectedTab, collapsed, setTabListState} = tabState;\n  const {tablistRef, wrapperRef} = refs;\n  // Pass original Tab props but override children to create the collection.\n  const state = useTabListState({...tabProps, children: props.children});\n\n  let {styleProps} = useStyleProps(props);\n  const {tabListProps} = useTabList({...tabProps, ...props}, state, tablistRef);\n\n  useEffect(() => {\n    // Passing back to root as useTabPanel needs the TabListState\n    setTabListState(state);\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [state.disabledKeys, state.selectedItem, state.selectedKey, props.children]);\n\n  let collapseStyle: React.CSSProperties =\n    collapsed && orientation !== 'vertical'\n      ? {\n          maxWidth: 'calc(100% + 1px)',\n          overflow: 'hidden',\n          visibility: 'hidden',\n          position: 'absolute'\n        }\n      : {maxWidth: 'calc(100% + 1px)'};\n  let stylePropsFinal = orientation === 'vertical' ? styleProps : {style: collapseStyle};\n\n  if (collapsed && orientation !== 'vertical') {\n    tabListProps['aria-hidden'] = true;\n  }\n\n  let tabListclassName = classNames(styles, 'spectrum-TabsPanel-tabs');\n\n  const tabContent = (\n    <div\n      {...stylePropsFinal}\n      {...tabListProps}\n      ref={tablistRef}\n      className={classNames(\n        styles,\n        'spectrum-Tabs',\n        `spectrum-Tabs--${orientation}`,\n        tabListclassName,\n        {\n          'spectrum-Tabs--quiet': isQuiet,\n          'spectrum-Tabs--emphasized': isEmphasized,\n          ['spectrum-Tabs--compact']: density === 'compact'\n        },\n        orientation === 'vertical' && styleProps.className\n      )}>\n      {[...state.collection].map(item => (\n        <Tab key={item.key} item={item} state={state} orientation={orientation} />\n      ))}\n      <TabLine orientation={orientation} selectedTab={selectedTab} />\n    </div>\n  );\n\n  if (orientation === 'vertical') {\n    return tabContent;\n  } else {\n    return (\n      <div\n        {...styleProps}\n        ref={wrapperRef}\n        className={classNames(styles, 'spectrum-TabsPanel-collapseWrapper', styleProps.className)}>\n        <TabPicker\n          {...props}\n          {...tabProps}\n          visible={collapsed}\n          id={tabPanelProps['aria-labelledby']}\n          state={state}\n          className={tabListclassName}\n        />\n        {tabContent}\n      </div>\n    );\n  }\n}\n\nexport interface SpectrumTabPanelsProps<T> extends DOMProps, StyleProps {\n  /**\n   * The contents of each tab. Item keys should match the key of the corresponding `<Item>` within\n   * the `<TabList>` element.\n   */\n  children: CollectionChildren<T>;\n}\n\n/**\n * TabPanels is used within Tabs as a container for the content of each tab. The keys of the items\n * within the <TabPanels> must match up with a corresponding item inside the <TabList>.\n */\nexport function TabPanels<T extends object>(props: SpectrumTabPanelsProps<T>): ReactElement {\n  const {tabState, tabProps} = useContext(TabContext)!;\n  const {tabListState} = tabState;\n\n  const factory = useCallback((nodes: Iterable<Node<T>>) => new ListCollection(nodes), []);\n  const collection = useCollection({items: tabProps.items, ...props}, factory, {\n    suppressTextValueWarning: true\n  });\n  const selectedItem =\n    tabListState && tabListState.selectedKey != null\n      ? collection.getItem(tabListState.selectedKey)\n      : null;\n\n  return (\n    <TabPanel {...props} key={tabListState?.selectedKey}>\n      {selectedItem && selectedItem.props.children}\n    </TabPanel>\n  );\n}\n\ninterface TabPanelProps extends AriaTabPanelProps, StyleProps {\n  children?: ReactNode;\n}\n\n// @private\nfunction TabPanel(props: TabPanelProps) {\n  const {tabState, tabPanelProps: ctxTabPanelProps} = useContext(TabContext)!;\n  const {tabListState} = tabState;\n  let ref = useRef<HTMLDivElement | null>(null);\n  const {tabPanelProps} = useTabPanel(props, tabListState, ref);\n  let {styleProps} = useStyleProps(props);\n\n  if (ctxTabPanelProps['aria-labelledby']) {\n    tabPanelProps['aria-labelledby'] = ctxTabPanelProps['aria-labelledby'];\n  }\n\n  return (\n    <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n      <div\n        {...styleProps}\n        {...tabPanelProps}\n        ref={ref}\n        className={classNames(styles, 'spectrum-TabsPanel-tabpanel', styleProps.className)}>\n        {props.children}\n      </div>\n    </FocusRing>\n  );\n}\n\ninterface TabPickerProps<T> extends Omit<SpectrumPickerProps<T>, 'children' | 'onSelectionChange'> {\n  density?: 'compact' | 'regular';\n  isEmphasized?: boolean;\n  state: TabListState<T>;\n  className?: string;\n  visible: boolean;\n  onSelectionChange?: (key: Key) => void;\n}\n\nfunction TabPicker<T>(props: TabPickerProps<T>) {\n  let {\n    isDisabled,\n    isEmphasized,\n    isQuiet,\n    state,\n    'aria-labelledby': ariaLabeledBy,\n    'aria-label': ariaLabel,\n    density,\n    className,\n    id,\n    visible\n  } = props;\n\n  let ref = useRef<DOMRefValue<HTMLDivElement>>(null);\n  let [pickerNode, setPickerNode] = useState<HTMLElement | null>(null);\n\n  useEffect(() => {\n    let node = unwrapDOMRef(ref);\n    setPickerNode(node.current);\n  }, [ref]);\n\n  let items = [...state.collection];\n  let pickerProps = {\n    'aria-labelledby': ariaLabeledBy,\n    'aria-label': ariaLabel\n  };\n\n  const style: React.CSSProperties = visible ? {} : {visibility: 'hidden', position: 'absolute'};\n\n  return (\n    <div\n      className={classNames(\n        styles,\n        'spectrum-Tabs',\n        'spectrum-Tabs--horizontal',\n        'spectrum-Tabs--isCollapsed',\n        {\n          'spectrum-Tabs--quiet': isQuiet,\n          ['spectrum-Tabs--compact']: density === 'compact',\n          'spectrum-Tabs--emphasized': isEmphasized\n        },\n        className\n      )}\n      style={style}\n      aria-hidden={visible ? undefined : true}>\n      <SlotProvider\n        slots={{\n          icon: {\n            size: 'S',\n            UNSAFE_className: classNames(styles, 'spectrum-Icon')\n          },\n          button: {\n            focusRingClass: classNames(styles, 'focus-ring')\n          }\n        }}>\n        <Picker\n          {...pickerProps}\n          id={id}\n          items={items}\n          ref={ref}\n          isQuiet\n          isDisabled={!visible || isDisabled}\n          selectedKey={state.selectedKey}\n          disabledKeys={state.disabledKeys}\n          onSelectionChange={key => {\n            if (key != null) {\n              state.setSelectedKey(key);\n            }\n          }}\n          UNSAFE_className={classNames(styles, 'spectrum-Tabs-picker')}>\n          {item => <Item {...item.props}>{item.rendered}</Item>}\n        </Picker>\n        {pickerNode && (\n          <TabLine\n            orientation=\"horizontal\"\n            selectedTab={pickerNode}\n            selectedKey={state.selectedKey}\n          />\n        )}\n      </SlotProvider>\n    </div>\n  );\n}\n"],"names":[],"version":3,"file":"Tabs.cjs.map"}