@draftbit/core 46.8.1 → 46.8.2-088bf8.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.
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.radioButtonGroupContext = exports.Direction = void 0;
7
7
  exports.useRadioButtonGroupContext = useRadioButtonGroupContext;
8
8
  var _react = require("react");
9
- let Direction;
9
+ var Direction;
10
10
  exports.Direction = Direction;
11
11
  (function (Direction) {
12
12
  Direction["Horizontal"] = "horizontal";
@@ -11,7 +11,6 @@ var _IconButton = _interopRequireDefault(require("./IconButton"));
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
12
  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); }
13
13
  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; }
14
- 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); }
15
14
  const ToggleButton = _ref => {
16
15
  let {
17
16
  Icon,
@@ -47,7 +46,7 @@ const ToggleButton = _ref => {
47
46
  setInternalValue(!internalValue);
48
47
  onPress(!internalValue);
49
48
  };
50
- return /*#__PURE__*/React.createElement(_IconButton.default, _extends({
49
+ return /*#__PURE__*/React.createElement(_IconButton.default, {
51
50
  Icon: Icon,
52
51
  icon: icon,
53
52
  size: iconSize,
@@ -59,6 +58,20 @@ const ToggleButton = _ref => {
59
58
  height,
60
59
  backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
61
60
  borderColor: colors[borderColor]
61
+ }, style],
62
+ ...rest
63
+ });
64
+ };
65
+ const styles = _reactNative.StyleSheet.create({
66
+ mainContainer: {
67
+ borderWidth: 1
68
+ }
69
+ });
70
+ var _default = (0, _theming.withTheme)(ToggleButton);
71
+ exports.default = _default;idth,
72
+ height,
73
+ backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
74
+ borderColor: colors[borderColor]
62
75
  }, style]
63
76
  }, rest));
64
77
  };
@@ -12,4 +12,4 @@ const APPROX_STATUSBAR_HEIGHT = _reactNative.Platform.select({
12
12
  android: DEFAULT_STATUSBAR_HEIGHT_EXPO,
13
13
  ios: _reactNative.Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
14
14
  });
15
- exports.APPROX_STATUSBAR_HEIGHT = APPROX_STATUSBAR_HEIGHT;AR_HEIGHT;
15
+ exports.APPROX_STATUSBAR_HEIGHT = APPROX_STATUSBAR_HEIGHT;
@@ -10,12 +10,11 @@ function usePrevious(value) {
10
10
  // The ref object is a generic container whose current property is mutable
11
11
  // and can hold any value, similar to an instance property on a class
12
12
  const ref = _react.default.useRef();
13
-
14
13
  // Store current value in ref
15
14
  _react.default.useEffect(() => {
16
15
  ref.current = value;
17
16
  }, [value]);
18
-
19
17
  // Return previous value (happens before update in useEffect above)
20
18
  return ref.current;
19
+ }
21
20
  }
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SEED_DATA = void 0;
7
+ var _types = require("@draftbit/types");
8
+ const SEED_DATA_TRIGGERS = [_types.Triggers.OnValueChange];
9
+ const ELEMENT_SEED_DATA = {
10
+ doc_link: "https://www.npmjs.com/package/@expo/html-elements",
11
+ code_link: "https://github.com/expo/expo/tree/master/packages/html-elements",
12
+ packageName: "@expo/html-elements",
13
+ stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.LayoutSelectedItem, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Effects],
14
+ layout: {
15
+ margin: 0
16
+ },
17
+ triggers: SEED_DATA_TRIGGERS,
18
+ category: _types.COMPONENT_TYPES.webelement
19
+ };
20
+ const HEADING_SEED_DATA = {
21
+ ...ELEMENT_SEED_DATA,
22
+ category: _types.COMPONENT_TYPES.text,
23
+ props: {
24
+ accessibilityLabel: {
25
+ group: _types.GROUPS.accessibility,
26
+ name: "accessibilityLabel",
27
+ label: "accessibilityLabel",
28
+ description: "Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space.",
29
+ editable: true,
30
+ required: false,
31
+ formType: _types.FORM_TYPES.string,
32
+ propType: _types.PROP_TYPES.STRING,
33
+ defaultValue: null
34
+ },
35
+ selectable: {
36
+ group: _types.GROUPS.advanced,
37
+ name: "selectable",
38
+ label: "selectable",
39
+ description: "Lets the user select text, to use the native copy and paste functionality.",
40
+ editable: true,
41
+ required: false,
42
+ formType: _types.FORM_TYPES.boolean,
43
+ propType: _types.PROP_TYPES.BOOLEAN,
44
+ defaultValue: null
45
+ },
46
+ children: {
47
+ group: _types.GROUPS.data,
48
+ label: "Text",
49
+ description: "Text",
50
+ editable: true,
51
+ required: true,
52
+ formType: _types.FORM_TYPES.string,
53
+ propType: _types.PROP_TYPES.STRING,
54
+ defaultValue: "Your Headline Here"
55
+ }
56
+ }
57
+ };
58
+ const TEXT_SEED_DATA = {
59
+ ...ELEMENT_SEED_DATA,
60
+ category: _types.COMPONENT_TYPES.text,
61
+ props: {
62
+ children: {
63
+ group: _types.GROUPS.data,
64
+ label: "Text",
65
+ description: "Text",
66
+ defaultValue: "Your Text Here",
67
+ editable: true,
68
+ required: true,
69
+ formType: _types.FORM_TYPES.string,
70
+ propType: _types.PROP_TYPES.STRING
71
+ }
72
+ }
73
+ };
74
+ const SEED_DATA = [{
75
+ name: "H1",
76
+ tag: "H1",
77
+ ...HEADING_SEED_DATA
78
+ }, {
79
+ name: "H2",
80
+ tag: "H2",
81
+ ...HEADING_SEED_DATA
82
+ }, {
83
+ name: "H3",
84
+ tag: "H3",
85
+ ...HEADING_SEED_DATA
86
+ }, {
87
+ name: "H4",
88
+ tag: "H4",
89
+ ...HEADING_SEED_DATA
90
+ }, {
91
+ name: "H5",
92
+ tag: "H5",
93
+ ...HEADING_SEED_DATA
94
+ }, {
95
+ name: "H6",
96
+ tag: "H6",
97
+ ...HEADING_SEED_DATA
98
+ }, {
99
+ name: "Anchor",
100
+ tag: "A",
101
+ ...TEXT_SEED_DATA,
102
+ props: {
103
+ href: (0, _types.createTextProp)({
104
+ label: "href",
105
+ description: "Specify the URL",
106
+ defaultValue: ""
107
+ }),
108
+ target: {
109
+ group: _types.GROUPS.basic,
110
+ label: "target",
111
+ description: "decide where link should open",
112
+ formType: _types.FORM_TYPES.flatArray,
113
+ defaultValue: "_blank",
114
+ options: ["_blank", "_self", "_parent", "_top"]
115
+ }
116
+ }
117
+ }, {
118
+ name: "Paragraph",
119
+ tag: "P",
120
+ ...TEXT_SEED_DATA,
121
+ props: {
122
+ // NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
123
+ // strong: createBoolProp({
124
+ // label: "Strong",
125
+ // description: "Strong",
126
+ // }),
127
+ // strike: createBoolProp({
128
+ // label: "Strike",
129
+ // description: "Strike through",
130
+ // }),
131
+ // italic: createBoolProp({
132
+ // label: "Italic",
133
+ // description: "Italic Fonts",
134
+ // }),
135
+ // bold: createBoolProp({
136
+ // label: "Bold",
137
+ // description: "Bold",
138
+ // }),
139
+ }
140
+ }, {
141
+ name: "Code",
142
+ tag: "Code",
143
+ ...TEXT_SEED_DATA
144
+ }, {
145
+ name: "Pre",
146
+ tag: "Pre",
147
+ ...TEXT_SEED_DATA
148
+ }, {
149
+ name: "Mark",
150
+ tag: "Mark",
151
+ ...TEXT_SEED_DATA
152
+ }, {
153
+ name: "BR",
154
+ tag: "BR",
155
+ ...TEXT_SEED_DATA
156
+ }, {
157
+ name: "BlockQuote",
158
+ tag: "BlockQuote",
159
+ ...TEXT_SEED_DATA
160
+ }, {
161
+ name: "HR",
162
+ tag: "HR",
163
+ ...TEXT_SEED_DATA
164
+ }, {
165
+ name: "Time",
166
+ tag: "Time",
167
+ ...ELEMENT_SEED_DATA
168
+ }, {
169
+ name: "UL",
170
+ tag: "UL",
171
+ ...ELEMENT_SEED_DATA
172
+ }, {
173
+ name: "LI",
174
+ tag: "LI",
175
+ ...ELEMENT_SEED_DATA
176
+ }];
177
+ exports.SEED_DATA = SEED_DATA;
@@ -1,4 +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
1
  import * as React from "react";
3
2
  import { View, StyleSheet } from "react-native";
4
3
  import omit from "lodash.omit";
@@ -8,7 +7,6 @@ import { extractStyles } from "../../utilities";
8
7
  import TextField from "../TextField";
9
8
  import Touchable from "../Touchable";
10
9
  const Picker = _ref => {
11
- var _options$find$label, _options$find;
12
10
  let {
13
11
  style,
14
12
  options,
@@ -18,6 +16,7 @@ const Picker = _ref => {
18
16
  onValueChange: onValueChangeOverride = () => {},
19
17
  ...props
20
18
  } = _ref;
19
+ var _a, _b;
21
20
  const {
22
21
  viewStyles: {
23
22
  borderRadius,
@@ -62,7 +61,7 @@ const Picker = _ref => {
62
61
  };
63
62
 
64
63
  const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
65
- const selectedLabel = selectedValue && ((_options$find$label = (_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : selectedValue);
64
+ const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
66
65
  return /*#__PURE__*/React.createElement(Touchable, {
67
66
  disabled: disabled,
68
67
  onPress: toggleFocus,
@@ -86,18 +85,16 @@ const Picker = _ref => {
86
85
  key: o.value
87
86
  }))), /*#__PURE__*/React.createElement(View, {
88
87
  pointerEvents: "none"
89
- }, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
88
+ }, /*#__PURE__*/React.createElement(TextField, {
89
+ ...props,
90
90
  value: selectedLabel,
91
- placeholder: placeholder
91
+ placeholder: placeholder,
92
92
  // @ts-ignore
93
- ,
94
- ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
95
- ,
96
- disabled: disabled
93
+ ref: textField,
94
+ disabled: disabled,
97
95
  // @ts-expect-error
98
- ,
99
96
  style: stylesWithoutMargin
100
- })))));
97
+ }))));
101
98
  };
102
99
  const styles = StyleSheet.create({
103
100
  container: {
@@ -0,0 +1,170 @@
1
+ import { COMPONENT_TYPES, createTextProp, FORM_TYPES, PROP_TYPES, GROUPS, StylesPanelSections, Triggers } from "@draftbit/types";
2
+ const SEED_DATA_TRIGGERS = [Triggers.OnValueChange];
3
+ const ELEMENT_SEED_DATA = {
4
+ doc_link: "https://www.npmjs.com/package/@expo/html-elements",
5
+ code_link: "https://github.com/expo/expo/tree/master/packages/html-elements",
6
+ packageName: "@expo/html-elements",
7
+ stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.LayoutSelectedItem, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Effects],
8
+ layout: {
9
+ margin: 0
10
+ },
11
+ triggers: SEED_DATA_TRIGGERS,
12
+ category: COMPONENT_TYPES.webelement
13
+ };
14
+ const HEADING_SEED_DATA = {
15
+ ...ELEMENT_SEED_DATA,
16
+ category: COMPONENT_TYPES.text,
17
+ props: {
18
+ accessibilityLabel: {
19
+ group: GROUPS.accessibility,
20
+ name: "accessibilityLabel",
21
+ label: "accessibilityLabel",
22
+ description: "Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space.",
23
+ editable: true,
24
+ required: false,
25
+ formType: FORM_TYPES.string,
26
+ propType: PROP_TYPES.STRING,
27
+ defaultValue: null
28
+ },
29
+ selectable: {
30
+ group: GROUPS.advanced,
31
+ name: "selectable",
32
+ label: "selectable",
33
+ description: "Lets the user select text, to use the native copy and paste functionality.",
34
+ editable: true,
35
+ required: false,
36
+ formType: FORM_TYPES.boolean,
37
+ propType: PROP_TYPES.BOOLEAN,
38
+ defaultValue: null
39
+ },
40
+ children: {
41
+ group: GROUPS.data,
42
+ label: "Text",
43
+ description: "Text",
44
+ editable: true,
45
+ required: true,
46
+ formType: FORM_TYPES.string,
47
+ propType: PROP_TYPES.STRING,
48
+ defaultValue: "Your Headline Here"
49
+ }
50
+ }
51
+ };
52
+ const TEXT_SEED_DATA = {
53
+ ...ELEMENT_SEED_DATA,
54
+ category: COMPONENT_TYPES.text,
55
+ props: {
56
+ children: {
57
+ group: GROUPS.data,
58
+ label: "Text",
59
+ description: "Text",
60
+ defaultValue: "Your Text Here",
61
+ editable: true,
62
+ required: true,
63
+ formType: FORM_TYPES.string,
64
+ propType: PROP_TYPES.STRING
65
+ }
66
+ }
67
+ };
68
+ export const SEED_DATA = [{
69
+ name: "H1",
70
+ tag: "H1",
71
+ ...HEADING_SEED_DATA
72
+ }, {
73
+ name: "H2",
74
+ tag: "H2",
75
+ ...HEADING_SEED_DATA
76
+ }, {
77
+ name: "H3",
78
+ tag: "H3",
79
+ ...HEADING_SEED_DATA
80
+ }, {
81
+ name: "H4",
82
+ tag: "H4",
83
+ ...HEADING_SEED_DATA
84
+ }, {
85
+ name: "H5",
86
+ tag: "H5",
87
+ ...HEADING_SEED_DATA
88
+ }, {
89
+ name: "H6",
90
+ tag: "H6",
91
+ ...HEADING_SEED_DATA
92
+ }, {
93
+ name: "Anchor",
94
+ tag: "A",
95
+ ...TEXT_SEED_DATA,
96
+ props: {
97
+ href: createTextProp({
98
+ label: "href",
99
+ description: "Specify the URL",
100
+ defaultValue: ""
101
+ }),
102
+ target: {
103
+ group: GROUPS.basic,
104
+ label: "target",
105
+ description: "decide where link should open",
106
+ formType: FORM_TYPES.flatArray,
107
+ defaultValue: "_blank",
108
+ options: ["_blank", "_self", "_parent", "_top"]
109
+ }
110
+ }
111
+ }, {
112
+ name: "Paragraph",
113
+ tag: "P",
114
+ ...TEXT_SEED_DATA,
115
+ props: {
116
+ // NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
117
+ // strong: createBoolProp({
118
+ // label: "Strong",
119
+ // description: "Strong",
120
+ // }),
121
+ // strike: createBoolProp({
122
+ // label: "Strike",
123
+ // description: "Strike through",
124
+ // }),
125
+ // italic: createBoolProp({
126
+ // label: "Italic",
127
+ // description: "Italic Fonts",
128
+ // }),
129
+ // bold: createBoolProp({
130
+ // label: "Bold",
131
+ // description: "Bold",
132
+ // }),
133
+ }
134
+ }, {
135
+ name: "Code",
136
+ tag: "Code",
137
+ ...TEXT_SEED_DATA
138
+ }, {
139
+ name: "Pre",
140
+ tag: "Pre",
141
+ ...TEXT_SEED_DATA
142
+ }, {
143
+ name: "Mark",
144
+ tag: "Mark",
145
+ ...TEXT_SEED_DATA
146
+ }, {
147
+ name: "BR",
148
+ tag: "BR",
149
+ ...TEXT_SEED_DATA
150
+ }, {
151
+ name: "BlockQuote",
152
+ tag: "BlockQuote",
153
+ ...TEXT_SEED_DATA
154
+ }, {
155
+ name: "HR",
156
+ tag: "HR",
157
+ ...TEXT_SEED_DATA
158
+ }, {
159
+ name: "Time",
160
+ tag: "Time",
161
+ ...ELEMENT_SEED_DATA
162
+ }, {
163
+ name: "UL",
164
+ tag: "UL",
165
+ ...ELEMENT_SEED_DATA
166
+ }, {
167
+ name: "LI",
168
+ tag: "LI",
169
+ ...ELEMENT_SEED_DATA
170
+ }];
@@ -0,0 +1,77 @@
1
+ export declare const SEED_DATA: ({
2
+ props: {
3
+ href: any;
4
+ target: {
5
+ group: string;
6
+ label: string;
7
+ description: string;
8
+ formType: string;
9
+ defaultValue: string;
10
+ options: string[];
11
+ };
12
+ };
13
+ category: string;
14
+ doc_link: string;
15
+ code_link: string;
16
+ packageName: string;
17
+ stylesPanelSections: string[];
18
+ layout: {
19
+ margin: number;
20
+ };
21
+ triggers: string[];
22
+ name: string;
23
+ tag: string;
24
+ } | {
25
+ props: {
26
+ href?: undefined;
27
+ target?: undefined;
28
+ };
29
+ category: string;
30
+ doc_link: string;
31
+ code_link: string;
32
+ packageName: string;
33
+ stylesPanelSections: string[];
34
+ layout: {
35
+ margin: number;
36
+ };
37
+ triggers: string[];
38
+ name: string;
39
+ tag: string;
40
+ } | {
41
+ category: string;
42
+ props: {
43
+ children: {
44
+ group: string;
45
+ label: string;
46
+ description: string;
47
+ defaultValue: string;
48
+ editable: boolean;
49
+ required: boolean;
50
+ formType: string;
51
+ propType: string;
52
+ };
53
+ };
54
+ doc_link: string;
55
+ code_link: string;
56
+ packageName: string;
57
+ stylesPanelSections: string[];
58
+ layout: {
59
+ margin: number;
60
+ };
61
+ triggers: string[];
62
+ name: string;
63
+ tag: string;
64
+ } | {
65
+ doc_link: string;
66
+ code_link: string;
67
+ packageName: string;
68
+ stylesPanelSections: string[];
69
+ layout: {
70
+ margin: number;
71
+ };
72
+ triggers: string[];
73
+ category: string;
74
+ name: string;
75
+ tag: string;
76
+ })[];
77
+ //# sourceMappingURL=HtmlElements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HtmlElements.d.ts","sourceRoot":"","sources":["../../../../src/mappings/HtmlElements.ts"],"names":[],"mappings":"AAsFA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwHrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.8.1",
3
+ "version": "46.8.2-088bf8.2+088bf87",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,8 @@
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.8.1",
44
+ "@draftbit/types": "^46.8.2-088bf8.2+088bf87",
45
+ "@expo/html-elements": "^0.3.1",
45
46
  "@material-ui/core": "^4.11.0",
46
47
  "@material-ui/pickers": "^3.2.10",
47
48
  "@react-native-community/slider": "4.2.3",
@@ -92,5 +93,5 @@
92
93
  ]
93
94
  ]
94
95
  },
95
- "gitHead": "85d8eebb959e07970330c830dd205a5c95e55ecd"
96
+ "gitHead": "088bf87109989ec13afa5a6b64d29314afdc8caa"
96
97
  }
@@ -0,0 +1,193 @@
1
+ import { COMPONENT_TYPES, createTextProp, FORM_TYPES, PROP_TYPES, GROUPS, StylesPanelSections, Triggers, } from "@draftbit/types";
2
+ const SEED_DATA_TRIGGERS = [Triggers.OnValueChange];
3
+ const ELEMENT_SEED_DATA = {
4
+ doc_link: "https://www.npmjs.com/package/@expo/html-elements",
5
+ code_link: "https://github.com/expo/expo/tree/master/packages/html-elements",
6
+ packageName: "@expo/html-elements",
7
+ stylesPanelSections: [
8
+ StylesPanelSections.Typography,
9
+ StylesPanelSections.LayoutSelectedItem,
10
+ StylesPanelSections.MarginsAndPaddings,
11
+ StylesPanelSections.Effects,
12
+ ],
13
+ layout: {
14
+ margin: 0,
15
+ },
16
+ triggers: SEED_DATA_TRIGGERS,
17
+ category: COMPONENT_TYPES.webelement,
18
+ };
19
+ const HEADING_SEED_DATA = {
20
+ ...ELEMENT_SEED_DATA,
21
+ category: COMPONENT_TYPES.text,
22
+ props: {
23
+ accessibilityLabel: {
24
+ group: GROUPS.accessibility,
25
+ name: "accessibilityLabel",
26
+ label: "accessibilityLabel",
27
+ description: "Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space.",
28
+ editable: true,
29
+ required: false,
30
+ formType: FORM_TYPES.string,
31
+ propType: PROP_TYPES.STRING,
32
+ defaultValue: null,
33
+ },
34
+ selectable: {
35
+ group: GROUPS.advanced,
36
+ name: "selectable",
37
+ label: "selectable",
38
+ description: "Lets the user select text, to use the native copy and paste functionality.",
39
+ editable: true,
40
+ required: false,
41
+ formType: FORM_TYPES.boolean,
42
+ propType: PROP_TYPES.BOOLEAN,
43
+ defaultValue: null,
44
+ },
45
+ children: {
46
+ group: GROUPS.data,
47
+ label: "Text",
48
+ description: "Text",
49
+ editable: true,
50
+ required: true,
51
+ formType: FORM_TYPES.string,
52
+ propType: PROP_TYPES.STRING,
53
+ defaultValue: "Your Headline Here",
54
+ },
55
+ },
56
+ };
57
+ const TEXT_SEED_DATA = {
58
+ ...ELEMENT_SEED_DATA,
59
+ category: COMPONENT_TYPES.text,
60
+ props: {
61
+ children: {
62
+ group: GROUPS.data,
63
+ label: "Text",
64
+ description: "Text",
65
+ defaultValue: "Your Text Here",
66
+ editable: true,
67
+ required: true,
68
+ formType: FORM_TYPES.string,
69
+ propType: PROP_TYPES.STRING,
70
+ },
71
+ },
72
+ };
73
+ export const SEED_DATA = [
74
+ {
75
+ name: "H1",
76
+ tag: "H1",
77
+ ...HEADING_SEED_DATA,
78
+ },
79
+ {
80
+ name: "H2",
81
+ tag: "H2",
82
+ ...HEADING_SEED_DATA,
83
+ },
84
+ {
85
+ name: "H3",
86
+ tag: "H3",
87
+ ...HEADING_SEED_DATA,
88
+ },
89
+ {
90
+ name: "H4",
91
+ tag: "H4",
92
+ ...HEADING_SEED_DATA,
93
+ },
94
+ {
95
+ name: "H5",
96
+ tag: "H5",
97
+ ...HEADING_SEED_DATA,
98
+ },
99
+ {
100
+ name: "H6",
101
+ tag: "H6",
102
+ ...HEADING_SEED_DATA,
103
+ },
104
+ {
105
+ name: "Anchor",
106
+ tag: "A",
107
+ ...TEXT_SEED_DATA,
108
+ props: {
109
+ href: createTextProp({
110
+ label: "href",
111
+ description: "Specify the URL",
112
+ defaultValue: "",
113
+ }),
114
+ target: {
115
+ group: GROUPS.basic,
116
+ label: "target",
117
+ description: "decide where link should open",
118
+ formType: FORM_TYPES.flatArray,
119
+ defaultValue: "_blank",
120
+ options: ["_blank", "_self", "_parent", "_top"],
121
+ },
122
+ },
123
+ },
124
+ {
125
+ name: "Paragraph",
126
+ tag: "P",
127
+ ...TEXT_SEED_DATA,
128
+ props: {
129
+ // NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
130
+ // strong: createBoolProp({
131
+ // label: "Strong",
132
+ // description: "Strong",
133
+ // }),
134
+ // strike: createBoolProp({
135
+ // label: "Strike",
136
+ // description: "Strike through",
137
+ // }),
138
+ // italic: createBoolProp({
139
+ // label: "Italic",
140
+ // description: "Italic Fonts",
141
+ // }),
142
+ // bold: createBoolProp({
143
+ // label: "Bold",
144
+ // description: "Bold",
145
+ // }),
146
+ },
147
+ },
148
+ {
149
+ name: "Code",
150
+ tag: "Code",
151
+ ...TEXT_SEED_DATA,
152
+ },
153
+ {
154
+ name: "Pre",
155
+ tag: "Pre",
156
+ ...TEXT_SEED_DATA,
157
+ },
158
+ {
159
+ name: "Mark",
160
+ tag: "Mark",
161
+ ...TEXT_SEED_DATA,
162
+ },
163
+ {
164
+ name: "BR",
165
+ tag: "BR",
166
+ ...TEXT_SEED_DATA,
167
+ },
168
+ {
169
+ name: "BlockQuote",
170
+ tag: "BlockQuote",
171
+ ...TEXT_SEED_DATA,
172
+ },
173
+ {
174
+ name: "HR",
175
+ tag: "HR",
176
+ ...TEXT_SEED_DATA,
177
+ },
178
+ {
179
+ name: "Time",
180
+ tag: "Time",
181
+ ...ELEMENT_SEED_DATA,
182
+ },
183
+ {
184
+ name: "UL",
185
+ tag: "UL",
186
+ ...ELEMENT_SEED_DATA,
187
+ },
188
+ {
189
+ name: "LI",
190
+ tag: "LI",
191
+ ...ELEMENT_SEED_DATA,
192
+ },
193
+ ];
@@ -0,0 +1,207 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ createTextProp,
4
+ FORM_TYPES,
5
+ PROP_TYPES,
6
+ GROUPS,
7
+ StylesPanelSections,
8
+ Triggers,
9
+ } from "@draftbit/types";
10
+ const SEED_DATA_TRIGGERS = [Triggers.OnValueChange];
11
+
12
+ const ELEMENT_SEED_DATA = {
13
+ doc_link: "https://www.npmjs.com/package/@expo/html-elements",
14
+ code_link: "https://github.com/expo/expo/tree/master/packages/html-elements",
15
+ packageName: "@expo/html-elements",
16
+ stylesPanelSections: [
17
+ StylesPanelSections.Typography,
18
+ StylesPanelSections.LayoutSelectedItem,
19
+ StylesPanelSections.MarginsAndPaddings,
20
+ StylesPanelSections.Effects,
21
+ ],
22
+ layout: {
23
+ margin: 0,
24
+ },
25
+ triggers: SEED_DATA_TRIGGERS,
26
+ category: COMPONENT_TYPES.webelement,
27
+ };
28
+
29
+ const HEADING_SEED_DATA = {
30
+ ...ELEMENT_SEED_DATA,
31
+ category: COMPONENT_TYPES.text,
32
+ props: {
33
+ accessibilityLabel: {
34
+ group: GROUPS.accessibility,
35
+ name: "accessibilityLabel",
36
+ label: "accessibilityLabel",
37
+ description:
38
+ "Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space.",
39
+ editable: true,
40
+ required: false,
41
+ formType: FORM_TYPES.string,
42
+ propType: PROP_TYPES.STRING,
43
+ defaultValue: null,
44
+ },
45
+ selectable: {
46
+ group: GROUPS.advanced,
47
+ name: "selectable",
48
+ label: "selectable",
49
+ description:
50
+ "Lets the user select text, to use the native copy and paste functionality.",
51
+ editable: true,
52
+ required: false,
53
+ formType: FORM_TYPES.boolean,
54
+ propType: PROP_TYPES.BOOLEAN,
55
+ defaultValue: null,
56
+ },
57
+ children: {
58
+ group: GROUPS.data,
59
+ label: "Text",
60
+ description: "Text",
61
+ editable: true,
62
+ required: true,
63
+ formType: FORM_TYPES.string,
64
+ propType: PROP_TYPES.STRING,
65
+ defaultValue: "Your Headline Here",
66
+ },
67
+ },
68
+ };
69
+
70
+ const TEXT_SEED_DATA = {
71
+ ...ELEMENT_SEED_DATA,
72
+ category: COMPONENT_TYPES.text,
73
+ props: {
74
+ children: {
75
+ group: GROUPS.data,
76
+ label: "Text",
77
+ description: "Text",
78
+ defaultValue: "Your Text Here",
79
+ editable: true,
80
+ required: true,
81
+ formType: FORM_TYPES.string,
82
+ propType: PROP_TYPES.STRING,
83
+ },
84
+ },
85
+ };
86
+
87
+ export const SEED_DATA = [
88
+ {
89
+ name: "H1",
90
+ tag: "H1",
91
+ ...HEADING_SEED_DATA,
92
+ },
93
+ {
94
+ name: "H2",
95
+ tag: "H2",
96
+ ...HEADING_SEED_DATA,
97
+ },
98
+ {
99
+ name: "H3",
100
+ tag: "H3",
101
+ ...HEADING_SEED_DATA,
102
+ },
103
+ {
104
+ name: "H4",
105
+ tag: "H4",
106
+ ...HEADING_SEED_DATA,
107
+ },
108
+ {
109
+ name: "H5",
110
+ tag: "H5",
111
+ ...HEADING_SEED_DATA,
112
+ },
113
+ {
114
+ name: "H6",
115
+ tag: "H6",
116
+ ...HEADING_SEED_DATA,
117
+ },
118
+ {
119
+ name: "Anchor",
120
+ tag: "A",
121
+ ...TEXT_SEED_DATA,
122
+ props: {
123
+ href: createTextProp({
124
+ label: "href",
125
+ description: "Specify the URL",
126
+ defaultValue: "",
127
+ }),
128
+ target: {
129
+ group: GROUPS.basic,
130
+ label: "target",
131
+ description: "decide where link should open",
132
+ formType: FORM_TYPES.flatArray,
133
+ defaultValue: "_blank",
134
+ options: ["_blank", "_self", "_parent", "_top"],
135
+ },
136
+ },
137
+ },
138
+ {
139
+ name: "Paragraph",
140
+ tag: "P",
141
+ ...TEXT_SEED_DATA,
142
+ props: {
143
+ // NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
144
+ // strong: createBoolProp({
145
+ // label: "Strong",
146
+ // description: "Strong",
147
+ // }),
148
+ // strike: createBoolProp({
149
+ // label: "Strike",
150
+ // description: "Strike through",
151
+ // }),
152
+ // italic: createBoolProp({
153
+ // label: "Italic",
154
+ // description: "Italic Fonts",
155
+ // }),
156
+ // bold: createBoolProp({
157
+ // label: "Bold",
158
+ // description: "Bold",
159
+ // }),
160
+ },
161
+ },
162
+ {
163
+ name: "Code",
164
+ tag: "Code",
165
+ ...TEXT_SEED_DATA,
166
+ },
167
+ {
168
+ name: "Pre",
169
+ tag: "Pre",
170
+ ...TEXT_SEED_DATA,
171
+ },
172
+ {
173
+ name: "Mark",
174
+ tag: "Mark",
175
+ ...TEXT_SEED_DATA,
176
+ },
177
+ {
178
+ name: "BR",
179
+ tag: "BR",
180
+ ...TEXT_SEED_DATA,
181
+ },
182
+ {
183
+ name: "BlockQuote",
184
+ tag: "BlockQuote",
185
+ ...TEXT_SEED_DATA,
186
+ },
187
+ {
188
+ name: "HR",
189
+ tag: "HR",
190
+ ...TEXT_SEED_DATA,
191
+ },
192
+ {
193
+ name: "Time",
194
+ tag: "Time",
195
+ ...ELEMENT_SEED_DATA,
196
+ },
197
+ {
198
+ name: "UL",
199
+ tag: "UL",
200
+ ...ELEMENT_SEED_DATA,
201
+ },
202
+ {
203
+ name: "LI",
204
+ tag: "LI",
205
+ ...ELEMENT_SEED_DATA,
206
+ },
207
+ ];