@yamada-ui/color-picker 1.4.10-dev-20241118224412 → 1.4.10-dev-20241119150031

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/dist/{chunk-OPWYRBSP.mjs → chunk-3DDU22W6.mjs} +3 -2
  2. package/dist/chunk-3DDU22W6.mjs.map +1 -0
  3. package/dist/{chunk-QWG3QE6A.mjs → chunk-DDNDRQKD.mjs} +3 -3
  4. package/dist/{chunk-ASZZSRFB.mjs → chunk-KXJGUNXF.mjs} +5 -6
  5. package/dist/chunk-KXJGUNXF.mjs.map +1 -0
  6. package/dist/{chunk-NNVWH4IX.mjs → chunk-OL3O7L3O.mjs} +2 -2
  7. package/dist/{chunk-Z2KAER2U.mjs → chunk-T4JTAQXV.mjs} +7 -12
  8. package/dist/chunk-T4JTAQXV.mjs.map +1 -0
  9. package/dist/{chunk-XSZZBWND.mjs → chunk-ZW72SK4V.mjs} +2 -2
  10. package/dist/color-picker.js +7 -12
  11. package/dist/color-picker.js.map +1 -1
  12. package/dist/color-picker.mjs +6 -6
  13. package/dist/color-selector-body.js +1 -0
  14. package/dist/color-selector-body.js.map +1 -1
  15. package/dist/color-selector-body.mjs +2 -2
  16. package/dist/color-selector-swatches.js +1 -0
  17. package/dist/color-selector-swatches.js.map +1 -1
  18. package/dist/color-selector-swatches.mjs +2 -2
  19. package/dist/color-selector.js +1 -0
  20. package/dist/color-selector.js.map +1 -1
  21. package/dist/color-selector.mjs +4 -4
  22. package/dist/color-swatch.js +1 -0
  23. package/dist/color-swatch.js.map +1 -1
  24. package/dist/color-swatch.mjs +1 -1
  25. package/dist/index.js +7 -12
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +6 -6
  28. package/dist/use-color-picker.d.mts +0 -1
  29. package/dist/use-color-picker.d.ts +0 -1
  30. package/dist/use-color-picker.js +5 -10
  31. package/dist/use-color-picker.js.map +1 -1
  32. package/dist/use-color-picker.mjs +1 -1
  33. package/package.json +4 -4
  34. package/dist/chunk-ASZZSRFB.mjs.map +0 -1
  35. package/dist/chunk-OPWYRBSP.mjs.map +0 -1
  36. package/dist/chunk-Z2KAER2U.mjs.map +0 -1
  37. /package/dist/{chunk-QWG3QE6A.mjs.map → chunk-DDNDRQKD.mjs.map} +0 -0
  38. /package/dist/{chunk-NNVWH4IX.mjs.map → chunk-OL3O7L3O.mjs.map} +0 -0
  39. /package/dist/{chunk-XSZZBWND.mjs.map → chunk-ZW72SK4V.mjs.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  ui,
8
8
  useComponentMultiStyle
9
9
  } from "@yamada-ui/core";
10
- import { cx } from "@yamada-ui/utils";
10
+ import { cx, isString } from "@yamada-ui/utils";
11
11
  import { jsx } from "react/jsx-runtime";
12
12
  var defaultOverlays = (background, withShadow) => {
13
13
  let overlays = [
@@ -79,6 +79,7 @@ var ColorSwatch = forwardRef((props, ref) => {
79
79
  {
80
80
  ref,
81
81
  className: cx("ui-color-swatch", className),
82
+ "aria-label": isString(color) ? color : void 0,
82
83
  "aria-roledescription": "color swatch",
83
84
  role: "img",
84
85
  ...isRounded ? { rounded: "fallback(full, 9999px)" } : {},
@@ -109,4 +110,4 @@ ColorSwatch.__ui__ = "ColorSwatch";
109
110
  export {
110
111
  ColorSwatch
111
112
  };
112
- //# sourceMappingURL=chunk-OPWYRBSP.mjs.map
113
+ //# sourceMappingURL=chunk-3DDU22W6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/color-swatch.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n CSSUIProps,\n HTMLUIProps,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { cx, isString } from \"@yamada-ui/utils\"\n\nconst defaultOverlays = (\n background: CSSUIProps[\"color\"],\n withShadow: boolean,\n): HTMLUIProps[] => {\n let overlays: HTMLUIProps[] = [\n {\n bgImage:\n \"linear-gradient(45deg, $checkers 25%, transparent 25%), linear-gradient(-45deg, $checkers 25%, transparent 25%), linear-gradient(45deg, transparent 75%, $checkers 75%), linear-gradient(-45deg, $body 75%, $checkers 75%)\",\n bgPosition: `0 0, 0 4px, 4px -4px, -4px 0`,\n bgSize: `8px 8px`,\n vars: [\n {\n name: \"checkers\",\n token: \"colors\",\n value: [\"blackAlpha.300\", \"whiteAlpha.300\"],\n },\n {\n name: \"body\",\n token: \"colors\",\n value: [\"whiteAlpha.500\", \"blackAlpha.500\"],\n },\n ],\n },\n { background },\n ]\n\n if (withShadow)\n overlays = [\n ...overlays,\n {\n boxShadow: `rgba(0, 0, 0, .1) 0 0 0 1px inset, rgb(0, 0, 0, .15) 0 0 4px inset`,\n },\n ]\n\n return overlays\n}\n\ninterface ColorSwatchOptions {\n /**\n * The color used for the swatch element.\n *\n * @default \"#ffffff00\"\n */\n color?: CSSUIProps[\"color\"]\n /**\n * If `true`, the color swatch will be perfectly round. Else, it'll be slightly round.\n *\n * @default false\n */\n isRounded?: boolean\n /**\n * The overlay used for the swatch element.\n */\n overlays?: HTMLUIProps[]\n /**\n * If `true`, the swatch element has an inner `box-shadow`.\n *\n * @default true\n */\n withShadow?: boolean\n}\n\nexport interface ColorSwatchProps\n extends Omit<HTMLUIProps, \"color\">,\n ThemeProps<\"ColorSwatch\">,\n ColorSwatchOptions {}\n\n/**\n * `ColorSwatch` is a component that displays color samples.\n *\n * @see Docs https://yamada-ui.com/components/data-display/color-swatch\n */\nexport const ColorSwatch = forwardRef<ColorSwatchProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"ColorSwatch\", props)\n const {\n className,\n color = \"#ffffff00\",\n isRounded,\n withShadow = true,\n overlays = defaultOverlays(color, withShadow),\n __css,\n ...rest\n } = omitThemeProps(mergedProps)\n\n const css: CSSUIObject = {\n \"& > *\": {\n alignItems: \"center\",\n bottom: \"0\",\n display: \"flex\",\n h: \"100%\",\n justifyContent: \"center\",\n left: \"0\",\n overflow: \"hidden\",\n position: \"absolute\",\n right: \"0\",\n top: \"0\",\n w: \"100%\",\n },\n position: \"relative\",\n _before: {\n content: `\"\"`,\n display: \"block\",\n h: 0,\n pb: \"100%\",\n },\n ...styles.container,\n ...__css,\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-color-swatch\", className)}\n aria-label={isString(color) ? color : undefined}\n aria-roledescription=\"color swatch\"\n role=\"img\"\n {...(isRounded ? { rounded: \"fallback(full, 9999px)\" } : {})}\n __css={css}\n {...rest}\n >\n <ui.div {...(isRounded ? { rounded: \"fallback(full, 9999px)\" } : {})}>\n {overlays.map((props, index) => (\n <ui.div\n key={index}\n __css={{\n bottom: 0,\n left: 0,\n position: \"absolute\",\n right: 0,\n top: 0,\n ...styles.overlay,\n }}\n {...(isRounded ? { rounded: \"fallback(full, 9999px)\" } : {})}\n {...props}\n />\n ))}\n </ui.div>\n </ui.div>\n )\n})\n\nColorSwatch.displayName = \"ColorSwatch\"\nColorSwatch.__ui__ = \"ColorSwatch\"\n"],"mappings":";;;AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,IAAI,gBAAgB;AA4HnB;AA1HV,IAAM,kBAAkB,CACtB,YACA,eACkB;AAClB,MAAI,WAA0B;AAAA,IAC5B;AAAA,MACE,SACE;AAAA,MACF,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,MAAM;AAAA,QACJ;AAAA,UACE,MAAM;AAAA,UACN,OAAO;AAAA,UACP,OAAO,CAAC,kBAAkB,gBAAgB;AAAA,QAC5C;AAAA,QACA;AAAA,UACE,MAAM;AAAA,UACN,OAAO;AAAA,UACP,OAAO,CAAC,kBAAkB,gBAAgB;AAAA,QAC5C;AAAA,MACF;AAAA,IACF;AAAA,IACA,EAAE,WAAW;AAAA,EACf;AAEA,MAAI;AACF,eAAW;AAAA,MACT,GAAG;AAAA,MACH;AAAA,QACE,WAAW;AAAA,MACb;AAAA,IACF;AAEF,SAAO;AACT;AAqCO,IAAM,cAAc,WAAo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E,SAAS,yBAAyB,IAAI,CAAC;AAAA,UACzD,GAAGA;AAAA;AAAA,QAVC;AAAA,MAWP,CACD,GACH;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,YAAY,cAAc;AAC1B,YAAY,SAAS;","names":["props"]}
@@ -4,13 +4,13 @@ import {
4
4
  } from "./chunk-AJTCPCFF.mjs";
5
5
  import {
6
6
  ColorSelectorBody
7
- } from "./chunk-XSZZBWND.mjs";
7
+ } from "./chunk-ZW72SK4V.mjs";
8
8
  import {
9
9
  ColorSelectorChannels
10
10
  } from "./chunk-RJOBF4LI.mjs";
11
11
  import {
12
12
  ColorSelectorSwatches
13
- } from "./chunk-NNVWH4IX.mjs";
13
+ } from "./chunk-OL3O7L3O.mjs";
14
14
  import {
15
15
  ColorSelectorProvider,
16
16
  useColorSelector
@@ -129,4 +129,4 @@ ColorSelector.__ui__ = "ColorSelector";
129
129
  export {
130
130
  ColorSelector
131
131
  };
132
- //# sourceMappingURL=chunk-QWG3QE6A.mjs.map
132
+ //# sourceMappingURL=chunk-DDNDRQKD.mjs.map
@@ -3,16 +3,16 @@ import {
3
3
  ColorPickerProvider,
4
4
  useColorPicker,
5
5
  useColorPickerContext
6
- } from "./chunk-Z2KAER2U.mjs";
6
+ } from "./chunk-T4JTAQXV.mjs";
7
7
  import {
8
8
  ColorSelector
9
- } from "./chunk-QWG3QE6A.mjs";
9
+ } from "./chunk-DDNDRQKD.mjs";
10
10
  import {
11
11
  EyeDropperIcon
12
12
  } from "./chunk-6XIZXZXV.mjs";
13
13
  import {
14
14
  ColorSwatch
15
- } from "./chunk-OPWYRBSP.mjs";
15
+ } from "./chunk-3DDU22W6.mjs";
16
16
 
17
17
  // src/color-picker.tsx
18
18
  import {
@@ -65,7 +65,6 @@ var ColorPicker = forwardRef(
65
65
  ...computedProps
66
66
  } = omitThemeProps(mergedProps, ["withSwatch"]);
67
67
  const {
68
- id,
69
68
  eyeDropperSupported,
70
69
  value,
71
70
  getContainerProps,
@@ -123,7 +122,7 @@ var ColorPicker = forwardRef(
123
122
  /* @__PURE__ */ jsx(Portal, { ...portalProps, children: /* @__PURE__ */ jsx(
124
123
  PopoverContent,
125
124
  {
126
- id,
125
+ as: "div",
127
126
  className: "ui-color-picker__content",
128
127
  __css: { ...styles.content },
129
128
  children: /* @__PURE__ */ jsx(
@@ -256,4 +255,4 @@ ColorPickerEyeDropper.__ui__ = "ColorPickerEyeDropper";
256
255
  export {
257
256
  ColorPicker
258
257
  };
259
- //# sourceMappingURL=chunk-ASZZSRFB.mjs.map
258
+ //# sourceMappingURL=chunk-KXJGUNXF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/color-picker.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps, ThemeProps } from \"@yamada-ui/core\"\nimport type { PortalProps } from \"@yamada-ui/portal\"\nimport type { FC, ReactNode, RefAttributes } from \"react\"\nimport type { ColorSelectorProps } from \"./color-selector\"\nimport type { ColorSwatchProps } from \"./color-swatch\"\nimport type { UseColorPickerProps } from \"./use-color-picker\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"@yamada-ui/popover\"\nimport { Portal } from \"@yamada-ui/portal\"\nimport {\n cx,\n getValidChildren,\n isValidElement,\n mergeRefs,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport { ColorSelector } from \"./color-selector\"\nimport { EyeDropperIcon } from \"./color-selector-eye-dropper\"\nimport { ColorSwatch } from \"./color-swatch\"\nimport {\n ColorPickerProvider,\n useColorPicker,\n useColorPickerContext,\n} from \"./use-color-picker\"\n\ninterface ColorPickerOptions {\n children?: FC<{ value: string; onClose: () => void }> | ReactNode\n /**\n * The border color when the input is invalid.\n */\n errorBorderColor?: string\n /**\n * The border color when the input is focused.\n */\n focusBorderColor?: string\n /**\n * If `true`, display the eye dropper component.\n *\n * @default true\n */\n withEyeDropper?: boolean\n /**\n * If `true`, display the color swatch component.\n *\n * @default true\n */\n withSwatch?: boolean\n /**\n * Props for color picker container element.\n */\n containerProps?: Omit<HTMLUIProps, \"children\">\n /**\n * Props for color eye dropper component.\n */\n eyeDropperProps?: ColorPickerEyeDropperProps\n /**\n * Props for color picker field element.\n */\n fieldProps?: Omit<ColorPickerFieldProps, \"children\" | \"inputProps\">\n /**\n * Props for color picker input element.\n */\n inputProps?: HTMLUIProps<\"input\">\n /**\n * Props to be forwarded to the portal component.\n *\n * @default '{ isDisabled: true }'\n */\n portalProps?: Omit<PortalProps, \"children\">\n /**\n * Props for color swatch component.\n */\n swatchProps?: ColorPickerSwatchProps\n}\n\nexport interface ColorPickerProps\n extends ThemeProps<\"ColorPicker\">,\n UseColorPickerProps,\n ColorPickerOptions,\n Pick<\n ColorSelectorProps,\n | \"alphaSliderProps\"\n | \"alphaSliderRef\"\n | \"channelProps\"\n | \"channelsProps\"\n | \"hueSliderProps\"\n | \"hueSliderRef\"\n | \"saturationSliderProps\"\n | \"saturationSliderRef\"\n | \"swatchesProps\"\n > {}\n\n/**\n * `ColorPicker` is a component used by the user to select a color or enter an arbitrary color value.\n *\n * @see Docs https://yamada-ui.com/components/forms/color-picker\n */\nexport const ColorPicker = forwardRef<ColorPickerProps, \"input\">(\n ({ withSwatch = true, ...props }, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"ColorPicker\", {\n withSwatch,\n ...props,\n })\n let {\n className,\n alphaSliderRef,\n children,\n color,\n h,\n height,\n hueSliderRef,\n minH,\n minHeight,\n saturationSliderRef,\n withEyeDropper = true,\n alphaSliderProps,\n channelProps,\n channelsProps,\n containerProps,\n eyeDropperProps,\n fieldProps,\n hueSliderProps,\n inputProps,\n portalProps = { isDisabled: true },\n saturationSliderProps,\n swatchesProps,\n swatchProps,\n ...computedProps\n } = omitThemeProps(mergedProps, [\"withSwatch\"])\n const {\n eyeDropperSupported,\n value,\n getContainerProps,\n getEyeDropperProps,\n getFieldProps,\n getInputProps,\n getPopoverProps,\n getSelectorProps,\n onClose,\n ...rest\n } = useColorPicker(computedProps)\n\n h ??= height\n minH ??= minHeight\n\n const css: CSSUIObject = {\n color,\n h: \"fit-content\",\n w: \"100%\",\n ...styles.container,\n }\n\n return (\n <ColorPickerProvider value={{ styles, value, ...rest }}>\n <Popover {...getPopoverProps()}>\n <ui.div\n className={cx(\"ui-color-picker\", className)}\n __css={css}\n {...getContainerProps(containerProps)}\n >\n <ui.div\n className=\"ui-color-picker__inner\"\n __css={{\n position: \"relative\",\n ...styles.inner,\n }}\n >\n {withSwatch ? <ColorPickerSwatch {...swatchProps} /> : null}\n\n <ColorPickerField\n h={h}\n minH={minH}\n {...getFieldProps(fieldProps, ref)}\n inputProps={getInputProps(inputProps)}\n />\n\n {eyeDropperSupported && withEyeDropper ? (\n <ColorPickerEyeDropper\n {...getEyeDropperProps(eyeDropperProps)}\n />\n ) : null}\n </ui.div>\n\n <Portal {...portalProps}>\n <PopoverContent\n as=\"div\"\n className=\"ui-color-picker__content\"\n __css={{ ...styles.content }}\n >\n <ColorSelector\n className=\"ui-color-picker__picker\"\n {...getSelectorProps({\n alphaSliderRef,\n hueSliderRef,\n saturationSliderRef,\n alphaSliderProps,\n channelProps,\n channelsProps,\n hueSliderProps,\n saturationSliderProps,\n swatchesProps,\n })}\n >\n {runIfFunc(children, { value, onClose })}\n </ColorSelector>\n </PopoverContent>\n </Portal>\n </ui.div>\n </Popover>\n </ColorPickerProvider>\n )\n },\n)\n\nColorPicker.displayName = \"ColorPicker\"\nColorPicker.__ui__ = \"ColorPicker\"\n\ninterface ColorPickerFieldOptions {\n inputProps?: HTMLUIProps<\"input\"> & RefAttributes<HTMLInputElement>\n}\n\ninterface ColorPickerFieldProps extends HTMLUIProps, ColorPickerFieldOptions {}\n\nconst ColorPickerField = forwardRef<ColorPickerFieldProps, \"input\">(\n ({ className, h, minH, inputProps, ...rest }, ref) => {\n const { styles } = useColorPickerContext()\n const { ref: inputRef, ...computedInputProps } = inputProps ?? {}\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n h,\n minH,\n pe: \"2rem\",\n ps: \"2rem\",\n ...styles.field,\n }\n\n return (\n <PopoverTrigger>\n <ui.div\n className={cx(\"ui-color-picker__field\", className)}\n __css={css}\n {...rest}\n >\n <ui.input\n ref={mergeRefs(ref, inputRef)}\n className=\"ui-color-picker-picker__field__input\"\n display=\"inline-block\"\n w=\"100%\"\n {...computedInputProps}\n />\n </ui.div>\n </PopoverTrigger>\n )\n },\n)\n\nColorPickerField.displayName = \"ColorPickerField\"\nColorPickerField.__ui__ = \"ColorPickerField\"\n\ninterface ColorPickerSwatchProps extends ColorSwatchProps {}\n\nconst ColorPickerSwatch = forwardRef<ColorPickerSwatchProps, \"div\">(\n ({ className, ...rest }, ref) => {\n const { styles, value } = useColorPickerContext()\n\n const css: CSSUIObject = {\n position: \"absolute\",\n top: \"50%\",\n transform: \"translateY(-50%)\",\n zIndex: 1,\n ...styles.swatch,\n }\n\n return (\n <ColorSwatch\n ref={ref}\n className={cx(\"ui-color-picker__swatch\", className)}\n color={value}\n isRounded\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nColorPickerSwatch.displayName = \"ColorPickerSwatch\"\nColorPickerSwatch.__ui__ = \"ColorPickerSwatch\"\n\ninterface ColorPickerEyeDropperProps extends HTMLUIProps<\"button\"> {}\n\nconst ColorPickerEyeDropper = forwardRef<ColorPickerEyeDropperProps, \"button\">(\n ({ className, children, ...rest }, ref) => {\n const { styles } = useColorPickerContext()\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"inline-flex\",\n justifyContent: \"center\",\n position: \"absolute\",\n top: \"50%\",\n transform: \"translateY(-50%)\",\n zIndex: 1,\n ...styles.eyeDropper,\n }\n\n const validChildren = getValidChildren(children)\n\n const cloneChildren = validChildren.map((child) =>\n cloneElement(child, {\n style: {\n color: \"currentColor\",\n maxHeight: \"1em\",\n maxWidth: \"1em\",\n },\n \"aria-hidden\": true,\n focusable: false,\n }),\n )\n\n return (\n <ui.button\n ref={ref}\n className={cx(\"ui-color-picker__eye-dropper\", className)}\n __css={css}\n {...rest}\n >\n {isValidElement(children) ? (\n cloneChildren\n ) : (\n <EyeDropperIcon className=\"ui-color-picker__eye-dropper__icon\" />\n )}\n </ui.button>\n )\n },\n)\n\nColorPickerEyeDropper.displayName = \"ColorPickerEyeDropper\"\nColorPickerEyeDropper.__ui__ = \"ColorPickerEyeDropper\"\n"],"mappings":";;;;;;;;;;;;;;;;;AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAiJjB,SAOgB,KAPhB;AA/DL,IAAM,cAAc;AAAA,EACzB,CAAC,EAAE,aAAa,MAAM,GAAG,MAAM,GAAG,QAAQ;AACxC,UAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,eAAe;AAAA,MAClE;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AACD,QAAI;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc,EAAE,YAAY,KAAK;AAAA,MACjC;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,IAAI,eAAe,aAAa,CAAC,YAAY,CAAC;AAC9C,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,IAAI,eAAe,aAAa;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AAAA,EAEJ;AACF;AAEA,kBAAkB,cAAc;AAChC,kBAAkB,SAAS;AAI3B,IAAM,wBAAwB;AAAA,EAC5B,CAAC,EAAE,WAAW,UAAU,GAAG,KAAK,GAAG,QAAQ;AACzC,UAAM,EAAE,OAAO,IAAI,sBAAsB;AAEzC,UAAM,MAAmB;AAAA,MACvB,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,gBAAgB;AAAA,MAChB,UAAU;AAAA,MACV,KAAK;AAAA,MACL,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,GAAG,OAAO;AAAA,IACZ;AAEA,UAAM,gBAAgB,iBAAiB,QAAQ;AAE/C,UAAM,gBAAgB,cAAc;AAAA,MAAI,CAAC,UACvC,aAAa,OAAO;AAAA,QAClB,OAAO;AAAA,UACL,OAAO;AAAA,UACP,WAAW;AAAA,UACX,UAAU;AAAA,QACZ;AAAA,QACA,eAAe;AAAA,QACf,WAAW;AAAA,MACb,CAAC;AAAA,IACH;AAEA,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAW,GAAG,gCAAgC,SAAS;AAAA,QACvD,OAAO;AAAA,QACN,GAAG;AAAA,QAEH,yBAAe,QAAQ,IACtB,gBAEA,oBAAC,kBAAe,WAAU,sCAAqC;AAAA;AAAA,IAEnE;AAAA,EAEJ;AACF;AAEA,sBAAsB,cAAc;AACpC,sBAAsB,SAAS;","names":[]}
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import {
3
3
  ColorSwatch
4
- } from "./chunk-OPWYRBSP.mjs";
4
+ } from "./chunk-3DDU22W6.mjs";
5
5
  import {
6
6
  useColorSelectorContext
7
7
  } from "./chunk-C7UAG4TH.mjs";
@@ -69,4 +69,4 @@ ColorSelectorSwatches.__ui__ = "ColorSelectorSwatches";
69
69
  export {
70
70
  ColorSelectorSwatches
71
71
  };
72
- //# sourceMappingURL=chunk-NNVWH4IX.mjs.map
72
+ //# sourceMappingURL=chunk-OL3O7L3O.mjs.map
@@ -23,15 +23,14 @@ import {
23
23
  splitObject,
24
24
  useUpdateEffect
25
25
  } from "@yamada-ui/utils";
26
- import { useCallback, useId, useRef, useState } from "react";
26
+ import { useCallback, useRef, useState } from "react";
27
27
  var defaultFormatInput = (value) => value;
28
28
  var [ColorPickerProvider, useColorPickerContext] = createContext({
29
29
  name: "ColorPickerContext",
30
30
  errorMessage: `useColorPickerContext returned is 'undefined'. Seems you forgot to wrap the components in "<ColorPicker />"`
31
31
  });
32
32
  var useColorPicker = (props) => {
33
- let {
34
- id,
33
+ const {
35
34
  allowInput = true,
36
35
  animation,
37
36
  boundary,
@@ -111,8 +110,6 @@ var useColorPicker = (props) => {
111
110
  onClose: onCloseProp,
112
111
  onOpen: onOpenProp
113
112
  });
114
- const uuid = useId();
115
- id != null ? id : id = uuid;
116
113
  const onOpen = useCallback(() => {
117
114
  if (disabled || readOnly) return;
118
115
  onInternalOpen();
@@ -289,10 +286,11 @@ var useColorPicker = (props) => {
289
286
  );
290
287
  const getFieldProps = useCallback(
291
288
  (props2 = {}, ref = null) => ({
292
- "aria-expanded": dataAttr(isOpen),
289
+ "aria-haspopup": "dialog",
293
290
  "data-active": dataAttr(isOpen),
294
291
  "data-not-allowed": dataAttr(!readOnly && !disabled && !allowInput),
295
- tabIndex: !allowInput ? -1 : 0,
292
+ role: "combobox",
293
+ tabIndex: -1,
296
294
  ...formControlProps,
297
295
  ...props2,
298
296
  ref: mergeRefs(fieldRef, ref),
@@ -321,8 +319,7 @@ var useColorPicker = (props) => {
321
319
  ...disabled || !allowInput ? { pointerEvents: "none" } : {}
322
320
  };
323
321
  return {
324
- "aria-controls": id,
325
- role: "combobox",
322
+ autoComplete: "off",
326
323
  tabIndex: !allowInput ? -1 : 0,
327
324
  ...formControlProps,
328
325
  ...inputProps,
@@ -334,7 +331,6 @@ var useColorPicker = (props) => {
334
331
  };
335
332
  },
336
333
  [
337
- id,
338
334
  inputProps,
339
335
  allowInput,
340
336
  disabled,
@@ -405,7 +401,6 @@ var useColorPicker = (props) => {
405
401
  ]
406
402
  );
407
403
  return {
408
- id,
409
404
  allowInput,
410
405
  eyeDropperSupported,
411
406
  value,
@@ -424,4 +419,4 @@ export {
424
419
  useColorPickerContext,
425
420
  useColorPicker
426
421
  };
427
- //# sourceMappingURL=chunk-Z2KAER2U.mjs.map
422
+ //# sourceMappingURL=chunk-T4JTAQXV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/use-color-picker.ts"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n PropGetter,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { ComboBoxProps, PopoverProps } from \"@yamada-ui/popover\"\nimport type { ColorFormat } from \"@yamada-ui/utils\"\nimport type {\n ChangeEvent,\n CSSProperties,\n FocusEvent,\n KeyboardEvent,\n MouseEvent,\n} from \"react\"\nimport type { ColorSelectorProps } from \"./color-selector\"\nimport type { UseColorSelectorBaseProps } from \"./use-color-selector\"\nimport { layoutStyleProperties } from \"@yamada-ui/core\"\nimport {\n formControlProperties,\n useFormControlProps,\n} from \"@yamada-ui/form-control\"\nimport { useControllableState } from \"@yamada-ui/use-controllable-state\"\nimport { useDisclosure } from \"@yamada-ui/use-disclosure\"\nimport { useEyeDropper } from \"@yamada-ui/use-eye-dropper\"\nimport { useOutsideClick } from \"@yamada-ui/use-outside-click\"\nimport {\n calcFormat,\n convertColor,\n createContext,\n dataAttr,\n getEventRelatedTarget,\n handlerAll,\n isContains,\n mergeRefs,\n pickObject,\n splitObject,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useRef, useState } from \"react\"\n\nconst defaultFormatInput = (value: string) => value\n\ntype ColorSelectorThemeProps = ThemeProps<\"ColorSelector\">\n\ninterface ColorPickerContext {\n styles: { [key: string]: CSSUIObject | undefined }\n value: string\n}\n\nexport const [ColorPickerProvider, useColorPickerContext] =\n createContext<ColorPickerContext>({\n name: \"ColorPickerContext\",\n errorMessage: `useColorPickerContext returned is 'undefined'. Seems you forgot to wrap the components in \"<ColorPicker />\"`,\n })\n\ninterface UseColorPickerOptions {\n /**\n * If `true`, allows input.\n *\n * @default true\n */\n allowInput?: boolean\n /**\n * If `true`, the color swatch will be closed when value is selected.\n */\n closeOnSelectSwatch?: boolean\n /**\n * ColorScheme for the color selector component.\n */\n colorSelectorColorScheme?: ColorSelectorThemeProps[\"colorScheme\"]\n /**\n * Size for the color selector component.\n */\n colorSelectorSize?: ColorSelectorThemeProps[\"size\"]\n /**\n * Variant for the color selector component.\n */\n colorSelectorVariant?: ColorSelectorThemeProps[\"variant\"]\n /**\n * The initial value of the color selector.\n */\n defaultColor?: string\n /**\n * A callback function to format the input entered.\n */\n formatInput?: (value: string) => string\n /**\n * If `true` display the eye dropper component.\n *\n * @default false\n */\n withColorSelectorEyeDropper?: boolean\n /**\n * If `true`, display the result component.\n *\n * @default false\n */\n withResult?: boolean\n /**\n * Props for color selector component.\n */\n colorSelectorProps?: ColorSelectorProps\n}\n\nexport interface UseColorPickerProps\n extends Omit<\n HTMLUIProps<\"input\">,\n | \"animation\"\n | \"children\"\n | \"defaultValue\"\n | \"offset\"\n | \"onChange\"\n | \"size\"\n | \"value\"\n >,\n Omit<UseColorSelectorBaseProps, \"id\" | \"name\">,\n ComboBoxProps,\n Pick<\n ColorSelectorProps,\n | \"swatches\"\n | \"swatchesColumns\"\n | \"swatchesLabel\"\n | \"withChannel\"\n | \"withPicker\"\n >,\n UseColorPickerOptions {}\n\nexport const useColorPicker = (props: UseColorPickerProps) => {\n const {\n allowInput = true,\n animation,\n boundary,\n closeDelay,\n closeOnBlur = true,\n closeOnEsc = true,\n closeOnSelectSwatch,\n colorSelectorColorScheme,\n colorSelectorSize,\n colorSelectorVariant,\n defaultColor,\n defaultIsOpen,\n defaultValue,\n duration = 0.2,\n eventListeners,\n fallbackValue,\n flip,\n format,\n formatInput = defaultFormatInput,\n gutter,\n isLazy,\n isOpen: isOpenProp,\n lazyBehavior,\n matchWidth = colorSelectorSize === \"full\",\n modifiers,\n offset,\n openDelay,\n placement = \"bottom-start\",\n preventOverflow,\n strategy,\n swatches,\n swatchesColumns,\n swatchesLabel,\n value: valueProp,\n withChannel,\n withColorSelectorEyeDropper = false,\n withPicker,\n withResult = false,\n onChange: onChangeProp,\n onChangeEnd,\n onChangeStart,\n onClick,\n onClose: onCloseProp,\n onKeyDown,\n onOpen: onOpenProp,\n onSwatchClick,\n ...rest\n } = useFormControlProps(props)\n const {\n \"aria-readonly\": _ariaReadonly,\n onBlur,\n onFocus,\n ...formControlProps\n } = pickObject(rest, formControlProperties)\n const { disabled, readOnly } = formControlProps\n const [containerProps, inputProps] = splitObject(rest, layoutStyleProperties)\n const containerRef = useRef<HTMLDivElement>(null)\n const fieldRef = useRef<HTMLInputElement>(null)\n const { supported: eyeDropperSupported, onOpen: onEyeDropperOpen } =\n useEyeDropper()\n const [value, setValue] = useControllableState({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const formatRef = useRef<ColorFormat>(\n format ?? calcFormat(value || defaultColor || \"\"),\n )\n const isInputFocused = useRef<boolean>(false)\n const [inputValue, setInputValue] = useState<string>(value || \"\")\n const {\n isOpen,\n onClose: onInternalClose,\n onOpen: onInternalOpen,\n } = useDisclosure({\n defaultIsOpen,\n isOpen: isOpenProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n\n const onOpen = useCallback(() => {\n if (disabled || readOnly) return\n\n onInternalOpen()\n }, [onInternalOpen, disabled, readOnly])\n\n const onClose = useCallback(() => {\n if (!isOpen) return\n\n const next = convertColor(value, fallbackValue)(formatRef.current)\n\n setValue((prev) => (!next || prev === next ? prev : next))\n setInputValue(formatInput(next ?? \"\"))\n\n onInternalClose()\n }, [\n formatRef,\n isOpen,\n setValue,\n onInternalClose,\n value,\n formatInput,\n setInputValue,\n fallbackValue,\n ])\n\n const onContainerClick = useCallback(() => {\n if (isOpen) return\n\n onOpen()\n }, [isOpen, onOpen])\n\n const onInputFocus = useCallback(() => {\n isInputFocused.current = true\n\n if (isOpen) return\n\n onOpen()\n }, [isOpen, onOpen])\n\n const onInputBlur = useCallback(() => {\n isInputFocused.current = false\n }, [])\n\n const onContainerBlur = useCallback(\n (ev: FocusEvent<HTMLDivElement>) => {\n const relatedTarget = getEventRelatedTarget(ev)\n\n if (isContains(containerRef.current, relatedTarget)) return\n\n if (!closeOnBlur) return\n\n if (isOpen) onClose()\n },\n [closeOnBlur, isOpen, onClose],\n )\n\n const onInputKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLInputElement>) => {\n if (ev.key === \" \") ev.key = ev.code\n\n if (disabled || readOnly) return\n\n const actions: { [key: string]: Function | undefined } = {\n Enter: !isOpen ? onOpen : undefined,\n Escape: closeOnEsc ? onClose : undefined,\n Space: !isOpen ? onOpen : undefined,\n }\n\n const action = actions[ev.key]\n\n if (!action) return\n\n ev.preventDefault()\n ev.stopPropagation()\n action()\n },\n [disabled, readOnly, isOpen, onOpen, closeOnEsc, onClose],\n )\n\n const onInputChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n const value = ev.target.value\n\n setInputValue(formatInput(value))\n setValue(value)\n },\n [setInputValue, formatInput, setValue],\n )\n\n const onColorSelectorChange = useCallback(\n (value: string) => {\n setValue(value)\n\n setTimeout(() => {\n if (!isInputFocused.current) setInputValue(formatInput(value))\n })\n },\n [setValue, formatInput],\n )\n\n const onEyeDropperClick = useCallback(\n async (ev: MouseEvent<HTMLButtonElement>) => {\n ev.preventDefault()\n ev.stopPropagation()\n\n try {\n const { sRGBHex } = (await onEyeDropperOpen()) ?? {}\n\n if (!sRGBHex) return\n\n onColorSelectorChange(sRGBHex)\n onChangeEnd?.(sRGBHex)\n } catch {}\n },\n [onEyeDropperOpen, onColorSelectorChange, onChangeEnd],\n )\n\n useOutsideClick({\n ref: containerRef,\n enabled: isOpen && closeOnBlur,\n handler: onClose,\n })\n\n useUpdateEffect(() => {\n if (!format || !value) return\n\n formatRef.current = format\n\n const nextValue = convertColor(value, fallbackValue)(format)\n\n if (!nextValue) return\n\n setInputValue(formatInput(nextValue))\n setValue(nextValue)\n }, [format])\n\n useUpdateEffect(() => {\n if (isInputFocused.current || !valueProp) return\n\n setInputValue(formatInput(valueProp))\n }, [valueProp])\n\n const getPopoverProps = useCallback(\n (props?: PopoverProps): PopoverProps => ({\n animation,\n boundary,\n closeDelay,\n closeOnBlur,\n duration,\n eventListeners,\n flip,\n gutter,\n isLazy,\n lazyBehavior,\n matchWidth,\n modifiers,\n offset,\n openDelay,\n placement,\n preventOverflow,\n strategy,\n ...props,\n closeOnButton: false,\n isOpen,\n trigger: \"never\",\n onClose,\n onOpen,\n }),\n [\n closeOnBlur,\n openDelay,\n closeDelay,\n isLazy,\n lazyBehavior,\n animation,\n duration,\n offset,\n gutter,\n preventOverflow,\n flip,\n matchWidth,\n boundary,\n eventListeners,\n strategy,\n placement,\n modifiers,\n isOpen,\n onOpen,\n onClose,\n ],\n )\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ref: mergeRefs(containerRef, ref),\n ...containerProps,\n ...props,\n ...formControlProps,\n onBlur: handlerAll(props.onBlur, onBlur, onContainerBlur),\n onClick: handlerAll(props.onClick, onClick, onContainerClick),\n }),\n [\n containerProps,\n formControlProps,\n onBlur,\n onClick,\n onContainerBlur,\n onContainerClick,\n ],\n )\n\n const getFieldProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n \"aria-haspopup\": \"dialog\",\n \"data-active\": dataAttr(isOpen),\n \"data-not-allowed\": dataAttr(!readOnly && !disabled && !allowInput),\n role: \"combobox\",\n tabIndex: -1,\n ...formControlProps,\n ...props,\n ref: mergeRefs(fieldRef, ref),\n onBlur: handlerAll(props.onFocus, onInputBlur),\n onFocus: handlerAll(props.onFocus, onFocus, onInputFocus),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown, onInputKeyDown),\n }),\n [\n allowInput,\n formControlProps,\n isOpen,\n readOnly,\n disabled,\n onInputBlur,\n onFocus,\n onInputFocus,\n onKeyDown,\n onInputKeyDown,\n ],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}, ref = null) => {\n const style: CSSProperties = {\n ...props.style,\n ...inputProps.style,\n ...(disabled || !allowInput ? { pointerEvents: \"none\" } : {}),\n }\n\n return {\n autoComplete: \"off\",\n tabIndex: !allowInput ? -1 : 0,\n ...formControlProps,\n ...inputProps,\n ...props,\n ref,\n style,\n value: inputValue,\n onChange: handlerAll(props.onChange, onInputChange),\n }\n },\n [\n inputProps,\n allowInput,\n disabled,\n formControlProps,\n inputValue,\n onInputChange,\n ],\n )\n\n const getEyeDropperProps: PropGetter<\"button\"> = useCallback(\n (props = {}, ref = null) => ({\n \"aria-label\": \"Pick a color\",\n disabled,\n ...props,\n ref,\n style: { ...props.style, pointerEvents: readOnly ? \"none\" : undefined },\n onClick: handlerAll(props.onClick, onEyeDropperClick),\n }),\n [disabled, onEyeDropperClick, readOnly],\n )\n\n const getSelectorProps: PropGetter<ColorSelectorProps> = useCallback(\n (props) => ({\n ...formControlProps,\n ...props,\n colorScheme: colorSelectorColorScheme,\n size: colorSelectorSize,\n variant: colorSelectorVariant,\n defaultValue: defaultColor,\n fallbackValue,\n format: formatRef.current,\n swatches,\n swatchesColumns,\n swatchesLabel,\n value,\n withChannel,\n withEyeDropper: withColorSelectorEyeDropper,\n withPicker,\n withResult,\n onChange: onColorSelectorChange,\n onChangeEnd,\n onChangeStart,\n onSwatchClick: handlerAll(\n onSwatchClick,\n closeOnSelectSwatch ? onClose : undefined,\n ),\n }),\n [\n formControlProps,\n value,\n fallbackValue,\n defaultColor,\n onColorSelectorChange,\n onChangeStart,\n onChangeEnd,\n onSwatchClick,\n onClose,\n closeOnSelectSwatch,\n formatRef,\n withPicker,\n withChannel,\n withResult,\n withColorSelectorEyeDropper,\n swatchesLabel,\n swatches,\n swatchesColumns,\n colorSelectorColorScheme,\n colorSelectorSize,\n colorSelectorVariant,\n ],\n )\n\n return {\n allowInput,\n eyeDropperSupported,\n value,\n getContainerProps,\n getEyeDropperProps,\n getFieldProps,\n getInputProps,\n getPopoverProps,\n getSelectorProps,\n onClose,\n }\n}\n\nexport type UseColorPickerReturn = ReturnType<typeof useColorPicker>\n"],"mappings":";;;AAiBA,SAAS,6BAA6B;AACtC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,QAAQ,gBAAgB;AAE9C,IAAM,qBAAqB,CAAC,UAAkB;AASvC,IAAM,CAAC,qBAAqB,qBAAqB,IACtD,cAAkC;AAAA,EAChC,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA0EI,IAAM,iBAAiB,CAAC,UAA+B;AAC5D,QAAM;AAAA,IACJ,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA,aAAa,sBAAsB;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,8BAA8B;AAAA,IAC9B;AAAA,IACA,aAAa;AAAA,IACb,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA,QAAQ;AAAA,IACR;AAA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AAAA,MACA,eAAe;AAAA,QACb;AAAA,QACA,sBAAsB,UAAU;AAAA,MAClC;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["value","props"]}
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-UKR7WWUY.mjs";
8
8
  import {
9
9
  ColorSwatch
10
- } from "./chunk-OPWYRBSP.mjs";
10
+ } from "./chunk-3DDU22W6.mjs";
11
11
  import {
12
12
  useColorSelectorContext
13
13
  } from "./chunk-C7UAG4TH.mjs";
@@ -74,4 +74,4 @@ ColorSelectorBody.__ui__ = "ColorSelectorBody";
74
74
  export {
75
75
  ColorSelectorBody
76
76
  };
77
- //# sourceMappingURL=chunk-XSZZBWND.mjs.map
77
+ //# sourceMappingURL=chunk-ZW72SK4V.mjs.map
@@ -1194,6 +1194,7 @@ var ColorSwatch = (0, import_core5.forwardRef)((props, ref) => {
1194
1194
  {
1195
1195
  ref,
1196
1196
  className: (0, import_utils7.cx)("ui-color-swatch", className),
1197
+ "aria-label": (0, import_utils7.isString)(color) ? color : void 0,
1197
1198
  "aria-roledescription": "color swatch",
1198
1199
  role: "img",
1199
1200
  ...isRounded ? { rounded: "fallback(full, 9999px)" } : {},
@@ -1899,8 +1900,7 @@ var [ColorPickerProvider, useColorPickerContext] = (0, import_utils14.createCont
1899
1900
  errorMessage: `useColorPickerContext returned is 'undefined'. Seems you forgot to wrap the components in "<ColorPicker />"`
1900
1901
  });
1901
1902
  var useColorPicker = (props) => {
1902
- let {
1903
- id,
1903
+ const {
1904
1904
  allowInput = true,
1905
1905
  animation,
1906
1906
  boundary,
@@ -1980,8 +1980,6 @@ var useColorPicker = (props) => {
1980
1980
  onClose: onCloseProp,
1981
1981
  onOpen: onOpenProp
1982
1982
  });
1983
- const uuid = (0, import_react5.useId)();
1984
- id != null ? id : id = uuid;
1985
1983
  const onOpen = (0, import_react5.useCallback)(() => {
1986
1984
  if (disabled || readOnly) return;
1987
1985
  onInternalOpen();
@@ -2158,10 +2156,11 @@ var useColorPicker = (props) => {
2158
2156
  );
2159
2157
  const getFieldProps = (0, import_react5.useCallback)(
2160
2158
  (props2 = {}, ref = null) => ({
2161
- "aria-expanded": (0, import_utils14.dataAttr)(isOpen),
2159
+ "aria-haspopup": "dialog",
2162
2160
  "data-active": (0, import_utils14.dataAttr)(isOpen),
2163
2161
  "data-not-allowed": (0, import_utils14.dataAttr)(!readOnly && !disabled && !allowInput),
2164
- tabIndex: !allowInput ? -1 : 0,
2162
+ role: "combobox",
2163
+ tabIndex: -1,
2165
2164
  ...formControlProps,
2166
2165
  ...props2,
2167
2166
  ref: (0, import_utils14.mergeRefs)(fieldRef, ref),
@@ -2190,8 +2189,7 @@ var useColorPicker = (props) => {
2190
2189
  ...disabled || !allowInput ? { pointerEvents: "none" } : {}
2191
2190
  };
2192
2191
  return {
2193
- "aria-controls": id,
2194
- role: "combobox",
2192
+ autoComplete: "off",
2195
2193
  tabIndex: !allowInput ? -1 : 0,
2196
2194
  ...formControlProps,
2197
2195
  ...inputProps,
@@ -2203,7 +2201,6 @@ var useColorPicker = (props) => {
2203
2201
  };
2204
2202
  },
2205
2203
  [
2206
- id,
2207
2204
  inputProps,
2208
2205
  allowInput,
2209
2206
  disabled,
@@ -2274,7 +2271,6 @@ var useColorPicker = (props) => {
2274
2271
  ]
2275
2272
  );
2276
2273
  return {
2277
- id,
2278
2274
  allowInput,
2279
2275
  eyeDropperSupported,
2280
2276
  value,
@@ -2323,7 +2319,6 @@ var ColorPicker = (0, import_core12.forwardRef)(
2323
2319
  ...computedProps
2324
2320
  } = (0, import_core12.omitThemeProps)(mergedProps, ["withSwatch"]);
2325
2321
  const {
2326
- id,
2327
2322
  eyeDropperSupported,
2328
2323
  value,
2329
2324
  getContainerProps,
@@ -2381,7 +2376,7 @@ var ColorPicker = (0, import_core12.forwardRef)(
2381
2376
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_portal.Portal, { ...portalProps, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2382
2377
  import_popover.PopoverContent,
2383
2378
  {
2384
- id,
2379
+ as: "div",
2385
2380
  className: "ui-color-picker__content",
2386
2381
  __css: { ...styles.content },
2387
2382
  children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(