@draftbit/core 43.2.5-7c0f30.3 → 43.2.5-8bfd16.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 (52) hide show
  1. package/lib/commonjs/components/DeprecatedCardWrapper.js +14 -2
  2. package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
  3. package/lib/commonjs/components/DeprecatedFAB.js +4 -20
  4. package/lib/commonjs/components/DeprecatedFAB.js.map +1 -1
  5. package/lib/commonjs/components/Divider.js +3 -13
  6. package/lib/commonjs/components/Divider.js.map +1 -1
  7. package/lib/commonjs/components/TabView/TabView.js +103 -0
  8. package/lib/commonjs/components/TabView/TabView.js.map +1 -0
  9. package/lib/commonjs/components/TabView/TabViewItem.js +27 -0
  10. package/lib/commonjs/components/TabView/TabViewItem.js.map +1 -0
  11. package/lib/commonjs/components/TabView/index.js +24 -0
  12. package/lib/commonjs/components/TabView/index.js.map +1 -0
  13. package/lib/commonjs/index.js +14 -8
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
  16. package/lib/commonjs/mappings/TabView.js +80 -0
  17. package/lib/commonjs/mappings/TabView.js.map +1 -0
  18. package/lib/module/components/RowBodyIcon.js.map +1 -1
  19. package/lib/module/components/TabView/TabView.js +88 -0
  20. package/lib/module/components/TabView/TabView.js.map +1 -0
  21. package/lib/module/components/TabView/TabViewItem.js +19 -0
  22. package/lib/module/components/TabView/TabViewItem.js.map +1 -0
  23. package/lib/module/components/TabView/index.js +3 -0
  24. package/lib/module/components/TabView/index.js.map +1 -0
  25. package/lib/module/components/TextField.js +24 -7
  26. package/lib/module/components/TextField.js.map +1 -1
  27. package/lib/module/index.js +1 -1
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/module/mappings/TabView.js +71 -0
  30. package/lib/module/mappings/TabView.js.map +1 -0
  31. package/lib/typescript/src/components/TabView/TabView.d.ts +19 -0
  32. package/lib/typescript/src/components/TabView/TabViewItem.d.ts +10 -0
  33. package/lib/typescript/src/components/TabView/index.d.ts +2 -0
  34. package/lib/typescript/src/index.d.ts +1 -1
  35. package/lib/typescript/src/{components/LinearGradient.d.ts → mappings/TabView.d.ts} +52 -49
  36. package/package.json +4 -3
  37. package/src/components/TabView/TabView.js +33 -0
  38. package/src/components/TabView/TabView.tsx +97 -0
  39. package/src/components/TabView/TabViewItem.js +5 -0
  40. package/src/components/TabView/TabViewItem.tsx +21 -0
  41. package/src/components/TabView/index.js +2 -0
  42. package/src/components/TabView/index.ts +2 -0
  43. package/src/index.js +1 -1
  44. package/src/index.tsx +1 -1
  45. package/src/mappings/TabView.js +73 -0
  46. package/src/mappings/TabView.ts +80 -0
  47. package/lib/commonjs/components/LinearGradient.js +0 -127
  48. package/lib/commonjs/components/LinearGradient.js.map +0 -1
  49. package/lib/module/components/LinearGradient.js +0 -111
  50. package/lib/module/components/LinearGradient.js.map +0 -1
  51. package/src/components/LinearGradient.js +0 -84
  52. package/src/components/LinearGradient.tsx +0 -119
@@ -1,108 +1,111 @@
1
- /// <reference types="react" />
2
- import { StyleProp, ViewStyle } from "react-native";
3
- declare type Props = {
4
- color1: string;
5
- color2: string;
6
- color3: string;
7
- startX: number;
8
- startY: number;
9
- endX: number;
10
- endY: number;
11
- children?: any;
12
- style?: StyleProp<ViewStyle>;
13
- };
14
- declare const LinearGradientComp: ({ children, color1, color2, color3, startX, startY, endX, endY, style, }: Props) => JSX.Element;
15
- export default LinearGradientComp;
16
- export declare const SEED_DATA: {
1
+ export declare const SEED_DATA: ({
17
2
  name: string;
18
3
  tag: string;
19
- description: string;
4
+ category: string;
5
+ layout: {};
20
6
  props: {
21
- color1: {
7
+ tabBarPosition: {
22
8
  group: string;
23
9
  label: string;
24
10
  description: string;
25
11
  editable: boolean;
26
12
  required: boolean;
27
- defaultValue: null;
28
13
  formType: string;
29
14
  propType: string;
15
+ defaultValue: null;
16
+ options: never[];
30
17
  };
31
- color2: {
18
+ keyboardDismissMode: {
32
19
  group: string;
33
20
  label: string;
34
21
  description: string;
35
22
  editable: boolean;
36
23
  required: boolean;
37
- defaultValue: null;
38
24
  formType: string;
39
25
  propType: string;
26
+ defaultValue: null;
27
+ options: never[];
40
28
  };
41
- color3: {
42
- group: string;
29
+ swipeEnabled: {
43
30
  label: string;
44
31
  description: string;
32
+ formType: string;
33
+ propType: string;
34
+ defaultValue: boolean;
45
35
  editable: boolean;
46
36
  required: boolean;
47
- defaultValue: null;
37
+ group: string;
38
+ };
39
+ scrollEnabled: {
40
+ label: string;
41
+ description: string;
48
42
  formType: string;
49
43
  propType: string;
44
+ defaultValue: boolean;
45
+ editable: boolean;
46
+ required: boolean;
47
+ group: string;
50
48
  };
51
- startX: {
49
+ activeColor: {
52
50
  group: string;
53
51
  label: string;
54
52
  description: string;
55
53
  editable: boolean;
56
54
  required: boolean;
57
- defaultValue: number;
58
- min: number;
59
- max: number;
60
- step: number;
61
- precision: number;
55
+ defaultValue: null;
62
56
  formType: string;
63
57
  propType: string;
64
58
  };
65
- startY: {
59
+ inactiveColor: {
66
60
  group: string;
67
61
  label: string;
68
62
  description: string;
69
63
  editable: boolean;
70
64
  required: boolean;
71
- defaultValue: number;
72
- min: number;
73
- max: number;
74
- step: number;
75
- precision: number;
65
+ defaultValue: null;
76
66
  formType: string;
77
67
  propType: string;
78
68
  };
79
- endX: {
69
+ pressColor: {
80
70
  group: string;
81
71
  label: string;
82
72
  description: string;
83
73
  editable: boolean;
84
74
  required: boolean;
85
- defaultValue: number;
86
- min: number;
87
- max: number;
88
- step: number;
89
- precision: number;
75
+ defaultValue: null;
90
76
  formType: string;
91
77
  propType: string;
92
78
  };
93
- endY: {
79
+ indicatorColor: {
94
80
  group: string;
95
81
  label: string;
96
82
  description: string;
97
83
  editable: boolean;
98
84
  required: boolean;
99
- defaultValue: number;
100
- min: number;
101
- max: number;
102
- step: number;
103
- precision: number;
85
+ defaultValue: null;
104
86
  formType: string;
105
87
  propType: string;
106
88
  };
89
+ title?: undefined;
90
+ id?: undefined;
91
+ accessibilityLabel?: undefined;
92
+ };
93
+ } | {
94
+ name: string;
95
+ tag: string;
96
+ category: string;
97
+ layout: {};
98
+ props: {
99
+ title: any;
100
+ id: any;
101
+ accessibilityLabel: any;
102
+ tabBarPosition?: undefined;
103
+ keyboardDismissMode?: undefined;
104
+ swipeEnabled?: undefined;
105
+ scrollEnabled?: undefined;
106
+ activeColor?: undefined;
107
+ inactiveColor?: undefined;
108
+ pressColor?: undefined;
109
+ indicatorColor?: undefined;
107
110
  };
108
- };
111
+ })[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "43.2.5-7c0f30.3+7c0f300b",
3
+ "version": "43.2.5-8bfd16.3+8bfd16fb",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -49,11 +49,12 @@
49
49
  "color": "^3.1.2",
50
50
  "date-fns": "^2.16.1",
51
51
  "dateformat": "^3.0.3",
52
- "expo-linear-gradient": "^9.2.0",
53
52
  "lodash.isnumber": "^3.0.3",
54
53
  "lodash.omit": "^4.5.0",
55
54
  "lodash.tonumber": "^4.0.3",
56
55
  "react-native-modal-datetime-picker": "^13.0.0",
56
+ "react-native-pager-view": "^5.4.9",
57
+ "react-native-tab-view": "^3.1.1",
57
58
  "react-native-typography": "^1.4.1",
58
59
  "react-native-web-swiper": "^2.2.1"
59
60
  },
@@ -80,5 +81,5 @@
80
81
  ]
81
82
  ]
82
83
  },
83
- "gitHead": "7c0f300b2632db799a0a07953a50109f3eaaabd4"
84
+ "gitHead": "8bfd16fb7313352b593393880414accf83e65557"
84
85
  }
@@ -0,0 +1,33 @@
1
+ import * as React from "react";
2
+ import { TabView, TabBar, SceneMap } from "react-native-tab-view";
3
+ // import { withTheme } from "../../theming";
4
+ import TabViewItem from "./TabViewItem";
5
+ const TabViewComponent = ({ Icon, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, style, children, }) => {
6
+ const [index, setIndex] = React.useState(0);
7
+ const [routes, setRoutes] = React.useState([]);
8
+ const [tabScenes, setTabScenes] = React.useState({});
9
+ React.useEffect(() => {
10
+ const newRoutes = [];
11
+ const scenes = {};
12
+ React.Children.toArray(children)
13
+ .filter((child) => child.type === TabViewItem)
14
+ .forEach((child) => {
15
+ if (child?.props?.id) {
16
+ newRoutes.push({
17
+ key: child?.props?.id,
18
+ ...child?.props,
19
+ });
20
+ scenes[child?.props?.id] = () => child;
21
+ }
22
+ });
23
+ setRoutes(newRoutes);
24
+ setTabScenes(scenes);
25
+ }, [children]);
26
+ const indexChangeHandler = (i) => setIndex(i);
27
+ const renderTabBar = (props) => {
28
+ console.log(props);
29
+ return (React.createElement(TabBar, { ...props, activeColor: activeColor, inactiveColor: inactiveColor, pressColor: pressColor, scrollEnabled: scrollEnabled, indicatorStyle: { backgroundColor: indicatorColor }, renderIcon: ({ route, color }) => route?.icon ? (React.createElement(Icon, { name: route.icon, color: color, size: 36 })) : null, style: style }));
30
+ };
31
+ return (React.createElement(TabView, { navigationState: { index, routes }, renderScene: SceneMap(tabScenes), renderTabBar: renderTabBar, onIndexChange: indexChangeHandler, tabBarPosition: tabBarPosition, keyboardDismissMode: keyboardDismissMode, swipeEnabled: swipeEnabled }));
32
+ };
33
+ export default TabViewComponent;
@@ -0,0 +1,97 @@
1
+ import * as React from "react";
2
+ import { StyleProp, TextStyle, ViewStyle } from "react-native";
3
+ import { TabView, TabBar, SceneMap } from "react-native-tab-view";
4
+
5
+ // import { withTheme } from "../../theming";
6
+ import TabViewItem from "./TabViewItem";
7
+ import type { IconSlot } from "../../interfaces/Icon";
8
+
9
+ type TabBarPosition = "top" | "bottom";
10
+ type KeyboardDismissMode = "none" | "auto" | "on-drag";
11
+
12
+ type TabViewProps = {
13
+ tabBarPosition?: TabBarPosition;
14
+ keyboardDismissMode?: KeyboardDismissMode;
15
+ swipeEnabled?: boolean;
16
+ scrollEnabled?: boolean;
17
+ activeColor?: string;
18
+ inactiveColor?: string;
19
+ pressColor?: string;
20
+ indicatorColor?: string;
21
+ style?: StyleProp<TextStyle | ViewStyle>;
22
+ children: React.ReactNode;
23
+ } & IconSlot;
24
+
25
+ const TabViewComponent = ({
26
+ Icon,
27
+ tabBarPosition,
28
+ keyboardDismissMode,
29
+ swipeEnabled,
30
+ scrollEnabled,
31
+ activeColor,
32
+ inactiveColor,
33
+ pressColor,
34
+ indicatorColor,
35
+ style,
36
+ children,
37
+ }: TabViewProps) => {
38
+ const [index, setIndex] = React.useState(0);
39
+ const [routes, setRoutes] = React.useState([]);
40
+ const [tabScenes, setTabScenes] = React.useState({});
41
+
42
+ React.useEffect(() => {
43
+ const newRoutes: any = [];
44
+ const scenes: any = {};
45
+
46
+ React.Children.toArray(children)
47
+ .filter((child: any) => child.type === TabViewItem)
48
+ .forEach((child: any) => {
49
+ if (child?.props?.id) {
50
+ newRoutes.push({
51
+ key: child?.props?.id,
52
+ ...child?.props,
53
+ });
54
+ scenes[child?.props?.id] = () => child;
55
+ }
56
+ });
57
+
58
+ setRoutes(newRoutes);
59
+ setTabScenes(scenes);
60
+ }, [children]);
61
+
62
+ const indexChangeHandler = (i: any) => setIndex(i);
63
+
64
+ const renderTabBar = (props: any) => {
65
+ console.log(props);
66
+ return (
67
+ <TabBar
68
+ {...props}
69
+ activeColor={activeColor}
70
+ inactiveColor={inactiveColor}
71
+ pressColor={pressColor}
72
+ scrollEnabled={scrollEnabled}
73
+ indicatorStyle={{ backgroundColor: indicatorColor }}
74
+ renderIcon={({ route, color }) =>
75
+ route?.icon ? (
76
+ <Icon name={route.icon} color={color} size={36} />
77
+ ) : null
78
+ }
79
+ style={style}
80
+ />
81
+ );
82
+ };
83
+
84
+ return (
85
+ <TabView
86
+ navigationState={{ index, routes }}
87
+ renderScene={SceneMap(tabScenes)}
88
+ renderTabBar={renderTabBar}
89
+ onIndexChange={indexChangeHandler}
90
+ tabBarPosition={tabBarPosition}
91
+ keyboardDismissMode={keyboardDismissMode}
92
+ swipeEnabled={swipeEnabled}
93
+ />
94
+ );
95
+ };
96
+
97
+ export default TabViewComponent;
@@ -0,0 +1,5 @@
1
+ const TabViewItem = ({ title, id, icon, children, accessibilityLabel, }) => {
2
+ console.log({ title, id, icon, accessibilityLabel });
3
+ return children;
4
+ };
5
+ export default TabViewItem;
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ interface TabViewItemProps {
3
+ title: string;
4
+ id: string;
5
+ icon: string;
6
+ accessibilityLabel: string;
7
+ children: React.ReactNode;
8
+ }
9
+
10
+ const TabViewItem = ({
11
+ title,
12
+ id,
13
+ icon,
14
+ children,
15
+ accessibilityLabel,
16
+ }: TabViewItemProps) => {
17
+ console.log({ title, id, icon, accessibilityLabel });
18
+ return children;
19
+ };
20
+
21
+ export default TabViewItem;
@@ -0,0 +1,2 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
@@ -0,0 +1,2 @@
1
+ export { default as TabView } from "./TabView";
2
+ export { default as TabViewItem } from "./TabViewItem";
package/src/index.js CHANGED
@@ -25,9 +25,9 @@ export { default as TextField } from "./components/TextField";
25
25
  export { default as ToggleButton } from "./components/ToggleButton";
26
26
  export { default as Touchable } from "./components/Touchable";
27
27
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
28
- export { default as LinearGradient } from "./components/LinearGradient";
29
28
  export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
30
29
  export { Swiper, SwiperItem } from "./components/Swiper";
30
+ export { TabView, TabViewItem } from "./components/TabView";
31
31
  export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
32
32
  export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
33
33
  /* Deprecated: Fix or Delete! */
package/src/index.tsx CHANGED
@@ -26,13 +26,13 @@ export { default as TextField } from "./components/TextField";
26
26
  export { default as ToggleButton } from "./components/ToggleButton";
27
27
  export { default as Touchable } from "./components/Touchable";
28
28
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
29
- export { default as LinearGradient } from "./components/LinearGradient";
30
29
  export {
31
30
  ActionSheet,
32
31
  ActionSheetItem,
33
32
  ActionSheetCancel,
34
33
  } from "./components/ActionSheet";
35
34
  export { Swiper, SwiperItem } from "./components/Swiper";
35
+ export { TabView, TabViewItem } from "./components/TabView";
36
36
 
37
37
  export {
38
38
  Center,
@@ -0,0 +1,73 @@
1
+ import { COMPONENT_TYPES, createTextProp, createTextEnumProp, createBoolProp, createColorProp, } from "@draftbit/types";
2
+ export const SEED_DATA = [
3
+ {
4
+ name: "TabView",
5
+ tag: "TabView",
6
+ category: COMPONENT_TYPES.container,
7
+ layout: {},
8
+ props: {
9
+ tabBarPosition: createTextEnumProp({
10
+ label: "Tab Bar Position",
11
+ description: "Tab Bar Position",
12
+ options: ["top", "bottom"],
13
+ defaultValue: "top",
14
+ }),
15
+ keyboardDismissMode: createTextEnumProp({
16
+ label: "Keyboard Dismiss Mode",
17
+ description: "Keyboard Dismiss Mode",
18
+ options: ["auto", "on-drag", "none"],
19
+ defaultValue: "auto",
20
+ }),
21
+ swipeEnabled: createBoolProp({
22
+ label: "Swipe Enabled",
23
+ description: "Swipe Enabled",
24
+ defaultValue: true,
25
+ }),
26
+ scrollEnabled: createBoolProp({
27
+ label: "Scroll Enabled",
28
+ description: "Scroll Enabled",
29
+ defaultValue: true,
30
+ }),
31
+ activeColor: createColorProp({
32
+ label: "Active Color",
33
+ description: "Active Color",
34
+ defaultValue: "primary",
35
+ }),
36
+ inactiveColor: createColorProp({
37
+ label: "Inactive Color",
38
+ description: "Inactive Color",
39
+ defaultValue: null,
40
+ }),
41
+ pressColor: createColorProp({
42
+ label: "Press Color",
43
+ description: "Press Color",
44
+ defaultValue: null,
45
+ }),
46
+ indicatorColor: createColorProp({
47
+ label: "Indicator Color",
48
+ description: "Indicator Color",
49
+ defaultValue: null,
50
+ }),
51
+ },
52
+ },
53
+ {
54
+ name: "TabViewItem",
55
+ tag: "TabViewItem",
56
+ category: COMPONENT_TYPES.container,
57
+ layout: {},
58
+ props: {
59
+ title: createTextProp({
60
+ label: "Title",
61
+ description: "Tab Title",
62
+ }),
63
+ id: createTextProp({
64
+ label: "Id",
65
+ description: "Tab Id",
66
+ }),
67
+ accessibilityLabel: createTextProp({
68
+ label: "Accessibility Label",
69
+ description: "Accessibility Label",
70
+ }),
71
+ },
72
+ },
73
+ ];
@@ -0,0 +1,80 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ createTextProp,
4
+ createTextEnumProp,
5
+ createBoolProp,
6
+ createColorProp,
7
+ } from "@draftbit/types";
8
+
9
+ export const SEED_DATA = [
10
+ {
11
+ name: "TabView",
12
+ tag: "TabView",
13
+ category: COMPONENT_TYPES.container,
14
+ layout: {},
15
+ props: {
16
+ tabBarPosition: createTextEnumProp({
17
+ label: "Tab Bar Position",
18
+ description: "Tab Bar Position",
19
+ options: ["top", "bottom"],
20
+ defaultValue: "top",
21
+ }),
22
+ keyboardDismissMode: createTextEnumProp({
23
+ label: "Keyboard Dismiss Mode",
24
+ description: "Keyboard Dismiss Mode",
25
+ options: ["auto", "on-drag", "none"],
26
+ defaultValue: "auto",
27
+ }),
28
+ swipeEnabled: createBoolProp({
29
+ label: "Swipe Enabled",
30
+ description: "Swipe Enabled",
31
+ defaultValue: true,
32
+ }),
33
+ scrollEnabled: createBoolProp({
34
+ label: "Scroll Enabled",
35
+ description: "Scroll Enabled",
36
+ defaultValue: true,
37
+ }),
38
+ activeColor: createColorProp({
39
+ label: "Active Color",
40
+ description: "Active Color",
41
+ defaultValue: "primary",
42
+ }),
43
+ inactiveColor: createColorProp({
44
+ label: "Inactive Color",
45
+ description: "Inactive Color",
46
+ defaultValue: null,
47
+ }),
48
+ pressColor: createColorProp({
49
+ label: "Press Color",
50
+ description: "Press Color",
51
+ defaultValue: null,
52
+ }),
53
+ indicatorColor: createColorProp({
54
+ label: "Indicator Color",
55
+ description: "Indicator Color",
56
+ defaultValue: null,
57
+ }),
58
+ },
59
+ },
60
+ {
61
+ name: "TabViewItem",
62
+ tag: "TabViewItem",
63
+ category: COMPONENT_TYPES.container,
64
+ layout: {},
65
+ props: {
66
+ title: createTextProp({
67
+ label: "Title",
68
+ description: "Tab Title",
69
+ }),
70
+ id: createTextProp({
71
+ label: "Id",
72
+ description: "Tab Id",
73
+ }),
74
+ accessibilityLabel: createTextProp({
75
+ label: "Accessibility Label",
76
+ description: "Accessibility Label",
77
+ }),
78
+ },
79
+ },
80
+ ];
@@ -1,127 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.SEED_DATA = void 0;
7
-
8
- var React = _interopRequireWildcard(require("react"));
9
-
10
- var _expoLinearGradient = require("expo-linear-gradient");
11
-
12
- var _utilities = require("../utilities");
13
-
14
- var _types = require("@draftbit/types");
15
-
16
- 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); }
17
-
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
-
20
- const LinearGradientComp = _ref => {
21
- let {
22
- children,
23
- color1,
24
- color2,
25
- color3,
26
- startX = 0,
27
- startY = 0,
28
- endX = 100,
29
- endY = 100,
30
- style
31
- } = _ref;
32
- const {
33
- viewStyles
34
- } = (0, _utilities.extractStyles)(style);
35
- const colors = [color1, color2, color3].filter(color => !!color);
36
- const start = {
37
- x: startX / 100,
38
- y: startY / 100
39
- };
40
- const end = {
41
- x: endX / 100,
42
- y: endY / 100
43
- };
44
- return /*#__PURE__*/React.createElement(_expoLinearGradient.LinearGradient, {
45
- colors: colors,
46
- start: start,
47
- end: end,
48
- style: viewStyles
49
- }, children);
50
- };
51
-
52
- var _default = LinearGradientComp;
53
- exports.default = _default;
54
- const SEED_DATA = {
55
- name: "LinearGradient",
56
- tag: "LinearGradient",
57
- description: "Linear Gradient Component",
58
- props: {
59
- color1: (0, _types.createColorProp)({
60
- label: "Color 1"
61
- }),
62
- color2: (0, _types.createColorProp)({
63
- label: "Color 2"
64
- }),
65
- color3: (0, _types.createColorProp)({
66
- label: "Color 3"
67
- }),
68
- startX: {
69
- group: _types.GROUPS.basic,
70
- label: "Start X",
71
- description: "Start position from Left",
72
- editable: true,
73
- required: false,
74
- defaultValue: 0,
75
- min: 0,
76
- max: 100,
77
- step: 1,
78
- precision: 0,
79
- formType: _types.FORM_TYPES.number,
80
- propType: _types.PROP_TYPES.NUMBER
81
- },
82
- startY: {
83
- group: _types.GROUPS.basic,
84
- label: "Start Y",
85
- description: "Start position from Top",
86
- editable: true,
87
- required: false,
88
- defaultValue: 0,
89
- min: 0,
90
- max: 100,
91
- step: 1,
92
- precision: 0,
93
- formType: _types.FORM_TYPES.number,
94
- propType: _types.PROP_TYPES.NUMBER
95
- },
96
- endX: {
97
- group: _types.GROUPS.basic,
98
- label: "End Y",
99
- description: "End position from Right",
100
- editable: true,
101
- required: false,
102
- defaultValue: 100,
103
- min: 0,
104
- max: 100,
105
- step: 1,
106
- precision: 0,
107
- formType: _types.FORM_TYPES.number,
108
- propType: _types.PROP_TYPES.NUMBER
109
- },
110
- endY: {
111
- group: _types.GROUPS.basic,
112
- label: "End Y",
113
- description: "End position from Bottom",
114
- editable: true,
115
- required: false,
116
- defaultValue: 100,
117
- min: 0,
118
- max: 100,
119
- step: 1,
120
- precision: 0,
121
- formType: _types.FORM_TYPES.number,
122
- propType: _types.PROP_TYPES.NUMBER
123
- }
124
- }
125
- };
126
- exports.SEED_DATA = SEED_DATA;
127
- //# sourceMappingURL=LinearGradient.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["LinearGradient.tsx"],"names":["LinearGradientComp","children","color1","color2","color3","startX","startY","endX","endY","style","viewStyles","colors","filter","color","start","x","y","end","SEED_DATA","name","tag","description","props","label","group","GROUPS","basic","editable","required","defaultValue","min","max","step","precision","formType","FORM_TYPES","number","propType","PROP_TYPES","NUMBER"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;;;;;AAmBA,MAAMA,kBAAkB,GAAG,QAUd;AAAA,MAVe;AAC1BC,IAAAA,QAD0B;AAE1BC,IAAAA,MAF0B;AAG1BC,IAAAA,MAH0B;AAI1BC,IAAAA,MAJ0B;AAK1BC,IAAAA,MAAM,GAAG,CALiB;AAM1BC,IAAAA,MAAM,GAAG,CANiB;AAO1BC,IAAAA,IAAI,GAAG,GAPmB;AAQ1BC,IAAAA,IAAI,GAAG,GARmB;AAS1BC,IAAAA;AAT0B,GAUf;AACX,QAAM;AAAEC,IAAAA;AAAF,MAAiB,8BAAcD,KAAd,CAAvB;AACA,QAAME,MAAM,GAAG,CAACT,MAAD,EAASC,MAAT,EAAiBC,MAAjB,EAAyBQ,MAAzB,CAAiCC,KAAD,IAAmB,CAAC,CAACA,KAArD,CAAf;AACA,QAAMC,KAAK,GAAG;AAAEC,IAAAA,CAAC,EAAEV,MAAM,GAAG,GAAd;AAAmBW,IAAAA,CAAC,EAAEV,MAAM,GAAG;AAA/B,GAAd;AACA,QAAMW,GAAG,GAAG;AAAEF,IAAAA,CAAC,EAAER,IAAI,GAAG,GAAZ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AAJgB,CAAlB","sourcesContent":["import * as React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\nimport { LinearGradient } from \"expo-linear-gradient\";\nimport { extractStyles } from \"../utilities\";\nimport {\n createColorProp,\n FORM_TYPES,\n GROUPS,\n PROP_TYPES,\n} from \"@draftbit/types\";\n\ntype Props = {\n color1: string;\n color2: string;\n color3: string;\n startX: number;\n startY: number;\n endX: number;\n endY: number;\n children?: any;\n style?: StyleProp<ViewStyle>;\n};\n\nconst LinearGradientComp = ({\n children,\n color1,\n color2,\n color3,\n startX = 0,\n startY = 0,\n endX = 100,\n endY = 100,\n style,\n}: Props) => {\n const { viewStyles } = extractStyles(style);\n const colors = [color1, color2, color3].filter((color: string) => !!color);\n const start = { x: startX / 100, y: startY / 100 };\n const end = { x: endX / 100, y: endY / 100 };\n return (\n <LinearGradient colors={colors} start={start} end={end} style={viewStyles}>\n {children}\n </LinearGradient>\n );\n};\n\nexport default LinearGradientComp;\n\nexport const SEED_DATA = {\n name: \"LinearGradient\",\n tag: \"LinearGradient\",\n description: \"Linear Gradient Component\",\n props: {\n color1: createColorProp({\n label: \"Color 1\",\n }),\n color2: createColorProp({\n label: \"Color 2\",\n }),\n color3: createColorProp({\n label: \"Color 3\",\n }),\n startX: {\n group: GROUPS.basic,\n label: \"Start X\",\n description: \"Start position from Left\",\n editable: true,\n required: false,\n defaultValue: 0,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n startY: {\n group: GROUPS.basic,\n label: \"Start Y\",\n description: \"Start position from Top\",\n editable: true,\n required: false,\n defaultValue: 0,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n endX: {\n group: GROUPS.basic,\n label: \"End Y\",\n description: \"End position from Right\",\n editable: true,\n required: false,\n defaultValue: 100,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n endY: {\n group: GROUPS.basic,\n label: \"End Y\",\n description: \"End position from Bottom\",\n editable: true,\n required: false,\n defaultValue: 100,\n min: 0,\n max: 100,\n step: 1,\n precision: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n },\n },\n};\n"]}