@skyscanner/backpack-web 33.0.0 → 33.1.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.
|
@@ -156,7 +156,6 @@ const BpkBannerAlertInner = ({
|
|
|
156
156
|
}), dismissable && /*#__PURE__*/_jsx("span", {
|
|
157
157
|
className: getClassName('bpk-banner-alert__toggle'),
|
|
158
158
|
children: /*#__PURE__*/_jsx(BpkCloseButton, {
|
|
159
|
-
className: getClassName('bpk-banner-alert__toggle-button'),
|
|
160
159
|
onClick: onBannerDismiss,
|
|
161
160
|
"aria-label": dismissButtonLabel,
|
|
162
161
|
label: dismissButtonLabel
|
|
@@ -22,11 +22,11 @@ import STYLES from "./BpkInput.module.css";
|
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
const getClassName = cssModules(STYLES);
|
|
24
24
|
const KEYCODES = {
|
|
25
|
-
ENTER:
|
|
26
|
-
SPACEBAR:
|
|
25
|
+
ENTER: 'Enter',
|
|
26
|
+
SPACEBAR: 'Space'
|
|
27
27
|
};
|
|
28
|
-
const handleKeyEvent =
|
|
29
|
-
if (e
|
|
28
|
+
const handleKeyEvent = callback => e => {
|
|
29
|
+
if (e.code === KEYCODES.ENTER || e.code === KEYCODES.SPACEBAR) {
|
|
30
30
|
e.preventDefault();
|
|
31
31
|
if (callback) {
|
|
32
32
|
callback();
|
|
@@ -107,8 +107,9 @@ const withOpenEvents = InputComponent => {
|
|
|
107
107
|
}
|
|
108
108
|
const eventHandlers = {
|
|
109
109
|
onClick: withEventHandler(onOpen, onClick),
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
// @ts-expect-error for some reason the type KeyboardEvent was not being recognized as
|
|
111
|
+
// a valid type to UIEvent even though it is a valid subtype type of UIEvent
|
|
112
|
+
onKeyDown: withEventHandler(handleKeyEvent(onOpen), onKeyDown)
|
|
112
113
|
};
|
|
113
114
|
if (hasTouchSupport) {
|
|
114
115
|
// Prevents the mobile keyboard from opening (iOS / Android), while not announcing it as 'read only' to a screen reader
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { cloneElement } from 'react';
|
|
20
19
|
import { cssModules } from "../../bpk-react-utils";
|
|
21
20
|
import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
|
|
22
21
|
import STYLES from "./BpkNavigationBar.module.css";
|
|
@@ -24,16 +23,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
24
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
24
|
const getClassNames = cssModules(STYLES);
|
|
26
25
|
export const BAR_STYLES = {
|
|
27
|
-
|
|
26
|
+
default: 'default',
|
|
28
27
|
onDark: 'on-dark'
|
|
29
28
|
};
|
|
30
|
-
const cloneWithClasses = (elem, ...newStyles) => {
|
|
31
|
-
const className = getClassNames(elem.props.className, ...newStyles);
|
|
32
|
-
return /*#__PURE__*/cloneElement(elem, {
|
|
33
|
-
...elem.props,
|
|
34
|
-
className
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
29
|
const BpkNavigationBar = props => {
|
|
38
30
|
const {
|
|
39
31
|
barStyle = BAR_STYLES.default,
|
|
@@ -53,12 +45,18 @@ const BpkNavigationBar = props => {
|
|
|
53
45
|
"aria-labelledby": titleId,
|
|
54
46
|
className: getClassNames('bpk-navigation-bar', `bpk-navigation-bar--${barStyle}`, sticky && 'bpk-navigation-bar__sticky', className),
|
|
55
47
|
...rest,
|
|
56
|
-
children: [leadingButton &&
|
|
48
|
+
children: [leadingButton && /*#__PURE__*/_jsx("div", {
|
|
49
|
+
className: getClassNames('bpk-navigation-bar__leading-item', `bpk-navigation-bar__leading-item--${barStyle}`),
|
|
50
|
+
children: leadingButton
|
|
51
|
+
}), typeof title === 'string' ? /*#__PURE__*/_jsx(BpkText, {
|
|
57
52
|
id: titleId,
|
|
58
53
|
textStyle: TEXT_STYLES.heading5,
|
|
59
54
|
className: getClassNames('bpk-navigation-bar__title', `bpk-navigation-bar__title--${barStyle}`),
|
|
60
55
|
children: title
|
|
61
|
-
}) : title, trailingButton &&
|
|
56
|
+
}) : title, trailingButton && /*#__PURE__*/_jsx("div", {
|
|
57
|
+
className: getClassNames('bpk-navigation-bar__trailing-item', `bpk-navigation-bar__trailing-item-${barStyle}`),
|
|
58
|
+
children: trailingButton
|
|
59
|
+
})]
|
|
62
60
|
});
|
|
63
61
|
};
|
|
64
62
|
export default BpkNavigationBar;
|