@skyscanner/backpack-web 23.2.2 → 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 (133) 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/src/BpkButtonV2/BpkButton.js +0 -1
  21. package/bpk-component-calendar/index.d.ts +30 -0
  22. package/bpk-component-calendar/index.js +5 -4
  23. package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +464 -0
  24. package/bpk-component-calendar/src/BpkCalendarContainer.js +19 -29
  25. package/bpk-component-calendar/src/BpkCalendarDate.d.ts +62 -0
  26. package/bpk-component-calendar/src/BpkCalendarDate.js +15 -39
  27. package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +68 -0
  28. package/bpk-component-calendar/src/BpkCalendarGrid.js +9 -40
  29. package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +36 -0
  30. package/bpk-component-calendar/src/BpkCalendarGridHeader.js +33 -52
  31. package/bpk-component-calendar/src/BpkCalendarGridTransition.d.ts +56 -0
  32. package/bpk-component-calendar/src/BpkCalendarGridTransition.js +43 -42
  33. package/bpk-component-calendar/src/BpkCalendarNav.d.ts +37 -0
  34. package/bpk-component-calendar/src/BpkCalendarNav.js +18 -32
  35. package/bpk-component-calendar/src/Week.d.ts +51 -0
  36. package/bpk-component-calendar/src/Week.js +48 -70
  37. package/bpk-component-calendar/src/composeCalendar.d.ts +55 -0
  38. package/bpk-component-calendar/src/composeCalendar.js +34 -95
  39. package/bpk-component-calendar/src/custom-proptypes-legacy.js +140 -0
  40. package/bpk-component-calendar/src/custom-proptypes.d.ts +46 -0
  41. package/bpk-component-calendar/src/custom-proptypes.js +2 -61
  42. package/bpk-component-calendar/src/date-utils.d.ts +54 -0
  43. package/bpk-component-calendar/src/utils.d.ts +26 -0
  44. package/bpk-component-calendar/src/utils.js +1 -0
  45. package/bpk-component-calendar/test-utils.d.ts +56 -0
  46. package/bpk-component-calendar/test-utils.js +2 -2
  47. package/bpk-component-card/index.d.ts +24 -0
  48. package/bpk-component-card/src/BpkCard.d.ts +39 -0
  49. package/bpk-component-card/src/BpkCard.js +9 -25
  50. package/bpk-component-card/src/BpkCardWrapper.d.ts +33 -0
  51. package/bpk-component-card/src/BpkCardWrapper.js +10 -18
  52. package/bpk-component-card/src/BpkDividedCard.d.ts +43 -0
  53. package/bpk-component-card/src/BpkDividedCard.js +9 -24
  54. package/bpk-component-chip/index.d.ts +32 -0
  55. package/bpk-component-chip/src/BpkDismissibleChip.d.ts +28 -0
  56. package/bpk-component-chip/src/BpkDismissibleChip.js +9 -8
  57. package/bpk-component-chip/src/BpkDropdownChip.d.ts +29 -0
  58. package/bpk-component-chip/src/BpkDropdownChip.js +39 -25
  59. package/bpk-component-chip/src/BpkSelectableChip.d.ts +39 -0
  60. package/bpk-component-chip/src/BpkSelectableChip.js +33 -48
  61. package/bpk-component-chip/src/commonTypes.d.ts +56 -0
  62. package/bpk-component-chip/src/commonTypes.js +8 -2
  63. package/bpk-component-dialog/src/BpkDialog.d.ts +1 -12
  64. package/bpk-component-dialog/src/BpkDialog.js +1 -2
  65. package/bpk-component-dialog/src/BpkDialogInner.d.ts +256 -2
  66. package/bpk-component-dialog/src/BpkDialogInner.js +0 -4
  67. package/bpk-component-dialog/src/common-types.d.ts +20 -21
  68. package/bpk-component-graphic-promotion/src/BpkGraphicPromo.js +0 -4
  69. package/bpk-component-icon/src/classNameModifierHOCFactory.js +0 -1
  70. package/bpk-component-icon/src/withAlignment.js +1 -1
  71. package/bpk-component-icon/src/withDescription.js +1 -1
  72. package/bpk-component-icon/src/withRtlSupport.js +0 -2
  73. package/bpk-component-input/index.d.ts +39 -0
  74. package/bpk-component-input/src/BpkClearButton.d.ts +28 -0
  75. package/bpk-component-input/src/BpkClearButton.js +6 -14
  76. package/bpk-component-input/src/BpkInput.d.ts +46 -0
  77. package/bpk-component-input/src/BpkInput.js +7 -3
  78. package/bpk-component-input/src/common-types.d.ts +91 -0
  79. package/bpk-component-input/src/common-types.js +4 -1
  80. package/bpk-component-input/src/withOpenEvents.d.ts +121 -0
  81. package/bpk-component-input/src/withOpenEvents.js +14 -25
  82. package/bpk-component-modal/index.d.ts +26 -0
  83. package/bpk-component-modal/index.js +13 -6
  84. package/bpk-component-modal/src/BpkModal.d.ts +32 -0
  85. package/bpk-component-modal/src/BpkModal.js +24 -44
  86. package/bpk-component-modal/src/BpkModalInner.d.ts +39 -0
  87. package/bpk-component-modal/src/BpkModalInner.js +67 -84
  88. package/bpk-component-modal/src/BpkModalV2/BpKModal.module.css +18 -0
  89. package/bpk-component-modal/src/BpkModalV2/BpkModal.d.ts +35 -0
  90. package/bpk-component-modal/src/BpkModalV2/BpkModal.js +131 -0
  91. package/bpk-component-modal/src/legacy-prop-types.js +86 -0
  92. package/bpk-component-modal/src/themeAttributes.js +1 -0
  93. package/bpk-component-rtl-toggle/index.d.ts +23 -0
  94. package/bpk-component-rtl-toggle/src/BpkRtlToggle.d.ts +41 -0
  95. package/bpk-component-rtl-toggle/src/BpkRtlToggle.js +9 -12
  96. package/bpk-component-rtl-toggle/src/updateOnDirectionChange.d.ts +151 -0
  97. package/bpk-component-rtl-toggle/src/updateOnDirectionChange.js +9 -2
  98. package/bpk-component-rtl-toggle/src/utils.d.ts +25 -0
  99. package/bpk-component-text/index.d.ts +21 -0
  100. package/bpk-component-text/index.js +0 -6
  101. package/bpk-component-text/src/BpkText.d.ts +60 -0
  102. package/bpk-component-text/src/BpkText.js +16 -56
  103. package/bpk-component-text/src/BpkText.module.css +1 -1
  104. package/bpk-component-tooltip/index.d.ts +24 -0
  105. package/bpk-component-tooltip/src/BpkTooltip.d.ts +29 -0
  106. package/bpk-component-tooltip/src/BpkTooltip.js +9 -26
  107. package/bpk-component-tooltip/src/BpkTooltipPortal.d.ts +60 -0
  108. package/bpk-component-tooltip/src/BpkTooltipPortal.js +13 -21
  109. package/bpk-component-tooltip/src/constants.d.ts +31 -0
  110. package/bpk-component-tooltip/src/constants.js +3 -1
  111. package/bpk-react-utils/index.d.ts +58 -0
  112. package/bpk-react-utils/index.js +1 -0
  113. package/bpk-react-utils/src/Portal.d.ts +76 -0
  114. package/bpk-react-utils/src/Portal.js +33 -43
  115. package/bpk-react-utils/src/TransitionInitialMount.d.ts +27 -0
  116. package/bpk-react-utils/src/TransitionInitialMount.js +7 -8
  117. package/bpk-react-utils/src/cssModules.d.ts +22 -0
  118. package/bpk-react-utils/src/deprecated.js +2 -1
  119. package/bpk-react-utils/src/deviceDetection.d.ts +22 -0
  120. package/bpk-react-utils/src/deviceDetection.js +3 -1
  121. package/bpk-react-utils/src/isRTL.d.ts +20 -0
  122. package/bpk-react-utils/src/isRTL.js +3 -1
  123. package/bpk-react-utils/src/withDefaultProps.d.ts +33 -0
  124. package/bpk-react-utils/src/withDefaultProps.js +11 -24
  125. package/bpk-react-utils/src/wrapDisplayName.d.ts +21 -0
  126. package/bpk-scrim-utils/index.d.ts +283 -0
  127. package/bpk-scrim-utils/src/BpkScrim.d.ts +24 -0
  128. package/bpk-scrim-utils/src/BpkScrim.js +5 -10
  129. package/bpk-scrim-utils/src/scroll-utils.d.ts +24 -0
  130. package/bpk-scrim-utils/src/scroll-utils.js +1 -1
  131. package/bpk-scrim-utils/src/withScrim.d.ts +96 -0
  132. package/bpk-scrim-utils/src/withScrim.js +5 -12
  133. package/package.json +1 -1
@@ -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 _BpkCardModule = _interopRequireDefault(require("./BpkCard.module.css"));
10
9
  var _jsxRuntime = require("react/jsx-runtime");
@@ -35,16 +34,16 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
35
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; }
36
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; }
37
36
  const getClassName = (0, _bpkReactUtils.cssModules)(_BpkCardModule.default);
38
- const BpkCard = props => {
39
- const {
40
- atomic,
41
- blank,
37
+ const BpkCard = _ref => {
38
+ let {
39
+ atomic = true,
40
+ blank = false,
42
41
  children,
43
- className,
44
- href,
45
- padded
46
- } = props,
47
- rest = _objectWithoutProperties(props, _excluded);
42
+ className = null,
43
+ href = null,
44
+ padded = true
45
+ } = _ref,
46
+ rest = _objectWithoutProperties(_ref, _excluded);
48
47
  const classNames = getClassName('bpk-card', atomic && !href && 'bpk-card--atomic-button', padded && 'bpk-card--padded', className);
49
48
  const atomicProps = {};
50
49
  if (href) {
@@ -90,20 +89,5 @@ const BpkCard = props => {
90
89
  }))
91
90
  );
92
91
  };
93
- BpkCard.propTypes = {
94
- children: _propTypes.default.node.isRequired,
95
- className: _propTypes.default.string,
96
- href: _propTypes.default.string,
97
- padded: _propTypes.default.bool,
98
- blank: _propTypes.default.bool,
99
- atomic: _propTypes.default.bool
100
- };
101
- BpkCard.defaultProps = {
102
- className: null,
103
- href: null,
104
- padded: true,
105
- blank: false,
106
- atomic: true
107
- };
108
92
  var _default = BpkCard;
109
93
  exports.default = _default;
@@ -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 } from 'react';
20
+
21
+ type Props = {
22
+ card: ReactNode;
23
+ className?: string | null;
24
+ backgroundColor: string;
25
+ header: ReactNode;
26
+ };
27
+ declare const BpkCardWrapper: ({
28
+ backgroundColor,
29
+ card,
30
+ className,
31
+ header,
32
+ }: Props) => JSX.Element;
33
+ export default BpkCardWrapper;
@@ -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 _BpkCardWrapperModule = _interopRequireDefault(require("./BpkCardWrapper.module.css"));
10
9
  var _jsxRuntime = require("react/jsx-runtime");
@@ -25,18 +24,20 @@ 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
- */const getClassName = (0, _bpkReactUtils.cssModules)(_BpkCardWrapperModule.default);
29
- const BpkCardWrapper = props => {
30
- const {
31
- backgroundColor,
32
- card,
33
- className,
34
- header
35
- } = props;
27
+ */
28
+
29
+ const getClassName = (0, _bpkReactUtils.cssModules)(_BpkCardWrapperModule.default);
30
+ const BpkCardWrapper = ({
31
+ backgroundColor,
32
+ card,
33
+ className = null,
34
+ header
35
+ }) => {
36
36
  const classNames = getClassName('bpk-card-wrapper', className);
37
37
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
38
38
  className: classNames,
39
39
  style: {
40
+ // @ts-expect-error TS is reporting this incorrectly as --background-color is valid
40
41
  '--background-color': backgroundColor
41
42
  },
42
43
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -48,14 +49,5 @@ const BpkCardWrapper = props => {
48
49
  })]
49
50
  });
50
51
  };
51
- BpkCardWrapper.propTypes = {
52
- backgroundColor: _propTypes.default.string.isRequired,
53
- card: _propTypes.default.node.isRequired,
54
- className: _propTypes.default.string,
55
- header: _propTypes.default.node.isRequired
56
- };
57
- BpkCardWrapper.defaultProps = {
58
- className: null
59
- };
60
52
  var _default = BpkCardWrapper;
61
53
  exports.default = _default;
@@ -0,0 +1,43 @@
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
+ export declare const ORIENTATION: {
22
+ readonly horizontal: 'horizontal';
23
+ readonly vertical: 'vertical';
24
+ };
25
+ export type Props = {
26
+ primaryContent: ReactNode;
27
+ secondaryContent: ReactNode;
28
+ orientation?: typeof ORIENTATION[keyof typeof ORIENTATION];
29
+ href?: string | null;
30
+ className?: string | null;
31
+ isElevated?: boolean;
32
+ [rest: string]: any;
33
+ };
34
+ declare const BpkDividedCard: ({
35
+ className,
36
+ href,
37
+ isElevated,
38
+ orientation,
39
+ primaryContent,
40
+ secondaryContent,
41
+ ...rest
42
+ }: Props) => JSX.Element;
43
+ export default BpkDividedCard;
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.ORIENTATION = void 0;
7
- var _propTypes = _interopRequireDefault(require("prop-types"));
8
7
  var _bpkReactUtils = require("../../bpk-react-utils");
9
8
  var _BpkCard = _interopRequireDefault(require("./BpkCard"));
10
9
  var _BpkDividedCardModule = _interopRequireDefault(require("./BpkDividedCard.module.css"));
11
10
  var _jsxRuntime = require("react/jsx-runtime");
12
- const _excluded = ["className", "href", "isElevated", "orientation", "primaryContent", "secondaryContent"];
11
+ const _excluded = ["orientation", "href", "className", "isElevated", "primaryContent", "secondaryContent"];
13
12
  /*
14
13
  * Backpack - Skyscanner's Design System
15
14
  *
@@ -41,16 +40,16 @@ const ORIENTATION = {
41
40
  vertical: 'vertical'
42
41
  };
43
42
  exports.ORIENTATION = ORIENTATION;
44
- const BpkDividedCard = props => {
45
- const {
46
- className,
47
- href,
48
- isElevated,
49
- orientation,
43
+ const BpkDividedCard = _ref => {
44
+ let {
45
+ orientation = ORIENTATION.horizontal,
46
+ href = null,
47
+ className = null,
48
+ isElevated = true,
50
49
  primaryContent,
51
50
  secondaryContent
52
- } = props,
53
- rest = _objectWithoutProperties(props, _excluded);
51
+ } = _ref,
52
+ rest = _objectWithoutProperties(_ref, _excluded);
54
53
  const isVertical = orientation === ORIENTATION.vertical;
55
54
  const classNames = getClassName('bpk-divided-card', isVertical ? 'bpk-divided-card--vertical' : 'bpk-divided-card--horizontal', !isElevated && 'bpk-divided-card--no-elevation', className);
56
55
  return (
@@ -71,19 +70,5 @@ const BpkDividedCard = props => {
71
70
  }))
72
71
  );
73
72
  };
74
- BpkDividedCard.propTypes = {
75
- primaryContent: _propTypes.default.node.isRequired,
76
- secondaryContent: _propTypes.default.node.isRequired,
77
- orientation: _propTypes.default.oneOf(Object.keys(ORIENTATION)),
78
- href: _propTypes.default.string,
79
- className: _propTypes.default.string,
80
- isElevated: _propTypes.default.bool
81
- };
82
- BpkDividedCard.defaultProps = {
83
- orientation: ORIENTATION.horizontal,
84
- href: null,
85
- className: null,
86
- isElevated: true
87
- };
88
73
  var _default = BpkDividedCard;
89
74
  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
+ import BpkSelectableChip, {
20
+ type Props as SelectableProps,
21
+ } from './src/BpkSelectableChip';
22
+ import BpkDismissibleChip from './src/BpkDismissibleChip';
23
+ import BpkDropdownChip from './src/BpkDropdownChip';
24
+ import type { CommonProps } from './src/commonTypes';
25
+ import { CHIP_TYPES } from './src/commonTypes';
26
+ import themeAttributes from './src/themeAttributes';
27
+
28
+ export type BpkSelectableChipProps = SelectableProps;
29
+ export type BpkDismissibleChipProps = CommonProps;
30
+ export type BpkDropdownChipProps = CommonProps;
31
+ export default BpkSelectableChip;
32
+ export { BpkDismissibleChip, BpkDropdownChip, CHIP_TYPES, themeAttributes };
@@ -0,0 +1,28 @@
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 as Props } from './commonTypes';
21
+
22
+ declare const BpkDismissibleChip: ({
23
+ className,
24
+ leadingAccessoryView,
25
+ type,
26
+ ...rest
27
+ }: Props) => JSX.Element;
28
+ export default BpkDismissibleChip;
@@ -10,7 +10,7 @@ var _BpkSelectableChip = _interopRequireDefault(require("./BpkSelectableChip"));
10
10
  var _commonTypes = require("./commonTypes");
11
11
  var _BpkSelectableChipModule = _interopRequireDefault(require("./BpkSelectableChip.module.css"));
12
12
  var _jsxRuntime = require("react/jsx-runtime");
13
- const _excluded = ["className", "type"];
13
+ const _excluded = ["className", "type", "leadingAccessoryView"];
14
14
  /*
15
15
  * Backpack - Skyscanner's Design System
16
16
  *
@@ -33,6 +33,7 @@ The dismissible chip component is just a selectable chip that's
33
33
  been hard coded to have disabled={false}, selected and a trailing
34
34
  accessory view of a close icon.
35
35
  */
36
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
36
37
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
38
  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; }
38
39
  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; }
@@ -42,15 +43,17 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
42
43
  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; }
43
44
  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; }
44
45
  const getClassName = (0, _bpkReactUtils.cssModules)(_BpkSelectableChipModule.default);
45
- const BpkDismissibleChip = props => {
46
- const {
46
+ const BpkDismissibleChip = _ref => {
47
+ let {
47
48
  className,
48
- type
49
- } = props,
50
- rest = _objectWithoutProperties(props, _excluded);
49
+ type = _commonTypes.CHIP_TYPES.default,
50
+ leadingAccessoryView = null
51
+ } = _ref,
52
+ rest = _objectWithoutProperties(_ref, _excluded);
51
53
  const iconClassNames = getClassName(`bpk-chip--${type}-dismissible__trailing-accessory-view`);
52
54
  const classNames = getClassName(`bpk-chip--${type}-dismissible`, className);
53
55
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BpkSelectableChip.default, _objectSpread(_objectSpread({}, rest), {}, {
56
+ leadingAccessoryView: leadingAccessoryView,
54
57
  disabled: false,
55
58
  trailingAccessoryView: /*#__PURE__*/(0, _jsxRuntime.jsx)(_closeCircle.default, {
56
59
  className: iconClassNames
@@ -62,7 +65,5 @@ const BpkDismissibleChip = props => {
62
65
  className: classNames
63
66
  }));
64
67
  };
65
- BpkDismissibleChip.propTypes = _commonTypes.COMMON_PROP_TYPES;
66
- BpkDismissibleChip.defaultProps = _commonTypes.COMMON_DEFAULT_PROPS;
67
68
  var _default = BpkDismissibleChip;
68
69
  exports.default = _default;
@@ -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 as Props } from './commonTypes';
21
+
22
+ declare const BpkDropdownChip: ({
23
+ disabled,
24
+ leadingAccessoryView,
25
+ selected,
26
+ type,
27
+ ...rest
28
+ }: Props) => JSX.Element;
29
+ export default BpkDropdownChip;
@@ -8,39 +8,53 @@ var _chevronDown = _interopRequireDefault(require("../../bpk-component-icon/sm/c
8
8
  var _BpkSelectableChip = _interopRequireDefault(require("./BpkSelectableChip"));
9
9
  var _commonTypes = require("./commonTypes");
10
10
  var _jsxRuntime = require("react/jsx-runtime");
11
+ const _excluded = ["disabled", "leadingAccessoryView", "selected", "type"];
12
+ /*
13
+ * Backpack - Skyscanner's Design System
14
+ *
15
+ * Copyright 2016 Skyscanner Ltd
16
+ *
17
+ * Licensed under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software
24
+ * distributed under the License is distributed on an "AS IS" BASIS,
25
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
+ * See the License for the specific language governing permissions and
27
+ * limitations under the License.
28
+ */
29
+ /*
30
+ The dropdown chip component is just a selectable chip component
31
+ with a trailing accessory view of a chevron down icon.
32
+ */
33
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
11
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
35
  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; }
13
36
  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; }
14
37
  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; }
15
38
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
16
39
  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); }
17
- function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); } /*
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
- The dropdown chip component is just a selectable chip component
35
- with a trailing accessory view of a chevron down icon.
36
- */
37
- const BpkDropdownChip = props => {
38
- const rest = Object.assign({}, (_objectDestructuringEmpty(props), props));
39
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BpkSelectableChip.default, _objectSpread(_objectSpread({}, rest), {}, {
40
+ 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; }
41
+ 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; }
42
+ const BpkDropdownChip = _ref => {
43
+ let {
44
+ disabled = false,
45
+ leadingAccessoryView = null,
46
+ selected = false,
47
+ type = _commonTypes.CHIP_TYPES.default
48
+ } = _ref,
49
+ rest = _objectWithoutProperties(_ref, _excluded);
50
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BpkSelectableChip.default, _objectSpread(_objectSpread({
51
+ disabled: disabled,
52
+ leadingAccessoryView: leadingAccessoryView,
53
+ selected: selected,
54
+ type: type
55
+ }, rest), {}, {
40
56
  trailingAccessoryView: /*#__PURE__*/(0, _jsxRuntime.jsx)(_chevronDown.default, {})
41
57
  }));
42
58
  };
43
- BpkDropdownChip.propTypes = _commonTypes.COMMON_PROP_TYPES;
44
- BpkDropdownChip.defaultProps = _commonTypes.COMMON_DEFAULT_PROPS;
45
59
  var _default = BpkDropdownChip;
46
60
  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
+
21
+ import type { CommonProps } from './commonTypes';
22
+
23
+ export interface Props extends CommonProps {
24
+ role?: string;
25
+ trailingAccessoryView?: ReactNode;
26
+ }
27
+ declare const BpkSelectableChip: ({
28
+ accessibilityLabel,
29
+ children,
30
+ className,
31
+ disabled,
32
+ leadingAccessoryView,
33
+ role,
34
+ selected,
35
+ trailingAccessoryView,
36
+ type,
37
+ ...rest
38
+ }: Props) => JSX.Element;
39
+ export default BpkSelectableChip;
@@ -4,13 +4,12 @@ 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 _bpkComponentText = _interopRequireWildcard(require("../../bpk-component-text"));
10
9
  var _BpkSelectableChipModule = _interopRequireDefault(require("./BpkSelectableChip.module.css"));
11
10
  var _commonTypes = require("./commonTypes");
12
11
  var _jsxRuntime = require("react/jsx-runtime");
13
- const _excluded = ["accessibilityLabel", "children", "className", "disabled", "leadingAccessoryView", "role", "selected", "trailingAccessoryView", "type"];
12
+ const _excluded = ["role", "selected", "trailingAccessoryView", "className", "disabled", "leadingAccessoryView", "type", "accessibilityLabel", "children"];
14
13
  /*
15
14
  * Backpack - Skyscanner's Design System
16
15
  *
@@ -28,9 +27,9 @@ const _excluded = ["accessibilityLabel", "children", "className", "disabled", "l
28
27
  * See the License for the specific language governing permissions and
29
28
  * limitations under the License.
30
29
  */
30
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
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
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
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
34
33
  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
34
  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; }
36
35
  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; }
@@ -39,53 +38,39 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
39
38
  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; }
40
39
  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
40
  const getClassName = (0, _bpkReactUtils.cssModules)(_BpkSelectableChipModule.default);
42
- const BpkSelectableChip = props => {
43
- const {
44
- accessibilityLabel,
45
- children,
41
+ const BpkSelectableChip = _ref => {
42
+ let {
43
+ role = 'checkbox',
44
+ selected = false,
45
+ trailingAccessoryView = null,
46
46
  className,
47
- disabled,
48
- leadingAccessoryView,
49
- role,
50
- selected,
51
- trailingAccessoryView,
52
- type
53
- } = props,
54
- rest = _objectWithoutProperties(props, _excluded);
47
+ disabled = false,
48
+ leadingAccessoryView = null,
49
+ type = _commonTypes.CHIP_TYPES.default,
50
+ accessibilityLabel,
51
+ children
52
+ } = _ref,
53
+ rest = _objectWithoutProperties(_ref, _excluded);
55
54
  const classNames = getClassName('bpk-chip', `bpk-chip--${type}`, disabled && 'bpk-chip--disabled', disabled && `bpk-chip--${type}-disabled`, !disabled && selected && `bpk-chip--${type}-selected`, className);
56
- return (
57
- /*#__PURE__*/
58
- // $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'
59
- (0, _jsxRuntime.jsxs)("button", _objectSpread(_objectSpread({
60
- "aria-checked": role === 'button' ? null : selected,
61
- className: classNames,
62
- disabled: disabled,
63
- role: role,
64
- title: accessibilityLabel,
65
- type: "button"
66
- }, rest), {}, {
67
- children: [leadingAccessoryView && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
68
- className: getClassName('bpk-chip__leading-accessory-view'),
69
- children: leadingAccessoryView
70
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentText.default, {
71
- textStyle: _bpkComponentText.TEXT_STYLES.footnote,
72
- children: children
73
- }), trailingAccessoryView && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
74
- className: getClassName('bpk-chip__trailing-accessory-view'),
75
- children: trailingAccessoryView
76
- })]
77
- }))
78
- );
55
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", _objectSpread(_objectSpread({
56
+ "aria-checked": role === 'button' ? undefined : selected,
57
+ className: classNames,
58
+ disabled: disabled,
59
+ role: role,
60
+ title: accessibilityLabel,
61
+ type: "button"
62
+ }, rest), {}, {
63
+ children: [leadingAccessoryView && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
64
+ className: getClassName('bpk-chip__leading-accessory-view'),
65
+ children: leadingAccessoryView
66
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentText.default, {
67
+ textStyle: _bpkComponentText.TEXT_STYLES.footnote,
68
+ children: children
69
+ }), trailingAccessoryView && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
70
+ className: getClassName('bpk-chip__trailing-accessory-view'),
71
+ children: trailingAccessoryView
72
+ })]
73
+ }));
79
74
  };
80
- BpkSelectableChip.propTypes = _objectSpread(_objectSpread({}, _commonTypes.COMMON_PROP_TYPES), {}, {
81
- role: _propTypes.default.string,
82
- selected: _propTypes.default.bool,
83
- trailingAccessoryView: _propTypes.default.node
84
- });
85
- BpkSelectableChip.defaultProps = _objectSpread(_objectSpread({}, _commonTypes.COMMON_DEFAULT_PROPS), {}, {
86
- role: 'checkbox',
87
- selected: false,
88
- trailingAccessoryView: null
89
- });
90
75
  var _default = BpkSelectableChip;
91
76
  exports.default = _default;