@skyscanner/backpack-web 42.11.0 → 42.13.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-comparison-table/index.d.ts +4 -1
- package/bpk-component-comparison-table/index.js +3 -1
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTable.d.ts +17 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTable.js +41 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTable.module.css +18 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableColumnHeader.d.ts +8 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableColumnHeader.js +66 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableColumnHeaderPlaceholder.d.ts +7 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableColumnHeaderPlaceholder.js +49 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableContent.d.ts +3 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableContent.js +94 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableHeader.d.ts +3 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableHeader.js +42 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableHeaderRow.d.ts +9 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableHeaderRow.js +52 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableRoot.d.ts +3 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableRoot.js +38 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/common-types.d.ts +73 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/common-types.js +1 -0
- package/bpk-component-comparison-table/src/BpkComparisonTray/BpkComparisonTray.module.css +1 -1
- package/bpk-component-segmented-control/src/BpkSegmentedControl.js +2 -0
- package/bpk-component-text/index.d.ts +3 -3
- package/bpk-component-text/index.js +2 -2
- package/bpk-component-text/src/BpkText.d.ts +9 -1
- package/bpk-component-text/src/BpkText.js +8 -1
- package/bpk-component-text/src/BpkText.module.css +1 -1
- package/bpk-stylesheets/base.css +1 -1
- package/bpk-stylesheets/index.scss +11 -1
- package/package.json +1 -1
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import BpkComparisonTable from './src/BpkComparisonTable/BpkComparisonTable';
|
|
1
2
|
import BpkComparisonTray from './src/BpkComparisonTray/BpkComparisonTray';
|
|
2
3
|
export type { BpkComparisonItem, BpkComparisonTrayRootProps, BpkComparisonTrayItemProps, BpkComparisonTrayNamespace, } from './src/BpkComparisonTray/common-types';
|
|
3
|
-
export
|
|
4
|
+
export type { BpkCompareRow, BpkCompareColumn, BpkComparisonTableRootProps, BpkComparisonTableStrings, BpkComparisonTableNamespace, } from './src/BpkComparisonTable/common-types';
|
|
5
|
+
export { BpkComparisonTray };
|
|
6
|
+
export default BpkComparisonTable;
|
|
@@ -16,5 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import BpkComparisonTable from "./src/BpkComparisonTable/BpkComparisonTable";
|
|
19
20
|
import BpkComparisonTray from "./src/BpkComparisonTray/BpkComparisonTray";
|
|
20
|
-
export
|
|
21
|
+
export { BpkComparisonTray };
|
|
22
|
+
export default BpkComparisonTable;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BpkComparisonTableNamespace } from './common-types';
|
|
2
|
+
/**
|
|
3
|
+
* BpkComparisonTable — side-by-side comparison modal.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* <BpkComparisonTable.Root isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
7
|
+
* <BpkComparisonTable.Header title="Compare cars" strings={strings} />
|
|
8
|
+
* <BpkComparisonTable.Content
|
|
9
|
+
* columns={columns}
|
|
10
|
+
* onRemove={(itemId) => handleRemove(itemId)}
|
|
11
|
+
* onAddMoreClick={() => setIsOpen(false)}
|
|
12
|
+
* strings={strings}
|
|
13
|
+
* />
|
|
14
|
+
* </BpkComparisonTable.Root>
|
|
15
|
+
*/
|
|
16
|
+
declare const BpkComparisonTable: BpkComparisonTableNamespace;
|
|
17
|
+
export default BpkComparisonTable;
|
|
@@ -0,0 +1,41 @@
|
|
|
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 BpkComparisonTableContent from "./BpkComparisonTableContent";
|
|
20
|
+
import BpkComparisonTableHeader from "./BpkComparisonTableHeader";
|
|
21
|
+
import BpkComparisonTableRoot from "./BpkComparisonTableRoot";
|
|
22
|
+
/**
|
|
23
|
+
* BpkComparisonTable — side-by-side comparison modal.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <BpkComparisonTable.Root isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
27
|
+
* <BpkComparisonTable.Header title="Compare cars" strings={strings} />
|
|
28
|
+
* <BpkComparisonTable.Content
|
|
29
|
+
* columns={columns}
|
|
30
|
+
* onRemove={(itemId) => handleRemove(itemId)}
|
|
31
|
+
* onAddMoreClick={() => setIsOpen(false)}
|
|
32
|
+
* strings={strings}
|
|
33
|
+
* />
|
|
34
|
+
* </BpkComparisonTable.Root>
|
|
35
|
+
*/
|
|
36
|
+
const BpkComparisonTable = {
|
|
37
|
+
Root: BpkComparisonTableRoot,
|
|
38
|
+
Header: BpkComparisonTableHeader,
|
|
39
|
+
Content: BpkComparisonTableContent
|
|
40
|
+
};
|
|
41
|
+
export default BpkComparisonTable;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
.bpk-comparison-table__scroll-container{flex:1;overflow:auto;min-block-size:0;overscroll-behavior:contain}.bpk-comparison-table__scroll-container tbody{transform:translateY(var(--bpk-rows-offset, 0))}.bpk-comparison-table__scroll-container td:not(:last-child){border-inline-end:1px solid #c1c7cf}.bpk-comparison-table__scroll-container th:not(:last-child)::after{position:absolute;content:"";background-color:#c1c7cf;inline-size:1px;inset-block-end:0;inset-block-start:1rem;inset-inline-end:0}.bpk-comparison-table__scroll-container table{border-collapse:separate;border-spacing:0;min-inline-size:33.75rem}.bpk-comparison-table__scroll-container th{position:sticky;z-index:1;padding:0;background-color:#fff;vertical-align:top;inset-block-start:0}.bpk-comparison-table__header-content{display:flex;padding:1rem;flex-direction:column}.bpk-comparison-table__header-image-wrapper{position:relative;opacity:var(--bpk-image-opacity, 1);margin-block-end:1rem}.bpk-comparison-table__header-image-area{display:flex;justify-content:center;align-items:center;border-radius:.25rem;background-color:#e0e4e9;overflow:hidden;block-size:5.1875rem}.bpk-comparison-table__header-image-area img{max-block-size:100%;max-inline-size:100%;object-fit:contain}.bpk-comparison-table__header-id-section{margin-block-start:calc(6.1875rem*(var(--bpk-image-opacity, 1) - 1))}.bpk-comparison-table__best-tag{position:absolute;z-index:1;transform:translateY(-50%);inset-block-start:0}.bpk-comparison-table__remove-button{opacity:var(--bpk-image-opacity, 1);overflow:clip;margin-block-start:calc(.5rem*var(--bpk-image-opacity, 1));max-block-size:calc(5rem*var(--bpk-image-opacity, 1));overflow-clip-margin:.25rem}.bpk-comparison-table__placeholder-cell{background-color:#fff}
|
package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableColumnHeader.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BpkCompareColumn } from './common-types';
|
|
2
|
+
type BpkComparisonTableColumnHeaderProps = Pick<BpkCompareColumn, 'imageSrc' | 'imageAlt' | 'headerContent' | 'itemId' | 'bestTag' | 'removeA11yLabel'> & {
|
|
3
|
+
removeLabel: string;
|
|
4
|
+
bestTagLabel: string;
|
|
5
|
+
onRemove: (itemId: string) => void;
|
|
6
|
+
};
|
|
7
|
+
declare const BpkComparisonTableColumnHeader: ({ bestTag, bestTagLabel, headerContent, imageAlt, imageSrc, itemId, onRemove, removeA11yLabel, removeLabel, }: BpkComparisonTableColumnHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default BpkComparisonTableColumnHeader;
|
package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableColumnHeader.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
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 BpkBadge, { BADGE_TYPES } from "../../../bpk-component-badge";
|
|
20
|
+
import BpkButton, { BUTTON_TYPES, SIZE_TYPES } from "../../../bpk-component-button";
|
|
21
|
+
import { cssModules } from "../../../bpk-react-utils";
|
|
22
|
+
import STYLES from "./BpkComparisonTable.module.css";
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
const getClassName = cssModules(STYLES);
|
|
25
|
+
const BpkComparisonTableColumnHeader = ({
|
|
26
|
+
bestTag = false,
|
|
27
|
+
bestTagLabel,
|
|
28
|
+
headerContent,
|
|
29
|
+
imageAlt = '',
|
|
30
|
+
imageSrc,
|
|
31
|
+
itemId,
|
|
32
|
+
onRemove,
|
|
33
|
+
removeA11yLabel,
|
|
34
|
+
removeLabel
|
|
35
|
+
}) => /*#__PURE__*/_jsxs("div", {
|
|
36
|
+
className: getClassName('bpk-comparison-table__header-content'),
|
|
37
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
38
|
+
className: getClassName('bpk-comparison-table__header-image-wrapper'),
|
|
39
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
40
|
+
className: getClassName('bpk-comparison-table__header-image-area'),
|
|
41
|
+
children: imageSrc && /*#__PURE__*/_jsx("img", {
|
|
42
|
+
src: imageSrc,
|
|
43
|
+
alt: imageAlt
|
|
44
|
+
})
|
|
45
|
+
}), bestTag && /*#__PURE__*/_jsx("span", {
|
|
46
|
+
className: getClassName('bpk-comparison-table__best-tag'),
|
|
47
|
+
children: /*#__PURE__*/_jsx(BpkBadge, {
|
|
48
|
+
type: BADGE_TYPES.brand,
|
|
49
|
+
children: bestTagLabel
|
|
50
|
+
})
|
|
51
|
+
})]
|
|
52
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
53
|
+
className: getClassName('bpk-comparison-table__header-id-section'),
|
|
54
|
+
children: headerContent
|
|
55
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
56
|
+
className: getClassName('bpk-comparison-table__remove-button'),
|
|
57
|
+
children: /*#__PURE__*/_jsx(BpkButton, {
|
|
58
|
+
type: BUTTON_TYPES.link,
|
|
59
|
+
size: SIZE_TYPES.small,
|
|
60
|
+
onClick: () => onRemove(itemId),
|
|
61
|
+
"aria-label": removeA11yLabel,
|
|
62
|
+
children: removeLabel
|
|
63
|
+
})
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
66
|
+
export default BpkComparisonTableColumnHeader;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type BpkComparisonTableColumnHeaderPlaceholderProps = {
|
|
2
|
+
addMoreDescription: string;
|
|
3
|
+
addMoreLinkText: string;
|
|
4
|
+
onAddMoreClick: () => void;
|
|
5
|
+
};
|
|
6
|
+
declare const BpkComparisonTableColumnHeaderPlaceholder: ({ addMoreDescription, addMoreLinkText, onAddMoreClick, }: BpkComparisonTableColumnHeaderPlaceholderProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default BpkComparisonTableColumnHeaderPlaceholder;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 BpkButton, { BUTTON_TYPES, SIZE_TYPES } from "../../../bpk-component-button";
|
|
20
|
+
import { BpkFlex, BpkSpacing } from "../../../bpk-component-layout";
|
|
21
|
+
import BpkText, { TEXT_COLORS, TEXT_STYLES } from "../../../bpk-component-text";
|
|
22
|
+
import { cssModules } from "../../../bpk-react-utils";
|
|
23
|
+
import STYLES from "./BpkComparisonTable.module.css";
|
|
24
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
+
const getClassName = cssModules(STYLES);
|
|
26
|
+
const BpkComparisonTableColumnHeaderPlaceholder = ({
|
|
27
|
+
addMoreDescription,
|
|
28
|
+
addMoreLinkText,
|
|
29
|
+
onAddMoreClick
|
|
30
|
+
}) => /*#__PURE__*/_jsxs(BpkFlex, {
|
|
31
|
+
direction: "column",
|
|
32
|
+
align: "center",
|
|
33
|
+
gap: BpkSpacing.MD,
|
|
34
|
+
paddingTop: BpkSpacing.LG,
|
|
35
|
+
paddingInline: BpkSpacing.XL,
|
|
36
|
+
children: [/*#__PURE__*/_jsx(BpkText, {
|
|
37
|
+
textAlign: "center",
|
|
38
|
+
tagName: "p",
|
|
39
|
+
textStyle: TEXT_STYLES.bodyDefault,
|
|
40
|
+
color: TEXT_COLORS.textSecondary,
|
|
41
|
+
children: addMoreDescription
|
|
42
|
+
}), /*#__PURE__*/_jsx(BpkButton, {
|
|
43
|
+
type: BUTTON_TYPES.link,
|
|
44
|
+
size: SIZE_TYPES.small,
|
|
45
|
+
onClick: onAddMoreClick,
|
|
46
|
+
children: addMoreLinkText
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
49
|
+
export default BpkComparisonTableColumnHeaderPlaceholder;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BpkComparisonTableContentProps } from './common-types';
|
|
2
|
+
declare const BpkComparisonTableContent: ({ columns, onAddMoreClick, onRemove, strings, }: BpkComparisonTableContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default BpkComparisonTableContent;
|
|
@@ -0,0 +1,94 @@
|
|
|
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 { useEffect, useRef } from 'react';
|
|
20
|
+
import { BpkTable, BpkTableBody, BpkTableCell, BpkTableRow, TABLE_BODY_TYPES } from "../../../bpk-component-table";
|
|
21
|
+
import { cssModules } from "../../../bpk-react-utils";
|
|
22
|
+
import BpkComparisonTableHeaderRow from "./BpkComparisonTableHeaderRow";
|
|
23
|
+
import STYLES from "./BpkComparisonTable.module.css";
|
|
24
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
+
const getClassName = cssModules(STYLES);
|
|
26
|
+
const MAX_COLUMNS = 3;
|
|
27
|
+
|
|
28
|
+
// Matches the image area height (5.1875rem × 16px). Opacity goes from 1 → 0 as the user scrolls 0 → 83 px, giving a smooth parallax fade.
|
|
29
|
+
const IMAGE_FADE_THRESHOLD_PX = 83;
|
|
30
|
+
const BpkComparisonTableContent = ({
|
|
31
|
+
columns,
|
|
32
|
+
onAddMoreClick,
|
|
33
|
+
onRemove,
|
|
34
|
+
strings
|
|
35
|
+
}) => {
|
|
36
|
+
const scrollContainerRef = useRef(null);
|
|
37
|
+
|
|
38
|
+
// Pad with nulls so the table always renders exactly MAX_COLUMNS slots.
|
|
39
|
+
const displayColumns = [...columns, null, null, null].slice(0, MAX_COLUMNS);
|
|
40
|
+
const rowIds = columns[0]?.rows.map(row => row.rowId) ?? [];
|
|
41
|
+
|
|
42
|
+
// Dev-mode guard: warn if not all columns share the same rowId sequence.
|
|
43
|
+
if (process.env.NODE_ENV !== 'production' && columns.length > 1) {
|
|
44
|
+
const rowIdsByColumn = columns.map(column => column.rows.map(row => row.rowId).join(','));
|
|
45
|
+
const allMatch = rowIdsByColumn.every(ids => ids === rowIdsByColumn[0]);
|
|
46
|
+
if (!allMatch) {
|
|
47
|
+
// eslint-disable-next-line no-console
|
|
48
|
+
console.warn('[BpkComparisonTable] Not all columns share the same rowId sequence. Rows may misalign.');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Pre-index cells by itemId → rowId for O(1) lookup during render.
|
|
53
|
+
const cellsByItemAndRow = new Map(columns.map(column => [column.itemId, new Map(column.rows.map(row => [row.rowId, row.cell]))]));
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
const container = scrollContainerRef.current;
|
|
56
|
+
if (!container) return undefined;
|
|
57
|
+
const handleScroll = () => {
|
|
58
|
+
const {
|
|
59
|
+
scrollTop
|
|
60
|
+
} = container;
|
|
61
|
+
// During the animation phase, push tbody down by the scroll amount so rows appear locked in place.
|
|
62
|
+
// Once the fade-out completes the offset is fixed at the threshold and normal scrolling resumes.
|
|
63
|
+
container.style.setProperty('--bpk-rows-offset', `${Math.min(scrollTop, IMAGE_FADE_THRESHOLD_PX)}px`);
|
|
64
|
+
container.style.setProperty('--bpk-image-opacity', `${1 - Math.min(scrollTop / IMAGE_FADE_THRESHOLD_PX, 1)}`);
|
|
65
|
+
};
|
|
66
|
+
container.addEventListener('scroll', handleScroll, {
|
|
67
|
+
passive: true
|
|
68
|
+
});
|
|
69
|
+
return () => container.removeEventListener('scroll', handleScroll);
|
|
70
|
+
}, []);
|
|
71
|
+
return /*#__PURE__*/_jsx("div", {
|
|
72
|
+
ref: scrollContainerRef,
|
|
73
|
+
className: getClassName('bpk-comparison-table__scroll-container'),
|
|
74
|
+
children: /*#__PURE__*/_jsxs(BpkTable, {
|
|
75
|
+
children: [/*#__PURE__*/_jsx(BpkComparisonTableHeaderRow, {
|
|
76
|
+
displayColumns: displayColumns,
|
|
77
|
+
onRemove: onRemove,
|
|
78
|
+
onAddMoreClick: onAddMoreClick,
|
|
79
|
+
strings: strings
|
|
80
|
+
}), /*#__PURE__*/_jsx(BpkTableBody, {
|
|
81
|
+
type: TABLE_BODY_TYPES.striped,
|
|
82
|
+
children: rowIds.map(rowId => /*#__PURE__*/_jsx(BpkTableRow, {
|
|
83
|
+
children: displayColumns.map((column, index) => /*#__PURE__*/_jsx(BpkTableCell, {
|
|
84
|
+
// Placeholder need a distinct background colour not available via BpkTableCell props
|
|
85
|
+
// eslint-disable-next-line @skyscanner/rules/forbid-component-props
|
|
86
|
+
className: column ? undefined : getClassName('bpk-comparison-table__placeholder-cell'),
|
|
87
|
+
children: column ? cellsByItemAndRow.get(column.itemId)?.get(rowId) ?? null : null
|
|
88
|
+
}, column ? `${rowId}-${column.itemId}` : `${rowId}-placeholder-${index}`))
|
|
89
|
+
}, rowId))
|
|
90
|
+
})]
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
export default BpkComparisonTableContent;
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { BpkBox, BpkSpacing } from "../../../bpk-component-layout";
|
|
20
|
+
import { BpkModalV3 } from "../../../bpk-component-modal";
|
|
21
|
+
import BpkVisuallyHidden from "../../../bpk-component-visually-hidden";
|
|
22
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
|
+
const BpkComparisonTableHeader = ({
|
|
24
|
+
children,
|
|
25
|
+
strings,
|
|
26
|
+
title
|
|
27
|
+
}) => /*#__PURE__*/_jsxs(_Fragment, {
|
|
28
|
+
children: [/*#__PURE__*/_jsxs(BpkModalV3.Header, {
|
|
29
|
+
children: [/*#__PURE__*/_jsx(BpkModalV3.Title, {
|
|
30
|
+
children: title ?? /*#__PURE__*/_jsx(BpkVisuallyHidden, {
|
|
31
|
+
children: strings.accessibleLabel
|
|
32
|
+
})
|
|
33
|
+
}), /*#__PURE__*/_jsx(BpkModalV3.CloseTrigger, {
|
|
34
|
+
label: strings.closeLabel
|
|
35
|
+
})]
|
|
36
|
+
}), children && /*#__PURE__*/_jsx(BpkBox, {
|
|
37
|
+
paddingBottom: BpkSpacing.MD,
|
|
38
|
+
paddingInline: BpkSpacing.Base,
|
|
39
|
+
children: children
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
42
|
+
export default BpkComparisonTableHeader;
|
package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableHeaderRow.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BpkComparisonTableStrings, BpkCompareColumn } from './common-types';
|
|
2
|
+
type BpkComparisonTableHeaderRowProps = {
|
|
3
|
+
displayColumns: Array<BpkCompareColumn | null>;
|
|
4
|
+
onRemove: (itemId: string) => void;
|
|
5
|
+
onAddMoreClick: () => void;
|
|
6
|
+
strings: BpkComparisonTableStrings;
|
|
7
|
+
};
|
|
8
|
+
declare const BpkComparisonTableHeaderRow: ({ displayColumns, onAddMoreClick, onRemove, strings, }: BpkComparisonTableHeaderRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default BpkComparisonTableHeaderRow;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { BpkTableHead, BpkTableHeadCell, BpkTableRow } from "../../../bpk-component-table";
|
|
20
|
+
import BpkComparisonTableColumnHeader from "./BpkComparisonTableColumnHeader";
|
|
21
|
+
import BpkComparisonTableColumnHeaderPlaceholder from "./BpkComparisonTableColumnHeaderPlaceholder";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
const BpkComparisonTableHeaderRow = ({
|
|
24
|
+
displayColumns,
|
|
25
|
+
onAddMoreClick,
|
|
26
|
+
onRemove,
|
|
27
|
+
strings
|
|
28
|
+
}) => {
|
|
29
|
+
const {
|
|
30
|
+
addMoreDescription,
|
|
31
|
+
addMoreLinkText,
|
|
32
|
+
bestTagLabel,
|
|
33
|
+
removeLabel
|
|
34
|
+
} = strings;
|
|
35
|
+
return /*#__PURE__*/_jsx(BpkTableHead, {
|
|
36
|
+
children: /*#__PURE__*/_jsx(BpkTableRow, {
|
|
37
|
+
children: displayColumns.map((column, index) => /*#__PURE__*/_jsx(BpkTableHeadCell, {
|
|
38
|
+
children: column ? /*#__PURE__*/_jsx(BpkComparisonTableColumnHeader, {
|
|
39
|
+
...column,
|
|
40
|
+
removeLabel: removeLabel,
|
|
41
|
+
onRemove: onRemove,
|
|
42
|
+
bestTagLabel: bestTagLabel
|
|
43
|
+
}) : /*#__PURE__*/_jsx(BpkComparisonTableColumnHeaderPlaceholder, {
|
|
44
|
+
addMoreDescription: addMoreDescription,
|
|
45
|
+
addMoreLinkText: addMoreLinkText,
|
|
46
|
+
onAddMoreClick: onAddMoreClick
|
|
47
|
+
})
|
|
48
|
+
}, column ? column.itemId : `placeholder-${index}`))
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export default BpkComparisonTableHeaderRow;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { BpkModalV3 } from "../../../bpk-component-modal";
|
|
20
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
const BpkComparisonTableRoot = ({
|
|
22
|
+
children,
|
|
23
|
+
isOpen,
|
|
24
|
+
onClose
|
|
25
|
+
}) => /*#__PURE__*/_jsx(BpkModalV3.Root, {
|
|
26
|
+
open: isOpen,
|
|
27
|
+
onOpenChange: details => {
|
|
28
|
+
if (!details.open) {
|
|
29
|
+
onClose();
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
children: /*#__PURE__*/_jsxs(BpkModalV3.Portal, {
|
|
33
|
+
children: [/*#__PURE__*/_jsx(BpkModalV3.Scrim, {}), /*#__PURE__*/_jsx(BpkModalV3.Content, {
|
|
34
|
+
children: children
|
|
35
|
+
})]
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
export default BpkComparisonTableRoot;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** A single row entry within a comparison column. */
|
|
3
|
+
export type BpkCompareRow = {
|
|
4
|
+
/** Stable unique identifier used to align rows across columns. */
|
|
5
|
+
rowId: string;
|
|
6
|
+
/** Cell content — consumer-controlled ReactNode. */
|
|
7
|
+
cell: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
/** Data for one filled comparison column. */
|
|
10
|
+
export type BpkCompareColumn = {
|
|
11
|
+
/** Stable unique identifier used for removal callbacks. */
|
|
12
|
+
itemId: string;
|
|
13
|
+
/** When true, renders a BpkBadge type=brand overlaying the top-left of the image area. */
|
|
14
|
+
bestTag?: boolean;
|
|
15
|
+
/** Image src for the header image area. */
|
|
16
|
+
imageSrc?: string;
|
|
17
|
+
/** Alt text for the header image. */
|
|
18
|
+
imageAlt?: string;
|
|
19
|
+
/** Consumer-owned slot rendered below the image area (name, description, price, CTA...). */
|
|
20
|
+
headerContent: ReactNode;
|
|
21
|
+
/** Row data — must match rowId sequences across all columns. */
|
|
22
|
+
rows: BpkCompareRow[];
|
|
23
|
+
/** Accessible label for the Remove button (e.g. "Remove rentalcars.com deal"). */
|
|
24
|
+
removeA11yLabel: string;
|
|
25
|
+
};
|
|
26
|
+
/** All strings required by BpkComparisonTable. */
|
|
27
|
+
export type BpkComparisonTableStrings = {
|
|
28
|
+
/** Accessible dialog name, used via BpkVisuallyHidden when no visible title is provided. */
|
|
29
|
+
accessibleLabel: string;
|
|
30
|
+
/** Accessible label for the modal close button. */
|
|
31
|
+
closeLabel: string;
|
|
32
|
+
/** Visible label for the Remove button in each column header. */
|
|
33
|
+
removeLabel: string;
|
|
34
|
+
/** Text inside the BpkBadge when bestTag=true (e.g. "Best"). */
|
|
35
|
+
bestTagLabel: string;
|
|
36
|
+
/** Description text inside the placeholder column. */
|
|
37
|
+
addMoreDescription: string;
|
|
38
|
+
/** Link text inside the placeholder column. */
|
|
39
|
+
addMoreLinkText: string;
|
|
40
|
+
};
|
|
41
|
+
/** Props for BpkComparisonTable.Root — modal shell only. */
|
|
42
|
+
export type BpkComparisonTableRootProps = {
|
|
43
|
+
/** Controls whether the modal is open. */
|
|
44
|
+
isOpen: boolean;
|
|
45
|
+
/** Called when the modal close trigger is activated or Escape is pressed. */
|
|
46
|
+
onClose: () => void;
|
|
47
|
+
/** BpkComparisonTable.Header and BpkComparisonTable.Content. */
|
|
48
|
+
children: ReactNode;
|
|
49
|
+
};
|
|
50
|
+
/** Props for BpkComparisonTable.Header — modal header + optional AiBlurb slot. */
|
|
51
|
+
export type BpkComparisonTableHeaderProps = {
|
|
52
|
+
/** Optional modal title rendered via BpkModalV3.Title. */
|
|
53
|
+
title?: string;
|
|
54
|
+
strings: BpkComparisonTableStrings;
|
|
55
|
+
/** Optional slot for AI blurb or any content below the title/close row. */
|
|
56
|
+
children?: ReactNode;
|
|
57
|
+
};
|
|
58
|
+
/** Props for BpkComparisonTable.Content — modal body with the comparison table. */
|
|
59
|
+
export type BpkComparisonTableContentProps = {
|
|
60
|
+
/** 1–3 filled columns. Component pads to 3 with placeholder cells automatically. */
|
|
61
|
+
columns: BpkCompareColumn[];
|
|
62
|
+
/** Called when a Remove button is clicked, with the column's itemId. */
|
|
63
|
+
onRemove: (itemId: string) => void;
|
|
64
|
+
/** Called when the Add more link in a placeholder column is clicked. */
|
|
65
|
+
onAddMoreClick: () => void;
|
|
66
|
+
strings: BpkComparisonTableStrings;
|
|
67
|
+
};
|
|
68
|
+
/** Namespace type covering all BpkComparisonTable subcomponents. */
|
|
69
|
+
export type BpkComparisonTableNamespace = {
|
|
70
|
+
Root: (props: BpkComparisonTableRootProps) => ReactNode;
|
|
71
|
+
Header: (props: BpkComparisonTableHeaderProps) => ReactNode;
|
|
72
|
+
Content: (props: BpkComparisonTableContentProps) => ReactNode;
|
|
73
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
-
.bpk-comparison-tray{width:22.1875rem;max-width:100%}
|
|
18
|
+
.bpk-comparison-tray{width:22.1875rem;max-width:100%}@media(max-width: 32rem){.bpk-comparison-tray{width:auto;min-width:0;flex:1}}.bpk-comparison-tray__item{position:relative;width:3.875rem;height:1.75rem;flex-shrink:0}.bpk-comparison-tray__item-image-container{width:100%;height:100%;background-color:#eff3f8;overflow:hidden;border-radius:.25rem}.bpk-comparison-tray__item-image-container img{object-fit:cover}.bpk-comparison-tray__item-close{position:relative;position:absolute;top:0;inset-inline-end:calc(-8*0.0625rem);display:flex;width:1rem;height:1rem;justify-content:center;align-items:center;transform:translateY(-50%);border:.125rem solid #fff;border-radius:50%;background-color:#161616;color:#fff;cursor:pointer;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}.bpk-comparison-tray__item-close::before{position:absolute;top:calc(-2.75rem/2 + 50%);left:calc(-2.75rem/2 + 50%);content:"";width:2.75rem;height:2.75rem}.bpk-comparison-tray__item-close svg{width:.5rem;height:.5rem;flex-shrink:0;fill:#fff}.bpk-comparison-tray__item-close:focus-visible{outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-comparison-tray__item-placeholder{width:3.875rem;height:1.75rem;flex-shrink:0;border:.0625rem dashed #c1c7cf;border-radius:.25rem}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import component, { TEXT_COLORS, TEXT_STYLES } from './src/BpkText';
|
|
1
|
+
import component, { TEXT_ALIGN, TEXT_COLORS, TEXT_STYLES } from './src/BpkText';
|
|
2
2
|
export default component;
|
|
3
|
-
export { TEXT_COLORS, TEXT_STYLES };
|
|
4
|
-
export type { Tag, TextStyle, TextColor } from './src/BpkText';
|
|
3
|
+
export { TEXT_ALIGN, TEXT_COLORS, TEXT_STYLES };
|
|
4
|
+
export type { Tag, TextAlign, TextStyle, TextColor } from './src/BpkText';
|
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import component, { TEXT_COLORS, TEXT_STYLES } from "./src/BpkText";
|
|
19
|
+
import component, { TEXT_ALIGN, TEXT_COLORS, TEXT_STYLES } from "./src/BpkText";
|
|
20
20
|
export default component;
|
|
21
|
-
export { TEXT_COLORS, TEXT_STYLES };
|
|
21
|
+
export { TEXT_ALIGN, TEXT_COLORS, TEXT_STYLES };
|
|
@@ -32,6 +32,12 @@ export declare const TEXT_STYLES: {
|
|
|
32
32
|
readonly editorial2: "editorial-2";
|
|
33
33
|
readonly editorial3: "editorial-3";
|
|
34
34
|
};
|
|
35
|
+
export declare const TEXT_ALIGN: {
|
|
36
|
+
readonly start: "start";
|
|
37
|
+
readonly end: "end";
|
|
38
|
+
readonly center: "center";
|
|
39
|
+
readonly justify: "justify";
|
|
40
|
+
};
|
|
35
41
|
export declare const TEXT_COLORS: {
|
|
36
42
|
readonly textDisabled: "text-disabled";
|
|
37
43
|
readonly textDisabledOnDark: "text-disabled-on-dark";
|
|
@@ -45,6 +51,7 @@ export declare const TEXT_COLORS: {
|
|
|
45
51
|
readonly textSecondary: "text-secondary";
|
|
46
52
|
readonly textSuccess: "text-success";
|
|
47
53
|
};
|
|
54
|
+
export type TextAlign = (typeof TEXT_ALIGN)[keyof typeof TEXT_ALIGN];
|
|
48
55
|
export type TextColor = (typeof TEXT_COLORS)[keyof typeof TEXT_COLORS];
|
|
49
56
|
export type TextStyle = (typeof TEXT_STYLES)[keyof typeof TEXT_STYLES];
|
|
50
57
|
export type Tag = 'span' | 'p' | 'text' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
@@ -54,8 +61,9 @@ type Props = {
|
|
|
54
61
|
tagName?: Tag;
|
|
55
62
|
className?: string | null;
|
|
56
63
|
color?: TextColor | null;
|
|
64
|
+
textAlign?: TextAlign | null;
|
|
57
65
|
id?: string;
|
|
58
66
|
[rest: string]: any;
|
|
59
67
|
};
|
|
60
|
-
declare const BpkText: ({ children, className, color, tagName: TagName, textStyle, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
declare const BpkText: ({ children, className, color, tagName: TagName, textAlign, textStyle, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
61
69
|
export default BpkText;
|
|
@@ -53,6 +53,12 @@ export const TEXT_STYLES = {
|
|
|
53
53
|
editorial2: 'editorial-2',
|
|
54
54
|
editorial3: 'editorial-3'
|
|
55
55
|
};
|
|
56
|
+
export const TEXT_ALIGN = {
|
|
57
|
+
start: 'start',
|
|
58
|
+
end: 'end',
|
|
59
|
+
center: 'center',
|
|
60
|
+
justify: 'justify'
|
|
61
|
+
};
|
|
56
62
|
export const TEXT_COLORS = {
|
|
57
63
|
textDisabled: 'text-disabled',
|
|
58
64
|
textDisabledOnDark: 'text-disabled-on-dark',
|
|
@@ -71,10 +77,11 @@ const BpkText = ({
|
|
|
71
77
|
className = null,
|
|
72
78
|
color = null,
|
|
73
79
|
tagName: TagName = 'span',
|
|
80
|
+
textAlign = null,
|
|
74
81
|
textStyle = TEXT_STYLES.bodyDefault,
|
|
75
82
|
...rest
|
|
76
83
|
}) => {
|
|
77
|
-
const classNames = getClassName('bpk-text', `bpk-text--${textStyle}`, color ? `bpk-text--${color}` : '', className);
|
|
84
|
+
const classNames = getClassName('bpk-text', `bpk-text--${textStyle}`, color ? `bpk-text--${color}` : '', textAlign ? `bpk-text--align-${textAlign}` : '', className);
|
|
78
85
|
return (
|
|
79
86
|
/*#__PURE__*/
|
|
80
87
|
// Allowed, TagName is always a dom element.
|
|
@@ -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
|
-
.bpk-text{margin:0}.bpk-text--xs{font-size:.75rem;line-height:1rem;font-weight:400}.bpk-text--sm{font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-text--base{font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-text--lg{font-size:1.25rem;line-height:1.75rem;font-weight:400}.bpk-text--xl{font-size:1.5rem;line-height:2rem;font-weight:400}.bpk-text--xxl{font-size:2rem;line-height:2.5rem;font-weight:700}.bpk-text--xxxl{font-size:2.5rem;line-height:3rem;font-weight:700}.bpk-text--xxxxl{font-size:3rem;line-height:3.5rem;font-weight:700;letter-spacing:-0.02em}.bpk-text--xxxxxl{font-size:4rem;line-height:4rem;font-weight:700;letter-spacing:-0.02em}.bpk-text--caption{font-size:.75rem;line-height:1rem;font-weight:400}.bpk-text--footnote{font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-text--label-1{font-size:1rem;line-height:1.5rem;font-weight:700}.bpk-text--label-2{font-size:.875rem;line-height:1.25rem;font-weight:700}.bpk-text--label-3{font-size:.75rem;line-height:1rem;font-weight:700}.bpk-text--body-default{font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-text--body-longform{font-size:1.25rem;line-height:1.75rem;font-weight:400}.bpk-text--subheading{font-size:1.5rem;line-height:2rem;font-weight:400}.bpk-text--heading-1{font-size:2.5rem;line-height:3rem;font-weight:700}.bpk-text--heading-2{font-size:2rem;line-height:2.5rem;font-weight:700}.bpk-text--heading-3{font-size:1.5rem;line-height:1.75rem;font-weight:700}.bpk-text--heading-4{font-size:1.25rem;line-height:1.5rem;font-weight:700}.bpk-text--heading-5{font-size:1rem;line-height:1.25rem;font-weight:700}.bpk-text--hero-1{font-size:7.5rem;line-height:7.5rem;font-weight:900;letter-spacing:-0.04em}.bpk-text--hero-2{font-size:6rem;line-height:6rem;font-weight:900;letter-spacing:-0.04em}.bpk-text--hero-3{font-size:4.75rem;line-height:4.75rem;font-weight:900;letter-spacing:-0.04em}.bpk-text--hero-4{font-size:4rem;line-height:4rem;font-weight:900;letter-spacing:-0.04em}.bpk-text--hero-5{font-size:3rem;line-height:3rem;font-weight:900;letter-spacing:-0.04em}.bpk-text--hero-6{font-size:2.5rem;line-height:2.5rem;font-weight:900;letter-spacing:-0.04em}.bpk-text--editorial-1{font-family:var(--bpk-larken-font-stack, "Larken", sans-serif);font-size:3rem;line-height:3.5rem;font-weight:300}.bpk-text--editorial-2{font-family:var(--bpk-larken-font-stack, "Larken", sans-serif);font-size:2rem;line-height:2.5rem;font-weight:300}.bpk-text--editorial-3{font-family:var(--bpk-larken-font-stack, "Larken", sans-serif);font-size:1.25rem;line-height:1.75rem;font-weight:400}.bpk-text.bpk-text--text-disabled{color:rgba(0,0,0,.2)}.bpk-text.bpk-text--text-disabled-on-dark{color:hsla(0,0%,100%,.5)}.bpk-text.bpk-text--text-error{color:#e70866}.bpk-text.bpk-text--text-hero{color:#0062e3}.bpk-text.bpk-text--text-link{color:#0062e3}.bpk-text.bpk-text--text-on-dark{color:#fff}.bpk-text.bpk-text--text-on-light{color:#161616}.bpk-text.bpk-text--text-primary{color:#161616}.bpk-text.bpk-text--text-primary-inverse{color:#fff}.bpk-text.bpk-text--text-secondary{color:#626971}.bpk-text.bpk-text--text-success{color:#0c838a}
|
|
18
|
+
.bpk-text{margin:0}.bpk-text--xs{font-size:.75rem;line-height:1rem;font-weight:400}.bpk-text--sm{font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-text--base{font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-text--lg{font-size:1.25rem;line-height:1.75rem;font-weight:400}.bpk-text--xl{font-size:1.5rem;line-height:2rem;font-weight:400}.bpk-text--xxl{font-size:2rem;line-height:2.5rem;font-weight:700}.bpk-text--xxxl{font-size:2.5rem;line-height:3rem;font-weight:700}.bpk-text--xxxxl{font-size:3rem;line-height:3.5rem;font-weight:700;letter-spacing:-0.02em}.bpk-text--xxxxxl{font-size:4rem;line-height:4rem;font-weight:700;letter-spacing:-0.02em}.bpk-text--caption{font-size:.75rem;line-height:1rem;font-weight:400}.bpk-text--footnote{font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-text--label-1{font-size:1rem;line-height:1.5rem;font-weight:700}.bpk-text--label-2{font-size:.875rem;line-height:1.25rem;font-weight:700}.bpk-text--label-3{font-size:.75rem;line-height:1rem;font-weight:700}.bpk-text--body-default{font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-text--body-longform{font-size:1.25rem;line-height:1.75rem;font-weight:400}.bpk-text--subheading{font-size:1.5rem;line-height:2rem;font-weight:400}.bpk-text--heading-1{font-size:2.5rem;line-height:3rem;font-weight:700}.bpk-text--heading-2{font-size:2rem;line-height:2.5rem;font-weight:700}.bpk-text--heading-3{font-size:1.5rem;line-height:1.75rem;font-weight:700}.bpk-text--heading-4{font-size:1.25rem;line-height:1.5rem;font-weight:700}.bpk-text--heading-5{font-size:1rem;line-height:1.25rem;font-weight:700}.bpk-text--hero-1{font-size:7.5rem;line-height:7.5rem;font-weight:900;letter-spacing:-0.04em}.bpk-text--hero-2{font-size:6rem;line-height:6rem;font-weight:900;letter-spacing:-0.04em}.bpk-text--hero-3{font-size:4.75rem;line-height:4.75rem;font-weight:900;letter-spacing:-0.04em}.bpk-text--hero-4{font-size:4rem;line-height:4rem;font-weight:900;letter-spacing:-0.04em}.bpk-text--hero-5{font-size:3rem;line-height:3rem;font-weight:900;letter-spacing:-0.04em}.bpk-text--hero-6{font-size:2.5rem;line-height:2.5rem;font-weight:900;letter-spacing:-0.04em}.bpk-text--editorial-1{font-family:var(--bpk-larken-font-stack, "Larken", sans-serif);font-size:3rem;line-height:3.5rem;font-weight:300}.bpk-text--editorial-2{font-family:var(--bpk-larken-font-stack, "Larken", sans-serif);font-size:2rem;line-height:2.5rem;font-weight:300}.bpk-text--editorial-3{font-family:var(--bpk-larken-font-stack, "Larken", sans-serif);font-size:1.25rem;line-height:1.75rem;font-weight:400}.bpk-text.bpk-text--text-disabled{color:rgba(0,0,0,.2)}.bpk-text.bpk-text--text-disabled-on-dark{color:hsla(0,0%,100%,.5)}.bpk-text.bpk-text--text-error{color:#e70866}.bpk-text.bpk-text--text-hero{color:#0062e3}.bpk-text.bpk-text--text-link{color:#0062e3}.bpk-text.bpk-text--text-on-dark{color:#fff}.bpk-text.bpk-text--text-on-light{color:#161616}.bpk-text.bpk-text--text-primary{color:#161616}.bpk-text.bpk-text--text-primary-inverse{color:#fff}.bpk-text.bpk-text--text-secondary{color:#626971}.bpk-text.bpk-text--text-success{color:#0c838a}.bpk-text--align-start{text-align:start}.bpk-text--align-end{text-align:end}.bpk-text--align-center{text-align:center}.bpk-text--align-justify{text-align:justify}
|
package/bpk-stylesheets/base.css
CHANGED
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*
|
|
19
|
-
*//*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}progress{vertical-align:baseline}template,[hidden]{display:none}a{background-color:rgba(0,0,0,0);-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}svg:not(:root){overflow:hidden}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}button,input,optgroup,select,textarea{font:inherit;margin:0}optgroup{font-weight:bold}button,input{overflow:visible}button,select{text-transform:none}button,html [type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-input-placeholder{color:inherit;opacity:.54}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}html{font-size:100%;box-sizing:border-box}*{box-sizing:inherit}*::before,*::after{box-sizing:inherit}body{color:#161616;font-family:var(--bpk-base-font-stack, "Skyscanner Relative", -apple-system, BlinkMacSystemFont, "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);font-size:1rem;line-height:1.3rem}body.scaffold-font-size{font-size:13px}body.enable-font-smoothing{-webkit-font-smoothing:antialiased}:focus-visible{outline:.125rem solid #0062e3;outline-offset:.125rem}.hidden,.hide{display:none !important}.visuallyhidden,.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;white-space:nowrap;overflow:hidden;clip:rect(0 0 0 0)}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus,.visually-hidden.focusable:active,.visually-hidden.focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}.invisible{visibility:hidden}.clearfix::before,.clearfix::after{content:"";display:table}.clearfix::after{clear:both}
|
|
19
|
+
*//*! normalize.css v4.1.1 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}progress{vertical-align:baseline}template,[hidden]{display:none}a{background-color:rgba(0,0,0,0);-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}svg:not(:root){overflow:hidden}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}button,input,optgroup,select,textarea{font:inherit;margin:0}optgroup{font-weight:bold}button,input{overflow:visible}button,select{text-transform:none}button,html [type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-input-placeholder{color:inherit;opacity:.54}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}html{font-size:100%;box-sizing:border-box}*{box-sizing:inherit}*::before,*::after{box-sizing:inherit}body{color:#161616;font-family:var(--bpk-base-font-stack, "Skyscanner Relative", -apple-system, BlinkMacSystemFont, "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif);font-size:1rem;line-height:1.3rem}body.scaffold-font-size{font-size:13px}body.enable-font-smoothing{-webkit-font-smoothing:antialiased}:focus-visible,button:focus-visible,[type=button]:focus-visible,[type=reset]:focus-visible,[type=submit]:focus-visible{outline:.125rem solid #0062e3;outline-offset:.125rem}.hidden,.hide{display:none !important}.visuallyhidden,.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;white-space:nowrap;overflow:hidden;clip:rect(0 0 0 0)}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus,.visually-hidden.focusable:active,.visually-hidden.focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}.invisible{visibility:hidden}.clearfix::before,.clearfix::after{content:"";display:table}.clearfix::after{clear:both}
|
|
@@ -51,7 +51,17 @@ body {
|
|
|
51
51
|
-webkit-font-smoothing: antialiased;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
// normalize.css 4.x ships Firefox `:-moz-focusring` rules for both `button` and
|
|
55
|
+
// button-like input controls. These have mixed specificity: `button:-moz-focusring`
|
|
56
|
+
// is 0-1-1, while `[type='button'|'reset'|'submit']:-moz-focusring` is 0-2-0, and
|
|
57
|
+
// both beat a bare `:focus-visible` rule (0-1-0) in Firefox. Adding matching
|
|
58
|
+
// button/control `:focus-visible` selectors lets Backpack's ring win by source
|
|
59
|
+
// order, restoring WCAG-compliant focus visibility on those controls.
|
|
60
|
+
:focus-visible,
|
|
61
|
+
button:focus-visible,
|
|
62
|
+
[type='button']:focus-visible,
|
|
63
|
+
[type='reset']:focus-visible,
|
|
64
|
+
[type='submit']:focus-visible {
|
|
55
65
|
@include utils.bpk-focus-indicator;
|
|
56
66
|
}
|
|
57
67
|
|