@skyscanner/backpack-web 41.10.0-beta-v1 → 41.11.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-accordion/src/BpkAccordion.js +2 -1
- package/bpk-component-accordion/src/BpkAccordionItem.js +2 -1
- package/bpk-component-aria-live/src/BpkAriaLive.js +2 -1
- package/bpk-component-autosuggest/src/BpkAutosuggestV2/BpkAutosuggest.js +2 -1
- package/bpk-component-bottom-sheet/src/BpkBottomSheet.js +14 -5
- package/bpk-component-breakpoint/src/useMediaQuery.js +27 -14
- package/bpk-component-bubble/src/BpkBubble.js +2 -1
- package/bpk-component-calendar/src/BpkCalendarDate.js +2 -1
- package/bpk-component-calendar/src/BpkCalendarGrid.js +2 -1
- package/bpk-component-calendar/src/BpkCalendarGridHeader.js +2 -1
- package/bpk-component-calendar/src/BpkCalendarGridTransition.js +2 -1
- package/bpk-component-calendar/src/BpkCalendarNav.js +2 -1
- package/bpk-component-calendar/src/BpkCalendarWeek.js +2 -1
- package/bpk-component-chip/src/BpkDismissibleChip.js +3 -2
- package/bpk-component-chip/src/BpkDropdownChip.js +2 -0
- package/bpk-component-chip/src/BpkIconChip.js +2 -0
- package/bpk-component-chip/src/BpkSelectableChip.js +2 -1
- package/bpk-component-chip-group/src/BpkMultiSelectChipGroup.js +2 -1
- package/bpk-component-chip-group/src/BpkStickyChip.js +2 -1
- package/bpk-component-map/src/BpkBasicMapMarker.js +3 -0
- package/bpk-component-map/src/BpkPriceMarker.js +2 -0
- package/bpk-component-price-range/src/BpkPriceMarker.js +2 -1
- package/bpk-component-price-range/src/BpkPriceRange.js +2 -1
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGrid.js +2 -1
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.js +2 -1
- package/bpk-component-tooltip/src/BpkTooltip.js +2 -1
- package/package.json +1 -2
- package/bpk-component-layout/index.d.ts +0 -18
- package/bpk-component-layout/index.js +0 -29
- package/bpk-component-layout/src/BpkBox.d.ts +0 -3
- package/bpk-component-layout/src/BpkBox.js +0 -33
- package/bpk-component-layout/src/BpkFlex.d.ts +0 -3
- package/bpk-component-layout/src/BpkFlex.js +0 -51
- package/bpk-component-layout/src/BpkGrid.d.ts +0 -3
- package/bpk-component-layout/src/BpkGrid.js +0 -57
- package/bpk-component-layout/src/BpkGridItem.d.ts +0 -3
- package/bpk-component-layout/src/BpkGridItem.js +0 -45
- package/bpk-component-layout/src/BpkProvider.d.ts +0 -14
- package/bpk-component-layout/src/BpkProvider.js +0 -42
- package/bpk-component-layout/src/BpkStack.constant.d.ts +0 -2
- package/bpk-component-layout/src/BpkStack.constant.js +0 -22
- package/bpk-component-layout/src/BpkStack.d.ts +0 -5
- package/bpk-component-layout/src/BpkStack.js +0 -57
- package/bpk-component-layout/src/BpkVessel.d.ts +0 -46
- package/bpk-component-layout/src/BpkVessel.js +0 -70
- package/bpk-component-layout/src/commonProps.d.ts +0 -86
- package/bpk-component-layout/src/commonProps.js +0 -1
- package/bpk-component-layout/src/theme.d.ts +0 -36
- package/bpk-component-layout/src/theme.js +0 -229
- package/bpk-component-layout/src/tokenUtils.d.ts +0 -108
- package/bpk-component-layout/src/tokenUtils.js +0 -323
- package/bpk-component-layout/src/tokens.d.ts +0 -96
- package/bpk-component-layout/src/tokens.js +0 -138
- package/bpk-component-layout/src/types.d.ts +0 -236
- package/bpk-component-layout/src/types.js +0 -1
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { createContext } from 'react';
|
|
20
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
20
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
21
|
import STYLES from "./BpkAccordion.module.css";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
const getClassName = cssModules(STYLES);
|
|
@@ -41,6 +41,7 @@ const BpkAccordion = props => {
|
|
|
41
41
|
},
|
|
42
42
|
children: /*#__PURE__*/_jsx("div", {
|
|
43
43
|
className: classNames,
|
|
44
|
+
...getDataComponentAttribute('Accordion'),
|
|
44
45
|
...rest,
|
|
45
46
|
children: children
|
|
46
47
|
})
|
|
@@ -22,7 +22,7 @@ import AnimateHeight from "../../bpk-animate-height";
|
|
|
22
22
|
import { withButtonAlignment } from "../../bpk-component-icon";
|
|
23
23
|
import ChevronDownIcon from "../../bpk-component-icon/sm/chevron-down";
|
|
24
24
|
import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
|
|
25
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
25
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
26
26
|
import { BpkAccordionContext } from "./BpkAccordion";
|
|
27
27
|
import STYLES from "./BpkAccordionItem.module.css";
|
|
28
28
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -88,6 +88,7 @@ const BpkAccordionItem = props => {
|
|
|
88
88
|
_jsxs("div", {
|
|
89
89
|
id: id,
|
|
90
90
|
className: itemClassNames.join(' '),
|
|
91
|
+
...getDataComponentAttribute('AccordionItem'),
|
|
91
92
|
...rest,
|
|
92
93
|
children: [/*#__PURE__*/_jsx("div", {
|
|
93
94
|
className: titleClassNames.join(' '),
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
19
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
20
20
|
import STYLES from "./BpkAriaLive.module.css";
|
|
21
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
22
|
const getClassName = cssModules(STYLES);
|
|
@@ -35,6 +35,7 @@ const BpkAriaLive = ({
|
|
|
35
35
|
return /*#__PURE__*/_jsx("div", {
|
|
36
36
|
"aria-live": politenessSetting,
|
|
37
37
|
className: classNames,
|
|
38
|
+
...getDataComponentAttribute('AriaLive'),
|
|
38
39
|
...rest
|
|
39
40
|
});
|
|
40
41
|
};
|
|
@@ -21,7 +21,7 @@ import { useFloating, offset, shift, size, arrow as floatingArrow, FloatingArrow
|
|
|
21
21
|
import { useCombobox } from 'downshift';
|
|
22
22
|
import { surfaceHighlightDay } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
23
23
|
import BpkInput from "../../../bpk-component-input";
|
|
24
|
-
import { cssModules } from "../../../bpk-react-utils";
|
|
24
|
+
import { cssModules, getDataComponentAttribute } from "../../../bpk-react-utils";
|
|
25
25
|
import STYLES from "./BpkAutosuggest.module.css";
|
|
26
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
27
|
const getClassName = cssModules(STYLES);
|
|
@@ -536,6 +536,7 @@ const BpkAutosuggest = /*#__PURE__*/forwardRef(({
|
|
|
536
536
|
return /*#__PURE__*/_jsxs("div", {
|
|
537
537
|
ref: containerWrapperRef,
|
|
538
538
|
className: getClassName(theme.container, suggestionsCount && theme.containerOpen),
|
|
539
|
+
...getDataComponentAttribute('Autosuggest'),
|
|
539
540
|
children: [renderInput(), showSuggestions && (isDesktop ? /*#__PURE__*/_jsx(FloatingPortal, {
|
|
540
541
|
children: /*#__PURE__*/_jsxs("div", {
|
|
541
542
|
ref: refs.setFloating,
|
|
@@ -23,9 +23,10 @@ import BpkCloseButton from "../../bpk-component-close-button";
|
|
|
23
23
|
import BpkLink from "../../bpk-component-link";
|
|
24
24
|
import BpkNavigationBar from "../../bpk-component-navigation-bar";
|
|
25
25
|
import { TEXT_STYLES } from "../../bpk-component-text/src/BpkText";
|
|
26
|
+
import BpkVisuallyHidden from "../../bpk-component-visually-hidden";
|
|
26
27
|
import { BpkDialogWrapper, cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
27
28
|
import STYLES from "./BpkBottomSheet.module.css";
|
|
28
|
-
import { jsx as _jsx,
|
|
29
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
29
30
|
const getClassName = cssModules(STYLES);
|
|
30
31
|
export const PADDING_TYPE = {
|
|
31
32
|
none: 'none',
|
|
@@ -93,6 +94,8 @@ const BpkBottomSheet = ({
|
|
|
93
94
|
}, timeoutDuration);
|
|
94
95
|
}, [isAboveMobile, onClose]);
|
|
95
96
|
const headingId = `bpk-bottom-sheet-heading-${id}`;
|
|
97
|
+
const hiddenTitleId = `bpk-bottom-sheet-title-hidden-${id}`;
|
|
98
|
+
const showHiddenTitle = !title && 'ariaLabel' in ariaProps && ariaProps.ariaLabel;
|
|
96
99
|
const dialogClassName = getClassName('bpk-bottom-sheet', wide && 'bpk-bottom-sheet--wide');
|
|
97
100
|
const contentStyle = getContentStyles(paddingStyles);
|
|
98
101
|
return /*#__PURE__*/_jsx(BpkDialogWrapper, {
|
|
@@ -115,10 +118,10 @@ const BpkBottomSheet = ({
|
|
|
115
118
|
},
|
|
116
119
|
...getDataComponentAttribute('BottomSheet'),
|
|
117
120
|
children: /*#__PURE__*/_jsxs(_Fragment, {
|
|
118
|
-
children: [/*#__PURE__*/
|
|
121
|
+
children: [/*#__PURE__*/_jsxs("header", {
|
|
119
122
|
className: getClassName('bpk-bottom-sheet--header-wrapper'),
|
|
120
|
-
children: /*#__PURE__*/_jsx(BpkNavigationBar, {
|
|
121
|
-
id: headingId,
|
|
123
|
+
children: [/*#__PURE__*/_jsx(BpkNavigationBar, {
|
|
124
|
+
id: showHiddenTitle ? hiddenTitleId : headingId,
|
|
122
125
|
title: title,
|
|
123
126
|
titleTextStyle: TEXT_STYLES.label1,
|
|
124
127
|
titleTagName: title ? 'h2' : 'span',
|
|
@@ -132,7 +135,13 @@ const BpkBottomSheet = ({
|
|
|
132
135
|
onClick: onAction,
|
|
133
136
|
children: actionText
|
|
134
137
|
}) : null
|
|
135
|
-
})
|
|
138
|
+
}), showHiddenTitle && /*#__PURE__*/_jsx(BpkVisuallyHidden, {
|
|
139
|
+
as: "h2",
|
|
140
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
141
|
+
id: hiddenTitleId,
|
|
142
|
+
children: ariaProps.ariaLabel
|
|
143
|
+
})
|
|
144
|
+
})]
|
|
136
145
|
}), /*#__PURE__*/_jsx("div", {
|
|
137
146
|
className: contentStyle,
|
|
138
147
|
children: children
|
|
@@ -17,28 +17,41 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { useEffect, useState } from 'react';
|
|
20
|
-
const useMediaQuery = (query, matchSSR
|
|
20
|
+
const useMediaQuery = (query, matchSSR) => {
|
|
21
21
|
const isClient = typeof window !== 'undefined' && !!window.matchMedia;
|
|
22
|
+
|
|
23
|
+
// When matchSSR is provided, we need hydration protection
|
|
24
|
+
const needsHydrationProtection = matchSSR !== undefined;
|
|
25
|
+
const [isHydrated, setIsHydrated] = useState(!needsHydrationProtection);
|
|
22
26
|
const [matches, setMatches] = useState(() => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
if (!isClient) {
|
|
28
|
+
return matchSSR ?? false;
|
|
29
|
+
}
|
|
30
|
+
if (needsHydrationProtection) {
|
|
26
31
|
return matchSSR;
|
|
27
32
|
}
|
|
28
33
|
return window.matchMedia(query).matches;
|
|
29
34
|
});
|
|
35
|
+
|
|
36
|
+
// Mark hydration as complete
|
|
30
37
|
useEffect(() => {
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
setMatches(media.matches);
|
|
34
|
-
const listener = () => {
|
|
35
|
-
setMatches(media.matches);
|
|
36
|
-
};
|
|
37
|
-
media.addEventListener('change', listener);
|
|
38
|
-
return () => media.removeEventListener('change', listener);
|
|
38
|
+
if (needsHydrationProtection && !isHydrated) {
|
|
39
|
+
setIsHydrated(true);
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
}, [needsHydrationProtection, isHydrated]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
// Wait for hydration to complete
|
|
44
|
+
if (!isClient || !isHydrated) {
|
|
45
|
+
return () => {};
|
|
46
|
+
}
|
|
47
|
+
const media = window.matchMedia(query);
|
|
48
|
+
setMatches(media.matches);
|
|
49
|
+
const listener = () => {
|
|
50
|
+
setMatches(media.matches);
|
|
51
|
+
};
|
|
52
|
+
media.addEventListener('change', listener);
|
|
53
|
+
return () => media.removeEventListener('change', listener);
|
|
54
|
+
}, [query, isClient, isHydrated]);
|
|
42
55
|
return matches;
|
|
43
56
|
};
|
|
44
57
|
export default useMediaQuery;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import BpkText, { TEXT_COLORS, TEXT_STYLES } from "../../bpk-component-text";
|
|
20
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
20
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
21
|
import BpkBubbleArrow from "../icons/BpkBubbleArrow";
|
|
22
22
|
import STYLES from "./BpkBubble.module.css";
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -26,6 +26,7 @@ const BpkBubble = ({
|
|
|
26
26
|
children
|
|
27
27
|
}) => /*#__PURE__*/_jsxs("span", {
|
|
28
28
|
className: getClassName('bpk-bubble'),
|
|
29
|
+
...getDataComponentAttribute('Bubble'),
|
|
29
30
|
children: [/*#__PURE__*/_jsx(BpkText, {
|
|
30
31
|
textStyle: TEXT_STYLES.label3,
|
|
31
32
|
tagName: "span",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { PureComponent } from 'react';
|
|
20
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
20
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
21
|
import STYLES from "./BpkCalendarDate.module.css";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
const getClassName = cssModules(STYLES);
|
|
@@ -125,6 +125,7 @@ class BpkCalendarDate extends PureComponent {
|
|
|
125
125
|
type: "button",
|
|
126
126
|
style: style,
|
|
127
127
|
className: classNames.join(' '),
|
|
128
|
+
...getDataComponentAttribute('CalendarDate'),
|
|
128
129
|
"aria-label": `${date.getDate()}`,
|
|
129
130
|
disabled: isBlocked,
|
|
130
131
|
tabIndex: isKeyboardFocusable && isFocused ? 0 : -1,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { Component } from 'react';
|
|
20
|
-
import { cssModules, isDeviceIos } from "../../bpk-react-utils";
|
|
20
|
+
import { cssModules, isDeviceIos, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
21
|
import { addCalendarGridTransition } from "./BpkCalendarGridTransition";
|
|
22
22
|
import BpkCalendarWeek from "./BpkCalendarWeek";
|
|
23
23
|
import { CALENDAR_SELECTION_TYPE } from "./custom-proptypes";
|
|
@@ -105,6 +105,7 @@ class BpkCalendarGrid extends Component {
|
|
|
105
105
|
const classNames = getClassName('bpk-calendar-grid', className);
|
|
106
106
|
return /*#__PURE__*/_jsx("div", {
|
|
107
107
|
className: classNames,
|
|
108
|
+
...getDataComponentAttribute('CalendarGrid'),
|
|
108
109
|
"aria-hidden": !isKeyboardFocusable,
|
|
109
110
|
role: "grid",
|
|
110
111
|
"aria-label": formatMonth(month),
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { PureComponent } from 'react';
|
|
20
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
20
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
21
|
import { orderDaysOfWeek } from "./date-utils";
|
|
22
22
|
import STYLES from "./BpkCalendarGridHeader.module.css";
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -57,6 +57,7 @@ class BpkCalendarGridHeader extends PureComponent {
|
|
|
57
57
|
}
|
|
58
58
|
return /*#__PURE__*/_jsx("header", {
|
|
59
59
|
className: classNames.join(' '),
|
|
60
|
+
...getDataComponentAttribute('CalendarGridHeader'),
|
|
60
61
|
"aria-hidden": true,
|
|
61
62
|
children: /*#__PURE__*/_jsx("ol", {
|
|
62
63
|
className: getClassName('bpk-calendar-header__week'),
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { Component, createElement as _createElement } from 'react';
|
|
20
|
-
import { cssModules, isRTL } from "../../bpk-react-utils";
|
|
20
|
+
import { cssModules, isRTL, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
21
|
import { addMonths, isSameMonth, formatIsoMonth, differenceInCalendarMonths, dateToBoundaries, startOfDay, setMonthYear, isWithinRange, getMonthRange } from "./date-utils";
|
|
22
22
|
import { getCalendarGridWidth, getTransformStyles, isTransitionEndSupported } from "./utils";
|
|
23
23
|
import STYLES from "./BpkCalendarGridTransition.module.css";
|
|
@@ -132,6 +132,7 @@ class BpkCalendarGridTransition extends Component {
|
|
|
132
132
|
className: stripClassNames,
|
|
133
133
|
style: getTransformStyles(transitionValue),
|
|
134
134
|
onTransitionEnd: this.onMonthTransitionEnd,
|
|
135
|
+
...getDataComponentAttribute('CalendarGridTransition'),
|
|
135
136
|
children: this.state.months.map((m, index) => min && max && isWithinRange(m, {
|
|
136
137
|
start: min,
|
|
137
138
|
end: max
|
|
@@ -22,7 +22,7 @@ import ArrowLeftIcon from "../../bpk-component-icon/lg/arrow-left";
|
|
|
22
22
|
import ArrowRightIcon from "../../bpk-component-icon/lg/arrow-right";
|
|
23
23
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
24
24
|
import BpkSelect from "../../bpk-component-select";
|
|
25
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
25
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
26
26
|
import { addMonths, formatIsoMonth, getMonthRange, getMonthsInRange, isWithinRange, parseIsoDate, startOfMonth } from "./date-utils";
|
|
27
27
|
import STYLES from "./BpkCalendarNav.module.css";
|
|
28
28
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -69,6 +69,7 @@ const BpkCalendarNav = ({
|
|
|
69
69
|
const nextMonth = addMonths(baseMonth, 1);
|
|
70
70
|
return /*#__PURE__*/_jsx("div", {
|
|
71
71
|
className: getClassName('bpk-calendar-nav'),
|
|
72
|
+
...getDataComponentAttribute('CalendarNav'),
|
|
72
73
|
children: /*#__PURE__*/_jsxs("div", {
|
|
73
74
|
style: {
|
|
74
75
|
display: 'table-row'
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { Component } from 'react';
|
|
20
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
20
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
21
|
import { SELECTION_TYPES } from "./BpkCalendarDate";
|
|
22
22
|
import { CALENDAR_SELECTION_TYPE } from "./custom-proptypes";
|
|
23
23
|
import { isSameDay, isSameWeek, isSameMonth, isToday, isWithinRange, startOfMonth, endOfMonth } from "./date-utils";
|
|
@@ -267,6 +267,7 @@ class BpkCalendarWeek extends Component {
|
|
|
267
267
|
}
|
|
268
268
|
return /*#__PURE__*/_jsx("div", {
|
|
269
269
|
className: getClassName('bpk-calendar-week'),
|
|
270
|
+
...getDataComponentAttribute('CalendarWeek'),
|
|
270
271
|
role: "row",
|
|
271
272
|
children: this.props.dates.map(date => {
|
|
272
273
|
const isBlocked = minDate && maxDate ? !isWithinRange(date.val, {
|
|
@@ -23,7 +23,7 @@ accessory view of a close icon.
|
|
|
23
23
|
*/
|
|
24
24
|
import { chipColors } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
25
25
|
import CloseCircleIconSm from "../../bpk-component-icon/sm/close-circle";
|
|
26
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
26
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
27
27
|
import BpkSelectableChip from "./BpkSelectableChip";
|
|
28
28
|
import { CHIP_TYPES } from "./commonTypes";
|
|
29
29
|
import STYLES from "./BpkSelectableChip.module.css";
|
|
@@ -48,7 +48,8 @@ const BpkDismissibleChip = ({
|
|
|
48
48
|
type: type,
|
|
49
49
|
role: "button" // Override role="checkbox" because this chip is not selectable.
|
|
50
50
|
,
|
|
51
|
-
className: classNames
|
|
51
|
+
className: classNames,
|
|
52
|
+
...getDataComponentAttribute('DismissibleChip')
|
|
52
53
|
});
|
|
53
54
|
};
|
|
54
55
|
export default BpkDismissibleChip;
|
|
@@ -22,6 +22,7 @@ with a trailing accessory view of a chevron down icon.
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import ChevronDownIconSm from "../../bpk-component-icon/sm/chevron-down";
|
|
25
|
+
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
25
26
|
import BpkSelectableChip from "./BpkSelectableChip";
|
|
26
27
|
import { CHIP_TYPES } from "./commonTypes";
|
|
27
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -36,6 +37,7 @@ const BpkDropdownChip = ({
|
|
|
36
37
|
leadingAccessoryView: leadingAccessoryView,
|
|
37
38
|
selected: selected,
|
|
38
39
|
type: type,
|
|
40
|
+
...getDataComponentAttribute('DropdownChip'),
|
|
39
41
|
...rest,
|
|
40
42
|
trailingAccessoryView: /*#__PURE__*/_jsx(ChevronDownIconSm, {})
|
|
41
43
|
});
|
|
@@ -22,9 +22,11 @@ been hard coded to have no text or trailing icon and padding/margin
|
|
|
22
22
|
to match.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
25
26
|
import BpkSelectableChip from "./BpkSelectableChip";
|
|
26
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
28
|
const BpkIconChip = props => /*#__PURE__*/_jsx(BpkSelectableChip, {
|
|
29
|
+
...getDataComponentAttribute('IconChip'),
|
|
28
30
|
...props,
|
|
29
31
|
children: null
|
|
30
32
|
});
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
|
|
20
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
20
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
21
|
import { CHIP_TYPES } from "./commonTypes";
|
|
22
22
|
import STYLES from "./BpkSelectableChip.module.css";
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -39,6 +39,7 @@ const BpkSelectableChip = ({
|
|
|
39
39
|
return /*#__PURE__*/_jsxs("button", {
|
|
40
40
|
"aria-checked": role === 'button' || role === 'tab' ? undefined : selected,
|
|
41
41
|
className: classNames,
|
|
42
|
+
...getDataComponentAttribute('SelectableChip'),
|
|
42
43
|
disabled: disabled,
|
|
43
44
|
role: role,
|
|
44
45
|
title: accessibilityLabel,
|
|
@@ -22,7 +22,7 @@ import BpkSelectableChip, { BpkDismissibleChip, BpkIconChip, BpkDropdownChip, CH
|
|
|
22
22
|
import BpkMobileScrollContainer from "../../bpk-component-mobile-scroll-container";
|
|
23
23
|
import BpkText, { TEXT_STYLES } from "../../bpk-component-text/src/BpkText";
|
|
24
24
|
import BpkVisuallyHidden from "../../bpk-component-visually-hidden";
|
|
25
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
25
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
26
26
|
import BpkStickyChip from "./BpkStickyChip";
|
|
27
27
|
import Nudger, { POSITION } from "./Nudger";
|
|
28
28
|
import STYLES from "./BpkChipGroup.module.css";
|
|
@@ -164,6 +164,7 @@ const WrapChipGroup = ({
|
|
|
164
164
|
});
|
|
165
165
|
const BpkMultiSelectChipGroup = props => /*#__PURE__*/_jsx("div", {
|
|
166
166
|
className: getClassName('bpk-chip-group-container'),
|
|
167
|
+
...getDataComponentAttribute('MultiSelectChipGroup'),
|
|
167
168
|
children: props.type === CHIP_GROUP_TYPES.rail ? /*#__PURE__*/_jsx(RailChipGroup, {
|
|
168
169
|
...props
|
|
169
170
|
}) : /*#__PURE__*/_jsx(WrapChipGroup, {
|
|
@@ -25,7 +25,7 @@ import { useEffect, useState } from 'react';
|
|
|
25
25
|
import BpkBreakpoint, { BREAKPOINTS } from "../../bpk-component-breakpoint";
|
|
26
26
|
import BpkSelectableChip from "../../bpk-component-chip";
|
|
27
27
|
import FilterIconSm from "../../bpk-component-icon/sm/filter";
|
|
28
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
28
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
29
29
|
import STYLES from "./BpkStickyChip.module.css";
|
|
30
30
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
31
|
const getClassName = cssModules(STYLES);
|
|
@@ -52,6 +52,7 @@ const BpkStickyChip = ({
|
|
|
52
52
|
const containerClassNames = getClassName('bpk-sticky-chip-container', `bpk-sticky-chip-container--${chipStyle}`);
|
|
53
53
|
return /*#__PURE__*/_jsx("div", {
|
|
54
54
|
className: containerClassNames,
|
|
55
|
+
...getDataComponentAttribute('StickyChip'),
|
|
55
56
|
children: /*#__PURE__*/_jsx(BpkBreakpoint, {
|
|
56
57
|
query: BREAKPOINTS.ABOVE_TABLET,
|
|
57
58
|
children: isDesktop => {
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import PropTypes from 'prop-types';
|
|
20
|
+
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
|
+
|
|
20
22
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
21
23
|
import BpkOverlayView from "./BpkOverlayView";
|
|
22
24
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
@@ -35,6 +37,7 @@ const BpkBasicMapMarker = props => {
|
|
|
35
37
|
return /*#__PURE__*/_jsx(BpkOverlayView, {
|
|
36
38
|
position: position,
|
|
37
39
|
getPixelPositionOffset: getPixelPositionOffset,
|
|
40
|
+
...getDataComponentAttribute('BasicMapMarker'),
|
|
38
41
|
...rest,
|
|
39
42
|
children: children
|
|
40
43
|
});
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
19
20
|
import BpkBasicMapMarker from "./BpkBasicMapMarker";
|
|
20
21
|
import BpkPriceMarkerButton, { MARKER_STATUSES } from "./BpkPriceMarkerButton";
|
|
21
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -42,6 +43,7 @@ const BpkPriceMarker = props => {
|
|
|
42
43
|
return /*#__PURE__*/_jsx(BpkBasicMapMarker, {
|
|
43
44
|
position: position,
|
|
44
45
|
"aria-label": accessibilityLabel,
|
|
46
|
+
...getDataComponentAttribute('PriceMarker'),
|
|
45
47
|
...rest,
|
|
46
48
|
children: /*#__PURE__*/_jsx(BpkPriceMarkerButton, {
|
|
47
49
|
...allButtonProps
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import { forwardRef } from 'react';
|
|
20
20
|
import BpkText, { TEXT_STYLES } from "../../bpk-component-text/src/BpkText";
|
|
21
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
21
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
22
22
|
import STYLES from "./BpkPriceMarker.module.css";
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
const getClassName = cssModules(STYLES);
|
|
@@ -28,6 +28,7 @@ const BpkPriceMarker = ({
|
|
|
28
28
|
}, ref) => /*#__PURE__*/_jsxs("div", {
|
|
29
29
|
className: getClassName('bpk-price-marker', `bpk-price-marker--${type}`),
|
|
30
30
|
ref: ref,
|
|
31
|
+
...getDataComponentAttribute('PriceMarker'),
|
|
31
32
|
children: [/*#__PURE__*/_jsx(BpkText, {
|
|
32
33
|
textStyle: TEXT_STYLES.label2,
|
|
33
34
|
children: priceLabel
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { useEffect, useRef, useState } from 'react';
|
|
20
20
|
import clamp from 'lodash/clamp';
|
|
21
21
|
import BpkText, { TEXT_STYLES } from "../../bpk-component-text/src/BpkText";
|
|
22
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
22
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
23
23
|
import BpkPriceMarker from "./BpkPriceMarker";
|
|
24
24
|
import { MARKER_DISPLAY_TYPES, MARKER_TYPES } from "./common-types";
|
|
25
25
|
import STYLES from "./BpkPriceRange.module.css";
|
|
@@ -102,6 +102,7 @@ const BpkPriceRange = ({
|
|
|
102
102
|
},
|
|
103
103
|
className: getClassName('bpk-price-range', shouldShowPriceOnBoundaries && 'bpk-price-range--large'),
|
|
104
104
|
ref: linesRef,
|
|
105
|
+
...getDataComponentAttribute('PriceRange'),
|
|
105
106
|
children: [shouldShowBubble && /*#__PURE__*/_jsx("div", {
|
|
106
107
|
className: getClassName('bpk-price-range__marker'),
|
|
107
108
|
children: /*#__PURE__*/_jsx(BpkPriceMarker, {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import { BpkCalendarGrid } from "../../bpk-component-calendar";
|
|
20
20
|
import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
|
|
21
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
21
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
22
22
|
import STYLES from "./BpkScrollableCalendarGrid.module.css";
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
const getClassName = cssModules(STYLES);
|
|
@@ -32,6 +32,7 @@ const BpkScrollableCalendarGrid = ({
|
|
|
32
32
|
const classNames = getClassName('bpk-scrollable-calendar-grid', className);
|
|
33
33
|
return /*#__PURE__*/_jsxs("div", {
|
|
34
34
|
className: classNames,
|
|
35
|
+
...getDataComponentAttribute('ScrollableCalendarGrid'),
|
|
35
36
|
children: [/*#__PURE__*/_jsx("span", {
|
|
36
37
|
className: getClassName('bpk-scrollable-calendar-grid__title'),
|
|
37
38
|
children: /*#__PURE__*/_jsx(BpkText, {
|
|
@@ -21,7 +21,7 @@ import { startOfDay, startOfMonth } from 'date-fns';
|
|
|
21
21
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
22
22
|
import { VariableSizeList as List } from 'react-window';
|
|
23
23
|
import { CALENDAR_SELECTION_TYPE, DateUtils } from "../../bpk-component-calendar";
|
|
24
|
-
import { cssModules } from "../../bpk-react-utils";
|
|
24
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
25
25
|
import BpkScrollableCalendarGrid from "./BpkScrollableCalendarGrid";
|
|
26
26
|
import { getMonthsArray, getMonthItemHeights } from "./utils";
|
|
27
27
|
import STYLES from "./BpkScrollableCalendarGridList.module.css";
|
|
@@ -102,6 +102,7 @@ const BpkScrollableCalendarGridList = props => {
|
|
|
102
102
|
const selectedDate = focusedDate || date;
|
|
103
103
|
return /*#__PURE__*/_jsx("div", {
|
|
104
104
|
className: getClassName('bpk-scrollable-calendar-grid-list', className),
|
|
105
|
+
...getDataComponentAttribute('ScrollableCalendarGridList'),
|
|
105
106
|
children: /*#__PURE__*/_jsx(AutoSizer, {
|
|
106
107
|
onResize: onResize,
|
|
107
108
|
defaultHeight: estimatedMonthItemHeight,
|
|
@@ -25,7 +25,7 @@ The actual component that developers create (i.e. the default export from this p
|
|
|
25
25
|
import { cloneElement, useRef, useState, useEffect } from 'react';
|
|
26
26
|
import { arrow, FloatingArrow, FloatingPortal, offset, safePolygon, shift, useFloating, useFocus, useHover, useInteractions, useRole } from '@floating-ui/react';
|
|
27
27
|
import { surfaceHighlightDay, onePixelRem } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
28
|
-
import { TransitionInitialMount, cssModules } from "../../bpk-react-utils";
|
|
28
|
+
import { TransitionInitialMount, cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
29
29
|
import { ARROW_ID, TOOLTIP_TYPES } from "./constants";
|
|
30
30
|
import STYLES from "./BpkTooltip.module.css";
|
|
31
31
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -118,6 +118,7 @@ const BpkTooltip = ({
|
|
|
118
118
|
tabIndex: -1,
|
|
119
119
|
role: "dialog",
|
|
120
120
|
className: classNames,
|
|
121
|
+
...getDataComponentAttribute('Tooltip'),
|
|
121
122
|
...rest,
|
|
122
123
|
children: [/*#__PURE__*/_jsx(FloatingArrow, {
|
|
123
124
|
ref: arrowRef,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyscanner/backpack-web",
|
|
3
|
-
"version": "41.
|
|
3
|
+
"version": "41.11.1",
|
|
4
4
|
"description": "Backpack Design System web library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@chakra-ui/react": "^3.30.0",
|
|
26
25
|
"@floating-ui/react": "^0.26.12",
|
|
27
26
|
"@popperjs/core": "^2.11.8",
|
|
28
27
|
"@radix-ui/react-compose-refs": "^1.1.1",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export { BpkProvider } from './src/BpkProvider';
|
|
2
|
-
export { BpkBox } from './src/BpkBox';
|
|
3
|
-
export { BpkVessel } from './src/BpkVessel';
|
|
4
|
-
export { BpkFlex } from './src/BpkFlex';
|
|
5
|
-
export { BpkGrid } from './src/BpkGrid';
|
|
6
|
-
export { BpkGridItem } from './src/BpkGridItem';
|
|
7
|
-
export type { BpkProviderProps } from './src/BpkProvider';
|
|
8
|
-
export type { BpkBoxProps } from './src/BpkBox';
|
|
9
|
-
export type { BpkVesselProps } from './src/BpkVessel';
|
|
10
|
-
export type { BpkFlexProps } from './src/BpkFlex';
|
|
11
|
-
export type { BpkGridProps } from './src/BpkGrid';
|
|
12
|
-
export type { BpkGridItemProps } from './src/BpkGridItem';
|
|
13
|
-
export { BpkStack, BpkHStack, BpkVStack } from './src/BpkStack';
|
|
14
|
-
export type { BpkStackProps } from './src/BpkStack';
|
|
15
|
-
export type { BpkCommonLayoutProps, BpkBoxSpecificProps, BpkFlexSpecificProps, BpkGridSpecificProps, BpkGridItemSpecificProps, } from './src/types';
|
|
16
|
-
export type { BpkStackSpecificProps } from './src/types';
|
|
17
|
-
export type { BpkSpacingToken, BpkBreakpointToken, BpkSpacingValue, BpkBreakpointValue, } from './src/tokens';
|
|
18
|
-
export { BpkSpacing, BpkBreakpoint, isValidSpacingValue, isPercentage, } from './src/tokens';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Backpack - Skyscanner's Design System
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2016 Skyscanner Ltd
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
export { BpkProvider } from "./src/BpkProvider";
|
|
20
|
-
export { BpkBox } from "./src/BpkBox";
|
|
21
|
-
export { BpkVessel } from "./src/BpkVessel";
|
|
22
|
-
export { BpkFlex } from "./src/BpkFlex";
|
|
23
|
-
export { BpkGrid } from "./src/BpkGrid";
|
|
24
|
-
export { BpkGridItem } from "./src/BpkGridItem";
|
|
25
|
-
export { BpkStack, BpkHStack, BpkVStack } from "./src/BpkStack";
|
|
26
|
-
|
|
27
|
-
// Export token types and utilities
|
|
28
|
-
|
|
29
|
-
export { BpkSpacing, BpkBreakpoint, isValidSpacingValue, isPercentage } from "./src/tokens";
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Backpack - Skyscanner's Design System
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2016 Skyscanner Ltd
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { Box } from '@chakra-ui/react';
|
|
20
|
-
import { processBpkComponentProps } from "./tokenUtils";
|
|
21
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
export const BpkBox = ({
|
|
23
|
-
children,
|
|
24
|
-
...props
|
|
25
|
-
}) => {
|
|
26
|
-
const processedProps = processBpkComponentProps(props, {
|
|
27
|
-
component: 'BpkBox'
|
|
28
|
-
});
|
|
29
|
-
return /*#__PURE__*/_jsx(Box, {
|
|
30
|
-
...processedProps,
|
|
31
|
-
children: children
|
|
32
|
-
});
|
|
33
|
-
};
|