261023_02_ENH: 자동완성 옵션 툴팁 동작 수정 및 MMS 배지 색상 구분과 색상 함수 분리
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "kri-ui-registry",
|
||||
"version": "0.15.1",
|
||||
"version": "0.15.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "kri-ui-registry",
|
||||
"version": "0.15.1",
|
||||
"version": "0.15.2",
|
||||
"devDependencies": {
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"@tiptap/extension-color": "^3.27.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "kri-ui-registry",
|
||||
"version": "0.15.1",
|
||||
"version": "0.15.2",
|
||||
"private": true,
|
||||
"description": "KRI internal shadcn UI registry",
|
||||
"scripts": {
|
||||
|
||||
@@ -41,6 +41,17 @@ export function KriEditorSms({
|
||||
const messageType: 'SMS' | 'LMS' | 'MMS' = smsHasAttachment ? 'MMS' : byteSize >= smsMaxBytes || Boolean(smsTitle) ? 'LMS' : 'SMS'
|
||||
const maxBytes = messageType === 'SMS' ? smsMaxBytes : lmsMaxBytes
|
||||
|
||||
function getBadgeColor(): string {
|
||||
switch (messageType) {
|
||||
case 'SMS':
|
||||
return 'bg-red-500'
|
||||
case 'LMS':
|
||||
return 'bg-blue-500'
|
||||
case 'MMS':
|
||||
return 'bg-green-500'
|
||||
}
|
||||
}
|
||||
|
||||
const commitText = React.useCallback((next: string, immediate = false) => {
|
||||
setText(next)
|
||||
latestTextRef.current = next
|
||||
@@ -89,7 +100,7 @@ export function KriEditorSms({
|
||||
<div className="flex h-full flex-col bg-gray-50 px-4 pt-8 pb-4">
|
||||
<div className="mb-3 flex items-center justify-between px-2">
|
||||
<span className="text-xs font-medium text-gray-600">{byteSize}/{maxBytes}byte</span>
|
||||
<span className={cn('rounded-md px-3 py-1 text-xs font-bold text-white', messageType === 'SMS' ? 'bg-red-500' : 'bg-blue-500')}>
|
||||
<span className={cn('rounded-md px-3 py-1 text-xs font-bold text-white', getBadgeColor())}>
|
||||
{messageType}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -54,7 +54,30 @@ function OptionItem<T>({
|
||||
}) {
|
||||
const Icon = option.icon
|
||||
|
||||
const item = (
|
||||
// cmdk's CommandItem overrides onPointerMove, so the label (not the item) is the tooltip trigger.
|
||||
const label = tooltip ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="min-w-0 flex-1 truncate">{option.label}</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent
|
||||
side="right"
|
||||
className={cn(
|
||||
'break-words',
|
||||
tooltip.mode === 'wrap'
|
||||
? 'max-w-[min(28rem,var(--radix-tooltip-content-available-width))]'
|
||||
: 'max-w-[var(--radix-tooltip-content-available-width)]',
|
||||
tooltip.className,
|
||||
)}
|
||||
>
|
||||
{option.label}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<span className="truncate">{option.label}</span>
|
||||
)
|
||||
|
||||
return (
|
||||
<CommandItem
|
||||
value={`${option.label} ${option.value}`}
|
||||
disabled={option.disabled}
|
||||
@@ -72,29 +95,9 @@ function OptionItem<T>({
|
||||
</span>
|
||||
) : null}
|
||||
{Icon ? <Icon className="size-4" style={{ color: option.style?.iconColor }} /> : null}
|
||||
<span className="truncate">{option.label}</span>
|
||||
{label}
|
||||
</CommandItem>
|
||||
)
|
||||
|
||||
if (!tooltip) return item
|
||||
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>{item}</TooltipTrigger>
|
||||
<TooltipContent
|
||||
side="right"
|
||||
className={cn(
|
||||
'break-words',
|
||||
tooltip.mode === 'wrap'
|
||||
? 'max-w-[min(28rem,var(--radix-tooltip-content-available-width))]'
|
||||
: 'max-w-[var(--radix-tooltip-content-available-width)]',
|
||||
tooltip.className,
|
||||
)}
|
||||
>
|
||||
{option.label}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
|
||||
function OptionsGroup<T>({
|
||||
|
||||
Reference in New Issue
Block a user