@skyscanner/backpack-web 42.5.2 → 42.6.0-dev-v24170567962.1

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 (38) hide show
  1. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Control.js +1 -1
  2. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2HiddenInput.js +1 -1
  3. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Label.js +1 -1
  4. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Root.js +1 -1
  5. package/bpk-component-checkbox-card/src/BpkCheckboxCard.js +1 -1
  6. package/bpk-component-checkbox-card/src/BpkCheckboxCardRoot.js +1 -1
  7. package/bpk-component-drawer/src/BpkDrawer.d.ts +1 -1
  8. package/bpk-component-drawer/src/BpkDrawerContent.d.ts +1 -1
  9. package/bpk-component-layout/index.d.ts +2 -0
  10. package/bpk-component-layout/index.js +4 -1
  11. package/bpk-component-layout/src/BpkBox.js +18 -8
  12. package/bpk-component-layout/src/BpkFlex.js +11 -3
  13. package/bpk-component-layout/src/BpkGrid.js +11 -3
  14. package/bpk-component-layout/src/BpkGridItem.js +11 -3
  15. package/bpk-component-layout/src/BpkLayout.module.css +18 -0
  16. package/bpk-component-layout/src/BpkProvider.js +11 -7
  17. package/bpk-component-layout/src/BpkStack.js +46 -20
  18. package/bpk-component-layout/src/backgroundColors.d.ts +16 -0
  19. package/bpk-component-layout/src/backgroundColors.js +37 -0
  20. package/bpk-component-layout/src/commonProps.d.ts +4 -3
  21. package/bpk-component-layout/src/spacingMap.d.ts +21 -0
  22. package/bpk-component-layout/src/spacingMap.js +92 -0
  23. package/bpk-component-layout/src/theme.d.ts +0 -14
  24. package/bpk-component-layout/src/theme.js +138 -205
  25. package/bpk-component-layout/src/tokenUtils.js +1 -1
  26. package/bpk-component-layout/src/types.d.ts +4 -1
  27. package/bpk-component-modal/src/BpkModalV3/BpkModalV3CloseTrigger/BpkModalV3CloseTrigger.js +1 -1
  28. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Content/BpkModalV3Content.js +1 -1
  29. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Description/BpkModalV3Description.js +1 -1
  30. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Portal/BpkModalV3Portal.js +1 -1
  31. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/BpkModalV3Root.js +1 -1
  32. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Scrim/BpkModalV3Scrim.js +1 -1
  33. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Title/BpkModalV3Title.js +1 -1
  34. package/bpk-component-modal/src/BpkModalV3/BpkModalV3Trigger/BpkModalV3Trigger.js +1 -1
  35. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.js +2 -1
  36. package/bpk-mixins/_borders.scss +20 -4
  37. package/bpk-mixins/_scroll-indicators.scss +5 -1
  38. package/package.json +2 -1
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import { Checkbox } from '@ark-ui/react';
19
+ import { Checkbox } from '@ark-ui/react/checkbox';
20
20
  import { cssModules } from "../../../bpk-react-utils";
21
21
  import STYLES from "./BpkCheckboxV2.module.css";
22
22
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import { Checkbox } from '@ark-ui/react';
19
+ import { Checkbox } from '@ark-ui/react/checkbox';
20
20
 
21
21
  // Renders Ark's visually hidden native <input type="checkbox">.
22
22
  // Include when the checkbox is inside a <form> for native form submission.
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import { Checkbox } from '@ark-ui/react';
19
+ import { Checkbox } from '@ark-ui/react/checkbox';
20
20
  import { cssModules } from "../../../bpk-react-utils";
21
21
  import STYLES from "./BpkCheckboxV2.module.css";
22
22
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import { Checkbox } from '@ark-ui/react';
19
+ import { Checkbox } from '@ark-ui/react/checkbox';
20
20
  import { cssModules, getDataComponentAttribute } from "../../../bpk-react-utils";
21
21
  import STYLES from "./BpkCheckboxV2.module.css";
22
22
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- import { CheckboxHiddenInput } from '@ark-ui/react';
19
+ import { CheckboxHiddenInput } from '@ark-ui/react/checkbox';
20
20
  import { withButtonAlignment } from "../../bpk-component-icon";
21
21
  import TickCircleIcon from "../../bpk-component-icon/sm/tick-circle";
22
22
  import { BpkSpinner, SPINNER_TYPES } from "../../bpk-component-spinner";
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import { useMemo } from 'react';
20
- import { CheckboxRoot } from '@ark-ui/react';
20
+ import { CheckboxRoot } from '@ark-ui/react/checkbox';
21
21
  import { withButtonAlignment } from "../../bpk-component-icon";
22
22
  import TickCircleIcon from "../../bpk-component-icon/sm/tick-circle";
23
23
  import { cssModules } from "../../bpk-react-utils";
@@ -6,7 +6,7 @@ export type Props = {
6
6
  onClose?: (arg0?: TouchEvent | MouseEvent | KeyboardEvent, arg1?: {
7
7
  source: 'ESCAPE' | 'DOCUMENT_CLICK';
8
8
  }) => void;
9
- title: string;
9
+ title: ReactNode;
10
10
  getApplicationElement: () => HTMLElement | null;
11
11
  width?: string;
12
12
  renderTarget?: null | HTMLElement | (() => null | HTMLElement);
@@ -5,7 +5,7 @@ type Props = {
5
5
  onCloseAnimationComplete: () => void;
6
6
  onClose: () => void;
7
7
  id: string;
8
- title: string;
8
+ title: ReactNode;
9
9
  width?: string;
10
10
  className?: string | null;
11
11
  contentClassName?: string;
@@ -16,3 +16,5 @@ export type { BpkCommonLayoutProps, BpkBoxSpecificProps, BpkFlexSpecificProps, B
16
16
  export type { BpkStackSpecificProps } from './src/types';
17
17
  export type { BpkSpacingToken, BpkBreakpointToken, BpkSpacingValue, BpkBreakpointValue, } from './src/tokens';
18
18
  export { BpkSpacing, BpkBreakpoint, isValidSpacingValue, isPercentage, } from './src/tokens';
19
+ export { BACKGROUND_COLORS } from './src/backgroundColors';
20
+ export type { BpkLayoutBackgroundColor } from './src/backgroundColors';
@@ -26,4 +26,7 @@ export { BpkStack, BpkHStack, BpkVStack } from "./src/BpkStack";
26
26
 
27
27
  // Export token types and utilities
28
28
 
29
- export { BpkSpacing, BpkBreakpoint, isValidSpacingValue, isPercentage } from "./src/tokens";
29
+ export { BpkSpacing, BpkBreakpoint, isValidSpacingValue, isPercentage } from "./src/tokens";
30
+
31
+ // Export color constants and types
32
+ export { BACKGROUND_COLORS } from "./src/backgroundColors";
@@ -17,22 +17,32 @@
17
17
  */
18
18
 
19
19
  import { forwardRef } from 'react';
20
- import { Box } from '@chakra-ui/react';
21
- import { getDataComponentAttribute } from "../../bpk-react-utils";
20
+ import { Box } from '@chakra-ui/react/box';
21
+ import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
22
22
  import { processBpkComponentProps } from "./tokenUtils";
23
+ import STYLES from "./BpkLayout.module.css";
23
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
+ const getClassName = cssModules(STYLES);
24
26
  export const BpkBox = /*#__PURE__*/forwardRef(({
27
+ backgroundColor,
25
28
  children,
29
+ color,
26
30
  ...props
27
31
  }, ref) => {
28
32
  const processedProps = processBpkComponentProps(props, {
29
33
  component: 'BpkBox'
30
34
  });
31
- return /*#__PURE__*/_jsx(Box, {
32
- ref: ref,
33
- ...getDataComponentAttribute('Box'),
34
- ...processedProps,
35
- children: children
36
- });
35
+ const classNames = color || backgroundColor ? getClassName('bpk-layout', color ? `bpk-layout--${color}` : '', backgroundColor ? `bpk-layout--${backgroundColor}` : '') : undefined;
36
+ return (
37
+ /*#__PURE__*/
38
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
39
+ _jsx(Box, {
40
+ ref: ref,
41
+ className: classNames,
42
+ ...getDataComponentAttribute('Box'),
43
+ ...processedProps,
44
+ children: children
45
+ })
46
+ );
37
47
  });
38
48
  BpkBox.displayName = 'BpkBox';
@@ -17,14 +17,18 @@
17
17
  */
18
18
 
19
19
  import { forwardRef } from 'react';
20
- import { Flex } from '@chakra-ui/react';
21
- import { getDataComponentAttribute } from "../../bpk-react-utils";
20
+ import { Flex } from '@chakra-ui/react/flex';
21
+ import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
22
22
  import { processBpkComponentProps } from "./tokenUtils";
23
+ import STYLES from "./BpkLayout.module.css";
23
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
+ const getClassName = cssModules(STYLES);
24
26
  export const BpkFlex = /*#__PURE__*/forwardRef(({
25
27
  align,
28
+ backgroundColor,
26
29
  basis,
27
30
  children,
31
+ color,
28
32
  direction,
29
33
  grow,
30
34
  inline,
@@ -47,8 +51,12 @@ export const BpkFlex = /*#__PURE__*/forwardRef(({
47
51
  flexBasis: basis
48
52
  }
49
53
  });
54
+ const classNames = color || backgroundColor ? getClassName('bpk-layout', color ? `bpk-layout--${color}` : '', backgroundColor ? `bpk-layout--${backgroundColor}` : '') : undefined;
50
55
  return /*#__PURE__*/_jsx(Flex, {
51
- ref: ref,
56
+ ref: ref
57
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
58
+ ,
59
+ className: classNames,
52
60
  ...getDataComponentAttribute('Flex'),
53
61
  ...processedProps,
54
62
  display: inline ? 'inline-flex' : undefined,
@@ -17,16 +17,20 @@
17
17
  */
18
18
 
19
19
  import { forwardRef } from 'react';
20
- import { Grid } from '@chakra-ui/react';
21
- import { getDataComponentAttribute } from "../../bpk-react-utils";
20
+ import { Grid } from '@chakra-ui/react/grid';
21
+ import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
22
22
  import { processBpkComponentProps } from "./tokenUtils";
23
+ import STYLES from "./BpkLayout.module.css";
23
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
+ const getClassName = cssModules(STYLES);
24
26
  export const BpkGrid = /*#__PURE__*/forwardRef(({
25
27
  align,
26
28
  autoColumns,
27
29
  autoFlow,
28
30
  autoRows,
31
+ backgroundColor,
29
32
  children,
33
+ color,
30
34
  column,
31
35
  inline,
32
36
  justify,
@@ -53,8 +57,12 @@ export const BpkGrid = /*#__PURE__*/forwardRef(({
53
57
  gridRow: row
54
58
  }
55
59
  });
60
+ const classNames = color || backgroundColor ? getClassName('bpk-layout', color ? `bpk-layout--${color}` : '', backgroundColor ? `bpk-layout--${backgroundColor}` : '') : undefined;
56
61
  return /*#__PURE__*/_jsx(Grid, {
57
- ref: ref,
62
+ ref: ref
63
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
64
+ ,
65
+ className: classNames,
58
66
  ...getDataComponentAttribute('Grid'),
59
67
  ...processedProps,
60
68
  display: inline ? 'inline-grid' : undefined,
@@ -17,16 +17,20 @@
17
17
  */
18
18
 
19
19
  import { forwardRef } from 'react';
20
- import { GridItem } from '@chakra-ui/react';
21
- import { getDataComponentAttribute } from "../../bpk-react-utils";
20
+ import { GridItem } from '@chakra-ui/react/grid';
21
+ import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
22
22
  import { processBpkComponentProps } from "./tokenUtils";
23
+ import STYLES from "./BpkLayout.module.css";
23
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
+ const getClassName = cssModules(STYLES);
24
26
  export const BpkGridItem = /*#__PURE__*/forwardRef(({
25
27
  area,
28
+ backgroundColor,
26
29
  children,
27
30
  colEnd,
28
31
  colSpan,
29
32
  colStart,
33
+ color,
30
34
  rowEnd,
31
35
  rowSpan,
32
36
  rowStart,
@@ -39,8 +43,12 @@ export const BpkGridItem = /*#__PURE__*/forwardRef(({
39
43
  }, {
40
44
  component: 'BpkGridItem'
41
45
  });
46
+ const classNames = color || backgroundColor ? getClassName('bpk-layout', color ? `bpk-layout--${color}` : '', backgroundColor ? `bpk-layout--${backgroundColor}` : '') : undefined;
42
47
  return /*#__PURE__*/_jsx(GridItem, {
43
- ref: ref,
48
+ ref: ref
49
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
50
+ ,
51
+ className: classNames,
44
52
  ...getDataComponentAttribute('GridItem'),
45
53
  ...processedProps,
46
54
  area: area,
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ .bpk-layout.bpk-layout--text-disabled{color:rgba(0,0,0,.2)}.bpk-layout.bpk-layout--text-disabled-on-dark{color:hsla(0,0%,100%,.5)}.bpk-layout.bpk-layout--text-error{color:#e70866}.bpk-layout.bpk-layout--text-hero{color:#0062e3}.bpk-layout.bpk-layout--text-link{color:#0062e3}.bpk-layout.bpk-layout--text-on-dark{color:#fff}.bpk-layout.bpk-layout--text-on-light{color:#161616}.bpk-layout.bpk-layout--text-primary{color:#161616}.bpk-layout.bpk-layout--text-primary-inverse{color:#fff}.bpk-layout.bpk-layout--text-secondary{color:#626971}.bpk-layout.bpk-layout--text-success{color:#0c838a}.bpk-layout.bpk-layout--surface-default{background-color:#fff}.bpk-layout.bpk-layout--surface-elevated{background-color:#fff}.bpk-layout.bpk-layout--surface-hero{background-color:#0062e3}.bpk-layout.bpk-layout--surface-contrast{background-color:#05203c}.bpk-layout.bpk-layout--surface-highlight{background-color:#e0e4e9}.bpk-layout.bpk-layout--surface-subtle{background-color:#e3f0ff}.bpk-layout.bpk-layout--surface-low-contrast{background-color:#f5f7fa}.bpk-layout.bpk-layout--surface-tint{background-color:hsla(0,0%,100%,.1)}.bpk-layout.bpk-layout--canvas{background-color:#fff}.bpk-layout.bpk-layout--canvas-contrast{background-color:#eff3f8}.bpk-layout.bpk-layout--status-success-fill{background-color:#d4fff2}.bpk-layout.bpk-layout--status-danger-fill{background-color:#ffe9f9}.bpk-layout.bpk-layout--status-warning-fill{background-color:#fff7cf}
@@ -17,18 +17,22 @@
17
17
  */
18
18
 
19
19
  import { useEffect, useState } from 'react';
20
- import { LocaleProvider } from '@ark-ui/react';
21
- import { ChakraProvider, createSystem, defaultBaseConfig } from '@chakra-ui/react';
20
+ import { LocaleProvider } from '@ark-ui/react/locale';
21
+ import { ChakraProvider, createSystem } from '@chakra-ui/react/styled-system';
22
22
  import { createBpkConfig } from "./theme";
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
24
  /**
25
- * Creates a Chakra UI system with Backpack token mappings.
25
+ * Creates a Chakra UI system with only the Backpack config.
26
26
  *
27
- * Uses `defaultBaseConfig` (conditions + utilities only) instead of
28
- * `defaultConfig` to avoid bundling ~141KB of unused component recipes.
29
- * See: https://chakra-ui.com/guides/component-bundle-optimization
27
+ * We intentionally omit `defaultBaseConfig` (~36KB of conditions & utility
28
+ * shorthands) and `defaultConfig` (~141KB of component recipes). Backpack
29
+ * layout components pre-resolve all tokens to raw CSS values before passing
30
+ * them to Chakra, so the utility transform layer is unused. Standard CSS
31
+ * properties still pass through via Chakra's `isCssProperty` check, and
32
+ * responsive objects work because breakpoint conditions are derived from
33
+ * `theme.breakpoints` in our config.
30
34
  */
31
- const bpkSystem = createSystem(defaultBaseConfig, createBpkConfig());
35
+ const bpkSystem = createSystem(createBpkConfig());
32
36
  // Fallback locale mapping used when no explicit locale is available on the document.
33
37
  // Maps DOM direction to minimal BCP 47 locales understood by Ark's isRTL() utility.
34
38
  // 'ar-SA' is the minimal RTL locale — Ark only uses it to derive dir='rtl'.
@@ -17,52 +17,78 @@
17
17
  */
18
18
 
19
19
  import { forwardRef } from 'react';
20
- import { Stack, VStack, HStack } from '@chakra-ui/react';
21
- import { getDataComponentAttribute } from "../../bpk-react-utils";
20
+ import { Stack, VStack, HStack } from '@chakra-ui/react/stack';
21
+ import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
22
22
  import { processBpkComponentProps } from "./tokenUtils";
23
+ import STYLES from "./BpkLayout.module.css";
23
24
  import { jsx as _jsx } from "react/jsx-runtime";
25
+ const getClassName = cssModules(STYLES);
24
26
  export const BpkStack = /*#__PURE__*/forwardRef(({
27
+ backgroundColor,
25
28
  children,
29
+ color,
26
30
  ...props
27
31
  }, ref) => {
28
32
  const processedProps = processBpkComponentProps(props, {
29
33
  component: 'BpkStack'
30
34
  });
31
- return /*#__PURE__*/_jsx(Stack, {
32
- ref: ref,
33
- ...getDataComponentAttribute('Stack'),
34
- ...processedProps,
35
- children: children
36
- });
35
+ const classNames = color || backgroundColor ? getClassName('bpk-layout', color ? `bpk-layout--${color}` : '', backgroundColor ? `bpk-layout--${backgroundColor}` : '') : undefined;
36
+ return (
37
+ /*#__PURE__*/
38
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
39
+ _jsx(Stack, {
40
+ ref: ref,
41
+ className: classNames,
42
+ ...getDataComponentAttribute('Stack'),
43
+ ...processedProps,
44
+ children: children
45
+ })
46
+ );
37
47
  });
38
48
  BpkStack.displayName = 'BpkStack';
39
49
  export const BpkHStack = /*#__PURE__*/forwardRef(({
50
+ backgroundColor,
40
51
  children,
52
+ color,
41
53
  ...props
42
54
  }, ref) => {
43
55
  const processedProps = processBpkComponentProps(props, {
44
56
  component: 'BpkStack'
45
57
  });
46
- return /*#__PURE__*/_jsx(HStack, {
47
- ref: ref,
48
- ...getDataComponentAttribute('HStack'),
49
- ...processedProps,
50
- children: children
51
- });
58
+ const classNames = color || backgroundColor ? getClassName('bpk-layout', color ? `bpk-layout--${color}` : '', backgroundColor ? `bpk-layout--${backgroundColor}` : '') : undefined;
59
+ return (
60
+ /*#__PURE__*/
61
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
62
+ _jsx(HStack, {
63
+ ref: ref,
64
+ className: classNames,
65
+ ...getDataComponentAttribute('HStack'),
66
+ ...processedProps,
67
+ children: children
68
+ })
69
+ );
52
70
  });
53
71
  BpkHStack.displayName = 'BpkHStack';
54
72
  export const BpkVStack = /*#__PURE__*/forwardRef(({
73
+ backgroundColor,
55
74
  children,
75
+ color,
56
76
  ...props
57
77
  }, ref) => {
58
78
  const processedProps = processBpkComponentProps(props, {
59
79
  component: 'BpkStack'
60
80
  });
61
- return /*#__PURE__*/_jsx(VStack, {
62
- ref: ref,
63
- ...getDataComponentAttribute('VStack'),
64
- ...processedProps,
65
- children: children
66
- });
81
+ const classNames = color || backgroundColor ? getClassName('bpk-layout', color ? `bpk-layout--${color}` : '', backgroundColor ? `bpk-layout--${backgroundColor}` : '') : undefined;
82
+ return (
83
+ /*#__PURE__*/
84
+ // eslint-disable-next-line @skyscanner/rules/forbid-component-props
85
+ _jsx(VStack, {
86
+ ref: ref,
87
+ className: classNames,
88
+ ...getDataComponentAttribute('VStack'),
89
+ ...processedProps,
90
+ children: children
91
+ })
92
+ );
67
93
  });
68
94
  BpkVStack.displayName = 'BpkVStack';
@@ -0,0 +1,16 @@
1
+ export declare const BACKGROUND_COLORS: {
2
+ readonly statusSuccessFill: "status-success-fill";
3
+ readonly statusDangerFill: "status-danger-fill";
4
+ readonly statusWarningFill: "status-warning-fill";
5
+ readonly canvas: "canvas";
6
+ readonly canvasContrast: "canvas-contrast";
7
+ readonly surfaceDefault: "surface-default";
8
+ readonly surfaceElevated: "surface-elevated";
9
+ readonly surfaceHero: "surface-hero";
10
+ readonly surfaceContrast: "surface-contrast";
11
+ readonly surfaceHighlight: "surface-highlight";
12
+ readonly surfaceSubtle: "surface-subtle";
13
+ readonly surfaceLowContrast: "surface-low-contrast";
14
+ readonly surfaceTint: "surface-tint";
15
+ };
16
+ export type BpkLayoutBackgroundColor = (typeof BACKGROUND_COLORS)[keyof typeof BACKGROUND_COLORS];
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ import { SURFACE_COLORS } from "../../bpk-react-utils";
20
+
21
+ // Canvas colors (day mode only)
22
+ const CANVAS_COLORS = {
23
+ canvas: 'canvas',
24
+ canvasContrast: 'canvas-contrast'
25
+ };
26
+
27
+ // Status fill colors (day mode only — only fill, not spot or on-dark)
28
+ const STATUS_FILL_COLORS = {
29
+ statusSuccessFill: 'status-success-fill',
30
+ statusDangerFill: 'status-danger-fill',
31
+ statusWarningFill: 'status-warning-fill'
32
+ };
33
+ export const BACKGROUND_COLORS = {
34
+ ...SURFACE_COLORS,
35
+ ...CANVAS_COLORS,
36
+ ...STATUS_FILL_COLORS
37
+ };
@@ -1,6 +1,7 @@
1
1
  import type { AriaRole, KeyboardEventHandler, MouseEventHandler } from 'react';
2
+ import type { BpkLayoutBackgroundColor } from './backgroundColors';
2
3
  import type { BpkSpacingValue, BpkSizeValue, BpkPositionValue, BpkResponsiveValue } from './tokens';
3
- import type { TextStyle } from '../../bpk-component-text/src/BpkText';
4
+ import type { TextColor, TextStyle } from '../../bpk-component-text';
4
5
  /**
5
6
  * Common spacing-related props shared by all Backpack layout components
6
7
  * All spacing props must use Backpack spacing tokens or percentages
@@ -55,9 +56,9 @@ export interface BpkCommonLayoutProps extends BpkSpacingProps {
55
56
  textStyle?: BpkResponsiveValue<TextStyle>;
56
57
  'data-testid'?: string;
57
58
  'data-cy'?: string;
58
- color?: never;
59
+ color?: TextColor;
60
+ backgroundColor?: BpkLayoutBackgroundColor;
59
61
  background?: never;
60
- backgroundColor?: never;
61
62
  borderColor?: never;
62
63
  borderTopColor?: never;
63
64
  borderRightColor?: never;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Maps Backpack spacing tokens to actual rem values.
3
+ * These come directly from @skyscanner/bpk-foundations-web.
4
+ */
5
+ export declare const spacingMap: Record<string, {
6
+ value: string;
7
+ }>;
8
+ /**
9
+ * Exports spacing map for use in tokenUtils
10
+ * This allows tokenUtils to look up actual spacing values
11
+ *
12
+ * @returns {Record<string, string>} A map of spacing token names to values.
13
+ */
14
+ export declare function getSpacingMap(): Record<string, string>;
15
+ /**
16
+ * Gets the actual spacing value for a Backpack spacing token
17
+ *
18
+ * @param {string} token - Backpack spacing token name.
19
+ * @returns {string | undefined} The actual spacing value.
20
+ */
21
+ export declare function getSpacingValue(token: string): string | undefined;
@@ -0,0 +1,92 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ // Note: Spacing tokens are defined as SCSS functions in Backpack foundations,
20
+ // not as direct values. We need to use the actual rem values from the SCSS functions.
21
+ // Based on @skyscanner/bpk-foundations-web/tokens/base.default.scss:
22
+ // - bpk-spacing-sm() returns .25rem
23
+ // - bpk-spacing-md() returns .5rem
24
+ // - bpk-spacing-lg() returns 1.5rem
25
+ // - bpk-spacing-xl() returns 2rem (needs verification)
26
+ // - bpk-spacing-xxl() returns 2.5rem
27
+ // - bpk-spacing-base() returns 1rem (standard base spacing)
28
+ // TODO: CLOV-1021 - will add spacing tokens to Backpack Foundations package and use them here after we ship the PoC
29
+ const spacingXs = '.125rem'; // 2px
30
+ const spacingSm = '.25rem';
31
+ const spacingBase = '1rem'; // Standard base spacing
32
+ const spacingMd = '.5rem';
33
+ const spacingLg = '1.5rem';
34
+ const spacingXl = '2rem';
35
+ const spacingXxl = '2.5rem';
36
+
37
+ /**
38
+ * Maps Backpack spacing tokens to actual rem values.
39
+ * These come directly from @skyscanner/bpk-foundations-web.
40
+ */
41
+ export const spacingMap = {
42
+ 'bpk-spacing-none': {
43
+ value: '0'
44
+ },
45
+ // Temporary: Foundations does not yet export a 2px spacing token. This will be
46
+ // replaced with a foundations value once available.
47
+ 'bpk-spacing-xs': {
48
+ value: spacingXs
49
+ },
50
+ 'bpk-spacing-sm': {
51
+ value: spacingSm
52
+ },
53
+ 'bpk-spacing-base': {
54
+ value: spacingBase
55
+ },
56
+ 'bpk-spacing-md': {
57
+ value: spacingMd
58
+ },
59
+ 'bpk-spacing-lg': {
60
+ value: spacingLg
61
+ },
62
+ 'bpk-spacing-xl': {
63
+ value: spacingXl
64
+ },
65
+ 'bpk-spacing-xxl': {
66
+ value: spacingXxl
67
+ }
68
+ };
69
+
70
+ /**
71
+ * Exports spacing map for use in tokenUtils
72
+ * This allows tokenUtils to look up actual spacing values
73
+ *
74
+ * @returns {Record<string, string>} A map of spacing token names to values.
75
+ */
76
+ export function getSpacingMap() {
77
+ const simpleMap = {};
78
+ Object.entries(spacingMap).forEach(([key, obj]) => {
79
+ simpleMap[key] = obj.value;
80
+ });
81
+ return simpleMap;
82
+ }
83
+
84
+ /**
85
+ * Gets the actual spacing value for a Backpack spacing token
86
+ *
87
+ * @param {string} token - Backpack spacing token name.
88
+ * @returns {string | undefined} The actual spacing value.
89
+ */
90
+ export function getSpacingValue(token) {
91
+ return spacingMap[token]?.value;
92
+ }
@@ -1,17 +1,3 @@
1
- /**
2
- * Exports spacing map for use in tokenUtils
3
- * This allows tokenUtils to look up actual spacing values
4
- *
5
- * @returns {Record<string, string>} A map of spacing token names to values.
6
- */
7
- export declare function getSpacingMap(): Record<string, string>;
8
- /**
9
- * Gets the actual spacing value for a Backpack spacing token
10
- *
11
- * @param {string} token - Backpack spacing token name.
12
- * @returns {string | undefined} The actual spacing value.
13
- */
14
- export declare function getSpacingValue(token: string): string | undefined;
15
1
  /**
16
2
  * Gets the actual border width value for a Backpack border size token
17
3
  *