@skyscanner/backpack-web 42.1.0 → 42.3.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-banner-alert/src/BpkBannerAlert.js +0 -7
- package/bpk-component-breakpoint/src/BpkBreakpoint.js +3 -1
- package/bpk-component-calendar/src/utils.js +1 -1
- package/bpk-component-card/index.d.ts +4 -1
- package/bpk-component-card/index.js +3 -1
- package/bpk-component-card/src/BpkCardV2/BpkCardV2.d.ts +27 -0
- package/bpk-component-card/src/BpkCardV2/BpkCardV2.js +57 -0
- package/bpk-component-card/src/BpkCardV2/BpkCardV2.module.css +18 -0
- package/bpk-component-card/src/BpkCardV2/common-types.d.ts +124 -0
- package/bpk-component-card/src/BpkCardV2/common-types.js +102 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Body.d.ts +36 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Body.js +65 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Divider.d.ts +13 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Divider.js +37 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Footer.d.ts +24 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Footer.js +60 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Header.d.ts +24 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Header.js +60 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Root.d.ts +28 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Root.js +68 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Section.d.ts +22 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Section.js +53 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/resolveDirectionalPadding.d.ts +16 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/resolveDirectionalPadding.js +32 -0
- package/bpk-component-card-list/src/BpkCardList.module.css +1 -1
- package/bpk-component-card-list/src/BpkCardListRowRail/BpkCardListCarousel.js +3 -3
- package/bpk-component-chat-bubble/index.d.ts +4 -0
- package/bpk-component-chat-bubble/index.js +21 -0
- package/bpk-component-chat-bubble/src/BpkChatBubble.d.ts +3 -0
- package/bpk-component-chat-bubble/src/BpkChatBubble.js +107 -0
- package/bpk-component-chat-bubble/src/BpkChatBubble.module.css +18 -0
- package/bpk-component-chat-bubble/src/common-types.d.ts +55 -0
- package/bpk-component-chat-bubble/src/common-types.js +29 -0
- package/bpk-component-chatbot-input/index.d.ts +7 -0
- package/bpk-component-chatbot-input/index.js +23 -0
- package/bpk-component-chatbot-input/src/BpkChatbotInput.d.ts +4 -0
- package/bpk-component-chatbot-input/src/BpkChatbotInput.js +118 -0
- package/bpk-component-chatbot-input/src/BpkChatbotInput.module.css +18 -0
- package/bpk-component-chatbot-input/src/InputField/InputField.d.ts +3 -0
- package/bpk-component-chatbot-input/src/InputField/InputField.js +82 -0
- package/bpk-component-chatbot-input/src/InputField/InputField.module.css +18 -0
- package/bpk-component-chatbot-input/src/SendButton/SendButton.d.ts +9 -0
- package/bpk-component-chatbot-input/src/SendButton/SendButton.js +47 -0
- package/bpk-component-chatbot-input/src/TextAreaField/TextAreaField.d.ts +10 -0
- package/bpk-component-chatbot-input/src/TextAreaField/TextAreaField.js +93 -0
- package/bpk-component-chatbot-input/src/TextAreaField/TextAreaField.module.css +18 -0
- package/bpk-component-chatbot-input/src/common-types.d.ts +37 -0
- package/bpk-component-chatbot-input/src/common-types.js +23 -0
- package/bpk-component-chatbot-input/src/constants.d.ts +5 -0
- package/bpk-component-chatbot-input/src/constants.js +22 -0
- package/bpk-component-chatbot-input/src/hooks/index.d.ts +4 -0
- package/bpk-component-chatbot-input/src/hooks/index.js +22 -0
- package/bpk-component-chatbot-input/src/hooks/useChatbotInput.d.ts +32 -0
- package/bpk-component-chatbot-input/src/hooks/useChatbotInput.js +111 -0
- package/bpk-component-chatbot-input/src/hooks/useChatbotInputManager.d.ts +20 -0
- package/bpk-component-chatbot-input/src/hooks/useChatbotInputManager.js +83 -0
- package/bpk-component-chatbot-input/src/hooks/useInputHandlers.d.ts +8 -0
- package/bpk-component-chatbot-input/src/hooks/useInputHandlers.js +54 -0
- package/bpk-component-chatbot-input/src/hooks/useTextAreaAutoResize.d.ts +22 -0
- package/bpk-component-chatbot-input/src/hooks/useTextAreaAutoResize.js +137 -0
- package/bpk-component-chatbot-input/src/themeAttributes.d.ts +14 -0
- package/bpk-component-chatbot-input/src/themeAttributes.js +34 -0
- package/bpk-component-checkbox/index.d.ts +8 -8
- package/bpk-component-checkbox/index.js +3 -3
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2.d.ts +9 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckbox.js → BpkCheckboxV2.js} +14 -14
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Control.d.ts +6 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxControl.js → BpkCheckboxV2Control.js} +3 -3
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Description.d.ts +6 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxDescription.js → BpkCheckboxV2Description.js} +3 -3
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2HiddenInput.d.ts +2 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxHiddenInput.js → BpkCheckboxV2HiddenInput.js} +2 -2
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Indicator.d.ts +2 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxIndicator.js → BpkCheckboxV2Indicator.js} +3 -3
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Label.d.ts +6 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxLabel.js → BpkCheckboxV2Label.js} +3 -3
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Root.d.ts +16 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxRoot.js → BpkCheckboxV2Root.js} +3 -3
- package/bpk-component-checkbox-card/src/BpkCheckboxCard.module.css +1 -1
- package/bpk-component-floating-notification/index.d.ts +2 -1
- package/bpk-component-floating-notification/index.js +2 -1
- package/bpk-component-floating-notification/src/BpkFloatingNotification.d.ts +5 -0
- package/bpk-component-floating-notification/src/BpkFloatingNotification.js +8 -2
- package/bpk-component-floating-notification/src/BpkFloatingNotification.module.css +1 -1
- package/bpk-component-icon/scripts/generate-figma-connect.js +267 -0
- package/bpk-component-info-banner/src/BpkInfoBanner.module.css +1 -1
- package/bpk-component-info-banner/src/BpkInfoBannerInner.js +8 -3
- package/bpk-component-info-banner/src/common-types.d.ts +1 -0
- package/bpk-component-info-banner/src/common-types.js +2 -1
- package/bpk-component-inset-banner/index.d.ts +4 -1
- package/bpk-component-inset-banner/index.js +2 -1
- package/bpk-component-inset-banner/src/BpkInsetBannerV3/BpkInsetBannerV3.d.ts +56 -0
- package/bpk-component-inset-banner/src/BpkInsetBannerV3/BpkInsetBannerV3.js +118 -0
- package/bpk-component-inset-banner/src/BpkInsetBannerV3/BpkInsetBannerV3.module.css +18 -0
- package/bpk-component-layout/src/BpkProvider.d.ts +9 -4
- package/bpk-component-layout/src/BpkProvider.js +87 -8
- package/bpk-component-layout/src/types.d.ts +2 -2
- package/bpk-component-link/src/common-types.d.ts +1 -1
- package/bpk-component-modal/index.d.ts +3 -1
- package/bpk-component-modal/index.js +3 -1
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3.d.ts +14 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3.js +43 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Body/BpkModalV3Body.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Body/BpkModalV3Body.js +30 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Body/BpkModalV3Body.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3CloseTrigger/BpkModalV3CloseTrigger.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3CloseTrigger/BpkModalV3CloseTrigger.js +49 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3CloseTrigger/BpkModalV3CloseTrigger.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Content/BpkModalV3Content.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Content/BpkModalV3Content.js +38 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Content/BpkModalV3Content.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Context.d.ts +3 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Context.js +22 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Description/BpkModalV3Description.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Description/BpkModalV3Description.js +28 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Header/BpkModalV3Header.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Header/BpkModalV3Header.js +34 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Header/BpkModalV3Header.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3HeroImage/BpkModalV3HeroImage.d.ts +10 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3HeroImage/BpkModalV3HeroImage.js +44 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3HeroImage/BpkModalV3HeroImage.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Portal/BpkModalV3Portal.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Portal/BpkModalV3Portal.js +26 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/BpkModalV3Root.d.ts +13 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/BpkModalV3Root.js +67 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/useBodyLock.d.ts +9 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/useBodyLock.js +69 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Scrim/BpkModalV3Scrim.d.ts +2 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Scrim/BpkModalV3Scrim.js +32 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Scrim/BpkModalV3Scrim.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Title/BpkModalV3Title.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Title/BpkModalV3Title.js +31 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Title/BpkModalV3Title.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Trigger/BpkModalV3Trigger.d.ts +8 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Trigger/BpkModalV3Trigger.js +30 -0
- package/bpk-component-modal/src/BpkModalV3/common-types.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/common-types.js +24 -0
- package/bpk-component-page-indicator/src/NavButton.d.ts +2 -1
- package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.js +37 -16
- package/bpk-component-skeleton/src/BpkBaseSkeleton.d.d.ts +1 -0
- package/bpk-component-skeleton/src/BpkSkeleton.d.d.ts +1 -0
- package/bpk-component-table/index.d.ts +2 -1
- package/bpk-component-table/index.js +2 -1
- package/bpk-component-table/src/BpkTable.module.css +1 -1
- package/bpk-component-table/src/BpkTableBody.d.ts +4 -1
- package/bpk-component-table/src/BpkTableBody.js +19 -4
- package/bpk-component-table/src/common-types.d.ts +5 -0
- package/bpk-component-table/src/common-types.js +22 -0
- package/bpk-react-utils/src/Portal.d.ts +1 -1
- package/package.json +2 -2
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckbox.d.ts +0 -9
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxControl.d.ts +0 -6
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxDescription.d.ts +0 -6
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxHiddenInput.d.ts +0 -2
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxIndicator.d.ts +0 -2
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxLabel.d.ts +0 -6
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxRoot.d.ts +0 -16
- /package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckbox.module.css → BpkCheckboxV2.module.css} +0 -0
|
@@ -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 { BpkFlex, BpkSpacing } from "../../../../bpk-component-layout";
|
|
20
|
+
import { getDataComponentAttribute } from "../../../../bpk-react-utils";
|
|
21
|
+
import resolveDirectionalPadding from "./resolveDirectionalPadding";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
/**
|
|
24
|
+
* Header subcomponent for BpkCardV2.
|
|
25
|
+
*
|
|
26
|
+
* Renders a BpkFlex container positioned at the top of the card.
|
|
27
|
+
* Defaults to horizontal (row) direction with base padding on top, start
|
|
28
|
+
* and end, and no bottom padding. All BpkFlex props can be used to customise the layout.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* <BpkCardV2.Header>Card title</BpkCardV2.Header>
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* <BpkCardV2.Header justify="space-between" align="center">
|
|
35
|
+
* <BpkText>Title</BpkText>
|
|
36
|
+
* <BpkText>Action</BpkText>
|
|
37
|
+
* </BpkCardV2.Header>
|
|
38
|
+
*
|
|
39
|
+
* @returns {JSX.Element} Header component
|
|
40
|
+
*/
|
|
41
|
+
const Header = ({
|
|
42
|
+
children,
|
|
43
|
+
padding,
|
|
44
|
+
paddingBottom,
|
|
45
|
+
paddingEnd,
|
|
46
|
+
paddingStart,
|
|
47
|
+
paddingTop,
|
|
48
|
+
...rest
|
|
49
|
+
}) => /*#__PURE__*/_jsx(BpkFlex, {
|
|
50
|
+
padding: padding,
|
|
51
|
+
paddingTop: resolveDirectionalPadding(padding, paddingTop, BpkSpacing.Base),
|
|
52
|
+
paddingStart: resolveDirectionalPadding(padding, paddingStart, BpkSpacing.Base),
|
|
53
|
+
paddingEnd: resolveDirectionalPadding(padding, paddingEnd, BpkSpacing.Base),
|
|
54
|
+
paddingBottom: resolveDirectionalPadding(padding, paddingBottom, BpkSpacing.None),
|
|
55
|
+
...getDataComponentAttribute('CardV2.Header'),
|
|
56
|
+
...rest,
|
|
57
|
+
children: children
|
|
58
|
+
});
|
|
59
|
+
Header.displayName = 'BpkCardV2.Header';
|
|
60
|
+
export default Header;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type BpkCardV2Props } from '../common-types';
|
|
2
|
+
/**
|
|
3
|
+
* BpkCardV2.Root is the root container for the card component.
|
|
4
|
+
*
|
|
5
|
+
* It supports explicit multi-section composition (Header, Body, Footer), flexible
|
|
6
|
+
* multi-column layouts (Section/Divider), and customizable surface colors. The component
|
|
7
|
+
* is mobile-first and automatically adapts layout across breakpoints.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <BpkCardV2.Root>
|
|
11
|
+
* <BpkCardV2.Header>Title</BpkCardV2.Header>
|
|
12
|
+
* <BpkCardV2.Body>Content</BpkCardV2.Body>
|
|
13
|
+
* <BpkCardV2.Footer>Footer</BpkCardV2.Footer>
|
|
14
|
+
* </BpkCardV2.Root>
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Multi-column layout (70/30 on desktop, stacked on mobile).
|
|
18
|
+
* // The `auto` column in templateColumns reserves space for the Divider.
|
|
19
|
+
* <BpkCardV2.Root bgColor={CARD_V2_SURFACE_COLORS.surfaceElevated}>
|
|
20
|
+
* <BpkCardV2.Body templateColumns={{ base: '1fr', tablet: '7fr auto 3fr' }}>
|
|
21
|
+
* <BpkCardV2.Section>Main content</BpkCardV2.Section>
|
|
22
|
+
* <BpkCardV2.Divider />
|
|
23
|
+
* <BpkCardV2.Section>Sidebar</BpkCardV2.Section>
|
|
24
|
+
* </BpkCardV2.Body>
|
|
25
|
+
* </BpkCardV2.Root>
|
|
26
|
+
*/
|
|
27
|
+
declare const Root: import("react").ForwardRefExoticComponent<BpkCardV2Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
|
+
export default Root;
|
|
@@ -0,0 +1,68 @@
|
|
|
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 { forwardRef } from 'react';
|
|
20
|
+
import { cssModules, getDataComponentAttribute } from "../../../../bpk-react-utils";
|
|
21
|
+
import { CARD_V2_SURFACE_COLORS, CARD_V2_VARIANTS } from "../common-types";
|
|
22
|
+
import STYLES from "../BpkCardV2.module.css";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
const getClassName = cssModules(STYLES);
|
|
25
|
+
const toKebab = s => s.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* BpkCardV2.Root is the root container for the card component.
|
|
29
|
+
*
|
|
30
|
+
* It supports explicit multi-section composition (Header, Body, Footer), flexible
|
|
31
|
+
* multi-column layouts (Section/Divider), and customizable surface colors. The component
|
|
32
|
+
* is mobile-first and automatically adapts layout across breakpoints.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* <BpkCardV2.Root>
|
|
36
|
+
* <BpkCardV2.Header>Title</BpkCardV2.Header>
|
|
37
|
+
* <BpkCardV2.Body>Content</BpkCardV2.Body>
|
|
38
|
+
* <BpkCardV2.Footer>Footer</BpkCardV2.Footer>
|
|
39
|
+
* </BpkCardV2.Root>
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // Multi-column layout (70/30 on desktop, stacked on mobile).
|
|
43
|
+
* // The `auto` column in templateColumns reserves space for the Divider.
|
|
44
|
+
* <BpkCardV2.Root bgColor={CARD_V2_SURFACE_COLORS.surfaceElevated}>
|
|
45
|
+
* <BpkCardV2.Body templateColumns={{ base: '1fr', tablet: '7fr auto 3fr' }}>
|
|
46
|
+
* <BpkCardV2.Section>Main content</BpkCardV2.Section>
|
|
47
|
+
* <BpkCardV2.Divider />
|
|
48
|
+
* <BpkCardV2.Section>Sidebar</BpkCardV2.Section>
|
|
49
|
+
* </BpkCardV2.Body>
|
|
50
|
+
* </BpkCardV2.Root>
|
|
51
|
+
*/
|
|
52
|
+
const Root = /*#__PURE__*/forwardRef(({
|
|
53
|
+
bgColor = CARD_V2_SURFACE_COLORS.surfaceDefault,
|
|
54
|
+
children,
|
|
55
|
+
variant = CARD_V2_VARIANTS.default,
|
|
56
|
+
...rest
|
|
57
|
+
}, ref) => /*#__PURE__*/_jsx("div", {
|
|
58
|
+
ref: ref,
|
|
59
|
+
...getDataComponentAttribute('CardV2'),
|
|
60
|
+
...rest,
|
|
61
|
+
// className and style are placed after {...rest} so any values smuggled
|
|
62
|
+
// past the TypeScript Omit (e.g. via `as any`) are safely overwritten.
|
|
63
|
+
className: getClassName('bpk-card-v2', `bpk-card-v2--${toKebab(variant)}`, `bpk-card-v2--${toKebab(bgColor)}`),
|
|
64
|
+
style: undefined,
|
|
65
|
+
children: children
|
|
66
|
+
}));
|
|
67
|
+
Root.displayName = 'BpkCardV2.Root';
|
|
68
|
+
export default Root;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BpkCardV2SectionProps } from '../common-types';
|
|
2
|
+
/**
|
|
3
|
+
* Section subcomponent for multi-column layouts in BpkCardV2.
|
|
4
|
+
*
|
|
5
|
+
* Generic content area used with the `columns` prop on BpkCardV2.Body.
|
|
6
|
+
* Flex value is injected by Body via cloneElement based on the columns spec.
|
|
7
|
+
* All BpkBox props can be used to customise the layout.
|
|
8
|
+
*
|
|
9
|
+
* @returns {JSX.Element} Section component
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* <BpkCardV2.Body templateColumns="1fr 2fr 1fr">
|
|
13
|
+
* <BpkCardV2.Section>Left</BpkCardV2.Section>
|
|
14
|
+
* <BpkCardV2.Section>Center</BpkCardV2.Section>
|
|
15
|
+
* <BpkCardV2.Section>Right</BpkCardV2.Section>
|
|
16
|
+
* </BpkCardV2.Body>
|
|
17
|
+
*/
|
|
18
|
+
declare const Section: {
|
|
19
|
+
({ children, display, flexDirection, padding, ...rest }: BpkCardV2SectionProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
export default Section;
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { BpkBox, BpkSpacing } from "../../../../bpk-component-layout";
|
|
20
|
+
import { getDataComponentAttribute } from "../../../../bpk-react-utils";
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
/**
|
|
23
|
+
* Section subcomponent for multi-column layouts in BpkCardV2.
|
|
24
|
+
*
|
|
25
|
+
* Generic content area used with the `columns` prop on BpkCardV2.Body.
|
|
26
|
+
* Flex value is injected by Body via cloneElement based on the columns spec.
|
|
27
|
+
* All BpkBox props can be used to customise the layout.
|
|
28
|
+
*
|
|
29
|
+
* @returns {JSX.Element} Section component
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* <BpkCardV2.Body templateColumns="1fr 2fr 1fr">
|
|
33
|
+
* <BpkCardV2.Section>Left</BpkCardV2.Section>
|
|
34
|
+
* <BpkCardV2.Section>Center</BpkCardV2.Section>
|
|
35
|
+
* <BpkCardV2.Section>Right</BpkCardV2.Section>
|
|
36
|
+
* </BpkCardV2.Body>
|
|
37
|
+
*/
|
|
38
|
+
const Section = ({
|
|
39
|
+
children,
|
|
40
|
+
display = 'flex',
|
|
41
|
+
flexDirection = 'column',
|
|
42
|
+
padding = BpkSpacing.Base,
|
|
43
|
+
...rest
|
|
44
|
+
}) => /*#__PURE__*/_jsx(BpkBox, {
|
|
45
|
+
display: display,
|
|
46
|
+
flexDirection: flexDirection,
|
|
47
|
+
padding: padding,
|
|
48
|
+
...getDataComponentAttribute('CardV2.Section'),
|
|
49
|
+
...rest,
|
|
50
|
+
children: children
|
|
51
|
+
});
|
|
52
|
+
Section.displayName = 'BpkCardV2.Section';
|
|
53
|
+
export default Section;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BpkFlexProps } from '../../../../bpk-component-layout';
|
|
2
|
+
type PaddingValue = BpkFlexProps['padding'];
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a directional padding value for Header/Footer subcomponents.
|
|
5
|
+
*
|
|
6
|
+
* When the shorthand `padding` prop is set, directional overrides are passed
|
|
7
|
+
* through as-is (BpkFlex handles shorthand + directional merging).
|
|
8
|
+
* When no shorthand is set, the directional value falls back to a default.
|
|
9
|
+
*
|
|
10
|
+
* @param {PaddingValue} padding - The shorthand padding prop value
|
|
11
|
+
* @param {PaddingValue} directional - The directional padding override
|
|
12
|
+
* @param {PaddingValue} fallback - The default value when no shorthand or directional is set
|
|
13
|
+
* @returns {PaddingValue} The resolved padding value
|
|
14
|
+
*/
|
|
15
|
+
declare const resolveDirectionalPadding: (padding: PaddingValue, directional: PaddingValue, fallback: PaddingValue) => PaddingValue;
|
|
16
|
+
export default resolveDirectionalPadding;
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
/**
|
|
20
|
+
* Resolves a directional padding value for Header/Footer subcomponents.
|
|
21
|
+
*
|
|
22
|
+
* When the shorthand `padding` prop is set, directional overrides are passed
|
|
23
|
+
* through as-is (BpkFlex handles shorthand + directional merging).
|
|
24
|
+
* When no shorthand is set, the directional value falls back to a default.
|
|
25
|
+
*
|
|
26
|
+
* @param {PaddingValue} padding - The shorthand padding prop value
|
|
27
|
+
* @param {PaddingValue} directional - The directional padding override
|
|
28
|
+
* @param {PaddingValue} fallback - The default value when no shorthand or directional is set
|
|
29
|
+
* @returns {PaddingValue} The resolved padding value
|
|
30
|
+
*/
|
|
31
|
+
const resolveDirectionalPadding = (padding, directional, fallback) => padding !== undefined ? directional : directional ?? fallback;
|
|
32
|
+
export default resolveDirectionalPadding;
|
|
@@ -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-card-list{display:flex;flex-direction:column;
|
|
18
|
+
.bpk-card-list{display:flex;flex-direction:column;gap:1.5rem}@media(max-width: 32rem){.bpk-card-list{gap:1rem}}.bpk-card-list--card-list{display:flex;margin:calc(-1*0.25rem);padding:.25rem;flex-direction:column;overflow:hidden}
|
|
@@ -133,10 +133,10 @@ const BpkCardListCarousel = props => {
|
|
|
133
133
|
cardDimensionStyle.height = `${firstCardHeightRef.current}px`;
|
|
134
134
|
}
|
|
135
135
|
const isPageStart = index % initiallyShownCards === 0;
|
|
136
|
+
const cardKey = `carousel-card-${index.toString()}`;
|
|
136
137
|
const commonProps = {
|
|
137
138
|
className: getClassName(`bpk-card-list-row-rail__${layout}__card`, isPageStart && 'bpk-card-list-row-rail__card--page-start'),
|
|
138
139
|
style: shownNumberStyle,
|
|
139
|
-
key: `carousel-card-${index.toString()}`,
|
|
140
140
|
role: 'group'
|
|
141
141
|
};
|
|
142
142
|
|
|
@@ -157,7 +157,7 @@ const BpkCardListCarousel = props => {
|
|
|
157
157
|
className: getClassName('bpk-card-list-row-rail__card-slot'),
|
|
158
158
|
children: card
|
|
159
159
|
})
|
|
160
|
-
});
|
|
160
|
+
}, cardKey);
|
|
161
161
|
}
|
|
162
162
|
return /*#__PURE__*/_jsx("div", {
|
|
163
163
|
...commonProps,
|
|
@@ -167,7 +167,7 @@ const BpkCardListCarousel = props => {
|
|
|
167
167
|
className: getClassName('bpk-card-list-row-rail__card-slot'),
|
|
168
168
|
children: card
|
|
169
169
|
})
|
|
170
|
-
});
|
|
170
|
+
}, cardKey);
|
|
171
171
|
})
|
|
172
172
|
});
|
|
173
173
|
};
|
|
@@ -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 BpkChatBubble from "./src/BpkChatBubble";
|
|
20
|
+
export { CHAT_BUBBLE_TYPE, CHAT_BUBBLE_POSITION } from "./src/common-types";
|
|
21
|
+
export default BpkChatBubble;
|
|
@@ -0,0 +1,107 @@
|
|
|
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 BpkButton, { BUTTON_TYPES, SIZE_TYPES } from "../../bpk-component-button";
|
|
20
|
+
import RedoSmIcon from "../../bpk-component-icon/sm/redo";
|
|
21
|
+
import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
|
|
22
|
+
import BpkThumbButton from "../../bpk-component-thumb-button";
|
|
23
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
24
|
+
import { CHAT_BUBBLE_TYPE } from "./common-types";
|
|
25
|
+
import STYLES from "./BpkChatBubble.module.css";
|
|
26
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
+
const getClassName = cssModules(STYLES);
|
|
28
|
+
const clampAndSnap = (ms, maxDelay = 300) => {
|
|
29
|
+
const v = Math.min(ms, maxDelay);
|
|
30
|
+
return Math.round(v / 50) * 50;
|
|
31
|
+
};
|
|
32
|
+
const BpkChatBubble = props => {
|
|
33
|
+
const {
|
|
34
|
+
animationDelay = 0,
|
|
35
|
+
children,
|
|
36
|
+
type
|
|
37
|
+
} = props;
|
|
38
|
+
const userPosition = 'userPosition' in props ? props.userPosition : undefined;
|
|
39
|
+
const systemPosition = 'systemPosition' in props ? props.systemPosition : undefined;
|
|
40
|
+
const showFeedback = 'showFeedback' in props ? props.showFeedback ?? false : false;
|
|
41
|
+
const selectedFeedback = 'selectedFeedback' in props ? props.selectedFeedback ?? null : null;
|
|
42
|
+
const onFeedbackClick = 'onFeedbackClick' in props ? props.onFeedbackClick : undefined;
|
|
43
|
+
const onRetry = 'onRetry' in props ? props.onRetry : undefined;
|
|
44
|
+
const retryDisabled = 'retryDisabled' in props ? props.retryDisabled ?? false : false;
|
|
45
|
+
const retryLabel = 'retryLabel' in props ? props.retryLabel : '';
|
|
46
|
+
const onSuggestionClick = 'onSuggestionClick' in props ? props.onSuggestionClick : undefined;
|
|
47
|
+
const thumbsUpLabel = 'thumbsUpLabel' in props ? props.thumbsUpLabel ?? 'Rate as useful' : 'Rate as useful';
|
|
48
|
+
const thumbsDownLabel = 'thumbsDownLabel' in props ? props.thumbsDownLabel ?? 'Rate as not useful' : 'Rate as not useful';
|
|
49
|
+
const isUser = type === CHAT_BUBBLE_TYPE.user;
|
|
50
|
+
const isSuggestion = type === CHAT_BUBBLE_TYPE.button;
|
|
51
|
+
const isRetry = type === CHAT_BUBBLE_TYPE.retry;
|
|
52
|
+
const isBot = type === CHAT_BUBBLE_TYPE.bot;
|
|
53
|
+
const isSystem = isBot || isRetry;
|
|
54
|
+
const snapped = clampAndSnap(animationDelay);
|
|
55
|
+
const inlineStyle = {
|
|
56
|
+
'--anim-delay': `${snapped}ms`
|
|
57
|
+
};
|
|
58
|
+
const containerClassName = getClassName('bpk-chat-bubble', 'bpk-chat-bubble--animated', isUser && 'bpk-chat-bubble--user', isBot && 'bpk-chat-bubble--bot', isRetry && 'bpk-chat-bubble--retry', isSuggestion && 'bpk-chat-bubble--button', isUser && userPosition === 'first' && 'bpk-chat-bubble--user-first', isUser && userPosition === 'middle' && 'bpk-chat-bubble--user-middle', isUser && userPosition === 'last' && 'bpk-chat-bubble--user-last', isSystem && systemPosition === 'first' && 'bpk-chat-bubble--system-first', isSystem && systemPosition === 'middle' && 'bpk-chat-bubble--system-middle', isSystem && systemPosition === 'last' && 'bpk-chat-bubble--system-last');
|
|
59
|
+
if (isSuggestion) {
|
|
60
|
+
return /*#__PURE__*/_jsx("button", {
|
|
61
|
+
type: "button",
|
|
62
|
+
className: containerClassName,
|
|
63
|
+
style: inlineStyle,
|
|
64
|
+
onClick: onSuggestionClick,
|
|
65
|
+
"data-testid": "bpk-chat-bubble-suggestion",
|
|
66
|
+
...getDataComponentAttribute('ChatBubble'),
|
|
67
|
+
children: children
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
71
|
+
className: containerClassName,
|
|
72
|
+
style: inlineStyle,
|
|
73
|
+
"data-testid": "bpk-chat-bubble",
|
|
74
|
+
...getDataComponentAttribute('ChatBubble'),
|
|
75
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
76
|
+
className: getClassName('bpk-chat-bubble__content'),
|
|
77
|
+
children: [children, isRetry && onRetry && /*#__PURE__*/_jsx("div", {
|
|
78
|
+
className: getClassName('bpk-chat-bubble__retry'),
|
|
79
|
+
children: /*#__PURE__*/_jsx(BpkButton, {
|
|
80
|
+
type: BUTTON_TYPES.primary,
|
|
81
|
+
size: SIZE_TYPES.small,
|
|
82
|
+
onClick: onRetry,
|
|
83
|
+
disabled: retryDisabled,
|
|
84
|
+
leadingIcon: /*#__PURE__*/_jsx(RedoSmIcon, {}),
|
|
85
|
+
children: /*#__PURE__*/_jsx(BpkText, {
|
|
86
|
+
textStyle: TEXT_STYLES.label1,
|
|
87
|
+
children: retryLabel
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
})]
|
|
91
|
+
}), showFeedback && isBot && /*#__PURE__*/_jsxs("div", {
|
|
92
|
+
className: getClassName('bpk-chat-bubble__thumbs'),
|
|
93
|
+
children: [/*#__PURE__*/_jsx(BpkThumbButton, {
|
|
94
|
+
type: "up",
|
|
95
|
+
selected: selectedFeedback === 'up',
|
|
96
|
+
onClick: onFeedbackClick ?? (() => {}),
|
|
97
|
+
accessibilityLabel: thumbsUpLabel
|
|
98
|
+
}), /*#__PURE__*/_jsx(BpkThumbButton, {
|
|
99
|
+
type: "down",
|
|
100
|
+
selected: selectedFeedback === 'down',
|
|
101
|
+
onClick: onFeedbackClick ?? (() => {}),
|
|
102
|
+
accessibilityLabel: thumbsDownLabel
|
|
103
|
+
})]
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
export default BpkChatBubble;
|
|
@@ -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
|
+
@keyframes bpk-chat-bubble-entrance{from{transform:translateY(0.625rem) scale(0.98);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}@keyframes bpk-chat-bubble-entrance-reduced{from{opacity:0}to{opacity:1}}.bpk-chat-bubble{width:fit-content;max-width:17.5rem;padding:1rem;background:#fff;color:#161616;overflow-wrap:break-word;word-wrap:break-word}.bpk-chat-bubble--bot,.bpk-chat-bubble--retry{align-self:flex-start}.bpk-chat-bubble--button,.bpk-chat-bubble--user{align-self:flex-end}.bpk-chat-bubble--button,.bpk-chat-bubble--user,.bpk-chat-bubble--bot,.bpk-chat-bubble--retry{border-radius:1.5rem}html[dir=rtl] .bpk-chat-bubble{direction:rtl}.bpk-chat-bubble--animated{transform:translateY(0.625rem) scale(0.98);opacity:0;animation:bpk-chat-bubble-entrance 200ms cubic-bezier(0.2, 0, 0, 1) forwards;animation-delay:var(--anim-delay, 0ms)}@media(prefers-reduced-motion: reduce){.bpk-chat-bubble--animated{transform:translateY(0) scale(1);animation:bpk-chat-bubble-entrance-reduced 200ms ease-out forwards}}.bpk-chat-bubble--bot,.bpk-chat-bubble--retry{text-align:start}.bpk-chat-bubble--user{background:#0062e3;color:#fff;text-align:start}.bpk-chat-bubble--button{width:fit-content;transition:transform 200ms ease-in-out,box-shadow 200ms ease-in-out;border:1px solid #0062e3;background:rgba(0,0,0,0);color:#0062e3;text-align:start;cursor:pointer;border-end-end-radius:.25rem}.bpk-no-touch-support .bpk-chat-bubble--button:hover:not(:active):not(:disabled){transform:translateY(-0.0625rem);box-shadow:0px 1px 3px 0px rgba(37,32,31,.3)}:global(.bpk-no-touch-support) .bpk-chat-bubble--button:hover:not(:active):not(:disabled){transform:translateY(-0.0625rem);box-shadow:0px 1px 3px 0px rgba(37,32,31,.3)}.bpk-chat-bubble--button:active{transform:translateY(0);box-shadow:none}.bpk-chat-bubble--system-first{border-end-start-radius:.25rem}.bpk-chat-bubble--system-middle{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.bpk-chat-bubble--system-last{border-start-start-radius:.25rem}.bpk-chat-bubble--user-first{border-end-end-radius:.25rem}.bpk-chat-bubble--user-middle{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.bpk-chat-bubble--user-last{border-start-end-radius:.25rem}.bpk-chat-bubble__content p+p{margin-top:1rem}.bpk-chat-bubble__retry{margin-top:1rem}.bpk-chat-bubble__retry button{padding:0 1rem}.bpk-chat-bubble__thumbs{display:flex;margin-top:.5rem;align-items:center;gap:1rem}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ThumbsButtonType } from '../../bpk-component-thumb-button';
|
|
3
|
+
export declare const CHAT_BUBBLE_TYPE: {
|
|
4
|
+
readonly user: "user";
|
|
5
|
+
readonly bot: "bot";
|
|
6
|
+
readonly retry: "retry";
|
|
7
|
+
readonly button: "button";
|
|
8
|
+
};
|
|
9
|
+
export declare const CHAT_BUBBLE_POSITION: {
|
|
10
|
+
readonly first: "first";
|
|
11
|
+
readonly middle: "middle";
|
|
12
|
+
readonly last: "last";
|
|
13
|
+
};
|
|
14
|
+
export type ChatBubbleType = (typeof CHAT_BUBBLE_TYPE)[keyof typeof CHAT_BUBBLE_TYPE];
|
|
15
|
+
export type BubblePosition = (typeof CHAT_BUBBLE_POSITION)[keyof typeof CHAT_BUBBLE_POSITION];
|
|
16
|
+
type BaseBubbleProps = {
|
|
17
|
+
/** Content to render inside the bubble */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/** Animation entrance delay in milliseconds (0–300, snapped to nearest 50ms) */
|
|
20
|
+
animationDelay?: number;
|
|
21
|
+
};
|
|
22
|
+
export type BpkChatBubbleProps = (BaseBubbleProps & {
|
|
23
|
+
type: 'user';
|
|
24
|
+
/** Position within a sequence of user bubbles, affects border-radius */
|
|
25
|
+
userPosition?: BubblePosition;
|
|
26
|
+
}) | (BaseBubbleProps & {
|
|
27
|
+
type: 'bot';
|
|
28
|
+
/** Position within a sequence of same-sender bubbles, affects border-radius */
|
|
29
|
+
systemPosition?: BubblePosition;
|
|
30
|
+
/** Show thumbs up/down feedback buttons */
|
|
31
|
+
showFeedback?: boolean;
|
|
32
|
+
/** Currently selected feedback type */
|
|
33
|
+
selectedFeedback?: ThumbsButtonType | null;
|
|
34
|
+
/** Called when a feedback thumb button is clicked */
|
|
35
|
+
onFeedbackClick?: (type: ThumbsButtonType) => void;
|
|
36
|
+
/** Accessibility label for the thumbs up button (defaults to "Rate as useful") */
|
|
37
|
+
thumbsUpLabel?: string;
|
|
38
|
+
/** Accessibility label for the thumbs down button (defaults to "Rate as not useful") */
|
|
39
|
+
thumbsDownLabel?: string;
|
|
40
|
+
}) | (BaseBubbleProps & {
|
|
41
|
+
type: 'retry';
|
|
42
|
+
/** Position within a sequence of same-sender bubbles, affects border-radius */
|
|
43
|
+
systemPosition?: BubblePosition;
|
|
44
|
+
/** Label for the retry button */
|
|
45
|
+
retryLabel: string;
|
|
46
|
+
/** Called when retry button is clicked */
|
|
47
|
+
onRetry?: () => void;
|
|
48
|
+
/** Whether the retry button is disabled */
|
|
49
|
+
retryDisabled?: boolean;
|
|
50
|
+
}) | (BaseBubbleProps & {
|
|
51
|
+
type: 'button';
|
|
52
|
+
/** Called when the suggestion is clicked */
|
|
53
|
+
onSuggestionClick?: () => void;
|
|
54
|
+
});
|
|
55
|
+
export {};
|
|
@@ -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
|
+
export const CHAT_BUBBLE_TYPE = {
|
|
20
|
+
user: 'user',
|
|
21
|
+
bot: 'bot',
|
|
22
|
+
retry: 'retry',
|
|
23
|
+
button: 'button'
|
|
24
|
+
};
|
|
25
|
+
export const CHAT_BUBBLE_POSITION = {
|
|
26
|
+
first: 'first',
|
|
27
|
+
middle: 'middle',
|
|
28
|
+
last: 'last'
|
|
29
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import BpkChatbotInput from './src/BpkChatbotInput';
|
|
2
|
+
export type { BpkChatbotInputProps } from './src/common-types';
|
|
3
|
+
export { CHATBOT_INPUT_TYPES } from './src/common-types';
|
|
4
|
+
export type { ChatbotInputType } from './src/common-types';
|
|
5
|
+
export { useChatbotInputManager } from './src/hooks';
|
|
6
|
+
export { default as themeAttributes } from './src/themeAttributes';
|
|
7
|
+
export default BpkChatbotInput;
|
|
@@ -0,0 +1,23 @@
|
|
|
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 BpkChatbotInput from "./src/BpkChatbotInput";
|
|
20
|
+
export { CHATBOT_INPUT_TYPES } from "./src/common-types";
|
|
21
|
+
export { useChatbotInputManager } from "./src/hooks";
|
|
22
|
+
export { default as themeAttributes } from "./src/themeAttributes";
|
|
23
|
+
export default BpkChatbotInput;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BpkChatbotInputProps } from './common-types';
|
|
2
|
+
export type { BpkChatbotInputProps };
|
|
3
|
+
declare const BpkChatbotInput: ({ inputType, inputValue, isPolling, isSending, loadingAriaLabel, maxCharacters, onInputBlur, onInputChange, onInputClick, onInputFocus, onKeyDown, onSubmit, placeholder, sendAriaLabel, }: BpkChatbotInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default BpkChatbotInput;
|