@lumx/react 3.20.1-alpha.2 → 3.20.1-alpha.20

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 (697) hide show
  1. package/CONTRIBUTING.md +1 -5
  2. package/README.md +0 -2
  3. package/_internal/Button-1f227024.js +98 -0
  4. package/_internal/Button-1f227024.js.map +1 -0
  5. package/_internal/ButtonRoot-823f3e9c.js +117 -0
  6. package/_internal/ButtonRoot-823f3e9c.js.map +1 -0
  7. package/_internal/Chip-a34f6905.js +146 -0
  8. package/_internal/Chip-a34f6905.js.map +1 -0
  9. package/_internal/ClickAwayProvider-7093ba23.js +95 -0
  10. package/_internal/ClickAwayProvider-7093ba23.js.map +1 -0
  11. package/_internal/DisabledStateContext-ea04260d.js +29 -0
  12. package/_internal/DisabledStateContext-ea04260d.js.map +1 -0
  13. package/_internal/HeadingLevelProvider-ebdcb0c7.js +61 -0
  14. package/_internal/HeadingLevelProvider-ebdcb0c7.js.map +1 -0
  15. package/_internal/IconButton-f4df224c.js +77 -0
  16. package/_internal/IconButton-f4df224c.js.map +1 -0
  17. package/_internal/ImageCaption-8134a3aa.js +75 -0
  18. package/_internal/ImageCaption-8134a3aa.js.map +1 -0
  19. package/_internal/List-54237e0e.js +793 -0
  20. package/_internal/List-54237e0e.js.map +1 -0
  21. package/_internal/PopoverDialog-e0967e5f.js +655 -0
  22. package/_internal/PopoverDialog-e0967e5f.js.map +1 -0
  23. package/_internal/Portal-3f86608e.js +45 -0
  24. package/_internal/Portal-3f86608e.js.map +1 -0
  25. package/_internal/RawClickable-2c2b6a89.js +52 -0
  26. package/_internal/RawClickable-2c2b6a89.js.map +1 -0
  27. package/_internal/Slides-b7a67f32.js +678 -0
  28. package/_internal/Slides-b7a67f32.js.map +1 -0
  29. package/_internal/ThemeContext-3181f000.js +14 -0
  30. package/_internal/ThemeContext-3181f000.js.map +1 -0
  31. package/_internal/Thumbnail-b5dea0af.js +313 -0
  32. package/_internal/Thumbnail-b5dea0af.js.map +1 -0
  33. package/_internal/components/alert-dialog-b284b191.js +162 -0
  34. package/_internal/components/alert-dialog-b284b191.js.map +1 -0
  35. package/_internal/components/autocomplete-8d3f37ea.js +261 -0
  36. package/_internal/components/autocomplete-8d3f37ea.js.map +1 -0
  37. package/_internal/components/avatar-5fc70e00.js +83 -0
  38. package/_internal/components/avatar-5fc70e00.js.map +1 -0
  39. package/_internal/components/badge-8390e590.js +81 -0
  40. package/_internal/components/badge-8390e590.js.map +1 -0
  41. package/_internal/components/button-e3c7f2eb.js +47 -0
  42. package/_internal/components/button-e3c7f2eb.js.map +1 -0
  43. package/_internal/components/checkbox-d1ca9748.js +140 -0
  44. package/_internal/components/checkbox-d1ca9748.js.map +1 -0
  45. package/_internal/components/chip-e40c5521.js +102 -0
  46. package/_internal/components/chip-e40c5521.js.map +1 -0
  47. package/_internal/components/comment-block-a3cf7b9b.js +138 -0
  48. package/_internal/components/comment-block-a3cf7b9b.js.map +1 -0
  49. package/_internal/components/date-picker-6c1b14e4.js +2 -0
  50. package/_internal/components/date-picker-6c1b14e4.js.map +1 -0
  51. package/_internal/components/dialog-ebdb9500.js +238 -0
  52. package/_internal/components/dialog-ebdb9500.js.map +1 -0
  53. package/_internal/components/divider-116af6b9.js +50 -0
  54. package/_internal/components/divider-116af6b9.js.map +1 -0
  55. package/_internal/components/drag-handle-5215cd21.js +51 -0
  56. package/_internal/components/drag-handle-5215cd21.js.map +1 -0
  57. package/_internal/components/dropdown-0baed51b.js +147 -0
  58. package/_internal/components/dropdown-0baed51b.js.map +1 -0
  59. package/_internal/components/expansion-panel-5533a680.js +167 -0
  60. package/_internal/components/expansion-panel-5533a680.js.map +1 -0
  61. package/_internal/components/flag-8d4a7e72.js +59 -0
  62. package/_internal/components/flag-8d4a7e72.js.map +1 -0
  63. package/_internal/components/flex-box-55144e5f.js +56 -0
  64. package/_internal/components/flex-box-55144e5f.js.map +1 -0
  65. package/_internal/components/generic-block-ff0509ee.js +124 -0
  66. package/_internal/components/generic-block-ff0509ee.js.map +1 -0
  67. package/_internal/components/grid-6f1b5a41.js +104 -0
  68. package/_internal/components/grid-6f1b5a41.js.map +1 -0
  69. package/_internal/components/grid-column-f01df853.js +59 -0
  70. package/_internal/components/grid-column-f01df853.js.map +1 -0
  71. package/_internal/components/heading-89239843.js +53 -0
  72. package/_internal/components/heading-89239843.js.map +1 -0
  73. package/_internal/components/icon-b708cca4.js +102 -0
  74. package/_internal/components/icon-b708cca4.js.map +1 -0
  75. package/_internal/components/image-block-7938422d.js +110 -0
  76. package/_internal/components/image-block-7938422d.js.map +1 -0
  77. package/_internal/components/image-lightbox-58331704.js +756 -0
  78. package/_internal/components/image-lightbox-58331704.js.map +1 -0
  79. package/_internal/components/inline-list-e6f19a98.js +74 -0
  80. package/_internal/components/inline-list-e6f19a98.js.map +1 -0
  81. package/_internal/components/input-helper-64153099.js +71 -0
  82. package/_internal/components/input-helper-64153099.js.map +1 -0
  83. package/_internal/components/input-label-2feb0bb0.js +59 -0
  84. package/_internal/components/input-label-2feb0bb0.js.map +1 -0
  85. package/_internal/components/lightbox-570ad9e5.js +155 -0
  86. package/_internal/components/lightbox-570ad9e5.js.map +1 -0
  87. package/_internal/components/link-91f76477.js +72 -0
  88. package/_internal/components/link-91f76477.js.map +1 -0
  89. package/_internal/components/link-preview-fdd8d738.js +117 -0
  90. package/_internal/components/link-preview-fdd8d738.js.map +1 -0
  91. package/_internal/components/list-b08d8423.js +71 -0
  92. package/_internal/components/list-b08d8423.js.map +1 -0
  93. package/_internal/components/message-29cb9181.js +96 -0
  94. package/_internal/components/message-29cb9181.js.map +1 -0
  95. package/_internal/components/mosaic-cdb9f563.js +95 -0
  96. package/_internal/components/mosaic-cdb9f563.js.map +1 -0
  97. package/_internal/components/navigation-8b7d9bd8.js +225 -0
  98. package/_internal/components/navigation-8b7d9bd8.js.map +1 -0
  99. package/_internal/components/notification-a45fda96.js +145 -0
  100. package/_internal/components/notification-a45fda96.js.map +1 -0
  101. package/_internal/components/popover-65bfbc57.js +3 -0
  102. package/_internal/components/popover-65bfbc57.js.map +1 -0
  103. package/_internal/components/post-block-52e58dd5.js +109 -0
  104. package/_internal/components/post-block-52e58dd5.js.map +1 -0
  105. package/_internal/components/progress-f39c3fa2.js +182 -0
  106. package/_internal/components/progress-f39c3fa2.js.map +1 -0
  107. package/_internal/components/progress-tracker-512d7a08.js +305 -0
  108. package/_internal/components/progress-tracker-512d7a08.js.map +1 -0
  109. package/_internal/components/radio-button-559a4863.js +149 -0
  110. package/_internal/components/radio-button-559a4863.js.map +1 -0
  111. package/_internal/components/select-48d4fa8c.js +454 -0
  112. package/_internal/components/select-48d4fa8c.js.map +1 -0
  113. package/_internal/components/side-navigation-f9bc5b4e.js +165 -0
  114. package/_internal/components/side-navigation-f9bc5b4e.js.map +1 -0
  115. package/_internal/components/skeleton-c66516ee.js +166 -0
  116. package/_internal/components/skeleton-c66516ee.js.map +1 -0
  117. package/_internal/components/slider-efbfbc45.js +311 -0
  118. package/_internal/components/slider-efbfbc45.js.map +1 -0
  119. package/_internal/components/slideshow-dd312470.js +151 -0
  120. package/_internal/components/slideshow-dd312470.js.map +1 -0
  121. package/_internal/components/switch-769a2a04.js +122 -0
  122. package/_internal/components/switch-769a2a04.js.map +1 -0
  123. package/_internal/components/table-8617b1ba.js +294 -0
  124. package/_internal/components/table-8617b1ba.js.map +1 -0
  125. package/_internal/components/tabs-884c57b6.js +298 -0
  126. package/_internal/components/tabs-884c57b6.js.map +1 -0
  127. package/_internal/components/text-c7b1e079.js +2 -0
  128. package/_internal/components/text-c7b1e079.js.map +1 -0
  129. package/_internal/components/text-field-478acd86.js +359 -0
  130. package/_internal/components/text-field-478acd86.js.map +1 -0
  131. package/_internal/components/thumbnail-310a4c4b.js +42 -0
  132. package/_internal/components/thumbnail-310a4c4b.js.map +1 -0
  133. package/_internal/components/toolbar-a43533a2.js +61 -0
  134. package/_internal/components/toolbar-a43533a2.js.map +1 -0
  135. package/_internal/components/tooltip-2885ab2e.js +327 -0
  136. package/_internal/components/tooltip-2885ab2e.js.map +1 -0
  137. package/_internal/components/uploader-1e7f5bbb.js +153 -0
  138. package/_internal/components/uploader-1e7f5bbb.js.map +1 -0
  139. package/_internal/components/user-block-68a51ed0.js +145 -0
  140. package/_internal/components/user-block-68a51ed0.js.map +1 -0
  141. package/_internal/constants-b9e57936.js +2155 -0
  142. package/_internal/constants-b9e57936.js.map +1 -0
  143. package/_internal/constants-d0e3f49e.js +24 -0
  144. package/_internal/constants-d0e3f49e.js.map +1 -0
  145. package/_internal/context-9d1336a1.js +19 -0
  146. package/_internal/context-9d1336a1.js.map +1 -0
  147. package/_internal/forwardRef-15f62847.js +70 -0
  148. package/_internal/forwardRef-15f62847.js.map +1 -0
  149. package/_internal/getFocusableElements-230173a8.js +13 -0
  150. package/_internal/getFocusableElements-230173a8.js.map +1 -0
  151. package/_internal/index-9df37c0d.js +436 -0
  152. package/_internal/index-9df37c0d.js.map +1 -0
  153. package/_internal/index-a9c5cd69.js +117 -0
  154. package/_internal/index-a9c5cd69.js.map +1 -0
  155. package/_internal/isComponent-78df9309.js +20 -0
  156. package/_internal/isComponent-78df9309.js.map +1 -0
  157. package/_internal/isComponentType-e806b848.js +9 -0
  158. package/_internal/isComponentType-e806b848.js.map +1 -0
  159. package/_internal/mergeRefs-f0d7d6ea.js +30 -0
  160. package/_internal/mergeRefs-f0d7d6ea.js.map +1 -0
  161. package/{src/utils/partitionMulti.ts → _internal/partitionMulti-4daccdd5.js} +5 -9
  162. package/_internal/partitionMulti-4daccdd5.js.map +1 -0
  163. package/_internal/state-db358714.js +130 -0
  164. package/_internal/state-db358714.js.map +1 -0
  165. package/_internal/useBooleanState-2a3d237c.js +12 -0
  166. package/_internal/useBooleanState-2a3d237c.js.map +1 -0
  167. package/_internal/useCallbackOnEscape-ea4d9eb4.js +62 -0
  168. package/_internal/useCallbackOnEscape-ea4d9eb4.js.map +1 -0
  169. package/_internal/useDisableBodyScroll-36bd7352.js +219 -0
  170. package/_internal/useDisableBodyScroll-36bd7352.js.map +1 -0
  171. package/_internal/useDisableStateProps-69e16b7c.js +36 -0
  172. package/_internal/useDisableStateProps-69e16b7c.js.map +1 -0
  173. package/_internal/useFocusTrap-c3c6378b.js +112 -0
  174. package/_internal/useFocusTrap-c3c6378b.js.map +1 -0
  175. package/_internal/useId-3a1facc0.js +18 -0
  176. package/_internal/useId-3a1facc0.js.map +1 -0
  177. package/_internal/useRovingTabIndex-7daf0f24.js +77 -0
  178. package/_internal/useRovingTabIndex-7daf0f24.js.map +1 -0
  179. package/_internal/useTransitionVisibility-321fdbfa.js +50 -0
  180. package/_internal/useTransitionVisibility-321fdbfa.js.map +1 -0
  181. package/_internal/wrapChildrenIconWithSpaces-c1faaae4.js +20 -0
  182. package/_internal/wrapChildrenIconWithSpaces-c1faaae4.js.map +1 -0
  183. package/index.d.ts +42 -387
  184. package/index.js +65 -14526
  185. package/index.js.map +1 -1
  186. package/package.json +11 -21
  187. package/utils/index.d.ts +7 -7
  188. package/utils/index.js +3 -1
  189. package/utils/index.js.map +1 -1
  190. package/_internal/Falsy.d.ts +0 -7
  191. package/_internal/index.js +0 -229
  192. package/_internal/index.js.map +0 -1
  193. package/src/components/alert-dialog/AlertDialog.stories.tsx +0 -127
  194. package/src/components/alert-dialog/AlertDialog.test.tsx +0 -35
  195. package/src/components/alert-dialog/AlertDialog.tsx +0 -189
  196. package/src/components/alert-dialog/index.ts +0 -1
  197. package/src/components/autocomplete/Autocomplete.stories.tsx +0 -75
  198. package/src/components/autocomplete/Autocomplete.test.tsx +0 -101
  199. package/src/components/autocomplete/Autocomplete.tsx +0 -294
  200. package/src/components/autocomplete/AutocompleteMultiple.stories.tsx +0 -167
  201. package/src/components/autocomplete/AutocompleteMultiple.test.tsx +0 -63
  202. package/src/components/autocomplete/AutocompleteMultiple.tsx +0 -156
  203. package/src/components/autocomplete/__mockData__/index.ts +0 -39
  204. package/src/components/autocomplete/index.ts +0 -2
  205. package/src/components/avatar/Avatar.stories.tsx +0 -121
  206. package/src/components/avatar/Avatar.test.tsx +0 -34
  207. package/src/components/avatar/Avatar.tsx +0 -114
  208. package/src/components/avatar/index.ts +0 -1
  209. package/src/components/badge/Badge.stories.tsx +0 -70
  210. package/src/components/badge/Badge.test.tsx +0 -47
  211. package/src/components/badge/Badge.tsx +0 -58
  212. package/src/components/badge/BadgeWrapper.stories.tsx +0 -76
  213. package/src/components/badge/BadgeWrapper.test.tsx +0 -49
  214. package/src/components/badge/BadgeWrapper.tsx +0 -37
  215. package/src/components/badge/index.ts +0 -2
  216. package/src/components/button/Button.stories.tsx +0 -356
  217. package/src/components/button/Button.test.tsx +0 -127
  218. package/src/components/button/Button.tsx +0 -103
  219. package/src/components/button/ButtonGroup.stories.tsx +0 -54
  220. package/src/components/button/ButtonGroup.test.tsx +0 -43
  221. package/src/components/button/ButtonGroup.tsx +0 -52
  222. package/src/components/button/ButtonRoot.tsx +0 -193
  223. package/src/components/button/IconButton.stories.tsx +0 -52
  224. package/src/components/button/IconButton.test.tsx +0 -68
  225. package/src/components/button/IconButton.tsx +0 -93
  226. package/src/components/button/index.ts +0 -4
  227. package/src/components/checkbox/Checkbox.stories.tsx +0 -64
  228. package/src/components/checkbox/Checkbox.test.tsx +0 -156
  229. package/src/components/checkbox/Checkbox.tsx +0 -164
  230. package/src/components/checkbox/index.ts +0 -1
  231. package/src/components/chip/Chip.stories.tsx +0 -166
  232. package/src/components/chip/Chip.test.tsx +0 -243
  233. package/src/components/chip/Chip.tsx +0 -168
  234. package/src/components/chip/ChipGroup.stories.tsx +0 -49
  235. package/src/components/chip/ChipGroup.test.tsx +0 -39
  236. package/src/components/chip/ChipGroup.tsx +0 -60
  237. package/src/components/chip/index.ts +0 -2
  238. package/src/components/comment-block/CommentBlock.stories.tsx +0 -92
  239. package/src/components/comment-block/CommentBlock.test.tsx +0 -29
  240. package/src/components/comment-block/CommentBlock.tsx +0 -172
  241. package/src/components/comment-block/index.ts +0 -1
  242. package/src/components/date-picker/DatePicker.stories.tsx +0 -118
  243. package/src/components/date-picker/DatePicker.test.tsx +0 -36
  244. package/src/components/date-picker/DatePicker.tsx +0 -52
  245. package/src/components/date-picker/DatePickerControlled.test.tsx +0 -93
  246. package/src/components/date-picker/DatePickerControlled.tsx +0 -259
  247. package/src/components/date-picker/DatePickerField.stories.tsx +0 -100
  248. package/src/components/date-picker/DatePickerField.test.tsx +0 -72
  249. package/src/components/date-picker/DatePickerField.tsx +0 -135
  250. package/src/components/date-picker/constants.ts +0 -11
  251. package/src/components/date-picker/index.ts +0 -4
  252. package/src/components/date-picker/types.ts +0 -28
  253. package/src/components/dialog/Dialog.stories.tsx +0 -318
  254. package/src/components/dialog/Dialog.test.tsx +0 -99
  255. package/src/components/dialog/Dialog.tsx +0 -288
  256. package/src/components/dialog/index.ts +0 -1
  257. package/src/components/divider/Divider.test.tsx +0 -53
  258. package/src/components/divider/Divider.tsx +0 -52
  259. package/src/components/divider/index.ts +0 -1
  260. package/src/components/drag-handle/DragHandle.test.tsx +0 -38
  261. package/src/components/drag-handle/DragHandle.tsx +0 -53
  262. package/src/components/drag-handle/index.ts +0 -1
  263. package/src/components/dropdown/Dropdown.stories.tsx +0 -31
  264. package/src/components/dropdown/Dropdown.test.tsx +0 -66
  265. package/src/components/dropdown/Dropdown.tsx +0 -186
  266. package/src/components/dropdown/index.ts +0 -1
  267. package/src/components/expansion-panel/ExpansionPanel.stories.tsx +0 -91
  268. package/src/components/expansion-panel/ExpansionPanel.test.tsx +0 -186
  269. package/src/components/expansion-panel/ExpansionPanel.tsx +0 -195
  270. package/src/components/expansion-panel/index.ts +0 -1
  271. package/src/components/flag/Flag.stories.tsx +0 -48
  272. package/src/components/flag/Flag.test.tsx +0 -64
  273. package/src/components/flag/Flag.tsx +0 -54
  274. package/src/components/flag/index.ts +0 -1
  275. package/src/components/flex-box/FlexBox.stories.tsx +0 -158
  276. package/src/components/flex-box/FlexBox.test.tsx +0 -25
  277. package/src/components/flex-box/FlexBox.tsx +0 -100
  278. package/src/components/flex-box/index.ts +0 -1
  279. package/src/components/generic-block/GenericBlock.stories.jsx +0 -128
  280. package/src/components/generic-block/GenericBlock.test.tsx +0 -156
  281. package/src/components/generic-block/GenericBlock.tsx +0 -225
  282. package/src/components/generic-block/constants.ts +0 -9
  283. package/src/components/generic-block/index.ts +0 -2
  284. package/src/components/grid/Grid.tsx +0 -85
  285. package/src/components/grid/GridItem.tsx +0 -57
  286. package/src/components/grid/index.ts +0 -2
  287. package/src/components/grid-column/GridColumn.stories.tsx +0 -46
  288. package/src/components/grid-column/GridColumn.test.jsx +0 -58
  289. package/src/components/grid-column/GridColumn.tsx +0 -83
  290. package/src/components/grid-column/index.ts +0 -1
  291. package/src/components/heading/Heading.stories.tsx +0 -70
  292. package/src/components/heading/Heading.test.tsx +0 -84
  293. package/src/components/heading/Heading.tsx +0 -67
  294. package/src/components/heading/HeadingLevelProvider.tsx +0 -30
  295. package/src/components/heading/constants.ts +0 -16
  296. package/src/components/heading/context.tsx +0 -13
  297. package/src/components/heading/index.ts +0 -3
  298. package/src/components/heading/useHeadingLevel.tsx +0 -8
  299. package/src/components/icon/Icon.stories.tsx +0 -47
  300. package/src/components/icon/Icon.test.tsx +0 -44
  301. package/src/components/icon/Icon.tsx +0 -24
  302. package/src/components/icon/index.ts +0 -1
  303. package/src/components/image-block/ImageBlock.stories.tsx +0 -119
  304. package/src/components/image-block/ImageBlock.test.tsx +0 -59
  305. package/src/components/image-block/ImageBlock.tsx +0 -142
  306. package/src/components/image-block/ImageCaption.tsx +0 -115
  307. package/src/components/image-block/index.ts +0 -1
  308. package/src/components/image-lightbox/ImageLightbox.stories.tsx +0 -161
  309. package/src/components/image-lightbox/ImageLightbox.test.tsx +0 -252
  310. package/src/components/image-lightbox/ImageLightbox.tsx +0 -90
  311. package/src/components/image-lightbox/constants.ts +0 -11
  312. package/src/components/image-lightbox/index.ts +0 -2
  313. package/src/components/image-lightbox/internal/ImageSlide.tsx +0 -107
  314. package/src/components/image-lightbox/internal/ImageSlideshow.tsx +0 -164
  315. package/src/components/image-lightbox/internal/useAnimateScroll.ts +0 -55
  316. package/src/components/image-lightbox/internal/usePointerZoom.ts +0 -148
  317. package/src/components/image-lightbox/types.ts +0 -50
  318. package/src/components/image-lightbox/useImageLightbox.tsx +0 -141
  319. package/src/components/inline-list/InlineList.stories.tsx +0 -78
  320. package/src/components/inline-list/InlineList.test.tsx +0 -54
  321. package/src/components/inline-list/InlineList.tsx +0 -96
  322. package/src/components/inline-list/index.ts +0 -1
  323. package/src/components/input-helper/InputHelper.stories.tsx +0 -35
  324. package/src/components/input-helper/InputHelper.test.tsx +0 -57
  325. package/src/components/input-helper/InputHelper.tsx +0 -65
  326. package/src/components/input-helper/constants.ts +0 -11
  327. package/src/components/input-helper/index.ts +0 -1
  328. package/src/components/input-label/InputLabel.stories.tsx +0 -47
  329. package/src/components/input-label/InputLabel.test.tsx +0 -61
  330. package/src/components/input-label/InputLabel.tsx +0 -69
  331. package/src/components/input-label/index.ts +0 -1
  332. package/src/components/lightbox/Lightbox.stories.tsx +0 -101
  333. package/src/components/lightbox/Lightbox.test.tsx +0 -55
  334. package/src/components/lightbox/Lightbox.tsx +0 -180
  335. package/src/components/lightbox/index.ts +0 -1
  336. package/src/components/link/Link.stories.tsx +0 -196
  337. package/src/components/link/Link.test.tsx +0 -127
  338. package/src/components/link/Link.tsx +0 -119
  339. package/src/components/link/index.ts +0 -1
  340. package/src/components/link-preview/LinkPreview.stories.tsx +0 -61
  341. package/src/components/link-preview/LinkPreview.test.tsx +0 -107
  342. package/src/components/link-preview/LinkPreview.tsx +0 -160
  343. package/src/components/link-preview/index.ts +0 -1
  344. package/src/components/list/List.stories.tsx +0 -116
  345. package/src/components/list/List.test.tsx +0 -20
  346. package/src/components/list/List.tsx +0 -104
  347. package/src/components/list/ListDivider.stories.tsx +0 -12
  348. package/src/components/list/ListDivider.test.tsx +0 -24
  349. package/src/components/list/ListDivider.tsx +0 -37
  350. package/src/components/list/ListItem.stories.tsx +0 -66
  351. package/src/components/list/ListItem.test.tsx +0 -95
  352. package/src/components/list/ListItem.tsx +0 -157
  353. package/src/components/list/ListSubheader.stories.tsx +0 -11
  354. package/src/components/list/ListSubheader.test.tsx +0 -23
  355. package/src/components/list/ListSubheader.tsx +0 -44
  356. package/src/components/list/index.ts +0 -4
  357. package/src/components/list/useInteractiveList.tsx +0 -202
  358. package/src/components/message/Message.stories.tsx +0 -72
  359. package/src/components/message/Message.test.tsx +0 -77
  360. package/src/components/message/Message.tsx +0 -100
  361. package/src/components/message/index.ts +0 -1
  362. package/src/components/mosaic/Mosaic.stories.tsx +0 -89
  363. package/src/components/mosaic/Mosaic.test.tsx +0 -79
  364. package/src/components/mosaic/Mosaic.tsx +0 -98
  365. package/src/components/mosaic/index.ts +0 -1
  366. package/src/components/navigation/Navigation.stories.tsx +0 -236
  367. package/src/components/navigation/Navigation.test.tsx +0 -67
  368. package/src/components/navigation/Navigation.tsx +0 -81
  369. package/src/components/navigation/NavigationItem.test.tsx +0 -37
  370. package/src/components/navigation/NavigationItem.tsx +0 -86
  371. package/src/components/navigation/NavigationSection.test.tsx +0 -139
  372. package/src/components/navigation/NavigationSection.tsx +0 -107
  373. package/src/components/navigation/context.tsx +0 -7
  374. package/src/components/navigation/index.ts +0 -1
  375. package/src/components/notification/Notification.test.tsx +0 -95
  376. package/src/components/notification/Notification.tsx +0 -138
  377. package/src/components/notification/Notifications.stories.tsx +0 -92
  378. package/src/components/notification/constants.ts +0 -28
  379. package/src/components/notification/index.ts +0 -1
  380. package/src/components/popover/Popover.stories.tsx +0 -264
  381. package/src/components/popover/Popover.test.tsx +0 -64
  382. package/src/components/popover/Popover.tsx +0 -201
  383. package/src/components/popover/constants.ts +0 -62
  384. package/src/components/popover/index.ts +0 -3
  385. package/src/components/popover/usePopoverStyle.tsx +0 -184
  386. package/src/components/popover/useRestoreFocusOnClose.tsx +0 -47
  387. package/src/components/popover-dialog/PopoverDialog.stories.tsx +0 -64
  388. package/src/components/popover-dialog/PopoverDialog.test.tsx +0 -140
  389. package/src/components/popover-dialog/PopoverDialog.tsx +0 -76
  390. package/src/components/popover-dialog/index.tsx +0 -1
  391. package/src/components/post-block/PostBlock.test.tsx +0 -29
  392. package/src/components/post-block/PostBlock.tsx +0 -122
  393. package/src/components/post-block/index.ts +0 -1
  394. package/src/components/progress/Progress.tsx +0 -70
  395. package/src/components/progress/ProgressCircular.stories.tsx +0 -44
  396. package/src/components/progress/ProgressCircular.test.tsx +0 -48
  397. package/src/components/progress/ProgressCircular.tsx +0 -84
  398. package/src/components/progress/ProgressLinear.stories.tsx +0 -12
  399. package/src/components/progress/ProgressLinear.test.tsx +0 -32
  400. package/src/components/progress/ProgressLinear.tsx +0 -52
  401. package/src/components/progress/index.ts +0 -3
  402. package/src/components/progress-tracker/ProgressTracker.stories.tsx +0 -145
  403. package/src/components/progress-tracker/ProgressTracker.test.tsx +0 -44
  404. package/src/components/progress-tracker/ProgressTracker.tsx +0 -87
  405. package/src/components/progress-tracker/ProgressTrackerProvider.test.tsx +0 -67
  406. package/src/components/progress-tracker/ProgressTrackerProvider.tsx +0 -67
  407. package/src/components/progress-tracker/ProgressTrackerStep.test.tsx +0 -38
  408. package/src/components/progress-tracker/ProgressTrackerStep.tsx +0 -159
  409. package/src/components/progress-tracker/ProgressTrackerStepPanel.test.tsx +0 -36
  410. package/src/components/progress-tracker/ProgressTrackerStepPanel.tsx +0 -69
  411. package/src/components/progress-tracker/index.ts +0 -4
  412. package/src/components/radio-button/RadioButton.stories.tsx +0 -71
  413. package/src/components/radio-button/RadioButton.test.tsx +0 -145
  414. package/src/components/radio-button/RadioButton.tsx +0 -143
  415. package/src/components/radio-button/RadioGroup.stories.tsx +0 -39
  416. package/src/components/radio-button/RadioGroup.test.tsx +0 -31
  417. package/src/components/radio-button/RadioGroup.tsx +0 -44
  418. package/src/components/radio-button/index.ts +0 -2
  419. package/src/components/select/Select.stories.tsx +0 -385
  420. package/src/components/select/Select.test.tsx +0 -200
  421. package/src/components/select/Select.tsx +0 -199
  422. package/src/components/select/SelectMultiple.stories.tsx +0 -315
  423. package/src/components/select/SelectMultiple.test.tsx +0 -215
  424. package/src/components/select/SelectMultiple.tsx +0 -206
  425. package/src/components/select/WithSelectContext.tsx +0 -147
  426. package/src/components/select/constants.ts +0 -55
  427. package/src/components/select/index.ts +0 -2
  428. package/src/components/side-navigation/SideNavigation.stories.tsx +0 -191
  429. package/src/components/side-navigation/SideNavigation.test.tsx +0 -39
  430. package/src/components/side-navigation/SideNavigation.tsx +0 -52
  431. package/src/components/side-navigation/SideNavigationItem.stories.tsx +0 -133
  432. package/src/components/side-navigation/SideNavigationItem.test.tsx +0 -138
  433. package/src/components/side-navigation/SideNavigationItem.tsx +0 -170
  434. package/src/components/side-navigation/index.ts +0 -2
  435. package/src/components/skeleton/SkeletonCircle.stories.tsx +0 -41
  436. package/src/components/skeleton/SkeletonCircle.test.tsx +0 -29
  437. package/src/components/skeleton/SkeletonCircle.tsx +0 -54
  438. package/src/components/skeleton/SkeletonRectangle.stories.tsx +0 -82
  439. package/src/components/skeleton/SkeletonRectangle.test.tsx +0 -29
  440. package/src/components/skeleton/SkeletonRectangle.tsx +0 -90
  441. package/src/components/skeleton/SkeletonTypography.stories.tsx +0 -21
  442. package/src/components/skeleton/SkeletonTypography.test.tsx +0 -29
  443. package/src/components/skeleton/SkeletonTypography.tsx +0 -59
  444. package/src/components/skeleton/index.ts +0 -3
  445. package/src/components/slider/Slider.stories.tsx +0 -45
  446. package/src/components/slider/Slider.test.tsx +0 -31
  447. package/src/components/slider/Slider.tsx +0 -299
  448. package/src/components/slider/index.ts +0 -2
  449. package/src/components/slideshow/Slides.tsx +0 -130
  450. package/src/components/slideshow/Slideshow.stories.tsx +0 -180
  451. package/src/components/slideshow/Slideshow.test.tsx +0 -37
  452. package/src/components/slideshow/Slideshow.tsx +0 -173
  453. package/src/components/slideshow/SlideshowControls.stories.tsx +0 -102
  454. package/src/components/slideshow/SlideshowControls.tsx +0 -243
  455. package/src/components/slideshow/SlideshowItem.tsx +0 -46
  456. package/src/components/slideshow/SlideshowItemGroup.tsx +0 -60
  457. package/src/components/slideshow/constants.ts +0 -24
  458. package/src/components/slideshow/index.ts +0 -4
  459. package/src/components/slideshow/useKeyNavigate.ts +0 -28
  460. package/src/components/slideshow/usePaginationVisibleRange.ts +0 -37
  461. package/src/components/slideshow/useSlideFocusManagement.tsx +0 -92
  462. package/src/components/slideshow/useSwipeNavigate.ts +0 -18
  463. package/src/components/switch/Switch.stories.tsx +0 -49
  464. package/src/components/switch/Switch.test.tsx +0 -146
  465. package/src/components/switch/Switch.tsx +0 -145
  466. package/src/components/switch/index.ts +0 -1
  467. package/src/components/table/Table.test.tsx +0 -31
  468. package/src/components/table/Table.tsx +0 -61
  469. package/src/components/table/TableBody.test.tsx +0 -32
  470. package/src/components/table/TableBody.tsx +0 -44
  471. package/src/components/table/TableCell.test.tsx +0 -74
  472. package/src/components/table/TableCell.tsx +0 -132
  473. package/src/components/table/TableHeader.test.tsx +0 -32
  474. package/src/components/table/TableHeader.tsx +0 -50
  475. package/src/components/table/TableRow.test.tsx +0 -42
  476. package/src/components/table/TableRow.tsx +0 -73
  477. package/src/components/table/index.ts +0 -5
  478. package/src/components/tabs/Tab.test.tsx +0 -52
  479. package/src/components/tabs/Tab.tsx +0 -133
  480. package/src/components/tabs/TabList.test.tsx +0 -51
  481. package/src/components/tabs/TabList.tsx +0 -94
  482. package/src/components/tabs/TabPanel.test.tsx +0 -39
  483. package/src/components/tabs/TabPanel.tsx +0 -69
  484. package/src/components/tabs/TabProvider.test.tsx +0 -163
  485. package/src/components/tabs/TabProvider.tsx +0 -67
  486. package/src/components/tabs/Tabs.stories.tsx +0 -170
  487. package/src/components/tabs/index.ts +0 -4
  488. package/src/components/tabs/state.ts +0 -114
  489. package/src/components/tabs/test-utils.ts +0 -39
  490. package/src/components/text/Text.stories.tsx +0 -177
  491. package/src/components/text/Text.test.tsx +0 -94
  492. package/src/components/text/Text.tsx +0 -141
  493. package/src/components/text/index.ts +0 -1
  494. package/src/components/text-field/TextField.stories.tsx +0 -180
  495. package/src/components/text-field/TextField.test.tsx +0 -299
  496. package/src/components/text-field/TextField.tsx +0 -493
  497. package/src/components/text-field/index.ts +0 -1
  498. package/src/components/thumbnail/Thumbnail.stories.tsx +0 -448
  499. package/src/components/thumbnail/Thumbnail.test.tsx +0 -66
  500. package/src/components/thumbnail/Thumbnail.tsx +0 -248
  501. package/src/components/thumbnail/index.ts +0 -3
  502. package/src/components/thumbnail/types.ts +0 -48
  503. package/src/components/thumbnail/useFocusPointStyle.test.ts +0 -92
  504. package/src/components/thumbnail/useFocusPointStyle.tsx +0 -107
  505. package/src/components/thumbnail/useImageLoad.ts +0 -40
  506. package/src/components/toolbar/Toolbar.tsx +0 -68
  507. package/src/components/toolbar/index.ts +0 -1
  508. package/src/components/tooltip/Tooltip.stories.tsx +0 -117
  509. package/src/components/tooltip/Tooltip.test.tsx +0 -411
  510. package/src/components/tooltip/Tooltip.tsx +0 -165
  511. package/src/components/tooltip/constants.ts +0 -8
  512. package/src/components/tooltip/context.tsx +0 -17
  513. package/src/components/tooltip/index.ts +0 -1
  514. package/src/components/tooltip/useInjectTooltipRef.tsx +0 -55
  515. package/src/components/tooltip/useTooltipOpen.tsx +0 -143
  516. package/src/components/uploader/Uploader.stories.tsx +0 -109
  517. package/src/components/uploader/Uploader.test.tsx +0 -148
  518. package/src/components/uploader/Uploader.tsx +0 -177
  519. package/src/components/uploader/index.ts +0 -1
  520. package/src/components/user-block/UserBlock.stories.tsx +0 -135
  521. package/src/components/user-block/UserBlock.test.tsx +0 -108
  522. package/src/components/user-block/UserBlock.tsx +0 -193
  523. package/src/components/user-block/index.ts +0 -1
  524. package/src/constants.ts +0 -27
  525. package/src/hooks/useBooleanState.tsx +0 -13
  526. package/src/hooks/useCallbackOnEscape.ts +0 -34
  527. package/src/hooks/useChipGroupNavigation.tsx +0 -75
  528. package/src/hooks/useClickAway.tsx +0 -48
  529. package/src/hooks/useDisableBodyScroll.ts +0 -28
  530. package/src/hooks/useEventCallback.tsx +0 -17
  531. package/src/hooks/useFocus.tsx +0 -21
  532. package/src/hooks/useFocusTrap.ts +0 -93
  533. package/src/hooks/useFocusWithin.ts +0 -33
  534. package/src/hooks/useId.test.tsx +0 -23
  535. package/src/hooks/useId.ts +0 -15
  536. package/src/hooks/useImageSize.ts +0 -17
  537. package/src/hooks/useInfiniteScroll.tsx +0 -60
  538. package/src/hooks/useIntersectionObserver.tsx +0 -43
  539. package/src/hooks/useInterval.tsx +0 -31
  540. package/src/hooks/useKeyboardListNavigation.tsx +0 -204
  541. package/src/hooks/useListenFocus.tsx +0 -26
  542. package/src/hooks/useOverflowTooltipLabel.tsx +0 -32
  543. package/src/hooks/usePopper.ts +0 -12
  544. package/src/hooks/usePreviousValue.ts +0 -13
  545. package/src/hooks/useRovingTabIndex.tsx +0 -90
  546. package/src/hooks/useSizeOnWindowResize.ts +0 -30
  547. package/src/hooks/useSlideshowControls.ts +0 -246
  548. package/src/hooks/useStopPropagation.ts +0 -21
  549. package/src/hooks/useTransitionVisibility.ts +0 -48
  550. package/src/index.ts +0 -63
  551. package/src/stories/controls/color.ts +0 -7
  552. package/src/stories/controls/element.ts +0 -6
  553. package/src/stories/controls/focusPoint.ts +0 -1
  554. package/src/stories/controls/icons.ts +0 -126
  555. package/src/stories/controls/image.ts +0 -84
  556. package/src/stories/controls/selectArgType.ts +0 -8
  557. package/src/stories/controls/theme.ts +0 -3
  558. package/src/stories/controls/typography.ts +0 -5
  559. package/src/stories/controls/withUndefined.ts +0 -1
  560. package/src/stories/decorators/withChromaticForceScreenSize.tsx +0 -8
  561. package/src/stories/decorators/withCombinations.tsx +0 -132
  562. package/src/stories/decorators/withNestedProps.tsx +0 -23
  563. package/src/stories/decorators/withResizableBox.tsx +0 -21
  564. package/src/stories/decorators/withThemedBackground.tsx +0 -18
  565. package/src/stories/decorators/withValueOnChange.tsx +0 -18
  566. package/src/stories/decorators/withWrapper.tsx +0 -21
  567. package/src/stories/generated/Autocomplete/Demos.stories.tsx +0 -7
  568. package/src/stories/generated/Avatar/Demos.stories.tsx +0 -7
  569. package/src/stories/generated/Badge/Demos.stories.tsx +0 -9
  570. package/src/stories/generated/Button/Demos.stories.tsx +0 -11
  571. package/src/stories/generated/Checkbox/Demos.stories.tsx +0 -6
  572. package/src/stories/generated/Chip/Demos.stories.tsx +0 -11
  573. package/src/stories/generated/CommentBlock/Demos.stories.tsx +0 -8
  574. package/src/stories/generated/DatePicker/Demos.stories.tsx +0 -8
  575. package/src/stories/generated/Dialog/Demos.stories.tsx +0 -10
  576. package/src/stories/generated/Divider/Demos.stories.tsx +0 -6
  577. package/src/stories/generated/Dropdown/Demos.stories.tsx +0 -8
  578. package/src/stories/generated/ExpansionPanel/Demos.stories.tsx +0 -9
  579. package/src/stories/generated/Flag/Demos.stories.tsx +0 -6
  580. package/src/stories/generated/GenericBlock/Demos.stories.tsx +0 -8
  581. package/src/stories/generated/Heading/Demos.stories.tsx +0 -6
  582. package/src/stories/generated/Icon/Demos.stories.tsx +0 -8
  583. package/src/stories/generated/ImageBlock/Demos.stories.tsx +0 -9
  584. package/src/stories/generated/ImageLightbox/Demos.stories.tsx +0 -6
  585. package/src/stories/generated/Lightbox/Demos.stories.tsx +0 -6
  586. package/src/stories/generated/LinkPreview/Demos.stories.tsx +0 -7
  587. package/src/stories/generated/List/Demos.stories.tsx +0 -11
  588. package/src/stories/generated/Message/Demos.stories.tsx +0 -11
  589. package/src/stories/generated/Mosaic/Demos.stories.tsx +0 -10
  590. package/src/stories/generated/Notification/Demos.stories.tsx +0 -6
  591. package/src/stories/generated/Popover/Demos.stories.tsx +0 -11
  592. package/src/stories/generated/PopoverDialog/Demos.stories.tsx +0 -6
  593. package/src/stories/generated/PostBlock/Demos.stories.tsx +0 -6
  594. package/src/stories/generated/Progress/Demos.stories.tsx +0 -7
  595. package/src/stories/generated/ProgressTracker/Demos.stories.tsx +0 -9
  596. package/src/stories/generated/RadioButton/Demos.stories.tsx +0 -6
  597. package/src/stories/generated/Select/Demos.stories.tsx +0 -14
  598. package/src/stories/generated/SideNavigation/Demos.stories.tsx +0 -10
  599. package/src/stories/generated/Skeleton/Demos.stories.tsx +0 -9
  600. package/src/stories/generated/Slider/Demos.stories.tsx +0 -9
  601. package/src/stories/generated/Slideshow/Demos.stories.tsx +0 -8
  602. package/src/stories/generated/Switch/Demos.stories.tsx +0 -6
  603. package/src/stories/generated/Table/Demos.stories.tsx +0 -7
  604. package/src/stories/generated/Tabs/Demos.stories.tsx +0 -8
  605. package/src/stories/generated/TextField/Demos.stories.tsx +0 -20
  606. package/src/stories/generated/Thumbnail/Demos.stories.tsx +0 -12
  607. package/src/stories/generated/Toolbar/Demos.stories.tsx +0 -10
  608. package/src/stories/generated/Tooltip/Demos.stories.tsx +0 -8
  609. package/src/stories/generated/Uploader/Demos.stories.tsx +0 -8
  610. package/src/stories/generated/UserBlock/Demos.stories.tsx +0 -11
  611. package/src/stories/utils/CustomLink.tsx +0 -13
  612. package/src/stories/utils/concatPath.tsx +0 -17
  613. package/src/stories/utils/disableArgTypes.ts +0 -3
  614. package/src/stories/utils/initDemoShadowDOMPortal.ts +0 -10
  615. package/src/stories/utils/lorem.ts +0 -59
  616. package/src/stories/utils/theming.tsx +0 -166
  617. package/src/stories/utils/toFlattenProps.ts +0 -28
  618. package/src/stories/utils/withCategory.ts +0 -12
  619. package/src/testing/utils/ThemeSentinel.tsx +0 -11
  620. package/src/testing/utils/commonTestsSuiteRTL.tsx +0 -193
  621. package/src/testing/utils/index.ts +0 -1
  622. package/src/testing/utils/queries.ts +0 -19
  623. package/src/untypped-modules.d.ts +0 -5
  624. package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.jsx +0 -70
  625. package/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +0 -69
  626. package/src/utils/ClickAwayProvider/index.ts +0 -1
  627. package/src/utils/MaterialThemeSwitcher/MaterialThemeSwitcher.tsx +0 -54
  628. package/src/utils/MaterialThemeSwitcher/index.ts +0 -1
  629. package/src/utils/Portal/Portal.test.tsx +0 -32
  630. package/src/utils/Portal/Portal.tsx +0 -33
  631. package/src/utils/Portal/PortalProvider.stories.jsx +0 -23
  632. package/src/utils/Portal/PortalProvider.test.tsx +0 -73
  633. package/src/utils/Portal/PortalProvider.tsx +0 -24
  634. package/src/utils/Portal/index.tsx +0 -2
  635. package/src/utils/browser/DOM/findImage.tsx +0 -3
  636. package/src/utils/browser/DOM/startViewTransition.ts +0 -68
  637. package/src/utils/browser/focus/constants.ts +0 -7
  638. package/src/utils/browser/focus/getFirstAndLastFocusable.test.ts +0 -134
  639. package/src/utils/browser/focus/getFirstAndLastFocusable.ts +0 -21
  640. package/src/utils/browser/focus/getFocusableElements.test.ts +0 -151
  641. package/src/utils/browser/focus/getFocusableElements.ts +0 -7
  642. package/src/utils/browser/isFocusVisible.ts +0 -9
  643. package/src/utils/browser/isHoverNotSupported.test.js +0 -24
  644. package/src/utils/browser/isHoverNotSupported.ts +0 -2
  645. package/src/utils/browser/isReducedMotion.ts +0 -6
  646. package/src/utils/date/addMonthResetDay.test.ts +0 -13
  647. package/src/utils/date/addMonthResetDay.ts +0 -9
  648. package/src/utils/date/formatDayNumber.test.ts +0 -12
  649. package/src/utils/date/formatDayNumber.ts +0 -5
  650. package/src/utils/date/getFirstDayOfWeek.test.ts +0 -20
  651. package/src/utils/date/getFirstDayOfWeek.ts +0 -59
  652. package/src/utils/date/getMonthCalendar.test.ts +0 -127
  653. package/src/utils/date/getMonthCalendar.ts +0 -69
  654. package/src/utils/date/getWeekDays.test.ts +0 -48
  655. package/src/utils/date/getWeekDays.ts +0 -34
  656. package/src/utils/date/getYearDisplayName.test.ts +0 -20
  657. package/src/utils/date/getYearDisplayName.ts +0 -12
  658. package/src/utils/date/isDateValid.test.ts +0 -15
  659. package/src/utils/date/isDateValid.ts +0 -4
  660. package/src/utils/date/isSameDay.test.ts +0 -37
  661. package/src/utils/date/isSameDay.ts +0 -11
  662. package/src/utils/disabled/DisabledStateContext.tsx +0 -29
  663. package/src/utils/disabled/DisabledStateProvider.stories.tsx +0 -94
  664. package/src/utils/disabled/index.ts +0 -2
  665. package/src/utils/disabled/useDisableStateProps.test.tsx +0 -74
  666. package/src/utils/disabled/useDisableStateProps.tsx +0 -37
  667. package/src/utils/function/makeListenerTowerContext.ts +0 -32
  668. package/src/utils/index.ts +0 -7
  669. package/src/utils/locale/getCurrentLocale.ts +0 -4
  670. package/src/utils/locale/parseLocale.test.ts +0 -17
  671. package/src/utils/locale/parseLocale.ts +0 -23
  672. package/src/utils/locale/types.ts +0 -8
  673. package/src/utils/number/clamp.ts +0 -17
  674. package/src/utils/object/isEqual.test.ts +0 -25
  675. package/src/utils/object/isEqual.ts +0 -11
  676. package/src/utils/partitionMulti.test.ts +0 -27
  677. package/src/utils/react/OnBeforeUnmount.tsx +0 -20
  678. package/src/utils/react/flattenChildren.ts +0 -32
  679. package/src/utils/react/forwardRef.ts +0 -11
  680. package/src/utils/react/forwardRefPolymorphic.ts +0 -9
  681. package/src/utils/react/mergeRefs.ts +0 -33
  682. package/src/utils/react/renderButtonOrLink.tsx +0 -16
  683. package/src/utils/react/renderLink.tsx +0 -17
  684. package/src/utils/react/skipRender.tsx +0 -18
  685. package/src/utils/react/unref.ts +0 -7
  686. package/src/utils/react/wrapChildrenIconWithSpaces.test.tsx +0 -37
  687. package/src/utils/react/wrapChildrenIconWithSpaces.tsx +0 -22
  688. package/src/utils/theme/ThemeContext.ts +0 -16
  689. package/src/utils/theme/invertTheme.ts +0 -4
  690. package/src/utils/type/Comp.ts +0 -14
  691. package/src/utils/type/ComponentRef.ts +0 -16
  692. package/src/utils/type/HasAriaDisabled.ts +0 -6
  693. package/src/utils/type/HasPolymorphicAs.ts +0 -8
  694. package/src/utils/type/MaybeElementOrRef.ts +0 -6
  695. package/src/utils/type/index.ts +0 -8
  696. package/src/utils/type/isComponent.ts +0 -33
  697. package/src/utils/type/isComponentType.ts +0 -9
package/CONTRIBUTING.md CHANGED
@@ -4,7 +4,7 @@ We'd love for you to contribute to our source code and to make it even better th
4
4
 
5
5
  ## Getting the source code
6
6
 
7
- To be able to contribute, you will have to use the global LumX package from our [GitHub repository](https://github.com/lumapps/design-system). You won't be able to contribute from the distributed packages `@lumx/<angularjs|react>`, so be sure to clone the repository before starting contributing:
7
+ To be able to contribute, you will have to use the global LumX package from our [GitHub repository](https://github.com/lumapps/design-system). You won't be able to contribute from the distributed packages, so be sure to clone the repository before starting contributing:
8
8
 
9
9
  ```bash
10
10
  git clone git@github.com:lumapps/design-system.git
@@ -25,10 +25,6 @@ Here are the guidelines we'd like you to follow.
25
25
  - [Coding rules](#coding-rules)
26
26
  - [Git commit guidelines](#git-commit-guidelines)
27
27
 
28
- ## <a name="code-of-conduct"></a> Code of Conduct
29
-
30
- As heavy users of [AngularJS](https://github.com/angular/angular.js) and [React](https://github.com/facebook/react/), we encourage you to read and follow the [AngularJS Code of Conduct](https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md) and the [React Code of Conduct](https://github.com/facebook/react/blob/master/CODE_OF_CONDUCT.md).
31
-
32
28
  ## <a name="got-a-question-or-a-problem-"></a> Got a question or a problem?
33
29
 
34
30
  If you have questions about how to use LumX, please direct these to [StackOverflow](http://stackoverflow.com/questions/tagged/LumX).
package/README.md CHANGED
@@ -30,9 +30,7 @@ Please refer to our [contributing guidelines](CONTRIBUTING.md).
30
30
 
31
31
  Code and documentation copyright 2019 LumApps. Code released under the [MIT license](LICENSE.md).
32
32
 
33
- [angularjs]: https://angularjs.org/
34
33
  [react]: https://react.org/
35
34
  [material]: http://www.google.com/design/spec/material-design/introduction.html
36
- [angularjs-release]: https://www.npmjs.com/package/@lumx/angularjs
37
35
  [react-release]: https://www.npmjs.com/package/@lumx/react
38
36
  [webpack]: https://webpack.js.org/
@@ -0,0 +1,98 @@
1
+ import { f as forwardRef, c as classNames } from './forwardRef-15f62847.js';
2
+ import isEmpty from 'lodash/isEmpty';
3
+ import { i as isComponent } from './isComponent-78df9309.js';
4
+ import { getRootClassName, getBasicClass } from '@lumx/core/js/utils/className';
5
+ import { u as useTheme, T as ThemeProvider } from './ThemeContext-3181f000.js';
6
+ import { B as ButtonRoot } from './ButtonRoot-823f3e9c.js';
7
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
+ import { T as Text } from './index-a9c5cd69.js';
9
+ import { Emphasis, Size, Theme } from '@lumx/core/js/constants';
10
+ import { Icon } from './components/icon-b708cca4.js';
11
+
12
+ const ButtonEmphasis = Emphasis;
13
+
14
+ /**
15
+ * Defines the props of the component.
16
+ */
17
+
18
+ /**
19
+ * Component display name.
20
+ */
21
+ const COMPONENT_NAME = 'Button';
22
+
23
+ /**
24
+ * Component default class name and class prefix.
25
+ */
26
+ const CLASSNAME = getRootClassName(COMPONENT_NAME);
27
+
28
+ /**
29
+ * Component default props.
30
+ */
31
+ const DEFAULT_PROPS = {
32
+ emphasis: Emphasis.high,
33
+ size: Size.m
34
+ };
35
+
36
+ /**
37
+ * Button component.
38
+ *
39
+ * @param props Component props.
40
+ * @param ref Component ref.
41
+ * @return React element.
42
+ */
43
+ const Button = forwardRef((props, ref) => {
44
+ const defaultTheme = useTheme() || Theme.light;
45
+ const {
46
+ children,
47
+ className,
48
+ emphasis = DEFAULT_PROPS.emphasis,
49
+ leftIcon,
50
+ rightIcon,
51
+ size = DEFAULT_PROPS.size,
52
+ theme = defaultTheme,
53
+ ...forwardedProps
54
+ } = props;
55
+ const buttonClassName = classNames(className, getBasicClass({
56
+ prefix: CLASSNAME,
57
+ type: 'hasLeftIcon',
58
+ value: !isEmpty(leftIcon)
59
+ }), getBasicClass({
60
+ prefix: CLASSNAME,
61
+ type: 'hasRightIcon',
62
+ value: !isEmpty(rightIcon)
63
+ }));
64
+ return /*#__PURE__*/jsxs(ButtonRoot, {
65
+ ref: ref,
66
+ emphasis,
67
+ size,
68
+ theme,
69
+ ...forwardedProps,
70
+ className: buttonClassName,
71
+ variant: "button",
72
+ children: [leftIcon && !isEmpty(leftIcon) &&
73
+ /*#__PURE__*/
74
+ // Theme is handled in the button scss
75
+ jsx(ThemeProvider, {
76
+ value: undefined,
77
+ children: /*#__PURE__*/jsx(Icon, {
78
+ icon: leftIcon
79
+ })
80
+ }), children && (isComponent(Text)(children) ? children : /*#__PURE__*/jsx("span", {
81
+ children: children
82
+ })), rightIcon && !isEmpty(rightIcon) &&
83
+ /*#__PURE__*/
84
+ // Theme is handled in the button scss
85
+ jsx(ThemeProvider, {
86
+ value: undefined,
87
+ children: /*#__PURE__*/jsx(Icon, {
88
+ icon: rightIcon
89
+ })
90
+ })]
91
+ });
92
+ });
93
+ Button.displayName = COMPONENT_NAME;
94
+ Button.className = CLASSNAME;
95
+ Button.defaultProps = DEFAULT_PROPS;
96
+
97
+ export { ButtonEmphasis as B, Button as a };
98
+ //# sourceMappingURL=Button-1f227024.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button-1f227024.js","sources":["../../src/components/button/Button.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport isEmpty from 'lodash/isEmpty';\n\nimport { Emphasis, Icon, Size, Theme, Text, ThemeProvider } from '@lumx/react';\nimport { isComponent } from '@lumx/react/utils/type';\nimport { getBasicClass, getRootClassName } from '@lumx/core/js/utils/className';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\n\nimport { BaseButtonProps, ButtonRoot } from './ButtonRoot';\n\n/**\n * Button emphasis definition.\n * @deprecated Use Emphasis instead.\n */\nexport const ButtonEmphasis = Emphasis;\n\n/**\n * Defines the props of the component.\n */\nexport interface ButtonProps extends BaseButtonProps {\n /** Left icon (SVG path). */\n leftIcon?: string;\n /** Right icon (SVG path). */\n rightIcon?: string;\n /** When `true`, the button gets as large as possible. */\n fullWidth?: boolean;\n /** Children */\n children?: React.ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Button';\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<ButtonProps> = {\n emphasis: Emphasis.high,\n size: Size.m,\n};\n\n/**\n * Button component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Button = forwardRef<ButtonProps, HTMLButtonElement | HTMLAnchorElement>((props, ref) => {\n const defaultTheme = useTheme() || Theme.light;\n const {\n children,\n className,\n emphasis = DEFAULT_PROPS.emphasis,\n leftIcon,\n rightIcon,\n size = DEFAULT_PROPS.size,\n theme = defaultTheme,\n ...forwardedProps\n } = props;\n\n const buttonClassName = classNames(\n className,\n getBasicClass({ prefix: CLASSNAME, type: 'hasLeftIcon', value: !isEmpty(leftIcon) }),\n getBasicClass({ prefix: CLASSNAME, type: 'hasRightIcon', value: !isEmpty(rightIcon) }),\n );\n\n return (\n <ButtonRoot\n ref={ref}\n {...{ emphasis, size, theme, ...forwardedProps }}\n className={buttonClassName}\n variant=\"button\"\n >\n {leftIcon && !isEmpty(leftIcon) && (\n // Theme is handled in the button scss\n <ThemeProvider value={undefined}>\n <Icon icon={leftIcon} />\n </ThemeProvider>\n )}\n {children && (isComponent(Text)(children) ? children : <span>{children}</span>)}\n {rightIcon && !isEmpty(rightIcon) && (\n // Theme is handled in the button scss\n <ThemeProvider value={undefined}>\n <Icon icon={rightIcon} />\n </ThemeProvider>\n )}\n </ButtonRoot>\n );\n});\nButton.displayName = COMPONENT_NAME;\nButton.className = CLASSNAME;\nButton.defaultProps = DEFAULT_PROPS;\n"],"names":["ButtonEmphasis","Emphasis","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","emphasis","high","size","Size","m","Button","forwardRef","props","ref","defaultTheme","useTheme","Theme","light","children","className","leftIcon","rightIcon","theme","forwardedProps","buttonClassName","classNames","getBasicClass","prefix","type","value","isEmpty","_jsxs","ButtonRoot","variant","_jsx","ThemeProvider","undefined","Icon","icon","isComponent","Text","displayName","defaultProps"],"mappings":";;;;;;;;;;;AAeO,MAAMA,cAAc,GA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AA,SAAS,EAAEK,eAAgB;AAC3BS,IAAAA,OAAO,EAAC,QAAQ;AAAAf,IAAAA,QAAA,GAEfE,QAAQ,IAAI,CAACU,OAAO,CAACV,QAAQ,CAAC;AAAA;AAC3B;AACAc,IAAAA,GAAA,CAACC,aAAa,EAAA;AAACN,MAAAA,KAAK,EAAEO,SAAU;MAAAlB,QAAA,eAC5BgB,GAAA,CAACG,IAAI,EAAA;AAACC,QAAAA,IAAI,EAAElB,QAAAA;OAAW,CAAA;AAAC,KACb,CAClB,EACAF,QAAQ,KAAKqB,WAAW,CAACC,IAAI,CAAC,CAACtB,QAAQ,CAAC,GAAGA,QAAQ,gBAAGgB,GAAA,CAAA,MAAA,EAAA;AAAAhB,MAAAA,QAAA,EAAOA,QAAAA;KAAe,CAAC,CAAC,EAC9EG,SAAS,IAAI,CAACS,OAAO,CAACT,SAAS,CAAC;AAAA;AAC7B;AACAa,IAAAA,GAAA,CAACC,aAAa,EAAA;AAACN,MAAAA,KAAK,EAAEO,SAAU;MAAAlB,QAAA,eAC5BgB,GAAA,CAACG,IAAI,EAAA;AAACC,QAAAA,IAAI,EAAEjB,SAAAA;OAAY,CAAA;AAAC,KACd,CAClB,CAAA;AAAA,GACO,CAAC,CAAA;AAErB,CAAC,EAAC;AACFX,MAAM,CAAC+B,WAAW,GAAGxC,cAAc,CAAA;AACnCS,MAAM,CAACS,SAAS,GAAGjB,SAAS,CAAA;AAC5BQ,MAAM,CAACgC,YAAY,GAAGtC,aAAa;;;;"}
@@ -0,0 +1,117 @@
1
+ import { f as forwardRef, c as classNames } from './forwardRef-15f62847.js';
2
+ import './constants-d0e3f49e.js';
3
+ import { handleBasicClasses } from '@lumx/core/js/utils/className';
4
+ import { R as RawClickable } from './RawClickable-2c2b6a89.js';
5
+ import { jsx } from 'react/jsx-runtime';
6
+ import { u as useDisableStateProps } from './useDisableStateProps-69e16b7c.js';
7
+ import { Emphasis, Theme, ColorPalette, CSS_PREFIX } from '@lumx/core/js/constants';
8
+
9
+ /**
10
+ * Component display name.
11
+ */
12
+ const COMPONENT_NAME = 'ButtonRoot';
13
+ const BUTTON_WRAPPER_CLASSNAME = `${CSS_PREFIX}-button-wrapper`;
14
+ const BUTTON_CLASSNAME = `${CSS_PREFIX}-button`;
15
+
16
+ /**
17
+ * Render a button wrapper with the ButtonRoot inside.
18
+ *
19
+ * @param props Component props.
20
+ * @return React element.
21
+ */
22
+ const renderButtonWrapper = props => {
23
+ const {
24
+ color,
25
+ emphasis,
26
+ variant,
27
+ fullWidth
28
+ } = props;
29
+ const adaptedColor = emphasis === Emphasis.low && (color === ColorPalette.light ? ColorPalette.dark : ColorPalette.light);
30
+ const wrapperClassName = classNames(handleBasicClasses({
31
+ color: adaptedColor,
32
+ prefix: BUTTON_WRAPPER_CLASSNAME,
33
+ variant,
34
+ fullWidth
35
+ }));
36
+ const buttonProps = {
37
+ ...props,
38
+ hasBackground: false
39
+ };
40
+ return /*#__PURE__*/jsx("div", {
41
+ className: wrapperClassName,
42
+ children: /*#__PURE__*/jsx(ButtonRoot, {
43
+ ...buttonProps
44
+ })
45
+ });
46
+ };
47
+
48
+ /**
49
+ * ButtonRoot component.
50
+ *
51
+ * @param props Component props.
52
+ * @param ref Component ref.
53
+ * @return React element.
54
+ */
55
+ const ButtonRoot = forwardRef((props, ref) => {
56
+ const {
57
+ isAnyDisabled,
58
+ disabledStateProps,
59
+ otherProps
60
+ } = useDisableStateProps(props);
61
+ const {
62
+ 'aria-label': ariaLabel,
63
+ children,
64
+ className,
65
+ color,
66
+ emphasis,
67
+ hasBackground,
68
+ isSelected,
69
+ isActive,
70
+ isFocused,
71
+ isHovered,
72
+ linkAs,
73
+ size,
74
+ theme,
75
+ variant,
76
+ fullWidth,
77
+ ...forwardedProps
78
+ } = otherProps;
79
+ const adaptedColor = color || emphasis !== Emphasis.high && theme === Theme.dark && ColorPalette.light || emphasis === Emphasis.high && ColorPalette.primary || ColorPalette.dark;
80
+ if (hasBackground) {
81
+ return renderButtonWrapper({
82
+ ...props,
83
+ ref,
84
+ variant,
85
+ color: adaptedColor
86
+ });
87
+ }
88
+ const buttonClassName = classNames(className, handleBasicClasses({
89
+ color: adaptedColor,
90
+ emphasis,
91
+ isSelected,
92
+ isDisabled: props.isDisabled || props['aria-disabled'],
93
+ isActive,
94
+ isFocused,
95
+ isHovered,
96
+ prefix: BUTTON_CLASSNAME,
97
+ size,
98
+ theme: emphasis === Emphasis.high && theme,
99
+ variant,
100
+ fullWidth
101
+ }));
102
+ return /*#__PURE__*/jsx(RawClickable, {
103
+ as: linkAs || (forwardedProps.href ? 'a' : 'button'),
104
+ ...forwardedProps,
105
+ ...disabledStateProps,
106
+ "aria-disabled": isAnyDisabled,
107
+ "aria-label": ariaLabel,
108
+ ref: ref,
109
+ className: buttonClassName,
110
+ children: children
111
+ });
112
+ });
113
+ ButtonRoot.displayName = COMPONENT_NAME;
114
+ ButtonRoot.defaultProps = {};
115
+
116
+ export { ButtonRoot as B };
117
+ //# sourceMappingURL=ButtonRoot-823f3e9c.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonRoot-823f3e9c.js","sources":["../../src/components/button/ButtonRoot.tsx"],"sourcesContent":["import { AriaAttributes, ButtonHTMLAttributes, DetailedHTMLProps, RefObject } from 'react';\n\nimport classNames from 'classnames';\n\nimport { ColorPalette, Emphasis, Size, Theme } from '@lumx/react';\nimport { CSS_PREFIX } from '@lumx/react/constants';\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\nimport { HasAriaDisabled } from '@lumx/react/utils/type/HasAriaDisabled';\nimport { RawClickable } from '@lumx/react/utils/react/RawClickable';\nimport { useDisableStateProps } from '@lumx/react/utils/disabled';\n\ntype HTMLButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;\n\n/**\n * Button size definition.\n */\nexport type ButtonSize = Extract<Size, 's' | 'm'>;\n\nexport interface BaseButtonProps\n extends GenericProps,\n Pick<AriaAttributes, 'aria-expanded' | 'aria-haspopup' | 'aria-pressed' | 'aria-label'>,\n HasTheme,\n HasAriaDisabled {\n /** Color variant. */\n color?: ColorPalette;\n /** Emphasis variant. */\n emphasis?: Emphasis;\n /** Whether or not the button has a background color in low emphasis. */\n hasBackground?: boolean;\n /** Native anchor href property. It determines whether the Button will be a <button> or an <a>. */\n href?: string;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Whether the component is selected or not (unsupported in `high` emphasis). */\n isSelected?: boolean;\n /** Native button name property. */\n name?: string;\n /** Size variant. */\n size?: ButtonSize;\n /** Native anchor target property. */\n target?: '_self' | '_blank' | '_parent' | '_top';\n /** Native button type. */\n type?: HTMLButtonProps['type'];\n /** Custom react component for the link (can be used to inject react router Link). */\n linkAs?: 'a' | any;\n}\n\nexport interface ButtonRootProps extends BaseButtonProps {\n variant: 'button' | 'icon';\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'ButtonRoot';\n\nexport const BUTTON_WRAPPER_CLASSNAME = `${CSS_PREFIX}-button-wrapper`;\nexport const BUTTON_CLASSNAME = `${CSS_PREFIX}-button`;\n\n/**\n * Render a button wrapper with the ButtonRoot inside.\n *\n * @param props Component props.\n * @return React element.\n */\nconst renderButtonWrapper: React.FC<ButtonRootProps> = (props) => {\n const { color, emphasis, variant, fullWidth } = props;\n\n const adaptedColor =\n emphasis === Emphasis.low && (color === ColorPalette.light ? ColorPalette.dark : ColorPalette.light);\n\n const wrapperClassName = classNames(\n handleBasicClasses({\n color: adaptedColor,\n prefix: BUTTON_WRAPPER_CLASSNAME,\n variant,\n fullWidth,\n }),\n );\n const buttonProps = { ...props, hasBackground: false };\n\n return (\n <div className={wrapperClassName}>\n {/* eslint-disable-next-line @typescript-eslint/no-use-before-define */}\n <ButtonRoot {...buttonProps} />\n </div>\n );\n};\n\n/**\n * ButtonRoot component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const ButtonRoot = forwardRef<ButtonRootProps, HTMLButtonElement | HTMLAnchorElement>((props, ref) => {\n const { isAnyDisabled, disabledStateProps, otherProps } = useDisableStateProps(props);\n const {\n 'aria-label': ariaLabel,\n children,\n className,\n color,\n emphasis,\n hasBackground,\n isSelected,\n isActive,\n isFocused,\n isHovered,\n linkAs,\n size,\n theme,\n variant,\n fullWidth,\n ...forwardedProps\n } = otherProps;\n\n const adaptedColor =\n color ||\n (emphasis !== Emphasis.high && theme === Theme.dark && ColorPalette.light) ||\n (emphasis === Emphasis.high && ColorPalette.primary) ||\n ColorPalette.dark;\n\n if (hasBackground) {\n return renderButtonWrapper({ ...props, ref, variant, color: adaptedColor });\n }\n\n const buttonClassName = classNames(\n className,\n handleBasicClasses({\n color: adaptedColor,\n emphasis,\n isSelected,\n isDisabled: props.isDisabled || props['aria-disabled'],\n isActive,\n isFocused,\n isHovered,\n prefix: BUTTON_CLASSNAME,\n size,\n theme: emphasis === Emphasis.high && theme,\n variant,\n fullWidth,\n }),\n );\n\n return (\n <RawClickable\n as={linkAs || (forwardedProps.href ? 'a' : 'button')}\n {...forwardedProps}\n {...disabledStateProps}\n aria-disabled={isAnyDisabled}\n aria-label={ariaLabel}\n ref={ref as RefObject<HTMLButtonElement>}\n className={buttonClassName}\n >\n {children}\n </RawClickable>\n );\n});\nButtonRoot.displayName = COMPONENT_NAME;\nButtonRoot.defaultProps = {};\n"],"names":["COMPONENT_NAME","BUTTON_WRAPPER_CLASSNAME","CSS_PREFIX","BUTTON_CLASSNAME","renderButtonWrapper","props","color","emphasis","variant","fullWidth","adaptedColor","Emphasis","low","ColorPalette","light","dark","wrapperClassName","classNames","handleBasicClasses","prefix","buttonProps","hasBackground","_jsx","className","children","ButtonRoot","forwardRef","ref","isAnyDisabled","disabledStateProps","otherProps","useDisableStateProps","ariaLabel","isSelected","isActive","isFocused","isHovered","linkAs","size","theme","forwardedProps","high","Theme","primary","buttonClassName","isDisabled","RawClickable","as","href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,CAACwB,YAAY,EAAA;IACTC,EAAE,EAAEV,MAAM,KAAKG,cAAc,CAACQ,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAE;AAAA,IAAA,GACjDR,cAAc;AAAA,IAAA,GACdX,kBAAkB;AACtB,IAAA,eAAA,EAAeD,aAAc;AAC7B,IAAA,YAAA,EAAYI,SAAU;AACtBL,IAAAA,GAAG,EAAEA,GAAoC;AACzCJ,IAAAA,SAAS,EAAEqB,eAAgB;AAAApB,IAAAA,QAAA,EAE1BA,QAAAA;AAAQ,GACC,CAAC,CAAA;AAEvB,CAAC,EAAC;AACFC,UAAU,CAACwB,WAAW,GAAGjD,cAAc,CAAA;AACvCyB,UAAU,CAACyB,YAAY,GAAG,EAAE;;;;"}
@@ -0,0 +1,146 @@
1
+ import { f as forwardRef, c as classNames } from './forwardRef-15f62847.js';
2
+ import isFunction from 'lodash/isFunction';
3
+ import { useCallback } from 'react';
4
+ import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
5
+ import { onEnterPressed } from '@lumx/core/js/utils';
6
+ import { u as useTheme } from './ThemeContext-3181f000.js';
7
+ import { u as useDisableStateProps } from './useDisableStateProps-69e16b7c.js';
8
+ import { jsxs, jsx } from 'react/jsx-runtime';
9
+ import { Size, Theme, ColorPalette } from '@lumx/core/js/constants';
10
+
11
+ /**
12
+ * Wrap mouse event handler to stop event propagation.
13
+ *
14
+ * @param handler The mouse handler to wrap.
15
+ * @return Mouse handler stopping propagation.
16
+ */
17
+ function useStopPropagation(handler) {
18
+ return useCallback(evt => {
19
+ if (!evt || !isFunction(handler)) {
20
+ return;
21
+ }
22
+ handler(evt);
23
+ evt.stopPropagation();
24
+ }, [handler]);
25
+ }
26
+
27
+ /**
28
+ * Component display name.
29
+ */
30
+ const COMPONENT_NAME = 'Chip';
31
+
32
+ /**
33
+ * Component default class name and class prefix.
34
+ */
35
+ const CLASSNAME = getRootClassName(COMPONENT_NAME);
36
+
37
+ /**
38
+ * Component default props.
39
+ */
40
+ const DEFAULT_PROPS = {
41
+ size: Size.m
42
+ };
43
+
44
+ /**
45
+ * Chip component.
46
+ *
47
+ * @param props Component props.
48
+ * @param ref Component ref.
49
+ * @return React element.
50
+ */
51
+ const Chip = forwardRef((props, ref) => {
52
+ const defaultTheme = useTheme() || Theme.light;
53
+ const {
54
+ isAnyDisabled,
55
+ disabledStateProps,
56
+ otherProps
57
+ } = useDisableStateProps(props);
58
+ const {
59
+ after,
60
+ before,
61
+ children,
62
+ className,
63
+ color,
64
+ isClickable: propIsClickable,
65
+ isHighlighted,
66
+ isSelected,
67
+ onAfterClick,
68
+ onBeforeClick,
69
+ onClick,
70
+ size = DEFAULT_PROPS.size,
71
+ theme = defaultTheme,
72
+ href,
73
+ onKeyDown,
74
+ ...forwardedProps
75
+ } = otherProps;
76
+ const hasAfterClick = isFunction(onAfterClick);
77
+ const hasBeforeClick = isFunction(onBeforeClick);
78
+ const hasOnClick = isFunction(props.onClick);
79
+ const isButton = hasOnClick && !href;
80
+ const isClickable = Boolean(hasOnClick) || Boolean(href) || propIsClickable;
81
+
82
+ // Adapt color to the theme.
83
+ const chipColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);
84
+ const handleOnBeforeClick = useStopPropagation(onBeforeClick);
85
+ const handleOnAfterClick = useStopPropagation(onAfterClick);
86
+ const handleKeyDown = evt => {
87
+ onKeyDown?.(evt);
88
+ if (hasOnClick) {
89
+ onEnterPressed(onClick)(evt);
90
+ }
91
+ };
92
+ return (
93
+ /*#__PURE__*/
94
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
95
+ jsxs("a", {
96
+ role: isButton ? 'button' : undefined,
97
+ tabIndex: isClickable && !disabledStateProps.disabled ? 0 : undefined,
98
+ ...forwardedProps,
99
+ href: !disabledStateProps.disabled ? href : undefined,
100
+ ref: ref,
101
+ className: classNames(className, handleBasicClasses({
102
+ clickable: isClickable,
103
+ color: chipColor,
104
+ isDisabled: isAnyDisabled,
105
+ hasAfter: Boolean(after),
106
+ hasBefore: Boolean(before),
107
+ highlighted: Boolean(isHighlighted),
108
+ prefix: CLASSNAME,
109
+ selected: Boolean(isSelected),
110
+ size,
111
+ unselected: Boolean(!isSelected)
112
+ })),
113
+ "aria-disabled": isClickable && isAnyDisabled || undefined,
114
+ onClick: hasOnClick ? onClick : undefined,
115
+ onKeyDown: handleKeyDown,
116
+ children: [before &&
117
+ /*#__PURE__*/
118
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
119
+ jsx("div", {
120
+ className: classNames(`${CLASSNAME}__before`, {
121
+ [`${CLASSNAME}__before--is-clickable`]: hasBeforeClick
122
+ }),
123
+ onClick: handleOnBeforeClick,
124
+ children: before
125
+ }), /*#__PURE__*/jsx("div", {
126
+ className: `${CLASSNAME}__label`,
127
+ children: children
128
+ }), after &&
129
+ /*#__PURE__*/
130
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
131
+ jsx("div", {
132
+ className: classNames(`${CLASSNAME}__after`, {
133
+ [`${CLASSNAME}__after--is-clickable`]: hasAfterClick
134
+ }),
135
+ onClick: handleOnAfterClick,
136
+ children: after
137
+ })]
138
+ })
139
+ );
140
+ });
141
+ Chip.displayName = COMPONENT_NAME;
142
+ Chip.className = CLASSNAME;
143
+ Chip.defaultProps = DEFAULT_PROPS;
144
+
145
+ export { Chip as C };
146
+ //# sourceMappingURL=Chip-a34f6905.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chip-a34f6905.js","sources":["../../src/hooks/useStopPropagation.ts","../../src/components/chip/Chip.tsx"],"sourcesContent":["import isFunction from 'lodash/isFunction';\nimport { MouseEventHandler, useCallback } from 'react';\n\n/**\n * Wrap mouse event handler to stop event propagation.\n *\n * @param handler The mouse handler to wrap.\n * @return Mouse handler stopping propagation.\n */\nexport function useStopPropagation(handler?: MouseEventHandler): MouseEventHandler {\n return useCallback(\n (evt) => {\n if (!evt || !isFunction(handler)) {\n return;\n }\n handler(evt);\n evt.stopPropagation();\n },\n [handler],\n );\n}\n","import { MouseEventHandler, ReactNode } from 'react';\n\nimport classNames from 'classnames';\nimport isFunction from 'lodash/isFunction';\n\nimport { ColorPalette, Size, Theme } from '@lumx/react';\nimport { useStopPropagation } from '@lumx/react/hooks/useStopPropagation';\n\nimport { GenericProps, HasTheme } from '@lumx/react/utils/type';\nimport { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';\nimport { onEnterPressed } from '@lumx/core/js/utils';\nimport { forwardRef } from '@lumx/react/utils/react/forwardRef';\nimport { useTheme } from '@lumx/react/utils/theme/ThemeContext';\nimport { useDisableStateProps } from '@lumx/react/utils/disabled/useDisableStateProps';\nimport { HasAriaDisabled } from '@lumx/react/utils/type/HasAriaDisabled';\n\n/**\n * Chip sizes.\n */\ntype ChipSize = Extract<Size, 's' | 'm'>;\n\n/**\n * Defines the props of the component.\n */\nexport interface ChipProps extends GenericProps, HasTheme, HasAriaDisabled {\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 /** Color variant. */\n color?: ColorPalette;\n /** Whether the component is clickable or not. */\n isClickable?: boolean;\n /** Whether the component is disabled or not. */\n isDisabled?: boolean;\n /** Whether the chip is currently in a highlighted state or not. */\n isHighlighted?: boolean;\n /** Whether the component is selected or not. */\n isSelected?: boolean;\n /** Size variant. */\n size?: ChipSize;\n /** On \"after\" element clicked callback. */\n onAfterClick?: MouseEventHandler;\n /** On \"before\" element clicked callback. */\n onBeforeClick?: MouseEventHandler;\n /** Children */\n children?: React.ReactNode;\n}\n\n/**\n * Component display name.\n */\nconst COMPONENT_NAME = 'Chip';\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<ChipProps> = {\n size: Size.m,\n};\n\n/**\n * Chip component.\n *\n * @param props Component props.\n * @param ref Component ref.\n * @return React element.\n */\nexport const Chip = forwardRef<ChipProps, HTMLAnchorElement>((props, ref) => {\n const defaultTheme = useTheme() || Theme.light;\n const { isAnyDisabled, disabledStateProps, otherProps } = useDisableStateProps(props);\n const {\n after,\n before,\n children,\n className,\n color,\n isClickable: propIsClickable,\n isHighlighted,\n isSelected,\n onAfterClick,\n onBeforeClick,\n onClick,\n size = DEFAULT_PROPS.size,\n theme = defaultTheme,\n href,\n onKeyDown,\n ...forwardedProps\n } = otherProps;\n const hasAfterClick = isFunction(onAfterClick);\n const hasBeforeClick = isFunction(onBeforeClick);\n const hasOnClick = isFunction(props.onClick);\n const isButton = hasOnClick && !href;\n const isClickable = Boolean(hasOnClick) || Boolean(href) || propIsClickable;\n\n // Adapt color to the theme.\n const chipColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);\n\n const handleOnBeforeClick = useStopPropagation(onBeforeClick);\n const handleOnAfterClick = useStopPropagation(onAfterClick);\n const handleKeyDown = (evt: React.KeyboardEvent) => {\n onKeyDown?.(evt);\n if (hasOnClick) {\n onEnterPressed(onClick)(evt);\n }\n };\n\n return (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <a\n role={isButton ? 'button' : undefined}\n tabIndex={isClickable && !disabledStateProps.disabled ? 0 : undefined}\n {...forwardedProps}\n href={!disabledStateProps.disabled ? href : undefined}\n ref={ref}\n className={classNames(\n className,\n handleBasicClasses({\n clickable: isClickable,\n color: chipColor,\n isDisabled: isAnyDisabled,\n hasAfter: Boolean(after),\n hasBefore: Boolean(before),\n highlighted: Boolean(isHighlighted),\n prefix: CLASSNAME,\n selected: Boolean(isSelected),\n size,\n unselected: Boolean(!isSelected),\n }),\n )}\n aria-disabled={(isClickable && isAnyDisabled) || undefined}\n onClick={hasOnClick ? onClick : undefined}\n onKeyDown={handleKeyDown}\n >\n {before && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div\n className={classNames(`${CLASSNAME}__before`, {\n [`${CLASSNAME}__before--is-clickable`]: hasBeforeClick,\n })}\n onClick={handleOnBeforeClick}\n >\n {before}\n </div>\n )}\n <div className={`${CLASSNAME}__label`}>{children}</div>\n {after && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions\n <div\n className={classNames(`${CLASSNAME}__after`, {\n [`${CLASSNAME}__after--is-clickable`]: hasAfterClick,\n })}\n onClick={handleOnAfterClick}\n >\n {after}\n </div>\n )}\n </a>\n );\n});\nChip.displayName = COMPONENT_NAME;\nChip.className = CLASSNAME;\nChip.defaultProps = DEFAULT_PROPS;\n"],"names":["useStopPropagation","handler","useCallback","evt","isFunction","stopPropagation","COMPONENT_NAME","CLASSNAME","getRootClassName","DEFAULT_PROPS","size","Size","m","Chip","forwardRef","props","ref","defaultTheme","useTheme","Theme","light","isAnyDisabled","disabledStateProps","otherProps","useDisableStateProps","after","before","children","className","color","isClickable","propIsClickable","isHighlighted","isSelected","onAfterClick","onBeforeClick","onClick","theme","href","onKeyDown","forwardedProps","hasAfterClick","hasBeforeClick","hasOnClick","isButton","Boolean","chipColor","ColorPalette","dark","handleOnBeforeClick","handleOnAfterClick","handleKeyDown","onEnterPressed","_jsxs","role","undefined","tabIndex","disabled","classNames","handleBasicClasses","clickable","isDisabled","hasAfter","hasBefore","highlighted","prefix","selected","unselected","_jsx","displayName","defaultProps"],"mappings":";;;;;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAkBA,CAACC,OAA2B,EAAqB;EAC/E,OAAOC,WAAW,CACbC,GAAG,IAAK;IACL,IAAI,CAACA,GAAG,IAAI,CAACC,UAAU,CAACH,OAAO,CAAC,EAAE;AAC9B,MAAA,OAAA;AACJ,KAAA;IACAA,OAAO,CAACE,GAAG,CAAC,CAAA;IACZA,GAAG,CAACE,eAAe,EAAE,CAAA;AACzB,GAAC,EACD,CAACJ,OAAO,CACZ,CAAC,CAAA;AACL;;AC6BA;AACA;AACA;AACA,MAAMK,cAAc,GAAG,MAAM,CAAA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o, useRef, createContext } from 'react';
2
+ import isEmpty from 'lodash/isEmpty';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ const EVENT_TYPES = ['mousedown', 'touchstart'];
6
+ function isClickAway(targets, refs) {
7
+ // The targets elements are not contained in any of the listed element references.
8
+ return !refs.some(ref => targets.some(target => ref?.current?.contains(target)));
9
+ }
10
+ /**
11
+ * Listen to clicks away from the given elements and callback the passed in function.
12
+ *
13
+ * Warning: If you need to detect click away on nested React portals, please use the `ClickAwayProvider` component.
14
+ */
15
+ function useClickAway({
16
+ callback,
17
+ childrenRefs
18
+ }) {
19
+ useEffect(() => {
20
+ const {
21
+ current: currentRefs
22
+ } = childrenRefs;
23
+ if (!callback || !currentRefs || isEmpty(currentRefs)) {
24
+ return undefined;
25
+ }
26
+ const listener = evt => {
27
+ const targets = [evt.composedPath?.()[0], evt.target];
28
+ if (isClickAway(targets, currentRefs)) {
29
+ callback(evt);
30
+ }
31
+ };
32
+ EVENT_TYPES.forEach(evtType => document.addEventListener(evtType, listener));
33
+ return () => {
34
+ EVENT_TYPES.forEach(evtType => document.removeEventListener(evtType, listener));
35
+ };
36
+ }, [callback, childrenRefs]);
37
+ }
38
+
39
+ const ClickAwayAncestorContext = /*#__PURE__*/createContext(null);
40
+ /**
41
+ * Component combining the `useClickAway` hook with a React context to hook into the React component tree and make sure
42
+ * we take into account both the DOM tree and the React tree to detect click away.
43
+ *
44
+ * @return the react component.
45
+ */
46
+ const ClickAwayProvider = ({
47
+ children,
48
+ callback,
49
+ childrenRefs,
50
+ parentRef
51
+ }) => {
52
+ const parentContext = useContext(ClickAwayAncestorContext);
53
+ const currentContext = useMemo(() => {
54
+ const context = {
55
+ childrenRefs: [],
56
+ /**
57
+ * Add element refs to the current context and propagate to the parent context.
58
+ */
59
+ addRefs(...newChildrenRefs) {
60
+ // Add element refs that should be considered as inside the click away context.
61
+ context.childrenRefs.push(...newChildrenRefs);
62
+ if (parentContext) {
63
+ // Also add then to the parent context
64
+ parentContext.addRefs(...newChildrenRefs);
65
+ if (parentRef) {
66
+ // The parent element is also considered as inside the parent click away context but not inside the current context
67
+ parentContext.addRefs(parentRef);
68
+ }
69
+ }
70
+ }
71
+ };
72
+ return context;
73
+ }, [parentContext, parentRef]);
74
+ useEffect(() => {
75
+ const {
76
+ current: currentRefs
77
+ } = childrenRefs;
78
+ if (!currentRefs) {
79
+ return;
80
+ }
81
+ currentContext.addRefs(...currentRefs);
82
+ }, [currentContext, childrenRefs]);
83
+ useClickAway({
84
+ callback,
85
+ childrenRefs: useRef(currentContext.childrenRefs)
86
+ });
87
+ return /*#__PURE__*/jsx(ClickAwayAncestorContext.Provider, {
88
+ value: currentContext,
89
+ children: children
90
+ });
91
+ };
92
+ ClickAwayProvider.displayName = 'ClickAwayProvider';
93
+
94
+ export { ClickAwayProvider as C };
95
+ //# sourceMappingURL=ClickAwayProvider-7093ba23.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClickAwayProvider-7093ba23.js","sources":["../../src/hooks/useClickAway.tsx","../../src/utils/ClickAwayProvider/ClickAwayProvider.tsx"],"sourcesContent":["import { RefObject, useEffect } from 'react';\n\nimport { Falsy } from '@lumx/react/utils/type';\n\nimport isEmpty from 'lodash/isEmpty';\n\nconst EVENT_TYPES = ['mousedown', 'touchstart'];\n\nfunction isClickAway(targets: HTMLElement[], refs: Array<RefObject<HTMLElement>>): boolean {\n // The targets elements are not contained in any of the listed element references.\n return !refs.some((ref) => targets.some((target) => ref?.current?.contains(target)));\n}\n\nexport interface ClickAwayParameters {\n /**\n * A callback function to call when the user clicks away from the elements.\n */\n callback: EventListener | Falsy;\n /**\n * Elements considered within the click away context (clicking outside them will trigger the click away callback).\n */\n childrenRefs: RefObject<Array<RefObject<HTMLElement>>>;\n}\n\n/**\n * Listen to clicks away from the given elements and callback the passed in function.\n *\n * Warning: If you need to detect click away on nested React portals, please use the `ClickAwayProvider` component.\n */\nexport function useClickAway({ callback, childrenRefs }: ClickAwayParameters): void {\n useEffect(() => {\n const { current: currentRefs } = childrenRefs;\n if (!callback || !currentRefs || isEmpty(currentRefs)) {\n return undefined;\n }\n const listener: EventListener = (evt) => {\n const targets = [evt.composedPath?.()[0], evt.target] as HTMLElement[];\n if (isClickAway(targets, currentRefs)) {\n callback(evt);\n }\n };\n\n EVENT_TYPES.forEach((evtType) => document.addEventListener(evtType, listener));\n return () => {\n EVENT_TYPES.forEach((evtType) => document.removeEventListener(evtType, listener));\n };\n }, [callback, childrenRefs]);\n}\n","import { createContext, RefObject, useContext, useEffect, useMemo, useRef } from 'react';\nimport { ClickAwayParameters, useClickAway } from '@lumx/react/hooks/useClickAway';\n\ninterface ContextValue {\n childrenRefs: Array<RefObject<HTMLElement>>;\n addRefs(...newChildrenRefs: Array<RefObject<HTMLElement>>): void;\n}\n\nconst ClickAwayAncestorContext = createContext<ContextValue | null>(null);\n\ninterface ClickAwayProviderProps extends ClickAwayParameters {\n /**\n * (Optional) Element that should be considered as part of the parent\n */\n parentRef?: RefObject<HTMLElement>;\n /**\n * Children\n */\n children?: React.ReactNode;\n}\n\n/**\n * Component combining the `useClickAway` hook with a React context to hook into the React component tree and make sure\n * we take into account both the DOM tree and the React tree to detect click away.\n *\n * @return the react component.\n */\nexport const ClickAwayProvider: React.FC<ClickAwayProviderProps> = ({\n children,\n callback,\n childrenRefs,\n parentRef,\n}) => {\n const parentContext = useContext(ClickAwayAncestorContext);\n const currentContext = useMemo(() => {\n const context: ContextValue = {\n childrenRefs: [],\n /**\n * Add element refs to the current context and propagate to the parent context.\n */\n addRefs(...newChildrenRefs) {\n // Add element refs that should be considered as inside the click away context.\n context.childrenRefs.push(...newChildrenRefs);\n\n if (parentContext) {\n // Also add then to the parent context\n parentContext.addRefs(...newChildrenRefs);\n if (parentRef) {\n // The parent element is also considered as inside the parent click away context but not inside the current context\n parentContext.addRefs(parentRef);\n }\n }\n },\n };\n return context;\n }, [parentContext, parentRef]);\n\n useEffect(() => {\n const { current: currentRefs } = childrenRefs;\n if (!currentRefs) {\n return;\n }\n currentContext.addRefs(...currentRefs);\n }, [currentContext, childrenRefs]);\n\n useClickAway({ callback, childrenRefs: useRef(currentContext.childrenRefs) });\n return <ClickAwayAncestorContext.Provider value={currentContext}>{children}</ClickAwayAncestorContext.Provider>;\n};\nClickAwayProvider.displayName = 'ClickAwayProvider';\n"],"names":["EVENT_TYPES","isClickAway","targets","refs","some","ref","target","current","contains","useClickAway","callback","childrenRefs","useEffect","currentRefs","isEmpty","undefined","listener","evt","composedPath","forEach","evtType","document","addEventListener","removeEventListener","ClickAwayAncestorContext","createContext","ClickAwayProvider","children","parentRef","parentContext","useContext","currentContext","useMemo","context","addRefs","newChildrenRefs","push","useRef","_jsx","Provider","value","displayName"],"mappings":";;;;AAMA,MAAMA,WAAW,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;AAE/C,SAASC,WAAWA,CAACC,OAAsB,EAAEC,IAAmC,EAAW;AACvF;EACA,OAAO,CAACA,IAAI,CAACC,IAAI,CAAEC,GAAG,IAAKH,OAAO,CAACE,IAAI,CAAEE,MAAM,IAAKD,GAAG,EAAEE,OAAO,EAAEC,QAAQ,CAACF,MAAM,CAAC,CAAC,CAAC,CAAA;AACxF,CAAA;AAaA;AACA;AACA;AACA;AACA;AACO,SAASG,YAAYA,CAAC;EAAEC,QAAQ;AAAEC,EAAAA,YAAAA;AAAkC,CAAC,EAAQ;AAChFC,EAAAA,SAAS,CAAC,MAAM;IACZ,MAAM;AAAEL,MAAAA,OAAO,EAAEM,WAAAA;AAAY,KAAC,GAAGF,YAAY,CAAA;IAC7C,IAAI,CAACD,QAAQ,IAAI,CAACG,WAAW,IAAIC,OAAO,CAACD,WAAW,CAAC,EAAE;AACnD,MAAA,OAAOE,SAAS,CAAA;AACpB,KAAA;IACA,MAAMC,QAAuB,GAAIC,GAAG,IAAK;AACrC,MAAA,MAAMf,OAAO,GAAG,CAACe,GAAG,CAACC,YAAY,IAAI,CAAC,CAAC,CAAC,EAAED,GAAG,CAACX,MAAM,CA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,OAAA;KACH,CAAA;AACD,IAAA,OAAOK,OAAO,CAAA;AAClB,GAAC,EAAE,CAACJ,aAAa,EAAED,SAAS,CAAC,CAAC,CAAA;AAE9BhB,EAAAA,SAAS,CAAC,MAAM;IACZ,MAAM;AAAEL,MAAAA,OAAO,EAAEM,WAAAA;AAAY,KAAC,GAAGF,YAAY,CAAA;IAC7C,IAAI,CAACE,WAAW,EAAE;AACd,MAAA,OAAA;AACJ,KAAA;AACAkB,IAAAA,cAAc,CAACG,OAAO,CAAC,GAAGrB,WAAW,CAAC,CAAA;AAC1C,GAAC,EAAE,CAACkB,cAAc,EAAEpB,YAAY,CAAC,CAAC,CAAA;AAElCF,EAAAA,YAAY,CAAC;IAAEC,QAAQ;AAAEC,IAAAA,YAAY,EAAE0B,MAAM,CAACN,cAAc,CAACpB,YAAY,CAAA;AAAE,GAAC,CAAC,CAAA;AAC7E,EAAA,oBAAO2B,GAAA,CAACd,wBAAwB,CAACe,QAAQ,EAAA;AAACC,IAAAA,KAAK,EAAET,cAAe;AAAAJ,IAAAA,QAAA,EAAEA,QAAAA;AAAQ,GAAoC,CAAC,CAAA;AACnH,EAAC;AACDD,iBAAiB,CAACe,WAAW,GAAG,mBAAmB;;;;"}
@@ -0,0 +1,29 @@
1
+ import React__default, { useContext } from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ const DisabledStateContext = /*#__PURE__*/React__default.createContext({
5
+ state: null
6
+ });
7
+ /**
8
+ * Disabled state provider.
9
+ * All nested LumX Design System components inherit this disabled state.
10
+ */
11
+ function DisabledStateProvider({
12
+ children,
13
+ ...value
14
+ }) {
15
+ return /*#__PURE__*/jsx(DisabledStateContext.Provider, {
16
+ value: value,
17
+ children: children
18
+ });
19
+ }
20
+
21
+ /**
22
+ * Get DisabledState context value
23
+ */
24
+ function useDisabledStateContext() {
25
+ return useContext(DisabledStateContext);
26
+ }
27
+
28
+ export { DisabledStateProvider as D, useDisabledStateContext as u };
29
+ //# sourceMappingURL=DisabledStateContext-ea04260d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DisabledStateContext-ea04260d.js","sources":["../../src/utils/disabled/DisabledStateContext.tsx"],"sourcesContent":["import React, { useContext } from 'react';\n\n/** Disable state */\ntype DisabledStateContextValue =\n | {\n state: 'disabled';\n }\n | { state: undefined | null };\n\nexport const DisabledStateContext = React.createContext<DisabledStateContextValue>({ state: null });\n\nexport type DisabledStateProviderProps = DisabledStateContextValue & {\n children: React.ReactNode;\n};\n\n/**\n * Disabled state provider.\n * All nested LumX Design System components inherit this disabled state.\n */\nexport function DisabledStateProvider({ children, ...value }: DisabledStateProviderProps) {\n return <DisabledStateContext.Provider value={value}>{children}</DisabledStateContext.Provider>;\n}\n\n/**\n * Get DisabledState context value\n */\nexport function useDisabledStateContext(): DisabledStateContextValue {\n return useContext(DisabledStateContext);\n}\n"],"names":["DisabledStateContext","React","createContext","state","DisabledStateProvider","children","value","_jsx","Provider","useDisabledStateContext","useContext"],"mappings":";;;AASO,MAAMA,oBAAoB,gBAAGC,cAAK,CAACC,aAAa,CAA4B;AAAEC,EAAAA,KAAK,EAAE,IAAA;AAAK,CAAC,CAAC,CAAA;AAMnG;AACA;AACA;AACA;AACO,SAASC,qBAAqBA,CAAC;EAAEC,QAAQ;EAAE,GAAGC,KAAAA;AAAkC,CAAC,EAAE;AACtF,EAAA,oBAAOC,GAAA,CAACP,oBAAoB,CAACQ,QAAQ,EAAA;AAACF,IAAAA,KAAK,EAAEA,KAAM;AAAAD,IAAAA,QAAA,EAAEA,QAAAA;AAAQ,GAAgC,CAAC,CAAA;AAClG,CAAA;;AAEA;AACA;AACA;AACO,SAASI,uBAAuBA,GAA8B;EACjE,OAAOC,UAAU,CAACV,oBAAoB,CAAC,CAAA;AAC3C;;;;"}