@skyscanner/backpack-web 42.0.0-test → 42.0.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.
Files changed (44) hide show
  1. package/bpk-component-button/index.d.ts +3 -3
  2. package/bpk-component-button/index.js +3 -3
  3. package/bpk-component-button/src/BpkButton.d.ts +3 -0
  4. package/bpk-component-button/src/{BpkButton/BpkButton.js → BpkButton.js} +39 -7
  5. package/bpk-component-button/src/BpkButton.module.css +18 -0
  6. package/bpk-component-button/src/{BpkButton/common-types.d.ts → common-types.d.ts} +2 -0
  7. package/bpk-component-button/src/themeAttributes.d.ts +1 -0
  8. package/bpk-component-button/src/themeAttributes.js +2 -1
  9. package/bpk-component-chip/index.d.ts +2 -2
  10. package/bpk-component-chip/index.js +2 -2
  11. package/bpk-component-chip/src/BpkSelectableChip.module.css +1 -1
  12. package/bpk-component-chip/src/themeAttributes.d.ts +4 -0
  13. package/bpk-component-chip/src/themeAttributes.js +7 -1
  14. package/bpk-component-pagination/src/BpkPaginationPage.module.css +1 -1
  15. package/bpk-component-scrollable-calendar/src/utils.d.ts +1 -1
  16. package/bpk-component-segmented-control/index.d.ts +2 -0
  17. package/bpk-component-segmented-control/index.js +2 -1
  18. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.d.ts +19 -0
  19. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.js +81 -0
  20. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.module.css +18 -0
  21. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/common-types.d.ts +57 -0
  22. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/common-types.js +24 -0
  23. package/bpk-component-table/index.d.ts +13 -0
  24. package/bpk-component-table/index.js +3 -1
  25. package/bpk-component-table/src/BpkTable.d.ts +8 -0
  26. package/bpk-component-table/src/BpkTable.js +7 -14
  27. package/bpk-component-table/src/BpkTableBody.d.ts +7 -0
  28. package/bpk-component-table/src/BpkTableBody.js +3 -5
  29. package/bpk-component-table/src/BpkTableCell.d.ts +9 -0
  30. package/bpk-component-table/src/BpkTableCell.js +7 -15
  31. package/bpk-component-table/src/BpkTableHead.d.ts +7 -0
  32. package/bpk-component-table/src/BpkTableHead.js +3 -5
  33. package/bpk-component-table/src/BpkTableHeadCell.d.ts +9 -0
  34. package/bpk-component-table/src/BpkTableHeadCell.js +2 -6
  35. package/bpk-component-table/src/BpkTableRow.d.ts +7 -0
  36. package/bpk-component-table/src/BpkTableRow.js +3 -5
  37. package/bpk-mixins/_buttons.scss +168 -76
  38. package/bpk-mixins/_chips.scss +104 -18
  39. package/bpk-mixins/_index.scss +1 -0
  40. package/bpk-mixins/_segmented-control.scss +263 -0
  41. package/package.json +2 -1
  42. package/bpk-component-button/src/BpkButton/BpkButton.d.ts +0 -3
  43. package/bpk-component-button/src/BpkButton/BpkButton.module.css +0 -18
  44. /package/bpk-component-button/src/{BpkButton/common-types.js → common-types.js} +0 -0
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  /*
2
3
  * Backpack - Skyscanner's Design System
3
4
  *
@@ -14,12 +15,9 @@
14
15
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
16
  * See the License for the specific language governing permissions and
16
17
  * limitations under the License.
17
- */import PropTypes from 'prop-types';
18
- import { jsx as _jsx } from "react/jsx-runtime";
18
+ */
19
+
19
20
  const BpkTableBody = props => /*#__PURE__*/_jsx("tbody", {
20
21
  ...props
21
22
  });
22
- BpkTableBody.propTypes = {
23
- children: PropTypes.node.isRequired
24
- };
25
23
  export default BpkTableBody;
@@ -0,0 +1,9 @@
1
+ import type { ReactNode, HTMLAttributes } from 'react';
2
+ export interface BpkTableCellProps extends Omit<HTMLAttributes<HTMLTableCellElement>, 'className'> {
3
+ /** The content of the table */
4
+ children: ReactNode;
5
+ className?: string | null;
6
+ wordBreak?: boolean;
7
+ }
8
+ declare const BpkTableCell: ({ children, className, wordBreak, ...rest }: BpkTableCellProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default BpkTableCell;
@@ -14,7 +14,8 @@
14
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
- */import PropTypes from 'prop-types';
17
+ */
18
+
18
19
  import { cssModules } from "../../bpk-react-utils";
19
20
  import STYLES from "./BpkTable.module.css";
20
21
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -27,19 +28,10 @@ const BpkTableCell = ({
27
28
  }) => {
28
29
  const classes = ['bpk-table__cell', wordBreak && 'bpk-table__cell--wordBreak', className];
29
30
  const classNames = getClassName(...classes);
30
- return (
31
- /*#__PURE__*/
32
- // $FlowFixMe[cannot-spread-inexact] - inexact rest. See decisions/flowfixme.md
33
- _jsx("td", {
34
- className: classNames,
35
- ...rest,
36
- children: children
37
- })
38
- );
39
- };
40
- BpkTableCell.propTypes = {
41
- className: PropTypes.string,
42
- children: PropTypes.node.isRequired,
43
- wordBreak: PropTypes.bool
31
+ return /*#__PURE__*/_jsx("td", {
32
+ className: classNames,
33
+ ...rest,
34
+ children: children
35
+ });
44
36
  };
45
37
  export default BpkTableCell;
@@ -0,0 +1,7 @@
1
+ import type { ReactNode, HTMLAttributes } from 'react';
2
+ export interface BpkTableHeadProps extends HTMLAttributes<HTMLTableSectionElement> {
3
+ /** The content of the table */
4
+ children: ReactNode;
5
+ }
6
+ declare const BpkTableHead: (props: BpkTableHeadProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default BpkTableHead;
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  /*
2
3
  * Backpack - Skyscanner's Design System
3
4
  *
@@ -14,12 +15,9 @@
14
15
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
16
  * See the License for the specific language governing permissions and
16
17
  * limitations under the License.
17
- */import PropTypes from 'prop-types';
18
- import { jsx as _jsx } from "react/jsx-runtime";
18
+ */
19
+
19
20
  const BpkTableHead = props => /*#__PURE__*/_jsx("thead", {
20
21
  ...props
21
22
  });
22
- BpkTableHead.propTypes = {
23
- children: PropTypes.node.isRequired
24
- };
25
23
  export default BpkTableHead;
@@ -0,0 +1,9 @@
1
+ import type { ReactNode, HTMLAttributes } from 'react';
2
+ export interface BpkTableHeadCellProps extends Omit<HTMLAttributes<HTMLTableCellElement>, 'className'> {
3
+ /** The content of the table */
4
+ children: ReactNode;
5
+ className?: string | null;
6
+ wordBreak?: boolean;
7
+ }
8
+ declare const BpkTableHeadCell: ({ children, className, wordBreak, ...rest }: BpkTableHeadCellProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default BpkTableHeadCell;
@@ -14,7 +14,8 @@
14
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
- */import PropTypes from 'prop-types';
17
+ */
18
+
18
19
  import { cssModules } from "../../bpk-react-utils";
19
20
  import STYLES from "./BpkTable.module.css";
20
21
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -33,9 +34,4 @@ const BpkTableHeadCell = ({
33
34
  children: children
34
35
  });
35
36
  };
36
- BpkTableHeadCell.propTypes = {
37
- children: PropTypes.node.isRequired,
38
- className: PropTypes.string,
39
- wordBreak: PropTypes.bool
40
- };
41
37
  export default BpkTableHeadCell;
@@ -0,0 +1,7 @@
1
+ import type { ReactNode, HTMLAttributes } from 'react';
2
+ export interface BpkTableRowProps extends HTMLAttributes<HTMLTableRowElement> {
3
+ /** The content of the table */
4
+ children: ReactNode;
5
+ }
6
+ declare const BpkTableRow: (props: BpkTableRowProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default BpkTableRow;
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  /*
2
3
  * Backpack - Skyscanner's Design System
3
4
  *
@@ -14,12 +15,9 @@
14
15
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
16
  * See the License for the specific language governing permissions and
16
17
  * limitations under the License.
17
- */import PropTypes from 'prop-types';
18
- import { jsx as _jsx } from "react/jsx-runtime";
18
+ */
19
+
19
20
  const BpkTableRow = props => /*#__PURE__*/_jsx("tr", {
20
21
  ...props
21
22
  });
22
- BpkTableRow.propTypes = {
23
- children: PropTypes.node.isRequired
24
- };
25
23
  export default BpkTableRow;
@@ -26,6 +26,112 @@
26
26
  /// @group buttons
27
27
  ////
28
28
 
29
+ // --- Private: pressed/hover colour declarations ---
30
+ // These mixins centralise pressed/hover token references.
31
+ // hover and loading can include the same mixin — token values
32
+ // are defined exactly once.
33
+
34
+ @mixin _bpk-button-primary-hover {
35
+ @include utils.bpk-themeable-property(
36
+ background-color,
37
+ --bpk-button-primary-hover-background-color,
38
+ tokens.$bpk-private-button-primary-pressed-background-day
39
+ );
40
+ @include utils.bpk-themeable-property(
41
+ color,
42
+ --bpk-button-primary-hover-text-color,
43
+ tokens.$bpk-text-on-dark-day
44
+ );
45
+ }
46
+
47
+ @mixin _bpk-button-primary-on-dark-hover {
48
+ @include utils.bpk-themeable-property(
49
+ background-color,
50
+ --bpk-button-primary-on-dark-hover-background-color,
51
+ tokens.$bpk-private-button-primary-on-dark-pressed-background-day
52
+ );
53
+ @include utils.bpk-themeable-property(
54
+ color,
55
+ --bpk-button-primary-on-dark-hover-text-color,
56
+ tokens.$bpk-text-on-light-day
57
+ );
58
+ }
59
+
60
+ @mixin _bpk-button-primary-on-light-hover {
61
+ @include utils.bpk-themeable-property(
62
+ background-color,
63
+ --bpk-button-primary-on-light-hover-background-color,
64
+ tokens.$bpk-private-button-primary-on-light-pressed-background-day
65
+ );
66
+ @include utils.bpk-themeable-property(
67
+ color,
68
+ --bpk-button-primary-on-light-hover-text-color,
69
+ tokens.$bpk-text-on-dark-night
70
+ );
71
+ }
72
+
73
+ @mixin _bpk-button-secondary-hover {
74
+ @include utils.bpk-themeable-property(
75
+ background-color,
76
+ --bpk-button-secondary-hover-background-color,
77
+ tokens.$bpk-private-button-secondary-pressed-background-day
78
+ );
79
+ @include utils.bpk-themeable-property(
80
+ color,
81
+ --bpk-button-secondary-hover-text-color,
82
+ tokens.$bpk-text-primary-day
83
+ );
84
+ }
85
+
86
+ @mixin _bpk-button-secondary-on-dark-hover {
87
+ @include utils.bpk-themeable-property(
88
+ background-color,
89
+ --bpk-button-secondary-on-dark-hover-background-color,
90
+ tokens.$bpk-private-button-secondary-on-dark-pressed-background-day
91
+ );
92
+ @include utils.bpk-themeable-property(
93
+ color,
94
+ --bpk-button-secondary-on-dark-hover-text-color,
95
+ tokens.$bpk-text-on-dark-day
96
+ );
97
+ }
98
+
99
+ @mixin _bpk-button-destructive-hover {
100
+ @include utils.bpk-themeable-property(
101
+ background-color,
102
+ --bpk-button-destructive-hover-background-color,
103
+ tokens.$bpk-private-button-destructive-pressed-background-day
104
+ );
105
+ @include utils.bpk-themeable-property(
106
+ color,
107
+ --bpk-button-destructive-hover-text-color,
108
+ tokens.$bpk-text-primary-inverse-day
109
+ );
110
+ }
111
+
112
+ @mixin _bpk-button-featured-hover {
113
+ @include utils.bpk-themeable-property(
114
+ background-color,
115
+ --bpk-button-featured-hover-background-color,
116
+ tokens.$bpk-private-button-featured-pressed-background-day
117
+ );
118
+ @include utils.bpk-themeable-property(
119
+ color,
120
+ --bpk-button-featured-hover-text-color,
121
+ tokens.$bpk-text-primary-inverse-day
122
+ );
123
+ }
124
+
125
+ @mixin _bpk-button-link-on-dark-hover {
126
+ @include utils.bpk-themeable-property(
127
+ color,
128
+ --bpk-button-link-on-dark-hover-text-color,
129
+ tokens.$bpk-private-button-link-on-dark-pressed-foreground-day
130
+ );
131
+ }
132
+
133
+ // --- End private mixins ---
134
+
29
135
  /// Standard button.
30
136
  ///
31
137
  /// @example scss
@@ -63,16 +169,7 @@
63
169
  );
64
170
 
65
171
  @include utils.bpk-hover {
66
- @include utils.bpk-themeable-property(
67
- color,
68
- --bpk-button-primary-hover-text-color,
69
- tokens.$bpk-text-on-dark-day
70
- );
71
- @include utils.bpk-themeable-property(
72
- background-color,
73
- --bpk-button-primary-hover-background-color,
74
- tokens.$bpk-private-button-primary-pressed-background-day
75
- );
172
+ @include _bpk-button-primary-hover;
76
173
  }
77
174
 
78
175
  &:active {
@@ -93,6 +190,11 @@
93
190
  color: tokens.$bpk-text-disabled-day;
94
191
  cursor: not-allowed;
95
192
  }
193
+
194
+ // Loading state override: restore hover/pressed appearance while disabled.
195
+ &.bpk-button--loading:disabled {
196
+ @include _bpk-button-primary-hover;
197
+ }
96
198
  }
97
199
 
98
200
  /// Large button. Modifies the bpk-button mixin.
@@ -133,16 +235,7 @@
133
235
  );
134
236
 
135
237
  @include utils.bpk-hover {
136
- @include utils.bpk-themeable-property(
137
- color,
138
- --bpk-button-primary-on-dark-hover-text-color,
139
- tokens.$bpk-text-on-light-day
140
- );
141
- @include utils.bpk-themeable-property(
142
- background-color,
143
- --bpk-button-primary-on-dark-hover-background-color,
144
- tokens.$bpk-private-button-primary-on-dark-pressed-background-day
145
- );
238
+ @include _bpk-button-primary-on-dark-hover;
146
239
  }
147
240
 
148
241
  &:active {
@@ -162,6 +255,11 @@
162
255
  background-color: tokens.$bpk-private-button-primary-on-dark-disabled-background-day;
163
256
  color: tokens.$bpk-private-button-primary-on-dark-disabled-foreground-day;
164
257
  }
258
+
259
+ // Loading state override: restore hover/pressed appearance while disabled.
260
+ &.bpk-button--loading:disabled {
261
+ @include _bpk-button-primary-on-dark-hover;
262
+ }
165
263
  }
166
264
 
167
265
  /// PrimaryOnLight button. Modifies the bpk-button mixin.
@@ -187,16 +285,7 @@
187
285
  );
188
286
 
189
287
  @include utils.bpk-hover {
190
- @include utils.bpk-themeable-property(
191
- color,
192
- --bpk-button-primary-on-light-hover-text-color,
193
- tokens.$bpk-text-on-dark-night
194
- );
195
- @include utils.bpk-themeable-property(
196
- background-color,
197
- --bpk-button-primary-on-light-hover-background-color,
198
- tokens.$bpk-private-button-primary-on-light-pressed-background-day
199
- );
288
+ @include _bpk-button-primary-on-light-hover;
200
289
  }
201
290
 
202
291
  &:active {
@@ -216,6 +305,11 @@
216
305
  background-color: tokens.$bpk-private-button-primary-on-light-disabled-background-day;
217
306
  color: tokens.$bpk-private-button-primary-on-light-disabled-foreground-day;
218
307
  }
308
+
309
+ // Loading state override: restore hover/pressed appearance while disabled.
310
+ &.bpk-button--loading:disabled {
311
+ @include _bpk-button-primary-on-light-hover;
312
+ }
219
313
  }
220
314
 
221
315
  /// Secondary button. Modifies the bpk-button mixin.
@@ -241,16 +335,7 @@
241
335
  );
242
336
 
243
337
  @include utils.bpk-hover {
244
- @include utils.bpk-themeable-property(
245
- color,
246
- --bpk-button-secondary-hover-text-color,
247
- tokens.$bpk-text-primary-day
248
- );
249
- @include utils.bpk-themeable-property(
250
- background-color,
251
- --bpk-button-secondary-hover-background-color,
252
- tokens.$bpk-private-button-secondary-pressed-background-day
253
- );
338
+ @include _bpk-button-secondary-hover;
254
339
  }
255
340
 
256
341
  &:active {
@@ -270,6 +355,11 @@
270
355
  background-color: tokens.$bpk-private-button-disabled-background-day;
271
356
  color: tokens.$bpk-text-disabled-day;
272
357
  }
358
+
359
+ // Loading state override: restore hover/pressed appearance while disabled.
360
+ &.bpk-button--loading:disabled {
361
+ @include _bpk-button-secondary-hover;
362
+ }
273
363
  }
274
364
 
275
365
  /// Secondary on dark button. Modifies the bpk-button mixin.
@@ -295,16 +385,7 @@
295
385
  );
296
386
 
297
387
  @include utils.bpk-hover {
298
- @include utils.bpk-themeable-property(
299
- color,
300
- --bpk-button-secondary-on-dark-hover-text-color,
301
- tokens.$bpk-text-on-dark-day
302
- );
303
- @include utils.bpk-themeable-property(
304
- background-color,
305
- --bpk-button-secondary-on-dark-hover-background-color,
306
- tokens.$bpk-private-button-secondary-on-dark-pressed-background-day
307
- );
388
+ @include _bpk-button-secondary-on-dark-hover;
308
389
  }
309
390
 
310
391
  &:active {
@@ -324,6 +405,11 @@
324
405
  background-color: tokens.$bpk-private-button-secondary-on-dark-disabled-background-day;
325
406
  color: tokens.$bpk-private-button-secondary-on-dark-disabled-foreground-day;
326
407
  }
408
+
409
+ // Loading state override: restore hover/pressed appearance while disabled.
410
+ &.bpk-button--loading:disabled {
411
+ @include _bpk-button-secondary-on-dark-hover;
412
+ }
327
413
  }
328
414
 
329
415
  /// Destructive button. Modifies the bpk-button & bpk-button--secondary lib.
@@ -351,16 +437,7 @@
351
437
  );
352
438
 
353
439
  @include utils.bpk-hover {
354
- @include utils.bpk-themeable-property(
355
- color,
356
- --bpk-button-destructive-hover-text-color,
357
- tokens.$bpk-text-primary-inverse-day
358
- );
359
- @include utils.bpk-themeable-property(
360
- background-color,
361
- --bpk-button-destructive-hover-background-color,
362
- tokens.$bpk-private-button-destructive-pressed-background-day
363
- );
440
+ @include _bpk-button-destructive-hover;
364
441
  }
365
442
 
366
443
  &:active {
@@ -380,6 +457,11 @@
380
457
  background-color: tokens.$bpk-private-button-disabled-background-day;
381
458
  color: tokens.$bpk-text-disabled-day;
382
459
  }
460
+
461
+ // Loading state override: restore hover/pressed appearance while disabled.
462
+ &.bpk-button--loading:disabled {
463
+ @include _bpk-button-destructive-hover;
464
+ }
383
465
  }
384
466
 
385
467
  /// Link-style button. Modifies the bpk-button mixin.
@@ -429,6 +511,18 @@
429
511
  text-decoration: none;
430
512
  }
431
513
 
514
+ // Loading state override: restore pressed appearance while disabled.
515
+ &.bpk-button--loading:disabled,
516
+ &.bpk-button--loading:disabled:active {
517
+ background: none;
518
+
519
+ @include utils.bpk-themeable-property(
520
+ color,
521
+ --bpk-button-link-loading-color,
522
+ tokens.$bpk-text-primary-day
523
+ );
524
+ }
525
+
432
526
  &-large {
433
527
  padding: $vertical-padding-large 0;
434
528
  }
@@ -437,7 +531,7 @@
437
531
  /// Link on dark button. Modifies the bpk-button & bpk-button--link lib.
438
532
  ///
439
533
  /// @require {mixin} bpk-button
440
-
534
+ ///
441
535
  /// @example scss
442
536
  /// .selector {
443
537
  /// @include bpk-button();
@@ -453,11 +547,7 @@
453
547
  );
454
548
 
455
549
  @include utils.bpk-hover {
456
- @include utils.bpk-themeable-property(
457
- color,
458
- --bpk-button-link-on-dark-hover-text-color,
459
- tokens.$bpk-private-button-link-on-dark-pressed-foreground-day
460
- );
550
+ @include _bpk-button-link-on-dark-hover;
461
551
  }
462
552
 
463
553
  &:active {
@@ -484,6 +574,12 @@
484
574
  tokens.$bpk-private-button-link-on-dark-disabled-foreground-day
485
575
  );
486
576
  }
577
+
578
+ // Loading state override: restore pressed/hover appearance while disabled.
579
+ &.bpk-button--loading:disabled,
580
+ &.bpk-button--loading:disabled:active {
581
+ @include _bpk-button-link-on-dark-hover;
582
+ }
487
583
  }
488
584
 
489
585
  /// Button link icon only aligned. Modifies the bpk-button mixin.
@@ -584,16 +680,7 @@
584
680
  );
585
681
 
586
682
  @include utils.bpk-hover {
587
- @include utils.bpk-themeable-property(
588
- color,
589
- --bpk-button-featured-hover-text-color,
590
- tokens.$bpk-text-primary-inverse-day
591
- );
592
- @include utils.bpk-themeable-property(
593
- background-color,
594
- --bpk-button-featured-hover-background-color,
595
- tokens.$bpk-private-button-featured-pressed-background-day
596
- );
683
+ @include _bpk-button-featured-hover;
597
684
  }
598
685
 
599
686
  &:active {
@@ -613,6 +700,11 @@
613
700
  background-color: tokens.$bpk-private-button-disabled-background-day;
614
701
  color: tokens.$bpk-text-disabled-day;
615
702
  }
703
+
704
+ // Loading state override: restore hover/pressed appearance while disabled.
705
+ &.bpk-button--loading:disabled {
706
+ @include _bpk-button-featured-hover;
707
+ }
616
708
  }
617
709
 
618
710
  /// Full width button. Modifies the bpk-button to horizontally fill its container