@skyscanner/backpack-web 36.18.0 → 37.1.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-component-button/src/BpkButtonBase.module.css +1 -1
- package/bpk-component-button/src/BpkButtonV2/BpkButton.module.css +1 -1
- package/bpk-component-carousel/src/BpkCarousel.js +0 -2
- package/bpk-component-checkbox/src/BpkCheckbox.module.css +1 -1
- package/bpk-component-icon/all.d.ts +2 -1
- package/bpk-component-icon/all.js +2 -1
- package/bpk-component-icon/lg/award.js +1 -1
- package/bpk-component-icon/lg/baggage-personal-item.js +14 -0
- package/bpk-component-icon/lg/bus.js +8 -5
- package/bpk-component-icon/sm/award.js +1 -1
- package/bpk-component-icon/sm/baggage-personal-item.js +14 -0
- package/bpk-component-icon/sm/bus.js +3 -2
- package/bpk-component-icon/sm/check.js +18 -0
- package/bpk-component-icon/xl/star-half.js +14 -0
- package/bpk-component-icon/xl/star-outline.js +14 -0
- package/bpk-component-icon/xl/star.js +14 -0
- package/bpk-component-inset-banner/src/BpkInsetBanner.d.ts +3 -0
- package/bpk-component-inset-banner/src/BpkInsetBanner.js +8 -0
- package/bpk-component-inset-banner/src/BpkInsetBanner.module.css +1 -1
- package/bpk-component-link/src/BpkLink.js +11 -5
- package/bpk-component-link/src/BpkLink.module.css +1 -1
- package/bpk-component-overlay/src/BpkOverlay.d.ts +2 -2
- package/bpk-component-overlay/src/BpkOverlay.js +4 -4
- package/bpk-component-overlay/src/BpkOverlay.module.css +1 -1
- package/bpk-component-page-indicator/index.d.ts +6 -0
- package/bpk-component-page-indicator/index.js +3 -1
- package/bpk-component-page-indicator/src/BpkPageIndicator.d.ts +21 -0
- package/bpk-component-page-indicator/src/BpkPageIndicator.js +49 -68
- package/bpk-component-page-indicator/src/NavButton.d.ts +15 -0
- package/bpk-component-page-indicator/src/NavButton.js +22 -35
- package/bpk-component-price/src/BpkPrice.js +6 -2
- package/bpk-component-tooltip/index.d.ts +4 -4
- package/bpk-component-tooltip/index.js +2 -2
- package/bpk-component-tooltip/src/BpkTooltip.d.ts +17 -4
- package/bpk-component-tooltip/src/BpkTooltip.js +100 -23
- package/bpk-component-tooltip/src/BpkTooltip.module.css +1 -1
- package/bpk-mixins/_buttons.scss +5 -1
- package/bpk-mixins/_forms.scss +5 -26
- package/bpk-mixins/_typography.scss +101 -8
- package/package.json +3 -3
- package/unstable__bpk-mixins/_buttons.scss +5 -1
- package/unstable__bpk-mixins/_forms.scss +5 -28
- package/unstable__bpk-mixins/_typography.scss +101 -8
- package/bpk-component-tooltip/src/BpkTooltipPortal.d.ts +0 -54
- package/bpk-component-tooltip/src/BpkTooltipPortal.js +0 -154
|
@@ -14,7 +14,8 @@
|
|
|
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
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
18
19
|
import { cssModules } from "../../bpk-react-utils";
|
|
19
20
|
import NavButton, { DIRECTIONS } from "./NavButton";
|
|
20
21
|
import STYLES from "./BpkPageIndicator.module.css";
|
|
@@ -27,84 +28,64 @@ export const VARIANT = {
|
|
|
27
28
|
overImage: 'overImage'
|
|
28
29
|
};
|
|
29
30
|
const BpkPageIndicator = ({
|
|
30
|
-
className,
|
|
31
|
+
className = undefined,
|
|
31
32
|
currentIndex,
|
|
32
33
|
indicatorLabel,
|
|
33
34
|
nextNavLabel,
|
|
34
|
-
onClick,
|
|
35
|
+
onClick = () => {},
|
|
35
36
|
prevNavLabel,
|
|
36
|
-
showNav,
|
|
37
|
+
showNav = false,
|
|
37
38
|
totalIndicators,
|
|
38
|
-
variant
|
|
39
|
+
variant = VARIANT.default
|
|
39
40
|
}) => {
|
|
40
41
|
/**
|
|
41
42
|
* This validation is used to avoid an a11y issue when onClick isn't available.
|
|
42
43
|
* In this case, we can set aria-hidden = true to let screen reader skip reading page indicator dots.
|
|
43
44
|
* and render the dot as div rather than button to align with aria-hidden = true.
|
|
44
|
-
|
|
45
|
+
*/
|
|
45
46
|
const isInteractive = !!onClick;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
direction: DIRECTIONS.NEXT
|
|
88
|
-
})]
|
|
89
|
-
})
|
|
47
|
+
const customStyle = {
|
|
48
|
+
'--scroll-index': totalIndicators > DISPLAYED_TOTAL ? Math.min(currentIndex - START_SCROLL_INDEX, totalIndicators - DISPLAYED_TOTAL) : 0
|
|
49
|
+
};
|
|
50
|
+
return /*#__PURE__*/_jsx("div", {
|
|
51
|
+
className: className,
|
|
52
|
+
"aria-hidden": isInteractive ? 'false' : 'true',
|
|
53
|
+
"data-testid": "indicator-container",
|
|
54
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
55
|
+
className: getClassName('bpk-page-indicator', showNav && 'bpk-page-indicator__showNav'),
|
|
56
|
+
children: [showNav && /*#__PURE__*/_jsx(NavButton, {
|
|
57
|
+
currentIndex: currentIndex,
|
|
58
|
+
onClick: onClick,
|
|
59
|
+
disabled: currentIndex === 0,
|
|
60
|
+
direction: DIRECTIONS.PREV,
|
|
61
|
+
ariaLabel: prevNavLabel
|
|
62
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
63
|
+
className: getClassName('bpk-page-indicator__container'),
|
|
64
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
65
|
+
className: getClassName('bpk-page-indicator__indicators-container'),
|
|
66
|
+
style: currentIndex > START_SCROLL_INDEX ? customStyle : undefined,
|
|
67
|
+
children: [...Array(totalIndicators)].map((val, index) => isInteractive ? /*#__PURE__*/_jsx("button", {
|
|
68
|
+
type: "button",
|
|
69
|
+
onClick: e => {
|
|
70
|
+
onClick(e, index, DIRECTIONS.INDICATORS);
|
|
71
|
+
},
|
|
72
|
+
className: getClassName('bpk-page-indicator__indicator', `bpk-page-indicator__indicator--${variant}`, index === currentIndex && `bpk-page-indicator__indicator--active-${variant}`),
|
|
73
|
+
"aria-label": `${indicatorLabel} ${index + 1}`,
|
|
74
|
+
"aria-current": currentIndex === index ? 'true' : 'false'
|
|
75
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
76
|
+
}, `indicator-${index}`) : /*#__PURE__*/_jsx("div", {
|
|
77
|
+
className: getClassName('bpk-page-indicator__indicator', `bpk-page-indicator__indicator--${variant}`, index === currentIndex && `bpk-page-indicator__indicator--active-${variant}`)
|
|
78
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
79
|
+
}, `indicator-${index}`))
|
|
80
|
+
})
|
|
81
|
+
}), showNav && /*#__PURE__*/_jsx(NavButton, {
|
|
82
|
+
currentIndex: currentIndex,
|
|
83
|
+
onClick: onClick,
|
|
84
|
+
disabled: currentIndex === totalIndicators - 1,
|
|
85
|
+
ariaLabel: nextNavLabel,
|
|
86
|
+
direction: DIRECTIONS.NEXT
|
|
87
|
+
})]
|
|
90
88
|
})
|
|
91
|
-
);
|
|
92
|
-
};
|
|
93
|
-
BpkPageIndicator.propTypes = {
|
|
94
|
-
indicatorLabel: PropTypes.string,
|
|
95
|
-
prevNavLabel: PropTypes.string,
|
|
96
|
-
nextNavLabel: PropTypes.string,
|
|
97
|
-
currentIndex: PropTypes.number.isRequired,
|
|
98
|
-
totalIndicators: PropTypes.number.isRequired,
|
|
99
|
-
variant: PropTypes.oneOf(Object.keys(VARIANT)),
|
|
100
|
-
onClick: PropTypes.func,
|
|
101
|
-
className: PropTypes.string,
|
|
102
|
-
showNav: PropTypes.bool
|
|
103
|
-
};
|
|
104
|
-
BpkPageIndicator.defaultProps = {
|
|
105
|
-
onClick: null,
|
|
106
|
-
className: null,
|
|
107
|
-
showNav: false,
|
|
108
|
-
variant: VARIANT.default
|
|
89
|
+
});
|
|
109
90
|
};
|
|
110
91
|
export default BpkPageIndicator;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const DIRECTIONS: {
|
|
2
|
+
readonly PREV: "PREV";
|
|
3
|
+
readonly INDICATORS: "INDICATORS";
|
|
4
|
+
readonly NEXT: "NEXT";
|
|
5
|
+
};
|
|
6
|
+
type Direction = (typeof DIRECTIONS)[keyof typeof DIRECTIONS];
|
|
7
|
+
type Props = {
|
|
8
|
+
ariaLabel: string | undefined;
|
|
9
|
+
currentIndex: number;
|
|
10
|
+
direction: Direction;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>, newIndex: number, direction: Direction) => void;
|
|
13
|
+
};
|
|
14
|
+
declare const NavButton: ({ ariaLabel, currentIndex, direction, disabled, onClick, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default NavButton;
|
|
@@ -14,7 +14,8 @@
|
|
|
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
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
18
19
|
import { BUTTON_TYPES, BpkButtonV2 } from "../../bpk-component-button";
|
|
19
20
|
import { withButtonAlignment, withRtlSupport } from "../../bpk-component-icon";
|
|
20
21
|
import LeftArrowIcon from "../../bpk-component-icon/lg/chevron-left";
|
|
@@ -27,38 +28,24 @@ export const DIRECTIONS = {
|
|
|
27
28
|
};
|
|
28
29
|
const AlignedLeftArrowIcon = withButtonAlignment(withRtlSupport(LeftArrowIcon));
|
|
29
30
|
const AlignedRightArrowIcon = withButtonAlignment(withRtlSupport(RightArrowIcon));
|
|
30
|
-
const NavButton =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
children: direction === DIRECTIONS.PREV ? /*#__PURE__*/_jsx(AlignedLeftArrowIcon, {}) : /*#__PURE__*/_jsx(AlignedRightArrowIcon, {})
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
NavButton.propTypes = {
|
|
54
|
-
direction: PropTypes.oneOf(Object.keys(DIRECTIONS)).isRequired,
|
|
55
|
-
disabled: PropTypes.bool,
|
|
56
|
-
ariaLabel: PropTypes.string.isRequired,
|
|
57
|
-
currentIndex: PropTypes.number.isRequired,
|
|
58
|
-
onClick: PropTypes.func
|
|
59
|
-
};
|
|
60
|
-
NavButton.defaultProps = {
|
|
61
|
-
disabled: false,
|
|
62
|
-
onClick: null
|
|
63
|
-
};
|
|
31
|
+
const NavButton = ({
|
|
32
|
+
ariaLabel,
|
|
33
|
+
currentIndex,
|
|
34
|
+
direction,
|
|
35
|
+
disabled = false,
|
|
36
|
+
onClick = () => {}
|
|
37
|
+
}) => /*#__PURE__*/_jsx(BpkButtonV2, {
|
|
38
|
+
iconOnly: true,
|
|
39
|
+
type: BUTTON_TYPES.link,
|
|
40
|
+
onClick: e => {
|
|
41
|
+
if (direction === DIRECTIONS.PREV) {
|
|
42
|
+
onClick(e, currentIndex - 1, direction);
|
|
43
|
+
} else {
|
|
44
|
+
onClick(e, currentIndex + 1, direction);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"aria-label": ariaLabel,
|
|
48
|
+
disabled: disabled,
|
|
49
|
+
children: direction === DIRECTIONS.PREV ? /*#__PURE__*/_jsx(AlignedLeftArrowIcon, {}) : /*#__PURE__*/_jsx(AlignedRightArrowIcon, {})
|
|
50
|
+
});
|
|
64
51
|
export default NavButton;
|
|
@@ -40,6 +40,7 @@ const BpkPrice = props => {
|
|
|
40
40
|
const {
|
|
41
41
|
align,
|
|
42
42
|
className,
|
|
43
|
+
dataAttributes,
|
|
43
44
|
icon,
|
|
44
45
|
leadingClassName,
|
|
45
46
|
leadingText,
|
|
@@ -107,6 +108,7 @@ const BpkPrice = props => {
|
|
|
107
108
|
children: /*#__PURE__*/_jsx(BpkText, {
|
|
108
109
|
textStyle: priceTextStyle,
|
|
109
110
|
tagName: "span",
|
|
111
|
+
...dataAttributes,
|
|
110
112
|
children: price
|
|
111
113
|
})
|
|
112
114
|
}), icon && /*#__PURE__*/_jsx("span", {
|
|
@@ -124,7 +126,8 @@ BpkPrice.propTypes = {
|
|
|
124
126
|
leadingText: PropTypes.string,
|
|
125
127
|
trailingText: PropTypes.string,
|
|
126
128
|
previousPrice: PropTypes.string,
|
|
127
|
-
leadingClassName: PropTypes.string
|
|
129
|
+
leadingClassName: PropTypes.string,
|
|
130
|
+
dataAttributes: PropTypes.objectOf(PropTypes.string)
|
|
128
131
|
};
|
|
129
132
|
BpkPrice.defaultProps = {
|
|
130
133
|
size: SIZES.small,
|
|
@@ -133,6 +136,7 @@ BpkPrice.defaultProps = {
|
|
|
133
136
|
leadingText: null,
|
|
134
137
|
trailingText: null,
|
|
135
138
|
previousPrice: null,
|
|
136
|
-
leadingClassName: null
|
|
139
|
+
leadingClassName: null,
|
|
140
|
+
dataAttributes: {}
|
|
137
141
|
};
|
|
138
142
|
export default BpkPrice;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import BpkTooltip from './src/BpkTooltip';
|
|
2
2
|
import { TOOLTIP_TYPES } from './src/constants';
|
|
3
|
-
import type { Props } from './src/
|
|
4
|
-
export type
|
|
5
|
-
export default
|
|
3
|
+
import type { Props } from './src/BpkTooltip';
|
|
4
|
+
export type BpkTooltipProps = Props;
|
|
5
|
+
export default BpkTooltip;
|
|
6
6
|
export { TOOLTIP_TYPES };
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import
|
|
19
|
+
import BpkTooltip from "./src/BpkTooltip";
|
|
20
20
|
import { TOOLTIP_TYPES } from "./src/constants";
|
|
21
|
-
export default
|
|
21
|
+
export default BpkTooltip;
|
|
22
22
|
export { TOOLTIP_TYPES };
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactNode, ReactElement } from 'react';
|
|
2
2
|
import { TOOLTIP_TYPES } from './constants';
|
|
3
|
-
|
|
3
|
+
import type { Placement } from '@floating-ui/react';
|
|
4
|
+
export type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Tooltips are invisible to assistive technologies such as screen readers.
|
|
7
|
+
* To improve accessibility, `ariaLabel` is required to describe the content of the tooltip to assistive technologies.
|
|
8
|
+
* The label will be used on the `target` element, so any existing `aria-label` attached to `target` will be overridden.
|
|
9
|
+
*/
|
|
10
|
+
ariaLabel: string;
|
|
11
|
+
/**
|
|
12
|
+
* "target" should be a DOM element.
|
|
13
|
+
*/
|
|
14
|
+
target: ReactElement<any>;
|
|
4
15
|
id: string;
|
|
5
16
|
children: ReactNode | string;
|
|
6
17
|
type?: (typeof TOOLTIP_TYPES)[keyof typeof TOOLTIP_TYPES];
|
|
7
18
|
padded?: boolean;
|
|
8
|
-
|
|
19
|
+
hideOnTouchDevices?: boolean;
|
|
20
|
+
placement?: Placement;
|
|
21
|
+
isOpen?: boolean;
|
|
9
22
|
};
|
|
10
|
-
declare const BpkTooltip: ({ children,
|
|
23
|
+
declare const BpkTooltip: ({ ariaLabel, children, hideOnTouchDevices, id, isOpen, padded, placement, target, type, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
24
|
export default BpkTooltip;
|
|
@@ -22,42 +22,119 @@ This is the component for the tooltip that is displayed to users.
|
|
|
22
22
|
The actual component that developers create (i.e. the default export from this package) is BpkTooltipPortal.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import { cloneElement, useRef, useState, useEffect } from 'react';
|
|
26
|
+
import { arrow, FloatingArrow, FloatingPortal, offset, shift, useFloating, useHover, useInteractions, useRole } from '@floating-ui/react';
|
|
27
|
+
import { surfaceHighlightDay } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
25
28
|
import { TransitionInitialMount, cssModules } from "../../bpk-react-utils";
|
|
26
29
|
import { ARROW_ID, TOOLTIP_TYPES } from "./constants";
|
|
27
30
|
import STYLES from "./BpkTooltip.module.css";
|
|
28
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
29
32
|
const getClassName = cssModules(STYLES);
|
|
33
|
+
|
|
34
|
+
// The stroke width is used to set the border width of the arrow.
|
|
35
|
+
const strokeWidth = 1;
|
|
36
|
+
// This function is to ensure the arrow alignment when used on the top and bottom
|
|
37
|
+
// doesn't look clipped away from the tooltip. This is due to our use of box-shadows that makes it look floating away,
|
|
38
|
+
// so we need to compensate slightly to make it look as one.
|
|
39
|
+
const getArrowAlignment = placement => {
|
|
40
|
+
if (placement.includes('bottom')) {
|
|
41
|
+
return {
|
|
42
|
+
bottom: '98%'
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (placement.includes('top')) {
|
|
46
|
+
return {
|
|
47
|
+
top: '98%'
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
};
|
|
52
|
+
const hasTouchSupport = () => !!(typeof window !== 'undefined' && ('ontouchstart' in window || navigator.maxTouchPoints > 0));
|
|
30
53
|
const BpkTooltip = ({
|
|
54
|
+
ariaLabel,
|
|
31
55
|
children,
|
|
32
|
-
|
|
56
|
+
hideOnTouchDevices = true,
|
|
33
57
|
id,
|
|
58
|
+
isOpen = false,
|
|
34
59
|
padded = true,
|
|
60
|
+
placement = 'bottom',
|
|
61
|
+
target,
|
|
35
62
|
type = TOOLTIP_TYPES.light,
|
|
36
63
|
...rest
|
|
37
64
|
}) => {
|
|
38
|
-
const
|
|
65
|
+
const [isOpenState, setIsOpenState] = useState(isOpen);
|
|
66
|
+
const arrowRef = useRef(null);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (!isOpen) {
|
|
69
|
+
setIsOpenState(false);
|
|
70
|
+
}
|
|
71
|
+
}, [isOpen]);
|
|
72
|
+
const {
|
|
73
|
+
context,
|
|
74
|
+
floatingStyles,
|
|
75
|
+
refs
|
|
76
|
+
} = useFloating({
|
|
77
|
+
open: isOpenState,
|
|
78
|
+
onOpenChange: setIsOpenState,
|
|
79
|
+
placement,
|
|
80
|
+
middleware: [offset(8), shift(), arrow({
|
|
81
|
+
element: arrowRef
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
const hover = useHover(context, {
|
|
85
|
+
mouseOnly: !hasTouchSupport() || !hideOnTouchDevices
|
|
86
|
+
});
|
|
87
|
+
const role = useRole(context, {
|
|
88
|
+
role: 'tooltip'
|
|
89
|
+
});
|
|
90
|
+
const {
|
|
91
|
+
getFloatingProps,
|
|
92
|
+
getReferenceProps
|
|
93
|
+
} = useInteractions([hover, role]);
|
|
94
|
+
const targetWithAccessibilityProps = /*#__PURE__*/cloneElement(target, {
|
|
95
|
+
tabIndex: '0',
|
|
96
|
+
'aria-label': ariaLabel,
|
|
97
|
+
role: 'tooltip',
|
|
98
|
+
ref: refs.setReference,
|
|
99
|
+
...getReferenceProps()
|
|
100
|
+
});
|
|
101
|
+
const classNames = getClassName('bpk-tooltip');
|
|
39
102
|
const innerClassNames = getClassName('bpk-tooltip__inner', type === TOOLTIP_TYPES.dark && 'bpk-tooltip__inner--dark', padded && 'bpk-tooltip__inner--padded');
|
|
40
103
|
const arrowClassNames = getClassName('bpk-tooltip__arrow', type === TOOLTIP_TYPES.dark && 'bpk-tooltip__arrow--dark');
|
|
41
|
-
return /*#__PURE__*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
104
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
105
|
+
children: [targetWithAccessibilityProps, isOpenState && /*#__PURE__*/_jsx(FloatingPortal, {
|
|
106
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
107
|
+
className: getClassName('bpk-tooltip--container'),
|
|
108
|
+
ref: refs.setFloating,
|
|
109
|
+
style: floatingStyles,
|
|
110
|
+
...getFloatingProps(),
|
|
111
|
+
children: /*#__PURE__*/_jsx(TransitionInitialMount, {
|
|
112
|
+
appearClassName: getClassName('bpk-tooltip--appear'),
|
|
113
|
+
appearActiveClassName: getClassName('bpk-tooltip--appear-active'),
|
|
114
|
+
transitionTimeout: 200,
|
|
115
|
+
children: /*#__PURE__*/_jsxs("section", {
|
|
116
|
+
id: id,
|
|
117
|
+
tabIndex: -1,
|
|
118
|
+
role: "dialog",
|
|
119
|
+
className: classNames,
|
|
120
|
+
...rest,
|
|
121
|
+
children: [/*#__PURE__*/_jsx(FloatingArrow, {
|
|
122
|
+
ref: arrowRef,
|
|
123
|
+
context: context,
|
|
124
|
+
id: ARROW_ID,
|
|
125
|
+
className: arrowClassNames,
|
|
126
|
+
role: "presentation",
|
|
127
|
+
stroke: surfaceHighlightDay,
|
|
128
|
+
strokeWidth: strokeWidth,
|
|
129
|
+
style: getArrowAlignment(context.placement)
|
|
130
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
131
|
+
className: innerClassNames,
|
|
132
|
+
children: children
|
|
133
|
+
})]
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
})]
|
|
61
138
|
});
|
|
62
139
|
};
|
|
63
140
|
export default BpkTooltip;
|
|
@@ -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-tooltip
|
|
18
|
+
.bpk-tooltip--container{z-index:900}.bpk-tooltip{transition:opacity 200ms ease-in-out;outline:0;opacity:1;border:.0625rem solid #e0e4e9;background-color:#fff;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}.bpk-tooltip--appear{opacity:0}.bpk-tooltip--appear-active{opacity:1}.bpk-tooltip__arrow{width:.5rem;height:.5rem;fill:#fff}.bpk-tooltip__arrow--dark{fill:#05203c}.bpk-tooltip__inner--padded{padding:.5rem 1rem}.bpk-tooltip__inner--dark{color:#fff;border:.0625rem solid #05203c;background-color:#05203c;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}
|
package/bpk-mixins/_buttons.scss
CHANGED
|
@@ -395,7 +395,11 @@
|
|
|
395
395
|
background: none; /* stylelint-disable-line order/order, order/properties-order */
|
|
396
396
|
box-shadow: none;
|
|
397
397
|
|
|
398
|
-
@include bpk-link;
|
|
398
|
+
@include bpk-link--implicit;
|
|
399
|
+
|
|
400
|
+
&::after {
|
|
401
|
+
bottom: auto;
|
|
402
|
+
}
|
|
399
403
|
|
|
400
404
|
padding: $vertical-padding 0; /* stylelint-disable-line order/order, order/properties-order */
|
|
401
405
|
color: $bpk-private-button-link-normal-foreground-day;
|
package/bpk-mixins/_forms.scss
CHANGED
|
@@ -627,34 +627,13 @@
|
|
|
627
627
|
/// @include bpk-checkbox__checkmark();
|
|
628
628
|
/// }
|
|
629
629
|
@mixin bpk-checkbox__checkmark {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
transform: rotate(45deg);
|
|
635
|
-
border-radius: $bpk-border-size-lg;
|
|
636
|
-
background-color: $bpk-text-primary-inverse-day;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
&::before {
|
|
640
|
-
top: bpk-spacing-md() - $bpk-one-pixel-rem;
|
|
641
|
-
left: 0;
|
|
642
|
-
width: bpk-spacing-lg() / 3;
|
|
643
|
-
height: bpk-spacing-sm() - $bpk-one-pixel-rem;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
&::after {
|
|
647
|
-
top: bpk-spacing-sm() / 2;
|
|
648
|
-
left: bpk-spacing-md() - $bpk-one-pixel-rem;
|
|
649
|
-
width: bpk-spacing-sm() - $bpk-one-pixel-rem;
|
|
650
|
-
height: bpk-spacing-md() + ($bpk-one-pixel-rem * 3);
|
|
651
|
-
}
|
|
630
|
+
background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22white%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E');
|
|
631
|
+
background-repeat: no-repeat;
|
|
632
|
+
background-position: $bpk-one-pixel-rem center;
|
|
633
|
+
background-size: calc(100% - $bpk-one-pixel-rem * 2.5) auto;
|
|
652
634
|
|
|
653
635
|
&:disabled {
|
|
654
|
-
|
|
655
|
-
&::after {
|
|
656
|
-
background-color: $bpk-text-disabled-day;
|
|
657
|
-
}
|
|
636
|
+
background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22lightgrey%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E');
|
|
658
637
|
}
|
|
659
638
|
}
|
|
660
639
|
|