@skyscanner/backpack-web 41.7.0-beta-v1 → 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.
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export { BpkProvider } from './src/BpkProvider';
|
|
2
2
|
export { BpkBox } from './src/BpkBox';
|
|
3
|
+
export { BpkVessel } from './src/BpkVessel';
|
|
3
4
|
export { BpkFlex } from './src/BpkFlex';
|
|
4
5
|
export { BpkGrid } from './src/BpkGrid';
|
|
5
6
|
export { BpkGridItem } from './src/BpkGridItem';
|
|
6
7
|
export type { BpkProviderProps } from './src/BpkProvider';
|
|
7
8
|
export type { BpkBoxProps } from './src/BpkBox';
|
|
9
|
+
export type { BpkVesselProps } from './src/BpkVessel';
|
|
8
10
|
export type { BpkFlexProps } from './src/BpkFlex';
|
|
9
11
|
export type { BpkGridProps } from './src/BpkGrid';
|
|
10
12
|
export type { BpkGridItemProps } from './src/BpkGridItem';
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
export { BpkProvider } from "./src/BpkProvider";
|
|
20
20
|
export { BpkBox } from "./src/BpkBox";
|
|
21
|
+
export { BpkVessel } from "./src/BpkVessel";
|
|
21
22
|
export { BpkFlex } from "./src/BpkFlex";
|
|
22
23
|
export { BpkGrid } from "./src/BpkGrid";
|
|
23
24
|
export { BpkGridItem } from "./src/BpkGridItem";
|
|
@@ -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
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import type StackOptionKeys from './BpkStack.constant';
|
|
3
3
|
import type { BpkCommonLayoutProps } from './commonProps';
|
|
4
4
|
import type { BpkSpacingValue, BpkResponsiveValue, BpkBasisValue } from './tokens';
|
|
@@ -103,6 +103,39 @@ export interface BpkBoxProps extends BpkCommonLayoutProps, BpkBoxSpecificProps {
|
|
|
103
103
|
onFocus?: BoxEventProps['onFocus'];
|
|
104
104
|
onBlur?: BoxEventProps['onBlur'];
|
|
105
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Valid HTML elements that can be used with BpkVessel
|
|
108
|
+
*/
|
|
109
|
+
export type VesselElement = 'div' | 'span' | 'section' | 'article' | 'nav' | 'main' | 'aside' | 'header' | 'footer';
|
|
110
|
+
/**
|
|
111
|
+
* Props for BpkVessel component.
|
|
112
|
+
*
|
|
113
|
+
* BpkVessel is a "migration hatch" that renders an HTML element
|
|
114
|
+
* and only accepts className and style props.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```tsx
|
|
118
|
+
* <BpkVessel
|
|
119
|
+
* className="legacy-wrapper"
|
|
120
|
+
* style={{ padding: '16px', transition: 'opacity 0.3s' }}
|
|
121
|
+
* >
|
|
122
|
+
* Content
|
|
123
|
+
* </BpkVessel>
|
|
124
|
+
*
|
|
125
|
+
* <BpkVessel
|
|
126
|
+
* as="section"
|
|
127
|
+
* className="legacy-section"
|
|
128
|
+
* >
|
|
129
|
+
* Section Content
|
|
130
|
+
* </BpkVessel>
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export type BpkVesselProps = {
|
|
134
|
+
as?: VesselElement;
|
|
135
|
+
children?: ReactNode;
|
|
136
|
+
className?: string;
|
|
137
|
+
style?: CSSProperties;
|
|
138
|
+
};
|
|
106
139
|
/**
|
|
107
140
|
* Component-specific props for BpkFlex
|
|
108
141
|
* Includes all Flex props except those in BpkCommonLayoutProps
|