UNPKG

repoweaver

Version:

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

1 lines 18.8 kB
{"ast":null,"code":"import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nconst _excluded = [\"left\", \"right\", \"title\", \"description\", \"onPress\", \"theme\", \"style\", \"containerStyle\", \"contentStyle\", \"titleStyle\", \"titleNumberOfLines\", \"descriptionNumberOfLines\", \"titleEllipsizeMode\", \"descriptionEllipsizeMode\", \"descriptionStyle\", \"descriptionMaxFontSizeMultiplier\", \"titleMaxFontSizeMultiplier\", \"testID\"];\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 View from \"react-native-web/dist/exports/View\";\nimport color from 'color';\nimport { getLeftStyles, getRightStyles } from \"./utils\";\nimport { useInternalTheme } from \"../../core/theming\";\nimport { forwardRef } from \"../../utils/forwardRef\";\nimport TouchableRipple from \"../TouchableRipple/TouchableRipple\";\nimport Text from \"../Typography/Text\";\nconst ListItem = (_ref, ref) => {\n let {\n left,\n right,\n title,\n description,\n onPress,\n theme: themeOverrides,\n style,\n containerStyle,\n contentStyle,\n titleStyle,\n titleNumberOfLines = 1,\n descriptionNumberOfLines = 2,\n titleEllipsizeMode,\n descriptionEllipsizeMode,\n descriptionStyle,\n descriptionMaxFontSizeMultiplier,\n titleMaxFontSizeMultiplier,\n testID\n } = _ref,\n rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n const theme = useInternalTheme(themeOverrides);\n const [alignToTop, setAlignToTop] = React.useState(false);\n const onDescriptionTextLayout = event => {\n if (!theme.isV3) {\n return;\n }\n const {\n nativeEvent\n } = event;\n setAlignToTop(nativeEvent.lines.length >= 2);\n };\n const renderDescription = (descriptionColor, description) => {\n return typeof description === 'function' ? description({\n selectable: false,\n ellipsizeMode: descriptionEllipsizeMode,\n color: descriptionColor,\n fontSize: styles.description.fontSize\n }) : React.createElement(Text, {\n selectable: false,\n numberOfLines: descriptionNumberOfLines,\n ellipsizeMode: descriptionEllipsizeMode,\n style: [styles.description, {\n color: descriptionColor\n }, descriptionStyle],\n onTextLayout: onDescriptionTextLayout,\n maxFontSizeMultiplier: descriptionMaxFontSizeMultiplier\n }, description);\n };\n const renderTitle = () => {\n const titleColor = theme.isV3 ? theme.colors.onSurface : color(theme.colors.text).alpha(0.87).rgb().string();\n return typeof title === 'function' ? title({\n selectable: false,\n ellipsizeMode: titleEllipsizeMode,\n color: titleColor,\n fontSize: styles.title.fontSize\n }) : React.createElement(Text, {\n selectable: false,\n ellipsizeMode: titleEllipsizeMode,\n numberOfLines: titleNumberOfLines,\n style: [styles.title, {\n color: titleColor\n }, titleStyle],\n maxFontSizeMultiplier: titleMaxFontSizeMultiplier\n }, title);\n };\n const descriptionColor = theme.isV3 ? theme.colors.onSurfaceVariant : color(theme.colors.text).alpha(0.54).rgb().string();\n return React.createElement(TouchableRipple, _extends({}, rest, {\n ref: ref,\n style: [theme.isV3 ? styles.containerV3 : styles.container, style],\n onPress: onPress,\n theme: theme,\n testID: testID\n }), React.createElement(View, {\n style: [theme.isV3 ? styles.rowV3 : styles.row, containerStyle]\n }, left ? left({\n color: descriptionColor,\n style: getLeftStyles(alignToTop, description, theme.isV3)\n }) : null, React.createElement(View, {\n style: [theme.isV3 ? styles.itemV3 : styles.item, styles.content, contentStyle],\n testID: `${testID}-content`\n }, renderTitle(), description ? renderDescription(descriptionColor, description) : null), right ? right({\n color: descriptionColor,\n style: getRightStyles(alignToTop, description, theme.isV3)\n }) : null));\n};\nListItem.displayName = 'List.Item';\nconst Component = forwardRef(ListItem);\nconst styles = StyleSheet.create({\n container: {\n padding: 8\n },\n containerV3: {\n paddingVertical: 8,\n paddingRight: 24\n },\n row: {\n width: '100%',\n flexDirection: 'row'\n },\n rowV3: {\n width: '100%',\n flexDirection: 'row',\n marginVertical: 6\n },\n title: {\n fontSize: 16\n },\n description: {\n fontSize: 14\n },\n item: {\n marginVertical: 6,\n paddingLeft: 8\n },\n itemV3: {\n paddingLeft: 16\n },\n content: {\n flexShrink: 1,\n flexGrow: 1,\n justifyContent: 'center'\n }\n});\nexport default Component;","map":{"version":3,"names":["React","StyleSheet","View","color","getLeftStyles","getRightStyles","useInternalTheme","forwardRef","TouchableRipple","Text","ListItem","_ref","ref","left","right","title","description","onPress","theme","themeOverrides","style","containerStyle","contentStyle","titleStyle","titleNumberOfLines","descriptionNumberOfLines","titleEllipsizeMode","descriptionEllipsizeMode","descriptionStyle","descriptionMaxFontSizeMultiplier","titleMaxFontSizeMultiplier","testID","rest","_objectWithoutPropertiesLoose","_excluded","alignToTop","setAlignToTop","useState","onDescriptionTextLayout","event","isV3","nativeEvent","lines","length","renderDescription","descriptionColor","selectable","ellipsizeMode","fontSize","styles","createElement","numberOfLines","onTextLayout","maxFontSizeMultiplier","renderTitle","titleColor","colors","onSurface","text","alpha","rgb","string","onSurfaceVariant","_extends","containerV3","container","rowV3","row","itemV3","item","content","displayName","Component","create","padding","paddingVertical","paddingRight","width","flexDirection","marginVertical","paddingLeft","flexShrink","flexGrow","justifyContent"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/react-native-paper/src/components/List/ListItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n GestureResponderEvent,\n NativeSyntheticEvent,\n StyleProp,\n StyleSheet,\n TextLayoutEventData,\n TextStyle,\n View,\n ViewStyle,\n} from 'react-native';\n\nimport color from 'color';\n\nimport { Style, getLeftStyles, getRightStyles } from './utils';\nimport { useInternalTheme } from '../../core/theming';\nimport type { $RemoveChildren, EllipsizeProp, ThemeProp } from '../../types';\nimport { forwardRef } from '../../utils/forwardRef';\nimport TouchableRipple from '../TouchableRipple/TouchableRipple';\nimport Text from '../Typography/Text';\n\ntype Title =\n | React.ReactNode\n | ((props: {\n selectable: boolean;\n ellipsizeMode: EllipsizeProp | undefined;\n color: string;\n fontSize: number;\n }) => React.ReactNode);\n\ntype Description =\n | React.ReactNode\n | ((props: {\n selectable: boolean;\n ellipsizeMode: EllipsizeProp | undefined;\n color: string;\n fontSize: number;\n }) => React.ReactNode);\n\nexport type Props = $RemoveChildren<typeof TouchableRipple> & {\n /**\n * Title text for the list item.\n */\n title: Title;\n /**\n * Description text for the list item or callback which returns a React element to display the description.\n */\n description?: Description;\n /**\n * Callback which returns a React element to display on the left side.\n */\n left?: (props: { color: string; style: Style }) => React.ReactNode;\n /**\n * Callback which returns a React element to display on the right side.\n */\n right?: (props: { color: string; style?: Style }) => React.ReactNode;\n /**\n * Function to execute on press.\n */\n onPress?: (e: GestureResponderEvent) => void;\n /**\n * @optional\n */\n theme?: ThemeProp;\n /**\n * Style that is passed to the root TouchableRipple container.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Style that is passed to the outermost container that wraps the entire content, including left and right items and both title and description.\n */\n containerStyle?: StyleProp<ViewStyle>;\n /**\n * Style that is passed to the content container, which wraps the title and description.\n */\n contentStyle?: StyleProp<ViewStyle>;\n /**\n * Style that is passed to Title element.\n */\n titleStyle?: StyleProp<TextStyle>;\n /**\n * Style that is passed to Description element.\n */\n descriptionStyle?: StyleProp<TextStyle>;\n /**\n * Truncate Title text such that the total number of lines does not\n * exceed this number.\n */\n titleNumberOfLines?: number;\n /**\n * Truncate Description text such that the total number of lines does not\n * exceed this number.\n */\n descriptionNumberOfLines?: number;\n /**\n * Ellipsize Mode for the Title. One of `'head'`, `'middle'`, `'tail'`, `'clip'`.\n *\n * See [`ellipsizeMode`](https://reactnative.dev/docs/text#ellipsizemode)\n */\n titleEllipsizeMode?: EllipsizeProp;\n /**\n * Ellipsize Mode for the Description. One of `'head'`, `'middle'`, `'tail'`, `'clip'`.\n *\n * See [`ellipsizeMode`](https://reactnative.dev/docs/text#ellipsizemode)\n */\n descriptionEllipsizeMode?: EllipsizeProp;\n /**\n * Specifies the largest possible scale a title font can reach.\n */\n titleMaxFontSizeMultiplier?: number;\n /**\n * Specifies the largest possible scale a description font can reach.\n */\n descriptionMaxFontSizeMultiplier?: number;\n /**\n * TestID used for testing purposes\n */\n testID?: string;\n};\n\n/**\n * A component to show tiles inside a List.\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { List } from 'react-native-paper';\n *\n * const MyComponent = () => (\n * <List.Item\n * title=\"First Item\"\n * description=\"Item description\"\n * left={props => <List.Icon {...props} icon=\"folder\" />}\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 ListItem = (\n {\n left,\n right,\n title,\n description,\n onPress,\n theme: themeOverrides,\n style,\n containerStyle,\n contentStyle,\n titleStyle,\n titleNumberOfLines = 1,\n descriptionNumberOfLines = 2,\n titleEllipsizeMode,\n descriptionEllipsizeMode,\n descriptionStyle,\n descriptionMaxFontSizeMultiplier,\n titleMaxFontSizeMultiplier,\n testID,\n ...rest\n }: Props,\n ref: React.ForwardedRef<View>\n) => {\n const theme = useInternalTheme(themeOverrides);\n const [alignToTop, setAlignToTop] = React.useState(false);\n\n const onDescriptionTextLayout = (\n event: NativeSyntheticEvent<TextLayoutEventData>\n ) => {\n if (!theme.isV3) {\n return;\n }\n const { nativeEvent } = event;\n setAlignToTop(nativeEvent.lines.length >= 2);\n };\n\n const renderDescription = (\n descriptionColor: string,\n description?: Description | null\n ) => {\n return typeof description === 'function' ? (\n description({\n selectable: false,\n ellipsizeMode: descriptionEllipsizeMode,\n color: descriptionColor,\n fontSize: styles.description.fontSize,\n })\n ) : (\n <Text\n selectable={false}\n numberOfLines={descriptionNumberOfLines}\n ellipsizeMode={descriptionEllipsizeMode}\n style={[\n styles.description,\n { color: descriptionColor },\n descriptionStyle,\n ]}\n onTextLayout={onDescriptionTextLayout}\n maxFontSizeMultiplier={descriptionMaxFontSizeMultiplier}\n >\n {description}\n </Text>\n );\n };\n\n const renderTitle = () => {\n const titleColor = theme.isV3\n ? theme.colors.onSurface\n : color(theme.colors.text).alpha(0.87).rgb().string();\n\n return typeof title === 'function' ? (\n title({\n selectable: false,\n ellipsizeMode: titleEllipsizeMode,\n color: titleColor,\n fontSize: styles.title.fontSize,\n })\n ) : (\n <Text\n selectable={false}\n ellipsizeMode={titleEllipsizeMode}\n numberOfLines={titleNumberOfLines}\n style={[styles.title, { color: titleColor }, titleStyle]}\n maxFontSizeMultiplier={titleMaxFontSizeMultiplier}\n >\n {title}\n </Text>\n );\n };\n\n const descriptionColor = theme.isV3\n ? theme.colors.onSurfaceVariant\n : color(theme.colors.text).alpha(0.54).rgb().string();\n\n return (\n <TouchableRipple\n {...rest}\n ref={ref}\n style={[theme.isV3 ? styles.containerV3 : styles.container, style]}\n onPress={onPress}\n theme={theme}\n testID={testID}\n >\n <View style={[theme.isV3 ? styles.rowV3 : styles.row, containerStyle]}>\n {left\n ? left({\n color: descriptionColor,\n style: getLeftStyles(alignToTop, description, theme.isV3),\n })\n : null}\n <View\n style={[\n theme.isV3 ? styles.itemV3 : styles.item,\n styles.content,\n contentStyle,\n ]}\n testID={`${testID}-content`}\n >\n {renderTitle()}\n\n {description\n ? renderDescription(descriptionColor, description)\n : null}\n </View>\n {right\n ? right({\n color: descriptionColor,\n style: getRightStyles(alignToTop, description, theme.isV3),\n })\n : null}\n </View>\n </TouchableRipple>\n );\n};\n\nListItem.displayName = 'List.Item';\nconst Component = forwardRef(ListItem);\n\nconst styles = StyleSheet.create({\n container: {\n padding: 8,\n },\n containerV3: {\n paddingVertical: 8,\n paddingRight: 24,\n },\n row: {\n width: '100%',\n flexDirection: 'row',\n },\n rowV3: {\n width: '100%',\n flexDirection: 'row',\n marginVertical: 6,\n },\n title: {\n fontSize: 16,\n },\n description: {\n fontSize: 14,\n },\n item: {\n marginVertical: 6,\n paddingLeft: 8,\n },\n itemV3: {\n paddingLeft: 16,\n },\n content: {\n flexShrink: 1,\n flexGrow: 1,\n justifyContent: 'center',\n },\n});\n\nexport default Component;\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAAA,OAAAC,UAAA;AAAA,OAAAC,IAAA;AAY9B,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAAgBC,aAAa,EAAEC,cAAc;AAC7C,SAASC,gBAAgB;AAEzB,SAASC,UAAU;AACnB,OAAOC,eAAe;AACtB,OAAOC,IAAI;AA0HX,MAAMC,QAAQ,GAAGA,CAAAC,IAAA,EAsBfC,GAA6B,KAC1B;EAAA,IAtBH;MACEC,IAAI;MACJC,KAAK;MACLC,KAAK;MACLC,WAAW;MACXC,OAAO;MACPC,KAAK,EAAEC,cAAc;MACrBC,KAAK;MACLC,cAAc;MACdC,YAAY;MACZC,UAAU;MACVC,kBAAkB,GAAG,CAAC;MACtBC,wBAAwB,GAAG,CAAC;MAC5BC,kBAAkB;MAClBC,wBAAwB;MACxBC,gBAAgB;MAChBC,gCAAgC;MAChCC,0BAA0B;MAC1BC;IAEK,CAAC,GAAApB,IAAA;IADHqB,IAAA,GAAAC,6BAAA,CAAAtB,IAAA,EAAAuB,SAAA;EAIL,MAAMhB,KAAK,GAAGZ,gBAAgB,CAACa,cAAc,CAAC;EAC9C,MAAM,CAACgB,UAAU,EAAEC,aAAa,CAAC,GAAGpC,KAAK,CAACqC,QAAQ,CAAC,KAAK,CAAC;EAEzD,MAAMC,uBAAuB,GAC3BC,KAAgD,IAC7C;IACH,IAAI,CAACrB,KAAK,CAACsB,IAAI,EAAE;MACf;IACF;IACA,MAAM;MAAEC;IAAY,CAAC,GAAGF,KAAK;IAC7BH,aAAa,CAACK,WAAW,CAACC,KAAK,CAACC,MAAM,IAAI,CAAC,CAAC;EAC9C,CAAC;EAED,MAAMC,iBAAiB,GAAGA,CACxBC,gBAAwB,EACxB7B,WAAgC,KAC7B;IACH,OAAO,OAAOA,WAAW,KAAK,UAAU,G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