@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,30 +1,30 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
- export default {
3
- title: 'molecules/List',
4
- component: 'tttx-list',
5
- parameters: {
6
- actions: {
7
- handles: ['listRowClick'],
8
- },
9
- },
10
- decorators: [withActions],
11
- };
1
+ import { withActions } from '@storybook/addon-actions/decorator';
2
+ export default {
3
+ title: 'molecules/List',
4
+ component: 'tttx-list',
5
+ parameters: {
6
+ actions: {
7
+ handles: ['listRowClick'],
8
+ },
9
+ },
10
+ decorators: [withActions],
11
+ };
12
12
  const TemplateStringList = ({ data }) => `
13
13
  <tttx-list
14
14
  data='${JSON.stringify(data)}'
15
15
  id='list'
16
16
  name='stringList'
17
17
  ></tttx-list>
18
- `;
19
- export const BasicStringList = TemplateStringList.bind({});
20
- BasicStringList.args = {
21
- data: [
22
- { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="green" /></span> Demulon 1,000,000' },
23
- { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="green" /></span> Patrick' },
24
- { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="orange" /></span> Lee' },
25
- { element: '<span><tttx-icon icon="egg" color="red" /></span> Ben' },
26
- ],
27
- };
18
+ `;
19
+ export const BasicStringList = TemplateStringList.bind({});
20
+ BasicStringList.args = {
21
+ data: [
22
+ { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="green" /></span> Demulon 1,000,000' },
23
+ { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="green" /></span> Patrick' },
24
+ { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="orange" /></span> Lee' },
25
+ { element: '<span><tttx-icon icon="egg" color="red" /></span> Ben' },
26
+ ],
27
+ };
28
28
  const TemplateObjectList = ({ data }) => `
29
29
  <tttx-list
30
30
  id='objectList'
@@ -36,16 +36,16 @@ const TemplateObjectList = ({ data }) => `
36
36
  }
37
37
  objectList.data = ${JSON.stringify(data)};
38
38
  </script>
39
- `;
40
- export const BasicObjectList = TemplateObjectList.bind({});
41
- BasicObjectList.args = {
42
- data: [
43
- { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" /></span> Demulon 1,000,000' },
44
- { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="red" /></span> Patrick' },
45
- { icon: 'chevron_right', element: '<span><tttx-icon icon="add" /></span> Lee' },
46
- { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" /></span> Ben' },
47
- ],
48
- };
39
+ `;
40
+ export const BasicObjectList = TemplateObjectList.bind({});
41
+ BasicObjectList.args = {
42
+ data: [
43
+ { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" /></span> Demulon 1,000,000' },
44
+ { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="red" /></span> Patrick' },
45
+ { icon: 'chevron_right', element: '<span><tttx-icon icon="add" /></span> Lee' },
46
+ { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" /></span> Ben' },
47
+ ],
48
+ };
49
49
  const TemplateClickableList = ({ data }) => `
50
50
  <tttx-list
51
51
  id='clickableList'
@@ -57,15 +57,15 @@ const TemplateClickableList = ({ data }) => `
57
57
  }
58
58
  clickableList.data = ${JSON.stringify(data)};
59
59
  </script>
60
- `;
61
- export const BasicClickableList = TemplateClickableList.bind({});
62
- BasicClickableList.args = {
63
- data: [
64
- { clickable: true, icon: 'chevron_right', element: '<span><tttx-icon icon="egg" /></span> Demulon 1,000,000', rowData: '[{ "name": "Demulon 1,000,000" }]' },
65
- { clickable: true, icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="red" /></span> Emma', rowData: [{ name: 'Emma' }] },
66
- { clickable: true, icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="green" /></span> Eulogio', rowData: 'Eulogio' },
67
- { clickable: true, icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="red" /></span> Patrick' },
68
- { clickable: false, icon: 'chevron_right', element: '<span><tttx-icon icon="add" /></span> Lee ' },
69
- { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" /></span> Ben' },
70
- ],
71
- };
60
+ `;
61
+ export const BasicClickableList = TemplateClickableList.bind({});
62
+ BasicClickableList.args = {
63
+ data: [
64
+ { clickable: true, icon: 'chevron_right', element: '<span><tttx-icon icon="egg" /></span> Demulon 1,000,000', rowData: '[{ "name": "Demulon 1,000,000" }]' },
65
+ { clickable: true, icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="red" /></span> Emma', rowData: [{ name: 'Emma' }] },
66
+ { clickable: true, icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="green" /></span> Eulogio', rowData: 'Eulogio' },
67
+ { clickable: true, icon: 'chevron_right', element: '<span><tttx-icon icon="egg" color="red" /></span> Patrick' },
68
+ { clickable: false, icon: 'chevron_right', element: '<span><tttx-icon icon="add" /></span> Lee ' },
69
+ { icon: 'chevron_right', element: '<span><tttx-icon icon="egg" /></span> Ben' },
70
+ ],
71
+ };
@@ -1,224 +1,224 @@
1
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
- import { h, Host } from '@stencil/core';
3
- export class TttxSorter {
4
- constructor() {
5
- this.sorterKey = undefined;
6
- this.defaultSortDirection = 'descending';
7
- this.fieldOptionsData = null;
8
- this.defaultOption = '';
9
- this.selectedField = this.defaultOption;
10
- this.sortDirection = this.defaultSortDirection;
11
- this.dropdownExpand = false;
12
- this.dropdownOptions = undefined;
13
- }
14
- emitSortEvent() {
15
- this.sorterChangeEvent.emit({
16
- sorterDirection: this.sortDirection,
17
- sorterKey: this.sorterKey,
18
- sortField: this.selectedField,
19
- });
20
- }
21
- onSortToggleClick(event) {
22
- event.preventDefault();
23
- if (this.sortDirection == 'ascending') {
24
- this.sortDirection = 'descending';
25
- }
26
- else {
27
- this.sortDirection = 'ascending';
28
- }
29
- this.emitSortEvent();
30
- }
31
- onDropdownClicked() {
32
- this.dropdownExpand = !this.dropdownExpand;
33
- }
34
- onDropdownSelected(event) {
35
- this.dropdownExpand = false;
36
- const target = event.target;
37
- this.selectedField = target.innerHTML;
38
- this.emitSortEvent();
39
- }
40
- // getOptionsList() {
41
- // return this.el.shadowRoot.querySelectorAll('.dropdown-option');
42
- // }
43
- // /* istanbul ignore next */
44
- // @Listen('keyup')
45
- // handleKeyDown(ev: KeyboardEvent) {
46
- // const keyboardEventValue = ev.key;
47
- // if (document.activeElement.id != `sorter__${this.sorterKey}`) return;
48
- // switch (keyboardEventValue) {
49
- // case 'Enter':
50
- // if (this._focussedElementIndex > -1) {
51
- // const options = this.el.shadowRoot.querySelectorAll('.dropdown-option');
52
- // this.selectedField = options[this._focussedElementIndex].innerHTML;
53
- // this.emitSortEvent();
54
- // }
55
- // this.dropdownExpand = false;
56
- // break;
57
- // case 'Escape':
58
- // this.dropdownExpand = false;
59
- // break;
60
- // case 'ArrowDown':
61
- // this.dropdownExpand = true;
62
- // if (this._focussedElementIndex > -1) {
63
- // const options = this.getOptionsList();
64
- // const currentOption = options[this._focussedElementIndex] as HTMLElement;
65
- // currentOption.blur();
66
- // options[this._focussedElementIndex].focus();
67
- // this._focussedElementIndex + 1 < options.length ? this._focussedElementIndex++ : (this._focussedElementIndex = 0);
68
- // } else {
69
- // this._focussedElementIndex++;
70
- // }
71
- // break;
72
- // case 'ArrowUp':
73
- // this.dropdownExpand = true;
74
- // if (this._focussedElementIndex == -1) {
75
- // const options = this.getOptionsList();
76
- // this._focussedElementIndex = options.length - 1;
77
- // } else {
78
- // const options = this.getOptionsList();
79
- // const currentOption = options[this._focussedElementIndex] as HTMLElement;
80
- // currentOption.blur();
81
- // this._focussedElementIndex > 0 ? this._focussedElementIndex-- : (this._focussedElementIndex = options.length - 1);
82
- // options[this._focussedElementIndex].focus();
83
- // }
84
- // break;
85
- // }
86
- // }
87
- render() {
88
- const parsedFieldOptionsData = typeof this.fieldOptionsData === 'string' ? JSON.parse(this.fieldOptionsData) : this.fieldOptionsData;
89
- if (!this.fieldOptionsData)
90
- return;
91
- const arrowIcon = this.sortDirection == 'ascending' ? 'arrow_upward' : 'arrow_downward';
92
- const chevronIcon = this.dropdownExpand ? 'expand_less' : 'expand_more';
93
- const selectedOption = this.selectedField;
94
- const dropdownSelectorClassNameModifier = this.dropdownExpand ? '--expanded' : '';
95
- const sorterKey = `sorter__${this.sorterKey}`;
96
- return (h(Host, { id: sorterKey }, h("div", { tabindex: 0, class: `sorter-container ${dropdownSelectorClassNameModifier}` }, h("button", { class: "arrow-toggle-button", type: "button", onClick: this.onSortToggleClick.bind(this) }, h("tttx-icon", { icon: arrowIcon, color: "black" })), h("div", { class: "dropdown-selector", onClick: this.onDropdownClicked.bind(this) }, h("div", { class: "dropdown-selector-button" }, h("div", { class: "dropdown-selector-text" }, selectedOption), h("div", { class: "dropdown-selector-chevron" }, h("tttx-icon", { icon: chevronIcon, color: "black" })))), this.dropdownExpand && (h("div", { class: "dropdown-options-list" }, parsedFieldOptionsData.sorterOptions.map(option => {
97
- return (h("div", { class: "dropdown-option", tabIndex: -1, onClick: this.onDropdownSelected.bind(this), key: option.optionLabel }, option.optionLabel));
98
- }))))));
99
- }
100
- static get is() { return "tttx-sorter"; }
101
- static get encapsulation() { return "shadow"; }
102
- static get originalStyleUrls() {
103
- return {
104
- "$": ["tttx-sorter.scss"]
105
- };
106
- }
107
- static get styleUrls() {
108
- return {
109
- "$": ["tttx-sorter.css"]
110
- };
111
- }
112
- static get properties() {
113
- return {
114
- "sorterKey": {
115
- "type": "string",
116
- "mutable": false,
117
- "complexType": {
118
- "original": "string",
119
- "resolved": "string",
120
- "references": {}
121
- },
122
- "required": false,
123
- "optional": false,
124
- "docs": {
125
- "tags": [],
126
- "text": ""
127
- },
128
- "attribute": "sorter-key",
129
- "reflect": false
130
- },
131
- "defaultSortDirection": {
132
- "type": "string",
133
- "mutable": false,
134
- "complexType": {
135
- "original": "'ascending' | 'descending'",
136
- "resolved": "\"ascending\" | \"descending\"",
137
- "references": {}
138
- },
139
- "required": false,
140
- "optional": false,
141
- "docs": {
142
- "tags": [],
143
- "text": ""
144
- },
145
- "attribute": "default-sort-direction",
146
- "reflect": false,
147
- "defaultValue": "'descending'"
148
- },
149
- "fieldOptionsData": {
150
- "type": "string",
151
- "mutable": false,
152
- "complexType": {
153
- "original": "string | SorterData",
154
- "resolved": "SorterData | string",
155
- "references": {
156
- "SorterData": {
157
- "location": "import",
158
- "path": "./interfaces"
159
- }
160
- }
161
- },
162
- "required": false,
163
- "optional": false,
164
- "docs": {
165
- "tags": [],
166
- "text": ""
167
- },
168
- "attribute": "field-options-data",
169
- "reflect": false,
170
- "defaultValue": "null"
171
- },
172
- "defaultOption": {
173
- "type": "string",
174
- "mutable": false,
175
- "complexType": {
176
- "original": "string",
177
- "resolved": "string",
178
- "references": {}
179
- },
180
- "required": false,
181
- "optional": false,
182
- "docs": {
183
- "tags": [],
184
- "text": ""
185
- },
186
- "attribute": "default-option",
187
- "reflect": false,
188
- "defaultValue": "''"
189
- }
190
- };
191
- }
192
- static get states() {
193
- return {
194
- "selectedField": {},
195
- "sortDirection": {},
196
- "dropdownExpand": {},
197
- "dropdownOptions": {}
198
- };
199
- }
200
- static get events() {
201
- return [{
202
- "method": "sorterChangeEvent",
203
- "name": "sorterChangeEvent",
204
- "bubbles": true,
205
- "cancelable": true,
206
- "composed": true,
207
- "docs": {
208
- "tags": [],
209
- "text": ""
210
- },
211
- "complexType": {
212
- "original": "SorterChangeEvent",
213
- "resolved": "SorterChangeEvent",
214
- "references": {
215
- "SorterChangeEvent": {
216
- "location": "import",
217
- "path": "./interfaces"
218
- }
219
- }
220
- }
221
- }];
222
- }
223
- static get elementRef() { return "el"; }
224
- }
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+ import { h, Host } from '@stencil/core';
3
+ export class TttxSorter {
4
+ constructor() {
5
+ this.sorterKey = undefined;
6
+ this.defaultSortDirection = 'descending';
7
+ this.fieldOptionsData = null;
8
+ this.defaultOption = '';
9
+ this.selectedField = this.defaultOption;
10
+ this.sortDirection = this.defaultSortDirection;
11
+ this.dropdownExpand = false;
12
+ this.dropdownOptions = undefined;
13
+ }
14
+ emitSortEvent() {
15
+ this.sorterChangeEvent.emit({
16
+ sorterDirection: this.sortDirection,
17
+ sorterKey: this.sorterKey,
18
+ sortField: this.selectedField,
19
+ });
20
+ }
21
+ onSortToggleClick(event) {
22
+ event.preventDefault();
23
+ if (this.sortDirection == 'ascending') {
24
+ this.sortDirection = 'descending';
25
+ }
26
+ else {
27
+ this.sortDirection = 'ascending';
28
+ }
29
+ this.emitSortEvent();
30
+ }
31
+ onDropdownClicked() {
32
+ this.dropdownExpand = !this.dropdownExpand;
33
+ }
34
+ onDropdownSelected(event) {
35
+ this.dropdownExpand = false;
36
+ const target = event.target;
37
+ this.selectedField = target.innerHTML;
38
+ this.emitSortEvent();
39
+ }
40
+ // getOptionsList() {
41
+ // return this.el.shadowRoot.querySelectorAll('.dropdown-option');
42
+ // }
43
+ // /* istanbul ignore next */
44
+ // @Listen('keyup')
45
+ // handleKeyDown(ev: KeyboardEvent) {
46
+ // const keyboardEventValue = ev.key;
47
+ // if (document.activeElement.id != `sorter__${this.sorterKey}`) return;
48
+ // switch (keyboardEventValue) {
49
+ // case 'Enter':
50
+ // if (this._focussedElementIndex > -1) {
51
+ // const options = this.el.shadowRoot.querySelectorAll('.dropdown-option');
52
+ // this.selectedField = options[this._focussedElementIndex].innerHTML;
53
+ // this.emitSortEvent();
54
+ // }
55
+ // this.dropdownExpand = false;
56
+ // break;
57
+ // case 'Escape':
58
+ // this.dropdownExpand = false;
59
+ // break;
60
+ // case 'ArrowDown':
61
+ // this.dropdownExpand = true;
62
+ // if (this._focussedElementIndex > -1) {
63
+ // const options = this.getOptionsList();
64
+ // const currentOption = options[this._focussedElementIndex] as HTMLElement;
65
+ // currentOption.blur();
66
+ // options[this._focussedElementIndex].focus();
67
+ // this._focussedElementIndex + 1 < options.length ? this._focussedElementIndex++ : (this._focussedElementIndex = 0);
68
+ // } else {
69
+ // this._focussedElementIndex++;
70
+ // }
71
+ // break;
72
+ // case 'ArrowUp':
73
+ // this.dropdownExpand = true;
74
+ // if (this._focussedElementIndex == -1) {
75
+ // const options = this.getOptionsList();
76
+ // this._focussedElementIndex = options.length - 1;
77
+ // } else {
78
+ // const options = this.getOptionsList();
79
+ // const currentOption = options[this._focussedElementIndex] as HTMLElement;
80
+ // currentOption.blur();
81
+ // this._focussedElementIndex > 0 ? this._focussedElementIndex-- : (this._focussedElementIndex = options.length - 1);
82
+ // options[this._focussedElementIndex].focus();
83
+ // }
84
+ // break;
85
+ // }
86
+ // }
87
+ render() {
88
+ const parsedFieldOptionsData = typeof this.fieldOptionsData === 'string' ? JSON.parse(this.fieldOptionsData) : this.fieldOptionsData;
89
+ if (!this.fieldOptionsData)
90
+ return;
91
+ const arrowIcon = this.sortDirection == 'ascending' ? 'arrow_upward' : 'arrow_downward';
92
+ const chevronIcon = this.dropdownExpand ? 'expand_less' : 'expand_more';
93
+ const selectedOption = this.selectedField;
94
+ const dropdownSelectorClassNameModifier = this.dropdownExpand ? '--expanded' : '';
95
+ const sorterKey = `sorter__${this.sorterKey}`;
96
+ return (h(Host, { id: sorterKey }, h("div", { tabindex: 0, class: `sorter-container ${dropdownSelectorClassNameModifier}` }, h("button", { class: "arrow-toggle-button", type: "button", onClick: this.onSortToggleClick.bind(this) }, h("tttx-icon", { icon: arrowIcon, color: "black" })), h("div", { class: "dropdown-selector", onClick: this.onDropdownClicked.bind(this) }, h("div", { class: "dropdown-selector-button" }, h("div", { class: "dropdown-selector-text" }, selectedOption), h("div", { class: "dropdown-selector-chevron" }, h("tttx-icon", { icon: chevronIcon, color: "black" })))), this.dropdownExpand && (h("div", { class: "dropdown-options-list" }, parsedFieldOptionsData.sorterOptions.map(option => {
97
+ return (h("div", { class: "dropdown-option", tabIndex: -1, onClick: this.onDropdownSelected.bind(this), key: option.optionLabel }, option.optionLabel));
98
+ }))))));
99
+ }
100
+ static get is() { return "tttx-sorter"; }
101
+ static get encapsulation() { return "shadow"; }
102
+ static get originalStyleUrls() {
103
+ return {
104
+ "$": ["tttx-sorter.scss"]
105
+ };
106
+ }
107
+ static get styleUrls() {
108
+ return {
109
+ "$": ["tttx-sorter.css"]
110
+ };
111
+ }
112
+ static get properties() {
113
+ return {
114
+ "sorterKey": {
115
+ "type": "string",
116
+ "mutable": false,
117
+ "complexType": {
118
+ "original": "string",
119
+ "resolved": "string",
120
+ "references": {}
121
+ },
122
+ "required": false,
123
+ "optional": false,
124
+ "docs": {
125
+ "tags": [],
126
+ "text": ""
127
+ },
128
+ "attribute": "sorter-key",
129
+ "reflect": false
130
+ },
131
+ "defaultSortDirection": {
132
+ "type": "string",
133
+ "mutable": false,
134
+ "complexType": {
135
+ "original": "'ascending' | 'descending'",
136
+ "resolved": "\"ascending\" | \"descending\"",
137
+ "references": {}
138
+ },
139
+ "required": false,
140
+ "optional": false,
141
+ "docs": {
142
+ "tags": [],
143
+ "text": ""
144
+ },
145
+ "attribute": "default-sort-direction",
146
+ "reflect": false,
147
+ "defaultValue": "'descending'"
148
+ },
149
+ "fieldOptionsData": {
150
+ "type": "string",
151
+ "mutable": false,
152
+ "complexType": {
153
+ "original": "string | SorterData",
154
+ "resolved": "SorterData | string",
155
+ "references": {
156
+ "SorterData": {
157
+ "location": "import",
158
+ "path": "./interfaces"
159
+ }
160
+ }
161
+ },
162
+ "required": false,
163
+ "optional": false,
164
+ "docs": {
165
+ "tags": [],
166
+ "text": ""
167
+ },
168
+ "attribute": "field-options-data",
169
+ "reflect": false,
170
+ "defaultValue": "null"
171
+ },
172
+ "defaultOption": {
173
+ "type": "string",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "string",
177
+ "resolved": "string",
178
+ "references": {}
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": ""
185
+ },
186
+ "attribute": "default-option",
187
+ "reflect": false,
188
+ "defaultValue": "''"
189
+ }
190
+ };
191
+ }
192
+ static get states() {
193
+ return {
194
+ "selectedField": {},
195
+ "sortDirection": {},
196
+ "dropdownExpand": {},
197
+ "dropdownOptions": {}
198
+ };
199
+ }
200
+ static get events() {
201
+ return [{
202
+ "method": "sorterChangeEvent",
203
+ "name": "sorterChangeEvent",
204
+ "bubbles": true,
205
+ "cancelable": true,
206
+ "composed": true,
207
+ "docs": {
208
+ "tags": [],
209
+ "text": ""
210
+ },
211
+ "complexType": {
212
+ "original": "SorterChangeEvent",
213
+ "resolved": "SorterChangeEvent",
214
+ "references": {
215
+ "SorterChangeEvent": {
216
+ "location": "import",
217
+ "path": "./interfaces"
218
+ }
219
+ }
220
+ }
221
+ }];
222
+ }
223
+ static get elementRef() { return "el"; }
224
+ }
@@ -1,26 +1,26 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
- export default {
3
- title: 'molecules/Sorter',
4
- component: 'tttx-sorter',
5
- argTypes: {
6
- fieldOptionsData: {
7
- control: { type: 'object' },
8
- },
9
- defaultOption: {
10
- control: { type: 'text' },
11
- },
12
- sorterKey: {
13
- control: { type: 'text' },
14
- },
15
- },
16
- parameters: {
17
- actions: {
18
- handles: ['sorterChangeEvent'],
19
- },
20
- },
21
- decorators: [withActions],
22
- };
23
- const TemplateSorter = ({ fieldOptionsData, sorterKey, defaultOption }) => {
1
+ import { withActions } from '@storybook/addon-actions/decorator';
2
+ export default {
3
+ title: 'molecules/Sorter',
4
+ component: 'tttx-sorter',
5
+ argTypes: {
6
+ fieldOptionsData: {
7
+ control: { type: 'object' },
8
+ },
9
+ defaultOption: {
10
+ control: { type: 'text' },
11
+ },
12
+ sorterKey: {
13
+ control: { type: 'text' },
14
+ },
15
+ },
16
+ parameters: {
17
+ actions: {
18
+ handles: ['sorterChangeEvent'],
19
+ },
20
+ },
21
+ decorators: [withActions],
22
+ };
23
+ const TemplateSorter = ({ fieldOptionsData, sorterKey, defaultOption }) => {
24
24
  return `
25
25
  <div style='width: 250px;'>
26
26
  <tttx-sorter
@@ -28,22 +28,22 @@ const TemplateSorter = ({ fieldOptionsData, sorterKey, defaultOption }) => {
28
28
  default-option='${defaultOption}'
29
29
  sorter-key='${sorterKey}'/>
30
30
  </div>
31
- `;
32
- };
33
- const fieldOptionsData = {
34
- sorterOptions: [{ optionLabel: 'Expiry date' }, { optionLabel: 'Qualification name' }],
35
- };
36
- export const BasicSorter = TemplateSorter.bind({});
37
- BasicSorter.args = {
38
- fieldOptionsData: fieldOptionsData,
39
- sorterKey: 'BasicDropdown',
40
- defaultOption: 'Qualification name',
41
- };
42
- export const AnotherSorter = TemplateSorter.bind({});
43
- AnotherSorter.args = {
44
- fieldOptionsData: {
45
- sorterOptions: [{ optionLabel: 'Name' }, { optionLabel: 'Date of Birth' }, { optionLabel: 'Job Role' }],
46
- },
47
- sorterKey: 'BasicDropdown',
48
- defaultOption: 'Date of Birth',
49
- };
31
+ `;
32
+ };
33
+ const fieldOptionsData = {
34
+ sorterOptions: [{ optionLabel: 'Expiry date' }, { optionLabel: 'Qualification name' }],
35
+ };
36
+ export const BasicSorter = TemplateSorter.bind({});
37
+ BasicSorter.args = {
38
+ fieldOptionsData: fieldOptionsData,
39
+ sorterKey: 'BasicDropdown',
40
+ defaultOption: 'Qualification name',
41
+ };
42
+ export const AnotherSorter = TemplateSorter.bind({});
43
+ AnotherSorter.args = {
44
+ fieldOptionsData: {
45
+ sorterOptions: [{ optionLabel: 'Name' }, { optionLabel: 'Date of Birth' }, { optionLabel: 'Job Role' }],
46
+ },
47
+ sorterKey: 'BasicDropdown',
48
+ defaultOption: 'Date of Birth',
49
+ };