@yamada-ui/color-picker 1.4.9-dev-20241110150258 → 1.4.9-dev-20241111191457

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/dist/{chunk-DJST5TK2.mjs → chunk-6XIZXZXV.mjs} +2 -2
  2. package/dist/{chunk-X2EYDFTM.mjs → chunk-C7UAG4TH.mjs} +2 -1
  3. package/dist/{chunk-X2EYDFTM.mjs.map → chunk-C7UAG4TH.mjs.map} +1 -1
  4. package/dist/{chunk-JRSGQRFQ.mjs → chunk-NNVWH4IX.mjs} +3 -3
  5. package/dist/{chunk-YYXTR7W7.mjs → chunk-OPWYRBSP.mjs} +3 -1
  6. package/dist/{chunk-YYXTR7W7.mjs.map → chunk-OPWYRBSP.mjs.map} +1 -1
  7. package/dist/{chunk-YPPP72VM.mjs → chunk-RJOBF4LI.mjs} +2 -2
  8. package/dist/{chunk-CRZIBBBY.mjs → chunk-RW7HCRPR.mjs} +4 -4
  9. package/dist/{chunk-HJMXAALX.mjs → chunk-TED6IK5W.mjs} +5 -5
  10. package/dist/{chunk-HPP26MVU.mjs → chunk-UKR7WWUY.mjs} +2 -2
  11. package/dist/{chunk-LJHUX2RB.mjs → chunk-XSZZBWND.mjs} +5 -5
  12. package/dist/color-picker.js +3 -0
  13. package/dist/color-picker.js.map +1 -1
  14. package/dist/color-picker.mjs +9 -9
  15. package/dist/color-selector-body.js +2 -0
  16. package/dist/color-selector-body.js.map +1 -1
  17. package/dist/color-selector-body.mjs +5 -5
  18. package/dist/color-selector-channels.js.map +1 -1
  19. package/dist/color-selector-channels.mjs +2 -2
  20. package/dist/color-selector-eye-dropper.js.map +1 -1
  21. package/dist/color-selector-eye-dropper.mjs +2 -2
  22. package/dist/color-selector-sliders.js.map +1 -1
  23. package/dist/color-selector-sliders.mjs +2 -2
  24. package/dist/color-selector-swatches.js +2 -0
  25. package/dist/color-selector-swatches.js.map +1 -1
  26. package/dist/color-selector-swatches.mjs +3 -3
  27. package/dist/color-selector.js +3 -0
  28. package/dist/color-selector.js.map +1 -1
  29. package/dist/color-selector.mjs +8 -8
  30. package/dist/color-swatch.js +2 -0
  31. package/dist/color-swatch.js.map +1 -1
  32. package/dist/color-swatch.mjs +1 -1
  33. package/dist/index.js +3 -0
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +9 -9
  36. package/dist/use-color-selector.js +1 -0
  37. package/dist/use-color-selector.js.map +1 -1
  38. package/dist/use-color-selector.mjs +1 -1
  39. package/package.json +7 -7
  40. /package/dist/{chunk-DJST5TK2.mjs.map → chunk-6XIZXZXV.mjs.map} +0 -0
  41. /package/dist/{chunk-JRSGQRFQ.mjs.map → chunk-NNVWH4IX.mjs.map} +0 -0
  42. /package/dist/{chunk-YPPP72VM.mjs.map → chunk-RJOBF4LI.mjs.map} +0 -0
  43. /package/dist/{chunk-CRZIBBBY.mjs.map → chunk-RW7HCRPR.mjs.map} +0 -0
  44. /package/dist/{chunk-HJMXAALX.mjs.map → chunk-TED6IK5W.mjs.map} +0 -0
  45. /package/dist/{chunk-HPP26MVU.mjs.map → chunk-UKR7WWUY.mjs.map} +0 -0
  46. /package/dist/{chunk-LJHUX2RB.mjs.map → chunk-XSZZBWND.mjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import {
3
3
  useColorSelectorContext
4
- } from "./chunk-X2EYDFTM.mjs";
4
+ } from "./chunk-C7UAG4TH.mjs";
5
5
 
6
6
  // src/color-selector-eye-dropper.tsx
7
7
  import { IconButton } from "@yamada-ui/button";
@@ -57,4 +57,4 @@ export {
57
57
  ColorSelectorEyeDropper,
58
58
  EyeDropperIcon
59
59
  };
60
- //# sourceMappingURL=chunk-DJST5TK2.mjs.map
60
+ //# sourceMappingURL=chunk-6XIZXZXV.mjs.map
@@ -395,6 +395,7 @@ var useColorSelector = ({
395
395
  "aria-label": `Select ${color} as the color`,
396
396
  disabled,
397
397
  readOnly,
398
+ role: "button",
398
399
  ...props2,
399
400
  ref,
400
401
  color,
@@ -432,4 +433,4 @@ export {
432
433
  useColorSelectorContext,
433
434
  useColorSelector
434
435
  };
435
- //# sourceMappingURL=chunk-X2EYDFTM.mjs.map
436
+ //# sourceMappingURL=chunk-C7UAG4TH.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-color-selector.ts"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n PropGetter,\n RequiredPropGetter,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport type { InputProps } from \"@yamada-ui/input\"\nimport type { ColorFormat, Dict } from \"@yamada-ui/utils\"\nimport type { ChangeEvent } from \"react\"\nimport type { AlphaSliderProps } from \"./alpha-slider\"\nimport type { ColorSwatchProps } from \"./color-swatch\"\nimport type { HueSliderProps } from \"./hue-slider\"\nimport type { SaturationSliderProps } from \"./saturation-slider\"\nimport {\n formControlProperties,\n useFormControlProps,\n} from \"@yamada-ui/form-control\"\nimport { useControllableState } from \"@yamada-ui/use-controllable-state\"\nimport { useEyeDropper } from \"@yamada-ui/use-eye-dropper\"\nimport {\n calcFormat,\n convertColor,\n createContext,\n handlerAll,\n hslaTo,\n hsvTo,\n isString,\n parseToHsla,\n parseToHsv,\n parseToRgba,\n rgbaTo,\n splitObject,\n useCallbackRef,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useMemo, useRef, useState } from \"react\"\n\ntype Space = keyof Hsla | keyof Rgba\ninterface Hsla {\n a: number\n h: number\n l: number\n s: number\n}\ninterface Rgba {\n a: number\n b: number\n g: number\n r: number\n}\ninterface Hsva {\n a: number\n h: number\n s: number\n v: number\n}\ninterface Channel {\n label: string\n max: number\n min: number\n space: Space\n value: number\n}\n\nconst convertHsla = (value: string, fallback?: string): Hsla => {\n let [h, s, l, a] = parseToHsla(value, fallback) ?? [0, 0, 1, 1]\n\n if (a > 1) a = 1\n\n return { a, h, l, s }\n}\n\nconst convertRgba = (value: string, fallback?: string): Rgba => {\n let [r, g, b, a] = parseToRgba(value, fallback) ?? [255, 255, 255, 1]\n\n if (r > 255) r = 255\n if (g > 255) g = 255\n if (b > 255) b = 255\n if (a > 1) a = 1\n\n return { a, b, g, r }\n}\n\nconst convertHsva = (value: string, fallback?: string): Hsva => {\n const [h, s, v, a] = parseToHsv(value, fallback)\n\n return { a, h, s, v }\n}\n\ninterface ColorSelectorContext {\n channels: Channel[]\n eyeDropperSupported: boolean\n isInteractive: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n value: string\n withAlpha: boolean\n getAlphaSliderProps: PropGetter<AlphaSliderProps>\n getChannelProps: RequiredPropGetter<{ space: Space } & InputProps, InputProps>\n getEyeDropperProps: PropGetter<\"button\">\n getHueSliderProps: PropGetter<HueSliderProps>\n getSwatchProps: PropGetter<ColorSwatchProps>\n onChange: (value: Partial<Hsva> | string) => void\n size?: ThemeProps<\"ColorSelector\">[\"size\"]\n disabled?: boolean\n readOnly?: boolean\n}\n\nexport const [ColorSelectorProvider, useColorSelectorContext] =\n createContext<ColorSelectorContext>({\n name: \"ColorSelectorContext\",\n errorMessage: `useColorSelectorContext returned is 'undefined'. Seems you forgot to wrap the components in \"<ColorSelector />\"`,\n })\n\ninterface UseColorSelectorOptions {\n /**\n * The base `id` to use for the color selector.\n */\n id?: string\n /**\n * The name attribute of the hidden `input` field.\n * This is particularly useful in forms.\n */\n name?: string\n /**\n * The initial value of the color selector.\n */\n defaultValue?: string\n /**\n * The fallback value returned when color determination fails.\n */\n fallbackValue?: string\n /**\n * Color format. For example, `hex`, `rgba`, etc.\n *\n * @default \"hexa\"\n */\n format?: ColorFormat\n /**\n * The value of the color selector.\n */\n value?: string\n /**\n * Function called whenever the color selector value changes.\n */\n onChange?: (value: string) => void\n /**\n * Function called when the user is done selecting a new value.\n */\n onChangeEnd?: (value: string) => void\n /**\n * Function called when the user starts selecting a new value.\n */\n onChangeStart?: (value: string) => void\n /**\n * Function called whenever the color swatch click.\n */\n onSwatchClick?: (value: string) => void\n}\n\nexport interface UseColorSelectorBaseProps\n extends UseColorSelectorOptions,\n FormControlOptions {}\n\nexport interface UseColorSelectorProps\n extends Omit<HTMLUIProps, \"children\" | \"defaultValue\" | \"onChange\">,\n UseColorSelectorBaseProps {}\n\nexport const useColorSelector = ({\n isInvalid,\n ...props\n}: UseColorSelectorProps) => {\n const {\n id,\n name,\n defaultValue,\n fallbackValue,\n format: formatProp,\n value: valueProp,\n onChange: onChangeProp,\n onChangeEnd: onChangeEndProp,\n onChangeStart: onChangeStartProp,\n onSwatchClick,\n ...rest\n } = useFormControlProps({ isInvalid, ...props })\n const [\n {\n \"aria-readonly\": ariaReadonly,\n disabled,\n readOnly,\n required,\n ...formControlProps\n },\n containerProps,\n ] = splitObject(rest, formControlProperties)\n\n const onChangeStartRef = useCallbackRef(onChangeStartProp)\n const onChangeEndRef = useCallbackRef(onChangeEndProp)\n const { supported: eyeDropperSupported, onOpen } = useEyeDropper()\n const [value, setValue] = useControllableState({\n defaultValue: defaultValue ?? fallbackValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const format = useMemo(\n () => formatProp ?? calcFormat(value || \"#ffffff\"),\n [value, formatProp],\n )\n const resolvedValue = convertColor(value, \"#ffffff\")(format) as string\n const timeoutId = useRef<any>(undefined)\n const isDraggingRef = useRef<boolean>(false)\n const [parsedValue, setParsedValue] = useState<Hsva>(\n convertHsva(resolvedValue, fallbackValue),\n )\n const { a, h, s, v } = parsedValue\n const withAlpha = format.endsWith(\"a\")\n const isInteractive = !(disabled || readOnly)\n\n const channels: Channel[] = useMemo(() => {\n if (resolvedValue.startsWith(\"hsl\")) {\n const { a, h, l, s } = convertHsla(resolvedValue, fallbackValue)\n\n let channels: Channel[] = [\n { label: \"H\", max: 360, min: 0, space: \"h\", value: Math.round(h) },\n {\n label: \"S(%)\",\n max: 100,\n min: 0,\n space: \"s\",\n value: Math.round(s * 100),\n },\n {\n label: \"L(%)\",\n max: 100,\n min: 0,\n space: \"l\",\n value: Math.round(l * 100),\n },\n ]\n\n if (withAlpha) {\n channels = [\n ...channels,\n {\n label: \"A(%)\",\n max: 100,\n min: 0,\n space: \"a\",\n value: Math.round(a * 100),\n },\n ]\n }\n\n return channels\n } else {\n const { a, b, g, r } = convertRgba(resolvedValue, fallbackValue)\n\n let channels: Channel[] = [\n { label: \"R\", max: 255, min: 0, space: \"r\", value: Math.round(r) },\n { label: \"G\", max: 255, min: 0, space: \"g\", value: Math.round(g) },\n { label: \"B\", max: 255, min: 0, space: \"b\", value: Math.round(b) },\n ]\n\n if (withAlpha) {\n channels = [\n ...channels,\n {\n label: \"A(%)\",\n max: 100,\n min: 0,\n space: \"a\",\n value: Math.round(a * 100),\n },\n ]\n }\n\n return channels\n }\n }, [resolvedValue, withAlpha, fallbackValue])\n\n const onChange = useCallback(\n (value: Partial<Hsva> | string) => {\n if (isString(value)) {\n setParsedValue(convertHsva(value, fallbackValue))\n } else {\n setParsedValue((prev) => ({ ...prev, ...value }))\n }\n },\n [fallbackValue],\n )\n\n const onChangeStart = useCallback(\n (value: Partial<Hsva>) => {\n window.clearTimeout(timeoutId.current)\n\n isDraggingRef.current = true\n\n const { a, h, s, v } = { ...parsedValue, ...value }\n\n const nextValue = hsvTo([h, s, v, a], fallbackValue)(format)\n\n if (nextValue) onChangeStartRef(nextValue)\n },\n [onChangeStartRef, fallbackValue, parsedValue, format],\n )\n\n const onChangeEnd = useCallback(\n (value: Partial<Hsva> | string) => {\n window.clearTimeout(timeoutId.current)\n\n timeoutId.current = window.setTimeout(() => {\n isDraggingRef.current = false\n }, 200)\n\n let nextValue: string | undefined\n\n if (isString(value)) {\n nextValue = convertColor(value, fallbackValue)(format)\n } else {\n const { a, h, s, v } = { ...parsedValue, ...value }\n\n nextValue = hsvTo([h, s, v, a], fallbackValue)(format)\n }\n\n if (nextValue) onChangeEndRef(nextValue)\n },\n [onChangeEndRef, fallbackValue, parsedValue, format],\n )\n\n const onChannelChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>, space: Space) => {\n let n = Math.floor(parseFloat(ev.target.value))\n\n if (isNaN(n)) n = 0\n\n if ([\"a\", \"l\", \"s\"].includes(space)) n = n / 100\n\n let nextValue: string | undefined\n\n if (resolvedValue.startsWith(\"hsl\")) {\n const { a, h, l, s } = Object.assign(\n convertHsla(resolvedValue, fallbackValue),\n { [space]: n },\n )\n\n nextValue = hslaTo([h, s, l, a], fallbackValue)(format)\n } else {\n const { a, b, g, r } = Object.assign(\n convertRgba(resolvedValue, fallbackValue),\n { [space]: n },\n )\n\n nextValue = rgbaTo([r, g, b, a], fallbackValue)(format)\n }\n\n if (!nextValue) return\n\n onChange(nextValue)\n onChangeEnd(nextValue)\n },\n [resolvedValue, onChange, onChangeEnd, fallbackValue, format],\n )\n\n const onEyeDropperClick = useCallback(async () => {\n try {\n const { sRGBHex } = (await onOpen()) ?? {}\n\n if (!sRGBHex) return\n\n onChange(sRGBHex)\n onChangeEnd(sRGBHex)\n } catch {}\n }, [onOpen, onChange, onChangeEnd])\n\n useUpdateEffect(() => {\n const nextValue = hsvTo([h, s, v, a], fallbackValue)(format)\n\n if (nextValue) setValue(nextValue)\n }, [h, s, v, a])\n\n useUpdateEffect(() => {\n if (isDraggingRef.current) return\n\n if (valueProp) setParsedValue(convertHsva(valueProp, fallbackValue))\n }, [valueProp])\n\n useUpdateEffect(() => {\n if (!value) return\n\n const nextValue = convertColor(value, fallbackValue)(format)\n\n if (nextValue) setValue(nextValue)\n }, [format])\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n ...formControlProps,\n ...containerProps,\n }),\n [containerProps, formControlProps],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}, ref = null) => ({\n ...formControlProps,\n \"aria-readonly\": ariaReadonly,\n ...props,\n id,\n ref,\n type: \"hidden\",\n name,\n disabled,\n readOnly,\n required,\n value: resolvedValue,\n }),\n [\n formControlProps,\n ariaReadonly,\n id,\n name,\n resolvedValue,\n required,\n disabled,\n readOnly,\n ],\n )\n\n const getSaturationSliderProps: PropGetter<SaturationSliderProps> =\n useCallback(\n (props = {}, ref = null) => ({\n disabled,\n isInvalid,\n readOnly,\n required,\n ...props,\n ref,\n value: [h, s, v],\n onChange: handlerAll(props.onChange, ([, s, v]) => onChange({ s, v })),\n onChangeEnd: handlerAll(props.onChangeEnd, ([, s, v]) =>\n onChangeEnd({ s, v }),\n ),\n onChangeStart: handlerAll(props.onChangeStart, ([, s, v]) =>\n onChangeStart({ s, v }),\n ),\n }),\n [\n required,\n disabled,\n readOnly,\n isInvalid,\n h,\n s,\n v,\n onChange,\n onChangeStart,\n onChangeEnd,\n ],\n )\n\n const getHueSliderProps: PropGetter<HueSliderProps> = useCallback(\n (props = {}, ref = null) => ({\n disabled,\n isInvalid,\n readOnly,\n required,\n ...props,\n ref,\n value: h,\n onChange: handlerAll(props.onChange, (h) => onChange({ h })),\n onChangeEnd: handlerAll(props.onChangeEnd, (h) => onChangeEnd({ h })),\n onChangeStart: handlerAll(props.onChangeStart, (h) =>\n onChangeStart({ h }),\n ),\n }),\n [\n required,\n disabled,\n readOnly,\n isInvalid,\n h,\n onChange,\n onChangeStart,\n onChangeEnd,\n ],\n )\n\n const getAlphaSliderProps: PropGetter<AlphaSliderProps> = useCallback(\n (props = {}, ref = null) => ({\n disabled,\n isInvalid,\n readOnly,\n required,\n ...props,\n ref,\n color: hsvTo([h, s, v, a], fallbackValue)(format),\n value: a,\n onChange: handlerAll(props.onChange, (a) => onChange({ a })),\n onChangeEnd: handlerAll(props.onChangeEnd, (a) => onChangeEnd({ a })),\n onChangeStart: handlerAll(props.onChangeStart, (a) =>\n onChangeStart({ a }),\n ),\n }),\n [\n fallbackValue,\n required,\n disabled,\n readOnly,\n isInvalid,\n format,\n h,\n s,\n v,\n a,\n onChange,\n onChangeStart,\n onChangeEnd,\n ],\n )\n\n const getChannelProps: RequiredPropGetter<\n { space: Space } & InputProps,\n InputProps\n > = useCallback(\n ({ space, ...props }, ref = null) => {\n return {\n disabled,\n isInvalid,\n readOnly,\n required,\n ...props,\n ref,\n type: \"number\",\n step: 1,\n onChange: handlerAll(props.onChange, (ev) =>\n onChannelChange(ev, space),\n ),\n } as Dict\n },\n [required, disabled, readOnly, isInvalid, onChannelChange],\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 onClick: handlerAll(props.onClick, onEyeDropperClick),\n }),\n [disabled, onEyeDropperClick],\n )\n\n const getSwatchProps: PropGetter<ColorSwatchProps> = useCallback(\n ({ color, ...props } = {}, ref = null) => ({\n \"aria-label\": `Select ${color} as the color`,\n disabled,\n readOnly,\n ...props,\n ref,\n color,\n onClick: handlerAll(props.onClick, () => {\n if (!isString(color)) return\n\n onSwatchClick?.(color)\n onChange(color)\n onChangeEnd(color)\n }),\n }),\n [disabled, readOnly, onSwatchClick, onChange, onChangeEnd],\n )\n\n return {\n channels,\n disabled,\n eyeDropperSupported,\n isInteractive,\n readOnly,\n value: resolvedValue,\n withAlpha,\n getAlphaSliderProps,\n getChannelProps,\n getContainerProps,\n getEyeDropperProps,\n getHueSliderProps,\n getInputProps,\n getSaturationSliderProps,\n getSwatchProps,\n onChange,\n }\n}\n\nexport type UseColorSelectorReturn = ReturnType<typeof useColorSelector>\n"],"mappings":";;;AAeA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;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,SAAS,QAAQ,gBAAgB;AA6BvD,IAAM,cAAc,CAAC,OAAe,aAA4B;AAlEhE;AAmEE,MAAI,CAAC,GAAG,GAAG,GAAG,CAAC,KAAI,iBAAY,OAAO,QAAQ,MAA3B,YAAgC,CAAC,GAAG,GA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,EACF;AACF;","names":["a","h","s","channels","value","v","props"]}
1
+ {"version":3,"sources":["../src/use-color-selector.ts"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n PropGetter,\n RequiredPropGetter,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { FormControlOptions } from \"@yamada-ui/form-control\"\nimport type { InputProps } from \"@yamada-ui/input\"\nimport type { ColorFormat, Dict } from \"@yamada-ui/utils\"\nimport type { ChangeEvent } from \"react\"\nimport type { AlphaSliderProps } from \"./alpha-slider\"\nimport type { ColorSwatchProps } from \"./color-swatch\"\nimport type { HueSliderProps } from \"./hue-slider\"\nimport type { SaturationSliderProps } from \"./saturation-slider\"\nimport {\n formControlProperties,\n useFormControlProps,\n} from \"@yamada-ui/form-control\"\nimport { useControllableState } from \"@yamada-ui/use-controllable-state\"\nimport { useEyeDropper } from \"@yamada-ui/use-eye-dropper\"\nimport {\n calcFormat,\n convertColor,\n createContext,\n handlerAll,\n hslaTo,\n hsvTo,\n isString,\n parseToHsla,\n parseToHsv,\n parseToRgba,\n rgbaTo,\n splitObject,\n useCallbackRef,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useMemo, useRef, useState } from \"react\"\n\ntype Space = keyof Hsla | keyof Rgba\ninterface Hsla {\n a: number\n h: number\n l: number\n s: number\n}\ninterface Rgba {\n a: number\n b: number\n g: number\n r: number\n}\ninterface Hsva {\n a: number\n h: number\n s: number\n v: number\n}\ninterface Channel {\n label: string\n max: number\n min: number\n space: Space\n value: number\n}\n\nconst convertHsla = (value: string, fallback?: string): Hsla => {\n let [h, s, l, a] = parseToHsla(value, fallback) ?? [0, 0, 1, 1]\n\n if (a > 1) a = 1\n\n return { a, h, l, s }\n}\n\nconst convertRgba = (value: string, fallback?: string): Rgba => {\n let [r, g, b, a] = parseToRgba(value, fallback) ?? [255, 255, 255, 1]\n\n if (r > 255) r = 255\n if (g > 255) g = 255\n if (b > 255) b = 255\n if (a > 1) a = 1\n\n return { a, b, g, r }\n}\n\nconst convertHsva = (value: string, fallback?: string): Hsva => {\n const [h, s, v, a] = parseToHsv(value, fallback)\n\n return { a, h, s, v }\n}\n\ninterface ColorSelectorContext {\n channels: Channel[]\n eyeDropperSupported: boolean\n isInteractive: boolean\n styles: { [key: string]: CSSUIObject | undefined }\n value: string\n withAlpha: boolean\n getAlphaSliderProps: PropGetter<AlphaSliderProps>\n getChannelProps: RequiredPropGetter<{ space: Space } & InputProps, InputProps>\n getEyeDropperProps: PropGetter<\"button\">\n getHueSliderProps: PropGetter<HueSliderProps>\n getSwatchProps: PropGetter<ColorSwatchProps>\n onChange: (value: Partial<Hsva> | string) => void\n size?: ThemeProps<\"ColorSelector\">[\"size\"]\n disabled?: boolean\n readOnly?: boolean\n}\n\nexport const [ColorSelectorProvider, useColorSelectorContext] =\n createContext<ColorSelectorContext>({\n name: \"ColorSelectorContext\",\n errorMessage: `useColorSelectorContext returned is 'undefined'. Seems you forgot to wrap the components in \"<ColorSelector />\"`,\n })\n\ninterface UseColorSelectorOptions {\n /**\n * The base `id` to use for the color selector.\n */\n id?: string\n /**\n * The name attribute of the hidden `input` field.\n * This is particularly useful in forms.\n */\n name?: string\n /**\n * The initial value of the color selector.\n */\n defaultValue?: string\n /**\n * The fallback value returned when color determination fails.\n */\n fallbackValue?: string\n /**\n * Color format. For example, `hex`, `rgba`, etc.\n *\n * @default \"hexa\"\n */\n format?: ColorFormat\n /**\n * The value of the color selector.\n */\n value?: string\n /**\n * Function called whenever the color selector value changes.\n */\n onChange?: (value: string) => void\n /**\n * Function called when the user is done selecting a new value.\n */\n onChangeEnd?: (value: string) => void\n /**\n * Function called when the user starts selecting a new value.\n */\n onChangeStart?: (value: string) => void\n /**\n * Function called whenever the color swatch click.\n */\n onSwatchClick?: (value: string) => void\n}\n\nexport interface UseColorSelectorBaseProps\n extends UseColorSelectorOptions,\n FormControlOptions {}\n\nexport interface UseColorSelectorProps\n extends Omit<HTMLUIProps, \"children\" | \"defaultValue\" | \"onChange\">,\n UseColorSelectorBaseProps {}\n\nexport const useColorSelector = ({\n isInvalid,\n ...props\n}: UseColorSelectorProps) => {\n const {\n id,\n name,\n defaultValue,\n fallbackValue,\n format: formatProp,\n value: valueProp,\n onChange: onChangeProp,\n onChangeEnd: onChangeEndProp,\n onChangeStart: onChangeStartProp,\n onSwatchClick,\n ...rest\n } = useFormControlProps({ isInvalid, ...props })\n const [\n {\n \"aria-readonly\": ariaReadonly,\n disabled,\n readOnly,\n required,\n ...formControlProps\n },\n containerProps,\n ] = splitObject(rest, formControlProperties)\n\n const onChangeStartRef = useCallbackRef(onChangeStartProp)\n const onChangeEndRef = useCallbackRef(onChangeEndProp)\n const { supported: eyeDropperSupported, onOpen } = useEyeDropper()\n const [value, setValue] = useControllableState({\n defaultValue: defaultValue ?? fallbackValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const format = useMemo(\n () => formatProp ?? calcFormat(value || \"#ffffff\"),\n [value, formatProp],\n )\n const resolvedValue = convertColor(value, \"#ffffff\")(format) as string\n const timeoutId = useRef<any>(undefined)\n const isDraggingRef = useRef<boolean>(false)\n const [parsedValue, setParsedValue] = useState<Hsva>(\n convertHsva(resolvedValue, fallbackValue),\n )\n const { a, h, s, v } = parsedValue\n const withAlpha = format.endsWith(\"a\")\n const isInteractive = !(disabled || readOnly)\n\n const channels: Channel[] = useMemo(() => {\n if (resolvedValue.startsWith(\"hsl\")) {\n const { a, h, l, s } = convertHsla(resolvedValue, fallbackValue)\n\n let channels: Channel[] = [\n { label: \"H\", max: 360, min: 0, space: \"h\", value: Math.round(h) },\n {\n label: \"S(%)\",\n max: 100,\n min: 0,\n space: \"s\",\n value: Math.round(s * 100),\n },\n {\n label: \"L(%)\",\n max: 100,\n min: 0,\n space: \"l\",\n value: Math.round(l * 100),\n },\n ]\n\n if (withAlpha) {\n channels = [\n ...channels,\n {\n label: \"A(%)\",\n max: 100,\n min: 0,\n space: \"a\",\n value: Math.round(a * 100),\n },\n ]\n }\n\n return channels\n } else {\n const { a, b, g, r } = convertRgba(resolvedValue, fallbackValue)\n\n let channels: Channel[] = [\n { label: \"R\", max: 255, min: 0, space: \"r\", value: Math.round(r) },\n { label: \"G\", max: 255, min: 0, space: \"g\", value: Math.round(g) },\n { label: \"B\", max: 255, min: 0, space: \"b\", value: Math.round(b) },\n ]\n\n if (withAlpha) {\n channels = [\n ...channels,\n {\n label: \"A(%)\",\n max: 100,\n min: 0,\n space: \"a\",\n value: Math.round(a * 100),\n },\n ]\n }\n\n return channels\n }\n }, [resolvedValue, withAlpha, fallbackValue])\n\n const onChange = useCallback(\n (value: Partial<Hsva> | string) => {\n if (isString(value)) {\n setParsedValue(convertHsva(value, fallbackValue))\n } else {\n setParsedValue((prev) => ({ ...prev, ...value }))\n }\n },\n [fallbackValue],\n )\n\n const onChangeStart = useCallback(\n (value: Partial<Hsva>) => {\n window.clearTimeout(timeoutId.current)\n\n isDraggingRef.current = true\n\n const { a, h, s, v } = { ...parsedValue, ...value }\n\n const nextValue = hsvTo([h, s, v, a], fallbackValue)(format)\n\n if (nextValue) onChangeStartRef(nextValue)\n },\n [onChangeStartRef, fallbackValue, parsedValue, format],\n )\n\n const onChangeEnd = useCallback(\n (value: Partial<Hsva> | string) => {\n window.clearTimeout(timeoutId.current)\n\n timeoutId.current = window.setTimeout(() => {\n isDraggingRef.current = false\n }, 200)\n\n let nextValue: string | undefined\n\n if (isString(value)) {\n nextValue = convertColor(value, fallbackValue)(format)\n } else {\n const { a, h, s, v } = { ...parsedValue, ...value }\n\n nextValue = hsvTo([h, s, v, a], fallbackValue)(format)\n }\n\n if (nextValue) onChangeEndRef(nextValue)\n },\n [onChangeEndRef, fallbackValue, parsedValue, format],\n )\n\n const onChannelChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>, space: Space) => {\n let n = Math.floor(parseFloat(ev.target.value))\n\n if (isNaN(n)) n = 0\n\n if ([\"a\", \"l\", \"s\"].includes(space)) n = n / 100\n\n let nextValue: string | undefined\n\n if (resolvedValue.startsWith(\"hsl\")) {\n const { a, h, l, s } = Object.assign(\n convertHsla(resolvedValue, fallbackValue),\n { [space]: n },\n )\n\n nextValue = hslaTo([h, s, l, a], fallbackValue)(format)\n } else {\n const { a, b, g, r } = Object.assign(\n convertRgba(resolvedValue, fallbackValue),\n { [space]: n },\n )\n\n nextValue = rgbaTo([r, g, b, a], fallbackValue)(format)\n }\n\n if (!nextValue) return\n\n onChange(nextValue)\n onChangeEnd(nextValue)\n },\n [resolvedValue, onChange, onChangeEnd, fallbackValue, format],\n )\n\n const onEyeDropperClick = useCallback(async () => {\n try {\n const { sRGBHex } = (await onOpen()) ?? {}\n\n if (!sRGBHex) return\n\n onChange(sRGBHex)\n onChangeEnd(sRGBHex)\n } catch {}\n }, [onOpen, onChange, onChangeEnd])\n\n useUpdateEffect(() => {\n const nextValue = hsvTo([h, s, v, a], fallbackValue)(format)\n\n if (nextValue) setValue(nextValue)\n }, [h, s, v, a])\n\n useUpdateEffect(() => {\n if (isDraggingRef.current) return\n\n if (valueProp) setParsedValue(convertHsva(valueProp, fallbackValue))\n }, [valueProp])\n\n useUpdateEffect(() => {\n if (!value) return\n\n const nextValue = convertColor(value, fallbackValue)(format)\n\n if (nextValue) setValue(nextValue)\n }, [format])\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n ...props,\n ref,\n ...formControlProps,\n ...containerProps,\n }),\n [containerProps, formControlProps],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}, ref = null) => ({\n ...formControlProps,\n \"aria-readonly\": ariaReadonly,\n ...props,\n id,\n ref,\n type: \"hidden\",\n name,\n disabled,\n readOnly,\n required,\n value: resolvedValue,\n }),\n [\n formControlProps,\n ariaReadonly,\n id,\n name,\n resolvedValue,\n required,\n disabled,\n readOnly,\n ],\n )\n\n const getSaturationSliderProps: PropGetter<SaturationSliderProps> =\n useCallback(\n (props = {}, ref = null) => ({\n disabled,\n isInvalid,\n readOnly,\n required,\n ...props,\n ref,\n value: [h, s, v],\n onChange: handlerAll(props.onChange, ([, s, v]) => onChange({ s, v })),\n onChangeEnd: handlerAll(props.onChangeEnd, ([, s, v]) =>\n onChangeEnd({ s, v }),\n ),\n onChangeStart: handlerAll(props.onChangeStart, ([, s, v]) =>\n onChangeStart({ s, v }),\n ),\n }),\n [\n required,\n disabled,\n readOnly,\n isInvalid,\n h,\n s,\n v,\n onChange,\n onChangeStart,\n onChangeEnd,\n ],\n )\n\n const getHueSliderProps: PropGetter<HueSliderProps> = useCallback(\n (props = {}, ref = null) => ({\n disabled,\n isInvalid,\n readOnly,\n required,\n ...props,\n ref,\n value: h,\n onChange: handlerAll(props.onChange, (h) => onChange({ h })),\n onChangeEnd: handlerAll(props.onChangeEnd, (h) => onChangeEnd({ h })),\n onChangeStart: handlerAll(props.onChangeStart, (h) =>\n onChangeStart({ h }),\n ),\n }),\n [\n required,\n disabled,\n readOnly,\n isInvalid,\n h,\n onChange,\n onChangeStart,\n onChangeEnd,\n ],\n )\n\n const getAlphaSliderProps: PropGetter<AlphaSliderProps> = useCallback(\n (props = {}, ref = null) => ({\n disabled,\n isInvalid,\n readOnly,\n required,\n ...props,\n ref,\n color: hsvTo([h, s, v, a], fallbackValue)(format),\n value: a,\n onChange: handlerAll(props.onChange, (a) => onChange({ a })),\n onChangeEnd: handlerAll(props.onChangeEnd, (a) => onChangeEnd({ a })),\n onChangeStart: handlerAll(props.onChangeStart, (a) =>\n onChangeStart({ a }),\n ),\n }),\n [\n fallbackValue,\n required,\n disabled,\n readOnly,\n isInvalid,\n format,\n h,\n s,\n v,\n a,\n onChange,\n onChangeStart,\n onChangeEnd,\n ],\n )\n\n const getChannelProps: RequiredPropGetter<\n { space: Space } & InputProps,\n InputProps\n > = useCallback(\n ({ space, ...props }, ref = null) => {\n return {\n disabled,\n isInvalid,\n readOnly,\n required,\n ...props,\n ref,\n type: \"number\",\n step: 1,\n onChange: handlerAll(props.onChange, (ev) =>\n onChannelChange(ev, space),\n ),\n } as Dict\n },\n [required, disabled, readOnly, isInvalid, onChannelChange],\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 onClick: handlerAll(props.onClick, onEyeDropperClick),\n }),\n [disabled, onEyeDropperClick],\n )\n\n const getSwatchProps: PropGetter<ColorSwatchProps> = useCallback(\n ({ color, ...props } = {}, ref = null) => ({\n \"aria-label\": `Select ${color} as the color`,\n disabled,\n readOnly,\n role: \"button\",\n ...props,\n ref,\n color,\n onClick: handlerAll(props.onClick, () => {\n if (!isString(color)) return\n\n onSwatchClick?.(color)\n onChange(color)\n onChangeEnd(color)\n }),\n }),\n [disabled, readOnly, onSwatchClick, onChange, onChangeEnd],\n )\n\n return {\n channels,\n disabled,\n eyeDropperSupported,\n isInteractive,\n readOnly,\n value: resolvedValue,\n withAlpha,\n getAlphaSliderProps,\n getChannelProps,\n getContainerProps,\n getEyeDropperProps,\n getHueSliderProps,\n getInputProps,\n getSaturationSliderProps,\n getSwatchProps,\n onChange,\n }\n}\n\nexport type UseColorSelectorReturn = ReturnType<typeof useColorSelector>\n"],"mappings":";;;AAeA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;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,SAAS,QAAQ,gBAAgB;AA6BvD,IAAM,cAAc,CAAC,OAAe,aAA4B;AAlEhE;AAmEE,MAAI,CAAC,GAAG,GAAG,GAAG,CAAC,KAAI,iBAAY,OAAO,QAAQ,MAA3B,YAAgC,CAAC,GAAG,GAAG,GAAG,CAAC;AAE9D,MAAI,IAAI,EAAG,KAAI;AAEf,SAAO,EAAE,GAAG,GAAG,GAAG,E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
2
2
  import {
3
3
  ColorSwatch
4
- } from "./chunk-YYXTR7W7.mjs";
4
+ } from "./chunk-OPWYRBSP.mjs";
5
5
  import {
6
6
  useColorSelectorContext
7
- } from "./chunk-X2EYDFTM.mjs";
7
+ } from "./chunk-C7UAG4TH.mjs";
8
8
 
9
9
  // src/color-selector-swatches.tsx
10
10
  import { forwardRef, ui } from "@yamada-ui/core";
@@ -69,4 +69,4 @@ ColorSelectorSwatches.__ui__ = "ColorSelectorSwatches";
69
69
  export {
70
70
  ColorSelectorSwatches
71
71
  };
72
- //# sourceMappingURL=chunk-JRSGQRFQ.mjs.map
72
+ //# sourceMappingURL=chunk-NNVWH4IX.mjs.map
@@ -79,6 +79,8 @@ var ColorSwatch = forwardRef((props, ref) => {
79
79
  {
80
80
  ref,
81
81
  className: cx("ui-color-swatch", className),
82
+ "aria-roledescription": "color swatch",
83
+ role: "img",
82
84
  ...isRounded ? { rounded: "fallback(full, 9999px)" } : {},
83
85
  __css: css,
84
86
  ...rest,
@@ -107,4 +109,4 @@ ColorSwatch.__ui__ = "ColorSwatch";
107
109
  export {
108
110
  ColorSwatch
109
111
  };
110
- //# sourceMappingURL=chunk-YYXTR7W7.mjs.map
112
+ //# sourceMappingURL=chunk-OPWYRBSP.mjs.map
@@ -1 +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 } 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 {...(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,UAAU;AAyHT;AAvHV,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,WAAoC,CAAC,OAAO,QAAQ;AAC7E,QAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,eAAe,KAAK;AACzE,QAAM;AAAA,IACJ;AAAA,IACA,QAAQ;AAAA,IACR;AAA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UIObject,\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 } 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-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,UAAU;AA2HT;AAzHV,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,Q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AC/D,mBAAS,IAAI,CAACA,QAAO,UACpB;AAAA,QAAC,GAAG;AAAA,QAAH;AAAA,UAEC,OAAO;AAAA,YACL,QAAQ;AAAA,YACR,MAAM;AAAA,YACN,UAAU;AAAA,YACV,OAAO;AAAA,YACP,KAAK;AAAA,YACL,GAAG,OAAO;AAAA,UACZ;AAAA,UACC,GAAI,YAAY,EAAE,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"]}
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import {
3
3
  useColorSelectorContext
4
- } from "./chunk-X2EYDFTM.mjs";
4
+ } from "./chunk-C7UAG4TH.mjs";
5
5
 
6
6
  // src/color-selector-channels.tsx
7
7
  import { forwardRef, ui } from "@yamada-ui/core";
@@ -65,4 +65,4 @@ export {
65
65
  ColorSelectorChannels,
66
66
  ColorSelectorChannel
67
67
  };
68
- //# sourceMappingURL=chunk-YPPP72VM.mjs.map
68
+ //# sourceMappingURL=chunk-RJOBF4LI.mjs.map
@@ -6,13 +6,13 @@ import {
6
6
  } from "./chunk-Z2KAER2U.mjs";
7
7
  import {
8
8
  ColorSelector
9
- } from "./chunk-HJMXAALX.mjs";
9
+ } from "./chunk-TED6IK5W.mjs";
10
10
  import {
11
11
  EyeDropperIcon
12
- } from "./chunk-DJST5TK2.mjs";
12
+ } from "./chunk-6XIZXZXV.mjs";
13
13
  import {
14
14
  ColorSwatch
15
- } from "./chunk-YYXTR7W7.mjs";
15
+ } from "./chunk-OPWYRBSP.mjs";
16
16
 
17
17
  // src/color-picker.tsx
18
18
  import {
@@ -256,4 +256,4 @@ ColorPickerEyeDropper.__ui__ = "ColorPickerEyeDropper";
256
256
  export {
257
257
  ColorPicker
258
258
  };
259
- //# sourceMappingURL=chunk-CRZIBBBY.mjs.map
259
+ //# sourceMappingURL=chunk-RW7HCRPR.mjs.map
@@ -4,17 +4,17 @@ import {
4
4
  } from "./chunk-YU3KOEL7.mjs";
5
5
  import {
6
6
  ColorSelectorBody
7
- } from "./chunk-LJHUX2RB.mjs";
7
+ } from "./chunk-XSZZBWND.mjs";
8
8
  import {
9
9
  ColorSelectorChannels
10
- } from "./chunk-YPPP72VM.mjs";
10
+ } from "./chunk-RJOBF4LI.mjs";
11
11
  import {
12
12
  ColorSelectorSwatches
13
- } from "./chunk-JRSGQRFQ.mjs";
13
+ } from "./chunk-NNVWH4IX.mjs";
14
14
  import {
15
15
  ColorSelectorProvider,
16
16
  useColorSelector
17
- } from "./chunk-X2EYDFTM.mjs";
17
+ } from "./chunk-C7UAG4TH.mjs";
18
18
 
19
19
  // src/color-selector.tsx
20
20
  import {
@@ -129,4 +129,4 @@ ColorSelector.__ui__ = "ColorSelector";
129
129
  export {
130
130
  ColorSelector
131
131
  };
132
- //# sourceMappingURL=chunk-HJMXAALX.mjs.map
132
+ //# sourceMappingURL=chunk-TED6IK5W.mjs.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-FP3X3PED.mjs";
8
8
  import {
9
9
  useColorSelectorContext
10
- } from "./chunk-X2EYDFTM.mjs";
10
+ } from "./chunk-C7UAG4TH.mjs";
11
11
 
12
12
  // src/color-selector-sliders.tsx
13
13
  import { forwardRef, ui } from "@yamada-ui/core";
@@ -66,4 +66,4 @@ ColorSelectorSliders.__ui__ = "ColorSelectorSliders";
66
66
  export {
67
67
  ColorSelectorSliders
68
68
  };
69
- //# sourceMappingURL=chunk-HPP26MVU.mjs.map
69
+ //# sourceMappingURL=chunk-UKR7WWUY.mjs.map
@@ -1,16 +1,16 @@
1
1
  "use client"
2
2
  import {
3
3
  ColorSelectorEyeDropper
4
- } from "./chunk-DJST5TK2.mjs";
4
+ } from "./chunk-6XIZXZXV.mjs";
5
5
  import {
6
6
  ColorSelectorSliders
7
- } from "./chunk-HPP26MVU.mjs";
7
+ } from "./chunk-UKR7WWUY.mjs";
8
8
  import {
9
9
  ColorSwatch
10
- } from "./chunk-YYXTR7W7.mjs";
10
+ } from "./chunk-OPWYRBSP.mjs";
11
11
  import {
12
12
  useColorSelectorContext
13
- } from "./chunk-X2EYDFTM.mjs";
13
+ } from "./chunk-C7UAG4TH.mjs";
14
14
 
15
15
  // src/color-selector-body.tsx
16
16
  import { forwardRef, ui } from "@yamada-ui/core";
@@ -74,4 +74,4 @@ ColorSelectorBody.__ui__ = "ColorSelectorBody";
74
74
  export {
75
75
  ColorSelectorBody
76
76
  };
77
- //# sourceMappingURL=chunk-LJHUX2RB.mjs.map
77
+ //# sourceMappingURL=chunk-XSZZBWND.mjs.map
@@ -421,6 +421,7 @@ var useColorSelector = ({
421
421
  "aria-label": `Select ${color} as the color`,
422
422
  disabled,
423
423
  readOnly,
424
+ role: "button",
424
425
  ...props2,
425
426
  ref,
426
427
  color,
@@ -1193,6 +1194,8 @@ var ColorSwatch = (0, import_core5.forwardRef)((props, ref) => {
1193
1194
  {
1194
1195
  ref,
1195
1196
  className: (0, import_utils7.cx)("ui-color-swatch", className),
1197
+ "aria-roledescription": "color swatch",
1198
+ role: "img",
1196
1199
  ...isRounded ? { rounded: "fallback(full, 9999px)" } : {},
1197
1200
  __css: css,
1198
1201
  ...rest,