@draftbit/core 46.2.4-7028ac.5 → 46.2.4-710cbc.10

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 (44) hide show
  1. package/lib/commonjs/components/CardContainer.js +5 -15
  2. package/lib/commonjs/components/CircleImage.js +2 -16
  3. package/lib/commonjs/components/DeprecatedButton.js +4 -22
  4. package/lib/commonjs/components/IconButton.js +5 -22
  5. package/lib/commonjs/components/Image.js +3 -16
  6. package/lib/commonjs/components/Portal/Portal.js +3 -12
  7. package/lib/commonjs/components/Portal/PortalConsumer.js +8 -10
  8. package/lib/commonjs/components/RadioButton/RadioButtonRow.js +6 -24
  9. package/lib/commonjs/components/RadioButton/context.js +1 -1
  10. package/lib/commonjs/components/StarRating.js +0 -1
  11. package/lib/commonjs/components/Switch.js +10 -23
  12. package/lib/commonjs/constants.js +1 -1
  13. package/lib/commonjs/mappings/FlashList.js +42 -0
  14. package/lib/commonjs/mappings/SVG.js +0 -1
  15. package/lib/module/components/AspectRatio.js +19 -2
  16. package/lib/module/components/Banner.js +4 -24
  17. package/lib/module/components/CardBlock.js +5 -15
  18. package/lib/module/components/CardContainer.js +15 -5
  19. package/lib/module/components/CardContainerShortImage.js +19 -5
  20. package/lib/module/components/Carousel.js +35 -10
  21. package/lib/module/components/Checkbox/CheckboxGroup.js +3 -17
  22. package/lib/module/components/Checkbox/context.js +1 -1
  23. package/lib/module/components/IconButton.js +5 -22
  24. package/lib/module/components/Picker/PickerComponent.android.js +5 -23
  25. package/lib/module/components/Picker/PickerComponent.web.js +5 -23
  26. package/lib/module/components/ProgressBar.js +7 -23
  27. package/lib/module/components/Slider.js +22 -5
  28. package/lib/module/components/StarRating.js +5 -25
  29. package/lib/module/components/Surface.js +2 -16
  30. package/lib/module/components/Text.js +10 -33
  31. package/lib/module/components/TextField.js +30 -62
  32. package/lib/module/components/Touchable.js +2 -18
  33. package/lib/module/constants.js +0 -1
  34. package/lib/module/mappings/FlashList.js +33 -0
  35. package/lib/module/mappings/SVG.js +0 -1
  36. package/lib/typescript/src/mappings/FlashList.d.ts +54 -0
  37. package/lib/typescript/src/mappings/SVG.d.ts +0 -1
  38. package/package.json +5 -4
  39. package/src/components/StarRating.js +0 -1
  40. package/src/components/StarRating.tsx +0 -1
  41. package/src/mappings/FlashList.js +33 -0
  42. package/src/mappings/FlashList.ts +41 -0
  43. package/src/mappings/SVG.js +0 -1
  44. package/src/mappings/SVG.ts +0 -1
@@ -1,3 +1,7 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+
1
5
  import * as React from "react";
2
6
  import { View, Animated, TextInput as NativeTextInput, StyleSheet, Text, I18nManager } from "react-native";
3
7
  import { withTheme } from "../theming";
@@ -10,7 +14,8 @@ const ICON_SIZE = 24;
10
14
  class TextField extends React.Component {
11
15
  constructor() {
12
16
  super(...arguments);
13
- this.state = {
17
+
18
+ _defineProperty(this, "state", {
14
19
  labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
15
20
  focused: false,
16
21
  placeholder: this.props.error ? this.props.placeholder : "",
@@ -18,35 +23,36 @@ class TextField extends React.Component {
18
23
  measured: false,
19
24
  width: 0
20
25
  }
21
- };
22
- this._timer = setTimeout(() => {}, 0);
26
+ });
27
+
28
+ _defineProperty(this, "_timer", setTimeout(() => {}, 0));
23
29
 
24
- this._showPlaceholder = () => {
30
+ _defineProperty(this, "_showPlaceholder", () => {
25
31
  clearTimeout(this._timer); // Set the placeholder in a delay to offset the label animation
26
32
  // If we show it immediately, they'll overlap and look ugly
27
33
 
28
34
  this._timer = setTimeout(() => this.setState({
29
35
  placeholder: this.props.placeholder
30
36
  }), 50);
31
- };
37
+ });
32
38
 
33
- this._hidePlaceholder = () => this.setState({
39
+ _defineProperty(this, "_hidePlaceholder", () => this.setState({
34
40
  placeholder: ""
35
- });
41
+ }));
36
42
 
37
- this._restoreLabel = () => Animated.timing(this.state.labeled, {
43
+ _defineProperty(this, "_restoreLabel", () => Animated.timing(this.state.labeled, {
38
44
  toValue: 1,
39
45
  duration: FOCUS_ANIMATION_DURATION,
40
46
  useNativeDriver: true
41
- }).start();
47
+ }).start());
42
48
 
43
- this._minmizeLabel = () => Animated.timing(this.state.labeled, {
49
+ _defineProperty(this, "_minmizeLabel", () => Animated.timing(this.state.labeled, {
44
50
  toValue: 0,
45
51
  duration: BLUR_ANIMATION_DURATION,
46
52
  useNativeDriver: true
47
- }).start();
53
+ }).start());
48
54
 
49
- this._handleFocus = () => {
55
+ _defineProperty(this, "_handleFocus", () => {
50
56
  if (this.props.disabled) {
51
57
  return;
52
58
  }
@@ -54,9 +60,9 @@ class TextField extends React.Component {
54
60
  this.setState({
55
61
  focused: true
56
62
  });
57
- };
63
+ });
58
64
 
59
- this._handleBlur = () => {
65
+ _defineProperty(this, "_handleBlur", () => {
60
66
  if (this.props.disabled) {
61
67
  return;
62
68
  }
@@ -64,9 +70,9 @@ class TextField extends React.Component {
64
70
  this.setState({
65
71
  focused: false
66
72
  });
67
- };
73
+ });
68
74
 
69
- this._handleChangeText = value => {
75
+ _defineProperty(this, "_handleChangeText", value => {
70
76
  if (this.props.disabled) {
71
77
  return;
72
78
  }
@@ -82,9 +88,9 @@ class TextField extends React.Component {
82
88
  });
83
89
  this.props.onChangeText && this.props.onChangeText(value.nativeEvent.text);
84
90
  }
85
- };
91
+ });
86
92
 
87
- this._root = undefined;
93
+ _defineProperty(this, "_root", undefined);
88
94
  }
89
95
 
90
96
  static getDerivedStateFromProps(nextProps, prevState) {
@@ -135,11 +141,10 @@ class TextField extends React.Component {
135
141
  focused: !prevState.focused
136
142
  }));
137
143
  }
144
+
138
145
  /**
139
146
  * @internal
140
147
  */
141
-
142
-
143
148
  setNativeProps(args) {
144
149
  return this._root && this._root.setNativeProps(args);
145
150
  }
@@ -182,8 +187,7 @@ class TextField extends React.Component {
182
187
  roundness,
183
188
  disabledOpacity
184
189
  },
185
- render = props => /*#__PURE__*/React.createElement(NativeTextInput, { ...props
186
- }),
190
+ render = props => /*#__PURE__*/React.createElement(NativeTextInput, props),
187
191
  ...rest
188
192
  } = this.props;
189
193
  const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
@@ -335,9 +339,9 @@ class TextField extends React.Component {
335
339
  } = StyleSheet.flatten(style || {});
336
340
  return /*#__PURE__*/React.createElement(View, {
337
341
  style: [styles.container, styleProp]
338
- }, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, { ...leftIconProps,
342
+ }, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, _extends({}, leftIconProps, {
339
343
  style: leftIconStyle
340
- }) : null, /*#__PURE__*/React.createElement(View, {
344
+ })) : null, /*#__PURE__*/React.createElement(View, {
341
345
  style: applyStyles([containerStyle], {
342
346
  height: style === null || style === void 0 ? void 0 : style.height,
343
347
  backgroundColor: bgColor,
@@ -404,9 +408,9 @@ class TextField extends React.Component {
404
408
  style: {
405
409
  justifyContent: type === "solid" ? "center" : undefined
406
410
  }
407
- }, /*#__PURE__*/React.createElement(Icon, { ...leftIconProps,
411
+ }, /*#__PURE__*/React.createElement(Icon, _extends({}, leftIconProps, {
408
412
  style: leftIconStyle
409
- })) : null, render({
413
+ }))) : null, render({
410
414
  ref: c => {
411
415
  this._root = c;
412
416
  },
@@ -443,42 +447,6 @@ class TextField extends React.Component {
443
447
 
444
448
  }
445
449
 
446
- export default withTheme(TextField);
447
- const styles = StyleSheet.create({
448
- container: {
449
- alignSelf: "stretch"
450
- },
451
- placeholder: {
452
- position: "absolute",
453
- left: 0
454
- },
455
- underline: {
456
- position: "absolute",
457
- left: 0,
458
- right: 0,
459
- bottom: 0,
460
- height: 2
461
- },
462
- input: {
463
- flexGrow: 1,
464
- justifyContent: "center",
465
- textAlignVertical: "center",
466
- margin: 0,
467
- textAlign: I18nManager.isRTL ? "right" : "left"
468
- }
469
- }); "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16
470
- }
471
- }) : null, assistiveText ? /*#__PURE__*/React.createElement(Text, {
472
- style: [{
473
- color: error ? colors.error : colors.light,
474
- marginTop: 8,
475
- marginLeft: assistiveTextLeftMargin
476
- }]
477
- }, assistiveText) : null);
478
- }
479
-
480
- }
481
-
482
450
  export default withTheme(TextField);
483
451
  const styles = StyleSheet.create({
484
452
  container: {
@@ -1,3 +1,5 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
1
3
  import React from "react";
2
4
  import { Pressable } from "react-native";
3
5
  export default function Touchable(_ref) {
@@ -8,24 +10,6 @@ export default function Touchable(_ref) {
8
10
  style,
9
11
  ...props
10
12
  } = _ref;
11
- return /*#__PURE__*/React.createElement(Pressable, {
12
- onPress: onPress,
13
- disabled: disabled,
14
- hitSlop: 8,
15
- style: _ref2 => {
16
- let {
17
- pressed
18
- } = _ref2;
19
- return [{
20
- opacity: pressed || disabled ? 0.75 : 1
21
- }, style];
22
- },
23
- ...props
24
- }, children);
25
- }s,
26
- style,
27
- ...props
28
- } = _ref;
29
13
  return /*#__PURE__*/React.createElement(Pressable, _extends({
30
14
  onPress: onPress,
31
15
  disabled: disabled,
@@ -5,5 +5,4 @@ const DEFAULT_STATUSBAR_HEIGHT_EXPO = expo !== null && expo !== void 0 && expo.C
5
5
  export const APPROX_STATUSBAR_HEIGHT = Platform.select({
6
6
  android: DEFAULT_STATUSBAR_HEIGHT_EXPO,
7
7
  ios: Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
8
- });PO : 0
9
8
  });
@@ -0,0 +1,33 @@
1
+ import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "FlashList",
4
+ tag: "FlashList",
5
+ description: "Flashlist by Shopify",
6
+ packageName: "@shopify/flash-list",
7
+ category: COMPONENT_TYPES.data,
8
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
9
+ layout: {
10
+ flex: 1
11
+ },
12
+ props: {
13
+ estimatedItemSize: createNumberProp({
14
+ group: GROUPS.basic,
15
+ label: "Est. Item Size",
16
+ description: "Approximate size of the items before rendering.",
17
+ defaultValue: 50,
18
+ step: 1,
19
+ precision: 0
20
+ }),
21
+ horizontal: createStaticBoolProp({
22
+ label: "Horizontal",
23
+ description: "Render list horizontally"
24
+ }),
25
+ inverted: createStaticBoolProp({
26
+ label: "Inverted",
27
+ description: "If true, reverses the direction."
28
+ }),
29
+ numColumns: createNumColumnsType({
30
+ editable: true
31
+ })
32
+ }
33
+ };
@@ -3,7 +3,6 @@ export const SEED_DATA = {
3
3
  name: "SVG",
4
4
  tag: "SVG",
5
5
  description: "An SVG component",
6
- packageName: "@draftbit/core",
7
6
  category: COMPONENT_TYPES.media,
8
7
  layout: {
9
8
  width: 100,
@@ -0,0 +1,54 @@
1
+ export declare const SEED_DATA: {
2
+ name: string;
3
+ tag: string;
4
+ description: string;
5
+ packageName: string;
6
+ category: string;
7
+ stylesPanelSections: string[];
8
+ layout: {
9
+ flex: number;
10
+ };
11
+ props: {
12
+ estimatedItemSize: {
13
+ label: string;
14
+ description: string;
15
+ formType: string;
16
+ propType: string;
17
+ group: string;
18
+ defaultValue: null;
19
+ editable: boolean;
20
+ required: boolean;
21
+ step: number;
22
+ };
23
+ horizontal: {
24
+ label: string;
25
+ description: string;
26
+ formType: string;
27
+ propType: string;
28
+ defaultValue: boolean;
29
+ editable: boolean;
30
+ required: boolean;
31
+ group: string;
32
+ };
33
+ inverted: {
34
+ label: string;
35
+ description: string;
36
+ formType: string;
37
+ propType: string;
38
+ defaultValue: boolean;
39
+ editable: boolean;
40
+ required: boolean;
41
+ group: string;
42
+ };
43
+ numColumns: {
44
+ label: string;
45
+ description: string;
46
+ group: string;
47
+ formType: string;
48
+ propType: string;
49
+ defaultValue: number;
50
+ editable: boolean;
51
+ required: boolean;
52
+ };
53
+ };
54
+ };
@@ -2,7 +2,6 @@ export declare const SEED_DATA: {
2
2
  name: string;
3
3
  tag: string;
4
4
  description: string;
5
- packageName: string;
6
5
  category: string;
7
6
  layout: {
8
7
  width: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.2.4-7028ac.5+7028ac76",
3
+ "version": "46.2.4-710cbc.10+710cbc93",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,11 +41,12 @@
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.4-7028ac.5+7028ac76",
44
+ "@draftbit/types": "^46.3.0",
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",
48
48
  "@react-native-picker/picker": "2.4.2",
49
+ "@shopify/flash-list": "1.1.0",
49
50
  "color": "^3.1.2",
50
51
  "date-fns": "^2.16.1",
51
52
  "dateformat": "^3.0.3",
@@ -53,7 +54,7 @@
53
54
  "lodash.omit": "^4.5.0",
54
55
  "lodash.tonumber": "^4.0.3",
55
56
  "react-native-modal-datetime-picker": "^13.0.0",
56
- "react-native-svg": "^12.3.0",
57
+ "react-native-svg": "12.3.0",
57
58
  "react-native-typography": "^1.4.1",
58
59
  "react-native-web-swiper": "^2.2.3"
59
60
  },
@@ -80,5 +81,5 @@
80
81
  ]
81
82
  ]
82
83
  },
83
- "gitHead": "7028ac766b962df851f034e308568aee4df4376a"
84
+ "gitHead": "710cbc93659ee88f995f95167ad63f445cb48a19"
84
85
  }
@@ -27,7 +27,6 @@ const StarRating = ({ Icon, starSize = 16, maxStars = 5, rating = 0, defaultValu
27
27
  React.createElement(Pressable, { style: styles.pressable, onPress: () => ratingHandler(i + 1) }))))))));
28
28
  };
29
29
  const styles = StyleSheet.create({
30
- //comment!
31
30
  container: {
32
31
  flexDirection: "row",
33
32
  alignItems: "center",
@@ -94,7 +94,6 @@ const StarRating: React.FC<React.PropsWithChildren<Props>> = ({
94
94
  };
95
95
 
96
96
  const styles = StyleSheet.create({
97
- //comment!
98
97
  container: {
99
98
  flexDirection: "row",
100
99
  alignItems: "center",
@@ -0,0 +1,33 @@
1
+ import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS, } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "FlashList",
4
+ tag: "FlashList",
5
+ description: "Flashlist by Shopify",
6
+ packageName: "@shopify/flash-list",
7
+ category: COMPONENT_TYPES.data,
8
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
9
+ layout: {
10
+ flex: 1,
11
+ },
12
+ props: {
13
+ estimatedItemSize: createNumberProp({
14
+ group: GROUPS.basic,
15
+ label: "Est. Item Size",
16
+ description: "Approximate size of the items before rendering.",
17
+ defaultValue: 50,
18
+ step: 1,
19
+ precision: 0,
20
+ }),
21
+ horizontal: createStaticBoolProp({
22
+ label: "Horizontal",
23
+ description: "Render list horizontally",
24
+ }),
25
+ inverted: createStaticBoolProp({
26
+ label: "Inverted",
27
+ description: "If true, reverses the direction.",
28
+ }),
29
+ numColumns: createNumColumnsType({
30
+ editable: true,
31
+ }),
32
+ },
33
+ };
@@ -0,0 +1,41 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ createNumColumnsType,
4
+ createStaticBoolProp,
5
+ createNumberProp,
6
+ CONTAINER_COMPONENT_STYLES_SECTIONS,
7
+ GROUPS,
8
+ } from "@draftbit/types";
9
+
10
+ export const SEED_DATA = {
11
+ name: "FlashList",
12
+ tag: "FlashList",
13
+ description: "Flashlist by Shopify",
14
+ packageName: "@shopify/flash-list",
15
+ category: COMPONENT_TYPES.data,
16
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
17
+ layout: {
18
+ flex: 1,
19
+ },
20
+ props: {
21
+ estimatedItemSize: createNumberProp({
22
+ group: GROUPS.basic,
23
+ label: "Est. Item Size",
24
+ description: "Approximate size of the items before rendering.",
25
+ defaultValue: 50,
26
+ step: 1,
27
+ precision: 0,
28
+ }),
29
+ horizontal: createStaticBoolProp({
30
+ label: "Horizontal",
31
+ description: "Render list horizontally",
32
+ }),
33
+ inverted: createStaticBoolProp({
34
+ label: "Inverted",
35
+ description: "If true, reverses the direction.",
36
+ }),
37
+ numColumns: createNumColumnsType({
38
+ editable: true,
39
+ }),
40
+ },
41
+ };
@@ -3,7 +3,6 @@ export const SEED_DATA = {
3
3
  name: "SVG",
4
4
  tag: "SVG",
5
5
  description: "An SVG component",
6
- packageName: "@draftbit/core",
7
6
  category: COMPONENT_TYPES.media,
8
7
  layout: {
9
8
  width: 100,
@@ -8,7 +8,6 @@ export const SEED_DATA = {
8
8
  name: "SVG",
9
9
  tag: "SVG",
10
10
  description: "An SVG component",
11
- packageName: "@draftbit/core",
12
11
  category: COMPONENT_TYPES.media,
13
12
  layout: {
14
13
  width: 100,