@draftbit/core 46.4.4-9a666e.2 → 46.4.4-b0ea41.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.
- package/lib/commonjs/components/DatePicker/DatePicker.js +18 -8
- package/lib/commonjs/components/Text.js +6 -2
- package/lib/commonjs/components/TextField.js +5 -1
- package/lib/commonjs/mappings/DatePicker.js +13 -0
- package/lib/commonjs/mappings/TextField.js +1 -1
- package/lib/commonjs/mappings/TextInput.js +1 -1
- package/lib/module/components/DatePicker/DatePicker.js +17 -8
- package/lib/module/components/Text.js +6 -2
- package/lib/module/components/TextField.js +5 -1
- package/lib/module/mappings/DatePicker.js +14 -1
- package/lib/module/mappings/TextField.js +1 -1
- package/lib/module/mappings/TextInput.js +1 -1
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +4 -0
- package/lib/typescript/src/components/Text.d.ts +2 -1
- package/lib/typescript/src/components/TextField.d.ts +2 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +42 -0
- package/lib/typescript/src/mappings/TextField.d.ts +2 -2
- package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
- package/package.json +3 -4
- package/src/components/DatePicker/DatePicker.js +14 -8
- package/src/components/DatePicker/DatePicker.tsx +23 -7
- package/src/components/Text.js +8 -2
- package/src/components/Text.tsx +6 -1
- package/src/components/TextField.js +6 -1
- package/src/components/TextField.tsx +7 -1
- package/src/mappings/DatePicker.js +21 -1
- package/src/mappings/DatePicker.ts +23 -0
- package/src/mappings/TextField.js +1 -1
- package/src/mappings/TextField.ts +1 -1
- package/src/mappings/TextInput.js +1 -1
- package/src/mappings/TextInput.ts +1 -1
- package/lib/commonjs/mappings/Elements.js +0 -129
- package/lib/module/mappings/Elements.js +0 -121
- package/lib/typescript/src/mappings/Elements.d.ts +0 -49
- package/src/mappings/Elements.js +0 -143
- package/src/mappings/Elements.ts +0 -152
|
@@ -23,6 +23,7 @@ import DateTimePicker from "./DatePickerComponent";
|
|
|
23
23
|
|
|
24
24
|
import type { Theme } from "../../styles/DefaultTheme";
|
|
25
25
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
26
|
+
import { extractStyles } from "../../utilities";
|
|
26
27
|
|
|
27
28
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
28
29
|
|
|
@@ -47,10 +48,14 @@ type Props = {
|
|
|
47
48
|
mode?: "date" | "time" | "datetime";
|
|
48
49
|
type?: "solid" | "underline";
|
|
49
50
|
label?: string;
|
|
51
|
+
labelSize?: number;
|
|
52
|
+
labelColor: string;
|
|
50
53
|
placeholder?: string;
|
|
51
54
|
leftIconName?: string;
|
|
52
55
|
leftIconMode?: "outset" | "inset";
|
|
53
56
|
rightIconName?: string;
|
|
57
|
+
borderColor?: string;
|
|
58
|
+
borderColorActive?: string;
|
|
54
59
|
} & IconSlot &
|
|
55
60
|
TextInputProps;
|
|
56
61
|
|
|
@@ -84,7 +89,11 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
84
89
|
rightIconName,
|
|
85
90
|
leftIconMode = "inset",
|
|
86
91
|
label,
|
|
92
|
+
labelSize,
|
|
93
|
+
labelColor,
|
|
87
94
|
placeholder,
|
|
95
|
+
borderColor: inputBorderColor,
|
|
96
|
+
borderColorActive: inputBorderColorActive,
|
|
88
97
|
...props
|
|
89
98
|
}) => {
|
|
90
99
|
const [value, setValue] = React.useState<any>(date || defaultValue);
|
|
@@ -106,6 +115,8 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
106
115
|
width: number;
|
|
107
116
|
}>({ measured: false, width: 0 });
|
|
108
117
|
|
|
118
|
+
const { textStyles } = extractStyles(style);
|
|
119
|
+
|
|
109
120
|
const getValidDate = (): Date => {
|
|
110
121
|
if (!value) {
|
|
111
122
|
return new Date();
|
|
@@ -211,8 +222,11 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
211
222
|
|
|
212
223
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
213
224
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
214
|
-
const MAXIMIZED_LABEL_FONT_SIZE =
|
|
215
|
-
|
|
225
|
+
const MAXIMIZED_LABEL_FONT_SIZE =
|
|
226
|
+
textStyles?.fontSize || typography.subtitle1.fontSize;
|
|
227
|
+
const MINIMIZED_LABEL_FONT_SIZE = labelSize
|
|
228
|
+
? labelSize
|
|
229
|
+
: typography.caption.fontSize;
|
|
216
230
|
|
|
217
231
|
const hasActiveOutline = focused;
|
|
218
232
|
|
|
@@ -233,9 +247,9 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
233
247
|
underlineColor = "transparent";
|
|
234
248
|
backgroundColor = colors.divider;
|
|
235
249
|
} else {
|
|
236
|
-
activeColor = colors.primary;
|
|
237
|
-
placeholderColor = borderColor = colors.light;
|
|
238
|
-
underlineColor = colors.light;
|
|
250
|
+
activeColor = inputBorderColorActive || colors.primary;
|
|
251
|
+
placeholderColor = borderColor = inputBorderColor || colors.light;
|
|
252
|
+
underlineColor = inputBorderColor || colors.light;
|
|
239
253
|
backgroundColor = colors.background;
|
|
240
254
|
}
|
|
241
255
|
|
|
@@ -306,6 +320,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
306
320
|
const labelStyle = {
|
|
307
321
|
...typography.subtitle1,
|
|
308
322
|
top: type === "solid" ? 16 : 0,
|
|
323
|
+
fontFamily: textStyles?.fontFamily,
|
|
309
324
|
left:
|
|
310
325
|
leftIconName && leftIconMode === "inset"
|
|
311
326
|
? ICON_SIZE + (type === "solid" ? 16 : 12)
|
|
@@ -351,6 +366,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
351
366
|
styles.input,
|
|
352
367
|
inputStyle,
|
|
353
368
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
369
|
+
textStyles,
|
|
354
370
|
];
|
|
355
371
|
|
|
356
372
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
@@ -406,7 +422,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
406
422
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
407
423
|
labelStyle,
|
|
408
424
|
{
|
|
409
|
-
color: colors.light,
|
|
425
|
+
color: labelColor || colors.light,
|
|
410
426
|
opacity: labeled.interpolate({
|
|
411
427
|
inputRange: [0, 1],
|
|
412
428
|
outputRange: [hasActiveOutline ? 1 : 0, 0],
|
|
@@ -423,7 +439,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
423
439
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
424
440
|
labelStyle,
|
|
425
441
|
{
|
|
426
|
-
color:
|
|
442
|
+
color: labelColor || placeholder,
|
|
427
443
|
opacity: hasActiveOutline ? labeled : 1,
|
|
428
444
|
},
|
|
429
445
|
]}
|
package/src/components/Text.js
CHANGED
|
@@ -2,13 +2,19 @@ import * as React from "react";
|
|
|
2
2
|
import { Text as NativeText, I18nManager } from "react-native";
|
|
3
3
|
import { withTheme } from "../theming";
|
|
4
4
|
class Text extends React.Component {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.state = {
|
|
8
|
+
nativeProps: {},
|
|
9
|
+
};
|
|
10
|
+
}
|
|
5
11
|
setNativeProps(args) {
|
|
6
|
-
|
|
12
|
+
this.state.nativeProps = args || {};
|
|
7
13
|
}
|
|
8
14
|
render() {
|
|
9
15
|
const { style, ...rest } = this.props;
|
|
10
16
|
const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
|
|
11
|
-
return (React.createElement(NativeText, { ...rest, ref: (c) => {
|
|
17
|
+
return (React.createElement(NativeText, { ...rest, ...this.state.nativeProps, ref: (c) => {
|
|
12
18
|
this._root = c;
|
|
13
19
|
}, style: [
|
|
14
20
|
{
|
package/src/components/Text.tsx
CHANGED
|
@@ -10,8 +10,12 @@ type Props = {
|
|
|
10
10
|
class Text extends React.Component<Props> {
|
|
11
11
|
_root: any;
|
|
12
12
|
|
|
13
|
+
state: any = {
|
|
14
|
+
nativeProps: {},
|
|
15
|
+
};
|
|
16
|
+
|
|
13
17
|
setNativeProps(args: TextProps) {
|
|
14
|
-
|
|
18
|
+
this.state.nativeProps = args || {};
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
render() {
|
|
@@ -21,6 +25,7 @@ class Text extends React.Component<Props> {
|
|
|
21
25
|
return (
|
|
22
26
|
<NativeText
|
|
23
27
|
{...rest}
|
|
28
|
+
{...this.state.nativeProps}
|
|
24
29
|
ref={(c) => {
|
|
25
30
|
this._root = c;
|
|
26
31
|
}}
|
|
@@ -10,6 +10,7 @@ class TextField extends React.Component {
|
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.state = {
|
|
13
|
+
nativeProps: {},
|
|
13
14
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
14
15
|
focused: false,
|
|
15
16
|
placeholder: this.props.error ? this.props.placeholder : "",
|
|
@@ -121,7 +122,10 @@ class TextField extends React.Component {
|
|
|
121
122
|
* @internal
|
|
122
123
|
*/
|
|
123
124
|
setNativeProps(args) {
|
|
124
|
-
|
|
125
|
+
this.setState((state) => ({
|
|
126
|
+
...state,
|
|
127
|
+
nativeState: args || {},
|
|
128
|
+
}));
|
|
125
129
|
}
|
|
126
130
|
isFocused() {
|
|
127
131
|
return this._root && this._root.isFocused();
|
|
@@ -381,6 +385,7 @@ class TextField extends React.Component {
|
|
|
381
385
|
underlineColorAndroid: "transparent",
|
|
382
386
|
style: inputStyles,
|
|
383
387
|
...rest,
|
|
388
|
+
...this.state.nativeProps,
|
|
384
389
|
value: this.state.value,
|
|
385
390
|
})),
|
|
386
391
|
rightIconName ? (React.createElement(Icon, { name: rightIconName, size: ICON_SIZE, color: colors.light, style: {
|
|
@@ -52,6 +52,7 @@ export type Props = {
|
|
|
52
52
|
IconSlot;
|
|
53
53
|
|
|
54
54
|
interface State {
|
|
55
|
+
nativeProps: any;
|
|
55
56
|
labeled: Animated.Value;
|
|
56
57
|
focused?: boolean;
|
|
57
58
|
placeholder?: string | undefined;
|
|
@@ -73,6 +74,7 @@ class TextField extends React.Component<Props, State> {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
state: State = {
|
|
77
|
+
nativeProps: {},
|
|
76
78
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
77
79
|
focused: false,
|
|
78
80
|
placeholder: this.props.error ? this.props.placeholder : "",
|
|
@@ -207,7 +209,10 @@ class TextField extends React.Component<Props, State> {
|
|
|
207
209
|
* @internal
|
|
208
210
|
*/
|
|
209
211
|
setNativeProps(args: Props) {
|
|
210
|
-
|
|
212
|
+
this.setState((state) => ({
|
|
213
|
+
...state,
|
|
214
|
+
nativeState: args || {},
|
|
215
|
+
}));
|
|
211
216
|
}
|
|
212
217
|
|
|
213
218
|
isFocused() {
|
|
@@ -566,6 +571,7 @@ class TextField extends React.Component<Props, State> {
|
|
|
566
571
|
underlineColorAndroid: "transparent",
|
|
567
572
|
style: inputStyles,
|
|
568
573
|
...rest,
|
|
574
|
+
...this.state.nativeProps,
|
|
569
575
|
value: this.state.value,
|
|
570
576
|
})}
|
|
571
577
|
</View>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp, } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
label: {
|
|
4
4
|
label: "Label",
|
|
@@ -10,6 +10,12 @@ const SEED_DATA_PROPS = {
|
|
|
10
10
|
required: true,
|
|
11
11
|
group: GROUPS.data,
|
|
12
12
|
},
|
|
13
|
+
labelSize: createNumberProp({
|
|
14
|
+
label: "Label Size",
|
|
15
|
+
}),
|
|
16
|
+
labelColor: createColorProp({
|
|
17
|
+
label: "Label Color",
|
|
18
|
+
}),
|
|
13
19
|
mode: {
|
|
14
20
|
label: "Mode",
|
|
15
21
|
description: "Choose between date, time and datetime",
|
|
@@ -21,6 +27,12 @@ const SEED_DATA_PROPS = {
|
|
|
21
27
|
options: ["date", "time", "datetime"],
|
|
22
28
|
group: GROUPS.basic,
|
|
23
29
|
},
|
|
30
|
+
borderColor: createColorProp({
|
|
31
|
+
label: "Border Color",
|
|
32
|
+
}),
|
|
33
|
+
borderColorActive: createColorProp({
|
|
34
|
+
label: "Border Color",
|
|
35
|
+
}),
|
|
24
36
|
format: {
|
|
25
37
|
label: "Format",
|
|
26
38
|
description: "Create an output format for the date.",
|
|
@@ -139,6 +151,14 @@ export const SEED_DATA = [
|
|
|
139
151
|
category: COMPONENT_TYPES.input,
|
|
140
152
|
layout: null,
|
|
141
153
|
triggers: [Triggers.OnDateChange],
|
|
154
|
+
StylesPanelSections: [
|
|
155
|
+
StylesPanelSections.Background,
|
|
156
|
+
StylesPanelSections.Borders,
|
|
157
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
158
|
+
StylesPanelSections.Position,
|
|
159
|
+
StylesPanelSections.Size,
|
|
160
|
+
StylesPanelSections.Typography,
|
|
161
|
+
],
|
|
142
162
|
props: {
|
|
143
163
|
...SEED_DATA_PROPS,
|
|
144
164
|
type: {
|
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
FIELD_NAME,
|
|
6
6
|
GROUPS,
|
|
7
7
|
Triggers,
|
|
8
|
+
StylesPanelSections,
|
|
9
|
+
createNumberProp,
|
|
10
|
+
createColorProp,
|
|
8
11
|
} from "@draftbit/types";
|
|
9
12
|
|
|
10
13
|
const SEED_DATA_PROPS = {
|
|
@@ -18,6 +21,12 @@ const SEED_DATA_PROPS = {
|
|
|
18
21
|
required: true,
|
|
19
22
|
group: GROUPS.data,
|
|
20
23
|
},
|
|
24
|
+
labelSize: createNumberProp({
|
|
25
|
+
label: "Label Size",
|
|
26
|
+
}),
|
|
27
|
+
labelColor: createColorProp({
|
|
28
|
+
label: "Label Color",
|
|
29
|
+
}),
|
|
21
30
|
mode: {
|
|
22
31
|
label: "Mode",
|
|
23
32
|
description: "Choose between date, time and datetime",
|
|
@@ -29,6 +38,12 @@ const SEED_DATA_PROPS = {
|
|
|
29
38
|
options: ["date", "time", "datetime"],
|
|
30
39
|
group: GROUPS.basic,
|
|
31
40
|
},
|
|
41
|
+
borderColor: createColorProp({
|
|
42
|
+
label: "Border Color",
|
|
43
|
+
}),
|
|
44
|
+
borderColorActive: createColorProp({
|
|
45
|
+
label: "Border Color",
|
|
46
|
+
}),
|
|
32
47
|
format: {
|
|
33
48
|
label: "Format",
|
|
34
49
|
description: "Create an output format for the date.",
|
|
@@ -150,6 +165,14 @@ export const SEED_DATA = [
|
|
|
150
165
|
category: COMPONENT_TYPES.input,
|
|
151
166
|
layout: null,
|
|
152
167
|
triggers: [Triggers.OnDateChange],
|
|
168
|
+
StylesPanelSections: [
|
|
169
|
+
StylesPanelSections.Background,
|
|
170
|
+
StylesPanelSections.Borders,
|
|
171
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
172
|
+
StylesPanelSections.Position,
|
|
173
|
+
StylesPanelSections.Size,
|
|
174
|
+
StylesPanelSections.Typography,
|
|
175
|
+
],
|
|
153
176
|
props: {
|
|
154
177
|
...SEED_DATA_PROPS,
|
|
155
178
|
type: {
|
|
@@ -16,7 +16,7 @@ const SEED_DATA_PROPS = {
|
|
|
16
16
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
17
17
|
editable: true,
|
|
18
18
|
required: false,
|
|
19
|
-
defaultValue:
|
|
19
|
+
defaultValue: "none",
|
|
20
20
|
options: ["none", "sentences", "words", "characters"],
|
|
21
21
|
formType: FORM_TYPES.flatArray,
|
|
22
22
|
propType: PROP_TYPES.STRING,
|
|
@@ -30,7 +30,7 @@ const SEED_DATA_PROPS = {
|
|
|
30
30
|
"Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
31
31
|
editable: true,
|
|
32
32
|
required: false,
|
|
33
|
-
defaultValue:
|
|
33
|
+
defaultValue: "none",
|
|
34
34
|
options: ["none", "sentences", "words", "characters"],
|
|
35
35
|
formType: FORM_TYPES.flatArray,
|
|
36
36
|
propType: PROP_TYPES.STRING,
|
|
@@ -104,7 +104,7 @@ export const SEED_DATA = [
|
|
|
104
104
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
105
105
|
editable: true,
|
|
106
106
|
required: false,
|
|
107
|
-
defaultValue:
|
|
107
|
+
defaultValue: "none",
|
|
108
108
|
options: ["none", "sentences", "words", "characters"],
|
|
109
109
|
formType: FORM_TYPES.flatArray,
|
|
110
110
|
propType: PROP_TYPES.STRING,
|
|
@@ -121,7 +121,7 @@ export const SEED_DATA = [
|
|
|
121
121
|
"Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
122
122
|
editable: true,
|
|
123
123
|
required: false,
|
|
124
|
-
defaultValue:
|
|
124
|
+
defaultValue: "none",
|
|
125
125
|
options: ["none", "sentences", "words", "characters"],
|
|
126
126
|
formType: FORM_TYPES.flatArray,
|
|
127
127
|
propType: PROP_TYPES.STRING,
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SEED_DATA = void 0;
|
|
7
|
-
|
|
8
|
-
var _types = require("@draftbit/types");
|
|
9
|
-
|
|
10
|
-
const SEED_DATA_TRIGGERS = [_types.Triggers.OnValueChange];
|
|
11
|
-
const ELEMENT_PROPS = {
|
|
12
|
-
category: _types.COMPONENT_TYPES.element,
|
|
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
|
-
stylesPanelSections: _types.BLOCK_STYLES_SECTIONS,
|
|
16
|
-
layout: {
|
|
17
|
-
margin: 0
|
|
18
|
-
},
|
|
19
|
-
triggers: SEED_DATA_TRIGGERS
|
|
20
|
-
};
|
|
21
|
-
const HEADING_PROPS = { ...ELEMENT_PROPS
|
|
22
|
-
};
|
|
23
|
-
const SEED_DATA = [{
|
|
24
|
-
name: "H1",
|
|
25
|
-
tag: "H1",
|
|
26
|
-
...HEADING_PROPS
|
|
27
|
-
}, {
|
|
28
|
-
name: "H2",
|
|
29
|
-
tag: "H2",
|
|
30
|
-
...HEADING_PROPS
|
|
31
|
-
}, {
|
|
32
|
-
name: "H3",
|
|
33
|
-
tag: "H3",
|
|
34
|
-
...HEADING_PROPS
|
|
35
|
-
}, {
|
|
36
|
-
name: "H4",
|
|
37
|
-
tag: "H4",
|
|
38
|
-
...HEADING_PROPS
|
|
39
|
-
}, {
|
|
40
|
-
name: "H5",
|
|
41
|
-
tag: "H5",
|
|
42
|
-
...HEADING_PROPS
|
|
43
|
-
}, {
|
|
44
|
-
name: "H6",
|
|
45
|
-
tag: "H6",
|
|
46
|
-
...HEADING_PROPS
|
|
47
|
-
}, {
|
|
48
|
-
name: "Anchor",
|
|
49
|
-
tag: "A",
|
|
50
|
-
...ELEMENT_PROPS,
|
|
51
|
-
props: {
|
|
52
|
-
href: (0, _types.createTextProp)({
|
|
53
|
-
label: "href",
|
|
54
|
-
description: "Specify the URL",
|
|
55
|
-
defaultValue: ""
|
|
56
|
-
}),
|
|
57
|
-
target: {
|
|
58
|
-
group: _types.GROUPS.basic,
|
|
59
|
-
label: "target",
|
|
60
|
-
description: "decide where link should open",
|
|
61
|
-
formType: _types.FORM_TYPES.flatArray,
|
|
62
|
-
defaultValue: "_blank",
|
|
63
|
-
options: ["_blank", "_self", "_parent", "_top"]
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}, {
|
|
67
|
-
name: "Paragraph",
|
|
68
|
-
tag: "P",
|
|
69
|
-
...ELEMENT_PROPS,
|
|
70
|
-
props: {// NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
|
|
71
|
-
// strong: createBoolProp({
|
|
72
|
-
// label: "Strong",
|
|
73
|
-
// description: "Strong",
|
|
74
|
-
// }),
|
|
75
|
-
// strike: createBoolProp({
|
|
76
|
-
// label: "Strike",
|
|
77
|
-
// description: "Strike through",
|
|
78
|
-
// }),
|
|
79
|
-
// italic: createBoolProp({
|
|
80
|
-
// label: "Italic",
|
|
81
|
-
// description: "Italic Fonts",
|
|
82
|
-
// }),
|
|
83
|
-
// bold: createBoolProp({
|
|
84
|
-
// label: "Bold",
|
|
85
|
-
// description: "Bold",
|
|
86
|
-
// }),
|
|
87
|
-
}
|
|
88
|
-
}, {
|
|
89
|
-
name: "Code",
|
|
90
|
-
tag: "Code",
|
|
91
|
-
...ELEMENT_PROPS
|
|
92
|
-
}, {
|
|
93
|
-
name: "Pre",
|
|
94
|
-
tag: "Pre",
|
|
95
|
-
...ELEMENT_PROPS
|
|
96
|
-
}, {
|
|
97
|
-
name: "Mark",
|
|
98
|
-
tag: "Mark",
|
|
99
|
-
...ELEMENT_PROPS
|
|
100
|
-
}, {
|
|
101
|
-
name: "BR",
|
|
102
|
-
tag: "BR",
|
|
103
|
-
...ELEMENT_PROPS
|
|
104
|
-
}, {
|
|
105
|
-
name: "Quote",
|
|
106
|
-
tag: "Q",
|
|
107
|
-
...ELEMENT_PROPS
|
|
108
|
-
}, {
|
|
109
|
-
name: "BlockQuote",
|
|
110
|
-
tag: "BlockQuote",
|
|
111
|
-
...ELEMENT_PROPS
|
|
112
|
-
}, {
|
|
113
|
-
name: "Time",
|
|
114
|
-
tag: "Time",
|
|
115
|
-
...ELEMENT_PROPS
|
|
116
|
-
}, {
|
|
117
|
-
name: "UL",
|
|
118
|
-
tag: "UL",
|
|
119
|
-
...ELEMENT_PROPS
|
|
120
|
-
}, {
|
|
121
|
-
name: "LI",
|
|
122
|
-
tag: "LI",
|
|
123
|
-
...ELEMENT_PROPS
|
|
124
|
-
}, {
|
|
125
|
-
name: "HR",
|
|
126
|
-
tag: "HR",
|
|
127
|
-
...ELEMENT_PROPS
|
|
128
|
-
}];
|
|
129
|
-
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { BLOCK_STYLES_SECTIONS, COMPONENT_TYPES, // createBoolProp,
|
|
2
|
-
createTextProp, FORM_TYPES, GROUPS, Triggers } from "@draftbit/types";
|
|
3
|
-
const SEED_DATA_TRIGGERS = [Triggers.OnValueChange];
|
|
4
|
-
const ELEMENT_PROPS = {
|
|
5
|
-
category: COMPONENT_TYPES.element,
|
|
6
|
-
doc_link: "https://www.npmjs.com/package/@expo/html-elements",
|
|
7
|
-
code_link: "https://github.com/expo/expo/tree/master/packages/html-elements",
|
|
8
|
-
stylesPanelSections: BLOCK_STYLES_SECTIONS,
|
|
9
|
-
layout: {
|
|
10
|
-
margin: 0
|
|
11
|
-
},
|
|
12
|
-
triggers: SEED_DATA_TRIGGERS
|
|
13
|
-
};
|
|
14
|
-
const HEADING_PROPS = { ...ELEMENT_PROPS
|
|
15
|
-
};
|
|
16
|
-
export const SEED_DATA = [{
|
|
17
|
-
name: "H1",
|
|
18
|
-
tag: "H1",
|
|
19
|
-
...HEADING_PROPS
|
|
20
|
-
}, {
|
|
21
|
-
name: "H2",
|
|
22
|
-
tag: "H2",
|
|
23
|
-
...HEADING_PROPS
|
|
24
|
-
}, {
|
|
25
|
-
name: "H3",
|
|
26
|
-
tag: "H3",
|
|
27
|
-
...HEADING_PROPS
|
|
28
|
-
}, {
|
|
29
|
-
name: "H4",
|
|
30
|
-
tag: "H4",
|
|
31
|
-
...HEADING_PROPS
|
|
32
|
-
}, {
|
|
33
|
-
name: "H5",
|
|
34
|
-
tag: "H5",
|
|
35
|
-
...HEADING_PROPS
|
|
36
|
-
}, {
|
|
37
|
-
name: "H6",
|
|
38
|
-
tag: "H6",
|
|
39
|
-
...HEADING_PROPS
|
|
40
|
-
}, {
|
|
41
|
-
name: "Anchor",
|
|
42
|
-
tag: "A",
|
|
43
|
-
...ELEMENT_PROPS,
|
|
44
|
-
props: {
|
|
45
|
-
href: createTextProp({
|
|
46
|
-
label: "href",
|
|
47
|
-
description: "Specify the URL",
|
|
48
|
-
defaultValue: ""
|
|
49
|
-
}),
|
|
50
|
-
target: {
|
|
51
|
-
group: GROUPS.basic,
|
|
52
|
-
label: "target",
|
|
53
|
-
description: "decide where link should open",
|
|
54
|
-
formType: FORM_TYPES.flatArray,
|
|
55
|
-
defaultValue: "_blank",
|
|
56
|
-
options: ["_blank", "_self", "_parent", "_top"]
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}, {
|
|
60
|
-
name: "Paragraph",
|
|
61
|
-
tag: "P",
|
|
62
|
-
...ELEMENT_PROPS,
|
|
63
|
-
props: {// NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
|
|
64
|
-
// strong: createBoolProp({
|
|
65
|
-
// label: "Strong",
|
|
66
|
-
// description: "Strong",
|
|
67
|
-
// }),
|
|
68
|
-
// strike: createBoolProp({
|
|
69
|
-
// label: "Strike",
|
|
70
|
-
// description: "Strike through",
|
|
71
|
-
// }),
|
|
72
|
-
// italic: createBoolProp({
|
|
73
|
-
// label: "Italic",
|
|
74
|
-
// description: "Italic Fonts",
|
|
75
|
-
// }),
|
|
76
|
-
// bold: createBoolProp({
|
|
77
|
-
// label: "Bold",
|
|
78
|
-
// description: "Bold",
|
|
79
|
-
// }),
|
|
80
|
-
}
|
|
81
|
-
}, {
|
|
82
|
-
name: "Code",
|
|
83
|
-
tag: "Code",
|
|
84
|
-
...ELEMENT_PROPS
|
|
85
|
-
}, {
|
|
86
|
-
name: "Pre",
|
|
87
|
-
tag: "Pre",
|
|
88
|
-
...ELEMENT_PROPS
|
|
89
|
-
}, {
|
|
90
|
-
name: "Mark",
|
|
91
|
-
tag: "Mark",
|
|
92
|
-
...ELEMENT_PROPS
|
|
93
|
-
}, {
|
|
94
|
-
name: "BR",
|
|
95
|
-
tag: "BR",
|
|
96
|
-
...ELEMENT_PROPS
|
|
97
|
-
}, {
|
|
98
|
-
name: "Quote",
|
|
99
|
-
tag: "Q",
|
|
100
|
-
...ELEMENT_PROPS
|
|
101
|
-
}, {
|
|
102
|
-
name: "BlockQuote",
|
|
103
|
-
tag: "BlockQuote",
|
|
104
|
-
...ELEMENT_PROPS
|
|
105
|
-
}, {
|
|
106
|
-
name: "Time",
|
|
107
|
-
tag: "Time",
|
|
108
|
-
...ELEMENT_PROPS
|
|
109
|
-
}, {
|
|
110
|
-
name: "UL",
|
|
111
|
-
tag: "UL",
|
|
112
|
-
...ELEMENT_PROPS
|
|
113
|
-
}, {
|
|
114
|
-
name: "LI",
|
|
115
|
-
tag: "LI",
|
|
116
|
-
...ELEMENT_PROPS
|
|
117
|
-
}, {
|
|
118
|
-
name: "HR",
|
|
119
|
-
tag: "HR",
|
|
120
|
-
...ELEMENT_PROPS
|
|
121
|
-
}];
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export declare const SEED_DATA: ({
|
|
2
|
-
category: string;
|
|
3
|
-
doc_link: string;
|
|
4
|
-
code_link: string;
|
|
5
|
-
stylesPanelSections: string[];
|
|
6
|
-
layout: {
|
|
7
|
-
margin: number;
|
|
8
|
-
};
|
|
9
|
-
triggers: string[];
|
|
10
|
-
name: string;
|
|
11
|
-
tag: string;
|
|
12
|
-
} | {
|
|
13
|
-
props: {
|
|
14
|
-
href: any;
|
|
15
|
-
target: {
|
|
16
|
-
group: string;
|
|
17
|
-
label: string;
|
|
18
|
-
description: string;
|
|
19
|
-
formType: string;
|
|
20
|
-
defaultValue: string;
|
|
21
|
-
options: string[];
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
category: string;
|
|
25
|
-
doc_link: string;
|
|
26
|
-
code_link: string;
|
|
27
|
-
stylesPanelSections: string[];
|
|
28
|
-
layout: {
|
|
29
|
-
margin: number;
|
|
30
|
-
};
|
|
31
|
-
triggers: string[];
|
|
32
|
-
name: string;
|
|
33
|
-
tag: string;
|
|
34
|
-
} | {
|
|
35
|
-
props: {
|
|
36
|
-
href?: undefined;
|
|
37
|
-
target?: undefined;
|
|
38
|
-
};
|
|
39
|
-
category: string;
|
|
40
|
-
doc_link: string;
|
|
41
|
-
code_link: string;
|
|
42
|
-
stylesPanelSections: string[];
|
|
43
|
-
layout: {
|
|
44
|
-
margin: number;
|
|
45
|
-
};
|
|
46
|
-
triggers: string[];
|
|
47
|
-
name: string;
|
|
48
|
-
tag: string;
|
|
49
|
-
})[];
|