@atlaskit/page-layout 1.8.4 → 2.0.1

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.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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.
8
+
9
+ ## 2.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [#56597](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/56597) [`162c25fea4d3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/162c25fea4d3) - Remove `onExpand` and `onCollapse` props on `LeftSidebar` component. These props were non-functional. Use `onLeftSidebarExpand` and `onLeftSidebarCollapse` props on `PageLayout` component instead.
14
+
3
15
  ## 1.8.4
4
16
 
5
17
  ### Patch 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
@@ -58,8 +58,6 @@ var LeftSidebar = function LeftSidebar(props) {
58
58
  resizeButtonLabel = props.resizeButtonLabel,
59
59
  resizeGrabAreaLabel = props.resizeGrabAreaLabel,
60
60
  overrides = props.overrides,
61
- onExpand = props.onExpand,
62
- onCollapse = props.onCollapse,
63
61
  onResizeStart = props.onResizeStart,
64
62
  onResizeEnd = props.onResizeEnd,
65
63
  onFlyoutExpand = props.onFlyoutExpand,
@@ -237,12 +235,11 @@ var LeftSidebar = function LeftSidebar(props) {
237
235
  if (current.isFlyoutOpen) {
238
236
  return current;
239
237
  }
240
- onExpand === null || onExpand === void 0 || onExpand();
241
238
  return _objectSpread(_objectSpread({}, current), {}, {
242
239
  isFlyoutOpen: true
243
240
  });
244
241
  });
245
- }, [setLeftSidebarState, onExpand, mobileMediaQuery]);
242
+ }, [setLeftSidebarState, mobileMediaQuery]);
246
243
 
247
244
  // CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
248
245
  var closeMobileFlyout = (0, _react.useCallback)(function () {
@@ -253,12 +250,11 @@ var LeftSidebar = function LeftSidebar(props) {
253
250
  if (!current.isFlyoutOpen) {
254
251
  return current;
255
252
  }
256
- onCollapse === null || onCollapse === void 0 || onCollapse();
257
253
  return _objectSpread(_objectSpread({}, current), {}, {
258
254
  isFlyoutOpen: false
259
255
  });
260
256
  });
261
- }, [setLeftSidebarState, onCollapse, mobileMediaQuery]);
257
+ }, [setLeftSidebarState, mobileMediaQuery]);
262
258
 
263
259
  // CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
264
260
  (0, _responsive.UNSAFE_useMediaQuery)('below.sm', function (event) {
@@ -336,8 +332,6 @@ var LeftSidebar = function LeftSidebar(props) {
336
332
  // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
337
333
  ,
338
334
  overrides: overrides,
339
- onCollapse: onCollapse,
340
- onExpand: onExpand,
341
335
  onResizeStart: onResizeStart,
342
336
  onResizeEnd: onResizeEnd
343
337
  }))));
@@ -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
@@ -50,8 +50,6 @@ const LeftSidebar = props => {
50
50
  resizeButtonLabel,
51
51
  resizeGrabAreaLabel,
52
52
  overrides,
53
- onExpand,
54
- onCollapse,
55
53
  onResizeStart,
56
54
  onResizeEnd,
57
55
  onFlyoutExpand,
@@ -231,13 +229,12 @@ const LeftSidebar = props => {
231
229
  if (current.isFlyoutOpen) {
232
230
  return current;
233
231
  }
234
- onExpand === null || onExpand === void 0 ? void 0 : onExpand();
235
232
  return {
236
233
  ...current,
237
234
  isFlyoutOpen: true
238
235
  };
239
236
  });
240
- }, [setLeftSidebarState, onExpand, mobileMediaQuery]);
237
+ }, [setLeftSidebarState, mobileMediaQuery]);
241
238
 
242
239
  // CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
243
240
  const closeMobileFlyout = useCallback(() => {
@@ -248,13 +245,12 @@ const LeftSidebar = props => {
248
245
  if (!current.isFlyoutOpen) {
249
246
  return current;
250
247
  }
251
- onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse();
252
248
  return {
253
249
  ...current,
254
250
  isFlyoutOpen: false
255
251
  };
256
252
  });
257
- }, [setLeftSidebarState, onCollapse, mobileMediaQuery]);
253
+ }, [setLeftSidebarState, mobileMediaQuery]);
258
254
 
259
255
  // CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
260
256
  useMediaQuery('below.sm', event => {
@@ -334,8 +330,6 @@ const LeftSidebar = props => {
334
330
  // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
335
331
  ,
336
332
  overrides: overrides,
337
- onCollapse: onCollapse,
338
- onExpand: onExpand,
339
333
  onResizeStart: onResizeStart,
340
334
  onResizeEnd: onResizeEnd
341
335
  }))));
@@ -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
@@ -53,8 +53,6 @@ var LeftSidebar = function LeftSidebar(props) {
53
53
  resizeButtonLabel = props.resizeButtonLabel,
54
54
  resizeGrabAreaLabel = props.resizeGrabAreaLabel,
55
55
  overrides = props.overrides,
56
- onExpand = props.onExpand,
57
- onCollapse = props.onCollapse,
58
56
  onResizeStart = props.onResizeStart,
59
57
  onResizeEnd = props.onResizeEnd,
60
58
  onFlyoutExpand = props.onFlyoutExpand,
@@ -232,12 +230,11 @@ var LeftSidebar = function LeftSidebar(props) {
232
230
  if (current.isFlyoutOpen) {
233
231
  return current;
234
232
  }
235
- onExpand === null || onExpand === void 0 || onExpand();
236
233
  return _objectSpread(_objectSpread({}, current), {}, {
237
234
  isFlyoutOpen: true
238
235
  });
239
236
  });
240
- }, [setLeftSidebarState, onExpand, mobileMediaQuery]);
237
+ }, [setLeftSidebarState, mobileMediaQuery]);
241
238
 
242
239
  // CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
243
240
  var closeMobileFlyout = useCallback(function () {
@@ -248,12 +245,11 @@ var LeftSidebar = function LeftSidebar(props) {
248
245
  if (!current.isFlyoutOpen) {
249
246
  return current;
250
247
  }
251
- onCollapse === null || onCollapse === void 0 || onCollapse();
252
248
  return _objectSpread(_objectSpread({}, current), {}, {
253
249
  isFlyoutOpen: false
254
250
  });
255
251
  });
256
- }, [setLeftSidebarState, onCollapse, mobileMediaQuery]);
252
+ }, [setLeftSidebarState, mobileMediaQuery]);
257
253
 
258
254
  // CLEANUP NOTE: If we revert `'platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g'`, this would be gone.
259
255
  useMediaQuery('below.sm', function (event) {
@@ -331,8 +327,6 @@ var LeftSidebar = function LeftSidebar(props) {
331
327
  // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
332
328
  ,
333
329
  overrides: overrides,
334
- onCollapse: onCollapse,
335
- onExpand: onExpand,
336
330
  onResizeStart: onResizeStart,
337
331
  onResizeEnd: onResizeEnd
338
332
  }))));
@@ -66,14 +66,6 @@ export interface LeftSidebarProps extends SlotWidthProps {
66
66
  * Display label for expand/collapse button for the left sidebar.
67
67
  */
68
68
  resizeButtonLabel?: string;
69
- /**
70
- * Called when left-sidebar is collapsed.
71
- */
72
- onCollapse?: () => void;
73
- /**
74
- * Called when left-sidebar is expanded.
75
- */
76
- onExpand?: () => void;
77
69
  /**
78
70
  * Called when left-sidebar resize starts using mouse or touch.
79
71
  */
@@ -66,14 +66,6 @@ export interface LeftSidebarProps extends SlotWidthProps {
66
66
  * Display label for expand/collapse button for the left sidebar.
67
67
  */
68
68
  resizeButtonLabel?: string;
69
- /**
70
- * Called when left-sidebar is collapsed.
71
- */
72
- onCollapse?: () => void;
73
- /**
74
- * Called when left-sidebar is expanded.
75
- */
76
- onExpand?: () => void;
77
69
  /**
78
70
  * Called when left-sidebar resize starts using mouse or touch.
79
71
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "1.8.4",
3
+ "version": "2.0.1",
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.10.0",
43
+ "@atlaskit/primitives": "^1.13.0",
44
44
  "@atlaskit/theme": "^12.6.0",
45
- "@atlaskit/tokens": "^1.28.0",
45
+ "@atlaskit/tokens": "^1.29.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": "^2.10.0",
58
59
  "@atlaskit/atlassian-notifications": "^0.4.0",
59
60
  "@atlaskit/drawer": "^7.6.0",
60
61
  "@atlaskit/logo": "^13.14.0",
@@ -1,175 +0,0 @@
1
- ## API Report File for "@atlaskit/page-layout"
2
-
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
-
5
- ```ts
6
-
7
- import { ButtonHTMLAttributes } from 'react';
8
- import { ElementType } from 'react';
9
- import { jsx } from '@emotion/react';
10
- import { KeyboardEvent as KeyboardEvent_2 } from 'react';
11
- import { MouseEvent as MouseEvent_2 } from 'react';
12
- import { ReactElement } from 'react';
13
- import { ReactNode } from 'react';
14
-
15
- // @public
16
- export const Banner: (props: SlotHeightProps) => jsx.JSX.Element;
17
-
18
- // @public (undocumented)
19
- export const BANNER_HEIGHT: string;
20
-
21
- // @public
22
- export const Content: (props: ContentProps) => jsx.JSX.Element;
23
-
24
- // @public (undocumented)
25
- interface ContentProps {
26
- children: ReactNode;
27
- testId?: string;
28
- }
29
-
30
- // @public (undocumented)
31
- type DimensionNames = 'bannerHeight' | 'leftPanelWidth' | 'leftSidebarFlyoutWidth' | 'leftSidebarWidth' | 'rightPanelWidth' | 'rightSidebarWidth' | 'topNavigationHeight';
32
-
33
- // @public (undocumented)
34
- export type Dimensions = Partial<Record<DimensionNames, number>>;
35
-
36
- // @public (undocumented)
37
- export const LEFT_PANEL_WIDTH: string;
38
-
39
- // @public (undocumented)
40
- export const LEFT_SIDEBAR_WIDTH: string;
41
-
42
- // @public
43
- export const LeftPanel: (props: SlotWidthProps) => jsx.JSX.Element;
44
-
45
- // @public
46
- export const LeftSidebar: (props: LeftSidebarProps) => jsx.JSX.Element;
47
-
48
- // @public (undocumented)
49
- interface LeftSidebarProps extends SlotWidthProps {
50
- collapsedState?: 'collapsed' | 'expanded';
51
- onCollapse?: () => void;
52
- onExpand?: () => void;
53
- onFlyoutCollapse?: () => void;
54
- onFlyoutExpand?: () => void;
55
- onResizeEnd?: (leftSidebarState: LeftSidebarState) => void;
56
- onResizeStart?: (leftSidebarState: LeftSidebarState) => void;
57
- overrides?: {
58
- ResizeButton?: {
59
- render?: (Component: ElementType<ResizeButtonProps>, props: ResizeButtonProps) => ReactElement;
60
- };
61
- };
62
- resizeButtonLabel?: string;
63
- resizeGrabAreaLabel?: string;
64
- testId?: string;
65
- valueTextLabel?: string;
66
- width?: number;
67
- }
68
-
69
- // @public (undocumented)
70
- export type LeftSidebarState = {
71
- isFlyoutOpen: boolean;
72
- isResizing: boolean;
73
- isLeftSidebarCollapsed: boolean;
74
- leftSidebarWidth: number;
75
- lastLeftSidebarWidth: number;
76
- flyoutLockCount: number;
77
- isFixed: boolean;
78
- };
79
-
80
- // @public
81
- export const LeftSidebarWithoutResize: (props: SlotWidthProps) => jsx.JSX.Element;
82
-
83
- // @public
84
- export const Main: (props: SlotWidthProps) => jsx.JSX.Element;
85
-
86
- // @public
87
- export const PageLayout: ({ skipLinksLabel, children, testId, onLeftSidebarExpand, onLeftSidebarCollapse, }: PageLayoutProps) => jsx.JSX.Element;
88
-
89
- // @public (undocumented)
90
- interface PageLayoutProps extends SidebarResizeControllerProps {
91
- // (undocumented)
92
- skipLinksLabel?: string;
93
- testId?: string;
94
- }
95
-
96
- // @public (undocumented)
97
- type ResizeButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
98
- isLeftSidebarCollapsed: boolean;
99
- label: string;
100
- testId?: string;
101
- };
102
-
103
- // @public (undocumented)
104
- export const RIGHT_PANEL_WIDTH: string;
105
-
106
- // @public (undocumented)
107
- export const RIGHT_SIDEBAR_WIDTH: string;
108
-
109
- // @public
110
- export const RightPanel: (props: SlotWidthProps) => jsx.JSX.Element;
111
-
112
- // @public
113
- export const RightSidebar: (props: SlotWidthProps) => jsx.JSX.Element;
114
-
115
- // @public (undocumented)
116
- type SidebarResizeControllerProps = {
117
- children: ReactNode;
118
- onLeftSidebarExpand?: (leftSidebarState: LeftSidebarState) => void;
119
- onLeftSidebarCollapse?: (leftSidebarState: LeftSidebarState) => void;
120
- };
121
-
122
- // @public (undocumented)
123
- type SkipLinkData = {
124
- id: string;
125
- skipLinkTitle: string;
126
- listIndex?: number;
127
- };
128
-
129
- // @public (undocumented)
130
- export interface SlotHeightProps extends SlotProps {
131
- height?: number;
132
- shouldPersistHeight?: boolean;
133
- }
134
-
135
- // @public (undocumented)
136
- interface SlotProps {
137
- children: ReactNode;
138
- // (undocumented)
139
- id?: string;
140
- isFixed?: boolean;
141
- // (undocumented)
142
- skipLinkTitle?: string;
143
- testId?: string;
144
- }
145
-
146
- // @public (undocumented)
147
- export interface SlotWidthProps extends SlotProps {
148
- shouldPersistWidth?: boolean;
149
- width?: number;
150
- }
151
-
152
- // @public (undocumented)
153
- export const TOP_NAVIGATION_HEIGHT: string;
154
-
155
- // @public
156
- export const TopNavigation: (props: SlotHeightProps) => jsx.JSX.Element;
157
-
158
- // @public (undocumented)
159
- export const useCustomSkipLink: (id: SkipLinkData['id'], skipLinkTitle: SkipLinkData['skipLinkTitle'], listIndex?: SkipLinkData['listIndex']) => void;
160
-
161
- // @public
162
- export const useLeftSidebarFlyoutLock: () => void;
163
-
164
- // @public (undocumented)
165
- export const usePageLayoutResize: () => {
166
- isLeftSidebarCollapsed: boolean;
167
- expandLeftSidebar: () => void;
168
- collapseLeftSidebar: (event?: KeyboardEvent_2 | MouseEvent_2, collapseWithoutTransition?: boolean) => void;
169
- toggleLeftSidebar: (event?: KeyboardEvent_2 | MouseEvent_2, collapseWithoutTransition?: boolean) => void;
170
- leftSidebarState: LeftSidebarState;
171
- };
172
-
173
- // (No @packageDocumentation comment for this package)
174
-
175
- ```