@3t-transform/threeteeui 0.1.36 → 0.1.41
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/dist/cjs/domsanitiser.options-277161b9.js +1667 -0
- package/dist/cjs/{index-457ca775.js → index-76f14107.js} +2 -88
- package/dist/cjs/loader.cjs.js +2 -3
- package/dist/cjs/tttx-button.cjs.entry.js +25 -25
- package/dist/cjs/tttx-filter.cjs.entry.js +159 -159
- package/dist/cjs/tttx-form.cjs.entry.js +457 -373
- package/dist/cjs/tttx-icon.cjs.entry.js +11 -11
- package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +59 -59
- package/dist/cjs/tttx-list.cjs.entry.js +32 -1694
- package/dist/cjs/tttx-loading-spinner.cjs.entry.js +16 -16
- package/dist/cjs/tttx-sorter.cjs.entry.js +102 -102
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +79 -79
- package/dist/cjs/tttx-toolbar.cjs.entry.js +10 -10
- package/dist/cjs/tttx.cjs.js +2 -6
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/atoms/tttx-button/tttx-button.css +4 -4
- package/dist/collection/components/atoms/tttx-button/tttx-button.js +110 -110
- package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +14 -14
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +62 -62
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +22 -22
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +109 -109
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +38 -38
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +67 -67
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -17
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.js +334 -334
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.stories.js +62 -62
- package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +37 -37
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +61 -58
- package/dist/collection/components/molecules/tttx-form/tttx-form.css +98 -2
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +477 -393
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +274 -218
- package/dist/collection/components/molecules/tttx-list/tttx-list.js +105 -105
- package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +43 -43
- package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.js +224 -224
- package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.stories.js +42 -42
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +759 -759
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +172 -172
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.js +44 -44
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.stories.js +14 -14
- package/dist/collection/components/palette.stories.js +7 -7
- package/dist/collection/docs/gettingstarted-developer.stories.js +5 -5
- package/dist/collection/icons.js +2838 -2838
- package/dist/collection/index.js +1 -1
- package/dist/collection/shared/domsanitiser.options.js +14 -14
- package/dist/components/domsanitiser.options.js +1664 -0
- package/dist/components/index.d.ts +0 -9
- package/dist/components/index.js +1 -1
- package/dist/components/tttx-button.js +49 -49
- package/dist/components/tttx-filter.js +191 -191
- package/dist/components/tttx-form.js +475 -391
- package/dist/components/tttx-icon2.js +28 -28
- package/dist/components/tttx-keyvalue-block.js +76 -76
- package/dist/components/tttx-list.js +54 -1716
- package/dist/components/tttx-loading-spinner.js +33 -33
- package/dist/components/tttx-sorter.js +130 -130
- package/dist/components/tttx-standalone-input.js +130 -130
- package/dist/components/tttx-toolbar.js +26 -26
- package/dist/esm/domsanitiser.options-cc420431.js +1664 -0
- package/dist/esm/{index-d784fb3e.js → index-9cde46a5.js} +3 -88
- package/dist/esm/loader.js +2 -3
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/tttx-button.entry.js +25 -25
- package/dist/esm/tttx-filter.entry.js +159 -159
- package/dist/esm/tttx-form.entry.js +457 -373
- package/dist/esm/tttx-icon.entry.js +11 -11
- package/dist/esm/tttx-keyvalue-block.entry.js +59 -59
- package/dist/esm/tttx-list.entry.js +32 -1694
- package/dist/esm/tttx-loading-spinner.entry.js +16 -16
- package/dist/esm/tttx-sorter.entry.js +102 -102
- package/dist/esm/tttx-standalone-input.entry.js +79 -79
- package/dist/esm/tttx-toolbar.entry.js +10 -10
- package/dist/esm/tttx.js +2 -3
- package/dist/tttx/{p-400868f1.entry.js → p-3b1be372.entry.js} +1 -1
- package/dist/tttx/{p-563605b2.entry.js → p-561224f5.entry.js} +1 -1
- package/dist/tttx/{p-b720c4ad.entry.js → p-9f1e9cc1.entry.js} +1 -1
- package/dist/tttx/{p-798a098a.entry.js → p-aef96333.entry.js} +1 -1
- package/dist/tttx/p-b4290a5b.js +3 -0
- package/dist/tttx/p-bd1edaed.entry.js +1 -0
- package/dist/tttx/p-d0ff9ad0.entry.js +1 -0
- package/dist/tttx/{p-cac26a1b.entry.js → p-d2f1aa8e.entry.js} +1 -1
- package/dist/tttx/p-db059a69.js +2 -0
- package/dist/tttx/p-dc2a37b0.entry.js +1 -0
- package/dist/tttx/{p-ab6ce9f6.entry.js → p-e53c7f9d.entry.js} +1 -1
- package/dist/tttx/{p-92cade7f.entry.js → p-f885f17a.entry.js} +1 -1
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +10 -10
- package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +10 -10
- package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +5 -5
- package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +20 -20
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +7 -7
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +9 -9
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +6 -6
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +17 -17
- package/dist/types/components/molecules/tttx-filter/tttx-filter.d.ts +39 -39
- package/dist/types/components/molecules/tttx-filter/tttx-filter.stories.d.ts +68 -68
- package/dist/types/components/molecules/tttx-form/lib/setErrorState.d.ts +13 -13
- package/dist/types/components/molecules/tttx-form/lib/validityCheck.d.ts +17 -17
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +133 -111
- package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +278 -13
- package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +11 -11
- package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +14 -14
- package/dist/types/components/molecules/tttx-sorter/tttx-sorter.d.ts +19 -19
- package/dist/types/components/molecules/tttx-sorter/tttx-sorter.stories.d.ts +30 -30
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +69 -69
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +143 -143
- package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.d.ts +4 -4
- package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.stories.d.ts +13 -13
- package/dist/types/components/palette.stories.d.ts +6 -6
- package/dist/types/components.d.ts +1 -1
- package/dist/types/docs/gettingstarted-developer.stories.d.ts +5 -5
- package/dist/types/icons.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/shared/domsanitiser.options.d.ts +10 -10
- package/dist/types/stencil-public-runtime.d.ts +3 -59
- package/loader/index.d.ts +0 -9
- package/package.json +1 -1
- package/dist/tttx/p-0ebffdfc.js +0 -2
- package/dist/tttx/p-72e7f7dd.entry.js +0 -3
- package/dist/tttx/p-c4162029.entry.js +0 -1
- package/dist/tttx/p-eb126fd0.entry.js +0 -1
|
@@ -1,112 +1,161 @@
|
|
|
1
|
-
import { withActions } from '@storybook/addon-actions/decorator';
|
|
2
|
-
export default {
|
|
3
|
-
title: 'molecules/Form',
|
|
4
|
-
component: 'tttx-form',
|
|
5
|
-
parameters: {
|
|
6
|
-
actions: {
|
|
7
|
-
handles: ['dataSubmitted', 'dataChanged'],
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
decorators: [withActions],
|
|
11
|
-
};
|
|
12
|
-
const formSchema = {
|
|
13
|
-
properties: {
|
|
14
|
-
title: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
format: 'string',
|
|
17
|
-
form: {
|
|
18
|
-
type: 'text',
|
|
19
|
-
placeholder: 'Mr, Mrs, Dr, Hon Rev',
|
|
20
|
-
label: 'Title'
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
forename: {
|
|
24
|
-
type: 'string',
|
|
25
|
-
format: 'string',
|
|
26
|
-
form: {
|
|
27
|
-
type: 'text',
|
|
28
|
-
placeholder: 'John',
|
|
29
|
-
label: 'Forename',
|
|
30
|
-
validation: {
|
|
31
|
-
required: {
|
|
32
|
-
message: 'Please enter your forename',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
surname: {
|
|
38
|
-
type: 'string',
|
|
39
|
-
format: 'string',
|
|
40
|
-
form: {
|
|
41
|
-
type: 'text',
|
|
42
|
-
placeholder: 'Doe',
|
|
43
|
-
label: 'Surname',
|
|
44
|
-
validation: {
|
|
45
|
-
required: {
|
|
46
|
-
message: 'Please enter your surname',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
postcode: {
|
|
52
|
-
type: 'string',
|
|
53
|
-
format: 'string',
|
|
54
|
-
form: {
|
|
55
|
-
type: 'text',
|
|
56
|
-
placeholder: 'AB10',
|
|
57
|
-
label: 'Start of postcode',
|
|
58
|
-
validation: {
|
|
59
|
-
required: {
|
|
60
|
-
message: 'Please enter the beginning of your postcode',
|
|
61
|
-
},
|
|
62
|
-
pattern: {
|
|
63
|
-
pattern: '^([A-Za-z][0-9])$|^([A-Za-z][0-9]{2})$|^([A-Za-z]{2}[0-9])$|^([A-Za-z]{2}[0-9]{2})$|^([A-Za-z][0-9][A-Za-z])$|^([A-Za-z]{2}[0-9][A-Za-z])$|^(GIR|BF|BX|XX)$',
|
|
64
|
-
message: 'Please enter the first half of your postcode. EG: ZZ99',
|
|
65
|
-
},
|
|
66
|
-
maxlength: 4,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
age: {
|
|
71
|
-
type: 'number',
|
|
72
|
-
format: 'number',
|
|
73
|
-
form: {
|
|
74
|
-
type: 'number',
|
|
75
|
-
placeholder: '',
|
|
76
|
-
label: 'Age',
|
|
77
|
-
validation: {
|
|
78
|
-
required: {
|
|
79
|
-
message: 'Please enter your age',
|
|
80
|
-
},
|
|
81
|
-
badInput: {
|
|
82
|
-
message: 'Please enter a number',
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
dob: {
|
|
88
|
-
type: 'string',
|
|
89
|
-
format: 'date-time',
|
|
90
|
-
form: {
|
|
91
|
-
type: 'date',
|
|
92
|
-
placeholder: '',
|
|
93
|
-
label: 'Date of birth',
|
|
94
|
-
validation: {
|
|
95
|
-
required: {
|
|
96
|
-
message: 'Please enter your date of birth',
|
|
97
|
-
},
|
|
98
|
-
minmax: {
|
|
99
|
-
min: '1900-01-01',
|
|
100
|
-
max: '2100-12-31',
|
|
101
|
-
message: 'Please enter a date between 1900 and 2100',
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
1
|
+
import { withActions } from '@storybook/addon-actions/decorator';
|
|
2
|
+
export default {
|
|
3
|
+
title: 'molecules/Form',
|
|
4
|
+
component: 'tttx-form',
|
|
5
|
+
parameters: {
|
|
6
|
+
actions: {
|
|
7
|
+
handles: ['dataSubmitted', 'dataChanged'],
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
decorators: [withActions],
|
|
11
|
+
};
|
|
12
|
+
const formSchema = {
|
|
13
|
+
properties: {
|
|
14
|
+
title: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
format: 'string',
|
|
17
|
+
form: {
|
|
18
|
+
type: 'text',
|
|
19
|
+
placeholder: 'Mr, Mrs, Dr, Hon Rev',
|
|
20
|
+
label: 'Title',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
forename: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
format: 'string',
|
|
26
|
+
form: {
|
|
27
|
+
type: 'text',
|
|
28
|
+
placeholder: 'John',
|
|
29
|
+
label: 'Forename',
|
|
30
|
+
validation: {
|
|
31
|
+
required: {
|
|
32
|
+
message: 'Please enter your forename',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
surname: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
format: 'string',
|
|
40
|
+
form: {
|
|
41
|
+
type: 'text',
|
|
42
|
+
placeholder: 'Doe',
|
|
43
|
+
label: 'Surname',
|
|
44
|
+
validation: {
|
|
45
|
+
required: {
|
|
46
|
+
message: 'Please enter your surname',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
postcode: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
format: 'string',
|
|
54
|
+
form: {
|
|
55
|
+
type: 'text',
|
|
56
|
+
placeholder: 'AB10',
|
|
57
|
+
label: 'Start of postcode',
|
|
58
|
+
validation: {
|
|
59
|
+
required: {
|
|
60
|
+
message: 'Please enter the beginning of your postcode',
|
|
61
|
+
},
|
|
62
|
+
pattern: {
|
|
63
|
+
pattern: '^([A-Za-z][0-9])$|^([A-Za-z][0-9]{2})$|^([A-Za-z]{2}[0-9])$|^([A-Za-z]{2}[0-9]{2})$|^([A-Za-z][0-9][A-Za-z])$|^([A-Za-z]{2}[0-9][A-Za-z])$|^(GIR|BF|BX|XX)$',
|
|
64
|
+
message: 'Please enter the first half of your postcode. EG: ZZ99',
|
|
65
|
+
},
|
|
66
|
+
maxlength: 4,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
age: {
|
|
71
|
+
type: 'number',
|
|
72
|
+
format: 'number',
|
|
73
|
+
form: {
|
|
74
|
+
type: 'number',
|
|
75
|
+
placeholder: '',
|
|
76
|
+
label: 'Age',
|
|
77
|
+
validation: {
|
|
78
|
+
required: {
|
|
79
|
+
message: 'Please enter your age',
|
|
80
|
+
},
|
|
81
|
+
badInput: {
|
|
82
|
+
message: 'Please enter a number',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
dob: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
format: 'date-time',
|
|
90
|
+
form: {
|
|
91
|
+
type: 'date',
|
|
92
|
+
placeholder: '',
|
|
93
|
+
label: 'Date of birth',
|
|
94
|
+
validation: {
|
|
95
|
+
required: {
|
|
96
|
+
message: 'Please enter your date of birth',
|
|
97
|
+
},
|
|
98
|
+
minmax: {
|
|
99
|
+
min: '1900-01-01',
|
|
100
|
+
max: '2100-12-31',
|
|
101
|
+
message: 'Please enter a date between 1900 and 2100',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
dropdown: {
|
|
107
|
+
form: {
|
|
108
|
+
type: 'select',
|
|
109
|
+
blankDefault: true,
|
|
110
|
+
label: 'Food category',
|
|
111
|
+
options: [
|
|
112
|
+
{ label: 'Choose an option', value: '', placeholder: true },
|
|
113
|
+
{ label: 'Poultry', value: 'Chicken' },
|
|
114
|
+
{ label: 'Fish', value: 'Salmon' },
|
|
115
|
+
{ label: 'Veg', value: 'Lettuce' },
|
|
116
|
+
],
|
|
117
|
+
validation: {
|
|
118
|
+
required: {
|
|
119
|
+
message: 'Must select a value',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
permissions: {
|
|
125
|
+
form: {
|
|
126
|
+
type: 'checkbox',
|
|
127
|
+
label: 'Permissions',
|
|
128
|
+
inlineLabel: 'Please grant permissions to use data',
|
|
129
|
+
validation: {
|
|
130
|
+
required: {
|
|
131
|
+
message: 'Please grant permissions to use data',
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
export const SingleFormItem = args => `<tttx-form formSchema='${JSON.stringify(args.formSchema)}'></tttx-form>`;
|
|
139
|
+
SingleFormItem.args = {
|
|
140
|
+
formSchema: {
|
|
141
|
+
properties: {
|
|
142
|
+
input: {
|
|
143
|
+
type: 'string',
|
|
144
|
+
format: 'string',
|
|
145
|
+
form: {
|
|
146
|
+
type: 'text',
|
|
147
|
+
label: 'Input Field',
|
|
148
|
+
validation: {
|
|
149
|
+
required: {
|
|
150
|
+
message: 'Please enter something',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
export const ExampleFormFromJSON = args => `<tttx-form id='form' formSchema='${JSON.stringify(args.formSchema)}'></tttx-form>
|
|
110
159
|
<hr/>
|
|
111
160
|
<button type='button' id='button'>Submit Form</button>
|
|
112
161
|
<script>
|
|
@@ -122,114 +171,117 @@ export const ExampleFormFromJSON = () => `<tttx-form id='form' formSchema='${jso
|
|
|
122
171
|
tttxform.submit();
|
|
123
172
|
}
|
|
124
173
|
}
|
|
125
|
-
</script>`;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
message: 'Please enter
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
174
|
+
</script>`;
|
|
175
|
+
ExampleFormFromJSON.args = {
|
|
176
|
+
formSchema,
|
|
177
|
+
};
|
|
178
|
+
const formSchemaWithReadonly = {
|
|
179
|
+
properties: {
|
|
180
|
+
title: {
|
|
181
|
+
type: 'string',
|
|
182
|
+
format: 'string',
|
|
183
|
+
form: {
|
|
184
|
+
type: 'text',
|
|
185
|
+
placeholder: 'Mr, Mrs, Dr, Hon Rev',
|
|
186
|
+
label: 'Title',
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
forename: {
|
|
190
|
+
type: 'string',
|
|
191
|
+
format: 'string',
|
|
192
|
+
form: {
|
|
193
|
+
type: 'text',
|
|
194
|
+
placeholder: 'John',
|
|
195
|
+
label: 'Forename',
|
|
196
|
+
validation: {
|
|
197
|
+
required: {
|
|
198
|
+
message: 'Please enter your forename',
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
surname: {
|
|
204
|
+
type: 'string',
|
|
205
|
+
format: 'string',
|
|
206
|
+
form: {
|
|
207
|
+
type: 'text',
|
|
208
|
+
placeholder: 'Doe',
|
|
209
|
+
label: 'Surname',
|
|
210
|
+
validation: {
|
|
211
|
+
required: {
|
|
212
|
+
message: 'Please enter your surname',
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
postcode: {
|
|
218
|
+
type: 'string',
|
|
219
|
+
format: 'string',
|
|
220
|
+
form: {
|
|
221
|
+
type: 'text',
|
|
222
|
+
placeholder: 'AB10',
|
|
223
|
+
label: 'Start of postcode',
|
|
224
|
+
validation: {
|
|
225
|
+
required: {
|
|
226
|
+
message: 'Please enter the beginning of your postcode',
|
|
227
|
+
},
|
|
228
|
+
pattern: {
|
|
229
|
+
pattern: '^([A-Za-z][0-9])$|^([A-Za-z][0-9]{2})$|^([A-Za-z]{2}[0-9])$|^([A-Za-z]{2}[0-9]{2})$|^([A-Za-z][0-9][A-Za-z])$|^([A-Za-z]{2}[0-9][A-Za-z])$|^(GIR|BF|BX|XX)$',
|
|
230
|
+
message: 'Please enter the first half of your postcode. EG: ZZ99',
|
|
231
|
+
},
|
|
232
|
+
maxlength: 4,
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
age: {
|
|
237
|
+
type: 'number',
|
|
238
|
+
format: 'number',
|
|
239
|
+
form: {
|
|
240
|
+
type: 'number',
|
|
241
|
+
placeholder: '',
|
|
242
|
+
label: 'Age',
|
|
243
|
+
readonly: true,
|
|
244
|
+
validation: {
|
|
245
|
+
required: {
|
|
246
|
+
message: 'Please enter your age',
|
|
247
|
+
},
|
|
248
|
+
badInput: {
|
|
249
|
+
message: 'Please enter a number',
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
dob: {
|
|
255
|
+
type: 'string',
|
|
256
|
+
format: 'date-time',
|
|
257
|
+
form: {
|
|
258
|
+
type: 'date',
|
|
259
|
+
placeholder: '',
|
|
260
|
+
label: 'Date of birth',
|
|
261
|
+
readonly: true,
|
|
262
|
+
validation: {
|
|
263
|
+
required: {
|
|
264
|
+
message: 'Please enter your date of birth',
|
|
265
|
+
},
|
|
266
|
+
minmax: {
|
|
267
|
+
min: '1900-01-01',
|
|
268
|
+
max: '2100-12-31',
|
|
269
|
+
message: 'Please enter a date between 1900 and 2100',
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
const data = {
|
|
277
|
+
title: 'Ms',
|
|
278
|
+
forename: 'Jane',
|
|
279
|
+
surname: 'Doe',
|
|
280
|
+
postcode: 'AB10',
|
|
281
|
+
age: '50',
|
|
282
|
+
dob: '1973-06-02',
|
|
283
|
+
};
|
|
284
|
+
export const PrePopulateForm = args => `<tttx-form id='form' formSchema='${JSON.stringify(args.formSchema)}' data='${JSON.stringify(args.data)}'></tttx-form>
|
|
233
285
|
<hr/>
|
|
234
286
|
<button type='button' id='button'>Submit Form</button>
|
|
235
287
|
<script>
|
|
@@ -245,4 +297,8 @@ export const PrePopulateForm = () => `<tttx-form id='form' formSchema='${formSch
|
|
|
245
297
|
tttxform.submit();
|
|
246
298
|
}
|
|
247
299
|
}
|
|
248
|
-
</script>`;
|
|
300
|
+
</script>`;
|
|
301
|
+
PrePopulateForm.args = {
|
|
302
|
+
data,
|
|
303
|
+
formSchema: formSchemaWithReadonly,
|
|
304
|
+
};
|