@yamada-ui/color-picker 2.0.0-next-20240513040311 → 2.0.0-next-20240516121223

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-L2ILNXB4.mjs → chunk-5QT7SRA4.mjs} +2 -2
  2. package/dist/{chunk-L2ILNXB4.mjs.map → chunk-5QT7SRA4.mjs.map} +1 -1
  3. package/dist/{chunk-ZUPKUHBV.mjs → chunk-C4ZOHCKU.mjs} +5 -5
  4. package/dist/{chunk-5CQI26IR.mjs → chunk-FUV4QZBE.mjs} +4 -4
  5. package/dist/{chunk-JFTUHZYL.mjs → chunk-JOX5PPY7.mjs} +2 -2
  6. package/dist/{chunk-ONIOGROX.mjs → chunk-SDO53ZU7.mjs} +3 -3
  7. package/dist/{chunk-NMHU434U.mjs → chunk-SMXYADBA.mjs} +2 -2
  8. package/dist/{chunk-NGSPXJBL.mjs → chunk-Y6662BW7.mjs} +2 -2
  9. package/dist/{chunk-2PW2Z2XD.mjs → chunk-YXQQHV2S.mjs} +2 -2
  10. package/dist/color-picker.js +1 -1
  11. package/dist/color-picker.js.map +1 -1
  12. package/dist/color-picker.mjs +8 -8
  13. package/dist/color-selector-body.js.map +1 -1
  14. package/dist/color-selector-body.mjs +4 -4
  15. package/dist/color-selector-channels.js.map +1 -1
  16. package/dist/color-selector-channels.mjs +2 -2
  17. package/dist/color-selector-eye-dropper.js.map +1 -1
  18. package/dist/color-selector-eye-dropper.mjs +2 -2
  19. package/dist/color-selector-sliders.js.map +1 -1
  20. package/dist/color-selector-sliders.mjs +2 -2
  21. package/dist/color-selector-swatches.js.map +1 -1
  22. package/dist/color-selector-swatches.mjs +2 -2
  23. package/dist/color-selector.js +1 -1
  24. package/dist/color-selector.js.map +1 -1
  25. package/dist/color-selector.mjs +7 -7
  26. package/dist/index.js +1 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +8 -8
  29. package/dist/use-color-selector.js +1 -1
  30. package/dist/use-color-selector.js.map +1 -1
  31. package/dist/use-color-selector.mjs +1 -1
  32. package/package.json +3 -3
  33. /package/dist/{chunk-ZUPKUHBV.mjs.map → chunk-C4ZOHCKU.mjs.map} +0 -0
  34. /package/dist/{chunk-5CQI26IR.mjs.map → chunk-FUV4QZBE.mjs.map} +0 -0
  35. /package/dist/{chunk-JFTUHZYL.mjs.map → chunk-JOX5PPY7.mjs.map} +0 -0
  36. /package/dist/{chunk-ONIOGROX.mjs.map → chunk-SDO53ZU7.mjs.map} +0 -0
  37. /package/dist/{chunk-NMHU434U.mjs.map → chunk-SMXYADBA.mjs.map} +0 -0
  38. /package/dist/{chunk-NGSPXJBL.mjs.map → chunk-Y6662BW7.mjs.map} +0 -0
  39. /package/dist/{chunk-2PW2Z2XD.mjs.map → chunk-YXQQHV2S.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -1,19 +1,19 @@
1
1
  "use client"
2
2
  import {
3
3
  ColorPicker
4
- } from "./chunk-ONIOGROX.mjs";
4
+ } from "./chunk-SDO53ZU7.mjs";
5
5
  import "./chunk-SBN7FEOE.mjs";
6
6
  import {
7
7
  ColorSelector
8
- } from "./chunk-ZUPKUHBV.mjs";
8
+ } from "./chunk-C4ZOHCKU.mjs";
9
9
  import {
10
10
  SaturationSlider
11
11
  } from "./chunk-RR6V37S5.mjs";
12
12
  import "./chunk-KKQ3MOXJ.mjs";
13
- import "./chunk-5CQI26IR.mjs";
14
- import "./chunk-2PW2Z2XD.mjs";
15
- import "./chunk-NMHU434U.mjs";
16
- import "./chunk-JFTUHZYL.mjs";
13
+ import "./chunk-FUV4QZBE.mjs";
14
+ import "./chunk-YXQQHV2S.mjs";
15
+ import "./chunk-SMXYADBA.mjs";
16
+ import "./chunk-JOX5PPY7.mjs";
17
17
  import {
18
18
  HueSlider
19
19
  } from "./chunk-K3QQKPFT.mjs";
@@ -21,11 +21,11 @@ import {
21
21
  AlphaSlider
22
22
  } from "./chunk-YD5QBKEV.mjs";
23
23
  import "./chunk-R4DLOKLT.mjs";
24
- import "./chunk-NGSPXJBL.mjs";
24
+ import "./chunk-Y6662BW7.mjs";
25
25
  import {
26
26
  ColorSwatch
27
27
  } from "./chunk-UQWAM6TA.mjs";
28
- import "./chunk-L2ILNXB4.mjs";
28
+ import "./chunk-5QT7SRA4.mjs";
29
29
  export {
30
30
  AlphaSlider,
31
31
  ColorPicker,
@@ -392,7 +392,7 @@ var useColorSelector = ({
392
392
  );
393
393
  const getSwatchProps = (0, import_react.useCallback)(
394
394
  ({ color, ...props2 } = {}, ref = null) => ({
395
- "aria-label": `select ${color} as the color`,
395
+ "aria-label": `Select ${color} as the color`,
396
396
  disabled,
397
397
  readOnly,
398
398
  ...props2,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/use-color-selector.ts"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n UIPropGetter,\n ThemeProps,\n RequiredUIPropGetter,\n} from \"@yamada-ui/core\"\nimport {\n useFormControlProps,\n type FormControlOptions,\n formControlProperties,\n} from \"@yamada-ui/form-control\"\nimport type { InputProps } from \"@yamada-ui/input\"\nimport { useControllableState } from \"@yamada-ui/use-controllable-state\"\nimport { useEyeDropper } from \"@yamada-ui/use-eye-dropper\"\nimport type { ColorFormat, Dict, Merge } from \"@yamada-ui/utils\"\nimport {\n calcFormat,\n convertColor,\n createContext,\n handlerAll,\n hsvTo,\n isString,\n parseToHsv,\n useCallbackRef,\n useUpdateEffect,\n omitObject,\n parseToRgba,\n parseToHsla,\n rgbaTo,\n hslaTo,\n pickObject,\n} from \"@yamada-ui/utils\"\nimport type { ChangeEvent } from \"react\"\nimport { useCallback, useMemo, useRef, useState } 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\"\n\ntype Space = keyof Hsla | keyof Rgba\ntype Hsla = { h: number; s: number; l: number; a: number }\ntype Rgba = { r: number; g: number; b: number; a: number }\ntype Hsva = { h: number; s: number; v: number; a: number }\ntype Channel = {\n label: string\n space: Space\n value: number\n min: number\n max: 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 { h, s, l, a }\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 { r, g, b, a }\n}\n\nconst convertHsva = (value: string, fallback?: string): Hsva => {\n const [h, s, v, a] = parseToHsv(value, fallback)\n\n return { h, s, v, a }\n}\n\ntype ColorSelectorContext = {\n value: string\n onChange: (value: string | Partial<Hsva>) => void\n eyeDropperSupported: boolean\n withAlpha: boolean\n isInteractive: boolean\n disabled?: boolean\n readOnly?: boolean\n channels: Channel[]\n size?: ThemeProps<\"ColorSelector\">[\"size\"]\n getHueSliderProps: UIPropGetter<\"input\", HueSliderProps, HueSliderProps>\n getAlphaSliderProps: UIPropGetter<\"input\", AlphaSliderProps, AlphaSliderProps>\n getEyeDropperProps: UIPropGetter<\"button\">\n getChannelProps: RequiredUIPropGetter<\n \"input\",\n Merge<InputProps, { space: Space }>,\n InputProps\n >\n getSwatchProps: UIPropGetter<\"div\", ColorSwatchProps, ColorSwatchProps>\n styles: Record<string, CSSUIObject>\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\ntype 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 value of the color selector.\n */\n value?: 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 * Function called whenever the color selector value changes.\n */\n onChange?: (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 when the user is done selecting a new value.\n */\n onChangeEnd?: (value: string) => void\n /**\n * Color format. For example, `hex`, `rgba`, etc.\n *\n * @default \"hexa\"\n */\n format?: ColorFormat\n /**\n * Function called whenever the color swatch click.\n */\n onSwatchClick?: (value: string) => void\n}\n\nexport type UseColorSelectorBaseProps = UseColorSelectorOptions &\n FormControlOptions\n\nexport type UseColorSelectorProps = Omit<\n HTMLUIProps<\"div\">,\n \"defaultValue\" | \"onChange\" | \"children\"\n> &\n UseColorSelectorBaseProps\n\nexport const useColorSelector = ({\n isInvalid,\n ...props\n}: UseColorSelectorProps) => {\n let {\n id,\n name,\n value: valueProp,\n defaultValue,\n fallbackValue,\n onChange: onChangeProp,\n onChangeStart: onChangeStartProp,\n onChangeEnd: onChangeEndProp,\n format,\n required,\n disabled,\n readOnly,\n onSwatchClick,\n ...rest\n } = useFormControlProps({ isInvalid, ...props })\n\n const onChangeStartRef = useCallbackRef(onChangeStartProp)\n const onChangeEndRef = useCallbackRef(onChangeEndProp)\n const { supported: eyeDropperSupported, onOpen } = useEyeDropper()\n const [value, setValue] = useControllableState({\n value: valueProp,\n defaultValue: defaultValue ?? fallbackValue,\n onChange: onChangeProp,\n })\n const resolvedValue = value ?? \"#ffffff\"\n const timeoutId = useRef<any>(undefined)\n const formatRef = useRef<ColorFormat>(format ?? calcFormat(resolvedValue))\n const isDraggingRef = useRef<boolean>(false)\n const [parsedValue, setParsedValue] = useState<Hsva>(\n convertHsva(resolvedValue, fallbackValue),\n )\n const { h, s, v, a } = parsedValue\n const withAlpha = formatRef.current.endsWith(\"a\")\n const isInteractive = !(disabled || readOnly)\n\n const channels: Channel[] = useMemo(() => {\n if (resolvedValue.startsWith(\"hsl\")) {\n const { h, s, l, a } = convertHsla(resolvedValue, fallbackValue)\n\n let channels: Channel[] = [\n { label: \"H\", space: \"h\", value: Math.round(h), min: 0, max: 360 },\n {\n label: \"S(%)\",\n space: \"s\",\n value: Math.round(s * 100),\n min: 0,\n max: 100,\n },\n {\n label: \"L(%)\",\n space: \"l\",\n value: Math.round(l * 100),\n min: 0,\n max: 100,\n },\n ]\n\n if (withAlpha) {\n channels = [\n ...channels,\n {\n label: \"A(%)\",\n space: \"a\",\n value: Math.round(a * 100),\n min: 0,\n max: 100,\n },\n ]\n }\n\n return channels\n } else {\n const { r, g, b, a } = convertRgba(resolvedValue, fallbackValue)\n\n let channels: Channel[] = [\n { label: \"R\", space: \"r\", value: Math.round(r), min: 0, max: 255 },\n { label: \"G\", space: \"g\", value: Math.round(g), min: 0, max: 255 },\n { label: \"B\", space: \"b\", value: Math.round(b), min: 0, max: 255 },\n ]\n\n if (withAlpha) {\n channels = [\n ...channels,\n {\n label: \"A(%)\",\n space: \"a\",\n value: Math.round(a * 100),\n min: 0,\n max: 100,\n },\n ]\n }\n\n return channels\n }\n }, [resolvedValue, withAlpha, fallbackValue])\n\n const onChange = useCallback(\n (value: string | Partial<Hsva>) => {\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 { h, s, v, a } = { ...parsedValue, ...value }\n\n const nextValue = hsvTo([h, s, v, a], fallbackValue)(formatRef.current)\n\n if (nextValue) onChangeStartRef(nextValue)\n },\n [formatRef, onChangeStartRef, fallbackValue, parsedValue],\n )\n\n const onChangeEnd = useCallback(\n (value: string | Partial<Hsva>) => {\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)(formatRef.current)\n } else {\n const { h, s, v, a } = { ...parsedValue, ...value }\n\n nextValue = hsvTo([h, s, v, a], fallbackValue)(formatRef.current)\n }\n\n if (nextValue) onChangeEndRef(nextValue)\n },\n [formatRef, onChangeEndRef, fallbackValue, parsedValue],\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 ([\"s\", \"l\", \"a\"].includes(space)) n = n / 100\n\n let nextValue: string | undefined\n\n if (resolvedValue.startsWith(\"hsl\")) {\n const { h, s, l, a } = Object.assign(\n convertHsla(resolvedValue, fallbackValue),\n { [space]: n },\n )\n\n nextValue = hslaTo([h, s, l, a], fallbackValue)(formatRef.current)\n } else {\n const { r, g, b, a } = Object.assign(\n convertRgba(resolvedValue, fallbackValue),\n { [space]: n },\n )\n\n nextValue = rgbaTo([r, g, b, a], fallbackValue)(formatRef.current)\n }\n\n if (!nextValue) return\n\n onChange(nextValue)\n onChangeEnd(nextValue)\n },\n [resolvedValue, onChange, onChangeEnd, formatRef, fallbackValue],\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)(formatRef.current)\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 (!format || !value) return\n\n formatRef.current = format\n\n const nextValue = convertColor(value, fallbackValue)(format)\n\n if (nextValue) setValue(nextValue)\n }, [format])\n\n const getContainerProps: UIPropGetter = (props = {}, ref = null) => ({\n ...props,\n ref,\n ...omitObject(rest, [\"aria-readonly\"]),\n })\n\n const getInputProps: UIPropGetter<\"input\"> = useCallback(\n (props = {}, ref = null) => ({\n ...pickObject(rest, formControlProperties),\n ...props,\n id,\n ref,\n type: \"hidden\",\n name,\n value: resolvedValue,\n required,\n disabled,\n readOnly,\n }),\n [disabled, id, name, readOnly, required, rest, resolvedValue],\n )\n\n const getSaturationSliderProps: UIPropGetter<\n \"input\",\n SaturationSliderProps,\n SaturationSliderProps\n > = useCallback(\n (props = {}, ref = null) => ({\n required,\n disabled,\n readOnly,\n isInvalid,\n ...props,\n ref,\n value: [h, s, v],\n onChange: handlerAll(props.onChange, ([, s, v]) => onChange({ s, v })),\n onChangeStart: handlerAll(props.onChangeStart, ([, s, v]) =>\n onChangeStart({ s, v }),\n ),\n onChangeEnd: handlerAll(props.onChangeEnd, ([, s, v]) =>\n onChangeEnd({ 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: UIPropGetter<\n \"input\",\n HueSliderProps,\n HueSliderProps\n > = useCallback(\n (props = {}, ref = null) => ({\n required,\n disabled,\n readOnly,\n isInvalid,\n ...props,\n ref,\n value: h,\n onChange: handlerAll(props.onChange, (h) => onChange({ h })),\n onChangeStart: handlerAll(props.onChangeStart, (h) =>\n onChangeStart({ h }),\n ),\n onChangeEnd: handlerAll(props.onChangeEnd, (h) => onChangeEnd({ h })),\n }),\n [\n required,\n disabled,\n readOnly,\n isInvalid,\n h,\n onChange,\n onChangeStart,\n onChangeEnd,\n ],\n )\n\n const getAlphaSliderProps: UIPropGetter<\n \"input\",\n AlphaSliderProps,\n AlphaSliderProps\n > = useCallback(\n (props = {}, ref = null) => ({\n required,\n disabled,\n readOnly,\n isInvalid,\n ...props,\n ref,\n value: a,\n color: hsvTo([h, s, v, a], fallbackValue)(formatRef.current),\n onChange: handlerAll(props.onChange, (a) => onChange({ a })),\n onChangeStart: handlerAll(props.onChangeStart, (a) =>\n onChangeStart({ a }),\n ),\n onChangeEnd: handlerAll(props.onChangeEnd, (a) => onChangeEnd({ a })),\n }),\n [\n fallbackValue,\n required,\n disabled,\n readOnly,\n isInvalid,\n formatRef,\n h,\n s,\n v,\n a,\n onChange,\n onChangeStart,\n onChangeEnd,\n ],\n )\n\n const getChannelProps: RequiredUIPropGetter<\n \"input\",\n Merge<InputProps, { space: Space }>,\n InputProps\n > = useCallback(\n ({ space, ...props }, ref = null) => {\n return {\n required,\n disabled,\n readOnly,\n isInvalid,\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: UIPropGetter<\"button\"> = useCallback(\n (props = {}, ref = null) => ({\n disabled,\n \"aria-label\": \"Pick a color\",\n ...props,\n ref,\n onClick: handlerAll(props.onClick, onEyeDropperClick),\n }),\n [disabled, onEyeDropperClick],\n )\n\n const getSwatchProps: UIPropGetter<\n \"div\",\n ColorSwatchProps,\n ColorSwatchProps\n > = 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 (!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 value: resolvedValue,\n onChange,\n eyeDropperSupported,\n withAlpha,\n isInteractive,\n disabled,\n readOnly,\n channels,\n getContainerProps,\n getInputProps,\n getSaturationSliderProps,\n getHueSliderProps,\n getAlphaSliderProps,\n getEyeDropperProps,\n getChannelProps,\n getSwatchProps,\n }\n}\n\nexport type UseColorSelectorReturn = ReturnType<typeof useColorSelector>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,0BAIO;AA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A,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["h","s","a","channels","value","v","props"]}
1
+ {"version":3,"sources":["../src/use-color-selector.ts"],"sourcesContent":["import type {\n CSSUIObject,\n HTMLUIProps,\n UIPropGetter,\n ThemeProps,\n RequiredUIPropGetter,\n} from \"@yamada-ui/core\"\nimport {\n useFormControlProps,\n type FormControlOptions,\n formControlProperties,\n} from \"@yamada-ui/form-control\"\nimport type { InputProps } from \"@yamada-ui/input\"\nimport { useControllableState } from \"@yamada-ui/use-controllable-state\"\nimport { useEyeDropper } from \"@yamada-ui/use-eye-dropper\"\nimport type { ColorFormat, Dict, Merge } from \"@yamada-ui/utils\"\nimport {\n calcFormat,\n convertColor,\n createContext,\n handlerAll,\n hsvTo,\n isString,\n parseToHsv,\n useCallbackRef,\n useUpdateEffect,\n omitObject,\n parseToRgba,\n parseToHsla,\n rgbaTo,\n hslaTo,\n pickObject,\n} from \"@yamada-ui/utils\"\nimport type { ChangeEvent } from \"react\"\nimport { useCallback, useMemo, useRef, useState } 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\"\n\ntype Space = keyof Hsla | keyof Rgba\ntype Hsla = { h: number; s: number; l: number; a: number }\ntype Rgba = { r: number; g: number; b: number; a: number }\ntype Hsva = { h: number; s: number; v: number; a: number }\ntype Channel = {\n label: string\n space: Space\n value: number\n min: number\n max: 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 { h, s, l, a }\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 { r, g, b, a }\n}\n\nconst convertHsva = (value: string, fallback?: string): Hsva => {\n const [h, s, v, a] = parseToHsv(value, fallback)\n\n return { h, s, v, a }\n}\n\ntype ColorSelectorContext = {\n value: string\n onChange: (value: string | Partial<Hsva>) => void\n eyeDropperSupported: boolean\n withAlpha: boolean\n isInteractive: boolean\n disabled?: boolean\n readOnly?: boolean\n channels: Channel[]\n size?: ThemeProps<\"ColorSelector\">[\"size\"]\n getHueSliderProps: UIPropGetter<\"input\", HueSliderProps, HueSliderProps>\n getAlphaSliderProps: UIPropGetter<\"input\", AlphaSliderProps, AlphaSliderProps>\n getEyeDropperProps: UIPropGetter<\"button\">\n getChannelProps: RequiredUIPropGetter<\n \"input\",\n Merge<InputProps, { space: Space }>,\n InputProps\n >\n getSwatchProps: UIPropGetter<\"div\", ColorSwatchProps, ColorSwatchProps>\n styles: Record<string, CSSUIObject>\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\ntype 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 value of the color selector.\n */\n value?: 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 * Function called whenever the color selector value changes.\n */\n onChange?: (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 when the user is done selecting a new value.\n */\n onChangeEnd?: (value: string) => void\n /**\n * Color format. For example, `hex`, `rgba`, etc.\n *\n * @default \"hexa\"\n */\n format?: ColorFormat\n /**\n * Function called whenever the color swatch click.\n */\n onSwatchClick?: (value: string) => void\n}\n\nexport type UseColorSelectorBaseProps = UseColorSelectorOptions &\n FormControlOptions\n\nexport type UseColorSelectorProps = Omit<\n HTMLUIProps<\"div\">,\n \"defaultValue\" | \"onChange\" | \"children\"\n> &\n UseColorSelectorBaseProps\n\nexport const useColorSelector = ({\n isInvalid,\n ...props\n}: UseColorSelectorProps) => {\n let {\n id,\n name,\n value: valueProp,\n defaultValue,\n fallbackValue,\n onChange: onChangeProp,\n onChangeStart: onChangeStartProp,\n onChangeEnd: onChangeEndProp,\n format,\n required,\n disabled,\n readOnly,\n onSwatchClick,\n ...rest\n } = useFormControlProps({ isInvalid, ...props })\n\n const onChangeStartRef = useCallbackRef(onChangeStartProp)\n const onChangeEndRef = useCallbackRef(onChangeEndProp)\n const { supported: eyeDropperSupported, onOpen } = useEyeDropper()\n const [value, setValue] = useControllableState({\n value: valueProp,\n defaultValue: defaultValue ?? fallbackValue,\n onChange: onChangeProp,\n })\n const resolvedValue = value ?? \"#ffffff\"\n const timeoutId = useRef<any>(undefined)\n const formatRef = useRef<ColorFormat>(format ?? calcFormat(resolvedValue))\n const isDraggingRef = useRef<boolean>(false)\n const [parsedValue, setParsedValue] = useState<Hsva>(\n convertHsva(resolvedValue, fallbackValue),\n )\n const { h, s, v, a } = parsedValue\n const withAlpha = formatRef.current.endsWith(\"a\")\n const isInteractive = !(disabled || readOnly)\n\n const channels: Channel[] = useMemo(() => {\n if (resolvedValue.startsWith(\"hsl\")) {\n const { h, s, l, a } = convertHsla(resolvedValue, fallbackValue)\n\n let channels: Channel[] = [\n { label: \"H\", space: \"h\", value: Math.round(h), min: 0, max: 360 },\n {\n label: \"S(%)\",\n space: \"s\",\n value: Math.round(s * 100),\n min: 0,\n max: 100,\n },\n {\n label: \"L(%)\",\n space: \"l\",\n value: Math.round(l * 100),\n min: 0,\n max: 100,\n },\n ]\n\n if (withAlpha) {\n channels = [\n ...channels,\n {\n label: \"A(%)\",\n space: \"a\",\n value: Math.round(a * 100),\n min: 0,\n max: 100,\n },\n ]\n }\n\n return channels\n } else {\n const { r, g, b, a } = convertRgba(resolvedValue, fallbackValue)\n\n let channels: Channel[] = [\n { label: \"R\", space: \"r\", value: Math.round(r), min: 0, max: 255 },\n { label: \"G\", space: \"g\", value: Math.round(g), min: 0, max: 255 },\n { label: \"B\", space: \"b\", value: Math.round(b), min: 0, max: 255 },\n ]\n\n if (withAlpha) {\n channels = [\n ...channels,\n {\n label: \"A(%)\",\n space: \"a\",\n value: Math.round(a * 100),\n min: 0,\n max: 100,\n },\n ]\n }\n\n return channels\n }\n }, [resolvedValue, withAlpha, fallbackValue])\n\n const onChange = useCallback(\n (value: string | Partial<Hsva>) => {\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 { h, s, v, a } = { ...parsedValue, ...value }\n\n const nextValue = hsvTo([h, s, v, a], fallbackValue)(formatRef.current)\n\n if (nextValue) onChangeStartRef(nextValue)\n },\n [formatRef, onChangeStartRef, fallbackValue, parsedValue],\n )\n\n const onChangeEnd = useCallback(\n (value: string | Partial<Hsva>) => {\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)(formatRef.current)\n } else {\n const { h, s, v, a } = { ...parsedValue, ...value }\n\n nextValue = hsvTo([h, s, v, a], fallbackValue)(formatRef.current)\n }\n\n if (nextValue) onChangeEndRef(nextValue)\n },\n [formatRef, onChangeEndRef, fallbackValue, parsedValue],\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 ([\"s\", \"l\", \"a\"].includes(space)) n = n / 100\n\n let nextValue: string | undefined\n\n if (resolvedValue.startsWith(\"hsl\")) {\n const { h, s, l, a } = Object.assign(\n convertHsla(resolvedValue, fallbackValue),\n { [space]: n },\n )\n\n nextValue = hslaTo([h, s, l, a], fallbackValue)(formatRef.current)\n } else {\n const { r, g, b, a } = Object.assign(\n convertRgba(resolvedValue, fallbackValue),\n { [space]: n },\n )\n\n nextValue = rgbaTo([r, g, b, a], fallbackValue)(formatRef.current)\n }\n\n if (!nextValue) return\n\n onChange(nextValue)\n onChangeEnd(nextValue)\n },\n [resolvedValue, onChange, onChangeEnd, formatRef, fallbackValue],\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)(formatRef.current)\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 (!format || !value) return\n\n formatRef.current = format\n\n const nextValue = convertColor(value, fallbackValue)(format)\n\n if (nextValue) setValue(nextValue)\n }, [format])\n\n const getContainerProps: UIPropGetter = (props = {}, ref = null) => ({\n ...props,\n ref,\n ...omitObject(rest, [\"aria-readonly\"]),\n })\n\n const getInputProps: UIPropGetter<\"input\"> = useCallback(\n (props = {}, ref = null) => ({\n ...pickObject(rest, formControlProperties),\n ...props,\n id,\n ref,\n type: \"hidden\",\n name,\n value: resolvedValue,\n required,\n disabled,\n readOnly,\n }),\n [disabled, id, name, readOnly, required, rest, resolvedValue],\n )\n\n const getSaturationSliderProps: UIPropGetter<\n \"input\",\n SaturationSliderProps,\n SaturationSliderProps\n > = useCallback(\n (props = {}, ref = null) => ({\n required,\n disabled,\n readOnly,\n isInvalid,\n ...props,\n ref,\n value: [h, s, v],\n onChange: handlerAll(props.onChange, ([, s, v]) => onChange({ s, v })),\n onChangeStart: handlerAll(props.onChangeStart, ([, s, v]) =>\n onChangeStart({ s, v }),\n ),\n onChangeEnd: handlerAll(props.onChangeEnd, ([, s, v]) =>\n onChangeEnd({ 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: UIPropGetter<\n \"input\",\n HueSliderProps,\n HueSliderProps\n > = useCallback(\n (props = {}, ref = null) => ({\n required,\n disabled,\n readOnly,\n isInvalid,\n ...props,\n ref,\n value: h,\n onChange: handlerAll(props.onChange, (h) => onChange({ h })),\n onChangeStart: handlerAll(props.onChangeStart, (h) =>\n onChangeStart({ h }),\n ),\n onChangeEnd: handlerAll(props.onChangeEnd, (h) => onChangeEnd({ h })),\n }),\n [\n required,\n disabled,\n readOnly,\n isInvalid,\n h,\n onChange,\n onChangeStart,\n onChangeEnd,\n ],\n )\n\n const getAlphaSliderProps: UIPropGetter<\n \"input\",\n AlphaSliderProps,\n AlphaSliderProps\n > = useCallback(\n (props = {}, ref = null) => ({\n required,\n disabled,\n readOnly,\n isInvalid,\n ...props,\n ref,\n value: a,\n color: hsvTo([h, s, v, a], fallbackValue)(formatRef.current),\n onChange: handlerAll(props.onChange, (a) => onChange({ a })),\n onChangeStart: handlerAll(props.onChangeStart, (a) =>\n onChangeStart({ a }),\n ),\n onChangeEnd: handlerAll(props.onChangeEnd, (a) => onChangeEnd({ a })),\n }),\n [\n fallbackValue,\n required,\n disabled,\n readOnly,\n isInvalid,\n formatRef,\n h,\n s,\n v,\n a,\n onChange,\n onChangeStart,\n onChangeEnd,\n ],\n )\n\n const getChannelProps: RequiredUIPropGetter<\n \"input\",\n Merge<InputProps, { space: Space }>,\n InputProps\n > = useCallback(\n ({ space, ...props }, ref = null) => {\n return {\n required,\n disabled,\n readOnly,\n isInvalid,\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: UIPropGetter<\"button\"> = useCallback(\n (props = {}, ref = null) => ({\n disabled,\n \"aria-label\": \"Pick a color\",\n ...props,\n ref,\n onClick: handlerAll(props.onClick, onEyeDropperClick),\n }),\n [disabled, onEyeDropperClick],\n )\n\n const getSwatchProps: UIPropGetter<\n \"div\",\n ColorSwatchProps,\n ColorSwatchProps\n > = 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 (!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 value: resolvedValue,\n onChange,\n eyeDropperSupported,\n withAlpha,\n isInteractive,\n disabled,\n readOnly,\n channels,\n getContainerProps,\n getInputProps,\n getSaturationSliderProps,\n getHueSliderProps,\n getAlphaSliderProps,\n getEyeDropperProps,\n getChannelProps,\n getSwatchProps,\n }\n}\n\nexport type UseColorSelectorReturn = ReturnType<typeof useColorSelector>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,0BAIO;AAEP,oCAAqC;AACrC,6BAA8B;AAE9B,mBAgBO;AAEP,mBAAuD;AAkBvD,IAAM,cAAc,CAAC,OAAe,aAA4B;AApDhE;AAqDE,MAAI,CAAC,GAAG,GAAG,GAAG,CAAC,KAAI,mCAAY,OAAO,QAAQ,MAA3B,YAAgC,CAAC,GAAG,GAAG,GAAG,CAAC;AAE9D,MAAI,IAAI;AAAG,QAAI;AAEf,SAAO,EAAE,GAAG,GAAG,GAAG,EAAE;AACtB;AAEA,IAAM,cAAc,CAAC,OAAe,aAA4B;AA5DhE;AA6DE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B;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,UAAU,UAAU,UAAU,WAAW,eAAe;AAAA,EAC3D;AAEA,QAAM,yBAA6C;AAAA,IACjD,CAACA,SAAQ,CAAC,GAAG,MAAM,UAAU;AAAA,MAC3B;AAAA,MACA,cAAc;AAAA,MACd,GAAGA;AAAA,MACH;AAAA,MACA,aAAS,yBAAWA,OAAM,SAAS,iBAAiB;AAAA,IACtD;AAAA,IACA,CAAC,UAAU,iBAAiB;AAAA,EAC9B;AAEA,QAAM,qBAIF;AAAA,IACF,CAAC,EAAE,OAAO,GAAGA,OAAM,IAAI,CAAC,GAAG,MAAM,UAAU;AAAA,MACzC,cAAc,UAAU,KAAK;AAAA,MAC7B;AAAA,MACA;AAAA,MACA,GAAGA;AAAA,MACH;AAAA,MACA;AAAA,MACA,aAAS,yBAAWA,OAAM,SAAS,MAAM;AACvC,YAAI,CAAC;AAAO;AAEZ,uDAAgB;AAChB,iBAAS,KAAK;AACd,oBAAY,KAAK;AAAA,MACnB,CAAC;AAAA,IACH;AAAA,IACA,CAAC,UAAU,UAAU,eAAe,UAAU,WAAW;AAAA,EAC3D;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["h","s","a","channels","value","v","props"]}
@@ -3,7 +3,7 @@ import {
3
3
  ColorSelectorProvider,
4
4
  useColorSelector,
5
5
  useColorSelectorContext
6
- } from "./chunk-L2ILNXB4.mjs";
6
+ } from "./chunk-5QT7SRA4.mjs";
7
7
  export {
8
8
  ColorSelectorProvider,
9
9
  useColorSelector,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/color-picker",
3
- "version": "2.0.0-next-20240513040311",
3
+ "version": "2.0.0-next-20240516121223",
4
4
  "description": "Yamada UI color picker component",
5
5
  "keywords": [
6
6
  "yamada",
@@ -41,14 +41,14 @@
41
41
  "@yamada-ui/form-control": "1.1.0",
42
42
  "@yamada-ui/use-disclosure": "1.0.13",
43
43
  "@yamada-ui/icon": "1.0.25",
44
- "@yamada-ui/input": "1.0.29",
44
+ "@yamada-ui/input": "1.0.30-next-20240516121223",
45
45
  "@yamada-ui/popover": "1.1.2",
46
46
  "@yamada-ui/portal": "1.0.14",
47
47
  "@yamada-ui/use-controllable-state": "1.0.13",
48
48
  "@yamada-ui/use-eye-dropper": "^1.0.10",
49
49
  "@yamada-ui/use-latest-ref": "^1.0.1",
50
50
  "@yamada-ui/use-outside-click": "1.0.13",
51
- "@yamada-ui/use-pan-event": "^1.0.14",
51
+ "@yamada-ui/use-pan-event": "^1.0.15-next-20240516121223",
52
52
  "@yamada-ui/use-size": "^1.0.13",
53
53
  "@yamada-ui/utils": "1.2.0"
54
54
  },