{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA0CM,MAAM,0DAAoB,CAAA,GAAA,uBAAS,EAAE,SAAS,kBACnD,KAAqC,EACrC,GAA2B;IAE3B,IAAI,WAAC,UAAU,iBAAW,OAAO,eAAK,WAAW,QAAQ,GAAG,YAAW,GAAG;IAC1E,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,qBACE,0DAAC,CAAA,GAAA,6DAAoB;QAClB,GAAG,UAAU;QACd,OAAO,WAAW,KAAK;QACvB,KAAK;QACL,WACE,WAAW,SAAS,GACpB;;;;;;;;;;;UAUG;qBAAC;QAAO;qBAEb,0DAAC,CAAA,GAAA,oDAAyB,EAAE,QAAQ;QAAC,OAAO;wBAAC;kBAAY;sBAAM;QAAQ;OACpE,MAAM,QAAQ;AAIvB;AAEA,SAAS,iCACP,MAAoB,EACpB,KAAY,EACZ,QAA8C;IAE9C,qBACE,0DAAC,CAAA,GAAA,iEAAwB;QACvB,OAAO;QACP,WAAW,CAAA,cACT;;;;;;;;;;;;;;;;;;;;;;eAgBG;gBAAC,GAAG,WAAW;0BAAE;YAAQ;OAE7B,CAAC,cAAC,UAAU,EAAC,iBACZ,sHACG,QACA,4BACC,0DAAC;YACC,eAAA;YACA,WAAW;;;;;;;;;;;;;;;;;AAezB","sources":["packages/@adobe/react-spectrum/src/color/ColorSwatchPicker.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 {\n  ColorSwatchPicker as AriaColorSwatchPicker,\n  ColorSwatchPickerItem as AriaColorSwatchPickerItem\n} from 'react-aria-components/ColorSwatchPicker';\n\nimport {Color} from 'react-stately/Color';\nimport {DOMRef, StyleProps, ValueBase} from '@react-types/shared';\nimport React, {forwardRef, ReactElement, ReactNode} from 'react';\nimport {SpectrumColorSwatchContext, SpectrumColorSwatchProps} from './ColorSwatch';\nimport {style} from '@react-spectrum/style-macro-s1' with {type: 'macro'};\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useStyleProps} from '../utils/styleProps';\n\nexport interface SpectrumColorSwatchPickerProps\n  extends ValueBase<string | Color, Color>, StyleProps {\n  /** The ColorSwatches within the ColorSwatchPicker. */\n  children: ReactNode;\n  /**\n   * The amount of padding between the swatches.\n   *\n   * @default 'regular'\n   */\n  density?: 'compact' | 'regular' | 'spacious';\n  /**\n   * The size of the color swatches.\n   *\n   * @default 'M'\n   */\n  size?: 'XS' | 'S' | 'M' | 'L';\n  /**\n   * The corner rounding of the color swatches.\n   *\n   * @default 'none'\n   */\n  rounding?: 'none' | 'default' | 'full';\n}\n\n/**\n * A ColorSwatchPicker displays a list of color swatches and allows a user to select one of them.\n */\nexport const ColorSwatchPicker = forwardRef(function ColorSwatchPicker(\n  props: SpectrumColorSwatchPickerProps,\n  ref: DOMRef<HTMLDivElement>\n) {\n  let {density = 'regular', size = 'M', rounding = 'none', ...otherProps} = props;\n  let {styleProps} = useStyleProps(props);\n  let domRef = useDOMRef(ref);\n\n  return (\n    <AriaColorSwatchPicker\n      {...otherProps}\n      style={styleProps.style}\n      ref={domRef}\n      className={\n        styleProps.className +\n        style({\n          display: 'flex',\n          flexWrap: 'wrap',\n          gap: {\n            density: {\n              compact: 0.5,\n              regular: 1,\n              spacious: 2\n            }\n          }\n        })({density})\n      }>\n      <SpectrumColorSwatchContext.Provider value={{useWrapper, size, rounding}}>\n        {props.children}\n      </SpectrumColorSwatchContext.Provider>\n    </AriaColorSwatchPicker>\n  );\n});\n\nfunction useWrapper(\n  swatch: ReactElement,\n  color: Color,\n  rounding: SpectrumColorSwatchProps['rounding']\n) {\n  return (\n    <AriaColorSwatchPickerItem\n      color={color}\n      className={renderProps =>\n        style({\n          outlineStyle: {\n            default: 'none',\n            isFocusVisible: 'solid'\n          },\n          outlineColor: 'focus-ring',\n          outlineWidth: 2,\n          outlineOffset: 2,\n          position: 'relative',\n          borderRadius: {\n            rounding: {\n              none: 'none',\n              default: 'default',\n              full: 'full'\n            }\n          }\n        })({...renderProps, rounding})\n      }>\n      {({isSelected}) => (\n        <>\n          {swatch}\n          {isSelected && (\n            <div\n              aria-hidden\n              className={style({\n                position: 'absolute',\n                pointerEvents: 'none',\n                inset: 0,\n                boxShadow:\n                  '[inset 0 0 0 2px var(--spectrum-gray-900), inset 0 0 0 4px var(--spectrum-gray-50)]',\n                forcedColorAdjust: 'none',\n                borderRadius: '[inherit]'\n              })()}\n            />\n          )}\n        </>\n      )}\n    </AriaColorSwatchPickerItem>\n  );\n}\n"],"names":[],"version":3,"file":"ColorSwatchPicker.cjs.map"}