@draftbit/core 46.7.2-9358f4.2 → 46.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/lib/commonjs/components/Justification.js +1 -5
  2. package/lib/commonjs/components/ResizeMode.js +1 -5
  3. package/lib/commonjs/index.js +0 -56
  4. package/lib/commonjs/utilities.js +2 -1
  5. package/lib/module/components/Justification.js +0 -1
  6. package/lib/module/components/ResizeMode.js +0 -1
  7. package/lib/module/index.js +0 -8
  8. package/lib/typescript/src/index.d.ts +0 -8
  9. package/lib/typescript/src/index.d.ts.map +1 -1
  10. package/package.json +3 -3
  11. package/src/index.tsx +0 -8
  12. package/lib/commonjs/components/CardBlock.js +0 -106
  13. package/lib/commonjs/components/CardContainer.js +0 -138
  14. package/lib/commonjs/components/CardContainerRating.js +0 -133
  15. package/lib/commonjs/components/CardContainerShortImage.js +0 -84
  16. package/lib/commonjs/components/CardInline.js +0 -91
  17. package/lib/commonjs/components/Carousel.js +0 -130
  18. package/lib/commonjs/components/Header.js +0 -82
  19. package/lib/commonjs/components/HeaderLarge.js +0 -38
  20. package/lib/commonjs/components/HeaderMedium.js +0 -38
  21. package/lib/commonjs/components/HeaderOverline.js +0 -39
  22. package/lib/module/components/CardBlock.js +0 -98
  23. package/lib/module/components/CardContainer.js +0 -121
  24. package/lib/module/components/CardContainerRating.js +0 -125
  25. package/lib/module/components/CardContainerShortImage.js +0 -76
  26. package/lib/module/components/CardInline.js +0 -82
  27. package/lib/module/components/Carousel.js +0 -120
  28. package/lib/module/components/Header.js +0 -72
  29. package/lib/module/components/HeaderLarge.js +0 -28
  30. package/lib/module/components/HeaderMedium.js +0 -28
  31. package/lib/module/components/HeaderOverline.js +0 -29
  32. package/lib/typescript/src/components/CardBlock.d.ts +0 -21
  33. package/lib/typescript/src/components/CardBlock.d.ts.map +0 -1
  34. package/lib/typescript/src/components/CardContainer.d.ts +0 -23
  35. package/lib/typescript/src/components/CardContainer.d.ts.map +0 -1
  36. package/lib/typescript/src/components/CardContainerRating.d.ts +0 -24
  37. package/lib/typescript/src/components/CardContainerRating.d.ts.map +0 -1
  38. package/lib/typescript/src/components/CardContainerShortImage.d.ts +0 -19
  39. package/lib/typescript/src/components/CardContainerShortImage.d.ts.map +0 -1
  40. package/lib/typescript/src/components/CardInline.d.ts +0 -20
  41. package/lib/typescript/src/components/CardInline.d.ts.map +0 -1
  42. package/lib/typescript/src/components/Carousel.d.ts +0 -15
  43. package/lib/typescript/src/components/Carousel.d.ts.map +0 -1
  44. package/lib/typescript/src/components/Header.d.ts +0 -20
  45. package/lib/typescript/src/components/Header.d.ts.map +0 -1
  46. package/lib/typescript/src/components/HeaderLarge.d.ts +0 -17
  47. package/lib/typescript/src/components/HeaderLarge.d.ts.map +0 -1
  48. package/lib/typescript/src/components/HeaderMedium.d.ts +0 -17
  49. package/lib/typescript/src/components/HeaderMedium.d.ts.map +0 -1
  50. package/lib/typescript/src/components/HeaderOverline.d.ts +0 -17
  51. package/lib/typescript/src/components/HeaderOverline.d.ts.map +0 -1
  52. package/src/Provider.js +0 -9
  53. package/src/components/Accordion/AccordionGroup.js +0 -44
  54. package/src/components/Accordion/AccordionItem.js +0 -32
  55. package/src/components/Accordion/index.js +0 -2
  56. package/src/components/ActionSheet/ActionSheet.js +0 -45
  57. package/src/components/ActionSheet/ActionSheetCancel.js +0 -6
  58. package/src/components/ActionSheet/ActionSheetItem.js +0 -30
  59. package/src/components/ActionSheet/index.js +0 -3
  60. package/src/components/AnimatedCircularProgress.js +0 -43
  61. package/src/components/AspectRatio.js +0 -18
  62. package/src/components/AvatarEdit.js +0 -30
  63. package/src/components/Banner.js +0 -109
  64. package/src/components/Button.js +0 -114
  65. package/src/components/Card.js +0 -57
  66. package/src/components/CardBlock.js +0 -54
  67. package/src/components/CardBlock.tsx +0 -127
  68. package/src/components/CardContainer.js +0 -69
  69. package/src/components/CardContainer.tsx +0 -165
  70. package/src/components/CardContainerRating.js +0 -79
  71. package/src/components/CardContainerRating.tsx +0 -175
  72. package/src/components/CardContainerShortImage.js +0 -33
  73. package/src/components/CardContainerShortImage.tsx +0 -101
  74. package/src/components/CardInline.js +0 -36
  75. package/src/components/CardInline.tsx +0 -93
  76. package/src/components/Carousel.js +0 -68
  77. package/src/components/Carousel.tsx +0 -134
  78. package/src/components/Checkbox/Checkbox.js +0 -62
  79. package/src/components/Checkbox/CheckboxGroup.js +0 -21
  80. package/src/components/Checkbox/CheckboxGroupRow.js +0 -76
  81. package/src/components/Checkbox/CheckboxRow.js +0 -77
  82. package/src/components/Checkbox/context.js +0 -14
  83. package/src/components/Checkbox/index.js +0 -3
  84. package/src/components/CircleImage.js +0 -8
  85. package/src/components/CircularProgress.js +0 -81
  86. package/src/components/Config.js +0 -64
  87. package/src/components/Container.js +0 -43
  88. package/src/components/DatePicker/DatePicker.js +0 -377
  89. package/src/components/DatePicker/DatePickerComponent.js +0 -13
  90. package/src/components/DatePicker/DatePickerComponent.web.js +0 -30
  91. package/src/components/DatePicker/DatePickerComponentType.js +0 -1
  92. package/src/components/DeprecatedButton.js +0 -83
  93. package/src/components/DeprecatedCardWrapper.js +0 -18
  94. package/src/components/DeprecatedFAB.js +0 -114
  95. package/src/components/Divider.js +0 -13
  96. package/src/components/Elevation.js +0 -20
  97. package/src/components/FAB.js +0 -46
  98. package/src/components/FieldSearchBarFull.js +0 -53
  99. package/src/components/FormRow.js +0 -19
  100. package/src/components/Header.js +0 -44
  101. package/src/components/Header.tsx +0 -105
  102. package/src/components/HeaderLarge.js +0 -7
  103. package/src/components/HeaderLarge.tsx +0 -40
  104. package/src/components/HeaderMedium.js +0 -7
  105. package/src/components/HeaderMedium.tsx +0 -41
  106. package/src/components/HeaderOverline.js +0 -7
  107. package/src/components/HeaderOverline.tsx +0 -42
  108. package/src/components/IconButton.js +0 -35
  109. package/src/components/Image.js +0 -47
  110. package/src/components/Justification.js +0 -1
  111. package/src/components/Layout.js +0 -50
  112. package/src/components/NumberInput.js +0 -49
  113. package/src/components/Picker/Picker.js +0 -267
  114. package/src/components/Picker/PickerComponent.android.js +0 -69
  115. package/src/components/Picker/PickerComponent.ios.js +0 -79
  116. package/src/components/Picker/PickerComponent.web.js +0 -70
  117. package/src/components/Picker/PickerTypes.js +0 -1
  118. package/src/components/Portal/Portal.js +0 -35
  119. package/src/components/Portal/PortalConsumer.js +0 -27
  120. package/src/components/Portal/PortalHost.js +0 -107
  121. package/src/components/Portal/PortalManager.js +0 -32
  122. package/src/components/Pressable.js +0 -12
  123. package/src/components/ProgressBar.js +0 -118
  124. package/src/components/ProgressCircle.js +0 -13
  125. package/src/components/ProgressIndicator.js +0 -27
  126. package/src/components/RadioButton/RadioButton.js +0 -17
  127. package/src/components/RadioButton/RadioButtonFieldGroup.js +0 -17
  128. package/src/components/RadioButton/RadioButtonGroup.js +0 -43
  129. package/src/components/RadioButton/RadioButtonRow.js +0 -76
  130. package/src/components/RadioButton/context.js +0 -14
  131. package/src/components/RadioButton/index.js +0 -4
  132. package/src/components/ResizeMode.js +0 -1
  133. package/src/components/Row.js +0 -48
  134. package/src/components/RowBodyIcon.js +0 -8
  135. package/src/components/RowHeadlineImageCaption.js +0 -12
  136. package/src/components/RowHeadlineImageIcon.js +0 -14
  137. package/src/components/SVG.js +0 -13
  138. package/src/components/ScreenContainer.js +0 -34
  139. package/src/components/Slider.js +0 -63
  140. package/src/components/StarRating.js +0 -50
  141. package/src/components/StepIndicator.js +0 -346
  142. package/src/components/Stepper.js +0 -41
  143. package/src/components/Surface.js +0 -32
  144. package/src/components/Swiper/Swiper.js +0 -29
  145. package/src/components/Swiper/SwiperItem.js +0 -9
  146. package/src/components/Swiper/index.js +0 -2
  147. package/src/components/Switch.js +0 -56
  148. package/src/components/Text.js +0 -33
  149. package/src/components/TextField.js +0 -428
  150. package/src/components/ToggleButton.js +0 -39
  151. package/src/components/Touchable.js +0 -12
  152. package/src/components/Touchable.web.js +0 -2
  153. package/src/components/Typography.js +0 -36
  154. package/src/components/useAuthState.js +0 -31
  155. package/src/constants.js +0 -10
  156. package/src/hooks.js +0 -12
  157. package/src/index.js +0 -53
  158. package/src/interfaces/Icon.js +0 -8
  159. package/src/mappings/Accordion.js +0 -41
  160. package/src/mappings/AccordionItem.js +0 -16
  161. package/src/mappings/ActionSheet.js +0 -13
  162. package/src/mappings/ActionSheetCancel.js +0 -19
  163. package/src/mappings/ActionSheetItem.js +0 -23
  164. package/src/mappings/ActivityIndicator.js +0 -58
  165. package/src/mappings/AudioPlayer.js +0 -57
  166. package/src/mappings/AvatarEdit.js +0 -38
  167. package/src/mappings/Banner.js +0 -32
  168. package/src/mappings/BlurView.js +0 -42
  169. package/src/mappings/Button.js +0 -116
  170. package/src/mappings/Card.js +0 -52
  171. package/src/mappings/CardBlock.js +0 -123
  172. package/src/mappings/CardContainer.js +0 -104
  173. package/src/mappings/CardContainerRating.js +0 -126
  174. package/src/mappings/CardContainerShortImage.js +0 -120
  175. package/src/mappings/CardInline.js +0 -52
  176. package/src/mappings/Carousel.js +0 -19
  177. package/src/mappings/Checkbox.js +0 -46
  178. package/src/mappings/CheckboxGroup.js +0 -26
  179. package/src/mappings/CheckboxRow.js +0 -61
  180. package/src/mappings/CircleImage.js +0 -25
  181. package/src/mappings/Container.js +0 -30
  182. package/src/mappings/CustomCode.js +0 -8
  183. package/src/mappings/DatePicker.js +0 -176
  184. package/src/mappings/Divider.js +0 -27
  185. package/src/mappings/FAB.js +0 -37
  186. package/src/mappings/Fetch.js +0 -13
  187. package/src/mappings/FieldSearchBarFull.js +0 -50
  188. package/src/mappings/FlashList.js +0 -85
  189. package/src/mappings/FlatList.js +0 -37
  190. package/src/mappings/HeaderLarge.js +0 -29
  191. package/src/mappings/HeaderMedium.js +0 -55
  192. package/src/mappings/HeaderOverline.js +0 -55
  193. package/src/mappings/Icon.js +0 -32
  194. package/src/mappings/IconButton.js +0 -35
  195. package/src/mappings/Image.js +0 -35
  196. package/src/mappings/ImageBackground.js +0 -29
  197. package/src/mappings/KeyboardAvoidingView.js +0 -41
  198. package/src/mappings/KeyboardAwareScrollView.js +0 -50
  199. package/src/mappings/Layout.js +0 -200
  200. package/src/mappings/LinearGradient.js +0 -77
  201. package/src/mappings/MapCallout.js +0 -21
  202. package/src/mappings/MapMarker.js +0 -47
  203. package/src/mappings/MapView.js +0 -139
  204. package/src/mappings/Modal.js +0 -42
  205. package/src/mappings/NumberInput.js +0 -254
  206. package/src/mappings/Picker.js +0 -148
  207. package/src/mappings/ProgressBar.js +0 -101
  208. package/src/mappings/ProgressCircle.js +0 -109
  209. package/src/mappings/ProgressIndicator.js +0 -181
  210. package/src/mappings/RadioButton.js +0 -51
  211. package/src/mappings/RadioButtonGroup.js +0 -17
  212. package/src/mappings/RadioButtonRow.js +0 -42
  213. package/src/mappings/RowBodyIcon.js +0 -75
  214. package/src/mappings/RowHeadlineImageCaption.js +0 -167
  215. package/src/mappings/RowHeadlineImageIcon.js +0 -99
  216. package/src/mappings/SVG.js +0 -20
  217. package/src/mappings/SafeAreaView.js +0 -33
  218. package/src/mappings/ScrollView.js +0 -31
  219. package/src/mappings/Slider.js +0 -60
  220. package/src/mappings/StarRating.js +0 -43
  221. package/src/mappings/Stepper.js +0 -32
  222. package/src/mappings/Surface.js +0 -14
  223. package/src/mappings/Swiper.js +0 -62
  224. package/src/mappings/SwiperItem.js +0 -8
  225. package/src/mappings/Switch.js +0 -81
  226. package/src/mappings/Text.js +0 -251
  227. package/src/mappings/TextArea.js +0 -274
  228. package/src/mappings/TextField.js +0 -391
  229. package/src/mappings/TextInput.js +0 -402
  230. package/src/mappings/ToggleButton.js +0 -50
  231. package/src/mappings/Touchable.js +0 -60
  232. package/src/mappings/Video.js +0 -81
  233. package/src/mappings/View.js +0 -207
  234. package/src/mappings/WebView.js +0 -88
  235. package/src/styles/DarkTheme.js +0 -26
  236. package/src/styles/DefaultTheme.js +0 -111
  237. package/src/styles/fonts.js +0 -62
  238. package/src/styles/overlay.js +0 -60
  239. package/src/styles/shadow.js +0 -51
  240. package/src/theming.js +0 -3
  241. package/src/utilities.js +0 -102
@@ -1,114 +0,0 @@
1
- import * as React from "react";
2
- import { Text, Pressable, Platform, StyleSheet, ActivityIndicator, } from "react-native";
3
- import { withTheme } from "../theming";
4
- const CONSTANTS = {
5
- baseHeight: 42,
6
- borderRadius: 4,
7
- padding: 8,
8
- icon: 24,
9
- };
10
- function Base({ Icon, icon, title, loading, disabled, style, activeOpacity, disabledOpacity, ...props }) {
11
- const { color, fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, textTransform, textAlign, textDecorationLine, textDecorationColor, textDecorationStyle, ...buttonStyles } = StyleSheet.flatten(style || {});
12
- const titleStyles = {
13
- color,
14
- fontFamily,
15
- fontWeight,
16
- fontSize,
17
- lineHeight,
18
- letterSpacing,
19
- textTransform,
20
- textAlign,
21
- textDecorationLine,
22
- textDecorationColor,
23
- textDecorationStyle,
24
- };
25
- if (textAlign === "left") {
26
- buttonStyles.justifyContent = "flex-start";
27
- }
28
- if (textAlign === "right") {
29
- buttonStyles.justifyContent = "flex-end";
30
- }
31
- return (React.createElement(Pressable, { disabled: disabled || loading, style: ({ pressed }) => {
32
- return [
33
- styles.base,
34
- {
35
- opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
36
- },
37
- buttonStyles,
38
- ];
39
- }, ...props },
40
- loading ? (React.createElement(ActivityIndicator, { size: "small", color: color, style: styles.loading })) : null,
41
- icon && !loading ? (React.createElement(Icon, { name: icon, color: color, style: styles.icon, size: CONSTANTS.icon })) : null,
42
- React.createElement(Text, { style: titleStyles }, title)));
43
- }
44
- const Solid = ({ style, theme, ...props }) => {
45
- return (React.createElement(Base, { style: [
46
- {
47
- color: "#FFF",
48
- borderRadius: theme.roundness,
49
- backgroundColor: theme.colors.primary,
50
- },
51
- style,
52
- ], ...props }));
53
- };
54
- const ButtonSolid = withTheme(Solid);
55
- export { ButtonSolid };
56
- const Button = withTheme(Solid);
57
- export { Button };
58
- const Outline = ({ style, theme, ...props }) => {
59
- return (React.createElement(Base, { style: [
60
- styles.outline,
61
- {
62
- borderRadius: theme.roundness,
63
- borderColor: theme.colors.primary,
64
- color: theme.colors.primary,
65
- },
66
- style,
67
- ], ...props }));
68
- };
69
- const ButtonOutline = withTheme(Outline);
70
- export { ButtonOutline };
71
- const styles = StyleSheet.create({
72
- base: {
73
- position: "relative",
74
- flexDirection: "row",
75
- alignItems: "center",
76
- justifyContent: "center",
77
- minHeight: CONSTANTS.baseHeight,
78
- paddingHorizontal: 12,
79
- fontFamily: "System",
80
- fontWeight: "700",
81
- ...Platform.select({
82
- web: {
83
- cursor: "pointer",
84
- userSelect: "none",
85
- },
86
- }),
87
- },
88
- outline: {
89
- backgroundColor: "transparent",
90
- borderWidth: 1,
91
- },
92
- bare: {
93
- backgroundColor: "transparent",
94
- padding: 0,
95
- minHeight: undefined,
96
- },
97
- loading: {
98
- marginRight: 6,
99
- },
100
- icon: {
101
- ...Platform.select({
102
- web: {
103
- marginTop: 1,
104
- marginRight: 4,
105
- alignSelf: "center",
106
- },
107
- default: {
108
- marginBottom: 2,
109
- marginRight: 4,
110
- alignSelf: "center",
111
- },
112
- }),
113
- },
114
- });
@@ -1,57 +0,0 @@
1
- import React from "react";
2
- import { StyleSheet, View, Pressable, } from "react-native";
3
- import Image from "./Image";
4
- import Surface from "./Surface";
5
- import { Title, Subtitle, Caption } from "./Typography";
6
- import { withTheme } from "../theming";
7
- import Config from "./Config";
8
- const ICON_SIZE = Config.cardIconSize;
9
- const ICON_CONTAINER_SIZE = Config.cardIconSize * 2;
10
- const ICON_CONTAINER_PADDING = Config.cardIconSize / 2 - 1;
11
- const ICON_ELEVATION = Config.cardIconElevation;
12
- export const TopRightCircleIcon = withTheme(({ Icon, icon, theme, onPress, }) => {
13
- return (React.createElement(Surface, { style: {
14
- justifyContent: "center",
15
- alignItems: "center",
16
- elevation: ICON_ELEVATION,
17
- position: "absolute",
18
- top: 12,
19
- right: 12,
20
- width: ICON_CONTAINER_SIZE,
21
- height: ICON_CONTAINER_SIZE,
22
- padding: ICON_CONTAINER_PADDING,
23
- borderRadius: ICON_CONTAINER_SIZE,
24
- backgroundColor: "rgba(0, 0, 0, 0.1)",
25
- } },
26
- React.createElement(Pressable, { disabled: !onPress, onPress: onPress, style: ({ pressed }) => {
27
- return [
28
- {
29
- opacity: pressed ? 0.8 : 1,
30
- },
31
- ];
32
- } },
33
- React.createElement(Icon, { name: icon, size: ICON_SIZE, color: theme.colors.surface }))));
34
- });
35
- const Card = ({ Icon, image = Config.cardImageUrl, title, subtitle, description, textCentered, icon, aspectRatio = 1.5, elevation = 2, style, onPress, onPressIcon, titleStyle, subtitleStyle, descriptionStyle, theme, children, }) => {
36
- const { backgroundColor: bgColor, padding, ...styles } = StyleSheet.flatten(style || {});
37
- const backgroundColor = bgColor ? bgColor : theme.colors.surface;
38
- const innerPadding = padding ? padding : 12;
39
- return (React.createElement(Surface, { style: [{ elevation, backgroundColor }, styles] },
40
- React.createElement(Pressable, { disabled: !onPress, onPress: onPress, style: ({ pressed }) => {
41
- return [
42
- {
43
- opacity: pressed ? 0.8 : 1,
44
- },
45
- ];
46
- } },
47
- React.createElement(Image, { style: { aspectRatio }, source: typeof image === "string" ? { uri: image } : image, resizeMode: "cover" }),
48
- React.createElement(View, { style: { padding: innerPadding } },
49
- React.createElement(View, { style: { alignItems: textCentered ? "center" : "flex-start" } },
50
- title || (title && title !== "") ? (React.createElement(Title, { text: title, style: titleStyle })) : null,
51
- subtitle || (subtitle && subtitle !== "") ? (React.createElement(Subtitle, { text: subtitle, style: subtitleStyle })) : null,
52
- description || (description && description !== "") ? (React.createElement(View, { style: { marginTop: 4 } },
53
- React.createElement(Caption, { text: description, style: descriptionStyle }))) : null,
54
- children)),
55
- icon ? (React.createElement(TopRightCircleIcon, { Icon: Icon, icon: icon, onPress: onPressIcon })) : null)));
56
- };
57
- export default withTheme(Card);
@@ -1,54 +0,0 @@
1
- import React from "react";
2
- import { View, Text, } from "react-native";
3
- import Image from "./Image";
4
- import Card from "./DeprecatedCardWrapper";
5
- import Elevation from "./Elevation";
6
- import { withTheme } from "../theming";
7
- import Config from "./Config";
8
- const CardBlock = ({ image = Config.cardImageUrl, title, leftDescription, rightDescription, titleCentered, aspectRatio = 1.5, elevation = 2, numColumns = 3, theme: { colors, roundness, typography }, style, onPress, ...rest }) => {
9
- let titleJustification;
10
- let titleStyle;
11
- if (titleCentered && !leftDescription && !rightDescription) {
12
- titleJustification = "center";
13
- }
14
- else {
15
- titleJustification = "space-between";
16
- }
17
- if (numColumns === 1) {
18
- titleStyle = typography.button;
19
- }
20
- else if (numColumns === 2) {
21
- titleStyle = typography.headline6;
22
- }
23
- else {
24
- titleStyle = typography.headline5;
25
- }
26
- const rightDescriptionStyles = [
27
- typography.subtitle2,
28
- { color: colors.light },
29
- ];
30
- return (React.createElement(Card, { style: style, onPress: onPress, numColumns: numColumns, ...rest },
31
- React.createElement(View, { style: { backgroundColor: colors.background } },
32
- React.createElement(Elevation, { style: { elevation, borderRadius: roundness } },
33
- React.createElement(Image, { style: {
34
- borderRadius: roundness,
35
- aspectRatio,
36
- }, source: typeof image === "string" ? { uri: image } : image, resizeMode: "cover" })),
37
- title ? (React.createElement(View, { style: {
38
- flexDirection: "row",
39
- alignItems: "center",
40
- justifyContent: titleJustification,
41
- marginTop: numColumns === 3 ? 16 : 12,
42
- } },
43
- React.createElement(Text, { numberOfLines: 1, style: [titleStyle, { color: colors.strong }] }, title),
44
- !leftDescription && rightDescription ? (React.createElement(Text, { style: rightDescriptionStyles }, rightDescription)) : null)) : null,
45
- leftDescription ? (React.createElement(View, { style: {
46
- flexDirection: "row",
47
- justifyContent: "space-between",
48
- alignItems: "center",
49
- marginTop: numColumns === 3 ? 4 : 4 / 2,
50
- } },
51
- React.createElement(Text, { numberOfLines: 1, style: [typography.body2, { color: colors.medium }] }, leftDescription),
52
- rightDescription ? (React.createElement(Text, { numberOfLines: 1, style: rightDescriptionStyles }, rightDescription)) : null)) : null)));
53
- };
54
- export default withTheme(CardBlock);
@@ -1,127 +0,0 @@
1
- import React from "react";
2
- import {
3
- ImageSourcePropType,
4
- View,
5
- Text,
6
- StyleProp,
7
- ViewStyle,
8
- } from "react-native";
9
- import Image from "./Image";
10
- import Card from "./DeprecatedCardWrapper";
11
- import Elevation from "./Elevation";
12
- import { withTheme } from "../theming";
13
- import Config from "./Config";
14
- import theme from "../styles/DefaultTheme";
15
- import { justificationType } from "./Justification";
16
-
17
- type Props = {
18
- image?: string | ImageSourcePropType;
19
- title?: string;
20
- leftDescription?: string;
21
- rightDescription?: string;
22
- titleCentered: boolean;
23
- aspectRatio?: number;
24
- elevation?: number;
25
- numColumns?: number;
26
- theme: typeof theme;
27
- style?: StyleProp<ViewStyle>;
28
- onPress: () => void;
29
- };
30
-
31
- const CardBlock: React.FC<React.PropsWithChildren<Props>> = ({
32
- image = Config.cardImageUrl,
33
- title,
34
- leftDescription,
35
- rightDescription,
36
- titleCentered,
37
- aspectRatio = 1.5,
38
- elevation = 2,
39
- numColumns = 3,
40
- theme: { colors, roundness, typography },
41
- style,
42
- onPress,
43
- ...rest
44
- }) => {
45
- let titleJustification: justificationType;
46
-
47
- let titleStyle;
48
- if (titleCentered && !leftDescription && !rightDescription) {
49
- titleJustification = "center";
50
- } else {
51
- titleJustification = "space-between";
52
- }
53
-
54
- if (numColumns === 1) {
55
- titleStyle = typography.button;
56
- } else if (numColumns === 2) {
57
- titleStyle = typography.headline6;
58
- } else {
59
- titleStyle = typography.headline5;
60
- }
61
-
62
- const rightDescriptionStyles = [
63
- typography.subtitle2,
64
- { color: colors.light },
65
- ];
66
-
67
- return (
68
- <Card style={style} onPress={onPress} numColumns={numColumns} {...rest}>
69
- <View style={{ backgroundColor: colors.background }}>
70
- <Elevation style={{ elevation, borderRadius: roundness }}>
71
- <Image
72
- style={{
73
- borderRadius: roundness,
74
- aspectRatio,
75
- }}
76
- source={typeof image === "string" ? { uri: image } : image}
77
- resizeMode="cover"
78
- />
79
- </Elevation>
80
- {title ? (
81
- <View
82
- style={{
83
- flexDirection: "row",
84
- alignItems: "center",
85
- justifyContent: titleJustification,
86
- marginTop: numColumns === 3 ? 16 : 12,
87
- }}
88
- >
89
- <Text
90
- numberOfLines={1}
91
- style={[titleStyle, { color: colors.strong }]}
92
- >
93
- {title}
94
- </Text>
95
- {!leftDescription && rightDescription ? (
96
- <Text style={rightDescriptionStyles}>{rightDescription}</Text>
97
- ) : null}
98
- </View>
99
- ) : null}
100
- {leftDescription ? (
101
- <View
102
- style={{
103
- flexDirection: "row",
104
- justifyContent: "space-between",
105
- alignItems: "center",
106
- marginTop: numColumns === 3 ? 4 : 4 / 2,
107
- }}
108
- >
109
- <Text
110
- numberOfLines={1}
111
- style={[typography.body2, { color: colors.medium }]}
112
- >
113
- {leftDescription}
114
- </Text>
115
- {rightDescription ? (
116
- <Text numberOfLines={1} style={rightDescriptionStyles}>
117
- {rightDescription}
118
- </Text>
119
- ) : null}
120
- </View>
121
- ) : null}
122
- </View>
123
- </Card>
124
- );
125
- };
126
-
127
- export default withTheme(CardBlock);
@@ -1,69 +0,0 @@
1
- import React from "react";
2
- import { View, Text, } from "react-native";
3
- import color from "color";
4
- import Image from "./Image";
5
- import Card from "./DeprecatedCardWrapper";
6
- import Elevation from "./Elevation";
7
- import { withTheme } from "../theming";
8
- import Config from "./Config";
9
- const ICON_CONTAINER_SIZE = Config.cardIconSize * 2;
10
- const ICON_CONTAINER_PADDING = Config.cardIconSize / 2 - 1;
11
- const CardContainer = ({ Icon, icon, image = Config.cardImageUrl, title, leftDescription, rightDescription, textCentered, aspectRatio = 1.5, elevation = 2, numColumns = 3, theme: { colors, roundness, typography }, style, onPress, ...rest }) => {
12
- let textJustification;
13
- let titleStyle;
14
- if (textCentered && !rightDescription) {
15
- textJustification = "center";
16
- }
17
- else {
18
- textJustification = "space-between";
19
- }
20
- switch (numColumns) {
21
- case 2:
22
- titleStyle = typography.headline6;
23
- break;
24
- case 3:
25
- titleStyle = typography.headline5;
26
- break;
27
- }
28
- return (React.createElement(Card, { style: style, onPress: onPress, numColumns: numColumns, ...rest },
29
- React.createElement(Elevation, { style: { elevation, borderRadius: roundness } },
30
- React.createElement(View, { style: {
31
- borderRadius: roundness,
32
- overflow: "hidden",
33
- backgroundColor: colors.surface,
34
- } },
35
- React.createElement(Image, { style: { aspectRatio }, source: typeof image === "string" ? { uri: image } : image, resizeMode: "cover" }),
36
- React.createElement(View, { style: {
37
- padding: numColumns === 1 ? 8 : 16,
38
- } },
39
- title ? (React.createElement(View, { style: {
40
- flexDirection: "row",
41
- alignItems: "center",
42
- justifyContent: textJustification,
43
- } },
44
- React.createElement(Text, { numberOfLines: 1, style: [titleStyle, { color: colors.strong }] }, title))) : null,
45
- leftDescription ? (React.createElement(View, { style: {
46
- flexDirection: "row",
47
- justifyContent: textJustification,
48
- alignItems: "center",
49
- marginTop: numColumns === 3 ? 4 : 4 / 2,
50
- } },
51
- React.createElement(Text, { numberOfLines: 1, style: [typography.body2, { color: colors.medium }] }, leftDescription),
52
- rightDescription ? (React.createElement(Text, { numberOfLines: 1, style: [typography.subtitle2, { color: colors.light }] }, rightDescription)) : null)) : null),
53
- icon ? (React.createElement(Elevation, { style: {
54
- elevation: Config.cardIconElevation,
55
- position: "absolute",
56
- top: 12,
57
- right: 12,
58
- width: ICON_CONTAINER_SIZE,
59
- height: ICON_CONTAINER_SIZE,
60
- padding: ICON_CONTAINER_PADDING,
61
- borderRadius: ICON_CONTAINER_SIZE,
62
- backgroundColor: color(colors.strong)
63
- .alpha(Config.cardIconBackgroundOpacity)
64
- .rgb()
65
- .string(),
66
- } },
67
- React.createElement(Icon, { name: icon, size: Config.cardIconSize, color: colors.surface }))) : null))));
68
- };
69
- export default withTheme(CardContainer);
@@ -1,165 +0,0 @@
1
- import React from "react";
2
- import {
3
- View,
4
- ImageSourcePropType,
5
- Text,
6
- StyleProp,
7
- ViewStyle,
8
- } from "react-native";
9
- import color from "color";
10
- import Image from "./Image";
11
- import Card from "./DeprecatedCardWrapper";
12
- import Elevation from "./Elevation";
13
- import { withTheme } from "../theming";
14
- import type { Theme } from "../styles/DefaultTheme";
15
- import type { IconSlot } from "../interfaces/Icon";
16
-
17
- import Config from "./Config";
18
- import { justificationType } from "./Justification";
19
-
20
- const ICON_CONTAINER_SIZE = Config.cardIconSize * 2;
21
- const ICON_CONTAINER_PADDING = Config.cardIconSize / 2 - 1;
22
-
23
- type Props = {
24
- image?: string | ImageSourcePropType;
25
- title?: string;
26
- leftDescription?: string;
27
- rightDescription?: string;
28
- textCentered: boolean;
29
- icon?: string;
30
- aspectRatio?: number;
31
- elevation?: number;
32
- numColumns?: number;
33
- theme: Theme;
34
- style?: StyleProp<ViewStyle>;
35
- onPress: () => void;
36
- } & IconSlot;
37
-
38
- const CardContainer: React.FC<React.PropsWithChildren<Props>> = ({
39
- Icon,
40
- icon,
41
- image = Config.cardImageUrl,
42
- title,
43
- leftDescription,
44
- rightDescription,
45
- textCentered,
46
- aspectRatio = 1.5,
47
- elevation = 2,
48
- numColumns = 3,
49
- theme: { colors, roundness, typography },
50
- style,
51
- onPress,
52
- ...rest
53
- }) => {
54
- let textJustification: justificationType;
55
-
56
- let titleStyle;
57
-
58
- if (textCentered && !rightDescription) {
59
- textJustification = "center";
60
- } else {
61
- textJustification = "space-between";
62
- }
63
-
64
- switch (numColumns) {
65
- case 2:
66
- titleStyle = typography.headline6;
67
- break;
68
- case 3:
69
- titleStyle = typography.headline5;
70
- break;
71
- }
72
-
73
- return (
74
- <Card style={style} onPress={onPress} numColumns={numColumns} {...rest}>
75
- <Elevation style={{ elevation, borderRadius: roundness }}>
76
- <View
77
- style={{
78
- borderRadius: roundness,
79
- overflow: "hidden",
80
- backgroundColor: colors.surface,
81
- }}
82
- >
83
- <Image
84
- style={{ aspectRatio }}
85
- source={typeof image === "string" ? { uri: image } : image}
86
- resizeMode="cover"
87
- />
88
- <View
89
- style={{
90
- padding: numColumns === 1 ? 8 : 16,
91
- }}
92
- >
93
- {title ? (
94
- <View
95
- style={{
96
- flexDirection: "row",
97
- alignItems: "center",
98
- justifyContent: textJustification,
99
- }}
100
- >
101
- <Text
102
- numberOfLines={1}
103
- style={[titleStyle, { color: colors.strong }]}
104
- >
105
- {title}
106
- </Text>
107
- </View>
108
- ) : null}
109
- {leftDescription ? (
110
- <View
111
- style={{
112
- flexDirection: "row",
113
- justifyContent: textJustification,
114
- alignItems: "center",
115
- marginTop: numColumns === 3 ? 4 : 4 / 2,
116
- }}
117
- >
118
- <Text
119
- numberOfLines={1}
120
- style={[typography.body2, { color: colors.medium }]}
121
- >
122
- {leftDescription}
123
- </Text>
124
- {rightDescription ? (
125
- <Text
126
- numberOfLines={1}
127
- style={[typography.subtitle2, { color: colors.light }]}
128
- >
129
- {rightDescription}
130
- </Text>
131
- ) : null}
132
- </View>
133
- ) : null}
134
- </View>
135
- {icon ? (
136
- <Elevation
137
- style={{
138
- elevation: Config.cardIconElevation,
139
- position: "absolute",
140
- top: 12,
141
- right: 12,
142
- width: ICON_CONTAINER_SIZE,
143
- height: ICON_CONTAINER_SIZE,
144
- padding: ICON_CONTAINER_PADDING,
145
- borderRadius: ICON_CONTAINER_SIZE,
146
- backgroundColor: color(colors.strong)
147
- .alpha(Config.cardIconBackgroundOpacity)
148
- .rgb()
149
- .string(),
150
- }}
151
- >
152
- <Icon
153
- name={icon}
154
- size={Config.cardIconSize}
155
- color={colors.surface}
156
- />
157
- </Elevation>
158
- ) : null}
159
- </View>
160
- </Elevation>
161
- </Card>
162
- );
163
- };
164
-
165
- export default withTheme(CardContainer);
@@ -1,79 +0,0 @@
1
- import React from "react";
2
- import { View, Text, } from "react-native";
3
- import color from "color";
4
- import Image from "./Image";
5
- import Card from "./DeprecatedCardWrapper";
6
- import Elevation from "./Elevation";
7
- import StarRating from "./StarRating";
8
- import { withTheme } from "../theming";
9
- import Config from "./Config";
10
- const ICON_CONTAINER_SIZE = Config.cardIconSize * 2;
11
- const ICON_CONTAINER_PADDING = Config.cardIconSize / 2 - 1;
12
- const CardContainerRating = ({ Icon, icon, image = Config.cardImageUrl, title, leftDescription, rightDescription, rating, aspectRatio = 1.5, elevation = 2, numColumns = 3, theme: { colors, roundness, typography }, style, onPress, ...rest }) => {
13
- let titleStyle, rightDescriptionStyle;
14
- switch (numColumns) {
15
- case 2:
16
- titleStyle = typography.headline6;
17
- rightDescriptionStyle = typography.body2;
18
- break;
19
- case 3:
20
- titleStyle = typography.headline5;
21
- rightDescriptionStyle = typography.caption;
22
- break;
23
- }
24
- return (React.createElement(Card, { style: style, onPress: onPress, numColumns: numColumns, ...rest },
25
- React.createElement(Elevation, { style: { elevation, borderRadius: roundness } },
26
- React.createElement(View, { style: {
27
- borderRadius: roundness,
28
- overflow: "hidden",
29
- backgroundColor: colors.background,
30
- //background color is needed for bug on android 9 - https://github.com/facebook/react-native/issues/25093
31
- } },
32
- React.createElement(Image, { style: { aspectRatio }, source: typeof image === "string" ? { uri: image } : image, resizeMode: "cover" }),
33
- React.createElement(View, { style: {
34
- padding: numColumns === 1 ? 8 : 16,
35
- } },
36
- title ? (React.createElement(View, { style: {
37
- flexDirection: "row",
38
- alignItems: "center",
39
- justifyContent: "space-between",
40
- } },
41
- React.createElement(Text, { numberOfLines: 1, style: [titleStyle, { color: colors.strong }] }, title))) : null,
42
- leftDescription ? (React.createElement(Text, { numberOfLines: 1, style: [
43
- typography.body2,
44
- {
45
- color: colors.medium,
46
- marginTop: numColumns === 3 ? 4 : 4 / 2,
47
- },
48
- ] }, leftDescription)) : null,
49
- React.createElement(View, { style: {
50
- flexDirection: "row",
51
- justifyContent: "space-between",
52
- alignItems: "center",
53
- marginTop: numColumns === 3 ? 16 : 12,
54
- } },
55
- React.createElement(StarRating, { Icon: Icon, starSize: numColumns === 1 ? 10 : 16, rating: rating }),
56
- React.createElement(Text, { style: [
57
- rightDescriptionStyle,
58
- {
59
- color: colors.medium,
60
- marginLeft: 8,
61
- },
62
- ], numberOfLines: 1 }, rightDescription))),
63
- icon ? (React.createElement(Elevation, { style: {
64
- elevation: Config.cardIconElevation,
65
- position: "absolute",
66
- top: 12,
67
- right: 12,
68
- width: ICON_CONTAINER_SIZE,
69
- height: ICON_CONTAINER_SIZE,
70
- padding: ICON_CONTAINER_PADDING,
71
- borderRadius: ICON_CONTAINER_SIZE,
72
- backgroundColor: color(colors.strong)
73
- .alpha(Config.cardIconBackgroundOpacity)
74
- .rgb()
75
- .string(),
76
- } },
77
- React.createElement(Icon, { name: icon, size: Config.cardIconSize, color: colors.surface }))) : null))));
78
- };
79
- export default withTheme(CardContainerRating);