@designbasekorea/ui 0.2.20 → 0.2.21
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 +24 -32
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +24 -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 +24 -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,31 @@
|
|
|
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
|
+
const saturation = Math.round((x / rect.width) * 100);
|
|
5535
|
+
const lightness = Math.round(100 - (y / rect.height) * 100);
|
|
5536
|
+
setSaturation(Math.max(0, Math.min(100, saturation)));
|
|
5537
|
+
setLightness(Math.max(0, Math.min(100, lightness)));
|
|
5538
|
+
const newColor = hslToHex(hue, saturation, lightness);
|
|
5539
|
+
handleColorChange(newColor);
|
|
5540
|
+
};
|
|
5543
5541
|
// 컬러 선택 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 }) }))] })] })] }));
|
|
5542
|
+
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
|
+
background: `linear-gradient(to right,
|
|
5544
|
+
hsl(${hue}, 0%, 50%),
|
|
5545
|
+
hsl(${hue}, 100%, 50%)),
|
|
5546
|
+
linear-gradient(to bottom,
|
|
5547
|
+
transparent,
|
|
5548
|
+
hsl(${hue}, ${saturation}%, 0%))`
|
|
5549
|
+
}, onClick: handleColorAreaClick, children: jsxRuntime.jsx("div", { className: "designbase-color-picker__color-pointer", style: {
|
|
5550
|
+
left: `${saturation}%`,
|
|
5551
|
+
top: `${100 - lightness}%`,
|
|
5552
|
+
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("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: jsxRuntime.jsx("path", { d: "M2 2h2v2H2V2zm4 0h2v2H6V2zm4 0h2v2h-2V2zm2 4h2v2h-2V6zm0 4h2v2h-2v-2zm0 4h2v2h-2v-2zm-4 0h2v2H6v-2zm-4 0h2v2H2v-2z" }) }) }), 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
5554
|
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
5555
|
backgroundColor: showAlpha
|
|
5564
5556
|
? `hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha / 100})`
|