@skyscanner/backpack-web 42.23.0 → 42.24.0-dev-v27250828403.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/BpkAccordionItem.d.ts +1 -1
- package/bpk-component-accordion/src/withSingleItemAccordionState.d.ts +1 -1
- package/bpk-component-aria-live/src/BpkAriaLive.d.ts +1 -1
- package/bpk-component-aria-live/src/BpkAriaLive.story-helpers.d.ts +2 -2
- package/bpk-component-autosuggest/src/BpkAutosuggestV2/BpkAutosuggest.d.ts +4 -4
- package/bpk-component-banner-alert/src/AnimateAndFade.d.ts +2 -1
- package/bpk-component-banner-alert/src/AnimateAndFade.js +6 -2
- package/bpk-component-barchart/src/BpkBarchartBar.js +7 -16
- package/bpk-component-barchart/src/BpkBarchartBars.js +6 -14
- package/bpk-component-barchart/src/BpkChartAxis.js +5 -12
- package/bpk-component-barchart/src/BpkChartDataTable.js +1 -4
- package/bpk-component-barchart/src/BpkChartGridLines.js +3 -8
- package/bpk-component-calendar/src/custom-proptypes.d.ts +1 -1
- package/bpk-component-card-list/src/common-types.d.ts +4 -4
- package/bpk-component-chatbot-input/src/hooks/useChatbotInput.d.ts +1 -1
- package/bpk-component-chatbot-input/src/hooks/useTextAreaAutoResize.d.ts +1 -1
- package/bpk-component-datepicker/src/BpkDatepicker.d.ts +3 -3
- package/bpk-component-drawer/src/BpkDrawerContent.d.ts +2 -2
- package/bpk-component-drawer/src/BpkDrawerContent.js +13 -1
- package/bpk-component-fieldset/src/BpkFieldset.d.ts +1 -1
- package/bpk-component-floating-notification/src/BpkFloatingNotification.js +4 -1
- package/bpk-component-info-banner/src/AnimateAndFade.d.ts +2 -1
- package/bpk-component-info-banner/src/AnimateAndFade.js +6 -2
- package/bpk-component-input/src/withOpenEvents.d.ts +1 -1
- package/bpk-component-layout/src/BpkProvider.d.ts +1 -1
- package/bpk-component-map/src/BpkBasicMapMarker.d.ts +1 -8
- package/bpk-component-map/src/BpkBasicMapMarker.js +0 -6
- package/bpk-component-map/src/BpkIconMarker.js +4 -10
- package/bpk-component-map/src/BpkIconMarkerBackground.js +3 -8
- package/bpk-component-map/src/BpkMap.js +14 -30
- package/bpk-component-map/src/withGoogleMapsScript.js +3 -8
- package/bpk-component-navigation-bar/src/BpkNavigationBar.d.ts +2 -2
- package/bpk-component-page-indicator/src/BpkPageIndicator.module.css +1 -1
- package/bpk-component-phone-input/src/BpkPhoneInput.js +6 -14
- package/bpk-component-price/index.d.ts +5 -0
- package/bpk-component-price/index.js +3 -1
- package/bpk-component-price/src/BpkPrice.d.ts +21 -0
- package/bpk-component-price/src/BpkPrice.js +3 -15
- package/bpk-component-price/src/common-types.d.ts +10 -0
- package/bpk-component-price/src/common-types.js +3 -1
- package/bpk-component-section-list/src/BpkSectionListItem.js +4 -10
- package/bpk-component-section-list/src/BpkSectionListSection.js +1 -4
- package/bpk-component-select/src/BpkSelect.d.ts +1 -1
- package/bpk-component-slider/src/BpkSlider.js +1 -1
- package/bpk-component-spinner/src/SpinnerLayout.story-helpers.d.ts +1 -7
- package/bpk-component-spinner/src/SpinnerLayout.story-helpers.js +0 -4
- package/bpk-component-star-rating/index.d.ts +9 -0
- package/bpk-component-star-rating/index.js +3 -1
- package/bpk-component-star-rating/src/BpkInteractiveStar.d.ts +17 -0
- package/bpk-component-star-rating/src/BpkInteractiveStar.js +4 -13
- package/bpk-component-star-rating/src/BpkInteractiveStarRating.d.ts +20 -0
- package/bpk-component-star-rating/src/BpkInteractiveStarRating.js +2 -14
- package/bpk-component-star-rating/src/BpkStar.d.ts +21 -0
- package/bpk-component-star-rating/src/BpkStar.js +9 -22
- package/bpk-component-star-rating/src/BpkStarRating.d.ts +21 -0
- package/bpk-component-star-rating/src/BpkStarRating.js +2 -10
- package/bpk-component-star-rating/src/themeAttributes.d.ts +2 -0
- package/bpk-component-star-rating/src/themeAttributes.js +3 -1
- package/bpk-component-star-rating/src/withInteractiveStarRatingState.d.ts +42 -0
- package/bpk-component-star-rating/src/withInteractiveStarRatingState.js +9 -10
- package/bpk-component-ticket/src/BpkTicket.js +6 -14
- package/bpk-stylesheets/base.css +1 -1
- package/bpk-stylesheets/primitives.css +4 -1
- package/bpk-stylesheets/theme-backpack-dark.css +39 -11
- package/bpk-stylesheets/theme-backpack-light.css +39 -11
- package/package.json +3 -3
|
@@ -7,7 +7,7 @@ export type BpkAccordionItemProps = {
|
|
|
7
7
|
className?: string;
|
|
8
8
|
expanded?: boolean;
|
|
9
9
|
initiallyExpanded?: boolean;
|
|
10
|
-
icon?: ReactElement
|
|
10
|
+
icon?: ReactElement<any>;
|
|
11
11
|
onClick?: () => void;
|
|
12
12
|
tagName?: 'span' | 'p' | 'text' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
13
13
|
textStyle?: (typeof TEXT_STYLES)[keyof typeof TEXT_STYLES];
|
|
@@ -9,7 +9,7 @@ type State = {
|
|
|
9
9
|
declare const withSingleItemAccordionState: <P extends BpkAccordionProps>(ComposedComponent: ComponentType<P>) => {
|
|
10
10
|
new (props: P & Props): {
|
|
11
11
|
openAccordionItem: (key?: string | number | null) => void;
|
|
12
|
-
renderAccordionItem: (accordionItem: ReactElement) => ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
12
|
+
renderAccordionItem: (accordionItem: ReactElement<any>) => ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
13
13
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
context: unknown;
|
|
15
15
|
setState<K extends "expanded">(state: State | ((prevState: Readonly<State>, props: Readonly<P & Props>) => State | Pick<State, K> | null) | Pick<State, K> | null, callback?: (() => void) | undefined): void;
|
|
@@ -6,7 +6,7 @@ export declare const POLITENESS_SETTINGS: {
|
|
|
6
6
|
};
|
|
7
7
|
export type PolitenessSetting = (typeof POLITENESS_SETTINGS)[keyof typeof POLITENESS_SETTINGS];
|
|
8
8
|
export type Props = {
|
|
9
|
-
children: ReactElement | string;
|
|
9
|
+
children: ReactElement<any> | string;
|
|
10
10
|
politenessSetting?: PolitenessSetting;
|
|
11
11
|
visible?: boolean;
|
|
12
12
|
className?: string | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
type AriaLiveDemoProps = {
|
|
3
|
-
preamble?: ReactElement | null;
|
|
4
|
-
children: ReactElement
|
|
3
|
+
preamble?: ReactElement<any> | null;
|
|
4
|
+
children: ReactElement<any>;
|
|
5
5
|
className?: string | null;
|
|
6
6
|
style?: {};
|
|
7
7
|
visible?: Boolean;
|
|
@@ -37,7 +37,7 @@ export type BpkAutoSuggestProps<T> = {
|
|
|
37
37
|
}) => void;
|
|
38
38
|
onSuggestionsFetchRequested: (value: string) => void;
|
|
39
39
|
onSuggestionsClearRequested: () => void;
|
|
40
|
-
renderSuggestion: (suggestion: T) => ReactElement
|
|
40
|
+
renderSuggestion: (suggestion: T) => ReactElement<any>;
|
|
41
41
|
id: string;
|
|
42
42
|
enterKeyHint?: EnterKeyHintType;
|
|
43
43
|
getA11yResultsMessage: (resultCount: number) => string;
|
|
@@ -45,20 +45,20 @@ export type BpkAutoSuggestProps<T> = {
|
|
|
45
45
|
isDesktop?: boolean;
|
|
46
46
|
onLoad?: (inputValue: string) => void;
|
|
47
47
|
onClick?: () => void;
|
|
48
|
-
renderBesideInput?: () => ReactElement
|
|
48
|
+
renderBesideInput?: () => ReactElement<any>;
|
|
49
49
|
showClear?: boolean;
|
|
50
50
|
theme?: Partial<BpkAutoSuggestTheme>;
|
|
51
51
|
highlightFirstSuggestion?: boolean;
|
|
52
52
|
shouldRenderSuggestions?: (value?: string) => boolean;
|
|
53
53
|
multiSection?: boolean;
|
|
54
54
|
getSectionSuggestions?: (section: T) => T[];
|
|
55
|
-
renderSectionTitle?: (section: T) => ReactElement | null;
|
|
55
|
+
renderSectionTitle?: (section: T) => ReactElement<any> | null;
|
|
56
56
|
alwaysRenderSuggestions?: boolean;
|
|
57
57
|
onInputValueChange?: (input: {
|
|
58
58
|
method: string;
|
|
59
59
|
newValue: string;
|
|
60
60
|
}) => void;
|
|
61
|
-
renderInputComponent?: (inputProps: BpkInputRenderProps) => ReactElement
|
|
61
|
+
renderInputComponent?: (inputProps: BpkInputRenderProps) => ReactElement<any>;
|
|
62
62
|
onSuggestionHighlighted?: (data: {
|
|
63
63
|
suggestion: T | null;
|
|
64
64
|
}) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ReactNode, RefObject } from 'react';
|
|
3
3
|
type Props = {
|
|
4
4
|
animateOnEnter: boolean;
|
|
5
5
|
animateOnLeave: boolean;
|
|
@@ -25,6 +25,7 @@ declare class AnimateAndFade extends Component<Props, State> {
|
|
|
25
25
|
componentDidUpdate(prevProps: Props): void;
|
|
26
26
|
onAnimateHeightComplete: () => void;
|
|
27
27
|
onFadeComplete: () => void;
|
|
28
|
+
nodeRef: RefObject<HTMLElement>;
|
|
28
29
|
toggle: () => void;
|
|
29
30
|
render(): import("react/jsx-runtime").JSX.Element | null;
|
|
30
31
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { Component } from 'react';
|
|
19
|
+
import { Component, cloneElement, createRef, isValidElement } from 'react';
|
|
20
20
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
21
21
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
22
22
|
import BpkAnimateHeight from "../../bpk-animate-height";
|
|
@@ -78,6 +78,7 @@ class AnimateAndFade extends Component {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
+
nodeRef = /*#__PURE__*/createRef();
|
|
81
82
|
toggle = () => {
|
|
82
83
|
if (this.state.visible && this.state.isExpanded) {
|
|
83
84
|
this.setState({
|
|
@@ -119,6 +120,7 @@ class AnimateAndFade extends Component {
|
|
|
119
120
|
appear: animateOnEnter,
|
|
120
121
|
onTransitionEnd: this.onFadeComplete,
|
|
121
122
|
children: this.state.visible && /*#__PURE__*/_jsx(CSSTransition, {
|
|
123
|
+
nodeRef: this.nodeRef,
|
|
122
124
|
classNames: {
|
|
123
125
|
exit: getClassName('bpk-animate-and-fade--leave'),
|
|
124
126
|
exitActive: getClassName('bpk-animate-and-fade--leave-active'),
|
|
@@ -131,7 +133,9 @@ class AnimateAndFade extends Component {
|
|
|
131
133
|
enter: ANIMATION_DURATION * 2,
|
|
132
134
|
exit: ANIMATION_DURATION * 2
|
|
133
135
|
},
|
|
134
|
-
children: children
|
|
136
|
+
children: /*#__PURE__*/isValidElement(children) ? /*#__PURE__*/cloneElement(children, {
|
|
137
|
+
ref: this.nodeRef
|
|
138
|
+
}) : children
|
|
135
139
|
})
|
|
136
140
|
})]
|
|
137
141
|
})
|
|
@@ -34,15 +34,15 @@ const handleKeyboardEvent = callback => event => {
|
|
|
34
34
|
const borderRadius = remToPx(borderRadiusXs);
|
|
35
35
|
const BpkBarchartBar = props => {
|
|
36
36
|
const {
|
|
37
|
-
className,
|
|
37
|
+
className = null,
|
|
38
38
|
height,
|
|
39
39
|
label,
|
|
40
|
-
onClick,
|
|
41
|
-
onFocus,
|
|
42
|
-
onHover,
|
|
43
|
-
outlier,
|
|
44
|
-
padding,
|
|
45
|
-
selected,
|
|
40
|
+
onClick = null,
|
|
41
|
+
onFocus = null,
|
|
42
|
+
onHover = null,
|
|
43
|
+
outlier = false,
|
|
44
|
+
padding = 0,
|
|
45
|
+
selected = false,
|
|
46
46
|
width,
|
|
47
47
|
x,
|
|
48
48
|
y,
|
|
@@ -98,13 +98,4 @@ BpkBarchartBar.propTypes = {
|
|
|
98
98
|
padding: PropTypes.number,
|
|
99
99
|
selected: PropTypes.bool
|
|
100
100
|
};
|
|
101
|
-
BpkBarchartBar.defaultProps = {
|
|
102
|
-
className: null,
|
|
103
|
-
onClick: null,
|
|
104
|
-
onHover: null,
|
|
105
|
-
onFocus: null,
|
|
106
|
-
outlier: false,
|
|
107
|
-
padding: 0,
|
|
108
|
-
selected: false
|
|
109
|
-
};
|
|
110
101
|
export default BpkBarchartBar;
|
|
@@ -49,15 +49,15 @@ const BpkBarchartBars = props => {
|
|
|
49
49
|
BarComponent,
|
|
50
50
|
data,
|
|
51
51
|
getBarLabel,
|
|
52
|
-
getBarSelection,
|
|
52
|
+
getBarSelection = () => false,
|
|
53
53
|
height,
|
|
54
|
-
innerPadding,
|
|
54
|
+
innerPadding = 0.35,
|
|
55
55
|
margin,
|
|
56
56
|
maxYValue,
|
|
57
|
-
onBarClick,
|
|
58
|
-
onBarFocus,
|
|
59
|
-
onBarHover,
|
|
60
|
-
outerPadding,
|
|
57
|
+
onBarClick = null,
|
|
58
|
+
onBarFocus = null,
|
|
59
|
+
onBarHover = null,
|
|
60
|
+
outerPadding = 0.35,
|
|
61
61
|
xScale,
|
|
62
62
|
xScaleDataKey,
|
|
63
63
|
yScale,
|
|
@@ -130,12 +130,4 @@ BpkBarchartBars.propTypes = {
|
|
|
130
130
|
onBarHover: PropTypes.func,
|
|
131
131
|
onBarFocus: PropTypes.func
|
|
132
132
|
};
|
|
133
|
-
BpkBarchartBars.defaultProps = {
|
|
134
|
-
outerPadding: 0.35,
|
|
135
|
-
innerPadding: 0.35,
|
|
136
|
-
onBarClick: null,
|
|
137
|
-
onBarHover: null,
|
|
138
|
-
onBarFocus: null,
|
|
139
|
-
getBarSelection: () => false
|
|
140
|
-
};
|
|
141
133
|
export default BpkBarchartBars;
|
|
@@ -72,14 +72,14 @@ const getAxisConfig = ({
|
|
|
72
72
|
const BpkChartAxis = props => {
|
|
73
73
|
const {
|
|
74
74
|
height,
|
|
75
|
-
label,
|
|
75
|
+
label = null,
|
|
76
76
|
margin,
|
|
77
|
-
numTicks,
|
|
77
|
+
numTicks = null,
|
|
78
78
|
orientation,
|
|
79
79
|
scale,
|
|
80
|
-
tickEvery,
|
|
81
|
-
tickOffset,
|
|
82
|
-
tickValue,
|
|
80
|
+
tickEvery = 1,
|
|
81
|
+
tickOffset = 0,
|
|
82
|
+
tickValue = identity,
|
|
83
83
|
width,
|
|
84
84
|
...rest
|
|
85
85
|
} = props;
|
|
@@ -131,11 +131,4 @@ BpkChartAxis.propTypes = {
|
|
|
131
131
|
tickOffset: PropTypes.number,
|
|
132
132
|
tickEvery: PropTypes.number
|
|
133
133
|
};
|
|
134
|
-
BpkChartAxis.defaultProps = {
|
|
135
|
-
tickOffset: 0,
|
|
136
|
-
tickEvery: 1,
|
|
137
|
-
tickValue: identity,
|
|
138
|
-
numTicks: null,
|
|
139
|
-
label: null
|
|
140
|
-
};
|
|
141
134
|
export default BpkChartAxis;
|
|
@@ -22,7 +22,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
22
22
|
const getClassName = cssModules(STYLES);
|
|
23
23
|
const BpkChartDataTable = props => {
|
|
24
24
|
const {
|
|
25
|
-
data,
|
|
25
|
+
data = null,
|
|
26
26
|
xAxisLabel,
|
|
27
27
|
xScaleDataKey,
|
|
28
28
|
yAxisLabel,
|
|
@@ -61,7 +61,4 @@ BpkChartDataTable.propTypes = {
|
|
|
61
61
|
xAxisLabel: PropTypes.string.isRequired,
|
|
62
62
|
yAxisLabel: PropTypes.string.isRequired
|
|
63
63
|
};
|
|
64
|
-
BpkChartDataTable.defaultProps = {
|
|
65
|
-
data: null
|
|
66
|
-
};
|
|
67
64
|
export default BpkChartDataTable;
|
|
@@ -25,11 +25,11 @@ const BpkChartGridLines = props => {
|
|
|
25
25
|
const {
|
|
26
26
|
height,
|
|
27
27
|
margin,
|
|
28
|
-
numTicks,
|
|
28
|
+
numTicks = null,
|
|
29
29
|
orientation,
|
|
30
30
|
scale,
|
|
31
|
-
tickEvery,
|
|
32
|
-
tickOffset,
|
|
31
|
+
tickEvery = 1,
|
|
32
|
+
tickOffset = 0,
|
|
33
33
|
width,
|
|
34
34
|
...rest
|
|
35
35
|
} = props;
|
|
@@ -75,9 +75,4 @@ BpkChartGridLines.propTypes = {
|
|
|
75
75
|
tickOffset: PropTypes.number,
|
|
76
76
|
tickEvery: PropTypes.number
|
|
77
77
|
};
|
|
78
|
-
BpkChartGridLines.defaultProps = {
|
|
79
|
-
numTicks: null,
|
|
80
|
-
tickOffset: 0,
|
|
81
|
-
tickEvery: 1
|
|
82
|
-
};
|
|
83
78
|
export default BpkChartGridLines;
|
|
@@ -17,7 +17,7 @@ declare const ACCESSORY_MOBILE_TYPES: {
|
|
|
17
17
|
readonly button: "button";
|
|
18
18
|
};
|
|
19
19
|
type ExpandProps = {
|
|
20
|
-
children: string | ReactElement
|
|
20
|
+
children: string | ReactElement<any>;
|
|
21
21
|
collapsed: boolean;
|
|
22
22
|
onExpandToggle: () => void;
|
|
23
23
|
};
|
|
@@ -29,7 +29,7 @@ type AccessibilityLabels = {
|
|
|
29
29
|
slideLabel?: (index: number, childrenLength: number) => string;
|
|
30
30
|
};
|
|
31
31
|
type CardListBaseProps = {
|
|
32
|
-
cardList: ReactElement
|
|
32
|
+
cardList: Array<ReactElement<any>>;
|
|
33
33
|
layoutMobile: LayoutMobile;
|
|
34
34
|
layoutDesktop: LayoutDesktop;
|
|
35
35
|
accessoryDesktop?: (typeof ACCESSORY_DESKTOP_TYPES)[keyof typeof ACCESSORY_DESKTOP_TYPES];
|
|
@@ -37,7 +37,7 @@ type CardListBaseProps = {
|
|
|
37
37
|
initiallyShownCardsDesktop?: number;
|
|
38
38
|
initiallyShownCardsMobile?: number;
|
|
39
39
|
initiallyInViewCardIndex?: number;
|
|
40
|
-
chipGroup?: ReactElement
|
|
40
|
+
chipGroup?: ReactElement<any>;
|
|
41
41
|
buttonContent?: React.ReactNode;
|
|
42
42
|
onButtonClick?: () => void;
|
|
43
43
|
onExpandClick?: () => void;
|
|
@@ -53,7 +53,7 @@ type TitleProps = {
|
|
|
53
53
|
description?: never;
|
|
54
54
|
};
|
|
55
55
|
type CardListGridStackProps = {
|
|
56
|
-
children: ReactElement
|
|
56
|
+
children: Array<ReactElement<any>>;
|
|
57
57
|
initiallyShownCards: number;
|
|
58
58
|
layout: typeof LAYOUTS.grid | typeof LAYOUTS.stack;
|
|
59
59
|
accessory?: typeof ACCESSORY_DESKTOP_TYPES.expand | typeof ACCESSORY_DESKTOP_TYPES.button | typeof ACCESSORY_MOBILE_TYPES.expand | typeof ACCESSORY_MOBILE_TYPES.button;
|
|
@@ -16,7 +16,7 @@ interface UseChatbotInputOptions {
|
|
|
16
16
|
onKeyDown?: (e: KeyboardEvent) => void;
|
|
17
17
|
}
|
|
18
18
|
interface UseChatbotInputReturn {
|
|
19
|
-
inputRef: RefObject<HTMLInputElement | HTMLTextAreaElement>;
|
|
19
|
+
inputRef: RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
|
|
20
20
|
isFocused: boolean;
|
|
21
21
|
isDisabled: boolean;
|
|
22
22
|
isOverLimit: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
import type { ReactElement,
|
|
2
|
+
import type { ReactElement, Ref } from 'react';
|
|
3
3
|
import type { DaysOfWeek, ReactComponent, SelectionConfiguration } from '../../bpk-component-calendar';
|
|
4
4
|
type Props = {
|
|
5
5
|
changeMonthLabel: string;
|
|
@@ -24,7 +24,7 @@ type Props = {
|
|
|
24
24
|
/**
|
|
25
25
|
* By default BpkInput. If passed, it should be a DOM node with a ref attached to it.
|
|
26
26
|
*/
|
|
27
|
-
inputComponent: ReactElement | null;
|
|
27
|
+
inputComponent: ReactElement<any> | null;
|
|
28
28
|
dateModifiers?: {};
|
|
29
29
|
fixedWidth?: boolean;
|
|
30
30
|
inputProps?: {};
|
|
@@ -51,7 +51,7 @@ type State = {
|
|
|
51
51
|
declare class BpkDatepicker extends Component<Props, State> {
|
|
52
52
|
inputRef: (ref: HTMLInputElement) => void;
|
|
53
53
|
elementRef?: HTMLInputElement;
|
|
54
|
-
focusRef?:
|
|
54
|
+
focusRef?: Ref<HTMLDivElement>;
|
|
55
55
|
static defaultProps: {
|
|
56
56
|
calendarComponent: {
|
|
57
57
|
new (props: Omit<import("../../bpk-component-calendar/src/composeCalendar").Props & import("../../bpk-component-calendar/src/BpkCalendarContainer").Props, keyof {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ReactNode,
|
|
1
|
+
import type { ReactNode, Ref } from 'react';
|
|
2
2
|
type Props = {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
dialogRef:
|
|
4
|
+
dialogRef: Ref<HTMLElement>;
|
|
5
5
|
onCloseAnimationComplete: () => void;
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
id: string;
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { useCallback, useRef } from 'react';
|
|
19
20
|
import { Transition } from 'react-transition-group';
|
|
20
21
|
import { animations } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
21
22
|
|
|
@@ -66,7 +67,18 @@ const BpkDrawerContent = ({
|
|
|
66
67
|
contentClassNames.push(contentClassName);
|
|
67
68
|
}
|
|
68
69
|
const headingId = `bpk-drawer-heading-${id}`;
|
|
70
|
+
const nodeRef = useRef(null);
|
|
71
|
+
const setRefs = useCallback(el => {
|
|
72
|
+
nodeRef.current = el;
|
|
73
|
+
const consumerRef = dialogRef;
|
|
74
|
+
if (typeof consumerRef === 'function') {
|
|
75
|
+
consumerRef(el);
|
|
76
|
+
} else if (consumerRef) {
|
|
77
|
+
consumerRef.current = el;
|
|
78
|
+
}
|
|
79
|
+
}, [dialogRef]);
|
|
69
80
|
return /*#__PURE__*/_jsx(Transition, {
|
|
81
|
+
nodeRef: nodeRef,
|
|
70
82
|
timeout: {
|
|
71
83
|
enter: 0,
|
|
72
84
|
exit: parseInt(animations.durationSm, 10)
|
|
@@ -85,7 +97,7 @@ const BpkDrawerContent = ({
|
|
|
85
97
|
'--dynamic-width': width
|
|
86
98
|
},
|
|
87
99
|
className: [drawerClassNames.join(' '), getClassName(`bpk-drawer--${status}`, mobileModalDisplay ? `bpk-drawer__modal-mobile-view--${status}` : undefined)].join(' '),
|
|
88
|
-
ref:
|
|
100
|
+
ref: setRefs,
|
|
89
101
|
...rest,
|
|
90
102
|
children: [/*#__PURE__*/_jsxs("header", {
|
|
91
103
|
className: getClassName('bpk-drawer__header'),
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { useEffect, useState } from 'react';
|
|
19
|
+
import { useEffect, useRef, useState } from 'react';
|
|
20
20
|
import { CSSTransition } from 'react-transition-group';
|
|
21
21
|
import BpkAriaLive, { ARIA_LIVE_POLITENESS_SETTINGS } from "../../bpk-component-aria-live";
|
|
22
22
|
import BpkButton, { BUTTON_TYPES } from "../../bpk-component-button";
|
|
@@ -31,6 +31,7 @@ export const NOTIFICATION_TYPES = {
|
|
|
31
31
|
};
|
|
32
32
|
const BpkFloatingNotification = props => {
|
|
33
33
|
const [showMessage, setShowMessage] = useState(true);
|
|
34
|
+
const nodeRef = useRef(null);
|
|
34
35
|
const {
|
|
35
36
|
animateOnEnter = true,
|
|
36
37
|
animateOnExit = true,
|
|
@@ -54,6 +55,7 @@ const BpkFloatingNotification = props => {
|
|
|
54
55
|
});
|
|
55
56
|
return /*#__PURE__*/_jsx(CSSTransition, {
|
|
56
57
|
in: showMessage,
|
|
58
|
+
nodeRef: nodeRef,
|
|
57
59
|
classNames: {
|
|
58
60
|
exit: getClassName('bpk-floating-notification--leave'),
|
|
59
61
|
exitActive: getClassName('bpk-floating-notification--leave-active'),
|
|
@@ -66,6 +68,7 @@ const BpkFloatingNotification = props => {
|
|
|
66
68
|
exit: animateOnExit,
|
|
67
69
|
onExited: onExit,
|
|
68
70
|
children: /*#__PURE__*/_jsxs("div", {
|
|
71
|
+
ref: nodeRef,
|
|
69
72
|
className: classNames,
|
|
70
73
|
...getDataComponentAttribute('FloatingNotification'),
|
|
71
74
|
...rest,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ReactNode, RefObject } from 'react';
|
|
3
3
|
type Props = {
|
|
4
4
|
animateOnEnter: boolean;
|
|
5
5
|
animateOnLeave: boolean;
|
|
@@ -25,6 +25,7 @@ declare class AnimateAndFade extends Component<Props, State> {
|
|
|
25
25
|
componentDidUpdate(prevProps: Props): void;
|
|
26
26
|
onAnimateHeightComplete: () => void;
|
|
27
27
|
onFadeComplete: () => void;
|
|
28
|
+
nodeRef: RefObject<HTMLElement>;
|
|
28
29
|
toggle: () => void;
|
|
29
30
|
render(): import("react/jsx-runtime").JSX.Element | null;
|
|
30
31
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { Component } from 'react';
|
|
19
|
+
import { Component, cloneElement, createRef, isValidElement } from 'react';
|
|
20
20
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
21
21
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
22
22
|
import BpkAnimateHeight from "../../bpk-animate-height";
|
|
@@ -78,6 +78,7 @@ class AnimateAndFade extends Component {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
+
nodeRef = /*#__PURE__*/createRef();
|
|
81
82
|
toggle = () => {
|
|
82
83
|
if (this.state.visible && this.state.isExpanded) {
|
|
83
84
|
this.setState({
|
|
@@ -119,6 +120,7 @@ class AnimateAndFade extends Component {
|
|
|
119
120
|
appear: animateOnEnter,
|
|
120
121
|
onTransitionEnd: this.onFadeComplete,
|
|
121
122
|
children: this.state.visible && /*#__PURE__*/_jsx(CSSTransition, {
|
|
123
|
+
nodeRef: this.nodeRef,
|
|
122
124
|
classNames: {
|
|
123
125
|
exit: getClassName('bpk-animate-and-fade--leave'),
|
|
124
126
|
exitActive: getClassName('bpk-animate-and-fade--leave-active'),
|
|
@@ -131,7 +133,9 @@ class AnimateAndFade extends Component {
|
|
|
131
133
|
enter: ANIMATION_DURATION * 2,
|
|
132
134
|
exit: ANIMATION_DURATION * 2
|
|
133
135
|
},
|
|
134
|
-
children: children
|
|
136
|
+
children: /*#__PURE__*/isValidElement(children) ? /*#__PURE__*/cloneElement(children, {
|
|
137
|
+
ref: this.nodeRef
|
|
138
|
+
}) : children
|
|
135
139
|
})
|
|
136
140
|
})]
|
|
137
141
|
})
|
|
@@ -40,7 +40,7 @@ declare const withOpenEvents: <P extends object>(WithOpenEventsInputComponent: C
|
|
|
40
40
|
handleTouchEnd: (event: UIEvent) => void;
|
|
41
41
|
handleFocus: () => void;
|
|
42
42
|
handleBlur: () => void;
|
|
43
|
-
render(): ReactElement
|
|
43
|
+
render(): ReactElement<any>;
|
|
44
44
|
context: unknown;
|
|
45
45
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P & import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Omit<EventHandlers, "inputMode" | "aria-readonly" | "readOnly"> & WithOpenEventsProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
46
46
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
1
|
import type { ReactNode } from 'react';
|
|
3
2
|
import { type LatLong } from './common-types';
|
|
4
3
|
type Props = {
|
|
5
4
|
children: ReactNode;
|
|
6
5
|
position: LatLong;
|
|
7
6
|
};
|
|
8
|
-
declare const BpkBasicMapMarker:
|
|
9
|
-
(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
propTypes: {
|
|
11
|
-
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
12
|
-
position: any;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
7
|
+
declare const BpkBasicMapMarker: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
8
|
export default BpkBasicMapMarker;
|
|
@@ -16,13 +16,11 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import PropTypes from 'prop-types';
|
|
20
19
|
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
20
|
|
|
22
21
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
23
22
|
import BpkOverlayView from "./BpkOverlayView";
|
|
24
23
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
25
|
-
import { LatLongPropType } from "./common-types";
|
|
26
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
25
|
const getPixelPositionOffset = (width, height) => ({
|
|
28
26
|
x: -(width / 2),
|
|
@@ -42,8 +40,4 @@ const BpkBasicMapMarker = props => {
|
|
|
42
40
|
children: children
|
|
43
41
|
});
|
|
44
42
|
};
|
|
45
|
-
BpkBasicMapMarker.propTypes = {
|
|
46
|
-
children: PropTypes.node.isRequired,
|
|
47
|
-
position: LatLongPropType.isRequired
|
|
48
|
-
};
|
|
49
43
|
export default BpkBasicMapMarker;
|
|
@@ -24,12 +24,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
24
24
|
const getClassName = cssModules(STYLES);
|
|
25
25
|
const BpkIconMarker = props => {
|
|
26
26
|
const {
|
|
27
|
-
buttonProps,
|
|
28
|
-
className,
|
|
27
|
+
buttonProps = null,
|
|
28
|
+
className = null,
|
|
29
29
|
icon,
|
|
30
|
-
onClick,
|
|
30
|
+
onClick = null,
|
|
31
31
|
position,
|
|
32
|
-
selected,
|
|
32
|
+
selected = false,
|
|
33
33
|
...rest
|
|
34
34
|
} = props;
|
|
35
35
|
const wrapperClassNames = getClassName('bpk-icon-marker__wrapper', selected && 'bpk-icon-marker__wrapper--selected', className);
|
|
@@ -64,10 +64,4 @@ BpkIconMarker.propTypes = {
|
|
|
64
64
|
selected: PropTypes.bool,
|
|
65
65
|
buttonProps: PropTypes.object // eslint-disable-line react/forbid-prop-types
|
|
66
66
|
};
|
|
67
|
-
BpkIconMarker.defaultProps = {
|
|
68
|
-
className: null,
|
|
69
|
-
onClick: null,
|
|
70
|
-
selected: false,
|
|
71
|
-
buttonProps: null
|
|
72
|
-
};
|
|
73
67
|
export default BpkIconMarker;
|
|
@@ -20,9 +20,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
20
20
|
const getClassName = cssModules(STYLES);
|
|
21
21
|
const BpkIconMarkerBackground = props => {
|
|
22
22
|
const {
|
|
23
|
-
disabled,
|
|
24
|
-
interactive,
|
|
25
|
-
selected,
|
|
23
|
+
disabled = false,
|
|
24
|
+
interactive = false,
|
|
25
|
+
selected = false,
|
|
26
26
|
...rest
|
|
27
27
|
} = props;
|
|
28
28
|
const classNames = getClassName('bpk-icon-marker-background', interactive && 'bpk-icon-marker-background--interactive', disabled && 'bpk-icon-marker-background--disabled', selected && 'bpk-icon-marker-background--selected');
|
|
@@ -61,9 +61,4 @@ const BpkIconMarkerBackground = props => {
|
|
|
61
61
|
})
|
|
62
62
|
);
|
|
63
63
|
};
|
|
64
|
-
BpkIconMarkerBackground.defaultProps = {
|
|
65
|
-
disabled: false,
|
|
66
|
-
interactive: false,
|
|
67
|
-
selected: false
|
|
68
|
-
};
|
|
69
64
|
export default BpkIconMarkerBackground;
|