@lumx/react 3.0.2-alpha-react-utils.1 → 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 (358) 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 -95
  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 -4
  10. package/utils/index.js.map +1 -1
  11. package/_internal/0062d1bc.js +0 -220
  12. package/_internal/0062d1bc.js.map +0 -1
  13. package/_internal/03e8323d.d.ts +0 -118
  14. package/_internal/0402f9bc.d.ts +0 -183
  15. package/_internal/0b370acc.js +0 -796
  16. package/_internal/0b370acc.js.map +0 -1
  17. package/_internal/0d154d73.d.ts +0 -67
  18. package/_internal/113e3b40.d.ts +0 -31
  19. package/_internal/12ab39e4.js +0 -58
  20. package/_internal/12ab39e4.js.map +0 -1
  21. package/_internal/13e759f3.js +0 -343
  22. package/_internal/13e759f3.js.map +0 -1
  23. package/_internal/158b46d5.js +0 -151
  24. package/_internal/158b46d5.js.map +0 -1
  25. package/_internal/17b74e16.d.ts +0 -31
  26. package/_internal/1b1530a4.d.ts +0 -43
  27. package/_internal/20976405.js +0 -87
  28. package/_internal/20976405.js.map +0 -1
  29. package/_internal/20b0e9a5.d.ts +0 -77
  30. package/_internal/26cd9c63.js +0 -118
  31. package/_internal/26cd9c63.js.map +0 -1
  32. package/_internal/27f21164.js +0 -79
  33. package/_internal/27f21164.js.map +0 -1
  34. package/_internal/288dfd0f.js +0 -13
  35. package/_internal/288dfd0f.js.map +0 -1
  36. package/_internal/28aaf23a.d.ts +0 -41
  37. package/_internal/2c829c0b.d.ts +0 -57
  38. package/_internal/2cc0aec5.js +0 -86
  39. package/_internal/2cc0aec5.js.map +0 -1
  40. package/_internal/2d0a5b28.js +0 -23
  41. package/_internal/2d0a5b28.js.map +0 -1
  42. package/_internal/2d4b5a5e.d.ts +0 -92
  43. package/_internal/2d770113.d.ts +0 -38
  44. package/_internal/2fe97f00.js +0 -291
  45. package/_internal/2fe97f00.js.map +0 -1
  46. package/_internal/31c16fa0.d.ts +0 -37
  47. package/_internal/329a01d3.js +0 -25
  48. package/_internal/329a01d3.js.map +0 -1
  49. package/_internal/3326e990.js +0 -168
  50. package/_internal/3326e990.js.map +0 -1
  51. package/_internal/377b2f44.js +0 -70
  52. package/_internal/377b2f44.js.map +0 -1
  53. package/_internal/3b8d2a6e.js +0 -124
  54. package/_internal/3b8d2a6e.js.map +0 -1
  55. package/_internal/3bd3186e.d.ts +0 -57
  56. package/_internal/48e40868.js +0 -101
  57. package/_internal/48e40868.js.map +0 -1
  58. package/_internal/490ec1da.js +0 -322
  59. package/_internal/490ec1da.js.map +0 -1
  60. package/_internal/49127d69.d.ts +0 -52
  61. package/_internal/4dcd87cb.js +0 -78
  62. package/_internal/4dcd87cb.js.map +0 -1
  63. package/_internal/4f44d848.js +0 -157
  64. package/_internal/4f44d848.js.map +0 -1
  65. package/_internal/4fc64a2e.js +0 -27
  66. package/_internal/4fc64a2e.js.map +0 -1
  67. package/_internal/53a831be.js +0 -108
  68. package/_internal/53a831be.js.map +0 -1
  69. package/_internal/55271fa1.d.ts +0 -34
  70. package/_internal/55d30377.d.ts +0 -22
  71. package/_internal/56385b04.js +0 -116
  72. package/_internal/56385b04.js.map +0 -1
  73. package/_internal/599e250a.d.ts +0 -88
  74. package/_internal/5a054691.d.ts +0 -33
  75. package/_internal/5a127b58.js +0 -82
  76. package/_internal/5a127b58.js.map +0 -1
  77. package/_internal/5a1c0db4.js +0 -156
  78. package/_internal/5a1c0db4.js.map +0 -1
  79. package/_internal/5babcc39.js +0 -147
  80. package/_internal/5babcc39.js.map +0 -1
  81. package/_internal/5c1bf4d4.d.ts +0 -81
  82. package/_internal/5d8ed4ee.js +0 -113
  83. package/_internal/5d8ed4ee.js.map +0 -1
  84. package/_internal/616f2912.js +0 -301
  85. package/_internal/616f2912.js.map +0 -1
  86. package/_internal/61f915de.d.ts +0 -49
  87. package/_internal/620081fa.js +0 -122
  88. package/_internal/620081fa.js.map +0 -1
  89. package/_internal/6340c129.js.map +0 -1
  90. package/_internal/6581c863.d.ts +0 -34
  91. package/_internal/66de4d45.d.ts +0 -32
  92. package/_internal/6735c5c8.d.ts +0 -62
  93. package/_internal/69dd1472.js +0 -112
  94. package/_internal/69dd1472.js.map +0 -1
  95. package/_internal/6a0e1c77.js +0 -327
  96. package/_internal/6a0e1c77.js.map +0 -1
  97. package/_internal/701c20b0.d.ts +0 -24
  98. package/_internal/7391188a.js +0 -81
  99. package/_internal/7391188a.js.map +0 -1
  100. package/_internal/74cb6c26.js +0 -136
  101. package/_internal/74cb6c26.js.map +0 -1
  102. package/_internal/761031bf.js +0 -314
  103. package/_internal/761031bf.js.map +0 -1
  104. package/_internal/76fed69d.js +0 -50
  105. package/_internal/76fed69d.js.map +0 -1
  106. package/_internal/78ef8e34.js +0 -40
  107. package/_internal/78ef8e34.js.map +0 -1
  108. package/_internal/7b906e16.d.ts +0 -17
  109. package/_internal/7be11ddc.d.ts +0 -35
  110. package/_internal/7d39705e.d.ts +0 -20
  111. package/_internal/7e03266f.js +0 -47
  112. package/_internal/7e03266f.js.map +0 -1
  113. package/_internal/7e8d0ac5.js +0 -84
  114. package/_internal/7e8d0ac5.js.map +0 -1
  115. package/_internal/7ffa45f6.js +0 -48
  116. package/_internal/7ffa45f6.js.map +0 -1
  117. package/_internal/84c1ec44.js +0 -257
  118. package/_internal/84c1ec44.js.map +0 -1
  119. package/_internal/8518279f.js +0 -96
  120. package/_internal/8518279f.js.map +0 -1
  121. package/_internal/853713cd.js +0 -25
  122. package/_internal/853713cd.js.map +0 -1
  123. package/_internal/86566d75.d.ts +0 -27
  124. package/_internal/86d22dde.d.ts +0 -57
  125. package/_internal/8e755ded.d.ts +0 -101
  126. package/_internal/901471f5.d.ts +0 -37
  127. package/_internal/935ce959.d.ts +0 -49
  128. package/_internal/97089888.d.ts +0 -16
  129. package/_internal/97cc728c.d.ts +0 -26
  130. package/_internal/9ab3c637.js +0 -2474
  131. package/_internal/9ab3c637.js.map +0 -1
  132. package/_internal/9ca3f59c.js +0 -60
  133. package/_internal/9ca3f59c.js.map +0 -1
  134. package/_internal/9e95ea38.d.ts +0 -43
  135. package/_internal/a0108f92.js +0 -84
  136. package/_internal/a0108f92.js.map +0 -1
  137. package/_internal/a493a193.d.ts +0 -65
  138. package/_internal/a521723d.js +0 -120
  139. package/_internal/a521723d.js.map +0 -1
  140. package/_internal/a6fad025.d.ts +0 -107
  141. package/_internal/a8fa525f.js +0 -124
  142. package/_internal/a8fa525f.js.map +0 -1
  143. package/_internal/aca2ecf5.js +0 -141
  144. package/_internal/aca2ecf5.js.map +0 -1
  145. package/_internal/aef2ef1c.js +0 -53
  146. package/_internal/aef2ef1c.js.map +0 -1
  147. package/_internal/af048b0c.js +0 -89
  148. package/_internal/af048b0c.js.map +0 -1
  149. package/_internal/af2cd0cd.d.ts +0 -17
  150. package/_internal/afec6b62.js +0 -864
  151. package/_internal/afec6b62.js.map +0 -1
  152. package/_internal/b0eb3a30.js +0 -72
  153. package/_internal/b0eb3a30.js.map +0 -1
  154. package/_internal/b89517ea.js +0 -275
  155. package/_internal/b89517ea.js.map +0 -1
  156. package/_internal/bafa6fcc.js +0 -116
  157. package/_internal/bafa6fcc.js.map +0 -1
  158. package/_internal/bbbeb49e.js +0 -47
  159. package/_internal/bbbeb49e.js.map +0 -1
  160. package/_internal/c11f6162.d.ts +0 -52
  161. package/_internal/c723dab4.js +0 -133
  162. package/_internal/c723dab4.js.map +0 -1
  163. package/_internal/c87cc857.d.ts +0 -42
  164. package/_internal/c97f8d04.js +0 -424
  165. package/_internal/c97f8d04.js.map +0 -1
  166. package/_internal/cbb373ea.d.ts +0 -6
  167. package/_internal/cbef23b6.d.ts +0 -104
  168. package/_internal/cdf77f06.d.ts +0 -88
  169. package/_internal/d350f2ff.js +0 -105
  170. package/_internal/d350f2ff.js.map +0 -1
  171. package/_internal/d71a8cf7.js +0 -54
  172. package/_internal/d71a8cf7.js.map +0 -1
  173. package/_internal/d9337952.js +0 -96
  174. package/_internal/d9337952.js.map +0 -1
  175. package/_internal/def14e1a.d.ts +0 -24
  176. package/_internal/e0cd29c7.d.ts +0 -35
  177. package/_internal/e354228f.js +0 -145
  178. package/_internal/e354228f.js.map +0 -1
  179. package/_internal/e3922a05.d.ts +0 -22
  180. package/_internal/e3cb6177.d.ts +0 -75
  181. package/_internal/e810c841.d.ts +0 -182
  182. package/_internal/ea700b01.d.ts +0 -43
  183. package/_internal/eed07003.js +0 -122
  184. package/_internal/eed07003.js.map +0 -1
  185. package/_internal/f1c9b334.d.ts +0 -22
  186. package/_internal/f3c3a674.js +0 -281
  187. package/_internal/f3c3a674.js.map +0 -1
  188. package/_internal/f571cdcd.js +0 -132
  189. package/_internal/f571cdcd.js.map +0 -1
  190. package/_internal/f5bdff7e.js +0 -282
  191. package/_internal/f5bdff7e.js.map +0 -1
  192. package/_internal/f851fc00.d.ts +0 -34
  193. package/_internal/f859b007.d.ts +0 -49
  194. package/_internal/fb384b79.d.ts +0 -38
  195. package/_internal/fc4c034b.js +0 -63
  196. package/_internal/fc4c034b.js.map +0 -1
  197. package/_internal/fc608bd9.js +0 -16
  198. package/_internal/fc608bd9.js.map +0 -1
  199. package/_internal/fd1f4d68.d.ts +0 -36
  200. package/_internal/fd867c9d.js +0 -346
  201. package/_internal/fd867c9d.js.map +0 -1
  202. package/_internal/ff8081e5.js +0 -57
  203. package/_internal/ff8081e5.js.map +0 -1
  204. package/_internal/ffd1bfe3.js +0 -123
  205. package/_internal/ffd1bfe3.js.map +0 -1
  206. package/components/alert-dialog.d.ts +0 -6
  207. package/components/alert-dialog.js +0 -35
  208. package/components/alert-dialog.js.map +0 -1
  209. package/components/autocomplete.d.ts +0 -8
  210. package/components/autocomplete.js +0 -33
  211. package/components/autocomplete.js.map +0 -1
  212. package/components/avatar.d.ts +0 -4
  213. package/components/avatar.js +0 -13
  214. package/components/avatar.js.map +0 -1
  215. package/components/badge.d.ts +0 -3
  216. package/components/badge.js +0 -10
  217. package/components/badge.js.map +0 -1
  218. package/components/button.d.ts +0 -8
  219. package/components/button.js +0 -26
  220. package/components/button.js.map +0 -1
  221. package/components/checkbox.d.ts +0 -3
  222. package/components/checkbox.js +0 -14
  223. package/components/checkbox.js.map +0 -1
  224. package/components/chip.d.ts +0 -3
  225. package/components/chip.js +0 -12
  226. package/components/chip.js.map +0 -1
  227. package/components/comment-block.d.ts +0 -5
  228. package/components/comment-block.js +0 -25
  229. package/components/comment-block.js.map +0 -1
  230. package/components/date-picker.d.ts +0 -7
  231. package/components/date-picker.js +0 -33
  232. package/components/date-picker.js.map +0 -1
  233. package/components/dialog.d.ts +0 -3
  234. package/components/dialog.js +0 -28
  235. package/components/dialog.js.map +0 -1
  236. package/components/divider.d.ts +0 -3
  237. package/components/divider.js +0 -10
  238. package/components/divider.js.map +0 -1
  239. package/components/drag-handle.d.ts +0 -3
  240. package/components/drag-handle.js +0 -11
  241. package/components/drag-handle.js.map +0 -1
  242. package/components/dropdown.d.ts +0 -4
  243. package/components/dropdown.js +0 -22
  244. package/components/dropdown.js.map +0 -1
  245. package/components/expansion-panel.d.ts +0 -7
  246. package/components/expansion-panel.js +0 -33
  247. package/components/expansion-panel.js.map +0 -1
  248. package/components/flag.d.ts +0 -3
  249. package/components/flag.js +0 -11
  250. package/components/flag.js.map +0 -1
  251. package/components/flex-box.d.ts +0 -3
  252. package/components/flex-box.js +0 -11
  253. package/components/flex-box.js.map +0 -1
  254. package/components/generic-block.d.ts +0 -4
  255. package/components/generic-block.js +0 -20
  256. package/components/generic-block.js.map +0 -1
  257. package/components/grid.d.ts +0 -3
  258. package/components/grid.js +0 -10
  259. package/components/grid.js.map +0 -1
  260. package/components/heading.d.ts +0 -4
  261. package/components/heading.js +0 -11
  262. package/components/heading.js.map +0 -1
  263. package/components/icon.d.ts +0 -3
  264. package/components/icon.js +0 -10
  265. package/components/icon.js.map +0 -1
  266. package/components/image-block.d.ts +0 -4
  267. package/components/image-block.js +0 -14
  268. package/components/image-block.js.map +0 -1
  269. package/components/input-helper.d.ts +0 -3
  270. package/components/input-helper.js +0 -10
  271. package/components/input-helper.js.map +0 -1
  272. package/components/input-label.d.ts +0 -3
  273. package/components/input-label.js +0 -10
  274. package/components/input-label.js.map +0 -1
  275. package/components/lightbox.d.ts +0 -7
  276. package/components/lightbox.js +0 -28
  277. package/components/lightbox.js.map +0 -1
  278. package/components/link-preview.d.ts +0 -5
  279. package/components/link-preview.js +0 -15
  280. package/components/link-preview.js.map +0 -1
  281. package/components/link.d.ts +0 -3
  282. package/components/link.js +0 -12
  283. package/components/link.js.map +0 -1
  284. package/components/list.d.ts +0 -3
  285. package/components/list.js +0 -15
  286. package/components/list.js.map +0 -1
  287. package/components/message.d.ts +0 -3
  288. package/components/message.js +0 -11
  289. package/components/message.js.map +0 -1
  290. package/components/mosaic.d.ts +0 -4
  291. package/components/mosaic.js +0 -14
  292. package/components/mosaic.js.map +0 -1
  293. package/components/notification.d.ts +0 -3
  294. package/components/notification.js +0 -18
  295. package/components/notification.js.map +0 -1
  296. package/components/popover.d.ts +0 -3
  297. package/components/popover.js +0 -16
  298. package/components/popover.js.map +0 -1
  299. package/components/post-block.d.ts +0 -4
  300. package/components/post-block.js +0 -15
  301. package/components/post-block.js.map +0 -1
  302. package/components/progress-tracker.d.ts +0 -3
  303. package/components/progress-tracker.js +0 -17
  304. package/components/progress-tracker.js.map +0 -1
  305. package/components/progress.d.ts +0 -3
  306. package/components/progress.js +0 -10
  307. package/components/progress.js.map +0 -1
  308. package/components/radio-button.d.ts +0 -3
  309. package/components/radio-button.js +0 -13
  310. package/components/radio-button.js.map +0 -1
  311. package/components/select.d.ts +0 -7
  312. package/components/select.js +0 -32
  313. package/components/select.js.map +0 -1
  314. package/components/side-navigation.d.ts +0 -7
  315. package/components/side-navigation.js +0 -26
  316. package/components/side-navigation.js.map +0 -1
  317. package/components/skeleton.d.ts +0 -3
  318. package/components/skeleton.js +0 -10
  319. package/components/skeleton.js.map +0 -1
  320. package/components/slider.d.ts +0 -3
  321. package/components/slider.js +0 -13
  322. package/components/slider.js.map +0 -1
  323. package/components/slideshow.d.ts +0 -7
  324. package/components/slideshow.js +0 -30
  325. package/components/slideshow.js.map +0 -1
  326. package/components/switch.d.ts +0 -3
  327. package/components/switch.js +0 -13
  328. package/components/switch.js.map +0 -1
  329. package/components/table.d.ts +0 -3
  330. package/components/table.js +0 -12
  331. package/components/table.js.map +0 -1
  332. package/components/tabs.d.ts +0 -4
  333. package/components/tabs.js +0 -15
  334. package/components/tabs.js.map +0 -1
  335. package/components/text-field.d.ts +0 -7
  336. package/components/text-field.js +0 -27
  337. package/components/text-field.js.map +0 -1
  338. package/components/text.d.ts +0 -3
  339. package/components/text.js +0 -10
  340. package/components/text.js.map +0 -1
  341. package/components/thumbnail.d.ts +0 -4
  342. package/components/thumbnail.js +0 -13
  343. package/components/thumbnail.js.map +0 -1
  344. package/components/toolbar.d.ts +0 -3
  345. package/components/toolbar.js +0 -9
  346. package/components/toolbar.js.map +0 -1
  347. package/components/tooltip.d.ts +0 -4
  348. package/components/tooltip.js +0 -19
  349. package/components/tooltip.js.map +0 -1
  350. package/components/uploader.d.ts +0 -3
  351. package/components/uploader.js +0 -11
  352. package/components/uploader.js.map +0 -1
  353. package/components/user-block.d.ts +0 -5
  354. package/components/user-block.js +0 -17
  355. package/components/user-block.js.map +0 -1
  356. package/components.d.ts +0 -2
  357. package/components.js +0 -156
  358. package/components.js.map +0 -1
@@ -1,346 +0,0 @@
1
- import { b as _objectWithoutProperties, d as _slicedToArray } from './6340c129.js';
2
- import kebabCase from 'lodash/kebabCase';
3
- import isBoolean from 'lodash/isBoolean';
4
- import isEmpty from 'lodash/isEmpty';
5
- import noop from 'lodash/noop';
6
-
7
- function createCommonjsModule(fn, basedir, module) {
8
- return module = {
9
- path: basedir,
10
- exports: {},
11
- require: function (path, base) {
12
- return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
13
- }
14
- }, fn(module, module.exports), module.exports;
15
- }
16
-
17
- function commonjsRequire () {
18
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
19
- }
20
-
21
- var classnames = createCommonjsModule(function (module) {
22
- /*!
23
- Copyright (c) 2017 Jed Watson.
24
- Licensed under the MIT License (MIT), see
25
- http://jedwatson.github.io/classnames
26
- */
27
- /* global define */
28
-
29
- (function () {
30
-
31
- var hasOwn = {}.hasOwnProperty;
32
-
33
- function classNames () {
34
- var classes = [];
35
-
36
- for (var i = 0; i < arguments.length; i++) {
37
- var arg = arguments[i];
38
- if (!arg) continue;
39
-
40
- var argType = typeof arg;
41
-
42
- if (argType === 'string' || argType === 'number') {
43
- classes.push(arg);
44
- } else if (Array.isArray(arg) && arg.length) {
45
- var inner = classNames.apply(null, arg);
46
- if (inner) {
47
- classes.push(inner);
48
- }
49
- } else if (argType === 'object') {
50
- for (var key in arg) {
51
- if (hasOwn.call(arg, key) && arg[key]) {
52
- classes.push(key);
53
- }
54
- }
55
- }
56
- }
57
-
58
- return classes.join(' ');
59
- }
60
-
61
- if ( module.exports) {
62
- classNames.default = classNames;
63
- module.exports = classNames;
64
- } else {
65
- window.classNames = classNames;
66
- }
67
- }());
68
- });
69
-
70
- /**
71
- * The prefix to use for the CSS classes.
72
- */
73
- var CSS_PREFIX = 'lumx';
74
- /**
75
- * Animation duration constants. Take into consideration that if you change one of these variables,
76
- * you need to update their scss counterpart as well
77
- */
78
-
79
- var DIALOG_TRANSITION_DURATION = 400;
80
- var NOTIFICATION_TRANSITION_DURATION = 200;
81
- /**
82
- * Delay on hover after which we open or close the tooltip.
83
- * Only applies to devices supporting pointer hover.
84
- */
85
-
86
- var TOOLTIP_HOVER_DELAY = {
87
- open: 500,
88
- close: 0
89
- };
90
- /**
91
- * Delay on long press after which we open or close the tooltip.
92
- * Only applies to devices not supporting pointer hover.
93
- */
94
-
95
- var TOOLTIP_LONG_PRESS_DELAY = {
96
- open: 250,
97
- close: 3000
98
- };
99
-
100
- /**
101
- * Enhance isEmpty method to also works with numbers.
102
- *
103
- * @param value The value to check.
104
- * @return Whether the input value is empty or != 0.
105
- */
106
-
107
- var _isEmpty = function _isEmpty(value) {
108
- if (typeof value === 'number') {
109
- return value === 0;
110
- }
111
-
112
- return isEmpty(value);
113
- };
114
- /**
115
- * Get the basic CSS class for the given type.
116
- *
117
- * @param prefix The class name prefix for the generated CSS class.
118
- * @param type The type of CSS class we want to generate (e.g.: 'color', 'variant', ...).
119
- * @param value The value of the type of the CSS class (e.g.: 'primary', 'button', ...).
120
- * @return The basic CSS class.
121
- */
122
-
123
-
124
- function getBasicClass(_ref) {
125
- var prefix = _ref.prefix,
126
- type = _ref.type,
127
- value = _ref.value;
128
-
129
- if (isBoolean(value)) {
130
- if (!value) {
131
- // False value should not return a class.
132
- return '';
133
- }
134
-
135
- var booleanPrefixes = ['has', 'is'];
136
-
137
- if (booleanPrefixes.some(function (booleanPrefix) {
138
- return type.toString().startsWith(booleanPrefix);
139
- })) {
140
- return "".concat(prefix, "--").concat(kebabCase(type));
141
- }
142
-
143
- return "".concat(prefix, "--is-").concat(kebabCase(type));
144
- }
145
-
146
- return "".concat(prefix, "--").concat(kebabCase(type), "-").concat(value);
147
- }
148
- /**
149
- * Return all basic LumX CSS classes which are available for every components.
150
- *
151
- * @see {@link /src/components/index.d.ts} for the possible values of each parameter.
152
- *
153
- * @param prefix The class name prefix for the generated CSS class.
154
- * @param props All the other props you want to generate a class.
155
- * The rule of thumb: the key is the name of the prop in the class, the value a string that will
156
- * be used in the classname to represent the value of the given prop.
157
- * @return All LumX basic CSS classes.
158
- */
159
-
160
- function handleBasicClasses(_ref2) {
161
- var prefix = _ref2.prefix,
162
- props = _objectWithoutProperties(_ref2, ["prefix"]);
163
-
164
- var otherClasses = {};
165
-
166
- if (!isEmpty(props)) {
167
- Object.keys(props).forEach(function (prop) {
168
- otherClasses[getBasicClass({
169
- prefix: prefix,
170
- type: prop,
171
- value: props[prop]
172
- })] = isBoolean(props[prop]) ? props[prop] : !_isEmpty(props[prop]);
173
- });
174
- }
175
-
176
- return classnames(prefix, otherClasses);
177
- }
178
- /**
179
- * Checks whether or not the browser support passive events.
180
- * @see https://github.com/Modernizr/Modernizr/blob/6d56d814b9682843313b16060adb25a58d83a317/feature-detects/dom/passiveeventlisteners.js
181
- */
182
-
183
- function isPassiveEventAvailable() {
184
- var supportsPassiveOption = false;
185
-
186
- try {
187
- var opts = Object.defineProperty({}, 'passive', {
188
- get: function get() {
189
- supportsPassiveOption = true;
190
- }
191
- });
192
- window.addEventListener('testPassiveEventSupport', noop, opts);
193
- window.removeEventListener('testPassiveEventSupport', noop, opts);
194
- } catch (e) {// ignored
195
- }
196
-
197
- return supportsPassiveOption;
198
- }
199
- /**
200
- * Detects horizontal swipe direction without blocking the browser scroll using passive event.
201
- * @see http://javascriptkit.com/javatutors/touchevents2.shtml
202
- * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
203
- */
204
-
205
-
206
- function detectHorizontalSwipe(touchSurface, handleSwipe) {
207
- var startX;
208
- var startY; // Required min distance traveled to be considered swipe.
209
-
210
- var threshold = 150; // Maximum distance allowed at the same time in perpendicular direction.
211
-
212
- var restraint = 150; // Maximum time allowed to travel that distance.
213
-
214
- var allowedTime = 300;
215
- var elapsedTime;
216
- var startTime;
217
- var finished;
218
-
219
- var onTouchStart = function onTouchStart(evt) {
220
- var _Array$from5 = Array.from(evt.changedTouches),
221
- _Array$from6 = _slicedToArray(_Array$from5, 1),
222
- touch = _Array$from6[0];
223
-
224
- startX = touch.pageX;
225
- startY = touch.pageY; // Record time when finger first makes contact with surface.
226
-
227
- startTime = new Date().getTime();
228
- finished = false;
229
- };
230
-
231
- var onTouchMove = function onTouchMove(evt) {
232
- if (finished) {
233
- return;
234
- }
235
-
236
- elapsedTime = new Date().getTime() - startTime;
237
-
238
- if (elapsedTime > allowedTime) {
239
- // Touch swipe too long to be considered.
240
- return;
241
- }
242
-
243
- var _Array$from7 = Array.from(evt.changedTouches),
244
- _Array$from8 = _slicedToArray(_Array$from7, 1),
245
- touch = _Array$from8[0]; // Get horizontal dist traveled by finger while in contact with surface.
246
-
247
-
248
- var distX = touch.pageX - startX; // Get vertical dist traveled by finger while in contact with surface.
249
-
250
- var distY = touch.pageY - startY;
251
-
252
- if (!(Math.abs(distX) >= threshold && Math.abs(distY) <= restraint)) {
253
- // Swipe is not horizontal.
254
- return;
255
- } // Swipe direction.
256
-
257
-
258
- var direction = distX < 0 ? 'left' : 'right';
259
- handleSwipe(direction);
260
- finished = true;
261
- }; // Activate passive event if possible for better scrolling performance.
262
-
263
-
264
- var eventOptions = isPassiveEventAvailable() ? {
265
- passive: true
266
- } : false;
267
- touchSurface.addEventListener('touchstart', onTouchStart, eventOptions);
268
- touchSurface.addEventListener('touchmove', onTouchMove, eventOptions);
269
- return function () {
270
- touchSurface.removeEventListener('touchstart', onTouchStart, eventOptions);
271
- touchSurface.removeEventListener('touchmove', onTouchMove, eventOptions);
272
- };
273
- }
274
-
275
- /**
276
- * Make sure the pressed key is the enter key before calling the callback.
277
- *
278
- * @param handler The handler to call on enter/return press.
279
- * @return The decorated function.
280
- */
281
- function onEnterPressed(handler) {
282
- return function (evt) {
283
- if (evt.key !== 'Enter') {
284
- return;
285
- }
286
-
287
- handler(evt);
288
- };
289
- }
290
- /**
291
- * Make sure the pressed key is the escape key before calling the callback.
292
- *
293
- * @param handler The handler to call on enter/return press.
294
- * @return The decorated function.
295
- */
296
-
297
- function onEscapePressed(handler) {
298
- return function (evt) {
299
- if (evt.key !== 'Escape') {
300
- return;
301
- }
302
-
303
- handler(evt);
304
- };
305
- }
306
- /**
307
- * Handle button key pressed (Enter + Space).
308
- *
309
- * @param handler The handler to call.
310
- * @return The decorated function.
311
- */
312
-
313
- function onButtonPressed(handler) {
314
- return function (evt) {
315
- if (evt.key !== 'Enter' && evt.key !== ' ') {
316
- return;
317
- }
318
-
319
- handler(evt);
320
- };
321
- }
322
-
323
- var LAST_PART_CLASSNAME = /^(.*)-(.+)$/gi;
324
- /**
325
- * Get the name of the root CSS class of a component based on its name.
326
- *
327
- * @param componentName The name of the component. This name should contains the component prefix and be
328
- * written in PascalCase.
329
- * @param subComponent Whether the current component is a sub component, if true, define the class according
330
- * to BEM standards.
331
- * @return The name of the root CSS class. This classname include the CSS classname prefix and is written in
332
- * lower-snake-case.
333
- */
334
-
335
- function getRootClassName(componentName, subComponent) {
336
- var formattedClassName = "".concat(CSS_PREFIX, "-").concat(kebabCase(componentName));
337
-
338
- if (subComponent) {
339
- return formattedClassName.replace(LAST_PART_CLASSNAME, '$1__$2');
340
- }
341
-
342
- return formattedClassName;
343
- }
344
-
345
- export { CSS_PREFIX as C, DIALOG_TRANSITION_DURATION as D, NOTIFICATION_TRANSITION_DURATION as N, TOOLTIP_LONG_PRESS_DELAY as T, getBasicClass as a, onButtonPressed as b, classnames as c, createCommonjsModule as d, detectHorizontalSwipe as e, onEscapePressed as f, getRootClassName as g, handleBasicClasses as h, TOOLTIP_HOVER_DELAY as i, onEnterPressed as o };
346
- //# sourceMappingURL=fd867c9d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fd867c9d.js","sources":["../../../../node_modules/classnames/index.js","../../../lumx-core/src/js/constants/index.ts","../../../lumx-core/src/js/utils.ts","../../src/utils/className.ts"],"sourcesContent":["/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","/**\n * The prefix to use for the CSS classes.\n */\nexport const CSS_PREFIX = 'lumx';\n\n/**\n * Key codes.\n */\nexport * from './keycodes';\n\n/**\n * Animation duration constants. Take into consideration that if you change one of these variables,\n * you need to update their scss counterpart as well\n */\nexport const DIALOG_TRANSITION_DURATION = 400;\nexport const NOTIFICATION_TRANSITION_DURATION = 200;\nexport const SLIDESHOW_TRANSITION_DURATION = 5000;\n\n/**\n * Delay on hover after which we open or close the tooltip.\n * Only applies to devices supporting pointer hover.\n */\nexport const TOOLTIP_HOVER_DELAY = {\n open: 500,\n close: 0,\n};\n\n/**\n * Delay on long press after which we open or close the tooltip.\n * Only applies to devices not supporting pointer hover.\n */\nexport const TOOLTIP_LONG_PRESS_DELAY = {\n open: 250,\n close: 3000,\n};\n","import classNames from 'classnames';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport React from 'react';\n\nimport isBoolean from 'lodash/isBoolean';\nimport isEmpty from 'lodash/isEmpty';\nimport kebabCase from 'lodash/kebabCase';\nimport noop from 'lodash/noop';\n\n/**\n * Enhance isEmpty method to also works with numbers.\n *\n * @param value The value to check.\n * @return Whether the input value is empty or != 0.\n */\nconst _isEmpty = (value: any) => {\n if (typeof value === 'number') {\n return value === 0;\n }\n\n return isEmpty(value);\n};\n\n/**\n * Get the basic CSS class for the given type.\n *\n * @param prefix The class name prefix for the generated CSS class.\n * @param type The type of CSS class we want to generate (e.g.: 'color', 'variant', ...).\n * @param value The value of the type of the CSS class (e.g.: 'primary', 'button', ...).\n * @return The basic CSS class.\n */\nexport function getBasicClass({\n prefix,\n type,\n value,\n}: {\n prefix: string;\n type: string;\n value: string | number | boolean | undefined;\n}): string {\n if (isBoolean(value)) {\n if (!value) {\n // False value should not return a class.\n return '';\n }\n const booleanPrefixes = ['has', 'is'];\n\n if (booleanPrefixes.some((booleanPrefix) => type.toString().startsWith(booleanPrefix))) {\n return `${prefix}--${kebabCase(type)}`;\n }\n\n return `${prefix}--is-${kebabCase(type)}`;\n }\n\n return `${prefix}--${kebabCase(type)}-${value}`;\n}\n\n/**\n * Return all basic LumX CSS classes which are available for every components.\n *\n * @see {@link /src/components/index.d.ts} for the possible values of each parameter.\n *\n * @param prefix The class name prefix for the generated CSS class.\n * @param props All the other props you want to generate a class.\n * The rule of thumb: the key is the name of the prop in the class, the value a string that will\n * be used in the classname to represent the value of the given prop.\n * @return All LumX basic CSS classes.\n */\nexport function handleBasicClasses({ prefix, ...props }: { prefix: string; [prop: string]: any }): string {\n const otherClasses: any = {};\n if (!isEmpty(props)) {\n Object.keys(props).forEach((prop) => {\n otherClasses[getBasicClass({ prefix, type: prop, value: props[prop] })] = isBoolean(props[prop])\n ? props[prop]\n : !_isEmpty(props[prop]);\n });\n }\n\n return classNames(prefix, otherClasses);\n}\n\ndeclare type SwipeDirection = 'none' | 'up' | 'down' | 'left' | 'right';\n\n/**\n * Detects swipe direction.\n * Credits: http://javascriptkit.com/javatutors/touchevents2.shtml.\n *\n * @deprecated use `detectHorizontalSwipe` instead if possible (better performance and does not block scroll)\n * @param touchSurface Element that will hold touch events.\n * @param handleSwipe Callback function.\n * @return Function to remove listeners.\n */\nexport function detectSwipe(touchSurface: Element, handleSwipe: (direction: SwipeDirection) => void = noop) {\n let distX: number;\n let distY: number;\n let startX: number;\n let startY: number;\n let direction: SwipeDirection;\n // Required min distance traveled to be considered swipe.\n const threshold = 150;\n // Maximum distance allowed at the same time in perpendicular direction.\n const restraint = 100;\n // Maximum time allowed to travel that distance.\n const allowedTime = 300;\n let elapsedTime: number;\n let startTime: number;\n\n const onTouchStart = (evt: Event) => {\n const [touch] = Array.from((evt as TouchEvent).changedTouches);\n direction = 'none';\n // Const dist = 0;\n startX = touch.pageX;\n startY = touch.pageY;\n // Record time when finger first makes contact with surface.\n startTime = new Date().getTime();\n evt.preventDefault();\n };\n\n const onTouchMove = (evt: Event) => {\n // Prevent scrolling when inside DIV.\n evt.preventDefault();\n };\n\n const onTouchEnd = (evt: Event) => {\n const [touch] = Array.from((evt as TouchEvent).changedTouches);\n // Get horizontal dist traveled by finger while in contact with surface.\n distX = touch.pageX - startX;\n // Get vertical dist traveled by finger while in contact with surface.\n distY = touch.pageY - startY;\n // Get time elapsed.\n elapsedTime = new Date().getTime() - startTime;\n if (elapsedTime <= allowedTime) {\n // First condition for awipe met.\n if (Math.abs(distX) >= threshold && Math.abs(distY) <= restraint) {\n // 2nd condition for horizontal swipe met.\n // If dist traveled is negative, it indicates left swipe.\n direction = distX < 0 ? 'left' : 'right';\n } else if (Math.abs(distY) >= threshold && Math.abs(distX) <= restraint) {\n // 2nd condition for vertical swipe met.\n // If dist traveled is negative, it indicates up swipe.\n direction = distY < 0 ? 'up' : 'down';\n }\n }\n handleSwipe(direction);\n evt.preventDefault();\n };\n\n touchSurface.addEventListener('touchstart', onTouchStart, false);\n touchSurface.addEventListener('touchmove', onTouchMove, false);\n touchSurface.addEventListener('touchend', onTouchEnd, false);\n\n return () => {\n touchSurface.removeEventListener('touchstart', onTouchStart, false);\n touchSurface.removeEventListener('touchmove', onTouchMove, false);\n touchSurface.removeEventListener('touchend', onTouchEnd, false);\n };\n}\n\n/**\n * Checks whether or not the browser support passive events.\n * @see https://github.com/Modernizr/Modernizr/blob/6d56d814b9682843313b16060adb25a58d83a317/feature-detects/dom/passiveeventlisteners.js\n */\nfunction isPassiveEventAvailable() {\n let supportsPassiveOption = false;\n try {\n const opts = Object.defineProperty({}, 'passive', {\n get() {\n supportsPassiveOption = true;\n },\n });\n window.addEventListener('testPassiveEventSupport', noop, opts);\n window.removeEventListener('testPassiveEventSupport', noop, opts);\n } catch (e) {\n // ignored\n }\n return supportsPassiveOption;\n}\n\n/**\n * Detects horizontal swipe direction without blocking the browser scroll using passive event.\n * @see http://javascriptkit.com/javatutors/touchevents2.shtml\n * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n */\nexport function detectHorizontalSwipe(touchSurface: Element, handleSwipe: (direction: 'right' | 'left') => void) {\n let startX: number;\n let startY: number;\n // Required min distance traveled to be considered swipe.\n const threshold = 150;\n // Maximum distance allowed at the same time in perpendicular direction.\n const restraint = 150;\n // Maximum time allowed to travel that distance.\n const allowedTime = 300;\n let elapsedTime: number;\n let startTime: number;\n let finished: boolean;\n\n const onTouchStart = (evt: Event) => {\n const [touch] = Array.from((evt as TouchEvent).changedTouches);\n startX = touch.pageX;\n startY = touch.pageY;\n // Record time when finger first makes contact with surface.\n startTime = new Date().getTime();\n finished = false;\n };\n\n const onTouchMove = (evt: Event) => {\n if (finished) {\n return;\n }\n\n elapsedTime = new Date().getTime() - startTime;\n if (elapsedTime > allowedTime) {\n // Touch swipe too long to be considered.\n return;\n }\n\n const [touch] = Array.from((evt as TouchEvent).changedTouches);\n // Get horizontal dist traveled by finger while in contact with surface.\n const distX = touch.pageX - startX;\n // Get vertical dist traveled by finger while in contact with surface.\n const distY = touch.pageY - startY;\n\n if (!(Math.abs(distX) >= threshold && Math.abs(distY) <= restraint)) {\n // Swipe is not horizontal.\n return;\n }\n // Swipe direction.\n const direction = distX < 0 ? 'left' : 'right';\n\n handleSwipe(direction);\n finished = true;\n };\n\n // Activate passive event if possible for better scrolling performance.\n const eventOptions: any = isPassiveEventAvailable() ? { passive: true } : false;\n touchSurface.addEventListener('touchstart', onTouchStart, eventOptions);\n touchSurface.addEventListener('touchmove', onTouchMove, eventOptions);\n\n return () => {\n touchSurface.removeEventListener('touchstart', onTouchStart, eventOptions);\n touchSurface.removeEventListener('touchmove', onTouchMove, eventOptions);\n };\n}\n\ntype KeyboardEventHandler<E extends KeyboardEvent | React.KeyboardEvent> = (event: E) => void;\n\n/**\n * Make sure the pressed key is the enter key before calling the callback.\n *\n * @param handler The handler to call on enter/return press.\n * @return The decorated function.\n */\nexport function onEnterPressed<E extends KeyboardEvent | React.KeyboardEvent>(\n handler: KeyboardEventHandler<E>,\n): KeyboardEventHandler<E> {\n return (evt) => {\n if (evt.key !== 'Enter') {\n return;\n }\n handler(evt);\n };\n}\n\n/**\n * Make sure the pressed key is the escape key before calling the callback.\n *\n * @param handler The handler to call on enter/return press.\n * @return The decorated function.\n */\nexport function onEscapePressed<E extends KeyboardEvent | React.KeyboardEvent>(\n handler: KeyboardEventHandler<E>,\n): KeyboardEventHandler<E> {\n return (evt) => {\n if (evt.key !== 'Escape') {\n return;\n }\n handler(evt);\n };\n}\n\n/**\n * Handle button key pressed (Enter + Space).\n *\n * @param handler The handler to call.\n * @return The decorated function.\n */\nexport function onButtonPressed<E extends KeyboardEvent | React.KeyboardEvent>(\n handler: KeyboardEventHandler<E>,\n): KeyboardEventHandler<E> {\n return (evt) => {\n if (evt.key !== 'Enter' && evt.key !== ' ') {\n return;\n }\n handler(evt);\n };\n}\n","import { CSS_PREFIX } from '@lumx/react/constants';\n\nimport kebabCase from 'lodash/kebabCase';\n\n// See https://regex101.com/r/YjS1uI/3\nconst LAST_PART_CLASSNAME = /^(.*)-(.+)$/gi;\n\nexport { getBasicClass, handleBasicClasses } from '@lumx/core/js/utils';\n\n/**\n * Get the name of the root CSS class of a component based on its name.\n *\n * @param componentName The name of the component. This name should contains the component prefix and be\n * written in PascalCase.\n * @param subComponent Whether the current component is a sub component, if true, define the class according\n * to BEM standards.\n * @return The name of the root CSS class. This classname include the CSS classname prefix and is written in\n * lower-snake-case.\n */\nexport function getRootClassName(componentName: string, subComponent?: boolean): string {\n const formattedClassName = `${CSS_PREFIX}-${kebabCase(componentName)}`;\n\n if (subComponent) {\n return formattedClassName.replace(LAST_PART_CLASSNAME, '$1__$2');\n }\n return formattedClassName;\n}\n"],"names":["CSS_PREFIX","DIALOG_TRANSITION_DURATION","NOTIFICATION_TRANSITION_DURATION","TOOLTIP_HOVER_DELAY","open","close","TOOLTIP_LONG_PRESS_DELAY","_isEmpty","value","isEmpty","getBasicClass","prefix","type","isBoolean","booleanPrefixes","some","booleanPrefix","toString","startsWith","kebabCase","handleBasicClasses","props","otherClasses","Object","keys","forEach","prop","classNames","isPassiveEventAvailable","supportsPassiveOption","opts","defineProperty","get","window","addEventListener","noop","removeEventListener","e","detectHorizontalSwipe","touchSurface","handleSwipe","startX","startY","threshold","restraint","allowedTime","elapsedTime","startTime","finished","onTouchStart","evt","Array","from","changedTouches","touch","pageX","pageY","Date","getTime","onTouchMove","distX","distY","Math","abs","direction","eventOptions","passive","onEnterPressed","handler","key","onEscapePressed","onButtonPressed","LAST_PART_CLASSNAME","getRootClassName","componentName","subComponent","formattedClassName","replace"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,YAAY;AAEb;AACA,CAAC,IAAI,MAAM,GAAG,EAAE,CAAC,cAAc,CAAC;AAChC;AACA,CAAC,SAAS,UAAU,IAAI;AACxB,EAAE,IAAI,OAAO,GAAG,EAAE,CAAC;AACnB;AACA,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC7C,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC1B,GAAG,IAAI,CA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BAAkB,CAACC,OAAnB,CAA2BL,mBAA3B,EAAgD,QAAhD,CAAP;AACH;;AACD,SAAOI,kBAAP;AACH;;;;"}
@@ -1,57 +0,0 @@
1
- import { b as _objectWithoutProperties, c as _extends } from './6340c129.js';
2
- import { Orientation } 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 castArray from 'lodash/castArray';
6
-
7
- /**
8
- * Component display name.
9
- */
10
- var COMPONENT_NAME = 'FlexBox';
11
- /**
12
- * Component default class name and class prefix.
13
- */
14
-
15
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
16
- /**
17
- * FlexBox component.
18
- *
19
- * @param props Component props.
20
- * @param ref Component ref.
21
- * @return React element.
22
- */
23
-
24
- var FlexBox = forwardRef(function (props, ref) {
25
- var _props$as = props.as,
26
- Component = _props$as === void 0 ? 'div' : _props$as,
27
- children = props.children,
28
- className = props.className,
29
- fillSpace = props.fillSpace,
30
- gap = props.gap,
31
- hAlign = props.hAlign,
32
- marginAuto = props.marginAuto,
33
- noShrink = props.noShrink,
34
- orientation = props.orientation,
35
- vAlign = props.vAlign,
36
- wrap = props.wrap,
37
- forwardedProps = _objectWithoutProperties(props, ["as", "children", "className", "fillSpace", "gap", "hAlign", "marginAuto", "noShrink", "orientation", "vAlign", "wrap"]);
38
-
39
- return React.createElement(Component, _extends({
40
- ref: ref
41
- }, forwardedProps, {
42
- className: classnames(className, handleBasicClasses({
43
- prefix: CLASSNAME,
44
- orientation: orientation !== null && orientation !== void 0 ? orientation : wrap || hAlign || vAlign ? Orientation.horizontal : null,
45
- vAlign: vAlign,
46
- hAlign: hAlign,
47
- gap: gap
48
- }), wrap && "".concat(CLASSNAME, "--wrap"), fillSpace && "".concat(CLASSNAME, "--fill-space"), noShrink && "".concat(CLASSNAME, "--no-shrink"), marginAuto && castArray(marginAuto).map(function (align) {
49
- return "".concat(CLASSNAME, "--margin-auto-").concat(align);
50
- }))
51
- }), children);
52
- });
53
- FlexBox.displayName = COMPONENT_NAME;
54
- FlexBox.className = CLASSNAME;
55
-
56
- export { FlexBox as F };
57
- //# sourceMappingURL=ff8081e5.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ff8081e5.js","sources":["../../src/components/flex-box/FlexBox.tsx"],"sourcesContent":["import { Alignment, Orientation } from '@lumx/react';\nimport { Comp, GenericProps } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';\nimport classNames from 'classnames';\nimport castArray from 'lodash/castArray';\nimport React, { forwardRef, ReactNode } from 'react';\nimport { HorizontalAlignment, Size, VerticalAlignment } from '..';\n\nexport type MarginAutoAlignment = Extract<Alignment, 'top' | 'bottom' | 'right' | 'left'>;\nexport type GapSize = Extract<Size, 'tiny' | 'regular' | 'medium' | 'big' | 'huge'>;\ntype SpaceAlignment = Extract<Alignment, 'space-between' | 'space-evenly' | 'space-around'>;\nexport type FlexVerticalAlignment = VerticalAlignment | SpaceAlignment;\nexport type FlexHorizontalAlignment = HorizontalAlignment | SpaceAlignment;\n\n/**\n * Defines the props of the component.\n */\nexport interface FlexBoxProps extends GenericProps {\n /** Customize the root element. */\n as?: React.ElementType;\n /** Children elements. */\n children?: ReactNode;\n /** Whether the \"content filling space\" is enabled or not. */\n fillSpace?: boolean;\n /** Gap space between flexbox items. */\n gap?: GapSize;\n /** Flex horizontal alignment. */\n hAlign?: FlexVerticalAlignment;\n /** Whether the \"auto margin\" is enabled all around or not. */\n marginAuto?: MarginAutoAlignment | MarginAutoAlignment[];\n /** Whether the \"content shrink\" is disabled or not. */\n noShrink?: boolean;\n /** Flex direction. */\n orientation?: Orientation;\n /** Flex vertical alignment. */\n vAlign?: FlexHorizontalAlignment;\n /** Whether the \"flex wrap\" is enabled or not. */\n wrap?: boolean;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'FlexBox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * FlexBox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const FlexBox: Comp<FlexBoxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n as: Component = 'div',\n children,\n className,\n fillSpace,\n gap,\n hAlign,\n marginAuto,\n noShrink,\n orientation,\n vAlign,\n wrap,\n ...forwardedProps\n } = props;\n\n return (\n <Component\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n orientation: orientation ?? (wrap || hAlign || vAlign ? Orientation.horizontal : null),\n vAlign,\n hAlign,\n gap,\n }),\n wrap && `${CLASSNAME}--wrap`,\n fillSpace && `${CLASSNAME}--fill-space`,\n noShrink && `${CLASSNAME}--no-shrink`,\n marginAuto && castArray(marginAuto).map((align) => `${CLASSNAME}--margin-auto-${align}`),\n )}\n >\n {children}\n </Component>\n );\n});\nFlexBox.displayName = COMPONENT_NAME;\nFlexBox.className = CLASSNAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","FlexBox","forwardRef","props","ref","as","Component","children","className","fillSpace","gap","hAlign","marginAuto","noShrink","orientation","vAlign","wrap","forwardedProps","classNames","handleBasicClasses","prefix","Orientation","horizontal","castArray","map","align","displayName"],"mappings":";;;;;;AAwCA;;;AAGA,IAAMA,cAAc,GAAG,SAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;;;;;IAOaG,OAA2C,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,kBAc9ED,KAd8E,CAE9EE,EAF8E;AAAA,MAE1EC,SAF0E,0BAE9D,KAF8D;AAAA,MAG9EC,QAH8E,GAc9EJ,KAd8E,CAG9EI,QAH8E;AAAA,MAI9EC,SAJ8E,GAc9EL,KAd8E,CAI9EK,SAJ8E;AAAA,MAK9EC,SAL8E,GAc9EN,KAd8E,CAK9EM,SAL8E;AAAA,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,0 @@
1
- import { b as _objectWithoutProperties, f as _toArray, d as _slicedToArray, c as _extends } from './6340c129.js';
2
- import { Orientation, Size } from '../components.js';
3
- import React, { forwardRef, Children } from 'react';
4
- import { g as getRootClassName, c as classnames } from './fd867c9d.js';
5
- import isEmpty from 'lodash/isEmpty';
6
- import noop from 'lodash/noop';
7
- import { a as isComponentType } from './78ef8e34.js';
8
- import { p as partitionMulti } from './4fc64a2e.js';
9
- import { F as FlexBox } from './ff8081e5.js';
10
-
11
- /**
12
- * Component display name.
13
- */
14
- var COMPONENT_NAME = 'GenericBlock';
15
- /**
16
- * Component default class name and class prefix.
17
- */
18
-
19
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
20
- /**
21
- * Component default props.
22
- */
23
-
24
- var DEFAULT_PROPS = {
25
- gap: Size.big,
26
- orientation: Orientation.horizontal
27
- };
28
- var Figure = noop.bind({});
29
- var isFigure = isComponentType(Figure);
30
- var Content = noop.bind({});
31
- var isContent = isComponentType(Content);
32
- var Actions = noop.bind({});
33
- var isActions = isComponentType(Actions);
34
- /**
35
- * The GenericBlock is a layout component made of 3 sections that can be
36
- * displayed either horizontally of vertically with the same gap between each section.
37
- *
38
- * The sections are:
39
- * - `Figure` => A visual element to display before the main content.
40
- * - `Content` => The main content displayed
41
- * - `Actions` => One or more actions to set after the element.
42
- *
43
- * @see https://www.figma.com/file/lzzrQmsfaXRaOyRfoEogPZ/DS%3A-playground?node-id=1%3A4076
44
- */
45
-
46
- var BaseGenericBlock = forwardRef(function (props, ref) {
47
- var _sections$figureChild, _ref4, _sections$figureChild2, _sections$figureChild3, _sections$contentChil, _ref5, _sections$contentChil2, _sections$contentChil3, _sections$actionsChil, _ref6, _sections$actionsChil2, _sections$actionsChil3;
48
-
49
- var className = props.className,
50
- figure = props.figure,
51
- figureProps = props.figureProps,
52
- children = props.children,
53
- actions = props.actions,
54
- actionsProps = props.actionsProps,
55
- gap = props.gap,
56
- orientation = props.orientation,
57
- contentProps = props.contentProps,
58
- forwardedProps = _objectWithoutProperties(props, ["className", "figure", "figureProps", "children", "actions", "actionsProps", "gap", "orientation", "contentProps"]);
59
-
60
- var sections = React.useMemo(function () {
61
- var _ref, _ref2, _ref3;
62
-
63
- // Split children by section type
64
- var _partitionMulti = partitionMulti(Children.toArray(children), [isFigure, isContent, isActions]),
65
- _partitionMulti2 = _toArray(_partitionMulti),
66
- _partitionMulti2$ = _slicedToArray(_partitionMulti2[0], 1),
67
- figureChild = _partitionMulti2$[0],
68
- _partitionMulti2$2 = _slicedToArray(_partitionMulti2[1], 1),
69
- contentChild = _partitionMulti2$2[0],
70
- _partitionMulti2$3 = _slicedToArray(_partitionMulti2[2], 1),
71
- actionsChild = _partitionMulti2$3[0],
72
- otherChildren = _partitionMulti2.slice(3);
73
-
74
- return {
75
- figureChild: figureChild,
76
- figureChildProps: (_ref = figureChild) === null || _ref === void 0 ? void 0 : _ref.props,
77
- contentChild: contentChild,
78
- contentChildProps: (_ref2 = contentChild) === null || _ref2 === void 0 ? void 0 : _ref2.props,
79
- actionsChild: actionsChild,
80
- actionsChildProps: (_ref3 = actionsChild) === null || _ref3 === void 0 ? void 0 : _ref3.props,
81
- otherChildren: otherChildren.filter(function (child) {
82
- return !isEmpty(child);
83
- })
84
- };
85
- }, [children]);
86
- return React.createElement(FlexBox, _extends({
87
- ref: ref,
88
- className: classnames(className, CLASSNAME),
89
- gap: gap,
90
- orientation: orientation
91
- }, forwardedProps), (figure || ((_sections$figureChild = sections.figureChildProps) === null || _sections$figureChild === void 0 ? void 0 : _sections$figureChild.children)) && React.createElement(FlexBox, _extends({
92
- ref: (_ref4 = sections.figureChild) === null || _ref4 === void 0 ? void 0 : _ref4.ref,
93
- vAlign: forwardedProps.vAlign,
94
- hAlign: forwardedProps.hAlign
95
- }, figureProps, sections.figureChildProps, {
96
- className: classnames(figureProps === null || figureProps === void 0 ? void 0 : figureProps.className, (_sections$figureChild2 = sections.figureChildProps) === null || _sections$figureChild2 === void 0 ? void 0 : _sections$figureChild2.className, "".concat(CLASSNAME, "__figure"))
97
- }), figure, (_sections$figureChild3 = sections.figureChildProps) === null || _sections$figureChild3 === void 0 ? void 0 : _sections$figureChild3.children), (((_sections$contentChil = sections.contentChildProps) === null || _sections$contentChil === void 0 ? void 0 : _sections$contentChil.children) || sections.otherChildren.length > 0) && React.createElement(FlexBox, _extends({
98
- ref: (_ref5 = sections.contentChild) === null || _ref5 === void 0 ? void 0 : _ref5.ref,
99
- orientation: Orientation.vertical,
100
- fillSpace: true,
101
- vAlign: forwardedProps.vAlign,
102
- hAlign: forwardedProps.hAlign
103
- }, contentProps, sections.contentChildProps, {
104
- className: classnames(contentProps === null || contentProps === void 0 ? void 0 : contentProps.className, (_sections$contentChil2 = sections.contentChildProps) === null || _sections$contentChil2 === void 0 ? void 0 : _sections$contentChil2.className, "".concat(CLASSNAME, "__content"))
105
- }), (_sections$contentChil3 = sections.contentChildProps) === null || _sections$contentChil3 === void 0 ? void 0 : _sections$contentChil3.children, sections.otherChildren), (actions || ((_sections$actionsChil = sections.actionsChildProps) === null || _sections$actionsChil === void 0 ? void 0 : _sections$actionsChil.children)) && React.createElement(FlexBox, _extends({
106
- ref: (_ref6 = sections.actionsChild) === null || _ref6 === void 0 ? void 0 : _ref6.ref,
107
- vAlign: forwardedProps.vAlign,
108
- hAlign: forwardedProps.hAlign
109
- }, actionsProps, sections.actionsChildProps, {
110
- className: classnames(actionsProps === null || actionsProps === void 0 ? void 0 : actionsProps.className, (_sections$actionsChil2 = sections.actionsChildProps) === null || _sections$actionsChil2 === void 0 ? void 0 : _sections$actionsChil2.className, "".concat(CLASSNAME, "__actions"))
111
- }), actions, (_sections$actionsChil3 = sections.actionsChildProps) === null || _sections$actionsChil3 === void 0 ? void 0 : _sections$actionsChil3.children));
112
- });
113
- BaseGenericBlock.displayName = COMPONENT_NAME;
114
- BaseGenericBlock.className = CLASSNAME;
115
- BaseGenericBlock.defaultProps = DEFAULT_PROPS;
116
- var GenericBlock = Object.assign(BaseGenericBlock, {
117
- Figure: Figure,
118
- Content: Content,
119
- Actions: Actions
120
- });
121
-
122
- export { GenericBlock as G };
123
- //# sourceMappingURL=ffd1bfe3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ffd1bfe3.js","sources":["../../src/components/generic-block/GenericBlock.tsx"],"sourcesContent":["import React, { Children, forwardRef, ReactElement, ReactNode } from 'react';\nimport classNames from 'classnames';\nimport isEmpty from 'lodash/isEmpty';\nimport noop from 'lodash/noop';\nimport { Comp, isComponentType } from '@lumx/react/utils/type';\nimport { getRootClassName } from '@lumx/react/utils/className';\nimport { partitionMulti } from '@lumx/react/utils/partitionMulti';\nimport { Orientation, Size, FlexBox, FlexBoxProps } from '@lumx/react';\n\nexport interface GenericBlockProps extends FlexBoxProps {\n /**\n * Component to use as visual element.\n */\n figure?: ReactNode;\n /**\n * Actions to set after the main content.\n */\n actions?: ReactNode;\n /**\n * Main content to display or sections components\n * ({@see GenericBlock.Figure}, {@see GenericBlock.Content} & {@see GenericBlock.Actions})\n */\n children: ReactNode;\n /**\n * Orientation of the 3 sections\n */\n orientation?: FlexBoxProps['orientation'];\n /**\n * Horizontal alignment.\n */\n hAlign?: FlexBoxProps['hAlign'];\n /**\n * Vertical alignment.\n */\n vAlign?: FlexBoxProps['vAlign'];\n /**\n * The props to forward to the content.\n * By default, the content will have the same alignment as wrapper.\n */\n contentProps?: Omit<FlexBoxProps, 'children'>;\n /**\n * props to forward to the actions element.\n */\n actionsProps?: Omit<FlexBoxProps, 'children'>;\n /**\n * props to forward to the figure element.\n */\n figureProps?: Omit<FlexBoxProps, 'children'>;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'GenericBlock';\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<GenericBlockProps> = {\n gap: Size.big,\n orientation: Orientation.horizontal,\n};\n\ntype BaseGenericBlock = Comp<GenericBlockProps, HTMLDivElement>;\n\ninterface GenericBlock extends BaseGenericBlock {\n /**\n * Use `GenericBlock.Figure` component as children of the `GenericBlock` component as an alternative way to inject\n * the \"figure\" section of the block (instead of using `figure` and `figureProps` props).\n */\n Figure: Comp<FlexBoxProps>;\n /**\n * Use `GenericBlock.Content` component as children of the `GenericBlock` component as an alternative way to inject\n * the \"content\" section of the block (instead of using `content` and `contentProps` props).\n */\n Content: Comp<FlexBoxProps>;\n /**\n * Use `GenericBlock.Actions` component as children of the `GenericBlock` component as an alternative way to inject\n * the \"actions\" section of the block (instead of using `actions` and `actionsProps` props).\n */\n Actions: Comp<FlexBoxProps>;\n}\n\nconst Figure = noop.bind({}) as Comp<FlexBoxProps>;\nconst isFigure = isComponentType(Figure);\n\nconst Content = noop.bind({}) as Comp<FlexBoxProps>;\nconst isContent = isComponentType(Content);\n\nconst Actions = noop.bind({}) as Comp<FlexBoxProps>;\nconst isActions = isComponentType(Actions);\n\n/**\n * The GenericBlock is a layout component made of 3 sections that can be\n * displayed either horizontally of vertically with the same gap between each section.\n *\n * The sections are:\n * - `Figure` => A visual element to display before the main content.\n * - `Content` => The main content displayed\n * - `Actions` => One or more actions to set after the element.\n *\n * @see https://www.figma.com/file/lzzrQmsfaXRaOyRfoEogPZ/DS%3A-playground?node-id=1%3A4076\n */\nconst BaseGenericBlock: BaseGenericBlock = forwardRef((props, ref) => {\n const {\n className,\n figure,\n figureProps,\n children,\n actions,\n actionsProps,\n gap,\n orientation,\n contentProps,\n ...forwardedProps\n } = props;\n\n const sections = React.useMemo(() => {\n // Split children by section type\n const [[figureChild], [contentChild], [actionsChild], ...otherChildren] = partitionMulti(\n Children.toArray(children),\n [isFigure, isContent, isActions],\n );\n return {\n figureChild,\n figureChildProps: (figureChild as ReactElement)?.props,\n contentChild,\n contentChildProps: (contentChild as ReactElement)?.props,\n actionsChild,\n actionsChildProps: (actionsChild as ReactElement)?.props,\n otherChildren: otherChildren.filter((child) => !isEmpty(child)),\n };\n }, [children]);\n\n return (\n <FlexBox\n ref={ref}\n className={classNames(className, CLASSNAME)}\n gap={gap}\n orientation={orientation}\n {...forwardedProps}\n >\n {(figure || sections.figureChildProps?.children) && (\n <FlexBox\n ref={(sections.figureChild as any)?.ref}\n vAlign={forwardedProps.vAlign}\n hAlign={forwardedProps.hAlign}\n {...figureProps}\n {...sections.figureChildProps}\n className={classNames(\n figureProps?.className,\n sections.figureChildProps?.className,\n `${CLASSNAME}__figure`,\n )}\n >\n {figure}\n {sections.figureChildProps?.children}\n </FlexBox>\n )}\n\n {(sections.contentChildProps?.children || sections.otherChildren.length > 0) && (\n <FlexBox\n ref={(sections.contentChild as any)?.ref}\n orientation={Orientation.vertical}\n fillSpace\n vAlign={forwardedProps.vAlign}\n hAlign={forwardedProps.hAlign}\n {...contentProps}\n {...sections.contentChildProps}\n className={classNames(\n contentProps?.className,\n sections.contentChildProps?.className,\n `${CLASSNAME}__content`,\n )}\n >\n {sections.contentChildProps?.children}\n {sections.otherChildren}\n </FlexBox>\n )}\n\n {(actions || sections.actionsChildProps?.children) && (\n <FlexBox\n ref={(sections.actionsChild as any)?.ref}\n vAlign={forwardedProps.vAlign}\n hAlign={forwardedProps.hAlign}\n {...actionsProps}\n {...sections.actionsChildProps}\n className={classNames(\n actionsProps?.className,\n sections.actionsChildProps?.className,\n `${CLASSNAME}__actions`,\n )}\n >\n {actions}\n {sections.actionsChildProps?.children}\n </FlexBox>\n )}\n </FlexBox>\n );\n});\nBaseGenericBlock.displayName = COMPONENT_NAME;\nBaseGenericBlock.className = CLASSNAME;\nBaseGenericBlock.defaultProps = DEFAULT_PROPS;\n\nexport const GenericBlock: GenericBlock = Object.assign(BaseGenericBlock, { Figure, Content, Actions });\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","gap","Size","big","orientation","Orientation","horizontal","Figure","noop","bind","isFigure","isComponentType","Content","isContent","Actions","isActions","BaseGenericBlock","forwardRef","props","ref","className","figure","figureProps","children","actions","actionsProps","contentProps","forwardedProps","sections","React","useMemo","partitionMulti","Children","toArray","figureChild","contentChild","actionsChild","otherChildren","figureChildProps","contentChildProps","actionsChildProps","filter","child","isEmpty","classNames","vAlign","hAlign","length","vertical","displayName","defaultProps","GenericBlock","Object","assign"],"mappings":";;;;;;;;;;AAkDA;;;AAGA,IAAMA,cAAc,GAAG,cAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAyC,GAAG;AAC9CC,EAAAA,GAAG,EAAEC,IAAI,CAACC,GADoC;AAE9CC,EAAAA,WAAW,EAAEC,WAAW,CAACC;AAFqB,CAAlD;AAyBA,IAAMC,MAAM,GAAGC,IAAI,CAACC,IAAL,CAAU,EAAV,CAAf;AACA,IAAMC,QAAQ,GAAGC,eAAe,CAACJ,MAAD,CAAhC;AAEA,IAAMK,OAAO,GAAGJ,IAAI,CAACC,IAAL,CAAU,EAAV,CAAhB;AACA,IAAMI,SAAS,GAAGF,eAAe,CAACC,OAAD,CAAjC;AAEA,IAAME,OAAO,GAAGN,IAAI,CAACC,IAAL,CAAU,EAAV,CAAhB;AACA,IAAMM,SAAS,GAAGJ,eAAe,CAACG,OAAD,CAAjC;AAEA;;;;;;;;;;;;AAWA,IAAME,gBAAkC,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA;;AAAA,MAE9DC,SAF8D,GAY9DF,KAZ8D,CAE9DE,SAF8D;AAAA,MAG9DC,MAH8D,GAY9DH,KAZ8D,CAG9DG,MAH8D;AAAA,MAI9DC,WAJ8D,GAY9DJ,KAZ8D,CAI9DI,WAJ8D;AAAA,MAK9DC,QAL8D,GAY9DL,KAZ8D,CAK9DK,QAL8D;AAAA,MAM9DC,OAN8D,GAY9DN,KAZ8D,CAM9DM,OAN8D;AAAA,MAO9DC,YAP8D,GAY9DP,KAZ8D,CAO9DO,YAP8D;AAAA,MAQ9DxB,GAR8D,GAY9DiB,KAZ8D,CAQ9Dj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QAAQ,CAACQ,YAAZ,0CAAE,MAAgCjB,GADzC;AAEI,IAAA,MAAM,EAAEQ,cAAc,CAACkB,MAF3B;AAGI,IAAA,MAAM,EAAElB,cAAc,CAACmB;AAH3B,KAIQrB,YAJR,EAKQG,QAAQ,CAACY,iBALjB;AAMI,IAAA,SAAS,EAAEI,UAAU,CACjBnB,YADiB,aACjBA,YADiB,uBACjBA,YAAY,CAAEL,SADG,4BAEjBQ,QAAQ,CAACY,iBAFQ,2DAEjB,uBAA4BpB,SAFX,YAGdtB,SAHc;AANzB,MAYK0B,OAZL,4BAaKI,QAAQ,CAACY,iBAbd,2DAaK,uBAA4BjB,QAbjC,CA9CR,CADJ;AAiEH,CAhGoD,CAArD;AAiGAP,gBAAgB,CAACiC,WAAjB,GAA+BpD,cAA/B;AACAmB,gBAAgB,CAACI,SAAjB,GAA6BtB,SAA7B;AACAkB,gBAAgB,CAACkC,YAAjB,GAAgClD,aAAhC;IAEamD,YAA0B,GAAGC,MAAM,CAACC,MAAP,CAAcrC,gBAAd,EAAgC;AAAET,EAAAA,MAAM,EAANA,MAAF;AAAUK,EAAAA,OAAO,EAAPA,OAAV;AAAmBE,EAAAA,OAAO,EAAPA;AAAnB,CAAhC;;;;"}
@@ -1,6 +0,0 @@
1
- import 'react';
2
- import '../_internal/eca6d4dc.js';
3
- export { a as AlertDialog, A as AlertDialogProps } from '../_internal/7be11ddc.js';
4
- import '../_internal/55271fa1.js';
5
- import '../_internal/fd1f4d68.js';
6
- import '../_internal/935ce959.js';
@@ -1,35 +0,0 @@
1
- import '../_internal/6340c129.js';
2
- import '../components.js';
3
- import 'react';
4
- import '../_internal/fd867c9d.js';
5
- import '../_internal/a521723d.js';
6
- import '../_internal/fc608bd9.js';
7
- import '../_internal/288dfd0f.js';
8
- import 'lodash/kebabCase';
9
- import 'lodash/isBoolean';
10
- import 'lodash/isEmpty';
11
- import 'lodash/noop';
12
- export { A as AlertDialog } from '../_internal/aca2ecf5.js';
13
- import '../_internal/853713cd.js';
14
- import '../_internal/329a01d3.js';
15
- import '../_internal/74cb6c26.js';
16
- import '../_internal/7e8d0ac5.js';
17
- import '../_internal/5d8ed4ee.js';
18
- import 'lodash/last';
19
- import 'lodash/pull';
20
- import '../_internal/2cc0aec5.js';
21
- import 'react-dom';
22
- import '../_internal/b89517ea.js';
23
- import 'lodash/get';
24
- import '../_internal/78ef8e34.js';
25
- import 'lodash/concat';
26
- import 'lodash/dropRight';
27
- import 'lodash/partition';
28
- import 'lodash/reduce';
29
- import '../_internal/4fc64a2e.js';
30
- import '../_internal/53a831be.js';
31
- import '../_internal/7e03266f.js';
32
- import '../_internal/0062d1bc.js';
33
- import '../_internal/7391188a.js';
34
- import '../_internal/9ca3f59c.js';
35
- //# sourceMappingURL=alert-dialog.js.map