@3t-transform/threeteeui 0.2.74 → 0.2.76

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 (72) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/tttx-button.cjs.entry.js +2 -2
  3. package/dist/cjs/tttx-form.cjs.entry.js +78 -49
  4. package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +17 -14
  5. package/dist/cjs/tttx-list.cjs.entry.js +1 -1
  6. package/dist/cjs/tttx-multiselect-box.cjs.entry.js +130 -0
  7. package/dist/cjs/tttx-standalone-input.cjs.entry.js +8 -3
  8. package/dist/cjs/tttx-tag.cjs.entry.js +1 -1
  9. package/dist/cjs/tttx.cjs.js +1 -1
  10. package/dist/collection/collection-manifest.json +2 -1
  11. package/dist/collection/components/atoms/tttx-button/tttx-button.css +1 -1
  12. package/dist/collection/components/atoms/tttx-button/tttx-button.js +1 -2
  13. package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +1 -1
  14. package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +0 -1
  15. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.css +14 -5
  16. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +46 -18
  17. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +85 -29
  18. package/dist/collection/components/atoms/tttx-tag/tttx-tag.css +1 -1
  19. package/dist/collection/components/atoms/tttx-tag/tttx-tag.js +0 -1
  20. package/dist/collection/components/atoms/tttx-tag/tttx-tag.stories.js +1 -1
  21. package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +14 -3
  22. package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +15 -13
  23. package/dist/collection/components/molecules/tttx-form/tttx-form.css +107 -177
  24. package/dist/collection/components/molecules/tttx-form/tttx-form.js +56 -36
  25. package/dist/collection/components/molecules/tttx-list/tttx-list.css +1 -1
  26. package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.css +135 -0
  27. package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.js +339 -0
  28. package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.stories.js +201 -0
  29. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css +102 -198
  30. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +7 -2
  31. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +23 -5
  32. package/dist/components/index.d.ts +1 -0
  33. package/dist/components/index.js +1 -0
  34. package/dist/components/tttx-button2.js +2 -2
  35. package/dist/components/tttx-form.js +79 -50
  36. package/dist/components/tttx-keyvalue-block.js +21 -16
  37. package/dist/components/tttx-list.js +1 -1
  38. package/dist/components/tttx-multiselect-box.d.ts +11 -0
  39. package/dist/components/tttx-multiselect-box.js +172 -0
  40. package/dist/components/tttx-standalone-input2.js +8 -3
  41. package/dist/components/tttx-tag.js +1 -1
  42. package/dist/esm/loader.js +1 -1
  43. package/dist/esm/tttx-button.entry.js +2 -2
  44. package/dist/esm/tttx-form.entry.js +78 -49
  45. package/dist/esm/tttx-keyvalue-block.entry.js +17 -14
  46. package/dist/esm/tttx-list.entry.js +1 -1
  47. package/dist/esm/tttx-multiselect-box.entry.js +126 -0
  48. package/dist/esm/tttx-standalone-input.entry.js +8 -3
  49. package/dist/esm/tttx-tag.entry.js +1 -1
  50. package/dist/esm/tttx.js +1 -1
  51. package/dist/tttx/p-09b92178.entry.js +1 -0
  52. package/dist/tttx/{p-750cf31b.entry.js → p-129df5a2.entry.js} +1 -1
  53. package/dist/tttx/{p-a6582ab0.entry.js → p-25acdd4c.entry.js} +1 -1
  54. package/dist/tttx/{p-5b7b8539.entry.js → p-4ade2866.entry.js} +1 -1
  55. package/dist/tttx/p-77fed2a6.entry.js +1 -0
  56. package/dist/tttx/p-b30a1025.entry.js +1 -0
  57. package/dist/tttx/p-d1ff1456.entry.js +1 -0
  58. package/dist/tttx/tttx.esm.js +1 -1
  59. package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +7 -1
  60. package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +6 -4
  61. package/dist/types/components/molecules/tttx-form/lib/setErrorState.d.ts +3 -2
  62. package/dist/types/components/molecules/tttx-form/lib/validityCheck.d.ts +5 -7
  63. package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +74 -29
  64. package/dist/types/components/molecules/tttx-multiselect-box/interfaces.d.ts +6 -0
  65. package/dist/types/components/molecules/tttx-multiselect-box/tttx-multiselect-box.d.ts +38 -0
  66. package/dist/types/components/molecules/tttx-multiselect-box/tttx-multiselect-box.stories.d.ts +15 -0
  67. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +7 -0
  68. package/dist/types/components.d.ts +46 -8
  69. package/package.json +1 -1
  70. package/dist/tttx/p-6fe0af4e.entry.js +0 -1
  71. package/dist/tttx/p-818574fe.entry.js +0 -1
  72. package/dist/tttx/p-895526aa.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-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]}]]],["tttx-filter.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"]]]]],["tttx-list.cjs",[[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}]]],["tttx-sorter.cjs",[[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"]]]]],["tttx-tabs.cjs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1032],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[8],"horizontal":[4]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag.cjs",[[1,"tttx-tag",{"text":[1],"color":[1]}]]],["tttx-toolbar.cjs",[[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["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-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
17
+ return index.bootstrapLazy([["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]}]]],["tttx-filter.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"]]]]],["tttx-list.cjs",[[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32]}]]],["tttx-sorter.cjs",[[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"]]]]],["tttx-tabs.cjs",[[2,"tttx-tabs",{"tabsName":[1,"tabs-name"],"navigation":[4],"wide":[4],"tabs":[1],"_tabs":[32]},[[0,"keydown","handleKeyDown"]]]]],["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-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag.cjs",[[1,"tttx-tag",{"text":[1],"color":[1]}]]],["tttx-toolbar.cjs",[[1,"tttx-toolbar",{"border":[4],"viewSize":[32]},[[9,"resize","handleResize"]]]]],["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-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-4cfa8e25.js');
6
6
 
7
- const tttxButtonCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}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:400}.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:inline-block}tttx-icon{cursor:inherit}.spacingleft{margin-left:8px}";
7
+ const tttxButtonCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}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:inline-block}tttx-icon{cursor:inherit}.spacingleft{margin-left:8px}";
8
8
 
9
9
  const TttxButton = class {
10
10
  constructor(hostRef) {
@@ -28,7 +28,7 @@ const TttxButton = class {
28
28
  }
29
29
  render() {
30
30
  this._iconcolor = this.iconcolor;
31
- return (index.h(index.Host, null, index.h("button", { class: `button ${this._design} ${this.icon ? 'withicon' : ''} ${this.icon && this.iconposition ? 'icon' + this.iconposition : ''} ${this.notext ? 'notext' : ''}` }, this.icon && this.iconposition === 'left' && (index.h("div", { class: "icon-left" }, index.h("tttx-icon", { icon: this.icon, color: this._iconcolor }))), !this.notext && index.h("div", { class: "button-content" }, index.h("slot", null)), this.icon && this.iconposition === 'right' && (index.h("div", { class: "icon-right" }, index.h("tttx-icon", { icon: this.icon, color: this._iconcolor }))))));
31
+ return (index.h(index.Host, null, index.h("button", { class: `button ${this._design} ${this.icon ? 'withicon' : ''} ${this.icon && this.iconposition ? 'icon' + this.iconposition : ''} ${this.notext ? 'notext' : ''}` }, this.icon && this.iconposition === 'left' && (index.h("div", { class: "icon-left" }, index.h("tttx-icon", { icon: this.icon, color: this._iconcolor }))), !this.notext && (index.h("div", { class: "button-content" }, index.h("slot", null))), this.icon && this.iconposition === 'right' && (index.h("div", { class: "icon-right" }, index.h("tttx-icon", { icon: this.icon, color: this._iconcolor }))))));
32
32
  }
33
33
  };
34
34
  TttxButton.style = tttxButtonCss;
@@ -11,8 +11,8 @@ require('./_commonjsHelpers-537d719a.js');
11
11
  * sets an error message if there's an issue, and emits a "dataChanged" event to
12
12
  * the parent component with the field name and its new value.
13
13
  *
14
- * @param {Event} event - The focusout event triggered by the input field.
15
- * @return {void}
14
+ * @param {Event | FocusEvent} event - The focusout event triggered by the input field.
15
+ * @return {{ target: FormField; hasError: boolean; errorMessage: string; }}
16
16
  */
17
17
  function validityCheck(event) {
18
18
  var _a, _b, _c, _d;
@@ -21,17 +21,19 @@ function validityCheck(event) {
21
21
  let hasError = true;
22
22
  let errorMessage = '';
23
23
  // validity object on HTML5 inputs has the following options
24
- // badInput
25
- // customError
26
- // patternMismatch
27
- // rangeOverflow
28
- // rangeUnderflow
29
- // stepMismatch
30
- // tooLong
31
- // tooShort
32
- // typeMismatch
33
- // valid
34
- // valueMissing
24
+ /*
25
+ badInput
26
+ customError
27
+ patternMismatch
28
+ rangeOverflow
29
+ rangeUnderflow
30
+ stepMismatch
31
+ tooLong
32
+ tooShort
33
+ typeMismatch
34
+ valid
35
+ valueMissing
36
+ */
35
37
  // customErrors can be set with
36
38
  // target.setCustomValidity('custom error!');
37
39
  // and cleared with
@@ -73,14 +75,25 @@ function validityCheck(event) {
73
75
  * displays the error message in an error bubble. If no error was detected,
74
76
  * it removes the "invalid" class from the input field and clears the error bubble.
75
77
  *
76
- * @param {HTMLInputElement} target - The input field to update.
78
+ * @param {FormField} target - The input field to update.
77
79
  * @param {boolean} hasError - Whether an error was detected in the field.
78
80
  * @param {string} errorMessage - The error message to display (if any).
79
81
  * @return {void}
80
82
  */
81
- function setErrorState(target, hasError, errorMessage) {
83
+ function setErrorState(target, hasError, errorMessage, parent = undefined) {
82
84
  // Find the error bubble element for the input field
83
- const errorBubble = target.parentElement.querySelector('.errorBubble');
85
+ let errorBubble;
86
+ if (parent !== undefined) {
87
+ errorBubble = parent.querySelector('.errorBubble');
88
+ }
89
+ else {
90
+ if (target.parentElement.nodeName.toLowerCase() === 'label') {
91
+ errorBubble = target.parentElement.querySelector('.errorBubble');
92
+ }
93
+ else {
94
+ errorBubble = target.parentElement.parentElement.querySelector('.errorBubble');
95
+ }
96
+ }
84
97
  // If an error was detected, set the input field's class to "invalid" and display the error message in the error bubble
85
98
  if (hasError) {
86
99
  target.classList.add('invalid');
@@ -104,7 +117,7 @@ function setErrorState(target, hasError, errorMessage) {
104
117
  }
105
118
  }
106
119
 
107
- 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}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:normal;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}.icon-left,.icon-right{flex-basis:24px}.icon-left span,.icon-right span{font-size:24px;line-height:24px;text-align:center;display:block;width:24px;height:24px;margin-top:4px}.icon-left span{margin-left:4px}.icon-right span{margin-right:4px}.icon-right{margin-top:5px}.icon-left{margin-top:5px;margin-left:4px}.iconleft .input{padding-left:4px}.iconright .input{padding-right:4px}.input-icon{position:absolute;margin-top:9px;margin-left:4px}.errormsg{display:flex;justify-content:center;align-items:center;float:left;margin-bottom:16px;box-sizing:border-box;background-color:transparent;height:26px;font-size:14px;line-height:16px;border-radius:none;z-index:2;color:#dc0000}.errormsg .validationicon{width:16px;height:16px;font-size:16px;line-height:19px;margin-right:4px;vertical-align:middle;color:#dc0000}.danger{color:#dc0000}.optional{color:#757575;font-weight:normal}label.inputBlock{display:block;position:relative;line-height:21px}label.inputInline{display:flex;white-space:nowrap;align-items:center}label.inputInline .input-container{margin:0 4px;width:100%;display:flex;align-items:center;gap:4px;position:relative}label{font-weight:500;font-size:16px;line-height:19px;margin-bottom:16px}input:not([type=submit]){font-family:\"Roboto\", serif;box-sizing:border-box;width:100%;height:36px;padding:0 16px;font-size:16px;line-height:19px;border:1px solid #d5d5d5;border-radius:4px;margin-top:4px}input[type=date]{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}@media (max-width: 600px){input[type=date]{padding-top:6px}}input.invalid:invalid,input.standalone.invalid{border:1px solid #dc0000}.input-icon~input{padding:0 32px}input~.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}input~.errorBubble:not(.visible){display:none}input~.errorBubble span{color:#dc0000;font-size:16px;margin-right:4px}input.invalid:invalid~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000}input:focus{border-color:#1479c6}input:focus-visible{outline:none}.secondarylabel{color:#757575;font-size:14px;line-height:16px;font-weight:normal;display:flex;margin-top:4px}label.inputBlock.readonly{pointer-events:none;user-select:none;color:gray}input[readonly]{cursor:default;pointer-events:none;user-select:none;color:gray}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:400}.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.inputBlock.inlineBlock{display:inline-block}.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}";
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}";
108
121
 
109
122
  const TttxForm = class {
110
123
  constructor(hostRef) {
@@ -121,11 +134,8 @@ const TttxForm = class {
121
134
  // If the formSchema changes and the form data is uncontrolled, store the data since the fields will be removed to avoid form duplication
122
135
  if (!this.data && this.form && this._formSchema) {
123
136
  const formData = new FormData(this.form);
124
- this._data = Object.fromEntries(Object.keys(this._formSchema.properties).map((formKey) => {
125
- return [
126
- formKey,
127
- formData.get(formKey)
128
- ];
137
+ this._data = Object.fromEntries(Object.keys(this._formSchema.properties).map(formKey => {
138
+ return [formKey, formData.get(formKey)];
129
139
  }));
130
140
  }
131
141
  // Check if the new value is a string, indicating that it needs to be parsed
@@ -150,7 +160,7 @@ const TttxForm = class {
150
160
  * Handles the focus event for a form field and emits a "dataChanged" event
151
161
  * to the parent component with the field name and its new value.
152
162
  *
153
- * @param {ChangeEvent} event - The focus event triggered by the field.
163
+ * @param {KeyboardEvent | Event} event - The focus event triggered by the field.
154
164
  * @return {void}
155
165
  */
156
166
  fieldChanged(event) {
@@ -202,20 +212,22 @@ const TttxForm = class {
202
212
  * Creates a new HTMLSelectElement with a set of options.
203
213
  *
204
214
  * @param {string} formKey - The name of the dropdown field, as specified in the form schema.
205
- * @param {Object} formProperties - An object containing additional properties, such as the field type and options properties.
215
+ * @param {object} formProperties - An object containing additional properties, such as the field type and options properties.
206
216
  * @param {'select'} formProperties.type - The type of form field. In this case, it will always be "select".
207
- * @param {Object} formProperties.validation - A set of validation rules for the field.
208
- * @param {Object[]} formProperties.options - A list of properties to pass to the select options.
209
- * @param {string} formProperties.options.label - The visible value of the option.
210
- * @param {string} formProperties.options.value - The actual value of the option.
217
+ * @param {object} formProperties.validation - A set of validation rules for the field.
218
+ * @param {Array<{label:string, value:string, placeholder?:boolean}>} formProperties.options - A list of properties to pass to the select options.
219
+ * @param {string} formProperties.options[].label - The visible value of the option.
220
+ * @param {string} formProperties.options[].value - The actual value of the option.
221
+ * @param {boolean} [formProperties.options[].placeholder]
211
222
  */
212
223
  createSelect(formKey, formProperties) {
224
+ var _a;
213
225
  const select = document.createElement('select');
214
226
  select.setAttribute('name', formKey);
215
227
  formProperties.options.forEach(optionProperties => {
216
228
  this.appendOption(select, optionProperties);
217
229
  });
218
- if (this._data && this._data[formKey])
230
+ if ((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey])
219
231
  select.classList.remove('placeholder');
220
232
  return select;
221
233
  }
@@ -223,8 +235,10 @@ const TttxForm = class {
223
235
  * Appends an option to a select element
224
236
  *
225
237
  * @param {HTMLSelectElement} select - The select elements to attach the option to.
226
- * @param {value} value - The value of the option.
227
- * @param {label} label - The label which will be displayed on the form for the option.
238
+ * @param {Object} optionProperties
239
+ * @param {string} optionProperties.value - The value of the option.
240
+ * @param {string} optionProperties.label - The label which will be displayed on the form for the option.
241
+ * @param {boolean} [optionProperties.placeholder]
228
242
  */
229
243
  appendOption(select, optionProperties) {
230
244
  const option = document.createElement('option');
@@ -244,7 +258,7 @@ const TttxForm = class {
244
258
  * and sets its autocomplete and autocapitalization properties to off.
245
259
  *
246
260
  * @param {string} formKey - The name of the input field, as specified in the form schema.
247
- * @param {Object} formProperties - An object containing additional properties for the input field, such as its type and placeholder value.
261
+ * @param {Record<string, any>} formProperties - An object containing additional properties for the input field, such as its type and placeholder value.
248
262
  * @param {string} formProperties.type - The type of the input field (e.g., "text", "email", "number", etc.).
249
263
  * @param {string} [formProperties.placeholder] - An optional placeholder value to display in the input field.
250
264
  * @return {HTMLInputElement} - The new input element.
@@ -272,12 +286,19 @@ const TttxForm = class {
272
286
  * the input element (e.g., "required" will set the "required" and "data-required" attributes,
273
287
  * "pattern" will set the "pattern" and "data-pattern" attributes, etc.).
274
288
  *
275
- * @param {HTMLInputElement} input - The input element to apply validation attributes to.
276
- * @param {Object} validation - An object containing the validation rules for the input field.
277
- * @param {Object} [validation.required] - An object containing a "message" property to display if the field is required.
278
- * @param {Object} [validation.pattern] - An object containing a "pattern" property to match against the field value, and a "message" property to display if the pattern doesn't match.
279
- * @param {Object} [validation.badInput] - An object containing a "message" property to display if the field value is invalid.
280
- * @param {Object} [validation.minmax] - An object containing "min" and "max" properties to validate the field value against, and a "message" property to display if the value is out of range.
289
+ * @param {FormField} input - The input element to apply validation attributes to.
290
+ * @param {object} validation - An object containing the validation rules for the input field.
291
+ * @param {object} [validation.required] - An object containing a "message" property to display if the field is required.
292
+ * @param {string} [validation.required.message]
293
+ * @param {object} [validation.pattern] - An object containing a "pattern" property to match against the field value, and a "message" property to display if the pattern doesn't match.
294
+ * @param {string} [validation.pattern.pattern]
295
+ * @param {string} [validation.pattern.message]
296
+ * @param {object} [validation.badInput] - An object containing a "message" property to display if the field value is invalid.
297
+ * @param {string} [validation.badInput.message]
298
+ * @param {object} [validation.minmax] - An object containing "min" and "max" properties to validate the field value against, and a "message" property to display if the value is out of range.
299
+ * @param {string} [validation.minmax.min]
300
+ * @param {string} [validation.minmax.max]
301
+ * @param {string} [validation.minmax.message]
281
302
  * @param {string} [validation.maxlength] - The maximum length of the input field.
282
303
  * @return {void}
283
304
  */
@@ -320,6 +341,13 @@ const TttxForm = class {
320
341
  // Return the error bubble element
321
342
  return errorBubble;
322
343
  }
344
+ /**
345
+ *
346
+ * @param {Record<string, any>} formProperties
347
+ * @param {HTMLInputElement | HTMLSelectElement} input
348
+ * @param {HTMLLabelElement} label
349
+ * @returns {void}
350
+ */
323
351
  appendCheckboxInput(formProperties, input, label) {
324
352
  if (formProperties.label) {
325
353
  const lineBreak = document.createElement('br');
@@ -339,15 +367,16 @@ const TttxForm = class {
339
367
  * and appends the input element and error bubble element to it. If the form property has
340
368
  * no validation object, it adds an "optional" span element to the label.
341
369
  *
342
- * @param {Object} formProperties - An object containing properties for the form field, including its label text and validation rules.
343
- * @param {HTMLInputElement} input - The input element to associate with the label.
370
+ * @param {Record<string, any>} formProperties - An object containing properties for the form field, including its label text and validation rules.
371
+ * @param {HTMLInputElement | HTMLSelectElement} input - The input element to associate with the label.
344
372
  * @param {HTMLDivElement} errorBubble - The error bubble element to display error messages in.
345
373
  * @return {HTMLLabelElement} - The new label element.
346
374
  */
347
375
  createLabel(formProperties, input, errorBubble) {
376
+ const outerContainer = document.createElement('div');
377
+ outerContainer.className = 'outer-container inputBlock';
348
378
  // Create a new <label> element with the "inputBlock" class and the specified text
349
379
  const label = document.createElement('label');
350
- label.className = 'inputBlock';
351
380
  label.innerText = formProperties.label;
352
381
  // If the form property has no validation object, add an "optional" span element to the label
353
382
  if (!formProperties.validation) {
@@ -360,12 +389,14 @@ const TttxForm = class {
360
389
  label.classList.add('readonly');
361
390
  }
362
391
  if (formProperties.type === 'checkbox') {
363
- label.className += ' inlineBlock';
364
392
  this.appendCheckboxInput(formProperties, input, label);
365
393
  }
366
394
  else {
367
- // Append the input element and error bubble element to the label
368
- label.appendChild(input);
395
+ // Append the input element and error bubble element to the outerContainer
396
+ outerContainer.appendChild(input);
397
+ }
398
+ if (formProperties.type !== 'checkbox') {
399
+ label.appendChild(outerContainer);
369
400
  }
370
401
  label.appendChild(errorBubble);
371
402
  // Return the label element
@@ -422,18 +453,18 @@ const TttxForm = class {
422
453
  const properties = this._formSchema.properties;
423
454
  const propertyKeys = Object.keys(properties);
424
455
  propertyKeys.forEach(formKey => {
425
- var _a;
456
+ var _a, _b;
426
457
  const formInput = formItems.querySelector(`[name=${formKey}]`);
427
458
  // Bind events to form input elements
428
459
  formInput.oninvalid = this.validityCheckWrapper.bind(this);
429
460
  formInput.onblur = this.validityCheckWrapper.bind(this);
430
461
  formInput.onkeyup = this.fieldChanged.bind(this);
431
462
  formInput.onchange = this.fieldChanged.bind(this);
432
- if (this._data && this._data[formKey] !== undefined && this._data[formKey] !== null) {
463
+ if (((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey]) !== undefined && this._data[formKey] !== null) {
433
464
  formInput.value = this._data[formKey];
434
465
  }
435
466
  // If explicitly setting input as invalid, set invalid state and error message on render
436
- if ((_a = properties[formKey].form.validation) === null || _a === void 0 ? void 0 : _a.invalid) {
467
+ if ((_b = properties[formKey].form.validation) === null || _b === void 0 ? void 0 : _b.invalid) {
437
468
  const errorMessage = properties[formKey].form.validation.invalid.message;
438
469
  formInput.setCustomValidity(errorMessage); // Prevents the invalid styling from resetting on blur
439
470
  setErrorState(formInput, true, errorMessage);
@@ -457,8 +488,6 @@ const TttxForm = class {
457
488
  * and emits a "dataSubmitted" event with the form data. The fieldset element is assigned
458
489
  * to the "fieldset" instance variable using a ref, so it can be populated with form elements
459
490
  * later on.
460
- *
461
- * @return {JSX.Element} - The rendered form template as a JSX element.
462
491
  */
463
492
  render() {
464
493
  return (index.h(index.Host, null, index.h("form", { ref: el => (this.form = el), onSubmit: this.doSubmit.bind(this) }, index.h("fieldset", { ref: el => (this.fieldset = el) }), index.h("input", { type: "submit", ref: el => (this.submitButton = el), style: { display: 'none' } }))));
@@ -4,25 +4,27 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-4cfa8e25.js');
6
6
 
7
- const tttxKeyvalueBlockCss = ":host{display:block}dl{margin:0;padding:0;font-family:\"Roboto\", sans-serif;cursor:default}dt{font-weight:400;line-height:21px;font-size:16px}dt,dt.subTitle{color:#757575}dt.mainTitle{color:#212121}dt,dd{overflow-wrap:anywhere}dd{margin:0;font-weight:400;font-size:16px;color:#212121;line-height:21px;margin-bottom:18px}dl.horizontal{display:flex;flex-direction:row;width:100%}dl.horizontal div{flex-grow:1}@media (max-width: 769px){dl.horizontal{flex-wrap:wrap}dl.horizontal div{width:50%;max-width:50% !important}}@media (max-width: 600px){dl.horizontal div{width:100%;max-width:100% !important}}";
7
+ const tttxKeyvalueBlockCss = ":host{display:block}dl{margin:0;padding:0;font-family:\"Roboto\", sans-serif;cursor:default}dt{font-weight:400;font-size:16px;margin-bottom:4px}dt,dt.subTitle{color:#757575}dt.mainTitle{color:#212121}dt,dd{overflow-wrap:anywhere}dd{margin:0;font-weight:400;font-size:16px;color:#212121}dd:not(:last-child){margin-bottom:16px}dl.spacedout,dl.horizontal{display:flex;flex-direction:row;width:100%}dl.spacedout{justify-content:space-between}dl.horizontal div{flex-grow:1}@media (max-width: 769px){dl.horizontal{flex-wrap:wrap}dl.horizontal div{width:50%;max-width:50% !important}}@media (max-width: 600px){dl.horizontal div{width:100%;max-width:100% !important}}";
8
8
 
9
9
  const TttxKeyvalueBlock = class {
10
10
  constructor(hostRef) {
11
11
  index.registerInstance(this, hostRef);
12
12
  this.keyvalues = undefined;
13
13
  this.horizontal = undefined;
14
+ this.spacedout = undefined;
15
+ this._elements = undefined;
14
16
  }
15
17
  renderSingleElements(values) {
16
18
  const keys = Object.keys(values);
17
19
  const elements = [];
18
20
  const divSize = (100 / keys.length).toString() + '%';
19
- for (let i = 0; i < keys.length; i++) {
20
- if (this.horizontal) {
21
- elements.push(index.h("div", { style: { maxWidth: divSize } }, index.h("dt", null, keys[i]), index.h("dd", null, values[keys[i]])));
21
+ for (const element of keys) {
22
+ if (this.horizontal || this.spacedout) {
23
+ elements.push(index.h("div", { style: { maxWidth: divSize } }, index.h("dt", null, element), index.h("dd", null, values[element])));
22
24
  }
23
25
  else {
24
- elements.push(index.h("dt", null, keys[i]));
25
- elements.push(index.h("dd", null, values[keys[i]]));
26
+ elements.push(index.h("dt", null, element));
27
+ elements.push(index.h("dd", null, values[element]));
26
28
  }
27
29
  }
28
30
  return elements;
@@ -30,9 +32,9 @@ const TttxKeyvalueBlock = class {
30
32
  renderArrayElements(values) {
31
33
  const elements = [];
32
34
  const divSize = (100 / values.length).toString() + '%';
33
- for (let i = 0; i < values.length; i++) {
34
- const value = values[i];
35
- if (this.horizontal) {
35
+ for (const element of values) {
36
+ const value = element;
37
+ if (this.horizontal || this.spacedout) {
36
38
  elements.push(index.h("div", { style: { maxWidth: divSize } }, index.h("dt", { class: 'mainTitle' }, value.title), index.h("dt", { class: 'subTitle' }, value.subTitle), index.h("dd", null, value.data)));
37
39
  }
38
40
  else {
@@ -43,7 +45,7 @@ const TttxKeyvalueBlock = class {
43
45
  }
44
46
  return elements;
45
47
  }
46
- render() {
48
+ componentWillRender() {
47
49
  if (!this.keyvalues) {
48
50
  return;
49
51
  }
@@ -54,14 +56,15 @@ const TttxKeyvalueBlock = class {
54
56
  else {
55
57
  values = this.keyvalues;
56
58
  }
57
- let elements;
58
59
  if (Array.isArray(values)) {
59
- elements = this.renderArrayElements(values);
60
+ this._elements = this.renderArrayElements(values);
60
61
  }
61
62
  else {
62
- elements = this.renderSingleElements(values);
63
+ this._elements = this.renderSingleElements(values);
63
64
  }
64
- return (index.h(index.Host, null, index.h("dl", { class: this.horizontal ? 'horizontal' : null }, elements)));
65
+ }
66
+ render() {
67
+ return (index.h(index.Host, null, index.h("dl", { class: [this.horizontal ? 'horizontal' : undefined, this.spacedout ? ' spacedout' : undefined].join(' ').trim() }, this._elements)));
65
68
  }
66
69
  };
67
70
  TttxKeyvalueBlock.style = tttxKeyvalueBlockCss;
@@ -6,7 +6,7 @@ const index = require('./index-4cfa8e25.js');
6
6
  const domsanitiser_options = require('./domsanitiser.options-1dfa7205.js');
7
7
  require('./_commonjsHelpers-537d719a.js');
8
8
 
9
- const tttxListCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}:host{display:flex;flex-direction:column}.list{margin:0;padding:0}li{display:flex;align-items:flex-start}li.item{list-style:none;margin:0;padding:8px;border-bottom:1px solid #d5d5d5;min-height:36px}li.item:first-of-type{border-top:1px solid #d5d5d5}li.item.clickable:hover{cursor:pointer}li.item.toggleable:hover{cursor:pointer}li.item.active{background-color:rgba(17, 17, 17, 0.1)}li.item.active:hover{background-color:rgba(17, 17, 17, 0.15)}li.item.selected{background-color:#ebfbfc}li.item.selected:hover{background-color:#e0f8f9}li.item.selected.active{background-color:#ccf3f6}li.item.selected.active:hover{background-color:#bff0f3}li.item .icons{display:flex;justify-content:flex-end;flex-grow:1;align-items:center;height:36px}li.item .icons tttx-icon:hover{cursor:pointer}li.item .icons *{display:flex}li:hover{background-color:rgba(17, 17, 17, 0.05)}.align-right{margin-left:auto}.item-content{display:flex;align-items:center;flex-grow:2;min-height:36px}.checkbox{padding:6px;margin-left:-8px}";
9
+ const tttxListCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}:host{display:flex;flex-direction:column}.list{margin:0;padding:0}li{display:flex;align-items:flex-start}li.item{list-style:none;margin:0;padding:8px;border-bottom:1px solid #d5d5d5;min-height:36px}li.item:first-of-type{border-top:1px solid #d5d5d5}li.item.clickable:hover{cursor:pointer}li.item.toggleable:hover{cursor:pointer}li.item.active{background-color:rgba(17, 17, 17, 0.1)}li.item.active:hover{background-color:rgba(17, 17, 17, 0.15)}li.item.selected{background-color:#ebfbfc}li.item.selected:hover{background-color:#e0f8f9}li.item.selected.active{background-color:#ccf3f6}li.item.selected.active:hover{background-color:#bff0f3}li.item .icons{display:flex;justify-content:flex-end;flex-grow:1;align-items:center;height:36px}li.item .icons tttx-icon:hover{cursor:pointer}li.item .icons *{display:flex}li.item:hover{background-color:rgba(17, 17, 17, 0.05)}.align-right{margin-left:auto}.item-content{display:flex;align-items:center;flex-grow:2;min-height:36px}.checkbox{padding:6px;margin-left:-8px}";
10
10
 
11
11
  const TttxList = class {
12
12
  constructor(hostRef) {
@@ -0,0 +1,130 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-4cfa8e25.js');
6
+ const domsanitiser_options = require('./domsanitiser.options-1dfa7205.js');
7
+ require('./_commonjsHelpers-537d719a.js');
8
+
9
+ const tttxMultiselectBoxCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}:host{display:flex;gap:4px}.label{font-size:16px;font-style:normal;font-weight:500;line-height:normal}:host(.inline) .label{padding-top:8px}:host(.block){flex-direction:column}.dropdown-container{display:grid;position:relative;display:flex;flex-direction:column;width:100%}.dropdown-container:focus-visible{outline:none}.dropdown-container:focus .dropdown-selector{border:1px solid #1479c6}.dropdown-selector,.dropdown-body{display:flex;border-radius:4px;background-color:white}.dropdown-selector{grid-row:1;align-items:center;gap:8px;padding:6px 8px 6px 16px;cursor:pointer;border:1px solid #d5d5d5}.dropdown-selector-chevron{margin-left:auto;height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-selector-html-content{display:flex;gap:8px;flex-wrap:wrap}.dropdown-body-container{grid-row:2;position:relative}.dropdown-body{position:absolute;display:flex;position:absolute;flex-direction:column;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5;width:100%}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;scrollbar-gutter:stable;max-height:288px}.dropdown-option{padding:6px 8px 6px 16px;cursor:pointer;display:flex;gap:8px}.dropdown-option .checkbox-icon{height:24px}.dropdown-option .plaintext-option{line-height:24px}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#9e9e9e}.searchbox{padding:8px 16px 8px 16px;height:52px;box-sizing:border-box}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}.footer{display:flex;gap:8px;flex-direction:row-reverse;padding:8px 16px 0 16px;border-top:1px solid #d5d5d5}";
10
+
11
+ const TttxMultiselectBox = class {
12
+ constructor(hostRef) {
13
+ index.registerInstance(this, hostRef);
14
+ this.selectItemEvent = index.createEvent(this, "selectItemEvent", 7);
15
+ this.toggleOpen = index.createEvent(this, "toggleOpen", 7);
16
+ this.changesApplied = index.createEvent(this, "changesApplied", 7);
17
+ this.bodyOffset = {};
18
+ this.optionsData = null;
19
+ this.label = undefined;
20
+ this.inline = undefined;
21
+ this.placeholder = '';
22
+ this.searchEnabled = undefined;
23
+ this.htmlVisibleValue = undefined;
24
+ this.visibleValue = undefined;
25
+ this.open = false;
26
+ this.unsavedSelectedItems = undefined;
27
+ this.searchTerm = '';
28
+ }
29
+ handleCloseSelectBox() {
30
+ this.open = false;
31
+ }
32
+ handleBlur() {
33
+ this.open = false;
34
+ this.toggleOpen.emit(false);
35
+ }
36
+ /**
37
+ * We want to generally clone instances of optionsData, _optionsData and unsavedSelectedItems
38
+ * This is because they may be assigned from each other, but have different purposes
39
+ * If we don't clone them, changing one may propagate to the others
40
+ * JSON.parse/stringify will deep clone them, so the references of the array elements will also change
41
+ */
42
+ safelyCloneArray(arr) {
43
+ return JSON.parse(JSON.stringify(arr));
44
+ }
45
+ onDropdownClicked() {
46
+ this.open = !this.open;
47
+ this.searchTerm = '';
48
+ this.calculateDropdownMenuOffset();
49
+ this.toggleOpen.emit(this.open);
50
+ }
51
+ onCancel() {
52
+ this.open = false;
53
+ this.unsavedSelectedItems = this.safelyCloneArray(this._optionsData);
54
+ this.toggleOpen.emit(false);
55
+ }
56
+ applyChanges() {
57
+ this.open = false;
58
+ this.changesApplied.emit(this.safelyCloneArray(this.unsavedSelectedItems));
59
+ }
60
+ onItemSelected(option) {
61
+ const optionIndex = this.unsavedSelectedItems.findIndex((item) => item.value === option.value);
62
+ this.unsavedSelectedItems[optionIndex] = Object.assign(Object.assign({}, option), { selected: !option.selected });
63
+ this.unsavedSelectedItems = [...this.unsavedSelectedItems];
64
+ this.selectItemEvent.emit(option);
65
+ }
66
+ dropdownSelectorContent() {
67
+ if (!this._optionsData.find((item) => item.selected))
68
+ return index.h("div", { class: "placeholder" }, this.placeholder);
69
+ if (this.htmlVisibleValue) {
70
+ const sanitisedHTML = domsanitiser_options.purify.sanitize(this.visibleValue, domsanitiser_options.domSanitiserOptions);
71
+ return index.h("div", { class: "dropdown-selector-html-content", innerHTML: sanitisedHTML });
72
+ }
73
+ return index.h("div", null, this.visibleValue);
74
+ }
75
+ dropdownOption(option) {
76
+ // This is tested in e2e tests
77
+ /* istanbul ignore next */
78
+ const hideOption = this.searchEnabled && option.label.toLowerCase().indexOf(this.searchTerm.toLowerCase()) === -1;
79
+ const checkboxIcon = option.selected ? 'check_box' : 'check_box_outline_blank';
80
+ const checkboxColor = option.selected ? 'blue' : 'grey';
81
+ if (option.html) {
82
+ const sanitisedHTML = domsanitiser_options.purify.sanitize(option.html, domsanitiser_options.domSanitiserOptions);
83
+ // This is tested in e2e tests
84
+ /* istanbul ignore next */
85
+ return (index.h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${option.selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, index.h("tttx-icon", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), index.h("div", { innerHTML: sanitisedHTML })));
86
+ }
87
+ // This is tested in e2e tests
88
+ /* istanbul ignore next */
89
+ return (index.h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${option.selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, index.h("tttx-icon", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), index.h("div", { class: "plaintext-option" }, option.label)));
90
+ }
91
+ // This is tested in e2e tests
92
+ /* istanbul ignore next */
93
+ handleSearchInput(event) {
94
+ const target = event.target;
95
+ this.searchTerm = target.value;
96
+ }
97
+ calculateDropdownMenuOffset() {
98
+ const dropdownSelector = this.el.shadowRoot.querySelector('.dropdown-selector');
99
+ const bottomPosY = dropdownSelector.getBoundingClientRect().bottom;
100
+ // (Max list height OR 36px * number of items) + 52px for search bar + 45px for footer + 8px padding at bottom
101
+ let dropdownMenuMaxHeight = Math.min((288), 36 * this._optionsData.length) + 45 + 8;
102
+ if (this.searchEnabled)
103
+ dropdownMenuMaxHeight += 52;
104
+ if (bottomPosY + dropdownMenuMaxHeight > window.innerHeight) {
105
+ this.bodyOffset = { bottom: '16px', position: 'fixed', width: `${dropdownSelector.offsetWidth}px` };
106
+ }
107
+ else {
108
+ this.bodyOffset = {};
109
+ }
110
+ }
111
+ render() {
112
+ if (!this.optionsData)
113
+ return;
114
+ this._optionsData = typeof this.optionsData === 'string' ? JSON.parse(this.optionsData) : this.optionsData;
115
+ // initialise, if not already. After initialisation, this will be managed by internal state
116
+ // Check is performed in render in case initial render did not include optionsData
117
+ if (!this.unsavedSelectedItems)
118
+ this.unsavedSelectedItems = this.safelyCloneArray(this._optionsData);
119
+ const chevronIcon = this.open ? 'expand_less' : 'expand_more';
120
+ return (index.h(index.Host, { class: this.inline ? 'inline' : 'block' }, this.label && index.h("div", { class: "label" }, this.label), index.h("div", { tabindex: "0", class: "dropdown-container" }, index.h("div", { class: "dropdown-selector", onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent(), index.h("div", { class: "dropdown-selector-chevron" }, index.h("tttx-icon", { icon: chevronIcon, color: "black" }))), this.open && (index.h("div", { class: "dropdown-body-container" }, index.h("div", { class: "dropdown-body", style: Object.assign({}, this.bodyOffset) }, this.searchEnabled &&
121
+ /* istanbul ignore next */
122
+ index.h("div", { class: "searchbox" }, index.h("tttx-standalone-input", { type: "text", label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this), inline: true })), index.h("div", { class: "dropdown-options-list" }, this.unsavedSelectedItems.map((option) => {
123
+ return this.dropdownOption(option);
124
+ })), index.h("div", { class: 'footer' }, index.h("tttx-button", { design: "primary", onClick: this.applyChanges.bind(this) }, "Apply"), index.h("tttx-button", { onClick: this.onCancel.bind(this) }, "Cancel"))))))));
125
+ }
126
+ get el() { return index.getElement(this); }
127
+ };
128
+ TttxMultiselectBox.style = tttxMultiselectBoxCss;
129
+
130
+ exports.tttx_multiselect_box = TttxMultiselectBox;