@designbasekorea/ui 0.2.21 → 0.2.23
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/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.css.map +1 -1
- package/dist/index.esm.js +27 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/dist/index.umd.css +1 -1
- package/dist/index.umd.css.map +1 -1
- package/dist/index.umd.js +26 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -5531,26 +5531,49 @@
|
|
|
5531
5531
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
5532
5532
|
const x = e.clientX - rect.left;
|
|
5533
5533
|
const y = e.clientY - rect.top;
|
|
5534
|
+
// 좌측은 채도 낮고, 우측은 채도 최대치
|
|
5534
5535
|
const saturation = Math.round((x / rect.width) * 100);
|
|
5536
|
+
// 위로는 밝기 최대, 아래로는 밝기 어둡게
|
|
5535
5537
|
const lightness = Math.round(100 - (y / rect.height) * 100);
|
|
5536
5538
|
setSaturation(Math.max(0, Math.min(100, saturation)));
|
|
5537
5539
|
setLightness(Math.max(0, Math.min(100, lightness)));
|
|
5538
5540
|
const newColor = hslToHex(hue, saturation, lightness);
|
|
5539
5541
|
handleColorChange(newColor);
|
|
5540
5542
|
};
|
|
5543
|
+
// 스포이드 기능 (색상 추출)
|
|
5544
|
+
const handleEyedropperClick = async () => {
|
|
5545
|
+
try {
|
|
5546
|
+
// EyeDropper API 지원 확인
|
|
5547
|
+
if ('EyeDropper' in window) {
|
|
5548
|
+
const eyeDropper = new window.EyeDropper();
|
|
5549
|
+
const result = await eyeDropper.open();
|
|
5550
|
+
const hexColor = result.sRGBHex;
|
|
5551
|
+
handleColorChange(hexColor);
|
|
5552
|
+
updateHSLFromHex(hexColor);
|
|
5553
|
+
}
|
|
5554
|
+
else {
|
|
5555
|
+
// EyeDropper API가 지원되지 않는 경우 대체 기능
|
|
5556
|
+
console.log('EyeDropper API is not supported in this browser');
|
|
5557
|
+
// 여기에 대체 기능을 구현할 수 있습니다
|
|
5558
|
+
}
|
|
5559
|
+
}
|
|
5560
|
+
catch (err) {
|
|
5561
|
+
console.error('EyeDropper failed:', err);
|
|
5562
|
+
}
|
|
5563
|
+
};
|
|
5541
5564
|
// 컬러 선택 UI
|
|
5542
5565
|
const renderColorSelector = () => (jsxRuntime.jsxs("div", { className: "designbase-color-picker__selector", children: [jsxRuntime.jsx("div", { className: "designbase-color-picker__color-area", children: jsxRuntime.jsx("div", { className: "designbase-color-picker__color-field", style: {
|
|
5543
5566
|
background: `linear-gradient(to right,
|
|
5544
5567
|
hsl(${hue}, 0%, 50%),
|
|
5545
5568
|
hsl(${hue}, 100%, 50%)),
|
|
5546
5569
|
linear-gradient(to bottom,
|
|
5547
|
-
|
|
5548
|
-
hsl(${hue},
|
|
5570
|
+
hsl(${hue}, 100%, 100%),
|
|
5571
|
+
hsl(${hue}, 100%, 0%))`
|
|
5549
5572
|
}, onClick: handleColorAreaClick, children: jsxRuntime.jsx("div", { className: "designbase-color-picker__color-pointer", style: {
|
|
5550
5573
|
left: `${saturation}%`,
|
|
5551
5574
|
top: `${100 - lightness}%`,
|
|
5552
5575
|
backgroundColor: `hsl(${hue}, ${saturation}%, ${lightness}%)`
|
|
5553
|
-
} }) }) }), jsxRuntime.jsxs("div", { className: "designbase-color-picker__controls", children: [jsxRuntime.jsx("button", { type: "button", className: "designbase-color-picker__eyedropper", "aria-label": "Eyedropper tool", children: jsxRuntime.jsx(
|
|
5576
|
+
} }) }) }), jsxRuntime.jsxs("div", { className: "designbase-color-picker__controls", children: [jsxRuntime.jsx("button", { type: "button", className: "designbase-color-picker__eyedropper", onClick: handleEyedropperClick, "aria-label": "Eyedropper tool", children: jsxRuntime.jsx(icons.EyedropperIcon, { size: 16 }) }), jsxRuntime.jsx("div", { className: "designbase-color-picker__hue-slider", children: jsxRuntime.jsx("input", { type: "range", min: "0", max: "360", value: hue, onChange: handleHueChange, className: "designbase-color-picker__slider designbase-color-picker__slider--hue" }) }), showAlpha && (jsxRuntime.jsx("div", { className: "designbase-color-picker__alpha-slider", children: jsxRuntime.jsx("input", { type: "range", min: "0", max: "100", value: alpha, onChange: handleAlphaChange, className: "designbase-color-picker__slider designbase-color-picker__slider--alpha" }) }))] }), jsxRuntime.jsxs("div", { className: "designbase-color-picker__value-display", children: [showFormatSelector && (jsxRuntime.jsxs("select", { className: "designbase-color-picker__format-select", value: colorFormat, onChange: (e) => setColorFormat(e.target.value), children: [jsxRuntime.jsx("option", { value: "hex", children: "HEX" }), jsxRuntime.jsx("option", { value: "rgb", children: "RGB" }), jsxRuntime.jsx("option", { value: "rgba", children: "RGBA" }), jsxRuntime.jsx("option", { value: "hsl", children: "HSL" }), jsxRuntime.jsx("option", { value: "hsla", children: "HSLA" })] })), jsxRuntime.jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, onBlur: handleInputBlur, className: "designbase-color-picker__value-input", placeholder: "#000000" }), showAlpha && (jsxRuntime.jsxs("span", { className: "designbase-color-picker__alpha-percent", children: [alpha, "%"] })), showCopyButton && (jsxRuntime.jsx("button", { type: "button", className: "designbase-color-picker__copy-button", onClick: handleCopy, "aria-label": "Copy color value", children: isCopied ? jsxRuntime.jsx(icons.DoneIcon, { size: 14 }) : jsxRuntime.jsx(icons.CopyIcon, { size: 14 }) }))] })] }));
|
|
5554
5577
|
return (jsxRuntime.jsxs("div", { ref: pickerRef, className: classes, children: [jsxRuntime.jsxs("div", { className: "designbase-color-picker__trigger", children: [jsxRuntime.jsx("div", { className: "designbase-color-picker__color-display", onClick: togglePicker, children: jsxRuntime.jsx("div", { className: "designbase-color-picker__color-box", style: {
|
|
5555
5578
|
backgroundColor: showAlpha
|
|
5556
5579
|
? `hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha / 100})`
|