@lumx/react 3.20.1-alpha.3 → 3.20.1-alpha.30

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 (698) hide show
  1. package/CONTRIBUTING.md +1 -5
  2. package/README.md +0 -2
  3. package/_internal/Button-4b67daa8.js +98 -0
  4. package/_internal/Button-4b67daa8.js.map +1 -0
  5. package/_internal/ButtonRoot-a70baf82.js +118 -0
  6. package/_internal/ButtonRoot-a70baf82.js.map +1 -0
  7. package/_internal/Chip-70af04b4.js +144 -0
  8. package/_internal/Chip-70af04b4.js.map +1 -0
  9. package/_internal/ClickAwayProvider-1204f237.js +95 -0
  10. package/_internal/ClickAwayProvider-1204f237.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-8d61f5be.js +77 -0
  16. package/_internal/IconButton-8d61f5be.js.map +1 -0
  17. package/_internal/ImageCaption-db44ec9e.js +75 -0
  18. package/_internal/ImageCaption-db44ec9e.js.map +1 -0
  19. package/_internal/List-c75646f2.js +818 -0
  20. package/_internal/List-c75646f2.js.map +1 -0
  21. package/_internal/PopoverDialog-35b2d87d.js +657 -0
  22. package/_internal/PopoverDialog-35b2d87d.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-ce641b5f.js +679 -0
  28. package/_internal/Slides-ce641b5f.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-02bd6869.js +314 -0
  32. package/_internal/Thumbnail-02bd6869.js.map +1 -0
  33. package/_internal/components/alert-dialog-a24330ed.js +166 -0
  34. package/_internal/components/alert-dialog-a24330ed.js.map +1 -0
  35. package/_internal/components/autocomplete-70749e51.js +262 -0
  36. package/_internal/components/autocomplete-70749e51.js.map +1 -0
  37. package/_internal/components/avatar-ed9f4869.js +84 -0
  38. package/_internal/components/avatar-ed9f4869.js.map +1 -0
  39. package/_internal/components/badge-ccf47147.js +82 -0
  40. package/_internal/components/badge-ccf47147.js.map +1 -0
  41. package/_internal/components/button-9f710830.js +48 -0
  42. package/_internal/components/button-9f710830.js.map +1 -0
  43. package/_internal/components/checkbox-8ab51ef9.js +142 -0
  44. package/_internal/components/checkbox-8ab51ef9.js.map +1 -0
  45. package/_internal/components/chip-19e40755.js +103 -0
  46. package/_internal/components/chip-19e40755.js.map +1 -0
  47. package/_internal/components/comment-block-bb6a0603.js +139 -0
  48. package/_internal/components/comment-block-bb6a0603.js.map +1 -0
  49. package/_internal/components/date-picker-e4209b01.js +2 -0
  50. package/_internal/components/date-picker-e4209b01.js.map +1 -0
  51. package/_internal/components/dialog-30336ccb.js +239 -0
  52. package/_internal/components/dialog-30336ccb.js.map +1 -0
  53. package/_internal/components/divider-0e93aa3d.js +51 -0
  54. package/_internal/components/divider-0e93aa3d.js.map +1 -0
  55. package/_internal/components/drag-handle-ba2e7e67.js +52 -0
  56. package/_internal/components/drag-handle-ba2e7e67.js.map +1 -0
  57. package/_internal/components/dropdown-d18122d7.js +148 -0
  58. package/_internal/components/dropdown-d18122d7.js.map +1 -0
  59. package/_internal/components/expansion-panel-0b263437.js +169 -0
  60. package/_internal/components/expansion-panel-0b263437.js.map +1 -0
  61. package/_internal/components/flag-8f9a498a.js +60 -0
  62. package/_internal/components/flag-8f9a498a.js.map +1 -0
  63. package/_internal/components/flex-box-15be92f6.js +57 -0
  64. package/_internal/components/flex-box-15be92f6.js.map +1 -0
  65. package/_internal/components/generic-block-5d843f1e.js +128 -0
  66. package/_internal/components/generic-block-5d843f1e.js.map +1 -0
  67. package/_internal/components/grid-8c08dc4b.js +105 -0
  68. package/_internal/components/grid-8c08dc4b.js.map +1 -0
  69. package/_internal/components/grid-column-85e305e7.js +59 -0
  70. package/_internal/components/grid-column-85e305e7.js.map +1 -0
  71. package/_internal/components/heading-7bfafd7d.js +54 -0
  72. package/_internal/components/heading-7bfafd7d.js.map +1 -0
  73. package/_internal/components/icon-ee15673b.js +103 -0
  74. package/_internal/components/icon-ee15673b.js.map +1 -0
  75. package/_internal/components/image-block-3479abda.js +111 -0
  76. package/_internal/components/image-block-3479abda.js.map +1 -0
  77. package/_internal/components/image-lightbox-1d7ca133.js +758 -0
  78. package/_internal/components/image-lightbox-1d7ca133.js.map +1 -0
  79. package/_internal/components/inline-list-5ba8bb0f.js +75 -0
  80. package/_internal/components/inline-list-5ba8bb0f.js.map +1 -0
  81. package/_internal/components/input-helper-2e4e49fd.js +72 -0
  82. package/_internal/components/input-helper-2e4e49fd.js.map +1 -0
  83. package/_internal/components/input-label-30d199c3.js +60 -0
  84. package/_internal/components/input-label-30d199c3.js.map +1 -0
  85. package/_internal/components/lightbox-c5f9afd0.js +156 -0
  86. package/_internal/components/lightbox-c5f9afd0.js.map +1 -0
  87. package/_internal/components/link-43ee103e.js +73 -0
  88. package/_internal/components/link-43ee103e.js.map +1 -0
  89. package/_internal/components/link-preview-db0ee2d6.js +118 -0
  90. package/_internal/components/link-preview-db0ee2d6.js.map +1 -0
  91. package/_internal/components/list-2f256244.js +72 -0
  92. package/_internal/components/list-2f256244.js.map +1 -0
  93. package/_internal/components/message-f7674e0e.js +101 -0
  94. package/_internal/components/message-f7674e0e.js.map +1 -0
  95. package/_internal/components/mosaic-3effd0cf.js +95 -0
  96. package/_internal/components/mosaic-3effd0cf.js.map +1 -0
  97. package/_internal/components/navigation-3a5dc270.js +227 -0
  98. package/_internal/components/navigation-3a5dc270.js.map +1 -0
  99. package/_internal/components/notification-098c5600.js +146 -0
  100. package/_internal/components/notification-098c5600.js.map +1 -0
  101. package/_internal/components/popover-dfcddda4.js +3 -0
  102. package/_internal/components/popover-dfcddda4.js.map +1 -0
  103. package/_internal/components/post-block-69797e4d.js +110 -0
  104. package/_internal/components/post-block-69797e4d.js.map +1 -0
  105. package/_internal/components/progress-44bb0301.js +183 -0
  106. package/_internal/components/progress-44bb0301.js.map +1 -0
  107. package/_internal/components/progress-tracker-e0981fcc.js +309 -0
  108. package/_internal/components/progress-tracker-e0981fcc.js.map +1 -0
  109. package/_internal/components/radio-button-929c7bee.js +150 -0
  110. package/_internal/components/radio-button-929c7bee.js.map +1 -0
  111. package/_internal/components/select-64bc72a0.js +458 -0
  112. package/_internal/components/select-64bc72a0.js.map +1 -0
  113. package/_internal/components/side-navigation-c610c689.js +166 -0
  114. package/_internal/components/side-navigation-c610c689.js.map +1 -0
  115. package/_internal/components/skeleton-1ea8c82a.js +167 -0
  116. package/_internal/components/skeleton-1ea8c82a.js.map +1 -0
  117. package/_internal/components/slider-78cfaa67.js +312 -0
  118. package/_internal/components/slider-78cfaa67.js.map +1 -0
  119. package/_internal/components/slideshow-d8a943a7.js +151 -0
  120. package/_internal/components/slideshow-d8a943a7.js.map +1 -0
  121. package/_internal/components/switch-25b65051.js +122 -0
  122. package/_internal/components/switch-25b65051.js.map +1 -0
  123. package/_internal/components/table-ec20c66c.js +296 -0
  124. package/_internal/components/table-ec20c66c.js.map +1 -0
  125. package/_internal/components/tabs-89c055bd.js +299 -0
  126. package/_internal/components/tabs-89c055bd.js.map +1 -0
  127. package/_internal/components/text-d04d0f1b.js +2 -0
  128. package/_internal/components/text-d04d0f1b.js.map +1 -0
  129. package/_internal/components/text-field-8f13957e.js +361 -0
  130. package/_internal/components/text-field-8f13957e.js.map +1 -0
  131. package/_internal/components/thumbnail-1255957f.js +42 -0
  132. package/_internal/components/thumbnail-1255957f.js.map +1 -0
  133. package/_internal/components/toolbar-e7c984e6.js +62 -0
  134. package/_internal/components/toolbar-e7c984e6.js.map +1 -0
  135. package/_internal/components/tooltip-dcb43bbe.js +328 -0
  136. package/_internal/components/tooltip-dcb43bbe.js.map +1 -0
  137. package/_internal/components/uploader-7ef4db39.js +154 -0
  138. package/_internal/components/uploader-7ef4db39.js.map +1 -0
  139. package/_internal/components/user-block-24d97650.js +145 -0
  140. package/_internal/components/user-block-24d97650.js.map +1 -0
  141. package/_internal/constants-43721918.js +2170 -0
  142. package/_internal/constants-43721918.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-8bce732e.js +9 -0
  148. package/_internal/forwardRef-8bce732e.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-25c9e8c2.js +118 -0
  152. package/_internal/index-25c9e8c2.js.map +1 -0
  153. package/_internal/index-25d2a45e.js +437 -0
  154. package/_internal/index-25d2a45e.js.map +1 -0
  155. package/_internal/isComponent-b9762ff1.js +18 -0
  156. package/_internal/isComponent-b9762ff1.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/_internal/state-db358714.js +130 -0
  162. package/_internal/state-db358714.js.map +1 -0
  163. package/_internal/useBooleanState-2a3d237c.js +12 -0
  164. package/_internal/useBooleanState-2a3d237c.js.map +1 -0
  165. package/_internal/useCallbackOnEscape-b956a85d.js +64 -0
  166. package/_internal/useCallbackOnEscape-b956a85d.js.map +1 -0
  167. package/_internal/useDisableBodyScroll-36bd7352.js +219 -0
  168. package/_internal/useDisableBodyScroll-36bd7352.js.map +1 -0
  169. package/_internal/useDisableStateProps-69e16b7c.js +36 -0
  170. package/_internal/useDisableStateProps-69e16b7c.js.map +1 -0
  171. package/_internal/useFocusTrap-2dbae79e.js +112 -0
  172. package/_internal/useFocusTrap-2dbae79e.js.map +1 -0
  173. package/_internal/useId-3a1facc0.js +18 -0
  174. package/_internal/useId-3a1facc0.js.map +1 -0
  175. package/_internal/useRovingTabIndex-7daf0f24.js +77 -0
  176. package/_internal/useRovingTabIndex-7daf0f24.js.map +1 -0
  177. package/_internal/useTransitionVisibility-321fdbfa.js +50 -0
  178. package/_internal/useTransitionVisibility-321fdbfa.js.map +1 -0
  179. package/_internal/wrapChildrenIconWithSpaces-50d705e6.js +20 -0
  180. package/_internal/wrapChildrenIconWithSpaces-50d705e6.js.map +1 -0
  181. package/index.d.ts +11 -368
  182. package/index.js +65 -14523
  183. package/index.js.map +1 -1
  184. package/package.json +8 -22
  185. package/utils/index.d.ts +1 -1
  186. package/utils/index.js +3 -1
  187. package/utils/index.js.map +1 -1
  188. package/_internal/Falsy.d.ts +0 -7
  189. package/_internal/index.js +0 -229
  190. package/_internal/index.js.map +0 -1
  191. package/src/components/alert-dialog/AlertDialog.stories.tsx +0 -127
  192. package/src/components/alert-dialog/AlertDialog.test.tsx +0 -34
  193. package/src/components/alert-dialog/AlertDialog.tsx +0 -189
  194. package/src/components/alert-dialog/index.ts +0 -1
  195. package/src/components/autocomplete/Autocomplete.stories.tsx +0 -75
  196. package/src/components/autocomplete/Autocomplete.test.tsx +0 -99
  197. package/src/components/autocomplete/Autocomplete.tsx +0 -294
  198. package/src/components/autocomplete/AutocompleteMultiple.stories.tsx +0 -167
  199. package/src/components/autocomplete/AutocompleteMultiple.test.tsx +0 -61
  200. package/src/components/autocomplete/AutocompleteMultiple.tsx +0 -156
  201. package/src/components/autocomplete/__mockData__/index.ts +0 -39
  202. package/src/components/autocomplete/index.ts +0 -2
  203. package/src/components/avatar/Avatar.stories.tsx +0 -119
  204. package/src/components/avatar/Avatar.test.tsx +0 -32
  205. package/src/components/avatar/Avatar.tsx +0 -114
  206. package/src/components/avatar/index.ts +0 -1
  207. package/src/components/badge/Badge.stories.tsx +0 -69
  208. package/src/components/badge/Badge.test.tsx +0 -45
  209. package/src/components/badge/Badge.tsx +0 -58
  210. package/src/components/badge/BadgeWrapper.stories.tsx +0 -75
  211. package/src/components/badge/BadgeWrapper.test.tsx +0 -47
  212. package/src/components/badge/BadgeWrapper.tsx +0 -37
  213. package/src/components/badge/index.ts +0 -2
  214. package/src/components/button/Button.stories.tsx +0 -355
  215. package/src/components/button/Button.test.tsx +0 -125
  216. package/src/components/button/Button.tsx +0 -101
  217. package/src/components/button/ButtonGroup.stories.tsx +0 -52
  218. package/src/components/button/ButtonGroup.test.tsx +0 -41
  219. package/src/components/button/ButtonGroup.tsx +0 -50
  220. package/src/components/button/ButtonRoot.tsx +0 -163
  221. package/src/components/button/IconButton.stories.tsx +0 -52
  222. package/src/components/button/IconButton.test.tsx +0 -66
  223. package/src/components/button/IconButton.tsx +0 -91
  224. package/src/components/button/index.ts +0 -4
  225. package/src/components/checkbox/Checkbox.stories.tsx +0 -64
  226. package/src/components/checkbox/Checkbox.test.tsx +0 -154
  227. package/src/components/checkbox/Checkbox.tsx +0 -164
  228. package/src/components/checkbox/index.ts +0 -1
  229. package/src/components/chip/Chip.stories.tsx +0 -164
  230. package/src/components/chip/Chip.test.tsx +0 -243
  231. package/src/components/chip/Chip.tsx +0 -168
  232. package/src/components/chip/ChipGroup.stories.tsx +0 -47
  233. package/src/components/chip/ChipGroup.test.tsx +0 -37
  234. package/src/components/chip/ChipGroup.tsx +0 -60
  235. package/src/components/chip/index.ts +0 -2
  236. package/src/components/comment-block/CommentBlock.stories.tsx +0 -91
  237. package/src/components/comment-block/CommentBlock.test.tsx +0 -28
  238. package/src/components/comment-block/CommentBlock.tsx +0 -172
  239. package/src/components/comment-block/index.ts +0 -1
  240. package/src/components/date-picker/DatePicker.stories.tsx +0 -118
  241. package/src/components/date-picker/DatePicker.test.tsx +0 -34
  242. package/src/components/date-picker/DatePicker.tsx +0 -52
  243. package/src/components/date-picker/DatePickerControlled.test.tsx +0 -91
  244. package/src/components/date-picker/DatePickerControlled.tsx +0 -259
  245. package/src/components/date-picker/DatePickerField.stories.tsx +0 -100
  246. package/src/components/date-picker/DatePickerField.test.tsx +0 -70
  247. package/src/components/date-picker/DatePickerField.tsx +0 -135
  248. package/src/components/date-picker/constants.ts +0 -11
  249. package/src/components/date-picker/index.ts +0 -4
  250. package/src/components/date-picker/types.ts +0 -28
  251. package/src/components/dialog/Dialog.stories.tsx +0 -318
  252. package/src/components/dialog/Dialog.test.tsx +0 -97
  253. package/src/components/dialog/Dialog.tsx +0 -288
  254. package/src/components/dialog/index.ts +0 -1
  255. package/src/components/divider/Divider.test.tsx +0 -51
  256. package/src/components/divider/Divider.tsx +0 -50
  257. package/src/components/divider/index.ts +0 -1
  258. package/src/components/drag-handle/DragHandle.test.tsx +0 -36
  259. package/src/components/drag-handle/DragHandle.tsx +0 -51
  260. package/src/components/drag-handle/index.ts +0 -1
  261. package/src/components/dropdown/Dropdown.stories.tsx +0 -31
  262. package/src/components/dropdown/Dropdown.test.tsx +0 -66
  263. package/src/components/dropdown/Dropdown.tsx +0 -186
  264. package/src/components/dropdown/index.ts +0 -1
  265. package/src/components/expansion-panel/ExpansionPanel.stories.tsx +0 -91
  266. package/src/components/expansion-panel/ExpansionPanel.test.tsx +0 -185
  267. package/src/components/expansion-panel/ExpansionPanel.tsx +0 -195
  268. package/src/components/expansion-panel/index.ts +0 -1
  269. package/src/components/flag/Flag.stories.tsx +0 -48
  270. package/src/components/flag/Flag.test.tsx +0 -62
  271. package/src/components/flag/Flag.tsx +0 -52
  272. package/src/components/flag/index.ts +0 -1
  273. package/src/components/flex-box/FlexBox.stories.tsx +0 -156
  274. package/src/components/flex-box/FlexBox.test.tsx +0 -24
  275. package/src/components/flex-box/FlexBox.tsx +0 -100
  276. package/src/components/flex-box/index.ts +0 -1
  277. package/src/components/generic-block/GenericBlock.stories.jsx +0 -128
  278. package/src/components/generic-block/GenericBlock.test.tsx +0 -156
  279. package/src/components/generic-block/GenericBlock.tsx +0 -225
  280. package/src/components/generic-block/constants.ts +0 -9
  281. package/src/components/generic-block/index.ts +0 -2
  282. package/src/components/grid/Grid.tsx +0 -83
  283. package/src/components/grid/GridItem.tsx +0 -55
  284. package/src/components/grid/index.ts +0 -2
  285. package/src/components/grid-column/GridColumn.stories.tsx +0 -45
  286. package/src/components/grid-column/GridColumn.test.jsx +0 -56
  287. package/src/components/grid-column/GridColumn.tsx +0 -83
  288. package/src/components/grid-column/index.ts +0 -1
  289. package/src/components/heading/Heading.stories.tsx +0 -69
  290. package/src/components/heading/Heading.test.tsx +0 -82
  291. package/src/components/heading/Heading.tsx +0 -65
  292. package/src/components/heading/HeadingLevelProvider.tsx +0 -30
  293. package/src/components/heading/constants.ts +0 -16
  294. package/src/components/heading/context.tsx +0 -13
  295. package/src/components/heading/index.ts +0 -3
  296. package/src/components/heading/useHeadingLevel.tsx +0 -8
  297. package/src/components/icon/Icon.stories.tsx +0 -73
  298. package/src/components/icon/Icon.test.tsx +0 -125
  299. package/src/components/icon/Icon.tsx +0 -22
  300. package/src/components/icon/index.ts +0 -1
  301. package/src/components/image-block/ImageBlock.stories.tsx +0 -117
  302. package/src/components/image-block/ImageBlock.test.tsx +0 -58
  303. package/src/components/image-block/ImageBlock.tsx +0 -142
  304. package/src/components/image-block/ImageCaption.tsx +0 -115
  305. package/src/components/image-block/index.ts +0 -1
  306. package/src/components/image-lightbox/ImageLightbox.stories.tsx +0 -160
  307. package/src/components/image-lightbox/ImageLightbox.test.tsx +0 -254
  308. package/src/components/image-lightbox/ImageLightbox.tsx +0 -90
  309. package/src/components/image-lightbox/constants.ts +0 -11
  310. package/src/components/image-lightbox/index.ts +0 -2
  311. package/src/components/image-lightbox/internal/ImageSlide.tsx +0 -107
  312. package/src/components/image-lightbox/internal/ImageSlideshow.tsx +0 -164
  313. package/src/components/image-lightbox/internal/useAnimateScroll.ts +0 -55
  314. package/src/components/image-lightbox/internal/usePointerZoom.ts +0 -148
  315. package/src/components/image-lightbox/types.ts +0 -48
  316. package/src/components/image-lightbox/useImageLightbox.tsx +0 -141
  317. package/src/components/inline-list/InlineList.stories.tsx +0 -77
  318. package/src/components/inline-list/InlineList.test.tsx +0 -52
  319. package/src/components/inline-list/InlineList.tsx +0 -96
  320. package/src/components/inline-list/index.ts +0 -1
  321. package/src/components/input-helper/InputHelper.stories.tsx +0 -35
  322. package/src/components/input-helper/InputHelper.test.tsx +0 -55
  323. package/src/components/input-helper/InputHelper.tsx +0 -65
  324. package/src/components/input-helper/constants.ts +0 -11
  325. package/src/components/input-helper/index.ts +0 -1
  326. package/src/components/input-label/InputLabel.stories.tsx +0 -45
  327. package/src/components/input-label/InputLabel.test.tsx +0 -59
  328. package/src/components/input-label/InputLabel.tsx +0 -69
  329. package/src/components/input-label/index.ts +0 -1
  330. package/src/components/lightbox/Lightbox.stories.tsx +0 -101
  331. package/src/components/lightbox/Lightbox.test.tsx +0 -53
  332. package/src/components/lightbox/Lightbox.tsx +0 -180
  333. package/src/components/lightbox/index.ts +0 -1
  334. package/src/components/link/Link.stories.tsx +0 -195
  335. package/src/components/link/Link.test.tsx +0 -127
  336. package/src/components/link/Link.tsx +0 -106
  337. package/src/components/link/index.ts +0 -1
  338. package/src/components/link-preview/LinkPreview.stories.tsx +0 -61
  339. package/src/components/link-preview/LinkPreview.test.tsx +0 -105
  340. package/src/components/link-preview/LinkPreview.tsx +0 -158
  341. package/src/components/link-preview/index.ts +0 -1
  342. package/src/components/list/List.stories.tsx +0 -116
  343. package/src/components/list/List.test.tsx +0 -18
  344. package/src/components/list/List.tsx +0 -104
  345. package/src/components/list/ListDivider.stories.tsx +0 -12
  346. package/src/components/list/ListDivider.test.tsx +0 -22
  347. package/src/components/list/ListDivider.tsx +0 -35
  348. package/src/components/list/ListItem.stories.tsx +0 -66
  349. package/src/components/list/ListItem.test.tsx +0 -93
  350. package/src/components/list/ListItem.tsx +0 -157
  351. package/src/components/list/ListSubheader.stories.tsx +0 -11
  352. package/src/components/list/ListSubheader.test.tsx +0 -21
  353. package/src/components/list/ListSubheader.tsx +0 -44
  354. package/src/components/list/index.ts +0 -4
  355. package/src/components/list/useInteractiveList.tsx +0 -202
  356. package/src/components/message/Message.stories.tsx +0 -72
  357. package/src/components/message/Message.test.tsx +0 -76
  358. package/src/components/message/Message.tsx +0 -100
  359. package/src/components/message/index.ts +0 -1
  360. package/src/components/mosaic/Mosaic.stories.tsx +0 -89
  361. package/src/components/mosaic/Mosaic.test.tsx +0 -77
  362. package/src/components/mosaic/Mosaic.tsx +0 -98
  363. package/src/components/mosaic/index.ts +0 -1
  364. package/src/components/navigation/Navigation.stories.tsx +0 -234
  365. package/src/components/navigation/Navigation.test.tsx +0 -65
  366. package/src/components/navigation/Navigation.tsx +0 -79
  367. package/src/components/navigation/NavigationItem.test.tsx +0 -35
  368. package/src/components/navigation/NavigationItem.tsx +0 -82
  369. package/src/components/navigation/NavigationSection.test.tsx +0 -137
  370. package/src/components/navigation/NavigationSection.tsx +0 -108
  371. package/src/components/navigation/context.tsx +0 -7
  372. package/src/components/navigation/index.ts +0 -1
  373. package/src/components/notification/Notification.test.tsx +0 -94
  374. package/src/components/notification/Notification.tsx +0 -138
  375. package/src/components/notification/Notifications.stories.tsx +0 -92
  376. package/src/components/notification/constants.ts +0 -28
  377. package/src/components/notification/index.ts +0 -1
  378. package/src/components/popover/Popover.stories.tsx +0 -264
  379. package/src/components/popover/Popover.test.tsx +0 -62
  380. package/src/components/popover/Popover.tsx +0 -201
  381. package/src/components/popover/constants.ts +0 -62
  382. package/src/components/popover/index.ts +0 -3
  383. package/src/components/popover/usePopoverStyle.tsx +0 -184
  384. package/src/components/popover/useRestoreFocusOnClose.tsx +0 -47
  385. package/src/components/popover-dialog/PopoverDialog.stories.tsx +0 -64
  386. package/src/components/popover-dialog/PopoverDialog.test.tsx +0 -139
  387. package/src/components/popover-dialog/PopoverDialog.tsx +0 -74
  388. package/src/components/popover-dialog/index.tsx +0 -1
  389. package/src/components/post-block/PostBlock.test.tsx +0 -27
  390. package/src/components/post-block/PostBlock.tsx +0 -122
  391. package/src/components/post-block/index.ts +0 -1
  392. package/src/components/progress/Progress.tsx +0 -68
  393. package/src/components/progress/ProgressCircular.stories.tsx +0 -43
  394. package/src/components/progress/ProgressCircular.test.tsx +0 -46
  395. package/src/components/progress/ProgressCircular.tsx +0 -82
  396. package/src/components/progress/ProgressLinear.stories.tsx +0 -12
  397. package/src/components/progress/ProgressLinear.test.tsx +0 -30
  398. package/src/components/progress/ProgressLinear.tsx +0 -50
  399. package/src/components/progress/index.ts +0 -3
  400. package/src/components/progress-tracker/ProgressTracker.stories.tsx +0 -145
  401. package/src/components/progress-tracker/ProgressTracker.test.tsx +0 -42
  402. package/src/components/progress-tracker/ProgressTracker.tsx +0 -87
  403. package/src/components/progress-tracker/ProgressTrackerProvider.test.tsx +0 -65
  404. package/src/components/progress-tracker/ProgressTrackerProvider.tsx +0 -67
  405. package/src/components/progress-tracker/ProgressTrackerStep.test.tsx +0 -36
  406. package/src/components/progress-tracker/ProgressTrackerStep.tsx +0 -159
  407. package/src/components/progress-tracker/ProgressTrackerStepPanel.test.tsx +0 -34
  408. package/src/components/progress-tracker/ProgressTrackerStepPanel.tsx +0 -67
  409. package/src/components/progress-tracker/index.ts +0 -4
  410. package/src/components/radio-button/RadioButton.stories.tsx +0 -71
  411. package/src/components/radio-button/RadioButton.test.tsx +0 -143
  412. package/src/components/radio-button/RadioButton.tsx +0 -143
  413. package/src/components/radio-button/RadioGroup.stories.tsx +0 -39
  414. package/src/components/radio-button/RadioGroup.test.tsx +0 -29
  415. package/src/components/radio-button/RadioGroup.tsx +0 -44
  416. package/src/components/radio-button/index.ts +0 -2
  417. package/src/components/select/Select.stories.tsx +0 -385
  418. package/src/components/select/Select.test.tsx +0 -199
  419. package/src/components/select/Select.tsx +0 -199
  420. package/src/components/select/SelectMultiple.stories.tsx +0 -315
  421. package/src/components/select/SelectMultiple.test.tsx +0 -213
  422. package/src/components/select/SelectMultiple.tsx +0 -206
  423. package/src/components/select/WithSelectContext.tsx +0 -147
  424. package/src/components/select/constants.ts +0 -55
  425. package/src/components/select/index.ts +0 -2
  426. package/src/components/side-navigation/SideNavigation.stories.tsx +0 -191
  427. package/src/components/side-navigation/SideNavigation.test.tsx +0 -37
  428. package/src/components/side-navigation/SideNavigation.tsx +0 -52
  429. package/src/components/side-navigation/SideNavigationItem.stories.tsx +0 -133
  430. package/src/components/side-navigation/SideNavigationItem.test.tsx +0 -136
  431. package/src/components/side-navigation/SideNavigationItem.tsx +0 -165
  432. package/src/components/side-navigation/index.ts +0 -2
  433. package/src/components/skeleton/SkeletonCircle.stories.tsx +0 -41
  434. package/src/components/skeleton/SkeletonCircle.test.tsx +0 -27
  435. package/src/components/skeleton/SkeletonCircle.tsx +0 -52
  436. package/src/components/skeleton/SkeletonRectangle.stories.tsx +0 -82
  437. package/src/components/skeleton/SkeletonRectangle.test.tsx +0 -27
  438. package/src/components/skeleton/SkeletonRectangle.tsx +0 -88
  439. package/src/components/skeleton/SkeletonTypography.stories.tsx +0 -19
  440. package/src/components/skeleton/SkeletonTypography.test.tsx +0 -27
  441. package/src/components/skeleton/SkeletonTypography.tsx +0 -59
  442. package/src/components/skeleton/index.ts +0 -3
  443. package/src/components/slider/Slider.stories.tsx +0 -45
  444. package/src/components/slider/Slider.test.tsx +0 -29
  445. package/src/components/slider/Slider.tsx +0 -299
  446. package/src/components/slider/index.ts +0 -2
  447. package/src/components/slideshow/Slides.tsx +0 -130
  448. package/src/components/slideshow/Slideshow.stories.tsx +0 -179
  449. package/src/components/slideshow/Slideshow.test.tsx +0 -35
  450. package/src/components/slideshow/Slideshow.tsx +0 -173
  451. package/src/components/slideshow/SlideshowControls.stories.tsx +0 -100
  452. package/src/components/slideshow/SlideshowControls.tsx +0 -243
  453. package/src/components/slideshow/SlideshowItem.tsx +0 -44
  454. package/src/components/slideshow/SlideshowItemGroup.tsx +0 -60
  455. package/src/components/slideshow/constants.ts +0 -24
  456. package/src/components/slideshow/index.ts +0 -4
  457. package/src/components/slideshow/useKeyNavigate.ts +0 -28
  458. package/src/components/slideshow/usePaginationVisibleRange.ts +0 -37
  459. package/src/components/slideshow/useSlideFocusManagement.tsx +0 -92
  460. package/src/components/slideshow/useSwipeNavigate.ts +0 -18
  461. package/src/components/switch/Switch.stories.tsx +0 -49
  462. package/src/components/switch/Switch.test.tsx +0 -144
  463. package/src/components/switch/Switch.tsx +0 -145
  464. package/src/components/switch/index.ts +0 -1
  465. package/src/components/table/Table.test.tsx +0 -29
  466. package/src/components/table/Table.tsx +0 -59
  467. package/src/components/table/TableBody.test.tsx +0 -30
  468. package/src/components/table/TableBody.tsx +0 -42
  469. package/src/components/table/TableCell.test.tsx +0 -72
  470. package/src/components/table/TableCell.tsx +0 -130
  471. package/src/components/table/TableHeader.test.tsx +0 -30
  472. package/src/components/table/TableHeader.tsx +0 -48
  473. package/src/components/table/TableRow.test.tsx +0 -40
  474. package/src/components/table/TableRow.tsx +0 -71
  475. package/src/components/table/index.ts +0 -5
  476. package/src/components/tabs/Tab.test.tsx +0 -50
  477. package/src/components/tabs/Tab.tsx +0 -133
  478. package/src/components/tabs/TabList.test.tsx +0 -49
  479. package/src/components/tabs/TabList.tsx +0 -94
  480. package/src/components/tabs/TabPanel.test.tsx +0 -37
  481. package/src/components/tabs/TabPanel.tsx +0 -67
  482. package/src/components/tabs/TabProvider.test.tsx +0 -161
  483. package/src/components/tabs/TabProvider.tsx +0 -67
  484. package/src/components/tabs/Tabs.stories.tsx +0 -170
  485. package/src/components/tabs/index.ts +0 -4
  486. package/src/components/tabs/state.ts +0 -114
  487. package/src/components/tabs/test-utils.ts +0 -39
  488. package/src/components/text/Text.stories.tsx +0 -177
  489. package/src/components/text/Text.test.tsx +0 -92
  490. package/src/components/text/Text.tsx +0 -139
  491. package/src/components/text/index.ts +0 -1
  492. package/src/components/text-field/TextField.stories.tsx +0 -180
  493. package/src/components/text-field/TextField.test.tsx +0 -298
  494. package/src/components/text-field/TextField.tsx +0 -493
  495. package/src/components/text-field/index.ts +0 -1
  496. package/src/components/thumbnail/Thumbnail.stories.tsx +0 -448
  497. package/src/components/thumbnail/Thumbnail.test.tsx +0 -88
  498. package/src/components/thumbnail/Thumbnail.tsx +0 -248
  499. package/src/components/thumbnail/index.ts +0 -3
  500. package/src/components/thumbnail/types.ts +0 -48
  501. package/src/components/thumbnail/useFocusPointStyle.test.ts +0 -92
  502. package/src/components/thumbnail/useFocusPointStyle.tsx +0 -107
  503. package/src/components/thumbnail/useImageLoad.ts +0 -40
  504. package/src/components/toolbar/Toolbar.tsx +0 -68
  505. package/src/components/toolbar/index.ts +0 -1
  506. package/src/components/tooltip/Tooltip.stories.tsx +0 -118
  507. package/src/components/tooltip/Tooltip.test.tsx +0 -417
  508. package/src/components/tooltip/Tooltip.tsx +0 -165
  509. package/src/components/tooltip/constants.ts +0 -8
  510. package/src/components/tooltip/context.tsx +0 -17
  511. package/src/components/tooltip/index.ts +0 -1
  512. package/src/components/tooltip/useInjectTooltipRef.tsx +0 -55
  513. package/src/components/tooltip/useTooltipOpen.tsx +0 -143
  514. package/src/components/uploader/Uploader.stories.tsx +0 -109
  515. package/src/components/uploader/Uploader.test.tsx +0 -146
  516. package/src/components/uploader/Uploader.tsx +0 -177
  517. package/src/components/uploader/index.ts +0 -1
  518. package/src/components/user-block/UserBlock.stories.tsx +0 -133
  519. package/src/components/user-block/UserBlock.test.tsx +0 -106
  520. package/src/components/user-block/UserBlock.tsx +0 -193
  521. package/src/components/user-block/index.ts +0 -1
  522. package/src/constants.ts +0 -27
  523. package/src/hooks/useBooleanState.tsx +0 -13
  524. package/src/hooks/useCallbackOnEscape.ts +0 -34
  525. package/src/hooks/useChipGroupNavigation.tsx +0 -75
  526. package/src/hooks/useClickAway.tsx +0 -48
  527. package/src/hooks/useDisableBodyScroll.ts +0 -28
  528. package/src/hooks/useEventCallback.tsx +0 -17
  529. package/src/hooks/useFocus.tsx +0 -21
  530. package/src/hooks/useFocusTrap.ts +0 -93
  531. package/src/hooks/useFocusWithin.ts +0 -33
  532. package/src/hooks/useId.test.tsx +0 -22
  533. package/src/hooks/useId.ts +0 -15
  534. package/src/hooks/useImageSize.ts +0 -17
  535. package/src/hooks/useInfiniteScroll.tsx +0 -60
  536. package/src/hooks/useIntersectionObserver.tsx +0 -43
  537. package/src/hooks/useInterval.tsx +0 -31
  538. package/src/hooks/useKeyboardListNavigation.tsx +0 -204
  539. package/src/hooks/useListenFocus.tsx +0 -26
  540. package/src/hooks/useOverflowTooltipLabel.tsx +0 -32
  541. package/src/hooks/usePopper.ts +0 -12
  542. package/src/hooks/usePreviousValue.ts +0 -12
  543. package/src/hooks/useRovingTabIndex.tsx +0 -90
  544. package/src/hooks/useSizeOnWindowResize.ts +0 -30
  545. package/src/hooks/useSlideshowControls.ts +0 -246
  546. package/src/hooks/useStopPropagation.ts +0 -21
  547. package/src/hooks/useTransitionVisibility.ts +0 -48
  548. package/src/index.ts +0 -63
  549. package/src/stories/controls/color.ts +0 -7
  550. package/src/stories/controls/element.ts +0 -6
  551. package/src/stories/controls/focusPoint.ts +0 -1
  552. package/src/stories/controls/icons.ts +0 -126
  553. package/src/stories/controls/image.ts +0 -84
  554. package/src/stories/controls/selectArgType.ts +0 -8
  555. package/src/stories/controls/theme.ts +0 -3
  556. package/src/stories/controls/typography.ts +0 -5
  557. package/src/stories/controls/withUndefined.ts +0 -1
  558. package/src/stories/decorators/withChromaticForceScreenSize.tsx +0 -7
  559. package/src/stories/decorators/withCombinations.tsx +0 -132
  560. package/src/stories/decorators/withNestedProps.tsx +0 -22
  561. package/src/stories/decorators/withResizableBox.tsx +0 -21
  562. package/src/stories/decorators/withThemedBackground.tsx +0 -16
  563. package/src/stories/decorators/withValueOnChange.tsx +0 -18
  564. package/src/stories/decorators/withWrapper.tsx +0 -19
  565. package/src/stories/generated/Autocomplete/Demos.stories.tsx +0 -7
  566. package/src/stories/generated/Avatar/Demos.stories.tsx +0 -7
  567. package/src/stories/generated/Badge/Demos.stories.tsx +0 -9
  568. package/src/stories/generated/Button/Demos.stories.tsx +0 -11
  569. package/src/stories/generated/Checkbox/Demos.stories.tsx +0 -6
  570. package/src/stories/generated/Chip/Demos.stories.tsx +0 -11
  571. package/src/stories/generated/CommentBlock/Demos.stories.tsx +0 -8
  572. package/src/stories/generated/DatePicker/Demos.stories.tsx +0 -8
  573. package/src/stories/generated/Dialog/Demos.stories.tsx +0 -10
  574. package/src/stories/generated/Divider/Demos.stories.tsx +0 -6
  575. package/src/stories/generated/Dropdown/Demos.stories.tsx +0 -8
  576. package/src/stories/generated/ExpansionPanel/Demos.stories.tsx +0 -9
  577. package/src/stories/generated/Flag/Demos.stories.tsx +0 -6
  578. package/src/stories/generated/GenericBlock/Demos.stories.tsx +0 -8
  579. package/src/stories/generated/Heading/Demos.stories.tsx +0 -6
  580. package/src/stories/generated/Icon/Demos.stories.tsx +0 -8
  581. package/src/stories/generated/ImageBlock/Demos.stories.tsx +0 -9
  582. package/src/stories/generated/ImageLightbox/Demos.stories.tsx +0 -6
  583. package/src/stories/generated/Lightbox/Demos.stories.tsx +0 -6
  584. package/src/stories/generated/LinkPreview/Demos.stories.tsx +0 -7
  585. package/src/stories/generated/List/Demos.stories.tsx +0 -11
  586. package/src/stories/generated/Message/Demos.stories.tsx +0 -11
  587. package/src/stories/generated/Mosaic/Demos.stories.tsx +0 -10
  588. package/src/stories/generated/Notification/Demos.stories.tsx +0 -6
  589. package/src/stories/generated/Popover/Demos.stories.tsx +0 -11
  590. package/src/stories/generated/PopoverDialog/Demos.stories.tsx +0 -6
  591. package/src/stories/generated/PostBlock/Demos.stories.tsx +0 -6
  592. package/src/stories/generated/Progress/Demos.stories.tsx +0 -7
  593. package/src/stories/generated/ProgressTracker/Demos.stories.tsx +0 -9
  594. package/src/stories/generated/RadioButton/Demos.stories.tsx +0 -6
  595. package/src/stories/generated/Select/Demos.stories.tsx +0 -14
  596. package/src/stories/generated/SideNavigation/Demos.stories.tsx +0 -10
  597. package/src/stories/generated/Skeleton/Demos.stories.tsx +0 -9
  598. package/src/stories/generated/Slider/Demos.stories.tsx +0 -9
  599. package/src/stories/generated/Slideshow/Demos.stories.tsx +0 -8
  600. package/src/stories/generated/Switch/Demos.stories.tsx +0 -6
  601. package/src/stories/generated/Table/Demos.stories.tsx +0 -7
  602. package/src/stories/generated/Tabs/Demos.stories.tsx +0 -8
  603. package/src/stories/generated/TextField/Demos.stories.tsx +0 -20
  604. package/src/stories/generated/Thumbnail/Demos.stories.tsx +0 -12
  605. package/src/stories/generated/Toolbar/Demos.stories.tsx +0 -10
  606. package/src/stories/generated/Tooltip/Demos.stories.tsx +0 -8
  607. package/src/stories/generated/Uploader/Demos.stories.tsx +0 -8
  608. package/src/stories/generated/UserBlock/Demos.stories.tsx +0 -11
  609. package/src/stories/utils/CustomLink.tsx +0 -12
  610. package/src/stories/utils/concatPath.tsx +0 -17
  611. package/src/stories/utils/disableArgTypes.ts +0 -3
  612. package/src/stories/utils/initDemoShadowDOMPortal.ts +0 -10
  613. package/src/stories/utils/lorem.ts +0 -59
  614. package/src/stories/utils/theming.tsx +0 -166
  615. package/src/stories/utils/toFlattenProps.ts +0 -28
  616. package/src/stories/utils/withCategory.ts +0 -12
  617. package/src/testing/utils/ThemeSentinel.tsx +0 -10
  618. package/src/testing/utils/commonTestsSuiteRTL.tsx +0 -193
  619. package/src/testing/utils/index.ts +0 -1
  620. package/src/testing/utils/queries.ts +0 -19
  621. package/src/untypped-modules.d.ts +0 -9
  622. package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.jsx +0 -70
  623. package/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +0 -69
  624. package/src/utils/ClickAwayProvider/index.ts +0 -1
  625. package/src/utils/MaterialThemeSwitcher/MaterialThemeSwitcher.tsx +0 -54
  626. package/src/utils/MaterialThemeSwitcher/index.ts +0 -1
  627. package/src/utils/Portal/Portal.test.tsx +0 -31
  628. package/src/utils/Portal/Portal.tsx +0 -33
  629. package/src/utils/Portal/PortalProvider.stories.jsx +0 -22
  630. package/src/utils/Portal/PortalProvider.test.tsx +0 -72
  631. package/src/utils/Portal/PortalProvider.tsx +0 -24
  632. package/src/utils/Portal/index.tsx +0 -2
  633. package/src/utils/browser/DOM/findImage.tsx +0 -3
  634. package/src/utils/browser/DOM/startViewTransition.ts +0 -68
  635. package/src/utils/browser/focus/constants.ts +0 -7
  636. package/src/utils/browser/focus/getFirstAndLastFocusable.test.ts +0 -134
  637. package/src/utils/browser/focus/getFirstAndLastFocusable.ts +0 -21
  638. package/src/utils/browser/focus/getFocusableElements.test.ts +0 -151
  639. package/src/utils/browser/focus/getFocusableElements.ts +0 -7
  640. package/src/utils/browser/isFocusVisible.ts +0 -9
  641. package/src/utils/browser/isHoverNotSupported.test.js +0 -24
  642. package/src/utils/browser/isHoverNotSupported.ts +0 -2
  643. package/src/utils/browser/isReducedMotion.ts +0 -6
  644. package/src/utils/date/addMonthResetDay.test.ts +0 -13
  645. package/src/utils/date/addMonthResetDay.ts +0 -9
  646. package/src/utils/date/formatDayNumber.test.ts +0 -12
  647. package/src/utils/date/formatDayNumber.ts +0 -5
  648. package/src/utils/date/getFirstDayOfWeek.test.ts +0 -20
  649. package/src/utils/date/getFirstDayOfWeek.ts +0 -59
  650. package/src/utils/date/getMonthCalendar.test.ts +0 -127
  651. package/src/utils/date/getMonthCalendar.ts +0 -69
  652. package/src/utils/date/getWeekDays.test.ts +0 -48
  653. package/src/utils/date/getWeekDays.ts +0 -34
  654. package/src/utils/date/getYearDisplayName.test.ts +0 -20
  655. package/src/utils/date/getYearDisplayName.ts +0 -12
  656. package/src/utils/date/isDateValid.test.ts +0 -15
  657. package/src/utils/date/isDateValid.ts +0 -4
  658. package/src/utils/date/isSameDay.test.ts +0 -37
  659. package/src/utils/date/isSameDay.ts +0 -11
  660. package/src/utils/disabled/DisabledStateContext.tsx +0 -29
  661. package/src/utils/disabled/DisabledStateProvider.stories.tsx +0 -92
  662. package/src/utils/disabled/index.ts +0 -2
  663. package/src/utils/disabled/useDisableStateProps.test.tsx +0 -74
  664. package/src/utils/disabled/useDisableStateProps.tsx +0 -37
  665. package/src/utils/function/makeListenerTowerContext.ts +0 -32
  666. package/src/utils/index.ts +0 -7
  667. package/src/utils/locale/getCurrentLocale.ts +0 -4
  668. package/src/utils/locale/parseLocale.test.ts +0 -17
  669. package/src/utils/locale/parseLocale.ts +0 -23
  670. package/src/utils/locale/types.ts +0 -8
  671. package/src/utils/number/clamp.ts +0 -17
  672. package/src/utils/object/isEqual.test.ts +0 -25
  673. package/src/utils/object/isEqual.ts +0 -11
  674. package/src/utils/partitionMulti.test.ts +0 -27
  675. package/src/utils/partitionMulti.ts +0 -29
  676. package/src/utils/react/OnBeforeUnmount.tsx +0 -20
  677. package/src/utils/react/RawClickable.test.tsx +0 -153
  678. package/src/utils/react/RawClickable.tsx +0 -65
  679. package/src/utils/react/flattenChildren.ts +0 -32
  680. package/src/utils/react/forwardRef.ts +0 -11
  681. package/src/utils/react/forwardRefPolymorphic.ts +0 -9
  682. package/src/utils/react/mergeRefs.ts +0 -33
  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 -6
  694. package/src/utils/type/HasRequiredLinkHref.ts +0 -1
  695. package/src/utils/type/MaybeElementOrRef.ts +0 -6
  696. package/src/utils/type/index.ts +0 -9
  697. package/src/utils/type/isComponent.ts +0 -33
  698. 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 classNames from 'classnames';
2
+ import { i as isComponent } from './isComponent-b9762ff1.js';
3
+ import { getRootClassName, getBasicClass } from '@lumx/core/js/utils/className';
4
+ import { u as useTheme, T as ThemeProvider } from './ThemeContext-3181f000.js';
5
+ import { f as forwardRef } from './forwardRef-8bce732e.js';
6
+ import { B as ButtonRoot } from './ButtonRoot-a70baf82.js';
7
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
+ import { T as Text } from './index-25c9e8c2.js';
9
+ import { Emphasis, Size, Theme } from '@lumx/core/js/constants';
10
+ import { Icon } from './components/icon-ee15673b.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: !!leftIcon
59
+ }), getBasicClass({
60
+ prefix: CLASSNAME,
61
+ type: 'hasRightIcon',
62
+ value: !!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 &&
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 &&
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-4b67daa8.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button-4b67daa8.js","sources":["../../src/components/button/Button.tsx"],"sourcesContent":["import classNames from 'classnames';\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: !!leftIcon }),\n getBasicClass({ prefix: CLASSNAME, type: 'hasRightIcon', value: !!rightIcon }),\n );\n\n return (\n <ButtonRoot\n ref={ref}\n {...{ emphasis, size, theme, ...forwardedProps }}\n className={buttonClassName}\n variant=\"button\"\n >\n {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 && (\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","_jsxs","ButtonRoot","variant","_jsx","ThemeProvider","undefined","Icon","icon","isComponent","Text","displayName","defaultProps"],"mappings":";;;;;;;;;;;AAcO,MAAMA,cAAc,GAAGC,SAAQ;;AAEtC;AACA;AACA;;AAYA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,QAAQ,CAAA;;AAE/B;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,c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AjB,QAAA,eAC5Be,GAAA,CAACG,IAAI,EAAA;AAACC,QAAAA,IAAI,EAAEjB,QAAAA;OAAW,CAAA;AAAC,KACb,CAClB,EACAF,QAAQ,KAAKoB,WAAW,CAACC,IAAI,CAAC,CAACrB,QAAQ,CAAC,GAAGA,QAAQ,gBAAGe,GAAA,CAAA,MAAA,EAAA;AAAAf,MAAAA,QAAA,EAAOA,QAAAA;KAAe,CAAC,CAAC,EAC9EG,SAAS;AAAA;AACN;AACAY,IAAAA,GAAA,CAACC,aAAa,EAAA;AAACL,MAAAA,KAAK,EAAEM,SAAU;MAAAjB,QAAA,eAC5Be,GAAA,CAACG,IAAI,EAAA;AAACC,QAAAA,IAAI,EAAEhB,SAAAA;OAAY,CAAA;AAAC,KACd,CAClB,CAAA;AAAA,GACO,CAAC,CAAA;AAErB,CAAC,EAAC;AACFX,MAAM,CAAC8B,WAAW,GAAGvC,cAAc,CAAA;AACnCS,MAAM,CAACS,SAAS,GAAGjB,SAAS,CAAA;AAC5BQ,MAAM,CAAC+B,YAAY,GAAGrC,aAAa;;;;"}
@@ -0,0 +1,118 @@
1
+ import classNames from 'classnames';
2
+ import './constants-d0e3f49e.js';
3
+ import { handleBasicClasses } from '@lumx/core/js/utils/className';
4
+ import { f as forwardRef } from './forwardRef-8bce732e.js';
5
+ import { R as RawClickable } from './RawClickable-2c2b6a89.js';
6
+ import { jsx } from 'react/jsx-runtime';
7
+ import { u as useDisableStateProps } from './useDisableStateProps-69e16b7c.js';
8
+ import { Emphasis, Theme, ColorPalette, CSS_PREFIX } from '@lumx/core/js/constants';
9
+
10
+ /**
11
+ * Component display name.
12
+ */
13
+ const COMPONENT_NAME = 'ButtonRoot';
14
+ const BUTTON_WRAPPER_CLASSNAME = `${CSS_PREFIX}-button-wrapper`;
15
+ const BUTTON_CLASSNAME = `${CSS_PREFIX}-button`;
16
+
17
+ /**
18
+ * Render a button wrapper with the ButtonRoot inside.
19
+ *
20
+ * @param props Component props.
21
+ * @return React element.
22
+ */
23
+ const renderButtonWrapper = props => {
24
+ const {
25
+ color,
26
+ emphasis,
27
+ variant,
28
+ fullWidth
29
+ } = props;
30
+ const adaptedColor = emphasis === Emphasis.low && (color === ColorPalette.light ? ColorPalette.dark : ColorPalette.light);
31
+ const wrapperClassName = classNames(handleBasicClasses({
32
+ color: adaptedColor,
33
+ prefix: BUTTON_WRAPPER_CLASSNAME,
34
+ variant,
35
+ fullWidth
36
+ }));
37
+ const buttonProps = {
38
+ ...props,
39
+ hasBackground: false
40
+ };
41
+ return /*#__PURE__*/jsx("div", {
42
+ className: wrapperClassName,
43
+ children: /*#__PURE__*/jsx(ButtonRoot, {
44
+ ...buttonProps
45
+ })
46
+ });
47
+ };
48
+
49
+ /**
50
+ * ButtonRoot component.
51
+ *
52
+ * @param props Component props.
53
+ * @param ref Component ref.
54
+ * @return React element.
55
+ */
56
+ const ButtonRoot = forwardRef((props, ref) => {
57
+ const {
58
+ isAnyDisabled,
59
+ disabledStateProps,
60
+ otherProps
61
+ } = useDisableStateProps(props);
62
+ const {
63
+ 'aria-label': ariaLabel,
64
+ children,
65
+ className,
66
+ color,
67
+ emphasis,
68
+ hasBackground,
69
+ isSelected,
70
+ isActive,
71
+ isFocused,
72
+ isHovered,
73
+ linkAs,
74
+ size,
75
+ theme,
76
+ variant,
77
+ fullWidth,
78
+ ...forwardedProps
79
+ } = otherProps;
80
+ const adaptedColor = color || emphasis !== Emphasis.high && theme === Theme.dark && ColorPalette.light || emphasis === Emphasis.high && ColorPalette.primary || ColorPalette.dark;
81
+ if (hasBackground) {
82
+ return renderButtonWrapper({
83
+ ...props,
84
+ ref,
85
+ variant,
86
+ color: adaptedColor
87
+ });
88
+ }
89
+ const buttonClassName = classNames(className, handleBasicClasses({
90
+ color: adaptedColor,
91
+ emphasis,
92
+ isSelected,
93
+ isDisabled: props.isDisabled || props['aria-disabled'],
94
+ isActive,
95
+ isFocused,
96
+ isHovered,
97
+ prefix: BUTTON_CLASSNAME,
98
+ size,
99
+ theme: emphasis === Emphasis.high && theme,
100
+ variant,
101
+ fullWidth
102
+ }));
103
+ return /*#__PURE__*/jsx(RawClickable, {
104
+ as: linkAs || (forwardedProps.href ? 'a' : 'button'),
105
+ ...forwardedProps,
106
+ ...disabledStateProps,
107
+ "aria-disabled": isAnyDisabled,
108
+ "aria-label": ariaLabel,
109
+ ref: ref,
110
+ className: buttonClassName,
111
+ children: children
112
+ });
113
+ });
114
+ ButtonRoot.displayName = COMPONENT_NAME;
115
+ ButtonRoot.defaultProps = {};
116
+
117
+ export { ButtonRoot as B };
118
+ //# sourceMappingURL=ButtonRoot-a70baf82.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonRoot-a70baf82.js","sources":["../../src/components/button/ButtonRoot.tsx"],"sourcesContent":["import { AriaAttributes, ButtonHTMLAttributes, DetailedHTMLProps, RefObject } from 'react';\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","displayName","defaultProps"],"mappings":";;;;;;;;;AAoDA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,YAAY,CAAA;AAE5B,MAAMC,wBAAwB,GAAG,CAAA,EAAGC,UAAU,CAAiB,eAAA,CAAA,CAAA;AAC/D,MAAMC,gBAAgB,GAAG,CAAA,EAAGD,UAAU,CAAS,OAAA,CAAA,CAAA;;AAEtD;AACA;AACA;AAC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AoC;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,144 @@
1
+ import classNames from 'classnames';
2
+ import { useCallback } from 'react';
3
+ import { getRootClassName, handleBasicClasses } from '@lumx/core/js/utils/className';
4
+ import { onEnterPressed } from '@lumx/core/js/utils';
5
+ import { f as forwardRef } from './forwardRef-8bce732e.js';
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 || !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 hasOnClick = Boolean(props.onClick);
77
+ const isButton = hasOnClick && !href;
78
+ const isClickable = Boolean(hasOnClick) || Boolean(href) || propIsClickable;
79
+
80
+ // Adapt color to the theme.
81
+ const chipColor = color || (theme === Theme.light ? ColorPalette.dark : ColorPalette.light);
82
+ const handleOnBeforeClick = useStopPropagation(onBeforeClick);
83
+ const handleOnAfterClick = useStopPropagation(onAfterClick);
84
+ const handleKeyDown = evt => {
85
+ onKeyDown?.(evt);
86
+ if (onClick) {
87
+ onEnterPressed(onClick)(evt);
88
+ }
89
+ };
90
+ return (
91
+ /*#__PURE__*/
92
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
93
+ jsxs("a", {
94
+ role: isButton ? 'button' : undefined,
95
+ tabIndex: isClickable && !disabledStateProps.disabled ? 0 : undefined,
96
+ ...forwardedProps,
97
+ href: !disabledStateProps.disabled ? href : undefined,
98
+ ref: ref,
99
+ className: classNames(className, handleBasicClasses({
100
+ clickable: isClickable,
101
+ color: chipColor,
102
+ isDisabled: isAnyDisabled,
103
+ hasAfter: Boolean(after),
104
+ hasBefore: Boolean(before),
105
+ highlighted: Boolean(isHighlighted),
106
+ prefix: CLASSNAME,
107
+ selected: Boolean(isSelected),
108
+ size,
109
+ unselected: Boolean(!isSelected)
110
+ })),
111
+ "aria-disabled": isClickable && isAnyDisabled || undefined,
112
+ onClick: onClick || undefined,
113
+ onKeyDown: handleKeyDown,
114
+ children: [before &&
115
+ /*#__PURE__*/
116
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
117
+ jsx("div", {
118
+ className: classNames(`${CLASSNAME}__before`, {
119
+ [`${CLASSNAME}__before--is-clickable`]: !!onBeforeClick
120
+ }),
121
+ onClick: handleOnBeforeClick,
122
+ children: before
123
+ }), /*#__PURE__*/jsx("div", {
124
+ className: `${CLASSNAME}__label`,
125
+ children: children
126
+ }), after &&
127
+ /*#__PURE__*/
128
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
129
+ jsx("div", {
130
+ className: classNames(`${CLASSNAME}__after`, {
131
+ [`${CLASSNAME}__after--is-clickable`]: !!onAfterClick
132
+ }),
133
+ onClick: handleOnAfterClick,
134
+ children: after
135
+ })]
136
+ })
137
+ );
138
+ });
139
+ Chip.displayName = COMPONENT_NAME;
140
+ Chip.className = CLASSNAME;
141
+ Chip.defaultProps = DEFAULT_PROPS;
142
+
143
+ export { Chip as C };
144
+ //# sourceMappingURL=Chip-70af04b4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chip-70af04b4.js","sources":["../../src/hooks/useStopPropagation.ts","../../src/components/chip/Chip.tsx"],"sourcesContent":["import { 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 || !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';\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 hasOnClick = Boolean(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 (onClick) {\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={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`]: !!onBeforeClick,\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`]: !!onAfterClick,\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","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","hasOnClick","Boolean","isButton","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":";;;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAkBA,CAACC,OAA2B,EAAqB;EAC/E,OAAOC,WAAW,CACbC,GAAG,IAAK;AACL,IAAA,IAAI,CAACA,GAAG,IAAI,CAACF,OAAO,EAAE;AAClB,MAAA,OAAA;AACJ,KAAA;IACAA,OAAO,CAACE,GAAG,CAAC,CAAA;IACZA,GAAG,CAACC,eAAe,EAAE,CAAA;AACzB,GAAC,EACD,CAACH,OAAO,CACZ,CAAC,CAAA;AACL;;AC6BA;AACA;AACA;AACA,MAAMI,cAAc,GAAG,MAAM,CAAA;;AAE7B;AACA;AACA;AACA,MAAMC,SAAS,GAAGC,gBAAgB,CAACF,cAAc,CAAC,CAAA;;AAElD;AACA;AACA;AACA,MAAMG,aAAiC,GAAG;EACtCC,IAAI,EAAEC,IAAI,CAACC,CAAAA;AACf,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,IAAI,GAAGC,UAAU,CAA+B,CAACC,KAAK,EAAEC,GAAG,KAAK;EACzE,MAAMC,YAAY,GAAGC,QAAQ,EAAE,IAAIC,KAAK,CAACC,KAAK,CAAA;EAC9C,MAAM;IAAEC,aAAa;IAAEC,kBAAkB;AAAEC,IAAAA,UAAAA;AAAW,GAAC,GAAGC,oBAAoB,CAACT,KAAK,CAAC,CAAA;EACrF,MAAM;IACFU,KAAK;IACLC,MAAM;IACNC,Q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AA,QAAA,EAAEA,QAAAA;OAAc,CAAC,EACtDF,KAAK;AAAA;AACF;MACAyC,GAAA,CAAA,KAAA,EAAA;AACItC,QAAAA,SAAS,EAAE4B,UAAU,CAAC,CAAGjD,EAAAA,SAAS,SAAS,EAAE;AACzC,UAAA,CAAC,CAAGA,EAAAA,SAAS,CAAuB,qBAAA,CAAA,GAAG,CAAC,CAAC2B,YAAAA;AAC7C,SAAC,CAAE;AACHE,QAAAA,OAAO,EAAEY,kBAAmB;AAAArB,QAAAA,QAAA,EAE3BF,KAAAA;AAAK,OACL,CACR,CAAA;KACF,CAAA;AAAC,IAAA;AAEZ,CAAC,EAAC;AACFZ,IAAI,CAACsD,WAAW,GAAG7D,cAAc,CAAA;AACjCO,IAAI,CAACe,SAAS,GAAGrB,SAAS,CAAA;AAC1BM,IAAI,CAACuD,YAAY,GAAG3D,aAAa;;;;"}
@@ -0,0 +1,95 @@
1
+ import { useEffect, useContext, useMemo, useRef, createContext } from 'react';
2
+ import { isEmpty } from '@lumx/core/js/utils/collection/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-1204f237.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClickAwayProvider-1204f237.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';\nimport { isEmpty } from '@lumx/core/js/utils/collection/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":";;;;AAKA,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,I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,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;;;;"}
@@ -0,0 +1,61 @@
1
+ import { Typography } from '@lumx/core/js/constants';
2
+ import React__default, { createContext } from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ /** The maximum authorized heading level. */
6
+ const MAX_HEADING_LEVEL = 6;
7
+
8
+ /**
9
+ * Typography to use by default depending on the heading level.
10
+ */
11
+ const DEFAULT_TYPOGRAPHY_BY_LEVEL = {
12
+ h1: Typography.display1,
13
+ h2: Typography.headline,
14
+ h3: Typography.title,
15
+ h4: Typography.subtitle2,
16
+ h5: Typography.subtitle1,
17
+ h6: Typography.body2
18
+ };
19
+
20
+ const defaultContext = {
21
+ level: 1,
22
+ headingElement: 'h1'
23
+ };
24
+ const HeadingLevelContext = /*#__PURE__*/createContext(defaultContext);
25
+
26
+ const useHeadingLevel = () => {
27
+ const {
28
+ level = 1,
29
+ headingElement = 'h1'
30
+ } = React__default.useContext(HeadingLevelContext);
31
+ return {
32
+ level,
33
+ headingElement
34
+ };
35
+ };
36
+
37
+ /**
38
+ * Provide a new heading level context.
39
+ */
40
+ const HeadingLevelProvider = ({
41
+ children,
42
+ level
43
+ }) => {
44
+ const {
45
+ level: contextLevel
46
+ } = useHeadingLevel();
47
+ const incrementedLevel = level || contextLevel + 1;
48
+ /** Don't allow a level beyond the maximum level. */
49
+ const nextLevel = incrementedLevel > MAX_HEADING_LEVEL ? MAX_HEADING_LEVEL : incrementedLevel;
50
+ const headingElement = `h${nextLevel}`;
51
+ return /*#__PURE__*/jsx(HeadingLevelContext.Provider, {
52
+ value: {
53
+ level: nextLevel,
54
+ headingElement
55
+ },
56
+ children: children
57
+ });
58
+ };
59
+
60
+ export { DEFAULT_TYPOGRAPHY_BY_LEVEL as D, HeadingLevelProvider as H, useHeadingLevel as u };
61
+ //# sourceMappingURL=HeadingLevelProvider-ebdcb0c7.js.map