@refinitiv-ui/elements 6.0.0-next.3 → 6.0.2

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 (193) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +3 -15
  3. package/lib/accordion/index.js +2 -2
  4. package/lib/autosuggest/custom-elements.json +5 -15
  5. package/lib/autosuggest/custom-elements.md +14 -14
  6. package/lib/autosuggest/helpers/renderer.d.ts +8 -0
  7. package/lib/autosuggest/helpers/renderer.js +35 -0
  8. package/lib/autosuggest/helpers/types.d.ts +101 -1
  9. package/lib/autosuggest/helpers/utils.d.ts +1 -8
  10. package/lib/autosuggest/helpers/utils.js +0 -27
  11. package/lib/autosuggest/index.d.ts +34 -32
  12. package/lib/autosuggest/index.js +246 -202
  13. package/lib/autosuggest/themes/halo/dark/index.js +1 -1
  14. package/lib/autosuggest/themes/halo/light/index.js +1 -1
  15. package/lib/autosuggest/themes/solar/charcoal/index.js +1 -1
  16. package/lib/autosuggest/themes/solar/pearl/index.js +1 -1
  17. package/lib/button/index.js +2 -1
  18. package/lib/button/themes/halo/dark/index.js +1 -1
  19. package/lib/button/themes/halo/light/index.js +1 -1
  20. package/lib/button/themes/solar/charcoal/index.js +1 -1
  21. package/lib/button/themes/solar/pearl/index.js +1 -1
  22. package/lib/calendar/index.d.ts +1 -1
  23. package/lib/calendar/themes/halo/dark/index.js +1 -1
  24. package/lib/calendar/themes/halo/light/index.js +1 -1
  25. package/lib/calendar/themes/solar/charcoal/index.js +1 -1
  26. package/lib/calendar/themes/solar/pearl/index.js +1 -1
  27. package/lib/chart/plugins/doughnut-center-label.js +1 -1
  28. package/lib/chart/themes/halo/dark/index.js +1 -1
  29. package/lib/chart/themes/halo/light/index.js +1 -1
  30. package/lib/checkbox/index.d.ts +8 -15
  31. package/lib/checkbox/index.js +19 -41
  32. package/lib/checkbox/themes/halo/dark/index.js +1 -1
  33. package/lib/checkbox/themes/halo/light/index.js +1 -1
  34. package/lib/checkbox/themes/solar/charcoal/index.js +1 -1
  35. package/lib/checkbox/themes/solar/pearl/index.js +1 -1
  36. package/lib/clock/custom-elements.json +10 -10
  37. package/lib/clock/custom-elements.md +1 -1
  38. package/lib/clock/index.d.ts +44 -16
  39. package/lib/clock/index.js +178 -61
  40. package/lib/clock/themes/halo/dark/index.js +1 -1
  41. package/lib/clock/themes/halo/light/index.js +1 -1
  42. package/lib/clock/themes/solar/charcoal/index.js +1 -1
  43. package/lib/clock/themes/solar/pearl/index.js +1 -1
  44. package/lib/combo-box/index.d.ts +4 -3
  45. package/lib/combo-box/index.js +7 -3
  46. package/lib/combo-box/themes/halo/dark/index.js +1 -1
  47. package/lib/combo-box/themes/halo/light/index.js +1 -1
  48. package/lib/combo-box/themes/solar/charcoal/index.js +1 -1
  49. package/lib/combo-box/themes/solar/pearl/index.js +1 -1
  50. package/lib/datetime-field/index.d.ts +1 -1
  51. package/lib/datetime-field/utils.d.ts +1 -1
  52. package/lib/datetime-picker/themes/halo/dark/index.js +1 -1
  53. package/lib/datetime-picker/themes/halo/light/index.js +1 -1
  54. package/lib/datetime-picker/themes/solar/charcoal/index.js +1 -1
  55. package/lib/datetime-picker/themes/solar/pearl/index.js +1 -1
  56. package/lib/email-field/themes/halo/dark/index.js +1 -1
  57. package/lib/email-field/themes/halo/light/index.js +1 -1
  58. package/lib/email-field/themes/solar/charcoal/index.js +1 -1
  59. package/lib/email-field/themes/solar/pearl/index.js +1 -1
  60. package/lib/flag/utils/FlagLoader.d.ts +2 -32
  61. package/lib/flag/utils/FlagLoader.js +2 -69
  62. package/lib/heatmap/index.d.ts +2 -2
  63. package/lib/heatmap/themes/halo/dark/index.js +1 -1
  64. package/lib/heatmap/themes/halo/light/index.js +1 -1
  65. package/lib/icon/utils/IconLoader.d.ts +2 -37
  66. package/lib/icon/utils/IconLoader.js +2 -76
  67. package/lib/index.d.ts +1 -1
  68. package/lib/index.js +1 -1
  69. package/lib/interactive-chart/themes/halo/dark/index.js +1 -1
  70. package/lib/interactive-chart/themes/halo/light/index.js +1 -1
  71. package/lib/item/helpers/types.d.ts +6 -6
  72. package/lib/item/index.d.ts +2 -2
  73. package/lib/item/index.js +0 -1
  74. package/lib/item/themes/halo/dark/index.js +1 -1
  75. package/lib/item/themes/halo/light/index.js +1 -1
  76. package/lib/list/elements/list-item.d.ts +30 -0
  77. package/lib/list/elements/list-item.js +19 -0
  78. package/lib/list/elements/list.d.ts +307 -0
  79. package/lib/list/elements/list.js +632 -0
  80. package/lib/list/helpers/renderer.d.ts +0 -1
  81. package/lib/list/helpers/renderer.js +1 -3
  82. package/lib/list/index.d.ts +3 -317
  83. package/lib/list/index.js +3 -641
  84. package/lib/list/themes/halo/dark/index.js +4 -1
  85. package/lib/list/themes/halo/light/index.js +5 -2
  86. package/lib/list/themes/solar/charcoal/index.js +4 -1
  87. package/lib/list/themes/solar/pearl/index.js +4 -1
  88. package/lib/multi-input/index.d.ts +1 -5
  89. package/lib/multi-input/index.js +17 -18
  90. package/lib/notification/themes/halo/dark/index.js +1 -1
  91. package/lib/notification/themes/halo/light/index.js +1 -1
  92. package/lib/notification/themes/solar/charcoal/index.js +1 -1
  93. package/lib/notification/themes/solar/pearl/index.js +1 -1
  94. package/lib/number-field/themes/halo/dark/index.js +1 -1
  95. package/lib/number-field/themes/halo/light/index.js +1 -1
  96. package/lib/number-field/themes/solar/charcoal/index.js +1 -1
  97. package/lib/number-field/themes/solar/pearl/index.js +1 -1
  98. package/lib/overlay/index.d.ts +2 -1
  99. package/lib/overlay-menu/helpers/constants.d.ts +6 -0
  100. package/lib/overlay-menu/helpers/constants.js +7 -0
  101. package/lib/overlay-menu/helpers/types.d.ts +0 -6
  102. package/lib/overlay-menu/helpers/types.js +1 -7
  103. package/lib/overlay-menu/index.d.ts +1 -1
  104. package/lib/overlay-menu/index.js +1 -1
  105. package/lib/password-field/themes/halo/dark/index.js +1 -1
  106. package/lib/password-field/themes/halo/light/index.js +1 -1
  107. package/lib/password-field/themes/solar/charcoal/index.js +1 -1
  108. package/lib/password-field/themes/solar/pearl/index.js +1 -1
  109. package/lib/pill/index.d.ts +11 -3
  110. package/lib/pill/index.js +25 -11
  111. package/lib/radio-button/index.d.ts +7 -11
  112. package/lib/radio-button/index.js +14 -25
  113. package/lib/radio-button/themes/halo/dark/index.js +1 -1
  114. package/lib/radio-button/themes/halo/light/index.js +1 -1
  115. package/lib/radio-button/themes/solar/charcoal/index.js +1 -1
  116. package/lib/radio-button/themes/solar/pearl/index.js +1 -1
  117. package/lib/rating/custom-elements.json +4 -4
  118. package/lib/rating/custom-elements.md +2 -2
  119. package/lib/rating/index.d.ts +84 -32
  120. package/lib/rating/index.js +209 -80
  121. package/lib/rating/themes/halo/dark/index.js +1 -1
  122. package/lib/rating/themes/halo/light/index.js +1 -1
  123. package/lib/rating/themes/solar/charcoal/index.js +1 -1
  124. package/lib/rating/themes/solar/pearl/index.js +1 -1
  125. package/lib/rating/utils.d.ts +9 -0
  126. package/lib/rating/utils.js +11 -0
  127. package/lib/search-field/themes/halo/dark/index.js +1 -1
  128. package/lib/search-field/themes/halo/light/index.js +1 -1
  129. package/lib/search-field/themes/solar/charcoal/index.js +1 -1
  130. package/lib/search-field/themes/solar/pearl/index.js +1 -1
  131. package/lib/select/index.d.ts +13 -1
  132. package/lib/select/index.js +25 -7
  133. package/lib/select/themes/halo/dark/index.js +1 -1
  134. package/lib/select/themes/halo/light/index.js +1 -1
  135. package/lib/select/themes/solar/charcoal/index.js +1 -1
  136. package/lib/select/themes/solar/pearl/index.js +1 -1
  137. package/lib/slider/constants.d.ts +5 -1
  138. package/lib/slider/constants.js +6 -1
  139. package/lib/slider/index.d.ts +112 -49
  140. package/lib/slider/index.js +331 -182
  141. package/lib/slider/themes/halo/dark/index.js +1 -1
  142. package/lib/slider/themes/halo/light/index.js +1 -1
  143. package/lib/slider/themes/solar/charcoal/index.js +1 -1
  144. package/lib/slider/themes/solar/pearl/index.js +1 -1
  145. package/lib/slider/utils.d.ts +1 -9
  146. package/lib/slider/utils.js +1 -18
  147. package/lib/sparkline/themes/halo/dark/index.js +1 -1
  148. package/lib/sparkline/themes/halo/light/index.js +1 -1
  149. package/lib/tab/themes/halo/dark/index.js +1 -1
  150. package/lib/tab/themes/halo/light/index.js +1 -1
  151. package/lib/tab/themes/solar/charcoal/index.js +1 -1
  152. package/lib/tab/themes/solar/pearl/index.js +1 -1
  153. package/lib/tab-bar/index.d.ts +6 -7
  154. package/lib/tab-bar/index.js +12 -10
  155. package/lib/tab-bar/themes/halo/dark/index.js +1 -0
  156. package/lib/tab-bar/themes/halo/light/index.js +1 -0
  157. package/lib/tab-bar/themes/solar/charcoal/index.js +1 -0
  158. package/lib/tab-bar/themes/solar/pearl/index.js +1 -0
  159. package/lib/text-field/index.js +2 -3
  160. package/lib/text-field/themes/halo/dark/index.js +1 -1
  161. package/lib/text-field/themes/halo/light/index.js +1 -1
  162. package/lib/text-field/themes/solar/charcoal/index.js +1 -1
  163. package/lib/text-field/themes/solar/pearl/index.js +1 -1
  164. package/lib/toggle/index.d.ts +7 -10
  165. package/lib/toggle/index.js +14 -24
  166. package/lib/toggle/themes/halo/dark/index.js +1 -1
  167. package/lib/toggle/themes/halo/light/index.js +1 -1
  168. package/lib/toggle/themes/solar/charcoal/index.js +1 -1
  169. package/lib/toggle/themes/solar/pearl/index.js +1 -1
  170. package/lib/tooltip/helpers/overflow-tooltip.d.ts +11 -4
  171. package/lib/tooltip/helpers/overflow-tooltip.js +34 -6
  172. package/lib/tooltip/index.d.ts +2 -2
  173. package/lib/tooltip/index.js +2 -2
  174. package/lib/tree/elements/tree-item.d.ts +4 -0
  175. package/lib/tree/elements/tree-item.js +5 -2
  176. package/lib/tree/elements/tree.d.ts +7 -0
  177. package/lib/tree/elements/tree.js +12 -1
  178. package/lib/tree/helpers/renderer.d.ts +0 -1
  179. package/lib/tree/helpers/renderer.js +0 -2
  180. package/lib/tree/index.d.ts +2 -1
  181. package/lib/tree/themes/halo/dark/index.js +2 -2
  182. package/lib/tree/themes/halo/light/index.js +3 -3
  183. package/lib/tree/themes/solar/charcoal/index.js +2 -2
  184. package/lib/tree/themes/solar/pearl/index.js +2 -2
  185. package/lib/tree-select/index.js +15 -5
  186. package/lib/tree-select/themes/halo/dark/index.js +1 -1
  187. package/lib/tree-select/themes/halo/light/index.js +1 -1
  188. package/lib/tree-select/themes/solar/charcoal/index.js +1 -1
  189. package/lib/tree-select/themes/solar/pearl/index.js +1 -1
  190. package/lib/version.js +1 -1
  191. package/package.json +20 -19
  192. package/lib/clock/utils/timestamps.d.ts +0 -6
  193. package/lib/clock/utils/timestamps.js +0 -6
package/CHANGELOG.md CHANGED
@@ -3,6 +3,57 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [6.0.2](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.1...@refinitiv-ui/elements@6.0.2) (2022-07-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **accordion:** The element should interact only with its direct children ([#378](https://github.com/Refinitiv/refinitiv-ui/issues/378)) ([f8e11d3](https://github.com/Refinitiv/refinitiv-ui/commit/f8e11d391839cb1e53aad3ec2682a089766851ff))
12
+ * **list:** item should not receive focus when click ([#272](https://github.com/Refinitiv/refinitiv-ui/issues/272)) ([e2293e3](https://github.com/Refinitiv/refinitiv-ui/commit/e2293e37126a446d5c1d16be1e5eb503425534f3))
13
+ * **tab-bar:** resize callback is not fired when a new tab has been added ([#389](https://github.com/Refinitiv/refinitiv-ui/issues/389)) ([13408e1](https://github.com/Refinitiv/refinitiv-ui/commit/13408e15302a19cd614fdd5f1b4af9be5f1881bd))
14
+ * use `setAttribute` instead of `AriaMixins` for aria attributes ([#327](https://github.com/Refinitiv/refinitiv-ui/issues/327)) ([09f91fa](https://github.com/Refinitiv/refinitiv-ui/commit/09f91fafdef57fa26722ccf0e19f586833405cbb))
15
+
16
+
17
+
18
+
19
+
20
+ ## [6.0.1](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.0...@refinitiv-ui/elements@6.0.1) (2022-06-20)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **chart:** render selected segment after tooltip has rendered so it won't cut off the tooltip ([#359](https://github.com/Refinitiv/refinitiv-ui/issues/359)) ([62e37d5](https://github.com/Refinitiv/refinitiv-ui/commit/62e37d50618f5ec4750d189e150ae8a076d8eca4))
26
+ * **datetime-picker:** change warning and error border style to make it consistent with textfield ([#356](https://github.com/Refinitiv/refinitiv-ui/issues/356)) ([51638bd](https://github.com/Refinitiv/refinitiv-ui/commit/51638bd4d5e9306deb538725726fb085d55fd425))
27
+ * incorrect TypeScript type delcaration path ([#370](https://github.com/Refinitiv/refinitiv-ui/issues/370)) ([4b40823](https://github.com/Refinitiv/refinitiv-ui/commit/4b4082316233ce5b6e4b6e8dd38e10ddedd532f7))
28
+ * **tree-select:** show unselected item on selection filter ([#358](https://github.com/Refinitiv/refinitiv-ui/issues/358)) ([ea88b3c](https://github.com/Refinitiv/refinitiv-ui/commit/ea88b3c1389ef7887af890206bdd29695ce49787))
29
+ * **tree:** incorrect padding size of tree item when use multiple mode ([#362](https://github.com/Refinitiv/refinitiv-ui/issues/362)) ([1f5d6aa](https://github.com/Refinitiv/refinitiv-ui/commit/1f5d6aa71fd9e155202203e18134934fa93c920c))
30
+ * **tree:** tree query selection issues ([#364](https://github.com/Refinitiv/refinitiv-ui/issues/364)) ([cf1c072](https://github.com/Refinitiv/refinitiv-ui/commit/cf1c07234be0ec0984cb109a9fed9cf58db22c44))
31
+
32
+
33
+
34
+
35
+
36
+ # [6.0.0](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@6.0.0-next.3...@refinitiv-ui/elements@6.0.0) (2022-06-07)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * **clock:** a11y, tick, show-seconds should not pronounce all the time ([#339](https://github.com/Refinitiv/refinitiv-ui/issues/339)) ([b4e51ac](https://github.com/Refinitiv/refinitiv-ui/commit/b4e51ac1a4b181d99ff37cc30980fd4fc55dd426))
42
+ * **clock:** sync interactiveChange code with rating ([#346](https://github.com/Refinitiv/refinitiv-ui/issues/346)) ([6837206](https://github.com/Refinitiv/refinitiv-ui/commit/6837206d9a32a4d05a18fef262e4277e8630c568))
43
+ * **utils:** improve svg security ([#342](https://github.com/Refinitiv/refinitiv-ui/issues/342)) ([ef53c5c](https://github.com/Refinitiv/refinitiv-ui/commit/ef53c5c8918548a0c2aa67a1934ba0823698a9e8))
44
+
45
+
46
+ ### Features
47
+
48
+ * **clock:** improve clock accessibility ([#308](https://github.com/Refinitiv/refinitiv-ui/issues/308)) ([c0a9bb0](https://github.com/Refinitiv/refinitiv-ui/commit/c0a9bb04c212b6aa4dbce495bec4faebd9080eaf)), closes [#311](https://github.com/Refinitiv/refinitiv-ui/issues/311)
49
+ * **rating:** add accessibility support ([2a1b7e4](https://github.com/Refinitiv/refinitiv-ui/commit/2a1b7e47199de3c1cca73b0a86150da07612c347))
50
+ * **slider:** add arrow key navigation support and aria attributes ([#299](https://github.com/Refinitiv/refinitiv-ui/issues/299)) ([056a45b](https://github.com/Refinitiv/refinitiv-ui/commit/056a45b56911ed0f7634ea1b4abe38c6392144d4)), closes [#332](https://github.com/Refinitiv/refinitiv-ui/issues/332) [#341](https://github.com/Refinitiv/refinitiv-ui/issues/341)
51
+ * **slider:** add localised label for slider thumb ([#351](https://github.com/Refinitiv/refinitiv-ui/issues/351)) ([ba9cc8d](https://github.com/Refinitiv/refinitiv-ui/commit/ba9cc8d563444dba35a082a3898dc4e8f9235074))
52
+
53
+
54
+
55
+
56
+
6
57
  ## [5.12.2](https://github.com/Refinitiv/refinitiv-ui/compare/@refinitiv-ui/elements@5.12.1...@refinitiv-ui/elements@5.12.2) (2022-02-17)
7
58
 
8
59
  **Note:** Version bump only for package @refinitiv-ui/elements
package/README.md CHANGED
@@ -25,12 +25,11 @@ Finally, import both elements that you want to use and its themes into your appl
25
25
  <br>
26
26
 
27
27
  ```javascript
28
- // import native styles for typography, css variables, etc.
29
- import '@refinitiv-ui/halo-theme/dark/imports/native-elements';
30
-
31
28
  // import element and its Halo dark theme
32
29
  import '@refinitiv-ui/elements/button';
33
30
  import '@refinitiv-ui/elements/panel';
31
+ // import native styles for typography, css variables, etc.
32
+ import '@refinitiv-ui/halo-theme/dark/imports/native-elements';
34
33
  import '@refinitiv-ui/elements/button/themes/halo/dark';
35
34
  import '@refinitiv-ui/elements/panel/themes/halo/dark';
36
35
  ```
@@ -51,20 +50,9 @@ Now, you can use the elements in your app.
51
50
  </ef-panel>
52
51
  ```
53
52
 
54
- ## Command Overview
55
-
56
- | Command | Target | Description | Example |
57
- | --- |:--- | --- | --- |
58
- | npm start | `<element>` | Build and serve an element. | npm start button |
59
- | npm run test | `<element>` &#124; `all` | Run unit tests. | npm run test button |
60
- | npm run test:watch | `<element>` | Run test server. | npm run test:watch button |
61
- | npm run test:snapshots | `<element>` &#124; `all` | Update and prune snapshots. | npm run test:watch button |
62
- | npm run lint | `<element>` &#124; `all` | Run linting tools. | npm run lint button |
63
- | npm run lint:fix | `<element>` &#124; `all` | Fix linting errors. | npm run lint:fix button |
64
-
65
53
  # Documentation
66
54
 
67
- See list of elements, demo and more tutorial by visiting [EF Documentation](https://cdn.ppe.refinitiv.com/public/apps/elf-docs/book/en/index.html).
55
+ See list of elements, demo and more tutorial by visiting [EF Documentation](https://ui.refinitiv.com/).
68
56
 
69
57
  # License
70
58
  Apache License 2.0. However, Halo theme shall only be used within Refinitiv products or services due to license of the font "Proxima Nova Fin".
@@ -12,7 +12,7 @@ import { Collapse } from '../collapse/index.js';
12
12
  */
13
13
  const getClosestAccordion = (element) => {
14
14
  while (element) {
15
- if (element.localName === 'ef-accordion') {
15
+ if (element instanceof Accordion) {
16
16
  return element;
17
17
  }
18
18
  else {
@@ -28,7 +28,7 @@ const getClosestAccordion = (element) => {
28
28
  * @returns is current accordion has child accordion that wraps checked element
29
29
  */
30
30
  const isDirectAccordionChild = (element, accordion) => {
31
- return getClosestAccordion(element) === accordion;
31
+ return element instanceof Collapse && getClosestAccordion(element) === accordion;
32
32
  };
33
33
  /**
34
34
  * Used to display a group of `Collapse` control.
@@ -7,8 +7,7 @@
7
7
  "attributes": [
8
8
  {
9
9
  "name": "attach",
10
- "description": "An HTML Element or CSS selector",
11
- "type": "AutosuggestTargetElement | string | null"
10
+ "description": "An HTML Element or CSS selector"
12
11
  },
13
12
  {
14
13
  "name": "request-on-focus",
@@ -59,16 +58,10 @@
59
58
  "type": "100",
60
59
  "default": "100"
61
60
  },
62
- {
63
- "name": "defaultMoreSearchText (readonly)",
64
- "type": "\"More results for {0}\"",
65
- "default": "\"More results for {0}\""
66
- },
67
61
  {
68
62
  "name": "attach",
69
63
  "attribute": "attach",
70
- "description": "An HTML Element or CSS selector",
71
- "type": "AutosuggestTargetElement | string | null"
64
+ "description": "An HTML Element or CSS selector"
72
65
  },
73
66
  {
74
67
  "name": "requestOnFocus",
@@ -100,8 +93,7 @@
100
93
  },
101
94
  {
102
95
  "name": "query",
103
- "description": "An object that represents a query from attach target",
104
- "type": "AutosuggestQuery | null"
96
+ "description": "An object that represents a query from attach target"
105
97
  },
106
98
  {
107
99
  "name": "debounceRate",
@@ -113,19 +105,17 @@
113
105
  {
114
106
  "name": "renderer",
115
107
  "description": "A renderer applied to suggestion.\nBy default a render maps data to item attributes",
116
- "type": "AutosuggestRenderer",
117
- "default": "\"itemRenderer\""
108
+ "default": "\"renderer\""
118
109
  },
119
110
  {
120
111
  "name": "highlightable",
121
112
  "description": "A function that is applied to every suggestion during the render process\nto say whether the item can be highlighted and selected. Only items that return true are considered.\nBy default the function checks for `item` `highlightable` property.",
122
- "type": "AutosuggestHighlightable",
123
113
  "default": "\"itemHighlightable\""
124
114
  },
125
115
  {
126
116
  "name": "suggestions",
127
117
  "description": "A list of suggestion items",
128
- "type": "AutosuggestItem[]",
118
+ "type": "object",
129
119
  "default": "[]"
130
120
  },
131
121
  {
@@ -8,20 +8,20 @@ custom rendering, pagination, asynchronous data request, etc.
8
8
 
9
9
  ## Properties
10
10
 
11
- | Property | Attribute | Type | Default | Description |
12
- |------------------|--------------------|----------------------------------------------|------------------------|--------------------------------------------------|
13
- | `attach` | `attach` | `AutosuggestTargetElement \| string \| null` | null | An HTML Element or CSS selector |
14
- | `debounceRate` | `debounce-rate` | `number` | "100" | Debounce rate in ms of the filter as a number.<br />Used to throttle the filter rate so as not to trigger unneeded filtering |
15
- | `highlightable` | | `AutosuggestHighlightable` | "itemHighlightable" | A function that is applied to every suggestion during the render process<br />to say whether the item can be highlighted and selected. Only items that return true are considered.<br />By default the function checks for `item` `highlightable` property. |
16
- | `htmlRenderer` | `html-renderer` | `boolean` | false | If set to true, the render function is not called. Instead the wrapper element<br />should populate and destroy suggestion elements. Rendering items manually<br />may have performance benefits in frameworks that use virtual DOM (such as `Vue`, `React`, `hyperHTML` and others) |
17
- | `loading` | `loading` | `boolean` | false | If set to true show loading mask |
18
- | `moreResults` | `more-results` | `boolean` | false | If set to true display 'Has more results' item |
19
- | `moreSearchText` | `more-search-text` | `string` | "More results for {0}" | Custom text for More Search |
20
- | `opened` | `opened` | `boolean` | false | Auto suggest popup's open state |
21
- | `query` | | `AutosuggestQuery \| null` | null | An object that represents a query from attach target |
22
- | `renderer` | | `AutosuggestRenderer` | "itemRenderer" | A renderer applied to suggestion.<br />By default a render maps data to item attributes |
23
- | `requestOnFocus` | `request-on-focus` | `boolean` | false | Request suggestions when attach target is focused |
24
- | `suggestions` | | `AutosuggestItem[]` | [] | A list of suggestion items |
11
+ | Property | Attribute | Type | Default | Description |
12
+ |------------------|--------------------|-----------|------------------------|--------------------------------------------------|
13
+ | `attach` | `attach` | | null | An HTML Element or CSS selector |
14
+ | `debounceRate` | `debounce-rate` | `number` | "100" | Debounce rate in ms of the filter as a number.<br />Used to throttle the filter rate so as not to trigger unneeded filtering |
15
+ | `highlightable` | | | "itemHighlightable" | A function that is applied to every suggestion during the render process<br />to say whether the item can be highlighted and selected. Only items that return true are considered.<br />By default the function checks for `item` `highlightable` property. |
16
+ | `htmlRenderer` | `html-renderer` | `boolean` | false | If set to true, the render function is not called. Instead the wrapper element<br />should populate and destroy suggestion elements. Rendering items manually<br />may have performance benefits in frameworks that use virtual DOM (such as `Vue`, `React`, `hyperHTML` and others) |
17
+ | `loading` | `loading` | `boolean` | false | If set to true show loading mask |
18
+ | `moreResults` | `more-results` | `boolean` | false | If set to true display 'Has more results' item |
19
+ | `moreSearchText` | `more-search-text` | `string` | "More results for {0}" | Custom text for More Search |
20
+ | `opened` | `opened` | `boolean` | false | Auto suggest popup's open state |
21
+ | `query` | | | null | An object that represents a query from attach target |
22
+ | `renderer` | | | "renderer" | A renderer applied to suggestion.<br />By default a render maps data to item attributes |
23
+ | `requestOnFocus` | `request-on-focus` | `boolean` | false | Request suggestions when attach target is focused |
24
+ | `suggestions` | | `object` | [] | A list of suggestion items |
25
25
 
26
26
  ## Methods
27
27
 
@@ -0,0 +1,8 @@
1
+ import type { AutosuggestRenderer } from './types';
2
+ /**
3
+ * Build item element from data object
4
+ * @param suggestion Suggestion data
5
+ * @param query A query data (usually string, but could be any entity )
6
+ * @returns item
7
+ */
8
+ export declare const renderer: AutosuggestRenderer;
@@ -0,0 +1,35 @@
1
+ import { uuid } from '@refinitiv-ui/utils/uuid.js';
2
+ import { updateElementContent } from './utils.js';
3
+ /**
4
+ * Build item element from data object
5
+ * @param suggestion Suggestion data
6
+ * @param query A query data (usually string, but could be any entity )
7
+ * @returns item
8
+ */
9
+ export const renderer = (suggestion, query) => {
10
+ if (typeof suggestion !== 'object') {
11
+ const value = suggestion || '';
12
+ suggestion = {
13
+ label: value,
14
+ value
15
+ };
16
+ }
17
+ const { type, label, title, icon, disabled, value, id } = suggestion;
18
+ const el = document.createElement('ef-item');
19
+ const isTextType = !type || type === 'text';
20
+ const elId = id || (isTextType ? uuid() : '');
21
+ if (elId) {
22
+ el.id = elId;
23
+ }
24
+ el.tabIndex = -1;
25
+ el.setAttribute('role', isTextType ? 'option' : 'presentation');
26
+ el.type = type || null;
27
+ el.disabled = !!disabled;
28
+ el.icon = icon || null;
29
+ el.value = value || label || '';
30
+ if (title) {
31
+ el.title = title;
32
+ }
33
+ updateElementContent(el, query || '', label || '', el.value);
34
+ return el;
35
+ };
@@ -3,7 +3,7 @@ export declare type AutosuggestSelectItemEvent = CustomEvent<{
3
3
  query: string;
4
4
  suggestion: Suggestion;
5
5
  }>;
6
- export declare type AutosuggestHighlightItem = {
6
+ export declare type AutosuggestHighlightItem = HTMLElement & {
7
7
  highlighted: boolean;
8
8
  };
9
9
  export declare type AutosuggestHighlightItemEvent = CustomEvent<{
@@ -41,6 +41,10 @@ export interface Suggestion {
41
41
  * Sort data item into the group.
42
42
  */
43
43
  group?: string;
44
+ /**
45
+ * Suggestion unique id.
46
+ */
47
+ id?: string;
44
48
  }
45
49
  export declare type AutosuggestItem = Suggestion | string | unknown;
46
50
  export interface AutosuggestQuery {
@@ -52,3 +56,99 @@ export declare type AutosuggestTargetElement = HTMLElement & {
52
56
  export declare type AutosuggestMethodType = 'click' | 'enter' | 'clear' | 'reset' | 'navigation';
53
57
  export declare type AutosuggestRenderer = (suggestion: AutosuggestItem, query: AutosuggestQuery | null) => HTMLElement;
54
58
  export declare type AutosuggestHighlightable = (suggestion: AutosuggestItem, target: HTMLElement) => boolean;
59
+ /**
60
+ * @event item-highlight
61
+ * Fired when an item gets highlighted or highlight is removed
62
+ */
63
+ export declare type ItemHighlightEvent = CustomEvent<{
64
+ /**
65
+ * New highlight target
66
+ */
67
+ target: AutosuggestTargetElement | null;
68
+ /**
69
+ * New suggestion
70
+ */
71
+ suggestion: AutosuggestItem | null;
72
+ /**
73
+ * Old highlight target
74
+ */
75
+ oldTarget: AutosuggestTargetElement | null;
76
+ /**
77
+ * Old suggestion
78
+ */
79
+ oldSuggestion: AutosuggestItem | null;
80
+ }>;
81
+ /**
82
+ * @event add-attach-target-events
83
+ * Fired when attach has been set.
84
+ * Add attach target listeners
85
+ */
86
+ export declare type AddAttachTargetEventsEvent = CustomEvent;
87
+ /**
88
+ * @event remove-attach-target-events
89
+ * Fired when attach has been removed.
90
+ * Remove attach target listeners
91
+ */
92
+ export declare type RemoveAttachTargetEventsEvent = CustomEvent;
93
+ /**
94
+ * @event item-select
95
+ * Fired when an item gets selected
96
+ */
97
+ export declare type ItemSelectEvent = CustomEvent<{
98
+ /**
99
+ * Select method
100
+ */
101
+ method: AutosuggestMethodType;
102
+ /**
103
+ * Selection target
104
+ */
105
+ target: AutosuggestTargetElement;
106
+ /**
107
+ * Selected suggestion
108
+ */
109
+ suggestion: AutosuggestItem | null;
110
+ /**
111
+ * Saved query object
112
+ */
113
+ query: AutosuggestQuery | null;
114
+ }>;
115
+ /**
116
+ * @event suggestions-fetch-requested
117
+ * Fired when auto suggest requests the data
118
+ */
119
+ export declare type SuggestionsFetchRequestedEvent = CustomEvent<{
120
+ /**
121
+ * Input query
122
+ */
123
+ query: AutosuggestQuery | null;
124
+ /**
125
+ * The reason to fetch data
126
+ */
127
+ reason: AutosuggestReason;
128
+ }>;
129
+ /**
130
+ * @event suggestions-clear-requested
131
+ * Fired when auto suggest requests to clear the data.
132
+ * If used in reactive application, prevent default and set suggestions to []
133
+ */
134
+ export declare type SuggestionsClearRequestedEvent = CustomEvent;
135
+ /**
136
+ * @event suggestions-query
137
+ * Fired when input value has changed and the query must be set.
138
+ */
139
+ export declare type SuggestionsQueryEvent = CustomEvent<{
140
+ /**
141
+ * The reason to request query
142
+ */
143
+ reason: AutosuggestReason;
144
+ }>;
145
+ /**
146
+ * @event suggestions-changed
147
+ * Fired when suggestions changed
148
+ */
149
+ export declare type SuggestionsChangedEvent = CustomEvent<{
150
+ /**
151
+ * Suggestion Items
152
+ */
153
+ value: AutosuggestItem[];
154
+ }>;
@@ -1,5 +1,5 @@
1
1
  import type { Item } from '../../item';
2
- import type { AutosuggestHighlightable, AutosuggestRenderer } from './types';
2
+ import type { AutosuggestHighlightable } from './types';
3
3
  /**
4
4
  * Check whether item can be highlighted
5
5
  * @param suggestion Suggestion object
@@ -30,10 +30,3 @@ export declare const queryWordSelect: (text: string, query?: string, pattern?: s
30
30
  * @return {void}
31
31
  */
32
32
  export declare const updateElementContent: (el: Item, query: string, label: string, value: string | number) => void;
33
- /**
34
- * Build item element from data object
35
- * @param suggestion Suggestion data
36
- * @param query A query data (usually string, but could be any entity )
37
- * @returns item
38
- */
39
- export declare const itemRenderer: AutosuggestRenderer;
@@ -46,30 +46,3 @@ export const updateElementContent = (el, query, label, value) => {
46
46
  el.label = `${value}`;
47
47
  }
48
48
  };
49
- /**
50
- * Build item element from data object
51
- * @param suggestion Suggestion data
52
- * @param query A query data (usually string, but could be any entity )
53
- * @returns item
54
- */
55
- export const itemRenderer = (suggestion, query) => {
56
- const el = document.createElement('ef-item');
57
- if (typeof suggestion === 'object') {
58
- const { type, label, title, icon, disabled, value } = suggestion;
59
- el.type = type || null;
60
- el.disabled = !!disabled;
61
- el.icon = icon || null;
62
- el.value = value || label || '';
63
- if (title) {
64
- el.title = title;
65
- }
66
- updateElementContent(el, query || '', label || '', el.value);
67
- }
68
- else {
69
- const value = suggestion || '';
70
- el.label = value;
71
- el.value = value;
72
- updateElementContent(el, query || '', value, value);
73
- }
74
- return el;
75
- };
@@ -1,11 +1,17 @@
1
1
  import { JSXInterface } from '../jsx';
2
2
  import { CSSResultGroup, ElementSize, PropertyValues, TemplateResult } from '@refinitiv-ui/core';
3
+ import { TranslateDirective } from '@refinitiv-ui/translate';
3
4
  import type { AutosuggestTargetElement, AutosuggestHighlightable, AutosuggestMethodType, AutosuggestQuery, AutosuggestRenderer, AutosuggestReason, AutosuggestItem, AutosuggestSelectItemEvent, AutosuggestHighlightItemEvent } from './helpers/types';
5
+ import { escapeRegExp, itemHighlightable, queryWordSelect } from './helpers/utils.js';
6
+ import { renderer } from './helpers/renderer.js';
4
7
  import { Overlay } from '../overlay/index.js';
5
8
  import '../loader/index.js';
6
9
  import '../item/index.js';
7
- export type { AutosuggestTargetElement, AutosuggestHighlightable, AutosuggestMethodType, AutosuggestQuery, AutosuggestRenderer, AutosuggestReason, AutosuggestItem } from './helpers/types';
8
- export { queryWordSelect, itemRenderer, escapeRegExp, itemHighlightable, updateElementContent } from './helpers/utils.js';
10
+ import '@refinitiv-ui/phrasebook/locale/en/autosuggest.js';
11
+ import type { ItemHighlightEvent, AddAttachTargetEventsEvent, RemoveAttachTargetEventsEvent, ItemSelectEvent, SuggestionsFetchRequestedEvent, SuggestionsClearRequestedEvent, SuggestionsQueryEvent, SuggestionsChangedEvent } from './helpers/types';
12
+ export type { AutosuggestTargetElement, AutosuggestHighlightable, AutosuggestMethodType, AutosuggestQuery, AutosuggestRenderer, AutosuggestReason, AutosuggestItem, ItemHighlightEvent, AddAttachTargetEventsEvent, RemoveAttachTargetEventsEvent, ItemSelectEvent, SuggestionsFetchRequestedEvent, SuggestionsClearRequestedEvent, SuggestionsQueryEvent, SuggestionsChangedEvent };
13
+ export { updateElementContent } from './helpers/utils.js';
14
+ export { itemHighlightable, escapeRegExp, queryWordSelect, renderer, renderer as itemRenderer };
9
15
  /**
10
16
  * Shows suggestions based on users' query.
11
17
  * It can be used by attaching to text form control
@@ -34,6 +40,7 @@ export declare class Autosuggest extends Overlay {
34
40
  * @returns version number
35
41
  */
36
42
  static get version(): string;
43
+ protected readonly defaultRole: string | null;
37
44
  /**
38
45
  * A `CSSResultGroup` that will be used
39
46
  * to style the host, slotted children
@@ -70,10 +77,8 @@ export declare class Autosuggest extends Overlay {
70
77
  */
71
78
  static ItemHighlightable(suggestion: AutosuggestItem, target: HTMLElement): boolean;
72
79
  static readonly defaultDebounceRate = 100;
73
- static readonly defaultMoreSearchText = "More results for {0}";
74
80
  /**
75
81
  * An HTML Element or CSS selector
76
- * @type {AutosuggestTargetElement | string | null}
77
82
  */
78
83
  attach: AutosuggestTargetElement | string | null;
79
84
  /**
@@ -95,7 +100,6 @@ export declare class Autosuggest extends Overlay {
95
100
  loading: boolean;
96
101
  /**
97
102
  * An object that represents a query from attach target
98
- * @type {AutosuggestQuery | null}
99
103
  */
100
104
  query: AutosuggestQuery | null;
101
105
  /**
@@ -107,19 +111,16 @@ export declare class Autosuggest extends Overlay {
107
111
  /**
108
112
  * A renderer applied to suggestion.
109
113
  * By default a render maps data to item attributes
110
- * @type {AutosuggestRenderer}
111
114
  */
112
115
  renderer: AutosuggestRenderer;
113
116
  /**
114
117
  * A function that is applied to every suggestion during the render process
115
118
  * to say whether the item can be highlighted and selected. Only items that return true are considered.
116
119
  * By default the function checks for `item` `highlightable` property.
117
- * @type {AutosuggestHighlightable}
118
120
  */
119
121
  highlightable: AutosuggestHighlightable;
120
122
  /**
121
123
  * A list of suggestion items
122
- * @type {AutosuggestItem[]}
123
124
  */
124
125
  suggestions: AutosuggestItem[];
125
126
  /**
@@ -128,11 +129,15 @@ export declare class Autosuggest extends Overlay {
128
129
  * may have performance benefits in frameworks that use virtual DOM (such as `Vue`, `React`, `hyperHTML` and others)
129
130
  */
130
131
  htmlRenderer: boolean;
132
+ /**
133
+ * Autosuggest internal translation strings
134
+ */
135
+ protected t: TranslateDirective;
131
136
  protected moreResultsItem?: HTMLElement | null;
132
- private contentSlot?;
133
- private contentElement?;
134
- private headerElement?;
135
- private footerElement?;
137
+ private contentSlotRef;
138
+ private contentElementRef;
139
+ private headerElementRef;
140
+ private footerElementRef;
136
141
  private suggestionMap;
137
142
  protected highlightedItem: HTMLElement | null;
138
143
  protected attachTarget: AutosuggestTargetElement | null;
@@ -180,20 +185,6 @@ export declare class Autosuggest extends Overlay {
180
185
  * @returns {void}
181
186
  */
182
187
  resizedCallback(size: ElementSize): void;
183
- /**
184
- * @returns template of loader if currently query loading
185
- */
186
- protected get loaderTemplate(): TemplateResult | null;
187
- /**
188
- * @returns template of moreResults
189
- */
190
- protected get moreResultsTemplate(): TemplateResult | null;
191
- /**
192
- * A `TemplateResult` that will be used
193
- * to render the updated internal template.
194
- * @return Render template
195
- */
196
- protected render(): TemplateResult;
197
188
  /**
198
189
  * Called once after the component is first rendered
199
190
  * @param changedProperties map of changed properties with old values
@@ -277,14 +268,12 @@ export declare class Autosuggest extends Overlay {
277
268
  * @returns {void}
278
269
  */
279
270
  protected highlightItem(target?: HTMLElement | null, silent?: boolean): void;
271
+ private xmlSerializer;
280
272
  /**
281
273
  * Calculate more search text inner html
282
- * @param moreResults True if has more results
283
- * @param moreSearchText More search text template
284
- * @param query A query
285
274
  * @returns innerHTML
286
275
  */
287
- protected highlightText(moreResults: boolean, moreSearchText: string, query: AutosuggestQuery | null): TemplateResult | null;
276
+ protected get moreResultsTextTemplate(): TemplateResult | null;
288
277
  /**
289
278
  * Call this method to request suggestions
290
279
  * @private
@@ -391,7 +380,7 @@ export declare class Autosuggest extends Overlay {
391
380
  */
392
381
  private debounceRateChange;
393
382
  /**
394
- * fire event and reinit listeners if attach was changed
383
+ * fire event and re-init listeners if attach was changed
395
384
  * @returns {void}
396
385
  */
397
386
  private attachChangeFrameCallback;
@@ -496,7 +485,6 @@ export declare class Autosuggest extends Overlay {
496
485
  * @returns {void}
497
486
  */
498
487
  private notifySuggestions;
499
- private removeChildNode;
500
488
  private generateSuggestionsFragment;
501
489
  /**
502
490
  * Set the width
@@ -509,6 +497,20 @@ export declare class Autosuggest extends Overlay {
509
497
  * @returns {void}
510
498
  */
511
499
  private onItemMousedown;
500
+ /**
501
+ * @returns template of loader if currently query loading
502
+ */
503
+ protected get loaderTemplate(): TemplateResult | null;
504
+ /**
505
+ * @returns template of moreResults
506
+ */
507
+ protected get moreResultsTemplate(): TemplateResult | null;
508
+ /**
509
+ * A `TemplateResult` that will be used
510
+ * to render the updated internal template.
511
+ * @return Render template
512
+ */
513
+ protected render(): TemplateResult;
512
514
  /**
513
515
  * IE11 only: Restrict maximum height of content element
514
516
  * @param [maxHeight] Maximum height of content element