@lumx/react 3.0.2-alpha-react-utils.2 → 3.0.2-alpha-react-utils.3

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 (357) hide show
  1. package/_internal/{6340c129.js → ClickAwayProvider.js} +107 -2
  2. package/_internal/ClickAwayProvider.js.map +1 -0
  3. package/_internal/{eca6d4dc.d.ts → types.d.ts} +1 -1
  4. package/index.d.ts +2627 -56
  5. package/index.js +12438 -56
  6. package/index.js.map +1 -1
  7. package/package.json +4 -4
  8. package/utils/index.d.ts +1 -1
  9. package/utils/index.js +1 -1
  10. package/_internal/0062d1bc.js +0 -220
  11. package/_internal/0062d1bc.js.map +0 -1
  12. package/_internal/03e8323d.d.ts +0 -118
  13. package/_internal/0402f9bc.d.ts +0 -183
  14. package/_internal/0b370acc.js +0 -796
  15. package/_internal/0b370acc.js.map +0 -1
  16. package/_internal/0d154d73.d.ts +0 -67
  17. package/_internal/113e3b40.d.ts +0 -31
  18. package/_internal/12ab39e4.js +0 -58
  19. package/_internal/12ab39e4.js.map +0 -1
  20. package/_internal/13e759f3.js +0 -343
  21. package/_internal/13e759f3.js.map +0 -1
  22. package/_internal/158b46d5.js +0 -151
  23. package/_internal/158b46d5.js.map +0 -1
  24. package/_internal/17b74e16.d.ts +0 -31
  25. package/_internal/1b1530a4.d.ts +0 -43
  26. package/_internal/20976405.js +0 -87
  27. package/_internal/20976405.js.map +0 -1
  28. package/_internal/20b0e9a5.d.ts +0 -77
  29. package/_internal/26cd9c63.js +0 -118
  30. package/_internal/26cd9c63.js.map +0 -1
  31. package/_internal/27f21164.js +0 -79
  32. package/_internal/27f21164.js.map +0 -1
  33. package/_internal/288dfd0f.js +0 -13
  34. package/_internal/288dfd0f.js.map +0 -1
  35. package/_internal/28aaf23a.d.ts +0 -41
  36. package/_internal/2c829c0b.d.ts +0 -57
  37. package/_internal/2cc0aec5.js +0 -86
  38. package/_internal/2cc0aec5.js.map +0 -1
  39. package/_internal/2d0a5b28.js +0 -23
  40. package/_internal/2d0a5b28.js.map +0 -1
  41. package/_internal/2d4b5a5e.d.ts +0 -92
  42. package/_internal/2d770113.d.ts +0 -38
  43. package/_internal/2fe97f00.js +0 -291
  44. package/_internal/2fe97f00.js.map +0 -1
  45. package/_internal/31c16fa0.d.ts +0 -37
  46. package/_internal/329a01d3.js +0 -25
  47. package/_internal/329a01d3.js.map +0 -1
  48. package/_internal/3326e990.js +0 -168
  49. package/_internal/3326e990.js.map +0 -1
  50. package/_internal/377b2f44.js +0 -70
  51. package/_internal/377b2f44.js.map +0 -1
  52. package/_internal/3b8d2a6e.js +0 -124
  53. package/_internal/3b8d2a6e.js.map +0 -1
  54. package/_internal/3bd3186e.d.ts +0 -57
  55. package/_internal/48e40868.js +0 -101
  56. package/_internal/48e40868.js.map +0 -1
  57. package/_internal/490ec1da.js +0 -322
  58. package/_internal/490ec1da.js.map +0 -1
  59. package/_internal/49127d69.d.ts +0 -52
  60. package/_internal/4dcd87cb.js +0 -78
  61. package/_internal/4dcd87cb.js.map +0 -1
  62. package/_internal/4f44d848.js +0 -157
  63. package/_internal/4f44d848.js.map +0 -1
  64. package/_internal/4fc64a2e.js +0 -27
  65. package/_internal/4fc64a2e.js.map +0 -1
  66. package/_internal/53a831be.js +0 -108
  67. package/_internal/53a831be.js.map +0 -1
  68. package/_internal/55271fa1.d.ts +0 -34
  69. package/_internal/55d30377.d.ts +0 -22
  70. package/_internal/56385b04.js +0 -116
  71. package/_internal/56385b04.js.map +0 -1
  72. package/_internal/599e250a.d.ts +0 -88
  73. package/_internal/5a054691.d.ts +0 -33
  74. package/_internal/5a127b58.js +0 -82
  75. package/_internal/5a127b58.js.map +0 -1
  76. package/_internal/5a1c0db4.js +0 -156
  77. package/_internal/5a1c0db4.js.map +0 -1
  78. package/_internal/5babcc39.js +0 -147
  79. package/_internal/5babcc39.js.map +0 -1
  80. package/_internal/5c1bf4d4.d.ts +0 -81
  81. package/_internal/5d8ed4ee.js +0 -113
  82. package/_internal/5d8ed4ee.js.map +0 -1
  83. package/_internal/616f2912.js +0 -301
  84. package/_internal/616f2912.js.map +0 -1
  85. package/_internal/61f915de.d.ts +0 -49
  86. package/_internal/620081fa.js +0 -122
  87. package/_internal/620081fa.js.map +0 -1
  88. package/_internal/6340c129.js.map +0 -1
  89. package/_internal/6581c863.d.ts +0 -34
  90. package/_internal/66de4d45.d.ts +0 -32
  91. package/_internal/6735c5c8.d.ts +0 -62
  92. package/_internal/69dd1472.js +0 -112
  93. package/_internal/69dd1472.js.map +0 -1
  94. package/_internal/6a0e1c77.js +0 -327
  95. package/_internal/6a0e1c77.js.map +0 -1
  96. package/_internal/701c20b0.d.ts +0 -24
  97. package/_internal/7391188a.js +0 -81
  98. package/_internal/7391188a.js.map +0 -1
  99. package/_internal/74cb6c26.js +0 -136
  100. package/_internal/74cb6c26.js.map +0 -1
  101. package/_internal/761031bf.js +0 -314
  102. package/_internal/761031bf.js.map +0 -1
  103. package/_internal/76fed69d.js +0 -50
  104. package/_internal/76fed69d.js.map +0 -1
  105. package/_internal/78ef8e34.js +0 -40
  106. package/_internal/78ef8e34.js.map +0 -1
  107. package/_internal/7b906e16.d.ts +0 -17
  108. package/_internal/7be11ddc.d.ts +0 -35
  109. package/_internal/7d39705e.d.ts +0 -20
  110. package/_internal/7e03266f.js +0 -47
  111. package/_internal/7e03266f.js.map +0 -1
  112. package/_internal/7e8d0ac5.js +0 -84
  113. package/_internal/7e8d0ac5.js.map +0 -1
  114. package/_internal/7ffa45f6.js +0 -48
  115. package/_internal/7ffa45f6.js.map +0 -1
  116. package/_internal/84c1ec44.js +0 -257
  117. package/_internal/84c1ec44.js.map +0 -1
  118. package/_internal/8518279f.js +0 -96
  119. package/_internal/8518279f.js.map +0 -1
  120. package/_internal/853713cd.js +0 -25
  121. package/_internal/853713cd.js.map +0 -1
  122. package/_internal/86566d75.d.ts +0 -27
  123. package/_internal/86d22dde.d.ts +0 -57
  124. package/_internal/8e755ded.d.ts +0 -101
  125. package/_internal/901471f5.d.ts +0 -37
  126. package/_internal/935ce959.d.ts +0 -49
  127. package/_internal/97089888.d.ts +0 -16
  128. package/_internal/97cc728c.d.ts +0 -26
  129. package/_internal/9ab3c637.js +0 -2474
  130. package/_internal/9ab3c637.js.map +0 -1
  131. package/_internal/9ca3f59c.js +0 -60
  132. package/_internal/9ca3f59c.js.map +0 -1
  133. package/_internal/9e95ea38.d.ts +0 -43
  134. package/_internal/a0108f92.js +0 -84
  135. package/_internal/a0108f92.js.map +0 -1
  136. package/_internal/a493a193.d.ts +0 -65
  137. package/_internal/a521723d.js +0 -120
  138. package/_internal/a521723d.js.map +0 -1
  139. package/_internal/a6fad025.d.ts +0 -107
  140. package/_internal/a8fa525f.js +0 -124
  141. package/_internal/a8fa525f.js.map +0 -1
  142. package/_internal/aca2ecf5.js +0 -141
  143. package/_internal/aca2ecf5.js.map +0 -1
  144. package/_internal/aef2ef1c.js +0 -53
  145. package/_internal/aef2ef1c.js.map +0 -1
  146. package/_internal/af048b0c.js +0 -89
  147. package/_internal/af048b0c.js.map +0 -1
  148. package/_internal/af2cd0cd.d.ts +0 -17
  149. package/_internal/afec6b62.js +0 -864
  150. package/_internal/afec6b62.js.map +0 -1
  151. package/_internal/b0eb3a30.js +0 -72
  152. package/_internal/b0eb3a30.js.map +0 -1
  153. package/_internal/b89517ea.js +0 -275
  154. package/_internal/b89517ea.js.map +0 -1
  155. package/_internal/bafa6fcc.js +0 -116
  156. package/_internal/bafa6fcc.js.map +0 -1
  157. package/_internal/bbbeb49e.js +0 -47
  158. package/_internal/bbbeb49e.js.map +0 -1
  159. package/_internal/c11f6162.d.ts +0 -52
  160. package/_internal/c723dab4.js +0 -133
  161. package/_internal/c723dab4.js.map +0 -1
  162. package/_internal/c87cc857.d.ts +0 -42
  163. package/_internal/c97f8d04.js +0 -424
  164. package/_internal/c97f8d04.js.map +0 -1
  165. package/_internal/cbb373ea.d.ts +0 -6
  166. package/_internal/cbef23b6.d.ts +0 -104
  167. package/_internal/cdf77f06.d.ts +0 -88
  168. package/_internal/d350f2ff.js +0 -105
  169. package/_internal/d350f2ff.js.map +0 -1
  170. package/_internal/d71a8cf7.js +0 -54
  171. package/_internal/d71a8cf7.js.map +0 -1
  172. package/_internal/d9337952.js +0 -96
  173. package/_internal/d9337952.js.map +0 -1
  174. package/_internal/def14e1a.d.ts +0 -24
  175. package/_internal/e0cd29c7.d.ts +0 -35
  176. package/_internal/e354228f.js +0 -145
  177. package/_internal/e354228f.js.map +0 -1
  178. package/_internal/e3922a05.d.ts +0 -22
  179. package/_internal/e3cb6177.d.ts +0 -75
  180. package/_internal/e810c841.d.ts +0 -182
  181. package/_internal/ea700b01.d.ts +0 -43
  182. package/_internal/eed07003.js +0 -122
  183. package/_internal/eed07003.js.map +0 -1
  184. package/_internal/f1c9b334.d.ts +0 -22
  185. package/_internal/f3c3a674.js +0 -281
  186. package/_internal/f3c3a674.js.map +0 -1
  187. package/_internal/f571cdcd.js +0 -132
  188. package/_internal/f571cdcd.js.map +0 -1
  189. package/_internal/f5bdff7e.js +0 -282
  190. package/_internal/f5bdff7e.js.map +0 -1
  191. package/_internal/f851fc00.d.ts +0 -34
  192. package/_internal/f859b007.d.ts +0 -49
  193. package/_internal/fb384b79.d.ts +0 -38
  194. package/_internal/fc4c034b.js +0 -63
  195. package/_internal/fc4c034b.js.map +0 -1
  196. package/_internal/fc608bd9.js +0 -16
  197. package/_internal/fc608bd9.js.map +0 -1
  198. package/_internal/fd1f4d68.d.ts +0 -36
  199. package/_internal/fd867c9d.js +0 -346
  200. package/_internal/fd867c9d.js.map +0 -1
  201. package/_internal/ff8081e5.js +0 -57
  202. package/_internal/ff8081e5.js.map +0 -1
  203. package/_internal/ffd1bfe3.js +0 -123
  204. package/_internal/ffd1bfe3.js.map +0 -1
  205. package/components/alert-dialog.d.ts +0 -6
  206. package/components/alert-dialog.js +0 -2
  207. package/components/alert-dialog.js.map +0 -1
  208. package/components/autocomplete.d.ts +0 -8
  209. package/components/autocomplete.js +0 -2
  210. package/components/autocomplete.js.map +0 -1
  211. package/components/avatar.d.ts +0 -4
  212. package/components/avatar.js +0 -2
  213. package/components/avatar.js.map +0 -1
  214. package/components/badge.d.ts +0 -3
  215. package/components/badge.js +0 -2
  216. package/components/badge.js.map +0 -1
  217. package/components/button.d.ts +0 -8
  218. package/components/button.js +0 -4
  219. package/components/button.js.map +0 -1
  220. package/components/checkbox.d.ts +0 -3
  221. package/components/checkbox.js +0 -2
  222. package/components/checkbox.js.map +0 -1
  223. package/components/chip.d.ts +0 -3
  224. package/components/chip.js +0 -3
  225. package/components/chip.js.map +0 -1
  226. package/components/comment-block.d.ts +0 -5
  227. package/components/comment-block.js +0 -2
  228. package/components/comment-block.js.map +0 -1
  229. package/components/date-picker.d.ts +0 -7
  230. package/components/date-picker.js +0 -2
  231. package/components/date-picker.js.map +0 -1
  232. package/components/dialog.d.ts +0 -3
  233. package/components/dialog.js +0 -2
  234. package/components/dialog.js.map +0 -1
  235. package/components/divider.d.ts +0 -3
  236. package/components/divider.js +0 -2
  237. package/components/divider.js.map +0 -1
  238. package/components/drag-handle.d.ts +0 -3
  239. package/components/drag-handle.js +0 -2
  240. package/components/drag-handle.js.map +0 -1
  241. package/components/dropdown.d.ts +0 -4
  242. package/components/dropdown.js +0 -2
  243. package/components/dropdown.js.map +0 -1
  244. package/components/expansion-panel.d.ts +0 -7
  245. package/components/expansion-panel.js +0 -2
  246. package/components/expansion-panel.js.map +0 -1
  247. package/components/flag.d.ts +0 -3
  248. package/components/flag.js +0 -2
  249. package/components/flag.js.map +0 -1
  250. package/components/flex-box.d.ts +0 -3
  251. package/components/flex-box.js +0 -2
  252. package/components/flex-box.js.map +0 -1
  253. package/components/generic-block.d.ts +0 -4
  254. package/components/generic-block.js +0 -2
  255. package/components/generic-block.js.map +0 -1
  256. package/components/grid.d.ts +0 -3
  257. package/components/grid.js +0 -2
  258. package/components/grid.js.map +0 -1
  259. package/components/heading.d.ts +0 -4
  260. package/components/heading.js +0 -2
  261. package/components/heading.js.map +0 -1
  262. package/components/icon.d.ts +0 -3
  263. package/components/icon.js +0 -2
  264. package/components/icon.js.map +0 -1
  265. package/components/image-block.d.ts +0 -4
  266. package/components/image-block.js +0 -2
  267. package/components/image-block.js.map +0 -1
  268. package/components/input-helper.d.ts +0 -3
  269. package/components/input-helper.js +0 -2
  270. package/components/input-helper.js.map +0 -1
  271. package/components/input-label.d.ts +0 -3
  272. package/components/input-label.js +0 -2
  273. package/components/input-label.js.map +0 -1
  274. package/components/lightbox.d.ts +0 -7
  275. package/components/lightbox.js +0 -2
  276. package/components/lightbox.js.map +0 -1
  277. package/components/link-preview.d.ts +0 -5
  278. package/components/link-preview.js +0 -2
  279. package/components/link-preview.js.map +0 -1
  280. package/components/link.d.ts +0 -3
  281. package/components/link.js +0 -2
  282. package/components/link.js.map +0 -1
  283. package/components/list.d.ts +0 -3
  284. package/components/list.js +0 -3
  285. package/components/list.js.map +0 -1
  286. package/components/message.d.ts +0 -3
  287. package/components/message.js +0 -2
  288. package/components/message.js.map +0 -1
  289. package/components/mosaic.d.ts +0 -4
  290. package/components/mosaic.js +0 -2
  291. package/components/mosaic.js.map +0 -1
  292. package/components/notification.d.ts +0 -3
  293. package/components/notification.js +0 -2
  294. package/components/notification.js.map +0 -1
  295. package/components/popover.d.ts +0 -3
  296. package/components/popover.js +0 -2
  297. package/components/popover.js.map +0 -1
  298. package/components/post-block.d.ts +0 -4
  299. package/components/post-block.js +0 -2
  300. package/components/post-block.js.map +0 -1
  301. package/components/progress-tracker.d.ts +0 -3
  302. package/components/progress-tracker.js +0 -2
  303. package/components/progress-tracker.js.map +0 -1
  304. package/components/progress.d.ts +0 -3
  305. package/components/progress.js +0 -2
  306. package/components/progress.js.map +0 -1
  307. package/components/radio-button.d.ts +0 -3
  308. package/components/radio-button.js +0 -2
  309. package/components/radio-button.js.map +0 -1
  310. package/components/select.d.ts +0 -7
  311. package/components/select.js +0 -2
  312. package/components/select.js.map +0 -1
  313. package/components/side-navigation.d.ts +0 -7
  314. package/components/side-navigation.js +0 -2
  315. package/components/side-navigation.js.map +0 -1
  316. package/components/skeleton.d.ts +0 -3
  317. package/components/skeleton.js +0 -2
  318. package/components/skeleton.js.map +0 -1
  319. package/components/slider.d.ts +0 -3
  320. package/components/slider.js +0 -2
  321. package/components/slider.js.map +0 -1
  322. package/components/slideshow.d.ts +0 -7
  323. package/components/slideshow.js +0 -2
  324. package/components/slideshow.js.map +0 -1
  325. package/components/switch.d.ts +0 -3
  326. package/components/switch.js +0 -2
  327. package/components/switch.js.map +0 -1
  328. package/components/table.d.ts +0 -3
  329. package/components/table.js +0 -2
  330. package/components/table.js.map +0 -1
  331. package/components/tabs.d.ts +0 -4
  332. package/components/tabs.js +0 -2
  333. package/components/tabs.js.map +0 -1
  334. package/components/text-field.d.ts +0 -7
  335. package/components/text-field.js +0 -2
  336. package/components/text-field.js.map +0 -1
  337. package/components/text.d.ts +0 -3
  338. package/components/text.js +0 -2
  339. package/components/text.js.map +0 -1
  340. package/components/thumbnail.d.ts +0 -4
  341. package/components/thumbnail.js +0 -3
  342. package/components/thumbnail.js.map +0 -1
  343. package/components/toolbar.d.ts +0 -3
  344. package/components/toolbar.js +0 -2
  345. package/components/toolbar.js.map +0 -1
  346. package/components/tooltip.d.ts +0 -4
  347. package/components/tooltip.js +0 -2
  348. package/components/tooltip.js.map +0 -1
  349. package/components/uploader.d.ts +0 -3
  350. package/components/uploader.js +0 -2
  351. package/components/uploader.js.map +0 -1
  352. package/components/user-block.d.ts +0 -5
  353. package/components/user-block.js +0 -2
  354. package/components/user-block.js.map +0 -1
  355. package/components.d.ts +0 -2
  356. package/components.js +0 -156
  357. package/components.js.map +0 -1
@@ -1,124 +0,0 @@
1
- import { b as _objectWithoutProperties, c as _extends } from './6340c129.js';
2
- import { Size, Theme } from '../components.js';
3
- import React, { forwardRef, Children } from 'react';
4
- import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './fd867c9d.js';
5
- import { A as Avatar } from './5a127b58.js';
6
- import isFunction from 'lodash/isFunction';
7
- import { T as Tooltip } from './f5bdff7e.js';
8
-
9
- /**
10
- * Comment block variants.
11
- */
12
- var CommentBlockVariant = {
13
- indented: 'indented',
14
- linear: 'linear'
15
- };
16
-
17
- /**
18
- * Component display name.
19
- */
20
- var COMPONENT_NAME = 'CommentBlock';
21
- /**
22
- * Component default class name and class prefix.
23
- */
24
-
25
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
26
- /**
27
- * Component default props.
28
- */
29
-
30
- var DEFAULT_PROPS = {
31
- theme: Theme.light,
32
- variant: CommentBlockVariant.indented
33
- };
34
- /**
35
- * CommentBlock component.
36
- *
37
- * @param props Component props.
38
- * @param ref Component ref.
39
- * @return React element.
40
- */
41
-
42
- var CommentBlock = forwardRef(function (props, ref) {
43
- var actions = props.actions,
44
- avatarProps = props.avatarProps,
45
- children = props.children,
46
- className = props.className,
47
- date = props.date,
48
- fullDate = props.fullDate,
49
- hasActions = props.hasActions,
50
- headerActions = props.headerActions,
51
- isOpen = props.isOpen,
52
- isRelevant = props.isRelevant,
53
- name = props.name,
54
- onClick = props.onClick,
55
- onMouseEnter = props.onMouseEnter,
56
- onMouseLeave = props.onMouseLeave,
57
- text = props.text,
58
- theme = props.theme,
59
- variant = props.variant,
60
- forwardedProps = _objectWithoutProperties(props, ["actions", "avatarProps", "children", "className", "date", "fullDate", "hasActions", "headerActions", "isOpen", "isRelevant", "name", "onClick", "onMouseEnter", "onMouseLeave", "text", "theme", "variant"]);
61
-
62
- var enterKeyPress = function enterKeyPress(evt) {
63
- if (evt.key === 'Enter' && isFunction(onClick)) {
64
- onClick();
65
- }
66
- };
67
-
68
- var hasChildren = Children.count(children) > 0;
69
- return React.createElement("div", _extends({
70
- ref: ref,
71
- className: classnames(className, handleBasicClasses({
72
- hasChildren: hasChildren && isOpen,
73
- hasIndentedChildren: hasChildren && variant === CommentBlockVariant.indented,
74
- hasLinearChildren: hasChildren && variant === CommentBlockVariant.linear,
75
- isRelevant: isRelevant,
76
- prefix: CLASSNAME,
77
- theme: theme
78
- }))
79
- }, forwardedProps), React.createElement("div", {
80
- className: "".concat(CLASSNAME, "__wrapper")
81
- }, React.createElement("div", {
82
- className: "".concat(CLASSNAME, "__avatar")
83
- }, React.createElement(Avatar, _extends({}, avatarProps, {
84
- size: Size.m,
85
- tabIndex: onClick ? 0 : -1,
86
- onClick: onClick,
87
- onKeyPress: enterKeyPress
88
- }))), React.createElement("div", {
89
- className: "".concat(CLASSNAME, "__container")
90
- }, React.createElement("div", {
91
- className: "".concat(CLASSNAME, "__content")
92
- }, React.createElement("div", {
93
- className: "".concat(CLASSNAME, "__meta")
94
- }, React.createElement("span", {
95
- className: "".concat(CLASSNAME, "__name"),
96
- onClick: onClick,
97
- onKeyPress: enterKeyPress,
98
- onMouseEnter: onMouseEnter,
99
- onMouseLeave: onMouseLeave,
100
- role: "button",
101
- tabIndex: onClick ? 0 : -1
102
- }, name), headerActions && React.createElement("span", {
103
- className: "".concat(CLASSNAME, "__header-actions")
104
- }, headerActions)), React.createElement("div", {
105
- className: "".concat(CLASSNAME, "__text")
106
- }, text), date && (fullDate ? React.createElement(Tooltip, {
107
- label: fullDate,
108
- placement: "top"
109
- }, React.createElement("span", {
110
- className: "".concat(CLASSNAME, "__date")
111
- }, date)) : React.createElement("span", {
112
- className: "".concat(CLASSNAME, "__date")
113
- }, date))), hasActions && React.createElement("div", {
114
- className: "".concat(CLASSNAME, "__actions")
115
- }, actions))), hasChildren && isOpen && React.createElement("div", {
116
- className: "".concat(CLASSNAME, "__children")
117
- }, children));
118
- });
119
- CommentBlock.displayName = COMPONENT_NAME;
120
- CommentBlock.className = CLASSNAME;
121
- CommentBlock.defaultProps = DEFAULT_PROPS;
122
-
123
- export { CommentBlockVariant as C, CommentBlock as a };
124
- //# sourceMappingURL=3b8d2a6e.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"3b8d2a6e.js","sources":["../../src/components/comment-block/CommentBlock.tsx"],"sourcesContent":["import React, { Children, forwardRef, KeyboardEvent, KeyboardEventHandler, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport { Avatar, Size, Theme, Tooltip } from '@lumx/react';\nimport { Comp, GenericProps, HasTheme, ValueOf } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';\n\nimport isFunction from 'lodash/isFunction';\nimport { AvatarProps } from '../avatar/Avatar';\n\n/**\n * Comment block variants.\n */\nexport const CommentBlockVariant = {\n indented: 'indented',\n linear: 'linear',\n} as const;\nexport type CommentBlockVariant = ValueOf<typeof CommentBlockVariant>;\n\n/**\n * Defines the props of the component.\n */\nexport interface CommentBlockProps extends GenericProps, HasTheme {\n /** Action toolbar content. */\n actions?: ReactNode;\n /** Props to pass to the avatar. */\n avatarProps: AvatarProps;\n /** Comment block replies. */\n children?: ReactNode;\n /** Comment date with the minimal timestamp informations (xx minutes, x hours, yesterday, 6 days, Month Day, Month Day Year)*/\n date: string;\n /** Comment date with the full timestamp informations (day, month, year, time) */\n fullDate?: string;\n /** Whether the component has actions to display or not. */\n hasActions?: boolean;\n /** Action toolbar header content. */\n headerActions?: ReactNode;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Whether the comment is relevant or not. */\n isRelevant?: boolean;\n /** Comment author name. */\n name: string;\n /** On click callback. */\n onClick?(): void;\n /** On mouse enter callback. */\n onMouseEnter?(): void;\n /** On mouse leave callback. */\n onMouseLeave?(): void;\n /** Comment content. */\n text: ReactNode | string;\n /** Comment variant. */\n variant?: CommentBlockVariant;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'CommentBlock';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<CommentBlockProps> = {\n theme: Theme.light,\n variant: CommentBlockVariant.indented,\n};\n\n/**\n * CommentBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const CommentBlock: Comp<CommentBlockProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n actions,\n avatarProps,\n children,\n className,\n date,\n fullDate,\n hasActions,\n headerActions,\n isOpen,\n isRelevant,\n name,\n onClick,\n onMouseEnter,\n onMouseLeave,\n text,\n theme,\n variant,\n ...forwardedProps\n } = props;\n const enterKeyPress: KeyboardEventHandler<HTMLElement> = (evt: KeyboardEvent<HTMLElement>) => {\n if (evt.key === 'Enter' && isFunction(onClick)) {\n onClick();\n }\n };\n const hasChildren = Children.count(children) > 0;\n\n return (\n <div\n ref={ref}\n className={classNames(\n className,\n handleBasicClasses({\n hasChildren: hasChildren && isOpen,\n hasIndentedChildren: hasChildren && variant === CommentBlockVariant.indented,\n hasLinearChildren: hasChildren && variant === CommentBlockVariant.linear,\n isRelevant,\n prefix: CLASSNAME,\n theme,\n }),\n )}\n {...forwardedProps}\n >\n <div className={`${CLASSNAME}__wrapper`}>\n <div className={`${CLASSNAME}__avatar`}>\n <Avatar\n {...avatarProps}\n size={Size.m}\n tabIndex={onClick ? 0 : -1}\n onClick={onClick}\n onKeyPress={enterKeyPress}\n />\n </div>\n\n <div className={`${CLASSNAME}__container`}>\n <div className={`${CLASSNAME}__content`}>\n <div className={`${CLASSNAME}__meta`}>\n <span\n className={`${CLASSNAME}__name`}\n onClick={onClick}\n onKeyPress={enterKeyPress}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n role=\"button\"\n tabIndex={onClick ? 0 : -1}\n >\n {name}\n </span>\n {headerActions && <span className={`${CLASSNAME}__header-actions`}>{headerActions}</span>}\n </div>\n\n <div className={`${CLASSNAME}__text`}>{text}</div>\n {date &&\n (fullDate ? (\n <Tooltip label={fullDate} placement=\"top\">\n <span className={`${CLASSNAME}__date`}>{date}</span>\n </Tooltip>\n ) : (\n <span className={`${CLASSNAME}__date`}>{date}</span>\n ))}\n </div>\n {hasActions && <div className={`${CLASSNAME}__actions`}>{actions}</div>}\n </div>\n </div>\n\n {hasChildren && isOpen && <div className={`${CLASSNAME}__children`}>{children}</div>}\n </div>\n );\n});\nCommentBlock.displayName = COMPONENT_NAME;\nCommentBlock.className = CLASSNAME;\nCommentBlock.defaultProps = DEFAULT_PROPS;\n"],"names":["CommentBlockVariant","indented","linear","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","variant","CommentBlock","forwardRef","props","ref","actions","avatarProps","children","className","date","fullDate","hasActions","headerActions","isOpen","isRelevant","name","onClick","onMouseEnter","onMouseLeave","text","forwardedProps","enterKeyPress","evt","key","isFunction","hasChildren","Children","count","classNames","handleBasicClasses","hasIndentedChildren","hasLinearChildren","prefix","Size","m","displayName","defaultProps"],"mappings":";;;;;;;;AAWA;;;IAGaA,mBAAmB,GAAG;AAC/BC,EAAAA,QAAQ,EAAE,UADqB;AAE/BC,EAAAA,MAAM,EAAE;AAFuB;;AA0CnC;;;AAGA,IAAMC,cAAc,GAAG,cAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAyC,GAAG;AAC9CC,EAAAA,KAAK,EAAEC,KAAK,CAACC,KADiC;AAE9CC,EAAAA,OAAO,EAAEV,mBAAmB,CAACC;AAFiB,CAAlD;AAKA;;;;;;;;IAOaU,YAAqD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAExFC,OAFwF,GAoBxFF,KApBwF,CAExFE,OAFwF;AAAA,MAGxFC,WAHwF,GAoBxFH,KApBwF,CAGxFG,WAHwF;AAAA,MAIxFC,QAJwF,GAoBxFJ,KApBwF,CAIxFI,QAJwF;AAAA,MAKxFC,SALwF,GAoBxFL,KApBwF,CAKxFK,SALwF;AAAA,MAMxFC,IANwF,GAoBxFN,KApBwF,CAMxFM,IANwF;AAAA,MAOxFC,QAPwF,GAoBxFP,KApBwF,CAOxFO,QAPwF;AAAA,MAQxFC,UARwF,GAoBxFR,KApBwF,CAQxFQ,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AAK,IAAA,SAAS,YAAKjB,SAAL;AAAd,KAA0CW,OAA1C,CA3BnB,CAXJ,CAfJ,EAyDKoB,WAAW,IAAIZ,MAAf,IAAyB;AAAK,IAAA,SAAS,YAAKnB,SAAL;AAAd,KAA2Ca,QAA3C,CAzD9B,CADJ;AA6DH,CAzF8E;AA0F/EN,YAAY,CAACkC,WAAb,GAA2B1C,cAA3B;AACAQ,YAAY,CAACO,SAAb,GAAyBd,SAAzB;AACAO,YAAY,CAACmC,YAAb,GAA4BxC,aAA5B;;;;"}
@@ -1,57 +0,0 @@
1
- import React, { ReactElement, ReactNode, Ref, MouseEventHandler, KeyboardEventHandler, ImgHTMLAttributes } from 'react';
2
- import { l as GenericProps, m as HasTheme, H as HorizontalAlignment, g as AspectRatio, q as Falsy, F as FocusPoint, i as ThumbnailSize, j as ThumbnailVariant, k as Comp } from './eca6d4dc.js';
3
-
4
- declare type ImgHTMLProps = ImgHTMLAttributes<HTMLImageElement>;
5
- /**
6
- * Defines the props of the component.
7
- */
8
- interface ThumbnailProps extends GenericProps, HasTheme {
9
- /** Alignment of the thumbnail in it's parent (requires flex parent). */
10
- align?: HorizontalAlignment;
11
- /** Image alternative text. */
12
- alt: string;
13
- /** Image aspect ratio. */
14
- aspectRatio?: AspectRatio;
15
- /** Badge. */
16
- badge?: ReactElement | Falsy;
17
- /** Image cross origin resource policy. */
18
- crossOrigin?: ImgHTMLProps['crossOrigin'];
19
- /** Fallback icon (SVG path) or react node when image fails to load. */
20
- fallback?: string | ReactNode;
21
- /** Whether the thumbnail should fill it's parent size (requires flex parent) or not. */
22
- fillHeight?: boolean;
23
- /** Apply relative vertical and horizontal shift (from -1 to 1) on the image position inside the thumbnail. */
24
- focusPoint?: FocusPoint;
25
- /** Image URL. */
26
- image: string;
27
- /** Props to inject into the native <img> element. */
28
- imgProps?: ImgHTMLProps;
29
- /** Reference to the native <img> element. */
30
- imgRef?: Ref<HTMLImageElement>;
31
- /** Set to true to force the display of the loading skeleton. */
32
- isLoading?: boolean;
33
- /** Size variant of the component. */
34
- size?: ThumbnailSize;
35
- /** Image loading mode. */
36
- loading?: ImgHTMLProps['loading'];
37
- /** On click callback. */
38
- onClick?: MouseEventHandler<HTMLDivElement>;
39
- /** On key press callback. */
40
- onKeyPress?: KeyboardEventHandler<HTMLDivElement>;
41
- /** Variant of the component. */
42
- variant?: ThumbnailVariant;
43
- /** Props to pass to the link wrapping the thumbnail. */
44
- linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
45
- /** Custom react component for the link (can be used to inject react router Link). */
46
- linkAs?: 'a' | any;
47
- }
48
- /**
49
- * Thumbnail component.
50
- *
51
- * @param props Component props.
52
- * @param ref Component ref.
53
- * @return React element.
54
- */
55
- declare const Thumbnail: Comp<ThumbnailProps>;
56
-
57
- export { ThumbnailProps as T, Thumbnail as a };
@@ -1,101 +0,0 @@
1
- import { b as _objectWithoutProperties, c as _extends } from './6340c129.js';
2
- import { Theme, Alignment } from '../components.js';
3
- import React, { forwardRef } from 'react';
4
- import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './fd867c9d.js';
5
- import isObject from 'lodash/isObject';
6
- import { T as Thumbnail } from './616f2912.js';
7
-
8
- /**
9
- * Image block variants.
10
- */
11
- var ImageBlockCaptionPosition = {
12
- below: 'below',
13
- over: 'over'
14
- };
15
-
16
- /**
17
- * Component display name.
18
- */
19
- var COMPONENT_NAME = 'ImageBlock';
20
- /**
21
- * Component default class name and class prefix.
22
- */
23
-
24
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
25
- /**
26
- * Component default props.
27
- */
28
-
29
- var DEFAULT_PROPS = {
30
- captionPosition: ImageBlockCaptionPosition.below,
31
- theme: Theme.light,
32
- align: Alignment.left
33
- };
34
- /**
35
- * ImageBlock component.
36
- *
37
- * @param props Component props.
38
- * @param ref Component ref.
39
- * @return React element.
40
- */
41
-
42
- var ImageBlock = forwardRef(function (props, ref) {
43
- var actions = props.actions,
44
- align = props.align,
45
- alt = props.alt,
46
- captionPosition = props.captionPosition,
47
- captionStyle = props.captionStyle,
48
- className = props.className,
49
- description = props.description,
50
- fillHeight = props.fillHeight,
51
- image = props.image,
52
- size = props.size,
53
- tags = props.tags,
54
- theme = props.theme,
55
- thumbnailProps = props.thumbnailProps,
56
- title = props.title,
57
- forwardedProps = _objectWithoutProperties(props, ["actions", "align", "alt", "captionPosition", "captionStyle", "className", "description", "fillHeight", "image", "size", "tags", "theme", "thumbnailProps", "title"]);
58
-
59
- return React.createElement("figure", _extends({
60
- ref: ref
61
- }, forwardedProps, {
62
- className: classnames(className, handleBasicClasses({
63
- prefix: CLASSNAME,
64
- captionPosition: captionPosition,
65
- align: align,
66
- size: size,
67
- theme: theme
68
- }), fillHeight && "".concat(CLASSNAME, "--fill-height"))
69
- }), React.createElement(Thumbnail, _extends({}, thumbnailProps, {
70
- className: classnames("".concat(CLASSNAME, "__image"), thumbnailProps === null || thumbnailProps === void 0 ? void 0 : thumbnailProps.className),
71
- fillHeight: fillHeight,
72
- align: align,
73
- image: image,
74
- size: size,
75
- theme: theme,
76
- alt: alt || title
77
- })), (title || description || tags) && React.createElement("figcaption", {
78
- className: "".concat(CLASSNAME, "__wrapper"),
79
- style: captionStyle
80
- }, (title || description) && React.createElement("div", {
81
- className: "".concat(CLASSNAME, "__caption")
82
- }, title && React.createElement("span", {
83
- className: "".concat(CLASSNAME, "__title")
84
- }, title), title && description && "\xA0", isObject(description) && description.__html ? // eslint-disable-next-line react/no-danger
85
- React.createElement("span", {
86
- dangerouslySetInnerHTML: description,
87
- className: "".concat(CLASSNAME, "__description")
88
- }) : React.createElement("span", {
89
- className: "".concat(CLASSNAME, "__description")
90
- }, description)), tags && React.createElement("div", {
91
- className: "".concat(CLASSNAME, "__tags")
92
- }, tags)), actions && React.createElement("div", {
93
- className: "".concat(CLASSNAME, "__actions")
94
- }, actions));
95
- });
96
- ImageBlock.displayName = COMPONENT_NAME;
97
- ImageBlock.className = CLASSNAME;
98
- ImageBlock.defaultProps = DEFAULT_PROPS;
99
-
100
- export { ImageBlockCaptionPosition as I, ImageBlock as a };
101
- //# sourceMappingURL=48e40868.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"48e40868.js","sources":["../../src/components/image-block/ImageBlock.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport isObject from 'lodash/isObject';\n\nimport { Alignment, HorizontalAlignment, Size, Theme, Thumbnail } from '@lumx/react';\n\nimport { Comp, GenericProps, HasTheme, ValueOf } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';\nimport { ThumbnailProps } from '../thumbnail/Thumbnail';\n\n/**\n * Image block variants.\n */\nexport const ImageBlockCaptionPosition = {\n below: 'below',\n over: 'over',\n} as const;\nexport type ImageBlockCaptionPosition = ValueOf<typeof ImageBlockCaptionPosition>;\n\n/**\n * Image block sizes.\n */\nexport type ImageBlockSize = Extract<Size, 'xl' | 'xxl'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface ImageBlockProps extends GenericProps, HasTheme {\n /** Action toolbar content. */\n actions?: ReactNode;\n /** Alignment. */\n align?: HorizontalAlignment;\n /** Image alternative text. */\n alt: string;\n /** Caption position. */\n captionPosition?: ImageBlockCaptionPosition;\n /** Caption custom CSS style. */\n captionStyle?: CSSProperties;\n /** Image description. Can be either a string, or sanitized html. */\n description?: string | { __html: string };\n /** Whether the image has to fill its container height or not. */\n fillHeight?: boolean;\n /** Image URL. */\n image: string;\n /** Size variant. */\n size?: ImageBlockSize;\n /** Tag content. */\n tags?: ReactNode;\n /** Props to pass to the thumbnail (minus those already set by the ImageBlock props). */\n thumbnailProps?: Omit<ThumbnailProps, 'image' | 'size' | 'theme' | 'align' | 'fillHeight'>;\n /** Image title to display in the caption. */\n title?: string;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ImageBlock';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ImageBlockProps> = {\n captionPosition: ImageBlockCaptionPosition.below,\n theme: Theme.light,\n align: Alignment.left,\n};\n\n/**\n * ImageBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ImageBlock: Comp<ImageBlockProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n actions,\n align,\n alt,\n captionPosition,\n captionStyle,\n className,\n description,\n fillHeight,\n image,\n size,\n tags,\n theme,\n thumbnailProps,\n title,\n ...forwardedProps\n } = props;\n return (\n <figure\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n captionPosition,\n align,\n size,\n theme,\n }),\n fillHeight && `${CLASSNAME}--fill-height`,\n )}\n >\n <Thumbnail\n {...thumbnailProps}\n className={classNames(`${CLASSNAME}__image`, thumbnailProps?.className)}\n fillHeight={fillHeight}\n align={align}\n image={image}\n size={size}\n theme={theme}\n alt={(alt || title) as string}\n />\n {(title || description || tags) && (\n <figcaption className={`${CLASSNAME}__wrapper`} style={captionStyle}>\n {(title || description) && (\n <div className={`${CLASSNAME}__caption`}>\n {title && <span className={`${CLASSNAME}__title`}>{title}</span>}\n {/* Add an `&nbsp;` when there is description and title. */}\n {title && description && '\\u00A0'}\n {isObject(description) && description.__html ? (\n // eslint-disable-next-line react/no-danger\n <span dangerouslySetInnerHTML={description} className={`${CLASSNAME}__description`} />\n ) : (\n <span className={`${CLASSNAME}__description`}>{description}</span>\n )}\n </div>\n )}\n {tags && <div className={`${CLASSNAME}__tags`}>{tags}</div>}\n </figcaption>\n )}\n {actions && <div className={`${CLASSNAME}__actions`}>{actions}</div>}\n </figure>\n );\n});\nImageBlock.displayName = COMPONENT_NAME;\nImageBlock.className = CLASSNAME;\nImageBlock.defaultProps = DEFAULT_PROPS;\n"],"names":["ImageBlockCaptionPosition","below","over","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","captionPosition","theme","Theme","light","align","Alignment","left","ImageBlock","forwardRef","props","ref","actions","alt","captionStyle","className","description","fillHeight","image","size","tags","thumbnailProps","title","forwardedProps","classNames","handleBasicClasses","prefix","isObject","__html","displayName","defaultProps"],"mappings":";;;;;;;AAYA;;;IAGaA,yBAAyB,GAAG;AACrCC,EAAAA,KAAK,EAAE,OAD8B;AAErCC,EAAAA,IAAI,EAAE;AAF+B;;AAyCzC;;;AAGA,IAAMC,cAAc,GAAG,YAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAuC,GAAG;AAC5CC,EAAAA,eAAe,EAAEP,yBAAyB,CAACC,KADC;AAE5CO,EAAAA,KAAK,EAAEC,KAAK,CAACC,KAF+B;AAG5CC,EAAAA,KAAK,EAAEC,SAAS,CAACC;AAH2B,CAAhD;AAMA;;;;;;;;IAOaC,UAAiD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAEpFC,OAFoF,GAiBpFF,KAjBoF,CAEpFE,OAFoF;AAAA,MAGpFP,KAHoF,GAiBpFK,KAjBoF,CAGpFL,KAHoF;AAAA,MAIpFQ,GAJoF,GAiBpFH,KAjBoF,CAIpFG,GAJoF;AAAA,MAKpFZ,eALoF,GAiBpFS,KAjBoF,CAKpFT,eALoF;AAAA,MAMpFa,YANoF,GAiBpFJ,KAjBoF,CAMpFI,YANoF;AAAA,MAOpFC,SAPoF,GAiBpFL,KAjBoF,CAOpFK,SAPoF;AAAA,MAQpFC,WARoF,GAiBpFN,KAjBoF,CAQpFM,WARoF;AAAA,MASpFC,UAToF,GAiBpFP,KAjBoF,CASpFO,UAToF;AAAA,MAUpFC,KAVoF,GAiBpFR,KAjBoF,CAUpFQ,KAVoF;AAAA,MAWpFC,IAXoF,GAiBpFT,KAjBoF,CAWpFS,IAXoF;AAAA,MAYpFC,IAZoF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,IAAIN,WAAT,IAAwB,MAH7B,EAIKW,QAAQ,CAACX,WAAD,CAAR,IAAyBA,WAAW,CAACY,MAArC;AAEG;AAAM,IAAA,uBAAuB,EAAEZ,WAA/B;AAA4C,IAAA,SAAS,YAAKlB,SAAL;AAArD,IAFH,GAIG;AAAM,IAAA,SAAS,YAAKA,SAAL;AAAf,KAA+CkB,WAA/C,CARR,CAFR,EAcKI,IAAI,IAAI;AAAK,IAAA,SAAS,YAAKtB,SAAL;AAAd,KAAuCsB,IAAvC,CAdb,CA1BR,EA2CKR,OAAO,IAAI;AAAK,IAAA,SAAS,YAAKd,SAAL;AAAd,KAA0Cc,OAA1C,CA3ChB,CADJ;AA+CH,CAjE0E;AAkE3EJ,UAAU,CAACqB,WAAX,GAAyBhC,cAAzB;AACAW,UAAU,CAACO,SAAX,GAAuBjB,SAAvB;AACAU,UAAU,CAACsB,YAAX,GAA0B9B,aAA1B;;;;"}
@@ -1,322 +0,0 @@
1
- import { b as _objectWithoutProperties, d as _slicedToArray, _ as _objectSpread2, c as _extends } from './6340c129.js';
2
- import { Size, Theme, Emphasis, Kind } from '../components.js';
3
- import React, { forwardRef, useMemo, useState, useRef, useEffect } from 'react';
4
- import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './fd867c9d.js';
5
- import { I as Icon, c as mdiAlertCircle, b as mdiCheckCircle, n as mdiCloseCircle } from './a521723d.js';
6
- import { u as uid } from './fc608bd9.js';
7
- import { m as mergeRefs } from './853713cd.js';
8
- import { I as IconButton } from './377b2f44.js';
9
- import get from 'lodash/get';
10
- import { I as InputHelper } from './b0eb3a30.js';
11
- import { I as InputLabel } from './12ab39e4.js';
12
-
13
- /**
14
- * Defines the props of the component.
15
- */
16
-
17
- /**
18
- * Component display name.
19
- */
20
- var COMPONENT_NAME = 'TextField';
21
- /**
22
- * Component default class name and class prefix.
23
- */
24
-
25
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
26
- /**
27
- * Default minimum number of rows in the multiline mode.
28
- */
29
-
30
- var DEFAULT_MIN_ROWS = 2;
31
- /**
32
- * Component default props.
33
- */
34
-
35
- var DEFAULT_PROPS = {
36
- theme: Theme.light,
37
- type: 'text'
38
- };
39
- /**
40
- * Hook that allows to calculate the number of rows needed for a text area.
41
- * @param minimumRows Minimum number of rows that we want to display.
42
- * @return rows to be used and a callback to recalculate
43
- */
44
-
45
- var useComputeNumberOfRows = function useComputeNumberOfRows(minimumRows) {
46
- var _useState = useState(minimumRows),
47
- _useState2 = _slicedToArray(_useState, 2),
48
- rows = _useState2[0],
49
- setRows = _useState2[1];
50
-
51
- var recompute = function recompute(target) {
52
- /**
53
- * HEAD's UP! This part is a little bit tricky. The idea here is to only
54
- * display the necessary rows on the textarea. In order to dynamically adjust
55
- * the height on that field, we need to:
56
- * 1. Set the current amount of rows to the minimum. That will make the scroll appear.
57
- * 2. With that, we will have the `scrollHeight`, meaning the height of the container adjusted to the current content
58
- * 3. With the scroll height, we can figure out how many rows we need to use by dividing the scroll height
59
- * by the line height.
60
- * 4. With that number, we can readjust the number of rows on the text area. We need to do that here, if we leave that to
61
- * the state change through React, there are some scenarios (resize, hitting ENTER or BACKSPACE which add or remove lines)
62
- * when we will not see the update and the rows will be resized to the minimum.
63
- * 5. In case there is any other update on the component that changes the UI, we need to keep the number of rows
64
- * on the state in order to allow React to re-render. Therefore, we save them using `useState`
65
- */
66
- // eslint-disable-next-line no-param-reassign
67
- target.rows = minimumRows;
68
- var currentRows = target.scrollHeight / (target.clientHeight / minimumRows);
69
- currentRows = currentRows >= minimumRows ? currentRows : minimumRows; // eslint-disable-next-line no-param-reassign
70
-
71
- target.rows = currentRows;
72
- setRows(currentRows);
73
- };
74
-
75
- return {
76
- recomputeNumberOfRows: recompute,
77
- rows: rows
78
- };
79
- };
80
-
81
- var renderInputNative = function renderInputNative(props) {
82
- var id = props.id,
83
- isDisabled = props.isDisabled,
84
- isRequired = props.isRequired,
85
- placeholder = props.placeholder,
86
- multiline = props.multiline,
87
- value = props.value,
88
- setFocus = props.setFocus,
89
- onChange = props.onChange,
90
- onFocus = props.onFocus,
91
- onBlur = props.onBlur,
92
- inputRef = props.inputRef,
93
- rows = props.rows,
94
- recomputeNumberOfRows = props.recomputeNumberOfRows,
95
- type = props.type,
96
- name = props.name,
97
- forwardedProps = _objectWithoutProperties(props, ["id", "isDisabled", "isRequired", "placeholder", "multiline", "value", "setFocus", "onChange", "onFocus", "onBlur", "inputRef", "rows", "recomputeNumberOfRows", "type", "name"]); // eslint-disable-next-line react-hooks/rules-of-hooks
98
-
99
-
100
- var ref = useRef(null); // eslint-disable-next-line react-hooks/rules-of-hooks
101
-
102
- useEffect(function () {
103
- // Recompute the number of rows for the first rendering
104
- if (multiline && ref && ref.current) {
105
- recomputeNumberOfRows(ref.current);
106
- }
107
- }, [ref, multiline, recomputeNumberOfRows, value]);
108
-
109
- var onTextFieldFocus = function onTextFieldFocus(event) {
110
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
111
- setFocus(true);
112
- };
113
-
114
- var onTextFieldBlur = function onTextFieldBlur(event) {
115
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
116
- setFocus(false);
117
- };
118
-
119
- var handleChange = function handleChange(event) {
120
- onChange(get(event, 'target.value'), name, event);
121
- };
122
-
123
- var Component = multiline ? 'textarea' : 'input';
124
-
125
- var inputProps = _objectSpread2({}, forwardedProps, {
126
- id: id,
127
- className: multiline ? "".concat(CLASSNAME, "__input-native ").concat(CLASSNAME, "__input-native--textarea") : "".concat(CLASSNAME, "__input-native ").concat(CLASSNAME, "__input-native--text"),
128
- placeholder: placeholder,
129
- value: value,
130
- name: name,
131
- disabled: isDisabled,
132
- required: isRequired,
133
- onFocus: onTextFieldFocus,
134
- onBlur: onTextFieldBlur,
135
- onChange: handleChange,
136
- ref: mergeRefs(inputRef, ref)
137
- });
138
-
139
- if (multiline) {
140
- inputProps.rows = rows;
141
- } else {
142
- inputProps.type = type;
143
- }
144
-
145
- return React.createElement(Component, inputProps);
146
- };
147
- /**
148
- * TextField component.
149
- *
150
- * @param props Component props.
151
- * @param ref Component ref.
152
- * @return React element.
153
- */
154
-
155
-
156
- var TextField = forwardRef(function (props, ref) {
157
- var chips = props.chips,
158
- className = props.className,
159
- clearButtonProps = props.clearButtonProps,
160
- disabled = props.disabled,
161
- error = props.error,
162
- forceFocusStyle = props.forceFocusStyle,
163
- hasError = props.hasError,
164
- helper = props.helper,
165
- icon = props.icon,
166
- id = props.id,
167
- inputRef = props.inputRef,
168
- _props$isDisabled = props.isDisabled,
169
- isDisabled = _props$isDisabled === void 0 ? disabled : _props$isDisabled,
170
- isRequired = props.isRequired,
171
- isValid = props.isValid,
172
- label = props.label,
173
- maxLength = props.maxLength,
174
- minimumRows = props.minimumRows,
175
- multiline = props.multiline,
176
- name = props.name,
177
- onBlur = props.onBlur,
178
- onChange = props.onChange,
179
- onFocus = props.onFocus,
180
- placeholder = props.placeholder,
181
- textFieldRef = props.textFieldRef,
182
- theme = props.theme,
183
- type = props.type,
184
- value = props.value,
185
- afterElement = props.afterElement,
186
- forwardedProps = _objectWithoutProperties(props, ["chips", "className", "clearButtonProps", "disabled", "error", "forceFocusStyle", "hasError", "helper", "icon", "id", "inputRef", "isDisabled", "isRequired", "isValid", "label", "maxLength", "minimumRows", "multiline", "name", "onBlur", "onChange", "onFocus", "placeholder", "textFieldRef", "theme", "type", "value", "afterElement"]);
187
-
188
- var textFieldId = useMemo(function () {
189
- return id || "text-field-".concat(uid());
190
- }, [id]);
191
-
192
- var _useState3 = useState(false),
193
- _useState4 = _slicedToArray(_useState3, 2),
194
- isFocus = _useState4[0],
195
- setFocus = _useState4[1];
196
-
197
- var _useComputeNumberOfRo = useComputeNumberOfRows(multiline ? minimumRows || DEFAULT_MIN_ROWS : 0),
198
- rows = _useComputeNumberOfRo.rows,
199
- recomputeNumberOfRows = _useComputeNumberOfRo.recomputeNumberOfRows;
200
-
201
- var valueLength = (value || '').length;
202
- var isNotEmpty = valueLength > 0;
203
- /**
204
- * Function triggered when the Clear Button is clicked.
205
- * The idea is to execute the `onChange` callback with an empty string
206
- * and remove focus from the clear button.
207
- * @param evt On clear event.
208
- */
209
-
210
- var onClear = function onClear(evt) {
211
- evt.nativeEvent.preventDefault();
212
- evt.nativeEvent.stopPropagation();
213
- evt.currentTarget.blur();
214
- onChange('');
215
- };
216
-
217
- return React.createElement("div", {
218
- ref: ref,
219
- className: classnames(className, handleBasicClasses({
220
- hasChips: Boolean(chips),
221
- hasError: !isValid && hasError,
222
- hasIcon: Boolean(icon),
223
- hasInput: !multiline,
224
- hasInputClear: clearButtonProps && isNotEmpty,
225
- hasLabel: Boolean(label),
226
- hasPlaceholder: Boolean(placeholder),
227
- hasTextarea: multiline,
228
- hasValue: Boolean(value),
229
- isDisabled: isDisabled,
230
- isFocus: isFocus || forceFocusStyle,
231
- isValid: isValid,
232
- prefix: CLASSNAME,
233
- theme: theme
234
- }))
235
- }, (label || maxLength) && React.createElement("div", {
236
- className: "".concat(CLASSNAME, "__header")
237
- }, label && React.createElement(InputLabel, {
238
- htmlFor: textFieldId,
239
- className: "".concat(CLASSNAME, "__label"),
240
- isRequired: isRequired,
241
- theme: theme
242
- }, label), maxLength && React.createElement("div", {
243
- className: "".concat(CLASSNAME, "__char-counter")
244
- }, React.createElement("span", null, maxLength - valueLength), maxLength - valueLength === 0 && React.createElement(Icon, {
245
- icon: mdiAlertCircle,
246
- size: Size.xxs
247
- }))), React.createElement("div", {
248
- className: "".concat(CLASSNAME, "__wrapper"),
249
- ref: textFieldRef
250
- }, icon && React.createElement(Icon, {
251
- className: "".concat(CLASSNAME, "__input-icon"),
252
- color: theme === Theme.dark ? 'light' : undefined,
253
- icon: icon,
254
- size: Size.xs
255
- }), chips && React.createElement("div", {
256
- className: "".concat(CLASSNAME, "__chips")
257
- }, chips, renderInputNative(_objectSpread2({
258
- id: textFieldId,
259
- inputRef: inputRef,
260
- isDisabled: isDisabled,
261
- isRequired: isRequired,
262
- maxLength: maxLength,
263
- multiline: multiline,
264
- onBlur: onBlur,
265
- onChange: onChange,
266
- onFocus: onFocus,
267
- placeholder: placeholder,
268
- recomputeNumberOfRows: recomputeNumberOfRows,
269
- rows: rows,
270
- setFocus: setFocus,
271
- type: type,
272
- value: value,
273
- name: name
274
- }, forwardedProps))), !chips && React.createElement("div", {
275
- className: "".concat(CLASSNAME, "__input-wrapper")
276
- }, renderInputNative(_objectSpread2({
277
- id: textFieldId,
278
- inputRef: inputRef,
279
- isDisabled: isDisabled,
280
- isRequired: isRequired,
281
- maxLength: maxLength,
282
- multiline: multiline,
283
- onBlur: onBlur,
284
- onChange: onChange,
285
- onFocus: onFocus,
286
- placeholder: placeholder,
287
- recomputeNumberOfRows: recomputeNumberOfRows,
288
- rows: rows,
289
- setFocus: setFocus,
290
- type: type,
291
- value: value,
292
- name: name
293
- }, forwardedProps))), (isValid || hasError) && React.createElement(Icon, {
294
- className: "".concat(CLASSNAME, "__input-validity"),
295
- color: theme === Theme.dark ? 'light' : undefined,
296
- icon: isValid ? mdiCheckCircle : mdiAlertCircle,
297
- size: Size.xxs
298
- }), clearButtonProps && isNotEmpty && React.createElement(IconButton, _extends({}, clearButtonProps, {
299
- className: "".concat(CLASSNAME, "__input-clear"),
300
- icon: mdiCloseCircle,
301
- emphasis: Emphasis.low,
302
- size: Size.s,
303
- theme: theme,
304
- onClick: onClear,
305
- type: "button"
306
- })), afterElement && React.createElement("div", {
307
- className: "".concat(CLASSNAME, "__after-element")
308
- }, afterElement)), hasError && error && React.createElement(InputHelper, {
309
- className: "".concat(CLASSNAME, "__helper"),
310
- kind: Kind.error,
311
- theme: theme
312
- }, error), helper && React.createElement(InputHelper, {
313
- className: "".concat(CLASSNAME, "__helper"),
314
- theme: theme
315
- }, helper));
316
- });
317
- TextField.displayName = COMPONENT_NAME;
318
- TextField.className = CLASSNAME;
319
- TextField.defaultProps = DEFAULT_PROPS;
320
-
321
- export { TextField as T };
322
- //# sourceMappingURL=490ec1da.js.map