@telia-ace/widget-ui 1.0.0

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 (315) hide show
  1. package/LICENSE.txt +6 -0
  2. package/README.md +3 -0
  3. package/lib/components/anchor-link.d.ts +4 -0
  4. package/lib/components/anchor-link.js +7 -0
  5. package/lib/components/button.d.ts +4 -0
  6. package/lib/components/button.js +64 -0
  7. package/lib/components/checkbox.d.ts +7 -0
  8. package/lib/components/checkbox.js +39 -0
  9. package/lib/components/drawer/drawer.d.ts +21 -0
  10. package/lib/components/drawer/drawer.js +150 -0
  11. package/lib/components/drawer/index.d.ts +3 -0
  12. package/lib/components/drawer/index.js +29 -0
  13. package/lib/components/dropdown/dropdown.d.ts +9 -0
  14. package/lib/components/dropdown/dropdown.js +155 -0
  15. package/lib/components/dropdown/index.d.ts +4 -0
  16. package/lib/components/dropdown/index.js +10 -0
  17. package/lib/components/dropdown/use-position.d.ts +5 -0
  18. package/lib/components/dropdown/use-position.js +57 -0
  19. package/lib/components/empty.d.ts +4 -0
  20. package/lib/components/empty.js +40 -0
  21. package/lib/components/grid.d.ts +7 -0
  22. package/lib/components/grid.js +64 -0
  23. package/lib/components/html.d.ts +12 -0
  24. package/lib/components/html.js +78 -0
  25. package/lib/components/icon.d.ts +7 -0
  26. package/lib/components/icon.js +35 -0
  27. package/lib/components/index.d.ts +58 -0
  28. package/lib/components/index.js +69 -0
  29. package/lib/components/input.d.ts +10 -0
  30. package/lib/components/input.js +94 -0
  31. package/lib/components/item-list.d.ts +10 -0
  32. package/lib/components/item-list.js +62 -0
  33. package/lib/components/item-tree.d.ts +13 -0
  34. package/lib/components/item-tree.js +55 -0
  35. package/lib/components/lightbox.d.ts +6 -0
  36. package/lib/components/lightbox.js +92 -0
  37. package/lib/components/link.d.ts +11 -0
  38. package/lib/components/link.js +99 -0
  39. package/lib/components/list.d.ts +9 -0
  40. package/lib/components/list.js +56 -0
  41. package/lib/components/modal/confirm.d.ts +12 -0
  42. package/lib/components/modal/confirm.js +61 -0
  43. package/lib/components/modal/index.d.ts +4 -0
  44. package/lib/components/modal/index.js +10 -0
  45. package/lib/components/modal/modal.d.ts +10 -0
  46. package/lib/components/modal/modal.js +127 -0
  47. package/lib/components/not-found.d.ts +9 -0
  48. package/lib/components/not-found.js +55 -0
  49. package/lib/components/overlay.d.ts +8 -0
  50. package/lib/components/overlay.js +73 -0
  51. package/lib/components/paragraph.d.ts +11 -0
  52. package/lib/components/paragraph.js +66 -0
  53. package/lib/components/portal.d.ts +7 -0
  54. package/lib/components/portal.js +61 -0
  55. package/lib/components/route-link.d.ts +11 -0
  56. package/lib/components/route-link.js +115 -0
  57. package/lib/components/symbol-badge.d.ts +15 -0
  58. package/lib/components/symbol-badge.js +197 -0
  59. package/lib/components/tab-stop.d.ts +18 -0
  60. package/lib/components/tab-stop.js +100 -0
  61. package/lib/components/text-link.d.ts +8 -0
  62. package/lib/components/text-link.js +62 -0
  63. package/lib/components/text.d.ts +4 -0
  64. package/lib/components/text.js +35 -0
  65. package/lib/components/timestamp.d.ts +13 -0
  66. package/lib/components/timestamp.js +39 -0
  67. package/lib/components/tooltip.d.ts +8 -0
  68. package/lib/components/tooltip.js +127 -0
  69. package/lib/components/transition-component.d.ts +30 -0
  70. package/lib/components/transition-component.js +77 -0
  71. package/lib/components/typography.d.ts +9 -0
  72. package/lib/components/typography.js +43 -0
  73. package/lib/components/widget-link.d.ts +10 -0
  74. package/lib/components/widget-link.js +116 -0
  75. package/lib/contexts/index.d.ts +9 -0
  76. package/lib/contexts/index.js +15 -0
  77. package/lib/create-react-component.d.ts +11 -0
  78. package/lib/create-react-component.js +18 -0
  79. package/lib/hooks/index.d.ts +27 -0
  80. package/lib/hooks/index.js +58 -0
  81. package/lib/hooks/use-action.d.ts +4 -0
  82. package/lib/hooks/use-action.js +21 -0
  83. package/lib/hooks/use-children.d.ts +4 -0
  84. package/lib/hooks/use-children.js +70 -0
  85. package/lib/hooks/use-columns.d.ts +2 -0
  86. package/lib/hooks/use-columns.js +6 -0
  87. package/lib/hooks/use-component-descriptor.d.ts +2 -0
  88. package/lib/hooks/use-component-descriptor.js +6 -0
  89. package/lib/hooks/use-component-node.d.ts +6 -0
  90. package/lib/hooks/use-component-node.js +37 -0
  91. package/lib/hooks/use-component-platform.d.ts +4 -0
  92. package/lib/hooks/use-component-platform.js +39 -0
  93. package/lib/hooks/use-component.d.ts +3 -0
  94. package/lib/hooks/use-component.js +57 -0
  95. package/lib/hooks/use-container.d.ts +2 -0
  96. package/lib/hooks/use-container.js +6 -0
  97. package/lib/hooks/use-context.d.ts +3 -0
  98. package/lib/hooks/use-context.js +50 -0
  99. package/lib/hooks/use-dispatch.d.ts +3 -0
  100. package/lib/hooks/use-dispatch.js +64 -0
  101. package/lib/hooks/use-event-listener.d.ts +2 -0
  102. package/lib/hooks/use-event-listener.js +21 -0
  103. package/lib/hooks/use-events.d.ts +3 -0
  104. package/lib/hooks/use-events.js +12 -0
  105. package/lib/hooks/use-is-mounted.d.ts +3 -0
  106. package/lib/hooks/use-is-mounted.js +14 -0
  107. package/lib/hooks/use-key-press.d.ts +2 -0
  108. package/lib/hooks/use-key-press.js +46 -0
  109. package/lib/hooks/use-layout.d.ts +3 -0
  110. package/lib/hooks/use-layout.js +50 -0
  111. package/lib/hooks/use-previous.d.ts +2 -0
  112. package/lib/hooks/use-previous.js +11 -0
  113. package/lib/hooks/use-properties.d.ts +6 -0
  114. package/lib/hooks/use-properties.js +9 -0
  115. package/lib/hooks/use-render-state.d.ts +4 -0
  116. package/lib/hooks/use-render-state.js +66 -0
  117. package/lib/hooks/use-route-data.d.ts +4 -0
  118. package/lib/hooks/use-route-data.js +54 -0
  119. package/lib/hooks/use-router.d.ts +3 -0
  120. package/lib/hooks/use-router.js +9 -0
  121. package/lib/hooks/use-scroll.d.ts +2 -0
  122. package/lib/hooks/use-scroll.js +71 -0
  123. package/lib/hooks/use-settings.d.ts +3 -0
  124. package/lib/hooks/use-settings.js +38 -0
  125. package/lib/hooks/use-toggle.d.ts +2 -0
  126. package/lib/hooks/use-toggle.js +28 -0
  127. package/lib/hooks/use-transition-end.d.ts +2 -0
  128. package/lib/hooks/use-transition-end.js +62 -0
  129. package/lib/hooks/use-unique-menu.d.ts +2 -0
  130. package/lib/hooks/use-unique-menu.js +15 -0
  131. package/lib/hooks/use-widget-event.d.ts +3 -0
  132. package/lib/hooks/use-widget-event.js +21 -0
  133. package/lib/index.d.ts +9 -0
  134. package/lib/index.js +92 -0
  135. package/lib/styles.d.ts +19 -0
  136. package/lib/styles.js +53 -0
  137. package/lib/utils/animations.d.ts +18 -0
  138. package/lib/utils/animations.js +104 -0
  139. package/lib/utils/browser.d.ts +12 -0
  140. package/lib/utils/browser.js +54 -0
  141. package/lib/utils/convert-to-string-attributes.d.ts +2 -0
  142. package/lib/utils/convert-to-string-attributes.js +23 -0
  143. package/lib/utils/create-empty-component.d.ts +4 -0
  144. package/lib/utils/create-empty-component.js +25 -0
  145. package/lib/utils/embedded-link-mapper.d.ts +4 -0
  146. package/lib/utils/embedded-link-mapper.js +62 -0
  147. package/lib/utils/filter-css-props.d.ts +8 -0
  148. package/lib/utils/filter-css-props.js +28 -0
  149. package/lib/utils/generic-hash-link.d.ts +8 -0
  150. package/lib/utils/generic-hash-link.js +70 -0
  151. package/lib/utils/heading-styles.d.ts +1 -0
  152. package/lib/utils/heading-styles.js +48 -0
  153. package/lib/utils/index.d.ts +12 -0
  154. package/lib/utils/index.js +28 -0
  155. package/lib/utils/process-html-string.d.ts +4 -0
  156. package/lib/utils/process-html-string.js +16 -0
  157. package/lib/utils/render-instructions.d.ts +8 -0
  158. package/lib/utils/render-instructions.js +19 -0
  159. package/lib-esm/components/anchor-link.d.ts +4 -0
  160. package/lib-esm/components/anchor-link.js +5 -0
  161. package/lib-esm/components/button.d.ts +4 -0
  162. package/lib-esm/components/button.js +36 -0
  163. package/lib-esm/components/checkbox.d.ts +7 -0
  164. package/lib-esm/components/checkbox.js +34 -0
  165. package/lib-esm/components/drawer/drawer.d.ts +21 -0
  166. package/lib-esm/components/drawer/drawer.js +121 -0
  167. package/lib-esm/components/drawer/index.d.ts +3 -0
  168. package/lib-esm/components/drawer/index.js +3 -0
  169. package/lib-esm/components/dropdown/dropdown.d.ts +9 -0
  170. package/lib-esm/components/dropdown/dropdown.js +127 -0
  171. package/lib-esm/components/dropdown/index.d.ts +4 -0
  172. package/lib-esm/components/dropdown/index.js +3 -0
  173. package/lib-esm/components/dropdown/use-position.d.ts +5 -0
  174. package/lib-esm/components/dropdown/use-position.js +53 -0
  175. package/lib-esm/components/empty.d.ts +4 -0
  176. package/lib-esm/components/empty.js +35 -0
  177. package/lib-esm/components/grid.d.ts +7 -0
  178. package/lib-esm/components/grid.js +36 -0
  179. package/lib-esm/components/html.d.ts +12 -0
  180. package/lib-esm/components/html.js +53 -0
  181. package/lib-esm/components/icon.d.ts +7 -0
  182. package/lib-esm/components/icon.js +30 -0
  183. package/lib-esm/components/index.d.ts +58 -0
  184. package/lib-esm/components/index.js +30 -0
  185. package/lib-esm/components/input.d.ts +10 -0
  186. package/lib-esm/components/input.js +69 -0
  187. package/lib-esm/components/item-list.d.ts +10 -0
  188. package/lib-esm/components/item-list.js +34 -0
  189. package/lib-esm/components/item-tree.d.ts +13 -0
  190. package/lib-esm/components/item-tree.js +50 -0
  191. package/lib-esm/components/lightbox.d.ts +6 -0
  192. package/lib-esm/components/lightbox.js +64 -0
  193. package/lib-esm/components/link.d.ts +11 -0
  194. package/lib-esm/components/link.js +71 -0
  195. package/lib-esm/components/list.d.ts +9 -0
  196. package/lib-esm/components/list.js +31 -0
  197. package/lib-esm/components/modal/confirm.d.ts +12 -0
  198. package/lib-esm/components/modal/confirm.js +33 -0
  199. package/lib-esm/components/modal/index.d.ts +4 -0
  200. package/lib-esm/components/modal/index.js +3 -0
  201. package/lib-esm/components/modal/modal.d.ts +10 -0
  202. package/lib-esm/components/modal/modal.js +99 -0
  203. package/lib-esm/components/not-found.d.ts +9 -0
  204. package/lib-esm/components/not-found.js +27 -0
  205. package/lib-esm/components/overlay.d.ts +8 -0
  206. package/lib-esm/components/overlay.js +45 -0
  207. package/lib-esm/components/paragraph.d.ts +11 -0
  208. package/lib-esm/components/paragraph.js +38 -0
  209. package/lib-esm/components/portal.d.ts +7 -0
  210. package/lib-esm/components/portal.js +36 -0
  211. package/lib-esm/components/route-link.d.ts +11 -0
  212. package/lib-esm/components/route-link.js +90 -0
  213. package/lib-esm/components/symbol-badge.d.ts +15 -0
  214. package/lib-esm/components/symbol-badge.js +192 -0
  215. package/lib-esm/components/tab-stop.d.ts +18 -0
  216. package/lib-esm/components/tab-stop.js +75 -0
  217. package/lib-esm/components/text-link.d.ts +8 -0
  218. package/lib-esm/components/text-link.js +34 -0
  219. package/lib-esm/components/text.d.ts +4 -0
  220. package/lib-esm/components/text.js +30 -0
  221. package/lib-esm/components/timestamp.d.ts +13 -0
  222. package/lib-esm/components/timestamp.js +33 -0
  223. package/lib-esm/components/tooltip.d.ts +8 -0
  224. package/lib-esm/components/tooltip.js +99 -0
  225. package/lib-esm/components/transition-component.d.ts +30 -0
  226. package/lib-esm/components/transition-component.js +72 -0
  227. package/lib-esm/components/typography.d.ts +9 -0
  228. package/lib-esm/components/typography.js +38 -0
  229. package/lib-esm/components/widget-link.d.ts +10 -0
  230. package/lib-esm/components/widget-link.js +88 -0
  231. package/lib-esm/contexts/index.d.ts +9 -0
  232. package/lib-esm/contexts/index.js +12 -0
  233. package/lib-esm/create-react-component.d.ts +11 -0
  234. package/lib-esm/create-react-component.js +16 -0
  235. package/lib-esm/hooks/index.d.ts +27 -0
  236. package/lib-esm/hooks/index.js +26 -0
  237. package/lib-esm/hooks/use-action.d.ts +4 -0
  238. package/lib-esm/hooks/use-action.js +14 -0
  239. package/lib-esm/hooks/use-children.d.ts +4 -0
  240. package/lib-esm/hooks/use-children.js +65 -0
  241. package/lib-esm/hooks/use-columns.d.ts +2 -0
  242. package/lib-esm/hooks/use-columns.js +4 -0
  243. package/lib-esm/hooks/use-component-descriptor.d.ts +2 -0
  244. package/lib-esm/hooks/use-component-descriptor.js +4 -0
  245. package/lib-esm/hooks/use-component-node.d.ts +6 -0
  246. package/lib-esm/hooks/use-component-node.js +35 -0
  247. package/lib-esm/hooks/use-component-platform.d.ts +4 -0
  248. package/lib-esm/hooks/use-component-platform.js +34 -0
  249. package/lib-esm/hooks/use-component.d.ts +3 -0
  250. package/lib-esm/hooks/use-component.js +52 -0
  251. package/lib-esm/hooks/use-container.d.ts +2 -0
  252. package/lib-esm/hooks/use-container.js +4 -0
  253. package/lib-esm/hooks/use-context.d.ts +3 -0
  254. package/lib-esm/hooks/use-context.js +45 -0
  255. package/lib-esm/hooks/use-dispatch.d.ts +3 -0
  256. package/lib-esm/hooks/use-dispatch.js +59 -0
  257. package/lib-esm/hooks/use-event-listener.d.ts +2 -0
  258. package/lib-esm/hooks/use-event-listener.js +19 -0
  259. package/lib-esm/hooks/use-events.d.ts +3 -0
  260. package/lib-esm/hooks/use-events.js +7 -0
  261. package/lib-esm/hooks/use-is-mounted.d.ts +3 -0
  262. package/lib-esm/hooks/use-is-mounted.js +12 -0
  263. package/lib-esm/hooks/use-key-press.d.ts +2 -0
  264. package/lib-esm/hooks/use-key-press.js +41 -0
  265. package/lib-esm/hooks/use-layout.d.ts +3 -0
  266. package/lib-esm/hooks/use-layout.js +45 -0
  267. package/lib-esm/hooks/use-previous.d.ts +2 -0
  268. package/lib-esm/hooks/use-previous.js +9 -0
  269. package/lib-esm/hooks/use-properties.d.ts +6 -0
  270. package/lib-esm/hooks/use-properties.js +7 -0
  271. package/lib-esm/hooks/use-render-state.d.ts +4 -0
  272. package/lib-esm/hooks/use-render-state.js +61 -0
  273. package/lib-esm/hooks/use-route-data.d.ts +4 -0
  274. package/lib-esm/hooks/use-route-data.js +49 -0
  275. package/lib-esm/hooks/use-router.d.ts +3 -0
  276. package/lib-esm/hooks/use-router.js +7 -0
  277. package/lib-esm/hooks/use-scroll.d.ts +2 -0
  278. package/lib-esm/hooks/use-scroll.js +66 -0
  279. package/lib-esm/hooks/use-settings.d.ts +3 -0
  280. package/lib-esm/hooks/use-settings.js +33 -0
  281. package/lib-esm/hooks/use-toggle.d.ts +2 -0
  282. package/lib-esm/hooks/use-toggle.js +26 -0
  283. package/lib-esm/hooks/use-transition-end.d.ts +2 -0
  284. package/lib-esm/hooks/use-transition-end.js +60 -0
  285. package/lib-esm/hooks/use-unique-menu.d.ts +2 -0
  286. package/lib-esm/hooks/use-unique-menu.js +10 -0
  287. package/lib-esm/hooks/use-widget-event.d.ts +3 -0
  288. package/lib-esm/hooks/use-widget-event.js +16 -0
  289. package/lib-esm/index.d.ts +9 -0
  290. package/lib-esm/index.js +7 -0
  291. package/lib-esm/styles.d.ts +19 -0
  292. package/lib-esm/styles.js +26 -0
  293. package/lib-esm/utils/animations.d.ts +18 -0
  294. package/lib-esm/utils/animations.js +101 -0
  295. package/lib-esm/utils/browser.d.ts +12 -0
  296. package/lib-esm/utils/browser.js +51 -0
  297. package/lib-esm/utils/convert-to-string-attributes.d.ts +2 -0
  298. package/lib-esm/utils/convert-to-string-attributes.js +21 -0
  299. package/lib-esm/utils/create-empty-component.d.ts +4 -0
  300. package/lib-esm/utils/create-empty-component.js +20 -0
  301. package/lib-esm/utils/embedded-link-mapper.d.ts +4 -0
  302. package/lib-esm/utils/embedded-link-mapper.js +57 -0
  303. package/lib-esm/utils/filter-css-props.d.ts +8 -0
  304. package/lib-esm/utils/filter-css-props.js +25 -0
  305. package/lib-esm/utils/generic-hash-link.d.ts +8 -0
  306. package/lib-esm/utils/generic-hash-link.js +63 -0
  307. package/lib-esm/utils/heading-styles.d.ts +1 -0
  308. package/lib-esm/utils/heading-styles.js +44 -0
  309. package/lib-esm/utils/index.d.ts +12 -0
  310. package/lib-esm/utils/index.js +10 -0
  311. package/lib-esm/utils/process-html-string.d.ts +4 -0
  312. package/lib-esm/utils/process-html-string.js +10 -0
  313. package/lib-esm/utils/render-instructions.d.ts +8 -0
  314. package/lib-esm/utils/render-instructions.js +12 -0
  315. package/package.json +47 -0
@@ -0,0 +1,53 @@
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 { useCallback, useEffect, useState } from 'react';
18
+ export var usePosition = function (visible, id, element) {
19
+ var _a = __read(useState(0), 2), posX = _a[0], setPosX = _a[1];
20
+ var _b = __read(useState(0), 2), posY = _b[0], setPosY = _b[1];
21
+ var set = useCallback(function (event, trigger) {
22
+ event.preventDefault();
23
+ if (trigger) {
24
+ var clientRect = trigger.getBoundingClientRect();
25
+ setPosX(Math.max(document.body.clientWidth - clientRect.right, 1));
26
+ setPosY(clientRect.bottom + window.scrollY);
27
+ }
28
+ }, [posX, posY, setPosX, setPosY]);
29
+ useEffect(function () {
30
+ if (!element || !visible) {
31
+ return;
32
+ }
33
+ var clientRect = element.getBoundingClientRect();
34
+ var newPos = {
35
+ x: posX,
36
+ y: posY,
37
+ };
38
+ if (clientRect.left < 0) {
39
+ newPos.x = 0;
40
+ }
41
+ if (clientRect.bottom > window.innerHeight) {
42
+ newPos.y = 0;
43
+ }
44
+ if (newPos.x !== posX) {
45
+ setPosX(newPos.x);
46
+ }
47
+ if (newPos.y !== posY) {
48
+ setPosY(newPos.y);
49
+ }
50
+ }, [element, visible, id]);
51
+ return [{ x: posX, y: posY }, set];
52
+ };
53
+ export default usePosition;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare type Props = {};
3
+ declare const Empty: React.SFC<Props>;
4
+ export default Empty;
@@ -0,0 +1,35 @@
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 from 'react';
28
+ import styled from 'styled-components';
29
+ var Empty = function (_a) {
30
+ var other = __rest(_a, []);
31
+ return React.createElement(Wrapper, __assign({}, other));
32
+ };
33
+ export default Empty;
34
+ var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
35
+ var templateObject_1;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export declare type Props = Merge<React.ComponentProps<'div'>, {
3
+ columns: number;
4
+ gap: string;
5
+ }>;
6
+ declare const _default: React.ForwardRefExoticComponent<Pick<Props, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "columns" | "gap"> & React.RefAttributes<HTMLDivElement>>;
7
+ export default _default;
@@ -0,0 +1,36 @@
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, filterCssProps, filterCssPropsStyle } from '../utils';
31
+ export default forwardRef(function (_a, ref) {
32
+ var children = _a.children, columns = _a.columns, gap = _a.gap, className = _a.className, other = __rest(_a, ["children", "columns", "gap", "className"]);
33
+ return (React.createElement(Div, __assign({ className: appendClassNames(className, 'humany-grid'), "data-columns": columns, "data-gap": gap }, filterCssProps(other), convertToStringAttributes(other), { ref: ref }), children));
34
+ });
35
+ var Div = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: grid;\n grid-template-columns: repeat(", ", 1fr);\n grid-gap: ", ";\n justify-content: center;\n grid-auto-rows: max-content;\n ", "\n"], ["\n display: grid;\n grid-template-columns: repeat(", ", 1fr);\n grid-gap: ", ";\n justify-content: center;\n grid-auto-rows: max-content;\n ", "\n"])), function (p) { return p['data-columns']; }, function (p) { return p['data-gap']; }, filterCssPropsStyle);
36
+ var templateObject_1;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export declare type HtmlParseInstruction = {
3
+ transform: {
4
+ [htmlTag: string]: (props: any) => JSX.Element;
5
+ };
6
+ };
7
+ export declare type Props = Merge<React.ComponentProps<'div'>, {
8
+ html: string;
9
+ htmlParseInstruction?: HtmlParseInstruction;
10
+ }>;
11
+ declare const _default: React.ForwardRefExoticComponent<Pick<Props, "html" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | "htmlParseInstruction"> & React.RefAttributes<HTMLDivElement>>;
12
+ export default _default;
@@ -0,0 +1,53 @@
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
+ var __read = (this && this.__read) || function (o, n) {
24
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
25
+ if (!m) return o;
26
+ var i = m.call(o), r, ar = [], e;
27
+ try {
28
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
29
+ }
30
+ catch (error) { e = { error: error }; }
31
+ finally {
32
+ try {
33
+ if (r && !r.done && (m = i["return"])) m.call(i);
34
+ }
35
+ finally { if (e) throw e.error; }
36
+ }
37
+ return ar;
38
+ };
39
+ import { appendClassNames } from '@telia-ace/widget-utilities';
40
+ import React, { forwardRef, useEffect, useState } from 'react';
41
+ import { useContainer } from '../hooks';
42
+ import { convertToStringAttributes, defaultRenderInstructions, processHtmlString } from '../utils';
43
+ export default forwardRef(function (_a, ref) {
44
+ var _b = _a.htmlParseInstruction, htmlParseInstruction = _b === void 0 ? null : _b, className = _a.className, html = _a.html, other = __rest(_a, ["htmlParseInstruction", "className", "html"]);
45
+ var container = useContainer();
46
+ var _c = __read(useState(), 2), processedHtml = _c[0], setProcessedHtml = _c[1];
47
+ useEffect(function () {
48
+ var instructions = htmlParseInstruction || defaultRenderInstructions(container);
49
+ var processed = processHtmlString(html, instructions);
50
+ setProcessedHtml(processed);
51
+ }, [html, htmlParseInstruction]);
52
+ return (React.createElement("div", __assign({ className: appendClassNames(className, 'humany-html') }, convertToStringAttributes(other), { ref: ref }), processedHtml));
53
+ });
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export declare type Props = Merge<React.HTMLProps<HTMLElement>, {
3
+ className?: string;
4
+ faIcon: string;
5
+ }>;
6
+ declare const Icon: React.FC<Props>;
7
+ export default Icon;
@@ -0,0 +1,30 @@
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 from 'react';
25
+ import { convertToStringAttributes } from '../utils';
26
+ var Icon = function (_a) {
27
+ var faIcon = _a.faIcon, title = _a.title, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.role, role = _c === void 0 ? 'presentation' : _c, other = __rest(_a, ["faIcon", "title", "className", "role"]);
28
+ return (React.createElement("i", __assign({ className: appendClassNames(className, "fa fa-".concat(faIcon)), title: title, role: role }, convertToStringAttributes(other))));
29
+ };
30
+ export default Icon;
@@ -0,0 +1,58 @@
1
+ export { default as AnchorLink } from './anchor-link';
2
+ export { default as Button } from './button';
3
+ export type { Props as ButtonProps } from './button';
4
+ export { default as Checkbox } from './checkbox';
5
+ export type { Props as CheckboxProps } from './checkbox';
6
+ export { AnimationType as DrawerAnimationType, default as Drawer } from './drawer';
7
+ export { default as Dropdown } from './dropdown';
8
+ export type { Props as DropdownProps } from './dropdown';
9
+ export { default as Empty } from './empty';
10
+ export type { Props as EmptyProps } from './empty';
11
+ export { default as Grid } from './grid';
12
+ export type { Props as GridProps } from './grid';
13
+ export { default as Html } from './html';
14
+ export type { HtmlParseInstruction, Props as HtmlProps } from './html';
15
+ export { default as Icon } from './icon';
16
+ export type { Props as IconProps } from './icon';
17
+ export { default as Input } from './input';
18
+ export type { Props as InputProps } from './input';
19
+ export { default as ItemList } from './item-list';
20
+ export type { Props as ItemListProps } from './item-list';
21
+ export { default as ItemTree } from './item-tree';
22
+ export type { Props as ItemTreeProps } from './item-tree';
23
+ export { default as Lightbox } from './lightbox';
24
+ export type { Props as LightboxProps } from './lightbox';
25
+ export { default as Link } from './link';
26
+ export type { Props as LinkProps } from './link';
27
+ export { default as List } from './list';
28
+ export type { ItemRenderer, Props as ListProps } from './list';
29
+ export { Confirm, default as Modal } from './modal';
30
+ export type { ModalProps } from './modal';
31
+ export { default as NotFound } from './not-found';
32
+ export type { Props as NotFoundProps } from './not-found';
33
+ export { default as Overlay } from './overlay';
34
+ export type { Props as OverlayProps } from './overlay';
35
+ export { default as Paragraph } from './paragraph';
36
+ export type { Props as ParagraphProps } from './paragraph';
37
+ export { default as Portal } from './portal';
38
+ export type { Props as PortalProps } from './portal';
39
+ export { default as RouteLink } from './route-link';
40
+ export type { Props as RouteLinkProps } from './route-link';
41
+ export { default as SymbolBadge } from './symbol-badge';
42
+ export type { HtmlIconProps, Props as SymbolBadgeProps, Symbol } from './symbol-badge';
43
+ export { default as TabStop } from './tab-stop';
44
+ export type { Props as TabStopProps } from './tab-stop';
45
+ export { default as Text } from './text';
46
+ export type { Props as TextProps } from './text';
47
+ export { default as TextLink } from './text-link';
48
+ export type { Props as TextLinkProps } from './text-link';
49
+ export { DateFormats, default as Timestamp } from './timestamp';
50
+ export type { Props as TimestampProps } from './timestamp';
51
+ export { default as Tooltip } from './tooltip';
52
+ export type { Props as TooltipProps } from './tooltip';
53
+ export { default as TransitionComponent } from './transition-component';
54
+ export type { Props as TransitionComponentProps } from './transition-component';
55
+ export { default as Typography } from './typography';
56
+ export type { Props as TypographyProps } from './typography';
57
+ export { default as WidgetLink } from './widget-link';
58
+ export type { Props as WidgetLinkProps } from './widget-link';
@@ -0,0 +1,30 @@
1
+ export { default as AnchorLink } from './anchor-link';
2
+ export { default as Button } from './button';
3
+ export { default as Checkbox } from './checkbox';
4
+ export { AnimationType as DrawerAnimationType, default as Drawer } from './drawer';
5
+ export { default as Dropdown } from './dropdown';
6
+ export { default as Empty } from './empty';
7
+ export { default as Grid } from './grid';
8
+ export { default as Html } from './html';
9
+ export { default as Icon } from './icon';
10
+ export { default as Input } from './input';
11
+ export { default as ItemList } from './item-list';
12
+ export { default as ItemTree } from './item-tree';
13
+ export { default as Lightbox } from './lightbox';
14
+ export { default as Link } from './link';
15
+ export { default as List } from './list';
16
+ export { Confirm, default as Modal } from './modal';
17
+ export { default as NotFound } from './not-found';
18
+ export { default as Overlay } from './overlay';
19
+ export { default as Paragraph } from './paragraph';
20
+ export { default as Portal } from './portal';
21
+ export { default as RouteLink } from './route-link';
22
+ export { default as SymbolBadge } from './symbol-badge';
23
+ export { default as TabStop } from './tab-stop';
24
+ export { default as Text } from './text';
25
+ export { default as TextLink } from './text-link';
26
+ export { DateFormats, default as Timestamp } from './timestamp';
27
+ export { default as Tooltip } from './tooltip';
28
+ export { default as TransitionComponent } from './transition-component';
29
+ export { default as Typography } from './typography';
30
+ export { default as WidgetLink } from './widget-link';
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export declare type Props = Merge<React.ComponentProps<'input'>, {
3
+ onChange?: (value: string) => void;
4
+ onEnter?: (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
5
+ onEscape?: (event: React.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
6
+ onFocusChange?: (focused: boolean) => void;
7
+ selectAllOnFocus?: boolean;
8
+ }>;
9
+ declare const _default: React.ForwardRefExoticComponent<Pick<Props, "form" | "slot" | "style" | "title" | "pattern" | "type" | "name" | "className" | "color" | "height" | "id" | "lang" | "max" | "min" | "width" | "role" | "tabIndex" | "crossOrigin" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "alt" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "autoComplete" | "accept" | "capture" | "checked" | "enterKeyHint" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "size" | "step" | "onEnter" | "onEscape" | "onFocusChange" | "selectAllOnFocus"> & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
10
+ export default _default;
@@ -0,0 +1,69 @@
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
+ var __read = (this && this.__read) || function (o, n) {
24
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
25
+ if (!m) return o;
26
+ var i = m.call(o), r, ar = [], e;
27
+ try {
28
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
29
+ }
30
+ catch (error) { e = { error: error }; }
31
+ finally {
32
+ try {
33
+ if (r && !r.done && (m = i["return"])) m.call(i);
34
+ }
35
+ finally { if (e) throw e.error; }
36
+ }
37
+ return ar;
38
+ };
39
+ import { appendClassNames } from '@telia-ace/widget-utilities';
40
+ import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
41
+ import { convertToStringAttributes } from '../utils';
42
+ export default forwardRef(function (_a, ref) {
43
+ var _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.autoFocus, autoFocus = _c === void 0 ? false : _c, _d = _a.onFocusChange, onFocusChange = _d === void 0 ? function () { } : _d, _e = _a.onEnter, onEnter = _e === void 0 ? function () { } : _e, _f = _a.onEscape, onEscape = _f === void 0 ? function () { } : _f, selectAllOnFocus = _a.selectAllOnFocus, _g = _a.onChange, onChange = _g === void 0 ? function () { } : _g, _h = _a.disabled, disabled = _h === void 0 ? false : _h, type = _a.type, other = __rest(_a, ["className", "autoFocus", "onFocusChange", "onEnter", "onEscape", "selectAllOnFocus", "onChange", "disabled", "type"]);
44
+ var _j = __read(useState(autoFocus), 2), hasFocus = _j[0], setHasFocus = _j[1];
45
+ var innerRef = useRef();
46
+ useImperativeHandle(ref, function () { return innerRef.current; });
47
+ useEffect(function () {
48
+ var _a;
49
+ if (autoFocus) {
50
+ (_a = innerRef === null || innerRef === void 0 ? void 0 : innerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
51
+ }
52
+ }, [autoFocus, ref, innerRef]);
53
+ var handleFocus = function (inFocus, event) {
54
+ setHasFocus(inFocus);
55
+ onFocusChange && onFocusChange(inFocus);
56
+ if (selectAllOnFocus && inFocus) {
57
+ event.target.select();
58
+ }
59
+ };
60
+ var props = __assign(__assign({}, convertToStringAttributes(other)), { disabled: disabled, autoFocus: autoFocus, type: type, onKeyDown: function (e) {
61
+ if (e.key === 'Enter' && hasFocus) {
62
+ onEnter(e);
63
+ }
64
+ if (e.key === 'Escape' && hasFocus) {
65
+ onEscape(e);
66
+ }
67
+ }, onFocus: function (e) { return handleFocus(true, e); }, onBlur: function (e) { return handleFocus(false, e); }, onChange: function (e) { return onChange(e.target.value || ''); }, className: appendClassNames(className, 'humany-input'), 'data-type': type });
68
+ return type !== 'textarea' ? (React.createElement("input", __assign({}, props, { ref: innerRef }))) : (React.createElement("textarea", __assign({}, props, { ref: innerRef })));
69
+ });
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Props as ListProps } from './list';
3
+ import { Props as ParagraphProps } from './paragraph';
4
+ export declare type ItemListProps = {
5
+ customHeader?: any;
6
+ ulProps?: any;
7
+ };
8
+ export declare type Props = Merge<ListProps, ParagraphProps> & ItemListProps;
9
+ declare const _default: React.ForwardRefExoticComponent<Pick<Props, "symbol" | "header" | "html" | "text" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | "htmlParseInstruction" | "renderItem" | "items" | "renderLi" | keyof ItemListProps> & React.RefAttributes<HTMLDivElement>>;
10
+ export default _default;
@@ -0,0 +1,34 @@
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 List from './list';
27
+ import Paragraph from './paragraph';
28
+ export default forwardRef(function (_a, ref) {
29
+ var header = _a.header, customHeader = _a.customHeader, text = _a.text, html = _a.html, className = _a.className, children = _a.children, symbol = _a.symbol, items = _a.items, renderItem = _a.renderItem, renderLi = _a.renderLi, ulProps = _a.ulProps, other = __rest(_a, ["header", "customHeader", "text", "html", "className", "children", "symbol", "items", "renderItem", "renderLi", "ulProps"]);
30
+ return (React.createElement("div", __assign({ className: appendClassNames(className, 'humany-item-list'), "data-item-count": items.length }, convertToStringAttributes(other), { ref: ref }),
31
+ customHeader ? (customHeader) : header || text || html ? (React.createElement(Paragraph, { symbol: symbol, header: header, text: text, html: html })) : null,
32
+ items.length ? (React.createElement(List, __assign({ items: items, renderItem: renderItem, renderLi: renderLi }, ulProps))) : null,
33
+ children));
34
+ });
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export declare type Props = {
3
+ className?: string;
4
+ tree?: any[];
5
+ rootItem?: any;
6
+ renderUnselected?: boolean;
7
+ renderItem: (props: any, level: number, isSelected: boolean) => JSX.Element;
8
+ renderEmpty?: boolean;
9
+ ulProps?: any;
10
+ liProps?: any;
11
+ };
12
+ declare const ItemTree: React.FC<Props>;
13
+ export default ItemTree;
@@ -0,0 +1,50 @@
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
+ import { appendClassNames } from '@telia-ace/widget-utilities';
13
+ import React from 'react';
14
+ import { ItemList } from '.';
15
+ import { convertToStringAttributes } from '../utils';
16
+ var ItemTree = function (_a) {
17
+ var _b = _a.className, className = _b === void 0 ? '' : _b, tree = _a.tree, renderItem = _a.renderItem, rootItem = _a.rootItem, _c = _a.renderUnselected, renderUnselected = _c === void 0 ? true : _c, _d = _a.renderEmpty, renderEmpty = _d === void 0 ? true : _d, ulProps = _a.ulProps, liProps = _a.liProps;
18
+ var hasSelectedChildren = function (items) {
19
+ return !checkIfSelected(items);
20
+ };
21
+ /**
22
+ * Checks if the selected item is actually selected or just expanded by
23
+ * checking if any of its immediate children has selection active
24
+ * @param items
25
+ */
26
+ var checkIfSelected = function (items) {
27
+ if (!items || items.length < 1) {
28
+ return true;
29
+ }
30
+ return !items.some(function (item) { return !!item.selected; });
31
+ };
32
+ var renderTreeItems = function (treeItems, level) {
33
+ return (React.createElement(ItemList, { className: appendClassNames("humany-item-tree-level-".concat(level)), items: treeItems, ulProps: ulProps, renderItem: function (itemProps) {
34
+ var id = itemProps.id, selected = itemProps.selected, items = itemProps.items, matches = itemProps.matches;
35
+ var isSelected = selected && checkIfSelected(items);
36
+ if (!renderEmpty && !matches) {
37
+ return null;
38
+ }
39
+ return (React.createElement("li", __assign({}, convertToStringAttributes(liProps), { key: id, className: 'humany-item-tree-item' }),
40
+ renderItem && renderItem(itemProps, level, isSelected),
41
+ items &&
42
+ (renderUnselected || isSelected) &&
43
+ renderTreeItems(items, level + 1)));
44
+ } }));
45
+ };
46
+ return (React.createElement("div", { className: appendClassNames(className, 'humany-item-tree') },
47
+ rootItem && rootItem(!hasSelectedChildren(tree || [])),
48
+ tree && renderTreeItems(tree, 1)));
49
+ };
50
+ export default ItemTree;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare type Props = {
3
+ attrs: React.DetailedHTMLProps<React.HtmlHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
4
+ };
5
+ declare const Lightbox: React.FC<Props>;
6
+ export default Lightbox;
@@ -0,0 +1,64 @@
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 __read = (this && this.__read) || function (o, n) {
17
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
18
+ if (!m) return o;
19
+ var i = m.call(o), r, ar = [], e;
20
+ try {
21
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
22
+ }
23
+ catch (error) { e = { error: error }; }
24
+ finally {
25
+ try {
26
+ if (r && !r.done && (m = i["return"])) m.call(i);
27
+ }
28
+ finally { if (e) throw e.error; }
29
+ }
30
+ return ar;
31
+ };
32
+ import React, { useCallback, useEffect } from 'react';
33
+ import styled from 'styled-components';
34
+ import { useKeyPress, useToggle } from '../hooks';
35
+ import Button from './button';
36
+ import Overlay from './overlay';
37
+ import SymbolBadge from './symbol-badge';
38
+ var Lightbox = function (_a) {
39
+ var attrs = _a.attrs;
40
+ var _b = __read(useToggle(false), 2), visible = _b[0], toggleVisible = _b[1];
41
+ var esc = useKeyPress('Escape');
42
+ useEffect(function () {
43
+ if (esc) {
44
+ toggleVisible(false);
45
+ }
46
+ }, [esc]);
47
+ var overlayClick = useCallback(function (e) {
48
+ toggleVisible(false);
49
+ }, [toggleVisible]);
50
+ return (React.createElement(React.Fragment, null,
51
+ React.createElement(Overlay, { visible: visible, onClick: overlayClick },
52
+ React.createElement(CloseButton, { onClick: function () { return toggleVisible(false); } },
53
+ React.createElement(StyledSymbolBadge, { size: 24, symbol: { type: 'Svg', content: 'close' } })),
54
+ React.createElement(Content, null,
55
+ React.createElement("img", __assign({}, attrs)))),
56
+ React.createElement("a", { onClick: function () { return toggleVisible(); } },
57
+ React.createElement(Thumbnail, __assign({}, attrs)))));
58
+ };
59
+ var Content = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: ", ";\n max-width: 80%;\n max-height: 80%;\n\n img {\n width: auto !important;\n height: auto !important;\n max-width: 100%;\n max-height: 100%;\n }\n"], ["\n padding: ", ";\n max-width: 80%;\n max-height: 80%;\n\n img {\n width: auto !important;\n height: auto !important;\n max-width: 100%;\n max-height: 100%;\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.normal; });
60
+ var CloseButton = styled(Button)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: fixed;\n top: 50px;\n right: 50px;\n transition: opacity 300ms ease-in-out;\n opacity: 0.7;\n\n &:hover {\n opacity: 1;\n }\n"], ["\n position: fixed;\n top: 50px;\n right: 50px;\n transition: opacity 300ms ease-in-out;\n opacity: 0.7;\n\n &:hover {\n opacity: 1;\n }\n"])));
61
+ var StyledSymbolBadge = styled(SymbolBadge)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n path {\n stroke: #ffffff;\n }\n"], ["\n path {\n stroke: #ffffff;\n }\n"])));
62
+ var Thumbnail = styled.img(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n cursor: pointer;\n"], ["\n cursor: pointer;\n"])));
63
+ export default Lightbox;
64
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export declare type Props = Merge<React.ComponentProps<'a'>, {
3
+ disabled?: boolean;
4
+ routeName?: string;
5
+ params?: {
6
+ [key: string]: any;
7
+ };
8
+ to?: string;
9
+ }>;
10
+ declare const _default: React.ForwardRefExoticComponent<Pick<Props, "to" | "key" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement> | "disabled" | "routeName" | "params"> & React.RefAttributes<HTMLAnchorElement>>;
11
+ export default _default;