@atlaskit/panel 2.5.1 → 2.7.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,23 @@
1
1
  # @atlaskit/panel
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`bd2c5b0112185`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd2c5b0112185) -
8
+ Remove stale API report artifacts from published Platform packages.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 2.6.0
15
+
16
+ ### Minor Changes
17
+
18
+ - [`d83cb6c1f23f8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d83cb6c1f23f8) -
19
+ Add support for aria-label
20
+
3
21
  ## 2.5.1
4
22
 
5
23
  ### Patch Changes
@@ -14,7 +14,8 @@ var PanelState = function PanelState(_ref) {
14
14
  var _ref$isDefaultExpande = _ref.isDefaultExpanded,
15
15
  isDefaultExpanded = _ref$isDefaultExpande === void 0 ? false : _ref$isDefaultExpande,
16
16
  children = _ref.children,
17
- header = _ref.header;
17
+ header = _ref.header,
18
+ ariaLabel = _ref.ariaLabel;
18
19
  var _useState = (0, _react.useState)(isDefaultExpanded),
19
20
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
20
21
  isExpanded = _useState2[0],
@@ -25,7 +26,8 @@ var PanelState = function PanelState(_ref) {
25
26
  return /*#__PURE__*/_react.default.createElement(_PanelStateless.default, {
26
27
  header: header,
27
28
  isExpanded: isExpanded,
28
- onChange: handleChange
29
+ onChange: handleChange,
30
+ ariaLabel: ariaLabel
29
31
  }, children);
30
32
  };
31
33
  var _default = exports.default = PanelState;
@@ -9,7 +9,7 @@ exports.default = void 0;
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _reactAnimateHeight = _interopRequireDefault(require("react-animate-height"));
11
11
  var _reactIntl = require("react-intl");
12
- var _button = _interopRequireDefault(require("@atlaskit/button"));
12
+ var _button = _interopRequireDefault(require("@atlaskit/button/button"));
13
13
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
14
14
  var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/core/chevron-right"));
15
15
  var _compiled = require("@atlaskit/primitives/compiled");
@@ -32,7 +32,8 @@ var PanelStateless = function PanelStateless(_ref) {
32
32
  header = _ref.header,
33
33
  _ref$isExpanded = _ref.isExpanded,
34
34
  isExpanded = _ref$isExpanded === void 0 ? false : _ref$isExpanded,
35
- onChange = _ref.onChange;
35
+ onChange = _ref.onChange,
36
+ ariaLabel = _ref.ariaLabel;
36
37
  var intl = (0, _reactIntl.useIntl)();
37
38
  var i18nExpandText = intl.formatMessage(i18n.expand);
38
39
  var i18nCollapseText = intl.formatMessage(i18n.collapse);
@@ -45,6 +46,7 @@ var PanelStateless = function PanelStateless(_ref) {
45
46
  }, /*#__PURE__*/_react.default.createElement(_button.default, {
46
47
  appearance: "subtle",
47
48
  "aria-expanded": isExpanded,
49
+ "aria-label": ariaLabel,
48
50
  spacing: "none",
49
51
  iconBefore: isExpanded ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
50
52
  as: "span",
@@ -41,7 +41,7 @@ transition, {
41
41
  }
42
42
  });
43
43
 
44
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @typescript-eslint/ban-types -- Ignored via go/DSP-18766
44
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @typescript-eslint/no-restricted-types -- Ignored via go/DSP-18766
45
45
  var PanelHeader = exports.PanelHeader = (0, _reactFocusWithin.withFocusWithin)(_styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\talign-items: center;\n\tbackground-color: ", ";\n\tborder-radius: ", ";\n\tdisplay: flex;\n\tleft: ", ";\n\tmargin-bottom: ", ";\n\tmargin-top: ", ";\n\tpadding: ", " ", " ", " ", ";\n\tposition: relative;\n\t", ";\n\twidth: 100%;\n\n\t", " {\n\t\topacity: ", ";\n\t}\n\n\t&:hover {\n\t\tbackground-color: ", ";\n\t\tcursor: pointer;\n\n\t\t", " {\n\t\t\topacity: 1;\n\t\t}\n\t}\n"])), function (props) {
46
46
  return props.isFocused && "var(--ds-surface-hovered, #F0F1F2)";
47
47
  }, "var(--ds-radius-small, 3px)", "var(--ds-space-negative-300, -24px)", "var(--ds-space-100, 8px)", "var(--ds-space-200, 16px)", "var(--ds-space-025, 2px)", "var(--ds-space-0, 0px)", "var(--ds-space-025, 2px)", "var(--ds-space-300, 24px)", transition, ButtonWrapper, function (props) {
@@ -3,7 +3,8 @@ import PanelStateless from './PanelStateless';
3
3
  const PanelState = ({
4
4
  isDefaultExpanded = false,
5
5
  children,
6
- header
6
+ header,
7
+ ariaLabel
7
8
  }) => {
8
9
  const [isExpanded, setisExpanded] = useState(isDefaultExpanded);
9
10
  const handleChange = () => {
@@ -12,7 +13,8 @@ const PanelState = ({
12
13
  return /*#__PURE__*/React.createElement(PanelStateless, {
13
14
  header: header,
14
15
  isExpanded: isExpanded,
15
- onChange: handleChange
16
+ onChange: handleChange,
17
+ ariaLabel: ariaLabel
16
18
  }, children);
17
19
  };
18
20
  export default PanelState;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import AnimateHeight from 'react-animate-height';
3
3
  import { defineMessages, useIntl } from 'react-intl';
4
- import Button from '@atlaskit/button';
4
+ import Button from '@atlaskit/button/button';
5
5
  import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
6
6
  import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
7
7
  import { Box } from '@atlaskit/primitives/compiled';
@@ -22,7 +22,8 @@ const PanelStateless = ({
22
22
  children,
23
23
  header,
24
24
  isExpanded = false,
25
- onChange
25
+ onChange,
26
+ ariaLabel
26
27
  }) => {
27
28
  const intl = useIntl();
28
29
  const i18nExpandText = intl.formatMessage(i18n.expand);
@@ -34,6 +35,7 @@ const PanelStateless = ({
34
35
  }, /*#__PURE__*/React.createElement(Button, {
35
36
  appearance: "subtle",
36
37
  "aria-expanded": isExpanded,
38
+ "aria-label": ariaLabel,
37
39
  spacing: "none",
38
40
  iconBefore: isExpanded ? /*#__PURE__*/React.createElement(Box, {
39
41
  as: "span",
@@ -33,7 +33,7 @@ transition, {
33
33
  }
34
34
  });
35
35
 
36
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @typescript-eslint/ban-types -- Ignored via go/DSP-18766
36
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @typescript-eslint/no-restricted-types -- Ignored via go/DSP-18766
37
37
  export const PanelHeader = withFocusWithin(styled.div`
38
38
  align-items: center;
39
39
  background-color: ${props => props.isFocused && "var(--ds-surface-hovered, #F0F1F2)"};
@@ -5,7 +5,8 @@ var PanelState = function PanelState(_ref) {
5
5
  var _ref$isDefaultExpande = _ref.isDefaultExpanded,
6
6
  isDefaultExpanded = _ref$isDefaultExpande === void 0 ? false : _ref$isDefaultExpande,
7
7
  children = _ref.children,
8
- header = _ref.header;
8
+ header = _ref.header,
9
+ ariaLabel = _ref.ariaLabel;
9
10
  var _useState = useState(isDefaultExpanded),
10
11
  _useState2 = _slicedToArray(_useState, 2),
11
12
  isExpanded = _useState2[0],
@@ -16,7 +17,8 @@ var PanelState = function PanelState(_ref) {
16
17
  return /*#__PURE__*/React.createElement(PanelStateless, {
17
18
  header: header,
18
19
  isExpanded: isExpanded,
19
- onChange: handleChange
20
+ onChange: handleChange,
21
+ ariaLabel: ariaLabel
20
22
  }, children);
21
23
  };
22
24
  export default PanelState;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import AnimateHeight from 'react-animate-height';
3
3
  import { defineMessages, useIntl } from 'react-intl';
4
- import Button from '@atlaskit/button';
4
+ import Button from '@atlaskit/button/button';
5
5
  import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
6
6
  import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
7
7
  import { Box } from '@atlaskit/primitives/compiled';
@@ -23,7 +23,8 @@ var PanelStateless = function PanelStateless(_ref) {
23
23
  header = _ref.header,
24
24
  _ref$isExpanded = _ref.isExpanded,
25
25
  isExpanded = _ref$isExpanded === void 0 ? false : _ref$isExpanded,
26
- onChange = _ref.onChange;
26
+ onChange = _ref.onChange,
27
+ ariaLabel = _ref.ariaLabel;
27
28
  var intl = useIntl();
28
29
  var i18nExpandText = intl.formatMessage(i18n.expand);
29
30
  var i18nCollapseText = intl.formatMessage(i18n.collapse);
@@ -36,6 +37,7 @@ var PanelStateless = function PanelStateless(_ref) {
36
37
  }, /*#__PURE__*/React.createElement(Button, {
37
38
  appearance: "subtle",
38
39
  "aria-expanded": isExpanded,
40
+ "aria-label": ariaLabel,
39
41
  spacing: "none",
40
42
  iconBefore: isExpanded ? /*#__PURE__*/React.createElement(Box, {
41
43
  as: "span",
@@ -33,7 +33,7 @@ transition, {
33
33
  }
34
34
  });
35
35
 
36
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @typescript-eslint/ban-types -- Ignored via go/DSP-18766
36
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @typescript-eslint/no-restricted-types -- Ignored via go/DSP-18766
37
37
  export var PanelHeader = withFocusWithin(styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\talign-items: center;\n\tbackground-color: ", ";\n\tborder-radius: ", ";\n\tdisplay: flex;\n\tleft: ", ";\n\tmargin-bottom: ", ";\n\tmargin-top: ", ";\n\tpadding: ", " ", " ", " ", ";\n\tposition: relative;\n\t", ";\n\twidth: 100%;\n\n\t", " {\n\t\topacity: ", ";\n\t}\n\n\t&:hover {\n\t\tbackground-color: ", ";\n\t\tcursor: pointer;\n\n\t\t", " {\n\t\t\topacity: 1;\n\t\t}\n\t}\n"])), function (props) {
38
38
  return props.isFocused && "var(--ds-surface-hovered, #F0F1F2)";
39
39
  }, "var(--ds-radius-small, 3px)", "var(--ds-space-negative-300, -24px)", "var(--ds-space-100, 8px)", "var(--ds-space-200, 16px)", "var(--ds-space-025, 2px)", "var(--ds-space-0, 0px)", "var(--ds-space-025, 2px)", "var(--ds-space-300, 24px)", transition, ButtonWrapper, function (props) {
@@ -1,5 +1,8 @@
1
1
  import { type FC, type ReactNode } from 'react';
2
2
  export type BasePanelProps = {
3
+ /** Accessible label for the expand/collapse button. Use this when the header is a non-text
4
+ * React node so screen readers announce a meaningful name instead of the icon label. */
5
+ ariaLabel?: string;
3
6
  /** Content to be shown inside the panel. */
4
7
  children?: ReactNode;
5
8
  /** Header to render on the panel. Clicking the header expands and collapses the panel */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/panel",
3
- "version": "2.5.1",
3
+ "version": "2.7.0",
4
4
  "description": "A React component rendering a collapsible panel",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -21,13 +21,13 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@atlaskit/afm-i18n-platform-bitbucket-panel": "2.209.0",
24
- "@atlaskit/button": "^25.0.0",
25
- "@atlaskit/icon": "^37.3.0",
26
- "@atlaskit/link": "^5.0.0",
27
- "@atlaskit/platform-feature-flags": "^2.1.0",
28
- "@atlaskit/primitives": "^22.2.0",
29
- "@atlaskit/theme": "^28.0.0",
30
- "@atlaskit/tokens": "^16.4.0",
24
+ "@atlaskit/button": "^25.3.0",
25
+ "@atlaskit/icon": "^37.6.0",
26
+ "@atlaskit/link": "^5.1.0",
27
+ "@atlaskit/platform-feature-flags": "^2.2.0",
28
+ "@atlaskit/primitives": "^22.5.0",
29
+ "@atlaskit/theme": "^28.2.0",
30
+ "@atlaskit/tokens": "^16.10.0",
31
31
  "@babel/runtime": "^7.0.0",
32
32
  "react-animate-height": "^2.1.0",
33
33
  "react-focus-within": "^2.0.1"
@@ -38,6 +38,7 @@
38
38
  "styled-components": "^3.2.6"
39
39
  },
40
40
  "devDependencies": {
41
+ "@atlaskit/page": "^15.3.0",
41
42
  "@testing-library/react": "^16.3.0",
42
43
  "@testing-library/user-event": "^14.4.3",
43
44
  "react": "^18.2.0",
package/report.api.md DELETED
@@ -1,62 +0,0 @@
1
- <!-- API Report Version: 2.3 -->
2
-
3
- ## API Report File for "@atlaskit/panel"
4
-
5
- > Do not edit this file. This report is auto-generated using
6
- > [API Extractor](https://api-extractor.com/).
7
- > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
8
-
9
- ### Table of contents
10
-
11
- - [Main Entry Types](#main-entry-types)
12
- - [Peer Dependencies](#peer-dependencies)
13
-
14
- ### Main Entry Types
15
-
16
- <!--SECTION START: Main Entry Types-->
17
-
18
- ```ts
19
- import { FC } from 'react';
20
- import { ReactNode } from 'react';
21
-
22
- // @public (undocumented)
23
- type BasePanelProps = {
24
- children?: ReactNode;
25
- header?: ReactNode;
26
- };
27
-
28
- // @public (undocumented)
29
- const PanelState: FC<Props>;
30
- export default PanelState;
31
-
32
- // @public (undocumented)
33
- type PanelState_2 = BasePanelProps & {
34
- isExpanded: boolean;
35
- onChange: (isExpanded: boolean) => void;
36
- };
37
-
38
- // @public (undocumented)
39
- export const PanelStateless: FC<PanelState_2>;
40
-
41
- // @public (undocumented)
42
- type Props = BasePanelProps & {
43
- isDefaultExpanded?: boolean;
44
- };
45
-
46
- // (No @packageDocumentation comment for this package)
47
- ```
48
-
49
- <!--SECTION END: Main Entry Types-->
50
-
51
- ### Peer Dependencies
52
-
53
- <!--SECTION START: Peer Dependencies-->
54
-
55
- ```json
56
- {
57
- "react": "^16.8.0",
58
- "styled-components": "^3.2.6"
59
- }
60
- ```
61
-
62
- <!--SECTION END: Peer Dependencies-->