@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
|
@@ -19,6 +19,7 @@ const Anchor = forwardRef((_ref, ref) => {
|
|
|
19
19
|
children,
|
|
20
20
|
isExternal,
|
|
21
21
|
externalIconLabel,
|
|
22
|
+
isUnderlined = true,
|
|
22
23
|
...otherProps
|
|
23
24
|
} = _ref;
|
|
24
25
|
let anchorProps = otherProps;
|
|
@@ -36,8 +37,9 @@ const Anchor = forwardRef((_ref, ref) => {
|
|
|
36
37
|
};
|
|
37
38
|
const iconAriaLabel = useText(Anchor, checkProps, isExternal ? 'externalIconLabel' : 'noIconLabel', '(opens in a new tab)');
|
|
38
39
|
return React__default.createElement(StyledAnchor, Object.assign({
|
|
39
|
-
ref: ref
|
|
40
|
-
|
|
40
|
+
ref: ref,
|
|
41
|
+
$isUnderlined: isUnderlined
|
|
42
|
+
}, anchorProps), children, !!isExternal &&
|
|
41
43
|
React__default.createElement(StyledExternalIcon, {
|
|
42
44
|
role: "img",
|
|
43
45
|
"aria-label": iconAriaLabel,
|
|
@@ -48,6 +50,7 @@ Anchor.displayName = 'Anchor';
|
|
|
48
50
|
Anchor.propTypes = {
|
|
49
51
|
isExternal: PropTypes.bool,
|
|
50
52
|
isDanger: PropTypes.bool,
|
|
53
|
+
isUnderlined: PropTypes.bool,
|
|
51
54
|
externalIconLabel: PropTypes.string
|
|
52
55
|
};
|
|
53
56
|
|
|
@@ -21,7 +21,8 @@ const ButtonComponent = forwardRef((props, ref) => {
|
|
|
21
21
|
const splitButtonContext = useSplitButtonContext();
|
|
22
22
|
const computedProps = {
|
|
23
23
|
...props,
|
|
24
|
-
focusInset: props.focusInset || splitButtonContext
|
|
24
|
+
focusInset: props.focusInset || splitButtonContext,
|
|
25
|
+
$isUnderlined: props.isLink
|
|
25
26
|
};
|
|
26
27
|
return React__default.createElement(StyledButton, Object.assign({}, computedProps, {
|
|
27
28
|
ref: ref
|
|
@@ -27,7 +27,7 @@ const IconButton = forwardRef((_ref, ref) => {
|
|
|
27
27
|
}, otherProps, {
|
|
28
28
|
focusInset: otherProps.focusInset || focusInset
|
|
29
29
|
}), React__default.createElement(StyledIcon, {
|
|
30
|
-
isRotated: isRotated
|
|
30
|
+
$isRotated: isRotated
|
|
31
31
|
}, children));
|
|
32
32
|
});
|
|
33
33
|
IconButton.displayName = 'IconButton';
|
|
@@ -12,9 +12,16 @@ import '../../styled/StyledExternalIcon.js';
|
|
|
12
12
|
import { StyledIcon } from '../../styled/StyledIcon.js';
|
|
13
13
|
import '../../styled/StyledIconButton.js';
|
|
14
14
|
|
|
15
|
-
const EndIconComponent =
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const EndIconComponent = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
isRotated,
|
|
18
|
+
...props
|
|
19
|
+
} = _ref;
|
|
20
|
+
return React__default.createElement(StyledIcon, Object.assign({
|
|
21
|
+
$position: "end",
|
|
22
|
+
$isRotated: isRotated
|
|
23
|
+
}, props));
|
|
24
|
+
};
|
|
18
25
|
EndIconComponent.displayName = 'Button.EndIcon';
|
|
19
26
|
const EndIcon = EndIconComponent;
|
|
20
27
|
|
|
@@ -12,9 +12,16 @@ import '../../styled/StyledExternalIcon.js';
|
|
|
12
12
|
import { StyledIcon } from '../../styled/StyledIcon.js';
|
|
13
13
|
import '../../styled/StyledIconButton.js';
|
|
14
14
|
|
|
15
|
-
const StartIconComponent =
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const StartIconComponent = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
isRotated,
|
|
18
|
+
...props
|
|
19
|
+
} = _ref;
|
|
20
|
+
return React__default.createElement(StyledIcon, Object.assign({
|
|
21
|
+
$position: "start",
|
|
22
|
+
$isRotated: isRotated
|
|
23
|
+
}, props));
|
|
24
|
+
};
|
|
18
25
|
StartIconComponent.displayName = 'Button.StartIcon';
|
|
19
26
|
const StartIcon = StartIconComponent;
|
|
20
27
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
var _path;
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
10
|
+
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); }
|
|
11
11
|
var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
12
12
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
9
|
var _path;
|
|
10
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
10
|
+
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); }
|
|
11
11
|
var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
|
|
12
12
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles
|
|
8
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledButton } from './StyledButton.js';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'buttons.anchor';
|
|
12
12
|
const StyledAnchor = styled(StyledButton).attrs(props => ({
|
|
13
13
|
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.0.0
|
|
14
|
+
'data-garden-version': '9.0.0',
|
|
15
15
|
as: 'a',
|
|
16
16
|
dir: props.theme.rtl ? 'rtl' : undefined,
|
|
17
17
|
isLink: true,
|
|
@@ -19,9 +19,6 @@ const StyledAnchor = styled(StyledButton).attrs(props => ({
|
|
|
19
19
|
})).withConfig({
|
|
20
20
|
displayName: "StyledAnchor",
|
|
21
21
|
componentId: "sc-xshgmo-0"
|
|
22
|
-
})(["direction:", ";", ";"], props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(
|
|
23
|
-
StyledAnchor.defaultProps = {
|
|
24
|
-
theme: DEFAULT_THEME
|
|
25
|
-
};
|
|
22
|
+
})(["direction:", ";", ";"], props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(props['data-garden-id'], props));
|
|
26
23
|
|
|
27
24
|
export { StyledAnchor };
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
|
-
import {
|
|
9
|
-
import { SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles,
|
|
8
|
+
import { math, em } from 'polished';
|
|
9
|
+
import { SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles, getColor, focusStyles, getFocusBoxShadow } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledSplitButton } from './StyledSplitButton.js';
|
|
11
11
|
import { StyledIcon } from './StyledIcon.js';
|
|
12
12
|
|
|
@@ -17,9 +17,6 @@ const getBorderRadius = props => {
|
|
|
17
17
|
}
|
|
18
18
|
return props.theme.borderRadii.md;
|
|
19
19
|
};
|
|
20
|
-
const getDisabledBackgroundColor = props => {
|
|
21
|
-
return getColorV8('neutralHue', 200, props.theme);
|
|
22
|
-
};
|
|
23
20
|
const getHeight = props => {
|
|
24
21
|
if (props.size === 'small') {
|
|
25
22
|
return `${props.theme.space.base * 8}px`;
|
|
@@ -28,65 +25,228 @@ const getHeight = props => {
|
|
|
28
25
|
}
|
|
29
26
|
return `${props.theme.space.base * 10}px`;
|
|
30
27
|
};
|
|
31
|
-
const colorStyles =
|
|
28
|
+
const colorStyles = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
theme,
|
|
31
|
+
isLink,
|
|
32
|
+
isBasic,
|
|
33
|
+
isDanger,
|
|
34
|
+
isNeutral,
|
|
35
|
+
isPrimary,
|
|
36
|
+
focusInset
|
|
37
|
+
} = _ref;
|
|
32
38
|
let retVal;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
const disabledBackgroundColor = getColor({
|
|
40
|
+
theme,
|
|
41
|
+
variable: 'background.disabled'
|
|
42
|
+
});
|
|
43
|
+
const disabledForegroundColor = getColor({
|
|
44
|
+
theme,
|
|
45
|
+
variable: 'foreground.disabled'
|
|
46
|
+
});
|
|
47
|
+
const offset100 = {
|
|
48
|
+
dark: {
|
|
49
|
+
offset: -100
|
|
50
|
+
},
|
|
51
|
+
light: {
|
|
52
|
+
offset: 100
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const offset200 = {
|
|
56
|
+
dark: {
|
|
57
|
+
offset: -200
|
|
58
|
+
},
|
|
59
|
+
light: {
|
|
60
|
+
offset: 200
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
if (isLink) {
|
|
64
|
+
const options = {
|
|
65
|
+
theme,
|
|
66
|
+
variable: isDanger ? 'foreground.danger' : 'foreground.primary'
|
|
67
|
+
};
|
|
68
|
+
const foregroundColor = getColor(options);
|
|
69
|
+
const hoverForegroundColor = getColor({
|
|
70
|
+
...options,
|
|
71
|
+
...offset100
|
|
72
|
+
});
|
|
73
|
+
const activeForegroundColor = getColor({
|
|
74
|
+
...options,
|
|
75
|
+
...offset200
|
|
76
|
+
});
|
|
77
|
+
const focusOutlineColor = getColor({
|
|
78
|
+
theme,
|
|
79
|
+
variable: 'border.primaryEmphasis'
|
|
80
|
+
});
|
|
81
|
+
retVal = css(["outline-color:transparent;background-color:transparent;color:", ";", " &:hover{color:", ";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{color:", ";}&:disabled{color:", ";}"], foregroundColor, focusStyles({
|
|
82
|
+
theme,
|
|
51
83
|
condition: false,
|
|
52
84
|
styles: {
|
|
53
|
-
color:
|
|
54
|
-
outlineColor:
|
|
85
|
+
color: foregroundColor ,
|
|
86
|
+
outlineColor: focusOutlineColor
|
|
55
87
|
}
|
|
56
|
-
}),
|
|
57
|
-
} else if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
88
|
+
}), hoverForegroundColor, activeForegroundColor, disabledForegroundColor);
|
|
89
|
+
} else if (isPrimary) {
|
|
90
|
+
let backgroundVariable;
|
|
91
|
+
if (isDanger) {
|
|
92
|
+
backgroundVariable = 'background.dangerEmphasis';
|
|
93
|
+
} else if (isNeutral) {
|
|
94
|
+
backgroundVariable = 'background.emphasis';
|
|
95
|
+
} else {
|
|
96
|
+
backgroundVariable = 'background.primaryEmphasis';
|
|
97
|
+
}
|
|
98
|
+
const options = {
|
|
99
|
+
theme,
|
|
100
|
+
variable: backgroundVariable
|
|
101
|
+
};
|
|
102
|
+
const backgroundColor = getColor(options);
|
|
103
|
+
const hoverBackgroundColor = getColor({
|
|
104
|
+
...options,
|
|
105
|
+
...offset100
|
|
106
|
+
});
|
|
107
|
+
const activeBackgroundColor = getColor({
|
|
108
|
+
...options,
|
|
109
|
+
...offset200
|
|
110
|
+
});
|
|
111
|
+
const foregroundColor = getColor({
|
|
112
|
+
theme,
|
|
113
|
+
variable: 'foreground.onEmphasis'
|
|
114
|
+
});
|
|
115
|
+
retVal = 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, focusStyles({
|
|
116
|
+
theme,
|
|
117
|
+
inset: focusInset,
|
|
118
|
+
shadowWidth: focusInset ? 'sm' : 'md',
|
|
119
|
+
spacerWidth: focusInset ? 'sm' : 'xs',
|
|
120
|
+
styles: (isDanger || isNeutral) && focusInset ? {
|
|
121
|
+
borderColor: getColor({
|
|
122
|
+
theme,
|
|
123
|
+
variable: 'border.primaryEmphasis'
|
|
124
|
+
})
|
|
65
125
|
} : undefined
|
|
66
|
-
}),
|
|
126
|
+
}), activeBackgroundColor, disabledBackgroundColor, disabledForegroundColor);
|
|
67
127
|
} else {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
128
|
+
let borderColor;
|
|
129
|
+
let hoverBorderColor;
|
|
130
|
+
let activeBorderColor;
|
|
131
|
+
let focusBorderColor;
|
|
132
|
+
let backgroundVariable;
|
|
133
|
+
let foregroundVariable;
|
|
134
|
+
if (isDanger) {
|
|
135
|
+
if (!isBasic) {
|
|
136
|
+
const borderOptions = {
|
|
137
|
+
theme,
|
|
138
|
+
variable: 'border.dangerEmphasis'
|
|
139
|
+
};
|
|
140
|
+
borderColor = getColor(borderOptions);
|
|
141
|
+
hoverBorderColor = getColor({
|
|
142
|
+
...borderOptions,
|
|
143
|
+
...offset100
|
|
144
|
+
});
|
|
145
|
+
activeBorderColor = getColor({
|
|
146
|
+
...borderOptions,
|
|
147
|
+
...offset200
|
|
148
|
+
});
|
|
149
|
+
if (isNeutral) {
|
|
150
|
+
focusBorderColor = getColor(borderOptions);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
backgroundVariable = 'background.dangerEmphasis';
|
|
154
|
+
foregroundVariable = isNeutral ? 'foreground.default' : 'foreground.danger';
|
|
155
|
+
} else {
|
|
156
|
+
if (!isBasic) {
|
|
157
|
+
const borderOptions = {
|
|
158
|
+
theme,
|
|
159
|
+
variable: 'border.primaryEmphasis'
|
|
160
|
+
};
|
|
161
|
+
if (isNeutral) {
|
|
162
|
+
borderColor = getColor({
|
|
163
|
+
theme,
|
|
164
|
+
variable: 'border.default',
|
|
165
|
+
...offset100
|
|
166
|
+
});
|
|
167
|
+
hoverBorderColor = getColor(borderOptions);
|
|
168
|
+
focusBorderColor = hoverBorderColor;
|
|
169
|
+
activeBorderColor = getColor({
|
|
170
|
+
...borderOptions,
|
|
171
|
+
...offset100
|
|
172
|
+
});
|
|
173
|
+
} else {
|
|
174
|
+
borderColor = getColor(borderOptions);
|
|
175
|
+
hoverBorderColor = getColor({
|
|
176
|
+
...borderOptions,
|
|
177
|
+
...offset100
|
|
178
|
+
});
|
|
179
|
+
activeBorderColor = getColor({
|
|
180
|
+
...borderOptions,
|
|
181
|
+
...offset200
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
backgroundVariable = 'background.primaryEmphasis';
|
|
186
|
+
foregroundVariable = isNeutral ? 'foreground.default' : 'foreground.primary';
|
|
187
|
+
}
|
|
188
|
+
const hoverBackgroundColor = getColor({
|
|
189
|
+
theme,
|
|
190
|
+
variable: backgroundVariable,
|
|
191
|
+
transparency: theme.opacity[100]
|
|
192
|
+
});
|
|
193
|
+
const activeBackgroundColor = getColor({
|
|
194
|
+
theme,
|
|
195
|
+
variable: backgroundVariable,
|
|
196
|
+
transparency: theme.opacity[200]
|
|
197
|
+
});
|
|
198
|
+
const foregroundOptions = {
|
|
199
|
+
theme,
|
|
200
|
+
variable: foregroundVariable
|
|
201
|
+
};
|
|
202
|
+
const foregroundColor = getColor(foregroundOptions);
|
|
203
|
+
let hoverForegroundColor;
|
|
204
|
+
let activeForegroundColor;
|
|
205
|
+
let iconForegroundColor;
|
|
206
|
+
let hoverIconForegroundColor;
|
|
207
|
+
let activeIconForegroundColor;
|
|
208
|
+
if (isNeutral) {
|
|
209
|
+
const iconOptions = {
|
|
210
|
+
theme,
|
|
211
|
+
variable: 'foreground.subtle'
|
|
212
|
+
};
|
|
213
|
+
iconForegroundColor = getColor(iconOptions);
|
|
214
|
+
hoverIconForegroundColor = getColor({
|
|
215
|
+
...iconOptions,
|
|
216
|
+
...offset100
|
|
217
|
+
});
|
|
218
|
+
activeIconForegroundColor = getColor({
|
|
219
|
+
...iconOptions,
|
|
220
|
+
...offset200
|
|
221
|
+
});
|
|
222
|
+
} else {
|
|
223
|
+
hoverForegroundColor = getColor({
|
|
224
|
+
...foregroundOptions,
|
|
225
|
+
...offset100
|
|
226
|
+
});
|
|
227
|
+
activeForegroundColor = getColor({
|
|
228
|
+
...foregroundOptions,
|
|
229
|
+
...offset200
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
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 ", "{color:", ";}&:active ", "{color:", ";}&:disabled ", "{color:", ";}"], borderColor, foregroundColor, hoverBorderColor, hoverBackgroundColor, hoverForegroundColor, focusStyles({
|
|
233
|
+
theme,
|
|
234
|
+
inset: focusInset,
|
|
235
|
+
styles: {
|
|
236
|
+
borderColor: focusBorderColor
|
|
237
|
+
}
|
|
238
|
+
}), activeBorderColor, activeBackgroundColor, activeForegroundColor, disabledBackgroundColor, disabledForegroundColor, StyledIcon, iconForegroundColor, StyledIcon, StyledIcon, hoverIconForegroundColor, StyledIcon, activeIconForegroundColor, StyledIcon, disabledForegroundColor);
|
|
79
239
|
}
|
|
80
240
|
return retVal;
|
|
81
241
|
};
|
|
82
|
-
const groupStyles =
|
|
83
|
-
|
|
242
|
+
const groupStyles = _ref2 => {
|
|
243
|
+
let {
|
|
84
244
|
theme,
|
|
85
245
|
isPrimary,
|
|
86
246
|
isBasic,
|
|
87
247
|
isPill,
|
|
88
248
|
focusInset
|
|
89
|
-
} =
|
|
249
|
+
} = _ref2;
|
|
90
250
|
const {
|
|
91
251
|
rtl,
|
|
92
252
|
borderWidths,
|
|
@@ -97,9 +257,15 @@ const groupStyles = props => {
|
|
|
97
257
|
const marginOffset = borderWidths.sm;
|
|
98
258
|
const marginDisplacement = `${isPrimary || isBasic ? '' : '-'}${marginOffset}`;
|
|
99
259
|
const iconMarginDisplacement = isPill && '-2px';
|
|
100
|
-
const disabledBackgroundColor = !isPrimary &&
|
|
260
|
+
const disabledBackgroundColor = !isPrimary && getColor({
|
|
261
|
+
theme,
|
|
262
|
+
variable: 'background.disabled'
|
|
263
|
+
});
|
|
101
264
|
const borderColor = isBasic ? 'transparent' : 'revert';
|
|
102
|
-
const focusColor =
|
|
265
|
+
const focusColor = getColor({
|
|
266
|
+
theme,
|
|
267
|
+
variable: 'border.primaryEmphasis'
|
|
268
|
+
});
|
|
103
269
|
const focusBoxShadow = isBasic && !isPrimary && getFocusBoxShadow({
|
|
104
270
|
theme,
|
|
105
271
|
inset: focusInset,
|
|
@@ -141,15 +307,12 @@ const sizeStyles = props => {
|
|
|
141
307
|
return retVal;
|
|
142
308
|
};
|
|
143
309
|
const StyledButton = styled.button.attrs(props => ({
|
|
144
|
-
'data-garden-id': COMPONENT_ID,
|
|
145
|
-
'data-garden-version': '9.0.0
|
|
310
|
+
'data-garden-id': props['data-garden-id'] || COMPONENT_ID,
|
|
311
|
+
'data-garden-version': '9.0.0',
|
|
146
312
|
type: props.type || 'button'
|
|
147
313
|
})).withConfig({
|
|
148
314
|
displayName: "StyledButton",
|
|
149
315
|
componentId: "sc-qe3ace-0"
|
|
150
|
-
})(["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:
|
|
151
|
-
StyledButton.defaultProps = {
|
|
152
|
-
theme: DEFAULT_THEME
|
|
153
|
-
};
|
|
316
|
+
})(["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), SELECTOR_FOCUS_VISIBLE, props => props.isLink ? 'underline' : 'none', props => props.isLink ? 'underline' : 'none', props => colorStyles(props), props => props.isLink && 'none', StyledIcon, props => iconStyles(props), StyledSplitButton, props => groupStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
154
317
|
|
|
155
|
-
export { StyledButton, getHeight };
|
|
318
|
+
export { COMPONENT_ID, StyledButton, getHeight };
|
|
@@ -6,18 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import SvgNewWindowStroke from '../node_modules/@zendeskgarden/svg-icons/src/12/new-window-stroke.svg.js';
|
|
9
|
-
import { retrieveComponentStyles
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'buttons.external_icon';
|
|
12
12
|
const StyledExternalIcon = styled(SvgNewWindowStroke).attrs({
|
|
13
13
|
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.0.0
|
|
14
|
+
'data-garden-version': '9.0.0'
|
|
15
15
|
}).withConfig({
|
|
16
16
|
displayName: "StyledExternalIcon",
|
|
17
17
|
componentId: "sc-16oz07e-0"
|
|
18
18
|
})(["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 => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
-
StyledExternalIcon.defaultProps = {
|
|
20
|
-
theme: DEFAULT_THEME
|
|
21
|
-
};
|
|
22
19
|
|
|
23
20
|
export { StyledExternalIcon };
|
|
@@ -5,36 +5,24 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
|
-
import
|
|
9
|
-
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
8
|
+
import { StyledBaseIcon, retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
9
|
|
|
11
10
|
const COMPONENT_ID = 'buttons.icon';
|
|
12
11
|
const sizeStyles = props => {
|
|
13
12
|
let marginProperty;
|
|
14
|
-
if (props
|
|
13
|
+
if (props.$position === 'start') {
|
|
15
14
|
marginProperty = `margin-${props.theme.rtl ? 'left' : 'right'}`;
|
|
16
|
-
} else if (props
|
|
15
|
+
} else if (props.$position === 'end') {
|
|
17
16
|
marginProperty = `margin-${props.theme.rtl ? 'right' : 'left'}`;
|
|
18
17
|
}
|
|
19
18
|
return marginProperty && css(["", ":", "px;"], marginProperty, props.theme.space.base * 2);
|
|
20
19
|
};
|
|
21
|
-
const StyledIcon = styled(
|
|
22
|
-
let {
|
|
23
|
-
children,
|
|
24
|
-
isRotated,
|
|
25
|
-
theme,
|
|
26
|
-
...props
|
|
27
|
-
} = _ref;
|
|
28
|
-
return React__default.cloneElement(Children.only(children), props);
|
|
29
|
-
}).attrs({
|
|
20
|
+
const StyledIcon = styled(StyledBaseIcon).attrs({
|
|
30
21
|
'data-garden-id': COMPONENT_ID,
|
|
31
|
-
'data-garden-version': '9.0.0
|
|
22
|
+
'data-garden-version': '9.0.0'
|
|
32
23
|
}).withConfig({
|
|
33
24
|
displayName: "StyledIcon",
|
|
34
25
|
componentId: "sc-19meqgg-0"
|
|
35
|
-
})(["transform:", ";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;", ";", ";"], props => props
|
|
36
|
-
StyledIcon.defaultProps = {
|
|
37
|
-
theme: DEFAULT_THEME
|
|
38
|
-
};
|
|
26
|
+
})(["transform:", ";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;", ";", ";"], props => props.$isRotated && `rotate(${props.theme.rtl ? '-' : '+'}180deg)`, props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
39
27
|
|
|
40
28
|
export { StyledIcon };
|
|
@@ -5,16 +5,38 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles,
|
|
9
|
-
import { StyledButton, getHeight } from './StyledButton.js';
|
|
8
|
+
import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledButton, COMPONENT_ID as COMPONENT_ID$1, getHeight } from './StyledButton.js';
|
|
10
10
|
import { StyledIcon } from './StyledIcon.js';
|
|
11
11
|
|
|
12
12
|
const COMPONENT_ID = 'buttons.icon_button';
|
|
13
|
-
const iconColorStyles =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
13
|
+
const iconColorStyles = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
theme
|
|
16
|
+
} = _ref;
|
|
17
|
+
const options = {
|
|
18
|
+
theme,
|
|
19
|
+
variable: 'foreground.subtle'
|
|
20
|
+
};
|
|
21
|
+
const baseColor = getColor(options);
|
|
22
|
+
const hoverColor = getColor({
|
|
23
|
+
...options,
|
|
24
|
+
dark: {
|
|
25
|
+
offset: -100
|
|
26
|
+
},
|
|
27
|
+
light: {
|
|
28
|
+
offset: 100
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const activeColor = getColor({
|
|
32
|
+
...options,
|
|
33
|
+
dark: {
|
|
34
|
+
offset: -200
|
|
35
|
+
},
|
|
36
|
+
light: {
|
|
37
|
+
offset: 200
|
|
38
|
+
}
|
|
39
|
+
});
|
|
18
40
|
return css(["color:", ";&:hover{color:", ";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{color:", ";}"], baseColor, hoverColor, activeColor);
|
|
19
41
|
};
|
|
20
42
|
const iconButtonStyles = props => {
|
|
@@ -25,15 +47,15 @@ const iconStyles = props => {
|
|
|
25
47
|
const size = props.theme.iconSizes.md;
|
|
26
48
|
return css(["width:", ";height:", ";& > svg{transition:opacity 0.15s ease-in-out;}"], size, size);
|
|
27
49
|
};
|
|
28
|
-
const StyledIconButton = styled(StyledButton).attrs({
|
|
29
|
-
'data-garden-id'
|
|
30
|
-
|
|
50
|
+
const StyledIconButton = styled(StyledButton).attrs(props => {
|
|
51
|
+
const externalId = props['data-garden-id'];
|
|
52
|
+
return {
|
|
53
|
+
'data-garden-id': externalId && externalId !== COMPONENT_ID$1 ? externalId : COMPONENT_ID,
|
|
54
|
+
'data-garden-version': '9.0.0'
|
|
55
|
+
};
|
|
31
56
|
}).withConfig({
|
|
32
57
|
displayName: "StyledIconButton",
|
|
33
58
|
componentId: "sc-1t0ughp-0"
|
|
34
|
-
})(["", ";& ", "{", "}", ";"], props => iconButtonStyles(props), StyledIcon, props => iconStyles(props), props => retrieveComponentStyles(
|
|
35
|
-
StyledIconButton.defaultProps = {
|
|
36
|
-
theme: DEFAULT_THEME
|
|
37
|
-
};
|
|
59
|
+
})(["", ";& ", "{", "}", ";"], props => iconButtonStyles(props), StyledIcon, props => iconStyles(props), props => retrieveComponentStyles(props['data-garden-id'], props));
|
|
38
60
|
|
|
39
|
-
export { StyledIconButton };
|
|
61
|
+
export { COMPONENT_ID, StyledIconButton };
|
|
@@ -5,18 +5,15 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles
|
|
8
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
10
|
const COMPONENT_ID = 'buttons.button_group_view';
|
|
11
11
|
const StyledSplitButton = styled.div.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0
|
|
13
|
+
'data-garden-version': '9.0.0'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledSplitButton",
|
|
16
16
|
componentId: "sc-1u4v04v-0"
|
|
17
17
|
})(["display:inline-flex;position:relative;z-index:0;direction:", ";white-space:nowrap;", ";"], props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
-
StyledSplitButton.defaultProps = {
|
|
19
|
-
theme: DEFAULT_THEME
|
|
20
|
-
};
|
|
21
18
|
|
|
22
19
|
export { StyledSplitButton };
|