@skyscanner/backpack-web 42.3.0 → 42.4.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.
- package/bpk-component-floating-notification/src/BpkFloatingNotification.module.css +1 -1
- package/bpk-component-layout/src/BpkBox.d.ts +1 -1
- package/bpk-component-layout/src/BpkBox.js +6 -3
- package/bpk-component-layout/src/BpkFlex.d.ts +1 -1
- package/bpk-component-layout/src/BpkFlex.js +8 -3
- package/bpk-component-layout/src/BpkGrid.d.ts +1 -1
- package/bpk-component-layout/src/BpkGrid.js +8 -3
- package/bpk-component-layout/src/BpkGridItem.d.ts +1 -1
- package/bpk-component-layout/src/BpkGridItem.js +14 -5
- package/bpk-component-layout/src/BpkStack.d.ts +3 -3
- package/bpk-component-layout/src/BpkStack.js +16 -9
- package/bpk-component-layout/src/commonProps.d.ts +10 -3
- package/bpk-component-layout/src/theme.js +239 -3
- package/bpk-component-layout/src/tokenUtils.d.ts +1 -1
- package/bpk-component-layout/src/tokenUtils.js +9 -3
- package/bpk-component-layout/src/types.d.ts +9 -8
- package/package.json +1 -1
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-floating-notification{position:fixed;right:0;bottom:2rem;left:0;display:flex;z-index:2;max-width:25rem;margin:auto;padding:1.5rem;align-items:center;transition:opacity 400ms ease-in-out,transform 400ms ease-in-out;border-radius:.75rem;background:#05203c;color:#fff;box-shadow:0px 12px 50px 0px rgba(37,32,31,.25),0px 4px 14px 0px rgba(37,32,31,.25)}@media(max-width: 32rem){.bpk-floating-notification{max-width:100%;padding:1rem}}.bpk-floating-notification--critical{background-color:#e70866}.bpk-floating-notification--leave{transform:translateY(0);opacity:1}.bpk-floating-notification--leave-active{transform:translateY(2rem);opacity:0}.bpk-floating-notification--leave-done{opacity:0}.bpk-floating-notification--appear{transform:translateY(2rem);opacity:0}.bpk-floating-notification--appear-active{transform:translateY(0);opacity:1}.bpk-floating-notification__icon{margin-right:.5rem;margin-left:.25rem;flex-shrink:0;transform:translateY(0.25rem);text-align:bottom;fill
|
|
18
|
+
.bpk-floating-notification{position:fixed;right:0;bottom:2rem;left:0;display:flex;z-index:2;max-width:25rem;margin:auto;padding:1.5rem;align-items:center;transition:opacity 400ms ease-in-out,transform 400ms ease-in-out;border-radius:.75rem;background:#05203c;color:#fff;box-shadow:0px 12px 50px 0px rgba(37,32,31,.25),0px 4px 14px 0px rgba(37,32,31,.25)}@media(max-width: 32rem){.bpk-floating-notification{max-width:100%;padding:1rem}}.bpk-floating-notification--critical{background-color:#e70866;color:#fff}.bpk-floating-notification--leave{transform:translateY(0);opacity:1}.bpk-floating-notification--leave-active{transform:translateY(2rem);opacity:0}.bpk-floating-notification--leave-done{opacity:0}.bpk-floating-notification--appear{transform:translateY(2rem);opacity:0}.bpk-floating-notification--appear-active{transform:translateY(0);opacity:1}.bpk-floating-notification__icon{margin-right:.5rem;margin-left:.25rem;flex-shrink:0;transform:translateY(0.25rem);text-align:bottom;fill:currentcolor}.bpk-floating-notification__text{margin-inline-end:.5rem}.bpk-floating-notification__cta{margin-inline-start:auto}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { BpkBoxProps } from './types';
|
|
2
|
-
export declare const BpkBox: (
|
|
2
|
+
export declare const BpkBox: import("react").ForwardRefExoticComponent<BpkBoxProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
3
|
export type { BpkBoxProps };
|
|
@@ -16,20 +16,23 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { forwardRef } from 'react';
|
|
19
20
|
import { Box } from '@chakra-ui/react';
|
|
20
21
|
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
22
|
import { processBpkComponentProps } from "./tokenUtils";
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
export const BpkBox = ({
|
|
24
|
+
export const BpkBox = /*#__PURE__*/forwardRef(({
|
|
24
25
|
children,
|
|
25
26
|
...props
|
|
26
|
-
}) => {
|
|
27
|
+
}, ref) => {
|
|
27
28
|
const processedProps = processBpkComponentProps(props, {
|
|
28
29
|
component: 'BpkBox'
|
|
29
30
|
});
|
|
30
31
|
return /*#__PURE__*/_jsx(Box, {
|
|
32
|
+
ref: ref,
|
|
31
33
|
...getDataComponentAttribute('Box'),
|
|
32
34
|
...processedProps,
|
|
33
35
|
children: children
|
|
34
36
|
});
|
|
35
|
-
};
|
|
37
|
+
});
|
|
38
|
+
BpkBox.displayName = 'BpkBox';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { BpkFlexProps } from './types';
|
|
2
|
-
export declare const BpkFlex: (
|
|
2
|
+
export declare const BpkFlex: import("react").ForwardRefExoticComponent<BpkFlexProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
3
|
export type { BpkFlexProps };
|
|
@@ -16,11 +16,12 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { forwardRef } from 'react';
|
|
19
20
|
import { Flex } from '@chakra-ui/react';
|
|
20
21
|
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
22
|
import { processBpkComponentProps } from "./tokenUtils";
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
export const BpkFlex = ({
|
|
24
|
+
export const BpkFlex = /*#__PURE__*/forwardRef(({
|
|
24
25
|
align,
|
|
25
26
|
basis,
|
|
26
27
|
children,
|
|
@@ -29,12 +30,14 @@ export const BpkFlex = ({
|
|
|
29
30
|
inline,
|
|
30
31
|
justify,
|
|
31
32
|
shrink,
|
|
33
|
+
textStyle,
|
|
32
34
|
wrap,
|
|
33
35
|
...props
|
|
34
|
-
}) => {
|
|
36
|
+
}, ref) => {
|
|
35
37
|
const processedProps = processBpkComponentProps(props, {
|
|
36
38
|
component: 'BpkFlex',
|
|
37
39
|
responsiveProps: {
|
|
40
|
+
textStyle,
|
|
38
41
|
flexDirection: direction,
|
|
39
42
|
justifyContent: justify,
|
|
40
43
|
alignItems: align,
|
|
@@ -45,9 +48,11 @@ export const BpkFlex = ({
|
|
|
45
48
|
}
|
|
46
49
|
});
|
|
47
50
|
return /*#__PURE__*/_jsx(Flex, {
|
|
51
|
+
ref: ref,
|
|
48
52
|
...getDataComponentAttribute('Flex'),
|
|
49
53
|
...processedProps,
|
|
50
54
|
display: inline ? 'inline-flex' : undefined,
|
|
51
55
|
children: children
|
|
52
56
|
});
|
|
53
|
-
};
|
|
57
|
+
});
|
|
58
|
+
BpkFlex.displayName = 'BpkFlex';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { BpkGridProps } from './types';
|
|
2
|
-
export declare const BpkGrid: (
|
|
2
|
+
export declare const BpkGrid: import("react").ForwardRefExoticComponent<BpkGridProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
3
|
export type { BpkGridProps };
|
|
@@ -16,11 +16,12 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { forwardRef } from 'react';
|
|
19
20
|
import { Grid } from '@chakra-ui/react';
|
|
20
21
|
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
22
|
import { processBpkComponentProps } from "./tokenUtils";
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
export const BpkGrid = ({
|
|
24
|
+
export const BpkGrid = /*#__PURE__*/forwardRef(({
|
|
24
25
|
align,
|
|
25
26
|
autoColumns,
|
|
26
27
|
autoFlow,
|
|
@@ -33,11 +34,13 @@ export const BpkGrid = ({
|
|
|
33
34
|
templateAreas,
|
|
34
35
|
templateColumns,
|
|
35
36
|
templateRows,
|
|
37
|
+
textStyle,
|
|
36
38
|
...props
|
|
37
|
-
}) => {
|
|
39
|
+
}, ref) => {
|
|
38
40
|
const processedProps = processBpkComponentProps(props, {
|
|
39
41
|
component: 'BpkGrid',
|
|
40
42
|
responsiveProps: {
|
|
43
|
+
textStyle,
|
|
41
44
|
justifyContent: justify,
|
|
42
45
|
alignItems: align,
|
|
43
46
|
gridTemplateColumns: templateColumns,
|
|
@@ -51,9 +54,11 @@ export const BpkGrid = ({
|
|
|
51
54
|
}
|
|
52
55
|
});
|
|
53
56
|
return /*#__PURE__*/_jsx(Grid, {
|
|
57
|
+
ref: ref,
|
|
54
58
|
...getDataComponentAttribute('Grid'),
|
|
55
59
|
...processedProps,
|
|
56
60
|
display: inline ? 'inline-grid' : undefined,
|
|
57
61
|
children: children
|
|
58
62
|
});
|
|
59
|
-
};
|
|
63
|
+
});
|
|
64
|
+
BpkGrid.displayName = 'BpkGrid';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { BpkGridItemProps } from './types';
|
|
2
|
-
export declare const BpkGridItem: (
|
|
2
|
+
export declare const BpkGridItem: import("react").ForwardRefExoticComponent<BpkGridItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
3
|
export type { BpkGridItemProps };
|
|
@@ -16,11 +16,12 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { forwardRef } from 'react';
|
|
19
20
|
import { GridItem } from '@chakra-ui/react';
|
|
20
21
|
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
|
-
import {
|
|
22
|
+
import { processBpkComponentProps } from "./tokenUtils";
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
export const BpkGridItem = ({
|
|
24
|
+
export const BpkGridItem = /*#__PURE__*/forwardRef(({
|
|
24
25
|
area,
|
|
25
26
|
children,
|
|
26
27
|
colEnd,
|
|
@@ -29,10 +30,17 @@ export const BpkGridItem = ({
|
|
|
29
30
|
rowEnd,
|
|
30
31
|
rowSpan,
|
|
31
32
|
rowStart,
|
|
33
|
+
textStyle,
|
|
32
34
|
...props
|
|
33
|
-
}) => {
|
|
34
|
-
const processedProps =
|
|
35
|
+
}, ref) => {
|
|
36
|
+
const processedProps = processBpkComponentProps({
|
|
37
|
+
textStyle,
|
|
38
|
+
...props
|
|
39
|
+
}, {
|
|
40
|
+
component: 'BpkGridItem'
|
|
41
|
+
});
|
|
35
42
|
return /*#__PURE__*/_jsx(GridItem, {
|
|
43
|
+
ref: ref,
|
|
36
44
|
...getDataComponentAttribute('GridItem'),
|
|
37
45
|
...processedProps,
|
|
38
46
|
area: area,
|
|
@@ -44,4 +52,5 @@ export const BpkGridItem = ({
|
|
|
44
52
|
rowSpan: rowSpan,
|
|
45
53
|
children: children
|
|
46
54
|
});
|
|
47
|
-
};
|
|
55
|
+
});
|
|
56
|
+
BpkGridItem.displayName = 'BpkGridItem';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BpkStackProps } from './types';
|
|
2
|
-
export declare const BpkStack: (
|
|
3
|
-
export declare const BpkHStack: (
|
|
4
|
-
export declare const BpkVStack: (
|
|
2
|
+
export declare const BpkStack: import("react").ForwardRefExoticComponent<BpkStackProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
|
+
export declare const BpkHStack: import("react").ForwardRefExoticComponent<BpkStackProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
+
export declare const BpkVStack: import("react").ForwardRefExoticComponent<BpkStackProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export type { BpkStackProps };
|
|
@@ -16,46 +16,53 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { forwardRef } from 'react';
|
|
19
20
|
import { Stack, VStack, HStack } from '@chakra-ui/react';
|
|
20
21
|
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
22
|
import { processBpkComponentProps } from "./tokenUtils";
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
export const BpkStack = ({
|
|
24
|
+
export const BpkStack = /*#__PURE__*/forwardRef(({
|
|
24
25
|
children,
|
|
25
26
|
...props
|
|
26
|
-
}) => {
|
|
27
|
+
}, ref) => {
|
|
27
28
|
const processedProps = processBpkComponentProps(props, {
|
|
28
29
|
component: 'BpkStack'
|
|
29
30
|
});
|
|
30
31
|
return /*#__PURE__*/_jsx(Stack, {
|
|
32
|
+
ref: ref,
|
|
31
33
|
...getDataComponentAttribute('Stack'),
|
|
32
34
|
...processedProps,
|
|
33
35
|
children: children
|
|
34
36
|
});
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
+
});
|
|
38
|
+
BpkStack.displayName = 'BpkStack';
|
|
39
|
+
export const BpkHStack = /*#__PURE__*/forwardRef(({
|
|
37
40
|
children,
|
|
38
41
|
...props
|
|
39
|
-
}) => {
|
|
42
|
+
}, ref) => {
|
|
40
43
|
const processedProps = processBpkComponentProps(props, {
|
|
41
44
|
component: 'BpkStack'
|
|
42
45
|
});
|
|
43
46
|
return /*#__PURE__*/_jsx(HStack, {
|
|
47
|
+
ref: ref,
|
|
44
48
|
...getDataComponentAttribute('HStack'),
|
|
45
49
|
...processedProps,
|
|
46
50
|
children: children
|
|
47
51
|
});
|
|
48
|
-
};
|
|
49
|
-
|
|
52
|
+
});
|
|
53
|
+
BpkHStack.displayName = 'BpkHStack';
|
|
54
|
+
export const BpkVStack = /*#__PURE__*/forwardRef(({
|
|
50
55
|
children,
|
|
51
56
|
...props
|
|
52
|
-
}) => {
|
|
57
|
+
}, ref) => {
|
|
53
58
|
const processedProps = processBpkComponentProps(props, {
|
|
54
59
|
component: 'BpkStack'
|
|
55
60
|
});
|
|
56
61
|
return /*#__PURE__*/_jsx(VStack, {
|
|
62
|
+
ref: ref,
|
|
57
63
|
...getDataComponentAttribute('VStack'),
|
|
58
64
|
...processedProps,
|
|
59
65
|
children: children
|
|
60
66
|
});
|
|
61
|
-
};
|
|
67
|
+
});
|
|
68
|
+
BpkVStack.displayName = 'BpkVStack';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { AriaRole, KeyboardEventHandler, MouseEventHandler } from 'react';
|
|
1
2
|
import type { BpkSpacingValue, BpkSizeValue, BpkPositionValue, BpkResponsiveValue } from './tokens';
|
|
3
|
+
import type { TextStyle } from '../../bpk-component-text/src/BpkText';
|
|
2
4
|
/**
|
|
3
5
|
* Common spacing-related props shared by all Backpack layout components
|
|
4
6
|
* All spacing props must use Backpack spacing tokens or percentages
|
|
@@ -39,13 +41,18 @@ export interface BpkSpacingProps {
|
|
|
39
41
|
* layout components purely structural.
|
|
40
42
|
*
|
|
41
43
|
* NOTE:
|
|
42
|
-
* - Layout components
|
|
43
|
-
*
|
|
44
|
-
*
|
|
44
|
+
* - Layout components expose onClick, tabIndex and role to support interactive
|
|
45
|
+
* container patterns (e.g. clickable cards, landmark regions).
|
|
46
|
+
* - BpkBox additionally exposes onFocus and onBlur on its own props type.
|
|
45
47
|
*/
|
|
46
48
|
export interface BpkCommonLayoutProps extends BpkSpacingProps {
|
|
47
49
|
className?: never;
|
|
48
50
|
style?: never;
|
|
51
|
+
tabIndex?: number;
|
|
52
|
+
role?: AriaRole;
|
|
53
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
54
|
+
onKeyDown?: KeyboardEventHandler<HTMLElement>;
|
|
55
|
+
textStyle?: BpkResponsiveValue<TextStyle>;
|
|
49
56
|
'data-testid'?: string;
|
|
50
57
|
'data-cy'?: string;
|
|
51
58
|
color?: never;
|
|
@@ -17,11 +17,10 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { defineConfig } from '@chakra-ui/react';
|
|
20
|
+
|
|
20
21
|
// Import tokens from Backpack foundations
|
|
21
22
|
// Note: Some tokens may not be in TypeScript definitions but exist at runtime
|
|
22
|
-
|
|
23
|
-
const bpkTokens = require('@skyscanner/bpk-foundations-web/tokens/base.es6');
|
|
24
|
-
|
|
23
|
+
import * as bpkTokens from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
25
24
|
// NOTE:
|
|
26
25
|
// We intentionally do not use the raw breakpoint *values* from foundations here.
|
|
27
26
|
// Foundations exports breakpoint values such as `breakpointMobile = "32rem"` which
|
|
@@ -210,6 +209,242 @@ export function getBorderRadiusValue(token) {
|
|
|
210
209
|
export function getShadowValue(token) {
|
|
211
210
|
return shadowMap[token];
|
|
212
211
|
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Maps Backpack text style tokens to Chakra UI textStyles.
|
|
215
|
+
* CSS property values are sourced from @skyscanner/bpk-foundations-web/tokens/base.es6.
|
|
216
|
+
* Each entry mirrors the corresponding SCSS mixin in bpk-mixins/_typography.scss.
|
|
217
|
+
*/
|
|
218
|
+
const textStylesMap = {
|
|
219
|
+
xs: {
|
|
220
|
+
value: {
|
|
221
|
+
fontSize: bpkTokens.fontSizeXs,
|
|
222
|
+
lineHeight: bpkTokens.lineHeightXs,
|
|
223
|
+
fontWeight: bpkTokens.fontWeightBook
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
sm: {
|
|
227
|
+
value: {
|
|
228
|
+
fontSize: bpkTokens.fontSizeSm,
|
|
229
|
+
lineHeight: bpkTokens.lineHeightSm,
|
|
230
|
+
fontWeight: bpkTokens.fontWeightBook
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
base: {
|
|
234
|
+
value: {
|
|
235
|
+
fontSize: bpkTokens.fontSizeBase,
|
|
236
|
+
lineHeight: bpkTokens.lineHeightBase,
|
|
237
|
+
fontWeight: bpkTokens.fontWeightBook
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
lg: {
|
|
241
|
+
value: {
|
|
242
|
+
fontSize: bpkTokens.fontSizeLg,
|
|
243
|
+
lineHeight: bpkTokens.lineHeightLg,
|
|
244
|
+
fontWeight: bpkTokens.fontWeightBook
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
xl: {
|
|
248
|
+
value: {
|
|
249
|
+
fontSize: bpkTokens.fontSizeXl,
|
|
250
|
+
lineHeight: bpkTokens.lineHeightXl,
|
|
251
|
+
fontWeight: bpkTokens.fontWeightBook
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
xxl: {
|
|
255
|
+
value: {
|
|
256
|
+
fontSize: bpkTokens.fontSizeXxl,
|
|
257
|
+
lineHeight: bpkTokens.lineHeightXxl,
|
|
258
|
+
fontWeight: bpkTokens.fontWeightBold
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
xxxl: {
|
|
262
|
+
value: {
|
|
263
|
+
fontSize: bpkTokens.fontSizeXxxl,
|
|
264
|
+
lineHeight: bpkTokens.lineHeightXxxl,
|
|
265
|
+
fontWeight: bpkTokens.fontWeightBold
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
xxxxl: {
|
|
269
|
+
value: {
|
|
270
|
+
fontSize: bpkTokens.fontSizeXxxxl,
|
|
271
|
+
lineHeight: bpkTokens.lineHeightXxxxl,
|
|
272
|
+
fontWeight: bpkTokens.fontWeightBold,
|
|
273
|
+
letterSpacing: bpkTokens.letterSpacingTight
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
xxxxxl: {
|
|
277
|
+
value: {
|
|
278
|
+
fontSize: bpkTokens.fontSizeXxxxxl,
|
|
279
|
+
lineHeight: bpkTokens.lineHeightXxxxxl,
|
|
280
|
+
fontWeight: bpkTokens.fontWeightBold,
|
|
281
|
+
letterSpacing: bpkTokens.letterSpacingTight
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
caption: {
|
|
285
|
+
value: {
|
|
286
|
+
fontSize: bpkTokens.fontSizeXs,
|
|
287
|
+
lineHeight: bpkTokens.lineHeightXs,
|
|
288
|
+
fontWeight: bpkTokens.fontWeightBook
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
footnote: {
|
|
292
|
+
value: {
|
|
293
|
+
fontSize: bpkTokens.fontSizeSm,
|
|
294
|
+
lineHeight: bpkTokens.lineHeightSm,
|
|
295
|
+
fontWeight: bpkTokens.fontWeightBook
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
'label-1': {
|
|
299
|
+
value: {
|
|
300
|
+
fontSize: bpkTokens.fontSizeBase,
|
|
301
|
+
lineHeight: bpkTokens.lineHeightBase,
|
|
302
|
+
fontWeight: bpkTokens.fontWeightBold
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
'label-2': {
|
|
306
|
+
value: {
|
|
307
|
+
fontSize: bpkTokens.fontSizeSm,
|
|
308
|
+
lineHeight: bpkTokens.lineHeightSm,
|
|
309
|
+
fontWeight: bpkTokens.fontWeightBold
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
'label-3': {
|
|
313
|
+
value: {
|
|
314
|
+
fontSize: bpkTokens.fontSizeXs,
|
|
315
|
+
lineHeight: bpkTokens.lineHeightXs,
|
|
316
|
+
fontWeight: bpkTokens.fontWeightBold
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
'body-default': {
|
|
320
|
+
value: {
|
|
321
|
+
fontSize: bpkTokens.fontSizeBase,
|
|
322
|
+
lineHeight: bpkTokens.lineHeightBase,
|
|
323
|
+
fontWeight: bpkTokens.fontWeightBook
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
'body-longform': {
|
|
327
|
+
value: {
|
|
328
|
+
fontSize: bpkTokens.fontSizeLg,
|
|
329
|
+
lineHeight: bpkTokens.lineHeightLg,
|
|
330
|
+
fontWeight: bpkTokens.fontWeightBook
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
subheading: {
|
|
334
|
+
value: {
|
|
335
|
+
fontSize: bpkTokens.fontSizeXl,
|
|
336
|
+
lineHeight: bpkTokens.lineHeightXl,
|
|
337
|
+
fontWeight: bpkTokens.fontWeightBook
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
'heading-1': {
|
|
341
|
+
value: {
|
|
342
|
+
fontSize: bpkTokens.fontSizeXxxl,
|
|
343
|
+
lineHeight: bpkTokens.lineHeightXxxl,
|
|
344
|
+
fontWeight: bpkTokens.fontWeightBold
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
'heading-2': {
|
|
348
|
+
value: {
|
|
349
|
+
fontSize: bpkTokens.fontSizeXxl,
|
|
350
|
+
lineHeight: bpkTokens.lineHeightXxl,
|
|
351
|
+
fontWeight: bpkTokens.fontWeightBold
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
'heading-3': {
|
|
355
|
+
value: {
|
|
356
|
+
fontSize: bpkTokens.fontSizeXl,
|
|
357
|
+
lineHeight: bpkTokens.lineHeightXlTight,
|
|
358
|
+
fontWeight: bpkTokens.fontWeightBold
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
'heading-4': {
|
|
362
|
+
value: {
|
|
363
|
+
fontSize: bpkTokens.fontSizeLg,
|
|
364
|
+
lineHeight: bpkTokens.lineHeightLgTight,
|
|
365
|
+
fontWeight: bpkTokens.fontWeightBold
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
'heading-5': {
|
|
369
|
+
value: {
|
|
370
|
+
fontSize: bpkTokens.fontSizeBase,
|
|
371
|
+
lineHeight: bpkTokens.lineHeightBaseTight,
|
|
372
|
+
fontWeight: bpkTokens.fontWeightBold
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
'hero-1': {
|
|
376
|
+
value: {
|
|
377
|
+
fontSize: bpkTokens.fontSize8Xl,
|
|
378
|
+
lineHeight: bpkTokens.lineHeight8Xl,
|
|
379
|
+
fontWeight: bpkTokens.fontWeightBlack,
|
|
380
|
+
letterSpacing: bpkTokens.letterSpacingHero
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
'hero-2': {
|
|
384
|
+
value: {
|
|
385
|
+
fontSize: bpkTokens.fontSize7Xl,
|
|
386
|
+
lineHeight: bpkTokens.lineHeight7Xl,
|
|
387
|
+
fontWeight: bpkTokens.fontWeightBlack,
|
|
388
|
+
letterSpacing: bpkTokens.letterSpacingHero
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
'hero-3': {
|
|
392
|
+
value: {
|
|
393
|
+
fontSize: bpkTokens.fontSize6Xl,
|
|
394
|
+
lineHeight: bpkTokens.lineHeight6Xl,
|
|
395
|
+
fontWeight: bpkTokens.fontWeightBlack,
|
|
396
|
+
letterSpacing: bpkTokens.letterSpacingHero
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
'hero-4': {
|
|
400
|
+
value: {
|
|
401
|
+
fontSize: bpkTokens.fontSizeXxxxxl,
|
|
402
|
+
lineHeight: bpkTokens.lineHeightXxxxxl,
|
|
403
|
+
fontWeight: bpkTokens.fontWeightBlack,
|
|
404
|
+
letterSpacing: bpkTokens.letterSpacingHero
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
'hero-5': {
|
|
408
|
+
value: {
|
|
409
|
+
fontSize: bpkTokens.fontSizeXxxxl,
|
|
410
|
+
lineHeight: bpkTokens.lineHeightXxxl,
|
|
411
|
+
fontWeight: bpkTokens.fontWeightBlack,
|
|
412
|
+
letterSpacing: bpkTokens.letterSpacingHero
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
'hero-6': {
|
|
416
|
+
value: {
|
|
417
|
+
fontSize: bpkTokens.fontSizeXxxl,
|
|
418
|
+
lineHeight: bpkTokens.lineHeightXxl,
|
|
419
|
+
fontWeight: bpkTokens.fontWeightBlack,
|
|
420
|
+
letterSpacing: bpkTokens.letterSpacingHero
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
'editorial-1': {
|
|
424
|
+
value: {
|
|
425
|
+
fontFamily: `var(--bpk-larken-font-stack, ${bpkTokens.fontFamilyLarken})`,
|
|
426
|
+
fontSize: bpkTokens.fontSizeXxxxl,
|
|
427
|
+
lineHeight: bpkTokens.lineHeightXxxxl,
|
|
428
|
+
fontWeight: bpkTokens.fontWeightLight
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
'editorial-2': {
|
|
432
|
+
value: {
|
|
433
|
+
fontFamily: `var(--bpk-larken-font-stack, ${bpkTokens.fontFamilyLarken})`,
|
|
434
|
+
fontSize: bpkTokens.fontSizeXxl,
|
|
435
|
+
lineHeight: bpkTokens.lineHeightXxl,
|
|
436
|
+
fontWeight: bpkTokens.fontWeightLight
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
'editorial-3': {
|
|
440
|
+
value: {
|
|
441
|
+
fontFamily: `var(--bpk-larken-font-stack, ${bpkTokens.fontFamilyLarken})`,
|
|
442
|
+
fontSize: bpkTokens.fontSizeLg,
|
|
443
|
+
lineHeight: bpkTokens.lineHeightLg,
|
|
444
|
+
fontWeight: bpkTokens.fontWeightBook
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
};
|
|
213
448
|
export function createBpkConfig() {
|
|
214
449
|
// Convert breakpoint map to Chakra UI format
|
|
215
450
|
// Breakpoints in Chakra v3 are typically simple strings in the breakpoints object
|
|
@@ -227,6 +462,7 @@ export function createBpkConfig() {
|
|
|
227
462
|
tokens: {
|
|
228
463
|
spacing: spacingMap
|
|
229
464
|
},
|
|
465
|
+
textStyles: textStylesMap,
|
|
230
466
|
breakpoints: chakraBreakpoints
|
|
231
467
|
}
|
|
232
468
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type BpkLayoutComponentName = 'BpkBox' | 'BpkFlex' | 'BpkGrid' | 'BpkStack';
|
|
1
|
+
export type BpkLayoutComponentName = 'BpkBox' | 'BpkFlex' | 'BpkGrid' | 'BpkGridItem' | 'BpkStack';
|
|
2
2
|
/**
|
|
3
3
|
* Allowlisted, component-scoped prop groups that are eligible for Backpack responsive value
|
|
4
4
|
* processing (Backpack breakpoint keys -> Chakra breakpoint keys).
|
|
@@ -34,6 +34,8 @@ import { BpkBreakpointToChakraKey, isValidSpacingValue, isValidSizeValue, isVali
|
|
|
34
34
|
export const BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT = {
|
|
35
35
|
BpkBox: {
|
|
36
36
|
container: [
|
|
37
|
+
// Typography
|
|
38
|
+
'textStyle',
|
|
37
39
|
// Display
|
|
38
40
|
'display',
|
|
39
41
|
// Flex container props
|
|
@@ -48,25 +50,29 @@ export const BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT = {
|
|
|
48
50
|
},
|
|
49
51
|
// Note: BpkFlex maps its public API props to these Chakra keys.
|
|
50
52
|
BpkFlex: {
|
|
51
|
-
container: ['flexDirection', 'justifyContent', 'alignItems', 'flexWrap'],
|
|
53
|
+
container: ['textStyle', 'flexDirection', 'justifyContent', 'alignItems', 'flexWrap'],
|
|
52
54
|
item: ['flexGrow', 'flexShrink', 'flexBasis']
|
|
53
55
|
},
|
|
54
56
|
// Note: BpkGrid maps its public API props to these Chakra keys.
|
|
55
57
|
BpkGrid: {
|
|
56
|
-
container: ['justifyContent', 'alignItems', 'gridTemplateColumns', 'gridTemplateRows', 'gridTemplateAreas', 'gridAutoFlow', 'gridAutoRows', 'gridAutoColumns'],
|
|
58
|
+
container: ['textStyle', 'justifyContent', 'alignItems', 'gridTemplateColumns', 'gridTemplateRows', 'gridTemplateAreas', 'gridAutoFlow', 'gridAutoRows', 'gridAutoColumns'],
|
|
57
59
|
item: [
|
|
58
60
|
// Used when placing the grid itself within a parent grid.
|
|
59
61
|
'gridColumn', 'gridRow']
|
|
60
62
|
},
|
|
63
|
+
BpkGridItem: {
|
|
64
|
+
container: ['textStyle']
|
|
65
|
+
},
|
|
61
66
|
// Note: BpkStack uses Chakra Stack option prop names directly.
|
|
62
67
|
BpkStack: {
|
|
63
|
-
container: StackOptionKeys
|
|
68
|
+
container: ['textStyle', ...StackOptionKeys]
|
|
64
69
|
}
|
|
65
70
|
};
|
|
66
71
|
export const BPK_RESPONSIVE_PROP_KEYS_BY_COMPONENT = {
|
|
67
72
|
BpkBox: [...BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT.BpkBox.container, ...(BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT.BpkBox.item ?? [])],
|
|
68
73
|
BpkFlex: [...BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT.BpkFlex.container, ...(BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT.BpkFlex.item ?? [])],
|
|
69
74
|
BpkGrid: [...BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT.BpkGrid.container, ...(BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT.BpkGrid.item ?? [])],
|
|
75
|
+
BpkGridItem: [...BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT.BpkGridItem.container],
|
|
70
76
|
BpkStack: [...BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT.BpkStack.container]
|
|
71
77
|
};
|
|
72
78
|
function filterToAllowlist(props, allowlist) {
|
|
@@ -4,11 +4,11 @@ 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
6
|
/**
|
|
7
|
-
* Layout-level event props that should not be exposed on layout components
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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
10
|
*/
|
|
11
|
-
type LayoutEventProps = '
|
|
11
|
+
type LayoutEventProps = 'onMouseEnter' | 'onMouseLeave' | 'onMouseOver' | 'onMouseOut' | 'onMouseDown' | 'onMouseUp' | 'onFocus' | 'onBlur' | 'onKeyDown' | 'onKeyUp' | 'onKeyPress';
|
|
12
12
|
/**
|
|
13
13
|
* Shorthand props from the underlying layout system that we do NOT expose on
|
|
14
14
|
* Backpack layout components. These mostly mirror longer-form spacing,
|
|
@@ -93,13 +93,14 @@ export interface BpkBoxSpecificProps extends Omit<RemoveCommonProps<BoxProps>, B
|
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* Props for BpkBox component
|
|
96
|
-
* Combines Box-specific props with Backpack common layout props
|
|
97
|
-
*
|
|
96
|
+
* Combines Box-specific props with Backpack common layout props.
|
|
97
|
+
* onClick is inherited from BpkCommonLayoutProps.
|
|
98
|
+
* onFocus and onBlur are reintroduced here as BpkBox-only interaction props.
|
|
99
|
+
* textStyle maps to Chakra's `textStyle` theme prop for Backpack typography and supports responsive values.
|
|
98
100
|
*/
|
|
99
|
-
type BoxEventProps = Pick<BoxProps, '
|
|
101
|
+
type BoxEventProps = Pick<BoxProps, 'onFocus' | 'onBlur'>;
|
|
100
102
|
export interface BpkBoxProps extends BpkCommonLayoutProps, BpkBoxSpecificProps {
|
|
101
103
|
children?: ReactNode;
|
|
102
|
-
onClick?: BoxEventProps['onClick'];
|
|
103
104
|
onFocus?: BoxEventProps['onFocus'];
|
|
104
105
|
onBlur?: BoxEventProps['onBlur'];
|
|
105
106
|
}
|