({
collection,
...props
}: StatelyComboBoxProps<object> & {
collection: ICollection<Node<object>>;
label?: ReactNode;
})
| 38 | } |
| 39 | |
| 40 | function ComboBoxInner({ |
| 41 | collection, |
| 42 | ...props |
| 43 | }: StatelyComboBoxProps<object> & { |
| 44 | collection: ICollection<Node<object>>; |
| 45 | label?: ReactNode; |
| 46 | }) { |
| 47 | let {contains} = useFilter({sensitivity: 'base'}); |
| 48 | let state = useComboBoxState({ |
| 49 | ...props, |
| 50 | defaultFilter: contains, |
| 51 | collection, |
| 52 | children: undefined |
| 53 | }); |
| 54 | let fieldRef = useRef<HTMLDivElement>(null); |
| 55 | let inputRef = useRef<HTMLInputElement>(null); |
| 56 | let buttonRef = useRef<HTMLButtonElement>(null); |
| 57 | let listBoxRef = useRef<HTMLDivElement>(null); |
| 58 | let popoverRef = useRef<HTMLDivElement>(null); |
| 59 | let {labelProps, inputProps, buttonProps, listBoxProps} = useComboBox( |
| 60 | {...props, inputRef, buttonRef, listBoxRef, popoverRef}, |
| 61 | state |
| 62 | ); |
| 63 | |
| 64 | return ( |
| 65 | <Provider |
| 66 | values={[ |
| 67 | [ComboBoxStateContext, state], |
| 68 | [LabelContext, labelProps], |
| 69 | [ButtonContext, {...buttonProps, ref: buttonRef, isPressed: state.isOpen}], |
| 70 | [InputContext, {...inputProps, ref: inputRef}], |
| 71 | [OverlayTriggerStateContext, state], |
| 72 | [ |
| 73 | PopoverContext, |
| 74 | { |
| 75 | ref: popoverRef, |
| 76 | triggerRef: fieldRef, |
| 77 | scrollRef: listBoxRef, |
| 78 | trigger: 'ComboBox', |
| 79 | placement: 'bottom start', |
| 80 | isNonModal: true |
| 81 | } |
| 82 | ], |
| 83 | [ListBoxContext, {...listBoxProps, ref: listBoxRef}], |
| 84 | [ListStateContext, state] |
| 85 | ]}> |
| 86 | <div className="react-aria-ComboBox"> |
| 87 | <Label>{props.label}</Label> |
| 88 | <div className="combobox-field" ref={fieldRef}> |
| 89 | <Input className="react-aria-Input inset" /> |
| 90 | <Button className="field-Button"> |
| 91 | <ChevronDown /> |
| 92 | </Button> |
| 93 | </div> |
| 94 | <Popover className="react-aria-Popover combobox-popover"> |
| 95 | <DropdownListBox /> |
| 96 | </Popover> |
| 97 | </div> |
nothing calls this directly
no test coverage detected