@atlaskit/page-layout 1.3.5 → 1.3.7

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
+ ## 1.3.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7f3ff7f0081`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7f3ff7f0081) - [ux] Enhance accessibility of header for skip links component
8
+
9
+ ## 1.3.6
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 1.3.5
4
16
 
5
17
  ### Patch Changes
@@ -53,6 +53,9 @@ var skipLinkStyles = (0, _react.css)({
53
53
  transform: 'translateY(0%)'
54
54
  }
55
55
  });
56
+ var skipLinkHeadingStyles = (0, _react.css)({
57
+ fontWeight: 600
58
+ });
56
59
  var skipLinkListStyles = (0, _react.css)({
57
60
  marginTop: 4,
58
61
  paddingLeft: 0,
@@ -69,7 +72,14 @@ var assignIndex = function assignIndex(num, arr) {
69
72
  }
70
73
 
71
74
  return assignIndex(num + 1, arr);
72
- }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
75
+ };
76
+ /**
77
+ * The default label will be used when the `skipLinksLabel` attribute is not
78
+ * provided or the attribute is an empty string. If a string comprised only of
79
+ * spaces is provided, the skip link heading element will be removed, but the
80
+ * default label will still be used in `title` attribute of the skip links
81
+ * themselves.
82
+ */
73
83
 
74
84
 
75
85
  var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
@@ -126,12 +136,16 @@ var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
126
136
  return window.removeEventListener('keydown', escapeHandler, false);
127
137
  };
128
138
 
139
+ var emptyLabelOverride = !!(skipLinksLabel !== null && skipLinksLabel !== void 0 && skipLinksLabel.match(/^\s+$/));
140
+ var label = skipLinksLabel || _constants.DEFAULT_I18N_PROPS_SKIP_LINKS;
129
141
  return (0, _react.jsx)("div", {
130
142
  onFocus: attachEscHandler,
131
143
  onBlur: removeEscHandler,
132
144
  css: [skipLinkStyles, prefersReducedMotionStyles],
133
145
  "data-skip-link-wrapper": true
134
- }, (0, _react.jsx)("h5", null, skipLinksLabel), (0, _react.jsx)("ol", {
146
+ }, emptyLabelOverride ? null : (0, _react.jsx)("p", {
147
+ css: skipLinkHeadingStyles
148
+ }, label), (0, _react.jsx)("ol", {
135
149
  css: skipLinkListStyles
136
150
  }, sortSkipLinks(skipLinksData).map(function (_ref2) {
137
151
  var id = _ref2.id,
@@ -140,7 +154,7 @@ var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
140
154
  key: id,
141
155
  href: "#".concat(id),
142
156
  isFocusable: true,
143
- title: "".concat(skipLinksLabel, " ").concat(skipLinkTitle)
157
+ title: emptyLabelOverride ? "".concat(_constants.DEFAULT_I18N_PROPS_SKIP_LINKS, " ").concat(skipLinkTitle) : "".concat(label, " ").concat(skipLinkTitle)
144
158
  }, skipLinkTitle);
145
159
  })));
146
160
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,7 @@
4
4
  import { css, jsx } from '@emotion/react';
5
5
  import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
6
6
  import { N30A, N60A } from '@atlaskit/theme/colors';
7
- import { PAGE_LAYOUT_CONTAINER_SELECTOR } from '../../common/constants';
7
+ import { DEFAULT_I18N_PROPS_SKIP_LINKS, PAGE_LAYOUT_CONTAINER_SELECTOR } from '../../common/constants';
8
8
  import { useSkipLinks } from '../../controllers';
9
9
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
10
10
  const prefersReducedMotionStyles = css(prefersReducedMotion());
@@ -34,6 +34,9 @@ const skipLinkStyles = css({
34
34
  transform: 'translateY(0%)'
35
35
  }
36
36
  });
37
+ const skipLinkHeadingStyles = css({
38
+ fontWeight: 600
39
+ });
37
40
  const skipLinkListStyles = css({
38
41
  marginTop: 4,
39
42
  paddingLeft: 0,
@@ -50,7 +53,14 @@ const assignIndex = (num, arr) => {
50
53
  }
51
54
 
52
55
  return assignIndex(num + 1, arr);
53
- }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
56
+ };
57
+ /**
58
+ * The default label will be used when the `skipLinksLabel` attribute is not
59
+ * provided or the attribute is an empty string. If a string comprised only of
60
+ * spaces is provided, the skip link heading element will be removed, but the
61
+ * default label will still be used in `title` attribute of the skip links
62
+ * themselves.
63
+ */
54
64
 
55
65
 
56
66
  export const SkipLinkWrapper = ({
@@ -96,12 +106,16 @@ export const SkipLinkWrapper = ({
96
106
 
97
107
  const removeEscHandler = () => window.removeEventListener('keydown', escapeHandler, false);
98
108
 
109
+ const emptyLabelOverride = !!(skipLinksLabel !== null && skipLinksLabel !== void 0 && skipLinksLabel.match(/^\s+$/));
110
+ const label = skipLinksLabel || DEFAULT_I18N_PROPS_SKIP_LINKS;
99
111
  return jsx("div", {
100
112
  onFocus: attachEscHandler,
101
113
  onBlur: removeEscHandler,
102
114
  css: [skipLinkStyles, prefersReducedMotionStyles],
103
115
  "data-skip-link-wrapper": true
104
- }, jsx("h5", null, skipLinksLabel), jsx("ol", {
116
+ }, emptyLabelOverride ? null : jsx("p", {
117
+ css: skipLinkHeadingStyles
118
+ }, label), jsx("ol", {
105
119
  css: skipLinkListStyles
106
120
  }, sortSkipLinks(skipLinksData).map(({
107
121
  id,
@@ -110,7 +124,7 @@ export const SkipLinkWrapper = ({
110
124
  key: id,
111
125
  href: `#${id}`,
112
126
  isFocusable: true,
113
- title: `${skipLinksLabel} ${skipLinkTitle}`
127
+ title: emptyLabelOverride ? `${DEFAULT_I18N_PROPS_SKIP_LINKS} ${skipLinkTitle}` : `${label} ${skipLinkTitle}`
114
128
  }, skipLinkTitle))));
115
129
  };
116
130
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -11,7 +11,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
11
11
  import { css, jsx } from '@emotion/react';
12
12
  import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
13
13
  import { N30A, N60A } from '@atlaskit/theme/colors';
14
- import { PAGE_LAYOUT_CONTAINER_SELECTOR } from '../../common/constants';
14
+ import { DEFAULT_I18N_PROPS_SKIP_LINKS, PAGE_LAYOUT_CONTAINER_SELECTOR } from '../../common/constants';
15
15
  import { useSkipLinks } from '../../controllers';
16
16
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
17
17
  var prefersReducedMotionStyles = css(prefersReducedMotion());
@@ -41,6 +41,9 @@ var skipLinkStyles = css({
41
41
  transform: 'translateY(0%)'
42
42
  }
43
43
  });
44
+ var skipLinkHeadingStyles = css({
45
+ fontWeight: 600
46
+ });
44
47
  var skipLinkListStyles = css({
45
48
  marginTop: 4,
46
49
  paddingLeft: 0,
@@ -57,7 +60,14 @@ var assignIndex = function assignIndex(num, arr) {
57
60
  }
58
61
 
59
62
  return assignIndex(num + 1, arr);
60
- }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
63
+ };
64
+ /**
65
+ * The default label will be used when the `skipLinksLabel` attribute is not
66
+ * provided or the attribute is an empty string. If a string comprised only of
67
+ * spaces is provided, the skip link heading element will be removed, but the
68
+ * default label will still be used in `title` attribute of the skip links
69
+ * themselves.
70
+ */
61
71
 
62
72
 
63
73
  export var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
@@ -114,12 +124,16 @@ export var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
114
124
  return window.removeEventListener('keydown', escapeHandler, false);
115
125
  };
116
126
 
127
+ var emptyLabelOverride = !!(skipLinksLabel !== null && skipLinksLabel !== void 0 && skipLinksLabel.match(/^\s+$/));
128
+ var label = skipLinksLabel || DEFAULT_I18N_PROPS_SKIP_LINKS;
117
129
  return jsx("div", {
118
130
  onFocus: attachEscHandler,
119
131
  onBlur: removeEscHandler,
120
132
  css: [skipLinkStyles, prefersReducedMotionStyles],
121
133
  "data-skip-link-wrapper": true
122
- }, jsx("h5", null, skipLinksLabel), jsx("ol", {
134
+ }, emptyLabelOverride ? null : jsx("p", {
135
+ css: skipLinkHeadingStyles
136
+ }, label), jsx("ol", {
123
137
  css: skipLinkListStyles
124
138
  }, sortSkipLinks(skipLinksData).map(function (_ref2) {
125
139
  var id = _ref2.id,
@@ -128,7 +142,7 @@ export var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
128
142
  key: id,
129
143
  href: "#".concat(id),
130
144
  isFocusable: true,
131
- title: "".concat(skipLinksLabel, " ").concat(skipLinkTitle)
145
+ title: emptyLabelOverride ? "".concat(DEFAULT_I18N_PROPS_SKIP_LINKS, " ").concat(skipLinkTitle) : "".concat(label, " ").concat(skipLinkTitle)
132
146
  }, skipLinkTitle);
133
147
  })));
134
148
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "sideEffects": false
5
5
  }
@@ -2,6 +2,13 @@
2
2
  import { ReactNode } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  import { SkipLinkWrapperProps } from './types';
5
+ /**
6
+ * The default label will be used when the `skipLinksLabel` attribute is not
7
+ * provided or the attribute is an empty string. If a string comprised only of
8
+ * spaces is provided, the skip link heading element will be removed, but the
9
+ * default label will still be used in `title` attribute of the skip links
10
+ * themselves.
11
+ */
5
12
  export declare const SkipLinkWrapper: ({ skipLinksLabel }: SkipLinkWrapperProps) => jsx.JSX.Element | null;
6
13
  export declare const SkipLink: ({ href, children, isFocusable, title, }: {
7
14
  href: string;
@@ -4,5 +4,5 @@ export declare type SkipLinkData = {
4
4
  ref?: undefined;
5
5
  };
6
6
  export declare type SkipLinkWrapperProps = {
7
- skipLinksLabel: string;
7
+ skipLinksLabel?: string;
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
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/"
@@ -30,7 +30,7 @@
30
30
  "@atlaskit/icon": "^21.11.0",
31
31
  "@atlaskit/motion": "^1.3.0",
32
32
  "@atlaskit/theme": "^12.2.0",
33
- "@atlaskit/tokens": "^0.12.0",
33
+ "@atlaskit/tokens": "^0.13.0",
34
34
  "@babel/runtime": "^7.0.0",
35
35
  "@emotion/react": "^11.7.1",
36
36
  "bind-event-listener": "^2.1.1",
@@ -54,7 +54,7 @@
54
54
  "@atlaskit/onboarding": "^10.6.0",
55
55
  "@atlaskit/popup": "^1.5.0",
56
56
  "@atlaskit/section-message": "^6.3.0",
57
- "@atlaskit/side-navigation": "^1.4.0",
57
+ "@atlaskit/side-navigation": "^1.5.0",
58
58
  "@atlaskit/ssr": "*",
59
59
  "@atlaskit/tooltip": "*",
60
60
  "@atlaskit/visual-regression": "*",
package/report.api.md CHANGED
@@ -1,4 +1,4 @@
1
- <!-- API Report Version: 2.2 -->
1
+ <!-- API Report Version: 2.3 -->
2
2
 
3
3
  ## API Report File for "@atlaskit/page-layout"
4
4
 
@@ -8,6 +8,7 @@
8
8
  ### Table of contents
9
9
 
10
10
  - [Main Entry Types](#main-entry-types)
11
+ - [Peer Dependencies](#peer-dependencies)
11
12
 
12
13
  ### Main Entry Types
13
14
 
@@ -210,3 +211,16 @@ export const usePageLayoutResize: () => {
210
211
  ```
211
212
 
212
213
  <!--SECTION END: Main Entry Types-->
214
+
215
+ ### Peer Dependencies
216
+
217
+ <!--SECTION START: Peer Dependencies-->
218
+
219
+ ```json
220
+ {
221
+ "react": "^16.8.0",
222
+ "react-dom": "^16.8.0"
223
+ }
224
+ ```
225
+
226
+ <!--SECTION END: Peer Dependencies-->