@atlaskit/page-layout 1.7.13 → 1.8.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 (51) hide show
  1. package/CHANGELOG.md +85 -79
  2. package/dist/cjs/common/constants.js +49 -98
  3. package/dist/cjs/common/hooks/use-is-sidebar-collapsing.js +1 -2
  4. package/dist/cjs/common/hooks/use-is-sidebar-dragging.js +1 -2
  5. package/dist/cjs/common/safe-local-storage.js +1 -2
  6. package/dist/cjs/common/utils.js +10 -19
  7. package/dist/cjs/components/resize-control/grab-area.js +30 -17
  8. package/dist/cjs/components/resize-control/index.js +13 -12
  9. package/dist/cjs/components/resize-control/resize-button.js +1 -2
  10. package/dist/cjs/components/resize-control/shadow.js +1 -2
  11. package/dist/cjs/components/skip-links/skip-link-components.js +3 -5
  12. package/dist/cjs/components/skip-links/use-custom-skip-link.js +2 -3
  13. package/dist/cjs/components/slots/banner-slot.js +1 -2
  14. package/dist/cjs/components/slots/content.js +1 -2
  15. package/dist/cjs/components/slots/internal/left-sidebar-inner.js +1 -2
  16. package/dist/cjs/components/slots/internal/left-sidebar-outer.js +1 -2
  17. package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +1 -2
  18. package/dist/cjs/components/slots/internal/slot-focus-ring.js +1 -2
  19. package/dist/cjs/components/slots/left-panel.js +1 -2
  20. package/dist/cjs/components/slots/left-sidebar-without-resize.js +1 -2
  21. package/dist/cjs/components/slots/left-sidebar.js +5 -4
  22. package/dist/cjs/components/slots/main.js +1 -2
  23. package/dist/cjs/components/slots/page-layout.js +1 -2
  24. package/dist/cjs/components/slots/right-panel.js +1 -2
  25. package/dist/cjs/components/slots/right-sidebar.js +1 -2
  26. package/dist/cjs/components/slots/slot-dimensions.js +2 -3
  27. package/dist/cjs/components/slots/top-navigation.js +1 -2
  28. package/dist/cjs/controllers/sidebar-resize-context.js +4 -7
  29. package/dist/cjs/controllers/sidebar-resize-controller.js +9 -10
  30. package/dist/cjs/controllers/skip-link-context.js +4 -7
  31. package/dist/cjs/controllers/skip-link-controller.js +2 -3
  32. package/dist/cjs/controllers/use-page-layout-grid.js +1 -2
  33. package/dist/cjs/controllers/use-update-css-vars.js +1 -2
  34. package/dist/es2019/components/resize-control/grab-area.js +31 -18
  35. package/dist/es2019/components/resize-control/index.js +7 -6
  36. package/dist/es2019/components/slots/left-sidebar.js +2 -0
  37. package/dist/esm/components/resize-control/grab-area.js +30 -16
  38. package/dist/esm/components/resize-control/index.js +12 -10
  39. package/dist/esm/components/slots/left-sidebar.js +4 -2
  40. package/dist/esm/controllers/sidebar-resize-controller.js +7 -7
  41. package/dist/types/common/types.d.ts +10 -2
  42. package/dist/types/components/resize-control/grab-area.d.ts +3 -1
  43. package/dist/types/components/resize-control/index.d.ts +1 -1
  44. package/dist/types/components/resize-control/types.d.ts +1 -0
  45. package/dist/types-ts4.5/common/types.d.ts +10 -2
  46. package/dist/types-ts4.5/components/resize-control/grab-area.d.ts +3 -1
  47. package/dist/types-ts4.5/components/resize-control/index.d.ts +1 -1
  48. package/dist/types-ts4.5/components/resize-control/types.d.ts +1 -0
  49. package/package.json +9 -10
  50. package/report.api.md +1 -0
  51. package/tmp/api-report-tmp.d.ts +1 -0
@@ -79,7 +79,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
79
79
  setLeftSidebarState(flyoutOpenSidebarState);
80
80
 
81
81
  // Flush the desktop transitions, cleanup, and call the `onExpand` still
82
- (_transition$current = transition.current) === null || _transition$current === void 0 ? void 0 : _transition$current.complete();
82
+ (_transition$current = transition.current) === null || _transition$current === void 0 || _transition$current.complete();
83
83
  handleDataAttributesAndCb(stableRef.current.onExpand, flyoutOpenSidebarState);
84
84
  return;
85
85
  }
@@ -90,7 +90,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
90
90
  }
91
91
 
92
92
  // flush existing transition
93
- (_transition$current3 = transition.current) === null || _transition$current3 === void 0 ? void 0 : _transition$current3.complete();
93
+ (_transition$current3 = transition.current) === null || _transition$current3 === void 0 || _transition$current3.complete();
94
94
  var width = Math.max(lastLeftSidebarWidth, DEFAULT_LEFT_SIDEBAR_WIDTH);
95
95
  var updatedLeftSidebarState = {
96
96
  isLeftSidebarCollapsed: false,
@@ -116,7 +116,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
116
116
  listener: function listener(event) {
117
117
  if (event.target === sidebar && event.propertyName === 'width') {
118
118
  var _transition$current4;
119
- (_transition$current4 = transition.current) === null || _transition$current4 === void 0 ? void 0 : _transition$current4.complete();
119
+ (_transition$current4 = transition.current) === null || _transition$current4 === void 0 || _transition$current4.complete();
120
120
  }
121
121
  }
122
122
  });
@@ -155,7 +155,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
155
155
  setLeftSidebarState(flyoutCloseSidebarState);
156
156
 
157
157
  // Flush the desktop transitions, cleanup, and call the `onCollapse` still
158
- (_transition$current5 = transition.current) === null || _transition$current5 === void 0 ? void 0 : _transition$current5.complete();
158
+ (_transition$current5 = transition.current) === null || _transition$current5 === void 0 || _transition$current5.complete();
159
159
  handleDataAttributesAndCb(stableRef.current.onCollapse, flyoutCloseSidebarState);
160
160
  return;
161
161
  }
@@ -166,7 +166,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
166
166
  }
167
167
 
168
168
  // flush existing transition
169
- (_transition$current7 = transition.current) === null || _transition$current7 === void 0 ? void 0 : _transition$current7.complete();
169
+ (_transition$current7 = transition.current) === null || _transition$current7 === void 0 || _transition$current7.complete();
170
170
 
171
171
  // data-attribute is used as a CSS selector to sync the hiding/showing
172
172
  // of the nav contents with expand/collapse animation
@@ -196,7 +196,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
196
196
  listener: function listener(event) {
197
197
  if (sidebar === event.target && event.propertyName === 'width') {
198
198
  var _transition$current8;
199
- (_transition$current8 = transition.current) === null || _transition$current8 === void 0 ? void 0 : _transition$current8.complete();
199
+ (_transition$current8 = transition.current) === null || _transition$current8 === void 0 || _transition$current8.complete();
200
200
  }
201
201
  }
202
202
  });
@@ -230,7 +230,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
230
230
  useEffect(function mount() {
231
231
  return function unmount() {
232
232
  var _transition$current9;
233
- (_transition$current9 = transition.current) === null || _transition$current9 === void 0 ? void 0 : _transition$current9.abort();
233
+ (_transition$current9 = transition.current) === null || _transition$current9 === void 0 || _transition$current9.abort();
234
234
  };
235
235
  }, []);
236
236
  var context = useMemo(function () {
@@ -42,6 +42,14 @@ export interface LeftSidebarProps extends SlotWidthProps {
42
42
  * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
43
43
  */
44
44
  testId?: string;
45
+ /**
46
+ * The `aria-valuetext` allows users relying on assistive technologies,
47
+ * particularly screen readers, to determine the purpose of the slider.
48
+ * The default value is "Width".
49
+ * The aria-valuenow property is automatically appended to the valueTextLabel.
50
+ * For Example, valueTextLabel="Width" will render aria-valuetext="Width 62%”.
51
+ */
52
+ valueTextLabel?: string;
45
53
  /**
46
54
  * You can override prop(s) for the mentioned component(s).
47
55
  */
@@ -51,11 +59,11 @@ export interface LeftSidebarProps extends SlotWidthProps {
51
59
  };
52
60
  };
53
61
  /**
54
- * Display label for grab area. This will be announced to the screenreaders when the grab area receives focus
62
+ * Display label for grab area/slider to resize the left side bar. This will be rendered through assistive technologies.
55
63
  */
56
64
  resizeGrabAreaLabel?: string;
57
65
  /**
58
- * Display label for resize button.
66
+ * Display label for expand/collapse button for the left sidebar.
59
67
  */
60
68
  resizeButtonLabel?: string;
61
69
  /**
@@ -1,6 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { ComponentProps, FocusEvent, KeyboardEvent, MouseEvent } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
+ import { LeftSidebarProps } from '../../common/types';
4
5
  export type GrabAreaProps = {
5
6
  isDisabled: boolean;
6
7
  isLeftSidebarCollapsed: boolean;
@@ -11,6 +12,7 @@ export type GrabAreaProps = {
11
12
  onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;
12
13
  onMouseDown: (event: MouseEvent<HTMLButtonElement>) => void;
13
14
  testId?: string;
15
+ ref?: React.Ref<HTMLButtonElement>;
14
16
  } & ComponentProps<'button'>;
15
- declare const GrabArea: ({ testId, isDisabled, isLeftSidebarCollapsed, label, leftSidebarPercentageExpanded, onKeyDown, onMouseDown, onBlur, onFocus, ...rest }: GrabAreaProps) => jsx.JSX.Element;
17
+ declare const GrabArea: ({ testId, valueTextLabel, isDisabled, isLeftSidebarCollapsed, label, leftSidebarPercentageExpanded, onKeyDown, onMouseDown, onBlur, onFocus, ref, ...rest }: GrabAreaProps & Partial<LeftSidebarProps>) => jsx.JSX.Element;
16
18
  export default GrabArea;
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { ResizeControlProps } from './types';
3
- declare const ResizeControl: ({ testId, overrides, resizeButtonLabel, resizeGrabAreaLabel, onResizeStart, onResizeEnd, }: ResizeControlProps) => jsx.JSX.Element;
3
+ declare const ResizeControl: ({ testId, overrides, resizeButtonLabel, valueTextLabel, resizeGrabAreaLabel, onResizeStart, onResizeEnd, }: ResizeControlProps) => jsx.JSX.Element;
4
4
  export default ResizeControl;
@@ -12,6 +12,7 @@ export type ResizeControlProps = {
12
12
  render?: (Component: ElementType<ResizeButtonProps>, props: ResizeButtonProps) => ReactElement;
13
13
  };
14
14
  };
15
+ valueTextLabel?: string;
15
16
  resizeGrabAreaLabel?: string;
16
17
  resizeButtonLabel?: string;
17
18
  onCollapse?: (leftSidebarState: LeftSidebarState) => void;
@@ -42,6 +42,14 @@ export interface LeftSidebarProps extends SlotWidthProps {
42
42
  * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
43
43
  */
44
44
  testId?: string;
45
+ /**
46
+ * The `aria-valuetext` allows users relying on assistive technologies,
47
+ * particularly screen readers, to determine the purpose of the slider.
48
+ * The default value is "Width".
49
+ * The aria-valuenow property is automatically appended to the valueTextLabel.
50
+ * For Example, valueTextLabel="Width" will render aria-valuetext="Width 62%”.
51
+ */
52
+ valueTextLabel?: string;
45
53
  /**
46
54
  * You can override prop(s) for the mentioned component(s).
47
55
  */
@@ -51,11 +59,11 @@ export interface LeftSidebarProps extends SlotWidthProps {
51
59
  };
52
60
  };
53
61
  /**
54
- * Display label for grab area. This will be announced to the screenreaders when the grab area receives focus
62
+ * Display label for grab area/slider to resize the left side bar. This will be rendered through assistive technologies.
55
63
  */
56
64
  resizeGrabAreaLabel?: string;
57
65
  /**
58
- * Display label for resize button.
66
+ * Display label for expand/collapse button for the left sidebar.
59
67
  */
60
68
  resizeButtonLabel?: string;
61
69
  /**
@@ -1,6 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { ComponentProps, FocusEvent, KeyboardEvent, MouseEvent } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
+ import { LeftSidebarProps } from '../../common/types';
4
5
  export type GrabAreaProps = {
5
6
  isDisabled: boolean;
6
7
  isLeftSidebarCollapsed: boolean;
@@ -11,6 +12,7 @@ export type GrabAreaProps = {
11
12
  onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;
12
13
  onMouseDown: (event: MouseEvent<HTMLButtonElement>) => void;
13
14
  testId?: string;
15
+ ref?: React.Ref<HTMLButtonElement>;
14
16
  } & ComponentProps<'button'>;
15
- declare const GrabArea: ({ testId, isDisabled, isLeftSidebarCollapsed, label, leftSidebarPercentageExpanded, onKeyDown, onMouseDown, onBlur, onFocus, ...rest }: GrabAreaProps) => jsx.JSX.Element;
17
+ declare const GrabArea: ({ testId, valueTextLabel, isDisabled, isLeftSidebarCollapsed, label, leftSidebarPercentageExpanded, onKeyDown, onMouseDown, onBlur, onFocus, ref, ...rest }: GrabAreaProps & Partial<LeftSidebarProps>) => jsx.JSX.Element;
16
18
  export default GrabArea;
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { ResizeControlProps } from './types';
3
- declare const ResizeControl: ({ testId, overrides, resizeButtonLabel, resizeGrabAreaLabel, onResizeStart, onResizeEnd, }: ResizeControlProps) => jsx.JSX.Element;
3
+ declare const ResizeControl: ({ testId, overrides, resizeButtonLabel, valueTextLabel, resizeGrabAreaLabel, onResizeStart, onResizeEnd, }: ResizeControlProps) => jsx.JSX.Element;
4
4
  export default ResizeControl;
@@ -12,6 +12,7 @@ export type ResizeControlProps = {
12
12
  render?: (Component: ElementType<ResizeButtonProps>, props: ResizeButtonProps) => ReactElement;
13
13
  };
14
14
  };
15
+ valueTextLabel?: string;
15
16
  resizeGrabAreaLabel?: string;
16
17
  resizeButtonLabel?: string;
17
18
  onCollapse?: (leftSidebarState: LeftSidebarState) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "1.7.13",
3
+ "version": "1.8.0",
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/"
@@ -35,11 +35,11 @@
35
35
  "dependencies": {
36
36
  "@atlaskit/ds-lib": "^2.2.0",
37
37
  "@atlaskit/icon": "^21.12.0",
38
- "@atlaskit/motion": "^1.4.0",
38
+ "@atlaskit/motion": "^1.5.0",
39
39
  "@atlaskit/platform-feature-flags": "^0.2.0",
40
- "@atlaskit/primitives": "^1.4.0",
40
+ "@atlaskit/primitives": "^1.6.0",
41
41
  "@atlaskit/theme": "^12.6.0",
42
- "@atlaskit/tokens": "^1.21.0",
42
+ "@atlaskit/tokens": "^1.26.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@emotion/react": "^11.7.1",
45
45
  "bind-event-listener": "^2.1.1",
@@ -51,16 +51,15 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@af/accessibility-testing": "*",
54
- "@atlaskit/atlassian-navigation": "^2.6.0",
54
+ "@atlaskit/atlassian-navigation": "^2.8.0",
55
55
  "@atlaskit/atlassian-notifications": "^0.4.0",
56
- "@atlaskit/drawer": "^7.5.0",
57
- "@atlaskit/icon": "*",
56
+ "@atlaskit/drawer": "^7.6.0",
58
57
  "@atlaskit/logo": "^13.14.0",
59
- "@atlaskit/menu": "^1.10.0",
58
+ "@atlaskit/menu": "^2.0.0",
60
59
  "@atlaskit/notification-indicator": "^9.1.0",
61
60
  "@atlaskit/notification-log-client": "^6.1.0",
62
- "@atlaskit/popup": "^1.9.0",
63
- "@atlaskit/side-navigation": "^2.0.0",
61
+ "@atlaskit/popup": "^1.11.0",
62
+ "@atlaskit/side-navigation": "^3.0.0",
64
63
  "@atlaskit/ssr": "*",
65
64
  "@atlaskit/tooltip": "*",
66
65
  "@atlaskit/visual-regression": "*",
package/report.api.md CHANGED
@@ -83,6 +83,7 @@ interface LeftSidebarProps extends SlotWidthProps {
83
83
  resizeButtonLabel?: string;
84
84
  resizeGrabAreaLabel?: string;
85
85
  testId?: string;
86
+ valueTextLabel?: string;
86
87
  width?: number;
87
88
  }
88
89
 
@@ -62,6 +62,7 @@ interface LeftSidebarProps extends SlotWidthProps {
62
62
  resizeButtonLabel?: string;
63
63
  resizeGrabAreaLabel?: string;
64
64
  testId?: string;
65
+ valueTextLabel?: string;
65
66
  width?: number;
66
67
  }
67
68