@designbasekorea/ui 0.2.20 → 0.2.22
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 +48 -33
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +47 -32
- 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 +47 -32
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -5404,20 +5404,6 @@
|
|
|
5404
5404
|
const newColor = hslToHex(newHue, saturation, lightness);
|
|
5405
5405
|
handleColorChange(newColor);
|
|
5406
5406
|
};
|
|
5407
|
-
// Saturation 슬라이더 변경
|
|
5408
|
-
const handleSaturationChange = (e) => {
|
|
5409
|
-
const newSaturation = parseInt(e.target.value);
|
|
5410
|
-
setSaturation(newSaturation);
|
|
5411
|
-
const newColor = hslToHex(hue, newSaturation, lightness);
|
|
5412
|
-
handleColorChange(newColor);
|
|
5413
|
-
};
|
|
5414
|
-
// Lightness 슬라이더 변경
|
|
5415
|
-
const handleLightnessChange = (e) => {
|
|
5416
|
-
const newLightness = parseInt(e.target.value);
|
|
5417
|
-
setLightness(newLightness);
|
|
5418
|
-
const newColor = hslToHex(hue, saturation, newLightness);
|
|
5419
|
-
handleColorChange(newColor);
|
|
5420
|
-
};
|
|
5421
5407
|
// Alpha 슬라이더 변경
|
|
5422
5408
|
const handleAlphaChange = (e) => {
|
|
5423
5409
|
const newAlpha = parseInt(e.target.value);
|
|
@@ -5540,25 +5526,54 @@
|
|
|
5540
5526
|
'designbase-color-picker--open': isOpen,
|
|
5541
5527
|
'designbase-color-picker--no-input': !showInput,
|
|
5542
5528
|
}, className);
|
|
5529
|
+
// 메인 컬러 선택 영역 클릭 핸들러
|
|
5530
|
+
const handleColorAreaClick = (e) => {
|
|
5531
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
5532
|
+
const x = e.clientX - rect.left;
|
|
5533
|
+
const y = e.clientY - rect.top;
|
|
5534
|
+
// 좌측은 채도 낮고, 우측은 채도 최대치
|
|
5535
|
+
const saturation = Math.round((x / rect.width) * 100);
|
|
5536
|
+
// 위로는 밝기 최대, 아래로는 밝기 어둡게
|
|
5537
|
+
const lightness = Math.round(100 - (y / rect.height) * 100);
|
|
5538
|
+
setSaturation(Math.max(0, Math.min(100, saturation)));
|
|
5539
|
+
setLightness(Math.max(0, Math.min(100, lightness)));
|
|
5540
|
+
const newColor = hslToHex(hue, saturation, lightness);
|
|
5541
|
+
handleColorChange(newColor);
|
|
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
|
+
};
|
|
5543
5564
|
// 컬러 선택 UI
|
|
5544
|
-
const renderColorSelector = () => (jsxRuntime.jsxs("div", { className: "designbase-color-picker__selector", children: [
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
hsl(${hue}, ${saturation}%, ${lightness}%))`
|
|
5557
|
-
} })] }))] }), jsxRuntime.jsxs("div", { className: "designbase-color-picker__preview", children: [jsxRuntime.jsx("div", { className: "designbase-color-picker__preview-box", style: {
|
|
5558
|
-
backgroundColor: showAlpha
|
|
5559
|
-
? `hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha / 100})`
|
|
5560
|
-
: `hsl(${hue}, ${saturation}%, ${lightness}%)`
|
|
5561
|
-
} }), jsxRuntime.jsxs("div", { className: "designbase-color-picker__preview-info", children: [jsxRuntime.jsx("div", { className: "designbase-color-picker__preview-value", children: getFormattedColor() }), 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 }) }))] })] })] }));
|
|
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: {
|
|
5566
|
+
background: `linear-gradient(to right,
|
|
5567
|
+
hsl(${hue}, 0%, 50%),
|
|
5568
|
+
hsl(${hue}, 100%, 50%)),
|
|
5569
|
+
linear-gradient(to bottom,
|
|
5570
|
+
hsl(${hue}, 100%, 100%),
|
|
5571
|
+
hsl(${hue}, 100%, 0%))`
|
|
5572
|
+
}, onClick: handleColorAreaClick, children: jsxRuntime.jsx("div", { className: "designbase-color-picker__color-pointer", style: {
|
|
5573
|
+
left: `${saturation}%`,
|
|
5574
|
+
top: `${100 - lightness}%`,
|
|
5575
|
+
backgroundColor: `hsl(${hue}, ${saturation}%, ${lightness}%)`
|
|
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.PaletteIcon, { 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 }) }))] })] }));
|
|
5562
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: {
|
|
5563
5578
|
backgroundColor: showAlpha
|
|
5564
5579
|
? `hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha / 100})`
|