@skyscanner/backpack-web 29.4.0 → 29.4.2
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/withBannerAlertState.d.ts +86 -143
- package/bpk-component-barchart/src/BpkBarchart.js +24 -2
- package/bpk-component-barchart/src/BpkChartAxis.js +2 -2
- package/bpk-component-breakpoint/src/BpkBreakpoint.d.ts +3 -0
- package/bpk-component-button/index.js +1 -1
- package/bpk-component-button/src/BpkButtonV2/BpkButton.d.ts +1 -16
- package/bpk-component-button/src/BpkButtonV2/BpkButton.js +4 -3
- package/bpk-component-calendar/index.d.ts +1 -1
- package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +21 -331
- package/bpk-component-calendar/src/BpkCalendarDate.d.ts +8 -1
- package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +15 -0
- package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +9 -0
- package/bpk-component-calendar/src/BpkCalendarNav.d.ts +4 -0
- package/bpk-component-calendar/src/composeCalendar.d.ts +42 -1
- package/bpk-component-card-button/src/BpkSaveButton.js +1 -1
- package/bpk-component-chip/src/BpkDismissibleChip.d.ts +2 -7
- package/bpk-component-datatable/src/BpkDataTable.js +50 -1
- package/bpk-component-datepicker/src/BpkDatepicker.d.ts +25 -461
- package/bpk-component-dialog/src/common-types.d.ts +12 -0
- package/bpk-component-drawer/src/BpkDrawer.js +24 -4
- package/bpk-component-fieldset/src/BpkFieldset.js +3 -0
- package/bpk-component-floating-notification/src/BpkFloatingNotification.module.css +1 -1
- package/bpk-component-graphic-promotion/src/BpkGraphicPromo.d.ts +23 -31
- package/bpk-component-horizontal-nav/src/BpkHorizontalNav.js +24 -17
- package/bpk-component-horizontal-nav/src/BpkHorizontalNavItem.js +25 -17
- package/bpk-component-image/src/BpkImage.d.ts +4 -1
- package/bpk-component-input/src/common-types.d.ts +17 -3
- package/bpk-component-input/src/common-types.js +7 -0
- package/bpk-component-input/src/withOpenEvents.d.ts +13 -1
- package/bpk-component-list/src/BpkList.js +4 -1
- package/bpk-component-map/index.js +1 -1
- package/bpk-component-map/src/BpkMap.js +6 -0
- package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.d.ts +21 -32
- package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.js +2 -3
- package/bpk-component-mobile-scroll-container/src/BpkMobileScrollContainer.js +25 -20
- package/bpk-component-modal/src/BpkModal.d.ts +7 -1
- package/bpk-component-modal/src/BpkModalInner.d.ts +4 -1
- package/bpk-component-navigation-bar/src/BpkNavigationBar.js +1 -0
- package/bpk-component-nudger/src/BpkConfigurableNudger.d.ts +16 -0
- package/bpk-component-nudger/src/common-types.d.ts +17 -1
- package/bpk-component-nudger/src/common-types.js +22 -1
- package/bpk-component-overlay/src/BpkOverlay.d.ts +8 -3
- package/bpk-component-popover/src/BpkPopoverPortal.js +50 -24
- package/bpk-component-progress/src/BpkProgress.js +25 -19
- package/bpk-component-select/src/BpkSelect.js +7 -5
- package/bpk-component-tooltip/src/BpkTooltipPortal.d.ts +12 -0
- package/package.json +1 -1
|
@@ -16,39 +16,31 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
/// <reference types="react" />
|
|
19
20
|
export declare const TEXT_ALIGN: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
readonly start: "start";
|
|
22
|
+
readonly center: "center";
|
|
23
|
+
readonly end: "end";
|
|
23
24
|
};
|
|
24
25
|
export type Props = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
className?: string | null;
|
|
27
|
+
contentId?: string | null;
|
|
28
|
+
tagline?: string | null;
|
|
29
|
+
headline: string;
|
|
30
|
+
subheading?: string | null;
|
|
31
|
+
/**
|
|
32
|
+
* An object that groups together all the sponsor related properties. This should only be provided if the graphic promo is sponsored, in which case all of the object's properties are required.
|
|
33
|
+
*/
|
|
34
|
+
sponsor?: {
|
|
35
|
+
label: string;
|
|
36
|
+
logo: string;
|
|
37
|
+
altText: string;
|
|
38
|
+
} | null;
|
|
39
|
+
buttonText: string;
|
|
40
|
+
onClick: () => void;
|
|
41
|
+
invertVertically?: boolean;
|
|
42
|
+
textAlign: (typeof TEXT_ALIGN)[keyof typeof TEXT_ALIGN];
|
|
43
|
+
style?: {};
|
|
40
44
|
};
|
|
41
|
-
declare const BpkGraphicPromo: ({
|
|
42
|
-
buttonText,
|
|
43
|
-
className,
|
|
44
|
-
contentId,
|
|
45
|
-
headline,
|
|
46
|
-
invertVertically,
|
|
47
|
-
onClick,
|
|
48
|
-
sponsor,
|
|
49
|
-
style,
|
|
50
|
-
subheading,
|
|
51
|
-
tagline,
|
|
52
|
-
textAlign,
|
|
53
|
-
}: Props) => JSX.Element;
|
|
45
|
+
declare const BpkGraphicPromo: ({ buttonText, className, contentId, headline, invertVertically, onClick, sponsor, style, subheading, tagline, textAlign, }: Props) => JSX.Element;
|
|
54
46
|
export default BpkGraphicPromo;
|
|
@@ -33,23 +33,6 @@ const getPos = ref => {
|
|
|
33
33
|
return pos;
|
|
34
34
|
};
|
|
35
35
|
class BpkHorizontalNav extends Component {
|
|
36
|
-
static propTypes = {
|
|
37
|
-
children: PropTypes.node.isRequired,
|
|
38
|
-
autoScrollToSelected: PropTypes.bool,
|
|
39
|
-
className: PropTypes.string,
|
|
40
|
-
leadingScrollIndicatorClassName: PropTypes.string,
|
|
41
|
-
showUnderline: PropTypes.bool,
|
|
42
|
-
trailingScrollIndicatorClassName: PropTypes.string,
|
|
43
|
-
type: PropTypes.oneOf(Object.keys(HORIZONTAL_NAV_TYPES))
|
|
44
|
-
};
|
|
45
|
-
static defaultProps = {
|
|
46
|
-
autoScrollToSelected: false,
|
|
47
|
-
className: null,
|
|
48
|
-
leadingScrollIndicatorClassName: null,
|
|
49
|
-
showUnderline: true,
|
|
50
|
-
trailingScrollIndicatorClassName: null,
|
|
51
|
-
type: HORIZONTAL_NAV_TYPES.default
|
|
52
|
-
};
|
|
53
36
|
constructor(props) {
|
|
54
37
|
super(props);
|
|
55
38
|
this.scrollRef = null;
|
|
@@ -147,5 +130,29 @@ class BpkHorizontalNav extends Component {
|
|
|
147
130
|
);
|
|
148
131
|
}
|
|
149
132
|
}
|
|
133
|
+
BpkHorizontalNav.propTypes = {
|
|
134
|
+
children: PropTypes.node.isRequired,
|
|
135
|
+
/**
|
|
136
|
+
* Ensures that the selected item is within view when loaded on narrow-screened devices.
|
|
137
|
+
*/
|
|
138
|
+
autoScrollToSelected: PropTypes.bool,
|
|
139
|
+
className: PropTypes.string,
|
|
140
|
+
leadingScrollIndicatorClassName: PropTypes.string,
|
|
141
|
+
/**
|
|
142
|
+
* When set to "false", the bottom border on the component isn't included. This refers
|
|
143
|
+
* to the underline on the whole "BpkHorizontalNav", not the line that appears under the selected item.
|
|
144
|
+
*/
|
|
145
|
+
showUnderline: PropTypes.bool,
|
|
146
|
+
trailingScrollIndicatorClassName: PropTypes.string,
|
|
147
|
+
type: PropTypes.oneOf(Object.keys(HORIZONTAL_NAV_TYPES))
|
|
148
|
+
};
|
|
149
|
+
BpkHorizontalNav.defaultProps = {
|
|
150
|
+
autoScrollToSelected: false,
|
|
151
|
+
className: null,
|
|
152
|
+
leadingScrollIndicatorClassName: null,
|
|
153
|
+
showUnderline: true,
|
|
154
|
+
trailingScrollIndicatorClassName: null,
|
|
155
|
+
type: HORIZONTAL_NAV_TYPES.default
|
|
156
|
+
};
|
|
150
157
|
export default BpkHorizontalNav;
|
|
151
158
|
export { HORIZONTAL_NAV_TYPES };
|
|
@@ -25,23 +25,6 @@ const getClassName = cssModules(STYLES);
|
|
|
25
25
|
// React Component class.
|
|
26
26
|
// eslint-disable-next-line react/prefer-stateless-function
|
|
27
27
|
class BpkHorizontalNavItem extends Component {
|
|
28
|
-
static propTypes = {
|
|
29
|
-
children: PropTypes.node.isRequired,
|
|
30
|
-
className: PropTypes.string,
|
|
31
|
-
disabled: PropTypes.bool,
|
|
32
|
-
href: PropTypes.string,
|
|
33
|
-
selected: PropTypes.bool,
|
|
34
|
-
spaceAround: PropTypes.bool,
|
|
35
|
-
type: PropTypes.oneOf(Object.keys(HORIZONTAL_NAV_TYPES))
|
|
36
|
-
};
|
|
37
|
-
static defaultProps = {
|
|
38
|
-
className: null,
|
|
39
|
-
disabled: false,
|
|
40
|
-
href: null,
|
|
41
|
-
selected: false,
|
|
42
|
-
spaceAround: false,
|
|
43
|
-
type: HORIZONTAL_NAV_TYPES.default
|
|
44
|
-
};
|
|
45
28
|
render() {
|
|
46
29
|
const {
|
|
47
30
|
children,
|
|
@@ -84,6 +67,31 @@ class BpkHorizontalNavItem extends Component {
|
|
|
84
67
|
});
|
|
85
68
|
}
|
|
86
69
|
}
|
|
70
|
+
BpkHorizontalNavItem.propTypes = {
|
|
71
|
+
children: PropTypes.node.isRequired,
|
|
72
|
+
className: PropTypes.string,
|
|
73
|
+
/**
|
|
74
|
+
* **Note:**
|
|
75
|
+
* "disabled" and "selected" are mutually exclusive for true values, i.e. only one of them can be true for a given nav item.
|
|
76
|
+
*/
|
|
77
|
+
disabled: PropTypes.bool,
|
|
78
|
+
href: PropTypes.string,
|
|
79
|
+
/**
|
|
80
|
+
* **Note:**
|
|
81
|
+
* "disabled" and "selected" are mutually exclusive for true values, i.e. only one of them can be true for a given nav item.
|
|
82
|
+
*/
|
|
83
|
+
selected: PropTypes.bool,
|
|
84
|
+
spaceAround: PropTypes.bool,
|
|
85
|
+
type: PropTypes.oneOf(Object.keys(HORIZONTAL_NAV_TYPES))
|
|
86
|
+
};
|
|
87
|
+
BpkHorizontalNavItem.defaultProps = {
|
|
88
|
+
className: null,
|
|
89
|
+
disabled: false,
|
|
90
|
+
href: null,
|
|
91
|
+
selected: false,
|
|
92
|
+
spaceAround: false,
|
|
93
|
+
type: HORIZONTAL_NAV_TYPES.default
|
|
94
|
+
};
|
|
87
95
|
const themeAttributes = ['horizontalNavLinkColor', 'horizontalNavLinkHoverColor', 'horizontalNavLinkActiveColor', 'horizontalNavLinkSelectedColor', 'horizontalNavBarSelectedColor'];
|
|
88
96
|
export { themeAttributes };
|
|
89
97
|
export default BpkHorizontalNavItem;
|
|
@@ -21,10 +21,13 @@ import BORDER_RADIUS_STYLES from './BpkImageBorderRadiusStyles';
|
|
|
21
21
|
type BpkImageProps = {
|
|
22
22
|
altText: string;
|
|
23
23
|
src: string;
|
|
24
|
+
/**
|
|
25
|
+
* Note: The `aspectRatio` prop should be calculated as `width/height` of the original src image. It is used by the component to preserve space on screen while the image loads.
|
|
26
|
+
*/
|
|
24
27
|
aspectRatio: number;
|
|
25
28
|
inView?: boolean;
|
|
26
29
|
loading?: boolean;
|
|
27
|
-
borderRadiusStyle?: typeof BORDER_RADIUS_STYLES[keyof typeof BORDER_RADIUS_STYLES];
|
|
30
|
+
borderRadiusStyle?: (typeof BORDER_RADIUS_STYLES)[keyof typeof BORDER_RADIUS_STYLES];
|
|
28
31
|
className?: string;
|
|
29
32
|
onLoad?: (() => void) | null;
|
|
30
33
|
style?: {};
|
|
@@ -30,11 +30,22 @@ export declare const INPUT_TYPES: {
|
|
|
30
30
|
readonly password: "password";
|
|
31
31
|
readonly tel: "tel";
|
|
32
32
|
};
|
|
33
|
-
type
|
|
33
|
+
type InputProps = {
|
|
34
|
+
/**
|
|
35
|
+
* **Required:** The id attribute of the input.
|
|
36
|
+
*/
|
|
34
37
|
id: string;
|
|
38
|
+
/**
|
|
39
|
+
* **Required:** The name attribute of the input.
|
|
40
|
+
*/
|
|
35
41
|
name: string;
|
|
42
|
+
/**
|
|
43
|
+
* **Required:** The value attribute of the input.
|
|
44
|
+
*/
|
|
36
45
|
value: string;
|
|
37
|
-
type?: typeof INPUT_TYPES[keyof typeof INPUT_TYPES];
|
|
46
|
+
type?: (typeof INPUT_TYPES)[keyof typeof INPUT_TYPES];
|
|
47
|
+
};
|
|
48
|
+
type BaseProps = InputProps & ComponentProps<'input'> & {
|
|
38
49
|
valid?: boolean | null;
|
|
39
50
|
large?: boolean;
|
|
40
51
|
docked?: boolean;
|
|
@@ -49,7 +60,10 @@ export type PropsWithoutClearButonMode = BaseProps & {
|
|
|
49
60
|
onClear?: ((e?: SyntheticEvent<HTMLButtonElement>) => void) | null;
|
|
50
61
|
};
|
|
51
62
|
export type PropsWithClearButtonMode = BaseProps & {
|
|
52
|
-
|
|
63
|
+
/**
|
|
64
|
+
* When `clearButtonMode` is set to `always`, validity icons will not appear.
|
|
65
|
+
*/
|
|
66
|
+
clearButtonMode: (typeof CLEAR_BUTTON_MODES)[keyof Omit<typeof CLEAR_BUTTON_MODES, 'never'>];
|
|
53
67
|
clearButtonLabel: string;
|
|
54
68
|
onClear: (e?: SyntheticEvent<HTMLButtonElement>) => void;
|
|
55
69
|
};
|
|
@@ -29,6 +29,9 @@ export const INPUT_TYPES = {
|
|
|
29
29
|
password: 'password',
|
|
30
30
|
tel: 'tel'
|
|
31
31
|
};
|
|
32
|
+
|
|
33
|
+
// Declaring this type here as react docgen gets confused and reads them as native input types
|
|
34
|
+
|
|
32
35
|
// TODO - this function should be removed once all input examples have been migrated to TS
|
|
33
36
|
export const clearablePropType = (props, propName, componentName) => {
|
|
34
37
|
const createError = message => new Error(`Invalid prop \`${propName}\` supplied to \`${componentName}\`. ${message}.`);
|
|
@@ -48,6 +51,8 @@ export const clearablePropType = (props, propName, componentName) => {
|
|
|
48
51
|
}
|
|
49
52
|
return null;
|
|
50
53
|
};
|
|
54
|
+
|
|
55
|
+
// TODO - this should be removed once all input examples have been migrated to TS
|
|
51
56
|
export const propTypes = {
|
|
52
57
|
id: PropTypes.string.isRequired,
|
|
53
58
|
name: PropTypes.string.isRequired,
|
|
@@ -65,6 +70,8 @@ export const propTypes = {
|
|
|
65
70
|
clearButtonLabel: clearablePropType,
|
|
66
71
|
onClear: clearablePropType
|
|
67
72
|
};
|
|
73
|
+
|
|
74
|
+
// TODO - this should be removed once all input examples have been migrated to TS
|
|
68
75
|
export const defaultProps = {
|
|
69
76
|
type: INPUT_TYPES.text,
|
|
70
77
|
valid: null,
|
|
@@ -17,8 +17,20 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import type { ComponentType, ReactElement, UIEvent, ComponentProps } from 'react';
|
|
20
|
-
type WithOpenEventsProps = {
|
|
20
|
+
export type WithOpenEventsProps = {
|
|
21
|
+
/**
|
|
22
|
+
* It is important you pass the `isOpen` prop, as it is necessary to work around an IE bug.
|
|
23
|
+
*/
|
|
21
24
|
isOpen?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The onOpen callback is called on the following events:
|
|
27
|
+
* click
|
|
28
|
+
* focus
|
|
29
|
+
* touchend
|
|
30
|
+
* keydown (Enter key)
|
|
31
|
+
* keyup (Space key)
|
|
32
|
+
* You can still attach custom handlers for these events as they will still be called. All other key events are prevented.
|
|
33
|
+
*/
|
|
22
34
|
onOpen?: () => void;
|
|
23
35
|
hasTouchSupport?: boolean;
|
|
24
36
|
};
|
|
@@ -41,7 +41,10 @@ const BpkList = props => {
|
|
|
41
41
|
BpkList.propTypes = {
|
|
42
42
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
43
43
|
ordered: PropTypes.bool,
|
|
44
|
-
className: PropTypes.string
|
|
44
|
+
className: PropTypes.string,
|
|
45
|
+
ariaLabel: PropTypes.string,
|
|
46
|
+
ariaLabelledby: PropTypes.string,
|
|
47
|
+
title: PropTypes.string
|
|
45
48
|
};
|
|
46
49
|
BpkList.defaultProps = {
|
|
47
50
|
ordered: false,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/import BpkMap from "./src/BpkMap";
|
|
18
18
|
import BpkIconMarker from "./src/BpkIconMarker";
|
|
19
19
|
import BpkPriceMarker, { PRICE_MARKER_STATUSES } from "./src/BpkPriceMarker";
|
|
20
|
-
import BpkPriceMarkerV2,
|
|
20
|
+
import { BpkPriceMarkerV2, MARKER_STATUSES } from "./src/BpkPriceMarkerV2/BpkPriceMarker";
|
|
21
21
|
import BpkOverlayView from "./src/BpkOverlayView";
|
|
22
22
|
import withGoogleMapsScript from "./src/withGoogleMapsScript";
|
|
23
23
|
import { defaultIconMarkerThemeAttributes, priceMarkerThemeAttributes } from "./src/themeAttributes";
|
|
@@ -106,12 +106,18 @@ const BpkMap = props => {
|
|
|
106
106
|
});
|
|
107
107
|
};
|
|
108
108
|
BpkMap.propTypes = {
|
|
109
|
+
/**
|
|
110
|
+
* Note: One of `bounds` and `center` must be provided.
|
|
111
|
+
*/
|
|
109
112
|
bounds: PropTypes.shape({
|
|
110
113
|
south: PropTypes.number.isRequired,
|
|
111
114
|
west: PropTypes.number.isRequired,
|
|
112
115
|
north: PropTypes.number.isRequired,
|
|
113
116
|
east: PropTypes.number.isRequired
|
|
114
117
|
}),
|
|
118
|
+
/**
|
|
119
|
+
* Note: One of `bounds` and `center` must be provided.
|
|
120
|
+
*/
|
|
115
121
|
center: LatLongPropType,
|
|
116
122
|
children: PropTypes.node,
|
|
117
123
|
greedyGestureHandling: PropTypes.bool,
|
|
@@ -15,39 +15,28 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
import type { Node } from 'react';
|
|
19
|
-
import { MouseEvent, ReactNode } from 'react';
|
|
20
|
-
|
|
21
|
-
export const MARKER_STATUSES = {
|
|
22
|
-
unselected: 'unselected',
|
|
23
|
-
selected: 'selected',
|
|
24
|
-
previous_selected: 'previous_selected',
|
|
25
|
-
} as const;
|
|
26
18
|
|
|
19
|
+
import type { MouseEvent, ReactNode } from 'react';
|
|
20
|
+
export declare const MARKER_STATUSES: {
|
|
21
|
+
readonly unselected: "unselected";
|
|
22
|
+
readonly selected: "selected";
|
|
23
|
+
readonly previous_selected: "previous_selected";
|
|
24
|
+
};
|
|
27
25
|
export type Status = (typeof MARKER_STATUSES)[keyof typeof MARKER_STATUSES];
|
|
28
|
-
|
|
29
26
|
type Props = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
label: string;
|
|
28
|
+
icon?: ReactNode;
|
|
29
|
+
accessibilityLabel: string;
|
|
30
|
+
position: {
|
|
31
|
+
latitude: number;
|
|
32
|
+
longitude: number;
|
|
33
|
+
};
|
|
34
|
+
className?: string;
|
|
35
|
+
onClick?: (event: MouseEvent) => void;
|
|
36
|
+
buttonProps?: {
|
|
37
|
+
[key: string]: string;
|
|
38
|
+
};
|
|
39
|
+
status?: Status;
|
|
41
40
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
label,
|
|
45
|
-
position,
|
|
46
|
-
className,
|
|
47
|
-
onClick,
|
|
48
|
-
buttonProps,
|
|
49
|
-
status,
|
|
50
|
-
style,
|
|
51
|
-
}: Props) => JSX.Element;
|
|
52
|
-
|
|
53
|
-
export default BpkPriceMarkerV2;
|
|
41
|
+
export declare const BpkPriceMarkerV2: (props: Props) => JSX.Element;
|
|
42
|
+
export {};
|
|
@@ -28,7 +28,7 @@ export const MARKER_STATUSES = {
|
|
|
28
28
|
selected: 'selected',
|
|
29
29
|
previous_selected: 'previous_selected'
|
|
30
30
|
};
|
|
31
|
-
const BpkPriceMarkerV2 = props => {
|
|
31
|
+
export const BpkPriceMarkerV2 = props => {
|
|
32
32
|
const {
|
|
33
33
|
accessibilityLabel,
|
|
34
34
|
buttonProps,
|
|
@@ -60,5 +60,4 @@ const BpkPriceMarkerV2 = props => {
|
|
|
60
60
|
})
|
|
61
61
|
})
|
|
62
62
|
});
|
|
63
|
-
};
|
|
64
|
-
export default BpkPriceMarkerV2;
|
|
63
|
+
};
|
|
@@ -58,27 +58,26 @@ const computeScrollIndicatorClassName = (scrollerEl, leadingIndicatorClassName =
|
|
|
58
58
|
}
|
|
59
59
|
return classNames;
|
|
60
60
|
};
|
|
61
|
+
const propTypes = {
|
|
62
|
+
children: PropTypes.node.isRequired,
|
|
63
|
+
scrollerRef: PropTypes.func,
|
|
64
|
+
innerContainerTagName: PropTypes.string,
|
|
65
|
+
className: PropTypes.string,
|
|
66
|
+
leadingIndicatorClassName: PropTypes.string,
|
|
67
|
+
trailingIndicatorClassName: PropTypes.string,
|
|
68
|
+
style: PropTypes.object,
|
|
69
|
+
showScrollbar: PropTypes.bool
|
|
70
|
+
};
|
|
71
|
+
const defaultProps = {
|
|
72
|
+
scrollerRef: null,
|
|
73
|
+
innerContainerTagName: 'div',
|
|
74
|
+
className: null,
|
|
75
|
+
leadingIndicatorClassName: null,
|
|
76
|
+
trailingIndicatorClassName: null,
|
|
77
|
+
style: null,
|
|
78
|
+
showScrollbar: false
|
|
79
|
+
};
|
|
61
80
|
class BpkMobileScrollContainer extends Component {
|
|
62
|
-
static propTypes = {
|
|
63
|
-
children: PropTypes.node.isRequired,
|
|
64
|
-
scrollerRef: PropTypes.func,
|
|
65
|
-
innerContainerTagName: PropTypes.string,
|
|
66
|
-
className: PropTypes.string,
|
|
67
|
-
leadingIndicatorClassName: PropTypes.string,
|
|
68
|
-
trailingIndicatorClassName: PropTypes.string,
|
|
69
|
-
style: PropTypes.object,
|
|
70
|
-
// eslint-disable-line react/forbid-prop-types
|
|
71
|
-
showScrollbar: PropTypes.bool
|
|
72
|
-
};
|
|
73
|
-
static defaultProps = {
|
|
74
|
-
scrollerRef: null,
|
|
75
|
-
innerContainerTagName: 'div',
|
|
76
|
-
className: null,
|
|
77
|
-
leadingIndicatorClassName: null,
|
|
78
|
-
trailingIndicatorClassName: null,
|
|
79
|
-
style: null,
|
|
80
|
-
showScrollbar: false
|
|
81
|
-
};
|
|
82
81
|
constructor() {
|
|
83
82
|
super();
|
|
84
83
|
this.state = {
|
|
@@ -167,5 +166,11 @@ class BpkMobileScrollContainer extends Component {
|
|
|
167
166
|
});
|
|
168
167
|
}
|
|
169
168
|
}
|
|
169
|
+
BpkMobileScrollContainer.propTypes = {
|
|
170
|
+
...propTypes
|
|
171
|
+
};
|
|
172
|
+
BpkMobileScrollContainer.defaultProps = {
|
|
173
|
+
...defaultProps
|
|
174
|
+
};
|
|
170
175
|
export default BpkMobileScrollContainer;
|
|
171
176
|
export { computeScrollBarAwareHeight, computeScrollIndicatorClassName };
|
|
@@ -29,7 +29,13 @@ export type Props = Partial<ModalDialogProps> & {
|
|
|
29
29
|
onClose?: (arg0?: TouchEvent | MouseEvent | KeyboardEvent, arg1?: {
|
|
30
30
|
source: 'ESCAPE' | 'DOCUMENT_CLICK';
|
|
31
31
|
}) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Because this component uses a modal on mobile viewports, you need to let it know what
|
|
34
|
+
* the root element of your application is by returning its DOM node via this prop
|
|
35
|
+
* This is to "hide" your application from screen readers whilst the modal is open.
|
|
36
|
+
* The "pagewrap" element id is a convention we use internally at Skyscanner. In most cases it should "just work".
|
|
37
|
+
*/
|
|
32
38
|
getApplicationElement: () => HTMLElement | null;
|
|
33
39
|
};
|
|
34
|
-
declare const BpkModal: ({
|
|
40
|
+
declare const BpkModal: ({ accessoryView, className, closeLabel, closeOnEscPressed, closeOnScrimClick, closeText, contentClassName, dialogRef, fullScreen, fullScreenOnMobile, isIphone, isOpen, onClose, padded, renderTarget, showHeader, title, wide, ...rest }: Props) => JSX.Element;
|
|
35
41
|
export default BpkModal;
|
|
@@ -33,7 +33,10 @@ export type Props = {
|
|
|
33
33
|
title?: string | null;
|
|
34
34
|
closeLabel?: string;
|
|
35
35
|
closeText?: string | null;
|
|
36
|
+
/**
|
|
37
|
+
* The accessory view allows for icons and actions to be placed in front of the main title inside the modal header. To be used with `BpkNavigationBarButtonLink`
|
|
38
|
+
*/
|
|
36
39
|
accessoryView?: ReactNode;
|
|
37
40
|
};
|
|
38
|
-
declare const BpkModalInner: ({
|
|
41
|
+
declare const BpkModalInner: ({ accessoryView, children, className, closeLabel, closeText, contentClassName, dialogRef, fullScreen, fullScreenOnMobile, id, isIphone, onClose, padded, showHeader, title, wide, }: Props) => JSX.Element;
|
|
39
42
|
export default BpkModalInner;
|
|
@@ -20,9 +20,25 @@
|
|
|
20
20
|
import { type CommonProps } from './common-types';
|
|
21
21
|
type Props = CommonProps & {
|
|
22
22
|
inputClassName?: string | null;
|
|
23
|
+
/**
|
|
24
|
+
* A simple function that will allow you to set the format of the display value e.g. local dates or times.
|
|
25
|
+
*/
|
|
23
26
|
formatValue: (arg0: any) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Function that handle the incrementing of the current selected value.
|
|
29
|
+
*/
|
|
24
30
|
incrementValue: (arg0: any) => string | number;
|
|
31
|
+
/**
|
|
32
|
+
* Function that handle the decrementing of the current selected value.
|
|
33
|
+
*/
|
|
25
34
|
decrementValue: (arg0: any) => string | number;
|
|
35
|
+
/**
|
|
36
|
+
* Given `a` and `b`:
|
|
37
|
+
* - If `a` is less than `b` then `compareValues(a, b)` should return a value less than `0`
|
|
38
|
+
* - If `a` and `b` are equal then `compareValues(a, b)` should return exactly `0`
|
|
39
|
+
* - If `a` is greater than `b` then `compareValues(a, b)` should return a value greater than `0`
|
|
40
|
+
* We use this along with the `min` and `max` values to determine when we should disable the increment and decrement buttons. This is inspired by the `compareFunction` in [Array.prototype.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description)
|
|
41
|
+
*/
|
|
26
42
|
compareValues: (arg0: any, arg1: any) => number;
|
|
27
43
|
};
|
|
28
44
|
declare const BpkConfigurableNudger: ({ buttonType, className, compareValues, decreaseButtonLabel, decrementValue, formatValue, id, increaseButtonLabel, incrementValue, inputClassName, max, min, onChange, value, ...rest }: Props) => JSX.Element;
|
|
@@ -17,7 +17,10 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import type { ReactNode } from "react";
|
|
20
|
-
|
|
20
|
+
export declare const BUTTON_TYPES: {
|
|
21
|
+
readonly secondary: "secondary";
|
|
22
|
+
readonly secondaryOnDark: "secondary-on-dark";
|
|
23
|
+
};
|
|
21
24
|
export type CommonProps = {
|
|
22
25
|
id: string;
|
|
23
26
|
min: string | number;
|
|
@@ -25,9 +28,22 @@ export type CommonProps = {
|
|
|
25
28
|
value: string | number;
|
|
26
29
|
onChange: (arg0: any) => void | null;
|
|
27
30
|
className?: string | null;
|
|
31
|
+
/**
|
|
32
|
+
* This is the label that will be read out when screen reader users tab to the increase button. Make sure you use a descriptive label.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* Function that handle the incrementing of the current selected value.
|
|
36
|
+
*/
|
|
28
37
|
increaseButtonLabel: string;
|
|
38
|
+
/**
|
|
39
|
+
* This is the label that will be read out when screen reader users tab to the decrease button. Make sure you use a descriptive label
|
|
40
|
+
*/
|
|
29
41
|
decreaseButtonLabel: string;
|
|
30
42
|
buttonType?: keyof typeof BUTTON_TYPES;
|
|
43
|
+
/**
|
|
44
|
+
* Title, subtitle and icon together make up the label for the nudger.
|
|
45
|
+
* This label will be read aloud as a whole by screen readers. They all are optional props, however, if you wish to use a label then you will need to pass a title as the label will not work without it.
|
|
46
|
+
*/
|
|
31
47
|
title?: string;
|
|
32
48
|
subtitle?: string;
|
|
33
49
|
icon?: ReactNode;
|
|
@@ -1 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export const BUTTON_TYPES = {
|
|
20
|
+
secondary: 'secondary',
|
|
21
|
+
secondaryOnDark: 'secondary-on-dark'
|
|
22
|
+
};
|
|
@@ -36,11 +36,16 @@ export declare const OVERLAY_TYPES: {
|
|
|
36
36
|
readonly vignette: "vignette";
|
|
37
37
|
readonly off: "off";
|
|
38
38
|
};
|
|
39
|
-
export type OverlayType = typeof OVERLAY_TYPES[keyof typeof OVERLAY_TYPES];
|
|
40
|
-
|
|
39
|
+
export type OverlayType = (typeof OVERLAY_TYPES)[keyof typeof OVERLAY_TYPES];
|
|
40
|
+
type BpkOverlayProps = {
|
|
41
|
+
/**
|
|
42
|
+
* **Required:** The content to be rendered within the overlay.
|
|
43
|
+
*/
|
|
41
44
|
children: ReactNode;
|
|
42
|
-
overlayType?: OverlayType;
|
|
43
45
|
className?: string;
|
|
46
|
+
};
|
|
47
|
+
export type Props = BpkOverlayProps & ComponentProps<'div'> & {
|
|
48
|
+
overlayType?: OverlayType;
|
|
44
49
|
foregroundContent?: ReactNode;
|
|
45
50
|
};
|
|
46
51
|
declare const BpkOverlay: (props: Props) => JSX.Element;
|