@3t-transform/threeteeui 0.2.96 → 0.2.98
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/loader.cjs.js +1 -1
- package/dist/cjs/tttx-form.cjs.entry.js +97 -29
- package/dist/cjs/tttx-icon.cjs.entry.js +6 -1
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +1 -1
- package/dist/cjs/tttx-tree-view.cjs.entry.js +4 -2
- package/dist/cjs/tttx.cjs.js +1 -1
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +6 -1
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +1 -1
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +8 -1
- package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +2 -0
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +10 -5
- package/dist/collection/components/molecules/tttx-form/tttx-form.css +7 -0
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +84 -23
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +126 -3
- package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.stories.js +2 -2
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css +7 -0
- package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.js +21 -2
- package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.stories.js +1 -0
- package/dist/components/tttx-form.js +97 -29
- package/dist/components/tttx-icon2.js +6 -1
- package/dist/components/tttx-standalone-input2.js +1 -1
- package/dist/components/tttx-tree-view.js +5 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tttx-form.entry.js +97 -29
- package/dist/esm/tttx-icon.entry.js +6 -1
- package/dist/esm/tttx-standalone-input.entry.js +1 -1
- package/dist/esm/tttx-tree-view.entry.js +4 -2
- package/dist/esm/tttx.js +1 -1
- package/dist/tttx/{p-93e63568.entry.js → p-6e0fac85.entry.js} +1 -1
- package/dist/tttx/p-73bb7a06.entry.js +1 -0
- package/dist/tttx/p-888fb9ee.entry.js +1 -0
- package/dist/tttx/p-bcf3844e.entry.js +1 -0
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +10 -1
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +12 -0
- package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +110 -0
- package/dist/types/components/molecules/tttx-tree-view/tttx-tree-view.d.ts +1 -0
- package/dist/types/components.d.ts +2 -0
- package/package.json +2 -2
- package/dist/tttx/p-a94f7efc.entry.js +0 -1
- package/dist/tttx/p-d5b6dd17.entry.js +0 -1
- package/dist/tttx/p-feea36cb.entry.js +0 -1
|
@@ -110,9 +110,9 @@ const formSchema = {
|
|
|
110
110
|
label: 'Food category',
|
|
111
111
|
options: [
|
|
112
112
|
{ label: 'Choose an option', value: '', placeholder: true },
|
|
113
|
-
{ label: 'Poultry', value: '
|
|
114
|
-
{ label: 'Fish', value: '
|
|
115
|
-
{ label: 'Veg', value: '
|
|
113
|
+
{ label: 'Poultry', value: 'chicken' },
|
|
114
|
+
{ label: 'Fish', value: 'salmon' },
|
|
115
|
+
{ label: 'Veg', value: 'lettuce' },
|
|
116
116
|
],
|
|
117
117
|
validation: {
|
|
118
118
|
required: {
|
|
@@ -271,6 +271,52 @@ const formSchemaWithReadonly = {
|
|
|
271
271
|
},
|
|
272
272
|
},
|
|
273
273
|
},
|
|
274
|
+
dropdown: {
|
|
275
|
+
form: {
|
|
276
|
+
type: 'select',
|
|
277
|
+
blankDefault: true,
|
|
278
|
+
label: 'Food category',
|
|
279
|
+
options: [
|
|
280
|
+
{ label: 'Choose an option', value: '', placeholder: true },
|
|
281
|
+
{ label: 'Poultry', value: 'chicken' },
|
|
282
|
+
{ label: 'Fish', value: 'salmon' },
|
|
283
|
+
{ label: 'Veg', value: 'lettuce' },
|
|
284
|
+
],
|
|
285
|
+
validation: {
|
|
286
|
+
required: {
|
|
287
|
+
message: 'Must select a value',
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
permissions: {
|
|
293
|
+
form: {
|
|
294
|
+
type: 'checkbox',
|
|
295
|
+
label: 'Permissions',
|
|
296
|
+
inlineLabel: 'Please grant permissions to use data',
|
|
297
|
+
validation: {
|
|
298
|
+
required: {
|
|
299
|
+
message: 'Please grant permissions to use data',
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
expiration: {
|
|
305
|
+
type: 'radio',
|
|
306
|
+
form: {
|
|
307
|
+
type: 'radio',
|
|
308
|
+
label: 'Expiration',
|
|
309
|
+
options: [
|
|
310
|
+
{ label: 'Never expires', value: 'neverExpires' },
|
|
311
|
+
{ label: 'Will expire', value: 'willExpire' },
|
|
312
|
+
],
|
|
313
|
+
validation: {
|
|
314
|
+
required: {
|
|
315
|
+
message: 'Please select validity',
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
},
|
|
274
320
|
},
|
|
275
321
|
};
|
|
276
322
|
const data = {
|
|
@@ -280,6 +326,9 @@ const data = {
|
|
|
280
326
|
postcode: 'AB10',
|
|
281
327
|
age: '50',
|
|
282
328
|
dob: '1973-06-02',
|
|
329
|
+
dropdown: 'chicken',
|
|
330
|
+
permissions: 'on',
|
|
331
|
+
expiration: 'willExpire'
|
|
283
332
|
};
|
|
284
333
|
export const PrePopulateForm = args => `<tttx-form id='form' formSchema='${JSON.stringify(args.formSchema)}' data='${JSON.stringify(args.data)}'></tttx-form>
|
|
285
334
|
<hr/>
|
|
@@ -302,3 +351,77 @@ PrePopulateForm.args = {
|
|
|
302
351
|
data,
|
|
303
352
|
formSchema: formSchemaWithReadonly,
|
|
304
353
|
};
|
|
354
|
+
const radioFormSchema = {
|
|
355
|
+
properties: {
|
|
356
|
+
name: {
|
|
357
|
+
type: 'string',
|
|
358
|
+
format: 'string',
|
|
359
|
+
form: {
|
|
360
|
+
type: 'text',
|
|
361
|
+
placeholder: 'Enter a name',
|
|
362
|
+
label: 'Name',
|
|
363
|
+
validation: {
|
|
364
|
+
required: {
|
|
365
|
+
message: 'Please enter name',
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
requiresEvidence: {
|
|
371
|
+
type: 'checkbox',
|
|
372
|
+
form: {
|
|
373
|
+
type: 'checkbox',
|
|
374
|
+
label: '',
|
|
375
|
+
inlineLabel: 'Requires Evidence',
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
validity: {
|
|
379
|
+
type: 'radio',
|
|
380
|
+
form: {
|
|
381
|
+
type: 'radio',
|
|
382
|
+
label: 'Validity',
|
|
383
|
+
options: [
|
|
384
|
+
{ label: 'Never expires', value: 'neverExpires' },
|
|
385
|
+
{ label: 'Validity duration', value: 'validityDuration' },
|
|
386
|
+
],
|
|
387
|
+
validation: {
|
|
388
|
+
required: {
|
|
389
|
+
message: 'Please select validity',
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
option2: {
|
|
395
|
+
type: 'radio',
|
|
396
|
+
form: {
|
|
397
|
+
type: 'radio',
|
|
398
|
+
label: 'Option 2',
|
|
399
|
+
options: [
|
|
400
|
+
{ label: 'Opt 2a', value: 'opt2a' },
|
|
401
|
+
{ label: 'Opt 2b', value: 'opt2b' },
|
|
402
|
+
{ label: 'Opt 2c', value: 'opt2c' },
|
|
403
|
+
],
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
};
|
|
408
|
+
export const FormWithRadio = args => `<tttx-form id='form' formSchema='${JSON.stringify(args.formSchema)}'></tttx-form>
|
|
409
|
+
<hr/>
|
|
410
|
+
<button type='button' id='button'>Submit Form</button>
|
|
411
|
+
<script>
|
|
412
|
+
if (window['tttxform'] === undefined && window['submitButton'] === undefined) {
|
|
413
|
+
let tttxform = document.getElementById('form');
|
|
414
|
+
tttxform.addEventListener('dataSubmitted', (event) => {
|
|
415
|
+
for(var entry of event.detail.entries()) {
|
|
416
|
+
console.log(entry[0], entry[1]);
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
let submitButton = document.getElementById('button');
|
|
420
|
+
submitButton.onclick = () => {
|
|
421
|
+
tttxform.submit();
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
</script>`;
|
|
425
|
+
FormWithRadio.args = {
|
|
426
|
+
formSchema: radioFormSchema,
|
|
427
|
+
};
|
|
@@ -102,7 +102,7 @@ DialogBoxWithDropdown.args = {
|
|
|
102
102
|
body: {
|
|
103
103
|
isCustomHtml: true,
|
|
104
104
|
customHtml: `
|
|
105
|
-
<div style="padding: 5px;">
|
|
105
|
+
<div style="padding: 5px; display: flex; gap: 16px; flex-direction: column">
|
|
106
106
|
<tttx-select-box
|
|
107
107
|
id="htmlSelectBox"
|
|
108
108
|
options-data='${JSON.stringify(tagOptions)}'
|
|
@@ -115,7 +115,7 @@ DialogBoxWithDropdown.args = {
|
|
|
115
115
|
<tttx-standalone-input
|
|
116
116
|
label='Name'
|
|
117
117
|
placeholder='Enter name'
|
|
118
|
-
|
|
118
|
+
></tttx-standalone-input>
|
|
119
119
|
<tttx-select-box
|
|
120
120
|
id="htmlSelectBox2"
|
|
121
121
|
options-data='${JSON.stringify(options)}'
|
package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css
CHANGED
|
@@ -70,6 +70,10 @@ label .outer-container input:not([type=submit]) {
|
|
|
70
70
|
font-size: 16px;
|
|
71
71
|
line-height: 19px;
|
|
72
72
|
}
|
|
73
|
+
label .outer-container input[type=radio] {
|
|
74
|
+
width: 20px;
|
|
75
|
+
height: 20px;
|
|
76
|
+
}
|
|
73
77
|
label .outer-container input[type=date] {
|
|
74
78
|
background: white;
|
|
75
79
|
display: block;
|
|
@@ -102,6 +106,9 @@ label .outer-container.inputBlock.readonly {
|
|
|
102
106
|
user-select: none;
|
|
103
107
|
color: gray;
|
|
104
108
|
}
|
|
109
|
+
label .outer-container.inputBlock.radioBlock {
|
|
110
|
+
display: block;
|
|
111
|
+
}
|
|
105
112
|
label .outer-container.inputInline {
|
|
106
113
|
display: flex;
|
|
107
114
|
white-space: nowrap;
|
|
@@ -5,6 +5,7 @@ import domSanitiserOptions from '../../../shared/domsanitiser.options';
|
|
|
5
5
|
export class TttxTreeView {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.data = undefined;
|
|
8
|
+
this.firstSelected = undefined;
|
|
8
9
|
this.treeData = undefined;
|
|
9
10
|
this.selectedId = undefined;
|
|
10
11
|
}
|
|
@@ -47,9 +48,8 @@ export class TttxTreeView {
|
|
|
47
48
|
}
|
|
48
49
|
updateSelected(node) {
|
|
49
50
|
let selected = false;
|
|
50
|
-
if (node.id === this.selectedId)
|
|
51
|
+
if (node.id === this.selectedId)
|
|
51
52
|
selected = true;
|
|
52
|
-
}
|
|
53
53
|
return selected;
|
|
54
54
|
}
|
|
55
55
|
treeConfigs(node) {
|
|
@@ -97,6 +97,8 @@ export class TttxTreeView {
|
|
|
97
97
|
render() {
|
|
98
98
|
if (!this.data)
|
|
99
99
|
return;
|
|
100
|
+
if (this.firstSelected)
|
|
101
|
+
this.selectedId = this.data[0].id;
|
|
100
102
|
this.treeData = typeof this.data === 'string' ? JSON.parse(this.data) : this.data;
|
|
101
103
|
return (h("div", { class: "tree-view-element" }, h("ul", null, this.treeData.map((node) => this.renderNode(node)))));
|
|
102
104
|
}
|
|
@@ -133,6 +135,23 @@ export class TttxTreeView {
|
|
|
133
135
|
"tags": [],
|
|
134
136
|
"text": ""
|
|
135
137
|
}
|
|
138
|
+
},
|
|
139
|
+
"firstSelected": {
|
|
140
|
+
"type": "boolean",
|
|
141
|
+
"mutable": true,
|
|
142
|
+
"complexType": {
|
|
143
|
+
"original": "boolean",
|
|
144
|
+
"resolved": "boolean",
|
|
145
|
+
"references": {}
|
|
146
|
+
},
|
|
147
|
+
"required": false,
|
|
148
|
+
"optional": false,
|
|
149
|
+
"docs": {
|
|
150
|
+
"tags": [],
|
|
151
|
+
"text": ""
|
|
152
|
+
},
|
|
153
|
+
"attribute": "first-selected",
|
|
154
|
+
"reflect": false
|
|
136
155
|
}
|
|
137
156
|
};
|
|
138
157
|
}
|
|
@@ -540,6 +540,7 @@ const TttxTreeViewselectable = ({ data }) => `
|
|
|
540
540
|
const treeViewselectable = document.getElementById('treeViewselectable');
|
|
541
541
|
}
|
|
542
542
|
treeViewselectable.data = ${JSON.stringify(data)};
|
|
543
|
+
treeViewselectable.firstSelected = true;
|
|
543
544
|
</script>
|
|
544
545
|
`;
|
|
545
546
|
export const SelectableAndHover = TttxTreeViewselectable.bind({});
|
|
@@ -33,6 +33,16 @@ function validityCheck(event) {
|
|
|
33
33
|
// target.setCustomValidity('custom error!');
|
|
34
34
|
// and cleared with
|
|
35
35
|
// target.setCustomValidity('');
|
|
36
|
+
//handle whitespace-only input
|
|
37
|
+
if (target.value.length && !target.value.replace(/\s/g, '').length) {
|
|
38
|
+
errorMessage = 'This field cannot be left blank';
|
|
39
|
+
target.setCustomValidity(errorMessage);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
errorMessage = '';
|
|
43
|
+
if (target.setCustomValidity) // tests are dumb as a brick
|
|
44
|
+
target.setCustomValidity('');
|
|
45
|
+
}
|
|
36
46
|
// Check the validity of the input field and set an error message if needed
|
|
37
47
|
switch (true) {
|
|
38
48
|
// The field is required, but has no value
|
|
@@ -60,11 +70,6 @@ function validityCheck(event) {
|
|
|
60
70
|
default:
|
|
61
71
|
hasError = false;
|
|
62
72
|
}
|
|
63
|
-
//handle whitespace-only input
|
|
64
|
-
if (!target.value.replace(/\s/g, '').length && target.value.length !== 0) {
|
|
65
|
-
errorMessage = 'Whitespace-only not allowed';
|
|
66
|
-
hasError = true;
|
|
67
|
-
}
|
|
68
73
|
// Return the error state
|
|
69
74
|
return { target, hasError, errorMessage };
|
|
70
75
|
}
|
|
@@ -94,6 +99,8 @@ function setErrorState(target, hasError, errorMessage, parent = undefined) {
|
|
|
94
99
|
errorBubble = target.parentElement.parentElement.querySelector('.errorBubble');
|
|
95
100
|
}
|
|
96
101
|
}
|
|
102
|
+
if (!errorBubble)
|
|
103
|
+
return;
|
|
97
104
|
// If an error was detected, set the input field's class to "invalid" and display the error message in the error bubble
|
|
98
105
|
if (hasError) {
|
|
99
106
|
target.classList.add('invalid');
|
|
@@ -117,7 +124,7 @@ function setErrorState(target, hasError, errorMessage, parent = undefined) {
|
|
|
117
124
|
}
|
|
118
125
|
}
|
|
119
126
|
|
|
120
|
-
const tttxFormCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}label{font-weight:500;font-size:16px;line-height:19px;color:#212121}label .optional{color:#757575;font-weight:normal}label .outer-container{position:relative}label .outer-container .left-icons,label .outer-container .right-icons{display:flex;position:absolute;height:24px;gap:8px}label .outer-container .left-icons tttx-icon,label .outer-container .right-icons tttx-icon{height:24px;width:24px}label .outer-container .left-icons{left:8px}label .outer-container .right-icons{right:8px}label .outer-container input{color:#212121;box-sizing:border-box;border:1px solid #d5d5d5;border-radius:4px;padding:0;padding-left:16px;padding-right:16px;margin-top:4px;}label .outer-container input.has-input-icon{padding-left:40px}label .outer-container input.has-input-icon.has-left-icon{padding-left:72px}label .outer-container input.has-left-icon{padding-left:40px}label .outer-container input.has-right-icon{padding-right:40px}label .outer-container input.invalid{border:1px solid #dc0000}label .outer-container input:not([type=submit]){font-family:\"Roboto\", serif;width:100%;height:36px;font-size:16px;line-height:19px}label .outer-container input[type=date]{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}label .outer-container input[readonly]{cursor:default;pointer-events:none;user-select:none;color:gray}label .outer-container input:focus{border-color:#1479c6}label .outer-container input:focus-visible{outline:none}label .outer-container.inputBlock{display:flex;align-items:center;line-height:21px}label .outer-container.inputBlock .left-icons,label .outer-container.inputBlock .right-icons{margin-top:4px}label .outer-container.inputBlock.readonly{pointer-events:none;user-select:none;color:gray}label .outer-container.inputInline{display:flex;white-space:nowrap;align-items:center;margin:0}label .outer-container.inputInline input{margin-top:0}label .secondarylabel{color:#757575;font-size:14px;line-height:16px;font-weight:normal;display:flex;margin-top:4px}label .errorBubble{position:relative;font-size:14px;line-height:16px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center;margin-top:4px}label .errorBubble:not(.visible){display:none}label .errorBubble span{color:#dc0000;font-size:16px;margin-right:4px}.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}button{cursor:pointer}.button{font-family:Roboto, serif;box-sizing:border-box;height:36px;min-width:36px;padding:0;margin:0;background:transparent;color:#212121;border:1px solid #c8c8c8;border-radius:4px;text-transform:uppercase;display:flex;justify-content:left;align-items:center;font-size:14px;font-weight:500}.button-content{display:block;padding:0 16px}.icon-left,.icon-right{margin-top:4px}.iconleft{padding-left:8px}.iconleft .button-content{padding-left:4px}.iconright{padding-right:8px}.iconright .button-content{padding-right:4px}.notext{padding:0 6px}.button:active{background:rgba(17, 17, 17, 0.2);border:1px solid #d5d5d5}.primary{background:#1479c6;border:1px solid #1479c6;color:white}.primary:active{background:#1464a2;border:1px solid #1464a2}.borderless{background:transparent;border:none;color:#212121}.borderless:active{background:rgba(17, 17, 17, 0.2);border:none}.borderless-circle{background:transparent;border:none;color:#212121;border-radius:50%}.borderless-circle:active{border:none}.borderless-circle:focus{border-color:transparent}.danger{background:#dc0000;border:1px solid #dc0000;color:white}.danger:active{background:#b00000;border:1px solid #b00000}.disabled{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}.disabled:active{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}@media (hover: hover){.button:hover{background:rgba(17, 17, 17, 0.1);border:1px solid #d5d5d5}.primary:hover{background:#146eb3;border:1px solid #146eb3}.borderless:hover{background:rgba(17, 17, 17, 0.1);border:none}.borderless-circle:hover{background:rgba(17, 17, 17, 0.1);border:none}.danger:hover{background:#c60000;border:1px solid #c60000}.disabled:hover{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}}:host{display:block}fieldset{margin:0;padding:0;border:none}label{display:block;position:relative;margin-bottom:16px}.inlineLabel{font-weight:400;display:inline-block;vertical-align:top;padding-top:4px}input[type=checkbox]{width:18px;height:18px}input~label{font-weight:400}select{font-family:\"Roboto\", serif;box-sizing:border-box;width:100%;height:36px;padding:0 16px;font-size:16px;border:1px solid #d5d5d5;border-radius:4px;margin-top:4px}.placeholder{color:#9e9e9e}.placeholder option{color:initial}select.invalid:invalid{border:1px solid #dc0000}select~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center}select~.errorBubble:not(.visible){visibility:hidden}select~.errorBubble span{color:#dc0000;font-size:16px;margin-right:4px;height:16px}select.invalid:invalid~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;visibility:visible}select:focus{border-color:#1479c6}select:focus-visible{outline:none}.button{padding:0 16px}.footer{display:flex;gap:16px;flex-direction:row-reverse}";
|
|
127
|
+
const tttxFormCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}label{font-weight:500;font-size:16px;line-height:19px;color:#212121}label .optional{color:#757575;font-weight:normal}label .outer-container{position:relative}label .outer-container .left-icons,label .outer-container .right-icons{display:flex;position:absolute;height:24px;gap:8px}label .outer-container .left-icons tttx-icon,label .outer-container .right-icons tttx-icon{height:24px;width:24px}label .outer-container .left-icons{left:8px}label .outer-container .right-icons{right:8px}label .outer-container input{color:#212121;box-sizing:border-box;border:1px solid #d5d5d5;border-radius:4px;padding:0;padding-left:16px;padding-right:16px;margin-top:4px;}label .outer-container input.has-input-icon{padding-left:40px}label .outer-container input.has-input-icon.has-left-icon{padding-left:72px}label .outer-container input.has-left-icon{padding-left:40px}label .outer-container input.has-right-icon{padding-right:40px}label .outer-container input.invalid{border:1px solid #dc0000}label .outer-container input:not([type=submit]){font-family:\"Roboto\", serif;width:100%;height:36px;font-size:16px;line-height:19px}label .outer-container input[type=radio]{width:20px;height:20px}label .outer-container input[type=date]{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}label .outer-container input[readonly]{cursor:default;pointer-events:none;user-select:none;color:gray}label .outer-container input:focus{border-color:#1479c6}label .outer-container input:focus-visible{outline:none}label .outer-container.inputBlock{display:flex;align-items:center;line-height:21px}label .outer-container.inputBlock .left-icons,label .outer-container.inputBlock .right-icons{margin-top:4px}label .outer-container.inputBlock.readonly{pointer-events:none;user-select:none;color:gray}label .outer-container.inputBlock.radioBlock{display:block}label .outer-container.inputInline{display:flex;white-space:nowrap;align-items:center;margin:0}label .outer-container.inputInline input{margin-top:0}label .secondarylabel{color:#757575;font-size:14px;line-height:16px;font-weight:normal;display:flex;margin-top:4px}label .errorBubble{position:relative;font-size:14px;line-height:16px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center;margin-top:4px}label .errorBubble:not(.visible){display:none}label .errorBubble span{color:#dc0000;font-size:16px;margin-right:4px}.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}button{cursor:pointer}.button{font-family:Roboto, serif;box-sizing:border-box;height:36px;min-width:36px;padding:0;margin:0;background:transparent;color:#212121;border:1px solid #c8c8c8;border-radius:4px;text-transform:uppercase;display:flex;justify-content:left;align-items:center;font-size:14px;font-weight:500}.button-content{display:block;padding:0 16px}.icon-left,.icon-right{margin-top:4px}.iconleft{padding-left:8px}.iconleft .button-content{padding-left:4px}.iconright{padding-right:8px}.iconright .button-content{padding-right:4px}.notext{padding:0 6px}.button:active{background:rgba(17, 17, 17, 0.2);border:1px solid #d5d5d5}.primary{background:#1479c6;border:1px solid #1479c6;color:white}.primary:active{background:#1464a2;border:1px solid #1464a2}.borderless{background:transparent;border:none;color:#212121}.borderless:active{background:rgba(17, 17, 17, 0.2);border:none}.borderless-circle{background:transparent;border:none;color:#212121;border-radius:50%}.borderless-circle:active{border:none}.borderless-circle:focus{border-color:transparent}.danger{background:#dc0000;border:1px solid #dc0000;color:white}.danger:active{background:#b00000;border:1px solid #b00000}.disabled{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}.disabled:active{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}@media (hover: hover){.button:hover{background:rgba(17, 17, 17, 0.1);border:1px solid #d5d5d5}.primary:hover{background:#146eb3;border:1px solid #146eb3}.borderless:hover{background:rgba(17, 17, 17, 0.1);border:none}.borderless-circle:hover{background:rgba(17, 17, 17, 0.1);border:none}.danger:hover{background:#c60000;border:1px solid #c60000}.disabled:hover{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}}:host{display:block}fieldset{margin:0;padding:0;border:none}label{display:block;position:relative;margin-bottom:16px}.inlineLabel{font-weight:400;display:inline-block;vertical-align:top;padding-top:4px}input[type=checkbox]{width:18px;height:18px}input~label{font-weight:400}select{font-family:\"Roboto\", serif;box-sizing:border-box;width:100%;height:36px;padding:0 16px;font-size:16px;border:1px solid #d5d5d5;border-radius:4px;margin-top:4px}.placeholder{color:#9e9e9e}.placeholder option{color:initial}select.invalid:invalid{border:1px solid #dc0000}select~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center}select~.errorBubble:not(.visible){visibility:hidden}select~.errorBubble span{color:#dc0000;font-size:16px;margin-right:4px;height:16px}select.invalid:invalid~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;visibility:visible}select:focus{border-color:#1479c6}select:focus-visible{outline:none}.button{padding:0 16px}.footer{display:flex;gap:16px;flex-direction:row-reverse}";
|
|
121
128
|
|
|
122
129
|
const TttxForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
123
130
|
constructor() {
|
|
@@ -376,17 +383,21 @@ const TttxForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
376
383
|
*/
|
|
377
384
|
createLabel(formProperties, input, errorBubble) {
|
|
378
385
|
const outerContainer = document.createElement('div');
|
|
379
|
-
|
|
386
|
+
let outerContainerClassName = 'outer-container inputBlock';
|
|
380
387
|
// Create a new <label> element with the "inputBlock" class and the specified text
|
|
381
388
|
const label = document.createElement('label');
|
|
382
389
|
label.innerText = formProperties.label;
|
|
383
390
|
// If the form property has no validation object, add an "optional" span element to the label
|
|
384
|
-
if (!formProperties.validation) {
|
|
391
|
+
if (!formProperties.validation && formProperties.label) {
|
|
385
392
|
const optionalSpan = document.createElement('span');
|
|
386
393
|
optionalSpan.className = 'optional';
|
|
387
394
|
optionalSpan.innerHTML = ' (optional)';
|
|
388
395
|
label.appendChild(optionalSpan);
|
|
389
396
|
}
|
|
397
|
+
if (formProperties.type === 'radio') {
|
|
398
|
+
outerContainerClassName += ' radioBlock';
|
|
399
|
+
}
|
|
400
|
+
outerContainer.className = outerContainerClassName;
|
|
390
401
|
if (formProperties.readonly) {
|
|
391
402
|
label.classList.add('readonly');
|
|
392
403
|
}
|
|
@@ -404,6 +415,38 @@ const TttxForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
404
415
|
// Return the label element
|
|
405
416
|
return label;
|
|
406
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* Creates a new radio input with a set of options.
|
|
420
|
+
*
|
|
421
|
+
* @param {string} formKey - The name of the dropdown field, as specified in the form schema.
|
|
422
|
+
* @param {Object} formProperties - An object containing additional properties, such as the field type and options properties.
|
|
423
|
+
* @param {'radio'} formProperties.type - The type of form field. In this case, it will always be "radio".
|
|
424
|
+
* @param {Object} formProperties.validation - A set of validation rules for the field.
|
|
425
|
+
* @param {Object[]} formProperties.options - A list of properties to pass to the select options.
|
|
426
|
+
* @param {string} formProperties.options.label - The visible value of the option.
|
|
427
|
+
* @param {string} formProperties.options.value - The actual value of the option.
|
|
428
|
+
*/
|
|
429
|
+
createRadio(formKey, formProperties) {
|
|
430
|
+
var _a, _b;
|
|
431
|
+
const fragment = new DocumentFragment();
|
|
432
|
+
for (const optionProperties of formProperties.options) {
|
|
433
|
+
// Create a new <input> element with the specified name and type
|
|
434
|
+
const input = document.createElement('input');
|
|
435
|
+
input.type = 'radio';
|
|
436
|
+
input.name = formKey;
|
|
437
|
+
input.value = optionProperties.value;
|
|
438
|
+
if ((_a = formProperties === null || formProperties === void 0 ? void 0 : formProperties.validation) === null || _a === void 0 ? void 0 : _a.required) {
|
|
439
|
+
input.setAttribute('required', 'required');
|
|
440
|
+
input.setAttribute('data-required', (_b = formProperties.validation.required.message) !== null && _b !== void 0 ? _b : '');
|
|
441
|
+
}
|
|
442
|
+
const span = document.createElement('span');
|
|
443
|
+
span.innerText = optionProperties.label;
|
|
444
|
+
fragment.appendChild(input);
|
|
445
|
+
fragment.appendChild(span);
|
|
446
|
+
fragment.appendChild(document.createElement('br'));
|
|
447
|
+
}
|
|
448
|
+
return fragment;
|
|
449
|
+
}
|
|
407
450
|
/**
|
|
408
451
|
* Populates the form template with input fields and labels based on the properties of the
|
|
409
452
|
* current form schema. For each property in the schema, it creates an input element, applies
|
|
@@ -423,9 +466,19 @@ const TttxForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
423
466
|
propertyKeys.forEach(formKey => {
|
|
424
467
|
const formItem = properties[formKey];
|
|
425
468
|
const formProperties = formItem.form;
|
|
426
|
-
|
|
469
|
+
let input;
|
|
470
|
+
switch (formProperties.type) {
|
|
471
|
+
case 'select':
|
|
472
|
+
input = this.createSelect(formKey, formProperties);
|
|
473
|
+
break;
|
|
474
|
+
case 'radio':
|
|
475
|
+
input = this.createRadio(formKey, formProperties);
|
|
476
|
+
break;
|
|
477
|
+
default:
|
|
478
|
+
input = this.createInput(formKey, formProperties);
|
|
479
|
+
}
|
|
427
480
|
// If the form property has validation, apply it to the input
|
|
428
|
-
if (formProperties.validation) {
|
|
481
|
+
if (formProperties.validation && formProperties.type !== 'radio') {
|
|
429
482
|
this.applyValidation(input, formProperties.validation);
|
|
430
483
|
}
|
|
431
484
|
// Create an error bubble and label element for the input
|
|
@@ -456,25 +509,40 @@ const TttxForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
456
509
|
const propertyKeys = Object.keys(properties);
|
|
457
510
|
propertyKeys.forEach(formKey => {
|
|
458
511
|
var _a, _b;
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
512
|
+
const formInputs = formItems.querySelectorAll(`[name=${formKey}]`);
|
|
513
|
+
for (const formInput of formInputs) {
|
|
514
|
+
// Bind events to form input elements
|
|
515
|
+
formInput.oninvalid = this.validityCheckWrapper.bind(this);
|
|
516
|
+
formInput.onblur = this.validityCheckWrapper.bind(this);
|
|
517
|
+
formInput.onkeyup = this.fieldChanged.bind(this);
|
|
518
|
+
formInput.onchange = this.fieldChanged.bind(this);
|
|
519
|
+
if ((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey]) {
|
|
520
|
+
switch (formInput.type) {
|
|
521
|
+
case 'checkbox':
|
|
522
|
+
if (this._data[formKey] === 'on') {
|
|
523
|
+
formInput.checked = true;
|
|
524
|
+
}
|
|
525
|
+
break;
|
|
526
|
+
case 'radio':
|
|
527
|
+
if (formInput.value === this._data[formKey]) {
|
|
528
|
+
formInput.checked = true;
|
|
529
|
+
}
|
|
530
|
+
break;
|
|
531
|
+
default:
|
|
532
|
+
formInput.value = this._data[formKey];
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
// If explicitly setting input as invalid, set invalid state and error message on render
|
|
536
|
+
if ((_b = properties[formKey].form.validation) === null || _b === void 0 ? void 0 : _b.invalid) {
|
|
537
|
+
const errorMessage = properties[formKey].form.validation.invalid.message;
|
|
538
|
+
formInput.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
|
|
539
|
+
setErrorState(formInput, true, errorMessage);
|
|
540
|
+
}
|
|
541
|
+
if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
|
|
542
|
+
formInput.addEventListener('change', () => {
|
|
543
|
+
formInput.classList.remove('placeholder');
|
|
544
|
+
});
|
|
545
|
+
}
|
|
478
546
|
}
|
|
479
547
|
});
|
|
480
548
|
// Append the cloned form elements to the fieldset
|
|
@@ -11,7 +11,12 @@ const TttxIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
11
11
|
this.color = 'grey';
|
|
12
12
|
}
|
|
13
13
|
render() {
|
|
14
|
-
|
|
14
|
+
if (this.color.startsWith('#')) {
|
|
15
|
+
return (h(Host, null, h("span", { class: 'material-symbols-rounded', style: { color: this.color } }, this.icon)));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return (h(Host, null, h("span", { class: `material-symbols-rounded ${this.color}` }, this.icon)));
|
|
19
|
+
}
|
|
15
20
|
}
|
|
16
21
|
static get style() { return tttxIconCss; }
|
|
17
22
|
}, [1, "tttx-icon", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { d as defineCustomElement$1 } from './tttx-icon2.js';
|
|
3
3
|
|
|
4
|
-
const tttxStandaloneInputCss = ".material-symbols-rounded.sc-tttx-standalone-input{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded.sc-tttx-standalone-input{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}label.sc-tttx-standalone-input{font-weight:500;font-size:16px;line-height:19px;color:#212121}label.sc-tttx-standalone-input .optional.sc-tttx-standalone-input{color:#757575;font-weight:normal}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input{position:relative}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input .left-icons.sc-tttx-standalone-input,label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input .right-icons.sc-tttx-standalone-input{display:flex;position:absolute;height:24px;gap:8px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input .left-icons.sc-tttx-standalone-input tttx-icon.sc-tttx-standalone-input,label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input .right-icons.sc-tttx-standalone-input tttx-icon.sc-tttx-standalone-input{height:24px;width:24px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input .left-icons.sc-tttx-standalone-input{left:8px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input .right-icons.sc-tttx-standalone-input{right:8px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.sc-tttx-standalone-input{color:#212121;box-sizing:border-box;border:1px solid #d5d5d5;border-radius:4px;padding:0;padding-left:16px;padding-right:16px;margin-top:4px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.has-input-icon.sc-tttx-standalone-input{padding-left:40px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.has-input-icon.has-left-icon.sc-tttx-standalone-input{padding-left:72px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.has-left-icon.sc-tttx-standalone-input{padding-left:40px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.has-right-icon.sc-tttx-standalone-input{padding-right:40px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.invalid.sc-tttx-standalone-input{border:1px solid #dc0000}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.sc-tttx-standalone-input:not([type=submit]){font-family:\"Roboto\", serif;width:100%;height:36px;font-size:16px;line-height:19px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input[type=date].sc-tttx-standalone-input{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input[readonly].sc-tttx-standalone-input{cursor:default;pointer-events:none;user-select:none;color:gray}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.sc-tttx-standalone-input:focus{border-color:#1479c6}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.sc-tttx-standalone-input:focus-visible{outline:none}label.sc-tttx-standalone-input .outer-container.inputBlock.sc-tttx-standalone-input{display:flex;align-items:center;line-height:21px}label.sc-tttx-standalone-input .outer-container.inputBlock.sc-tttx-standalone-input .left-icons.sc-tttx-standalone-input,label.sc-tttx-standalone-input .outer-container.inputBlock.sc-tttx-standalone-input .right-icons.sc-tttx-standalone-input{margin-top:4px}label.sc-tttx-standalone-input .outer-container.inputBlock.readonly.sc-tttx-standalone-input{pointer-events:none;user-select:none;color:gray}label.sc-tttx-standalone-input .outer-container.inputInline.sc-tttx-standalone-input{display:flex;white-space:nowrap;align-items:center;margin:0}label.sc-tttx-standalone-input .outer-container.inputInline.sc-tttx-standalone-input input.sc-tttx-standalone-input{margin-top:0}label.sc-tttx-standalone-input .secondarylabel.sc-tttx-standalone-input{color:#757575;font-size:14px;line-height:16px;font-weight:normal;display:flex;margin-top:4px}label.sc-tttx-standalone-input .errorBubble.sc-tttx-standalone-input{position:relative;font-size:14px;line-height:16px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center;margin-top:4px}label.sc-tttx-standalone-input .errorBubble.sc-tttx-standalone-input:not(.visible){display:none}label.sc-tttx-standalone-input .errorBubble.sc-tttx-standalone-input span.sc-tttx-standalone-input{color:#dc0000;font-size:16px;margin-right:4px}.material-symbols-rounded.sc-tttx-standalone-input{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}.sc-tttx-standalone-input-h{display:block}";
|
|
4
|
+
const tttxStandaloneInputCss = ".material-symbols-rounded.sc-tttx-standalone-input{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded.sc-tttx-standalone-input{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}label.sc-tttx-standalone-input{font-weight:500;font-size:16px;line-height:19px;color:#212121}label.sc-tttx-standalone-input .optional.sc-tttx-standalone-input{color:#757575;font-weight:normal}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input{position:relative}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input .left-icons.sc-tttx-standalone-input,label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input .right-icons.sc-tttx-standalone-input{display:flex;position:absolute;height:24px;gap:8px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input .left-icons.sc-tttx-standalone-input tttx-icon.sc-tttx-standalone-input,label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input .right-icons.sc-tttx-standalone-input tttx-icon.sc-tttx-standalone-input{height:24px;width:24px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input .left-icons.sc-tttx-standalone-input{left:8px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input .right-icons.sc-tttx-standalone-input{right:8px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.sc-tttx-standalone-input{color:#212121;box-sizing:border-box;border:1px solid #d5d5d5;border-radius:4px;padding:0;padding-left:16px;padding-right:16px;margin-top:4px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.has-input-icon.sc-tttx-standalone-input{padding-left:40px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.has-input-icon.has-left-icon.sc-tttx-standalone-input{padding-left:72px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.has-left-icon.sc-tttx-standalone-input{padding-left:40px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.has-right-icon.sc-tttx-standalone-input{padding-right:40px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.invalid.sc-tttx-standalone-input{border:1px solid #dc0000}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.sc-tttx-standalone-input:not([type=submit]){font-family:\"Roboto\", serif;width:100%;height:36px;font-size:16px;line-height:19px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input[type=radio].sc-tttx-standalone-input{width:20px;height:20px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input[type=date].sc-tttx-standalone-input{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input[readonly].sc-tttx-standalone-input{cursor:default;pointer-events:none;user-select:none;color:gray}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.sc-tttx-standalone-input:focus{border-color:#1479c6}label.sc-tttx-standalone-input .outer-container.sc-tttx-standalone-input input.sc-tttx-standalone-input:focus-visible{outline:none}label.sc-tttx-standalone-input .outer-container.inputBlock.sc-tttx-standalone-input{display:flex;align-items:center;line-height:21px}label.sc-tttx-standalone-input .outer-container.inputBlock.sc-tttx-standalone-input .left-icons.sc-tttx-standalone-input,label.sc-tttx-standalone-input .outer-container.inputBlock.sc-tttx-standalone-input .right-icons.sc-tttx-standalone-input{margin-top:4px}label.sc-tttx-standalone-input .outer-container.inputBlock.readonly.sc-tttx-standalone-input{pointer-events:none;user-select:none;color:gray}label.sc-tttx-standalone-input .outer-container.inputBlock.radioBlock.sc-tttx-standalone-input{display:block}label.sc-tttx-standalone-input .outer-container.inputInline.sc-tttx-standalone-input{display:flex;white-space:nowrap;align-items:center;margin:0}label.sc-tttx-standalone-input .outer-container.inputInline.sc-tttx-standalone-input input.sc-tttx-standalone-input{margin-top:0}label.sc-tttx-standalone-input .secondarylabel.sc-tttx-standalone-input{color:#757575;font-size:14px;line-height:16px;font-weight:normal;display:flex;margin-top:4px}label.sc-tttx-standalone-input .errorBubble.sc-tttx-standalone-input{position:relative;font-size:14px;line-height:16px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center;margin-top:4px}label.sc-tttx-standalone-input .errorBubble.sc-tttx-standalone-input:not(.visible){display:none}label.sc-tttx-standalone-input .errorBubble.sc-tttx-standalone-input span.sc-tttx-standalone-input{color:#dc0000;font-size:16px;margin-right:4px}.material-symbols-rounded.sc-tttx-standalone-input{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}.sc-tttx-standalone-input-h{display:block}";
|
|
5
5
|
|
|
6
6
|
const TttxInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -13,6 +13,7 @@ const TttxTreeView$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
13
13
|
this.clickEvent = createEvent(this, "clickEvent", 7);
|
|
14
14
|
this.expandNode = createEvent(this, "expandNode", 7);
|
|
15
15
|
this.data = undefined;
|
|
16
|
+
this.firstSelected = undefined;
|
|
16
17
|
this.treeData = undefined;
|
|
17
18
|
this.selectedId = undefined;
|
|
18
19
|
}
|
|
@@ -55,9 +56,8 @@ const TttxTreeView$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
55
56
|
}
|
|
56
57
|
updateSelected(node) {
|
|
57
58
|
let selected = false;
|
|
58
|
-
if (node.id === this.selectedId)
|
|
59
|
+
if (node.id === this.selectedId)
|
|
59
60
|
selected = true;
|
|
60
|
-
}
|
|
61
61
|
return selected;
|
|
62
62
|
}
|
|
63
63
|
treeConfigs(node) {
|
|
@@ -105,12 +105,15 @@ const TttxTreeView$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
105
105
|
render() {
|
|
106
106
|
if (!this.data)
|
|
107
107
|
return;
|
|
108
|
+
if (this.firstSelected)
|
|
109
|
+
this.selectedId = this.data[0].id;
|
|
108
110
|
this.treeData = typeof this.data === 'string' ? JSON.parse(this.data) : this.data;
|
|
109
111
|
return (h("div", { class: "tree-view-element" }, h("ul", null, this.treeData.map((node) => this.renderNode(node)))));
|
|
110
112
|
}
|
|
111
113
|
static get style() { return tttxTreeViewCss; }
|
|
112
114
|
}, [1, "tttx-tree-view", {
|
|
113
115
|
"data": [1040],
|
|
116
|
+
"firstSelected": [1028, "first-selected"],
|
|
114
117
|
"treeData": [32],
|
|
115
118
|
"selectedId": [32]
|
|
116
119
|
}]);
|
package/dist/esm/loader.js
CHANGED
|
@@ -11,7 +11,7 @@ const patchEsm = () => {
|
|
|
11
11
|
const defineCustomElements = (win, options) => {
|
|
12
12
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
13
13
|
return patchEsm().then(() => {
|
|
14
|
-
return bootstrapLazy([["tttx-data-pattern",[[1,"tttx-data-pattern",{"data":[1],"sorteroptions":[1],"filteroptions":[1],"filterheader":[1]}]]],["tttx-multiselect-box",[[1,"tttx-multiselect-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"htmlVisibleValue":[4,"html-visible-value"],"visibleValue":[1,"visible-value"],"open":[32],"unsavedSelectedItems":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-dialog-box",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"selectedValue":[1,"selected-value"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32],"selectedId":[32]}]]],["tttx-checkbox",[[0,"tttx-checkbox",{"checkboxId":[1,"checkbox-id"],"label":[1],"inline":[4],"indeterminate":[4],"checked":[4]}]]],["tttx-dialog",[[1,"tttx-dialog",{"header":[1],"type":[1],"size":[1],"open":[4],"allowOverflow":[4,"allow-overflow"],"closeEnabled":[4,"close-enabled"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-expander",[[1,"tttx-expander",{"name":[1],"open":[4],"lefticon":[1],"lefticoncolor":[1],"isExpanded":[32]}]]],["tttx-tabs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-checkbox-group",[[1,"tttx-checkbox-group"]]],["tttx-checkbox-group-caption",[[4,"tttx-checkbox-group-caption"]]],["tttx-checkbox-group-heading",[[4,"tttx-checkbox-group-heading"]]],["tttx-form",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-percentage-bar",[[2,"tttx-percentage-bar",{"percentage":[8],"thresholds":[1],"color":[1],"min":[1],"labelid":[1],"_percentage":[32],"_ranges":[32],"_min":[32]}]]],["tttx-qrcode",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag",[[1,"tttx-tag",{"text":[1],"color":[1],"textColor":[1,"text-color"]}]]],["tttx-textarea",[[2,"tttx-textarea",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"rows":[2],"textareaautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"disabled":[4],"maxlength":[8],"name":[1],"placeholder":[1],"readonly":[8],"required":[4],"value":[1032]}]]],["tttx-icon",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input",[[2,"tttx-standalone-input",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconleftcolor":[1],"iconright":[1],"iconrightcolor":[1],"inputicon":[1],"inputiconcolor":[1],"inline":[4],"inputautocapitalize":[1],"inputautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-filter_4",[[1,"tttx-filter",{"filterKey":[1,"filter-key"],"filterOptions":[1,"filter-options"],"showSelectAll":[4,"show-select-all"],"showSearchField":[4,"show-search-field"],"showOptionIcons":[4,"show-option-icons"],"filterButtonStyle":[1,"filter-button-style"],"filterHeader":[1,"filter-header"],"defaultFilterOptions":[1,"default-filter-options"],"popoverWidth":[1,"popover-width"],"showPopover":[32],"displayedFilterSettings":[32],"selectedFilters":[32],"filterSearchTerm":[32],"allSelected":[32]},[[0,"closeFilter","handleCloseFilter"]]],[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}],[1,"tttx-sorter",{"sorterKey":[1,"sorter-key"],"defaultSortDirection":[1,"default-sort-direction"],"fieldOptionsData":[1,"field-options-data"],"defaultOption":[1,"default-option"],"selectedField":[32],"sortDirection":[32],"dropdownExpand":[32],"dropdownOptions":[32]},[[0,"closeSorter","handleCloseSorter"]]],[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-button",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
|
|
14
|
+
return bootstrapLazy([["tttx-data-pattern",[[1,"tttx-data-pattern",{"data":[1],"sorteroptions":[1],"filteroptions":[1],"filterheader":[1]}]]],["tttx-multiselect-box",[[1,"tttx-multiselect-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"htmlVisibleValue":[4,"html-visible-value"],"visibleValue":[1,"visible-value"],"open":[32],"unsavedSelectedItems":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-dialog-box",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"selectedValue":[1,"selected-value"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view",[[1,"tttx-tree-view",{"data":[1040],"firstSelected":[1028,"first-selected"],"treeData":[32],"selectedId":[32]}]]],["tttx-checkbox",[[0,"tttx-checkbox",{"checkboxId":[1,"checkbox-id"],"label":[1],"inline":[4],"indeterminate":[4],"checked":[4]}]]],["tttx-dialog",[[1,"tttx-dialog",{"header":[1],"type":[1],"size":[1],"open":[4],"allowOverflow":[4,"allow-overflow"],"closeEnabled":[4,"close-enabled"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-expander",[[1,"tttx-expander",{"name":[1],"open":[4],"lefticon":[1],"lefticoncolor":[1],"isExpanded":[32]}]]],["tttx-tabs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-checkbox-group",[[1,"tttx-checkbox-group"]]],["tttx-checkbox-group-caption",[[4,"tttx-checkbox-group-caption"]]],["tttx-checkbox-group-heading",[[4,"tttx-checkbox-group-heading"]]],["tttx-form",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-percentage-bar",[[2,"tttx-percentage-bar",{"percentage":[8],"thresholds":[1],"color":[1],"min":[1],"labelid":[1],"_percentage":[32],"_ranges":[32],"_min":[32]}]]],["tttx-qrcode",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag",[[1,"tttx-tag",{"text":[1],"color":[1],"textColor":[1,"text-color"]}]]],["tttx-textarea",[[2,"tttx-textarea",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"rows":[2],"textareaautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"disabled":[4],"maxlength":[8],"name":[1],"placeholder":[1],"readonly":[8],"required":[4],"value":[1032]}]]],["tttx-icon",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input",[[2,"tttx-standalone-input",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconleftcolor":[1],"iconright":[1],"iconrightcolor":[1],"inputicon":[1],"inputiconcolor":[1],"inline":[4],"inputautocapitalize":[1],"inputautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-filter_4",[[1,"tttx-filter",{"filterKey":[1,"filter-key"],"filterOptions":[1,"filter-options"],"showSelectAll":[4,"show-select-all"],"showSearchField":[4,"show-search-field"],"showOptionIcons":[4,"show-option-icons"],"filterButtonStyle":[1,"filter-button-style"],"filterHeader":[1,"filter-header"],"defaultFilterOptions":[1,"default-filter-options"],"popoverWidth":[1,"popover-width"],"showPopover":[32],"displayedFilterSettings":[32],"selectedFilters":[32],"filterSearchTerm":[32],"allSelected":[32]},[[0,"closeFilter","handleCloseFilter"]]],[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}],[1,"tttx-sorter",{"sorterKey":[1,"sorter-key"],"defaultSortDirection":[1,"default-sort-direction"],"fieldOptionsData":[1,"field-options-data"],"defaultOption":[1,"default-option"],"selectedField":[32],"sortDirection":[32],"dropdownExpand":[32],"dropdownOptions":[32]},[[0,"closeSorter","handleCloseSorter"]]],[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-button",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
|