@skyscanner/backpack-web 41.14.0 → 41.15.1
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-bottom-sheet/src/BpkBottomSheet.d.ts +1 -1
- package/bpk-component-bottom-sheet/src/BpkBottomSheet.js +11 -4
- package/bpk-component-layout/index.d.ts +18 -0
- package/bpk-component-layout/index.js +29 -0
- package/bpk-component-layout/src/BpkBox.d.ts +3 -0
- package/bpk-component-layout/src/BpkBox.js +35 -0
- package/bpk-component-layout/src/BpkFlex.d.ts +3 -0
- package/bpk-component-layout/src/BpkFlex.js +53 -0
- package/bpk-component-layout/src/BpkGrid.d.ts +3 -0
- package/bpk-component-layout/src/BpkGrid.js +59 -0
- package/bpk-component-layout/src/BpkGridItem.d.ts +3 -0
- package/bpk-component-layout/src/BpkGridItem.js +47 -0
- package/bpk-component-layout/src/BpkProvider.d.ts +14 -0
- package/bpk-component-layout/src/BpkProvider.js +42 -0
- package/bpk-component-layout/src/BpkStack.constant.d.ts +2 -0
- package/bpk-component-layout/src/BpkStack.constant.js +22 -0
- package/bpk-component-layout/src/BpkStack.d.ts +5 -0
- package/bpk-component-layout/src/BpkStack.js +61 -0
- package/bpk-component-layout/src/BpkVessel.d.ts +46 -0
- package/bpk-component-layout/src/BpkVessel.js +72 -0
- package/bpk-component-layout/src/commonProps.d.ts +86 -0
- package/bpk-component-layout/src/commonProps.js +1 -0
- package/bpk-component-layout/src/theme.d.ts +36 -0
- package/bpk-component-layout/src/theme.js +229 -0
- package/bpk-component-layout/src/tokenUtils.d.ts +108 -0
- package/bpk-component-layout/src/tokenUtils.js +323 -0
- package/bpk-component-layout/src/tokens.d.ts +96 -0
- package/bpk-component-layout/src/tokens.js +138 -0
- package/bpk-component-layout/src/types.d.ts +236 -0
- package/bpk-component-layout/src/types.js +1 -0
- package/package.json +2 -1
|
@@ -24,7 +24,7 @@ interface CommonProps {
|
|
|
24
24
|
onClose: (arg0?: TouchEvent | MouseEvent | KeyboardEvent | SyntheticEvent<HTMLDialogElement, Event>, arg1?: {
|
|
25
25
|
source: 'ESCAPE' | 'DOCUMENT_CLICK';
|
|
26
26
|
}) => void;
|
|
27
|
-
title?: string;
|
|
27
|
+
title?: string | ReactNode;
|
|
28
28
|
wide?: boolean;
|
|
29
29
|
isOpen: boolean;
|
|
30
30
|
paddingStyles?: PaddingStyles;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { useCallback, useState } from 'react';
|
|
19
|
+
import { useCallback, useState, isValidElement, cloneElement } from 'react';
|
|
20
20
|
import BpkBreakpoint, { BREAKPOINTS } from "../../bpk-component-breakpoint";
|
|
21
21
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
22
22
|
import BpkCloseButton from "../../bpk-component-close-button";
|
|
@@ -95,9 +95,16 @@ const BpkBottomSheet = ({
|
|
|
95
95
|
}, [isAboveMobile, onClose]);
|
|
96
96
|
const headingId = `bpk-bottom-sheet-heading-${id}`;
|
|
97
97
|
const hiddenTitleId = `bpk-bottom-sheet-title-hidden-${id}`;
|
|
98
|
-
const
|
|
98
|
+
const hasTitle = !!title;
|
|
99
|
+
const showHiddenTitle = !hasTitle && 'ariaLabel' in ariaProps && ariaProps.ariaLabel;
|
|
99
100
|
const dialogClassName = getClassName('bpk-bottom-sheet', wide && 'bpk-bottom-sheet--wide');
|
|
100
101
|
const contentStyle = getContentStyles(paddingStyles);
|
|
102
|
+
|
|
103
|
+
// For custom title (ReactNode), wrap it with an element that has the correct id
|
|
104
|
+
// so BpkNavigationBar's aria-labelledby reference is valid
|
|
105
|
+
const titleWithId = hasTitle && typeof title !== 'string' && /*#__PURE__*/isValidElement(title) ? /*#__PURE__*/cloneElement(title, {
|
|
106
|
+
id: showHiddenTitle ? hiddenTitleId : headingId
|
|
107
|
+
}) : title;
|
|
101
108
|
return /*#__PURE__*/_jsx(BpkDialogWrapper, {
|
|
102
109
|
...ariaProps,
|
|
103
110
|
dialogClassName: dialogClassName,
|
|
@@ -122,9 +129,9 @@ const BpkBottomSheet = ({
|
|
|
122
129
|
className: getClassName('bpk-bottom-sheet--header-wrapper'),
|
|
123
130
|
children: [/*#__PURE__*/_jsx(BpkNavigationBar, {
|
|
124
131
|
id: showHiddenTitle ? hiddenTitleId : headingId,
|
|
125
|
-
title:
|
|
132
|
+
title: titleWithId,
|
|
126
133
|
titleTextStyle: TEXT_STYLES.label1,
|
|
127
|
-
titleTagName:
|
|
134
|
+
titleTagName: hasTitle ? 'h2' : 'span',
|
|
128
135
|
className: getClassName('bpk-bottom-sheet--header'),
|
|
129
136
|
leadingButton: /*#__PURE__*/_jsx(BpkCloseButton, {
|
|
130
137
|
label: closeLabel,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { BpkProvider } from './src/BpkProvider';
|
|
2
|
+
export { BpkBox } from './src/BpkBox';
|
|
3
|
+
export { BpkVessel } from './src/BpkVessel';
|
|
4
|
+
export { BpkFlex } from './src/BpkFlex';
|
|
5
|
+
export { BpkGrid } from './src/BpkGrid';
|
|
6
|
+
export { BpkGridItem } from './src/BpkGridItem';
|
|
7
|
+
export type { BpkProviderProps } from './src/BpkProvider';
|
|
8
|
+
export type { BpkBoxProps } from './src/BpkBox';
|
|
9
|
+
export type { BpkVesselProps } from './src/BpkVessel';
|
|
10
|
+
export type { BpkFlexProps } from './src/BpkFlex';
|
|
11
|
+
export type { BpkGridProps } from './src/BpkGrid';
|
|
12
|
+
export type { BpkGridItemProps } from './src/BpkGridItem';
|
|
13
|
+
export { BpkStack, BpkHStack, BpkVStack } from './src/BpkStack';
|
|
14
|
+
export type { BpkStackProps } from './src/BpkStack';
|
|
15
|
+
export type { BpkCommonLayoutProps, BpkBoxSpecificProps, BpkFlexSpecificProps, BpkGridSpecificProps, BpkGridItemSpecificProps, } from './src/types';
|
|
16
|
+
export type { BpkStackSpecificProps } from './src/types';
|
|
17
|
+
export type { BpkSpacingToken, BpkBreakpointToken, BpkSpacingValue, BpkBreakpointValue, } from './src/tokens';
|
|
18
|
+
export { BpkSpacing, BpkBreakpoint, isValidSpacingValue, isPercentage, } from './src/tokens';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export { BpkProvider } from "./src/BpkProvider";
|
|
20
|
+
export { BpkBox } from "./src/BpkBox";
|
|
21
|
+
export { BpkVessel } from "./src/BpkVessel";
|
|
22
|
+
export { BpkFlex } from "./src/BpkFlex";
|
|
23
|
+
export { BpkGrid } from "./src/BpkGrid";
|
|
24
|
+
export { BpkGridItem } from "./src/BpkGridItem";
|
|
25
|
+
export { BpkStack, BpkHStack, BpkVStack } from "./src/BpkStack";
|
|
26
|
+
|
|
27
|
+
// Export token types and utilities
|
|
28
|
+
|
|
29
|
+
export { BpkSpacing, BpkBreakpoint, isValidSpacingValue, isPercentage } from "./src/tokens";
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { Box } from '@chakra-ui/react';
|
|
20
|
+
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
|
+
import { processBpkComponentProps } from "./tokenUtils";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
export const BpkBox = ({
|
|
24
|
+
children,
|
|
25
|
+
...props
|
|
26
|
+
}) => {
|
|
27
|
+
const processedProps = processBpkComponentProps(props, {
|
|
28
|
+
component: 'BpkBox'
|
|
29
|
+
});
|
|
30
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
31
|
+
...getDataComponentAttribute('Box'),
|
|
32
|
+
...processedProps,
|
|
33
|
+
children: children
|
|
34
|
+
});
|
|
35
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { Flex } from '@chakra-ui/react';
|
|
20
|
+
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
|
+
import { processBpkComponentProps } from "./tokenUtils";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
export const BpkFlex = ({
|
|
24
|
+
align,
|
|
25
|
+
basis,
|
|
26
|
+
children,
|
|
27
|
+
direction,
|
|
28
|
+
grow,
|
|
29
|
+
inline,
|
|
30
|
+
justify,
|
|
31
|
+
shrink,
|
|
32
|
+
wrap,
|
|
33
|
+
...props
|
|
34
|
+
}) => {
|
|
35
|
+
const processedProps = processBpkComponentProps(props, {
|
|
36
|
+
component: 'BpkFlex',
|
|
37
|
+
responsiveProps: {
|
|
38
|
+
flexDirection: direction,
|
|
39
|
+
justifyContent: justify,
|
|
40
|
+
alignItems: align,
|
|
41
|
+
flexWrap: wrap,
|
|
42
|
+
flexGrow: grow,
|
|
43
|
+
flexShrink: shrink,
|
|
44
|
+
flexBasis: basis
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return /*#__PURE__*/_jsx(Flex, {
|
|
48
|
+
...getDataComponentAttribute('Flex'),
|
|
49
|
+
...processedProps,
|
|
50
|
+
display: inline ? 'inline-flex' : undefined,
|
|
51
|
+
children: children
|
|
52
|
+
});
|
|
53
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BpkGridProps } from './types';
|
|
2
|
+
export declare const BpkGrid: ({ align, autoColumns, autoFlow, autoRows, children, column, inline, justify, row, templateAreas, templateColumns, templateRows, ...props }: BpkGridProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export type { BpkGridProps };
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { Grid } from '@chakra-ui/react';
|
|
20
|
+
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
|
+
import { processBpkComponentProps } from "./tokenUtils";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
export const BpkGrid = ({
|
|
24
|
+
align,
|
|
25
|
+
autoColumns,
|
|
26
|
+
autoFlow,
|
|
27
|
+
autoRows,
|
|
28
|
+
children,
|
|
29
|
+
column,
|
|
30
|
+
inline,
|
|
31
|
+
justify,
|
|
32
|
+
row,
|
|
33
|
+
templateAreas,
|
|
34
|
+
templateColumns,
|
|
35
|
+
templateRows,
|
|
36
|
+
...props
|
|
37
|
+
}) => {
|
|
38
|
+
const processedProps = processBpkComponentProps(props, {
|
|
39
|
+
component: 'BpkGrid',
|
|
40
|
+
responsiveProps: {
|
|
41
|
+
justifyContent: justify,
|
|
42
|
+
alignItems: align,
|
|
43
|
+
gridTemplateColumns: templateColumns,
|
|
44
|
+
gridTemplateRows: templateRows,
|
|
45
|
+
gridTemplateAreas: templateAreas,
|
|
46
|
+
gridAutoFlow: autoFlow,
|
|
47
|
+
gridAutoRows: autoRows,
|
|
48
|
+
gridAutoColumns: autoColumns,
|
|
49
|
+
gridColumn: column,
|
|
50
|
+
gridRow: row
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return /*#__PURE__*/_jsx(Grid, {
|
|
54
|
+
...getDataComponentAttribute('Grid'),
|
|
55
|
+
...processedProps,
|
|
56
|
+
display: inline ? 'inline-grid' : undefined,
|
|
57
|
+
children: children
|
|
58
|
+
});
|
|
59
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { GridItem } from '@chakra-ui/react';
|
|
20
|
+
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
|
+
import { processBpkProps } from "./tokenUtils";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
export const BpkGridItem = ({
|
|
24
|
+
area,
|
|
25
|
+
children,
|
|
26
|
+
colEnd,
|
|
27
|
+
colSpan,
|
|
28
|
+
colStart,
|
|
29
|
+
rowEnd,
|
|
30
|
+
rowSpan,
|
|
31
|
+
rowStart,
|
|
32
|
+
...props
|
|
33
|
+
}) => {
|
|
34
|
+
const processedProps = processBpkProps(props);
|
|
35
|
+
return /*#__PURE__*/_jsx(GridItem, {
|
|
36
|
+
...getDataComponentAttribute('GridItem'),
|
|
37
|
+
...processedProps,
|
|
38
|
+
area: area,
|
|
39
|
+
colEnd: colEnd,
|
|
40
|
+
colStart: colStart,
|
|
41
|
+
colSpan: colSpan,
|
|
42
|
+
rowEnd: rowEnd,
|
|
43
|
+
rowStart: rowStart,
|
|
44
|
+
rowSpan: rowSpan,
|
|
45
|
+
children: children
|
|
46
|
+
});
|
|
47
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface BpkProviderProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* BpkProvider - Provides Chakra UI context for Backpack layout components
|
|
7
|
+
*
|
|
8
|
+
* Chakra UI 3.0 requires the `value` prop to be set to a system object.
|
|
9
|
+
* We create a custom system with Backpack tokens using createSystem.
|
|
10
|
+
*
|
|
11
|
+
* @param {BpkProviderProps} props - The provider props.
|
|
12
|
+
* @returns {JSX.Element} The provider wrapping its children with Chakra context.
|
|
13
|
+
*/
|
|
14
|
+
export declare const BpkProvider: ({ children }: BpkProviderProps) => JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { ChakraProvider, createSystem, defaultConfig } from '@chakra-ui/react';
|
|
20
|
+
import { createBpkConfig } from "./theme";
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
/**
|
|
23
|
+
* Creates a Chakra UI system with Backpack token mappings
|
|
24
|
+
* Chakra UI 3.0 uses `createSystem` with `defaultConfig` and custom config
|
|
25
|
+
*/
|
|
26
|
+
const bpkSystem = createSystem(defaultConfig, createBpkConfig());
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* BpkProvider - Provides Chakra UI context for Backpack layout components
|
|
30
|
+
*
|
|
31
|
+
* Chakra UI 3.0 requires the `value` prop to be set to a system object.
|
|
32
|
+
* We create a custom system with Backpack tokens using createSystem.
|
|
33
|
+
*
|
|
34
|
+
* @param {BpkProviderProps} props - The provider props.
|
|
35
|
+
* @returns {JSX.Element} The provider wrapping its children with Chakra context.
|
|
36
|
+
*/
|
|
37
|
+
export const BpkProvider = ({
|
|
38
|
+
children
|
|
39
|
+
}) => /*#__PURE__*/_jsx(ChakraProvider, {
|
|
40
|
+
value: bpkSystem,
|
|
41
|
+
children: children
|
|
42
|
+
});
|
|
@@ -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
|
+
// these options align with Chakra's StackOption excluding separator
|
|
20
|
+
// TODO: add separator to Stack
|
|
21
|
+
const StackOptionKeys = ['align', 'justify', 'wrap', 'direction'];
|
|
22
|
+
export default StackOptionKeys;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BpkStackProps } from './types';
|
|
2
|
+
export declare const BpkStack: ({ children, ...props }: BpkStackProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const BpkHStack: ({ children, ...props }: BpkStackProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const BpkVStack: ({ children, ...props }: BpkStackProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export type { BpkStackProps };
|
|
@@ -0,0 +1,61 @@
|
|
|
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 { Stack, VStack, HStack } from '@chakra-ui/react';
|
|
20
|
+
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
|
+
import { processBpkComponentProps } from "./tokenUtils";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
export const BpkStack = ({
|
|
24
|
+
children,
|
|
25
|
+
...props
|
|
26
|
+
}) => {
|
|
27
|
+
const processedProps = processBpkComponentProps(props, {
|
|
28
|
+
component: 'BpkStack'
|
|
29
|
+
});
|
|
30
|
+
return /*#__PURE__*/_jsx(Stack, {
|
|
31
|
+
...getDataComponentAttribute('Stack'),
|
|
32
|
+
...processedProps,
|
|
33
|
+
children: children
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export const BpkHStack = ({
|
|
37
|
+
children,
|
|
38
|
+
...props
|
|
39
|
+
}) => {
|
|
40
|
+
const processedProps = processBpkComponentProps(props, {
|
|
41
|
+
component: 'BpkStack'
|
|
42
|
+
});
|
|
43
|
+
return /*#__PURE__*/_jsx(HStack, {
|
|
44
|
+
...getDataComponentAttribute('HStack'),
|
|
45
|
+
...processedProps,
|
|
46
|
+
children: children
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export const BpkVStack = ({
|
|
50
|
+
children,
|
|
51
|
+
...props
|
|
52
|
+
}) => {
|
|
53
|
+
const processedProps = processBpkComponentProps(props, {
|
|
54
|
+
component: 'BpkStack'
|
|
55
|
+
});
|
|
56
|
+
return /*#__PURE__*/_jsx(VStack, {
|
|
57
|
+
...getDataComponentAttribute('VStack'),
|
|
58
|
+
...processedProps,
|
|
59
|
+
children: children
|
|
60
|
+
});
|
|
61
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { BpkVesselProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* A "migration hatch" layout primitive designed to ease component migration.
|
|
4
|
+
*
|
|
5
|
+
* BpkVessel renders an HTML element (default: div) and accepts all standard
|
|
6
|
+
* HTML attributes for maximum migration flexibility.
|
|
7
|
+
*
|
|
8
|
+
* **When to use:**
|
|
9
|
+
* - During component migration when you need to maintain existing className/style usage
|
|
10
|
+
* - When you need to pass testing attributes (data-testid) or accessibility props
|
|
11
|
+
* - As a temporary solution while refactoring components
|
|
12
|
+
*
|
|
13
|
+
* **Important:**
|
|
14
|
+
* - This is a temporary migration tool, not a permanent solution
|
|
15
|
+
* - Accepts all React.HTMLAttributes (styling, events, aria, data-*, etc.)
|
|
16
|
+
* - Plan to migrate to BpkBox once legacy styling is removed
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <BpkVessel
|
|
21
|
+
* className="legacy-class"
|
|
22
|
+
* style={{ padding: '16px', transition: 'opacity 0.3s' }}
|
|
23
|
+
* data-testid="migration-wrapper"
|
|
24
|
+
* onClick={handleClick}
|
|
25
|
+
* >
|
|
26
|
+
* Content
|
|
27
|
+
* </BpkVessel>
|
|
28
|
+
*
|
|
29
|
+
* <BpkVessel
|
|
30
|
+
* as="section"
|
|
31
|
+
* className="legacy-section"
|
|
32
|
+
* aria-label="Main content"
|
|
33
|
+
* role="region"
|
|
34
|
+
* dir="rtl"
|
|
35
|
+
* >
|
|
36
|
+
* Section Content
|
|
37
|
+
* </BpkVessel>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @todo Migration component - pending removal after component migration is complete.
|
|
41
|
+
* Replace usages with BpkBox once legacy className/style dependencies are refactored.
|
|
42
|
+
*
|
|
43
|
+
* @returns {JSX.Element} An HTML element with all props applied.
|
|
44
|
+
*/
|
|
45
|
+
export declare const BpkVessel: ({ as: Element, children, ...restProps }: BpkVesselProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export type { BpkVesselProps };
|
|
@@ -0,0 +1,72 @@
|
|
|
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 { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
/**
|
|
22
|
+
* A "migration hatch" layout primitive designed to ease component migration.
|
|
23
|
+
*
|
|
24
|
+
* BpkVessel renders an HTML element (default: div) and accepts all standard
|
|
25
|
+
* HTML attributes for maximum migration flexibility.
|
|
26
|
+
*
|
|
27
|
+
* **When to use:**
|
|
28
|
+
* - During component migration when you need to maintain existing className/style usage
|
|
29
|
+
* - When you need to pass testing attributes (data-testid) or accessibility props
|
|
30
|
+
* - As a temporary solution while refactoring components
|
|
31
|
+
*
|
|
32
|
+
* **Important:**
|
|
33
|
+
* - This is a temporary migration tool, not a permanent solution
|
|
34
|
+
* - Accepts all React.HTMLAttributes (styling, events, aria, data-*, etc.)
|
|
35
|
+
* - Plan to migrate to BpkBox once legacy styling is removed
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <BpkVessel
|
|
40
|
+
* className="legacy-class"
|
|
41
|
+
* style={{ padding: '16px', transition: 'opacity 0.3s' }}
|
|
42
|
+
* data-testid="migration-wrapper"
|
|
43
|
+
* onClick={handleClick}
|
|
44
|
+
* >
|
|
45
|
+
* Content
|
|
46
|
+
* </BpkVessel>
|
|
47
|
+
*
|
|
48
|
+
* <BpkVessel
|
|
49
|
+
* as="section"
|
|
50
|
+
* className="legacy-section"
|
|
51
|
+
* aria-label="Main content"
|
|
52
|
+
* role="region"
|
|
53
|
+
* dir="rtl"
|
|
54
|
+
* >
|
|
55
|
+
* Section Content
|
|
56
|
+
* </BpkVessel>
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @todo Migration component - pending removal after component migration is complete.
|
|
60
|
+
* Replace usages with BpkBox once legacy className/style dependencies are refactored.
|
|
61
|
+
*
|
|
62
|
+
* @returns {JSX.Element} An HTML element with all props applied.
|
|
63
|
+
*/
|
|
64
|
+
export const BpkVessel = ({
|
|
65
|
+
as: Element = 'div',
|
|
66
|
+
children,
|
|
67
|
+
...restProps
|
|
68
|
+
}) => /*#__PURE__*/_jsx(Element, {
|
|
69
|
+
...getDataComponentAttribute('Vessel'),
|
|
70
|
+
...restProps,
|
|
71
|
+
children: children
|
|
72
|
+
});
|