@draftbit/core 48.4.1-87073a.2 → 48.4.2-91140d.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 (27) hide show
  1. package/lib/commonjs/components/Layout/Center.js +1 -1
  2. package/lib/commonjs/components/Layout/Circle.js +1 -1
  3. package/lib/commonjs/components/Layout/LayoutCommon.js +1 -0
  4. package/lib/commonjs/components/Layout/Square.js +1 -1
  5. package/lib/typescript/src/components/Layout/Center.js +3 -1
  6. package/lib/typescript/src/components/Layout/Center.js.map +1 -1
  7. package/lib/typescript/src/components/Layout/Circle.js +4 -1
  8. package/lib/typescript/src/components/Layout/Circle.js.map +1 -1
  9. package/lib/typescript/src/components/Layout/LayoutCommon.d.ts +15 -0
  10. package/lib/typescript/src/components/Layout/LayoutCommon.js +8 -0
  11. package/lib/typescript/src/components/Layout/LayoutCommon.js.map +1 -0
  12. package/lib/typescript/src/components/Layout/Square.js +4 -0
  13. package/lib/typescript/src/components/Layout/Square.js.map +1 -1
  14. package/lib/typescript/tsconfig.tsbuildinfo +1 -1
  15. package/package.json +3 -3
  16. package/src/components/Layout/Center.js +3 -1
  17. package/src/components/Layout/Center.js.map +1 -1
  18. package/src/components/Layout/Center.tsx +5 -1
  19. package/src/components/Layout/Circle.js +4 -1
  20. package/src/components/Layout/Circle.js.map +1 -1
  21. package/src/components/Layout/Circle.tsx +14 -1
  22. package/src/components/Layout/LayoutCommon.js +8 -0
  23. package/src/components/Layout/LayoutCommon.js.map +1 -0
  24. package/src/components/Layout/LayoutCommon.ts +25 -0
  25. package/src/components/Layout/Square.js +4 -0
  26. package/src/components/Layout/Square.js.map +1 -1
  27. package/src/components/Layout/Square.tsx +7 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "48.4.1-87073a.2+87073a0",
3
+ "version": "48.4.2-91140d.2+91140d8",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "types": "lib/typescript/src/index.d.ts",
@@ -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": "^48.4.1-87073a.2+87073a0",
44
+ "@draftbit/types": "^48.4.2-91140d.2+91140d8",
45
45
  "@expo/vector-icons": "^13.0.0",
46
46
  "@material-ui/core": "^4.11.0",
47
47
  "@material-ui/pickers": "^3.2.10",
@@ -100,5 +100,5 @@
100
100
  ],
101
101
  "testEnvironment": "node"
102
102
  },
103
- "gitHead": "87073a0c7cf622e54f39549d291bf00acc8cb521"
103
+ "gitHead": "91140d874c87d209cb4f2073ddf92b7418768545"
104
104
  }
@@ -1,7 +1,9 @@
1
1
  import React from "react";
2
2
  import { View, StyleSheet } from "react-native";
3
+ import { convertBackwardCompatiblePropsToStyle } from "./LayoutCommon";
3
4
  const Center = ({ style, ...rest }) => {
4
- return React.createElement(View, { ...rest, style: [styles.center, style] });
5
+ const backwardsCompatibleStyle = convertBackwardCompatiblePropsToStyle(rest);
6
+ return (React.createElement(View, { ...rest, style: [styles.center, backwardsCompatibleStyle, style] }));
5
7
  };
6
8
  const styles = StyleSheet.create({
7
9
  center: {
@@ -1 +1 @@
1
- {"version":3,"file":"Center.js","sourceRoot":"","sources":["Center.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAa,UAAU,EAAE,MAAM,cAAc,CAAC;AAE3D,MAAM,MAAM,GAAwB,CAAC,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACzD,OAAO,oBAAC,IAAI,OAAK,IAAI,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAI,CAAC;AAC3D,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE;QACN,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;CACF,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Center.js","sourceRoot":"","sources":["Center.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAa,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,gBAAgB,CAAC;AAEvE,MAAM,MAAM,GAAwB,CAAC,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACzD,MAAM,wBAAwB,GAAG,qCAAqC,CAAC,IAAI,CAAC,CAAC;IAC7E,OAAO,CACL,oBAAC,IAAI,OAAK,IAAI,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,wBAAwB,EAAE,KAAK,CAAC,GAAI,CAC5E,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE;QACN,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;CACF,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -1,8 +1,12 @@
1
1
  import React from "react";
2
2
  import { View, ViewProps, StyleSheet } from "react-native";
3
+ import { convertBackwardCompatiblePropsToStyle } from "./LayoutCommon";
3
4
 
4
5
  const Center: React.FC<ViewProps> = ({ style, ...rest }) => {
5
- return <View {...rest} style={[styles.center, style]} />;
6
+ const backwardsCompatibleStyle = convertBackwardCompatiblePropsToStyle(rest);
7
+ return (
8
+ <View {...rest} style={[styles.center, backwardsCompatibleStyle, style]} />
9
+ );
6
10
  };
7
11
 
8
12
  const styles = StyleSheet.create({
@@ -1,8 +1,11 @@
1
1
  import React from "react";
2
2
  import { StyleSheet } from "react-native";
3
3
  import Square from "./Square";
4
+ import { pick } from "lodash";
5
+ import { convertBackwardCompatiblePropsToStyle } from "./LayoutCommon";
4
6
  const Circle = ({ size, style, ...rest }) => {
5
- return React.createElement(Square, { ...rest, size: size, style: [style, styles.circle] });
7
+ const backwardsCompatibleStyle = pick(convertBackwardCompatiblePropsToStyle(rest), "backgroundColor");
8
+ return (React.createElement(Square, { ...rest, size: size, style: [backwardsCompatibleStyle, style, styles.circle] }));
6
9
  };
7
10
  const styles = StyleSheet.create({
8
11
  circle: {
@@ -1 +1 @@
1
- {"version":3,"file":"Circle.js","sourceRoot":"","sources":["Circle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,MAAM,MAAM,UAAU,CAAC;AAM9B,MAAM,MAAM,GAA0B,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACjE,OAAO,oBAAC,MAAM,OAAK,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,GAAI,CAAC;AACzE,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE;QACN,YAAY,EAAE,IAAI,EAAE,gGAAgG;KACrH;CACF,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Circle.js","sourceRoot":"","sources":["Circle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,qCAAqC,EAAE,MAAM,gBAAgB,CAAC;AAMvE,MAAM,MAAM,GAA0B,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IACjE,MAAM,wBAAwB,GAAG,IAAI,CACnC,qCAAqC,CAAC,IAAI,CAAC,EAC3C,iBAAiB,CAClB,CAAC;IAEF,OAAO,CACL,oBAAC,MAAM,OACD,IAAI,EACR,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,CAAC,wBAAwB,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,GACvD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE;QACN,YAAY,EAAE,IAAI,EAAE,gGAAgG;KACrH;CACF,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -1,13 +1,26 @@
1
1
  import React from "react";
2
2
  import { ViewProps, StyleSheet } from "react-native";
3
3
  import Square from "./Square";
4
+ import { pick } from "lodash";
5
+ import { convertBackwardCompatiblePropsToStyle } from "./LayoutCommon";
4
6
 
5
7
  interface CircleProps extends ViewProps {
6
8
  size?: number;
7
9
  }
8
10
 
9
11
  const Circle: React.FC<CircleProps> = ({ size, style, ...rest }) => {
10
- return <Square {...rest} size={size} style={[style, styles.circle]} />;
12
+ const backwardsCompatibleStyle = pick(
13
+ convertBackwardCompatiblePropsToStyle(rest),
14
+ "backgroundColor"
15
+ );
16
+
17
+ return (
18
+ <Square
19
+ {...rest}
20
+ size={size}
21
+ style={[backwardsCompatibleStyle, style, styles.circle]}
22
+ />
23
+ );
11
24
  };
12
25
 
13
26
  const styles = StyleSheet.create({
@@ -0,0 +1,8 @@
1
+ export function convertBackwardCompatiblePropsToStyle(props) {
2
+ return {
3
+ width: props.width,
4
+ height: props.height,
5
+ backgroundColor: props.bgColor,
6
+ };
7
+ }
8
+ //# sourceMappingURL=LayoutCommon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LayoutCommon.js","sourceRoot":"","sources":["LayoutCommon.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,qCAAqC,CACnD,KAA2C;IAE3C,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,eAAe,EAAE,KAAK,CAAC,OAAO;KAC/B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { ViewProps, ViewStyle } from "react-native";
2
+
3
+ /**
4
+ * Old and deprecated layout components of the same names had props that have since been removed
5
+ * This maintains correct rendering when using the older/deprecated props as to not break existing usage
6
+ * (See: deprecared-components/Layout)
7
+ *
8
+ * These deprecated props are not exposed in the component type to discourage their usage
9
+ */
10
+
11
+ interface BackwardsCompatibleProps {
12
+ width?: number;
13
+ height?: number;
14
+ bgColor?: string;
15
+ }
16
+
17
+ export function convertBackwardCompatiblePropsToStyle(
18
+ props: BackwardsCompatibleProps & ViewProps
19
+ ): ViewStyle {
20
+ return {
21
+ width: props.width,
22
+ height: props.height,
23
+ backgroundColor: props.bgColor,
24
+ };
25
+ }
@@ -1,12 +1,16 @@
1
1
  import React from "react";
2
2
  import Center from "./Center";
3
+ import { pick } from "lodash";
4
+ import { convertBackwardCompatiblePropsToStyle } from "./LayoutCommon";
3
5
  const Square = ({ size, style, onLayout, ...rest }) => {
4
6
  const [calculatedSize, setCalculatedSize] = React.useState(0);
7
+ const backwardsCompatibleStyle = pick(convertBackwardCompatiblePropsToStyle(rest), "backgroundColor");
5
8
  return (React.createElement(Center, { onLayout: (e) => {
6
9
  const layout = e.nativeEvent.layout;
7
10
  setCalculatedSize(Math.max(layout.width, layout.height));
8
11
  onLayout === null || onLayout === void 0 ? void 0 : onLayout(e);
9
12
  }, ...rest, style: [
13
+ backwardsCompatibleStyle,
10
14
  style,
11
15
  size != undefined ? { width: size, height: size } : {},
12
16
  calculatedSize > 0
@@ -1 +1 @@
1
- {"version":3,"file":"Square.js","sourceRoot":"","sources":["Square.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,MAAM,MAAM,UAAU,CAAC;AAM9B,MAAM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B,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC9D,MAAM,wBAAwB,GAAG,IAAI,CACnC,qCAAqC,CAAC,IAAI,CAAC,EAC3C,iBAAiB,CAClB,CAAC;IAEF,OAAO,CACL,oBAAC,MAAM,IACL,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC;YACpC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;YACzD,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,CAAC,CAAC,CAAC;QAChB,CAAC,KACG,IAAI,EACR,KAAK,EAAE;YACL,wBAAwB;YACxB,KAAK;YACL,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;YACtD,cAAc,GAAG,CAAC;gBAChB,CAAC,CAAC;oBACE,KAAK,EAAE,cAAc;oBACrB,MAAM,EAAE,cAAc;iBACvB;gBACH,CAAC,CAAC,EAAE;SACP,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import React from "react";
2
2
  import { ViewProps } from "react-native";
3
3
  import Center from "./Center";
4
+ import { pick } from "lodash";
5
+ import { convertBackwardCompatiblePropsToStyle } from "./LayoutCommon";
4
6
 
5
7
  interface SquareProps extends ViewProps {
6
8
  size?: number;
@@ -8,6 +10,10 @@ interface SquareProps extends ViewProps {
8
10
 
9
11
  const Square: React.FC<SquareProps> = ({ size, style, onLayout, ...rest }) => {
10
12
  const [calculatedSize, setCalculatedSize] = React.useState(0);
13
+ const backwardsCompatibleStyle = pick(
14
+ convertBackwardCompatiblePropsToStyle(rest),
15
+ "backgroundColor"
16
+ );
11
17
 
12
18
  return (
13
19
  <Center
@@ -18,6 +24,7 @@ const Square: React.FC<SquareProps> = ({ size, style, onLayout, ...rest }) => {
18
24
  }}
19
25
  {...rest}
20
26
  style={[
27
+ backwardsCompatibleStyle,
21
28
  style,
22
29
  size != undefined ? { width: size, height: size } : {},
23
30
  calculatedSize > 0