@3t-transform/threeteeui 0.1.28 → 0.1.30

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 (190) hide show
  1. package/dist/cjs/{index-dc6cc829.js → index-457ca775.js} +104 -2
  2. package/dist/cjs/loader.cjs.js +4 -3
  3. package/dist/cjs/tttx-button.cjs.entry.js +24 -24
  4. package/dist/cjs/tttx-filter.cjs.entry.js +159 -159
  5. package/dist/cjs/tttx-form.cjs.entry.js +376 -364
  6. package/dist/cjs/tttx-icon.cjs.entry.js +11 -11
  7. package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +59 -59
  8. package/dist/cjs/tttx-list.cjs.entry.js +43 -43
  9. package/dist/cjs/tttx-loading-spinner.cjs.entry.js +16 -16
  10. package/dist/cjs/tttx-sorter.cjs.entry.js +102 -102
  11. package/dist/cjs/tttx-standalone-input.cjs.entry.js +62 -62
  12. package/dist/cjs/tttx-toolbar.cjs.entry.js +10 -10
  13. package/dist/cjs/tttx.cjs.js +7 -3
  14. package/dist/collection/collection-manifest.json +2 -2
  15. package/dist/collection/components/atoms/tttx-button/tttx-button.js +110 -110
  16. package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +14 -14
  17. package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +62 -62
  18. package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +22 -22
  19. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +109 -109
  20. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +38 -38
  21. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +67 -67
  22. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -17
  23. package/dist/collection/components/molecules/tttx-filter/tttx-filter.js +334 -334
  24. package/dist/collection/components/molecules/tttx-filter/tttx-filter.stories.js +62 -62
  25. package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +37 -35
  26. package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +58 -58
  27. package/dist/collection/components/molecules/tttx-form/tttx-form.css +5 -0
  28. package/dist/collection/components/molecules/tttx-form/tttx-form.js +396 -364
  29. package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +248 -127
  30. package/dist/collection/components/molecules/tttx-list/tttx-list.js +105 -105
  31. package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +43 -43
  32. package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.js +224 -224
  33. package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.stories.js +42 -42
  34. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css +27 -5
  35. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +645 -645
  36. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +163 -163
  37. package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.js +44 -44
  38. package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.stories.js +14 -14
  39. package/dist/collection/components/palette.stories.js +7 -7
  40. package/dist/collection/docs/gettingstarted-developer.stories.js +5 -5
  41. package/dist/collection/icons.js +2838 -2838
  42. package/dist/collection/index.js +1 -1
  43. package/dist/collection/shared/domsanitiser.options.js +14 -14
  44. package/dist/components/index.d.ts +9 -0
  45. package/dist/components/index.js +1 -1
  46. package/dist/components/tttx-button.js +48 -48
  47. package/dist/components/tttx-filter.js +191 -191
  48. package/dist/components/tttx-form.js +394 -381
  49. package/dist/components/tttx-icon2.js +28 -28
  50. package/dist/components/tttx-keyvalue-block.js +76 -76
  51. package/dist/components/tttx-list.js +65 -65
  52. package/dist/components/tttx-loading-spinner.js +33 -33
  53. package/dist/components/tttx-sorter.js +130 -130
  54. package/dist/components/tttx-standalone-input.js +110 -110
  55. package/dist/components/tttx-toolbar.js +26 -26
  56. package/dist/esm/{index-86faeaab.js → index-d784fb3e.js} +104 -3
  57. package/dist/esm/loader.js +4 -3
  58. package/dist/esm/polyfills/core-js.js +0 -0
  59. package/dist/esm/polyfills/css-shim.js +1 -1
  60. package/dist/esm/polyfills/dom.js +0 -0
  61. package/dist/esm/polyfills/es5-html-element.js +0 -0
  62. package/dist/esm/polyfills/index.js +0 -0
  63. package/dist/esm/polyfills/system.js +0 -0
  64. package/dist/esm/tttx-button.entry.js +24 -24
  65. package/dist/esm/tttx-filter.entry.js +159 -159
  66. package/dist/esm/tttx-form.entry.js +376 -364
  67. package/dist/esm/tttx-icon.entry.js +11 -11
  68. package/dist/esm/tttx-keyvalue-block.entry.js +59 -59
  69. package/dist/esm/tttx-list.entry.js +43 -43
  70. package/dist/esm/tttx-loading-spinner.entry.js +16 -16
  71. package/dist/esm/tttx-sorter.entry.js +102 -102
  72. package/dist/esm/tttx-standalone-input.entry.js +62 -62
  73. package/dist/esm/tttx-toolbar.entry.js +10 -10
  74. package/dist/esm/tttx.js +4 -3
  75. package/dist/tttx/p-0ebffdfc.js +2 -0
  76. package/dist/tttx/p-1112ed2e.entry.js +1 -0
  77. package/dist/tttx/p-13495422.entry.js +1 -0
  78. package/dist/tttx/{p-ae00cae3.entry.js → p-1ed7a43d.entry.js} +1 -1
  79. package/dist/tttx/p-237fe0d5.entry.js +1 -0
  80. package/dist/tttx/p-2731fbc6.entry.js +1 -0
  81. package/dist/tttx/p-280b8e45.entry.js +1 -0
  82. package/dist/tttx/p-3772f4d0.entry.js +1 -0
  83. package/dist/tttx/p-390d97dd.entry.js +1 -0
  84. package/dist/tttx/p-49796abf.entry.js +1 -0
  85. package/dist/tttx/p-4f68f1eb.entry.js +1 -0
  86. package/dist/tttx/p-53793ed2.entry.js +1 -0
  87. package/dist/tttx/p-5f335153.entry.js +1 -0
  88. package/dist/tttx/p-60a0fee2.entry.js +1 -0
  89. package/dist/tttx/p-6ab75c0b.entry.js +1 -0
  90. package/dist/tttx/{p-daa27411.entry.js → p-6b006ccf.entry.js} +1 -1
  91. package/dist/tttx/p-6cbe1824.entry.js +1 -0
  92. package/dist/tttx/p-6cefa1ce.entry.js +1 -0
  93. package/dist/tttx/p-72e7f7dd.entry.js +3 -0
  94. package/dist/tttx/{p-c72d1a03.entry.js → p-798a098a.entry.js} +1 -1
  95. package/dist/tttx/p-824af346.entry.js +1 -0
  96. package/dist/tttx/{p-f1d7eb35.entry.js → p-91e42647.entry.js} +1 -1
  97. package/dist/tttx/{p-8f3badad.entry.js → p-b720c4ad.entry.js} +1 -1
  98. package/dist/tttx/p-c06f1207.entry.js +1 -0
  99. package/dist/tttx/p-c0a15524.entry.js +1 -0
  100. package/dist/tttx/{p-e25d5fe2.entry.js → p-c4162029.entry.js} +1 -1
  101. package/dist/tttx/p-c7c968dd.entry.js +1 -0
  102. package/dist/tttx/{p-c4538d55.entry.js → p-cac26a1b.entry.js} +1 -1
  103. package/dist/tttx/p-ce728715.entry.js +1 -0
  104. package/dist/tttx/p-d3932db5.entry.js +1 -0
  105. package/dist/tttx/p-d575ef2d.entry.js +1 -0
  106. package/dist/tttx/p-d83edcfb.entry.js +1 -0
  107. package/dist/tttx/p-d8e03ed6.entry.js +1 -0
  108. package/dist/tttx/p-ebb496a2.entry.js +1 -0
  109. package/dist/tttx/p-fb5e737b.entry.js +1 -0
  110. package/dist/tttx/p-fce571c2.entry.js +1 -0
  111. package/dist/tttx/tttx.esm.js +1 -1
  112. package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +10 -10
  113. package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +10 -10
  114. package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +5 -5
  115. package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +20 -20
  116. package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +7 -7
  117. package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +9 -9
  118. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +6 -6
  119. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +17 -17
  120. package/dist/types/components/molecules/tttx-filter/tttx-filter.d.ts +39 -39
  121. package/dist/types/components/molecules/tttx-filter/tttx-filter.stories.d.ts +68 -68
  122. package/dist/types/components/molecules/tttx-form/lib/setErrorState.d.ts +13 -13
  123. package/dist/types/components/molecules/tttx-form/lib/validityCheck.d.ts +17 -17
  124. package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +111 -114
  125. package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +13 -13
  126. package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +11 -11
  127. package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +14 -14
  128. package/dist/types/components/molecules/tttx-sorter/tttx-sorter.d.ts +19 -19
  129. package/dist/types/components/molecules/tttx-sorter/tttx-sorter.stories.d.ts +30 -30
  130. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +60 -60
  131. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +128 -128
  132. package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.d.ts +4 -4
  133. package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.stories.d.ts +13 -13
  134. package/dist/types/components/palette.stories.d.ts +6 -6
  135. package/dist/types/components.d.ts +3 -2
  136. package/dist/types/docs/gettingstarted-developer.stories.d.ts +5 -5
  137. package/dist/types/icons.d.ts +2 -2
  138. package/dist/types/index.d.ts +1 -1
  139. package/dist/types/shared/domsanitiser.options.d.ts +10 -10
  140. package/dist/types/stencil-public-runtime.d.ts +59 -3
  141. package/loader/index.d.ts +9 -0
  142. package/package.json +1 -1
  143. package/dist/cjs/domsanitiser.options-277161b9.js +0 -1667
  144. package/dist/collection/components/atoms/tttx-button/test/tttx-button.e2e.js +0 -9
  145. package/dist/collection/components/atoms/tttx-button/test/tttx-button.spec.js +0 -83
  146. package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.e2e.js +0 -9
  147. package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.spec.js +0 -16
  148. package/dist/collection/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.js +0 -216
  149. package/dist/collection/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.js +0 -64
  150. package/dist/collection/components/molecules/tttx-filter/test/tttx-filter.spec.js +0 -231
  151. package/dist/collection/components/molecules/tttx-form/lib/setErrorState.spec.js +0 -38
  152. package/dist/collection/components/molecules/tttx-form/lib/validityCheck.spec.js +0 -214
  153. package/dist/collection/components/molecules/tttx-form/test/tttx-form.e2e.js +0 -9
  154. package/dist/collection/components/molecules/tttx-form/test/tttx-form.spec.js +0 -232
  155. package/dist/collection/components/molecules/tttx-list/test/ttttx-list.spec.e2e.js +0 -26
  156. package/dist/collection/components/molecules/tttx-list/test/tttx-list.spec.js +0 -183
  157. package/dist/collection/components/molecules/tttx-sorter/test/tttx-sorter.spec.js +0 -87
  158. package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.js +0 -9
  159. package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.js +0 -215
  160. package/dist/collection/components/molecules/tttx-toolbar/test/tttx-toolbar.spec.js +0 -52
  161. package/dist/collection/shared/test/domsanitiser.options.spec.js +0 -23
  162. package/dist/components/domsanitiser.options.js +0 -1664
  163. package/dist/esm/domsanitiser.options-cc420431.js +0 -1664
  164. package/dist/tttx/p-12fc0b16.entry.js +0 -3
  165. package/dist/tttx/p-2e43a578.entry.js +0 -1
  166. package/dist/tttx/p-33c0cbdc.entry.js +0 -1
  167. package/dist/tttx/p-52a47b7c.js +0 -2
  168. package/dist/tttx/p-72b4c98a.entry.js +0 -1
  169. package/dist/tttx/p-7e6fa227.entry.js +0 -1
  170. package/dist/tttx/p-90b0f72a.entry.js +0 -1
  171. package/dist/tttx/p-b4290a5b.js +0 -3
  172. package/dist/tttx/p-c4f2186e.entry.js +0 -1
  173. package/dist/types/components/atoms/tttx-button/test/tttx-button.e2e.d.ts +0 -1
  174. package/dist/types/components/atoms/tttx-button/test/tttx-button.spec.d.ts +0 -1
  175. package/dist/types/components/atoms/tttx-icon/test/tttx-icon.e2e.d.ts +0 -1
  176. package/dist/types/components/atoms/tttx-icon/test/tttx-icon.spec.d.ts +0 -1
  177. package/dist/types/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.d.ts +0 -1
  178. package/dist/types/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.d.ts +0 -1
  179. package/dist/types/components/molecules/tttx-filter/test/tttx-filter.spec.d.ts +0 -1
  180. package/dist/types/components/molecules/tttx-form/lib/setErrorState.spec.d.ts +0 -1
  181. package/dist/types/components/molecules/tttx-form/lib/validityCheck.spec.d.ts +0 -1
  182. package/dist/types/components/molecules/tttx-form/test/tttx-form.e2e.d.ts +0 -1
  183. package/dist/types/components/molecules/tttx-form/test/tttx-form.spec.d.ts +0 -1
  184. package/dist/types/components/molecules/tttx-list/test/ttttx-list.spec.e2e.d.ts +0 -1
  185. package/dist/types/components/molecules/tttx-list/test/tttx-list.spec.d.ts +0 -1
  186. package/dist/types/components/molecules/tttx-sorter/test/tttx-sorter.spec.d.ts +0 -1
  187. package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.d.ts +0 -1
  188. package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.d.ts +0 -1
  189. package/dist/types/components/molecules/tttx-toolbar/test/tttx-toolbar.spec.d.ts +0 -1
  190. package/dist/types/shared/test/domsanitiser.options.spec.d.ts +0 -1
@@ -1,47 +1,47 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
- export default {
3
- title: 'molecules/Filter',
4
- component: 'tttx-filter',
5
- argTypes: {
6
- filterOptions: {
7
- control: { type: 'object' }
8
- },
9
- filterButtonStyle: {
10
- table: { defaultValue: { summary: 'list filter' } },
11
- control: { type: 'select' },
12
- options: ['list filter', 'list icon', 'table icon'],
13
- },
14
- showSearchField: {
15
- table: { defaultValue: { summary: false } },
16
- control: { type: 'boolean' },
17
- },
18
- showSelectAll: {
19
- table: { defaultValue: { summary: true } },
20
- control: { type: 'boolean' },
21
- },
22
- showOptionIcons: {
23
- table: { defaultValue: { summary: true } },
24
- control: { type: 'boolean' },
25
- },
26
- filterHeader: {
27
- control: { type: 'text' },
28
- },
29
- },
30
- parameters: {
31
- actions: {
32
- handles: ['filterChangeEvent'],
33
- },
34
- },
35
- decorators: [withActions],
36
- };
37
- const filterOptions = [
38
- { optionIcon: 'cancel', optionIconColor: 'exit', optionText: 'Expired' },
39
- { optionIcon: 'warning', optionIconColor: 'orange', optionText: 'Expiring soon' },
40
- { optionIcon: 'check_circle', optionIconColor: 'green', optionText: 'Active' },
41
- ];
42
- const ExampleFilter = args => {
43
- const filterHeader = args.filterHeader || 'Qualification status';
44
- const jsonFilterOptions = args.filterOptions ? JSON.stringify(args.filterOptions) : undefined;
1
+ import { withActions } from '@storybook/addon-actions/decorator';
2
+ export default {
3
+ title: 'molecules/Filter',
4
+ component: 'tttx-filter',
5
+ argTypes: {
6
+ filterOptions: {
7
+ control: { type: 'object' }
8
+ },
9
+ filterButtonStyle: {
10
+ table: { defaultValue: { summary: 'list filter' } },
11
+ control: { type: 'select' },
12
+ options: ['list filter', 'list icon', 'table icon'],
13
+ },
14
+ showSearchField: {
15
+ table: { defaultValue: { summary: false } },
16
+ control: { type: 'boolean' },
17
+ },
18
+ showSelectAll: {
19
+ table: { defaultValue: { summary: true } },
20
+ control: { type: 'boolean' },
21
+ },
22
+ showOptionIcons: {
23
+ table: { defaultValue: { summary: true } },
24
+ control: { type: 'boolean' },
25
+ },
26
+ filterHeader: {
27
+ control: { type: 'text' },
28
+ },
29
+ },
30
+ parameters: {
31
+ actions: {
32
+ handles: ['filterChangeEvent'],
33
+ },
34
+ },
35
+ decorators: [withActions],
36
+ };
37
+ const filterOptions = [
38
+ { optionIcon: 'cancel', optionIconColor: 'exit', optionText: 'Expired' },
39
+ { optionIcon: 'warning', optionIconColor: 'orange', optionText: 'Expiring soon' },
40
+ { optionIcon: 'check_circle', optionIconColor: 'green', optionText: 'Active' },
41
+ ];
42
+ const ExampleFilter = args => {
43
+ const filterHeader = args.filterHeader || 'Qualification status';
44
+ const jsonFilterOptions = args.filterOptions ? JSON.stringify(args.filterOptions) : undefined;
45
45
  return `<tttx-filter
46
46
  ${jsonFilterOptions ? 'filter-options=\'' + jsonFilterOptions + '\'' : ''}
47
47
  ${args.showSearchField ? 'show-search-field=\'' + args.showSearchField + '\'' : ''}
@@ -50,21 +50,21 @@ const ExampleFilter = args => {
50
50
  ${args.showOptionIcons ? 'show-option-icons=\'' + args.showOptionIcons + '\'' : ''}
51
51
  filter-header='${filterHeader}'
52
52
  filter-key='basic-filter'
53
- ></tttx-filter>`;
54
- };
55
- export const Default = ExampleFilter.bind({});
56
- export const CustomFilterOptions = ExampleFilter.bind({});
57
- CustomFilterOptions.args = {
58
- filterOptions
59
- };
60
- export const ListFilterWithoutSearchField = ExampleFilter.bind({});
61
- ListFilterWithoutSearchField.args = {
62
- filterOptions,
63
- showSearchField: false
64
- };
65
- export const TableIconWithoutOptionIconsOrSelectAll = ExampleFilter.bind({});
66
- TableIconWithoutOptionIconsOrSelectAll.args = {
67
- filterOptions,
68
- showOptionIcons: false,
69
- showSelectAll: false
70
- };
53
+ ></tttx-filter>`;
54
+ };
55
+ export const Default = ExampleFilter.bind({});
56
+ export const CustomFilterOptions = ExampleFilter.bind({});
57
+ CustomFilterOptions.args = {
58
+ filterOptions
59
+ };
60
+ export const ListFilterWithoutSearchField = ExampleFilter.bind({});
61
+ ListFilterWithoutSearchField.args = {
62
+ filterOptions,
63
+ showSearchField: false
64
+ };
65
+ export const TableIconWithoutOptionIconsOrSelectAll = ExampleFilter.bind({});
66
+ TableIconWithoutOptionIconsOrSelectAll.args = {
67
+ filterOptions,
68
+ showOptionIcons: false,
69
+ showSelectAll: false
70
+ };
@@ -1,35 +1,37 @@
1
- /**
2
- * Sets the error state of an input field by updating its class and error message.
3
- * If an error was detected, it sets the input field's class to "invalid" and
4
- * displays the error message in an error bubble. If no error was detected,
5
- * it removes the "invalid" class from the input field and clears the error bubble.
6
- *
7
- * @param {HTMLInputElement} target - The input field to update.
8
- * @param {boolean} hasError - Whether an error was detected in the field.
9
- * @param {string} errorMessage - The error message to display (if any).
10
- * @return {void}
11
- */
12
- function setErrorState(target, hasError, errorMessage) {
13
- // Find the error bubble element for the input field
14
- const errorBubble = target.parentElement.querySelector('.errorBubble');
15
- // If an error was detected, set the input field's class to "invalid" and display the error message in the error bubble
16
- if (hasError) {
17
- target.className = 'invalid';
18
- const errorIcon = document.createElement('span');
19
- // Set the class of the error icon to a pre-defined CSS class that specifies the icon's appearance
20
- errorIcon.className = 'material-symbols-rounded';
21
- // Set the text content of the error icon to the word "warning"
22
- errorIcon.textContent = 'warning';
23
- // errorBubble.replaceChildren cannot be used here because the tests don't support this new feature :(
24
- errorBubble.innerHTML = '';
25
- errorBubble.append(errorIcon);
26
- errorBubble.append(errorMessage);
27
- // errorBubble.replaceChildren(errorIcon, errorMessage);
28
- }
29
- // If no error was detected, remove the "invalid" class from the input field and clear the error bubble
30
- else {
31
- target.className = '';
32
- errorBubble.innerHTML = '';
33
- }
34
- }
35
- export default setErrorState;
1
+ /**
2
+ * Sets the error state of an input field by updating its class and error message.
3
+ * If an error was detected, it sets the input field's class to "invalid" and
4
+ * displays the error message in an error bubble. If no error was detected,
5
+ * it removes the "invalid" class from the input field and clears the error bubble.
6
+ *
7
+ * @param {HTMLInputElement} target - The input field to update.
8
+ * @param {boolean} hasError - Whether an error was detected in the field.
9
+ * @param {string} errorMessage - The error message to display (if any).
10
+ * @return {void}
11
+ */
12
+ function setErrorState(target, hasError, errorMessage) {
13
+ // Find the error bubble element for the input field
14
+ const errorBubble = target.parentElement.querySelector('.errorBubble');
15
+ // If an error was detected, set the input field's class to "invalid" and display the error message in the error bubble
16
+ if (hasError) {
17
+ target.className = 'invalid';
18
+ errorBubble.classList.add('visible');
19
+ const errorIcon = document.createElement('span');
20
+ // Set the class of the error icon to a pre-defined CSS class that specifies the icon's appearance
21
+ errorIcon.className = 'material-symbols-rounded';
22
+ // Set the text content of the error icon to the word "warning"
23
+ errorIcon.textContent = 'warning';
24
+ // errorBubble.replaceChildren cannot be used here because the tests don't support this new feature :(
25
+ errorBubble.innerHTML = '';
26
+ errorBubble.append(errorIcon);
27
+ errorBubble.append(errorMessage);
28
+ // errorBubble.replaceChildren(errorIcon, errorMessage);
29
+ }
30
+ // If no error was detected, remove the "invalid" class from the input field and clear the error bubble
31
+ else {
32
+ errorBubble.classList.remove('visible');
33
+ target.className = '';
34
+ errorBubble.innerHTML = '';
35
+ }
36
+ }
37
+ export default setErrorState;
@@ -1,58 +1,58 @@
1
- /**
2
- * Validates the input field on focusout event by checking its validity state,
3
- * sets an error message if there's an issue, and emits a "dataChanged" event to
4
- * the parent component with the field name and its new value.
5
- *
6
- * @param {Event} event - The focusout event triggered by the input field.
7
- * @return {void}
8
- */
9
- function validityCheck(event) {
10
- var _a, _b, _c, _d;
11
- event.preventDefault();
12
- const target = event.target;
13
- let hasError = true;
14
- let errorMessage = '';
15
- // validity object on HTML5 inputs has the following options
16
- // badInput
17
- // customError
18
- // patternMismatch
19
- // rangeOverflow
20
- // rangeUnderflow
21
- // stepMismatch
22
- // tooLong
23
- // tooShort
24
- // typeMismatch
25
- // valid
26
- // valueMissing
27
- // customErrors can be set with
28
- // target.setCustomValidity('custom error!');
29
- // and cleared with
30
- // target.setCustomValidity('');
31
- // Check the validity of the input field and set an error message if needed
32
- switch (true) {
33
- // The field is required, but has no value
34
- case target.validity.valueMissing:
35
- errorMessage = (_a = target.dataset.required) !== null && _a !== void 0 ? _a : 'This field is required';
36
- break;
37
- // The field's value does not match the expected pattern
38
- case target.validity.patternMismatch:
39
- errorMessage = (_b = target.dataset.pattern) !== null && _b !== void 0 ? _b : 'Incorrect format';
40
- break;
41
- // The field's value is not of the correct input type
42
- case target.validity.badInput:
43
- // IE string in a number field
44
- errorMessage = (_c = target.dataset.badinput) !== null && _c !== void 0 ? _c : 'Wrong input type';
45
- break;
46
- // The field's value is above or below the range set in the "min" and "max" attributes
47
- case target.validity.rangeOverflow || target.validity.rangeUnderflow:
48
- // IE date or number is above or below value set in min or max tags
49
- errorMessage = (_d = target.dataset.range) !== null && _d !== void 0 ? _d : 'Invalid value';
50
- break;
51
- // No error detected
52
- default:
53
- hasError = false;
54
- }
55
- // Return the error state
56
- return { target, hasError, errorMessage };
57
- }
58
- export default validityCheck;
1
+ /**
2
+ * Validates the input field on focusout event by checking its validity state,
3
+ * sets an error message if there's an issue, and emits a "dataChanged" event to
4
+ * the parent component with the field name and its new value.
5
+ *
6
+ * @param {Event} event - The focusout event triggered by the input field.
7
+ * @return {void}
8
+ */
9
+ function validityCheck(event) {
10
+ var _a, _b, _c, _d;
11
+ event.preventDefault();
12
+ const target = event.target;
13
+ let hasError = true;
14
+ let errorMessage = '';
15
+ // validity object on HTML5 inputs has the following options
16
+ // badInput
17
+ // customError
18
+ // patternMismatch
19
+ // rangeOverflow
20
+ // rangeUnderflow
21
+ // stepMismatch
22
+ // tooLong
23
+ // tooShort
24
+ // typeMismatch
25
+ // valid
26
+ // valueMissing
27
+ // customErrors can be set with
28
+ // target.setCustomValidity('custom error!');
29
+ // and cleared with
30
+ // target.setCustomValidity('');
31
+ // Check the validity of the input field and set an error message if needed
32
+ switch (true) {
33
+ // The field is required, but has no value
34
+ case target.validity.valueMissing:
35
+ errorMessage = (_a = target.dataset.required) !== null && _a !== void 0 ? _a : 'This field is required';
36
+ break;
37
+ // The field's value does not match the expected pattern
38
+ case target.validity.patternMismatch:
39
+ errorMessage = (_b = target.dataset.pattern) !== null && _b !== void 0 ? _b : 'Incorrect format';
40
+ break;
41
+ // The field's value is not of the correct input type
42
+ case target.validity.badInput:
43
+ // IE string in a number field
44
+ errorMessage = (_c = target.dataset.badinput) !== null && _c !== void 0 ? _c : 'Wrong input type';
45
+ break;
46
+ // The field's value is above or below the range set in the "min" and "max" attributes
47
+ case target.validity.rangeOverflow || target.validity.rangeUnderflow:
48
+ // IE date or number is above or below value set in min or max tags
49
+ errorMessage = (_d = target.dataset.range) !== null && _d !== void 0 ? _d : 'Invalid value';
50
+ break;
51
+ // No error detected
52
+ default:
53
+ hasError = false;
54
+ }
55
+ // Return the error state
56
+ return { target, hasError, errorMessage };
57
+ }
58
+ export default validityCheck;
@@ -218,6 +218,11 @@ input:focus-visible {
218
218
  margin-top: 4px;
219
219
  }
220
220
 
221
+ input[readonly] {
222
+ cursor: default;
223
+ pointer-events: none;
224
+ }
225
+
221
226
  .button {
222
227
  font-family: Roboto, serif;
223
228
  box-sizing: border-box;