@atlaskit/page-layout 2.0.0 → 2.0.2

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/page-layout
2
2
 
3
+ ## 2.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#61821](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/61821) [`bd212363ecc2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bd212363ecc2) - Add role=main to main slot
8
+
9
+ ## 2.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#58110](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/58110) [`9e7a86f76af4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9e7a86f76af4) - Resizing the Sidebar can now only be triggered via left-click (main button click). This prevents situations where right-clicking the resize button unexpectedly starts resizing the Sidebar.
14
+
3
15
  ## 2.0.0
4
16
 
5
17
  ### Major Changes
@@ -19,6 +19,13 @@ import { HelpPopup } from './help-popup';
19
19
  import { NotificationsPopup } from './notifications-popup';
20
20
  import { ProfilePopup } from './profile-popup';
21
21
 
22
+ const drawerLabelText = {
23
+ search: 'Search drawer',
24
+ settings: 'Settings drawer',
25
+ };
26
+
27
+ const { search, settings } = drawerLabelText;
28
+
22
29
  const ProductHomeExample = () => (
23
30
  <ProductHome icon={JiraIcon} logo={JiraLogo} siteTitle="Extranet" />
24
31
  );
@@ -43,8 +50,8 @@ const SearchDrawer = () => {
43
50
  tooltip="Search"
44
51
  label="Search"
45
52
  />
46
- <Drawer isOpen={isOpen} onClose={onClose}>
47
- <div>search drawer</div>
53
+ <Drawer label={search} isOpen={isOpen} onClose={onClose}>
54
+ <div>{search}</div>
48
55
  </Drawer>
49
56
  </Fragment>
50
57
  );
@@ -64,8 +71,8 @@ const SettingsDrawer = () => {
64
71
  return (
65
72
  <Fragment>
66
73
  <Settings isSelected={isOpen} onClick={onClick} tooltip="Settings" />
67
- <Drawer isOpen={isOpen} onClose={onClose}>
68
- settings drawer
74
+ <Drawer label={settings} isOpen={isOpen} onClose={onClose}>
75
+ {settings}
69
76
  </Drawer>
70
77
  </Fragment>
71
78
  );
@@ -104,8 +104,11 @@ var ResizeControl = function ResizeControl(_ref) {
104
104
  return;
105
105
  }
106
106
 
107
- // TODO: should only a primary pointer be able to start a resize?
108
- // Keeping as is for now, but worth considering
107
+ // Only allow left (primary) clicks to trigger resize as we've received
108
+ // bug reports about right click unexpectedly beginning a resize.
109
+ if (event.button !== 0) {
110
+ return;
111
+ }
109
112
 
110
113
  // It is possible for a mousedown to fire during a resize
111
114
  // Example: the user presses another pointer button while dragging
@@ -21,10 +21,8 @@ var _slotFocusRing = _interopRequireDefault(require("./internal/slot-focus-ring"
21
21
  var prefersReducedMotionStyles = (0, _react2.css)((0, _accessibility.prefersReducedMotion)());
22
22
  var mainStyles = (0, _react2.css)({
23
23
  minWidth: 0,
24
- marginLeft: 0,
25
- // Prevent flex container from blowing up when there's super wide content.
26
24
  flexGrow: 1,
27
- // Transition negative margin on main in sync with the increase in width of leftSidebar.
25
+ marginInlineStart: 0,
28
26
  transition: "margin-left ".concat(_constants.TRANSITION_DURATION, "ms ").concat(_curves.easeOut, " 0s")
29
27
  });
30
28
  var draggingStyles = (0, _react2.css)({
@@ -40,7 +38,7 @@ var draggingStyles = (0, _react2.css)({
40
38
  */
41
39
  var flyoutStyles = (0, _react2.css)({
42
40
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
43
- marginLeft: "calc(-1 * var(--".concat(_constants.VAR_LEFT_SIDEBAR_FLYOUT, ", ").concat(_constants.DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH, "px) + ").concat(_constants.COLLAPSED_LEFT_SIDEBAR_WIDTH, "px)")
41
+ marginInlineStart: "calc(-1 * var(--".concat(_constants.VAR_LEFT_SIDEBAR_FLYOUT, ", ").concat(_constants.DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH, "px) + ").concat(_constants.COLLAPSED_LEFT_SIDEBAR_WIDTH, "px)")
44
42
  });
45
43
 
46
44
  /**
@@ -65,6 +63,8 @@ var Main = function Main(props) {
65
63
  return (0, _react2.jsx)(_slotFocusRing.default, null, function (_ref) {
66
64
  var className = _ref.className;
67
65
  return (0, _react2.jsx)("div", (0, _extends2.default)({
66
+ // Using ARIA role instead of <main> tag to avoid any issues with downstream implementations.
67
+ role: "main",
68
68
  "data-testid": testId,
69
69
  css: [mainStyles, isDragging && draggingStyles, isFlyoutOpen && !isFixed && flyoutStyles, prefersReducedMotionStyles],
70
70
  className: className,
@@ -96,8 +96,11 @@ const ResizeControl = ({
96
96
  return;
97
97
  }
98
98
 
99
- // TODO: should only a primary pointer be able to start a resize?
100
- // Keeping as is for now, but worth considering
99
+ // Only allow left (primary) clicks to trigger resize as we've received
100
+ // bug reports about right click unexpectedly beginning a resize.
101
+ if (event.button !== 0) {
102
+ return;
103
+ }
101
104
 
102
105
  // It is possible for a mousedown to fire during a resize
103
106
  // Example: the user presses another pointer button while dragging
@@ -14,10 +14,8 @@ import SlotFocusRing from './internal/slot-focus-ring';
14
14
  const prefersReducedMotionStyles = css(prefersReducedMotion());
15
15
  const mainStyles = css({
16
16
  minWidth: 0,
17
- marginLeft: 0,
18
- // Prevent flex container from blowing up when there's super wide content.
19
17
  flexGrow: 1,
20
- // Transition negative margin on main in sync with the increase in width of leftSidebar.
18
+ marginInlineStart: 0,
21
19
  transition: `margin-left ${TRANSITION_DURATION}ms ${easeOut} 0s`
22
20
  });
23
21
  const draggingStyles = css({
@@ -33,7 +31,7 @@ const draggingStyles = css({
33
31
  */
34
32
  const flyoutStyles = css({
35
33
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
36
- marginLeft: `calc(-1 * var(--${VAR_LEFT_SIDEBAR_FLYOUT}, ${DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH}px) + ${COLLAPSED_LEFT_SIDEBAR_WIDTH}px)`
34
+ marginInlineStart: `calc(-1 * var(--${VAR_LEFT_SIDEBAR_FLYOUT}, ${DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH}px) + ${COLLAPSED_LEFT_SIDEBAR_WIDTH}px)`
37
35
  });
38
36
 
39
37
  /**
@@ -62,6 +60,8 @@ const Main = props => {
62
60
  return jsx(SlotFocusRing, null, ({
63
61
  className
64
62
  }) => jsx("div", _extends({
63
+ // Using ARIA role instead of <main> tag to avoid any issues with downstream implementations.
64
+ role: "main",
65
65
  "data-testid": testId,
66
66
  css: [mainStyles, isDragging && draggingStyles, isFlyoutOpen && !isFixed && flyoutStyles, prefersReducedMotionStyles],
67
67
  className: className,
@@ -100,8 +100,11 @@ var ResizeControl = function ResizeControl(_ref) {
100
100
  return;
101
101
  }
102
102
 
103
- // TODO: should only a primary pointer be able to start a resize?
104
- // Keeping as is for now, but worth considering
103
+ // Only allow left (primary) clicks to trigger resize as we've received
104
+ // bug reports about right click unexpectedly beginning a resize.
105
+ if (event.button !== 0) {
106
+ return;
107
+ }
105
108
 
106
109
  // It is possible for a mousedown to fire during a resize
107
110
  // Example: the user presses another pointer button while dragging
@@ -14,10 +14,8 @@ import SlotFocusRing from './internal/slot-focus-ring';
14
14
  var prefersReducedMotionStyles = css(prefersReducedMotion());
15
15
  var mainStyles = css({
16
16
  minWidth: 0,
17
- marginLeft: 0,
18
- // Prevent flex container from blowing up when there's super wide content.
19
17
  flexGrow: 1,
20
- // Transition negative margin on main in sync with the increase in width of leftSidebar.
18
+ marginInlineStart: 0,
21
19
  transition: "margin-left ".concat(TRANSITION_DURATION, "ms ").concat(easeOut, " 0s")
22
20
  });
23
21
  var draggingStyles = css({
@@ -33,7 +31,7 @@ var draggingStyles = css({
33
31
  */
34
32
  var flyoutStyles = css({
35
33
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
36
- marginLeft: "calc(-1 * var(--".concat(VAR_LEFT_SIDEBAR_FLYOUT, ", ").concat(DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH, "px) + ").concat(COLLAPSED_LEFT_SIDEBAR_WIDTH, "px)")
34
+ marginInlineStart: "calc(-1 * var(--".concat(VAR_LEFT_SIDEBAR_FLYOUT, ", ").concat(DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH, "px) + ").concat(COLLAPSED_LEFT_SIDEBAR_WIDTH, "px)")
37
35
  });
38
36
 
39
37
  /**
@@ -58,6 +56,8 @@ var Main = function Main(props) {
58
56
  return jsx(SlotFocusRing, null, function (_ref) {
59
57
  var className = _ref.className;
60
58
  return jsx("div", _extends({
59
+ // Using ARIA role instead of <main> tag to avoid any issues with downstream implementations.
60
+ role: "main",
61
61
  "data-testid": testId,
62
62
  css: [mainStyles, isDragging && draggingStyles, isFlyoutOpen && !isFixed && flyoutStyles, prefersReducedMotionStyles],
63
63
  className: className,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "A collection of components which let you compose an application's page layout.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,9 +40,9 @@
40
40
  "@atlaskit/icon": "^22.0.0",
41
41
  "@atlaskit/motion": "^1.5.0",
42
42
  "@atlaskit/platform-feature-flags": "^0.2.0",
43
- "@atlaskit/primitives": "^1.12.0",
43
+ "@atlaskit/primitives": "^1.15.0",
44
44
  "@atlaskit/theme": "^12.6.0",
45
- "@atlaskit/tokens": "^1.29.0",
45
+ "@atlaskit/tokens": "^1.30.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1",
48
48
  "bind-event-listener": "^2.1.1",
@@ -54,7 +54,8 @@
54
54
  },
55
55
  "devDependencies": {
56
56
  "@af/accessibility-testing": "*",
57
- "@atlaskit/atlassian-navigation": "^2.9.0",
57
+ "@af/integration-testing": "*",
58
+ "@atlaskit/atlassian-navigation": "^3.0.0",
58
59
  "@atlaskit/atlassian-notifications": "^0.4.0",
59
60
  "@atlaskit/drawer": "^7.6.0",
60
61
  "@atlaskit/logo": "^13.14.0",