@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 +0,0 @@
1
- {"version":3,"file":"0b370acc.js","sources":["../../src/hooks/useKeyboardListNavigation.tsx","../../src/components/list/ListItem.tsx","../../../../node_modules/react-is/cjs/react-is.production.min.js","../../../../node_modules/react-is/cjs/react-is.development.js","../../../../node_modules/react-is/index.js","../../src/utils/flattenChildren.ts","../../src/components/list/useInteractiveList.tsx","../../src/components/list/List.tsx"],"sourcesContent":["import { RefObject, SetStateAction, useEffect, useState } from 'react';\n\nimport get from 'lodash/get';\n\ntype Listener = (evt: KeyboardEvent) => void;\n\ninterface UseKeyboardListNavigationType {\n /** the current active index */\n activeItemIndex: number;\n /** callback to be used when a key is pressed. usually used with the native prop `onKeyDown` */\n onKeyboardNavigation: Listener;\n /** Resets the active index to the initial state */\n resetActiveIndex(): void;\n /** Sets the active index to a given value */\n setActiveItemIndex(value: SetStateAction<number>): void;\n}\n\nexport type useKeyboardListNavigationType = <I>(\n items: I[],\n ref: RefObject<HTMLElement>,\n onListItemSelected: (itemSelected: I) => void,\n onListItemNavigated?: (itemSelected: I) => void,\n onEnterPressed?: (itemSelected: string) => void,\n onBackspacePressed?: Listener,\n keepFocusAfterSelection?: boolean,\n initialIndex?: number,\n preventTabOnEnteredValue?: boolean,\n) => UseKeyboardListNavigationType;\n\nconst INITIAL_INDEX = -1;\n\n/**\n * This custom hook provides the necessary set of functions and values to properly navigate\n * a list using the keyboard.\n *\n * @param items the list of items that will be navigated using the keyboard.\n * @param ref A reference to the element that is controlling the navigation.\n * @param onListItemSelected callback to be executed when the ENTER key is pressed on an item.\n * @param onListItemNavigated callback to be executed when the Arrow keys are pressed.\n * @param onEnterPressed callback to be executed when the ENTER key is pressed.\n * @param onBackspacePressed callback to be executed when the BACKSPACE key is pressed.\n * @param keepFocusAfterSelection determines whether after selecting an item, the focus should be maintained on the current target or not.\n * @param initialIndex where should the navigation start from. it defaults to `-1`, so the first item navigated is the item on position `0`.\n * @param preventTabOnEnteredValue determines whether upon TAB, if there is a value entered, the event is prevented or not.\n * @return useKeyboardListNavigation helpers.\n */\nexport const useKeyboardListNavigation: useKeyboardListNavigationType = (\n items,\n ref,\n onListItemSelected,\n onListItemNavigated,\n onEnterPressed,\n onBackspacePressed,\n keepFocusAfterSelection = false,\n initialIndex = INITIAL_INDEX,\n preventTabOnEnteredValue = true,\n) => {\n const [activeItemIndex, setActiveItemIndex] = useState(initialIndex);\n\n /**\n * This function calculates the next index in the list to be highlighted\n * @param key - key code pressed\n * @return next active index\n */\n const calculateActiveIndex = (key: string): number => {\n switch (key) {\n case 'ArrowDown':\n return activeItemIndex + 1 < items.length ? activeItemIndex + 1 : 0;\n case 'ArrowUp':\n return activeItemIndex - 1 >= 0 ? activeItemIndex - 1 : items.length - 1;\n default:\n return initialIndex;\n }\n };\n\n /**\n * Resets the active index to the initial state\n */\n const resetActiveIndex = () => {\n setActiveItemIndex(initialIndex);\n };\n\n /**\n * Prevents the default event and stops the propagation of said event\n * @param evt - key pressed event\n */\n const preventDefaultAndStopPropagation: Listener = (evt) => {\n evt.preventDefault();\n evt.stopPropagation();\n };\n\n /**\n * Handles navigation with the arrows using the keyboard\n * @param evt - key pressed event\n */\n const onArrowPressed: Listener = (evt) => {\n const { key } = evt;\n const nextActiveIndex = calculateActiveIndex(key);\n setActiveItemIndex(nextActiveIndex);\n preventDefaultAndStopPropagation(evt);\n if (onListItemNavigated) {\n const selectedItem = items[nextActiveIndex];\n onListItemNavigated(selectedItem);\n }\n };\n\n /**\n * Handles the event when the backspace key is pressed\n * @param evt - key pressed event\n */\n const onBackspaceKeyPressed: Listener = (evt) => {\n if (onBackspacePressed) {\n onBackspacePressed(evt);\n }\n };\n\n /**\n * Handles when the ENTER key is pressed\n * @param evt - key pressed event\n */\n const onEnterKeyPressed: Listener = (evt) => {\n if (!onListItemSelected) {\n return;\n }\n\n preventDefaultAndStopPropagation(evt);\n\n if (!keepFocusAfterSelection) {\n (evt.currentTarget as HTMLElement).blur();\n }\n\n const selectedItem = items[activeItemIndex];\n\n if (selectedItem) {\n onListItemSelected(selectedItem);\n resetActiveIndex();\n } else if (activeItemIndex === initialIndex && onEnterPressed) {\n const value = get(evt, 'target.value');\n onEnterPressed(value);\n resetActiveIndex();\n }\n };\n\n /**\n * Handles when the TAB key is pressed\n * @param evt - key pressed event\n */\n const onTabKeyPressed: Listener = (evt) => {\n const value = get(evt, 'target.value');\n\n if (preventTabOnEnteredValue && value && value.length > 0) {\n preventDefaultAndStopPropagation(evt);\n }\n };\n\n /**\n * In order to make it easier in the future to add new events depending on the key\n * a map was created to add these handlers. In the future, if there is another event\n * that we need to manage depending on a specific key, we just need to add the key code\n * here, and as a value, the handler for said key.\n */\n const eventsForKeyPressed: Record<string, Listener> = {\n ArrowDown: onArrowPressed,\n Tab: onTabKeyPressed,\n ArrowUp: onArrowPressed,\n Enter: onEnterKeyPressed,\n Backspace: onBackspaceKeyPressed,\n };\n\n /**\n * Calculates the next active item index depending on the key pressed.\n * If the key pressed was ENTER, the function executes the callback `onListItemSelected`\n * and resets the active index, since an item was selected.\n * @param evt - key pressed or key down event\n */\n const onKeyboardNavigation: Listener = (evt) => {\n const { key } = evt;\n const handler = eventsForKeyPressed[key];\n\n if (handler) {\n handler(evt);\n }\n };\n\n useEffect(() => {\n const { current: currentElement } = ref;\n if (!currentElement) {\n return undefined;\n }\n currentElement.addEventListener('focus', resetActiveIndex);\n currentElement.addEventListener('keydown', onKeyboardNavigation);\n return () => {\n currentElement.removeEventListener('focus', resetActiveIndex);\n currentElement.removeEventListener('keydown', onKeyboardNavigation);\n };\n });\n\n return {\n activeItemIndex,\n onKeyboardNavigation,\n resetActiveIndex,\n setActiveItemIndex,\n };\n};\n","import React, { forwardRef, ReactNode, Ref, SyntheticEvent, useMemo } from 'react';\n\nimport classNames from 'classnames';\nimport isEmpty from 'lodash/isEmpty';\n\nimport { ListProps, Size } from '@lumx/react';\nimport { Comp, GenericProps } from '@lumx/react/utils/type';\nimport { onEnterPressed, onButtonPressed } from '@lumx/react/utils/event';\nimport { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';\nimport { renderLink } from '@lumx/react/utils/renderLink';\n\nexport type ListItemSize = Extract<Size, 'tiny' | 'regular' | 'big' | 'huge'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface ListItemProps extends GenericProps {\n /** A component to be rendered after the content. */\n after?: ReactNode;\n /** A component to be rendered before the content. */\n before?: ReactNode;\n /** Content. */\n children: string | ReactNode;\n /** Whether the list item should be highlighted or not. */\n isHighlighted?: boolean;\n /** Whether the component is selected or not. */\n isSelected?: boolean;\n /** Whether link/button is disabled or not. */\n isDisabled?: boolean;\n /** Reference to the <li> element. */\n listItemRef?: Ref<HTMLLIElement>;\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n /** Props that will be passed on to the Link */\n linkProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;\n /** Reference to the link element. */\n linkRef?: Ref<HTMLAnchorElement>;\n /** Size variant. */\n size?: ListItemSize;\n\n /** On selected callback. */\n onItemSelected?(evt: SyntheticEvent): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ListItem';\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<ListProps> = {\n size: Size.regular,\n};\n\n/**\n * Check if the list item is clickable.\n * @return `true` if the list item is clickable; `false` otherwise.\n */\nexport function isClickable({ linkProps, onItemSelected }: Partial<ListItemProps>): boolean {\n return !isEmpty(linkProps?.href) || !!onItemSelected;\n}\n\n/**\n * ListItem component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ListItem: Comp<ListItemProps, HTMLLIElement> = forwardRef((props, ref) => {\n const {\n after,\n before,\n children,\n className,\n isHighlighted,\n isSelected,\n isDisabled,\n linkAs,\n linkProps = {},\n linkRef,\n onItemSelected,\n size,\n ...forwardedProps\n } = props;\n\n const role = linkAs || linkProps.href ? 'link' : 'button';\n const onKeyDown = useMemo(() => {\n if (onItemSelected && role === 'link') return onEnterPressed(onItemSelected as any);\n if (onItemSelected && role === 'button') return onButtonPressed(onItemSelected as any);\n return undefined;\n }, [role, onItemSelected]);\n\n const content = (\n <>\n {before && <div className={`${CLASSNAME}__before`}>{before}</div>}\n <div className={`${CLASSNAME}__content`}>{children}</div>\n {after && <div className={`${CLASSNAME}__after`}>{after}</div>}\n </>\n );\n\n return (\n <li\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n size,\n }),\n )}\n >\n {isClickable({ linkProps, onItemSelected }) ? (\n /* Clickable list item */\n renderLink(\n {\n linkAs,\n tabIndex: !isDisabled && role === 'button' ? 0 : undefined,\n role,\n 'aria-disabled': isDisabled,\n ...linkProps,\n href: isDisabled ? undefined : linkProps.href,\n className: classNames(\n handleBasicClasses({\n prefix: `${CLASSNAME}__link`,\n isHighlighted,\n isSelected,\n isDisabled,\n }),\n ),\n onClick: isDisabled ? undefined : onItemSelected,\n onKeyDown,\n ref: linkRef,\n },\n content,\n )\n ) : (\n /* Non clickable list item */\n <div className={`${CLASSNAME}__wrapper`}>{content}</div>\n )}\n </li>\n );\n});\nListItem.displayName = COMPONENT_NAME;\nListItem.className = CLASSNAME;\nListItem.defaultProps = DEFAULT_PROPS;\n","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","/** @license React v16.13.1\n * react-is.development.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n\n\nif (process.env.NODE_ENV !== \"production\") {\n (function() {\n'use strict';\n\n// The Symbol used to tag the ReactElement-like types. If there is no native Symbol\n// nor polyfill, then a plain number is used for performance.\nvar hasSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;\nvar REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;\nvar REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;\nvar REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;\nvar REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;\nvar REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;\nvar REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary\n// (unstable) APIs that have been removed. Can we remove the symbols?\n\nvar REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;\nvar REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;\nvar REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;\nvar REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;\nvar REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;\nvar REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;\nvar REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;\nvar REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;\nvar REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;\nvar REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;\nvar REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;\n\nfunction isValidElementType(type) {\n return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.\n type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);\n}\n\nfunction typeOf(object) {\n if (typeof object === 'object' && object !== null) {\n var $$typeof = object.$$typeof;\n\n switch ($$typeof) {\n case REACT_ELEMENT_TYPE:\n var type = object.type;\n\n switch (type) {\n case REACT_ASYNC_MODE_TYPE:\n case REACT_CONCURRENT_MODE_TYPE:\n case REACT_FRAGMENT_TYPE:\n case REACT_PROFILER_TYPE:\n case REACT_STRICT_MODE_TYPE:\n case REACT_SUSPENSE_TYPE:\n return type;\n\n default:\n var $$typeofType = type && type.$$typeof;\n\n switch ($$typeofType) {\n case REACT_CONTEXT_TYPE:\n case REACT_FORWARD_REF_TYPE:\n case REACT_LAZY_TYPE:\n case REACT_MEMO_TYPE:\n case REACT_PROVIDER_TYPE:\n return $$typeofType;\n\n default:\n return $$typeof;\n }\n\n }\n\n case REACT_PORTAL_TYPE:\n return $$typeof;\n }\n }\n\n return undefined;\n} // AsyncMode is deprecated along with isAsyncMode\n\nvar AsyncMode = REACT_ASYNC_MODE_TYPE;\nvar ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;\nvar ContextConsumer = REACT_CONTEXT_TYPE;\nvar ContextProvider = REACT_PROVIDER_TYPE;\nvar Element = REACT_ELEMENT_TYPE;\nvar ForwardRef = REACT_FORWARD_REF_TYPE;\nvar Fragment = REACT_FRAGMENT_TYPE;\nvar Lazy = REACT_LAZY_TYPE;\nvar Memo = REACT_MEMO_TYPE;\nvar Portal = REACT_PORTAL_TYPE;\nvar Profiler = REACT_PROFILER_TYPE;\nvar StrictMode = REACT_STRICT_MODE_TYPE;\nvar Suspense = REACT_SUSPENSE_TYPE;\nvar hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated\n\nfunction isAsyncMode(object) {\n {\n if (!hasWarnedAboutDeprecatedIsAsyncMode) {\n hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint\n\n console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');\n }\n }\n\n return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;\n}\nfunction isConcurrentMode(object) {\n return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;\n}\nfunction isContextConsumer(object) {\n return typeOf(object) === REACT_CONTEXT_TYPE;\n}\nfunction isContextProvider(object) {\n return typeOf(object) === REACT_PROVIDER_TYPE;\n}\nfunction isElement(object) {\n return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;\n}\nfunction isForwardRef(object) {\n return typeOf(object) === REACT_FORWARD_REF_TYPE;\n}\nfunction isFragment(object) {\n return typeOf(object) === REACT_FRAGMENT_TYPE;\n}\nfunction isLazy(object) {\n return typeOf(object) === REACT_LAZY_TYPE;\n}\nfunction isMemo(object) {\n return typeOf(object) === REACT_MEMO_TYPE;\n}\nfunction isPortal(object) {\n return typeOf(object) === REACT_PORTAL_TYPE;\n}\nfunction isProfiler(object) {\n return typeOf(object) === REACT_PROFILER_TYPE;\n}\nfunction isStrictMode(object) {\n return typeOf(object) === REACT_STRICT_MODE_TYPE;\n}\nfunction isSuspense(object) {\n return typeOf(object) === REACT_SUSPENSE_TYPE;\n}\n\nexports.AsyncMode = AsyncMode;\nexports.ConcurrentMode = ConcurrentMode;\nexports.ContextConsumer = ContextConsumer;\nexports.ContextProvider = ContextProvider;\nexports.Element = Element;\nexports.ForwardRef = ForwardRef;\nexports.Fragment = Fragment;\nexports.Lazy = Lazy;\nexports.Memo = Memo;\nexports.Portal = Portal;\nexports.Profiler = Profiler;\nexports.StrictMode = StrictMode;\nexports.Suspense = Suspense;\nexports.isAsyncMode = isAsyncMode;\nexports.isConcurrentMode = isConcurrentMode;\nexports.isContextConsumer = isContextConsumer;\nexports.isContextProvider = isContextProvider;\nexports.isElement = isElement;\nexports.isForwardRef = isForwardRef;\nexports.isFragment = isFragment;\nexports.isLazy = isLazy;\nexports.isMemo = isMemo;\nexports.isPortal = isPortal;\nexports.isProfiler = isProfiler;\nexports.isStrictMode = isStrictMode;\nexports.isSuspense = isSuspense;\nexports.isValidElementType = isValidElementType;\nexports.typeOf = typeOf;\n })();\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","import get from 'lodash/get';\nimport { Children, Key, ReactChild, ReactNode, cloneElement, isValidElement } from 'react';\nimport { isFragment } from 'react-is';\n\n/**\n * Flatten list of react nodes removing fragments and adding keys.\n * based on: https://github.com/grrowl/react-keyed-flatten-children/blob/5d421644a449765ddd62b659946196b4b5d7b135/index.ts\n *\n * @param children React nodes to flatten.\n * @return Flattened react nodes.\n */\nexport function flattenChildren(children: ReactNode) {\n function recur(nodes: ReactNode, keys: Key[] = []) {\n return Children.toArray(nodes).reduce((acc: ReactChild[], node, index) => {\n const nodeKeys = keys.concat(get(node, 'key') ?? index);\n if (isFragment(node)) {\n acc.push(...recur(node.props.children, nodeKeys));\n } else if (isValidElement(node)) {\n acc.push(cloneElement(node, { key: nodeKeys.join('.') }));\n } else if (typeof node === 'string' || typeof node === 'number') {\n acc.push(node);\n }\n return acc;\n }, []);\n }\n return recur(children);\n}\n","import { ListItemProps } from '@lumx/react';\nimport { isClickable } from '@lumx/react/components/list/ListItem';\n\nimport { isComponent } from '@lumx/react/utils/type';\nimport { flattenChildren } from '@lumx/react/utils/flattenChildren';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\nimport get from 'lodash/get';\nimport {\n cloneElement,\n Key,\n ReactElement,\n ReactNode,\n RefObject,\n SyntheticEvent,\n useEffect,\n useMemo,\n useState,\n} from 'react';\n\ntype Listener = (evt: KeyboardEvent) => void;\n\ninterface Options {\n /** List of items to navigate on. */\n items: ReactNode[] | ReactNode;\n /** Reference to the list-like element controlling the navigation. */\n ref: RefObject<HTMLElement>;\n\n /**\n * On list item navigated callback (triggered on ARROW key navigation).\n *\n * @param index Index of the navigated item among the sibling items.\n * @param key React key of the navigated item.\n */\n onListItemNavigated?(index: number, key: Key | null): void;\n\n /**\n * On list item selected callback (via ENTER key or click).\n *\n * @param index Index of the selected item among the sibling items.\n * @param key React key of the selected item.\n * @param evt Source event (either mouse or keyboard event).\n */\n onListItemSelected?(index: number, key: Key | null, evt: SyntheticEvent): void;\n}\n\ninterface Output {\n /** List of items transformed to accommodate keyboard navigation. */\n items: ReactNode[];\n /** Whether the list contains clickable items or not. */\n hasClickableItem: boolean;\n}\n\nexport type useInteractiveList = (options: Options) => Output;\n\nconst INITIAL_INDEX = -1;\n\nfunction onKeyboardFocus(props: any, handler: (evt: FocusEvent) => void) {\n let isMouseDown = false;\n return {\n onFocus(evt: FocusEvent) {\n props.onFocus?.(evt);\n if (!isMouseDown) {\n handler(evt);\n }\n },\n onMouseDown(evt: MouseEvent) {\n props.onMouseDown?.(evt);\n isMouseDown = true;\n },\n onMouseUp(evt: MouseEvent) {\n props.onMouseUp?.(evt);\n isMouseDown = false;\n },\n };\n}\n\nconst isNavigableItem = (node: ReactNode): node is ReactElement => {\n return isComponent('ListItem')(node) && isClickable(node.props) && !node.props.isDisabled;\n};\n\n/**\n * This custom hook detects clickable list item in a list and make them navigable with the keyboard.\n *\n * @param options See {@link Options}\n * @return See {@link Output}\n */\nexport const useInteractiveList: useInteractiveList = (options) => {\n const { ref, onListItemSelected, onListItemNavigated } = options;\n const items = useMemo(() => flattenChildren(options.items), [options.items]);\n const [activeItemIndex, setActiveItemIndex] = useState(INITIAL_INDEX);\n\n // Attach listeners to the list.\n useEffect(() => {\n const { current: listElement } = ref;\n if (!listElement) {\n return undefined;\n }\n\n /**\n * This function calculates the next index in the list to be active\n * @param index current index\n * @param code key code pressed\n * @return next index\n */\n const getNextIndex = (index: number, key: string): number => {\n switch (key) {\n case 'ArrowDown':\n return index + 1 < items.length ? index + 1 : 0;\n case 'ArrowUp':\n return index - 1 >= 0 ? index - 1 : items.length - 1;\n default:\n return INITIAL_INDEX;\n }\n };\n\n /**\n * Resets the active index to the initial state\n */\n const resetActiveIndex = () => {\n setActiveItemIndex(INITIAL_INDEX);\n };\n\n /**\n * Handles navigation with the arrows using the keyboard\n * @param evt Key event\n */\n const onArrowPressed: Listener = (evt) => {\n const { key } = evt;\n if (key !== 'ArrowUp' && key !== 'ArrowDown') {\n return;\n }\n\n let nextIndex = activeItemIndex;\n let iterations = 0;\n\n // Move to next navigable item.\n do {\n nextIndex = getNextIndex(nextIndex, key);\n iterations += 1;\n } while (\n nextIndex !== INITIAL_INDEX &&\n nextIndex !== activeItemIndex &&\n !isNavigableItem(items[nextIndex] as any) &&\n iterations < items.length\n );\n\n setActiveItemIndex(nextIndex);\n evt.preventDefault();\n evt.stopPropagation();\n onListItemNavigated?.(nextIndex, get(items, [nextIndex, 'key']));\n };\n\n /**\n * Reset active list item index when focusing outside the list.\n * @param evt Focus out event\n */\n const onFocusOut = (evt: FocusEvent) => {\n if (!evt.relatedTarget || !listElement.contains(evt.relatedTarget as any)) {\n resetActiveIndex();\n }\n };\n\n listElement.addEventListener('focusout', onFocusOut);\n listElement.addEventListener('keydown', onArrowPressed);\n return () => {\n listElement.removeEventListener('focusout', onFocusOut);\n listElement.removeEventListener('keydown', onArrowPressed);\n };\n }, [ref, activeItemIndex, items, onListItemNavigated]);\n\n return useMemo(() => {\n let hasClickableItem = false;\n const transformedItems = items.map((item, index) => {\n // Ignore if list not clickable or item is not a simple list item.\n if (!isNavigableItem(item)) {\n return item;\n }\n\n hasClickableItem = true;\n const isHighlighted = index === activeItemIndex;\n\n // Clone list item: inject ref, add tab index and active state.\n return cloneElement<ListItemProps>(item, {\n ...item.props,\n isHighlighted: item.props.isHighlighted ?? isHighlighted,\n linkRef: mergeRefs(item.props.linkRef, (element: any) => {\n if (isHighlighted) {\n element?.focus();\n }\n }),\n onItemSelected(evt) {\n item.props.onItemSelected?.();\n onListItemSelected?.(index, item.key, evt);\n },\n ...onKeyboardFocus(item.props, () => {\n setActiveItemIndex(index);\n }),\n });\n });\n return { items: transformedItems, hasClickableItem };\n }, [items, activeItemIndex, onListItemSelected]);\n};\n","import { Size } from '@lumx/react';\n\nimport { useKeyboardListNavigation } from '@lumx/react/hooks/useKeyboardListNavigation';\nimport { Comp, GenericProps } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\n\nimport classNames from 'classnames';\nimport React, { forwardRef, Key, ReactNode, SyntheticEvent, useRef } from 'react';\nimport { useInteractiveList } from './useInteractiveList';\n\n/**\n * Defines the props of the component.\n */\nexport interface ListProps extends GenericProps {\n /** List content (should be ListItem, ListSubheader or ListDivider). */\n children: ReactNode;\n /**\n * Whether the list items are clickable.\n * @deprecated not needed anymore.\n */\n isClickable?: boolean;\n /** Item padding size. */\n itemPadding?: Extract<Size, 'big' | 'huge'>;\n /** Tab index of the list. Default to -1 */\n tabIndex?: number;\n /**\n * On list item selected callback.\n *\n * @param key React key of the selected item.\n * @param index Index of the selected item among the sibling items.\n * @param evt Source event (either mouse or keyboard event).\n */\n onListItemSelected?(key: Key, index: number, evt: SyntheticEvent): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'List';\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<ListProps> = {\n tabIndex: -1,\n};\n\n/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\n/**\n * List component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nconst InternalList: Comp<ListProps, HTMLUListElement> = forwardRef((props, ref) => {\n const { children, className, isClickable, itemPadding, onListItemSelected, tabIndex, ...forwardedProps } = props;\n const listElementRef = useRef<HTMLUListElement>(null);\n\n const { items, hasClickableItem } = useInteractiveList({\n items: children,\n ref: listElementRef,\n onListItemSelected,\n });\n const clickable = hasClickableItem || isClickable;\n\n return (\n <ul\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n itemPadding: itemPadding ?? (clickable ? Size.big : undefined),\n }),\n )}\n tabIndex={tabIndex}\n ref={mergeRefs(ref, listElementRef)}\n >\n {items}\n </ul>\n );\n});\nInternalList.displayName = COMPONENT_NAME;\nInternalList.className = CLASSNAME;\nInternalList.defaultProps = DEFAULT_PROPS;\n\nexport const List = Object.assign(InternalList, { useKeyboardListNavigation });\n"],"names":["INITIAL_INDEX","useKeyboardListNavigation","items","ref","onListItemSelected","onListItemNavigated","onEnterPressed","onBackspacePressed","keepFocusAfterSelection","initialIndex","preventTabOnEnteredValue","useState","activeItemIndex","setActiveItemIndex","calculateActiveIndex","key","length","resetActiveIndex","preventDefaultAndStopPropagation","evt","preventDefault","stopPropagation","onArrowPressed","nextActiveIndex","selectedItem","onBackspaceKeyPressed","onEnterKeyPressed","currentTarget","blur","value","get","onTabKeyPressed","eventsForKeyPressed","ArrowDown","Tab","ArrowUp","Enter","Backspace","onKeyboardNavigation","handler","useEffect","currentElement","current","undefined","addEventListener","removeEventListener","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","regular","isClickable","linkProps","onItemSelected","isEmpty","href","ListItem","forwardRef","props","after","before","children","className","isHighlighted","isSelected","isDisabled","linkAs","linkRef","forwardedProps","role","onKeyDown","useMemo","onButtonPressed","content","classNames","handleBasicClasses","prefix","renderLink","tabIndex","onClick","displayName","defaultProps","require$$0","require$$1","flattenChildren","recur","nodes","keys","Children","toArray","reduce","acc","node","index","nodeKeys","concat","isFragment","push","isValidElement","cloneElement","join","onKeyboardFocus","isMouseDown","onFocus","onMouseDown","onMouseUp","isNavigableItem","isComponent","useInteractiveList","options","listElement","getNextIndex","nextIndex","iterations","onFocusOut","relatedTarget","contains","hasClickableItem","transformedItems","map","item","mergeRefs","element","focus","InternalList","itemPadding","listElementRef","useRef","clickable","big","List","Object","assign"],"mappings":";;;;;;;;;;AA6BA,IAAMA,aAAa,GAAG,CAAC,CAAvB;AAEA;;;;;;;;;;;;;;;;AAeO,IAAMC,yBAAwD,GAAG,SAA3DA,yBAA2D,CACpEC,KADoE,EAEpEC,GAFoE,EAGpEC,kBAHoE,EAIpEC,mBAJoE,EAKpEC,cALoE,EAMpEC,kBANoE,EAUnE;AAAA,MAHDC,uBAGC,uEAHyB,KAGzB;AAAA,MAFDC,YAEC,uEAFcT,aAEd;AAAA,MADDU,wBACC,uEAD0B,IAC1B;;AAAA,kBAC6CC,QAAQ,CAACF,YAAD,CADrD;AAAA;AAAA,MACMG,eADN;AAAA,MACuBC,kBADvB;AAGD;;;;;;;AAKA,MAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,CAACC,GAAD,EAAyB;AAClD,YAAQA,GAAR;AACI,WAAK,WAAL;AACI,eAAOH,eAAe,GAAG,CAAlB,GAAsBV,KAAK,CAACc,MAA5B,GAAqCJ,eAAe,GAAG,CAAvD,GAA2D,CAAlE;;AACJ,WAAK,SAAL;AACI,eAAOA,eAAe,GAAG,CAAlB,IAAuB,CAAvB,GAA2BA,eAAe,GAAG,CAA7C,GAAiDV,KAAK,CAACc,MAAN,GAAe,CAAvE;;AACJ;AACI,eAAOP,YAAP;AANR;A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,EAAEqC,QATd;AAUI,IAAA,GAAG,EAAE2C,SAAS,CAACxH,GAAD,EAAM6H,cAAN;AAVlB,MAYK9H,KAZL,CADJ;AAgBH,CA3BiE,CAAlE;AA4BA4H,YAAY,CAAC5C,WAAb,GAA2BpC,gBAA3B;AACAgF,YAAY,CAAC9D,SAAb,GAAyBjB,WAAzB;AACA+E,YAAY,CAAC3C,YAAb,GAA4BlC,eAA5B;IAEamF,IAAI,GAAGC,MAAM,CAACC,MAAP,CAAcR,YAAd,EAA4B;AAAE7H,EAAAA,yBAAyB,EAAzBA;AAAF,CAA5B;;;;"}
@@ -1,67 +0,0 @@
1
- import React, { ReactNode, Ref, SyntheticEvent } from 'react';
2
- import { l as GenericProps, m as HasTheme, k as Comp } from './eca6d4dc.js';
3
- import { I as IconButtonProps } from './2d770113.js';
4
-
5
- /**
6
- * Defines the props of the component.
7
- */
8
- interface TextFieldProps extends GenericProps, HasTheme {
9
- /** Chip Group to be rendered before the main text input. */
10
- chips?: HTMLElement | ReactNode;
11
- /** Props to pass to the clear button (minus those already set by the TextField props). If not specified, the button won't be displayed. */
12
- clearButtonProps?: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis'>;
13
- /** Error message. */
14
- error?: string | ReactNode;
15
- /** Whether we force the focus style or not. */
16
- forceFocusStyle?: boolean;
17
- /** Whether the text field is displayed with error style or not. */
18
- hasError?: boolean;
19
- /** Additional element to put at the end of the text field. */
20
- afterElement?: ReactNode;
21
- /** Helper text. */
22
- helper?: string | ReactNode;
23
- /** Icon (SVG path). */
24
- icon?: string;
25
- /** Native input id property (generated if not provided to link the label element). */
26
- id?: string;
27
- /** Reference to the <input> or <textarea> element. */
28
- inputRef?: Ref<HTMLInputElement | HTMLTextAreaElement>;
29
- /** Whether the component is disabled or not. */
30
- isDisabled?: boolean;
31
- /** Whether the component is required or not. */
32
- isRequired?: boolean;
33
- /** Whether the text field is displayed with valid style or not. */
34
- isValid?: boolean;
35
- /** Label text. */
36
- label?: string;
37
- /** Max string length the input accepts (constrains the input and displays a character counter). */
38
- maxLength?: number;
39
- /** Minimum number of rows displayed in multiline mode (requires `multiline` to be enabled). */
40
- minimumRows?: number;
41
- /** Whether the text field is a textarea or an input. */
42
- multiline?: boolean;
43
- /** Native input name property. */
44
- name?: string;
45
- /** Placeholder text. */
46
- placeholder?: string;
47
- /** Reference to the wrapper. */
48
- textFieldRef?: Ref<HTMLDivElement>;
49
- /** Value. */
50
- value?: string;
51
- /** On blur callback. */
52
- onBlur?(event: React.FocusEvent): void;
53
- /** On change callback. */
54
- onChange(value: string, name?: string, event?: SyntheticEvent): void;
55
- /** On focus callback. */
56
- onFocus?(event: React.FocusEvent): void;
57
- }
58
- /**
59
- * TextField component.
60
- *
61
- * @param props Component props.
62
- * @param ref Component ref.
63
- * @return React element.
64
- */
65
- declare const TextField: Comp<TextFieldProps, HTMLDivElement>;
66
-
67
- export { TextFieldProps as T, TextField as a };
@@ -1,31 +0,0 @@
1
- import { RefObject } from 'react';
2
- import { l as GenericProps, m as HasTheme, k as Comp } from './eca6d4dc.js';
3
- import { I as IconButtonProps } from './2d770113.js';
4
-
5
- /**
6
- * Defines the props of the component.
7
- */
8
- interface LightboxProps extends GenericProps, HasTheme {
9
- /** Props to pass to the close button (minus those already set by the Lightbox props). */
10
- closeButtonProps?: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;
11
- /** Whether the component is open or not. */
12
- isOpen?: boolean;
13
- /** Reference to the element that triggered modal opening to set focus on. */
14
- parentElement: RefObject<any>;
15
- /** Whether to keep the dialog open on clickaway or escape press. */
16
- preventAutoClose?: boolean;
17
- /** Z-axis position. */
18
- zIndex?: number;
19
- /** On close callback. */
20
- onClose?(): void;
21
- }
22
- /**
23
- * Lightbox component.
24
- *
25
- * @param props Component props.
26
- * @param ref Component ref.
27
- * @return React element.
28
- */
29
- declare const Lightbox: Comp<LightboxProps, HTMLDivElement>;
30
-
31
- export { LightboxProps as L, Lightbox as a };
@@ -1,58 +0,0 @@
1
- import { b as _objectWithoutProperties, c as _extends } from './6340c129.js';
2
- import { Theme } from '../components.js';
3
- import React, { forwardRef } from 'react';
4
- import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './fd867c9d.js';
5
-
6
- /**
7
- * Defines the props of the component.
8
- */
9
-
10
- /**
11
- * Component display name.
12
- */
13
- var COMPONENT_NAME = 'InputLabel';
14
- /**
15
- * Component default class name and class prefix.
16
- */
17
-
18
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
19
- /**
20
- * Component default props.
21
- */
22
-
23
- var DEFAULT_PROPS = {
24
- theme: Theme.light
25
- };
26
- /**
27
- * InputLabel component.
28
- *
29
- * @param props Component props.
30
- * @param ref Component ref.
31
- * @return React element.
32
- */
33
-
34
- var InputLabel = forwardRef(function (props, ref) {
35
- var children = props.children,
36
- className = props.className,
37
- htmlFor = props.htmlFor,
38
- isRequired = props.isRequired,
39
- theme = props.theme,
40
- forwardedProps = _objectWithoutProperties(props, ["children", "className", "htmlFor", "isRequired", "theme"]);
41
-
42
- return React.createElement("label", _extends({
43
- ref: ref
44
- }, forwardedProps, {
45
- htmlFor: htmlFor,
46
- className: classnames(className, handleBasicClasses({
47
- prefix: CLASSNAME,
48
- isRequired: isRequired,
49
- theme: theme
50
- }))
51
- }), children);
52
- });
53
- InputLabel.displayName = COMPONENT_NAME;
54
- InputLabel.className = CLASSNAME;
55
- InputLabel.defaultProps = DEFAULT_PROPS;
56
-
57
- export { InputLabel as I };
58
- //# sourceMappingURL=12ab39e4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"12ab39e4.js","sources":["../../src/components/input-label/InputLabel.tsx"],"sourcesContent":["import { Theme } from '@lumx/react';\nimport { Comp, GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/react/utils/className';\nimport classNames from 'classnames';\nimport React, { forwardRef, ReactNode } from 'react';\n\n/**\n * Defines the props of the component.\n */\nexport interface InputLabelProps extends GenericProps, HasTheme {\n /** Label content. */\n children: string | ReactNode;\n /** Native htmlFor property. */\n htmlFor: string;\n /** Whether the component is required or not. */\n isRequired?: boolean;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'InputLabel';\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<InputLabelProps> = {\n theme: Theme.light,\n};\n\n/**\n * InputLabel component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const InputLabel: Comp<InputLabelProps, HTMLLabelElement> = forwardRef((props, ref) => {\n const { children, className, htmlFor, isRequired, theme, ...forwardedProps } = props;\n\n return (\n <label\n ref={ref}\n {...forwardedProps}\n htmlFor={htmlFor}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, isRequired, theme }))}\n >\n {children}\n </label>\n );\n});\nInputLabel.displayName = COMPONENT_NAME;\nInputLabel.className = CLASSNAME;\nInputLabel.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","theme","Theme","light","InputLabel","forwardRef","props","ref","children","className","htmlFor","isRequired","forwardedProps","classNames","handleBasicClasses","prefix","displayName","defaultProps"],"mappings":";;;;;AAMA;;;;AAYA;;;AAGA,IAAMA,cAAc,GAAG,YAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAuC,GAAG;AAC5CC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAD+B,CAAhD;AAIA;;;;;;;;IAOaC,UAAmD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAClFC,QADkF,GACXF,KADW,CAClFE,QADkF;AAAA,MACxEC,SADwE,GACXH,KADW,CACxEG,SADwE;AAAA,MAC7DC,OAD6D,GACXJ,KADW,CAC7DI,OAD6D;AAAA,MACpDC,UADoD,GACXL,KADW,CACpDK,UADoD;AAAA,MACxCV,KADwC,GACXK,KADW,CACxCL,KADwC;AAAA,MAC9BW,cAD8B,4BACXN,KADW;;AAG1F,SACI;AACI,IAAA,GAAG,EAAEC;AADT,KAEQK,cAFR;AAGI,IAAA,OAAO,EAAEF,OAHb;AAII,IAAA,SAAS,EAAEG,UAAU,CAACJ,SAAD,EAAYK,kBAAkB,CAAC;AAAEC,MAAAA,MAAM,EAAEjB,SAAV;AAAqBa,MAAAA,UAAU,EAAVA,UAArB;AAAiCV,MAAAA,KAAK,EAALA;AAAjC,KAAD,CAA9B;AAJzB,MAMKO,QANL,CADJ;AAUH,CAb4E;AAc7EJ,UAAU,CAACY,WAAX,GAAyBnB,cAAzB;AACAO,UAAU,CAACK,SAAX,GAAuBX,SAAvB;AACAM,UAAU,CAACa,YAAX,GAA0BjB,aAA1B;;;;"}
@@ -1,343 +0,0 @@
1
- import { c as _extends, a as _defineProperty, b as _objectWithoutProperties, d as _slicedToArray } from './6340c129.js';
2
- import { Emphasis } from '../components.js';
3
- import React, { forwardRef, useState, useRef, useCallback } from 'react';
4
- import { g as getRootClassName, c as classnames } from './fd867c9d.js';
5
- import { f as mdiChevronRight, g as mdiChevronLeft } from './a521723d.js';
6
- import { u as useFocus, a as Popover, P as Placement } from './9ab3c637.js';
7
- import { I as IconButton } from './377b2f44.js';
8
- import moment$1 from 'moment';
9
- import range from 'lodash/range';
10
- import { extendMoment } from 'moment-range';
11
- import { u as useFocusTrap } from './2cc0aec5.js';
12
- import { T as TextField } from './490ec1da.js';
13
- import { T as Toolbar } from './9ca3f59c.js';
14
-
15
- /**
16
- * Component display name.
17
- */
18
-
19
- var COMPONENT_NAME = 'DatePicker';
20
- /**
21
- * Component default class name and class prefix.
22
- */
23
-
24
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
25
-
26
- var moment = extendMoment(moment$1);
27
- var DAYS_PER_WEEK = 7;
28
-
29
- /**
30
- * Get the list of days in a week based on locale.
31
- *
32
- * @param locale The locale using to generate the order of days in a week.
33
- * @return The list of days in a week based on locale.
34
- */
35
- function getWeekDays(locale) {
36
- return range(DAYS_PER_WEEK).map(function (_, i) {
37
- return moment().locale(locale).weekday(i);
38
- });
39
- }
40
- /**
41
- * Get month calendar based on locale and start date.
42
- *
43
- * @param locale The locale using to generate the order of days in a week.
44
- * @param selectedMonth The selected month.
45
- * @return The list of days in a week based on locale.
46
- */
47
-
48
- function getMonthCalendar(locale, selectedMonth) {
49
- var firstDayOfMonth = moment(selectedMonth).startOf('month');
50
- var endDayOfMonth = moment(selectedMonth).endOf('month'); // The first day of the week depends on the locale used. In FR the first day is a monday but in EN the first day is sunday
51
-
52
- var firstDay = firstDayOfMonth.locale(locale).startOf('week');
53
- var monthRange = moment.range(firstDay.toDate(), endDayOfMonth.toDate());
54
- return Array.from(monthRange.by('day'));
55
- }
56
- /**
57
- * Get month calendar based on locale and start date.
58
- * Each day is annotated to know if they are displayed and/or clickable.
59
- *
60
- * @param locale The locale using to generate the order of days in a week.
61
- * @param minDate The first selectable date.
62
- * @param maxDate The last selectable date.
63
- * @param selectedMonth The selected month.
64
- * @return The list of days in a week based on locale.
65
- */
66
-
67
- function getAnnotatedMonthCalendar(locale, minDate, maxDate, selectedMonth) {
68
- var month = moment(selectedMonth).locale(locale).month();
69
- var clickableRange = moment.range(minDate, maxDate);
70
- return getMonthCalendar(locale, selectedMonth).map(function (date) {
71
- return {
72
- date: date,
73
- isClickable: clickableRange.contains(date),
74
- isDisplayed: date.month() === month,
75
- isToday: date.isSame(moment(), 'day')
76
- };
77
- });
78
- }
79
-
80
- /**
81
- * Defines the props of the component.
82
- */
83
-
84
- /**
85
- * Component display name.
86
- */
87
- var COMPONENT_NAME$1 = 'DatePickerControlled';
88
- /**
89
- * DatePickerControlled component.
90
- *
91
- * @param props Component props.
92
- * @param ref Component ref.
93
- * @return React element.
94
- */
95
-
96
- var DatePickerControlled = forwardRef(function (props, ref) {
97
- var locale = props.locale,
98
- maxDate = props.maxDate,
99
- minDate = props.minDate,
100
- nextButtonProps = props.nextButtonProps,
101
- onChange = props.onChange,
102
- onNextMonthChange = props.onNextMonthChange,
103
- onPrevMonthChange = props.onPrevMonthChange,
104
- previousButtonProps = props.previousButtonProps,
105
- selectedMonth = props.selectedMonth,
106
- todayOrSelectedDateRef = props.todayOrSelectedDateRef,
107
- value = props.value;
108
- var days = React.useMemo(function () {
109
- return getAnnotatedMonthCalendar(locale, minDate, maxDate, moment$1(selectedMonth));
110
- }, [locale, minDate, maxDate, selectedMonth]);
111
- var weekDays = React.useMemo(function () {
112
- return getWeekDays(locale);
113
- }, [locale]);
114
- return React.createElement("div", {
115
- ref: ref,
116
- className: "".concat(CLASSNAME)
117
- }, React.createElement(Toolbar, {
118
- className: "".concat(CLASSNAME, "__toolbar"),
119
- after: React.createElement(IconButton, _extends({}, nextButtonProps, {
120
- emphasis: Emphasis.low,
121
- icon: mdiChevronRight,
122
- onClick: onNextMonthChange
123
- })),
124
- before: React.createElement(IconButton, _extends({}, previousButtonProps, {
125
- emphasis: Emphasis.low,
126
- icon: mdiChevronLeft,
127
- onClick: onPrevMonthChange
128
- })),
129
- label: React.createElement("span", {
130
- className: "".concat(CLASSNAME, "__month")
131
- }, moment$1(selectedMonth).locale(locale).format('MMMM YYYY'))
132
- }), React.createElement("div", {
133
- className: "".concat(CLASSNAME, "__calendar")
134
- }, React.createElement("div", {
135
- className: "".concat(CLASSNAME, "__week-days ").concat(CLASSNAME, "__days-wrapper")
136
- }, weekDays.map(function (weekDay) {
137
- return React.createElement("div", {
138
- key: weekDay.unix(),
139
- className: "".concat(CLASSNAME, "__day-wrapper")
140
- }, React.createElement("span", {
141
- className: "".concat(CLASSNAME, "__week-day")
142
- }, weekDay.format('dddd').slice(0, 1).toLocaleUpperCase()));
143
- })), React.createElement("div", {
144
- className: "".concat(CLASSNAME, "__month-days ").concat(CLASSNAME, "__days-wrapper")
145
- }, days.map(function (annotatedDate) {
146
- if (annotatedDate.isDisplayed) {
147
- var _classNames;
148
-
149
- return React.createElement("div", {
150
- key: annotatedDate.date.unix(),
151
- className: "".concat(CLASSNAME, "__day-wrapper")
152
- }, React.createElement("button", {
153
- ref: value && annotatedDate.date.isSame(value, 'day') || !value && annotatedDate.isToday ? todayOrSelectedDateRef : null,
154
- className: classnames("".concat(CLASSNAME, "__month-day"), (_classNames = {}, _defineProperty(_classNames, "".concat(CLASSNAME, "__month-day--is-selected"), value && annotatedDate.date.isSame(value, 'day')), _defineProperty(_classNames, "".concat(CLASSNAME, "__month-day--is-today"), annotatedDate.isClickable && annotatedDate.isToday), _classNames)),
155
- disabled: !annotatedDate.isClickable,
156
- type: "button",
157
- onClick: function onClick() {
158
- return onChange(moment$1(annotatedDate.date).toDate());
159
- }
160
- }, React.createElement("span", null, annotatedDate.date.format('DD'))));
161
- }
162
-
163
- return React.createElement("div", {
164
- key: annotatedDate.date.unix(),
165
- className: "".concat(CLASSNAME, "__day-wrapper")
166
- });
167
- }))));
168
- });
169
- DatePickerControlled.displayName = COMPONENT_NAME$1;
170
- DatePickerControlled.className = CLASSNAME;
171
-
172
- /**
173
- * DatePicker component.
174
- *
175
- * @param props Component props.
176
- * @param ref Component ref.
177
- * @return React element.
178
- */
179
- var DatePicker = forwardRef(function (props, ref) {
180
- var defaultMonth = props.defaultMonth,
181
- locale = props.locale,
182
- value = props.value,
183
- onChange = props.onChange,
184
- forwardedProps = _objectWithoutProperties(props, ["defaultMonth", "locale", "value", "onChange"]);
185
-
186
- var castedValue;
187
-
188
- if (value) {
189
- castedValue = moment$1(value);
190
- } else if (defaultMonth) {
191
- castedValue = moment$1(defaultMonth);
192
- }
193
-
194
- if (castedValue && !castedValue.isValid()) {
195
- // eslint-disable-next-line no-console
196
- console.warn("[@lumx/react/DatePicker] Invalid date provided ".concat(castedValue));
197
- }
198
-
199
- var selectedDay = castedValue && castedValue.isValid() ? castedValue : moment$1();
200
-
201
- var _useState = useState(0),
202
- _useState2 = _slicedToArray(_useState, 2),
203
- monthOffset = _useState2[0],
204
- setMonthOffset = _useState2[1];
205
-
206
- var setPrevMonth = function setPrevMonth() {
207
- return setMonthOffset(monthOffset - 1);
208
- };
209
-
210
- var setNextMonth = function setNextMonth() {
211
- return setMonthOffset(monthOffset + 1);
212
- };
213
-
214
- var onDatePickerChange = function onDatePickerChange(newDate) {
215
- onChange(newDate);
216
- setMonthOffset(0);
217
- };
218
-
219
- var selectedMonth = moment$1(selectedDay).locale(locale).add(monthOffset, 'months').toDate();
220
- return React.createElement(DatePickerControlled, _extends({
221
- ref: ref
222
- }, forwardedProps, {
223
- defaultMonth: defaultMonth,
224
- locale: locale,
225
- value: value,
226
- onPrevMonthChange: setPrevMonth,
227
- onNextMonthChange: setNextMonth,
228
- selectedMonth: selectedMonth,
229
- onChange: onDatePickerChange
230
- }));
231
- });
232
- DatePicker.displayName = COMPONENT_NAME;
233
- DatePicker.className = CLASSNAME;
234
-
235
- /**
236
- * Component display name.
237
- */
238
- var COMPONENT_NAME$2 = 'DatePickerField';
239
- /**
240
- * DatePickerField component.
241
- *
242
- * @param props Component props.
243
- * @param ref Component ref.
244
- * @return React element.
245
- */
246
-
247
- var DatePickerField = forwardRef(function (props, ref) {
248
- var defaultMonth = props.defaultMonth,
249
- disabled = props.disabled,
250
- _props$isDisabled = props.isDisabled,
251
- isDisabled = _props$isDisabled === void 0 ? disabled : _props$isDisabled,
252
- locale = props.locale,
253
- maxDate = props.maxDate,
254
- minDate = props.minDate,
255
- name = props.name,
256
- nextButtonProps = props.nextButtonProps,
257
- onChange = props.onChange,
258
- previousButtonProps = props.previousButtonProps,
259
- value = props.value,
260
- forwardedProps = _objectWithoutProperties(props, ["defaultMonth", "disabled", "isDisabled", "locale", "maxDate", "minDate", "name", "nextButtonProps", "onChange", "previousButtonProps", "value"]);
261
-
262
- var _useState = useState(null),
263
- _useState2 = _slicedToArray(_useState, 2),
264
- wrapperElement = _useState2[0],
265
- setWrapperElement = _useState2[1];
266
-
267
- var anchorRef = useRef(null);
268
-
269
- var _useState3 = useState(false),
270
- _useState4 = _slicedToArray(_useState3, 2),
271
- isOpen = _useState4[0],
272
- setIsOpen = _useState4[1];
273
-
274
- var toggleSimpleMenu = function toggleSimpleMenu() {
275
- setIsOpen(!isOpen);
276
- };
277
-
278
- var onClose = useCallback(function () {
279
- setIsOpen(false);
280
- }, []);
281
- useFocus(anchorRef.current, isOpen);
282
-
283
- var handleKeyboardNav = function handleKeyboardNav(evt) {
284
- if ((evt.key === 'Enter' || evt.key === ' ') && toggleSimpleMenu) {
285
- toggleSimpleMenu();
286
- }
287
- }; // Handle focus trap.
288
-
289
-
290
- var _useState5 = useState(null),
291
- _useState6 = _slicedToArray(_useState5, 2),
292
- todayOrSelectedDate = _useState6[0],
293
- setTodayOrSelectedDate = _useState6[1];
294
-
295
- useFocusTrap(isOpen && wrapperElement, todayOrSelectedDate);
296
-
297
- var onTextFieldChange = function onTextFieldChange(textFieldValue, textFieldName, event) {
298
- if (!textFieldValue) {
299
- onChange(undefined, textFieldName, event);
300
- }
301
- };
302
-
303
- var onDatePickerChange = function onDatePickerChange(newDate) {
304
- onChange(newDate, name);
305
- onClose();
306
- };
307
-
308
- return React.createElement(React.Fragment, null, React.createElement(TextField, _extends({
309
- ref: ref
310
- }, forwardedProps, {
311
- name: name,
312
- forceFocusStyle: isOpen,
313
- textFieldRef: anchorRef,
314
- value: value ? moment$1(value).locale(locale).format('LL') : '',
315
- onClick: toggleSimpleMenu,
316
- onChange: onTextFieldChange,
317
- onKeyPress: handleKeyboardNav,
318
- isDisabled: isDisabled,
319
- readOnly: true
320
- })), isOpen ? React.createElement(Popover, {
321
- anchorRef: anchorRef,
322
- placement: Placement.BOTTOM_START,
323
- isOpen: isOpen,
324
- onClose: onClose,
325
- closeOnClickAway: true,
326
- closeOnEscape: true
327
- }, React.createElement(DatePicker, {
328
- ref: setWrapperElement,
329
- locale: locale,
330
- maxDate: maxDate,
331
- minDate: minDate,
332
- value: value,
333
- onChange: onDatePickerChange,
334
- todayOrSelectedDateRef: setTodayOrSelectedDate,
335
- defaultMonth: defaultMonth,
336
- nextButtonProps: nextButtonProps,
337
- previousButtonProps: previousButtonProps
338
- })) : null);
339
- });
340
- DatePickerField.displayName = COMPONENT_NAME$2;
341
-
342
- export { DatePicker as D, DatePickerControlled as a, DatePickerField as b };
343
- //# sourceMappingURL=13e759f3.js.map