@skyscanner/backpack-web 42.26.0 → 42.27.0

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.
@@ -3,6 +3,19 @@ import type StackOptionKeys from './BpkStack.constant';
3
3
  import type { BpkCommonLayoutProps } from './commonProps';
4
4
  import type { BpkSpacingValue, BpkResponsiveValue, BpkBasisValue } from './tokens';
5
5
  import type { BoxProps, FlexProps, GridProps, GridItemProps, StackProps } from '@chakra-ui/react';
6
+ /**
7
+ * Layout-level event props that should not be exposed on layout components.
8
+ * onClick is handled via BpkCommonLayoutProps; onFocus/onBlur are reintroduced
9
+ * on BpkBoxProps only.
10
+ */
11
+ type LayoutEventProps = 'onMouseEnter' | 'onMouseLeave' | 'onMouseOver' | 'onMouseOut' | 'onMouseDown' | 'onMouseUp' | 'onFocus' | 'onBlur' | 'onKeyDown' | 'onKeyUp' | 'onKeyPress';
12
+ /**
13
+ * Shorthand props from the underlying layout system that we do NOT expose on
14
+ * Backpack layout components. These mostly mirror longer-form spacing,
15
+ * sizing and visual props that we already model explicitly via
16
+ * BpkCommonLayoutProps and BpkFlexGridProps.
17
+ */
18
+ type DisallowedShorthandProps = 'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'm' | 'mt' | 'mr' | 'mb' | 'ml' | 'mx' | 'my' | 'w' | 'h' | 'minW' | 'maxW' | 'minH' | 'maxH' | 'bg' | 'rounded' | 'shadow';
6
19
  /**
7
20
  * Flexbox & grid layout props that we explicitly support on Backpack layout
8
21
  * components. These are a curated subset of the underlying Box flex/grid API
@@ -66,10 +79,17 @@ type BpkBoxResponsiveLayoutProps = {
66
79
  };
67
80
  type BpkBoxResponsiveLayoutPropKeys = keyof BpkBoxResponsiveLayoutProps;
68
81
  /**
69
- * Component-specific props for BpkBox.
70
- * Explicit allowlist does NOT inherit from Chakra BoxProps.
82
+ * Base type that removes common layout props, reserved props (className,
83
+ * children) and all layout-level event props from Chakra UI props.
84
+ *
85
+ * These will be replaced with Backpack-specific types.
86
+ */
87
+ export type RemoveCommonProps<T> = Omit<T, keyof BpkCommonLayoutProps | 'className' | 'children' | LayoutEventProps | FlexGridPropKeys | DisallowedShorthandProps>;
88
+ /**
89
+ * Component-specific props for BpkBox
90
+ * Includes all Box props except those in BpkCommonLayoutProps
71
91
  */
72
- export interface BpkBoxSpecificProps extends BpkBoxResponsiveLayoutProps, Omit<BpkFlexGridProps, BpkBoxResponsiveLayoutPropKeys> {
92
+ export interface BpkBoxSpecificProps extends Omit<RemoveCommonProps<BoxProps>, BpkBoxResponsiveLayoutPropKeys>, BpkBoxResponsiveLayoutProps, Omit<BpkFlexGridProps, BpkBoxResponsiveLayoutPropKeys> {
73
93
  }
74
94
  /**
75
95
  * Props for BpkBox component
@@ -127,10 +147,10 @@ export type BpkVesselProps = {
127
147
  as?: VesselElement;
128
148
  } & HTMLAttributes<HTMLElement>;
129
149
  /**
130
- * Component-specific props for BpkFlex.
131
- * Explicit allowlist does NOT inherit from Chakra FlexProps.
150
+ * Component-specific props for BpkFlex
151
+ * Includes all Flex props except those in BpkCommonLayoutProps
132
152
  */
133
- export interface BpkFlexSpecificProps {
153
+ export interface BpkFlexSpecificProps extends RemoveCommonProps<FlexProps> {
134
154
  direction?: BpkResponsiveValue<FlexProps['flexDirection']>;
135
155
  justify?: BpkResponsiveValue<FlexProps['justifyContent']>;
136
156
  align?: BpkResponsiveValue<FlexProps['alignItems']>;
@@ -148,10 +168,10 @@ export interface BpkFlexProps extends BpkCommonLayoutProps, BpkFlexSpecificProps
148
168
  children?: ReactNode;
149
169
  }
150
170
  /**
151
- * Component-specific props for BpkGrid.
152
- * Explicit allowlist does NOT inherit from Chakra GridProps.
171
+ * Component-specific props for BpkGrid
172
+ * Includes all Grid props except those in BpkCommonLayoutProps
153
173
  */
154
- export interface BpkGridSpecificProps {
174
+ export interface BpkGridSpecificProps extends RemoveCommonProps<GridProps> {
155
175
  justify?: BpkResponsiveValue<GridProps['justifyContent']>;
156
176
  align?: BpkResponsiveValue<GridProps['alignItems']>;
157
177
  templateColumns?: BpkResponsiveValue<GridProps['gridTemplateColumns']>;
@@ -174,10 +194,10 @@ export interface BpkGridProps extends BpkCommonLayoutProps, BpkGridSpecificProps
174
194
  children?: ReactNode;
175
195
  }
176
196
  /**
177
- * Component-specific props for BpkGridItem.
178
- * Explicit allowlist does NOT inherit from Chakra GridItemProps.
197
+ * Component-specific props for BpkGridItem
198
+ * Includes all GridItem props except those in BpkCommonLayoutProps
179
199
  */
180
- export interface BpkGridItemSpecificProps {
200
+ export interface BpkGridItemSpecificProps extends RemoveCommonProps<GridItemProps> {
181
201
  area?: GridItemProps['area'];
182
202
  colEnd?: GridItemProps['colEnd'];
183
203
  colStart?: GridItemProps['colStart'];
@@ -201,17 +221,13 @@ type BpkStackOptions = {
201
221
  [K in StackOptionKeysType]?: K extends keyof StackProps ? BpkResponsiveValue<StackProps[K]> | StackProps[K] : never;
202
222
  };
203
223
  /**
204
- * Component-specific props for BpkStack.
205
- * Explicit allowlist does NOT inherit from Chakra StackProps.
224
+ * Component-specific props for BpkStack
225
+ * Includes all Stack props except those in BpkCommonLayoutProps
206
226
  * Overrides StackOptions to support BpkResponsiveValue.
207
227
  * `alignItems` and `justifyContent` are accepted as semantic aliases for `align` and `justify`.
208
228
  * If both are provided, `align`/`justify` take precedence.
209
- *
210
- * `alignItems` and `justifyContent` are explicitly omitted from `BpkFlexGridProps` here so
211
- * that the responsive alias declarations below (which match BpkStackOptions) unambiguously
212
- * replace the non-responsive `BoxProps` variants from `BpkFlexGridProps`.
213
229
  */
214
- export interface BpkStackSpecificProps extends BpkStackOptions, Omit<BpkFlexGridProps, 'alignItems' | 'justifyContent'> {
230
+ export interface BpkStackSpecificProps extends Omit<RemoveCommonProps<StackProps>, StackOptionKeysType>, BpkStackOptions, Omit<BpkFlexGridProps, 'alignItems' | 'justifyContent'> {
215
231
  /** Alias for `align`. Maps to CSS `align-items`. Responsive — replaces the non-responsive BpkFlexGridProps.alignItems. */
216
232
  alignItems?: BpkStackOptions['align'];
217
233
  /** Alias for `justify`. Maps to CSS `justify-content`. Responsive — replaces the non-responsive BpkFlexGridProps.justifyContent. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "42.26.0",
3
+ "version": "42.27.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",