@skyscanner/backpack-web 7.1.0 → 8.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 (82) hide show
  1. package/bpk-animate-height/package.json +2 -2
  2. package/bpk-component-accordion/package.json +6 -6
  3. package/bpk-component-aria-live/package.json +7 -7
  4. package/bpk-component-autosuggest/package.json +4 -4
  5. package/bpk-component-badge/package.json +4 -4
  6. package/bpk-component-banner-alert/package.json +8 -8
  7. package/bpk-component-barchart/package.json +7 -7
  8. package/bpk-component-blockquote/package.json +2 -2
  9. package/bpk-component-breadcrumb/package.json +5 -5
  10. package/bpk-component-breakpoint/package.json +2 -2
  11. package/bpk-component-button/package.json +2 -2
  12. package/bpk-component-calendar/package.json +8 -8
  13. package/bpk-component-card/package.json +4 -4
  14. package/bpk-component-checkbox/package.json +4 -4
  15. package/bpk-component-chip/package.json +5 -5
  16. package/bpk-component-close-button/package.json +4 -4
  17. package/bpk-component-code/package.json +2 -2
  18. package/bpk-component-content-container/package.json +2 -2
  19. package/bpk-component-datatable/package.json +3 -3
  20. package/bpk-component-datepicker/README.md +4 -0
  21. package/bpk-component-datepicker/package.json +8 -8
  22. package/bpk-component-datepicker/src/BpkDatepicker.js +18 -13
  23. package/bpk-component-datepicker/src/BpkDatepicker.module.scss +5 -0
  24. package/bpk-component-description-list/package.json +2 -2
  25. package/bpk-component-dialog/package.json +8 -8
  26. package/bpk-component-drawer/package.json +8 -8
  27. package/bpk-component-fieldset/package.json +12 -12
  28. package/bpk-component-flare/package.json +4 -4
  29. package/bpk-component-floating-notification/package.json +5 -5
  30. package/bpk-component-form-validation/package.json +9 -9
  31. package/bpk-component-graphic-promotion/package.json +4 -4
  32. package/bpk-component-grid/package.json +2 -2
  33. package/bpk-component-grid-toggle/package.json +3 -3
  34. package/bpk-component-horizontal-nav/package.json +5 -5
  35. package/bpk-component-icon/package.json +5 -5
  36. package/bpk-component-image/package.json +5 -5
  37. package/bpk-component-infinite-scroll/package.json +6 -6
  38. package/bpk-component-input/package.json +6 -6
  39. package/bpk-component-label/package.json +2 -2
  40. package/bpk-component-link/package.json +3 -3
  41. package/bpk-component-list/package.json +2 -2
  42. package/bpk-component-loading-button/package.json +6 -6
  43. package/bpk-component-map/package.json +6 -6
  44. package/bpk-component-mobile-scroll-container/package.json +2 -2
  45. package/bpk-component-modal/package.json +9 -9
  46. package/bpk-component-navigation-bar/package.json +7 -7
  47. package/bpk-component-navigation-stack/package.json +6 -6
  48. package/bpk-component-nudger/package.json +6 -6
  49. package/bpk-component-overlay/package.json +4 -4
  50. package/bpk-component-pagination/package.json +4 -4
  51. package/bpk-component-panel/package.json +2 -2
  52. package/bpk-component-phone-input/package.json +8 -8
  53. package/bpk-component-popover/README.md +15 -3
  54. package/bpk-component-popover/package.json +8 -8
  55. package/bpk-component-popover/src/BpkPopoverPortal.js +2 -10
  56. package/bpk-component-price/package.json +3 -3
  57. package/bpk-component-progress/package.json +4 -4
  58. package/bpk-component-radio/package.json +3 -3
  59. package/bpk-component-rating/package.json +3 -3
  60. package/bpk-component-rtl-toggle/package.json +3 -3
  61. package/bpk-component-scrollable-calendar/package.json +5 -5
  62. package/bpk-component-section-list/package.json +5 -5
  63. package/bpk-component-select/package.json +3 -3
  64. package/bpk-component-skip-link/package.json +2 -2
  65. package/bpk-component-slider/package.json +3 -3
  66. package/bpk-component-spinner/package.json +2 -2
  67. package/bpk-component-split-input/package.json +3 -3
  68. package/bpk-component-star-rating/package.json +5 -5
  69. package/bpk-component-switch/package.json +2 -2
  70. package/bpk-component-table/package.json +2 -2
  71. package/bpk-component-text/package.json +2 -2
  72. package/bpk-component-textarea/package.json +4 -4
  73. package/bpk-component-theme-toggle/package.json +4 -4
  74. package/bpk-component-ticket/package.json +4 -4
  75. package/bpk-component-tooltip/README.md +12 -1
  76. package/bpk-component-tooltip/package.json +3 -3
  77. package/bpk-component-tooltip/src/BpkTooltip.module.scss +4 -0
  78. package/bpk-component-tooltip/src/BpkTooltipPortal.js +24 -21
  79. package/bpk-react-utils/package.json +1 -1
  80. package/bpk-react-utils/src/Portal.js +1 -1
  81. package/bpk-scrim-utils/package.json +2 -2
  82. package/package.json +1 -1
@@ -16,10 +16,17 @@ import BpkText from 'bpk-component-text';
16
16
  import BpkTooltip from 'bpk-component-tooltip';
17
17
 
18
18
  const App = () => (
19
+ const targetRef = useRef(null);
20
+ const target = (
21
+ <div ref={targetRef} className={'my-tooltip-target'}>
22
+ <BpkText textStyle="lg">LHR</BpkText>
23
+ </div>
24
+ );
25
+
19
26
  <BpkTooltip
20
27
  ariaLabel="London Heathrow"
21
28
  id="my-tooltip"
22
- target={<BpkText textStyle="lg">LHR</BpkText>}
29
+ target={target}
23
30
  >
24
31
  London Heathrow
25
32
  </BpkTooltip>
@@ -54,3 +61,7 @@ The label will be used on the `target` element, so any existing `aria-label` att
54
61
  #### `popperModifiers`
55
62
 
56
63
  Please refer to the [documentation](https://popper.js.org/docs/v2/modifiers/) for the underlying positioning library "Popper.js". You can achieve various behaviours such as allowing the tooltip to overflow the viewport etc.
64
+
65
+ #### target
66
+
67
+ `target` should be a DOM element with a `ref` attached to it.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-tooltip",
3
- "version": "7.0.3",
3
+ "version": "8.0.0",
4
4
  "description": "Backpack tooltip component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@popperjs/core": "^2.11.5",
18
18
  "bpk-mixins": "^31.1.1",
19
- "bpk-react-utils": "^6.0.0",
19
+ "bpk-react-utils": "^6.0.1",
20
20
  "prop-types": "^15.7.2"
21
21
  },
22
22
  "peerDependencies": {
@@ -24,6 +24,6 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@skyscanner/bpk-foundations-web": "^8.0.0",
27
- "bpk-component-text": "^7.0.6"
27
+ "bpk-component-text": "^7.0.7"
28
28
  }
29
29
  }
@@ -26,6 +26,10 @@ $dark-background-color: $bpk-color-sky-gray;
26
26
 
27
27
  .bpk-tooltip-portal {
28
28
  z-index: $bpk-zindex-tooltip;
29
+
30
+ &--target {
31
+ display: inline-block;
32
+ }
29
33
  }
30
34
 
31
35
  .bpk-tooltip {
@@ -22,7 +22,7 @@ import { createPopper } from '@popperjs/core';
22
22
  import PropTypes from 'prop-types';
23
23
  import React, { Component, type Node, type Element } from 'react';
24
24
 
25
- import { PortalV1, cssModules } from '../../bpk-react-utils';
25
+ import { Portal, cssModules } from '../../bpk-react-utils';
26
26
 
27
27
  import BpkTooltip, {
28
28
  propTypes as tooltipPropTypes,
@@ -195,26 +195,29 @@ class BpkTooltipPortal extends Component<Props, State> {
195
195
  classNames.push(portalClassName);
196
196
  }
197
197
 
198
- return renderPortal ? (
199
- <PortalV1
200
- target={targetWithAccessibilityProps}
201
- targetRef={(targetRef) => {
202
- this.targetRef = targetRef;
203
- }}
204
- isOpen={this.state.isOpen}
205
- onOpen={this.onOpen}
206
- onClose={this.closeTooltip}
207
- style={portalStyle}
208
- renderTarget={renderTarget}
209
- className={classNames.join(' ')}
210
- >
211
- {/* $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'. */}
212
- <BpkTooltip padded={padded} {...rest}>
213
- {children}
214
- </BpkTooltip>
215
- </PortalV1>
216
- ) : (
217
- targetWithAccessibilityProps
198
+ return (
199
+ <>
200
+ {targetWithAccessibilityProps}
201
+ {renderPortal && (
202
+ <Portal
203
+ target={targetWithAccessibilityProps}
204
+ targetRef={(targetRef) => {
205
+ this.targetRef = targetRef;
206
+ }}
207
+ isOpen={this.state.isOpen}
208
+ onOpen={this.onOpen}
209
+ onClose={this.closeTooltip}
210
+ style={portalStyle}
211
+ renderTarget={renderTarget}
212
+ className={classNames.join(' ')}
213
+ >
214
+ {/* $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'. */}
215
+ <BpkTooltip padded={padded} {...rest}>
216
+ {children}
217
+ </BpkTooltip>
218
+ </Portal>
219
+ )}
220
+ </>
218
221
  );
219
222
  }
220
223
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-react-utils",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Utilities for Backpack's React components.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -208,7 +208,7 @@ class Portal extends Component {
208
208
  this.portalElement.className = this.props.className;
209
209
  }
210
210
  this.setState({ isVisible: true }, () =>
211
- this.props.onOpen(this.portalElement),
211
+ this.props.onOpen(this.portalElement, this.getTargetElement()),
212
212
  );
213
213
  }
214
214
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-scrim-utils",
3
- "version": "5.1.11",
3
+ "version": "5.1.12",
4
4
  "description": "Higher order component that adds an overlay behind components and manages scroll states.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -17,7 +17,7 @@
17
17
  "a11y-focus-scope": "^1.1.3",
18
18
  "a11y-focus-store": "^1.0.0",
19
19
  "bpk-mixins": "^31.1.1",
20
- "bpk-react-utils": "^6.0.0"
20
+ "bpk-react-utils": "^6.0.1"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": "^16.3.0 || ^17.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "7.1.0",
3
+ "version": "8.0.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",