{"version":3,"file":"FormControl.mjs","sources":["../../../../../../../../node_modules/@mui/material/FormControl/FormControl.js"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport composeClasses from '@mui/utils/composeClasses';\nimport { styled } from \"../zero-styled/index.js\";\nimport { useDefaultProps } from \"../DefaultPropsProvider/index.js\";\nimport { isFilled, isAdornedStart } from \"../InputBase/utils.js\";\nimport capitalize from \"../utils/capitalize.js\";\nimport isMuiElement from \"../utils/isMuiElement.js\";\nimport FormControlContext from \"./FormControlContext.js\";\nimport { getFormControlUtilityClasses } from \"./formControlClasses.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst useUtilityClasses = ownerState => {\n  const {\n    classes,\n    margin,\n    fullWidth\n  } = ownerState;\n  const slots = {\n    root: ['root', margin !== 'none' && `margin${capitalize(margin)}`, fullWidth && 'fullWidth']\n  };\n  return composeClasses(slots, getFormControlUtilityClasses, classes);\n};\nconst FormControlRoot = styled('div', {\n  name: 'MuiFormControl',\n  slot: 'Root',\n  overridesResolver: (props, styles) => {\n    const {\n      ownerState\n    } = props;\n    return [styles.root, styles[`margin${capitalize(ownerState.margin)}`], ownerState.fullWidth && styles.fullWidth];\n  }\n})({\n  display: 'inline-flex',\n  flexDirection: 'column',\n  position: 'relative',\n  // Reset fieldset default style.\n  minWidth: 0,\n  padding: 0,\n  margin: 0,\n  border: 0,\n  verticalAlign: 'top',\n  // Fix alignment issue on Safari.\n  variants: [{\n    props: {\n      margin: 'normal'\n    },\n    style: {\n      marginTop: 16,\n      marginBottom: 8\n    }\n  }, {\n    props: {\n      margin: 'dense'\n    },\n    style: {\n      marginTop: 8,\n      marginBottom: 4\n    }\n  }, {\n    props: {\n      fullWidth: true\n    },\n    style: {\n      width: '100%'\n    }\n  }]\n});\n\n/**\n * Provides context such as filled/focused/error/required for form inputs.\n * Relying on the context provides high flexibility and ensures that the state always stays\n * consistent across the children of the `FormControl`.\n * This context is used by the following components:\n *\n *  - FormLabel\n *  - FormHelperText\n *  - Input\n *  - InputLabel\n *\n * You can find one composition example below and more going to [the demos](/material-ui/react-text-field/#components).\n *\n * ```jsx\n * <FormControl>\n *   <InputLabel htmlFor=\"my-input\">Email address</InputLabel>\n *   <Input id=\"my-input\" aria-describedby=\"my-helper-text\" />\n *   <FormHelperText id=\"my-helper-text\">We'll never share your email.</FormHelperText>\n * </FormControl>\n * ```\n *\n * ⚠️ Only one `InputBase` can be used within a FormControl because it creates visual inconsistencies.\n * For instance, only one input can be focused at the same time, the state shouldn't be shared.\n */\nconst FormControl = /*#__PURE__*/React.forwardRef(function FormControl(inProps, ref) {\n  const props = useDefaultProps({\n    props: inProps,\n    name: 'MuiFormControl'\n  });\n  const {\n    children,\n    className,\n    color = 'primary',\n    component = 'div',\n    disabled = false,\n    error = false,\n    focused: visuallyFocused,\n    fullWidth = false,\n    hiddenLabel = false,\n    margin = 'none',\n    required = false,\n    size = 'medium',\n    variant = 'outlined',\n    ...other\n  } = props;\n  const ownerState = {\n    ...props,\n    color,\n    component,\n    disabled,\n    error,\n    fullWidth,\n    hiddenLabel,\n    margin,\n    required,\n    size,\n    variant\n  };\n  const classes = useUtilityClasses(ownerState);\n  const [adornedStart, setAdornedStart] = React.useState(() => {\n    // We need to iterate through the children and find the Input in order\n    // to fully support server-side rendering.\n    let initialAdornedStart = false;\n    if (children) {\n      React.Children.forEach(children, child => {\n        if (!isMuiElement(child, ['Input', 'Select'])) {\n          return;\n        }\n        const input = isMuiElement(child, ['Select']) ? child.props.input : child;\n        if (input && isAdornedStart(input.props)) {\n          initialAdornedStart = true;\n        }\n      });\n    }\n    return initialAdornedStart;\n  });\n  const [filled, setFilled] = React.useState(() => {\n    // We need to iterate through the children and find the Input in order\n    // to fully support server-side rendering.\n    let initialFilled = false;\n    if (children) {\n      React.Children.forEach(children, child => {\n        if (!isMuiElement(child, ['Input', 'Select'])) {\n          return;\n        }\n        if (isFilled(child.props, true) || isFilled(child.props.inputProps, true)) {\n          initialFilled = true;\n        }\n      });\n    }\n    return initialFilled;\n  });\n  const [focusedState, setFocused] = React.useState(false);\n  if (disabled && focusedState) {\n    setFocused(false);\n  }\n  const focused = visuallyFocused !== undefined && !disabled ? visuallyFocused : focusedState;\n  let registerEffect;\n  const registeredInput = React.useRef(false);\n  if (process.env.NODE_ENV !== 'production') {\n    registerEffect = () => {\n      if (registeredInput.current) {\n        console.error(['MUI: There are multiple `InputBase` components inside a FormControl.', 'This creates visual inconsistencies, only use one `InputBase`.'].join('\\n'));\n      }\n      registeredInput.current = true;\n      return () => {\n        registeredInput.current = false;\n      };\n    };\n  }\n  const childContext = React.useMemo(() => {\n    return {\n      adornedStart,\n      setAdornedStart,\n      color,\n      disabled,\n      error,\n      filled,\n      focused,\n      fullWidth,\n      hiddenLabel,\n      size,\n      onBlur: () => {\n        setFocused(false);\n      },\n      onEmpty: () => {\n        setFilled(false);\n      },\n      onFilled: () => {\n        setFilled(true);\n      },\n      onFocus: () => {\n        setFocused(true);\n      },\n      registerEffect,\n      required,\n      variant\n    };\n  }, [adornedStart, color, disabled, error, filled, focused, fullWidth, hiddenLabel, registerEffect, required, size, variant]);\n  return /*#__PURE__*/_jsx(FormControlContext.Provider, {\n    value: childContext,\n    children: /*#__PURE__*/_jsx(FormControlRoot, {\n      as: component,\n      ownerState: ownerState,\n      className: clsx(classes.root, className),\n      ref: ref,\n      ...other,\n      children: children\n    })\n  });\n});\nprocess.env.NODE_ENV !== \"production\" ? FormControl.propTypes /* remove-proptypes */ = {\n  // ┌────────────────────────────── Warning ──────────────────────────────┐\n  // │ These PropTypes are generated from the TypeScript type definitions. │\n  // │    To update them, edit the d.ts file and run `pnpm proptypes`.     │\n  // └─────────────────────────────────────────────────────────────────────┘\n  /**\n   * The content of the component.\n   */\n  children: PropTypes.node,\n  /**\n   * Override or extend the styles applied to the component.\n   */\n  classes: PropTypes.object,\n  /**\n   * @ignore\n   */\n  className: PropTypes.string,\n  /**\n   * The color of the component.\n   * It supports both default and custom theme colors, which can be added as shown in the\n   * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).\n   * @default 'primary'\n   */\n  color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['primary', 'secondary', 'error', 'info', 'success', 'warning']), PropTypes.string]),\n  /**\n   * The component used for the root node.\n   * Either a string to use a HTML element or a component.\n   */\n  component: PropTypes.elementType,\n  /**\n   * If `true`, the label, input and helper text should be displayed in a disabled state.\n   * @default false\n   */\n  disabled: PropTypes.bool,\n  /**\n   * If `true`, the label is displayed in an error state.\n   * @default false\n   */\n  error: PropTypes.bool,\n  /**\n   * If `true`, the component is displayed in focused state.\n   */\n  focused: PropTypes.bool,\n  /**\n   * If `true`, the component will take up the full width of its container.\n   * @default false\n   */\n  fullWidth: PropTypes.bool,\n  /**\n   * If `true`, the label is hidden.\n   * This is used to increase density for a `FilledInput`.\n   * Be sure to add `aria-label` to the `input` element.\n   * @default false\n   */\n  hiddenLabel: PropTypes.bool,\n  /**\n   * If `dense` or `normal`, will adjust vertical spacing of this and contained components.\n   * @default 'none'\n   */\n  margin: PropTypes.oneOf(['dense', 'none', 'normal']),\n  /**\n   * If `true`, the label will indicate that the `input` is required.\n   * @default false\n   */\n  required: PropTypes.bool,\n  /**\n   * The size of the component.\n   * @default 'medium'\n   */\n  size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),\n  /**\n   * The system prop that allows defining system overrides as well as additional CSS styles.\n   */\n  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),\n  /**\n   * The variant to use.\n   * @default 'outlined'\n   */\n  variant: PropTypes.oneOf(['filled', 'outlined', 'standard'])\n} : void 0;\nexport default FormControl;"],"names":["useUtilityClasses","React.forwardRef","React.useState","React.Children","React.useRef","React.useMemo","_jsx"],"mappings":";;;;;;;;;;;;;AAcA,MAAMA,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