UNPKG

repoweaver

Version:

A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies

1 lines 16.1 kB
{"ast":null,"code":"import _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nvar _excluded = [\"icon\", \"iconColor\", \"containerColor\", \"rippleColor\", \"size\", \"accessibilityLabel\", \"disabled\", \"onPress\", \"selected\", \"animated\", \"mode\", \"style\", \"theme\", \"testID\", \"loading\", \"contentStyle\"];\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 StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport { getIconButtonColor } from \"./utils\";\nimport { useInternalTheme } from \"../../core/theming\";\nimport { forwardRef } from \"../../utils/forwardRef\";\nimport ActivityIndicator from \"../ActivityIndicator\";\nimport CrossFadeIcon from \"../CrossFadeIcon\";\nimport Icon from \"../Icon\";\nimport Surface from \"../Surface\";\nimport TouchableRipple from \"../TouchableRipple/TouchableRipple\";\nvar PADDING = 8;\nvar IconButton = forwardRef(function (_ref, ref) {\n var icon = _ref.icon,\n customIconColor = _ref.iconColor,\n customContainerColor = _ref.containerColor,\n customRippleColor = _ref.rippleColor,\n _ref$size = _ref.size,\n size = _ref$size === void 0 ? 24 : _ref$size,\n accessibilityLabel = _ref.accessibilityLabel,\n disabled = _ref.disabled,\n onPress = _ref.onPress,\n _ref$selected = _ref.selected,\n selected = _ref$selected === void 0 ? false : _ref$selected,\n _ref$animated = _ref.animated,\n animated = _ref$animated === void 0 ? false : _ref$animated,\n mode = _ref.mode,\n style = _ref.style,\n themeOverrides = _ref.theme,\n _ref$testID = _ref.testID,\n testID = _ref$testID === void 0 ? 'icon-button' : _ref$testID,\n _ref$loading = _ref.loading,\n loading = _ref$loading === void 0 ? false : _ref$loading,\n contentStyle = _ref.contentStyle,\n rest = _objectWithoutProperties(_ref, _excluded);\n var theme = useInternalTheme(themeOverrides);\n var isV3 = theme.isV3;\n var IconComponent = animated ? CrossFadeIcon : Icon;\n var _getIconButtonColor = getIconButtonColor({\n theme: theme,\n disabled: disabled,\n selected: selected,\n mode: mode,\n customIconColor: customIconColor,\n customContainerColor: customContainerColor,\n customRippleColor: customRippleColor\n }),\n iconColor = _getIconButtonColor.iconColor,\n rippleColor = _getIconButtonColor.rippleColor,\n backgroundColor = _getIconButtonColor.backgroundColor,\n borderColor = _getIconButtonColor.borderColor;\n var buttonSize = isV3 ? size + 2 * PADDING : size * 1.5;\n var _ref2 = StyleSheet.flatten(style) || {},\n _ref2$borderWidth = _ref2.borderWidth,\n borderWidth = _ref2$borderWidth === void 0 ? isV3 && mode === 'outlined' && !selected ? 1 : 0 : _ref2$borderWidth,\n _ref2$borderRadius = _ref2.borderRadius,\n borderRadius = _ref2$borderRadius === void 0 ? buttonSize / 2 : _ref2$borderRadius;\n var borderStyles = {\n borderWidth: borderWidth,\n borderRadius: borderRadius,\n borderColor: borderColor\n };\n return React.createElement(Surface, _extends({\n ref: ref,\n testID: `${testID}-container`,\n style: [{\n backgroundColor: backgroundColor,\n width: buttonSize,\n height: buttonSize\n }, styles.container, borderStyles, !isV3 && disabled && styles.disabled, style],\n container: true\n }, isV3 && {\n elevation: 0\n }), React.createElement(TouchableRipple, _extends({\n borderless: true,\n centered: true,\n onPress: onPress,\n rippleColor: rippleColor,\n accessibilityLabel: accessibilityLabel,\n style: [styles.touchable, contentStyle],\n accessibilityTraits: disabled ? ['button', 'disabled'] : 'button',\n accessibilityComponentType: \"button\",\n accessibilityRole: \"button\",\n accessibilityState: {\n disabled: disabled\n },\n disabled: disabled,\n hitSlop: TouchableRipple.supported ? {\n top: 10,\n left: 10,\n bottom: 10,\n right: 10\n } : {\n top: 6,\n left: 6,\n bottom: 6,\n right: 6\n },\n testID: testID\n }, rest), loading ? React.createElement(ActivityIndicator, {\n size: size,\n color: iconColor\n }) : React.createElement(IconComponent, {\n color: iconColor,\n source: icon,\n size: size\n })));\n});\nvar styles = StyleSheet.create({\n container: {\n overflow: 'hidden',\n margin: 6,\n elevation: 0\n },\n touchable: {\n flexGrow: 1,\n justifyContent: 'center',\n alignItems: 'center'\n },\n disabled: {\n opacity: 0.32\n }\n});\nexport default IconButton;","map":{"version":3,"names":["React","StyleSheet","getIconButtonColor","useInternalTheme","forwardRef","ActivityIndicator","CrossFadeIcon","Icon","Surface","TouchableRipple","PADDING","IconButton","_ref","ref","icon","customIconColor","iconColor","customContainerColor","containerColor","customRippleColor","rippleColor","_ref$size","size","accessibilityLabel","disabled","onPress","_ref$selected","selected","_ref$animated","animated","mode","style","themeOverrides","theme","_ref$testID","testID","_ref$loading","loading","contentStyle","rest","_objectWithoutProperties","_excluded","isV3","IconComponent","_getIconButtonColor","backgroundColor","borderColor","buttonSize","_ref2","flatten","_ref2$borderWidth","borderWidth","_ref2$borderRadius","borderRadius","borderStyles","createElement","_extends","width","height","styles","container","elevation","borderless","centered","touchable","accessibilityTraits","accessibilityComponentType","accessibilityRole","accessibilityState","hitSlop","supported","top","left","bottom","right","color","source","create","overflow","margin","flexGrow","justifyContent","alignItems","opacity"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n GestureResponderEvent,\n StyleProp,\n StyleSheet,\n ViewStyle,\n View,\n Animated,\n ColorValue,\n} from 'react-native';\n\nimport { getIconButtonColor } from './utils';\nimport { useInternalTheme } from '../../core/theming';\nimport type { $RemoveChildren, ThemeProp } from '../../types';\nimport { forwardRef } from '../../utils/forwardRef';\nimport ActivityIndicator from '../ActivityIndicator';\nimport CrossFadeIcon from '../CrossFadeIcon';\nimport Icon, { IconSource } from '../Icon';\nimport Surface from '../Surface';\nimport TouchableRipple from '../TouchableRipple/TouchableRipple';\n\nconst PADDING = 8;\n\ntype IconButtonMode = 'outlined' | 'contained' | 'contained-tonal';\n\nexport type Props = Omit<$RemoveChildren<typeof TouchableRipple>, 'style'> & {\n /**\n * Icon to display.\n */\n icon: IconSource;\n /**\n * @supported Available in v5.x with theme version 3\n * Mode of the icon button. By default there is no specified mode - only pressable icon will be rendered.\n */\n mode?: IconButtonMode;\n /**\n * @renamed Renamed from 'color' to 'iconColor' in v5.x\n * Color of the icon.\n */\n iconColor?: string;\n /**\n * Background color of the icon container.\n */\n containerColor?: string;\n /**\n * Color of the ripple effect.\n */\n rippleColor?: ColorValue;\n /**\n * @supported Available in v5.x with theme version 3\n * Whether icon button is selected. A selected button receives alternative combination of icon and container colors.\n */\n selected?: boolean;\n /**\n * Size of the icon.\n */\n size?: number;\n /**\n * Whether the button is disabled. A disabled button is greyed out and `onPress` is not called on touch.\n */\n disabled?: boolean;\n /**\n * Whether an icon change is animated.\n */\n animated?: boolean;\n /**\n * Accessibility label for the button. This is read by the screen reader when the user taps the button.\n */\n accessibilityLabel?: string;\n /**\n * Style of button's inner content.\n * Use this prop to apply custom height and width or to set a custom padding`.\n */\n contentStyle?: StyleProp<ViewStyle>;\n /**\n * Function to execute on press.\n */\n onPress?: (e: GestureResponderEvent) => void;\n style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;\n ref?: React.RefObject<View>;\n /**\n * TestID used for testing purposes\n */\n testID?: string;\n /**\n * @optional\n */\n theme?: ThemeProp;\n /**\n * Whether to show a loading indicator.\n */\n loading?: boolean;\n};\n\n/**\n * An icon button is a button which displays only an icon without a label.\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { IconButton, MD3Colors } from 'react-native-paper';\n *\n * const MyComponent = () => (\n * <IconButton\n * icon=\"camera\"\n * iconColor={MD3Colors.error50}\n * size={20}\n * onPress={() => console.log('Pressed')}\n * />\n * );\n *\n * export default MyComponent;\n * ```\n *\n * @extends TouchableRipple props https://callstack.github.io/react-native-paper/docs/components/TouchableRipple\n */\nconst IconButton = forwardRef<View, Props>(\n (\n {\n icon,\n iconColor: customIconColor,\n containerColor: customContainerColor,\n rippleColor: customRippleColor,\n size = 24,\n accessibilityLabel,\n disabled,\n onPress,\n selected = false,\n animated = false,\n mode,\n style,\n theme: themeOverrides,\n testID = 'icon-button',\n loading = false,\n contentStyle,\n ...rest\n }: Props,\n ref\n ) => {\n const theme = useInternalTheme(themeOverrides);\n const { isV3 } = theme;\n\n const IconComponent = animated ? CrossFadeIcon : Icon;\n\n const { iconColor, rippleColor, backgroundColor, borderColor } =\n getIconButtonColor({\n theme,\n disabled,\n selected,\n mode,\n customIconColor,\n customContainerColor,\n customRippleColor,\n });\n\n const buttonSize = isV3 ? size + 2 * PADDING : size * 1.5;\n\n const {\n borderWidth = isV3 && mode === 'outlined' && !selected ? 1 : 0,\n borderRadius = buttonSize / 2,\n } = (StyleSheet.flatten(style) || {}) as ViewStyle;\n\n const borderStyles = {\n borderWidth,\n borderRadius,\n borderColor,\n };\n\n return (\n <Surface\n ref={ref}\n testID={`${testID}-container`}\n style={[\n {\n backgroundColor,\n width: buttonSize,\n height: buttonSize,\n },\n styles.container,\n borderStyles,\n !isV3 && disabled && styles.disabled,\n style,\n ]}\n container\n {...(isV3 && { elevation: 0 })}\n >\n <TouchableRipple\n borderless\n centered\n onPress={onPress}\n rippleColor={rippleColor}\n accessibilityLabel={accessibilityLabel}\n style={[styles.touchable, contentStyle]}\n // @ts-expect-error We keep old a11y props for backwards compat with old RN versions\n accessibilityTraits={disabled ? ['button', 'disabled'] : 'button'}\n accessibilityComponentType=\"button\"\n accessibilityRole=\"button\"\n accessibilityState={{ disabled }}\n disabled={disabled}\n hitSlop={\n TouchableRipple.supported\n ? { top: 10, left: 10, bottom: 10, right: 10 }\n : { top: 6, left: 6, bottom: 6, right: 6 }\n }\n testID={testID}\n {...rest}\n >\n {loading ? (\n <ActivityIndicator size={size} color={iconColor} />\n ) : (\n <IconComponent color={iconColor} source={icon} size={size} />\n )}\n </TouchableRipple>\n </Surface>\n );\n }\n);\n\nconst styles = StyleSheet.create({\n container: {\n overflow: 'hidden',\n margin: 6,\n elevation: 0,\n },\n touchable: {\n flexGrow: 1,\n justifyContent: 'center',\n alignItems: 'center',\n },\n disabled: {\n opacity: 0.32,\n },\n});\n\nexport default IconButton;\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA,OAAAC,UAAA;AAW9B,SAASC,kBAAkB;AAC3B,SAASC,gBAAgB;AAEzB,SAASC,UAAU;AACnB,OAAOC,iBAAiB;AACxB,OAAOC,aAAa;AACpB,OAAOC,IAAI;AACX,OAAOC,OAAO;AACd,OAAOC,eAAe;AAEtB,IAAMC,OAAO,GAAG,CAAC;AA+FjB,IAAMC,UAAU,GAAGP,UAAU,CAC3B,UAAAQ,IAAA,EAoBEC,GAAG,EACA;EAAA,IAnBDC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACOC,eAAe,GAAAH,IAAA,CAA1BI,SAAS;IACOC,oBAAoB,GAAAL,IAAA,CAApCM,cAAc;IACDC,iBAAiB,GAAAP,IAAA,CAA9BQ,WAAW;IAAAC,SAAA,GAAAT,IAAA,CACXU,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,EAAE,GAAAA,SAAA;IACTE,kBAAkB,GAAAX,IAAA,CAAlBW,kBAAkB;IAClBC,QAAQ,GAAAZ,IAAA,CAARY,QAAQ;IACRC,OAAO,GAAAb,IAAA,CAAPa,OAAO;IAAAC,aAAA,GAAAd,IAAA,CACPe,QAAQ;IAARA,QAAQ,GAAAD,aAAA,cAAG,KAAK,GAAAA,aAAA;IAAAE,aAAA,GAAAhB,IAAA,CAChBiB,QAAQ;IAARA,QAAQ,GAAAD,aAAA,cAAG,KAAK,GAAAA,aAAA;IAChBE,IAAI,GAAAlB,IAAA,CAAJkB,IAAI;IACJC,KAAK,GAAAnB,IAAA,CAALmB,KAAK;IACEC,cAAc,GAAApB,IAAA,CAArBqB,KAAK;IAAAC,WAAA,GAAAtB,IAA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