@atlaskit/button 17.17.3 → 17.18.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/CHANGELOG.md +46 -0
- package/dist/cjs/containers/button-group.js +3 -1
- package/dist/cjs/new-button/containers/split-button/split-button.js +6 -2
- package/dist/cjs/new-button/variants/default/button.js +8 -1
- package/dist/cjs/new-button/variants/default/link.js +8 -1
- package/dist/cjs/new-button/variants/default/use-default-button.js +7 -1
- package/dist/cjs/new-button/variants/icon/button.js +6 -1
- package/dist/cjs/new-button/variants/icon/link.js +6 -1
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/cjs/new-button/variants/shared/constants.js +7 -0
- package/dist/cjs/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/cjs/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/cjs/old-button/button.js +1 -1
- package/dist/cjs/old-button/custom-theme-button/custom-theme-button.js +1 -1
- package/dist/cjs/old-button/custom-theme-button/theme.js +1 -1
- package/dist/cjs/old-button/shared/button-base.js +9 -3
- package/dist/cjs/old-button/shared/css.js +4 -3
- package/dist/es2019/containers/button-group.js +3 -1
- package/dist/es2019/new-button/containers/split-button/split-button.js +5 -2
- package/dist/es2019/new-button/variants/default/button.js +7 -0
- package/dist/es2019/new-button/variants/default/link.js +7 -0
- package/dist/es2019/new-button/variants/default/use-default-button.js +7 -1
- package/dist/es2019/new-button/variants/icon/button.js +5 -0
- package/dist/es2019/new-button/variants/icon/link.js +5 -0
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/es2019/new-button/variants/shared/constants.js +1 -0
- package/dist/es2019/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/es2019/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/es2019/old-button/button.js +3 -0
- package/dist/es2019/old-button/custom-theme-button/custom-theme-button.js +3 -0
- package/dist/es2019/old-button/custom-theme-button/theme.js +2 -0
- package/dist/es2019/old-button/shared/button-base.js +10 -3
- package/dist/es2019/old-button/shared/css.js +4 -2
- package/dist/esm/containers/button-group.js +3 -1
- package/dist/esm/new-button/containers/split-button/split-button.js +5 -2
- package/dist/esm/new-button/variants/default/button.js +8 -1
- package/dist/esm/new-button/variants/default/link.js +8 -1
- package/dist/esm/new-button/variants/default/use-default-button.js +7 -1
- package/dist/esm/new-button/variants/icon/button.js +6 -1
- package/dist/esm/new-button/variants/icon/link.js +6 -1
- package/dist/esm/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/esm/new-button/variants/shared/constants.js +1 -0
- package/dist/esm/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/esm/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/esm/old-button/button.js +3 -0
- package/dist/esm/old-button/custom-theme-button/custom-theme-button.js +3 -0
- package/dist/esm/old-button/custom-theme-button/theme.js +2 -0
- package/dist/esm/old-button/shared/button-base.js +10 -3
- package/dist/esm/old-button/shared/css.js +4 -2
- package/dist/types/new-button/variants/default/link.d.ts +1 -1
- package/dist/types/new-button/variants/default/types.d.ts +1 -1
- package/dist/types/new-button/variants/default/use-default-button.d.ts +4 -3
- package/dist/types/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +4 -3
- package/dist/types/new-button/variants/shared/constants.d.ts +1 -0
- package/dist/types/new-button/variants/shared/loading-overlay.d.ts +2 -1
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +5 -1
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/types.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +4 -3
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +4 -3
- package/dist/types-ts4.5/new-button/variants/shared/constants.d.ts +1 -0
- package/dist/types-ts4.5/new-button/variants/shared/loading-overlay.d.ts +2 -1
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +5 -1
- package/package.json +202 -201
|
@@ -2,14 +2,17 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import React, { Fragment, useRef } from 'react';
|
|
5
|
+
import { uid } from 'react-uid';
|
|
5
6
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
6
7
|
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
7
8
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
9
10
|
import * as colors from '@atlaskit/theme/colors';
|
|
10
11
|
import { fontSize as getFontSize } from '@atlaskit/theme/constants';
|
|
12
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
11
13
|
import { useSplitButtonContext } from '../../containers/split-button/split-button-context';
|
|
12
14
|
import blockEvents from './block-events';
|
|
15
|
+
import { LOADING_LABEL } from './constants';
|
|
13
16
|
var fontSize = getFontSize();
|
|
14
17
|
var buttonStyles = xcss({
|
|
15
18
|
display: 'inline-flex',
|
|
@@ -20,10 +23,12 @@ var buttonStyles = xcss({
|
|
|
20
23
|
alignItems: 'baseline',
|
|
21
24
|
justifyContent: 'center',
|
|
22
25
|
columnGap: 'space.050',
|
|
26
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
23
27
|
background: "var(--ds-background-neutral, ".concat(colors.N20A, ")"),
|
|
24
28
|
borderRadius: 'border.radius.100',
|
|
25
29
|
borderWidth: 'border.width.0',
|
|
26
30
|
// @ts-expect-error
|
|
31
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
27
32
|
color: "var(--ds-text, ".concat(colors.N500, ")"),
|
|
28
33
|
flexShrink: 0,
|
|
29
34
|
height: "".concat(32 / fontSize, "em"),
|
|
@@ -34,6 +39,7 @@ var buttonStyles = xcss({
|
|
|
34
39
|
verticalAlign: 'middle',
|
|
35
40
|
':visited': {
|
|
36
41
|
// @ts-expect-error
|
|
42
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
37
43
|
color: "var(--ds-text, ".concat(colors.N500, ")")
|
|
38
44
|
}
|
|
39
45
|
});
|
|
@@ -54,12 +60,15 @@ var defaultInteractiveStyles = xcss({
|
|
|
54
60
|
':hover': {
|
|
55
61
|
background: "var(--ds-background-neutral-hovered, #091e4214)",
|
|
56
62
|
// @ts-expect-error
|
|
63
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
57
64
|
color: "var(--ds-text, ".concat(colors.N500, ")"),
|
|
58
65
|
transitionDuration: '0s, 0.15s'
|
|
59
66
|
},
|
|
60
67
|
':active': {
|
|
68
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
61
69
|
background: "var(--ds-background-neutral-pressed, ".concat(colors.B75, ")"),
|
|
62
70
|
// @ts-expect-error
|
|
71
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
63
72
|
color: "var(--ds-text, ".concat(colors.B400, ")"),
|
|
64
73
|
transitionDuration: '0s, 0s'
|
|
65
74
|
}
|
|
@@ -163,11 +172,13 @@ var subtleInteractiveStyles = xcss({
|
|
|
163
172
|
});
|
|
164
173
|
var linkStyles = xcss({
|
|
165
174
|
// @ts-expect-error
|
|
175
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
166
176
|
color: "var(--ds-link, ".concat(colors.B400, ")"),
|
|
167
177
|
background: "var(--ds-background-neutral-subtle, transparent)",
|
|
168
178
|
textDecoration: 'none',
|
|
169
179
|
':hover': {
|
|
170
180
|
// @ts-expect-error
|
|
181
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
171
182
|
color: "var(--ds-link, ".concat(colors.B300, ")"),
|
|
172
183
|
background: "var(--ds-background-neutral-subtle, transparent)"
|
|
173
184
|
},
|
|
@@ -178,26 +189,31 @@ var linkStyles = xcss({
|
|
|
178
189
|
},
|
|
179
190
|
':visited': {
|
|
180
191
|
// @ts-expect-error
|
|
192
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
181
193
|
color: "var(--ds-link, ".concat(colors.B400, ")")
|
|
182
194
|
}
|
|
183
195
|
});
|
|
184
196
|
var subtleLinkStyles = xcss({
|
|
185
197
|
// @ts-expect-error
|
|
198
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
186
199
|
color: "var(--ds-text-subtle, ".concat(colors.N200, ")"),
|
|
187
200
|
background: "var(--ds-background-neutral-subtle, transparent)",
|
|
188
201
|
textDecoration: 'none',
|
|
189
202
|
':hover': {
|
|
190
203
|
// @ts-expect-error
|
|
204
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
191
205
|
color: "var(--ds-text-subtle, ".concat(colors.N90, ")"),
|
|
192
206
|
background: "var(--ds-background-neutral-subtle, transparent)"
|
|
193
207
|
},
|
|
194
208
|
':active': {
|
|
195
209
|
// @ts-expect-error
|
|
210
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
196
211
|
color: "var(--ds-text, ".concat(colors.N400, ")"),
|
|
197
212
|
background: "var(--ds-background-neutral-subtle, transparent)"
|
|
198
213
|
},
|
|
199
214
|
':visited': {
|
|
200
215
|
// @ts-expect-error
|
|
216
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
201
217
|
color: "var(--ds-text-subtle, ".concat(colors.N200, ")")
|
|
202
218
|
}
|
|
203
219
|
});
|
|
@@ -224,72 +240,94 @@ var linkDecorationStyles = xcss({
|
|
|
224
240
|
}
|
|
225
241
|
});
|
|
226
242
|
var disabledStyles = xcss({
|
|
243
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
227
244
|
background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
|
|
228
245
|
// @ts-expect-error
|
|
229
246
|
color: "var(--ds-text-disabled, #091E424F)",
|
|
230
247
|
':hover': {
|
|
248
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
231
249
|
background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
|
|
232
250
|
// @ts-expect-error
|
|
233
251
|
color: "var(--ds-text-disabled, #091E424F)"
|
|
234
252
|
},
|
|
235
253
|
':active': {
|
|
254
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
236
255
|
background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
|
|
237
256
|
// @ts-expect-error
|
|
238
257
|
color: "var(--ds-text-disabled, #091E424F)"
|
|
239
258
|
}
|
|
240
259
|
});
|
|
241
260
|
var selectedStyles = xcss({
|
|
261
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
242
262
|
background: "var(--ds-background-selected, ".concat(colors.N700, ")"),
|
|
243
263
|
// @ts-expect-error
|
|
264
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
244
265
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
245
266
|
':visited': {
|
|
246
267
|
// @ts-expect-error
|
|
268
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
247
269
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")")
|
|
248
270
|
}
|
|
249
271
|
});
|
|
250
272
|
var selectedInteractiveStyles = xcss({
|
|
251
273
|
':hover': {
|
|
252
274
|
// @ts-expect-error
|
|
275
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
253
276
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
277
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
254
278
|
background: "var(--ds-background-selected-hovered, ".concat(colors.N700, ")")
|
|
255
279
|
},
|
|
256
280
|
':active': {
|
|
257
281
|
// @ts-expect-error
|
|
282
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
258
283
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
284
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
259
285
|
background: "var(--ds-background-selected-pressed, ".concat(colors.N700, ")")
|
|
260
286
|
}
|
|
261
287
|
});
|
|
262
288
|
|
|
263
289
|
// TODO: Remove me once we kill color fallbacks
|
|
264
290
|
var selectedWarningStyles = xcss({
|
|
291
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
265
292
|
background: "var(--ds-background-selected, ".concat(colors.Y400, ")"),
|
|
266
293
|
// @ts-expect-error
|
|
294
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
267
295
|
color: "var(--ds-text-selected, ".concat(colors.N800, ")"),
|
|
268
296
|
':hover': {
|
|
269
297
|
// @ts-expect-error
|
|
298
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
270
299
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
300
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
271
301
|
background: "var(--ds-background-selected, ".concat(colors.Y400, ")")
|
|
272
302
|
},
|
|
273
303
|
':active': {
|
|
274
304
|
// @ts-expect-error
|
|
305
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
275
306
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
307
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
276
308
|
background: "var(--ds-background-selected, ".concat(colors.Y400, ")")
|
|
277
309
|
}
|
|
278
310
|
});
|
|
279
311
|
|
|
280
312
|
// TODO: Remove me once we kill color fallbacks
|
|
281
313
|
var selectedDangerStyles = xcss({
|
|
314
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
282
315
|
background: "var(--ds-background-selected, ".concat(colors.R500, ")"),
|
|
283
316
|
// @ts-expect-error
|
|
317
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
284
318
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
285
319
|
':hover': {
|
|
286
320
|
// @ts-expect-error
|
|
321
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
287
322
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
323
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
288
324
|
background: "var(--ds-background-selected, ".concat(colors.R500, ")")
|
|
289
325
|
},
|
|
290
326
|
':active': {
|
|
291
327
|
// @ts-expect-error
|
|
328
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
292
329
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
330
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
293
331
|
background: "var(--ds-background-selected, ".concat(colors.R500, ")")
|
|
294
332
|
}
|
|
295
333
|
});
|
|
@@ -298,14 +336,17 @@ var selectedDangerStyles = xcss({
|
|
|
298
336
|
var selectedDiscoveryStyles = xcss({
|
|
299
337
|
background: "var(--ds-background-selected, #403294)",
|
|
300
338
|
// @ts-expect-error
|
|
339
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
301
340
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
302
341
|
':hover': {
|
|
303
342
|
// @ts-expect-error
|
|
343
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
304
344
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
305
345
|
background: "var(--ds-background-selected, #403294)"
|
|
306
346
|
},
|
|
307
347
|
':active': {
|
|
308
348
|
// @ts-expect-error
|
|
349
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
309
350
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
310
351
|
background: "var(--ds-background-selected, #403294)"
|
|
311
352
|
}
|
|
@@ -432,9 +473,16 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
432
473
|
_ref$shouldFitContain = _ref.shouldFitContainer,
|
|
433
474
|
shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
|
|
434
475
|
_ref$spacing = _ref.spacing,
|
|
435
|
-
propSpacing = _ref$spacing === void 0 ? 'default' : _ref$spacing
|
|
476
|
+
propSpacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
|
|
477
|
+
ariaLabel = _ref.ariaLabel,
|
|
478
|
+
ariaLabelledBy = _ref.ariaLabelledBy;
|
|
436
479
|
var localRef = useRef(null);
|
|
437
480
|
var splitButtonContext = useSplitButtonContext();
|
|
481
|
+
// TODO: Use React 18's useId() hook when we update.
|
|
482
|
+
// eslint-disable-next-line @repo/internal/react/disallow-unstable-values
|
|
483
|
+
var loadingLabelId = uid({
|
|
484
|
+
ariaLabelledBy: ariaLabelledBy
|
|
485
|
+
});
|
|
438
486
|
var isSplitButton = Boolean(splitButtonContext);
|
|
439
487
|
var isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
|
|
440
488
|
var appearance = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
|
|
@@ -458,7 +506,11 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
458
506
|
children: /*#__PURE__*/React.createElement(Fragment, null, children, overlay ? /*#__PURE__*/React.createElement(Box, {
|
|
459
507
|
as: "span",
|
|
460
508
|
xcss: overlayStyles
|
|
461
|
-
}, overlay) : null)
|
|
509
|
+
}, overlay) : null, isLoading && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
510
|
+
id: loadingLabelId
|
|
511
|
+
}, ", Loading")),
|
|
512
|
+
'aria-label': isLoading && ariaLabel && !ariaLabelledBy ? "".concat(ariaLabel, " ").concat(LOADING_LABEL) : ariaLabel,
|
|
513
|
+
'aria-labelledby': isLoading && ariaLabelledBy ? "".concat(ariaLabelledBy, " ").concat(loadingLabelId) : ariaLabelledBy
|
|
462
514
|
}, blockEvents(isEffectivelyDisabled, {
|
|
463
515
|
onClick: onClick,
|
|
464
516
|
onMouseDownCapture: onMouseDownCapture,
|
|
@@ -3,6 +3,9 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["appearance", "children", "iconBefore", "iconAfter", "isSelected", "onMouseDown", "onMouseUp", "shouldFitContainer", "spacing"];
|
|
5
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
|
+
|
|
6
9
|
import noop from '@atlaskit/ds-lib/noop';
|
|
7
10
|
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
8
11
|
import ButtonBase from './shared/button-base';
|
|
@@ -6,6 +6,9 @@ var _excluded = ["appearance", "autoFocus", "isDisabled", "isSelected", "shouldF
|
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
import React, { useCallback, useState } from 'react';
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
|
+
|
|
9
12
|
import GlobalTheme from '@atlaskit/theme/components';
|
|
10
13
|
import ButtonBase from '../shared/button-base';
|
|
11
14
|
import getIsOnlySingleIcon from '../shared/get-is-only-single-icon';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
|
+
|
|
4
6
|
import { createTheme } from '@atlaskit/theme/components';
|
|
5
7
|
import { getCss } from '../shared/css';
|
|
6
8
|
var stateToSelectorMap = {
|
|
@@ -4,6 +4,8 @@ var _excluded = ["analyticsContext", "appearance", "autoFocus", "buttonCss", "ch
|
|
|
4
4
|
/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
|
|
5
5
|
/** @jsx jsx */
|
|
6
6
|
import React, { useCallback, useContext, useEffect, useRef } from 'react';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
9
|
import { css, jsx } from '@emotion/react';
|
|
8
10
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
9
11
|
import noop from '@atlaskit/ds-lib/noop';
|
|
@@ -120,7 +122,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
120
122
|
action: 'clicked',
|
|
121
123
|
componentName: 'button',
|
|
122
124
|
packageName: "@atlaskit/button",
|
|
123
|
-
packageVersion: "17.
|
|
125
|
+
packageVersion: "17.18.0",
|
|
124
126
|
analyticsData: analyticsContext
|
|
125
127
|
});
|
|
126
128
|
|
|
@@ -140,6 +142,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
140
142
|
|
|
141
143
|
// we are 'disabling' input with a button when there is an overlay
|
|
142
144
|
var hasOverlay = Boolean(overlay);
|
|
145
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
143
146
|
var fadeStyles = css(getFadingCss({
|
|
144
147
|
hasOverlay: hasOverlay
|
|
145
148
|
}));
|
|
@@ -183,13 +186,17 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
183
186
|
}, blockEvents({
|
|
184
187
|
isInteractive: isInteractive
|
|
185
188
|
})), iconBefore ? jsx("span", {
|
|
186
|
-
css: [fadeStyles,
|
|
189
|
+
css: [fadeStyles,
|
|
190
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
191
|
+
getIconStyle({
|
|
187
192
|
spacing: spacing
|
|
188
193
|
}), getSpacingFix(children, iconBeforeSpacingFixStyle)]
|
|
189
194
|
}, iconBefore) : null, getChildren(children, [fadeStyles, getContentStyle({
|
|
190
195
|
spacing: spacing
|
|
191
196
|
})]), iconAfter ? jsx("span", {
|
|
192
|
-
css: [fadeStyles,
|
|
197
|
+
css: [fadeStyles,
|
|
198
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
199
|
+
getIconStyle({
|
|
193
200
|
spacing: spacing
|
|
194
201
|
}), getSpacingFix(children, iconAfterSpacingFixStyle)]
|
|
195
202
|
}, iconAfter) : null, overlay ? jsx("span", {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
5
|
import { css } from '@emotion/react';
|
|
5
6
|
import { fontSize as getFontSize,
|
|
6
7
|
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
@@ -187,7 +188,7 @@ export function getIconStyle(_ref4) {
|
|
|
187
188
|
return css({
|
|
188
189
|
display: 'flex',
|
|
189
190
|
// icon size cannot grow and shrink
|
|
190
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
191
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
191
192
|
margin: spacing === 'none' ? 0 : innerMargin.icon,
|
|
192
193
|
flexGrow: 0,
|
|
193
194
|
flexShrink: 0,
|
|
@@ -202,7 +203,7 @@ export function getIconStyle(_ref4) {
|
|
|
202
203
|
export function getContentStyle(_ref5) {
|
|
203
204
|
var spacing = _ref5.spacing;
|
|
204
205
|
return css({
|
|
205
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
206
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
206
207
|
margin: spacing === 'none' ? 0 : innerMargin.content,
|
|
207
208
|
// content can grow and shrink
|
|
208
209
|
flexGrow: 1,
|
|
@@ -216,6 +217,7 @@ export function getContentStyle(_ref5) {
|
|
|
216
217
|
export function getFadingCss(_ref6) {
|
|
217
218
|
var hasOverlay = _ref6.hasOverlay;
|
|
218
219
|
return css({
|
|
220
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
219
221
|
opacity: hasOverlay ? 0 : 1,
|
|
220
222
|
transition: 'opacity 0.3s'
|
|
221
223
|
});
|
|
@@ -2,7 +2,7 @@ import { type Ref } from 'react';
|
|
|
2
2
|
import { type AdditionalDefaultLinkVariantProps, type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonDefaultButtonProps } from './types';
|
|
4
4
|
export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig> & AdditionalDefaultLinkVariantProps;
|
|
5
|
-
declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, appearance, autoFocus, children, href, iconAfter, iconBefore, interactionName, isDisabled, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
5
|
+
declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, appearance, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, autoFocus, children, href, iconAfter, iconBefore, interactionName, isDisabled, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Button__
|
|
8
8
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { type ButtonSpacing, type IconProp, type IconSize } from '../types';
|
|
3
3
|
export type CommonDefaultButtonProps = {
|
|
4
4
|
/**
|
|
5
|
-
* Text content to be rendered in the button.
|
|
5
|
+
* Text content to be rendered in the button.
|
|
6
6
|
*/
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type UseButtonBaseArgs, type UseButtonBaseReturn } from '../shared/use-button-base';
|
|
2
|
-
import {
|
|
3
|
-
type
|
|
2
|
+
import type { CommonButtonProps } from '../types';
|
|
3
|
+
import type { CommonDefaultButtonProps } from './types';
|
|
4
|
+
type UseDefaultButtonArgs<TagName extends HTMLElement> = UseButtonBaseArgs<TagName> & CommonDefaultButtonProps & Pick<CommonButtonProps<TagName>, 'testId'>;
|
|
4
5
|
type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>;
|
|
5
6
|
/**
|
|
6
7
|
* __Use default button base__
|
|
@@ -11,5 +12,5 @@ type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>
|
|
|
11
12
|
*
|
|
12
13
|
* @private
|
|
13
14
|
*/
|
|
14
|
-
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, children, iconAfter: IconAfter, iconBefore: IconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shouldFitContainer, spacing, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
|
|
15
|
+
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter: IconAfter, iconBefore: IconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
|
|
15
16
|
export default useDefaultButton;
|
|
@@ -2,7 +2,7 @@ import { type Ref } from 'react';
|
|
|
2
2
|
import { type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
4
|
export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
|
|
5
|
-
declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ "aria-label": preventedAriaLabel, analyticsContext, appearance, autoFocus, href, icon, interactionName, isDisabled, isSelected, isTooltipDisabled, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, shape, spacing, testId, tooltip, UNSAFE_size, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
5
|
+
declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ "aria-label": preventedAriaLabel, "aria-labelledby": ariaLabelledBy, analyticsContext, appearance, autoFocus, href, icon, interactionName, isDisabled, isSelected, isTooltipDisabled, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, shape, spacing, testId, tooltip, UNSAFE_size, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Icon Button__
|
|
8
8
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type UseButtonBaseArgs, type UseButtonBaseReturn } from '../shared/use-button-base';
|
|
2
|
-
import {
|
|
3
|
-
type
|
|
2
|
+
import type { CommonButtonProps } from '../types';
|
|
3
|
+
import type { CommonIconButtonProps } from './types';
|
|
4
|
+
type UseIconButtonArgs<TagName extends HTMLElement> = Omit<UseButtonBaseArgs<TagName>, 'children'> & Omit<CommonIconButtonProps, 'isTooltipDisabled' | 'tooltip'> & Pick<CommonButtonProps<TagName>, 'testId'>;
|
|
4
5
|
type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>;
|
|
5
6
|
/**
|
|
6
7
|
* __Use icon button__
|
|
@@ -11,5 +12,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
|
|
|
11
12
|
*
|
|
12
13
|
* @private
|
|
13
14
|
*/
|
|
14
|
-
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shape, shouldFitContainer, spacing, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
15
|
+
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shape, shouldFitContainer, spacing, testId, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
15
16
|
export default useIconButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LOADING_LABEL = ", Loading";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type Appearance, type ButtonSpacing } from '../types';
|
|
3
|
-
export default function renderLoadingOverlay({ appearance, spacing, isDisabled, isSelected, }: {
|
|
3
|
+
export default function renderLoadingOverlay({ appearance, spacing, isDisabled, isSelected, testId, }: {
|
|
4
4
|
spacing?: ButtonSpacing;
|
|
5
5
|
appearance?: Appearance;
|
|
6
6
|
isDisabled?: boolean;
|
|
7
7
|
isSelected?: boolean;
|
|
8
|
+
testId?: string;
|
|
8
9
|
}): JSX.Element;
|
|
@@ -17,6 +17,8 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
17
17
|
children: React.ReactNode;
|
|
18
18
|
spacing?: Spacing;
|
|
19
19
|
isLoading?: boolean;
|
|
20
|
+
ariaLabel?: string;
|
|
21
|
+
ariaLabelledBy?: string;
|
|
20
22
|
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay'> & ControlledEvents<TagName>;
|
|
21
23
|
type XCSS = ReturnType<typeof xcss>;
|
|
22
24
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
@@ -24,6 +26,8 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
|
24
26
|
ref(node: TagName | null): void;
|
|
25
27
|
children: React.ReactNode;
|
|
26
28
|
isDisabled: boolean;
|
|
29
|
+
'aria-label'?: string;
|
|
30
|
+
'aria-labelledby'?: string;
|
|
27
31
|
} & ControlledEvents<TagName>;
|
|
28
32
|
/**
|
|
29
33
|
* __Use button base__
|
|
@@ -38,5 +42,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
|
38
42
|
*
|
|
39
43
|
* @private
|
|
40
44
|
*/
|
|
41
|
-
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
45
|
+
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, ariaLabel, ariaLabelledBy, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
42
46
|
export default useButtonBase;
|
|
@@ -2,7 +2,7 @@ import { type Ref } from 'react';
|
|
|
2
2
|
import { type AdditionalDefaultLinkVariantProps, type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonDefaultButtonProps } from './types';
|
|
4
4
|
export type LinkButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonDefaultButtonProps & CommonLinkVariantProps<RouterLinkConfig> & AdditionalDefaultLinkVariantProps;
|
|
5
|
-
declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, appearance, autoFocus, children, href, iconAfter, iconBefore, interactionName, isDisabled, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
5
|
+
declare const LinkButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ analyticsContext, appearance, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, autoFocus, children, href, iconAfter, iconBefore, interactionName, isDisabled, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, ...rest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Button__
|
|
8
8
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { type ButtonSpacing, type IconProp, type IconSize } from '../types';
|
|
3
3
|
export type CommonDefaultButtonProps = {
|
|
4
4
|
/**
|
|
5
|
-
* Text content to be rendered in the button.
|
|
5
|
+
* Text content to be rendered in the button.
|
|
6
6
|
*/
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type UseButtonBaseArgs, type UseButtonBaseReturn } from '../shared/use-button-base';
|
|
2
|
-
import {
|
|
3
|
-
type
|
|
2
|
+
import type { CommonButtonProps } from '../types';
|
|
3
|
+
import type { CommonDefaultButtonProps } from './types';
|
|
4
|
+
type UseDefaultButtonArgs<TagName extends HTMLElement> = UseButtonBaseArgs<TagName> & CommonDefaultButtonProps & Pick<CommonButtonProps<TagName>, 'testId'>;
|
|
4
5
|
type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>;
|
|
5
6
|
/**
|
|
6
7
|
* __Use default button base__
|
|
@@ -11,5 +12,5 @@ type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>
|
|
|
11
12
|
*
|
|
12
13
|
* @private
|
|
13
14
|
*/
|
|
14
|
-
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, children, iconAfter: IconAfter, iconBefore: IconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shouldFitContainer, spacing, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
|
|
15
|
+
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter: IconAfter, iconBefore: IconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
|
|
15
16
|
export default useDefaultButton;
|
|
@@ -2,7 +2,7 @@ import { type Ref } from 'react';
|
|
|
2
2
|
import { type CommonLinkVariantProps } from '../types';
|
|
3
3
|
import { type CommonIconButtonProps } from './types';
|
|
4
4
|
export type LinkIconButtonProps<RouterLinkConfig extends Record<string, any> = never> = CommonIconButtonProps & CommonLinkVariantProps<RouterLinkConfig>;
|
|
5
|
-
declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ "aria-label": preventedAriaLabel, analyticsContext, appearance, autoFocus, href, icon, interactionName, isDisabled, isSelected, isTooltipDisabled, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, shape, spacing, testId, tooltip, UNSAFE_size, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
5
|
+
declare const LinkIconButtonBase: <RouterLinkConfig extends Record<string, any> = never>({ "aria-label": preventedAriaLabel, "aria-labelledby": ariaLabelledBy, analyticsContext, appearance, autoFocus, href, icon, interactionName, isDisabled, isSelected, isTooltipDisabled, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, shape, spacing, testId, tooltip, UNSAFE_size, ...rest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Icon Button__
|
|
8
8
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type UseButtonBaseArgs, type UseButtonBaseReturn } from '../shared/use-button-base';
|
|
2
|
-
import {
|
|
3
|
-
type
|
|
2
|
+
import type { CommonButtonProps } from '../types';
|
|
3
|
+
import type { CommonIconButtonProps } from './types';
|
|
4
|
+
type UseIconButtonArgs<TagName extends HTMLElement> = Omit<UseButtonBaseArgs<TagName>, 'children'> & Omit<CommonIconButtonProps, 'isTooltipDisabled' | 'tooltip'> & Pick<CommonButtonProps<TagName>, 'testId'>;
|
|
4
5
|
type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>;
|
|
5
6
|
/**
|
|
6
7
|
* __Use icon button__
|
|
@@ -11,5 +12,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
|
|
|
11
12
|
*
|
|
12
13
|
* @private
|
|
13
14
|
*/
|
|
14
|
-
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shape, shouldFitContainer, spacing, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
15
|
+
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon: Icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, overlay, ref, shape, shouldFitContainer, spacing, testId, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
15
16
|
export default useIconButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LOADING_LABEL = ", Loading";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type Appearance, type ButtonSpacing } from '../types';
|
|
3
|
-
export default function renderLoadingOverlay({ appearance, spacing, isDisabled, isSelected, }: {
|
|
3
|
+
export default function renderLoadingOverlay({ appearance, spacing, isDisabled, isSelected, testId, }: {
|
|
4
4
|
spacing?: ButtonSpacing;
|
|
5
5
|
appearance?: Appearance;
|
|
6
6
|
isDisabled?: boolean;
|
|
7
7
|
isSelected?: boolean;
|
|
8
|
+
testId?: string;
|
|
8
9
|
}): JSX.Element;
|
|
@@ -17,6 +17,8 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
17
17
|
children: React.ReactNode;
|
|
18
18
|
spacing?: Spacing;
|
|
19
19
|
isLoading?: boolean;
|
|
20
|
+
ariaLabel?: string;
|
|
21
|
+
ariaLabelledBy?: string;
|
|
20
22
|
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'overlay'> & ControlledEvents<TagName>;
|
|
21
23
|
type XCSS = ReturnType<typeof xcss>;
|
|
22
24
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
@@ -24,6 +26,8 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
|
24
26
|
ref(node: TagName | null): void;
|
|
25
27
|
children: React.ReactNode;
|
|
26
28
|
isDisabled: boolean;
|
|
29
|
+
'aria-label'?: string;
|
|
30
|
+
'aria-labelledby'?: string;
|
|
27
31
|
} & ControlledEvents<TagName>;
|
|
28
32
|
/**
|
|
29
33
|
* __Use button base__
|
|
@@ -38,5 +42,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
|
38
42
|
*
|
|
39
43
|
* @private
|
|
40
44
|
*/
|
|
41
|
-
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
45
|
+
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, overlay, ref, shouldFitContainer, spacing: propSpacing, ariaLabel, ariaLabelledBy, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
42
46
|
export default useButtonBase;
|