@skyscanner/backpack-web 30.2.0 → 30.3.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.
@@ -18,7 +18,7 @@
18
18
 
19
19
  import component, { BADGE_TYPES, type Props } from './src/BpkBadge';
20
20
  import themeAttributes from './src/themeAttributes';
21
-
21
+ import BpkBadgeV2 from './src/BpkBadgeV2/BpkBadge';
22
22
  export type BpkBadgeProps = Props;
23
23
  export default component;
24
- export { BADGE_TYPES, themeAttributes };
24
+ export { BADGE_TYPES, themeAttributes, BpkBadgeV2 };
@@ -18,5 +18,7 @@
18
18
 
19
19
  import component, { BADGE_TYPES } from "./src/BpkBadge";
20
20
  import themeAttributes from "./src/themeAttributes";
21
+ import BpkBadgeV2 from "./src/BpkBadgeV2/BpkBadge";
22
+ ;
21
23
  export default component;
22
- export { BADGE_TYPES, themeAttributes };
24
+ export { BADGE_TYPES, themeAttributes, BpkBadgeV2 };
@@ -0,0 +1,22 @@
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
+ /// <reference types="react" />
20
+ import type { Props } from '../BpkBadge';
21
+ declare const BpkBadgeV2: ({ centered, className, docked, type, ...rest }: Props) => JSX.Element;
22
+ export default BpkBadgeV2;
@@ -0,0 +1,47 @@
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 { cssModules } from "../../../bpk-react-utils";
20
+ import { BADGE_TYPES } from "../BpkBadge";
21
+ import STYLES from "./BpkBadge.module.css";
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ const getClassName = cssModules(STYLES);
24
+ const badgeTypeClassNames = {
25
+ [BADGE_TYPES.warning]: getClassName('bpk-badge--warning'),
26
+ [BADGE_TYPES.success]: getClassName('bpk-badge--success'),
27
+ [BADGE_TYPES.critical]: getClassName('bpk-badge--critical'),
28
+ [BADGE_TYPES.normal]: getClassName('bpk-badge--normal'),
29
+ [BADGE_TYPES.inverse]: getClassName('bpk-badge--inverse'),
30
+ [BADGE_TYPES.outline]: getClassName('bpk-badge--outline'),
31
+ [BADGE_TYPES.strong]: getClassName('bpk-badge--strong'),
32
+ [BADGE_TYPES.brand]: getClassName('bpk-badge--brand')
33
+ };
34
+ const BpkBadgeV2 = ({
35
+ centered = false,
36
+ className = null,
37
+ docked = null,
38
+ type = BADGE_TYPES.normal,
39
+ ...rest
40
+ }) => {
41
+ const classNames = getClassName('bpk-badge', badgeTypeClassNames[type], docked === 'right' && 'bpk-badge--docked-right', docked === 'left' && 'bpk-badge--docked-left', centered && 'bpk-badge--centered', className);
42
+ return /*#__PURE__*/_jsx("span", {
43
+ className: classNames,
44
+ ...rest
45
+ });
46
+ };
47
+ export default BpkBadgeV2;
@@ -0,0 +1,18 @@
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
+ .bpk-badge{display:inline-flex;padding:0.25rem 0.5rem;align-items:center;border-radius:.25rem;margin:0;font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-badge--centered{vertical-align:text-bottom}.bpk-badge--docked-right{position:absolute;top:0;right:0;border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:0}html[dir='rtl'] .bpk-badge--docked-right{right:inherit;left:0;border-bottom-left-radius:0;border-bottom-right-radius:.25rem}.bpk-badge--docked-left{position:absolute;top:0;left:0;border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:0}html[dir='rtl'] .bpk-badge--docked-left{right:0;left:inherit;border-bottom-left-radius:.25rem;border-bottom-right-radius:0}.bpk-badge--warning{background-color:#eff1f2;color:#161616;fill:#f55d42}.bpk-badge--success{background-color:#eff1f2;color:#161616;fill:#0c838a}.bpk-badge--critical{background-color:#eff1f2;color:#161616;fill:#e70866}.bpk-badge--normal{background-color:#eff1f2;color:#161616;fill:#161616}.bpk-badge--inverse{background-color:#fff;color:#161616;fill:#161616}.bpk-badge--outline{background-color:transparent;color:#fff;box-shadow:inset 0 0 0 1px #fff;fill:#fff}.bpk-badge--strong{background-color:#05203c;color:#fff;fill:#fff}.bpk-badge--brand{background-color:#0062e3;color:#fff;fill:#fff}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const _default: ({ styles, ...props }: {
3
+ [x: string]: any;
4
+ styles?: {} | undefined;
5
+ }) => JSX.Element;
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const _default: ({ styles, ...props }: {
3
+ [x: string]: any;
4
+ styles?: {} | undefined;
5
+ }) => JSX.Element;
6
+ export default _default;
@@ -0,0 +1,238 @@
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 '../bonds.scss';
20
+ @import 'typography.scss';
21
+ @import 'radii.scss';
22
+ @import 'utils.scss';
23
+
24
+ ////
25
+ /// @group badges
26
+ ////
27
+
28
+ /// Standard badge.
29
+ ///
30
+ /// @example scss
31
+ /// .selector {
32
+ /// @include bpk-badge();
33
+ /// }
34
+
35
+ @mixin bpk-badge {
36
+ display: inline-flex;
37
+ padding: bpk-spacing-sm() bpk-spacing-md();
38
+ align-items: center;
39
+
40
+ @include bpk-border-radius-xs;
41
+ @include bpk-text;
42
+ @include bpk-footnote;
43
+ }
44
+
45
+ /// Centered badge. Modifies the bpk-badge mixin.
46
+ ///
47
+ /// @require {mixin} bpk-badge
48
+ ///
49
+ /// @example scss
50
+ /// .selector {
51
+ /// @include bpk-badge();
52
+ /// @include bpk-badge--centered();
53
+ /// }
54
+
55
+ @mixin bpk-badge--centered {
56
+ vertical-align: text-bottom;
57
+ }
58
+
59
+ /// Right-docked badge. Modifies the bpk-badge mixin.
60
+ ///
61
+ /// @require {mixin} bpk-badge
62
+ ///
63
+ /// @example scss
64
+ /// .selector {
65
+ /// @include bpk-badge();
66
+ /// @include bpk-badge--docked-right();
67
+ /// }
68
+
69
+ @mixin bpk-badge--docked-right {
70
+ position: absolute;
71
+ top: 0;
72
+ right: 0;
73
+ border-top-left-radius: 0;
74
+ border-top-right-radius: 0;
75
+ border-bottom-right-radius: 0;
76
+
77
+ @include bpk-rtl {
78
+ right: inherit;
79
+ left: 0;
80
+ border-bottom-left-radius: 0;
81
+ border-bottom-right-radius: $bpk-border-radius-xs;
82
+ }
83
+ }
84
+
85
+ /// Left-docked badge. Modifies the bpk-badge mixin.
86
+ ///
87
+ /// @require {mixin} bpk-badge
88
+ ///
89
+ /// @example scss
90
+ /// .selector {
91
+ /// @include bpk-badge();
92
+ /// @include bpk-badge--docked-left();
93
+ /// }
94
+
95
+ @mixin bpk-badge--docked-left {
96
+ position: absolute;
97
+ top: 0;
98
+ left: 0;
99
+ border-top-left-radius: 0;
100
+ border-top-right-radius: 0;
101
+ border-bottom-left-radius: 0;
102
+
103
+ @include bpk-rtl {
104
+ right: 0;
105
+ left: inherit;
106
+ border-bottom-left-radius: $bpk-border-radius-xs;
107
+ border-bottom-right-radius: 0;
108
+ }
109
+ }
110
+
111
+ /// Normal badge. Modifies the bpk-badge mixin.
112
+ ///
113
+ /// @require {mixin} bpk-badge
114
+ ///
115
+ /// @example scss
116
+ /// .selector {
117
+ /// @include bpk-badge();
118
+ /// @include bpk-badge--normal();
119
+ /// }
120
+
121
+ @mixin bpk-badge--normal {
122
+ background-color: $bpk-private-badge-background-normal-day;
123
+ color: $bpk-text-primary-day;
124
+ fill: $bpk-text-primary-day;
125
+ }
126
+
127
+ /// Warning badge. Modifies the bpk-badge mixin.
128
+ ///
129
+ /// @require {mixin} bpk-badge
130
+ ///
131
+ /// @example scss
132
+ /// .selector {
133
+ /// @include bpk-badge();
134
+ /// @include bpk-badge--warning();
135
+ /// }
136
+
137
+ @mixin bpk-badge--warning {
138
+ background-color: $bpk-private-badge-background-normal-day;
139
+ color: $bpk-text-on-light-day;
140
+ fill: $bpk-status-warning-spot-day;
141
+ }
142
+
143
+ /// Success badge. Modifies the bpk-badge mixin.
144
+ ///
145
+ /// @require {mixin} bpk-badge
146
+ ///
147
+ /// @example scss
148
+ /// .selector {
149
+ /// @include bpk-badge();
150
+ /// @include bpk-badge--success();
151
+ /// }
152
+
153
+ @mixin bpk-badge--success {
154
+ background-color: $bpk-private-badge-background-normal-day;
155
+ color: $bpk-text-on-light-day;
156
+ fill: $bpk-status-success-spot-day;
157
+ }
158
+
159
+ /// Critical badge. Modifies the bpk-badge mixin.
160
+ ///
161
+ /// @require {mixin} bpk-badge
162
+ ///
163
+ /// @example scss
164
+ /// .selector {
165
+ /// @include bpk-badge();
166
+ /// @include bpk-badge--critical();
167
+ /// }
168
+
169
+ @mixin bpk-badge--critical {
170
+ background-color: $bpk-private-badge-background-normal-day;
171
+ color: $bpk-text-on-light-day;
172
+ fill: $bpk-status-danger-spot-day;
173
+ }
174
+
175
+ /// Inverse badge. Modifies the bpk-badge mixin.
176
+ ///
177
+ /// @require {mixin} bpk-badge
178
+ ///
179
+ /// @example scss
180
+ /// .selector {
181
+ /// @include bpk-badge();
182
+ /// @include bpk-badge--inverse();
183
+ /// }
184
+
185
+ @mixin bpk-badge--inverse {
186
+ background-color: $bpk-surface-default-day;
187
+ color: $bpk-text-primary-day;
188
+ fill: $bpk-text-primary-day;
189
+ }
190
+
191
+ /// Outline badge. Modifies the bpk-badge mixin.
192
+ ///
193
+ /// @require {mixin} bpk-badge
194
+ ///
195
+ /// @example scss
196
+ /// .selector {
197
+ /// @include bpk-badge();
198
+ /// @include bpk-badge--outline();
199
+ /// }
200
+
201
+ @mixin bpk-badge--outline {
202
+ background-color: transparent;
203
+ color: $bpk-text-on-dark-day;
204
+ box-shadow: inset 0 0 0 $bpk-border-size-sm $bpk-text-on-dark-day;
205
+ fill: $bpk-text-on-dark-day;
206
+ }
207
+
208
+ /// Strong badge. Modifies the bpk-badge mixin.
209
+ ///
210
+ /// @require {mixin} bpk-badge
211
+ ///
212
+ /// @example scss
213
+ /// .selector {
214
+ /// @include bpk-badge();
215
+ /// @include bpk-badge--strong();
216
+ /// }
217
+
218
+ @mixin bpk-badge--strong {
219
+ background-color: $bpk-core-primary-day;
220
+ color: $bpk-text-on-dark-day;
221
+ fill: $bpk-text-on-dark-day;
222
+ }
223
+
224
+ /// Brand badge. Modifies the bpk-badge mixin.
225
+ ///
226
+ /// @require {mixin} bpk-badge
227
+ ///
228
+ /// @example scss
229
+ /// .selector {
230
+ /// @include bpk-badge();
231
+ /// @include bpk-badge--brand();
232
+ /// }
233
+
234
+ @mixin bpk-badge--brand {
235
+ background-color: $bpk-core-accent-day;
236
+ color: $bpk-text-primary-inverse-day;
237
+ fill: $bpk-text-primary-inverse-day;
238
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "30.2.0",
3
+ "version": "30.3.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@popperjs/core": "^2.11.5",
26
26
  "@react-google-maps/api": "^2.12.0",
27
- "@skyscanner/bpk-foundations-web": "^17.2.0",
27
+ "@skyscanner/bpk-foundations-web": "^17.4.0",
28
28
  "@skyscanner/bpk-svgs": "^18.1.2",
29
29
  "a11y-focus-scope": "^1.1.3",
30
30
  "a11y-focus-store": "^1.0.0",