@zendeskgarden/react-buttons 9.0.0-next.9 → 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/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.0.0-next.9'
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 => {
@@ -62,14 +59,11 @@ 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.0.0-next.9'
62
+ 'data-garden-version': '9.0.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 => {
@@ -78,9 +72,6 @@ const getBorderRadius = props => {
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
76
  if (props.size === 'small') {
86
77
  return `${props.theme.space.base * 8}px`;
@@ -89,65 +80,228 @@ const getHeight = props => {
89
80
  }
90
81
  return `${props.theme.space.base * 10}px`;
91
82
  };
92
- const colorStyles = props => {
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
- let hue;
95
- if (props.disabled || props.isNeutral && props.isPrimary && !props.isDanger) {
96
- hue = 'neutralHue';
97
- } else if (props.isDanger) {
98
- hue = 'dangerHue';
99
- } else {
100
- hue = 'primaryHue';
101
- }
102
- const shade = 600;
103
- const baseColor = reactTheming.getColorV8(hue, shade, props.theme);
104
- const hoverColor = reactTheming.getColorV8(hue, shade + 100, props.theme);
105
- const activeColor = reactTheming.getColorV8(hue, shade + 200, props.theme);
106
- const focusColor = reactTheming.getColorV8('primaryHue', shade, props.theme);
107
- const disabledBackgroundColor = getDisabledBackgroundColor(props);
108
- const disabledForegroundColor = reactTheming.getColorV8(hue, shade - 200, props.theme);
109
- if (props.isLink) {
110
- 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({
111
- theme: props.theme,
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: baseColor,
115
- outlineColor: focusColor
140
+ color: foregroundColor ,
141
+ outlineColor: focusOutlineColor
116
142
  }
117
- }), hoverColor, activeColor, disabledForegroundColor);
118
- } else if (props.isPrimary) {
119
- 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:", ";}"], baseColor, props.theme.palette.white, hoverColor, reactTheming.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
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
- }), activeColor, props.isPrimary && activeColor, disabledBackgroundColor, disabledForegroundColor);
181
+ }), activeBackgroundColor, disabledBackgroundColor, disabledForegroundColor);
128
182
  } else {
129
- const borderColor = props.isNeutral && !props.isDanger ? reactTheming.getColorV8('neutralHue', 300, props.theme) : baseColor;
130
- const foregroundColor = props.isNeutral ? reactTheming.getColorV8('foreground', 600 , props.theme) : baseColor;
131
- const hoverBorderColor = props.isNeutral && !props.isDanger ? baseColor : hoverColor;
132
- const hoverForegroundColor = props.isNeutral ? foregroundColor : hoverColor;
133
- 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:", ";}"], !props.isBasic && borderColor, foregroundColor, !props.isBasic && hoverBorderColor, polished.rgba(baseColor, 0.08), hoverForegroundColor, reactTheming.focusStyles({
134
- theme: props.theme,
135
- inset: props.focusInset,
136
- styles: props.isNeutral ? {
137
- borderColor: baseColor
138
- } : undefined
139
- }), !props.isBasic && activeColor, polished.rgba(baseColor, 0.2), !props.isNeutral && activeColor, disabledBackgroundColor, disabledForegroundColor, StyledIcon, props.isNeutral && reactTheming.getColorV8('neutralHue', shade, props.theme), StyledIcon, StyledIcon, props.isNeutral && reactTheming.getColorV8('neutralHue', shade + 100, props.theme), StyledIcon, props.isNeutral && foregroundColor, StyledIcon, disabledForegroundColor);
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 = props => {
144
- const {
297
+ const groupStyles = _ref2 => {
298
+ let {
145
299
  theme,
146
300
  isPrimary,
147
301
  isBasic,
148
302
  isPill,
149
303
  focusInset
150
- } = props;
304
+ } = _ref2;
151
305
  const {
152
306
  rtl,
153
307
  borderWidths,
@@ -158,9 +312,15 @@ const groupStyles = props => {
158
312
  const marginOffset = borderWidths.sm;
159
313
  const marginDisplacement = `${isPrimary || isBasic ? '' : '-'}${marginOffset}`;
160
314
  const iconMarginDisplacement = isPill && '-2px';
161
- const disabledBackgroundColor = !isPrimary && getDisabledBackgroundColor(props);
315
+ const disabledBackgroundColor = !isPrimary && reactTheming.getColor({
316
+ theme,
317
+ variable: 'background.disabled'
318
+ });
162
319
  const borderColor = isBasic ? 'transparent' : 'revert';
163
- const focusColor = reactTheming.getColorV8('primaryHue', 600, theme);
320
+ const focusColor = reactTheming.getColor({
321
+ theme,
322
+ variable: 'border.primaryEmphasis'
323
+ });
164
324
  const focusBoxShadow = isBasic && !isPrimary && reactTheming.getFocusBoxShadow({
165
325
  theme,
166
326
  inset: focusInset,
@@ -202,21 +362,18 @@ 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.0.0-next.9',
365
+ 'data-garden-id': props['data-garden-id'] || COMPONENT_ID$3,
366
+ 'data-garden-version': '9.0.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: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), StyledSplitButton, props => groupStyles(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
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.0.0-next.9',
376
+ 'data-garden-version': '9.0.0',
220
377
  as: 'a',
221
378
  dir: props.theme.rtl ? 'rtl' : undefined,
222
379
  isLink: true,
@@ -224,13 +381,10 @@ const StyledAnchor = styled__default.default(StyledButton).attrs(props => ({
224
381
  })).withConfig({
225
382
  displayName: "StyledAnchor",
226
383
  componentId: "sc-xshgmo-0"
227
- })(["direction:", ";", ";"], props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
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 (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
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,21 +404,40 @@ 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.0.0-next.9'
407
+ 'data-garden-version': '9.0.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 = props => {
264
- const shade = 600;
265
- const baseColor = reactTheming.getColorV8('neutralHue', shade, props.theme);
266
- const hoverColor = reactTheming.getColorV8('neutralHue', shade + 100, props.theme);
267
- const activeColor = reactTheming.getColorV8('neutralHue', shade + 200, props.theme);
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 => {
@@ -275,16 +448,16 @@ 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': COMPONENT_ID,
280
- 'data-garden-version': '9.0.0-next.9'
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
+ };
281
457
  }).withConfig({
282
458
  displayName: "StyledIconButton",
283
459
  componentId: "sc-1t0ughp-0"
284
- })(["", ";& ", "{", "}", ";"], props => iconButtonStyles(props), StyledIcon, props => iconStyles(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
285
- StyledIconButton.defaultProps = {
286
- theme: reactTheming.DEFAULT_THEME
287
- };
460
+ })(["", ";& ", "{", "}", ";"], props => iconButtonStyles(props), StyledIcon, props => iconStyles(props), props => reactTheming.retrieveComponentStyles(props['data-garden-id'], props));
288
461
 
289
462
  const SplitButtonContext = React.createContext(undefined);
290
463
  const useSplitButtonContext = () => {
@@ -321,7 +494,8 @@ const ButtonComponent = React.forwardRef((props, ref) => {
321
494
  const splitButtonContext = useSplitButtonContext();
322
495
  const computedProps = {
323
496
  ...props,
324
- focusInset: props.focusInset || splitButtonContext
497
+ focusInset: props.focusInset || splitButtonContext,
498
+ $isUnderlined: props.isLink
325
499
  };
326
500
  return React__namespace.default.createElement(StyledButton, Object.assign({}, computedProps, {
327
501
  ref: ref
@@ -351,6 +525,7 @@ const Anchor = React.forwardRef((_ref, ref) => {
351
525
  children,
352
526
  isExternal,
353
527
  externalIconLabel,
528
+ isUnderlined = true,
354
529
  ...otherProps
355
530
  } = _ref;
356
531
  let anchorProps = otherProps;
@@ -368,8 +543,9 @@ const Anchor = React.forwardRef((_ref, ref) => {
368
543
  };
369
544
  const iconAriaLabel = reactTheming.useText(Anchor, checkProps, isExternal ? 'externalIconLabel' : 'noIconLabel', '(opens in a new tab)');
370
545
  return React__namespace.default.createElement(StyledAnchor, Object.assign({
371
- ref: ref
372
- }, anchorProps), children, isExternal &&
546
+ ref: ref,
547
+ $isUnderlined: isUnderlined
548
+ }, anchorProps), children, !!isExternal &&
373
549
  React__namespace.default.createElement(StyledExternalIcon, {
374
550
  role: "img",
375
551
  "aria-label": iconAriaLabel,
@@ -380,6 +556,7 @@ Anchor.displayName = 'Anchor';
380
556
  Anchor.propTypes = {
381
557
  isExternal: PropTypes__default.default.bool,
382
558
  isDanger: PropTypes__default.default.bool,
559
+ isUnderlined: PropTypes__default.default.bool,
383
560
  externalIconLabel: PropTypes__default.default.string
384
561
  };
385
562
 
@@ -416,7 +593,7 @@ IconButton.defaultProps = {
416
593
  };
417
594
 
418
595
  var _path;
419
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
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); }
420
597
  var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
421
598
  return /*#__PURE__*/React__namespace.createElement("svg", _extends({
422
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: React.ForwardRefExoticComponent<IButtonProps & React.RefAttributes<HTMLButtonElement>> & {
15
+ export declare const Button: typeof ButtonComponent & {
15
16
  EndIcon: typeof EndIcon;
16
17
  StartIcon: typeof StartIcon;
17
18
  };
19
+ export {};
@@ -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("..").IButtonProps & {
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 getHeight: (props: IButtonProps & ThemeProps<DefaultTheme>) => string;
10
- /**
11
- * 1. FF <input type="submit"> fix
12
- * 2. <a> element reset
13
- * 3. Shifting :focus-visible from LVHFA order to preserve `text-decoration` on hover
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>;
@@ -4,7 +4,6 @@
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
- /// <reference types="react" />
8
7
  import { DefaultTheme } from 'styled-components';
9
8
  interface IStyledIconProps {
10
9
  $isRotated: boolean;
@@ -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
- import { IButtonProps } from '../types';
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>;
@@ -5,8 +5,8 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  export * from './StyledAnchor';
8
- export * from './StyledButton';
8
+ export { StyledButton } from './StyledButton';
9
9
  export * from './StyledSplitButton';
10
10
  export * from './StyledExternalIcon';
11
11
  export * from './StyledIcon';
12
- export * from './StyledIconButton';
12
+ export { StyledIconButton } from './StyledIconButton';
@@ -53,4 +53,6 @@ export interface IAnchorProps extends Pick<IButtonProps, 'isDanger'>, AnchorHTML
53
53
  * making that icon accessible to assistive technology
54
54
  **/
55
55
  externalIconLabel?: string;
56
+ /** Determines if the anchor has underline styling */
57
+ isUnderlined?: boolean;
56
58
  }
@@ -4,6 +4,5 @@
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
- /// <reference types="react" />
8
7
  export declare const SplitButtonContext: import("react").Context<boolean | undefined>;
9
8
  export declare const useSplitButtonContext: () => boolean | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-buttons",
3
- "version": "9.0.0-next.9",
3
+ "version": "9.0.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>",
@@ -22,19 +22,19 @@
22
22
  "types": "dist/typings/index.d.ts",
23
23
  "dependencies": {
24
24
  "@zendeskgarden/container-utilities": "^2.0.0",
25
- "polished": "^4.0.0",
25
+ "polished": "^4.3.1",
26
26
  "prop-types": "^15.5.7",
27
27
  "react-merge-refs": "^2.0.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@zendeskgarden/react-theming": ">=9.0.0-next",
31
- "react": ">=16.8.0",
32
- "react-dom": ">=16.8.0",
31
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
32
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
33
33
  "styled-components": "^5.3.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@zendeskgarden/react-theming": "^9.0.0-next.9",
37
- "@zendeskgarden/svg-icons": "7.0.0"
36
+ "@zendeskgarden/react-theming": "^9.0.0",
37
+ "@zendeskgarden/svg-icons": "7.2.0"
38
38
  },
39
39
  "keywords": [
40
40
  "components",
@@ -45,6 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "zendeskgarden:src": "src/index.ts",
49
- "gitHead": "771281b562d376a6aee04b0cd71dd888b3ae4a1d"
48
+ "zendeskgarden:src": "src/index.ts"
50
49
  }