@skyscanner/backpack-web 41.7.0-beta-v1 → 41.7.0-beta-v3

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,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,70 @@
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 accepts all standard
24
+ * HTML attributes for maximum migration flexibility.
25
+ *
26
+ * **When to use:**
27
+ * - During component migration when you need to maintain existing className/style usage
28
+ * - When you need to pass testing attributes (data-testid) or accessibility props
29
+ * - As a temporary solution while refactoring components
30
+ *
31
+ * **Important:**
32
+ * - This is a temporary migration tool, not a permanent solution
33
+ * - Accepts all React.HTMLAttributes (styling, events, aria, data-*, etc.)
34
+ * - Plan to migrate to BpkBox once legacy styling is removed
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * <BpkVessel
39
+ * className="legacy-class"
40
+ * style={{ padding: '16px', transition: 'opacity 0.3s' }}
41
+ * data-testid="migration-wrapper"
42
+ * onClick={handleClick}
43
+ * >
44
+ * Content
45
+ * </BpkVessel>
46
+ *
47
+ * <BpkVessel
48
+ * as="section"
49
+ * className="legacy-section"
50
+ * aria-label="Main content"
51
+ * role="region"
52
+ * dir="rtl"
53
+ * >
54
+ * Section Content
55
+ * </BpkVessel>
56
+ * ```
57
+ *
58
+ * @todo Migration component - pending removal after component migration is complete.
59
+ * Replace usages with BpkBox once legacy className/style dependencies are refactored.
60
+ *
61
+ * @returns {JSX.Element} An HTML element with all props applied.
62
+ */
63
+ export const BpkVessel = ({
64
+ as: Element = 'div',
65
+ children,
66
+ ...restProps
67
+ }) => /*#__PURE__*/_jsx(Element, {
68
+ ...restProps,
69
+ children: children
70
+ });
@@ -103,6 +103,48 @@ 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 accepts all standard HTML attributes for maximum migration flexibility.
115
+ *
116
+ * Accepts all React.HTMLAttributes including:
117
+ * - Styling: className, style
118
+ * - Testing: data-testid, data-cy, data-*
119
+ * - Accessibility: aria-*, role, tabIndex
120
+ * - Basic HTML: id, title, dir, lang, hidden, etc.
121
+ * - All standard DOM events: onClick, onChange, onFocus, etc.
122
+ *
123
+ * @example
124
+ * ```tsx
125
+ * <BpkVessel
126
+ * className="legacy-wrapper"
127
+ * style={{ padding: '16px', transition: 'opacity 0.3s' }}
128
+ * data-testid="migration-wrapper"
129
+ * onClick={handleClick}
130
+ * >
131
+ * Content
132
+ * </BpkVessel>
133
+ *
134
+ * <BpkVessel
135
+ * as="section"
136
+ * className="legacy-section"
137
+ * aria-label="Main content"
138
+ * role="region"
139
+ * dir="rtl"
140
+ * >
141
+ * Section Content
142
+ * </BpkVessel>
143
+ * ```
144
+ */
145
+ export type BpkVesselProps = {
146
+ as?: VesselElement;
147
+ } & React.HTMLAttributes<HTMLElement>;
106
148
  /**
107
149
  * Component-specific props for BpkFlex
108
150
  * Includes all Flex props except those in BpkCommonLayoutProps
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "41.7.0-beta-v1",
3
+ "version": "41.7.0-beta-v3",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",