260617_01_ENH: 배정 테스트를 위해 개발 중도 커밋
This commit is contained in:
@@ -1136,171 +1136,150 @@ function MultiSelectInner(
|
||||
responsiveSettings.compactMode && "gap-0.5"
|
||||
)}
|
||||
>
|
||||
{selectedValues
|
||||
.slice(0, responsiveSettings.maxCount)
|
||||
.map((value) => {
|
||||
const option =
|
||||
getOptionByValue(value) ??
|
||||
({ value, label: value } as MultiSelectOption<any>);
|
||||
const IconComponent = option.icon;
|
||||
const customStyle = option.style;
|
||||
const badgeStyle: React.CSSProperties = {
|
||||
animationDuration: `${animation}s`,
|
||||
...(customStyle?.badgeColor && {
|
||||
backgroundColor: customStyle.badgeColor,
|
||||
}),
|
||||
...(customStyle?.gradient && {
|
||||
background: customStyle.gradient,
|
||||
color: "white",
|
||||
}),
|
||||
};
|
||||
return (
|
||||
<Badge
|
||||
key={value}
|
||||
className={cn(
|
||||
getBadgeAnimationClass(),
|
||||
multiSelectVariants({ variant }),
|
||||
customStyle?.gradient &&
|
||||
"text-white border-transparent",
|
||||
responsiveSettings.compactMode &&
|
||||
"px-1.5 py-0.5",
|
||||
screenSize === "mobile" &&
|
||||
"max-w-[120px] truncate",
|
||||
singleLine &&
|
||||
"flex-shrink-0 whitespace-nowrap",
|
||||
"[&>svg]:pointer-events-auto",
|
||||
badgeClassName
|
||||
)}
|
||||
style={{
|
||||
...badgeStyle,
|
||||
animationDuration: `${
|
||||
animationConfig?.duration || animation
|
||||
}s`,
|
||||
animationDelay: `${
|
||||
animationConfig?.delay || 0
|
||||
}s`,
|
||||
}}
|
||||
>
|
||||
{IconComponent &&
|
||||
!responsiveSettings.hideIcons && (
|
||||
<IconComponent
|
||||
className={cn(
|
||||
"h-4 w-4 mr-2",
|
||||
responsiveSettings.compactMode &&
|
||||
"h-3 w-3 mr-1",
|
||||
customStyle?.iconColor &&
|
||||
"text-current"
|
||||
)}
|
||||
{...(customStyle?.iconColor && {
|
||||
style: { color: customStyle.iconColor },
|
||||
})}
|
||||
/>
|
||||
)}
|
||||
<span
|
||||
{
|
||||
selectedValues.length <= responsiveSettings.maxCount?
|
||||
selectedValues
|
||||
.slice(0, responsiveSettings.maxCount)
|
||||
.map((value) => {
|
||||
const option =
|
||||
getOptionByValue(value) ??
|
||||
({ value, label: value } as MultiSelectOption<any>);
|
||||
const IconComponent = option.icon;
|
||||
const customStyle = option.style;
|
||||
const badgeStyle: React.CSSProperties = {
|
||||
animationDuration: `${animation}s`,
|
||||
...(customStyle?.badgeColor && {
|
||||
backgroundColor: customStyle.badgeColor,
|
||||
}),
|
||||
...(customStyle?.gradient && {
|
||||
background: customStyle.gradient,
|
||||
color: "white",
|
||||
}),
|
||||
};
|
||||
return (
|
||||
<Badge
|
||||
key={value}
|
||||
className={cn(
|
||||
screenSize === "mobile" && "truncate"
|
||||
getBadgeAnimationClass(),
|
||||
multiSelectVariants({ variant }),
|
||||
customStyle?.gradient &&
|
||||
"text-white border-transparent",
|
||||
responsiveSettings.compactMode &&
|
||||
"px-1.5 py-0.5",
|
||||
screenSize === "mobile" &&
|
||||
"max-w-[120px] truncate",
|
||||
singleLine &&
|
||||
"flex-shrink-0 whitespace-nowrap",
|
||||
"[&>svg]:pointer-events-auto",
|
||||
badgeClassName
|
||||
)}
|
||||
style={{
|
||||
...badgeStyle,
|
||||
animationDuration: `${
|
||||
animationConfig?.duration || animation
|
||||
}s`,
|
||||
animationDelay: `${
|
||||
animationConfig?.delay || 0
|
||||
}s`,
|
||||
}}
|
||||
>
|
||||
{IconComponent &&
|
||||
!responsiveSettings.hideIcons && (
|
||||
<IconComponent
|
||||
className={cn(
|
||||
"h-4 w-4 mr-2",
|
||||
responsiveSettings.compactMode &&
|
||||
"h-3 w-3 mr-1",
|
||||
customStyle?.iconColor &&
|
||||
"text-current"
|
||||
)}
|
||||
{...(customStyle?.iconColor && {
|
||||
style: { color: customStyle.iconColor },
|
||||
})}
|
||||
/>
|
||||
)}
|
||||
<span
|
||||
className={cn(
|
||||
screenSize === "mobile" && "truncate"
|
||||
)}
|
||||
>
|
||||
{option.label}
|
||||
</span>
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
toggleOption(value);
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (
|
||||
event.key === "Enter" ||
|
||||
event.key === " "
|
||||
) {
|
||||
event.preventDefault();
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
toggleOption(value);
|
||||
}
|
||||
}}
|
||||
aria-label={`Remove ${option.label} from selection`}
|
||||
className="ml-2 h-4.5 w-4.5 cursor-pointer hover:bg-white/20 rounded-sm p-0.5 -m-0.5 focus:outline-none focus:ring-1 focus:ring-white/50"
|
||||
>
|
||||
{!preventDeselect &&
|
||||
<XCircle
|
||||
className={cn(
|
||||
"h-3 w-3",
|
||||
responsiveSettings.compactMode &&
|
||||
"h-2.5 w-2.5"
|
||||
)}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
</Badge>
|
||||
);
|
||||
})
|
||||
.filter(Boolean)}
|
||||
{selectedValues.length >
|
||||
responsiveSettings.maxCount && (
|
||||
<Badge
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (
|
||||
event.key === "Enter" ||
|
||||
event.key === " "
|
||||
) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
toggleOption(value);
|
||||
}
|
||||
}}
|
||||
aria-label={`Remove ${option.label} from selection`}
|
||||
className="ml-2 h-4.5 w-4.5 cursor-pointer hover:bg-white/20 rounded-sm p-0.5 -m-0.5 focus:outline-none focus:ring-1 focus:ring-white/50"
|
||||
>
|
||||
{!preventDeselect &&
|
||||
<XCircle
|
||||
className={cn(
|
||||
"h-3 w-3",
|
||||
responsiveSettings.compactMode &&
|
||||
"h-2.5 w-2.5"
|
||||
)}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
</Badge>
|
||||
);
|
||||
})
|
||||
.filter(Boolean)
|
||||
:
|
||||
<Badge
|
||||
className={cn(
|
||||
"bg-transparent text-foreground border-foreground/1 hover:bg-transparent",
|
||||
getBadgeAnimationClass(),
|
||||
multiSelectVariants({ variant }),
|
||||
responsiveSettings.compactMode &&
|
||||
"px-1.5 py-0.5",
|
||||
singleLine &&
|
||||
"flex-shrink-0 whitespace-nowrap",
|
||||
"[&>svg]:pointer-events-auto",
|
||||
badgeClassName
|
||||
)}
|
||||
style={{
|
||||
animationDuration: `${
|
||||
animationConfig?.duration || animation
|
||||
}s`,
|
||||
animationDelay: `${
|
||||
animationConfig?.delay || 0
|
||||
}s`,
|
||||
}}
|
||||
>
|
||||
{`+ ${
|
||||
selectedValues.length
|
||||
}`}
|
||||
<XCircle
|
||||
className={cn(
|
||||
"bg-transparent text-foreground border-foreground/1 hover:bg-transparent",
|
||||
getBadgeAnimationClass(),
|
||||
multiSelectVariants({ variant }),
|
||||
"ml-2 h-4 w-4 mt-0.5 cursor-pointer",
|
||||
responsiveSettings.compactMode &&
|
||||
"px-1.5 py-0.5",
|
||||
singleLine &&
|
||||
"flex-shrink-0 whitespace-nowrap",
|
||||
"[&>svg]:pointer-events-auto",
|
||||
badgeClassName
|
||||
"ml-1 h-3 w-3"
|
||||
)}
|
||||
style={{
|
||||
animationDuration: `${
|
||||
animationConfig?.duration || animation
|
||||
}s`,
|
||||
animationDelay: `${
|
||||
animationConfig?.delay || 0
|
||||
}s`,
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
handleClear();
|
||||
}}
|
||||
>
|
||||
{`+${
|
||||
selectedValues.length -
|
||||
responsiveSettings.maxCount
|
||||
} more`}
|
||||
<XCircle
|
||||
className={cn(
|
||||
"ml-2 h-4 w-4 mt-0.5 cursor-pointer",
|
||||
responsiveSettings.compactMode &&
|
||||
"ml-1 h-3 w-3"
|
||||
)}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
clearExtraOptions();
|
||||
}}
|
||||
/>
|
||||
</Badge>
|
||||
)}
|
||||
/>
|
||||
</Badge>
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-center justify-between">
|
||||
{!preventDeselect &&
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
handleClear();
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
handleClear();
|
||||
}
|
||||
}}
|
||||
aria-label={`Clear all ${selectedValues.length} selected options`}
|
||||
className="flex items-center justify-center h-4 w-4 mx-2 cursor-pointer text-muted-foreground hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 rounded-sm"
|
||||
>
|
||||
<XIcon className="h-4 w-4" />
|
||||
</div>
|
||||
}
|
||||
<Separator
|
||||
orientation="vertical"
|
||||
className="flex min-h-6 h-full"
|
||||
|
||||
Reference in New Issue
Block a user