(props: SelectBoxProps)
| 322 | * SelectBox is a single selectable item in a SelectBoxGroup. |
| 323 | */ |
| 324 | export function SelectBox(props: SelectBoxProps): ReactNode { |
| 325 | let { |
| 326 | children, |
| 327 | isDisabled: individualDisabled = false, |
| 328 | UNSAFE_style, |
| 329 | UNSAFE_className, |
| 330 | styles, |
| 331 | ...otherProps |
| 332 | } = props; |
| 333 | |
| 334 | let {orientation = 'vertical', isDisabled: groupDisabled = false} = useContext(SelectBoxContext); |
| 335 | |
| 336 | const isDisabled = individualDisabled || groupDisabled; |
| 337 | const ref = useRef<HTMLDivElement>(null); |
| 338 | let {isFocusVisible} = useFocusVisible(); |
| 339 | |
| 340 | // oxlint-disable react/react-compiler |
| 341 | return ( |
| 342 | <ListBoxItem |
| 343 | isDisabled={isDisabled} |
| 344 | ref={ref} |
| 345 | className={renderProps => |
| 346 | (UNSAFE_className || '') + |
| 347 | selectBoxStyles( |
| 348 | { |
| 349 | ...renderProps, |
| 350 | isFocusVisible: isFocusVisible && renderProps.isFocused, |
| 351 | orientation |
| 352 | }, |
| 353 | styles |
| 354 | ) |
| 355 | } |
| 356 | style={pressScale(ref, UNSAFE_style)} |
| 357 | {...otherProps}> |
| 358 | {({isSelected, isDisabled, isHovered, selectionMode}) => { |
| 359 | return ( |
| 360 | <> |
| 361 | <div |
| 362 | className={style({ |
| 363 | position: 'absolute', |
| 364 | top: 8, |
| 365 | insetStart: 8, |
| 366 | pointerEvents: 'none' |
| 367 | })} |
| 368 | aria-hidden="true"> |
| 369 | {!isDisabled && selectionMode === 'multiple' && ( |
| 370 | <div |
| 371 | className={box({ |
| 372 | isSelected, |
| 373 | isDisabled, |
| 374 | size: 'M' |
| 375 | } as any)}> |
| 376 | <Checkmark size="S" className={iconStyles} /> |
| 377 | </div> |
| 378 | )} |
| 379 | </div> |
| 380 | <Provider |
| 381 | values={[ |
nothing calls this directly
no test coverage detected