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ACrC,YAAY,cAAc;QAC1B,SAAS,IAAM,WAAW,KAAK,GAAG;IACpC;IAEA,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK,KAAK;QACb,UAAU,KAAK,QAAQ;QACvB,QAAQ;YAAC,YAAY,cAAc;uBAAW;QAAS;QACvD,kBAAkB;IACpB;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAc;QAAC,QAAQ;QAAM,WAAW;IAAI;IAC1E,OAAO,SAAS,EAAE;IAElB,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,EAAE;QACJ,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,cAAc,aAAa;QAC1C,gBAAc,aAAa;qBAC3B,gCAAC,CAAA,GAAA,yCAAU,EAAE,QAAQ;QAAC,OAAO;OAAY,YAAY,QAAQ;AAGnE","sources":["packages/react-aria-components/src/Breadcrumbs.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {AriaBreadcrumbsProps, useBreadcrumbs} from 'react-aria/useBreadcrumbs';\n\nimport {AriaLabelingProps, forwardRefType, GlobalDOMAttributes, Key} from '@react-types/shared';\nimport {\n  ClassNameOrFunction,\n  ContextValue,\n  dom,\n  DOMRenderProps,\n  RenderProps,\n  SlotProps,\n  StyleProps,\n  useContextProps,\n  useRenderProps,\n  useSlottedContext\n} from './utils';\nimport {Collection} from 'react-aria/Collection';\nimport {CollectionBuilder, createLeafComponent} from 'react-aria/CollectionBuilder';\nimport {CollectionNode} from 'react-aria/private/collections/BaseCollection';\nimport {CollectionProps, CollectionRendererContext} from './Collection';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {LinkContext} from './Link';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {Node} from '@react-types/shared';\nimport React, {createContext, ForwardedRef, forwardRef, useContext} from 'react';\n\nexport interface BreadcrumbsProps<T>\n  extends\n    Omit<CollectionProps<T>, 'disabledKeys'>,\n    AriaBreadcrumbsProps,\n    StyleProps,\n    SlotProps,\n    AriaLabelingProps,\n    DOMRenderProps<'ol', undefined>,\n    GlobalDOMAttributes<HTMLOListElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element.\n   *\n   * @default 'react-aria-Breadcrumbs'\n   */\n  className?: string;\n  /** Whether the breadcrumbs are disabled. */\n  isDisabled?: boolean;\n  /** Handler that is called when a breadcrumb is clicked. */\n  onAction?: (key: Key) => void;\n}\n\nexport const BreadcrumbsContext =\n  createContext<ContextValue<BreadcrumbsProps<any>, HTMLOListElement>>(null);\n\n/**\n * Breadcrumbs display a hierarchy of links to the current page or resource in an application.\n */\nexport const Breadcrumbs = /*#__PURE__*/ (forwardRef as forwardRefType)(function Breadcrumbs<T>(\n  props: BreadcrumbsProps<T>,\n  ref: ForwardedRef<HTMLOListElement>\n) {\n  [props, ref] = useContextProps(props, ref, BreadcrumbsContext);\n  let {CollectionRoot} = useContext(CollectionRendererContext);\n  let {navProps} = useBreadcrumbs(props);\n  let DOMProps = filterDOMProps(props, {global: true, labelable: true});\n\n  return (\n    <CollectionBuilder content={<Collection {...props} />}>\n      {collection => (\n        <dom.ol\n          render={props.render}\n          ref={ref}\n          {...mergeProps(DOMProps, navProps)}\n          slot={props.slot || undefined}\n          style={props.style}\n          className={props.className ?? 'react-aria-Breadcrumbs'}>\n          <BreadcrumbsContext.Provider value={props}>\n            <CollectionRoot collection={collection} />\n          </BreadcrumbsContext.Provider>\n        </dom.ol>\n      )}\n    </CollectionBuilder>\n  );\n});\n\nexport interface BreadcrumbRenderProps {\n  /**\n   * Whether the breadcrumb is for the current page.\n   *\n   * @selector [data-current]\n   */\n  isCurrent: boolean;\n  /**\n   * Whether the breadcrumb is disabled.\n   *\n   * @selector [data-disabled]\n   */\n  isDisabled: boolean;\n}\n\nexport interface BreadcrumbProps\n  extends\n    RenderProps<BreadcrumbRenderProps, 'li'>,\n    AriaLabelingProps,\n    GlobalDOMAttributes<HTMLLIElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   *\n   * @default 'react-aria-Breadcrumb'\n   */\n  className?: ClassNameOrFunction<BreadcrumbRenderProps>;\n  /**\n   * A unique id for the breadcrumb, which will be passed to `onAction` when the breadcrumb is\n   * pressed.\n   */\n  id?: Key;\n}\n\nclass BreadcrumbNode extends CollectionNode<unknown> {\n  static readonly type = 'item';\n}\n\n/**\n * A Breadcrumb represents an individual item in a `<Breadcrumbs>` list.\n */\nexport const Breadcrumb = /*#__PURE__*/ createLeafComponent(\n  BreadcrumbNode,\n  function Breadcrumb(\n    props: BreadcrumbProps,\n    ref: ForwardedRef<HTMLLIElement>,\n    node: Node<unknown>\n  ) {\n    // Recreating useBreadcrumbItem because we want to use composition instead of having the link builtin.\n    let isCurrent = node.nextKey == null;\n    let {isDisabled, onAction} = useSlottedContext(BreadcrumbsContext)!;\n    let linkProps = {\n      'aria-current': isCurrent ? 'page' : null,\n      isDisabled: isDisabled || isCurrent,\n      onPress: () => onAction?.(node.key)\n    };\n\n    let renderProps = useRenderProps({\n      ...node.props,\n      children: node.rendered,\n      values: {isDisabled: isDisabled || isCurrent, isCurrent},\n      defaultClassName: 'react-aria-Breadcrumb'\n    });\n\n    let DOMProps = filterDOMProps(props as any, {global: true, labelable: true});\n    delete DOMProps.id;\n\n    return (\n      <dom.li\n        {...DOMProps}\n        {...renderProps}\n        ref={ref}\n        data-disabled={isDisabled || isCurrent || undefined}\n        data-current={isCurrent || undefined}>\n        <LinkContext.Provider value={linkProps}>{renderProps.children}</LinkContext.Provider>\n      </dom.li>\n    );\n  }\n);\n"],"names":[],"version":3,"file":"Breadcrumbs.mjs.map"}