@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.
- package/bpk-component-aria-live/src/BpkAriaLive.js +0 -1
- package/bpk-component-badge/src/BpkBadge.js +0 -1
- package/{bpk-scrim-utils/src/customPropTypes.js → bpk-component-banner-alert/index.d.ts} +16 -14
- package/bpk-component-banner-alert/src/AnimateAndFade.d.ts +61 -0
- package/bpk-component-banner-alert/src/AnimateAndFade.js +3 -9
- package/bpk-component-banner-alert/src/BpkBannerAlert.d.ts +29 -0
- package/bpk-component-banner-alert/src/BpkBannerAlert.js +42 -21
- package/bpk-component-banner-alert/src/BpkBannerAlertDismissable.d.ts +30 -0
- package/bpk-component-banner-alert/src/BpkBannerAlertDismissable.js +31 -33
- package/bpk-component-banner-alert/src/BpkBannerAlertExpandable.d.ts +35 -0
- package/bpk-component-banner-alert/src/BpkBannerAlertExpandable.js +15 -28
- package/bpk-component-banner-alert/src/BpkBannerAlertInner.d.ts +58 -0
- package/bpk-component-banner-alert/src/BpkBannerAlertInner.js +65 -87
- package/bpk-component-banner-alert/src/common-types.d.ts +44 -0
- package/bpk-component-banner-alert/src/common-types.js +5 -23
- package/bpk-component-banner-alert/src/themeAttributes.d.ts +20 -0
- package/bpk-component-banner-alert/src/withBannerAlertState.d.ts +169 -0
- package/bpk-component-banner-alert/src/withBannerAlertState.js +10 -29
- package/bpk-component-boilerplate/src/BpkBoilerplate.js +0 -1
- package/bpk-component-button/src/BpkButtonV2/BpkButton.js +0 -1
- package/bpk-component-calendar/index.d.ts +30 -0
- package/bpk-component-calendar/index.js +5 -4
- package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +464 -0
- package/bpk-component-calendar/src/BpkCalendarContainer.js +19 -29
- package/bpk-component-calendar/src/BpkCalendarDate.d.ts +62 -0
- package/bpk-component-calendar/src/BpkCalendarDate.js +15 -39
- package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +68 -0
- package/bpk-component-calendar/src/BpkCalendarGrid.js +9 -40
- package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +36 -0
- package/bpk-component-calendar/src/BpkCalendarGridHeader.js +33 -52
- package/bpk-component-calendar/src/BpkCalendarGridTransition.d.ts +56 -0
- package/bpk-component-calendar/src/BpkCalendarGridTransition.js +43 -42
- package/bpk-component-calendar/src/BpkCalendarNav.d.ts +37 -0
- package/bpk-component-calendar/src/BpkCalendarNav.js +18 -32
- package/bpk-component-calendar/src/Week.d.ts +51 -0
- package/bpk-component-calendar/src/Week.js +48 -70
- package/bpk-component-calendar/src/composeCalendar.d.ts +55 -0
- package/bpk-component-calendar/src/composeCalendar.js +34 -95
- package/bpk-component-calendar/src/custom-proptypes-legacy.js +140 -0
- package/bpk-component-calendar/src/custom-proptypes.d.ts +46 -0
- package/bpk-component-calendar/src/custom-proptypes.js +2 -61
- package/bpk-component-calendar/src/date-utils.d.ts +54 -0
- package/bpk-component-calendar/src/utils.d.ts +26 -0
- package/bpk-component-calendar/src/utils.js +1 -0
- package/bpk-component-calendar/test-utils.d.ts +56 -0
- package/bpk-component-calendar/test-utils.js +2 -2
- package/bpk-component-card/index.d.ts +24 -0
- package/bpk-component-card/src/BpkCard.d.ts +39 -0
- package/bpk-component-card/src/BpkCard.js +9 -25
- package/bpk-component-card/src/BpkCardWrapper.d.ts +33 -0
- package/bpk-component-card/src/BpkCardWrapper.js +10 -18
- package/bpk-component-card/src/BpkDividedCard.d.ts +43 -0
- package/bpk-component-card/src/BpkDividedCard.js +9 -24
- package/bpk-component-chip/index.d.ts +32 -0
- package/bpk-component-chip/src/BpkDismissibleChip.d.ts +28 -0
- package/bpk-component-chip/src/BpkDismissibleChip.js +9 -8
- package/bpk-component-chip/src/BpkDropdownChip.d.ts +29 -0
- package/bpk-component-chip/src/BpkDropdownChip.js +39 -25
- package/bpk-component-chip/src/BpkSelectableChip.d.ts +39 -0
- package/bpk-component-chip/src/BpkSelectableChip.js +33 -48
- package/bpk-component-chip/src/commonTypes.d.ts +56 -0
- package/bpk-component-chip/src/commonTypes.js +8 -2
- package/bpk-component-dialog/src/BpkDialog.d.ts +1 -12
- package/bpk-component-dialog/src/BpkDialog.js +1 -2
- package/bpk-component-dialog/src/BpkDialogInner.d.ts +256 -2
- package/bpk-component-dialog/src/BpkDialogInner.js +0 -4
- package/bpk-component-dialog/src/common-types.d.ts +20 -21
- package/bpk-component-graphic-promotion/src/BpkGraphicPromo.js +0 -4
- package/bpk-component-icon/src/classNameModifierHOCFactory.js +0 -1
- package/bpk-component-icon/src/withAlignment.js +1 -1
- package/bpk-component-icon/src/withDescription.js +1 -1
- package/bpk-component-icon/src/withRtlSupport.js +0 -2
- package/bpk-component-input/index.d.ts +39 -0
- package/bpk-component-input/src/BpkClearButton.d.ts +28 -0
- package/bpk-component-input/src/BpkClearButton.js +6 -14
- package/bpk-component-input/src/BpkInput.d.ts +46 -0
- package/bpk-component-input/src/BpkInput.js +7 -3
- package/bpk-component-input/src/common-types.d.ts +91 -0
- package/bpk-component-input/src/common-types.js +4 -1
- package/bpk-component-input/src/withOpenEvents.d.ts +121 -0
- package/bpk-component-input/src/withOpenEvents.js +14 -25
- package/bpk-component-modal/index.d.ts +26 -0
- package/bpk-component-modal/index.js +13 -6
- package/bpk-component-modal/src/BpkModal.d.ts +32 -0
- package/bpk-component-modal/src/BpkModal.js +24 -44
- package/bpk-component-modal/src/BpkModalInner.d.ts +39 -0
- package/bpk-component-modal/src/BpkModalInner.js +67 -84
- package/bpk-component-modal/src/BpkModalV2/BpKModal.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV2/BpkModal.d.ts +35 -0
- package/bpk-component-modal/src/BpkModalV2/BpkModal.js +131 -0
- package/bpk-component-modal/src/legacy-prop-types.js +86 -0
- package/bpk-component-modal/src/themeAttributes.js +1 -0
- package/bpk-component-rtl-toggle/index.d.ts +23 -0
- package/bpk-component-rtl-toggle/src/BpkRtlToggle.d.ts +41 -0
- package/bpk-component-rtl-toggle/src/BpkRtlToggle.js +9 -12
- package/bpk-component-rtl-toggle/src/updateOnDirectionChange.d.ts +151 -0
- package/bpk-component-rtl-toggle/src/updateOnDirectionChange.js +9 -2
- package/bpk-component-rtl-toggle/src/utils.d.ts +25 -0
- package/bpk-component-text/index.d.ts +21 -0
- package/bpk-component-text/index.js +0 -6
- package/bpk-component-text/src/BpkText.d.ts +60 -0
- package/bpk-component-text/src/BpkText.js +16 -56
- package/bpk-component-text/src/BpkText.module.css +1 -1
- package/bpk-component-tooltip/index.d.ts +24 -0
- package/bpk-component-tooltip/src/BpkTooltip.d.ts +29 -0
- package/bpk-component-tooltip/src/BpkTooltip.js +9 -26
- package/bpk-component-tooltip/src/BpkTooltipPortal.d.ts +60 -0
- package/bpk-component-tooltip/src/BpkTooltipPortal.js +13 -21
- package/bpk-component-tooltip/src/constants.d.ts +31 -0
- package/bpk-component-tooltip/src/constants.js +3 -1
- package/bpk-react-utils/index.d.ts +58 -0
- package/bpk-react-utils/index.js +1 -0
- package/bpk-react-utils/src/Portal.d.ts +76 -0
- package/bpk-react-utils/src/Portal.js +33 -43
- package/bpk-react-utils/src/TransitionInitialMount.d.ts +27 -0
- package/bpk-react-utils/src/TransitionInitialMount.js +7 -8
- package/bpk-react-utils/src/cssModules.d.ts +22 -0
- package/bpk-react-utils/src/deprecated.js +2 -1
- package/bpk-react-utils/src/deviceDetection.d.ts +22 -0
- package/bpk-react-utils/src/deviceDetection.js +3 -1
- package/bpk-react-utils/src/isRTL.d.ts +20 -0
- package/bpk-react-utils/src/isRTL.js +3 -1
- package/bpk-react-utils/src/withDefaultProps.d.ts +33 -0
- package/bpk-react-utils/src/withDefaultProps.js +11 -24
- package/bpk-react-utils/src/wrapDisplayName.d.ts +21 -0
- package/bpk-scrim-utils/index.d.ts +283 -0
- package/bpk-scrim-utils/src/BpkScrim.d.ts +24 -0
- package/bpk-scrim-utils/src/BpkScrim.js +5 -10
- package/bpk-scrim-utils/src/scroll-utils.d.ts +24 -0
- package/bpk-scrim-utils/src/scroll-utils.js +1 -1
- package/bpk-scrim-utils/src/withScrim.d.ts +96 -0
- package/bpk-scrim-utils/src/withScrim.js +5 -12
- package/package.json +1 -1
|
@@ -0,0 +1,151 @@
|
|
|
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 { ComponentType } from 'react';
|
|
20
|
+
|
|
21
|
+
declare const updateOnDirectionChange: (
|
|
22
|
+
EnhancedComponent: ComponentType<any> | string,
|
|
23
|
+
) => {
|
|
24
|
+
new (props: {} | Readonly<{}>): {
|
|
25
|
+
componentDidMount(): void;
|
|
26
|
+
componentWillUnmount(): void;
|
|
27
|
+
onDirectionChange: () => void;
|
|
28
|
+
render(): JSX.Element;
|
|
29
|
+
context: any;
|
|
30
|
+
setState<K extends never>(
|
|
31
|
+
state:
|
|
32
|
+
| {}
|
|
33
|
+
| ((
|
|
34
|
+
prevState: Readonly<{}>,
|
|
35
|
+
props: Readonly<{}>,
|
|
36
|
+
) => {} | Pick<{}, K> | null)
|
|
37
|
+
| Pick<{}, K>
|
|
38
|
+
| null,
|
|
39
|
+
callback?: (() => void) | undefined,
|
|
40
|
+
): void;
|
|
41
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
42
|
+
readonly props: Readonly<{}> &
|
|
43
|
+
Readonly<{
|
|
44
|
+
children?: import('react').ReactNode;
|
|
45
|
+
}>;
|
|
46
|
+
state: Readonly<{}>;
|
|
47
|
+
refs: {
|
|
48
|
+
[key: string]: import('react').ReactInstance;
|
|
49
|
+
};
|
|
50
|
+
shouldComponentUpdate?(
|
|
51
|
+
nextProps: Readonly<{}>,
|
|
52
|
+
nextState: Readonly<{}>,
|
|
53
|
+
nextContext: any,
|
|
54
|
+
): boolean;
|
|
55
|
+
componentDidCatch?(
|
|
56
|
+
error: Error,
|
|
57
|
+
errorInfo: import('react').ErrorInfo,
|
|
58
|
+
): void;
|
|
59
|
+
getSnapshotBeforeUpdate?(
|
|
60
|
+
prevProps: Readonly<{}>,
|
|
61
|
+
prevState: Readonly<{}>,
|
|
62
|
+
): any;
|
|
63
|
+
componentDidUpdate?(
|
|
64
|
+
prevProps: Readonly<{}>,
|
|
65
|
+
prevState: Readonly<{}>,
|
|
66
|
+
snapshot?: any,
|
|
67
|
+
): void;
|
|
68
|
+
componentWillMount?(): void;
|
|
69
|
+
UNSAFE_componentWillMount?(): void;
|
|
70
|
+
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
71
|
+
UNSAFE_componentWillReceiveProps?(
|
|
72
|
+
nextProps: Readonly<{}>,
|
|
73
|
+
nextContext: any,
|
|
74
|
+
): void;
|
|
75
|
+
componentWillUpdate?(
|
|
76
|
+
nextProps: Readonly<{}>,
|
|
77
|
+
nextState: Readonly<{}>,
|
|
78
|
+
nextContext: any,
|
|
79
|
+
): void;
|
|
80
|
+
UNSAFE_componentWillUpdate?(
|
|
81
|
+
nextProps: Readonly<{}>,
|
|
82
|
+
nextState: Readonly<{}>,
|
|
83
|
+
nextContext: any,
|
|
84
|
+
): void;
|
|
85
|
+
};
|
|
86
|
+
new (props: {}, context: any): {
|
|
87
|
+
componentDidMount(): void;
|
|
88
|
+
componentWillUnmount(): void;
|
|
89
|
+
onDirectionChange: () => void;
|
|
90
|
+
render(): JSX.Element;
|
|
91
|
+
context: any;
|
|
92
|
+
setState<K extends never>(
|
|
93
|
+
state:
|
|
94
|
+
| {}
|
|
95
|
+
| ((
|
|
96
|
+
prevState: Readonly<{}>,
|
|
97
|
+
props: Readonly<{}>,
|
|
98
|
+
) => {} | Pick<{}, K> | null)
|
|
99
|
+
| Pick<{}, K>
|
|
100
|
+
| null,
|
|
101
|
+
callback?: (() => void) | undefined,
|
|
102
|
+
): void;
|
|
103
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
104
|
+
readonly props: Readonly<{}> &
|
|
105
|
+
Readonly<{
|
|
106
|
+
children?: import('react').ReactNode;
|
|
107
|
+
}>;
|
|
108
|
+
state: Readonly<{}>;
|
|
109
|
+
refs: {
|
|
110
|
+
[key: string]: import('react').ReactInstance;
|
|
111
|
+
};
|
|
112
|
+
shouldComponentUpdate?(
|
|
113
|
+
nextProps: Readonly<{}>,
|
|
114
|
+
nextState: Readonly<{}>,
|
|
115
|
+
nextContext: any,
|
|
116
|
+
): boolean;
|
|
117
|
+
componentDidCatch?(
|
|
118
|
+
error: Error,
|
|
119
|
+
errorInfo: import('react').ErrorInfo,
|
|
120
|
+
): void;
|
|
121
|
+
getSnapshotBeforeUpdate?(
|
|
122
|
+
prevProps: Readonly<{}>,
|
|
123
|
+
prevState: Readonly<{}>,
|
|
124
|
+
): any;
|
|
125
|
+
componentDidUpdate?(
|
|
126
|
+
prevProps: Readonly<{}>,
|
|
127
|
+
prevState: Readonly<{}>,
|
|
128
|
+
snapshot?: any,
|
|
129
|
+
): void;
|
|
130
|
+
componentWillMount?(): void;
|
|
131
|
+
UNSAFE_componentWillMount?(): void;
|
|
132
|
+
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
133
|
+
UNSAFE_componentWillReceiveProps?(
|
|
134
|
+
nextProps: Readonly<{}>,
|
|
135
|
+
nextContext: any,
|
|
136
|
+
): void;
|
|
137
|
+
componentWillUpdate?(
|
|
138
|
+
nextProps: Readonly<{}>,
|
|
139
|
+
nextState: Readonly<{}>,
|
|
140
|
+
nextContext: any,
|
|
141
|
+
): void;
|
|
142
|
+
UNSAFE_componentWillUpdate?(
|
|
143
|
+
nextProps: Readonly<{}>,
|
|
144
|
+
nextState: Readonly<{}>,
|
|
145
|
+
nextContext: any,
|
|
146
|
+
): void;
|
|
147
|
+
};
|
|
148
|
+
displayName: string;
|
|
149
|
+
contextType?: import('react').Context<any> | undefined;
|
|
150
|
+
};
|
|
151
|
+
export default updateOnDirectionChange;
|
|
@@ -38,15 +38,22 @@ const updateOnDirectionChange = EnhancedComponent => {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
componentDidMount() {
|
|
41
|
-
(0, _utils.getHtmlElement)()
|
|
41
|
+
const htmlElement = (0, _utils.getHtmlElement)();
|
|
42
|
+
if (htmlElement instanceof HTMLElement) {
|
|
43
|
+
htmlElement.addEventListener(_utils.DIRECTION_CHANGE_EVENT, this.onDirectionChange, false);
|
|
44
|
+
}
|
|
42
45
|
}
|
|
43
46
|
componentWillUnmount() {
|
|
44
|
-
(0, _utils.getHtmlElement)()
|
|
47
|
+
const htmlElement = (0, _utils.getHtmlElement)();
|
|
48
|
+
if (htmlElement instanceof HTMLElement) {
|
|
49
|
+
htmlElement.removeEventListener(_utils.DIRECTION_CHANGE_EVENT, this.onDirectionChange, false);
|
|
50
|
+
}
|
|
45
51
|
}
|
|
46
52
|
render() {
|
|
47
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(EnhancedComponent, _objectSpread({}, this.props));
|
|
48
54
|
}
|
|
49
55
|
}
|
|
56
|
+
_defineProperty(UpdateOnDirectionChange, "displayName", void 0);
|
|
50
57
|
UpdateOnDirectionChange.displayName = (0, _bpkReactUtils.wrapDisplayName)(EnhancedComponent, 'updateOnDirectionChange');
|
|
51
58
|
return UpdateOnDirectionChange;
|
|
52
59
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
declare const DIRECTIONS: {
|
|
20
|
+
readonly LTR: 'ltr';
|
|
21
|
+
readonly RTL: 'rtl';
|
|
22
|
+
};
|
|
23
|
+
declare const DIRECTION_CHANGE_EVENT = 'bpkchangedirection';
|
|
24
|
+
declare const getHtmlElement: () => HTMLElement | null | {};
|
|
25
|
+
export { DIRECTIONS, DIRECTION_CHANGE_EVENT, getHtmlElement };
|
|
@@ -0,0 +1,21 @@
|
|
|
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 component, { TEXT_STYLES } from './src/BpkText';
|
|
20
|
+
export default component;
|
|
21
|
+
export { TEXT_STYLES };
|
|
@@ -9,12 +9,6 @@ Object.defineProperty(exports, "TEXT_STYLES", {
|
|
|
9
9
|
return _BpkText.TEXT_STYLES;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "WEIGHT_STYLES", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _BpkText.WEIGHT_STYLES;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
12
|
exports.default = void 0;
|
|
19
13
|
var _BpkText = _interopRequireWildcard(require("./src/BpkText"));
|
|
20
14
|
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); }
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
export declare const TEXT_STYLES: {
|
|
21
|
+
readonly xs: "xs";
|
|
22
|
+
readonly sm: "sm";
|
|
23
|
+
readonly base: "base";
|
|
24
|
+
readonly lg: "lg";
|
|
25
|
+
readonly xl: "xl";
|
|
26
|
+
readonly xxl: "xxl";
|
|
27
|
+
readonly xxxl: "xxxl";
|
|
28
|
+
readonly xxxxl: "xxxxl";
|
|
29
|
+
readonly xxxxxl: "xxxxxl";
|
|
30
|
+
readonly caption: "caption";
|
|
31
|
+
readonly footnote: "footnote";
|
|
32
|
+
readonly label1: "label-1";
|
|
33
|
+
readonly label2: "label-2";
|
|
34
|
+
readonly label3: "label-3";
|
|
35
|
+
readonly bodyDefault: "body-default";
|
|
36
|
+
readonly bodyLongform: "body-longform";
|
|
37
|
+
readonly subheading: "subheading";
|
|
38
|
+
readonly heading1: "heading-1";
|
|
39
|
+
readonly heading2: "heading-2";
|
|
40
|
+
readonly heading3: "heading-3";
|
|
41
|
+
readonly heading4: "heading-4";
|
|
42
|
+
readonly heading5: "heading-5";
|
|
43
|
+
readonly hero1: "hero-1";
|
|
44
|
+
readonly hero2: "hero-2";
|
|
45
|
+
readonly hero3: "hero-3";
|
|
46
|
+
readonly hero4: "hero-4";
|
|
47
|
+
readonly hero5: "hero-5";
|
|
48
|
+
};
|
|
49
|
+
export type TextStyle = typeof TEXT_STYLES[keyof typeof TEXT_STYLES];
|
|
50
|
+
export type Tag = 'span' | 'p' | 'text' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
51
|
+
type Props = {
|
|
52
|
+
children: ReactNode;
|
|
53
|
+
textStyle?: TextStyle;
|
|
54
|
+
tagName?: Tag;
|
|
55
|
+
className?: string | null;
|
|
56
|
+
id?: string;
|
|
57
|
+
[rest: string]: any;
|
|
58
|
+
};
|
|
59
|
+
declare const BpkText: ({ textStyle, tagName: TagName, className, children, ...rest }: Props) => JSX.Element;
|
|
60
|
+
export default BpkText;
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
6
|
+
exports.default = exports.TEXT_STYLES = void 0;
|
|
8
7
|
var _bpkReactUtils = require("../../bpk-react-utils");
|
|
9
8
|
var _BpkTextModule = _interopRequireDefault(require("./BpkText.module.css"));
|
|
10
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
const _excluded = ["
|
|
10
|
+
const _excluded = ["textStyle", "tagName", "className", "children"];
|
|
12
11
|
/*
|
|
13
12
|
* Backpack - Skyscanner's Design System
|
|
14
13
|
*
|
|
@@ -65,59 +64,20 @@ const TEXT_STYLES = {
|
|
|
65
64
|
hero5: 'hero-5'
|
|
66
65
|
};
|
|
67
66
|
exports.TEXT_STYLES = TEXT_STYLES;
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
return null;
|
|
84
|
-
};
|
|
85
|
-
const BpkText = props => {
|
|
86
|
-
const {
|
|
87
|
-
bold,
|
|
88
|
-
children,
|
|
89
|
-
className,
|
|
90
|
-
tagName: TagName,
|
|
91
|
-
textStyle,
|
|
92
|
-
weight
|
|
93
|
-
} = props,
|
|
94
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
95
|
-
const validWeight = getWeight(bold, weight, textStyle);
|
|
96
|
-
const classNames = getClassName('bpk-text', `bpk-text--${textStyle}`, validWeight && `bpk-text--${validWeight}`, className);
|
|
97
|
-
return (
|
|
98
|
-
/*#__PURE__*/
|
|
99
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
100
|
-
(0, _jsxRuntime.jsx)(TagName, _objectSpread(_objectSpread({
|
|
101
|
-
className: classNames
|
|
102
|
-
}, rest), {}, {
|
|
103
|
-
children: children
|
|
104
|
-
}))
|
|
105
|
-
);
|
|
106
|
-
};
|
|
107
|
-
BpkText.propTypes = {
|
|
108
|
-
children: _propTypes.default.node.isRequired,
|
|
109
|
-
textStyle: _propTypes.default.oneOf(Object.values(TEXT_STYLES)),
|
|
110
|
-
tagName: _propTypes.default.oneOf(['span', 'p', 'text', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']),
|
|
111
|
-
className: _propTypes.default.string,
|
|
112
|
-
bold: (0, _bpkReactUtils.deprecated)(_propTypes.default.bool, 'Use a different "textStyle" to achieve the desired weight.'),
|
|
113
|
-
weight: (0, _bpkReactUtils.deprecated)(_propTypes.default.oneOf(Object.keys(WEIGHT_STYLES)), 'Use a different "textStyle" to achieve the desired weight.')
|
|
114
|
-
};
|
|
115
|
-
BpkText.defaultProps = {
|
|
116
|
-
textStyle: TEXT_STYLES.bodyDefault,
|
|
117
|
-
tagName: 'span',
|
|
118
|
-
className: null,
|
|
119
|
-
bold: null,
|
|
120
|
-
weight: null
|
|
67
|
+
const BpkText = _ref => {
|
|
68
|
+
let {
|
|
69
|
+
textStyle = TEXT_STYLES.bodyDefault,
|
|
70
|
+
tagName: TagName = 'span',
|
|
71
|
+
className = null,
|
|
72
|
+
children
|
|
73
|
+
} = _ref,
|
|
74
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
75
|
+
const classNames = getClassName('bpk-text', `bpk-text--${textStyle}`, className);
|
|
76
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TagName, _objectSpread(_objectSpread({
|
|
77
|
+
className: classNames
|
|
78
|
+
}, rest), {}, {
|
|
79
|
+
children: children
|
|
80
|
+
}));
|
|
121
81
|
};
|
|
122
82
|
var _default = BpkText;
|
|
123
83
|
exports.default = _default;
|
|
@@ -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
|
-
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-text{margin:0}.bpk-text--xs{font-size:.75rem;line-height:1rem;font-weight:400}.bpk-text--sm{font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-text--base{font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-text--lg{font-size:1.25rem;line-height:1.75rem;font-weight:400}.bpk-text--xl{font-size:1.5rem;line-height:2rem;font-weight:400}.bpk-text--xxl{font-size:2rem;line-height:2.5rem;font-weight:700}.bpk-text--xxxl{font-size:2.5rem;line-height:3rem;font-weight:700}.bpk-text--xxxxl{font-size:3rem;line-height:3.5rem;font-weight:700;letter-spacing:-.02em}.bpk-text--xxxxxl{font-size:4rem;line-height:4.5rem;font-weight:700;letter-spacing:-.02em}.bpk-text--caption{font-size:.75rem;line-height:1rem;font-weight:400}.bpk-text--footnote{font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-text--label-1{font-size:1rem;line-height:1.5rem;font-weight:700}.bpk-text--label-2{font-size:.875rem;line-height:1.25rem;font-weight:700}.bpk-text--label-3{font-size:.75rem;line-height:1rem;font-weight:700}.bpk-text--body-default{font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-text--body-longform{font-size:1.25rem;line-height:1.75rem;font-weight:400}.bpk-text--subheading{font-size:1.5rem;line-height:2rem;font-weight:400}.bpk-text--heading-1{font-size:2.5rem;line-height:3rem;font-weight:700}.bpk-text--heading-2{font-size:2rem;line-height:2.5rem;font-weight:700}.bpk-text--heading-3{font-size:1.5rem;line-height:1.75rem;font-weight:700}.bpk-text--heading-4{font-size:1.25rem;line-height:1.5rem;font-weight:700}.bpk-text--heading-5{font-size:1rem;line-height:1.25rem;font-weight:700}.bpk-text--hero-1{font-size:7.5rem;line-height:7.5rem;font-weight:700;letter-spacing:-.02em}.bpk-text--hero-2{font-size:6rem;line-height:6rem;font-weight:700;letter-spacing:-.02em}.bpk-text--hero-3{font-size:4.75rem;line-height:5.25rem;font-weight:700;letter-spacing:-.02em}.bpk-text--hero-4{font-size:4rem;line-height:4.5rem;font-weight:700;letter-spacing:-.02em}.bpk-text--hero-5{font-size:3rem;line-height:3.5rem;font-weight:700;letter-spacing:-.02em}
|
|
18
|
+
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-text{margin:0}.bpk-text--xs{font-size:.75rem;line-height:1rem;font-weight:400}.bpk-text--sm{font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-text--base{font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-text--lg{font-size:1.25rem;line-height:1.75rem;font-weight:400}.bpk-text--xl{font-size:1.5rem;line-height:2rem;font-weight:400}.bpk-text--xxl{font-size:2rem;line-height:2.5rem;font-weight:700}.bpk-text--xxxl{font-size:2.5rem;line-height:3rem;font-weight:700}.bpk-text--xxxxl{font-size:3rem;line-height:3.5rem;font-weight:700;letter-spacing:-.02em}.bpk-text--xxxxxl{font-size:4rem;line-height:4.5rem;font-weight:700;letter-spacing:-.02em}.bpk-text--caption{font-size:.75rem;line-height:1rem;font-weight:400}.bpk-text--footnote{font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-text--label-1{font-size:1rem;line-height:1.5rem;font-weight:700}.bpk-text--label-2{font-size:.875rem;line-height:1.25rem;font-weight:700}.bpk-text--label-3{font-size:.75rem;line-height:1rem;font-weight:700}.bpk-text--body-default{font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-text--body-longform{font-size:1.25rem;line-height:1.75rem;font-weight:400}.bpk-text--subheading{font-size:1.5rem;line-height:2rem;font-weight:400}.bpk-text--heading-1{font-size:2.5rem;line-height:3rem;font-weight:700}.bpk-text--heading-2{font-size:2rem;line-height:2.5rem;font-weight:700}.bpk-text--heading-3{font-size:1.5rem;line-height:1.75rem;font-weight:700}.bpk-text--heading-4{font-size:1.25rem;line-height:1.5rem;font-weight:700}.bpk-text--heading-5{font-size:1rem;line-height:1.25rem;font-weight:700}.bpk-text--hero-1{font-size:7.5rem;line-height:7.5rem;font-weight:700;letter-spacing:-.02em}.bpk-text--hero-2{font-size:6rem;line-height:6rem;font-weight:700;letter-spacing:-.02em}.bpk-text--hero-3{font-size:4.75rem;line-height:5.25rem;font-weight:700;letter-spacing:-.02em}.bpk-text--hero-4{font-size:4rem;line-height:4.5rem;font-weight:700;letter-spacing:-.02em}.bpk-text--hero-5{font-size:3rem;line-height:3.5rem;font-weight:700;letter-spacing:-.02em}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 BpkTooltipPortal from './src/BpkTooltipPortal';
|
|
20
|
+
import type { Props } from './src/BpkTooltipPortal';
|
|
21
|
+
import { TOOLTIP_TYPES } from './src/constants';
|
|
22
|
+
export type BpkTooltipPortalProps = Props;
|
|
23
|
+
export default BpkTooltipPortal;
|
|
24
|
+
export { TOOLTIP_TYPES };
|
|
@@ -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
|
+
import type { ReactNode } from 'react';
|
|
20
|
+
import { TOOLTIP_TYPES } from './constants';
|
|
21
|
+
export type TooltipProps = {
|
|
22
|
+
id: string;
|
|
23
|
+
children: ReactNode | string;
|
|
24
|
+
type?: typeof TOOLTIP_TYPES[keyof typeof TOOLTIP_TYPES];
|
|
25
|
+
padded?: boolean;
|
|
26
|
+
className?: string | null;
|
|
27
|
+
};
|
|
28
|
+
declare const BpkTooltip: ({ children, className, id, padded, type, ...rest }: TooltipProps) => JSX.Element;
|
|
29
|
+
export default BpkTooltip;
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
6
|
+
exports.default = void 0;
|
|
8
7
|
var _bpkReactUtils = require("../../bpk-react-utils");
|
|
9
8
|
var _BpkTooltipModule = _interopRequireDefault(require("./BpkTooltip.module.css"));
|
|
10
9
|
var _constants = require("./constants");
|
|
@@ -41,15 +40,15 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
41
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; }
|
|
42
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; }
|
|
43
42
|
const getClassName = (0, _bpkReactUtils.cssModules)(_BpkTooltipModule.default);
|
|
44
|
-
const BpkTooltip =
|
|
45
|
-
|
|
43
|
+
const BpkTooltip = _ref => {
|
|
44
|
+
let {
|
|
46
45
|
children,
|
|
47
|
-
className,
|
|
46
|
+
className = null,
|
|
48
47
|
id,
|
|
49
|
-
padded,
|
|
50
|
-
type
|
|
51
|
-
} =
|
|
52
|
-
rest = _objectWithoutProperties(
|
|
48
|
+
padded = true,
|
|
49
|
+
type = _constants.TOOLTIP_TYPES.light
|
|
50
|
+
} = _ref,
|
|
51
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
53
52
|
const classNames = getClassName('bpk-tooltip', className);
|
|
54
53
|
const innerClassNames = getClassName('bpk-tooltip__inner', type === _constants.TOOLTIP_TYPES.dark && 'bpk-tooltip__inner--dark', padded && 'bpk-tooltip__inner--padded');
|
|
55
54
|
const arrowClassNames = getClassName('bpk-tooltip__arrow', type === _constants.TOOLTIP_TYPES.dark && 'bpk-tooltip__arrow--dark');
|
|
@@ -59,7 +58,7 @@ const BpkTooltip = props => {
|
|
|
59
58
|
transitionTimeout: 200,
|
|
60
59
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", _objectSpread(_objectSpread({
|
|
61
60
|
id: id,
|
|
62
|
-
tabIndex:
|
|
61
|
+
tabIndex: -1,
|
|
63
62
|
role: "dialog",
|
|
64
63
|
className: classNames
|
|
65
64
|
}, rest), {}, {
|
|
@@ -75,21 +74,5 @@ const BpkTooltip = props => {
|
|
|
75
74
|
}))
|
|
76
75
|
});
|
|
77
76
|
};
|
|
78
|
-
const propTypes = {
|
|
79
|
-
id: _propTypes.default.string.isRequired,
|
|
80
|
-
children: _propTypes.default.node.isRequired,
|
|
81
|
-
className: _propTypes.default.string,
|
|
82
|
-
padded: _propTypes.default.bool,
|
|
83
|
-
type: _propTypes.default.oneOf(Object.keys(_constants.TOOLTIP_TYPES))
|
|
84
|
-
};
|
|
85
|
-
exports.propTypes = propTypes;
|
|
86
|
-
const defaultProps = {
|
|
87
|
-
className: null,
|
|
88
|
-
padded: true,
|
|
89
|
-
type: _constants.TOOLTIP_TYPES.light
|
|
90
|
-
};
|
|
91
|
-
exports.defaultProps = defaultProps;
|
|
92
|
-
BpkTooltip.propTypes = _objectSpread({}, propTypes);
|
|
93
|
-
BpkTooltip.defaultProps = _objectSpread({}, defaultProps);
|
|
94
77
|
var _default = BpkTooltip;
|
|
95
78
|
exports.default = _default;
|
|
@@ -0,0 +1,60 @@
|
|
|
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 { createPopper } from '@popperjs/core';
|
|
20
|
+
import { Component } from 'react';
|
|
21
|
+
import type { ReactNode, ReactElement } from 'react';
|
|
22
|
+
import type { TooltipProps } from './BpkTooltip';
|
|
23
|
+
export type Props = TooltipProps & {
|
|
24
|
+
ariaLabel: string;
|
|
25
|
+
target: ReactElement<any>;
|
|
26
|
+
children: ReactNode | string;
|
|
27
|
+
placement?: 'top' | 'right' | 'bottom' | 'left' | 'auto';
|
|
28
|
+
hideOnTouchDevices?: boolean;
|
|
29
|
+
portalStyle?: object;
|
|
30
|
+
portalClassName?: string;
|
|
31
|
+
renderTarget: null | (() => null | HTMLElement);
|
|
32
|
+
popperModifiers?: object[];
|
|
33
|
+
};
|
|
34
|
+
type State = {
|
|
35
|
+
isOpen: boolean;
|
|
36
|
+
};
|
|
37
|
+
declare class BpkTooltipPortal extends Component<Props, State> {
|
|
38
|
+
popper?: ReturnType<typeof createPopper> | null;
|
|
39
|
+
targetRef?: Element | null;
|
|
40
|
+
static defaultProps: {
|
|
41
|
+
className: null;
|
|
42
|
+
padded: boolean;
|
|
43
|
+
type: "light";
|
|
44
|
+
placement: string;
|
|
45
|
+
hideOnTouchDevices: boolean;
|
|
46
|
+
portalStyle: null;
|
|
47
|
+
portalClassName: null;
|
|
48
|
+
renderTarget: null;
|
|
49
|
+
popperModifiers: null;
|
|
50
|
+
};
|
|
51
|
+
constructor(props: Props);
|
|
52
|
+
componentDidMount(): void;
|
|
53
|
+
componentWillUnmount(): void;
|
|
54
|
+
onOpen: (tooltipElement: HTMLElement, targetElement?: HTMLElement | null | undefined) => void;
|
|
55
|
+
beforeClose: (done: () => void | null) => void;
|
|
56
|
+
openTooltip: () => void;
|
|
57
|
+
closeTooltip: () => void;
|
|
58
|
+
render(): JSX.Element;
|
|
59
|
+
}
|
|
60
|
+
export default BpkTooltipPortal;
|
|
@@ -5,15 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _core = require("@popperjs/core");
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
8
|
var _react = require("react");
|
|
10
9
|
var _bpkReactUtils = require("../../bpk-react-utils");
|
|
11
|
-
var _BpkTooltip =
|
|
10
|
+
var _BpkTooltip = _interopRequireDefault(require("./BpkTooltip"));
|
|
12
11
|
var _BpkTooltipModule = _interopRequireDefault(require("./BpkTooltip.module.css"));
|
|
12
|
+
var _constants = require("./constants");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
const _excluded = ["ariaLabel", "children", "hideOnTouchDevices", "padded", "placement", "popperModifiers", "portalClassName", "portalStyle", "renderTarget", "target"];
|
|
15
|
-
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); }
|
|
16
|
-
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; }
|
|
17
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
16
|
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; }
|
|
19
17
|
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; }
|
|
@@ -39,10 +37,10 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
39
37
|
* limitations under the License.
|
|
40
38
|
*/
|
|
41
39
|
const getClassName = (0, _bpkReactUtils.cssModules)(_BpkTooltipModule.default);
|
|
42
|
-
const hasTouchSupport = () => !!(typeof window !== 'undefined' && ('ontouchstart' in window ||
|
|
40
|
+
const hasTouchSupport = () => !!(typeof window !== 'undefined' && ('ontouchstart' in window || navigator.maxTouchPoints > 0));
|
|
43
41
|
class BpkTooltipPortal extends _react.Component {
|
|
44
|
-
constructor() {
|
|
45
|
-
super();
|
|
42
|
+
constructor(props) {
|
|
43
|
+
super(props);
|
|
46
44
|
_defineProperty(this, "popper", void 0);
|
|
47
45
|
_defineProperty(this, "targetRef", void 0);
|
|
48
46
|
_defineProperty(this, "onOpen", (tooltipElement, targetElement) => {
|
|
@@ -152,25 +150,19 @@ class BpkTooltipPortal extends _react.Component {
|
|
|
152
150
|
});
|
|
153
151
|
}
|
|
154
152
|
}
|
|
155
|
-
_defineProperty(BpkTooltipPortal, "
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
// eslint-disable-line react/forbid-prop-types
|
|
163
|
-
portalClassName: _propTypes.default.string,
|
|
164
|
-
renderTarget: _propTypes.default.func,
|
|
165
|
-
popperModifiers: _propTypes.default.arrayOf(_propTypes.default.object) // eslint-disable-line react/forbid-prop-types
|
|
166
|
-
}));
|
|
167
|
-
_defineProperty(BpkTooltipPortal, "defaultProps", _objectSpread(_objectSpread({}, _BpkTooltip.defaultProps), {}, {
|
|
153
|
+
_defineProperty(BpkTooltipPortal, "defaultProps", {
|
|
154
|
+
// Disabling as the rule doesn't work when types are defined in a different file
|
|
155
|
+
/* eslint-disable react/default-props-match-prop-types */
|
|
156
|
+
className: null,
|
|
157
|
+
padded: true,
|
|
158
|
+
type: _constants.TOOLTIP_TYPES.light,
|
|
159
|
+
/* eslint-enable */
|
|
168
160
|
placement: 'bottom',
|
|
169
161
|
hideOnTouchDevices: true,
|
|
170
162
|
portalStyle: null,
|
|
171
163
|
portalClassName: null,
|
|
172
164
|
renderTarget: null,
|
|
173
165
|
popperModifiers: null
|
|
174
|
-
})
|
|
166
|
+
});
|
|
175
167
|
var _default = BpkTooltipPortal;
|
|
176
168
|
exports.default = _default;
|