@atlaskit/button 17.23.0 → 18.0.1
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 +18 -5
- package/dist/cjs/new-button/variants/default/button.js +1 -3
- package/dist/cjs/new-button/variants/default/link.js +1 -3
- package/dist/cjs/new-button/variants/default/use-default-button.js +4 -13
- package/dist/cjs/new-button/variants/icon/button.js +1 -3
- package/dist/cjs/new-button/variants/icon/link.js +1 -3
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +5 -13
- package/dist/cjs/new-button/variants/shared/content.js +2 -2
- package/dist/cjs/new-button/variants/shared/use-button-base.js +19 -15
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/variants/default/button.js +0 -2
- package/dist/es2019/new-button/variants/default/link.js +0 -2
- package/dist/es2019/new-button/variants/default/use-default-button.js +4 -13
- package/dist/es2019/new-button/variants/icon/button.js +0 -2
- package/dist/es2019/new-button/variants/icon/link.js +0 -2
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +4 -13
- package/dist/es2019/new-button/variants/shared/content.js +2 -2
- package/dist/es2019/new-button/variants/shared/use-button-base.js +19 -15
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/variants/default/button.js +1 -3
- package/dist/esm/new-button/variants/default/link.js +1 -3
- package/dist/esm/new-button/variants/default/use-default-button.js +4 -13
- package/dist/esm/new-button/variants/icon/button.js +1 -3
- package/dist/esm/new-button/variants/icon/link.js +1 -3
- package/dist/esm/new-button/variants/icon/use-icon-button.js +5 -13
- package/dist/esm/new-button/variants/shared/content.js +2 -2
- package/dist/esm/new-button/variants/shared/use-button-base.js +19 -15
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/new-button/variants/default/link.d.ts +1 -1
- package/dist/types/new-button/variants/default/use-default-button.d.ts +1 -1
- package/dist/types/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +1 -1
- package/dist/types/new-button/variants/shared/content.d.ts +2 -2
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +2 -2
- package/dist/types/new-button/variants/types.d.ts +0 -6
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +1 -1
- 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 +1 -1
- package/dist/types-ts4.5/new-button/variants/shared/content.d.ts +2 -2
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +2 -2
- package/dist/types-ts4.5/new-button/variants/types.d.ts +0 -6
- package/package.json +4 -4
|
@@ -9,6 +9,7 @@ import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
|
9
9
|
import { useSplitButtonContext } from '../../containers/split-button/split-button-context';
|
|
10
10
|
import blockEvents from './block-events';
|
|
11
11
|
import { LOADING_LABEL } from './constants';
|
|
12
|
+
import renderLoadingOverlay from './loading-overlay';
|
|
12
13
|
const buttonStyles = xcss({
|
|
13
14
|
display: 'inline-flex',
|
|
14
15
|
boxSizing: 'border-box',
|
|
@@ -281,6 +282,7 @@ const linkDecorationStyles = xcss({
|
|
|
281
282
|
}
|
|
282
283
|
});
|
|
283
284
|
const disabledStyles = xcss({
|
|
285
|
+
cursor: 'not-allowed',
|
|
284
286
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
285
287
|
background: `var(--ds-background-disabled, ${colors.N20A})`,
|
|
286
288
|
// @ts-expect-error
|
|
@@ -436,12 +438,9 @@ const circleStyles = xcss({
|
|
|
436
438
|
const fullWidthStyles = xcss({
|
|
437
439
|
width: '100%'
|
|
438
440
|
});
|
|
439
|
-
const
|
|
441
|
+
const loadingStyles = xcss({
|
|
440
442
|
cursor: 'progress'
|
|
441
443
|
});
|
|
442
|
-
const nonInteractiveStyles = xcss({
|
|
443
|
-
cursor: 'not-allowed'
|
|
444
|
-
});
|
|
445
444
|
const iconButtonStyles = xcss({
|
|
446
445
|
height: `${32 / 14}em`,
|
|
447
446
|
width: `${32 / 14}em`,
|
|
@@ -469,7 +468,7 @@ const navigationSplitButtonStyles = xcss({
|
|
|
469
468
|
paddingInlineEnd: 'space.075',
|
|
470
469
|
paddingInlineStart: 'space.075'
|
|
471
470
|
});
|
|
472
|
-
const
|
|
471
|
+
const loadingOverlayStyles = xcss({
|
|
473
472
|
display: 'flex',
|
|
474
473
|
position: 'absolute',
|
|
475
474
|
alignItems: 'center',
|
|
@@ -516,10 +515,10 @@ const useButtonBase = ({
|
|
|
516
515
|
onPointerDownCapture,
|
|
517
516
|
onPointerUpCapture,
|
|
518
517
|
onClickCapture,
|
|
519
|
-
overlay,
|
|
520
518
|
ref,
|
|
521
519
|
shouldFitContainer = false,
|
|
522
520
|
spacing: propSpacing = 'default',
|
|
521
|
+
testId,
|
|
523
522
|
ariaLabel,
|
|
524
523
|
ariaLabelledBy
|
|
525
524
|
}) => {
|
|
@@ -536,9 +535,9 @@ const useButtonBase = ({
|
|
|
536
535
|
const appearance = getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') && isDefaultAppearanceSplitButton ? 'subtle' : (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
|
|
537
536
|
const spacing = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.spacing) || propSpacing;
|
|
538
537
|
const isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
const isEffectivelyDisabled = isDisabled ||
|
|
538
|
+
const isInteractive = !isDisabled && !isLoading;
|
|
539
|
+
// Also treat loading buttons as disabled
|
|
540
|
+
const isEffectivelyDisabled = isDisabled || isLoading;
|
|
542
541
|
const isSelected = propIsSelected && !isDisabled;
|
|
543
542
|
useAutoFocus(localRef, autoFocus);
|
|
544
543
|
return {
|
|
@@ -549,15 +548,20 @@ const useButtonBase = ({
|
|
|
549
548
|
// TODO: remove me once we kill color fallbacks
|
|
550
549
|
isSelected && appearance === 'warning' && selectedWarningStyles,
|
|
551
550
|
// TODO: remove me once we kill color fallbacks
|
|
552
|
-
isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, spacing === 'compact' && (getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedSpacingCompactStyles : baseSpacingCompactStyles), spacing === 'none' && spacingNoneStyles, spacing === 'none' && getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') && tokenizedSpacingNoneStyles, spacing !== 'none' && hasIconBefore && buttonIconBeforeStyles, spacing !== 'none' && hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading &&
|
|
553
|
-
// Consider overlay buttons to be effectively disabled
|
|
551
|
+
isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, spacing === 'compact' && (getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedSpacingCompactStyles : baseSpacingCompactStyles), spacing === 'none' && spacingNoneStyles, spacing === 'none' && getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') && tokenizedSpacingNoneStyles, spacing !== 'none' && hasIconBefore && buttonIconBeforeStyles, spacing !== 'none' && hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading && loadingStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
|
|
554
552
|
isDisabled: isEffectivelyDisabled,
|
|
555
|
-
children: /*#__PURE__*/React.createElement(Fragment, null, children,
|
|
553
|
+
children: /*#__PURE__*/React.createElement(Fragment, null, children, isLoading ? /*#__PURE__*/React.createElement(Box, {
|
|
556
554
|
as: "span",
|
|
557
|
-
xcss:
|
|
558
|
-
},
|
|
555
|
+
xcss: loadingOverlayStyles
|
|
556
|
+
}, renderLoadingOverlay({
|
|
557
|
+
spacing,
|
|
558
|
+
appearance,
|
|
559
|
+
isDisabled,
|
|
560
|
+
isSelected,
|
|
561
|
+
testId
|
|
562
|
+
})) : null, isLoading && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
559
563
|
id: loadingLabelId
|
|
560
|
-
},
|
|
564
|
+
}, LOADING_LABEL)),
|
|
561
565
|
'aria-label': isLoading && ariaLabel && !ariaLabelledBy ? `${ariaLabel} ${LOADING_LABEL}` : ariaLabel,
|
|
562
566
|
'aria-labelledby': isLoading && ariaLabelledBy ? `${ariaLabelledBy} ${loadingLabelId}` : ariaLabelledBy,
|
|
563
567
|
...blockEvents(isEffectivelyDisabled, {
|
|
@@ -119,7 +119,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
119
119
|
action: 'clicked',
|
|
120
120
|
componentName: 'button',
|
|
121
121
|
packageName: "@atlaskit/button",
|
|
122
|
-
packageVersion: "
|
|
122
|
+
packageVersion: "18.0.1",
|
|
123
123
|
analyticsData: analyticsContext
|
|
124
124
|
});
|
|
125
125
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["analyticsContext", "appearance", "aria-label", "aria-labelledby", "autoFocus", "children", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isLoading", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "
|
|
3
|
+
var _excluded = ["analyticsContext", "appearance", "aria-label", "aria-labelledby", "autoFocus", "children", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isLoading", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "shouldFitContainer", "spacing", "testId", "type", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"],
|
|
4
4
|
_excluded2 = ["className", "css", "as", "style"];
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -38,7 +38,6 @@ var Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function But
|
|
|
38
38
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
39
39
|
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
40
40
|
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
41
|
-
overlay = _ref.overlay,
|
|
42
41
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
43
42
|
spacing = _ref.spacing,
|
|
44
43
|
testId = _ref.testId,
|
|
@@ -78,7 +77,6 @@ var Button = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function But
|
|
|
78
77
|
onPointerUpCapture: onPointerUpCapture,
|
|
79
78
|
onTouchEndCapture: onTouchEndCapture,
|
|
80
79
|
onTouchStartCapture: onTouchStartCapture,
|
|
81
|
-
overlay: overlay,
|
|
82
80
|
ref: ref,
|
|
83
81
|
shouldFitContainer: shouldFitContainer,
|
|
84
82
|
spacing: spacing,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["analyticsContext", "appearance", "aria-label", "aria-labelledby", "autoFocus", "children", "href", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "
|
|
3
|
+
var _excluded = ["analyticsContext", "appearance", "aria-label", "aria-labelledby", "autoFocus", "children", "href", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "shouldFitContainer", "spacing", "testId", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"],
|
|
4
4
|
_excluded2 = ["className", "css", "as", "style"];
|
|
5
5
|
import React, { forwardRef, memo } from 'react';
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -29,7 +29,6 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
29
29
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
30
30
|
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
31
31
|
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
32
|
-
overlay = _ref.overlay,
|
|
33
32
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
34
33
|
spacing = _ref.spacing,
|
|
35
34
|
testId = _ref.testId,
|
|
@@ -66,7 +65,6 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
66
65
|
onPointerUpCapture: onPointerUpCapture,
|
|
67
66
|
onTouchEndCapture: onTouchEndCapture,
|
|
68
67
|
onTouchStartCapture: onTouchStartCapture,
|
|
69
|
-
overlay: overlay,
|
|
70
68
|
ref: ref,
|
|
71
69
|
shouldFitContainer: shouldFitContainer,
|
|
72
70
|
spacing: spacing,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
2
|
import Content from '../shared/content';
|
|
3
3
|
import IconRenderer from '../shared/icon-renderer';
|
|
4
|
-
import renderLoadingOverlay from '../shared/loading-overlay';
|
|
5
4
|
import useButtonBase from '../shared/use-button-base';
|
|
6
5
|
/**
|
|
7
6
|
* __Use default button base__
|
|
@@ -37,14 +36,12 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
37
36
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
38
37
|
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
39
38
|
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
40
|
-
overlay = _ref.overlay,
|
|
41
39
|
ref = _ref.ref,
|
|
42
40
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
43
41
|
spacing = _ref.spacing,
|
|
44
42
|
testId = _ref.testId,
|
|
45
43
|
UNSAFE_iconAfter_size = _ref.UNSAFE_iconAfter_size,
|
|
46
44
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size;
|
|
47
|
-
var hasOverlay = Boolean(overlay || isLoading);
|
|
48
45
|
var baseProps = useButtonBase({
|
|
49
46
|
analyticsContext: analyticsContext,
|
|
50
47
|
appearance: appearance,
|
|
@@ -55,16 +52,16 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
55
52
|
children: /*#__PURE__*/React.createElement(Fragment, null, iconBefore && /*#__PURE__*/React.createElement(Content, {
|
|
56
53
|
type: "icon",
|
|
57
54
|
position: "before",
|
|
58
|
-
|
|
55
|
+
isLoading: isLoading
|
|
59
56
|
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
60
57
|
icon: iconBefore,
|
|
61
58
|
size: UNSAFE_iconBefore_size
|
|
62
59
|
})), children && /*#__PURE__*/React.createElement(Content, {
|
|
63
|
-
|
|
60
|
+
isLoading: isLoading
|
|
64
61
|
}, children), iconAfter && /*#__PURE__*/React.createElement(Content, {
|
|
65
62
|
type: "icon",
|
|
66
63
|
position: "after",
|
|
67
|
-
|
|
64
|
+
isLoading: isLoading
|
|
68
65
|
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
69
66
|
icon: iconAfter,
|
|
70
67
|
size: UNSAFE_iconAfter_size
|
|
@@ -83,16 +80,10 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
83
80
|
onPointerDownCapture: onPointerDownCapture,
|
|
84
81
|
onPointerUpCapture: onPointerUpCapture,
|
|
85
82
|
onClickCapture: onClickCapture,
|
|
86
|
-
overlay: isLoading ? renderLoadingOverlay({
|
|
87
|
-
spacing: spacing,
|
|
88
|
-
appearance: appearance,
|
|
89
|
-
isDisabled: isDisabled,
|
|
90
|
-
isSelected: isSelected,
|
|
91
|
-
testId: testId
|
|
92
|
-
}) : overlay,
|
|
93
83
|
ref: ref,
|
|
94
84
|
shouldFitContainer: shouldFitContainer,
|
|
95
85
|
spacing: spacing,
|
|
86
|
+
testId: testId,
|
|
96
87
|
hasIconBefore: Boolean(iconBefore),
|
|
97
88
|
hasIconAfter: Boolean(iconAfter)
|
|
98
89
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["aria-label", "aria-labelledby", "analyticsContext", "appearance", "autoFocus", "icon", "interactionName", "isDisabled", "isLoading", "isSelected", "isTooltipDisabled", "label", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "
|
|
3
|
+
var _excluded = ["aria-label", "aria-labelledby", "analyticsContext", "appearance", "autoFocus", "icon", "interactionName", "isDisabled", "isLoading", "isSelected", "isTooltipDisabled", "label", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "shape", "spacing", "testId", "tooltip", "type", "UNSAFE_size"],
|
|
4
4
|
_excluded2 = ["className", "css", "as", "style"];
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -40,7 +40,6 @@ var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
40
40
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
41
41
|
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
42
42
|
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
43
|
-
overlay = _ref.overlay,
|
|
44
43
|
shape = _ref.shape,
|
|
45
44
|
spacing = _ref.spacing,
|
|
46
45
|
testId = _ref.testId,
|
|
@@ -83,7 +82,6 @@ var IconButton = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
83
82
|
onPointerUpCapture: onPointerUpCapture,
|
|
84
83
|
onTouchEndCapture: onTouchEndCapture,
|
|
85
84
|
onTouchStartCapture: onTouchStartCapture,
|
|
86
|
-
overlay: overlay,
|
|
87
85
|
ref: ref,
|
|
88
86
|
shape: shape,
|
|
89
87
|
spacing: spacing,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["aria-label", "aria-labelledby", "analyticsContext", "appearance", "autoFocus", "href", "icon", "interactionName", "isDisabled", "isSelected", "isTooltipDisabled", "label", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "
|
|
3
|
+
var _excluded = ["aria-label", "aria-labelledby", "analyticsContext", "appearance", "autoFocus", "href", "icon", "interactionName", "isDisabled", "isSelected", "isTooltipDisabled", "label", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "shape", "spacing", "testId", "tooltip", "UNSAFE_size"],
|
|
4
4
|
_excluded2 = ["className", "css", "as", "style"];
|
|
5
5
|
import React, { forwardRef, memo } from 'react';
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -31,7 +31,6 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
31
31
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
32
32
|
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
33
33
|
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
34
|
-
overlay = _ref.overlay,
|
|
35
34
|
shape = _ref.shape,
|
|
36
35
|
spacing = _ref.spacing,
|
|
37
36
|
testId = _ref.testId,
|
|
@@ -66,7 +65,6 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
66
65
|
onPointerUpCapture: onPointerUpCapture,
|
|
67
66
|
onTouchEndCapture: onTouchEndCapture,
|
|
68
67
|
onTouchStartCapture: onTouchStartCapture,
|
|
69
|
-
overlay: overlay,
|
|
70
68
|
ref: ref,
|
|
71
69
|
shape: shape,
|
|
72
70
|
spacing: spacing,
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
3
3
|
import Content from '../shared/content';
|
|
4
4
|
import IconRenderer from '../shared/icon-renderer';
|
|
5
|
-
import renderLoadingOverlay from '../shared/loading-overlay';
|
|
6
5
|
import useButtonBase from '../shared/use-button-base';
|
|
7
6
|
/**
|
|
8
7
|
* __Use icon button__
|
|
@@ -23,7 +22,8 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
23
22
|
icon = _ref.icon,
|
|
24
23
|
interactionName = _ref.interactionName,
|
|
25
24
|
isDisabled = _ref.isDisabled,
|
|
26
|
-
isLoading = _ref.isLoading,
|
|
25
|
+
_ref$isLoading = _ref.isLoading,
|
|
26
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
27
27
|
isSelected = _ref.isSelected,
|
|
28
28
|
label = _ref.label,
|
|
29
29
|
onClick = _ref.onClick,
|
|
@@ -36,14 +36,12 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
36
36
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
37
37
|
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
38
38
|
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
39
|
-
overlay = _ref.overlay,
|
|
40
39
|
ref = _ref.ref,
|
|
41
40
|
shape = _ref.shape,
|
|
42
41
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
43
42
|
spacing = _ref.spacing,
|
|
44
43
|
testId = _ref.testId,
|
|
45
44
|
UNSAFE_size = _ref.UNSAFE_size;
|
|
46
|
-
var hasOverlay = Boolean(overlay || isLoading);
|
|
47
45
|
var isCircle = shape === 'circle';
|
|
48
46
|
var baseProps = useButtonBase({
|
|
49
47
|
analyticsContext: analyticsContext,
|
|
@@ -54,7 +52,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
54
52
|
buttonType: buttonType,
|
|
55
53
|
children: /*#__PURE__*/React.createElement(Content, {
|
|
56
54
|
type: "icon",
|
|
57
|
-
|
|
55
|
+
isLoading: isLoading
|
|
58
56
|
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
59
57
|
icon: icon,
|
|
60
58
|
size: UNSAFE_size
|
|
@@ -75,16 +73,10 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
75
73
|
onPointerDownCapture: onPointerDownCapture,
|
|
76
74
|
onPointerUpCapture: onPointerUpCapture,
|
|
77
75
|
onClickCapture: onClickCapture,
|
|
78
|
-
overlay: isLoading ? renderLoadingOverlay({
|
|
79
|
-
spacing: spacing,
|
|
80
|
-
appearance: appearance,
|
|
81
|
-
isDisabled: isDisabled,
|
|
82
|
-
isSelected: isSelected,
|
|
83
|
-
testId: testId
|
|
84
|
-
}) : overlay,
|
|
85
76
|
ref: ref,
|
|
86
77
|
shouldFitContainer: shouldFitContainer,
|
|
87
|
-
spacing: spacing
|
|
78
|
+
spacing: spacing,
|
|
79
|
+
testId: testId
|
|
88
80
|
});
|
|
89
81
|
return baseProps;
|
|
90
82
|
};
|
|
@@ -56,11 +56,11 @@ var Content = function Content(_ref) {
|
|
|
56
56
|
var children = _ref.children,
|
|
57
57
|
_ref$type = _ref.type,
|
|
58
58
|
type = _ref$type === void 0 ? 'text' : _ref$type,
|
|
59
|
-
|
|
59
|
+
isLoading = _ref.isLoading,
|
|
60
60
|
position = _ref.position;
|
|
61
61
|
return /*#__PURE__*/React.createElement(Box, {
|
|
62
62
|
as: "span",
|
|
63
|
-
xcss: [commonStyles].concat(_toConsumableArray(type === 'text' ? [textStyles] : [iconStyles]), _toConsumableArray(
|
|
63
|
+
xcss: [commonStyles].concat(_toConsumableArray(type === 'text' ? [textStyles] : [iconStyles]), _toConsumableArray(isLoading ? [fadeStyles] : []), _toConsumableArray(position === 'before' ? [beforeIconStyles] : []), _toConsumableArray(position === 'after' ? [afterIconStyles] : []))
|
|
64
64
|
}, children);
|
|
65
65
|
};
|
|
66
66
|
export default Content;
|
|
@@ -12,6 +12,7 @@ import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
|
12
12
|
import { useSplitButtonContext } from '../../containers/split-button/split-button-context';
|
|
13
13
|
import blockEvents from './block-events';
|
|
14
14
|
import { LOADING_LABEL } from './constants';
|
|
15
|
+
import renderLoadingOverlay from './loading-overlay';
|
|
15
16
|
var buttonStyles = xcss({
|
|
16
17
|
display: 'inline-flex',
|
|
17
18
|
boxSizing: 'border-box',
|
|
@@ -284,6 +285,7 @@ var linkDecorationStyles = xcss({
|
|
|
284
285
|
}
|
|
285
286
|
});
|
|
286
287
|
var disabledStyles = xcss({
|
|
288
|
+
cursor: 'not-allowed',
|
|
287
289
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
288
290
|
background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
|
|
289
291
|
// @ts-expect-error
|
|
@@ -439,12 +441,9 @@ var circleStyles = xcss({
|
|
|
439
441
|
var fullWidthStyles = xcss({
|
|
440
442
|
width: '100%'
|
|
441
443
|
});
|
|
442
|
-
var
|
|
444
|
+
var loadingStyles = xcss({
|
|
443
445
|
cursor: 'progress'
|
|
444
446
|
});
|
|
445
|
-
var nonInteractiveStyles = xcss({
|
|
446
|
-
cursor: 'not-allowed'
|
|
447
|
-
});
|
|
448
447
|
var iconButtonStyles = xcss({
|
|
449
448
|
height: "".concat(32 / 14, "em"),
|
|
450
449
|
width: "".concat(32 / 14, "em"),
|
|
@@ -472,7 +471,7 @@ var navigationSplitButtonStyles = xcss({
|
|
|
472
471
|
paddingInlineEnd: 'space.075',
|
|
473
472
|
paddingInlineStart: 'space.075'
|
|
474
473
|
});
|
|
475
|
-
var
|
|
474
|
+
var loadingOverlayStyles = xcss({
|
|
476
475
|
display: 'flex',
|
|
477
476
|
position: 'absolute',
|
|
478
477
|
alignItems: 'center',
|
|
@@ -526,12 +525,12 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
526
525
|
onPointerDownCapture = _ref.onPointerDownCapture,
|
|
527
526
|
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
528
527
|
onClickCapture = _ref.onClickCapture,
|
|
529
|
-
overlay = _ref.overlay,
|
|
530
528
|
ref = _ref.ref,
|
|
531
529
|
_ref$shouldFitContain = _ref.shouldFitContainer,
|
|
532
530
|
shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
|
|
533
531
|
_ref$spacing = _ref.spacing,
|
|
534
532
|
propSpacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
|
|
533
|
+
testId = _ref.testId,
|
|
535
534
|
ariaLabel = _ref.ariaLabel,
|
|
536
535
|
ariaLabelledBy = _ref.ariaLabelledBy;
|
|
537
536
|
var localRef = useRef(null);
|
|
@@ -547,9 +546,9 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
547
546
|
var appearance = getBooleanFF('platform.design-system-team.component-visual-refresh_t8zbo') && isDefaultAppearanceSplitButton ? 'subtle' : (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
|
|
548
547
|
var spacing = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.spacing) || propSpacing;
|
|
549
548
|
var isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
|
|
550
|
-
var
|
|
551
|
-
|
|
552
|
-
var isEffectivelyDisabled = isDisabled ||
|
|
549
|
+
var isInteractive = !isDisabled && !isLoading;
|
|
550
|
+
// Also treat loading buttons as disabled
|
|
551
|
+
var isEffectivelyDisabled = isDisabled || isLoading;
|
|
553
552
|
var isSelected = propIsSelected && !isDisabled;
|
|
554
553
|
useAutoFocus(localRef, autoFocus);
|
|
555
554
|
return _objectSpread({
|
|
@@ -560,15 +559,20 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
560
559
|
// TODO: remove me once we kill color fallbacks
|
|
561
560
|
isSelected && appearance === 'warning' && selectedWarningStyles,
|
|
562
561
|
// TODO: remove me once we kill color fallbacks
|
|
563
|
-
isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, spacing === 'compact' && (getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedSpacingCompactStyles : baseSpacingCompactStyles), spacing === 'none' && spacingNoneStyles, spacing === 'none' && getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') && tokenizedSpacingNoneStyles, spacing !== 'none' && hasIconBefore && buttonIconBeforeStyles, spacing !== 'none' && hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading &&
|
|
564
|
-
// Consider overlay buttons to be effectively disabled
|
|
562
|
+
isSelected && appearance === 'discovery' && selectedDiscoveryStyles, isDisabled && disabledStyles, isCircle && !isSplitButton && circleStyles, spacing === 'compact' && spacingCompactStyles, spacing === 'compact' && (getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') ? tokenizedSpacingCompactStyles : baseSpacingCompactStyles), spacing === 'none' && spacingNoneStyles, spacing === 'none' && getBooleanFF('platform.design-system-team.button-tokenised-typography-styles') && tokenizedSpacingNoneStyles, spacing !== 'none' && hasIconBefore && buttonIconBeforeStyles, spacing !== 'none' && hasIconAfter && buttonIconAfterStyles, isIconButton && iconButtonStyles, isIconButton && spacing === 'compact' && iconButtonCompactStyles, shouldFitContainer && fullWidthStyles, isLoading && loadingStyles, isSplitButton && splitButtonStyles, isNavigationSplitButton && navigationSplitButtonStyles],
|
|
565
563
|
isDisabled: isEffectivelyDisabled,
|
|
566
|
-
children: /*#__PURE__*/React.createElement(Fragment, null, children,
|
|
564
|
+
children: /*#__PURE__*/React.createElement(Fragment, null, children, isLoading ? /*#__PURE__*/React.createElement(Box, {
|
|
567
565
|
as: "span",
|
|
568
|
-
xcss:
|
|
569
|
-
},
|
|
566
|
+
xcss: loadingOverlayStyles
|
|
567
|
+
}, renderLoadingOverlay({
|
|
568
|
+
spacing: spacing,
|
|
569
|
+
appearance: appearance,
|
|
570
|
+
isDisabled: isDisabled,
|
|
571
|
+
isSelected: isSelected,
|
|
572
|
+
testId: testId
|
|
573
|
+
})) : null, isLoading && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
570
574
|
id: loadingLabelId
|
|
571
|
-
},
|
|
575
|
+
}, LOADING_LABEL)),
|
|
572
576
|
'aria-label': isLoading && ariaLabel && !ariaLabelledBy ? "".concat(ariaLabel, " ").concat(LOADING_LABEL) : ariaLabel,
|
|
573
577
|
'aria-labelledby': isLoading && ariaLabelledBy ? "".concat(ariaLabelledBy, " ").concat(loadingLabelId) : ariaLabelledBy
|
|
574
578
|
}, blockEvents(isEffectivelyDisabled, {
|
|
@@ -125,7 +125,7 @@ export default /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
|
|
|
125
125
|
action: 'clicked',
|
|
126
126
|
componentName: 'button',
|
|
127
127
|
packageName: "@atlaskit/button",
|
|
128
|
-
packageVersion: "
|
|
128
|
+
packageVersion: "18.0.1",
|
|
129
129
|
analyticsData: analyticsContext
|
|
130
130
|
});
|
|
131
131
|
|
|
@@ -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, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, autoFocus, children, href, iconAfter, iconBefore, interactionName, isDisabled, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture,
|
|
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, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, ...unsafeRest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Button__
|
|
8
8
|
*
|
|
@@ -12,5 +12,5 @@ type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>
|
|
|
12
12
|
*
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
|
-
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter, iconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture,
|
|
15
|
+
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter, iconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, ref, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
|
|
16
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, "aria-labelledby": ariaLabelledBy, analyticsContext, appearance, autoFocus, href, icon, interactionName, isDisabled, isSelected, isTooltipDisabled, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture,
|
|
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, shape, spacing, testId, tooltip, UNSAFE_size, ...unsafeRest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Icon Button__
|
|
8
8
|
*
|
|
@@ -12,5 +12,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
|
|
|
12
12
|
*
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
|
-
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture,
|
|
15
|
+
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, ref, shape, shouldFitContainer, spacing, testId, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
16
16
|
export default useIconButton;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
type ContentProps = {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
type?: 'text' | 'icon';
|
|
5
|
-
|
|
5
|
+
isLoading: boolean;
|
|
6
6
|
position?: 'before' | 'after';
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
@@ -10,5 +10,5 @@ type ContentProps = {
|
|
|
10
10
|
*
|
|
11
11
|
* Used for slots within a Button, including icons and text content.
|
|
12
12
|
*/
|
|
13
|
-
declare const Content: ({ children, type,
|
|
13
|
+
declare const Content: ({ children, type, isLoading, position }: ContentProps) => JSX.Element;
|
|
14
14
|
export default Content;
|
|
@@ -19,7 +19,7 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
19
19
|
isLoading?: boolean;
|
|
20
20
|
ariaLabel?: string;
|
|
21
21
|
ariaLabelledBy?: string;
|
|
22
|
-
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | '
|
|
22
|
+
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'testId'> & ControlledEvents<TagName>;
|
|
23
23
|
type XCSS = ReturnType<typeof xcss>;
|
|
24
24
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
25
25
|
xcss: XCSS | Array<XCSS | false | undefined>;
|
|
@@ -42,5 +42,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
|
42
42
|
*
|
|
43
43
|
* @private
|
|
44
44
|
*/
|
|
45
|
-
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected: propIsSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture,
|
|
45
|
+
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected: propIsSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, ref, shouldFitContainer, spacing: propSpacing, testId, ariaLabel, ariaLabelledBy, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
46
46
|
export default useButtonBase;
|
|
@@ -16,12 +16,6 @@ export type CommonButtonProps<TagName extends HTMLElement> = {
|
|
|
16
16
|
* Set the button to autofocus on mount.
|
|
17
17
|
*/
|
|
18
18
|
autoFocus?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated This is no longer supported and will be removed in a future major release. It only existed to support loading spinners, which can now be achieved with the `isLoading` prop.
|
|
21
|
-
*
|
|
22
|
-
* Used to 'overlay' something over a button. This is commonly used to display a loading spinner.
|
|
23
|
-
*/
|
|
24
|
-
overlay?: React.ReactNode;
|
|
25
19
|
/**
|
|
26
20
|
* Disable the button to prevent user interaction.
|
|
27
21
|
*/
|
|
@@ -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, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, autoFocus, children, href, iconAfter, iconBefore, interactionName, isDisabled, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture,
|
|
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, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, ...unsafeRest }: LinkButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Button__
|
|
8
8
|
*
|
|
@@ -12,5 +12,5 @@ type UseButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagName>
|
|
|
12
12
|
*
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
|
-
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter, iconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture,
|
|
15
|
+
declare const useDefaultButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, children, iconAfter, iconBefore, interactionName, isDisabled, isLoading, isSelected, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, ref, shouldFitContainer, spacing, testId, UNSAFE_iconAfter_size, UNSAFE_iconBefore_size, }: UseDefaultButtonArgs<TagName>) => UseButtonReturn<TagName>;
|
|
16
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, "aria-labelledby": ariaLabelledBy, analyticsContext, appearance, autoFocus, href, icon, interactionName, isDisabled, isSelected, isTooltipDisabled, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture,
|
|
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, shape, spacing, testId, tooltip, UNSAFE_size, ...unsafeRest }: LinkIconButtonProps<RouterLinkConfig>, ref: Ref<HTMLAnchorElement>) => JSX.Element;
|
|
6
6
|
/**
|
|
7
7
|
* __Link Icon Button__
|
|
8
8
|
*
|
|
@@ -12,5 +12,5 @@ type UseIconButtonReturn<TagName extends HTMLElement> = UseButtonBaseReturn<TagN
|
|
|
12
12
|
*
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
|
-
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture,
|
|
15
|
+
declare const useIconButton: <TagName extends HTMLElement>({ analyticsContext, appearance, ariaLabel, ariaLabelledBy, autoFocus, buttonType, icon, interactionName, isDisabled, isLoading, isSelected, label, onClick, onClickCapture, onKeyDownCapture, onKeyUpCapture, onMouseDownCapture, onMouseUpCapture, onPointerDownCapture, onPointerUpCapture, onTouchEndCapture, onTouchStartCapture, ref, shape, shouldFitContainer, spacing, testId, UNSAFE_size, }: UseIconButtonArgs<TagName>) => UseIconButtonReturn<TagName>;
|
|
16
16
|
export default useIconButton;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
type ContentProps = {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
type?: 'text' | 'icon';
|
|
5
|
-
|
|
5
|
+
isLoading: boolean;
|
|
6
6
|
position?: 'before' | 'after';
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
@@ -10,5 +10,5 @@ type ContentProps = {
|
|
|
10
10
|
*
|
|
11
11
|
* Used for slots within a Button, including icons and text content.
|
|
12
12
|
*/
|
|
13
|
-
declare const Content: ({ children, type,
|
|
13
|
+
declare const Content: ({ children, type, isLoading, position }: ContentProps) => JSX.Element;
|
|
14
14
|
export default Content;
|
|
@@ -19,7 +19,7 @@ export type UseButtonBaseArgs<TagName extends HTMLElement> = {
|
|
|
19
19
|
isLoading?: boolean;
|
|
20
20
|
ariaLabel?: string;
|
|
21
21
|
ariaLabelledBy?: string;
|
|
22
|
-
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | '
|
|
22
|
+
} & Pick<CommonButtonProps<TagName>, 'analyticsContext' | 'autoFocus' | 'interactionName' | 'isDisabled' | 'isSelected' | 'testId'> & ControlledEvents<TagName>;
|
|
23
23
|
type XCSS = ReturnType<typeof xcss>;
|
|
24
24
|
export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
25
25
|
xcss: XCSS | Array<XCSS | false | undefined>;
|
|
@@ -42,5 +42,5 @@ export type UseButtonBaseReturn<TagName extends HTMLElement> = {
|
|
|
42
42
|
*
|
|
43
43
|
* @private
|
|
44
44
|
*/
|
|
45
|
-
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected: propIsSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture,
|
|
45
|
+
declare const useButtonBase: <TagName extends HTMLElement>({ appearance: propAppearance, autoFocus, isDisabled: propIsDisabled, isLoading, isSelected: propIsSelected, isIconButton, isCircle, hasIconBefore, hasIconAfter, children, onClick, onMouseDownCapture, onMouseUpCapture, onKeyDownCapture, onKeyUpCapture, onTouchStartCapture, onTouchEndCapture, onPointerDownCapture, onPointerUpCapture, onClickCapture, ref, shouldFitContainer, spacing: propSpacing, testId, ariaLabel, ariaLabelledBy, }: UseButtonBaseArgs<TagName>) => UseButtonBaseReturn<TagName>;
|
|
46
46
|
export default useButtonBase;
|