@atlaskit/menu 2.3.0 → 2.4.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +613 -600
  2. package/__perf__/custom.tsx +1 -1
  3. package/__perf__/utils/interaction-tasks.tsx +2 -2
  4. package/codemods/0.7.0-change-css-fn-prop.tsx +3 -2
  5. package/codemods/2.1.0-invalid-link-item-to-button-item.tsx +2 -1
  6. package/codemods/helpers/generic.tsx +4 -3
  7. package/dist/cjs/internal/components/menu-item-primitive.js +8 -8
  8. package/dist/cjs/menu-item/button-item.js +4 -1
  9. package/dist/cjs/menu-item/custom-item.js +4 -1
  10. package/dist/cjs/menu-item/heading-item.js +6 -4
  11. package/dist/cjs/menu-item/link-item.js +2 -0
  12. package/dist/cjs/menu-item/skeleton-heading-item.js +4 -1
  13. package/dist/cjs/menu-item/skeleton-item.js +4 -1
  14. package/dist/cjs/menu-section/menu-group.js +3 -1
  15. package/dist/cjs/menu-section/section.js +7 -1
  16. package/dist/es2019/internal/components/menu-item-primitive.js +8 -8
  17. package/dist/es2019/menu-item/button-item.js +4 -1
  18. package/dist/es2019/menu-item/custom-item.js +4 -1
  19. package/dist/es2019/menu-item/heading-item.js +6 -4
  20. package/dist/es2019/menu-item/link-item.js +2 -0
  21. package/dist/es2019/menu-item/skeleton-heading-item.js +4 -1
  22. package/dist/es2019/menu-item/skeleton-item.js +4 -1
  23. package/dist/es2019/menu-section/menu-group.js +3 -1
  24. package/dist/es2019/menu-section/section.js +6 -0
  25. package/dist/esm/internal/components/menu-item-primitive.js +8 -8
  26. package/dist/esm/menu-item/button-item.js +4 -1
  27. package/dist/esm/menu-item/custom-item.js +4 -1
  28. package/dist/esm/menu-item/heading-item.js +6 -4
  29. package/dist/esm/menu-item/link-item.js +2 -0
  30. package/dist/esm/menu-item/skeleton-heading-item.js +4 -1
  31. package/dist/esm/menu-item/skeleton-item.js +4 -1
  32. package/dist/esm/menu-section/menu-group.js +3 -1
  33. package/dist/esm/menu-section/section.js +7 -1
  34. package/dist/types/internal/components/skeleton-shimmer.d.ts +1 -1
  35. package/dist/types/types.d.ts +7 -2
  36. package/dist/types-ts4.5/internal/components/skeleton-shimmer.d.ts +1 -1
  37. package/dist/types-ts4.5/types.d.ts +7 -2
  38. package/package.json +4 -6
@@ -108,7 +108,10 @@ var SkeletonItem = function SkeletonItem(_ref) {
108
108
  }, function (_ref2) {
109
109
  var className = _ref2.className;
110
110
  return jsx("div", {
111
- className: className,
111
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
112
+ className: className
113
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
114
+ ,
112
115
  style: {
113
116
  '--width': width
114
117
  },
@@ -46,7 +46,9 @@ var MenuGroup = function MenuGroup(_ref) {
46
46
  },
47
47
  css: baseStyles,
48
48
  "data-testid": testId,
49
- role: role,
49
+ role: role
50
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
51
+ ,
50
52
  className: getBooleanFF('platform.design-system-team.unsafe-overrides-killswitch_c8j9m') ? undefined : UNSAFE_className
51
53
  // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
52
54
  }, rest))));
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "overrides", "title", "testId", "isScrollable", "hasSeparator", "id", "isList", "className"];
3
+ var _excluded = ["children", "overrides", "title", "titleId", "testId", "isScrollable", "hasSeparator", "id", "isList", "className"];
4
4
  /* eslint-disable @atlaskit/design-system/ensure-design-token-usage, @atlaskit/design-system/ensure-design-token-usage/preview */
5
5
  /** @jsx jsx */
6
6
  import { Children, forwardRef, Fragment } from 'react';
@@ -89,6 +89,7 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
89
89
  var children = _ref.children,
90
90
  overrides = _ref.overrides,
91
91
  title = _ref.title,
92
+ titleId = _ref.titleId,
92
93
  testId = _ref.testId,
93
94
  isScrollable = _ref.isScrollable,
94
95
  hasSeparator = _ref.hasSeparator,
@@ -102,11 +103,14 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
102
103
  var UNSAFE_headingOverrides = getBooleanFF('platform.design-system-team.unsafe-overrides-killswitch_c8j9m') ? undefined : overrides && overrides.HeadingItem && overrides.HeadingItem.cssFn;
103
104
  var content = isList ? jsx("ul", {
104
105
  style: {
106
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
105
107
  margin: 0,
108
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
106
109
  padding: 0
107
110
  }
108
111
  }, Children.map(Children.toArray(children), function (child, index) {
109
112
  return jsx("li", {
113
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
110
114
  style: {
111
115
  listStyleType: 'none',
112
116
  margin: 0,
@@ -123,6 +127,7 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
123
127
  "aria-hidden": true
124
128
  }, title), content) : jsx(Fragment, null, content);
125
129
  return jsx("div", _extends({}, rest, {
130
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
126
131
  className: getBooleanFF('platform.design-system-team.unsafe-overrides-killswitch_c8j9m') ? undefined : UNSAFE_className,
127
132
  id: id
128
133
  // NOTE: Firefox allows elements that have "overflow: auto" to gain focus (as if it had tab-index="0")
@@ -130,6 +135,7 @@ var Section = /*#__PURE__*/forwardRef(function (_ref, ref) {
130
135
  ,
131
136
  css: [sectionStyles, isScrollable ? scrollableStyles : unscrollableStyles, hasSeparator ? getBooleanFF('platform.design-system-team.section-1px-seperator-borders') ? thinSeparatorStyles : thickSeparatorStyles : noSeparatorStyles],
132
137
  "aria-label": title,
138
+ "aria-labelledby": titleId,
133
139
  "data-testid": testId,
134
140
  role: "group",
135
141
  "data-section": true,
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  type SkeletonShimmerProps = {
5
5
  children: ({ className }: {
@@ -1,5 +1,5 @@
1
- import { ComponentType, PropsWithChildren, ReactNode, Ref } from 'react';
2
- import { CSSObject } from '@emotion/react';
1
+ import { type ComponentType, type PropsWithChildren, type ReactNode, type Ref } from 'react';
2
+ import { type CSSObject } from '@emotion/react';
3
3
  import type { SpacingMode } from './internal/components/menu-context';
4
4
  export interface RenderFunction<TProps = {}> {
5
5
  (Component: ComponentType | string, props: TProps): React.ReactNode;
@@ -114,6 +114,11 @@ export interface SectionProps {
114
114
  * the `HeadingItem` won't be rendered, and this component will act as a regular `Section`.
115
115
  */
116
116
  title?: string;
117
+ /**
118
+ * ID referenced by the menu group wrapper's `aria-labelledby` attribute. This ID should be assigned to the group title element.
119
+ * Usage of either this, or the `label` attribute is strongly recommended.
120
+ */
121
+ titleId?: string;
117
122
  /**
118
123
  * If your menu contains a list, use this to add `<ul>` and `<li>` tags around the items. This is essential for offering better, accessible semantic markup in a list of items.
119
124
  */
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  type SkeletonShimmerProps = {
5
5
  children: ({ className }: {
@@ -1,5 +1,5 @@
1
- import { ComponentType, PropsWithChildren, ReactNode, Ref } from 'react';
2
- import { CSSObject } from '@emotion/react';
1
+ import { type ComponentType, type PropsWithChildren, type ReactNode, type Ref } from 'react';
2
+ import { type CSSObject } from '@emotion/react';
3
3
  import type { SpacingMode } from './internal/components/menu-context';
4
4
  export interface RenderFunction<TProps = {}> {
5
5
  (Component: ComponentType | string, props: TProps): React.ReactNode;
@@ -114,6 +114,11 @@ export interface SectionProps {
114
114
  * the `HeadingItem` won't be rendered, and this component will act as a regular `Section`.
115
115
  */
116
116
  title?: string;
117
+ /**
118
+ * ID referenced by the menu group wrapper's `aria-labelledby` attribute. This ID should be assigned to the group title element.
119
+ * Usage of either this, or the `label` attribute is strongly recommended.
120
+ */
121
+ titleId?: string;
117
122
  /**
118
123
  * If your menu contains a list, use this to add `<ul>` and `<li>` tags around the items. This is essential for offering better, accessible semantic markup in a list of items.
119
124
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "2.3.0",
3
+ "version": "2.4.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/"
@@ -46,9 +46,9 @@
46
46
  "@atlaskit/ds-lib": "^2.3.0",
47
47
  "@atlaskit/focus-ring": "^1.4.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.2.0",
49
- "@atlaskit/primitives": "^6.2.0",
49
+ "@atlaskit/primitives": "^6.5.0",
50
50
  "@atlaskit/theme": "^12.8.0",
51
- "@atlaskit/tokens": "^1.48.0",
51
+ "@atlaskit/tokens": "^1.49.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "@emotion/react": "^11.7.1"
54
54
  },
@@ -61,7 +61,6 @@
61
61
  "@af/integration-testing": "*",
62
62
  "@af/visual-regression": "*",
63
63
  "@atlaskit/visual-regression": "*",
64
- "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
65
64
  "@atlassian/feature-flags-test-utils": "*",
66
65
  "@emotion/jest": "^11.8.0",
67
66
  "@testing-library/dom": "^8.17.1",
@@ -131,6 +130,5 @@
131
130
  "type": "boolean"
132
131
  }
133
132
  },
134
- "homepage": "https://atlassian.design/components/menu/",
135
- "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
133
+ "homepage": "https://atlassian.design/components/menu/"
136
134
  }