{"version":3,"sources":["../src/TextArea/TextArea.tsx"],"sourcesContent":["import * as React from 'react';\nimport { clsx } from 'clsx';\n\nexport interface TextAreaProps {\n  /**\n   * The label for the textarea\n   */\n  label?: string;\n  /**\n   * Placeholder text\n   */\n  placeholder?: string;\n  /**\n   * Current value\n   */\n  value?: string;\n  /**\n   * Change handler\n   */\n  onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n  /**\n   * Validation state - affects border color\n   */\n  state?: 'default' | 'success' | 'error';\n  /**\n   * Error message (implies error state)\n   */\n  error?: string;\n  /**\n   * Helper text shown below input\n   */\n  helperText?: string;\n  /**\n   * Whether the textarea is disabled\n   */\n  disabled?: boolean;\n  /**\n   * Number of rows (affects height)\n   */\n  rows?: number;\n  /**\n   * Custom className\n   */\n  className?: string;\n  /**\n   * Custom style\n   */\n  style?: React.CSSProperties;\n  /**\n   * Test ID for testing\n   */\n  'data-testid'?: string;\n  /**\n   * Name attribute for form submission\n   */\n  name?: string;\n}\n\nconst labelStyles: React.CSSProperties = {\n  fontSize: '13px',\n  fontWeight: 600,\n  color: '#2f2f2f',\n  marginBottom: '0px',\n  display: 'block',\n  fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n};\n\nconst textareaWrapperStyles: React.CSSProperties = {\n  position: 'relative',\n  width: '100%',\n};\n\nconst textareaStyles: React.CSSProperties = {\n  width: '100%',\n  minHeight: '72px',\n  padding: '8px',\n  fontSize: '13px',\n  fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n  border: '1px solid',\n  borderRadius: '8px',\n  outline: 'none',\n  resize: 'vertical',\n  transition: 'all 0.2s ease-in-out',\n  lineHeight: '1.5',\n};\n\nconst helperTextStyles: React.CSSProperties = {\n  fontSize: '13px',\n  marginTop: '4px',\n  fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n};\n\n/**\n * TextArea component - Arbor Design System\n *\n * A multi-line text input with label, helper text, and validation states.\n */\nexport const TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>(\n  (\n    {\n      label,\n      placeholder,\n      value,\n      onChange,\n      state = 'default',\n      error,\n      helperText,\n      disabled = false,\n      rows = 3,\n      className,\n      style,\n      'data-testid': dataTestId,\n      name,\n    },\n    ref\n  ) => {\n    const [isFocused, setIsFocused] = React.useState(false);\n    const [isHovered, setIsHovered] = React.useState(false);\n    const textareaId = React.useId();\n\n    // Determine the actual state (error overrides state prop)\n    const actualState = error ? 'error' : state;\n\n    // Get border color based on state and interactions\n    const getBorderColor = (): string => {\n      if (disabled) {\n        return '#dfdfdf';\n      }\n\n      if (actualState === 'error') {\n        return '#c93232';\n      }\n\n      if (actualState === 'success') {\n        return '#0e8a0e';\n      }\n\n      if (isFocused) {\n        return '#0e8a0e';\n      }\n\n      if (isHovered) {\n        return '#7e7e7e';\n      }\n\n      return '#dfdfdf';\n    };\n\n    // Get background color\n    const getBackgroundColor = (): string => {\n      if (disabled) {\n        return '#efefef';\n      }\n      return '#ffffff';\n    };\n\n    // Get box shadow (focus ring)\n    const getBoxShadow = (): string | undefined => {\n      if (isFocused && !disabled) {\n        if (actualState === 'error') {\n          return '0px 0px 0px 3px rgba(201, 50, 50, 0.2)';\n        }\n        return '0px 0px 0px 3px #3cad51';\n      }\n      return undefined;\n    };\n\n    const textareaStylesCombined: React.CSSProperties = {\n      ...textareaStyles,\n      borderColor: getBorderColor(),\n      backgroundColor: getBackgroundColor(),\n      boxShadow: getBoxShadow(),\n      color: disabled ? '#7e7e7e' : '#2f2f2f',\n      cursor: disabled ? 'not-allowed' : 'text',\n    };\n\n    const helperColor = error ? '#c93232' : actualState === 'success' ? '#0e8a0e' : '#595959';\n\n    return (\n      <div\n        className={clsx('arbor-textarea-wrapper', className)}\n        style={style}\n        data-testid={dataTestId}\n      >\n        {label && (\n          <label htmlFor={textareaId} style={labelStyles}>\n            {label}\n          </label>\n        )}\n        {label && <div style={{ height: '8px' }} />}\n        <div style={textareaWrapperStyles}>\n          <textarea\n            ref={ref}\n            id={textareaId}\n            name={name}\n            placeholder={placeholder}\n            value={value}\n            onChange={onChange}\n            disabled={disabled}\n            rows={rows}\n            onFocus={() => setIsFocused(true)}\n            onBlur={() => setIsFocused(false)}\n            onMouseEnter={() => setIsHovered(true)}\n            onMouseLeave={() => setIsHovered(false)}\n            style={textareaStylesCombined}\n          />\n        </div>\n        {(error || helperText) && (\n          <div style={{ ...helperTextStyles, color: helperColor }} role={error ? 'alert' : undefined}>\n            {error || helperText}\n          </div>\n        )}\n      </div>\n    );\n  }\n);\n\nTextArea.displayName = 'TextArea';\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,YAAY;AAkLf,SAMI,KANJ;AAzHN,IAAM,cAAmC;AAAA,EACvC,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,cAAc;AAAA,EACd,SAAS;AAAA,EACT,YAAY;AACd;AAEA,IAAM,wBAA6C;AAAA,EACjD,UAAU;AAAA,EACV,OAAO;AACT;AAEA,IAAM,iBAAsC;AAAA,EAC1C,OAAO;AAAA,EACP,WAAW;AAAA,EACX,SAAS;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,YAAY;AACd;AAEA,IAAM,mBAAwC;AAAA,EAC5C,UAAU;AAAA,EACV,WAAW;AAAA,EACX,YAAY;AACd;AAOO,IAAM,WAAiB;AAAA,EAC5B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,EACF,GACA,QACG;AACH,UAAM,CAAC,WAAW,YAAY,IAAU,eAAS,KAAK;AACtD,UAAM,CA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