@skyscanner/backpack-web 27.0.0 → 28.0.1
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-infinite-scroll/src/intersection-observer.js +2 -3
- package/bpk-component-map/src/BpkIconMarker.module.css +1 -1
- package/bpk-component-map/src/BpkPriceMarker.module.css +1 -1
- package/bpk-component-nudger/src/BpkNudger.d.ts +1 -1
- package/bpk-component-nudger/src/BpkNudger.js +41 -10
- package/bpk-component-nudger/src/BpkNudger.module.css +1 -1
- package/bpk-component-nudger/src/common-types.d.ts +5 -1
- package/bpk-mixins/sass-functions.js +1 -1
- package/bpk-react-utils/src/Portal.js +1 -1
- package/bpk-react-utils/src/deprecated.js +1 -3
- package/bpk-stylesheets/index.js +2 -2
- package/package.json +1 -1
- package/bpk-component-nudger-row/index.d.ts +0 -21
- package/bpk-component-nudger-row/index.js +0 -20
- package/bpk-component-nudger-row/src/BpkNudgerRow.d.ts +0 -33
- package/bpk-component-nudger-row/src/BpkNudgerRow.js +0 -69
- package/bpk-component-nudger-row/src/BpkNudgerRow.module.css +0 -18
|
@@ -18,9 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
if (typeof window === 'undefined') {
|
|
20
20
|
global.IntersectionObserver = class {
|
|
21
|
-
observe() {}
|
|
22
|
-
|
|
23
|
-
unobserve() {} // eslint-disable-line class-methods-use-this
|
|
21
|
+
observe() {}
|
|
22
|
+
unobserve() {}
|
|
24
23
|
};
|
|
25
24
|
} else {
|
|
26
25
|
require('intersection-observer'); /* eslint-disable-line global-require */
|
|
@@ -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-icon-marker__wrapper{position:
|
|
18
|
+
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-icon-marker__wrapper{position:absolute;top:-32px;left:-13px;z-index:1;padding:16px 13px;border:none;background:none}.bpk-icon-marker__wrapper--selected{top:-40px;left:-16px;z-index:2;padding:20px 16px}.bpk-icon-marker__icon{position:absolute;top:4.8px;left:5px;color:#fff}.bpk-icon-marker__icon>svg{position:absolute;width:16px !important;height:16px !important;fill:currentcolor}.bpk-icon-marker__icon--interactive{cursor:pointer}.bpk-icon-marker__icon--disabled{color:#0c838a;color:var(--bpk-icon-marker-default-disabled-color, #0c838a)}.bpk-icon-marker__icon--selected{top:8px;left:8px;color:#0c838a;color:var(--bpk-icon-marker-default-selected-color, #0c838a)}
|
|
@@ -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-price-marker{display:flex;padding
|
|
18
|
+
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-price-marker{display:flex;padding:.125rem 0.5rem;justify-content:center;align-items:center;border:3px solid;border-radius:.5rem}.bpk-price-marker--dynamic{cursor:pointer}.bpk-price-marker-default{color:#fff;border-color:#0062e3;border-color:var(--bpk-price-marker-background-color, #0062e3);background-color:#0062e3;background-color:var(--bpk-price-marker-background-color, #0062e3)}.bpk-price-marker-viewed{color:rgba(255,255,255,0.8);color:var(--bpk-price-marker-viewed-color, rgba(255,255,255,0.8));border-color:#0062e3;border-color:var(--bpk-price-marker-viewed-border-color, #0062e3);background-color:#0062e3;background-color:var(--bpk-price-marker-viewed-background-color, #0062e3)}.bpk-price-marker-focused{padding:0.375rem 0.5rem;background-color:#fff;border-color:#0062e3;border-color:var(--bpk-price-marker-selected-border-color, #0062e3);color:#0062e3;color:var(--bpk-price-marker-selected-color, #0062e3)}.bpk-price-marker-disabled{z-index:-2;border-color:#fff;background-color:#fff;color:rgba(0,0,0,0.2)}.bpk-price-marker__wrapper{position:relative;display:flex;padding:0;flex-direction:column;align-items:center;transform:translate(calc(-50% - 3px), calc(-100% - 3px - 1rem/ 2));border:none;background:none}.bpk-price-marker__arrow{position:absolute;top:50%;z-index:-1;width:1rem;height:1rem;transform:rotate(45deg);border-radius:25%;background-color:#0062e3}.bpk-price-marker__arrow-default{background-color:#0062e3;background-color:var(--bpk-price-marker-background-color, #0062e3)}.bpk-price-marker__arrow-viewed{background-color:#0062e3;background-color:var(--bpk-price-marker-viewed-border-color, #0062e3)}.bpk-price-marker__arrow-focused{top:75%;background-color:#0062e3;background-color:var(--bpk-price-marker-selected-border-color, #0062e3)}.bpk-price-marker__arrow-disabled{top:75%;z-index:-3;background-color:#fff}
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
|
|
19
19
|
/// <reference types="react" />
|
|
20
20
|
import { type CommonProps } from './common-types';
|
|
21
|
-
declare const BpkNudger: ({ className,
|
|
21
|
+
declare const BpkNudger: ({ buttonType, className, icon, id, subtitle, title, ...rest }: CommonProps) => JSX.Element;
|
|
22
22
|
export default BpkNudger;
|
|
@@ -17,9 +17,13 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { cssModules } from "../../bpk-react-utils";
|
|
20
|
+
import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
|
|
21
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
22
|
+
import BpkLabel from "../../bpk-component-label";
|
|
20
23
|
import BpkConfigurableNudger from "./BpkConfigurableNudger";
|
|
21
24
|
import STYLES from "./BpkNudger.module.css";
|
|
22
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
27
|
const getClassName = cssModules(STYLES);
|
|
24
28
|
const compareValues = (a, b) => a - b;
|
|
25
29
|
const incrementValue = currentValue => currentValue + 1;
|
|
@@ -28,15 +32,42 @@ const formatValue = currentValue => currentValue.toString();
|
|
|
28
32
|
const BpkNudger = ({
|
|
29
33
|
buttonType = 'secondary',
|
|
30
34
|
className = null,
|
|
35
|
+
icon,
|
|
36
|
+
id,
|
|
37
|
+
subtitle,
|
|
38
|
+
title,
|
|
31
39
|
...rest
|
|
32
|
-
}) =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
}) => {
|
|
41
|
+
const classNames = getClassName(title && 'bpk-nudger__container');
|
|
42
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
43
|
+
className: classNames,
|
|
44
|
+
children: [title && /*#__PURE__*/_jsxs(BpkLabel, {
|
|
45
|
+
htmlFor: id,
|
|
46
|
+
className: getClassName('bpk-nudger__label'),
|
|
47
|
+
children: [icon, /*#__PURE__*/_jsxs("span", {
|
|
48
|
+
// For a11y on IOS, role='text' forces label to be read in full. More info: https://axesslab.com/text-splitting/
|
|
49
|
+
// eslint-disable-next-line jsx-a11y/aria-role
|
|
50
|
+
role: "text",
|
|
51
|
+
className: getClassName('bpk-nudger__label--title-subtitle'),
|
|
52
|
+
children: [/*#__PURE__*/_jsx(BpkText, {
|
|
53
|
+
textStyle: TEXT_STYLES.heading5,
|
|
54
|
+
children: title
|
|
55
|
+
}), subtitle && /*#__PURE__*/_jsx(BpkText, {
|
|
56
|
+
className: getClassName('bpk-nudger__label--subtitle'),
|
|
57
|
+
children: subtitle
|
|
58
|
+
})]
|
|
59
|
+
})]
|
|
60
|
+
}), /*#__PURE__*/_jsx(BpkConfigurableNudger, {
|
|
61
|
+
inputClassName: getClassName('bpk-nudger__input--numeric'),
|
|
62
|
+
compareValues: compareValues,
|
|
63
|
+
incrementValue: incrementValue,
|
|
64
|
+
decrementValue: decrementValue,
|
|
65
|
+
formatValue: formatValue,
|
|
66
|
+
className: className,
|
|
67
|
+
buttonType: buttonType,
|
|
68
|
+
id: id,
|
|
69
|
+
...rest
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
};
|
|
42
73
|
export default BpkNudger;
|
|
@@ -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-nudger__button{position:relative}.bpk-nudger__input{display:inline-block;padding:0.5rem 0;border:none;color:#161616;text-align:center;vertical-align:middle;margin:0;font-size:
|
|
18
|
+
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-nudger__button{position:relative}.bpk-nudger__input{display:inline-block;padding:0.5rem 0;border:none;color:#161616;text-align:center;vertical-align:middle;margin:0;font-size:1rem;line-height:1.25rem;font-weight:700}.bpk-nudger__input--secondary-on-dark{background-color:transparent;color:#fff}.bpk-nudger__input--numeric{width:2.5rem}.bpk-nudger__container{display:flex;justify-content:space-between;align-items:center}.bpk-nudger__label{display:flex;gap:0.5rem}.bpk-nudger__label--title-subtitle{display:flex;flex-direction:column;justify-content:space-between}.bpk-nudger__label--subtitle{color:#545860}
|
|
@@ -16,14 +16,18 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import type { ReactNode } from "react";
|
|
19
20
|
export type CommonProps = {
|
|
20
21
|
id: string;
|
|
21
22
|
min: string | number;
|
|
22
23
|
max: string | number;
|
|
23
24
|
value: string | number;
|
|
24
|
-
onChange: (arg0: any) =>
|
|
25
|
+
onChange: (arg0: any) => void | null;
|
|
25
26
|
className?: string | null;
|
|
26
27
|
increaseButtonLabel: string;
|
|
27
28
|
decreaseButtonLabel: string;
|
|
28
29
|
buttonType?: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
subtitle?: string;
|
|
32
|
+
icon?: ReactNode;
|
|
29
33
|
};
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
// We disable eslint here as this package is listed as a peerDep so consumers are required to install this when using this package.
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
const nodeSass = require('node-sass');
|
|
22
22
|
|
|
23
23
|
module.exports = {
|
|
@@ -192,7 +192,7 @@ class Portal extends Component {
|
|
|
192
192
|
|
|
193
193
|
// This function is taken from modernizr
|
|
194
194
|
// See https://github.com/modernizr/modernizr
|
|
195
|
-
|
|
195
|
+
|
|
196
196
|
supportsPassiveEvents() {
|
|
197
197
|
let supportsPassiveOption = false;
|
|
198
198
|
try {
|
|
@@ -18,9 +18,7 @@
|
|
|
18
18
|
// We disable eslint on the below line because it breaks the flow type definitions and the FlowIssue comment below
|
|
19
19
|
// We can remove this when we migrate this file to TypeScript.
|
|
20
20
|
// $FlowIssue[value-as-type] - PropType is imported as a type so is incorrectly reporting the PropType is not a valid type
|
|
21
|
-
const deprecated = (propType, alternativeSuggestion) =>
|
|
22
|
-
// eslint-disable-line
|
|
23
|
-
(props, propName, componentName, ...rest) => {
|
|
21
|
+
const deprecated = (propType, alternativeSuggestion) => (props, propName, componentName, ...rest) => {
|
|
24
22
|
if (props[propName] != null) {
|
|
25
23
|
const message = `Warning: "${propName}" property of "${componentName}" has been deprecated. ${alternativeSuggestion}`;
|
|
26
24
|
// eslint-disable-next-line no-console
|
package/bpk-stylesheets/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import './index.scss';
|
|
|
27
27
|
|
|
28
28
|
// touch support
|
|
29
29
|
classNames.push(
|
|
30
|
-
'ontouchstart' in window ||
|
|
30
|
+
'ontouchstart' in window ||
|
|
31
31
|
(window.DocumentTouch && document instanceof DocumentTouch) // eslint-disable-line no-undef
|
|
32
32
|
? 'touch-support'
|
|
33
33
|
: 'no-touch-support',
|
|
@@ -35,7 +35,7 @@ import './index.scss';
|
|
|
35
35
|
|
|
36
36
|
// add more feature tests here...
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
document.documentElement.className += ` ${classNames
|
|
40
40
|
.map((className) => `bpk-${className}`)
|
|
41
41
|
.join(' ')}`;
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Backpack - Skyscanner's Design System
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2016 Skyscanner Ltd
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import BpkNudgerRow, { type Props as BpkNudgerRowProps } from './src/BpkNudgerRow';
|
|
20
|
-
export type { BpkNudgerRowProps };
|
|
21
|
-
export default BpkNudgerRow;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Backpack - Skyscanner's Design System
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2016 Skyscanner Ltd
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import BpkNudgerRow from "./src/BpkNudgerRow";
|
|
20
|
-
export default BpkNudgerRow;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Backpack - Skyscanner's Design System
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2016 Skyscanner Ltd
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/// <reference types="react" />
|
|
20
|
-
export type Props = {
|
|
21
|
-
title: string;
|
|
22
|
-
nudgerId: string;
|
|
23
|
-
value: number;
|
|
24
|
-
decreaseButtonLabel: string;
|
|
25
|
-
increaseButtonLabel: string;
|
|
26
|
-
min: number;
|
|
27
|
-
max: number;
|
|
28
|
-
onChange: (arg0: any) => (null | void);
|
|
29
|
-
subtitle?: string;
|
|
30
|
-
className?: string | null;
|
|
31
|
-
};
|
|
32
|
-
declare const BpkNudgerRow: ({ title, nudgerId, subtitle, decreaseButtonLabel, increaseButtonLabel, min, max, onChange, value, className }: Props) => JSX.Element;
|
|
33
|
-
export default BpkNudgerRow;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Backpack - Skyscanner's Design System
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2016 Skyscanner Ltd
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
20
|
-
import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
|
|
21
|
-
import BpkNudger from "../../bpk-component-nudger";
|
|
22
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
23
|
-
import BpkLabel from "../../bpk-component-label";
|
|
24
|
-
import STYLES from "./BpkNudgerRow.module.css";
|
|
25
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
-
const getClassName = cssModules(STYLES);
|
|
28
|
-
const BpkNudgerRow = ({
|
|
29
|
-
className = null,
|
|
30
|
-
decreaseButtonLabel,
|
|
31
|
-
increaseButtonLabel,
|
|
32
|
-
max,
|
|
33
|
-
min,
|
|
34
|
-
nudgerId,
|
|
35
|
-
onChange,
|
|
36
|
-
subtitle,
|
|
37
|
-
title,
|
|
38
|
-
value
|
|
39
|
-
}) => {
|
|
40
|
-
const classNames = getClassName('bpk-nudger-row', className);
|
|
41
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
42
|
-
className: classNames,
|
|
43
|
-
children: [/*#__PURE__*/_jsx(BpkLabel, {
|
|
44
|
-
htmlFor: nudgerId,
|
|
45
|
-
children: /*#__PURE__*/_jsxs("span", {
|
|
46
|
-
// For a11y on IOS, role='text' forces label to be read in full. More info: https://axesslab.com/text-splitting/
|
|
47
|
-
// eslint-disable-next-line jsx-a11y/aria-role
|
|
48
|
-
role: "text",
|
|
49
|
-
className: getClassName('bpk-nudger-row__title-subtitle'),
|
|
50
|
-
children: [/*#__PURE__*/_jsx(BpkText, {
|
|
51
|
-
textStyle: TEXT_STYLES.heading5,
|
|
52
|
-
children: title
|
|
53
|
-
}), subtitle && /*#__PURE__*/_jsx(BpkText, {
|
|
54
|
-
className: getClassName('bpk-nudger-row__subtitle'),
|
|
55
|
-
children: subtitle
|
|
56
|
-
})]
|
|
57
|
-
})
|
|
58
|
-
}), /*#__PURE__*/_jsx(BpkNudger, {
|
|
59
|
-
id: nudgerId,
|
|
60
|
-
decreaseButtonLabel: decreaseButtonLabel,
|
|
61
|
-
increaseButtonLabel: increaseButtonLabel,
|
|
62
|
-
min: min,
|
|
63
|
-
max: max,
|
|
64
|
-
onChange: onChange,
|
|
65
|
-
value: value
|
|
66
|
-
})]
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
export default BpkNudgerRow;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Backpack - Skyscanner's Design System
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2016 Skyscanner Ltd
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-nudger-row{display:flex;justify-content:space-between;align-items:center}.bpk-nudger-row__title-subtitle{display:flex;flex-direction:column;justify-content:space-between}.bpk-nudger-row__subtitle{color:#545860}
|