@skyscanner/backpack-web 33.4.0 → 34.0.0-premajor.1

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 (153) hide show
  1. package/bpk-component-accordion/index.js +1 -1
  2. package/bpk-component-accordion/src/BpkAccordionItem.js +12 -12
  3. package/bpk-component-accordion/src/BpkAccordionItem.module.css +1 -1
  4. package/bpk-component-autosuggest/src/BpkAutosuggestSuggestion.js +4 -1
  5. package/bpk-component-banner-alert/index.js +1 -1
  6. package/bpk-component-banner-alert/src/AnimateAndFade.js +33 -31
  7. package/bpk-component-banner-alert/src/BpkBannerAlertInner.js +11 -4
  8. package/bpk-component-barchart/src/BpkBarchart.js +8 -8
  9. package/bpk-component-bottom-sheet/src/BpkBottomSheet.js +3 -3
  10. package/bpk-component-breadcrumb/src/BpkBreadcrumbItem.js +17 -12
  11. package/bpk-component-breadcrumb/src/BpkBreadcrumbItem.module.css +1 -1
  12. package/bpk-component-button/index.js +5 -5
  13. package/bpk-component-button/src/BpkButtonDestructive.js +10 -9
  14. package/bpk-component-button/src/BpkButtonFeatured.js +10 -9
  15. package/bpk-component-button/src/BpkButtonLink.js +11 -10
  16. package/bpk-component-button/src/BpkButtonLinkOnDark.js +11 -10
  17. package/bpk-component-button/src/BpkButtonPrimary.js +2 -2
  18. package/bpk-component-button/src/BpkButtonPrimaryOnDark.js +10 -9
  19. package/bpk-component-button/src/BpkButtonPrimaryOnLight.js +10 -9
  20. package/bpk-component-button/src/BpkButtonSecondary.js +10 -10
  21. package/bpk-component-button/src/BpkButtonSecondaryOnDark.js +10 -9
  22. package/bpk-component-calendar/index.js +1 -1
  23. package/bpk-component-calendar/src/BpkCalendarContainer.js +3 -3
  24. package/bpk-component-calendar/src/BpkCalendarGrid.js +2 -2
  25. package/bpk-component-calendar/src/BpkCalendarGrid.module.css +1 -1
  26. package/bpk-component-calendar/src/BpkCalendarGridHeader.js +4 -1
  27. package/bpk-component-calendar/src/BpkCalendarGridTransition.js +5 -2
  28. package/bpk-component-calendar/src/BpkCalendarNav.js +9 -3
  29. package/bpk-component-calendar/src/Week.js +6 -3
  30. package/bpk-component-calendar/src/composeCalendar.js +8 -2
  31. package/bpk-component-calendar/src/date-utils.js +14 -14
  32. package/bpk-component-card/src/BpkDividedCard.js +18 -13
  33. package/bpk-component-card-button/src/BpkSaveButton.js +13 -4
  34. package/bpk-component-chip/index.d.ts +3 -5
  35. package/bpk-component-chip/index.js +3 -2
  36. package/bpk-component-chip/src/BpkDismissibleChip.js +7 -2
  37. package/bpk-component-chip/src/BpkIconChip.d.ts +25 -0
  38. package/bpk-component-chip/src/BpkIconChip.js +31 -0
  39. package/bpk-component-chip/src/BpkSelectableChip.d.ts +0 -2
  40. package/bpk-component-chip/src/BpkSelectableChip.js +3 -3
  41. package/bpk-component-chip/src/BpkSelectableChip.module.css +1 -1
  42. package/bpk-component-chip/src/commonTypes.d.ts +1 -1
  43. package/bpk-component-chip/src/commonTypes.js +1 -24
  44. package/bpk-component-content-cards/src/BpkContentCard.js +8 -2
  45. package/bpk-component-datatable/src/BpkDataTable.js +1 -1
  46. package/bpk-component-datatable/src/BpkDataTableHeader.js +12 -8
  47. package/bpk-component-datatable/src/BpkDataTableHeader.module.css +1 -1
  48. package/bpk-component-datepicker/src/BpkDatepicker.js +2 -2
  49. package/bpk-component-description-list/index.js +1 -1
  50. package/bpk-component-description-list/src/ComponentFactory.js +10 -5
  51. package/bpk-component-dialog/src/BpkDialog.js +6 -4
  52. package/bpk-component-dialog/src/BpkDialog.module.css +1 -1
  53. package/bpk-component-dialog/src/BpkDialogInner.js +6 -3
  54. package/bpk-component-drawer/src/BpkDrawer.js +1 -4
  55. package/bpk-component-drawer/src/BpkDrawerContent.js +7 -5
  56. package/bpk-component-fieldset/src/BpkFieldset.js +9 -7
  57. package/bpk-component-flare/index.js +2 -2
  58. package/bpk-component-flare/src/BpkContentBubble.js +4 -1
  59. package/bpk-component-flare/src/BpkFlareBar.js +13 -4
  60. package/bpk-component-flare/src/__generated__/corner-radius.d.ts +6 -0
  61. package/bpk-component-flare/src/__generated__/pointer.d.ts +6 -0
  62. package/bpk-component-floating-notification/src/BpkFloatingNotification.js +8 -2
  63. package/bpk-component-form-validation/src/BpkFormValidation.js +5 -4
  64. package/bpk-component-graphic-promotion/src/BpkGraphicPromo.js +9 -11
  65. package/bpk-component-graphic-promotion/src/BpkGraphicPromo.module.css +1 -1
  66. package/bpk-component-grid-toggle/src/BpkGridToggle.js +8 -6
  67. package/bpk-component-horizontal-nav/src/BpkHorizontalNav.js +16 -14
  68. package/bpk-component-horizontal-nav/src/BpkHorizontalNav.module.css +1 -1
  69. package/bpk-component-horizontal-nav/src/BpkHorizontalNavItem.js +2 -2
  70. package/bpk-component-icon/index.js +1 -1
  71. package/bpk-component-icon/src/classNameModifierHOCFactory.js +3 -0
  72. package/bpk-component-image/index.js +2 -2
  73. package/bpk-component-image/src/BpkBackgroundImage.js +2 -1
  74. package/bpk-component-image/src/BpkImage.js +2 -1
  75. package/bpk-component-infinite-scroll/src/withInfiniteScroll.js +3 -3
  76. package/bpk-component-info-banner/src/AnimateAndFade.js +33 -31
  77. package/bpk-component-info-banner/src/BpkInfoBanner.module.css +1 -1
  78. package/bpk-component-info-banner/src/BpkInfoBannerInner.js +16 -12
  79. package/bpk-component-input/index.js +1 -1
  80. package/bpk-component-input/src/BpkClearButton.js +3 -1
  81. package/bpk-component-input/src/BpkInput.js +4 -1
  82. package/bpk-component-input/src/withOpenEvents.js +4 -1
  83. package/bpk-component-link/index.js +2 -2
  84. package/bpk-component-list/src/BpkList.js +4 -1
  85. package/bpk-component-loading-button/src/BpkLoadingButton.js +6 -3
  86. package/bpk-component-map/index.js +4 -4
  87. package/bpk-component-map/src/BpkIconMarker.js +1 -1
  88. package/bpk-component-map/src/BpkMap.js +2 -2
  89. package/bpk-component-map/src/BpkPriceMarker.js +7 -5
  90. package/bpk-component-map/src/BpkPriceMarkerV2/BpkPriceMarker.js +1 -1
  91. package/bpk-component-mobile-scroll-container/src/BpkMobileScrollContainer.js +4 -1
  92. package/bpk-component-modal/index.js +4 -3
  93. package/bpk-component-modal/src/BpkModal.d.ts +2 -1
  94. package/bpk-component-modal/src/BpkModal.js +8 -3
  95. package/bpk-component-modal/src/BpkModalInner.d.ts +2 -0
  96. package/bpk-component-modal/src/BpkModalInner.js +24 -8
  97. package/bpk-component-modal/src/BpkModalInner.module.css +1 -1
  98. package/bpk-component-modal/src/BpkModalV2/BpKModal.module.css +1 -1
  99. package/bpk-component-modal/src/BpkModalV2/BpkModal.d.ts +2 -0
  100. package/bpk-component-modal/src/BpkModalV2/BpkModal.js +19 -8
  101. package/bpk-component-navigation-bar/index.js +1 -1
  102. package/bpk-component-navigation-bar/src/BpkNavigationBar.js +7 -5
  103. package/bpk-component-navigation-bar/src/BpkNavigationBarButtonLink.js +4 -1
  104. package/bpk-component-navigation-bar/src/BpkNavigationBarIconButton.js +4 -1
  105. package/bpk-component-nudger/index.js +1 -1
  106. package/bpk-component-nudger/src/BpkConfigurableNudger.js +16 -4
  107. package/bpk-component-nudger/src/BpkNudger.js +16 -5
  108. package/bpk-component-page-indicator/src/BpkPageIndicator.module.css +1 -1
  109. package/bpk-component-page-indicator/src/NavButton.js +1 -1
  110. package/bpk-component-pagination/src/BpkPaginationList.js +1 -1
  111. package/bpk-component-pagination/src/BpkPaginationNudger.js +13 -4
  112. package/bpk-component-pagination/src/BpkPaginationPage.js +4 -1
  113. package/bpk-component-phone-input/src/BpkPhoneInput.js +15 -4
  114. package/bpk-component-popover/index.js +3 -3
  115. package/bpk-component-popover/src/BpkPopover.js +131 -101
  116. package/bpk-component-popover/src/BpkPopover.module.css +1 -1
  117. package/bpk-component-popover/src/themeAttributes.js +4 -1
  118. package/bpk-component-price/src/BpkPrice.js +17 -5
  119. package/bpk-component-rating/src/BpkRating.js +17 -5
  120. package/bpk-component-rtl-toggle/src/BpkRtlToggle.js +4 -1
  121. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGrid.js +6 -3
  122. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.js +6 -3
  123. package/bpk-component-section-header/src/BpkSectionHeader.js +9 -3
  124. package/bpk-component-section-list/index.js +1 -1
  125. package/bpk-component-section-list/src/BpkSectionListItem.js +10 -4
  126. package/bpk-component-section-list/src/BpkSectionListSection.js +1 -1
  127. package/bpk-component-slider/src/BpkSlider.js +4 -1
  128. package/bpk-component-spinner/index.js +3 -3
  129. package/bpk-component-spinner/src/BpkExtraLargeSpinner.js +7 -4
  130. package/bpk-component-spinner/src/BpkLargeSpinner.js +7 -4
  131. package/bpk-component-spinner/src/BpkSpinner.js +7 -4
  132. package/bpk-component-split-input/src/BpkInputField.js +2 -2
  133. package/bpk-component-split-input/src/BpkSplitInput.js +3 -3
  134. package/bpk-component-star-rating/index.js +4 -4
  135. package/bpk-component-star-rating/src/BpkInteractiveStar.js +6 -2
  136. package/bpk-component-star-rating/src/BpkInteractiveStarRating.js +1 -1
  137. package/bpk-component-star-rating/src/BpkStar.js +22 -15
  138. package/bpk-component-swap-button/src/BpkSwapButton.js +2 -1
  139. package/bpk-component-table/index.js +2 -2
  140. package/bpk-component-text/src/BpkText.js +10 -5
  141. package/bpk-component-theme-toggle/src/BpkThemeToggle.js +4 -1
  142. package/bpk-component-theme-toggle/src/updateOnThemeChange.js +1 -1
  143. package/bpk-component-tooltip/src/BpkTooltipPortal.js +4 -1
  144. package/bpk-mixins/_chips.scss +9 -0
  145. package/bpk-react-utils/index.js +3 -3
  146. package/bpk-react-utils/src/withDefaultProps.js +4 -1
  147. package/bpk-scrim-utils/src/withScrimmedPortal.js +1 -1
  148. package/bpk-theming/src/BpkThemeProvider.js +1 -1
  149. package/package.json +4 -3
  150. package/unstable__bpk-mixins/_chips.scss +9 -0
  151. package/bpk-component-button/src/commonButtonTests.js +0 -133
  152. package/bpk-component-popover/src/BpkPopoverPortal.js +0 -216
  153. package/bpk-component-popover/src/keyboardFocusScope.js +0 -76
@@ -22,33 +22,43 @@ import { useEffect, useRef } from 'react';
22
22
  import BpkCloseButton from "../../../bpk-component-close-button";
23
23
  import BpkText, { TEXT_STYLES } from "../../../bpk-component-text";
24
24
  import { cssModules, withDefaultProps } from "../../../bpk-react-utils";
25
+ import { MODAL_STYLING } from "../BpkModalInner";
25
26
  import STYLES from "./BpKModal.module.css";
26
27
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
27
28
  const getClassName = cssModules(STYLES);
28
29
  const Header = ({
29
30
  closeLabel,
30
31
  id,
32
+ modalStyle,
31
33
  onClose,
32
34
  title
33
35
  }) => {
34
36
  if (title) {
35
37
  return /*#__PURE__*/_jsxs("div", {
36
38
  id: id,
37
- className: getClassName('bpk-modal__header-title'),
39
+ className: [getClassName('bpk-modal__header-title'), getClassName(`bpk-modal__header-title-style--${modalStyle}`)].join(' '),
38
40
  children: [/*#__PURE__*/_jsx("div", {
39
41
  className: getClassName('bpk-modal__header-title-container'),
40
42
  children: /*#__PURE__*/_jsx(Heading, {
41
43
  children: title
42
44
  })
43
- }), /*#__PURE__*/_jsx(BpkCloseButton, {
45
+ }), /*#__PURE__*/_jsx(BpkCloseButton
46
+ // TODO: className to be removed
47
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
48
+ , {
49
+ className: getClassName(`bpk-modal__close-button-style--${modalStyle}`),
44
50
  label: closeLabel,
45
51
  onClick: onClose
46
52
  })]
47
53
  });
48
54
  }
49
55
  return /*#__PURE__*/_jsx("div", {
50
- className: getClassName('bpk-modal__button-container'),
51
- children: /*#__PURE__*/_jsx(BpkCloseButton, {
56
+ className: [getClassName('bpk-modal__button-container'), getClassName(`bpk-modal__button-container-style--${modalStyle}`)].join(' '),
57
+ children: /*#__PURE__*/_jsx(BpkCloseButton
58
+ // TODO: className to be removed
59
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
60
+ , {
61
+ className: getClassName(`bpk-modal__close-button-style--${modalStyle}`),
52
62
  label: closeLabel,
53
63
  onClick: onClose
54
64
  })
@@ -56,8 +66,7 @@ const Header = ({
56
66
  };
57
67
  const Heading = withDefaultProps(BpkText, {
58
68
  textStyle: TEXT_STYLES.label1,
59
- tagName: 'h2',
60
- className: getClassName('bpk-modal__title')
69
+ tagName: 'h2'
61
70
  });
62
71
  // TODO: this check if the browser support the HTML dialog element. We can remove it once we drop support as a business for Safari 14
63
72
  const dialogSupported = typeof HTMLDialogElement === 'function';
@@ -78,6 +87,7 @@ export const BpkModalV2 = props => {
78
87
  fullScreenOnDesktop,
79
88
  id,
80
89
  isOpen,
90
+ modalStyle = MODAL_STYLING.default,
81
91
  noFullScreenOnMobile,
82
92
  onClose,
83
93
  padded,
@@ -130,7 +140,7 @@ export const BpkModalV2 = props => {
130
140
  };
131
141
  }, [id, isOpen, onClose]);
132
142
  const classNames = getClassName('bpk-modal', fullScreenOnDesktop && 'bpk-modal--full-screen-desktop', noFullScreenOnMobile && 'bpk-modal--no-full-screen-mobile', wide && 'bpk-modal--wide');
133
- const contentClassNames = getClassName('bpk-modal__container', fullScreenOnDesktop && 'bpk-modal__container--full-screen-desktop', padded && 'bpk-modal__container--padded');
143
+ const contentClassNames = getClassName('bpk-modal__container', fullScreenOnDesktop && 'bpk-modal__container--full-screen-desktop', padded && 'bpk-modal__container--padded', modalStyle === MODAL_STYLING.surfaceContrast && 'bpk-modal__container--surface-contrast');
134
144
  return isOpen ? /*#__PURE__*/_jsxs("div", {
135
145
  className: getClassName('bpk-modal-wrapper', dialogSupported ? '' : 'bpk-modal-polyfill'),
136
146
  children: [!dialogSupported && /*#__PURE__*/_jsx("div", {
@@ -148,7 +158,8 @@ export const BpkModalV2 = props => {
148
158
  id: `${id}-title`,
149
159
  title: title,
150
160
  closeLabel: closeLabel,
151
- onClose: onClose
161
+ onClose: onClose,
162
+ modalStyle: modalStyle
152
163
  }), /*#__PURE__*/_jsx("div", {
153
164
  className: contentClassNames,
154
165
  children: children
@@ -17,8 +17,8 @@
17
17
  */
18
18
 
19
19
  import BpkNavigationBar, { BAR_STYLES } from "./src/BpkNavigationBar";
20
- import BpkNavigationBarIconButton from "./src/BpkNavigationBarIconButton";
21
20
  import BpkNavigationBarButtonLink from "./src/BpkNavigationBarButtonLink";
21
+ import BpkNavigationBarIconButton from "./src/BpkNavigationBarIconButton";
22
22
  import themeAttributes from "./src/themeAttributes";
23
23
  export { BpkNavigationBarIconButton, BpkNavigationBarButtonLink, themeAttributes, BAR_STYLES };
24
24
  export default BpkNavigationBar;
@@ -16,8 +16,8 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import { cssModules } from "../../bpk-react-utils";
20
19
  import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
20
+ import { cssModules } from "../../bpk-react-utils";
21
21
  import STYLES from "./BpkNavigationBar.module.css";
22
22
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
23
  const getClassNames = cssModules(STYLES);
@@ -47,11 +47,13 @@ const BpkNavigationBar = props => {
47
47
  children: [leadingButton && /*#__PURE__*/_jsx("div", {
48
48
  className: getClassNames('bpk-navigation-bar__leading-item', `bpk-navigation-bar__leading-item--${barStyle}`),
49
49
  children: leadingButton
50
- }), typeof title === 'string' ? /*#__PURE__*/_jsx(BpkText, {
51
- id: titleId,
52
- textStyle: TEXT_STYLES.heading5,
50
+ }), typeof title === 'string' ? /*#__PURE__*/_jsx("span", {
53
51
  className: getClassNames('bpk-navigation-bar__title', `bpk-navigation-bar__title--${barStyle}`),
54
- children: title
52
+ children: /*#__PURE__*/_jsx(BpkText, {
53
+ id: titleId,
54
+ textStyle: TEXT_STYLES.heading5,
55
+ children: title
56
+ })
55
57
  }) : title, trailingButton && /*#__PURE__*/_jsx("div", {
56
58
  className: getClassNames('bpk-navigation-bar__trailing-item', `bpk-navigation-bar__trailing-item-${barStyle}`),
57
59
  children: trailingButton
@@ -28,7 +28,10 @@ const BpkNavigationBarButtonLink = ({
28
28
  children,
29
29
  className,
30
30
  ...rest
31
- }) => /*#__PURE__*/_jsx(BpkButtonLink, {
31
+ }) => /*#__PURE__*/_jsx(BpkButtonLink
32
+ // TODO: className to be removed
33
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
34
+ , {
32
35
  className: getClassName('bpk-navigation-bar-button-link', `bpk-navigation-bar-button-link--${barStyle}`, className),
33
36
  ...rest,
34
37
  children: children
@@ -29,7 +29,10 @@ const BpkNavigationBarIconButton = ({
29
29
  icon,
30
30
  ...rest
31
31
  }) => /*#__PURE__*/_jsx(BpkIconButton, {
32
- customIcon: icon,
32
+ customIcon: icon
33
+ // TODO: className to be removed
34
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
35
+ ,
33
36
  className: getClassName('bpk-navigation-bar-icon-button', `bpk-navigation-bar-icon-button--${barStyle}`, className),
34
37
  ...rest
35
38
  });
@@ -16,8 +16,8 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import BpkNudger from "./src/BpkNudger";
20
19
  import BpkConfigurableNudger from "./src/BpkConfigurableNudger";
20
+ import BpkNudger from "./src/BpkNudger";
21
21
  import themeAttributes from "./src/themeAttributes";
22
22
  export default BpkNudger;
23
23
  export { themeAttributes, BpkConfigurableNudger };
@@ -59,9 +59,15 @@ const BpkConfigurableNudger = ({
59
59
  onClick: () => onChange(decrementValue(value)),
60
60
  disabled: minButtonDisabled,
61
61
  title: decreaseButtonLabel,
62
- "aria-controls": id,
62
+ "aria-controls": id
63
+ // TODO: className to be removed
64
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
65
+ ,
63
66
  className: getClassName('bpk-nudger__button'),
64
- children: /*#__PURE__*/_jsx(AlignedMinusIcon, {
67
+ children: /*#__PURE__*/_jsx(AlignedMinusIcon
68
+ // TODO: className to be removed
69
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
70
+ , {
65
71
  className: minusIconClassNames
66
72
  })
67
73
  }), /*#__PURE__*/_jsx("input", {
@@ -79,9 +85,15 @@ const BpkConfigurableNudger = ({
79
85
  onClick: () => onChange(incrementValue(value)),
80
86
  disabled: maxButtonDisabled,
81
87
  title: increaseButtonLabel,
82
- "aria-controls": id,
88
+ "aria-controls": id
89
+ // TODO: className to be removed
90
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
91
+ ,
83
92
  className: getClassName('bpk-nudger__button'),
84
- children: /*#__PURE__*/_jsx(AlignedPlusIcon, {
93
+ children: /*#__PURE__*/_jsx(AlignedPlusIcon
94
+ // TODO: className to be removed
95
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
96
+ , {
85
97
  className: plusIconClassNames
86
98
  })
87
99
  })]
@@ -16,10 +16,10 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import { cssModules } from "../../bpk-react-utils";
20
- import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
21
19
  // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
22
20
  import BpkLabel from "../../bpk-component-label";
21
+ import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
22
+ import { cssModules } from "../../bpk-react-utils";
23
23
  import BpkConfigurableNudger from "./BpkConfigurableNudger";
24
24
  import STYLES from "./BpkNudger.module.css";
25
25
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -40,7 +40,11 @@ const BpkNudger = ({
40
40
  const classNames = getClassName(title && 'bpk-nudger__container');
41
41
  return /*#__PURE__*/_jsxs("div", {
42
42
  className: classNames,
43
- children: [title && /*#__PURE__*/_jsxs(BpkLabel, {
43
+ children: [title &&
44
+ /*#__PURE__*/
45
+ // TODO: className to be removed
46
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
47
+ _jsxs(BpkLabel, {
44
48
  htmlFor: id,
45
49
  className: getClassName('bpk-nudger__label'),
46
50
  children: [icon, /*#__PURE__*/_jsxs("span", {
@@ -51,7 +55,11 @@ const BpkNudger = ({
51
55
  children: [/*#__PURE__*/_jsx(BpkText, {
52
56
  textStyle: TEXT_STYLES.heading5,
53
57
  children: title
54
- }), subtitle && /*#__PURE__*/_jsx(BpkText, {
58
+ }), subtitle &&
59
+ /*#__PURE__*/
60
+ // TODO: className to be removed
61
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
62
+ _jsx(BpkText, {
55
63
  className: getClassName('bpk-nudger__label--subtitle'),
56
64
  children: subtitle
57
65
  })]
@@ -61,7 +69,10 @@ const BpkNudger = ({
61
69
  compareValues: compareValues,
62
70
  incrementValue: incrementValue,
63
71
  decrementValue: decrementValue,
64
- formatValue: formatValue,
72
+ formatValue: formatValue
73
+ // TODO: className to be removed
74
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
75
+ ,
65
76
  className: className,
66
77
  buttonType: buttonType,
67
78
  id: id,
@@ -15,4 +15,4 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- .bpk-page-indicator{display:flex;width:100%;justify-content:center;align-items:center}.bpk-page-indicator__showNav{justify-content:space-between}.bpk-page-indicator__container{max-width:5rem;min-height:.5rem;overflow:hidden}.bpk-page-indicator__indicators-container{--direction: -1;transform:translateX(calc(var(--direction) * var(--scroll-index, 0) * 1rem));transition:transform 200ms ease-in-out;white-space:nowrap}html[dir=rtl] .bpk-page-indicator__indicators-container{--direction: 1}.bpk-page-indicator__indicator{display:inline-block;width:.5rem;height:.5rem;padding:0;border:none;border-radius:50%;margin-inline:.25rem}.bpk-page-indicator__indicator--default{background-color:#c1c7cf}.bpk-page-indicator__indicator--overImage{background-color:rgba(255,255,255,.5)}.bpk-page-indicator__indicator--active-default{background-color:#626971}.bpk-page-indicator__indicator--active-overImage{background-color:#fff}
18
+ .bpk-page-indicator{display:flex;width:100%;justify-content:center;align-items:center}.bpk-page-indicator__showNav{justify-content:space-between}.bpk-page-indicator__container{max-width:5rem;min-height:.5rem;overflow:hidden}.bpk-page-indicator__indicators-container{--direction: -1;transform:translateX(calc(var(--direction) * var(--scroll-index, 0) * 1rem));transition:transform 200ms ease-in-out;white-space:nowrap}html[dir=rtl] .bpk-page-indicator__indicators-container{--direction: 1}.bpk-page-indicator__indicator{display:inline-block;width:.5rem;height:.5rem;padding:0;border:none;border-radius:50%;margin-inline:.25rem}.bpk-page-indicator__indicator:hover{cursor:pointer}.bpk-page-indicator__indicator--default{background-color:#c1c7cf}.bpk-page-indicator__indicator--overImage{background-color:rgba(255,255,255,.5)}.bpk-page-indicator__indicator--active-default{background-color:#626971;pointer-events:none}.bpk-page-indicator__indicator--active-overImage{background-color:#fff;pointer-events:none}
@@ -15,8 +15,8 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */import PropTypes from 'prop-types';
18
- import { withButtonAlignment, withRtlSupport } from "../../bpk-component-icon";
19
18
  import { BUTTON_TYPES, BpkButtonV2 } from "../../bpk-component-button";
19
+ import { withButtonAlignment, withRtlSupport } from "../../bpk-component-icon";
20
20
  import LeftArrowIcon from "../../bpk-component-icon/lg/chevron-left";
21
21
  import RightArrowIcon from "../../bpk-component-icon/lg/chevron-right";
22
22
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -18,8 +18,8 @@
18
18
 
19
19
  import PropTypes from 'prop-types';
20
20
  import { cssModules } from "../../bpk-react-utils";
21
- import BpkPaginationPage from "./BpkPaginationPage";
22
21
  import BpkPaginationBreak from "./BpkPaginationBreak";
22
+ import BpkPaginationPage from "./BpkPaginationPage";
23
23
  import STYLES from "./BpkPaginationList.module.css";
24
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
25
  const getClassName = cssModules(STYLES);
@@ -17,19 +17,25 @@
17
17
  */
18
18
 
19
19
  import PropTypes from 'prop-types';
20
- import { cssModules } from "../../bpk-react-utils";
21
20
  import { BpkButtonV2, BUTTON_TYPES } from "../../bpk-component-button";
22
21
  import { withRtlSupport } from "../../bpk-component-icon";
23
22
  import ArrowLeftIcon from "../../bpk-component-icon/sm/arrow-left";
24
23
  import ArrowRightIcon from "../../bpk-component-icon/sm/arrow-right";
24
+ import { cssModules } from "../../bpk-react-utils";
25
25
  import STYLES from "./BpkPaginationNudger.module.css";
26
26
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
27
27
  const getClassName = cssModules(STYLES);
28
28
  const AlignedArrowLeftIcon = withRtlSupport(ArrowLeftIcon);
29
29
  const AlignedArrowRightIcon = withRtlSupport(ArrowRightIcon);
30
- const nudgerIcon = forward => forward ? /*#__PURE__*/_jsx(AlignedArrowRightIcon, {
30
+ const nudgerIcon = forward => forward ? /*#__PURE__*/_jsx(AlignedArrowRightIcon
31
+ // TODO: className to be removed
32
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
33
+ , {
31
34
  className: getClassName('bpk-pagination-nudger__icon')
32
- }) : /*#__PURE__*/_jsx(AlignedArrowLeftIcon, {
35
+ }) : /*#__PURE__*/_jsx(AlignedArrowLeftIcon
36
+ // TODO: className to be removed
37
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
38
+ , {
33
39
  className: getClassName('bpk-pagination-nudger__icon')
34
40
  });
35
41
  const BpkPaginationNudger = props => {
@@ -42,7 +48,10 @@ const BpkPaginationNudger = props => {
42
48
  return /*#__PURE__*/_jsxs(BpkButtonV2, {
43
49
  type: BUTTON_TYPES.link,
44
50
  onClick: onNudge,
45
- disabled: disabled,
51
+ disabled: disabled
52
+ // TODO: className to be removed
53
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
54
+ ,
46
55
  className: getClassName('bpk-pagination-nudger'),
47
56
  children: [nudgerIcon(forward), /*#__PURE__*/_jsx("span", {
48
57
  className: getClassName('bpk-pagination-nudger__text--hidden'),
@@ -35,7 +35,10 @@ const BpkPaginationPage = props => {
35
35
  }
36
36
  return /*#__PURE__*/_jsx(BpkButtonV2, {
37
37
  type: !isSelected ? BUTTON_TYPES.primaryOnDark : BUTTON_TYPES.primary,
38
- onClick: onSelect,
38
+ onClick: onSelect
39
+ // TODO: className to be removed
40
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
41
+ ,
39
42
  className: classNames.join(' '),
40
43
  "aria-label": pageLabel(page, isSelected),
41
44
  "aria-current": isSelected,
@@ -15,10 +15,10 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */import PropTypes from 'prop-types';
18
- import { cssModules } from "../../bpk-react-utils";
19
18
  import BpkInput, { INPUT_TYPES } from "../../bpk-component-input";
20
19
  import BpkLabel from "../../bpk-component-label";
21
20
  import BpkSelect from "../../bpk-component-select";
21
+ import { cssModules } from "../../bpk-react-utils";
22
22
  import STYLES from "./BpkPhoneInput.module.css";
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  const getClassName = cssModules(STYLES);
@@ -86,12 +86,17 @@ const BpkPhoneInput = props => {
86
86
  children: [/*#__PURE__*/_jsxs("div", {
87
87
  children: [/*#__PURE__*/_jsx(BpkLabel, {
88
88
  htmlFor: dialingCodeProps.id,
89
- disabled: disabled,
89
+ disabled: disabled
90
+ // TODO: className to be removed
91
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
92
+ ,
90
93
  className: getClassName('bpk-phone-input__label'),
91
94
  children: dialingCodeProps.label
92
95
  }), /*#__PURE__*/_jsx(BpkSelect, {
93
96
  ...commonProps,
94
97
  ...dialingCodeProps,
98
+ // TODO: className to be removed
99
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
95
100
  className: getClassName(dialingCodeProps.className),
96
101
  wrapperClassName: getClassName(dialingCodeProps.wrapperClassName),
97
102
  value: dialingCode,
@@ -113,7 +118,10 @@ const BpkPhoneInput = props => {
113
118
  className: getClassName('bpk-phone-input__phone-number'),
114
119
  children: [/*#__PURE__*/_jsx(BpkLabel, {
115
120
  htmlFor: id,
116
- disabled: disabled,
121
+ disabled: disabled
122
+ // TODO: className to be removed
123
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
124
+ ,
117
125
  className: getClassName('bpk-phone-input__label'),
118
126
  children: label
119
127
  }), /*#__PURE__*/_jsx(BpkInput, {
@@ -123,7 +131,10 @@ const BpkPhoneInput = props => {
123
131
  name: name,
124
132
  value: displayValue,
125
133
  type: INPUT_TYPES.tel,
126
- onChange: handleChange,
134
+ onChange: handleChange
135
+ // TODO: className to be removed
136
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
137
+ ,
127
138
  className: getClassName(className)
128
139
  })]
129
140
  })]
@@ -14,7 +14,7 @@
14
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
- */import BpkPopoverPortal, { propTypes as bpkPopoverPortalPropTypes, defaultProps as bpkPopoverPortalDefaultProps } from "./src/BpkPopoverPortal";
17
+ */import BpkPopover from "./src/BpkPopover";
18
18
  import themeAttributes from "./src/themeAttributes";
19
- export { themeAttributes, bpkPopoverPortalPropTypes, bpkPopoverPortalDefaultProps };
20
- export default BpkPopoverPortal;
19
+ export { themeAttributes };
20
+ export default BpkPopover;
@@ -14,14 +14,23 @@
14
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
- */import PropTypes from 'prop-types';
18
- import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
19
- import { BpkButtonLink } from "../../bpk-component-link";
17
+ */
18
+
19
+ import { useState, cloneElement, useRef } from 'react';
20
+ import { useFloating, autoUpdate, offset, flip, useClick, useDismiss, useInteractions, FloatingFocusManager, FloatingArrow, arrow } from '@floating-ui/react';
21
+
22
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
23
+ import { surfaceHighlightDay } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
24
+
25
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
20
26
  import BpkCloseButton from "../../bpk-component-close-button";
27
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
28
+ import { BpkButtonLink } from "../../bpk-component-link";
29
+ import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
21
30
  import { TransitionInitialMount, cssModules } from "../../bpk-react-utils";
22
31
  import { ARROW_ID } from "./constants";
23
32
  import STYLES from "./BpkPopover.module.css";
24
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
33
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
25
34
  const getClassName = cssModules(STYLES);
26
35
  const EVENT_SOURCES = {
27
36
  CLOSE_BUTTON: 'CLOSE_BUTTON',
@@ -35,107 +44,128 @@ const bindEventSource = (source, callback) => event => {
35
44
  source
36
45
  });
37
46
  };
38
- const BpkPopover = props => {
47
+ const BpkPopover = ({
48
+ children,
49
+ className = null,
50
+ closeButtonIcon = true,
51
+ closeButtonProps = {},
52
+ closeButtonText,
53
+ id,
54
+ isOpen = false,
55
+ label,
56
+ labelAsTitle = false,
57
+ onClose,
58
+ padded = true,
59
+ placement = 'bottom',
60
+ showArrow = true,
61
+ target,
62
+ ...rest
63
+ }) => {
64
+ const [isOpenState, setIsOpenState] = useState(isOpen);
65
+ const arrowRef = useRef(null);
39
66
  const {
40
- children,
41
- className,
42
- closeButtonIcon,
43
- closeButtonProps,
44
- closeButtonText,
45
- id,
46
- label,
47
- labelAsTitle,
48
- onClose,
49
- padded,
50
- ...rest
51
- } = props;
52
- const classNames = [getClassName('bpk-popover')];
53
- const bodyClassNames = [];
54
-
55
- // outer classNames
56
- if (className) {
57
- classNames.push(className);
58
- }
67
+ context,
68
+ floatingStyles,
69
+ refs
70
+ } = useFloating({
71
+ open: isOpenState,
72
+ onOpenChange: setIsOpenState,
73
+ placement,
74
+ middleware: [showArrow && offset(14), flip({
75
+ fallbackAxisSideDirection: 'start'
76
+ }), arrow({
77
+ element: arrowRef
78
+ })],
79
+ whileElementsMounted: autoUpdate
80
+ });
81
+ const click = useClick(context);
82
+ const dismiss = useDismiss(context);
59
83
 
60
- // inner classNames
61
- if (padded) {
62
- bodyClassNames.push(getClassName('bpk-popover__body--padded'));
63
- }
84
+ // Merge all the interactions into prop getters
85
+ const {
86
+ getFloatingProps,
87
+ getReferenceProps
88
+ } = useInteractions([click, dismiss]);
89
+ const targetElement = /*#__PURE__*/cloneElement(target, {
90
+ ...getReferenceProps(),
91
+ ref: refs.setReference
92
+ });
93
+ const classNames = getClassName('bpk-popover', className);
94
+ const bodyClassNames = getClassName(padded && 'bpk-popover__body--padded');
64
95
  const labelId = `bpk-popover-label-${id}`;
65
- return /*#__PURE__*/_jsx(TransitionInitialMount, {
66
- appearClassName: getClassName('bpk-popover--appear'),
67
- appearActiveClassName: getClassName('bpk-popover--appear-active'),
68
- transitionTimeout: 200,
69
- children: /*#__PURE__*/_jsxs("section", {
70
- id: id,
71
- tabIndex: "-1",
72
- role: "dialog",
73
- "aria-labelledby": labelId,
74
- className: classNames.join(' '),
75
- ...rest,
76
- children: [/*#__PURE__*/_jsx("span", {
77
- id: ARROW_ID,
78
- className: getClassName('bpk-popover__arrow'),
79
- role: "presentation",
80
- "data-popper-arrow": true
81
- }), labelAsTitle ? /*#__PURE__*/_jsxs("header", {
82
- className: getClassName('bpk-popover__header'),
83
- children: [/*#__PURE__*/_jsx(BpkText, {
84
- tagName: "h2",
85
- id: labelId,
86
- textStyle: TEXT_STYLES.label1,
87
- children: label
88
- }), "\xA0", closeButtonIcon ? /*#__PURE__*/_jsx(BpkCloseButton, {
89
- className: getClassName('bpk-popover__close-button'),
90
- label: closeButtonText,
91
- onClick: bindEventSource(EVENT_SOURCES.CLOSE_BUTTON, props.onClose),
92
- ...closeButtonProps
93
- }) : /*#__PURE__*/_jsx(BpkButtonLink, {
94
- onClick: bindEventSource(EVENT_SOURCES.CLOSE_LINK, props.onClose),
95
- ...closeButtonProps,
96
- children: closeButtonText
97
- })]
98
- }) : /*#__PURE__*/_jsx("span", {
99
- id: labelId,
100
- className: getClassName('bpk-popover__label'),
101
- children: label
102
- }), /*#__PURE__*/_jsx("div", {
103
- className: bodyClassNames.join(' '),
104
- children: children
105
- }), !labelAsTitle && /*#__PURE__*/_jsx("footer", {
106
- className: getClassName('bpk-popover__footer'),
107
- children: /*#__PURE__*/_jsx(BpkButtonLink, {
108
- onClick: bindEventSource(EVENT_SOURCES.CLOSE_LINK, props.onClose),
109
- ...closeButtonProps,
110
- children: closeButtonText
96
+ return /*#__PURE__*/_jsxs(_Fragment, {
97
+ children: [targetElement, isOpenState && /*#__PURE__*/_jsx(FloatingFocusManager, {
98
+ context: context,
99
+ modal: false,
100
+ children: /*#__PURE__*/_jsx("div", {
101
+ ref: refs.setFloating,
102
+ style: floatingStyles,
103
+ ...getFloatingProps(),
104
+ children: /*#__PURE__*/_jsx(TransitionInitialMount, {
105
+ appearClassName: getClassName('bpk-popover--appear'),
106
+ appearActiveClassName: getClassName('bpk-popover--appear-active'),
107
+ transitionTimeout: 200,
108
+ children: /*#__PURE__*/_jsxs("section", {
109
+ id: id,
110
+ tabIndex: -1,
111
+ role: "dialog",
112
+ "aria-labelledby": labelId,
113
+ className: classNames,
114
+ ...rest,
115
+ children: [showArrow && /*#__PURE__*/_jsx(FloatingArrow, {
116
+ ref: arrowRef,
117
+ context: context,
118
+ id: ARROW_ID
119
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
120
+ ,
121
+ className: getClassName('bpk-popover__arrow'),
122
+ role: "presentation",
123
+ stroke: surfaceHighlightDay,
124
+ strokeWidth: 0.0625
125
+ }), labelAsTitle ? /*#__PURE__*/_jsxs("header", {
126
+ className: getClassName('bpk-popover__header'),
127
+ children: [/*#__PURE__*/_jsx(BpkText, {
128
+ tagName: "h2",
129
+ id: labelId,
130
+ textStyle: TEXT_STYLES.label1,
131
+ children: label
132
+ }), "\xA0", closeButtonIcon ? /*#__PURE__*/_jsx(BpkCloseButton, {
133
+ label: closeButtonText,
134
+ onClick: () => {
135
+ bindEventSource(EVENT_SOURCES.CLOSE_BUTTON, onClose);
136
+ setIsOpenState(false);
137
+ },
138
+ ...closeButtonProps
139
+ }) : /*#__PURE__*/_jsx(BpkButtonLink, {
140
+ onClick: () => {
141
+ bindEventSource(EVENT_SOURCES.CLOSE_LINK, onClose);
142
+ setIsOpenState(false);
143
+ },
144
+ ...closeButtonProps,
145
+ children: closeButtonText
146
+ })]
147
+ }) : /*#__PURE__*/_jsx("span", {
148
+ id: labelId,
149
+ className: getClassName('bpk-popover__label'),
150
+ children: label
151
+ }), /*#__PURE__*/_jsx("div", {
152
+ className: bodyClassNames,
153
+ children: children
154
+ }), !labelAsTitle && /*#__PURE__*/_jsx("footer", {
155
+ className: getClassName('bpk-popover__footer'),
156
+ children: /*#__PURE__*/_jsx(BpkButtonLink, {
157
+ onClick: () => {
158
+ bindEventSource(EVENT_SOURCES.CLOSE_LINK, onClose);
159
+ setIsOpenState(false);
160
+ },
161
+ ...closeButtonProps,
162
+ children: closeButtonText
163
+ })
164
+ })]
165
+ })
111
166
  })
112
- })]
113
- })
167
+ })
168
+ })]
114
169
  });
115
170
  };
116
- export const propTypes = {
117
- children: PropTypes.node.isRequired,
118
- closeButtonText: PropTypes.string.isRequired,
119
- id: PropTypes.string.isRequired,
120
- label: PropTypes.string.isRequired,
121
- onClose: PropTypes.func.isRequired,
122
- className: PropTypes.string,
123
- closeButtonIcon: PropTypes.bool,
124
- closeButtonProps: PropTypes.object,
125
- labelAsTitle: PropTypes.bool,
126
- padded: PropTypes.bool
127
- };
128
- export const defaultProps = {
129
- className: null,
130
- closeButtonIcon: true,
131
- closeButtonProps: null,
132
- labelAsTitle: false,
133
- padded: true
134
- };
135
- BpkPopover.propTypes = {
136
- ...propTypes
137
- };
138
- BpkPopover.defaultProps = {
139
- ...defaultProps
140
- };
141
171
  export default BpkPopover;