UNPKG

repoweaver

Version:

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

1 lines 14.9 kB
{"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 RadioButton from \"./RadioButton\";\nimport RadioButtonAndroid from \"./RadioButtonAndroid\";\nimport { RadioButtonContext } from \"./RadioButtonGroup\";\nimport RadioButtonIOS from \"./RadioButtonIOS\";\nimport { handlePress, isChecked } from \"./utils\";\nimport { useInternalTheme } from \"../../core/theming\";\nimport TouchableRipple from \"../TouchableRipple/TouchableRipple\";\nimport Text from \"../Typography/Text\";\nconst RadioButtonItem = ({\n value,\n label,\n style,\n labelStyle,\n onPress,\n onLongPress,\n disabled,\n color,\n uncheckedColor,\n rippleColor,\n status,\n theme: themeOverrides,\n background,\n accessibilityLabel = label,\n testID,\n mode,\n position = 'trailing',\n labelVariant = 'bodyLarge',\n labelMaxFontSizeMultiplier,\n hitSlop\n}) => {\n const theme = useInternalTheme(themeOverrides);\n const radioButtonProps = {\n value,\n disabled,\n status,\n color,\n theme,\n uncheckedColor\n };\n const isLeading = position === 'leading';\n let radioButton;\n if (mode === 'android') {\n radioButton = React.createElement(RadioButtonAndroid, radioButtonProps);\n } else if (mode === 'ios') {\n radioButton = React.createElement(RadioButtonIOS, radioButtonProps);\n } else {\n radioButton = React.createElement(RadioButton, radioButtonProps);\n }\n const textColor = theme.isV3 ? theme.colors.onSurface : theme.colors.text;\n const disabledTextColor = theme.isV3 ? theme.colors.onSurfaceDisabled : theme.colors.disabled;\n const textAlign = isLeading ? 'right' : 'left';\n const computedStyle = {\n color: disabled ? disabledTextColor : textColor,\n textAlign\n };\n return React.createElement(RadioButtonContext.Consumer, null, context => {\n const checked = isChecked({\n contextValue: context === null || context === void 0 ? void 0 : context.value,\n status,\n value\n }) === 'checked';\n return React.createElement(TouchableRipple, {\n onPress: event => handlePress({\n onPress: onPress,\n onValueChange: context === null || context === void 0 ? void 0 : context.onValueChange,\n value,\n event\n }),\n onLongPress: onLongPress,\n accessibilityLabel: accessibilityLabel,\n accessibilityRole: \"radio\",\n accessibilityState: {\n checked,\n disabled\n },\n testID: testID,\n disabled: disabled,\n background: background,\n theme: theme,\n rippleColor: rippleColor,\n hitSlop: hitSlop\n }, React.createElement(View, {\n style: [styles.container, style],\n pointerEvents: \"none\"\n }, isLeading && radioButton, React.createElement(Text, {\n variant: labelVariant,\n style: [styles.label, !theme.isV3 && styles.font, computedStyle, labelStyle],\n maxFontSizeMultiplier: labelMaxFontSizeMultiplier\n }, label), !isLeading && radioButton));\n });\n};\nRadioButtonItem.displayName = 'RadioButton.Item';\nexport default RadioButtonItem;\nexport { RadioButtonItem };\nconst styles = StyleSheet.create({\n container: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingVertical: 8,\n paddingHorizontal: 16\n },\n label: {\n flexShrink: 1,\n flexGrow: 1\n },\n font: {\n fontSize: 16\n }\n});","map":{"version":3,"names":["React","StyleSheet","View","RadioButton","RadioButtonAndroid","RadioButtonContext","RadioButtonIOS","handlePress","isChecked","useInternalTheme","TouchableRipple","Text","RadioButtonItem","value","label","style","labelStyle","onPress","onLongPress","disabled","color","uncheckedColor","rippleColor","status","theme","themeOverrides","background","accessibilityLabel","testID","mode","position","labelVariant","labelMaxFontSizeMultiplier","hitSlop","radioButtonProps","isLeading","radioButton","createElement","textColor","isV3","colors","onSurface","text","disabledTextColor","onSurfaceDisabled","textAlign","computedStyle","Consumer","context","checked","contextValue","event","onValueChange","accessibilityRole","accessibilityState","styles","container","pointerEvents","variant","font","maxFontSizeMultiplier","displayName","create","flexDirection","alignItems","justifyContent","paddingVertical","paddingHorizontal","flexShrink","flexGrow","fontSize"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/RadioButton/RadioButtonItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n ColorValue,\n GestureResponderEvent,\n PressableAndroidRippleConfig,\n StyleProp,\n StyleSheet,\n TextStyle,\n View,\n ViewStyle,\n} from 'react-native';\n\nimport RadioButton from './RadioButton';\nimport RadioButtonAndroid from './RadioButtonAndroid';\nimport { RadioButtonContext, RadioButtonContextType } from './RadioButtonGroup';\nimport RadioButtonIOS from './RadioButtonIOS';\nimport { handlePress, isChecked } from './utils';\nimport { useInternalTheme } from '../../core/theming';\nimport type { ThemeProp, MD3TypescaleKey } from '../../types';\nimport TouchableRipple, {\n Props as TouchableRippleProps,\n} from '../TouchableRipple/TouchableRipple';\nimport Text from '../Typography/Text';\n\nexport type Props = {\n /**\n * Value of the radio button.\n */\n value: string;\n /**\n * Label to be displayed on the item.\n */\n label: string;\n /**\n * Whether radio is disabled.\n */\n disabled?: 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 * Function to execute on long press.\n */\n onLongPress?: (e: GestureResponderEvent) => void;\n /**\n * Accessibility label for the touchable. This is read by the screen reader when the user taps the touchable.\n */\n accessibilityLabel?: string;\n /**\n * Custom color for unchecked radio.\n */\n uncheckedColor?: string;\n /**\n * Custom color for radio.\n */\n color?: string;\n /**\n * Color of the ripple effect.\n */\n rippleColor?: ColorValue;\n /**\n * Status of radio button.\n */\n status?: 'checked' | 'unchecked';\n /**\n * Additional styles for container View.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Style that is passed to Label element.\n */\n labelStyle?: StyleProp<TextStyle>;\n /**\n * @supported Available in v5.x with theme version 3\n *\n * Label text variant defines appropriate text styles for type role and its size.\n * Available variants:\n *\n * Display: `displayLarge`, `displayMedium`, `displaySmall`\n *\n * Headline: `headlineLarge`, `headlineMedium`, `headlineSmall`\n *\n * Title: `titleLarge`, `titleMedium`, `titleSmall`\n *\n * Label: `labelLarge`, `labelMedium`, `labelSmall`\n *\n * Body: `bodyLarge`, `bodyMedium`, `bodySmall`\n */\n labelVariant?: keyof typeof MD3TypescaleKey;\n /**\n * Specifies the largest possible scale a label font can reach.\n */\n labelMaxFontSizeMultiplier?: number;\n /**\n * @optional\n */\n theme?: ThemeProp;\n /**\n * testID to be used on tests.\n */\n testID?: string;\n /**\n * Whether `<RadioButton.Android />` or `<RadioButton.IOS />` should be used.\n * Left undefined `<RadioButton />` will be used.\n */\n mode?: 'android' | 'ios';\n /**\n * Radio button control position.\n */\n position?: 'leading' | 'trailing';\n /**\n * Sets additional distance outside of element in which a press can be detected.\n */\n hitSlop?: TouchableRippleProps['hitSlop'];\n};\n\n/**\n * RadioButton.Item allows you to press the whole row (item) instead of only the RadioButton.\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { RadioButton } from 'react-native-paper';\n *\n * const MyComponent = () => {\n * const [value, setValue] = React.useState('first');\n *\n * return (\n * <RadioButton.Group onValueChange={value => setValue(value)} value={value}>\n * <RadioButton.Item label=\"First item\" value=\"first\" />\n * <RadioButton.Item label=\"Second item\" value=\"second\" />\n * </RadioButton.Group>\n * );\n * };\n *\n * export default MyComponent;\n *```\n */\nconst RadioButtonItem = ({\n value,\n label,\n style,\n labelStyle,\n onPress,\n onLongPress,\n disabled,\n color,\n uncheckedColor,\n rippleColor,\n status,\n theme: themeOverrides,\n background,\n accessibilityLabel = label,\n testID,\n mode,\n position = 'trailing',\n labelVariant = 'bodyLarge',\n labelMaxFontSizeMultiplier,\n hitSlop,\n}: Props) => {\n const theme = useInternalTheme(themeOverrides);\n const radioButtonProps = {\n value,\n disabled,\n status,\n color,\n theme,\n uncheckedColor,\n };\n const isLeading = position === 'leading';\n let radioButton: any;\n\n if (mode === 'android') {\n radioButton = <RadioButtonAndroid {...radioButtonProps} />;\n } else if (mode === 'ios') {\n radioButton = <RadioButtonIOS {...radioButtonProps} />;\n } else {\n radioButton = <RadioButton {...radioButtonProps} />;\n }\n\n const textColor = theme.isV3 ? theme.colors.onSurface : theme.colors.text;\n const disabledTextColor = theme.isV3\n ? theme.colors.onSurfaceDisabled\n : theme.colors.disabled;\n const textAlign = isLeading ? 'right' : 'left';\n\n const computedStyle = {\n color: disabled ? disabledTextColor : textColor,\n textAlign,\n } as TextStyle;\n\n return (\n <RadioButtonContext.Consumer>\n {(context?: RadioButtonContextType) => {\n const checked =\n isChecked({\n contextValue: context?.value,\n status,\n value,\n }) === 'checked';\n return (\n <TouchableRipple\n onPress={(event) =>\n handlePress({\n onPress: onPress,\n onValueChange: context?.onValueChange,\n value,\n event,\n })\n }\n onLongPress={onLongPress}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"radio\"\n accessibilityState={{\n checked,\n disabled,\n }}\n testID={testID}\n disabled={disabled}\n background={background}\n theme={theme}\n rippleColor={rippleColor}\n hitSlop={hitSlop}\n >\n <View style={[styles.container, style]} pointerEvents=\"none\">\n {isLeading && radioButton}\n <Text\n variant={labelVariant}\n style={[\n styles.label,\n !theme.isV3 && styles.font,\n computedStyle,\n labelStyle,\n ]}\n maxFontSizeMultiplier={labelMaxFontSizeMultiplier}\n >\n {label}\n </Text>\n {!isLeading && radioButton}\n </View>\n </TouchableRipple>\n );\n }}\n </RadioButtonContext.Consumer>\n );\n};\n\nRadioButtonItem.displayName = 'RadioButton.Item';\n\nexport default RadioButtonItem;\n\n// @component-docs ignore-next-line\nexport { RadioButtonItem };\n\nconst styles = StyleSheet.create({\n container: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingVertical: 8,\n paddingHorizontal: 16,\n },\n label: {\n flexShrink: 1,\n flexGrow: 1,\n },\n font: {\n fontSize: 16,\n },\n});\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA,OAAAC,UAAA;AAAA,OAAAC,IAAA;AAY9B,OAAOC,WAAW;AAClB,OAAOC,kBAAkB;AACzB,SAASC,kBAAkB;AAC3B,OAAOC,cAAc;AACrB,SAASC,WAAW,EAAEC,SAAS;AAC/B,S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