@draftbit/core 46.4.4-5206b0.2 → 46.4.4-5ec738.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.
@@ -17,8 +17,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
17
17
 
18
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
19
 
20
- 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); }
21
-
22
20
  const AnimatedProgress = _reactNative.Animated.createAnimatedComponent(_CircularProgress.default);
23
21
 
24
22
  const AnimatedCircularProgress = _ref => {
@@ -69,6 +67,18 @@ const AnimatedCircularProgress = _ref => {
69
67
  React.useEffect(() => {
70
68
  animate();
71
69
  }, [fill, animate]);
70
+ return /*#__PURE__*/React.createElement(AnimatedProgress, { ...other,
71
+ style: other.style,
72
+ childrenContainerStyle: other.childrenContainerStyle,
73
+ fill: fillAnimation,
74
+ tintColor: animateColor()
75
+ });
76
+ };
77
+
78
+ var _default = AnimatedCircularProgress;
79
+ exports.default = _default;eEffect(() => {
80
+ animate();
81
+ }, [fill, animate]);
72
82
  return /*#__PURE__*/React.createElement(AnimatedProgress, _extends({}, other, {
73
83
  style: other.style,
74
84
  childrenContainerStyle: other.childrenContainerStyle,
@@ -13,26 +13,29 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
13
13
 
14
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
+ 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; }
17
+
16
18
  /**
17
19
  * Portal host is the component which actually renders all Portals.
18
20
  */
19
21
  class PortalManager extends React.PureComponent {
20
22
  constructor() {
21
23
  super(...arguments);
22
- this.state = {
24
+
25
+ _defineProperty(this, "state", {
23
26
  portals: []
24
- };
27
+ });
25
28
 
26
- this.mount = (key, children) => {
29
+ _defineProperty(this, "mount", (key, children) => {
27
30
  this.setState(state => ({
28
31
  portals: [...state.portals, {
29
32
  key,
30
33
  children
31
34
  }]
32
35
  }));
33
- };
36
+ });
34
37
 
35
- this.update = (key, children) => this.setState(state => ({
38
+ _defineProperty(this, "update", (key, children) => this.setState(state => ({
36
39
  portals: state.portals.map(item => {
37
40
  if (item.key === key) {
38
41
  return { ...item,
@@ -42,11 +45,11 @@ class PortalManager extends React.PureComponent {
42
45
 
43
46
  return item;
44
47
  })
45
- }));
48
+ })));
46
49
 
47
- this.unmount = key => this.setState(state => ({
50
+ _defineProperty(this, "unmount", key => this.setState(state => ({
48
51
  portals: state.portals.filter(item => item.key !== key)
49
- }));
52
+ })));
50
53
  }
51
54
 
52
55
  render() {
@@ -68,15 +71,4 @@ class PortalManager extends React.PureComponent {
68
71
 
69
72
  }
70
73
 
71
- exports.default = PortalManager;le: false
72
- /* Need collapsable=false here to clip the elevations, otherwise they appear above sibling components */
73
- ,
74
- pointerEvents: "box-none",
75
- style: _reactNative.StyleSheet.absoluteFill
76
- }, children);
77
- });
78
- }
79
-
80
- }
81
-
82
74
  exports.default = PortalManager;
@@ -15,6 +15,8 @@ var _theming = require("../theming");
15
15
 
16
16
  var _IconButton = _interopRequireDefault(require("./IconButton"));
17
17
 
18
+ var _utilities = require("../utilities");
19
+
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
21
 
20
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -28,7 +30,6 @@ const Stepper = _ref => {
28
30
  value: valueProp,
29
31
  defaultValue,
30
32
  style,
31
- typeStyle,
32
33
  iconSize = 24,
33
34
  iconColor,
34
35
  onChange,
@@ -38,6 +39,10 @@ const Stepper = _ref => {
38
39
  },
39
40
  Icon
40
41
  } = _ref;
42
+ const {
43
+ viewStyles,
44
+ textStyles
45
+ } = (0, _utilities.extractStyles)(style);
41
46
  const [value, setValue] = (0, _react.useState)(defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0);
42
47
 
43
48
  const isValidValue = valueArg => valueArg >= min && valueArg <= max;
@@ -60,7 +65,7 @@ const Stepper = _ref => {
60
65
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
61
66
  style: [{
62
67
  flexDirection: "row"
63
- }, style]
68
+ }, viewStyles]
64
69
  }, /*#__PURE__*/_react.default.createElement(_IconButton.default, {
65
70
  Icon: Icon,
66
71
  icon: "MaterialIcons/remove",
@@ -77,7 +82,7 @@ const Stepper = _ref => {
77
82
  alignSelf: "center",
78
83
  color: colors.medium,
79
84
  marginHorizontal: 8
80
- }, typeStyle]
85
+ }, textStyles]
81
86
  }, value), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
82
87
  Icon: Icon,
83
88
  icon: "MaterialIcons/add",
@@ -16,4 +16,4 @@ const APPROX_STATUSBAR_HEIGHT = _reactNative.Platform.select({
16
16
  ios: _reactNative.Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
17
17
  });
18
18
 
19
- exports.APPROX_STATUSBAR_HEIGHT = APPROX_STATUSBAR_HEIGHT;AR_HEIGHT;
19
+ exports.APPROX_STATUSBAR_HEIGHT = APPROX_STATUSBAR_HEIGHT;
@@ -12,7 +12,7 @@ const SEED_DATA = [{
12
12
  tag: "Stepper",
13
13
  description: "A component used to control the quantity of something",
14
14
  category: _types.COMPONENT_TYPES.control,
15
- stylesPanelSections: _types.BLOCK_STYLES_SECTIONS,
15
+ stylesPanelSections: [..._types.BLOCK_STYLES_SECTIONS, _types.StylesPanelSections.Typography],
16
16
  layout: {},
17
17
  triggers: [_types.Triggers.OnChange],
18
18
  props: {
@@ -1,5 +1,3 @@
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
1
  import * as React from "react";
4
2
  import { ActivityIndicator, View, StyleSheet } from "react-native";
5
3
  import color from "color";
@@ -110,7 +108,7 @@ const FAB = _ref => {
110
108
  style: [{
111
109
  elevation
112
110
  }, style]
113
- }, /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
111
+ }, /*#__PURE__*/React.createElement(Touchable, { ...rest,
114
112
  onPress: onPress,
115
113
  accessibilityState: {
116
114
  disabled
@@ -118,7 +116,7 @@ const FAB = _ref => {
118
116
  accessibilityRole: "button",
119
117
  disabled: disabled || loading,
120
118
  style: buttonStyles
121
- }), /*#__PURE__*/React.createElement(View, {
119
+ }, /*#__PURE__*/React.createElement(View, {
122
120
  style: styles.content
123
121
  }, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
124
122
  style: iconStyle
@@ -158,4 +156,24 @@ const styles = StyleSheet.create({
158
156
  borderRadius: 0
159
157
  }
160
158
  });
159
+ export default withTheme(FAB);erStyle: "solid"
160
+ },
161
+ content: {
162
+ flexDirection: "row",
163
+ alignItems: "center",
164
+ justifyContent: "center"
165
+ },
166
+ icon: {
167
+ alignItems: "center",
168
+ justifyContent: "center",
169
+ width: Config.buttonIconSize
170
+ },
171
+ fixed: {
172
+ left: 0,
173
+ right: 0,
174
+ bottom: 0,
175
+ height: 64,
176
+ borderRadius: 0
177
+ }
178
+ });
161
179
  export default withTheme(FAB);
@@ -3,6 +3,7 @@ import { View, Text } from "react-native";
3
3
  import { isNumber } from "lodash";
4
4
  import { withTheme } from "../theming";
5
5
  import IconButton from "./IconButton";
6
+ import { extractStyles } from "../utilities";
6
7
 
7
8
  const Stepper = _ref => {
8
9
  let {
@@ -11,7 +12,6 @@ const Stepper = _ref => {
11
12
  value: valueProp,
12
13
  defaultValue,
13
14
  style,
14
- typeStyle,
15
15
  iconSize = 24,
16
16
  iconColor,
17
17
  onChange,
@@ -21,6 +21,10 @@ const Stepper = _ref => {
21
21
  },
22
22
  Icon
23
23
  } = _ref;
24
+ const {
25
+ viewStyles,
26
+ textStyles
27
+ } = extractStyles(style);
24
28
  const [value, setValue] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0);
25
29
 
26
30
  const isValidValue = valueArg => valueArg >= min && valueArg <= max;
@@ -43,7 +47,7 @@ const Stepper = _ref => {
43
47
  return /*#__PURE__*/React.createElement(View, {
44
48
  style: [{
45
49
  flexDirection: "row"
46
- }, style]
50
+ }, viewStyles]
47
51
  }, /*#__PURE__*/React.createElement(IconButton, {
48
52
  Icon: Icon,
49
53
  icon: "MaterialIcons/remove",
@@ -60,7 +64,7 @@ const Stepper = _ref => {
60
64
  alignSelf: "center",
61
65
  color: colors.medium,
62
66
  marginHorizontal: 8
63
- }, typeStyle]
67
+ }, textStyles]
64
68
  }, value), /*#__PURE__*/React.createElement(IconButton, {
65
69
  Icon: Icon,
66
70
  icon: "MaterialIcons/add",
@@ -5,4 +5,5 @@ 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
8
9
  });
@@ -1,10 +1,10 @@
1
- import { COMPONENT_TYPES, createIconSizeProp, createColorProp, createFieldNameProp, createStaticNumberProp, Triggers, BLOCK_STYLES_SECTIONS } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createIconSizeProp, createColorProp, createFieldNameProp, createStaticNumberProp, Triggers, BLOCK_STYLES_SECTIONS, StylesPanelSections } from "@draftbit/types";
2
2
  export const SEED_DATA = [{
3
3
  name: "Stepper",
4
4
  tag: "Stepper",
5
5
  description: "A component used to control the quantity of something",
6
6
  category: COMPONENT_TYPES.control,
7
- stylesPanelSections: BLOCK_STYLES_SECTIONS,
7
+ stylesPanelSections: [...BLOCK_STYLES_SECTIONS, StylesPanelSections.Typography],
8
8
  layout: {},
9
9
  triggers: [Triggers.OnChange],
10
10
  props: {
@@ -7,8 +7,7 @@ declare type Props = {
7
7
  max: number;
8
8
  value?: number;
9
9
  defaultValue?: number;
10
- style?: StyleProp<ViewStyle>;
11
- typeStyle?: StyleProp<TextStyle>;
10
+ style?: StyleProp<ViewStyle | TextStyle>;
12
11
  iconSize: number;
13
12
  iconColor?: string;
14
13
  onChange?: (value: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.4.4-5206b0.2+5206b00",
3
+ "version": "46.4.4-5ec738.2+5ec738b",
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.4.4-5206b0.2+5206b00",
44
+ "@draftbit/types": "^46.4.4-5ec738.2+5ec738b",
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",
@@ -81,5 +81,5 @@
81
81
  ]
82
82
  ]
83
83
  },
84
- "gitHead": "5206b0041de0cb36f5211e9bac66c4b94fdbb594"
84
+ "gitHead": "5ec738bf09d2e9c64fe5c0f75666944239b8975c"
85
85
  }
@@ -3,7 +3,9 @@ import { View, Text } from "react-native";
3
3
  import { isNumber } from "lodash";
4
4
  import { withTheme } from "../theming";
5
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, }) => {
6
+ import { extractStyles } from "../utilities";
7
+ const Stepper = ({ min = -Infinity, max = Infinity, value: valueProp, defaultValue, style, iconSize = 24, iconColor, onChange, theme: { colors, typography }, Icon, }) => {
8
+ const { viewStyles, textStyles } = extractStyles(style);
7
9
  const [value, setValue] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0);
8
10
  const isValidValue = (valueArg) => valueArg >= min && valueArg <= max;
9
11
  const handlePlusOrMinus = (type) => {
@@ -22,7 +24,7 @@ const Stepper = ({ min = -Infinity, max = Infinity, value: valueProp, defaultVal
22
24
  }
23
25
  // eslint-disable-next-line react-hooks/exhaustive-deps
24
26
  }, [valueProp]);
25
- return (React.createElement(View, { style: [{ flexDirection: "row" }, style] },
27
+ return (React.createElement(View, { style: [{ flexDirection: "row" }, viewStyles] },
26
28
  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
29
  React.createElement(Text, { style: [
28
30
  typography.body1,
@@ -32,7 +34,7 @@ const Stepper = ({ min = -Infinity, max = Infinity, value: valueProp, defaultVal
32
34
  color: colors.medium,
33
35
  marginHorizontal: 8,
34
36
  },
35
- typeStyle,
37
+ textStyles,
36
38
  ] }, value),
37
39
  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
40
  };
@@ -6,14 +6,14 @@ import { withTheme } from "../theming";
6
6
  import type { Theme } from "../styles/DefaultTheme";
7
7
  import type { IconSlot } from "../interfaces/Icon";
8
8
  import IconButton from "./IconButton";
9
+ import { extractStyles } from "../utilities";
9
10
 
10
11
  type Props = {
11
12
  min: number;
12
13
  max: number;
13
14
  value?: number;
14
15
  defaultValue?: number;
15
- style?: StyleProp<ViewStyle>;
16
- typeStyle?: StyleProp<TextStyle>;
16
+ style?: StyleProp<ViewStyle | TextStyle>;
17
17
  iconSize: number;
18
18
  iconColor?: string;
19
19
  onChange?: (value: number) => void;
@@ -26,13 +26,13 @@ const Stepper: FC<Props> = ({
26
26
  value: valueProp,
27
27
  defaultValue,
28
28
  style,
29
- typeStyle,
30
29
  iconSize = 24,
31
30
  iconColor,
32
31
  onChange,
33
32
  theme: { colors, typography },
34
33
  Icon,
35
34
  }) => {
35
+ const { viewStyles, textStyles } = extractStyles(style);
36
36
  const [value, setValue] = useState(defaultValue ?? 0);
37
37
 
38
38
  const isValidValue = (valueArg: number) => valueArg >= min && valueArg <= max;
@@ -59,7 +59,7 @@ const Stepper: FC<Props> = ({
59
59
  }, [valueProp]);
60
60
 
61
61
  return (
62
- <View style={[{ flexDirection: "row" }, style]}>
62
+ <View style={[{ flexDirection: "row" }, viewStyles]}>
63
63
  <IconButton
64
64
  Icon={Icon}
65
65
  icon="MaterialIcons/remove"
@@ -79,7 +79,7 @@ const Stepper: FC<Props> = ({
79
79
  color: colors.medium,
80
80
  marginHorizontal: 8,
81
81
  },
82
- typeStyle,
82
+ textStyles,
83
83
  ]}
84
84
  >
85
85
  {value}
@@ -1,11 +1,14 @@
1
- import { COMPONENT_TYPES, createIconSizeProp, createColorProp, createFieldNameProp, createStaticNumberProp, Triggers, BLOCK_STYLES_SECTIONS, } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createIconSizeProp, createColorProp, createFieldNameProp, createStaticNumberProp, Triggers, BLOCK_STYLES_SECTIONS, StylesPanelSections, } from "@draftbit/types";
2
2
  export const SEED_DATA = [
3
3
  {
4
4
  name: "Stepper",
5
5
  tag: "Stepper",
6
6
  description: "A component used to control the quantity of something",
7
7
  category: COMPONENT_TYPES.control,
8
- stylesPanelSections: BLOCK_STYLES_SECTIONS,
8
+ stylesPanelSections: [
9
+ ...BLOCK_STYLES_SECTIONS,
10
+ StylesPanelSections.Typography,
11
+ ],
9
12
  layout: {},
10
13
  triggers: [Triggers.OnChange],
11
14
  props: {
@@ -6,6 +6,7 @@ import {
6
6
  createStaticNumberProp,
7
7
  Triggers,
8
8
  BLOCK_STYLES_SECTIONS,
9
+ StylesPanelSections,
9
10
  } from "@draftbit/types";
10
11
 
11
12
  export const SEED_DATA = [
@@ -14,7 +15,10 @@ export const SEED_DATA = [
14
15
  tag: "Stepper",
15
16
  description: "A component used to control the quantity of something",
16
17
  category: COMPONENT_TYPES.control,
17
- stylesPanelSections: BLOCK_STYLES_SECTIONS,
18
+ stylesPanelSections: [
19
+ ...BLOCK_STYLES_SECTIONS,
20
+ StylesPanelSections.Typography,
21
+ ],
18
22
  layout: {},
19
23
  triggers: [Triggers.OnChange],
20
24
  props: {