(props: ColorChannelFieldProps)
| 146 | } |
| 147 | |
| 148 | function ColorChannelField(props: ColorChannelFieldProps) { |
| 149 | let {locale} = useLocale(); |
| 150 | let state = useColorChannelFieldState({ |
| 151 | ...props, |
| 152 | locale |
| 153 | }); |
| 154 | |
| 155 | let inputRef = useRef<HTMLInputElement>(null); |
| 156 | let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']); |
| 157 | let {labelProps, inputProps, descriptionProps, errorMessageProps, ...validation} = |
| 158 | useColorChannelField( |
| 159 | { |
| 160 | ...removeDataAttributes(props), |
| 161 | label, |
| 162 | validationBehavior: props.validationBehavior ?? 'native' |
| 163 | }, |
| 164 | state, |
| 165 | inputRef |
| 166 | ); |
| 167 | |
| 168 | return ( |
| 169 | <> |
| 170 | {useChildren( |
| 171 | props, |
| 172 | state, |
| 173 | props.forwardedRef, |
| 174 | inputProps, |
| 175 | inputRef, |
| 176 | labelProps, |
| 177 | labelRef, |
| 178 | descriptionProps, |
| 179 | errorMessageProps, |
| 180 | validation |
| 181 | )} |
| 182 | {props.name && ( |
| 183 | <input |
| 184 | type="hidden" |
| 185 | name={props.name} |
| 186 | form={props.form} |
| 187 | value={isNaN(state.numberValue) ? '' : state.numberValue} |
| 188 | /> |
| 189 | )} |
| 190 | </> |
| 191 | ); |
| 192 | } |
| 193 | |
| 194 | interface HexColorFieldProps extends ColorFieldProps { |
| 195 | forwardedRef: ForwardedRef<HTMLDivElement>; |
nothing calls this directly
no test coverage detected