{"ast":null,"code":"import * as React from 'react';\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport View from \"react-native-web/dist/exports/View\";\nimport { getContentMaxWidth, getMenuItemColor, MAX_WIDTH, MIN_WIDTH } from \"./utils\";\nimport { useInternalTheme } from \"../../core/theming\";\nimport Icon from \"../Icon\";\nimport TouchableRipple from \"../TouchableRipple/TouchableRipple\";\nimport Text from \"../Typography/Text\";\nconst MenuItem = ({\n  leadingIcon,\n  trailingIcon,\n  dense,\n  title,\n  disabled,\n  background,\n  onPress,\n  style,\n  containerStyle,\n  contentStyle,\n  titleStyle,\n  rippleColor: customRippleColor,\n  testID = 'menu-item',\n  accessibilityLabel,\n  accessibilityState,\n  theme: themeOverrides,\n  titleMaxFontSizeMultiplier = 1.5,\n  hitSlop\n}) => {\n  const theme = useInternalTheme(themeOverrides);\n  const {\n    titleColor,\n    iconColor,\n    rippleColor\n  } = getMenuItemColor({\n    theme,\n    disabled,\n    customRippleColor\n  });\n  const {\n    isV3\n  } = theme;\n  const containerPadding = isV3 ? 12 : 8;\n  const iconWidth = isV3 ? 24 : 40;\n  const minWidth = MIN_WIDTH - (isV3 ? 12 : 16);\n  const maxWidth = getContentMaxWidth({\n    isV3,\n    iconWidth,\n    leadingIcon,\n    trailingIcon\n  });\n  const titleTextStyle = Object.assign({\n    color: titleColor\n  }, isV3 ? theme.fonts.bodyLarge : {});\n  const newAccessibilityState = Object.assign({}, accessibilityState, {\n    disabled\n  });\n  return React.createElement(TouchableRipple, {\n    style: [styles.container, {\n      paddingHorizontal: containerPadding\n    }, dense && styles.md3DenseContainer, style],\n    onPress: onPress,\n    disabled: disabled,\n    testID: testID,\n    background: background,\n    accessibilityLabel: accessibilityLabel,\n    accessibilityRole: \"menuitem\",\n    accessibilityState: newAccessibilityState,\n    rippleColor: rippleColor,\n    hitSlop: hitSlop\n  }, React.createElement(View, {\n    style: [styles.row, containerStyle]\n  }, leadingIcon ? React.createElement(View, {\n    style: [!isV3 && styles.item, {\n      width: iconWidth\n    }],\n    pointerEvents: \"box-none\"\n  }, React.createElement(Icon, {\n    source: leadingIcon,\n    size: 24,\n    color: iconColor\n  })) : null, React.createElement(View, {\n    style: [!isV3 && styles.item, styles.content, {\n      minWidth,\n      maxWidth\n    }, isV3 && (leadingIcon ? styles.md3LeadingIcon : styles.md3WithoutLeadingIcon), contentStyle],\n    pointerEvents: \"none\"\n  }, React.createElement(Text, {\n    variant: \"bodyLarge\",\n    selectable: false,\n    numberOfLines: 1,\n    testID: `${testID}-title`,\n    style: [!isV3 && styles.title, titleTextStyle, titleStyle],\n    maxFontSizeMultiplier: titleMaxFontSizeMultiplier\n  }, title)), isV3 && trailingIcon ? React.createElement(View, {\n    style: [!isV3 && styles.item, {\n      width: iconWidth\n    }],\n    pointerEvents: \"box-none\"\n  }, React.createElement(Icon, {\n    source: trailingIcon,\n    size: 24,\n    color: iconColor\n  })) : null));\n};\nMenuItem.displayName = 'Menu.Item';\nconst styles = StyleSheet.create({\n  container: {\n    minWidth: MIN_WIDTH,\n    maxWidth: MAX_WIDTH,\n    height: 48,\n    justifyContent: 'center'\n  },\n  md3DenseContainer: {\n    height: 32\n  },\n  row: {\n    flexDirection: 'row'\n  },\n  title: {\n    fontSize: 16\n  },\n  item: {\n    marginHorizontal: 8\n  },\n  content: {\n    justifyContent: 'center'\n  },\n  md3LeadingIcon: {\n    marginLeft: 12\n  },\n  md3WithoutLeadingIcon: {\n    marginLeft: 4\n  }\n});\nexport default MenuItem;","map":{"version":3,"names":["React","StyleSheet","View","getContentMaxWidth","getMenuItemColor","MAX_WIDTH","MIN_WIDTH","useInternalTheme","Icon","TouchableRipple","Text","MenuItem","leadingIcon","trailingIcon","dense","title","disabled","background","onPress","style","containerStyle","contentStyle","titleStyle","rippleColor","customRippleColor","testID","accessibilityLabel","accessibilityState","theme","themeOverrides","titleMaxFontSizeMultiplier","hitSlop","titleColor","iconColor","isV3","containerPadding","iconWidth","minWidth","maxWidth","titleTextStyle","Object","assign","color","fonts","bodyLarge","newAccessibilityState","createElement","styles","container","paddingHorizontal","md3DenseContainer","accessibilityRole","row","item","width","pointerEvents","source","size","content","md3LeadingIcon","md3WithoutLeadingIcon","variant","selectable","numberOfLines","maxFontSizeMultiplier","displayName","create","height","justifyContent","flexDirection","fontSize","marginHorizontal","marginLeft"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/Menu/MenuItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n  AccessibilityState,\n  ColorValue,\n  GestureResponderEvent,\n  PressableAndroidRippleConfig,\n  StyleProp,\n  StyleSheet,\n  TextStyle,\n  View,\n  ViewStyle,\n} from 'react-native';\n\nimport {\n  getContentMaxWidth,\n  getMenuItemColor,\n  MAX_WIDTH,\n  MIN_WIDTH,\n} from './utils';\nimport { useInternalTheme } from '../../core/theming';\nimport type { ThemeProp } from '../../types';\nimport Icon, { IconSource } from '../Icon';\nimport TouchableRipple, {\n  Props as TouchableRippleProps,\n} from '../TouchableRipple/TouchableRipple';\nimport Text from '../Typography/Text';\n\nexport type Props = {\n  /**\n   * Title text for the `MenuItem`.\n   */\n  title: React.ReactNode;\n  /**\n   * @renamed Renamed from 'icon' to 'leadingIcon' in v5.x\n   *\n   * Leading icon to display for the `MenuItem`.\n   */\n  leadingIcon?: IconSource;\n  /**\n   * @supported Available in v5.x with theme version 3\n   *\n   * Trailing icon to display for the `MenuItem`.\n   */\n  trailingIcon?: IconSource;\n  /**\n   * Whether the 'item' is disabled. A disabled 'item' is greyed out and `onPress` is not called on touch.\n   */\n  disabled?: boolean;\n  /**\n   * @supported Available in v5.x with theme version 3\n   *\n   * Sets min height with densed layout.\n   */\n  dense?: boolean;\n  /**\n   * Type of background drawabale to display the feedback (Android).\n   * https://reactnative.dev/docs/pressable#rippleconfig\n   */\n  background?: PressableAndroidRippleConfig;\n  /**\n   * Function to execute on press.\n   */\n  onPress?: (e: GestureResponderEvent) => void;\n  /**\n   * Specifies the largest possible scale a title font can reach.\n   */\n  titleMaxFontSizeMultiplier?: number;\n  /**\n   * Style that is passed to the root TouchableRipple container.\n   * @optional\n   */\n  style?: StyleProp<ViewStyle>;\n  /**\n   * Style that is passed to the outermost container that wraps the entire content, including leading and trailing icons and title text.\n   */\n  containerStyle?: StyleProp<ViewStyle>;\n  /**\n   * Style that is passed to the content container, which wraps the title text.\n   */\n  contentStyle?: StyleProp<ViewStyle>;\n  /**\n   * Style that is passed to the Title element.\n   */\n  titleStyle?: StyleProp<TextStyle>;\n  /**\n   * Color of the ripple effect.\n   */\n  rippleColor?: ColorValue;\n  /**\n   * @optional\n   */\n  theme?: ThemeProp;\n  /**\n   * Sets additional distance outside of element in which a press can be detected.\n   */\n  hitSlop?: TouchableRippleProps['hitSlop'];\n  /**\n   * TestID used for testing purposes\n   */\n  testID?: string;\n  /**\n   * Accessibility label for the Touchable. This is read by the screen reader when the user taps the component.\n   */\n  accessibilityLabel?: string;\n  /**\n   * Accessibility state for the Touchable. This is read by the screen reader when the user taps the component.\n   */\n  accessibilityState?: AccessibilityState;\n};\n\n/**\n * A component to show a single list item inside a Menu.\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { View } from 'react-native';\n * import { Menu } from 'react-native-paper';\n *\n * const MyComponent = () => (\n *   <View style={{ flex: 1 }}>\n *     <Menu.Item leadingIcon=\"redo\" onPress={() => {}} title=\"Redo\" />\n *     <Menu.Item leadingIcon=\"undo\" onPress={() => {}} title=\"Undo\" />\n *     <Menu.Item leadingIcon=\"content-cut\" onPress={() => {}} title=\"Cut\" disabled />\n *     <Menu.Item leadingIcon=\"content-copy\" onPress={() => {}} title=\"Copy\" disabled />\n *     <Menu.Item leadingIcon=\"content-paste\" onPress={() => {}} title=\"Paste\" />\n *   </View>\n * );\n *\n * export default MyComponent;\n * ```\n */\nconst MenuItem = ({\n  leadingIcon,\n  trailingIcon,\n  dense,\n  title,\n  disabled,\n  background,\n  onPress,\n  style,\n  containerStyle,\n  contentStyle,\n  titleStyle,\n  rippleColor: customRippleColor,\n  testID = 'menu-item',\n  accessibilityLabel,\n  accessibilityState,\n  theme: themeOverrides,\n  titleMaxFontSizeMultiplier = 1.5,\n  hitSlop,\n}: Props) => {\n  const theme = useInternalTheme(themeOverrides);\n  const { titleColor, iconColor, rippleColor } = getMenuItemColor({\n    theme,\n    disabled,\n    customRippleColor,\n  });\n  const { isV3 } = theme;\n\n  const containerPadding = isV3 ? 12 : 8;\n\n  const iconWidth = isV3 ? 24 : 40;\n\n  const minWidth = MIN_WIDTH - (isV3 ? 12 : 16);\n\n  const maxWidth = getContentMaxWidth({\n    isV3,\n    iconWidth,\n    leadingIcon,\n    trailingIcon,\n  });\n\n  const titleTextStyle = {\n    color: titleColor,\n    ...(isV3 ? theme.fonts.bodyLarge : {}),\n  };\n\n  const newAccessibilityState = { ...accessibilityState, disabled };\n\n  return (\n    <TouchableRipple\n      style={[\n        styles.container,\n        { paddingHorizontal: containerPadding },\n        dense && styles.md3DenseContainer,\n        style,\n      ]}\n      onPress={onPress}\n      disabled={disabled}\n      testID={testID}\n      background={background}\n      accessibilityLabel={accessibilityLabel}\n      accessibilityRole=\"menuitem\"\n      accessibilityState={newAccessibilityState}\n      rippleColor={rippleColor}\n      hitSlop={hitSlop}\n    >\n      <View style={[styles.row, containerStyle]}>\n        {leadingIcon ? (\n          <View\n            style={[!isV3 && styles.item, { width: iconWidth }]}\n            pointerEvents=\"box-none\"\n          >\n            <Icon source={leadingIcon} size={24} color={iconColor} />\n          </View>\n        ) : null}\n        <View\n          style={[\n            !isV3 && styles.item,\n            styles.content,\n            { minWidth, maxWidth },\n            isV3 &&\n              (leadingIcon\n                ? styles.md3LeadingIcon\n                : styles.md3WithoutLeadingIcon),\n            contentStyle,\n          ]}\n          pointerEvents=\"none\"\n        >\n          <Text\n            variant=\"bodyLarge\"\n            selectable={false}\n            numberOfLines={1}\n            testID={`${testID}-title`}\n            style={[!isV3 && styles.title, titleTextStyle, titleStyle]}\n            maxFontSizeMultiplier={titleMaxFontSizeMultiplier}\n          >\n            {title}\n          </Text>\n        </View>\n        {isV3 && trailingIcon ? (\n          <View\n            style={[!isV3 && styles.item, { width: iconWidth }]}\n            pointerEvents=\"box-none\"\n          >\n            <Icon source={trailingIcon} size={24} color={iconColor} />\n          </View>\n        ) : null}\n      </View>\n    </TouchableRipple>\n  );\n};\n\nMenuItem.displayName = 'Menu.Item';\n\nconst styles = StyleSheet.create({\n  container: {\n    minWidth: MIN_WIDTH,\n    maxWidth: MAX_WIDTH,\n    height: 48,\n    justifyContent: 'center',\n  },\n  md3DenseContainer: {\n    height: 32,\n  },\n  row: {\n    flexDirection: 'row',\n  },\n  title: {\n    fontSize: 16,\n  },\n  item: {\n    marginHorizontal: 8,\n  },\n  content: {\n    justifyContent: 'center',\n  },\n  md3LeadingIcon: {\n    marginLeft: 12,\n  },\n  md3WithoutLeadingIcon: {\n    marginLeft: 4,\n  },\n});\n\nexport default MenuItem;\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA,OAAAC,UAAA;AAAA,OAAAC,IAAA;AAa9B,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,SAAS,EACTC,SAAS;AAEX,SAASC,gBAAgB;AAEzB,OAAOC,IAAI;AACX,OAAOC,eAAe;AAGtB,OAAOC,IAAI;AA2GX,MAAMC,QAAQ,GAAGA,CAAC;EAChBC,WAAW;EACXC,YAAY;EACZC,KAAK;EACLC,KAAK;EACLC,QAAQ;EACRC,UAAU;EACVC,OAAO;EACPC,KAAK;EACLC,cAAc;EACdC,YAAY;EACZC,UAAU;EACVC,WAAW,EAAEC,iBAAiB;EAC9BC,MAAM,GAAG,WAAW;EACpBC,kBAAkB;EAClBC,kBAAkB;EAClBC,KAAK,EAAEC,cAAc;EACrBC,0BAA0B,GAAG,GAAG;EAChCC;AACK,CAAC,KAAK;EACX,MAAMH,KAAK,GAAGrB,gBAAgB,CAACsB,cAAc,CAAC;EAC9C,MAAM;IAAEG,UAAU;IAAEC,SAAS;IA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