@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,409 @@
|
|
|
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/hue-slider.tsx
|
|
21
|
+
var hue_slider_exports = {};
|
|
22
|
+
__export(hue_slider_exports, {
|
|
23
|
+
HueSlider: () => HueSlider
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(hue_slider_exports);
|
|
26
|
+
var import_core = require("@yamada-ui/core");
|
|
27
|
+
var import_utils2 = require("@yamada-ui/utils");
|
|
28
|
+
|
|
29
|
+
// src/use-color-slider.ts
|
|
30
|
+
var import_form_control = require("@yamada-ui/form-control");
|
|
31
|
+
var import_use_controllable_state = require("@yamada-ui/use-controllable-state");
|
|
32
|
+
var import_use_latest_ref = require("@yamada-ui/use-latest-ref");
|
|
33
|
+
var import_use_pan_event = require("@yamada-ui/use-pan-event");
|
|
34
|
+
var import_use_size = require("@yamada-ui/use-size");
|
|
35
|
+
var import_utils = require("@yamada-ui/utils");
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
|
|
38
|
+
// ../../utils/src/object.ts
|
|
39
|
+
var pickObject = (obj, keys) => {
|
|
40
|
+
const result = {};
|
|
41
|
+
keys.forEach((key) => {
|
|
42
|
+
if (key in obj)
|
|
43
|
+
result[key] = obj[key];
|
|
44
|
+
});
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
var getObject = (obj, path, fallback, i) => {
|
|
48
|
+
const k = typeof path === "string" ? path.split(".") : [path];
|
|
49
|
+
for (i = 0; i < k.length; i += 1) {
|
|
50
|
+
if (!obj)
|
|
51
|
+
break;
|
|
52
|
+
obj = obj[k[i]];
|
|
53
|
+
}
|
|
54
|
+
return obj === void 0 ? fallback : obj;
|
|
55
|
+
};
|
|
56
|
+
var memoizeObject = (func) => {
|
|
57
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
58
|
+
const memoizedFunc = (obj, path, fallback, i) => {
|
|
59
|
+
if (typeof obj === "undefined")
|
|
60
|
+
return func(obj, path, fallback);
|
|
61
|
+
if (!cache.has(obj))
|
|
62
|
+
cache.set(obj, /* @__PURE__ */ new Map());
|
|
63
|
+
const map = cache.get(obj);
|
|
64
|
+
if (map.has(path))
|
|
65
|
+
return map.get(path);
|
|
66
|
+
const value = func(obj, path, fallback, i);
|
|
67
|
+
map.set(path, value);
|
|
68
|
+
return value;
|
|
69
|
+
};
|
|
70
|
+
return memoizedFunc;
|
|
71
|
+
};
|
|
72
|
+
var getMemoizedObject = memoizeObject(getObject);
|
|
73
|
+
|
|
74
|
+
// src/use-color-slider.ts
|
|
75
|
+
var useColorSlider = ({
|
|
76
|
+
focusThumbOnChange = true,
|
|
77
|
+
...props
|
|
78
|
+
}) => {
|
|
79
|
+
if (!focusThumbOnChange)
|
|
80
|
+
props.isReadOnly = true;
|
|
81
|
+
let {
|
|
82
|
+
id,
|
|
83
|
+
name,
|
|
84
|
+
value: valueProp,
|
|
85
|
+
defaultValue,
|
|
86
|
+
min = 0,
|
|
87
|
+
max,
|
|
88
|
+
step = 1,
|
|
89
|
+
onChange: onChangeProp,
|
|
90
|
+
onChangeStart: onChangeStartProp,
|
|
91
|
+
onChangeEnd: onChangeEndProp,
|
|
92
|
+
thumbColor,
|
|
93
|
+
required,
|
|
94
|
+
disabled,
|
|
95
|
+
readOnly,
|
|
96
|
+
...rest
|
|
97
|
+
} = (0, import_form_control.useFormControlProps)(props);
|
|
98
|
+
const onChangeStart = (0, import_utils.useCallbackRef)(onChangeStartProp);
|
|
99
|
+
const onChangeEnd = (0, import_utils.useCallbackRef)(onChangeEndProp);
|
|
100
|
+
const [computedValue, setValue] = (0, import_use_controllable_state.useControllableState)({
|
|
101
|
+
value: valueProp,
|
|
102
|
+
defaultValue: defaultValue != null ? defaultValue : min + (max - min) / 2,
|
|
103
|
+
onChange: onChangeProp
|
|
104
|
+
});
|
|
105
|
+
const value = (0, import_utils.clampNumber)(computedValue, min, max);
|
|
106
|
+
const thumbPercent = (0, import_utils.valueToPercent)(value, min, max);
|
|
107
|
+
const [isDragging, setDragging] = (0, import_react.useState)(false);
|
|
108
|
+
const isInteractive = !(disabled || readOnly);
|
|
109
|
+
const oneStep = step || (max - min) / 100;
|
|
110
|
+
const tenStep = (max - min) / 10;
|
|
111
|
+
const containerRef = (0, import_react.useRef)(null);
|
|
112
|
+
const trackRef = (0, import_react.useRef)(null);
|
|
113
|
+
const thumbRef = (0, import_react.useRef)(null);
|
|
114
|
+
const latestRef = (0, import_use_latest_ref.useLatestRef)({
|
|
115
|
+
value,
|
|
116
|
+
min,
|
|
117
|
+
max,
|
|
118
|
+
step,
|
|
119
|
+
isInteractive,
|
|
120
|
+
eventSource: null,
|
|
121
|
+
focusThumbOnChange
|
|
122
|
+
});
|
|
123
|
+
const thumbSize = (0, import_use_size.useSize)(thumbRef);
|
|
124
|
+
const getValueFromPointer = (0, import_react.useCallback)(
|
|
125
|
+
(ev) => {
|
|
126
|
+
var _a, _b;
|
|
127
|
+
if (!trackRef.current)
|
|
128
|
+
return;
|
|
129
|
+
const { min: min2, max: max2, step: step2 } = latestRef.current;
|
|
130
|
+
latestRef.current.eventSource = "pointer";
|
|
131
|
+
const { left, width } = trackRef.current.getBoundingClientRect();
|
|
132
|
+
const { clientX } = (_b = (_a = ev.touches) == null ? void 0 : _a[0]) != null ? _b : ev;
|
|
133
|
+
let percent = (clientX - left) / width;
|
|
134
|
+
let nextValue = (0, import_utils.percentToValue)(percent, min2, max2);
|
|
135
|
+
if (step2)
|
|
136
|
+
nextValue = parseFloat((0, import_utils.roundNumberToStep)(nextValue, min2, step2));
|
|
137
|
+
nextValue = (0, import_utils.clampNumber)(nextValue, min2, max2);
|
|
138
|
+
return nextValue;
|
|
139
|
+
},
|
|
140
|
+
[latestRef]
|
|
141
|
+
);
|
|
142
|
+
const setValueFromPointer = (ev) => {
|
|
143
|
+
const { value: value2 } = latestRef.current;
|
|
144
|
+
const nextValue = getValueFromPointer(ev);
|
|
145
|
+
if (nextValue != null && nextValue !== value2)
|
|
146
|
+
setValue(nextValue);
|
|
147
|
+
};
|
|
148
|
+
const focusThumb = (0, import_react.useCallback)(() => {
|
|
149
|
+
const { focusThumbOnChange: focusThumbOnChange2 } = latestRef.current;
|
|
150
|
+
if (focusThumbOnChange2)
|
|
151
|
+
setTimeout(() => {
|
|
152
|
+
var _a;
|
|
153
|
+
return (_a = thumbRef.current) == null ? void 0 : _a.focus();
|
|
154
|
+
});
|
|
155
|
+
}, [latestRef]);
|
|
156
|
+
const constrain = (0, import_react.useCallback)(
|
|
157
|
+
(value2) => {
|
|
158
|
+
const { isInteractive: isInteractive2, min: min2, max: max2 } = latestRef.current;
|
|
159
|
+
if (!isInteractive2)
|
|
160
|
+
return;
|
|
161
|
+
value2 = parseFloat((0, import_utils.roundNumberToStep)(value2, min2, oneStep));
|
|
162
|
+
value2 = (0, import_utils.clampNumber)(value2, min2, max2);
|
|
163
|
+
setValue(value2);
|
|
164
|
+
},
|
|
165
|
+
[setValue, latestRef, oneStep]
|
|
166
|
+
);
|
|
167
|
+
const stepUp = (0, import_react.useCallback)(
|
|
168
|
+
(step2 = oneStep) => constrain(value + step2),
|
|
169
|
+
[constrain, value, oneStep]
|
|
170
|
+
);
|
|
171
|
+
const stepDown = (0, import_react.useCallback)(
|
|
172
|
+
(step2 = oneStep) => constrain(value - step2),
|
|
173
|
+
[constrain, value, oneStep]
|
|
174
|
+
);
|
|
175
|
+
const onKeyDown = (0, import_react.useCallback)(
|
|
176
|
+
(ev) => {
|
|
177
|
+
const { min: min2, max: max2 } = latestRef.current;
|
|
178
|
+
const actions = {
|
|
179
|
+
ArrowRight: () => stepUp(),
|
|
180
|
+
ArrowUp: () => stepUp(),
|
|
181
|
+
ArrowLeft: () => stepDown(),
|
|
182
|
+
ArrowDown: () => stepDown(),
|
|
183
|
+
PageUp: () => stepUp(tenStep),
|
|
184
|
+
PageDown: () => stepDown(tenStep),
|
|
185
|
+
Home: () => constrain(min2),
|
|
186
|
+
End: () => constrain(max2)
|
|
187
|
+
};
|
|
188
|
+
const action = actions[ev.key];
|
|
189
|
+
if (!action)
|
|
190
|
+
return;
|
|
191
|
+
ev.preventDefault();
|
|
192
|
+
ev.stopPropagation();
|
|
193
|
+
action(ev);
|
|
194
|
+
latestRef.current.eventSource = "keyboard";
|
|
195
|
+
},
|
|
196
|
+
[constrain, latestRef, stepDown, stepUp, tenStep]
|
|
197
|
+
);
|
|
198
|
+
(0, import_use_pan_event.usePanEvent)(containerRef, {
|
|
199
|
+
onSessionStart: (ev) => {
|
|
200
|
+
const { isInteractive: isInteractive2, value: value2 } = latestRef.current;
|
|
201
|
+
if (!isInteractive2)
|
|
202
|
+
return;
|
|
203
|
+
setDragging(true);
|
|
204
|
+
focusThumb();
|
|
205
|
+
setValueFromPointer(ev);
|
|
206
|
+
onChangeStart(value2);
|
|
207
|
+
},
|
|
208
|
+
onSessionEnd: () => {
|
|
209
|
+
const { isInteractive: isInteractive2, value: value2 } = latestRef.current;
|
|
210
|
+
if (!isInteractive2)
|
|
211
|
+
return;
|
|
212
|
+
setDragging(false);
|
|
213
|
+
onChangeEnd(value2);
|
|
214
|
+
},
|
|
215
|
+
onMove: (ev) => {
|
|
216
|
+
const { isInteractive: isInteractive2 } = latestRef.current;
|
|
217
|
+
if (!isInteractive2)
|
|
218
|
+
return;
|
|
219
|
+
setValueFromPointer(ev);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
(0, import_utils.useUpdateEffect)(() => {
|
|
223
|
+
const { eventSource, value: value2 } = latestRef.current;
|
|
224
|
+
if (eventSource === "keyboard")
|
|
225
|
+
onChangeEnd(value2);
|
|
226
|
+
}, [value, onChangeEnd]);
|
|
227
|
+
const getContainerProps = (0, import_react.useCallback)(
|
|
228
|
+
(props2 = {}, ref = null) => {
|
|
229
|
+
const { width: w } = thumbSize != null ? thumbSize : { width: 0 };
|
|
230
|
+
const style = {
|
|
231
|
+
...props2.style,
|
|
232
|
+
...rest.style,
|
|
233
|
+
paddingInline: `${w / 2}px`
|
|
234
|
+
};
|
|
235
|
+
return {
|
|
236
|
+
...props2,
|
|
237
|
+
...(0, import_utils.omitObject)(rest, ["aria-readonly"]),
|
|
238
|
+
ref: (0, import_utils.mergeRefs)(ref, containerRef),
|
|
239
|
+
tabIndex: -1,
|
|
240
|
+
style
|
|
241
|
+
};
|
|
242
|
+
},
|
|
243
|
+
[rest, thumbSize]
|
|
244
|
+
);
|
|
245
|
+
const getInputProps = (0, import_react.useCallback)(
|
|
246
|
+
(props2 = {}, ref = null) => ({
|
|
247
|
+
...pickObject(rest, import_form_control.formControlProperties),
|
|
248
|
+
...props2,
|
|
249
|
+
id,
|
|
250
|
+
ref,
|
|
251
|
+
type: "hidden",
|
|
252
|
+
name,
|
|
253
|
+
value,
|
|
254
|
+
required,
|
|
255
|
+
disabled,
|
|
256
|
+
readOnly
|
|
257
|
+
}),
|
|
258
|
+
[disabled, id, name, readOnly, required, rest, value]
|
|
259
|
+
);
|
|
260
|
+
const getTrackProps = (0, import_react.useCallback)(
|
|
261
|
+
(props2 = {}, ref = null) => ({
|
|
262
|
+
...pickObject(
|
|
263
|
+
rest,
|
|
264
|
+
(0, import_form_control.getFormControlProperties)({ omit: ["aria-readonly"] })
|
|
265
|
+
),
|
|
266
|
+
...props2,
|
|
267
|
+
ref: (0, import_utils.mergeRefs)(ref, trackRef)
|
|
268
|
+
}),
|
|
269
|
+
[rest]
|
|
270
|
+
);
|
|
271
|
+
const getThumbProps = (0, import_react.useCallback)(
|
|
272
|
+
(props2 = {}, ref = null) => {
|
|
273
|
+
const n = thumbPercent;
|
|
274
|
+
const { width: w } = thumbSize != null ? thumbSize : { width: 0 };
|
|
275
|
+
const style = {
|
|
276
|
+
...props2.style,
|
|
277
|
+
position: "absolute",
|
|
278
|
+
userSelect: "none",
|
|
279
|
+
touchAction: "none",
|
|
280
|
+
left: `calc(${n}% - ${w / 2}px)`
|
|
281
|
+
};
|
|
282
|
+
return {
|
|
283
|
+
"aria-label": "Slider thumb",
|
|
284
|
+
bg: thumbColor != null ? thumbColor : `hsl(${value}, 100%, 50%)`,
|
|
285
|
+
...pickObject(rest, import_form_control.formControlProperties),
|
|
286
|
+
...props2,
|
|
287
|
+
ref: (0, import_utils.mergeRefs)(ref, thumbRef),
|
|
288
|
+
tabIndex: isInteractive && focusThumbOnChange ? 0 : void 0,
|
|
289
|
+
role: "slider",
|
|
290
|
+
"aria-valuenow": value,
|
|
291
|
+
"aria-valuemin": min,
|
|
292
|
+
"aria-valuemax": max,
|
|
293
|
+
"data-active": (0, import_utils.dataAttr)(isDragging && focusThumbOnChange),
|
|
294
|
+
onKeyDown: (0, import_utils.handlerAll)(props2.onKeyDown, onKeyDown),
|
|
295
|
+
onFocus: (0, import_utils.handlerAll)(props2.onFocus, rest.onFocus),
|
|
296
|
+
onBlur: (0, import_utils.handlerAll)(props2.onBlur, rest.onBlur),
|
|
297
|
+
style
|
|
298
|
+
};
|
|
299
|
+
},
|
|
300
|
+
[
|
|
301
|
+
thumbColor,
|
|
302
|
+
focusThumbOnChange,
|
|
303
|
+
isDragging,
|
|
304
|
+
isInteractive,
|
|
305
|
+
min,
|
|
306
|
+
max,
|
|
307
|
+
onKeyDown,
|
|
308
|
+
rest,
|
|
309
|
+
thumbPercent,
|
|
310
|
+
thumbSize,
|
|
311
|
+
value
|
|
312
|
+
]
|
|
313
|
+
);
|
|
314
|
+
return {
|
|
315
|
+
value,
|
|
316
|
+
getContainerProps,
|
|
317
|
+
getTrackProps,
|
|
318
|
+
getInputProps,
|
|
319
|
+
getThumbProps
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
// src/hue-slider.tsx
|
|
324
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
325
|
+
var defaultOverlays = (min, max, withShadow) => {
|
|
326
|
+
let overlays = [
|
|
327
|
+
{
|
|
328
|
+
bgGradient: `linear(to-r, ${[...Array(7)].map(
|
|
329
|
+
(_, index) => `hsl(${Math.round(min + (max - min) / 6 * index)}, 100%, 50%)`
|
|
330
|
+
).join(", ")})`
|
|
331
|
+
}
|
|
332
|
+
];
|
|
333
|
+
if (withShadow)
|
|
334
|
+
overlays = [
|
|
335
|
+
...overlays,
|
|
336
|
+
{
|
|
337
|
+
boxShadow: `rgba(0, 0, 0, .1) 0 0 0 1px inset, rgb(0, 0, 0, .15) 0 0 4px inset`
|
|
338
|
+
}
|
|
339
|
+
];
|
|
340
|
+
return overlays;
|
|
341
|
+
};
|
|
342
|
+
var HueSlider = (0, import_core.forwardRef)((props, ref) => {
|
|
343
|
+
const [styles, mergedProps] = (0, import_core.useMultiComponentStyle)("HueSlider", props);
|
|
344
|
+
const {
|
|
345
|
+
className,
|
|
346
|
+
inputProps,
|
|
347
|
+
trackProps,
|
|
348
|
+
thumbProps,
|
|
349
|
+
min = 0,
|
|
350
|
+
max = 360,
|
|
351
|
+
withShadow = true,
|
|
352
|
+
overlays = defaultOverlays(min, max, withShadow),
|
|
353
|
+
__css,
|
|
354
|
+
...computedProps
|
|
355
|
+
} = (0, import_core.omitThemeProps)(mergedProps);
|
|
356
|
+
const { getContainerProps, getTrackProps, getInputProps, getThumbProps } = useColorSlider({ min, max, step: 1, ...computedProps });
|
|
357
|
+
const css = {
|
|
358
|
+
position: "relative",
|
|
359
|
+
...styles.container,
|
|
360
|
+
...__css
|
|
361
|
+
};
|
|
362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
363
|
+
import_core.ui.div,
|
|
364
|
+
{
|
|
365
|
+
className: (0, import_utils2.cx)("ui-hue-slider", className),
|
|
366
|
+
__css: css,
|
|
367
|
+
...getContainerProps(),
|
|
368
|
+
children: [
|
|
369
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.input, { ...getInputProps(inputProps, ref) }),
|
|
370
|
+
overlays.map((props2, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
371
|
+
import_core.ui.div,
|
|
372
|
+
{
|
|
373
|
+
className: "ui-hue-slider__overlay",
|
|
374
|
+
__css: {
|
|
375
|
+
position: "absolute",
|
|
376
|
+
top: 0,
|
|
377
|
+
left: 0,
|
|
378
|
+
right: 0,
|
|
379
|
+
bottom: 0,
|
|
380
|
+
...styles.overlay
|
|
381
|
+
},
|
|
382
|
+
...props2
|
|
383
|
+
},
|
|
384
|
+
index
|
|
385
|
+
)),
|
|
386
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
387
|
+
import_core.ui.div,
|
|
388
|
+
{
|
|
389
|
+
className: "ui-hue-slider__track",
|
|
390
|
+
__css: { position: "relative", w: "full", h: "full", ...styles.track },
|
|
391
|
+
...getTrackProps(trackProps),
|
|
392
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
393
|
+
import_core.ui.div,
|
|
394
|
+
{
|
|
395
|
+
className: "ui-hue-slider__thumb",
|
|
396
|
+
__css: { ...styles.thumb },
|
|
397
|
+
...getThumbProps(thumbProps)
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
}
|
|
401
|
+
)
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
});
|
|
406
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
407
|
+
0 && (module.exports = {
|
|
408
|
+
HueSlider
|
|
409
|
+
});
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { ColorPicker, ColorPickerProps } from './color-picker.mjs';
|
|
2
|
+
export { ColorInput, ColorInputProps } from './color-input.mjs';
|
|
3
|
+
export { HueSlider, HueSliderProps } from './hue-slider.mjs';
|
|
4
|
+
export { AlphaSlider, AlphaSliderProps } from './alpha-slider.mjs';
|
|
5
|
+
export { ColorSwatch, ColorSwatchProps } from './color-swatch.mjs';
|
|
6
|
+
export { SaturationSlider, SaturationSliderProps } from './saturation-slider.mjs';
|
|
7
|
+
export { Hsv } from './use-saturation-slider.mjs';
|
|
8
|
+
import '@yamada-ui/core';
|
|
9
|
+
import 'react';
|
|
10
|
+
import './color-picker-body.mjs';
|
|
11
|
+
import './color-picker-eye-dropper.mjs';
|
|
12
|
+
import '@yamada-ui/button';
|
|
13
|
+
import '@yamada-ui/icon';
|
|
14
|
+
import './color-picker-sliders.mjs';
|
|
15
|
+
import './use-color-slider.mjs';
|
|
16
|
+
import '@yamada-ui/form-control';
|
|
17
|
+
import './color-picker-swatches.mjs';
|
|
18
|
+
import './use-color-picker.mjs';
|
|
19
|
+
import '@yamada-ui/input';
|
|
20
|
+
import '@yamada-ui/utils';
|
|
21
|
+
import '@yamada-ui/portal';
|
|
22
|
+
import './use-color-input.mjs';
|
|
23
|
+
import '@yamada-ui/popover';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { ColorPicker, ColorPickerProps } from './color-picker.js';
|
|
2
|
+
export { ColorInput, ColorInputProps } from './color-input.js';
|
|
3
|
+
export { HueSlider, HueSliderProps } from './hue-slider.js';
|
|
4
|
+
export { AlphaSlider, AlphaSliderProps } from './alpha-slider.js';
|
|
5
|
+
export { ColorSwatch, ColorSwatchProps } from './color-swatch.js';
|
|
6
|
+
export { SaturationSlider, SaturationSliderProps } from './saturation-slider.js';
|
|
7
|
+
export { Hsv } from './use-saturation-slider.js';
|
|
8
|
+
import '@yamada-ui/core';
|
|
9
|
+
import 'react';
|
|
10
|
+
import './color-picker-body.js';
|
|
11
|
+
import './color-picker-eye-dropper.js';
|
|
12
|
+
import '@yamada-ui/button';
|
|
13
|
+
import '@yamada-ui/icon';
|
|
14
|
+
import './color-picker-sliders.js';
|
|
15
|
+
import './use-color-slider.js';
|
|
16
|
+
import '@yamada-ui/form-control';
|
|
17
|
+
import './color-picker-swatches.js';
|
|
18
|
+
import './use-color-picker.js';
|
|
19
|
+
import '@yamada-ui/input';
|
|
20
|
+
import '@yamada-ui/utils';
|
|
21
|
+
import '@yamada-ui/portal';
|
|
22
|
+
import './use-color-input.js';
|
|
23
|
+
import '@yamada-ui/popover';
|