@3t-transform/threeteeui 0.0.21 → 0.0.23

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 (101) hide show
  1. package/dist/cjs/{index-bf777121.js → index-2943e8f8.js} +1 -122
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/tttx-button.cjs.entry.js +1 -1
  4. package/dist/cjs/tttx-icon.cjs.entry.js +1 -1
  5. package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +8 -5
  6. package/dist/cjs/tttx-loading-spinner.cjs.entry.js +1 -1
  7. package/dist/cjs/tttx-standalone-input.cjs.entry.js +6 -4
  8. package/dist/cjs/tttx.cjs.js +2 -2
  9. package/dist/collection/collection-manifest.json +1 -7
  10. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +7 -4
  11. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +28 -9
  12. package/dist/components/index.d.ts +0 -6
  13. package/dist/components/index.js +0 -6
  14. package/dist/components/tttx-button.js +54 -1
  15. package/dist/components/tttx-keyvalue-block.js +7 -4
  16. package/dist/components/tttx-loading-spinner.js +38 -1
  17. package/dist/components/tttx-standalone-input.js +8 -5
  18. package/dist/esm/{index-a05bd606.js → index-058a3cd0.js} +2 -122
  19. package/dist/esm/loader.js +3 -3
  20. package/dist/esm/tttx-button.entry.js +1 -1
  21. package/dist/esm/tttx-icon.entry.js +1 -1
  22. package/dist/esm/tttx-keyvalue-block.entry.js +8 -5
  23. package/dist/esm/tttx-loading-spinner.entry.js +1 -1
  24. package/dist/esm/tttx-standalone-input.entry.js +6 -4
  25. package/dist/esm/tttx.js +3 -3
  26. package/dist/tttx/{p-68ff0f39.entry.js → p-046868d9.entry.js} +1 -1
  27. package/dist/tttx/{p-93763d3c.entry.js → p-1adb2b75.entry.js} +1 -1
  28. package/dist/tttx/{p-a5808741.entry.js → p-495cf4b3.entry.js} +1 -1
  29. package/dist/tttx/p-a4d9929a.entry.js +1 -0
  30. package/dist/tttx/p-ad637dde.entry.js +1 -0
  31. package/dist/tttx/p-bbb7dbf7.js +2 -0
  32. package/dist/tttx/tttx.esm.js +1 -1
  33. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +3 -2
  34. package/dist/types/components.d.ts +6 -140
  35. package/package.json +2 -2
  36. package/dist/cjs/tttx-checkbox.cjs.entry.js +0 -28
  37. package/dist/cjs/tttx-form.cjs.entry.js +0 -374
  38. package/dist/cjs/tttx-input-calendar.cjs.entry.js +0 -125
  39. package/dist/cjs/tttx-list.cjs.entry.js +0 -198
  40. package/dist/cjs/tttx-popover-content.cjs.entry.js +0 -23
  41. package/dist/cjs/tttx-table.cjs.entry.js +0 -60
  42. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.css +0 -30
  43. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.js +0 -97
  44. package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.stories.js +0 -23
  45. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.css +0 -181
  46. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.js +0 -102
  47. package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.stories.js +0 -13
  48. package/dist/collection/components/molecules/tttx-form/tttx-form.css +0 -314
  49. package/dist/collection/components/molecules/tttx-form/tttx-form.js +0 -452
  50. package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +0 -109
  51. package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.css +0 -93
  52. package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.js +0 -174
  53. package/dist/collection/components/molecules/tttx-input-calendar/tttx-input-calendar.stories.js +0 -27
  54. package/dist/collection/components/molecules/tttx-list/tttx-list.css +0 -56
  55. package/dist/collection/components/molecules/tttx-list/tttx-list.js +0 -312
  56. package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +0 -37
  57. package/dist/collection/components/molecules/tttx-table/tttx-table.css +0 -166
  58. package/dist/collection/components/molecules/tttx-table/tttx-table.js +0 -174
  59. package/dist/collection/components/molecules/tttx-table/tttx-table.stories.js +0 -81
  60. package/dist/components/tttx-button2.js +0 -56
  61. package/dist/components/tttx-checkbox.d.ts +0 -11
  62. package/dist/components/tttx-checkbox.js +0 -46
  63. package/dist/components/tttx-form.d.ts +0 -11
  64. package/dist/components/tttx-form.js +0 -391
  65. package/dist/components/tttx-input-calendar.d.ts +0 -11
  66. package/dist/components/tttx-input-calendar.js +0 -157
  67. package/dist/components/tttx-list.d.ts +0 -11
  68. package/dist/components/tttx-list.js +0 -225
  69. package/dist/components/tttx-loading-spinner2.js +0 -40
  70. package/dist/components/tttx-popover-content.d.ts +0 -11
  71. package/dist/components/tttx-popover-content.js +0 -6
  72. package/dist/components/tttx-popover-content2.js +0 -39
  73. package/dist/components/tttx-table.d.ts +0 -11
  74. package/dist/components/tttx-table.js +0 -91
  75. package/dist/esm/tttx-checkbox.entry.js +0 -24
  76. package/dist/esm/tttx-form.entry.js +0 -370
  77. package/dist/esm/tttx-input-calendar.entry.js +0 -121
  78. package/dist/esm/tttx-list.entry.js +0 -194
  79. package/dist/esm/tttx-popover-content.entry.js +0 -19
  80. package/dist/esm/tttx-table.entry.js +0 -56
  81. package/dist/tttx/p-037d286f.entry.js +0 -1
  82. package/dist/tttx/p-07b134af.js +0 -2
  83. package/dist/tttx/p-1b63f16a.entry.js +0 -1
  84. package/dist/tttx/p-45afb84c.entry.js +0 -1
  85. package/dist/tttx/p-74061060.entry.js +0 -1
  86. package/dist/tttx/p-9536b8c4.entry.js +0 -1
  87. package/dist/tttx/p-a92ca87e.entry.js +0 -1
  88. package/dist/tttx/p-a96ca037.entry.js +0 -1
  89. package/dist/tttx/p-f579ed1e.entry.js +0 -1
  90. package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.d.ts +0 -7
  91. package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.stories.d.ts +0 -18
  92. package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.d.ts +0 -9
  93. package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.stories.d.ts +0 -6
  94. package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +0 -134
  95. package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +0 -12
  96. package/dist/types/components/molecules/tttx-input-calendar/tttx-input-calendar.d.ts +0 -19
  97. package/dist/types/components/molecules/tttx-input-calendar/tttx-input-calendar.stories.d.ts +0 -26
  98. package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +0 -51
  99. package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +0 -13
  100. package/dist/types/components/molecules/tttx-table/tttx-table.d.ts +0 -15
  101. package/dist/types/components/molecules/tttx-table/tttx-table.stories.d.ts +0 -21
@@ -1,452 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
- import { h, Host } from '@stencil/core';
3
- export class TttxForm {
4
- constructor() {
5
- // Create a new template element using the HTMLTemplateElement interface.
6
- this.template = document.createElement('template');
7
- this.formschema = undefined;
8
- this.submitValue = undefined;
9
- }
10
- // This method is called whenever the "formschema" property changes
11
- onFormSchemaChange(newValue) {
12
- // Check if the new value is a string, indicating that it needs to be parsed
13
- if (typeof newValue === 'string') {
14
- // Parse the string and set the "_formSchema" property
15
- this._formSchema = JSON.parse(newValue);
16
- }
17
- else {
18
- // If the new value is already an object, set the "_formSchema" property directly
19
- this._formSchema = newValue;
20
- }
21
- }
22
- /**
23
- * Handles the focus event for a form field and emits a "dataChanged" event
24
- * to the parent component with the field name and its new value.
25
- *
26
- * @param {FocusEvent} event - The focus event triggered by the field.
27
- * @return {void}
28
- */
29
- fieldChanged(event) {
30
- // Extract the name and value of the field from the event
31
- const fieldName = event.target.name;
32
- const fieldValue = event.target.value;
33
- // Emit an event to signal that the field's data has changed
34
- this.dataChanged.emit({ name: fieldName, value: fieldValue });
35
- }
36
- /**
37
- * Validates the input field on focusout event by checking its validity state,
38
- * sets an error message if there's an issue, and emits a "dataChanged" event to
39
- * the parent component with the field name and its new value.
40
- *
41
- * @param {FocusEvent} event - The focusout event triggered by the input field.
42
- * @return {void}
43
- */
44
- validityCheck(event) {
45
- var _a, _b, _c, _d;
46
- event.preventDefault();
47
- const target = event.target;
48
- let hasError = true;
49
- let errorMessage = '';
50
- // validity object on HTML5 inputs has the following options
51
- // badInput
52
- // customError
53
- // patternMismatch
54
- // rangeOverflow
55
- // rangeUnderflow
56
- // stepMismatch
57
- // tooLong
58
- // tooShort
59
- // typeMismatch
60
- // valid
61
- // valueMissing
62
- // customErrors can be set with
63
- // target.setCustomValidity('custom error!');
64
- // and cleared with
65
- // target.setCustomValidity('');
66
- // Check the validity of the input field and set an error message if needed
67
- switch (true) {
68
- // The field is required, but has no value
69
- case target.validity.valueMissing:
70
- errorMessage = (_a = target.dataset.required) !== null && _a !== void 0 ? _a : 'This field is required';
71
- break;
72
- // The field's value does not match the expected pattern
73
- case target.validity.patternMismatch:
74
- errorMessage = (_b = target.dataset.pattern) !== null && _b !== void 0 ? _b : 'Incorrect format';
75
- break;
76
- // The field's value is not of the correct input type
77
- case target.validity.badInput:
78
- // IE string in a number field
79
- errorMessage = (_c = target.dataset.badinput) !== null && _c !== void 0 ? _c : 'Wrong input type';
80
- break;
81
- // The field's value is above or below the range set in the "min" and "max" attributes
82
- case target.validity.rangeOverflow || target.validity.rangeUnderflow:
83
- // IE date or number is above or below value set in min or max tags
84
- errorMessage = (_d = target.dataset.range) !== null && _d !== void 0 ? _d : 'Invalid value';
85
- break;
86
- // No error detected
87
- default:
88
- hasError = false;
89
- }
90
- // Set the error state of the input field based on the error message and whether an error was detected
91
- this.setErrorState(target, hasError, errorMessage);
92
- }
93
- /**
94
- * Sets the error state of an input field by updating its class and error message.
95
- * If an error was detected, it sets the input field's class to "invalid" and
96
- * displays the error message in an error bubble. If no error was detected,
97
- * it removes the "invalid" class from the input field and clears the error bubble.
98
- *
99
- * @param {HTMLInputElement} target - The input field to update.
100
- * @param {boolean} hasError - Whether an error was detected in the field.
101
- * @param {string} errorMessage - The error message to display (if any).
102
- * @return {void}
103
- */
104
- setErrorState(target, hasError, errorMessage) {
105
- // Find the error bubble element for the input field
106
- const errorBubble = target.parentElement.querySelector('.errorBubble');
107
- // If an error was detected, set the input field's class to "invalid" and display the error message in the error bubble
108
- if (hasError) {
109
- target.className = 'invalid';
110
- const errorIcon = this.createErrorIcon();
111
- errorBubble.replaceChildren(errorIcon, errorMessage);
112
- }
113
- // If no error was detected, remove the "invalid" class from the input field and clear the error bubble
114
- else {
115
- target.className = '';
116
- errorBubble.replaceChildren();
117
- }
118
- }
119
- // Create an error icon element to display in the error bubble of an input field
120
- createErrorIcon() {
121
- // Create a new <span> element to serve as the error icon
122
- const errorIcon = document.createElement('span');
123
- // Set the class of the error icon to a pre-defined CSS class that specifies the icon's appearance
124
- errorIcon.className = 'material-symbols-rounded';
125
- // Set the text content of the error icon to the word "warning"
126
- errorIcon.textContent = 'warning';
127
- // Return the error icon element
128
- return errorIcon;
129
- }
130
- /**
131
- * Submits the form data to the server.
132
- *
133
- * @param {SubmitEvent} event - The event object for the form submission.
134
- * @returns {void}
135
- *
136
- * @example
137
- * const form = document.getElementById('myForm');
138
- * form.addEventListener('submit', (event) => {
139
- * doSubmit(event);
140
- * });
141
- */
142
- doSubmit(event) {
143
- // prevent the form from submitting normally
144
- event.preventDefault();
145
- // create a new FormData object with the form data
146
- const formData = new FormData(event.target);
147
- // emit the form data through the `dataSubmitted` event
148
- this.dataSubmitted.emit(formData);
149
- }
150
- // This method is called before the component is loaded into the DOM
151
- componentWillLoad() {
152
- // Initialize the form schema by calling the "onFormSchemaChange" method with the current "formschema" property
153
- this.onFormSchemaChange(this.formschema);
154
- }
155
- // This method is called before the component is rendered
156
- componentWillRender() {
157
- // Clear the template to account for a potential re-render scenario
158
- this.template = document.createElement('template');
159
- // Populate the form from the form schema
160
- this.populateFormFromSchema();
161
- }
162
- /**
163
- * Creates a new HTMLInputElement with the specified name, type, and placeholder (if any),
164
- * and sets its autocomplete and autocapitalization properties to off.
165
- *
166
- * @param {string} formKey - The name of the input field, as specified in the form schema.
167
- * @param {Object} formProperties - An object containing additional properties for the input field, such as its type and placeholder value.
168
- * @param {string} formProperties.type - The type of the input field (e.g., "text", "email", "number", etc.).
169
- * @param {string} [formProperties.placeholder] - An optional placeholder value to display in the input field.
170
- * @return {HTMLInputElement} - The new input element.
171
- */
172
- createInput(formKey, formProperties) {
173
- var _a;
174
- // Create a new <input> element with the specified name and type
175
- const input = document.createElement('input');
176
- input.name = formKey;
177
- input.type = formProperties.type;
178
- // Set the placeholder attribute to the specified value (if any)
179
- input.placeholder = (_a = formProperties.placeholder) !== null && _a !== void 0 ? _a : '';
180
- // Disable autocomplete and autocapitalization
181
- input.autocomplete = 'off';
182
- input.autocapitalize = 'off';
183
- // Return the input element
184
- return input;
185
- }
186
- /**
187
- * Applies validation attributes to an input element based on the specified validation object.
188
- * If a certain property is present in the object, it will set the corresponding attribute on
189
- * the input element (e.g., "required" will set the "required" and "data-required" attributes,
190
- * "pattern" will set the "pattern" and "data-pattern" attributes, etc.).
191
- *
192
- * @param {HTMLInputElement} input - The input element to apply validation attributes to.
193
- * @param {Object} validation - An object containing the validation rules for the input field.
194
- * @param {Object} [validation.required] - An object containing a "message" property to display if the field is required.
195
- * @param {Object} [validation.pattern] - An object containing a "pattern" property to match against the field value, and a "message" property to display if the pattern doesn't match.
196
- * @param {Object} [validation.badInput] - An object containing a "message" property to display if the field value is invalid.
197
- * @param {Object} [validation.minmax] - An object containing "min" and "max" properties to validate the field value against, and a "message" property to display if the value is out of range.
198
- * @param {string} [validation.maxlength] - The maximum length of the input field.
199
- * @return {void}
200
- */
201
- applyValidation(input, validation) {
202
- var _a, _b;
203
- // If the "required" property is present, add the "required" attribute to the input element and
204
- // set its "data-required" attribute to the specified message (if any)
205
- if (validation.required) {
206
- input.setAttribute('required', '');
207
- input.setAttribute('data-required', (_a = validation.required.message) !== null && _a !== void 0 ? _a : '');
208
- }
209
- // If the "pattern" property is present, add the "pattern" attribute to the input element and set
210
- // its "data-pattern" attribute to the specified message (if any)
211
- if (validation.pattern) {
212
- input.setAttribute('pattern', validation.pattern.pattern);
213
- input.setAttribute('data-pattern', (_b = validation.pattern.message) !== null && _b !== void 0 ? _b : '');
214
- }
215
- // If the "badInput" property is present, set the input element's "data-badinput" attribute to
216
- // the specified message
217
- if (validation.badInput) {
218
- input.setAttribute('data-badinput', validation.badInput.message);
219
- }
220
- // If the "minmax" property is present, add the "min" and "max" attributes to the input element
221
- // and set its "data-range" attribute to the specified message (if any)
222
- if (validation.minmax) {
223
- input.setAttribute('min', validation.minmax.min);
224
- input.setAttribute('max', validation.minmax.max);
225
- input.setAttribute('data-range', validation.minmax.message);
226
- }
227
- // If the "maxlength" property is present, add the "maxlength" attribute to the input element
228
- if (validation.maxlength) {
229
- input.setAttribute('maxlength', validation.maxlength);
230
- }
231
- }
232
- // Create a new error bubble element
233
- createErrorBubble() {
234
- // Create a new <div> element with the "errorBubble" class
235
- const errorBubble = document.createElement('div');
236
- errorBubble.className = 'errorBubble';
237
- // Return the error bubble element
238
- return errorBubble;
239
- }
240
- /**
241
- * Creates a new <label> element with the "inputBlock" class and the specified label text,
242
- * and appends the input element and error bubble element to it. If the form property has
243
- * no validation object, it adds an "optional" span element to the label.
244
- *
245
- * @param {Object} formProperties - An object containing properties for the form field, including its label text and validation rules.
246
- * @param {HTMLInputElement} input - The input element to associate with the label.
247
- * @param {HTMLDivElement} errorBubble - The error bubble element to display error messages in.
248
- * @return {HTMLLabelElement} - The new label element.
249
- */
250
- createLabel(formProperties, input, errorBubble) {
251
- // Create a new <label> element with the "inputBlock" class and the specified text
252
- const label = document.createElement('label');
253
- label.className = 'inputBlock';
254
- label.innerText = formProperties.label;
255
- // If the form property has no validation object, add an "optional" span element to the label
256
- if (!formProperties.validation) {
257
- const optionalSpan = document.createElement('span');
258
- optionalSpan.className = 'optional';
259
- optionalSpan.innerHTML = '&nbsp;(optional)';
260
- label.appendChild(optionalSpan);
261
- }
262
- // Append the input element and error bubble element to the label
263
- label.appendChild(input);
264
- label.appendChild(errorBubble);
265
- // Return the label element
266
- return label;
267
- }
268
- /**
269
- * Creates a new <input> element with the "submit" type, the "primary-blue" class, and the
270
- * specified label text (i.e., "Save" by default), and returns the new submit button element.
271
- *
272
- * @return {HTMLInputElement} - The new submit button element.
273
- */
274
- createSubmitButton() {
275
- // Create a new <input> element with the "submit" type and the specified class and value
276
- const submitButton = document.createElement('input');
277
- submitButton.type = 'submit';
278
- submitButton.className = 'button primary-blue';
279
- submitButton.value = 'Save';
280
- // Return the submit button element
281
- return submitButton;
282
- }
283
- /**
284
- * Populates the form template with input fields and labels based on the properties of the
285
- * current form schema. For each property in the schema, it creates an input element, applies
286
- * any validation rules to it, creates an error bubble and label element, and appends them
287
- * to the form template. Finally, it creates and appends a submit button element to the form.
288
- *
289
- * @return {void}
290
- */
291
- populateFormFromSchema() {
292
- // If there is no form schema, return early
293
- if (!this._formSchema)
294
- return;
295
- // Get the properties of the form schema and their keys
296
- const properties = this._formSchema.properties;
297
- const propertyKeys = Object.keys(properties);
298
- // Loop through each property key and create an input, label, and error bubble for it
299
- propertyKeys.forEach(formKey => {
300
- const formItem = properties[formKey];
301
- const formProperties = formItem.form;
302
- const input = this.createInput(formKey, formProperties);
303
- // If the form property has validation, apply it to the input
304
- if (formProperties.validation) {
305
- this.applyValidation(input, formProperties.validation);
306
- }
307
- // Create an error bubble and label element for the input
308
- const errorBubble = this.createErrorBubble();
309
- const label = this.createLabel(formProperties, input, errorBubble);
310
- // Append the label element to the form template
311
- this.template.content.append(label);
312
- });
313
- // Create and append a submit button element to the form template
314
- const submitButton = this.createSubmitButton();
315
- this.template.content.append(submitButton);
316
- }
317
- /**
318
- * Clones the form template and binds event listeners to its input elements. First, it checks if
319
- * there is a form schema present. If so, it clones the template's content, binds events to form
320
- * input elements, and appends the cloned form elements to the fieldset. The event listeners include
321
- * "oninvalid" (to check input validity on submit), "onblur" (to check input validity on blur),
322
- * "onkeyup" (to handle changes in input fields), and "onchange" (to handle changes in select fields).
323
- *
324
- * @return {void}
325
- */
326
- componentDidRender() {
327
- // If there's no form schema, return
328
- if (!this._formSchema) {
329
- return;
330
- }
331
- // Clone the template's content and store it in a variable
332
- const formItems = this.template.content.cloneNode(true);
333
- // Bind event listeners to form elements
334
- const properties = this._formSchema.properties;
335
- const propertyKeys = Object.keys(properties);
336
- propertyKeys.forEach((formKey) => {
337
- const formInput = formItems.querySelector(`[name=${formKey}]`);
338
- // Bind events to form input elements
339
- formInput.oninvalid = this.validityCheck.bind(this);
340
- formInput.onblur = this.validityCheck.bind(this);
341
- formInput.onkeyup = this.fieldChanged.bind(this);
342
- formInput.onchange = this.fieldChanged.bind(this);
343
- });
344
- // Append the cloned form elements to the fieldset
345
- this.fieldset.appendChild(formItems);
346
- }
347
- /**
348
- * Renders the component's template as a form element with a fieldset container. The form's
349
- * "onSubmit" event is bound to the "doSubmit" function, which handles the form submission
350
- * and emits a "dataSubmitted" event with the form data. The fieldset element is assigned
351
- * to the "fieldset" instance variable using a ref, so it can be populated with form elements
352
- * later on.
353
- *
354
- * @return {JSX.Element} - The rendered form template as a JSX element.
355
- */
356
- render() {
357
- return (h(Host, null, h("form", { onSubmit: this.doSubmit.bind(this) }, h("fieldset", { ref: el => (this.fieldset = el) }))));
358
- }
359
- static get is() { return "tttx-form"; }
360
- static get encapsulation() { return "shadow"; }
361
- static get originalStyleUrls() {
362
- return {
363
- "$": ["tttx-form.scss"]
364
- };
365
- }
366
- static get styleUrls() {
367
- return {
368
- "$": ["tttx-form.css"]
369
- };
370
- }
371
- static get properties() {
372
- return {
373
- "formschema": {
374
- "type": "any",
375
- "mutable": false,
376
- "complexType": {
377
- "original": "any",
378
- "resolved": "any",
379
- "references": {}
380
- },
381
- "required": false,
382
- "optional": false,
383
- "docs": {
384
- "tags": [],
385
- "text": ""
386
- },
387
- "attribute": "formschema",
388
- "reflect": false
389
- },
390
- "submitValue": {
391
- "type": "any",
392
- "mutable": false,
393
- "complexType": {
394
- "original": "any",
395
- "resolved": "any",
396
- "references": {}
397
- },
398
- "required": false,
399
- "optional": false,
400
- "docs": {
401
- "tags": [],
402
- "text": ""
403
- },
404
- "attribute": "submit-value",
405
- "reflect": false
406
- }
407
- };
408
- }
409
- static get events() {
410
- return [{
411
- "method": "dataSubmitted",
412
- "name": "dataSubmitted",
413
- "bubbles": true,
414
- "cancelable": true,
415
- "composed": true,
416
- "docs": {
417
- "tags": [],
418
- "text": ""
419
- },
420
- "complexType": {
421
- "original": "FormData",
422
- "resolved": "FormData",
423
- "references": {
424
- "FormData": {
425
- "location": "global"
426
- }
427
- }
428
- }
429
- }, {
430
- "method": "dataChanged",
431
- "name": "dataChanged",
432
- "bubbles": true,
433
- "cancelable": true,
434
- "composed": true,
435
- "docs": {
436
- "tags": [],
437
- "text": ""
438
- },
439
- "complexType": {
440
- "original": "{ name: string, value: any }",
441
- "resolved": "{ name: string; value: any; }",
442
- "references": {}
443
- }
444
- }];
445
- }
446
- static get watchers() {
447
- return [{
448
- "propName": "formschema",
449
- "methodName": "onFormSchemaChange"
450
- }];
451
- }
452
- }
@@ -1,109 +0,0 @@
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
- const jsonFormSchema = JSON.stringify(formSchema);
109
- export const ExampleFormFromJSON = () => `<tttx-form formSchema='${jsonFormSchema}'></tttx-form>`;
@@ -1,93 +0,0 @@
1
- .material-symbols-rounded {
2
- font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
3
- }
4
-
5
- :host {
6
- display: block;
7
- --border-radius: 4px;
8
- position: relative;
9
- }
10
-
11
- .calcontainer {
12
- -webkit-perspective: 500px;
13
- perspective: 500px;
14
- }
15
-
16
- .lefty {
17
- float: left;
18
- }
19
-
20
- .righty {
21
- float: right;
22
- }
23
-
24
- .calendar {
25
- display: none;
26
- position: absolute;
27
- box-sizing: border-box;
28
- width: 312px;
29
- height: 332px;
30
- background-color: white;
31
- padding: 16px;
32
- box-shadow: 0px 1px 5px rgba(17, 17, 17, 0.3);
33
- border-radius: var(--border-radius);
34
- }
35
-
36
- .calendar-header {
37
- display: flex;
38
- justify-content: space-between;
39
- margin-bottom: 8px;
40
- }
41
-
42
- .date-display {
43
- margin-top: 8px;
44
- }
45
-
46
- .calendar-header select {
47
- border: none;
48
- padding: 5px;
49
- }
50
-
51
- .calendar-table {
52
- width: 100%;
53
- border-collapse: collapse;
54
- }
55
-
56
- .calendar-table th {
57
- text-align: center;
58
- padding: 4px;
59
- text-transform: uppercase;
60
- font-size: 14px;
61
- color: #757575;
62
- border-bottom: 1px solid #d5d5d5;
63
- margin-bottom: 8px;
64
- }
65
-
66
- .calendar .calendar-table td {
67
- padding: 0;
68
- margin: 0;
69
- width: 14.2%;
70
- text-align: center;
71
- height: 36px;
72
- line-height: 36px;
73
- }
74
-
75
- .calendar .calendar-table td span:hover {
76
- background-color: #f0f0f0;
77
- }
78
-
79
- .calendar .calendar-table td span {
80
- display: block;
81
- text-align: center;
82
- padding: 4px;
83
- cursor: pointer;
84
- border-radius: var(--border-radius);
85
- }
86
-
87
- .calendar-visible {
88
- display: block;
89
- }
90
-
91
- .calendar-table thead tr {
92
- border-bottom: 1px solid #d5d5d5;
93
- }