@yamada-ui/color-picker 1.0.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.
Files changed (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +28 -0
  3. package/dist/alpha-slider.d.mts +62 -0
  4. package/dist/alpha-slider.d.ts +62 -0
  5. package/dist/alpha-slider.js +438 -0
  6. package/dist/alpha-slider.mjs +8 -0
  7. package/dist/chunk-3EO2XBIZ.mjs +54 -0
  8. package/dist/chunk-3KASGDAY.mjs +122 -0
  9. package/dist/chunk-3N443XSV.mjs +105 -0
  10. package/dist/chunk-73BVTMII.mjs +73 -0
  11. package/dist/chunk-7QGCTVDG.mjs +66 -0
  12. package/dist/chunk-DTB2Z3IJ.mjs +278 -0
  13. package/dist/chunk-EMWFECJD.mjs +123 -0
  14. package/dist/chunk-HNVFOSAM.mjs +210 -0
  15. package/dist/chunk-KJS52X4M.mjs +330 -0
  16. package/dist/chunk-MAHWFXUG.mjs +294 -0
  17. package/dist/chunk-N2GG5L7Q.mjs +39 -0
  18. package/dist/chunk-NR2XCTSD.mjs +430 -0
  19. package/dist/chunk-PTTNJPGJ.mjs +98 -0
  20. package/dist/chunk-PVWIBTBL.mjs +67 -0
  21. package/dist/chunk-TFQ62YSQ.mjs +68 -0
  22. package/dist/chunk-U6OJ4TDG.mjs +127 -0
  23. package/dist/color-input.d.mts +79 -0
  24. package/dist/color-input.d.ts +79 -0
  25. package/dist/color-input.js +2283 -0
  26. package/dist/color-input.mjs +21 -0
  27. package/dist/color-picker-body.d.mts +38 -0
  28. package/dist/color-picker-body.d.ts +38 -0
  29. package/dist/color-picker-body.js +794 -0
  30. package/dist/color-picker-body.mjs +14 -0
  31. package/dist/color-picker-channels.d.mts +20 -0
  32. package/dist/color-picker-channels.d.ts +20 -0
  33. package/dist/color-picker-channels.js +101 -0
  34. package/dist/color-picker-channels.mjs +10 -0
  35. package/dist/color-picker-eye-dropper.d.mts +10 -0
  36. package/dist/color-picker-eye-dropper.d.ts +10 -0
  37. package/dist/color-picker-eye-dropper.js +88 -0
  38. package/dist/color-picker-eye-dropper.mjs +10 -0
  39. package/dist/color-picker-sliders.d.mts +30 -0
  40. package/dist/color-picker-sliders.d.ts +30 -0
  41. package/dist/color-picker-sliders.js +590 -0
  42. package/dist/color-picker-sliders.mjs +11 -0
  43. package/dist/color-picker-swatches.d.mts +34 -0
  44. package/dist/color-picker-swatches.d.ts +34 -0
  45. package/dist/color-picker-swatches.js +195 -0
  46. package/dist/color-picker-swatches.mjs +9 -0
  47. package/dist/color-picker.d.mts +59 -0
  48. package/dist/color-picker.d.ts +59 -0
  49. package/dist/color-picker.js +1790 -0
  50. package/dist/color-picker.mjs +19 -0
  51. package/dist/color-swatch.d.mts +36 -0
  52. package/dist/color-swatch.d.ts +36 -0
  53. package/dist/color-swatch.js +124 -0
  54. package/dist/color-swatch.mjs +6 -0
  55. package/dist/hue-slider.d.mts +56 -0
  56. package/dist/hue-slider.d.ts +56 -0
  57. package/dist/hue-slider.js +409 -0
  58. package/dist/hue-slider.mjs +8 -0
  59. package/dist/index.d.mts +23 -0
  60. package/dist/index.d.ts +23 -0
  61. package/dist/index.js +2295 -0
  62. package/dist/index.mjs +36 -0
  63. package/dist/saturation-slider.d.mts +33 -0
  64. package/dist/saturation-slider.d.ts +33 -0
  65. package/dist/saturation-slider.js +414 -0
  66. package/dist/saturation-slider.mjs +7 -0
  67. package/dist/use-color-input.d.mts +90 -0
  68. package/dist/use-color-input.d.ts +90 -0
  69. package/dist/use-color-input.js +340 -0
  70. package/dist/use-color-input.mjs +10 -0
  71. package/dist/use-color-picker.d.mts +131 -0
  72. package/dist/use-color-picker.d.ts +131 -0
  73. package/dist/use-color-picker.js +472 -0
  74. package/dist/use-color-picker.mjs +11 -0
  75. package/dist/use-color-slider.d.mts +69 -0
  76. package/dist/use-color-slider.d.ts +69 -0
  77. package/dist/use-color-slider.js +321 -0
  78. package/dist/use-color-slider.mjs +7 -0
  79. package/dist/use-saturation-slider.d.mts +77 -0
  80. package/dist/use-saturation-slider.d.ts +77 -0
  81. package/dist/use-saturation-slider.js +302 -0
  82. package/dist/use-saturation-slider.mjs +6 -0
  83. package/package.json +88 -0
@@ -0,0 +1,14 @@
1
+ import {
2
+ ColorPickerBody
3
+ } from "./chunk-73BVTMII.mjs";
4
+ import "./chunk-3EO2XBIZ.mjs";
5
+ import "./chunk-7QGCTVDG.mjs";
6
+ import "./chunk-PTTNJPGJ.mjs";
7
+ import "./chunk-U6OJ4TDG.mjs";
8
+ import "./chunk-DTB2Z3IJ.mjs";
9
+ import "./chunk-3N443XSV.mjs";
10
+ import "./chunk-NR2XCTSD.mjs";
11
+ import "./chunk-N2GG5L7Q.mjs";
12
+ export {
13
+ ColorPickerBody
14
+ };
@@ -0,0 +1,20 @@
1
+ import * as _yamada_ui_core from '@yamada-ui/core';
2
+ import { HTMLUIProps } from '@yamada-ui/core';
3
+ import { InputProps } from '@yamada-ui/input';
4
+ import { ReactNode } from 'react';
5
+
6
+ type ColorPickerChannelsOptions = {
7
+ /**
8
+ * Props for the chancel component.
9
+ */
10
+ channelProps?: Omit<ColorPickerChannelProps, "channelLabel">;
11
+ };
12
+ type ColorPickerChannelsProps = Omit<HTMLUIProps<"div">, "children"> & ColorPickerChannelsOptions;
13
+ declare const ColorPickerChannels: _yamada_ui_core.Component<"div", ColorPickerChannelsProps>;
14
+ type ColorPickerChannelOptions = {
15
+ channelLabel?: ReactNode;
16
+ };
17
+ type ColorPickerChannelProps = Omit<InputProps, "type" | "pattern" | "min" | "max" | "value" | "defaultValue"> & ColorPickerChannelOptions;
18
+ declare const ColorPickerChannel: _yamada_ui_core.Component<"input", ColorPickerChannelProps>;
19
+
20
+ export { ColorPickerChannel, type ColorPickerChannelProps, ColorPickerChannels, type ColorPickerChannelsProps };
@@ -0,0 +1,20 @@
1
+ import * as _yamada_ui_core from '@yamada-ui/core';
2
+ import { HTMLUIProps } from '@yamada-ui/core';
3
+ import { InputProps } from '@yamada-ui/input';
4
+ import { ReactNode } from 'react';
5
+
6
+ type ColorPickerChannelsOptions = {
7
+ /**
8
+ * Props for the chancel component.
9
+ */
10
+ channelProps?: Omit<ColorPickerChannelProps, "channelLabel">;
11
+ };
12
+ type ColorPickerChannelsProps = Omit<HTMLUIProps<"div">, "children"> & ColorPickerChannelsOptions;
13
+ declare const ColorPickerChannels: _yamada_ui_core.Component<"div", ColorPickerChannelsProps>;
14
+ type ColorPickerChannelOptions = {
15
+ channelLabel?: ReactNode;
16
+ };
17
+ type ColorPickerChannelProps = Omit<InputProps, "type" | "pattern" | "min" | "max" | "value" | "defaultValue"> & ColorPickerChannelOptions;
18
+ declare const ColorPickerChannel: _yamada_ui_core.Component<"input", ColorPickerChannelProps>;
19
+
20
+ export { ColorPickerChannel, type ColorPickerChannelProps, ColorPickerChannels, type ColorPickerChannelsProps };
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/color-picker-channels.tsx
21
+ var color_picker_channels_exports = {};
22
+ __export(color_picker_channels_exports, {
23
+ ColorPickerChannel: () => ColorPickerChannel,
24
+ ColorPickerChannels: () => ColorPickerChannels
25
+ });
26
+ module.exports = __toCommonJS(color_picker_channels_exports);
27
+ var import_core = require("@yamada-ui/core");
28
+ var import_input = require("@yamada-ui/input");
29
+ var import_utils2 = require("@yamada-ui/utils");
30
+ var import_react2 = require("react");
31
+
32
+ // src/use-color-picker.ts
33
+ var import_form_control = require("@yamada-ui/form-control");
34
+ var import_use_controllable_state = require("@yamada-ui/use-controllable-state");
35
+ var import_use_eye_dropper = require("@yamada-ui/use-eye-dropper");
36
+ var import_utils = require("@yamada-ui/utils");
37
+ var import_react = require("react");
38
+ var [ColorPickerProvider, useColorPickerContext] = (0, import_utils.createContext)({
39
+ name: "ColorPickerContext",
40
+ errorMessage: `useColorPickerContext returned is 'undefined'. Seems you forgot to wrap the components in "<ColorPicker />"`
41
+ });
42
+
43
+ // src/color-picker-channels.tsx
44
+ var import_jsx_runtime = require("react/jsx-runtime");
45
+ var ColorPickerChannels = (0, import_core.forwardRef)(
46
+ ({ className, channelProps, ...rest }, ref) => {
47
+ const { withAlpha, channels, getChannelProps, styles } = useColorPickerContext();
48
+ const css = {
49
+ display: "grid",
50
+ gridTemplateColumns: `repeat(${withAlpha ? "4" : "3"}, 1fr)`,
51
+ ...styles.channels
52
+ };
53
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
+ import_core.ui.div,
55
+ {
56
+ ref,
57
+ className: (0, import_utils2.cx)("ui-color-picker__channels", className),
58
+ __css: css,
59
+ ...rest,
60
+ children: channels.map(({ label, space, value, min, max }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
61
+ ColorPickerChannel,
62
+ {
63
+ channelLabel: label,
64
+ ...getChannelProps({ ...channelProps, space, value, min, max })
65
+ },
66
+ label
67
+ ))
68
+ }
69
+ );
70
+ }
71
+ );
72
+ var ColorPickerChannel = (0, import_core.forwardRef)(
73
+ ({ className, channelLabel, ...rest }, ref) => {
74
+ const id = (0, import_react2.useId)();
75
+ let { size, disabled, readOnly, styles } = useColorPickerContext();
76
+ if (size === "full")
77
+ size = "lg";
78
+ const css = { ...styles.channel };
79
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.ui.div, { className: (0, import_utils2.cx)("ui-color-picker__channel", className), children: [
80
+ channelLabel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
81
+ import_core.ui.label,
82
+ {
83
+ htmlFor: id,
84
+ style: { cursor: disabled ? "not-allowed" : void 0 },
85
+ __css: {
86
+ display: "block",
87
+ pointerEvents: readOnly ? "none" : void 0,
88
+ ...styles.channelLabel
89
+ },
90
+ children: channelLabel
91
+ }
92
+ ) : null,
93
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { ref, id, size, __css: css, ...rest })
94
+ ] });
95
+ }
96
+ );
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
99
+ ColorPickerChannel,
100
+ ColorPickerChannels
101
+ });
@@ -0,0 +1,10 @@
1
+ import {
2
+ ColorPickerChannel,
3
+ ColorPickerChannels
4
+ } from "./chunk-PVWIBTBL.mjs";
5
+ import "./chunk-NR2XCTSD.mjs";
6
+ import "./chunk-N2GG5L7Q.mjs";
7
+ export {
8
+ ColorPickerChannel,
9
+ ColorPickerChannels
10
+ };
@@ -0,0 +1,10 @@
1
+ import * as _yamada_ui_core from '@yamada-ui/core';
2
+ import { IconButtonProps } from '@yamada-ui/button';
3
+ import { IconProps } from '@yamada-ui/icon';
4
+ import { FC } from 'react';
5
+
6
+ type ColorPickerEyeDropperProps = IconButtonProps;
7
+ declare const ColorPickerEyeDropper: _yamada_ui_core.Component<"button", IconButtonProps>;
8
+ declare const EyeDropperIcon: FC<IconProps>;
9
+
10
+ export { ColorPickerEyeDropper, type ColorPickerEyeDropperProps, EyeDropperIcon };
@@ -0,0 +1,10 @@
1
+ import * as _yamada_ui_core from '@yamada-ui/core';
2
+ import { IconButtonProps } from '@yamada-ui/button';
3
+ import { IconProps } from '@yamada-ui/icon';
4
+ import { FC } from 'react';
5
+
6
+ type ColorPickerEyeDropperProps = IconButtonProps;
7
+ declare const ColorPickerEyeDropper: _yamada_ui_core.Component<"button", IconButtonProps>;
8
+ declare const EyeDropperIcon: FC<IconProps>;
9
+
10
+ export { ColorPickerEyeDropper, type ColorPickerEyeDropperProps, EyeDropperIcon };
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/color-picker-eye-dropper.tsx
21
+ var color_picker_eye_dropper_exports = {};
22
+ __export(color_picker_eye_dropper_exports, {
23
+ ColorPickerEyeDropper: () => ColorPickerEyeDropper,
24
+ EyeDropperIcon: () => EyeDropperIcon
25
+ });
26
+ module.exports = __toCommonJS(color_picker_eye_dropper_exports);
27
+ var import_button = require("@yamada-ui/button");
28
+ var import_core = require("@yamada-ui/core");
29
+ var import_icon = require("@yamada-ui/icon");
30
+ var import_utils2 = require("@yamada-ui/utils");
31
+
32
+ // src/use-color-picker.ts
33
+ var import_form_control = require("@yamada-ui/form-control");
34
+ var import_use_controllable_state = require("@yamada-ui/use-controllable-state");
35
+ var import_use_eye_dropper = require("@yamada-ui/use-eye-dropper");
36
+ var import_utils = require("@yamada-ui/utils");
37
+ var import_react = require("react");
38
+ var [ColorPickerProvider, useColorPickerContext] = (0, import_utils.createContext)({
39
+ name: "ColorPickerContext",
40
+ errorMessage: `useColorPickerContext returned is 'undefined'. Seems you forgot to wrap the components in "<ColorPicker />"`
41
+ });
42
+
43
+ // src/color-picker-eye-dropper.tsx
44
+ var import_jsx_runtime = require("react/jsx-runtime");
45
+ var ColorPickerEyeDropper = (0, import_core.forwardRef)(({ className, ...rest }, ref) => {
46
+ const { getEyeDropperProps, readOnly, size, styles } = useColorPickerContext();
47
+ const css = {
48
+ h: "auto",
49
+ minW: "auto",
50
+ pointerEvents: readOnly ? "none" : void 0,
51
+ ...styles.eyeDropper
52
+ };
53
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
+ import_button.IconButton,
55
+ {
56
+ className: (0, import_utils2.cx)("ui-color-picker__eye-dropper", className),
57
+ variant: "outline",
58
+ size,
59
+ __css: css,
60
+ ...getEyeDropperProps(rest, ref),
61
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EyeDropperIcon, { className: "ui-color-picker__eye-dropper__icon" })
62
+ }
63
+ );
64
+ });
65
+ var EyeDropperIcon = ({ ...rest }) => {
66
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
67
+ import_icon.Icon,
68
+ {
69
+ viewBox: "0 0 24 24",
70
+ fill: "none",
71
+ stroke: "currentColor",
72
+ strokeWidth: "2",
73
+ strokeLinecap: "round",
74
+ strokeLinejoin: "round",
75
+ ...rest,
76
+ children: [
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m2 22 1-1h3l9-9" }),
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 21v-3l9-9" }),
79
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z" })
80
+ ]
81
+ }
82
+ );
83
+ };
84
+ // Annotate the CommonJS export names for ESM import in node:
85
+ 0 && (module.exports = {
86
+ ColorPickerEyeDropper,
87
+ EyeDropperIcon
88
+ });
@@ -0,0 +1,10 @@
1
+ import {
2
+ ColorPickerEyeDropper,
3
+ EyeDropperIcon
4
+ } from "./chunk-3EO2XBIZ.mjs";
5
+ import "./chunk-NR2XCTSD.mjs";
6
+ import "./chunk-N2GG5L7Q.mjs";
7
+ export {
8
+ ColorPickerEyeDropper,
9
+ EyeDropperIcon
10
+ };
@@ -0,0 +1,30 @@
1
+ import * as _yamada_ui_core from '@yamada-ui/core';
2
+ import { HTMLUIProps } from '@yamada-ui/core';
3
+ import { ForwardedRef } from 'react';
4
+ import { AlphaSliderProps } from './alpha-slider.mjs';
5
+ import { HueSliderProps } from './hue-slider.mjs';
6
+ import './use-color-slider.mjs';
7
+ import '@yamada-ui/form-control';
8
+
9
+ type ColorPickerSlidersOptions = {
10
+ /**
11
+ * Ref for the hue slider component.
12
+ */
13
+ hueSliderRef?: ForwardedRef<HTMLInputElement>;
14
+ /**
15
+ * Props for the hue slider component.
16
+ */
17
+ hueSliderProps?: Omit<HueSliderProps, "value" | "defaultValue">;
18
+ /**
19
+ * Ref for the alpha slider component.
20
+ */
21
+ alphaSliderRef?: ForwardedRef<HTMLInputElement>;
22
+ /**
23
+ * Props for the alpha slider component.
24
+ */
25
+ alphaSliderProps?: Omit<AlphaSliderProps, "value" | "defaultValue">;
26
+ };
27
+ type ColorPickerSlidersProps = Omit<HTMLUIProps<"div">, "children"> & ColorPickerSlidersOptions;
28
+ declare const ColorPickerSliders: _yamada_ui_core.Component<"div", ColorPickerSlidersProps>;
29
+
30
+ export { ColorPickerSliders, type ColorPickerSlidersProps };
@@ -0,0 +1,30 @@
1
+ import * as _yamada_ui_core from '@yamada-ui/core';
2
+ import { HTMLUIProps } from '@yamada-ui/core';
3
+ import { ForwardedRef } from 'react';
4
+ import { AlphaSliderProps } from './alpha-slider.js';
5
+ import { HueSliderProps } from './hue-slider.js';
6
+ import './use-color-slider.js';
7
+ import '@yamada-ui/form-control';
8
+
9
+ type ColorPickerSlidersOptions = {
10
+ /**
11
+ * Ref for the hue slider component.
12
+ */
13
+ hueSliderRef?: ForwardedRef<HTMLInputElement>;
14
+ /**
15
+ * Props for the hue slider component.
16
+ */
17
+ hueSliderProps?: Omit<HueSliderProps, "value" | "defaultValue">;
18
+ /**
19
+ * Ref for the alpha slider component.
20
+ */
21
+ alphaSliderRef?: ForwardedRef<HTMLInputElement>;
22
+ /**
23
+ * Props for the alpha slider component.
24
+ */
25
+ alphaSliderProps?: Omit<AlphaSliderProps, "value" | "defaultValue">;
26
+ };
27
+ type ColorPickerSlidersProps = Omit<HTMLUIProps<"div">, "children"> & ColorPickerSlidersOptions;
28
+ declare const ColorPickerSliders: _yamada_ui_core.Component<"div", ColorPickerSlidersProps>;
29
+
30
+ export { ColorPickerSliders, type ColorPickerSlidersProps };