@yamada-ui/color-picker 1.0.6-dev-20240218063424 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@ import {
22
22
  useMultiComponentStyle,
23
23
  omitThemeProps
24
24
  } from "@yamada-ui/core";
25
- import { cx } from "@yamada-ui/utils";
25
+ import { cx, runIfFunc } from "@yamada-ui/utils";
26
26
  import { jsx, jsxs } from "react/jsx-runtime";
27
27
  var ColorSelector = forwardRef(
28
28
  ({ size, ...props }, ref) => {
@@ -32,6 +32,7 @@ var ColorSelector = forwardRef(
32
32
  });
33
33
  const {
34
34
  className,
35
+ children,
35
36
  withResult = true,
36
37
  withPicker = true,
37
38
  withChannel = true,
@@ -55,6 +56,7 @@ var ColorSelector = forwardRef(
55
56
  ...computedProps
56
57
  } = omitThemeProps(mergedProps);
57
58
  const {
59
+ value,
58
60
  getContainerProps,
59
61
  getInputProps,
60
62
  getSaturationSliderProps,
@@ -65,7 +67,7 @@ var ColorSelector = forwardRef(
65
67
  flexDirection: "column",
66
68
  ...styles.container
67
69
  };
68
- return /* @__PURE__ */ jsx(ColorSelectorProvider, { value: { styles, size, ...rest }, children: /* @__PURE__ */ jsxs(
70
+ return /* @__PURE__ */ jsx(ColorSelectorProvider, { value: { styles, size, value, ...rest }, children: /* @__PURE__ */ jsxs(
69
71
  ui.div,
70
72
  {
71
73
  ref,
@@ -113,7 +115,8 @@ var ColorSelector = forwardRef(
113
115
  ...swatchesProps
114
116
  }
115
117
  }
116
- )
118
+ ),
119
+ runIfFunc(children, { value })
117
120
  ]
118
121
  }
119
122
  ) });
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-RSF3HAQH.mjs";
6
6
  import {
7
7
  ColorSelector
8
- } from "./chunk-NKOO74IZ.mjs";
8
+ } from "./chunk-RLVNTNR5.mjs";
9
9
  import {
10
10
  EyeDropperIcon
11
11
  } from "./chunk-J62WY74P.mjs";
@@ -38,6 +38,7 @@ var ColorPicker = forwardRef(
38
38
  });
39
39
  let {
40
40
  className,
41
+ children,
41
42
  withEyeDropper = true,
42
43
  color,
43
44
  h,
@@ -131,7 +132,8 @@ var ColorPicker = forwardRef(
131
132
  alphaSliderProps,
132
133
  channelsProps,
133
134
  channelProps
134
- })
135
+ }),
136
+ children
135
137
  }
136
138
  )
137
139
  }
@@ -67,7 +67,7 @@ type ColorPickerOptions = {
67
67
  */
68
68
  portalProps?: Omit<PortalProps, "children">;
69
69
  };
70
- type ColorPickerProps = ThemeProps<"ColorPicker"> & UseColorPickerProps & ColorPickerOptions & Pick<ColorSelectorProps, "saturationSliderRef" | "saturationSliderProps" | "swatchesProps" | "hueSliderRef" | "hueSliderProps" | "alphaSliderRef" | "alphaSliderProps" | "channelsProps" | "channelProps">;
70
+ type ColorPickerProps = ThemeProps<"ColorPicker"> & UseColorPickerProps & ColorPickerOptions & Pick<ColorSelectorProps, "saturationSliderRef" | "saturationSliderProps" | "swatchesProps" | "hueSliderRef" | "hueSliderProps" | "alphaSliderRef" | "alphaSliderProps" | "channelsProps" | "channelProps" | "children">;
71
71
  /**
72
72
  * `ColorPicker` is a component used by the user to select a color or enter an arbitrary color value.
73
73
  *
@@ -67,7 +67,7 @@ type ColorPickerOptions = {
67
67
  */
68
68
  portalProps?: Omit<PortalProps, "children">;
69
69
  };
70
- type ColorPickerProps = ThemeProps<"ColorPicker"> & UseColorPickerProps & ColorPickerOptions & Pick<ColorSelectorProps, "saturationSliderRef" | "saturationSliderProps" | "swatchesProps" | "hueSliderRef" | "hueSliderProps" | "alphaSliderRef" | "alphaSliderProps" | "channelsProps" | "channelProps">;
70
+ type ColorPickerProps = ThemeProps<"ColorPicker"> & UseColorPickerProps & ColorPickerOptions & Pick<ColorSelectorProps, "saturationSliderRef" | "saturationSliderProps" | "swatchesProps" | "hueSliderRef" | "hueSliderProps" | "alphaSliderRef" | "alphaSliderProps" | "channelsProps" | "channelProps" | "children">;
71
71
  /**
72
72
  * `ColorPicker` is a component used by the user to select a color or enter an arbitrary color value.
73
73
  *
@@ -1664,6 +1664,7 @@ var ColorSelector = (0, import_core10.forwardRef)(
1664
1664
  });
1665
1665
  const {
1666
1666
  className,
1667
+ children,
1667
1668
  withResult = true,
1668
1669
  withPicker = true,
1669
1670
  withChannel = true,
@@ -1687,6 +1688,7 @@ var ColorSelector = (0, import_core10.forwardRef)(
1687
1688
  ...computedProps
1688
1689
  } = (0, import_core10.omitThemeProps)(mergedProps);
1689
1690
  const {
1691
+ value,
1690
1692
  getContainerProps,
1691
1693
  getInputProps,
1692
1694
  getSaturationSliderProps,
@@ -1697,7 +1699,7 @@ var ColorSelector = (0, import_core10.forwardRef)(
1697
1699
  flexDirection: "column",
1698
1700
  ...styles.container
1699
1701
  };
1700
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ColorSelectorProvider, { value: { styles, size, ...rest }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1702
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ColorSelectorProvider, { value: { styles, size, value, ...rest }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1701
1703
  import_core10.ui.div,
1702
1704
  {
1703
1705
  ref,
@@ -1745,7 +1747,8 @@ var ColorSelector = (0, import_core10.forwardRef)(
1745
1747
  ...swatchesProps
1746
1748
  }
1747
1749
  }
1748
- )
1750
+ ),
1751
+ (0, import_utils13.runIfFunc)(children, { value })
1749
1752
  ]
1750
1753
  }
1751
1754
  ) });
@@ -2080,6 +2083,7 @@ var ColorPicker = (0, import_core12.forwardRef)(
2080
2083
  });
2081
2084
  let {
2082
2085
  className,
2086
+ children,
2083
2087
  withEyeDropper = true,
2084
2088
  color,
2085
2089
  h,
@@ -2173,7 +2177,8 @@ var ColorPicker = (0, import_core12.forwardRef)(
2173
2177
  alphaSliderProps,
2174
2178
  channelsProps,
2175
2179
  channelProps
2176
- })
2180
+ }),
2181
+ children
2177
2182
  }
2178
2183
  )
2179
2184
  }
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  ColorPicker
3
- } from "./chunk-EHKRI7PV.mjs";
3
+ } from "./chunk-VVKPF2XB.mjs";
4
4
  import "./chunk-RSF3HAQH.mjs";
5
- import "./chunk-NKOO74IZ.mjs";
5
+ import "./chunk-RLVNTNR5.mjs";
6
6
  import "./chunk-3KASGDAY.mjs";
7
7
  import "./chunk-MAHWFXUG.mjs";
8
8
  import "./chunk-AZHLF5KM.mjs";
@@ -1,6 +1,6 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { ThemeProps, HTMLUIProps } from '@yamada-ui/core';
3
- import { ForwardedRef } from 'react';
3
+ import { ForwardedRef, ReactNode } from 'react';
4
4
  import { ColorSelectorBodyProps } from './color-selector-body.mjs';
5
5
  import { ColorSelectorChannelsProps } from './color-selector-channels.mjs';
6
6
  import { ColorSelectorSwatchesProps } from './color-selector-swatches.mjs';
@@ -52,6 +52,9 @@ type ColorSelectorOptions = {
52
52
  * Props for the channels component.
53
53
  */
54
54
  channelsProps?: ColorSelectorChannelsProps;
55
+ children?: ReactNode | ((props: {
56
+ value: string;
57
+ }) => ReactNode);
55
58
  };
56
59
  type ColorSelectorProps = ThemeProps<"ColorSelector"> & UseColorSelectorProps & ColorSelectorOptions & Pick<ColorSelectorBodyProps, "withResult" | "withEyeDropper" | "eyeDropperRef" | "eyeDropperProps" | "hueSliderRef" | "hueSliderProps" | "alphaSliderRef" | "alphaSliderProps"> & Pick<ColorSelectorSwatchesProps, "swatchesLabel" | "swatches" | "swatchesColumns" | "swatchProps"> & Pick<ColorSelectorChannelsProps, "channelProps">;
57
60
  /**
@@ -1,6 +1,6 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
2
  import { ThemeProps, HTMLUIProps } from '@yamada-ui/core';
3
- import { ForwardedRef } from 'react';
3
+ import { ForwardedRef, ReactNode } from 'react';
4
4
  import { ColorSelectorBodyProps } from './color-selector-body.js';
5
5
  import { ColorSelectorChannelsProps } from './color-selector-channels.js';
6
6
  import { ColorSelectorSwatchesProps } from './color-selector-swatches.js';
@@ -52,6 +52,9 @@ type ColorSelectorOptions = {
52
52
  * Props for the channels component.
53
53
  */
54
54
  channelsProps?: ColorSelectorChannelsProps;
55
+ children?: ReactNode | ((props: {
56
+ value: string;
57
+ }) => ReactNode);
55
58
  };
56
59
  type ColorSelectorProps = ThemeProps<"ColorSelector"> & UseColorSelectorProps & ColorSelectorOptions & Pick<ColorSelectorBodyProps, "withResult" | "withEyeDropper" | "eyeDropperRef" | "eyeDropperProps" | "hueSliderRef" | "hueSliderProps" | "alphaSliderRef" | "alphaSliderProps"> & Pick<ColorSelectorSwatchesProps, "swatchesLabel" | "swatches" | "swatchesColumns" | "swatchProps"> & Pick<ColorSelectorChannelsProps, "channelProps">;
57
60
  /**
@@ -1657,6 +1657,7 @@ var ColorSelector = (0, import_core10.forwardRef)(
1657
1657
  });
1658
1658
  const {
1659
1659
  className,
1660
+ children,
1660
1661
  withResult = true,
1661
1662
  withPicker = true,
1662
1663
  withChannel = true,
@@ -1680,6 +1681,7 @@ var ColorSelector = (0, import_core10.forwardRef)(
1680
1681
  ...computedProps
1681
1682
  } = (0, import_core10.omitThemeProps)(mergedProps);
1682
1683
  const {
1684
+ value,
1683
1685
  getContainerProps,
1684
1686
  getInputProps,
1685
1687
  getSaturationSliderProps,
@@ -1690,7 +1692,7 @@ var ColorSelector = (0, import_core10.forwardRef)(
1690
1692
  flexDirection: "column",
1691
1693
  ...styles.container
1692
1694
  };
1693
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ColorSelectorProvider, { value: { styles, size, ...rest }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1695
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ColorSelectorProvider, { value: { styles, size, value, ...rest }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1694
1696
  import_core10.ui.div,
1695
1697
  {
1696
1698
  ref,
@@ -1738,7 +1740,8 @@ var ColorSelector = (0, import_core10.forwardRef)(
1738
1740
  ...swatchesProps
1739
1741
  }
1740
1742
  }
1741
- )
1743
+ ),
1744
+ (0, import_utils13.runIfFunc)(children, { value })
1742
1745
  ]
1743
1746
  }
1744
1747
  ) });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ColorSelector
3
- } from "./chunk-NKOO74IZ.mjs";
3
+ } from "./chunk-RLVNTNR5.mjs";
4
4
  import "./chunk-3KASGDAY.mjs";
5
5
  import "./chunk-MAHWFXUG.mjs";
6
6
  import "./chunk-AZHLF5KM.mjs";
package/dist/index.js CHANGED
@@ -1664,6 +1664,7 @@ var ColorSelector = (0, import_core10.forwardRef)(
1664
1664
  });
1665
1665
  const {
1666
1666
  className,
1667
+ children,
1667
1668
  withResult = true,
1668
1669
  withPicker = true,
1669
1670
  withChannel = true,
@@ -1687,6 +1688,7 @@ var ColorSelector = (0, import_core10.forwardRef)(
1687
1688
  ...computedProps
1688
1689
  } = (0, import_core10.omitThemeProps)(mergedProps);
1689
1690
  const {
1691
+ value,
1690
1692
  getContainerProps,
1691
1693
  getInputProps,
1692
1694
  getSaturationSliderProps,
@@ -1697,7 +1699,7 @@ var ColorSelector = (0, import_core10.forwardRef)(
1697
1699
  flexDirection: "column",
1698
1700
  ...styles.container
1699
1701
  };
1700
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ColorSelectorProvider, { value: { styles, size, ...rest }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1702
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ColorSelectorProvider, { value: { styles, size, value, ...rest }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1701
1703
  import_core10.ui.div,
1702
1704
  {
1703
1705
  ref,
@@ -1745,7 +1747,8 @@ var ColorSelector = (0, import_core10.forwardRef)(
1745
1747
  ...swatchesProps
1746
1748
  }
1747
1749
  }
1748
- )
1750
+ ),
1751
+ (0, import_utils13.runIfFunc)(children, { value })
1749
1752
  ]
1750
1753
  }
1751
1754
  ) });
@@ -2087,6 +2090,7 @@ var ColorPicker = (0, import_core12.forwardRef)(
2087
2090
  });
2088
2091
  let {
2089
2092
  className,
2093
+ children,
2090
2094
  withEyeDropper = true,
2091
2095
  color,
2092
2096
  h,
@@ -2180,7 +2184,8 @@ var ColorPicker = (0, import_core12.forwardRef)(
2180
2184
  alphaSliderProps,
2181
2185
  channelsProps,
2182
2186
  channelProps
2183
- })
2187
+ }),
2188
+ children
2184
2189
  }
2185
2190
  )
2186
2191
  }
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ColorPicker
3
- } from "./chunk-EHKRI7PV.mjs";
3
+ } from "./chunk-VVKPF2XB.mjs";
4
4
  import "./chunk-RSF3HAQH.mjs";
5
5
  import {
6
6
  ColorSelector
7
- } from "./chunk-NKOO74IZ.mjs";
7
+ } from "./chunk-RLVNTNR5.mjs";
8
8
  import {
9
9
  SaturationSlider
10
10
  } from "./chunk-3KASGDAY.mjs";
@@ -75,7 +75,7 @@ type UseColorPickerOptions = {
75
75
  */
76
76
  colorSelectorProps?: ColorSelectorProps;
77
77
  };
78
- type UseColorPickerProps = Omit<HTMLUIProps<"input">, "size" | "offset" | "value" | "defaultValue" | "onChange"> & Omit<UseColorSelectorBaseProps, "id" | "name"> & Omit<PopoverProps, "initialFocusRef" | "closeOnButton" | "isOpen" | "trigger" | "autoFocus" | "restoreFocus" | "openDelay" | "closeDelay"> & Pick<ColorSelectorProps, "withPicker" | "withChannel" | "swatchesLabel" | "swatches" | "swatchesColumns"> & UseColorPickerOptions;
78
+ type UseColorPickerProps = Omit<HTMLUIProps<"input">, "size" | "offset" | "value" | "defaultValue" | "onChange" | "children"> & Omit<UseColorSelectorBaseProps, "id" | "name"> & Omit<PopoverProps, "initialFocusRef" | "closeOnButton" | "isOpen" | "trigger" | "autoFocus" | "restoreFocus" | "openDelay" | "closeDelay" | "children"> & Pick<ColorSelectorProps, "withPicker" | "withChannel" | "swatchesLabel" | "swatches" | "swatchesColumns"> & UseColorPickerOptions;
79
79
  declare const useColorPicker: ({ value: valueProp, defaultValue, fallbackValue, defaultColor, onChange: onChangeProp, onChangeStart, onChangeEnd, onSwatchClick, formatInput, closeOnBlur, closeOnEsc, placement, duration, defaultIsOpen, onOpen: onOpenProp, onClose: onCloseProp, allowInput, closeOnSelectSwatch, format, swatchesLabel, swatches, swatchesColumns, withPicker, withChannel, withResult, withColorSelectorEyeDropper, colorSelectorVariant, colorSelectorSize, colorSelectorColorScheme, ...rest }: UseColorPickerProps) => {
80
80
  value: string;
81
81
  eyeDropperSupported: boolean;
@@ -75,7 +75,7 @@ type UseColorPickerOptions = {
75
75
  */
76
76
  colorSelectorProps?: ColorSelectorProps;
77
77
  };
78
- type UseColorPickerProps = Omit<HTMLUIProps<"input">, "size" | "offset" | "value" | "defaultValue" | "onChange"> & Omit<UseColorSelectorBaseProps, "id" | "name"> & Omit<PopoverProps, "initialFocusRef" | "closeOnButton" | "isOpen" | "trigger" | "autoFocus" | "restoreFocus" | "openDelay" | "closeDelay"> & Pick<ColorSelectorProps, "withPicker" | "withChannel" | "swatchesLabel" | "swatches" | "swatchesColumns"> & UseColorPickerOptions;
78
+ type UseColorPickerProps = Omit<HTMLUIProps<"input">, "size" | "offset" | "value" | "defaultValue" | "onChange" | "children"> & Omit<UseColorSelectorBaseProps, "id" | "name"> & Omit<PopoverProps, "initialFocusRef" | "closeOnButton" | "isOpen" | "trigger" | "autoFocus" | "restoreFocus" | "openDelay" | "closeDelay" | "children"> & Pick<ColorSelectorProps, "withPicker" | "withChannel" | "swatchesLabel" | "swatches" | "swatchesColumns"> & UseColorPickerOptions;
79
79
  declare const useColorPicker: ({ value: valueProp, defaultValue, fallbackValue, defaultColor, onChange: onChangeProp, onChangeStart, onChangeEnd, onSwatchClick, formatInput, closeOnBlur, closeOnEsc, placement, duration, defaultIsOpen, onOpen: onOpenProp, onClose: onCloseProp, allowInput, closeOnSelectSwatch, format, swatchesLabel, swatches, swatchesColumns, withPicker, withChannel, withResult, withColorSelectorEyeDropper, colorSelectorVariant, colorSelectorSize, colorSelectorColorScheme, ...rest }: UseColorPickerProps) => {
80
80
  value: string;
81
81
  eyeDropperSupported: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/color-picker",
3
- "version": "1.0.6-dev-20240218063424",
3
+ "version": "1.1.0",
4
4
  "description": "Yamada UI color picker component",
5
5
  "keywords": [
6
6
  "yamada",
@@ -36,12 +36,12 @@
36
36
  "url": "https://github.com/hirotomoyamada/yamada-ui/issues"
37
37
  },
38
38
  "dependencies": {
39
- "@yamada-ui/button": "1.0.14-dev-20240218063424",
40
- "@yamada-ui/core": "1.4.0-dev-20240218063424",
41
- "@yamada-ui/form-control": "1.0.15-dev-20240218063424",
42
- "@yamada-ui/icon": "1.0.12-dev-20240218063424",
43
- "@yamada-ui/input": "1.0.15-dev-20240218063424",
44
- "@yamada-ui/popover": "1.0.13-dev-20240218063424",
39
+ "@yamada-ui/button": "1.0.14",
40
+ "@yamada-ui/core": "1.4.0",
41
+ "@yamada-ui/form-control": "1.0.15",
42
+ "@yamada-ui/icon": "1.0.12",
43
+ "@yamada-ui/input": "1.0.15",
44
+ "@yamada-ui/popover": "1.0.13",
45
45
  "@yamada-ui/portal": "1.0.5",
46
46
  "@yamada-ui/use-controllable-state": "1.0.5",
47
47
  "@yamada-ui/use-eye-dropper": "^1.0.2",