@skyscanner/backpack-web 23.2.1 → 23.3.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 (111) hide show
  1. package/bpk-component-aria-live/src/BpkAriaLive.js +0 -1
  2. package/bpk-component-badge/src/BpkBadge.js +0 -1
  3. package/{bpk-scrim-utils/src/customPropTypes.js → bpk-component-banner-alert/index.d.ts} +16 -14
  4. package/bpk-component-banner-alert/src/AnimateAndFade.d.ts +61 -0
  5. package/bpk-component-banner-alert/src/AnimateAndFade.js +3 -9
  6. package/bpk-component-banner-alert/src/BpkBannerAlert.d.ts +29 -0
  7. package/bpk-component-banner-alert/src/BpkBannerAlert.js +42 -21
  8. package/bpk-component-banner-alert/src/BpkBannerAlertDismissable.d.ts +30 -0
  9. package/bpk-component-banner-alert/src/BpkBannerAlertDismissable.js +31 -33
  10. package/bpk-component-banner-alert/src/BpkBannerAlertExpandable.d.ts +35 -0
  11. package/bpk-component-banner-alert/src/BpkBannerAlertExpandable.js +15 -28
  12. package/bpk-component-banner-alert/src/BpkBannerAlertInner.d.ts +58 -0
  13. package/bpk-component-banner-alert/src/BpkBannerAlertInner.js +65 -87
  14. package/bpk-component-banner-alert/src/common-types.d.ts +44 -0
  15. package/bpk-component-banner-alert/src/common-types.js +5 -23
  16. package/bpk-component-banner-alert/src/themeAttributes.d.ts +20 -0
  17. package/bpk-component-banner-alert/src/withBannerAlertState.d.ts +169 -0
  18. package/bpk-component-banner-alert/src/withBannerAlertState.js +10 -29
  19. package/bpk-component-boilerplate/src/BpkBoilerplate.js +0 -1
  20. package/bpk-component-button/index.js +13 -0
  21. package/bpk-component-button/src/BpkButtonV2/BpkButton.js +0 -1
  22. package/bpk-component-calendar/index.d.ts +30 -0
  23. package/bpk-component-calendar/index.js +5 -4
  24. package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +429 -0
  25. package/bpk-component-calendar/src/BpkCalendarContainer.js +19 -29
  26. package/bpk-component-calendar/src/BpkCalendarDate.d.ts +62 -0
  27. package/bpk-component-calendar/src/BpkCalendarDate.js +15 -39
  28. package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +68 -0
  29. package/bpk-component-calendar/src/BpkCalendarGrid.js +9 -40
  30. package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +36 -0
  31. package/bpk-component-calendar/src/BpkCalendarGridHeader.js +33 -52
  32. package/bpk-component-calendar/src/BpkCalendarGridTransition.d.ts +56 -0
  33. package/bpk-component-calendar/src/BpkCalendarGridTransition.js +43 -42
  34. package/bpk-component-calendar/src/BpkCalendarNav.d.ts +37 -0
  35. package/bpk-component-calendar/src/BpkCalendarNav.js +18 -32
  36. package/bpk-component-calendar/src/Week.d.ts +51 -0
  37. package/bpk-component-calendar/src/Week.js +48 -70
  38. package/bpk-component-calendar/src/composeCalendar.d.ts +52 -0
  39. package/bpk-component-calendar/src/composeCalendar.js +34 -95
  40. package/bpk-component-calendar/src/custom-proptypes-legacy.js +140 -0
  41. package/bpk-component-calendar/src/custom-proptypes.d.ts +46 -0
  42. package/bpk-component-calendar/src/custom-proptypes.js +2 -61
  43. package/bpk-component-calendar/src/date-utils.d.ts +54 -0
  44. package/bpk-component-calendar/src/utils.d.ts +26 -0
  45. package/bpk-component-calendar/src/utils.js +1 -0
  46. package/bpk-component-calendar/test-utils.d.ts +56 -0
  47. package/bpk-component-calendar/test-utils.js +2 -2
  48. package/bpk-component-card/index.d.ts +24 -0
  49. package/bpk-component-card/src/BpkCard.d.ts +39 -0
  50. package/bpk-component-card/src/BpkCard.js +9 -25
  51. package/bpk-component-card/src/BpkCardWrapper.d.ts +33 -0
  52. package/bpk-component-card/src/BpkCardWrapper.js +10 -18
  53. package/bpk-component-card/src/BpkDividedCard.d.ts +43 -0
  54. package/bpk-component-card/src/BpkDividedCard.js +9 -24
  55. package/bpk-component-chip/index.d.ts +32 -0
  56. package/bpk-component-chip/src/BpkDismissibleChip.d.ts +28 -0
  57. package/bpk-component-chip/src/BpkDismissibleChip.js +9 -8
  58. package/bpk-component-chip/src/BpkDropdownChip.d.ts +29 -0
  59. package/bpk-component-chip/src/BpkDropdownChip.js +39 -25
  60. package/bpk-component-chip/src/BpkSelectableChip.d.ts +39 -0
  61. package/bpk-component-chip/src/BpkSelectableChip.js +34 -48
  62. package/bpk-component-chip/src/commonTypes.d.ts +56 -0
  63. package/bpk-component-chip/src/commonTypes.js +8 -2
  64. package/bpk-component-dialog/src/BpkDialog.js +0 -1
  65. package/bpk-component-dialog/src/BpkDialogInner.js +0 -2
  66. package/bpk-component-graphic-promotion/src/BpkGraphicPromo.js +0 -2
  67. package/bpk-component-icon/src/classNameModifierHOCFactory.js +0 -1
  68. package/bpk-component-icon/src/withAlignment.js +1 -1
  69. package/bpk-component-icon/src/withDescription.js +1 -1
  70. package/bpk-component-icon/src/withRtlSupport.js +0 -2
  71. package/bpk-component-input/index.d.ts +39 -0
  72. package/bpk-component-input/src/BpkClearButton.d.ts +28 -0
  73. package/bpk-component-input/src/BpkClearButton.js +6 -14
  74. package/bpk-component-input/src/BpkInput.d.ts +46 -0
  75. package/bpk-component-input/src/BpkInput.js +7 -3
  76. package/bpk-component-input/src/common-types.d.ts +91 -0
  77. package/bpk-component-input/src/common-types.js +4 -1
  78. package/bpk-component-input/src/withOpenEvents.d.ts +121 -0
  79. package/bpk-component-input/src/withOpenEvents.js +14 -25
  80. package/bpk-component-modal/index.js +11 -4
  81. package/bpk-component-modal/src/BpkModalV2/BpKModal.module.css +18 -0
  82. package/bpk-component-modal/src/BpkModalV2/BpkModal.d.ts +35 -0
  83. package/bpk-component-modal/src/BpkModalV2/BpkModal.js +133 -0
  84. package/bpk-component-rtl-toggle/index.d.ts +23 -0
  85. package/bpk-component-rtl-toggle/src/BpkRtlToggle.d.ts +41 -0
  86. package/bpk-component-rtl-toggle/src/BpkRtlToggle.js +9 -12
  87. package/bpk-component-rtl-toggle/src/updateOnDirectionChange.d.ts +151 -0
  88. package/bpk-component-rtl-toggle/src/updateOnDirectionChange.js +9 -2
  89. package/bpk-component-rtl-toggle/src/utils.d.ts +25 -0
  90. package/bpk-react-utils/index.d.ts +58 -0
  91. package/bpk-react-utils/index.js +1 -0
  92. package/bpk-react-utils/src/Portal.d.ts +76 -0
  93. package/bpk-react-utils/src/Portal.js +33 -43
  94. package/bpk-react-utils/src/TransitionInitialMount.d.ts +27 -0
  95. package/bpk-react-utils/src/TransitionInitialMount.js +7 -8
  96. package/bpk-react-utils/src/cssModules.d.ts +22 -0
  97. package/bpk-react-utils/src/deprecated.js +2 -1
  98. package/bpk-react-utils/src/deviceDetection.d.ts +22 -0
  99. package/bpk-react-utils/src/deviceDetection.js +3 -1
  100. package/bpk-react-utils/src/isRTL.d.ts +20 -0
  101. package/bpk-react-utils/src/isRTL.js +3 -1
  102. package/bpk-react-utils/src/withDefaultProps.d.ts +33 -0
  103. package/bpk-react-utils/src/withDefaultProps.js +11 -24
  104. package/bpk-react-utils/src/wrapDisplayName.d.ts +21 -0
  105. package/bpk-scrim-utils/src/BpkScrim.d.ts +24 -0
  106. package/bpk-scrim-utils/src/BpkScrim.js +5 -10
  107. package/bpk-scrim-utils/src/scroll-utils.d.ts +24 -0
  108. package/bpk-scrim-utils/src/scroll-utils.js +1 -1
  109. package/bpk-scrim-utils/src/withScrim.d.ts +95 -0
  110. package/bpk-scrim-utils/src/withScrim.js +5 -12
  111. package/package.json +1 -1
@@ -0,0 +1,58 @@
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="react" />
20
+ import wrapDisplayName from './src/wrapDisplayName';
21
+ import Portal from './src/Portal';
22
+ import TransitionInitialMount from './src/TransitionInitialMount';
23
+ import cssModules from './src/cssModules';
24
+ import deprecated from './src/deprecated';
25
+ import { isDeviceIphone, isDeviceIpad, isDeviceIos } from './src/deviceDetection';
26
+ import withDefaultProps from './src/withDefaultProps';
27
+ import isRTL from './src/isRTL';
28
+ export { Portal, TransitionInitialMount, cssModules, deprecated, withDefaultProps, wrapDisplayName, isDeviceIphone, isDeviceIpad, isDeviceIos, isRTL, };
29
+ declare const _default: {
30
+ Portal: typeof Portal;
31
+ TransitionInitialMount: ({ appearActiveClassName, appearClassName, children, transitionTimeout, }: {
32
+ appearClassName: string;
33
+ appearActiveClassName: string;
34
+ transitionTimeout: number;
35
+ children: import("react").ReactNode;
36
+ }) => JSX.Element;
37
+ cssModules: (styles?: {
38
+ [key: string]: any;
39
+ }) => (...classNames: (string | number | boolean | {} | null | undefined)[]) => string;
40
+ deprecated: any;
41
+ withDefaultProps: (WrappedComponent: import("react").ComponentType<any>, defaultProps: {
42
+ [rest: string]: any;
43
+ className?: string | undefined;
44
+ }) => {
45
+ ({ children, className: innerClassName, ...rest }: {
46
+ [rest: string]: any;
47
+ children?: import("react").ReactNode;
48
+ className?: string | null | undefined;
49
+ }): JSX.Element;
50
+ displayName: string;
51
+ };
52
+ wrapDisplayName: (Component: string | import("react").ComponentType<any> | null, hoc: string) => string;
53
+ isDeviceIphone: () => boolean;
54
+ isDeviceIpad: () => boolean;
55
+ isDeviceIos: () => boolean;
56
+ isRTL: () => boolean;
57
+ };
58
+ export default _default;
@@ -90,6 +90,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
90
90
  * See the License for the specific language governing permissions and
91
91
  * limitations under the License.
92
92
  */
93
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
93
94
  var _default = {
94
95
  Portal: _Portal.default,
95
96
  TransitionInitialMount: _TransitionInitialMount.default,
@@ -0,0 +1,76 @@
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 { Component } from 'react';
20
+ import type { ReactNode } from 'react';
21
+ type InteractionEvents = TouchEvent | MouseEvent | KeyboardEvent;
22
+ type Props = {
23
+ children: string | ReactNode;
24
+ isOpen: boolean;
25
+ beforeClose: ((arg0: () => void) => void) | null | undefined;
26
+ className: string | null | undefined;
27
+ onClose: (arg0: InteractionEvents, arg1: {
28
+ source: 'ESCAPE' | 'DOCUMENT_CLICK';
29
+ }) => void;
30
+ onOpen: (arg0: HTMLElement, arg1?: HTMLElement | null | undefined) => void;
31
+ onRender: (arg0: HTMLElement | null | undefined, arg1: HTMLElement | null | undefined) => void;
32
+ style: {} | null | undefined;
33
+ renderTarget: null | HTMLElement | (() => null | HTMLElement);
34
+ target: null | HTMLElement | JSX.Element | (() => HTMLElement);
35
+ targetRef: ((arg0: null | Element | Text | undefined) => void) | null | undefined;
36
+ closeOnEscPressed: boolean;
37
+ };
38
+ type State = {
39
+ isVisible: boolean;
40
+ };
41
+ declare class Portal extends Component<Props, State> {
42
+ portalElement: null | HTMLDivElement;
43
+ shouldClose: boolean;
44
+ static defaultProps: {
45
+ beforeClose: null;
46
+ className: null;
47
+ onClose: () => null;
48
+ onOpen: () => null;
49
+ onRender: () => null;
50
+ style: null;
51
+ renderTarget: null;
52
+ target: null;
53
+ targetRef: null;
54
+ closeOnEscPressed: boolean;
55
+ };
56
+ constructor(props: Props);
57
+ componentDidMount(): void;
58
+ componentDidUpdate(prevProps: Props): void;
59
+ componentWillUnmount(): void;
60
+ onDocumentMouseDown(event: MouseEvent | TouchEvent): void;
61
+ onDocumentMouseUp(event: MouseEvent | TouchEvent): void;
62
+ onDocumentKeyDown(event: KeyboardEvent): void;
63
+ onDocumentMouseMove(): void;
64
+ getClickEventProperties(event: MouseEvent | TouchEvent): {
65
+ isNotLeftClick: boolean;
66
+ isTargetClick: boolean;
67
+ isPortalClick: boolean;
68
+ };
69
+ getTargetElement(): HTMLElement | null;
70
+ getRenderTarget(): HTMLElement;
71
+ open(): void;
72
+ close(): void;
73
+ supportsPassiveEvents(): boolean;
74
+ render(): import("react").ReactPortal | null;
75
+ }
76
+ export default Portal;
@@ -7,33 +7,35 @@ exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _reactDom = require("react-dom");
9
9
  var _objectAssign = _interopRequireDefault(require("object-assign"));
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
10
  var _jsxRuntime = require("react/jsx-runtime");
12
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- /*
14
- * Backpack - Skyscanner's Design System
15
- *
16
- * Copyright 2016 Skyscanner Ltd
17
- *
18
- * Licensed under the Apache License, Version 2.0 (the "License");
19
- * you may not use this file except in compliance with the License.
20
- * You may obtain a copy of the License at
21
- *
22
- * http://www.apache.org/licenses/LICENSE-2.0
23
- *
24
- * Unless required by applicable law or agreed to in writing, software
25
- * distributed under the License is distributed on an "AS IS" BASIS,
26
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27
- * See the License for the specific language governing permissions and
28
- * limitations under the License.
29
- */
30
-
12
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
14
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*
15
+ * Backpack - Skyscanner's Design System
16
+ *
17
+ * Copyright 2016 Skyscanner Ltd
18
+ *
19
+ * Licensed under the Apache License, Version 2.0 (the "License");
20
+ * you may not use this file except in compliance with the License.
21
+ * You may obtain a copy of the License at
22
+ *
23
+ * http://www.apache.org/licenses/LICENSE-2.0
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software
26
+ * distributed under the License is distributed on an "AS IS" BASIS,
27
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ * See the License for the specific language governing permissions and
29
+ * limitations under the License.
30
+ */ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
31
31
  const KEYCODES = {
32
32
  ESCAPE: 'Escape'
33
33
  };
34
34
  class Portal extends _react.Component {
35
- constructor() {
36
- super();
35
+ constructor(props) {
36
+ super(props);
37
+ _defineProperty(this, "portalElement", void 0);
38
+ _defineProperty(this, "shouldClose", void 0);
37
39
  this.portalElement = null;
38
40
  this.state = {
39
41
  isVisible: false
@@ -115,6 +117,7 @@ class Portal extends _react.Component {
115
117
  this.shouldClose = false;
116
118
  }
117
119
  getClickEventProperties(event) {
120
+ // @ts-expect-error FIXME: TS2339: Property 'button' does not exist on type 'TouchEvent | MouseEvent'.
118
121
  const isNotLeftClick = event.button && event.button !== 0;
119
122
  const targetElement = this.getTargetElement();
120
123
  const isTargetClick = targetElement && event.target instanceof Node && (event.target === targetElement || targetElement.contains(event.target));
@@ -142,8 +145,8 @@ class Portal extends _react.Component {
142
145
  if (this.portalElement) {
143
146
  return;
144
147
  }
145
- this.portalElement = document.createElement('div');
146
- this.getRenderTarget().appendChild(this.portalElement);
148
+ const portalElement = document.createElement('div');
149
+ this.getRenderTarget().appendChild(portalElement);
147
150
  const passiveArgs = this.supportsPassiveEvents() ? {
148
151
  passive: true
149
152
  } : false;
@@ -154,14 +157,15 @@ class Portal extends _react.Component {
154
157
  document.addEventListener('mouseup', this.onDocumentMouseUp, false);
155
158
  document.addEventListener('keydown', this.onDocumentKeyDown, false);
156
159
  if (this.props.style) {
157
- (0, _objectAssign.default)(this.portalElement.style, this.props.style);
160
+ (0, _objectAssign.default)(portalElement.style, this.props.style);
158
161
  }
159
162
  if (this.props.className) {
160
- this.portalElement.className = this.props.className;
163
+ portalElement.className = this.props.className;
161
164
  }
165
+ this.portalElement = portalElement;
162
166
  this.setState({
163
167
  isVisible: true
164
- }, () => this.props.onOpen(this.portalElement, this.getTargetElement()));
168
+ }, () => this.props.onOpen(portalElement, this.getTargetElement()));
165
169
  }
166
170
  close() {
167
171
  if (!this.portalElement) {
@@ -195,6 +199,7 @@ class Portal extends _react.Component {
195
199
  supportsPassiveOption = true;
196
200
  }
197
201
  });
202
+ // @ts-expect-error FIXME: TS2769: No overload matches this call.
198
203
  window.addEventListener('test', null, opts);
199
204
  } catch (e) {
200
205
  return false;
@@ -227,22 +232,7 @@ class Portal extends _react.Component {
227
232
  }), portalElement);
228
233
  }
229
234
  }
230
- Portal.propTypes = {
231
- children: _propTypes.default.node.isRequired,
232
- isOpen: _propTypes.default.bool.isRequired,
233
- beforeClose: _propTypes.default.func,
234
- className: _propTypes.default.string,
235
- onClose: _propTypes.default.func,
236
- onOpen: _propTypes.default.func,
237
- onRender: _propTypes.default.func,
238
- style: _propTypes.default.object,
239
- // eslint-disable-line react/forbid-prop-types
240
- renderTarget: _propTypes.default.func,
241
- target: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]),
242
- targetRef: _propTypes.default.func,
243
- closeOnEscPressed: _propTypes.default.bool
244
- };
245
- Portal.defaultProps = {
235
+ _defineProperty(Portal, "defaultProps", {
246
236
  beforeClose: null,
247
237
  className: null,
248
238
  onClose: () => null,
@@ -253,6 +243,6 @@ Portal.defaultProps = {
253
243
  target: null,
254
244
  targetRef: null,
255
245
  closeOnEscPressed: true
256
- };
246
+ });
257
247
  var _default = Portal;
258
248
  exports.default = _default;
@@ -0,0 +1,27 @@
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 { ReactNode } from 'react';
20
+ type Props = {
21
+ appearClassName: string;
22
+ appearActiveClassName: string;
23
+ transitionTimeout: number;
24
+ children: string | ReactNode;
25
+ };
26
+ declare const TransitionInitialMount: ({ appearActiveClassName, appearClassName, children, transitionTimeout, }: Props) => JSX.Element;
27
+ export default TransitionInitialMount;
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _objectAssign = _interopRequireDefault(require("object-assign"));
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
8
  var _CSSTransition = _interopRequireDefault(require("react-transition-group/CSSTransition"));
10
9
  var _jsxRuntime = require("react/jsx-runtime");
11
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -25,7 +24,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
25
24
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
25
  * See the License for the specific language governing permissions and
27
26
  * limitations under the License.
28
- */ // Object.assign() is used unpolyfilled in react-transition-group.
27
+ */
28
+
29
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
30
+
31
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
32
+
33
+ // Object.assign() is used unpolyfilled in react-transition-group.
29
34
  // It will use the native implementation if it's present and isn't buggy.
30
35
  Object.assign = _objectAssign.default;
31
36
  const TransitionInitialMount = ({
@@ -47,11 +52,5 @@ const TransitionInitialMount = ({
47
52
  },
48
53
  children: children
49
54
  });
50
- TransitionInitialMount.propTypes = {
51
- children: _propTypes.default.node.isRequired,
52
- appearClassName: _propTypes.default.string.isRequired,
53
- appearActiveClassName: _propTypes.default.string.isRequired,
54
- transitionTimeout: _propTypes.default.number.isRequired
55
- };
56
55
  var _default = TransitionInitialMount;
57
56
  exports.default = _default;
@@ -0,0 +1,22 @@
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 _default: (styles?: {
20
+ [key: string]: any;
21
+ }) => (...classNames: Array<string | boolean | number | {} | null | undefined>) => string;
22
+ export default _default;
@@ -20,7 +20,8 @@ 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
- */ // We disable eslint on the below line because it breaks the flow type definitions and the FlowIssue comment below
23
+ */ // TODO: Remove this file once all BPK components have been migrated to TS
24
+ // We disable eslint on the below line because it breaks the flow type definitions and the FlowIssue comment below
24
25
  // We can remove this when we migrate this file to TypeScript.
25
26
  // $FlowIssue[value-as-type] - PropType is imported as a type so is incorrectly reporting the PropType is not a valid type
26
27
  const deprecated = (propType, alternativeSuggestion) =>
@@ -0,0 +1,22 @@
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 isDeviceIphone: () => boolean;
20
+ declare const isDeviceIpad: () => boolean;
21
+ declare const isDeviceIos: () => boolean;
22
+ export { isDeviceIphone, isDeviceIpad, isDeviceIos };
@@ -20,7 +20,9 @@ exports.isDeviceIphone = exports.isDeviceIpad = exports.isDeviceIos = 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 isDeviceIphone = () => /iPhone/i.test(typeof window !== 'undefined' ? window.navigator.userAgent : '');
23
+ */
24
+
25
+ const isDeviceIphone = () => /iPhone/i.test(typeof window !== 'undefined' ? window.navigator.userAgent : '');
24
26
  exports.isDeviceIphone = isDeviceIphone;
25
27
  const isDeviceIpad = () => /iPad/i.test(typeof window !== 'undefined' ? window.navigator.userAgent : '');
26
28
  exports.isDeviceIpad = isDeviceIpad;
@@ -0,0 +1,20 @@
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 isRTL: () => boolean;
20
+ export default isRTL;
@@ -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 DIRECTIONS = {
23
+ */
24
+
25
+ const DIRECTIONS = {
24
26
  LTR: 'ltr',
25
27
  RTL: 'rtl'
26
28
  };
@@ -0,0 +1,33 @@
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 { ReactNode, ComponentType } from 'react';
20
+ type Props = {
21
+ children?: ReactNode | string;
22
+ className?: string | null;
23
+ [rest: string]: any;
24
+ };
25
+ type DefaultProps = {
26
+ className?: string;
27
+ [rest: string]: any;
28
+ };
29
+ declare const withDefaultProps: (WrappedComponent: ComponentType<any>, defaultProps: DefaultProps) => {
30
+ ({ children, className: innerClassName, ...rest }: Props): JSX.Element;
31
+ displayName: string;
32
+ };
33
+ export default withDefaultProps;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _propTypes = _interopRequireDefault(require("prop-types"));
8
7
  var _wrapDisplayName = _interopRequireDefault(require("./wrapDisplayName"));
9
8
  var _jsxRuntime = require("react/jsx-runtime");
10
9
  const _excluded = ["className"],
@@ -39,12 +38,12 @@ const withDefaultProps = (WrappedComponent, defaultProps) => {
39
38
  className: defaultClassName
40
39
  } = defaultProps,
41
40
  defaultRest = _objectWithoutProperties(defaultProps, _excluded);
42
- const component = props => {
43
- const {
44
- children,
45
- className: innerClassName
46
- } = props,
47
- rest = _objectWithoutProperties(props, _excluded2);
41
+ const component = _ref => {
42
+ let {
43
+ children = null,
44
+ className: innerClassName = null
45
+ } = _ref,
46
+ rest = _objectWithoutProperties(_ref, _excluded2);
48
47
  const classNames = [];
49
48
  if (defaultClassName) {
50
49
  classNames.push(defaultClassName);
@@ -52,23 +51,11 @@ const withDefaultProps = (WrappedComponent, defaultProps) => {
52
51
  if (innerClassName) {
53
52
  classNames.push(innerClassName);
54
53
  }
55
- return (
56
- /*#__PURE__*/
57
- // $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
58
- (0, _jsxRuntime.jsx)(WrappedComponent, _objectSpread(_objectSpread(_objectSpread({
59
- className: classNames.join(' ')
60
- }, defaultRest), rest), {}, {
61
- children: children
62
- }))
63
- );
64
- };
65
- component.propTypes = {
66
- children: _propTypes.default.node,
67
- className: _propTypes.default.string
68
- };
69
- component.defaultProps = {
70
- children: null,
71
- className: null
54
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedComponent, _objectSpread(_objectSpread(_objectSpread({
55
+ className: classNames.join(' ')
56
+ }, defaultRest), rest), {}, {
57
+ children: children
58
+ }));
72
59
  };
73
60
  component.displayName = (0, _wrapDisplayName.default)(WrappedComponent, 'withDefaultProps');
74
61
  return component;
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ import type { ComponentType } from 'react';
20
+ declare const wrapDisplayName: (Component: ComponentType<any> | string | null, hoc: string) => string;
21
+ export default wrapDisplayName;
@@ -0,0 +1,24 @@
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 { SyntheticEvent } from 'react';
20
+ type Props = {
21
+ onClose?: (e?: SyntheticEvent) => void | null;
22
+ };
23
+ declare const BpkScrim: ({ onClose }: Props) => JSX.Element;
24
+ export default BpkScrim;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _propTypes = _interopRequireDefault(require("prop-types"));
8
7
  var _bpkReactUtils = require("../../bpk-react-utils");
9
8
  var _bpkScrimModule = _interopRequireDefault(require("./bpk-scrim.module.css"));
10
9
  var _jsxRuntime = require("react/jsx-runtime");
@@ -28,22 +27,18 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
28
27
  */
29
28
 
30
29
  const getClassName = (0, _bpkReactUtils.cssModules)(_bpkScrimModule.default);
31
- const BpkScrim = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkReactUtils.TransitionInitialMount, {
30
+ const BpkScrim = ({
31
+ onClose = () => {}
32
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkReactUtils.TransitionInitialMount, {
32
33
  appearClassName: getClassName('bpk-scrim--appear'),
33
34
  appearActiveClassName: getClassName('bpk-scrim--appear-active'),
34
35
  transitionTimeout: 200,
35
36
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
36
37
  role: "presentation",
37
38
  className: getClassName('bpk-scrim'),
38
- onMouseDown: props.onClose,
39
- onTouchStart: props.onClose
39
+ onMouseDown: onClose,
40
+ onTouchStart: onClose
40
41
  })
41
42
  });
42
- BpkScrim.propTypes = {
43
- onClose: _propTypes.default.func
44
- };
45
- BpkScrim.defaultProps = {
46
- onClose: null
47
- };
48
43
  var _default = BpkScrim;
49
44
  exports.default = _default;
@@ -0,0 +1,24 @@
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 declare const storeScroll: () => void;
20
+ export declare const restoreScroll: () => void;
21
+ export declare const fixBody: () => void;
22
+ export declare const unfixBody: () => void;
23
+ export declare const lockScroll: () => void;
24
+ export declare const unlockScroll: () => void;