@designbasekorea/ui 0.2.28 → 0.2.30
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.esm.js +76 -79
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +76 -79
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +76 -79
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -5277,7 +5277,7 @@ const Chip = ({ label, size = 'm', variant = 'default', color = 'primary', delet
|
|
|
5277
5277
|
};
|
|
5278
5278
|
Chip.displayName = 'Chip';
|
|
5279
5279
|
|
|
5280
|
-
|
|
5280
|
+
/* ----------------------- 유틸 ----------------------- */
|
|
5281
5281
|
const clamp = (n, min, max) => Math.max(min, Math.min(max, n));
|
|
5282
5282
|
const hexToRgb = (hex) => {
|
|
5283
5283
|
const m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex.trim());
|
|
@@ -5289,6 +5289,7 @@ const rgbToHex = (r, g, b) => {
|
|
|
5289
5289
|
const toHex = (n) => clamp(Math.round(n), 0, 255).toString(16).padStart(2, '0');
|
|
5290
5290
|
return `#${toHex(r)}${toHex(g)}${toHex(b)}`.toUpperCase();
|
|
5291
5291
|
};
|
|
5292
|
+
/** RGB ↔ HSV (HSV: h[0-360], s[0-100], v[0-100]) */
|
|
5292
5293
|
const rgbToHsv = (r, g, b) => {
|
|
5293
5294
|
r /= 255;
|
|
5294
5295
|
g /= 255;
|
|
@@ -5351,7 +5352,11 @@ const hsvToRgb = (h, s, v) => {
|
|
|
5351
5352
|
gp = 0;
|
|
5352
5353
|
bp = x;
|
|
5353
5354
|
}
|
|
5354
|
-
return {
|
|
5355
|
+
return {
|
|
5356
|
+
r: Math.round((rp + m) * 255),
|
|
5357
|
+
g: Math.round((gp + m) * 255),
|
|
5358
|
+
b: Math.round((bp + m) * 255),
|
|
5359
|
+
};
|
|
5355
5360
|
};
|
|
5356
5361
|
const rgbToHsl = (r, g, b) => {
|
|
5357
5362
|
r /= 255;
|
|
@@ -5376,10 +5381,15 @@ const rgbToHsl = (r, g, b) => {
|
|
|
5376
5381
|
}
|
|
5377
5382
|
h *= 60;
|
|
5378
5383
|
}
|
|
5379
|
-
return {
|
|
5384
|
+
return {
|
|
5385
|
+
h: Math.round(h * 100) / 100,
|
|
5386
|
+
s: Math.round(s * 10000) / 100,
|
|
5387
|
+
l: Math.round(l * 10000) / 100,
|
|
5388
|
+
};
|
|
5380
5389
|
};
|
|
5390
|
+
/* ----------------------- 컴포넌트 ----------------------- */
|
|
5381
5391
|
const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left', value, defaultValue = '#006FFF', showInput = true, showAlpha = true, showFormatSelector = true, showCopyButton = true, disabled = false, readonly = false, onChange, onApply, onCancel, className, }) => {
|
|
5382
|
-
/** 내부
|
|
5392
|
+
/** 내부 HSV + alpha */
|
|
5383
5393
|
const [h, setH] = useState(211);
|
|
5384
5394
|
const [s, setS] = useState(100);
|
|
5385
5395
|
const [v, setV] = useState(50);
|
|
@@ -5387,15 +5397,13 @@ const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left',
|
|
|
5387
5397
|
const [isOpen, setIsOpen] = useState(false);
|
|
5388
5398
|
const [format, setFormat] = useState('hex');
|
|
5389
5399
|
const [isCopied, setIsCopied] = useState(false);
|
|
5390
|
-
// 하단 컬러 인풋(문자열), 알파 인풋(문자열) – 엔터로만 확정
|
|
5391
5400
|
const [colorInput, setColorInput] = useState('');
|
|
5392
5401
|
const [alphaInput, setAlphaInput] = useState('100');
|
|
5393
|
-
// 모달용 임시 상태 (적용/취소 버튼용)
|
|
5394
5402
|
const [tempColor, setTempColor] = useState('');
|
|
5395
5403
|
const pickerRef = useRef(null);
|
|
5396
5404
|
const areaRef = useRef(null);
|
|
5397
5405
|
const dragging = useRef(false);
|
|
5398
|
-
/**
|
|
5406
|
+
/** 초기값 세팅 */
|
|
5399
5407
|
useEffect(() => {
|
|
5400
5408
|
const initial = (value || defaultValue).toUpperCase();
|
|
5401
5409
|
const rgb = hexToRgb(initial);
|
|
@@ -5404,12 +5412,11 @@ const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left',
|
|
|
5404
5412
|
setH(h);
|
|
5405
5413
|
setS(s);
|
|
5406
5414
|
setV(v);
|
|
5407
|
-
setColorInput(initial);
|
|
5408
|
-
setAlphaInput('100');
|
|
5409
5415
|
}
|
|
5410
|
-
|
|
5416
|
+
setColorInput(initial);
|
|
5417
|
+
setAlphaInput('100');
|
|
5411
5418
|
}, []);
|
|
5412
|
-
/**
|
|
5419
|
+
/** 제어형(value) → HSV */
|
|
5413
5420
|
useEffect(() => {
|
|
5414
5421
|
if (!value)
|
|
5415
5422
|
return;
|
|
@@ -5421,11 +5428,11 @@ const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left',
|
|
|
5421
5428
|
setV(v);
|
|
5422
5429
|
}
|
|
5423
5430
|
}, [value]);
|
|
5424
|
-
/**
|
|
5431
|
+
/** RGB/HSL 계산 */
|
|
5425
5432
|
const rgb = useMemo(() => hsvToRgb(h, s, v), [h, s, v]);
|
|
5426
5433
|
const hex = useMemo(() => rgbToHex(rgb.r, rgb.g, rgb.b), [rgb]);
|
|
5427
5434
|
const hsl = useMemo(() => rgbToHsl(rgb.r, rgb.g, rgb.b), [rgb]);
|
|
5428
|
-
/**
|
|
5435
|
+
/** 출력값 formatted */
|
|
5429
5436
|
const formatted = useMemo(() => {
|
|
5430
5437
|
const alpha = a / 100;
|
|
5431
5438
|
switch (format) {
|
|
@@ -5437,24 +5444,24 @@ const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left',
|
|
|
5437
5444
|
default: return hex;
|
|
5438
5445
|
}
|
|
5439
5446
|
}, [format, hex, rgb, hsl, a]);
|
|
5440
|
-
/**
|
|
5447
|
+
/** ✅ 무한 루프 방지: formatted이 부모 value랑 같으면 onChange 호출하지 않음 */
|
|
5441
5448
|
useEffect(() => {
|
|
5449
|
+
if (value !== undefined && value.toUpperCase() === formatted.toUpperCase())
|
|
5450
|
+
return;
|
|
5442
5451
|
onChange?.(formatted);
|
|
5443
|
-
|
|
5444
|
-
setAlphaInput(String(a));
|
|
5445
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5446
|
-
}, [formatted]);
|
|
5452
|
+
}, [formatted, onChange, value]);
|
|
5447
5453
|
/** 드롭다운 외부 클릭 닫기 */
|
|
5448
5454
|
useEffect(() => {
|
|
5449
5455
|
const handler = (e) => {
|
|
5450
|
-
if (pickerRef.current && !pickerRef.current.contains(e.target))
|
|
5456
|
+
if (pickerRef.current && !pickerRef.current.contains(e.target)) {
|
|
5451
5457
|
setIsOpen(false);
|
|
5458
|
+
}
|
|
5452
5459
|
};
|
|
5453
5460
|
if (isOpen && type === 'dropdown')
|
|
5454
5461
|
document.addEventListener('mousedown', handler);
|
|
5455
5462
|
return () => document.removeEventListener('mousedown', handler);
|
|
5456
5463
|
}, [isOpen, type]);
|
|
5457
|
-
/**
|
|
5464
|
+
/** S/V 영역 업데이트 */
|
|
5458
5465
|
const updateFromArea = (clientX, clientY) => {
|
|
5459
5466
|
const el = areaRef.current;
|
|
5460
5467
|
if (!el)
|
|
@@ -5477,27 +5484,24 @@ const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left',
|
|
|
5477
5484
|
return; const t = e.touches[0]; updateFromArea(t.clientX, t.clientY); };
|
|
5478
5485
|
const onAreaTouchEnd = () => { dragging.current = false; };
|
|
5479
5486
|
/** 슬라이더 */
|
|
5480
|
-
const onHueChange = useCallback((e) =>
|
|
5481
|
-
setH(parseInt(e.target.value, 10));
|
|
5482
|
-
}, []);
|
|
5487
|
+
const onHueChange = useCallback((e) => setH(parseInt(e.target.value, 10)), []);
|
|
5483
5488
|
const onAlphaChange = useCallback((e) => {
|
|
5484
5489
|
const newAlpha = parseInt(e.target.value, 10);
|
|
5485
5490
|
setA(newAlpha);
|
|
5486
|
-
setAlphaInput(String(newAlpha));
|
|
5491
|
+
setAlphaInput(String(newAlpha));
|
|
5487
5492
|
}, []);
|
|
5488
|
-
/** 컬러
|
|
5489
|
-
const
|
|
5493
|
+
/** 컬러 인풋 (엔터 확정) */
|
|
5494
|
+
const commitColorInput = useCallback(() => {
|
|
5490
5495
|
const str = colorInput.trim();
|
|
5491
|
-
// HEX
|
|
5492
5496
|
if (/^#([0-9A-Fa-f]{6})$/.test(str)) {
|
|
5493
5497
|
const rgb = hexToRgb(str);
|
|
5494
5498
|
const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);
|
|
5495
5499
|
setH(hsv.h);
|
|
5496
5500
|
setS(hsv.s);
|
|
5497
5501
|
setV(hsv.v);
|
|
5502
|
+
setColorInput(str.toUpperCase());
|
|
5498
5503
|
return;
|
|
5499
5504
|
}
|
|
5500
|
-
// rgb()
|
|
5501
5505
|
let m = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(str);
|
|
5502
5506
|
if (m) {
|
|
5503
5507
|
const r = clamp(parseInt(m[1], 10), 0, 255);
|
|
@@ -5507,9 +5511,9 @@ const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left',
|
|
|
5507
5511
|
setH(hsv.h);
|
|
5508
5512
|
setS(hsv.s);
|
|
5509
5513
|
setV(hsv.v);
|
|
5514
|
+
setColorInput(`rgb(${r}, ${g}, ${b})`.toUpperCase());
|
|
5510
5515
|
return;
|
|
5511
5516
|
}
|
|
5512
|
-
// rgba()
|
|
5513
5517
|
m = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i.exec(str);
|
|
5514
5518
|
if (m) {
|
|
5515
5519
|
const r = clamp(parseInt(m[1], 10), 0, 255);
|
|
@@ -5521,37 +5525,32 @@ const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left',
|
|
|
5521
5525
|
setS(hsv.s);
|
|
5522
5526
|
setV(hsv.v);
|
|
5523
5527
|
setA(Math.round(alpha * 100));
|
|
5528
|
+
setAlphaInput(String(Math.round(alpha * 100)));
|
|
5529
|
+
setColorInput(`rgba(${r}, ${g}, ${b}, ${alpha})`.toUpperCase());
|
|
5524
5530
|
return;
|
|
5525
5531
|
}
|
|
5526
|
-
// 실패 → 원래 값으로 복구
|
|
5527
5532
|
setColorInput(formatted.toUpperCase());
|
|
5528
|
-
};
|
|
5533
|
+
}, [colorInput, formatted]);
|
|
5529
5534
|
const onColorKeyDown = (e) => {
|
|
5530
5535
|
if (e.key === 'Enter')
|
|
5531
|
-
|
|
5536
|
+
commitColorInput();
|
|
5532
5537
|
};
|
|
5533
|
-
const onColorBlur = () =>
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
};
|
|
5537
|
-
/** 알파 인풋: 엔터로만 확정 (0-100) */
|
|
5538
|
-
const tryCommitAlphaInput = () => {
|
|
5538
|
+
const onColorBlur = () => setColorInput(formatted.toUpperCase());
|
|
5539
|
+
/** 알파 인풋 (엔터 확정) */
|
|
5540
|
+
const commitAlphaInput = useCallback(() => {
|
|
5539
5541
|
const n = Number(alphaInput.trim());
|
|
5540
5542
|
if (!Number.isNaN(n) && n >= 0 && n <= 100) {
|
|
5541
5543
|
setA(Math.round(n));
|
|
5544
|
+
setAlphaInput(String(Math.round(n)));
|
|
5542
5545
|
return;
|
|
5543
5546
|
}
|
|
5544
|
-
// 실패 → 복구
|
|
5545
5547
|
setAlphaInput(String(a));
|
|
5546
|
-
};
|
|
5548
|
+
}, [alphaInput, a]);
|
|
5547
5549
|
const onAlphaInputKeyDown = (e) => {
|
|
5548
5550
|
if (e.key === 'Enter')
|
|
5549
|
-
|
|
5550
|
-
};
|
|
5551
|
-
const onAlphaInputBlur = () => {
|
|
5552
|
-
// 엔터로만 반영. 블러 시 복원.
|
|
5553
|
-
setAlphaInput(String(a));
|
|
5551
|
+
commitAlphaInput();
|
|
5554
5552
|
};
|
|
5553
|
+
const onAlphaInputBlur = () => setAlphaInput(String(a));
|
|
5555
5554
|
/** 복사 */
|
|
5556
5555
|
const onCopy = useCallback(async () => {
|
|
5557
5556
|
try {
|
|
@@ -5575,21 +5574,17 @@ const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left',
|
|
|
5575
5574
|
setS(hsv.s);
|
|
5576
5575
|
setV(hsv.v);
|
|
5577
5576
|
}
|
|
5578
|
-
else {
|
|
5579
|
-
console.log('EyeDropper API is not supported');
|
|
5580
|
-
}
|
|
5581
5577
|
}
|
|
5582
5578
|
catch (e) {
|
|
5583
5579
|
console.error(e);
|
|
5584
5580
|
}
|
|
5585
5581
|
}, []);
|
|
5586
|
-
/**
|
|
5582
|
+
/** modal open(중요: formatted deps 제거) */
|
|
5587
5583
|
const handleModalOpen = useCallback(() => {
|
|
5588
|
-
if (type === 'modal')
|
|
5589
|
-
setTempColor(
|
|
5590
|
-
}
|
|
5584
|
+
if (type === 'modal')
|
|
5585
|
+
setTempColor(hex);
|
|
5591
5586
|
setIsOpen(true);
|
|
5592
|
-
}, [type,
|
|
5587
|
+
}, [type, hex]);
|
|
5593
5588
|
const handleModalApply = useCallback(() => {
|
|
5594
5589
|
if (type === 'modal') {
|
|
5595
5590
|
onApply?.(formatted);
|
|
@@ -5598,55 +5593,57 @@ const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left',
|
|
|
5598
5593
|
}, [type, formatted, onApply]);
|
|
5599
5594
|
const handleModalCancel = useCallback(() => {
|
|
5600
5595
|
if (type === 'modal') {
|
|
5601
|
-
// 원래 색상으로 복원
|
|
5602
5596
|
const rgb = hexToRgb(tempColor);
|
|
5603
5597
|
if (rgb) {
|
|
5604
|
-
const
|
|
5605
|
-
setH(h);
|
|
5606
|
-
setS(s);
|
|
5607
|
-
setV(v);
|
|
5598
|
+
const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);
|
|
5599
|
+
setH(hsv.h);
|
|
5600
|
+
setS(hsv.s);
|
|
5601
|
+
setV(hsv.v);
|
|
5608
5602
|
}
|
|
5609
5603
|
onCancel?.();
|
|
5610
5604
|
setIsOpen(false);
|
|
5611
5605
|
}
|
|
5612
5606
|
}, [type, tempColor, onCancel]);
|
|
5613
|
-
/**
|
|
5607
|
+
/** 스타일 */
|
|
5614
5608
|
const hueTrackStyle = useMemo(() => ({
|
|
5615
5609
|
background: `linear-gradient(to right,
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5610
|
+
hsl(0,100%,50%),
|
|
5611
|
+
hsl(60,100%,50%),
|
|
5612
|
+
hsl(120,100%,50%),
|
|
5613
|
+
hsl(180,100%,50%),
|
|
5614
|
+
hsl(240,100%,50%),
|
|
5615
|
+
hsl(300,100%,50%),
|
|
5616
|
+
hsl(360,100%,50%))`,
|
|
5623
5617
|
}), []);
|
|
5624
5618
|
const areaBackground = useMemo(() => ({
|
|
5625
5619
|
backgroundImage: `
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5620
|
+
linear-gradient(to top, rgba(0,0,0,1), rgba(0,0,0,0)),
|
|
5621
|
+
linear-gradient(to right, #ffffff, hsl(${h}, 100%, 50%))
|
|
5622
|
+
`,
|
|
5629
5623
|
}), [h]);
|
|
5630
|
-
/** ✔︎ 알파 트랙: 색상 무관, 고정 흑백 그라디언트 */
|
|
5631
5624
|
const alphaTrackStyle = useMemo(() => ({
|
|
5632
5625
|
backgroundImage: `
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5626
|
+
linear-gradient(45deg, var(--db-border-base) 25%, transparent 25%),
|
|
5627
|
+
linear-gradient(-45deg, var(--db-border-base) 25%, transparent 25%),
|
|
5628
|
+
linear-gradient(45deg, transparent 75%, var(--db-border-base) 75%),
|
|
5629
|
+
linear-gradient(-45deg, transparent 75%, var(--db-border-base) 75%),
|
|
5630
|
+
linear-gradient(to right, rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 0), rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 1))
|
|
5631
|
+
`,
|
|
5639
5632
|
backgroundSize: '8px 8px,8px 8px,8px 8px,8px 8px,100% 100%',
|
|
5640
5633
|
backgroundPosition: '0 0,0 4px,4px -4px,-4px 0,0 0',
|
|
5641
5634
|
backgroundColor: 'var(--db-surface-base)',
|
|
5642
|
-
}), []);
|
|
5635
|
+
}), [rgb]);
|
|
5643
5636
|
const classes = clsx('designbase-color-picker', `designbase-color-picker--${size}`, `designbase-color-picker--${position}`, {
|
|
5644
5637
|
'designbase-color-picker--disabled': disabled,
|
|
5645
5638
|
'designbase-color-picker--readonly': readonly,
|
|
5646
5639
|
'designbase-color-picker--open': isOpen,
|
|
5647
5640
|
'designbase-color-picker--no-input': !showInput,
|
|
5648
5641
|
}, className);
|
|
5649
|
-
const Trigger = (jsxs("div", { className: "designbase-color-picker__trigger", onClick: () => !disabled && !readonly &&
|
|
5642
|
+
const Trigger = (jsxs("div", { className: "designbase-color-picker__trigger", onClick: () => !disabled && !readonly && (type === 'modal' ? handleModalOpen() : setIsOpen(v => !v)), children: [jsx("div", { className: "designbase-color-picker__color-display", children: jsx("div", { className: "designbase-color-picker__color-box", style: {
|
|
5643
|
+
backgroundColor: showAlpha
|
|
5644
|
+
? `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${a / 100})`
|
|
5645
|
+
: hex
|
|
5646
|
+
} }) }), showInput && (jsx("input", { type: "text", value: colorInput, onChange: (e) => setColorInput(e.target.value), onKeyDown: onColorKeyDown, onBlur: onColorBlur, onClick: (e) => e.stopPropagation(), disabled: disabled, readOnly: readonly, className: "designbase-color-picker__input", placeholder: "#000000" })), showInput && showCopyButton && (jsx("button", { type: "button", className: "designbase-color-picker__copy-button-inline", onClick: (e) => { e.stopPropagation(); onCopy(); }, disabled: disabled, "aria-label": "Copy color value", children: isCopied ? jsx(DoneIcon$1, { size: 14 }) : jsx(CopyIcon, { size: 14 }) })), jsx("button", { type: "button", className: "designbase-color-picker__toggle", disabled: disabled, "aria-label": "Toggle color picker", children: jsx(ChevronDownIcon, { size: 16 }) })] }));
|
|
5650
5647
|
const Selector = (jsxs("div", { className: "designbase-color-picker__selector", children: [jsx("div", { className: "designbase-color-picker__color-area", children: jsx("div", { ref: areaRef, className: "designbase-color-picker__color-field", style: areaBackground, onMouseDown: onAreaMouseDown, onMouseMove: onAreaMouseMove, onMouseUp: onAreaMouseUp, onMouseLeave: onAreaLeave, onTouchStart: onAreaTouchStart, onTouchMove: onAreaTouchMove, onTouchEnd: onAreaTouchEnd, children: jsx("div", { className: "designbase-color-picker__color-pointer", style: { left: `${s}%`, top: `${100 - v}%`, backgroundColor: `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})` } }) }) }), jsxs("div", { className: "designbase-color-picker__controls", children: [jsx(Button, { variant: "tertiary", size: "m", iconOnly: true, onClick: onEyedrop, "aria-label": "Eyedropper tool", children: jsx(EyedropperIcon, {}) }), jsxs("div", { className: "designbase-color-picker__slider-container", children: [jsx("div", { className: "designbase-color-picker__hue-slider", children: jsx("input", { type: "range", min: 0, max: 360, value: h, onChange: onHueChange, className: "designbase-color-picker__slider designbase-color-picker__slider--hue", style: hueTrackStyle }) }), showAlpha && (jsx("div", { className: "designbase-color-picker__alpha-slider", children: jsx("input", { type: "range", min: 0, max: 100, value: a, onChange: onAlphaChange, className: "designbase-color-picker__slider designbase-color-picker__slider--alpha", style: alphaTrackStyle }) }))] })] }), jsxs("div", { className: "designbase-color-picker__value-display", children: [showFormatSelector && (jsx(Select, { value: format, onChange: (v) => setFormat(v), showClearButton: false, options: [
|
|
5651
5648
|
{ label: 'HEX', value: 'hex' },
|
|
5652
5649
|
{ label: 'RGB', value: 'rgb' },
|
|
@@ -5654,7 +5651,7 @@ const ColorPicker = ({ size = 'm', type = 'dropdown', position = 'bottom-left',
|
|
|
5654
5651
|
{ label: 'HSL', value: 'hsl' },
|
|
5655
5652
|
{ label: 'HSLA', value: 'hsla' },
|
|
5656
5653
|
], size: "s", position: "top" })), jsx(Input, { type: "text", value: colorInput, onChange: setColorInput, onKeyDown: onColorKeyDown, onBlur: onColorBlur, placeholder: "#000000", size: "s", className: "designbase-color-picker__value-input" }), showAlpha && (jsxs("div", { className: "designbase-color-picker__alpha-input-wrap", children: [jsx(Input, { type: "text", inputMode: "numeric", value: alphaInput, onChange: (value) => setAlphaInput(value.replace(/[^\d]/g, '').slice(0, 3)), onKeyDown: onAlphaInputKeyDown, onBlur: onAlphaInputBlur, placeholder: "100", size: "s", className: "designbase-color-picker__alpha-input", "aria-label": "Alpha percent" }), jsx("span", { className: "designbase-color-picker__alpha-suffix", children: "%" })] })), showCopyButton && (jsx(Button, { variant: "tertiary", size: "m", iconOnly: true, onClick: onCopy, "aria-label": "Copy color value", children: isCopied ? jsx(DoneIcon$1, {}) : jsx(CopyIcon, {}) }))] })] }));
|
|
5657
|
-
return (jsxs("div", { ref: pickerRef, className: classes, children: [Trigger, type === 'dropdown' && isOpen && (jsx("div", { className: "designbase-color-picker__dropdown", onClick: (e) => e.stopPropagation(), children: Selector })), type === 'modal' && (jsxs(Modal, { isOpen: isOpen, onClose: handleModalCancel, title: "\uC0C9\uC0C1 \uC120\uD0DD", size: "s", children: [jsx(ModalBody, { children: Selector }), jsx(ModalFooter, { children: jsxs("div", { style: { display: 'flex', gap:
|
|
5654
|
+
return (jsxs("div", { ref: pickerRef, className: classes, children: [Trigger, type === 'dropdown' && isOpen && (jsx("div", { className: "designbase-color-picker__dropdown", onClick: (e) => e.stopPropagation(), children: Selector })), type === 'modal' && (jsxs(Modal, { isOpen: isOpen, onClose: handleModalCancel, title: "\uC0C9\uC0C1 \uC120\uD0DD", size: "s", children: [jsx(ModalBody, { children: Selector }), jsx(ModalFooter, { children: jsxs("div", { style: { display: 'flex', gap: 8, justifyContent: 'flex-end' }, children: [jsx(Button, { variant: "tertiary", size: "s", onClick: handleModalCancel, children: "\uCDE8\uC18C" }), jsx(Button, { variant: "primary", size: "s", onClick: handleModalApply, children: "\uC801\uC6A9" })] }) })] }))] }));
|
|
5658
5655
|
};
|
|
5659
5656
|
ColorPicker.displayName = 'ColorPicker';
|
|
5660
5657
|
|