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