@skyscanner/backpack-web 41.7.0-beta-v2 → 41.7.0-beta-v4

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.
@@ -2,22 +2,26 @@ import type { BpkVesselProps } from './types';
2
2
  /**
3
3
  * A "migration hatch" layout primitive designed to ease component migration.
4
4
  *
5
- * BpkVessel renders an HTML element (default: div) and only accepts
6
- * className and style props for legacy styling during migration.
5
+ * BpkVessel renders an HTML element (default: div) and accepts all standard
6
+ * HTML attributes for maximum migration flexibility.
7
7
  *
8
8
  * **When to use:**
9
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
10
11
  * - As a temporary solution while refactoring components
11
12
  *
12
13
  * **Important:**
13
14
  * - This is a temporary migration tool, not a permanent solution
14
- * - Only accepts: `as`, `className`, `style`, and `children` props
15
+ * - Accepts all React.HTMLAttributes (styling, events, aria, data-*, etc.)
16
+ * - Plan to migrate to BpkBox once legacy styling is removed
15
17
  *
16
18
  * @example
17
19
  * ```tsx
18
20
  * <BpkVessel
19
21
  * className="legacy-class"
20
22
  * style={{ padding: '16px', transition: 'opacity 0.3s' }}
23
+ * data-testid="migration-wrapper"
24
+ * onClick={handleClick}
21
25
  * >
22
26
  * Content
23
27
  * </BpkVessel>
@@ -25,12 +29,18 @@ import type { BpkVesselProps } from './types';
25
29
  * <BpkVessel
26
30
  * as="section"
27
31
  * className="legacy-section"
32
+ * aria-label="Main content"
33
+ * role="region"
34
+ * dir="rtl"
28
35
  * >
29
36
  * Section Content
30
37
  * </BpkVessel>
31
38
  * ```
32
39
  *
33
- * @returns {JSX.Element} An HTML element with className and style applied.
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.
34
44
  */
35
- export declare const BpkVessel: ({ as: Element, children, className, style, }: BpkVesselProps) => import("react/jsx-runtime").JSX.Element;
45
+ export declare const BpkVessel: ({ as: Element, children, ...restProps }: BpkVesselProps) => import("react/jsx-runtime").JSX.Element;
36
46
  export type { BpkVesselProps };
@@ -20,22 +20,26 @@ import { jsx as _jsx } from "react/jsx-runtime";
20
20
  /**
21
21
  * A "migration hatch" layout primitive designed to ease component migration.
22
22
  *
23
- * BpkVessel renders an HTML element (default: div) and only accepts
24
- * className and style props for legacy styling during migration.
23
+ * BpkVessel renders an HTML element (default: div) and accepts all standard
24
+ * HTML attributes for maximum migration flexibility.
25
25
  *
26
26
  * **When to use:**
27
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
28
29
  * - As a temporary solution while refactoring components
29
30
  *
30
31
  * **Important:**
31
32
  * - This is a temporary migration tool, not a permanent solution
32
- * - Only accepts: `as`, `className`, `style`, and `children` props
33
+ * - Accepts all React.HTMLAttributes (styling, events, aria, data-*, etc.)
34
+ * - Plan to migrate to BpkBox once legacy styling is removed
33
35
  *
34
36
  * @example
35
37
  * ```tsx
36
38
  * <BpkVessel
37
39
  * className="legacy-class"
38
40
  * style={{ padding: '16px', transition: 'opacity 0.3s' }}
41
+ * data-testid="migration-wrapper"
42
+ * onClick={handleClick}
39
43
  * >
40
44
  * Content
41
45
  * </BpkVessel>
@@ -43,24 +47,24 @@ import { jsx as _jsx } from "react/jsx-runtime";
43
47
  * <BpkVessel
44
48
  * as="section"
45
49
  * className="legacy-section"
50
+ * aria-label="Main content"
51
+ * role="region"
52
+ * dir="rtl"
46
53
  * >
47
54
  * Section Content
48
55
  * </BpkVessel>
49
56
  * ```
50
57
  *
51
- * @returns {JSX.Element} An HTML element with className and style applied.
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.
52
62
  */
53
63
  export const BpkVessel = ({
54
64
  as: Element = 'div',
55
65
  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,
66
+ ...restProps
67
+ }) => /*#__PURE__*/_jsx(Element, {
68
+ ...restProps,
65
69
  children: children
66
70
  });
@@ -1,4 +1,4 @@
1
- import type { CSSProperties, ReactNode } from 'react';
1
+ import type { 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';
@@ -111,13 +111,22 @@ export type VesselElement = 'div' | 'span' | 'section' | 'article' | 'nav' | 'ma
111
111
  * Props for BpkVessel component.
112
112
  *
113
113
  * BpkVessel is a "migration hatch" that renders an HTML element
114
- * and only accepts className and style props.
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.
115
122
  *
116
123
  * @example
117
124
  * ```tsx
118
125
  * <BpkVessel
119
126
  * className="legacy-wrapper"
120
127
  * style={{ padding: '16px', transition: 'opacity 0.3s' }}
128
+ * data-testid="migration-wrapper"
129
+ * onClick={handleClick}
121
130
  * >
122
131
  * Content
123
132
  * </BpkVessel>
@@ -125,6 +134,9 @@ export type VesselElement = 'div' | 'span' | 'section' | 'article' | 'nav' | 'ma
125
134
  * <BpkVessel
126
135
  * as="section"
127
136
  * className="legacy-section"
137
+ * aria-label="Main content"
138
+ * role="region"
139
+ * dir="rtl"
128
140
  * >
129
141
  * Section Content
130
142
  * </BpkVessel>
@@ -132,10 +144,7 @@ export type VesselElement = 'div' | 'span' | 'section' | 'article' | 'nav' | 'ma
132
144
  */
133
145
  export type BpkVesselProps = {
134
146
  as?: VesselElement;
135
- children?: ReactNode;
136
- className?: string;
137
- style?: CSSProperties;
138
- };
147
+ } & React.HTMLAttributes<HTMLElement>;
139
148
  /**
140
149
  * Component-specific props for BpkFlex
141
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-v2",
3
+ "version": "41.7.0-beta-v4",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",