mirror of
https://github.com/langgenius/dify.git
synced 2026-06-19 00:21:10 +08:00
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: yyh <yuanyouhuilyz@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: hjlarry <hjlarry@163.com> Co-authored-by: fatelei <fatelei@gmail.com> Co-authored-by: Asuka Minato <i@asukaminato.eu.org> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com> Co-authored-by: gigglewang <gigglewang@dify.ai> Co-authored-by: Yunlu Wen <yunlu.wen@dify.ai> Co-authored-by: chariri <w@chariri.moe> Co-authored-by: Evan <2869018789@qq.com> Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
45 lines
1.6 KiB
TypeScript
45 lines
1.6 KiB
TypeScript
import { cn } from '@langgenius/dify-ui/cn'
|
|
import { RadioRoot } from '@langgenius/dify-ui/radio'
|
|
|
|
type UpdateSettingOptionCardProps<Value extends string> = {
|
|
value: Value
|
|
label: string
|
|
onBlur?: () => void
|
|
onFocus?: () => void
|
|
onMouseEnter?: () => void
|
|
onMouseLeave?: () => void
|
|
}
|
|
|
|
const UpdateSettingOptionCard = <Value extends string>({
|
|
value,
|
|
label,
|
|
onBlur,
|
|
onFocus,
|
|
onMouseEnter,
|
|
onMouseLeave,
|
|
}: UpdateSettingOptionCardProps<Value>) => {
|
|
return (
|
|
<RadioRoot<Value>
|
|
value={value}
|
|
variant="unstyled"
|
|
nativeButton
|
|
render={<button type="button" />}
|
|
onBlur={onBlur}
|
|
onFocus={onFocus}
|
|
onMouseEnter={onMouseEnter}
|
|
onMouseLeave={onMouseLeave}
|
|
title={label}
|
|
className={cn(
|
|
'flex min-w-0 flex-1 cursor-pointer items-center justify-center rounded-lg border border-components-option-card-option-border bg-components-option-card-option-bg p-2 px-3 text-center system-sm-regular text-text-secondary shadow-none outline-hidden transition-colors',
|
|
'hover:border-components-option-card-option-border-hover hover:bg-components-option-card-option-bg-hover',
|
|
'focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden',
|
|
'data-checked:border-[1.5px] data-checked:border-components-option-card-option-selected-border data-checked:bg-components-option-card-option-selected-bg data-checked:system-sm-medium data-checked:text-text-primary data-checked:shadow-xs',
|
|
)}
|
|
>
|
|
<span className="max-w-full min-w-0 truncate whitespace-nowrap">{label}</span>
|
|
</RadioRoot>
|
|
)
|
|
}
|
|
|
|
export default UpdateSettingOptionCard
|