(props: PickerProps<T>, ref: FocusableRef<HTMLButtonElement>)
| 164 | }); |
| 165 | let InsideSelectValueContext = createContext(false); |
| 166 | function Picker<T>(props: PickerProps<T>, ref: FocusableRef<HTMLButtonElement>) { |
| 167 | [props, ref] = useSpectrumContextProps(props, ref, PickerContext); |
| 168 | let domRef = useFocusableRef(ref); |
| 169 | props = useFormProps(props); |
| 170 | let { |
| 171 | direction = 'bottom', |
| 172 | align = 'start', |
| 173 | shouldFlip = true, |
| 174 | children, |
| 175 | items, |
| 176 | density, |
| 177 | labelBehavior = 'show', |
| 178 | valueId, |
| 179 | ...pickerProps |
| 180 | } = props; |
| 181 | let isQuiet = true; |
| 182 | const menuOffset: number = 6; |
| 183 | const size = 'M'; |
| 184 | let ariaLabelledby = props['aria-labelledby'] ?? ''; |
| 185 | let {direction: dir} = useLocale(); |
| 186 | let RTLFlipOffset = dir === 'rtl' ? -1 : 1; |
| 187 | |
| 188 | return ( |
| 189 | <div> |
| 190 | <AriaSelect |
| 191 | {...pickerProps} |
| 192 | className="" |
| 193 | aria-labelledby={`${labelBehavior === 'hide' ? valueId : ''} ${ariaLabelledby}`}> |
| 194 | {({isOpen}) => ( |
| 195 | <> |
| 196 | <FieldLabel isQuiet={isQuiet} /> |
| 197 | <Button |
| 198 | ref={domRef} |
| 199 | style={renderProps => pressScale(domRef)(renderProps)} |
| 200 | // Prevent press scale from sticking while Picker is open. |
| 201 | // @ts-ignore |
| 202 | isPressed={false} |
| 203 | className={renderProps => |
| 204 | inputButton({ |
| 205 | ...renderProps, |
| 206 | size: 'M', |
| 207 | isOpen, |
| 208 | isQuiet, |
| 209 | density |
| 210 | }) |
| 211 | }> |
| 212 | <SelectValue className={valueStyles + ' ' + css('&> * {display: none;}')}> |
| 213 | {({defaultChildren}) => { |
| 214 | return ( |
| 215 | <Provider |
| 216 | values={[ |
| 217 | [ |
| 218 | IconContext, |
| 219 | { |
| 220 | slots: { |
| 221 | icon: { |
| 222 | render: centerBaseline({ |
| 223 | slot: 'icon', |
nothing calls this directly
no test coverage detected