@zendeskgarden/react-buttons 8.67.0 → 8.68.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/index.cjs.js
CHANGED
|
@@ -58,11 +58,11 @@ const SIZE = ['small', 'medium', 'large'];
|
|
|
58
58
|
const COMPONENT_ID$5 = 'buttons.button_group_view';
|
|
59
59
|
const StyledButtonGroup = styled__default.default.div.attrs({
|
|
60
60
|
'data-garden-id': COMPONENT_ID$5,
|
|
61
|
-
'data-garden-version': '8.
|
|
61
|
+
'data-garden-version': '8.68.0'
|
|
62
62
|
}).withConfig({
|
|
63
63
|
displayName: "StyledButtonGroup",
|
|
64
64
|
componentId: "sc-1fbpzef-0"
|
|
65
|
-
})(["display:inline-flex;position:relative;z-index:0;direction:", ";white-space:nowrap
|
|
65
|
+
})(["display:inline-flex;position:relative;z-index:0;direction:", ";white-space:nowrap;", ";"], props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
66
66
|
StyledButtonGroup.defaultProps = {
|
|
67
67
|
theme: reactTheming.DEFAULT_THEME
|
|
68
68
|
};
|
|
@@ -87,7 +87,7 @@ const StyledIcon = styled__default.default(_ref => {
|
|
|
87
87
|
return React__namespace.default.cloneElement(React.Children.only(children), props);
|
|
88
88
|
}).attrs({
|
|
89
89
|
'data-garden-id': COMPONENT_ID$4,
|
|
90
|
-
'data-garden-version': '8.
|
|
90
|
+
'data-garden-version': '8.68.0'
|
|
91
91
|
}).withConfig({
|
|
92
92
|
displayName: "StyledIcon",
|
|
93
93
|
componentId: "sc-19meqgg-0"
|
|
@@ -98,9 +98,7 @@ StyledIcon.defaultProps = {
|
|
|
98
98
|
|
|
99
99
|
const COMPONENT_ID$3 = 'buttons.button';
|
|
100
100
|
const getBorderRadius = props => {
|
|
101
|
-
if (props.
|
|
102
|
-
return 0;
|
|
103
|
-
} else if (props.isPill) {
|
|
101
|
+
if (props.isPill) {
|
|
104
102
|
return '100px';
|
|
105
103
|
}
|
|
106
104
|
return props.theme.borderRadii.md;
|
|
@@ -130,31 +128,72 @@ const colorStyles = props => {
|
|
|
130
128
|
const baseColor = reactTheming.getColor(hue, shade, props.theme);
|
|
131
129
|
const hoverColor = reactTheming.getColor(hue, shade + 100, props.theme);
|
|
132
130
|
const activeColor = reactTheming.getColor(hue, shade + 200, props.theme);
|
|
131
|
+
const focusColor = reactTheming.getColor('primaryHue', shade, props.theme);
|
|
133
132
|
const disabledBackgroundColor = getDisabledBackgroundColor(props);
|
|
134
133
|
const disabledForegroundColor = reactTheming.getColor(hue, shade - 200, props.theme);
|
|
135
|
-
const boxShadowColor = props.focusInset && (props.isPrimary || props.isSelected) ? props.theme.palette.white : baseColor;
|
|
136
|
-
const boxShadow = `
|
|
137
|
-
${props.focusInset ? 'inset' : ''}
|
|
138
|
-
${props.theme.shadows.md(polished.rgba(boxShadowColor, 0.35))}`;
|
|
139
134
|
if (props.isLink) {
|
|
140
|
-
retVal = styled.css(["background-color:transparent;color:", "
|
|
135
|
+
retVal = styled.css(["outline-color:transparent;background-color:transparent;color:", ";", " &:hover{color:", ";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{color:", ";}&:disabled{color:", ";}"], baseColor, reactTheming.focusStyles({
|
|
136
|
+
theme: props.theme,
|
|
137
|
+
condition: false,
|
|
138
|
+
styles: {
|
|
139
|
+
color: baseColor,
|
|
140
|
+
outlineColor: focusColor
|
|
141
|
+
}
|
|
142
|
+
}), hoverColor, activeColor, disabledForegroundColor);
|
|
141
143
|
} else if (props.isPrimary || props.isSelected) {
|
|
142
|
-
retVal = styled.css(["background-color:", ";color:", ";&:hover{background-color:", ";}
|
|
144
|
+
retVal = styled.css(["outline-color:transparent;background-color:", ";color:", ";&:hover{background-color:", ";}", " &:active{background-color:", ";}&[aria-pressed='true'],&[aria-pressed='mixed']{background-color:", ";}&:disabled{background-color:", ";color:", ";}"], props.isPrimary && props.isSelected ? activeColor : baseColor, props.theme.palette.white, hoverColor, reactTheming.focusStyles({
|
|
145
|
+
theme: props.theme,
|
|
146
|
+
inset: props.focusInset,
|
|
147
|
+
shadowWidth: props.focusInset ? 'sm' : 'md',
|
|
148
|
+
spacerWidth: props.focusInset ? 'sm' : 'xs',
|
|
149
|
+
styles: props.isDanger && props.focusInset ? {
|
|
150
|
+
borderColor: focusColor
|
|
151
|
+
} : undefined
|
|
152
|
+
}), activeColor, props.isPrimary && activeColor, disabledBackgroundColor, disabledForegroundColor);
|
|
143
153
|
} else {
|
|
144
154
|
const borderColor = props.isNeutral && !props.isDanger ? reactTheming.getColor('neutralHue', 300, props.theme) : baseColor;
|
|
145
155
|
const foregroundColor = props.isNeutral ? props.theme.colors.foreground : baseColor;
|
|
146
156
|
const hoverBorderColor = props.isNeutral && !props.isDanger ? baseColor : hoverColor;
|
|
147
157
|
const hoverForegroundColor = props.isNeutral ? foregroundColor : hoverColor;
|
|
148
|
-
retVal = styled.css(["border-color:", ";background-color:transparent;color:", ";&:hover{border-color:", ";background-color:", ";color:", ";}
|
|
158
|
+
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 ", ",&[data-garden-focus-visible] ", "{color:", ";}&:active ", "{color:", ";}&:disabled ", "{color:", ";}"], !props.isBasic && borderColor, foregroundColor, !props.isBasic && hoverBorderColor, polished.rgba(baseColor, 0.08), hoverForegroundColor, reactTheming.focusStyles({
|
|
159
|
+
theme: props.theme,
|
|
160
|
+
inset: props.focusInset,
|
|
161
|
+
styles: props.isNeutral ? {
|
|
162
|
+
borderColor: baseColor
|
|
163
|
+
} : undefined
|
|
164
|
+
}), !props.isBasic && activeColor, polished.rgba(baseColor, 0.2), !props.isNeutral && activeColor, disabledBackgroundColor, disabledForegroundColor, StyledIcon, props.isNeutral && reactTheming.getColor('neutralHue', shade, props.theme), StyledIcon, StyledIcon, StyledIcon, props.isNeutral && reactTheming.getColor('neutralHue', shade + 100, props.theme), StyledIcon, props.isNeutral && foregroundColor, StyledIcon, disabledForegroundColor);
|
|
149
165
|
}
|
|
150
166
|
return retVal;
|
|
151
167
|
};
|
|
152
168
|
const groupStyles = props => {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
169
|
+
const {
|
|
170
|
+
theme,
|
|
171
|
+
isPrimary,
|
|
172
|
+
isBasic,
|
|
173
|
+
isSelected,
|
|
174
|
+
isPill,
|
|
175
|
+
focusInset
|
|
176
|
+
} = props;
|
|
177
|
+
const {
|
|
178
|
+
rtl,
|
|
179
|
+
borderWidths,
|
|
180
|
+
borders
|
|
181
|
+
} = theme;
|
|
182
|
+
const startPosition = rtl ? 'right' : 'left';
|
|
183
|
+
const endPosition = rtl ? 'left' : 'right';
|
|
184
|
+
const marginOffset = borderWidths.sm;
|
|
185
|
+
const marginDisplacement = `${isPrimary || isBasic ? '' : '-'}${marginOffset}`;
|
|
186
|
+
const iconMarginDisplacement = isPill && '-2px';
|
|
187
|
+
const disabledBackgroundColor = !isPrimary && getDisabledBackgroundColor(props);
|
|
188
|
+
const borderColor = isBasic ? 'transparent' : 'revert';
|
|
189
|
+
const focusColor = reactTheming.getColor('primaryHue', 600, theme);
|
|
190
|
+
const focusBoxShadow = isBasic && !isSelected && !isPrimary && reactTheming.getFocusBoxShadow({
|
|
191
|
+
theme,
|
|
192
|
+
inset: focusInset,
|
|
193
|
+
spacerHue: focusColor,
|
|
194
|
+
hue: 'transparent'
|
|
195
|
+
});
|
|
196
|
+
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);
|
|
158
197
|
};
|
|
159
198
|
const iconStyles$1 = props => {
|
|
160
199
|
const size = props.size === 'small' ? props.theme.iconSizes.sm : props.theme.iconSizes.md;
|
|
@@ -186,12 +225,12 @@ const sizeStyles = props => {
|
|
|
186
225
|
};
|
|
187
226
|
const StyledButton = styled__default.default.button.attrs(props => ({
|
|
188
227
|
'data-garden-id': COMPONENT_ID$3,
|
|
189
|
-
'data-garden-version': '8.
|
|
228
|
+
'data-garden-version': '8.68.0',
|
|
190
229
|
type: props.type || 'button'
|
|
191
230
|
})).withConfig({
|
|
192
231
|
displayName: "StyledButton",
|
|
193
232
|
componentId: "sc-qe3ace-0"
|
|
194
|
-
})(["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,z-index 0.25s ease-in-out;margin:0;border:", ";border-radius:", ";cursor:pointer;width:", ";overflow:hidden;text-decoration:none;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;}
|
|
233
|
+
})(["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:none;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.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), StyledButtonGroup, props => groupStyles(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
195
234
|
StyledButton.defaultProps = {
|
|
196
235
|
theme: reactTheming.DEFAULT_THEME
|
|
197
236
|
};
|
|
@@ -199,7 +238,7 @@ StyledButton.defaultProps = {
|
|
|
199
238
|
const COMPONENT_ID$2 = 'buttons.anchor';
|
|
200
239
|
const StyledAnchor = styled__default.default(StyledButton).attrs(props => ({
|
|
201
240
|
'data-garden-id': COMPONENT_ID$2,
|
|
202
|
-
'data-garden-version': '8.
|
|
241
|
+
'data-garden-version': '8.68.0',
|
|
203
242
|
as: 'a',
|
|
204
243
|
dir: props.theme.rtl ? 'rtl' : undefined,
|
|
205
244
|
isLink: true,
|
|
@@ -233,7 +272,7 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
|
233
272
|
const COMPONENT_ID$1 = 'buttons.external_icon';
|
|
234
273
|
const StyledExternalIcon = styled__default.default(SvgNewWindowStroke).attrs({
|
|
235
274
|
'data-garden-id': COMPONENT_ID$1,
|
|
236
|
-
'data-garden-version': '8.
|
|
275
|
+
'data-garden-version': '8.68.0'
|
|
237
276
|
}).withConfig({
|
|
238
277
|
displayName: "StyledExternalIcon",
|
|
239
278
|
componentId: "sc-16oz07e-0"
|
|
@@ -260,7 +299,7 @@ const iconStyles = props => {
|
|
|
260
299
|
};
|
|
261
300
|
const StyledIconButton = styled__default.default(StyledButton).attrs({
|
|
262
301
|
'data-garden-id': COMPONENT_ID,
|
|
263
|
-
'data-garden-version': '8.
|
|
302
|
+
'data-garden-version': '8.68.0'
|
|
264
303
|
}).withConfig({
|
|
265
304
|
displayName: "StyledIconButton",
|
|
266
305
|
componentId: "sc-1t0ughp-0"
|
package/dist/index.esm.js
CHANGED
|
@@ -9,7 +9,7 @@ import * as React from 'react';
|
|
|
9
9
|
import React__default, { Children, createContext, useContext, forwardRef, useMemo } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import styled, { css } from 'styled-components';
|
|
12
|
-
import { retrieveComponentStyles, DEFAULT_THEME, getColor, useText } from '@zendeskgarden/react-theming';
|
|
12
|
+
import { retrieveComponentStyles, DEFAULT_THEME, SELECTOR_FOCUS_VISIBLE, getColor, focusStyles, getFocusBoxShadow, useText } from '@zendeskgarden/react-theming';
|
|
13
13
|
import { rgba, math, em } from 'polished';
|
|
14
14
|
import { useButtonGroup } from '@zendeskgarden/container-buttongroup';
|
|
15
15
|
|
|
@@ -33,11 +33,11 @@ const SIZE = ['small', 'medium', 'large'];
|
|
|
33
33
|
const COMPONENT_ID$5 = 'buttons.button_group_view';
|
|
34
34
|
const StyledButtonGroup = styled.div.attrs({
|
|
35
35
|
'data-garden-id': COMPONENT_ID$5,
|
|
36
|
-
'data-garden-version': '8.
|
|
36
|
+
'data-garden-version': '8.68.0'
|
|
37
37
|
}).withConfig({
|
|
38
38
|
displayName: "StyledButtonGroup",
|
|
39
39
|
componentId: "sc-1fbpzef-0"
|
|
40
|
-
})(["display:inline-flex;position:relative;z-index:0;direction:", ";white-space:nowrap
|
|
40
|
+
})(["display:inline-flex;position:relative;z-index:0;direction:", ";white-space:nowrap;", ";"], props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
41
41
|
StyledButtonGroup.defaultProps = {
|
|
42
42
|
theme: DEFAULT_THEME
|
|
43
43
|
};
|
|
@@ -62,7 +62,7 @@ const StyledIcon = styled(_ref => {
|
|
|
62
62
|
return React__default.cloneElement(Children.only(children), props);
|
|
63
63
|
}).attrs({
|
|
64
64
|
'data-garden-id': COMPONENT_ID$4,
|
|
65
|
-
'data-garden-version': '8.
|
|
65
|
+
'data-garden-version': '8.68.0'
|
|
66
66
|
}).withConfig({
|
|
67
67
|
displayName: "StyledIcon",
|
|
68
68
|
componentId: "sc-19meqgg-0"
|
|
@@ -73,9 +73,7 @@ StyledIcon.defaultProps = {
|
|
|
73
73
|
|
|
74
74
|
const COMPONENT_ID$3 = 'buttons.button';
|
|
75
75
|
const getBorderRadius = props => {
|
|
76
|
-
if (props.
|
|
77
|
-
return 0;
|
|
78
|
-
} else if (props.isPill) {
|
|
76
|
+
if (props.isPill) {
|
|
79
77
|
return '100px';
|
|
80
78
|
}
|
|
81
79
|
return props.theme.borderRadii.md;
|
|
@@ -105,31 +103,72 @@ const colorStyles = props => {
|
|
|
105
103
|
const baseColor = getColor(hue, shade, props.theme);
|
|
106
104
|
const hoverColor = getColor(hue, shade + 100, props.theme);
|
|
107
105
|
const activeColor = getColor(hue, shade + 200, props.theme);
|
|
106
|
+
const focusColor = getColor('primaryHue', shade, props.theme);
|
|
108
107
|
const disabledBackgroundColor = getDisabledBackgroundColor(props);
|
|
109
108
|
const disabledForegroundColor = getColor(hue, shade - 200, props.theme);
|
|
110
|
-
const boxShadowColor = props.focusInset && (props.isPrimary || props.isSelected) ? props.theme.palette.white : baseColor;
|
|
111
|
-
const boxShadow = `
|
|
112
|
-
${props.focusInset ? 'inset' : ''}
|
|
113
|
-
${props.theme.shadows.md(rgba(boxShadowColor, 0.35))}`;
|
|
114
109
|
if (props.isLink) {
|
|
115
|
-
retVal = css(["background-color:transparent;color:", "
|
|
110
|
+
retVal = css(["outline-color:transparent;background-color:transparent;color:", ";", " &:hover{color:", ";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{color:", ";}&:disabled{color:", ";}"], baseColor, focusStyles({
|
|
111
|
+
theme: props.theme,
|
|
112
|
+
condition: false,
|
|
113
|
+
styles: {
|
|
114
|
+
color: baseColor,
|
|
115
|
+
outlineColor: focusColor
|
|
116
|
+
}
|
|
117
|
+
}), hoverColor, activeColor, disabledForegroundColor);
|
|
116
118
|
} else if (props.isPrimary || props.isSelected) {
|
|
117
|
-
retVal = css(["background-color:", ";color:", ";&:hover{background-color:", ";}
|
|
119
|
+
retVal = css(["outline-color:transparent;background-color:", ";color:", ";&:hover{background-color:", ";}", " &:active{background-color:", ";}&[aria-pressed='true'],&[aria-pressed='mixed']{background-color:", ";}&:disabled{background-color:", ";color:", ";}"], props.isPrimary && props.isSelected ? activeColor : baseColor, props.theme.palette.white, hoverColor, focusStyles({
|
|
120
|
+
theme: props.theme,
|
|
121
|
+
inset: props.focusInset,
|
|
122
|
+
shadowWidth: props.focusInset ? 'sm' : 'md',
|
|
123
|
+
spacerWidth: props.focusInset ? 'sm' : 'xs',
|
|
124
|
+
styles: props.isDanger && props.focusInset ? {
|
|
125
|
+
borderColor: focusColor
|
|
126
|
+
} : undefined
|
|
127
|
+
}), activeColor, props.isPrimary && activeColor, disabledBackgroundColor, disabledForegroundColor);
|
|
118
128
|
} else {
|
|
119
129
|
const borderColor = props.isNeutral && !props.isDanger ? getColor('neutralHue', 300, props.theme) : baseColor;
|
|
120
130
|
const foregroundColor = props.isNeutral ? props.theme.colors.foreground : baseColor;
|
|
121
131
|
const hoverBorderColor = props.isNeutral && !props.isDanger ? baseColor : hoverColor;
|
|
122
132
|
const hoverForegroundColor = props.isNeutral ? foregroundColor : hoverColor;
|
|
123
|
-
retVal = css(["border-color:", ";background-color:transparent;color:", ";&:hover{border-color:", ";background-color:", ";color:", ";}
|
|
133
|
+
retVal = 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 ", ",&[data-garden-focus-visible] ", "{color:", ";}&:active ", "{color:", ";}&:disabled ", "{color:", ";}"], !props.isBasic && borderColor, foregroundColor, !props.isBasic && hoverBorderColor, rgba(baseColor, 0.08), hoverForegroundColor, focusStyles({
|
|
134
|
+
theme: props.theme,
|
|
135
|
+
inset: props.focusInset,
|
|
136
|
+
styles: props.isNeutral ? {
|
|
137
|
+
borderColor: baseColor
|
|
138
|
+
} : undefined
|
|
139
|
+
}), !props.isBasic && activeColor, rgba(baseColor, 0.2), !props.isNeutral && activeColor, disabledBackgroundColor, disabledForegroundColor, StyledIcon, props.isNeutral && getColor('neutralHue', shade, props.theme), StyledIcon, StyledIcon, StyledIcon, props.isNeutral && getColor('neutralHue', shade + 100, props.theme), StyledIcon, props.isNeutral && foregroundColor, StyledIcon, disabledForegroundColor);
|
|
124
140
|
}
|
|
125
141
|
return retVal;
|
|
126
142
|
};
|
|
127
143
|
const groupStyles = props => {
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
144
|
+
const {
|
|
145
|
+
theme,
|
|
146
|
+
isPrimary,
|
|
147
|
+
isBasic,
|
|
148
|
+
isSelected,
|
|
149
|
+
isPill,
|
|
150
|
+
focusInset
|
|
151
|
+
} = props;
|
|
152
|
+
const {
|
|
153
|
+
rtl,
|
|
154
|
+
borderWidths,
|
|
155
|
+
borders
|
|
156
|
+
} = theme;
|
|
157
|
+
const startPosition = rtl ? 'right' : 'left';
|
|
158
|
+
const endPosition = rtl ? 'left' : 'right';
|
|
159
|
+
const marginOffset = borderWidths.sm;
|
|
160
|
+
const marginDisplacement = `${isPrimary || isBasic ? '' : '-'}${marginOffset}`;
|
|
161
|
+
const iconMarginDisplacement = isPill && '-2px';
|
|
162
|
+
const disabledBackgroundColor = !isPrimary && getDisabledBackgroundColor(props);
|
|
163
|
+
const borderColor = isBasic ? 'transparent' : 'revert';
|
|
164
|
+
const focusColor = getColor('primaryHue', 600, theme);
|
|
165
|
+
const focusBoxShadow = isBasic && !isSelected && !isPrimary && getFocusBoxShadow({
|
|
166
|
+
theme,
|
|
167
|
+
inset: focusInset,
|
|
168
|
+
spacerHue: focusColor,
|
|
169
|
+
hue: 'transparent'
|
|
170
|
+
});
|
|
171
|
+
return 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, SELECTOR_FOCUS_VISIBLE, focusColor, focusBoxShadow, SELECTOR_FOCUS_VISIBLE, disabledBackgroundColor, startPosition, marginDisplacement, startPosition, marginOffset, endPosition, endPosition, startPosition, startPosition, StyledIcon, endPosition, iconMarginDisplacement, StyledIcon, startPosition, iconMarginDisplacement);
|
|
133
172
|
};
|
|
134
173
|
const iconStyles$1 = props => {
|
|
135
174
|
const size = props.size === 'small' ? props.theme.iconSizes.sm : props.theme.iconSizes.md;
|
|
@@ -161,12 +200,12 @@ const sizeStyles = props => {
|
|
|
161
200
|
};
|
|
162
201
|
const StyledButton = styled.button.attrs(props => ({
|
|
163
202
|
'data-garden-id': COMPONENT_ID$3,
|
|
164
|
-
'data-garden-version': '8.
|
|
203
|
+
'data-garden-version': '8.68.0',
|
|
165
204
|
type: props.type || 'button'
|
|
166
205
|
})).withConfig({
|
|
167
206
|
displayName: "StyledButton",
|
|
168
207
|
componentId: "sc-qe3ace-0"
|
|
169
|
-
})(["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,z-index 0.25s ease-in-out;margin:0;border:", ";border-radius:", ";cursor:pointer;width:", ";overflow:hidden;text-decoration:none;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;}
|
|
208
|
+
})(["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:none;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.isLink && 'nowrap', props => props.isLink ? 'inherit' : props.theme.fontWeights.regular, props => !props.isLink && 'none', props => sizeStyles(props), 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), StyledButtonGroup, props => groupStyles(props), props => retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
170
209
|
StyledButton.defaultProps = {
|
|
171
210
|
theme: DEFAULT_THEME
|
|
172
211
|
};
|
|
@@ -174,7 +213,7 @@ StyledButton.defaultProps = {
|
|
|
174
213
|
const COMPONENT_ID$2 = 'buttons.anchor';
|
|
175
214
|
const StyledAnchor = styled(StyledButton).attrs(props => ({
|
|
176
215
|
'data-garden-id': COMPONENT_ID$2,
|
|
177
|
-
'data-garden-version': '8.
|
|
216
|
+
'data-garden-version': '8.68.0',
|
|
178
217
|
as: 'a',
|
|
179
218
|
dir: props.theme.rtl ? 'rtl' : undefined,
|
|
180
219
|
isLink: true,
|
|
@@ -208,7 +247,7 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
|
208
247
|
const COMPONENT_ID$1 = 'buttons.external_icon';
|
|
209
248
|
const StyledExternalIcon = styled(SvgNewWindowStroke).attrs({
|
|
210
249
|
'data-garden-id': COMPONENT_ID$1,
|
|
211
|
-
'data-garden-version': '8.
|
|
250
|
+
'data-garden-version': '8.68.0'
|
|
212
251
|
}).withConfig({
|
|
213
252
|
displayName: "StyledExternalIcon",
|
|
214
253
|
componentId: "sc-16oz07e-0"
|
|
@@ -235,7 +274,7 @@ const iconStyles = props => {
|
|
|
235
274
|
};
|
|
236
275
|
const StyledIconButton = styled(StyledButton).attrs({
|
|
237
276
|
'data-garden-id': COMPONENT_ID,
|
|
238
|
-
'data-garden-version': '8.
|
|
277
|
+
'data-garden-version': '8.68.0'
|
|
239
278
|
}).withConfig({
|
|
240
279
|
displayName: "StyledIconButton",
|
|
241
280
|
componentId: "sc-1t0ughp-0"
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
+
import React from 'react';
|
|
7
8
|
import { IButtonIconProps } from '../../types';
|
|
8
9
|
/**
|
|
9
10
|
* @extends SVGAttributes<SVGElement>
|
|
10
11
|
*/
|
|
11
12
|
export declare const EndIcon: {
|
|
12
|
-
(props: IButtonIconProps): JSX.Element;
|
|
13
|
+
(props: IButtonIconProps): React.JSX.Element;
|
|
13
14
|
displayName: string;
|
|
14
15
|
};
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
+
import React from 'react';
|
|
7
8
|
import { IButtonIconProps } from '../../types';
|
|
8
9
|
/**
|
|
9
10
|
* @extends SVGAttributes<SVGElement>
|
|
10
11
|
*/
|
|
11
12
|
export declare const StartIcon: {
|
|
12
|
-
(props: IButtonIconProps): JSX.Element;
|
|
13
|
+
(props: IButtonIconProps): React.JSX.Element;
|
|
13
14
|
displayName: string;
|
|
14
15
|
};
|
|
@@ -10,5 +10,6 @@ export declare const getHeight: (props: IButtonProps & ThemeProps<DefaultTheme>)
|
|
|
10
10
|
/**
|
|
11
11
|
* 1. FF <input type="submit"> fix
|
|
12
12
|
* 2. <a> element reset
|
|
13
|
+
* 3. Shifting :focus-visible from LVHFA order to preserve `text-decoration` on hover
|
|
13
14
|
*/
|
|
14
15
|
export declare const StyledButton: import("styled-components").StyledComponent<"button", DefaultTheme, IButtonProps, never>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-buttons",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.68.0",
|
|
4
4
|
"description": "Components relating to buttons in the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"prop-types": "^15.5.7"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@zendeskgarden/react-theming": "^8.
|
|
30
|
+
"@zendeskgarden/react-theming": "^8.67.0",
|
|
31
31
|
"react": ">=16.8.0",
|
|
32
32
|
"react-dom": ">=16.8.0",
|
|
33
33
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@zendeskgarden/react-theming": "^8.
|
|
36
|
+
"@zendeskgarden/react-theming": "^8.68.0",
|
|
37
37
|
"@zendeskgarden/svg-icons": "6.33.0"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"zendeskgarden:src": "src/index.ts",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "e05a28d586f47d95e0570fe2d529915aa4285845"
|
|
50
50
|
}
|