@atlaskit/page-header 10.1.2 → 10.2.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,33 @@
1
1
  # @atlaskit/page-header
2
2
 
3
+ ## 10.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 10.2.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`b3893a2357b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b3893a2357b) - Fixes a styling issue that arose in v10.2.0 relating to the lineHeight of the page header's title.
14
+
15
+ ## 10.2.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [`6b76b1ceab3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6b76b1ceab3) - This change removes the dependency `styled components`. It has been refactored to use `@emotion/core` instead. Some examples have also been updated. There should be no UI or UX change.
20
+
21
+ ### Patch Changes
22
+
23
+ - [`cd34d8ca8ea`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cd34d8ca8ea) - Internal wiring up to the tokens techstack, no code changes.
24
+
25
+ ## 10.1.3
26
+
27
+ ### Patch Changes
28
+
29
+ - [`c5785203506`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c5785203506) - Updated homepage in package.json
30
+
3
31
  ## 10.1.2
4
32
 
5
33
  ### Patch Changes
@@ -11,6 +11,22 @@ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _styled = require("./styled");
13
13
 
14
+ // TODO: Remove this eslint-disable when prop names have been renamed.
15
+ // This rule is here as prop name changes are a major as they are used
16
+ // by our consumers. This can be done in the next lite-mode conversion.
17
+
18
+ /* eslint-disable @repo/internal/react/boolean-prop-naming-convention */
19
+
20
+ /**
21
+ * __Page header__
22
+ *
23
+ * A page header defines the top of a page. It contains a title and can be optionally combined with
24
+ * breadcrumbs buttons, search, and filters.
25
+ *
26
+ * - [Examples](https://atlassian.design/components/page-header/examples)
27
+ * - [Code](https://atlassian.design/components/page-header/code)
28
+ * - [Usage](https://atlassian.design/components/page-header/usage)
29
+ */
14
30
  var PageHeader = function PageHeader(_ref) {
15
31
  var innerRef = _ref.innerRef,
16
32
  breadcrumbs = _ref.breadcrumbs,
@@ -22,14 +38,13 @@ var PageHeader = function PageHeader(_ref) {
22
38
  disableTitleStyles = _ref$disableTitleStyl === void 0 ? false : _ref$disableTitleStyl,
23
39
  _ref$truncateTitle = _ref.truncateTitle,
24
40
  truncateTitle = _ref$truncateTitle === void 0 ? false : _ref$truncateTitle;
25
- return /*#__PURE__*/_react.default.createElement(_styled.Outer, null, breadcrumbs, /*#__PURE__*/_react.default.createElement(_styled.TitleWrapper, {
26
- truncate: truncateTitle
41
+ return /*#__PURE__*/_react.default.createElement(_styled.OuterWrapper, null, breadcrumbs, /*#__PURE__*/_react.default.createElement(_styled.TitleWrapper, {
42
+ truncateTitle: truncateTitle
27
43
  }, /*#__PURE__*/_react.default.createElement(_styled.TitleContainer, {
28
- truncate: truncateTitle
29
- }, disableTitleStyles ? children : /*#__PURE__*/_react.default.createElement(_styled.StyledTitle, {
30
- innerRef: innerRef,
31
- tabIndex: -1,
32
- truncate: truncateTitle,
44
+ truncateTitle: truncateTitle
45
+ }, disableTitleStyles ? children : /*#__PURE__*/_react.default.createElement(_styled.StyledTitleWrapper, {
46
+ ref: innerRef,
47
+ truncateTitle: truncateTitle,
33
48
  id: id
34
49
  }, children)), actions && /*#__PURE__*/_react.default.createElement(_styled.ActionsWrapper, null, actions)), bottomBar && /*#__PURE__*/_react.default.createElement(_styled.BottomBarWrapper, null, " ", bottomBar, " "));
35
50
  };
@@ -5,49 +5,171 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.BottomBarWrapper = exports.ActionsWrapper = exports.TitleContainer = exports.TitleWrapper = exports.StyledTitle = exports.Outer = void 0;
8
+ exports.BottomBarWrapper = exports.ActionsWrapper = exports.TitleContainer = exports.TitleWrapper = exports.StyledTitleWrapper = exports.OuterWrapper = void 0;
9
9
 
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
10
+ var _react = _interopRequireDefault(require("react"));
11
11
 
12
- var _styledComponents = _interopRequireDefault(require("styled-components"));
12
+ var _core = require("@emotion/core");
13
13
 
14
14
  var _constants = require("@atlaskit/theme/constants");
15
15
 
16
16
  var _typography = require("@atlaskit/theme/typography");
17
17
 
18
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
18
+ // TODO: Remove this eslint-disable when prop names have been renamed.
19
+ // This rule is here as prop name changes are a major as they are used
20
+ // by our consumers. The prop name concerned here is truncateTitle.
21
+ // This can be done in the next lite-mode conversion.
19
22
 
20
- var getTruncationStyles = function getTruncationStyles(_ref) {
21
- var truncate = _ref.truncate;
22
- return truncate ? "\n overflow-x: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n " : null;
23
- };
24
-
25
- var Outer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin: ", "px 0 ", "px 0;\n"])), (0, _constants.gridSize)() * 3, (0, _constants.gridSize)() * 2);
26
-
27
- exports.Outer = Outer;
23
+ /* eslint-disable @repo/internal/react/boolean-prop-naming-convention */
28
24
 
29
- var StyledTitle = _styledComponents.default.h1(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n ", " line-height: ", "px;\n margin-top: 0;\n outline: none;\n"])), (0, _typography.h700)(), getTruncationStyles, (0, _constants.gridSize)() * 4);
25
+ /** @jsx jsx */
26
+ var gridSize = (0, _constants.gridSize)();
27
+ var truncateStyles = (0, _core.css)({
28
+ overflowX: 'hidden',
29
+ textOverflow: 'ellipsis',
30
+ whiteSpace: 'nowrap'
31
+ });
32
+ var outerStyles = (0, _core.css)({
33
+ margin: "".concat(gridSize * 3, "px 0 ").concat(gridSize * 2, "px 0")
34
+ });
35
+ var styledTitleStyles = (0, _core.css)({
36
+ marginTop: 0,
37
+ lineHeight: "".concat(gridSize * 4, "px"),
38
+ outline: 'none'
39
+ });
40
+ var titleWrapperStyles = (0, _core.css)({
41
+ display: 'flex',
42
+ alignItems: 'flex-start',
43
+ flexWrap: 'wrap'
44
+ });
45
+ var titleWrapperTruncateStyles = (0, _core.css)({
46
+ flexWrap: 'nowrap'
47
+ });
48
+ var titleContainerStyles = (0, _core.css)({
49
+ minWidth: 0,
50
+ maxWidth: '100%',
51
+ marginBottom: "".concat(gridSize, "px"),
52
+ flex: '1 0 auto',
53
+ flexShrink: undefined
54
+ });
55
+ var actionStyles = (0, _core.css)({
56
+ maxWidth: '100%',
57
+ marginBottom: "".concat(gridSize, "px"),
58
+ marginLeft: 'auto',
59
+ paddingLeft: "".concat(gridSize * 4, "px"),
60
+ flex: '0 0 auto',
61
+ whiteSpace: 'nowrap',
62
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
63
+ '>': {
64
+ textAlign: 'right'
65
+ }
66
+ });
67
+ var titleContainerTruncateStyles = (0, _core.css)({
68
+ flexShrink: 1
69
+ });
70
+ var bottomBarStyles = (0, _core.css)({
71
+ marginTop: "".concat(gridSize * 2, "px")
72
+ });
73
+ /**
74
+ * __Outer wrapper__
75
+ *
76
+ * An outer wrapper that is the outermost component of the PageHeader component. It wraps around the PageHeader, its Actions,
77
+ * the BottomBar and its Breadcrumbs.
78
+ *
79
+ */
80
+
81
+ var OuterWrapper = function OuterWrapper(_ref) {
82
+ var children = _ref.children;
83
+ return (0, _core.jsx)("div", {
84
+ css: outerStyles
85
+ }, children);
86
+ }; // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
87
+
88
+
89
+ exports.OuterWrapper = OuterWrapper;
90
+ var h700Styles = (0, _core.css)((0, _typography.h700)());
91
+
92
+ /**
93
+ * __Styled title wrapper__
94
+ *
95
+ * A styled title wrapper is a wrapper around the title that controls its the styles exclusively.
96
+ *
97
+ */
98
+ var StyledTitleWrapper = /*#__PURE__*/_react.default.forwardRef(function (_ref2, ref) {
99
+ var children = _ref2.children,
100
+ id = _ref2.id,
101
+ truncateTitle = _ref2.truncateTitle;
102
+ return (0, _core.jsx)("h1", {
103
+ css: [h700Styles, styledTitleStyles, truncateTitle && truncateStyles],
104
+ ref: ref,
105
+ tabIndex: -1,
106
+ id: id
107
+ }, children);
108
+ });
30
109
 
31
- exports.StyledTitle = StyledTitle;
110
+ exports.StyledTitleWrapper = StyledTitleWrapper;
111
+
112
+ /**
113
+ * __Title wrapper__
114
+ *
115
+ * A title wrapper is a wrapper around the title and the actions.
116
+ *
117
+ */
118
+ var TitleWrapper = function TitleWrapper(_ref3) {
119
+ var children = _ref3.children,
120
+ truncateTitle = _ref3.truncateTitle;
121
+ return (0, _core.jsx)("div", {
122
+ css: [titleWrapperStyles, truncateTitle && titleWrapperTruncateStyles]
123
+ }, children);
124
+ };
125
+ /**
126
+ * Title container
127
+ *
128
+ * A title container is a container that wraps around the title and its styles (if applied).
129
+ *
130
+ */
32
131
 
33
- var TitleWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n align-items: flex-start;\n display: flex;\n ", "\n"])), function (_ref2) {
34
- var truncate = _ref2.truncate;
35
- return truncate ? 'flex-wrap: no-wrap;' : 'flex-wrap: wrap;';
36
- });
37
132
 
38
133
  exports.TitleWrapper = TitleWrapper;
39
134
 
40
- var TitleContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n flex: 1 0 auto;\n ", "\n margin-bottom: ", "px;\n max-width: 100%;\n min-width: 0;\n"])), function (_ref3) {
41
- var truncate = _ref3.truncate;
42
- return truncate ? 'flex-shrink: 1;' : null;
43
- }, (0, _constants.gridSize)());
135
+ var TitleContainer = function TitleContainer(_ref4) {
136
+ var children = _ref4.children,
137
+ truncateTitle = _ref4.truncateTitle;
138
+ return (0, _core.jsx)("div", {
139
+ css: [titleContainerStyles, truncateTitle && titleContainerTruncateStyles]
140
+ }, children);
141
+ };
142
+ /**
143
+ * __Actions wrapper__
144
+ *
145
+ * An actions wrapper is a wrapper for the actions, which appear on the top right of the PageHeader component.
146
+ *
147
+ */
148
+
44
149
 
45
150
  exports.TitleContainer = TitleContainer;
46
151
 
47
- var ActionsWrapper = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n flex: 0 0 auto;\n margin-bottom: ", "px;\n margin-left: auto;\n max-width: 100%;\n padding-left: ", "px;\n white-space: nowrap;\n\n > {\n text-align: right;\n }\n"])), (0, _constants.gridSize)(), (0, _constants.gridSize)() * 4);
152
+ var ActionsWrapper = function ActionsWrapper(_ref5) {
153
+ var children = _ref5.children;
154
+ return (0, _core.jsx)("div", {
155
+ css: actionStyles
156
+ }, children);
157
+ };
158
+ /**
159
+ * __Bottom bar wrapper__
160
+ *
161
+ * A bottom bar wrapper is a wrapper for the bottom bar, which appears at the bottom of the PageHeader component.
162
+ *
163
+ */
164
+
48
165
 
49
166
  exports.ActionsWrapper = ActionsWrapper;
50
167
 
51
- var BottomBarWrapper = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n margin-top: ", "px;\n"])), (0, _constants.gridSize)() * 2);
168
+ var BottomBarWrapper = function BottomBarWrapper(_ref6) {
169
+ var children = _ref6.children;
170
+ return (0, _core.jsx)("div", {
171
+ css: bottomBarStyles
172
+ }, children);
173
+ };
52
174
 
53
175
  exports.BottomBarWrapper = BottomBarWrapper;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/page-header",
3
- "version": "10.1.2",
3
+ "version": "10.2.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,21 @@
1
+ // TODO: Remove this eslint-disable when prop names have been renamed.
2
+ // This rule is here as prop name changes are a major as they are used
3
+ // by our consumers. This can be done in the next lite-mode conversion.
4
+
5
+ /* eslint-disable @repo/internal/react/boolean-prop-naming-convention */
1
6
  import React from 'react';
2
- import { ActionsWrapper, BottomBarWrapper, Outer, StyledTitle, TitleContainer, TitleWrapper } from './styled';
7
+ import { ActionsWrapper, BottomBarWrapper, OuterWrapper, StyledTitleWrapper, TitleContainer, TitleWrapper } from './styled';
3
8
 
9
+ /**
10
+ * __Page header__
11
+ *
12
+ * A page header defines the top of a page. It contains a title and can be optionally combined with
13
+ * breadcrumbs buttons, search, and filters.
14
+ *
15
+ * - [Examples](https://atlassian.design/components/page-header/examples)
16
+ * - [Code](https://atlassian.design/components/page-header/code)
17
+ * - [Usage](https://atlassian.design/components/page-header/usage)
18
+ */
4
19
  const PageHeader = ({
5
20
  innerRef,
6
21
  breadcrumbs,
@@ -11,14 +26,13 @@ const PageHeader = ({
11
26
  disableTitleStyles = false,
12
27
  truncateTitle = false
13
28
  }) => {
14
- return /*#__PURE__*/React.createElement(Outer, null, breadcrumbs, /*#__PURE__*/React.createElement(TitleWrapper, {
15
- truncate: truncateTitle
29
+ return /*#__PURE__*/React.createElement(OuterWrapper, null, breadcrumbs, /*#__PURE__*/React.createElement(TitleWrapper, {
30
+ truncateTitle: truncateTitle
16
31
  }, /*#__PURE__*/React.createElement(TitleContainer, {
17
- truncate: truncateTitle
18
- }, disableTitleStyles ? children : /*#__PURE__*/React.createElement(StyledTitle, {
19
- innerRef: innerRef,
20
- tabIndex: -1,
21
- truncate: truncateTitle,
32
+ truncateTitle: truncateTitle
33
+ }, disableTitleStyles ? children : /*#__PURE__*/React.createElement(StyledTitleWrapper, {
34
+ ref: innerRef,
35
+ truncateTitle: truncateTitle,
22
36
  id: id
23
37
  }, children)), actions && /*#__PURE__*/React.createElement(ActionsWrapper, null, actions)), bottomBar && /*#__PURE__*/React.createElement(BottomBarWrapper, null, " ", bottomBar, " "));
24
38
  };
@@ -1,52 +1,153 @@
1
- import styled from 'styled-components';
2
- import { gridSize } from '@atlaskit/theme/constants';
3
- import { h700 } from '@atlaskit/theme/typography';
1
+ // TODO: Remove this eslint-disable when prop names have been renamed.
2
+ // This rule is here as prop name changes are a major as they are used
3
+ // by our consumers. The prop name concerned here is truncateTitle.
4
+ // This can be done in the next lite-mode conversion.
5
+
6
+ /* eslint-disable @repo/internal/react/boolean-prop-naming-convention */
4
7
 
5
- const getTruncationStyles = ({
6
- truncate
7
- }) => truncate ? `
8
- overflow-x: hidden;
9
- text-overflow: ellipsis;
10
- white-space: nowrap;
11
- ` : null;
12
-
13
- export const Outer = styled.div`
14
- margin: ${gridSize() * 3}px 0 ${gridSize() * 2}px 0;
15
- `;
16
- export const StyledTitle = styled.h1`
17
- ${h700()};
18
- ${getTruncationStyles} line-height: ${gridSize() * 4}px;
19
- margin-top: 0;
20
- outline: none;
21
- `;
22
- export const TitleWrapper = styled.div`
23
- align-items: flex-start;
24
- display: flex;
25
- ${({
26
- truncate
27
- }) => truncate ? 'flex-wrap: no-wrap;' : 'flex-wrap: wrap;'}
28
- `;
29
- export const TitleContainer = styled.div`
30
- flex: 1 0 auto;
31
- ${({
32
- truncate
33
- }) => truncate ? 'flex-shrink: 1;' : null}
34
- margin-bottom: ${gridSize()}px;
35
- max-width: 100%;
36
- min-width: 0;
37
- `;
38
- export const ActionsWrapper = styled.div`
39
- flex: 0 0 auto;
40
- margin-bottom: ${gridSize()}px;
41
- margin-left: auto;
42
- max-width: 100%;
43
- padding-left: ${gridSize() * 4}px;
44
- white-space: nowrap;
45
-
46
- > {
47
- text-align: right;
8
+ /** @jsx jsx */
9
+ import React from 'react';
10
+ import { css, jsx } from '@emotion/core';
11
+ import { gridSize as getGridSize } from '@atlaskit/theme/constants';
12
+ import { h700 } from '@atlaskit/theme/typography';
13
+ const gridSize = getGridSize();
14
+ const truncateStyles = css({
15
+ overflowX: 'hidden',
16
+ textOverflow: 'ellipsis',
17
+ whiteSpace: 'nowrap'
18
+ });
19
+ const outerStyles = css({
20
+ margin: `${gridSize * 3}px 0 ${gridSize * 2}px 0`
21
+ });
22
+ const styledTitleStyles = css({
23
+ marginTop: 0,
24
+ lineHeight: `${gridSize * 4}px`,
25
+ outline: 'none'
26
+ });
27
+ const titleWrapperStyles = css({
28
+ display: 'flex',
29
+ alignItems: 'flex-start',
30
+ flexWrap: 'wrap'
31
+ });
32
+ const titleWrapperTruncateStyles = css({
33
+ flexWrap: 'nowrap'
34
+ });
35
+ const titleContainerStyles = css({
36
+ minWidth: 0,
37
+ maxWidth: '100%',
38
+ marginBottom: `${gridSize}px`,
39
+ flex: '1 0 auto',
40
+ flexShrink: undefined
41
+ });
42
+ const actionStyles = css({
43
+ maxWidth: '100%',
44
+ marginBottom: `${gridSize}px`,
45
+ marginLeft: 'auto',
46
+ paddingLeft: `${gridSize * 4}px`,
47
+ flex: '0 0 auto',
48
+ whiteSpace: 'nowrap',
49
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
50
+ '>': {
51
+ textAlign: 'right'
48
52
  }
49
- `;
50
- export const BottomBarWrapper = styled.div`
51
- margin-top: ${gridSize() * 2}px;
52
- `;
53
+ });
54
+ const titleContainerTruncateStyles = css({
55
+ flexShrink: 1
56
+ });
57
+ const bottomBarStyles = css({
58
+ marginTop: `${gridSize * 2}px`
59
+ });
60
+ /**
61
+ * __Outer wrapper__
62
+ *
63
+ * An outer wrapper that is the outermost component of the PageHeader component. It wraps around the PageHeader, its Actions,
64
+ * the BottomBar and its Breadcrumbs.
65
+ *
66
+ */
67
+
68
+ export const OuterWrapper = ({
69
+ children
70
+ }) => {
71
+ return jsx("div", {
72
+ css: outerStyles
73
+ }, children);
74
+ }; // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
75
+
76
+ const h700Styles = css(h700());
77
+
78
+ /**
79
+ * __Styled title wrapper__
80
+ *
81
+ * A styled title wrapper is a wrapper around the title that controls its the styles exclusively.
82
+ *
83
+ */
84
+ export const StyledTitleWrapper = /*#__PURE__*/React.forwardRef(({
85
+ children,
86
+ id,
87
+ truncateTitle
88
+ }, ref) => {
89
+ return jsx("h1", {
90
+ css: [h700Styles, styledTitleStyles, truncateTitle && truncateStyles],
91
+ ref: ref,
92
+ tabIndex: -1,
93
+ id: id
94
+ }, children);
95
+ });
96
+
97
+ /**
98
+ * __Title wrapper__
99
+ *
100
+ * A title wrapper is a wrapper around the title and the actions.
101
+ *
102
+ */
103
+ export const TitleWrapper = ({
104
+ children,
105
+ truncateTitle
106
+ }) => {
107
+ return jsx("div", {
108
+ css: [titleWrapperStyles, truncateTitle && titleWrapperTruncateStyles]
109
+ }, children);
110
+ };
111
+ /**
112
+ * Title container
113
+ *
114
+ * A title container is a container that wraps around the title and its styles (if applied).
115
+ *
116
+ */
117
+
118
+ export const TitleContainer = ({
119
+ children,
120
+ truncateTitle
121
+ }) => {
122
+ return jsx("div", {
123
+ css: [titleContainerStyles, truncateTitle && titleContainerTruncateStyles]
124
+ }, children);
125
+ };
126
+ /**
127
+ * __Actions wrapper__
128
+ *
129
+ * An actions wrapper is a wrapper for the actions, which appear on the top right of the PageHeader component.
130
+ *
131
+ */
132
+
133
+ export const ActionsWrapper = ({
134
+ children
135
+ }) => {
136
+ return jsx("div", {
137
+ css: actionStyles
138
+ }, children);
139
+ };
140
+ /**
141
+ * __Bottom bar wrapper__
142
+ *
143
+ * A bottom bar wrapper is a wrapper for the bottom bar, which appears at the bottom of the PageHeader component.
144
+ *
145
+ */
146
+
147
+ export const BottomBarWrapper = ({
148
+ children
149
+ }) => {
150
+ return jsx("div", {
151
+ css: bottomBarStyles
152
+ }, children);
153
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/page-header",
3
- "version": "10.1.2",
3
+ "version": "10.2.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,21 @@
1
+ // TODO: Remove this eslint-disable when prop names have been renamed.
2
+ // This rule is here as prop name changes are a major as they are used
3
+ // by our consumers. This can be done in the next lite-mode conversion.
4
+
5
+ /* eslint-disable @repo/internal/react/boolean-prop-naming-convention */
1
6
  import React from 'react';
2
- import { ActionsWrapper, BottomBarWrapper, Outer, StyledTitle, TitleContainer, TitleWrapper } from './styled';
7
+ import { ActionsWrapper, BottomBarWrapper, OuterWrapper, StyledTitleWrapper, TitleContainer, TitleWrapper } from './styled';
3
8
 
9
+ /**
10
+ * __Page header__
11
+ *
12
+ * A page header defines the top of a page. It contains a title and can be optionally combined with
13
+ * breadcrumbs buttons, search, and filters.
14
+ *
15
+ * - [Examples](https://atlassian.design/components/page-header/examples)
16
+ * - [Code](https://atlassian.design/components/page-header/code)
17
+ * - [Usage](https://atlassian.design/components/page-header/usage)
18
+ */
4
19
  var PageHeader = function PageHeader(_ref) {
5
20
  var innerRef = _ref.innerRef,
6
21
  breadcrumbs = _ref.breadcrumbs,
@@ -12,14 +27,13 @@ var PageHeader = function PageHeader(_ref) {
12
27
  disableTitleStyles = _ref$disableTitleStyl === void 0 ? false : _ref$disableTitleStyl,
13
28
  _ref$truncateTitle = _ref.truncateTitle,
14
29
  truncateTitle = _ref$truncateTitle === void 0 ? false : _ref$truncateTitle;
15
- return /*#__PURE__*/React.createElement(Outer, null, breadcrumbs, /*#__PURE__*/React.createElement(TitleWrapper, {
16
- truncate: truncateTitle
30
+ return /*#__PURE__*/React.createElement(OuterWrapper, null, breadcrumbs, /*#__PURE__*/React.createElement(TitleWrapper, {
31
+ truncateTitle: truncateTitle
17
32
  }, /*#__PURE__*/React.createElement(TitleContainer, {
18
- truncate: truncateTitle
19
- }, disableTitleStyles ? children : /*#__PURE__*/React.createElement(StyledTitle, {
20
- innerRef: innerRef,
21
- tabIndex: -1,
22
- truncate: truncateTitle,
33
+ truncateTitle: truncateTitle
34
+ }, disableTitleStyles ? children : /*#__PURE__*/React.createElement(StyledTitleWrapper, {
35
+ ref: innerRef,
36
+ truncateTitle: truncateTitle,
23
37
  id: id
24
38
  }, children)), actions && /*#__PURE__*/React.createElement(ActionsWrapper, null, actions)), bottomBar && /*#__PURE__*/React.createElement(BottomBarWrapper, null, " ", bottomBar, " "));
25
39
  };
@@ -1,25 +1,147 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
1
+ // TODO: Remove this eslint-disable when prop names have been renamed.
2
+ // This rule is here as prop name changes are a major as they are used
3
+ // by our consumers. The prop name concerned here is truncateTitle.
4
+ // This can be done in the next lite-mode conversion.
2
5
 
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
6
+ /* eslint-disable @repo/internal/react/boolean-prop-naming-convention */
4
7
 
5
- import styled from 'styled-components';
6
- import { gridSize } from '@atlaskit/theme/constants';
8
+ /** @jsx jsx */
9
+ import React from 'react';
10
+ import { css, jsx } from '@emotion/core';
11
+ import { gridSize as getGridSize } from '@atlaskit/theme/constants';
7
12
  import { h700 } from '@atlaskit/theme/typography';
13
+ var gridSize = getGridSize();
14
+ var truncateStyles = css({
15
+ overflowX: 'hidden',
16
+ textOverflow: 'ellipsis',
17
+ whiteSpace: 'nowrap'
18
+ });
19
+ var outerStyles = css({
20
+ margin: "".concat(gridSize * 3, "px 0 ").concat(gridSize * 2, "px 0")
21
+ });
22
+ var styledTitleStyles = css({
23
+ marginTop: 0,
24
+ lineHeight: "".concat(gridSize * 4, "px"),
25
+ outline: 'none'
26
+ });
27
+ var titleWrapperStyles = css({
28
+ display: 'flex',
29
+ alignItems: 'flex-start',
30
+ flexWrap: 'wrap'
31
+ });
32
+ var titleWrapperTruncateStyles = css({
33
+ flexWrap: 'nowrap'
34
+ });
35
+ var titleContainerStyles = css({
36
+ minWidth: 0,
37
+ maxWidth: '100%',
38
+ marginBottom: "".concat(gridSize, "px"),
39
+ flex: '1 0 auto',
40
+ flexShrink: undefined
41
+ });
42
+ var actionStyles = css({
43
+ maxWidth: '100%',
44
+ marginBottom: "".concat(gridSize, "px"),
45
+ marginLeft: 'auto',
46
+ paddingLeft: "".concat(gridSize * 4, "px"),
47
+ flex: '0 0 auto',
48
+ whiteSpace: 'nowrap',
49
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
50
+ '>': {
51
+ textAlign: 'right'
52
+ }
53
+ });
54
+ var titleContainerTruncateStyles = css({
55
+ flexShrink: 1
56
+ });
57
+ var bottomBarStyles = css({
58
+ marginTop: "".concat(gridSize * 2, "px")
59
+ });
60
+ /**
61
+ * __Outer wrapper__
62
+ *
63
+ * An outer wrapper that is the outermost component of the PageHeader component. It wraps around the PageHeader, its Actions,
64
+ * the BottomBar and its Breadcrumbs.
65
+ *
66
+ */
67
+
68
+ export var OuterWrapper = function OuterWrapper(_ref) {
69
+ var children = _ref.children;
70
+ return jsx("div", {
71
+ css: outerStyles
72
+ }, children);
73
+ }; // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
74
+
75
+ var h700Styles = css(h700());
76
+
77
+ /**
78
+ * __Styled title wrapper__
79
+ *
80
+ * A styled title wrapper is a wrapper around the title that controls its the styles exclusively.
81
+ *
82
+ */
83
+ export var StyledTitleWrapper = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
84
+ var children = _ref2.children,
85
+ id = _ref2.id,
86
+ truncateTitle = _ref2.truncateTitle;
87
+ return jsx("h1", {
88
+ css: [h700Styles, styledTitleStyles, truncateTitle && truncateStyles],
89
+ ref: ref,
90
+ tabIndex: -1,
91
+ id: id
92
+ }, children);
93
+ });
94
+
95
+ /**
96
+ * __Title wrapper__
97
+ *
98
+ * A title wrapper is a wrapper around the title and the actions.
99
+ *
100
+ */
101
+ export var TitleWrapper = function TitleWrapper(_ref3) {
102
+ var children = _ref3.children,
103
+ truncateTitle = _ref3.truncateTitle;
104
+ return jsx("div", {
105
+ css: [titleWrapperStyles, truncateTitle && titleWrapperTruncateStyles]
106
+ }, children);
107
+ };
108
+ /**
109
+ * Title container
110
+ *
111
+ * A title container is a container that wraps around the title and its styles (if applied).
112
+ *
113
+ */
114
+
115
+ export var TitleContainer = function TitleContainer(_ref4) {
116
+ var children = _ref4.children,
117
+ truncateTitle = _ref4.truncateTitle;
118
+ return jsx("div", {
119
+ css: [titleContainerStyles, truncateTitle && titleContainerTruncateStyles]
120
+ }, children);
121
+ };
122
+ /**
123
+ * __Actions wrapper__
124
+ *
125
+ * An actions wrapper is a wrapper for the actions, which appear on the top right of the PageHeader component.
126
+ *
127
+ */
8
128
 
9
- var getTruncationStyles = function getTruncationStyles(_ref) {
10
- var truncate = _ref.truncate;
11
- return truncate ? "\n overflow-x: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n " : null;
129
+ export var ActionsWrapper = function ActionsWrapper(_ref5) {
130
+ var children = _ref5.children;
131
+ return jsx("div", {
132
+ css: actionStyles
133
+ }, children);
12
134
  };
135
+ /**
136
+ * __Bottom bar wrapper__
137
+ *
138
+ * A bottom bar wrapper is a wrapper for the bottom bar, which appears at the bottom of the PageHeader component.
139
+ *
140
+ */
13
141
 
14
- export var Outer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: ", "px 0 ", "px 0;\n"])), gridSize() * 3, gridSize() * 2);
15
- export var StyledTitle = styled.h1(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", ";\n ", " line-height: ", "px;\n margin-top: 0;\n outline: none;\n"])), h700(), getTruncationStyles, gridSize() * 4);
16
- export var TitleWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n align-items: flex-start;\n display: flex;\n ", "\n"])), function (_ref2) {
17
- var truncate = _ref2.truncate;
18
- return truncate ? 'flex-wrap: no-wrap;' : 'flex-wrap: wrap;';
19
- });
20
- export var TitleContainer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n flex: 1 0 auto;\n ", "\n margin-bottom: ", "px;\n max-width: 100%;\n min-width: 0;\n"])), function (_ref3) {
21
- var truncate = _ref3.truncate;
22
- return truncate ? 'flex-shrink: 1;' : null;
23
- }, gridSize());
24
- export var ActionsWrapper = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n margin-bottom: ", "px;\n margin-left: auto;\n max-width: 100%;\n padding-left: ", "px;\n white-space: nowrap;\n\n > {\n text-align: right;\n }\n"])), gridSize(), gridSize() * 4);
25
- export var BottomBarWrapper = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-top: ", "px;\n"])), gridSize() * 2);
142
+ export var BottomBarWrapper = function BottomBarWrapper(_ref6) {
143
+ var children = _ref6.children;
144
+ return jsx("div", {
145
+ css: bottomBarStyles
146
+ }, children);
147
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/page-header",
3
- "version": "10.1.2",
3
+ "version": "10.2.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,21 +1,47 @@
1
1
  import { ReactElement, ReactNode } from 'react';
2
- declare type Props = {
3
- /** Contents of the action bar to be rendered next to the page title. */
2
+ export declare type PageHeaderProps = {
3
+ /**
4
+ * Contents of the action bar to be rendered next to the page title.
5
+ */
4
6
  actions?: ReactElement;
5
- /** Contents of the action bar to be rendered next to the page title. Typically a button group. */
7
+ /**
8
+ * Contents of the action bar to be rendered next to the page title. Typically a button group.
9
+ */
6
10
  bottomBar?: ReactElement;
7
- /** Page breadcrumbs to be rendered above the title. */
11
+ /**
12
+ * Page breadcrumbs to be rendered above the title.
13
+ */
8
14
  breadcrumbs?: ReactElement;
9
- /** Contents of the bottom bar to be rendered below the page title. Typically contains a search bar and/or filters. */
15
+ /**
16
+ * Contents of the bottom bar to be rendered below the page title. Typically contains a search bar and/or filters.
17
+ */
10
18
  children?: ReactNode;
11
- /** Content of the page title. The text wraps by default. */
19
+ /**
20
+ * Content of the page title. The text wraps by default.
21
+ */
12
22
  disableTitleStyles?: boolean;
13
- /** Returns the inner ref to the DOM element of the title. This is exposed so the focus can be set. */
23
+ /**
24
+ * Returns the inner ref to the DOM element of the title. This is exposed so the focus can be set.
25
+ */
14
26
  innerRef?: (element: HTMLElement) => void;
15
- /** Prevent the title from wrapping across lines. This should be avoided. */
27
+ /**
28
+ * Prevent the title from wrapping across lines. This should be avoided.
29
+ */
16
30
  truncateTitle?: boolean;
17
- /** Used as id of inner h1 tag. This is exposed so the header text can be used as label of other element by aria-labeledby */
31
+ /**
32
+ * Used as id of inner h1 tag. This is exposed so the header text can be used as label of other element by aria-labeledby
33
+ */
18
34
  id?: string;
19
35
  };
20
- declare const PageHeader: ({ innerRef, breadcrumbs, actions, bottomBar, children, id, disableTitleStyles, truncateTitle, }: Props) => JSX.Element;
36
+ /**
37
+ * __Page header__
38
+ *
39
+ * A page header defines the top of a page. It contains a title and can be optionally combined with
40
+ * breadcrumbs buttons, search, and filters.
41
+ *
42
+ * - [Examples](https://atlassian.design/components/page-header/examples)
43
+ * - [Code](https://atlassian.design/components/page-header/code)
44
+ * - [Usage](https://atlassian.design/components/page-header/usage)
45
+ */
46
+ declare const PageHeader: ({ innerRef, breadcrumbs, actions, bottomBar, children, id, disableTitleStyles, truncateTitle, }: PageHeaderProps) => JSX.Element;
21
47
  export default PageHeader;
@@ -1,11 +1,54 @@
1
- /// <reference types="react" />
2
- interface StyledProps {
3
- truncate?: boolean;
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ /**
4
+ * __Outer wrapper__
5
+ *
6
+ * An outer wrapper that is the outermost component of the PageHeader component. It wraps around the PageHeader, its Actions,
7
+ * the BottomBar and its Breadcrumbs.
8
+ *
9
+ */
10
+ export declare const OuterWrapper: React.FC<React.ReactNode>;
11
+ interface StyledTitleWrapperProps {
12
+ children?: React.ReactNode;
13
+ id?: string;
14
+ truncateTitle?: boolean;
4
15
  }
5
- export declare const Outer: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
6
- export declare const StyledTitle: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLHeadingElement> & import("react").HTMLAttributes<HTMLHeadingElement> & StyledProps, any, import("react").ClassAttributes<HTMLHeadingElement> & import("react").HTMLAttributes<HTMLHeadingElement> & StyledProps>;
7
- export declare const TitleWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyledProps, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyledProps>;
8
- export declare const TitleContainer: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyledProps, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyledProps>;
9
- export declare const ActionsWrapper: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
10
- export declare const BottomBarWrapper: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
16
+ /**
17
+ * __Styled title wrapper__
18
+ *
19
+ * A styled title wrapper is a wrapper around the title that controls its the styles exclusively.
20
+ *
21
+ */
22
+ export declare const StyledTitleWrapper: React.ForwardRefExoticComponent<StyledTitleWrapperProps & React.RefAttributes<HTMLHeadingElement>>;
23
+ interface TitleProps {
24
+ truncateTitle?: boolean;
25
+ }
26
+ /**
27
+ * __Title wrapper__
28
+ *
29
+ * A title wrapper is a wrapper around the title and the actions.
30
+ *
31
+ */
32
+ export declare const TitleWrapper: React.FC<TitleProps>;
33
+ /**
34
+ * Title container
35
+ *
36
+ * A title container is a container that wraps around the title and its styles (if applied).
37
+ *
38
+ */
39
+ export declare const TitleContainer: React.FC<TitleProps>;
40
+ /**
41
+ * __Actions wrapper__
42
+ *
43
+ * An actions wrapper is a wrapper for the actions, which appear on the top right of the PageHeader component.
44
+ *
45
+ */
46
+ export declare const ActionsWrapper: React.FC;
47
+ /**
48
+ * __Bottom bar wrapper__
49
+ *
50
+ * A bottom bar wrapper is a wrapper for the bottom bar, which appears at the bottom of the PageHeader component.
51
+ *
52
+ */
53
+ export declare const BottomBarWrapper: React.FC;
11
54
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/page-header",
3
- "version": "10.1.2",
3
+ "version": "10.2.2",
4
4
  "description": "A page header defines the top of a page. It contains a title and can be optionally combined with breadcrumbs buttons, search, and filters.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -13,11 +13,10 @@
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
15
  "sideEffects": false,
16
- "atlaskit:src": "src/index.ts",
17
- "atlaskit:designLink": "https://atlassian.design/patterns/page-header",
16
+ "atlaskit:src": "src/index.tsx",
17
+ "homepage": "https://atlassian.design/components/page-header",
18
18
  "atlassian": {
19
19
  "team": "Design System Team",
20
- "deprecatedAutoEntryPoints": true,
21
20
  "inPublicMirror": true,
22
21
  "releaseModel": "scheduled",
23
22
  "website": {
@@ -25,24 +24,25 @@
25
24
  }
26
25
  },
27
26
  "dependencies": {
28
- "@atlaskit/theme": "^11.4.0",
29
- "@babel/runtime": "^7.0.0"
27
+ "@atlaskit/theme": "^12.0.0",
28
+ "@babel/runtime": "^7.0.0",
29
+ "@emotion/core": "^10.0.9"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": "^16.8.0",
33
- "react-dom": "^16.8.0",
34
- "styled-components": "^3.2.6"
33
+ "react-dom": "^16.8.0"
35
34
  },
36
35
  "devDependencies": {
37
36
  "@atlaskit/breadcrumbs": "^11.3.0",
38
37
  "@atlaskit/build-utils": "*",
39
- "@atlaskit/button": "^16.0.0",
38
+ "@atlaskit/button": "^16.1.0",
40
39
  "@atlaskit/docs": "*",
41
- "@atlaskit/inline-edit": "^12.0.0",
40
+ "@atlaskit/inline-edit": "^12.1.0",
42
41
  "@atlaskit/page": "^12.0.0",
42
+ "@atlaskit/section-message": "^6.1.0",
43
43
  "@atlaskit/select": "^15.0.0",
44
44
  "@atlaskit/ssr": "*",
45
- "@atlaskit/textfield": "^5.0.0",
45
+ "@atlaskit/textfield": "^5.1.0",
46
46
  "@atlaskit/visual-regression": "*",
47
47
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
48
48
  "enzyme": "^3.10.0",
@@ -58,7 +58,20 @@
58
58
  "techstack": {
59
59
  "@atlassian/frontend": {
60
60
  "import-structure": "atlassian-conventions"
61
+ },
62
+ "@repo/internal": {
63
+ "analytics": "analytics-next",
64
+ "theming": [
65
+ "new-theming-api",
66
+ "tokens"
67
+ ],
68
+ "styling": "emotion",
69
+ "design-system": "v1",
70
+ "deprecation": "no-deprecated-imports"
61
71
  }
62
72
  },
73
+ "af:exports": {
74
+ ".": "./src/index.tsx"
75
+ },
63
76
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
64
77
  }