@skyscanner/backpack-web 41.7.0-beta-layout → 41.7.0-beta-v2
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-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 +33 -0
- package/bpk-component-layout/src/BpkFlex.d.ts +3 -0
- package/bpk-component-layout/src/BpkFlex.js +51 -0
- package/bpk-component-layout/src/BpkGrid.d.ts +3 -0
- package/bpk-component-layout/src/BpkGrid.js +57 -0
- package/bpk-component-layout/src/BpkGridItem.d.ts +3 -0
- package/bpk-component-layout/src/BpkGridItem.js +45 -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 +57 -0
- package/bpk-component-layout/src/BpkVessel.d.ts +36 -0
- package/bpk-component-layout/src/BpkVessel.js +66 -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 +227 -0
- package/bpk-component-layout/src/types.js +1 -0
- package/package.json +2 -1
|
@@ -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,33 @@
|
|
|
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 { processBpkComponentProps } from "./tokenUtils";
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
export const BpkBox = ({
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}) => {
|
|
26
|
+
const processedProps = processBpkComponentProps(props, {
|
|
27
|
+
component: 'BpkBox'
|
|
28
|
+
});
|
|
29
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
30
|
+
...processedProps,
|
|
31
|
+
children: children
|
|
32
|
+
});
|
|
33
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
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 { processBpkComponentProps } from "./tokenUtils";
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
export const BpkFlex = ({
|
|
23
|
+
align,
|
|
24
|
+
basis,
|
|
25
|
+
children,
|
|
26
|
+
direction,
|
|
27
|
+
grow,
|
|
28
|
+
inline,
|
|
29
|
+
justify,
|
|
30
|
+
shrink,
|
|
31
|
+
wrap,
|
|
32
|
+
...props
|
|
33
|
+
}) => {
|
|
34
|
+
const processedProps = processBpkComponentProps(props, {
|
|
35
|
+
component: 'BpkFlex',
|
|
36
|
+
responsiveProps: {
|
|
37
|
+
flexDirection: direction,
|
|
38
|
+
justifyContent: justify,
|
|
39
|
+
alignItems: align,
|
|
40
|
+
flexWrap: wrap,
|
|
41
|
+
flexGrow: grow,
|
|
42
|
+
flexShrink: shrink,
|
|
43
|
+
flexBasis: basis
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return /*#__PURE__*/_jsx(Flex, {
|
|
47
|
+
...processedProps,
|
|
48
|
+
display: inline ? 'inline-flex' : undefined,
|
|
49
|
+
children: children
|
|
50
|
+
});
|
|
51
|
+
};
|
|
@@ -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,57 @@
|
|
|
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 { processBpkComponentProps } from "./tokenUtils";
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
export const BpkGrid = ({
|
|
23
|
+
align,
|
|
24
|
+
autoColumns,
|
|
25
|
+
autoFlow,
|
|
26
|
+
autoRows,
|
|
27
|
+
children,
|
|
28
|
+
column,
|
|
29
|
+
inline,
|
|
30
|
+
justify,
|
|
31
|
+
row,
|
|
32
|
+
templateAreas,
|
|
33
|
+
templateColumns,
|
|
34
|
+
templateRows,
|
|
35
|
+
...props
|
|
36
|
+
}) => {
|
|
37
|
+
const processedProps = processBpkComponentProps(props, {
|
|
38
|
+
component: 'BpkGrid',
|
|
39
|
+
responsiveProps: {
|
|
40
|
+
justifyContent: justify,
|
|
41
|
+
alignItems: align,
|
|
42
|
+
gridTemplateColumns: templateColumns,
|
|
43
|
+
gridTemplateRows: templateRows,
|
|
44
|
+
gridTemplateAreas: templateAreas,
|
|
45
|
+
gridAutoFlow: autoFlow,
|
|
46
|
+
gridAutoRows: autoRows,
|
|
47
|
+
gridAutoColumns: autoColumns,
|
|
48
|
+
gridColumn: column,
|
|
49
|
+
gridRow: row
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return /*#__PURE__*/_jsx(Grid, {
|
|
53
|
+
...processedProps,
|
|
54
|
+
display: inline ? 'inline-grid' : undefined,
|
|
55
|
+
children: children
|
|
56
|
+
});
|
|
57
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { processBpkProps } from "./tokenUtils";
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
export const BpkGridItem = ({
|
|
23
|
+
area,
|
|
24
|
+
children,
|
|
25
|
+
colEnd,
|
|
26
|
+
colSpan,
|
|
27
|
+
colStart,
|
|
28
|
+
rowEnd,
|
|
29
|
+
rowSpan,
|
|
30
|
+
rowStart,
|
|
31
|
+
...props
|
|
32
|
+
}) => {
|
|
33
|
+
const processedProps = processBpkProps(props);
|
|
34
|
+
return /*#__PURE__*/_jsx(GridItem, {
|
|
35
|
+
...processedProps,
|
|
36
|
+
area: area,
|
|
37
|
+
colEnd: colEnd,
|
|
38
|
+
colStart: colStart,
|
|
39
|
+
colSpan: colSpan,
|
|
40
|
+
rowEnd: rowEnd,
|
|
41
|
+
rowStart: rowStart,
|
|
42
|
+
rowSpan: rowSpan,
|
|
43
|
+
children: children
|
|
44
|
+
});
|
|
45
|
+
};
|
|
@@ -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,57 @@
|
|
|
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 { processBpkComponentProps } from "./tokenUtils";
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
export const BpkStack = ({
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}) => {
|
|
26
|
+
const processedProps = processBpkComponentProps(props, {
|
|
27
|
+
component: 'BpkStack'
|
|
28
|
+
});
|
|
29
|
+
return /*#__PURE__*/_jsx(Stack, {
|
|
30
|
+
...processedProps,
|
|
31
|
+
children: children
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export const BpkHStack = ({
|
|
35
|
+
children,
|
|
36
|
+
...props
|
|
37
|
+
}) => {
|
|
38
|
+
const processedProps = processBpkComponentProps(props, {
|
|
39
|
+
component: 'BpkStack'
|
|
40
|
+
});
|
|
41
|
+
return /*#__PURE__*/_jsx(HStack, {
|
|
42
|
+
...processedProps,
|
|
43
|
+
children: children
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
export const BpkVStack = ({
|
|
47
|
+
children,
|
|
48
|
+
...props
|
|
49
|
+
}) => {
|
|
50
|
+
const processedProps = processBpkComponentProps(props, {
|
|
51
|
+
component: 'BpkStack'
|
|
52
|
+
});
|
|
53
|
+
return /*#__PURE__*/_jsx(VStack, {
|
|
54
|
+
...processedProps,
|
|
55
|
+
children: children
|
|
56
|
+
});
|
|
57
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
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 only accepts
|
|
6
|
+
* className and style props for legacy styling during migration.
|
|
7
|
+
*
|
|
8
|
+
* **When to use:**
|
|
9
|
+
* - During component migration when you need to maintain existing className/style usage
|
|
10
|
+
* - As a temporary solution while refactoring components
|
|
11
|
+
*
|
|
12
|
+
* **Important:**
|
|
13
|
+
* - This is a temporary migration tool, not a permanent solution
|
|
14
|
+
* - Only accepts: `as`, `className`, `style`, and `children` props
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <BpkVessel
|
|
19
|
+
* className="legacy-class"
|
|
20
|
+
* style={{ padding: '16px', transition: 'opacity 0.3s' }}
|
|
21
|
+
* >
|
|
22
|
+
* Content
|
|
23
|
+
* </BpkVessel>
|
|
24
|
+
*
|
|
25
|
+
* <BpkVessel
|
|
26
|
+
* as="section"
|
|
27
|
+
* className="legacy-section"
|
|
28
|
+
* >
|
|
29
|
+
* Section Content
|
|
30
|
+
* </BpkVessel>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @returns {JSX.Element} An HTML element with className and style applied.
|
|
34
|
+
*/
|
|
35
|
+
export declare const BpkVessel: ({ as: Element, children, className, style, }: BpkVesselProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export type { BpkVesselProps };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Backpack - Skyscanner's Design System
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2016 Skyscanner Ltd
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A "migration hatch" layout primitive designed to ease component migration.
|
|
22
|
+
*
|
|
23
|
+
* BpkVessel renders an HTML element (default: div) and only accepts
|
|
24
|
+
* className and style props for legacy styling during migration.
|
|
25
|
+
*
|
|
26
|
+
* **When to use:**
|
|
27
|
+
* - During component migration when you need to maintain existing className/style usage
|
|
28
|
+
* - As a temporary solution while refactoring components
|
|
29
|
+
*
|
|
30
|
+
* **Important:**
|
|
31
|
+
* - This is a temporary migration tool, not a permanent solution
|
|
32
|
+
* - Only accepts: `as`, `className`, `style`, and `children` props
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <BpkVessel
|
|
37
|
+
* className="legacy-class"
|
|
38
|
+
* style={{ padding: '16px', transition: 'opacity 0.3s' }}
|
|
39
|
+
* >
|
|
40
|
+
* Content
|
|
41
|
+
* </BpkVessel>
|
|
42
|
+
*
|
|
43
|
+
* <BpkVessel
|
|
44
|
+
* as="section"
|
|
45
|
+
* className="legacy-section"
|
|
46
|
+
* >
|
|
47
|
+
* Section Content
|
|
48
|
+
* </BpkVessel>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @returns {JSX.Element} An HTML element with className and style applied.
|
|
52
|
+
*/
|
|
53
|
+
export const BpkVessel = ({
|
|
54
|
+
as: Element = 'div',
|
|
55
|
+
children,
|
|
56
|
+
className,
|
|
57
|
+
style
|
|
58
|
+
}) =>
|
|
59
|
+
/*#__PURE__*/
|
|
60
|
+
// Allowed, Element is always a DOM element.
|
|
61
|
+
// eslint-disable-next-line @skyscanner/rules/forbid-component-props
|
|
62
|
+
_jsx(Element, {
|
|
63
|
+
className: className,
|
|
64
|
+
style: style,
|
|
65
|
+
children: children
|
|
66
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { BpkSpacingValue, BpkSizeValue, BpkPositionValue, BpkResponsiveValue } from './tokens';
|
|
2
|
+
/**
|
|
3
|
+
* Common spacing-related props shared by all Backpack layout components
|
|
4
|
+
* All spacing props must use Backpack spacing tokens or percentages
|
|
5
|
+
*/
|
|
6
|
+
export interface BpkSpacingProps {
|
|
7
|
+
padding?: BpkResponsiveValue<BpkSpacingValue>;
|
|
8
|
+
paddingTop?: BpkResponsiveValue<BpkSpacingValue>;
|
|
9
|
+
paddingRight?: BpkResponsiveValue<BpkSpacingValue>;
|
|
10
|
+
paddingBottom?: BpkResponsiveValue<BpkSpacingValue>;
|
|
11
|
+
paddingLeft?: BpkResponsiveValue<BpkSpacingValue>;
|
|
12
|
+
margin?: BpkResponsiveValue<BpkSpacingValue>;
|
|
13
|
+
marginTop?: BpkResponsiveValue<BpkSpacingValue>;
|
|
14
|
+
marginRight?: BpkResponsiveValue<BpkSpacingValue>;
|
|
15
|
+
marginBottom?: BpkResponsiveValue<BpkSpacingValue>;
|
|
16
|
+
marginLeft?: BpkResponsiveValue<BpkSpacingValue>;
|
|
17
|
+
marginStart?: BpkResponsiveValue<BpkSpacingValue>;
|
|
18
|
+
marginEnd?: BpkResponsiveValue<BpkSpacingValue>;
|
|
19
|
+
paddingStart?: BpkResponsiveValue<BpkSpacingValue>;
|
|
20
|
+
paddingEnd?: BpkResponsiveValue<BpkSpacingValue>;
|
|
21
|
+
marginInline?: BpkResponsiveValue<BpkSpacingValue>;
|
|
22
|
+
paddingInline?: BpkResponsiveValue<BpkSpacingValue>;
|
|
23
|
+
gap?: BpkResponsiveValue<BpkSpacingValue>;
|
|
24
|
+
width?: BpkResponsiveValue<BpkSizeValue>;
|
|
25
|
+
height?: BpkResponsiveValue<BpkSizeValue>;
|
|
26
|
+
minWidth?: BpkResponsiveValue<BpkSizeValue>;
|
|
27
|
+
minHeight?: BpkResponsiveValue<BpkSizeValue>;
|
|
28
|
+
maxWidth?: BpkResponsiveValue<BpkSizeValue>;
|
|
29
|
+
maxHeight?: BpkResponsiveValue<BpkSizeValue>;
|
|
30
|
+
top?: BpkResponsiveValue<BpkPositionValue>;
|
|
31
|
+
right?: BpkResponsiveValue<BpkPositionValue>;
|
|
32
|
+
bottom?: BpkResponsiveValue<BpkPositionValue>;
|
|
33
|
+
left?: BpkResponsiveValue<BpkPositionValue>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Common props for all Backpack layout components
|
|
37
|
+
* Combines spacing and color props, and explicitly excludes className and
|
|
38
|
+
* certain props (e.g. typography, composite borders, transitions) to keep
|
|
39
|
+
* layout components purely structural.
|
|
40
|
+
*
|
|
41
|
+
* NOTE:
|
|
42
|
+
* - Layout components other than BpkBox do not expose event handlers.
|
|
43
|
+
* - BpkBox reintroduces a minimal set of events (onClick, onFocus, onBlur)
|
|
44
|
+
* on its own props type.
|
|
45
|
+
*/
|
|
46
|
+
export interface BpkCommonLayoutProps extends BpkSpacingProps {
|
|
47
|
+
className?: never;
|
|
48
|
+
style?: never;
|
|
49
|
+
'data-testid'?: string;
|
|
50
|
+
'data-cy'?: string;
|
|
51
|
+
color?: never;
|
|
52
|
+
background?: never;
|
|
53
|
+
backgroundColor?: never;
|
|
54
|
+
borderColor?: never;
|
|
55
|
+
borderTopColor?: never;
|
|
56
|
+
borderRightColor?: never;
|
|
57
|
+
borderBottomColor?: never;
|
|
58
|
+
borderLeftColor?: never;
|
|
59
|
+
borderWidth?: never;
|
|
60
|
+
borderTopWidth?: never;
|
|
61
|
+
borderRightWidth?: never;
|
|
62
|
+
borderBottomWidth?: never;
|
|
63
|
+
borderLeftWidth?: never;
|
|
64
|
+
borderRadius?: never;
|
|
65
|
+
borderTopLeftRadius?: never;
|
|
66
|
+
borderTopRightRadius?: never;
|
|
67
|
+
borderBottomLeftRadius?: never;
|
|
68
|
+
borderBottomRightRadius?: never;
|
|
69
|
+
boxShadow?: never;
|
|
70
|
+
border?: never;
|
|
71
|
+
borderTop?: never;
|
|
72
|
+
borderRight?: never;
|
|
73
|
+
borderBottom?: never;
|
|
74
|
+
borderLeft?: never;
|
|
75
|
+
borderInline?: never;
|
|
76
|
+
borderBlock?: never;
|
|
77
|
+
borderX?: never;
|
|
78
|
+
borderY?: never;
|
|
79
|
+
transition?: never;
|
|
80
|
+
transitionProperty?: never;
|
|
81
|
+
transitionDuration?: never;
|
|
82
|
+
transitionTimingFunction?: never;
|
|
83
|
+
transitionDelay?: never;
|
|
84
|
+
transform?: never;
|
|
85
|
+
transformOrigin?: never;
|
|
86
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exports spacing map for use in tokenUtils
|
|
3
|
+
* This allows tokenUtils to look up actual spacing values
|
|
4
|
+
*
|
|
5
|
+
* @returns {Record<string, string>} A map of spacing token names to values.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getSpacingMap(): Record<string, string>;
|
|
8
|
+
/**
|
|
9
|
+
* Gets the actual spacing value for a Backpack spacing token
|
|
10
|
+
*
|
|
11
|
+
* @param {string} token - Backpack spacing token name.
|
|
12
|
+
* @returns {string | undefined} The actual spacing value.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getSpacingValue(token: string): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Gets the actual border width value for a Backpack border size token
|
|
17
|
+
*
|
|
18
|
+
* @param {string} token - Backpack border size token name.
|
|
19
|
+
* @returns {string | undefined} The actual border width value.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getBorderSizeValue(token: string): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the actual border radius value for a Backpack border radius token
|
|
24
|
+
*
|
|
25
|
+
* @param {string} token - Backpack border radius token name.
|
|
26
|
+
* @returns {string | undefined} The actual border radius value.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getBorderRadiusValue(token: string): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the actual box-shadow value for a Backpack shadow token
|
|
31
|
+
*
|
|
32
|
+
* @param {string} token - Backpack shadow token name.
|
|
33
|
+
* @returns {string | undefined} The actual box-shadow value.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getShadowValue(token: string): string | undefined;
|
|
36
|
+
export declare function createBpkConfig(): import("@chakra-ui/react").SystemConfig;
|