@zendeskgarden/react-buttons 9.0.0-next.9 → 9.1.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/dist/esm/elements/Anchor.js +10 -5
- package/dist/esm/elements/Button.js +30 -12
- package/dist/esm/elements/ChevronButton.js +3 -8
- package/dist/esm/elements/IconButton.js +22 -10
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/new-window-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +1 -1
- package/dist/esm/styled/StyledAnchor.js +4 -7
- package/dist/esm/styled/StyledButton.js +239 -76
- package/dist/esm/styled/StyledExternalIcon.js +2 -5
- package/dist/esm/styled/StyledIcon.js +2 -5
- package/dist/esm/styled/StyledIconButton.js +38 -16
- package/dist/esm/styled/StyledSplitButton.js +2 -5
- package/dist/index.cjs.js +344 -141
- package/dist/typings/elements/Button.d.ts +3 -1
- package/dist/typings/styled/StyledAnchor.d.ts +1 -8
- package/dist/typings/styled/StyledButton.d.ts +16 -7
- package/dist/typings/styled/StyledIcon.d.ts +1 -2
- package/dist/typings/styled/StyledIconButton.d.ts +4 -3
- package/dist/typings/styled/index.d.ts +2 -2
- package/dist/typings/types/index.d.ts +2 -0
- package/dist/typings/utils/useSplitButtonContext.d.ts +0 -1
- package/package.json +7 -7
package/dist/index.cjs.js
CHANGED
|
@@ -41,14 +41,11 @@ const SIZE = ['small', 'medium', 'large'];
|
|
|
41
41
|
const COMPONENT_ID$5 = 'buttons.button_group_view';
|
|
42
42
|
const StyledSplitButton = styled__default.default.div.attrs({
|
|
43
43
|
'data-garden-id': COMPONENT_ID$5,
|
|
44
|
-
'data-garden-version': '9.
|
|
44
|
+
'data-garden-version': '9.1.0'
|
|
45
45
|
}).withConfig({
|
|
46
46
|
displayName: "StyledSplitButton",
|
|
47
47
|
componentId: "sc-1u4v04v-0"
|
|
48
48
|
})(["display:inline-flex;position:relative;z-index:0;direction:", ";white-space:nowrap;", ";"], props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
49
|
-
StyledSplitButton.defaultProps = {
|
|
50
|
-
theme: reactTheming.DEFAULT_THEME
|
|
51
|
-
};
|
|
52
49
|
|
|
53
50
|
const COMPONENT_ID$4 = 'buttons.icon';
|
|
54
51
|
const sizeStyles$1 = props => {
|
|
@@ -62,92 +59,249 @@ const sizeStyles$1 = props => {
|
|
|
62
59
|
};
|
|
63
60
|
const StyledIcon = styled__default.default(reactTheming.StyledBaseIcon).attrs({
|
|
64
61
|
'data-garden-id': COMPONENT_ID$4,
|
|
65
|
-
'data-garden-version': '9.
|
|
62
|
+
'data-garden-version': '9.1.0'
|
|
66
63
|
}).withConfig({
|
|
67
64
|
displayName: "StyledIcon",
|
|
68
65
|
componentId: "sc-19meqgg-0"
|
|
69
66
|
})(["transform:", ";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;", ";", ";"], props => props.$isRotated && `rotate(${props.theme.rtl ? '-' : '+'}180deg)`, props => sizeStyles$1(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
70
|
-
StyledIcon.defaultProps = {
|
|
71
|
-
theme: reactTheming.DEFAULT_THEME
|
|
72
|
-
};
|
|
73
67
|
|
|
74
68
|
const COMPONENT_ID$3 = 'buttons.button';
|
|
75
69
|
const getBorderRadius = props => {
|
|
76
|
-
if (props
|
|
70
|
+
if (props.$isPill) {
|
|
77
71
|
return '100px';
|
|
78
72
|
}
|
|
79
73
|
return props.theme.borderRadii.md;
|
|
80
74
|
};
|
|
81
|
-
const getDisabledBackgroundColor = props => {
|
|
82
|
-
return reactTheming.getColorV8('neutralHue', 200, props.theme);
|
|
83
|
-
};
|
|
84
75
|
const getHeight = props => {
|
|
85
|
-
if (props
|
|
76
|
+
if (props.$size === 'small') {
|
|
86
77
|
return `${props.theme.space.base * 8}px`;
|
|
87
|
-
} else if (props
|
|
78
|
+
} else if (props.$size === 'large') {
|
|
88
79
|
return `${props.theme.space.base * 12}px`;
|
|
89
80
|
}
|
|
90
81
|
return `${props.theme.space.base * 10}px`;
|
|
91
82
|
};
|
|
92
|
-
const colorStyles =
|
|
83
|
+
const colorStyles = _ref => {
|
|
84
|
+
let {
|
|
85
|
+
theme,
|
|
86
|
+
$isLink,
|
|
87
|
+
$isBasic,
|
|
88
|
+
$isDanger,
|
|
89
|
+
$isNeutral,
|
|
90
|
+
$isPrimary,
|
|
91
|
+
$focusInset
|
|
92
|
+
} = _ref;
|
|
93
93
|
let retVal;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
94
|
+
const disabledBackgroundColor = reactTheming.getColor({
|
|
95
|
+
theme,
|
|
96
|
+
variable: 'background.disabled'
|
|
97
|
+
});
|
|
98
|
+
const disabledForegroundColor = reactTheming.getColor({
|
|
99
|
+
theme,
|
|
100
|
+
variable: 'foreground.disabled'
|
|
101
|
+
});
|
|
102
|
+
const offset100 = {
|
|
103
|
+
dark: {
|
|
104
|
+
offset: -100
|
|
105
|
+
},
|
|
106
|
+
light: {
|
|
107
|
+
offset: 100
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const offset200 = {
|
|
111
|
+
dark: {
|
|
112
|
+
offset: -200
|
|
113
|
+
},
|
|
114
|
+
light: {
|
|
115
|
+
offset: 200
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
if ($isLink) {
|
|
119
|
+
const options = {
|
|
120
|
+
theme,
|
|
121
|
+
variable: $isDanger ? 'foreground.danger' : 'foreground.primary'
|
|
122
|
+
};
|
|
123
|
+
const foregroundColor = reactTheming.getColor(options);
|
|
124
|
+
const hoverForegroundColor = reactTheming.getColor({
|
|
125
|
+
...options,
|
|
126
|
+
...offset100
|
|
127
|
+
});
|
|
128
|
+
const activeForegroundColor = reactTheming.getColor({
|
|
129
|
+
...options,
|
|
130
|
+
...offset200
|
|
131
|
+
});
|
|
132
|
+
const focusOutlineColor = reactTheming.getColor({
|
|
133
|
+
theme,
|
|
134
|
+
variable: 'border.primaryEmphasis'
|
|
135
|
+
});
|
|
136
|
+
retVal = styled.css(["outline-color:transparent;background-color:transparent;color:", ";", " &:hover{color:", ";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{color:", ";}&:disabled{color:", ";}"], foregroundColor, reactTheming.focusStyles({
|
|
137
|
+
theme,
|
|
112
138
|
condition: false,
|
|
113
139
|
styles: {
|
|
114
|
-
color:
|
|
115
|
-
outlineColor:
|
|
140
|
+
color: foregroundColor ,
|
|
141
|
+
outlineColor: focusOutlineColor
|
|
116
142
|
}
|
|
117
|
-
}),
|
|
118
|
-
} else if (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
143
|
+
}), hoverForegroundColor, activeForegroundColor, disabledForegroundColor);
|
|
144
|
+
} else if ($isPrimary) {
|
|
145
|
+
let backgroundVariable;
|
|
146
|
+
if ($isDanger) {
|
|
147
|
+
backgroundVariable = 'background.dangerEmphasis';
|
|
148
|
+
} else if ($isNeutral) {
|
|
149
|
+
backgroundVariable = 'background.emphasis';
|
|
150
|
+
} else {
|
|
151
|
+
backgroundVariable = 'background.primaryEmphasis';
|
|
152
|
+
}
|
|
153
|
+
const options = {
|
|
154
|
+
theme,
|
|
155
|
+
variable: backgroundVariable
|
|
156
|
+
};
|
|
157
|
+
const backgroundColor = reactTheming.getColor(options);
|
|
158
|
+
const hoverBackgroundColor = reactTheming.getColor({
|
|
159
|
+
...options,
|
|
160
|
+
...offset100
|
|
161
|
+
});
|
|
162
|
+
const activeBackgroundColor = reactTheming.getColor({
|
|
163
|
+
...options,
|
|
164
|
+
...offset200
|
|
165
|
+
});
|
|
166
|
+
const foregroundColor = reactTheming.getColor({
|
|
167
|
+
theme,
|
|
168
|
+
variable: 'foreground.onEmphasis'
|
|
169
|
+
});
|
|
170
|
+
retVal = styled.css(["outline-color:transparent;background-color:", ";color:", ";&:hover{background-color:", ";}", " &:active,&[aria-pressed='true'],&[aria-pressed='mixed']{background-color:", ";}&:disabled{background-color:", ";color:", ";}"], backgroundColor, foregroundColor, hoverBackgroundColor, reactTheming.focusStyles({
|
|
171
|
+
theme,
|
|
172
|
+
inset: $focusInset,
|
|
173
|
+
shadowWidth: $focusInset ? 'sm' : 'md',
|
|
174
|
+
spacerWidth: $focusInset ? 'sm' : 'xs',
|
|
175
|
+
styles: ($isDanger || $isNeutral) && $focusInset ? {
|
|
176
|
+
borderColor: reactTheming.getColor({
|
|
177
|
+
theme,
|
|
178
|
+
variable: 'border.primaryEmphasis'
|
|
179
|
+
})
|
|
126
180
|
} : undefined
|
|
127
|
-
}),
|
|
181
|
+
}), activeBackgroundColor, disabledBackgroundColor, disabledForegroundColor);
|
|
128
182
|
} else {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
183
|
+
let borderColor;
|
|
184
|
+
let hoverBorderColor;
|
|
185
|
+
let activeBorderColor;
|
|
186
|
+
let focusBorderColor;
|
|
187
|
+
let backgroundVariable;
|
|
188
|
+
let foregroundVariable;
|
|
189
|
+
if ($isDanger) {
|
|
190
|
+
if (!$isBasic) {
|
|
191
|
+
const borderOptions = {
|
|
192
|
+
theme,
|
|
193
|
+
variable: 'border.dangerEmphasis'
|
|
194
|
+
};
|
|
195
|
+
borderColor = reactTheming.getColor(borderOptions);
|
|
196
|
+
hoverBorderColor = reactTheming.getColor({
|
|
197
|
+
...borderOptions,
|
|
198
|
+
...offset100
|
|
199
|
+
});
|
|
200
|
+
activeBorderColor = reactTheming.getColor({
|
|
201
|
+
...borderOptions,
|
|
202
|
+
...offset200
|
|
203
|
+
});
|
|
204
|
+
if ($isNeutral) {
|
|
205
|
+
focusBorderColor = reactTheming.getColor(borderOptions);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
backgroundVariable = 'background.dangerEmphasis';
|
|
209
|
+
foregroundVariable = $isNeutral ? 'foreground.default' : 'foreground.danger';
|
|
210
|
+
} else {
|
|
211
|
+
if (!$isBasic) {
|
|
212
|
+
const borderOptions = {
|
|
213
|
+
theme,
|
|
214
|
+
variable: 'border.primaryEmphasis'
|
|
215
|
+
};
|
|
216
|
+
if ($isNeutral) {
|
|
217
|
+
borderColor = reactTheming.getColor({
|
|
218
|
+
theme,
|
|
219
|
+
variable: 'border.default',
|
|
220
|
+
...offset100
|
|
221
|
+
});
|
|
222
|
+
hoverBorderColor = reactTheming.getColor(borderOptions);
|
|
223
|
+
focusBorderColor = hoverBorderColor;
|
|
224
|
+
activeBorderColor = reactTheming.getColor({
|
|
225
|
+
...borderOptions,
|
|
226
|
+
...offset100
|
|
227
|
+
});
|
|
228
|
+
} else {
|
|
229
|
+
borderColor = reactTheming.getColor(borderOptions);
|
|
230
|
+
hoverBorderColor = reactTheming.getColor({
|
|
231
|
+
...borderOptions,
|
|
232
|
+
...offset100
|
|
233
|
+
});
|
|
234
|
+
activeBorderColor = reactTheming.getColor({
|
|
235
|
+
...borderOptions,
|
|
236
|
+
...offset200
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
backgroundVariable = 'background.primaryEmphasis';
|
|
241
|
+
foregroundVariable = $isNeutral ? 'foreground.default' : 'foreground.primary';
|
|
242
|
+
}
|
|
243
|
+
const hoverBackgroundColor = reactTheming.getColor({
|
|
244
|
+
theme,
|
|
245
|
+
variable: backgroundVariable,
|
|
246
|
+
transparency: theme.opacity[100]
|
|
247
|
+
});
|
|
248
|
+
const activeBackgroundColor = reactTheming.getColor({
|
|
249
|
+
theme,
|
|
250
|
+
variable: backgroundVariable,
|
|
251
|
+
transparency: theme.opacity[200]
|
|
252
|
+
});
|
|
253
|
+
const foregroundOptions = {
|
|
254
|
+
theme,
|
|
255
|
+
variable: foregroundVariable
|
|
256
|
+
};
|
|
257
|
+
const foregroundColor = reactTheming.getColor(foregroundOptions);
|
|
258
|
+
let hoverForegroundColor;
|
|
259
|
+
let activeForegroundColor;
|
|
260
|
+
let iconForegroundColor;
|
|
261
|
+
let hoverIconForegroundColor;
|
|
262
|
+
let activeIconForegroundColor;
|
|
263
|
+
if ($isNeutral) {
|
|
264
|
+
const iconOptions = {
|
|
265
|
+
theme,
|
|
266
|
+
variable: 'foreground.subtle'
|
|
267
|
+
};
|
|
268
|
+
iconForegroundColor = reactTheming.getColor(iconOptions);
|
|
269
|
+
hoverIconForegroundColor = reactTheming.getColor({
|
|
270
|
+
...iconOptions,
|
|
271
|
+
...offset100
|
|
272
|
+
});
|
|
273
|
+
activeIconForegroundColor = reactTheming.getColor({
|
|
274
|
+
...iconOptions,
|
|
275
|
+
...offset200
|
|
276
|
+
});
|
|
277
|
+
} else {
|
|
278
|
+
hoverForegroundColor = reactTheming.getColor({
|
|
279
|
+
...foregroundOptions,
|
|
280
|
+
...offset100
|
|
281
|
+
});
|
|
282
|
+
activeForegroundColor = reactTheming.getColor({
|
|
283
|
+
...foregroundOptions,
|
|
284
|
+
...offset200
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
retVal = styled.css(["outline-color:transparent;border-color:", ";background-color:transparent;color:", ";&:hover{border-color:", ";background-color:", ";color:", ";}", " &:active,&[aria-pressed='true'],&[aria-pressed='mixed']{border-color:", ";background-color:", ";color:", ";}&:disabled{border-color:transparent;background-color:", ";color:", ";}& ", "{color:", ";}&:hover ", ",&:focus-visible ", "{color:", ";}&:active ", "{color:", ";}&:disabled ", "{color:", ";}"], borderColor, foregroundColor, hoverBorderColor, hoverBackgroundColor, hoverForegroundColor, reactTheming.focusStyles({
|
|
288
|
+
theme,
|
|
289
|
+
inset: $focusInset,
|
|
290
|
+
styles: {
|
|
291
|
+
borderColor: focusBorderColor
|
|
292
|
+
}
|
|
293
|
+
}), activeBorderColor, activeBackgroundColor, activeForegroundColor, disabledBackgroundColor, disabledForegroundColor, StyledIcon, iconForegroundColor, StyledIcon, StyledIcon, hoverIconForegroundColor, StyledIcon, activeIconForegroundColor, StyledIcon, disabledForegroundColor);
|
|
140
294
|
}
|
|
141
295
|
return retVal;
|
|
142
296
|
};
|
|
143
|
-
const groupStyles =
|
|
144
|
-
|
|
297
|
+
const groupStyles = _ref2 => {
|
|
298
|
+
let {
|
|
145
299
|
theme,
|
|
146
|
-
isPrimary,
|
|
147
|
-
isBasic,
|
|
148
|
-
isPill,
|
|
149
|
-
focusInset
|
|
150
|
-
} =
|
|
300
|
+
$isPrimary,
|
|
301
|
+
$isBasic,
|
|
302
|
+
$isPill,
|
|
303
|
+
$focusInset
|
|
304
|
+
} = _ref2;
|
|
151
305
|
const {
|
|
152
306
|
rtl,
|
|
153
307
|
borderWidths,
|
|
@@ -156,14 +310,20 @@ const groupStyles = props => {
|
|
|
156
310
|
const startPosition = rtl ? 'right' : 'left';
|
|
157
311
|
const endPosition = rtl ? 'left' : 'right';
|
|
158
312
|
const marginOffset = borderWidths.sm;
|
|
159
|
-
const marginDisplacement = `${isPrimary || isBasic ? '' : '-'}${marginOffset}`;
|
|
160
|
-
const iconMarginDisplacement = isPill && '-2px';
|
|
161
|
-
const disabledBackgroundColor =
|
|
162
|
-
const borderColor = isBasic ? 'transparent' : 'revert';
|
|
163
|
-
const focusColor = reactTheming.getColorV8('primaryHue', 600, theme);
|
|
164
|
-
const focusBoxShadow = isBasic && !isPrimary && reactTheming.getFocusBoxShadow({
|
|
313
|
+
const marginDisplacement = `${$isPrimary || $isBasic ? '' : '-'}${marginOffset}`;
|
|
314
|
+
const iconMarginDisplacement = $isPill && '-2px';
|
|
315
|
+
const disabledBackgroundColor = !$isPrimary && reactTheming.getColor({
|
|
165
316
|
theme,
|
|
166
|
-
|
|
317
|
+
variable: 'background.disabled'
|
|
318
|
+
});
|
|
319
|
+
const borderColor = $isBasic ? 'transparent' : 'revert';
|
|
320
|
+
const focusColor = reactTheming.getColor({
|
|
321
|
+
theme,
|
|
322
|
+
variable: 'border.primaryEmphasis'
|
|
323
|
+
});
|
|
324
|
+
const focusBoxShadow = $isBasic && !$isPrimary && reactTheming.getFocusBoxShadow({
|
|
325
|
+
theme,
|
|
326
|
+
inset: $focusInset,
|
|
167
327
|
spacerColor: {
|
|
168
328
|
hue: focusColor
|
|
169
329
|
},
|
|
@@ -174,24 +334,24 @@ const groupStyles = props => {
|
|
|
174
334
|
return styled.css(["position:relative;transition:border-color 0.1s ease-in-out,background-color 0.1s ease-in-out,box-shadow 0.1s ease-in-out,color 0.1s ease-in-out,margin-", " 0.1s ease-in-out,outline-color 0.1s ease-in-out,z-index 0.25s ease-in-out;border:", " ", ";", "{border-color:", ";box-shadow:", ";}&:hover,&:active,", "{z-index:1;}&:disabled{z-index:-1;background-color:", ";}&:not(:first-of-type){margin-", ":", ";}&:not(:first-of-type):disabled{margin-", ":", ";}&:not(:first-of-type):not(:last-of-type){border-radius:0;}&:first-of-type:not(:last-of-type){border-top-", "-radius:0;border-bottom-", "-radius:0;}&:last-of-type:not(:first-of-type){border-top-", "-radius:0;border-bottom-", "-radius:0;}&:first-of-type:not(:last-of-type) ", "{margin-", ":", ";}&:last-of-type:not(:first-of-type) ", "{margin-", ":", ";}"], startPosition, borders.sm, borderColor, reactTheming.SELECTOR_FOCUS_VISIBLE, focusColor, focusBoxShadow, reactTheming.SELECTOR_FOCUS_VISIBLE, disabledBackgroundColor, startPosition, marginDisplacement, startPosition, marginOffset, endPosition, endPosition, startPosition, startPosition, StyledIcon, endPosition, iconMarginDisplacement, StyledIcon, startPosition, iconMarginDisplacement);
|
|
175
335
|
};
|
|
176
336
|
const iconStyles$1 = props => {
|
|
177
|
-
const size = props
|
|
178
|
-
return styled.css(["width:", ";min-width:", ";height:", ";vertical-align:", ";"], size, size, size, props
|
|
337
|
+
const $size = props.$size === 'small' ? props.theme.iconSizes.sm : props.theme.iconSizes.md;
|
|
338
|
+
return styled.css(["width:", ";min-width:", ";height:", ";vertical-align:", ";"], $size, $size, $size, props.$isLink && 'middle');
|
|
179
339
|
};
|
|
180
340
|
const sizeStyles = props => {
|
|
181
341
|
let retVal;
|
|
182
|
-
if (props
|
|
342
|
+
if (props.$isLink) {
|
|
183
343
|
retVal = styled.css(["padding:0;font-size:inherit;"]);
|
|
184
344
|
} else {
|
|
185
345
|
const height = getHeight(props);
|
|
186
346
|
const lineHeight = polished.math(`${height} - (${props.theme.borderWidths.sm} * 2)`);
|
|
187
347
|
let padding;
|
|
188
348
|
let fontSize;
|
|
189
|
-
if (props
|
|
349
|
+
if (props.$size === 'small') {
|
|
190
350
|
fontSize = props.theme.fontSizes.sm;
|
|
191
351
|
padding = `${props.theme.space.base * 3}px`;
|
|
192
352
|
} else {
|
|
193
353
|
fontSize = props.theme.fontSizes.md;
|
|
194
|
-
if (props
|
|
354
|
+
if (props.$size === 'large') {
|
|
195
355
|
padding = `${props.theme.space.base * 5}px`;
|
|
196
356
|
} else {
|
|
197
357
|
padding = `${props.theme.space.base * 4}px`;
|
|
@@ -202,35 +362,29 @@ const sizeStyles = props => {
|
|
|
202
362
|
return retVal;
|
|
203
363
|
};
|
|
204
364
|
const StyledButton = styled__default.default.button.attrs(props => ({
|
|
205
|
-
'data-garden-id': COMPONENT_ID$3,
|
|
206
|
-
'data-garden-version': '9.
|
|
365
|
+
'data-garden-id': props['data-garden-id'] || COMPONENT_ID$3,
|
|
366
|
+
'data-garden-version': '9.1.0',
|
|
207
367
|
type: props.type || 'button'
|
|
208
368
|
})).withConfig({
|
|
209
369
|
displayName: "StyledButton",
|
|
210
370
|
componentId: "sc-qe3ace-0"
|
|
211
|
-
})(["display:", ";align-items:", ";justify-content:", ";transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out,outline-color 0.1s ease-in-out,z-index 0.25s ease-in-out;margin:0;border:", ";border-radius:", ";cursor:pointer;width:", ";overflow:hidden;text-decoration:
|
|
212
|
-
StyledButton.defaultProps = {
|
|
213
|
-
theme: reactTheming.DEFAULT_THEME
|
|
214
|
-
};
|
|
371
|
+
})(["display:", ";align-items:", ";justify-content:", ";transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out,outline-color 0.1s ease-in-out,z-index 0.25s ease-in-out;margin:0;border:", ";border-radius:", ";cursor:pointer;width:", ";overflow:hidden;text-decoration:", ";text-overflow:ellipsis;white-space:", ";font-family:inherit;font-weight:", ";-webkit-font-smoothing:subpixel-antialiased;box-sizing:border-box;user-select:", ";-webkit-touch-callout:none;", ";&::-moz-focus-inner{border:0;padding:0;}", "{text-decoration:none;}&:hover{text-decoration:", ";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{transition:border-color 0.1s ease-in-out,background-color 0.1s ease-in-out,box-shadow 0.1s ease-in-out,color 0.1s ease-in-out,outline-color 0.1s ease-in-out,z-index 0.25s ease-in-out;text-decoration:", ";}", ";&:disabled{cursor:default;text-decoration:", ";}& ", "{", "}", " &&{", "}", ""], props => props.$isLink ? 'inline' : 'inline-flex', props => !props.$isLink && 'center', props => !props.$isLink && 'center', props => `${props.$isLink ? `0px solid` : props.theme.borders.sm} transparent`, props => getBorderRadius(props), props => props.$isStretched ? '100%' : '', props => props.$isUnderlined ? 'underline' : 'none', props => !props.$isLink && 'nowrap', props => props.$isLink ? 'inherit' : props.theme.fontWeights.regular, props => !props.$isLink && 'none', props => sizeStyles(props), reactTheming.SELECTOR_FOCUS_VISIBLE, props => props.$isLink ? 'underline' : 'none', props => props.$isLink ? 'underline' : 'none', props => colorStyles(props), props => props.$isLink && 'none', StyledIcon, props => iconStyles$1(props), StyledSplitButton, props => groupStyles(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
215
372
|
|
|
216
373
|
const COMPONENT_ID$2 = 'buttons.anchor';
|
|
217
374
|
const StyledAnchor = styled__default.default(StyledButton).attrs(props => ({
|
|
218
375
|
'data-garden-id': COMPONENT_ID$2,
|
|
219
|
-
'data-garden-version': '9.
|
|
376
|
+
'data-garden-version': '9.1.0',
|
|
220
377
|
as: 'a',
|
|
221
378
|
dir: props.theme.rtl ? 'rtl' : undefined,
|
|
222
|
-
isLink: true,
|
|
379
|
+
$isLink: true,
|
|
223
380
|
type: undefined
|
|
224
381
|
})).withConfig({
|
|
225
382
|
displayName: "StyledAnchor",
|
|
226
383
|
componentId: "sc-xshgmo-0"
|
|
227
|
-
})(["direction:", ";", ";"], props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(
|
|
228
|
-
StyledAnchor.defaultProps = {
|
|
229
|
-
theme: reactTheming.DEFAULT_THEME
|
|
230
|
-
};
|
|
384
|
+
})(["direction:", ";", ";"], props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(props['data-garden-id'], props));
|
|
231
385
|
|
|
232
386
|
var _path$1;
|
|
233
|
-
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (
|
|
387
|
+
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
234
388
|
var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
235
389
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
236
390
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -250,41 +404,60 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
|
250
404
|
const COMPONENT_ID$1 = 'buttons.external_icon';
|
|
251
405
|
const StyledExternalIcon = styled__default.default(SvgNewWindowStroke).attrs({
|
|
252
406
|
'data-garden-id': COMPONENT_ID$1,
|
|
253
|
-
'data-garden-version': '9.
|
|
407
|
+
'data-garden-version': '9.1.0'
|
|
254
408
|
}).withConfig({
|
|
255
409
|
displayName: "StyledExternalIcon",
|
|
256
410
|
componentId: "sc-16oz07e-0"
|
|
257
411
|
})(["transform:", ";margin-bottom:-0.085em;padding-left:0.25em;box-sizing:content-box;width:0.85em;height:0.85em;", ";"], props => props.theme.rtl && 'scaleX(-1)', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
258
|
-
StyledExternalIcon.defaultProps = {
|
|
259
|
-
theme: reactTheming.DEFAULT_THEME
|
|
260
|
-
};
|
|
261
412
|
|
|
262
413
|
const COMPONENT_ID = 'buttons.icon_button';
|
|
263
|
-
const iconColorStyles =
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const
|
|
414
|
+
const iconColorStyles = _ref => {
|
|
415
|
+
let {
|
|
416
|
+
theme
|
|
417
|
+
} = _ref;
|
|
418
|
+
const options = {
|
|
419
|
+
theme,
|
|
420
|
+
variable: 'foreground.subtle'
|
|
421
|
+
};
|
|
422
|
+
const baseColor = reactTheming.getColor(options);
|
|
423
|
+
const hoverColor = reactTheming.getColor({
|
|
424
|
+
...options,
|
|
425
|
+
dark: {
|
|
426
|
+
offset: -100
|
|
427
|
+
},
|
|
428
|
+
light: {
|
|
429
|
+
offset: 100
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
const activeColor = reactTheming.getColor({
|
|
433
|
+
...options,
|
|
434
|
+
dark: {
|
|
435
|
+
offset: -200
|
|
436
|
+
},
|
|
437
|
+
light: {
|
|
438
|
+
offset: 200
|
|
439
|
+
}
|
|
440
|
+
});
|
|
268
441
|
return styled.css(["color:", ";&:hover{color:", ";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{color:", ";}"], baseColor, hoverColor, activeColor);
|
|
269
442
|
};
|
|
270
443
|
const iconButtonStyles = props => {
|
|
271
444
|
const width = getHeight(props);
|
|
272
|
-
return styled.css(["border:", ";padding:0;width:", ";min-width:", ";", ";&:disabled{background-color:", ";}"], props
|
|
445
|
+
return styled.css(["border:", ";padding:0;width:", ";min-width:", ";", ";&:disabled{background-color:", ";}"], props.$isBasic && 'none', width, width, props.$isBasic && !(props.$isPrimary || props.$isDanger || props.disabled) && iconColorStyles(props), !props.$isPrimary && 'transparent');
|
|
273
446
|
};
|
|
274
447
|
const iconStyles = props => {
|
|
275
448
|
const size = props.theme.iconSizes.md;
|
|
276
449
|
return styled.css(["width:", ";height:", ";& > svg{transition:opacity 0.15s ease-in-out;}"], size, size);
|
|
277
450
|
};
|
|
278
|
-
const StyledIconButton = styled__default.default(StyledButton).attrs({
|
|
279
|
-
'data-garden-id'
|
|
280
|
-
|
|
451
|
+
const StyledIconButton = styled__default.default(StyledButton).attrs(props => {
|
|
452
|
+
const externalId = props['data-garden-id'];
|
|
453
|
+
return {
|
|
454
|
+
'data-garden-id': externalId && externalId !== COMPONENT_ID$3 ? externalId : COMPONENT_ID,
|
|
455
|
+
'data-garden-version': '9.1.0'
|
|
456
|
+
};
|
|
281
457
|
}).withConfig({
|
|
282
458
|
displayName: "StyledIconButton",
|
|
283
459
|
componentId: "sc-1t0ughp-0"
|
|
284
|
-
})(["", ";& ", "{", "}", ";"],
|
|
285
|
-
StyledIconButton.defaultProps = {
|
|
286
|
-
theme: reactTheming.DEFAULT_THEME
|
|
287
|
-
};
|
|
460
|
+
})(["", ";& ", "{", "}", ";"], iconButtonStyles, StyledIcon, iconStyles, props => reactTheming.retrieveComponentStyles(props['data-garden-id'], props));
|
|
288
461
|
|
|
289
462
|
const SplitButtonContext = React.createContext(undefined);
|
|
290
463
|
const useSplitButtonContext = () => {
|
|
@@ -317,25 +490,43 @@ const EndIconComponent = _ref => {
|
|
|
317
490
|
EndIconComponent.displayName = 'Button.EndIcon';
|
|
318
491
|
const EndIcon = EndIconComponent;
|
|
319
492
|
|
|
320
|
-
const ButtonComponent = React.forwardRef((
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
493
|
+
const ButtonComponent = React.forwardRef((_ref, ref) => {
|
|
494
|
+
let {
|
|
495
|
+
focusInset,
|
|
496
|
+
isBasic,
|
|
497
|
+
isDanger,
|
|
498
|
+
isLink,
|
|
499
|
+
isNeutral,
|
|
500
|
+
isPill,
|
|
501
|
+
isPrimary,
|
|
502
|
+
isStretched,
|
|
503
|
+
size,
|
|
504
|
+
...other
|
|
505
|
+
} = _ref;
|
|
506
|
+
const splitButtonFocusInset = useSplitButtonContext();
|
|
507
|
+
return React__namespace.default.createElement(StyledButton, Object.assign({}, other, {
|
|
508
|
+
$focusInset: focusInset || splitButtonFocusInset,
|
|
509
|
+
$isBasic: isBasic,
|
|
510
|
+
$isDanger: isDanger,
|
|
511
|
+
$isLink: isLink,
|
|
512
|
+
$isNeutral: isNeutral,
|
|
513
|
+
$isPill: isPill,
|
|
514
|
+
$isPrimary: isPrimary,
|
|
515
|
+
$isStretched: isStretched,
|
|
516
|
+
$isUnderlined: isLink,
|
|
517
|
+
$size: size,
|
|
327
518
|
ref: ref
|
|
328
519
|
}));
|
|
329
520
|
});
|
|
330
521
|
ButtonComponent.displayName = 'Button';
|
|
331
522
|
ButtonComponent.propTypes = {
|
|
332
|
-
isNeutral: PropTypes__default.default.bool,
|
|
333
|
-
isPrimary: PropTypes__default.default.bool,
|
|
334
|
-
isDanger: PropTypes__default.default.bool,
|
|
335
|
-
isPill: PropTypes__default.default.bool,
|
|
336
|
-
isBasic: PropTypes__default.default.bool,
|
|
337
523
|
focusInset: PropTypes__default.default.bool,
|
|
524
|
+
isBasic: PropTypes__default.default.bool,
|
|
525
|
+
isDanger: PropTypes__default.default.bool,
|
|
338
526
|
isLink: PropTypes__default.default.bool,
|
|
527
|
+
isNeutral: PropTypes__default.default.bool,
|
|
528
|
+
isPill: PropTypes__default.default.bool,
|
|
529
|
+
isPrimary: PropTypes__default.default.bool,
|
|
339
530
|
isStretched: PropTypes__default.default.bool,
|
|
340
531
|
size: PropTypes__default.default.oneOf(SIZE)
|
|
341
532
|
};
|
|
@@ -349,11 +540,13 @@ Button.StartIcon = StartIcon;
|
|
|
349
540
|
const Anchor = React.forwardRef((_ref, ref) => {
|
|
350
541
|
let {
|
|
351
542
|
children,
|
|
352
|
-
isExternal,
|
|
353
543
|
externalIconLabel,
|
|
354
|
-
|
|
544
|
+
isDanger,
|
|
545
|
+
isExternal,
|
|
546
|
+
isUnderlined = true,
|
|
547
|
+
...other
|
|
355
548
|
} = _ref;
|
|
356
|
-
let anchorProps =
|
|
549
|
+
let anchorProps = other;
|
|
357
550
|
if (isExternal) {
|
|
358
551
|
anchorProps = {
|
|
359
552
|
target: '_blank',
|
|
@@ -368,8 +561,10 @@ const Anchor = React.forwardRef((_ref, ref) => {
|
|
|
368
561
|
};
|
|
369
562
|
const iconAriaLabel = reactTheming.useText(Anchor, checkProps, isExternal ? 'externalIconLabel' : 'noIconLabel', '(opens in a new tab)');
|
|
370
563
|
return React__namespace.default.createElement(StyledAnchor, Object.assign({
|
|
371
|
-
ref: ref
|
|
372
|
-
|
|
564
|
+
ref: ref,
|
|
565
|
+
$isDanger: isDanger,
|
|
566
|
+
$isUnderlined: isUnderlined
|
|
567
|
+
}, anchorProps), children, !!isExternal &&
|
|
373
568
|
React__namespace.default.createElement(StyledExternalIcon, {
|
|
374
569
|
role: "img",
|
|
375
570
|
"aria-label": iconAriaLabel,
|
|
@@ -380,34 +575,47 @@ Anchor.displayName = 'Anchor';
|
|
|
380
575
|
Anchor.propTypes = {
|
|
381
576
|
isExternal: PropTypes__default.default.bool,
|
|
382
577
|
isDanger: PropTypes__default.default.bool,
|
|
578
|
+
isUnderlined: PropTypes__default.default.bool,
|
|
383
579
|
externalIconLabel: PropTypes__default.default.string
|
|
384
580
|
};
|
|
385
581
|
|
|
386
582
|
const IconButton = React.forwardRef((_ref, ref) => {
|
|
387
583
|
let {
|
|
388
584
|
children,
|
|
585
|
+
focusInset,
|
|
586
|
+
isBasic,
|
|
587
|
+
isDanger,
|
|
588
|
+
isNeutral,
|
|
589
|
+
isPill,
|
|
590
|
+
isPrimary,
|
|
389
591
|
isRotated,
|
|
390
|
-
|
|
592
|
+
size,
|
|
593
|
+
...other
|
|
391
594
|
} = _ref;
|
|
392
|
-
const
|
|
393
|
-
return React__namespace.default.createElement(StyledIconButton, Object.assign({
|
|
595
|
+
const splitButtonFocusInset = useSplitButtonContext();
|
|
596
|
+
return React__namespace.default.createElement(StyledIconButton, Object.assign({}, other, {
|
|
597
|
+
$isBasic: isBasic,
|
|
598
|
+
$isDanger: isDanger,
|
|
599
|
+
$isNeutral: isNeutral,
|
|
600
|
+
$isPill: isPill,
|
|
601
|
+
$isPrimary: isPrimary,
|
|
602
|
+
$size: size,
|
|
603
|
+
$focusInset: focusInset || splitButtonFocusInset,
|
|
394
604
|
ref: ref
|
|
395
|
-
}, otherProps, {
|
|
396
|
-
focusInset: otherProps.focusInset || focusInset
|
|
397
605
|
}), React__namespace.default.createElement(StyledIcon, {
|
|
398
606
|
$isRotated: isRotated
|
|
399
607
|
}, children));
|
|
400
608
|
});
|
|
401
609
|
IconButton.displayName = 'IconButton';
|
|
402
610
|
IconButton.propTypes = {
|
|
611
|
+
focusInset: PropTypes__default.default.bool,
|
|
612
|
+
isBasic: PropTypes__default.default.bool,
|
|
403
613
|
isDanger: PropTypes__default.default.bool,
|
|
404
|
-
size: PropTypes__default.default.oneOf(SIZE),
|
|
405
614
|
isNeutral: PropTypes__default.default.bool,
|
|
406
|
-
isPrimary: PropTypes__default.default.bool,
|
|
407
|
-
isBasic: PropTypes__default.default.bool,
|
|
408
615
|
isPill: PropTypes__default.default.bool,
|
|
409
|
-
|
|
410
|
-
isRotated: PropTypes__default.default.bool
|
|
616
|
+
isPrimary: PropTypes__default.default.bool,
|
|
617
|
+
isRotated: PropTypes__default.default.bool,
|
|
618
|
+
size: PropTypes__default.default.oneOf(SIZE)
|
|
411
619
|
};
|
|
412
620
|
IconButton.defaultProps = {
|
|
413
621
|
isPill: true,
|
|
@@ -416,7 +624,7 @@ IconButton.defaultProps = {
|
|
|
416
624
|
};
|
|
417
625
|
|
|
418
626
|
var _path;
|
|
419
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
627
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
420
628
|
var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
|
|
421
629
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
422
630
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -431,14 +639,9 @@ var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
|
|
|
431
639
|
})));
|
|
432
640
|
};
|
|
433
641
|
|
|
434
|
-
const ChevronButton = React.forwardRef((
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
} = _ref;
|
|
438
|
-
return React__namespace.default.createElement(IconButton, Object.assign({
|
|
439
|
-
ref: ref
|
|
440
|
-
}, buttonProps), React__namespace.default.createElement(SvgChevronDownStroke, null));
|
|
441
|
-
});
|
|
642
|
+
const ChevronButton = React.forwardRef((props, ref) => React__namespace.default.createElement(IconButton, Object.assign({
|
|
643
|
+
ref: ref
|
|
644
|
+
}, props), React__namespace.default.createElement(SvgChevronDownStroke, null)));
|
|
442
645
|
ChevronButton.displayName = 'ChevronButton';
|
|
443
646
|
ChevronButton.propTypes = IconButton.propTypes;
|
|
444
647
|
ChevronButton.defaultProps = {
|