(props: PickerItemProps)
| 340 | children: ReactNode; |
| 341 | } |
| 342 | export function PickerItem(props: PickerItemProps): ReactNode { |
| 343 | let ref = useRef(null); |
| 344 | let isLink = props.href != null; |
| 345 | const size = 'M'; |
| 346 | return ( |
| 347 | <ListBoxItem |
| 348 | {...props} |
| 349 | ref={ref} |
| 350 | textValue={ |
| 351 | props.textValue || |
| 352 | (typeof props.children === 'string' ? (props.children as string) : undefined) |
| 353 | } |
| 354 | style={pressScale(ref, props.UNSAFE_style)} |
| 355 | className={renderProps => |
| 356 | (props.UNSAFE_className || '') + menuitem({...renderProps, size, isLink}, props.styles) |
| 357 | }> |
| 358 | {renderProps => { |
| 359 | let {children} = props; |
| 360 | return ( |
| 361 | <DefaultProvider |
| 362 | context={IconContext} |
| 363 | value={{ |
| 364 | slots: { |
| 365 | icon: { |
| 366 | render: centerBaseline({slot: 'icon', styles: iconCenterWrapper({})}), |
| 367 | styles: icon |
| 368 | } |
| 369 | } |
| 370 | }}> |
| 371 | <DefaultProvider |
| 372 | context={TextContext} |
| 373 | value={{ |
| 374 | slots: { |
| 375 | [DEFAULT_SLOT]: {styles: label({size})} |
| 376 | } |
| 377 | }}> |
| 378 | {!isLink && ( |
| 379 | <CheckmarkIcon size={size} className={checkmark({...renderProps, size})} /> |
| 380 | )} |
| 381 | {typeof children === 'string' ? <Text>{children}</Text> : children} |
| 382 | </DefaultProvider> |
| 383 | </DefaultProvider> |
| 384 | ); |
| 385 | }} |
| 386 | </ListBoxItem> |
| 387 | ); |
| 388 | } |
| 389 | // A Context.Provider that only sets a value if not inside SelectValue. |
| 390 | function DefaultProvider({ |
| 391 | context, |
nothing calls this directly
no test coverage detected