@draftbit/core 46.4.4-8a6164.2 → 46.4.4-926784.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 +1 -6
- package/lib/commonjs/components/Text.js +6 -2
- package/lib/commonjs/components/TextField.js +5 -1
- package/lib/commonjs/index.js +84 -0
- package/lib/commonjs/mappings/HtmlElements.js +125 -0
- package/lib/commonjs/mappings/TextField.js +1 -1
- package/lib/commonjs/mappings/TextInput.js +1 -1
- package/lib/module/components/CircularProgress.js +15 -7
- package/lib/module/components/DatePicker/DatePicker.js +1 -5
- package/lib/module/components/Justification.js +0 -1
- package/lib/module/components/Portal/PortalHost.js +26 -15
- package/lib/module/components/Text.js +38 -8
- package/lib/module/components/TextField.js +67 -31
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/HtmlElements.js +116 -0
- package/lib/module/mappings/TextField.js +1 -1
- package/lib/module/mappings/TextInput.js +1 -1
- package/lib/typescript/src/components/Text.d.ts +2 -1
- package/lib/typescript/src/components/TextField.d.ts +2 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/mappings/HtmlElements.d.ts +49 -0
- package/lib/typescript/src/mappings/TextField.d.ts +2 -2
- package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
- package/package.json +4 -3
- package/src/components/DatePicker/DatePicker.js +0 -3
- package/src/components/DatePicker/DatePicker.tsx +0 -4
- 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/index.js +1 -0
- package/src/index.tsx +2 -0
- package/src/mappings/HtmlElements.js +141 -0
- package/src/mappings/HtmlElements.ts +151 -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
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createTextProp, FORM_TYPES, GROUPS, StylesPanelSections, Triggers, } from "@draftbit/types";
|
|
2
|
+
const SEED_DATA_TRIGGERS = [Triggers.OnValueChange];
|
|
3
|
+
const ELEMENT_PROPS = {
|
|
4
|
+
category: COMPONENT_TYPES.element,
|
|
5
|
+
doc_link: "https://www.npmjs.com/package/@expo/html-elements",
|
|
6
|
+
code_link: "https://github.com/expo/expo/tree/master/packages/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
|
+
};
|
|
18
|
+
const HEADING_PROPS = {
|
|
19
|
+
...ELEMENT_PROPS,
|
|
20
|
+
};
|
|
21
|
+
export const SEED_DATA = [
|
|
22
|
+
{
|
|
23
|
+
name: "H1",
|
|
24
|
+
tag: "H1",
|
|
25
|
+
...HEADING_PROPS,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "H2",
|
|
29
|
+
tag: "H2",
|
|
30
|
+
...HEADING_PROPS,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "H3",
|
|
34
|
+
tag: "H3",
|
|
35
|
+
...HEADING_PROPS,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "H4",
|
|
39
|
+
tag: "H4",
|
|
40
|
+
...HEADING_PROPS,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "H5",
|
|
44
|
+
tag: "H5",
|
|
45
|
+
...HEADING_PROPS,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "H6",
|
|
49
|
+
tag: "H6",
|
|
50
|
+
...HEADING_PROPS,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "Anchor",
|
|
54
|
+
tag: "A",
|
|
55
|
+
...ELEMENT_PROPS,
|
|
56
|
+
props: {
|
|
57
|
+
href: createTextProp({
|
|
58
|
+
label: "href",
|
|
59
|
+
description: "Specify the URL",
|
|
60
|
+
defaultValue: "",
|
|
61
|
+
}),
|
|
62
|
+
target: {
|
|
63
|
+
group: GROUPS.basic,
|
|
64
|
+
label: "target",
|
|
65
|
+
description: "decide where link should open",
|
|
66
|
+
formType: FORM_TYPES.flatArray,
|
|
67
|
+
defaultValue: "_blank",
|
|
68
|
+
options: ["_blank", "_self", "_parent", "_top"],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "Paragraph",
|
|
74
|
+
tag: "P",
|
|
75
|
+
...ELEMENT_PROPS,
|
|
76
|
+
props: {
|
|
77
|
+
// NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
|
|
78
|
+
// strong: createBoolProp({
|
|
79
|
+
// label: "Strong",
|
|
80
|
+
// description: "Strong",
|
|
81
|
+
// }),
|
|
82
|
+
// strike: createBoolProp({
|
|
83
|
+
// label: "Strike",
|
|
84
|
+
// description: "Strike through",
|
|
85
|
+
// }),
|
|
86
|
+
// italic: createBoolProp({
|
|
87
|
+
// label: "Italic",
|
|
88
|
+
// description: "Italic Fonts",
|
|
89
|
+
// }),
|
|
90
|
+
// bold: createBoolProp({
|
|
91
|
+
// label: "Bold",
|
|
92
|
+
// description: "Bold",
|
|
93
|
+
// }),
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "Code",
|
|
98
|
+
tag: "Code",
|
|
99
|
+
...ELEMENT_PROPS,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "Pre",
|
|
103
|
+
tag: "Pre",
|
|
104
|
+
...ELEMENT_PROPS,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "Mark",
|
|
108
|
+
tag: "Mark",
|
|
109
|
+
...ELEMENT_PROPS,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "BR",
|
|
113
|
+
tag: "BR",
|
|
114
|
+
...ELEMENT_PROPS,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "BlockQuote",
|
|
118
|
+
tag: "BlockQuote",
|
|
119
|
+
...ELEMENT_PROPS,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "Time",
|
|
123
|
+
tag: "Time",
|
|
124
|
+
...ELEMENT_PROPS,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "UL",
|
|
128
|
+
tag: "UL",
|
|
129
|
+
...ELEMENT_PROPS,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "LI",
|
|
133
|
+
tag: "LI",
|
|
134
|
+
...ELEMENT_PROPS,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "HR",
|
|
138
|
+
tag: "HR",
|
|
139
|
+
...ELEMENT_PROPS,
|
|
140
|
+
},
|
|
141
|
+
];
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPONENT_TYPES,
|
|
3
|
+
createTextProp,
|
|
4
|
+
FORM_TYPES,
|
|
5
|
+
GROUPS,
|
|
6
|
+
StylesPanelSections,
|
|
7
|
+
Triggers,
|
|
8
|
+
} from "@draftbit/types";
|
|
9
|
+
const SEED_DATA_TRIGGERS = [Triggers.OnValueChange];
|
|
10
|
+
|
|
11
|
+
const ELEMENT_PROPS = {
|
|
12
|
+
category: 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: [
|
|
16
|
+
StylesPanelSections.Typography,
|
|
17
|
+
StylesPanelSections.LayoutSelectedItem,
|
|
18
|
+
StylesPanelSections.MarginsAndPaddings,
|
|
19
|
+
StylesPanelSections.Effects,
|
|
20
|
+
],
|
|
21
|
+
layout: {
|
|
22
|
+
margin: 0,
|
|
23
|
+
},
|
|
24
|
+
triggers: SEED_DATA_TRIGGERS,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const HEADING_PROPS = {
|
|
28
|
+
...ELEMENT_PROPS,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const SEED_DATA = [
|
|
32
|
+
{
|
|
33
|
+
name: "H1",
|
|
34
|
+
tag: "H1",
|
|
35
|
+
...HEADING_PROPS,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "H2",
|
|
39
|
+
tag: "H2",
|
|
40
|
+
...HEADING_PROPS,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "H3",
|
|
44
|
+
tag: "H3",
|
|
45
|
+
...HEADING_PROPS,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "H4",
|
|
49
|
+
tag: "H4",
|
|
50
|
+
...HEADING_PROPS,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "H5",
|
|
54
|
+
tag: "H5",
|
|
55
|
+
...HEADING_PROPS,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "H6",
|
|
59
|
+
tag: "H6",
|
|
60
|
+
...HEADING_PROPS,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "Anchor",
|
|
64
|
+
tag: "A",
|
|
65
|
+
...ELEMENT_PROPS,
|
|
66
|
+
props: {
|
|
67
|
+
href: createTextProp({
|
|
68
|
+
label: "href",
|
|
69
|
+
description: "Specify the URL",
|
|
70
|
+
defaultValue: "",
|
|
71
|
+
}),
|
|
72
|
+
target: {
|
|
73
|
+
group: GROUPS.basic,
|
|
74
|
+
label: "target",
|
|
75
|
+
description: "decide where link should open",
|
|
76
|
+
formType: FORM_TYPES.flatArray,
|
|
77
|
+
defaultValue: "_blank",
|
|
78
|
+
options: ["_blank", "_self", "_parent", "_top"],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "Paragraph",
|
|
84
|
+
tag: "P",
|
|
85
|
+
...ELEMENT_PROPS,
|
|
86
|
+
props: {
|
|
87
|
+
// NOTE - Keeping the props commented until we figure out a way to use this props from draftbit side.
|
|
88
|
+
// strong: createBoolProp({
|
|
89
|
+
// label: "Strong",
|
|
90
|
+
// description: "Strong",
|
|
91
|
+
// }),
|
|
92
|
+
// strike: createBoolProp({
|
|
93
|
+
// label: "Strike",
|
|
94
|
+
// description: "Strike through",
|
|
95
|
+
// }),
|
|
96
|
+
// italic: createBoolProp({
|
|
97
|
+
// label: "Italic",
|
|
98
|
+
// description: "Italic Fonts",
|
|
99
|
+
// }),
|
|
100
|
+
// bold: createBoolProp({
|
|
101
|
+
// label: "Bold",
|
|
102
|
+
// description: "Bold",
|
|
103
|
+
// }),
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "Code",
|
|
108
|
+
tag: "Code",
|
|
109
|
+
...ELEMENT_PROPS,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "Pre",
|
|
113
|
+
tag: "Pre",
|
|
114
|
+
...ELEMENT_PROPS,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "Mark",
|
|
118
|
+
tag: "Mark",
|
|
119
|
+
...ELEMENT_PROPS,
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "BR",
|
|
123
|
+
tag: "BR",
|
|
124
|
+
...ELEMENT_PROPS,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "BlockQuote",
|
|
128
|
+
tag: "BlockQuote",
|
|
129
|
+
...ELEMENT_PROPS,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "Time",
|
|
133
|
+
tag: "Time",
|
|
134
|
+
...ELEMENT_PROPS,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "UL",
|
|
138
|
+
tag: "UL",
|
|
139
|
+
...ELEMENT_PROPS,
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "LI",
|
|
143
|
+
tag: "LI",
|
|
144
|
+
...ELEMENT_PROPS,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "HR",
|
|
148
|
+
tag: "HR",
|
|
149
|
+
...ELEMENT_PROPS,
|
|
150
|
+
},
|
|
151
|
+
];
|
|
@@ -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,
|