(props: TimeFieldProps)
| 16 | } |
| 17 | |
| 18 | export function TimeField(props: TimeFieldProps) { |
| 19 | let {locale} = useLocale(); |
| 20 | let state = useTimeFieldState({...props, locale}); |
| 21 | let ref = useRef<HTMLDivElement>(null); |
| 22 | /*- begin highlight -*/ |
| 23 | let {labelProps, fieldProps} = useTimeField(props, state, ref); |
| 24 | /*- end highlight -*/ |
| 25 | let [isFocusWithin, setFocusWithin] = useState(false); |
| 26 | let {focusWithinProps} = useFocusWithin({onFocusWithinChange: setFocusWithin}); |
| 27 | |
| 28 | return ( |
| 29 | <div className="react-aria-TimeField"> |
| 30 | <label className="react-aria-Label" {...labelProps}> |
| 31 | {props.label} |
| 32 | </label> |
| 33 | <div |
| 34 | {...mergeProps(fieldProps, focusWithinProps)} |
| 35 | ref={ref} |
| 36 | className="react-aria-DateInput inset" |
| 37 | data-focus-within={isFocusWithin || undefined}> |
| 38 | {state.segments.map((segment, i) => ( |
| 39 | <DateSegment key={i} segment={segment} state={state} /> |
| 40 | ))} |
| 41 | </div> |
| 42 | </div> |
| 43 | ); |
| 44 | } |
| 45 | |
| 46 | function DateSegment({segment, state}: {segment: DateSegmentType; state: TimeFieldState}) { |
| 47 | let ref = useRef<HTMLSpanElement>(null); |
nothing calls this directly
no test coverage detected