{"ast":null,"code":"import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nconst _excluded = [\"style\", \"type\", \"visible\", \"theme\", \"onLayout\", \"padding\", \"disabled\"];\nfunction _extends() {\n  return _extends = Object.assign ? Object.assign.bind() : function (n) {\n    for (var e = 1; e < arguments.length; e++) {\n      var t = arguments[e];\n      for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n    }\n    return n;\n  }, _extends.apply(null, arguments);\n}\nimport * as React from 'react';\nimport Animated from \"react-native-web/dist/exports/Animated\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport { getTextColor } from \"./utils\";\nimport { useInternalTheme } from \"../../core/theming\";\nimport AnimatedText from \"../Typography/AnimatedText\";\nconst HelperText = _ref => {\n  let {\n      style,\n      type = 'info',\n      visible = true,\n      theme: themeOverrides,\n      onLayout,\n      padding = 'normal',\n      disabled\n    } = _ref,\n    rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n  const theme = useInternalTheme(themeOverrides);\n  const {\n    current: shown\n  } = React.useRef(new Animated.Value(visible ? 1 : 0));\n  let {\n    current: textHeight\n  } = React.useRef(0);\n  const {\n    scale\n  } = theme.animation;\n  const {\n    maxFontSizeMultiplier = 1.5\n  } = rest;\n  React.useEffect(() => {\n    if (visible) {\n      Animated.timing(shown, {\n        toValue: 1,\n        duration: 150 * scale,\n        useNativeDriver: true\n      }).start();\n    } else {\n      Animated.timing(shown, {\n        toValue: 0,\n        duration: 180 * scale,\n        useNativeDriver: true\n      }).start();\n    }\n  }, [visible, scale, shown]);\n  const handleTextLayout = e => {\n    onLayout === null || onLayout === void 0 || onLayout(e);\n    textHeight = e.nativeEvent.layout.height;\n  };\n  const textColor = getTextColor({\n    theme,\n    disabled,\n    type\n  });\n  return React.createElement(AnimatedText, _extends({\n    onLayout: handleTextLayout,\n    style: [styles.text, padding !== 'none' ? styles.padding : {}, {\n      color: textColor,\n      opacity: shown,\n      transform: visible && type === 'error' ? [{\n        translateY: shown.interpolate({\n          inputRange: [0, 1],\n          outputRange: [-textHeight / 2, 0]\n        })\n      }] : []\n    }, style],\n    maxFontSizeMultiplier: maxFontSizeMultiplier\n  }, rest), rest.children);\n};\nconst styles = StyleSheet.create({\n  text: {\n    fontSize: 12,\n    paddingVertical: 4\n  },\n  padding: {\n    paddingHorizontal: 12\n  }\n});\nexport default HelperText;","map":{"version":3,"names":["React","Animated","StyleSheet","getTextColor","useInternalTheme","AnimatedText","HelperText","_ref","style","type","visible","theme","themeOverrides","onLayout","padding","disabled","rest","_objectWithoutPropertiesLoose","_excluded","current","shown","useRef","Value","textHeight","scale","animation","maxFontSizeMultiplier","useEffect","timing","toValue","duration","useNativeDriver","start","handleTextLayout","e","nativeEvent","layout","height","textColor","createElement","_extends","styles","text","color","opacity","transform","translateY","interpolate","inputRange","outputRange","children","create","fontSize","paddingVertical","paddingHorizontal"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/HelperText/HelperText.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n  Animated,\n  LayoutChangeEvent,\n  StyleProp,\n  StyleSheet,\n  TextStyle,\n} from 'react-native';\n\nimport { getTextColor } from './utils';\nimport { useInternalTheme } from '../../core/theming';\nimport type { $Omit, ThemeProp } from '../../types';\nimport AnimatedText from '../Typography/AnimatedText';\n\nexport type Props = $Omit<\n  $Omit<React.ComponentPropsWithRef<typeof AnimatedText>, 'padding'>,\n  'type'\n> & {\n  /**\n   * Type of the helper text.\n   */\n  type: 'error' | 'info';\n  /**\n   * Text content of the HelperText.\n   */\n  children: React.ReactNode;\n  /**\n   * Whether to display the helper text.\n   */\n  visible?: boolean;\n  /**\n   * Whether to apply padding to the helper text.\n   */\n  padding?: 'none' | 'normal';\n  /**\n   * Whether the text input tied with helper text is disabled.\n   */\n  disabled?: boolean;\n  style?: StyleProp<TextStyle>;\n  /**\n   * @optional\n   */\n  theme?: ThemeProp;\n  /**\n   * TestID used for testing purposes\n   */\n  testID?: string;\n};\n\n/**\n * Helper text is used in conjuction with input elements to provide additional hints for the user.\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { View } from 'react-native';\n * import { HelperText, TextInput } from 'react-native-paper';\n *\n * const MyComponent = () => {\n *   const [text, setText] = React.useState('');\n *\n *    const onChangeText = text => setText(text);\n *\n *   const hasErrors = () => {\n *     return !text.includes('@');\n *   };\n *\n *  return (\n *     <View>\n *       <TextInput label=\"Email\" value={text} onChangeText={onChangeText} />\n *       <HelperText type=\"error\" visible={hasErrors()}>\n *         Email address is invalid!\n *       </HelperText>\n *     </View>\n *   );\n * };\n *\n * export default MyComponent;\n * ```\n */\nconst HelperText = ({\n  style,\n  type = 'info',\n  visible = true,\n  theme: themeOverrides,\n  onLayout,\n  padding = 'normal',\n  disabled,\n  ...rest\n}: Props) => {\n  const theme = useInternalTheme(themeOverrides);\n  const { current: shown } = React.useRef<Animated.Value>(\n    new Animated.Value(visible ? 1 : 0)\n  );\n\n  let { current: textHeight } = React.useRef<number>(0);\n\n  const { scale } = theme.animation;\n\n  const { maxFontSizeMultiplier = 1.5 } = rest;\n\n  React.useEffect(() => {\n    if (visible) {\n      // show text\n      Animated.timing(shown, {\n        toValue: 1,\n        duration: 150 * scale,\n        useNativeDriver: true,\n      }).start();\n    } else {\n      // hide text\n      Animated.timing(shown, {\n        toValue: 0,\n        duration: 180 * scale,\n        useNativeDriver: true,\n      }).start();\n    }\n  }, [visible, scale, shown]);\n\n  const handleTextLayout = (e: LayoutChangeEvent) => {\n    onLayout?.(e);\n    textHeight = e.nativeEvent.layout.height;\n  };\n\n  const textColor = getTextColor({ theme, disabled, type });\n\n  return (\n    <AnimatedText\n      onLayout={handleTextLayout}\n      style={[\n        styles.text,\n        padding !== 'none' ? styles.padding : {},\n        {\n          color: textColor,\n          opacity: shown,\n          transform:\n            visible && type === 'error'\n              ? [\n                  {\n                    translateY: shown.interpolate({\n                      inputRange: [0, 1],\n                      outputRange: [-textHeight / 2, 0],\n                    }),\n                  },\n                ]\n              : [],\n        },\n        style,\n      ]}\n      maxFontSizeMultiplier={maxFontSizeMultiplier}\n      {...rest}\n    >\n      {rest.children}\n    </AnimatedText>\n  );\n};\n\nconst styles = StyleSheet.create({\n  text: {\n    fontSize: 12,\n    paddingVertical: 4,\n  },\n  padding: {\n    paddingHorizontal: 12,\n  },\n});\n\nexport default HelperText;\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA,OAAAC,QAAA;AAAA,OAAAC,UAAA;AAS9B,SAASC,YAAY;AACrB,SAASC,gBAAgB;AAEzB,OAAOC,YAAY;AAoEnB,MAAMC,UAAU,GAAGC,IAAA,IASN;EAAA,IATO;MAClBC,KAAK;MACLC,IAAI,GAAG,MAAM;MACbC,OAAO,GAAG,IAAI;MACdC,KAAK,EAAEC,cAAc;MACrBC,QAAQ;MACRC,OAAO,GAAG,QAAQ;MAClBC;IAEK,CAAC,GAAAR,IAAA;IADHS,IAAA,GAAAC,6BAAA,CAAAV,IAAA,EAAAW,SAAA;EAEH,MAAMP,KAAK,GAAGP,gBAAgB,CAACQ,cAAc,CAAC;EAC9C,MAAM;IAAEO,OAAO,EAAEC;EAAM,CAAC,GAAGpB,KAAK,CAACqB,MAAM,CACrC,IAAIpB,QAAQ,CAACqB,KAAK,CAACZ,OAAO,GAAG,CAAC,GAAG,CAAC,CACpC,CAAC;EAED,IAAI;IAAES,OAAO,EAAEI;EAAW,CAAC,GAAGvB,KAAK,CAACqB,MAAM,CAAS,CAAC,CAAC;EAErD,MAAM;IAAEG;EAAM,CAAC,GAAGb,KAAK,CAACc,SAAS;EAEjC,MAAM;IAAEC,qBAAqB,GAAG;EAAI,CAAC,GAAGV,IAAI;EAE5ChB,KAAK,CAAC2B,SAAS,CAAC,MAAM;IACpB,IAAIjB,OAAO,EAAE;MAEXT,QAAQ,CAAC2B,MAAM,CAACR,KAAK,EAAE;QACrBS,OAAO,EAAE,CAAC;Q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