@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 17.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#111486](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111486)
|
|
8
|
+
[`f848f651ef678`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f848f651ef678) - ###
|
|
9
|
+
Accessibility improvement
|
|
10
|
+
|
|
11
|
+
New buttons now adds ", Loading" to the accessible name of loading buttons regardless of how they
|
|
12
|
+
are labelled. This supports labelling by text content (`children`), `aria-label`, and
|
|
13
|
+
`aria-labelledby`.
|
|
14
|
+
|
|
15
|
+
The ", Loading" label was previously part of the loading spinner `<svg>`, which has been relocated
|
|
16
|
+
because this does not support `aria-label` or `aria-labelledby`. Any test locators for loading
|
|
17
|
+
buttons may need to be updated.
|
|
18
|
+
|
|
19
|
+
The most robust way to find loading buttons is by role and accessible name. This accounts for
|
|
20
|
+
label precedence. For example:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
screen.findByRole("button", {
|
|
24
|
+
name: /, Loading/,
|
|
25
|
+
})
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
To validate a loading button that is already located, use `toHaveAccessibleName()`:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
render(<Button testId="foo" isLoading>My label</Button>);
|
|
32
|
+
|
|
33
|
+
const button = screen.getByTestId("foo");
|
|
34
|
+
expect(button).toHaveAccessibleName(`My label , Loading`);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
For locating loading spinners, a test ID has been added that is based on the button `testId`. For
|
|
38
|
+
example:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
render(<Button isLoading testId="bar">My label</Button>);
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
const spinner = screen.getByTestId("bar--loading-spinner-wrapper");
|
|
45
|
+
expect(spinner).toBeInTheDocument();
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
|
|
3
49
|
## 17.17.3
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
|
@@ -11,10 +11,12 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
11
11
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
12
|
/** @jsx jsx */
|
|
13
13
|
|
|
14
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
|
+
|
|
14
16
|
var buttonGroupStyles = (0, _react2.css)({
|
|
15
17
|
display: 'inline-flex',
|
|
16
18
|
gap: "var(--ds-space-050, 4px)",
|
|
17
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
19
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
18
20
|
'> *': {
|
|
19
21
|
flex: '1 0 auto'
|
|
20
22
|
}
|
|
@@ -10,6 +10,8 @@ var _splitButtonContext = require("./split-button-context");
|
|
|
10
10
|
var _utils = require("./utils");
|
|
11
11
|
/** @jsx jsx */
|
|
12
12
|
|
|
13
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
14
|
+
|
|
13
15
|
var fontSize = (0, _constants.fontSize)();
|
|
14
16
|
var heights = {
|
|
15
17
|
default: "".concat(32 / fontSize, "em"),
|
|
@@ -23,9 +25,11 @@ var baseDividerStyles = (0, _react.css)({
|
|
|
23
25
|
zIndex: 2
|
|
24
26
|
});
|
|
25
27
|
var defaultDividerStyles = (0, _react.css)({
|
|
28
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
26
29
|
height: heights.default
|
|
27
30
|
});
|
|
28
31
|
var compactDividerStyles = (0, _react.css)({
|
|
32
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
29
33
|
height: heights.compact
|
|
30
34
|
});
|
|
31
35
|
var dividerDisabledStyles = (0, _react.css)({
|
|
@@ -75,14 +79,14 @@ var splitButtonStyles = (0, _react.css)({
|
|
|
75
79
|
whiteSpace: 'nowrap'
|
|
76
80
|
});
|
|
77
81
|
var primaryButtonStyles = (0, _react.css)({
|
|
78
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
82
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
79
83
|
'button,a': {
|
|
80
84
|
borderEndEndRadius: 0,
|
|
81
85
|
borderStartEndRadius: 0
|
|
82
86
|
}
|
|
83
87
|
});
|
|
84
88
|
var secondaryButtonStyles = (0, _react.css)({
|
|
85
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
89
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
86
90
|
'button,a': {
|
|
87
91
|
borderEndStartRadius: 0,
|
|
88
92
|
borderStartStartRadius: 0
|
|
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
|
|
12
12
|
var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
|
|
13
|
-
var _excluded = ["analyticsContext", "appearance", "autoFocus", "children", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isLoading", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "overlay", "shouldFitContainer", "spacing", "testId", "type", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"];
|
|
13
|
+
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", "overlay", "shouldFitContainer", "spacing", "testId", "type", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"];
|
|
14
14
|
/**
|
|
15
15
|
* __Button__
|
|
16
16
|
*
|
|
@@ -23,6 +23,8 @@ var _excluded = ["analyticsContext", "appearance", "autoFocus", "children", "ico
|
|
|
23
23
|
var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function Button(_ref, ref) {
|
|
24
24
|
var analyticsContext = _ref.analyticsContext,
|
|
25
25
|
appearance = _ref.appearance,
|
|
26
|
+
ariaLabel = _ref['aria-label'],
|
|
27
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
26
28
|
autoFocus = _ref.autoFocus,
|
|
27
29
|
children = _ref.children,
|
|
28
30
|
iconAfter = _ref.iconAfter,
|
|
@@ -51,6 +53,8 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
51
53
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
|
|
52
54
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
53
55
|
var baseProps = (0, _useDefaultButton.default)({
|
|
56
|
+
ariaLabel: ariaLabel,
|
|
57
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
54
58
|
analyticsContext: analyticsContext,
|
|
55
59
|
appearance: appearance,
|
|
56
60
|
autoFocus: autoFocus,
|
|
@@ -76,12 +80,15 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
76
80
|
ref: ref,
|
|
77
81
|
shouldFitContainer: shouldFitContainer,
|
|
78
82
|
spacing: spacing,
|
|
83
|
+
testId: testId,
|
|
79
84
|
UNSAFE_iconAfter_size: UNSAFE_iconAfter_size,
|
|
80
85
|
UNSAFE_iconBefore_size: UNSAFE_iconBefore_size
|
|
81
86
|
});
|
|
82
87
|
return /*#__PURE__*/_react.default.createElement(_pressable.default
|
|
83
88
|
// TODO: Remove spread props
|
|
84
89
|
, (0, _extends2.default)({}, rest, {
|
|
90
|
+
"aria-label": baseProps['aria-label'],
|
|
91
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
85
92
|
ref: baseProps.ref,
|
|
86
93
|
xcss: baseProps.xcss,
|
|
87
94
|
isDisabled: baseProps.isDisabled,
|
|
@@ -11,12 +11,14 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _anchor = _interopRequireDefault(require("@atlaskit/primitives/anchor"));
|
|
13
13
|
var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
|
|
14
|
-
var _excluded = ["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"];
|
|
14
|
+
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", "overlay", "shouldFitContainer", "spacing", "testId", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"];
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
17
|
var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
18
18
|
var analyticsContext = _ref.analyticsContext,
|
|
19
19
|
appearance = _ref.appearance,
|
|
20
|
+
ariaLabel = _ref['aria-label'],
|
|
21
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
20
22
|
autoFocus = _ref.autoFocus,
|
|
21
23
|
children = _ref.children,
|
|
22
24
|
href = _ref.href,
|
|
@@ -43,6 +45,8 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
43
45
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
|
|
44
46
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
45
47
|
var baseProps = (0, _useDefaultButton.default)({
|
|
48
|
+
ariaLabel: ariaLabel,
|
|
49
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
46
50
|
analyticsContext: analyticsContext,
|
|
47
51
|
appearance: appearance,
|
|
48
52
|
autoFocus: autoFocus,
|
|
@@ -67,12 +71,15 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
67
71
|
ref: ref,
|
|
68
72
|
shouldFitContainer: shouldFitContainer,
|
|
69
73
|
spacing: spacing,
|
|
74
|
+
testId: testId,
|
|
70
75
|
UNSAFE_iconAfter_size: UNSAFE_iconAfter_size,
|
|
71
76
|
UNSAFE_iconBefore_size: UNSAFE_iconBefore_size
|
|
72
77
|
});
|
|
73
78
|
return /*#__PURE__*/_react.default.createElement(_anchor.default
|
|
74
79
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
75
80
|
, (0, _extends2.default)({}, rest, {
|
|
81
|
+
"aria-label": baseProps['aria-label'],
|
|
82
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
76
83
|
ref: baseProps.ref,
|
|
77
84
|
xcss: baseProps.xcss,
|
|
78
85
|
onClick: baseProps.onClick,
|
|
@@ -24,6 +24,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
24
24
|
var useDefaultButton = function useDefaultButton(_ref) {
|
|
25
25
|
var analyticsContext = _ref.analyticsContext,
|
|
26
26
|
appearance = _ref.appearance,
|
|
27
|
+
ariaLabel = _ref.ariaLabel,
|
|
28
|
+
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
27
29
|
autoFocus = _ref.autoFocus,
|
|
28
30
|
buttonType = _ref.buttonType,
|
|
29
31
|
children = _ref.children,
|
|
@@ -48,6 +50,7 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
48
50
|
ref = _ref.ref,
|
|
49
51
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
50
52
|
spacing = _ref.spacing,
|
|
53
|
+
testId = _ref.testId,
|
|
51
54
|
UNSAFE_iconAfter_size = _ref.UNSAFE_iconAfter_size,
|
|
52
55
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size;
|
|
53
56
|
var hasOverlay = Boolean(overlay || isLoading);
|
|
@@ -55,6 +58,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
55
58
|
analyticsContext: analyticsContext,
|
|
56
59
|
appearance: appearance,
|
|
57
60
|
autoFocus: autoFocus,
|
|
61
|
+
ariaLabel: ariaLabel,
|
|
62
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
58
63
|
buttonType: buttonType,
|
|
59
64
|
children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, IconBefore && /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
60
65
|
type: "icon",
|
|
@@ -93,7 +98,8 @@ var useDefaultButton = function useDefaultButton(_ref) {
|
|
|
93
98
|
spacing: spacing,
|
|
94
99
|
appearance: appearance,
|
|
95
100
|
isDisabled: isDisabled,
|
|
96
|
-
isSelected: isSelected
|
|
101
|
+
isSelected: isSelected,
|
|
102
|
+
testId: testId
|
|
97
103
|
}) : overlay,
|
|
98
104
|
ref: ref,
|
|
99
105
|
shouldFitContainer: shouldFitContainer,
|
|
@@ -11,7 +11,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
|
|
12
12
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
13
13
|
var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
|
|
14
|
-
var _excluded = ["aria-label", "analyticsContext", "appearance", "autoFocus", "icon", "interactionName", "isDisabled", "isLoading", "isSelected", "isTooltipDisabled", "label", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "overlay", "shape", "spacing", "testId", "tooltip", "type", "UNSAFE_size"];
|
|
14
|
+
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", "overlay", "shape", "spacing", "testId", "tooltip", "type", "UNSAFE_size"];
|
|
15
15
|
/**
|
|
16
16
|
* __Icon Button__
|
|
17
17
|
*
|
|
@@ -23,6 +23,7 @@ var _excluded = ["aria-label", "analyticsContext", "appearance", "autoFocus", "i
|
|
|
23
23
|
*/
|
|
24
24
|
var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function Button(_ref, ref) {
|
|
25
25
|
var preventedAriaLabel = _ref['aria-label'],
|
|
26
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
26
27
|
analyticsContext = _ref.analyticsContext,
|
|
27
28
|
appearance = _ref.appearance,
|
|
28
29
|
autoFocus = _ref.autoFocus,
|
|
@@ -60,6 +61,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
60
61
|
var baseProps = (0, _useIconButton.default)({
|
|
61
62
|
analyticsContext: analyticsContext,
|
|
62
63
|
appearance: appearance,
|
|
64
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
63
65
|
autoFocus: autoFocus,
|
|
64
66
|
buttonType: 'button',
|
|
65
67
|
icon: icon,
|
|
@@ -82,6 +84,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
82
84
|
ref: ref,
|
|
83
85
|
shape: shape,
|
|
84
86
|
spacing: spacing,
|
|
87
|
+
testId: testId,
|
|
85
88
|
UNSAFE_size: UNSAFE_size
|
|
86
89
|
});
|
|
87
90
|
if (!isTooltipDisabled) {
|
|
@@ -105,6 +108,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
105
108
|
return /*#__PURE__*/_react.default.createElement(_pressable.default
|
|
106
109
|
// Top level props
|
|
107
110
|
, (0, _extends2.default)({}, rest, {
|
|
111
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
108
112
|
type: type,
|
|
109
113
|
testId: testId,
|
|
110
114
|
componentName: "IconButton",
|
|
@@ -171,6 +175,7 @@ var IconButton = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.f
|
|
|
171
175
|
});
|
|
172
176
|
}
|
|
173
177
|
return /*#__PURE__*/_react.default.createElement(_pressable.default, (0, _extends2.default)({}, rest, {
|
|
178
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
174
179
|
ref: baseProps.ref,
|
|
175
180
|
xcss: baseProps.xcss,
|
|
176
181
|
isDisabled: baseProps.isDisabled,
|
|
@@ -12,11 +12,12 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _anchor = _interopRequireDefault(require("@atlaskit/primitives/anchor"));
|
|
13
13
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
14
14
|
var _useIconButton = _interopRequireDefault(require("./use-icon-button"));
|
|
15
|
-
var _excluded = ["aria-label", "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"];
|
|
15
|
+
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", "overlay", "shape", "spacing", "testId", "tooltip", "UNSAFE_size"];
|
|
16
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
19
19
|
var preventedAriaLabel = _ref['aria-label'],
|
|
20
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
20
21
|
analyticsContext = _ref.analyticsContext,
|
|
21
22
|
appearance = _ref.appearance,
|
|
22
23
|
autoFocus = _ref.autoFocus,
|
|
@@ -48,6 +49,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
48
49
|
var baseProps = (0, _useIconButton.default)({
|
|
49
50
|
analyticsContext: analyticsContext,
|
|
50
51
|
appearance: appearance,
|
|
52
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
51
53
|
autoFocus: autoFocus,
|
|
52
54
|
buttonType: 'link',
|
|
53
55
|
icon: icon,
|
|
@@ -69,6 +71,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
69
71
|
ref: ref,
|
|
70
72
|
shape: shape,
|
|
71
73
|
spacing: spacing,
|
|
74
|
+
testId: testId,
|
|
72
75
|
UNSAFE_size: UNSAFE_size
|
|
73
76
|
});
|
|
74
77
|
if (!isTooltipDisabled) {
|
|
@@ -92,6 +95,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
92
95
|
return /*#__PURE__*/_react.default.createElement(_anchor.default
|
|
93
96
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
94
97
|
, (0, _extends2.default)({}, rest, {
|
|
98
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
95
99
|
testId: testId,
|
|
96
100
|
componentName: "LinkIconButton",
|
|
97
101
|
analyticsContext: analyticsContext,
|
|
@@ -167,6 +171,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
167
171
|
return /*#__PURE__*/_react.default.createElement(_anchor.default
|
|
168
172
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
169
173
|
, (0, _extends2.default)({}, rest, {
|
|
174
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
170
175
|
ref: baseProps.ref,
|
|
171
176
|
xcss: baseProps.xcss,
|
|
172
177
|
onClick: baseProps.onClick,
|
|
@@ -22,6 +22,8 @@ var _useButtonBase = _interopRequireDefault(require("../shared/use-button-base")
|
|
|
22
22
|
var useIconButton = function useIconButton(_ref) {
|
|
23
23
|
var analyticsContext = _ref.analyticsContext,
|
|
24
24
|
appearance = _ref.appearance,
|
|
25
|
+
ariaLabel = _ref.ariaLabel,
|
|
26
|
+
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
25
27
|
autoFocus = _ref.autoFocus,
|
|
26
28
|
buttonType = _ref.buttonType,
|
|
27
29
|
Icon = _ref.icon,
|
|
@@ -45,6 +47,7 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
45
47
|
shape = _ref.shape,
|
|
46
48
|
shouldFitContainer = _ref.shouldFitContainer,
|
|
47
49
|
spacing = _ref.spacing,
|
|
50
|
+
testId = _ref.testId,
|
|
48
51
|
UNSAFE_size = _ref.UNSAFE_size;
|
|
49
52
|
var hasOverlay = Boolean(overlay || isLoading);
|
|
50
53
|
var isCircle = shape === 'circle';
|
|
@@ -52,6 +55,8 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
52
55
|
analyticsContext: analyticsContext,
|
|
53
56
|
appearance: appearance,
|
|
54
57
|
autoFocus: autoFocus,
|
|
58
|
+
ariaLabel: ariaLabel,
|
|
59
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
55
60
|
buttonType: buttonType,
|
|
56
61
|
children: /*#__PURE__*/_react.default.createElement(_content.default, {
|
|
57
62
|
type: "icon",
|
|
@@ -81,7 +86,8 @@ var useIconButton = function useIconButton(_ref) {
|
|
|
81
86
|
spacing: spacing,
|
|
82
87
|
appearance: appearance,
|
|
83
88
|
isDisabled: isDisabled,
|
|
84
|
-
isSelected: isSelected
|
|
89
|
+
isSelected: isSelected,
|
|
90
|
+
testId: testId
|
|
85
91
|
}) : overlay,
|
|
86
92
|
ref: ref,
|
|
87
93
|
shouldFitContainer: shouldFitContainer,
|
|
@@ -33,14 +33,15 @@ function renderLoadingOverlay(_ref2) {
|
|
|
33
33
|
var appearance = _ref2.appearance,
|
|
34
34
|
spacing = _ref2.spacing,
|
|
35
35
|
isDisabled = _ref2.isDisabled,
|
|
36
|
-
isSelected = _ref2.isSelected
|
|
36
|
+
isSelected = _ref2.isSelected,
|
|
37
|
+
testId = _ref2.testId;
|
|
37
38
|
return /*#__PURE__*/_react.default.createElement(_spinner.default, {
|
|
38
|
-
label: ", Loading",
|
|
39
39
|
size: getIconSpacing(spacing),
|
|
40
40
|
appearance: getSpinnerAppearance({
|
|
41
41
|
appearance: appearance,
|
|
42
42
|
isDisabled: isDisabled,
|
|
43
43
|
isSelected: isSelected
|
|
44
|
-
})
|
|
44
|
+
}),
|
|
45
|
+
testId: testId ? "".concat(testId, "--loading-spinner") : undefined
|
|
45
46
|
});
|
|
46
47
|
}
|
|
@@ -8,14 +8,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _reactUid = require("react-uid");
|
|
11
12
|
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
12
13
|
var _useAutoFocus = _interopRequireDefault(require("@atlaskit/ds-lib/use-auto-focus"));
|
|
13
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _primitives = require("@atlaskit/primitives");
|
|
15
16
|
var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
|
|
16
17
|
var _constants = require("@atlaskit/theme/constants");
|
|
18
|
+
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
17
19
|
var _splitButtonContext = require("../../containers/split-button/split-button-context");
|
|
18
20
|
var _blockEvents = _interopRequireDefault(require("./block-events"));
|
|
21
|
+
var _constants2 = require("./constants");
|
|
19
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
24
|
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; }
|
|
@@ -30,10 +33,12 @@ var buttonStyles = (0, _primitives.xcss)({
|
|
|
30
33
|
alignItems: 'baseline',
|
|
31
34
|
justifyContent: 'center',
|
|
32
35
|
columnGap: 'space.050',
|
|
36
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
33
37
|
background: "var(--ds-background-neutral, ".concat(colors.N20A, ")"),
|
|
34
38
|
borderRadius: 'border.radius.100',
|
|
35
39
|
borderWidth: 'border.width.0',
|
|
36
40
|
// @ts-expect-error
|
|
41
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
37
42
|
color: "var(--ds-text, ".concat(colors.N500, ")"),
|
|
38
43
|
flexShrink: 0,
|
|
39
44
|
height: "".concat(32 / fontSize, "em"),
|
|
@@ -44,6 +49,7 @@ var buttonStyles = (0, _primitives.xcss)({
|
|
|
44
49
|
verticalAlign: 'middle',
|
|
45
50
|
':visited': {
|
|
46
51
|
// @ts-expect-error
|
|
52
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
47
53
|
color: "var(--ds-text, ".concat(colors.N500, ")")
|
|
48
54
|
}
|
|
49
55
|
});
|
|
@@ -64,12 +70,15 @@ var defaultInteractiveStyles = (0, _primitives.xcss)({
|
|
|
64
70
|
':hover': {
|
|
65
71
|
background: "var(--ds-background-neutral-hovered, #091e4214)",
|
|
66
72
|
// @ts-expect-error
|
|
73
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
67
74
|
color: "var(--ds-text, ".concat(colors.N500, ")"),
|
|
68
75
|
transitionDuration: '0s, 0.15s'
|
|
69
76
|
},
|
|
70
77
|
':active': {
|
|
78
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
71
79
|
background: "var(--ds-background-neutral-pressed, ".concat(colors.B75, ")"),
|
|
72
80
|
// @ts-expect-error
|
|
81
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
73
82
|
color: "var(--ds-text, ".concat(colors.B400, ")"),
|
|
74
83
|
transitionDuration: '0s, 0s'
|
|
75
84
|
}
|
|
@@ -173,11 +182,13 @@ var subtleInteractiveStyles = (0, _primitives.xcss)({
|
|
|
173
182
|
});
|
|
174
183
|
var linkStyles = (0, _primitives.xcss)({
|
|
175
184
|
// @ts-expect-error
|
|
185
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
176
186
|
color: "var(--ds-link, ".concat(colors.B400, ")"),
|
|
177
187
|
background: "var(--ds-background-neutral-subtle, transparent)",
|
|
178
188
|
textDecoration: 'none',
|
|
179
189
|
':hover': {
|
|
180
190
|
// @ts-expect-error
|
|
191
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
181
192
|
color: "var(--ds-link, ".concat(colors.B300, ")"),
|
|
182
193
|
background: "var(--ds-background-neutral-subtle, transparent)"
|
|
183
194
|
},
|
|
@@ -188,26 +199,31 @@ var linkStyles = (0, _primitives.xcss)({
|
|
|
188
199
|
},
|
|
189
200
|
':visited': {
|
|
190
201
|
// @ts-expect-error
|
|
202
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
191
203
|
color: "var(--ds-link, ".concat(colors.B400, ")")
|
|
192
204
|
}
|
|
193
205
|
});
|
|
194
206
|
var subtleLinkStyles = (0, _primitives.xcss)({
|
|
195
207
|
// @ts-expect-error
|
|
208
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
196
209
|
color: "var(--ds-text-subtle, ".concat(colors.N200, ")"),
|
|
197
210
|
background: "var(--ds-background-neutral-subtle, transparent)",
|
|
198
211
|
textDecoration: 'none',
|
|
199
212
|
':hover': {
|
|
200
213
|
// @ts-expect-error
|
|
214
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
201
215
|
color: "var(--ds-text-subtle, ".concat(colors.N90, ")"),
|
|
202
216
|
background: "var(--ds-background-neutral-subtle, transparent)"
|
|
203
217
|
},
|
|
204
218
|
':active': {
|
|
205
219
|
// @ts-expect-error
|
|
220
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
206
221
|
color: "var(--ds-text, ".concat(colors.N400, ")"),
|
|
207
222
|
background: "var(--ds-background-neutral-subtle, transparent)"
|
|
208
223
|
},
|
|
209
224
|
':visited': {
|
|
210
225
|
// @ts-expect-error
|
|
226
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
211
227
|
color: "var(--ds-text-subtle, ".concat(colors.N200, ")")
|
|
212
228
|
}
|
|
213
229
|
});
|
|
@@ -234,72 +250,94 @@ var linkDecorationStyles = (0, _primitives.xcss)({
|
|
|
234
250
|
}
|
|
235
251
|
});
|
|
236
252
|
var disabledStyles = (0, _primitives.xcss)({
|
|
253
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
237
254
|
background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
|
|
238
255
|
// @ts-expect-error
|
|
239
256
|
color: "var(--ds-text-disabled, #091E424F)",
|
|
240
257
|
':hover': {
|
|
258
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
241
259
|
background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
|
|
242
260
|
// @ts-expect-error
|
|
243
261
|
color: "var(--ds-text-disabled, #091E424F)"
|
|
244
262
|
},
|
|
245
263
|
':active': {
|
|
264
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
246
265
|
background: "var(--ds-background-disabled, ".concat(colors.N20A, ")"),
|
|
247
266
|
// @ts-expect-error
|
|
248
267
|
color: "var(--ds-text-disabled, #091E424F)"
|
|
249
268
|
}
|
|
250
269
|
});
|
|
251
270
|
var selectedStyles = (0, _primitives.xcss)({
|
|
271
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
252
272
|
background: "var(--ds-background-selected, ".concat(colors.N700, ")"),
|
|
253
273
|
// @ts-expect-error
|
|
274
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
254
275
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
255
276
|
':visited': {
|
|
256
277
|
// @ts-expect-error
|
|
278
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
257
279
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")")
|
|
258
280
|
}
|
|
259
281
|
});
|
|
260
282
|
var selectedInteractiveStyles = (0, _primitives.xcss)({
|
|
261
283
|
':hover': {
|
|
262
284
|
// @ts-expect-error
|
|
285
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
263
286
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
287
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
264
288
|
background: "var(--ds-background-selected-hovered, ".concat(colors.N700, ")")
|
|
265
289
|
},
|
|
266
290
|
':active': {
|
|
267
291
|
// @ts-expect-error
|
|
292
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
268
293
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
294
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
269
295
|
background: "var(--ds-background-selected-pressed, ".concat(colors.N700, ")")
|
|
270
296
|
}
|
|
271
297
|
});
|
|
272
298
|
|
|
273
299
|
// TODO: Remove me once we kill color fallbacks
|
|
274
300
|
var selectedWarningStyles = (0, _primitives.xcss)({
|
|
301
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
275
302
|
background: "var(--ds-background-selected, ".concat(colors.Y400, ")"),
|
|
276
303
|
// @ts-expect-error
|
|
304
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
277
305
|
color: "var(--ds-text-selected, ".concat(colors.N800, ")"),
|
|
278
306
|
':hover': {
|
|
279
307
|
// @ts-expect-error
|
|
308
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
280
309
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
310
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
281
311
|
background: "var(--ds-background-selected, ".concat(colors.Y400, ")")
|
|
282
312
|
},
|
|
283
313
|
':active': {
|
|
284
314
|
// @ts-expect-error
|
|
315
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
285
316
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
317
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
286
318
|
background: "var(--ds-background-selected, ".concat(colors.Y400, ")")
|
|
287
319
|
}
|
|
288
320
|
});
|
|
289
321
|
|
|
290
322
|
// TODO: Remove me once we kill color fallbacks
|
|
291
323
|
var selectedDangerStyles = (0, _primitives.xcss)({
|
|
324
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
292
325
|
background: "var(--ds-background-selected, ".concat(colors.R500, ")"),
|
|
293
326
|
// @ts-expect-error
|
|
327
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
294
328
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
295
329
|
':hover': {
|
|
296
330
|
// @ts-expect-error
|
|
331
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
297
332
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
333
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
298
334
|
background: "var(--ds-background-selected, ".concat(colors.R500, ")")
|
|
299
335
|
},
|
|
300
336
|
':active': {
|
|
301
337
|
// @ts-expect-error
|
|
338
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
302
339
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
340
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
303
341
|
background: "var(--ds-background-selected, ".concat(colors.R500, ")")
|
|
304
342
|
}
|
|
305
343
|
});
|
|
@@ -308,14 +346,17 @@ var selectedDangerStyles = (0, _primitives.xcss)({
|
|
|
308
346
|
var selectedDiscoveryStyles = (0, _primitives.xcss)({
|
|
309
347
|
background: "var(--ds-background-selected, #403294)",
|
|
310
348
|
// @ts-expect-error
|
|
349
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
311
350
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
312
351
|
':hover': {
|
|
313
352
|
// @ts-expect-error
|
|
353
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
314
354
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
315
355
|
background: "var(--ds-background-selected, #403294)"
|
|
316
356
|
},
|
|
317
357
|
':active': {
|
|
318
358
|
// @ts-expect-error
|
|
359
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
319
360
|
color: "var(--ds-text-selected, ".concat(colors.N20, ")"),
|
|
320
361
|
background: "var(--ds-background-selected, #403294)"
|
|
321
362
|
}
|
|
@@ -442,9 +483,16 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
442
483
|
_ref$shouldFitContain = _ref.shouldFitContainer,
|
|
443
484
|
shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
|
|
444
485
|
_ref$spacing = _ref.spacing,
|
|
445
|
-
propSpacing = _ref$spacing === void 0 ? 'default' : _ref$spacing
|
|
486
|
+
propSpacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
|
|
487
|
+
ariaLabel = _ref.ariaLabel,
|
|
488
|
+
ariaLabelledBy = _ref.ariaLabelledBy;
|
|
446
489
|
var localRef = (0, _react.useRef)(null);
|
|
447
490
|
var splitButtonContext = (0, _splitButtonContext.useSplitButtonContext)();
|
|
491
|
+
// TODO: Use React 18's useId() hook when we update.
|
|
492
|
+
// eslint-disable-next-line @repo/internal/react/disallow-unstable-values
|
|
493
|
+
var loadingLabelId = (0, _reactUid.uid)({
|
|
494
|
+
ariaLabelledBy: ariaLabelledBy
|
|
495
|
+
});
|
|
448
496
|
var isSplitButton = Boolean(splitButtonContext);
|
|
449
497
|
var isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
|
|
450
498
|
var appearance = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || propAppearance;
|
|
@@ -468,7 +516,11 @@ var useButtonBase = function useButtonBase(_ref) {
|
|
|
468
516
|
children: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children, overlay ? /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
469
517
|
as: "span",
|
|
470
518
|
xcss: overlayStyles
|
|
471
|
-
}, overlay) : null)
|
|
519
|
+
}, overlay) : null, isLoading && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, {
|
|
520
|
+
id: loadingLabelId
|
|
521
|
+
}, ", Loading")),
|
|
522
|
+
'aria-label': isLoading && ariaLabel && !ariaLabelledBy ? "".concat(ariaLabel, " ").concat(_constants2.LOADING_LABEL) : ariaLabel,
|
|
523
|
+
'aria-labelledby': isLoading && ariaLabelledBy ? "".concat(ariaLabelledBy, " ").concat(loadingLabelId) : ariaLabelledBy
|
|
472
524
|
}, (0, _blockEvents.default)(isEffectivelyDisabled, {
|
|
473
525
|
onClick: onClick,
|
|
474
526
|
onMouseDownCapture: onMouseDownCapture,
|
|
@@ -15,7 +15,7 @@ var _components = require("@atlaskit/theme/components");
|
|
|
15
15
|
var _buttonBase = _interopRequireDefault(require("./shared/button-base"));
|
|
16
16
|
var _css = require("./shared/css");
|
|
17
17
|
var _getIsOnlySingleIcon = _interopRequireDefault(require("./shared/get-is-only-single-icon"));
|
|
18
|
-
var _excluded = ["appearance", "children", "iconBefore", "iconAfter", "isSelected", "onMouseDown", "onMouseUp", "shouldFitContainer", "spacing"];
|
|
18
|
+
var _excluded = ["appearance", "children", "iconBefore", "iconAfter", "isSelected", "onMouseDown", "onMouseUp", "shouldFitContainer", "spacing"]; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
19
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
21
|
var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|