@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.
- package/LICENSE +21 -0
- package/README.md +28 -0
- package/dist/alpha-slider.d.mts +62 -0
- package/dist/alpha-slider.d.ts +62 -0
- package/dist/alpha-slider.js +438 -0
- package/dist/alpha-slider.mjs +8 -0
- package/dist/chunk-3EO2XBIZ.mjs +54 -0
- package/dist/chunk-3KASGDAY.mjs +122 -0
- package/dist/chunk-3N443XSV.mjs +105 -0
- package/dist/chunk-73BVTMII.mjs +73 -0
- package/dist/chunk-7QGCTVDG.mjs +66 -0
- package/dist/chunk-DTB2Z3IJ.mjs +278 -0
- package/dist/chunk-EMWFECJD.mjs +123 -0
- package/dist/chunk-HNVFOSAM.mjs +210 -0
- package/dist/chunk-KJS52X4M.mjs +330 -0
- package/dist/chunk-MAHWFXUG.mjs +294 -0
- package/dist/chunk-N2GG5L7Q.mjs +39 -0
- package/dist/chunk-NR2XCTSD.mjs +430 -0
- package/dist/chunk-PTTNJPGJ.mjs +98 -0
- package/dist/chunk-PVWIBTBL.mjs +67 -0
- package/dist/chunk-TFQ62YSQ.mjs +68 -0
- package/dist/chunk-U6OJ4TDG.mjs +127 -0
- package/dist/color-input.d.mts +79 -0
- package/dist/color-input.d.ts +79 -0
- package/dist/color-input.js +2283 -0
- package/dist/color-input.mjs +21 -0
- package/dist/color-picker-body.d.mts +38 -0
- package/dist/color-picker-body.d.ts +38 -0
- package/dist/color-picker-body.js +794 -0
- package/dist/color-picker-body.mjs +14 -0
- package/dist/color-picker-channels.d.mts +20 -0
- package/dist/color-picker-channels.d.ts +20 -0
- package/dist/color-picker-channels.js +101 -0
- package/dist/color-picker-channels.mjs +10 -0
- package/dist/color-picker-eye-dropper.d.mts +10 -0
- package/dist/color-picker-eye-dropper.d.ts +10 -0
- package/dist/color-picker-eye-dropper.js +88 -0
- package/dist/color-picker-eye-dropper.mjs +10 -0
- package/dist/color-picker-sliders.d.mts +30 -0
- package/dist/color-picker-sliders.d.ts +30 -0
- package/dist/color-picker-sliders.js +590 -0
- package/dist/color-picker-sliders.mjs +11 -0
- package/dist/color-picker-swatches.d.mts +34 -0
- package/dist/color-picker-swatches.d.ts +34 -0
- package/dist/color-picker-swatches.js +195 -0
- package/dist/color-picker-swatches.mjs +9 -0
- package/dist/color-picker.d.mts +59 -0
- package/dist/color-picker.d.ts +59 -0
- package/dist/color-picker.js +1790 -0
- package/dist/color-picker.mjs +19 -0
- package/dist/color-swatch.d.mts +36 -0
- package/dist/color-swatch.d.ts +36 -0
- package/dist/color-swatch.js +124 -0
- package/dist/color-swatch.mjs +6 -0
- package/dist/hue-slider.d.mts +56 -0
- package/dist/hue-slider.d.ts +56 -0
- package/dist/hue-slider.js +409 -0
- package/dist/hue-slider.mjs +8 -0
- package/dist/index.d.mts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +2295 -0
- package/dist/index.mjs +36 -0
- package/dist/saturation-slider.d.mts +33 -0
- package/dist/saturation-slider.d.ts +33 -0
- package/dist/saturation-slider.js +414 -0
- package/dist/saturation-slider.mjs +7 -0
- package/dist/use-color-input.d.mts +90 -0
- package/dist/use-color-input.d.ts +90 -0
- package/dist/use-color-input.js +340 -0
- package/dist/use-color-input.mjs +10 -0
- package/dist/use-color-picker.d.mts +131 -0
- package/dist/use-color-picker.d.ts +131 -0
- package/dist/use-color-picker.js +472 -0
- package/dist/use-color-picker.mjs +11 -0
- package/dist/use-color-slider.d.mts +69 -0
- package/dist/use-color-slider.d.ts +69 -0
- package/dist/use-color-slider.js +321 -0
- package/dist/use-color-slider.mjs +7 -0
- package/dist/use-saturation-slider.d.mts +77 -0
- package/dist/use-saturation-slider.d.ts +77 -0
- package/dist/use-saturation-slider.js +302 -0
- package/dist/use-saturation-slider.mjs +6 -0
- package/package.json +88 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ColorPicker
|
|
3
|
+
} from "./chunk-EMWFECJD.mjs";
|
|
4
|
+
import "./chunk-3KASGDAY.mjs";
|
|
5
|
+
import "./chunk-MAHWFXUG.mjs";
|
|
6
|
+
import "./chunk-73BVTMII.mjs";
|
|
7
|
+
import "./chunk-PVWIBTBL.mjs";
|
|
8
|
+
import "./chunk-3EO2XBIZ.mjs";
|
|
9
|
+
import "./chunk-7QGCTVDG.mjs";
|
|
10
|
+
import "./chunk-PTTNJPGJ.mjs";
|
|
11
|
+
import "./chunk-U6OJ4TDG.mjs";
|
|
12
|
+
import "./chunk-DTB2Z3IJ.mjs";
|
|
13
|
+
import "./chunk-TFQ62YSQ.mjs";
|
|
14
|
+
import "./chunk-3N443XSV.mjs";
|
|
15
|
+
import "./chunk-NR2XCTSD.mjs";
|
|
16
|
+
import "./chunk-N2GG5L7Q.mjs";
|
|
17
|
+
export {
|
|
18
|
+
ColorPicker
|
|
19
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as _yamada_ui_core from '@yamada-ui/core';
|
|
2
|
+
import { HTMLUIProps, ThemeProps } from '@yamada-ui/core';
|
|
3
|
+
|
|
4
|
+
type ColorSwatchOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* The color used for the swatch element.
|
|
7
|
+
*
|
|
8
|
+
* @default "#ffffff00"
|
|
9
|
+
*/
|
|
10
|
+
color?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The overlay used for the swatch element.
|
|
13
|
+
*/
|
|
14
|
+
overlays?: HTMLUIProps<"div">[];
|
|
15
|
+
/**
|
|
16
|
+
* If `true`, the swatch element has an inner `box-shadow`.
|
|
17
|
+
*
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
withShadow?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* If `true`, the color swatch will be perfectly round. Else, it'll be slightly round.
|
|
23
|
+
*
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
isRounded?: boolean;
|
|
27
|
+
};
|
|
28
|
+
type ColorSwatchProps = Omit<HTMLUIProps<"div">, "color"> & ThemeProps<"ColorSwatch"> & ColorSwatchOptions;
|
|
29
|
+
/**
|
|
30
|
+
* `ColorSwatch` is a component that displays color samples.
|
|
31
|
+
*
|
|
32
|
+
* @see Docs https://yamada-ui.com/components/data-display/color-swatch
|
|
33
|
+
*/
|
|
34
|
+
declare const ColorSwatch: _yamada_ui_core.Component<"div", ColorSwatchProps>;
|
|
35
|
+
|
|
36
|
+
export { ColorSwatch, type ColorSwatchProps };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as _yamada_ui_core from '@yamada-ui/core';
|
|
2
|
+
import { HTMLUIProps, ThemeProps } from '@yamada-ui/core';
|
|
3
|
+
|
|
4
|
+
type ColorSwatchOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* The color used for the swatch element.
|
|
7
|
+
*
|
|
8
|
+
* @default "#ffffff00"
|
|
9
|
+
*/
|
|
10
|
+
color?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The overlay used for the swatch element.
|
|
13
|
+
*/
|
|
14
|
+
overlays?: HTMLUIProps<"div">[];
|
|
15
|
+
/**
|
|
16
|
+
* If `true`, the swatch element has an inner `box-shadow`.
|
|
17
|
+
*
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
withShadow?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* If `true`, the color swatch will be perfectly round. Else, it'll be slightly round.
|
|
23
|
+
*
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
isRounded?: boolean;
|
|
27
|
+
};
|
|
28
|
+
type ColorSwatchProps = Omit<HTMLUIProps<"div">, "color"> & ThemeProps<"ColorSwatch"> & ColorSwatchOptions;
|
|
29
|
+
/**
|
|
30
|
+
* `ColorSwatch` is a component that displays color samples.
|
|
31
|
+
*
|
|
32
|
+
* @see Docs https://yamada-ui.com/components/data-display/color-swatch
|
|
33
|
+
*/
|
|
34
|
+
declare const ColorSwatch: _yamada_ui_core.Component<"div", ColorSwatchProps>;
|
|
35
|
+
|
|
36
|
+
export { ColorSwatch, type ColorSwatchProps };
|
|
@@ -0,0 +1,124 @@
|
|
|
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-swatch.tsx
|
|
21
|
+
var color_swatch_exports = {};
|
|
22
|
+
__export(color_swatch_exports, {
|
|
23
|
+
ColorSwatch: () => ColorSwatch
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(color_swatch_exports);
|
|
26
|
+
var import_core = require("@yamada-ui/core");
|
|
27
|
+
var import_utils = require("@yamada-ui/utils");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var defaultOverlays = (background, withShadow) => {
|
|
30
|
+
let overlays = [
|
|
31
|
+
{
|
|
32
|
+
bgImage: "linear-gradient(45deg, var(--ui-checkers) 25%, transparent 25%), linear-gradient(-45deg, var(--ui-checkers) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--ui-checkers) 75%), linear-gradient(-45deg, var(--ui-body) 75%, var(--ui-checkers) 75%)",
|
|
33
|
+
bgSize: `8px 8px`,
|
|
34
|
+
bgPosition: `0 0, 0 4px, 4px -4px, -4px 0`,
|
|
35
|
+
var: [
|
|
36
|
+
{
|
|
37
|
+
name: "checkers",
|
|
38
|
+
token: "colors",
|
|
39
|
+
value: ["blackAlpha.300", "whiteAlpha.300"]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "body",
|
|
43
|
+
token: "colors",
|
|
44
|
+
value: ["whiteAlpha.500", "blackAlpha.500"]
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{ background }
|
|
49
|
+
];
|
|
50
|
+
if (withShadow)
|
|
51
|
+
overlays = [
|
|
52
|
+
...overlays,
|
|
53
|
+
{
|
|
54
|
+
boxShadow: `rgba(0, 0, 0, .1) 0 0 0 1px inset, rgb(0, 0, 0, .15) 0 0 4px inset`
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
return overlays;
|
|
58
|
+
};
|
|
59
|
+
var ColorSwatch = (0, import_core.forwardRef)((props, ref) => {
|
|
60
|
+
const [styles, mergedProps] = (0, import_core.useMultiComponentStyle)("ColorSwatch", props);
|
|
61
|
+
const {
|
|
62
|
+
className,
|
|
63
|
+
color = "#ffffff00",
|
|
64
|
+
withShadow = true,
|
|
65
|
+
overlays = defaultOverlays(color, withShadow),
|
|
66
|
+
isRounded,
|
|
67
|
+
__css,
|
|
68
|
+
...rest
|
|
69
|
+
} = (0, import_core.omitThemeProps)(mergedProps);
|
|
70
|
+
const css = {
|
|
71
|
+
position: "relative",
|
|
72
|
+
_before: {
|
|
73
|
+
content: `""`,
|
|
74
|
+
display: "block",
|
|
75
|
+
h: 0,
|
|
76
|
+
pb: "100%"
|
|
77
|
+
},
|
|
78
|
+
"& > *": {
|
|
79
|
+
overflow: "hidden",
|
|
80
|
+
position: "absolute",
|
|
81
|
+
top: "0",
|
|
82
|
+
right: "0",
|
|
83
|
+
bottom: "0",
|
|
84
|
+
left: "0",
|
|
85
|
+
display: "flex",
|
|
86
|
+
justifyContent: "center",
|
|
87
|
+
alignItems: "center",
|
|
88
|
+
w: "100%",
|
|
89
|
+
h: "100%"
|
|
90
|
+
},
|
|
91
|
+
...styles.container,
|
|
92
|
+
...__css
|
|
93
|
+
};
|
|
94
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
95
|
+
import_core.ui.div,
|
|
96
|
+
{
|
|
97
|
+
ref,
|
|
98
|
+
className: (0, import_utils.cx)("ui-color-swatch", className),
|
|
99
|
+
...isRounded ? { rounded: "full" } : {},
|
|
100
|
+
__css: css,
|
|
101
|
+
...rest,
|
|
102
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.div, { ...isRounded ? { rounded: "full" } : {}, children: overlays.map((props2, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
103
|
+
import_core.ui.div,
|
|
104
|
+
{
|
|
105
|
+
__css: {
|
|
106
|
+
position: "absolute",
|
|
107
|
+
top: 0,
|
|
108
|
+
left: 0,
|
|
109
|
+
right: 0,
|
|
110
|
+
bottom: 0,
|
|
111
|
+
...styles.overlay
|
|
112
|
+
},
|
|
113
|
+
...isRounded ? { rounded: "full" } : {},
|
|
114
|
+
...props2
|
|
115
|
+
},
|
|
116
|
+
index
|
|
117
|
+
)) })
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
});
|
|
121
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
122
|
+
0 && (module.exports = {
|
|
123
|
+
ColorSwatch
|
|
124
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as _yamada_ui_core from '@yamada-ui/core';
|
|
2
|
+
import { ThemeProps, HTMLUIProps } from '@yamada-ui/core';
|
|
3
|
+
import { UseColorSliderProps } from './use-color-slider.mjs';
|
|
4
|
+
import '@yamada-ui/form-control';
|
|
5
|
+
|
|
6
|
+
type HueSliderOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* The minimum allowed value of the slider. Cannot be greater than max.
|
|
9
|
+
*
|
|
10
|
+
* @default 0
|
|
11
|
+
*/
|
|
12
|
+
min?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The maximum allowed value of the slider. Cannot be less than min.
|
|
15
|
+
*
|
|
16
|
+
* @default 360
|
|
17
|
+
*/
|
|
18
|
+
max?: number;
|
|
19
|
+
/**
|
|
20
|
+
* The step in which increments or decrements have to be made.
|
|
21
|
+
*
|
|
22
|
+
* @default 1
|
|
23
|
+
*/
|
|
24
|
+
step?: number;
|
|
25
|
+
/**
|
|
26
|
+
* If `true`, the slider has an inner `box-shadow`.
|
|
27
|
+
*
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
withShadow?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Props for slider input element.
|
|
33
|
+
*/
|
|
34
|
+
inputProps?: HTMLUIProps<"input">;
|
|
35
|
+
/**
|
|
36
|
+
* Props for slider track element.
|
|
37
|
+
*/
|
|
38
|
+
trackProps?: HTMLUIProps<"div">;
|
|
39
|
+
/**
|
|
40
|
+
* Props for slider thumb element.
|
|
41
|
+
*/
|
|
42
|
+
thumbProps?: HTMLUIProps<"div">;
|
|
43
|
+
/**
|
|
44
|
+
* The overlay used for the slider.
|
|
45
|
+
*/
|
|
46
|
+
overlays?: HTMLUIProps<"div">[];
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* `HueSlider` is a component used to allow the user to select a color hue.
|
|
50
|
+
*
|
|
51
|
+
* @see Docs https://yamada-ui.com/components/forms/hue-slider
|
|
52
|
+
*/
|
|
53
|
+
type HueSliderProps = ThemeProps<"HueSlider"> & Partial<UseColorSliderProps> & HueSliderOptions;
|
|
54
|
+
declare const HueSlider: _yamada_ui_core.Component<"input", HueSliderProps>;
|
|
55
|
+
|
|
56
|
+
export { HueSlider, type HueSliderProps };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as _yamada_ui_core from '@yamada-ui/core';
|
|
2
|
+
import { ThemeProps, HTMLUIProps } from '@yamada-ui/core';
|
|
3
|
+
import { UseColorSliderProps } from './use-color-slider.js';
|
|
4
|
+
import '@yamada-ui/form-control';
|
|
5
|
+
|
|
6
|
+
type HueSliderOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* The minimum allowed value of the slider. Cannot be greater than max.
|
|
9
|
+
*
|
|
10
|
+
* @default 0
|
|
11
|
+
*/
|
|
12
|
+
min?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The maximum allowed value of the slider. Cannot be less than min.
|
|
15
|
+
*
|
|
16
|
+
* @default 360
|
|
17
|
+
*/
|
|
18
|
+
max?: number;
|
|
19
|
+
/**
|
|
20
|
+
* The step in which increments or decrements have to be made.
|
|
21
|
+
*
|
|
22
|
+
* @default 1
|
|
23
|
+
*/
|
|
24
|
+
step?: number;
|
|
25
|
+
/**
|
|
26
|
+
* If `true`, the slider has an inner `box-shadow`.
|
|
27
|
+
*
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
withShadow?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Props for slider input element.
|
|
33
|
+
*/
|
|
34
|
+
inputProps?: HTMLUIProps<"input">;
|
|
35
|
+
/**
|
|
36
|
+
* Props for slider track element.
|
|
37
|
+
*/
|
|
38
|
+
trackProps?: HTMLUIProps<"div">;
|
|
39
|
+
/**
|
|
40
|
+
* Props for slider thumb element.
|
|
41
|
+
*/
|
|
42
|
+
thumbProps?: HTMLUIProps<"div">;
|
|
43
|
+
/**
|
|
44
|
+
* The overlay used for the slider.
|
|
45
|
+
*/
|
|
46
|
+
overlays?: HTMLUIProps<"div">[];
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* `HueSlider` is a component used to allow the user to select a color hue.
|
|
50
|
+
*
|
|
51
|
+
* @see Docs https://yamada-ui.com/components/forms/hue-slider
|
|
52
|
+
*/
|
|
53
|
+
type HueSliderProps = ThemeProps<"HueSlider"> & Partial<UseColorSliderProps> & HueSliderOptions;
|
|
54
|
+
declare const HueSlider: _yamada_ui_core.Component<"input", HueSliderProps>;
|
|
55
|
+
|
|
56
|
+
export { HueSlider, type HueSliderProps };
|