@skyscanner/backpack-web 41.7.0-beta-v2 → 41.8.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.
Files changed (37) hide show
  1. package/bpk-component-chip-group/src/BpkMultiSelectChipGroup.js +3 -2
  2. package/bpk-component-icon/src/withDescription.js +3 -5
  3. package/bpk-component-info-banner/src/BpkInfoBannerInner.js +2 -2
  4. package/bpk-component-theme-toggle/src/BpkThemeToggle.js +2 -5
  5. package/bpk-component-visually-hidden/index.d.ts +3 -0
  6. package/{bpk-component-theme-toggle/src/BpkThemeToggle.module.css → bpk-component-visually-hidden/index.js} +7 -5
  7. package/bpk-component-visually-hidden/src/BpkVisuallyHidden.d.ts +8 -0
  8. package/{bpk-component-layout/src/BpkGridItem.js → bpk-component-visually-hidden/src/BpkVisuallyHidden.js} +18 -25
  9. package/{bpk-component-icon/src/withDescription.module.css → bpk-component-visually-hidden/src/BpkVisuallyHidden.module.css} +1 -1
  10. package/package.json +1 -2
  11. package/bpk-component-layout/index.d.ts +0 -18
  12. package/bpk-component-layout/index.js +0 -29
  13. package/bpk-component-layout/src/BpkBox.d.ts +0 -3
  14. package/bpk-component-layout/src/BpkBox.js +0 -33
  15. package/bpk-component-layout/src/BpkFlex.d.ts +0 -3
  16. package/bpk-component-layout/src/BpkFlex.js +0 -51
  17. package/bpk-component-layout/src/BpkGrid.d.ts +0 -3
  18. package/bpk-component-layout/src/BpkGrid.js +0 -57
  19. package/bpk-component-layout/src/BpkGridItem.d.ts +0 -3
  20. package/bpk-component-layout/src/BpkProvider.d.ts +0 -14
  21. package/bpk-component-layout/src/BpkProvider.js +0 -42
  22. package/bpk-component-layout/src/BpkStack.constant.d.ts +0 -2
  23. package/bpk-component-layout/src/BpkStack.constant.js +0 -22
  24. package/bpk-component-layout/src/BpkStack.d.ts +0 -5
  25. package/bpk-component-layout/src/BpkStack.js +0 -57
  26. package/bpk-component-layout/src/BpkVessel.d.ts +0 -36
  27. package/bpk-component-layout/src/BpkVessel.js +0 -66
  28. package/bpk-component-layout/src/commonProps.d.ts +0 -86
  29. package/bpk-component-layout/src/commonProps.js +0 -1
  30. package/bpk-component-layout/src/theme.d.ts +0 -36
  31. package/bpk-component-layout/src/theme.js +0 -229
  32. package/bpk-component-layout/src/tokenUtils.d.ts +0 -108
  33. package/bpk-component-layout/src/tokenUtils.js +0 -323
  34. package/bpk-component-layout/src/tokens.d.ts +0 -96
  35. package/bpk-component-layout/src/tokens.js +0 -138
  36. package/bpk-component-layout/src/types.d.ts +0 -227
  37. package/bpk-component-layout/src/types.js +0 -1
@@ -1,227 +0,0 @@
1
- import type { CSSProperties, ReactNode } from 'react';
2
- import type StackOptionKeys from './BpkStack.constant';
3
- import type { BpkCommonLayoutProps } from './commonProps';
4
- import type { BpkSpacingValue, BpkResponsiveValue, BpkBasisValue } from './tokens';
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
- * by default. BpkBox will reintroduce a minimal subset (onClick, onFocus,
9
- * onBlur) explicitly on its own props type.
10
- */
11
- type LayoutEventProps = 'onClick' | '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';
19
- /**
20
- * Flexbox & grid layout props that we explicitly support on Backpack layout
21
- * components. These are a curated subset of the underlying Box flex/grid API
22
- * that are useful for structural layout.
23
- */
24
- export interface BpkFlexGridProps {
25
- display?: BoxProps['display'];
26
- flexDirection?: BoxProps['flexDirection'];
27
- flexWrap?: BoxProps['flexWrap'];
28
- justifyContent?: BoxProps['justifyContent'];
29
- alignItems?: BoxProps['alignItems'];
30
- alignContent?: BoxProps['alignContent'];
31
- flex?: BoxProps['flex'];
32
- flexGrow?: BoxProps['flexGrow'];
33
- flexShrink?: BoxProps['flexShrink'];
34
- flexBasis?: BoxProps['flexBasis'];
35
- order?: BoxProps['order'];
36
- alignSelf?: BoxProps['alignSelf'];
37
- justifySelf?: BoxProps['justifySelf'];
38
- gridTemplateColumns?: BoxProps['gridTemplateColumns'];
39
- gridTemplateRows?: BoxProps['gridTemplateRows'];
40
- gridTemplateAreas?: BoxProps['gridTemplateAreas'];
41
- gridAutoFlow?: BoxProps['gridAutoFlow'];
42
- gridAutoRows?: BoxProps['gridAutoRows'];
43
- gridAutoColumns?: BoxProps['gridAutoColumns'];
44
- rowGap?: BoxProps['rowGap'];
45
- columnGap?: BoxProps['columnGap'];
46
- }
47
- export type FlexGridPropKeys = keyof BpkFlexGridProps;
48
- /**
49
- * Curated subset of Box layout props that support Backpack responsive values.
50
- *
51
- * NOTE:
52
- * - These are structural layout props (flex/grid/display) that we want to allow
53
- * on `BpkBox`, but using Backpack breakpoint keys rather than Chakra's
54
- * array syntax or Chakra breakpoint keys.
55
- * - Spacing/size/position props are handled separately via `BpkCommonLayoutProps`.
56
- */
57
- type BpkBoxResponsiveLayoutProps = {
58
- display?: BpkResponsiveValue<BoxProps['display']>;
59
- flexDirection?: BpkResponsiveValue<BoxProps['flexDirection']>;
60
- flexWrap?: BpkResponsiveValue<BoxProps['flexWrap']>;
61
- justifyContent?: BpkResponsiveValue<BoxProps['justifyContent']>;
62
- alignItems?: BpkResponsiveValue<BoxProps['alignItems']>;
63
- alignContent?: BpkResponsiveValue<BoxProps['alignContent']>;
64
- flex?: BpkResponsiveValue<BoxProps['flex']>;
65
- flexGrow?: BpkResponsiveValue<BoxProps['flexGrow']>;
66
- flexShrink?: BpkResponsiveValue<BoxProps['flexShrink']>;
67
- flexBasis?: BpkResponsiveValue<BoxProps['flexBasis']>;
68
- order?: BpkResponsiveValue<BoxProps['order']>;
69
- alignSelf?: BpkResponsiveValue<BoxProps['alignSelf']>;
70
- justifySelf?: BpkResponsiveValue<BoxProps['justifySelf']>;
71
- gridTemplateColumns?: BpkResponsiveValue<BoxProps['gridTemplateColumns']>;
72
- gridTemplateRows?: BpkResponsiveValue<BoxProps['gridTemplateRows']>;
73
- gridTemplateAreas?: BpkResponsiveValue<BoxProps['gridTemplateAreas']>;
74
- gridAutoFlow?: BpkResponsiveValue<BoxProps['gridAutoFlow']>;
75
- gridAutoRows?: BpkResponsiveValue<BoxProps['gridAutoRows']>;
76
- gridAutoColumns?: BpkResponsiveValue<BoxProps['gridAutoColumns']>;
77
- gridColumn?: BpkResponsiveValue<BoxProps['gridColumn']>;
78
- gridRow?: BpkResponsiveValue<BoxProps['gridRow']>;
79
- };
80
- type BpkBoxResponsiveLayoutPropKeys = keyof BpkBoxResponsiveLayoutProps;
81
- /**
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
91
- */
92
- export interface BpkBoxSpecificProps extends Omit<RemoveCommonProps<BoxProps>, BpkBoxResponsiveLayoutPropKeys>, BpkBoxResponsiveLayoutProps, Omit<BpkFlexGridProps, BpkBoxResponsiveLayoutPropKeys> {
93
- }
94
- /**
95
- * Props for BpkBox component
96
- * Combines Box-specific props with Backpack common layout props
97
- * and reintroduces a minimal set of interaction props.
98
- */
99
- type BoxEventProps = Pick<BoxProps, 'onClick' | 'onFocus' | 'onBlur'>;
100
- export interface BpkBoxProps extends BpkCommonLayoutProps, BpkBoxSpecificProps {
101
- children?: ReactNode;
102
- onClick?: BoxEventProps['onClick'];
103
- onFocus?: BoxEventProps['onFocus'];
104
- onBlur?: BoxEventProps['onBlur'];
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
- };
139
- /**
140
- * Component-specific props for BpkFlex
141
- * Includes all Flex props except those in BpkCommonLayoutProps
142
- */
143
- export interface BpkFlexSpecificProps extends RemoveCommonProps<FlexProps> {
144
- direction?: BpkResponsiveValue<FlexProps['flexDirection']>;
145
- justify?: BpkResponsiveValue<FlexProps['justifyContent']>;
146
- align?: BpkResponsiveValue<FlexProps['alignItems']>;
147
- wrap?: BpkResponsiveValue<FlexProps['flexWrap']>;
148
- grow?: BpkResponsiveValue<FlexProps['flexGrow']>;
149
- shrink?: BpkResponsiveValue<FlexProps['flexShrink']>;
150
- basis?: BpkResponsiveValue<BpkBasisValue>;
151
- inline?: boolean;
152
- }
153
- /**
154
- * Props for BpkFlex component
155
- * Combines Flex-specific props with Backpack common layout props
156
- */
157
- export interface BpkFlexProps extends BpkCommonLayoutProps, BpkFlexSpecificProps {
158
- children?: ReactNode;
159
- }
160
- /**
161
- * Component-specific props for BpkGrid
162
- * Includes all Grid props except those in BpkCommonLayoutProps
163
- */
164
- export interface BpkGridSpecificProps extends RemoveCommonProps<GridProps> {
165
- justify?: BpkResponsiveValue<GridProps['justifyContent']>;
166
- align?: BpkResponsiveValue<GridProps['alignItems']>;
167
- templateColumns?: BpkResponsiveValue<GridProps['gridTemplateColumns']>;
168
- templateRows?: BpkResponsiveValue<GridProps['gridTemplateRows']>;
169
- templateAreas?: BpkResponsiveValue<GridProps['gridTemplateAreas']>;
170
- autoFlow?: BpkResponsiveValue<GridProps['gridAutoFlow']>;
171
- autoRows?: BpkResponsiveValue<GridProps['gridAutoRows']>;
172
- autoColumns?: BpkResponsiveValue<GridProps['gridAutoColumns']>;
173
- rowGap?: BpkResponsiveValue<BpkSpacingValue>;
174
- columnGap?: BpkResponsiveValue<BpkSpacingValue>;
175
- column?: BpkResponsiveValue<GridProps['gridColumn']>;
176
- row?: BpkResponsiveValue<GridProps['gridRow']>;
177
- inline?: boolean;
178
- }
179
- /**
180
- * Props for BpkGrid component
181
- * Combines Grid-specific props with Backpack common layout props
182
- */
183
- export interface BpkGridProps extends BpkCommonLayoutProps, BpkGridSpecificProps {
184
- children?: ReactNode;
185
- }
186
- /**
187
- * Component-specific props for BpkGridItem
188
- * Includes all GridItem props except those in BpkCommonLayoutProps
189
- */
190
- export interface BpkGridItemSpecificProps extends RemoveCommonProps<GridItemProps> {
191
- area?: GridItemProps['area'];
192
- colEnd?: GridItemProps['colEnd'];
193
- colStart?: GridItemProps['colStart'];
194
- colSpan?: GridItemProps['colSpan'];
195
- rowEnd?: GridItemProps['rowEnd'];
196
- rowStart?: GridItemProps['rowStart'];
197
- rowSpan?: GridItemProps['rowSpan'];
198
- }
199
- /**
200
- * Props for BpkGridItem component
201
- * Combines GridItem-specific props with Backpack common layout props
202
- */
203
- export interface BpkGridItemProps extends BpkCommonLayoutProps, BpkGridItemSpecificProps {
204
- children?: ReactNode;
205
- }
206
- type StackOptionKeysType = typeof StackOptionKeys[number];
207
- /**
208
- * Overrides StackOptions to support BpkResponsiveValue
209
- */
210
- type BpkStackOptions = {
211
- [K in StackOptionKeysType]?: K extends keyof StackProps ? BpkResponsiveValue<StackProps[K]> | StackProps[K] : never;
212
- };
213
- /**
214
- * Component-specific props for BpkStack
215
- * Includes all Stack props except those in BpkCommonLayoutProps
216
- * Overrides StackOptions to support BpkResponsiveValue
217
- */
218
- export interface BpkStackSpecificProps extends Omit<RemoveCommonProps<StackProps>, StackOptionKeysType>, BpkStackOptions, BpkFlexGridProps {
219
- }
220
- /**
221
- * Props for BpkStack component
222
- * Combines Stack-specific props with Backpack common layout props
223
- */
224
- export interface BpkStackProps extends BpkCommonLayoutProps, BpkStackSpecificProps {
225
- children?: ReactNode;
226
- }
227
- export type { BpkCommonLayoutProps };
@@ -1 +0,0 @@
1
- export {};