@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.
- package/bpk-animate-height/package.json +2 -2
- package/bpk-component-accordion/package.json +6 -6
- package/bpk-component-aria-live/package.json +7 -7
- package/bpk-component-autosuggest/package.json +4 -4
- package/bpk-component-badge/package.json +4 -4
- package/bpk-component-banner-alert/package.json +8 -8
- package/bpk-component-barchart/package.json +7 -7
- package/bpk-component-blockquote/package.json +2 -2
- package/bpk-component-breadcrumb/package.json +5 -5
- package/bpk-component-breakpoint/package.json +2 -2
- package/bpk-component-button/package.json +2 -2
- package/bpk-component-calendar/package.json +8 -8
- package/bpk-component-card/package.json +4 -4
- package/bpk-component-checkbox/package.json +4 -4
- package/bpk-component-chip/package.json +5 -5
- package/bpk-component-close-button/package.json +4 -4
- package/bpk-component-code/package.json +2 -2
- package/bpk-component-content-container/package.json +2 -2
- package/bpk-component-datatable/package.json +3 -3
- package/bpk-component-datepicker/README.md +4 -0
- package/bpk-component-datepicker/package.json +8 -8
- package/bpk-component-datepicker/src/BpkDatepicker.js +18 -13
- package/bpk-component-datepicker/src/BpkDatepicker.module.scss +5 -0
- package/bpk-component-description-list/package.json +2 -2
- package/bpk-component-dialog/package.json +8 -8
- package/bpk-component-drawer/package.json +8 -8
- package/bpk-component-fieldset/package.json +12 -12
- package/bpk-component-flare/package.json +4 -4
- package/bpk-component-floating-notification/package.json +5 -5
- package/bpk-component-form-validation/package.json +9 -9
- package/bpk-component-graphic-promotion/package.json +4 -4
- package/bpk-component-grid/package.json +2 -2
- package/bpk-component-grid-toggle/package.json +3 -3
- package/bpk-component-horizontal-nav/package.json +5 -5
- package/bpk-component-icon/package.json +5 -5
- package/bpk-component-image/package.json +5 -5
- package/bpk-component-infinite-scroll/package.json +6 -6
- package/bpk-component-input/package.json +6 -6
- package/bpk-component-label/package.json +2 -2
- package/bpk-component-link/package.json +3 -3
- package/bpk-component-list/package.json +2 -2
- package/bpk-component-loading-button/package.json +6 -6
- package/bpk-component-map/package.json +6 -6
- package/bpk-component-mobile-scroll-container/package.json +2 -2
- package/bpk-component-modal/package.json +9 -9
- package/bpk-component-navigation-bar/package.json +7 -7
- package/bpk-component-navigation-stack/package.json +6 -6
- package/bpk-component-nudger/package.json +6 -6
- package/bpk-component-overlay/package.json +4 -4
- package/bpk-component-pagination/package.json +4 -4
- package/bpk-component-panel/package.json +2 -2
- package/bpk-component-phone-input/package.json +8 -8
- package/bpk-component-popover/README.md +15 -3
- package/bpk-component-popover/package.json +8 -8
- package/bpk-component-popover/src/BpkPopoverPortal.js +2 -10
- package/bpk-component-price/package.json +3 -3
- package/bpk-component-progress/package.json +4 -4
- package/bpk-component-radio/package.json +3 -3
- package/bpk-component-rating/package.json +3 -3
- package/bpk-component-rtl-toggle/package.json +3 -3
- package/bpk-component-scrollable-calendar/package.json +5 -5
- package/bpk-component-section-list/package.json +5 -5
- package/bpk-component-select/package.json +3 -3
- package/bpk-component-skip-link/package.json +2 -2
- package/bpk-component-slider/package.json +3 -3
- package/bpk-component-spinner/package.json +2 -2
- package/bpk-component-split-input/package.json +3 -3
- package/bpk-component-star-rating/package.json +5 -5
- package/bpk-component-switch/package.json +2 -2
- package/bpk-component-table/package.json +2 -2
- package/bpk-component-text/package.json +2 -2
- package/bpk-component-textarea/package.json +4 -4
- package/bpk-component-theme-toggle/package.json +4 -4
- package/bpk-component-ticket/package.json +4 -4
- package/bpk-component-tooltip/README.md +12 -1
- package/bpk-component-tooltip/package.json +3 -3
- package/bpk-component-tooltip/src/BpkTooltip.module.scss +4 -0
- package/bpk-component-tooltip/src/BpkTooltipPortal.js +24 -21
- package/bpk-react-utils/package.json +1 -1
- package/bpk-react-utils/src/Portal.js +1 -1
- package/bpk-scrim-utils/package.json +2 -2
- 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={
|
|
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": "
|
|
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.
|
|
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.
|
|
27
|
+
"bpk-component-text": "^7.0.7"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -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 {
|
|
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
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
}
|
|
@@ -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.
|
|
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.
|
|
20
|
+
"bpk-react-utils": "^6.0.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"react": "^16.3.0 || ^17.0.0"
|