@telia-ace/widget-ui 1.0.8 → 1.0.11

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 (317) hide show
  1. package/LICENSE.txt +5 -5
  2. package/README.md +3 -3
  3. package/{lib-esm → dist}/components/anchor-link.d.ts +4 -4
  4. package/{lib → dist}/components/button.d.ts +4 -4
  5. package/{lib-esm → dist}/components/checkbox.d.ts +7 -7
  6. package/{lib-esm → dist}/components/drawer/drawer.d.ts +21 -21
  7. package/{lib-esm → dist}/components/drawer/index.d.ts +3 -3
  8. package/{lib-esm → dist}/components/dropdown/dropdown.d.ts +9 -9
  9. package/{lib → dist}/components/dropdown/index.d.ts +4 -4
  10. package/{lib-esm → dist}/components/dropdown/use-position.d.ts +5 -5
  11. package/{lib → dist}/components/empty.d.ts +4 -4
  12. package/{lib → dist}/components/grid.d.ts +7 -7
  13. package/{lib-esm → dist}/components/html.d.ts +12 -12
  14. package/{lib → dist}/components/icon.d.ts +7 -7
  15. package/{lib-esm → dist}/components/index.d.ts +58 -58
  16. package/{lib-esm → dist}/components/input.d.ts +10 -10
  17. package/{lib → dist}/components/item-list.d.ts +10 -10
  18. package/{lib → dist}/components/item-tree.d.ts +13 -13
  19. package/{lib-esm → dist}/components/lightbox.d.ts +6 -6
  20. package/{lib-esm → dist}/components/link.d.ts +11 -11
  21. package/{lib-esm → dist}/components/list.d.ts +9 -9
  22. package/{lib-esm → dist}/components/modal/confirm.d.ts +12 -12
  23. package/{lib → dist}/components/modal/index.d.ts +4 -4
  24. package/{lib-esm → dist}/components/modal/modal.d.ts +10 -10
  25. package/{lib → dist}/components/not-found.d.ts +9 -9
  26. package/{lib → dist}/components/overlay.d.ts +8 -8
  27. package/{lib-esm → dist}/components/paragraph.d.ts +11 -11
  28. package/{lib → dist}/components/portal.d.ts +7 -7
  29. package/{lib-esm → dist}/components/route-link.d.ts +11 -11
  30. package/{lib → dist}/components/symbol-badge.d.ts +15 -15
  31. package/{lib-esm → dist}/components/tab-stop.d.ts +18 -18
  32. package/{lib-esm → dist}/components/text-link.d.ts +8 -8
  33. package/{lib-esm → dist}/components/text.d.ts +4 -4
  34. package/{lib-esm → dist}/components/timestamp.d.ts +13 -13
  35. package/{lib-esm → dist}/components/tooltip.d.ts +8 -8
  36. package/{lib-esm → dist}/components/transition-component.d.ts +30 -30
  37. package/{lib → dist}/components/typography.d.ts +9 -9
  38. package/{lib → dist}/components/widget-link.d.ts +10 -10
  39. package/{lib → dist}/contexts/index.d.ts +9 -9
  40. package/{lib-esm → dist}/create-react-component.d.ts +11 -11
  41. package/{lib-esm → dist}/hooks/index.d.ts +27 -27
  42. package/{lib → dist}/hooks/use-action.d.ts +4 -4
  43. package/{lib-esm → dist}/hooks/use-children.d.ts +4 -4
  44. package/{lib-esm → dist}/hooks/use-columns.d.ts +2 -2
  45. package/{lib-esm → dist}/hooks/use-component-descriptor.d.ts +2 -2
  46. package/{lib-esm → dist}/hooks/use-component-node.d.ts +6 -6
  47. package/{lib → dist}/hooks/use-component-platform.d.ts +4 -4
  48. package/{lib → dist}/hooks/use-component.d.ts +3 -3
  49. package/{lib-esm → dist}/hooks/use-container.d.ts +2 -2
  50. package/{lib-esm → dist}/hooks/use-context.d.ts +3 -3
  51. package/{lib-esm → dist}/hooks/use-dispatch.d.ts +3 -3
  52. package/{lib-esm → dist}/hooks/use-event-listener.d.ts +2 -2
  53. package/{lib-esm → dist}/hooks/use-events.d.ts +3 -3
  54. package/{lib-esm → dist}/hooks/use-is-mounted.d.ts +3 -3
  55. package/{lib-esm → dist}/hooks/use-key-press.d.ts +2 -2
  56. package/{lib-esm → dist}/hooks/use-layout.d.ts +3 -3
  57. package/{lib-esm → dist}/hooks/use-previous.d.ts +2 -2
  58. package/{lib-esm → dist}/hooks/use-properties.d.ts +6 -6
  59. package/{lib-esm → dist}/hooks/use-render-state.d.ts +4 -4
  60. package/{lib → dist}/hooks/use-route-data.d.ts +4 -4
  61. package/{lib-esm → dist}/hooks/use-router.d.ts +3 -3
  62. package/{lib → dist}/hooks/use-scroll.d.ts +2 -2
  63. package/{lib-esm → dist}/hooks/use-settings.d.ts +3 -3
  64. package/{lib-esm → dist}/hooks/use-toggle.d.ts +2 -2
  65. package/{lib → dist}/hooks/use-transition-end.d.ts +2 -2
  66. package/{lib-esm → dist}/hooks/use-unique-menu.d.ts +2 -2
  67. package/{lib-esm → dist}/hooks/use-widget-event.d.ts +3 -3
  68. package/{lib-esm → dist}/index.d.ts +9 -9
  69. package/dist/index.js +2988 -0
  70. package/dist/index.js.map +1 -0
  71. package/{lib-esm → dist}/styles.d.ts +19 -19
  72. package/{lib-esm → dist}/utils/animations.d.ts +18 -18
  73. package/{lib → dist}/utils/browser.d.ts +12 -12
  74. package/{lib-esm → dist}/utils/convert-to-string-attributes.d.ts +2 -2
  75. package/{lib → dist}/utils/create-empty-component.d.ts +3 -3
  76. package/{lib → dist}/utils/embedded-link-mapper.d.ts +3 -3
  77. package/{lib-esm → dist}/utils/filter-css-props.d.ts +8 -8
  78. package/{lib → dist}/utils/generic-hash-link.d.ts +8 -8
  79. package/{lib-esm → dist}/utils/heading-styles.d.ts +1 -1
  80. package/{lib-esm → dist}/utils/index.d.ts +12 -12
  81. package/{lib → dist}/utils/process-html-string.d.ts +4 -4
  82. package/{lib-esm → dist}/utils/render-instructions.d.ts +8 -8
  83. package/package.json +11 -12
  84. package/lib/components/anchor-link.d.ts +0 -4
  85. package/lib/components/anchor-link.js +0 -7
  86. package/lib/components/button.js +0 -64
  87. package/lib/components/checkbox.d.ts +0 -7
  88. package/lib/components/checkbox.js +0 -39
  89. package/lib/components/drawer/drawer.d.ts +0 -21
  90. package/lib/components/drawer/drawer.js +0 -150
  91. package/lib/components/drawer/index.d.ts +0 -3
  92. package/lib/components/drawer/index.js +0 -29
  93. package/lib/components/dropdown/dropdown.d.ts +0 -9
  94. package/lib/components/dropdown/dropdown.js +0 -155
  95. package/lib/components/dropdown/index.js +0 -10
  96. package/lib/components/dropdown/use-position.d.ts +0 -5
  97. package/lib/components/dropdown/use-position.js +0 -57
  98. package/lib/components/empty.js +0 -40
  99. package/lib/components/grid.js +0 -64
  100. package/lib/components/html.d.ts +0 -12
  101. package/lib/components/html.js +0 -78
  102. package/lib/components/icon.js +0 -35
  103. package/lib/components/index.d.ts +0 -58
  104. package/lib/components/index.js +0 -69
  105. package/lib/components/input.d.ts +0 -10
  106. package/lib/components/input.js +0 -94
  107. package/lib/components/item-list.js +0 -62
  108. package/lib/components/item-tree.js +0 -55
  109. package/lib/components/lightbox.d.ts +0 -6
  110. package/lib/components/lightbox.js +0 -92
  111. package/lib/components/link.d.ts +0 -11
  112. package/lib/components/link.js +0 -99
  113. package/lib/components/list.d.ts +0 -9
  114. package/lib/components/list.js +0 -56
  115. package/lib/components/modal/confirm.d.ts +0 -12
  116. package/lib/components/modal/confirm.js +0 -61
  117. package/lib/components/modal/index.js +0 -10
  118. package/lib/components/modal/modal.d.ts +0 -10
  119. package/lib/components/modal/modal.js +0 -127
  120. package/lib/components/not-found.js +0 -55
  121. package/lib/components/overlay.js +0 -73
  122. package/lib/components/paragraph.d.ts +0 -11
  123. package/lib/components/paragraph.js +0 -66
  124. package/lib/components/portal.js +0 -61
  125. package/lib/components/route-link.d.ts +0 -11
  126. package/lib/components/route-link.js +0 -115
  127. package/lib/components/symbol-badge.js +0 -205
  128. package/lib/components/tab-stop.d.ts +0 -18
  129. package/lib/components/tab-stop.js +0 -100
  130. package/lib/components/text-link.d.ts +0 -8
  131. package/lib/components/text-link.js +0 -62
  132. package/lib/components/text.d.ts +0 -4
  133. package/lib/components/text.js +0 -35
  134. package/lib/components/timestamp.d.ts +0 -13
  135. package/lib/components/timestamp.js +0 -39
  136. package/lib/components/tooltip.d.ts +0 -8
  137. package/lib/components/tooltip.js +0 -127
  138. package/lib/components/transition-component.d.ts +0 -30
  139. package/lib/components/transition-component.js +0 -77
  140. package/lib/components/typography.js +0 -43
  141. package/lib/components/widget-link.js +0 -116
  142. package/lib/contexts/index.js +0 -15
  143. package/lib/create-react-component.d.ts +0 -11
  144. package/lib/create-react-component.js +0 -18
  145. package/lib/hooks/index.d.ts +0 -27
  146. package/lib/hooks/index.js +0 -58
  147. package/lib/hooks/use-action.js +0 -21
  148. package/lib/hooks/use-children.d.ts +0 -4
  149. package/lib/hooks/use-children.js +0 -70
  150. package/lib/hooks/use-columns.d.ts +0 -2
  151. package/lib/hooks/use-columns.js +0 -6
  152. package/lib/hooks/use-component-descriptor.d.ts +0 -2
  153. package/lib/hooks/use-component-descriptor.js +0 -6
  154. package/lib/hooks/use-component-node.d.ts +0 -6
  155. package/lib/hooks/use-component-node.js +0 -37
  156. package/lib/hooks/use-component-platform.js +0 -39
  157. package/lib/hooks/use-component.js +0 -57
  158. package/lib/hooks/use-container.d.ts +0 -2
  159. package/lib/hooks/use-container.js +0 -6
  160. package/lib/hooks/use-context.d.ts +0 -3
  161. package/lib/hooks/use-context.js +0 -50
  162. package/lib/hooks/use-dispatch.d.ts +0 -3
  163. package/lib/hooks/use-dispatch.js +0 -64
  164. package/lib/hooks/use-event-listener.d.ts +0 -2
  165. package/lib/hooks/use-event-listener.js +0 -21
  166. package/lib/hooks/use-events.d.ts +0 -3
  167. package/lib/hooks/use-events.js +0 -12
  168. package/lib/hooks/use-is-mounted.d.ts +0 -3
  169. package/lib/hooks/use-is-mounted.js +0 -14
  170. package/lib/hooks/use-key-press.d.ts +0 -2
  171. package/lib/hooks/use-key-press.js +0 -46
  172. package/lib/hooks/use-layout.d.ts +0 -3
  173. package/lib/hooks/use-layout.js +0 -50
  174. package/lib/hooks/use-previous.d.ts +0 -2
  175. package/lib/hooks/use-previous.js +0 -11
  176. package/lib/hooks/use-properties.d.ts +0 -6
  177. package/lib/hooks/use-properties.js +0 -9
  178. package/lib/hooks/use-render-state.d.ts +0 -4
  179. package/lib/hooks/use-render-state.js +0 -70
  180. package/lib/hooks/use-route-data.js +0 -58
  181. package/lib/hooks/use-router.d.ts +0 -3
  182. package/lib/hooks/use-router.js +0 -9
  183. package/lib/hooks/use-scroll.js +0 -71
  184. package/lib/hooks/use-settings.d.ts +0 -3
  185. package/lib/hooks/use-settings.js +0 -38
  186. package/lib/hooks/use-toggle.d.ts +0 -2
  187. package/lib/hooks/use-toggle.js +0 -28
  188. package/lib/hooks/use-transition-end.js +0 -62
  189. package/lib/hooks/use-unique-menu.d.ts +0 -2
  190. package/lib/hooks/use-unique-menu.js +0 -15
  191. package/lib/hooks/use-widget-event.d.ts +0 -3
  192. package/lib/hooks/use-widget-event.js +0 -21
  193. package/lib/index.d.ts +0 -9
  194. package/lib/index.js +0 -98
  195. package/lib/styles.d.ts +0 -19
  196. package/lib/styles.js +0 -53
  197. package/lib/utils/animations.d.ts +0 -18
  198. package/lib/utils/animations.js +0 -104
  199. package/lib/utils/browser.js +0 -54
  200. package/lib/utils/convert-to-string-attributes.d.ts +0 -2
  201. package/lib/utils/convert-to-string-attributes.js +0 -23
  202. package/lib/utils/create-empty-component.js +0 -25
  203. package/lib/utils/embedded-link-mapper.js +0 -62
  204. package/lib/utils/filter-css-props.d.ts +0 -8
  205. package/lib/utils/filter-css-props.js +0 -28
  206. package/lib/utils/generic-hash-link.js +0 -70
  207. package/lib/utils/heading-styles.d.ts +0 -1
  208. package/lib/utils/heading-styles.js +0 -48
  209. package/lib/utils/index.d.ts +0 -12
  210. package/lib/utils/index.js +0 -28
  211. package/lib/utils/process-html-string.js +0 -16
  212. package/lib/utils/render-instructions.d.ts +0 -8
  213. package/lib/utils/render-instructions.js +0 -19
  214. package/lib-esm/components/anchor-link.js +0 -5
  215. package/lib-esm/components/button.d.ts +0 -4
  216. package/lib-esm/components/button.js +0 -36
  217. package/lib-esm/components/checkbox.js +0 -34
  218. package/lib-esm/components/drawer/drawer.js +0 -121
  219. package/lib-esm/components/drawer/index.js +0 -3
  220. package/lib-esm/components/dropdown/dropdown.js +0 -127
  221. package/lib-esm/components/dropdown/index.d.ts +0 -4
  222. package/lib-esm/components/dropdown/index.js +0 -3
  223. package/lib-esm/components/dropdown/use-position.js +0 -53
  224. package/lib-esm/components/empty.d.ts +0 -4
  225. package/lib-esm/components/empty.js +0 -35
  226. package/lib-esm/components/grid.d.ts +0 -7
  227. package/lib-esm/components/grid.js +0 -36
  228. package/lib-esm/components/html.js +0 -53
  229. package/lib-esm/components/icon.d.ts +0 -7
  230. package/lib-esm/components/icon.js +0 -30
  231. package/lib-esm/components/index.js +0 -30
  232. package/lib-esm/components/input.js +0 -69
  233. package/lib-esm/components/item-list.d.ts +0 -10
  234. package/lib-esm/components/item-list.js +0 -34
  235. package/lib-esm/components/item-tree.d.ts +0 -13
  236. package/lib-esm/components/item-tree.js +0 -50
  237. package/lib-esm/components/lightbox.js +0 -64
  238. package/lib-esm/components/link.js +0 -71
  239. package/lib-esm/components/list.js +0 -31
  240. package/lib-esm/components/modal/confirm.js +0 -33
  241. package/lib-esm/components/modal/index.d.ts +0 -4
  242. package/lib-esm/components/modal/index.js +0 -3
  243. package/lib-esm/components/modal/modal.js +0 -99
  244. package/lib-esm/components/not-found.d.ts +0 -9
  245. package/lib-esm/components/not-found.js +0 -27
  246. package/lib-esm/components/overlay.d.ts +0 -8
  247. package/lib-esm/components/overlay.js +0 -45
  248. package/lib-esm/components/paragraph.js +0 -38
  249. package/lib-esm/components/portal.d.ts +0 -7
  250. package/lib-esm/components/portal.js +0 -36
  251. package/lib-esm/components/route-link.js +0 -90
  252. package/lib-esm/components/symbol-badge.d.ts +0 -15
  253. package/lib-esm/components/symbol-badge.js +0 -200
  254. package/lib-esm/components/tab-stop.js +0 -75
  255. package/lib-esm/components/text-link.js +0 -34
  256. package/lib-esm/components/text.js +0 -30
  257. package/lib-esm/components/timestamp.js +0 -33
  258. package/lib-esm/components/tooltip.js +0 -99
  259. package/lib-esm/components/transition-component.js +0 -72
  260. package/lib-esm/components/typography.d.ts +0 -9
  261. package/lib-esm/components/typography.js +0 -38
  262. package/lib-esm/components/widget-link.d.ts +0 -10
  263. package/lib-esm/components/widget-link.js +0 -88
  264. package/lib-esm/contexts/index.d.ts +0 -9
  265. package/lib-esm/contexts/index.js +0 -12
  266. package/lib-esm/create-react-component.js +0 -16
  267. package/lib-esm/hooks/index.js +0 -26
  268. package/lib-esm/hooks/use-action.d.ts +0 -4
  269. package/lib-esm/hooks/use-action.js +0 -14
  270. package/lib-esm/hooks/use-children.js +0 -65
  271. package/lib-esm/hooks/use-columns.js +0 -4
  272. package/lib-esm/hooks/use-component-descriptor.js +0 -4
  273. package/lib-esm/hooks/use-component-node.js +0 -35
  274. package/lib-esm/hooks/use-component-platform.d.ts +0 -4
  275. package/lib-esm/hooks/use-component-platform.js +0 -34
  276. package/lib-esm/hooks/use-component.d.ts +0 -3
  277. package/lib-esm/hooks/use-component.js +0 -52
  278. package/lib-esm/hooks/use-container.js +0 -4
  279. package/lib-esm/hooks/use-context.js +0 -45
  280. package/lib-esm/hooks/use-dispatch.js +0 -59
  281. package/lib-esm/hooks/use-event-listener.js +0 -19
  282. package/lib-esm/hooks/use-events.js +0 -7
  283. package/lib-esm/hooks/use-is-mounted.js +0 -12
  284. package/lib-esm/hooks/use-key-press.js +0 -41
  285. package/lib-esm/hooks/use-layout.js +0 -45
  286. package/lib-esm/hooks/use-previous.js +0 -9
  287. package/lib-esm/hooks/use-properties.js +0 -7
  288. package/lib-esm/hooks/use-render-state.js +0 -65
  289. package/lib-esm/hooks/use-route-data.d.ts +0 -4
  290. package/lib-esm/hooks/use-route-data.js +0 -53
  291. package/lib-esm/hooks/use-router.js +0 -7
  292. package/lib-esm/hooks/use-scroll.d.ts +0 -2
  293. package/lib-esm/hooks/use-scroll.js +0 -66
  294. package/lib-esm/hooks/use-settings.js +0 -33
  295. package/lib-esm/hooks/use-toggle.js +0 -26
  296. package/lib-esm/hooks/use-transition-end.d.ts +0 -2
  297. package/lib-esm/hooks/use-transition-end.js +0 -60
  298. package/lib-esm/hooks/use-unique-menu.js +0 -10
  299. package/lib-esm/hooks/use-widget-event.js +0 -16
  300. package/lib-esm/index.js +0 -7
  301. package/lib-esm/styles.js +0 -26
  302. package/lib-esm/utils/animations.js +0 -101
  303. package/lib-esm/utils/browser.d.ts +0 -12
  304. package/lib-esm/utils/browser.js +0 -51
  305. package/lib-esm/utils/convert-to-string-attributes.js +0 -21
  306. package/lib-esm/utils/create-empty-component.d.ts +0 -3
  307. package/lib-esm/utils/create-empty-component.js +0 -20
  308. package/lib-esm/utils/embedded-link-mapper.d.ts +0 -3
  309. package/lib-esm/utils/embedded-link-mapper.js +0 -57
  310. package/lib-esm/utils/filter-css-props.js +0 -25
  311. package/lib-esm/utils/generic-hash-link.d.ts +0 -8
  312. package/lib-esm/utils/generic-hash-link.js +0 -63
  313. package/lib-esm/utils/heading-styles.js +0 -44
  314. package/lib-esm/utils/index.js +0 -10
  315. package/lib-esm/utils/process-html-string.d.ts +0 -4
  316. package/lib-esm/utils/process-html-string.js +0 -10
  317. package/lib-esm/utils/render-instructions.js +0 -12
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var react_1 = require("react");
4
- var contexts_1 = require("../contexts");
5
- var useComponentDescriptor = function () { return (0, react_1.useContext)(contexts_1.ComponentNodeContext); };
6
- exports.default = useComponentDescriptor;
@@ -1,6 +0,0 @@
1
- import { ComponentNode } from '@telia-ace/widget-core';
2
- /**
3
- * Provides the `ComponentNode` for the current context.
4
- */
5
- declare const useComponentNode: (id?: string | undefined) => ComponentNode | undefined;
6
- export default useComponentNode;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- var react_1 = require("react");
20
- var _1 = require(".");
21
- var contexts_1 = require("../contexts");
22
- /**
23
- * Provides the `ComponentNode` for the current context.
24
- */
25
- var useComponentNode = function (id) {
26
- var descriptor = (0, react_1.useContext)(contexts_1.ComponentNodeContext);
27
- var components = (0, _1.useComponentPlatform)();
28
- var _a = __read((0, react_1.useState)(), 2), node = _a[0], setNode = _a[1];
29
- (0, react_1.useEffect)(function () {
30
- if ((id || descriptor.id) && components) {
31
- var node_1 = components.nodes.get(id || descriptor.id);
32
- setNode(node_1);
33
- }
34
- }, [id, descriptor.id, components]);
35
- return node;
36
- };
37
- exports.default = useComponentNode;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __importDefault = (this && this.__importDefault) || function (mod) {
19
- return (mod && mod.__esModule) ? mod : { "default": mod };
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- var widget_core_1 = require("@telia-ace/widget-core");
23
- var react_1 = require("react");
24
- var use_container_1 = __importDefault(require("./use-container"));
25
- var use_is_mounted_1 = __importDefault(require("./use-is-mounted"));
26
- var useComponentPlatform = function (passedContainer) {
27
- var container = (0, use_container_1.default)();
28
- var _a = __read((0, react_1.useState)(null), 2), componentPlatform = _a[0], setComponentPlatform = _a[1];
29
- var isMounted = (0, use_is_mounted_1.default)();
30
- (0, react_1.useEffect)(function () {
31
- widget_core_1.ComponentPlatform.getInstance(passedContainer || container).then(function (platform) {
32
- if (isMounted.current) {
33
- setComponentPlatform(platform);
34
- }
35
- });
36
- }, [isMounted]);
37
- return componentPlatform;
38
- };
39
- exports.default = useComponentPlatform;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __importDefault = (this && this.__importDefault) || function (mod) {
19
- return (mod && mod.__esModule) ? mod : { "default": mod };
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- var react_1 = require("react");
23
- var use_component_descriptor_1 = __importDefault(require("./use-component-descriptor"));
24
- var use_container_1 = __importDefault(require("./use-container"));
25
- var use_is_mounted_1 = __importDefault(require("./use-is-mounted"));
26
- var useComponent = function (passedType, passedContainer) {
27
- var descriptor = (0, use_component_descriptor_1.default)();
28
- var container = (0, use_container_1.default)();
29
- var _a = __read((0, react_1.useState)(undefined), 2), component = _a[0], setComponent = _a[1];
30
- var isMounted = (0, use_is_mounted_1.default)();
31
- var type = passedType || descriptor.type || '';
32
- (0, react_1.useEffect)(function () {
33
- if (type) {
34
- var unsubscribe_1;
35
- (passedContainer || container)
36
- .getAsync('componentResolver')
37
- .then(function (resolver) {
38
- if (isMounted.current) {
39
- var component_1 = resolver.getComponent(type);
40
- setComponent(component_1);
41
- }
42
- unsubscribe_1 = resolver.registerResolver(type, function (component) {
43
- if (isMounted.current) {
44
- setComponent(component);
45
- }
46
- });
47
- });
48
- return function () {
49
- if (unsubscribe_1) {
50
- unsubscribe_1();
51
- }
52
- };
53
- }
54
- }, [isMounted, type, passedContainer, container]);
55
- return component;
56
- };
57
- exports.default = useComponent;
@@ -1,2 +0,0 @@
1
- declare const useContainer: () => import("@webprovisions/platform").Container;
2
- export default useContainer;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var react_1 = require("react");
4
- var contexts_1 = require("../contexts");
5
- var useContainer = function () { return (0, react_1.useContext)(contexts_1.ContainerContext); };
6
- exports.default = useContainer;
@@ -1,3 +0,0 @@
1
- import { ComponentNodeContext } from '@telia-ace/widget-core';
2
- declare const useContext: <T extends ComponentNodeContext>(id?: string | undefined) => T;
3
- export default useContext;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __importDefault = (this && this.__importDefault) || function (mod) {
19
- return (mod && mod.__esModule) ? mod : { "default": mod };
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- var react_1 = require("react");
23
- var use_component_node_1 = __importDefault(require("./use-component-node"));
24
- var use_component_platform_1 = __importDefault(require("./use-component-platform"));
25
- var use_is_mounted_1 = __importDefault(require("./use-is-mounted"));
26
- var useContext = function (id) {
27
- var node = (0, use_component_node_1.default)(id);
28
- var components = (0, use_component_platform_1.default)();
29
- var _a = __read((0, react_1.useState)({}), 2), context = _a[0], setContext = _a[1];
30
- var isMounted = (0, use_is_mounted_1.default)();
31
- (0, react_1.useEffect)(function () {
32
- if (node && isMounted.current) {
33
- setContext(node.attributes.context);
34
- }
35
- }, [isMounted, node]);
36
- (0, react_1.useEffect)(function () {
37
- if (components) {
38
- var unsubscribe_1 = components.events.subscribe('components:context-changed', function (event, data) {
39
- if (node === data.node && isMounted.current) {
40
- setContext(data.node.attributes.context);
41
- }
42
- });
43
- return function () {
44
- unsubscribe_1();
45
- };
46
- }
47
- }, [isMounted, components]);
48
- return context;
49
- };
50
- exports.default = useContext;
@@ -1,3 +0,0 @@
1
- export declare type DispatchAction = (key: string, data?: any) => Promise<any>;
2
- declare const useDispatch: () => DispatchAction;
3
- export default useDispatch;
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __importDefault = (this && this.__importDefault) || function (mod) {
19
- return (mod && mod.__esModule) ? mod : { "default": mod };
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- var widget_core_1 = require("@telia-ace/widget-core");
23
- var widget_utilities_1 = require("@telia-ace/widget-utilities");
24
- var react_1 = require("react");
25
- var use_component_descriptor_1 = __importDefault(require("./use-component-descriptor"));
26
- var use_component_platform_1 = __importDefault(require("./use-component-platform"));
27
- var useDispatch = function () {
28
- var components = (0, use_component_platform_1.default)();
29
- var descriptor = (0, use_component_descriptor_1.default)();
30
- var _a = __read((0, react_1.useState)([]), 2), queue = _a[0], setQueue = _a[1];
31
- var _b = __read((0, react_1.useState)(), 2), actions = _b[0], setActions = _b[1];
32
- (0, react_1.useEffect)(function () {
33
- if (components && descriptor) {
34
- var component = new widget_core_1.ComponentQuery(components).withId(descriptor.id);
35
- var actions_1 = components.actions(component, descriptor.type || (0, widget_utilities_1.uuid)());
36
- setActions(actions_1);
37
- // process the queue and set it to null
38
- if (queue !== null) {
39
- queue.forEach(function (item) {
40
- actions_1
41
- .dispatch(item.key, item.data)
42
- .then(function (value) { return item.resolve(value); })
43
- .catch(function (reason) { return item.reject(reason); });
44
- });
45
- setQueue(null);
46
- }
47
- }
48
- }, [components, descriptor.id]);
49
- return function (key, data) {
50
- if (queue !== null) {
51
- // if queue is available the actions controller is not yet created
52
- return new Promise(function (resolve, reject) {
53
- queue.push({
54
- key: key,
55
- data: data,
56
- resolve: resolve,
57
- reject: reject,
58
- });
59
- });
60
- }
61
- return actions.dispatch(key, data);
62
- };
63
- };
64
- exports.default = useDispatch;
@@ -1,2 +0,0 @@
1
- declare const _default: (eventName: string, handler: Function, element?: HTMLElement | Window, condition?: () => boolean) => void;
2
- export default _default;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var react_1 = require("react");
4
- exports.default = (function (eventName, handler, element, condition) {
5
- if (element === void 0) { element = window; }
6
- if (condition === void 0) { condition = function () { return true; }; }
7
- var savedHandler = (0, react_1.useRef)(function () { });
8
- (0, react_1.useEffect)(function () {
9
- savedHandler.current = handler;
10
- }, [handler]);
11
- (0, react_1.useEffect)(function () {
12
- var isSupported = element && condition();
13
- if (!isSupported)
14
- return;
15
- var eventListener = function (event) { return savedHandler.current(event); };
16
- element.addEventListener(eventName, eventListener);
17
- return function () {
18
- element.removeEventListener(eventName, eventListener);
19
- };
20
- }, [eventName, element]);
21
- });
@@ -1,3 +0,0 @@
1
- import { Container, EventManager } from '@webprovisions/platform';
2
- declare const useEvents: (passedContainer?: Container | undefined) => EventManager;
3
- export default useEvents;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var use_container_1 = __importDefault(require("./use-container"));
7
- var useEvents = function (passedContainer) {
8
- var container = (0, use_container_1.default)();
9
- var events = (passedContainer || container).get('$widget').events;
10
- return events;
11
- };
12
- exports.default = useEvents;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare const useIsMounted: () => import("react").MutableRefObject<boolean>;
3
- export default useIsMounted;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var react_1 = require("react");
4
- var useIsMounted = function () {
5
- var isMounted = (0, react_1.useRef)(false);
6
- (0, react_1.useEffect)(function () {
7
- isMounted.current = true;
8
- return function () {
9
- isMounted.current = false;
10
- };
11
- }, []);
12
- return isMounted;
13
- };
14
- exports.default = useIsMounted;
@@ -1,2 +0,0 @@
1
- declare const useKeyPress: (targetKey: string, action?: ((event: KeyboardEvent) => void) | undefined) => boolean;
2
- export default useKeyPress;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __importDefault = (this && this.__importDefault) || function (mod) {
19
- return (mod && mod.__esModule) ? mod : { "default": mod };
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- var react_1 = require("react");
23
- var use_event_listener_1 = __importDefault(require("./use-event-listener"));
24
- var useKeyPress = function (targetKey, action) {
25
- // State for keeping track of whether key is pressed
26
- var _a = __read((0, react_1.useState)(false), 2), keyPressed = _a[0], setKeyPressed = _a[1];
27
- var onKeyDown = (0, react_1.useCallback)(function (event) {
28
- var key = event.key;
29
- if (key === targetKey) {
30
- setKeyPressed(true);
31
- if (action) {
32
- action(event);
33
- }
34
- }
35
- }, [setKeyPressed, action]);
36
- var onKeyUp = (0, react_1.useCallback)(function (_a) {
37
- var key = _a.key;
38
- if (key === targetKey) {
39
- setKeyPressed(false);
40
- }
41
- }, [setKeyPressed]);
42
- (0, use_event_listener_1.default)('keydown', onKeyDown, window);
43
- (0, use_event_listener_1.default)('keyup', onKeyUp, window);
44
- return keyPressed;
45
- };
46
- exports.default = useKeyPress;
@@ -1,3 +0,0 @@
1
- import { ComponentNodeLayout } from '@telia-ace/widget-core';
2
- declare const useLayout: (id?: string | undefined) => ComponentNodeLayout;
3
- export default useLayout;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __importDefault = (this && this.__importDefault) || function (mod) {
19
- return (mod && mod.__esModule) ? mod : { "default": mod };
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- var react_1 = require("react");
23
- var use_component_node_1 = __importDefault(require("./use-component-node"));
24
- var use_component_platform_1 = __importDefault(require("./use-component-platform"));
25
- var use_is_mounted_1 = __importDefault(require("./use-is-mounted"));
26
- var useLayout = function (id) {
27
- var node = (0, use_component_node_1.default)(id);
28
- var components = (0, use_component_platform_1.default)();
29
- var _a = __read((0, react_1.useState)({}), 2), layout = _a[0], setLayout = _a[1];
30
- var isMounted = (0, use_is_mounted_1.default)();
31
- (0, react_1.useEffect)(function () {
32
- if (node && isMounted.current) {
33
- setLayout(node.attributes.layout);
34
- }
35
- }, [node, isMounted]);
36
- (0, react_1.useEffect)(function () {
37
- if (components) {
38
- var unsubscribe_1 = components.events.subscribe('components:layout-changed', function (event, data) {
39
- if (node === data.node && isMounted.current) {
40
- setLayout(data.node.attributes.layout);
41
- }
42
- });
43
- return function () {
44
- unsubscribe_1();
45
- };
46
- }
47
- }, [components, isMounted]);
48
- return layout;
49
- };
50
- exports.default = useLayout;
@@ -1,2 +0,0 @@
1
- declare const usePrevious: <T>(value: T) => T | undefined;
2
- export default usePrevious;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var react_1 = require("react");
4
- var usePrevious = function (value) {
5
- var ref = (0, react_1.useRef)();
6
- (0, react_1.useEffect)(function () {
7
- ref.current = value;
8
- });
9
- return ref.current;
10
- };
11
- exports.default = usePrevious;
@@ -1,6 +0,0 @@
1
- import { ComponentNodeProperties } from '@telia-ace/widget-core';
2
- declare type DataProperties = {
3
- loading?: boolean;
4
- };
5
- declare const useProperties: <T extends ComponentNodeProperties>() => Merge<DataProperties, T>;
6
- export default useProperties;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var react_1 = require("react");
4
- var contexts_1 = require("../contexts");
5
- var useProperties = function () {
6
- var properties = (0, react_1.useContext)(contexts_1.ComponentPropertyContext);
7
- return properties;
8
- };
9
- exports.default = useProperties;
@@ -1,4 +0,0 @@
1
- import { WidgetRenderState } from '@telia-ace/widget-core';
2
- import { Container } from '@webprovisions/platform';
3
- declare const useRenderState: (passedContainer?: Container | undefined) => WidgetRenderState | undefined;
4
- export default useRenderState;
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __importDefault = (this && this.__importDefault) || function (mod) {
19
- return (mod && mod.__esModule) ? mod : { "default": mod };
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- var widget_core_1 = require("@telia-ace/widget-core");
23
- var react_1 = require("react");
24
- var use_container_1 = __importDefault(require("./use-container"));
25
- var use_is_mounted_1 = __importDefault(require("./use-is-mounted"));
26
- var useRenderState = function (passedContainer) {
27
- var _a = __read((0, react_1.useState)(), 2), renderState = _a[0], setRenderState = _a[1];
28
- var container = (0, use_container_1.default)();
29
- var isMounted = (0, use_is_mounted_1.default)();
30
- (0, react_1.useEffect)(function () {
31
- var unsubscribe;
32
- var widget = (passedContainer || container).get('$widget');
33
- if (!widget) {
34
- return;
35
- }
36
- var name = widget.name, invoke = widget.invoke;
37
- invoke('renderState').then(function (renderState) {
38
- if (isMounted.current) {
39
- setRenderState(renderState);
40
- }
41
- });
42
- (passedContainer || container)
43
- .getAsync('actionResolver')
44
- .then(function (actionResolver) {
45
- unsubscribe = actionResolver.subscribe(name, function (origin, action) {
46
- switch (action) {
47
- case 'close':
48
- case 'open':
49
- if (isMounted.current) {
50
- setRenderState(action === 'open'
51
- ? widget_core_1.WidgetRenderState.open
52
- : widget_core_1.WidgetRenderState.closed);
53
- }
54
- break;
55
- case 'hide':
56
- if (isMounted.current) {
57
- setRenderState(widget_core_1.WidgetRenderState.hidden);
58
- }
59
- }
60
- });
61
- });
62
- return function () {
63
- if (unsubscribe) {
64
- unsubscribe();
65
- }
66
- };
67
- }, [isMounted]);
68
- return renderState;
69
- };
70
- exports.default = useRenderState;
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __importDefault = (this && this.__importDefault) || function (mod) {
19
- return (mod && mod.__esModule) ? mod : { "default": mod };
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- var widget_utilities_1 = require("@telia-ace/widget-utilities");
23
- var react_1 = require("react");
24
- var use_container_1 = __importDefault(require("./use-container"));
25
- var use_is_mounted_1 = __importDefault(require("./use-is-mounted"));
26
- var use_router_1 = __importDefault(require("./use-router"));
27
- var useRouteData = function (passedContainer) {
28
- var container = (0, use_container_1.default)();
29
- var router = (0, use_router_1.default)();
30
- var _a = __read((0, react_1.useState)({ name: '', params: {} }), 2), routeData = _a[0], setRouteData = _a[1];
31
- var isMounted = (0, use_is_mounted_1.default)();
32
- (0, react_1.useEffect)(function () {
33
- var widget = (passedContainer || container).get('$widget');
34
- if (!widget) {
35
- return;
36
- }
37
- var events = widget.events;
38
- var unsubscribe = events.subscribe('router:change', function (e, _a) {
39
- var routeData = _a.next.routeData;
40
- if (isMounted.current) {
41
- var name_1 = routeData.name, params = routeData.params;
42
- (0, widget_utilities_1.removeNullAndUndefinedValues)(params);
43
- setRouteData({ name: name_1, params: params });
44
- }
45
- });
46
- return unsubscribe;
47
- }, [isMounted, passedContainer, container]);
48
- (0, react_1.useEffect)(function () {
49
- if (router && router.history && isMounted.current) {
50
- var routeData_1 = router.getRouteData();
51
- var name_2 = routeData_1.name, params = routeData_1.params;
52
- (0, widget_utilities_1.removeNullAndUndefinedValues)(params);
53
- setRouteData({ name: name_2, params: params });
54
- }
55
- }, [router, isMounted]);
56
- return routeData;
57
- };
58
- exports.default = useRouteData;
@@ -1,3 +0,0 @@
1
- import { RoutingService } from '@telia-ace/widget-routing';
2
- declare const useRouter: () => RoutingService | null;
3
- export default useRouter;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var react_1 = require("react");
4
- var contexts_1 = require("../contexts");
5
- var useRouter = function () {
6
- var router = (0, react_1.useContext)(contexts_1.RoutingContext);
7
- return router;
8
- };
9
- exports.default = useRouter;