@atlaskit/button 16.0.0 → 16.1.3

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.
@@ -1,4 +1,5 @@
1
1
  import * as colors from '@atlaskit/theme/colors';
2
+ import { token } from '@atlaskit/tokens';
2
3
  // Hard coding the active rgba color value rather than using a helper to convert it
3
4
  // With helper it would be: hex2rgba(colors.B75, 0.6)
4
5
  const fadedB75 = 'rgba(179, 212, 255, 0.6)';
@@ -7,106 +8,106 @@ const values = {
7
8
  background: {
8
9
  default: {
9
10
  default: {
10
- light: colors.N20A,
11
- dark: colors.DN70
11
+ light: token('color.background.subtleNeutral.resting', colors.N20A),
12
+ dark: token('color.background.subtleNeutral.resting', colors.DN70)
12
13
  },
13
14
  hover: {
14
- light: colors.N30A,
15
- dark: colors.DN60
15
+ light: token('color.background.subtleNeutral.hover', colors.N30A),
16
+ dark: token('color.background.subtleNeutral.hover', colors.DN60)
16
17
  },
17
18
  active: {
18
- light: fadedB75,
19
- dark: colors.B75
19
+ light: token('color.background.subtleNeutral.pressed', fadedB75),
20
+ dark: token('color.background.subtleNeutral.pressed', colors.B75)
20
21
  },
21
22
  disabled: {
22
- light: colors.N20A,
23
- dark: colors.DN70
23
+ light: token('color.background.disabled', colors.N20A),
24
+ dark: token('color.background.disabled', colors.DN70)
24
25
  },
25
26
  selected: {
26
- light: colors.N700,
27
- dark: colors.DN0
27
+ light: token('color.background.selected.resting', colors.N700),
28
+ dark: token('color.background.selected.resting', colors.DN0)
28
29
  },
29
30
  focusSelected: {
30
- light: colors.N700,
31
- dark: colors.DN0
31
+ light: token('color.background.selected.resting', colors.N700),
32
+ dark: token('color.background.selected.resting', colors.DN0)
32
33
  }
33
34
  },
34
35
  primary: {
35
36
  default: {
36
- light: colors.B400,
37
- dark: colors.B100
37
+ light: token('color.background.boldBrand.resting', colors.B400),
38
+ dark: token('color.background.boldBrand.resting', colors.B100)
38
39
  },
39
40
  hover: {
40
- light: colors.B300,
41
- dark: colors.B75
41
+ light: token('color.background.boldBrand.hover', colors.B300),
42
+ dark: token('color.background.boldBrand.hover', colors.B75)
42
43
  },
43
44
  active: {
44
- light: colors.B500,
45
- dark: colors.B200
45
+ light: token('color.background.boldBrand.pressed', colors.B500),
46
+ dark: token('color.background.boldBrand.pressed', colors.B200)
46
47
  },
47
48
  disabled: {
48
- light: colors.N20A,
49
- dark: colors.DN70
49
+ light: token('color.background.disabled', colors.N20A),
50
+ dark: token('color.background.disabled', colors.DN70)
50
51
  },
51
52
  selected: {
52
- light: colors.N700,
53
- dark: colors.DN0
53
+ light: token('color.background.selected.resting', colors.N700),
54
+ dark: token('color.background.selected.resting', colors.DN0)
54
55
  },
55
56
  focusSelected: {
56
- light: colors.N700,
57
- dark: colors.DN0
57
+ light: token('color.background.selected.resting', colors.N700),
58
+ dark: token('color.background.selected.resting', colors.DN0)
58
59
  }
59
60
  },
60
61
  warning: {
61
62
  default: {
62
- light: colors.Y300,
63
- dark: colors.Y300
63
+ light: token('color.background.boldWarning.resting', colors.Y300),
64
+ dark: token('color.background.boldWarning.resting', colors.Y300)
64
65
  },
65
66
  hover: {
66
- light: colors.Y200,
67
- dark: colors.Y200
67
+ light: token('color.background.boldWarning.hover', colors.Y200),
68
+ dark: token('color.background.boldWarning.hover', colors.Y200)
68
69
  },
69
70
  active: {
70
- light: colors.Y400,
71
- dark: colors.Y400
71
+ light: token('color.background.boldWarning.pressed', colors.Y400),
72
+ dark: token('color.background.boldWarning.pressed', colors.Y400)
72
73
  },
73
74
  disabled: {
74
- light: colors.N20A,
75
- dark: colors.DN70
75
+ light: token('color.background.disabled', colors.N20A),
76
+ dark: token('color.background.disabled', colors.DN70)
76
77
  },
77
78
  selected: {
78
- light: colors.Y400,
79
- dark: colors.Y400
79
+ light: token('color.background.selected.resting', colors.Y400),
80
+ dark: token('color.background.selected.resting', colors.Y400)
80
81
  },
81
82
  focusSelected: {
82
- light: colors.Y400,
83
- dark: colors.Y400
83
+ light: token('color.background.selected.resting', colors.Y400),
84
+ dark: token('color.background.selected.resting', colors.Y400)
84
85
  }
85
86
  },
86
87
  danger: {
87
88
  default: {
88
- light: colors.R400,
89
- dark: colors.R400
89
+ light: token('color.background.boldDanger.resting', colors.R400),
90
+ dark: token('color.background.boldDanger.resting', colors.R400)
90
91
  },
91
92
  hover: {
92
- light: colors.R300,
93
- dark: colors.R300
93
+ light: token('color.background.boldDanger.hover', colors.R300),
94
+ dark: token('color.background.boldDanger.hover', colors.R300)
94
95
  },
95
96
  active: {
96
- light: colors.R500,
97
- dark: colors.R500
97
+ light: token('color.background.boldDanger.pressed', colors.R500),
98
+ dark: token('color.background.boldDanger.pressed', colors.R500)
98
99
  },
99
100
  disabled: {
100
- light: colors.N20A,
101
- dark: colors.DN70
101
+ light: token('color.background.disabled', colors.N20A),
102
+ dark: token('color.background.disabled', colors.DN70)
102
103
  },
103
104
  selected: {
104
- light: colors.R500,
105
- dark: colors.R500
105
+ light: token('color.background.selected.resting', colors.R500),
106
+ dark: token('color.background.selected.resting', colors.R500)
106
107
  },
107
108
  focusSelected: {
108
- light: colors.R500,
109
- dark: colors.R500
109
+ light: token('color.background.selected.resting', colors.R500),
110
+ dark: token('color.background.selected.resting', colors.R500)
110
111
  }
111
112
  },
112
113
  link: {
@@ -115,12 +116,12 @@ const values = {
115
116
  dark: 'none'
116
117
  },
117
118
  selected: {
118
- light: colors.N700,
119
- dark: colors.N20
119
+ light: token('color.background.selected.resting', colors.N700),
120
+ dark: token('color.background.selected.resting', colors.N20)
120
121
  },
121
122
  focusSelected: {
122
- light: colors.N700,
123
- dark: colors.N20
123
+ light: token('color.background.selected.resting', colors.N700),
124
+ dark: token('color.background.selected.resting', colors.N20)
124
125
  }
125
126
  },
126
127
  subtle: {
@@ -129,24 +130,24 @@ const values = {
129
130
  dark: 'none'
130
131
  },
131
132
  hover: {
132
- light: colors.N30A,
133
- dark: colors.DN60
133
+ light: token('color.background.transparentNeutral.hover', colors.N30A),
134
+ dark: token('color.background.transparentNeutral.hover', colors.DN60)
134
135
  },
135
136
  active: {
136
- light: fadedB75,
137
- dark: colors.B75
137
+ light: token('color.background.transparentNeutral.pressed', fadedB75),
138
+ dark: token('color.background.transparentNeutral.pressed', colors.B75)
138
139
  },
139
140
  disabled: {
140
141
  light: 'none',
141
142
  dark: 'none'
142
143
  },
143
144
  selected: {
144
- light: colors.N700,
145
- dark: colors.DN0
145
+ light: token('color.background.selected.resting', colors.N700),
146
+ dark: token('color.background.selected.resting', colors.DN0)
146
147
  },
147
148
  focusSelected: {
148
- light: colors.N700,
149
- dark: colors.DN0
149
+ light: token('color.background.selected.resting', colors.N700),
150
+ dark: token('color.background.selected.resting', colors.DN0)
150
151
  }
151
152
  },
152
153
  'subtle-link': {
@@ -155,236 +156,236 @@ const values = {
155
156
  dark: 'none'
156
157
  },
157
158
  selected: {
158
- light: colors.N700,
159
- dark: colors.N20
159
+ light: token('color.background.selected.resting', colors.N700),
160
+ dark: token('color.background.selected.resting', colors.N20)
160
161
  },
161
162
  focusSelected: {
162
- light: colors.N700,
163
- dark: colors.N20
163
+ light: token('color.background.selected.resting', colors.N700),
164
+ dark: token('color.background.selected.resting', colors.N20)
164
165
  }
165
166
  }
166
167
  },
167
168
  boxShadowColor: {
168
169
  default: {
169
170
  focus: {
170
- light: colors.B100,
171
- dark: colors.B75
171
+ light: token('color.border.focus', colors.B100),
172
+ dark: token('color.border.focus', colors.B75)
172
173
  },
173
174
  focusSelected: {
174
- light: colors.B100,
175
- dark: colors.B75
175
+ light: token('color.border.focus', colors.B100),
176
+ dark: token('color.border.focus', colors.B75)
176
177
  }
177
178
  },
178
179
  primary: {
179
180
  focus: {
180
- light: colors.B100,
181
- dark: colors.B75
181
+ light: token('color.border.focus', colors.B100),
182
+ dark: token('color.border.focus', colors.B75)
182
183
  },
183
184
  focusSelected: {
184
- light: colors.B100,
185
- dark: colors.B75
185
+ light: token('color.border.focus', colors.B100),
186
+ dark: token('color.border.focus', colors.B75)
186
187
  }
187
188
  },
188
189
  warning: {
189
190
  focus: {
190
- light: colors.Y500,
191
- dark: colors.Y500
191
+ light: token('color.border.focus', colors.Y500),
192
+ dark: token('color.border.focus', colors.Y500)
192
193
  },
193
194
  focusSelected: {
194
- light: colors.Y500,
195
- dark: colors.Y500
195
+ light: token('color.border.focus', colors.Y500),
196
+ dark: token('color.border.focus', colors.Y500)
196
197
  }
197
198
  },
198
199
  danger: {
199
200
  focus: {
200
- light: colors.R100,
201
- dark: colors.R100
201
+ light: token('color.border.focus', colors.R100),
202
+ dark: token('color.border.focus', colors.R100)
202
203
  },
203
204
  focusSelected: {
204
- light: colors.R100,
205
- dark: colors.R100
205
+ light: token('color.border.focus', colors.R100),
206
+ dark: token('color.border.focus', colors.R100)
206
207
  }
207
208
  },
208
209
  link: {
209
210
  focus: {
210
- light: colors.B100,
211
- dark: colors.B75
211
+ light: token('color.border.focus', colors.B100),
212
+ dark: token('color.border.focus', colors.B75)
212
213
  },
213
214
  focusSelected: {
214
- light: colors.B100,
215
- dark: colors.B75
215
+ light: token('color.border.focus', colors.B100),
216
+ dark: token('color.border.focus', colors.B75)
216
217
  }
217
218
  },
218
219
  subtle: {
219
220
  focus: {
220
- light: colors.B100,
221
- dark: colors.B75
221
+ light: token('color.border.focus', colors.B100),
222
+ dark: token('color.border.focus', colors.B75)
222
223
  },
223
224
  focusSelected: {
224
- light: colors.B100,
225
- dark: colors.B75
225
+ light: token('color.border.focus', colors.B100),
226
+ dark: token('color.border.focus', colors.B75)
226
227
  }
227
228
  },
228
229
  'subtle-link': {
229
230
  focus: {
230
- light: colors.B100,
231
- dark: colors.B75
231
+ light: token('color.border.focus', colors.B100),
232
+ dark: token('color.border.focus', colors.B75)
232
233
  },
233
234
  focusSelected: {
234
- light: colors.B100,
235
- dark: colors.B75
235
+ light: token('color.border.focus', colors.B100),
236
+ dark: token('color.border.focus', colors.B75)
236
237
  }
237
238
  }
238
239
  },
239
240
  color: {
240
241
  default: {
241
242
  default: {
242
- light: colors.N500,
243
- dark: colors.DN400
243
+ light: token('color.text.highEmphasis', colors.N500),
244
+ dark: token('color.text.highEmphasis', colors.DN400)
244
245
  },
245
246
  active: {
246
- light: colors.B400,
247
- dark: colors.B400
247
+ light: token('color.text.highEmphasis', colors.B400),
248
+ dark: token('color.text.highEmphasis', colors.B400)
248
249
  },
249
250
  disabled: {
250
- light: colors.N70,
251
- dark: colors.DN30
251
+ light: token('color.text.disabled', colors.N70),
252
+ dark: token('color.text.disabled', colors.DN30)
252
253
  },
253
254
  selected: {
254
- light: colors.N20,
255
- dark: colors.DN400
255
+ light: token('color.text.selected', colors.N20),
256
+ dark: token('color.text.selected', colors.DN400)
256
257
  },
257
258
  focusSelected: {
258
- light: colors.N20,
259
- dark: colors.DN400
259
+ light: token('color.text.selected', colors.N20),
260
+ dark: token('color.text.selected', colors.DN400)
260
261
  }
261
262
  },
262
263
  primary: {
263
264
  default: {
264
- light: colors.N0,
265
- dark: colors.DN30
265
+ light: token('color.text.onBold', colors.N0),
266
+ dark: token('color.text.onBold', colors.DN30)
266
267
  },
267
268
  disabled: {
268
- light: colors.N70,
269
- dark: colors.DN30
269
+ light: token('color.text.disabled', colors.N70),
270
+ dark: token('color.text.disabled', colors.DN30)
270
271
  },
271
272
  selected: {
272
- light: colors.N20,
273
- dark: colors.DN400
273
+ light: token('color.text.selected', colors.N20),
274
+ dark: token('color.text.selected', colors.DN400)
274
275
  },
275
276
  focusSelected: {
276
- light: colors.N20,
277
- dark: colors.DN400
277
+ light: token('color.text.selected', colors.N20),
278
+ dark: token('color.text.selected', colors.DN400)
278
279
  }
279
280
  },
280
281
  warning: {
281
282
  default: {
282
- light: colors.N800,
283
- dark: colors.N800
283
+ light: token('color.text.onBoldWarning', colors.N800),
284
+ dark: token('color.text.onBoldWarning', colors.N800)
284
285
  },
285
286
  disabled: {
286
- light: colors.N70,
287
- dark: colors.DN30
287
+ light: token('color.text.disabled', colors.N70),
288
+ dark: token('color.text.disabled', colors.DN30)
288
289
  },
289
290
  selected: {
290
- light: colors.N800,
291
- dark: colors.N800
291
+ light: token('color.text.selected', colors.N800),
292
+ dark: token('color.text.selected', colors.N800)
292
293
  },
293
294
  focusSelected: {
294
- light: colors.N800,
295
- dark: colors.N800
295
+ light: token('color.text.selected', colors.N800),
296
+ dark: token('color.text.selected', colors.N800)
296
297
  }
297
298
  },
298
299
  danger: {
299
300
  default: {
300
- light: colors.N0,
301
- dark: colors.N0
301
+ light: token('color.text.onBold', colors.N0),
302
+ dark: token('color.text.onBold', colors.N0)
302
303
  },
303
304
  disabled: {
304
- light: colors.N70,
305
- dark: colors.DN30
305
+ light: token('color.text.disabled', colors.N70),
306
+ dark: token('color.text.disabled', colors.DN30)
306
307
  },
307
308
  selected: {
308
- light: colors.N0,
309
- dark: colors.N0
309
+ light: token('color.text.selected', colors.N0),
310
+ dark: token('color.text.selected', colors.N0)
310
311
  },
311
312
  focusSelected: {
312
- light: colors.N0,
313
- dark: colors.N0
313
+ light: token('color.text.selected', colors.N0),
314
+ dark: token('color.text.selected', colors.N0)
314
315
  }
315
316
  },
316
317
  link: {
317
318
  default: {
318
- light: colors.B400,
319
- dark: colors.B100
319
+ light: token('color.text.link.resting', colors.B400),
320
+ dark: token('color.text.link.resting', colors.B100)
320
321
  },
321
322
  hover: {
322
- light: colors.B300,
323
- dark: colors.B75
323
+ light: token('color.text.link.resting', colors.B300),
324
+ dark: token('color.text.link.resting', colors.B75)
324
325
  },
325
326
  active: {
326
- light: colors.B500,
327
- dark: colors.B200
327
+ light: token('color.text.link.pressed', colors.B500),
328
+ dark: token('color.text.link.pressed', colors.B200)
328
329
  },
329
330
  disabled: {
330
- light: colors.N70,
331
- dark: colors.DN100
331
+ light: token('color.text.disabled', colors.N70),
332
+ dark: token('color.text.disabled', colors.DN100)
332
333
  },
333
334
  selected: {
334
- light: colors.N20,
335
- dark: colors.N700
335
+ light: token('color.text.selected', colors.N20),
336
+ dark: token('color.text.selected', colors.N700)
336
337
  },
337
338
  focusSelected: {
338
- light: colors.N20,
339
- dark: colors.N700
339
+ light: token('color.text.selected', colors.N20),
340
+ dark: token('color.text.selected', colors.N700)
340
341
  }
341
342
  },
342
343
  subtle: {
343
344
  default: {
344
- light: colors.N500,
345
- dark: colors.DN400
345
+ light: token('color.text.highEmphasis', colors.N500),
346
+ dark: token('color.text.highEmphasis', colors.DN400)
346
347
  },
347
348
  active: {
348
- light: colors.B400,
349
- dark: colors.B400
349
+ light: token('color.text.highEmphasis', colors.B400),
350
+ dark: token('color.text.highEmphasis', colors.B400)
350
351
  },
351
352
  disabled: {
352
- light: colors.N70,
353
- dark: colors.DN100
353
+ light: token('color.text.disabled', colors.N70),
354
+ dark: token('color.text.disabled', colors.DN100)
354
355
  },
355
356
  selected: {
356
- light: colors.N20,
357
- dark: colors.DN400
357
+ light: token('color.text.selected', colors.N20),
358
+ dark: token('color.text.selected', colors.DN400)
358
359
  },
359
360
  focusSelected: {
360
- light: colors.N20,
361
- dark: colors.DN400
361
+ light: token('color.text.selected', colors.N20),
362
+ dark: token('color.text.selected', colors.DN400)
362
363
  }
363
364
  },
364
365
  'subtle-link': {
365
366
  default: {
366
- light: colors.N200,
367
- dark: colors.DN400
367
+ light: token('color.text.mediumEmphasis', colors.N200),
368
+ dark: token('color.text.mediumEmphasis', colors.DN400)
368
369
  },
369
370
  hover: {
370
- light: colors.N90,
371
- dark: colors.B50
371
+ light: token('color.text.mediumEmphasis', colors.N90),
372
+ dark: token('color.text.mediumEmphasis', colors.B50)
372
373
  },
373
374
  active: {
374
- light: colors.N400,
375
- dark: colors.DN300
375
+ light: token('color.text.highEmphasis', colors.N400),
376
+ dark: token('color.text.highEmphasis', colors.DN300)
376
377
  },
377
378
  disabled: {
378
- light: colors.N70,
379
- dark: colors.DN100
379
+ light: token('color.text.disabled', colors.N70),
380
+ dark: token('color.text.disabled', colors.DN100)
380
381
  },
381
382
  selected: {
382
- light: colors.N20,
383
- dark: colors.DN400
383
+ light: token('color.text.selected', colors.N20),
384
+ dark: token('color.text.selected', colors.DN400)
384
385
  },
385
386
  focusSelected: {
386
- light: colors.N20,
387
- dark: colors.DN400
387
+ light: token('color.text.selected', colors.N20),
388
+ dark: token('color.text.selected', colors.DN400)
388
389
  }
389
390
  }
390
391
  }
@@ -166,7 +166,7 @@ export function getCss({
166
166
  // Giving disabled styles preference over active by listing them after.
167
167
  // Not using '&:disabled' because :disabled is not a valid state for all element types
168
168
  // so we are targeting the attribute
169
- // Attributes have the same specificity a pesudo classes so we are overriding :disabled here
169
+ // Attributes have the same specificity a pseudo classes so we are overriding :disabled here
170
170
  '&[disabled]': { // always using 'disabled' even when selected
171
171
  ...getColors({
172
172
  appearance,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/button",
3
- "version": "16.0.0",
3
+ "version": "16.1.3",
4
4
  "sideEffects": false
5
5
  }
@@ -14,7 +14,7 @@ var stateToSelectorMap = {
14
14
  disabled: '&[disabled]'
15
15
  }; // Mapping the new clean css back to the legacy theme format.
16
16
  // The legacy theme format has all styles at the top level (no nested selectors)
17
- // and uses `getSpecifiers()` to apply the style to all psudeo states
17
+ // and uses `getSpecifiers()` to apply the style to all pseudo states
18
18
 
19
19
  export function getCustomCss(_ref) {
20
20
  var _ref$appearance = _ref.appearance,
@@ -40,7 +40,7 @@ export function getCustomCss(_ref) {
40
40
  shouldFitContainer: shouldFitContainer,
41
41
  isOnlySingleIcon: iconIsOnlyChild
42
42
  }); // we need to disable the default browser focus styles always
43
- // this is because we are not expressing that we can have two pesduo states at a time
43
+ // this is because we are not expressing that we can have two pseudo states at a time
44
44
 
45
45
  result.outline = 'none'; // Pulling relevant styles up to the top level
46
46
 
@@ -68,7 +68,7 @@ export function getCustomCss(_ref) {
68
68
  });
69
69
  return result;
70
70
  } // This styling approach works by generating a 'style' and applying with maximum specificity
71
- // To do this we are overwriting all psuedo selectors
71
+ // To do this we are overwriting all pseudo selectors
72
72
 
73
73
  export function getSpecifiers(styles) {
74
74
  return {
@@ -6,6 +6,8 @@ import React, { useCallback, useEffect, useRef } from 'react';
6
6
  import { jsx } from '@emotion/core';
7
7
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
8
8
  import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
9
+ import { N500 } from '@atlaskit/theme/colors';
10
+ import { token } from '@atlaskit/tokens';
9
11
  import blockEvents from './block-events';
10
12
  import { getContentStyle, getFadingCss, getIconStyle, overlayCss } from './css';
11
13
 
@@ -77,7 +79,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
77
79
  action: 'clicked',
78
80
  componentName: 'button',
79
81
  packageName: "@atlaskit/button",
80
- packageVersion: "16.0.0",
82
+ packageVersion: "16.1.3",
81
83
  analyticsData: analyticsContext
82
84
  }); // Button currently calls preventDefault, which is not standard button behaviour
83
85
 
@@ -99,6 +101,21 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
99
101
  hasOverlay: hasOverlay
100
102
  });
101
103
  var isInteractive = !isDisabled && !hasOverlay;
104
+ /** HACK: Spinner needs to have different colours in the "new" tokens design compared to the old design.
105
+ * For now, while we support both, these styles reach into Spinner when a theme is set, applies the right color.
106
+ * Ticket to remove: https://product-fabric.atlassian.net/browse/DSP-2067
107
+ */
108
+
109
+ var spinnerHackCss = {};
110
+
111
+ if (isSelected || isDisabled || appearance === 'warning') {
112
+ spinnerHackCss = {
113
+ '[data-theme] & svg': {
114
+ stroke: isSelected || isDisabled ? token('color.text.mediumEmphasis', N500) : token('color.text.onBoldWarning', N500)
115
+ }
116
+ };
117
+ }
118
+
102
119
  return jsx(Component, _extends({}, rest, {
103
120
  css: [buttonCss, isInteractive ? null : noPointerEventsOnChildrenCss],
104
121
  className: className,
@@ -130,6 +147,6 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
130
147
  spacing: spacing
131
148
  })]
132
149
  }, iconAfter) : null, overlay ? jsx("span", {
133
- css: overlayCss
150
+ css: [overlayCss, spinnerHackCss]
134
151
  }, overlay) : null);
135
152
  });