@skyscanner/backpack-web 29.4.0 → 29.4.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-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
|
@@ -21,35 +21,12 @@ import focusStore from 'a11y-focus-store';
|
|
|
21
21
|
import { Portal, cssModules } from "../../bpk-react-utils";
|
|
22
22
|
import keyboardFocusScope from "./keyboardFocusScope";
|
|
23
23
|
import STYLES from "./BpkPopover.module.css";
|
|
24
|
-
import BpkPopover
|
|
24
|
+
import BpkPopover from "./BpkPopover";
|
|
25
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
26
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
27
27
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
28
|
const getClassName = cssModules(STYLES);
|
|
29
|
-
export const propTypes = {
|
|
30
|
-
...popoverPropTypes,
|
|
31
|
-
target: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
|
|
32
|
-
isOpen: PropTypes.bool.isRequired,
|
|
33
|
-
onClose: PropTypes.func.isRequired,
|
|
34
|
-
placement: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
|
35
|
-
portalStyle: PropTypes.object,
|
|
36
|
-
// eslint-disable-line react/forbid-prop-types
|
|
37
|
-
portalClassName: PropTypes.string,
|
|
38
|
-
renderTarget: PropTypes.func,
|
|
39
|
-
popperModifiers: PropTypes.arrayOf(PropTypes.object) // eslint-disable-line react/forbid-prop-types
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const defaultProps = {
|
|
43
|
-
...popoverDefaultProps,
|
|
44
|
-
placement: 'bottom',
|
|
45
|
-
portalStyle: null,
|
|
46
|
-
portalClassName: null,
|
|
47
|
-
renderTarget: null,
|
|
48
|
-
popperModifiers: null
|
|
49
|
-
};
|
|
50
29
|
class BpkPopoverPortal extends Component {
|
|
51
|
-
static propTypes = propTypes;
|
|
52
|
-
static defaultProps = defaultProps;
|
|
53
30
|
constructor() {
|
|
54
31
|
super();
|
|
55
32
|
this.popper = null;
|
|
@@ -189,4 +166,53 @@ class BpkPopoverPortal extends Component {
|
|
|
189
166
|
});
|
|
190
167
|
}
|
|
191
168
|
}
|
|
169
|
+
const propTypes = {
|
|
170
|
+
// BpkPopover props - when migrating the popover to TS, we can import the type from BpkPopover
|
|
171
|
+
children: PropTypes.node.isRequired,
|
|
172
|
+
closeButtonText: PropTypes.string.isRequired,
|
|
173
|
+
id: PropTypes.string.isRequired,
|
|
174
|
+
label: PropTypes.string.isRequired,
|
|
175
|
+
onClose: PropTypes.func.isRequired,
|
|
176
|
+
className: PropTypes.string,
|
|
177
|
+
closeButtonIcon: PropTypes.bool,
|
|
178
|
+
closeButtonProps: PropTypes.object,
|
|
179
|
+
labelAsTitle: PropTypes.bool,
|
|
180
|
+
padded: PropTypes.bool,
|
|
181
|
+
// BpkPopoverPortal additional props
|
|
182
|
+
/**
|
|
183
|
+
* In order to attach the popover to a regular DOM element, provide a function which returns it to `target`.
|
|
184
|
+
* `target` can be a DOM element with a `ref` attached to it or a function that returns a DOM element.
|
|
185
|
+
*/
|
|
186
|
+
target: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
|
|
187
|
+
isOpen: PropTypes.bool.isRequired,
|
|
188
|
+
placement: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
|
189
|
+
portalStyle: PropTypes.object,
|
|
190
|
+
portalClassName: PropTypes.string,
|
|
191
|
+
renderTarget: PropTypes.func,
|
|
192
|
+
/**
|
|
193
|
+
* Please refer to the [documentation](https://popper.js.org/docs/v2/modifiers/) for the underlying positioning library "Popper.js".
|
|
194
|
+
* You can achieve various behaviours such as allowing the popover to overflow the viewport etc.
|
|
195
|
+
*/
|
|
196
|
+
popperModifiers: PropTypes.arrayOf(PropTypes.object)
|
|
197
|
+
};
|
|
198
|
+
const defaultProps = {
|
|
199
|
+
// BpkPopover props - when migrating the popover to TS, we can import the type from BpkPopover
|
|
200
|
+
className: null,
|
|
201
|
+
closeButtonIcon: true,
|
|
202
|
+
closeButtonProps: null,
|
|
203
|
+
labelAsTitle: false,
|
|
204
|
+
padded: true,
|
|
205
|
+
// BpkPopoverPortal additional props
|
|
206
|
+
placement: 'bottom',
|
|
207
|
+
portalStyle: null,
|
|
208
|
+
portalClassName: null,
|
|
209
|
+
renderTarget: null,
|
|
210
|
+
popperModifiers: null
|
|
211
|
+
};
|
|
212
|
+
BpkPopoverPortal.propTypes = {
|
|
213
|
+
...propTypes
|
|
214
|
+
};
|
|
215
|
+
BpkPopoverPortal.defaultProps = {
|
|
216
|
+
...defaultProps
|
|
217
|
+
};
|
|
192
218
|
export default BpkPopoverPortal;
|
|
@@ -36,26 +36,26 @@ const renderSteps = numberOfSteps => {
|
|
|
36
36
|
}
|
|
37
37
|
return steps;
|
|
38
38
|
};
|
|
39
|
+
const propTypes = {
|
|
40
|
+
max: PropTypes.number.isRequired,
|
|
41
|
+
min: PropTypes.number.isRequired,
|
|
42
|
+
value: PropTypes.number.isRequired,
|
|
43
|
+
stepped: PropTypes.bool,
|
|
44
|
+
small: PropTypes.bool,
|
|
45
|
+
className: PropTypes.string,
|
|
46
|
+
onComplete: PropTypes.func,
|
|
47
|
+
onCompleteTransitionEnd: PropTypes.func,
|
|
48
|
+
getValueText: PropTypes.func
|
|
49
|
+
};
|
|
50
|
+
const defaultProps = {
|
|
51
|
+
className: null,
|
|
52
|
+
stepped: false,
|
|
53
|
+
small: false,
|
|
54
|
+
onComplete: () => null,
|
|
55
|
+
onCompleteTransitionEnd: () => null,
|
|
56
|
+
getValueText: null
|
|
57
|
+
};
|
|
39
58
|
class BpkProgress extends Component {
|
|
40
|
-
static propTypes = {
|
|
41
|
-
max: PropTypes.number.isRequired,
|
|
42
|
-
min: PropTypes.number.isRequired,
|
|
43
|
-
value: PropTypes.number.isRequired,
|
|
44
|
-
stepped: PropTypes.bool,
|
|
45
|
-
small: PropTypes.bool,
|
|
46
|
-
className: PropTypes.string,
|
|
47
|
-
onComplete: PropTypes.func,
|
|
48
|
-
onCompleteTransitionEnd: PropTypes.func,
|
|
49
|
-
getValueText: PropTypes.func
|
|
50
|
-
};
|
|
51
|
-
static defaultProps = {
|
|
52
|
-
className: null,
|
|
53
|
-
stepped: false,
|
|
54
|
-
small: false,
|
|
55
|
-
onComplete: () => null,
|
|
56
|
-
onCompleteTransitionEnd: () => null,
|
|
57
|
-
getValueText: null
|
|
58
|
-
};
|
|
59
59
|
componentDidUpdate(previousProps) {
|
|
60
60
|
const {
|
|
61
61
|
max,
|
|
@@ -119,4 +119,10 @@ class BpkProgress extends Component {
|
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
+
BpkProgress.propTypes = {
|
|
123
|
+
...propTypes
|
|
124
|
+
};
|
|
125
|
+
BpkProgress.defaultProps = {
|
|
126
|
+
...defaultProps
|
|
127
|
+
};
|
|
122
128
|
export default BpkProgress;
|
|
@@ -62,11 +62,13 @@ const BpkSelect = props => {
|
|
|
62
62
|
BpkSelect.propTypes = {
|
|
63
63
|
id: PropTypes.string.isRequired,
|
|
64
64
|
name: PropTypes.string.isRequired,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
/**
|
|
66
|
+
* The "value" prop is only relevant if the user is wanting a controlled component
|
|
67
|
+
* In some cases, users may want to create an uncontrolled select as described here: https://beta.reactjs.org/reference/react-dom/components/select
|
|
68
|
+
* In this case value is not required and nor should it be given a default value (as the linter thinks)
|
|
69
|
+
* Prop types are not expressive enough (without a drastic increase in complexity of writing a custom validator) to encode this relationship. Equally, this wouldn't actually solve the linting issue (AFAIK).
|
|
70
|
+
* As a solution, the require-default-props has been disabled for this line.
|
|
71
|
+
*/
|
|
70
72
|
|
|
71
73
|
value: PropTypes.string,
|
|
72
74
|
className: PropTypes.string,
|
|
@@ -21,7 +21,15 @@ import { Component } from 'react';
|
|
|
21
21
|
import type { ReactNode, ReactElement } from 'react';
|
|
22
22
|
import type { TooltipProps } from './BpkTooltip';
|
|
23
23
|
export type Props = TooltipProps & {
|
|
24
|
+
/**
|
|
25
|
+
* Tooltips are invisible to assistive technologies such as screen readers.
|
|
26
|
+
* To improve accessibility, `ariaLabel` is required to describe the content of the tooltip to assistive technologies.
|
|
27
|
+
* The label will be used on the `target` element, so any existing `aria-label` attached to `target` will be overridden.
|
|
28
|
+
*/
|
|
24
29
|
ariaLabel: string;
|
|
30
|
+
/**
|
|
31
|
+
* "target" should be a DOM element with a "ref" attached to it.
|
|
32
|
+
*/
|
|
25
33
|
target: ReactElement<any>;
|
|
26
34
|
children: ReactNode | string;
|
|
27
35
|
placement?: 'top' | 'right' | 'bottom' | 'left' | 'auto';
|
|
@@ -29,6 +37,10 @@ export type Props = TooltipProps & {
|
|
|
29
37
|
portalStyle?: object;
|
|
30
38
|
portalClassName?: string;
|
|
31
39
|
renderTarget: null | (() => null | HTMLElement);
|
|
40
|
+
/**
|
|
41
|
+
* Please refer to the [documentation](https://popper.js.org/docs/v2/modifiers/) for the underlying positioning library "Popper.js".
|
|
42
|
+
* You can achieve various behaviours such as allowing the tooltip to overflow the viewport etc.
|
|
43
|
+
*/
|
|
32
44
|
popperModifiers?: object[];
|
|
33
45
|
};
|
|
34
46
|
type State = {
|