@skyscanner/backpack-web 42.10.0-dev-v24496611676.1 → 42.11.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-bottom-sheet/src/BpkBottomSheet.js +1 -0
- package/bpk-component-layout/index.d.ts +0 -4
- package/bpk-component-layout/index.js +0 -2
- package/bpk-component-layout/src/BpkBox.js +13 -16
- package/bpk-component-layout/src/BpkFlex.js +9 -20
- package/bpk-component-layout/src/BpkGrid.js +9 -20
- package/bpk-component-layout/src/BpkGridItem.js +15 -23
- package/bpk-component-layout/src/BpkProvider.d.ts +10 -7
- package/bpk-component-layout/src/BpkProvider.js +98 -12
- package/bpk-component-layout/src/BpkStack.constant.js +2 -3
- package/bpk-component-layout/src/BpkStack.js +40 -89
- package/bpk-component-layout/src/commonProps.d.ts +1 -8
- package/bpk-component-layout/src/theme.d.ts +1 -0
- package/bpk-component-layout/src/theme.js +301 -27
- package/bpk-component-layout/src/tokenUtils.js +11 -34
- package/bpk-component-layout/src/types.d.ts +147 -84
- package/bpk-component-navigation-bar/src/BpkNavigationBar.d.ts +3 -0
- package/bpk-component-navigation-bar/src/BpkNavigationBar.js +2 -1
- package/bpk-component-navigation-bar/src/BpkNavigationBar.module.css +1 -1
- package/bpk-component-page-indicator/src/NavButton.js +3 -3
- package/package.json +3 -2
- package/bpk-component-layout/src/BpkArkProvider.d.ts +0 -20
- package/bpk-component-layout/src/BpkArkProvider.js +0 -112
- package/bpk-component-layout/src/BpkLayoutProvider.d.ts +0 -18
- package/bpk-component-layout/src/BpkLayoutProvider.js +0 -36
- package/bpk-component-layout/src/resolveTextStyle.d.ts +0 -13
- package/bpk-component-layout/src/resolveTextStyle.js +0 -265
- package/bpk-component-layout/src/responsiveStyleBuilder.d.ts +0 -22
- package/bpk-component-layout/src/responsiveStyleBuilder.js +0 -152
- package/bpk-component-layout/src/useCurrentBreakpoint.d.ts +0 -9
- package/bpk-component-layout/src/useCurrentBreakpoint.js +0 -89
|
@@ -16,26 +16,19 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
// Typography tokens have been moved to resolveTextStyle.ts where textStyle is
|
|
21
|
-
// resolved inline, avoiding the need to bundle the full text style map in the
|
|
22
|
-
// Chakra theme config.
|
|
23
|
-
import {
|
|
24
|
-
// Border sizes
|
|
25
|
-
borderSizeSm, borderSizeLg, borderSizeXl,
|
|
26
|
-
// Border radii
|
|
27
|
-
borderRadiusXs, borderRadiusSm, borderRadiusMd, borderRadiusLg, borderRadiusXl, borderRadiusFull,
|
|
28
|
-
// Box shadows
|
|
29
|
-
boxShadowSm, boxShadowLg, boxShadowXl } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
19
|
+
import { defineConfig } from '@chakra-ui/react';
|
|
30
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';
|
|
31
24
|
// NOTE:
|
|
32
25
|
// We intentionally do not use the raw breakpoint *values* from foundations here.
|
|
33
26
|
// Foundations exports breakpoint values such as `breakpointMobile = "32rem"` which
|
|
34
27
|
// are used primarily for max-width queries (e.g. `(max-width: 32rem)`).
|
|
35
28
|
//
|
|
36
29
|
// Backpack layout responsive values in this package are mobile-first and behave
|
|
37
|
-
//
|
|
38
|
-
// we define lower-bound (min-width) thresholds:
|
|
30
|
+
// like Chakra breakpoints (min-width thresholds). To align with Backpack’s
|
|
31
|
+
// intended breakpoint ranges we define lower-bound (min-width) thresholds:
|
|
39
32
|
//
|
|
40
33
|
// - small-mobile: 320px+
|
|
41
34
|
// - mobile: 360px+
|
|
@@ -107,9 +100,9 @@ const spacingMap = {
|
|
|
107
100
|
* These come directly from @skyscanner/bpk-foundations-web
|
|
108
101
|
*/
|
|
109
102
|
const borderSizeMap = {
|
|
110
|
-
'bpk-border-size-sm': borderSizeSm,
|
|
111
|
-
'bpk-border-size-lg': borderSizeLg,
|
|
112
|
-
'bpk-border-size-xl': borderSizeXl
|
|
103
|
+
'bpk-border-size-sm': bpkTokens.borderSizeSm,
|
|
104
|
+
'bpk-border-size-lg': bpkTokens.borderSizeLg,
|
|
105
|
+
'bpk-border-size-xl': bpkTokens.borderSizeXl
|
|
113
106
|
};
|
|
114
107
|
|
|
115
108
|
/**
|
|
@@ -118,12 +111,12 @@ const borderSizeMap = {
|
|
|
118
111
|
*/
|
|
119
112
|
const borderRadiusMap = {
|
|
120
113
|
'bpk-border-radius-none': '0',
|
|
121
|
-
'bpk-border-radius-xs': borderRadiusXs,
|
|
122
|
-
'bpk-border-radius-sm': borderRadiusSm,
|
|
123
|
-
'bpk-border-radius-md': borderRadiusMd,
|
|
124
|
-
'bpk-border-radius-lg': borderRadiusLg,
|
|
125
|
-
'bpk-border-radius-xl': borderRadiusXl,
|
|
126
|
-
'bpk-border-radius-full': borderRadiusFull
|
|
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
|
|
127
120
|
};
|
|
128
121
|
|
|
129
122
|
/**
|
|
@@ -131,13 +124,36 @@ const borderRadiusMap = {
|
|
|
131
124
|
* These come directly from @skyscanner/bpk-foundations-web
|
|
132
125
|
*/
|
|
133
126
|
const shadowMap = {
|
|
134
|
-
'bpk-shadow-sm': boxShadowSm,
|
|
135
|
-
'bpk-shadow-lg': boxShadowLg,
|
|
136
|
-
'bpk-shadow-xl': boxShadowXl
|
|
127
|
+
'bpk-shadow-sm': bpkTokens.boxShadowSm,
|
|
128
|
+
'bpk-shadow-lg': bpkTokens.boxShadowLg,
|
|
129
|
+
'bpk-shadow-xl': bpkTokens.boxShadowXl
|
|
137
130
|
};
|
|
138
131
|
|
|
139
|
-
|
|
140
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Chakra expects raw width values (e.g. "48rem"), not full media queries.
|
|
134
|
+
* The media query construction is handled internally by Chakra's system.
|
|
135
|
+
*
|
|
136
|
+
* We align Backpack breakpoint tokens to Chakra's keys like this:
|
|
137
|
+
* - base: 0 (implicit)
|
|
138
|
+
* - sm: small-mobile (>= 320px)
|
|
139
|
+
* - md: mobile (>= 360px)
|
|
140
|
+
* - lg: small-tablet (>= 513px)
|
|
141
|
+
* - xl: tablet (>= 769px)
|
|
142
|
+
* - 2xl: desktop (>= 1025px)
|
|
143
|
+
*/
|
|
144
|
+
// TODO: CLOV-1021 - will add breakpoint boundary tokens to Backpack Foundations package and use them here after we ship the PoC
|
|
145
|
+
const breakpointMap = {
|
|
146
|
+
base: '0rem',
|
|
147
|
+
sm: '20rem',
|
|
148
|
+
// 320px
|
|
149
|
+
md: '22.5rem',
|
|
150
|
+
// 360px
|
|
151
|
+
lg: '32.0625rem',
|
|
152
|
+
// 513px
|
|
153
|
+
xl: '48.0625rem',
|
|
154
|
+
// 769px
|
|
155
|
+
'2xl': '64.0625rem' // 1025px
|
|
156
|
+
};
|
|
141
157
|
|
|
142
158
|
/**
|
|
143
159
|
* Exports spacing map for use in tokenUtils
|
|
@@ -192,4 +208,262 @@ export function getBorderRadiusValue(token) {
|
|
|
192
208
|
*/
|
|
193
209
|
export function getShadowValue(token) {
|
|
194
210
|
return shadowMap[token];
|
|
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
|
+
};
|
|
448
|
+
export function createBpkConfig() {
|
|
449
|
+
// Convert breakpoint map to Chakra UI format
|
|
450
|
+
// Breakpoints in Chakra v3 are typically simple strings in the breakpoints object
|
|
451
|
+
const chakraBreakpoints = {};
|
|
452
|
+
Object.entries(breakpointMap).forEach(([token, value]) => {
|
|
453
|
+
chakraBreakpoints[token] = value;
|
|
454
|
+
});
|
|
455
|
+
return defineConfig({
|
|
456
|
+
// Disable Chakra's preflight (CSS reset) so it does not override Backpack's
|
|
457
|
+
// global font styles, in particular the `-webkit-font-smoothing: antialiased`
|
|
458
|
+
// setting applied by Backpack.
|
|
459
|
+
preflight: false,
|
|
460
|
+
cssVarsPrefix: 'bpk',
|
|
461
|
+
theme: {
|
|
462
|
+
tokens: {
|
|
463
|
+
spacing: spacingMap
|
|
464
|
+
},
|
|
465
|
+
textStyles: textStylesMap,
|
|
466
|
+
breakpoints: chakraBreakpoints
|
|
467
|
+
}
|
|
468
|
+
});
|
|
195
469
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import
|
|
19
|
+
import StackOptionKeys from "./BpkStack.constant";
|
|
20
20
|
import { getSpacingValue } from "./theme";
|
|
21
21
|
import { BpkBreakpointToChakraKey, isValidSpacingValue, isValidSizeValue, isValidPositionValue, isPercentage } from "./tokens";
|
|
22
22
|
|
|
@@ -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
|
|
@@ -50,14 +52,14 @@ export const BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT = {
|
|
|
50
52
|
},
|
|
51
53
|
// Note: BpkFlex maps its public API props to these Chakra keys.
|
|
52
54
|
BpkFlex: {
|
|
53
|
-
container: ['flexDirection', 'justifyContent', 'alignItems', 'flexWrap',
|
|
55
|
+
container: ['textStyle', 'flexDirection', 'justifyContent', 'alignItems', 'flexWrap',
|
|
54
56
|
// Position keyword and overflow (from BpkCommonLayoutProps)
|
|
55
57
|
'position', 'overflow', 'overflowX', 'overflowY'],
|
|
56
58
|
item: ['flexGrow', 'flexShrink', 'flexBasis']
|
|
57
59
|
},
|
|
58
60
|
// Note: BpkGrid maps its public API props to these Chakra keys.
|
|
59
61
|
BpkGrid: {
|
|
60
|
-
container: ['justifyContent', 'alignItems', 'gridTemplateColumns', 'gridTemplateRows', 'gridTemplateAreas', 'gridAutoFlow', 'gridAutoRows', 'gridAutoColumns',
|
|
62
|
+
container: ['textStyle', 'justifyContent', 'alignItems', 'gridTemplateColumns', 'gridTemplateRows', 'gridTemplateAreas', 'gridAutoFlow', 'gridAutoRows', 'gridAutoColumns',
|
|
61
63
|
// Position keyword and overflow (from BpkCommonLayoutProps)
|
|
62
64
|
'position', 'overflow', 'overflowX', 'overflowY'],
|
|
63
65
|
item: [
|
|
@@ -65,13 +67,11 @@ export const BPK_RESPONSIVE_PROP_GROUPS_BY_COMPONENT = {
|
|
|
65
67
|
'gridColumn', 'gridRow']
|
|
66
68
|
},
|
|
67
69
|
BpkGridItem: {
|
|
68
|
-
container: ['position', 'overflow', 'overflowX', 'overflowY']
|
|
70
|
+
container: ['textStyle', 'position', 'overflow', 'overflowX', 'overflowY']
|
|
69
71
|
},
|
|
70
|
-
// BpkStack
|
|
71
|
-
// names (alignItems, justifyContent, flexWrap, flexDirection) via responsiveProps.
|
|
72
|
-
// The allowlist must use the CSS-standard names since that's what arrives here.
|
|
72
|
+
// Note: BpkStack uses Chakra Stack option prop names directly.
|
|
73
73
|
BpkStack: {
|
|
74
|
-
container: ['
|
|
74
|
+
container: ['textStyle', ...StackOptionKeys,
|
|
75
75
|
// Position keyword and overflow (from BpkCommonLayoutProps)
|
|
76
76
|
'position', 'overflow', 'overflowX', 'overflowY']
|
|
77
77
|
}
|
|
@@ -108,37 +108,18 @@ function filterToAllowlist(props, allowlist) {
|
|
|
108
108
|
*/
|
|
109
109
|
export function processBpkComponentProps(props, options) {
|
|
110
110
|
const processed = processBpkProps(props);
|
|
111
|
-
|
|
112
|
-
// --- textStyle inline resolution ---
|
|
113
|
-
// textStyle is no longer part of the Chakra theme config. Instead we resolve
|
|
114
|
-
// it here into concrete CSS properties (fontSize, lineHeight, fontWeight, etc.).
|
|
115
|
-
// The value may come from:
|
|
116
|
-
// - responsiveProps (BpkFlex, BpkGrid explicitly pass it)
|
|
117
|
-
// - processed props (BpkBox, BpkStack pass it via ...props)
|
|
118
|
-
const textStyleValue = options.responsiveProps?.textStyle ?? processed.textStyle;
|
|
119
|
-
delete processed.textStyle;
|
|
120
|
-
// Strip textStyle from responsiveProps without mutating the original object.
|
|
121
|
-
const {
|
|
122
|
-
textStyle: _ts,
|
|
123
|
-
...cleanResponsiveProps
|
|
124
|
-
} = options.responsiveProps ?? {};
|
|
125
|
-
const expandedTextStyle = expandTextStyleProps(textStyleValue);
|
|
126
111
|
const allowlist = BPK_RESPONSIVE_PROP_KEYS_BY_COMPONENT[options.component];
|
|
127
112
|
// When responsiveProps is provided (e.g. BpkFlex maps direction→flexDirection),
|
|
128
113
|
// merge it with any allowlisted props already in `processed` (e.g. position/overflow
|
|
129
114
|
// that come in via ...props and are NOT included in responsiveProps).
|
|
130
115
|
// responsiveProps takes precedence so that explicit prop-name mappings always win.
|
|
131
116
|
const processedAllowlisted = filterToAllowlist(processed, allowlist);
|
|
132
|
-
const
|
|
133
|
-
const responsiveSource = hasResponsiveProps ? {
|
|
117
|
+
const responsiveSource = options.responsiveProps ? {
|
|
134
118
|
...processedAllowlisted,
|
|
135
|
-
...filterToAllowlist(
|
|
119
|
+
...filterToAllowlist(options.responsiveProps, allowlist)
|
|
136
120
|
} : processedAllowlisted;
|
|
137
121
|
if (Object.keys(responsiveSource).length === 0) {
|
|
138
|
-
return
|
|
139
|
-
...processed,
|
|
140
|
-
...expandedTextStyle
|
|
141
|
-
};
|
|
122
|
+
return processed;
|
|
142
123
|
}
|
|
143
124
|
|
|
144
125
|
// Ensure allowlisted layout props do NOT fall through unprocessed (e.g. array responsive values).
|
|
@@ -159,11 +140,7 @@ export function processBpkComponentProps(props, options) {
|
|
|
159
140
|
delete responsiveProcessed[key];
|
|
160
141
|
}
|
|
161
142
|
});
|
|
162
|
-
|
|
163
|
-
// Expanded textStyle props are applied last so they don't get overridden by
|
|
164
|
-
// the responsive pipeline, but explicit CSS props from the user take precedence.
|
|
165
143
|
return {
|
|
166
|
-
...expandedTextStyle,
|
|
167
144
|
...cleanedProcessed,
|
|
168
145
|
...responsiveProcessed
|
|
169
146
|
};
|