@skyscanner/backpack-web 29.2.0 → 29.3.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-card/src/BpkCard.js +13 -21
- package/bpk-component-card/src/BpkDividedCard.js +13 -17
- package/bpk-component-datatable/src/BpkDataTable.js +10 -3
- package/bpk-component-datatable/src/BpkDataTableColumn.js +1 -1
- package/bpk-component-datatable/src/utils.js +177 -82
- package/bpk-component-input/src/BpkClearButton.js +12 -16
- package/bpk-component-input/src/BpkInput.js +1 -4
- package/bpk-component-map/index.js +2 -1
- package/bpk-component-map/src/BpkBasicMapMarker.d.ts +28 -0
- package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.d.ts +53 -0
- package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.js +64 -0
- package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.module.css +18 -0
- package/bpk-component-overlay/index.d.ts +0 -1
- package/bpk-component-overlay/index.js +3 -1
- package/package.json +4 -4
|
@@ -45,18 +45,14 @@ const BpkCard = ({
|
|
|
45
45
|
atomicProps.tabIndex = -1;
|
|
46
46
|
atomicProps.role = 'group';
|
|
47
47
|
}
|
|
48
|
-
return (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
...rest,
|
|
57
|
-
children: children
|
|
58
|
-
})
|
|
59
|
-
);
|
|
48
|
+
return /*#__PURE__*/_jsx("a", {
|
|
49
|
+
href: href,
|
|
50
|
+
className: classNames,
|
|
51
|
+
...atomicProps,
|
|
52
|
+
...blankProps,
|
|
53
|
+
...rest,
|
|
54
|
+
children: children
|
|
55
|
+
});
|
|
60
56
|
}
|
|
61
57
|
if (atomic) {
|
|
62
58
|
return /*#__PURE__*/_jsx("button", {
|
|
@@ -66,14 +62,10 @@ const BpkCard = ({
|
|
|
66
62
|
children: children
|
|
67
63
|
});
|
|
68
64
|
}
|
|
69
|
-
return (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
...rest,
|
|
75
|
-
children: children
|
|
76
|
-
})
|
|
77
|
-
);
|
|
65
|
+
return /*#__PURE__*/_jsx("div", {
|
|
66
|
+
className: classNames,
|
|
67
|
+
...rest,
|
|
68
|
+
children: children
|
|
69
|
+
});
|
|
78
70
|
};
|
|
79
71
|
export default BpkCard;
|
|
@@ -37,22 +37,18 @@ const BpkDividedCard = ({
|
|
|
37
37
|
}) => {
|
|
38
38
|
const isVertical = orientation === ORIENTATION.vertical;
|
|
39
39
|
const classNames = getClassName('bpk-divided-card', isVertical ? 'bpk-divided-card--vertical' : 'bpk-divided-card--horizontal', !isElevated && 'bpk-divided-card--no-elevation', className);
|
|
40
|
-
return (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
children: secondaryContent
|
|
54
|
-
})]
|
|
55
|
-
})
|
|
56
|
-
);
|
|
40
|
+
return /*#__PURE__*/_jsxs(BpkCard, {
|
|
41
|
+
className: classNames,
|
|
42
|
+
href: href,
|
|
43
|
+
padded: false,
|
|
44
|
+
...rest,
|
|
45
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
46
|
+
className: getClassName(!isVertical && 'bpk-divided-card__primary--horizontal'),
|
|
47
|
+
children: primaryContent
|
|
48
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
49
|
+
className: getClassName(isVertical ? 'bpk-divided-card__secondary--vertical' : 'bpk-divided-card__secondary--horizontal'),
|
|
50
|
+
children: secondaryContent
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
57
53
|
};
|
|
58
54
|
export default BpkDividedCard;
|
|
@@ -21,7 +21,7 @@ import { cssModules } from "../../bpk-react-utils";
|
|
|
21
21
|
import STYLES from "./BpkDataTable.module.css";
|
|
22
22
|
import { SORT_DIRECTION_TYPES } from "./sort-types";
|
|
23
23
|
import BpkDataTableHeader from "./BpkDataTableHeader";
|
|
24
|
-
import { pxToRem, getColumns } from "./utils";
|
|
24
|
+
import { pxToRem, getColumns, createColumnsSchema } from "./utils";
|
|
25
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
27
|
const getClassName = cssModules(STYLES);
|
|
@@ -33,6 +33,7 @@ const BpkDataTable = props => {
|
|
|
33
33
|
const {
|
|
34
34
|
children,
|
|
35
35
|
className,
|
|
36
|
+
columns: columnsData,
|
|
36
37
|
defaultColumnSortIndex,
|
|
37
38
|
headerClassName,
|
|
38
39
|
headerHeight,
|
|
@@ -41,7 +42,7 @@ const BpkDataTable = props => {
|
|
|
41
42
|
rowClassName,
|
|
42
43
|
rowHeight,
|
|
43
44
|
rowStyle,
|
|
44
|
-
rows:
|
|
45
|
+
rows: rowsData,
|
|
45
46
|
sort,
|
|
46
47
|
sortBy,
|
|
47
48
|
sortDirection,
|
|
@@ -57,7 +58,13 @@ const BpkDataTable = props => {
|
|
|
57
58
|
return rowClassNames;
|
|
58
59
|
};
|
|
59
60
|
const headerClassNames = getClassName('bpk-data-table__row', 'bpk-data-table__header-row', headerClassName);
|
|
60
|
-
const columns = useMemo(() =>
|
|
61
|
+
const columns = useMemo(() => {
|
|
62
|
+
if (columnsData) {
|
|
63
|
+
return createColumnsSchema(columnsData);
|
|
64
|
+
}
|
|
65
|
+
return getColumns(children);
|
|
66
|
+
}, [children, columnsData]);
|
|
67
|
+
const data = useMemo(() => rowsData, [rowsData]);
|
|
61
68
|
const {
|
|
62
69
|
getTableBodyProps,
|
|
63
70
|
getTableProps,
|
|
@@ -25,7 +25,7 @@ const BpkDataTableColumn = props => /*#__PURE__*/_jsx("div", {
|
|
|
25
25
|
});
|
|
26
26
|
BpkDataTableColumn.propTypes = {
|
|
27
27
|
dataKey: PropTypes.string.isRequired,
|
|
28
|
-
width: PropTypes.number.isRequired,
|
|
28
|
+
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
29
29
|
className: PropTypes.string,
|
|
30
30
|
disableSort: PropTypes.bool,
|
|
31
31
|
defaultSortDirection: PropTypes.oneOf(Object.keys(SORT_DIRECTION_TYPES)),
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/const ROOT_FONT_SIZE_PX = 16;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param {String|Number} value width or height of data table or its columns, or rows
|
|
22
|
+
* @returns {String} the value in rem
|
|
23
|
+
*/
|
|
18
24
|
export const pxToRem = value => {
|
|
19
25
|
let parsed = value;
|
|
20
26
|
if (typeof value === 'number' || typeof value === 'string' && value.includes('px')) {
|
|
@@ -23,90 +29,179 @@ export const pxToRem = value => {
|
|
|
23
29
|
}
|
|
24
30
|
return parsed;
|
|
25
31
|
};
|
|
26
|
-
// TODO: Remove this function once we want to change the API to match the react-table library API
|
|
27
|
-
// To maintain backwards compatibility with the old API of BpkDataTable which takes columns as children
|
|
28
|
-
// The `react-table` library however expects columns as an array of objects
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
33
|
+
/**
|
|
34
|
+
* TODO: Remove this function once BpkDataTableColumns is removed
|
|
35
|
+
* This function takes the children of BpkDataTableColumns and converts them to an array of objects
|
|
36
|
+
* to temporarily maintain backwards compatibility with the old API of BpkDataTable
|
|
37
|
+
*
|
|
38
|
+
* @param {Array} columns the BpkDataTableColumns children
|
|
39
|
+
* @returns {Array} An array of column objects that can be passed to the react-table library
|
|
40
|
+
*/
|
|
41
|
+
export const getColumns = columns => {
|
|
42
|
+
console.warn('BpkDataTableColumns is deprecated. Please pass an array of objects to the columns prop instead.');
|
|
43
|
+
let columnsArray = [];
|
|
44
|
+
if (!columns) return columnsArray;
|
|
45
|
+
columnsArray = columns.map(column => {
|
|
46
|
+
const {
|
|
47
|
+
cellDataGetter,
|
|
48
|
+
cellRenderer,
|
|
49
|
+
headerRenderer
|
|
50
|
+
} = column.props;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* TODO: Remove this function once BpkDataTableColumns is removed
|
|
54
|
+
* This function takes the react-table column and row data and returns the cell data
|
|
55
|
+
* to temporarily maintain backwards compatibility with the old API of BpkDataTable
|
|
56
|
+
* and create an interface so that the function signature doesn't depend on the underlying library
|
|
57
|
+
*
|
|
58
|
+
* @param {Object} Object containing the react-table column and row data
|
|
59
|
+
* @returns {Node} JSX to render in the cell
|
|
60
|
+
*/
|
|
61
|
+
const columnCellRenderer = ({
|
|
62
|
+
column: {
|
|
63
|
+
id: dataKey
|
|
64
|
+
},
|
|
65
|
+
columns: columnsData,
|
|
66
|
+
row: {
|
|
67
|
+
id: rowID,
|
|
68
|
+
values: rowData
|
|
69
|
+
},
|
|
70
|
+
sortedRows,
|
|
71
|
+
value: cellData
|
|
72
|
+
}) => {
|
|
73
|
+
const columnIndex = columnsData.map(col => col.id).indexOf(dataKey);
|
|
74
|
+
const rowIndex = sortedRows.map(row => row.id).indexOf(rowID);
|
|
75
|
+
return cellRenderer({
|
|
76
|
+
cellData,
|
|
77
|
+
columnIndex,
|
|
78
|
+
dataKey,
|
|
79
|
+
rowData,
|
|
80
|
+
rowIndex
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* TODO: Remove this function once BpkDataTableColumns is removed
|
|
86
|
+
* This function takes the react-table column and row data and returns the cell data
|
|
87
|
+
* to temporarily maintain backwards compatibility with the old API of BpkDataTable
|
|
88
|
+
* and create an interface so that the function signature doesn't depend on the underlying library
|
|
89
|
+
*
|
|
90
|
+
* @param {Object} Object containing the react-table column and row data
|
|
91
|
+
* @returns {Node} JSX to render in the cell
|
|
92
|
+
*/
|
|
93
|
+
const columnCellDataGetter = ({
|
|
94
|
+
column: {
|
|
95
|
+
id: dataKey
|
|
96
|
+
},
|
|
97
|
+
row: {
|
|
98
|
+
values: rowData
|
|
99
|
+
}
|
|
100
|
+
}) => cellDataGetter({
|
|
55
101
|
dataKey,
|
|
56
|
-
rowData
|
|
57
|
-
rowIndex
|
|
102
|
+
rowData
|
|
58
103
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* TODO: Remove this function once BpkDataTableColumns is removed
|
|
107
|
+
* This function takes the react-table column data and returns the header data
|
|
108
|
+
* to temporarily maintain backwards compatibility with the old API of BpkDataTable
|
|
109
|
+
* and create an interface so that the function signature doesn't depend on the underlying library
|
|
110
|
+
*
|
|
111
|
+
* @param {Object} Object containing the react-table column data
|
|
112
|
+
* @returns {Node} JSX to render in the header
|
|
113
|
+
*/
|
|
114
|
+
const columnHeaderRenderer = ({
|
|
115
|
+
column: {
|
|
116
|
+
disableSortBy: disableSort,
|
|
117
|
+
id: dataKey,
|
|
118
|
+
label
|
|
119
|
+
}
|
|
120
|
+
}) => headerRenderer({
|
|
121
|
+
dataKey,
|
|
122
|
+
label,
|
|
123
|
+
disableSort
|
|
124
|
+
});
|
|
125
|
+
const {
|
|
126
|
+
className,
|
|
127
|
+
dataKey,
|
|
128
|
+
defaultSortDirection,
|
|
129
|
+
disableSort,
|
|
130
|
+
flexGrow,
|
|
131
|
+
headerClassName,
|
|
132
|
+
headerStyle,
|
|
133
|
+
label,
|
|
134
|
+
minWidth,
|
|
135
|
+
style,
|
|
136
|
+
width
|
|
137
|
+
} = column.props;
|
|
138
|
+
return {
|
|
139
|
+
Header: headerRenderer ? columnHeaderRenderer : label,
|
|
140
|
+
accessor: dataKey,
|
|
141
|
+
...((cellRenderer || cellDataGetter) && {
|
|
142
|
+
Cell: columnCellRenderer || columnCellDataGetter
|
|
143
|
+
}),
|
|
144
|
+
className,
|
|
73
145
|
disableSortBy: disableSort,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
146
|
+
defaultSortDirection,
|
|
147
|
+
flexGrow,
|
|
148
|
+
headerClassName,
|
|
149
|
+
headerStyle,
|
|
150
|
+
label,
|
|
151
|
+
minWidth: pxToRem(minWidth),
|
|
152
|
+
style,
|
|
153
|
+
width: pxToRem(width)
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
return columnsArray;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
*
|
|
161
|
+
* @param {Array} columns Array of column objects
|
|
162
|
+
* @returns {Array} An array of column objects that can be passed to the react-table library
|
|
163
|
+
* This function abstract the Cell and Header of the react-table API
|
|
164
|
+
*/
|
|
165
|
+
export const createColumnsSchema = columns => {
|
|
166
|
+
let columnsArray = [];
|
|
167
|
+
if (!columns) return columnsArray;
|
|
168
|
+
columnsArray = columns.map(column => {
|
|
169
|
+
const Cell = ({
|
|
170
|
+
column: {
|
|
171
|
+
id: accessor
|
|
172
|
+
},
|
|
173
|
+
columns: columnsData,
|
|
174
|
+
row: {
|
|
175
|
+
id: rowID,
|
|
176
|
+
values: rowData
|
|
177
|
+
},
|
|
178
|
+
sortedRows,
|
|
179
|
+
value: cellData
|
|
180
|
+
}) => column.Cell({
|
|
181
|
+
rowData,
|
|
182
|
+
rowIndex: sortedRows.map(row => row.id).indexOf(rowID),
|
|
183
|
+
accessor,
|
|
184
|
+
columnIndex: columnsData.map(col => col.id).indexOf(accessor),
|
|
185
|
+
cellData
|
|
186
|
+
});
|
|
187
|
+
const Header = ({
|
|
188
|
+
column: {
|
|
189
|
+
disableSortBy: disableSort,
|
|
190
|
+
id: accessor,
|
|
191
|
+
label
|
|
192
|
+
}
|
|
193
|
+
}) => column.Header({
|
|
194
|
+
label,
|
|
195
|
+
disableSort,
|
|
196
|
+
accessor
|
|
197
|
+
});
|
|
198
|
+
return {
|
|
199
|
+
...column,
|
|
200
|
+
...(column.Cell && {
|
|
201
|
+
Cell
|
|
202
|
+
}),
|
|
203
|
+
Header: column.Header && typeof column.Header === 'function' ? Header : column.label
|
|
204
|
+
};
|
|
81
205
|
});
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
dataKey,
|
|
85
|
-
defaultSortDirection,
|
|
86
|
-
disableSort,
|
|
87
|
-
flexGrow,
|
|
88
|
-
headerClassName,
|
|
89
|
-
headerStyle,
|
|
90
|
-
label,
|
|
91
|
-
minWidth,
|
|
92
|
-
style,
|
|
93
|
-
width
|
|
94
|
-
} = column.props;
|
|
95
|
-
return {
|
|
96
|
-
Header: headerRenderer ? columnHeaderRenderer : label,
|
|
97
|
-
accessor: dataKey,
|
|
98
|
-
...((cellRenderer || cellDataGetter) && {
|
|
99
|
-
Cell: columnCellRenderer || columnCellDataGetter
|
|
100
|
-
}),
|
|
101
|
-
className,
|
|
102
|
-
disableSortBy: disableSort,
|
|
103
|
-
defaultSortDirection,
|
|
104
|
-
flexGrow,
|
|
105
|
-
headerClassName,
|
|
106
|
-
headerStyle,
|
|
107
|
-
label,
|
|
108
|
-
minWidth: pxToRem(minWidth),
|
|
109
|
-
style,
|
|
110
|
-
width: pxToRem(width)
|
|
111
|
-
};
|
|
112
|
-
});
|
|
206
|
+
return columnsArray;
|
|
207
|
+
};
|
|
@@ -34,22 +34,18 @@ const BpkClearButton = ({
|
|
|
34
34
|
if (className) {
|
|
35
35
|
classNames.push(className);
|
|
36
36
|
}
|
|
37
|
-
return (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
focusable: "false" // prevents focus on IE11
|
|
49
|
-
,
|
|
50
|
-
className: getClassName('bpk-clear-button__icon')
|
|
51
|
-
})
|
|
37
|
+
return /*#__PURE__*/_jsx("button", {
|
|
38
|
+
type: "button",
|
|
39
|
+
title: label,
|
|
40
|
+
onClick: onClick,
|
|
41
|
+
"aria-label": label,
|
|
42
|
+
className: classNames.join(' '),
|
|
43
|
+
...rest,
|
|
44
|
+
children: /*#__PURE__*/_jsx(ClearButtonIcon, {
|
|
45
|
+
focusable: "false" // prevents focus on IE11
|
|
46
|
+
,
|
|
47
|
+
className: getClassName('bpk-clear-button__icon')
|
|
52
48
|
})
|
|
53
|
-
);
|
|
49
|
+
});
|
|
54
50
|
};
|
|
55
51
|
export default BpkClearButton;
|
|
@@ -95,10 +95,7 @@ class BpkInput extends Component {
|
|
|
95
95
|
classNames.push(className);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
const renderedInput =
|
|
99
|
-
/*#__PURE__*/
|
|
100
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
101
|
-
_jsx("input", {
|
|
98
|
+
const renderedInput = /*#__PURE__*/_jsx("input", {
|
|
102
99
|
className: classNames.join(' '),
|
|
103
100
|
ref: input => {
|
|
104
101
|
ref = input;
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
*/import BpkMap from "./src/BpkMap";
|
|
18
18
|
import BpkIconMarker from "./src/BpkIconMarker";
|
|
19
19
|
import BpkPriceMarker, { PRICE_MARKER_STATUSES } from "./src/BpkPriceMarker";
|
|
20
|
+
import BpkPriceMarkerV2, { MARKER_STATUSES } from "./src/BpkPriceMarkerV2/BpkPriceMarker";
|
|
20
21
|
import BpkOverlayView from "./src/BpkOverlayView";
|
|
21
22
|
import withGoogleMapsScript from "./src/withGoogleMapsScript";
|
|
22
23
|
import { defaultIconMarkerThemeAttributes, priceMarkerThemeAttributes } from "./src/themeAttributes";
|
|
23
24
|
export default BpkMap;
|
|
24
|
-
export { BpkIconMarker, BpkPriceMarker, BpkOverlayView, withGoogleMapsScript, defaultIconMarkerThemeAttributes, priceMarkerThemeAttributes, PRICE_MARKER_STATUSES };
|
|
25
|
+
export { BpkIconMarker, BpkPriceMarker, BpkPriceMarkerV2, BpkOverlayView, withGoogleMapsScript, defaultIconMarkerThemeAttributes, priceMarkerThemeAttributes, PRICE_MARKER_STATUSES, MARKER_STATUSES };
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
import type { Node } from 'react';
|
|
19
|
+
import { type LatLong } from './common-types';
|
|
20
|
+
|
|
21
|
+
export type Props = {
|
|
22
|
+
children: Node;
|
|
23
|
+
position: LatLong;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
declare const BpkBasicMapMarker: ({ children, position }: Props) => JSX.Element;
|
|
27
|
+
|
|
28
|
+
export default BpkBasicMapMarker;
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
import type { Node } from 'react';
|
|
19
|
+
import { MouseEvent, ReactNode } from 'react';
|
|
20
|
+
|
|
21
|
+
export const MARKER_STATUSES = {
|
|
22
|
+
unselected: 'unselected',
|
|
23
|
+
selected: 'selected',
|
|
24
|
+
previous_selected: 'previous_selected',
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
export type Status = (typeof MARKER_STATUSES)[keyof typeof MARKER_STATUSES];
|
|
28
|
+
|
|
29
|
+
type Props = {
|
|
30
|
+
label: string;
|
|
31
|
+
icon?: ReactNode;
|
|
32
|
+
accessibilityLabel: string;
|
|
33
|
+
position: {
|
|
34
|
+
latitude: number;
|
|
35
|
+
longitude: number;
|
|
36
|
+
};
|
|
37
|
+
className?: string;
|
|
38
|
+
onClick?: (event: MouseEvent) => void;
|
|
39
|
+
buttonProps?: { [key: string]: string };
|
|
40
|
+
status?: Status;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
declare const BpkPriceMarkerV2: ({
|
|
44
|
+
label,
|
|
45
|
+
position,
|
|
46
|
+
className,
|
|
47
|
+
onClick,
|
|
48
|
+
buttonProps,
|
|
49
|
+
status,
|
|
50
|
+
style,
|
|
51
|
+
}: Props) => JSX.Element;
|
|
52
|
+
|
|
53
|
+
export default BpkPriceMarkerV2;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 BpkBasicMapMarker from "../BpkBasicMapMarker";
|
|
22
|
+
import STYLES from "./BpkPriceMarker.module.css";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
+
const getClassName = cssModules(STYLES);
|
|
26
|
+
export const MARKER_STATUSES = {
|
|
27
|
+
unselected: 'unselected',
|
|
28
|
+
selected: 'selected',
|
|
29
|
+
previous_selected: 'previous_selected'
|
|
30
|
+
};
|
|
31
|
+
const BpkPriceMarkerV2 = props => {
|
|
32
|
+
const {
|
|
33
|
+
accessibilityLabel,
|
|
34
|
+
buttonProps,
|
|
35
|
+
className,
|
|
36
|
+
icon,
|
|
37
|
+
label,
|
|
38
|
+
onClick,
|
|
39
|
+
position,
|
|
40
|
+
status = MARKER_STATUSES.unselected,
|
|
41
|
+
...rest
|
|
42
|
+
} = props;
|
|
43
|
+
const markerWrapperClassNames = getClassName('bpk-price-marker__wrapper');
|
|
44
|
+
const classNames = getClassName('bpk-price-marker', onClick && 'bpk-price-marker--dynamic', `bpk-price-marker-${status}`, icon && `bpk-price-marker-${status}--icon`, className);
|
|
45
|
+
return /*#__PURE__*/_jsx(BpkBasicMapMarker, {
|
|
46
|
+
position: position,
|
|
47
|
+
"aria-label": accessibilityLabel,
|
|
48
|
+
...rest,
|
|
49
|
+
children: /*#__PURE__*/_jsx("button", {
|
|
50
|
+
type: "button",
|
|
51
|
+
className: markerWrapperClassNames,
|
|
52
|
+
onClick: onClick,
|
|
53
|
+
...buttonProps,
|
|
54
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
55
|
+
className: classNames,
|
|
56
|
+
children: [icon, /*#__PURE__*/_jsx(BpkText, {
|
|
57
|
+
textStyle: TEXT_STYLES.label2,
|
|
58
|
+
children: label
|
|
59
|
+
})]
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
export default BpkPriceMarkerV2;
|
|
@@ -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
|
+
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-price-marker{display:flex;height:1.5rem;padding:0 0.5rem;justify-content:center;align-items:center;border-radius:.5rem;gap:0.5rem}.bpk-price-marker--dynamic{cursor:pointer}.bpk-price-marker-unselected{background-color:#fff;color:#161616}.bpk-price-marker-unselected--icon{fill:#161616}.bpk-price-marker-previous_selected{background-color:#cfe4ff;color:#161616}.bpk-price-marker-previous_selected--icon{fill:#161616}.bpk-price-marker-selected{background-color:#05203c;color:#fff}.bpk-price-marker-selected--icon{fill:#fff}.bpk-price-marker__wrapper{position:relative;display:flex;padding:0;flex-direction:column;align-items:center;border:none;background:none}
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import BpkOverlay, { OVERLAY_TYPES } from "./src/BpkOverlay";
|
|
18
20
|
export default BpkOverlay;
|
|
19
21
|
export { OVERLAY_TYPES };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyscanner/backpack-web",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.3.1",
|
|
4
4
|
"description": "Backpack Design System web library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@popperjs/core": "^2.11.5",
|
|
26
26
|
"@react-google-maps/api": "^2.12.0",
|
|
27
|
-
"@skyscanner/bpk-foundations-web": "^17.
|
|
28
|
-
"@skyscanner/bpk-svgs": "^18.1.
|
|
27
|
+
"@skyscanner/bpk-foundations-web": "^17.2.0",
|
|
28
|
+
"@skyscanner/bpk-svgs": "^18.1.2",
|
|
29
29
|
"a11y-focus-scope": "^1.1.3",
|
|
30
30
|
"a11y-focus-store": "^1.0.0",
|
|
31
31
|
"d3-path": "^2.0.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"prop-types": "^15.7.2",
|
|
41
41
|
"react-autosuggest": "^9.4.3",
|
|
42
42
|
"react-responsive": "^9.0.2",
|
|
43
|
-
"react-slider": "^
|
|
43
|
+
"react-slider": "^2.0.6",
|
|
44
44
|
"react-table": "^7.8.0",
|
|
45
45
|
"react-transition-group": "^2.5.3",
|
|
46
46
|
"react-virtualized-auto-sizer": "^1.0.20",
|