baseui 0.0.0-next-f3c2f6a → 0.0.0-next-48fd521
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/drawer/close-icon.js +3 -2
- package/drawer/close-icon.js.flow +2 -2
- package/drawer/drawer.js +3 -1
- package/drawer/drawer.js.flow +1 -1
- package/es/drawer/close-icon.js +3 -2
- package/es/drawer/drawer.js +3 -1
- package/es/list/list-heading.js +17 -6
- package/esm/drawer/close-icon.js +3 -2
- package/esm/drawer/drawer.js +3 -1
- package/esm/list/list-heading.js +17 -6
- package/list/index.d.ts +36 -0
- package/list/list-heading.js +24 -7
- package/list/list-heading.js.flow +17 -8
- package/package.json +1 -1
package/drawer/close-icon.js
CHANGED
|
@@ -23,9 +23,10 @@ Copyright (c) Uber Technologies, Inc.
|
|
|
23
23
|
This source code is licensed under the MIT license found in the
|
|
24
24
|
LICENSE file in the root directory of this source tree.
|
|
25
25
|
*/
|
|
26
|
-
function CloseIcon() {
|
|
26
|
+
function CloseIcon(props) {
|
|
27
27
|
return /*#__PURE__*/React.createElement(_delete.default, {
|
|
28
28
|
size: "inherit",
|
|
29
|
-
color: "inherit"
|
|
29
|
+
color: "inherit",
|
|
30
|
+
title: props.title
|
|
30
31
|
});
|
|
31
32
|
}
|
|
@@ -8,8 +8,8 @@ LICENSE file in the root directory of this source tree.
|
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
import Delete from '../icon/delete.js';
|
|
10
10
|
|
|
11
|
-
export function CloseIcon() {
|
|
12
|
-
return <Delete size="inherit" color="inherit" />;
|
|
11
|
+
export function CloseIcon(props: {title: string}) {
|
|
12
|
+
return <Delete size="inherit" color="inherit" title={props.title} />;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
declare var __DEV__: boolean;
|
package/drawer/drawer.js
CHANGED
|
@@ -354,7 +354,9 @@ var Drawer = /*#__PURE__*/function (_React$Component) {
|
|
|
354
354
|
}, sharedProps, closeProps, {
|
|
355
355
|
onFocus: (0, _focusVisible.forkFocus)(closeProps, _this3.handleFocus),
|
|
356
356
|
onBlur: (0, _focusVisible.forkBlur)(closeProps, _this3.handleBlur)
|
|
357
|
-
}), /*#__PURE__*/React.createElement(_closeIcon.CloseIcon,
|
|
357
|
+
}), /*#__PURE__*/React.createElement(_closeIcon.CloseIcon, {
|
|
358
|
+
title: locale.drawer.close
|
|
359
|
+
})) : null)));
|
|
358
360
|
});
|
|
359
361
|
}
|
|
360
362
|
}, {
|
package/drawer/drawer.js.flow
CHANGED
|
@@ -278,7 +278,7 @@ class Drawer extends React.Component<DrawerPropsT, DrawerStateT> {
|
|
|
278
278
|
onFocus={forkFocus(closeProps, this.handleFocus)}
|
|
279
279
|
onBlur={forkBlur(closeProps, this.handleBlur)}
|
|
280
280
|
>
|
|
281
|
-
<CloseIcon />
|
|
281
|
+
<CloseIcon title={locale.drawer.close} />
|
|
282
282
|
</Close>
|
|
283
283
|
) : null}
|
|
284
284
|
</DrawerContainer>
|
package/es/drawer/close-icon.js
CHANGED
|
@@ -6,9 +6,10 @@ LICENSE file in the root directory of this source tree.
|
|
|
6
6
|
*/
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import Delete from '../icon/delete.js';
|
|
9
|
-
export function CloseIcon() {
|
|
9
|
+
export function CloseIcon(props) {
|
|
10
10
|
return /*#__PURE__*/React.createElement(Delete, {
|
|
11
11
|
size: "inherit",
|
|
12
|
-
color: "inherit"
|
|
12
|
+
color: "inherit",
|
|
13
|
+
title: props.title
|
|
13
14
|
});
|
|
14
15
|
}
|
package/es/drawer/drawer.js
CHANGED
|
@@ -264,7 +264,9 @@ class Drawer extends React.Component {
|
|
|
264
264
|
}, sharedProps, closeProps, {
|
|
265
265
|
onFocus: forkFocus(closeProps, this.handleFocus),
|
|
266
266
|
onBlur: forkBlur(closeProps, this.handleBlur)
|
|
267
|
-
}), /*#__PURE__*/React.createElement(CloseIcon,
|
|
267
|
+
}), /*#__PURE__*/React.createElement(CloseIcon, {
|
|
268
|
+
title: locale.drawer.close
|
|
269
|
+
})) : null)));
|
|
268
270
|
});
|
|
269
271
|
}
|
|
270
272
|
|
package/es/list/list-heading.js
CHANGED
|
@@ -7,7 +7,7 @@ This source code is licensed under the MIT license found in the
|
|
|
7
7
|
LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import ReactIs from 'react-is';
|
|
10
|
+
import * as ReactIs from 'react-is';
|
|
11
11
|
import { getOverrides } from '../helpers/overrides.js';
|
|
12
12
|
import { StyledHeadingRoot, StyledHeadingContent, StyledHeadingContentRow, StyledHeadingEndEnhancerContainer, StyledHeadingEndEnhancerDescriptionContainer, StyledHeadingMainHeading, StyledHeadingSubHeading } from './styled-components.js';
|
|
13
13
|
|
|
@@ -35,9 +35,14 @@ function RenderNode(props) {
|
|
|
35
35
|
return Component;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
function isMaxLinesValid(maxLines) {
|
|
39
|
+
return maxLines === 1 || maxLines === 2;
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
const ListHeading = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
39
43
|
const {
|
|
40
|
-
overrides = {}
|
|
44
|
+
overrides = {},
|
|
45
|
+
maxLines
|
|
41
46
|
} = props;
|
|
42
47
|
const EndEnhancer = props.endEnhancer;
|
|
43
48
|
const EndEnhancerDescription = props.endEnhancerDescription;
|
|
@@ -50,15 +55,21 @@ const ListHeading = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
50
55
|
const [EndEnhancerDescriptionContainer, endEnhancerDescriptionContainerProps] = getOverrides(overrides.EndEnhancerDescriptionContainer, StyledHeadingEndEnhancerDescriptionContainer);
|
|
51
56
|
const isEndEnhancerString = typeof EndEnhancer === 'string';
|
|
52
57
|
|
|
53
|
-
if (
|
|
54
|
-
|
|
58
|
+
if (process.env.NODE_ENV !== "production") {
|
|
59
|
+
if (isEndEnhancerString && EndEnhancerDescription) {
|
|
60
|
+
console.warn('endEnhancerDescription will not be rendered if endEnhancer is not a string');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (maxLines && !isMaxLinesValid(maxLines)) {
|
|
64
|
+
console.warn('maxLines must be 1 or 2.');
|
|
65
|
+
}
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
return /*#__PURE__*/React.createElement(Root // eslint-disable-next-line flowtype/no-weak-types
|
|
58
69
|
, _extends({
|
|
59
70
|
ref: ref
|
|
60
71
|
}, rootProps), /*#__PURE__*/React.createElement(Content, contentProps, /*#__PURE__*/React.createElement(StyledHeadingContentRow, null, /*#__PURE__*/React.createElement(HeadingContainer, _extends({
|
|
61
|
-
$maxLines:
|
|
72
|
+
$maxLines: isMaxLinesValid(maxLines) ? maxLines : 1
|
|
62
73
|
}, headingContainerProps), /*#__PURE__*/React.createElement(RenderNode, {
|
|
63
74
|
component: props.heading
|
|
64
75
|
})), EndEnhancer && /*#__PURE__*/React.createElement(EndEnhancerContainer, _extends({
|
|
@@ -66,7 +77,7 @@ const ListHeading = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
66
77
|
}, endEnhancerContainerProps), /*#__PURE__*/React.createElement(RenderNode, {
|
|
67
78
|
component: EndEnhancer
|
|
68
79
|
}))), (SubHeading || EndEnhancerDescription) && /*#__PURE__*/React.createElement(StyledHeadingContentRow, null, /*#__PURE__*/React.createElement(SubHeadingContainer, _extends({
|
|
69
|
-
$maxLines:
|
|
80
|
+
$maxLines: isMaxLinesValid(maxLines) ? maxLines : 1
|
|
70
81
|
}, subHeadingContainerProps), /*#__PURE__*/React.createElement(RenderNode, {
|
|
71
82
|
component: SubHeading
|
|
72
83
|
})), EndEnhancerDescription && isEndEnhancerString && /*#__PURE__*/React.createElement(EndEnhancerDescriptionContainer, endEnhancerDescriptionContainerProps, /*#__PURE__*/React.createElement(RenderNode, {
|
package/esm/drawer/close-icon.js
CHANGED
|
@@ -6,9 +6,10 @@ LICENSE file in the root directory of this source tree.
|
|
|
6
6
|
*/
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import Delete from '../icon/delete.js';
|
|
9
|
-
export function CloseIcon() {
|
|
9
|
+
export function CloseIcon(props) {
|
|
10
10
|
return /*#__PURE__*/React.createElement(Delete, {
|
|
11
11
|
size: "inherit",
|
|
12
|
-
color: "inherit"
|
|
12
|
+
color: "inherit",
|
|
13
|
+
title: props.title
|
|
13
14
|
});
|
|
14
15
|
}
|
package/esm/drawer/drawer.js
CHANGED
|
@@ -343,7 +343,9 @@ var Drawer = /*#__PURE__*/function (_React$Component) {
|
|
|
343
343
|
}, sharedProps, closeProps, {
|
|
344
344
|
onFocus: forkFocus(closeProps, _this3.handleFocus),
|
|
345
345
|
onBlur: forkBlur(closeProps, _this3.handleBlur)
|
|
346
|
-
}), /*#__PURE__*/React.createElement(CloseIcon,
|
|
346
|
+
}), /*#__PURE__*/React.createElement(CloseIcon, {
|
|
347
|
+
title: locale.drawer.close
|
|
348
|
+
})) : null)));
|
|
347
349
|
});
|
|
348
350
|
}
|
|
349
351
|
}, {
|
package/esm/list/list-heading.js
CHANGED
|
@@ -23,7 +23,7 @@ This source code is licensed under the MIT license found in the
|
|
|
23
23
|
LICENSE file in the root directory of this source tree.
|
|
24
24
|
*/
|
|
25
25
|
import React from 'react';
|
|
26
|
-
import ReactIs from 'react-is';
|
|
26
|
+
import * as ReactIs from 'react-is';
|
|
27
27
|
import { getOverrides } from '../helpers/overrides.js';
|
|
28
28
|
import { StyledHeadingRoot, StyledHeadingContent, StyledHeadingContentRow, StyledHeadingEndEnhancerContainer, StyledHeadingEndEnhancerDescriptionContainer, StyledHeadingMainHeading, StyledHeadingSubHeading } from './styled-components.js';
|
|
29
29
|
|
|
@@ -50,9 +50,14 @@ function RenderNode(props) {
|
|
|
50
50
|
return Component;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
function isMaxLinesValid(maxLines) {
|
|
54
|
+
return maxLines === 1 || maxLines === 2;
|
|
55
|
+
}
|
|
56
|
+
|
|
53
57
|
var ListHeading = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
54
58
|
var _props$overrides = props.overrides,
|
|
55
|
-
overrides = _props$overrides === void 0 ? {} : _props$overrides
|
|
59
|
+
overrides = _props$overrides === void 0 ? {} : _props$overrides,
|
|
60
|
+
maxLines = props.maxLines;
|
|
56
61
|
var EndEnhancer = props.endEnhancer;
|
|
57
62
|
var EndEnhancerDescription = props.endEnhancerDescription;
|
|
58
63
|
var SubHeading = props.subHeading;
|
|
@@ -89,15 +94,21 @@ var ListHeading = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
89
94
|
|
|
90
95
|
var isEndEnhancerString = typeof EndEnhancer === 'string';
|
|
91
96
|
|
|
92
|
-
if (
|
|
93
|
-
|
|
97
|
+
if (process.env.NODE_ENV !== "production") {
|
|
98
|
+
if (isEndEnhancerString && EndEnhancerDescription) {
|
|
99
|
+
console.warn('endEnhancerDescription will not be rendered if endEnhancer is not a string');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (maxLines && !isMaxLinesValid(maxLines)) {
|
|
103
|
+
console.warn('maxLines must be 1 or 2.');
|
|
104
|
+
}
|
|
94
105
|
}
|
|
95
106
|
|
|
96
107
|
return /*#__PURE__*/React.createElement(Root // eslint-disable-next-line flowtype/no-weak-types
|
|
97
108
|
, _extends({
|
|
98
109
|
ref: ref
|
|
99
110
|
}, rootProps), /*#__PURE__*/React.createElement(Content, contentProps, /*#__PURE__*/React.createElement(StyledHeadingContentRow, null, /*#__PURE__*/React.createElement(HeadingContainer, _extends({
|
|
100
|
-
$maxLines:
|
|
111
|
+
$maxLines: isMaxLinesValid(maxLines) ? maxLines : 1
|
|
101
112
|
}, headingContainerProps), /*#__PURE__*/React.createElement(RenderNode, {
|
|
102
113
|
component: props.heading
|
|
103
114
|
})), EndEnhancer && /*#__PURE__*/React.createElement(EndEnhancerContainer, _extends({
|
|
@@ -105,7 +116,7 @@ var ListHeading = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
105
116
|
}, endEnhancerContainerProps), /*#__PURE__*/React.createElement(RenderNode, {
|
|
106
117
|
component: EndEnhancer
|
|
107
118
|
}))), (SubHeading || EndEnhancerDescription) && /*#__PURE__*/React.createElement(StyledHeadingContentRow, null, /*#__PURE__*/React.createElement(SubHeadingContainer, _extends({
|
|
108
|
-
$maxLines:
|
|
119
|
+
$maxLines: isMaxLinesValid(maxLines) ? maxLines : 1
|
|
109
120
|
}, subHeadingContainerProps), /*#__PURE__*/React.createElement(RenderNode, {
|
|
110
121
|
component: SubHeading
|
|
111
122
|
})), EndEnhancerDescription && isEndEnhancerString && /*#__PURE__*/React.createElement(EndEnhancerDescriptionContainer, endEnhancerDescriptionContainerProps, /*#__PURE__*/React.createElement(RenderNode, {
|
package/list/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {HeaderNavigationOverrides} from 'baseui/header-navigation';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import {StyletronComponent} from 'styletron-react';
|
|
3
4
|
import {Override} from '../overrides';
|
|
@@ -84,3 +85,38 @@ export const StyledEndEnhancerContainer: StyletronComponent<{}>;
|
|
|
84
85
|
export const StyledArtworkContainer: StyletronComponent<
|
|
85
86
|
StyledArtworkContainerPropsT
|
|
86
87
|
>;
|
|
88
|
+
|
|
89
|
+
export interface HeadingPropsT {
|
|
90
|
+
heading: React.ReactNode;
|
|
91
|
+
subHeading?: React.ReactNode;
|
|
92
|
+
endEnhancer?: React.ReactNode;
|
|
93
|
+
endEnhancerDescription?: React.ReactNode;
|
|
94
|
+
overrides?: HeaderNavigationOverrides;
|
|
95
|
+
maxLines?: number;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface StyledHeadingEndEnhancerContainerPropsT {
|
|
99
|
+
$isText: boolean;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export type StyledHeadingHeadingPropsT = {
|
|
103
|
+
$maxLines: 1 | 2;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const ListHeading: React.ForwardRefExoticComponent<
|
|
107
|
+
HeadingPropsT & React.RefAttributes<HTMLLIElement>
|
|
108
|
+
>;
|
|
109
|
+
|
|
110
|
+
export const StyledHeadingRoot: StyletronComponent<{}>;
|
|
111
|
+
export const StyledHeadingContent: StyletronComponent<{}>;
|
|
112
|
+
export const StyledHeadingContentRow: StyletronComponent<{}>;
|
|
113
|
+
export const StyledHeadingMainHeading: StyletronComponent<
|
|
114
|
+
StyledHeadingHeadingPropsT
|
|
115
|
+
>;
|
|
116
|
+
export const StyledHeadingSubHeading: StyletronComponent<
|
|
117
|
+
StyledHeadingHeadingPropsT
|
|
118
|
+
>;
|
|
119
|
+
export const StyledHeadingEndEnhancerContainer: StyletronComponent<
|
|
120
|
+
StyledHeadingEndEnhancerContainerPropsT
|
|
121
|
+
>;
|
|
122
|
+
export const StyledHeadingEndEnhancerDescriptionContainer: StyletronComponent<{}>;
|
package/list/list-heading.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -7,12 +9,16 @@ exports.default = void 0;
|
|
|
7
9
|
|
|
8
10
|
var _react = _interopRequireDefault(require("react"));
|
|
9
11
|
|
|
10
|
-
var
|
|
12
|
+
var ReactIs = _interopRequireWildcard(require("react-is"));
|
|
11
13
|
|
|
12
14
|
var _overrides = require("../helpers/overrides.js");
|
|
13
15
|
|
|
14
16
|
var _styledComponents = require("./styled-components.js");
|
|
15
17
|
|
|
18
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
16
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
23
|
|
|
18
24
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -47,7 +53,7 @@ function RenderNode(props) {
|
|
|
47
53
|
return Component;
|
|
48
54
|
}
|
|
49
55
|
|
|
50
|
-
if (
|
|
56
|
+
if (ReactIs.isValidElementType(Component)) {
|
|
51
57
|
// $FlowFixMe
|
|
52
58
|
return /*#__PURE__*/_react.default.createElement(Component, restProps);
|
|
53
59
|
} // $FlowFixMe
|
|
@@ -56,9 +62,14 @@ function RenderNode(props) {
|
|
|
56
62
|
return Component;
|
|
57
63
|
}
|
|
58
64
|
|
|
65
|
+
function isMaxLinesValid(maxLines) {
|
|
66
|
+
return maxLines === 1 || maxLines === 2;
|
|
67
|
+
}
|
|
68
|
+
|
|
59
69
|
var ListHeading = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
60
70
|
var _props$overrides = props.overrides,
|
|
61
|
-
overrides = _props$overrides === void 0 ? {} : _props$overrides
|
|
71
|
+
overrides = _props$overrides === void 0 ? {} : _props$overrides,
|
|
72
|
+
maxLines = props.maxLines;
|
|
62
73
|
var EndEnhancer = props.endEnhancer;
|
|
63
74
|
var EndEnhancerDescription = props.endEnhancerDescription;
|
|
64
75
|
var SubHeading = props.subHeading;
|
|
@@ -95,15 +106,21 @@ var ListHeading = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
95
106
|
|
|
96
107
|
var isEndEnhancerString = typeof EndEnhancer === 'string';
|
|
97
108
|
|
|
98
|
-
if (
|
|
99
|
-
|
|
109
|
+
if (process.env.NODE_ENV !== "production") {
|
|
110
|
+
if (isEndEnhancerString && EndEnhancerDescription) {
|
|
111
|
+
console.warn('endEnhancerDescription will not be rendered if endEnhancer is not a string');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (maxLines && !isMaxLinesValid(maxLines)) {
|
|
115
|
+
console.warn('maxLines must be 1 or 2.');
|
|
116
|
+
}
|
|
100
117
|
}
|
|
101
118
|
|
|
102
119
|
return /*#__PURE__*/_react.default.createElement(Root // eslint-disable-next-line flowtype/no-weak-types
|
|
103
120
|
, _extends({
|
|
104
121
|
ref: ref
|
|
105
122
|
}, rootProps), /*#__PURE__*/_react.default.createElement(Content, contentProps, /*#__PURE__*/_react.default.createElement(_styledComponents.StyledHeadingContentRow, null, /*#__PURE__*/_react.default.createElement(HeadingContainer, _extends({
|
|
106
|
-
$maxLines:
|
|
123
|
+
$maxLines: isMaxLinesValid(maxLines) ? maxLines : 1
|
|
107
124
|
}, headingContainerProps), /*#__PURE__*/_react.default.createElement(RenderNode, {
|
|
108
125
|
component: props.heading
|
|
109
126
|
})), EndEnhancer && /*#__PURE__*/_react.default.createElement(EndEnhancerContainer, _extends({
|
|
@@ -111,7 +128,7 @@ var ListHeading = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
111
128
|
}, endEnhancerContainerProps), /*#__PURE__*/_react.default.createElement(RenderNode, {
|
|
112
129
|
component: EndEnhancer
|
|
113
130
|
}))), (SubHeading || EndEnhancerDescription) && /*#__PURE__*/_react.default.createElement(_styledComponents.StyledHeadingContentRow, null, /*#__PURE__*/_react.default.createElement(SubHeadingContainer, _extends({
|
|
114
|
-
$maxLines:
|
|
131
|
+
$maxLines: isMaxLinesValid(maxLines) ? maxLines : 1
|
|
115
132
|
}, subHeadingContainerProps), /*#__PURE__*/_react.default.createElement(RenderNode, {
|
|
116
133
|
component: SubHeading
|
|
117
134
|
})), EndEnhancerDescription && isEndEnhancerString && /*#__PURE__*/_react.default.createElement(EndEnhancerDescriptionContainer, endEnhancerDescriptionContainerProps, /*#__PURE__*/_react.default.createElement(RenderNode, {
|
|
@@ -7,7 +7,7 @@ LICENSE file in the root directory of this source tree.
|
|
|
7
7
|
// @flow
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import ReactIs from 'react-is';
|
|
10
|
+
import * as ReactIs from 'react-is';
|
|
11
11
|
|
|
12
12
|
import {getOverrides} from '../helpers/overrides.js';
|
|
13
13
|
|
|
@@ -39,9 +39,13 @@ function RenderNode(props) {
|
|
|
39
39
|
return Component;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
function isMaxLinesValid(maxLines) {
|
|
43
|
+
return maxLines === 1 || maxLines === 2;
|
|
44
|
+
}
|
|
45
|
+
|
|
42
46
|
const ListHeading = React.forwardRef<HeadingPropsT, HTMLLIElement>(
|
|
43
47
|
(props: HeadingPropsT, ref) => {
|
|
44
|
-
const {overrides = {}} = props;
|
|
48
|
+
const {overrides = {}, maxLines} = props;
|
|
45
49
|
const EndEnhancer = props.endEnhancer;
|
|
46
50
|
const EndEnhancerDescription = props.endEnhancerDescription;
|
|
47
51
|
const SubHeading = props.subHeading;
|
|
@@ -73,10 +77,15 @@ const ListHeading = React.forwardRef<HeadingPropsT, HTMLLIElement>(
|
|
|
73
77
|
|
|
74
78
|
const isEndEnhancerString = typeof EndEnhancer === 'string';
|
|
75
79
|
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
if (__DEV__) {
|
|
81
|
+
if (isEndEnhancerString && EndEnhancerDescription) {
|
|
82
|
+
console.warn(
|
|
83
|
+
'endEnhancerDescription will not be rendered if endEnhancer is not a string',
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
if (maxLines && !isMaxLinesValid(maxLines)) {
|
|
87
|
+
console.warn('maxLines must be 1 or 2.');
|
|
88
|
+
}
|
|
80
89
|
}
|
|
81
90
|
|
|
82
91
|
return (
|
|
@@ -89,7 +98,7 @@ const ListHeading = React.forwardRef<HeadingPropsT, HTMLLIElement>(
|
|
|
89
98
|
{/* ----- Top Row -------------------------- */}
|
|
90
99
|
<StyledHeadingContentRow>
|
|
91
100
|
<HeadingContainer
|
|
92
|
-
$maxLines={
|
|
101
|
+
$maxLines={isMaxLinesValid(maxLines) ? maxLines : 1}
|
|
93
102
|
{...headingContainerProps}
|
|
94
103
|
>
|
|
95
104
|
<RenderNode component={props.heading} />
|
|
@@ -109,7 +118,7 @@ const ListHeading = React.forwardRef<HeadingPropsT, HTMLLIElement>(
|
|
|
109
118
|
{(SubHeading || EndEnhancerDescription) && (
|
|
110
119
|
<StyledHeadingContentRow>
|
|
111
120
|
<SubHeadingContainer
|
|
112
|
-
$maxLines={
|
|
121
|
+
$maxLines={isMaxLinesValid(maxLines) ? maxLines : 1}
|
|
113
122
|
{...subHeadingContainerProps}
|
|
114
123
|
>
|
|
115
124
|
<RenderNode component={SubHeading} />
|