{"ast":null,"code":"import React from 'react';\nimport Animated from \"react-native-web/dist/exports/Animated\";\nimport Pressable from \"react-native-web/dist/exports/Pressable\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport Text from \"react-native-web/dist/exports/Text\";\nimport { AdornmentSide } from \"./enums\";\nimport { getTextColor } from \"./utils\";\nimport { useInternalTheme } from \"../../../core/theming\";\nimport { getConstants } from \"../helpers\";\nconst AffixContext = React.createContext({\n  textStyle: {\n    fontFamily: '',\n    color: ''\n  },\n  topPosition: null,\n  side: AdornmentSide.Left\n});\nconst AffixAdornment = ({\n  affix,\n  side,\n  textStyle,\n  topPosition,\n  onLayout,\n  visible,\n  paddingHorizontal,\n  maxFontSizeMultiplier,\n  testID,\n  disabled\n}) => {\n  return React.createElement(AffixContext.Provider, {\n    value: {\n      side,\n      textStyle,\n      topPosition,\n      onLayout,\n      visible,\n      paddingHorizontal,\n      maxFontSizeMultiplier,\n      testID,\n      disabled\n    }\n  }, affix);\n};\nconst TextInputAffix = ({\n  text,\n  textStyle: labelStyle,\n  theme: themeOverrides,\n  onLayout: onTextLayout,\n  onPress,\n  accessibilityLabel = text\n}) => {\n  const theme = useInternalTheme(themeOverrides);\n  const {\n    AFFIX_OFFSET\n  } = getConstants(theme.isV3);\n  const {\n    textStyle,\n    onLayout,\n    topPosition,\n    side,\n    visible,\n    paddingHorizontal,\n    maxFontSizeMultiplier,\n    testID,\n    disabled\n  } = React.useContext(AffixContext);\n  const offset = typeof paddingHorizontal === 'number' ? paddingHorizontal : AFFIX_OFFSET;\n  const style = {\n    top: topPosition,\n    [side]: offset\n  };\n  const textColor = getTextColor({\n    theme,\n    disabled\n  });\n  const content = React.createElement(Text, {\n    maxFontSizeMultiplier: maxFontSizeMultiplier,\n    style: [{\n      color: textColor\n    }, textStyle, labelStyle],\n    onLayout: onTextLayout,\n    testID: `${testID}-text`\n  }, text);\n  return React.createElement(Animated.View, {\n    style: [styles.container, style, {\n      opacity: (visible === null || visible === void 0 ? void 0 : visible.interpolate({\n        inputRange: [0, 1],\n        outputRange: [1, 0]\n      })) || 1\n    }],\n    onLayout: onLayout,\n    testID: testID\n  }, onPress ? React.createElement(Pressable, {\n    onPress: onPress,\n    accessibilityRole: \"button\",\n    accessibilityLabel: accessibilityLabel\n  }, content) : content);\n};\nTextInputAffix.displayName = 'TextInput.Affix';\nconst styles = StyleSheet.create({\n  container: {\n    position: 'absolute',\n    justifyContent: 'center',\n    alignItems: 'center'\n  }\n});\nexport default TextInputAffix;\nexport { TextInputAffix, AffixAdornment };","map":{"version":3,"names":["React","Animated","Pressable","StyleSheet","Text","AdornmentSide","getTextColor","useInternalTheme","getConstants","AffixContext","createContext","textStyle","fontFamily","color","topPosition","side","Left","AffixAdornment","affix","onLayout","visible","paddingHorizontal","maxFontSizeMultiplier","testID","disabled","createElement","Provider","value","TextInputAffix","text","labelStyle","theme","themeOverrides","onTextLayout","onPress","accessibilityLabel","AFFIX_OFFSET","isV3","useContext","offset","style","top","textColor","content","View","styles","container","opacity","interpolate","inputRange","outputRange","accessibilityRole","displayName","create","position","justifyContent","alignItems"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/TextInput/Adornment/TextInputAffix.tsx"],"sourcesContent":["import React from 'react';\nimport {\n  Animated,\n  DimensionValue,\n  GestureResponderEvent,\n  LayoutChangeEvent,\n  Pressable,\n  StyleProp,\n  StyleSheet,\n  Text,\n  TextStyle,\n  ViewStyle,\n} from 'react-native';\n\nimport { AdornmentSide } from './enums';\nimport { getTextColor } from './utils';\nimport { useInternalTheme } from '../../../core/theming';\nimport type { ThemeProp } from '../../../types';\nimport { getConstants } from '../helpers';\n\nexport type Props = {\n  /**\n   * Text to show.\n   */\n  text: string;\n  onLayout?: (event: LayoutChangeEvent) => void;\n  /**\n   * Function to execute on press.\n   */\n  onPress?: (e: GestureResponderEvent) => void;\n  /**\n   * Accessibility label for the affix. This is read by the screen reader when the user taps the affix.\n   */\n  accessibilityLabel?: string;\n  /**\n   * Style that is passed to the Text element.\n   */\n  textStyle?: StyleProp<TextStyle>;\n  /**\n   * @optional\n   */\n  theme?: ThemeProp;\n};\n\ntype ContextState = {\n  topPosition: number | null;\n  onLayout?: (event: LayoutChangeEvent) => void;\n  visible?: Animated.Value;\n  textStyle?: StyleProp<TextStyle>;\n  side: AdornmentSide;\n  paddingHorizontal?: DimensionValue;\n  maxFontSizeMultiplier?: number | undefined | null;\n  testID?: string;\n  disabled?: boolean;\n};\n\nconst AffixContext = React.createContext<ContextState>({\n  textStyle: { fontFamily: '', color: '' },\n  topPosition: null,\n  side: AdornmentSide.Left,\n});\n\nconst AffixAdornment: React.FunctionComponent<\n  {\n    affix: React.ReactNode;\n    testID: string;\n  } & ContextState\n> = ({\n  affix,\n  side,\n  textStyle,\n  topPosition,\n  onLayout,\n  visible,\n  paddingHorizontal,\n  maxFontSizeMultiplier,\n  testID,\n  disabled,\n}) => {\n  return (\n    <AffixContext.Provider\n      value={{\n        side,\n        textStyle,\n        topPosition,\n        onLayout,\n        visible,\n        paddingHorizontal,\n        maxFontSizeMultiplier,\n        testID,\n        disabled,\n      }}\n    >\n      {affix}\n    </AffixContext.Provider>\n  );\n};\n\n/**\n * A component to render a leading / trailing text in the TextInput\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { TextInput } from 'react-native-paper';\n *\n * const MyComponent = () => {\n *   const [text, setText] = React.useState('');\n *\n *   return (\n *     <TextInput\n *       mode=\"outlined\"\n *       label=\"Outlined input\"\n *       placeholder=\"Type something\"\n *       right={<TextInput.Affix text=\"/100\" />}\n *     />\n *   );\n * };\n *\n * export default MyComponent;\n * ```\n */\n\nconst TextInputAffix = ({\n  text,\n  textStyle: labelStyle,\n  theme: themeOverrides,\n  onLayout: onTextLayout,\n  onPress,\n  accessibilityLabel = text,\n}: Props) => {\n  const theme = useInternalTheme(themeOverrides);\n  const { AFFIX_OFFSET } = getConstants(theme.isV3);\n\n  const {\n    textStyle,\n    onLayout,\n    topPosition,\n    side,\n    visible,\n    paddingHorizontal,\n    maxFontSizeMultiplier,\n    testID,\n    disabled,\n  } = React.useContext(AffixContext);\n\n  const offset =\n    typeof paddingHorizontal === 'number' ? paddingHorizontal : AFFIX_OFFSET;\n\n  const style = {\n    top: topPosition,\n    [side]: offset,\n  } as ViewStyle;\n\n  const textColor = getTextColor({ theme, disabled });\n\n  const content = (\n    <Text\n      maxFontSizeMultiplier={maxFontSizeMultiplier}\n      style={[{ color: textColor }, textStyle, labelStyle]}\n      onLayout={onTextLayout}\n      testID={`${testID}-text`}\n    >\n      {text}\n    </Text>\n  );\n\n  return (\n    <Animated.View\n      style={[\n        styles.container,\n        style,\n        {\n          opacity:\n            visible?.interpolate({\n              inputRange: [0, 1],\n              outputRange: [1, 0],\n            }) || 1,\n        },\n      ]}\n      onLayout={onLayout}\n      testID={testID}\n    >\n      {onPress ? (\n        <Pressable\n          onPress={onPress}\n          accessibilityRole=\"button\"\n          accessibilityLabel={accessibilityLabel}\n        >\n          {content}\n        </Pressable>\n      ) : (\n        content\n      )}\n    </Animated.View>\n  );\n};\n\nTextInputAffix.displayName = 'TextInput.Affix';\n\nconst styles = StyleSheet.create({\n  container: {\n    position: 'absolute',\n    justifyContent: 'center',\n    alignItems: 'center',\n  },\n});\n\nexport default TextInputAffix;\n\n// @component-docs ignore-next-line\nexport { TextInputAffix, AffixAdornment };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAAA,OAAAC,QAAA;AAAA,OAAAC,SAAA;AAAA,OAAAC,UAAA;AAAA,OAAAC,IAAA;AAczB,SAASC,aAAa;AACtB,SAASC,YAAY;AACrB,SAASC,gBAAgB;AAEzB,SAASC,YAAY;AAsCrB,MAAMC,YAAY,GAAGT,KAAK,CAACU,aAAa,CAAe;EACrDC,SAAS,EAAE;IAAEC,UAAU,EAAE,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAC;EACxCC,WAAW,EAAE,IAAI;EACjBC,IAAI,EAAEV,aAAa,CAACW;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