UNPKG

2.51 kBSource Map (JSON)View Raw
1{"version":3,"sources":["CardActions.tsx"],"names":["CardActions","props","styles","container","style","React","Children","map","children","child","isValidElement","cloneElement","compact","displayName","StyleSheet","create","flexDirection","alignItems","justifyContent","padding"],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,WAAW,GAAIC,KAAD,iBAClB,oBAAC,iBAAD,eAAUA,KAAV;AAAiB,EAAA,KAAK,EAAE,CAACC,MAAM,CAACC,SAAR,EAAmBF,KAAK,CAACG,KAAzB;AAAxB,IACGC,KAAK,CAACC,QAAN,CAAeC,GAAf,CAAmBN,KAAK,CAACO,QAAzB,EAAoCC,KAAD,IAClC,aAAAJ,KAAK,CAACK,cAAN,CAAqBD,KAArB,iBACIJ,KAAK,CAACM,YAAN,CAAmBF,KAAnB,EAA0B;AACxBG,EAAAA,OAAO,EAAEH,KAAK,CAACR,KAAN,CAAYW,OAAZ,KAAwB;AADT,CAA1B,CADJ,GAIIH,KALL,CADH,CADF;;AAYAT,WAAW,CAACa,WAAZ,GAA0B,cAA1B;;AAEA,MAAMX,MAAM,GAAGY,wBAAWC,MAAX,CAAkB;AAC/BZ,EAAAA,SAAS,EAAE;AACTa,IAAAA,aAAa,EAAE,KADN;AAETC,IAAAA,UAAU,EAAE,QAFH;AAGTC,IAAAA,cAAc,EAAE,YAHP;AAITC,IAAAA,OAAO,EAAE;AAJA;AADoB,CAAlB,CAAf;;eASenB,W","sourcesContent":["import * as React from 'react';\nimport { StyleSheet, StyleProp, View, ViewStyle } from 'react-native';\n\ntype Props = React.ComponentPropsWithRef<typeof View> & {\n /**\n * Items inside the `CardActions`.\n */\n children: React.ReactNode;\n style?: StyleProp<ViewStyle>;\n};\n\n/**\n * A component to show a list of actions inside a Card.\n *\n * <div class=\"screenshots\">\n * <figure>\n * <img class=\"medium\" src=\"screenshots/card-actions.png\" />\n * </figure>\n * </div>\n *\n * ## Usage\n * ```js\n * import * as React from 'react';\n * import { Card, Button } from 'react-native-paper';\n *\n * const MyComponent = () => (\n * <Card>\n * <Card.Actions>\n * <Button>Cancel</Button>\n * <Button>Ok</Button>\n * </Card.Actions>\n * </Card>\n * );\n *\n * export default MyComponent;\n * ```\n */\nconst CardActions = (props: Props) => (\n <View {...props} style={[styles.container, props.style]}>\n {React.Children.map(props.children, (child) =>\n React.isValidElement(child)\n ? React.cloneElement(child, {\n compact: child.props.compact !== false,\n })\n : child\n )}\n </View>\n);\n\nCardActions.displayName = 'Card.Actions';\n\nconst styles = StyleSheet.create({\n container: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'flex-start',\n padding: 8,\n },\n});\n\nexport default CardActions;\n"]}
\No newline at end of file