@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.
Files changed (47) hide show
  1. package/bpk-component-banner-alert/src/withBannerAlertState.d.ts +86 -143
  2. package/bpk-component-barchart/src/BpkBarchart.js +24 -2
  3. package/bpk-component-barchart/src/BpkChartAxis.js +2 -2
  4. package/bpk-component-breakpoint/src/BpkBreakpoint.d.ts +3 -0
  5. package/bpk-component-button/index.js +1 -1
  6. package/bpk-component-button/src/BpkButtonV2/BpkButton.d.ts +1 -16
  7. package/bpk-component-button/src/BpkButtonV2/BpkButton.js +4 -3
  8. package/bpk-component-calendar/index.d.ts +1 -1
  9. package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +21 -331
  10. package/bpk-component-calendar/src/BpkCalendarDate.d.ts +8 -1
  11. package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +15 -0
  12. package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +9 -0
  13. package/bpk-component-calendar/src/BpkCalendarNav.d.ts +4 -0
  14. package/bpk-component-calendar/src/composeCalendar.d.ts +42 -1
  15. package/bpk-component-card-button/src/BpkSaveButton.js +1 -1
  16. package/bpk-component-chip/src/BpkDismissibleChip.d.ts +2 -7
  17. package/bpk-component-datatable/src/BpkDataTable.js +50 -1
  18. package/bpk-component-datepicker/src/BpkDatepicker.d.ts +25 -461
  19. package/bpk-component-dialog/src/common-types.d.ts +12 -0
  20. package/bpk-component-drawer/src/BpkDrawer.js +24 -4
  21. package/bpk-component-fieldset/src/BpkFieldset.js +3 -0
  22. package/bpk-component-floating-notification/src/BpkFloatingNotification.module.css +1 -1
  23. package/bpk-component-graphic-promotion/src/BpkGraphicPromo.d.ts +23 -31
  24. package/bpk-component-horizontal-nav/src/BpkHorizontalNav.js +24 -17
  25. package/bpk-component-horizontal-nav/src/BpkHorizontalNavItem.js +25 -17
  26. package/bpk-component-image/src/BpkImage.d.ts +4 -1
  27. package/bpk-component-input/src/common-types.d.ts +17 -3
  28. package/bpk-component-input/src/common-types.js +7 -0
  29. package/bpk-component-input/src/withOpenEvents.d.ts +13 -1
  30. package/bpk-component-list/src/BpkList.js +4 -1
  31. package/bpk-component-map/index.js +1 -1
  32. package/bpk-component-map/src/BpkMap.js +6 -0
  33. package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.d.ts +21 -32
  34. package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.js +2 -3
  35. package/bpk-component-mobile-scroll-container/src/BpkMobileScrollContainer.js +25 -20
  36. package/bpk-component-modal/src/BpkModal.d.ts +7 -1
  37. package/bpk-component-modal/src/BpkModalInner.d.ts +4 -1
  38. package/bpk-component-navigation-bar/src/BpkNavigationBar.js +1 -0
  39. package/bpk-component-nudger/src/BpkConfigurableNudger.d.ts +16 -0
  40. package/bpk-component-nudger/src/common-types.d.ts +17 -1
  41. package/bpk-component-nudger/src/common-types.js +22 -1
  42. package/bpk-component-overlay/src/BpkOverlay.d.ts +8 -3
  43. package/bpk-component-popover/src/BpkPopoverPortal.js +50 -24
  44. package/bpk-component-progress/src/BpkProgress.js +25 -19
  45. package/bpk-component-select/src/BpkSelect.js +7 -5
  46. package/bpk-component-tooltip/src/BpkTooltipPortal.d.ts +12 -0
  47. package/package.json +1 -1
@@ -18,152 +18,95 @@
18
18
 
19
19
  /// <reference types="node" />
20
20
  import type { ComponentType } from 'react';
21
-
22
- type WithBannerAlertStateProps = {
23
- onHide?: () => void;
24
- hideAfter?: number;
21
+ export type WithBannerAlertStateProps = {
22
+ onHide?: () => void;
23
+ hideAfter?: number;
25
24
  };
26
- declare const withBannerAlertState: <
27
- P extends Partial<
28
- import('./common-types').CommonProps & {
29
- dismissButtonLabel: string;
30
- onDismiss?: import('./common-types').OnDismissHandler;
31
- } & {
32
- children: import('react').ReactNode;
33
- expanded?: boolean | undefined;
34
- toggleButtonLabel: string;
35
- onExpandToggle?: import('./common-types').OnExpandToggleHandler;
36
- }
37
- >,
38
- >(
39
- WrappedComponent: ComponentType<P>,
40
- ) => {
41
- new (props: P & WithBannerAlertStateProps): {
42
- hideIntervalId?: NodeJS.Timeout | null | undefined;
43
- componentDidMount(): void;
44
- componentWillUnmount(): void;
45
- onExpandToggle: () => void;
46
- onDismiss: () => void;
47
- onHide: () => void;
48
- render(): JSX.Element;
49
- context: any;
50
- setState<
51
- K extends keyof {
52
- expanded?: boolean | undefined;
53
- show?: boolean | undefined;
54
- },
55
- >(
56
- state:
57
- | {
25
+ declare const withBannerAlertState: <P extends Partial<import("./common-types").CommonProps & {
26
+ dismissButtonLabel: string;
27
+ onDismiss?: import("./common-types").OnDismissHandler;
28
+ } & {
29
+ children: import("react").ReactNode;
30
+ expanded?: boolean | undefined;
31
+ toggleButtonLabel: string;
32
+ onExpandToggle?: import("./common-types").OnExpandToggleHandler;
33
+ }>>(WrappedComponent: ComponentType<P>) => {
34
+ new (props: P & WithBannerAlertStateProps): {
35
+ hideIntervalId?: NodeJS.Timeout | null | undefined;
36
+ componentDidMount(): void;
37
+ componentWillUnmount(): void;
38
+ onExpandToggle: () => void;
39
+ onDismiss: () => void;
40
+ onHide: () => void;
41
+ render(): JSX.Element;
42
+ context: any;
43
+ setState<K extends keyof {
44
+ expanded?: boolean | undefined;
45
+ show?: boolean | undefined;
46
+ }>(state: {
47
+ expanded?: boolean | undefined;
48
+ show?: boolean | undefined;
49
+ } | ((prevState: Readonly<{
50
+ expanded?: boolean | undefined;
51
+ show?: boolean | undefined;
52
+ }>, props: Readonly<P & WithBannerAlertStateProps>) => {
53
+ expanded?: boolean | undefined;
54
+ show?: boolean | undefined;
55
+ } | Pick<{
56
+ expanded?: boolean | undefined;
57
+ show?: boolean | undefined;
58
+ }, K> | null) | Pick<{
59
+ expanded?: boolean | undefined;
60
+ show?: boolean | undefined;
61
+ }, K> | null, callback?: (() => void) | undefined): void;
62
+ forceUpdate(callback?: (() => void) | undefined): void;
63
+ readonly props: Readonly<P & WithBannerAlertStateProps> & Readonly<{
64
+ children?: import("react").ReactNode;
65
+ }>;
66
+ state: Readonly<{
67
+ expanded?: boolean | undefined;
68
+ show?: boolean | undefined;
69
+ }>;
70
+ refs: {
71
+ [key: string]: import("react").ReactInstance;
72
+ };
73
+ shouldComponentUpdate?(nextProps: Readonly<P & WithBannerAlertStateProps>, nextState: Readonly<{
74
+ expanded?: boolean | undefined;
75
+ show?: boolean | undefined;
76
+ }>, nextContext: any): boolean;
77
+ componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
78
+ getSnapshotBeforeUpdate?(prevProps: Readonly<P & WithBannerAlertStateProps>, prevState: Readonly<{
79
+ expanded?: boolean | undefined;
80
+ show?: boolean | undefined;
81
+ }>): any;
82
+ componentDidUpdate?(prevProps: Readonly<P & WithBannerAlertStateProps>, prevState: Readonly<{
83
+ expanded?: boolean | undefined;
84
+ show?: boolean | undefined;
85
+ }>, snapshot?: any): void;
86
+ componentWillMount?(): void;
87
+ UNSAFE_componentWillMount?(): void;
88
+ componentWillReceiveProps?(nextProps: Readonly<P & WithBannerAlertStateProps>, nextContext: any): void;
89
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P & WithBannerAlertStateProps>, nextContext: any): void;
90
+ componentWillUpdate?(nextProps: Readonly<P & WithBannerAlertStateProps>, nextState: Readonly<{
58
91
  expanded?: boolean | undefined;
59
92
  show?: boolean | undefined;
60
- }
61
- | ((
62
- prevState: Readonly<{
63
- expanded?: boolean | undefined;
64
- show?: boolean | undefined;
65
- }>,
66
- props: Readonly<P & WithBannerAlertStateProps>,
67
- ) =>
68
- | {
69
- expanded?: boolean | undefined;
70
- show?: boolean | undefined;
71
- }
72
- | Pick<
73
- {
74
- expanded?: boolean | undefined;
75
- show?: boolean | undefined;
76
- },
77
- K
78
- >
79
- | null)
80
- | Pick<
81
- {
82
- expanded?: boolean | undefined;
83
- show?: boolean | undefined;
84
- },
85
- K
86
- >
87
- | null,
88
- callback?: (() => void) | undefined,
89
- ): void;
90
- forceUpdate(callback?: (() => void) | undefined): void;
91
- readonly props: Readonly<P & WithBannerAlertStateProps> &
92
- Readonly<{
93
- children?: import('react').ReactNode;
94
- }>;
95
- state: Readonly<{
96
- expanded?: boolean | undefined;
97
- show?: boolean | undefined;
98
- }>;
99
- refs: {
100
- [key: string]: import('react').ReactInstance;
93
+ }>, nextContext: any): void;
94
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<P & WithBannerAlertStateProps>, nextState: Readonly<{
95
+ expanded?: boolean | undefined;
96
+ show?: boolean | undefined;
97
+ }>, nextContext: any): void;
98
+ };
99
+ displayName: string;
100
+ defaultProps: {
101
+ onDismiss: null;
102
+ onExpandToggle: null;
103
+ onHide: null;
104
+ expanded: boolean;
105
+ show: boolean;
106
+ hideAfter: null;
107
+ animateOnLeave: boolean;
108
+ children: null;
101
109
  };
102
- shouldComponentUpdate?(
103
- nextProps: Readonly<P & WithBannerAlertStateProps>,
104
- nextState: Readonly<{
105
- expanded?: boolean | undefined;
106
- show?: boolean | undefined;
107
- }>,
108
- nextContext: any,
109
- ): boolean;
110
- componentDidCatch?(
111
- error: Error,
112
- errorInfo: import('react').ErrorInfo,
113
- ): void;
114
- getSnapshotBeforeUpdate?(
115
- prevProps: Readonly<P & WithBannerAlertStateProps>,
116
- prevState: Readonly<{
117
- expanded?: boolean | undefined;
118
- show?: boolean | undefined;
119
- }>,
120
- ): any;
121
- componentDidUpdate?(
122
- prevProps: Readonly<P & WithBannerAlertStateProps>,
123
- prevState: Readonly<{
124
- expanded?: boolean | undefined;
125
- show?: boolean | undefined;
126
- }>,
127
- snapshot?: any,
128
- ): void;
129
- componentWillMount?(): void;
130
- UNSAFE_componentWillMount?(): void;
131
- componentWillReceiveProps?(
132
- nextProps: Readonly<P & WithBannerAlertStateProps>,
133
- nextContext: any,
134
- ): void;
135
- UNSAFE_componentWillReceiveProps?(
136
- nextProps: Readonly<P & WithBannerAlertStateProps>,
137
- nextContext: any,
138
- ): void;
139
- componentWillUpdate?(
140
- nextProps: Readonly<P & WithBannerAlertStateProps>,
141
- nextState: Readonly<{
142
- expanded?: boolean | undefined;
143
- show?: boolean | undefined;
144
- }>,
145
- nextContext: any,
146
- ): void;
147
- UNSAFE_componentWillUpdate?(
148
- nextProps: Readonly<P & WithBannerAlertStateProps>,
149
- nextState: Readonly<{
150
- expanded?: boolean | undefined;
151
- show?: boolean | undefined;
152
- }>,
153
- nextContext: any,
154
- ): void;
155
- };
156
- displayName: string;
157
- defaultProps: {
158
- onDismiss: null;
159
- onExpandToggle: null;
160
- onHide: null;
161
- expanded: boolean;
162
- show: boolean;
163
- hideAfter: null;
164
- animateOnLeave: boolean;
165
- children: null;
166
- };
167
- contextType?: import('react').Context<any> | undefined;
110
+ contextType?: import("react").Context<any> | undefined;
168
111
  };
169
112
  export default withBannerAlertState;
@@ -18,7 +18,7 @@
18
18
  import debounce from 'lodash.debounce';
19
19
  import { Component } from 'react';
20
20
  import { scaleLinear, scaleBand } from 'd3-scale';
21
- import { spacingXs, lineHeightSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
21
+ import { lineHeightSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
22
22
  import { cssModules } from "../../bpk-react-utils";
23
23
  import BpkMobileScrollContainer from "../../bpk-component-mobile-scroll-container";
24
24
  import BpkBarchartDefs from "./BpkBarchartDefs";
@@ -36,7 +36,7 @@ import STYLES from "./BpkBarchart.module.css";
36
36
  import { jsx as _jsx } from "react/jsx-runtime";
37
37
  import { jsxs as _jsxs } from "react/jsx-runtime";
38
38
  const getClassName = cssModules(STYLES);
39
- const spacing = remToPx(spacingXs);
39
+ const spacing = remToPx('.375rem');
40
40
  const lineHeight = remToPx(lineHeightSm);
41
41
  const getMaxYValue = (dataPoints, outlierPercentage) => {
42
42
  const meanValue = dataPoints.reduce((d, t) => d + t, 0) / dataPoints.length;
@@ -214,16 +214,35 @@ class BpkBarchart extends Component {
214
214
  }
215
215
  }
216
216
  BpkBarchart.propTypes = {
217
+ /**
218
+ * **Required**
219
+ * An array of data points with a value for the x axis and y axis respectively.
220
+ * The keys for the x axis and y axis can be anything you choose.
221
+ * Specify the keys with the props `xScaleDataKey` and `yScaleDataKey`.
222
+ */
217
223
  data: dataProp,
224
+ /**
225
+ * The key in each data point that holds the value for the x axis of that data point.
226
+ */
218
227
  xScaleDataKey: PropTypes.string.isRequired,
228
+ /**
229
+ * The key in each data point that holds the value for the y axis of that data point.
230
+ */
219
231
  yScaleDataKey: PropTypes.string.isRequired,
220
232
  xAxisLabel: PropTypes.string.isRequired,
233
+ /**
234
+ * Override the default y axis domain. This is an array with two elements, the lower and upper domain.
235
+ * If either value is set to `null` the default value is used instead.
236
+ */
221
237
  yAxisLabel: PropTypes.string.isRequired,
222
238
  initialWidth: PropTypes.number.isRequired,
223
239
  initialHeight: PropTypes.number.isRequired,
224
240
  className: PropTypes.string,
225
241
  leadingScrollIndicatorClassName: PropTypes.string,
226
242
  trailingScrollIndicatorClassName: PropTypes.string,
243
+ /**
244
+ * Values that are `outlierPercentage` percent above the mean of the whole dataset are considered outliers and rendered cut off instead of at their full height.
245
+ */
227
246
  outlierPercentage: PropTypes.number,
228
247
  showGridlines: PropTypes.bool,
229
248
  xAxisMargin: PropTypes.number,
@@ -238,6 +257,9 @@ BpkBarchart.propTypes = {
238
257
  onBarHover: PropTypes.func,
239
258
  onBarFocus: PropTypes.func,
240
259
  getBarLabel: PropTypes.func,
260
+ /**
261
+ * Must be a function which returns true based on the `point` argument
262
+ */
241
263
  getBarSelection: PropTypes.func,
242
264
  BarComponent: PropTypes.elementType,
243
265
  disableDataTable: PropTypes.bool
@@ -15,7 +15,7 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */import PropTypes from 'prop-types';
18
- import { spacingXs, lineHeightSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
18
+ import { lineHeightSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
19
19
  import { cssModules } from "../../bpk-react-utils";
20
20
  import { rtlConditionalValue } from "./RTLtransforms";
21
21
  import { ORIENTATION_X, ORIENTATION_Y } from "./orientation";
@@ -24,7 +24,7 @@ import STYLES from "./BpkChartAxis.module.css";
24
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
25
  import { jsxs as _jsxs } from "react/jsx-runtime";
26
26
  const getClassName = cssModules(STYLES);
27
- const spacing = remToPx(spacingXs);
27
+ const spacing = remToPx('.375rem');
28
28
  const lineHeight = remToPx(lineHeightSm);
29
29
  const getAxisConfig = ({
30
30
  height,
@@ -30,6 +30,9 @@ declare const BREAKPOINTS: {
30
30
  readonly DESKTOP_ONLY: any;
31
31
  };
32
32
  type Props = {
33
+ /**
34
+ * The content to render when the breakpoint matches.
35
+ */
33
36
  children: ReactNode | ((matches: boolean) => ReactNode | null);
34
37
  query: string | (typeof BREAKPOINTS)[keyof typeof BREAKPOINTS];
35
38
  legacy?: boolean;
@@ -15,7 +15,7 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */import BpkButton from "./src/BpkButton"; // eslint-disable-line import/no-cycle
18
- import BpkButtonV2 from "./src/BpkButtonV2/BpkButton";
18
+ import { BpkButtonV2 } from "./src/BpkButtonV2/BpkButton";
19
19
  import BpkButtonPrimary from "./src/BpkButtonPrimary";
20
20
  import BpkButtonPrimaryOnDark from "./src/BpkButtonPrimaryOnDark";
21
21
  import BpkButtonPrimaryOnLight from "./src/BpkButtonPrimaryOnLight";
@@ -18,19 +18,4 @@
18
18
 
19
19
  /// <reference types="react" />
20
20
  import type { Props } from './common-types';
21
-
22
- declare const BpkButtonV2: ({
23
- blank,
24
- children,
25
- className,
26
- disabled,
27
- href,
28
- iconOnly,
29
- onClick,
30
- rel: propRel,
31
- size,
32
- submit,
33
- type,
34
- ...rest
35
- }: Props) => JSX.Element;
36
- export default BpkButtonV2;
21
+ export declare const BpkButtonV2: ({ blank, children, className, disabled, href, iconOnly, onClick, rel: propRel, size, submit, type, ...rest }: Props) => JSX.Element;
@@ -20,7 +20,9 @@ import { BUTTON_TYPES, SIZE_TYPES } from "./common-types";
20
20
  import COMMON_STYLES from "./BpkButton.module.css";
21
21
  import { jsx as _jsx } from "react/jsx-runtime";
22
22
  const getCommonClassName = cssModules(COMMON_STYLES);
23
- const BpkButtonV2 = ({
23
+
24
+ // eslint-disable-next-line import/prefer-default-export
25
+ export const BpkButtonV2 = ({
24
26
  blank = false,
25
27
  children,
26
28
  className = null,
@@ -56,5 +58,4 @@ const BpkButtonV2 = ({
56
58
  ...rest,
57
59
  children: children
58
60
  });
59
- };
60
- export default BpkButtonV2;
61
+ };
@@ -30,4 +30,4 @@ import CustomPropTypes, { BpkCalendarGridPropTypes, BpkCalendarDatePropTypes } f
30
30
  import * as DateUtils from './src/date-utils';
31
31
  import themeAttributes from './src/themeAttributes';
32
32
  export default BpkCalendarContainer;
33
- export { BpkCalendarGrid, BpkCalendarGridHeader, BpkCalendarNav, BpkCalendarDate, DateUtils, CALENDAR_SELECTION_TYPE, DaysOfWeek, ReactComponent, WeekDay, WeekDayKey, SelectionConfiguration, ROW_TYPES, SELECTION_TYPES, composeCalendar, withCalendarState, themeAttributes, BpkCalendarGridWithTransition, CustomPropTypes, BpkCalendarGridPropTypes, BpkCalendarDatePropTypes, BpkCalendarGridProps, BpkCalendarDateProps };
33
+ export { BpkCalendarGrid, BpkCalendarGridHeader, BpkCalendarNav, BpkCalendarDate, DateUtils, CALENDAR_SELECTION_TYPE, DaysOfWeek, ReactComponent, WeekDay, WeekDayKey, SelectionConfiguration, ROW_TYPES, SELECTION_TYPES, composeCalendar, withCalendarState, themeAttributes, BpkCalendarGridWithTransition, CustomPropTypes, BpkCalendarGridPropTypes, BpkCalendarDatePropTypes, BpkCalendarDateProps, BpkCalendarGridProps, };