@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
@@ -25,7 +25,6 @@ const _excluded = ["className", "politenessSetting", "visible"];
25
25
  * See the License for the specific language governing permissions and
26
26
  * limitations under the License.
27
27
  */
28
- // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
29
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
29
  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; }
31
30
  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; }
@@ -25,7 +25,6 @@ const _excluded = ["type", "docked", "centered", "className"];
25
25
  * See the License for the specific language governing permissions and
26
26
  * limitations under the License.
27
27
  */
28
- // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
29
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
29
  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; }
31
30
  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; }
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.onClosePropType = void 0;
7
1
  /*
8
2
  * Backpack - Skyscanner's Design System
9
3
  *
@@ -20,12 +14,20 @@ exports.onClosePropType = void 0;
20
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
15
  * See the License for the specific language governing permissions and
22
16
  * limitations under the License.
23
- */ // eslint-disable-next-line import/prefer-default-export
24
- const onClosePropType = (props, propName, componentName) => {
25
- const onCloseValue = props[propName];
26
- if (props.closeOnScrimClick && (!onCloseValue || typeof onCloseValue !== 'function')) {
27
- return new Error(`Invalid prop \`${propName}\` supplied to \`${componentName}\`. There must an onClose handler if closeOnScrimClick is true.`);
28
- }
29
- return null;
17
+ */
18
+
19
+ import BpkBannerAlert from './src/BpkBannerAlert';
20
+ import BpkBannerAlertDismissable from './src/BpkBannerAlertDismissable';
21
+ import BpkBannerAlertExpandable from './src/BpkBannerAlertExpandable';
22
+ import { ALERT_TYPES } from './src/common-types';
23
+ import withBannerAlertState from './src/withBannerAlertState';
24
+ import themeAttributes from './src/themeAttributes';
25
+
26
+ export {
27
+ ALERT_TYPES,
28
+ BpkBannerAlertDismissable,
29
+ BpkBannerAlertExpandable,
30
+ withBannerAlertState,
31
+ themeAttributes,
30
32
  };
31
- exports.onClosePropType = onClosePropType;
33
+ export default BpkBannerAlert;
@@ -0,0 +1,61 @@
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
+
22
+ type Props = {
23
+ animateOnEnter: boolean;
24
+ animateOnLeave: boolean;
25
+ children: ReactNode | string;
26
+ show: boolean;
27
+ className?: string | null;
28
+ };
29
+ type State = {
30
+ isExpanded: boolean;
31
+ visible: boolean;
32
+ initiateShow: boolean;
33
+ hideAnimationInProgress: boolean;
34
+ inDom: boolean;
35
+ };
36
+ declare class AnimateAndFade extends Component<Props, State> {
37
+ toggleImmediately: boolean;
38
+
39
+ static defaultProps: {
40
+ animateOnEnter: boolean;
41
+ animateOnLeave: boolean;
42
+ className: null;
43
+ };
44
+
45
+ constructor(props: Props);
46
+
47
+ componentDidMount(): void;
48
+
49
+ UNSAFE_componentWillReceiveProps(nextProps: Props): void;
50
+
51
+ componentDidUpdate(): void;
52
+
53
+ onAnimateHeightComplete: () => void;
54
+
55
+ onFadeComplete: () => void;
56
+
57
+ toggle: () => void;
58
+
59
+ render(): JSX.Element | null;
60
+ }
61
+ export default AnimateAndFade;
@@ -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 _react = require("react");
9
8
  var _base = require("@skyscanner/bpk-foundations-web/tokens/base.es6");
10
9
  var _reactTransitionGroup = require("react-transition-group");
@@ -31,7 +30,9 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
31
30
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
31
  * See the License for the specific language governing permissions and
33
32
  * limitations under the License.
34
- */
33
+ */ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
34
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
35
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
35
36
  const getClassName = (0, _bpkReactUtils.cssModules)(_BpkAnimateAndFadeModule.default);
36
37
  const ANIMATION_DURATION = parseInt(_base.durationSm, 10);
37
38
  class AnimateAndFade extends _react.Component {
@@ -145,13 +146,6 @@ class AnimateAndFade extends _react.Component {
145
146
  }) : null;
146
147
  }
147
148
  }
148
- _defineProperty(AnimateAndFade, "propTypes", {
149
- animateOnEnter: _propTypes.default.bool,
150
- animateOnLeave: _propTypes.default.bool,
151
- children: _propTypes.default.node.isRequired,
152
- show: _propTypes.default.bool.isRequired,
153
- className: _propTypes.default.string
154
- });
155
149
  _defineProperty(AnimateAndFade, "defaultProps", {
156
150
  animateOnEnter: false,
157
151
  animateOnLeave: false,
@@ -0,0 +1,29 @@
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 { CommonProps } from './common-types';
21
+
22
+ declare const BpkBannerAlert: ({
23
+ animateOnEnter,
24
+ animateOnLeave,
25
+ icon,
26
+ show,
27
+ ...rest
28
+ }: CommonProps) => JSX.Element;
29
+ export default BpkBannerAlert;
@@ -4,33 +4,54 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _commonTypes = require("./common-types");
8
7
  var _BpkBannerAlertInner = _interopRequireDefault(require("./BpkBannerAlertInner"));
9
8
  var _jsxRuntime = require("react/jsx-runtime");
9
+ const _excluded = ["animateOnEnter", "animateOnLeave", "icon", "show"];
10
+ /*
11
+ * Backpack - Skyscanner's Design System
12
+ *
13
+ * Copyright 2016 Skyscanner Ltd
14
+ *
15
+ * Licensed under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License.
17
+ * You may obtain a copy of the License at
18
+ *
19
+ * http://www.apache.org/licenses/LICENSE-2.0
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software
22
+ * distributed under the License is distributed on an "AS IS" BASIS,
23
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
+ * See the License for the specific language governing permissions and
25
+ * limitations under the License.
26
+ */
10
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
28
  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
29
  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
30
  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
31
  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
- * Backpack - Skyscanner's Design System
17
- *
18
- * Copyright 2016 Skyscanner Ltd
19
- *
20
- * Licensed under the Apache License, Version 2.0 (the "License");
21
- * you may not use this file except in compliance with the License.
22
- * You may obtain a copy of the License at
23
- *
24
- * http://www.apache.org/licenses/LICENSE-2.0
25
- *
26
- * Unless required by applicable law or agreed to in writing, software
27
- * distributed under the License is distributed on an "AS IS" BASIS,
28
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
- * See the License for the specific language governing permissions and
30
- * limitations under the License.
31
- */
32
- const BpkBannerAlert = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_BpkBannerAlertInner.default, _objectSpread({}, props));
33
- BpkBannerAlert.propTypes = _commonTypes.COMMON_PROP_TYPES;
34
- BpkBannerAlert.defaultProps = _commonTypes.COMMON_DEFAULT_PROPS;
32
+ 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); }
33
+ 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; }
34
+ 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; }
35
+ const defaultProps = {
36
+ animateOnEnter: false,
37
+ animateOnLeave: false,
38
+ show: true,
39
+ icon: null
40
+ };
41
+ const BpkBannerAlert = _ref => {
42
+ let {
43
+ animateOnEnter = false,
44
+ animateOnLeave = false,
45
+ icon = null,
46
+ show = true
47
+ } = _ref,
48
+ rest = _objectWithoutProperties(_ref, _excluded);
49
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BpkBannerAlertInner.default, _objectSpread({
50
+ animateOnEnter: animateOnEnter,
51
+ animateOnLeave: animateOnLeave,
52
+ show: show,
53
+ icon: icon
54
+ }, rest));
55
+ };
35
56
  var _default = BpkBannerAlert;
36
57
  exports.default = _default;
@@ -0,0 +1,30 @@
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 { CommonProps, OnDismissHandler } from './common-types';
21
+
22
+ export type Props = CommonProps & {
23
+ dismissButtonLabel: string;
24
+ onDismiss?: OnDismissHandler;
25
+ };
26
+ declare const BpkBannerAlertDismissable: ({
27
+ onDismiss,
28
+ ...rest
29
+ }: Props) => JSX.Element;
30
+ export default BpkBannerAlertDismissable;
@@ -4,46 +4,44 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _propTypes = _interopRequireDefault(require("prop-types"));
8
- var _commonTypes = require("./common-types");
9
7
  var _BpkBannerAlertInner = _interopRequireWildcard(require("./BpkBannerAlertInner"));
10
8
  var _jsxRuntime = require("react/jsx-runtime");
9
+ const _excluded = ["onDismiss"];
10
+ /*
11
+ * Backpack - Skyscanner's Design System
12
+ *
13
+ * Copyright 2016 Skyscanner Ltd
14
+ *
15
+ * Licensed under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License.
17
+ * You may obtain a copy of the License at
18
+ *
19
+ * http://www.apache.org/licenses/LICENSE-2.0
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software
22
+ * distributed under the License is distributed on an "AS IS" BASIS,
23
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
+ * See the License for the specific language governing permissions and
25
+ * limitations under the License.
26
+ */
11
27
  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); }
12
28
  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; }
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
29
  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; }
15
30
  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; }
16
31
  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; }
17
32
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
- 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); } /*
19
- * Backpack - Skyscanner's Design System
20
- *
21
- * Copyright 2016 Skyscanner Ltd
22
- *
23
- * Licensed under the Apache License, Version 2.0 (the "License");
24
- * you may not use this file except in compliance with the License.
25
- * You may obtain a copy of the License at
26
- *
27
- * http://www.apache.org/licenses/LICENSE-2.0
28
- *
29
- * Unless required by applicable law or agreed to in writing, software
30
- * distributed under the License is distributed on an "AS IS" BASIS,
31
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
- * See the License for the specific language governing permissions and
33
- * limitations under the License.
34
- */
35
- const BpkBannerAlertDismissable = props =>
36
- /*#__PURE__*/
37
- // $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
38
- (0, _jsxRuntime.jsx)(_BpkBannerAlertInner.default, _objectSpread({
39
- configuration: _BpkBannerAlertInner.CONFIGURATION.DISMISSABLE
40
- }, props));
41
- BpkBannerAlertDismissable.propTypes = _objectSpread(_objectSpread({}, _commonTypes.COMMON_PROP_TYPES), {}, {
42
- dismissButtonLabel: _propTypes.default.string.isRequired,
43
- onDismiss: _propTypes.default.func
44
- });
45
- BpkBannerAlertDismissable.defaultProps = _objectSpread(_objectSpread({}, _commonTypes.COMMON_DEFAULT_PROPS), {}, {
46
- onDismiss: null
47
- });
33
+ 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); }
34
+ 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; }
35
+ 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; }
36
+ const BpkBannerAlertDismissable = _ref => {
37
+ let {
38
+ onDismiss = null
39
+ } = _ref,
40
+ rest = _objectWithoutProperties(_ref, _excluded);
41
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BpkBannerAlertInner.default, _objectSpread({
42
+ configuration: _BpkBannerAlertInner.CONFIGURATION.DISMISSABLE,
43
+ onDismiss: onDismiss
44
+ }, rest));
45
+ };
48
46
  var _default = BpkBannerAlertDismissable;
49
47
  exports.default = _default;
@@ -0,0 +1,35 @@
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
+
21
+ import type { CommonProps, OnExpandToggleHandler } from './common-types';
22
+
23
+ export type Props = CommonProps & {
24
+ children: ReactNode;
25
+ expanded?: boolean;
26
+ toggleButtonLabel: string;
27
+ onExpandToggle?: OnExpandToggleHandler;
28
+ };
29
+ declare const BpkBannerAlertExpandable: ({
30
+ children,
31
+ expanded,
32
+ onExpandToggle,
33
+ ...rest
34
+ }: Props) => JSX.Element;
35
+ export default BpkBannerAlertExpandable;
@@ -4,11 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _propTypes = _interopRequireDefault(require("prop-types"));
8
- var _commonTypes = require("./common-types");
9
7
  var _BpkBannerAlertInner = _interopRequireWildcard(require("./BpkBannerAlertInner"));
10
8
  var _jsxRuntime = require("react/jsx-runtime");
11
- const _excluded = ["children"];
9
+ const _excluded = ["children", "expanded", "onExpandToggle"];
12
10
  /*
13
11
  * Backpack - Skyscanner's Design System
14
12
  *
@@ -28,7 +26,6 @@ const _excluded = ["children"];
28
26
  */
29
27
  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); }
30
28
  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; }
31
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
29
  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; }
33
30
  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; }
34
31
  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; }
@@ -36,30 +33,20 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
36
33
  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); }
37
34
  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; }
38
35
  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; }
39
- const BpkBannerAlertExpandable = props => {
40
- const {
41
- children
42
- } = props,
43
- rest = _objectWithoutProperties(props, _excluded);
44
- return (
45
- /*#__PURE__*/
46
- // $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
47
- (0, _jsxRuntime.jsx)(_BpkBannerAlertInner.default, _objectSpread(_objectSpread({
48
- configuration: _BpkBannerAlertInner.CONFIGURATION.EXPANDABLE
49
- }, rest), {}, {
50
- children: children
51
- }))
52
- );
36
+ const BpkBannerAlertExpandable = _ref => {
37
+ let {
38
+ children,
39
+ expanded = false,
40
+ onExpandToggle = null
41
+ } = _ref,
42
+ rest = _objectWithoutProperties(_ref, _excluded);
43
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BpkBannerAlertInner.default, _objectSpread(_objectSpread({
44
+ configuration: _BpkBannerAlertInner.CONFIGURATION.EXPANDABLE,
45
+ expanded: expanded,
46
+ onExpandToggle: onExpandToggle
47
+ }, rest), {}, {
48
+ children: children
49
+ }));
53
50
  };
54
- BpkBannerAlertExpandable.propTypes = _objectSpread(_objectSpread({}, _commonTypes.COMMON_PROP_TYPES), {}, {
55
- children: _propTypes.default.node.isRequired,
56
- toggleButtonLabel: _propTypes.default.string.isRequired,
57
- expanded: _propTypes.default.bool,
58
- onExpandToggle: _propTypes.default.func
59
- });
60
- BpkBannerAlertExpandable.defaultProps = _objectSpread(_objectSpread({}, _commonTypes.COMMON_DEFAULT_PROPS), {}, {
61
- expanded: false,
62
- onExpandToggle: null
63
- });
64
51
  var _default = BpkBannerAlertExpandable;
65
52
  exports.default = _default;
@@ -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
+ import type { ReactNode } from 'react';
20
+
21
+ import type {
22
+ CommonProps,
23
+ OnDismissHandler,
24
+ OnExpandToggleHandler,
25
+ } from './common-types';
26
+
27
+ export declare const CONFIGURATION: {
28
+ readonly NONE: 'none';
29
+ readonly DISMISSABLE: 'dismissable';
30
+ readonly EXPANDABLE: 'expandable';
31
+ };
32
+ type Props = CommonProps & {
33
+ configuration?: typeof CONFIGURATION[keyof typeof CONFIGURATION];
34
+ children?: ReactNode | string;
35
+ expanded?: boolean;
36
+ toggleButtonLabel?: string;
37
+ onExpandToggle?: OnExpandToggleHandler;
38
+ dismissButtonLabel?: string;
39
+ onDismiss?: OnDismissHandler;
40
+ };
41
+ declare const BpkBannerAlertInner: ({
42
+ animateOnEnter,
43
+ animateOnLeave,
44
+ bannerClassName,
45
+ children,
46
+ configuration,
47
+ dismissButtonLabel,
48
+ expanded,
49
+ icon,
50
+ message,
51
+ onDismiss,
52
+ onExpandToggle,
53
+ show,
54
+ toggleButtonLabel,
55
+ type,
56
+ ...rest
57
+ }: Props) => JSX.Element;
58
+ export default BpkBannerAlertInner;