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,CAAC;QACN,IAAI,MAAM,CAAA,GAAA,aAAK,EAAc;QAC7B,IAAI;QACJ,CAAC,KAAK,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE;YAAC,MAAM,MAAM,IAAI,IAAI;QAAM,GAAuB,KAAK;QAC5F,IAAI,UAAC,MAAM,EAAE,QAAQ,SAAS,EAAC,GAAG;QAClC,IAAI,oBACF,gBAAgB,gBAChB,YAAY,QACZ,IAAI,EACJ,cAAc,SAAS,EACvB,eAAe,UAAU,QACzB,OAAO,IAAI,IAAI,IAAI,aACnB,MAAM,EACN,GAAG,YACJ,GAAG;QAEJ,IAAI,CAAC,YACH,aAAa;QAGf,IAAI,oBACF,gBAAC;YACE,GAAG,UAAU;YACd,aAAa;YACb,MAAM;YACN,WAAW;YACX,cAAY;YACZ,eAAa,YAAa,cAAc,YAAa;YACrD,MAAK;YACL,aAAW;YACX,WAAW,AAAC,CAAA,oBAAoB,EAAC,IAAK,MAAM,yCAAmB;sBAAC;YAAI,GAAG,UAAW,CAAA,aAAa,EAAC;YAChG,OAAO;;QAGX,IAAI,QACF,OAAO,OAAO;QAGhB,OAAO;IACT;AACF","sources":["packages/@react-spectrum/s2/src/Icon.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 {AriaLabelingProps, DOMProps} from '@react-types/shared';\nimport {ComponentType, Context, createContext, FunctionComponent, ReactNode, SVGProps, useRef} from 'react';\nimport {ContextValue, SlotProps} from 'react-aria-components';\nimport {mergeStyles} from '../style/runtime';\nimport {SkeletonWrapper, useSkeletonIcon} from './Skeleton';\nimport {style} from '../style' with {type: 'macro'};\nimport {StyleString} from '../style/types';\nimport {UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\n// Custom list of overrides, excluding width/height/flexGrow/flexShrink/flexBasis\nconst allowedOverrides = [\n  'margin',\n  'marginStart',\n  'marginEnd',\n  'marginTop',\n  'marginBottom',\n  'marginX',\n  'marginY',\n  'justifySelf',\n  'alignSelf',\n  'order',\n  'gridArea',\n  'gridRowStart',\n  'gridRowEnd',\n  'gridColumnStart',\n  'gridColumnEnd',\n  'position',\n  'zIndex',\n  'top',\n  'bottom',\n  'inset',\n  'insetX',\n  'insetY',\n  'insetStart',\n  'insetEnd',\n  'rotate',\n  '--iconPrimary',\n  'size'\n] as const;\n\n// Omit --iconPrimary and size from type (they are private).\n// Use the iconStyle() macro to apply them.\ntype AllowedOverrides = Exclude<(typeof allowedOverrides)[number], '--iconPrimary' | 'size'>;\n\nexport interface IconProps extends UnsafeStyles, SlotProps, AriaLabelingProps, DOMProps {\n  'aria-hidden'?: boolean | 'false' | 'true',\n  styles?: StyleString<AllowedOverrides>\n}\n\nexport interface IconContextValue extends UnsafeStyles, SlotProps {\n  styles?: StyleString,\n  render?: (icon: ReactNode) => ReactNode\n}\n\nexport interface IllustrationProps extends UnsafeStyles, SlotProps, AriaLabelingProps, DOMProps {\n  'aria-hidden'?: boolean | 'false' | 'true',\n  size?: 'S' | 'M' | 'L',\n  styles?: StyleString<AllowedOverrides>\n}\n\nexport interface IllustrationContextValue extends IconContextValue {\n  size?: 'S' | 'M' | 'L'\n}\n\nexport const IconContext = createContext<ContextValue<Partial<IconContextValue>, SVGElement>>({});\nexport const IllustrationContext = createContext<ContextValue<Partial<IllustrationContextValue>, SVGElement>>({});\n\nconst iconStyles = style({\n  size: 20,\n  flexShrink: 0\n}, allowedOverrides);\n\nexport function createIcon(Component: ComponentType<SVGProps<SVGSVGElement>>, context: Context<ContextValue<IconContextValue, SVGElement>> = IconContext): FunctionComponent<IconProps> {\n  return (props: IconProps) => {\n    let ref = useRef<SVGElement>(null);\n    let ctx;\n    // TODO: remove this default once we release RAC and use DEFAULT_SLOT.\n    [ctx, ref] = useSpectrumContextProps({slot: props.slot || 'icon'} as IconContextValue, ref, context);\n    let {render, styles: ctxStyles} = ctx;\n    let {\n      UNSAFE_className,\n      UNSAFE_style,\n      slot,\n      'aria-label': ariaLabel,\n      'aria-hidden': ariaHidden,\n      styles,\n      ...otherProps\n    } = props;\n\n    if (!ariaHidden) {\n      ariaHidden = undefined;\n    }\n\n    let svg = (\n      <SkeletonWrapper>\n        <Component\n          {...otherProps}\n          focusable={false}\n          aria-label={ariaLabel}\n          aria-hidden={ariaLabel ? (ariaHidden || undefined) : true}\n          role=\"img\"\n          data-slot={slot}\n          className={(UNSAFE_className ?? '') + ' ' + useSkeletonIcon(mergeStyles(iconStyles(null, styles), ctxStyles))}\n          style={UNSAFE_style} />\n      </SkeletonWrapper>\n    );\n\n    if (render) {\n      return render(svg);\n    }\n\n    return svg;\n  };\n}\n\nconst illustrationStyles = style({\n  size: {\n    size: {\n      S: 48,\n      M: 96,\n      L: 160\n    }\n  },\n  flexShrink: 0\n}, allowedOverrides);\n\nexport function createIllustration(Component: ComponentType<SVGProps<SVGSVGElement>>): FunctionComponent<IllustrationProps> {\n  return (props: IllustrationProps) => {\n    let ref = useRef<SVGElement>(null);\n    let ctx;\n    [ctx, ref] = useSpectrumContextProps({slot: props.slot || 'icon'} as IconContextValue, ref, IllustrationContext);\n    let {render, styles: ctxStyles} = ctx;\n    let {\n      UNSAFE_className,\n      UNSAFE_style,\n      slot,\n      'aria-label': ariaLabel,\n      'aria-hidden': ariaHidden,\n      size = ctx.size || 'M',\n      styles,\n      ...otherProps\n    } = props;\n\n    if (!ariaHidden) {\n      ariaHidden = undefined;\n    }\n\n    let svg = (\n      <Component\n        {...otherProps}\n        // @ts-ignore\n        size={size}\n        focusable={false}\n        aria-label={ariaLabel}\n        aria-hidden={ariaLabel ? (ariaHidden || undefined) : true}\n        role=\"img\"\n        data-slot={slot}\n        className={(UNSAFE_className ?? '') + ' ' + illustrationStyles({size}, styles) + (ctxStyles || '')}\n        style={UNSAFE_style} />\n    );\n\n    if (render) {\n      return render(svg);\n    }\n\n    return svg;\n  };\n}\n"],"names":[],"version":3,"file":"Icon.mjs.map"}