@3t-transform/threeteeui 1.2.0 → 1.4.0

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 (211) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/{tttx-button_1_2_0.cjs.entry.js → tttx-button_1_4_0.cjs.entry.js} +2 -2
  3. package/dist/cjs/{tttx-checkbox-group-caption_1_2_0.cjs.entry.js → tttx-checkbox-group-caption_1_4_0.cjs.entry.js} +1 -1
  4. package/dist/cjs/{tttx-checkbox-group-heading_1_2_0.cjs.entry.js → tttx-checkbox-group-heading_1_4_0.cjs.entry.js} +1 -1
  5. package/dist/cjs/{tttx-checkbox-group_1_2_0.cjs.entry.js → tttx-checkbox-group_1_4_0.cjs.entry.js} +1 -1
  6. package/dist/cjs/{tttx-checkbox_1_2_0.cjs.entry.js → tttx-checkbox_1_4_0.cjs.entry.js} +2 -2
  7. package/dist/cjs/{tttx-data-pattern_1_2_0.cjs.entry.js → tttx-data-pattern_1_4_0.cjs.entry.js} +2 -2
  8. package/dist/cjs/{tttx-dialog-box_1_2_0.cjs.entry.js → tttx-dialog-box_1_4_0.cjs.entry.js} +3 -3
  9. package/dist/cjs/{tttx-dialog_1_2_0.cjs.entry.js → tttx-dialog_1_4_0.cjs.entry.js} +2 -2
  10. package/dist/cjs/{tttx-expander_1_2_0.cjs.entry.js → tttx-expander_1_4_0.cjs.entry.js} +2 -2
  11. package/dist/cjs/{tttx-filter_1_2_0_4.cjs.entry.js → tttx-filter_1_4_0_4.cjs.entry.js} +17 -10
  12. package/dist/cjs/{tttx-form_1_2_0.cjs.entry.js → tttx-form_1_4_0.cjs.entry.js} +229 -134
  13. package/dist/cjs/{tttx-icon_1_2_0.cjs.entry.js → tttx-icon_1_4_0.cjs.entry.js} +1 -1
  14. package/dist/cjs/{tttx-keyvalue-block_1_2_0.cjs.entry.js → tttx-keyvalue-block_1_4_0.cjs.entry.js} +1 -1
  15. package/dist/cjs/{tttx-loading-spinner_1_2_0.cjs.entry.js → tttx-loading-spinner_1_4_0.cjs.entry.js} +1 -1
  16. package/dist/cjs/{tttx-multiselect-box_1_2_0.cjs.entry.js → tttx-multiselect-box_1_4_0.cjs.entry.js} +6 -6
  17. package/dist/cjs/{tttx-percentage-bar_1_2_0.cjs.entry.js → tttx-percentage-bar_1_4_0.cjs.entry.js} +2 -2
  18. package/dist/cjs/{tttx-qrcode_1_2_0.cjs.entry.js → tttx-qrcode_1_4_0.cjs.entry.js} +1 -1
  19. package/dist/cjs/{tttx-select-box_1_2_0.cjs.entry.js → tttx-select-box_1_4_0.cjs.entry.js} +3 -3
  20. package/dist/cjs/tttx-standalone-input_1_4_0.cjs.entry.js +94 -0
  21. package/dist/cjs/{tttx-tabs_1_2_0.cjs.entry.js → tttx-tabs_1_4_0.cjs.entry.js} +4 -4
  22. package/dist/cjs/{tttx-tag_1_2_0.cjs.entry.js → tttx-tag_1_4_0.cjs.entry.js} +1 -1
  23. package/dist/cjs/{tttx-textarea_1_2_0.cjs.entry.js → tttx-textarea_1_4_0.cjs.entry.js} +2 -2
  24. package/dist/cjs/{tttx-tree-view_1_2_0.cjs.entry.js → tttx-tree-view_1_4_0.cjs.entry.js} +3 -3
  25. package/dist/cjs/tttx.cjs.js +1 -1
  26. package/dist/collection/collection-manifest.json +1 -1
  27. package/dist/collection/components/atoms/tttx-button/tttx-button.js +2 -2
  28. package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +20 -20
  29. package/dist/collection/components/atoms/tttx-checkbox/tttx-checkbox.js +2 -2
  30. package/dist/collection/components/atoms/tttx-checkbox/tttx-checkbox.stories.js +1 -1
  31. package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +1 -1
  32. package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +1 -1
  33. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +1 -1
  34. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +6 -6
  35. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +1 -1
  36. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +1 -1
  37. package/dist/collection/components/atoms/tttx-percentage-bar/tttx-percentage-bar.js +1 -1
  38. package/dist/collection/components/atoms/tttx-percentage-bar/tttx-percentage-bar.stories.js +5 -5
  39. package/dist/collection/components/atoms/tttx-qrcode/tttx-qrcode.js +1 -1
  40. package/dist/collection/components/atoms/tttx-qrcode/tttx-qrcode.stories.js +1 -1
  41. package/dist/collection/components/atoms/tttx-tag/tttx-tag.js +1 -1
  42. package/dist/collection/components/atoms/tttx-tag/tttx-tag.stories.js +6 -6
  43. package/dist/collection/components/molecules/tttx-checkbox-group/components/tttx-checkbox-group-caption.js +1 -1
  44. package/dist/collection/components/molecules/tttx-checkbox-group/components/tttx-checkbox-group-heading.js +1 -1
  45. package/dist/collection/components/molecules/tttx-checkbox-group/tttx-checkbox-group.js +1 -1
  46. package/dist/collection/components/molecules/tttx-checkbox-group/tttx-checkbox-group.stories.js +10 -10
  47. package/dist/collection/components/molecules/tttx-dialog/tttx-dialog.js +2 -2
  48. package/dist/collection/components/molecules/tttx-dialog/tttx-dialog.stories.js +6 -6
  49. package/dist/collection/components/molecules/tttx-dialog-box/tttx-dialog-box.js +3 -3
  50. package/dist/collection/components/molecules/tttx-dialog-box/tttx-dialog-box.stories.js +24 -24
  51. package/dist/collection/components/molecules/tttx-expander/tttx-expander.js +2 -2
  52. package/dist/collection/components/molecules/tttx-expander/tttx-expander.stories.js +9 -9
  53. package/dist/collection/components/molecules/tttx-filter/tttx-filter.js +3 -3
  54. package/dist/collection/components/molecules/tttx-filter/tttx-filter.stories.js +2 -2
  55. package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +0 -1
  56. package/dist/collection/components/molecules/tttx-form/lib/timecomparatorChecks.js +64 -0
  57. package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +9 -8
  58. package/dist/collection/components/molecules/tttx-form/tttx-form.js +304 -129
  59. package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +5 -5
  60. package/dist/collection/components/molecules/tttx-list/tttx-list.js +11 -4
  61. package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +46 -46
  62. package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.js +6 -6
  63. package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.stories.js +33 -33
  64. package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.js +3 -3
  65. package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.stories.js +16 -16
  66. package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.js +2 -2
  67. package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.stories.js +1 -1
  68. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +4 -4
  69. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +1 -1
  70. package/dist/collection/components/molecules/tttx-tabs/tttx-tabs.js +3 -3
  71. package/dist/collection/components/molecules/tttx-tabs/tttx-tabs.stories.js +4 -4
  72. package/dist/collection/components/molecules/tttx-textarea/tttx-textarea.js +3 -3
  73. package/dist/collection/components/molecules/tttx-textarea/tttx-textarea.stories.js +1 -1
  74. package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.js +1 -1
  75. package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.stories.js +37 -37
  76. package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.js +3 -3
  77. package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.stories.js +8 -8
  78. package/dist/collection/components/organisms/tttx-data-pattern/tttx-data-pattern.js +2 -2
  79. package/dist/collection/components/organisms/tttx-data-pattern/tttx-data-pattern.stories.js +5 -5
  80. package/dist/components/index.d.ts +26 -26
  81. package/dist/components/index.js +26 -26
  82. package/dist/components/tttx-button.js +5 -5
  83. package/dist/components/{tttx-button_1_2_0.d.ts → tttx-button_1_4_0.d.ts} +4 -4
  84. package/dist/components/{tttx-button_1_2_0.js → tttx-button_1_4_0.js} +2 -2
  85. package/dist/components/tttx-checkbox-group-caption_1_4_0.d.ts +11 -0
  86. package/dist/components/{tttx-checkbox-group-caption_1_2_0.js → tttx-checkbox-group-caption_1_4_0.js} +5 -5
  87. package/dist/components/tttx-checkbox-group-heading_1_4_0.d.ts +11 -0
  88. package/dist/components/{tttx-checkbox-group-heading_1_2_0.js → tttx-checkbox-group-heading_1_4_0.js} +5 -5
  89. package/dist/components/tttx-checkbox-group_1_4_0.d.ts +11 -0
  90. package/dist/components/{tttx-checkbox-group_1_2_0.js → tttx-checkbox-group_1_4_0.js} +5 -5
  91. package/dist/components/{tttx-textarea_1_2_0.d.ts → tttx-checkbox_1_4_0.d.ts} +4 -4
  92. package/dist/components/{tttx-checkbox_1_2_0.js → tttx-checkbox_1_4_0.js} +7 -7
  93. package/dist/components/tttx-data-pattern_1_4_0.d.ts +11 -0
  94. package/dist/components/{tttx-data-pattern_1_2_0.js → tttx-data-pattern_1_4_0.js} +13 -13
  95. package/dist/components/{tttx-dialog-box_1_2_0.d.ts → tttx-dialog-box_1_4_0.d.ts} +4 -4
  96. package/dist/components/{tttx-dialog-box_1_2_0.js → tttx-dialog-box_1_4_0.js} +9 -9
  97. package/dist/components/{tttx-filter_1_2_0.d.ts → tttx-dialog_1_4_0.d.ts} +4 -4
  98. package/dist/components/{tttx-dialog_1_2_0.js → tttx-dialog_1_4_0.js} +8 -8
  99. package/dist/components/{tttx-expander_1_2_0.d.ts → tttx-expander_1_4_0.d.ts} +4 -4
  100. package/dist/components/{tttx-expander_1_2_0.js → tttx-expander_1_4_0.js} +7 -7
  101. package/dist/components/tttx-filter.js +6 -6
  102. package/dist/components/{tttx-qrcode_1_2_0.d.ts → tttx-filter_1_4_0.d.ts} +4 -4
  103. package/dist/components/{tttx-filter_1_2_0.js → tttx-filter_1_4_0.js} +2 -2
  104. package/dist/components/{tttx-icon_1_2_0.d.ts → tttx-form_1_4_0.d.ts} +4 -4
  105. package/dist/components/{tttx-form_1_2_0.js → tttx-form_1_4_0.js} +241 -142
  106. package/dist/components/tttx-icon.js +3 -3
  107. package/dist/components/{tttx-list_1_2_0.d.ts → tttx-icon_1_4_0.d.ts} +4 -4
  108. package/dist/components/{tttx-icon_1_2_0.js → tttx-icon_1_4_0.js} +2 -2
  109. package/dist/components/tttx-keyvalue-block_1_4_0.d.ts +11 -0
  110. package/dist/components/{tttx-keyvalue-block_1_2_0.js → tttx-keyvalue-block_1_4_0.js} +5 -5
  111. package/dist/components/tttx-list.js +14 -7
  112. package/dist/components/{tttx-form_1_2_0.d.ts → tttx-list_1_4_0.d.ts} +4 -4
  113. package/dist/components/{tttx-list_1_2_0.js → tttx-list_1_4_0.js} +2 -2
  114. package/dist/components/tttx-loading-spinner_1_4_0.d.ts +11 -0
  115. package/dist/components/{tttx-loading-spinner_1_2_0.js → tttx-loading-spinner_1_4_0.js} +5 -5
  116. package/dist/components/tttx-multiselect-box_1_4_0.d.ts +11 -0
  117. package/dist/components/{tttx-multiselect-box_1_2_0.js → tttx-multiselect-box_1_4_0.js} +13 -13
  118. package/dist/components/tttx-percentage-bar_1_4_0.d.ts +11 -0
  119. package/dist/components/{tttx-percentage-bar_1_2_0.js → tttx-percentage-bar_1_4_0.js} +6 -6
  120. package/dist/components/{tttx-dialog_1_2_0.d.ts → tttx-qrcode_1_4_0.d.ts} +4 -4
  121. package/dist/components/{tttx-qrcode_1_2_0.js → tttx-qrcode_1_4_0.js} +5 -5
  122. package/dist/components/tttx-select-box.js +7 -7
  123. package/dist/components/tttx-select-box_1_4_0.d.ts +11 -0
  124. package/dist/components/{tttx-select-box_1_2_0.js → tttx-select-box_1_4_0.js} +2 -2
  125. package/dist/components/tttx-sorter.js +5 -5
  126. package/dist/components/tttx-sorter_1_4_0.d.ts +11 -0
  127. package/dist/components/{tttx-sorter_1_2_0.js → tttx-sorter_1_4_0.js} +2 -2
  128. package/dist/components/tttx-standalone-input.js +6 -6
  129. package/dist/components/tttx-standalone-input_1_4_0.d.ts +11 -0
  130. package/dist/components/{tttx-standalone-input_1_2_0.js → tttx-standalone-input_1_4_0.js} +2 -2
  131. package/dist/components/{tttx-tabs_1_2_0.d.ts → tttx-tabs_1_4_0.d.ts} +4 -4
  132. package/dist/components/{tttx-tabs_1_2_0.js → tttx-tabs_1_4_0.js} +9 -9
  133. package/dist/components/{tttx-tag_1_2_0.d.ts → tttx-tag_1_4_0.d.ts} +4 -4
  134. package/dist/components/{tttx-tag_1_2_0.js → tttx-tag_1_4_0.js} +5 -5
  135. package/dist/components/{tttx-checkbox_1_2_0.d.ts → tttx-textarea_1_4_0.d.ts} +4 -4
  136. package/dist/components/{tttx-textarea_1_2_0.js → tttx-textarea_1_4_0.js} +6 -6
  137. package/dist/components/tttx-toolbar.js +3 -3
  138. package/dist/components/{tttx-toolbar_1_2_0.d.ts → tttx-toolbar_1_4_0.d.ts} +4 -4
  139. package/dist/components/{tttx-toolbar_1_2_0.js → tttx-toolbar_1_4_0.js} +2 -2
  140. package/dist/components/{tttx-tree-view_1_2_0.d.ts → tttx-tree-view_1_4_0.d.ts} +4 -4
  141. package/dist/components/{tttx-tree-view_1_2_0.js → tttx-tree-view_1_4_0.js} +9 -9
  142. package/dist/esm/loader.js +1 -1
  143. package/dist/esm/{tttx-button_1_2_0.entry.js → tttx-button_1_4_0.entry.js} +2 -2
  144. package/dist/esm/{tttx-checkbox-group-caption_1_2_0.entry.js → tttx-checkbox-group-caption_1_4_0.entry.js} +1 -1
  145. package/dist/esm/{tttx-checkbox-group-heading_1_2_0.entry.js → tttx-checkbox-group-heading_1_4_0.entry.js} +1 -1
  146. package/dist/esm/{tttx-checkbox-group_1_2_0.entry.js → tttx-checkbox-group_1_4_0.entry.js} +1 -1
  147. package/dist/esm/{tttx-checkbox_1_2_0.entry.js → tttx-checkbox_1_4_0.entry.js} +2 -2
  148. package/dist/esm/{tttx-data-pattern_1_2_0.entry.js → tttx-data-pattern_1_4_0.entry.js} +2 -2
  149. package/dist/esm/{tttx-dialog-box_1_2_0.entry.js → tttx-dialog-box_1_4_0.entry.js} +3 -3
  150. package/dist/esm/{tttx-dialog_1_2_0.entry.js → tttx-dialog_1_4_0.entry.js} +2 -2
  151. package/dist/esm/{tttx-expander_1_2_0.entry.js → tttx-expander_1_4_0.entry.js} +2 -2
  152. package/dist/esm/{tttx-filter_1_2_0_4.entry.js → tttx-filter_1_4_0_4.entry.js} +14 -7
  153. package/dist/esm/{tttx-form_1_2_0.entry.js → tttx-form_1_4_0.entry.js} +229 -134
  154. package/dist/esm/{tttx-icon_1_2_0.entry.js → tttx-icon_1_4_0.entry.js} +1 -1
  155. package/dist/esm/{tttx-keyvalue-block_1_2_0.entry.js → tttx-keyvalue-block_1_4_0.entry.js} +1 -1
  156. package/dist/esm/{tttx-loading-spinner_1_2_0.entry.js → tttx-loading-spinner_1_4_0.entry.js} +1 -1
  157. package/dist/esm/{tttx-multiselect-box_1_2_0.entry.js → tttx-multiselect-box_1_4_0.entry.js} +6 -6
  158. package/dist/esm/{tttx-percentage-bar_1_2_0.entry.js → tttx-percentage-bar_1_4_0.entry.js} +2 -2
  159. package/dist/esm/{tttx-qrcode_1_2_0.entry.js → tttx-qrcode_1_4_0.entry.js} +1 -1
  160. package/dist/esm/{tttx-select-box_1_2_0.entry.js → tttx-select-box_1_4_0.entry.js} +3 -3
  161. package/dist/esm/tttx-standalone-input_1_4_0.entry.js +90 -0
  162. package/dist/esm/{tttx-tabs_1_2_0.entry.js → tttx-tabs_1_4_0.entry.js} +4 -4
  163. package/dist/esm/{tttx-tag_1_2_0.entry.js → tttx-tag_1_4_0.entry.js} +1 -1
  164. package/dist/esm/{tttx-textarea_1_2_0.entry.js → tttx-textarea_1_4_0.entry.js} +2 -2
  165. package/dist/esm/{tttx-tree-view_1_2_0.entry.js → tttx-tree-view_1_4_0.entry.js} +3 -3
  166. package/dist/esm/tttx.js +1 -1
  167. package/dist/tttx/p-0e515960.entry.js +1 -1
  168. package/dist/tttx/p-0f439f10.entry.js +1 -0
  169. package/dist/tttx/p-1e5ff5f8.entry.js +1 -1
  170. package/dist/tttx/p-23f45005.entry.js +1 -1
  171. package/dist/tttx/p-3676cddd.entry.js +1 -0
  172. package/dist/tttx/p-56c8c353.entry.js +1 -1
  173. package/dist/tttx/p-59c7b049.entry.js +1 -1
  174. package/dist/tttx/p-5d2706b1.entry.js +1 -1
  175. package/dist/tttx/p-63ad6fb7.entry.js +1 -1
  176. package/dist/tttx/p-6b1c7a21.entry.js +1 -1
  177. package/dist/tttx/p-6deb8699.entry.js +1 -1
  178. package/dist/tttx/p-796f699a.entry.js +1 -1
  179. package/dist/tttx/p-81aaafa0.entry.js +1 -1
  180. package/dist/tttx/p-884f37d3.entry.js +1 -1
  181. package/dist/tttx/p-9434561e.entry.js +1 -1
  182. package/dist/tttx/p-983d63ff.entry.js +1 -1
  183. package/dist/tttx/p-a01e679a.entry.js +1 -1
  184. package/dist/tttx/p-a8e76e78.entry.js +1 -1
  185. package/dist/tttx/p-c170e3b8.entry.js +1 -1
  186. package/dist/tttx/p-ee358ce4.entry.js +1 -1
  187. package/dist/tttx/p-f374e293.entry.js +1 -1
  188. package/dist/tttx/p-f4db1cf2.entry.js +1 -1
  189. package/dist/tttx/p-fe967031.entry.js +1 -1
  190. package/dist/tttx/tttx.esm.js +1 -1
  191. package/dist/types/components/molecules/tttx-form/lib/timecomparatorChecks.d.ts +4 -0
  192. package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +57 -14
  193. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +2 -2
  194. package/dist/types/components/molecules/tttx-textarea/tttx-textarea.d.ts +2 -2
  195. package/dist/types/components.d.ts +326 -304
  196. package/package.json +2 -1
  197. package/dist/cjs/tttx-standalone-input_1_2_0.cjs.entry.js +0 -94
  198. package/dist/components/tttx-checkbox-group-caption_1_2_0.d.ts +0 -11
  199. package/dist/components/tttx-checkbox-group-heading_1_2_0.d.ts +0 -11
  200. package/dist/components/tttx-checkbox-group_1_2_0.d.ts +0 -11
  201. package/dist/components/tttx-data-pattern_1_2_0.d.ts +0 -11
  202. package/dist/components/tttx-keyvalue-block_1_2_0.d.ts +0 -11
  203. package/dist/components/tttx-loading-spinner_1_2_0.d.ts +0 -11
  204. package/dist/components/tttx-multiselect-box_1_2_0.d.ts +0 -11
  205. package/dist/components/tttx-percentage-bar_1_2_0.d.ts +0 -11
  206. package/dist/components/tttx-select-box_1_2_0.d.ts +0 -11
  207. package/dist/components/tttx-sorter_1_2_0.d.ts +0 -11
  208. package/dist/components/tttx-standalone-input_1_2_0.d.ts +0 -11
  209. package/dist/esm/tttx-standalone-input_1_2_0.entry.js +0 -90
  210. package/dist/tttx/p-34be6c6d.entry.js +0 -1
  211. package/dist/tttx/p-c8589436.entry.js +0 -1
@@ -41,14 +41,15 @@ function validityCheck(event) {
41
41
  // and cleared with
42
42
  // target.setCustomValidity('');
43
43
  //handle whitespace-only input
44
- if (target.value.length && !target.value.replace(/\s/g, '').length) {
45
- errorMessage = 'This field cannot be left blank';
46
- target.setCustomValidity(errorMessage);
47
- }
48
- else {
49
- errorMessage = '';
50
- if (target.setCustomValidity) // tests are dumb as a brick
51
- target.setCustomValidity('');
44
+ if (!target.hasAttribute('custom-validation-set')) {
45
+ if (target.value.length && !target.value.replace(/\s/g, '').length) {
46
+ errorMessage = 'This field cannot be left blank';
47
+ target.setCustomValidity(errorMessage);
48
+ }
49
+ else {
50
+ if (target.setCustomValidity) // tests are dumb as a brick
51
+ target.setCustomValidity('');
52
+ }
52
53
  }
53
54
  // Check the validity of the input field and set an error message if needed
54
55
  switch (true) {
@@ -121,7 +122,6 @@ function setErrorState(target, hasError, errorMessage, parent = undefined) {
121
122
  errorBubble.innerHTML = '';
122
123
  errorBubble.append(errorIcon);
123
124
  errorBubble.append(errorMessage);
124
- // errorBubble.replaceChildren(errorIcon, errorMessage);
125
125
  }
126
126
  // If no error was detected, remove the "invalid" class from the input field and clear the error bubble
127
127
  else {
@@ -131,6 +131,70 @@ function setErrorState(target, hasError, errorMessage, parent = undefined) {
131
131
  }
132
132
  }
133
133
 
134
+ function startEndTimeComparator(event) {
135
+ var _a, _b;
136
+ const target = event.target;
137
+ const formKey = target.getAttribute('data-formkey');
138
+ const timeFields = Array.from(target.parentElement.parentElement.parentElement.querySelectorAll(`[data-formkey=${formKey}]`));
139
+ if (timeFields.length === 4) {
140
+ const startTime = timeFields.find(t => t.name.endsWith('starttime'));
141
+ const endTime = timeFields.find(t => t.name.endsWith('endtime'));
142
+ const startDate = timeFields.find(t => t.name.endsWith('startdate'));
143
+ const endDate = timeFields.find(t => t.name.endsWith('enddate'));
144
+ if (startTime.valueAsNumber >= endTime.valueAsNumber && ((_a = startDate.valueAsDate) === null || _a === void 0 ? void 0 : _a.valueOf()) === ((_b = endDate.valueAsDate) === null || _b === void 0 ? void 0 : _b.valueOf())) {
145
+ setErrorState(endTime, true, 'End time cannot be the same or before the start time');
146
+ if (target.name.endsWith('starttime')) {
147
+ this.validityCheckWrapper(event);
148
+ }
149
+ }
150
+ else {
151
+ // clear any end time comparitor errors and perform the standard validity check on the event
152
+ endTime.setCustomValidity('');
153
+ setErrorState(endTime, false, null);
154
+ this.validityCheckWrapper(event);
155
+ }
156
+ }
157
+ }
158
+ function clearTimeComparator(event) {
159
+ const target = event.target;
160
+ const formKey = target.getAttribute('data-formkey');
161
+ const timeFields = Array.from(target.parentElement.parentElement.parentElement.querySelectorAll(`[type=time][data-formkey=${formKey}]`));
162
+ if (timeFields.length) {
163
+ const endTime = timeFields.find(t => t.name.endsWith('endtime'));
164
+ endTime.setCustomValidity('');
165
+ setErrorState(endTime, false, null);
166
+ }
167
+ }
168
+ function endDateComparisonValidator(event, triggeredByStartDate = false) {
169
+ var _a, _b, _c, _d;
170
+ const endDate = event.target;
171
+ if (!endDate.value && triggeredByStartDate) {
172
+ return;
173
+ }
174
+ const compareWithName = endDate.getAttribute('data-compare-with');
175
+ const startDate = endDate.parentElement.parentElement.parentElement.querySelector(`[name=${compareWithName}]`);
176
+ if (((_a = endDate.valueAsDate) === null || _a === void 0 ? void 0 : _a.valueOf()) < ((_b = startDate.valueAsDate) === null || _b === void 0 ? void 0 : _b.valueOf())) {
177
+ endDate.setCustomValidity(endDate.getAttribute('data-compare'));
178
+ setErrorState(endDate, true, endDate.getAttribute('data-compare'));
179
+ }
180
+ else if (((_c = endDate.valueAsDate) === null || _c === void 0 ? void 0 : _c.valueOf()) === ((_d = startDate.valueAsDate) === null || _d === void 0 ? void 0 : _d.valueOf())) {
181
+ endDate.setCustomValidity('');
182
+ this.validityCheckWrapper(event);
183
+ startEndTimeComparator.bind(this)(event);
184
+ }
185
+ else {
186
+ clearTimeComparator.bind(this)(event);
187
+ this.validityCheckWrapper(event);
188
+ }
189
+ }
190
+ function startDateComparisonValidator(event) {
191
+ const startDate = event.target;
192
+ const compareToName = startDate.getAttribute('data-compare-to');
193
+ const endDate = startDate.parentElement.parentElement.parentElement.querySelector(`[name=${compareToName}]`);
194
+ endDateComparisonValidator.bind(this)({ target: endDate }, true);
195
+ this.validityCheckWrapper(event);
196
+ }
197
+
134
198
  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:18.752px;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,label .outer-container textarea{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,label .outer-container textarea.has-input-icon{padding-left:40px}label .outer-container input.has-input-icon.has-left-icon,label .outer-container textarea.has-input-icon.has-left-icon{padding-left:72px}label .outer-container input.has-left-icon,label .outer-container textarea.has-left-icon{padding-left:40px}label .outer-container input.has-right-icon,label .outer-container textarea.has-right-icon{padding-right:40px}label .outer-container input.invalid,label .outer-container textarea.invalid{border:1px solid #dc0000}label .outer-container input:not([type=submit]),label .outer-container textarea:not([type=submit]){font-family:\"Roboto\", serif;width:100%;height:36px;font-size:16px;line-height:18.752px}label .outer-container input[type=radio],label .outer-container textarea[type=radio]{width:20px;height:20px}label .outer-container input[type=date],label .outer-container textarea[type=date]{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}label .outer-container input[readonly],label .outer-container textarea[readonly]{cursor:default;pointer-events:none;user-select:none;color:gray}label .outer-container input:focus,label .outer-container textarea:focus{border-color:#1479c6}label .outer-container input:focus-visible,label .outer-container textarea:focus-visible{outline:none}label .outer-container textarea{padding:8px;height:auto;min-height:100px;resize:vertical}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:16.408px;font-weight:normal;display:flex;margin-top:4px}label .errorBubble{position:relative;font-size:14px;line-height:16.408px;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}label.flex-label{display:flex;flex-direction:column;width:346px;box-sizing:border-box}label>.outer-container>input[type=date]{min-width:0;width:200px}label.flex-label input[type=time]{min-width:auto;text-align:center;width:130px;margin-left:16px}label>.outer-container>input[type=date],label.flex-label input[type=time]{line-height:36px}";
135
199
 
136
200
  const TttxForm = class {
@@ -145,13 +209,6 @@ const TttxForm = class {
145
209
  }
146
210
  // This method is called whenever the "formschema" property changes
147
211
  onFormSchemaChange(newValue) {
148
- // If the formSchema changes and the form data is uncontrolled, store the data since the fields will be removed to avoid form duplication
149
- if (!this.data && this.form && this._formSchema) {
150
- const formData = new FormData(this.form);
151
- this._data = Object.fromEntries(Object.keys(this._formSchema.properties).map(formKey => {
152
- return [formKey, formData.get(formKey)];
153
- }));
154
- }
155
212
  // Check if the new value is a string, indicating that it needs to be parsed
156
213
  if (typeof newValue === 'string') {
157
214
  // Parse the string and set the "_formSchema" property
@@ -161,6 +218,7 @@ const TttxForm = class {
161
218
  // If the new value is already an object, set the "_formSchema" property directly
162
219
  this._formSchema = newValue;
163
220
  }
221
+ return this._formSchema;
164
222
  }
165
223
  onDataChange(newValue) {
166
224
  if (typeof newValue === 'string') {
@@ -169,6 +227,7 @@ const TttxForm = class {
169
227
  else {
170
228
  this._data = newValue;
171
229
  }
230
+ return this._data;
172
231
  }
173
232
  /**
174
233
  * Handles the focus event for a form field and emits a "dataChanged" event
@@ -208,7 +267,6 @@ const TttxForm = class {
208
267
  }
209
268
  select.replaceChildren(fragment);
210
269
  tttxSelect.optionsData = options;
211
- //await tttxSelect.setOptionsData(options);
212
270
  await tttxSelect.setSelectedItem(options[0].value);
213
271
  }
214
272
  /**
@@ -220,6 +278,10 @@ const TttxForm = class {
220
278
  doSubmit(event) {
221
279
  // prevent the form from submitting normally
222
280
  event.preventDefault();
281
+ const allElements = this.fieldset.querySelectorAll('[custom-validation-set=true]');
282
+ if (allElements.length) {
283
+ return;
284
+ }
223
285
  // create a new FormData object with the form data
224
286
  const formData = new FormData(event.target);
225
287
  // get a list of checkboxes, if any, so we can manually set unchecked box data
@@ -266,9 +328,10 @@ const TttxForm = class {
266
328
  formProperties.options.forEach(optionProperties => {
267
329
  this.appendOption(select, optionProperties);
268
330
  });
269
- if ((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey])
331
+ if ((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey]) {
270
332
  select.classList.remove('placeholder');
271
- const tttxSelect = document.createElement('tttx-select-box_1_2_0');
333
+ }
334
+ const tttxSelect = document.createElement('tttx-select-box_1_4_0');
272
335
  tttxSelect.optionsData = (_b = formProperties.options) === null || _b === void 0 ? void 0 : _b.filter(o => !o.placeholder);
273
336
  tttxSelect.placeholder = (_d = (_c = formProperties.options) === null || _c === void 0 ? void 0 : _c.filter(o => o.placeholder)[0]) === null || _d === void 0 ? void 0 : _d.label;
274
337
  tttxSelect.inline = false;
@@ -279,13 +342,18 @@ const TttxForm = class {
279
342
  const fragment = document.createDocumentFragment();
280
343
  fragment.append(tttxSelect);
281
344
  select.style.display = 'none';
282
- tttxSelect.addEventListener('selectItemEvent', function (ev) {
283
- select.value = ev.detail.value;
284
- select.onblur({ target: select }); // triggers validator
285
- select.onchange({ target: select }); // triggers dataChanged event
286
- });
345
+ tttxSelect.addEventListener('selectItemEvent', this.selectItemEventCallback.bind(select));
287
346
  return { input: select, overlay: fragment };
288
347
  }
348
+ selectItemEventCallback(ev) {
349
+ // this function MUST be bound to a HTMLSelectElement
350
+ // 'this' will be the select element
351
+ // the function was split out for testing
352
+ const select = this;
353
+ select.value = ev.detail.value;
354
+ select.onblur({ target: select }); // triggers validator
355
+ select.onchange({ target: select }); // triggers dataChanged event
356
+ }
289
357
  /**
290
358
  * Appends an option to a select element
291
359
  *
@@ -516,7 +584,7 @@ const TttxForm = class {
516
584
  * @param {HTMLDivElement} errorBubble - The error bubble element to display error messages in.
517
585
  * @return {HTMLLabelElement} - The new label element.
518
586
  */
519
- createLabel(formProperties, input, overlay, errorBubble) {
587
+ createLabel(formProperties, input, overlay = null, errorBubble) {
520
588
  var _a;
521
589
  const outerContainer = document.createElement('div');
522
590
  let outerContainerClassName = 'outer-container inputBlock';
@@ -567,7 +635,7 @@ const TttxForm = class {
567
635
  */
568
636
  createRadio(formKey, formProperties) {
569
637
  var _a, _b;
570
- const fragment = new DocumentFragment();
638
+ const fragment = document.createDocumentFragment();
571
639
  for (const optionProperties of formProperties.options) {
572
640
  // Create a new <input> element with the specified name and type
573
641
  const input = document.createElement('input');
@@ -597,8 +665,9 @@ const TttxForm = class {
597
665
  populateFormFromSchema() {
598
666
  var _a;
599
667
  // If there is no form schema, return early
600
- if (!this._formSchema)
668
+ if (!this._formSchema) {
601
669
  return;
670
+ }
602
671
  // Get the properties of the form schema and their keys
603
672
  const properties = this._formSchema.properties;
604
673
  const propertyKeys = Object.keys(properties);
@@ -666,128 +735,154 @@ const TttxForm = class {
666
735
  const properties = this._formSchema.properties;
667
736
  const propertyKeys = Object.keys(properties);
668
737
  for (const formKey of propertyKeys) {
669
- const formItemsByKey = formItems.querySelectorAll(`[name^=${formKey}]`);
670
- for (const formInput of formItemsByKey) {
671
- // Bind events to form input elements
672
- formInput.oninvalid = this.validityCheckWrapper.bind(this);
673
- formInput.onblur = this.validityCheckWrapper.bind(this);
674
- formInput.onkeyup = this.fieldChanged.bind(this);
675
- formInput.onchange = this.fieldChanged.bind(this);
676
- if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
677
- formInput.addEventListener('change', () => {
678
- formInput.classList.remove('placeholder');
679
- });
680
- }
681
- if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-with')) {
682
- formInput.oninvalid = this.endDateComparisonValidator.bind(this);
683
- formInput.onblur = this.endDateComparisonValidator.bind(this);
684
- }
685
- if (properties[formKey].form.type === 'startenddate' && formInput.type === 'time') {
686
- formInput.oninvalid = this.startEndTimeComparitor.bind(this);
687
- formInput.onblur = this.startEndTimeComparitor.bind(this);
688
- }
689
- if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-to')) {
690
- formInput.oninvalid = this.startDateComparisonValidator.bind(this);
691
- formInput.onblur = this.startDateComparisonValidator.bind(this);
692
- }
693
- }
738
+ this.applyValidationFunctionsToFormElement(formItems, formKey, properties);
694
739
  }
695
740
  // populate with existing form data if available
696
- if (this._data && Object.keys(this._data).length > 0) {
697
- const dataKeys = Object.keys(this._data);
698
- for (const key of dataKeys) {
699
- const formItemsByKey = formItems.querySelectorAll(`[name=${key}]`);
700
- for (const formItem of formItemsByKey) {
701
- switch (formItem.type) {
702
- case 'checkbox':
703
- if (this._data[key] === 'on') {
704
- formItem.checked = true;
705
- }
706
- break;
707
- case 'radio':
708
- if (formItem.value === this._data[key]) {
709
- formItem.checked = true;
710
- }
711
- break;
712
- case 'select':
713
- case 'select-one':
714
- formItems.querySelector(`[name=overlay-${key}]`).selectedValue = this._data[key];
715
- formItem.value = this._data[key];
716
- break;
717
- default:
718
- formItem.value = this._data[key];
719
- }
720
- }
721
- }
741
+ if ((this._data && Object.keys(this._data).length > 0)) {
742
+ this.populateFormWithExistingData(formItems);
722
743
  }
723
744
  // Append the cloned form elements to the fieldset
724
745
  this.fieldset.replaceChildren(formItems);
725
746
  }
726
- startEndTimeComparitor(event) {
727
- var _a, _b;
728
- const target = event.target;
729
- const formKey = target.getAttribute('data-formkey');
730
- const timeFields = Array.from(target.parentElement.parentElement.parentElement.querySelectorAll(`[data-formkey=${formKey}]`));
731
- if (timeFields.length === 4) {
732
- const startTime = timeFields.find(t => t.name.endsWith('starttime'));
733
- const endTime = timeFields.find(t => t.name.endsWith('endtime'));
734
- const startDate = timeFields.find(t => t.name.endsWith('startdate'));
735
- const endDate = timeFields.find(t => t.name.endsWith('enddate'));
736
- if (startTime.valueAsNumber >= endTime.valueAsNumber && ((_a = startDate.valueAsDate) === null || _a === void 0 ? void 0 : _a.valueOf()) === ((_b = endDate.valueAsDate) === null || _b === void 0 ? void 0 : _b.valueOf())) {
737
- setErrorState(endTime, true, 'End time cannot be the same or before the start time');
738
- if (target.name.endsWith('starttime')) {
739
- this.validityCheckWrapper(event);
740
- }
747
+ /**
748
+ * Assign validation events to a given form item
749
+ * @param formItems The document fragment template of form items to be rendered
750
+ * @param formKey The key of the form item to bind events too
751
+ * @param properties The form item's properties, such as type and name
752
+ */
753
+ applyValidationFunctionsToFormElement(formItems, formKey, properties) {
754
+ const formItemsByKey = formItems.querySelectorAll(`[name^=${formKey}]`);
755
+ for (const formInput of formItemsByKey) {
756
+ // Bind events to form input elements
757
+ formInput.oninvalid = this.validityCheckWrapper.bind(this);
758
+ formInput.onblur = this.validityCheckWrapper.bind(this);
759
+ formInput.onkeyup = this.fieldChanged.bind(this);
760
+ formInput.onchange = this.fieldChanged.bind(this);
761
+ if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
762
+ formInput.addEventListener('change', this.selectRemovePlaceholderCallback.bind(formInput));
741
763
  }
742
- else {
743
- // clear any end time comparitor errors and perform the standard validity check on the event
744
- endTime.setCustomValidity('');
745
- setErrorState(endTime, false, null);
746
- this.validityCheckWrapper(event);
764
+ if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-with')) {
765
+ formInput.oninvalid = endDateComparisonValidator.bind(this);
766
+ formInput.onblur = endDateComparisonValidator.bind(this);
767
+ }
768
+ if (properties[formKey].form.type === 'startenddate' && formInput.type === 'time') {
769
+ formInput.oninvalid = startEndTimeComparator.bind(this);
770
+ formInput.onblur = startEndTimeComparator.bind(this);
771
+ }
772
+ if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-to')) {
773
+ formInput.oninvalid = startDateComparisonValidator.bind(this);
774
+ formInput.onblur = startDateComparisonValidator.bind(this);
747
775
  }
748
776
  }
749
777
  }
750
- clearTimeComparitor(event) {
751
- const target = event.target;
752
- const formKey = target.getAttribute('data-formkey');
753
- const timeFields = Array.from(target.parentElement.parentElement.parentElement.querySelectorAll(`[type=time][data-formkey=${formKey}]`));
754
- if (timeFields.length) {
755
- const endTime = timeFields.find(t => t.name.endsWith('endtime'));
756
- endTime.setCustomValidity('');
757
- setErrorState(endTime, false, null);
778
+ /**
779
+ * If data exists, set form input values before rendering
780
+ * @param formItems The document fragment template of form items to be rendered
781
+ */
782
+ populateFormWithExistingData(formItems) {
783
+ const dataKeys = Object.keys(this._data);
784
+ for (const key of dataKeys) {
785
+ const formItemsByKey = formItems.querySelectorAll(`[name=${key}]`);
786
+ for (const formItem of formItemsByKey) {
787
+ switch (formItem.type) {
788
+ case 'checkbox':
789
+ if (this._data[key] === 'on') {
790
+ formItem.checked = true;
791
+ }
792
+ break;
793
+ case 'radio':
794
+ if (formItem.value === this._data[key]) {
795
+ formItem.checked = true;
796
+ }
797
+ break;
798
+ case 'select':
799
+ case 'select-one':
800
+ formItems.querySelector(`[name=overlay-${key}]`)['selectedValue'] = this._data[key];
801
+ formItem.value = this._data[key];
802
+ break;
803
+ default:
804
+ formItem.value = this._data[key];
805
+ }
806
+ }
758
807
  }
759
808
  }
760
- startDateComparisonValidator(event) {
761
- const startDate = event.target;
762
- const compareToName = startDate.getAttribute('data-compare-to');
763
- const endDate = startDate.parentElement.parentElement.parentElement.querySelector(`[name=${compareToName}]`);
764
- this.endDateComparisonValidator({ target: endDate }, true);
765
- this.validityCheckWrapper(event);
809
+ /**
810
+ * Remove the placeholder class on the bound THIS select element
811
+ */
812
+ selectRemovePlaceholderCallback() {
813
+ const select = this;
814
+ select.classList.remove('placeholder');
766
815
  }
767
- endDateComparisonValidator(event, triggeredByStartDate = false) {
768
- var _a, _b, _c, _d;
769
- const endDate = event.target;
770
- if (!endDate.value && triggeredByStartDate)
816
+ /**
817
+ * A wrapper around validity check and set error state
818
+ */
819
+ validityCheckWrapper(event) {
820
+ const { target, hasError, errorMessage } = validityCheck(event);
821
+ setErrorState(target, hasError, errorMessage);
822
+ }
823
+ assignFieldsetReference(el) {
824
+ this.fieldset = el;
825
+ }
826
+ assignButtonReference(el) {
827
+ this.submitButton = el;
828
+ }
829
+ /**
830
+ * An external validation trigger to apply to a form field
831
+ * @param { string } fieldName The form field name to apply the validation too
832
+ * @param { string } message The validation message to display under the form field
833
+ */
834
+ async setValidationFor(fieldName, message) {
835
+ const formField = this.fieldset.querySelector(`[name=${fieldName}]`);
836
+ if (formField.disabled) {
771
837
  return;
772
- const compareWithName = endDate.getAttribute('data-compare-with');
773
- const startDate = endDate.parentElement.parentElement.parentElement.querySelector(`[name=${compareWithName}]`);
774
- if (((_a = endDate.valueAsDate) === null || _a === void 0 ? void 0 : _a.valueOf()) < ((_b = startDate.valueAsDate) === null || _b === void 0 ? void 0 : _b.valueOf())) {
775
- endDate.setCustomValidity(endDate.getAttribute('data-compare'));
776
- setErrorState(endDate, true, endDate.getAttribute('data-compare'));
777
- }
778
- else if (((_c = endDate.valueAsDate) === null || _c === void 0 ? void 0 : _c.valueOf()) === ((_d = startDate.valueAsDate) === null || _d === void 0 ? void 0 : _d.valueOf())) {
779
- endDate.setCustomValidity('');
780
- this.validityCheckWrapper(event);
781
- this.startEndTimeComparitor(event);
782
838
  }
783
- else {
784
- this.clearTimeComparitor(event);
785
- this.validityCheckWrapper(event);
839
+ formField.setCustomValidity(message);
840
+ formField.setAttribute('custom-validation-set', 'true');
841
+ setErrorState(formField, true, message);
842
+ }
843
+ /**
844
+ * Clear the validation message on a given form field
845
+ * @param { string } fieldName The form field name to clear the validation of
846
+ */
847
+ async clearValidationFor(fieldName) {
848
+ const formField = this.fieldset.querySelector(`[name=${fieldName}]`);
849
+ formField.setCustomValidity('');
850
+ formField.removeAttribute('custom-validation-set');
851
+ setErrorState(formField, false, '');
852
+ }
853
+ /**
854
+ * Disable a form field and visually remove it from the form.
855
+ * If custom validation is set, this function will return without affecting the form field.
856
+ * @param { string } fieldName The form field name to disable
857
+ */
858
+ async disableFormField(fieldName) {
859
+ const formField = this.fieldset.querySelector(`[name=${fieldName}]`);
860
+ if (formField.hasAttribute('custom-validation-set')) {
861
+ return;
786
862
  }
863
+ formField.disabled = true;
864
+ let parent = formField.parentElement;
865
+ do {
866
+ if (parent.nodeName !== 'LABEL') {
867
+ parent = parent.parentElement;
868
+ }
869
+ } while (parent.nodeName !== 'LABEL');
870
+ parent.style.display = 'none';
787
871
  }
788
- validityCheckWrapper(event) {
789
- const { target, hasError, errorMessage } = validityCheck(event);
790
- setErrorState(target, hasError, errorMessage);
872
+ /**
873
+ * Enable a form field and visually add it back to the form.
874
+ * @param { string } fieldName The form field name to enable
875
+ */
876
+ async enableFormField(fieldName) {
877
+ const formField = this.fieldset.querySelector(`[name=${fieldName}]`);
878
+ formField.disabled = false;
879
+ let parent = formField.parentElement;
880
+ do {
881
+ if (parent.nodeName !== 'LABEL') {
882
+ parent = parent.parentElement;
883
+ }
884
+ } while (parent.nodeName !== 'LABEL');
885
+ parent.style.display = 'block';
791
886
  }
792
887
  /**
793
888
  * Renders the component's template as a form element with a fieldset container. The form's
@@ -797,7 +892,7 @@ const TttxForm = class {
797
892
  * later on.
798
893
  */
799
894
  render() {
800
- 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' } }))));
895
+ return (index.h(index.Host, null, index.h("form", { onSubmit: this.doSubmit.bind(this) }, index.h("fieldset", { ref: this.assignFieldsetReference.bind(this) }), index.h("input", { type: "submit", ref: this.assignButtonReference.bind(this), style: { display: 'none' } }))));
801
896
  }
802
897
  static get watchers() { return {
803
898
  "formschema": ["onFormSchemaChange"],
@@ -806,4 +901,4 @@ const TttxForm = class {
806
901
  };
807
902
  TttxForm.style = tttxFormCss;
808
903
 
809
- exports.tttx_form_1_2_0 = TttxForm;
904
+ exports.tttx_form_1_4_0 = TttxForm;
@@ -31,4 +31,4 @@ const TttxIcon = class {
31
31
  };
32
32
  TttxIcon.style = tttxIconCss;
33
33
 
34
- exports.tttx_icon_1_2_0 = TttxIcon;
34
+ exports.tttx_icon_1_4_0 = TttxIcon;
@@ -69,4 +69,4 @@ const TttxKeyvalueBlock = class {
69
69
  };
70
70
  TttxKeyvalueBlock.style = tttxKeyvalueBlockCss;
71
71
 
72
- exports.tttx_keyvalue_block_1_2_0 = TttxKeyvalueBlock;
72
+ exports.tttx_keyvalue_block_1_4_0 = TttxKeyvalueBlock;
@@ -23,4 +23,4 @@ const TttxLoadingSpinner = class {
23
23
  };
24
24
  TttxLoadingSpinner.style = tttxLoadingSpinnerCss;
25
25
 
26
- exports.tttx_loading_spinner_1_2_0 = TttxLoadingSpinner;
26
+ exports.tttx_loading_spinner_1_4_0 = TttxLoadingSpinner;
@@ -88,11 +88,11 @@ const TttxMultiselectBox = class {
88
88
  const sanitisedHTML = domsanitiser_options.purify.sanitize(option.html, domsanitiser_options.domSanitiserOptions);
89
89
  // This is tested in e2e tests
90
90
  /* istanbul ignore next */
91
- 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_1_2_0", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), index.h("div", { innerHTML: sanitisedHTML })));
91
+ 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_1_4_0", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), index.h("div", { innerHTML: sanitisedHTML })));
92
92
  }
93
93
  // This is tested in e2e tests
94
94
  /* istanbul ignore next */
95
- 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_1_2_0", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), index.h("div", { class: "plaintext-option" }, option.label)));
95
+ 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_1_4_0", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), index.h("div", { class: "plaintext-option" }, option.label)));
96
96
  }
97
97
  // This is tested in e2e tests
98
98
  /* istanbul ignore next */
@@ -124,11 +124,11 @@ const TttxMultiselectBox = class {
124
124
  if (!this.unsavedSelectedItems)
125
125
  this.unsavedSelectedItems = this.safelyCloneArray(this._optionsData);
126
126
  const chevronIcon = this.open ? 'expand_less' : 'expand_more';
127
- 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_1_2_0", { 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 &&
127
+ 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_1_4_0", { 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 &&
128
128
  /* istanbul ignore next */
129
- index.h("div", { class: "searchbox" }, index.h("tttx-standalone-input_1_2_0", { type: "text", placeholder: 'Search', 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) => {
129
+ index.h("div", { class: "searchbox" }, index.h("tttx-standalone-input_1_4_0", { type: "text", placeholder: 'Search', 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) => {
130
130
  return this.dropdownOption(option);
131
- })), index.h("div", { class: 'footer' }, index.h("tttx-button_1_2_0", { design: "primary", onClick: this.applyChanges.bind(this) }, "Apply"), index.h("tttx-button_1_2_0", { onClick: this.onCancel.bind(this) }, "Cancel"))))))));
131
+ })), index.h("div", { class: 'footer' }, index.h("tttx-button_1_4_0", { design: "primary", onClick: this.applyChanges.bind(this) }, "Apply"), index.h("tttx-button_1_4_0", { onClick: this.onCancel.bind(this) }, "Cancel"))))))));
132
132
  }
133
133
  get el() { return index.getElement(this); }
134
134
  static get watchers() { return {
@@ -137,4 +137,4 @@ const TttxMultiselectBox = class {
137
137
  };
138
138
  TttxMultiselectBox.style = tttxMultiselectBoxCss;
139
139
 
140
- exports.tttx_multiselect_box_1_2_0 = TttxMultiselectBox;
140
+ exports.tttx_multiselect_box_1_4_0 = TttxMultiselectBox;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-fdc30724.js');
6
6
 
7
- const tttxPercentageBarCss = ".sc-tttx-percentage-bar_1_2_0-h{display:block}.progress.sc-tttx-percentage-bar_1_2_0{width:100%;background-color:#dbdbdb}.progress.sc-tttx-percentage-bar_1_2_0 .bar.sc-tttx-percentage-bar_1_2_0{height:20px}";
7
+ const tttxPercentageBarCss = ".sc-tttx-percentage-bar_1_4_0-h{display:block}.progress.sc-tttx-percentage-bar_1_4_0{width:100%;background-color:#dbdbdb}.progress.sc-tttx-percentage-bar_1_4_0 .bar.sc-tttx-percentage-bar_1_4_0{height:20px}";
8
8
 
9
9
  const TttxPercentageBar = class {
10
10
  constructor(hostRef) {
@@ -62,4 +62,4 @@ const TttxPercentageBar = class {
62
62
  };
63
63
  TttxPercentageBar.style = tttxPercentageBarCss;
64
64
 
65
- exports.tttx_percentage_bar_1_2_0 = TttxPercentageBar;
65
+ exports.tttx_percentage_bar_1_4_0 = TttxPercentageBar;
@@ -40,4 +40,4 @@ const TttxQrCode = class {
40
40
  };
41
41
  TttxQrCode.style = tttxQrcodeCss;
42
42
 
43
- exports.tttx_qrcode_1_2_0 = TttxQrCode;
43
+ exports.tttx_qrcode_1_4_0 = TttxQrCode;
@@ -65,7 +65,7 @@ const TttxSelectBox = class {
65
65
  let title;
66
66
  let subtitle;
67
67
  const chevronIcon = this.open ? 'expand_less' : 'expand_more';
68
- const icon = index.h("tttx-icon_1_2_0", { icon: chevronIcon, color: "black" });
68
+ const icon = index.h("tttx-icon_1_4_0", { icon: chevronIcon, color: "black" });
69
69
  let chevron = index.h("div", { class: 'dropdown-selector-chevron' }, icon);
70
70
  if (!this.selectedItem) {
71
71
  title = index.h("div", { class: "placeholder" }, this.placeholder);
@@ -124,7 +124,7 @@ const TttxSelectBox = class {
124
124
  return;
125
125
  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", ref: (el) => this.dropdownSelector = el, onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent()), this.open && (index.h("div", { class: "dropdown-body-container" }, index.h("div", { class: "dropdown-body", style: Object.assign({ width: `${this.dropdownSelector.offsetWidth}px` }, this.bodyOffset) }, this.searchEnabled &&
126
126
  /* istanbul ignore next */
127
- index.h("div", { class: "searchbox" }, index.h("tttx-standalone-input_1_2_0", { type: "text", label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this) })), index.h("div", { class: "dropdown-options-list" }, this._optionsData.map((option) => {
127
+ index.h("div", { class: "searchbox" }, index.h("tttx-standalone-input_1_4_0", { type: "text", label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this) })), index.h("div", { class: "dropdown-options-list" }, this._optionsData.map((option) => {
128
128
  return this.dropdownOption(option);
129
129
  }))))))));
130
130
  }
@@ -135,4 +135,4 @@ const TttxSelectBox = class {
135
135
  };
136
136
  TttxSelectBox.style = tttxSelectBoxCss;
137
137
 
138
- exports.tttx_select_box_1_2_0 = TttxSelectBox;
138
+ exports.tttx_select_box_1_4_0 = TttxSelectBox;