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