@skyscanner/backpack-web 42.1.0 → 42.2.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-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.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.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-icon/scripts/generate-figma-connect.js +267 -0
- 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 +2 -1
- package/bpk-component-modal/index.js +2 -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.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.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.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.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.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 +44 -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.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.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 +1 -0
- package/bpk-component-modal/src/BpkModalV3/common-types.js +1 -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,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 @@
|
|
|
1
|
+
export type BpkModalV3Type = 'default' | 'full' | 'sheet';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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:
|
|
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 {
|
|
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
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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,
|
|
@@ -4,10 +4,11 @@ import BpkTableCell from './src/BpkTableCell';
|
|
|
4
4
|
import BpkTableHead from './src/BpkTableHead';
|
|
5
5
|
import BpkTableHeadCell from './src/BpkTableHeadCell';
|
|
6
6
|
import BpkTableRow from './src/BpkTableRow';
|
|
7
|
+
import { TABLE_BODY_TYPES } from './src/common-types';
|
|
7
8
|
export type { BpkTableProps } from './src/BpkTable';
|
|
8
9
|
export type { BpkTableHeadProps } from './src/BpkTableHead';
|
|
9
10
|
export type { BpkTableBodyProps } from './src/BpkTableBody';
|
|
10
11
|
export type { BpkTableRowProps } from './src/BpkTableRow';
|
|
11
12
|
export type { BpkTableCellProps } from './src/BpkTableCell';
|
|
12
13
|
export type { BpkTableHeadCellProps } from './src/BpkTableHeadCell';
|
|
13
|
-
export { BpkTable, BpkTableHead, BpkTableBody, BpkTableRow, BpkTableCell, BpkTableHeadCell, };
|
|
14
|
+
export { BpkTable, BpkTableHead, BpkTableBody, BpkTableRow, BpkTableCell, BpkTableHeadCell, TABLE_BODY_TYPES, };
|
|
@@ -22,4 +22,5 @@ import BpkTableCell from "./src/BpkTableCell";
|
|
|
22
22
|
import BpkTableHead from "./src/BpkTableHead";
|
|
23
23
|
import BpkTableHeadCell from "./src/BpkTableHeadCell";
|
|
24
24
|
import BpkTableRow from "./src/BpkTableRow";
|
|
25
|
-
|
|
25
|
+
import { TABLE_BODY_TYPES } from "./src/common-types";
|
|
26
|
+
export { BpkTable, BpkTableHead, BpkTableBody, BpkTableRow, BpkTableCell, BpkTableHeadCell, TABLE_BODY_TYPES };
|
|
@@ -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-table{width:100%;margin-bottom:.5rem;border-collapse:collapse;table-layout:fixed;box-shadow:0 0 0 1px #c1c7cf}.bpk-table__cell{padding:1rem}.bpk-table__cell--head{background-color:#eff3f8;text-align:left;font-size:1rem;line-height:1.5rem;font-weight:700}html[dir=rtl] .bpk-table__cell--head{text-align:right}.bpk-table__cell--wordBreak{white-space:normal;overflow-wrap:break-word}
|
|
18
|
+
.bpk-table{width:100%;margin-bottom:.5rem;border-collapse:collapse;table-layout:fixed;box-shadow:0 0 0 1px #c1c7cf}.bpk-table__body--striped tr:nth-child(even){background-color:#eff3f8}.bpk-table__cell{padding:1rem}.bpk-table__cell--head{background-color:#eff3f8;text-align:left;font-size:1rem;line-height:1.5rem;font-weight:700}html[dir=rtl] .bpk-table__cell--head{text-align:right}.bpk-table__cell--wordBreak{white-space:normal;overflow-wrap:break-word}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
import type { TableBodyType } from './common-types';
|
|
2
3
|
export interface BpkTableBodyProps extends HTMLAttributes<HTMLTableSectionElement> {
|
|
3
4
|
/** The content of the table */
|
|
4
5
|
children: ReactNode;
|
|
6
|
+
/** The type of table body styling */
|
|
7
|
+
type?: TableBodyType;
|
|
5
8
|
}
|
|
6
|
-
declare const BpkTableBody: (
|
|
9
|
+
declare const BpkTableBody: ({ children, className, type, ...rest }: BpkTableBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
10
|
export default BpkTableBody;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
/*
|
|
3
2
|
* Backpack - Skyscanner's Design System
|
|
4
3
|
*
|
|
@@ -17,7 +16,23 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
17
16
|
* limitations under the License.
|
|
18
17
|
*/
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
20
|
+
import { TABLE_BODY_TYPES } from "./common-types";
|
|
21
|
+
import STYLES from "./BpkTable.module.css";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
const getClassName = cssModules(STYLES);
|
|
24
|
+
const BpkTableBody = ({
|
|
25
|
+
children,
|
|
26
|
+
className,
|
|
27
|
+
type = TABLE_BODY_TYPES.default,
|
|
28
|
+
...rest
|
|
29
|
+
}) => {
|
|
30
|
+
const classNames = getClassName(type === TABLE_BODY_TYPES.striped && 'bpk-table__body--striped', className);
|
|
31
|
+
return /*#__PURE__*/_jsx("tbody", {
|
|
32
|
+
...rest,
|
|
33
|
+
className: classNames || undefined,
|
|
34
|
+
...getDataComponentAttribute('TableBody'),
|
|
35
|
+
children: children
|
|
36
|
+
});
|
|
37
|
+
};
|
|
23
38
|
export default BpkTableBody;
|
|
@@ -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
|
+
export const TABLE_BODY_TYPES = {
|
|
20
|
+
default: 'default',
|
|
21
|
+
striped: 'striped'
|
|
22
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyscanner/backpack-web",
|
|
3
|
-
"version": "42.
|
|
3
|
+
"version": "42.2.0",
|
|
4
4
|
"description": "Backpack Design System web library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"d3-scale": "^4.0.2",
|
|
38
38
|
"downshift": "^9.0.10",
|
|
39
39
|
"intersection-observer": "^0.12.2",
|
|
40
|
-
"lodash": "^4.17.
|
|
40
|
+
"lodash": "^4.17.23",
|
|
41
41
|
"lodash.clamp": "^4.0.3",
|
|
42
42
|
"lodash.debounce": "^4.0.8",
|
|
43
43
|
"normalize.css": "4.2.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const BpkCheckbox: {
|
|
2
|
-
Root: ({ checked, children, defaultChecked, disabled, id, invalid, name, onCheckedChange, required, value, }: import("./BpkCheckboxRoot").BpkCheckboxRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
Control: ({ children }: import("./BpkCheckboxControl").BpkCheckboxControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
Indicator: () => null;
|
|
5
|
-
Label: ({ children }: import("./BpkCheckboxLabel").BpkCheckboxLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
Description: ({ children }: import("./BpkCheckboxDescription").BpkCheckboxDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
HiddenInput: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
};
|
|
9
|
-
export default BpkCheckbox;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
export type BpkCheckboxDescriptionProps = {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
};
|
|
5
|
-
declare const BpkCheckboxDescription: ({ children }: BpkCheckboxDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export default BpkCheckboxDescription;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
export type BpkCheckedState = boolean | 'indeterminate';
|
|
3
|
-
export type BpkCheckboxRootProps = {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
checked?: BpkCheckedState;
|
|
6
|
-
defaultChecked?: BpkCheckedState;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
id?: string;
|
|
9
|
-
invalid?: boolean;
|
|
10
|
-
name?: string;
|
|
11
|
-
onCheckedChange?: (checked: BpkCheckedState) => void;
|
|
12
|
-
required?: boolean;
|
|
13
|
-
value?: string;
|
|
14
|
-
};
|
|
15
|
-
declare const BpkCheckboxRoot: ({ checked, children, defaultChecked, disabled, id, invalid, name, onCheckedChange, required, value, }: BpkCheckboxRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export default BpkCheckboxRoot;
|
|
File without changes
|