({
collection,
...props
}: StatelySelectProps<object> & {
collection: ICollection<Node<object>>;
label?: ReactNode;
})
| 39 | } |
| 40 | |
| 41 | function SelectInner({ |
| 42 | collection, |
| 43 | ...props |
| 44 | }: StatelySelectProps<object> & { |
| 45 | collection: ICollection<Node<object>>; |
| 46 | label?: ReactNode; |
| 47 | }) { |
| 48 | let state = useSelectState({...props, collection, children: undefined}); |
| 49 | let buttonRef = useRef<HTMLButtonElement>(null); |
| 50 | let scrollRef = useRef<HTMLDivElement>(null); |
| 51 | let {labelProps, triggerProps, valueProps, menuProps, hiddenSelectProps} = useSelect( |
| 52 | props, |
| 53 | state, |
| 54 | buttonRef |
| 55 | ); |
| 56 | |
| 57 | return ( |
| 58 | <Provider |
| 59 | values={[ |
| 60 | [SelectContext, {placeholder: props.placeholder}], |
| 61 | [SelectStateContext, state], |
| 62 | [SelectValueContext, valueProps], |
| 63 | [LabelContext, {...labelProps, elementType: 'span'}], |
| 64 | [ButtonContext, {...triggerProps, ref: buttonRef, isPressed: state.isOpen}], |
| 65 | [OverlayTriggerStateContext, state], |
| 66 | [ |
| 67 | PopoverContext, |
| 68 | {trigger: 'Select', triggerRef: buttonRef, scrollRef, placement: 'bottom start'} |
| 69 | ], |
| 70 | [ListBoxContext, {...menuProps, ref: scrollRef}], |
| 71 | [ListStateContext, state] |
| 72 | ]}> |
| 73 | <div className="react-aria-Select"> |
| 74 | <Label>{props.label}</Label> |
| 75 | <Button className="react-aria-Button button-base" data-variant="primary"> |
| 76 | <SelectValue /> |
| 77 | <ChevronDown /> |
| 78 | </Button> |
| 79 | <HiddenSelect {...hiddenSelectProps} /> |
| 80 | <Popover className="react-aria-Popover select-popover"> |
| 81 | <DropdownListBox /> |
| 82 | </Popover> |
| 83 | </div> |
| 84 | </Provider> |
| 85 | ); |
| 86 | } |
nothing calls this directly
no test coverage detected