261116_03_ENH: KriColorPalette 중첩 삼항 제거 및 Dice UI 출처 주석 추가

This commit is contained in:
2026-11-16 16:54:42 +09:00
parent e64a48417b
commit 623615a287
3 changed files with 11 additions and 8 deletions

View File

@@ -153,6 +153,7 @@ export function KriColorPalette({
const parsedColor = parseHexColor(color)
if (!parsedColor) return null
const selected = parsedColor.rgb === parsedValue?.rgb
const checkColorClass = isLightHexColor(parsedColor.rgb) ? 'text-black' : 'text-white'
return (
<button
key={parsedColor.rgb}
@@ -164,9 +165,7 @@ export function KriColorPalette({
title={parsedColor.rgb}
onClick={() => selectDiscrete(withAlpha(parsedColor.rgb))}
>
{selected ? (
<Check className={cn('size-3.5', isLightHexColor(parsedColor.rgb) ? 'text-black' : 'text-white')} />
) : null}
{selected ? <Check className={cn('size-3.5', checkColorClass)} /> : null}
</button>
)
})}

View File

@@ -1,5 +1,8 @@
"use client";
// Adapted from Dice UI color-picker (Radix variant), https://www.diceui.com/docs/components/radix/color-picker (MIT License).
// 로컬 변경: import 경로, 아이콘(lucide PipetteIcon), 빈 interface lint 수정.
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";
import {

View File

@@ -101,11 +101,12 @@ function VisuallyHiddenInput<T = InputValue>(
const propertyKey = isCheckInput ? "checked" : "value";
const eventType = isCheckInput ? "click" : "input";
const serializedCurrentValue = isCheckInput
? checked
: typeof value === "object" && value !== null
? JSON.stringify(value)
: value;
let serializedCurrentValue: unknown = value;
if (isCheckInput) {
serializedCurrentValue = checked;
} else if (typeof value === "object" && value !== null) {
serializedCurrentValue = JSON.stringify(value);
}
const descriptor = Object.getOwnPropertyDescriptor(inputProto, propertyKey);