@skyscanner/backpack-web 42.9.0 → 42.10.0-dev-v24443725500.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 (48) hide show
  1. package/bpk-component-ai-blurb/src/BpkAiBlurb.module.css +1 -1
  2. package/bpk-component-ai-blurb/src/BpkAiBlurbFeedback.js +13 -21
  3. package/bpk-component-bubble/src/BpkBubble.module.css +1 -1
  4. package/bpk-component-calendar/src/BpkCalendarNav.d.ts +1 -1
  5. package/bpk-component-calendar/src/BpkCalendarNav.js +0 -1
  6. package/bpk-component-chatbot-input/index.d.ts +1 -2
  7. package/bpk-component-chatbot-input/src/BpkChatbotInput.d.ts +13 -3
  8. package/bpk-component-chatbot-input/src/BpkChatbotInput.js +18 -98
  9. package/bpk-component-chatbot-input/src/BpkChatbotInput.module.css +1 -1
  10. package/bpk-component-chatbot-input/src/BpkChatbotInputContext.d.ts +9 -0
  11. package/bpk-component-chatbot-input/src/BpkChatbotInputContext.js +26 -0
  12. package/bpk-component-chatbot-input/src/BpkChatbotInputInput.d.ts +3 -0
  13. package/bpk-component-chatbot-input/src/BpkChatbotInputInput.js +125 -0
  14. package/bpk-component-chatbot-input/src/BpkChatbotInputRoot.d.ts +3 -0
  15. package/bpk-component-chatbot-input/src/BpkChatbotInputRoot.js +77 -0
  16. package/bpk-component-chatbot-input/src/BpkChatbotInputToolbar.d.ts +3 -0
  17. package/bpk-component-chatbot-input/src/BpkChatbotInputToolbar.js +33 -0
  18. package/bpk-component-chatbot-input/src/TextAreaField/TextAreaField.d.ts +1 -0
  19. package/bpk-component-chatbot-input/src/TextAreaField/TextAreaField.js +5 -1
  20. package/bpk-component-chatbot-input/src/common-types.d.ts +23 -3
  21. package/bpk-component-chatbot-input/src/hooks/useChatbotInput.d.ts +2 -1
  22. package/bpk-component-chatbot-input/src/hooks/useChatbotInput.js +3 -1
  23. package/bpk-component-chatbot-input/src/hooks/useTextAreaAutoResize.d.ts +2 -1
  24. package/bpk-component-chatbot-input/src/hooks/useTextAreaAutoResize.js +19 -6
  25. package/bpk-component-layout/src/resolveTextStyle.d.ts +13 -0
  26. package/bpk-component-layout/src/resolveTextStyle.js +265 -0
  27. package/bpk-component-layout/src/theme.js +29 -252
  28. package/bpk-component-layout/src/tokenUtils.js +31 -9
  29. package/bpk-component-select/index.d.ts +5 -0
  30. package/bpk-component-select/index.js +3 -1
  31. package/bpk-component-select/src/BpkSelect.d.ts +18 -0
  32. package/bpk-component-select/src/BpkSelect.js +3 -28
  33. package/bpk-component-select/src/themeAttributes.d.ts +2 -0
  34. package/bpk-component-text/src/BpkText.module.css +1 -1
  35. package/bpk-component-theme-toggle/src/BpkThemeToggle.js +0 -1
  36. package/bpk-scrim-utils/src/focusScope.d.ts +5 -0
  37. package/bpk-scrim-utils/src/focusScope.js +88 -0
  38. package/bpk-scrim-utils/src/focusStore.d.ts +6 -0
  39. package/bpk-scrim-utils/src/focusStore.js +74 -0
  40. package/bpk-scrim-utils/src/withScrim.js +2 -5
  41. package/bpk-stylesheets/base.css +1 -1
  42. package/bpk-stylesheets/font.css +1 -1
  43. package/bpk-stylesheets/font.scss +80 -1
  44. package/bpk-stylesheets/larken.css +1 -1
  45. package/bpk-stylesheets/larken.scss +63 -1
  46. package/package.json +3 -5
  47. package/bpk-component-chatbot-input/src/SendButton/SendButton.d.ts +0 -9
  48. package/bpk-component-chatbot-input/src/SendButton/SendButton.js +0 -47
@@ -3,6 +3,7 @@ interface UseTextAreaAutoResizeProps {
3
3
  ref: RefObject<HTMLTextAreaElement>;
4
4
  value: string;
5
5
  enabled?: boolean;
6
+ maxLines?: number;
6
7
  }
7
8
  interface UseTextAreaAutoResizeReturn {
8
9
  isExpanding: boolean;
@@ -18,5 +19,5 @@ export declare const MAX_INPUT_HEIGHT_PHASE_2: number;
18
19
  export declare const MIN_CONTAINER_HEIGHT = 24;
19
20
  export declare const MAX_CONTAINER_HEIGHT = 96;
20
21
  export declare const PARENT_PADDING_TOP = 16;
21
- declare const useTextAreaAutoResize: ({ enabled, ref, value, }: UseTextAreaAutoResizeProps) => UseTextAreaAutoResizeReturn;
22
+ declare const useTextAreaAutoResize: ({ enabled, maxLines, ref, value, }: UseTextAreaAutoResizeProps) => UseTextAreaAutoResizeReturn;
22
23
  export default useTextAreaAutoResize;
@@ -26,6 +26,7 @@ export const MAX_CONTAINER_HEIGHT = 96;
26
26
  export const PARENT_PADDING_TOP = 16;
27
27
  const useTextAreaAutoResize = ({
28
28
  enabled = true,
29
+ maxLines,
29
30
  ref,
30
31
  value
31
32
  }) => {
@@ -99,15 +100,27 @@ const useTextAreaAutoResize = ({
99
100
  scrollHeight
100
101
  } = measureEl;
101
102
  const lines = Math.max(1, Math.ceil(scrollHeight / lineHeightRef.current));
102
- const isCapped = lines >= 5;
103
- const maxInputHeight = isCapped ? MAX_INPUT_HEIGHT_PHASE_2 : MAX_INPUT_HEIGHT_PHASE_1;
103
+ const hasCustomMaxLines = maxLines !== undefined;
104
+ const isCapped = hasCustomMaxLines ? lines >= maxLines : lines >= 5;
105
+ let maxInputHeight;
106
+ if (hasCustomMaxLines) {
107
+ maxInputHeight = lineHeightRef.current * maxLines;
108
+ } else {
109
+ maxInputHeight = isCapped ? MAX_INPUT_HEIGHT_PHASE_2 : MAX_INPUT_HEIGHT_PHASE_1;
110
+ }
104
111
  const targetInputHeight = Math.max(MIN_INPUT_HEIGHT, Math.min(scrollHeight, maxInputHeight));
105
- const extraSpace = isCapped ? PARENT_PADDING_TOP : 0;
106
- const targetContainerHeight = Math.max(MIN_CONTAINER_HEIGHT, Math.min(targetInputHeight - extraSpace, MAX_CONTAINER_HEIGHT));
112
+ const customMaxContainerHeight = hasCustomMaxLines ? lineHeightRef.current * maxLines : MAX_CONTAINER_HEIGHT;
113
+ const extraSpace = isCapped && !hasCustomMaxLines ? PARENT_PADDING_TOP : 0;
114
+ const targetContainerHeight = Math.max(MIN_CONTAINER_HEIGHT, Math.min(targetInputHeight - extraSpace, customMaxContainerHeight));
107
115
  setDimensions(prev => {
108
116
  const isContentAdded = value.length > previousValueRef.current.length;
109
117
  const isAppending = value.startsWith(previousValueRef.current);
110
- const prevMaxHeight = prev.isCapped ? MAX_INPUT_HEIGHT_PHASE_2 : MAX_INPUT_HEIGHT_PHASE_1;
118
+ let prevMaxHeight;
119
+ if (hasCustomMaxLines) {
120
+ prevMaxHeight = lineHeightRef.current * maxLines;
121
+ } else {
122
+ prevMaxHeight = prev.isCapped ? MAX_INPUT_HEIGHT_PHASE_2 : MAX_INPUT_HEIGHT_PHASE_1;
123
+ }
111
124
  const isInitialRender = isInitialRenderRef.current;
112
125
  const shouldScroll = isContentAdded && isAppending && textarea.scrollHeight > prevMaxHeight || isInitialRender && scrollHeight > maxInputHeight;
113
126
  shouldScrollRef.current = shouldScroll;
@@ -122,7 +135,7 @@ const useTextAreaAutoResize = ({
122
135
  };
123
136
  });
124
137
  previousValueRef.current = value;
125
- }, [value, ref, enabled, containerWidth]);
138
+ }, [value, ref, enabled, containerWidth, maxLines]);
126
139
  useLayoutEffect(() => {
127
140
  if (shouldScrollRef.current) {
128
141
  scrollToBottom();
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Expands a textStyle token (or responsive object of tokens) into concrete
3
+ * CSS property values that can be spread directly onto a Chakra component.
4
+ *
5
+ * Supports:
6
+ * - Static values: `textStyle="heading-3"` → `{ fontSize, lineHeight, fontWeight }`
7
+ * - Responsive objects: `textStyle={{ mobile: 'heading-5', desktop: 'heading-3' }}`
8
+ * → `{ fontSize: { md: '...', '2xl': '...' }, lineHeight: { ... }, ... }`
9
+ *
10
+ * @param {any} value - A textStyle token string, responsive object, or undefined/null.
11
+ * @returns {Record<string, any>} An object of CSS props to spread, or an empty object if no match.
12
+ */
13
+ export declare function expandTextStyleProps(value: any): Record<string, any>;
@@ -0,0 +1,265 @@
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 only the specific tokens needed for text styles, rather than the
20
+ // entire foundations module. This avoids pulling unused tokens (colors,
21
+ // shadows, borders, etc.) into the layout bundle.
22
+ import { fontSizeXs, fontSizeSm, fontSizeBase, fontSizeLg, fontSizeXl, fontSizeXxl, fontSizeXxxl, fontSizeXxxxl, fontSizeXxxxxl, fontSize6Xl, fontSize7Xl, fontSize8Xl, lineHeightXs, lineHeightSm, lineHeightBase, lineHeightBaseTight, lineHeightLg, lineHeightLgTight, lineHeightXl, lineHeightXlTight, lineHeightXxl, lineHeightXxxl, lineHeightXxxxl, lineHeightXxxxxl, lineHeight6Xl, lineHeight7Xl, lineHeight8Xl, fontWeightBook, fontWeightBold, fontWeightBlack, fontWeightLight, letterSpacingTight, letterSpacingHero, fontFamilyLarken } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
23
+ import { BpkBreakpointToChakraKey } from "./tokens";
24
+ /**
25
+ * Maps Backpack text style tokens to concrete CSS properties.
26
+ *
27
+ * This map is intentionally kept outside the Chakra theme config so that
28
+ * layout-only consumers (who never use textStyle) do not pay for it.
29
+ * Components that use textStyle expand it inline via `expandTextStyleProps`.
30
+ */
31
+ const TEXT_STYLE_MAP = {
32
+ xs: {
33
+ fontSize: fontSizeXs,
34
+ lineHeight: lineHeightXs,
35
+ fontWeight: fontWeightBook
36
+ },
37
+ sm: {
38
+ fontSize: fontSizeSm,
39
+ lineHeight: lineHeightSm,
40
+ fontWeight: fontWeightBook
41
+ },
42
+ base: {
43
+ fontSize: fontSizeBase,
44
+ lineHeight: lineHeightBase,
45
+ fontWeight: fontWeightBook
46
+ },
47
+ lg: {
48
+ fontSize: fontSizeLg,
49
+ lineHeight: lineHeightLg,
50
+ fontWeight: fontWeightBook
51
+ },
52
+ xl: {
53
+ fontSize: fontSizeXl,
54
+ lineHeight: lineHeightXl,
55
+ fontWeight: fontWeightBook
56
+ },
57
+ xxl: {
58
+ fontSize: fontSizeXxl,
59
+ lineHeight: lineHeightXxl,
60
+ fontWeight: fontWeightBold
61
+ },
62
+ xxxl: {
63
+ fontSize: fontSizeXxxl,
64
+ lineHeight: lineHeightXxxl,
65
+ fontWeight: fontWeightBold
66
+ },
67
+ xxxxl: {
68
+ fontSize: fontSizeXxxxl,
69
+ lineHeight: lineHeightXxxxl,
70
+ fontWeight: fontWeightBold,
71
+ letterSpacing: letterSpacingTight
72
+ },
73
+ xxxxxl: {
74
+ fontSize: fontSizeXxxxxl,
75
+ lineHeight: lineHeightXxxxxl,
76
+ fontWeight: fontWeightBold,
77
+ letterSpacing: letterSpacingTight
78
+ },
79
+ caption: {
80
+ fontSize: fontSizeXs,
81
+ lineHeight: lineHeightXs,
82
+ fontWeight: fontWeightBook
83
+ },
84
+ footnote: {
85
+ fontSize: fontSizeSm,
86
+ lineHeight: lineHeightSm,
87
+ fontWeight: fontWeightBook
88
+ },
89
+ 'label-1': {
90
+ fontSize: fontSizeBase,
91
+ lineHeight: lineHeightBase,
92
+ fontWeight: fontWeightBold
93
+ },
94
+ 'label-2': {
95
+ fontSize: fontSizeSm,
96
+ lineHeight: lineHeightSm,
97
+ fontWeight: fontWeightBold
98
+ },
99
+ 'label-3': {
100
+ fontSize: fontSizeXs,
101
+ lineHeight: lineHeightXs,
102
+ fontWeight: fontWeightBold
103
+ },
104
+ 'body-default': {
105
+ fontSize: fontSizeBase,
106
+ lineHeight: lineHeightBase,
107
+ fontWeight: fontWeightBook
108
+ },
109
+ 'body-longform': {
110
+ fontSize: fontSizeLg,
111
+ lineHeight: lineHeightLg,
112
+ fontWeight: fontWeightBook
113
+ },
114
+ subheading: {
115
+ fontSize: fontSizeXl,
116
+ lineHeight: lineHeightXl,
117
+ fontWeight: fontWeightBook
118
+ },
119
+ 'heading-1': {
120
+ fontSize: fontSizeXxxl,
121
+ lineHeight: lineHeightXxxl,
122
+ fontWeight: fontWeightBold
123
+ },
124
+ 'heading-2': {
125
+ fontSize: fontSizeXxl,
126
+ lineHeight: lineHeightXxl,
127
+ fontWeight: fontWeightBold
128
+ },
129
+ 'heading-3': {
130
+ fontSize: fontSizeXl,
131
+ lineHeight: lineHeightXlTight,
132
+ fontWeight: fontWeightBold
133
+ },
134
+ 'heading-4': {
135
+ fontSize: fontSizeLg,
136
+ lineHeight: lineHeightLgTight,
137
+ fontWeight: fontWeightBold
138
+ },
139
+ 'heading-5': {
140
+ fontSize: fontSizeBase,
141
+ lineHeight: lineHeightBaseTight,
142
+ fontWeight: fontWeightBold
143
+ },
144
+ 'hero-1': {
145
+ fontSize: fontSize8Xl,
146
+ lineHeight: lineHeight8Xl,
147
+ fontWeight: fontWeightBlack,
148
+ letterSpacing: letterSpacingHero
149
+ },
150
+ 'hero-2': {
151
+ fontSize: fontSize7Xl,
152
+ lineHeight: lineHeight7Xl,
153
+ fontWeight: fontWeightBlack,
154
+ letterSpacing: letterSpacingHero
155
+ },
156
+ 'hero-3': {
157
+ fontSize: fontSize6Xl,
158
+ lineHeight: lineHeight6Xl,
159
+ fontWeight: fontWeightBlack,
160
+ letterSpacing: letterSpacingHero
161
+ },
162
+ 'hero-4': {
163
+ fontSize: fontSizeXxxxxl,
164
+ lineHeight: lineHeightXxxxxl,
165
+ fontWeight: fontWeightBlack,
166
+ letterSpacing: letterSpacingHero
167
+ },
168
+ 'hero-5': {
169
+ fontSize: fontSizeXxxxl,
170
+ lineHeight: lineHeightXxxl,
171
+ fontWeight: fontWeightBlack,
172
+ letterSpacing: letterSpacingHero
173
+ },
174
+ 'hero-6': {
175
+ fontSize: fontSizeXxxl,
176
+ lineHeight: lineHeightXxl,
177
+ fontWeight: fontWeightBlack,
178
+ letterSpacing: letterSpacingHero
179
+ },
180
+ 'editorial-1': {
181
+ fontFamily: `var(--bpk-larken-font-stack, ${fontFamilyLarken})`,
182
+ fontSize: fontSizeXxxxl,
183
+ lineHeight: lineHeightXxxxl,
184
+ fontWeight: fontWeightLight
185
+ },
186
+ 'editorial-2': {
187
+ fontFamily: `var(--bpk-larken-font-stack, ${fontFamilyLarken})`,
188
+ fontSize: fontSizeXxl,
189
+ lineHeight: lineHeightXxl,
190
+ fontWeight: fontWeightLight
191
+ },
192
+ 'editorial-3': {
193
+ fontFamily: `var(--bpk-larken-font-stack, ${fontFamilyLarken})`,
194
+ fontSize: fontSizeLg,
195
+ lineHeight: lineHeightLg,
196
+ fontWeight: fontWeightBook
197
+ }
198
+ };
199
+
200
+ /**
201
+ * Expands a textStyle token (or responsive object of tokens) into concrete
202
+ * CSS property values that can be spread directly onto a Chakra component.
203
+ *
204
+ * Supports:
205
+ * - Static values: `textStyle="heading-3"` → `{ fontSize, lineHeight, fontWeight }`
206
+ * - Responsive objects: `textStyle={{ mobile: 'heading-5', desktop: 'heading-3' }}`
207
+ * → `{ fontSize: { md: '...', '2xl': '...' }, lineHeight: { ... }, ... }`
208
+ *
209
+ * @param {any} value - A textStyle token string, responsive object, or undefined/null.
210
+ * @returns {Record<string, any>} An object of CSS props to spread, or an empty object if no match.
211
+ */
212
+ // eslint-disable-next-line import/prefer-default-export
213
+ export function expandTextStyleProps(value) {
214
+ if (value == null) return {};
215
+
216
+ // Responsive object: { mobile: 'heading-5', desktop: 'heading-3' }
217
+ if (typeof value === 'object' && !Array.isArray(value)) {
218
+ // Normalise Backpack breakpoint keys to Chakra keys inline (avoids
219
+ // circular dependency on tokenUtils).
220
+ const normalized = {};
221
+ Object.entries(value).forEach(([key, val]) => {
222
+ if (key === 'base') {
223
+ normalized.base = val;
224
+ } else {
225
+ const chakraKey = BpkBreakpointToChakraKey[key];
226
+ if (chakraKey) {
227
+ normalized[chakraKey] = val;
228
+ }
229
+ }
230
+ });
231
+
232
+ // Pivot from { bp -> token } to { cssProp -> { bp -> cssValue } }
233
+ const result = {};
234
+ Object.entries(normalized).forEach(([bp, token]) => {
235
+ const style = TEXT_STYLE_MAP[String(token)];
236
+ if (!style) {
237
+ if (process.env.NODE_ENV !== 'production') {
238
+ // eslint-disable-next-line no-console
239
+ console.warn(`Unknown textStyle token "${String(token)}" at breakpoint "${bp}".`);
240
+ }
241
+ return;
242
+ }
243
+ Object.entries(style).forEach(([cssProp, cssValue]) => {
244
+ if (!result[cssProp]) {
245
+ result[cssProp] = {};
246
+ }
247
+ result[cssProp][bp] = cssValue;
248
+ });
249
+ });
250
+ return result;
251
+ }
252
+
253
+ // Static string value
254
+ const style = TEXT_STYLE_MAP[String(value)];
255
+ if (!style) {
256
+ if (process.env.NODE_ENV !== 'production') {
257
+ // eslint-disable-next-line no-console
258
+ console.warn(`Unknown textStyle token "${String(value)}".`);
259
+ }
260
+ return {};
261
+ }
262
+ return {
263
+ ...style
264
+ };
265
+ }
@@ -18,9 +18,17 @@
18
18
 
19
19
  import { defineConfig } from '@chakra-ui/react';
20
20
 
21
- // Import tokens from Backpack foundations
22
- // Note: Some tokens may not be in TypeScript definitions but exist at runtime
23
- import * as bpkTokens from '@skyscanner/bpk-foundations-web/tokens/base.es6';
21
+ // Import only the tokens needed for border/radius/shadow utilities.
22
+ // Typography tokens have been moved to resolveTextStyle.ts where textStyle is
23
+ // resolved inline, avoiding the need to bundle the full text style map in the
24
+ // Chakra theme config.
25
+ import {
26
+ // Border sizes
27
+ borderSizeSm, borderSizeLg, borderSizeXl,
28
+ // Border radii
29
+ borderRadiusXs, borderRadiusSm, borderRadiusMd, borderRadiusLg, borderRadiusXl, borderRadiusFull,
30
+ // Box shadows
31
+ boxShadowSm, boxShadowLg, boxShadowXl } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
24
32
  // NOTE:
25
33
  // We intentionally do not use the raw breakpoint *values* from foundations here.
26
34
  // Foundations exports breakpoint values such as `breakpointMobile = "32rem"` which
@@ -100,9 +108,9 @@ const spacingMap = {
100
108
  * These come directly from @skyscanner/bpk-foundations-web
101
109
  */
102
110
  const borderSizeMap = {
103
- 'bpk-border-size-sm': bpkTokens.borderSizeSm,
104
- 'bpk-border-size-lg': bpkTokens.borderSizeLg,
105
- 'bpk-border-size-xl': bpkTokens.borderSizeXl
111
+ 'bpk-border-size-sm': borderSizeSm,
112
+ 'bpk-border-size-lg': borderSizeLg,
113
+ 'bpk-border-size-xl': borderSizeXl
106
114
  };
107
115
 
108
116
  /**
@@ -111,12 +119,12 @@ const borderSizeMap = {
111
119
  */
112
120
  const borderRadiusMap = {
113
121
  'bpk-border-radius-none': '0',
114
- 'bpk-border-radius-xs': bpkTokens.borderRadiusXs,
115
- 'bpk-border-radius-sm': bpkTokens.borderRadiusSm,
116
- 'bpk-border-radius-md': bpkTokens.borderRadiusMd,
117
- 'bpk-border-radius-lg': bpkTokens.borderRadiusLg,
118
- 'bpk-border-radius-xl': bpkTokens.borderRadiusXl,
119
- 'bpk-border-radius-full': bpkTokens.borderRadiusFull
122
+ 'bpk-border-radius-xs': borderRadiusXs,
123
+ 'bpk-border-radius-sm': borderRadiusSm,
124
+ 'bpk-border-radius-md': borderRadiusMd,
125
+ 'bpk-border-radius-lg': borderRadiusLg,
126
+ 'bpk-border-radius-xl': borderRadiusXl,
127
+ 'bpk-border-radius-full': borderRadiusFull
120
128
  };
121
129
 
122
130
  /**
@@ -124,9 +132,9 @@ const borderRadiusMap = {
124
132
  * These come directly from @skyscanner/bpk-foundations-web
125
133
  */
126
134
  const shadowMap = {
127
- 'bpk-shadow-sm': bpkTokens.boxShadowSm,
128
- 'bpk-shadow-lg': bpkTokens.boxShadowLg,
129
- 'bpk-shadow-xl': bpkTokens.boxShadowXl
135
+ 'bpk-shadow-sm': boxShadowSm,
136
+ 'bpk-shadow-lg': boxShadowLg,
137
+ 'bpk-shadow-xl': boxShadowXl
130
138
  };
131
139
 
132
140
  /**
@@ -209,242 +217,6 @@ export function getBorderRadiusValue(token) {
209
217
  export function getShadowValue(token) {
210
218
  return shadowMap[token];
211
219
  }
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
- };
448
220
  export function createBpkConfig() {
449
221
  // Convert breakpoint map to Chakra UI format
450
222
  // Breakpoints in Chakra v3 are typically simple strings in the breakpoints object
@@ -452,6 +224,12 @@ export function createBpkConfig() {
452
224
  Object.entries(breakpointMap).forEach(([token, value]) => {
453
225
  chakraBreakpoints[token] = value;
454
226
  });
227
+
228
+ // textStyles have been removed from the Chakra config to reduce bundle size.
229
+ // Text style resolution is now handled inline by resolveTextStyle.ts via
230
+ // expandTextStyleProps(), which expands textStyle tokens into concrete CSS
231
+ // properties at prop-processing time. This means layout-only consumers that
232
+ // never use textStyle pay nothing for the typography map.
455
233
  return defineConfig({
456
234
  // Disable Chakra's preflight (CSS reset) so it does not override Backpack's
457
235
  // global font styles, in particular the `-webkit-font-smoothing: antialiased`
@@ -462,7 +240,6 @@ export function createBpkConfig() {
462
240
  tokens: {
463
241
  spacing: spacingMap
464
242
  },
465
- textStyles: textStylesMap,
466
243
  breakpoints: chakraBreakpoints
467
244
  }
468
245
  });