(props: DateFieldProps)
| 28 | } |
| 29 | |
| 30 | export function DateField(props: DateFieldProps) { |
| 31 | let {locale} = useLocale(); |
| 32 | let state = useDateFieldState({...props, locale, createCalendar}); |
| 33 | let ref = useRef<HTMLDivElement>(null); |
| 34 | /*- begin highlight -*/ |
| 35 | let {labelProps, fieldProps} = useDateField(props, state, ref); |
| 36 | /*- end highlight -*/ |
| 37 | let [isFocusWithin, setFocusWithin] = useState(false); |
| 38 | let {focusWithinProps} = useFocusWithin({onFocusWithinChange: setFocusWithin}); |
| 39 | |
| 40 | return ( |
| 41 | <div className="react-aria-DateField"> |
| 42 | <label className="react-aria-Label" {...labelProps}> |
| 43 | {props.label} |
| 44 | </label> |
| 45 | <div |
| 46 | {...mergeProps(fieldProps, focusWithinProps)} |
| 47 | ref={ref} |
| 48 | className="react-aria-DateInput inset" |
| 49 | data-focus-within={isFocusWithin || undefined}> |
| 50 | {state.segments.map((segment, i) => ( |
| 51 | <DateSegment key={i} segment={segment} state={state} /> |
| 52 | ))} |
| 53 | </div> |
| 54 | </div> |
| 55 | ); |
| 56 | } |
| 57 | |
| 58 | export function DateSegment({segment, state}: DateSegmentProps) { |
| 59 | let ref = useRef<HTMLSpanElement>(null); |
nothing calls this directly
no test coverage detected