@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
@@ -386,7 +386,7 @@ var useColorSelector = ({
386
386
  );
387
387
  const getSwatchProps = useCallback(
388
388
  ({ color, ...props2 } = {}, ref = null) => ({
389
- "aria-label": `select ${color} as the color`,
389
+ "aria-label": `Select ${color} as the color`,
390
390
  disabled,
391
391
  readOnly,
392
392
  ...props2,
@@ -427,4 +427,4 @@ export {
427
427
  useColorSelectorContext,
428
428
  useColorSelector
429
429
  };
430
- //# sourceMappingURL=chunk-L2ILNXB4.mjs.map
430
+ //# sourceMappingURL=chunk-5QT7SRA4.mjs.map
@@ -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":";;;AAOA;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AAEP,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAE9B;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,EACA;AAAA,OACK;AAEP,SAAS,aAAa,SAAS,QAAQ,gBAAgB;AAkBvD,IAAM,cAAc,CAAC,OAAe,aAA4B;AApDhE;AAqDE,MAAI,CAAC,GAAG,GAAG,GAAG,CAAC,KAAI,iBAAY,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,MAAI,CAAC,GAAG,GAAG,GAAG,CAAC,KAAI,iBAAY,OAAO,QAAQ,MAA3B,YAAgC,CAAC,KAAK,KAAK,KAAK,CAAC;AAEpE,MAAI,IAAI;AAAK,QAAI;AACjB,MAAI,IAAI;AAAK,QAAI;AACjB,MAAI,IAAI;AAAK,QAAI;AACjB,MAAI,IAAI;AAAG,QAAI;AAEf,SAAO,EAAE,GAAG,GAAG,GAAG,EAAE;AACtB;AAEA,IAAM,cAAc,CAAC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,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,SAAS,WAAWA,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"]}
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":";;;AAOA;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AAEP,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAE9B;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,EACA;AAAA,OACK;AAEP,SAAS,aAAa,SAAS,QAAQ,gBAAgB;AAkBvD,IAAM,cAAc,CAAC,OAAe,aAA4B;AApDhE;AAqDE,MAAI,CAAC,GAAG,GAAG,GAAG,CAAC,KAAI,iBAAY,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,MAAI,CAAC,GAAG,GAAG,GAAG,CAAC,KAAI,iBAAY,OAAO,QAAQ,MAA3B,YAAgC,CAAC,KAAK,KAAK,KAAK,CAAC;AAEpE,MAAI,IAAI;AAAK,QAAI;AACjB,MAAI,IAAI;AAAK,QAAI;AACjB,MAAI,IAAI;AAAK,QAAI;AACjB,MAAI,IAAI;AAAG,QAAI;AAEf,SAAO,EAAE,GAAG,GAAG,GAAG,EAAE;AACtB;AAEA,IAAM,cAAc,CAAC,OAAe,aAA4B;AAC9D,QAAM,CAAC,GAAG,GAAG,GAAG,CAAC,IAAI,WAAW,OAAO,QAAQ;AAE/C,SAAO,EAAE,GAAG,GAAG,GAAG,EAAE;AACtB;AAwBO,IAAM,CAAC,uBAAuB,uBAAuB,IAC1D,cAAoC;AAAA,EAClC,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAyD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ChB,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"]}
@@ -4,17 +4,17 @@ import {
4
4
  } from "./chunk-RR6V37S5.mjs";
5
5
  import {
6
6
  ColorSelectorBody
7
- } from "./chunk-5CQI26IR.mjs";
7
+ } from "./chunk-FUV4QZBE.mjs";
8
8
  import {
9
9
  ColorSelectorChannels
10
- } from "./chunk-2PW2Z2XD.mjs";
10
+ } from "./chunk-YXQQHV2S.mjs";
11
11
  import {
12
12
  ColorSelectorSwatches
13
- } from "./chunk-NGSPXJBL.mjs";
13
+ } from "./chunk-Y6662BW7.mjs";
14
14
  import {
15
15
  ColorSelectorProvider,
16
16
  useColorSelector
17
- } from "./chunk-L2ILNXB4.mjs";
17
+ } from "./chunk-5QT7SRA4.mjs";
18
18
 
19
19
  // src/color-selector.tsx
20
20
  import {
@@ -127,4 +127,4 @@ var ColorSelector = forwardRef(
127
127
  export {
128
128
  ColorSelector
129
129
  };
130
- //# sourceMappingURL=chunk-ZUPKUHBV.mjs.map
130
+ //# sourceMappingURL=chunk-C4ZOHCKU.mjs.map
@@ -1,16 +1,16 @@
1
1
  "use client"
2
2
  import {
3
3
  ColorSelectorEyeDropper
4
- } from "./chunk-NMHU434U.mjs";
4
+ } from "./chunk-SMXYADBA.mjs";
5
5
  import {
6
6
  ColorSelectorSliders
7
- } from "./chunk-JFTUHZYL.mjs";
7
+ } from "./chunk-JOX5PPY7.mjs";
8
8
  import {
9
9
  ColorSwatch
10
10
  } from "./chunk-UQWAM6TA.mjs";
11
11
  import {
12
12
  useColorSelectorContext
13
- } from "./chunk-L2ILNXB4.mjs";
13
+ } from "./chunk-5QT7SRA4.mjs";
14
14
 
15
15
  // src/color-selector-body.tsx
16
16
  import { forwardRef, ui } from "@yamada-ui/core";
@@ -72,4 +72,4 @@ var ColorSelectorBody = forwardRef(
72
72
  export {
73
73
  ColorSelectorBody
74
74
  };
75
- //# sourceMappingURL=chunk-5CQI26IR.mjs.map
75
+ //# sourceMappingURL=chunk-FUV4QZBE.mjs.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-YD5QBKEV.mjs";
8
8
  import {
9
9
  useColorSelectorContext
10
- } from "./chunk-L2ILNXB4.mjs";
10
+ } from "./chunk-5QT7SRA4.mjs";
11
11
 
12
12
  // src/color-selector-sliders.tsx
13
13
  import { forwardRef, ui } from "@yamada-ui/core";
@@ -65,4 +65,4 @@ var ColorSelectorSliders = forwardRef(
65
65
  export {
66
66
  ColorSelectorSliders
67
67
  };
68
- //# sourceMappingURL=chunk-JFTUHZYL.mjs.map
68
+ //# sourceMappingURL=chunk-JOX5PPY7.mjs.map
@@ -6,10 +6,10 @@ import {
6
6
  } from "./chunk-SBN7FEOE.mjs";
7
7
  import {
8
8
  ColorSelector
9
- } from "./chunk-ZUPKUHBV.mjs";
9
+ } from "./chunk-C4ZOHCKU.mjs";
10
10
  import {
11
11
  EyeDropperIcon
12
- } from "./chunk-NMHU434U.mjs";
12
+ } from "./chunk-SMXYADBA.mjs";
13
13
  import {
14
14
  ColorSwatch
15
15
  } from "./chunk-UQWAM6TA.mjs";
@@ -227,4 +227,4 @@ var ColorPickerEyeDropper = forwardRef(
227
227
  export {
228
228
  ColorPicker
229
229
  };
230
- //# sourceMappingURL=chunk-ONIOGROX.mjs.map
230
+ //# sourceMappingURL=chunk-SDO53ZU7.mjs.map
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import {
3
3
  useColorSelectorContext
4
- } from "./chunk-L2ILNXB4.mjs";
4
+ } from "./chunk-5QT7SRA4.mjs";
5
5
 
6
6
  // src/color-selector-eye-dropper.tsx
7
7
  import { IconButton } from "@yamada-ui/button";
@@ -53,4 +53,4 @@ export {
53
53
  ColorSelectorEyeDropper,
54
54
  EyeDropperIcon
55
55
  };
56
- //# sourceMappingURL=chunk-NMHU434U.mjs.map
56
+ //# sourceMappingURL=chunk-SMXYADBA.mjs.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-UQWAM6TA.mjs";
5
5
  import {
6
6
  useColorSelectorContext
7
- } from "./chunk-L2ILNXB4.mjs";
7
+ } from "./chunk-5QT7SRA4.mjs";
8
8
 
9
9
  // src/color-selector-swatches.tsx
10
10
  import { forwardRef, ui } from "@yamada-ui/core";
@@ -67,4 +67,4 @@ var ColorSelectorSwatches = forwardRef(
67
67
  export {
68
68
  ColorSelectorSwatches
69
69
  };
70
- //# sourceMappingURL=chunk-NGSPXJBL.mjs.map
70
+ //# sourceMappingURL=chunk-Y6662BW7.mjs.map
@@ -1,7 +1,7 @@
1
1
  "use client"
2
2
  import {
3
3
  useColorSelectorContext
4
- } from "./chunk-L2ILNXB4.mjs";
4
+ } from "./chunk-5QT7SRA4.mjs";
5
5
 
6
6
  // src/color-selector-channels.tsx
7
7
  import { forwardRef, ui } from "@yamada-ui/core";
@@ -62,4 +62,4 @@ export {
62
62
  ColorSelectorChannels,
63
63
  ColorSelectorChannel
64
64
  };
65
- //# sourceMappingURL=chunk-2PW2Z2XD.mjs.map
65
+ //# sourceMappingURL=chunk-YXQQHV2S.mjs.map
@@ -411,7 +411,7 @@ var useColorSelector = ({
411
411
  );
412
412
  const getSwatchProps = (0, import_react.useCallback)(
413
413
  ({ color, ...props2 } = {}, ref = null) => ({
414
- "aria-label": `select ${color} as the color`,
414
+ "aria-label": `Select ${color} as the color`,
415
415
  disabled,
416
416
  readOnly,
417
417
  ...props2,