@atlaskit/button 21.1.4 → 21.1.6
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 +15 -0
- package/dist/cjs/new-button/containers/split-button/split-button.compiled.css +34 -0
- package/dist/cjs/new-button/containers/split-button/split-button.js +58 -118
- package/dist/cjs/new-button/variants/default/button.js +36 -41
- package/dist/cjs/new-button/variants/default/link.compiled.css +119 -0
- package/dist/cjs/new-button/variants/default/link.js +111 -59
- package/dist/cjs/new-button/variants/icon/button.js +128 -143
- package/dist/cjs/new-button/variants/icon/link.compiled.css +104 -0
- package/dist/cjs/new-button/variants/icon/link.js +101 -75
- package/dist/cjs/new-button/variants/shared/button-base.compiled.css +137 -0
- package/dist/cjs/new-button/variants/shared/button-base.js +223 -0
- package/dist/cjs/new-button/variants/shared/content.compiled.css +19 -0
- package/dist/cjs/new-button/variants/shared/content.js +13 -53
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/containers/split-button/split-button.compiled.css +34 -0
- package/dist/es2019/new-button/containers/split-button/split-button.js +54 -117
- package/dist/es2019/new-button/variants/default/button.js +47 -56
- package/dist/es2019/new-button/variants/default/link.compiled.css +119 -0
- package/dist/es2019/new-button/variants/default/link.js +113 -63
- package/dist/es2019/new-button/variants/icon/button.js +117 -133
- package/dist/es2019/new-button/variants/icon/link.compiled.css +104 -0
- package/dist/es2019/new-button/variants/icon/link.js +94 -70
- package/dist/es2019/new-button/variants/shared/button-base.compiled.css +137 -0
- package/dist/es2019/new-button/variants/shared/button-base.js +203 -0
- package/dist/es2019/new-button/variants/shared/content.compiled.css +19 -0
- package/dist/es2019/new-button/variants/shared/content.js +13 -52
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/containers/split-button/split-button.compiled.css +34 -0
- package/dist/esm/new-button/containers/split-button/split-button.js +55 -120
- package/dist/esm/new-button/variants/default/button.js +33 -41
- package/dist/esm/new-button/variants/default/link.compiled.css +119 -0
- package/dist/esm/new-button/variants/default/link.js +111 -59
- package/dist/esm/new-button/variants/icon/button.js +128 -143
- package/dist/esm/new-button/variants/icon/link.compiled.css +104 -0
- package/dist/esm/new-button/variants/icon/link.js +98 -72
- package/dist/esm/new-button/variants/shared/button-base.compiled.css +137 -0
- package/dist/esm/new-button/variants/shared/button-base.js +213 -0
- package/dist/esm/new-button/variants/shared/content.compiled.css +19 -0
- package/dist/esm/new-button/variants/shared/content.js +13 -53
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/new-button/containers/split-button/split-button.d.ts +4 -5
- package/dist/types/new-button/variants/default/button.d.ts +5 -1
- package/dist/types/new-button/variants/default/link.d.ts +22 -8
- package/dist/types/new-button/variants/icon/button.d.ts +5 -1
- package/dist/types/new-button/variants/icon/link.d.ts +11 -4
- package/dist/types/new-button/variants/shared/block-events.d.ts +1 -1
- package/dist/types/new-button/variants/shared/button-base.d.ts +45 -0
- package/dist/types/new-button/variants/shared/content.d.ts +5 -1
- package/dist/types/new-button/variants/types.d.ts +26 -6
- package/dist/types-ts4.5/new-button/containers/split-button/split-button.d.ts +4 -5
- package/dist/types-ts4.5/new-button/variants/default/button.d.ts +5 -1
- package/dist/types-ts4.5/new-button/variants/default/link.d.ts +22 -8
- package/dist/types-ts4.5/new-button/variants/icon/button.d.ts +5 -1
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +11 -4
- package/dist/types-ts4.5/new-button/variants/shared/block-events.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/shared/button-base.d.ts +45 -0
- package/dist/types-ts4.5/new-button/variants/shared/content.d.ts +5 -1
- package/dist/types-ts4.5/new-button/variants/types.d.ts +26 -6
- package/package.json +17 -15
- package/dist/cjs/new-button/variants/default/use-default-button.js +0 -98
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +0 -88
- package/dist/cjs/new-button/variants/shared/use-button-base.js +0 -639
- package/dist/es2019/new-button/variants/default/use-default-button.js +0 -88
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +0 -81
- package/dist/es2019/new-button/variants/shared/use-button-base.js +0 -619
- package/dist/esm/new-button/variants/default/use-default-button.js +0 -88
- package/dist/esm/new-button/variants/icon/use-icon-button.js +0 -81
- package/dist/esm/new-button/variants/shared/use-button-base.js +0 -629
- package/dist/types/new-button/variants/default/use-default-button.d.ts +0 -16
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +0 -16
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +0 -46
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +0 -16
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +0 -16
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +0 -46
|
@@ -1,17 +1,55 @@
|
|
|
1
|
+
/* link.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
3
|
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", "shape", "spacing", "testId", "tooltip"],
|
|
4
|
+
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", "xcss"],
|
|
4
5
|
_excluded2 = ["className", "css", "as", "style"];
|
|
5
|
-
import
|
|
6
|
-
import
|
|
6
|
+
import "./link.compiled.css";
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
9
|
+
import { forwardRef, memo, useRef } from 'react';
|
|
10
|
+
import { cx } from '@atlaskit/css';
|
|
11
|
+
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
12
|
+
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { Anchor } from '@atlaskit/primitives/compiled';
|
|
7
15
|
import Tooltip from '@atlaskit/tooltip';
|
|
8
|
-
import
|
|
16
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
17
|
+
import Content from '../shared/content';
|
|
18
|
+
import IconRenderer from '../shared/icon-renderer';
|
|
19
|
+
var styles = {
|
|
20
|
+
base: "_2rkosqtm _11c82smr _v5649dqc _189eidpf _1rjc12x7 _1e0c116y _vchhusvi _1bsb1wug _p12f1osq _kqswh2mm _4cvr1q9y _1bah1h6o _gy1p1b66 _1o9zidpf _4t3iviql _k48p1wq8 _y4tiutpp _bozgutpp _y3gn1h6o _s7n4nkob _14mj1kw7 _9v7aze3t _1tv3nqa1 _39yqe4h9 _11fnglyw _18postnw",
|
|
21
|
+
linkDecorationUnset: "_4bfu1snc _1hmsagmp _ajmmvv82 _1a3b1r31 _4fprglyw _5goinqa1 _9oik1r31 _1bnxglyw _jf4cnqa1 _1nrm1r31 _c2waglyw _1iohnqa1",
|
|
22
|
+
disabled: "_80om13gf _bfhksyzs _syaz1lh4 _aetrglyw _irr3syzs _30l31lh4 _1di6syzs _9h8h1lh4",
|
|
23
|
+
spacingCompact: "_1rjcv77o _gy1p1b66 _y4tiutpp _bozgutpp _s7n4nkob _4t3i1k8s _1bsb1k8s",
|
|
24
|
+
iconButton: "_4t3iviql _1bsbviql _y4tize3t _bozgze3t"
|
|
25
|
+
};
|
|
26
|
+
var defaultStyles = {
|
|
27
|
+
root: "_bfhk1j54 _syaz10s3 _105310s3 _f8pj10s3 _irr3yw9d _30l310s3 _1di6ip91 _9h8h10s3",
|
|
28
|
+
rootRefreshed: "_bfhksm61 _syaz1gjq _8l3mmuej _aetrb3bt _10531gjq _f8pj1gjq _irr3166n _30l31gjq _1di61dty _9h8h1gjq"
|
|
29
|
+
};
|
|
30
|
+
var primaryStyles = {
|
|
31
|
+
root: "_bfhkomb0 _syaz15cr _105315cr _30l315cr _irr31wqm _9h8h15cr _1di617hq"
|
|
32
|
+
};
|
|
33
|
+
var discoveryStyles = {
|
|
34
|
+
root: "_bfhk1vbi _syaz15cr _105315cr _30l315cr _irr37gr8 _9h8h15cr _1di61wu2"
|
|
35
|
+
};
|
|
36
|
+
var subtleStyles = {
|
|
37
|
+
root: "_bfhkqtfy _syaz10s3 _105310s3 _f8pj10s3 _irr34mfv _30l310s3 _1di619qy _9h8h10s3",
|
|
38
|
+
rootRefreshed: "_bfhkqtfy _syaz1gjq _10531gjq _f8pj1mjl _irr34mfv _30l31gjq _1di619qy _9h8h1gjq"
|
|
39
|
+
};
|
|
40
|
+
var selectedStyles = {
|
|
41
|
+
root: "_bfhk7btw _syaz1pke _10531pke _f8pj1pke _irr3i1yw _30l3aqb7 _1di619ru _9h8haqb7",
|
|
42
|
+
rootRefreshed: "_bfhkfg4m _syaz1ldt _8l3mcoux _aetrb3bt _10531ldt _f8pj1ldt _30l31ldt _9h8h1ldt",
|
|
43
|
+
discovery: "_bfhk1g49 _syaz1pke _30l31pke _irr31g49 _9h8h1pke _1di61g49"
|
|
44
|
+
};
|
|
9
45
|
var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
10
46
|
var preventedAriaLabel = _ref['aria-label'],
|
|
11
47
|
ariaLabelledBy = _ref['aria-labelledby'],
|
|
12
48
|
analyticsContext = _ref.analyticsContext,
|
|
13
|
-
appearance = _ref.appearance,
|
|
14
|
-
|
|
49
|
+
_ref$appearance = _ref.appearance,
|
|
50
|
+
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
|
|
51
|
+
_ref$autoFocus = _ref.autoFocus,
|
|
52
|
+
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
|
|
15
53
|
href = _ref.href,
|
|
16
54
|
icon = _ref.icon,
|
|
17
55
|
interactionName = _ref.interactionName,
|
|
@@ -20,7 +58,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
20
58
|
_ref$isTooltipDisable = _ref.isTooltipDisabled,
|
|
21
59
|
isTooltipDisabled = _ref$isTooltipDisable === void 0 ? true : _ref$isTooltipDisable,
|
|
22
60
|
label = _ref.label,
|
|
23
|
-
|
|
61
|
+
_onClick = _ref.onClick,
|
|
24
62
|
onClickCapture = _ref.onClickCapture,
|
|
25
63
|
onKeyDownCapture = _ref.onKeyDownCapture,
|
|
26
64
|
onKeyUpCapture = _ref.onKeyUpCapture,
|
|
@@ -34,6 +72,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
34
72
|
spacing = _ref.spacing,
|
|
35
73
|
testId = _ref.testId,
|
|
36
74
|
tooltip = _ref.tooltip,
|
|
75
|
+
xcss = _ref.xcss,
|
|
37
76
|
unsafeRest = _objectWithoutProperties(_ref, _excluded);
|
|
38
77
|
// @ts-expect-error
|
|
39
78
|
var _className = unsafeRest.className,
|
|
@@ -41,32 +80,8 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
41
80
|
_as = unsafeRest.as,
|
|
42
81
|
_style = unsafeRest.style,
|
|
43
82
|
saferRest = _objectWithoutProperties(unsafeRest, _excluded2);
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
appearance: appearance,
|
|
47
|
-
ariaLabelledBy: ariaLabelledBy,
|
|
48
|
-
autoFocus: autoFocus,
|
|
49
|
-
buttonType: 'link',
|
|
50
|
-
icon: icon,
|
|
51
|
-
interactionName: interactionName,
|
|
52
|
-
isDisabled: isDisabled,
|
|
53
|
-
isSelected: isSelected,
|
|
54
|
-
label: label,
|
|
55
|
-
onClick: onClick,
|
|
56
|
-
onClickCapture: onClickCapture,
|
|
57
|
-
onKeyDownCapture: onKeyDownCapture,
|
|
58
|
-
onKeyUpCapture: onKeyUpCapture,
|
|
59
|
-
onMouseDownCapture: onMouseDownCapture,
|
|
60
|
-
onMouseUpCapture: onMouseUpCapture,
|
|
61
|
-
onPointerDownCapture: onPointerDownCapture,
|
|
62
|
-
onPointerUpCapture: onPointerUpCapture,
|
|
63
|
-
onTouchEndCapture: onTouchEndCapture,
|
|
64
|
-
onTouchStartCapture: onTouchStartCapture,
|
|
65
|
-
ref: ref,
|
|
66
|
-
shape: shape,
|
|
67
|
-
spacing: spacing,
|
|
68
|
-
testId: testId
|
|
69
|
-
});
|
|
83
|
+
var localRef = useRef(null);
|
|
84
|
+
useAutoFocus(localRef, autoFocus);
|
|
70
85
|
if (!isTooltipDisabled) {
|
|
71
86
|
var _tooltip$content;
|
|
72
87
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -89,7 +104,7 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
89
104
|
return /*#__PURE__*/React.createElement(Anchor
|
|
90
105
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
91
106
|
, _extends({}, saferRest, {
|
|
92
|
-
"aria-labelledby":
|
|
107
|
+
"aria-labelledby": ariaLabelledBy,
|
|
93
108
|
testId: testId,
|
|
94
109
|
componentName: "LinkIconButton",
|
|
95
110
|
analyticsContext: analyticsContext,
|
|
@@ -129,55 +144,61 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
129
144
|
// Shared between tooltip and base props
|
|
130
145
|
,
|
|
131
146
|
onClick: function onClick(event, analyticsEvent) {
|
|
132
|
-
var
|
|
133
|
-
|
|
147
|
+
var _triggerProps$onClick;
|
|
148
|
+
_onClick === null || _onClick === void 0 || _onClick(event, analyticsEvent);
|
|
134
149
|
triggerProps === null || triggerProps === void 0 || (_triggerProps$onClick = triggerProps.onClick) === null || _triggerProps$onClick === void 0 || _triggerProps$onClick.call(triggerProps, event);
|
|
135
150
|
},
|
|
136
|
-
ref:
|
|
137
|
-
var _triggerProps$ref;
|
|
138
|
-
baseProps.ref(_ref2);
|
|
139
|
-
triggerProps === null || triggerProps === void 0 || (_triggerProps$ref = triggerProps.ref) === null || _triggerProps$ref === void 0 || _triggerProps$ref.call(triggerProps, _ref2);
|
|
140
|
-
}
|
|
151
|
+
ref: mergeRefs([localRef, ref, triggerProps.ref].filter(Boolean))
|
|
141
152
|
// Base props only
|
|
142
153
|
,
|
|
143
|
-
xcss:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
xcss: cx(styles.base, appearance === 'default' && (fg('platform-component-visual-refresh') ? defaultStyles.rootRefreshed : defaultStyles.root), appearance === 'primary' && primaryStyles.root, appearance === 'discovery' && discoveryStyles.root, appearance === 'subtle' && (fg('platform-component-visual-refresh') ? subtleStyles.rootRefreshed : subtleStyles.root), styles.linkDecorationUnset, isSelected && (fg('platform-component-visual-refresh') ? selectedStyles.rootRefreshed : selectedStyles.root),
|
|
155
|
+
// TODO: remove me once we kill color fallbacks
|
|
156
|
+
isSelected && appearance === 'discovery' && selectedStyles.discovery, isDisabled && styles.disabled, spacing === 'compact' && styles.spacingCompact, styles.iconButton),
|
|
157
|
+
onMouseDownCapture: onMouseDownCapture,
|
|
158
|
+
onMouseUpCapture: onMouseUpCapture,
|
|
159
|
+
onKeyDownCapture: onKeyDownCapture,
|
|
160
|
+
onKeyUpCapture: onKeyUpCapture,
|
|
161
|
+
onTouchStartCapture: onTouchStartCapture,
|
|
162
|
+
onTouchEndCapture: onTouchEndCapture,
|
|
163
|
+
onPointerDownCapture: onPointerDownCapture,
|
|
164
|
+
onPointerUpCapture: onPointerUpCapture,
|
|
165
|
+
onClickCapture: onClickCapture
|
|
153
166
|
/**
|
|
154
167
|
* Disable link in an accessible way using `href`, `role`, and `aria-disabled`.
|
|
155
168
|
* @see https://a11y-guidelines.orange.com/en/articles/disable-elements/#disable-a-link
|
|
156
169
|
*/
|
|
157
170
|
// @ts-expect-error (`href` is required, we could make it optional but don't want to encourage this pattern elsewhere)
|
|
158
171
|
,
|
|
159
|
-
href:
|
|
160
|
-
role:
|
|
161
|
-
"aria-disabled":
|
|
162
|
-
}),
|
|
172
|
+
href: isDisabled ? undefined : href,
|
|
173
|
+
role: isDisabled ? 'link' : undefined,
|
|
174
|
+
"aria-disabled": isDisabled === true ? true : undefined
|
|
175
|
+
}), /*#__PURE__*/React.createElement(Content, {
|
|
176
|
+
type: "icon",
|
|
177
|
+
isLoading: false
|
|
178
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
179
|
+
icon: icon
|
|
180
|
+
}), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)));
|
|
163
181
|
});
|
|
164
182
|
}
|
|
165
183
|
return /*#__PURE__*/React.createElement(Anchor
|
|
166
184
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
167
185
|
, _extends({}, saferRest, {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
186
|
+
// aria-label={preventedAriaLabel}
|
|
187
|
+
"aria-labelledby": ariaLabelledBy,
|
|
188
|
+
ref: mergeRefs([localRef, ref]),
|
|
189
|
+
xcss: cx(styles.base, appearance === 'default' && (fg('platform-component-visual-refresh') ? defaultStyles.rootRefreshed : defaultStyles.root), appearance === 'primary' && primaryStyles.root, appearance === 'discovery' && discoveryStyles.root, appearance === 'subtle' && (fg('platform-component-visual-refresh') ? subtleStyles.rootRefreshed : subtleStyles.root), styles.linkDecorationUnset, isSelected && (fg('platform-component-visual-refresh') ? selectedStyles.rootRefreshed : selectedStyles.root),
|
|
190
|
+
// TODO: remove me once we kill color fallbacks
|
|
191
|
+
isSelected && appearance === 'discovery' && selectedStyles.discovery, isDisabled && styles.disabled, styles.iconButton, spacing === 'compact' && styles.spacingCompact),
|
|
192
|
+
onClick: _onClick,
|
|
193
|
+
onMouseDownCapture: onMouseDownCapture,
|
|
194
|
+
onMouseUpCapture: onMouseUpCapture,
|
|
195
|
+
onKeyDownCapture: onKeyDownCapture,
|
|
196
|
+
onKeyUpCapture: onKeyUpCapture,
|
|
197
|
+
onTouchStartCapture: onTouchStartCapture,
|
|
198
|
+
onTouchEndCapture: onTouchEndCapture,
|
|
199
|
+
onPointerDownCapture: onPointerDownCapture,
|
|
200
|
+
onPointerUpCapture: onPointerUpCapture,
|
|
201
|
+
onClickCapture: onClickCapture,
|
|
181
202
|
testId: testId
|
|
182
203
|
/**
|
|
183
204
|
* Disable link in an accessible way using `href`, `role`, and `aria-disabled`.
|
|
@@ -185,13 +206,18 @@ var LinkIconButtonBase = function LinkIconButtonBase(_ref, ref) {
|
|
|
185
206
|
*/
|
|
186
207
|
// @ts-expect-error (`href` is required, we could make it optional but don't want to encourage this pattern elsewhere)
|
|
187
208
|
,
|
|
188
|
-
href:
|
|
189
|
-
role:
|
|
190
|
-
"aria-disabled":
|
|
209
|
+
href: isDisabled ? undefined : href,
|
|
210
|
+
role: isDisabled ? 'link' : undefined,
|
|
211
|
+
"aria-disabled": isDisabled === true ? true : undefined,
|
|
191
212
|
componentName: "LinkIconButton",
|
|
192
213
|
analyticsContext: analyticsContext,
|
|
193
214
|
interactionName: interactionName
|
|
194
|
-
}),
|
|
215
|
+
}), /*#__PURE__*/React.createElement(Content, {
|
|
216
|
+
type: "icon",
|
|
217
|
+
isLoading: false
|
|
218
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
219
|
+
icon: icon
|
|
220
|
+
}), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)));
|
|
195
221
|
};
|
|
196
222
|
|
|
197
223
|
// Workarounds to support generic types with forwardRef + memo
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
|
|
2
|
+
._11c82smr{font:var(--ds-font-body,normal 400 14px/20px ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
3
|
+
._14mj1kw7:after{border-radius:inherit}
|
|
4
|
+
._2rko14q2{border-radius:var(--ds-border-radius-circle,2002pc)}
|
|
5
|
+
._2rkosqtm{border-radius:var(--ds-border-radius-100,3px)}
|
|
6
|
+
._9v7aze3t:after{inset:var(--ds-space-0,0)}
|
|
7
|
+
._v5649dqc{transition:background .1s ease-out}
|
|
8
|
+
._189eidpf{border-width:0}
|
|
9
|
+
._1rjc12x7{padding-block:var(--ds-space-075,6px)}
|
|
10
|
+
._1rjcv77o{padding-block:var(--ds-space-025,2px)}
|
|
11
|
+
._1tv3nqa1:after{border-style:solid}
|
|
12
|
+
._39yqe4h9:after{border-width:var(--ds-border-width,1px)}
|
|
13
|
+
._8l3mcoux:after{border-color:var(--ds-border-selected,#0052cc)}
|
|
14
|
+
._8l3mmuej:after{border-color:var(--ds-border,#091e4224)}
|
|
15
|
+
._11fnglyw:after{pointer-events:none}
|
|
16
|
+
._152tze3t{inset-block-start:var(--ds-space-0,0)}
|
|
17
|
+
._18postnw:after{position:absolute}
|
|
18
|
+
._1bah1h6o{justify-content:center}
|
|
19
|
+
._1bsb1k8s{width:1.5rem}
|
|
20
|
+
._1bsb1osq{width:100%}
|
|
21
|
+
._1bsb1tcg{width:24px}
|
|
22
|
+
._1bsb1wug{width:auto}
|
|
23
|
+
._1bsbviql{width:2rem}
|
|
24
|
+
._1e02ze3t{inset-inline-start:var(--ds-space-0,0)}
|
|
25
|
+
._1e0c116y{display:inline-flex}
|
|
26
|
+
._1e0c1txw{display:flex}
|
|
27
|
+
._1hmsglyw{text-decoration-line:none}
|
|
28
|
+
._1o9zidpf{flex-shrink:0}
|
|
29
|
+
._1pbycs5v{z-index:2}
|
|
30
|
+
._4bfu1r31{text-decoration-color:currentColor}
|
|
31
|
+
._4cvr1h6o{align-items:center}
|
|
32
|
+
._4cvr1q9y{align-items:baseline}
|
|
33
|
+
._4t3i1k8s{height:1.5rem}
|
|
34
|
+
._4t3iviql{height:2rem}
|
|
35
|
+
._80om13gf{cursor:not-allowed}
|
|
36
|
+
._80om15jw{cursor:progress}
|
|
37
|
+
._aetrb3bt:after{content:""}
|
|
38
|
+
._aetrglyw:after{content:none}
|
|
39
|
+
._ajmmnqa1{text-decoration-style:solid}
|
|
40
|
+
._bfhk1fvb{background-color:var(--ds-background-disabled,rgba(9,30,66,.04))}
|
|
41
|
+
._bfhk1g49{background-color:var(--ds-background-selected,#403294)}
|
|
42
|
+
._bfhk1ikc{background-color:var(--ds-background-warning-bold,#ffab00)}
|
|
43
|
+
._bfhk1j54{background-color:var(--ds-background-neutral,rgba(9,30,66,.04))}
|
|
44
|
+
._bfhk1v7l{background-color:var(--ds-background-danger-bold,#de350b)}
|
|
45
|
+
._bfhk1vbi{background-color:var(--ds-background-discovery-bold,#5243aa)}
|
|
46
|
+
._bfhk7btw{background-color:var(--ds-background-selected,#253858)}
|
|
47
|
+
._bfhkbeib{background-color:var(--ds-background-selected,#bf2600)}
|
|
48
|
+
._bfhkfg4m{background-color:var(--ds-background-selected,#e9f2ff)}
|
|
49
|
+
._bfhkomb0{background-color:var(--ds-background-brand-bold,#0052cc)}
|
|
50
|
+
._bfhkqtfy{background-color:var(--ds-background-neutral-subtle,transparent)}
|
|
51
|
+
._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
|
|
52
|
+
._bfhkvdtc{background-color:var(--ds-background-selected,#ff991f)}
|
|
53
|
+
._bozg12x7{padding-inline-start:var(--ds-space-075,6px)}
|
|
54
|
+
._bozgu2gc{padding-inline-start:var(--ds-space-100,8px)}
|
|
55
|
+
._bozgutpp{padding-inline-start:var(--ds-space-150,9pt)}
|
|
56
|
+
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
57
|
+
._gy1p1b66{column-gap:var(--ds-space-050,4px)}
|
|
58
|
+
._k48p1wq8{font-weight:var(--ds-font-weight-medium,500)}
|
|
59
|
+
._kqswh2mm{position:relative}
|
|
60
|
+
._kqswstnw{position:absolute}
|
|
61
|
+
._p12f1osq{max-width:100%}
|
|
62
|
+
._rjxpze3t{inset-inline-end:var(--ds-space-0,0)}
|
|
63
|
+
._s7n4nkob{vertical-align:middle}
|
|
64
|
+
._syaz10s3{color:var(--ds-text,#42526e)}
|
|
65
|
+
._syaz15cr{color:var(--ds-text-inverse,#fff)}
|
|
66
|
+
._syaz16q2{color:var(--ds-text-selected,#172b4d)}
|
|
67
|
+
._syaz1gjq{color:var(--ds-text-subtle,#44546f)}
|
|
68
|
+
._syaz1ldt{color:var(--ds-text-selected,#0052cc)}
|
|
69
|
+
._syaz1lh4{color:var(--ds-text-disabled,#091e424f)}
|
|
70
|
+
._syaz1pke{color:var(--ds-text-selected,#f4f5f7)}
|
|
71
|
+
._syazal3n{color:var(--ds-text-warning-inverse,#172b4d)}
|
|
72
|
+
._u7coze3t{inset-block-end:var(--ds-space-0,0)}
|
|
73
|
+
._vchhusvi{box-sizing:border-box}
|
|
74
|
+
._y3gn1h6o{text-align:center}
|
|
75
|
+
._y4ti12x7{padding-inline-end:var(--ds-space-075,6px)}
|
|
76
|
+
._y4tiu2gc{padding-inline-end:var(--ds-space-100,8px)}
|
|
77
|
+
._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
|
|
78
|
+
._y4tize3t{padding-inline-end:var(--ds-space-0,0)}._105310s3:visited{color:var(--ds-text,#42526e)}
|
|
79
|
+
._105315cr:visited{color:var(--ds-text-inverse,#fff)}
|
|
80
|
+
._10531gjq:visited{color:var(--ds-text-subtle,#44546f)}
|
|
81
|
+
._10531ldt:visited{color:var(--ds-text-selected,#0052cc)}
|
|
82
|
+
._10531pke:visited{color:var(--ds-text-selected,#f4f5f7)}
|
|
83
|
+
._1053al3n:visited{color:var(--ds-text-warning-inverse,#172b4d)}
|
|
84
|
+
._1a3b1r31:focus{text-decoration-color:currentColor}
|
|
85
|
+
._4fprglyw:focus{text-decoration-line:none}
|
|
86
|
+
._5goinqa1:focus{text-decoration-style:solid}
|
|
87
|
+
._f8pj10s3:focus{color:var(--ds-text,#42526e)}
|
|
88
|
+
._f8pj15cr:focus{color:var(--ds-text-inverse,#fff)}
|
|
89
|
+
._f8pj1gjq:focus{color:var(--ds-text-subtle,#44546f)}
|
|
90
|
+
._f8pj1ldt:focus{color:var(--ds-text-selected,#0052cc)}
|
|
91
|
+
._f8pj1pke:focus{color:var(--ds-text-selected,#f4f5f7)}
|
|
92
|
+
._f8pjal3n:focus{color:var(--ds-text-warning-inverse,#172b4d)}
|
|
93
|
+
._g0pbb4wl:focus-visible{z-index:100}
|
|
94
|
+
._1bnxglyw:hover{text-decoration-line:none}
|
|
95
|
+
._30l310s3:hover{color:var(--ds-text,#42526e)}
|
|
96
|
+
._30l315cr:hover{color:var(--ds-text-inverse,#fff)}
|
|
97
|
+
._30l31gjq:hover{color:var(--ds-text-subtle,#44546f)}
|
|
98
|
+
._30l31ldt:hover{color:var(--ds-text-selected,#0052cc)}
|
|
99
|
+
._30l31lh4:hover{color:var(--ds-text-disabled,#091e424f)}
|
|
100
|
+
._30l31pke:hover{color:var(--ds-text-selected,#f4f5f7)}
|
|
101
|
+
._30l3al3n:hover{color:var(--ds-text-warning-inverse,#172b4d)}
|
|
102
|
+
._9oik1r31:hover{text-decoration-color:currentColor}
|
|
103
|
+
._irr3166n:hover{background-color:var(--ds-background-neutral-subtle-hovered,#091e420f)}
|
|
104
|
+
._irr31fvb:hover{background-color:var(--ds-background-disabled,rgba(9,30,66,.04))}
|
|
105
|
+
._irr31g49:hover{background-color:var(--ds-background-selected,#403294)}
|
|
106
|
+
._irr31j43:hover{background-color:var(--ds-background-warning-bold-hovered,#ffc400)}
|
|
107
|
+
._irr31rwk:hover{background-color:var(--ds-background-danger-bold-hovered,#ff5630)}
|
|
108
|
+
._irr31wqm:hover{background-color:var(--ds-background-brand-bold-hovered,#0065ff)}
|
|
109
|
+
._irr34mfv:hover{background-color:var(--ds-background-neutral-subtle-hovered,#091e4214)}
|
|
110
|
+
._irr37gr8:hover{background-color:var(--ds-background-discovery-bold-hovered,#8777d9)}
|
|
111
|
+
._irr3beib:hover{background-color:var(--ds-background-selected,#bf2600)}
|
|
112
|
+
._irr3t71w:hover{background-color:var(--ds-background-selected-hovered,#253858)}
|
|
113
|
+
._irr3vdtc:hover{background-color:var(--ds-background-selected,#ff991f)}
|
|
114
|
+
._irr3yw9d:hover{background-color:var(--ds-background-neutral-hovered,#091e4214)}
|
|
115
|
+
._jf4cnqa1:hover{text-decoration-style:solid}
|
|
116
|
+
._1di617hq:active{background-color:var(--ds-background-brand-bold-pressed,#0747a6)}
|
|
117
|
+
._1di619qy:active{background-color:var(--ds-background-neutral-subtle-pressed,#b3d4ff)}
|
|
118
|
+
._1di61dty:active{background-color:var(--ds-background-neutral-subtle-pressed,#091e4224)}
|
|
119
|
+
._1di61fvb:active{background-color:var(--ds-background-disabled,rgba(9,30,66,.04))}
|
|
120
|
+
._1di61g49:active{background-color:var(--ds-background-selected,#403294)}
|
|
121
|
+
._1di61wu2:active{background-color:var(--ds-background-discovery-bold-pressed,#5243aa)}
|
|
122
|
+
._1di6beib:active{background-color:var(--ds-background-selected,#bf2600)}
|
|
123
|
+
._1di6h4op:active{background-color:var(--ds-background-warning-bold-pressed,#ff991f)}
|
|
124
|
+
._1di6ih13:active{background-color:var(--ds-background-neutral-pressed,#b3d4ff)}
|
|
125
|
+
._1di6vdtc:active{background-color:var(--ds-background-selected,#ff991f)}
|
|
126
|
+
._1di6yssv:active{background-color:var(--ds-background-selected-pressed,#253858)}
|
|
127
|
+
._1di6yycf:active{background-color:var(--ds-background-danger-bold-pressed,#bf2600)}
|
|
128
|
+
._1iohnqa1:active{text-decoration-style:solid}
|
|
129
|
+
._1nrm1r31:active{text-decoration-color:currentColor}
|
|
130
|
+
._9h8h10s3:active{color:var(--ds-text,#42526e)}
|
|
131
|
+
._9h8h15cr:active{color:var(--ds-text-inverse,#fff)}
|
|
132
|
+
._9h8h1gjq:active{color:var(--ds-text-subtle,#44546f)}
|
|
133
|
+
._9h8h1ldt:active{color:var(--ds-text-selected,#0052cc)}
|
|
134
|
+
._9h8h1lh4:active{color:var(--ds-text-disabled,#091e424f)}
|
|
135
|
+
._9h8h1pke:active{color:var(--ds-text-selected,#f4f5f7)}
|
|
136
|
+
._9h8hal3n:active{color:var(--ds-text-warning-inverse,#172b4d)}
|
|
137
|
+
._c2waglyw:active{text-decoration-line:none}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/* button-base.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["appearance", "autoFocus", "isDisabled", "isLoading", "isSelected", "isIconButton", "isCircle", "hasIconBefore", "hasIconAfter", "shouldFitContainer", "spacing", "ariaLabel", "ariaLabelledBy", "children", "interactionName", "onClick", "onMouseDown", "onMouseDownCapture", "onMouseUp", "onMouseUpCapture", "onKeyDown", "onKeyDownCapture", "onKeyUp", "onKeyUpCapture", "onTouchStart", "onTouchStartCapture", "onTouchEnd", "onTouchEndCapture", "onPointerDown", "onPointerDownCapture", "onPointerUp", "onPointerUpCapture", "onClickCapture", "testId", "analyticsContext", "componentName", "role", "onMouseOver", "onMouseOut", "onFocus", "onBlur", "onMouseMove", "type"],
|
|
5
|
+
_excluded2 = ["className", "css", "as", "style"];
|
|
6
|
+
import "./button-base.compiled.css";
|
|
7
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
8
|
+
import React, { Fragment, useRef } from 'react';
|
|
9
|
+
import { cx } from '@atlaskit/css';
|
|
10
|
+
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
11
|
+
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
12
|
+
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { Pressable } from '@atlaskit/primitives/compiled';
|
|
15
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
16
|
+
import { useSplitButtonContext } from '../../containers/split-button/split-button-context';
|
|
17
|
+
import blockEvents from './block-events';
|
|
18
|
+
import renderLoadingOverlay from './loading-overlay';
|
|
19
|
+
var LOADING_LABEL = ', Loading';
|
|
20
|
+
var styles = {
|
|
21
|
+
base: "_2rkosqtm _11c82smr _v5649dqc _189eidpf _1rjc12x7 _1e0c116y _vchhusvi _1bsb1wug _p12f1osq _kqswh2mm _4cvr1q9y _1bah1h6o _gy1p1b66 _1o9zidpf _4t3iviql _k48p1wq8 _y4tiutpp _bozgutpp _y3gn1h6o _s7n4nkob _14mj1kw7 _9v7aze3t _1tv3nqa1 _39yqe4h9 _11fnglyw _18postnw",
|
|
22
|
+
linkDecorationUnset: "_4bfu1r31 _1hmsglyw _ajmmnqa1 _1a3b1r31 _4fprglyw _5goinqa1 _9oik1r31 _1bnxglyw _jf4cnqa1 _1nrm1r31 _c2waglyw _1iohnqa1",
|
|
23
|
+
disabled: "_80om13gf _bfhk1fvb _syaz1lh4 _aetrglyw _irr31fvb _30l31lh4 _1di61fvb _9h8h1lh4",
|
|
24
|
+
spacingCompact: "_1rjcv77o _gy1p1b66 _4t3i1k8s _y4tiutpp _bozgutpp _s7n4nkob",
|
|
25
|
+
circle: "_2rko14q2",
|
|
26
|
+
fullWidth: "_1bsb1osq",
|
|
27
|
+
loading: "_80om15jw",
|
|
28
|
+
iconButton: "_4t3iviql _1bsbviql _y4tize3t _bozgze3t",
|
|
29
|
+
iconButtonCompact: "_4t3i1k8s _1bsb1k8s",
|
|
30
|
+
buttonIconBefore: "_bozgu2gc",
|
|
31
|
+
buttonIconAfter: "_y4tiu2gc",
|
|
32
|
+
splitButton: "_g0pbb4wl",
|
|
33
|
+
loadingOverlay: "_1e0c1txw _kqswstnw _4cvr1h6o _1bah1h6o _u7coze3t _152tze3t _rjxpze3t _1e02ze3t",
|
|
34
|
+
navigationSplitButton: "_1bsb1tcg _bfhksm61 _y4ti12x7 _bozg12x7"
|
|
35
|
+
};
|
|
36
|
+
var defaultStyles = {
|
|
37
|
+
root: "_bfhk1j54 _syaz10s3 _105310s3 _f8pj10s3 _30l310s3 _9h8h10s3",
|
|
38
|
+
rootRefreshed: "_bfhksm61 _syaz1gjq _8l3mmuej _aetrb3bt _10531gjq _f8pj1gjq _30l31gjq _9h8h1gjq",
|
|
39
|
+
interactive: "_irr3yw9d _30l310s3 _1di6ih13 _9h8h10s3",
|
|
40
|
+
interactiveRefreshed: "_irr3166n _30l31gjq _1di61dty _9h8h1gjq"
|
|
41
|
+
};
|
|
42
|
+
var primaryStyles = {
|
|
43
|
+
root: "_bfhkomb0 _syaz15cr _105315cr _f8pj15cr _30l315cr _9h8h15cr",
|
|
44
|
+
interactive: "_30l315cr _irr31wqm _9h8h15cr _1di617hq"
|
|
45
|
+
};
|
|
46
|
+
var warningStyles = {
|
|
47
|
+
root: "_bfhk1ikc _syazal3n _1053al3n _f8pjal3n _30l3al3n _9h8hal3n",
|
|
48
|
+
interactive: "_30l3al3n _irr31j43 _9h8hal3n _1di6h4op"
|
|
49
|
+
};
|
|
50
|
+
var dangerStyles = {
|
|
51
|
+
root: "_bfhk1v7l _syaz15cr _105315cr _f8pj15cr _30l315cr _9h8h15cr",
|
|
52
|
+
interactive: "_30l315cr _irr31rwk _9h8h15cr _1di6yycf"
|
|
53
|
+
};
|
|
54
|
+
var discoveryStyles = {
|
|
55
|
+
root: "_bfhk1vbi _syaz15cr _105315cr _f8pj15cr _30l315cr _9h8h15cr",
|
|
56
|
+
interactive: "_30l315cr _irr37gr8 _9h8h15cr _1di61wu2"
|
|
57
|
+
};
|
|
58
|
+
var subtleStyles = {
|
|
59
|
+
root: "_bfhkqtfy _syaz10s3 _105310s3 _f8pj10s3 _30l310s3 _9h8h10s3",
|
|
60
|
+
rootRefreshed: "_bfhkqtfy _syaz1gjq _10531gjq _f8pj1gjq _30l31gjq _9h8h1gjq",
|
|
61
|
+
interactive: "_irr34mfv _30l310s3 _1di619qy _9h8h10s3",
|
|
62
|
+
interactiveRefreshed: "_irr34mfv _30l31gjq _1di619qy _9h8h1gjq"
|
|
63
|
+
};
|
|
64
|
+
var selectedStyles = {
|
|
65
|
+
root: "_bfhk7btw _syaz1pke _10531pke _f8pj1pke _30l31pke _9h8h1pke",
|
|
66
|
+
rootRefreshed: "_bfhkfg4m _syaz1ldt _8l3mcoux _aetrb3bt _10531ldt _f8pj1ldt _30l31ldt _9h8h1ldt",
|
|
67
|
+
insideSplitButton: "_1pbycs5v",
|
|
68
|
+
interactive: "_irr3t71w _30l31pke _1di6yssv _9h8h1pke",
|
|
69
|
+
warning: "_bfhkvdtc _syaz16q2 _30l31pke _irr3vdtc _9h8h1pke _1di6vdtc",
|
|
70
|
+
danger: "_bfhkbeib _syaz1pke _30l31pke _irr3beib _9h8h1pke _1di6beib",
|
|
71
|
+
discovery: "_bfhk1g49 _syaz1pke _30l31pke _irr31g49 _9h8h1pke _1di61g49"
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* __button base__
|
|
76
|
+
*
|
|
77
|
+
* - Implements auto focus when enabled.
|
|
78
|
+
* - Appends the `onClick` event with UFO analytics tracking.
|
|
79
|
+
*
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
var ButtonBase = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
83
|
+
var propAppearance = _ref.appearance,
|
|
84
|
+
_ref$autoFocus = _ref.autoFocus,
|
|
85
|
+
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
|
|
86
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
87
|
+
propIsDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
88
|
+
_ref$isLoading = _ref.isLoading,
|
|
89
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
90
|
+
_ref$isSelected = _ref.isSelected,
|
|
91
|
+
propIsSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
92
|
+
_ref$isIconButton = _ref.isIconButton,
|
|
93
|
+
isIconButton = _ref$isIconButton === void 0 ? false : _ref$isIconButton,
|
|
94
|
+
_ref$isCircle = _ref.isCircle,
|
|
95
|
+
isCircle = _ref$isCircle === void 0 ? false : _ref$isCircle,
|
|
96
|
+
_ref$hasIconBefore = _ref.hasIconBefore,
|
|
97
|
+
hasIconBefore = _ref$hasIconBefore === void 0 ? false : _ref$hasIconBefore,
|
|
98
|
+
_ref$hasIconAfter = _ref.hasIconAfter,
|
|
99
|
+
hasIconAfter = _ref$hasIconAfter === void 0 ? false : _ref$hasIconAfter,
|
|
100
|
+
_ref$shouldFitContain = _ref.shouldFitContainer,
|
|
101
|
+
shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
|
|
102
|
+
_ref$spacing = _ref.spacing,
|
|
103
|
+
propSpacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
|
|
104
|
+
ariaLabel = _ref.ariaLabel,
|
|
105
|
+
ariaLabelledBy = _ref.ariaLabelledBy,
|
|
106
|
+
children = _ref.children,
|
|
107
|
+
interactionName = _ref.interactionName,
|
|
108
|
+
onClick = _ref.onClick,
|
|
109
|
+
onMouseDown = _ref.onMouseDown,
|
|
110
|
+
onMouseDownCapture = _ref.onMouseDownCapture,
|
|
111
|
+
onMouseUp = _ref.onMouseUp,
|
|
112
|
+
onMouseUpCapture = _ref.onMouseUpCapture,
|
|
113
|
+
onKeyDown = _ref.onKeyDown,
|
|
114
|
+
onKeyDownCapture = _ref.onKeyDownCapture,
|
|
115
|
+
onKeyUp = _ref.onKeyUp,
|
|
116
|
+
onKeyUpCapture = _ref.onKeyUpCapture,
|
|
117
|
+
onTouchStart = _ref.onTouchStart,
|
|
118
|
+
onTouchStartCapture = _ref.onTouchStartCapture,
|
|
119
|
+
onTouchEnd = _ref.onTouchEnd,
|
|
120
|
+
onTouchEndCapture = _ref.onTouchEndCapture,
|
|
121
|
+
onPointerDown = _ref.onPointerDown,
|
|
122
|
+
onPointerDownCapture = _ref.onPointerDownCapture,
|
|
123
|
+
onPointerUp = _ref.onPointerUp,
|
|
124
|
+
onPointerUpCapture = _ref.onPointerUpCapture,
|
|
125
|
+
onClickCapture = _ref.onClickCapture,
|
|
126
|
+
testId = _ref.testId,
|
|
127
|
+
analyticsContext = _ref.analyticsContext,
|
|
128
|
+
componentName = _ref.componentName,
|
|
129
|
+
role = _ref.role,
|
|
130
|
+
onMouseOver = _ref.onMouseOver,
|
|
131
|
+
onMouseOut = _ref.onMouseOut,
|
|
132
|
+
onFocus = _ref.onFocus,
|
|
133
|
+
onBlur = _ref.onBlur,
|
|
134
|
+
onMouseMove = _ref.onMouseMove,
|
|
135
|
+
type = _ref.type,
|
|
136
|
+
unsafeRest = _objectWithoutProperties(_ref, _excluded);
|
|
137
|
+
var localRef = useRef(null);
|
|
138
|
+
var splitButtonContext = useSplitButtonContext();
|
|
139
|
+
var loadingLabelId = useId();
|
|
140
|
+
var isSplitButton = Boolean(splitButtonContext);
|
|
141
|
+
var isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
|
|
142
|
+
var isDefaultAppearanceSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) === 'default';
|
|
143
|
+
var appearance = isDefaultAppearanceSplitButton && fg('platform-component-visual-refresh') ? 'subtle' : propAppearance || (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || 'default';
|
|
144
|
+
var spacing = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.spacing) || propSpacing;
|
|
145
|
+
var isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
|
|
146
|
+
var isInteractive = !isDisabled && !isLoading;
|
|
147
|
+
// Also treat loading buttons as disabled
|
|
148
|
+
var isEffectivelyDisabled = isDisabled || isLoading;
|
|
149
|
+
var isSelected = propIsSelected && !isDisabled;
|
|
150
|
+
useAutoFocus(localRef, autoFocus);
|
|
151
|
+
|
|
152
|
+
// @ts-expect-error
|
|
153
|
+
var _className = unsafeRest.className,
|
|
154
|
+
_css = unsafeRest.css,
|
|
155
|
+
_as = unsafeRest.as,
|
|
156
|
+
_style = unsafeRest.style,
|
|
157
|
+
saferRest = _objectWithoutProperties(unsafeRest, _excluded2);
|
|
158
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({}, saferRest, {
|
|
159
|
+
componentName: componentName || 'button',
|
|
160
|
+
analyticsContext: analyticsContext,
|
|
161
|
+
role: role,
|
|
162
|
+
ref: mergeRefs([localRef, ref]),
|
|
163
|
+
xcss: cx(styles.base, appearance === 'default' && (fg('platform-component-visual-refresh') ? defaultStyles.rootRefreshed : defaultStyles.root), appearance === 'default' && isInteractive && (fg('platform-component-visual-refresh') ? defaultStyles.interactiveRefreshed : defaultStyles.interactive), appearance === 'primary' && primaryStyles.root, appearance === 'primary' && isInteractive && primaryStyles.interactive, appearance === 'warning' && warningStyles.root, appearance === 'warning' && isInteractive && warningStyles.interactive, appearance === 'danger' && dangerStyles.root, appearance === 'danger' && isInteractive && dangerStyles.interactive, appearance === 'discovery' && discoveryStyles.root, appearance === 'discovery' && isInteractive && discoveryStyles.interactive, appearance === 'subtle' && (fg('platform-component-visual-refresh') ? subtleStyles.rootRefreshed : subtleStyles.root), appearance === 'subtle' && isInteractive && (fg('platform-component-visual-refresh') ? subtleStyles.interactiveRefreshed : subtleStyles.interactive), styles.linkDecorationUnset, isSelected && (fg('platform-component-visual-refresh') ? selectedStyles.rootRefreshed : selectedStyles.root), isSelected && isSplitButton && selectedStyles.insideSplitButton, isSelected && isInteractive && selectedStyles.interactive,
|
|
164
|
+
// TODO: remove me once we kill color fallbacks
|
|
165
|
+
isSelected && appearance === 'danger' && selectedStyles.danger,
|
|
166
|
+
// TODO: remove me once we kill color fallbacks
|
|
167
|
+
isSelected && appearance === 'warning' && selectedStyles.warning,
|
|
168
|
+
// TODO: remove me once we kill color fallbacks
|
|
169
|
+
isSelected && appearance === 'discovery' && selectedStyles.discovery, isDisabled && styles.disabled, isCircle && !isSplitButton && styles.circle, spacing === 'compact' && styles.spacingCompact, hasIconBefore && styles.buttonIconBefore, shouldFitContainer && styles.fullWidth, hasIconAfter && styles.buttonIconAfter, isIconButton && styles.iconButton, isIconButton && spacing === 'compact' && styles.iconButtonCompact, isLoading && styles.loading, isSplitButton && styles.splitButton, isNavigationSplitButton && styles.navigationSplitButton),
|
|
170
|
+
isDisabled: isEffectivelyDisabled,
|
|
171
|
+
"aria-label": isLoading && ariaLabel && !ariaLabelledBy ? "".concat(ariaLabel, " ").concat(LOADING_LABEL) : ariaLabel,
|
|
172
|
+
"aria-labelledby": isLoading && ariaLabelledBy ? "".concat(ariaLabelledBy, " ").concat(loadingLabelId) : ariaLabelledBy,
|
|
173
|
+
onClick: onClick
|
|
174
|
+
}, blockEvents(isEffectivelyDisabled, {
|
|
175
|
+
onMouseDownCapture: onMouseDownCapture,
|
|
176
|
+
onMouseUpCapture: onMouseUpCapture,
|
|
177
|
+
onKeyDownCapture: onKeyDownCapture,
|
|
178
|
+
onKeyUpCapture: onKeyUpCapture,
|
|
179
|
+
onTouchStartCapture: onTouchStartCapture,
|
|
180
|
+
onTouchEndCapture: onTouchEndCapture,
|
|
181
|
+
onPointerDownCapture: onPointerDownCapture,
|
|
182
|
+
onPointerUpCapture: onPointerUpCapture,
|
|
183
|
+
onClickCapture: onClickCapture
|
|
184
|
+
}), {
|
|
185
|
+
testId: testId,
|
|
186
|
+
onMouseOver: onMouseOver,
|
|
187
|
+
onFocus: onFocus,
|
|
188
|
+
onMouseMove: onMouseMove,
|
|
189
|
+
onBlur: onBlur,
|
|
190
|
+
type: type,
|
|
191
|
+
interactionName: interactionName,
|
|
192
|
+
onMouseDown: onMouseDown,
|
|
193
|
+
onMouseUp: onMouseUp,
|
|
194
|
+
onKeyDown: onKeyDown,
|
|
195
|
+
onMouseOut: onMouseOut,
|
|
196
|
+
onKeyUp: onKeyUp,
|
|
197
|
+
onTouchStart: onTouchStart,
|
|
198
|
+
onTouchEnd: onTouchEnd,
|
|
199
|
+
onPointerDown: onPointerDown,
|
|
200
|
+
onPointerUp: onPointerUp
|
|
201
|
+
}), /*#__PURE__*/React.createElement(Fragment, null, children, isLoading && /*#__PURE__*/React.createElement("span", {
|
|
202
|
+
className: ax([styles.loadingOverlay])
|
|
203
|
+
}, renderLoadingOverlay({
|
|
204
|
+
spacing: spacing,
|
|
205
|
+
appearance: appearance,
|
|
206
|
+
isDisabled: isDisabled,
|
|
207
|
+
isSelected: isSelected,
|
|
208
|
+
testId: testId
|
|
209
|
+
})), isLoading && (ariaLabelledBy || !ariaLabel) && /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
210
|
+
id: loadingLabelId
|
|
211
|
+
}, LOADING_LABEL)));
|
|
212
|
+
});
|
|
213
|
+
export default ButtonBase;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
._v564g17y{transition:opacity .3s}._16jlidpf{flex-grow:0}
|
|
3
|
+
._16jlkb7n{flex-grow:1}
|
|
4
|
+
._18m915vq{overflow-y:hidden}
|
|
5
|
+
._1bto1l2s{text-overflow:ellipsis}
|
|
6
|
+
._1e0c1txw{display:flex}
|
|
7
|
+
._1he91b66{--ds--button--new-icon-padding-start:var(--ds-space-050,4px)}
|
|
8
|
+
._1he9v77o{--ds--button--new-icon-padding-start:var(--ds-space-025,2px)}
|
|
9
|
+
._1o9zidpf{flex-shrink:0}
|
|
10
|
+
._1o9zkb7n{flex-shrink:1}
|
|
11
|
+
._1reo15vq{overflow-x:hidden}
|
|
12
|
+
._1wpz1h6o{align-self:center}
|
|
13
|
+
._1wybidpf{font-size:0}
|
|
14
|
+
._o5721q9c{white-space:nowrap}
|
|
15
|
+
._tzy4idpf{opacity:0}
|
|
16
|
+
._uiztglyw{-webkit-user-select:none;-ms-user-select:none;user-select:none}
|
|
17
|
+
._vwz4idpf{line-height:0}
|
|
18
|
+
._w7951b66{--ds--button--new-icon-padding-end:var(--ds-space-050,4px)}
|
|
19
|
+
._w795v77o{--ds--button--new-icon-padding-end:var(--ds-space-025,2px)}
|