@skyscanner/backpack-web 23.3.0 → 24.0.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 (35) hide show
  1. package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +74 -39
  2. package/bpk-component-calendar/src/BpkCalendarContainer.js +4 -4
  3. package/bpk-component-calendar/src/composeCalendar.d.ts +6 -3
  4. package/bpk-component-calendar/src/composeCalendar.js +3 -3
  5. package/bpk-component-chip/src/BpkSelectableChip.js +0 -1
  6. package/bpk-component-dialog/src/BpkDialog.d.ts +1 -12
  7. package/bpk-component-dialog/src/BpkDialog.js +1 -1
  8. package/bpk-component-dialog/src/BpkDialogInner.d.ts +256 -2
  9. package/bpk-component-dialog/src/BpkDialogInner.js +0 -2
  10. package/bpk-component-dialog/src/common-types.d.ts +20 -21
  11. package/bpk-component-graphic-promotion/src/BpkGraphicPromo.js +0 -2
  12. package/bpk-component-modal/index.d.ts +26 -0
  13. package/bpk-component-modal/index.js +5 -5
  14. package/bpk-component-modal/src/BpkModal.d.ts +32 -0
  15. package/bpk-component-modal/src/BpkModal.js +24 -44
  16. package/bpk-component-modal/src/BpkModalInner.d.ts +39 -0
  17. package/bpk-component-modal/src/BpkModalInner.js +67 -84
  18. package/bpk-component-modal/src/BpkModalV2/BpkModal.js +0 -2
  19. package/bpk-component-modal/src/legacy-prop-types.js +86 -0
  20. package/bpk-component-modal/src/themeAttributes.js +1 -0
  21. package/bpk-component-text/index.d.ts +21 -0
  22. package/bpk-component-text/index.js +0 -6
  23. package/bpk-component-text/src/BpkText.d.ts +60 -0
  24. package/bpk-component-text/src/BpkText.js +16 -56
  25. package/bpk-component-text/src/BpkText.module.css +1 -1
  26. package/bpk-component-tooltip/index.d.ts +24 -0
  27. package/bpk-component-tooltip/src/BpkTooltip.d.ts +29 -0
  28. package/bpk-component-tooltip/src/BpkTooltip.js +9 -26
  29. package/bpk-component-tooltip/src/BpkTooltipPortal.d.ts +60 -0
  30. package/bpk-component-tooltip/src/BpkTooltipPortal.js +13 -21
  31. package/bpk-component-tooltip/src/constants.d.ts +31 -0
  32. package/bpk-component-tooltip/src/constants.js +3 -1
  33. package/bpk-scrim-utils/index.d.ts +283 -0
  34. package/bpk-scrim-utils/src/withScrim.d.ts +2 -1
  35. package/package.json +1 -1
@@ -0,0 +1,26 @@
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 { BpkModalV2 } from './src/BpkModalV2/BpkModal';
20
+ import themeAttributes from './src/themeAttributes';
21
+ import BpkModal from './src/BpkModal';
22
+ import type { Props } from './src/BpkModal';
23
+ import { propTypes, defaultProps } from './src/legacy-prop-types';
24
+ export type BpkModalProps = Props;
25
+ export default BpkModal;
26
+ export { propTypes, defaultProps, themeAttributes, BpkModalV2 };
@@ -13,13 +13,13 @@ exports.default = void 0;
13
13
  Object.defineProperty(exports, "defaultProps", {
14
14
  enumerable: true,
15
15
  get: function () {
16
- return _BpkModal2.defaultProps;
16
+ return _legacyPropTypes.defaultProps;
17
17
  }
18
18
  });
19
19
  Object.defineProperty(exports, "propTypes", {
20
20
  enumerable: true,
21
21
  get: function () {
22
- return _BpkModal2.propTypes;
22
+ return _legacyPropTypes.propTypes;
23
23
  }
24
24
  });
25
25
  Object.defineProperty(exports, "themeAttributes", {
@@ -30,9 +30,8 @@ Object.defineProperty(exports, "themeAttributes", {
30
30
  });
31
31
  var _BpkModal = require("./src/BpkModalV2/BpkModal");
32
32
  var _themeAttributes = _interopRequireDefault(require("./src/themeAttributes"));
33
- var _BpkModal2 = _interopRequireWildcard(require("./src/BpkModal"));
34
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
+ var _BpkModal2 = _interopRequireDefault(require("./src/BpkModal"));
34
+ var _legacyPropTypes = require("./src/legacy-prop-types");
36
35
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
36
  /*
38
37
  * Backpack - Skyscanner's Design System
@@ -51,5 +50,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
51
50
  * See the License for the specific language governing permissions and
52
51
  * limitations under the License.
53
52
  */
53
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
54
54
  var _default = _BpkModal2.default;
55
55
  exports.default = _default;
@@ -0,0 +1,32 @@
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 type { Props as ModalDialogProps } from './BpkModalInner';
21
+ export type Props = ModalDialogProps & {
22
+ isOpen: boolean;
23
+ closeOnScrimClick?: boolean;
24
+ closeOnEscPressed?: boolean;
25
+ renderTarget?: null | HTMLElement | (() => null | HTMLElement);
26
+ onClose: (arg0: TouchEvent | MouseEvent | KeyboardEvent, arg1: {
27
+ source: 'ESCAPE' | 'DOCUMENT_CLICK';
28
+ }) => void;
29
+ getApplicationElement: () => HTMLElement | null;
30
+ };
31
+ declare const BpkModal: ({ title, onClose, className, contentClassName, closeLabel, closeText, wide, showHeader, fullScreenOnMobile, fullScreen, padded, accessoryView, renderTarget, isIphone, closeOnScrimClick, closeOnEscPressed, isOpen, ...rest }: Props) => JSX.Element;
32
+ export default BpkModal;
@@ -3,14 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.propTypes = exports.defaultProps = exports.default = void 0;
7
- var _propTypes = _interopRequireDefault(require("prop-types"));
6
+ exports.default = void 0;
8
7
  var _bpkScrimUtils = require("../../bpk-scrim-utils");
9
8
  var _bpkReactUtils = require("../../bpk-react-utils");
10
9
  var _BpkModalModule = _interopRequireDefault(require("./BpkModal.module.css"));
11
- var _BpkModalInner = _interopRequireWildcard(require("./BpkModalInner"));
10
+ var _BpkModalInner = _interopRequireDefault(require("./BpkModalInner"));
12
11
  var _jsxRuntime = require("react/jsx-runtime");
13
- const _excluded = ["closeOnEscPressed", "closeOnScrimClick", "fullScreen", "fullScreenOnMobile", "isIphone", "isOpen", "onClose", "renderTarget"];
12
+ const _excluded = ["title", "onClose", "className", "contentClassName", "closeLabel", "closeText", "wide", "showHeader", "fullScreenOnMobile", "fullScreen", "padded", "accessoryView", "renderTarget", "isIphone", "closeOnScrimClick", "closeOnEscPressed", "isOpen"];
14
13
  /*
15
14
  * Backpack - Skyscanner's Design System
16
15
  *
@@ -28,8 +27,6 @@ const _excluded = ["closeOnEscPressed", "closeOnScrimClick", "fullScreen", "full
28
27
  * See the License for the specific language governing permissions and
29
28
  * limitations under the License.
30
29
  */
31
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
32
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
34
31
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
35
32
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -40,21 +37,27 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
40
37
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
41
38
  const getClassName = (0, _bpkReactUtils.cssModules)(_BpkModalModule.default);
42
39
  const ScrimBpkModalInner = (0, _bpkScrimUtils.withScrim)(_BpkModalInner.default);
43
-
44
- // Please remove this type when `withScrim` is flow-typed
45
-
46
- const BpkModal = props => {
47
- const {
48
- closeOnEscPressed,
49
- closeOnScrimClick,
50
- fullScreen,
51
- fullScreenOnMobile,
52
- isIphone,
53
- isOpen,
54
- onClose,
55
- renderTarget
56
- } = props,
57
- rest = _objectWithoutProperties(props, _excluded);
40
+ const BpkModal = _ref => {
41
+ let {
42
+ title = null,
43
+ onClose = () => null,
44
+ className = null,
45
+ contentClassName = null,
46
+ closeLabel = '',
47
+ closeText = null,
48
+ wide = false,
49
+ showHeader = true,
50
+ fullScreenOnMobile = true,
51
+ fullScreen = false,
52
+ padded = true,
53
+ accessoryView = null,
54
+ renderTarget = null,
55
+ isIphone = (0, _bpkReactUtils.isDeviceIphone)(),
56
+ closeOnScrimClick = true,
57
+ closeOnEscPressed = true,
58
+ isOpen
59
+ } = _ref,
60
+ rest = _objectWithoutProperties(_ref, _excluded);
58
61
  const containerClass = [getClassName('bpk-modal__container')];
59
62
  if (fullScreen || isIphone) {
60
63
  containerClass.push(getClassName('bpk-modal__container--full-screen'));
@@ -76,28 +79,5 @@ const BpkModal = props => {
76
79
  }, rest))
77
80
  });
78
81
  };
79
- const {
80
- dialogRef
81
- } = _BpkModalInner.propTypes,
82
- newModalDialogPropTypes = _objectWithoutProperties(_BpkModalInner.propTypes, ["dialogRef"]);
83
- const propTypes = _objectSpread(_objectSpread({}, newModalDialogPropTypes), {}, {
84
- onClose: _propTypes.default.func,
85
- isIphone: _propTypes.default.bool,
86
- isOpen: _propTypes.default.bool.isRequired,
87
- renderTarget: _propTypes.default.func,
88
- closeOnScrimClick: _propTypes.default.bool,
89
- closeOnEscPressed: _propTypes.default.bool
90
- });
91
- exports.propTypes = propTypes;
92
- const defaultProps = _objectSpread(_objectSpread({}, _BpkModalInner.defaultProps), {}, {
93
- onClose: () => null,
94
- renderTarget: null,
95
- isIphone: (0, _bpkReactUtils.isDeviceIphone)(),
96
- closeOnScrimClick: true,
97
- closeOnEscPressed: true
98
- });
99
- exports.defaultProps = defaultProps;
100
- BpkModal.propTypes = _objectSpread({}, propTypes);
101
- BpkModal.defaultProps = _objectSpread({}, defaultProps);
102
82
  var _default = BpkModal;
103
83
  exports.default = _default;
@@ -0,0 +1,39 @@
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
+ export type Props = {
21
+ id: string;
22
+ children: ReactNode;
23
+ wide?: boolean;
24
+ isIphone: boolean;
25
+ showHeader?: boolean;
26
+ fullScreenOnMobile?: boolean;
27
+ fullScreen?: boolean;
28
+ padded?: boolean;
29
+ dialogRef: (ref: HTMLElement | null | undefined) => void;
30
+ onClose?: () => void;
31
+ className?: string | null;
32
+ contentClassName?: string | null;
33
+ title?: string | null;
34
+ closeLabel?: string;
35
+ closeText?: string | null;
36
+ accessoryView?: ReactNode;
37
+ };
38
+ declare const BpkModalInner: ({ isIphone, id, dialogRef, children, title, onClose, className, contentClassName, closeLabel, closeText, wide, showHeader, fullScreenOnMobile, fullScreen, padded, accessoryView, ...rest }: Props) => JSX.Element;
39
+ export default BpkModalInner;
@@ -3,76 +3,95 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.propTypes = exports.defaultProps = exports.default = void 0;
7
- var _propTypes = _interopRequireDefault(require("prop-types"));
6
+ exports.default = void 0;
8
7
  var _bpkComponentLink = require("../../bpk-component-link");
9
8
  var _bpkComponentCloseButton = _interopRequireDefault(require("../../bpk-component-close-button"));
10
9
  var _bpkComponentNavigationBar = _interopRequireDefault(require("../../bpk-component-navigation-bar"));
11
10
  var _bpkReactUtils = require("../../bpk-react-utils");
12
11
  var _BpkModalInnerModule = _interopRequireDefault(require("./BpkModalInner.module.css"));
13
- var _customPropTypes = require("./customPropTypes");
14
12
  var _jsxRuntime = require("react/jsx-runtime");
13
+ const _excluded = ["isIphone", "id", "dialogRef", "children", "title", "onClose", "className", "contentClassName", "closeLabel", "closeText", "wide", "showHeader", "fullScreenOnMobile", "fullScreen", "padded", "accessoryView"];
14
+ /*
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
+ */
31
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
32
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
33
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
15
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
- 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; }
19
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
20
- 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); } /*
21
- * Backpack - Skyscanner's Design System
22
- *
23
- * Copyright 2016 Skyscanner Ltd
24
- *
25
- * Licensed under the Apache License, Version 2.0 (the "License");
26
- * you may not use this file except in compliance with the License.
27
- * You may obtain a copy of the License at
28
- *
29
- * http://www.apache.org/licenses/LICENSE-2.0
30
- *
31
- * Unless required by applicable law or agreed to in writing, software
32
- * distributed under the License is distributed on an "AS IS" BASIS,
33
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
- * See the License for the specific language governing permissions and
35
- * limitations under the License.
36
- */
35
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
36
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
37
37
  const getClassName = (0, _bpkReactUtils.cssModules)(_BpkModalInnerModule.default);
38
- const BpkModalInner = props => {
38
+ const BpkModalInner = _ref => {
39
+ let {
40
+ isIphone,
41
+ id,
42
+ dialogRef,
43
+ children,
44
+ title = null,
45
+ onClose = () => null,
46
+ className = null,
47
+ contentClassName = null,
48
+ closeLabel = '',
49
+ closeText = null,
50
+ wide = false,
51
+ showHeader = true,
52
+ fullScreenOnMobile = true,
53
+ fullScreen = false,
54
+ padded = true,
55
+ accessoryView = null
56
+ } = _ref,
57
+ rest = _objectWithoutProperties(_ref, _excluded);
39
58
  const classNames = [getClassName('bpk-modal')];
40
59
  const contentClassNames = [getClassName('bpk-modal__content')];
41
60
  const navigationStyles = [getClassName('bpk-modal__navigation')];
42
- if (props.wide) {
61
+ if (wide) {
43
62
  classNames.push(getClassName('bpk-modal--wide'));
44
63
  }
45
- if (props.className) {
46
- classNames.push(props.className);
64
+ if (className) {
65
+ classNames.push(className);
47
66
  }
48
- if (props.fullScreen || props.isIphone) {
67
+ if (fullScreen || isIphone) {
49
68
  classNames.push(getClassName('bpk-modal--full-screen'));
50
- } else if (props.fullScreenOnMobile) {
69
+ } else if (fullScreenOnMobile) {
51
70
  classNames.push(getClassName('bpk-modal--full-screen-mobile'));
52
71
  }
53
- if (props.padded) {
72
+ if (padded) {
54
73
  contentClassNames.push(getClassName('bpk-modal__content--padded'));
55
74
  }
56
- if (props.contentClassName) {
57
- contentClassNames.push(props.contentClassName);
75
+ if (contentClassName) {
76
+ contentClassNames.push(contentClassName);
58
77
  }
59
- const headingId = `bpk-modal-heading-${props.id}`;
60
- const accessoryViewFinal = props.accessoryView ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
78
+ const headingId = `bpk-modal-heading-${id}`;
79
+ const accessoryViewFinal = accessoryView ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
61
80
  className: getClassName('bpk-modal__accessory-view'),
62
- children: props.accessoryView
81
+ children: accessoryView
63
82
  }) : null;
64
83
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkReactUtils.TransitionInitialMount, {
65
84
  appearClassName: getClassName('bpk-modal--appear'),
66
85
  appearActiveClassName: getClassName('bpk-modal--appear-active'),
67
86
  transitionTimeout: 300,
68
87
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
69
- id: props.id,
70
- tabIndex: "-1",
88
+ id: id,
89
+ tabIndex: -1,
71
90
  role: "dialog",
72
- "aria-labelledby": props.showHeader ? headingId : null,
91
+ "aria-labelledby": showHeader ? headingId : undefined,
73
92
  className: classNames.join(' '),
74
- ref: props.dialogRef,
75
- children: [props.showHeader && /*#__PURE__*/(0, _jsxRuntime.jsx)("header", {
93
+ ref: dialogRef,
94
+ children: [showHeader && /*#__PURE__*/(0, _jsxRuntime.jsx)("header", {
76
95
  className: getClassName('bpk-modal__header'),
77
96
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentNavigationBar.default, {
78
97
  id: headingId,
@@ -80,61 +99,25 @@ const BpkModalInner = props => {
80
99
  title: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
81
100
  id: headingId,
82
101
  className: getClassName('bpk-modal__heading'),
83
- children: props.title
102
+ children: title
84
103
  }),
85
104
  leadingButton: accessoryViewFinal,
86
- trailingButton: props.closeText ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentLink.BpkButtonLink, {
105
+ trailingButton: closeText ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentLink.BpkButtonLink, {
87
106
  className: getClassName('bpk-modal__close-button'),
88
- onClick: props.onClose,
89
- children: props.closeText
107
+ onClick: onClose,
108
+ children: closeText
90
109
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentCloseButton.default, {
91
110
  className: getClassName('bpk-modal__close-button'),
92
- label: props.closeLabel,
93
- onClick: props.onClose
111
+ label: closeLabel,
112
+ onClick: onClose
94
113
  })
95
114
  })
96
115
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
97
116
  className: contentClassNames.join(' '),
98
- children: props.children
117
+ children: children
99
118
  })]
100
119
  })
101
120
  });
102
121
  };
103
- const propTypes = {
104
- id: _propTypes.default.string.isRequired,
105
- children: _propTypes.default.node.isRequired,
106
- isIphone: _propTypes.default.bool.isRequired,
107
- dialogRef: _propTypes.default.func.isRequired,
108
- title: _customPropTypes.titlePropType,
109
- onClose: _customPropTypes.onClosePropType,
110
- className: _propTypes.default.string,
111
- contentClassName: _propTypes.default.string,
112
- closeLabel: _propTypes.default.string,
113
- closeText: _propTypes.default.string,
114
- wide: _propTypes.default.bool,
115
- showHeader: _propTypes.default.bool,
116
- fullScreenOnMobile: _propTypes.default.bool,
117
- fullScreen: _propTypes.default.bool,
118
- padded: _propTypes.default.bool,
119
- accesoryView: _propTypes.default.func
120
- };
121
- exports.propTypes = propTypes;
122
- const defaultProps = {
123
- title: null,
124
- onClose: () => null,
125
- className: null,
126
- contentClassName: null,
127
- closeLabel: '',
128
- closeText: null,
129
- wide: false,
130
- showHeader: true,
131
- fullScreenOnMobile: true,
132
- fullScreen: false,
133
- padded: true,
134
- accessoryView: null
135
- };
136
- exports.defaultProps = defaultProps;
137
- BpkModalInner.propTypes = _objectSpread({}, propTypes);
138
- BpkModalInner.defaultProps = _objectSpread({}, defaultProps);
139
122
  var _default = BpkModalInner;
140
123
  exports.default = _default;
@@ -33,8 +33,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
33
33
 
34
34
  // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
35
35
 
36
- // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
37
-
38
36
  const getClassName = (0, _bpkReactUtils.cssModules)(_BpKModalModule.default);
39
37
  const Heading = (0, _bpkReactUtils.withDefaultProps)(_bpkComponentText.default, {
40
38
  textStyle: _bpkComponentText.TEXT_STYLES.label1,
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.propTypes = exports.defaultProps = void 0;
7
+ var _propTypes = _interopRequireDefault(require("prop-types"));
8
+ var _bpkReactUtils = require("../../bpk-react-utils");
9
+ var _customPropTypes = require("./customPropTypes");
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
+ 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; }
14
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
15
+ 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); }
16
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
17
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } /*
18
+ * Backpack - Skyscanner's Design System
19
+ *
20
+ * Copyright 2016 Skyscanner Ltd
21
+ *
22
+ * Licensed under the Apache License, Version 2.0 (the "License");
23
+ * you may not use this file except in compliance with the License.
24
+ * You may obtain a copy of the License at
25
+ *
26
+ * http://www.apache.org/licenses/LICENSE-2.0
27
+ *
28
+ * Unless required by applicable law or agreed to in writing, software
29
+ * distributed under the License is distributed on an "AS IS" BASIS,
30
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
+ * See the License for the specific language governing permissions and
32
+ * limitations under the License.
33
+ */
34
+ const modalDialogPropTypes = {
35
+ id: _propTypes.default.string.isRequired,
36
+ children: _propTypes.default.node.isRequired,
37
+ isIphone: _propTypes.default.bool.isRequired,
38
+ dialogRef: _propTypes.default.func.isRequired,
39
+ title: _customPropTypes.titlePropType,
40
+ onClose: _customPropTypes.onClosePropType,
41
+ className: _propTypes.default.string,
42
+ contentClassName: _propTypes.default.string,
43
+ closeLabel: _propTypes.default.string,
44
+ closeText: _propTypes.default.string,
45
+ wide: _propTypes.default.bool,
46
+ showHeader: _propTypes.default.bool,
47
+ fullScreenOnMobile: _propTypes.default.bool,
48
+ fullScreen: _propTypes.default.bool,
49
+ padded: _propTypes.default.bool,
50
+ accesoryView: _propTypes.default.func
51
+ };
52
+ const modalDialogDefaultProps = {
53
+ title: null,
54
+ onClose: () => null,
55
+ className: null,
56
+ contentClassName: null,
57
+ closeLabel: '',
58
+ closeText: null,
59
+ wide: false,
60
+ showHeader: true,
61
+ fullScreenOnMobile: true,
62
+ fullScreen: false,
63
+ padded: true,
64
+ accessoryView: null
65
+ };
66
+ const {
67
+ dialogRef
68
+ } = modalDialogPropTypes,
69
+ newModalDialogPropTypes = _objectWithoutProperties(modalDialogPropTypes, ["dialogRef"]);
70
+ const propTypes = _objectSpread(_objectSpread({}, newModalDialogPropTypes), {}, {
71
+ onClose: _propTypes.default.func,
72
+ isIphone: _propTypes.default.bool,
73
+ isOpen: _propTypes.default.bool.isRequired,
74
+ renderTarget: _propTypes.default.func,
75
+ closeOnScrimClick: _propTypes.default.bool,
76
+ closeOnEscPressed: _propTypes.default.bool
77
+ });
78
+ exports.propTypes = propTypes;
79
+ const defaultProps = _objectSpread(_objectSpread({}, modalDialogDefaultProps), {}, {
80
+ onClose: () => null,
81
+ renderTarget: null,
82
+ isIphone: (0, _bpkReactUtils.isDeviceIphone)(),
83
+ closeOnScrimClick: true,
84
+ closeOnEscPressed: true
85
+ });
86
+ exports.defaultProps = defaultProps;
@@ -22,5 +22,6 @@ var _bpkComponentLink = require("../../bpk-component-link");
22
22
  * See the License for the specific language governing permissions and
23
23
  * limitations under the License.
24
24
  */
25
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
25
26
  var _default = [..._bpkComponentLink.themeAttributes];
26
27
  exports.default = _default;
@@ -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 component, { TEXT_STYLES } from './src/BpkText';
20
+ export default component;
21
+ export { TEXT_STYLES };
@@ -9,12 +9,6 @@ Object.defineProperty(exports, "TEXT_STYLES", {
9
9
  return _BpkText.TEXT_STYLES;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "WEIGHT_STYLES", {
13
- enumerable: true,
14
- get: function () {
15
- return _BpkText.WEIGHT_STYLES;
16
- }
17
- });
18
12
  exports.default = void 0;
19
13
  var _BpkText = _interopRequireWildcard(require("./src/BpkText"));
20
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }