@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,118 @@
|
|
|
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 STYLES from "./BpkInsetBannerV3.module.css";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
const getClassName = cssModules(STYLES);
|
|
24
|
+
const Body = ({
|
|
25
|
+
backgroundColor,
|
|
26
|
+
bleed,
|
|
27
|
+
children
|
|
28
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
29
|
+
...getDataComponentAttribute('InsetBannerV3.Body'),
|
|
30
|
+
className: getClassName('bpk-inset-banner-v3__body', bleed && 'bpk-inset-banner-v3__body--bleed'),
|
|
31
|
+
style: backgroundColor ? {
|
|
32
|
+
backgroundColor
|
|
33
|
+
} : undefined,
|
|
34
|
+
children: children
|
|
35
|
+
});
|
|
36
|
+
Body.displayName = 'BpkInsetBannerV3.Body';
|
|
37
|
+
const Root = /*#__PURE__*/forwardRef(({
|
|
38
|
+
backgroundColor,
|
|
39
|
+
children,
|
|
40
|
+
textVariant = 'on-light',
|
|
41
|
+
...rest
|
|
42
|
+
}, ref) => /*#__PURE__*/_jsx("div", {
|
|
43
|
+
ref: ref,
|
|
44
|
+
...getDataComponentAttribute('InsetBannerV3'),
|
|
45
|
+
...rest,
|
|
46
|
+
className: getClassName('bpk-inset-banner-v3', `bpk-inset-banner-v3--${textVariant}`),
|
|
47
|
+
style: backgroundColor ? {
|
|
48
|
+
backgroundColor
|
|
49
|
+
} : undefined,
|
|
50
|
+
children: children
|
|
51
|
+
}));
|
|
52
|
+
Root.displayName = 'BpkInsetBannerV3.Root';
|
|
53
|
+
const Header = ({
|
|
54
|
+
children,
|
|
55
|
+
layout
|
|
56
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
57
|
+
...getDataComponentAttribute('InsetBannerV3.Header'),
|
|
58
|
+
className: getClassName('bpk-inset-banner-v3__header', layout === 'horizontal' && 'bpk-inset-banner-v3__header--horizontal', layout === 'vertical' && 'bpk-inset-banner-v3__header--vertical'),
|
|
59
|
+
children: children
|
|
60
|
+
});
|
|
61
|
+
Header.displayName = 'BpkInsetBannerV3.Header';
|
|
62
|
+
const LeadingAccessory = ({
|
|
63
|
+
children
|
|
64
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
65
|
+
...getDataComponentAttribute('InsetBannerV3.LeadingAccessory'),
|
|
66
|
+
className: getClassName('bpk-inset-banner-v3__leading-accessory'),
|
|
67
|
+
children: children
|
|
68
|
+
});
|
|
69
|
+
LeadingAccessory.displayName = 'BpkInsetBannerV3.LeadingAccessory';
|
|
70
|
+
const Content = ({
|
|
71
|
+
children
|
|
72
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
73
|
+
...getDataComponentAttribute('InsetBannerV3.Content'),
|
|
74
|
+
className: getClassName('bpk-inset-banner-v3__content'),
|
|
75
|
+
children: children
|
|
76
|
+
});
|
|
77
|
+
Content.displayName = 'BpkInsetBannerV3.Content';
|
|
78
|
+
const TrailingAccessory = /*#__PURE__*/forwardRef((props, ref) => {
|
|
79
|
+
if ('onClick' in props && props.onClick) {
|
|
80
|
+
const {
|
|
81
|
+
'aria-label': ariaLabel,
|
|
82
|
+
children,
|
|
83
|
+
onClick,
|
|
84
|
+
...rest
|
|
85
|
+
} = props;
|
|
86
|
+
return /*#__PURE__*/_jsx("button", {
|
|
87
|
+
ref: ref,
|
|
88
|
+
type: "button",
|
|
89
|
+
"aria-label": ariaLabel,
|
|
90
|
+
...rest,
|
|
91
|
+
...getDataComponentAttribute('InsetBannerV3.TrailingAccessory'),
|
|
92
|
+
className: getClassName('bpk-inset-banner-v3__trailing-accessory', 'bpk-inset-banner-v3__trailing-accessory--interactive'),
|
|
93
|
+
onClick: onClick,
|
|
94
|
+
children: children
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
const {
|
|
98
|
+
children,
|
|
99
|
+
...rest
|
|
100
|
+
} = props;
|
|
101
|
+
return /*#__PURE__*/_jsx("div", {
|
|
102
|
+
ref: ref,
|
|
103
|
+
...rest,
|
|
104
|
+
...getDataComponentAttribute('InsetBannerV3.TrailingAccessory'),
|
|
105
|
+
className: getClassName('bpk-inset-banner-v3__trailing-accessory'),
|
|
106
|
+
children: children
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
TrailingAccessory.displayName = 'BpkInsetBannerV3.TrailingAccessory';
|
|
110
|
+
const BpkInsetBannerV3 = {
|
|
111
|
+
Root,
|
|
112
|
+
Header,
|
|
113
|
+
LeadingAccessory,
|
|
114
|
+
Content,
|
|
115
|
+
Body,
|
|
116
|
+
TrailingAccessory
|
|
117
|
+
};
|
|
118
|
+
export default BpkInsetBannerV3;
|
|
@@ -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-inset-banner-v3{border-radius:.5rem;overflow:hidden;container-type:inline-size}.bpk-inset-banner-v3--on-light{color:#161616;fill:#161616}.bpk-inset-banner-v3--on-dark{color:#fff;fill:#fff}.bpk-inset-banner-v3__header{display:grid;padding:.5rem 1rem;grid-template-columns:auto 1fr auto;grid-template-areas:"leading content trailing";align-items:center;gap:1rem}@container (max-width: 25rem){.bpk-inset-banner-v3__header{grid-template-columns:1fr auto;grid-template-areas:"leading trailing" "content content";gap:.25rem}.bpk-inset-banner-v3__header--horizontal{grid-template-columns:auto 1fr auto;grid-template-areas:"leading content trailing";align-items:center;gap:1rem}}.bpk-inset-banner-v3__header--vertical{grid-template-columns:1fr auto;grid-template-areas:"leading trailing" "content content";gap:.25rem}.bpk-inset-banner-v3__leading-accessory{display:flex;grid-area:leading;align-items:center}.bpk-inset-banner-v3__content{display:flex;min-width:0;grid-area:content;flex-direction:column;word-wrap:break-word}.bpk-inset-banner-v3__trailing-accessory{display:flex;grid-area:trailing;align-items:center}@container (max-width: 25rem){.bpk-inset-banner-v3__trailing-accessory{align-self:flex-start}}.bpk-inset-banner-v3__header--horizontal>.bpk-inset-banner-v3__trailing-accessory{align-self:center}.bpk-inset-banner-v3__trailing-accessory--interactive{padding:0;border:none;background:none;color:inherit;cursor:pointer;position:relative}.bpk-inset-banner-v3__trailing-accessory--interactive::before{position:absolute;top:calc(-2.75rem/2 + 50%);left:calc(-2.75rem/2 + 50%);content:"";width:2.75rem;height:2.75rem}.bpk-inset-banner-v3__trailing-accessory--interactive:focus-visible{outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-inset-banner-v3__body{padding:1rem}.bpk-inset-banner-v3__body--bleed{padding:0}
|
|
@@ -3,12 +3,17 @@ export interface BpkProviderProps {
|
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
* BpkProvider - Provides
|
|
6
|
+
* BpkProvider - Provides context for Backpack layout and Ark-based components.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Wraps children with:
|
|
9
|
+
* - Chakra UI system context (for layout components: BpkFlex, BpkGrid, etc.)
|
|
10
|
+
* - Ark UI LocaleProvider (for Ark-based components: BpkCheckboxV2, BpkSegmentedControlV2, etc.)
|
|
11
|
+
*
|
|
12
|
+
* RTL support: reads document direction reactively via MutationObserver and passes
|
|
13
|
+
* the appropriate locale to Ark's LocaleProvider. All Ark-based components in the
|
|
14
|
+
* tree render correctly in RTL without requiring additional wrapping or prop changes.
|
|
10
15
|
*
|
|
11
16
|
* @param {BpkProviderProps} props - The provider props.
|
|
12
|
-
* @returns {JSX.Element} The provider wrapping its children with Chakra context.
|
|
17
|
+
* @returns {JSX.Element} The provider wrapping its children with Chakra and Ark context.
|
|
13
18
|
*/
|
|
14
19
|
export declare const BpkProvider: ({ children }: BpkProviderProps) => JSX.Element;
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { useEffect, useState } from 'react';
|
|
20
|
+
import { LocaleProvider } from '@ark-ui/react';
|
|
19
21
|
import { ChakraProvider, createSystem, defaultConfig } from '@chakra-ui/react';
|
|
20
22
|
import { createBpkConfig } from "./theme";
|
|
21
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -29,19 +31,96 @@ const {
|
|
|
29
31
|
...defaultConfigWithoutGlobalCss
|
|
30
32
|
} = defaultConfig;
|
|
31
33
|
const bpkSystem = createSystem(defaultConfigWithoutGlobalCss, createBpkConfig());
|
|
34
|
+
// Fallback locale mapping used when no explicit locale is available on the document.
|
|
35
|
+
// Maps DOM direction to minimal BCP 47 locales understood by Ark's isRTL() utility.
|
|
36
|
+
// 'ar-SA' is the minimal RTL locale — Ark only uses it to derive dir='rtl'.
|
|
37
|
+
const FALLBACK_LOCALE_BY_DIRECTION = {
|
|
38
|
+
ltr: 'en-US',
|
|
39
|
+
rtl: 'ar-SA'
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Known RTL language subtags (ISO 639 codes). Used as fallback when
|
|
43
|
+
// Intl.Locale.textInfo is unavailable (Node < 22, older browsers).
|
|
44
|
+
const RTL_LANGUAGE_SUBTAGS = new Set(['ar', 'he', 'fa', 'ur', 'yi', 'iw', 'ps', 'sd', 'ug', 'ku']);
|
|
45
|
+
|
|
46
|
+
// Returns the text direction implied by a BCP 47 locale string.
|
|
47
|
+
// Uses Intl.Locale.textInfo when available (Chrome 99+, Safari 15.4+, Firefox 126+, Node 22+);
|
|
48
|
+
// falls back to a known-RTL-subtag lookup.
|
|
49
|
+
const getLangDir = locale => {
|
|
50
|
+
try {
|
|
51
|
+
const dir = new Intl.Locale(locale).textInfo?.direction;
|
|
52
|
+
if (dir) return dir === 'rtl' ? 'rtl' : 'ltr';
|
|
53
|
+
} catch {
|
|
54
|
+
// Ignore invalid locale strings
|
|
55
|
+
}
|
|
56
|
+
return RTL_LANGUAGE_SUBTAGS.has(locale.split('-')[0].toLowerCase()) ? 'rtl' : 'ltr';
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// Resolves the locale to pass to Ark's LocaleProvider.
|
|
60
|
+
//
|
|
61
|
+
// Priority rules:
|
|
62
|
+
// 1. If html[dir] is explicitly set:
|
|
63
|
+
// - Use html[lang] only when its direction is consistent with html[dir].
|
|
64
|
+
// - Otherwise fall back to FALLBACK_LOCALE_BY_DIRECTION[dir].
|
|
65
|
+
// This prevents an LTR html[lang] (e.g. 'en' from a page template) from
|
|
66
|
+
// overriding an explicit html[dir]="rtl" signal (e.g. from a dev RTL toggle).
|
|
67
|
+
// 2. If html[dir] is not set: use html[lang] if present, else 'en-US'.
|
|
68
|
+
//
|
|
69
|
+
// SSR-safe: returns 'en-US' when document is unavailable.
|
|
70
|
+
const getArkLocale = () => {
|
|
71
|
+
if (typeof document === 'undefined') return 'en-US';
|
|
72
|
+
const explicitDir = document.documentElement.getAttribute('dir');
|
|
73
|
+
const lang = document.documentElement.getAttribute('lang');
|
|
74
|
+
if (explicitDir === 'rtl' || explicitDir === 'ltr') {
|
|
75
|
+
if (lang && getLangDir(lang) === explicitDir) return lang;
|
|
76
|
+
return FALLBACK_LOCALE_BY_DIRECTION[explicitDir];
|
|
77
|
+
}
|
|
78
|
+
return lang || 'en-US';
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// Reactive hook: subscribes to document.documentElement[dir] and [lang] changes
|
|
82
|
+
// via MutationObserver. Re-renders BpkProvider when direction or locale is toggled
|
|
83
|
+
// (e.g. Storybook RTL toolbar, runtime locale switcher).
|
|
84
|
+
// SSR-safe: always initialises to 'en-US' so server and client agree on the first render,
|
|
85
|
+
// avoiding hydration mismatches. The real locale is read inside useEffect,
|
|
86
|
+
// which does not run on the server.
|
|
87
|
+
const useArkLocale = () => {
|
|
88
|
+
const [locale, setLocale] = useState('en-US');
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
setLocale(getArkLocale());
|
|
91
|
+
const observer = new MutationObserver(() => setLocale(getArkLocale()));
|
|
92
|
+
observer.observe(document.documentElement, {
|
|
93
|
+
attributes: true,
|
|
94
|
+
attributeFilter: ['dir', 'lang']
|
|
95
|
+
});
|
|
96
|
+
return () => observer.disconnect();
|
|
97
|
+
}, []);
|
|
98
|
+
return locale;
|
|
99
|
+
};
|
|
32
100
|
|
|
33
101
|
/**
|
|
34
|
-
* BpkProvider - Provides
|
|
102
|
+
* BpkProvider - Provides context for Backpack layout and Ark-based components.
|
|
103
|
+
*
|
|
104
|
+
* Wraps children with:
|
|
105
|
+
* - Chakra UI system context (for layout components: BpkFlex, BpkGrid, etc.)
|
|
106
|
+
* - Ark UI LocaleProvider (for Ark-based components: BpkCheckboxV2, BpkSegmentedControlV2, etc.)
|
|
35
107
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
108
|
+
* RTL support: reads document direction reactively via MutationObserver and passes
|
|
109
|
+
* the appropriate locale to Ark's LocaleProvider. All Ark-based components in the
|
|
110
|
+
* tree render correctly in RTL without requiring additional wrapping or prop changes.
|
|
38
111
|
*
|
|
39
112
|
* @param {BpkProviderProps} props - The provider props.
|
|
40
|
-
* @returns {JSX.Element} The provider wrapping its children with Chakra context.
|
|
113
|
+
* @returns {JSX.Element} The provider wrapping its children with Chakra and Ark context.
|
|
41
114
|
*/
|
|
42
115
|
export const BpkProvider = ({
|
|
43
116
|
children
|
|
44
|
-
}) =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
117
|
+
}) => {
|
|
118
|
+
const locale = useArkLocale();
|
|
119
|
+
return /*#__PURE__*/_jsx(ChakraProvider, {
|
|
120
|
+
value: bpkSystem,
|
|
121
|
+
children: /*#__PURE__*/_jsx(LocaleProvider, {
|
|
122
|
+
locale: locale,
|
|
123
|
+
children: children
|
|
124
|
+
})
|
|
125
|
+
});
|
|
126
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import type StackOptionKeys from './BpkStack.constant';
|
|
3
3
|
import type { BpkCommonLayoutProps } from './commonProps';
|
|
4
4
|
import type { BpkSpacingValue, BpkResponsiveValue, BpkBasisValue } from './tokens';
|
|
@@ -144,7 +144,7 @@ export type VesselElement = 'div' | 'span' | 'section' | 'article' | 'nav' | 'ma
|
|
|
144
144
|
*/
|
|
145
145
|
export type BpkVesselProps = {
|
|
146
146
|
as?: VesselElement;
|
|
147
|
-
} &
|
|
147
|
+
} & HTMLAttributes<HTMLElement>;
|
|
148
148
|
/**
|
|
149
149
|
* Component-specific props for BpkFlex
|
|
150
150
|
* Includes all Flex props except those in BpkCommonLayoutProps
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef, ElementType, ReactNode, Ref } from 'react';
|
|
1
|
+
import type { ComponentPropsWithoutRef, ElementType, JSX, ReactNode, Ref } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Polymorphic component types following Chakra UI pattern.
|
|
4
4
|
* Allows BpkLink to be rendered as different HTML elements while
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import BpkModal from './src/BpkModal';
|
|
2
2
|
import { MODAL_STYLING } from './src/BpkModalInner';
|
|
3
3
|
import { BpkModalV2 } from './src/BpkModalV2/BpkModal';
|
|
4
|
+
import BpkModalV3 from './src/BpkModalV3/BpkModalV3';
|
|
5
|
+
import { MODAL_V3_TYPES } from './src/BpkModalV3/common-types';
|
|
4
6
|
import { propTypes, defaultProps } from './src/legacy-prop-types';
|
|
5
7
|
import themeAttributes from './src/themeAttributes';
|
|
6
8
|
import type { Props } from './src/BpkModal';
|
|
7
9
|
export type BpkModalProps = Props;
|
|
8
10
|
export default BpkModal;
|
|
9
|
-
export { propTypes, defaultProps, themeAttributes, BpkModalV2, MODAL_STYLING };
|
|
11
|
+
export { propTypes, defaultProps, themeAttributes, BpkModalV2, BpkModalV3, MODAL_V3_TYPES, MODAL_STYLING, };
|
|
@@ -19,8 +19,10 @@
|
|
|
19
19
|
import BpkModal from "./src/BpkModal";
|
|
20
20
|
import { MODAL_STYLING } from "./src/BpkModalInner";
|
|
21
21
|
import { BpkModalV2 } from "./src/BpkModalV2/BpkModal";
|
|
22
|
+
import BpkModalV3 from "./src/BpkModalV3/BpkModalV3";
|
|
23
|
+
import { MODAL_V3_TYPES } from "./src/BpkModalV3/common-types";
|
|
22
24
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
23
25
|
import { propTypes, defaultProps } from "./src/legacy-prop-types";
|
|
24
26
|
import themeAttributes from "./src/themeAttributes";
|
|
25
27
|
export default BpkModal;
|
|
26
|
-
export { propTypes, defaultProps, themeAttributes, BpkModalV2, MODAL_STYLING };
|
|
28
|
+
export { propTypes, defaultProps, themeAttributes, BpkModalV2, BpkModalV3, MODAL_V3_TYPES, MODAL_STYLING };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const BpkModalV3: {
|
|
2
|
+
Root: ({ children, onOpenChange, open, type, }: import("./BpkModalV3Root/BpkModalV3Root").BpkModalV3RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
Trigger: ({ asChild, children, }: import("./BpkModalV3Trigger/BpkModalV3Trigger").BpkModalV3TriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
Portal: ({ children }: import("./BpkModalV3Portal/BpkModalV3Portal").BpkModalV3PortalProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
Scrim: () => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Content: ({ children }: import("./BpkModalV3Content/BpkModalV3Content").BpkModalV3ContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
Header: ({ children }: import("./BpkModalV3Header/BpkModalV3Header").BpkModalV3HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
Title: ({ children }: import("./BpkModalV3Title/BpkModalV3Title").BpkModalV3TitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
Description: ({ children }: import("./BpkModalV3Description/BpkModalV3Description").BpkModalV3DescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
Body: ({ children }: import("./BpkModalV3Body/BpkModalV3Body").BpkModalV3BodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
HeroImage: ({ alt, children, height, src, }: import("./BpkModalV3HeroImage/BpkModalV3HeroImage").BpkModalV3HeroImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
CloseTrigger: ({ label, onImage, }: import("./BpkModalV3CloseTrigger/BpkModalV3CloseTrigger").BpkModalV3CloseTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
export default BpkModalV3;
|
|
@@ -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 BpkModalV3Body from "./BpkModalV3Body/BpkModalV3Body";
|
|
20
|
+
import BpkModalV3CloseTrigger from "./BpkModalV3CloseTrigger/BpkModalV3CloseTrigger";
|
|
21
|
+
import BpkModalV3Content from "./BpkModalV3Content/BpkModalV3Content";
|
|
22
|
+
import BpkModalV3Description from "./BpkModalV3Description/BpkModalV3Description";
|
|
23
|
+
import BpkModalV3Header from "./BpkModalV3Header/BpkModalV3Header";
|
|
24
|
+
import BpkModalV3HeroImage from "./BpkModalV3HeroImage/BpkModalV3HeroImage";
|
|
25
|
+
import BpkModalV3Portal from "./BpkModalV3Portal/BpkModalV3Portal";
|
|
26
|
+
import BpkModalV3Root from "./BpkModalV3Root/BpkModalV3Root";
|
|
27
|
+
import BpkModalV3Scrim from "./BpkModalV3Scrim/BpkModalV3Scrim";
|
|
28
|
+
import BpkModalV3Title from "./BpkModalV3Title/BpkModalV3Title";
|
|
29
|
+
import BpkModalV3Trigger from "./BpkModalV3Trigger/BpkModalV3Trigger";
|
|
30
|
+
const BpkModalV3 = {
|
|
31
|
+
Root: BpkModalV3Root,
|
|
32
|
+
Trigger: BpkModalV3Trigger,
|
|
33
|
+
Portal: BpkModalV3Portal,
|
|
34
|
+
Scrim: BpkModalV3Scrim,
|
|
35
|
+
Content: BpkModalV3Content,
|
|
36
|
+
Header: BpkModalV3Header,
|
|
37
|
+
Title: BpkModalV3Title,
|
|
38
|
+
Description: BpkModalV3Description,
|
|
39
|
+
Body: BpkModalV3Body,
|
|
40
|
+
HeroImage: BpkModalV3HeroImage,
|
|
41
|
+
CloseTrigger: BpkModalV3CloseTrigger
|
|
42
|
+
};
|
|
43
|
+
export default BpkModalV3;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
type BpkModalV3BodyProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const BpkModalV3Body: ({ children }: BpkModalV3BodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default BpkModalV3Body;
|
|
7
|
+
export type { BpkModalV3BodyProps };
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { cssModules, getDataComponentAttribute } from "../../../../bpk-react-utils";
|
|
20
|
+
import STYLES from "./BpkModalV3Body.module.css";
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
const getClassName = cssModules(STYLES);
|
|
23
|
+
const BpkModalV3Body = ({
|
|
24
|
+
children
|
|
25
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
26
|
+
className: getClassName('bpk-modal-v3__body'),
|
|
27
|
+
...getDataComponentAttribute('ModalV3Body'),
|
|
28
|
+
children: children
|
|
29
|
+
});
|
|
30
|
+
export default BpkModalV3Body;
|
|
@@ -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-modal-v3__body{flex:1;overflow-y:auto;overscroll-behavior:contain}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type BpkModalV3CloseTriggerProps = {
|
|
2
|
+
label: string;
|
|
3
|
+
onImage?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const BpkModalV3CloseTrigger: ({ label, onImage, }: BpkModalV3CloseTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default BpkModalV3CloseTrigger;
|
|
7
|
+
export type { BpkModalV3CloseTriggerProps };
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { Dialog } from '@ark-ui/react';
|
|
20
|
+
|
|
21
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
22
|
+
import BpkCloseButton from "../../../../bpk-component-close-button";
|
|
23
|
+
import CloseIcon from "../../../../bpk-component-icon/sm/close";
|
|
24
|
+
import { cssModules, getDataComponentAttribute } from "../../../../bpk-react-utils";
|
|
25
|
+
import STYLES from "./BpkModalV3CloseTrigger.module.css";
|
|
26
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
|
+
const getClassName = cssModules(STYLES);
|
|
28
|
+
const BpkModalV3CloseTrigger = ({
|
|
29
|
+
label,
|
|
30
|
+
onImage = false
|
|
31
|
+
}) => {
|
|
32
|
+
if (onImage) {
|
|
33
|
+
return /*#__PURE__*/_jsx(Dialog.CloseTrigger, {
|
|
34
|
+
className: getClassName('bpk-modal-v3__close-trigger--on-image'),
|
|
35
|
+
"aria-label": label,
|
|
36
|
+
...getDataComponentAttribute('ModalV3CloseTrigger'),
|
|
37
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return /*#__PURE__*/_jsx(Dialog.CloseTrigger, {
|
|
41
|
+
asChild: true,
|
|
42
|
+
children: /*#__PURE__*/_jsx(BpkCloseButton, {
|
|
43
|
+
label: label,
|
|
44
|
+
onClick: () => {},
|
|
45
|
+
...getDataComponentAttribute('ModalV3CloseTrigger')
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export default BpkModalV3CloseTrigger;
|
package/bpk-component-modal/src/BpkModalV3/BpkModalV3CloseTrigger/BpkModalV3CloseTrigger.module.css
ADDED
|
@@ -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-modal-v3__close-trigger--on-image{position:absolute;top:1rem;display:flex;width:2.5rem;height:2.5rem;padding:.75rem;justify-content:center;align-items:center;flex-shrink:0;border:none;border-radius:1.5rem;outline:none;background-color:hsla(0,0%,100%,.5);color:#161616;cursor:pointer;inset-inline-end:1.5rem}.bpk-modal-v3__close-trigger--on-image:focus-visible{outline:.125rem solid #0062e3;outline-offset:.125rem}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
type BpkModalV3ContentProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const BpkModalV3Content: ({ children }: BpkModalV3ContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default BpkModalV3Content;
|
|
7
|
+
export type { BpkModalV3ContentProps };
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { Dialog } from '@ark-ui/react';
|
|
20
|
+
import { cssModules, getDataComponentAttribute } from "../../../../bpk-react-utils";
|
|
21
|
+
import { useModalType } from "../BpkModalV3Context";
|
|
22
|
+
import STYLES from "./BpkModalV3Content.module.css";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
const getClassName = cssModules(STYLES);
|
|
25
|
+
const BpkModalV3Content = ({
|
|
26
|
+
children
|
|
27
|
+
}) => {
|
|
28
|
+
const type = useModalType();
|
|
29
|
+
return /*#__PURE__*/_jsx(Dialog.Positioner, {
|
|
30
|
+
className: getClassName('bpk-modal-v3__positioner', `bpk-modal-v3__positioner--${type}`),
|
|
31
|
+
children: /*#__PURE__*/_jsx(Dialog.Content, {
|
|
32
|
+
className: getClassName('bpk-modal-v3__content', `bpk-modal-v3__content--${type}`),
|
|
33
|
+
...getDataComponentAttribute('ModalV3Content'),
|
|
34
|
+
children: children
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export default BpkModalV3Content;
|
|
@@ -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-modal-v3__positioner{position:fixed;display:flex;z-index:1100;justify-content:center;align-items:center;inset:0;pointer-events:none}.bpk-modal-v3__positioner--sheet{align-items:flex-end}.bpk-modal-v3__positioner--full{align-items:stretch}.bpk-modal-v3__positioner--chatbot{align-items:stretch}.bpk-modal-v3__content{position:relative;display:flex;flex-direction:column;background-color:#fff;overflow:clip;pointer-events:none}.bpk-modal-v3__content[data-state=open]{pointer-events:auto}.bpk-modal-v3__content--default{width:100%;max-width:50rem;max-height:90vh;transform:scale(0.9);transition:transform 200ms ease-in-out;border-radius:1.5rem;opacity:0;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}@media(max-width: 32rem){.bpk-modal-v3__content--default{max-width:none;height:100%;max-height:none;transform:translateY(100%);border-radius:0;box-shadow:none}.bpk-modal-v3__content--default[data-state=open]{transform:translateY(0)}.bpk-modal-v3__content--default[data-state=closed]{transform:translateY(100%)}}.bpk-modal-v3__content--default[data-state=open]{transform:scale(1);opacity:1}.bpk-modal-v3__content--default[data-state=closed]{transform:scale(0.9);opacity:0}.bpk-modal-v3__content--sheet{width:100%;height:fit-content;max-height:100dvh;transform:translateY(100%);transition:opacity 400ms cubic-bezier(0.5, 0, 0, 1),transform 400ms cubic-bezier(0.5, 0, 0, 1);border-radius:1.5rem 1.5rem 0 0;opacity:0;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}.bpk-modal-v3__content--sheet[data-state=open]{transform:translateY(0);opacity:1}.bpk-modal-v3__content--sheet[data-state=closed]{transform:translateY(100%);opacity:0}.bpk-modal-v3__content--full{width:100%;height:100%;transform:translateY(100%);transition:opacity 400ms cubic-bezier(0.5, 0, 0, 1),transform 400ms cubic-bezier(0.5, 0, 0, 1);border-radius:0;opacity:0}.bpk-modal-v3__content--full[data-state=open]{transform:translateY(0);opacity:1}.bpk-modal-v3__content--full[data-state=closed]{transform:translateY(100%);opacity:0}.bpk-modal-v3__content--chatbot{width:100%;height:100%;transform:translateX(100%);transition:transform 400ms cubic-bezier(0.5, 0, 0, 1);border-radius:0;background-color:#eff3f8}html[dir=rtl] .bpk-modal-v3__content--chatbot{transform:translateX(-100%)}.bpk-modal-v3__content--chatbot[data-state=open]{transform:translateX(0)}html[dir=rtl] .bpk-modal-v3__content--chatbot[data-state=open]{transform:translateX(0)}.bpk-modal-v3__content--chatbot[data-state=closed]{transform:translateX(100%)}html[dir=rtl] .bpk-modal-v3__content--chatbot[data-state=closed]{transform:translateX(-100%)}@media(prefers-reduced-motion: reduce){.bpk-modal-v3__content--default{transform:scale(1);transition:none;opacity:1}}@media(prefers-reduced-motion: reduce)and (max-width: 32rem){.bpk-modal-v3__content--default{transform:translateY(0)}}@media(prefers-reduced-motion: reduce){.bpk-modal-v3__content--sheet,.bpk-modal-v3__content--full{transform:translateY(0);transition:none;opacity:1}.bpk-modal-v3__content--chatbot{transform:translateX(0);transition:none;opacity:1}html[dir=rtl] .bpk-modal-v3__content--chatbot{transform:translateX(0)}}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { createContext, useContext } from 'react';
|
|
20
|
+
const BpkModalV3Context = /*#__PURE__*/createContext('default');
|
|
21
|
+
export const useModalType = () => useContext(BpkModalV3Context);
|
|
22
|
+
export const ModalTypeProvider = BpkModalV3Context.Provider;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
type BpkModalV3DescriptionProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const BpkModalV3Description: ({ children }: BpkModalV3DescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default BpkModalV3Description;
|
|
7
|
+
export type { BpkModalV3DescriptionProps };
|