@skyscanner/backpack-web 31.5.0 → 31.6.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.
- package/bpk-component-autosuggest/src/BpkAutosuggestSuggestion.js +4 -4
- package/bpk-component-bottom-sheet/src/BpkBottomSheetInner.js +0 -1
- package/bpk-component-modal/src/BpkModalInner.js +0 -1
- package/bpk-component-navigation-bar/index.js +4 -2
- package/bpk-component-navigation-bar/src/BpkNavigationBar.js +24 -26
- package/bpk-component-navigation-bar/src/BpkNavigationBar.module.css +1 -1
- package/bpk-component-navigation-bar/src/BpkNavigationBarButtonLink.js +10 -11
- package/bpk-component-navigation-bar/src/BpkNavigationBarButtonLink.module.css +1 -1
- package/bpk-component-navigation-bar/src/BpkNavigationBarIconButton.js +10 -11
- package/bpk-component-navigation-bar/src/BpkNavigationBarIconButton.module.css +1 -1
- package/bpk-component-navigation-bar/src/themeAttributes.js +3 -1
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ import STYLES from "./BpkAutosuggest.module.css";
|
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
22
|
const getClassName = cssModules(STYLES);
|
|
23
|
-
const
|
|
23
|
+
const BpkAutosuggestSuggestion = props => {
|
|
24
24
|
const classNames = [getClassName('bpk-autosuggest__suggestion')];
|
|
25
25
|
const {
|
|
26
26
|
className,
|
|
@@ -67,7 +67,7 @@ const BpkSuggestion = props => {
|
|
|
67
67
|
})
|
|
68
68
|
);
|
|
69
69
|
};
|
|
70
|
-
|
|
70
|
+
BpkAutosuggestSuggestion.propTypes = {
|
|
71
71
|
value: PropTypes.node.isRequired,
|
|
72
72
|
subHeading: PropTypes.node,
|
|
73
73
|
tertiaryLabel: PropTypes.string,
|
|
@@ -75,11 +75,11 @@ BpkSuggestion.propTypes = {
|
|
|
75
75
|
indent: PropTypes.bool,
|
|
76
76
|
className: PropTypes.string
|
|
77
77
|
};
|
|
78
|
-
|
|
78
|
+
BpkAutosuggestSuggestion.defaultProps = {
|
|
79
79
|
subHeading: null,
|
|
80
80
|
tertiaryLabel: null,
|
|
81
81
|
icon: null,
|
|
82
82
|
indent: false,
|
|
83
83
|
className: null
|
|
84
84
|
};
|
|
85
|
-
export default
|
|
85
|
+
export default BpkAutosuggestSuggestion;
|
|
@@ -23,7 +23,6 @@ import CSSTransition from 'react-transition-group/CSSTransition';
|
|
|
23
23
|
import { BpkButtonLink } from "../../bpk-component-link";
|
|
24
24
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
25
25
|
import BpkCloseButton from "../../bpk-component-close-button";
|
|
26
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
27
26
|
import BpkNavigationBar from "../../bpk-component-navigation-bar";
|
|
28
27
|
import { cssModules } from "../../bpk-react-utils";
|
|
29
28
|
import STYLES from "./BpkBottomSheetInner.module.css";
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
import { BpkButtonLink } from "../../bpk-component-link";
|
|
21
21
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
22
22
|
import BpkCloseButton from "../../bpk-component-close-button";
|
|
23
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
24
23
|
import BpkNavigationBar from "../../bpk-component-navigation-bar";
|
|
25
24
|
import { TransitionInitialMount, cssModules } from "../../bpk-react-utils";
|
|
26
25
|
import STYLES from "./BpkModalInner.module.css";
|
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import BpkNavigationBar, { BAR_STYLES } from "./src/BpkNavigationBar";
|
|
18
20
|
import BpkNavigationBarIconButton from "./src/BpkNavigationBarIconButton";
|
|
19
21
|
import BpkNavigationBarButtonLink from "./src/BpkNavigationBarButtonLink";
|
|
20
22
|
import themeAttributes from "./src/themeAttributes";
|
|
21
|
-
export { BpkNavigationBarIconButton, BpkNavigationBarButtonLink, themeAttributes };
|
|
23
|
+
export { BpkNavigationBarIconButton, BpkNavigationBarButtonLink, themeAttributes, BAR_STYLES };
|
|
22
24
|
export default BpkNavigationBar;
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { cloneElement } from 'react';
|
|
18
20
|
import PropTypes from 'prop-types';
|
|
19
21
|
import { cssModules } from "../../bpk-react-utils";
|
|
20
22
|
import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
|
|
@@ -22,8 +24,12 @@ import STYLES from "./BpkNavigationBar.module.css";
|
|
|
22
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
25
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
26
|
const getClassNames = cssModules(STYLES);
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
+
export const BAR_STYLES = {
|
|
28
|
+
'default': 'default',
|
|
29
|
+
onDark: 'on-dark'
|
|
30
|
+
};
|
|
31
|
+
const cloneWithClasses = (elem, ...newStyles) => {
|
|
32
|
+
const className = getClassNames(elem.props.className, ...newStyles);
|
|
27
33
|
return /*#__PURE__*/cloneElement(elem, {
|
|
28
34
|
...elem.props,
|
|
29
35
|
className
|
|
@@ -31,10 +37,11 @@ const cloneWithClass = (elem, newStyle) => {
|
|
|
31
37
|
};
|
|
32
38
|
const BpkNavigationBar = props => {
|
|
33
39
|
const {
|
|
40
|
+
barStyle = BAR_STYLES.default,
|
|
34
41
|
className,
|
|
35
42
|
id,
|
|
36
43
|
leadingButton,
|
|
37
|
-
sticky,
|
|
44
|
+
sticky = false,
|
|
38
45
|
title,
|
|
39
46
|
trailingButton,
|
|
40
47
|
...rest
|
|
@@ -43,21 +50,17 @@ const BpkNavigationBar = props => {
|
|
|
43
50
|
// If the title is a component that sets its own id we want the aria-labelledby on the nav to match this so it can find the element
|
|
44
51
|
// Otherwise if its just a string we set the id on the title component.
|
|
45
52
|
const titleId = typeof title === 'string' ? `${id}-bpk-navigation-bar-title` : id;
|
|
46
|
-
return (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
children: title
|
|
58
|
-
}) : title, trailingButton && cloneWithClass(trailingButton, 'bpk-navigation-bar__trailing-item')]
|
|
59
|
-
})
|
|
60
|
-
);
|
|
53
|
+
return /*#__PURE__*/_jsxs("nav", {
|
|
54
|
+
"aria-labelledby": titleId,
|
|
55
|
+
className: getClassNames('bpk-navigation-bar', `bpk-navigation-bar--${barStyle}`, sticky && 'bpk-navigation-bar__sticky', className),
|
|
56
|
+
...rest,
|
|
57
|
+
children: [leadingButton && cloneWithClasses(leadingButton, 'bpk-navigation-bar__leading-item', `bpk-navigation-bar__leading-item--${barStyle}`), typeof title === 'string' ? /*#__PURE__*/_jsx(BpkText, {
|
|
58
|
+
id: titleId,
|
|
59
|
+
textStyle: TEXT_STYLES.heading5,
|
|
60
|
+
className: getClassNames('bpk-navigation-bar__title', `bpk-navigation-bar__title--${barStyle}`),
|
|
61
|
+
children: title
|
|
62
|
+
}) : title, trailingButton && cloneWithClasses(trailingButton, 'bpk-navigation-bar__trailing-item', `bpk-navigation-bar__trailing-item--${barStyle}`)]
|
|
63
|
+
});
|
|
61
64
|
};
|
|
62
65
|
BpkNavigationBar.propTypes = {
|
|
63
66
|
id: PropTypes.string.isRequired,
|
|
@@ -65,12 +68,7 @@ BpkNavigationBar.propTypes = {
|
|
|
65
68
|
className: PropTypes.string,
|
|
66
69
|
leadingButton: PropTypes.element,
|
|
67
70
|
trailingButton: PropTypes.element,
|
|
68
|
-
sticky: PropTypes.bool
|
|
69
|
-
|
|
70
|
-
BpkNavigationBar.defaultProps = {
|
|
71
|
-
className: null,
|
|
72
|
-
leadingButton: null,
|
|
73
|
-
trailingButton: null,
|
|
74
|
-
sticky: false
|
|
71
|
+
sticky: PropTypes.bool,
|
|
72
|
+
barStyle: PropTypes.oneOf(Object.values(BAR_STYLES))
|
|
75
73
|
};
|
|
76
74
|
export default BpkNavigationBar;
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-navigation-bar{position:relative;display:flex;min-height:3.5rem;padding:1rem;flex-direction:row;justify-content:center;align-items:center;background-color:#fff;background-color:var(--bpk-navigation-bar-background-color, #fff)}.bpk-navigation-bar__title{color:#161616;color:var(--bpk-navigation-bar-title-color, #161616)}.bpk-navigation-bar__leading-item,.bpk-navigation-bar__trailing-item{position:absolute;font-size:.875rem;line-height:1.25rem;font-weight:700}.bpk-navigation-bar__leading-item{left:1rem}html[dir='rtl'] .bpk-navigation-bar__leading-item{right:1rem;left:auto}.bpk-navigation-bar__trailing-item{right:1rem}html[dir='rtl'] .bpk-navigation-bar__trailing-item{right:auto;left:1rem}.bpk-navigation-bar__sticky{position:sticky;top:0;z-index:899;box-shadow:0px 1px 3px 0px rgba(37,32,31,0.3)}
|
|
18
|
+
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-navigation-bar{position:relative;display:flex;min-height:3.5rem;padding:1rem;flex-direction:row;justify-content:center;align-items:center;background-color:#fff;background-color:var(--bpk-navigation-bar-background-color, #fff)}.bpk-navigation-bar--on-dark{background-color:#05203c}.bpk-navigation-bar__title{color:#161616;color:var(--bpk-navigation-bar-title-color, #161616)}.bpk-navigation-bar__title--on-dark{color:#fff}.bpk-navigation-bar__leading-item,.bpk-navigation-bar__trailing-item{position:absolute;font-size:.875rem;line-height:1.25rem;font-weight:700}.bpk-navigation-bar__leading-item{left:1rem}html[dir='rtl'] .bpk-navigation-bar__leading-item{right:1rem;left:auto}.bpk-navigation-bar__trailing-item{right:1rem}html[dir='rtl'] .bpk-navigation-bar__trailing-item{right:auto;left:1rem}.bpk-navigation-bar__sticky{position:sticky;top:0;z-index:899;box-shadow:0px 1px 3px 0px rgba(37,32,31,0.3)}
|
|
@@ -14,32 +14,31 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
import PropTypes from 'prop-types';
|
|
20
|
+
|
|
21
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
20
22
|
import { BpkButtonLink } from "../../bpk-component-link";
|
|
21
23
|
import { cssModules } from "../../bpk-react-utils";
|
|
22
24
|
import STYLES from "./BpkNavigationBarButtonLink.module.css";
|
|
25
|
+
import { BAR_STYLES } from "./BpkNavigationBar";
|
|
23
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
27
|
const getClassName = cssModules(STYLES);
|
|
25
28
|
const BpkNavigationBarButtonLink = ({
|
|
29
|
+
barStyle = BAR_STYLES.default,
|
|
26
30
|
children,
|
|
27
31
|
className,
|
|
28
32
|
...rest
|
|
29
|
-
}) =>
|
|
30
|
-
|
|
31
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
32
|
-
_jsx(BpkButtonLink, {
|
|
33
|
-
className: getClassName('bpk-navigation-bar-button-link', className),
|
|
33
|
+
}) => /*#__PURE__*/_jsx(BpkButtonLink, {
|
|
34
|
+
className: getClassName('bpk-navigation-bar-button-link', `bpk-navigation-bar-button-link--${barStyle}`, className),
|
|
34
35
|
...rest,
|
|
35
36
|
children: children
|
|
36
37
|
});
|
|
37
38
|
BpkNavigationBarButtonLink.propTypes = {
|
|
38
39
|
children: PropTypes.node.isRequired,
|
|
39
40
|
onClick: PropTypes.func.isRequired,
|
|
40
|
-
className: PropTypes.string
|
|
41
|
-
|
|
42
|
-
BpkNavigationBarButtonLink.defaultProps = {
|
|
43
|
-
className: null
|
|
41
|
+
className: PropTypes.string,
|
|
42
|
+
barStyle: PropTypes.oneOf(Object.values(BAR_STYLES))
|
|
44
43
|
};
|
|
45
44
|
export default BpkNavigationBarButtonLink;
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-navigation-bar-button-link{color:#161616;color:var(--bpk-navigation-bar-button-link-color, #161616)}.bpk-no-touch-support .bpk-navigation-bar-button-link:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-navigation-bar-button-link-hover-color, #161616)}:global(.bpk-no-touch-support) .bpk-navigation-bar-button-link:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-navigation-bar-button-link-hover-color, #161616)}.bpk-navigation-bar-button-link:active{color:#161616;color:var(--bpk-navigation-bar-button-link-active-color, #161616)}.bpk-navigation-bar-button-link:visited{color:#161616;color:var(--bpk-navigation-bar-button-link-visited-color, #161616)}
|
|
18
|
+
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-navigation-bar-button-link{color:#161616;color:var(--bpk-navigation-bar-button-link-color, #161616)}.bpk-no-touch-support .bpk-navigation-bar-button-link:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-navigation-bar-button-link-hover-color, #161616)}:global(.bpk-no-touch-support) .bpk-navigation-bar-button-link:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-navigation-bar-button-link-hover-color, #161616)}.bpk-navigation-bar-button-link:active{color:#161616;color:var(--bpk-navigation-bar-button-link-active-color, #161616)}.bpk-navigation-bar-button-link:visited{color:#161616;color:var(--bpk-navigation-bar-button-link-visited-color, #161616)}.bpk-navigation-bar-button-link--on-dark{color:#fff}.bpk-no-touch-support .bpk-navigation-bar-button-link--on-dark:hover:not(:active):not(:disabled){color:#fff}:global(.bpk-no-touch-support) .bpk-navigation-bar-button-link--on-dark:hover:not(:active):not(:disabled){color:#fff}.bpk-navigation-bar-button-link--on-dark:active{color:#fff}.bpk-navigation-bar-button-link--on-dark:visited{color:#fff}
|
|
@@ -14,33 +14,32 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
import PropTypes from 'prop-types';
|
|
20
|
+
|
|
21
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
20
22
|
import BpkIconButton from "../../bpk-component-close-button";
|
|
21
23
|
import { cssModules } from "../../bpk-react-utils";
|
|
22
24
|
import STYLES from "./BpkNavigationBarIconButton.module.css";
|
|
25
|
+
import { BAR_STYLES } from "./BpkNavigationBar";
|
|
23
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
27
|
const getClassName = cssModules(STYLES);
|
|
25
28
|
const BpkNavigationBarIconButton = ({
|
|
29
|
+
barStyle = BAR_STYLES.default,
|
|
26
30
|
className,
|
|
27
31
|
icon,
|
|
28
32
|
...rest
|
|
29
|
-
}) =>
|
|
30
|
-
/*#__PURE__*/
|
|
31
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
32
|
-
_jsx(BpkIconButton, {
|
|
33
|
+
}) => /*#__PURE__*/_jsx(BpkIconButton, {
|
|
33
34
|
customIcon: icon,
|
|
34
|
-
className: getClassName('bpk-navigation-bar-icon-button', className),
|
|
35
|
+
className: getClassName('bpk-navigation-bar-icon-button', `bpk-navigation-bar-icon-button--${barStyle}`, className),
|
|
35
36
|
...rest
|
|
36
37
|
});
|
|
37
38
|
BpkNavigationBarIconButton.propTypes = {
|
|
38
39
|
icon: PropTypes.func.isRequired,
|
|
39
40
|
label: PropTypes.string.isRequired,
|
|
40
41
|
onClick: PropTypes.func.isRequired,
|
|
41
|
-
className: PropTypes.string
|
|
42
|
-
|
|
43
|
-
BpkNavigationBarIconButton.defaultProps = {
|
|
44
|
-
className: null
|
|
42
|
+
className: PropTypes.string,
|
|
43
|
+
barStyle: PropTypes.oneOf(Object.values(BAR_STYLES))
|
|
45
44
|
};
|
|
46
45
|
export default BpkNavigationBarIconButton;
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-navigation-bar-icon-button{color:#161616;color:var(--bpk-navigation-bar-icon-button-color, #161616)}.bpk-no-touch-support .bpk-navigation-bar-icon-button:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-navigation-bar-icon-button-hover-color, #161616)}:global(.bpk-no-touch-support) .bpk-navigation-bar-icon-button:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-navigation-bar-icon-button-hover-color, #161616)}.bpk-navigation-bar-icon-button:active{color:#161616;color:var(--bpk-navigation-bar-icon-button-active-color, #161616)}
|
|
18
|
+
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-navigation-bar-icon-button{color:#161616;color:var(--bpk-navigation-bar-icon-button-color, #161616)}.bpk-no-touch-support .bpk-navigation-bar-icon-button:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-navigation-bar-icon-button-hover-color, #161616)}:global(.bpk-no-touch-support) .bpk-navigation-bar-icon-button:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-navigation-bar-icon-button-hover-color, #161616)}.bpk-navigation-bar-icon-button:active{color:#161616;color:var(--bpk-navigation-bar-icon-button-active-color, #161616)}.bpk-navigation-bar-icon-button--on-dark{color:#fff}.bpk-no-touch-support .bpk-navigation-bar-icon-button--on-dark:hover:not(:active):not(:disabled){color:#fff}:global(.bpk-no-touch-support) .bpk-navigation-bar-icon-button--on-dark:hover:not(:active):not(:disabled){color:#fff}.bpk-navigation-bar-icon-button--on-dark:active{color:#fff}
|
|
@@ -14,4 +14,6 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export default ['navigationBarBackgroundColor', 'navigationBarTitleColor', 'navigationBarButtonLinkColor', 'navigationBarButtonLinkActiveColor', 'navigationBarButtonLinkHoverColor', 'navigationBarButtonLinkVisitedColor', 'navigationBarIconButtonColor', 'navigationBarIconButtonActiveColor', 'navigationBarIconButtonHoverColor'];
|