@skyscanner/backpack-web 41.17.0 → 41.19.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 (62) hide show
  1. package/bpk-component-badge/index.d.ts +2 -2
  2. package/bpk-component-badge/index.js +2 -2
  3. package/bpk-component-badge/src/BpkBadge.module.css +1 -1
  4. package/bpk-component-badge/src/themeAttributes.d.ts +25 -2
  5. package/bpk-component-badge/src/themeAttributes.js +27 -1
  6. package/bpk-component-button/index.d.ts +2 -2
  7. package/bpk-component-button/index.js +1 -1
  8. package/bpk-component-button/src/BpkButtonV2/BpkButton.d.ts +1 -1
  9. package/bpk-component-button/src/BpkButtonV2/BpkButton.js +38 -6
  10. package/bpk-component-button/src/BpkButtonV2/BpkButton.module.css +1 -1
  11. package/bpk-component-button/src/BpkButtonV2/common-types.d.ts +2 -0
  12. package/bpk-component-button/src/themeAttributes.d.ts +1 -0
  13. package/bpk-component-button/src/themeAttributes.js +3 -2
  14. package/bpk-component-chat-notification/index.d.ts +2 -0
  15. package/bpk-component-chat-notification/index.js +19 -0
  16. package/bpk-component-chat-notification/src/BpkChatNotification.d.ts +9 -0
  17. package/bpk-component-chat-notification/src/BpkChatNotification.js +43 -0
  18. package/bpk-component-chat-notification/src/BpkChatNotification.module.css +18 -0
  19. package/bpk-component-chat-thought-bubble/index.d.ts +3 -0
  20. package/bpk-component-chat-thought-bubble/index.js +20 -0
  21. package/bpk-component-chat-thought-bubble/src/BpkChatThoughtBubble.d.ts +8 -0
  22. package/bpk-component-chat-thought-bubble/src/BpkChatThoughtBubble.js +46 -0
  23. package/bpk-component-chat-thought-bubble/src/BpkChatThoughtBubble.module.css +18 -0
  24. package/bpk-component-chip/index.d.ts +2 -2
  25. package/bpk-component-chip/index.js +2 -2
  26. package/bpk-component-chip/src/BpkSelectableChip.module.css +1 -1
  27. package/bpk-component-chip/src/themeAttributes.d.ts +4 -0
  28. package/bpk-component-chip/src/themeAttributes.js +7 -1
  29. package/bpk-component-pagination/src/BpkPaginationPage.module.css +1 -1
  30. package/bpk-component-scrollable-calendar/src/utils.d.ts +1 -1
  31. package/bpk-component-segmented-control/index.d.ts +2 -0
  32. package/bpk-component-segmented-control/index.js +2 -1
  33. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.d.ts +19 -0
  34. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.js +81 -0
  35. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.module.css +18 -0
  36. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/common-types.d.ts +57 -0
  37. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/common-types.js +24 -0
  38. package/bpk-component-table/index.d.ts +13 -0
  39. package/bpk-component-table/index.js +3 -1
  40. package/bpk-component-table/src/BpkTable.d.ts +8 -0
  41. package/bpk-component-table/src/BpkTable.js +7 -14
  42. package/bpk-component-table/src/BpkTableBody.d.ts +7 -0
  43. package/bpk-component-table/src/BpkTableBody.js +3 -5
  44. package/bpk-component-table/src/BpkTableCell.d.ts +9 -0
  45. package/bpk-component-table/src/BpkTableCell.js +7 -15
  46. package/bpk-component-table/src/BpkTableHead.d.ts +7 -0
  47. package/bpk-component-table/src/BpkTableHead.js +3 -5
  48. package/bpk-component-table/src/BpkTableHeadCell.d.ts +9 -0
  49. package/bpk-component-table/src/BpkTableHeadCell.js +2 -6
  50. package/bpk-component-table/src/BpkTableRow.d.ts +7 -0
  51. package/bpk-component-table/src/BpkTableRow.js +3 -5
  52. package/bpk-component-thumb-button/index.d.ts +3 -0
  53. package/bpk-component-thumb-button/index.js +20 -0
  54. package/bpk-component-thumb-button/src/BpkThumbButton.d.ts +21 -0
  55. package/bpk-component-thumb-button/src/BpkThumbButton.js +52 -0
  56. package/bpk-component-thumb-button/src/BpkThumbButton.module.css +18 -0
  57. package/bpk-mixins/_badges.scss +147 -25
  58. package/bpk-mixins/_buttons.scss +173 -79
  59. package/bpk-mixins/_chips.scss +104 -18
  60. package/bpk-mixins/_index.scss +1 -0
  61. package/bpk-mixins/_segmented-control.scss +263 -0
  62. package/package.json +2 -1
@@ -24,15 +24,29 @@
24
24
  @use 'shadows';
25
25
  @use 'utils';
26
26
 
27
+ // Private helper: applies a box-shadow border with CSS variable fallback.
28
+ // bpk-border-sm() uses a box-shadow shorthand, so bpk-themeable-property cannot
29
+ // embed a CSS variable inside it — this mixin applies the two-line fallback pattern manually.
30
+ @mixin _bpk-chip-themeable-border($var-name, $fallback-color) {
31
+ box-shadow: 0 0 0 tokens.$bpk-border-size-sm $fallback-color inset;
32
+ box-shadow: 0 0 0 tokens.$bpk-border-size-sm
33
+ var(#{$var-name}, $fallback-color) inset;
34
+ }
35
+
27
36
  @mixin bpk-chip {
28
37
  display: inline-flex;
29
38
  height: tokens.bpk-spacing-xl();
30
39
  padding: 0 tokens.bpk-spacing-base();
31
40
  align-items: center;
32
41
  border: none;
33
- border-radius: tokens.$bpk-border-radius-xs * 2;
34
42
  cursor: pointer;
35
43
 
44
+ @include utils.bpk-themeable-property(
45
+ border-radius,
46
+ --bpk-chip-border-radius,
47
+ tokens.$bpk-border-radius-sm
48
+ );
49
+
36
50
  &__leading-accessory-view {
37
51
  display: inline-flex;
38
52
  fill: currentcolor;
@@ -49,17 +63,33 @@
49
63
  }
50
64
 
51
65
  &--on-dark {
52
- background-color: transparent;
53
- color: tokens.$bpk-text-on-dark-day;
54
-
55
- @include borders.bpk-border-sm(tokens.$bpk-line-on-dark-day);
66
+ @include utils.bpk-themeable-property(
67
+ background-color,
68
+ --bpk-chip-on-dark-background-color,
69
+ transparent
70
+ );
71
+ @include utils.bpk-themeable-property(
72
+ color,
73
+ --bpk-chip-on-dark-text-color,
74
+ tokens.$bpk-text-on-dark-day
75
+ );
76
+ @include _bpk-chip-themeable-border(
77
+ --bpk-chip-on-dark-border-color,
78
+ tokens.$bpk-line-on-dark-day
79
+ );
56
80
 
57
81
  @include utils.bpk-hover {
58
- @include borders.bpk-border-sm(tokens.$bpk-surface-default-day);
82
+ @include _bpk-chip-themeable-border(
83
+ --bpk-chip-on-dark-hover-border-color,
84
+ tokens.$bpk-surface-default-day
85
+ );
59
86
  }
60
87
 
61
88
  &:active:not(:disabled) {
62
- @include borders.bpk-border-sm(tokens.$bpk-surface-default-day);
89
+ @include _bpk-chip-themeable-border(
90
+ --bpk-chip-on-dark-active-border-color,
91
+ tokens.$bpk-surface-default-day
92
+ );
63
93
  }
64
94
 
65
95
  &-selected {
@@ -76,10 +106,20 @@
76
106
  @include borders.bpk-border-sm(transparent);
77
107
 
78
108
  @include utils.bpk-hover {
109
+ @include utils.bpk-themeable-property(
110
+ background-color,
111
+ --bpk-chip-on-dark-selected-hover-background-color,
112
+ tokens.$bpk-surface-default-day
113
+ );
79
114
  @include borders.bpk-border-sm(transparent);
80
115
  }
81
116
 
82
117
  &:active:not(:disabled) {
118
+ @include utils.bpk-themeable-property(
119
+ background-color,
120
+ --bpk-chip-on-dark-selected-active-background-color,
121
+ tokens.$bpk-surface-default-day
122
+ );
83
123
  @include borders.bpk-border-sm(transparent);
84
124
  }
85
125
  }
@@ -108,17 +148,38 @@
108
148
  }
109
149
 
110
150
  &--default {
111
- background-color: transparent;
112
- color: tokens.$bpk-text-primary-day;
113
-
114
- @include borders.bpk-border-sm(tokens.$bpk-line-day);
151
+ @include utils.bpk-themeable-property(
152
+ background-color,
153
+ --bpk-chip-default-background-color,
154
+ transparent
155
+ );
156
+ @include utils.bpk-themeable-property(
157
+ color,
158
+ --bpk-chip-default-text-color,
159
+ tokens.$bpk-text-primary-day
160
+ );
161
+ @include _bpk-chip-themeable-border(
162
+ --bpk-chip-default-border-color,
163
+ tokens.$bpk-line-day
164
+ );
115
165
 
116
166
  @include utils.bpk-hover {
117
- @include borders.bpk-border-sm(tokens.$bpk-core-primary-day);
167
+ @include utils.bpk-themeable-property(
168
+ background-color,
169
+ --bpk-chip-default-hover-background-color,
170
+ transparent
171
+ );
172
+ @include _bpk-chip-themeable-border(
173
+ --bpk-chip-default-hover-border-color,
174
+ tokens.$bpk-core-primary-day
175
+ );
118
176
  }
119
177
 
120
178
  &:active:not(:disabled) {
121
- @include borders.bpk-border-sm(tokens.$bpk-core-primary-day);
179
+ @include _bpk-chip-themeable-border(
180
+ --bpk-chip-default-active-border-color,
181
+ tokens.$bpk-core-primary-day
182
+ );
122
183
  }
123
184
 
124
185
  &-selected {
@@ -135,10 +196,20 @@
135
196
  @include borders.bpk-border-sm(transparent);
136
197
 
137
198
  @include utils.bpk-hover {
199
+ @include utils.bpk-themeable-property(
200
+ background-color,
201
+ --bpk-chip-default-selected-hover-background-color,
202
+ tokens.$bpk-core-primary-day
203
+ );
138
204
  @include borders.bpk-border-sm(transparent);
139
205
  }
140
206
 
141
207
  &:active:not(:disabled) {
208
+ @include utils.bpk-themeable-property(
209
+ background-color,
210
+ --bpk-chip-default-selected-active-background-color,
211
+ tokens.$bpk-core-primary-day
212
+ );
142
213
  @include borders.bpk-border-sm(transparent);
143
214
  }
144
215
  }
@@ -167,17 +238,32 @@
167
238
  }
168
239
 
169
240
  &--on-image {
170
- background-color: tokens.$bpk-surface-default-day;
171
- color: tokens.$bpk-text-primary-day;
172
-
241
+ @include utils.bpk-themeable-property(
242
+ background-color,
243
+ --bpk-chip-on-image-background-color,
244
+ tokens.$bpk-surface-default-day
245
+ );
246
+ @include utils.bpk-themeable-property(
247
+ color,
248
+ --bpk-chip-on-image-text-color,
249
+ tokens.$bpk-text-primary-day
250
+ );
173
251
  @include shadows.bpk-box-shadow-sm;
174
252
 
175
253
  @include utils.bpk-hover {
176
- background-color: tokens.$bpk-canvas-contrast-day;
254
+ @include utils.bpk-themeable-property(
255
+ background-color,
256
+ --bpk-chip-on-image-hover-background-color,
257
+ tokens.$bpk-canvas-contrast-day
258
+ );
177
259
  }
178
260
 
179
261
  &:active:not(:disabled) {
180
- background-color: tokens.$bpk-canvas-contrast-day;
262
+ @include utils.bpk-themeable-property(
263
+ background-color,
264
+ --bpk-chip-on-image-active-background-color,
265
+ tokens.$bpk-canvas-contrast-day
266
+ );
181
267
  }
182
268
 
183
269
  &-selected {
@@ -30,6 +30,7 @@
30
30
  @forward 'panels';
31
31
  @forward 'radii';
32
32
  @forward 'scroll-indicators';
33
+ @forward 'segmented-control';
33
34
  @forward 'shadows';
34
35
  @forward 'spinners';
35
36
  @forward 'surfaces';
@@ -0,0 +1,263 @@
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
+ /* stylelint-disable at-rule-disallowed-list */
20
+
21
+ @use 'tokens';
22
+ @use 'typography';
23
+ @use 'utils';
24
+ @use 'shadows';
25
+
26
+ ////
27
+ /// @group segmented-control-v2
28
+ ////
29
+
30
+ /// Segmented control group container.
31
+ ///
32
+ /// @example scss
33
+ /// .selector {
34
+ /// @include bpk-segmented-control-v2();
35
+ /// }
36
+
37
+ @mixin bpk-segmented-control-v2 {
38
+ position: relative;
39
+ display: grid;
40
+ grid-auto-columns: 1fr;
41
+ grid-auto-flow: column;
42
+ border-radius: tokens.$bpk-border-radius-sm;
43
+ background-color: tokens.$bpk-private-segmented-control-canvas-default-day;
44
+ overflow: hidden;
45
+ }
46
+
47
+ /// Canvas default type. Modifies the bpk-segmented-control-v2 mixin.
48
+ ///
49
+ /// @require {mixin} bpk-segmented-control-v2
50
+ ///
51
+ /// @example scss
52
+ /// .selector {
53
+ /// @include bpk-segmented-control-v2();
54
+ /// @include bpk-segmented-control-v2--canvas-default();
55
+ /// }
56
+
57
+ @mixin bpk-segmented-control-v2--canvas-default {
58
+ background-color: tokens.$bpk-private-segmented-control-canvas-default-day;
59
+ }
60
+
61
+ /// Canvas contrast type. Modifies the bpk-segmented-control-v2 mixin.
62
+ ///
63
+ /// @require {mixin} bpk-segmented-control-v2
64
+ ///
65
+ /// @example scss
66
+ /// .selector {
67
+ /// @include bpk-segmented-control-v2();
68
+ /// @include bpk-segmented-control-v2--canvas-contrast();
69
+ /// }
70
+
71
+ @mixin bpk-segmented-control-v2--canvas-contrast {
72
+ background-color: tokens.$bpk-surface-default-day;
73
+ }
74
+
75
+ /// Surface default type. Modifies the bpk-segmented-control-v2 mixin.
76
+ ///
77
+ /// @require {mixin} bpk-segmented-control-v2
78
+ ///
79
+ /// @example scss
80
+ /// .selector {
81
+ /// @include bpk-segmented-control-v2();
82
+ /// @include bpk-segmented-control-v2--surface-default();
83
+ /// }
84
+
85
+ @mixin bpk-segmented-control-v2--surface-default {
86
+ background-color: tokens.$bpk-canvas-contrast-day;
87
+ }
88
+
89
+ /// Surface contrast type. Modifies the bpk-segmented-control-v2 mixin.
90
+ ///
91
+ /// @require {mixin} bpk-segmented-control-v2
92
+ ///
93
+ /// @example scss
94
+ /// .selector {
95
+ /// @include bpk-segmented-control-v2();
96
+ /// @include bpk-segmented-control-v2--surface-contrast();
97
+ /// }
98
+
99
+ @mixin bpk-segmented-control-v2--surface-contrast {
100
+ background-color: tokens.$bpk-private-segmented-control-surface-contrast-day;
101
+ }
102
+
103
+ /// Adds a box shadow to the group container. Modifies the bpk-segmented-control-v2 mixin.
104
+ ///
105
+ /// @require {mixin} bpk-segmented-control-v2
106
+ ///
107
+ /// @example scss
108
+ /// .selector {
109
+ /// @include bpk-segmented-control-v2();
110
+ /// @include bpk-segmented-control-v2--shadow();
111
+ /// }
112
+
113
+ @mixin bpk-segmented-control-v2--shadow {
114
+ @include shadows.bpk-box-shadow-sm;
115
+ }
116
+
117
+ /// Visually hidden group label (satisfies aria-labelledby generated by Ark-UI).
118
+ ///
119
+ /// @example scss
120
+ /// .selector {
121
+ /// @include bpk-segmented-control-v2__label();
122
+ /// }
123
+
124
+ @mixin bpk-segmented-control-v2__label {
125
+ @include utils.bpk-visually-hidden;
126
+ }
127
+
128
+ /// Segmented control item (label wrapper).
129
+ /// Creates a grid cell in the root grid, and a stacking context for ItemText + ItemControl.
130
+ ///
131
+ /// @example scss
132
+ /// .selector {
133
+ /// @include bpk-segmented-control-v2__item();
134
+ /// }
135
+
136
+ @mixin bpk-segmented-control-v2__item {
137
+ display: grid;
138
+ cursor: pointer;
139
+ }
140
+
141
+ /// Segmented control item control (background layer, aria-hidden).
142
+ /// Sits behind ItemText via CSS grid stacking (grid-area: 1 / 1).
143
+ ///
144
+ /// @example scss
145
+ /// .selector {
146
+ /// @include bpk-segmented-control-v2__item-control();
147
+ /// }
148
+
149
+ @mixin bpk-segmented-control-v2__item-control {
150
+ display: none;
151
+ }
152
+
153
+ /// Segmented control item text (content layer, visible to accessibility tree).
154
+ /// Sits above ItemControl via CSS grid stacking (grid-area: 1 / 1, z-index: 1).
155
+ ///
156
+ /// @example scss
157
+ /// .selector {
158
+ /// @include bpk-segmented-control-v2__item-text();
159
+ /// }
160
+
161
+ @mixin bpk-segmented-control-v2__item-text {
162
+ display: flex;
163
+ z-index: 1;
164
+ min-height: tokens.bpk-spacing-xl();
165
+
166
+ // Content layer: stacked above item-control via shared grid-area
167
+ grid-area: 1 / 1;
168
+ justify-content: center;
169
+ align-items: center;
170
+ transition: color tokens.$bpk-duration-xs ease-in-out;
171
+ color: tokens.$bpk-text-primary-day;
172
+ overflow: hidden;
173
+ border-inline-start: tokens.$bpk-border-size-sm solid tokens.$bpk-line-day;
174
+ pointer-events: none;
175
+
176
+ @include typography.bpk-label-2;
177
+
178
+ // stylelint-disable-next-line selector-max-type
179
+ svg {
180
+ fill: currentcolor;
181
+ }
182
+
183
+ &[data-state='checked'] {
184
+ color: tokens.$bpk-text-on-dark-day;
185
+ }
186
+ }
187
+
188
+ /// Surface contrast item text colors. Modifies the bpk-segmented-control-v2__item-text mixin.
189
+ ///
190
+ /// @require {mixin} bpk-segmented-control-v2__item-text
191
+ ///
192
+ /// @example scss
193
+ /// .selector {
194
+ /// @include bpk-segmented-control-v2__item-text();
195
+ /// @include bpk-segmented-control-v2__item-text--surface-contrast();
196
+ /// }
197
+
198
+ @mixin bpk-segmented-control-v2__item-text--surface-contrast {
199
+ color: tokens.$bpk-text-on-dark-day;
200
+ border-inline-start-color: tokens.$bpk-line-on-dark-day;
201
+ }
202
+
203
+ /// Segmented control indicator (floating selection background, positioned by Ark-UI CSS variables).
204
+ /// Mirrors ItemControl visually but uses absolute positioning driven by --left/--top/--height
205
+ /// injected by Ark. --transition-duration is set to 0ms to prevent sliding animation.
206
+ ///
207
+ /// @example scss
208
+ /// .selector {
209
+ /// @include bpk-segmented-control-v2__indicator();
210
+ /// }
211
+
212
+ @mixin bpk-segmented-control-v2__indicator {
213
+ position: absolute;
214
+ top: var(--top);
215
+ left: var(--left);
216
+ width: var(--width);
217
+ height: var(--height);
218
+ background-color: tokens.$bpk-core-primary-day;
219
+
220
+ --transition-duration: 0ms;
221
+ }
222
+
223
+ /// Canvas contrast indicator color. Modifies the bpk-segmented-control-v2__indicator mixin.
224
+ ///
225
+ /// @require {mixin} bpk-segmented-control-v2__indicator
226
+ ///
227
+ /// @example scss
228
+ /// .selector {
229
+ /// @include bpk-segmented-control-v2__indicator();
230
+ /// @include bpk-segmented-control-v2__indicator--canvas-contrast();
231
+ /// }
232
+
233
+ @mixin bpk-segmented-control-v2__indicator--canvas-contrast {
234
+ background-color: tokens.$bpk-surface-default-day;
235
+ }
236
+
237
+ /// Surface default indicator color. Modifies the bpk-segmented-control-v2__indicator mixin.
238
+ ///
239
+ /// @require {mixin} bpk-segmented-control-v2__indicator
240
+ ///
241
+ /// @example scss
242
+ /// .selector {
243
+ /// @include bpk-segmented-control-v2__indicator();
244
+ /// @include bpk-segmented-control-v2__indicator--surface-default();
245
+ /// }
246
+
247
+ @mixin bpk-segmented-control-v2__indicator--surface-default {
248
+ background-color: tokens.$bpk-canvas-contrast-day;
249
+ }
250
+
251
+ /// Surface contrast indicator color. Modifies the bpk-segmented-control-v2__indicator mixin.
252
+ ///
253
+ /// @require {mixin} bpk-segmented-control-v2__indicator
254
+ ///
255
+ /// @example scss
256
+ /// .selector {
257
+ /// @include bpk-segmented-control-v2__indicator();
258
+ /// @include bpk-segmented-control-v2__indicator--surface-contrast();
259
+ /// }
260
+
261
+ @mixin bpk-segmented-control-v2__indicator--surface-contrast {
262
+ background-color: tokens.$bpk-private-segmented-control-surface-contrast-on-day;
263
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "41.17.0",
3
+ "version": "41.19.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,6 +22,7 @@
22
22
  "access": "public"
23
23
  },
24
24
  "dependencies": {
25
+ "@ark-ui/react": "^5.34.1",
25
26
  "@chakra-ui/react": "^3.33.0",
26
27
  "@floating-ui/react": "^0.26.12",
27
28
  "@popperjs/core": "^2.11.8",