@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.
Files changed (158) hide show
  1. package/bpk-component-banner-alert/src/BpkBannerAlert.js +0 -7
  2. package/bpk-component-breakpoint/src/BpkBreakpoint.js +3 -1
  3. package/bpk-component-calendar/src/utils.js +1 -1
  4. package/bpk-component-card/index.d.ts +4 -1
  5. package/bpk-component-card/index.js +3 -1
  6. package/bpk-component-card/src/BpkCardV2/BpkCardV2.d.ts +27 -0
  7. package/bpk-component-card/src/BpkCardV2/BpkCardV2.js +57 -0
  8. package/bpk-component-card/src/BpkCardV2/BpkCardV2.module.css +18 -0
  9. package/bpk-component-card/src/BpkCardV2/common-types.d.ts +124 -0
  10. package/bpk-component-card/src/BpkCardV2/common-types.js +102 -0
  11. package/bpk-component-card/src/BpkCardV2/subcomponents/Body.d.ts +36 -0
  12. package/bpk-component-card/src/BpkCardV2/subcomponents/Body.js +65 -0
  13. package/bpk-component-card/src/BpkCardV2/subcomponents/Divider.d.ts +13 -0
  14. package/bpk-component-card/src/BpkCardV2/subcomponents/Divider.js +37 -0
  15. package/bpk-component-card/src/BpkCardV2/subcomponents/Footer.d.ts +24 -0
  16. package/bpk-component-card/src/BpkCardV2/subcomponents/Footer.js +60 -0
  17. package/bpk-component-card/src/BpkCardV2/subcomponents/Header.d.ts +24 -0
  18. package/bpk-component-card/src/BpkCardV2/subcomponents/Header.js +60 -0
  19. package/bpk-component-card/src/BpkCardV2/subcomponents/Root.d.ts +28 -0
  20. package/bpk-component-card/src/BpkCardV2/subcomponents/Root.js +68 -0
  21. package/bpk-component-card/src/BpkCardV2/subcomponents/Section.d.ts +22 -0
  22. package/bpk-component-card/src/BpkCardV2/subcomponents/Section.js +53 -0
  23. package/bpk-component-card/src/BpkCardV2/subcomponents/resolveDirectionalPadding.d.ts +16 -0
  24. package/bpk-component-card/src/BpkCardV2/subcomponents/resolveDirectionalPadding.js +32 -0
  25. package/bpk-component-card-list/src/BpkCardList.module.css +1 -1
  26. package/bpk-component-card-list/src/BpkCardListRowRail/BpkCardListCarousel.js +3 -3
  27. package/bpk-component-chat-bubble/index.d.ts +4 -0
  28. package/bpk-component-chat-bubble/index.js +21 -0
  29. package/bpk-component-chat-bubble/src/BpkChatBubble.d.ts +3 -0
  30. package/bpk-component-chat-bubble/src/BpkChatBubble.js +107 -0
  31. package/bpk-component-chat-bubble/src/BpkChatBubble.module.css +18 -0
  32. package/bpk-component-chat-bubble/src/common-types.d.ts +55 -0
  33. package/bpk-component-chat-bubble/src/common-types.js +29 -0
  34. package/bpk-component-chatbot-input/index.d.ts +7 -0
  35. package/bpk-component-chatbot-input/index.js +23 -0
  36. package/bpk-component-chatbot-input/src/BpkChatbotInput.d.ts +4 -0
  37. package/bpk-component-chatbot-input/src/BpkChatbotInput.js +118 -0
  38. package/bpk-component-chatbot-input/src/BpkChatbotInput.module.css +18 -0
  39. package/bpk-component-chatbot-input/src/InputField/InputField.d.ts +3 -0
  40. package/bpk-component-chatbot-input/src/InputField/InputField.js +82 -0
  41. package/bpk-component-chatbot-input/src/InputField/InputField.module.css +18 -0
  42. package/bpk-component-chatbot-input/src/SendButton/SendButton.d.ts +9 -0
  43. package/bpk-component-chatbot-input/src/SendButton/SendButton.js +47 -0
  44. package/bpk-component-chatbot-input/src/TextAreaField/TextAreaField.d.ts +10 -0
  45. package/bpk-component-chatbot-input/src/TextAreaField/TextAreaField.js +93 -0
  46. package/bpk-component-chatbot-input/src/TextAreaField/TextAreaField.module.css +18 -0
  47. package/bpk-component-chatbot-input/src/common-types.d.ts +37 -0
  48. package/bpk-component-chatbot-input/src/common-types.js +23 -0
  49. package/bpk-component-chatbot-input/src/constants.d.ts +5 -0
  50. package/bpk-component-chatbot-input/src/constants.js +22 -0
  51. package/bpk-component-chatbot-input/src/hooks/index.d.ts +4 -0
  52. package/bpk-component-chatbot-input/src/hooks/index.js +22 -0
  53. package/bpk-component-chatbot-input/src/hooks/useChatbotInput.d.ts +32 -0
  54. package/bpk-component-chatbot-input/src/hooks/useChatbotInput.js +111 -0
  55. package/bpk-component-chatbot-input/src/hooks/useChatbotInputManager.d.ts +20 -0
  56. package/bpk-component-chatbot-input/src/hooks/useChatbotInputManager.js +83 -0
  57. package/bpk-component-chatbot-input/src/hooks/useInputHandlers.d.ts +8 -0
  58. package/bpk-component-chatbot-input/src/hooks/useInputHandlers.js +54 -0
  59. package/bpk-component-chatbot-input/src/hooks/useTextAreaAutoResize.d.ts +22 -0
  60. package/bpk-component-chatbot-input/src/hooks/useTextAreaAutoResize.js +137 -0
  61. package/bpk-component-chatbot-input/src/themeAttributes.d.ts +14 -0
  62. package/bpk-component-chatbot-input/src/themeAttributes.js +34 -0
  63. package/bpk-component-checkbox/index.d.ts +8 -8
  64. package/bpk-component-checkbox/index.js +3 -3
  65. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2.d.ts +9 -0
  66. package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckbox.js → BpkCheckboxV2.js} +14 -14
  67. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Control.d.ts +6 -0
  68. package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxControl.js → BpkCheckboxV2Control.js} +3 -3
  69. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Description.d.ts +6 -0
  70. package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxDescription.js → BpkCheckboxV2Description.js} +3 -3
  71. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2HiddenInput.d.ts +2 -0
  72. package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxHiddenInput.js → BpkCheckboxV2HiddenInput.js} +2 -2
  73. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Indicator.d.ts +2 -0
  74. package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxIndicator.js → BpkCheckboxV2Indicator.js} +3 -3
  75. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Label.d.ts +6 -0
  76. package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxLabel.js → BpkCheckboxV2Label.js} +3 -3
  77. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Root.d.ts +16 -0
  78. package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxRoot.js → BpkCheckboxV2Root.js} +3 -3
  79. package/bpk-component-checkbox-card/src/BpkCheckboxCard.module.css +1 -1
  80. package/bpk-component-floating-notification/index.d.ts +2 -1
  81. package/bpk-component-floating-notification/index.js +2 -1
  82. package/bpk-component-floating-notification/src/BpkFloatingNotification.d.ts +5 -0
  83. package/bpk-component-floating-notification/src/BpkFloatingNotification.js +8 -2
  84. package/bpk-component-floating-notification/src/BpkFloatingNotification.module.css +1 -1
  85. package/bpk-component-icon/scripts/generate-figma-connect.js +267 -0
  86. package/bpk-component-info-banner/src/BpkInfoBanner.module.css +1 -1
  87. package/bpk-component-info-banner/src/BpkInfoBannerInner.js +8 -3
  88. package/bpk-component-info-banner/src/common-types.d.ts +1 -0
  89. package/bpk-component-info-banner/src/common-types.js +2 -1
  90. package/bpk-component-inset-banner/index.d.ts +4 -1
  91. package/bpk-component-inset-banner/index.js +2 -1
  92. package/bpk-component-inset-banner/src/BpkInsetBannerV3/BpkInsetBannerV3.d.ts +56 -0
  93. package/bpk-component-inset-banner/src/BpkInsetBannerV3/BpkInsetBannerV3.js +118 -0
  94. package/bpk-component-inset-banner/src/BpkInsetBannerV3/BpkInsetBannerV3.module.css +18 -0
  95. package/bpk-component-layout/src/BpkProvider.d.ts +9 -4
  96. package/bpk-component-layout/src/BpkProvider.js +87 -8
  97. package/bpk-component-layout/src/types.d.ts +2 -2
  98. package/bpk-component-link/src/common-types.d.ts +1 -1
  99. package/bpk-component-modal/index.d.ts +3 -1
  100. package/bpk-component-modal/index.js +3 -1
  101. package/bpk-component-modal/src/BpkModalV3/BpkModalV3.d.ts +14 -0
  102. package/bpk-component-modal/src/BpkModalV3/BpkModalV3.js +43 -0
  103. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Body/BpkModalV3Body.d.ts +7 -0
  104. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Body/BpkModalV3Body.js +30 -0
  105. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Body/BpkModalV3Body.module.css +18 -0
  106. package/bpk-component-modal/src/BpkModalV3/BpkModalV3CloseTrigger/BpkModalV3CloseTrigger.d.ts +7 -0
  107. package/bpk-component-modal/src/BpkModalV3/BpkModalV3CloseTrigger/BpkModalV3CloseTrigger.js +49 -0
  108. package/bpk-component-modal/src/BpkModalV3/BpkModalV3CloseTrigger/BpkModalV3CloseTrigger.module.css +18 -0
  109. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Content/BpkModalV3Content.d.ts +7 -0
  110. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Content/BpkModalV3Content.js +38 -0
  111. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Content/BpkModalV3Content.module.css +18 -0
  112. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Context.d.ts +3 -0
  113. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Context.js +22 -0
  114. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Description/BpkModalV3Description.d.ts +7 -0
  115. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Description/BpkModalV3Description.js +28 -0
  116. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Header/BpkModalV3Header.d.ts +7 -0
  117. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Header/BpkModalV3Header.js +34 -0
  118. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Header/BpkModalV3Header.module.css +18 -0
  119. package/bpk-component-modal/src/BpkModalV3/BpkModalV3HeroImage/BpkModalV3HeroImage.d.ts +10 -0
  120. package/bpk-component-modal/src/BpkModalV3/BpkModalV3HeroImage/BpkModalV3HeroImage.js +44 -0
  121. package/bpk-component-modal/src/BpkModalV3/BpkModalV3HeroImage/BpkModalV3HeroImage.module.css +18 -0
  122. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Portal/BpkModalV3Portal.d.ts +7 -0
  123. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Portal/BpkModalV3Portal.js +26 -0
  124. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/BpkModalV3Root.d.ts +13 -0
  125. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/BpkModalV3Root.js +67 -0
  126. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/useBodyLock.d.ts +9 -0
  127. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/useBodyLock.js +69 -0
  128. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Scrim/BpkModalV3Scrim.d.ts +2 -0
  129. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Scrim/BpkModalV3Scrim.js +32 -0
  130. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Scrim/BpkModalV3Scrim.module.css +18 -0
  131. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Title/BpkModalV3Title.d.ts +7 -0
  132. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Title/BpkModalV3Title.js +31 -0
  133. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Title/BpkModalV3Title.module.css +18 -0
  134. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Trigger/BpkModalV3Trigger.d.ts +8 -0
  135. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Trigger/BpkModalV3Trigger.js +30 -0
  136. package/bpk-component-modal/src/BpkModalV3/common-types.d.ts +7 -0
  137. package/bpk-component-modal/src/BpkModalV3/common-types.js +24 -0
  138. package/bpk-component-page-indicator/src/NavButton.d.ts +2 -1
  139. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.js +37 -16
  140. package/bpk-component-skeleton/src/BpkBaseSkeleton.d.d.ts +1 -0
  141. package/bpk-component-skeleton/src/BpkSkeleton.d.d.ts +1 -0
  142. package/bpk-component-table/index.d.ts +2 -1
  143. package/bpk-component-table/index.js +2 -1
  144. package/bpk-component-table/src/BpkTable.module.css +1 -1
  145. package/bpk-component-table/src/BpkTableBody.d.ts +4 -1
  146. package/bpk-component-table/src/BpkTableBody.js +19 -4
  147. package/bpk-component-table/src/common-types.d.ts +5 -0
  148. package/bpk-component-table/src/common-types.js +22 -0
  149. package/bpk-react-utils/src/Portal.d.ts +1 -1
  150. package/package.json +2 -2
  151. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckbox.d.ts +0 -9
  152. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxControl.d.ts +0 -6
  153. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxDescription.d.ts +0 -6
  154. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxHiddenInput.d.ts +0 -2
  155. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxIndicator.d.ts +0 -2
  156. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxLabel.d.ts +0 -6
  157. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxRoot.d.ts +0 -16
  158. /package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckbox.module.css → BpkCheckboxV2.module.css} +0 -0
@@ -0,0 +1,28 @@
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 { getDataComponentAttribute } from "../../../../bpk-react-utils";
21
+ import { jsx as _jsx } from "react/jsx-runtime";
22
+ const BpkModalV3Description = ({
23
+ children
24
+ }) => /*#__PURE__*/_jsx(Dialog.Description, {
25
+ ...getDataComponentAttribute('ModalV3Description'),
26
+ children: children
27
+ });
28
+ export default BpkModalV3Description;
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ type BpkModalV3HeaderProps = {
3
+ children: ReactNode;
4
+ };
5
+ declare const BpkModalV3Header: ({ children }: BpkModalV3HeaderProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default BpkModalV3Header;
7
+ export type { BpkModalV3HeaderProps };
@@ -0,0 +1,34 @@
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 { useModalType } from "../BpkModalV3Context";
21
+ import STYLES from "./BpkModalV3Header.module.css";
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ const getClassName = cssModules(STYLES);
24
+ const BpkModalV3Header = ({
25
+ children
26
+ }) => {
27
+ const type = useModalType();
28
+ return /*#__PURE__*/_jsx("div", {
29
+ className: getClassName('bpk-modal-v3__header', `bpk-modal-v3__header--${type}`),
30
+ ...getDataComponentAttribute('ModalV3Header'),
31
+ children: children
32
+ });
33
+ };
34
+ export default BpkModalV3Header;
@@ -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__header{display:flex;padding:1.5rem;align-items:flex-start;flex-shrink:0;gap:.25rem}.bpk-modal-v3__header--sheet,.bpk-modal-v3__header--full{padding-bottom:1rem}
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ type BpkModalV3HeroImageProps = {
3
+ src: string;
4
+ alt: string;
5
+ height?: string;
6
+ children?: ReactNode;
7
+ };
8
+ declare const BpkModalV3HeroImage: ({ alt, children, height, src, }: BpkModalV3HeroImageProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default BpkModalV3HeroImage;
10
+ export type { BpkModalV3HeroImageProps };
@@ -0,0 +1,44 @@
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 "./BpkModalV3HeroImage.module.css";
21
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
+ const getClassName = cssModules(STYLES);
23
+ const BpkModalV3HeroImage = ({
24
+ alt,
25
+ children,
26
+ height,
27
+ src
28
+ }) => {
29
+ const style = height ? {
30
+ height,
31
+ flex: 'none'
32
+ } : undefined;
33
+ return /*#__PURE__*/_jsxs("div", {
34
+ className: getClassName('bpk-modal-v3__hero-image'),
35
+ style: style,
36
+ ...getDataComponentAttribute('ModalV3HeroImage'),
37
+ children: [/*#__PURE__*/_jsx("img", {
38
+ src: src,
39
+ alt: alt,
40
+ className: getClassName('bpk-modal-v3__hero-image-img')
41
+ }), children]
42
+ });
43
+ };
44
+ export default BpkModalV3HeroImage;
@@ -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__hero-image{position:relative;flex:1;overflow:hidden}.bpk-modal-v3__hero-image-img{position:absolute;width:100%;height:100%;inset:0;object-fit:cover}
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ type BpkModalV3PortalProps = {
3
+ children: ReactNode;
4
+ };
5
+ declare const BpkModalV3Portal: ({ children }: BpkModalV3PortalProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default BpkModalV3Portal;
7
+ export type { BpkModalV3PortalProps };
@@ -0,0 +1,26 @@
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 { Portal } from '@ark-ui/react';
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
+ const BpkModalV3Portal = ({
22
+ children
23
+ }) => /*#__PURE__*/_jsx(Portal, {
24
+ children: children
25
+ });
26
+ export default BpkModalV3Portal;
@@ -0,0 +1,13 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type BpkModalV3Type } from '../common-types';
3
+ type BpkModalV3RootProps = {
4
+ children: ReactNode;
5
+ open?: boolean;
6
+ onOpenChange?: (details: {
7
+ open: boolean;
8
+ }) => void;
9
+ type?: BpkModalV3Type;
10
+ };
11
+ declare const BpkModalV3Root: ({ children, onOpenChange, open, type, }: BpkModalV3RootProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default BpkModalV3Root;
13
+ export type { BpkModalV3RootProps };
@@ -0,0 +1,67 @@
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 { useEffect, useState } from 'react';
20
+ import { Dialog } from '@ark-ui/react';
21
+ import { durationBase } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
22
+ import { getDataComponentAttribute } from "../../../../bpk-react-utils";
23
+ import { ModalTypeProvider } from "../BpkModalV3Context";
24
+ import { MODAL_V3_TYPES } from "../common-types";
25
+ import useBodyLock from "./useBodyLock";
26
+ import { jsx as _jsx } from "react/jsx-runtime";
27
+ const BpkModalV3Root = ({
28
+ children,
29
+ onOpenChange,
30
+ open,
31
+ type = MODAL_V3_TYPES.default
32
+ }) => {
33
+ const [internalOpen, setInternalOpen] = useState(open ?? false);
34
+ const isOpen = open ?? internalOpen;
35
+ const [bodyLockOpen, setBodyLockOpen] = useState(isOpen);
36
+ useEffect(() => {
37
+ if (isOpen) {
38
+ setBodyLockOpen(true);
39
+ } else {
40
+ const timer = setTimeout(() => setBodyLockOpen(false), parseInt(durationBase, 10));
41
+ return () => clearTimeout(timer);
42
+ }
43
+ return undefined;
44
+ }, [isOpen]);
45
+ useBodyLock(type === MODAL_V3_TYPES.chatbot && bodyLockOpen);
46
+ const handleOpenChange = details => {
47
+ if (open === undefined) {
48
+ setInternalOpen(details.open);
49
+ }
50
+ onOpenChange?.(details);
51
+ };
52
+ return /*#__PURE__*/_jsx(Dialog.Root, {
53
+ ...(open !== undefined && {
54
+ open
55
+ }),
56
+ onOpenChange: handleOpenChange,
57
+ children: /*#__PURE__*/_jsx(ModalTypeProvider, {
58
+ value: type,
59
+ children: /*#__PURE__*/_jsx("div", {
60
+ "data-type": type,
61
+ ...getDataComponentAttribute('ModalV3'),
62
+ children: children
63
+ })
64
+ })
65
+ });
66
+ };
67
+ export default BpkModalV3Root;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Locks body scroll when the modal is open, preventing background scroll and
3
+ * iOS Safari bounce effects. Restores all body styles and scroll position on
4
+ * cleanup.
5
+ * @param {boolean} isLocked - Whether the body scroll should be locked.
6
+ * @returns {void}
7
+ */
8
+ declare const useBodyLock: (isLocked: boolean) => void;
9
+ export default useBodyLock;
@@ -0,0 +1,69 @@
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 { useEffect, useRef } from 'react';
20
+
21
+ /**
22
+ * Locks body scroll when the modal is open, preventing background scroll and
23
+ * iOS Safari bounce effects. Restores all body styles and scroll position on
24
+ * cleanup.
25
+ * @param {boolean} isLocked - Whether the body scroll should be locked.
26
+ * @returns {void}
27
+ */
28
+ const useBodyLock = isLocked => {
29
+ const savedScrollYRef = useRef(0);
30
+ const savedBodyStylesRef = useRef(null);
31
+ useEffect(() => {
32
+ if (!isLocked) {
33
+ return undefined;
34
+ }
35
+ const {
36
+ body
37
+ } = document;
38
+ const currentScrollY = window.scrollY;
39
+ savedScrollYRef.current = currentScrollY;
40
+ savedBodyStylesRef.current = {
41
+ overflow: body.style.overflow || '',
42
+ position: body.style.position || '',
43
+ top: body.style.top || '',
44
+ width: body.style.width || '',
45
+ touchAction: body.style.touchAction || '',
46
+ overscrollBehavior: body.style.overscrollBehavior || ''
47
+ };
48
+ body.style.overflow = 'hidden';
49
+ body.style.position = 'fixed';
50
+ body.style.top = `-${currentScrollY}px`;
51
+ body.style.width = '100%';
52
+ body.style.touchAction = 'none';
53
+ body.style.overscrollBehavior = 'contain';
54
+ return () => {
55
+ if (savedBodyStylesRef.current) {
56
+ const saved = savedBodyStylesRef.current;
57
+ body.style.overflow = saved.overflow;
58
+ body.style.position = saved.position;
59
+ body.style.top = saved.top;
60
+ body.style.width = saved.width;
61
+ body.style.touchAction = saved.touchAction;
62
+ body.style.overscrollBehavior = saved.overscrollBehavior;
63
+ savedBodyStylesRef.current = null;
64
+ window.scrollTo(0, savedScrollYRef.current);
65
+ }
66
+ };
67
+ }, [isLocked]);
68
+ };
69
+ export default useBodyLock;
@@ -0,0 +1,2 @@
1
+ declare const BpkModalV3Scrim: () => import("react/jsx-runtime").JSX.Element;
2
+ export default BpkModalV3Scrim;
@@ -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
+ import { Dialog } from '@ark-ui/react';
20
+ import { cssModules, getDataComponentAttribute } from "../../../../bpk-react-utils";
21
+ import { useModalType } from "../BpkModalV3Context";
22
+ import STYLES from "./BpkModalV3Scrim.module.css";
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ const getClassName = cssModules(STYLES);
25
+ const BpkModalV3Scrim = () => {
26
+ const type = useModalType();
27
+ return /*#__PURE__*/_jsx(Dialog.Backdrop, {
28
+ className: getClassName('bpk-modal-v3__scrim', type === 'full' && 'bpk-modal-v3__scrim--full', type === 'chatbot' && 'bpk-modal-v3__scrim--chatbot'),
29
+ ...getDataComponentAttribute('ModalV3Scrim')
30
+ });
31
+ };
32
+ export default BpkModalV3Scrim;
@@ -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__scrim{position:fixed;z-index:1100;transition:opacity 200ms ease-in-out;background-color:rgba(0,0,0,.7);opacity:0;inset:0;pointer-events:none}.bpk-modal-v3__scrim[data-state=open]{opacity:1;pointer-events:auto}.bpk-modal-v3__scrim[data-state=closed]{opacity:0}.bpk-modal-v3__scrim--full{display:none}.bpk-modal-v3__scrim--chatbot{transition:none}.bpk-modal-v3__scrim--chatbot[data-state=open]{animation:bpk-scrim-fade-in 200ms ease-in-out forwards}.bpk-modal-v3__scrim--chatbot[data-state=closed]{animation:bpk-scrim-fade-out 400ms ease-in-out both}@keyframes bpk-scrim-fade-in{from{opacity:0}to{opacity:1}}@keyframes bpk-scrim-fade-out{from{opacity:1}to{opacity:0}}@media(prefers-reduced-motion: reduce){.bpk-modal-v3__scrim{transition:none;animation:none}}
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ type BpkModalV3TitleProps = {
3
+ children: ReactNode;
4
+ };
5
+ declare const BpkModalV3Title: ({ children }: BpkModalV3TitleProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default BpkModalV3Title;
7
+ export type { BpkModalV3TitleProps };
@@ -0,0 +1,31 @@
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 STYLES from "./BpkModalV3Title.module.css";
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ const getClassName = cssModules(STYLES);
24
+ const BpkModalV3Title = ({
25
+ children
26
+ }) => /*#__PURE__*/_jsx(Dialog.Title, {
27
+ className: getClassName('bpk-modal-v3__title'),
28
+ ...getDataComponentAttribute('ModalV3Title'),
29
+ children: children
30
+ });
31
+ export default BpkModalV3Title;
@@ -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__title{min-width:0;margin:0;flex:1;font-size:inherit;font-weight:inherit}
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from 'react';
2
+ type BpkModalV3TriggerProps = {
3
+ children: ReactNode;
4
+ asChild?: boolean;
5
+ };
6
+ declare const BpkModalV3Trigger: ({ asChild, children, }: BpkModalV3TriggerProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default BpkModalV3Trigger;
8
+ export type { BpkModalV3TriggerProps };
@@ -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 { Dialog } from '@ark-ui/react';
20
+ import { getDataComponentAttribute } from "../../../../bpk-react-utils";
21
+ import { jsx as _jsx } from "react/jsx-runtime";
22
+ const BpkModalV3Trigger = ({
23
+ asChild,
24
+ children
25
+ }) => /*#__PURE__*/_jsx(Dialog.Trigger, {
26
+ asChild: asChild,
27
+ ...getDataComponentAttribute('ModalV3Trigger'),
28
+ children: children
29
+ });
30
+ export default BpkModalV3Trigger;
@@ -0,0 +1,7 @@
1
+ export declare const MODAL_V3_TYPES: {
2
+ readonly default: "default";
3
+ readonly full: "full";
4
+ readonly sheet: "sheet";
5
+ readonly chatbot: "chatbot";
6
+ };
7
+ export type BpkModalV3Type = (typeof MODAL_V3_TYPES)[keyof typeof MODAL_V3_TYPES];
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ export const MODAL_V3_TYPES = {
20
+ default: 'default',
21
+ full: 'full',
22
+ sheet: 'sheet',
23
+ chatbot: 'chatbot'
24
+ };
@@ -1,3 +1,4 @@
1
+ import type { MouseEvent } from 'react';
1
2
  import { BUTTON_TYPES } from '../../bpk-component-button';
2
3
  export declare const DIRECTIONS: {
3
4
  readonly PREV: "PREV";
@@ -11,7 +12,7 @@ type Props = {
11
12
  currentIndex: number;
12
13
  direction: Direction;
13
14
  disabled?: boolean;
14
- onClick?: (event: React.MouseEvent<HTMLButtonElement>, newIndex: number, direction: Direction) => void;
15
+ onClick?: (event: MouseEvent<HTMLButtonElement>, newIndex: number, direction: Direction) => void;
15
16
  type?: ButtonType;
16
17
  };
17
18
  declare const NavButton: ({ ariaLabel, currentIndex, direction, disabled, onClick, type, }: Props) => import("react/jsx-runtime").JSX.Element;
@@ -16,7 +16,8 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import { SegmentGroup } from '@ark-ui/react';
19
+ import { useRef } from 'react';
20
+ import { SegmentGroup, useLocaleContext } from '@ark-ui/react';
20
21
  import { cssModules, getDataComponentAttribute } from "../../../bpk-react-utils";
21
22
  import { SEGMENT_TYPES_V2 } from "./common-types";
22
23
  import STYLES from "./BpkSegmentedControlV2.module.css";
@@ -31,22 +32,42 @@ const BpkSegmentedControlV2Root = ({
31
32
  type = SEGMENT_TYPES_V2.CanvasDefault,
32
33
  value
33
34
  }) => {
35
+ const {
36
+ dir
37
+ } = useLocaleContext();
38
+ // Tracks the last user-selected value so it can be restored after a key={dir}
39
+ // remount. Without this, uncontrolled usage would reset to defaultValue on every
40
+ // direction change.
41
+ const lastValueRef = useRef(defaultValue);
34
42
  const containerClass = getClassName('bpk-segmented-control-v2', `bpk-segmented-control-v2--${type}`, shadow && 'bpk-segmented-control-v2--shadow');
35
- return /*#__PURE__*/_jsxs(SegmentGroup.Root, {
36
- className: containerClass,
37
- value: value,
38
- defaultValue: defaultValue,
39
- onValueChange: onChange ? ({
40
- value: selectedValue
41
- }) => {
42
- if (selectedValue !== null) onChange(selectedValue);
43
- } : undefined,
44
- orientation: "horizontal",
45
- ...getDataComponentAttribute('SegmentedControlV2'),
46
- children: [/*#__PURE__*/_jsx(SegmentGroup.Label, {
47
- children: label
48
- }), children]
49
- });
43
+ return (
44
+ /*#__PURE__*/
45
+ // key={dir} is required because Zag.js measures the indicator position via
46
+ // el.offsetLeft (a physical pixel value) and only re-syncs when `value` changes —
47
+ // it has no listener on locale/direction. When direction changes, LocaleProvider
48
+ // updates the locale context but Zag's internal indicatorRect stays stale, leaving
49
+ // the sliding indicator visually offset. Forcing a remount via key={dir} restarts
50
+ // the Zag machine, which re-measures offsetLeft in the new layout direction.
51
+ // See: decisions/rtl-ark-localeprovider.md — "Zag machine indicator pattern"
52
+ _jsxs(SegmentGroup.Root, {
53
+ className: containerClass,
54
+ value: value,
55
+ defaultValue: lastValueRef.current,
56
+ onValueChange: ({
57
+ value: selectedValue
58
+ }) => {
59
+ if (selectedValue !== null) {
60
+ lastValueRef.current = selectedValue;
61
+ if (onChange) onChange(selectedValue);
62
+ }
63
+ },
64
+ orientation: "horizontal",
65
+ ...getDataComponentAttribute('SegmentedControlV2'),
66
+ children: [/*#__PURE__*/_jsx(SegmentGroup.Label, {
67
+ children: label
68
+ }), children]
69
+ }, dir)
70
+ );
50
71
  };
51
72
  const BpkSegmentedControlV2Item = ({
52
73
  children,
@@ -1,3 +1,4 @@
1
+ import type { JSX } from 'react';
1
2
  type Props = {
2
3
  skeletonStyle: string;
3
4
  styleObj?: {
@@ -1,3 +1,4 @@
1
+ import type { JSX } from 'react';
1
2
  import type { ComponentProps } from './common-types';
2
3
  declare const BpkSkeleton: (props: ComponentProps) => JSX.Element;
3
4
  export default BpkSkeleton;