5641e3a980a6ce5e367addfe940fb80c.json
10 KB
{"ast":null,"code":"var _interopRequireWildcard=require(\"@babel/runtime/helpers/interopRequireWildcard\");var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");Object.defineProperty(exports,\"__esModule\",{value:true});exports.CardTitle=exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require(\"@babel/runtime/helpers/classCallCheck\"));var _createClass2=_interopRequireDefault(require(\"@babel/runtime/helpers/createClass\"));var _possibleConstructorReturn2=_interopRequireDefault(require(\"@babel/runtime/helpers/possibleConstructorReturn\"));var _getPrototypeOf2=_interopRequireDefault(require(\"@babel/runtime/helpers/getPrototypeOf\"));var _inherits2=_interopRequireDefault(require(\"@babel/runtime/helpers/inherits\"));var React=_interopRequireWildcard(require(\"react\"));var _StyleSheet=_interopRequireDefault(require(\"react-native-web/dist/exports/StyleSheet\"));var _View=_interopRequireDefault(require(\"react-native-web/dist/exports/View\"));var _theming=require(\"../../core/theming\");var _Caption=_interopRequireDefault(require(\"./../Typography/Caption\"));var _Title=_interopRequireDefault(require(\"./../Typography/Title\"));var _jsxFileName=\"/Users/satya/Workspace/Callstack/react-native-paper/src/components/Card/CardTitle.tsx\";var LEFT_SIZE=40;var CardTitle=function(_React$Component){(0,_inherits2.default)(CardTitle,_React$Component);function CardTitle(){(0,_classCallCheck2.default)(this,CardTitle);return(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(CardTitle).apply(this,arguments));}(0,_createClass2.default)(CardTitle,[{key:\"render\",value:function render(){var _this$props=this.props,left=_this$props.left,leftStyle=_this$props.leftStyle,right=_this$props.right,rightStyle=_this$props.rightStyle,subtitle=_this$props.subtitle,subtitleStyle=_this$props.subtitleStyle,style=_this$props.style,title=_this$props.title,titleStyle=_this$props.titleStyle;return React.createElement(_View.default,{style:[styles.container,{height:subtitle||left||right?72:50},style],__source:{fileName:_jsxFileName,lineNumber:106}},left?React.createElement(_View.default,{style:[styles.left,leftStyle],__source:{fileName:_jsxFileName,lineNumber:114}},left({size:LEFT_SIZE})):null,React.createElement(_View.default,{style:[styles.titles],__source:{fileName:_jsxFileName,lineNumber:121}},title?React.createElement(_Title.default,{style:[styles.title,{marginBottom:subtitle?0:2},titleStyle],numberOfLines:1,__source:{fileName:_jsxFileName,lineNumber:123}},title):null,subtitle?React.createElement(_Caption.default,{style:[styles.subtitle,subtitleStyle],numberOfLines:1,__source:{fileName:_jsxFileName,lineNumber:136}},subtitle):null),React.createElement(_View.default,{style:rightStyle,__source:{fileName:_jsxFileName,lineNumber:142}},right?right({size:24}):null));}}]);return CardTitle;}(React.Component);exports.CardTitle=CardTitle;CardTitle.displayName='Card.Title';var styles=_StyleSheet.default.create({container:{flexDirection:'row',alignItems:'center',justifyContent:'space-between',paddingLeft:16},left:{justifyContent:'center',marginRight:16,height:LEFT_SIZE,width:LEFT_SIZE},titles:{flex:1,flexDirection:'column',justifyContent:'center',height:50},title:{minHeight:30},subtitle:{minHeight:20,marginVertical:0}});var _default=(0,_theming.withTheme)(CardTitle);exports.default=_default;","map":{"version":3,"sources":["CardTitle.tsx"],"names":["LEFT_SIZE","CardTitle","React","Component","displayName","left","leftStyle","right","rightStyle","subtitle","subtitleStyle","style","title","titleStyle","styles","height","size","marginBottom","StyleSheet","container","flexDirection","alignItems","justifyContent","paddingLeft","marginRight","width","titles","flex","minHeight","marginVertical","withTheme"],"mappings":"ouBAAA,oD,4KASA,2CACA,wEACA,oE,yGAmDA,GAAMA,CAAAA,SAAS,CAAf,EAAA,CA0BMC,GAAAA,CAAAA,S,8UAGK,CAAA,GAAA,CAAA,WAAA,CAWH,KAXG,KAAA,CAELI,IAFK,CAAA,WAAA,CAAA,IAAA,CAGLC,SAHK,CAAA,WAAA,CAAA,SAAA,CAILC,KAJK,CAAA,WAAA,CAAA,KAAA,CAKLC,UALK,CAAA,WAAA,CAAA,UAAA,CAMLC,QANK,CAAA,WAAA,CAAA,QAAA,CAOLC,aAPK,CAAA,WAAA,CAAA,aAAA,CAQLC,K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kD,aAAa,CAA/D,CAAA,CAAA,QAAA,CAAA,CAAA,QAAA,CAAA,YAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,CADO,QACP,CADO,CA7Bb,IAeE,CAfF,CAoCE,KAAA,CAAA,aAAA,CAAA,aAAA,CAAA,CAAM,KAAK,CAAX,UAAA,CAAA,QAAA,CAAA,CAAA,QAAA,CAAA,YAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,CAA0BP,KAAK,CAAGA,KAAK,CAAC,CAAES,IAAI,CAAf,EAAS,CAAD,CAAR,CArCnC,IAqCI,CApCF,CADF,C,wBAhBoBd,KAAK,CAACC,S,CAAxBF,C,4BAAAA,S,CACGG,WADHH,CACiB,YADjBA,CA2DN,GAAMa,CAAAA,MAAM,CAAGI,oBAAAA,MAAAA,CAAkB,CAC/BC,SAAS,CAAE,CACTC,aAAa,CADJ,KAAA,CAETC,UAAU,CAFD,QAAA,CAGTC,cAAc,CAHL,eAAA,CAITC,WAAW,CALkB,EACpB,CADoB,CAQ/BlB,IAAI,CAAE,CACJiB,cAAc,CADV,QAAA,CAEJE,WAAW,CAFP,EAAA,CAGJT,MAAM,CAHF,SAAA,CAIJU,KAAK,CAZwB,SAQzB,CARyB,CAe/BC,MAAM,CAAE,CACNC,IAAI,CADE,CAAA,CAENP,aAAa,CAFP,QAAA,CAGNE,cAAc,CAHR,QAAA,CAINP,MAAM,CAnBuB,EAevB,CAfuB,CAsB/BH,KAAK,CAAE,CACLgB,SAAS,CAvBoB,EAsBxB,CAtBwB,CA0B/BnB,QAAQ,CAAE,CACRmB,SAAS,CADD,EAAA,CAERC,cAAc,CA5BlB,CA0BY,CA1BqB,CAAlBX,CAAf,C,aAgCeY,uBAAf,SAAeA,C","sourcesContent":["import * as React from 'react';\nimport {\n StyleProp,\n StyleSheet,\n TextStyle,\n View,\n ViewStyle,\n} from 'react-native';\n\nimport { withTheme } from '../../core/theming';\nimport Caption from './../Typography/Caption';\nimport Title from './../Typography/Title';\nimport { Theme } from '../../types';\n\ntype Props = React.ComponentProps<typeof View> & {\n /**\n * Text for the title. Note that this will only accept a string or `<Text>`-based node.\n */\n title: React.ReactNode;\n /**\n * Style for the title.\n */\n titleStyle?: StyleProp<TextStyle>;\n /**\n * Text for the subtitle. Note that this will only accept a string or `<Text>`-based node.\n */\n subtitle?: React.ReactNode;\n /**\n * Style for the subtitle.\n */\n subtitleStyle?: StyleProp<TextStyle>;\n /**\n * Callback which returns a React element to display on the left side.\n */\n left?: (props: { size: number }) => React.ReactNode;\n /**\n * Style for the left element wrapper.\n */\n leftStyle?: StyleProp<ViewStyle>;\n /**\n * Callback which returns a React element to display on the right side.\n */\n right?: (props: { size: number }) => React.ReactNode;\n /**\n * Style for the right element wrapper.\n */\n rightStyle?: StyleProp<ViewStyle>;\n /**\n * @internal\n */\n index?: number;\n /**\n * @internal\n */\n total?: number;\n style?: StyleProp<ViewStyle>;\n /**\n * @optional\n */\n theme: Theme;\n};\n\nconst LEFT_SIZE = 40;\n\n/**\n * A component to show a title, subtitle and an avatar inside a Card.\n *\n * <div class=\"screenshots\">\n * <img class=\"medium\" src=\"screenshots/card-title-1.png\" />\n * </div>\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { Avatar, Card, IconButton } from 'react-native-paper';\n *\n * const MyComponent = () => (\n * <Card.Title\n * title=\"Card Title\"\n * subtitle=\"Card Subtitle\"\n * left={(props) => <Avatar.Icon {...props} icon=\"folder\" />}\n * right={(props) => <IconButton {...props} icon=\"more-vert\" onPress={() => {}} />}\n * />\n * );\n *\n * export default MyComponent;\n * ```\n */\nclass CardTitle extends React.Component<Props> {\n static displayName = 'Card.Title';\n\n render() {\n const {\n left,\n leftStyle,\n right,\n rightStyle,\n subtitle,\n subtitleStyle,\n style,\n title,\n titleStyle,\n } = this.props;\n\n return (\n <View\n style={[\n styles.container,\n { height: subtitle || left || right ? 72 : 50 },\n style,\n ]}\n >\n {left ? (\n <View style={[styles.left, leftStyle]}>\n {left({\n size: LEFT_SIZE,\n })}\n </View>\n ) : null}\n\n <View style={[styles.titles]}>\n {title ? (\n <Title\n style={[\n styles.title,\n { marginBottom: subtitle ? 0 : 2 },\n titleStyle,\n ]}\n numberOfLines={1}\n >\n {title}\n </Title>\n ) : null}\n\n {subtitle ? (\n <Caption style={[styles.subtitle, subtitleStyle]} numberOfLines={1}>\n {subtitle}\n </Caption>\n ) : null}\n </View>\n\n <View style={rightStyle}>{right ? right({ size: 24 }) : null}</View>\n </View>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingLeft: 16,\n },\n\n left: {\n justifyContent: 'center',\n marginRight: 16,\n height: LEFT_SIZE,\n width: LEFT_SIZE,\n },\n\n titles: {\n flex: 1,\n flexDirection: 'column',\n justifyContent: 'center',\n height: 50,\n },\n\n title: {\n minHeight: 30,\n },\n\n subtitle: {\n minHeight: 20,\n marginVertical: 0,\n },\n});\n\nexport default withTheme(CardTitle);\n\n// @component-docs ignore-next-line\nexport { CardTitle };\n"]},"metadata":{},"sourceType":"script"}