@atlaskit/menu 1.3.4 → 1.3.7

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,24 @@
1
1
  # @atlaskit/menu
2
2
 
3
+ ## 1.3.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8a5bdb3c844`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8a5bdb3c844) - Upgrading internal dependency (bind-event-listener) for improved internal types
8
+
9
+ ## 1.3.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [`c8145459eb5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c8145459eb5) - [ux] Updating skeleton token in @atlakist/menu, @atlaskit/theme
14
+ - Updated dependencies
15
+
16
+ ## 1.3.5
17
+
18
+ ### Patch Changes
19
+
20
+ - [`efa50ac72ba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/efa50ac72ba) - Adjusts jsdoc strings to improve prop documentation
21
+
3
22
  ## 1.3.4
4
23
 
5
24
  ### Patch Changes
@@ -1,5 +1,7 @@
1
1
  import React, { useLayoutEffect, useRef, useState } from 'react';
2
2
 
3
+ import { bindAll } from 'bind-event-listener';
4
+
3
5
  type ItemComponentProps =
4
6
  | React.ComponentType<React.AllHTMLAttributes<HTMLElement>>
5
7
  | React.ElementType;
@@ -28,13 +30,16 @@ export default function Example({
28
30
  throw new Error('Could not find button ref');
29
31
  }
30
32
 
31
- el.addEventListener('toggle-select', toggleSelect);
32
- el.addEventListener('toggle-disabled', toggleDisabled);
33
-
34
- return () => {
35
- el.removeEventListener('toggle-select', toggleSelect);
36
- el.removeEventListener('toggle-disabled', toggleDisabled);
37
- };
33
+ return bindAll(el, [
34
+ {
35
+ type: 'toggle-select',
36
+ listener: toggleSelect,
37
+ },
38
+ {
39
+ type: 'toggle-disabled',
40
+ listener: toggleDisabled,
41
+ },
42
+ ]);
38
43
  }, []);
39
44
 
40
45
  return (
@@ -11,26 +11,18 @@ var _colors = require("@atlaskit/theme/colors");
11
11
 
12
12
  /** @jsx jsx */
13
13
 
14
- /**
15
- * This color is mirrored in:
16
- * packages/design-system/theme/src/colors.tsx
17
- *
18
- * Please update both.
19
- */
20
- var skeletonColor = "var(--ds-background-neutral, ".concat(_colors.N20A, ")");
21
14
  /**
22
15
  * These keyframes are mirrored in:
23
16
  * packages/design-system/theme/src/constants.tsx
24
17
  *
25
18
  * Please update both.
26
19
  */
27
-
28
20
  var shimmerKeyframes = (0, _core.keyframes)({
29
21
  from: {
30
- backgroundColor: "var(--ds-background-neutral, ".concat(skeletonColor, ")")
22
+ backgroundColor: "var(--ds-skeleton, ".concat(_colors.N20A, ")")
31
23
  },
32
24
  to: {
33
- backgroundColor: "var(--ds-background-neutral-hovered, ".concat(_colors.N30A, ")")
25
+ backgroundColor: "var(--ds-skeleton-subtle, ".concat(_colors.N30A, ")")
34
26
  }
35
27
  });
36
28
  /**
@@ -47,7 +39,7 @@ var shimmerStyles = (0, _core.css)({
47
39
  animationIterationCount: 'infinite',
48
40
  animationName: "".concat(shimmerKeyframes),
49
41
  animationTimingFunction: 'linear',
50
- backgroundColor: "var(--ds-background-neutral, ".concat(skeletonColor, ")")
42
+ backgroundColor: "var(--ds-skeleton, ".concat(_colors.N20A, ")")
51
43
  }
52
44
  });
53
45
  /**
@@ -24,7 +24,7 @@ var skeletonStyles = (0, _core.css)({
24
24
  display: 'block',
25
25
  width: '30%',
26
26
  height: (0, _constants.gridSize)(),
27
- backgroundColor: "var(--ds-background-neutral, ".concat((0, _colors.skeleton)(), ")"),
27
+ backgroundColor: "var(--ds-skeleton, ".concat(_colors.N20A, ")"),
28
28
  borderRadius: 100,
29
29
  content: '""'
30
30
  }
@@ -28,7 +28,7 @@ var skeletonItemElemSize = gridSize * 2.5;
28
28
  var itemElemSkeletonOffset = (itemExpectedElemSize - skeletonItemElemSize) / 2;
29
29
  var skeletonTextBorderRadius = 100;
30
30
  var skeletonContentHeight = 9;
31
- var skeletonColor = "var(--ds-background-neutral, ".concat((0, _colors.skeleton)(), ")");
31
+ var skeletonColor = "var(--ds-skeleton, ".concat(_colors.N20A, ")");
32
32
  var skeletonStyles = (0, _core.css)({
33
33
  display: 'flex',
34
34
  minHeight: itemMinHeight,
@@ -76,7 +76,7 @@ var unscrollableStyles = (0, _core.css)({
76
76
  flexShrink: 0
77
77
  });
78
78
  var separatorStyles = (0, _core.css)({
79
- borderTop: "2px solid var(".concat(VAR_SEPARATOR_COLOR, ", ").concat("var(--ds-border, ".concat(_colors.N30A, ")"), ")")
79
+ borderTop: "2px solid var(".concat(VAR_SEPARATOR_COLOR, ", ", "var(--ds-border, ".concat(_colors.N30A, ")"), ")")
80
80
  });
81
81
  var noSeparatorStyles = (0, _core.css)({
82
82
  // this is to ensure that adjacent sections without separators don't get additional margins.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.3.4",
3
+ "version": "1.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -2,26 +2,18 @@
2
2
  import { ClassNames, css, jsx, keyframes } from '@emotion/core';
3
3
  import { N20A, N30A } from '@atlaskit/theme/colors';
4
4
 
5
- /**
6
- * This color is mirrored in:
7
- * packages/design-system/theme/src/colors.tsx
8
- *
9
- * Please update both.
10
- */
11
- const skeletonColor = `var(--ds-background-neutral, ${N20A})`;
12
5
  /**
13
6
  * These keyframes are mirrored in:
14
7
  * packages/design-system/theme/src/constants.tsx
15
8
  *
16
9
  * Please update both.
17
10
  */
18
-
19
11
  const shimmerKeyframes = keyframes({
20
12
  from: {
21
- backgroundColor: `var(--ds-background-neutral, ${skeletonColor})`
13
+ backgroundColor: `var(--ds-skeleton, ${N20A})`
22
14
  },
23
15
  to: {
24
- backgroundColor: `var(--ds-background-neutral-hovered, ${N30A})`
16
+ backgroundColor: `var(--ds-skeleton-subtle, ${N30A})`
25
17
  }
26
18
  });
27
19
  /**
@@ -38,7 +30,7 @@ const shimmerStyles = css({
38
30
  animationIterationCount: 'infinite',
39
31
  animationName: `${shimmerKeyframes}`,
40
32
  animationTimingFunction: 'linear',
41
- backgroundColor: `var(--ds-background-neutral, ${skeletonColor})`
33
+ backgroundColor: `var(--ds-skeleton, ${N20A})`
42
34
  }
43
35
  });
44
36
  /**
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/core';
3
3
  import noop from '@atlaskit/ds-lib/noop';
4
- import { skeleton as skeletonColorFn } from '@atlaskit/theme/colors';
4
+ import { N20A } from '@atlaskit/theme/colors';
5
5
  import { gridSize } from '@atlaskit/theme/constants';
6
6
  import SkeletonShimmer from '../internal/components/skeleton-shimmer';
7
7
  const skeletonStyles = css({
@@ -10,7 +10,7 @@ const skeletonStyles = css({
10
10
  display: 'block',
11
11
  width: '30%',
12
12
  height: gridSize(),
13
- backgroundColor: `var(--ds-background-neutral, ${skeletonColorFn()})`,
13
+ backgroundColor: `var(--ds-skeleton, ${N20A})`,
14
14
  borderRadius: 100,
15
15
  content: '""'
16
16
  }
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/core';
3
3
  import noop from '@atlaskit/ds-lib/noop';
4
- import { skeleton as skeletonColorFn } from '@atlaskit/theme/colors';
4
+ import { N20A } from '@atlaskit/theme/colors';
5
5
  import { borderRadius as borderRadiusFn, gridSize as gridSizeFn } from '@atlaskit/theme/constants';
6
6
  import SkeletonShimmer from '../internal/components/skeleton-shimmer';
7
7
  const gridSize = gridSizeFn();
@@ -14,7 +14,7 @@ const skeletonItemElemSize = gridSize * 2.5;
14
14
  const itemElemSkeletonOffset = (itemExpectedElemSize - skeletonItemElemSize) / 2;
15
15
  const skeletonTextBorderRadius = 100;
16
16
  const skeletonContentHeight = 9;
17
- const skeletonColor = `var(--ds-background-neutral, ${skeletonColorFn()})`;
17
+ const skeletonColor = `var(--ds-skeleton, ${N20A})`;
18
18
  const skeletonStyles = css({
19
19
  display: 'flex',
20
20
  minHeight: itemMinHeight,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.3.4",
3
+ "version": "1.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -2,26 +2,18 @@
2
2
  import { ClassNames, css, jsx, keyframes } from '@emotion/core';
3
3
  import { N20A, N30A } from '@atlaskit/theme/colors';
4
4
 
5
- /**
6
- * This color is mirrored in:
7
- * packages/design-system/theme/src/colors.tsx
8
- *
9
- * Please update both.
10
- */
11
- var skeletonColor = "var(--ds-background-neutral, ".concat(N20A, ")");
12
5
  /**
13
6
  * These keyframes are mirrored in:
14
7
  * packages/design-system/theme/src/constants.tsx
15
8
  *
16
9
  * Please update both.
17
10
  */
18
-
19
11
  var shimmerKeyframes = keyframes({
20
12
  from: {
21
- backgroundColor: "var(--ds-background-neutral, ".concat(skeletonColor, ")")
13
+ backgroundColor: "var(--ds-skeleton, ".concat(N20A, ")")
22
14
  },
23
15
  to: {
24
- backgroundColor: "var(--ds-background-neutral-hovered, ".concat(N30A, ")")
16
+ backgroundColor: "var(--ds-skeleton-subtle, ".concat(N30A, ")")
25
17
  }
26
18
  });
27
19
  /**
@@ -38,7 +30,7 @@ var shimmerStyles = css({
38
30
  animationIterationCount: 'infinite',
39
31
  animationName: "".concat(shimmerKeyframes),
40
32
  animationTimingFunction: 'linear',
41
- backgroundColor: "var(--ds-background-neutral, ".concat(skeletonColor, ")")
33
+ backgroundColor: "var(--ds-skeleton, ".concat(N20A, ")")
42
34
  }
43
35
  });
44
36
  /**
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/core';
3
3
  import noop from '@atlaskit/ds-lib/noop';
4
- import { skeleton as skeletonColorFn } from '@atlaskit/theme/colors';
4
+ import { N20A } from '@atlaskit/theme/colors';
5
5
  import { gridSize } from '@atlaskit/theme/constants';
6
6
  import SkeletonShimmer from '../internal/components/skeleton-shimmer';
7
7
  var skeletonStyles = css({
@@ -10,7 +10,7 @@ var skeletonStyles = css({
10
10
  display: 'block',
11
11
  width: '30%',
12
12
  height: gridSize(),
13
- backgroundColor: "var(--ds-background-neutral, ".concat(skeletonColorFn(), ")"),
13
+ backgroundColor: "var(--ds-skeleton, ".concat(N20A, ")"),
14
14
  borderRadius: 100,
15
15
  content: '""'
16
16
  }
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/core';
3
3
  import noop from '@atlaskit/ds-lib/noop';
4
- import { skeleton as skeletonColorFn } from '@atlaskit/theme/colors';
4
+ import { N20A } from '@atlaskit/theme/colors';
5
5
  import { borderRadius as borderRadiusFn, gridSize as gridSizeFn } from '@atlaskit/theme/constants';
6
6
  import SkeletonShimmer from '../internal/components/skeleton-shimmer';
7
7
  var gridSize = gridSizeFn();
@@ -14,7 +14,7 @@ var skeletonItemElemSize = gridSize * 2.5;
14
14
  var itemElemSkeletonOffset = (itemExpectedElemSize - skeletonItemElemSize) / 2;
15
15
  var skeletonTextBorderRadius = 100;
16
16
  var skeletonContentHeight = 9;
17
- var skeletonColor = "var(--ds-background-neutral, ".concat(skeletonColorFn(), ")");
17
+ var skeletonColor = "var(--ds-skeleton, ".concat(N20A, ")");
18
18
  var skeletonStyles = css({
19
19
  display: 'flex',
20
20
  minHeight: itemMinHeight,
@@ -61,7 +61,7 @@ var unscrollableStyles = css({
61
61
  flexShrink: 0
62
62
  });
63
63
  var separatorStyles = css({
64
- borderTop: "2px solid var(".concat(VAR_SEPARATOR_COLOR, ", ").concat("var(--ds-border, ".concat(N30A, ")"), ")")
64
+ borderTop: "2px solid var(".concat(VAR_SEPARATOR_COLOR, ", ", "var(--ds-border, ".concat(N30A, ")"), ")")
65
65
  });
66
66
  var noSeparatorStyles = css({
67
67
  // this is to ensure that adjacent sections without separators don't get additional margins.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.3.4",
3
+ "version": "1.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -94,7 +94,7 @@ export interface SectionProps {
94
94
  overrides?: {
95
95
  HeadingItem?: {
96
96
  /**
97
- * A function that can be used to override the styles of the component.
97
+ * A function that overrides the styles of the component.
98
98
  * It receives the current styles and state and expects a styles object.
99
99
  */
100
100
  cssFn?: StatelessCSSFn;
@@ -127,10 +127,10 @@ export interface MenuItemPrimitiveProps {
127
127
  }
128
128
  export interface MenuItemProps {
129
129
  /**
130
- * A function that can be used to override the styles of the component.
131
- * It receives the current styles and state and expects a styles object.
132
- *
133
- * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
130
+ A function that overrides the styles of the component.
131
+ It receives the current styles and state and expects a styles object.
132
+
133
+ @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
134
134
  */
135
135
  cssFn?: CSSFn;
136
136
  /**
@@ -175,9 +175,9 @@ export interface MenuItemProps {
175
175
  */
176
176
  testId?: string;
177
177
  /**
178
- * Custom overrides for the composed components.
179
- *
180
- * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
178
+ Custom overrides for the composed components.
179
+
180
+ @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
181
181
  */
182
182
  overrides?: Overrides;
183
183
  /**
@@ -266,14 +266,16 @@ export interface CustomItemComponentProps {
266
266
  }
267
267
  export interface CustomItemProps<TCustomComponentProps = CustomItemComponentProps> extends MenuItemProps {
268
268
  /**
269
- * Custom component to render as an item.
270
- * This can be both a functional component or a class component.
271
- * __Will return `null` if no component is defined.__
272
- * If using TypeScript and this has typed props it will make its props available to the root custom item component for type safety,
273
- * which allows you to pass the custom component's props via the root custom item component props.
274
- * e.g. `<CustomItem to="/link" component={RouterLink} />`
275
- *
276
- * __NOTE:__ Make sure the reference for this component does not change between renders else undefined behavior may happen.
269
+ Custom component to render as an item. This can be both a functional component or a class component.
270
+
271
+ __Will return `null` if no component is defined.__
272
+
273
+ Props passed to `CustomItem` will be passed down to this component. If the props for `component` have TypeScript types,
274
+ CustomItem will extend them, providing type safety for your custom item.
275
+
276
+ e.g. `<CustomItem to="/link" component={RouterLink} />`
277
+
278
+ __NOTE:__ Make sure the reference for this component does not change between renders else undefined behavior may happen.
277
279
  */
278
280
  component?: React.ComponentType<TCustomComponentProps>;
279
281
  }
@@ -305,17 +307,17 @@ export interface SkeletonItemProps {
305
307
  */
306
308
  isShimmering?: boolean;
307
309
  /**
308
- * A function that can be used to override the styles of this component.
310
+ * A function that overrides the styles of this component.
309
311
  * It receives the current styles and returns a customized styles object.
310
312
  */
311
313
  cssFn?: StatelessCSSFn;
312
314
  }
313
315
  export interface HeadingItemProps {
314
316
  /**
315
- * A function that can be used to override the styles.
316
- * It receives the current styles and returns a customised styles object.
317
- *
318
- * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
317
+ A function that overrides the styles.
318
+ It receives the current styles and returns a customized styles object.
319
+
320
+ @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
319
321
  */
320
322
  cssFn?: StatelessCSSFn;
321
323
  /**
@@ -353,10 +355,10 @@ export interface SkeletonHeadingItemProps {
353
355
  */
354
356
  isShimmering?: boolean;
355
357
  /**
356
- * A function that can be used to override the styles of this component.
357
- * It receives the current styles and returns a customized styles object.
358
- *
359
- * @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
358
+ A function that overrides the styles of this component.
359
+ It receives the current styles and returns a customized styles object.
360
+
361
+ @deprecated This API is deprecated and will be removed in a future release. See DSP-2676 for more information.
360
362
  */
361
363
  cssFn?: StatelessCSSFn;
362
364
  }
@@ -365,12 +367,12 @@ export declare type ItemState = {
365
367
  isDisabled: boolean;
366
368
  };
367
369
  /**
368
- * A function that can be used to override the styles of
369
- * menu components. It receives the current state
370
- * and should return a CSSObject.
371
- *
372
- * @see @atlaskit/menu/docs/85-overriding-item-styles
373
- * @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
370
+ A function that overrides the styles of
371
+ menu components. It receives the current state
372
+ and should return a CSSObject.
373
+
374
+ @see @atlaskit/menu/docs/85-overriding-item-styles
375
+ @deprecated This type is deprecated and will be removed in a future release. See DSP-2676 for more information.
374
376
  */
375
377
  export interface CSSFn<TState = ItemState extends void ? void : ItemState> {
376
378
  (currentState: TState): CSSObject | CSSObject[];
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "1.3.4",
3
+ "version": "1.3.7",
4
4
  "description": "A collection of composable menu components that can be used anywhere.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
7
7
  },
8
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
8
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
9
9
  "author": "Atlassian Pty Ltd",
10
10
  "license": "Apache-2.0",
11
11
  "main": "dist/cjs/index.js",
@@ -18,7 +18,8 @@
18
18
  "team": "Design System Team",
19
19
  "releaseModel": "scheduled",
20
20
  "website": {
21
- "name": "Menu"
21
+ "name": "Menu",
22
+ "category": "Components"
22
23
  }
23
24
  },
24
25
  "af:exports": {
@@ -35,7 +36,7 @@
35
36
  ".": "./src/index.tsx"
36
37
  },
37
38
  "dependencies": {
38
- "@atlaskit/ds-lib": "^1.4.0",
39
+ "@atlaskit/ds-lib": "^2.0.0",
39
40
  "@atlaskit/focus-ring": "^1.0.0",
40
41
  "@atlaskit/theme": "^12.1.0",
41
42
  "@atlaskit/tokens": "^0.10.0",
@@ -47,7 +48,7 @@
47
48
  "react-dom": "^16.8.0"
48
49
  },
49
50
  "devDependencies": {
50
- "@atlaskit/avatar": "^20.5.0",
51
+ "@atlaskit/avatar": "^21.0.0",
51
52
  "@atlaskit/button": "^16.3.0",
52
53
  "@atlaskit/docs": "*",
53
54
  "@atlaskit/icon": "^21.10.0",
@@ -61,6 +62,7 @@
61
62
  "@testing-library/react": "^8.0.1",
62
63
  "@types/react-router-dom": "^4.3.1",
63
64
  "ast-types": "^0.13.3",
65
+ "bind-event-listener": "^2.1.1",
64
66
  "jest-axe": "^4.0.0",
65
67
  "jest-emotion": "^10.0.32",
66
68
  "jscodeshift": "^0.13.0",
@@ -78,6 +80,7 @@
78
80
  "import-structure": "atlassian-conventions"
79
81
  },
80
82
  "@repo/internal": {
83
+ "dom-events": "use-bind-event-listener",
81
84
  "ui-components": "lite-mode",
82
85
  "design-system": "v1",
83
86
  "styling": [