{"version":3,"file":"Input.mjs","sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport type { ChangeEventHandler } from 'react';\nimport React, { forwardRef } from 'react';\nimport type { Status } from '../../util/variant-types';\nimport styles from './Input.module.css';\n\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {\n  /**\n   * Aria-label to provide an accesible name for the text input if no visible label is provided.\n   */\n  'aria-label'?: string;\n  /**\n   * CSS class names that can be appended to the component.\n   */\n  className?: string;\n  /**\n   * Disables the input and prevents editing the contents\n   */\n  disabled?: boolean;\n  /**\n   * HTML id for the component\n   */\n  id?: string;\n  /**\n   * Gives a hint as to the type of data needed for text input\n   */\n  inputMode?:\n    | 'text'\n    | 'email'\n    | 'url'\n    | 'search'\n    | 'tel'\n    | 'none'\n    | 'numeric'\n    | 'decimal';\n  /**\n   * Maximum number the input can take.\n   */\n  max?: number | string;\n  /**\n   * Minimum number the input can take.\n   */\n  min?: number | string;\n  /**\n   * HTML name attribute for the input\n   */\n  name?: string;\n  /**\n   * Function that fires when field value has changed\n   */\n  onChange?: ChangeEventHandler<HTMLInputElement>;\n  /**\n   * Placeholder attribute for input. Note: placeholder should be used sparingly\n   */\n  placeholder?: string;\n  /**\n   * Toggles the form control's interactivity. When `readOnly` is set to `true`, the form control is not interactive\n   */\n  readOnly?: boolean;\n  /**\n   * Indicates that field is required for form to be successfully submitted\n   */\n  required?: boolean;\n  /**\n   * Title attribute on input\n   */\n  title?: string;\n  /**\n   * HTML type attribute, allowing switching between text, password, and other HTML5 input field types\n   */\n  type?: React.HTMLInputTypeAttribute;\n  /**\n   * The value of the input\n   */\n  value?: string | number;\n  /**\n   * The default value of the input\n   */\n  defaultValue?: string | number;\n  // Design API\n  /**\n   * Status for the field state\n   *\n   * **Default is `\"default\"`**.\n   */\n  status?: 'default' | Extract<Status, 'warning' | 'critical'>;\n};\n\n/**\n * Input component for one line of text.\n */\nexport const Input = forwardRef<HTMLInputElement, InputProps>(\n  ({ className, disabled, id, status, ...other }, ref) => {\n    const componentClassName = clsx(\n      styles['input'],\n      status === 'critical' && styles['error'],\n      status === 'warning' && styles['warning'],\n      className,\n    );\n\n    return (\n      <input\n        className={componentClassName}\n        disabled={disabled}\n        id={id}\n        ref={ref}\n        {...other}\n      />\n    );\n  },\n);\n\nInput.displayName = 'Input';\n"],"names":["React"],"mappings":";;;;AAwFA;;AAEG;MACU,KAAK,GAAG,UAAU,CAC7B,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AACrD,IAAA,MAAM,kBAAkB,GAAG,IAAI,CAC7B,MAAM,CAAC,OAAO,CAAC,EACf,MAAM,KAAK,UAAU,IAAI,MAAM,CAAC,OAAO,CAAC,EACxC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC,EACzC,SAAS,CACV;IAED,QACEA,wCACE,SAAS,EAAE,kBAAkB,EAC7B,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,EAAE,EACN,GAAG,EAAE,GAAG,EAAA,GACJ,KAAK,EAAA,CACT;AAEN,CAAC;AAGH,KAAK,CAAC,WAAW,GAAG,OAAO;;"}