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,QAAQ;AAM3B","sources":["packages/@adobe/react-spectrum/src/color/ColorPicker.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 {ColorPicker as AriaColorPicker} from 'react-aria-components/ColorPicker';\n\nimport {AriaLabelingProps, FocusableRef, ValueBase} from '@react-types/shared';\nimport {Button} from 'react-aria-components/Button';\nimport {Color} from 'react-stately/Color';\nimport {ColorSwatch} from './ColorSwatch';\nimport {Content} from '../view/Content';\nimport {Dialog} from '../dialog/Dialog';\nimport {DialogTrigger} from '../dialog/DialogTrigger';\nimport React, {ReactNode, useRef} from 'react';\nimport {style} from '@react-spectrum/style-macro-s1' with {type: 'macro'};\nimport {unwrapDOMRef, useFocusableRef} from '../utils/useDOMRef';\nimport {useId} from 'react-aria/useId';\n\nexport interface SpectrumColorPickerProps\n  extends ValueBase<string | Color, Color>, AriaLabelingProps {\n  /** A visual label for the color picker. */\n  label?: ReactNode;\n  /** The contents of the color picker popover, e.g. `<ColorEditor />`. */\n  children?: ReactNode;\n  /**\n   * The size of the color swatch.\n   *\n   * @default 'M'\n   */\n  size?: 'XS' | 'S' | 'M' | 'L';\n  /**\n   * The corner rounding of the color swatch.\n   *\n   * @default 'default'\n   */\n  rounding?: 'default' | 'none' | 'full';\n}\n\n/**\n * A ColorPicker combines a swatch with a customizable popover for editing a color.\n */\nexport const ColorPicker = React.forwardRef(function ColorPicker(\n  props: SpectrumColorPickerProps,\n  ref: FocusableRef<HTMLButtonElement>\n) {\n  let swatchRef = useRef(null);\n  let domRef = useFocusableRef(ref);\n  let labelId = useId();\n  return (\n    <AriaColorPicker {...props}>\n      <DialogTrigger type=\"popover\" mobileType=\"tray\" targetRef={unwrapDOMRef(swatchRef)}>\n        <Button\n          ref={domRef}\n          className={style({\n            backgroundColor: 'transparent',\n            borderStyle: 'none',\n            padding: 0,\n            display: 'flex',\n            alignItems: 'center',\n            gap: 'text-to-control',\n            outlineStyle: 'none',\n            fontFamily: 'sans',\n            color: 'body',\n            fontSize: {\n              size: {\n                XS: 'xs',\n                S: 'sm',\n                M: 'base',\n                L: 'lg'\n              }\n            }\n          })({size: props.size || 'M'})}>\n          {({isFocusVisible}) => (\n            <>\n              <div\n                className={style({\n                  outlineStyle: {\n                    default: 'none',\n                    isFocusVisible: 'solid'\n                  },\n                  outlineColor: 'focus-ring',\n                  outlineWidth: 2,\n                  outlineOffset: 2,\n                  borderRadius: 'default'\n                })({isFocusVisible})}>\n                <ColorSwatch\n                  ref={swatchRef}\n                  color={props.value}\n                  size={props.size}\n                  rounding={props.rounding}\n                  aria-label={props['aria-label']}\n                  aria-labelledby={props['aria-labelledby']}\n                  aria-describedby={props['aria-describedby']}\n                  aria-details={props['aria-details']}\n                />\n              </div>\n              {props.label && <span id={labelId}>{props.label}</span>}\n            </>\n          )}\n        </Button>\n        <Dialog\n          aria-labelledby={props.label ? labelId : props['aria-labelledby']}\n          aria-label={props['aria-label']}\n          UNSAFE_style={{\n            width: 'fit-content',\n            minWidth: 0,\n            margin: '0 auto' // Center within tray.\n          }}>\n          <Content\n            UNSAFE_style={{\n              position: 'relative',\n              margin: 'calc(var(--spectrum-dialog-padding) * -1)',\n              padding: 'var(--spectrum-global-dimension-size-200)'\n            }}>\n            {props.children}\n          </Content>\n        </Dialog>\n      </DialogTrigger>\n    </AriaColorPicker>\n  );\n});\n"],"names":[],"version":3,"file":"ColorPicker.mjs.map"}