@atlaskit/menu 2.13.8 → 2.14.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/menu
2
2
 
3
+ ## 2.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#109060](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/109060)
8
+ [`4660ec858a305`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4660ec858a305) -
9
+ Update `React` from v16 to v18
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 2.13.8
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "2.13.8",
3
+ "version": "2.14.0",
4
4
  "description": "A list of options to help users navigate, or perform actions.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -41,14 +41,14 @@
41
41
  }
42
42
  },
43
43
  "dependencies": {
44
- "@atlaskit/app-provider": "^1.5.0",
45
- "@atlaskit/ds-lib": "^3.3.0",
46
- "@atlaskit/focus-ring": "^2.0.0",
47
- "@atlaskit/interaction-context": "^2.4.0",
44
+ "@atlaskit/app-provider": "^1.8.0",
45
+ "@atlaskit/ds-lib": "^3.5.0",
46
+ "@atlaskit/focus-ring": "^2.1.0",
47
+ "@atlaskit/interaction-context": "^2.6.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
- "@atlaskit/primitives": "^13.3.0",
50
- "@atlaskit/theme": "^14.0.0",
51
- "@atlaskit/tokens": "^3.0.0",
49
+ "@atlaskit/primitives": "^13.4.0",
50
+ "@atlaskit/theme": "^14.1.0",
51
+ "@atlaskit/tokens": "^3.3.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "@emotion/react": "^11.7.1"
54
54
  },
@@ -64,7 +64,7 @@
64
64
  "@atlassian/feature-flags-test-utils": "*",
65
65
  "@emotion/jest": "^11.8.0",
66
66
  "@testing-library/dom": "^10.1.0",
67
- "@testing-library/react": "^12.1.5",
67
+ "@testing-library/react": "^13.4.0",
68
68
  "ast-types": "^0.13.3",
69
69
  "bind-event-listener": "^3.0.0",
70
70
  "jscodeshift": "^0.13.0",
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
-
3
- import ButtonItem from '../src/menu-item/button-item';
4
-
5
- import Example from './utils/example-runner';
6
- import { interactionTasks } from './utils/interaction-tasks';
7
-
8
- const buttonItem = () => <Example Component={ButtonItem} displayName="Button item" />;
9
-
10
- buttonItem.story = {
11
- name: 'Button Item',
12
- parameters: {
13
- performance: {
14
- interactions: interactionTasks,
15
- },
16
- },
17
- };
18
-
19
- export default buttonItem;
@@ -1,30 +0,0 @@
1
- import React, { type Ref } from 'react';
2
-
3
- import CustomItem from '../src/menu-item/custom-item';
4
- import type { CustomItemComponentProps, CustomItemProps } from '../src/types';
5
-
6
- import Example from './utils/example-runner';
7
- import { interactionTasks } from './utils/interaction-tasks';
8
-
9
- const Emphasis = React.forwardRef((props: CustomItemComponentProps, ref: Ref<HTMLElement>) => (
10
- <em {...props} ref={ref} />
11
- ));
12
-
13
- const CustomItemEmphasis = React.forwardRef(
14
- (props: CustomItemProps, ref: Ref<HTMLElement | null>) => {
15
- return <CustomItem component={Emphasis} {...props} ref={ref} />;
16
- },
17
- );
18
-
19
- const customItem = () => <Example Component={CustomItemEmphasis} displayName="Custom item" />;
20
-
21
- customItem.story = {
22
- name: 'Custom Item',
23
- parameters: {
24
- performance: {
25
- interactions: interactionTasks,
26
- },
27
- },
28
- };
29
-
30
- export default customItem;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
-
3
- import { SkeletonItem } from '../src';
4
-
5
- export default () => <SkeletonItem />;
package/__perf__/link.tsx DELETED
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
-
3
- import LinkItem from '../src/menu-item/link-item';
4
-
5
- import Example from './utils/example-runner';
6
- import { interactionTasks } from './utils/interaction-tasks';
7
-
8
- const linkItem = () => <Example Component={LinkItem} displayName="Link item" />;
9
-
10
- linkItem.story = {
11
- name: 'Link Item',
12
- parameters: {
13
- performance: {
14
- interactions: interactionTasks,
15
- },
16
- },
17
- };
18
-
19
- export default linkItem;
@@ -1,50 +0,0 @@
1
- import React, { useLayoutEffect, useRef, useState } from 'react';
2
-
3
- import { bindAll } from 'bind-event-listener';
4
-
5
- type ItemComponentProps =
6
- | React.ComponentType<React.AllHTMLAttributes<HTMLElement>>
7
- | React.ElementType;
8
-
9
- export default function Example({
10
- Component,
11
- displayName,
12
- }: {
13
- Component: ItemComponentProps;
14
- displayName: string;
15
- }) {
16
- const [isSelected, setIsSelected] = useState<boolean>(false);
17
- const [isDisabled, setIsDisabled] = useState<boolean>(false);
18
- const ref = useRef<HTMLElement>(null);
19
-
20
- useLayoutEffect(() => {
21
- function toggleSelect() {
22
- setIsSelected((value) => !value);
23
- }
24
- function toggleDisabled() {
25
- setIsDisabled((value) => !value);
26
- }
27
-
28
- const el: HTMLElement | null = ref.current;
29
- if (!el) {
30
- throw new Error('Could not find button ref');
31
- }
32
-
33
- return bindAll(el, [
34
- {
35
- type: 'toggle-select',
36
- listener: toggleSelect,
37
- },
38
- {
39
- type: 'toggle-disabled',
40
- listener: toggleDisabled,
41
- },
42
- ]);
43
- }, []);
44
-
45
- return (
46
- <Component ref={ref} testId="menu-item" isSelected={isSelected} isDisabled={isDisabled}>
47
- {displayName}
48
- </Component>
49
- );
50
- }
@@ -1,76 +0,0 @@
1
- import { fireEvent } from '@testing-library/dom';
2
- import { type InteractionTaskArgs, type PublicInteractionTask } from 'storybook-addon-performance';
3
-
4
- export const interactionTasks: PublicInteractionTask[] = [
5
- {
6
- name: 'Click a menu item',
7
- description: 'Recording how long a mousedown + click event take to be processed',
8
- run: async ({ container }: InteractionTaskArgs): Promise<void> => {
9
- const menuItem: HTMLElement | null = container.querySelector('[data-testid="menu-item"]');
10
- if (menuItem == null) {
11
- throw new Error('Could not find a menu item element');
12
- }
13
-
14
- fireEvent.mouseDown(menuItem);
15
- fireEvent.click(menuItem);
16
- },
17
- },
18
- {
19
- name: 'Focus on a menu item',
20
- description: 'Focus on a menu item and wait for layout and paint to finish',
21
- run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
22
- const menuItem: HTMLElement | null = container.querySelector('[data-testid="menu-item"]');
23
- if (menuItem == null) {
24
- throw new Error('Could not find a menu item element');
25
- }
26
-
27
- await controls.time(async () => {
28
- fireEvent.focus(menuItem);
29
- fireEvent.blur(menuItem);
30
- });
31
- },
32
- },
33
- {
34
- name: 'Select a menu item',
35
- description: 'Trigger the selection of a menu item',
36
- run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
37
- const menuItem: HTMLElement | null = container.querySelector('[data-testid="menu-item"]');
38
-
39
- if (menuItem == null) {
40
- throw new Error('Could not find a menu item element');
41
- }
42
-
43
- await controls.time(async () => {
44
- fireEvent(menuItem, new Event('toggle-select'));
45
- });
46
- },
47
- },
48
- {
49
- name: 'Disable a menu item',
50
- description: 'Trigger the disabling of a menu item',
51
- run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
52
- const menuItem: HTMLElement | null = container.querySelector('[data-testid="menu-item"]');
53
- if (menuItem == null) {
54
- throw new Error('Could not find a menu item element');
55
- }
56
-
57
- const beforeState =
58
- menuItem.getAttribute('aria-disabled') || menuItem.getAttribute('disabled');
59
-
60
- if (beforeState === 'true') {
61
- throw new Error('Should not be disabled before the test begins');
62
- }
63
-
64
- await controls.time(async () => {
65
- fireEvent(menuItem!, new Event('toggle-disabled'));
66
- });
67
-
68
- const afterState =
69
- menuItem.getAttribute('aria-disabled') || menuItem.getAttribute('disabled');
70
-
71
- if (afterState === 'false') {
72
- throw new Error('Should be disabled after the test finished');
73
- }
74
- },
75
- },
76
- ];