@skyscanner/backpack-web 42.9.0 → 42.10.0-dev-v24445021679.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 (56) 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/index.d.ts +4 -0
  26. package/bpk-component-layout/index.js +2 -0
  27. package/bpk-component-layout/src/BpkArkProvider.d.ts +20 -0
  28. package/bpk-component-layout/src/BpkArkProvider.js +112 -0
  29. package/bpk-component-layout/src/BpkLayoutProvider.d.ts +19 -0
  30. package/bpk-component-layout/src/BpkLayoutProvider.js +50 -0
  31. package/bpk-component-layout/src/BpkProvider.d.ts +6 -7
  32. package/bpk-component-layout/src/BpkProvider.js +13 -96
  33. package/bpk-component-layout/src/resolveTextStyle.d.ts +13 -0
  34. package/bpk-component-layout/src/resolveTextStyle.js +265 -0
  35. package/bpk-component-layout/src/theme.js +29 -252
  36. package/bpk-component-layout/src/tokenUtils.js +31 -9
  37. package/bpk-component-select/index.d.ts +5 -0
  38. package/bpk-component-select/index.js +3 -1
  39. package/bpk-component-select/src/BpkSelect.d.ts +18 -0
  40. package/bpk-component-select/src/BpkSelect.js +3 -28
  41. package/bpk-component-select/src/themeAttributes.d.ts +2 -0
  42. package/bpk-component-text/src/BpkText.module.css +1 -1
  43. package/bpk-component-theme-toggle/src/BpkThemeToggle.js +0 -1
  44. package/bpk-scrim-utils/src/focusScope.d.ts +5 -0
  45. package/bpk-scrim-utils/src/focusScope.js +88 -0
  46. package/bpk-scrim-utils/src/focusStore.d.ts +6 -0
  47. package/bpk-scrim-utils/src/focusStore.js +74 -0
  48. package/bpk-scrim-utils/src/withScrim.js +2 -5
  49. package/bpk-stylesheets/base.css +1 -1
  50. package/bpk-stylesheets/font.css +1 -1
  51. package/bpk-stylesheets/font.scss +80 -1
  52. package/bpk-stylesheets/larken.css +1 -1
  53. package/bpk-stylesheets/larken.scss +63 -1
  54. package/package.json +3 -5
  55. package/bpk-component-chatbot-input/src/SendButton/SendButton.d.ts +0 -9
  56. package/bpk-component-chatbot-input/src/SendButton/SendButton.js +0 -47
@@ -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
  });
@@ -17,6 +17,7 @@
17
17
  */
18
18
 
19
19
  import StackOptionKeys from "./BpkStack.constant";
20
+ import { expandTextStyleProps } from "./resolveTextStyle";
20
21
  import { getSpacingValue } from "./theme";
21
22
  import { BpkBreakpointToChakraKey, isValidSpacingValue, isValidSizeValue, isValidPositionValue, isPercentage } from "./tokens";
22
23
 
@@ -34,8 +35,6 @@ import { BpkBreakpointToChakraKey, isValidSpacingValue, isValidSizeValue, isVali
34
35
  export const BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT = {
35
36
  BpkBox: {
36
37
  container: [
37
- // Typography
38
- 'textStyle',
39
38
  // Display
40
39
  'display',
41
40
  // Flex container props
@@ -52,14 +51,14 @@ export const BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT = {
52
51
  },
53
52
  // Note: BpkFlex maps its public API props to these Chakra keys.
54
53
  BpkFlex: {
55
- container: ['textStyle', 'flexDirection', 'justifyContent', 'alignItems', 'flexWrap',
54
+ container: ['flexDirection', 'justifyContent', 'alignItems', 'flexWrap',
56
55
  // Position keyword and overflow (from BpkCommonLayoutProps)
57
56
  'position', 'overflow', 'overflowX', 'overflowY'],
58
57
  item: ['flexGrow', 'flexShrink', 'flexBasis']
59
58
  },
60
59
  // Note: BpkGrid maps its public API props to these Chakra keys.
61
60
  BpkGrid: {
62
- container: ['textStyle', 'justifyContent', 'alignItems', 'gridTemplateColumns', 'gridTemplateRows', 'gridTemplateAreas', 'gridAutoFlow', 'gridAutoRows', 'gridAutoColumns',
61
+ container: ['justifyContent', 'alignItems', 'gridTemplateColumns', 'gridTemplateRows', 'gridTemplateAreas', 'gridAutoFlow', 'gridAutoRows', 'gridAutoColumns',
63
62
  // Position keyword and overflow (from BpkCommonLayoutProps)
64
63
  'position', 'overflow', 'overflowX', 'overflowY'],
65
64
  item: [
@@ -67,11 +66,11 @@ export const BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT = {
67
66
  'gridColumn', 'gridRow']
68
67
  },
69
68
  BpkGridItem: {
70
- container: ['textStyle', 'position', 'overflow', 'overflowX', 'overflowY']
69
+ container: ['position', 'overflow', 'overflowX', 'overflowY']
71
70
  },
72
71
  // Note: BpkStack uses Chakra Stack option prop names directly.
73
72
  BpkStack: {
74
- container: ['textStyle', ...StackOptionKeys,
73
+ container: [...StackOptionKeys,
75
74
  // Position keyword and overflow (from BpkCommonLayoutProps)
76
75
  'position', 'overflow', 'overflowX', 'overflowY']
77
76
  }
@@ -108,18 +107,37 @@ function filterToAllowlist(props, allowlist) {
108
107
  */
109
108
  export function processBpkComponentProps(props, options) {
110
109
  const processed = processBpkProps(props);
110
+
111
+ // --- textStyle inline resolution ---
112
+ // textStyle is no longer part of the Chakra theme config. Instead we resolve
113
+ // it here into concrete CSS properties (fontSize, lineHeight, fontWeight, etc.).
114
+ // The value may come from:
115
+ // - responsiveProps (BpkFlex, BpkGrid explicitly pass it)
116
+ // - processed props (BpkBox, BpkStack pass it via ...props)
117
+ const textStyleValue = options.responsiveProps?.textStyle ?? processed.textStyle;
118
+ delete processed.textStyle;
119
+ // Strip textStyle from responsiveProps without mutating the original object.
120
+ const {
121
+ textStyle: _ts,
122
+ ...cleanResponsiveProps
123
+ } = options.responsiveProps ?? {};
124
+ const expandedTextStyle = expandTextStyleProps(textStyleValue);
111
125
  const allowlist = BPK_RESPONSIVE_PROP_KEYS_BY_COMPONENT[options.component];
112
126
  // When responsiveProps is provided (e.g. BpkFlex maps direction→flexDirection),
113
127
  // merge it with any allowlisted props already in `processed` (e.g. position/overflow
114
128
  // that come in via ...props and are NOT included in responsiveProps).
115
129
  // responsiveProps takes precedence so that explicit prop-name mappings always win.
116
130
  const processedAllowlisted = filterToAllowlist(processed, allowlist);
117
- const responsiveSource = options.responsiveProps ? {
131
+ const hasResponsiveProps = Object.keys(cleanResponsiveProps).length > 0;
132
+ const responsiveSource = hasResponsiveProps ? {
118
133
  ...processedAllowlisted,
119
- ...filterToAllowlist(options.responsiveProps, allowlist)
134
+ ...filterToAllowlist(cleanResponsiveProps, allowlist)
120
135
  } : processedAllowlisted;
121
136
  if (Object.keys(responsiveSource).length === 0) {
122
- return processed;
137
+ return {
138
+ ...processed,
139
+ ...expandedTextStyle
140
+ };
123
141
  }
124
142
 
125
143
  // Ensure allowlisted layout props do NOT fall through unprocessed (e.g. array responsive values).
@@ -140,7 +158,11 @@ export function processBpkComponentProps(props, options) {
140
158
  delete responsiveProcessed[key];
141
159
  }
142
160
  });
161
+
162
+ // Expanded textStyle props are applied last so they don't get overridden by
163
+ // the responsive pipeline, but explicit CSS props from the user take precedence.
143
164
  return {
165
+ ...expandedTextStyle,
144
166
  ...cleanedProcessed,
145
167
  ...responsiveProcessed
146
168
  };
@@ -0,0 +1,5 @@
1
+ import BpkSelect, { type Props } from './src/BpkSelect';
2
+ import themeAttributes from './src/themeAttributes';
3
+ export type BpkSelectProps = Props;
4
+ export default BpkSelect;
5
+ export { themeAttributes };