(props: PickerItemProps)
| 768 | } as const; |
| 769 | |
| 770 | export function PickerItem(props: PickerItemProps): ReactNode { |
| 771 | let ref = useRef(null); |
| 772 | let isLink = props.href != null; |
| 773 | let {size} = useContext(InternalPickerContext); |
| 774 | // oxlint-disable react/react-compiler |
| 775 | return ( |
| 776 | <ListBoxItem |
| 777 | {...props} |
| 778 | ref={ref} |
| 779 | textValue={ |
| 780 | props.textValue || |
| 781 | (typeof props.children === 'string' ? (props.children as string) : undefined) |
| 782 | } |
| 783 | style={pressScale(ref, props.UNSAFE_style)} |
| 784 | className={renderProps => |
| 785 | (props.UNSAFE_className || '') + listboxItem({...renderProps, size, isLink}, props.styles) |
| 786 | }> |
| 787 | {renderProps => { |
| 788 | let {children} = props; |
| 789 | let checkboxRenderProps = { |
| 790 | ...renderProps, |
| 791 | size, |
| 792 | isFocused: false, |
| 793 | isFocusVisible: false, |
| 794 | isIndeterminate: false, |
| 795 | isReadOnly: false, |
| 796 | isInvalid: false, |
| 797 | isRequired: false |
| 798 | }; |
| 799 | return ( |
| 800 | <DefaultProvider |
| 801 | context={IconContext} |
| 802 | value={{ |
| 803 | slots: { |
| 804 | icon: { |
| 805 | render: centerBaseline({slot: 'icon', styles: iconCenterWrapper}), |
| 806 | styles: icon |
| 807 | } |
| 808 | } |
| 809 | }}> |
| 810 | <DefaultProvider |
| 811 | context={AvatarContext} |
| 812 | value={{ |
| 813 | slots: { |
| 814 | avatar: {size: avatarSize[size], styles: avatar} |
| 815 | } |
| 816 | }}> |
| 817 | <DefaultProvider |
| 818 | context={TextContext} |
| 819 | value={{ |
| 820 | slots: { |
| 821 | [DEFAULT_SLOT]: {styles: label({size})}, |
| 822 | label: {styles: label({size})}, |
| 823 | description: {styles: description({...renderProps, size})} |
| 824 | } |
| 825 | }}> |
| 826 | {renderProps.selectionMode === 'single' && !isLink && ( |
| 827 | <CheckmarkIcon |
nothing calls this directly
no test coverage detected