MCPcopy Index your code
hub / github.com/adobe/react-spectrum / useChildren

Function useChildren

packages/react-aria-components/src/ColorField.tsx:230–296  ·  view source on GitHub ↗
(
  props: ColorFieldProps,
  state: ColorFieldState,
  ref: ForwardedRef<HTMLDivElement>,
  inputProps: InputHTMLAttributes<HTMLElement>,
  inputRef: Ref<HTMLInputElement>,
  labelProps: LabelHTMLAttributes<HTMLLabelElement>,
  labelRef: Ref<HTMLLabelElement>,
  descriptionProps: HTMLAttributes<HTMLElement>,
  errorMessageProps: HTMLAttributes<HTMLElement>,
  validation: ValidationResult
)

Source from the content-addressed store, hash-verified

228}
229
230function useChildren(
231 props: ColorFieldProps,
232 state: ColorFieldState,
233 ref: ForwardedRef<HTMLDivElement>,
234 inputProps: InputHTMLAttributes<HTMLElement>,
235 inputRef: Ref<HTMLInputElement>,
236 labelProps: LabelHTMLAttributes<HTMLLabelElement>,
237 labelRef: Ref<HTMLLabelElement>,
238 descriptionProps: HTMLAttributes<HTMLElement>,
239 errorMessageProps: HTMLAttributes<HTMLElement>,
240 validation: ValidationResult
241) {
242 let renderProps = useRenderProps({
243 ...props,
244 values: {
245 state,
246 channel: props.channel || 'hex',
247 isDisabled: props.isDisabled || false,
248 isInvalid: validation.isInvalid || false,
249 isReadOnly: props.isReadOnly || false,
250 isRequired: props.isRequired || false
251 },
252 defaultClassName: 'react-aria-ColorField'
253 });
254
255 let DOMProps = filterDOMProps(props, {global: true});
256 delete DOMProps.id;
257
258 return (
259 <Provider
260 values={[
261 [ColorFieldStateContext, state],
262 [InputContext, {...inputProps, ref: inputRef}],
263 [LabelContext, {...labelProps, ref: labelRef}],
264 [
265 GroupContext,
266 {
267 role: 'presentation',
268 isInvalid: validation.isInvalid,
269 isDisabled: props.isDisabled || false
270 }
271 ],
272 [
273 TextContext,
274 {
275 slots: {
276 description: descriptionProps,
277 errorMessage: errorMessageProps
278 }
279 }
280 ],
281 [FieldErrorContext, validation]
282 ]}>
283 <dom.div
284 {...DOMProps}
285 {...renderProps}
286 ref={ref}
287 slot={props.slot || undefined}

Callers 3

createBranchComponentFunction · 0.85
ColorChannelFieldFunction · 0.85
HexColorFieldFunction · 0.85

Calls 2

useRenderPropsFunction · 0.90
filterDOMPropsFunction · 0.90

Tested by

no test coverage detected