@zendeskgarden/react-buttons 9.0.0-next.8 → 9.0.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 +5 -2
- package/dist/esm/elements/Button.js +2 -1
- package/dist/esm/elements/IconButton.js +1 -1
- package/dist/esm/elements/components/EndIcon.js +10 -3
- package/dist/esm/elements/components/StartIcon.js +10 -3
- 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 +3 -6
- package/dist/esm/styled/StyledButton.js +222 -59
- package/dist/esm/styled/StyledExternalIcon.js +2 -5
- package/dist/esm/styled/StyledIcon.js +6 -18
- package/dist/esm/styled/StyledIconButton.js +37 -15
- package/dist/esm/styled/StyledSplitButton.js +2 -5
- package/dist/index.cjs.js +292 -109
- package/dist/typings/elements/Button.d.ts +3 -1
- package/dist/typings/elements/components/EndIcon.d.ts +1 -1
- package/dist/typings/elements/components/StartIcon.d.ts +1 -1
- package/dist/typings/styled/StyledAnchor.d.ts +1 -8
- package/dist/typings/styled/StyledButton.d.ts +6 -7
- package/dist/typings/styled/StyledIcon.d.ts +3 -4
- package/dist/typings/styled/StyledIconButton.d.ts +2 -5
- 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 -8
- package/LICENSE.md +0 -176
package/dist/index.cjs.js
CHANGED
|
@@ -41,43 +41,29 @@ 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.0.0
|
|
44
|
+
'data-garden-version': '9.0.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 => {
|
|
55
52
|
let marginProperty;
|
|
56
|
-
if (props
|
|
53
|
+
if (props.$position === 'start') {
|
|
57
54
|
marginProperty = `margin-${props.theme.rtl ? 'left' : 'right'}`;
|
|
58
|
-
} else if (props
|
|
55
|
+
} else if (props.$position === 'end') {
|
|
59
56
|
marginProperty = `margin-${props.theme.rtl ? 'right' : 'left'}`;
|
|
60
57
|
}
|
|
61
58
|
return marginProperty && styled.css(["", ":", "px;"], marginProperty, props.theme.space.base * 2);
|
|
62
59
|
};
|
|
63
|
-
const StyledIcon = styled__default.default(
|
|
64
|
-
let {
|
|
65
|
-
children,
|
|
66
|
-
isRotated,
|
|
67
|
-
theme,
|
|
68
|
-
...props
|
|
69
|
-
} = _ref;
|
|
70
|
-
return React__namespace.default.cloneElement(React.Children.only(children), props);
|
|
71
|
-
}).attrs({
|
|
60
|
+
const StyledIcon = styled__default.default(reactTheming.StyledBaseIcon).attrs({
|
|
72
61
|
'data-garden-id': COMPONENT_ID$4,
|
|
73
|
-
'data-garden-version': '9.0.0
|
|
62
|
+
'data-garden-version': '9.0.0'
|
|
74
63
|
}).withConfig({
|
|
75
64
|
displayName: "StyledIcon",
|
|
76
65
|
componentId: "sc-19meqgg-0"
|
|
77
|
-
})(["transform:", ";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;", ";", ";"], props => props
|
|
78
|
-
StyledIcon.defaultProps = {
|
|
79
|
-
theme: reactTheming.DEFAULT_THEME
|
|
80
|
-
};
|
|
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));
|
|
81
67
|
|
|
82
68
|
const COMPONENT_ID$3 = 'buttons.button';
|
|
83
69
|
const getBorderRadius = props => {
|
|
@@ -86,9 +72,6 @@ const getBorderRadius = props => {
|
|
|
86
72
|
}
|
|
87
73
|
return props.theme.borderRadii.md;
|
|
88
74
|
};
|
|
89
|
-
const getDisabledBackgroundColor = props => {
|
|
90
|
-
return reactTheming.getColorV8('neutralHue', 200, props.theme);
|
|
91
|
-
};
|
|
92
75
|
const getHeight = props => {
|
|
93
76
|
if (props.size === 'small') {
|
|
94
77
|
return `${props.theme.space.base * 8}px`;
|
|
@@ -97,65 +80,228 @@ const getHeight = props => {
|
|
|
97
80
|
}
|
|
98
81
|
return `${props.theme.space.base * 10}px`;
|
|
99
82
|
};
|
|
100
|
-
const colorStyles =
|
|
83
|
+
const colorStyles = _ref => {
|
|
84
|
+
let {
|
|
85
|
+
theme,
|
|
86
|
+
isLink,
|
|
87
|
+
isBasic,
|
|
88
|
+
isDanger,
|
|
89
|
+
isNeutral,
|
|
90
|
+
isPrimary,
|
|
91
|
+
focusInset
|
|
92
|
+
} = _ref;
|
|
101
93
|
let retVal;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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,
|
|
120
138
|
condition: false,
|
|
121
139
|
styles: {
|
|
122
|
-
color:
|
|
123
|
-
outlineColor:
|
|
140
|
+
color: foregroundColor ,
|
|
141
|
+
outlineColor: focusOutlineColor
|
|
124
142
|
}
|
|
125
|
-
}),
|
|
126
|
-
} else if (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
+
})
|
|
134
180
|
} : undefined
|
|
135
|
-
}),
|
|
181
|
+
}), activeBackgroundColor, disabledBackgroundColor, disabledForegroundColor);
|
|
136
182
|
} else {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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);
|
|
148
294
|
}
|
|
149
295
|
return retVal;
|
|
150
296
|
};
|
|
151
|
-
const groupStyles =
|
|
152
|
-
|
|
297
|
+
const groupStyles = _ref2 => {
|
|
298
|
+
let {
|
|
153
299
|
theme,
|
|
154
300
|
isPrimary,
|
|
155
301
|
isBasic,
|
|
156
302
|
isPill,
|
|
157
303
|
focusInset
|
|
158
|
-
} =
|
|
304
|
+
} = _ref2;
|
|
159
305
|
const {
|
|
160
306
|
rtl,
|
|
161
307
|
borderWidths,
|
|
@@ -166,9 +312,15 @@ const groupStyles = props => {
|
|
|
166
312
|
const marginOffset = borderWidths.sm;
|
|
167
313
|
const marginDisplacement = `${isPrimary || isBasic ? '' : '-'}${marginOffset}`;
|
|
168
314
|
const iconMarginDisplacement = isPill && '-2px';
|
|
169
|
-
const disabledBackgroundColor = !isPrimary &&
|
|
315
|
+
const disabledBackgroundColor = !isPrimary && reactTheming.getColor({
|
|
316
|
+
theme,
|
|
317
|
+
variable: 'background.disabled'
|
|
318
|
+
});
|
|
170
319
|
const borderColor = isBasic ? 'transparent' : 'revert';
|
|
171
|
-
const focusColor = reactTheming.
|
|
320
|
+
const focusColor = reactTheming.getColor({
|
|
321
|
+
theme,
|
|
322
|
+
variable: 'border.primaryEmphasis'
|
|
323
|
+
});
|
|
172
324
|
const focusBoxShadow = isBasic && !isPrimary && reactTheming.getFocusBoxShadow({
|
|
173
325
|
theme,
|
|
174
326
|
inset: focusInset,
|
|
@@ -210,21 +362,18 @@ const sizeStyles = props => {
|
|
|
210
362
|
return retVal;
|
|
211
363
|
};
|
|
212
364
|
const StyledButton = styled__default.default.button.attrs(props => ({
|
|
213
|
-
'data-garden-id': COMPONENT_ID$3,
|
|
214
|
-
'data-garden-version': '9.0.0
|
|
365
|
+
'data-garden-id': props['data-garden-id'] || COMPONENT_ID$3,
|
|
366
|
+
'data-garden-version': '9.0.0',
|
|
215
367
|
type: props.type || 'button'
|
|
216
368
|
})).withConfig({
|
|
217
369
|
displayName: "StyledButton",
|
|
218
370
|
componentId: "sc-qe3ace-0"
|
|
219
|
-
})(["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:
|
|
220
|
-
StyledButton.defaultProps = {
|
|
221
|
-
theme: reactTheming.DEFAULT_THEME
|
|
222
|
-
};
|
|
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));
|
|
223
372
|
|
|
224
373
|
const COMPONENT_ID$2 = 'buttons.anchor';
|
|
225
374
|
const StyledAnchor = styled__default.default(StyledButton).attrs(props => ({
|
|
226
375
|
'data-garden-id': COMPONENT_ID$2,
|
|
227
|
-
'data-garden-version': '9.0.0
|
|
376
|
+
'data-garden-version': '9.0.0',
|
|
228
377
|
as: 'a',
|
|
229
378
|
dir: props.theme.rtl ? 'rtl' : undefined,
|
|
230
379
|
isLink: true,
|
|
@@ -232,13 +381,10 @@ const StyledAnchor = styled__default.default(StyledButton).attrs(props => ({
|
|
|
232
381
|
})).withConfig({
|
|
233
382
|
displayName: "StyledAnchor",
|
|
234
383
|
componentId: "sc-xshgmo-0"
|
|
235
|
-
})(["direction:", ";", ";"], props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(
|
|
236
|
-
StyledAnchor.defaultProps = {
|
|
237
|
-
theme: reactTheming.DEFAULT_THEME
|
|
238
|
-
};
|
|
384
|
+
})(["direction:", ";", ";"], props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(props['data-garden-id'], props));
|
|
239
385
|
|
|
240
386
|
var _path$1;
|
|
241
|
-
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); }
|
|
242
388
|
var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
243
389
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
244
390
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -258,21 +404,40 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
|
258
404
|
const COMPONENT_ID$1 = 'buttons.external_icon';
|
|
259
405
|
const StyledExternalIcon = styled__default.default(SvgNewWindowStroke).attrs({
|
|
260
406
|
'data-garden-id': COMPONENT_ID$1,
|
|
261
|
-
'data-garden-version': '9.0.0
|
|
407
|
+
'data-garden-version': '9.0.0'
|
|
262
408
|
}).withConfig({
|
|
263
409
|
displayName: "StyledExternalIcon",
|
|
264
410
|
componentId: "sc-16oz07e-0"
|
|
265
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));
|
|
266
|
-
StyledExternalIcon.defaultProps = {
|
|
267
|
-
theme: reactTheming.DEFAULT_THEME
|
|
268
|
-
};
|
|
269
412
|
|
|
270
413
|
const COMPONENT_ID = 'buttons.icon_button';
|
|
271
|
-
const iconColorStyles =
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
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
|
+
});
|
|
276
441
|
return styled.css(["color:", ";&:hover{color:", ";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{color:", ";}"], baseColor, hoverColor, activeColor);
|
|
277
442
|
};
|
|
278
443
|
const iconButtonStyles = props => {
|
|
@@ -283,31 +448,45 @@ const iconStyles = props => {
|
|
|
283
448
|
const size = props.theme.iconSizes.md;
|
|
284
449
|
return styled.css(["width:", ";height:", ";& > svg{transition:opacity 0.15s ease-in-out;}"], size, size);
|
|
285
450
|
};
|
|
286
|
-
const StyledIconButton = styled__default.default(StyledButton).attrs({
|
|
287
|
-
'data-garden-id'
|
|
288
|
-
|
|
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.0.0'
|
|
456
|
+
};
|
|
289
457
|
}).withConfig({
|
|
290
458
|
displayName: "StyledIconButton",
|
|
291
459
|
componentId: "sc-1t0ughp-0"
|
|
292
|
-
})(["", ";& ", "{", "}", ";"], props => iconButtonStyles(props), StyledIcon, props => iconStyles(props), props => reactTheming.retrieveComponentStyles(
|
|
293
|
-
StyledIconButton.defaultProps = {
|
|
294
|
-
theme: reactTheming.DEFAULT_THEME
|
|
295
|
-
};
|
|
460
|
+
})(["", ";& ", "{", "}", ";"], props => iconButtonStyles(props), StyledIcon, props => iconStyles(props), props => reactTheming.retrieveComponentStyles(props['data-garden-id'], props));
|
|
296
461
|
|
|
297
462
|
const SplitButtonContext = React.createContext(undefined);
|
|
298
463
|
const useSplitButtonContext = () => {
|
|
299
464
|
return React.useContext(SplitButtonContext);
|
|
300
465
|
};
|
|
301
466
|
|
|
302
|
-
const StartIconComponent =
|
|
303
|
-
|
|
304
|
-
|
|
467
|
+
const StartIconComponent = _ref => {
|
|
468
|
+
let {
|
|
469
|
+
isRotated,
|
|
470
|
+
...props
|
|
471
|
+
} = _ref;
|
|
472
|
+
return React__namespace.default.createElement(StyledIcon, Object.assign({
|
|
473
|
+
$position: "start",
|
|
474
|
+
$isRotated: isRotated
|
|
475
|
+
}, props));
|
|
476
|
+
};
|
|
305
477
|
StartIconComponent.displayName = 'Button.StartIcon';
|
|
306
478
|
const StartIcon = StartIconComponent;
|
|
307
479
|
|
|
308
|
-
const EndIconComponent =
|
|
309
|
-
|
|
310
|
-
|
|
480
|
+
const EndIconComponent = _ref => {
|
|
481
|
+
let {
|
|
482
|
+
isRotated,
|
|
483
|
+
...props
|
|
484
|
+
} = _ref;
|
|
485
|
+
return React__namespace.default.createElement(StyledIcon, Object.assign({
|
|
486
|
+
$position: "end",
|
|
487
|
+
$isRotated: isRotated
|
|
488
|
+
}, props));
|
|
489
|
+
};
|
|
311
490
|
EndIconComponent.displayName = 'Button.EndIcon';
|
|
312
491
|
const EndIcon = EndIconComponent;
|
|
313
492
|
|
|
@@ -315,7 +494,8 @@ const ButtonComponent = React.forwardRef((props, ref) => {
|
|
|
315
494
|
const splitButtonContext = useSplitButtonContext();
|
|
316
495
|
const computedProps = {
|
|
317
496
|
...props,
|
|
318
|
-
focusInset: props.focusInset || splitButtonContext
|
|
497
|
+
focusInset: props.focusInset || splitButtonContext,
|
|
498
|
+
$isUnderlined: props.isLink
|
|
319
499
|
};
|
|
320
500
|
return React__namespace.default.createElement(StyledButton, Object.assign({}, computedProps, {
|
|
321
501
|
ref: ref
|
|
@@ -345,6 +525,7 @@ const Anchor = React.forwardRef((_ref, ref) => {
|
|
|
345
525
|
children,
|
|
346
526
|
isExternal,
|
|
347
527
|
externalIconLabel,
|
|
528
|
+
isUnderlined = true,
|
|
348
529
|
...otherProps
|
|
349
530
|
} = _ref;
|
|
350
531
|
let anchorProps = otherProps;
|
|
@@ -362,8 +543,9 @@ const Anchor = React.forwardRef((_ref, ref) => {
|
|
|
362
543
|
};
|
|
363
544
|
const iconAriaLabel = reactTheming.useText(Anchor, checkProps, isExternal ? 'externalIconLabel' : 'noIconLabel', '(opens in a new tab)');
|
|
364
545
|
return React__namespace.default.createElement(StyledAnchor, Object.assign({
|
|
365
|
-
ref: ref
|
|
366
|
-
|
|
546
|
+
ref: ref,
|
|
547
|
+
$isUnderlined: isUnderlined
|
|
548
|
+
}, anchorProps), children, !!isExternal &&
|
|
367
549
|
React__namespace.default.createElement(StyledExternalIcon, {
|
|
368
550
|
role: "img",
|
|
369
551
|
"aria-label": iconAriaLabel,
|
|
@@ -374,6 +556,7 @@ Anchor.displayName = 'Anchor';
|
|
|
374
556
|
Anchor.propTypes = {
|
|
375
557
|
isExternal: PropTypes__default.default.bool,
|
|
376
558
|
isDanger: PropTypes__default.default.bool,
|
|
559
|
+
isUnderlined: PropTypes__default.default.bool,
|
|
377
560
|
externalIconLabel: PropTypes__default.default.string
|
|
378
561
|
};
|
|
379
562
|
|
|
@@ -389,7 +572,7 @@ const IconButton = React.forwardRef((_ref, ref) => {
|
|
|
389
572
|
}, otherProps, {
|
|
390
573
|
focusInset: otherProps.focusInset || focusInset
|
|
391
574
|
}), React__namespace.default.createElement(StyledIcon, {
|
|
392
|
-
isRotated: isRotated
|
|
575
|
+
$isRotated: isRotated
|
|
393
576
|
}, children));
|
|
394
577
|
});
|
|
395
578
|
IconButton.displayName = 'IconButton';
|
|
@@ -410,7 +593,7 @@ IconButton.defaultProps = {
|
|
|
410
593
|
};
|
|
411
594
|
|
|
412
595
|
var _path;
|
|
413
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
596
|
+
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); }
|
|
414
597
|
var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
|
|
415
598
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
416
599
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -8,10 +8,12 @@ import React from 'react';
|
|
|
8
8
|
import { IButtonProps } from '../types';
|
|
9
9
|
import { StartIcon } from './components/StartIcon';
|
|
10
10
|
import { EndIcon } from './components/EndIcon';
|
|
11
|
+
declare const ButtonComponent: React.ForwardRefExoticComponent<IButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
12
|
/**
|
|
12
13
|
* @extends ButtonHTMLAttributes<HTMLButtonElement>
|
|
13
14
|
*/
|
|
14
|
-
export declare const Button:
|
|
15
|
+
export declare const Button: typeof ButtonComponent & {
|
|
15
16
|
EndIcon: typeof EndIcon;
|
|
16
17
|
StartIcon: typeof StartIcon;
|
|
17
18
|
};
|
|
19
|
+
export {};
|
|
@@ -10,6 +10,6 @@ import { IButtonIconProps } from '../../types';
|
|
|
10
10
|
* @extends SVGAttributes<SVGElement>
|
|
11
11
|
*/
|
|
12
12
|
export declare const EndIcon: {
|
|
13
|
-
(props: IButtonIconProps): React.JSX.Element;
|
|
13
|
+
({ isRotated, ...props }: IButtonIconProps): React.JSX.Element;
|
|
14
14
|
displayName: string;
|
|
15
15
|
};
|
|
@@ -10,6 +10,6 @@ import { IButtonIconProps } from '../../types';
|
|
|
10
10
|
* @extends SVGAttributes<SVGElement>
|
|
11
11
|
*/
|
|
12
12
|
export declare const StartIcon: {
|
|
13
|
-
(props: IButtonIconProps): React.JSX.Element;
|
|
13
|
+
({ isRotated, ...props }: IButtonIconProps): React.JSX.Element;
|
|
14
14
|
displayName: string;
|
|
15
15
|
};
|
|
@@ -7,11 +7,4 @@
|
|
|
7
7
|
/**
|
|
8
8
|
* Accepts all `<a>` props
|
|
9
9
|
*/
|
|
10
|
-
export declare const StyledAnchor: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, import("
|
|
11
|
-
'data-garden-id': string;
|
|
12
|
-
'data-garden-version': string;
|
|
13
|
-
as: string;
|
|
14
|
-
dir: "rtl" | undefined;
|
|
15
|
-
isLink: boolean;
|
|
16
|
-
type: undefined;
|
|
17
|
-
}, "type" | "dir" | "as" | "data-garden-id" | "data-garden-version" | "isLink">;
|
|
10
|
+
export declare const StyledAnchor: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, import("./StyledButton").IStyledButtonProps, never>;
|
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { DefaultTheme, ThemeProps } from 'styled-components';
|
|
8
8
|
import { IButtonProps } from '../types';
|
|
9
|
-
export declare const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export declare const StyledButton: import("styled-components").StyledComponent<"button", DefaultTheme, IButtonProps, never>;
|
|
9
|
+
export declare const COMPONENT_ID = "buttons.button";
|
|
10
|
+
export interface IStyledButtonProps extends IButtonProps {
|
|
11
|
+
$isUnderlined?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const getHeight: (props: IStyledButtonProps & ThemeProps<DefaultTheme>) => string;
|
|
14
|
+
export declare const StyledButton: import("styled-components").StyledComponent<"button", DefaultTheme, IStyledButtonProps, never>;
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import { DefaultTheme } from 'styled-components';
|
|
8
|
-
import React from 'react';
|
|
9
8
|
interface IStyledIconProps {
|
|
10
|
-
isRotated: boolean;
|
|
11
|
-
position?: 'start' | 'end';
|
|
9
|
+
$isRotated: boolean;
|
|
10
|
+
$position?: 'start' | 'end';
|
|
12
11
|
}
|
|
13
|
-
export declare const StyledIcon: import("styled-components").StyledComponent<({ children,
|
|
12
|
+
export declare const StyledIcon: import("styled-components").StyledComponent<({ children, theme, ...props }: any) => import("react").DetailedReactHTMLElement<any, HTMLElement>, DefaultTheme, {
|
|
14
13
|
'data-garden-id': string;
|
|
15
14
|
'data-garden-version': string;
|
|
16
15
|
} & IStyledIconProps, "data-garden-id" | "data-garden-version">;
|
|
@@ -5,8 +5,5 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import { DefaultTheme } from 'styled-components';
|
|
8
|
-
|
|
9
|
-
export declare const StyledIconButton: import("styled-components").StyledComponent<"button", DefaultTheme,
|
|
10
|
-
'data-garden-id': string;
|
|
11
|
-
'data-garden-version': string;
|
|
12
|
-
} & IButtonProps, "data-garden-id" | "data-garden-version">;
|
|
8
|
+
export declare const COMPONENT_ID = "buttons.icon_button";
|
|
9
|
+
export declare const StyledIconButton: import("styled-components").StyledComponent<"button", DefaultTheme, import("./StyledButton").IStyledButtonProps, never>;
|