@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.
Files changed (42) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/tttx-form.cjs.entry.js +97 -29
  3. package/dist/cjs/tttx-icon.cjs.entry.js +6 -1
  4. package/dist/cjs/tttx-standalone-input.cjs.entry.js +1 -1
  5. package/dist/cjs/tttx-tree-view.cjs.entry.js +4 -2
  6. package/dist/cjs/tttx.cjs.js +1 -1
  7. package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +6 -1
  8. package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +1 -1
  9. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +8 -1
  10. package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +2 -0
  11. package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +10 -5
  12. package/dist/collection/components/molecules/tttx-form/tttx-form.css +7 -0
  13. package/dist/collection/components/molecules/tttx-form/tttx-form.js +84 -23
  14. package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +126 -3
  15. package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.stories.js +2 -2
  16. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css +7 -0
  17. package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.js +21 -2
  18. package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.stories.js +1 -0
  19. package/dist/components/tttx-form.js +97 -29
  20. package/dist/components/tttx-icon2.js +6 -1
  21. package/dist/components/tttx-standalone-input2.js +1 -1
  22. package/dist/components/tttx-tree-view.js +5 -2
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/tttx-form.entry.js +97 -29
  25. package/dist/esm/tttx-icon.entry.js +6 -1
  26. package/dist/esm/tttx-standalone-input.entry.js +1 -1
  27. package/dist/esm/tttx-tree-view.entry.js +4 -2
  28. package/dist/esm/tttx.js +1 -1
  29. package/dist/tttx/{p-93e63568.entry.js → p-6e0fac85.entry.js} +1 -1
  30. package/dist/tttx/p-73bb7a06.entry.js +1 -0
  31. package/dist/tttx/p-888fb9ee.entry.js +1 -0
  32. package/dist/tttx/p-bcf3844e.entry.js +1 -0
  33. package/dist/tttx/tttx.esm.js +1 -1
  34. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +10 -1
  35. package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +12 -0
  36. package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +110 -0
  37. package/dist/types/components/molecules/tttx-tree-view/tttx-tree-view.d.ts +1 -0
  38. package/dist/types/components.d.ts +2 -0
  39. package/package.json +2 -2
  40. package/dist/tttx/p-a94f7efc.entry.js +0 -1
  41. package/dist/tttx/p-d5b6dd17.entry.js +0 -1
  42. package/dist/tttx/p-feea36cb.entry.js +0 -1
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["tttx-data-pattern.cjs",[[1,"tttx-data-pattern",{"data":[1],"sorteroptions":[1],"filteroptions":[1],"filterheader":[1]}]]],["tttx-multiselect-box.cjs",[[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.cjs",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box.cjs",[[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.cjs",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32],"selectedId":[32]}]]],["tttx-checkbox.cjs",[[0,"tttx-checkbox",{"checkboxId":[1,"checkbox-id"],"label":[1],"inline":[4],"indeterminate":[4],"checked":[4]}]]],["tttx-dialog.cjs",[[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.cjs",[[1,"tttx-expander",{"name":[1],"open":[4],"lefticon":[1],"lefticoncolor":[1],"isExpanded":[32]}]]],["tttx-tabs.cjs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-checkbox-group.cjs",[[1,"tttx-checkbox-group"]]],["tttx-checkbox-group-caption.cjs",[[4,"tttx-checkbox-group-caption"]]],["tttx-checkbox-group-heading.cjs",[[4,"tttx-checkbox-group-heading"]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-percentage-bar.cjs",[[2,"tttx-percentage-bar",{"percentage":[8],"thresholds":[1],"color":[1],"min":[1],"labelid":[1],"_percentage":[32],"_ranges":[32],"_min":[32]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag.cjs",[[1,"tttx-tag",{"text":[1],"color":[1],"textColor":[1,"text-color"]}]]],["tttx-textarea.cjs",[[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.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input.cjs",[[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.cjs",[[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.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
17
+ return index.bootstrapLazy([["tttx-data-pattern.cjs",[[1,"tttx-data-pattern",{"data":[1],"sorteroptions":[1],"filteroptions":[1],"filterheader":[1]}]]],["tttx-multiselect-box.cjs",[[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.cjs",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box.cjs",[[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.cjs",[[1,"tttx-tree-view",{"data":[1040],"firstSelected":[1028,"first-selected"],"treeData":[32],"selectedId":[32]}]]],["tttx-checkbox.cjs",[[0,"tttx-checkbox",{"checkboxId":[1,"checkbox-id"],"label":[1],"inline":[4],"indeterminate":[4],"checked":[4]}]]],["tttx-dialog.cjs",[[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.cjs",[[1,"tttx-expander",{"name":[1],"open":[4],"lefticon":[1],"lefticoncolor":[1],"isExpanded":[32]}]]],["tttx-tabs.cjs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-checkbox-group.cjs",[[1,"tttx-checkbox-group"]]],["tttx-checkbox-group-caption.cjs",[[4,"tttx-checkbox-group-caption"]]],["tttx-checkbox-group-heading.cjs",[[4,"tttx-checkbox-group-heading"]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-percentage-bar.cjs",[[2,"tttx-percentage-bar",{"percentage":[8],"thresholds":[1],"color":[1],"min":[1],"labelid":[1],"_percentage":[32],"_ranges":[32],"_min":[32]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag.cjs",[[1,"tttx-tag",{"text":[1],"color":[1],"textColor":[1,"text-color"]}]]],["tttx-textarea.cjs",[[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.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input.cjs",[[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.cjs",[[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.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -38,6 +38,16 @@ function validityCheck(event) {
38
38
  // target.setCustomValidity('custom error!');
39
39
  // and cleared with
40
40
  // target.setCustomValidity('');
41
+ //handle whitespace-only input
42
+ if (target.value.length && !target.value.replace(/\s/g, '').length) {
43
+ errorMessage = 'This field cannot be left blank';
44
+ target.setCustomValidity(errorMessage);
45
+ }
46
+ else {
47
+ errorMessage = '';
48
+ if (target.setCustomValidity) // tests are dumb as a brick
49
+ target.setCustomValidity('');
50
+ }
41
51
  // Check the validity of the input field and set an error message if needed
42
52
  switch (true) {
43
53
  // The field is required, but has no value
@@ -65,11 +75,6 @@ function validityCheck(event) {
65
75
  default:
66
76
  hasError = false;
67
77
  }
68
- //handle whitespace-only input
69
- if (!target.value.replace(/\s/g, '').length && target.value.length !== 0) {
70
- errorMessage = 'Whitespace-only not allowed';
71
- hasError = true;
72
- }
73
78
  // Return the error state
74
79
  return { target, hasError, errorMessage };
75
80
  }
@@ -99,6 +104,8 @@ function setErrorState(target, hasError, errorMessage, parent = undefined) {
99
104
  errorBubble = target.parentElement.parentElement.querySelector('.errorBubble');
100
105
  }
101
106
  }
107
+ if (!errorBubble)
108
+ return;
102
109
  // If an error was detected, set the input field's class to "invalid" and display the error message in the error bubble
103
110
  if (hasError) {
104
111
  target.classList.add('invalid');
@@ -122,7 +129,7 @@ function setErrorState(target, hasError, errorMessage, parent = undefined) {
122
129
  }
123
130
  }
124
131
 
125
- 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}";
132
+ 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}";
126
133
 
127
134
  const TttxForm = class {
128
135
  constructor(hostRef) {
@@ -379,17 +386,21 @@ const TttxForm = class {
379
386
  */
380
387
  createLabel(formProperties, input, errorBubble) {
381
388
  const outerContainer = document.createElement('div');
382
- outerContainer.className = 'outer-container inputBlock';
389
+ let outerContainerClassName = 'outer-container inputBlock';
383
390
  // Create a new <label> element with the "inputBlock" class and the specified text
384
391
  const label = document.createElement('label');
385
392
  label.innerText = formProperties.label;
386
393
  // If the form property has no validation object, add an "optional" span element to the label
387
- if (!formProperties.validation) {
394
+ if (!formProperties.validation && formProperties.label) {
388
395
  const optionalSpan = document.createElement('span');
389
396
  optionalSpan.className = 'optional';
390
397
  optionalSpan.innerHTML = '&nbsp;(optional)';
391
398
  label.appendChild(optionalSpan);
392
399
  }
400
+ if (formProperties.type === 'radio') {
401
+ outerContainerClassName += ' radioBlock';
402
+ }
403
+ outerContainer.className = outerContainerClassName;
393
404
  if (formProperties.readonly) {
394
405
  label.classList.add('readonly');
395
406
  }
@@ -407,6 +418,38 @@ const TttxForm = class {
407
418
  // Return the label element
408
419
  return label;
409
420
  }
421
+ /**
422
+ * Creates a new radio input with a set of options.
423
+ *
424
+ * @param {string} formKey - The name of the dropdown field, as specified in the form schema.
425
+ * @param {Object} formProperties - An object containing additional properties, such as the field type and options properties.
426
+ * @param {'radio'} formProperties.type - The type of form field. In this case, it will always be "radio".
427
+ * @param {Object} formProperties.validation - A set of validation rules for the field.
428
+ * @param {Object[]} formProperties.options - A list of properties to pass to the select options.
429
+ * @param {string} formProperties.options.label - The visible value of the option.
430
+ * @param {string} formProperties.options.value - The actual value of the option.
431
+ */
432
+ createRadio(formKey, formProperties) {
433
+ var _a, _b;
434
+ const fragment = new DocumentFragment();
435
+ for (const optionProperties of formProperties.options) {
436
+ // Create a new <input> element with the specified name and type
437
+ const input = document.createElement('input');
438
+ input.type = 'radio';
439
+ input.name = formKey;
440
+ input.value = optionProperties.value;
441
+ if ((_a = formProperties === null || formProperties === void 0 ? void 0 : formProperties.validation) === null || _a === void 0 ? void 0 : _a.required) {
442
+ input.setAttribute('required', 'required');
443
+ input.setAttribute('data-required', (_b = formProperties.validation.required.message) !== null && _b !== void 0 ? _b : '');
444
+ }
445
+ const span = document.createElement('span');
446
+ span.innerText = optionProperties.label;
447
+ fragment.appendChild(input);
448
+ fragment.appendChild(span);
449
+ fragment.appendChild(document.createElement('br'));
450
+ }
451
+ return fragment;
452
+ }
410
453
  /**
411
454
  * Populates the form template with input fields and labels based on the properties of the
412
455
  * current form schema. For each property in the schema, it creates an input element, applies
@@ -426,9 +469,19 @@ const TttxForm = class {
426
469
  propertyKeys.forEach(formKey => {
427
470
  const formItem = properties[formKey];
428
471
  const formProperties = formItem.form;
429
- const input = formProperties.type === 'select' ? this.createSelect(formKey, formProperties) : this.createInput(formKey, formProperties);
472
+ let input;
473
+ switch (formProperties.type) {
474
+ case 'select':
475
+ input = this.createSelect(formKey, formProperties);
476
+ break;
477
+ case 'radio':
478
+ input = this.createRadio(formKey, formProperties);
479
+ break;
480
+ default:
481
+ input = this.createInput(formKey, formProperties);
482
+ }
430
483
  // If the form property has validation, apply it to the input
431
- if (formProperties.validation) {
484
+ if (formProperties.validation && formProperties.type !== 'radio') {
432
485
  this.applyValidation(input, formProperties.validation);
433
486
  }
434
487
  // Create an error bubble and label element for the input
@@ -459,25 +512,40 @@ const TttxForm = class {
459
512
  const propertyKeys = Object.keys(properties);
460
513
  propertyKeys.forEach(formKey => {
461
514
  var _a, _b;
462
- const formInput = formItems.querySelector(`[name=${formKey}]`);
463
- // Bind events to form input elements
464
- formInput.oninvalid = this.validityCheckWrapper.bind(this);
465
- formInput.onblur = this.validityCheckWrapper.bind(this);
466
- formInput.onkeyup = this.fieldChanged.bind(this);
467
- formInput.onchange = this.fieldChanged.bind(this);
468
- if (((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey]) !== undefined && this._data[formKey] !== null) {
469
- formInput.value = this._data[formKey];
470
- }
471
- // If explicitly setting input as invalid, set invalid state and error message on render
472
- if ((_b = properties[formKey].form.validation) === null || _b === void 0 ? void 0 : _b.invalid) {
473
- const errorMessage = properties[formKey].form.validation.invalid.message;
474
- formInput.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
475
- setErrorState(formInput, true, errorMessage);
476
- }
477
- if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
478
- formInput.addEventListener('change', () => {
479
- formInput.classList.remove('placeholder');
480
- });
515
+ const formInputs = formItems.querySelectorAll(`[name=${formKey}]`);
516
+ for (const formInput of formInputs) {
517
+ // Bind events to form input elements
518
+ formInput.oninvalid = this.validityCheckWrapper.bind(this);
519
+ formInput.onblur = this.validityCheckWrapper.bind(this);
520
+ formInput.onkeyup = this.fieldChanged.bind(this);
521
+ formInput.onchange = this.fieldChanged.bind(this);
522
+ if ((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey]) {
523
+ switch (formInput.type) {
524
+ case 'checkbox':
525
+ if (this._data[formKey] === 'on') {
526
+ formInput.checked = true;
527
+ }
528
+ break;
529
+ case 'radio':
530
+ if (formInput.value === this._data[formKey]) {
531
+ formInput.checked = true;
532
+ }
533
+ break;
534
+ default:
535
+ formInput.value = this._data[formKey];
536
+ }
537
+ }
538
+ // If explicitly setting input as invalid, set invalid state and error message on render
539
+ if ((_b = properties[formKey].form.validation) === null || _b === void 0 ? void 0 : _b.invalid) {
540
+ const errorMessage = properties[formKey].form.validation.invalid.message;
541
+ formInput.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
542
+ setErrorState(formInput, true, errorMessage);
543
+ }
544
+ if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
545
+ formInput.addEventListener('change', () => {
546
+ formInput.classList.remove('placeholder');
547
+ });
548
+ }
481
549
  }
482
550
  });
483
551
  // Append the cloned form elements to the fieldset
@@ -13,7 +13,12 @@ const TttxIcon = class {
13
13
  this.color = 'grey';
14
14
  }
15
15
  render() {
16
- return (index.h(index.Host, null, index.h("span", { class: `material-symbols-rounded ${this.color ? this.color : ''}` }, this.icon)));
16
+ if (this.color.startsWith('#')) {
17
+ return (index.h(index.Host, null, index.h("span", { class: 'material-symbols-rounded', style: { color: this.color } }, this.icon)));
18
+ }
19
+ else {
20
+ return (index.h(index.Host, null, index.h("span", { class: `material-symbols-rounded ${this.color}` }, this.icon)));
21
+ }
17
22
  }
18
23
  };
19
24
  TttxIcon.style = tttxIconCss;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-992a9fb3.js');
6
6
 
7
- 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}";
7
+ 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}";
8
8
 
9
9
  const TttxInput = class {
10
10
  constructor(hostRef) {
@@ -14,6 +14,7 @@ const TttxTreeView = class {
14
14
  this.clickEvent = index.createEvent(this, "clickEvent", 7);
15
15
  this.expandNode = index.createEvent(this, "expandNode", 7);
16
16
  this.data = undefined;
17
+ this.firstSelected = undefined;
17
18
  this.treeData = undefined;
18
19
  this.selectedId = undefined;
19
20
  }
@@ -56,9 +57,8 @@ const TttxTreeView = class {
56
57
  }
57
58
  updateSelected(node) {
58
59
  let selected = false;
59
- if (node.id === this.selectedId) {
60
+ if (node.id === this.selectedId)
60
61
  selected = true;
61
- }
62
62
  return selected;
63
63
  }
64
64
  treeConfigs(node) {
@@ -106,6 +106,8 @@ const TttxTreeView = class {
106
106
  render() {
107
107
  if (!this.data)
108
108
  return;
109
+ if (this.firstSelected)
110
+ this.selectedId = this.data[0].id;
109
111
  this.treeData = typeof this.data === 'string' ? JSON.parse(this.data) : this.data;
110
112
  return (index.h("div", { class: "tree-view-element" }, index.h("ul", null, this.treeData.map((node) => this.renderNode(node)))));
111
113
  }
@@ -17,7 +17,7 @@ const patchBrowser = () => {
17
17
  };
18
18
 
19
19
  patchBrowser().then(options => {
20
- return index.bootstrapLazy([["tttx-data-pattern.cjs",[[1,"tttx-data-pattern",{"data":[1],"sorteroptions":[1],"filteroptions":[1],"filterheader":[1]}]]],["tttx-multiselect-box.cjs",[[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.cjs",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box.cjs",[[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.cjs",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32],"selectedId":[32]}]]],["tttx-checkbox.cjs",[[0,"tttx-checkbox",{"checkboxId":[1,"checkbox-id"],"label":[1],"inline":[4],"indeterminate":[4],"checked":[4]}]]],["tttx-dialog.cjs",[[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.cjs",[[1,"tttx-expander",{"name":[1],"open":[4],"lefticon":[1],"lefticoncolor":[1],"isExpanded":[32]}]]],["tttx-tabs.cjs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-checkbox-group.cjs",[[1,"tttx-checkbox-group"]]],["tttx-checkbox-group-caption.cjs",[[4,"tttx-checkbox-group-caption"]]],["tttx-checkbox-group-heading.cjs",[[4,"tttx-checkbox-group-heading"]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-percentage-bar.cjs",[[2,"tttx-percentage-bar",{"percentage":[8],"thresholds":[1],"color":[1],"min":[1],"labelid":[1],"_percentage":[32],"_ranges":[32],"_min":[32]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag.cjs",[[1,"tttx-tag",{"text":[1],"color":[1],"textColor":[1,"text-color"]}]]],["tttx-textarea.cjs",[[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.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input.cjs",[[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.cjs",[[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.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
20
+ return index.bootstrapLazy([["tttx-data-pattern.cjs",[[1,"tttx-data-pattern",{"data":[1],"sorteroptions":[1],"filteroptions":[1],"filterheader":[1]}]]],["tttx-multiselect-box.cjs",[[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.cjs",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"allowOverflow":[4,"allow-overflow"],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box.cjs",[[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.cjs",[[1,"tttx-tree-view",{"data":[1040],"firstSelected":[1028,"first-selected"],"treeData":[32],"selectedId":[32]}]]],["tttx-checkbox.cjs",[[0,"tttx-checkbox",{"checkboxId":[1,"checkbox-id"],"label":[1],"inline":[4],"indeterminate":[4],"checked":[4]}]]],["tttx-dialog.cjs",[[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.cjs",[[1,"tttx-expander",{"name":[1],"open":[4],"lefticon":[1],"lefticoncolor":[1],"isExpanded":[32]}]]],["tttx-tabs.cjs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-checkbox-group.cjs",[[1,"tttx-checkbox-group"]]],["tttx-checkbox-group-caption.cjs",[[4,"tttx-checkbox-group-caption"]]],["tttx-checkbox-group-heading.cjs",[[4,"tttx-checkbox-group-heading"]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1025],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[1],"horizontal":[4],"spacedout":[4],"_elements":[32]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-percentage-bar.cjs",[[2,"tttx-percentage-bar",{"percentage":[8],"thresholds":[1],"color":[1],"min":[1],"labelid":[1],"_percentage":[32],"_ranges":[32],"_min":[32]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag.cjs",[[1,"tttx-tag",{"text":[1],"color":[1],"textColor":[1,"text-color"]}]]],["tttx-textarea.cjs",[[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.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input.cjs",[[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.cjs",[[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.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
21
21
  });
22
22
 
23
23
  exports.setNonce = index.setNonce;
@@ -5,7 +5,12 @@ export class TttxIcon {
5
5
  this.color = 'grey';
6
6
  }
7
7
  render() {
8
- return (h(Host, null, h("span", { class: `material-symbols-rounded ${this.color ? this.color : ''}` }, this.icon)));
8
+ if (this.color.startsWith('#')) {
9
+ return (h(Host, null, h("span", { class: 'material-symbols-rounded', style: { color: this.color } }, this.icon)));
10
+ }
11
+ else {
12
+ return (h(Host, null, h("span", { class: `material-symbols-rounded ${this.color}` }, this.icon)));
13
+ }
9
14
  }
10
15
  static get is() { return "tttx-icon"; }
11
16
  static get encapsulation() { return "shadow"; }
@@ -1,5 +1,5 @@
1
1
  import icons from './../../../icons';
2
- const colors = ['red', 'blue', 'black', 'white', 'gray', 'green', 'orange', 'darkred'];
2
+ const colors = ['red', 'blue', 'black', 'white', 'gray', 'green', 'orange', 'darkred', '#397A4C', '#FF00BB'];
3
3
  export default {
4
4
  title: 'Atoms/Icons',
5
5
  component: 'tttx-icon',
@@ -13,5 +13,12 @@ export default {
13
13
  };
14
14
  export const Example = args => {
15
15
  const size = args.size || 'large';
16
- return `<tttx-loading-spinner ${args.loadingMessage ? 'loading-message' : ''} size='${size}' />`;
16
+ return `<tttx-loading-spinner data-chromatic="ignore" ${args.loadingMessage ? 'loading-message' : ''} size='${size}' />`;
17
+ };
18
+ Example.parameters = {
19
+ chromatic: {
20
+ pauseAnimationAtEnd: true,
21
+ delay: 5000,
22
+ disableSnapshot: true
23
+ },
17
24
  };
@@ -23,6 +23,8 @@ function setErrorState(target, hasError, errorMessage, parent = undefined) {
23
23
  errorBubble = target.parentElement.parentElement.querySelector('.errorBubble');
24
24
  }
25
25
  }
26
+ if (!errorBubble)
27
+ return;
26
28
  // If an error was detected, set the input field's class to "invalid" and display the error message in the error bubble
27
29
  if (hasError) {
28
30
  target.classList.add('invalid');
@@ -30,6 +30,16 @@ function validityCheck(event) {
30
30
  // target.setCustomValidity('custom error!');
31
31
  // and cleared with
32
32
  // target.setCustomValidity('');
33
+ //handle whitespace-only input
34
+ if (target.value.length && !target.value.replace(/\s/g, '').length) {
35
+ errorMessage = 'This field cannot be left blank';
36
+ target.setCustomValidity(errorMessage);
37
+ }
38
+ else {
39
+ errorMessage = '';
40
+ if (target.setCustomValidity) // tests are dumb as a brick
41
+ target.setCustomValidity('');
42
+ }
33
43
  // Check the validity of the input field and set an error message if needed
34
44
  switch (true) {
35
45
  // The field is required, but has no value
@@ -57,11 +67,6 @@ function validityCheck(event) {
57
67
  default:
58
68
  hasError = false;
59
69
  }
60
- //handle whitespace-only input
61
- if (!target.value.replace(/\s/g, '').length && target.value.length !== 0) {
62
- errorMessage = 'Whitespace-only not allowed';
63
- hasError = true;
64
- }
65
70
  // Return the error state
66
71
  return { target, hasError, errorMessage };
67
72
  }
@@ -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;
@@ -258,17 +258,21 @@ export class TttxForm {
258
258
  */
259
259
  createLabel(formProperties, input, errorBubble) {
260
260
  const outerContainer = document.createElement('div');
261
- outerContainer.className = 'outer-container inputBlock';
261
+ let outerContainerClassName = 'outer-container inputBlock';
262
262
  // Create a new <label> element with the "inputBlock" class and the specified text
263
263
  const label = document.createElement('label');
264
264
  label.innerText = formProperties.label;
265
265
  // If the form property has no validation object, add an "optional" span element to the label
266
- if (!formProperties.validation) {
266
+ if (!formProperties.validation && formProperties.label) {
267
267
  const optionalSpan = document.createElement('span');
268
268
  optionalSpan.className = 'optional';
269
269
  optionalSpan.innerHTML = '&nbsp;(optional)';
270
270
  label.appendChild(optionalSpan);
271
271
  }
272
+ if (formProperties.type === 'radio') {
273
+ outerContainerClassName += ' radioBlock';
274
+ }
275
+ outerContainer.className = outerContainerClassName;
272
276
  if (formProperties.readonly) {
273
277
  label.classList.add('readonly');
274
278
  }
@@ -286,6 +290,38 @@ export class TttxForm {
286
290
  // Return the label element
287
291
  return label;
288
292
  }
293
+ /**
294
+ * Creates a new radio input with a set of options.
295
+ *
296
+ * @param {string} formKey - The name of the dropdown field, as specified in the form schema.
297
+ * @param {Object} formProperties - An object containing additional properties, such as the field type and options properties.
298
+ * @param {'radio'} formProperties.type - The type of form field. In this case, it will always be "radio".
299
+ * @param {Object} formProperties.validation - A set of validation rules for the field.
300
+ * @param {Object[]} formProperties.options - A list of properties to pass to the select options.
301
+ * @param {string} formProperties.options.label - The visible value of the option.
302
+ * @param {string} formProperties.options.value - The actual value of the option.
303
+ */
304
+ createRadio(formKey, formProperties) {
305
+ var _a, _b;
306
+ const fragment = new DocumentFragment();
307
+ for (const optionProperties of formProperties.options) {
308
+ // Create a new <input> element with the specified name and type
309
+ const input = document.createElement('input');
310
+ input.type = 'radio';
311
+ input.name = formKey;
312
+ input.value = optionProperties.value;
313
+ if ((_a = formProperties === null || formProperties === void 0 ? void 0 : formProperties.validation) === null || _a === void 0 ? void 0 : _a.required) {
314
+ input.setAttribute('required', 'required');
315
+ input.setAttribute('data-required', (_b = formProperties.validation.required.message) !== null && _b !== void 0 ? _b : '');
316
+ }
317
+ const span = document.createElement('span');
318
+ span.innerText = optionProperties.label;
319
+ fragment.appendChild(input);
320
+ fragment.appendChild(span);
321
+ fragment.appendChild(document.createElement('br'));
322
+ }
323
+ return fragment;
324
+ }
289
325
  /**
290
326
  * Populates the form template with input fields and labels based on the properties of the
291
327
  * current form schema. For each property in the schema, it creates an input element, applies
@@ -305,9 +341,19 @@ export class TttxForm {
305
341
  propertyKeys.forEach(formKey => {
306
342
  const formItem = properties[formKey];
307
343
  const formProperties = formItem.form;
308
- const input = formProperties.type === 'select' ? this.createSelect(formKey, formProperties) : this.createInput(formKey, formProperties);
344
+ let input;
345
+ switch (formProperties.type) {
346
+ case 'select':
347
+ input = this.createSelect(formKey, formProperties);
348
+ break;
349
+ case 'radio':
350
+ input = this.createRadio(formKey, formProperties);
351
+ break;
352
+ default:
353
+ input = this.createInput(formKey, formProperties);
354
+ }
309
355
  // If the form property has validation, apply it to the input
310
- if (formProperties.validation) {
356
+ if (formProperties.validation && formProperties.type !== 'radio') {
311
357
  this.applyValidation(input, formProperties.validation);
312
358
  }
313
359
  // Create an error bubble and label element for the input
@@ -338,25 +384,40 @@ export class TttxForm {
338
384
  const propertyKeys = Object.keys(properties);
339
385
  propertyKeys.forEach(formKey => {
340
386
  var _a, _b;
341
- const formInput = formItems.querySelector(`[name=${formKey}]`);
342
- // Bind events to form input elements
343
- formInput.oninvalid = this.validityCheckWrapper.bind(this);
344
- formInput.onblur = this.validityCheckWrapper.bind(this);
345
- formInput.onkeyup = this.fieldChanged.bind(this);
346
- formInput.onchange = this.fieldChanged.bind(this);
347
- if (((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey]) !== undefined && this._data[formKey] !== null) {
348
- formInput.value = this._data[formKey];
349
- }
350
- // If explicitly setting input as invalid, set invalid state and error message on render
351
- if ((_b = properties[formKey].form.validation) === null || _b === void 0 ? void 0 : _b.invalid) {
352
- const errorMessage = properties[formKey].form.validation.invalid.message;
353
- formInput.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
354
- setErrorState(formInput, true, errorMessage);
355
- }
356
- if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
357
- formInput.addEventListener('change', () => {
358
- formInput.classList.remove('placeholder');
359
- });
387
+ const formInputs = formItems.querySelectorAll(`[name=${formKey}]`);
388
+ for (const formInput of formInputs) {
389
+ // Bind events to form input elements
390
+ formInput.oninvalid = this.validityCheckWrapper.bind(this);
391
+ formInput.onblur = this.validityCheckWrapper.bind(this);
392
+ formInput.onkeyup = this.fieldChanged.bind(this);
393
+ formInput.onchange = this.fieldChanged.bind(this);
394
+ if ((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey]) {
395
+ switch (formInput.type) {
396
+ case 'checkbox':
397
+ if (this._data[formKey] === 'on') {
398
+ formInput.checked = true;
399
+ }
400
+ break;
401
+ case 'radio':
402
+ if (formInput.value === this._data[formKey]) {
403
+ formInput.checked = true;
404
+ }
405
+ break;
406
+ default:
407
+ formInput.value = this._data[formKey];
408
+ }
409
+ }
410
+ // If explicitly setting input as invalid, set invalid state and error message on render
411
+ if ((_b = properties[formKey].form.validation) === null || _b === void 0 ? void 0 : _b.invalid) {
412
+ const errorMessage = properties[formKey].form.validation.invalid.message;
413
+ formInput.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
414
+ setErrorState(formInput, true, errorMessage);
415
+ }
416
+ if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
417
+ formInput.addEventListener('change', () => {
418
+ formInput.classList.remove('placeholder');
419
+ });
420
+ }
360
421
  }
361
422
  });
362
423
  // Append the cloned form elements to the fieldset