@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
@@ -63,6 +63,18 @@ const isComplexType = (o) => {
63
63
  o = typeof o;
64
64
  return o === 'object' || o === 'function';
65
65
  };
66
+ /**
67
+ * Helper method for querying a `meta` tag that contains a nonce value
68
+ * out of a DOM's head.
69
+ *
70
+ * @param doc The DOM containing the `head` to query against
71
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
72
+ * exists or the tag has no content.
73
+ */
74
+ function queryNonceMetaTagContent(doc) {
75
+ var _a, _b, _c;
76
+ return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
77
+ }
66
78
  /**
67
79
  * Production h() function based on Preact by
68
80
  * Jason Miller (@developit)
@@ -71,7 +83,6 @@ const isComplexType = (o) => {
71
83
  *
72
84
  * Modified for Stencil's compiler and vdom
73
85
  */
74
- // const stack: any[] = [];
75
86
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
76
87
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
77
88
  const h = (nodeName, vnodeData, ...children) => {
@@ -130,6 +141,14 @@ const h = (nodeName, vnodeData, ...children) => {
130
141
  }
131
142
  return vnode;
132
143
  };
144
+ /**
145
+ * A utility function for creating a virtual DOM node from a tag and some
146
+ * possible text content.
147
+ *
148
+ * @param tag the tag for this element
149
+ * @param text possible text content for the node
150
+ * @returns a newly-minted virtual DOM node
151
+ */
133
152
  const newVNode = (tag, text) => {
134
153
  const vnode = {
135
154
  $flags$: 0,
@@ -147,6 +166,12 @@ const newVNode = (tag, text) => {
147
166
  return vnode;
148
167
  };
149
168
  const Host = {};
169
+ /**
170
+ * Check whether a given node is a Host node or not
171
+ *
172
+ * @param node the virtual DOM node to check
173
+ * @returns whether it's a Host node or not
174
+ */
150
175
  const isHost = (node) => node && node.$tag$ === Host;
151
176
  /**
152
177
  * Parse a new property value for a given property type.
@@ -235,6 +260,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
235
260
  styles.set(scopeId, style);
236
261
  };
237
262
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
263
+ var _a;
238
264
  let scopeId = getScopeId(cmpMeta);
239
265
  const style = styles.get(scopeId);
240
266
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -254,6 +280,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
254
280
  styleElm = doc.createElement('style');
255
281
  styleElm.innerHTML = style;
256
282
  }
283
+ // Apply CSP nonce to the style tag if it exists
284
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
285
+ if (nonce != null) {
286
+ styleElm.setAttribute('nonce', nonce);
287
+ }
257
288
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
258
289
  }
259
290
  if (appliedStyles) {
@@ -488,6 +519,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
488
519
  }
489
520
  return elm;
490
521
  };
522
+ /**
523
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
524
+ * add them to the DOM in the appropriate place.
525
+ *
526
+ * @param parentElm the DOM node which should be used as a parent for the new
527
+ * DOM nodes
528
+ * @param before a child of the `parentElm` which the new children should be
529
+ * inserted before (optional)
530
+ * @param parentVNode the parent virtual DOM node
531
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
532
+ * @param startIdx the index in the child virtual DOM nodes at which to start
533
+ * creating DOM nodes (inclusive)
534
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
535
+ * creating DOM nodes (inclusive)
536
+ */
491
537
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
492
538
  let containerElm = (parentElm);
493
539
  let childNode;
@@ -504,6 +550,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
504
550
  }
505
551
  }
506
552
  };
553
+ /**
554
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
555
+ * This can be used to, for instance, clean up after a list of children which
556
+ * should no longer be shown.
557
+ *
558
+ * This function also handles some of Stencil's slot relocation logic.
559
+ *
560
+ * @param vnodes a list of virtual DOM nodes to remove
561
+ * @param startIdx the index at which to start removing nodes (inclusive)
562
+ * @param endIdx the index at which to stop removing nodes (inclusive)
563
+ * @param vnode a VNode
564
+ * @param elm an element
565
+ */
507
566
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
508
567
  for (; startIdx <= endIdx; ++startIdx) {
509
568
  if ((vnode = vnodes[startIdx])) {
@@ -733,7 +792,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
733
792
  *
734
793
  * So, in other words, if `key` attrs are not set on VNodes which may be
735
794
  * changing order within a `children` array or something along those lines then
736
- * we could obtain a false positive and then have to do needless re-rendering.
795
+ * we could obtain a false negative and then have to do needless re-rendering
796
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
737
797
  *
738
798
  * @param leftVNode the first VNode to check
739
799
  * @param rightVNode the second VNode to check
@@ -806,6 +866,18 @@ const callNodeRefs = (vNode) => {
806
866
  vNode.$children$ && vNode.$children$.map(callNodeRefs);
807
867
  }
808
868
  };
869
+ /**
870
+ * The main entry point for Stencil's virtual DOM-based rendering engine
871
+ *
872
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
873
+ * function will handle creating a virtual DOM tree with a single root, patching
874
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
875
+ * relocation, and reflecting attributes.
876
+ *
877
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
878
+ * the DOM node into which it should be rendered.
879
+ * @param renderFnResults the virtual DOM nodes to be rendered
880
+ */
809
881
  const renderVdom = (hostRef, renderFnResults) => {
810
882
  const hostElm = hostRef.$hostElement$;
811
883
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -942,6 +1014,9 @@ const postUpdateComponent = (hostRef) => {
942
1014
  else {
943
1015
  endPostUpdate();
944
1016
  }
1017
+ {
1018
+ hostRef.$onInstanceResolve$(elm);
1019
+ }
945
1020
  // load events fire from bottom to top
946
1021
  // the deepest elements load first then bubbles up
947
1022
  {
@@ -1060,6 +1135,16 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1060
1135
  enumerable: true,
1061
1136
  });
1062
1137
  }
1138
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1139
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1140
+ // proxyComponent - method
1141
+ Object.defineProperty(prototype, memberName, {
1142
+ value(...args) {
1143
+ const ref = getHostRef(this);
1144
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
1145
+ },
1146
+ });
1147
+ }
1063
1148
  });
1064
1149
  if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1065
1150
  const attrNameToPropName = new Map();
@@ -1252,6 +1337,7 @@ const disconnectedCallback = (elm) => {
1252
1337
  }
1253
1338
  };
1254
1339
  const bootstrapLazy = (lazyBundles, options = {}) => {
1340
+ var _a;
1255
1341
  const endBootstrap = createTime();
1256
1342
  const cmpTags = [];
1257
1343
  const exclude = options.exclude || [];
@@ -1330,6 +1416,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1330
1416
  {
1331
1417
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1332
1418
  visibilityStyle.setAttribute('data-styles', '');
1419
+ // Apply CSP nonce to the style tag if it exists
1420
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1421
+ if (nonce != null) {
1422
+ visibilityStyle.setAttribute('nonce', nonce);
1423
+ }
1333
1424
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1334
1425
  }
1335
1426
  // Process deferred connectedCallbacks now all components have been registered
@@ -1345,6 +1436,13 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1345
1436
  // Fallback appLoad event
1346
1437
  endBootstrap();
1347
1438
  };
1439
+ /**
1440
+ * Assigns the given value to the nonce property on the runtime platform object.
1441
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1442
+ * @param nonce The value to be assigned to the platform nonce property.
1443
+ * @returns void
1444
+ */
1445
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1348
1446
  const hostRefs = /*@__PURE__*/ new WeakMap();
1349
1447
  const getHostRef = (ref) => hostRefs.get(ref);
1350
1448
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1355,6 +1453,9 @@ const registerHost = (elm, cmpMeta) => {
1355
1453
  $cmpMeta$: cmpMeta,
1356
1454
  $instanceValues$: new Map(),
1357
1455
  };
1456
+ {
1457
+ hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
1458
+ }
1358
1459
  {
1359
1460
  hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1360
1461
  elm['s-p'] = [];
@@ -1458,3 +1559,4 @@ exports.getElement = getElement;
1458
1559
  exports.h = h;
1459
1560
  exports.promiseResolve = promiseResolve;
1460
1561
  exports.registerInstance = registerInstance;
1562
+ exports.setNonce = setNonce;
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-dc6cc829.js');
5
+ const index = require('./index-457ca775.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Esm v2.20.0 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Esm v2.22.3 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
  const patchEsm = () => {
11
11
  return index.promiseResolve();
@@ -14,8 +14,9 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["tttx-icon.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"design":[1]}]]],["tttx-filter.cjs",[[1,"tttx-filter",{"filterKey":[1,"filter-key"],"filterOptions":[1,"filter-options"],"showSelectAll":[4,"show-select-all"],"showSearchField":[4,"show-search-field"],"showOptionIcons":[4,"show-option-icons"],"filterButtonStyle":[1,"filter-button-style"],"filterHeader":[1,"filter-header"],"showPopover":[32],"displayedFilterSettings":[32],"selectedFilters":[32],"filterSearchTerm":[32],"allSelected":[32]}]]],["tttx-list.cjs",[[1,"tttx-list",{"data":[1025],"name":[1]}]]],["tttx-sorter.cjs",[[1,"tttx-sorter",{"sorterKey":[1,"sorter-key"],"defaultSortDirection":[1,"default-sort-direction"],"fieldOptionsData":[1,"field-options-data"],"defaultOption":[1,"default-option"],"selectedField":[32],"sortDirection":[32],"dropdownExpand":[32],"dropdownOptions":[32]}]]],["tttx-standalone-input.cjs",[[2,"tttx-standalone-input",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconright":[1],"inputicon":[1],"inline":[4],"inputautocapitalize":[1],"inputautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1032],"submitValue":[1032,"submit-value"]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[8],"horizontal":[4]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-toolbar.cjs",[[1,"tttx-toolbar",{"border":[4]}]]]], options);
17
+ return index.bootstrapLazy([["tttx-icon.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"design":[1]}]]],["tttx-filter.cjs",[[1,"tttx-filter",{"filterKey":[1,"filter-key"],"filterOptions":[1,"filter-options"],"showSelectAll":[4,"show-select-all"],"showSearchField":[4,"show-search-field"],"showOptionIcons":[4,"show-option-icons"],"filterButtonStyle":[1,"filter-button-style"],"filterHeader":[1,"filter-header"],"showPopover":[32],"displayedFilterSettings":[32],"selectedFilters":[32],"filterSearchTerm":[32],"allSelected":[32]}]]],["tttx-list.cjs",[[1,"tttx-list",{"data":[1025],"name":[1]}]]],["tttx-sorter.cjs",[[1,"tttx-sorter",{"sorterKey":[1,"sorter-key"],"defaultSortDirection":[1,"default-sort-direction"],"fieldOptionsData":[1,"field-options-data"],"defaultOption":[1,"default-option"],"selectedField":[32],"sortDirection":[32],"dropdownExpand":[32],"dropdownOptions":[32]}]]],["tttx-standalone-input.cjs",[[2,"tttx-standalone-input",{"label":[1],"secondarylabel":[1],"showerrormsg":[4],"showerrorbubble":[4],"errormsg":[1],"iconleft":[1],"iconright":[1],"inputicon":[1],"inline":[4],"inputautocapitalize":[1],"inputautofocus":[4],"inputkeyhint":[1],"inputindex":[8],"inputtitle":[1],"autocomplete":[1],"checked":[4],"disabled":[4],"max":[8],"maxlength":[8],"min":[8],"minlength":[8],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[8],"required":[4],"step":[8],"type":[1],"value":[1032]}]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1032],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[8],"horizontal":[4]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-toolbar.cjs",[[1,"tttx-toolbar",{"border":[4]}]]]], options);
18
18
  });
19
19
  };
20
20
 
21
+ exports.setNonce = index.setNonce;
21
22
  exports.defineCustomElements = defineCustomElements;
@@ -2,33 +2,33 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-dc6cc829.js');
5
+ const index = require('./index-457ca775.js');
6
6
 
7
7
  const tttxButtonCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.button{font-family:Roboto, serif;box-sizing:border-box;height:36px;min-width:36px;padding:0;margin:0;background:transparent;color:#212121;border:1px solid #c8c8c8;border-radius:4px;text-transform:uppercase;display:flex;justify-content:left;align-items:center;font-size:14px;font-weight:400}.button-content{display:block;padding:0 16px}.icon-left,.icon-right{margin-top:4px}.iconleft{padding-left:8px}.iconleft .button-content{padding-left:4px}.iconright{padding-right:8px}.iconright .button-content{padding-right:4px}.notext{padding:0 6px}.button:hover{background:rgba(17, 17, 17, 0.1);border:1px solid #D5D5D5}.button:active{background:rgba(17, 17, 17, 0.2);border:1px solid #D5D5D5}.primary{background:#1479c6;border:1px solid #1479c6;color:white}.primary:hover{background:#146EB3;border:1px solid #146EB3}.primary:active{background:#1464A2;border:1px solid #1464A2}.borderless{background:transparent;border:none;color:#212121}.borderless:hover{background:rgba(17, 17, 17, 0.1);border:none}.borderless:active{background:rgba(17, 17, 17, 0.2);border:none}.danger{background:#DC0000;border:1px solid #DC0000;color:white}.danger:hover{background:#C60000;border:1px solid #C60000}.danger:active{background:#B00000;border:1px solid #B00000}.disabled{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}.disabled:hover{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}.disabled:active{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}:host{display:inline-block}button{cursor:pointer}tttx-icon{cursor:inherit}.spacingleft{margin-left:8px}";
8
8
 
9
- const TttxButton = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- this._iconcolor = 'black';
13
- this.notext = undefined;
14
- this.icon = undefined;
15
- this.iconposition = 'left';
16
- this.design = 'default';
17
- }
18
- componentWillLoad() {
19
- this._design = this.design;
20
- const designs = ['primary', 'default', 'disabled', 'danger', 'borderless'];
21
- if (!designs.includes(this.design)) {
22
- this._design = 'default';
23
- }
24
- if (this._design === 'primary' || this._design === 'danger') {
25
- this._iconcolor = 'white';
26
- }
27
- }
28
- render() {
29
- return (index.h(index.Host, null, index.h("button", { class: `button ${this._design} ${this.icon ? 'withicon' : ''} ${this.icon && this.iconposition ? 'icon' + this.iconposition : ''} ${this.notext ? 'notext' : ''}` }, this.icon && this.iconposition === 'left' && (index.h("div", { class: "icon-left" }, index.h("tttx-icon", { icon: this.icon, color: this._iconcolor }))), !this.notext && index.h("div", { class: "button-content" }, index.h("slot", null)), this.icon && this.iconposition === 'right' && (index.h("div", { class: "icon-right" }, index.h("tttx-icon", { icon: this.icon, color: this._iconcolor }))))));
30
- }
31
- };
9
+ const TttxButton = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this._iconcolor = 'black';
13
+ this.notext = undefined;
14
+ this.icon = undefined;
15
+ this.iconposition = 'left';
16
+ this.design = 'default';
17
+ }
18
+ componentWillLoad() {
19
+ this._design = this.design;
20
+ const designs = ['primary', 'default', 'disabled', 'danger', 'borderless'];
21
+ if (!designs.includes(this.design)) {
22
+ this._design = 'default';
23
+ }
24
+ if (this._design === 'primary' || this._design === 'danger') {
25
+ this._iconcolor = 'white';
26
+ }
27
+ }
28
+ render() {
29
+ return (index.h(index.Host, null, index.h("button", { class: `button ${this._design} ${this.icon ? 'withicon' : ''} ${this.icon && this.iconposition ? 'icon' + this.iconposition : ''} ${this.notext ? 'notext' : ''}` }, this.icon && this.iconposition === 'left' && (index.h("div", { class: "icon-left" }, index.h("tttx-icon", { icon: this.icon, color: this._iconcolor }))), !this.notext && index.h("div", { class: "button-content" }, index.h("slot", null)), this.icon && this.iconposition === 'right' && (index.h("div", { class: "icon-right" }, index.h("tttx-icon", { icon: this.icon, color: this._iconcolor }))))));
30
+ }
31
+ };
32
32
  TttxButton.style = tttxButtonCss;
33
33
 
34
34
  exports.tttx_button = TttxButton;
@@ -2,168 +2,168 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-dc6cc829.js');
5
+ const index = require('./index-457ca775.js');
6
6
 
7
7
  const tttxFilterCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}.filter-container{background-color:white;position:relative}.filter-container .filter-button{display:inline-flex;justify-content:center;align-items:center;font-size:14px;font-weight:400;font-family:\"Roboto\", serif;text-transform:uppercase;color:#212121;border:1px solid #d5d5d5;border-radius:4px;background:transparent;height:36px;width:95px;margin:0;padding-right:16px}.filter-container .filter-button .filter-icon{padding-left:8px;padding-right:4px}.filter-container .filter-button.--list-icon{font-size:0;width:36px;height:36px;padding:0}.filter-container .filter-button.--list-icon .filter-icon{padding:0}.filter-container .filter-button.--list-icon:hover{background:#e3e3e3}.filter-container .filter-button.--table-icon{font-size:0;width:36px;height:36px;padding:0;border:none}.filter-container .filter-button.--table-icon .filter-icon{padding:0;width:24px;height:24px}.filter-container .filter-button.--table-icon:hover{background:#e3e3e3;border-radius:50%;width:36px;height:36px}.filter-container .filter-button:hover{background:#e3e3e3}.filter-container .filter-popover-container{display:flex;flex-direction:column;gap:8px;border-radius:4px;box-shadow:0px 1px 5px #1111114D;position:absolute;top:36px;left:0px;background-color:white;padding:0 16px}.filter-container .filter-popover-container .filter-header{color:#757575;text-transform:uppercase;font-size:14px;font-weight:500;font-family:\"Roboto\", serif;padding:12px 0}.filter-container .filter-popover-container .filter-options-container{display:flex;flex-direction:column;gap:4px;border-top:1px solid #d5d5d5;border-bottom:1px solid #d5d5d5}.filter-container .filter-popover-container .filter-option{display:flex;flex-direction:row;align-items:center;min-height:36px;padding-left:8px}.filter-container .filter-popover-container .filter-option .select-all-icon{padding-right:6px}.filter-container .filter-popover-container .filter-option .checkbox-icon{padding-right:8px}.filter-container .filter-popover-container .filter-option .filter-label{padding-left:8px;padding-bottom:3px;font-size:16px;font-weight:500;font-family:\"Roboto\", serif}.filter-container .filter-popover-container .filter-option:first-child{padding-top:8px}.filter-container .filter-popover-container .filter-popover-button-container{display:flex;justify-content:flex-end;align-items:center;padding-bottom:8px}.filter-container .filter-popover-container .filter-popover-button-container .close-button{height:36px;width:74px;background-color:white;border:1px solid #d5d5d5;border-radius:4px;text-transform:uppercase;margin-right:8px;font-size:14px;font-weight:400;font-family:\"Roboto\", serif}.filter-container .filter-popover-container .filter-popover-button-container .apply-button{height:36px;width:73px;background-color:#1479c6;color:white;border-radius:4px;border:none;text-transform:uppercase;font-size:14px;font-weight:400;font-family:\"Roboto\", serif}.filter-container .filter-popover-container.--with-search-field .filter-header{border-bottom:1px solid #d5d5d5}.filter-container .filter-popover-container.--with-search-field .search-field-container{position:relative;color:#d5d5d5;height:36px}.filter-container .filter-popover-container.--with-search-field .search-field-container .search-icon{position:absolute;top:6px;left:8px}.filter-container .filter-popover-container.--with-search-field .search-field-container .search-input{padding-left:36px;border:1px solid #d5d5d5;border-radius:4px;height:36px;font-size:16px;font-family:\"Roboto\", serif;font-weight:500;box-sizing:border-box}.filter-container .filter-popover-container.--with-search-field .search-field-container .search-input:focus-visible,.filter-container .filter-popover-container.--with-search-field .search-field-container .search-input:focus{outline:none;border:1px solid #1479c6}.filter-container .filter-popover-container.--with-search-field .search-field-container .search-input::placeholder{color:#9e9e9e;font-size:16px;font-family:\"Roboto\", serif;font-weight:500}";
8
8
 
9
- const TttxFilter = class {
10
- constructor(hostRef) {
11
- index.registerInstance(this, hostRef);
12
- this.filterChangeEvent = index.createEvent(this, "filterChangeEvent", 7);
13
- this.filterKey = undefined;
14
- this.filterOptions = [
15
- { optionIcon: 'cancel', optionIconColor: 'darkred', optionText: 'Expired' },
16
- { optionIcon: 'warning', optionIconColor: 'orange', optionText: 'Expiring soon' },
17
- { optionIcon: 'check_circle', optionIconColor: 'green', optionText: 'Active' },
18
- ];
19
- this.showSelectAll = true;
20
- this.showSearchField = false;
21
- this.showOptionIcons = true;
22
- this.filterButtonStyle = 'list filter';
23
- this.filterHeader = 'Qualification status';
24
- this.showPopover = false;
25
- this.displayedFilterSettings = undefined;
26
- this.selectedFilters = undefined;
27
- this.filterSearchTerm = '';
28
- this.allSelected = true;
29
- }
30
- emitFilterEvent() {
31
- this.filterChangeEvent.emit({
32
- selectedFilters: this.selectedFilters,
33
- filterKey: this.filterKey,
34
- allSelected: this.allSelected,
35
- });
36
- }
37
- onFilterButtonClick() {
38
- this.togglePopover();
39
- }
40
- onCloseButtonClick() {
41
- this.togglePopover();
42
- }
43
- onApplyFilterButtonClick() {
44
- this.emitFilterEvent();
45
- this.togglePopover();
46
- }
47
- onFilterOptionSelected(selectedOption) {
48
- this.allSelected = false;
49
- if (this.selectedFilters.includes(selectedOption)) {
50
- this.selectedFilters = this.selectedFilters.filter((filter) => filter != selectedOption);
51
- }
52
- else {
53
- this.selectedFilters = [...this.selectedFilters, selectedOption];
54
- }
55
- }
56
- componentWillLoad() {
57
- this.displayedFilterSettings = this.parseFilterOptions();
58
- this.selectedFilters = this.displayedFilterSettings.map((filterOption) => filterOption.optionText);
59
- }
60
- togglePopover() {
61
- this.showPopover = !this.showPopover;
62
- // if(!this.showPopover) {
63
- // // this._focussedElementIndex = -1;
64
- // }
65
- }
66
- // Commented out keyboard interaction for now
67
- // @Listen('keyup')
68
- // handleKeyUp(event: KeyboardEvent) {
69
- // const keyboardEventValue = event.key;
70
- // if (document.activeElement.id != `filter__${this.filterKey}`) return;
71
- // if (event.key == " " || event.code == "Space" || event.keyCode == 32) {
72
- // if (this._focussedElementIndex == 0) {
73
- // this.onSelectAllClick()
74
- // } else {
75
- // const options = this.el.shadowRoot.querySelectorAll('.filter-option') as HTMLElement[];
76
- // this.onFilterOptionSelected(options[this._focussedElementIndex].textContent)
77
- // }
78
- // return;
79
- // }
80
- // switch (keyboardEventValue) {
81
- // case 'Enter':
82
- // if(!this.showPopover) {
83
- // this.showPopover=true
84
- // } else {
85
- // this.emitFilterEvent()
86
- // }
87
- // break;
88
- // case 'Escape':
89
- // this.showPopover = false;
90
- // this._focussedElementIndex = -1;
91
- // break;
92
- // case 'ArrowDown':
93
- // this.showPopover = true;
94
- // if (this._focussedElementIndex == -1) {
95
- // this._focussedElementIndex = 0;
96
- // } else {
97
- // const options = this.el.shadowRoot.querySelectorAll('.filter-option') as HTMLElement[];
98
- // const currentOption = options[this._focussedElementIndex] as HTMLElement;
99
- // currentOption.blur();
100
- // // options[this._focussedElementIndex].focus();
101
- // this._focussedElementIndex + 1 < options.length ? this._focussedElementIndex++ : (this._focussedElementIndex = 0);
102
- // }
103
- // break;
104
- // case 'ArrowUp':
105
- // if (this._focussedElementIndex == -1) {
106
- // this.showPopover = true;
107
- // this._focussedElementIndex = 0;
108
- // } else {
109
- // const options = this.el.shadowRoot.querySelectorAll('.filter-option') as HTMLElement[];
110
- // const currentOption = options[this._focussedElementIndex] as HTMLElement;
111
- // currentOption.blur();
112
- // // options[this._focussedElementIndex].focus();
113
- // this._focussedElementIndex > 0 ? this._focussedElementIndex-- : (this._focussedElementIndex = options.length - 1);
114
- // }
115
- // break;
116
- // }
117
- // }
118
- handleFilterChange(event) {
119
- const target = event.target;
120
- this.filterSearchTerm = target.value;
121
- const filteredResults = this.parseFilterOptions().filter((filterOption) => {
122
- const lowercaseOption = filterOption.optionText.toLowerCase();
123
- const filterTerm = this.filterSearchTerm.toLowerCase();
124
- return lowercaseOption.includes(filterTerm);
125
- });
126
- this.displayedFilterSettings = filteredResults;
127
- }
128
- onSelectAllClick() {
129
- this.allSelected = !this.allSelected;
130
- if (this.allSelected) {
131
- this.displayedFilterSettings.forEach((filterSetting) => { this.selectedFilters = [...this.selectedFilters, filterSetting.optionText]; });
132
- }
133
- else {
134
- this.selectedFilters = [];
135
- }
136
- }
137
- getFilterButtonClassName(buttonStyle) {
138
- switch (buttonStyle) {
139
- case 'table icon': {
140
- return '--table-icon';
141
- }
142
- case 'list icon': {
143
- return '--list-icon';
144
- }
145
- default: {
146
- return '';
147
- }
148
- }
149
- }
150
- parseFilterOptions() {
151
- return typeof this.filterOptions === 'string' ? JSON.parse(this.filterOptions) : this.filterOptions;
152
- }
153
- render() {
154
- const filterPopoverContainerClassNameModifier = this.showSearchField ? '--with-search-field' : '';
155
- const selectAllCheckboxIcon = this.allSelected ? 'check_box' : 'check_box_outline_blank';
156
- const selectAllCheckboxColor = this.allSelected ? 'blue' : 'grey';
157
- const buttonStyleClassNameModifier = this.getFilterButtonClassName(this.filterButtonStyle);
158
- const filterKey = `filter__${this.filterKey}`;
159
- return (index.h(index.Host, { id: filterKey }, index.h("div", { class: 'filter-container' }, index.h("button", { class: `filter-button ${buttonStyleClassNameModifier}`, type: 'button', onClick: this.onFilterButtonClick.bind(this) }, index.h("tttx-icon", { icon: 'filter_list', class: 'filter-icon', color: 'black' }), "Filter"), this.showPopover && (index.h("div", { class: `filter-popover-container ${filterPopoverContainerClassNameModifier}` }, index.h("div", { class: 'filter-header' }, this.filterHeader), this.showSearchField ? (index.h("div", { class: 'search-field-container' }, index.h("tttx-icon", { icon: 'search', class: 'search-icon' }), index.h("input", { type: 'text', class: 'search-input', placeholder: 'Search', value: this.filterSearchTerm, onInput: this.handleFilterChange.bind(this) }))) : (''), index.h("div", { class: 'filter-options-container' }, this.showSelectAll ? (index.h("div", { class: 'filter-option', tabIndex: -1, onClick: this.onSelectAllClick.bind(this) }, index.h("tttx-icon", { icon: selectAllCheckboxIcon, color: selectAllCheckboxColor, class: 'select-all-icon' }), index.h("label", { class: 'filter-label' }, "Select all"))) : (''), this.displayedFilterSettings.map((option) => {
160
- const checkboxIcon = this.selectedFilters.includes(option.optionText) ? 'check_box' : 'check_box_outline_blank';
161
- const checkboxColor = this.selectedFilters.includes(option.optionText) ? 'blue' : 'grey';
162
- return index.h("div", { class: 'filter-option', tabIndex: -1, onClick: () => this.onFilterOptionSelected(option.optionText), key: option.optionText }, index.h("tttx-icon", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), this.showOptionIcons && index.h("tttx-icon", { icon: option.optionIcon, color: option.optionIconColor }), index.h("label", { class: 'filter-label' }, option.optionText));
163
- })), index.h("div", { class: 'filter-popover-button-container' }, index.h("button", { type: 'button', class: 'close-button', onClick: this.onCloseButtonClick.bind(this) }, "Close"), index.h("button", { type: 'button', class: 'apply-button', onClick: this.onApplyFilterButtonClick.bind(this) }, "Apply")))))));
164
- }
165
- get el() { return index.getElement(this); }
166
- };
9
+ const TttxFilter = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.filterChangeEvent = index.createEvent(this, "filterChangeEvent", 7);
13
+ this.filterKey = undefined;
14
+ this.filterOptions = [
15
+ { optionIcon: 'cancel', optionIconColor: 'darkred', optionText: 'Expired' },
16
+ { optionIcon: 'warning', optionIconColor: 'orange', optionText: 'Expiring soon' },
17
+ { optionIcon: 'check_circle', optionIconColor: 'green', optionText: 'Active' },
18
+ ];
19
+ this.showSelectAll = true;
20
+ this.showSearchField = false;
21
+ this.showOptionIcons = true;
22
+ this.filterButtonStyle = 'list filter';
23
+ this.filterHeader = 'Qualification status';
24
+ this.showPopover = false;
25
+ this.displayedFilterSettings = undefined;
26
+ this.selectedFilters = undefined;
27
+ this.filterSearchTerm = '';
28
+ this.allSelected = true;
29
+ }
30
+ emitFilterEvent() {
31
+ this.filterChangeEvent.emit({
32
+ selectedFilters: this.selectedFilters,
33
+ filterKey: this.filterKey,
34
+ allSelected: this.allSelected,
35
+ });
36
+ }
37
+ onFilterButtonClick() {
38
+ this.togglePopover();
39
+ }
40
+ onCloseButtonClick() {
41
+ this.togglePopover();
42
+ }
43
+ onApplyFilterButtonClick() {
44
+ this.emitFilterEvent();
45
+ this.togglePopover();
46
+ }
47
+ onFilterOptionSelected(selectedOption) {
48
+ this.allSelected = false;
49
+ if (this.selectedFilters.includes(selectedOption)) {
50
+ this.selectedFilters = this.selectedFilters.filter((filter) => filter != selectedOption);
51
+ }
52
+ else {
53
+ this.selectedFilters = [...this.selectedFilters, selectedOption];
54
+ }
55
+ }
56
+ componentWillLoad() {
57
+ this.displayedFilterSettings = this.parseFilterOptions();
58
+ this.selectedFilters = this.displayedFilterSettings.map((filterOption) => filterOption.optionText);
59
+ }
60
+ togglePopover() {
61
+ this.showPopover = !this.showPopover;
62
+ // if(!this.showPopover) {
63
+ // // this._focussedElementIndex = -1;
64
+ // }
65
+ }
66
+ // Commented out keyboard interaction for now
67
+ // @Listen('keyup')
68
+ // handleKeyUp(event: KeyboardEvent) {
69
+ // const keyboardEventValue = event.key;
70
+ // if (document.activeElement.id != `filter__${this.filterKey}`) return;
71
+ // if (event.key == " " || event.code == "Space" || event.keyCode == 32) {
72
+ // if (this._focussedElementIndex == 0) {
73
+ // this.onSelectAllClick()
74
+ // } else {
75
+ // const options = this.el.shadowRoot.querySelectorAll('.filter-option') as HTMLElement[];
76
+ // this.onFilterOptionSelected(options[this._focussedElementIndex].textContent)
77
+ // }
78
+ // return;
79
+ // }
80
+ // switch (keyboardEventValue) {
81
+ // case 'Enter':
82
+ // if(!this.showPopover) {
83
+ // this.showPopover=true
84
+ // } else {
85
+ // this.emitFilterEvent()
86
+ // }
87
+ // break;
88
+ // case 'Escape':
89
+ // this.showPopover = false;
90
+ // this._focussedElementIndex = -1;
91
+ // break;
92
+ // case 'ArrowDown':
93
+ // this.showPopover = true;
94
+ // if (this._focussedElementIndex == -1) {
95
+ // this._focussedElementIndex = 0;
96
+ // } else {
97
+ // const options = this.el.shadowRoot.querySelectorAll('.filter-option') as HTMLElement[];
98
+ // const currentOption = options[this._focussedElementIndex] as HTMLElement;
99
+ // currentOption.blur();
100
+ // // options[this._focussedElementIndex].focus();
101
+ // this._focussedElementIndex + 1 < options.length ? this._focussedElementIndex++ : (this._focussedElementIndex = 0);
102
+ // }
103
+ // break;
104
+ // case 'ArrowUp':
105
+ // if (this._focussedElementIndex == -1) {
106
+ // this.showPopover = true;
107
+ // this._focussedElementIndex = 0;
108
+ // } else {
109
+ // const options = this.el.shadowRoot.querySelectorAll('.filter-option') as HTMLElement[];
110
+ // const currentOption = options[this._focussedElementIndex] as HTMLElement;
111
+ // currentOption.blur();
112
+ // // options[this._focussedElementIndex].focus();
113
+ // this._focussedElementIndex > 0 ? this._focussedElementIndex-- : (this._focussedElementIndex = options.length - 1);
114
+ // }
115
+ // break;
116
+ // }
117
+ // }
118
+ handleFilterChange(event) {
119
+ const target = event.target;
120
+ this.filterSearchTerm = target.value;
121
+ const filteredResults = this.parseFilterOptions().filter((filterOption) => {
122
+ const lowercaseOption = filterOption.optionText.toLowerCase();
123
+ const filterTerm = this.filterSearchTerm.toLowerCase();
124
+ return lowercaseOption.includes(filterTerm);
125
+ });
126
+ this.displayedFilterSettings = filteredResults;
127
+ }
128
+ onSelectAllClick() {
129
+ this.allSelected = !this.allSelected;
130
+ if (this.allSelected) {
131
+ this.displayedFilterSettings.forEach((filterSetting) => { this.selectedFilters = [...this.selectedFilters, filterSetting.optionText]; });
132
+ }
133
+ else {
134
+ this.selectedFilters = [];
135
+ }
136
+ }
137
+ getFilterButtonClassName(buttonStyle) {
138
+ switch (buttonStyle) {
139
+ case 'table icon': {
140
+ return '--table-icon';
141
+ }
142
+ case 'list icon': {
143
+ return '--list-icon';
144
+ }
145
+ default: {
146
+ return '';
147
+ }
148
+ }
149
+ }
150
+ parseFilterOptions() {
151
+ return typeof this.filterOptions === 'string' ? JSON.parse(this.filterOptions) : this.filterOptions;
152
+ }
153
+ render() {
154
+ const filterPopoverContainerClassNameModifier = this.showSearchField ? '--with-search-field' : '';
155
+ const selectAllCheckboxIcon = this.allSelected ? 'check_box' : 'check_box_outline_blank';
156
+ const selectAllCheckboxColor = this.allSelected ? 'blue' : 'grey';
157
+ const buttonStyleClassNameModifier = this.getFilterButtonClassName(this.filterButtonStyle);
158
+ const filterKey = `filter__${this.filterKey}`;
159
+ return (index.h(index.Host, { id: filterKey }, index.h("div", { class: 'filter-container' }, index.h("button", { class: `filter-button ${buttonStyleClassNameModifier}`, type: 'button', onClick: this.onFilterButtonClick.bind(this) }, index.h("tttx-icon", { icon: 'filter_list', class: 'filter-icon', color: 'black' }), "Filter"), this.showPopover && (index.h("div", { class: `filter-popover-container ${filterPopoverContainerClassNameModifier}` }, index.h("div", { class: 'filter-header' }, this.filterHeader), this.showSearchField ? (index.h("div", { class: 'search-field-container' }, index.h("tttx-icon", { icon: 'search', class: 'search-icon' }), index.h("input", { type: 'text', class: 'search-input', placeholder: 'Search', value: this.filterSearchTerm, onInput: this.handleFilterChange.bind(this) }))) : (''), index.h("div", { class: 'filter-options-container' }, this.showSelectAll ? (index.h("div", { class: 'filter-option', tabIndex: -1, onClick: this.onSelectAllClick.bind(this) }, index.h("tttx-icon", { icon: selectAllCheckboxIcon, color: selectAllCheckboxColor, class: 'select-all-icon' }), index.h("label", { class: 'filter-label' }, "Select all"))) : (''), this.displayedFilterSettings.map((option) => {
160
+ const checkboxIcon = this.selectedFilters.includes(option.optionText) ? 'check_box' : 'check_box_outline_blank';
161
+ const checkboxColor = this.selectedFilters.includes(option.optionText) ? 'blue' : 'grey';
162
+ return index.h("div", { class: 'filter-option', tabIndex: -1, onClick: () => this.onFilterOptionSelected(option.optionText), key: option.optionText }, index.h("tttx-icon", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), this.showOptionIcons && index.h("tttx-icon", { icon: option.optionIcon, color: option.optionIconColor }), index.h("label", { class: 'filter-label' }, option.optionText));
163
+ })), index.h("div", { class: 'filter-popover-button-container' }, index.h("button", { type: 'button', class: 'close-button', onClick: this.onCloseButtonClick.bind(this) }, "Close"), index.h("button", { type: 'button', class: 'apply-button', onClick: this.onApplyFilterButtonClick.bind(this) }, "Apply")))))));
164
+ }
165
+ get el() { return index.getElement(this); }
166
+ };
167
167
  TttxFilter.style = tttxFilterCss;
168
168
 
169
169
  exports.tttx_filter = TttxFilter;