@skyscanner/backpack-web 41.17.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-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-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 +1 -1
|
@@ -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}}
|
|
@@ -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}
|