@3t-transform/threeteeui 0.0.13 → 0.0.15

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.
Files changed (121) hide show
  1. package/package.json +7 -4
  2. package/dist/cjs/index-bf39be87.js +0 -1530
  3. package/dist/cjs/index.cjs.js +0 -2
  4. package/dist/cjs/loader.cjs.js +0 -22
  5. package/dist/cjs/tttx-button.cjs.entry.js +0 -28
  6. package/dist/cjs/tttx-checkbox.cjs.entry.js +0 -28
  7. package/dist/cjs/tttx-form.cjs.entry.js +0 -186
  8. package/dist/cjs/tttx-icon.cjs.entry.js +0 -1861
  9. package/dist/cjs/tttx-list.cjs.entry.js +0 -198
  10. package/dist/cjs/tttx-loading-spinner.cjs.entry.js +0 -26
  11. package/dist/cjs/tttx-popover-content.cjs.entry.js +0 -23
  12. package/dist/cjs/tttx-standalone-input.cjs.entry.js +0 -136
  13. package/dist/cjs/tttx.cjs.js +0 -23
  14. package/dist/collection/collection-manifest.json +0 -19
  15. package/dist/collection/components/atoms/tttx-button/tttx-button.css +0 -62
  16. package/dist/collection/components/atoms/tttx-button/tttx-button.js +0 -93
  17. package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +0 -27
  18. package/dist/collection/components/atoms/tttx-icon/tttx-icon.css +0 -105
  19. package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +0 -114
  20. package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +0 -47
  21. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.css +0 -48
  22. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +0 -66
  23. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +0 -17
  24. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.css +0 -30
  25. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.js +0 -96
  26. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.stories.js +0 -23
  27. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.css +0 -181
  28. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.js +0 -101
  29. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.stories.js +0 -13
  30. package/dist/collection/components/molecules/tttx-form/tttx-form.css +0 -230
  31. package/dist/collection/components/molecules/tttx-form/tttx-form.js +0 -249
  32. package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +0 -102
  33. package/dist/collection/components/molecules/tttx-list/tttx-list.css +0 -56
  34. package/dist/collection/components/molecules/tttx-list/tttx-list.js +0 -311
  35. package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +0 -37
  36. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css +0 -177
  37. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +0 -569
  38. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +0 -156
  39. package/dist/collection/components/palette.stories.js +0 -88
  40. package/dist/collection/docs/gettingstarted-developer.stories.js +0 -9
  41. package/dist/collection/icons.js +0 -2838
  42. package/dist/collection/index.js +0 -1
  43. package/dist/components/index.d.ts +0 -38
  44. package/dist/components/index.js +0 -9
  45. package/dist/components/tttx-button.d.ts +0 -11
  46. package/dist/components/tttx-button.js +0 -45
  47. package/dist/components/tttx-checkbox.d.ts +0 -11
  48. package/dist/components/tttx-checkbox.js +0 -46
  49. package/dist/components/tttx-form.d.ts +0 -11
  50. package/dist/components/tttx-form.js +0 -203
  51. package/dist/components/tttx-icon.d.ts +0 -11
  52. package/dist/components/tttx-icon.js +0 -6
  53. package/dist/components/tttx-icon2.js +0 -1875
  54. package/dist/components/tttx-list.d.ts +0 -11
  55. package/dist/components/tttx-list.js +0 -225
  56. package/dist/components/tttx-loading-spinner.d.ts +0 -11
  57. package/dist/components/tttx-loading-spinner.js +0 -6
  58. package/dist/components/tttx-loading-spinner2.js +0 -40
  59. package/dist/components/tttx-popover-content.d.ts +0 -11
  60. package/dist/components/tttx-popover-content.js +0 -42
  61. package/dist/components/tttx-standalone-input.d.ts +0 -11
  62. package/dist/components/tttx-standalone-input.js +0 -178
  63. package/dist/esm/index-63c4d25e.js +0 -1501
  64. package/dist/esm/index.js +0 -1
  65. package/dist/esm/loader.js +0 -18
  66. package/dist/esm/polyfills/core-js.js +0 -11
  67. package/dist/esm/polyfills/css-shim.js +0 -1
  68. package/dist/esm/polyfills/dom.js +0 -79
  69. package/dist/esm/polyfills/es5-html-element.js +0 -1
  70. package/dist/esm/polyfills/index.js +0 -34
  71. package/dist/esm/polyfills/system.js +0 -6
  72. package/dist/esm/tttx-button.entry.js +0 -24
  73. package/dist/esm/tttx-checkbox.entry.js +0 -24
  74. package/dist/esm/tttx-form.entry.js +0 -182
  75. package/dist/esm/tttx-icon.entry.js +0 -1857
  76. package/dist/esm/tttx-list.entry.js +0 -194
  77. package/dist/esm/tttx-loading-spinner.entry.js +0 -22
  78. package/dist/esm/tttx-popover-content.entry.js +0 -19
  79. package/dist/esm/tttx-standalone-input.entry.js +0 -132
  80. package/dist/esm/tttx.js +0 -18
  81. package/dist/index.cjs.js +0 -1
  82. package/dist/index.js +0 -1
  83. package/dist/tttx/index.esm.js +0 -0
  84. package/dist/tttx/p-1a4eb1f3.entry.js +0 -1
  85. package/dist/tttx/p-25953f82.entry.js +0 -1
  86. package/dist/tttx/p-2b6720ac.entry.js +0 -1
  87. package/dist/tttx/p-2d54f8aa.entry.js +0 -1
  88. package/dist/tttx/p-4c57bcbd.entry.js +0 -1
  89. package/dist/tttx/p-709246f5.entry.js +0 -1
  90. package/dist/tttx/p-95a29e09.entry.js +0 -1
  91. package/dist/tttx/p-ad0c3fe4.entry.js +0 -1
  92. package/dist/tttx/p-bec472d8.js +0 -2
  93. package/dist/tttx/tttx.esm.js +0 -1
  94. package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +0 -9
  95. package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +0 -20
  96. package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +0 -14
  97. package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +0 -21
  98. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +0 -6
  99. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +0 -17
  100. package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.d.ts +0 -7
  101. package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.stories.d.ts +0 -18
  102. package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.d.ts +0 -9
  103. package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.stories.d.ts +0 -6
  104. package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +0 -18
  105. package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +0 -6
  106. package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +0 -51
  107. package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +0 -13
  108. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +0 -38
  109. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +0 -106
  110. package/dist/types/components/palette.stories.d.ts +0 -6
  111. package/dist/types/components.d.ts +0 -236
  112. package/dist/types/docs/gettingstarted-developer.stories.d.ts +0 -5
  113. package/dist/types/icons.d.ts +0 -2
  114. package/dist/types/index.d.ts +0 -1
  115. package/dist/types/stencil-public-runtime.d.ts +0 -1637
  116. package/loader/cdn.js +0 -3
  117. package/loader/index.cjs.js +0 -3
  118. package/loader/index.d.ts +0 -21
  119. package/loader/index.es2017.js +0 -3
  120. package/loader/index.js +0 -4
  121. package/loader/package.json +0 -11
@@ -1,249 +0,0 @@
1
- import { h, Host } from '@stencil/core';
2
- export class TttxForm {
3
- constructor() {
4
- this.template = document.createElement('template');
5
- this.formschema = undefined;
6
- this.submitValue = undefined;
7
- }
8
- onFormSchemaChange(newValue) {
9
- if (typeof newValue === 'string') {
10
- this._formSchema = JSON.parse(newValue);
11
- }
12
- else {
13
- this._formSchema = newValue;
14
- }
15
- }
16
- validityCheck(event) {
17
- var _a, _b, _c, _d;
18
- event.preventDefault();
19
- const target = event.target;
20
- let hasError = true;
21
- let errorMessage = '';
22
- // validity object on HTML5 inputs has the following options
23
- // badInput
24
- // customError
25
- // patternMismatch
26
- // rangeOverflow
27
- // rangeUnderflow
28
- // stepMismatch
29
- // tooLong
30
- // tooShort
31
- // typeMismatch
32
- // valid
33
- // valueMissing
34
- // customErrors can be set with
35
- // target.setCustomValidity('custom error!');
36
- // and cleared with
37
- // target.setCustomValidity('');
38
- if (target.validity.valueMissing) {
39
- errorMessage = (_a = target.dataset.required) !== null && _a !== void 0 ? _a : 'This field is required';
40
- }
41
- else if (target.validity.patternMismatch) {
42
- errorMessage = (_b = target.dataset.pattern) !== null && _b !== void 0 ? _b : 'Incorrect format';
43
- }
44
- else if (target.validity.badInput) {
45
- // IE string in a number field
46
- errorMessage = (_c = target.dataset.badinput) !== null && _c !== void 0 ? _c : 'Wrong input type';
47
- }
48
- else if (target.validity.rangeOverflow || target.validity.rangeUnderflow) {
49
- // IE date or number is above or below value set in min or max tags
50
- errorMessage = (_d = target.dataset.range) !== null && _d !== void 0 ? _d : 'Invalid value';
51
- }
52
- else {
53
- // no error
54
- hasError = false;
55
- }
56
- if (hasError) {
57
- target.className = 'invalid';
58
- const errorIcon = document.createElement('span');
59
- errorIcon.className = 'material-symbols-rounded';
60
- errorIcon.textContent = 'warning';
61
- target.parentElement.querySelector('.errorBubble').replaceChildren();
62
- target.parentElement.querySelector('.errorBubble').append(errorIcon);
63
- target.parentElement.querySelector('.errorBubble').append(errorMessage);
64
- }
65
- else {
66
- target.className = '';
67
- target.parentElement.querySelector('.errorBubble').replaceChildren();
68
- }
69
- }
70
- doSubmit(event) {
71
- event.preventDefault();
72
- const formData = new FormData(event.target);
73
- // Key value pair matching the key names given by the JSON schema will be output line by line
74
- // TODO: Emit an event so external components can handle the resulting form data
75
- // let output = "";
76
- // for (var [key, value] of formData.entries()) {
77
- // output += `${key} -> ${value}\n`;
78
- // }
79
- // console.log(output);
80
- this.submitEvent.emit(formData);
81
- }
82
- fieldsetChange(event) {
83
- console.log(event.target.name + ' has changed');
84
- // The correct input box will always be the target of the incoming event
85
- // TODO: Emit an event so external components can change based on form values input
86
- }
87
- componentWillLoad() {
88
- // set proper on initial render
89
- this.onFormSchemaChange(this.formschema);
90
- }
91
- componentWillRender() {
92
- this.template.content.replaceChildren(); // clear the template to account for a potential re-render scenario
93
- this.populateFormFromSchema();
94
- }
95
- populateFormFromSchema() {
96
- if (!this._formSchema)
97
- return;
98
- const properties = this._formSchema.properties;
99
- const propertyKeys = Object.keys(properties);
100
- propertyKeys.forEach(formKey => {
101
- var _a, _b, _c;
102
- const formItem = properties[formKey];
103
- const formProperties = formItem.form;
104
- const input = document.createElement('input');
105
- input.name = formKey;
106
- input.type = formProperties.type;
107
- input.placeholder = (_a = formProperties.placeholder) !== null && _a !== void 0 ? _a : '';
108
- input.autocomplete = 'off';
109
- input.autocapitalize = 'off';
110
- if (formProperties.validation) {
111
- const validation = formProperties.validation;
112
- if (validation.required) {
113
- input.setAttribute('required', '');
114
- input.setAttribute('data-required', (_b = validation.required.message) !== null && _b !== void 0 ? _b : '');
115
- }
116
- if (validation.pattern) {
117
- input.setAttribute('pattern', validation.pattern.pattern);
118
- input.setAttribute('data-pattern', (_c = validation.pattern.message) !== null && _c !== void 0 ? _c : '');
119
- }
120
- if (validation.badInput) {
121
- input.setAttribute('data-badinput', validation.badInput.message);
122
- }
123
- if (validation.minmax) {
124
- input.setAttribute('min', validation.minmax.min);
125
- input.setAttribute('max', validation.minmax.max);
126
- input.setAttribute('data-range', validation.minmax.message);
127
- }
128
- if (validation.maxlength) {
129
- input.setAttribute('maxlength', validation.maxlength);
130
- }
131
- }
132
- const errorBubble = document.createElement('div');
133
- errorBubble.className = 'errorBubble';
134
- const label = document.createElement('label');
135
- label.className = 'inputBlock';
136
- label.innerText = formProperties.label;
137
- if (!formProperties.validation) {
138
- const optionalSpan = document.createElement('span');
139
- optionalSpan.className = 'optional';
140
- optionalSpan.innerHTML = ' (optional)';
141
- label.appendChild(optionalSpan);
142
- }
143
- label.appendChild(input);
144
- label.appendChild(errorBubble);
145
- this.template.content.append(label);
146
- });
147
- const submitButton = document.createElement('input');
148
- submitButton.type = 'submit';
149
- submitButton.className = 'button primary-blue';
150
- console.log(this.submitValue);
151
- submitButton.value = 'Save';
152
- this.template.content.append(submitButton);
153
- }
154
- componentDidRender() {
155
- if (!this._formSchema)
156
- return;
157
- const formItems = this.template.content.cloneNode(true);
158
- // bind to events here as you can't do it in a template in stencil
159
- const properties = this._formSchema.properties;
160
- const propertyKeys = Object.keys(properties);
161
- propertyKeys.forEach(formKey => {
162
- formItems.querySelector(`[name=${formKey}]`).oninvalid = this.validityCheck.bind(this);
163
- formItems.querySelector(`[name=${formKey}]`).onblur = this.validityCheck.bind(this);
164
- });
165
- // append to the fieldset
166
- this.fieldset.appendChild(formItems);
167
- }
168
- render() {
169
- return (h(Host, null, h("form", { onSubmit: this.doSubmit.bind(this) }, h("fieldset", { onChange: this.fieldsetChange, ref: el => (this.fieldset = el) }))));
170
- }
171
- static get is() { return "tttx-form"; }
172
- static get encapsulation() { return "shadow"; }
173
- static get originalStyleUrls() {
174
- return {
175
- "$": ["tttx-form.scss"]
176
- };
177
- }
178
- static get styleUrls() {
179
- return {
180
- "$": ["tttx-form.css"]
181
- };
182
- }
183
- static get properties() {
184
- return {
185
- "formschema": {
186
- "type": "any",
187
- "mutable": false,
188
- "complexType": {
189
- "original": "any",
190
- "resolved": "any",
191
- "references": {}
192
- },
193
- "required": false,
194
- "optional": false,
195
- "docs": {
196
- "tags": [],
197
- "text": ""
198
- },
199
- "attribute": "formschema",
200
- "reflect": false
201
- },
202
- "submitValue": {
203
- "type": "any",
204
- "mutable": false,
205
- "complexType": {
206
- "original": "any",
207
- "resolved": "any",
208
- "references": {}
209
- },
210
- "required": false,
211
- "optional": false,
212
- "docs": {
213
- "tags": [],
214
- "text": ""
215
- },
216
- "attribute": "submit-value",
217
- "reflect": false
218
- }
219
- };
220
- }
221
- static get events() {
222
- return [{
223
- "method": "submitEvent",
224
- "name": "submitEvent",
225
- "bubbles": true,
226
- "cancelable": true,
227
- "composed": true,
228
- "docs": {
229
- "tags": [],
230
- "text": ""
231
- },
232
- "complexType": {
233
- "original": "FormData",
234
- "resolved": "FormData",
235
- "references": {
236
- "FormData": {
237
- "location": "global"
238
- }
239
- }
240
- }
241
- }];
242
- }
243
- static get watchers() {
244
- return [{
245
- "propName": "formschema",
246
- "methodName": "onFormSchemaChange"
247
- }];
248
- }
249
- }
@@ -1,102 +0,0 @@
1
- export default {
2
- title: 'molecules/tttx Form',
3
- component: 'tttx-form',
4
- };
5
- const formSchema = {
6
- properties: {
7
- Title: {
8
- type: 'string',
9
- format: 'string',
10
- form: {
11
- type: 'text',
12
- placeholder: 'Mr, Mrs, Dr, Hon Rev',
13
- label: 'Title',
14
- },
15
- },
16
- forename: {
17
- type: 'string',
18
- format: 'string',
19
- form: {
20
- type: 'text',
21
- placeholder: 'John',
22
- label: 'Forename',
23
- validation: {
24
- required: {
25
- message: 'Please enter your forename',
26
- },
27
- },
28
- },
29
- },
30
- surname: {
31
- type: 'string',
32
- format: 'string',
33
- form: {
34
- type: 'text',
35
- placeholder: 'Doe',
36
- label: 'Surname',
37
- validation: {
38
- required: {
39
- message: 'Please enter your surname',
40
- },
41
- },
42
- },
43
- },
44
- postcode: {
45
- type: 'string',
46
- format: 'string',
47
- form: {
48
- type: 'text',
49
- placeholder: 'AB10',
50
- label: 'Start of postcode',
51
- validation: {
52
- required: {
53
- message: 'Please enter the beginning of your postcode',
54
- },
55
- pattern: {
56
- 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)$',
57
- message: 'Please enter the first half of your postcode. EG: ZZ99',
58
- },
59
- maxlength: 4,
60
- },
61
- },
62
- },
63
- age: {
64
- type: 'number',
65
- format: 'number',
66
- form: {
67
- type: 'number',
68
- placeholder: '',
69
- label: 'Age',
70
- validation: {
71
- required: {
72
- message: 'Please enter your age',
73
- },
74
- badInput: {
75
- message: 'Please enter a number',
76
- },
77
- },
78
- },
79
- },
80
- dob: {
81
- type: 'string',
82
- format: 'date-time',
83
- form: {
84
- type: 'date',
85
- placeholder: '',
86
- label: 'Date of birth',
87
- validation: {
88
- required: {
89
- message: 'Please enter your date of birth',
90
- },
91
- minmax: {
92
- min: '1900-01-01',
93
- max: '2100-12-31',
94
- message: 'Please enter a date between 1900 and 2100',
95
- },
96
- },
97
- },
98
- },
99
- },
100
- };
101
- const jsonFormSchema = JSON.stringify(formSchema);
102
- export const ExampleFormFromJSON = () => `<tttx-form formSchema='${jsonFormSchema}'></tttx-form>`;
@@ -1,56 +0,0 @@
1
- .material-symbols-rounded {
2
- font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
3
- }
4
-
5
- .material-symbols-rounded {
6
- font-family: "Material Symbols Rounded", sans-serif;
7
- font-weight: 400;
8
- font-style: normal;
9
- font-size: 24px;
10
- line-height: 1;
11
- letter-spacing: normal;
12
- text-transform: none;
13
- display: inline-block;
14
- white-space: nowrap;
15
- word-wrap: normal;
16
- direction: ltr;
17
- text-rendering: optimizeLegibility;
18
- -webkit-font-smoothing: antialiased;
19
- color: #9e9e9e;
20
- }
21
-
22
- :host {
23
- display: flex;
24
- flex-direction: column;
25
- }
26
-
27
- .tttx-list__row {
28
- min-height: 52px;
29
- line-height: 36px;
30
- padding: 8px;
31
- display: flex;
32
- flex-direction: row;
33
- align-items: center;
34
- cursor: pointer;
35
- border-bottom: 1px solid #d5d5d5;
36
- }
37
- .tttx-list__row .generic-template__content {
38
- width: 100%;
39
- display: flex;
40
- align-items: center;
41
- gap: 8px;
42
- }
43
- .tttx-list__row:first-of-type {
44
- border-top: 1px solid #d5d5d5;
45
- }
46
- .tttx-list__row:focus, .tttx-list__row:active {
47
- background-color: #e6e6e6;
48
- }
49
- .tttx-list__row.selected {
50
- background-color: #e7f1f9;
51
- }
52
-
53
- .load-indicator {
54
- display: flex;
55
- justify-content: center;
56
- }