@skyscanner/backpack-web 41.16.0 → 41.18.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/index.d.ts +3 -0
- package/bpk-animate-height/src/AnimateHeight.d.ts +25 -0
- package/bpk-animate-height/src/AnimateHeight.js +16 -31
- package/bpk-component-accordion/src/BpkAccordionItem.js +0 -1
- package/bpk-component-banner-alert/src/AnimateAndFade.js +0 -2
- package/bpk-component-banner-alert/src/BpkBannerAlertInner.js +0 -2
- package/bpk-component-chat-notification/index.d.ts +2 -0
- package/bpk-component-chat-notification/index.js +19 -0
- package/bpk-component-chat-notification/src/BpkChatNotification.d.ts +9 -0
- package/bpk-component-chat-notification/src/BpkChatNotification.js +43 -0
- package/bpk-component-chat-notification/src/BpkChatNotification.module.css +18 -0
- package/bpk-component-chat-thought-bubble/index.d.ts +3 -0
- package/bpk-component-chat-thought-bubble/index.js +20 -0
- package/bpk-component-chat-thought-bubble/src/BpkChatThoughtBubble.d.ts +8 -0
- package/bpk-component-chat-thought-bubble/src/BpkChatThoughtBubble.js +46 -0
- package/bpk-component-chat-thought-bubble/src/BpkChatThoughtBubble.module.css +18 -0
- package/bpk-component-info-banner/src/AnimateAndFade.js +0 -2
- package/bpk-component-info-banner/src/BpkInfoBannerInner.js +0 -2
- package/bpk-component-layout/src/BpkProvider.js +6 -1
- package/bpk-component-layout/src/theme.js +4 -0
- package/bpk-component-skip-link/index.d.ts +5 -0
- package/bpk-component-skip-link/index.js +2 -1
- package/bpk-component-skip-link/src/BpkSkipLink.d.ts +10 -0
- package/bpk-component-skip-link/src/BpkSkipLink.js +3 -10
- package/bpk-component-skip-link/src/themeAttributes.d.ts +2 -0
- package/bpk-component-thumb-button/index.d.ts +3 -0
- package/bpk-component-thumb-button/index.js +20 -0
- package/bpk-component-thumb-button/src/BpkThumbButton.d.ts +21 -0
- package/bpk-component-thumb-button/src/BpkThumbButton.js +52 -0
- package/bpk-component-thumb-button/src/BpkThumbButton.module.css +18 -0
- package/package.json +2 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
export type Props = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
duration: number;
|
|
6
|
+
height: number | string;
|
|
7
|
+
easing?: string;
|
|
8
|
+
transitionOverflow?: string;
|
|
9
|
+
onAnimationComplete?: (() => void) | null;
|
|
10
|
+
};
|
|
11
|
+
type State = {
|
|
12
|
+
height: number | string;
|
|
13
|
+
overflow: string;
|
|
14
|
+
};
|
|
15
|
+
declare class AnimateHeight extends Component<Props, State> {
|
|
16
|
+
constructor(props: Props);
|
|
17
|
+
componentDidMount(): void;
|
|
18
|
+
componentDidUpdate(prevProps: Props, prevState: State): void;
|
|
19
|
+
componentWillUnmount(): void;
|
|
20
|
+
onTransitionEnd: () => void;
|
|
21
|
+
timeoutID: ReturnType<typeof setTimeout> | null;
|
|
22
|
+
contentElement: HTMLDivElement | null;
|
|
23
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
}
|
|
25
|
+
export default AnimateHeight;
|
|
@@ -16,14 +16,12 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import PropTypes from 'prop-types';
|
|
20
19
|
import { Component } from 'react';
|
|
21
|
-
|
|
22
|
-
// IE11 doesn't support `Number.isNaN` so we must use the global.
|
|
23
|
-
// When IE11 support drops we can migrate.
|
|
24
|
-
// eslint-disable-next-line no-restricted-globals
|
|
25
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
-
const isNumber = n =>
|
|
21
|
+
const isNumber = n => {
|
|
22
|
+
const parsed = typeof n === 'number' ? n : parseFloat(n);
|
|
23
|
+
return !Number.isNaN(parsed) && Number.isFinite(parsed);
|
|
24
|
+
};
|
|
27
25
|
const isTransitionEndSupported = () => !!(typeof window !== 'undefined' && 'TransitionEvent' in window);
|
|
28
26
|
class AnimateHeight extends Component {
|
|
29
27
|
constructor(props) {
|
|
@@ -32,7 +30,7 @@ class AnimateHeight extends Component {
|
|
|
32
30
|
let overflow = 'visible';
|
|
33
31
|
if (isNumber(this.props.height)) {
|
|
34
32
|
height = this.props.height < 0 ? 0 : this.props.height;
|
|
35
|
-
overflow = this.props.transitionOverflow;
|
|
33
|
+
overflow = this.props.transitionOverflow ?? 'hidden';
|
|
36
34
|
}
|
|
37
35
|
this.state = {
|
|
38
36
|
height,
|
|
@@ -64,9 +62,9 @@ class AnimateHeight extends Component {
|
|
|
64
62
|
let newHeight = null;
|
|
65
63
|
let shouldSetTimeout = false;
|
|
66
64
|
let timeoutHeight = null;
|
|
67
|
-
let timeoutOverflow = prevTransitionOverflow;
|
|
65
|
+
let timeoutOverflow = prevTransitionOverflow ?? 'hidden';
|
|
68
66
|
let timeoutDuration = duration;
|
|
69
|
-
clearTimeout(this.timeoutID);
|
|
67
|
+
clearTimeout(this.timeoutID ?? undefined);
|
|
70
68
|
if (isNumber(height)) {
|
|
71
69
|
// If new height is a number
|
|
72
70
|
newHeight = height < 0 ? 0 : height;
|
|
@@ -88,12 +86,12 @@ class AnimateHeight extends Component {
|
|
|
88
86
|
}
|
|
89
87
|
this.setState({
|
|
90
88
|
height: newHeight,
|
|
91
|
-
overflow: transitionOverflow
|
|
89
|
+
overflow: transitionOverflow ?? 'hidden'
|
|
92
90
|
});
|
|
93
91
|
if (shouldSetTimeout) {
|
|
94
92
|
this.timeoutID = setTimeout(() => {
|
|
95
93
|
this.setState({
|
|
96
|
-
height: timeoutHeight,
|
|
94
|
+
height: timeoutHeight ?? 0,
|
|
97
95
|
overflow: timeoutOverflow
|
|
98
96
|
});
|
|
99
97
|
if (!isTransitionEndSupported()) {
|
|
@@ -104,7 +102,7 @@ class AnimateHeight extends Component {
|
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
104
|
componentWillUnmount() {
|
|
107
|
-
clearTimeout(this.timeoutID);
|
|
105
|
+
clearTimeout(this.timeoutID ?? undefined);
|
|
108
106
|
this.timeoutID = null;
|
|
109
107
|
}
|
|
110
108
|
onTransitionEnd = () => {
|
|
@@ -115,13 +113,17 @@ class AnimateHeight extends Component {
|
|
|
115
113
|
this.props.onAnimationComplete();
|
|
116
114
|
}
|
|
117
115
|
};
|
|
116
|
+
timeoutID = null;
|
|
117
|
+
contentElement = null;
|
|
118
118
|
render() {
|
|
119
119
|
const {
|
|
120
120
|
children,
|
|
121
121
|
duration,
|
|
122
|
-
easing,
|
|
123
|
-
|
|
122
|
+
easing = 'ease',
|
|
123
|
+
height: _height,
|
|
124
|
+
onAnimationComplete: _onAnimationComplete,
|
|
124
125
|
style,
|
|
126
|
+
transitionOverflow: _transitionOverflow,
|
|
125
127
|
...rest
|
|
126
128
|
} = this.props;
|
|
127
129
|
const {
|
|
@@ -138,8 +140,6 @@ class AnimateHeight extends Component {
|
|
|
138
140
|
msTransition: `height ${duration}ms ${easing} `,
|
|
139
141
|
transition: `height ${duration}ms ${easing} `
|
|
140
142
|
};
|
|
141
|
-
delete rest.height;
|
|
142
|
-
delete rest.transitionOverflow;
|
|
143
143
|
return /*#__PURE__*/_jsx("div", {
|
|
144
144
|
style: componentStyle,
|
|
145
145
|
onTransitionEnd: this.onTransitionEnd,
|
|
@@ -153,19 +153,4 @@ class AnimateHeight extends Component {
|
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
AnimateHeight.propTypes = {
|
|
157
|
-
children: PropTypes.node.isRequired,
|
|
158
|
-
duration: PropTypes.number.isRequired,
|
|
159
|
-
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
160
|
-
easing: PropTypes.string,
|
|
161
|
-
transitionOverflow: PropTypes.string,
|
|
162
|
-
onAnimationComplete: PropTypes.func,
|
|
163
|
-
style: PropTypes.object // eslint-disable-line react/forbid-prop-types
|
|
164
|
-
};
|
|
165
|
-
AnimateHeight.defaultProps = {
|
|
166
|
-
easing: 'ease',
|
|
167
|
-
transitionOverflow: 'hidden',
|
|
168
|
-
onAnimationComplete: null,
|
|
169
|
-
style: {}
|
|
170
|
-
};
|
|
171
156
|
export default AnimateHeight;
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { useContext, cloneElement } from 'react';
|
|
20
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
21
20
|
import AnimateHeight from "../../bpk-animate-height";
|
|
22
21
|
import { withButtonAlignment } from "../../bpk-component-icon";
|
|
23
22
|
import ChevronDownIcon from "../../bpk-component-icon/sm/chevron-down";
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
import { Component } from 'react';
|
|
20
20
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
21
21
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
22
|
-
|
|
23
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
24
22
|
import BpkAnimateHeight from "../../bpk-animate-height";
|
|
25
23
|
import { cssModules } from "../../bpk-react-utils";
|
|
26
24
|
import STYLES from "./BpkAnimateAndFade.module.css";
|
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
24
|
-
|
|
25
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
26
24
|
import BpkAnimateHeight from "../../bpk-animate-height";
|
|
27
25
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
28
26
|
import BpkCloseButton from "../../bpk-component-close-button";
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
export { default } from "./src/BpkChatNotification";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
2
|
+
export type BpkChatNotificationProps = {
|
|
3
|
+
/** Text displayed in the notification. */
|
|
4
|
+
text: string;
|
|
5
|
+
/** Optional icon to display before the text. */
|
|
6
|
+
icon?: FunctionComponent;
|
|
7
|
+
};
|
|
8
|
+
declare const BpkChatNotification: ({ icon: Icon, text, }: BpkChatNotificationProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default BpkChatNotification;
|
|
@@ -0,0 +1,43 @@
|
|
|
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 BpkText, { TEXT_STYLES } from "../../bpk-component-text";
|
|
20
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
|
+
import STYLES from "./BpkChatNotification.module.css";
|
|
22
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
const getClassName = cssModules(STYLES);
|
|
24
|
+
const BpkChatNotification = ({
|
|
25
|
+
icon: Icon,
|
|
26
|
+
text
|
|
27
|
+
}) => /*#__PURE__*/_jsxs("output", {
|
|
28
|
+
className: getClassName('bpk-chat-notification'),
|
|
29
|
+
"aria-atomic": "true",
|
|
30
|
+
"data-testid": "bpk-chat-notification",
|
|
31
|
+
...getDataComponentAttribute('ChatNotification'),
|
|
32
|
+
children: [Icon && /*#__PURE__*/_jsx("span", {
|
|
33
|
+
className: getClassName('bpk-chat-notification__icon'),
|
|
34
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
35
|
+
"aria-hidden": "true"
|
|
36
|
+
})
|
|
37
|
+
}), /*#__PURE__*/_jsx(BpkText, {
|
|
38
|
+
tagName: "span",
|
|
39
|
+
textStyle: TEXT_STYLES.footnote,
|
|
40
|
+
children: text
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
export default BpkChatNotification;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
.bpk-chat-notification{display:flex;width:100%;padding:1rem;align-items:center;border-radius:.75rem;background:#05203c;color:#fff;box-shadow:none;animation:bpk-chat-notification-slide-in 400ms ease-out forwards;gap:.5rem}@media(prefers-reduced-motion: reduce){.bpk-chat-notification{animation:none}}.bpk-chat-notification__icon{display:flex;flex-shrink:0;fill:#fff}@keyframes bpk-chat-notification-slide-in{from{transform:translateY(-0.625rem);opacity:0}to{transform:translateY(0);opacity:1}}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 BpkChatThoughtBubble from "./src/BpkChatThoughtBubble";
|
|
20
|
+
export default BpkChatThoughtBubble;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type BpkChatThoughtBubbleProps = {
|
|
2
|
+
/**
|
|
3
|
+
* The content to display in the thinking bubble.
|
|
4
|
+
*/
|
|
5
|
+
content: string;
|
|
6
|
+
};
|
|
7
|
+
declare const BpkChatThoughtBubble: ({ content }: BpkChatThoughtBubbleProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default BpkChatThoughtBubble;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 BpkText, { TEXT_STYLES } from "../../bpk-component-text";
|
|
20
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
|
+
import STYLES from "./BpkChatThoughtBubble.module.css";
|
|
22
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
const getClassName = cssModules(STYLES);
|
|
24
|
+
const BpkChatThoughtBubble = ({
|
|
25
|
+
content
|
|
26
|
+
}) => /*#__PURE__*/_jsxs("div", {
|
|
27
|
+
className: getClassName('bpk-chat-thought-bubble'),
|
|
28
|
+
...getDataComponentAttribute('ChatThoughtBubble'),
|
|
29
|
+
"data-testid": "bpk-chat-thought-bubble",
|
|
30
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
31
|
+
className: getClassName('bpk-chat-thought-bubble__dots'),
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
34
|
+
className: getClassName('bpk-chat-thought-bubble__dots--dot', 'bpk-chat-thought-bubble__dots--dot-first')
|
|
35
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
36
|
+
className: getClassName('bpk-chat-thought-bubble__dots--dot', 'bpk-chat-thought-bubble__dots--dot-second')
|
|
37
|
+
})]
|
|
38
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
39
|
+
className: getClassName('bpk-chat-thought-bubble__bubble'),
|
|
40
|
+
children: /*#__PURE__*/_jsx(BpkText, {
|
|
41
|
+
textStyle: TEXT_STYLES.bodyDefault,
|
|
42
|
+
children: content
|
|
43
|
+
})
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
export default BpkChatThoughtBubble;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
.bpk-chat-thought-bubble{display:flex;align-items:flex-end;transform:translateY(0.75rem) scale(0.98);opacity:0;animation:bpk-chat-thought-bubble-entrance .24s cubic-bezier(0.2, 0, 0, 1) forwards;gap:.5rem;will-change:transform,opacity}@media(prefers-reduced-motion: reduce){.bpk-chat-thought-bubble{animation:bpk-chat-thought-bubble-entrance-reduced .2s ease-out forwards}}.bpk-chat-thought-bubble__dots{display:flex;align-items:flex-end;flex-shrink:0;gap:.5rem}.bpk-chat-thought-bubble__dots--dot{border-radius:50%;background-color:#05203c;animation:bpk-chat-thought-bubble-dot-bounce 1.2s ease-in-out infinite;will-change:transform}@media(prefers-reduced-motion: reduce){.bpk-chat-thought-bubble__dots--dot{transform:none;animation:bpk-chat-thought-bubble-dot-pulse 2s ease-in-out infinite}}.bpk-chat-thought-bubble__dots--dot-first{width:.5rem;height:.5rem;animation-delay:0ms}.bpk-chat-thought-bubble__dots--dot-second{width:1rem;height:1rem;animation-delay:.2s}.bpk-chat-thought-bubble__bubble{position:relative;min-width:2.5rem;max-width:17.5rem;padding:1rem;align-self:flex-start;background:#05203c;color:#fff;opacity:1;animation:bpk-chat-thought-bubble-bubble-bounce 1.2s ease-in-out infinite;animation-delay:.4s;border-end-end-radius:1.5rem;border-end-start-radius:.25rem;border-start-end-radius:1.5rem;border-start-start-radius:1.5rem;overflow-wrap:break-word;will-change:transform;word-wrap:break-word}@media(prefers-reduced-motion: reduce){.bpk-chat-thought-bubble__bubble{animation:none}}@keyframes bpk-chat-thought-bubble-dot-bounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-0.625rem)}}@keyframes bpk-chat-thought-bubble-dot-pulse{0%,100%{transform:scale(1);opacity:.6}50%{transform:scale(1.1);opacity:1}}@keyframes bpk-chat-thought-bubble-bubble-bounce{0%,60%,100%{transform:translateY(0) scale(1)}30%{transform:translateY(-0.375rem) scale(1.02)}}@keyframes bpk-chat-thought-bubble-entrance{from{transform:translateY(0.75rem) scale(0.98);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}@keyframes bpk-chat-thought-bubble-entrance-reduced{from{opacity:0}to{opacity:1}}
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
import { Component } from 'react';
|
|
20
20
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
21
21
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
22
|
-
|
|
23
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
24
22
|
import BpkAnimateHeight from "../../bpk-animate-height";
|
|
25
23
|
import { cssModules } from "../../bpk-react-utils";
|
|
26
24
|
import STYLES from "./BpkAnimateAndFade.module.css";
|
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
24
|
-
|
|
25
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
26
24
|
import BpkAnimateHeight from "../../bpk-animate-height";
|
|
27
25
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
28
26
|
import BpkCloseButton from "../../bpk-component-close-button";
|
|
@@ -23,7 +23,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
23
23
|
* Creates a Chakra UI system with Backpack token mappings
|
|
24
24
|
* Chakra UI 3.0 uses `createSystem` with `defaultConfig` and custom config
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
// Remove Chakra's global CSS to prevent style conflicts with Backpack components
|
|
27
|
+
const {
|
|
28
|
+
globalCss: _chakraGlobalCss,
|
|
29
|
+
...defaultConfigWithoutGlobalCss
|
|
30
|
+
} = defaultConfig;
|
|
31
|
+
const bpkSystem = createSystem(defaultConfigWithoutGlobalCss, createBpkConfig());
|
|
27
32
|
|
|
28
33
|
/**
|
|
29
34
|
* BpkProvider - Provides Chakra UI context for Backpack layout components
|
|
@@ -218,6 +218,10 @@ export function createBpkConfig() {
|
|
|
218
218
|
chakraBreakpoints[token] = value;
|
|
219
219
|
});
|
|
220
220
|
return defineConfig({
|
|
221
|
+
// Disable Chakra's preflight (CSS reset) so it does not override Backpack's
|
|
222
|
+
// global font styles, in particular the `-webkit-font-smoothing: antialiased`
|
|
223
|
+
// setting applied by Backpack.
|
|
224
|
+
preflight: false,
|
|
221
225
|
cssVarsPrefix: 'bpk',
|
|
222
226
|
theme: {
|
|
223
227
|
tokens: {
|
|
@@ -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
|
+
import BpkSkipLink from "./src/BpkSkipLink";
|
|
18
19
|
import themeAttributes from "./src/themeAttributes";
|
|
19
20
|
export { themeAttributes };
|
|
20
21
|
export default BpkSkipLink;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
type NativeAnchorProps = Omit<ComponentPropsWithoutRef<'a'>, 'href' | 'className' | 'children'>;
|
|
3
|
+
export type Props = NativeAnchorProps & {
|
|
4
|
+
label: string;
|
|
5
|
+
href: string;
|
|
6
|
+
className?: string | null;
|
|
7
|
+
[rest: string]: any;
|
|
8
|
+
};
|
|
9
|
+
declare const BpkSkipLink: ({ className, href, label, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default BpkSkipLink;
|
|
@@ -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 STYLES from "./BpkSkipLink.module.css";
|
|
20
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -24,18 +25,10 @@ const BpkSkipLink = ({
|
|
|
24
25
|
href,
|
|
25
26
|
label,
|
|
26
27
|
...rest
|
|
27
|
-
}) =>
|
|
28
|
-
/*#__PURE__*/
|
|
29
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
30
|
-
_jsx("a", {
|
|
28
|
+
}) => /*#__PURE__*/_jsx("a", {
|
|
31
29
|
href: href,
|
|
32
30
|
className: getClassName('bpk-skip-link', className),
|
|
33
31
|
...rest,
|
|
34
32
|
children: label
|
|
35
33
|
});
|
|
36
|
-
BpkSkipLink.propTypes = {
|
|
37
|
-
label: PropTypes.string.isRequired,
|
|
38
|
-
href: PropTypes.string.isRequired,
|
|
39
|
-
className: PropTypes.string
|
|
40
|
-
};
|
|
41
34
|
export default BpkSkipLink;
|
|
@@ -0,0 +1,20 @@
|
|
|
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 BpkThumbButton from "./src/BpkThumbButton";
|
|
20
|
+
export default BpkThumbButton;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ThumbsButtonType = 'up' | 'down';
|
|
2
|
+
export type BpkThumbButtonProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Accessibility label for screen readers (REQUIRED).
|
|
5
|
+
*/
|
|
6
|
+
accessibilityLabel: string;
|
|
7
|
+
/**
|
|
8
|
+
* Click handler callback.
|
|
9
|
+
*/
|
|
10
|
+
onClick: (type: ThumbsButtonType) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the thumb is in selected state.
|
|
13
|
+
*/
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Type of thumb icon to display.
|
|
17
|
+
*/
|
|
18
|
+
type: ThumbsButtonType;
|
|
19
|
+
};
|
|
20
|
+
declare const BpkThumbButton: ({ accessibilityLabel, onClick, selected, type, }: BpkThumbButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export default BpkThumbButton;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 ThumbsDownIcon from "../../bpk-component-icon/lg/thumbs-down";
|
|
20
|
+
import ThumbsUpIcon from "../../bpk-component-icon/lg/thumbs-up";
|
|
21
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
22
|
+
import STYLES from "./BpkThumbButton.module.css";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
const getClassName = cssModules(STYLES);
|
|
25
|
+
const BpkThumbButton = ({
|
|
26
|
+
accessibilityLabel,
|
|
27
|
+
onClick,
|
|
28
|
+
selected = false,
|
|
29
|
+
type
|
|
30
|
+
}) => {
|
|
31
|
+
const Icon = type === 'up' ? ThumbsUpIcon : ThumbsDownIcon;
|
|
32
|
+
const classNames = getClassName('bpk-thumb-button', selected && 'bpk-thumb-button--selected');
|
|
33
|
+
const handleClick = event => {
|
|
34
|
+
event.stopPropagation();
|
|
35
|
+
onClick(type);
|
|
36
|
+
};
|
|
37
|
+
const iconClassNames = getClassName('bpk-thumb-button__icon');
|
|
38
|
+
return /*#__PURE__*/_jsx("button", {
|
|
39
|
+
type: "button",
|
|
40
|
+
className: classNames,
|
|
41
|
+
onClick: handleClick,
|
|
42
|
+
"aria-label": accessibilityLabel,
|
|
43
|
+
"aria-pressed": selected,
|
|
44
|
+
"data-testid": `bpk-thumb-button-${type}`,
|
|
45
|
+
...getDataComponentAttribute('ThumbButton'),
|
|
46
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
47
|
+
className: iconClassNames,
|
|
48
|
+
children: /*#__PURE__*/_jsx(Icon, {})
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export default BpkThumbButton;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
.bpk-thumb-button{display:flex;width:1.5rem;height:1.5rem;padding:0;justify-content:center;align-items:center;transition:all 200ms ease-in-out;border:none;background:rgba(0,0,0,0);color:rgba(0,0,0,.2);cursor:pointer;appearance:none;position:relative}.bpk-thumb-button::before{position:absolute;top:calc(-2.75rem/2 + 50%);left:calc(-2.75rem/2 + 50%);content:"";width:2.75rem;height:2.75rem}.bpk-no-touch-support .bpk-thumb-button:hover:not(:active):not(:disabled){color:#626971}:global(.bpk-no-touch-support) .bpk-thumb-button:hover:not(:active):not(:disabled){color:#626971}@media(prefers-reduced-motion: reduce){.bpk-thumb-button{transition:none}}.bpk-thumb-button--selected{color:#0062e3}.bpk-no-touch-support .bpk-thumb-button--selected:hover:not(:active):not(:disabled){color:#0062e3}:global(.bpk-no-touch-support) .bpk-thumb-button--selected:hover:not(:active):not(:disabled){color:#0062e3}.bpk-thumb-button__icon{display:flex;fill:currentcolor}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyscanner/backpack-web",
|
|
3
|
-
"version": "41.
|
|
3
|
+
"version": "41.18.0",
|
|
4
4
|
"description": "Backpack Design System web library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@chakra-ui/react": "^3.
|
|
25
|
+
"@chakra-ui/react": "^3.33.0",
|
|
26
26
|
"@floating-ui/react": "^0.26.12",
|
|
27
27
|
"@popperjs/core": "^2.11.8",
|
|
28
28
|
"@radix-ui/react-compose-refs": "^1.1.1",
|