@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,71 +0,0 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- var __assign = (this && this.__assign) || function () {
6
- __assign = Object.assign || function(t) {
7
- for (var s, i = 1, n = arguments.length; i < n; i++) {
8
- s = arguments[i];
9
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
- t[p] = s[p];
11
- }
12
- return t;
13
- };
14
- return __assign.apply(this, arguments);
15
- };
16
- var __rest = (this && this.__rest) || function (s, e) {
17
- var t = {};
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
- t[p] = s[p];
20
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
- t[p[i]] = s[p[i]];
24
- }
25
- return t;
26
- };
27
- import { appendClassNames } from '@telia-ace/widget-utilities';
28
- import React, { forwardRef } from 'react';
29
- import styled from 'styled-components';
30
- import { convertToStringAttributes } from '../utils';
31
- import RouteLink from './route-link';
32
- export default forwardRef(function (_a, ref) {
33
- var className = _a.className, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.role, role = _c === void 0 ? 'link' : _c, _d = _a.tabIndex, tabIndex = _d === void 0 ? 0 : _d, _e = _a.onClick, onClick = _e === void 0 ? function () { } : _e, _f = _a.onKeyDown, onKeyDown = _f === void 0 ? function () { } : _f, title = _a.title, href = _a.href, children = _a.children, target = _a.target, routeName = _a.routeName, params = _a.params, other = __rest(_a, ["className", "disabled", "role", "tabIndex", "onClick", "onKeyDown", "title", "href", "children", "target", "routeName", "params"]);
34
- var props = {
35
- title: title,
36
- disabled: disabled,
37
- role: role,
38
- tabIndex: tabIndex,
39
- className: appendClassNames(className, 'humany-link', [!!disabled, 'humany-disabled']),
40
- onClick: function (e) {
41
- e.persist();
42
- if (disabled) {
43
- e.preventDefault();
44
- return;
45
- }
46
- onClick(e);
47
- },
48
- onKeyDown: function (e) {
49
- e.persist();
50
- if (disabled) {
51
- if (e.key !== 'Tab') {
52
- e.preventDefault();
53
- }
54
- return;
55
- }
56
- onKeyDown(e);
57
- },
58
- };
59
- return routeName ? (React.createElement(StyledRouteLink, __assign({ name: routeName, params: params }, props, convertToStringAttributes(other), { ref: ref }), children)) : (React.createElement(StyledLink, __assign({ href: href, target: target }, props, convertToStringAttributes(other), { ref: ref }), children));
60
- });
61
- var StyledRouteLink = styled(RouteLink)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (p) {
62
- return p.disabled
63
- ? "\n pointer-events: none;\n opacity: .7;\n "
64
- : 'cursor: pointer;';
65
- });
66
- var StyledLink = styled.a(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (p) {
67
- return p.disabled
68
- ? "\n pointer-events: none;\n opacity: .7;\n "
69
- : 'cursor: pointer;';
70
- });
71
- var templateObject_1, templateObject_2;
@@ -1,31 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- import { appendClassNames } from '@telia-ace/widget-utilities';
24
- import React, { forwardRef } from 'react';
25
- import { convertToStringAttributes } from '../utils';
26
- export default forwardRef(function (_a, ref) {
27
- var className = _a.className, items = _a.items, renderItem = _a.renderItem, _b = _a.renderLi, renderLi = _b === void 0 ? false : _b, other = __rest(_a, ["className", "items", "renderItem", "renderLi"]);
28
- return (React.createElement("ul", __assign({ className: appendClassNames(className, 'humany-list'), "data-item-count": items.length }, convertToStringAttributes(other), { ref: ref }), items.map(function (item, index, items) {
29
- return renderLi ? (React.createElement("li", { className: "humany-list-item", key: item.id }, renderItem(item, index, items))) : (renderItem(item, index, items));
30
- })));
31
- });
@@ -1,33 +0,0 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- import React, { useCallback, useRef } from 'react';
6
- import styled from 'styled-components';
7
- import { Button } from '..';
8
- import { borderTabStyle, StyledText } from '../../styles';
9
- import Modal from './modal';
10
- var Confirm = function (_a) {
11
- var className = _a.className, trigger = _a.trigger, _b = _a.header, header = _b === void 0 ? '' : _b, _c = _a.text, text = _c === void 0 ? '' : _c, _d = _a.onCancel, onCancel = _d === void 0 ? function () { } : _d, _e = _a.onConfirm, onConfirm = _e === void 0 ? function () { } : _e, _f = _a.cancelLabel, cancelLabel = _f === void 0 ? '' : _f, _g = _a.confirmLabel, confirmLabel = _g === void 0 ? '' : _g;
12
- var ref = useRef();
13
- var cancel = useCallback(function () {
14
- var _a;
15
- onCancel();
16
- (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.close();
17
- }, [onCancel]);
18
- var confirm = useCallback(function () {
19
- var _a;
20
- onConfirm();
21
- (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.close();
22
- }, [onConfirm]);
23
- return (React.createElement(StyledModal, { className: className, trigger: trigger, ref: ref, onOverlayClick: cancel },
24
- header && React.createElement(StyledText, null, header),
25
- text && React.createElement(StyledText, null, text),
26
- confirmLabel && (React.createElement(StyledConfirmButton, { onClick: confirm }, confirmLabel)),
27
- cancelLabel && React.createElement(StyledCancelButton, { onClick: cancel }, cancelLabel)));
28
- };
29
- export default Confirm;
30
- var StyledModal = styled(Modal)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: block;\n\n span {\n display: block;\n margin: 0 0 ", ";\n\n &:first-of-type:not(:only-of-type) {\n font-weight: 700;\n margin: 0 0 ", ";\n }\n }\n"], ["\n display: block;\n\n span {\n display: block;\n margin: 0 0 ", ";\n\n &:first-of-type:not(:only-of-type) {\n font-weight: 700;\n margin: 0 0 ", ";\n }\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; });
31
- var StyledConfirmButton = styled(Button)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: inline-block;\n min-width: 50px;\n ", "\n ", "\n color: #FFFFFF;\n background-color: ", ";\n border: 1px solid ", ";\n\n margin: 0 ", " 0 0;\n\n &:focus {\n ", ";\n background-color: transparent;\n }\n"], ["\n display: inline-block;\n min-width: 50px;\n ", "\n ", "\n color: #FFFFFF;\n background-color: ", ";\n border: 1px solid ", ";\n\n margin: 0 ", " 0 0;\n\n &:focus {\n ", ";\n background-color: transparent;\n }\n"])), function (p) { var _a, _b; return "padding: ".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small, " ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.normal, ";"); }, function (p) { return p.theme.borderRadius && "border-radius: ".concat(p.theme.borderRadius, ";"); }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.primary; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small; }, function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && borderTabStyle; });
32
- var StyledCancelButton = styled(Button)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: inline-block;\n min-width: 50px;\n ", "\n ", "\n background-color: transparent;\n color: ", ";\n border: 1px solid ", ";\n\n &:focus {\n ", ";\n }\n"], ["\n display: inline-block;\n min-width: 50px;\n ", "\n ", "\n background-color: transparent;\n color: ", ";\n border: 1px solid ", ";\n\n &:focus {\n ", ";\n }\n"])), function (p) { var _a, _b; return "padding: ".concat((_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.small, " ").concat((_b = p.theme.sizes) === null || _b === void 0 ? void 0 : _b.normal, ";"); }, function (p) { return p.theme.borderRadius && "border-radius: ".concat(p.theme.borderRadius, ";"); }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; }, function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && borderTabStyle; });
33
- var templateObject_1, templateObject_2, templateObject_3;
@@ -1,4 +0,0 @@
1
- import Modal from './modal';
2
- export { default as Confirm } from './confirm';
3
- export type { Props as ModalProps } from './modal';
4
- export default Modal;
@@ -1,3 +0,0 @@
1
- import Modal from './modal';
2
- export { default as Confirm } from './confirm';
3
- export default Modal;
@@ -1,99 +0,0 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- var __assign = (this && this.__assign) || function () {
6
- __assign = Object.assign || function(t) {
7
- for (var s, i = 1, n = arguments.length; i < n; i++) {
8
- s = arguments[i];
9
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
- t[p] = s[p];
11
- }
12
- return t;
13
- };
14
- return __assign.apply(this, arguments);
15
- };
16
- var __rest = (this && this.__rest) || function (s, e) {
17
- var t = {};
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
- t[p] = s[p];
20
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
- t[p[i]] = s[p[i]];
24
- }
25
- return t;
26
- };
27
- var __read = (this && this.__read) || function (o, n) {
28
- var m = typeof Symbol === "function" && o[Symbol.iterator];
29
- if (!m) return o;
30
- var i = m.call(o), r, ar = [], e;
31
- try {
32
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
33
- }
34
- catch (error) { e = { error: error }; }
35
- finally {
36
- try {
37
- if (r && !r.done && (m = i["return"])) m.call(i);
38
- }
39
- finally { if (e) throw e.error; }
40
- }
41
- return ar;
42
- };
43
- import { appendClassNames, uuid } from '@telia-ace/widget-utilities';
44
- import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from 'react';
45
- import styled from 'styled-components';
46
- import { useKeyPress, useScroll, useToggle, useUniqueMenu, useWidgetEvent } from '../../hooks';
47
- import { CloseButton, contentBox } from '../../styles';
48
- import Overlay from '../overlay';
49
- import SymbolBadge from '../symbol-badge';
50
- var Modal = forwardRef(function (_a, ref) {
51
- var className = _a.className, children = _a.children, trigger = _a.trigger, _b = _a.onOverlayClick, onOverlayClick = _b === void 0 ? function () { } : _b, _c = _a.close, close = _c === void 0 ? false : _c, other = __rest(_a, ["className", "children", "trigger", "onOverlayClick", "close"]);
52
- var _d = __read(useToggle(), 2), visible = _d[0], toggleVisible = _d[1];
53
- var _e = __read(useScroll(true), 2), css = _e[0], innerRef = _e[1];
54
- var closeButtonRef = useRef();
55
- var id = useRef(uuid());
56
- var esc = useKeyPress('Escape');
57
- useEffect(function () {
58
- if (esc || close) {
59
- toggleVisible(false);
60
- }
61
- }, [esc, close]);
62
- useEffect(function () {
63
- if (visible && closeButtonRef.current) {
64
- closeButtonRef.current.focus();
65
- }
66
- }, [visible, closeButtonRef.current]);
67
- useWidgetEvent('router:changed', function () {
68
- toggleVisible(false);
69
- });
70
- var overlayClick = useCallback(function (e) {
71
- toggleVisible(false);
72
- onOverlayClick(e);
73
- }, [onOverlayClick, toggleVisible]);
74
- useImperativeHandle(ref, function () { return ({
75
- close: function () {
76
- toggleVisible(false);
77
- },
78
- }); });
79
- var closeMenus = useCallback(function () {
80
- return useUniqueMenu(id.current, function () {
81
- toggleVisible(false);
82
- });
83
- }, [id.current]);
84
- return (React.createElement(React.Fragment, null,
85
- React.createElement(Overlay, { visible: visible, onClick: overlayClick },
86
- React.createElement(Wrapper, __assign({ className: appendClassNames(className, 'humany-modal', "humany-modal-".concat(id.current)), css: css, tabIndex: -1 }, other, { ref: innerRef }),
87
- React.createElement(CloseButton, { onClick: function () { return toggleVisible(false); }, tabIndex: 0, ref: closeButtonRef },
88
- React.createElement(SymbolBadge, { symbol: { type: 'Svg', content: 'close' } })),
89
- children)),
90
- React.cloneElement(trigger, {
91
- onClick: function (event) {
92
- toggleVisible();
93
- closeMenus();
94
- },
95
- })));
96
- });
97
- export default Modal;
98
- var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n position: relative;\n max-width: 50%;\n min-width: 200px;\n padding: ", ";\n ", "\n ", "\n outline: none;\n"], ["\n font-family: ", ";\n font-size: ", ";\n position: relative;\n max-width: 50%;\n min-width: 200px;\n padding: ", ";\n ", "\n ", "\n outline: none;\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.type; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, contentBox, function (p) { return p.css && p.css; });
99
- var templateObject_1;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- export declare type Props = {
3
- header?: string;
4
- link?: string;
5
- suggestionHeader?: string;
6
- suggestion?: string;
7
- };
8
- declare const NotFound: React.FC<Props>;
9
- export default NotFound;
@@ -1,27 +0,0 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- import React from 'react';
6
- import styled, { css } from 'styled-components';
7
- import { TextLink, Typography } from '../components';
8
- import { headingElement } from '../utils/heading-styles';
9
- var NotFound = function (_a) {
10
- var _b = _a.header, header = _b === void 0 ? '' : _b, _c = _a.link, link = _c === void 0 ? '' : _c, _d = _a.suggestionHeader, suggestionHeader = _d === void 0 ? '' : _d, _e = _a.suggestion, suggestion = _e === void 0 ? '' : _e;
11
- return (React.createElement(Wrapper, null,
12
- React.createElement(Status, null,
13
- React.createElement(Typography, { variant: "h2" }, "404")),
14
- React.createElement(Header, null,
15
- React.createElement(Typography, { variant: "h3" }, header),
16
- React.createElement(TextLink, { routeName: "index", "aria-label": link, text: link })),
17
- React.createElement(Content, null,
18
- React.createElement("span", null, suggestionHeader),
19
- React.createElement("ul", null,
20
- React.createElement("li", null, suggestion)))));
21
- };
22
- export default NotFound;
23
- var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n"], ["\n display: flex;\n flex-wrap: wrap;\n"])));
24
- var Status = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), headingElement('h2', css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 0;\n margin: 0;\n color: gray;\n font-size: 7em;\n "], ["\n padding: 0;\n margin: 0;\n color: gray;\n font-size: 7em;\n "])))));
25
- var Header = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-left: ", ";\n\n ", "\n\n a {\n color: ", ";\n font-size: ", ";\n }\n"], ["\n margin-left: ", ";\n\n ", "\n\n a {\n color: ", ";\n font-size: ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; }, headingElement('h3', css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n text-transform: uppercase;\n font-size: ", ";\n "], ["\n text-transform: uppercase;\n font-size: ", ";\n "])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.normal; })), function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.link; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.small; });
26
- var Content = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-top: ", ";\n min-width: 100%;\n\n span {\n font-weight: bold;\n }\n"], ["\n margin-top: ", ";\n min-width: 100%;\n\n span {\n font-weight: bold;\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.medium; });
27
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- export declare type Props = {
3
- duration?: number;
4
- visible: boolean;
5
- onClick?: (e: React.MouseEvent) => void;
6
- };
7
- declare const Overlay: React.FC<Props>;
8
- export default Overlay;
@@ -1,45 +0,0 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- var __assign = (this && this.__assign) || function () {
6
- __assign = Object.assign || function(t) {
7
- for (var s, i = 1, n = arguments.length; i < n; i++) {
8
- s = arguments[i];
9
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
- t[p] = s[p];
11
- }
12
- return t;
13
- };
14
- return __assign.apply(this, arguments);
15
- };
16
- var __rest = (this && this.__rest) || function (s, e) {
17
- var t = {};
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
- t[p] = s[p];
20
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
- t[p[i]] = s[p[i]];
24
- }
25
- return t;
26
- };
27
- import React, { useCallback, useRef } from 'react';
28
- import { CSSTransition } from 'react-transition-group';
29
- import styled from 'styled-components';
30
- import Portal from './portal';
31
- var Overlay = function (_a) {
32
- var visible = _a.visible, _b = _a.duration, duration = _b === void 0 ? 500 : _b, children = _a.children, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, other = __rest(_a, ["visible", "duration", "children", "onClick"]);
33
- var ref = useRef();
34
- var onOverlayClick = useCallback(function (e) {
35
- if (e.target === ref.current) {
36
- onClick(e);
37
- }
38
- }, [onClick]);
39
- return (React.createElement(CSSTransition, { in: visible, className: "humany-overlay-transition", classNames: "humany-overlay-transition", unmountOnExit: true, timeout: duration },
40
- React.createElement(Portal, null,
41
- React.createElement(Wrapper, __assign({ className: "humany-overlay", duration: duration, ref: ref, onClick: onOverlayClick }, other), children))));
42
- };
43
- var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: rgba(0, 0, 0, 0.6);\n min-width: 100%;\n min-height: 100%;\n position: fixed;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 7;\n\n transition: ", "ms;\n opacity: 0;\n\n &.humany-overlay-transition-enter {\n opacity: 0.1;\n }\n &.humany-overlay-transition-enter-active,\n &.humany-overlay-transition-enter-done,\n &.humany-overlay-transition-exit {\n opacity: 1;\n }\n\n &.humany-overlay-transition-exit-active,\n &.humany-overlay-transition-exit-done {\n opacity: 0;\n }\n"], ["\n background: rgba(0, 0, 0, 0.6);\n min-width: 100%;\n min-height: 100%;\n position: fixed;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 7;\n\n transition: ", "ms;\n opacity: 0;\n\n &.humany-overlay-transition-enter {\n opacity: 0.1;\n }\n &.humany-overlay-transition-enter-active,\n &.humany-overlay-transition-enter-done,\n &.humany-overlay-transition-exit {\n opacity: 1;\n }\n\n &.humany-overlay-transition-exit-active,\n &.humany-overlay-transition-exit-done {\n opacity: 0;\n }\n"])), function (p) { return p.duration; });
44
- export default Overlay;
45
- var templateObject_1;
@@ -1,38 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- import { appendClassNames } from '@telia-ace/widget-utilities';
24
- import React, { forwardRef } from 'react';
25
- import { convertToStringAttributes } from '../utils';
26
- import Html from './html';
27
- import SymbolBadge from './symbol-badge';
28
- import Text from './text';
29
- import Typography from './typography';
30
- export default forwardRef(function (_a, ref) {
31
- var text = _a.text, html = _a.html, header = _a.header, className = _a.className, htmlParseInstruction = _a.htmlParseInstruction, symbol = _a.symbol, other = __rest(_a, ["text", "html", "header", "className", "htmlParseInstruction", "symbol"]);
32
- return (React.createElement("div", __assign({ className: appendClassNames(className, 'humany-paragraph') }, convertToStringAttributes(other), { ref: ref }),
33
- header ? (React.createElement(Typography, { variant: "h1" },
34
- symbol ? React.createElement(SymbolBadge, { symbol: symbol }) : null,
35
- header)) : null,
36
- html ? React.createElement(Html, { html: html, htmlParseInstruction: htmlParseInstruction }) : null,
37
- text ? React.createElement(Text, null, text) : null));
38
- });
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- export declare type Props = {
3
- elementId?: string;
4
- children?: any;
5
- };
6
- declare const Portal: React.FC<Props>;
7
- export default Portal;
@@ -1,36 +0,0 @@
1
- var __read = (this && this.__read) || function (o, n) {
2
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3
- if (!m) return o;
4
- var i = m.call(o), r, ar = [], e;
5
- try {
6
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
- }
8
- catch (error) { e = { error: error }; }
9
- finally {
10
- try {
11
- if (r && !r.done && (m = i["return"])) m.call(i);
12
- }
13
- finally { if (e) throw e.error; }
14
- }
15
- return ar;
16
- };
17
- import React, { useEffect } from 'react';
18
- import { createPortal } from 'react-dom';
19
- var Portal = function (_a) {
20
- var _b = _a.elementId, elementId = _b === void 0 ? 'humany-portal-elements' : _b, children = _a.children;
21
- var _c = __read(React.useState(function () {
22
- var el = document.getElementById(elementId) || document.createElement('div');
23
- el.id = elementId;
24
- return el;
25
- }), 1), container = _c[0];
26
- useEffect(function () {
27
- document.body.appendChild(container);
28
- return function () {
29
- if (container.childElementCount <= 1) {
30
- document.body.removeChild(container);
31
- }
32
- };
33
- }, [container]);
34
- return createPortal(children, container);
35
- };
36
- export default Portal;
@@ -1,90 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- import { getSpecificWidgetPath, HistoryMode } from '@telia-ace/widget-routing';
24
- import { appendClassNames, Logger } from '@telia-ace/widget-utilities';
25
- import React, { forwardRef } from 'react';
26
- import { Link } from 'react-router-dom';
27
- import { useContainer, useRouter } from '../hooks';
28
- export default forwardRef(function (_a, forwardedRef) {
29
- var className = _a.className, _b = _a.onClick, onClick = _b === void 0 ? function () { } : _b, _c = _a.name, name = _c === void 0 ? '' : _c, _d = _a.to, to = _d === void 0 ? '' : _d, _e = _a.params, params = _e === void 0 ? {} : _e, children = _a.children, other = __rest(_a, ["className", "onClick", "name", "to", "params", "children"]);
30
- var router = useRouter();
31
- var container = useContainer();
32
- if (!router) {
33
- return null;
34
- }
35
- var path = '';
36
- var props = __assign(__assign({ onClick: onClick, className: appendClassNames(className, 'humany-route-link'), to: path, innerRef: forwardedRef }, other), { ref: null });
37
- if (name) {
38
- var routes = router.routes || [];
39
- var route = routes.find(function (r) { return r.name === name; });
40
- if (!route) {
41
- if (process.env.NODE_ENV !== 'production') {
42
- Logger.warn("Unable to create route. No route named \"".concat(name, "\" exist."));
43
- }
44
- return (React.createElement(Link, __assign({}, props, { onClick: function (e) {
45
- onClick(e);
46
- e.preventDefault();
47
- if (process.env.NODE_ENV !== 'production') {
48
- Logger.warn("Unable to navigate. No route named \"".concat(name, "\" exist."));
49
- }
50
- } }), children));
51
- }
52
- var encodedParams = Object.keys(params).reduce(function (acc, key) {
53
- acc[key] =
54
- typeof params[key] === 'string' ? encodeURIComponent(params[key]) : params[key];
55
- return acc;
56
- }, {});
57
- try {
58
- path = router.generate(name, encodedParams || {});
59
- }
60
- catch (e) {
61
- return React.createElement(Link, __assign({}, props), children);
62
- }
63
- if (path &&
64
- router.settings.mode &&
65
- router.settings.mode === HistoryMode.browser &&
66
- path[0] !== '/') {
67
- path = "/".concat(path);
68
- }
69
- }
70
- else if (to && router.history) {
71
- path = router.history.createHref({
72
- hash: '',
73
- pathname: to,
74
- search: '',
75
- state: undefined,
76
- });
77
- }
78
- else {
79
- if (process.env.NODE_ENV !== 'production') {
80
- Logger.warn('Unable to generate path for route link. Either specify route name or use the "to" prop.');
81
- }
82
- return null;
83
- }
84
- // Get the path for the specific widget
85
- if (router.settings && router.settings.mode === HistoryMode.scopedHash) {
86
- var widgetName = container.get('$widget').name;
87
- path = getSpecificWidgetPath(path, widgetName);
88
- }
89
- return (React.createElement(Link, __assign({}, props, { to: path }), children));
90
- });
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- export declare type Symbol = {
3
- type: 'Uri' | 'Svg' | 'FontAwesome' | 'Text' | string;
4
- content: string;
5
- };
6
- export declare type HtmlIconProps = Merge<React.ComponentProps<'i'>, React.ComponentProps<'svg'>>;
7
- export declare type Props = Merge<HtmlIconProps, {
8
- symbol: Symbol;
9
- backgroundSize?: string;
10
- size?: number;
11
- text?: string;
12
- elementStyle?: Object;
13
- }>;
14
- declare const SymbolBadge: React.SFC<Props>;
15
- export default SymbolBadge;