@draftbit/core 46.0.1-eb73d2.0 → 46.0.2

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 (247) hide show
  1. package/lib/commonjs/components/Carousel.js +1 -3
  2. package/lib/commonjs/components/Carousel.js.map +1 -1
  3. package/lib/commonjs/components/Checkbox/Checkbox.js.map +1 -1
  4. package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js +3 -3
  5. package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js.map +1 -1
  6. package/lib/commonjs/components/DeprecatedButton.js +4 -20
  7. package/lib/commonjs/components/DeprecatedButton.js.map +1 -1
  8. package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -14
  9. package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
  10. package/lib/commonjs/components/Justification.js +0 -3
  11. package/lib/commonjs/components/Picker/Picker.js +3 -3
  12. package/lib/commonjs/components/Picker/Picker.js.map +1 -1
  13. package/lib/commonjs/components/Picker/PickerComponent.android.js +2 -2
  14. package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -1
  15. package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
  16. package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +1 -1
  17. package/lib/commonjs/components/Picker/PickerComponent.web.js +2 -2
  18. package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -1
  19. package/lib/commonjs/components/RadioButton/RadioButton.js +1 -1
  20. package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
  21. package/lib/commonjs/components/RadioButton/RadioButtonRow.js +1 -1
  22. package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
  23. package/lib/commonjs/components/ResizeMode.js +0 -3
  24. package/lib/commonjs/components/Stepper.js +1 -1
  25. package/lib/commonjs/components/Stepper.js.map +1 -1
  26. package/lib/commonjs/mappings/KeyboardAvoidingView.js +2 -2
  27. package/lib/commonjs/mappings/KeyboardAvoidingView.js.map +1 -1
  28. package/lib/commonjs/mappings/RadioButtonGroup.js.map +1 -1
  29. package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
  30. package/lib/module/components/Button.js +11 -32
  31. package/lib/module/components/Button.js.map +1 -1
  32. package/lib/module/components/Card.js.map +1 -1
  33. package/lib/module/components/Carousel.js +1 -3
  34. package/lib/module/components/Carousel.js.map +1 -1
  35. package/lib/module/components/Checkbox/Checkbox.js.map +1 -1
  36. package/lib/module/components/Checkbox/index.js.map +1 -1
  37. package/lib/module/components/CircleImage.js +2 -16
  38. package/lib/module/components/CircleImage.js.map +1 -1
  39. package/lib/module/components/DatePicker/DatePickerComponent.web.js +3 -3
  40. package/lib/module/components/DatePicker/DatePickerComponent.web.js.map +1 -1
  41. package/lib/module/components/DatePicker/DatePickerComponentType.js.map +1 -1
  42. package/lib/module/components/DeprecatedFAB.js +4 -20
  43. package/lib/module/components/DeprecatedFAB.js.map +1 -1
  44. package/lib/module/components/Justification.js +1 -1
  45. package/lib/module/components/NumberInput.js +2 -13
  46. package/lib/module/components/NumberInput.js.map +1 -1
  47. package/lib/module/components/Picker/Picker.js +3 -3
  48. package/lib/module/components/Picker/Picker.js.map +1 -1
  49. package/lib/module/components/Picker/PickerComponent.android.js +2 -2
  50. package/lib/module/components/Picker/PickerComponent.android.js.map +1 -1
  51. package/lib/module/components/Picker/PickerComponent.ios.js +2 -2
  52. package/lib/module/components/Picker/PickerComponent.ios.js.map +1 -1
  53. package/lib/module/components/Picker/PickerComponent.web.js +2 -2
  54. package/lib/module/components/Picker/PickerComponent.web.js.map +1 -1
  55. package/lib/module/components/Portal/PortalManager.js +1 -1
  56. package/lib/module/components/Portal/PortalManager.js.map +1 -1
  57. package/lib/module/components/RadioButton/RadioButton.js +1 -1
  58. package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
  59. package/lib/module/components/RadioButton/RadioButtonGroup.js +4 -16
  60. package/lib/module/components/RadioButton/RadioButtonGroup.js.map +1 -1
  61. package/lib/module/components/RadioButton/RadioButtonRow.js +7 -24
  62. package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
  63. package/lib/module/components/ResizeMode.js +1 -1
  64. package/lib/module/components/ScreenContainer.js +5 -21
  65. package/lib/module/components/ScreenContainer.js.map +1 -1
  66. package/lib/module/components/Stepper.js +1 -1
  67. package/lib/module/components/Stepper.js.map +1 -1
  68. package/lib/module/mappings/KeyboardAvoidingView.js +2 -2
  69. package/lib/module/mappings/KeyboardAvoidingView.js.map +1 -1
  70. package/package.json +2 -2
  71. package/src/components/Checkbox/Checkbox.tsx +76 -77
  72. package/src/mappings/KeyboardAvoidingView.ts +2 -2
  73. package/src/Provider.js +0 -9
  74. package/src/components/Accordion/AccordionGroup.js +0 -44
  75. package/src/components/Accordion/AccordionItem.js +0 -32
  76. package/src/components/Accordion/index.js +0 -2
  77. package/src/components/ActionSheet/ActionSheet.js +0 -45
  78. package/src/components/ActionSheet/ActionSheetCancel.js +0 -6
  79. package/src/components/ActionSheet/ActionSheetItem.js +0 -30
  80. package/src/components/ActionSheet/index.js +0 -3
  81. package/src/components/AnimatedCircularProgress.js +0 -43
  82. package/src/components/AspectRatio.js +0 -18
  83. package/src/components/AvatarEdit.js +0 -30
  84. package/src/components/Banner.js +0 -109
  85. package/src/components/Button.js +0 -112
  86. package/src/components/Card.js +0 -57
  87. package/src/components/CardBlock.js +0 -54
  88. package/src/components/CardContainer.js +0 -69
  89. package/src/components/CardContainerRating.js +0 -79
  90. package/src/components/CardContainerShortImage.js +0 -33
  91. package/src/components/CardInline.js +0 -36
  92. package/src/components/Carousel.js +0 -66
  93. package/src/components/Checkbox/Checkbox.js +0 -63
  94. package/src/components/Checkbox/CheckboxGroup.js +0 -21
  95. package/src/components/Checkbox/CheckboxGroupRow.js +0 -77
  96. package/src/components/Checkbox/CheckboxRow.js +0 -78
  97. package/src/components/Checkbox/context.js +0 -14
  98. package/src/components/Checkbox/index.js +0 -3
  99. package/src/components/CircleImage.js +0 -8
  100. package/src/components/CircularProgress.js +0 -78
  101. package/src/components/Config.js +0 -63
  102. package/src/components/Container.js +0 -43
  103. package/src/components/DatePicker/DatePicker.js +0 -368
  104. package/src/components/DatePicker/DatePickerComponent.js +0 -13
  105. package/src/components/DatePicker/DatePickerComponent.web.js +0 -30
  106. package/src/components/DatePicker/DatePickerComponentType.js +0 -1
  107. package/src/components/DeprecatedButton.js +0 -95
  108. package/src/components/DeprecatedCardWrapper.js +0 -18
  109. package/src/components/DeprecatedFAB.js +0 -115
  110. package/src/components/Divider.js +0 -13
  111. package/src/components/Elevation.js +0 -20
  112. package/src/components/FAB.js +0 -46
  113. package/src/components/FieldSearchBarFull.js +0 -53
  114. package/src/components/FormRow.js +0 -19
  115. package/src/components/Header.js +0 -44
  116. package/src/components/HeaderLarge.js +0 -7
  117. package/src/components/HeaderMedium.js +0 -7
  118. package/src/components/HeaderOverline.js +0 -7
  119. package/src/components/IconButton.js +0 -35
  120. package/src/components/Image.js +0 -47
  121. package/src/components/Justification.js +0 -1
  122. package/src/components/Layout.js +0 -50
  123. package/src/components/NumberInput.js +0 -49
  124. package/src/components/Picker/Picker.js +0 -266
  125. package/src/components/Picker/PickerComponent.android.js +0 -68
  126. package/src/components/Picker/PickerComponent.ios.js +0 -78
  127. package/src/components/Picker/PickerComponent.web.js +0 -69
  128. package/src/components/Picker/PickerTypes.js +0 -1
  129. package/src/components/Portal/Portal.js +0 -35
  130. package/src/components/Portal/PortalConsumer.js +0 -28
  131. package/src/components/Portal/PortalHost.js +0 -105
  132. package/src/components/Portal/PortalManager.js +0 -29
  133. package/src/components/ProgressBar.js +0 -118
  134. package/src/components/ProgressCircle.js +0 -13
  135. package/src/components/ProgressIndicator.js +0 -27
  136. package/src/components/RadioButton/RadioButton.js +0 -17
  137. package/src/components/RadioButton/RadioButtonFieldGroup.js +0 -17
  138. package/src/components/RadioButton/RadioButtonGroup.js +0 -43
  139. package/src/components/RadioButton/RadioButtonRow.js +0 -76
  140. package/src/components/RadioButton/context.js +0 -14
  141. package/src/components/RadioButton/index.js +0 -4
  142. package/src/components/ResizeMode.js +0 -1
  143. package/src/components/Row.js +0 -48
  144. package/src/components/RowBodyIcon.js +0 -8
  145. package/src/components/RowHeadlineImageCaption.js +0 -12
  146. package/src/components/RowHeadlineImageIcon.js +0 -14
  147. package/src/components/ScreenContainer.js +0 -34
  148. package/src/components/Slider.js +0 -63
  149. package/src/components/StarRating.js +0 -50
  150. package/src/components/StepIndicator.js +0 -346
  151. package/src/components/Stepper.js +0 -39
  152. package/src/components/Surface.js +0 -32
  153. package/src/components/Swiper/Swiper.js +0 -29
  154. package/src/components/Swiper/SwiperItem.js +0 -9
  155. package/src/components/Swiper/index.js +0 -2
  156. package/src/components/Switch.js +0 -56
  157. package/src/components/Text.js +0 -28
  158. package/src/components/TextField.js +0 -420
  159. package/src/components/ToggleButton.js +0 -39
  160. package/src/components/Touchable.js +0 -12
  161. package/src/components/Touchable.web.js +0 -2
  162. package/src/components/Typography.js +0 -36
  163. package/src/components/useAuthState.js +0 -31
  164. package/src/constants.js +0 -10
  165. package/src/hooks.js +0 -12
  166. package/src/index.js +0 -52
  167. package/src/interfaces/Icon.js +0 -8
  168. package/src/mappings/Accordion.js +0 -41
  169. package/src/mappings/AccordionItem.js +0 -16
  170. package/src/mappings/ActionSheet.js +0 -13
  171. package/src/mappings/ActionSheetCancel.js +0 -19
  172. package/src/mappings/ActionSheetItem.js +0 -23
  173. package/src/mappings/ActivityIndicator.js +0 -53
  174. package/src/mappings/AudioPlayer.js +0 -20
  175. package/src/mappings/AvatarEdit.js +0 -37
  176. package/src/mappings/Banner.js +0 -32
  177. package/src/mappings/BlurView.js +0 -41
  178. package/src/mappings/Button.js +0 -56
  179. package/src/mappings/Card.js +0 -52
  180. package/src/mappings/CardBlock.js +0 -122
  181. package/src/mappings/CardContainer.js +0 -102
  182. package/src/mappings/CardContainerRating.js +0 -124
  183. package/src/mappings/CardContainerShortImage.js +0 -118
  184. package/src/mappings/CardInline.js +0 -51
  185. package/src/mappings/Carousel.js +0 -18
  186. package/src/mappings/Checkbox.js +0 -45
  187. package/src/mappings/CheckboxGroup.js +0 -25
  188. package/src/mappings/CheckboxRow.js +0 -56
  189. package/src/mappings/CircleImage.js +0 -24
  190. package/src/mappings/Container.js +0 -29
  191. package/src/mappings/CustomCode.js +0 -8
  192. package/src/mappings/DatePicker.js +0 -147
  193. package/src/mappings/Divider.js +0 -26
  194. package/src/mappings/FAB.js +0 -36
  195. package/src/mappings/Fetch.js +0 -12
  196. package/src/mappings/FieldSearchBarFull.js +0 -49
  197. package/src/mappings/FlatList.js +0 -19
  198. package/src/mappings/HeaderLarge.js +0 -28
  199. package/src/mappings/HeaderMedium.js +0 -54
  200. package/src/mappings/HeaderOverline.js +0 -54
  201. package/src/mappings/Icon.js +0 -25
  202. package/src/mappings/IconButton.js +0 -30
  203. package/src/mappings/Image.js +0 -15
  204. package/src/mappings/ImageBackground.js +0 -28
  205. package/src/mappings/KeyboardAvoidingView.js +0 -40
  206. package/src/mappings/KeyboardAwareScrollView.js +0 -49
  207. package/src/mappings/Layout.js +0 -195
  208. package/src/mappings/LinearGradient.js +0 -77
  209. package/src/mappings/MapCallout.js +0 -21
  210. package/src/mappings/MapMarker.js +0 -47
  211. package/src/mappings/MapView.js +0 -138
  212. package/src/mappings/Modal.js +0 -41
  213. package/src/mappings/Picker.js +0 -139
  214. package/src/mappings/ProgressBar.js +0 -100
  215. package/src/mappings/ProgressCircle.js +0 -108
  216. package/src/mappings/ProgressIndicator.js +0 -180
  217. package/src/mappings/RadioButton.js +0 -50
  218. package/src/mappings/RadioButtonGroup.js +0 -16
  219. package/src/mappings/RadioButtonRow.js +0 -37
  220. package/src/mappings/RowBodyIcon.js +0 -75
  221. package/src/mappings/RowHeadlineImageCaption.js +0 -167
  222. package/src/mappings/RowHeadlineImageIcon.js +0 -99
  223. package/src/mappings/SafeAreaView.js +0 -33
  224. package/src/mappings/ScrollView.js +0 -30
  225. package/src/mappings/Slider.js +0 -59
  226. package/src/mappings/StarRating.js +0 -42
  227. package/src/mappings/Stepper.js +0 -28
  228. package/src/mappings/Surface.js +0 -13
  229. package/src/mappings/Swiper.js +0 -60
  230. package/src/mappings/SwiperItem.js +0 -8
  231. package/src/mappings/Switch.js +0 -75
  232. package/src/mappings/Text.js +0 -232
  233. package/src/mappings/TextArea.js +0 -52
  234. package/src/mappings/TextField.js +0 -158
  235. package/src/mappings/TextInput.js +0 -208
  236. package/src/mappings/ToggleButton.js +0 -45
  237. package/src/mappings/Touchable.js +0 -12
  238. package/src/mappings/Video.js +0 -74
  239. package/src/mappings/View.js +0 -206
  240. package/src/mappings/WebView.js +0 -18
  241. package/src/styles/DarkTheme.js +0 -26
  242. package/src/styles/DefaultTheme.js +0 -111
  243. package/src/styles/fonts.js +0 -62
  244. package/src/styles/overlay.js +0 -60
  245. package/src/styles/shadow.js +0 -51
  246. package/src/theming.js +0 -3
  247. package/src/utilities.js +0 -102
@@ -1,346 +0,0 @@
1
- // @ts-nocheck
2
- import React, { Component } from "react";
3
- import { View, Text, StyleSheet, Animated, TouchableWithoutFeedback, } from "react-native";
4
- const STEP_STATUS = {
5
- CURRENT: "current",
6
- FINISHED: "finished",
7
- UNFINISHED: "unfinished",
8
- };
9
- export default class StepIndicator extends Component {
10
- constructor(props) {
11
- super(props);
12
- const defaultStyles = {
13
- stepIndicatorSize: 30,
14
- currentStepIndicatorSize: 40,
15
- separatorStrokeWidth: 3,
16
- separatorStrokeUnfinishedWidth: 0,
17
- separatorStrokeFinishedWidth: 0,
18
- currentStepStrokeWidth: 5,
19
- stepStrokeWidth: 0,
20
- stepStrokeCurrentColor: "#4aae4f",
21
- stepStrokeFinishedColor: "#4aae4f",
22
- stepStrokeUnFinishedColor: "#4aae4f",
23
- separatorFinishedColor: "#4aae4f",
24
- separatorUnFinishedColor: "#a4d4a5",
25
- stepIndicatorFinishedColor: "#4aae4f",
26
- stepIndicatorUnFinishedColor: "#a4d4a5",
27
- stepIndicatorCurrentColor: "#ffffff",
28
- stepIndicatorLabelFontSize: 15,
29
- currentStepIndicatorLabelFontSize: 15,
30
- stepIndicatorLabelCurrentColor: "#000000",
31
- stepIndicatorLabelFinishedColor: "#ffffff",
32
- stepIndicatorLabelUnFinishedColor: "rgba(255,255,255,0.5)",
33
- labelColor: "#000000",
34
- labelSize: 13,
35
- labelAlign: "center",
36
- currentStepLabelColor: "#4aae4f",
37
- };
38
- const customStyles = Object.assign(defaultStyles, props.customStyles);
39
- this.state = {
40
- width: 0,
41
- height: 1,
42
- progressBarSize: -2,
43
- customStyles,
44
- };
45
- this.progressAnim = new Animated.Value(0);
46
- this.sizeAnim = new Animated.Value(this.state.customStyles.stepIndicatorSize);
47
- this.borderRadiusAnim = new Animated.Value(this.state.customStyles.stepIndicatorSize / 2);
48
- }
49
- stepPressed(position) {
50
- if (this.props.onPress) {
51
- this.props.onPress(position);
52
- }
53
- }
54
- render() {
55
- const { labels, direction } = this.props;
56
- return (React.createElement(View, { style: [
57
- styles.container,
58
- direction === "vertical"
59
- ? { flexDirection: "row", flex: 1 }
60
- : { flexDirection: "column" },
61
- ] },
62
- this.state.width !== 0 && this.renderProgressBarBackground(),
63
- this.state.width !== 0 && this.renderProgressBar(),
64
- this.renderStepIndicator(),
65
- labels && this.renderStepLabels()));
66
- }
67
- componentDidUpdate(prevProps) {
68
- // if (prevProps.customStyles !== this.props.customStyles) {
69
- // this.setState((state) => ({
70
- // customStyles: Object.assign(
71
- // state.customStyles,
72
- // this.props.customStyles
73
- // ),
74
- // }));
75
- // }
76
- if (prevProps.currentPosition !== this.props.currentPosition) {
77
- this.onCurrentPositionChanged(this.props.currentPosition);
78
- }
79
- }
80
- renderProgressBarBackground = () => {
81
- const { stepCount, direction } = this.props;
82
- let progressBarBackgroundStyle;
83
- if (direction === "vertical") {
84
- progressBarBackgroundStyle = {
85
- backgroundColor: this.state.customStyles.separatorUnFinishedColor,
86
- position: "absolute",
87
- left: (this.state.width - this.state.customStyles.separatorStrokeWidth) / 2,
88
- top: this.state.height / (2 * stepCount),
89
- bottom: this.state.height / (2 * stepCount),
90
- width: this.state.customStyles.separatorStrokeUnfinishedWidth === 0
91
- ? this.state.customStyles.separatorStrokeWidth
92
- : this.state.customStyles.separatorStrokeUnfinishedWidth,
93
- };
94
- }
95
- else {
96
- progressBarBackgroundStyle = {
97
- backgroundColor: this.state.customStyles.separatorUnFinishedColor,
98
- position: "absolute",
99
- top: (this.state.height - this.state.customStyles.separatorStrokeWidth) /
100
- 2,
101
- left: this.state.width / (2 * stepCount),
102
- right: this.state.width / (2 * stepCount),
103
- height: this.state.customStyles.separatorStrokeUnfinishedWidth === 0
104
- ? this.state.customStyles.separatorStrokeWidth
105
- : this.state.customStyles.separatorStrokeUnfinishedWidth,
106
- };
107
- }
108
- return (React.createElement(View, { onLayout: (event) => {
109
- if (direction === "vertical") {
110
- this.setState({ progressBarSize: event.nativeEvent.layout.height }, () => {
111
- this.onCurrentPositionChanged(this.props.currentPosition);
112
- });
113
- }
114
- else {
115
- this.setState({ progressBarSize: event.nativeEvent.layout.width }, () => {
116
- this.onCurrentPositionChanged(this.props.currentPosition);
117
- });
118
- }
119
- }, style: progressBarBackgroundStyle }));
120
- };
121
- renderProgressBar = () => {
122
- const { stepCount, direction } = this.props;
123
- let progressBarStyle;
124
- if (direction === "vertical") {
125
- progressBarStyle = {
126
- backgroundColor: this.state.customStyles.separatorFinishedColor,
127
- position: "absolute",
128
- left: (this.state.width - this.state.customStyles.separatorStrokeWidth) / 2,
129
- top: this.state.height / (2 * stepCount),
130
- bottom: this.state.height / (2 * stepCount),
131
- width: this.state.customStyles.separatorStrokeFinishedWidth === 0
132
- ? this.state.customStyles.separatorStrokeWidth
133
- : this.state.customStyles.separatorStrokeFinishedWidth,
134
- height: this.progressAnim,
135
- };
136
- }
137
- else {
138
- progressBarStyle = {
139
- backgroundColor: this.state.customStyles.separatorFinishedColor,
140
- position: "absolute",
141
- top: (this.state.height - this.state.customStyles.separatorStrokeWidth) /
142
- 2,
143
- left: this.state.width / (2 * stepCount),
144
- right: this.state.width / (2 * stepCount),
145
- height: this.state.customStyles.separatorStrokeFinishedWidth === 0
146
- ? this.state.customStyles.separatorStrokeWidth
147
- : this.state.customStyles.separatorStrokeFinishedWidth,
148
- width: this.progressAnim,
149
- };
150
- }
151
- return React.createElement(Animated.View, { style: progressBarStyle });
152
- };
153
- renderStepIndicator = () => {
154
- let steps = [];
155
- const { stepCount, direction } = this.props;
156
- for (let position = 0; position < stepCount; position++) {
157
- steps.push(React.createElement(TouchableWithoutFeedback, { key: position, onPress: () => this.stepPressed(position) },
158
- React.createElement(View, { style: [
159
- styles.stepContainer,
160
- direction === "vertical"
161
- ? { flexDirection: "column" }
162
- : { flexDirection: "row" },
163
- ] }, this.renderStep(position))));
164
- }
165
- return (React.createElement(View, { onLayout: (event) => this.setState({
166
- width: event.nativeEvent.layout.width,
167
- height: event.nativeEvent.layout.height,
168
- }), style: [
169
- styles.stepIndicatorContainer,
170
- direction === "vertical"
171
- ? {
172
- flexDirection: "column",
173
- width: this.state.customStyles.currentStepIndicatorSize,
174
- }
175
- : {
176
- flexDirection: "row",
177
- height: this.state.customStyles.currentStepIndicatorSize,
178
- },
179
- ] }, steps));
180
- };
181
- renderStepLabels = () => {
182
- const { labels, direction, currentPosition, renderLabel } = this.props;
183
- var labelViews = labels.map((label, index) => {
184
- const selectedStepLabelStyle = index === currentPosition
185
- ? { color: this.state.customStyles.currentStepLabelColor }
186
- : { color: this.state.customStyles.labelColor };
187
- return (React.createElement(TouchableWithoutFeedback, { style: styles.stepLabelItem, key: index, onPress: () => this.stepPressed(index) },
188
- React.createElement(View, { style: styles.stepLabelItem }, renderLabel ? (renderLabel({
189
- position: index,
190
- stepStatus: this.getStepStatus(index),
191
- label,
192
- currentPosition,
193
- })) : (React.createElement(Text, { style: [
194
- styles.stepLabel,
195
- selectedStepLabelStyle,
196
- {
197
- fontSize: this.state.customStyles.labelSize,
198
- fontFamily: this.state.customStyles.labelFontFamily,
199
- },
200
- ] }, label)))));
201
- });
202
- return (React.createElement(View, { style: [
203
- styles.stepLabelsContainer,
204
- direction === "vertical"
205
- ? { flexDirection: "column", paddingHorizontal: 4 }
206
- : { flexDirection: "row", paddingVertical: 4 },
207
- { alignItems: this.state.customStyles.labelAlign },
208
- ] }, labelViews));
209
- };
210
- renderStep = (position) => {
211
- const { renderStepIndicator } = this.props;
212
- let stepStyle;
213
- let indicatorLabelStyle;
214
- switch (this.getStepStatus(position)) {
215
- case STEP_STATUS.CURRENT: {
216
- stepStyle = {
217
- backgroundColor: this.state.customStyles.stepIndicatorCurrentColor,
218
- borderWidth: this.state.customStyles.currentStepStrokeWidth,
219
- borderColor: this.state.customStyles.stepStrokeCurrentColor,
220
- height: this.sizeAnim,
221
- width: this.sizeAnim,
222
- borderRadius: this.borderRadiusAnim,
223
- };
224
- indicatorLabelStyle = {
225
- fontSize: this.state.customStyles.currentStepIndicatorLabelFontSize,
226
- color: this.state.customStyles.stepIndicatorLabelCurrentColor,
227
- };
228
- break;
229
- }
230
- case STEP_STATUS.FINISHED: {
231
- stepStyle = {
232
- backgroundColor: this.state.customStyles.stepIndicatorFinishedColor,
233
- borderWidth: this.state.customStyles.stepStrokeWidth,
234
- borderColor: this.state.customStyles.stepStrokeFinishedColor,
235
- height: this.state.customStyles.stepIndicatorSize,
236
- width: this.state.customStyles.stepIndicatorSize,
237
- borderRadius: this.state.customStyles.stepIndicatorSize / 2,
238
- };
239
- indicatorLabelStyle = {
240
- fontSize: this.state.customStyles.stepIndicatorLabelFontSize,
241
- color: this.state.customStyles.stepIndicatorLabelFinishedColor,
242
- };
243
- break;
244
- }
245
- case STEP_STATUS.UNFINISHED: {
246
- stepStyle = {
247
- backgroundColor: this.state.customStyles.stepIndicatorUnFinishedColor,
248
- borderWidth: this.state.customStyles.stepStrokeWidth,
249
- borderColor: this.state.customStyles.stepStrokeUnFinishedColor,
250
- height: this.state.customStyles.stepIndicatorSize,
251
- width: this.state.customStyles.stepIndicatorSize,
252
- borderRadius: this.state.customStyles.stepIndicatorSize / 2,
253
- };
254
- indicatorLabelStyle = {
255
- overflow: "hidden",
256
- fontSize: this.state.customStyles.stepIndicatorLabelFontSize,
257
- color: this.state.customStyles.stepIndicatorLabelUnFinishedColor,
258
- };
259
- break;
260
- }
261
- default:
262
- }
263
- return (React.createElement(Animated.View, { key: "step-indicator", style: [styles.step, stepStyle] }, renderStepIndicator ? (renderStepIndicator({
264
- position,
265
- stepStatus: this.getStepStatus(position),
266
- })) : (React.createElement(Text, { style: indicatorLabelStyle }, `${position + 1}`))));
267
- };
268
- getStepStatus = (stepPosition) => {
269
- const { currentPosition } = this.props;
270
- if (stepPosition === currentPosition) {
271
- return STEP_STATUS.CURRENT;
272
- }
273
- else if (stepPosition < currentPosition) {
274
- return STEP_STATUS.FINISHED;
275
- }
276
- else {
277
- return STEP_STATUS.UNFINISHED;
278
- }
279
- };
280
- onCurrentPositionChanged = (position) => {
281
- let { stepCount } = this.props;
282
- if (position > stepCount - 1) {
283
- position = stepCount - 1;
284
- }
285
- const animateToPosition = (this.state.progressBarSize / (stepCount - 1)) * position;
286
- this.sizeAnim.setValue(this.state.customStyles.stepIndicatorSize);
287
- this.borderRadiusAnim.setValue(this.state.customStyles.stepIndicatorSize / 2);
288
- Animated.sequence([
289
- Animated.timing(this.progressAnim, {
290
- toValue: animateToPosition,
291
- duration: 200,
292
- }),
293
- Animated.parallel([
294
- Animated.timing(this.sizeAnim, {
295
- toValue: this.state.customStyles.currentStepIndicatorSize,
296
- duration: 100,
297
- }),
298
- Animated.timing(this.borderRadiusAnim, {
299
- toValue: this.state.customStyles.currentStepIndicatorSize / 2,
300
- duration: 100,
301
- }),
302
- ]),
303
- ]).start();
304
- };
305
- }
306
- const styles = StyleSheet.create({
307
- container: {
308
- backgroundColor: "transparent",
309
- },
310
- stepIndicatorContainer: {
311
- flexDirection: "row",
312
- alignItems: "center",
313
- justifyContent: "space-around",
314
- backgroundColor: "transparent",
315
- },
316
- stepLabelsContainer: {
317
- justifyContent: "space-around",
318
- },
319
- step: {
320
- alignItems: "center",
321
- justifyContent: "center",
322
- zIndex: 2,
323
- },
324
- stepContainer: {
325
- flex: 1,
326
- flexDirection: "row",
327
- alignItems: "center",
328
- justifyContent: "center",
329
- },
330
- stepLabel: {
331
- fontSize: 12,
332
- textAlign: "center",
333
- fontWeight: "500",
334
- },
335
- stepLabelItem: {
336
- flex: 1,
337
- alignItems: "center",
338
- justifyContent: "center",
339
- },
340
- });
341
- StepIndicator.defaultProps = {
342
- currentPosition: 0,
343
- stepCount: 5,
344
- customStyles: {},
345
- direction: "horizontal",
346
- };
@@ -1,39 +0,0 @@
1
- import React, { useEffect, useState } from "react";
2
- import { View, Text } from "react-native";
3
- import { isNumber } from "lodash";
4
- import { withTheme } from "../theming";
5
- import IconButton from "./IconButton";
6
- const Stepper = ({ min = -Infinity, max = Infinity, value: valueProp, defaultValue, style, typeStyle, iconSize = 24, iconColor, onChange, theme: { colors, typography }, Icon, }) => {
7
- const [value, setValue] = useState(defaultValue ?? 0);
8
- const isValidValue = (valueArg) => valueArg >= min && valueArg <= max;
9
- const handlePlusOrMinus = (type) => {
10
- const newValue = type === "plus" ? value + 1 : value - 1;
11
- if (isValidValue(newValue)) {
12
- setValue(newValue);
13
- onChange?.(newValue);
14
- }
15
- };
16
- useEffect(() => {
17
- if (valueProp != null &&
18
- isNumber(valueProp) &&
19
- valueProp !== value &&
20
- isValidValue(valueProp)) {
21
- setValue(valueProp);
22
- }
23
- // eslint-disable-next-line react-hooks/exhaustive-deps
24
- }, [valueProp]);
25
- return (React.createElement(View, { style: [{ flexDirection: "row" }, style] },
26
- React.createElement(IconButton, { Icon: Icon, icon: "MaterialIcons/remove", onPress: () => handlePlusOrMinus("minus"), size: iconSize, color: iconColor, disabled: value === min, style: { opacity: value === min ? 0.5 : 1 } }),
27
- React.createElement(Text, { style: [
28
- typography.body1,
29
- {
30
- textAlign: "center",
31
- alignSelf: "center",
32
- color: colors.medium,
33
- marginHorizontal: 8,
34
- },
35
- typeStyle,
36
- ] }, value),
37
- React.createElement(IconButton, { Icon: Icon, icon: "MaterialIcons/add", onPress: () => handlePlusOrMinus("plus"), size: iconSize, color: iconColor, disabled: value === max, style: { opacity: value === max ? 0.5 : 1 } })));
38
- };
39
- export default withTheme(Stepper);
@@ -1,32 +0,0 @@
1
- /* Copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx */
2
- import * as React from "react";
3
- import { Animated, StyleSheet, } from "react-native";
4
- import shadow from "../styles/shadow";
5
- import overlay from "../styles/overlay";
6
- import { withTheme } from "../theming";
7
- const Surface = ({ elevation: propElevation, style, theme, children, ...rest }) => {
8
- const { elevation: styleElevation = 3, backgroundColor, ...restStyle } = (StyleSheet.flatten(style) || {});
9
- const { dark: isDarkTheme, mode, colors } = theme;
10
- const elevation = propElevation || styleElevation;
11
- const evalationStyles = elevation ? shadow(elevation) : {};
12
- const getBackgroundColor = () => {
13
- if (backgroundColor) {
14
- return backgroundColor;
15
- }
16
- else if (isDarkTheme && mode === "adaptive") {
17
- return overlay(elevation, colors.surface);
18
- }
19
- else {
20
- return colors.surface;
21
- }
22
- };
23
- return (React.createElement(Animated.View, { ...rest, style: [
24
- {
25
- backgroundColor: getBackgroundColor(),
26
- elevation,
27
- ...evalationStyles,
28
- ...restStyle,
29
- },
30
- ] }, children));
31
- };
32
- export default withTheme(Surface);
@@ -1,29 +0,0 @@
1
- import React from "react";
2
- import { View } from "react-native";
3
- import SwiperComponent from "react-native-web-swiper";
4
- const Swiper = ({ vertical = false, loop = false, timeout = 0, from = 0, prevTitle = "", nextTitle = "", prevTitleColor, nextTitleColor, dotsTouchable = true, dotColor, dotActiveColor, data, keyExtractor, renderItem, children, style, }) => (React.createElement(View, { style: style },
5
- React.createElement(SwiperComponent, { from: from, loop: loop, timeout: timeout, vertical: vertical, controlsProps: {
6
- prevTitle,
7
- nextTitle,
8
- prevTitleStyle: { color: prevTitleColor },
9
- nextTitleStyle: { color: nextTitleColor },
10
- dotsTouchable,
11
- ...(dotColor
12
- ? { dotProps: { badgeStyle: { backgroundColor: dotColor } } }
13
- : {}),
14
- ...(dotActiveColor
15
- ? { dotActiveStyle: { backgroundColor: dotActiveColor } }
16
- : {}),
17
- } }, data && renderItem
18
- ? data.map((item, index) => {
19
- const component = renderItem({ item, index });
20
- if (!component) {
21
- return null;
22
- }
23
- const key = keyExtractor ? keyExtractor(item, index) : index;
24
- return React.cloneElement(component, {
25
- key,
26
- });
27
- })
28
- : children)));
29
- export default Swiper;
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import { View, StyleSheet } from "react-native";
3
- const styles = StyleSheet.create({
4
- wrapper: {
5
- flex: 1,
6
- },
7
- });
8
- const SwiperItem = ({ children, style }) => (React.createElement(View, { style: [styles.wrapper, style] }, children));
9
- export default SwiperItem;
@@ -1,2 +0,0 @@
1
- export { default as Swiper } from "./Swiper";
2
- export { default as SwiperItem } from "./SwiperItem";
@@ -1,56 +0,0 @@
1
- import * as React from "react";
2
- import { Switch as NativeSwitch, } from "react-native";
3
- import { withTheme } from "../theming";
4
- import FormRow from "./FormRow";
5
- import { RowDirection } from "@draftbit/types";
6
- import { usePrevious } from "../hooks";
7
- function Switch({ value, defaultValue, disabled, onValueChange, activeTrackColor, inactiveTrackColor, activeThumbColor, inactiveThumbColor, theme, style, ...rest }) {
8
- const activeTrackThemeColor = activeTrackColor || theme.colors.primary;
9
- const inactiveTrackThemeColor = inactiveTrackColor || "#EEE";
10
- const activeThumbThemeColor = activeThumbColor || "#FFF";
11
- const inactiveThumbThemeColor = inactiveThumbColor || "#FFF";
12
- const [checked, setChecked] = React.useState(value || defaultValue);
13
- React.useEffect(() => {
14
- if (value != null && value !== checked) {
15
- setChecked(value);
16
- }
17
- }, [value, checked]);
18
- // This special logic is to handle weird APIs like Airtable that return
19
- // true or undefined for a boolean
20
- const previousDefaultValue = usePrevious(defaultValue);
21
- React.useEffect(() => {
22
- if (defaultValue !== previousDefaultValue) {
23
- setChecked(Boolean(defaultValue));
24
- }
25
- }, [defaultValue, previousDefaultValue]);
26
- return (React.createElement(NativeSwitch, { value: checked, disabled: disabled, trackColor: {
27
- false: inactiveTrackThemeColor,
28
- true: activeTrackThemeColor,
29
- }, thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor,
30
- // @ts-ignore react-native-web only
31
- activeThumbColor: activeThumbThemeColor, ios_backgroundColor: inactiveTrackThemeColor, style: style, onValueChange: (bool) => {
32
- setChecked(bool);
33
- onValueChange && onValueChange(bool);
34
- }, ...rest }));
35
- }
36
- function Row({ label = "Label", direction = RowDirection.Row, style, value, defaultValue, disabled, onValueChange, activeTrackColor, inactiveTrackColor, activeThumbColor, inactiveThumbColor, theme, ...rest }) {
37
- const [checked, setChecked] = React.useState(value != null ? value : defaultValue);
38
- React.useEffect(() => {
39
- if (value != null) {
40
- setChecked(value);
41
- }
42
- }, [value]);
43
- React.useEffect(() => {
44
- if (defaultValue != null) {
45
- setChecked(defaultValue);
46
- }
47
- }, [defaultValue]);
48
- return (React.createElement(FormRow, { disabled: disabled, onPress: () => {
49
- setChecked(!checked);
50
- onValueChange && onValueChange(!checked);
51
- }, label: label, direction: direction, style: style, ...rest },
52
- React.createElement(Switch, { theme: theme, value: checked, disabled: disabled, onValueChange: onValueChange, activeTrackColor: activeTrackColor, inactiveTrackColor: inactiveTrackColor, activeThumbColor: activeThumbColor, inactiveThumbColor: inactiveThumbColor })));
53
- }
54
- const SwitchRow = withTheme(Row);
55
- export { SwitchRow };
56
- export default withTheme(Switch);
@@ -1,28 +0,0 @@
1
- import * as React from "react";
2
- import { Text as NativeText, I18nManager } from "react-native";
3
- import { withTheme } from "../theming";
4
- class Text extends React.Component {
5
- _root;
6
- setNativeProps(args) {
7
- return this._root && this._root.setNativeProps(args);
8
- }
9
- render() {
10
- const { style, ...rest } = this.props;
11
- const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
12
- return (React.createElement(NativeText, { ...rest, ref: (c) => {
13
- this._root = c;
14
- }, style: [
15
- {
16
- textAlign: "left",
17
- writingDirection,
18
- },
19
- style,
20
- ] }));
21
- }
22
- }
23
- export const BaseLink = ({ style, theme, title, ...props }) => {
24
- return (React.createElement(Text, { hitSlop: 8, style: [{ color: theme.colors.primary }, style], theme: theme, ...props }, title));
25
- };
26
- const Link = withTheme(BaseLink);
27
- export { Link };
28
- export default withTheme(Text);