@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,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);
@@ -1,101 +0,0 @@
1
- import React from "react";
2
- import {
3
- View,
4
- Text,
5
- ImageSourcePropType,
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
-
16
- type Props = {
17
- image?: string | ImageSourcePropType;
18
- title?: string;
19
- subtitle?: string;
20
- mode?: "right" | "left";
21
- aspectRatio?: number;
22
- elevation?: number;
23
- theme: typeof theme;
24
- style?: StyleProp<ViewStyle>;
25
- onPress: () => void;
26
- };
27
-
28
- const CardContainerShortImage: React.FC<React.PropsWithChildren<Props>> = ({
29
- image = Config.squareImageUrl,
30
- title,
31
- subtitle,
32
- mode = "left",
33
- aspectRatio = 1,
34
- elevation = 2,
35
- theme: { colors, roundness, typography },
36
- style,
37
- onPress,
38
- ...rest
39
- }) => {
40
- return (
41
- <Card style={style} onPress={onPress} {...rest}>
42
- <Elevation
43
- style={{
44
- elevation,
45
- borderRadius: roundness,
46
- }}
47
- >
48
- <View
49
- style={{
50
- overflow: "hidden",
51
- flexDirection: "row",
52
- justifyContent: mode === "right" ? "space-between" : "flex-start",
53
- borderRadius: roundness,
54
- }}
55
- >
56
- {mode === "left" && (
57
- <Image
58
- style={{ aspectRatio }}
59
- source={typeof image === "string" ? { uri: image } : image}
60
- resizeMode="cover"
61
- />
62
- )}
63
- <View
64
- style={{
65
- padding: 16,
66
- backgroundColor: colors.surface,
67
- flex: 1,
68
- }}
69
- >
70
- <Text
71
- numberOfLines={1}
72
- style={[typography.headline5, { color: colors.strong }]}
73
- >
74
- {title}
75
- </Text>
76
- {subtitle ? (
77
- <Text
78
- numberOfLines={1}
79
- style={[
80
- typography.body2,
81
- { color: colors.medium, marginTop: 4 },
82
- ]}
83
- >
84
- {subtitle}
85
- </Text>
86
- ) : null}
87
- </View>
88
- {mode === "right" && (
89
- <Image
90
- style={{ aspectRatio }}
91
- source={typeof image === "string" ? { uri: image } : image}
92
- resizeMode="cover"
93
- />
94
- )}
95
- </View>
96
- </Elevation>
97
- </Card>
98
- );
99
- };
100
-
101
- export default withTheme(CardContainerShortImage);
@@ -1,36 +0,0 @@
1
- // @ts-nocheck
2
- import React from "react";
3
- import { Pressable, View, StyleSheet, } from "react-native";
4
- import { Title, Subtitle } from "./Typography";
5
- import Image from "./Image";
6
- import Surface from "./Surface";
7
- import Config from "./Config";
8
- import { withTheme } from "../theming";
9
- const CardInline = ({ image = Config.cardImageUrl, title, subtitle, aspectRatio = 1.5, elevation = 2, style, titleStyle, subtitleStyle, onPress, }) => {
10
- const { alignItems, justifyContent, width, height } = StyleSheet.flatten(style || {});
11
- const imageStyles = width && height ? { width, height } : { aspectRatio };
12
- return (React.createElement(Surface, { style: [{ elevation }, style] },
13
- React.createElement(Pressable, { disabled: !onPress, onPress: onPress, style: ({ pressed }) => {
14
- return [
15
- {
16
- opacity: pressed ? 0.8 : 1,
17
- },
18
- ];
19
- } },
20
- React.createElement(Image, { style: imageStyles, source: typeof image === "string" ? { uri: image } : image, resizeMode: "cover" }),
21
- React.createElement(View, { style: [styles.overlay, { justifyContent, alignItems }] },
22
- title ? (React.createElement(Title, { style: [{ color: "white" }, titleStyle], text: title })) : null,
23
- subtitle ? (React.createElement(Subtitle, { style: [{ color: "rgba(255, 255, 255, 0.7)" }, subtitleStyle], text: subtitle })) : null))));
24
- };
25
- const styles = StyleSheet.create({
26
- overlay: {
27
- position: "absolute",
28
- top: 0,
29
- bottom: 0,
30
- left: 0,
31
- right: 0,
32
- padding: 16,
33
- backgroundColor: "rgba(0, 0, 0, 0.2)",
34
- },
35
- });
36
- export default withTheme(CardInline);
@@ -1,93 +0,0 @@
1
- // @ts-nocheck
2
- import React from "react";
3
- import {
4
- Pressable,
5
- View,
6
- ImageSourcePropType,
7
- StyleProp,
8
- ViewStyle,
9
- TextStyle,
10
- StyleSheet,
11
- } from "react-native";
12
- import { Title, Subtitle } from "./Typography";
13
- import Image from "./Image";
14
- import Surface from "./Surface";
15
- import Config from "./Config";
16
- import { withTheme } from "../theming";
17
- import theme from "../styles/DefaultTheme";
18
-
19
- type Props = {
20
- image?: string | ImageSourcePropType;
21
- title?: string;
22
- subtitle?: string;
23
- aspectRatio?: number;
24
- elevation?: number;
25
- theme: typeof theme;
26
- style?: StyleProp<ViewStyle>;
27
- titleStyle?: StyleProp<TextStyle>;
28
- subtitleStyle?: StyleProp<TextStyle>;
29
- onPress: () => void;
30
- };
31
-
32
- const CardInline: React.FC<React.PropsWithChildren<Props>> = ({
33
- image = Config.cardImageUrl,
34
- title,
35
- subtitle,
36
- aspectRatio = 1.5,
37
- elevation = 2,
38
- style,
39
- titleStyle,
40
- subtitleStyle,
41
- onPress,
42
- }) => {
43
- const { alignItems, justifyContent, width, height } = StyleSheet.flatten(
44
- style || {}
45
- );
46
- const imageStyles = width && height ? { width, height } : { aspectRatio };
47
- return (
48
- <Surface style={[{ elevation }, style]}>
49
- <Pressable
50
- disabled={!onPress}
51
- onPress={onPress}
52
- style={({ pressed }) => {
53
- return [
54
- {
55
- opacity: pressed ? 0.8 : 1,
56
- },
57
- ];
58
- }}
59
- >
60
- <Image
61
- style={imageStyles}
62
- source={typeof image === "string" ? { uri: image } : image}
63
- resizeMode="cover"
64
- />
65
- <View style={[styles.overlay, { justifyContent, alignItems }]}>
66
- {title ? (
67
- <Title style={[{ color: "white" }, titleStyle]} text={title} />
68
- ) : null}
69
- {subtitle ? (
70
- <Subtitle
71
- style={[{ color: "rgba(255, 255, 255, 0.7)" }, subtitleStyle]}
72
- text={subtitle}
73
- />
74
- ) : null}
75
- </View>
76
- </Pressable>
77
- </Surface>
78
- );
79
- };
80
-
81
- const styles = StyleSheet.create({
82
- overlay: {
83
- position: "absolute",
84
- top: 0,
85
- bottom: 0,
86
- left: 0,
87
- right: 0,
88
- padding: 16,
89
- backgroundColor: "rgba(0, 0, 0, 0.2)",
90
- },
91
- });
92
-
93
- export default withTheme(CardInline);
@@ -1,68 +0,0 @@
1
- import * as React from "react";
2
- import { withTheme } from "../theming";
3
- import { ScrollView, View, StyleSheet, Dimensions, } from "react-native";
4
- import Image from "./Image";
5
- const screenWidth = Dimensions.get("window").width;
6
- function Pager({ color, index, length, }) {
7
- return (React.createElement(View, { style: styles.pager }, Array.from({ length }).map((_, i) => {
8
- const current = index === i;
9
- const opacity = current ? 1 : 0.5;
10
- const size = current ? 10 : 8;
11
- return (React.createElement(View, { key: i, style: [
12
- styles.bullet,
13
- { backgroundColor: color, opacity, width: size, height: size },
14
- ] }));
15
- })));
16
- }
17
- function Carousel({ data, children, dotColor = "strong", style, ...rest }) {
18
- var _a;
19
- const [index, setIndex] = React.useState(0);
20
- const length = React.Children.count(children);
21
- const itemsLength = ((_a = data === null || data === void 0 ? void 0 : data.length) !== null && _a !== void 0 ? _a : 0) + length;
22
- const slides = Array.isArray(data) ? data : [];
23
- const { width, height } = StyleSheet.flatten(style || {});
24
- const slideWidth = width || screenWidth;
25
- const slideHeight = height || 250;
26
- return (React.createElement(View, { style: [styles.container, style], ...rest },
27
- React.createElement(ScrollView, { pagingEnabled: true, horizontal: true, decelerationRate: "fast", scrollEventThrottle: 200, showsHorizontalScrollIndicator: false, onScroll: ({ nativeEvent }) => {
28
- const layoutWidth = nativeEvent.layoutMeasurement.width;
29
- const offset = nativeEvent.contentOffset.x;
30
- const currentIndex = Math.ceil(offset / layoutWidth);
31
- setIndex(currentIndex);
32
- } },
33
- slides.length > 0
34
- ? slides.map((item, i) => {
35
- return (React.createElement(Image, { key: i, resizeMode: "cover", source: typeof item === "string" ? { uri: item } : item, style: [{ width: slideWidth, height: slideHeight }] }));
36
- })
37
- : null,
38
- React.Children.map(children, (child) => {
39
- var _a;
40
- const s = ((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.style) || {};
41
- return (React.createElement(View, { style: { width: slideWidth } }, React.cloneElement(child, {
42
- style: { ...s, width: slideWidth },
43
- })));
44
- })),
45
- React.createElement(Pager, { color: dotColor, index: index, length: itemsLength })));
46
- }
47
- const styles = StyleSheet.create({
48
- container: {
49
- backgroundColor: "#eee",
50
- },
51
- pager: {
52
- position: "absolute",
53
- bottom: 12,
54
- left: 0,
55
- right: 0,
56
- flexDirection: "row",
57
- justifyContent: "center",
58
- alignItems: "center",
59
- },
60
- bullet: {
61
- marginHorizontal: 2,
62
- width: 10,
63
- height: 10,
64
- borderRadius: 20,
65
- backgroundColor: "#000",
66
- },
67
- });
68
- export default withTheme(Carousel);
@@ -1,134 +0,0 @@
1
- import * as React from "react";
2
- import { withTheme } from "../theming";
3
- import {
4
- ScrollView,
5
- View,
6
- StyleSheet,
7
- Dimensions,
8
- StyleProp,
9
- ViewStyle,
10
- } from "react-native";
11
- import Image from "./Image";
12
-
13
- const screenWidth = Dimensions.get("window").width;
14
-
15
- type Props = {
16
- data?: any[];
17
- children?: React.ReactNode;
18
- style?: StyleProp<ViewStyle>;
19
- dotColor?: string;
20
- theme: any;
21
- };
22
-
23
- function Pager({
24
- color,
25
- index,
26
- length,
27
- }: {
28
- color: string;
29
- index: number;
30
- length: number;
31
- }) {
32
- return (
33
- <View style={styles.pager}>
34
- {Array.from({ length }).map((_, i) => {
35
- const current = index === i;
36
- const opacity = current ? 1 : 0.5;
37
- const size = current ? 10 : 8;
38
- return (
39
- <View
40
- key={i}
41
- style={[
42
- styles.bullet,
43
- { backgroundColor: color, opacity, width: size, height: size },
44
- ]}
45
- />
46
- );
47
- })}
48
- </View>
49
- );
50
- }
51
-
52
- function Carousel({
53
- data,
54
- children,
55
- dotColor = "strong",
56
- style,
57
- ...rest
58
- }: React.PropsWithChildren<Props>) {
59
- const [index, setIndex] = React.useState(0);
60
-
61
- const length = React.Children.count(children);
62
- const itemsLength = (data?.length ?? 0) + length;
63
- const slides = Array.isArray(data) ? data : [];
64
-
65
- const { width, height } = StyleSheet.flatten(style || {});
66
- const slideWidth = width || screenWidth;
67
- const slideHeight = height || 250;
68
-
69
- return (
70
- <View style={[styles.container, style]} {...rest}>
71
- <ScrollView
72
- pagingEnabled
73
- horizontal
74
- decelerationRate="fast"
75
- scrollEventThrottle={200}
76
- showsHorizontalScrollIndicator={false}
77
- onScroll={({ nativeEvent }) => {
78
- const layoutWidth = nativeEvent.layoutMeasurement.width;
79
- const offset = nativeEvent.contentOffset.x;
80
- const currentIndex = Math.ceil(offset / layoutWidth);
81
- setIndex(currentIndex);
82
- }}
83
- >
84
- {slides.length > 0
85
- ? slides.map((item, i) => {
86
- return (
87
- <Image
88
- key={i}
89
- resizeMode="cover"
90
- source={typeof item === "string" ? { uri: item } : item}
91
- style={[{ width: slideWidth, height: slideHeight }]}
92
- />
93
- );
94
- })
95
- : null}
96
- {React.Children.map(children, (child: any) => {
97
- const s = child?.props?.style || {};
98
- return (
99
- <View style={{ width: slideWidth }}>
100
- {React.cloneElement(child, {
101
- style: { ...s, width: slideWidth },
102
- })}
103
- </View>
104
- );
105
- })}
106
- </ScrollView>
107
- <Pager color={dotColor} index={index} length={itemsLength} />
108
- </View>
109
- );
110
- }
111
-
112
- const styles = StyleSheet.create({
113
- container: {
114
- backgroundColor: "#eee",
115
- },
116
- pager: {
117
- position: "absolute",
118
- bottom: 12,
119
- left: 0,
120
- right: 0,
121
- flexDirection: "row",
122
- justifyContent: "center",
123
- alignItems: "center",
124
- },
125
- bullet: {
126
- marginHorizontal: 2,
127
- width: 10,
128
- height: 10,
129
- borderRadius: 20,
130
- backgroundColor: "#000",
131
- },
132
- });
133
-
134
- export default withTheme(Carousel);