@draftbit/core 46.7.3 → 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 (287) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +4 -23
  2. package/lib/commonjs/components/AnimatedCircularProgress.js +1 -12
  3. package/lib/commonjs/components/AvatarEdit.js +4 -15
  4. package/lib/commonjs/components/Button.js +10 -33
  5. package/lib/commonjs/components/Checkbox/Checkbox.js +4 -22
  6. package/lib/commonjs/components/Container.js +4 -15
  7. package/lib/commonjs/components/DeprecatedButton.js +3 -20
  8. package/lib/commonjs/components/DeprecatedCardWrapper.js +1 -15
  9. package/lib/commonjs/components/Divider.js +1 -14
  10. package/lib/commonjs/components/Image.js +2 -17
  11. package/lib/commonjs/components/Justification.js +1 -5
  12. package/lib/commonjs/components/Picker/Picker.js +4 -9
  13. package/lib/commonjs/components/Portal/PortalHost.js +15 -44
  14. package/lib/commonjs/components/Portal/PortalManager.js +8 -34
  15. package/lib/commonjs/components/ProgressBar.js +7 -37
  16. package/lib/commonjs/components/ResizeMode.js +1 -5
  17. package/lib/commonjs/components/Slider.js +4 -21
  18. package/lib/commonjs/components/Surface.js +2 -14
  19. package/lib/commonjs/components/TextField.js +28 -76
  20. package/lib/commonjs/components/Touchable.js +2 -15
  21. package/lib/commonjs/hooks.js +2 -1
  22. package/lib/commonjs/index.js +0 -56
  23. package/lib/commonjs/mappings/StarRating.js +2 -6
  24. package/lib/commonjs/utilities.js +2 -1
  25. package/lib/module/components/Button.js +10 -33
  26. package/lib/module/components/Checkbox/CheckboxGroupRow.js +5 -24
  27. package/lib/module/components/Checkbox/context.js +1 -1
  28. package/lib/module/components/CircleImage.js +1 -16
  29. package/lib/module/components/DeprecatedCardWrapper.js +1 -18
  30. package/lib/module/components/Divider.js +1 -18
  31. package/lib/module/components/Elevation.js +2 -14
  32. package/lib/module/components/FieldSearchBarFull.js +2 -1
  33. package/lib/module/components/FormRow.js +2 -17
  34. package/lib/module/components/Image.js +2 -18
  35. package/lib/module/components/Justification.js +0 -1
  36. package/lib/module/components/Layout.js +21 -42
  37. package/lib/module/components/NumberInput.js +3 -12
  38. package/lib/module/components/Picker/PickerComponent.ios.js +11 -36
  39. package/lib/module/components/Portal/PortalConsumer.js +7 -22
  40. package/lib/module/components/RadioButton/RadioButton.js +1 -13
  41. package/lib/module/components/RadioButton/RadioButtonGroup.js +2 -16
  42. package/lib/module/components/RadioButton/RadioButtonRow.js +5 -24
  43. package/lib/module/components/ResizeMode.js +0 -1
  44. package/lib/module/components/Slider.js +4 -21
  45. package/lib/module/components/StepIndicator.js +18 -58
  46. package/lib/module/components/TextField.js +28 -78
  47. package/lib/module/components/ToggleButton.js +2 -16
  48. package/lib/module/components/Touchable.js +2 -15
  49. package/lib/module/constants.js +2 -1
  50. package/lib/module/index.js +0 -8
  51. package/lib/module/mappings/FieldSearchBarFull.js +1 -4
  52. package/lib/module/styles/overlay.js +3 -1
  53. package/lib/module/utilities.js +2 -1
  54. package/lib/typescript/src/index.d.ts +0 -8
  55. package/lib/typescript/src/index.d.ts.map +1 -1
  56. package/package.json +3 -3
  57. package/src/index.tsx +0 -8
  58. package/lib/commonjs/components/CardBlock.js +0 -115
  59. package/lib/commonjs/components/CardContainer.js +0 -138
  60. package/lib/commonjs/components/CardContainerRating.js +0 -133
  61. package/lib/commonjs/components/CardContainerShortImage.js +0 -84
  62. package/lib/commonjs/components/CardInline.js +0 -91
  63. package/lib/commonjs/components/Carousel.js +0 -130
  64. package/lib/commonjs/components/Header.js +0 -82
  65. package/lib/commonjs/components/HeaderLarge.js +0 -38
  66. package/lib/commonjs/components/HeaderMedium.js +0 -38
  67. package/lib/commonjs/components/HeaderOverline.js +0 -39
  68. package/lib/module/components/CardBlock.js +0 -108
  69. package/lib/module/components/CardContainer.js +0 -121
  70. package/lib/module/components/CardContainerRating.js +0 -135
  71. package/lib/module/components/CardContainerShortImage.js +0 -90
  72. package/lib/module/components/CardInline.js +0 -82
  73. package/lib/module/components/Carousel.js +0 -120
  74. package/lib/module/components/Header.js +0 -72
  75. package/lib/module/components/HeaderLarge.js +0 -28
  76. package/lib/module/components/HeaderMedium.js +0 -28
  77. package/lib/module/components/HeaderOverline.js +0 -29
  78. package/lib/typescript/src/components/CardBlock.d.ts +0 -21
  79. package/lib/typescript/src/components/CardBlock.d.ts.map +0 -1
  80. package/lib/typescript/src/components/CardContainer.d.ts +0 -23
  81. package/lib/typescript/src/components/CardContainer.d.ts.map +0 -1
  82. package/lib/typescript/src/components/CardContainerRating.d.ts +0 -24
  83. package/lib/typescript/src/components/CardContainerRating.d.ts.map +0 -1
  84. package/lib/typescript/src/components/CardContainerShortImage.d.ts +0 -19
  85. package/lib/typescript/src/components/CardContainerShortImage.d.ts.map +0 -1
  86. package/lib/typescript/src/components/CardInline.d.ts +0 -20
  87. package/lib/typescript/src/components/CardInline.d.ts.map +0 -1
  88. package/lib/typescript/src/components/Carousel.d.ts +0 -15
  89. package/lib/typescript/src/components/Carousel.d.ts.map +0 -1
  90. package/lib/typescript/src/components/Header.d.ts +0 -20
  91. package/lib/typescript/src/components/Header.d.ts.map +0 -1
  92. package/lib/typescript/src/components/HeaderLarge.d.ts +0 -17
  93. package/lib/typescript/src/components/HeaderLarge.d.ts.map +0 -1
  94. package/lib/typescript/src/components/HeaderMedium.d.ts +0 -17
  95. package/lib/typescript/src/components/HeaderMedium.d.ts.map +0 -1
  96. package/lib/typescript/src/components/HeaderOverline.d.ts +0 -17
  97. package/lib/typescript/src/components/HeaderOverline.d.ts.map +0 -1
  98. package/src/Provider.js +0 -9
  99. package/src/components/Accordion/AccordionGroup.js +0 -44
  100. package/src/components/Accordion/AccordionItem.js +0 -32
  101. package/src/components/Accordion/index.js +0 -2
  102. package/src/components/ActionSheet/ActionSheet.js +0 -45
  103. package/src/components/ActionSheet/ActionSheetCancel.js +0 -6
  104. package/src/components/ActionSheet/ActionSheetItem.js +0 -30
  105. package/src/components/ActionSheet/index.js +0 -3
  106. package/src/components/AnimatedCircularProgress.js +0 -43
  107. package/src/components/AspectRatio.js +0 -18
  108. package/src/components/AvatarEdit.js +0 -30
  109. package/src/components/Banner.js +0 -109
  110. package/src/components/Button.js +0 -114
  111. package/src/components/Card.js +0 -57
  112. package/src/components/CardBlock.js +0 -54
  113. package/src/components/CardBlock.tsx +0 -127
  114. package/src/components/CardContainer.js +0 -69
  115. package/src/components/CardContainer.tsx +0 -165
  116. package/src/components/CardContainerRating.js +0 -79
  117. package/src/components/CardContainerRating.tsx +0 -175
  118. package/src/components/CardContainerShortImage.js +0 -33
  119. package/src/components/CardContainerShortImage.tsx +0 -101
  120. package/src/components/CardInline.js +0 -36
  121. package/src/components/CardInline.tsx +0 -93
  122. package/src/components/Carousel.js +0 -68
  123. package/src/components/Carousel.tsx +0 -134
  124. package/src/components/Checkbox/Checkbox.js +0 -62
  125. package/src/components/Checkbox/CheckboxGroup.js +0 -21
  126. package/src/components/Checkbox/CheckboxGroupRow.js +0 -76
  127. package/src/components/Checkbox/CheckboxRow.js +0 -77
  128. package/src/components/Checkbox/context.js +0 -14
  129. package/src/components/Checkbox/index.js +0 -3
  130. package/src/components/CircleImage.js +0 -8
  131. package/src/components/CircularProgress.js +0 -81
  132. package/src/components/Config.js +0 -64
  133. package/src/components/Container.js +0 -43
  134. package/src/components/DatePicker/DatePicker.js +0 -377
  135. package/src/components/DatePicker/DatePickerComponent.js +0 -13
  136. package/src/components/DatePicker/DatePickerComponent.web.js +0 -30
  137. package/src/components/DatePicker/DatePickerComponentType.js +0 -1
  138. package/src/components/DeprecatedButton.js +0 -83
  139. package/src/components/DeprecatedCardWrapper.js +0 -18
  140. package/src/components/DeprecatedFAB.js +0 -114
  141. package/src/components/Divider.js +0 -13
  142. package/src/components/Elevation.js +0 -20
  143. package/src/components/FAB.js +0 -46
  144. package/src/components/FieldSearchBarFull.js +0 -53
  145. package/src/components/FormRow.js +0 -19
  146. package/src/components/Header.js +0 -44
  147. package/src/components/Header.tsx +0 -105
  148. package/src/components/HeaderLarge.js +0 -7
  149. package/src/components/HeaderLarge.tsx +0 -40
  150. package/src/components/HeaderMedium.js +0 -7
  151. package/src/components/HeaderMedium.tsx +0 -41
  152. package/src/components/HeaderOverline.js +0 -7
  153. package/src/components/HeaderOverline.tsx +0 -42
  154. package/src/components/IconButton.js +0 -35
  155. package/src/components/Image.js +0 -47
  156. package/src/components/Justification.js +0 -1
  157. package/src/components/Layout.js +0 -50
  158. package/src/components/NumberInput.js +0 -49
  159. package/src/components/Picker/Picker.js +0 -267
  160. package/src/components/Picker/PickerComponent.android.js +0 -69
  161. package/src/components/Picker/PickerComponent.ios.js +0 -79
  162. package/src/components/Picker/PickerComponent.web.js +0 -70
  163. package/src/components/Picker/PickerTypes.js +0 -1
  164. package/src/components/Portal/Portal.js +0 -35
  165. package/src/components/Portal/PortalConsumer.js +0 -27
  166. package/src/components/Portal/PortalHost.js +0 -107
  167. package/src/components/Portal/PortalManager.js +0 -32
  168. package/src/components/Pressable.js +0 -12
  169. package/src/components/ProgressBar.js +0 -118
  170. package/src/components/ProgressCircle.js +0 -13
  171. package/src/components/ProgressIndicator.js +0 -27
  172. package/src/components/RadioButton/RadioButton.js +0 -17
  173. package/src/components/RadioButton/RadioButtonFieldGroup.js +0 -17
  174. package/src/components/RadioButton/RadioButtonGroup.js +0 -43
  175. package/src/components/RadioButton/RadioButtonRow.js +0 -76
  176. package/src/components/RadioButton/context.js +0 -14
  177. package/src/components/RadioButton/index.js +0 -4
  178. package/src/components/ResizeMode.js +0 -1
  179. package/src/components/Row.js +0 -48
  180. package/src/components/RowBodyIcon.js +0 -8
  181. package/src/components/RowHeadlineImageCaption.js +0 -12
  182. package/src/components/RowHeadlineImageIcon.js +0 -14
  183. package/src/components/SVG.js +0 -13
  184. package/src/components/ScreenContainer.js +0 -34
  185. package/src/components/Slider.js +0 -63
  186. package/src/components/StarRating.js +0 -50
  187. package/src/components/StepIndicator.js +0 -346
  188. package/src/components/Stepper.js +0 -41
  189. package/src/components/Surface.js +0 -32
  190. package/src/components/Swiper/Swiper.js +0 -29
  191. package/src/components/Swiper/SwiperItem.js +0 -9
  192. package/src/components/Swiper/index.js +0 -2
  193. package/src/components/Switch.js +0 -56
  194. package/src/components/Text.js +0 -33
  195. package/src/components/TextField.js +0 -428
  196. package/src/components/ToggleButton.js +0 -39
  197. package/src/components/Touchable.js +0 -12
  198. package/src/components/Touchable.web.js +0 -2
  199. package/src/components/Typography.js +0 -36
  200. package/src/components/useAuthState.js +0 -31
  201. package/src/constants.js +0 -10
  202. package/src/hooks.js +0 -12
  203. package/src/index.js +0 -53
  204. package/src/interfaces/Icon.js +0 -8
  205. package/src/mappings/Accordion.js +0 -41
  206. package/src/mappings/AccordionItem.js +0 -16
  207. package/src/mappings/ActionSheet.js +0 -13
  208. package/src/mappings/ActionSheetCancel.js +0 -19
  209. package/src/mappings/ActionSheetItem.js +0 -23
  210. package/src/mappings/ActivityIndicator.js +0 -58
  211. package/src/mappings/AudioPlayer.js +0 -57
  212. package/src/mappings/AvatarEdit.js +0 -38
  213. package/src/mappings/Banner.js +0 -32
  214. package/src/mappings/BlurView.js +0 -42
  215. package/src/mappings/Button.js +0 -116
  216. package/src/mappings/Card.js +0 -52
  217. package/src/mappings/CardBlock.js +0 -123
  218. package/src/mappings/CardContainer.js +0 -104
  219. package/src/mappings/CardContainerRating.js +0 -126
  220. package/src/mappings/CardContainerShortImage.js +0 -120
  221. package/src/mappings/CardInline.js +0 -52
  222. package/src/mappings/Carousel.js +0 -19
  223. package/src/mappings/Checkbox.js +0 -46
  224. package/src/mappings/CheckboxGroup.js +0 -26
  225. package/src/mappings/CheckboxRow.js +0 -61
  226. package/src/mappings/CircleImage.js +0 -25
  227. package/src/mappings/Container.js +0 -30
  228. package/src/mappings/CustomCode.js +0 -8
  229. package/src/mappings/DatePicker.js +0 -176
  230. package/src/mappings/Divider.js +0 -27
  231. package/src/mappings/FAB.js +0 -37
  232. package/src/mappings/Fetch.js +0 -13
  233. package/src/mappings/FieldSearchBarFull.js +0 -50
  234. package/src/mappings/FlashList.js +0 -85
  235. package/src/mappings/FlatList.js +0 -37
  236. package/src/mappings/HeaderLarge.js +0 -29
  237. package/src/mappings/HeaderMedium.js +0 -55
  238. package/src/mappings/HeaderOverline.js +0 -55
  239. package/src/mappings/Icon.js +0 -32
  240. package/src/mappings/IconButton.js +0 -35
  241. package/src/mappings/Image.js +0 -35
  242. package/src/mappings/ImageBackground.js +0 -29
  243. package/src/mappings/KeyboardAvoidingView.js +0 -41
  244. package/src/mappings/KeyboardAwareScrollView.js +0 -50
  245. package/src/mappings/Layout.js +0 -200
  246. package/src/mappings/LinearGradient.js +0 -77
  247. package/src/mappings/MapCallout.js +0 -21
  248. package/src/mappings/MapMarker.js +0 -47
  249. package/src/mappings/MapView.js +0 -139
  250. package/src/mappings/Modal.js +0 -42
  251. package/src/mappings/NumberInput.js +0 -254
  252. package/src/mappings/Picker.js +0 -148
  253. package/src/mappings/ProgressBar.js +0 -101
  254. package/src/mappings/ProgressCircle.js +0 -109
  255. package/src/mappings/ProgressIndicator.js +0 -181
  256. package/src/mappings/RadioButton.js +0 -51
  257. package/src/mappings/RadioButtonGroup.js +0 -17
  258. package/src/mappings/RadioButtonRow.js +0 -42
  259. package/src/mappings/RowBodyIcon.js +0 -75
  260. package/src/mappings/RowHeadlineImageCaption.js +0 -167
  261. package/src/mappings/RowHeadlineImageIcon.js +0 -99
  262. package/src/mappings/SVG.js +0 -20
  263. package/src/mappings/SafeAreaView.js +0 -33
  264. package/src/mappings/ScrollView.js +0 -31
  265. package/src/mappings/Slider.js +0 -60
  266. package/src/mappings/StarRating.js +0 -43
  267. package/src/mappings/Stepper.js +0 -32
  268. package/src/mappings/Surface.js +0 -14
  269. package/src/mappings/Swiper.js +0 -62
  270. package/src/mappings/SwiperItem.js +0 -8
  271. package/src/mappings/Switch.js +0 -81
  272. package/src/mappings/Text.js +0 -251
  273. package/src/mappings/TextArea.js +0 -274
  274. package/src/mappings/TextField.js +0 -391
  275. package/src/mappings/TextInput.js +0 -402
  276. package/src/mappings/ToggleButton.js +0 -50
  277. package/src/mappings/Touchable.js +0 -60
  278. package/src/mappings/Video.js +0 -81
  279. package/src/mappings/View.js +0 -207
  280. package/src/mappings/WebView.js +0 -88
  281. package/src/styles/DarkTheme.js +0 -26
  282. package/src/styles/DefaultTheme.js +0 -111
  283. package/src/styles/fonts.js +0 -62
  284. package/src/styles/overlay.js +0 -60
  285. package/src/styles/shadow.js +0 -51
  286. package/src/theming.js +0 -3
  287. package/src/utilities.js +0 -102
@@ -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);
@@ -1,175 +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 StarRating from "./StarRating";
14
- import { withTheme } from "../theming";
15
- import type { Theme } from "../styles/DefaultTheme";
16
- import type { IconSlot } from "../interfaces/Icon";
17
-
18
- import Config from "./Config";
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
- rating: number;
31
- aspectRatio?: number;
32
- elevation?: number;
33
- numColumns?: number;
34
- theme: Theme;
35
- style?: StyleProp<ViewStyle>;
36
- onPress: () => void;
37
- } & IconSlot;
38
-
39
- const CardContainerRating: React.FC<React.PropsWithChildren<Props>> = ({
40
- Icon,
41
- icon,
42
- image = Config.cardImageUrl,
43
- title,
44
- leftDescription,
45
- rightDescription,
46
- rating,
47
- aspectRatio = 1.5,
48
- elevation = 2,
49
- numColumns = 3,
50
- theme: { colors, roundness, typography },
51
- style,
52
- onPress,
53
- ...rest
54
- }) => {
55
- let titleStyle, rightDescriptionStyle;
56
- switch (numColumns) {
57
- case 2:
58
- titleStyle = typography.headline6;
59
- rightDescriptionStyle = typography.body2;
60
- break;
61
- case 3:
62
- titleStyle = typography.headline5;
63
- rightDescriptionStyle = typography.caption;
64
- break;
65
- }
66
-
67
- return (
68
- <Card style={style} onPress={onPress} numColumns={numColumns} {...rest}>
69
- <Elevation style={{ elevation, borderRadius: roundness }}>
70
- <View
71
- style={{
72
- borderRadius: roundness,
73
- overflow: "hidden",
74
- backgroundColor: colors.background,
75
- //background color is needed for bug on android 9 - https://github.com/facebook/react-native/issues/25093
76
- }}
77
- >
78
- <Image
79
- style={{ aspectRatio }}
80
- source={typeof image === "string" ? { uri: image } : image}
81
- resizeMode="cover"
82
- />
83
- <View
84
- style={{
85
- padding: numColumns === 1 ? 8 : 16,
86
- }}
87
- >
88
- {title ? (
89
- <View
90
- style={{
91
- flexDirection: "row",
92
- alignItems: "center",
93
- justifyContent: "space-between",
94
- }}
95
- >
96
- <Text
97
- numberOfLines={1}
98
- style={[titleStyle, { color: colors.strong }]}
99
- >
100
- {title}
101
- </Text>
102
- </View>
103
- ) : null}
104
- {leftDescription ? (
105
- <Text
106
- numberOfLines={1}
107
- style={[
108
- typography.body2,
109
- {
110
- color: colors.medium,
111
- marginTop: numColumns === 3 ? 4 : 4 / 2,
112
- },
113
- ]}
114
- >
115
- {leftDescription}
116
- </Text>
117
- ) : null}
118
- <View
119
- style={{
120
- flexDirection: "row",
121
- justifyContent: "space-between",
122
- alignItems: "center",
123
- marginTop: numColumns === 3 ? 16 : 12,
124
- }}
125
- >
126
- <StarRating
127
- Icon={Icon}
128
- starSize={numColumns === 1 ? 10 : 16}
129
- rating={rating}
130
- />
131
- <Text
132
- style={[
133
- rightDescriptionStyle,
134
- {
135
- color: colors.medium,
136
- marginLeft: 8,
137
- },
138
- ]}
139
- numberOfLines={1}
140
- >
141
- {rightDescription}
142
- </Text>
143
- </View>
144
- </View>
145
- {icon ? (
146
- <Elevation
147
- style={{
148
- elevation: Config.cardIconElevation,
149
- position: "absolute",
150
- top: 12,
151
- right: 12,
152
- width: ICON_CONTAINER_SIZE,
153
- height: ICON_CONTAINER_SIZE,
154
- padding: ICON_CONTAINER_PADDING,
155
- borderRadius: ICON_CONTAINER_SIZE,
156
- backgroundColor: color(colors.strong)
157
- .alpha(Config.cardIconBackgroundOpacity)
158
- .rgb()
159
- .string(),
160
- }}
161
- >
162
- <Icon
163
- name={icon}
164
- size={Config.cardIconSize}
165
- color={colors.surface}
166
- />
167
- </Elevation>
168
- ) : null}
169
- </View>
170
- </Elevation>
171
- </Card>
172
- );
173
- };
174
-
175
- export default withTheme(CardContainerRating);
@@ -1,33 +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 CardContainerShortImage = ({ image = Config.squareImageUrl, title, subtitle, mode = "left", aspectRatio = 1, elevation = 2, theme: { colors, roundness, typography }, style, onPress, ...rest }) => {
9
- return (React.createElement(Card, { style: style, onPress: onPress, ...rest },
10
- React.createElement(Elevation, { style: {
11
- elevation,
12
- borderRadius: roundness,
13
- } },
14
- React.createElement(View, { style: {
15
- overflow: "hidden",
16
- flexDirection: "row",
17
- justifyContent: mode === "right" ? "space-between" : "flex-start",
18
- borderRadius: roundness,
19
- } },
20
- mode === "left" && (React.createElement(Image, { style: { aspectRatio }, source: typeof image === "string" ? { uri: image } : image, resizeMode: "cover" })),
21
- React.createElement(View, { style: {
22
- padding: 16,
23
- backgroundColor: colors.surface,
24
- flex: 1,
25
- } },
26
- React.createElement(Text, { numberOfLines: 1, style: [typography.headline5, { color: colors.strong }] }, title),
27
- subtitle ? (React.createElement(Text, { numberOfLines: 1, style: [
28
- typography.body2,
29
- { color: colors.medium, marginTop: 4 },
30
- ] }, subtitle)) : null),
31
- mode === "right" && (React.createElement(Image, { style: { aspectRatio }, source: typeof image === "string" ? { uri: image } : image, resizeMode: "cover" }))))));
32
- };
33
- export default withTheme(CardContainerShortImage);