@skyscanner/backpack-web 37.7.0 → 37.8.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-card-list/index.d.ts +1 -1
- package/bpk-component-card-list/src/BpkCardList.js +97 -6
- package/bpk-component-card-list/src/BpkCardListGridStack/BpkCardListGridStack.d.ts +3 -0
- package/bpk-component-card-list/src/BpkCardListGridStack/BpkCardListGridStack.js +89 -0
- package/bpk-component-card-list/src/BpkCardListGridStack/BpkCardListGridStack.module.css +18 -0
- package/bpk-component-card-list/src/BpkCardListGridStack/index.d.ts +2 -0
- package/bpk-component-card-list/src/BpkCardListGridStack/index.js +20 -0
- package/bpk-component-card-list/src/BpkExpand/ExpandAccessoryContent.d.ts +3 -0
- package/bpk-component-card-list/src/BpkExpand/ExpandAccessoryContent.js +37 -0
- package/bpk-component-card-list/src/BpkExpand/index.d.ts +2 -0
- package/bpk-component-card-list/src/BpkExpand/index.js +20 -0
- package/bpk-component-card-list/src/common-types.d.ts +48 -2
- package/bpk-component-card-list/src/common-types.js +50 -1
- package/bpk-component-card-list/testMocks.js +27 -0
- package/bpk-component-datepicker/src/BpkDatepicker.js +1 -1
- package/bpk-component-drawer/src/BpkDrawer.d.ts +2 -1
- package/bpk-component-drawer/src/BpkDrawer.js +2 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import BpkCardList from
|
|
1
|
+
import BpkCardList from './src/BpkCardList';
|
|
2
2
|
export default BpkCardList;
|
|
@@ -16,35 +16,126 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { useState, useEffect } from 'react';
|
|
20
|
+
import BpkBreakpoint, { BREAKPOINTS } from "../../bpk-component-breakpoint";
|
|
19
21
|
import { BpkButtonV2 } from "../../bpk-component-button";
|
|
20
22
|
import BpkSectionHeader from "../../bpk-component-section-header";
|
|
21
23
|
import { cssModules } from "../../bpk-react-utils";
|
|
24
|
+
import BpkCardListGridStack from "./BpkCardListGridStack";
|
|
25
|
+
// import BpkCardListRowRailContainer from './BpkCardListRowRail';
|
|
26
|
+
import { ACCESSORY_DESKTOP_TYPES, ACCESSORY_MOBILE_TYPES, LAYOUTS } from "./common-types";
|
|
22
27
|
import STYLES from "./BpkCardList.module.css";
|
|
23
28
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
29
|
const getClassName = cssModules(STYLES);
|
|
30
|
+
const DEFAULT_ITEMS = 3;
|
|
25
31
|
const BpkCardList = props => {
|
|
26
32
|
const {
|
|
33
|
+
accessoryDesktop,
|
|
34
|
+
accessoryMobile,
|
|
35
|
+
buttonContent,
|
|
27
36
|
buttonHref,
|
|
28
|
-
|
|
37
|
+
cardList,
|
|
38
|
+
chipGroup,
|
|
29
39
|
description,
|
|
40
|
+
expandText,
|
|
41
|
+
initiallyShownCards = DEFAULT_ITEMS,
|
|
42
|
+
layoutDesktop,
|
|
43
|
+
layoutMobile,
|
|
30
44
|
onButtonClick,
|
|
45
|
+
onExpandClick,
|
|
31
46
|
title
|
|
32
47
|
} = props;
|
|
33
|
-
const
|
|
48
|
+
const [showHeaderButton, setShowHeaderButton] = useState(false);
|
|
49
|
+
const [isMobileActive, setIsMobileActive] = useState(false);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (isMobileActive) {
|
|
52
|
+
setShowHeaderButton(!!buttonContent && accessoryMobile !== ACCESSORY_MOBILE_TYPES.button);
|
|
53
|
+
} else {
|
|
54
|
+
setShowHeaderButton(!!buttonContent && accessoryDesktop !== ACCESSORY_DESKTOP_TYPES.button);
|
|
55
|
+
}
|
|
56
|
+
}, [isMobileActive, buttonContent, accessoryMobile, accessoryDesktop]);
|
|
57
|
+
const headerButton = buttonContent && /*#__PURE__*/_jsx(BpkButtonV2, {
|
|
34
58
|
onClick: onButtonClick,
|
|
35
59
|
href: buttonHref,
|
|
36
|
-
|
|
60
|
+
"data-testid": "bpk-card-list-header-button",
|
|
61
|
+
children: buttonContent
|
|
37
62
|
});
|
|
38
63
|
return /*#__PURE__*/_jsxs("div", {
|
|
39
64
|
className: getClassName('bpk-card-list'),
|
|
65
|
+
"data-testid": "bpk-card-list",
|
|
40
66
|
children: [/*#__PURE__*/_jsx(BpkSectionHeader, {
|
|
41
67
|
title: title,
|
|
42
68
|
description: description,
|
|
43
|
-
button:
|
|
44
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
69
|
+
button: showHeaderButton ? headerButton : null
|
|
70
|
+
}), chipGroup, /*#__PURE__*/_jsx("div", {
|
|
45
71
|
className: getClassName('bpk-card-list--card-list'),
|
|
46
72
|
"data-testid": "bpk-card-list--card-list",
|
|
47
|
-
children:
|
|
73
|
+
children: /*#__PURE__*/_jsx(BpkBreakpoint, {
|
|
74
|
+
query: BREAKPOINTS.MOBILE,
|
|
75
|
+
children: isActive => {
|
|
76
|
+
if (isActive) {
|
|
77
|
+
setIsMobileActive(isActive);
|
|
78
|
+
|
|
79
|
+
// if (layoutMobile === LAYOUTS.rail) {
|
|
80
|
+
// return (
|
|
81
|
+
// <BpkCardListRowRailContainer
|
|
82
|
+
// initiallyShownCards={initiallyShownCards}
|
|
83
|
+
// layout={layoutMobile}
|
|
84
|
+
// >
|
|
85
|
+
// {cardList}
|
|
86
|
+
// </BpkCardListRowRailContainer>
|
|
87
|
+
// );
|
|
88
|
+
// }
|
|
89
|
+
|
|
90
|
+
if (layoutMobile === LAYOUTS.stack) {
|
|
91
|
+
return /*#__PURE__*/_jsx(BpkCardListGridStack, {
|
|
92
|
+
accessory: accessoryMobile,
|
|
93
|
+
initiallyShownCards: initiallyShownCards,
|
|
94
|
+
buttonContent: buttonContent,
|
|
95
|
+
expandText: expandText,
|
|
96
|
+
onButtonClick: onButtonClick,
|
|
97
|
+
onExpandClick: onExpandClick,
|
|
98
|
+
layout: layoutMobile,
|
|
99
|
+
buttonHref: buttonHref,
|
|
100
|
+
children: cardList
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/// ///// Desktop Cases ////////
|
|
106
|
+
|
|
107
|
+
// if (
|
|
108
|
+
// layoutDesktop === LAYOUTS.row &&
|
|
109
|
+
// accessoryDesktop !== ACCESSORY_DESKTOP_TYPES.expand &&
|
|
110
|
+
// accessoryDesktop !== ACCESSORY_DESKTOP_TYPES.button
|
|
111
|
+
// ) {
|
|
112
|
+
// return (
|
|
113
|
+
// <BpkCardListRowRailContainer
|
|
114
|
+
// accessory={accessoryDesktop}
|
|
115
|
+
// initiallyShownCards={initiallyShownCards}
|
|
116
|
+
// layout={layoutDesktop}
|
|
117
|
+
// >
|
|
118
|
+
// {cardList}
|
|
119
|
+
// </BpkCardListRowRailContainer>
|
|
120
|
+
// );
|
|
121
|
+
// }
|
|
122
|
+
|
|
123
|
+
if (layoutDesktop === LAYOUTS.grid && accessoryDesktop !== ACCESSORY_DESKTOP_TYPES.pagination) {
|
|
124
|
+
return /*#__PURE__*/_jsx(BpkCardListGridStack, {
|
|
125
|
+
accessory: accessoryDesktop,
|
|
126
|
+
initiallyShownCards: initiallyShownCards,
|
|
127
|
+
buttonContent: buttonContent,
|
|
128
|
+
expandText: expandText,
|
|
129
|
+
onButtonClick: onButtonClick,
|
|
130
|
+
onExpandClick: onExpandClick,
|
|
131
|
+
layout: layoutDesktop,
|
|
132
|
+
buttonHref: buttonHref,
|
|
133
|
+
children: cardList
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
})
|
|
48
139
|
})]
|
|
49
140
|
});
|
|
50
141
|
};
|
|
@@ -0,0 +1,89 @@
|
|
|
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 { Children, useState } from 'react';
|
|
20
|
+
import { BpkButtonV2 } from "../../../bpk-component-button";
|
|
21
|
+
import { cssModules } from "../../../bpk-react-utils";
|
|
22
|
+
import ExpandAccessoryContent from "../BpkExpand/ExpandAccessoryContent";
|
|
23
|
+
import { ACCESSORY_DESKTOP_TYPES } from "../common-types";
|
|
24
|
+
import STYLES from "./BpkCardListGridStack.module.css";
|
|
25
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
+
const getClassName = cssModules(STYLES);
|
|
27
|
+
const BpkCardListGridStack = props => {
|
|
28
|
+
const {
|
|
29
|
+
accessory,
|
|
30
|
+
buttonContent,
|
|
31
|
+
buttonHref,
|
|
32
|
+
children,
|
|
33
|
+
expandText,
|
|
34
|
+
initiallyShownCards,
|
|
35
|
+
layout,
|
|
36
|
+
onButtonClick,
|
|
37
|
+
onExpandClick
|
|
38
|
+
} = props;
|
|
39
|
+
const gridStyle = {
|
|
40
|
+
'--initially-shown-cards': initiallyShownCards
|
|
41
|
+
};
|
|
42
|
+
const isExpandType = accessory === ACCESSORY_DESKTOP_TYPES.expand; // or ACCESSORY_MOBILE_TYPES.expand
|
|
43
|
+
const defaultInitiallyShownCards = isExpandType ? initiallyShownCards : children.length;
|
|
44
|
+
const showExpand = isExpandType ? children.length > defaultInitiallyShownCards : false;
|
|
45
|
+
const [collapsed, setCollapsed] = useState(true);
|
|
46
|
+
const showButton = accessory === ACCESSORY_DESKTOP_TYPES.button;
|
|
47
|
+
const childrenArray = Children.toArray(children);
|
|
48
|
+
const initialCards = childrenArray.slice(0, defaultInitiallyShownCards);
|
|
49
|
+
const restCards = childrenArray.slice(defaultInitiallyShownCards, childrenArray.length);
|
|
50
|
+
const onExpandTogle = () => {
|
|
51
|
+
setCollapsed(prev => !prev);
|
|
52
|
+
onExpandClick?.();
|
|
53
|
+
};
|
|
54
|
+
const expandAccessoryContent = /*#__PURE__*/_jsx(ExpandAccessoryContent, {
|
|
55
|
+
collapsed: collapsed,
|
|
56
|
+
onExpandTogle: onExpandTogle,
|
|
57
|
+
children: expandText || ''
|
|
58
|
+
});
|
|
59
|
+
const buttonAccessoryContent = /*#__PURE__*/_jsx("div", {
|
|
60
|
+
className: getClassName('bpk-card-list-grid-stack__accessory__button'),
|
|
61
|
+
children: /*#__PURE__*/_jsx(BpkButtonV2, {
|
|
62
|
+
"data-testid": "bpk-card-list__accessory-button",
|
|
63
|
+
onClick: onButtonClick,
|
|
64
|
+
href: buttonHref,
|
|
65
|
+
children: buttonContent
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
69
|
+
className: getClassName('bpk-card-list-grid-stack'),
|
|
70
|
+
"data-testid": "bpk-card-list-grid-stack",
|
|
71
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
72
|
+
className: getClassName(`bpk-card-list-grid-stack__${layout}`),
|
|
73
|
+
"data-testid": "bpk-card-list-grid-stack__initial-content",
|
|
74
|
+
style: gridStyle,
|
|
75
|
+
children: initialCards
|
|
76
|
+
}), showButton && buttonAccessoryContent, showExpand &&
|
|
77
|
+
/*#__PURE__*/
|
|
78
|
+
// This is for A11y considerations
|
|
79
|
+
_jsxs(_Fragment, {
|
|
80
|
+
children: [collapsed === true && expandAccessoryContent, /*#__PURE__*/_jsx("div", {
|
|
81
|
+
className: getClassName(`bpk-card-list-grid-stack__${layout}`),
|
|
82
|
+
"data-testid": "bpk-card-list-grid-stack__expanded-content",
|
|
83
|
+
style: gridStyle,
|
|
84
|
+
children: collapsed === false && restCards
|
|
85
|
+
}), collapsed === false && expandAccessoryContent]
|
|
86
|
+
})]
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
export default BpkCardListGridStack;
|
|
@@ -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-card-list-grid-stack{display:grid;gap:1.5rem}.bpk-card-list-grid-stack__grid{display:grid;grid-template-columns:repeat(var(--initially-shown-cards, 3), auto);gap:1.5rem}.bpk-card-list-grid-stack__stack{display:grid;grid-template-columns:1;gap:1.5rem}.bpk-card-list-grid-stack__accessory__button{width:auto}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 BpkCardListGridStack from "./BpkCardListGridStack";
|
|
20
|
+
export default BpkCardListGridStack;
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { BUTTON_TYPES, BpkButtonV2 } from "../../../bpk-component-button";
|
|
20
|
+
import { withButtonAlignment, withRtlSupport } from "../../../bpk-component-icon";
|
|
21
|
+
import ChevronDown from "../../../bpk-component-icon/sm/chevron-down";
|
|
22
|
+
import ChevronUp from "../../../bpk-component-icon/sm/chevron-up";
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
const AlignedChevronDownIcon = withButtonAlignment(withRtlSupport(ChevronDown));
|
|
25
|
+
const AlignedChevronUpIcon = withButtonAlignment(withRtlSupport(ChevronUp));
|
|
26
|
+
const ExpandAccessoryContent = ({
|
|
27
|
+
children,
|
|
28
|
+
collapsed,
|
|
29
|
+
onExpandTogle
|
|
30
|
+
}) => /*#__PURE__*/_jsxs(BpkButtonV2, {
|
|
31
|
+
"data-testid": "bpk-card-list__accessory-expand-button",
|
|
32
|
+
type: BUTTON_TYPES.link,
|
|
33
|
+
onClick: () => onExpandTogle(),
|
|
34
|
+
"aria-expanded": !collapsed,
|
|
35
|
+
children: [children, collapsed ? /*#__PURE__*/_jsx(AlignedChevronDownIcon, {}) : /*#__PURE__*/_jsx(AlignedChevronUpIcon, {})]
|
|
36
|
+
});
|
|
37
|
+
export default ExpandAccessoryContent;
|
|
@@ -0,0 +1,20 @@
|
|
|
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 ExpandAccessoryContent from "./ExpandAccessoryContent";
|
|
20
|
+
export default ExpandAccessoryContent;
|
|
@@ -1,8 +1,54 @@
|
|
|
1
|
-
type
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
declare const LAYOUTS: {
|
|
3
|
+
readonly grid: "grid";
|
|
4
|
+
readonly stack: "stack";
|
|
5
|
+
readonly row: "row";
|
|
6
|
+
readonly rail: "rail";
|
|
7
|
+
};
|
|
8
|
+
type LayoutDesktop = typeof LAYOUTS.row | typeof LAYOUTS.grid;
|
|
9
|
+
type LayoutMobile = typeof LAYOUTS.rail | typeof LAYOUTS.stack;
|
|
10
|
+
declare const ACCESSORY_DESKTOP_TYPES: {
|
|
11
|
+
readonly pagination: "pagination";
|
|
12
|
+
readonly expand: "expand";
|
|
13
|
+
readonly button: "button";
|
|
14
|
+
};
|
|
15
|
+
declare const ACCESSORY_MOBILE_TYPES: {
|
|
16
|
+
readonly expand: "expand";
|
|
17
|
+
readonly button: "button";
|
|
18
|
+
};
|
|
19
|
+
type ExpandProps = {
|
|
20
|
+
children: string | ReactElement;
|
|
21
|
+
collapsed: boolean;
|
|
22
|
+
onExpandTogle: () => void;
|
|
23
|
+
};
|
|
24
|
+
type CardListBaseProps = {
|
|
2
25
|
title: string;
|
|
3
26
|
description?: string;
|
|
4
|
-
|
|
27
|
+
cardList: ReactElement[];
|
|
28
|
+
layoutMobile: LayoutMobile;
|
|
29
|
+
layoutDesktop: LayoutDesktop;
|
|
30
|
+
accessoryDesktop?: (typeof ACCESSORY_DESKTOP_TYPES)[keyof typeof ACCESSORY_DESKTOP_TYPES];
|
|
31
|
+
accessoryMobile?: (typeof ACCESSORY_MOBILE_TYPES)[keyof typeof ACCESSORY_MOBILE_TYPES];
|
|
32
|
+
initiallyShownCards?: number;
|
|
33
|
+
chipGroup?: ReactElement;
|
|
34
|
+
buttonContent?: React.ReactNode;
|
|
35
|
+
onButtonClick?: () => void;
|
|
36
|
+
onExpandClick?: () => void;
|
|
37
|
+
buttonHref?: string;
|
|
38
|
+
expandText?: string;
|
|
39
|
+
};
|
|
40
|
+
type CardListGridStackProps = {
|
|
41
|
+
children: ReactElement[];
|
|
42
|
+
initiallyShownCards: number;
|
|
43
|
+
layout: typeof LAYOUTS.grid | typeof LAYOUTS.stack;
|
|
44
|
+
accessory?: typeof ACCESSORY_DESKTOP_TYPES.expand | typeof ACCESSORY_DESKTOP_TYPES.button | typeof ACCESSORY_MOBILE_TYPES.expand | typeof ACCESSORY_MOBILE_TYPES.button;
|
|
45
|
+
expandText?: string;
|
|
46
|
+
buttonContent?: React.ReactNode;
|
|
5
47
|
onButtonClick?: () => void;
|
|
48
|
+
onExpandClick?: () => void;
|
|
6
49
|
buttonHref?: string;
|
|
7
50
|
};
|
|
51
|
+
type CardListProps = CardListBaseProps;
|
|
8
52
|
export default CardListProps;
|
|
53
|
+
export { LAYOUTS, ACCESSORY_DESKTOP_TYPES, ACCESSORY_MOBILE_TYPES };
|
|
54
|
+
export type { LayoutDesktop, LayoutMobile, CardListGridStackProps, ExpandProps, };
|
|
@@ -1 +1,50 @@
|
|
|
1
|
-
|
|
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
|
+
const LAYOUTS = {
|
|
20
|
+
grid: 'grid',
|
|
21
|
+
stack: 'stack',
|
|
22
|
+
row: 'row',
|
|
23
|
+
rail: 'rail'
|
|
24
|
+
};
|
|
25
|
+
const ACCESSORY_DESKTOP_TYPES = {
|
|
26
|
+
pagination: 'pagination',
|
|
27
|
+
expand: 'expand',
|
|
28
|
+
button: 'button'
|
|
29
|
+
};
|
|
30
|
+
const ACCESSORY_MOBILE_TYPES = {
|
|
31
|
+
expand: 'expand',
|
|
32
|
+
button: 'button'
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// type CardListRowRailProps = {
|
|
36
|
+
// children: Array<ReactElement<HTMLDivElement | HTMLAnchorElement>>;
|
|
37
|
+
// initiallyShownCards: number;
|
|
38
|
+
// layout: typeof LAYOUTS.row | typeof LAYOUTS.rail;
|
|
39
|
+
// accessory?: typeof ACCESSORY_DESKTOP_TYPES.Pagination;
|
|
40
|
+
// };
|
|
41
|
+
|
|
42
|
+
// type CardListCarouselProps = {
|
|
43
|
+
// children: Array<ReactElement<HTMLDivElement | HTMLAnchorElement>>;
|
|
44
|
+
// initiallyShownCards: number;
|
|
45
|
+
// layout: typeof LAYOUTS.row | typeof LAYOUTS.rail;
|
|
46
|
+
// currentIndex: number;
|
|
47
|
+
// setCurrentIndex: Dispatch<SetStateAction<number>>;
|
|
48
|
+
// }
|
|
49
|
+
|
|
50
|
+
export { LAYOUTS, ACCESSORY_DESKTOP_TYPES, ACCESSORY_MOBILE_TYPES };
|
|
@@ -0,0 +1,27 @@
|
|
|
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 BpkCard from "../bpk-component-card";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
const mockCards = numberOfCards => Array.from({
|
|
22
|
+
length: numberOfCards
|
|
23
|
+
}, (_, i) => /*#__PURE__*/_jsx(BpkCard, {
|
|
24
|
+
"data-testid": `card-testId-${i}`,
|
|
25
|
+
children: `Card ${i}`
|
|
26
|
+
}, i));
|
|
27
|
+
export default mockCards;
|
|
@@ -200,7 +200,7 @@ class BpkDatepicker extends Component {
|
|
|
200
200
|
id: id,
|
|
201
201
|
name: `${id}_input`,
|
|
202
202
|
value: this.getValue(selectionConfiguration, formatDate),
|
|
203
|
-
"aria-live": "
|
|
203
|
+
"aria-live": "polite",
|
|
204
204
|
"aria-atomic": "true",
|
|
205
205
|
"aria-label": this.getLabel(selectionConfiguration, formatDateFull),
|
|
206
206
|
onChange: () => null,
|
|
@@ -20,6 +20,7 @@ export type Props = {
|
|
|
20
20
|
isIphone?: boolean;
|
|
21
21
|
padded?: boolean;
|
|
22
22
|
mobileModalDisplay?: boolean;
|
|
23
|
+
containerClassName?: string;
|
|
23
24
|
};
|
|
24
|
-
declare const BpkDrawer: ({ children, className, closeLabel, closeText, contentClassName, dialogRef, getApplicationElement, hideTitle, id, isIpad, isIphone, isOpen, mobileModalDisplay, onClose, padded, renderTarget, title, width, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
declare const BpkDrawer: ({ children, className, closeLabel, closeText, containerClassName, contentClassName, dialogRef, getApplicationElement, hideTitle, id, isIpad, isIphone, isOpen, mobileModalDisplay, onClose, padded, renderTarget, title, width, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
export default BpkDrawer;
|
|
@@ -25,6 +25,7 @@ const BpkDrawer = ({
|
|
|
25
25
|
className = undefined,
|
|
26
26
|
closeLabel = null,
|
|
27
27
|
closeText = undefined,
|
|
28
|
+
containerClassName = undefined,
|
|
28
29
|
contentClassName = undefined,
|
|
29
30
|
dialogRef,
|
|
30
31
|
getApplicationElement,
|
|
@@ -79,6 +80,7 @@ const BpkDrawer = ({
|
|
|
79
80
|
isIphone: isIphone,
|
|
80
81
|
padded: padded,
|
|
81
82
|
mobileModalDisplay: mobileModalDisplay,
|
|
83
|
+
containerClassName: containerClassName,
|
|
82
84
|
children: children
|
|
83
85
|
})
|
|
84
86
|
});
|