Skip to content

Commit b3640e1

Browse files
authored
Updates to Text Inputs and Text Areas (#545)
* Add blurOnSubmit, move disabled, editable to data * Add to more places * Missing Import
1 parent bc20c3d commit b3640e1

File tree

3 files changed

+44
-10
lines changed

3 files changed

+44
-10
lines changed

packages/core/src/mappings/TextArea.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
PROP_TYPES,
66
FIELD_NAME,
77
Triggers,
8+
createDisabledProp,
89
} from "@draftbit/types";
910

1011
export const SEED_DATA = {
@@ -69,6 +70,17 @@ export const SEED_DATA = {
6970
formType: FORM_TYPES.boolean,
7071
propType: PROP_TYPES.BOOLEAN,
7172
},
73+
blurOnSubmit: {
74+
group: GROUPS.advanced,
75+
label: "Blur On Submit",
76+
description: "If true, the text field will blur when submitted. ",
77+
editable: true,
78+
required: false,
79+
defaultValue: null,
80+
formType: FORM_TYPES.boolean,
81+
propType: PROP_TYPES.BOOLEAN,
82+
},
83+
disabled: createDisabledProp(),
7284
caretHidden: {
7385
group: GROUPS.advanced,
7486
label: "Hide Caret",
@@ -91,12 +103,12 @@ export const SEED_DATA = {
91103
propType: PROP_TYPES.BOOLEAN,
92104
},
93105
editable: {
94-
group: GROUPS.advanced,
95-
label: "Editable",
106+
group: GROUPS.data,
107+
label: "Editable?",
96108
description: "If false, the text is not editable",
97109
editable: true,
98110
required: false,
99-
defaultValue: true,
111+
defaultValue: null,
100112
formType: FORM_TYPES.boolean,
101113
propType: PROP_TYPES.BOOLEAN,
102114
},

packages/core/src/mappings/TextField.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const SEED_DATA_PROPS = {
7777
propType: PROP_TYPES.BOOLEAN,
7878
},
7979
disabled: {
80-
group: GROUPS.basic,
80+
group: GROUPS.data,
8181
label: "Disabled",
8282
description:
8383
"Whether the input should be disabled. Will prevent input and show a greyed out state.",
@@ -88,12 +88,22 @@ const SEED_DATA_PROPS = {
8888
required: false,
8989
},
9090
editable: {
91-
group: GROUPS.advanced,
92-
label: "Editable",
91+
group: GROUPS.data,
92+
label: "Editable?",
9393
description: "If false, the text is not editable",
9494
editable: true,
9595
required: false,
96-
defaultValue: true,
96+
defaultValue: null,
97+
formType: FORM_TYPES.boolean,
98+
propType: PROP_TYPES.BOOLEAN,
99+
},
100+
blurOnSubmit: {
101+
group: GROUPS.advanced,
102+
label: "Blur On Submit",
103+
description: "If true, the text field will blur when submitted. ",
104+
editable: true,
105+
required: false,
106+
defaultValue: null,
97107
formType: FORM_TYPES.boolean,
98108
propType: PROP_TYPES.BOOLEAN,
99109
},

packages/core/src/mappings/TextInput.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
FIELD_NAME,
77
Triggers,
88
StylesPanelSections,
9+
createDisabledProp,
910
} from "@draftbit/types";
1011

1112
export const SEED_DATA_PROPS = {
@@ -168,12 +169,12 @@ export const SEED_DATA = [
168169
propType: PROP_TYPES.BOOLEAN,
169170
},
170171
editable: {
171-
group: GROUPS.advanced,
172-
label: "Editable",
172+
group: GROUPS.data,
173+
label: "Editable?",
173174
description: "If false, the text is not editable",
174175
editable: true,
175176
required: false,
176-
defaultValue: true,
177+
defaultValue: null,
177178
formType: FORM_TYPES.boolean,
178179
propType: PROP_TYPES.BOOLEAN,
179180
},
@@ -258,6 +259,16 @@ export const SEED_DATA = [
258259
formType: FORM_TYPES.string,
259260
propType: PROP_TYPES.STRING,
260261
},
262+
blurOnSubmit: {
263+
group: GROUPS.advanced,
264+
label: "Blur On Submit",
265+
description: "If true, the text field will blur when submitted. ",
266+
editable: true,
267+
required: false,
268+
defaultValue: null,
269+
formType: FORM_TYPES.boolean,
270+
propType: PROP_TYPES.BOOLEAN,
271+
},
261272
returnKeyType: {
262273
group: GROUPS.advanced,
263274
label: "Return Key Type",
@@ -341,6 +352,7 @@ export const SEED_DATA = [
341352
formType: FORM_TYPES.number,
342353
propType: PROP_TYPES.NUMBER,
343354
},
355+
disabled: createDisabledProp(),
344356
scrollEnabled: {
345357
group: GROUPS.basic,
346358
label: "Scroll Enabled",

0 commit comments

Comments
 (0)