@draftbit/core 42.1.5 → 42.1.7-71d4c6.1

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 (127) hide show
  1. package/LICENSE +21 -0
  2. package/lib/commonjs/components/DatePicker/DatePicker.js +6 -1
  3. package/lib/commonjs/components/DatePicker/DatePicker.js.map +1 -1
  4. package/lib/commonjs/components/DatePicker/DatePickerComponentType.js +2 -0
  5. package/lib/commonjs/components/Divider.js +18 -5
  6. package/lib/commonjs/components/Divider.js.map +1 -1
  7. package/lib/commonjs/components/Elevation.js +14 -3
  8. package/lib/commonjs/components/Elevation.js.map +1 -1
  9. package/lib/commonjs/components/Justification.js +3 -0
  10. package/lib/commonjs/components/Picker/PickerComponent.android.js +4 -1
  11. package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -1
  12. package/lib/commonjs/components/Picker/PickerComponent.web.js +4 -1
  13. package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -1
  14. package/lib/commonjs/components/Picker/PickerTypes.js +3 -0
  15. package/lib/commonjs/components/Portal/PortalHost.js.map +1 -1
  16. package/lib/commonjs/components/ResizeMode.js +3 -0
  17. package/lib/module/components/DatePicker/DatePicker.js +6 -1
  18. package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
  19. package/lib/module/components/DatePicker/DatePickerComponentType.js +1 -1
  20. package/lib/module/components/Justification.js +1 -1
  21. package/lib/module/components/Picker/PickerComponent.android.js +4 -1
  22. package/lib/module/components/Picker/PickerComponent.android.js.map +1 -1
  23. package/lib/module/components/Picker/PickerComponent.web.js +4 -1
  24. package/lib/module/components/Picker/PickerComponent.web.js.map +1 -1
  25. package/lib/module/components/Picker/PickerTypes.js +1 -1
  26. package/lib/module/components/ResizeMode.js +1 -1
  27. package/package.json +3 -2
  28. package/src/Provider.js +9 -0
  29. package/src/components/Accordion/AccordionGroup.js +94 -0
  30. package/src/components/Accordion/AccordionItem.js +48 -0
  31. package/src/components/Accordion/index.js +2 -0
  32. package/src/components/ActionSheet/ActionSheet.js +57 -0
  33. package/src/components/ActionSheet/ActionSheetCancel.js +28 -0
  34. package/src/components/ActionSheet/ActionSheetItem.js +49 -0
  35. package/src/components/ActionSheet/index.js +3 -0
  36. package/src/components/AnimatedCircularProgress.js +43 -0
  37. package/src/components/AspectRatio.js +18 -0
  38. package/src/components/AvatarEdit.js +67 -0
  39. package/src/components/Button.js +187 -0
  40. package/src/components/Card.js +109 -0
  41. package/src/components/CardBlock.js +176 -0
  42. package/src/components/CardContainer.js +171 -0
  43. package/src/components/CardContainerRating.js +203 -0
  44. package/src/components/CardContainerShortImage.js +151 -0
  45. package/src/components/CardInline.js +87 -0
  46. package/src/components/Carousel.js +85 -0
  47. package/src/components/Checkbox/Checkbox.js +114 -0
  48. package/src/components/Checkbox/CheckboxGroup.js +46 -0
  49. package/src/components/Checkbox/CheckboxRow.js +109 -0
  50. package/src/components/Checkbox/context.js +14 -0
  51. package/src/components/Checkbox/index.js +3 -0
  52. package/src/components/CircleImage.js +32 -0
  53. package/src/components/CircularProgress.js +78 -0
  54. package/src/components/Config.js +63 -0
  55. package/src/components/Container.js +73 -0
  56. package/src/components/DatePicker/DatePicker.js +379 -0
  57. package/src/components/DatePicker/DatePicker.tsx +7 -1
  58. package/src/components/DatePicker/DatePickerComponent.js +13 -0
  59. package/src/components/DatePicker/DatePickerComponent.web.js +30 -0
  60. package/src/components/DatePicker/DatePickerComponentType.js +1 -0
  61. package/src/components/DeprecatedButton.js +201 -0
  62. package/src/components/DeprecatedCardWrapper.js +18 -0
  63. package/src/components/DeprecatedFAB.js +261 -0
  64. package/src/components/Divider.js +39 -0
  65. package/src/components/Elevation.js +20 -0
  66. package/src/components/FAB.js +82 -0
  67. package/src/components/FieldSearchBarFull.js +92 -0
  68. package/src/components/FormRow.js +19 -0
  69. package/src/components/Header.js +44 -0
  70. package/src/components/HeaderLarge.js +35 -0
  71. package/src/components/HeaderMedium.js +61 -0
  72. package/src/components/HeaderOverline.js +61 -0
  73. package/src/components/IconButton.js +65 -0
  74. package/src/components/Image.js +62 -0
  75. package/src/components/Justification.js +1 -0
  76. package/src/components/Layout.js +245 -0
  77. package/src/components/Picker/Picker.js +204 -0
  78. package/src/components/Picker/PickerComponent.android.js +68 -0
  79. package/src/components/Picker/PickerComponent.android.tsx +6 -1
  80. package/src/components/Picker/PickerComponent.ios.js +72 -0
  81. package/src/components/Picker/PickerComponent.web.js +68 -0
  82. package/src/components/Picker/PickerComponent.web.tsx +6 -1
  83. package/src/components/Picker/PickerTypes.js +1 -0
  84. package/src/components/Portal/Portal.js +35 -0
  85. package/src/components/Portal/PortalConsumer.js +28 -0
  86. package/src/components/Portal/PortalHost.js +105 -0
  87. package/src/components/Portal/PortalManager.js +29 -0
  88. package/src/components/ProgressBar.js +218 -0
  89. package/src/components/ProgressCircle.js +121 -0
  90. package/src/components/ProgressIndicator.js +207 -0
  91. package/src/components/RadioButton/RadioButton.js +66 -0
  92. package/src/components/RadioButton/RadioButtonFieldGroup.js +17 -0
  93. package/src/components/RadioButton/RadioButtonGroup.js +43 -0
  94. package/src/components/RadioButton/RadioButtonRow.js +111 -0
  95. package/src/components/RadioButton/context.js +14 -0
  96. package/src/components/RadioButton/index.js +4 -0
  97. package/src/components/ResizeMode.js +1 -0
  98. package/src/components/Row.js +48 -0
  99. package/src/components/RowBodyIcon.js +83 -0
  100. package/src/components/RowHeadlineImageCaption.js +179 -0
  101. package/src/components/RowHeadlineImageIcon.js +113 -0
  102. package/src/components/ScreenContainer.js +35 -0
  103. package/src/components/Slider.js +114 -0
  104. package/src/components/StarRating.js +80 -0
  105. package/src/components/StepIndicator.js +346 -0
  106. package/src/components/Stepper.js +69 -0
  107. package/src/components/Surface.js +36 -0
  108. package/src/components/Switch.js +59 -0
  109. package/src/components/Text.js +232 -0
  110. package/src/components/TextField.js +552 -0
  111. package/src/components/TextInput.js +13 -0
  112. package/src/components/ToggleButton.js +75 -0
  113. package/src/components/Touchable.js +24 -0
  114. package/src/components/Touchable.web.js +2 -0
  115. package/src/components/Typography.js +36 -0
  116. package/src/components/useAuthState.js +31 -0
  117. package/src/constants.js +10 -0
  118. package/src/hooks.js +12 -0
  119. package/src/index.js +48 -0
  120. package/src/interfaces/Icon.js +8 -0
  121. package/src/styles/DarkTheme.js +26 -0
  122. package/src/styles/DefaultTheme.js +111 -0
  123. package/src/styles/fonts.js +62 -0
  124. package/src/styles/overlay.js +60 -0
  125. package/src/styles/shadow.js +51 -0
  126. package/src/theming.js +3 -0
  127. package/src/utilities.js +42 -0
@@ -0,0 +1,261 @@
1
+ import * as React from "react";
2
+ import { ActivityIndicator, View, StyleSheet, } from "react-native";
3
+ import color from "color";
4
+ import Config from "./Config";
5
+ import Text from "./Text";
6
+ import Touchable from "./Touchable";
7
+ import Elevation from "./Elevation";
8
+ import { withTheme } from "../theming";
9
+ import { GROUPS, FORM_TYPES, PROP_TYPES, COMPONENT_TYPES, } from "@draftbit/types";
10
+ const FAB = ({ Icon, icon, disabled = false, type = "solid", loading = false, color: colorOverride, label, onPress, elevation = 0, style, theme: { colors, disabledOpacity, roundness, typography }, ...rest }) => {
11
+ let backgroundColor, borderColor, textColor, borderWidth;
12
+ const buttonColor = colorOverride || colors.primary;
13
+ if (type === "standard" || type === "extended" || type === "fixed") {
14
+ backgroundColor = buttonColor;
15
+ if (disabled) {
16
+ textColor = color(colors.surface).alpha(disabledOpacity).rgb().string();
17
+ }
18
+ else {
19
+ textColor = colors.surface;
20
+ }
21
+ }
22
+ else {
23
+ backgroundColor = "transparent";
24
+ if (disabled) {
25
+ textColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
26
+ }
27
+ else {
28
+ textColor = buttonColor;
29
+ }
30
+ }
31
+ if (type === "outline") {
32
+ if (disabled) {
33
+ borderColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
34
+ }
35
+ else {
36
+ borderColor = buttonColor;
37
+ }
38
+ borderWidth = StyleSheet.hairlineWidth;
39
+ }
40
+ else {
41
+ borderColor = "transparent";
42
+ borderWidth = 0;
43
+ }
44
+ const buttonStyle = {
45
+ backgroundColor,
46
+ borderColor,
47
+ borderWidth,
48
+ borderRadius: roundness,
49
+ alignItems: "center",
50
+ justifyContent: "center",
51
+ };
52
+ const buttonStyles = [styles.button, buttonStyle];
53
+ const contentStyle = [styles.content];
54
+ const textStyle = {
55
+ textAlign: "center",
56
+ color: textColor,
57
+ };
58
+ const iconStyle = [
59
+ styles.icon,
60
+ {
61
+ width: Config.buttonIconSize,
62
+ },
63
+ ];
64
+ if (type === "standard" || type === "outline") {
65
+ buttonStyle.width = Config.FABSize;
66
+ buttonStyle.height = Config.FABSize;
67
+ buttonStyle.borderRadius = Config.FABBorderRadius;
68
+ contentStyle.push({
69
+ width: Config.FABSize,
70
+ height: Config.FABSize,
71
+ });
72
+ }
73
+ if (type === "extended" || type === "fixed") {
74
+ iconStyle.push({
75
+ marginLeft: 16,
76
+ marginRight: -8,
77
+ });
78
+ textStyle.margin = 16;
79
+ }
80
+ if (type === "fixed") {
81
+ buttonStyles.push({
82
+ height: Config.FABFixedHeight,
83
+ alignSelf: "stretch",
84
+ });
85
+ }
86
+ return (React.createElement(Elevation, { style: [{ elevation }, style] },
87
+ React.createElement(Touchable, { ...rest, onPress: onPress, accessibilityState: { disabled }, accessibilityRole: "button", disabled: disabled || loading, style: buttonStyles },
88
+ React.createElement(View, { style: styles.content },
89
+ icon && loading !== true ? (React.createElement(View, { style: iconStyle },
90
+ React.createElement(Icon, { name: icon, size: Config.buttonIconSize, color: textColor }))) : null,
91
+ loading ? (React.createElement(ActivityIndicator, { size: "small", color: textColor, style: iconStyle })) : null,
92
+ label ? (React.createElement(Text, { numberOfLines: 1, style: [textStyle, typography.button] }, label)) : null))));
93
+ };
94
+ const styles = StyleSheet.create({
95
+ button: {
96
+ borderStyle: "solid",
97
+ },
98
+ content: {
99
+ flexDirection: "row",
100
+ alignItems: "center",
101
+ justifyContent: "center",
102
+ },
103
+ icon: {
104
+ alignItems: "center",
105
+ justifyContent: "center",
106
+ width: Config.buttonIconSize,
107
+ },
108
+ fixed: {
109
+ left: 0,
110
+ right: 0,
111
+ bottom: 0,
112
+ height: 64,
113
+ borderRadius: 0,
114
+ },
115
+ });
116
+ export default withTheme(FAB);
117
+ const SEED_DATA_PROPS = {
118
+ icon: {
119
+ group: GROUPS.basic,
120
+ label: "Icon Name",
121
+ description: "Name of the icon",
122
+ editable: true,
123
+ required: true,
124
+ formType: FORM_TYPES.icon,
125
+ propType: PROP_TYPES.ASSET,
126
+ defaultValue: null,
127
+ },
128
+ label: {
129
+ group: GROUPS.basic,
130
+ label: "Label",
131
+ description: "Button label",
132
+ required: true,
133
+ editable: true,
134
+ formType: FORM_TYPES.string,
135
+ propType: PROP_TYPES.STRING,
136
+ defaultValue: "GET STARTED",
137
+ },
138
+ color: {
139
+ group: GROUPS.basic,
140
+ label: "Color Override",
141
+ description: "Override the background color of the button",
142
+ editable: true,
143
+ required: false,
144
+ formType: FORM_TYPES.color,
145
+ propType: PROP_TYPES.THEME,
146
+ defaultValue: null,
147
+ },
148
+ onPress: {
149
+ group: GROUPS.basic,
150
+ label: "Action",
151
+ description: "Action to execute when button pressed",
152
+ editable: true,
153
+ required: false,
154
+ formType: FORM_TYPES.action,
155
+ propType: PROP_TYPES.STRING,
156
+ defaultValue: null,
157
+ },
158
+ };
159
+ export const SEED_DATA = [
160
+ {
161
+ name: "FAB Mini",
162
+ tag: "FAB",
163
+ category: COMPONENT_TYPES.deprecated,
164
+ description: "A round, mini FAB",
165
+ preview_image_url: "{CLOUDINARY_URL}/Button_FABMini.png",
166
+ props: {
167
+ ...SEED_DATA_PROPS,
168
+ type: {
169
+ group: GROUPS.uncategorized,
170
+ label: "Type",
171
+ description: "Button type",
172
+ editable: false,
173
+ required: true,
174
+ formType: FORM_TYPES.icon,
175
+ propType: PROP_TYPES.STRING,
176
+ defaultValue: "standard",
177
+ },
178
+ label: {
179
+ group: GROUPS.data,
180
+ label: "Label",
181
+ description: "Button label",
182
+ required: false,
183
+ editable: false,
184
+ formType: FORM_TYPES.string,
185
+ propType: PROP_TYPES.STRING,
186
+ defaultValue: null,
187
+ },
188
+ },
189
+ layout: {},
190
+ },
191
+ {
192
+ name: "FAB Outline",
193
+ tag: "FAB",
194
+ category: COMPONENT_TYPES.deprecated,
195
+ preview_image_url: "{CLOUDINARY_URL}/Button_FABMini.png",
196
+ props: {
197
+ ...SEED_DATA_PROPS,
198
+ type: {
199
+ group: GROUPS.uncategorized,
200
+ label: "Type",
201
+ description: "Button type",
202
+ editable: false,
203
+ required: true,
204
+ propType: PROP_TYPES.STRING,
205
+ formType: FORM_TYPES.string,
206
+ defaultValue: "outline",
207
+ },
208
+ label: {
209
+ group: GROUPS.uncategorized,
210
+ label: "Label",
211
+ description: "Button label",
212
+ required: false,
213
+ editable: false,
214
+ formType: FORM_TYPES.string,
215
+ propType: PROP_TYPES.STRING,
216
+ defaultValue: null,
217
+ },
218
+ },
219
+ layout: {},
220
+ },
221
+ {
222
+ name: "FAB Extended",
223
+ tag: "FAB",
224
+ category: COMPONENT_TYPES.deprecated,
225
+ preview_image_url: "{CLOUDINARY_URL}/Button_FABExtended.png",
226
+ props: {
227
+ ...SEED_DATA_PROPS,
228
+ type: {
229
+ group: GROUPS.uncategorized,
230
+ label: "Type",
231
+ description: "Button type",
232
+ editable: false,
233
+ required: true,
234
+ formType: FORM_TYPES.string,
235
+ propType: PROP_TYPES.STRING,
236
+ defaultValue: "extended",
237
+ },
238
+ },
239
+ layout: {},
240
+ },
241
+ {
242
+ name: "FAB Fixed",
243
+ tag: "FAB",
244
+ category: COMPONENT_TYPES.deprecated,
245
+ preview_image_url: "{CLOUDINARY_URL}/Button_FABFixed.png",
246
+ props: {
247
+ ...SEED_DATA_PROPS,
248
+ type: {
249
+ group: GROUPS.uncategorized,
250
+ label: "Type",
251
+ description: "Button type",
252
+ editable: false,
253
+ required: true,
254
+ formType: FORM_TYPES.string,
255
+ propType: PROP_TYPES.STRING,
256
+ defaultValue: "fixed",
257
+ },
258
+ },
259
+ layout: {},
260
+ },
261
+ ];
@@ -0,0 +1,39 @@
1
+ import * as React from "react";
2
+ import { StyleSheet, View } from "react-native";
3
+ import { withTheme } from "../theming";
4
+ import { GROUPS, FORM_TYPES, PROP_TYPES, COMPONENT_TYPES, } from "@draftbit/types";
5
+ const Divider = ({ style, color, theme: { colors }, ...rest }) => {
6
+ return (React.createElement(View, { style: [
7
+ {
8
+ backgroundColor: color || colors.divider,
9
+ height: StyleSheet.hairlineWidth,
10
+ },
11
+ style,
12
+ ], ...rest }));
13
+ };
14
+ export default withTheme(Divider);
15
+ export const SEED_DATA = [
16
+ {
17
+ name: "Divider",
18
+ tag: "Divider",
19
+ category: COMPONENT_TYPES.layout,
20
+ description: "A horizontal line used to divide content",
21
+ preview_image_url: "{CLOUDINARY_URL}/Divider.png",
22
+ supports_list_render: false,
23
+ props: {
24
+ color: {
25
+ group: GROUPS.basic,
26
+ label: "Color",
27
+ description: "The color of the divider",
28
+ editable: true,
29
+ required: false,
30
+ defaultValue: "divider",
31
+ formType: FORM_TYPES.color,
32
+ propType: PROP_TYPES.THEME,
33
+ },
34
+ },
35
+ layout: {
36
+ height: 1,
37
+ },
38
+ },
39
+ ];
@@ -0,0 +1,20 @@
1
+ import * as React from "react";
2
+ import { Animated, StyleSheet, View, } from "react-native";
3
+ import shadow from "../styles/shadow";
4
+ import { withTheme } from "../theming";
5
+ /* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */
6
+ const Elevation = ({ style, theme, children, ...rest }) => {
7
+ const { elevation = 4, borderRadius: radius } = StyleSheet.flatten(style) || {};
8
+ const { colors } = theme;
9
+ const borderRadius = radius;
10
+ return (React.createElement(Animated.View, { ...rest, style: [
11
+ {
12
+ borderRadius,
13
+ backgroundColor: colors.surface,
14
+ },
15
+ elevation ? shadow(elevation) : null,
16
+ style,
17
+ ] },
18
+ React.createElement(View, { style: { overflow: "hidden", borderRadius } }, children)));
19
+ };
20
+ export default withTheme(Elevation);
@@ -0,0 +1,82 @@
1
+ import * as React from "react";
2
+ import { View, StyleSheet, Pressable, ActivityIndicator, Platform, } from "react-native";
3
+ import { withTheme } from "../theming";
4
+ import { COMPONENT_TYPES, createIconProp, createColorProp, GROUPS, createBoolProp, createIconSizeProp, createActionProp, Triggers, } from "@draftbit/types";
5
+ const FAB = ({ onPress, disabled, loading, iconName = "MaterialIcons/add", style, theme, iconColor, bgColor, size = 50, Icon, ...props }) => {
6
+ const backgroundColor = bgColor || theme.colors.primary;
7
+ const color = iconColor || "#FFF";
8
+ return (React.createElement(View, { style: [
9
+ {
10
+ width: size,
11
+ height: size,
12
+ borderRadius: size / 2,
13
+ overflow: "hidden",
14
+ },
15
+ style,
16
+ ] },
17
+ React.createElement(Pressable, { onPress: onPress, disabled: loading || disabled, android_ripple: {
18
+ color: "#333",
19
+ radius: size / 4,
20
+ }, style: ({ pressed }) => {
21
+ return [
22
+ styles.button,
23
+ {
24
+ opacity: pressed || disabled ? 0.75 : 1,
25
+ width: size,
26
+ height: size,
27
+ borderRadius: size / 2,
28
+ backgroundColor,
29
+ },
30
+ ];
31
+ }, ...props },
32
+ React.createElement(View, null, loading ? (React.createElement(ActivityIndicator, { size: "small", color: color })) : (React.createElement(Icon, { name: iconName, size: 28, color: color }))))));
33
+ };
34
+ const styles = StyleSheet.create({
35
+ button: {
36
+ backgroundColor: "#5a45ff",
37
+ justifyContent: "center",
38
+ alignItems: "center",
39
+ ...Platform.select({
40
+ web: {
41
+ cursor: "pointer",
42
+ userSelect: "none",
43
+ },
44
+ }),
45
+ },
46
+ });
47
+ export default withTheme(FAB);
48
+ export const SEED_DATA = {
49
+ name: "FAB",
50
+ tag: "FAB",
51
+ category: COMPONENT_TYPES.button,
52
+ description: "A mini round icon FAB",
53
+ layout: {},
54
+ triggers: [Triggers.OnPress],
55
+ props: {
56
+ onPress: createActionProp(),
57
+ disabled: createBoolProp({
58
+ label: "Disabled",
59
+ group: GROUPS.basic,
60
+ }),
61
+ loading: createBoolProp({
62
+ label: "Loading",
63
+ group: GROUPS.basic,
64
+ }),
65
+ iconName: createIconProp({
66
+ label: "Icon",
67
+ defaultValue: null,
68
+ group: GROUPS.basic,
69
+ }),
70
+ iconColor: createColorProp({
71
+ label: "Icon color",
72
+ defaultValue: null,
73
+ group: GROUPS.basic,
74
+ }),
75
+ bgColor: createColorProp({
76
+ label: "Background color",
77
+ defaultValue: null,
78
+ group: GROUPS.basic,
79
+ }),
80
+ iconSize: createIconSizeProp(),
81
+ },
82
+ };
@@ -0,0 +1,92 @@
1
+ import * as React from "react";
2
+ import { View, TextInput, StyleSheet, } from "react-native";
3
+ import { withTheme } from "../theming";
4
+ import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, Triggers, } from "@draftbit/types";
5
+ import Config from "./Config";
6
+ import { usePrevious } from "../hooks";
7
+ const FieldSearchBarFull = ({ Icon, icon = "search", placeholder = "", style, theme: { colors, typography }, onChange: changeOverride, onSubmit: submitOverride, value, initialValue, }) => {
8
+ const [focused, setIsFocused] = React.useState(false);
9
+ const onBlur = () => {
10
+ setIsFocused(false);
11
+ };
12
+ const onChange = React.useCallback((text) => {
13
+ changeOverride && changeOverride(text);
14
+ }, [changeOverride]);
15
+ const previousInitialValue = usePrevious(initialValue);
16
+ React.useEffect(() => {
17
+ if (initialValue !== previousInitialValue) {
18
+ onChange(initialValue);
19
+ }
20
+ }, [initialValue, previousInitialValue, onChange]);
21
+ const onFocus = () => {
22
+ setIsFocused(true);
23
+ };
24
+ const onSubmit = (e) => {
25
+ submitOverride && submitOverride(e);
26
+ };
27
+ const { lineHeight, ...typeStyles } = typography.body2; // eslint-disable-line @typescript-eslint/no-unused-vars
28
+ return (React.createElement(View, { style: [{ padding: 16 }, styles.container, style] },
29
+ React.createElement(Icon, { name: icon, size: Config.fieldSearchBarFullIconSize, color: focused ? colors.primary : colors.light }),
30
+ React.createElement(View, { style: { marginLeft: 12, flex: 1 } },
31
+ React.createElement(TextInput, { clearButtonMode: "while-editing", placeholder: placeholder, value: value, onBlur: onBlur, onFocus: onFocus, onChangeText: onChange, onSubmitEditing: onSubmit, placeholderTextColor: colors.light, style: [
32
+ {
33
+ color: colors.medium,
34
+ },
35
+ typeStyles,
36
+ ] }))));
37
+ };
38
+ const styles = StyleSheet.create({
39
+ container: {
40
+ flexDirection: "row",
41
+ alignItems: "center",
42
+ },
43
+ });
44
+ export default withTheme(FieldSearchBarFull);
45
+ export const SEED_DATA = [
46
+ {
47
+ name: "Search Bar",
48
+ tag: "FieldSearchBarFull",
49
+ description: "A search bar with accompanying search icon and clear button.",
50
+ category: COMPONENT_TYPES.input,
51
+ preview_image_url: "{CLOUDINARY_URL}/Field_SearchBar_Full.png",
52
+ supports_list_render: false,
53
+ triggers: [Triggers.OnChange],
54
+ props: {
55
+ icon: {
56
+ group: GROUPS.basic,
57
+ label: "Icon",
58
+ description: "Left icon to display",
59
+ formType: FORM_TYPES.icon,
60
+ propType: PROP_TYPES.ASSET,
61
+ defaultValue: null,
62
+ editable: true,
63
+ required: false,
64
+ },
65
+ placeholder: {
66
+ group: GROUPS.basic,
67
+ label: "Placeholder",
68
+ description: "Input placeholder text",
69
+ formType: FORM_TYPES.string,
70
+ propType: PROP_TYPES.STRING,
71
+ defaultValue: "Search for...",
72
+ editable: true,
73
+ required: false,
74
+ },
75
+ onSubmit: {
76
+ group: GROUPS.basic,
77
+ label: "Submit action",
78
+ description: "Action to execute on submission",
79
+ editable: true,
80
+ required: false,
81
+ formType: FORM_TYPES.action,
82
+ propType: PROP_TYPES.STRING,
83
+ defaultValue: null,
84
+ },
85
+ fieldName: {
86
+ ...FIELD_NAME,
87
+ defaultValue: "searchBarValue",
88
+ },
89
+ },
90
+ layout: {},
91
+ },
92
+ ];
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import { Text, StyleSheet } from "react-native";
3
+ import { extractStyles } from "../utilities";
4
+ import Touchable from "./Touchable";
5
+ export default function FormRow({ disabled, direction, children, label, style, onPress, ...rest }) {
6
+ const { textStyles, viewStyles } = extractStyles(style);
7
+ return (React.createElement(Touchable, { disabled: disabled, onPress: onPress, style: [styles.row, { flexDirection: direction }, viewStyles], ...rest },
8
+ React.createElement(Text, { style: textStyles }, label),
9
+ children));
10
+ }
11
+ const styles = StyleSheet.create({
12
+ row: {
13
+ marginLeft: 8,
14
+ marginRight: 8,
15
+ flexDirection: "row",
16
+ justifyContent: "space-between",
17
+ alignItems: "center",
18
+ },
19
+ });
@@ -0,0 +1,44 @@
1
+ import * as React from "react";
2
+ import { View, Text, StyleSheet, } from "react-native";
3
+ import { withTheme } from "../theming";
4
+ import Divider from "./Divider";
5
+ import Touchable from "./Touchable";
6
+ import Config from "./Config";
7
+ const Header = ({ Icon, titleTypeStyle, titleColor, title, buttonText, dividerTopMargin, icon, onPress, style, theme: { colors, typography }, }) => {
8
+ return (React.createElement(View, { style: [styles.container, style] },
9
+ React.createElement(View, { style: styles.topContainer },
10
+ React.createElement(Text, { style: [
11
+ titleTypeStyle,
12
+ {
13
+ color: titleColor,
14
+ flex: 1,
15
+ },
16
+ ], numberOfLines: 1 }, title),
17
+ onPress && (React.createElement(Touchable, { style: { alignSelf: "center", marginLeft: 12 }, onPress: onPress },
18
+ React.createElement(View, { style: styles.buttonContainer },
19
+ React.createElement(Text, { style: [
20
+ typography.subtitle2,
21
+ {
22
+ color: colors.light,
23
+ marginRight: 8,
24
+ },
25
+ ], numberOfLines: 1 }, buttonText),
26
+ React.createElement(Icon, { name: icon, size: Config.headerIconSize, color: colors.light }))))),
27
+ React.createElement(Divider, { style: { marginTop: dividerTopMargin || 16 } })));
28
+ };
29
+ const styles = StyleSheet.create({
30
+ container: {
31
+ alignSelf: "stretch",
32
+ },
33
+ topContainer: {
34
+ flexDirection: "row",
35
+ justifyContent: "space-between",
36
+ alignItems: "center",
37
+ },
38
+ buttonContainer: {
39
+ flexDirection: "row",
40
+ justifyContent: "center",
41
+ alignItems: "center",
42
+ },
43
+ });
44
+ export default withTheme(Header);
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { withTheme } from "../theming";
3
+ import { COMPONENT_TYPES, createIconProp, createTextProp, createActionProp, Triggers, } from "@draftbit/types";
4
+ import Header from "./Header";
5
+ const HeaderLarge = ({ Icon, title, buttonText, icon, onPress = () => { }, style, theme: { colors, typography }, }) => {
6
+ return (React.createElement(Header, { Icon: Icon, titleTypeStyle: typography.headline4, titleColor: colors.strong, title: title, buttonText: buttonText, icon: icon, onPress: onPress, style: style }));
7
+ };
8
+ export default withTheme(HeaderLarge);
9
+ export const SEED_DATA = [
10
+ {
11
+ name: "Header Large",
12
+ tag: "HeaderLarge",
13
+ description: "A large header with an optional touchable right aligned text and icon.",
14
+ category: COMPONENT_TYPES.header,
15
+ layout: {},
16
+ triggers: [Triggers.OnPress],
17
+ props: {
18
+ onPress: createActionProp(),
19
+ title: createTextProp({
20
+ label: "Title",
21
+ description: "Text to display",
22
+ defaultValue: "Title",
23
+ }),
24
+ buttonText: createTextProp({
25
+ label: "Button text",
26
+ description: "Right aligned button text to display",
27
+ defaultValue: "See All",
28
+ }),
29
+ icon: createIconProp({
30
+ defaultValue: null,
31
+ required: false,
32
+ }),
33
+ },
34
+ },
35
+ ];
@@ -0,0 +1,61 @@
1
+ import * as React from "react";
2
+ import { withTheme } from "../theming";
3
+ import { GROUPS, COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, } from "@draftbit/types";
4
+ import Header from "./Header";
5
+ const HeaderMedium = ({ Icon, title, buttonText, icon, onPress = () => { }, style, theme: { colors, typography }, }) => {
6
+ return (React.createElement(Header, { Icon: Icon, titleTypeStyle: typography.headline6, titleColor: colors.strong, title: title, buttonText: buttonText, icon: icon, onPress: onPress, style: style }));
7
+ };
8
+ export default withTheme(HeaderMedium);
9
+ export const SEED_DATA = [
10
+ {
11
+ name: "Header Medium",
12
+ tag: "HeaderMedium",
13
+ description: "A medium header with an optional touchable right aligned text and icon.",
14
+ category: COMPONENT_TYPES.header,
15
+ preview_image_url: "{CLOUDINARY_URL}/Header_HeadlineMediumIconText.png",
16
+ supports_list_render: false,
17
+ props: {
18
+ title: {
19
+ group: GROUPS.data,
20
+ label: "Title",
21
+ description: "Text to display",
22
+ formType: FORM_TYPES.string,
23
+ propType: PROP_TYPES.STRING,
24
+ defaultValue: "Title",
25
+ editable: true,
26
+ required: false,
27
+ },
28
+ buttonText: {
29
+ group: GROUPS.data,
30
+ label: "Button text",
31
+ description: "Right aligned button text to display",
32
+ formType: FORM_TYPES.string,
33
+ propType: PROP_TYPES.STRING,
34
+ defaultValue: "See All",
35
+ editable: true,
36
+ required: false,
37
+ },
38
+ icon: {
39
+ group: GROUPS.basic,
40
+ label: "Icon",
41
+ description: "Name of icon to display",
42
+ formType: FORM_TYPES.icon,
43
+ propType: PROP_TYPES.ASSET,
44
+ defaultValue: null,
45
+ editable: true,
46
+ required: false,
47
+ },
48
+ onPress: {
49
+ group: GROUPS.basic,
50
+ label: "Action",
51
+ description: "Action to execute when button pressed",
52
+ editable: true,
53
+ required: false,
54
+ formType: FORM_TYPES.action,
55
+ propType: PROP_TYPES.STRING,
56
+ defaultValue: null,
57
+ },
58
+ },
59
+ layout: {},
60
+ },
61
+ ];