@draftbit/core 46.2.3 → 46.2.4-2fc21b.3

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 (61) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +5 -25
  2. package/lib/commonjs/components/Banner.js +24 -4
  3. package/lib/commonjs/components/CardContainer.js +15 -5
  4. package/lib/commonjs/components/Carousel.js +34 -10
  5. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +24 -6
  6. package/lib/commonjs/components/CircularProgress.js +15 -7
  7. package/lib/commonjs/components/Config.js +1 -0
  8. package/lib/commonjs/components/Image.js +16 -3
  9. package/lib/commonjs/components/NumberInput.js +13 -2
  10. package/lib/commonjs/components/Portal/PortalManager.js +19 -11
  11. package/lib/commonjs/components/ProgressBar.js +23 -7
  12. package/lib/commonjs/components/SVG.js +49 -0
  13. package/lib/commonjs/components/Slider.js +24 -5
  14. package/lib/commonjs/components/TextField.js +2 -1
  15. package/lib/commonjs/components/Touchable.js +16 -2
  16. package/lib/commonjs/constants.js +1 -1
  17. package/lib/commonjs/index.js +8 -0
  18. package/lib/commonjs/mappings/Image.js +2 -2
  19. package/lib/commonjs/mappings/NumberInput.js +146 -149
  20. package/lib/commonjs/mappings/SVG.js +23 -0
  21. package/lib/commonjs/mappings/TextArea.js +188 -193
  22. package/lib/commonjs/mappings/TextField.js +7 -8
  23. package/lib/commonjs/mappings/TextInput.js +178 -180
  24. package/lib/module/components/Config.js +1 -0
  25. package/lib/module/components/SVG.js +32 -0
  26. package/lib/module/components/TextField.js +2 -1
  27. package/lib/module/index.js +1 -0
  28. package/lib/module/mappings/Image.js +2 -2
  29. package/lib/module/mappings/NumberInput.js +146 -149
  30. package/lib/module/mappings/SVG.js +14 -0
  31. package/lib/module/mappings/TextArea.js +188 -193
  32. package/lib/module/mappings/TextField.js +7 -8
  33. package/lib/module/mappings/TextInput.js +178 -180
  34. package/lib/typescript/src/components/Config.d.ts +1 -0
  35. package/lib/typescript/src/components/SVG.d.ts +8 -0
  36. package/lib/typescript/src/components/TextField.d.ts +1 -0
  37. package/lib/typescript/src/index.d.ts +1 -0
  38. package/lib/typescript/src/mappings/SVG.d.ts +22 -0
  39. package/lib/typescript/src/mappings/TextArea.d.ts +42 -42
  40. package/lib/typescript/src/mappings/TextField.d.ts +120 -110
  41. package/package.json +4 -3
  42. package/src/components/Config.js +1 -0
  43. package/src/components/Config.ts +1 -0
  44. package/src/components/SVG.js +14 -0
  45. package/src/components/SVG.tsx +35 -0
  46. package/src/components/TextField.js +2 -2
  47. package/src/components/TextField.tsx +3 -1
  48. package/src/index.js +1 -0
  49. package/src/index.tsx +1 -0
  50. package/src/mappings/Image.js +2 -2
  51. package/src/mappings/Image.ts +2 -2
  52. package/src/mappings/NumberInput.js +160 -163
  53. package/src/mappings/NumberInput.ts +165 -168
  54. package/src/mappings/SVG.js +14 -0
  55. package/src/mappings/SVG.ts +15 -0
  56. package/src/mappings/TextArea.js +213 -220
  57. package/src/mappings/TextArea.ts +219 -227
  58. package/src/mappings/TextField.js +6 -9
  59. package/src/mappings/TextField.ts +7 -11
  60. package/src/mappings/TextInput.js +205 -208
  61. package/src/mappings/TextInput.ts +212 -215
@@ -28,68 +28,17 @@ export declare const SEED_DATA: ({
28
28
  formType: string;
29
29
  propType: string;
30
30
  };
31
- secureTextEntry: {
32
- group: string;
33
- label: string;
34
- description: string;
35
- formType: string;
36
- propType: string;
37
- defaultValue: null;
38
- editable: boolean;
39
- required: boolean;
40
- };
41
- label: {
42
- group: string;
43
- label: string;
44
- description: string;
45
- formType: string;
46
- propType: string;
47
- defaultValue: null;
48
- editable: boolean;
49
- required: boolean;
50
- };
51
- assistiveText: {
52
- group: string;
53
- label: string;
54
- description: string;
55
- formType: string;
56
- propType: string;
57
- defaultValue: null;
58
- editable: boolean;
59
- required: boolean;
60
- };
61
- error: {
31
+ activeBorderColor: {
62
32
  group: string;
63
33
  label: string;
64
34
  description: string;
65
- formType: string;
66
- propType: string;
67
- defaultValue: null;
68
35
  editable: boolean;
69
36
  required: boolean;
70
- };
71
- leftIconName: {
72
- group: string;
73
- label: string;
74
- description: string;
75
- formType: string;
76
- propType: string;
77
37
  defaultValue: null;
78
- editable: boolean;
79
- required: boolean;
80
- };
81
- leftIconMode: {
82
- group: string;
83
- label: string;
84
- description: string;
85
38
  formType: string;
86
39
  propType: string;
87
- defaultValue: null;
88
- options: string[];
89
- editable: boolean;
90
- required: boolean;
91
40
  };
92
- rightIconName: {
41
+ secureTextEntry: {
93
42
  group: string;
94
43
  label: string;
95
44
  description: string;
@@ -99,18 +48,6 @@ export declare const SEED_DATA: ({
99
48
  editable: boolean;
100
49
  required: boolean;
101
50
  };
102
- fieldName: {
103
- handlerPropName: string;
104
- defaultValue: string;
105
- group: string;
106
- label: string;
107
- description: string;
108
- formType: string;
109
- propType: string;
110
- valuePropName: string;
111
- editable: boolean;
112
- required: boolean;
113
- };
114
51
  allowFontScaling: {
115
52
  group: string;
116
53
  label: string;
@@ -288,74 +225,58 @@ export declare const SEED_DATA: ({
288
225
  formType: string;
289
226
  propType: string;
290
227
  };
291
- };
292
- layout: {};
293
- stylesPanelSections?: undefined;
294
- } | {
295
- name: string;
296
- tag: string;
297
- description: string;
298
- category: string;
299
- stylesPanelSections: string[];
300
- preview_image_url: string;
301
- supports_list_render: boolean;
302
- triggers: string[];
303
- props: {
304
- placeholder: {
305
- defaultValue: string;
228
+ label: {
306
229
  group: string;
307
230
  label: string;
308
231
  description: string;
309
- editable: boolean;
310
- required: boolean;
311
232
  formType: string;
312
233
  propType: string;
234
+ defaultValue: null;
235
+ editable: boolean;
236
+ required: boolean;
313
237
  };
314
- type: {
238
+ assistiveText: {
239
+ group: string;
315
240
  label: string;
316
241
  description: string;
317
242
  formType: string;
318
243
  propType: string;
319
- defaultValue: string;
320
- options: string[];
244
+ defaultValue: null;
321
245
  editable: boolean;
322
246
  required: boolean;
323
- group: string;
324
247
  };
325
- multiline: {
248
+ error: {
249
+ group: string;
326
250
  label: string;
327
251
  description: string;
328
- group: string;
329
252
  formType: string;
330
253
  propType: string;
331
- defaultValue: boolean;
254
+ defaultValue: null;
332
255
  editable: boolean;
333
256
  required: boolean;
334
257
  };
335
- numberOfLines: {
258
+ leftIconName: {
259
+ group: string;
336
260
  label: string;
337
261
  description: string;
338
262
  formType: string;
339
263
  propType: string;
340
- group: string;
341
264
  defaultValue: null;
342
265
  editable: boolean;
343
266
  required: boolean;
344
- step: number;
345
267
  };
346
- fieldName: {
347
- handlerPropName: string;
268
+ leftIconMode: {
348
269
  group: string;
349
270
  label: string;
350
271
  description: string;
351
272
  formType: string;
352
273
  propType: string;
353
- defaultValue: string;
354
- valuePropName: string;
274
+ defaultValue: null;
275
+ options: string[];
355
276
  editable: boolean;
356
277
  required: boolean;
357
278
  };
358
- label: {
279
+ rightIconName: {
359
280
  group: string;
360
281
  label: string;
361
282
  description: string;
@@ -365,54 +286,72 @@ export declare const SEED_DATA: ({
365
286
  editable: boolean;
366
287
  required: boolean;
367
288
  };
368
- assistiveText: {
289
+ fieldName: {
290
+ handlerPropName: string;
291
+ defaultValue: string;
369
292
  group: string;
370
293
  label: string;
371
294
  description: string;
372
295
  formType: string;
373
296
  propType: string;
374
- defaultValue: null;
297
+ valuePropName: string;
375
298
  editable: boolean;
376
299
  required: boolean;
377
300
  };
378
- error: {
379
- group: string;
301
+ };
302
+ layout: {};
303
+ stylesPanelSections?: undefined;
304
+ } | {
305
+ name: string;
306
+ tag: string;
307
+ description: string;
308
+ category: string;
309
+ stylesPanelSections: string[];
310
+ preview_image_url: string;
311
+ supports_list_render: boolean;
312
+ triggers: string[];
313
+ props: {
314
+ type: {
380
315
  label: string;
381
316
  description: string;
382
317
  formType: string;
383
318
  propType: string;
384
- defaultValue: null;
319
+ defaultValue: string;
320
+ options: string[];
385
321
  editable: boolean;
386
322
  required: boolean;
387
- };
388
- leftIconName: {
389
323
  group: string;
324
+ };
325
+ multiline: {
390
326
  label: string;
391
327
  description: string;
328
+ group: string;
392
329
  formType: string;
393
330
  propType: string;
394
- defaultValue: null;
331
+ defaultValue: boolean;
395
332
  editable: boolean;
396
333
  required: boolean;
397
334
  };
398
- leftIconMode: {
399
- group: string;
335
+ numberOfLines: {
400
336
  label: string;
401
337
  description: string;
402
338
  formType: string;
403
339
  propType: string;
340
+ group: string;
404
341
  defaultValue: null;
405
- options: string[];
406
342
  editable: boolean;
407
343
  required: boolean;
344
+ step: number;
408
345
  };
409
- rightIconName: {
346
+ fieldName: {
347
+ handlerPropName: string;
410
348
  group: string;
411
349
  label: string;
412
350
  description: string;
413
351
  formType: string;
414
352
  propType: string;
415
- defaultValue: null;
353
+ defaultValue: string;
354
+ valuePropName: string;
416
355
  editable: boolean;
417
356
  required: boolean;
418
357
  };
@@ -532,6 +471,16 @@ export declare const SEED_DATA: ({
532
471
  formType: string;
533
472
  propType: string;
534
473
  };
474
+ placeholder: {
475
+ group: string;
476
+ label: string;
477
+ description: string;
478
+ editable: boolean;
479
+ required: boolean;
480
+ defaultValue: string;
481
+ formType: string;
482
+ propType: string;
483
+ };
535
484
  placeholderTextColor: {
536
485
  group: string;
537
486
  label: string;
@@ -593,6 +542,67 @@ export declare const SEED_DATA: ({
593
542
  formType: string;
594
543
  propType: string;
595
544
  };
545
+ label: {
546
+ group: string;
547
+ label: string;
548
+ description: string;
549
+ formType: string;
550
+ propType: string;
551
+ defaultValue: null;
552
+ editable: boolean;
553
+ required: boolean;
554
+ };
555
+ assistiveText: {
556
+ group: string;
557
+ label: string;
558
+ description: string;
559
+ formType: string;
560
+ propType: string;
561
+ defaultValue: null;
562
+ editable: boolean;
563
+ required: boolean;
564
+ };
565
+ error: {
566
+ group: string;
567
+ label: string;
568
+ description: string;
569
+ formType: string;
570
+ propType: string;
571
+ defaultValue: null;
572
+ editable: boolean;
573
+ required: boolean;
574
+ };
575
+ leftIconName: {
576
+ group: string;
577
+ label: string;
578
+ description: string;
579
+ formType: string;
580
+ propType: string;
581
+ defaultValue: null;
582
+ editable: boolean;
583
+ required: boolean;
584
+ };
585
+ leftIconMode: {
586
+ group: string;
587
+ label: string;
588
+ description: string;
589
+ formType: string;
590
+ propType: string;
591
+ defaultValue: null;
592
+ options: string[];
593
+ editable: boolean;
594
+ required: boolean;
595
+ };
596
+ rightIconName: {
597
+ group: string;
598
+ label: string;
599
+ description: string;
600
+ formType: string;
601
+ propType: string;
602
+ defaultValue: null;
603
+ editable: boolean;
604
+ required: boolean;
605
+ };
596
606
  };
597
607
  layout: {};
598
608
  })[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.2.3",
3
+ "version": "46.2.4-2fc21b.3+2fc21b45",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^46.2.3",
44
+ "@draftbit/types": "^46.2.4-2fc21b.3+2fc21b45",
45
45
  "@material-ui/core": "^4.11.0",
46
46
  "@material-ui/pickers": "^3.2.10",
47
47
  "@react-native-community/slider": "4.2.3",
@@ -53,6 +53,7 @@
53
53
  "lodash.omit": "^4.5.0",
54
54
  "lodash.tonumber": "^4.0.3",
55
55
  "react-native-modal-datetime-picker": "^13.0.0",
56
+ "react-native-svg": "^12.3.0",
56
57
  "react-native-typography": "^1.4.1",
57
58
  "react-native-web-swiper": "^2.2.3"
58
59
  },
@@ -79,5 +80,5 @@
79
80
  ]
80
81
  ]
81
82
  },
82
- "gitHead": "9a0a65dfc2aff945da5cbe7db48d07114c8cea7c"
83
+ "gitHead": "2fc21b450f5dc6abb219668f9795e8805d444bc9"
83
84
  }
@@ -42,6 +42,7 @@ export default {
42
42
  cardIconElevation: 1,
43
43
  placeholderImageURL: "https://static.draftbit.com/images/placeholder-image" + getExtension(),
44
44
  getPlaceholderImageUrl: (size) => buildImageUrl({ width: size.width, height: size.height }, "image-placeholder_1"),
45
+ placeholderSvgURL: "https://static.draftbit.com/images/placeholder-svg.svg",
45
46
  squareImageUrl: buildImageUrl({ width: 100, height: 100 }, "Avatar"),
46
47
  FABSize: 40,
47
48
  FABBorderRadius: 20,
@@ -60,6 +60,7 @@ export default {
60
60
  { width: size.width, height: size.height },
61
61
  "image-placeholder_1"
62
62
  ),
63
+ placeholderSvgURL: "https://static.draftbit.com/images/placeholder-svg.svg",
63
64
  squareImageUrl: buildImageUrl({ width: 100, height: 100 }, "Avatar"),
64
65
  FABSize: 40,
65
66
  FABBorderRadius: 20,
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import { View, Platform, Image } from "react-native";
3
+ import { SvgUri } from "react-native-svg";
4
+ import Config from "./Config";
5
+ const SVG = ({ source, style }) => {
6
+ let svgSource = source === null || source === undefined ? Config.placeholderSvgURL : source;
7
+ return (React.createElement(React.Fragment, null,
8
+ Platform.OS === "ios" && (React.createElement(View, { style: style },
9
+ React.createElement(SvgUri, { width: "100%", height: "100%", uri: svgSource }))),
10
+ Platform.OS === "android" && (React.createElement(View, { style: style },
11
+ React.createElement(SvgUri, { width: "100%", height: "100%", uri: svgSource }))),
12
+ Platform.OS === "web" && (React.createElement(Image, { style: style, source: { uri: svgSource } }))));
13
+ };
14
+ export default SVG;
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { View, Platform, Image, StyleProp, ImageStyle } from "react-native";
3
+ import { SvgUri } from "react-native-svg";
4
+
5
+ import Config from "./Config";
6
+
7
+ type SVGComponentProps = {
8
+ source: string;
9
+ style?: StyleProp<ImageStyle>;
10
+ };
11
+
12
+ const SVG = ({ source, style }: SVGComponentProps) => {
13
+ let svgSource =
14
+ source === null || source === undefined ? Config.placeholderSvgURL : source;
15
+
16
+ return (
17
+ <>
18
+ {Platform.OS === "ios" && (
19
+ <View style={style}>
20
+ <SvgUri width="100%" height="100%" uri={svgSource} />
21
+ </View>
22
+ )}
23
+ {Platform.OS === "android" && (
24
+ <View style={style}>
25
+ <SvgUri width="100%" height="100%" uri={svgSource} />
26
+ </View>
27
+ )}
28
+ {Platform.OS === "web" && (
29
+ <Image style={style} source={{ uri: svgSource }} />
30
+ )}
31
+ </>
32
+ );
33
+ };
34
+
35
+ export default SVG;
@@ -136,7 +136,7 @@ class TextField extends React.Component {
136
136
  return this._root && this._root.blur();
137
137
  }
138
138
  render() {
139
- const { Icon, type = "underline", disabled = false, label, error = false, leftIconName, leftIconMode, rightIconName, assistiveText, underlineColor: underlineColorProp, multiline = false, numberOfLines = 4, style, theme: { colors, typography, roundness, disabledOpacity }, render = (props) => React.createElement(NativeTextInput, { ...props }), ...rest } = this.props;
139
+ const { Icon, type = "underline", disabled = false, label, error = false, leftIconName, leftIconMode, rightIconName, assistiveText, underlineColor: underlineColorProp, activeBorderColor: activeBorderColorProp, multiline = false, numberOfLines = 4, style, theme: { colors, typography, roundness, disabledOpacity }, render = (props) => React.createElement(NativeTextInput, { ...props }), ...rest } = this.props;
140
140
  const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
141
141
  const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
142
142
  const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
@@ -152,7 +152,7 @@ class TextField extends React.Component {
152
152
  backgroundColor = colors.divider;
153
153
  }
154
154
  else {
155
- activeColor = error ? colors.error : colors.primary;
155
+ activeColor = error ? colors.error : activeBorderColorProp;
156
156
  placeholderColor = borderColor = colors.light;
157
157
  underlineColor = underlineColorProp;
158
158
  backgroundColor = colors.background;
@@ -42,6 +42,7 @@ export type Props = {
42
42
  multiline?: boolean;
43
43
  numberOfLines: number;
44
44
  underlineColor?: string;
45
+ activeBorderColor?: string;
45
46
  style?: StyleProp<ViewStyle> & { height?: number };
46
47
  theme: Theme;
47
48
  render?: (
@@ -237,6 +238,7 @@ class TextField extends React.Component<Props, State> {
237
238
  rightIconName,
238
239
  assistiveText,
239
240
  underlineColor: underlineColorProp,
241
+ activeBorderColor: activeBorderColorProp,
240
242
  multiline = false,
241
243
  numberOfLines = 4,
242
244
  style,
@@ -269,7 +271,7 @@ class TextField extends React.Component<Props, State> {
269
271
  underlineColor = "transparent";
270
272
  backgroundColor = colors.divider;
271
273
  } else {
272
- activeColor = error ? colors.error : colors.primary;
274
+ activeColor = error ? colors.error : activeBorderColorProp;
273
275
  placeholderColor = borderColor = colors.light;
274
276
  underlineColor = underlineColorProp;
275
277
  backgroundColor = colors.background;
package/src/index.js CHANGED
@@ -17,6 +17,7 @@ export { default as FAB } from "./components/FAB";
17
17
  export { default as FieldSearchBarFull } from "./components/FieldSearchBarFull";
18
18
  export { default as IconButton } from "./components/IconButton";
19
19
  export { default as Image } from "./components/Image";
20
+ export { default as SVG } from "./components/SVG";
20
21
  export { default as NumberInput } from "./components/NumberInput";
21
22
  export { default as ScreenContainer } from "./components/ScreenContainer";
22
23
  export { default as StarRating } from "./components/StarRating";
package/src/index.tsx CHANGED
@@ -18,6 +18,7 @@ export { default as FAB } from "./components/FAB";
18
18
  export { default as FieldSearchBarFull } from "./components/FieldSearchBarFull";
19
19
  export { default as IconButton } from "./components/IconButton";
20
20
  export { default as Image } from "./components/Image";
21
+ export { default as SVG } from "./components/SVG";
21
22
  export { default as NumberInput } from "./components/NumberInput";
22
23
  export { default as ScreenContainer } from "./components/ScreenContainer";
23
24
  export { default as StarRating } from "./components/StarRating";
@@ -11,8 +11,8 @@ export const SEED_DATA = {
11
11
  StylesPanelSections.Effects,
12
12
  ],
13
13
  layout: {
14
- width: 250,
15
- height: 250,
14
+ width: 100,
15
+ height: 100,
16
16
  },
17
17
  props: {
18
18
  source: createImageProp(),
@@ -17,8 +17,8 @@ export const SEED_DATA = {
17
17
  StylesPanelSections.Effects,
18
18
  ],
19
19
  layout: {
20
- width: 250,
21
- height: 250,
20
+ width: 100,
21
+ height: 100,
22
22
  },
23
23
  props: {
24
24
  source: createImageProp(),