@skyscanner/backpack-web 34.15.1 → 34.16.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-banner-alert/src/BpkBannerAlert.d.ts +0 -1
- package/bpk-component-banner-alert/src/BpkBannerAlertDismissable.d.ts +0 -1
- package/bpk-component-banner-alert/src/withBannerAlertState.d.ts +34 -40
- package/bpk-component-boilerplate/src/BpkBoilerplate.d.ts +0 -1
- package/bpk-component-button/BpkButtonDestructive.d.ts +0 -1
- package/bpk-component-button/BpkButtonFeatured.d.ts +0 -1
- package/bpk-component-button/BpkButtonLink.d.ts +0 -1
- package/bpk-component-button/BpkButtonLinkOnDark.d.ts +0 -1
- package/bpk-component-button/BpkButtonPrimary.d.ts +0 -1
- package/bpk-component-button/BpkButtonPrimaryOnDark.d.ts +0 -1
- package/bpk-component-button/BpkButtonPrimaryOnLight.d.ts +0 -1
- package/bpk-component-button/BpkButtonSecondary.d.ts +0 -1
- package/bpk-component-button/BpkButtonSecondaryOnDark.d.ts +0 -1
- package/bpk-component-button/src/BpkButton.d.ts +0 -1
- package/bpk-component-button/src/BpkButtonBase.d.ts +1 -12
- package/bpk-component-button/src/BpkButtonV2/BpkButton.d.ts +0 -1
- package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +6 -6
- package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +3 -3
- package/bpk-component-card/src/CardContext.d.ts +0 -1
- package/bpk-component-carousel/src/BpkCarousel.d.ts +0 -1
- package/bpk-component-chip/src/BpkDismissibleChip.d.ts +0 -1
- package/bpk-component-chip/src/BpkDropdownChip.d.ts +0 -1
- package/bpk-component-chip-group/src/BpkSingleSelectChipGroup.d.ts +0 -1
- package/bpk-component-datatable/src/BpkDataTable.d.ts +0 -1
- package/bpk-component-datatable/src/BpkDataTableHeader.d.ts +0 -1
- package/bpk-component-datepicker/src/BpkDatepicker.d.ts +5 -5
- package/bpk-component-dialog/src/BpkDialog.d.ts +0 -1
- package/bpk-component-dialog/src/BpkDialogInner.d.ts +6 -7
- package/bpk-component-graphic-promotion/src/BpkGraphicPromo.d.ts +0 -1
- package/bpk-component-icon/src/classNameModifierHOCFactory.d.ts +1 -1
- package/bpk-component-icon/src/withRtlSupport.d.ts +2 -3
- package/bpk-component-image/src/withLazyLoading.d.ts +6 -7
- package/bpk-component-image/src/withLoadingBehavior.d.ts +3 -3
- package/bpk-component-info-banner/src/BpkInfoBanner.d.ts +0 -1
- package/bpk-component-info-banner/src/BpkInfoBannerDismissable.d.ts +0 -1
- package/bpk-component-info-banner/src/withBannerAlertState.d.ts +34 -41
- package/bpk-component-input/src/withOpenEvents.d.ts +3 -3
- package/bpk-component-inset-banner/src/BpkInsetBanner.d.ts +0 -1
- package/bpk-component-journey-arrow/src/BpkJourneyArrow.d.ts +0 -1
- package/bpk-component-nudger/src/BpkConfigurableNudger.d.ts +0 -1
- package/bpk-component-nudger/src/BpkNudger.d.ts +0 -1
- package/bpk-component-rtl-toggle/src/updateOnDirectionChange.d.ts +6 -6
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendar.d.ts +5 -6
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarDate.d.ts +0 -1
- package/bpk-component-skeleton/src/BpkBaseSkeleton.d.d.ts +0 -1
- package/bpk-component-skeleton/src/BpkBaseSkeleton.d.ts +0 -1
- package/bpk-component-skeleton/src/BpkSkeleton.d.d.ts +0 -1
- package/bpk-component-skeleton/src/BpkSkeleton.d.ts +0 -1
- package/bpk-component-slider/src/BpkSlider.d.ts +0 -1
- package/bpk-component-snippet/index.d.ts +3 -0
- package/bpk-component-snippet/index.js +21 -0
- package/bpk-component-snippet/src/BpkSnippet.d.ts +48 -0
- package/bpk-component-snippet/src/BpkSnippet.js +131 -0
- package/bpk-component-snippet/src/BpkSnippet.module.css +18 -0
- package/bpk-component-spinner/src/BpkExtraLargeSpinner.d.ts +0 -1
- package/bpk-component-spinner/src/BpkLargeSpinner.d.ts +0 -1
- package/bpk-component-spinner/src/BpkSpinner.d.ts +0 -1
- package/bpk-component-split-input/src/BpkInputField.js +4 -1
- package/bpk-component-split-input/src/BpkSplitInput.js +1 -1
- package/bpk-component-swap-button/src/BpkSwapButton.d.ts +0 -1
- package/bpk-react-utils/index.d.ts +6 -7
- package/bpk-scrim-utils/index.d.ts +7 -8
- package/bpk-scrim-utils/src/withScrim.d.ts +6 -6
- package/package.json +1 -1
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { ComponentType } from 'react';
|
|
2
|
+
import type { Props as BpkInfoBannerDismissableProps } from './BpkInfoBannerDismissable';
|
|
3
|
+
import type { Props as BpkInfoBannerExpandableProps } from './BpkInfoBannerExpandable';
|
|
3
4
|
export type WithBannerAlertStateProps = {
|
|
4
5
|
onHide?: () => void;
|
|
5
6
|
hideAfter?: number;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
onDismiss?: import("./common-types").OnDismissHandler;
|
|
10
|
-
} & {
|
|
11
|
-
children: import("react").ReactNode;
|
|
12
|
-
expanded?: boolean | undefined;
|
|
13
|
-
toggleButtonLabel: string;
|
|
14
|
-
onExpandToggle?: import("./common-types").OnExpandToggleHandler;
|
|
15
|
-
action?: import("./common-types").ExpandableBannerAction;
|
|
16
|
-
}>>(WrappedComponent: ComponentType<P>) => {
|
|
8
|
+
type BpkInfoBannerProps = Partial<BpkInfoBannerDismissableProps & BpkInfoBannerExpandableProps>;
|
|
9
|
+
declare const withBannerAlertState: <P extends BpkInfoBannerProps>(WrappedComponent: ComponentType<P>) => {
|
|
17
10
|
new (props: P & WithBannerAlertStateProps): {
|
|
18
|
-
hideIntervalId?:
|
|
11
|
+
hideIntervalId?: ReturnType<typeof setTimeout> | null;
|
|
19
12
|
componentDidMount(): void;
|
|
20
13
|
componentWillUnmount(): void;
|
|
21
14
|
onExpandToggle: () => void;
|
|
@@ -24,59 +17,59 @@ declare const withBannerAlertState: <P extends Partial<import("./common-types").
|
|
|
24
17
|
render(): JSX.Element;
|
|
25
18
|
context: any;
|
|
26
19
|
setState<K extends keyof {
|
|
27
|
-
expanded?: boolean
|
|
28
|
-
show?: boolean
|
|
20
|
+
expanded?: boolean;
|
|
21
|
+
show?: boolean;
|
|
29
22
|
}>(state: {
|
|
30
|
-
expanded?: boolean
|
|
31
|
-
show?: boolean
|
|
23
|
+
expanded?: boolean;
|
|
24
|
+
show?: boolean;
|
|
32
25
|
} | ((prevState: Readonly<{
|
|
33
|
-
expanded?: boolean
|
|
34
|
-
show?: boolean
|
|
35
|
-
}>, props: Readonly<P & WithBannerAlertStateProps>) => {
|
|
36
|
-
expanded?: boolean
|
|
37
|
-
show?: boolean
|
|
38
|
-
} |
|
|
39
|
-
expanded?: boolean
|
|
40
|
-
show?: boolean
|
|
41
|
-
}
|
|
42
|
-
expanded?: boolean
|
|
43
|
-
show?: boolean
|
|
26
|
+
expanded?: boolean;
|
|
27
|
+
show?: boolean;
|
|
28
|
+
}>, props: Readonly<P & WithBannerAlertStateProps>) => Pick<{
|
|
29
|
+
expanded?: boolean;
|
|
30
|
+
show?: boolean;
|
|
31
|
+
}, K> | {
|
|
32
|
+
expanded?: boolean;
|
|
33
|
+
show?: boolean;
|
|
34
|
+
} | null) | Pick<{
|
|
35
|
+
expanded?: boolean;
|
|
36
|
+
show?: boolean;
|
|
44
37
|
}, K> | null, callback?: (() => void) | undefined): void;
|
|
45
38
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
46
39
|
readonly props: Readonly<P & WithBannerAlertStateProps> & Readonly<{
|
|
47
|
-
children?: import("react").ReactNode;
|
|
40
|
+
children?: import("react").ReactNode | undefined;
|
|
48
41
|
}>;
|
|
49
42
|
state: Readonly<{
|
|
50
|
-
expanded?: boolean
|
|
51
|
-
show?: boolean
|
|
43
|
+
expanded?: boolean;
|
|
44
|
+
show?: boolean;
|
|
52
45
|
}>;
|
|
53
46
|
refs: {
|
|
54
47
|
[key: string]: import("react").ReactInstance;
|
|
55
48
|
};
|
|
56
49
|
shouldComponentUpdate?(nextProps: Readonly<P & WithBannerAlertStateProps>, nextState: Readonly<{
|
|
57
|
-
expanded?: boolean
|
|
58
|
-
show?: boolean
|
|
50
|
+
expanded?: boolean;
|
|
51
|
+
show?: boolean;
|
|
59
52
|
}>, nextContext: any): boolean;
|
|
60
53
|
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
61
54
|
getSnapshotBeforeUpdate?(prevProps: Readonly<P & WithBannerAlertStateProps>, prevState: Readonly<{
|
|
62
|
-
expanded?: boolean
|
|
63
|
-
show?: boolean
|
|
64
|
-
}>): any;
|
|
55
|
+
expanded?: boolean;
|
|
56
|
+
show?: boolean;
|
|
57
|
+
}>): any | null;
|
|
65
58
|
componentDidUpdate?(prevProps: Readonly<P & WithBannerAlertStateProps>, prevState: Readonly<{
|
|
66
|
-
expanded?: boolean
|
|
67
|
-
show?: boolean
|
|
59
|
+
expanded?: boolean;
|
|
60
|
+
show?: boolean;
|
|
68
61
|
}>, snapshot?: any): void;
|
|
69
62
|
componentWillMount?(): void;
|
|
70
63
|
UNSAFE_componentWillMount?(): void;
|
|
71
64
|
componentWillReceiveProps?(nextProps: Readonly<P & WithBannerAlertStateProps>, nextContext: any): void;
|
|
72
65
|
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P & WithBannerAlertStateProps>, nextContext: any): void;
|
|
73
66
|
componentWillUpdate?(nextProps: Readonly<P & WithBannerAlertStateProps>, nextState: Readonly<{
|
|
74
|
-
expanded?: boolean
|
|
75
|
-
show?: boolean
|
|
67
|
+
expanded?: boolean;
|
|
68
|
+
show?: boolean;
|
|
76
69
|
}>, nextContext: any): void;
|
|
77
70
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<P & WithBannerAlertStateProps>, nextState: Readonly<{
|
|
78
|
-
expanded?: boolean
|
|
79
|
-
show?: boolean
|
|
71
|
+
expanded?: boolean;
|
|
72
|
+
show?: boolean;
|
|
80
73
|
}>, nextContext: any): void;
|
|
81
74
|
};
|
|
82
75
|
displayName: string;
|
|
@@ -35,10 +35,10 @@ declare const withOpenEvents: <P extends object>(WithOpenEventsInputComponent: C
|
|
|
35
35
|
handleBlur: () => void;
|
|
36
36
|
render(): ReactElement;
|
|
37
37
|
context: any;
|
|
38
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P & import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Omit<EventHandlers, "aria-readonly" | "readOnly"> & WithOpenEventsProps>) =>
|
|
38
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P & import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Omit<EventHandlers, "aria-readonly" | "readOnly"> & WithOpenEventsProps>) => Pick<{}, K> | {} | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
39
39
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
40
40
|
readonly props: Readonly<P & import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Omit<EventHandlers, "aria-readonly" | "readOnly"> & WithOpenEventsProps> & Readonly<{
|
|
41
|
-
children?: import("react").ReactNode;
|
|
41
|
+
children?: import("react").ReactNode | undefined;
|
|
42
42
|
}>;
|
|
43
43
|
state: Readonly<{}>;
|
|
44
44
|
refs: {
|
|
@@ -48,7 +48,7 @@ declare const withOpenEvents: <P extends object>(WithOpenEventsInputComponent: C
|
|
|
48
48
|
shouldComponentUpdate?(nextProps: Readonly<P & import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Omit<EventHandlers, "aria-readonly" | "readOnly"> & WithOpenEventsProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
49
49
|
componentWillUnmount?(): void;
|
|
50
50
|
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
51
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<P & import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Omit<EventHandlers, "aria-readonly" | "readOnly"> & WithOpenEventsProps>, prevState: Readonly<{}>): any;
|
|
51
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<P & import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Omit<EventHandlers, "aria-readonly" | "readOnly"> & WithOpenEventsProps>, prevState: Readonly<{}>): any | null;
|
|
52
52
|
componentDidUpdate?(prevProps: Readonly<P & import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Omit<EventHandlers, "aria-readonly" | "readOnly"> & WithOpenEventsProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
53
53
|
componentWillMount?(): void;
|
|
54
54
|
UNSAFE_componentWillMount?(): void;
|
|
@@ -6,10 +6,10 @@ declare const updateOnDirectionChange: (EnhancedComponent: ComponentType<any> |
|
|
|
6
6
|
onDirectionChange: () => void;
|
|
7
7
|
render(): JSX.Element;
|
|
8
8
|
context: any;
|
|
9
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) =>
|
|
9
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => Pick<{}, K> | {} | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
10
10
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
11
11
|
readonly props: Readonly<{}> & Readonly<{
|
|
12
|
-
children?: import("react").ReactNode;
|
|
12
|
+
children?: import("react").ReactNode | undefined;
|
|
13
13
|
}>;
|
|
14
14
|
state: Readonly<{}>;
|
|
15
15
|
refs: {
|
|
@@ -17,7 +17,7 @@ declare const updateOnDirectionChange: (EnhancedComponent: ComponentType<any> |
|
|
|
17
17
|
};
|
|
18
18
|
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
19
19
|
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
20
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
|
|
20
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any | null;
|
|
21
21
|
componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
22
22
|
componentWillMount?(): void;
|
|
23
23
|
UNSAFE_componentWillMount?(): void;
|
|
@@ -32,10 +32,10 @@ declare const updateOnDirectionChange: (EnhancedComponent: ComponentType<any> |
|
|
|
32
32
|
onDirectionChange: () => void;
|
|
33
33
|
render(): JSX.Element;
|
|
34
34
|
context: any;
|
|
35
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) =>
|
|
35
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => Pick<{}, K> | {} | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
36
36
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
37
37
|
readonly props: Readonly<{}> & Readonly<{
|
|
38
|
-
children?: import("react").ReactNode;
|
|
38
|
+
children?: import("react").ReactNode | undefined;
|
|
39
39
|
}>;
|
|
40
40
|
state: Readonly<{}>;
|
|
41
41
|
refs: {
|
|
@@ -43,7 +43,7 @@ declare const updateOnDirectionChange: (EnhancedComponent: ComponentType<any> |
|
|
|
43
43
|
};
|
|
44
44
|
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
45
45
|
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
46
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
|
|
46
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any | null;
|
|
47
47
|
componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
48
48
|
componentWillMount?(): void;
|
|
49
49
|
UNSAFE_componentWillMount?(): void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
declare const _default: {
|
|
3
2
|
new (props: Omit<import("../../bpk-component-calendar/src/composeCalendar").Props & import("../../bpk-component-calendar/src/BpkCalendarContainer").Props, keyof {
|
|
4
3
|
onDateClick: ((date: Date) => void) | null;
|
|
@@ -47,13 +46,13 @@ declare const _default: {
|
|
|
47
46
|
maxDate: Date;
|
|
48
47
|
}> & {
|
|
49
48
|
[rest: string]: any;
|
|
50
|
-
}>) => {
|
|
49
|
+
}>) => Pick<{
|
|
51
50
|
preventKeyboardFocus: boolean;
|
|
52
51
|
focusedDate: Date;
|
|
53
|
-
} |
|
|
52
|
+
}, K> | {
|
|
54
53
|
preventKeyboardFocus: boolean;
|
|
55
54
|
focusedDate: Date;
|
|
56
|
-
}
|
|
55
|
+
} | null) | Pick<{
|
|
57
56
|
preventKeyboardFocus: boolean;
|
|
58
57
|
focusedDate: Date;
|
|
59
58
|
}, K> | null, callback?: (() => void) | undefined): void;
|
|
@@ -67,7 +66,7 @@ declare const _default: {
|
|
|
67
66
|
}> & {
|
|
68
67
|
[rest: string]: any;
|
|
69
68
|
}> & Readonly<{
|
|
70
|
-
children?: import("react").ReactNode;
|
|
69
|
+
children?: import("react").ReactNode | undefined;
|
|
71
70
|
}>;
|
|
72
71
|
state: Readonly<{
|
|
73
72
|
preventKeyboardFocus: boolean;
|
|
@@ -102,7 +101,7 @@ declare const _default: {
|
|
|
102
101
|
}>, prevState: Readonly<{
|
|
103
102
|
preventKeyboardFocus: boolean;
|
|
104
103
|
focusedDate: Date;
|
|
105
|
-
}>): any;
|
|
104
|
+
}>): any | null;
|
|
106
105
|
componentDidUpdate?(prevProps: Readonly<Omit<import("../../bpk-component-calendar/src/composeCalendar").Props & import("../../bpk-component-calendar/src/BpkCalendarContainer").Props, keyof {
|
|
107
106
|
onDateClick: ((date: Date) => void) | null;
|
|
108
107
|
onDateKeyDown: ((event: KeyboardEvent) => void) | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 BpkSnippet, { BODY_STYLE, BUTTON_STYLE, DESKTOP_LAYOUT, HEADLINE_STYLE, IMAGE_ORIENTATION } from "./src/BpkSnippet";
|
|
20
|
+
export default BpkSnippet;
|
|
21
|
+
export { BODY_STYLE, BUTTON_STYLE, DESKTOP_LAYOUT, HEADLINE_STYLE, IMAGE_ORIENTATION };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { MouseEvent } from 'react';
|
|
2
|
+
export declare const BODY_STYLE: {
|
|
3
|
+
readonly bodyDefault: "body-default";
|
|
4
|
+
readonly bodyLongform: "body-longform";
|
|
5
|
+
};
|
|
6
|
+
export declare const BUTTON_STYLE: {
|
|
7
|
+
readonly primary: "primary";
|
|
8
|
+
readonly featured: "featured";
|
|
9
|
+
};
|
|
10
|
+
export declare const HEADLINE_STYLE: {
|
|
11
|
+
readonly heading1: "heading-1";
|
|
12
|
+
readonly heading2: "heading-2";
|
|
13
|
+
readonly heading3: "heading-3";
|
|
14
|
+
readonly heading4: "heading-4";
|
|
15
|
+
readonly heading5: "heading-5";
|
|
16
|
+
readonly hero1: "hero-1";
|
|
17
|
+
readonly hero2: "hero-2";
|
|
18
|
+
readonly hero3: "hero-3";
|
|
19
|
+
readonly hero4: "hero-4";
|
|
20
|
+
readonly hero5: "hero-5";
|
|
21
|
+
};
|
|
22
|
+
export declare const DESKTOP_LAYOUT: {
|
|
23
|
+
readonly imageLeft: "imageLeft";
|
|
24
|
+
readonly imageRight: "imageRight";
|
|
25
|
+
readonly vertical: "vertical";
|
|
26
|
+
};
|
|
27
|
+
export declare const IMAGE_ORIENTATION: {
|
|
28
|
+
readonly landscape: "landscape";
|
|
29
|
+
readonly portrait: "portrait";
|
|
30
|
+
readonly square: "square";
|
|
31
|
+
};
|
|
32
|
+
export type Props = {
|
|
33
|
+
src: string;
|
|
34
|
+
altText: string;
|
|
35
|
+
headline?: string | null;
|
|
36
|
+
subheading?: string | null;
|
|
37
|
+
bodyText?: string | null;
|
|
38
|
+
buttonText?: string | null;
|
|
39
|
+
bodyStyle?: (typeof BODY_STYLE)[keyof typeof BODY_STYLE];
|
|
40
|
+
buttonStyle?: (typeof BUTTON_STYLE)[keyof typeof BUTTON_STYLE];
|
|
41
|
+
headlineStyle?: (typeof HEADLINE_STYLE)[keyof typeof HEADLINE_STYLE];
|
|
42
|
+
desktopLayout?: (typeof DESKTOP_LAYOUT)[keyof typeof DESKTOP_LAYOUT];
|
|
43
|
+
imageOrientation?: (typeof IMAGE_ORIENTATION)[keyof typeof IMAGE_ORIENTATION];
|
|
44
|
+
imageRadius?: boolean;
|
|
45
|
+
onClick?: (event: MouseEvent<HTMLButtonElement & HTMLAnchorElement>) => void;
|
|
46
|
+
};
|
|
47
|
+
declare const BpkSnippet: ({ altText, bodyStyle, bodyText, buttonStyle, buttonText, desktopLayout, headline, headlineStyle, imageOrientation, imageRadius, onClick, src, subheading, }: Props) => JSX.Element;
|
|
48
|
+
export default BpkSnippet;
|
|
@@ -0,0 +1,131 @@
|
|
|
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 BpkBreakpoint, { BREAKPOINTS } from "../../bpk-component-breakpoint";
|
|
20
|
+
import { BpkButtonV2, BUTTON_TYPES } from "../../bpk-component-button";
|
|
21
|
+
import BpkImage, { BORDER_RADIUS_STYLES, withLazyLoading } from "../../bpk-component-image";
|
|
22
|
+
import BpkText, { TEXT_STYLES } from "../../bpk-component-text/src/BpkText";
|
|
23
|
+
import { cssModules } from "../../bpk-react-utils";
|
|
24
|
+
import STYLES from "./BpkSnippet.module.css";
|
|
25
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
+
const getClassName = cssModules(STYLES);
|
|
27
|
+
export const BODY_STYLE = {
|
|
28
|
+
bodyDefault: TEXT_STYLES.bodyDefault,
|
|
29
|
+
bodyLongform: TEXT_STYLES.bodyLongform
|
|
30
|
+
};
|
|
31
|
+
export const BUTTON_STYLE = {
|
|
32
|
+
primary: BUTTON_TYPES.primary,
|
|
33
|
+
featured: BUTTON_TYPES.featured
|
|
34
|
+
};
|
|
35
|
+
export const HEADLINE_STYLE = {
|
|
36
|
+
heading1: TEXT_STYLES.heading1,
|
|
37
|
+
heading2: TEXT_STYLES.heading2,
|
|
38
|
+
heading3: TEXT_STYLES.heading3,
|
|
39
|
+
heading4: TEXT_STYLES.heading4,
|
|
40
|
+
heading5: TEXT_STYLES.heading5,
|
|
41
|
+
hero1: TEXT_STYLES.hero1,
|
|
42
|
+
hero2: TEXT_STYLES.hero2,
|
|
43
|
+
hero3: TEXT_STYLES.hero3,
|
|
44
|
+
hero4: TEXT_STYLES.hero4,
|
|
45
|
+
hero5: TEXT_STYLES.hero5
|
|
46
|
+
};
|
|
47
|
+
export const DESKTOP_LAYOUT = {
|
|
48
|
+
imageLeft: 'imageLeft',
|
|
49
|
+
imageRight: 'imageRight',
|
|
50
|
+
vertical: 'vertical'
|
|
51
|
+
};
|
|
52
|
+
export const IMAGE_ORIENTATION = {
|
|
53
|
+
landscape: 'landscape',
|
|
54
|
+
portrait: 'portrait',
|
|
55
|
+
square: 'square'
|
|
56
|
+
};
|
|
57
|
+
const documentIfExists = typeof window !== 'undefined' ? document : null;
|
|
58
|
+
const LazyLoadedImage = withLazyLoading(BpkImage, documentIfExists);
|
|
59
|
+
const getImageAspectRatio = imageOrientation => {
|
|
60
|
+
let imageAspectRatio;
|
|
61
|
+
switch (imageOrientation) {
|
|
62
|
+
case 'landscape':
|
|
63
|
+
imageAspectRatio = 3 / 2;
|
|
64
|
+
break;
|
|
65
|
+
case 'square':
|
|
66
|
+
imageAspectRatio = 1;
|
|
67
|
+
break;
|
|
68
|
+
case 'portrait':
|
|
69
|
+
imageAspectRatio = 5 / 7;
|
|
70
|
+
break;
|
|
71
|
+
default:
|
|
72
|
+
imageAspectRatio = 3 / 2;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
return imageAspectRatio;
|
|
76
|
+
};
|
|
77
|
+
const BpkSnippet = ({
|
|
78
|
+
altText,
|
|
79
|
+
bodyStyle = BODY_STYLE.bodyDefault,
|
|
80
|
+
bodyText,
|
|
81
|
+
buttonStyle = BUTTON_STYLE.primary,
|
|
82
|
+
buttonText,
|
|
83
|
+
desktopLayout = DESKTOP_LAYOUT.imageLeft,
|
|
84
|
+
headline,
|
|
85
|
+
headlineStyle = HEADLINE_STYLE.hero5,
|
|
86
|
+
imageOrientation,
|
|
87
|
+
imageRadius = true,
|
|
88
|
+
onClick,
|
|
89
|
+
src,
|
|
90
|
+
subheading
|
|
91
|
+
}) => /*#__PURE__*/_jsx(BpkBreakpoint, {
|
|
92
|
+
query: BREAKPOINTS.MOBILE,
|
|
93
|
+
children: isMobile => /*#__PURE__*/_jsxs("div", {
|
|
94
|
+
className: getClassName('bpk-snippet', desktopLayout === 'imageRight' && 'bpk-snippet--row-reverse', desktopLayout === 'vertical' && 'bpk-snippet--vertical'),
|
|
95
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
96
|
+
className: getClassName('bpk-snippet--image', desktopLayout === 'vertical' ? 'bpk-snippet--vertical--container' : 'bpk-snippet--container'),
|
|
97
|
+
children: /*#__PURE__*/_jsx(LazyLoadedImage, {
|
|
98
|
+
altText: altText,
|
|
99
|
+
aspectRatio: getImageAspectRatio(imageOrientation),
|
|
100
|
+
borderRadiusStyle: imageRadius ? BORDER_RADIUS_STYLES.sm : BORDER_RADIUS_STYLES.none,
|
|
101
|
+
src: src
|
|
102
|
+
})
|
|
103
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
104
|
+
className: desktopLayout === 'vertical' ? getClassName('bpk-snippet--vertical--container', 'bpk-snippet--vertical--content') : getClassName('bpk-snippet--container', 'bpk-snippet--content'),
|
|
105
|
+
children: [headline && /*#__PURE__*/_jsx("div", {
|
|
106
|
+
className: getClassName('bpk-snippet--headline'),
|
|
107
|
+
children: /*#__PURE__*/_jsx(BpkText, {
|
|
108
|
+
textStyle: isMobile ? HEADLINE_STYLE.heading4 : headlineStyle,
|
|
109
|
+
children: headline
|
|
110
|
+
})
|
|
111
|
+
}), subheading && /*#__PURE__*/_jsx("div", {
|
|
112
|
+
className: getClassName('bpk-snippet--subheading'),
|
|
113
|
+
children: /*#__PURE__*/_jsx(BpkText, {
|
|
114
|
+
textStyle: TEXT_STYLES.subheading,
|
|
115
|
+
children: subheading
|
|
116
|
+
})
|
|
117
|
+
}), bodyText && /*#__PURE__*/_jsx("div", {
|
|
118
|
+
className: getClassName('bpk-snippet--bodyText'),
|
|
119
|
+
children: /*#__PURE__*/_jsx(BpkText, {
|
|
120
|
+
textStyle: isMobile ? BODY_STYLE.bodyDefault : bodyStyle,
|
|
121
|
+
children: bodyText
|
|
122
|
+
})
|
|
123
|
+
}), buttonText && onClick && /*#__PURE__*/_jsx(BpkButtonV2, {
|
|
124
|
+
type: buttonStyle,
|
|
125
|
+
onClick: onClick,
|
|
126
|
+
children: buttonText
|
|
127
|
+
})]
|
|
128
|
+
})]
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
export default BpkSnippet;
|
|
@@ -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-snippet{display:flex;flex-direction:row;align-items:center}@media(max-width: 48rem){.bpk-snippet{flex-direction:column;gap:1rem}}.bpk-snippet--row-reverse{flex-direction:row-reverse}@media(max-width: 48rem){.bpk-snippet--row-reverse{flex-direction:column;gap:1rem}}.bpk-snippet--vertical{flex-direction:column;gap:1rem}.bpk-snippet--vertical--container{width:100%}.bpk-snippet--vertical--content{padding:0}.bpk-snippet--container{width:50%}@media(max-width: 48rem){.bpk-snippet--container{width:100%}}.bpk-snippet--image img{height:100%;object-fit:cover}.bpk-snippet--content{display:flex;padding:4rem;flex-direction:column;justify-content:center;align-items:flex-start}@media(max-width: 48rem){.bpk-snippet--content{padding:0}}.bpk-snippet--headline,.bpk-snippet--subheading,.bpk-snippet--bodyText{padding-bottom:1rem}@media(max-width: 48rem){.bpk-snippet--headline,.bpk-snippet--subheading,.bpk-snippet--bodyText{padding-bottom:.5rem}}
|
|
@@ -37,6 +37,7 @@ class BpkInputField extends Component {
|
|
|
37
37
|
id,
|
|
38
38
|
index,
|
|
39
39
|
label,
|
|
40
|
+
name,
|
|
40
41
|
value,
|
|
41
42
|
...rest
|
|
42
43
|
} = this.props;
|
|
@@ -51,6 +52,7 @@ class BpkInputField extends Component {
|
|
|
51
52
|
this.input = input;
|
|
52
53
|
},
|
|
53
54
|
value: value || '',
|
|
55
|
+
name: name || '',
|
|
54
56
|
...rest
|
|
55
57
|
})
|
|
56
58
|
}, index);
|
|
@@ -61,7 +63,8 @@ BpkInputField.propTypes = {
|
|
|
61
63
|
label: PropTypes.string.isRequired,
|
|
62
64
|
value: PropTypes.string,
|
|
63
65
|
focus: PropTypes.bool.isRequired,
|
|
64
|
-
index: PropTypes.number.isRequired
|
|
66
|
+
index: PropTypes.number.isRequired,
|
|
67
|
+
name: PropTypes.string
|
|
65
68
|
};
|
|
66
69
|
BpkInputField.defaultProps = {
|
|
67
70
|
value: ''
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { BpkDialogWrapper } from './src/BpkDialogWrapper/BpkDialogWrapper';
|
|
3
2
|
import Portal from './src/Portal';
|
|
4
3
|
import TransitionInitialMount from './src/TransitionInitialMount';
|
|
@@ -16,24 +15,24 @@ declare const _default: {
|
|
|
16
15
|
appearClassName: string;
|
|
17
16
|
appearActiveClassName: string;
|
|
18
17
|
transitionTimeout: number;
|
|
19
|
-
children: import("react").ReactNode;
|
|
18
|
+
children: string | import("react").ReactNode;
|
|
20
19
|
}) => JSX.Element;
|
|
21
20
|
cssModules: (styles?: {
|
|
22
21
|
[key: string]: any;
|
|
23
|
-
}) => (...classNames:
|
|
22
|
+
}) => (...classNames: Array<string | boolean | number | {} | null | undefined>) => string;
|
|
24
23
|
deprecated: any;
|
|
25
24
|
withDefaultProps: (WrappedComponent: import("react").ComponentType<any>, defaultProps: {
|
|
26
25
|
[rest: string]: any;
|
|
27
|
-
className?: string
|
|
26
|
+
className?: string;
|
|
28
27
|
}) => {
|
|
29
28
|
({ children, className: innerClassName, ...rest }: {
|
|
30
29
|
[rest: string]: any;
|
|
31
|
-
children?: import("react").ReactNode;
|
|
32
|
-
className?: string | null
|
|
30
|
+
children?: import("react").ReactNode | string;
|
|
31
|
+
className?: string | null;
|
|
33
32
|
}): JSX.Element;
|
|
34
33
|
displayName: string;
|
|
35
34
|
};
|
|
36
|
-
wrapDisplayName: (Component:
|
|
35
|
+
wrapDisplayName: (Component: import("react").ComponentType<any> | string | null, hoc: string) => string;
|
|
37
36
|
isDeviceIphone: () => boolean;
|
|
38
37
|
isDeviceIpad: () => boolean;
|
|
39
38
|
isDeviceIos: () => boolean;
|