@3t-transform/threeteeui 0.2.106 → 0.2.108
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/tttx-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/tttx-dialog-box.cjs.entry.js +1 -1
- package/dist/cjs/tttx-dialog.cjs.entry.js +1 -1
- package/dist/cjs/tttx-form.cjs.entry.js +184 -28
- package/dist/cjs/tttx-tabs.cjs.entry.js +2 -5
- package/dist/collection/components/atoms/tttx-checkbox/tttx-checkbox.js +1 -1
- package/dist/collection/components/molecules/tttx-dialog/tttx-dialog.css +1 -0
- package/dist/collection/components/molecules/tttx-dialog-box/tttx-dialog-box.css +1 -0
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +3 -1
- package/dist/collection/components/molecules/tttx-form/tttx-form.css +19 -0
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +180 -26
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +64 -10
- package/dist/collection/components/molecules/tttx-tabs/tttx-tabs.js +2 -5
- package/dist/components/tttx-checkbox.js +1 -1
- package/dist/components/tttx-dialog-box.js +1 -1
- package/dist/components/tttx-dialog.js +1 -1
- package/dist/components/tttx-form.js +184 -28
- package/dist/components/tttx-tabs.js +2 -5
- package/dist/esm/tttx-checkbox.entry.js +1 -1
- package/dist/esm/tttx-dialog-box.entry.js +1 -1
- package/dist/esm/tttx-dialog.entry.js +1 -1
- package/dist/esm/tttx-form.entry.js +184 -28
- package/dist/esm/tttx-tabs.entry.js +2 -5
- package/dist/tttx/{p-5462c08c.entry.js → p-20d3d8fb.entry.js} +1 -1
- package/dist/tttx/p-562eafbd.entry.js +1 -0
- package/dist/tttx/{p-61ef7773.entry.js → p-69e15a92.entry.js} +1 -1
- package/dist/tttx/p-91cf9bd4.entry.js +1 -0
- package/dist/tttx/{p-5c40a5db.entry.js → p-c476e635.entry.js} +1 -1
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +14 -0
- package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +64 -8
- package/package.json +9 -5
- package/dist/tttx/p-a19ad838.entry.js +0 -1
- package/dist/tttx/p-b2cfa283.entry.js +0 -1
|
@@ -171,6 +171,59 @@ export class TttxForm {
|
|
|
171
171
|
// Return the input element
|
|
172
172
|
return input;
|
|
173
173
|
}
|
|
174
|
+
createStartEndDateComponent(formKey, formProperties) {
|
|
175
|
+
const startDate = document.createElement('input');
|
|
176
|
+
const endDate = document.createElement('input');
|
|
177
|
+
startDate.type = endDate.type = 'date';
|
|
178
|
+
startDate.name = `${formKey}-startdate`;
|
|
179
|
+
endDate.name = `${formKey}-enddate`;
|
|
180
|
+
startDate.setAttribute('data-formkey', formKey);
|
|
181
|
+
endDate.setAttribute('data-formkey', formKey);
|
|
182
|
+
if (formProperties.readonly) {
|
|
183
|
+
startDate.readOnly = true;
|
|
184
|
+
endDate.readOnly = true;
|
|
185
|
+
}
|
|
186
|
+
this.applyValidation(startDate, { required: { message: 'Please enter a start date' }, dateCompare: { to: endDate.name } });
|
|
187
|
+
this.applyValidation(endDate, { required: { message: 'Please enter an end date' }, dateCompare: { with: startDate.name, message: 'End date cannot be before the start date' } });
|
|
188
|
+
let startTime;
|
|
189
|
+
let endTime;
|
|
190
|
+
if (formProperties.includeTime) {
|
|
191
|
+
startTime = document.createElement('input');
|
|
192
|
+
endTime = document.createElement('input');
|
|
193
|
+
startTime.type = endTime.type = 'time';
|
|
194
|
+
startTime.name = `${formKey}-starttime`;
|
|
195
|
+
endTime.name = `${formKey}-endtime`;
|
|
196
|
+
startTime.setAttribute('data-formkey', formKey);
|
|
197
|
+
endTime.setAttribute('data-formkey', formKey);
|
|
198
|
+
if (formProperties.readonly) {
|
|
199
|
+
startTime.readOnly = true;
|
|
200
|
+
endTime.readOnly = true;
|
|
201
|
+
}
|
|
202
|
+
this.applyValidation(startTime, { required: { message: 'Please enter a start time' } });
|
|
203
|
+
this.applyValidation(endTime, { required: { message: 'Please enter an end time' } });
|
|
204
|
+
}
|
|
205
|
+
const startLabel = document.createElement('label');
|
|
206
|
+
startLabel.innerText = 'Start date';
|
|
207
|
+
const endLabel = document.createElement('label');
|
|
208
|
+
endLabel.innerText = 'End date';
|
|
209
|
+
const startContainer = document.createElement('div');
|
|
210
|
+
const endContainer = document.createElement('div');
|
|
211
|
+
startContainer.className = endContainer.className = 'outer-container inputBlock';
|
|
212
|
+
startLabel.className = endLabel.className = 'flex-label';
|
|
213
|
+
startContainer.append(startDate);
|
|
214
|
+
if (startTime) {
|
|
215
|
+
startContainer.append(startTime);
|
|
216
|
+
}
|
|
217
|
+
startLabel.append(startContainer);
|
|
218
|
+
startLabel.append(this.createErrorBubble());
|
|
219
|
+
endContainer.append(endDate);
|
|
220
|
+
if (endTime) {
|
|
221
|
+
endContainer.append(endTime);
|
|
222
|
+
}
|
|
223
|
+
endLabel.append(endContainer);
|
|
224
|
+
endLabel.append(this.createErrorBubble());
|
|
225
|
+
return { start: startLabel, end: endLabel };
|
|
226
|
+
}
|
|
174
227
|
/**
|
|
175
228
|
* Applies validation attributes to an input element based on the specified validation object.
|
|
176
229
|
* If a certain property is present in the object, it will set the corresponding attribute on
|
|
@@ -191,6 +244,7 @@ export class TttxForm {
|
|
|
191
244
|
* @param {string} [validation.minmax.max]
|
|
192
245
|
* @param {string} [validation.minmax.message]
|
|
193
246
|
* @param {string} [validation.maxlength] - The maximum length of the input field.
|
|
247
|
+
* @param {string} [validation.datecompare] - To compare start and end date fields.
|
|
194
248
|
* @return {void}
|
|
195
249
|
*/
|
|
196
250
|
applyValidation(input, validation) {
|
|
@@ -223,6 +277,16 @@ export class TttxForm {
|
|
|
223
277
|
if (validation.maxlength) {
|
|
224
278
|
input.setAttribute('maxlength', validation.maxlength);
|
|
225
279
|
}
|
|
280
|
+
// Custom validation parameters for start date and end date comparison
|
|
281
|
+
if (validation.dateCompare) {
|
|
282
|
+
if (validation.dateCompare.message && validation.dateCompare.with) {
|
|
283
|
+
input.setAttribute('data-compare', validation.dateCompare.message);
|
|
284
|
+
input.setAttribute('data-compare-with', validation.dateCompare.with);
|
|
285
|
+
}
|
|
286
|
+
if (validation.dateCompare.to) {
|
|
287
|
+
input.setAttribute('data-compare-to', validation.dateCompare.to);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
226
290
|
}
|
|
227
291
|
// Create a new error bubble element
|
|
228
292
|
createErrorBubble() {
|
|
@@ -339,6 +403,7 @@ export class TttxForm {
|
|
|
339
403
|
* @return {void}
|
|
340
404
|
*/
|
|
341
405
|
populateFormFromSchema() {
|
|
406
|
+
var _a;
|
|
342
407
|
// If there is no form schema, return early
|
|
343
408
|
if (!this._formSchema)
|
|
344
409
|
return;
|
|
@@ -346,9 +411,17 @@ export class TttxForm {
|
|
|
346
411
|
const properties = this._formSchema.properties;
|
|
347
412
|
const propertyKeys = Object.keys(properties);
|
|
348
413
|
// Loop through each property key and create an input, label, and error bubble for it
|
|
349
|
-
|
|
414
|
+
for (const formKey of propertyKeys) {
|
|
350
415
|
const formItem = properties[formKey];
|
|
351
416
|
const formProperties = formItem.form;
|
|
417
|
+
// complex form types which require
|
|
418
|
+
// custom HTML should be done here
|
|
419
|
+
if (formProperties.type === 'startenddate') {
|
|
420
|
+
const { start, end } = this.createStartEndDateComponent(formKey, formProperties);
|
|
421
|
+
this.template.content.append(start);
|
|
422
|
+
this.template.content.append(end);
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
352
425
|
let input;
|
|
353
426
|
switch (formProperties.type) {
|
|
354
427
|
case 'select':
|
|
@@ -361,15 +434,22 @@ export class TttxForm {
|
|
|
361
434
|
input = this.createInput(formKey, formProperties);
|
|
362
435
|
}
|
|
363
436
|
// If the form property has validation, apply it to the input
|
|
364
|
-
if (formProperties.validation &&
|
|
437
|
+
if (formProperties.validation &&
|
|
438
|
+
formProperties.type !== 'radio') {
|
|
365
439
|
this.applyValidation(input, formProperties.validation);
|
|
366
440
|
}
|
|
367
441
|
// Create an error bubble and label element for the input
|
|
368
442
|
const errorBubble = this.createErrorBubble();
|
|
369
443
|
const label = this.createLabel(formProperties, input, errorBubble);
|
|
444
|
+
// If explicitly setting input as invalid, set invalid state and error message on render
|
|
445
|
+
if ((_a = formProperties.validation) === null || _a === void 0 ? void 0 : _a.invalid) {
|
|
446
|
+
const errorMessage = formProperties.validation.invalid.message;
|
|
447
|
+
input.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
|
|
448
|
+
setErrorState(input, true, errorMessage);
|
|
449
|
+
}
|
|
370
450
|
// Append the label element to the form template
|
|
371
451
|
this.template.content.append(label);
|
|
372
|
-
}
|
|
452
|
+
}
|
|
373
453
|
}
|
|
374
454
|
/**
|
|
375
455
|
* Clones the form template and binds event listeners to its input elements. First, it checks if
|
|
@@ -390,47 +470,121 @@ export class TttxForm {
|
|
|
390
470
|
// Bind event listeners to form elements
|
|
391
471
|
const properties = this._formSchema.properties;
|
|
392
472
|
const propertyKeys = Object.keys(properties);
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
const
|
|
396
|
-
for (const formInput of formInputs) {
|
|
473
|
+
for (const formKey of propertyKeys) {
|
|
474
|
+
const formItemsByKey = formItems.querySelectorAll(`[name^=${formKey}]`);
|
|
475
|
+
for (const formInput of formItemsByKey) {
|
|
397
476
|
// Bind events to form input elements
|
|
398
477
|
formInput.oninvalid = this.validityCheckWrapper.bind(this);
|
|
399
478
|
formInput.onblur = this.validityCheckWrapper.bind(this);
|
|
400
479
|
formInput.onkeyup = this.fieldChanged.bind(this);
|
|
401
480
|
formInput.onchange = this.fieldChanged.bind(this);
|
|
402
|
-
if (
|
|
403
|
-
|
|
481
|
+
if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
|
|
482
|
+
formInput.addEventListener('change', () => {
|
|
483
|
+
formInput.classList.remove('placeholder');
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-with')) {
|
|
487
|
+
formInput.oninvalid = this.endDateComparisonValidator.bind(this);
|
|
488
|
+
formInput.onblur = this.endDateComparisonValidator.bind(this);
|
|
489
|
+
}
|
|
490
|
+
if (properties[formKey].form.type === 'startenddate' && formInput.type === 'time') {
|
|
491
|
+
formInput.oninvalid = this.startEndTimeComparitor.bind(this);
|
|
492
|
+
formInput.onblur = this.startEndTimeComparitor.bind(this);
|
|
493
|
+
}
|
|
494
|
+
if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-to')) {
|
|
495
|
+
formInput.oninvalid = this.startDateComparisonValidator.bind(this);
|
|
496
|
+
formInput.onblur = this.startDateComparisonValidator.bind(this);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
// populate with existing form data if available
|
|
501
|
+
if (this._data && Object.keys(this._data).length > 0) {
|
|
502
|
+
const dataKeys = Object.keys(this._data);
|
|
503
|
+
for (const key of dataKeys) {
|
|
504
|
+
const formItemsByKey = formItems.querySelectorAll(`[name=${key}]`);
|
|
505
|
+
for (const formItem of formItemsByKey) {
|
|
506
|
+
switch (formItem.type) {
|
|
404
507
|
case 'checkbox':
|
|
405
|
-
if (this._data[
|
|
406
|
-
|
|
508
|
+
if (this._data[key] === 'on') {
|
|
509
|
+
formItem.checked = true;
|
|
407
510
|
}
|
|
408
511
|
break;
|
|
409
512
|
case 'radio':
|
|
410
|
-
if (
|
|
411
|
-
|
|
513
|
+
if (formItem.value === this._data[key]) {
|
|
514
|
+
formItem.checked = true;
|
|
412
515
|
}
|
|
413
516
|
break;
|
|
414
517
|
default:
|
|
415
|
-
|
|
518
|
+
formItem.value = this._data[key];
|
|
416
519
|
}
|
|
417
520
|
}
|
|
418
|
-
// If explicitly setting input as invalid, set invalid state and error message on render
|
|
419
|
-
if ((_b = properties[formKey].form.validation) === null || _b === void 0 ? void 0 : _b.invalid) {
|
|
420
|
-
const errorMessage = properties[formKey].form.validation.invalid.message;
|
|
421
|
-
formInput.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
|
|
422
|
-
setErrorState(formInput, true, errorMessage);
|
|
423
|
-
}
|
|
424
|
-
if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
|
|
425
|
-
formInput.addEventListener('change', () => {
|
|
426
|
-
formInput.classList.remove('placeholder');
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
521
|
}
|
|
430
|
-
}
|
|
522
|
+
}
|
|
431
523
|
// Append the cloned form elements to the fieldset
|
|
432
524
|
this.fieldset.replaceChildren(formItems);
|
|
433
525
|
}
|
|
526
|
+
startEndTimeComparitor(event) {
|
|
527
|
+
var _a, _b;
|
|
528
|
+
const target = event.target;
|
|
529
|
+
const formKey = target.getAttribute('data-formkey');
|
|
530
|
+
const timeFields = Array.from(target.parentElement.parentElement.parentElement.querySelectorAll(`[data-formkey=${formKey}]`));
|
|
531
|
+
if (timeFields.length === 4) {
|
|
532
|
+
const startTime = timeFields.find(t => t.name.endsWith('starttime'));
|
|
533
|
+
const endTime = timeFields.find(t => t.name.endsWith('endtime'));
|
|
534
|
+
const startDate = timeFields.find(t => t.name.endsWith('startdate'));
|
|
535
|
+
const endDate = timeFields.find(t => t.name.endsWith('enddate'));
|
|
536
|
+
if (startTime.valueAsNumber >= endTime.valueAsNumber && ((_a = startDate.valueAsDate) === null || _a === void 0 ? void 0 : _a.valueOf()) === ((_b = endDate.valueAsDate) === null || _b === void 0 ? void 0 : _b.valueOf())) {
|
|
537
|
+
setErrorState(endTime, true, 'End time cannot be the same or before the start time');
|
|
538
|
+
if (target.name.endsWith('starttime')) {
|
|
539
|
+
this.validityCheckWrapper(event);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
// clear any end time comparitor errors and perform the standard validity check on the event
|
|
544
|
+
endTime.setCustomValidity('');
|
|
545
|
+
setErrorState(endTime, false, null);
|
|
546
|
+
this.validityCheckWrapper(event);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
clearTimeComparitor(event) {
|
|
551
|
+
const target = event.target;
|
|
552
|
+
const formKey = target.getAttribute('data-formkey');
|
|
553
|
+
const timeFields = Array.from(target.parentElement.parentElement.parentElement.querySelectorAll(`[type=time][data-formkey=${formKey}]`));
|
|
554
|
+
if (timeFields.length) {
|
|
555
|
+
const endTime = timeFields.find(t => t.name.endsWith('endtime'));
|
|
556
|
+
endTime.setCustomValidity('');
|
|
557
|
+
setErrorState(endTime, false, null);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
startDateComparisonValidator(event) {
|
|
561
|
+
const startDate = event.target;
|
|
562
|
+
const compareToName = startDate.getAttribute('data-compare-to');
|
|
563
|
+
const endDate = startDate.parentElement.parentElement.parentElement.querySelector(`[name=${compareToName}]`);
|
|
564
|
+
this.endDateComparisonValidator({ target: endDate }, true);
|
|
565
|
+
this.validityCheckWrapper(event);
|
|
566
|
+
}
|
|
567
|
+
endDateComparisonValidator(event, triggeredByStartDate = false) {
|
|
568
|
+
var _a, _b, _c, _d;
|
|
569
|
+
const endDate = event.target;
|
|
570
|
+
if (!endDate.value && triggeredByStartDate)
|
|
571
|
+
return;
|
|
572
|
+
const compareWithName = endDate.getAttribute('data-compare-with');
|
|
573
|
+
const startDate = endDate.parentElement.parentElement.parentElement.querySelector(`[name=${compareWithName}]`);
|
|
574
|
+
if (((_a = endDate.valueAsDate) === null || _a === void 0 ? void 0 : _a.valueOf()) < ((_b = startDate.valueAsDate) === null || _b === void 0 ? void 0 : _b.valueOf())) {
|
|
575
|
+
endDate.setCustomValidity(endDate.getAttribute('data-compare'));
|
|
576
|
+
setErrorState(endDate, true, endDate.getAttribute('data-compare'));
|
|
577
|
+
}
|
|
578
|
+
else if (((_c = endDate.valueAsDate) === null || _c === void 0 ? void 0 : _c.valueOf()) === ((_d = startDate.valueAsDate) === null || _d === void 0 ? void 0 : _d.valueOf())) {
|
|
579
|
+
endDate.setCustomValidity('');
|
|
580
|
+
this.validityCheckWrapper(event);
|
|
581
|
+
this.startEndTimeComparitor(event);
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
this.clearTimeComparitor(event);
|
|
585
|
+
this.validityCheckWrapper(event);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
434
588
|
validityCheckWrapper(event) {
|
|
435
589
|
const { target, hasError, errorMessage } = validityCheck(event);
|
|
436
590
|
setErrorState(target, hasError, errorMessage);
|
|
@@ -121,6 +121,30 @@ const formSchema = {
|
|
|
121
121
|
},
|
|
122
122
|
},
|
|
123
123
|
},
|
|
124
|
+
startend: {
|
|
125
|
+
type: 'string',
|
|
126
|
+
format: 'string',
|
|
127
|
+
form: {
|
|
128
|
+
type: 'startenddate',
|
|
129
|
+
includeTime: true
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
expiration: {
|
|
133
|
+
type: 'radio',
|
|
134
|
+
form: {
|
|
135
|
+
type: 'radio',
|
|
136
|
+
label: 'Expiration',
|
|
137
|
+
options: [
|
|
138
|
+
{ label: 'Never expires', value: 'neverExpires' },
|
|
139
|
+
{ label: 'Will expire', value: 'willExpire' },
|
|
140
|
+
],
|
|
141
|
+
validation: {
|
|
142
|
+
required: {
|
|
143
|
+
message: 'Please select validity',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
124
148
|
permissions: {
|
|
125
149
|
form: {
|
|
126
150
|
type: 'checkbox',
|
|
@@ -146,6 +170,9 @@ SingleFormItem.args = {
|
|
|
146
170
|
type: 'text',
|
|
147
171
|
label: 'Input Field',
|
|
148
172
|
validation: {
|
|
173
|
+
invalid: {
|
|
174
|
+
message: "This field is invalid"
|
|
175
|
+
},
|
|
149
176
|
required: {
|
|
150
177
|
message: 'Please enter something',
|
|
151
178
|
},
|
|
@@ -155,6 +182,21 @@ SingleFormItem.args = {
|
|
|
155
182
|
},
|
|
156
183
|
},
|
|
157
184
|
};
|
|
185
|
+
export const StartAndEndDateWithoutTime = args => `<tttx-form formSchema='${JSON.stringify(args.formSchema)}'></tttx-form>`;
|
|
186
|
+
StartAndEndDateWithoutTime.args = {
|
|
187
|
+
formSchema: {
|
|
188
|
+
properties: {
|
|
189
|
+
startend: {
|
|
190
|
+
type: 'string',
|
|
191
|
+
format: 'string',
|
|
192
|
+
form: {
|
|
193
|
+
type: 'startenddate',
|
|
194
|
+
includeTime: false
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
};
|
|
158
200
|
export const ExampleFormFromJSON = args => `<tttx-form id='form' formSchema='${JSON.stringify(args.formSchema)}'></tttx-form>
|
|
159
201
|
<hr/>
|
|
160
202
|
<button type='button' id='button'>Submit Form</button>
|
|
@@ -289,16 +331,12 @@ const formSchemaWithReadonly = {
|
|
|
289
331
|
},
|
|
290
332
|
},
|
|
291
333
|
},
|
|
292
|
-
|
|
334
|
+
startend: {
|
|
335
|
+
type: 'string',
|
|
336
|
+
format: 'string',
|
|
293
337
|
form: {
|
|
294
|
-
type: '
|
|
295
|
-
|
|
296
|
-
inlineLabel: 'Please grant permissions to use data',
|
|
297
|
-
validation: {
|
|
298
|
-
required: {
|
|
299
|
-
message: 'Please grant permissions to use data',
|
|
300
|
-
},
|
|
301
|
-
},
|
|
338
|
+
type: 'startenddate',
|
|
339
|
+
includeTime: true
|
|
302
340
|
},
|
|
303
341
|
},
|
|
304
342
|
expiration: {
|
|
@@ -317,6 +355,18 @@ const formSchemaWithReadonly = {
|
|
|
317
355
|
},
|
|
318
356
|
},
|
|
319
357
|
},
|
|
358
|
+
permissions: {
|
|
359
|
+
form: {
|
|
360
|
+
type: 'checkbox',
|
|
361
|
+
label: 'Permissions',
|
|
362
|
+
inlineLabel: 'Please grant permissions to use data',
|
|
363
|
+
validation: {
|
|
364
|
+
required: {
|
|
365
|
+
message: 'Please grant permissions to use data',
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
},
|
|
320
370
|
},
|
|
321
371
|
};
|
|
322
372
|
const data = {
|
|
@@ -328,7 +378,11 @@ const data = {
|
|
|
328
378
|
dob: '1973-06-02',
|
|
329
379
|
dropdown: 'chicken',
|
|
330
380
|
permissions: 'on',
|
|
331
|
-
expiration: 'willExpire'
|
|
381
|
+
expiration: 'willExpire',
|
|
382
|
+
'startend-startdate': '2021-09-01',
|
|
383
|
+
'startend-starttime': '09:00',
|
|
384
|
+
'startend-enddate': '2024-10-15',
|
|
385
|
+
'startend-endtime': '17:00'
|
|
332
386
|
};
|
|
333
387
|
export const PrePopulateForm = args => `<tttx-form id='form' formSchema='${JSON.stringify(args.formSchema)}' data='${JSON.stringify(args.data)}'></tttx-form>
|
|
334
388
|
<hr/>
|
|
@@ -69,15 +69,12 @@ export class TttxTabs {
|
|
|
69
69
|
if (!this.tabs || this.tabs.length == 0) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
if (this.tabFocus > -1) {
|
|
74
|
-
currentTab = this._tabs[this.tabFocus];
|
|
75
|
-
}
|
|
72
|
+
const selectedTab = this._tabs.find(tab => tab.selected);
|
|
76
73
|
return (h(Host, null, h("div", null, h("div", { class: "tab-bar", role: "tablist", "aria-label": this.tabsName, ref: el => (this.tabList = el) }, this.navigation && (h("div", { class: "left-navigation", tabindex: "0", onClick: this.handleLeftNavigation.bind(this) }, h("tttx-icon", { icon: "navigate_before", color: "black" }))), h("div", { class: 'tabs-container' + (this.wide ? ' wide' : '') }, this._tabs.map(tab => {
|
|
77
74
|
return (h("a", { key: tab.id, id: tab.id, role: "tab", "aria-controls": tab.controls, tabindex: tab.tabIndex, "aria-selected": tab.selected, onClick: () => {
|
|
78
75
|
this.handleTabClick(tab);
|
|
79
76
|
} }, tab.tabName));
|
|
80
|
-
})), this.navigation && (h("div", { class: "right-navigation", tabindex: "0", onClick: this.handleRightNavigation.bind(this) }, h("tttx-icon", { icon: "navigate_next", color: "black" })))), h("article", { key:
|
|
77
|
+
})), this.navigation && (h("div", { class: "right-navigation", tabindex: "0", onClick: this.handleRightNavigation.bind(this) }, h("tttx-icon", { icon: "navigate_next", color: "black" })))), selectedTab && (h("article", { key: selectedTab.id, id: selectedTab.controls, role: "tabpanel", tabindex: "0", "aria-labelledby": selectedTab.id, "aria-expanded": selectedTab.selected, innerHTML: DOMPurify.sanitize(selectedTab.pageContent, domSanitiserOptions), hidden: !selectedTab.selected })))));
|
|
81
78
|
}
|
|
82
79
|
static get is() { return "tttx-tabs"; }
|
|
83
80
|
static get encapsulation() { return "scoped"; }
|
|
@@ -30,7 +30,7 @@ const TttxCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
30
30
|
render() {
|
|
31
31
|
const checkBoxIcon = this.checked ? 'check_box' : 'check_box_outline_blank';
|
|
32
32
|
const renderedIcon = this.indeterminate ? 'indeterminate_check_box' : checkBoxIcon;
|
|
33
|
-
return (h(Host, null, h("label", { class: `tttx-checkbox ${this.inline ? '--inline' : ''}` }, h("input", { class: "tttx-checkbox__input", type: "checkbox", id: this.checkboxId, checked: this.checked, ref: (el) => this.checkbox = el }), h("tttx-icon", { color: this.checked ? 'blue' :
|
|
33
|
+
return (h(Host, null, h("label", { class: `tttx-checkbox ${this.inline ? '--inline' : ''}` }, h("input", { class: "tttx-checkbox__input", type: "checkbox", id: this.checkboxId, checked: this.checked, ref: (el) => this.checkbox = el }), h("tttx-icon", { color: this.checked ? 'blue' : 'grey', icon: renderedIcon, onClick: this.onClick.bind(this) }), h("span", { class: "tttx-checkbox__label" }, this.label))));
|
|
34
34
|
}
|
|
35
35
|
static get watchers() { return {
|
|
36
36
|
"indeterminate": ["watchIndeterminateChange"]
|
|
@@ -3,7 +3,7 @@ import { p as purify, d as domSanitiserOptions } from './domsanitiser.options.js
|
|
|
3
3
|
import { d as defineCustomElement$3 } from './tttx-button2.js';
|
|
4
4
|
import { d as defineCustomElement$2 } from './tttx-icon2.js';
|
|
5
5
|
|
|
6
|
-
const tttxDialogBoxCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}h3{margin-block-start:0em;margin-block-end:0em}.dialog-box{background-color:#ffffff;border:1px solid #d5d5d5;border-radius:4px;box-shadow:0px 1px 5px #1111114d;padding:0}.overflow-visible{overflow-y:auto}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.dialog-box.small{width:400px;min-height:200px}.dialog-box.regular{width:600px;min-height:200px}.dialog-box.large{width:900px;min-height:200px}.dialog-box.mobile{max-width:424px;width:calc(100vw - 20px)}.dialog-box-clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.dialog-box-padding{padding:8px 16px}.dialog-box-align-right{margin-left:auto;display:flex}.dialog-box-header-box{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;height:36px;position:sticky;top:0;background:white}.dialog-box-header{display:flex;align-items:center;width:100%}.dialog-box-title{font-size:18;font-weight:500;font-family:\"Roboto\", serif}.dialog-box-icon{padding-right:8px;width:24px;height:24px}.dialog-box-icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.dialog-box-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.dialog-box-body{text-overflow:ellipsis}.dialog-box-body-box{padding:16px}.dialog-box-footer-box{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px;position:sticky;bottom:0;background:white}.dialog-box-footer{display:flex;align-items:center;width:100%}.dialog-box-spacing-button{margin-right:8px}.dialog-box-header-box.info{border-bottom:1px solid #1479c6}.dialog-box-header-box.success{border-bottom:1px solid #a2bb31}.dialog-box-header-box.warning{border-bottom:1px solid #f59500}.dialog-box-header-box.critical{border-bottom:1px solid #dc0000}";
|
|
6
|
+
const tttxDialogBoxCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}h3{margin-block-start:0em;margin-block-end:0em}.dialog-box{background-color:#ffffff;border:1px solid #d5d5d5;border-radius:4px;box-shadow:0px 1px 5px #1111114d;padding:0}.overflow-visible{overflow-y:auto}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.dialog-box.small{width:400px;min-height:200px}.dialog-box.regular{width:600px;min-height:200px}.dialog-box.large{width:900px;min-height:200px}.dialog-box.mobile{max-width:424px;width:calc(100vw - 20px)}.dialog-box-clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.dialog-box-padding{padding:8px 16px}.dialog-box-align-right{margin-left:auto;display:flex}.dialog-box-header-box{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;height:36px;position:sticky;top:0;background:white;z-index:2}.dialog-box-header{display:flex;align-items:center;width:100%}.dialog-box-title{font-size:18;font-weight:500;font-family:\"Roboto\", serif}.dialog-box-icon{padding-right:8px;width:24px;height:24px}.dialog-box-icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.dialog-box-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.dialog-box-body{text-overflow:ellipsis}.dialog-box-body-box{padding:16px}.dialog-box-footer-box{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px;position:sticky;bottom:0;background:white}.dialog-box-footer{display:flex;align-items:center;width:100%}.dialog-box-spacing-button{margin-right:8px}.dialog-box-header-box.info{border-bottom:1px solid #1479c6}.dialog-box-header-box.success{border-bottom:1px solid #a2bb31}.dialog-box-header-box.warning{border-bottom:1px solid #f59500}.dialog-box-header-box.critical{border-bottom:1px solid #dc0000}";
|
|
7
7
|
|
|
8
8
|
const TttxDialogBox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
9
|
constructor() {
|
|
@@ -8,7 +8,7 @@ const ICON_TYPES = {
|
|
|
8
8
|
warning: { iconName: 'warning', iconColor: 'orange' },
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const tttxDialogCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}h3{margin-block-start:0em;margin-block-end:0em}.dialog-box{background-color:#ffffff;border:1px solid #d5d5d5;border-radius:4px;box-shadow:0px 1px 5px #1111114d;padding:0}.dialog-box.small{width:400px;min-height:200px}.dialog-box.regular{width:600px;min-height:200px}.dialog-box.large{width:900px;min-height:200px}.dialog-box.mobile{max-width:424px;width:calc(100vw - 20px)}.overflow-visible{overflow-y:auto}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.padding{padding:8px 16px}.align-right{margin-left:auto;display:flex}.header{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;align-items:center;height:36px;position:sticky;top:0;background:white}.title{font-size:18;font-weight:500;font-family:\"Roboto\", serif;text-overflow:ellipsis;overflow-x:hidden;white-space:nowrap}.icon{padding-right:8px;width:24px;height:24px}.icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.body-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.body{text-overflow:ellipsis;padding:16px}.footer{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px;position:sticky;background:white;bottom:0}::slotted([slot=buttons]){display:flex;gap:8px}.header.info{border-bottom:1px solid #1479c6}.header.success{border-bottom:1px solid #a2bb31}.header.warning{border-bottom:1px solid #f59500}.header.critical{border-bottom:1px solid #dc0000}";
|
|
11
|
+
const tttxDialogCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}h3{margin-block-start:0em;margin-block-end:0em}.dialog-box{background-color:#ffffff;border:1px solid #d5d5d5;border-radius:4px;box-shadow:0px 1px 5px #1111114d;padding:0}.dialog-box.small{width:400px;min-height:200px}.dialog-box.regular{width:600px;min-height:200px}.dialog-box.large{width:900px;min-height:200px}.dialog-box.mobile{max-width:424px;width:calc(100vw - 20px)}.overflow-visible{overflow-y:auto}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.padding{padding:8px 16px}.align-right{margin-left:auto;display:flex}.header{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;align-items:center;height:36px;position:sticky;top:0;background:white;z-index:2}.title{font-size:18;font-weight:500;font-family:\"Roboto\", serif;text-overflow:ellipsis;overflow-x:hidden;white-space:nowrap}.icon{padding-right:8px;width:24px;height:24px}.icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.body-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.body{text-overflow:ellipsis;padding:16px}.footer{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px;position:sticky;background:white;bottom:0}::slotted([slot=buttons]){display:flex;gap:8px}.header.info{border-bottom:1px solid #1479c6}.header.success{border-bottom:1px solid #a2bb31}.header.warning{border-bottom:1px solid #f59500}.header.critical{border-bottom:1px solid #dc0000}";
|
|
12
12
|
|
|
13
13
|
const TttxDialog$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
14
|
constructor() {
|