@lumx/react 3.20.1-alpha.5 → 3.20.1-alpha.6

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 (230) hide show
  1. package/_internal/index.js.map +1 -1
  2. package/index.d.ts +35 -34
  3. package/index.js +778 -651
  4. package/index.js.map +1 -1
  5. package/package.json +13 -12
  6. package/src/components/alert-dialog/AlertDialog.stories.tsx +1 -1
  7. package/src/components/alert-dialog/AlertDialog.test.tsx +3 -4
  8. package/src/components/autocomplete/Autocomplete.stories.tsx +1 -1
  9. package/src/components/autocomplete/Autocomplete.test.tsx +3 -5
  10. package/src/components/autocomplete/Autocomplete.tsx +1 -1
  11. package/src/components/autocomplete/AutocompleteMultiple.stories.tsx +1 -1
  12. package/src/components/autocomplete/AutocompleteMultiple.test.tsx +0 -2
  13. package/src/components/autocomplete/AutocompleteMultiple.tsx +1 -1
  14. package/src/components/avatar/Avatar.stories.tsx +0 -2
  15. package/src/components/avatar/Avatar.test.tsx +0 -2
  16. package/src/components/avatar/Avatar.tsx +1 -1
  17. package/src/components/badge/Badge.stories.tsx +0 -1
  18. package/src/components/badge/Badge.test.tsx +0 -2
  19. package/src/components/badge/Badge.tsx +1 -1
  20. package/src/components/badge/BadgeWrapper.stories.tsx +0 -1
  21. package/src/components/badge/BadgeWrapper.test.tsx +0 -2
  22. package/src/components/badge/BadgeWrapper.tsx +1 -1
  23. package/src/components/button/Button.stories.tsx +0 -1
  24. package/src/components/button/Button.test.tsx +9 -11
  25. package/src/components/button/Button.tsx +0 -2
  26. package/src/components/button/ButtonGroup.stories.tsx +0 -2
  27. package/src/components/button/ButtonGroup.test.tsx +0 -2
  28. package/src/components/button/ButtonGroup.tsx +0 -2
  29. package/src/components/button/ButtonRoot.tsx +7 -37
  30. package/src/components/button/IconButton.test.tsx +0 -2
  31. package/src/components/button/IconButton.tsx +0 -2
  32. package/src/components/checkbox/Checkbox.test.tsx +3 -5
  33. package/src/components/chip/Chip.stories.tsx +0 -2
  34. package/src/components/chip/Chip.test.tsx +19 -19
  35. package/src/components/chip/Chip.tsx +1 -1
  36. package/src/components/chip/ChipGroup.stories.tsx +0 -2
  37. package/src/components/chip/ChipGroup.test.tsx +0 -2
  38. package/src/components/chip/ChipGroup.tsx +1 -1
  39. package/src/components/comment-block/CommentBlock.stories.tsx +0 -1
  40. package/src/components/comment-block/CommentBlock.test.tsx +0 -1
  41. package/src/components/comment-block/CommentBlock.tsx +1 -1
  42. package/src/components/date-picker/DatePicker.test.tsx +3 -5
  43. package/src/components/date-picker/DatePicker.tsx +1 -1
  44. package/src/components/date-picker/DatePickerControlled.test.tsx +6 -8
  45. package/src/components/date-picker/DatePickerField.test.tsx +3 -5
  46. package/src/components/dialog/Dialog.test.tsx +4 -6
  47. package/src/components/divider/Divider.test.tsx +0 -2
  48. package/src/components/divider/Divider.tsx +0 -2
  49. package/src/components/drag-handle/DragHandle.test.tsx +0 -2
  50. package/src/components/drag-handle/DragHandle.tsx +0 -2
  51. package/src/components/dropdown/Dropdown.stories.tsx +1 -1
  52. package/src/components/dropdown/Dropdown.test.tsx +3 -3
  53. package/src/components/dropdown/Dropdown.tsx +1 -1
  54. package/src/components/expansion-panel/ExpansionPanel.test.tsx +6 -7
  55. package/src/components/flag/Flag.test.tsx +0 -2
  56. package/src/components/flag/Flag.tsx +0 -2
  57. package/src/components/flex-box/FlexBox.stories.tsx +0 -2
  58. package/src/components/flex-box/FlexBox.test.tsx +0 -1
  59. package/src/components/flex-box/FlexBox.tsx +1 -1
  60. package/src/components/generic-block/GenericBlock.test.tsx +1 -1
  61. package/src/components/grid/Grid.tsx +0 -2
  62. package/src/components/grid/GridItem.tsx +0 -2
  63. package/src/components/grid-column/GridColumn.stories.tsx +0 -1
  64. package/src/components/grid-column/GridColumn.test.jsx +0 -2
  65. package/src/components/grid-column/GridColumn.tsx +1 -1
  66. package/src/components/heading/Heading.stories.tsx +0 -1
  67. package/src/components/heading/Heading.test.tsx +0 -2
  68. package/src/components/heading/Heading.tsx +0 -2
  69. package/src/components/heading/HeadingLevelProvider.tsx +1 -1
  70. package/src/components/icon/Icon.stories.tsx +30 -4
  71. package/src/components/icon/Icon.test.tsx +85 -4
  72. package/src/components/icon/Icon.tsx +0 -2
  73. package/src/components/image-block/ImageBlock.stories.tsx +0 -2
  74. package/src/components/image-block/ImageBlock.test.tsx +0 -1
  75. package/src/components/image-block/ImageBlock.tsx +1 -1
  76. package/src/components/image-block/ImageCaption.tsx +1 -1
  77. package/src/components/image-lightbox/ImageLightbox.stories.tsx +0 -1
  78. package/src/components/image-lightbox/ImageLightbox.test.tsx +11 -9
  79. package/src/components/image-lightbox/types.ts +0 -2
  80. package/src/components/inline-list/InlineList.stories.tsx +0 -1
  81. package/src/components/inline-list/InlineList.test.tsx +0 -2
  82. package/src/components/inline-list/InlineList.tsx +1 -1
  83. package/src/components/input-helper/InputHelper.test.tsx +0 -2
  84. package/src/components/input-helper/InputHelper.tsx +1 -1
  85. package/src/components/input-label/InputLabel.stories.tsx +0 -2
  86. package/src/components/input-label/InputLabel.test.tsx +0 -2
  87. package/src/components/input-label/InputLabel.tsx +1 -1
  88. package/src/components/lightbox/Lightbox.test.tsx +0 -2
  89. package/src/components/lightbox/Lightbox.tsx +1 -1
  90. package/src/components/link/Link.stories.tsx +0 -1
  91. package/src/components/link/Link.test.tsx +13 -13
  92. package/src/components/link/Link.tsx +9 -22
  93. package/src/components/link-preview/LinkPreview.test.tsx +0 -2
  94. package/src/components/link-preview/LinkPreview.tsx +0 -2
  95. package/src/components/list/List.stories.tsx +1 -1
  96. package/src/components/list/List.test.tsx +0 -2
  97. package/src/components/list/List.tsx +1 -1
  98. package/src/components/list/ListDivider.test.tsx +0 -2
  99. package/src/components/list/ListDivider.tsx +0 -2
  100. package/src/components/list/ListItem.test.tsx +5 -7
  101. package/src/components/list/ListItem.tsx +1 -1
  102. package/src/components/list/ListSubheader.test.tsx +0 -2
  103. package/src/components/list/ListSubheader.tsx +1 -1
  104. package/src/components/message/Message.test.tsx +1 -2
  105. package/src/components/message/Message.tsx +1 -1
  106. package/src/components/mosaic/Mosaic.test.tsx +3 -5
  107. package/src/components/mosaic/Mosaic.tsx +1 -1
  108. package/src/components/navigation/Navigation.stories.tsx +0 -2
  109. package/src/components/navigation/Navigation.test.tsx +0 -2
  110. package/src/components/navigation/Navigation.tsx +0 -2
  111. package/src/components/navigation/NavigationItem.test.tsx +0 -2
  112. package/src/components/navigation/NavigationItem.tsx +7 -11
  113. package/src/components/navigation/NavigationSection.test.tsx +0 -2
  114. package/src/components/navigation/NavigationSection.tsx +5 -4
  115. package/src/components/notification/Notification.test.tsx +4 -5
  116. package/src/components/notification/Notification.tsx +1 -1
  117. package/src/components/popover/Popover.test.tsx +0 -2
  118. package/src/components/popover/Popover.tsx +1 -1
  119. package/src/components/popover/usePopoverStyle.tsx +1 -1
  120. package/src/components/popover-dialog/PopoverDialog.test.tsx +1 -2
  121. package/src/components/popover-dialog/PopoverDialog.tsx +0 -2
  122. package/src/components/post-block/PostBlock.test.tsx +0 -2
  123. package/src/components/post-block/PostBlock.tsx +1 -1
  124. package/src/components/progress/Progress.tsx +0 -2
  125. package/src/components/progress/ProgressCircular.stories.tsx +0 -1
  126. package/src/components/progress/ProgressCircular.test.tsx +0 -2
  127. package/src/components/progress/ProgressCircular.tsx +0 -2
  128. package/src/components/progress/ProgressLinear.test.tsx +0 -2
  129. package/src/components/progress/ProgressLinear.tsx +0 -2
  130. package/src/components/progress-tracker/ProgressTracker.stories.tsx +1 -1
  131. package/src/components/progress-tracker/ProgressTracker.test.tsx +0 -2
  132. package/src/components/progress-tracker/ProgressTrackerProvider.test.tsx +0 -2
  133. package/src/components/progress-tracker/ProgressTrackerProvider.tsx +1 -1
  134. package/src/components/progress-tracker/ProgressTrackerStep.test.tsx +0 -2
  135. package/src/components/progress-tracker/ProgressTrackerStep.tsx +1 -1
  136. package/src/components/progress-tracker/ProgressTrackerStepPanel.test.tsx +0 -2
  137. package/src/components/progress-tracker/ProgressTrackerStepPanel.tsx +0 -2
  138. package/src/components/radio-button/RadioButton.test.tsx +3 -5
  139. package/src/components/radio-button/RadioButton.tsx +1 -1
  140. package/src/components/radio-button/RadioGroup.stories.tsx +1 -1
  141. package/src/components/radio-button/RadioGroup.test.tsx +0 -2
  142. package/src/components/radio-button/RadioGroup.tsx +1 -1
  143. package/src/components/select/Select.stories.tsx +1 -1
  144. package/src/components/select/Select.test.tsx +8 -9
  145. package/src/components/select/Select.tsx +1 -1
  146. package/src/components/select/SelectMultiple.stories.tsx +1 -1
  147. package/src/components/select/SelectMultiple.test.tsx +5 -7
  148. package/src/components/select/SelectMultiple.tsx +1 -1
  149. package/src/components/select/WithSelectContext.tsx +1 -1
  150. package/src/components/select/constants.ts +1 -1
  151. package/src/components/side-navigation/SideNavigation.test.tsx +0 -2
  152. package/src/components/side-navigation/SideNavigation.tsx +1 -1
  153. package/src/components/side-navigation/SideNavigationItem.test.tsx +2 -4
  154. package/src/components/side-navigation/SideNavigationItem.tsx +23 -28
  155. package/src/components/skeleton/SkeletonCircle.test.tsx +0 -2
  156. package/src/components/skeleton/SkeletonCircle.tsx +0 -2
  157. package/src/components/skeleton/SkeletonRectangle.test.tsx +0 -2
  158. package/src/components/skeleton/SkeletonRectangle.tsx +0 -2
  159. package/src/components/skeleton/SkeletonTypography.stories.tsx +0 -2
  160. package/src/components/skeleton/SkeletonTypography.test.tsx +0 -2
  161. package/src/components/skeleton/SkeletonTypography.tsx +1 -1
  162. package/src/components/slider/Slider.test.tsx +1 -3
  163. package/src/components/slider/Slider.tsx +1 -1
  164. package/src/components/slideshow/Slideshow.stories.tsx +0 -1
  165. package/src/components/slideshow/Slideshow.test.tsx +0 -2
  166. package/src/components/slideshow/SlideshowControls.stories.tsx +0 -2
  167. package/src/components/slideshow/SlideshowItem.tsx +0 -2
  168. package/src/components/slideshow/useSlideFocusManagement.tsx +1 -1
  169. package/src/components/switch/Switch.test.tsx +5 -7
  170. package/src/components/switch/Switch.tsx +1 -1
  171. package/src/components/table/Table.test.tsx +0 -2
  172. package/src/components/table/Table.tsx +0 -2
  173. package/src/components/table/TableBody.test.tsx +0 -2
  174. package/src/components/table/TableBody.tsx +0 -2
  175. package/src/components/table/TableCell.test.tsx +1 -3
  176. package/src/components/table/TableCell.tsx +0 -2
  177. package/src/components/table/TableHeader.test.tsx +0 -2
  178. package/src/components/table/TableHeader.tsx +0 -2
  179. package/src/components/table/TableRow.test.tsx +0 -2
  180. package/src/components/table/TableRow.tsx +0 -2
  181. package/src/components/tabs/Tab.test.tsx +0 -2
  182. package/src/components/tabs/Tab.tsx +1 -1
  183. package/src/components/tabs/TabList.test.tsx +0 -2
  184. package/src/components/tabs/TabPanel.test.tsx +0 -2
  185. package/src/components/tabs/TabPanel.tsx +0 -2
  186. package/src/components/tabs/TabProvider.test.tsx +0 -2
  187. package/src/components/tabs/TabProvider.tsx +1 -1
  188. package/src/components/tabs/Tabs.stories.tsx +1 -1
  189. package/src/components/text/Text.stories.tsx +1 -1
  190. package/src/components/text/Text.test.tsx +0 -2
  191. package/src/components/text/Text.tsx +0 -2
  192. package/src/components/text-field/TextField.test.tsx +9 -10
  193. package/src/components/text-field/TextField.tsx +1 -1
  194. package/src/components/thumbnail/Thumbnail.test.tsx +29 -7
  195. package/src/components/thumbnail/Thumbnail.tsx +11 -11
  196. package/src/components/toolbar/Toolbar.tsx +1 -1
  197. package/src/components/tooltip/Tooltip.stories.tsx +2 -1
  198. package/src/components/tooltip/Tooltip.test.tsx +14 -8
  199. package/src/components/uploader/Uploader.test.tsx +2 -4
  200. package/src/components/user-block/UserBlock.stories.tsx +0 -2
  201. package/src/components/user-block/UserBlock.test.tsx +1 -3
  202. package/src/hooks/useId.test.tsx +0 -1
  203. package/src/hooks/useInfiniteScroll.tsx +1 -1
  204. package/src/hooks/usePreviousValue.ts +0 -1
  205. package/src/stories/decorators/withChromaticForceScreenSize.tsx +0 -1
  206. package/src/stories/decorators/withNestedProps.tsx +0 -1
  207. package/src/stories/decorators/withThemedBackground.tsx +0 -2
  208. package/src/stories/decorators/withWrapper.tsx +0 -2
  209. package/src/stories/utils/CustomLink.tsx +0 -1
  210. package/src/testing/utils/ThemeSentinel.tsx +0 -1
  211. package/src/untypped-modules.d.ts +4 -0
  212. package/src/utils/ClickAwayProvider/ClickAwayProvider.stories.jsx +1 -1
  213. package/src/utils/ClickAwayProvider/ClickAwayProvider.tsx +1 -1
  214. package/src/utils/MaterialThemeSwitcher/MaterialThemeSwitcher.tsx +1 -1
  215. package/src/utils/Portal/Portal.test.tsx +0 -1
  216. package/src/utils/Portal/PortalProvider.stories.jsx +0 -1
  217. package/src/utils/Portal/PortalProvider.test.tsx +1 -2
  218. package/src/utils/date/getYearDisplayName.test.ts +1 -1
  219. package/src/utils/disabled/DisabledStateProvider.stories.tsx +0 -2
  220. package/src/utils/disabled/useDisableStateProps.test.tsx +2 -2
  221. package/src/utils/react/OnBeforeUnmount.tsx +1 -1
  222. package/src/utils/react/RawClickable.test.tsx +153 -0
  223. package/src/utils/react/RawClickable.tsx +65 -0
  224. package/src/utils/react/skipRender.tsx +2 -2
  225. package/src/utils/react/wrapChildrenIconWithSpaces.test.tsx +1 -1
  226. package/src/utils/type/HasPolymorphicAs.ts +0 -2
  227. package/src/utils/type/HasRequiredLinkHref.ts +1 -0
  228. package/src/utils/type/index.ts +1 -0
  229. package/utils/index.d.ts +6 -6
  230. package/src/utils/react/renderButtonOrLink.tsx +0 -16
package/package.json CHANGED
@@ -6,14 +6,17 @@
6
6
  "url": "https://github.com/lumapps/design-system/issues"
7
7
  },
8
8
  "dependencies": {
9
- "@lumx/core": "^3.20.1-alpha.5",
10
- "@lumx/icons": "^3.20.1-alpha.5",
9
+ "@lumx/core": "^3.20.1-alpha.6",
10
+ "@lumx/icons": "^3.20.1-alpha.6",
11
11
  "@popperjs/core": "^2.5.4",
12
12
  "body-scroll-lock": "^3.1.5",
13
13
  "classnames": "^2.3.2",
14
14
  "react-is": ">=16.13.0",
15
15
  "react-popper": "^2.2.4"
16
16
  },
17
+ "installConfig": {
18
+ "hoistingLimits": "workspaces"
19
+ },
17
20
  "devDependencies": {
18
21
  "@babel/core": "^7.26.10",
19
22
  "@babel/plugin-proposal-class-properties": "^7.18.6",
@@ -34,20 +37,18 @@
34
37
  "@storybook/addon-a11y": "^9.1.4",
35
38
  "@storybook/addon-docs": "^9.1.4",
36
39
  "@storybook/react-vite": "^9.1.4",
37
- "@testing-library/dom": "^9.3.4",
38
- "@testing-library/jest-dom": "^5.16.4",
40
+ "@testing-library/dom": "^10.4.1",
39
41
  "@testing-library/react": "^12.1.2",
40
42
  "@testing-library/user-event": "^14.4.3",
41
43
  "@types/body-scroll-lock": "^2.6.1",
42
44
  "@types/classnames": "^2.2.9",
43
45
  "@types/dom-view-transitions": "^1.0.5",
44
- "@types/jest": "^29.2.1",
45
46
  "@types/lodash": "^4.14.149",
46
47
  "@types/react": "^17.0.2",
47
48
  "@types/react-dom": "^17.0.2",
48
49
  "@types/react-is": "^17.0.2",
50
+ "@vitest/ui": "^1.0.0",
49
51
  "autoprefixer": "^9.7.4",
50
- "babel-jest": "29.1.2",
51
52
  "babel-loader": "^8.0.6",
52
53
  "chromatic": "^13.1.4",
53
54
  "core-js": "^3.6.4",
@@ -55,8 +56,7 @@
55
56
  "glob": "^7.1.6",
56
57
  "install-peers-cli": "^2.2.0",
57
58
  "is-ci": "^2.0.0",
58
- "jest": "29.1.2",
59
- "jest-environment-jsdom": "29.1.2",
59
+ "jsdom": "^27.2.0",
60
60
  "node-notifier": "^10.0.1",
61
61
  "react": "^17.0.2",
62
62
  "react-dom": "^17.0.2",
@@ -71,12 +71,13 @@
71
71
  "typescript": "^5.4.3",
72
72
  "vite": "^6.3.5",
73
73
  "vite-tsconfig-paths": "^5.1.4",
74
+ "vitest": "^1.0.0",
74
75
  "yargs": "^15.4.1"
75
76
  },
76
77
  "peerDependencies": {
77
78
  "lodash": "4.17.21",
78
- "react": ">= 17.0.0",
79
- "react-dom": ">= 17.0.0"
79
+ "react": ">= 17.0.2",
80
+ "react-dom": ">= 17.0.2"
80
81
  },
81
82
  "description": "The official LumApps Design System (LumX) for React applications",
82
83
  "homepage": "https://github.com/lumapps/design-system",
@@ -101,10 +102,10 @@
101
102
  "scripts": {
102
103
  "build": "rollup -c",
103
104
  "prepare": "install-peers || exit 0",
104
- "test": "jest --config jest/index.js --coverage --notify --passWithNoTests --detectOpenHandles --runInBand",
105
+ "test": "vitest run",
105
106
  "start:storybook": "storybook dev -p 9000",
106
107
  "build:storybook": "storybook build"
107
108
  },
108
109
  "sideEffects": false,
109
- "version": "3.20.1-alpha.5"
110
+ "version": "3.20.1-alpha.6"
110
111
  }
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react-hooks/rules-of-hooks */
2
- import React, { RefObject, useRef } from 'react';
2
+ import { RefObject, useRef } from 'react';
3
3
  import { Button, Link, Kind } from '@lumx/react';
4
4
  import { DIALOG_TRANSITION_DURATION } from '@lumx/core/js/constants';
5
5
  import { useBooleanState } from '@lumx/react/hooks/useBooleanState';
@@ -1,11 +1,10 @@
1
- import React from 'react';
2
-
3
1
  import { commonTestsSuiteRTL } from '@lumx/react/testing/utils';
4
2
  import { queryByClassName } from '@lumx/react/testing/utils/queries';
5
3
  import { render } from '@testing-library/react';
4
+ import { vi } from 'vitest';
6
5
  import { AlertDialog, AlertDialogProps } from './AlertDialog';
7
6
 
8
- jest.mock('@lumx/react/hooks/useId', () => ({ useId: () => ':r1:' }));
7
+ vi.mock('@lumx/react/hooks/useId', () => ({ useId: () => ':r1:' }));
9
8
 
10
9
  const CLASSNAME = AlertDialog.className as string;
11
10
 
@@ -17,7 +16,7 @@ const setup = (propsOverride: Partial<AlertDialogProps> = {}) => {
17
16
  title: 'Alert',
18
17
  isOpen: true,
19
18
  description: 'Deserunt et sunt qui consequat sint sit.',
20
- confirmProps: { onClick: jest.fn(), label: 'OK' },
19
+ confirmProps: { onClick: vi.fn(), label: 'OK' },
21
20
  ...propsOverride,
22
21
  };
23
22
  render(<AlertDialog {...props} />);
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useRef, useState } from 'react';
1
+ import { useMemo, useRef, useState } from 'react';
2
2
 
3
3
  import { Autocomplete, List, ListItem, Size } from '@lumx/react';
4
4
 
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { Dropdown, List, ListItem, Size, TextField } from '@lumx/react';
4
2
  import { commonTestsSuiteRTL, SetupRenderOptions } from '@lumx/react/testing/utils';
5
3
  import { getByClassName, getByTagName, queryByClassName } from '@lumx/react/testing/utils/queries';
@@ -53,7 +51,7 @@ describe(`<${Autocomplete.displayName}>`, () => {
53
51
  describe('Events', () => {
54
52
  it('should trigger the onChange callback when there is a change on the Text Field', async () => {
55
53
  const name = 'autocomplete-name';
56
- const onChange = jest.fn();
54
+ const onChange = vi.fn();
57
55
  const { inputNative } = setup({
58
56
  name,
59
57
  onChange,
@@ -68,8 +66,8 @@ describe(`<${Autocomplete.displayName}>`, () => {
68
66
  });
69
67
 
70
68
  it('should trigger the onFocus/onBlur callback when the text field is focused and blurred', async () => {
71
- const onFocus = jest.fn();
72
- const onBlur = jest.fn();
69
+ const onFocus = vi.fn();
70
+ const onBlur = vi.fn();
73
71
  const { inputNative } = setup({
74
72
  onFocus,
75
73
  onBlur,
@@ -1,4 +1,4 @@
1
- import React, { ReactNode, SyntheticEvent, useRef } from 'react';
1
+ import { ReactNode, SyntheticEvent, useRef } from 'react';
2
2
 
3
3
  import classNames from 'classnames';
4
4
 
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useRef, useState } from 'react';
1
+ import { useMemo, useRef, useState } from 'react';
2
2
 
3
3
  import { AutocompleteMultiple, Chip, ChipGroup, Icon, List, ListItem, Size } from '@lumx/react';
4
4
 
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { Dropdown, List, ListItem, Size, TextField } from '@lumx/react';
4
2
  import { commonTestsSuiteRTL, SetupRenderOptions } from '@lumx/react/testing/utils';
5
3
  import { getByClassName, queryByClassName } from '@lumx/react/testing/utils/queries';
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
 
3
3
  import classNames from 'classnames';
4
4
 
@@ -1,6 +1,4 @@
1
1
  /* eslint-disable react/display-name */
2
- import React from 'react';
3
-
4
2
  import { mdiDelete, mdiEye, mdiPencil, mdiStar } from '@lumx/icons';
5
3
  import { AvatarSize, Badge, ColorPalette, FlexBox, Icon, IconButton, Size } from '@lumx/react';
6
4
  import { avatarImageArgType, AVATAR_IMAGES } from '@lumx/react/stories/controls/image';
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { commonTestsSuiteRTL, SetupRenderOptions } from '@lumx/react/testing/utils';
4
2
  import { render } from '@testing-library/react';
5
3
  import { queryByClassName } from '@lumx/react/testing/utils/queries';
@@ -1,4 +1,4 @@
1
- import React, { KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode } from 'react';
1
+ import { KeyboardEventHandler, MouseEventHandler, ReactElement, ReactNode } from 'react';
2
2
 
3
3
  import classNames from 'classnames';
4
4
 
@@ -1,6 +1,5 @@
1
1
  import { mdiHeart } from '@lumx/icons';
2
2
  import { AspectRatio, Badge, ColorPalette, Icon, Size, Thumbnail, ThumbnailVariant } from '@lumx/react';
3
- import React from 'react';
4
3
  import { colorArgType } from '@lumx/react/stories/controls/color';
5
4
  import { withCombinations } from '@lumx/react/stories/decorators/withCombinations';
6
5
  import { withUndefined } from '@lumx/react/stories/controls/withUndefined';
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { ColorPalette } from '@lumx/react';
4
2
  import { commonTestsSuiteRTL } from '@lumx/react/testing/utils';
5
3
  import { getByClassName } from '@lumx/react/testing/utils/queries';
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
 
3
3
  import classNames from 'classnames';
4
4
 
@@ -1,6 +1,5 @@
1
1
  import { mdiAccount, mdiBee, mdiHeart } from '@lumx/icons';
2
2
  import { Badge, BadgeWrapper, Button, Chip, ColorPalette, FlexBox, Icon, Orientation, Size } from '@lumx/react';
3
- import React from 'react';
4
3
 
5
4
  export default {
6
5
  title: 'LumX components/badge/BadgeWrapper',
@@ -1,6 +1,4 @@
1
1
  import { commonTestsSuiteRTL } from '@lumx/react/testing/utils';
2
- import React from 'react';
3
-
4
2
  import omit from 'lodash/omit';
5
3
  import last from 'lodash/last';
6
4
 
@@ -1,4 +1,4 @@
1
- import React, { ReactElement, ReactNode } from 'react';
1
+ import { ReactElement, ReactNode } from 'react';
2
2
 
3
3
  import classNames from 'classnames';
4
4
 
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import omit from 'lodash/omit';
3
2
  import pick from 'lodash/pick';
4
3
 
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { mdiCheck, mdiPlus } from '@lumx/icons';
4
2
  import { commonTestsSuiteRTL, SetupRenderOptions } from '@lumx/react/testing/utils';
5
3
  import { render, screen, within } from '@testing-library/react';
@@ -68,7 +66,7 @@ describe(`<${Button.displayName}>`, () => {
68
66
 
69
67
  describe('Disabled state', () => {
70
68
  it('should render disabled button', async () => {
71
- const onClick = jest.fn();
69
+ const onClick = vi.fn();
72
70
  const { button } = setup({ children: 'Label', disabled: true, onClick });
73
71
  expect(button).toHaveAttribute('disabled');
74
72
  await userEvent.click(button);
@@ -76,17 +74,18 @@ describe(`<${Button.displayName}>`, () => {
76
74
  });
77
75
 
78
76
  it('should render disabled link', async () => {
79
- const onClick = jest.fn();
77
+ const onClick = vi.fn();
80
78
  const { button } = setup({ children: 'Label', disabled: true, href: 'https://example.com', onClick });
81
- // Disabled link do not exist so we fallback to a button
82
- expect(screen.queryByRole('link')).not.toBeInTheDocument();
83
- expect(button).toHaveAttribute('disabled');
79
+ expect(screen.queryByRole('link')).toBeInTheDocument();
80
+ expect(button).toHaveAttribute('aria-disabled', 'true');
81
+ // Simulate standard disabled state (not focusable)
82
+ expect(button).toHaveAttribute('tabindex', '-1');
84
83
  await userEvent.click(button);
85
84
  expect(onClick).not.toHaveBeenCalled();
86
85
  });
87
86
 
88
87
  it('should render aria-disabled button', async () => {
89
- const onClick = jest.fn();
88
+ const onClick = vi.fn();
90
89
  const { button } = setup({ children: 'Label', 'aria-disabled': true, onClick });
91
90
  expect(button).toHaveAttribute('aria-disabled');
92
91
  await userEvent.click(button);
@@ -94,7 +93,7 @@ describe(`<${Button.displayName}>`, () => {
94
93
  });
95
94
 
96
95
  it('should render aria-disabled link', async () => {
97
- const onClick = jest.fn();
96
+ const onClick = vi.fn();
98
97
  const { button } = setup({
99
98
  children: 'Label',
100
99
  'aria-disabled': true,
@@ -102,8 +101,7 @@ describe(`<${Button.displayName}>`, () => {
102
101
  onClick,
103
102
  });
104
103
  expect(button).toHaveAccessibleName('Label');
105
- // Disabled link do not exist so we fallback to a button
106
- expect(screen.queryByRole('link')).not.toBeInTheDocument();
104
+ expect(screen.queryByRole('link')).toBeInTheDocument();
107
105
  expect(button).toHaveAttribute('aria-disabled', 'true');
108
106
  await userEvent.click(button);
109
107
  expect(onClick).not.toHaveBeenCalled();
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import classNames from 'classnames';
4
2
  import isEmpty from 'lodash/isEmpty';
5
3
 
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { Button, ButtonGroup, Emphasis, IconButton, Size } from '@lumx/react';
4
2
  import { mdiAbjadArabic, mdiFoodApple, mdiMenuDown } from '@lumx/icons';
5
3
  import { withCombinations } from '@lumx/react/stories/decorators/withCombinations';
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { mdiPlus } from '@lumx/icons';
4
2
  import { Button, IconButton } from '@lumx/react';
5
3
  import { commonTestsSuiteRTL } from '@lumx/react/testing/utils';
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import classNames from 'classnames';
4
2
 
5
3
  import { GenericProps } from '@lumx/react/utils/type';
@@ -1,6 +1,4 @@
1
- import React, { AriaAttributes, ButtonHTMLAttributes, DetailedHTMLProps, RefObject } from 'react';
2
-
3
- import isEmpty from 'lodash/isEmpty';
1
+ import { AriaAttributes, ButtonHTMLAttributes, DetailedHTMLProps, RefObject } from 'react';
4
2
 
5
3
  import classNames from 'classnames';
6
4
 
@@ -8,10 +6,10 @@ import { ColorPalette, Emphasis, Size, Theme } from '@lumx/react';
8
6
  import { CSS_PREFIX } from '@lumx/react/constants';
9
7
  import { GenericProps, HasTheme } from '@lumx/react/utils/type';
10
8
  import { handleBasicClasses } from '@lumx/core/js/utils/className';
11
- import { renderLink } from '@lumx/react/utils/react/renderLink';
12
9
  import { forwardRef } from '@lumx/react/utils/react/forwardRef';
13
- import { useDisableStateProps } from '@lumx/react/utils/disabled/useDisableStateProps';
14
10
  import { HasAriaDisabled } from '@lumx/react/utils/type/HasAriaDisabled';
11
+ import { RawClickable } from '@lumx/react/utils/react/RawClickable';
12
+ import { useDisableStateProps } from '@lumx/react/utils/disabled';
15
13
 
16
14
  type HTMLButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
17
15
 
@@ -107,18 +105,14 @@ export const ButtonRoot = forwardRef<ButtonRootProps, HTMLButtonElement | HTMLAn
107
105
  color,
108
106
  emphasis,
109
107
  hasBackground,
110
- href,
111
108
  isSelected,
112
109
  isActive,
113
110
  isFocused,
114
111
  isHovered,
115
112
  linkAs,
116
- name,
117
113
  size,
118
- target,
119
114
  theme,
120
115
  variant,
121
- type = 'button',
122
116
  fullWidth,
123
117
  ...forwardedProps
124
118
  } = otherProps;
@@ -139,7 +133,7 @@ export const ButtonRoot = forwardRef<ButtonRootProps, HTMLButtonElement | HTMLAn
139
133
  color: adaptedColor,
140
134
  emphasis,
141
135
  isSelected,
142
- isDisabled: isAnyDisabled,
136
+ isDisabled: props.isDisabled || props['aria-disabled'],
143
137
  isActive,
144
138
  isFocused,
145
139
  isHovered,
@@ -151,42 +145,18 @@ export const ButtonRoot = forwardRef<ButtonRootProps, HTMLButtonElement | HTMLAn
151
145
  }),
152
146
  );
153
147
 
154
- /**
155
- * If the linkAs prop is used, we use the linkAs component instead of a <button>.
156
- * If there is an href attribute, we display an <a> instead of a <button>.
157
- *
158
- * However, in any case, if the component is disabled, we returned a <button> since disabled is not compatible with <a>.
159
- */
160
- if ((linkAs || !isEmpty(props.href)) && !isAnyDisabled) {
161
- return renderLink(
162
- {
163
- linkAs,
164
- ...forwardedProps,
165
- 'aria-label': ariaLabel,
166
- href,
167
- target,
168
- className: buttonClassName,
169
- ref: ref as RefObject<HTMLAnchorElement>,
170
- },
171
- children,
172
- );
173
- }
174
148
  return (
175
- <button
149
+ <RawClickable
150
+ as={linkAs || (forwardedProps.href ? 'a' : 'button')}
176
151
  {...forwardedProps}
177
152
  {...disabledStateProps}
178
153
  aria-disabled={isAnyDisabled}
179
154
  aria-label={ariaLabel}
180
155
  ref={ref as RefObject<HTMLButtonElement>}
181
156
  className={buttonClassName}
182
- name={name}
183
- type={
184
- // eslint-disable-next-line react/button-has-type
185
- type
186
- }
187
157
  >
188
158
  {children}
189
- </button>
159
+ </RawClickable>
190
160
  );
191
161
  });
192
162
  ButtonRoot.displayName = COMPONENT_NAME;
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { commonTestsSuiteRTL, SetupRenderOptions } from '@lumx/react/testing/utils';
4
2
  import { Button } from '@lumx/react';
5
3
  import { render, screen } from '@testing-library/react';
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { Emphasis, Icon, Size, Theme, ThemeProvider, Tooltip, TooltipProps } from '@lumx/react';
4
2
  import { BaseButtonProps, ButtonRoot } from '@lumx/react/components/button/ButtonRoot';
5
3
  import { getRootClassName } from '@lumx/core/js/utils/className';
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { commonTestsSuiteRTL, SetupRenderOptions } from '@lumx/react/testing/utils';
4
2
 
5
3
  import { getByClassName, getByTagName, queryByClassName } from '@lumx/react/testing/utils/queries';
@@ -98,7 +96,7 @@ describe(`<${Checkbox.displayName}>`, () => {
98
96
  });
99
97
 
100
98
  describe('Events', () => {
101
- const onChange = jest.fn();
99
+ const onChange = vi.fn();
102
100
 
103
101
  it('should trigger `onChange` when checkbox is clicked', async () => {
104
102
  const value = 'value';
@@ -114,7 +112,7 @@ describe(`<${Checkbox.displayName}>`, () => {
114
112
 
115
113
  describe('Disabled state', () => {
116
114
  it('should be disabled with isDisabled', async () => {
117
- const onChange = jest.fn();
115
+ const onChange = vi.fn();
118
116
  const { checkbox, input } = setup({ isDisabled: true, onChange });
119
117
 
120
118
  expect(checkbox).toHaveClass('lumx-checkbox--is-disabled');
@@ -126,7 +124,7 @@ describe(`<${Checkbox.displayName}>`, () => {
126
124
  });
127
125
 
128
126
  it('should be disabled with aria-disabled', async () => {
129
- const onChange = jest.fn();
127
+ const onChange = vi.fn();
130
128
  const { checkbox, input } = setup({ 'aria-disabled': true, onChange });
131
129
 
132
130
  expect(checkbox).toHaveClass('lumx-checkbox--is-disabled');
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import omit from 'lodash/omit';
4
2
  import { mdiClose, mdiViewList } from '@lumx/icons';
5
3
  import { Chip, ChipProps, ColorPalette, Icon, Size, Theme } from '@lumx/react';
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { Theme } from '@lumx/react';
4
2
  import { commonTestsSuiteRTL, SetupRenderOptions } from '@lumx/react/testing/utils';
5
3
  import { fireEvent, render, screen } from '@testing-library/react';
@@ -42,7 +40,7 @@ describe('<Chip />', () => {
42
40
  });
43
41
 
44
42
  it('should render clickable', () => {
45
- const onClick = jest.fn();
43
+ const onClick = vi.fn();
46
44
  const { chip } = setup({ children: 'Chip text', onClick });
47
45
  expect(chip).toHaveAttribute('role', 'button');
48
46
  expect(chip.className).toMatchInlineSnapshot(
@@ -70,11 +68,13 @@ describe('<Chip />', () => {
70
68
  });
71
69
 
72
70
  describe('Events', () => {
73
- const onClick = jest.fn();
74
- const onAfterClick = jest.fn();
75
- const onBeforeClick = jest.fn();
71
+ const onClick = vi.fn();
72
+ const onAfterClick = vi.fn();
73
+ const onBeforeClick = vi.fn();
76
74
 
77
- beforeEach(jest.clearAllMocks);
75
+ beforeEach(() => {
76
+ vi.clearAllMocks();
77
+ });
78
78
 
79
79
  it('should trigger onBeforeClick only when clicking on the "before" element', async () => {
80
80
  const { after, before, chip } = setup({
@@ -88,12 +88,12 @@ describe('<Chip />', () => {
88
88
  await userEvent.click(chip);
89
89
  expect(onBeforeClick).not.toHaveBeenCalled();
90
90
 
91
- jest.clearAllMocks();
91
+ vi.clearAllMocks();
92
92
 
93
93
  await userEvent.click(after as any);
94
94
  expect(onBeforeClick).not.toHaveBeenCalled();
95
95
 
96
- jest.clearAllMocks();
96
+ vi.clearAllMocks();
97
97
 
98
98
  await userEvent.click(before as any);
99
99
  expect(onBeforeClick).toHaveBeenCalled();
@@ -111,12 +111,12 @@ describe('<Chip />', () => {
111
111
  await userEvent.click(chip);
112
112
  expect(onClick).toHaveBeenCalled();
113
113
 
114
- jest.clearAllMocks();
114
+ vi.clearAllMocks();
115
115
 
116
116
  await userEvent.click(after as any);
117
117
  expect(onClick).not.toHaveBeenCalled();
118
118
 
119
- jest.clearAllMocks();
119
+ vi.clearAllMocks();
120
120
 
121
121
  await userEvent.click(before as any);
122
122
  expect(onClick).not.toHaveBeenCalled();
@@ -134,12 +134,12 @@ describe('<Chip />', () => {
134
134
  await userEvent.click(chip);
135
135
  expect(onAfterClick).not.toHaveBeenCalled();
136
136
 
137
- jest.clearAllMocks();
137
+ vi.clearAllMocks();
138
138
 
139
139
  await userEvent.click(after as any);
140
140
  expect(onAfterClick).toHaveBeenCalled();
141
141
 
142
- jest.clearAllMocks();
142
+ vi.clearAllMocks();
143
143
 
144
144
  await userEvent.click(before as any);
145
145
  expect(onAfterClick).not.toHaveBeenCalled();
@@ -162,7 +162,7 @@ describe('<Chip />', () => {
162
162
  });
163
163
 
164
164
  it('should forward key down event', async () => {
165
- const onKeyDown = jest.fn();
165
+ const onKeyDown = vi.fn();
166
166
  const { chip } = setup({ onClick, onKeyDown });
167
167
 
168
168
  fireEvent.keyDown(chip, { key: 'A', code: 'KeyA' });
@@ -171,7 +171,7 @@ describe('<Chip />', () => {
171
171
 
172
172
  it('should forward key down event and trigger `onClick` when pressing Enter', async () => {
173
173
  const user = userEvent.setup();
174
- const onKeyDown = jest.fn();
174
+ const onKeyDown = vi.fn();
175
175
  const { chip } = setup({ onClick, onKeyDown });
176
176
 
177
177
  await user.tab();
@@ -187,7 +187,7 @@ describe('<Chip />', () => {
187
187
 
188
188
  describe('Disabled state', () => {
189
189
  it('should render disabled chip button', async () => {
190
- const onClick = jest.fn();
190
+ const onClick = vi.fn();
191
191
  const { chip } = setup({ children: 'Label', isDisabled: true, onClick });
192
192
  expect(chip).toHaveAttribute('aria-disabled', 'true');
193
193
  await userEvent.click(chip);
@@ -195,7 +195,7 @@ describe('<Chip />', () => {
195
195
  });
196
196
 
197
197
  it('should render disabled chip link', async () => {
198
- const onClick = jest.fn();
198
+ const onClick = vi.fn();
199
199
  const { chip } = setup({ children: 'Label', isDisabled: true, href: 'https://example.com', onClick });
200
200
  // Disabled link should not have an href.
201
201
  expect(chip).not.toHaveAttribute('href');
@@ -205,7 +205,7 @@ describe('<Chip />', () => {
205
205
  });
206
206
 
207
207
  it('should render aria-disabled chip button', async () => {
208
- const onClick = jest.fn();
208
+ const onClick = vi.fn();
209
209
  const { chip } = setup({ children: 'Label', 'aria-disabled': true, onClick });
210
210
  expect(chip).toHaveAttribute('aria-disabled', 'true');
211
211
  await userEvent.click(chip);
@@ -214,7 +214,7 @@ describe('<Chip />', () => {
214
214
  });
215
215
 
216
216
  it('should render aria-disabled chip link', async () => {
217
- const onClick = jest.fn();
217
+ const onClick = vi.fn();
218
218
  const { chip } = setup({
219
219
  children: 'Label',
220
220
  'aria-disabled': true,
@@ -1,4 +1,4 @@
1
- import React, { MouseEventHandler, ReactNode } from 'react';
1
+ import { MouseEventHandler, ReactNode } from 'react';
2
2
 
3
3
  import classNames from 'classnames';
4
4
  import isFunction from 'lodash/isFunction';
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { Chip, ChipGroup, Size } from '@lumx/react';
4
2
 
5
3
  export default {
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import { render } from '@testing-library/react';
4
2
  import { getByClassName } from '@lumx/react/testing/utils/queries';
5
3
  import { commonTestsSuiteRTL } from '@lumx/react/testing/utils';
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
 
3
3
  import classNames from 'classnames';
4
4
 
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable react/jsx-key,react/display-name */
2
- import React from 'react';
3
2
  import { mdiDotsHorizontal, mdiHeart, mdiReply } from '@lumx/icons';
4
3
  import { Button, CommentBlock } from '@lumx/react';
5
4
  import { IconButton } from '@lumx/react/components/button/IconButton';