@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,15 +1,51 @@
|
|
|
1
|
+
/* link.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
3
|
+
import "./link.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { forwardRef, memo, useRef } from 'react';
|
|
7
|
+
import { cx } from '@atlaskit/css';
|
|
8
|
+
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
9
|
+
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import { Anchor } from '@atlaskit/primitives/compiled';
|
|
4
12
|
import Tooltip from '@atlaskit/tooltip';
|
|
5
|
-
import
|
|
13
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
14
|
+
import Content from '../shared/content';
|
|
15
|
+
import IconRenderer from '../shared/icon-renderer';
|
|
16
|
+
const styles = {
|
|
17
|
+
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",
|
|
18
|
+
linkDecorationUnset: "_4bfu1snc _1hmsagmp _ajmmvv82 _1a3b1r31 _4fprglyw _5goinqa1 _9oik1r31 _1bnxglyw _jf4cnqa1 _1nrm1r31 _c2waglyw _1iohnqa1",
|
|
19
|
+
disabled: "_80om13gf _bfhksyzs _syaz1lh4 _aetrglyw _irr3syzs _30l31lh4 _1di6syzs _9h8h1lh4",
|
|
20
|
+
spacingCompact: "_1rjcv77o _gy1p1b66 _y4tiutpp _bozgutpp _s7n4nkob _4t3i1k8s _1bsb1k8s",
|
|
21
|
+
iconButton: "_4t3iviql _1bsbviql _y4tize3t _bozgze3t"
|
|
22
|
+
};
|
|
23
|
+
const defaultStyles = {
|
|
24
|
+
root: "_bfhk1j54 _syaz10s3 _105310s3 _f8pj10s3 _irr3yw9d _30l310s3 _1di6ip91 _9h8h10s3",
|
|
25
|
+
rootRefreshed: "_bfhksm61 _syaz1gjq _8l3mmuej _aetrb3bt _10531gjq _f8pj1gjq _irr3166n _30l31gjq _1di61dty _9h8h1gjq"
|
|
26
|
+
};
|
|
27
|
+
const primaryStyles = {
|
|
28
|
+
root: "_bfhkomb0 _syaz15cr _105315cr _30l315cr _irr31wqm _9h8h15cr _1di617hq"
|
|
29
|
+
};
|
|
30
|
+
const discoveryStyles = {
|
|
31
|
+
root: "_bfhk1vbi _syaz15cr _105315cr _30l315cr _irr37gr8 _9h8h15cr _1di61wu2"
|
|
32
|
+
};
|
|
33
|
+
const subtleStyles = {
|
|
34
|
+
root: "_bfhkqtfy _syaz10s3 _105310s3 _f8pj10s3 _irr34mfv _30l310s3 _1di619qy _9h8h10s3",
|
|
35
|
+
rootRefreshed: "_bfhkqtfy _syaz1gjq _10531gjq _f8pj1mjl _irr34mfv _30l31gjq _1di619qy _9h8h1gjq"
|
|
36
|
+
};
|
|
37
|
+
const selectedStyles = {
|
|
38
|
+
root: "_bfhk7btw _syaz1pke _10531pke _f8pj1pke _irr3i1yw _30l3aqb7 _1di619ru _9h8haqb7",
|
|
39
|
+
rootRefreshed: "_bfhkfg4m _syaz1ldt _8l3mcoux _aetrb3bt _10531ldt _f8pj1ldt _30l31ldt _9h8h1ldt",
|
|
40
|
+
discovery: "_bfhk1g49 _syaz1pke _30l31pke _irr31g49 _9h8h1pke _1di61g49"
|
|
41
|
+
};
|
|
6
42
|
const LinkIconButtonBase = ({
|
|
7
43
|
// Prevent duplicate labels being added.
|
|
8
44
|
'aria-label': preventedAriaLabel,
|
|
9
45
|
'aria-labelledby': ariaLabelledBy,
|
|
10
46
|
analyticsContext,
|
|
11
|
-
appearance,
|
|
12
|
-
autoFocus,
|
|
47
|
+
appearance = 'default',
|
|
48
|
+
autoFocus = false,
|
|
13
49
|
href,
|
|
14
50
|
icon,
|
|
15
51
|
interactionName,
|
|
@@ -31,6 +67,7 @@ const LinkIconButtonBase = ({
|
|
|
31
67
|
spacing,
|
|
32
68
|
testId,
|
|
33
69
|
tooltip,
|
|
70
|
+
xcss,
|
|
34
71
|
...unsafeRest
|
|
35
72
|
}, ref) => {
|
|
36
73
|
// @ts-expect-error
|
|
@@ -41,32 +78,8 @@ const LinkIconButtonBase = ({
|
|
|
41
78
|
style: _style,
|
|
42
79
|
...saferRest
|
|
43
80
|
} = unsafeRest;
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
appearance,
|
|
47
|
-
ariaLabelledBy,
|
|
48
|
-
autoFocus,
|
|
49
|
-
buttonType: 'link',
|
|
50
|
-
icon,
|
|
51
|
-
interactionName,
|
|
52
|
-
isDisabled,
|
|
53
|
-
isSelected,
|
|
54
|
-
label,
|
|
55
|
-
onClick,
|
|
56
|
-
onClickCapture,
|
|
57
|
-
onKeyDownCapture,
|
|
58
|
-
onKeyUpCapture,
|
|
59
|
-
onMouseDownCapture,
|
|
60
|
-
onMouseUpCapture,
|
|
61
|
-
onPointerDownCapture,
|
|
62
|
-
onPointerUpCapture,
|
|
63
|
-
onTouchEndCapture,
|
|
64
|
-
onTouchStartCapture,
|
|
65
|
-
ref,
|
|
66
|
-
shape,
|
|
67
|
-
spacing,
|
|
68
|
-
testId
|
|
69
|
-
});
|
|
81
|
+
const localRef = useRef(null);
|
|
82
|
+
useAutoFocus(localRef, autoFocus);
|
|
70
83
|
if (!isTooltipDisabled) {
|
|
71
84
|
var _tooltip$content;
|
|
72
85
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -88,7 +101,7 @@ const LinkIconButtonBase = ({
|
|
|
88
101
|
}, triggerProps => /*#__PURE__*/React.createElement(Anchor
|
|
89
102
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
90
103
|
, _extends({}, saferRest, {
|
|
91
|
-
"aria-labelledby":
|
|
104
|
+
"aria-labelledby": ariaLabelledBy,
|
|
92
105
|
testId: testId,
|
|
93
106
|
componentName: "LinkIconButton",
|
|
94
107
|
analyticsContext: analyticsContext,
|
|
@@ -128,54 +141,60 @@ const LinkIconButtonBase = ({
|
|
|
128
141
|
// Shared between tooltip and base props
|
|
129
142
|
,
|
|
130
143
|
onClick: (event, analyticsEvent) => {
|
|
131
|
-
var
|
|
132
|
-
|
|
144
|
+
var _triggerProps$onClick;
|
|
145
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event, analyticsEvent);
|
|
133
146
|
triggerProps === null || triggerProps === void 0 ? void 0 : (_triggerProps$onClick = triggerProps.onClick) === null || _triggerProps$onClick === void 0 ? void 0 : _triggerProps$onClick.call(triggerProps, event);
|
|
134
147
|
},
|
|
135
|
-
ref: ref
|
|
136
|
-
var _triggerProps$ref;
|
|
137
|
-
baseProps.ref(ref);
|
|
138
|
-
triggerProps === null || triggerProps === void 0 ? void 0 : (_triggerProps$ref = triggerProps.ref) === null || _triggerProps$ref === void 0 ? void 0 : _triggerProps$ref.call(triggerProps, ref);
|
|
139
|
-
}
|
|
148
|
+
ref: mergeRefs([localRef, ref, triggerProps.ref].filter(Boolean))
|
|
140
149
|
// Base props only
|
|
141
150
|
,
|
|
142
|
-
xcss:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
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),
|
|
152
|
+
// TODO: remove me once we kill color fallbacks
|
|
153
|
+
isSelected && appearance === 'discovery' && selectedStyles.discovery, isDisabled && styles.disabled, spacing === 'compact' && styles.spacingCompact, styles.iconButton),
|
|
154
|
+
onMouseDownCapture: onMouseDownCapture,
|
|
155
|
+
onMouseUpCapture: onMouseUpCapture,
|
|
156
|
+
onKeyDownCapture: onKeyDownCapture,
|
|
157
|
+
onKeyUpCapture: onKeyUpCapture,
|
|
158
|
+
onTouchStartCapture: onTouchStartCapture,
|
|
159
|
+
onTouchEndCapture: onTouchEndCapture,
|
|
160
|
+
onPointerDownCapture: onPointerDownCapture,
|
|
161
|
+
onPointerUpCapture: onPointerUpCapture,
|
|
162
|
+
onClickCapture: onClickCapture
|
|
152
163
|
/**
|
|
153
164
|
* Disable link in an accessible way using `href`, `role`, and `aria-disabled`.
|
|
154
165
|
* @see https://a11y-guidelines.orange.com/en/articles/disable-elements/#disable-a-link
|
|
155
166
|
*/
|
|
156
167
|
// @ts-expect-error (`href` is required, we could make it optional but don't want to encourage this pattern elsewhere)
|
|
157
168
|
,
|
|
158
|
-
href:
|
|
159
|
-
role:
|
|
160
|
-
"aria-disabled":
|
|
161
|
-
}),
|
|
169
|
+
href: isDisabled ? undefined : href,
|
|
170
|
+
role: isDisabled ? 'link' : undefined,
|
|
171
|
+
"aria-disabled": isDisabled === true ? true : undefined
|
|
172
|
+
}), /*#__PURE__*/React.createElement(Content, {
|
|
173
|
+
type: "icon",
|
|
174
|
+
isLoading: false
|
|
175
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
176
|
+
icon: icon
|
|
177
|
+
}), /*#__PURE__*/React.createElement(VisuallyHidden, null, label))));
|
|
162
178
|
}
|
|
163
179
|
return /*#__PURE__*/React.createElement(Anchor
|
|
164
180
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
165
181
|
, _extends({}, saferRest, {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
182
|
+
// aria-label={preventedAriaLabel}
|
|
183
|
+
"aria-labelledby": ariaLabelledBy,
|
|
184
|
+
ref: mergeRefs([localRef, ref]),
|
|
185
|
+
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),
|
|
186
|
+
// TODO: remove me once we kill color fallbacks
|
|
187
|
+
isSelected && appearance === 'discovery' && selectedStyles.discovery, isDisabled && styles.disabled, styles.iconButton, spacing === 'compact' && styles.spacingCompact),
|
|
188
|
+
onClick: onClick,
|
|
189
|
+
onMouseDownCapture: onMouseDownCapture,
|
|
190
|
+
onMouseUpCapture: onMouseUpCapture,
|
|
191
|
+
onKeyDownCapture: onKeyDownCapture,
|
|
192
|
+
onKeyUpCapture: onKeyUpCapture,
|
|
193
|
+
onTouchStartCapture: onTouchStartCapture,
|
|
194
|
+
onTouchEndCapture: onTouchEndCapture,
|
|
195
|
+
onPointerDownCapture: onPointerDownCapture,
|
|
196
|
+
onPointerUpCapture: onPointerUpCapture,
|
|
197
|
+
onClickCapture: onClickCapture,
|
|
179
198
|
testId: testId
|
|
180
199
|
/**
|
|
181
200
|
* Disable link in an accessible way using `href`, `role`, and `aria-disabled`.
|
|
@@ -183,13 +202,18 @@ const LinkIconButtonBase = ({
|
|
|
183
202
|
*/
|
|
184
203
|
// @ts-expect-error (`href` is required, we could make it optional but don't want to encourage this pattern elsewhere)
|
|
185
204
|
,
|
|
186
|
-
href:
|
|
187
|
-
role:
|
|
188
|
-
"aria-disabled":
|
|
205
|
+
href: isDisabled ? undefined : href,
|
|
206
|
+
role: isDisabled ? 'link' : undefined,
|
|
207
|
+
"aria-disabled": isDisabled === true ? true : undefined,
|
|
189
208
|
componentName: "LinkIconButton",
|
|
190
209
|
analyticsContext: analyticsContext,
|
|
191
210
|
interactionName: interactionName
|
|
192
|
-
}),
|
|
211
|
+
}), /*#__PURE__*/React.createElement(Content, {
|
|
212
|
+
type: "icon",
|
|
213
|
+
isLoading: false
|
|
214
|
+
}, /*#__PURE__*/React.createElement(IconRenderer, {
|
|
215
|
+
icon: icon
|
|
216
|
+
}), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)));
|
|
193
217
|
};
|
|
194
218
|
|
|
195
219
|
// 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,203 @@
|
|
|
1
|
+
/* button-base.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./button-base.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import React, { Fragment, useRef } from 'react';
|
|
6
|
+
import { cx } from '@atlaskit/css';
|
|
7
|
+
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
8
|
+
import useAutoFocus from '@atlaskit/ds-lib/use-auto-focus';
|
|
9
|
+
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import { Pressable } from '@atlaskit/primitives/compiled';
|
|
12
|
+
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
13
|
+
import { useSplitButtonContext } from '../../containers/split-button/split-button-context';
|
|
14
|
+
import blockEvents from './block-events';
|
|
15
|
+
import renderLoadingOverlay from './loading-overlay';
|
|
16
|
+
const LOADING_LABEL = ', Loading';
|
|
17
|
+
const styles = {
|
|
18
|
+
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",
|
|
19
|
+
linkDecorationUnset: "_4bfu1r31 _1hmsglyw _ajmmnqa1 _1a3b1r31 _4fprglyw _5goinqa1 _9oik1r31 _1bnxglyw _jf4cnqa1 _1nrm1r31 _c2waglyw _1iohnqa1",
|
|
20
|
+
disabled: "_80om13gf _bfhk1fvb _syaz1lh4 _aetrglyw _irr31fvb _30l31lh4 _1di61fvb _9h8h1lh4",
|
|
21
|
+
spacingCompact: "_1rjcv77o _gy1p1b66 _4t3i1k8s _y4tiutpp _bozgutpp _s7n4nkob",
|
|
22
|
+
circle: "_2rko14q2",
|
|
23
|
+
fullWidth: "_1bsb1osq",
|
|
24
|
+
loading: "_80om15jw",
|
|
25
|
+
iconButton: "_4t3iviql _1bsbviql _y4tize3t _bozgze3t",
|
|
26
|
+
iconButtonCompact: "_4t3i1k8s _1bsb1k8s",
|
|
27
|
+
buttonIconBefore: "_bozgu2gc",
|
|
28
|
+
buttonIconAfter: "_y4tiu2gc",
|
|
29
|
+
splitButton: "_g0pbb4wl",
|
|
30
|
+
loadingOverlay: "_1e0c1txw _kqswstnw _4cvr1h6o _1bah1h6o _u7coze3t _152tze3t _rjxpze3t _1e02ze3t",
|
|
31
|
+
navigationSplitButton: "_1bsb1tcg _bfhksm61 _y4ti12x7 _bozg12x7"
|
|
32
|
+
};
|
|
33
|
+
const defaultStyles = {
|
|
34
|
+
root: "_bfhk1j54 _syaz10s3 _105310s3 _f8pj10s3 _30l310s3 _9h8h10s3",
|
|
35
|
+
rootRefreshed: "_bfhksm61 _syaz1gjq _8l3mmuej _aetrb3bt _10531gjq _f8pj1gjq _30l31gjq _9h8h1gjq",
|
|
36
|
+
interactive: "_irr3yw9d _30l310s3 _1di6ih13 _9h8h10s3",
|
|
37
|
+
interactiveRefreshed: "_irr3166n _30l31gjq _1di61dty _9h8h1gjq"
|
|
38
|
+
};
|
|
39
|
+
const primaryStyles = {
|
|
40
|
+
root: "_bfhkomb0 _syaz15cr _105315cr _f8pj15cr _30l315cr _9h8h15cr",
|
|
41
|
+
interactive: "_30l315cr _irr31wqm _9h8h15cr _1di617hq"
|
|
42
|
+
};
|
|
43
|
+
const warningStyles = {
|
|
44
|
+
root: "_bfhk1ikc _syazal3n _1053al3n _f8pjal3n _30l3al3n _9h8hal3n",
|
|
45
|
+
interactive: "_30l3al3n _irr31j43 _9h8hal3n _1di6h4op"
|
|
46
|
+
};
|
|
47
|
+
const dangerStyles = {
|
|
48
|
+
root: "_bfhk1v7l _syaz15cr _105315cr _f8pj15cr _30l315cr _9h8h15cr",
|
|
49
|
+
interactive: "_30l315cr _irr31rwk _9h8h15cr _1di6yycf"
|
|
50
|
+
};
|
|
51
|
+
const discoveryStyles = {
|
|
52
|
+
root: "_bfhk1vbi _syaz15cr _105315cr _f8pj15cr _30l315cr _9h8h15cr",
|
|
53
|
+
interactive: "_30l315cr _irr37gr8 _9h8h15cr _1di61wu2"
|
|
54
|
+
};
|
|
55
|
+
const subtleStyles = {
|
|
56
|
+
root: "_bfhkqtfy _syaz10s3 _105310s3 _f8pj10s3 _30l310s3 _9h8h10s3",
|
|
57
|
+
rootRefreshed: "_bfhkqtfy _syaz1gjq _10531gjq _f8pj1gjq _30l31gjq _9h8h1gjq",
|
|
58
|
+
interactive: "_irr34mfv _30l310s3 _1di619qy _9h8h10s3",
|
|
59
|
+
interactiveRefreshed: "_irr34mfv _30l31gjq _1di619qy _9h8h1gjq"
|
|
60
|
+
};
|
|
61
|
+
const selectedStyles = {
|
|
62
|
+
root: "_bfhk7btw _syaz1pke _10531pke _f8pj1pke _30l31pke _9h8h1pke",
|
|
63
|
+
rootRefreshed: "_bfhkfg4m _syaz1ldt _8l3mcoux _aetrb3bt _10531ldt _f8pj1ldt _30l31ldt _9h8h1ldt",
|
|
64
|
+
insideSplitButton: "_1pbycs5v",
|
|
65
|
+
interactive: "_irr3t71w _30l31pke _1di6yssv _9h8h1pke",
|
|
66
|
+
warning: "_bfhkvdtc _syaz16q2 _30l31pke _irr3vdtc _9h8h1pke _1di6vdtc",
|
|
67
|
+
danger: "_bfhkbeib _syaz1pke _30l31pke _irr3beib _9h8h1pke _1di6beib",
|
|
68
|
+
discovery: "_bfhk1g49 _syaz1pke _30l31pke _irr31g49 _9h8h1pke _1di61g49"
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* __button base__
|
|
73
|
+
*
|
|
74
|
+
* - Implements auto focus when enabled.
|
|
75
|
+
* - Appends the `onClick` event with UFO analytics tracking.
|
|
76
|
+
*
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
const ButtonBase = /*#__PURE__*/React.forwardRef(({
|
|
80
|
+
appearance: propAppearance,
|
|
81
|
+
autoFocus = false,
|
|
82
|
+
isDisabled: propIsDisabled = false,
|
|
83
|
+
isLoading = false,
|
|
84
|
+
isSelected: propIsSelected = false,
|
|
85
|
+
isIconButton = false,
|
|
86
|
+
isCircle = false,
|
|
87
|
+
hasIconBefore = false,
|
|
88
|
+
hasIconAfter = false,
|
|
89
|
+
shouldFitContainer = false,
|
|
90
|
+
spacing: propSpacing = 'default',
|
|
91
|
+
ariaLabel,
|
|
92
|
+
ariaLabelledBy,
|
|
93
|
+
children,
|
|
94
|
+
interactionName,
|
|
95
|
+
onClick,
|
|
96
|
+
onMouseDown,
|
|
97
|
+
onMouseDownCapture,
|
|
98
|
+
onMouseUp,
|
|
99
|
+
onMouseUpCapture,
|
|
100
|
+
onKeyDown,
|
|
101
|
+
onKeyDownCapture,
|
|
102
|
+
onKeyUp,
|
|
103
|
+
onKeyUpCapture,
|
|
104
|
+
onTouchStart,
|
|
105
|
+
onTouchStartCapture,
|
|
106
|
+
onTouchEnd,
|
|
107
|
+
onTouchEndCapture,
|
|
108
|
+
onPointerDown,
|
|
109
|
+
onPointerDownCapture,
|
|
110
|
+
onPointerUp,
|
|
111
|
+
onPointerUpCapture,
|
|
112
|
+
onClickCapture,
|
|
113
|
+
testId,
|
|
114
|
+
analyticsContext,
|
|
115
|
+
componentName,
|
|
116
|
+
role,
|
|
117
|
+
onMouseOver,
|
|
118
|
+
onMouseOut,
|
|
119
|
+
onFocus,
|
|
120
|
+
onBlur,
|
|
121
|
+
onMouseMove,
|
|
122
|
+
type,
|
|
123
|
+
...unsafeRest
|
|
124
|
+
}, ref) => {
|
|
125
|
+
const localRef = useRef(null);
|
|
126
|
+
const splitButtonContext = useSplitButtonContext();
|
|
127
|
+
const loadingLabelId = useId();
|
|
128
|
+
const isSplitButton = Boolean(splitButtonContext);
|
|
129
|
+
const isNavigationSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isNavigationSplitButton) || false;
|
|
130
|
+
const isDefaultAppearanceSplitButton = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) === 'default';
|
|
131
|
+
const appearance = isDefaultAppearanceSplitButton && fg('platform-component-visual-refresh') ? 'subtle' : propAppearance || (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.appearance) || 'default';
|
|
132
|
+
const spacing = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.spacing) || propSpacing;
|
|
133
|
+
const isDisabled = (splitButtonContext === null || splitButtonContext === void 0 ? void 0 : splitButtonContext.isDisabled) || propIsDisabled;
|
|
134
|
+
const isInteractive = !isDisabled && !isLoading;
|
|
135
|
+
// Also treat loading buttons as disabled
|
|
136
|
+
const isEffectivelyDisabled = isDisabled || isLoading;
|
|
137
|
+
const isSelected = propIsSelected && !isDisabled;
|
|
138
|
+
useAutoFocus(localRef, autoFocus);
|
|
139
|
+
|
|
140
|
+
// @ts-expect-error
|
|
141
|
+
const {
|
|
142
|
+
className: _className,
|
|
143
|
+
css: _css,
|
|
144
|
+
as: _as,
|
|
145
|
+
style: _style,
|
|
146
|
+
...saferRest
|
|
147
|
+
} = unsafeRest;
|
|
148
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({}, saferRest, {
|
|
149
|
+
componentName: componentName || 'button',
|
|
150
|
+
analyticsContext: analyticsContext,
|
|
151
|
+
role: role,
|
|
152
|
+
ref: mergeRefs([localRef, ref]),
|
|
153
|
+
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,
|
|
154
|
+
// TODO: remove me once we kill color fallbacks
|
|
155
|
+
isSelected && appearance === 'danger' && selectedStyles.danger,
|
|
156
|
+
// TODO: remove me once we kill color fallbacks
|
|
157
|
+
isSelected && appearance === 'warning' && selectedStyles.warning,
|
|
158
|
+
// TODO: remove me once we kill color fallbacks
|
|
159
|
+
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),
|
|
160
|
+
isDisabled: isEffectivelyDisabled,
|
|
161
|
+
"aria-label": isLoading && ariaLabel && !ariaLabelledBy ? `${ariaLabel} ${LOADING_LABEL}` : ariaLabel,
|
|
162
|
+
"aria-labelledby": isLoading && ariaLabelledBy ? `${ariaLabelledBy} ${loadingLabelId}` : ariaLabelledBy,
|
|
163
|
+
onClick: onClick
|
|
164
|
+
}, blockEvents(isEffectivelyDisabled, {
|
|
165
|
+
onMouseDownCapture,
|
|
166
|
+
onMouseUpCapture,
|
|
167
|
+
onKeyDownCapture,
|
|
168
|
+
onKeyUpCapture,
|
|
169
|
+
onTouchStartCapture,
|
|
170
|
+
onTouchEndCapture,
|
|
171
|
+
onPointerDownCapture,
|
|
172
|
+
onPointerUpCapture,
|
|
173
|
+
onClickCapture
|
|
174
|
+
}), {
|
|
175
|
+
testId: testId,
|
|
176
|
+
onMouseOver: onMouseOver,
|
|
177
|
+
onFocus: onFocus,
|
|
178
|
+
onMouseMove: onMouseMove,
|
|
179
|
+
onBlur: onBlur,
|
|
180
|
+
type: type,
|
|
181
|
+
interactionName: interactionName,
|
|
182
|
+
onMouseDown: onMouseDown,
|
|
183
|
+
onMouseUp: onMouseUp,
|
|
184
|
+
onKeyDown: onKeyDown,
|
|
185
|
+
onMouseOut: onMouseOut,
|
|
186
|
+
onKeyUp: onKeyUp,
|
|
187
|
+
onTouchStart: onTouchStart,
|
|
188
|
+
onTouchEnd: onTouchEnd,
|
|
189
|
+
onPointerDown: onPointerDown,
|
|
190
|
+
onPointerUp: onPointerUp
|
|
191
|
+
}), /*#__PURE__*/React.createElement(Fragment, null, children, isLoading && /*#__PURE__*/React.createElement("span", {
|
|
192
|
+
className: ax([styles.loadingOverlay])
|
|
193
|
+
}, renderLoadingOverlay({
|
|
194
|
+
spacing: spacing,
|
|
195
|
+
appearance: appearance,
|
|
196
|
+
isDisabled: isDisabled,
|
|
197
|
+
isSelected: isSelected,
|
|
198
|
+
testId
|
|
199
|
+
})), isLoading && (ariaLabelledBy || !ariaLabel) && /*#__PURE__*/React.createElement(VisuallyHidden, {
|
|
200
|
+
id: loadingLabelId
|
|
201
|
+
}, LOADING_LABEL)));
|
|
202
|
+
});
|
|
203
|
+
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)}
|
|
@@ -1,53 +1,15 @@
|
|
|
1
|
+
/* content.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./content.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
1
4
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
whiteSpace: 'nowrap'
|
|
11
|
-
});
|
|
12
|
-
const iconStyles = xcss({
|
|
13
|
-
display: 'flex',
|
|
14
|
-
// icon size cannot grow and shrink
|
|
15
|
-
flexGrow: 0,
|
|
16
|
-
flexShrink: 0,
|
|
17
|
-
alignSelf: 'center',
|
|
18
|
-
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
19
|
-
fontSize: 0,
|
|
20
|
-
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
21
|
-
lineHeight: 0,
|
|
22
|
-
userSelect: 'none'
|
|
23
|
-
});
|
|
24
|
-
const commonStyles = xcss({
|
|
25
|
-
transition: 'opacity 0.3s'
|
|
26
|
-
});
|
|
27
|
-
const fadeStyles = xcss({
|
|
28
|
-
opacity: 0
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* These CSS variables consumed by the new icons, to allow them to have appropriate
|
|
33
|
-
* padding inside Button while also maintaining spacing for the existing icons.
|
|
34
|
-
*
|
|
35
|
-
* These styles can be removed once the new icons are fully rolled out, feature flag
|
|
36
|
-
* platform-visual-refresh-icons is cleaned up,
|
|
37
|
-
* and we bump Button to set padding based on the new icons.
|
|
38
|
-
*/
|
|
39
|
-
const beforeIconStyles = xcss({
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
'--ds--button--new-icon-padding-start': "var(--ds-space-050, 4px)",
|
|
42
|
-
// @ts-ignore
|
|
43
|
-
'--ds--button--new-icon-padding-end': "var(--ds-space-025, 2px)"
|
|
44
|
-
});
|
|
45
|
-
const afterIconStyles = xcss({
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
'--ds--button--new-icon-padding-start': "var(--ds-space-025, 2px)",
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
'--ds--button--new-icon-padding-end': "var(--ds-space-050, 4px)"
|
|
50
|
-
});
|
|
5
|
+
const styles = {
|
|
6
|
+
text: "_1reo15vq _18m915vq _16jlkb7n _1o9zkb7n _1bto1l2s _o5721q9c",
|
|
7
|
+
icon: "_1e0c1txw _16jlidpf _1o9zidpf _1wpz1h6o _1wybidpf _vwz4idpf _uiztglyw",
|
|
8
|
+
beforeIcon: "_1he91b66 _w795v77o",
|
|
9
|
+
afterIcon: "_1he9v77o _w7951b66",
|
|
10
|
+
common: "_v564g17y",
|
|
11
|
+
fade: "_tzy4idpf"
|
|
12
|
+
};
|
|
51
13
|
/**
|
|
52
14
|
* __Content__
|
|
53
15
|
*
|
|
@@ -59,9 +21,8 @@ const Content = ({
|
|
|
59
21
|
isLoading,
|
|
60
22
|
position
|
|
61
23
|
}) => {
|
|
62
|
-
return /*#__PURE__*/React.createElement(
|
|
63
|
-
|
|
64
|
-
xcss: [commonStyles, ...(type === 'text' ? [textStyles] : [iconStyles]), ...(isLoading ? [fadeStyles] : []), ...(position === 'before' ? [beforeIconStyles] : []), ...(position === 'after' ? [afterIconStyles] : [])]
|
|
24
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
25
|
+
className: ax([styles.common, type === 'text' && styles.text, type === 'icon' && styles.icon, isLoading && styles.fade, position === 'before' && styles.beforeIcon, position === 'after' && styles.afterIcon])
|
|
65
26
|
}, children);
|
|
66
27
|
};
|
|
67
28
|
export default Content;
|