@lumx/react 3.0.2 → 3.0.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 (391) hide show
  1. package/{esm/_internal/_rollupPluginBabelHelpers.js → _internal/ClickAwayProvider.js} +107 -2
  2. package/_internal/ClickAwayProvider.js.map +1 -0
  3. package/_internal/types.d.ts +271 -0
  4. package/index.d.ts +2686 -0
  5. package/index.js +12533 -0
  6. package/index.js.map +1 -0
  7. package/package.json +7 -6
  8. package/src/components/alert-dialog/AlertDialog.tsx +2 -1
  9. package/src/components/autocomplete/Autocomplete.tsx +2 -2
  10. package/src/components/autocomplete/AutocompleteMultiple.tsx +2 -1
  11. package/src/components/avatar/Avatar.tsx +2 -1
  12. package/src/components/badge/Badge.test.tsx +1 -1
  13. package/src/components/badge/Badge.tsx +2 -1
  14. package/src/components/button/Button.test.tsx +1 -1
  15. package/src/components/button/Button.tsx +2 -1
  16. package/src/components/button/ButtonGroup.tsx +2 -1
  17. package/src/components/button/ButtonRoot.test.tsx +1 -1
  18. package/src/components/button/ButtonRoot.tsx +2 -1
  19. package/src/components/button/IconButton.tsx +2 -1
  20. package/src/components/checkbox/Checkbox.test.tsx +1 -1
  21. package/src/components/checkbox/Checkbox.tsx +2 -1
  22. package/src/components/chip/Chip.test.tsx +1 -1
  23. package/src/components/chip/Chip.tsx +3 -1
  24. package/src/components/chip/ChipGroup.tsx +2 -1
  25. package/src/components/comment-block/CommentBlock.tsx +2 -1
  26. package/src/components/date-picker/DatePicker.tsx +1 -1
  27. package/src/components/date-picker/DatePickerControlled.tsx +1 -1
  28. package/src/components/date-picker/DatePickerField.tsx +1 -1
  29. package/src/components/date-picker/constants.ts +1 -1
  30. package/src/components/date-picker/types.ts +1 -1
  31. package/src/components/dialog/Dialog.tsx +4 -8
  32. package/src/components/divider/Divider.test.tsx +1 -1
  33. package/src/components/divider/Divider.tsx +3 -2
  34. package/src/components/drag-handle/DragHandle.tsx +2 -1
  35. package/src/components/dropdown/Dropdown.tsx +2 -1
  36. package/src/components/expansion-panel/ExpansionPanel.test.tsx +1 -1
  37. package/src/components/expansion-panel/ExpansionPanel.tsx +3 -10
  38. package/src/components/flag/Flag.test.tsx +1 -1
  39. package/src/components/flag/Flag.tsx +2 -1
  40. package/src/components/flex-box/FlexBox.stories.tsx +8 -0
  41. package/src/components/flex-box/FlexBox.tsx +7 -3
  42. package/src/components/flex-box/__snapshots__/FlexBox.test.tsx.snap +16 -0
  43. package/src/components/generic-block/GenericBlock.stories.jsx +23 -1
  44. package/src/components/generic-block/GenericBlock.tsx +18 -4
  45. package/src/components/generic-block/constants.ts +9 -0
  46. package/src/components/generic-block/index.ts +1 -0
  47. package/src/components/grid/Grid.tsx +2 -1
  48. package/src/components/grid/GridItem.tsx +2 -1
  49. package/src/components/heading/Heading.tsx +2 -1
  50. package/src/components/heading/HeadingLevelProvider.tsx +1 -1
  51. package/src/components/heading/context.tsx +1 -1
  52. package/src/components/icon/Icon.test.tsx +1 -1
  53. package/src/components/icon/Icon.tsx +2 -1
  54. package/src/components/image-block/ImageBlock.tsx +2 -1
  55. package/src/components/index.ts +1 -1
  56. package/src/components/inline-list/InlineList.stories.tsx +40 -0
  57. package/src/components/inline-list/InlineList.test.tsx +41 -0
  58. package/src/components/inline-list/InlineList.tsx +80 -0
  59. package/src/components/inline-list/index.ts +1 -0
  60. package/src/components/input-helper/InputHelper.tsx +2 -1
  61. package/src/components/input-label/InputLabel.tsx +2 -1
  62. package/src/components/lightbox/Lightbox.tsx +2 -1
  63. package/src/components/link/Link.tsx +2 -1
  64. package/src/components/link-preview/LinkPreview.test.tsx +1 -1
  65. package/src/components/link-preview/LinkPreview.tsx +2 -1
  66. package/src/components/list/List.tsx +2 -1
  67. package/src/components/list/ListDivider.tsx +2 -1
  68. package/src/components/list/ListItem.tsx +3 -8
  69. package/src/components/list/ListSubheader.tsx +2 -1
  70. package/src/components/list/useInteractiveList.tsx +1 -1
  71. package/src/components/message/Message.test.tsx +1 -1
  72. package/src/components/message/Message.tsx +2 -1
  73. package/src/components/mosaic/Mosaic.tsx +2 -1
  74. package/src/components/notification/Notification.tsx +2 -1
  75. package/src/components/popover/Popover.tsx +2 -1
  76. package/src/components/post-block/PostBlock.tsx +2 -1
  77. package/src/components/progress/Progress.tsx +2 -1
  78. package/src/components/progress-tracker/ProgressTracker.tsx +2 -1
  79. package/src/components/progress-tracker/ProgressTrackerStep.test.tsx +1 -1
  80. package/src/components/progress-tracker/ProgressTrackerStep.tsx +2 -1
  81. package/src/components/progress-tracker/ProgressTrackerStepPanel.tsx +2 -1
  82. package/src/components/radio-button/RadioButton.test.tsx +1 -1
  83. package/src/components/radio-button/RadioButton.tsx +2 -1
  84. package/src/components/radio-button/RadioGroup.tsx +2 -1
  85. package/src/components/select/Select.test.tsx +1 -1
  86. package/src/components/select/Select.tsx +2 -1
  87. package/src/components/select/SelectMultiple.test.tsx +1 -1
  88. package/src/components/select/SelectMultiple.tsx +2 -1
  89. package/src/components/select/WithSelectContext.tsx +1 -1
  90. package/src/components/select/constants.ts +1 -1
  91. package/src/components/side-navigation/SideNavigation.tsx +2 -1
  92. package/src/components/side-navigation/SideNavigationItem.test.tsx +1 -1
  93. package/src/components/side-navigation/SideNavigationItem.tsx +3 -9
  94. package/src/components/skeleton/SkeletonCircle.tsx +2 -1
  95. package/src/components/skeleton/SkeletonRectangle.tsx +2 -1
  96. package/src/components/skeleton/SkeletonTypography.tsx +2 -1
  97. package/src/components/slider/Slider.tsx +2 -1
  98. package/src/components/slideshow/Slides.tsx +2 -1
  99. package/src/components/slideshow/Slideshow.tsx +1 -1
  100. package/src/components/slideshow/SlideshowControls.tsx +2 -1
  101. package/src/components/slideshow/SlideshowItem.tsx +2 -1
  102. package/src/components/slideshow/SlideshowItemGroup.tsx +2 -1
  103. package/src/components/switch/Switch.test.tsx +1 -1
  104. package/src/components/switch/Switch.tsx +2 -1
  105. package/src/components/table/Table.tsx +2 -1
  106. package/src/components/table/TableBody.tsx +2 -1
  107. package/src/components/table/TableCell.tsx +3 -1
  108. package/src/components/table/TableHeader.tsx +2 -1
  109. package/src/components/table/TableRow.tsx +2 -1
  110. package/src/components/tabs/Tab.test.tsx +1 -1
  111. package/src/components/tabs/Tab.tsx +2 -1
  112. package/src/components/tabs/TabList.test.tsx +1 -1
  113. package/src/components/tabs/TabList.tsx +2 -1
  114. package/src/components/tabs/TabPanel.tsx +2 -1
  115. package/src/components/text/{Text.stories.tsx → Text.stories.jsx} +23 -28
  116. package/src/components/text/Text.test.tsx +15 -1
  117. package/src/components/text/Text.tsx +38 -12
  118. package/src/components/text-field/TextField.test.tsx +1 -1
  119. package/src/components/text-field/TextField.tsx +2 -1
  120. package/src/components/thumbnail/Thumbnail.tsx +2 -1
  121. package/src/components/thumbnail/types.ts +1 -1
  122. package/src/components/toolbar/Toolbar.tsx +2 -1
  123. package/src/components/tooltip/Tooltip.tsx +2 -1
  124. package/src/components/tooltip/useTooltipOpen.tsx +1 -1
  125. package/src/components/uploader/Uploader.test.tsx +1 -1
  126. package/src/components/uploader/Uploader.tsx +2 -1
  127. package/src/components/user-block/UserBlock.tsx +2 -1
  128. package/src/hooks/useCallbackOnEscape.ts +2 -1
  129. package/src/hooks/useClickAway.tsx +1 -1
  130. package/src/hooks/useDisableBodyScroll.ts +1 -1
  131. package/src/hooks/useFocusTrap.ts +1 -1
  132. package/src/hooks/useInterval.tsx +1 -1
  133. package/src/hooks/useOnResize.ts +1 -1
  134. package/src/index.ts +5 -0
  135. package/src/stories/generated/GenericBlock/Demos.stories.tsx +3 -1
  136. package/src/stories/generated/Heading/Demos.stories.tsx +6 -0
  137. package/src/stories/withResizableBox.tsx +18 -0
  138. package/src/testing/utils/commonTestsSuite.ts +1 -1
  139. package/src/utils/{getRootClassName.ts → className.ts} +19 -0
  140. package/src/utils/event.ts +1 -0
  141. package/src/utils/index.ts +5 -0
  142. package/src/utils/type.ts +3 -0
  143. package/src/utils/utils.test.ts +1 -1
  144. package/types.d.ts +68 -11
  145. package/utils/index.d.ts +29 -0
  146. package/utils/index.js +2 -0
  147. package/utils/index.js.map +1 -0
  148. package/esm/_internal/AlertDialog.js +0 -141
  149. package/esm/_internal/AlertDialog.js.map +0 -1
  150. package/esm/_internal/AutocompleteMultiple.js +0 -257
  151. package/esm/_internal/AutocompleteMultiple.js.map +0 -1
  152. package/esm/_internal/Avatar2.js +0 -82
  153. package/esm/_internal/Avatar2.js.map +0 -1
  154. package/esm/_internal/Badge2.js +0 -54
  155. package/esm/_internal/Badge2.js.map +0 -1
  156. package/esm/_internal/Button2.js +0 -84
  157. package/esm/_internal/Button2.js.map +0 -1
  158. package/esm/_internal/ButtonGroup.js +0 -51
  159. package/esm/_internal/ButtonGroup.js.map +0 -1
  160. package/esm/_internal/ButtonRoot.js +0 -135
  161. package/esm/_internal/ButtonRoot.js.map +0 -1
  162. package/esm/_internal/Checkbox2.js +0 -116
  163. package/esm/_internal/Checkbox2.js.map +0 -1
  164. package/esm/_internal/Chip2.js +0 -118
  165. package/esm/_internal/Chip2.js.map +0 -1
  166. package/esm/_internal/ChipGroup.js +0 -122
  167. package/esm/_internal/ChipGroup.js.map +0 -1
  168. package/esm/_internal/ClickAwayProvider.js +0 -217
  169. package/esm/_internal/ClickAwayProvider.js.map +0 -1
  170. package/esm/_internal/CommentBlock.js +0 -124
  171. package/esm/_internal/CommentBlock.js.map +0 -1
  172. package/esm/_internal/DatePickerField.js +0 -347
  173. package/esm/_internal/DatePickerField.js.map +0 -1
  174. package/esm/_internal/Dialog2.js +0 -274
  175. package/esm/_internal/Dialog2.js.map +0 -1
  176. package/esm/_internal/Divider2.js +0 -53
  177. package/esm/_internal/Divider2.js.map +0 -1
  178. package/esm/_internal/DragHandle.js +0 -50
  179. package/esm/_internal/DragHandle.js.map +0 -1
  180. package/esm/_internal/Dropdown2.js +0 -157
  181. package/esm/_internal/Dropdown2.js.map +0 -1
  182. package/esm/_internal/ExpansionPanel.js +0 -156
  183. package/esm/_internal/ExpansionPanel.js.map +0 -1
  184. package/esm/_internal/Flag2.js +0 -48
  185. package/esm/_internal/Flag2.js.map +0 -1
  186. package/esm/_internal/FlexBox.js +0 -55
  187. package/esm/_internal/FlexBox.js.map +0 -1
  188. package/esm/_internal/GenericBlock.js +0 -125
  189. package/esm/_internal/GenericBlock.js.map +0 -1
  190. package/esm/_internal/GridItem.js +0 -96
  191. package/esm/_internal/GridItem.js.map +0 -1
  192. package/esm/_internal/HeadingLevelProvider.js +0 -112
  193. package/esm/_internal/HeadingLevelProvider.js.map +0 -1
  194. package/esm/_internal/Icon2.js +0 -120
  195. package/esm/_internal/Icon2.js.map +0 -1
  196. package/esm/_internal/IconButton.js +0 -74
  197. package/esm/_internal/IconButton.js.map +0 -1
  198. package/esm/_internal/ImageBlock.js +0 -101
  199. package/esm/_internal/ImageBlock.js.map +0 -1
  200. package/esm/_internal/InputHelper.js +0 -72
  201. package/esm/_internal/InputHelper.js.map +0 -1
  202. package/esm/_internal/InputLabel.js +0 -58
  203. package/esm/_internal/InputLabel.js.map +0 -1
  204. package/esm/_internal/Lightbox2.js +0 -123
  205. package/esm/_internal/Lightbox2.js.map +0 -1
  206. package/esm/_internal/Link2.js +0 -122
  207. package/esm/_internal/Link2.js.map +0 -1
  208. package/esm/_internal/LinkPreview.js +0 -105
  209. package/esm/_internal/LinkPreview.js.map +0 -1
  210. package/esm/_internal/List2.js +0 -799
  211. package/esm/_internal/List2.js.map +0 -1
  212. package/esm/_internal/ListSubheader.js +0 -79
  213. package/esm/_internal/ListSubheader.js.map +0 -1
  214. package/esm/_internal/Message2.js +0 -78
  215. package/esm/_internal/Message2.js.map +0 -1
  216. package/esm/_internal/Mosaic2.js +0 -89
  217. package/esm/_internal/Mosaic2.js.map +0 -1
  218. package/esm/_internal/Notification2.js +0 -133
  219. package/esm/_internal/Notification2.js.map +0 -1
  220. package/esm/_internal/Popover2.js +0 -2473
  221. package/esm/_internal/Popover2.js.map +0 -1
  222. package/esm/_internal/PostBlock.js +0 -96
  223. package/esm/_internal/PostBlock.js.map +0 -1
  224. package/esm/_internal/Progress2.js +0 -81
  225. package/esm/_internal/Progress2.js.map +0 -1
  226. package/esm/_internal/ProgressTrackerStepPanel.js +0 -313
  227. package/esm/_internal/ProgressTrackerStepPanel.js.map +0 -1
  228. package/esm/_internal/RadioGroup.js +0 -147
  229. package/esm/_internal/RadioGroup.js.map +0 -1
  230. package/esm/_internal/SelectMultiple.js +0 -424
  231. package/esm/_internal/SelectMultiple.js.map +0 -1
  232. package/esm/_internal/SideNavigationItem.js +0 -151
  233. package/esm/_internal/SideNavigationItem.js.map +0 -1
  234. package/esm/_internal/SkeletonTypography.js +0 -168
  235. package/esm/_internal/SkeletonTypography.js.map +0 -1
  236. package/esm/_internal/Slider2.js +0 -327
  237. package/esm/_internal/Slider2.js.map +0 -1
  238. package/esm/_internal/Slides.js +0 -864
  239. package/esm/_internal/Slides.js.map +0 -1
  240. package/esm/_internal/Switch2.js +0 -116
  241. package/esm/_internal/Switch2.js.map +0 -1
  242. package/esm/_internal/TabPanel.js +0 -280
  243. package/esm/_internal/TabPanel.js.map +0 -1
  244. package/esm/_internal/TableRow.js +0 -291
  245. package/esm/_internal/TableRow.js.map +0 -1
  246. package/esm/_internal/Text2.js +0 -63
  247. package/esm/_internal/Text2.js.map +0 -1
  248. package/esm/_internal/TextField.js +0 -322
  249. package/esm/_internal/TextField.js.map +0 -1
  250. package/esm/_internal/Thumbnail2.js +0 -301
  251. package/esm/_internal/Thumbnail2.js.map +0 -1
  252. package/esm/_internal/Toolbar2.js +0 -60
  253. package/esm/_internal/Toolbar2.js.map +0 -1
  254. package/esm/_internal/Tooltip2.js +0 -282
  255. package/esm/_internal/Tooltip2.js.map +0 -1
  256. package/esm/_internal/Uploader2.js +0 -84
  257. package/esm/_internal/Uploader2.js.map +0 -1
  258. package/esm/_internal/UserBlock.js +0 -132
  259. package/esm/_internal/UserBlock.js.map +0 -1
  260. package/esm/_internal/_rollupPluginBabelHelpers.js.map +0 -1
  261. package/esm/_internal/alert-dialog.js +0 -34
  262. package/esm/_internal/alert-dialog.js.map +0 -1
  263. package/esm/_internal/autocomplete.js +0 -32
  264. package/esm/_internal/autocomplete.js.map +0 -1
  265. package/esm/_internal/avatar.js +0 -13
  266. package/esm/_internal/avatar.js.map +0 -1
  267. package/esm/_internal/badge.js +0 -10
  268. package/esm/_internal/badge.js.map +0 -1
  269. package/esm/_internal/button.js +0 -25
  270. package/esm/_internal/button.js.map +0 -1
  271. package/esm/_internal/checkbox.js +0 -14
  272. package/esm/_internal/checkbox.js.map +0 -1
  273. package/esm/_internal/chip.js +0 -12
  274. package/esm/_internal/chip.js.map +0 -1
  275. package/esm/_internal/comment-block.js +0 -24
  276. package/esm/_internal/comment-block.js.map +0 -1
  277. package/esm/_internal/components.js +0 -156
  278. package/esm/_internal/components.js.map +0 -1
  279. package/esm/_internal/constants.js +0 -13
  280. package/esm/_internal/constants.js.map +0 -1
  281. package/esm/_internal/date-picker.js +0 -32
  282. package/esm/_internal/date-picker.js.map +0 -1
  283. package/esm/_internal/dialog.js +0 -27
  284. package/esm/_internal/dialog.js.map +0 -1
  285. package/esm/_internal/divider.js +0 -10
  286. package/esm/_internal/divider.js.map +0 -1
  287. package/esm/_internal/drag-handle.js +0 -11
  288. package/esm/_internal/drag-handle.js.map +0 -1
  289. package/esm/_internal/dropdown.js +0 -21
  290. package/esm/_internal/dropdown.js.map +0 -1
  291. package/esm/_internal/expansion-panel.js +0 -32
  292. package/esm/_internal/expansion-panel.js.map +0 -1
  293. package/esm/_internal/flag.js +0 -11
  294. package/esm/_internal/flag.js.map +0 -1
  295. package/esm/_internal/flex-box.js +0 -11
  296. package/esm/_internal/flex-box.js.map +0 -1
  297. package/esm/_internal/generic-block.js +0 -20
  298. package/esm/_internal/generic-block.js.map +0 -1
  299. package/esm/_internal/getRootClassName.js +0 -346
  300. package/esm/_internal/getRootClassName.js.map +0 -1
  301. package/esm/_internal/grid.js +0 -10
  302. package/esm/_internal/grid.js.map +0 -1
  303. package/esm/_internal/heading.js +0 -11
  304. package/esm/_internal/heading.js.map +0 -1
  305. package/esm/_internal/icon.js +0 -10
  306. package/esm/_internal/icon.js.map +0 -1
  307. package/esm/_internal/image-block.js +0 -14
  308. package/esm/_internal/image-block.js.map +0 -1
  309. package/esm/_internal/input-helper.js +0 -10
  310. package/esm/_internal/input-helper.js.map +0 -1
  311. package/esm/_internal/input-label.js +0 -10
  312. package/esm/_internal/input-label.js.map +0 -1
  313. package/esm/_internal/lightbox.js +0 -27
  314. package/esm/_internal/lightbox.js.map +0 -1
  315. package/esm/_internal/link-preview.js +0 -15
  316. package/esm/_internal/link-preview.js.map +0 -1
  317. package/esm/_internal/link.js +0 -12
  318. package/esm/_internal/link.js.map +0 -1
  319. package/esm/_internal/list.js +0 -15
  320. package/esm/_internal/list.js.map +0 -1
  321. package/esm/_internal/mergeRefs.js +0 -25
  322. package/esm/_internal/mergeRefs.js.map +0 -1
  323. package/esm/_internal/message.js +0 -11
  324. package/esm/_internal/message.js.map +0 -1
  325. package/esm/_internal/mosaic.js +0 -14
  326. package/esm/_internal/mosaic.js.map +0 -1
  327. package/esm/_internal/notification.js +0 -18
  328. package/esm/_internal/notification.js.map +0 -1
  329. package/esm/_internal/partitionMulti.js +0 -27
  330. package/esm/_internal/partitionMulti.js.map +0 -1
  331. package/esm/_internal/popover.js +0 -15
  332. package/esm/_internal/popover.js.map +0 -1
  333. package/esm/_internal/post-block.js +0 -15
  334. package/esm/_internal/post-block.js.map +0 -1
  335. package/esm/_internal/progress-tracker.js +0 -17
  336. package/esm/_internal/progress-tracker.js.map +0 -1
  337. package/esm/_internal/progress.js +0 -10
  338. package/esm/_internal/progress.js.map +0 -1
  339. package/esm/_internal/radio-button.js +0 -13
  340. package/esm/_internal/radio-button.js.map +0 -1
  341. package/esm/_internal/renderLink.js +0 -25
  342. package/esm/_internal/renderLink.js.map +0 -1
  343. package/esm/_internal/select.js +0 -31
  344. package/esm/_internal/select.js.map +0 -1
  345. package/esm/_internal/side-navigation.js +0 -25
  346. package/esm/_internal/side-navigation.js.map +0 -1
  347. package/esm/_internal/skeleton.js +0 -10
  348. package/esm/_internal/skeleton.js.map +0 -1
  349. package/esm/_internal/slider.js +0 -13
  350. package/esm/_internal/slider.js.map +0 -1
  351. package/esm/_internal/slideshow.js +0 -29
  352. package/esm/_internal/slideshow.js.map +0 -1
  353. package/esm/_internal/state.js +0 -145
  354. package/esm/_internal/state.js.map +0 -1
  355. package/esm/_internal/switch.js +0 -13
  356. package/esm/_internal/switch.js.map +0 -1
  357. package/esm/_internal/table.js +0 -12
  358. package/esm/_internal/table.js.map +0 -1
  359. package/esm/_internal/tabs.js +0 -15
  360. package/esm/_internal/tabs.js.map +0 -1
  361. package/esm/_internal/text-field.js +0 -26
  362. package/esm/_internal/text-field.js.map +0 -1
  363. package/esm/_internal/text.js +0 -10
  364. package/esm/_internal/text.js.map +0 -1
  365. package/esm/_internal/thumbnail.js +0 -13
  366. package/esm/_internal/thumbnail.js.map +0 -1
  367. package/esm/_internal/toolbar.js +0 -9
  368. package/esm/_internal/toolbar.js.map +0 -1
  369. package/esm/_internal/tooltip.js +0 -18
  370. package/esm/_internal/tooltip.js.map +0 -1
  371. package/esm/_internal/type.js +0 -40
  372. package/esm/_internal/type.js.map +0 -1
  373. package/esm/_internal/types.js +0 -23
  374. package/esm/_internal/types.js.map +0 -1
  375. package/esm/_internal/uploader.js +0 -11
  376. package/esm/_internal/uploader.js.map +0 -1
  377. package/esm/_internal/useDelayedVisibility.js +0 -47
  378. package/esm/_internal/useDelayedVisibility.js.map +0 -1
  379. package/esm/_internal/useDisableBodyScroll.js +0 -220
  380. package/esm/_internal/useDisableBodyScroll.js.map +0 -1
  381. package/esm/_internal/useFocusTrap.js +0 -86
  382. package/esm/_internal/useFocusTrap.js.map +0 -1
  383. package/esm/_internal/useRovingTabIndex.js +0 -87
  384. package/esm/_internal/useRovingTabIndex.js.map +0 -1
  385. package/esm/_internal/user-block.js +0 -17
  386. package/esm/_internal/user-block.js.map +0 -1
  387. package/esm/index.js +0 -95
  388. package/esm/index.js.map +0 -1
  389. package/esm/index2.js +0 -16
  390. package/esm/index2.js.map +0 -1
  391. package/src/utils/index.tsx +0 -7
@@ -1,74 +0,0 @@
1
- import { b as _objectWithoutProperties, c as _extends, _ as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
2
- import { Emphasis, Size, Theme } from './components.js';
3
- import React, { forwardRef } from 'react';
4
- import { g as getRootClassName } from './getRootClassName.js';
5
- import { I as Icon } from './Icon2.js';
6
- import 'lodash/isBoolean';
7
- import 'lodash/isEmpty';
8
- import 'lodash/kebabCase';
9
- import 'lodash/noop';
10
- import { B as ButtonRoot } from './ButtonRoot.js';
11
- import { T as Tooltip } from './Tooltip2.js';
12
-
13
- /**
14
- * Component display name.
15
- */
16
- var COMPONENT_NAME = 'IconButton';
17
- /**
18
- * Component default class name and class prefix.
19
- */
20
-
21
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
22
- /**
23
- * Component default props.
24
- */
25
-
26
- var DEFAULT_PROPS = {
27
- emphasis: Emphasis.high,
28
- size: Size.m,
29
- theme: Theme.light
30
- };
31
- /**
32
- * IconButton component.
33
- *
34
- * @param props Component props.
35
- * @param ref Component ref.
36
- * @return React element.
37
- */
38
-
39
- var IconButton = forwardRef(function (props, ref) {
40
- var emphasis = props.emphasis,
41
- image = props.image,
42
- icon = props.icon,
43
- label = props.label,
44
- size = props.size,
45
- theme = props.theme,
46
- tooltipProps = props.tooltipProps,
47
- hideTooltip = props.hideTooltip,
48
- forwardedProps = _objectWithoutProperties(props, ["emphasis", "image", "icon", "label", "size", "theme", "tooltipProps", "hideTooltip"]);
49
-
50
- return React.createElement(Tooltip, _extends({
51
- label: hideTooltip ? '' : label
52
- }, tooltipProps), React.createElement(ButtonRoot, _extends({
53
- ref: ref
54
- }, _objectSpread2({
55
- emphasis: emphasis,
56
- size: size,
57
- theme: theme
58
- }, forwardedProps), {
59
- "aria-label": label,
60
- variant: "icon"
61
- }), image ? React.createElement("img", {
62
- // no need to set alt as an aria-label is already set on the button
63
- alt: "",
64
- src: image
65
- }) : React.createElement(Icon, {
66
- icon: icon
67
- })));
68
- });
69
- IconButton.displayName = COMPONENT_NAME;
70
- IconButton.className = CLASSNAME;
71
- IconButton.defaultProps = DEFAULT_PROPS;
72
-
73
- export { IconButton as I };
74
- //# sourceMappingURL=IconButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IconButton.js","sources":["../../../src/components/button/IconButton.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { Emphasis, Icon, Size, Theme, Tooltip, TooltipProps } from '@lumx/react';\nimport { BaseButtonProps, ButtonRoot } from '@lumx/react/components/button/ButtonRoot';\nimport { Comp, getRootClassName } from '@lumx/react/utils';\n\nexport interface IconButtonProps extends BaseButtonProps {\n /**\n * Icon (SVG path).\n * If `image` is also set, `image` will be used instead.\n */\n icon?: string;\n /**\n * Image (image url).\n * Has priority over `icon`.\n */\n image?: string;\n /**\n * Label text (required for a11y purpose).\n * If you really don't want an aria-label, you can set an empty label (this is not recommended).\n */\n label: string;\n /**\n * Props to pass to the tooltip.\n * If undefined or if tooltipProps.label is undefined, the label prop will be used as tooltip label.\n * */\n tooltipProps?: Partial<TooltipProps>;\n /** Whether the tooltip should be hidden or not. */\n hideTooltip?: boolean;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'IconButton';\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<IconButtonProps> = {\n emphasis: Emphasis.high,\n size: Size.m,\n theme: Theme.light,\n};\n\n/**\n * IconButton component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const IconButton: Comp<IconButtonProps, HTMLButtonElement> = forwardRef((props, ref) => {\n const { emphasis, image, icon, label, size, theme, tooltipProps, hideTooltip, ...forwardedProps } = props;\n\n return (\n <Tooltip label={hideTooltip ? '' : label} {...tooltipProps}>\n <ButtonRoot ref={ref} {...{ emphasis, size, theme, ...forwardedProps }} aria-label={label} variant=\"icon\">\n {image ? (\n <img\n // no need to set alt as an aria-label is already set on the button\n alt=\"\"\n src={image}\n />\n ) : (\n <Icon icon={icon as string} />\n )}\n </ButtonRoot>\n </Tooltip>\n );\n});\nIconButton.displayName = COMPONENT_NAME;\nIconButton.className = CLASSNAME;\nIconButton.defaultProps = DEFAULT_PROPS;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","emphasis","Emphasis","high","size","Size","m","theme","Theme","light","IconButton","forwardRef","props","ref","image","icon","label","tooltipProps","hideTooltip","forwardedProps","displayName","className","defaultProps"],"mappings":";;;;;;;;;;;;AA+BA;;;AAGA,IAAMA,cAAc,GAAG,YAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAuC,GAAG;AAC5CC,EAAAA,QAAQ,EAAEC,QAAQ,CAACC,IADyB;AAE5CC,EAAAA,IAAI,EAAEC,IAAI,CAACC,CAFiC;AAG5CC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAH+B,CAAhD;AAMA;;;;;;;;IAOaC,UAAoD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MACnFZ,QADmF,GACSW,KADT,CACnFX,QADmF;AAAA,MACzEa,KADyE,GACSF,KADT,CACzEE,KADyE;AAAA,MAClEC,IADkE,GACSH,KADT,CAClEG,IADkE;AAAA,MAC5DC,KAD4D,GACSJ,KADT,CAC5DI,KAD4D;AAAA,MACrDZ,IADqD,GACSQ,KADT,CACrDR,IADqD;AAAA,MAC/CG,KAD+C,GACSK,KADT,CAC/CL,KAD+C;AAAA,MACxCU,YADwC,GACSL,KADT,CACxCK,YADwC;AAAA,MAC1BC,WAD0B,GACSN,KADT,CAC1BM,WAD0B;AAAA,MACVC,cADU,4BACSP,KADT;;AAG3F,SACI,oBAAC,OAAD;AAAS,IAAA,KAAK,EAAEM,WAAW,GAAG,EAAH,GAAQF;AAAnC,KAA8CC,YAA9C,GACI,oBAAC,UAAD;AAAY,IAAA,GAAG,EAAEJ;AAAjB;AAA4BZ,IAAAA,QAAQ,EAARA,QAA5B;AAAsCG,IAAAA,IAAI,EAAJA,IAAtC;AAA4CG,IAAAA,KAAK,EAALA;AAA5C,KAAsDY,cAAtD;AAAwE,kBAAYH,KAApF;AAA2F,IAAA,OAAO,EAAC;AAAnG,MACKF,KAAK,GACF;AACI;AACA,IAAA,GAAG,EAAC,EAFR;AAGI,IAAA,GAAG,EAAEA;AAHT,IADE,GAOF,oBAAC,IAAD;AAAM,IAAA,IAAI,EAAEC;AAAZ,IARR,CADJ,CADJ;AAeH,CAlB6E;AAmB9EL,UAAU,CAACU,WAAX,GAAyBvB,cAAzB;AACAa,UAAU,CAACW,SAAX,GAAuBvB,SAAvB;AACAY,UAAU,CAACY,YAAX,GAA0BtB,aAA1B;;;;"}
@@ -1,101 +0,0 @@
1
- import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
2
- import { Theme, Alignment } from './components.js';
3
- import React, { forwardRef } from 'react';
4
- import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getRootClassName.js';
5
- import isObject from 'lodash/isObject';
6
- import { T as Thumbnail } from './Thumbnail2.js';
7
-
8
- /**
9
- * Image block variants.
10
- */
11
- var ImageBlockCaptionPosition = {
12
- below: 'below',
13
- over: 'over'
14
- };
15
-
16
- /**
17
- * Component display name.
18
- */
19
- var COMPONENT_NAME = 'ImageBlock';
20
- /**
21
- * Component default class name and class prefix.
22
- */
23
-
24
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
25
- /**
26
- * Component default props.
27
- */
28
-
29
- var DEFAULT_PROPS = {
30
- captionPosition: ImageBlockCaptionPosition.below,
31
- theme: Theme.light,
32
- align: Alignment.left
33
- };
34
- /**
35
- * ImageBlock component.
36
- *
37
- * @param props Component props.
38
- * @param ref Component ref.
39
- * @return React element.
40
- */
41
-
42
- var ImageBlock = forwardRef(function (props, ref) {
43
- var actions = props.actions,
44
- align = props.align,
45
- alt = props.alt,
46
- captionPosition = props.captionPosition,
47
- captionStyle = props.captionStyle,
48
- className = props.className,
49
- description = props.description,
50
- fillHeight = props.fillHeight,
51
- image = props.image,
52
- size = props.size,
53
- tags = props.tags,
54
- theme = props.theme,
55
- thumbnailProps = props.thumbnailProps,
56
- title = props.title,
57
- forwardedProps = _objectWithoutProperties(props, ["actions", "align", "alt", "captionPosition", "captionStyle", "className", "description", "fillHeight", "image", "size", "tags", "theme", "thumbnailProps", "title"]);
58
-
59
- return React.createElement("figure", _extends({
60
- ref: ref
61
- }, forwardedProps, {
62
- className: classnames(className, handleBasicClasses({
63
- prefix: CLASSNAME,
64
- captionPosition: captionPosition,
65
- align: align,
66
- size: size,
67
- theme: theme
68
- }), fillHeight && "".concat(CLASSNAME, "--fill-height"))
69
- }), React.createElement(Thumbnail, _extends({}, thumbnailProps, {
70
- className: classnames("".concat(CLASSNAME, "__image"), thumbnailProps === null || thumbnailProps === void 0 ? void 0 : thumbnailProps.className),
71
- fillHeight: fillHeight,
72
- align: align,
73
- image: image,
74
- size: size,
75
- theme: theme,
76
- alt: alt || title
77
- })), (title || description || tags) && React.createElement("figcaption", {
78
- className: "".concat(CLASSNAME, "__wrapper"),
79
- style: captionStyle
80
- }, (title || description) && React.createElement("div", {
81
- className: "".concat(CLASSNAME, "__caption")
82
- }, title && React.createElement("span", {
83
- className: "".concat(CLASSNAME, "__title")
84
- }, title), title && description && "\xA0", isObject(description) && description.__html ? // eslint-disable-next-line react/no-danger
85
- React.createElement("span", {
86
- dangerouslySetInnerHTML: description,
87
- className: "".concat(CLASSNAME, "__description")
88
- }) : React.createElement("span", {
89
- className: "".concat(CLASSNAME, "__description")
90
- }, description)), tags && React.createElement("div", {
91
- className: "".concat(CLASSNAME, "__tags")
92
- }, tags)), actions && React.createElement("div", {
93
- className: "".concat(CLASSNAME, "__actions")
94
- }, actions));
95
- });
96
- ImageBlock.displayName = COMPONENT_NAME;
97
- ImageBlock.className = CLASSNAME;
98
- ImageBlock.defaultProps = DEFAULT_PROPS;
99
-
100
- export { ImageBlockCaptionPosition as I, ImageBlock as a };
101
- //# sourceMappingURL=ImageBlock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ImageBlock.js","sources":["../../../src/components/image-block/ImageBlock.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef, ReactNode } from 'react';\n\nimport classNames from 'classnames';\n\nimport isObject from 'lodash/isObject';\n\nimport { Alignment, HorizontalAlignment, Size, Theme, Thumbnail } from '@lumx/react';\n\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme, ValueOf } from '@lumx/react/utils';\nimport { ThumbnailProps } from '../thumbnail/Thumbnail';\n\n/**\n * Image block variants.\n */\nexport const ImageBlockCaptionPosition = {\n below: 'below',\n over: 'over',\n} as const;\nexport type ImageBlockCaptionPosition = ValueOf<typeof ImageBlockCaptionPosition>;\n\n/**\n * Image block sizes.\n */\nexport type ImageBlockSize = Extract<Size, 'xl' | 'xxl'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface ImageBlockProps extends GenericProps, HasTheme {\n /** Action toolbar content. */\n actions?: ReactNode;\n /** Alignment. */\n align?: HorizontalAlignment;\n /** Image alternative text. */\n alt: string;\n /** Caption position. */\n captionPosition?: ImageBlockCaptionPosition;\n /** Caption custom CSS style. */\n captionStyle?: CSSProperties;\n /** Image description. Can be either a string, or sanitized html. */\n description?: string | { __html: string };\n /** Whether the image has to fill its container height or not. */\n fillHeight?: boolean;\n /** Image URL. */\n image: string;\n /** Size variant. */\n size?: ImageBlockSize;\n /** Tag content. */\n tags?: ReactNode;\n /** Props to pass to the thumbnail (minus those already set by the ImageBlock props). */\n thumbnailProps?: Omit<ThumbnailProps, 'image' | 'size' | 'theme' | 'align' | 'fillHeight'>;\n /** Image title to display in the caption. */\n title?: string;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ImageBlock';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Component default props.\n */\nconst DEFAULT_PROPS: Partial<ImageBlockProps> = {\n captionPosition: ImageBlockCaptionPosition.below,\n theme: Theme.light,\n align: Alignment.left,\n};\n\n/**\n * ImageBlock component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ImageBlock: Comp<ImageBlockProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n actions,\n align,\n alt,\n captionPosition,\n captionStyle,\n className,\n description,\n fillHeight,\n image,\n size,\n tags,\n theme,\n thumbnailProps,\n title,\n ...forwardedProps\n } = props;\n return (\n <figure\n ref={ref}\n {...forwardedProps}\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n captionPosition,\n align,\n size,\n theme,\n }),\n fillHeight && `${CLASSNAME}--fill-height`,\n )}\n >\n <Thumbnail\n {...thumbnailProps}\n className={classNames(`${CLASSNAME}__image`, thumbnailProps?.className)}\n fillHeight={fillHeight}\n align={align}\n image={image}\n size={size}\n theme={theme}\n alt={(alt || title) as string}\n />\n {(title || description || tags) && (\n <figcaption className={`${CLASSNAME}__wrapper`} style={captionStyle}>\n {(title || description) && (\n <div className={`${CLASSNAME}__caption`}>\n {title && <span className={`${CLASSNAME}__title`}>{title}</span>}\n {/* Add an `&nbsp;` when there is description and title. */}\n {title && description && '\\u00A0'}\n {isObject(description) && description.__html ? (\n // eslint-disable-next-line react/no-danger\n <span dangerouslySetInnerHTML={description} className={`${CLASSNAME}__description`} />\n ) : (\n <span className={`${CLASSNAME}__description`}>{description}</span>\n )}\n </div>\n )}\n {tags && <div className={`${CLASSNAME}__tags`}>{tags}</div>}\n </figcaption>\n )}\n {actions && <div className={`${CLASSNAME}__actions`}>{actions}</div>}\n </figure>\n );\n});\nImageBlock.displayName = COMPONENT_NAME;\nImageBlock.className = CLASSNAME;\nImageBlock.defaultProps = DEFAULT_PROPS;\n"],"names":["ImageBlockCaptionPosition","below","over","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","captionPosition","theme","Theme","light","align","Alignment","left","ImageBlock","forwardRef","props","ref","actions","alt","captionStyle","className","description","fillHeight","image","size","tags","thumbnailProps","title","forwardedProps","classNames","handleBasicClasses","prefix","isObject","__html","displayName","defaultProps"],"mappings":";;;;;;;AAWA;;;IAGaA,yBAAyB,GAAG;AACrCC,EAAAA,KAAK,EAAE,OAD8B;AAErCC,EAAAA,IAAI,EAAE;AAF+B;;AAyCzC;;;AAGA,IAAMC,cAAc,GAAG,YAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAuC,GAAG;AAC5CC,EAAAA,eAAe,EAAEP,yBAAyB,CAACC,KADC;AAE5CO,EAAAA,KAAK,EAAEC,KAAK,CAACC,KAF+B;AAG5CC,EAAAA,KAAK,EAAEC,SAAS,CAACC;AAH2B,CAAhD;AAMA;;;;;;;;IAOaC,UAAiD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAEpFC,OAFoF,GAiBpFF,KAjBoF,CAEpFE,OAFoF;AAAA,MAGpFP,KAHoF,GAiBpFK,KAjBoF,CAGpFL,KAHoF;AAAA,MAIpFQ,GAJoF,GAiBpFH,KAjBoF,CAIpFG,GAJoF;AAAA,MAKpFZ,eALoF,GAiBpFS,KAjBoF,CAKpFT,eALoF;AAAA,MAMpFa,YANoF,GAiBpFJ,KAjBoF,CAMpFI,YANoF;AAAA,MAOpFC,SAPoF,GAiBpFL,KAjBoF,CAOpFK,SAPoF;AAAA,MAQpFC,WARoF,GAiBpFN,KAjBoF,CAQpFM,WARoF;AAAA,MASpFC,UAToF,GAiBpFP,KAjBoF,CASpFO,UAToF;AAAA,MAUpFC,KAVoF,GAiBpFR,KAjBoF,CAUpFQ,KAVoF;AAAA,MA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,IAAA,SAAS,YAAKxB,SAAL;AAAf,KAAyCwB,KAAzC,CADd,EAGKA,KAAK,IAAIN,WAAT,IAAwB,MAH7B,EAIKW,QAAQ,CAACX,WAAD,CAAR,IAAyBA,WAAW,CAACY,MAArC;AAEG;AAAM,IAAA,uBAAuB,EAAEZ,WAA/B;AAA4C,IAAA,SAAS,YAAKlB,SAAL;AAArD,IAFH,GAIG;AAAM,IAAA,SAAS,YAAKA,SAAL;AAAf,KAA+CkB,WAA/C,CARR,CAFR,EAcKI,IAAI,IAAI;AAAK,IAAA,SAAS,YAAKtB,SAAL;AAAd,KAAuCsB,IAAvC,CAdb,CA1BR,EA2CKR,OAAO,IAAI;AAAK,IAAA,SAAS,YAAKd,SAAL;AAAd,KAA0Cc,OAA1C,CA3ChB,CADJ;AA+CH,CAjE0E;AAkE3EJ,UAAU,CAACqB,WAAX,GAAyBhC,cAAzB;AACAW,UAAU,CAACO,SAAX,GAAuBjB,SAAvB;AACAU,UAAU,CAACsB,YAAX,GAA0B9B,aAA1B;;;;"}
@@ -1,72 +0,0 @@
1
- import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
2
- import { Kind, Theme } from './components.js';
3
- import React, { forwardRef } from 'react';
4
- import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getRootClassName.js';
5
-
6
- var INPUT_HELPER_CONFIGURATION = {
7
- error: {
8
- color: 'red'
9
- },
10
- success: {
11
- color: 'green'
12
- },
13
- warning: {
14
- color: 'yellow'
15
- }
16
- };
17
-
18
- /**
19
- * Defines the props of the component.
20
- */
21
-
22
- /**
23
- * Component display name.
24
- */
25
- var COMPONENT_NAME = 'InputHelper';
26
- /**
27
- * Component default class name and class prefix.
28
- */
29
-
30
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
31
- /**
32
- * Component default props.
33
- */
34
-
35
- var DEFAULT_PROPS = {
36
- kind: Kind.info,
37
- theme: Theme.light
38
- };
39
- /**
40
- * InputHelper component.
41
- *
42
- * @param props Component props.
43
- * @param ref Component ref.
44
- * @return React element.
45
- */
46
-
47
- var InputHelper = forwardRef(function (props, ref) {
48
- var children = props.children,
49
- className = props.className,
50
- kind = props.kind,
51
- theme = props.theme,
52
- forwardedProps = _objectWithoutProperties(props, ["children", "className", "kind", "theme"]);
53
-
54
- var _ref = INPUT_HELPER_CONFIGURATION[kind] || {},
55
- color = _ref.color;
56
-
57
- return React.createElement("span", _extends({
58
- ref: ref
59
- }, forwardedProps, {
60
- className: classnames(className, handleBasicClasses({
61
- prefix: CLASSNAME,
62
- color: color,
63
- theme: theme
64
- }))
65
- }), children);
66
- });
67
- InputHelper.displayName = COMPONENT_NAME;
68
- InputHelper.className = CLASSNAME;
69
- InputHelper.defaultProps = DEFAULT_PROPS;
70
-
71
- export { InputHelper as I };
72
- //# sourceMappingURL=InputHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InputHelper.js","sources":["../../../src/components/input-helper/constants.ts","../../../src/components/input-helper/InputHelper.tsx"],"sourcesContent":["export const INPUT_HELPER_CONFIGURATION: Record<string, { color: string }> = {\n error: {\n color: 'red',\n },\n success: {\n color: 'green',\n },\n warning: {\n color: 'yellow',\n },\n};\n","import { Kind, Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';\nimport classNames from 'classnames';\nimport React, { forwardRef, ReactNode } from 'react';\n\nimport { INPUT_HELPER_CONFIGURATION } from './constants';\n\n/**\n * Defines the props of the component.\n */\nexport interface InputHelperProps extends GenericProps, HasTheme {\n /** Helper content. */\n children: string | ReactNode;\n /** Helper variant. */\n kind?: Kind;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'InputHelper';\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<InputHelperProps> = {\n kind: Kind.info,\n theme: Theme.light,\n};\n\n/**\n * InputHelper component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const InputHelper: Comp<InputHelperProps, HTMLSpanElement> = forwardRef((props, ref) => {\n const { children, className, kind, theme, ...forwardedProps } = props;\n const { color } = INPUT_HELPER_CONFIGURATION[kind as any] || {};\n\n return (\n <span\n ref={ref}\n {...forwardedProps}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, color, theme }))}\n >\n {children}\n </span>\n );\n});\n\nInputHelper.displayName = COMPONENT_NAME;\nInputHelper.className = CLASSNAME;\nInputHelper.defaultProps = DEFAULT_PROPS;\n"],"names":["INPUT_HELPER_CONFIGURATION","error","color","success","warning","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","kind","Kind","info","theme","Theme","light","InputHelper","forwardRef","props","ref","children","className","forwardedProps","classNames","handleBasicClasses","prefix","displayName","defaultProps"],"mappings":";;;;;AAAO,IAAMA,0BAA6D,GAAG;AACzEC,EAAAA,KAAK,EAAE;AACHC,IAAAA,KAAK,EAAE;AADJ,GADkE;AAIzEC,EAAAA,OAAO,EAAE;AACLD,IAAAA,KAAK,EAAE;AADF,GAJgE;AAOzEE,EAAAA,OAAO,EAAE;AACLF,IAAAA,KAAK,EAAE;AADF;AAPgE,CAAtE;;ACOP;;;;AAUA;;;AAGA,IAAMG,cAAc,GAAG,aAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;AAGA,IAAMG,aAAwC,GAAG;AAC7CC,EAAAA,IAAI,EAAEC,IAAI,CAACC,IADkC;AAE7CC,EAAAA,KAAK,EAAEC,KAAK,CAACC;AAFgC,CAAjD;AAKA;;;;;;;;IAOaC,WAAoD,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MACnFC,QADmF,GAC3BF,KAD2B,CACnFE,QADmF;AAAA,MACzEC,SADyE,GAC3BH,KAD2B,CACzEG,SADyE;AAAA,MAC9DX,IAD8D,GAC3BQ,KAD2B,CAC9DR,IAD8D;AAAA,MACxDG,KADwD,GAC3BK,KAD2B,CACxDL,KADwD;AAAA,MAC9CS,cAD8C,4BAC3BJ,KAD2B;;AAAA,aAEzEjB,0BAA0B,CAACS,IAAD,CAA1B,IAA2C,EAF8B;AAAA,MAEnFP,KAFmF,QAEnFA,KAFmF;;AAI3F,SACI;AACI,IAAA,GAAG,EAAEgB;AADT,KAEQG,cAFR;AAGI,IAAA,SAAS,EAAEC,UAAU,CAACF,SAAD,EAAYG,kBAAkB,CAAC;AAAEC,MAAAA,MAAM,EAAElB,SAAV;AAAqBJ,MAAAA,KAAK,EAALA,KAArB;AAA4BU,MAAAA,KAAK,EAALA;AAA5B,KAAD,CAA9B;AAHzB,MAKKO,QALL,CADJ;AASH,CAb6E;AAe9EJ,WAAW,CAACU,WAAZ,GAA0BpB,cAA1B;AACAU,WAAW,CAACK,SAAZ,GAAwBd,SAAxB;AACAS,WAAW,CAACW,YAAZ,GAA2BlB,aAA3B;;;;"}
@@ -1,58 +0,0 @@
1
- import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.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 './getRootClassName.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=InputLabel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InputLabel.js","sources":["../../../src/components/input-label/InputLabel.tsx"],"sourcesContent":["import { Theme } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';\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":";;;;;AAKA;;;;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,123 +0,0 @@
1
- import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
2
- import { ColorPalette, Emphasis } from './components.js';
3
- import React, { forwardRef, useRef, useEffect } from 'react';
4
- import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getRootClassName.js';
5
- import { d as mdiClose } from './Icon2.js';
6
- import { D as DOCUMENT } from './constants.js';
7
- import { m as mergeRefs } from './mergeRefs.js';
8
- import { I as IconButton } from './IconButton.js';
9
- import { u as useCallbackOnEscape, C as ClickAwayProvider } from './ClickAwayProvider.js';
10
- import { u as useFocusTrap } from './useFocusTrap.js';
11
- import { createPortal } from 'react-dom';
12
- import { u as useDelayedVisibility } from './useDelayedVisibility.js';
13
- import { u as useDisableBodyScroll } from './useDisableBodyScroll.js';
14
-
15
- var LIGHTBOX_TRANSITION_DURATION = 400;
16
- /**
17
- * Defines the props of the component.
18
- */
19
-
20
- /**
21
- * Component display name.
22
- */
23
- var COMPONENT_NAME = 'Lightbox';
24
- /**
25
- * Component default class name and class prefix.
26
- */
27
-
28
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
29
- /**
30
- * Lightbox component.
31
- *
32
- * @param props Component props.
33
- * @param ref Component ref.
34
- * @return React element.
35
- */
36
-
37
- var Lightbox = forwardRef(function (props, ref) {
38
- var _childrenRef$current;
39
-
40
- var ariaLabel = props.ariaLabel,
41
- children = props.children,
42
- className = props.className,
43
- closeButtonProps = props.closeButtonProps,
44
- isOpen = props.isOpen,
45
- onClose = props.onClose,
46
- parentElement = props.parentElement,
47
- preventAutoClose = props.preventAutoClose,
48
- theme = props.theme,
49
- zIndex = props.zIndex,
50
- forwardedProps = _objectWithoutProperties(props, ["ariaLabel", "children", "className", "closeButtonProps", "isOpen", "onClose", "parentElement", "preventAutoClose", "theme", "zIndex"]);
51
-
52
- if (!DOCUMENT) {
53
- // Can't render in SSR.
54
- return null;
55
- } // eslint-disable-next-line react-hooks/rules-of-hooks
56
-
57
-
58
- var childrenRef = useRef(null); // eslint-disable-next-line react-hooks/rules-of-hooks
59
-
60
- var wrapperRef = useRef(null); // eslint-disable-next-line react-hooks/rules-of-hooks
61
-
62
- useDisableBodyScroll(isOpen && wrapperRef.current); // eslint-disable-next-line react-hooks/rules-of-hooks
63
-
64
- var isVisible = useDelayedVisibility(!!isOpen, LIGHTBOX_TRANSITION_DURATION); // Handle focus trap.
65
- // eslint-disable-next-line react-hooks/rules-of-hooks
66
-
67
- useFocusTrap(isOpen && wrapperRef.current, (_childrenRef$current = childrenRef.current) === null || _childrenRef$current === void 0 ? void 0 : _childrenRef$current.firstChild); // eslint-disable-next-line react-hooks/rules-of-hooks
68
-
69
- var previousOpen = useRef(isOpen); // eslint-disable-next-line react-hooks/rules-of-hooks
70
-
71
- useEffect(function () {
72
- if (isOpen !== previousOpen.current) {
73
- previousOpen.current = isOpen; // Focus the parent element on close.
74
-
75
- if (!isOpen && parentElement && parentElement.current) {
76
- parentElement.current.focus();
77
- }
78
- }
79
- }, [isOpen, parentElement]); // Close lightbox on escape key pressed.
80
- // eslint-disable-next-line react-hooks/rules-of-hooks
81
-
82
- useCallbackOnEscape(onClose); // eslint-disable-next-line react-hooks/rules-of-hooks
83
-
84
- var clickAwayRefs = useRef([wrapperRef]);
85
- if (!isOpen && !isVisible) return null;
86
- return createPortal(
87
- /* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */
88
- React.createElement("div", _extends({
89
- ref: mergeRefs(ref, wrapperRef)
90
- }, forwardedProps, {
91
- "aria-label": ariaLabel,
92
- "aria-modal": "true",
93
- className: classnames(className, handleBasicClasses({
94
- prefix: CLASSNAME,
95
- isHidden: !isOpen,
96
- isShown: isOpen || isVisible,
97
- theme: theme
98
- })),
99
- style: {
100
- zIndex: zIndex
101
- }
102
- }), closeButtonProps && React.createElement(IconButton, _extends({}, closeButtonProps, {
103
- className: "".concat(CLASSNAME, "__close"),
104
- color: ColorPalette.light,
105
- emphasis: Emphasis.low,
106
- icon: mdiClose,
107
- theme: theme,
108
- type: "button",
109
- onClick: onClose
110
- })), React.createElement(ClickAwayProvider, {
111
- callback: !preventAutoClose && onClose,
112
- childrenRefs: clickAwayRefs
113
- }, React.createElement("div", {
114
- ref: childrenRef,
115
- className: "".concat(CLASSNAME, "__wrapper"),
116
- role: "presentation"
117
- }, children))), document.body);
118
- });
119
- Lightbox.displayName = COMPONENT_NAME;
120
- Lightbox.className = CLASSNAME;
121
-
122
- export { Lightbox as L };
123
- //# sourceMappingURL=Lightbox2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Lightbox2.js","sources":["../../../src/components/lightbox/Lightbox.tsx"],"sourcesContent":["import React, { forwardRef, RefObject, useRef, useEffect } from 'react';\n\nimport classNames from 'classnames';\nimport { createPortal } from 'react-dom';\n\nimport { mdiClose } from '@lumx/icons';\nimport { ColorPalette, Emphasis, IconButton, IconButtonProps } from '@lumx/react';\nimport { DOCUMENT } from '@lumx/react/constants';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses, HasTheme } from '@lumx/react/utils';\n\nimport { useFocusTrap } from '@lumx/react/hooks/useFocusTrap';\nimport { useDelayedVisibility } from '@lumx/react/hooks/useDelayedVisibility';\nimport { useDisableBodyScroll } from '@lumx/react/hooks/useDisableBodyScroll';\nimport { ClickAwayProvider } from '@lumx/react/utils/ClickAwayProvider';\nimport { mergeRefs } from '@lumx/react/utils/mergeRefs';\nimport { useCallbackOnEscape } from '@lumx/react/hooks/useCallbackOnEscape';\n\nconst LIGHTBOX_TRANSITION_DURATION = 400;\n\n/**\n * Defines the props of the component.\n */\nexport interface LightboxProps extends GenericProps, HasTheme {\n /** Props to pass to the close button (minus those already set by the Lightbox props). */\n closeButtonProps?: Pick<IconButtonProps, 'label'> &\n Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;\n /** Whether the component is open or not. */\n isOpen?: boolean;\n /** Reference to the element that triggered modal opening to set focus on. */\n parentElement: RefObject<any>;\n /** Whether to keep the dialog open on clickaway or escape press. */\n preventAutoClose?: boolean;\n /** Z-axis position. */\n zIndex?: number;\n /** On close callback. */\n onClose?(): void;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Lightbox';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\n/**\n * Lightbox component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Lightbox: Comp<LightboxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n ariaLabel,\n children,\n className,\n closeButtonProps,\n isOpen,\n onClose,\n parentElement,\n preventAutoClose,\n theme,\n zIndex,\n ...forwardedProps\n } = props;\n if (!DOCUMENT) {\n // Can't render in SSR.\n return null;\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const childrenRef = useRef<any>(null);\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useDisableBodyScroll(isOpen && wrapperRef.current);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const isVisible = useDelayedVisibility(!!isOpen, LIGHTBOX_TRANSITION_DURATION);\n\n // Handle focus trap.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useFocusTrap(isOpen && wrapperRef.current, childrenRef.current?.firstChild);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const previousOpen = useRef(isOpen);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n if (isOpen !== previousOpen.current) {\n previousOpen.current = isOpen;\n\n // Focus the parent element on close.\n if (!isOpen && parentElement && parentElement.current) {\n parentElement.current.focus();\n }\n }\n }, [isOpen, parentElement]);\n\n // Close lightbox on escape key pressed.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useCallbackOnEscape(onClose);\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const clickAwayRefs = useRef([wrapperRef]);\n\n if (!isOpen && !isVisible) return null;\n\n return createPortal(\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */\n <div\n ref={mergeRefs(ref, wrapperRef)}\n {...forwardedProps}\n aria-label={ariaLabel}\n aria-modal=\"true\"\n className={classNames(\n className,\n handleBasicClasses({\n prefix: CLASSNAME,\n isHidden: !isOpen,\n isShown: isOpen || isVisible,\n theme,\n }),\n )}\n style={{ zIndex }}\n >\n {closeButtonProps && (\n <IconButton\n {...closeButtonProps}\n className={`${CLASSNAME}__close`}\n color={ColorPalette.light}\n emphasis={Emphasis.low}\n icon={mdiClose}\n theme={theme}\n type=\"button\"\n onClick={onClose}\n />\n )}\n <ClickAwayProvider callback={!preventAutoClose && onClose} childrenRefs={clickAwayRefs}>\n <div ref={childrenRef} className={`${CLASSNAME}__wrapper`} role=\"presentation\">\n {children}\n </div>\n </ClickAwayProvider>\n </div>,\n document.body,\n );\n});\nLightbox.displayName = COMPONENT_NAME;\nLightbox.className = CLASSNAME;\n"],"names":["LIGHTBOX_TRANSITION_DURATION","COMPONENT_NAME","CLASSNAME","getRootClassName","Lightbox","forwardRef","props","ref","ariaLabel","children","className","closeButtonProps","isOpen","onClose","parentElement","preventAutoClose","theme","zIndex","forwardedProps","DOCUMENT","childrenRef","useRef","wrapperRef","useDisableBodyScroll","current","isVisible","useDelayedVisibility","useFocusTrap","firstChild","previousOpen","useEffect","focus","useCallbackOnEscape","clickAwayRefs","createPortal","mergeRefs","classNames","handleBasicClasses","prefix","isHidden","isShown","ColorPalette","light","Emphasis","low","mdiClose","document","body","displayName"],"mappings":";;;;;;;;;;;;;;AAiBA,IAAMA,4BAA4B,GAAG,GAArC;AAEA;;;;AAmBA;;;AAGA,IAAMC,cAAc,GAAG,UAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;AAEA;;;;;;;;IAOaG,QAA6C,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA;;AAAA,MAEhFC,SAFgF,GAahFF,KAbgF,CAEhFE,SAFgF;AAAA,MAG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oB;AAAzE,KACI;AAAK,IAAA,GAAG,EAAEb,WAAV;AAAuB,IAAA,SAAS,YAAKlB,SAAL,cAAhC;AAA2D,IAAA,IAAI,EAAC;AAAhE,KACKO,QADL,CADJ,CA5BJ,CAFe,EAoCfqC,QAAQ,CAACC,IApCM,CAAnB;AAsCH,CAhGsE;AAiGvE3C,QAAQ,CAAC4C,WAAT,GAAuB/C,cAAvB;AACAG,QAAQ,CAACM,SAAT,GAAqBR,SAArB;;;;"}
@@ -1,122 +0,0 @@
1
- import { b as _objectWithoutProperties, a as _defineProperty, c as _extends, _ as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
2
- import { Size, Typography } from './components.js';
3
- import React, { forwardRef, useMemo } from 'react';
4
- import { g as getRootClassName, c as classnames, h as handleBasicClasses } from './getRootClassName.js';
5
- import { I as Icon } from './Icon2.js';
6
- import isEmpty from 'lodash/isEmpty';
7
- import { r as renderLink } from './renderLink.js';
8
-
9
- /**
10
- * Component display name.
11
- */
12
- var COMPONENT_NAME = 'Link';
13
- /**
14
- * Component default class name and class prefix.
15
- */
16
-
17
- var CLASSNAME = getRootClassName(COMPONENT_NAME);
18
-
19
- var getIconSize = function getIconSize(typography) {
20
- switch (typography) {
21
- case Typography.display1:
22
- return Size.m;
23
-
24
- case Typography.headline:
25
- case Typography.title:
26
- case Typography.custom.title1:
27
- case Typography.custom.title2:
28
- case Typography.custom.title3:
29
- case Typography.custom.title4:
30
- case Typography.custom.title5:
31
- case Typography.custom.title6:
32
- case Typography.body2:
33
- case Typography.subtitle2:
34
- return Size.s;
35
-
36
- case Typography.body1:
37
- case Typography.subtitle1:
38
- return Size.xs;
39
-
40
- case Typography.caption:
41
- case Typography.overline:
42
- return Size.xxs;
43
-
44
- default:
45
- return Size.s;
46
- }
47
- };
48
- /**
49
- * Link component.
50
- *
51
- * @param props Component props.
52
- * @param ref Component ref.
53
- * @return React element.
54
- */
55
-
56
-
57
- var Link = forwardRef(function (props, ref) {
58
- var children = props.children,
59
- className = props.className,
60
- color = props.color,
61
- colorVariant = props.colorVariant,
62
- disabled = props.disabled,
63
- _props$isDisabled = props.isDisabled,
64
- isDisabled = _props$isDisabled === void 0 ? disabled : _props$isDisabled,
65
- href = props.href,
66
- leftIcon = props.leftIcon,
67
- linkAs = props.linkAs,
68
- rightIcon = props.rightIcon,
69
- target = props.target,
70
- typography = props.typography,
71
- forwardedProps = _objectWithoutProperties(props, ["children", "className", "color", "colorVariant", "disabled", "isDisabled", "href", "leftIcon", "linkAs", "rightIcon", "target", "typography"]);
72
-
73
- var renderedChildren = useMemo(function () {
74
- return React.createElement(React.Fragment, null, leftIcon && !isEmpty(leftIcon) && React.createElement(Icon, {
75
- icon: leftIcon,
76
- className: "".concat(CLASSNAME, "__left-icon"),
77
- size: getIconSize(typography)
78
- }), children && React.createElement("span", {
79
- className: classnames("".concat(CLASSNAME, "__content"), _defineProperty({}, "lumx-typography-".concat(typography), typography))
80
- }, children), rightIcon && !isEmpty(rightIcon) && React.createElement(Icon, {
81
- icon: rightIcon,
82
- className: "".concat(CLASSNAME, "__right-icon"),
83
- size: getIconSize(typography)
84
- }));
85
- }, [leftIcon, typography, children, rightIcon]);
86
- /**
87
- * If there is no linkAs prop and no href, we returned a <button> instead of a <a>.
88
- * If the component is disabled, we also returned a <button> since disabled is not compatible with <a>.
89
- */
90
-
91
- if (!linkAs && isEmpty(href) || isDisabled) {
92
- return React.createElement("button", _extends({
93
- type: "button"
94
- }, forwardedProps, {
95
- ref: ref,
96
- disabled: isDisabled,
97
- className: classnames(className, handleBasicClasses({
98
- prefix: CLASSNAME,
99
- color: color,
100
- colorVariant: colorVariant
101
- }))
102
- }), renderedChildren);
103
- }
104
-
105
- return renderLink(_objectSpread2({
106
- linkAs: linkAs
107
- }, forwardedProps, {
108
- href: href,
109
- target: target,
110
- className: classnames(className, handleBasicClasses({
111
- prefix: CLASSNAME,
112
- color: color,
113
- colorVariant: colorVariant
114
- })),
115
- ref: ref
116
- }), renderedChildren);
117
- });
118
- Link.displayName = COMPONENT_NAME;
119
- Link.className = CLASSNAME;
120
-
121
- export { Link as L };
122
- //# sourceMappingURL=Link2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Link2.js","sources":["../../../src/components/link/Link.tsx"],"sourcesContent":["import React, { forwardRef, RefObject, useMemo } from 'react';\n\nimport isEmpty from 'lodash/isEmpty';\n\nimport classNames from 'classnames';\n\nimport { Color, ColorVariant, Icon, Size, Typography } from '@lumx/react';\nimport { Comp, GenericProps, getRootClassName, handleBasicClasses } from '@lumx/react/utils';\nimport { renderLink } from '@lumx/react/utils/renderLink';\n\ntype HTMLAnchorProps = React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;\n\n/**\n * Defines the props of the component.\n */\nexport interface LinkProps extends GenericProps {\n /** Color variant. */\n color?: Color;\n /** Lightened or darkened variant of the selected icon color. */\n colorVariant?: ColorVariant;\n /** Link href. */\n href?: HTMLAnchorProps['href'];\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Left icon (SVG path). */\n leftIcon?: string;\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n /** Right icon (SVG path). */\n rightIcon?: string;\n /** Link target. */\n target?: HTMLAnchorProps['target'];\n /** Typography variant. */\n typography?: Typography;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Link';\n\n/**\n * Component default class name and class prefix.\n */\nconst CLASSNAME = getRootClassName(COMPONENT_NAME);\n\nconst getIconSize = (typography?: Typography) => {\n switch (typography) {\n case Typography.display1:\n return Size.m;\n\n case Typography.headline:\n case Typography.title:\n case Typography.custom.title1:\n case Typography.custom.title2:\n case Typography.custom.title3:\n case Typography.custom.title4:\n case Typography.custom.title5:\n case Typography.custom.title6:\n case Typography.body2:\n case Typography.subtitle2:\n return Size.s;\n\n case Typography.body1:\n case Typography.subtitle1:\n return Size.xs;\n\n case Typography.caption:\n case Typography.overline:\n return Size.xxs;\n\n default:\n return Size.s;\n }\n};\n\n/**\n * Link component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Link: Comp<LinkProps, HTMLAnchorElement | HTMLButtonElement> = forwardRef((props, ref) => {\n const {\n children,\n className,\n color,\n colorVariant,\n disabled,\n isDisabled = disabled,\n href,\n leftIcon,\n linkAs,\n rightIcon,\n target,\n typography,\n ...forwardedProps\n } = props;\n const renderedChildren = useMemo(\n () => (\n <>\n {leftIcon && !isEmpty(leftIcon) && (\n <Icon icon={leftIcon} className={`${CLASSNAME}__left-icon`} size={getIconSize(typography)} />\n )}\n\n {children && (\n <span\n className={classNames(`${CLASSNAME}__content`, {\n [`lumx-typography-${typography}`]: typography,\n })}\n >\n {children}\n </span>\n )}\n\n {rightIcon && !isEmpty(rightIcon) && (\n <Icon icon={rightIcon} className={`${CLASSNAME}__right-icon`} size={getIconSize(typography)} />\n )}\n </>\n ),\n [leftIcon, typography, children, rightIcon],\n );\n\n /**\n * If there is no linkAs prop and no href, we returned a <button> instead of a <a>.\n * If the component is disabled, we also returned a <button> since disabled is not compatible with <a>.\n */\n if ((!linkAs && isEmpty(href)) || isDisabled) {\n return (\n <button\n type=\"button\"\n {...forwardedProps}\n ref={ref as RefObject<HTMLButtonElement>}\n disabled={isDisabled}\n className={classNames(className, handleBasicClasses({ prefix: CLASSNAME, color, colorVariant }))}\n >\n {renderedChildren}\n </button>\n );\n }\n return renderLink(\n {\n linkAs,\n ...forwardedProps,\n href,\n target,\n className: classNames(className, handleBasicClasses({ prefix: CLASSNAME, color, colorVariant })),\n ref: ref as RefObject<HTMLAnchorElement>,\n },\n renderedChildren,\n );\n});\nLink.displayName = COMPONENT_NAME;\nLink.className = CLASSNAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","getRootClassName","getIconSize","typography","Typography","display1","Size","m","headline","title","custom","title1","title2","title3","title4","title5","title6","body2","subtitle2","s","body1","subtitle1","xs","caption","overline","xxs","Link","forwardRef","props","ref","children","className","color","colorVariant","disabled","isDisabled","href","leftIcon","linkAs","rightIcon","target","forwardedProps","renderedChildren","useMemo","isEmpty","classNames","handleBasicClasses","prefix","renderLink","displayName"],"mappings":";;;;;;;;AAoCA;;;AAGA,IAAMA,cAAc,GAAG,MAAvB;AAEA;;;;AAGA,IAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAD,CAAlC;;AAEA,IAAMG,WAAW,GAAG,SAAdA,WAAc,CAACC,UAAD,EAA6B;AAC7C,UAAQA,UAAR;AACI,SAAKC,UAAU,CAACC,QAAhB;AACI,aAAOC,IAAI,CAACC,CAAZ;;AAEJ,SAAKH,UAAU,CAACI,QAAhB;AACA,SAAKJ,UAAU,CAACK,KAAhB;AACA,SAAKL,UAAU,CAACM,MAAX,CAAkBC,MAAvB;AACA,SAAKP,UAAU,CAACM,MAAX,CAAkBE,MAAvB;AACA,SAAKR,UAAU,CAACM,MAAX,CAAkBG,MAAvB;AACA,SAAKT,UAAU,CAACM,MAAX,CAAkBI,MAAvB;AACA,SAAKV,UAAU,CAACM,MAAX,CAAkBK,MAAvB;AACA,SAAKX,UAAU,CAACM,MAAX,CAAkBM,MAAvB;AACA,SAAKZ,UAAU,CAACa,KAAhB;AACA,SAAKb,UAAU,CAACc,SAAhB;AACI,aAAOZ,IAAI,CAACa,CAAZ;;AAEJ,SAAKf,UAAU,CAACgB,KAAhB;AACA,SAAKhB,UAAU,CAACiB,SAAhB;AACI,aAAOf,IAAI,CAACgB,EAAZ;;AAEJ,SAAKlB,UAAU,CAACmB,OAAhB;AACA,SAAKnB,UAAU,CAACoB,QAAhB;AACI,aAAOlB,IAAI,CAACmB,GAAZ;;AAEJ;AACI,aAAOnB,IAAI,CAACa,CAAZ;AAzBR;AA2BH,CA5BD;AA8BA;;;;;;;;;IAOaO,IAA4D,GAAGC,UAAU,CAAC,UAACC,KAAD,EAAQC,GAAR,EAAgB;AAAA,MAE/FC,QAF+F,GAe/FF,KAf+F,CAE/FE,QAF+F;AAAA,MAG/FC,SAH+F,GAe/FH,KAf+F,CA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