@skyscanner/backpack-web 25.0.0 → 25.2.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.
Files changed (48) hide show
  1. package/bpk-component-badge/src/BpkBadge.js +4 -4
  2. package/bpk-component-breakpoint/index.d.ts +21 -0
  3. package/bpk-component-breakpoint/src/BpkBreakpoint.d.ts +39 -0
  4. package/bpk-component-breakpoint/src/BpkBreakpoint.js +18 -24
  5. package/bpk-component-button/src/BpkButtonV2/BpkButton.js +7 -7
  6. package/bpk-component-calendar/index.d.ts +3 -1
  7. package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +9 -7
  8. package/bpk-component-calendar/src/BpkCalendarContainer.js +1 -1
  9. package/bpk-component-calendar/src/BpkCalendarDate.d.ts +12 -12
  10. package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +4 -4
  11. package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +1 -1
  12. package/bpk-component-calendar/src/Week.d.ts +9 -9
  13. package/bpk-component-calendar/src/Week.js +2 -2
  14. package/bpk-component-card/src/BpkCardWrapper.module.css +1 -1
  15. package/bpk-component-card/src/BpkDividedCard.js +3 -3
  16. package/bpk-component-chip/src/BpkDismissibleChip.js +3 -3
  17. package/bpk-component-chip/src/BpkSelectableChip.js +7 -7
  18. package/bpk-component-image/index.d.ts +27 -0
  19. package/bpk-component-image/src/BpkBackgroundImage.d.ts +50 -0
  20. package/bpk-component-image/src/BpkBackgroundImage.js +4 -16
  21. package/bpk-component-image/src/BpkImage.d.ts +48 -0
  22. package/bpk-component-image/src/BpkImage.js +10 -36
  23. package/bpk-component-image/src/BpkImageBorderRadiusStyles.d.ts +23 -0
  24. package/bpk-component-image/src/BpkImageBorderRadiusStyles.js +3 -1
  25. package/bpk-component-image/src/withLazyLoading.d.ts +73 -0
  26. package/bpk-component-image/src/withLazyLoading.js +18 -28
  27. package/bpk-component-image/src/withLoadingBehavior.d.ts +57 -0
  28. package/bpk-component-image/src/withLoadingBehavior.js +3 -2
  29. package/bpk-component-modal/src/BpkModal.js +13 -13
  30. package/bpk-component-modal/src/BpkModalInner.js +10 -10
  31. package/bpk-component-modal/src/BpkModalV2/BpKModal.module.css +1 -1
  32. package/bpk-component-modal/src/BpkModalV2/BpkModal.js +16 -11
  33. package/bpk-component-radio/src/BpkRadio.module.css +1 -1
  34. package/bpk-component-scrollable-calendar/index.d.ts +25 -0
  35. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendar.d.ts +596 -0
  36. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarDate.d.ts +32 -0
  37. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarDate.js +21 -28
  38. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGrid.d.ts +29 -0
  39. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGrid.js +8 -7
  40. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.d.ts +56 -0
  41. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.js +8 -15
  42. package/bpk-component-scrollable-calendar/src/utils.d.ts +21 -0
  43. package/bpk-component-scrollable-calendar/src/utils.js +1 -1
  44. package/bpk-component-scrollable-calendar/test-utils.d.ts +52 -0
  45. package/bpk-component-scrollable-calendar/test-utils.js +2 -2
  46. package/bpk-component-text/src/BpkText.js +4 -4
  47. package/bpk-scrim-utils/src/withScrim.js +28 -31
  48. package/package.json +4 -4
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = require("react");
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
8
  var _CSSTransition = _interopRequireDefault(require("react-transition-group/CSSTransition"));
10
9
  var _base = require("@skyscanner/bpk-foundations-web/tokens/base.es6");
11
10
  var _bpkReactUtils = require("../../bpk-react-utils");
@@ -38,7 +37,9 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
38
37
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39
38
  * See the License for the specific language governing permissions and
40
39
  * limitations under the License.
41
- */
40
+ */ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
41
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
42
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
42
43
  const getClassName = (0, _bpkReactUtils.cssModules)(_BpkImageModule.default);
43
44
  class Image extends _react.Component {
44
45
  constructor(props) {
@@ -68,30 +69,20 @@ class Image extends _react.Component {
68
69
  if (hidden) {
69
70
  imgClassNames.push(getClassName('bpk-image__img--hidden'));
70
71
  }
71
- return (
72
- /*#__PURE__*/
73
- // $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
74
- (0, _jsxRuntime.jsx)("img", _objectSpread({
75
- className: imgClassNames.join(' '),
76
- alt: altText,
77
- onLoad: onImageLoad,
78
- ref: this.setImgRef
79
- }, rest))
80
- );
72
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("img", _objectSpread({
73
+ className: imgClassNames.join(' '),
74
+ alt: altText,
75
+ onLoad: onImageLoad,
76
+ ref: this.setImgRef
77
+ }, rest));
81
78
  }
82
79
  }
83
- _defineProperty(Image, "propTypes", {
84
- altText: _propTypes.default.string.isRequired,
85
- hidden: _propTypes.default.bool,
86
- onImageLoad: _propTypes.default.func.isRequired
87
- });
88
80
  _defineProperty(Image, "defaultProps", {
89
81
  hidden: false
90
82
  });
91
83
  class BpkImage extends _react.Component {
92
84
  constructor(...args) {
93
85
  super(...args);
94
- _defineProperty(this, "onImageLoad", void 0);
95
86
  _defineProperty(this, "placeholder", void 0);
96
87
  _defineProperty(this, "onImageLoad", () => {
97
88
  if (this.props.onLoad) {
@@ -143,10 +134,7 @@ class BpkImage extends _react.Component {
143
134
  },
144
135
  className: classNames.join(' '),
145
136
  suppressHydrationWarning: this.props.suppressHydrationWarning,
146
- children: [inView &&
147
- /*#__PURE__*/
148
- // $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
149
- (0, _jsxRuntime.jsx)(Image, _objectSpread({
137
+ children: [inView && /*#__PURE__*/(0, _jsxRuntime.jsx)(Image, _objectSpread({
150
138
  hidden: loading,
151
139
  altText: altText,
152
140
  onImageLoad: this.onImageLoad
@@ -170,22 +158,8 @@ class BpkImage extends _react.Component {
170
158
  });
171
159
  }
172
160
  }
173
- _defineProperty(BpkImage, "propTypes", {
174
- altText: _propTypes.default.string.isRequired,
175
- src: _propTypes.default.string.isRequired,
176
- aspectRatio: _propTypes.default.number.isRequired,
177
- borderRadiusStyle: _propTypes.default.oneOf(Object.keys(_BpkImageBorderRadiusStyles.default)),
178
- className: _propTypes.default.string,
179
- inView: _propTypes.default.bool,
180
- loading: _propTypes.default.bool,
181
- onLoad: _propTypes.default.func,
182
- style: _propTypes.default.object,
183
- // eslint-disable-line react/forbid-prop-types
184
- suppressHydrationWarning: _propTypes.default.bool
185
- });
186
161
  _defineProperty(BpkImage, "defaultProps", {
187
162
  borderRadiusStyle: _BpkImageBorderRadiusStyles.default.none,
188
- className: null,
189
163
  inView: true,
190
164
  loading: false,
191
165
  onLoad: null,
@@ -0,0 +1,23 @@
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
+ declare const BORDER_RADIUS_STYLES: {
20
+ readonly none: "none";
21
+ readonly sm: "sm";
22
+ };
23
+ export default BORDER_RADIUS_STYLES;
@@ -20,7 +20,9 @@ exports.default = void 0;
20
20
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
21
  * See the License for the specific language governing permissions and
22
22
  * limitations under the License.
23
- */const BORDER_RADIUS_STYLES = {
23
+ */
24
+
25
+ const BORDER_RADIUS_STYLES = {
24
26
  none: 'none',
25
27
  sm: 'sm'
26
28
  };
@@ -0,0 +1,73 @@
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
+ /// <reference types="lodash" />
20
+ import type { ComponentType } from 'react';
21
+ type WithLazyLoadingProps = {
22
+ className?: string;
23
+ style?: {};
24
+ [rest: string]: any;
25
+ };
26
+ type WithLazyLoadingState = {
27
+ inView: boolean;
28
+ };
29
+ export default function withLazyLoading<P extends object>(WrappedComponent: ComponentType<P>, documentRef?: Document | null): {
30
+ new (props: Omit<P, 'inView'> & WithLazyLoadingProps): {
31
+ element?: HTMLElement | null | undefined;
32
+ placeholderReference?: string | undefined;
33
+ componentDidMount(): void;
34
+ componentWillUnmount(): void;
35
+ setInView: () => void;
36
+ getPassiveArgs(): {
37
+ capture: boolean;
38
+ passive?: boolean;
39
+ };
40
+ removeEventListeners: () => void;
41
+ checkInView: import("lodash").DebouncedFunc<() => void>;
42
+ supportsPassiveEvents: () => boolean;
43
+ isInViewPort: () => boolean;
44
+ render(): JSX.Element;
45
+ context: any;
46
+ setState<K extends "inView">(state: WithLazyLoadingState | ((prevState: Readonly<WithLazyLoadingState>, props: Readonly<Omit<P, "inView"> & WithLazyLoadingProps>) => WithLazyLoadingState | Pick<WithLazyLoadingState, K> | null) | Pick<WithLazyLoadingState, K> | null, callback?: (() => void) | undefined): void;
47
+ forceUpdate(callback?: (() => void) | undefined): void;
48
+ readonly props: Readonly<Omit<P, "inView"> & WithLazyLoadingProps> & Readonly<{
49
+ children?: import("react").ReactNode;
50
+ }>;
51
+ state: Readonly<WithLazyLoadingState>;
52
+ refs: {
53
+ [key: string]: import("react").ReactInstance;
54
+ };
55
+ shouldComponentUpdate?(nextProps: Readonly<Omit<P, "inView"> & WithLazyLoadingProps>, nextState: Readonly<WithLazyLoadingState>, nextContext: any): boolean;
56
+ componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
57
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<P, "inView"> & WithLazyLoadingProps>, prevState: Readonly<WithLazyLoadingState>): any;
58
+ componentDidUpdate?(prevProps: Readonly<Omit<P, "inView"> & WithLazyLoadingProps>, prevState: Readonly<WithLazyLoadingState>, snapshot?: any): void;
59
+ componentWillMount?(): void;
60
+ UNSAFE_componentWillMount?(): void;
61
+ componentWillReceiveProps?(nextProps: Readonly<Omit<P, "inView"> & WithLazyLoadingProps>, nextContext: any): void;
62
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<P, "inView"> & WithLazyLoadingProps>, nextContext: any): void;
63
+ componentWillUpdate?(nextProps: Readonly<Omit<P, "inView"> & WithLazyLoadingProps>, nextState: Readonly<WithLazyLoadingState>, nextContext: any): void;
64
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<P, "inView"> & WithLazyLoadingProps>, nextState: Readonly<WithLazyLoadingState>, nextContext: any): void;
65
+ };
66
+ displayName: string;
67
+ defaultProps: {
68
+ style: {};
69
+ className: string;
70
+ };
71
+ contextType?: import("react").Context<any> | undefined;
72
+ };
73
+ export {};
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = withLazyLoading;
7
7
  var _react = require("react");
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
8
  var _throttle = _interopRequireDefault(require("lodash/throttle"));
10
9
  var _bpkReactUtils = require("../../bpk-react-utils");
11
10
  var _jsxRuntime = require("react/jsx-runtime");
@@ -36,16 +35,10 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
36
35
  */
37
36
  function withLazyLoading(WrappedComponent, documentRef) {
38
37
  class WithLazyLoading extends _react.Component {
39
- constructor() {
40
- super();
41
- _defineProperty(this, "checkInView", void 0);
38
+ constructor(props) {
39
+ super(props);
42
40
  _defineProperty(this, "element", void 0);
43
- _defineProperty(this, "isInViewPort", void 0);
44
41
  _defineProperty(this, "placeholderReference", void 0);
45
- _defineProperty(this, "removeEventListeners", void 0);
46
- _defineProperty(this, "setInView", void 0);
47
- _defineProperty(this, "state", void 0);
48
- _defineProperty(this, "supportsPassiveEvents", void 0);
49
42
  _defineProperty(this, "setInView", () => {
50
43
  this.setState(() => ({
51
44
  inView: true
@@ -53,10 +46,10 @@ function withLazyLoading(WrappedComponent, documentRef) {
53
46
  this.removeEventListeners();
54
47
  });
55
48
  _defineProperty(this, "removeEventListeners", () => {
56
- documentRef.removeEventListener('scroll', this.checkInView, _objectSpread({}, this.getPassiveArgs()));
57
- documentRef.removeEventListener('resize', this.checkInView);
58
- documentRef.removeEventListener('orientationchange', this.checkInView);
59
- documentRef.removeEventListener('fullscreenchange', this.checkInView);
49
+ documentRef?.removeEventListener('scroll', this.checkInView, _objectSpread({}, this.getPassiveArgs()));
50
+ documentRef?.removeEventListener('resize', this.checkInView);
51
+ documentRef?.removeEventListener('orientationchange', this.checkInView);
52
+ documentRef?.removeEventListener('fullscreenchange', this.checkInView);
60
53
  });
61
54
  _defineProperty(this, "checkInView", (0, _throttle.default)(() => {
62
55
  if (this.isInViewPort()) {
@@ -74,8 +67,9 @@ function withLazyLoading(WrappedComponent, documentRef) {
74
67
  return supportsPassiveOption;
75
68
  }
76
69
  });
77
- window.addEventListener('test', null, opts);
78
- window.removeEventListener('test');
70
+ const noop = function () {};
71
+ window.addEventListener('test', noop, opts);
72
+ window.removeEventListener('test', noop, opts);
79
73
  } catch (e) {
80
74
  return false;
81
75
  }
@@ -84,8 +78,8 @@ function withLazyLoading(WrappedComponent, documentRef) {
84
78
  _defineProperty(this, "isInViewPort", () => {
85
79
  if (!this.element) return false;
86
80
  const rect = this.element.getBoundingClientRect();
87
- const viewPortHeight = Math.max(window.innerHeight, documentRef.documentElement.clientHeight);
88
- const viewPortWidth = Math.max(window.innerWidth, documentRef.documentElement.clientWidth);
81
+ const viewPortHeight = documentRef ? Math.max(window.innerHeight, documentRef.documentElement.clientHeight) : -1;
82
+ const viewPortWidth = documentRef ? Math.max(window.innerWidth, documentRef.documentElement.clientWidth) : -1;
89
83
  return rect.bottom >= 0 && rect.right >= 0 && rect.top < viewPortHeight && rect.left < viewPortWidth;
90
84
  });
91
85
  this.state = {
@@ -93,10 +87,10 @@ function withLazyLoading(WrappedComponent, documentRef) {
93
87
  };
94
88
  }
95
89
  componentDidMount() {
96
- documentRef.addEventListener('scroll', this.checkInView, _objectSpread({}, this.getPassiveArgs()));
97
- documentRef.addEventListener('resize', this.checkInView);
98
- documentRef.addEventListener('orientationchange', this.checkInView);
99
- documentRef.addEventListener('fullscreenchange', this.checkInView);
90
+ documentRef?.addEventListener('scroll', this.checkInView, _objectSpread({}, this.getPassiveArgs()));
91
+ documentRef?.addEventListener('resize', this.checkInView);
92
+ documentRef?.addEventListener('orientationchange', this.checkInView);
93
+ documentRef?.addEventListener('fullscreenchange', this.checkInView);
100
94
  // call checkInView immediately incase the
101
95
  // component is already in view prior to scrolling
102
96
  this.checkInView();
@@ -132,14 +126,10 @@ function withLazyLoading(WrappedComponent, documentRef) {
132
126
  });
133
127
  }
134
128
  }
135
- _defineProperty(WithLazyLoading, "propTypes", {
136
- style: _propTypes.default.object,
137
- // eslint-disable-line react/forbid-prop-types
138
- className: _propTypes.default.string
139
- });
129
+ _defineProperty(WithLazyLoading, "displayName", void 0);
140
130
  _defineProperty(WithLazyLoading, "defaultProps", {
141
- style: null,
142
- className: null
131
+ style: {},
132
+ className: ''
143
133
  });
144
134
  WithLazyLoading.displayName = (0, _bpkReactUtils.wrapDisplayName)(WrappedComponent, 'withLazyLoading');
145
135
  return WithLazyLoading;
@@ -0,0 +1,57 @@
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 type { ComponentType } from 'react';
20
+ type InjectedProps = {
21
+ onLoad: () => void;
22
+ loading: boolean;
23
+ };
24
+ type State = {
25
+ loading: boolean;
26
+ };
27
+ export default function withLoadingBehavior<P extends object>(WrappedComponent: ComponentType<P>): {
28
+ new (props: Omit<P, keyof InjectedProps>): {
29
+ onLoad: () => void;
30
+ render(): JSX.Element;
31
+ context: any;
32
+ setState<K extends "loading">(state: State | ((prevState: Readonly<State>, props: Readonly<Omit<P, keyof InjectedProps>>) => State | Pick<State, K> | null) | Pick<State, K> | null, callback?: (() => void) | undefined): void;
33
+ forceUpdate(callback?: (() => void) | undefined): void;
34
+ readonly props: Readonly<Omit<P, keyof InjectedProps>> & Readonly<{
35
+ children?: import("react").ReactNode;
36
+ }>;
37
+ state: Readonly<State>;
38
+ refs: {
39
+ [key: string]: import("react").ReactInstance;
40
+ };
41
+ componentDidMount?(): void;
42
+ shouldComponentUpdate?(nextProps: Readonly<Omit<P, keyof InjectedProps>>, nextState: Readonly<State>, nextContext: any): boolean;
43
+ componentWillUnmount?(): void;
44
+ componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
45
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<P, keyof InjectedProps>>, prevState: Readonly<State>): any;
46
+ componentDidUpdate?(prevProps: Readonly<Omit<P, keyof InjectedProps>>, prevState: Readonly<State>, snapshot?: any): void;
47
+ componentWillMount?(): void;
48
+ UNSAFE_componentWillMount?(): void;
49
+ componentWillReceiveProps?(nextProps: Readonly<Omit<P, keyof InjectedProps>>, nextContext: any): void;
50
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<P, keyof InjectedProps>>, nextContext: any): void;
51
+ componentWillUpdate?(nextProps: Readonly<Omit<P, keyof InjectedProps>>, nextState: Readonly<State>, nextContext: any): void;
52
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<P, keyof InjectedProps>>, nextState: Readonly<State>, nextContext: any): void;
53
+ };
54
+ displayName: string;
55
+ contextType?: import("react").Context<any> | undefined;
56
+ };
57
+ export {};
@@ -30,8 +30,8 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
30
30
  */
31
31
  function withLoadingBehavior(WrappedComponent) {
32
32
  class WithLoadingBehavior extends _react.Component {
33
- constructor() {
34
- super();
33
+ constructor(props) {
34
+ super(props);
35
35
  _defineProperty(this, "onLoad", () => {
36
36
  this.setState(() => ({
37
37
  loading: false
@@ -48,6 +48,7 @@ function withLoadingBehavior(WrappedComponent) {
48
48
  }, this.props));
49
49
  }
50
50
  }
51
+ _defineProperty(WithLoadingBehavior, "displayName", void 0);
51
52
  WithLoadingBehavior.displayName = (0, _bpkReactUtils.wrapDisplayName)(WrappedComponent, 'withLoadingBehavior');
52
53
  return WithLoadingBehavior;
53
54
  }
@@ -9,7 +9,7 @@ var _bpkReactUtils = require("../../bpk-react-utils");
9
9
  var _BpkModalModule = _interopRequireDefault(require("./BpkModal.module.css"));
10
10
  var _BpkModalInner = _interopRequireDefault(require("./BpkModalInner"));
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
- const _excluded = ["title", "onClose", "className", "contentClassName", "closeLabel", "closeText", "wide", "showHeader", "fullScreenOnMobile", "fullScreen", "padded", "accessoryView", "renderTarget", "isIphone", "closeOnScrimClick", "closeOnEscPressed", "dialogRef", "isOpen"];
12
+ const _excluded = ["accessoryView", "className", "closeLabel", "closeOnEscPressed", "closeOnScrimClick", "closeText", "contentClassName", "dialogRef", "fullScreen", "fullScreenOnMobile", "isIphone", "isOpen", "onClose", "padded", "renderTarget", "showHeader", "title", "wide"];
13
13
  /*
14
14
  * Backpack - Skyscanner's Design System
15
15
  *
@@ -39,24 +39,24 @@ const getClassName = (0, _bpkReactUtils.cssModules)(_BpkModalModule.default);
39
39
  const ScrimBpkModalInner = (0, _bpkScrimUtils.withScrim)(_BpkModalInner.default);
40
40
  const BpkModal = _ref => {
41
41
  let {
42
- title = null,
43
- onClose = () => null,
42
+ accessoryView = null,
44
43
  className = null,
45
- contentClassName = null,
46
44
  closeLabel = '',
45
+ closeOnEscPressed = true,
46
+ closeOnScrimClick = true,
47
47
  closeText = null,
48
- wide = false,
49
- showHeader = true,
50
- fullScreenOnMobile = true,
48
+ contentClassName = null,
49
+ dialogRef = () => null,
51
50
  fullScreen = false,
51
+ fullScreenOnMobile = true,
52
+ isIphone = (0, _bpkReactUtils.isDeviceIphone)(),
53
+ isOpen,
54
+ onClose = () => null,
52
55
  padded = true,
53
- accessoryView = null,
54
56
  renderTarget = null,
55
- isIphone = (0, _bpkReactUtils.isDeviceIphone)(),
56
- closeOnScrimClick = true,
57
- closeOnEscPressed = true,
58
- dialogRef = () => null,
59
- isOpen
57
+ showHeader = true,
58
+ title = null,
59
+ wide = false
60
60
  } = _ref,
61
61
  rest = _objectWithoutProperties(_ref, _excluded);
62
62
  const containerClass = [getClassName('bpk-modal__container')];
@@ -37,22 +37,22 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
37
37
 
38
38
  const getClassName = (0, _bpkReactUtils.cssModules)(_BpkModalInnerModule.default);
39
39
  const BpkModalInner = ({
40
- isIphone,
41
- id,
42
- dialogRef,
40
+ accessoryView = null,
43
41
  children,
44
- title = null,
45
- onClose = () => null,
46
42
  className = null,
47
- contentClassName = null,
48
43
  closeLabel = '',
49
44
  closeText = null,
50
- wide = false,
51
- showHeader = true,
52
- fullScreenOnMobile = true,
45
+ contentClassName = null,
46
+ dialogRef,
53
47
  fullScreen = false,
48
+ fullScreenOnMobile = true,
49
+ id,
50
+ isIphone,
51
+ onClose = () => null,
54
52
  padded = true,
55
- accessoryView = null
53
+ showHeader = true,
54
+ title = null,
55
+ wide = false
56
56
  }) => {
57
57
  const classNames = [getClassName('bpk-modal')];
58
58
  const contentClassNames = [getClassName('bpk-modal__content')];
@@ -15,4 +15,4 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:0;background-color:rgba(0,0,0,0.7);inset:0;inset-block-end:0;inset-inline:0;inset-inline-end:0}.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal{position:fixed;display:block;z-index:1}.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal:not([data-open='true']),.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal-backdrop:not([data-open='true']){display:none}.bpk-modal{top:0;right:0;left:0;width:100%;max-width:100%;height:100%;max-height:100%;margin:0 auto;padding:0;border:none;background:#fff;overflow-y:scroll;inset-block-start:0;inset-inline:0;inset-inline-end:0;scrollbar-width:none;box-shadow:0px 12px 50px 0px rgba(37,32,31,0.25)}@media (min-width: 32.0625rem){.bpk-modal{width:32rem;max-width:none;height:fit-content;max-height:90%;top:50%;transform:translateY(-50%);border-radius:.75rem;inset-block-start:50%}.bpk-modal--full-screen-desktop{width:100%;height:100%;max-height:100%;border-radius:0}.bpk-modal--wide{width:64rem}}.bpk-modal--no-full-screen-mobile{width:90%;max-width:none;height:fit-content;max-height:90%;top:50%;transform:translateY(-50%);border-radius:.75rem;inset-block-start:50%}@media (min-width: 32.0625rem){.bpk-modal--no-full-screen-mobile{width:32rem;max-width:none}}.bpk-modal::backdrop{position:fixed;background-color:rgba(0,0,0,0.7);inset:0;inset-block-end:0;inset-inline:0;inset-inline-end:0}.bpk-modal::-webkit-scrollbar{display:none}.bpk-modal__header-title{padding:1rem;border-block-end:solid 0.0625rem #C2C9CD;display:flex;min-height:1.5rem;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.bpk-modal__header-title-container{display:flex;width:100%;justify-content:flex-start}.bpk-modal__title{padding-inline-end:1rem;font-size:1rem;line-height:1.5rem;font-weight:700}.bpk-modal__button-container{padding-block-start:1rem;padding-inline-end:1rem;display:flex;min-height:1.5rem;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.bpk-modal__container{min-height:100%;padding:1rem}.bpk-modal__container--padded{padding:0}.bpk-modal__container--full-screen-desktop{height:100%}
18
+ @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}@keyframes bpk-modal-scrim{0%{opacity:0}100%{opacity:1}}@keyframes bpk-modal-scale{0%{transform:scale(0.9)}100%{transform:scale(1)}}.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:0;margin:0 auto;background-color:rgba(0,0,0,0.7);animation:bpk-modal-scrim 200ms ease-in-out;inset:0;inset-block-end:0;inset-inline:0;inset-inline-end:0}.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal{position:fixed;top:50%;left:50%;display:block;z-index:1;transform:translate(-50%, -50%) scale(1);transition:transform 200ms ease-in-out 200ms}.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal:not([data-open='true']),.bpk-modal-wrapper.bpk-modal-polyfill .bpk-modal-backdrop:not([data-open='true']){display:none}.bpk-modal{padding:0;border:none;border-radius:.75rem;background:#fff;overflow-y:scroll;scrollbar-width:none;box-shadow:0px 12px 50px 0px rgba(37,32,31,0.25)}@media (min-width: 32.0625rem){.bpk-modal{width:32rem;max-width:none;height:fit-content;max-height:90%}.bpk-modal--full-screen-desktop{width:100%;height:100%;max-height:100%;border-radius:0}.bpk-modal--wide{width:64rem}}.bpk-modal[open]{animation:bpk-modal-scale 200ms ease-in-out}.bpk-modal--no-full-screen-mobile{width:90%;max-width:none;height:fit-content;max-height:90%}@media (min-width: 32.0625rem){.bpk-modal--no-full-screen-mobile{width:32rem;max-width:none}}.bpk-modal::backdrop{position:fixed;background-color:rgba(0,0,0,0.7);animation:bpk-modal-scrim 200ms ease-in-out;inset:0;inset-block-end:0;inset-inline:0;inset-inline-end:0}.bpk-modal::-webkit-scrollbar{display:none}.bpk-modal__header-title{padding:1rem;border-block-end:solid 0.0625rem #C2C9CD;display:flex;min-height:1.5rem;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.bpk-modal__header-title-container{display:flex;width:100%;justify-content:flex-start}.bpk-modal__title{padding-inline-end:1rem;font-size:1rem;line-height:1.5rem;font-weight:700}.bpk-modal__button-container{padding-block-start:1rem;padding-inline-end:1rem;display:flex;min-height:1.5rem;flex-wrap:nowrap;justify-content:flex-end;align-items:center}.bpk-modal__container{min-height:100%;padding:1rem}.bpk-modal__container--padded{padding:0}.bpk-modal__container--full-screen-desktop{height:100%}
@@ -99,16 +99,21 @@ const BpkModalV2 = props => {
99
99
  if (isOpen) {
100
100
  ref.current?.showModal?.();
101
101
  const dialog = document.getElementById(`${id}`);
102
- if (dialog) {
103
- dialog.addEventListener('click', event => {
104
- const {
105
- target
106
- } = event;
107
- if (target instanceof HTMLElement && target.id === `${id}`) {
108
- ref.current?.close?.();
109
- }
110
- });
111
- }
102
+ const dialogWithPolyfill = document.getElementById(`${id}-polyfill`);
103
+ const handleBackdropClick = modal => {
104
+ if (modal) {
105
+ modal.addEventListener('click', event => {
106
+ const {
107
+ target
108
+ } = event;
109
+ if (target === modal) {
110
+ modal === dialog ? ref.current?.close?.() : onClose();
111
+ }
112
+ });
113
+ }
114
+ };
115
+ handleBackdropClick(dialog);
116
+ handleBackdropClick(dialogWithPolyfill);
112
117
  } else {
113
118
  ref.current?.close?.();
114
119
  }
@@ -118,7 +123,7 @@ const BpkModalV2 = props => {
118
123
  return () => setPageProperties({
119
124
  isDialogOpen: false
120
125
  });
121
- }, [id, isOpen]);
126
+ }, [id, isOpen, onClose]);
122
127
  const classNames = getClassName('bpk-modal', fullScreenOnDesktop && 'bpk-modal--full-screen-desktop', noFullScreenOnMobile && 'bpk-modal--no-full-screen-mobile', wide && 'bpk-modal--wide');
123
128
  const contentClassNames = getClassName('bpk-modal__container', fullScreenOnDesktop && 'bpk-modal__container--full-screen-desktop', padded && 'bpk-modal__container--padded');
124
129
  return isOpen ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -15,4 +15,4 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-radio{position:relative;display:inline-block;padding-left:1.75rem}html[dir='rtl'] .bpk-radio{padding-right:1.75rem;padding-left:0}.bpk-radio--white{color:#fff}.bpk-radio--white input[type='radio']{background:#fff}.bpk-radio--disabled{color:rgba(0,0,0,0.2);cursor:not-allowed}.bpk-radio--disabled--white{color:rgba(255,255,255,0.5)}.bpk-radio--invalid input[type='radio']{border:3px solid #e70866;border-radius:1.125rem}.bpk-radio__input{position:absolute;top:0;left:0;width:1.25rem;height:1.25rem;margin:0;padding:0;cursor:pointer;vertical-align:text-bottom;appearance:none;border:3px solid #545860;border-radius:1.125rem}html[dir='rtl'] .bpk-radio__input{right:0;left:auto}@media screen\0 {.bpk-radio__input{background:none !important}}.bpk-radio__input:checked{border-color:#0062e3;border-color:var(--bpk-radio-checked-color, #0062e3)}.bpk-radio__input:checked:disabled{border-color:rgba(0,0,0,0.2)}.bpk-radio__input:disabled{border-color:rgba(0,0,0,0.2)}.bpk-radio__input:disabled{cursor:inherit}.bpk-radio__input:checked+.bpk-radio__circle{display:block}.bpk-radio__input:checked:disabled+.bpk-radio__circle{display:block;background:rgba(0,0,0,0.2)}.bpk-radio__circle{position:absolute;top:0.375rem;left:0.375rem;display:none;width:.5rem;height:.5rem;border-radius:50%;background:#0062e3;background:var(--bpk-radio-checked-color, #0062e3)}html[dir='rtl'] .bpk-radio__circle{right:0.375rem;left:auto}
18
+ @keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-radio{position:relative;display:inline-block;padding-left:1.75rem}html[dir='rtl'] .bpk-radio{padding-right:1.75rem;padding-left:0}.bpk-radio--white{color:#fff}.bpk-radio--white input[type='radio']{background:#fff}.bpk-radio--disabled{color:rgba(0,0,0,0.2);cursor:not-allowed}.bpk-radio--disabled--white{color:rgba(255,255,255,0.5)}.bpk-radio--invalid input[type='radio']{border:3px solid #e70866;border-radius:1.5rem}.bpk-radio__input{position:absolute;top:0;left:0;width:1.25rem;height:1.25rem;margin:0;padding:0;cursor:pointer;vertical-align:text-bottom;appearance:none;border:3px solid #545860;border-radius:1.5rem}html[dir='rtl'] .bpk-radio__input{right:0;left:auto}@media screen\0 {.bpk-radio__input{background:none !important}}.bpk-radio__input:checked{border-color:#0062e3;border-color:var(--bpk-radio-checked-color, #0062e3)}.bpk-radio__input:checked:disabled{border-color:rgba(0,0,0,0.2)}.bpk-radio__input:disabled{border-color:rgba(0,0,0,0.2)}.bpk-radio__input:disabled{cursor:inherit}.bpk-radio__input:checked+.bpk-radio__circle{display:block}.bpk-radio__input:checked:disabled+.bpk-radio__circle{display:block;background:rgba(0,0,0,0.2)}.bpk-radio__circle{position:absolute;top:0.375rem;left:0.375rem;display:none;width:.5rem;height:.5rem;border-radius:50%;background:#0062e3;background:var(--bpk-radio-checked-color, #0062e3)}html[dir='rtl'] .bpk-radio__circle{right:0.375rem;left:auto}
@@ -0,0 +1,25 @@
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 { CALENDAR_SELECTION_TYPE } from '../bpk-component-calendar';
20
+ import BpkScrollableCalendar from './src/BpkScrollableCalendar';
21
+ import BpkScrollableCalendarDate from './src/BpkScrollableCalendarDate';
22
+ import BpkScrollableCalendarGrid from './src/BpkScrollableCalendarGrid';
23
+ import BpkScrollableCalendarGridList from './src/BpkScrollableCalendarGridList';
24
+ export default BpkScrollableCalendar;
25
+ export { CALENDAR_SELECTION_TYPE, BpkScrollableCalendarDate, BpkScrollableCalendarGrid, BpkScrollableCalendarGridList, };