Files
claude-code/src/components/CustomSelect/select-option.tsx
claude-code-best a574ea205b style(B1-5): 格式化 components其余 + hooks + tools (232 files)
纯格式化:移除分号、React Compiler import、import 多行展开。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 22:50:19 +08:00

65 lines
1.3 KiB
TypeScript

import React, { type ReactNode } from 'react'
import { ListItem } from '../design-system/ListItem.js'
export type SelectOptionProps = {
/**
* Determines if option is focused.
*/
readonly isFocused: boolean
/**
* Determines if option is selected.
*/
readonly isSelected: boolean
/**
* Option label.
*/
readonly children: ReactNode
/**
* Optional description to display below the label.
*/
readonly description?: string
/**
* Determines if the down arrow should be shown.
*/
readonly shouldShowDownArrow?: boolean
/**
* Determines if the up arrow should be shown.
*/
readonly shouldShowUpArrow?: boolean
/**
* Whether ListItem should declare the terminal cursor position.
* Set false when a child declares its own cursor (e.g. BaseTextInput).
*/
readonly declareCursor?: boolean
}
export function SelectOption({
isFocused,
isSelected,
children,
description,
shouldShowDownArrow,
shouldShowUpArrow,
declareCursor,
}: SelectOptionProps): React.ReactNode {
return (
<ListItem
isFocused={isFocused}
isSelected={isSelected}
description={description}
showScrollDown={shouldShowDownArrow}
showScrollUp={shouldShowUpArrow}
styled={false}
declareCursor={declareCursor}
>
{children}
</ListItem>
)
}