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