@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.esm.js
CHANGED
|
@@ -5403,20 +5403,6 @@ const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left',
|
|
|
5403
5403
|
const newColor = hslToHex(newHue, saturation, lightness);
|
|
5404
5404
|
handleColorChange(newColor);
|
|
5405
5405
|
};
|
|
5406
|
-
// Saturation 슬라이더 변경
|
|
5407
|
-
const handleSaturationChange = (e) => {
|
|
5408
|
-
const newSaturation = parseInt(e.target.value);
|
|
5409
|
-
setSaturation(newSaturation);
|
|
5410
|
-
const newColor = hslToHex(hue, newSaturation, lightness);
|
|
5411
|
-
handleColorChange(newColor);
|
|
5412
|
-
};
|
|
5413
|
-
// Lightness 슬라이더 변경
|
|
5414
|
-
const handleLightnessChange = (e) => {
|
|
5415
|
-
const newLightness = parseInt(e.target.value);
|
|
5416
|
-
setLightness(newLightness);
|
|
5417
|
-
const newColor = hslToHex(hue, saturation, newLightness);
|
|
5418
|
-
handleColorChange(newColor);
|
|
5419
|
-
};
|
|
5420
5406
|
// Alpha 슬라이더 변경
|
|
5421
5407
|
const handleAlphaChange = (e) => {
|
|
5422
5408
|
const newAlpha = parseInt(e.target.value);
|
|
@@ -5539,25 +5525,31 @@ const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left',
|
|
|
5539
5525
|
'designbase-color-picker--open': isOpen,
|
|
5540
5526
|
'designbase-color-picker--no-input': !showInput,
|
|
5541
5527
|
}, className);
|
|
5528
|
+
// 메인 컬러 선택 영역 클릭 핸들러
|
|
5529
|
+
const handleColorAreaClick = (e) => {
|
|
5530
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
5531
|
+
const x = e.clientX - rect.left;
|
|
5532
|
+
const y = e.clientY - rect.top;
|
|
5533
|
+
const saturation = Math.round((x / rect.width) * 100);
|
|
5534
|
+
const lightness = Math.round(100 - (y / rect.height) * 100);
|
|
5535
|
+
setSaturation(Math.max(0, Math.min(100, saturation)));
|
|
5536
|
+
setLightness(Math.max(0, Math.min(100, lightness)));
|
|
5537
|
+
const newColor = hslToHex(hue, saturation, lightness);
|
|
5538
|
+
handleColorChange(newColor);
|
|
5539
|
+
};
|
|
5542
5540
|
// 컬러 선택 UI
|
|
5543
|
-
const renderColorSelector = () => (jsxs("div", { className: "designbase-color-picker__selector", children: [
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
hsl(${hue}, ${saturation}%, ${lightness}%))`
|
|
5556
|
-
} })] }))] }), jsxs("div", { className: "designbase-color-picker__preview", children: [jsx("div", { className: "designbase-color-picker__preview-box", style: {
|
|
5557
|
-
backgroundColor: showAlpha
|
|
5558
|
-
? `hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha / 100})`
|
|
5559
|
-
: `hsl(${hue}, ${saturation}%, ${lightness}%)`
|
|
5560
|
-
} }), jsxs("div", { className: "designbase-color-picker__preview-info", children: [jsx("div", { className: "designbase-color-picker__preview-value", children: getFormattedColor() }), showCopyButton && (jsx("button", { type: "button", className: "designbase-color-picker__copy-button", onClick: handleCopy, "aria-label": "Copy color value", children: isCopied ? jsx(DoneIcon$1, { size: 14 }) : jsx(CopyIcon, { size: 14 }) }))] })] })] }));
|
|
5541
|
+
const renderColorSelector = () => (jsxs("div", { className: "designbase-color-picker__selector", children: [jsx("div", { className: "designbase-color-picker__color-area", children: jsx("div", { className: "designbase-color-picker__color-field", style: {
|
|
5542
|
+
background: `linear-gradient(to right,
|
|
5543
|
+
hsl(${hue}, 0%, 50%),
|
|
5544
|
+
hsl(${hue}, 100%, 50%)),
|
|
5545
|
+
linear-gradient(to bottom,
|
|
5546
|
+
transparent,
|
|
5547
|
+
hsl(${hue}, ${saturation}%, 0%))`
|
|
5548
|
+
}, onClick: handleColorAreaClick, children: jsx("div", { className: "designbase-color-picker__color-pointer", style: {
|
|
5549
|
+
left: `${saturation}%`,
|
|
5550
|
+
top: `${100 - lightness}%`,
|
|
5551
|
+
backgroundColor: `hsl(${hue}, ${saturation}%, ${lightness}%)`
|
|
5552
|
+
} }) }) }), jsxs("div", { className: "designbase-color-picker__controls", children: [jsx("button", { type: "button", className: "designbase-color-picker__eyedropper", "aria-label": "Eyedropper tool", children: jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: jsx("path", { d: "M2 2h2v2H2V2zm4 0h2v2H6V2zm4 0h2v2h-2V2zm2 4h2v2h-2V6zm0 4h2v2h-2v-2zm0 4h2v2h-2v-2zm-4 0h2v2H6v-2zm-4 0h2v2H2v-2z" }) }) }), jsx("div", { className: "designbase-color-picker__hue-slider", children: jsx("input", { type: "range", min: "0", max: "360", value: hue, onChange: handleHueChange, className: "designbase-color-picker__slider designbase-color-picker__slider--hue" }) }), showAlpha && (jsx("div", { className: "designbase-color-picker__alpha-slider", children: jsx("input", { type: "range", min: "0", max: "100", value: alpha, onChange: handleAlphaChange, className: "designbase-color-picker__slider designbase-color-picker__slider--alpha" }) }))] }), jsxs("div", { className: "designbase-color-picker__value-display", children: [showFormatSelector && (jsxs("select", { className: "designbase-color-picker__format-select", value: colorFormat, onChange: (e) => setColorFormat(e.target.value), children: [jsx("option", { value: "hex", children: "HEX" }), jsx("option", { value: "rgb", children: "RGB" }), jsx("option", { value: "rgba", children: "RGBA" }), jsx("option", { value: "hsl", children: "HSL" }), jsx("option", { value: "hsla", children: "HSLA" })] })), jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, onBlur: handleInputBlur, className: "designbase-color-picker__value-input", placeholder: "#000000" }), showAlpha && (jsxs("span", { className: "designbase-color-picker__alpha-percent", children: [alpha, "%"] })), showCopyButton && (jsx("button", { type: "button", className: "designbase-color-picker__copy-button", onClick: handleCopy, "aria-label": "Copy color value", children: isCopied ? jsx(DoneIcon$1, { size: 14 }) : jsx(CopyIcon, { size: 14 }) }))] })] }));
|
|
5561
5553
|
return (jsxs("div", { ref: pickerRef, className: classes, children: [jsxs("div", { className: "designbase-color-picker__trigger", children: [jsx("div", { className: "designbase-color-picker__color-display", onClick: togglePicker, children: jsx("div", { className: "designbase-color-picker__color-box", style: {
|
|
5562
5554
|
backgroundColor: showAlpha
|
|
5563
5555
|
? `hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha / 100})`
|