@zendeskgarden/react-buttons 9.0.0-next.2 → 9.0.0-next.20

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.
Files changed (37) hide show
  1. package/README.md +0 -27
  2. package/dist/esm/elements/Anchor.js +57 -0
  3. package/dist/esm/elements/Button.js +50 -0
  4. package/dist/esm/elements/ChevronButton.js +27 -0
  5. package/dist/esm/elements/IconButton.js +50 -0
  6. package/dist/esm/elements/SplitButton.js +29 -0
  7. package/dist/esm/elements/ToggleButton.js +30 -0
  8. package/dist/esm/elements/ToggleIconButton.js +32 -0
  9. package/dist/esm/elements/components/EndIcon.js +28 -0
  10. package/dist/esm/elements/components/StartIcon.js +28 -0
  11. package/dist/esm/index.js +13 -0
  12. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/new-window-stroke.svg.js +27 -0
  13. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +25 -0
  14. package/dist/esm/styled/StyledAnchor.js +27 -0
  15. package/dist/esm/styled/StyledButton.js +321 -0
  16. package/dist/esm/styled/StyledExternalIcon.js +23 -0
  17. package/dist/esm/styled/StyledIcon.js +31 -0
  18. package/dist/esm/styled/StyledIconButton.js +64 -0
  19. package/dist/esm/styled/StyledSplitButton.js +22 -0
  20. package/dist/esm/types/index.js +9 -0
  21. package/dist/esm/utils/useSplitButtonContext.js +14 -0
  22. package/dist/index.cjs.js +316 -203
  23. package/dist/typings/elements/Button.d.ts +1 -7
  24. package/dist/typings/elements/components/EndIcon.d.ts +1 -1
  25. package/dist/typings/elements/components/StartIcon.d.ts +1 -1
  26. package/dist/typings/index.d.ts +2 -3
  27. package/dist/typings/styled/StyledAnchor.d.ts +1 -8
  28. package/dist/typings/styled/StyledButton.d.ts +6 -7
  29. package/dist/typings/styled/StyledIcon.d.ts +4 -4
  30. package/dist/typings/styled/StyledIconButton.d.ts +2 -5
  31. package/dist/typings/styled/{StyledButtonGroup.d.ts → StyledSplitButton.d.ts} +1 -1
  32. package/dist/typings/styled/index.d.ts +3 -3
  33. package/dist/typings/types/index.d.ts +3 -13
  34. package/package.json +8 -9
  35. package/dist/index.esm.js +0 -559
  36. package/dist/typings/elements/ButtonGroup.d.ts +0 -14
  37. package/dist/typings/utils/useButtonGroupContext.d.ts +0 -14
package/dist/index.cjs.js CHANGED
@@ -1,20 +1,16 @@
1
1
  /**
2
- * Copyright Zendesk, Inc.
3
- *
4
- * Use of this source code is governed under the Apache License, Version 2.0
5
- * found at http://www.apache.org/licenses/LICENSE-2.0.
6
- */
7
-
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
8
7
  'use strict';
9
8
 
10
9
  var React = require('react');
11
10
  var PropTypes = require('prop-types');
12
- var reactMergeRefs = require('react-merge-refs');
13
11
  var styled = require('styled-components');
14
12
  var reactTheming = require('@zendeskgarden/react-theming');
15
13
  var polished = require('polished');
16
- var containerSelection = require('@zendeskgarden/container-selection');
17
- var containerUtilities = require('@zendeskgarden/container-utilities');
18
14
 
19
15
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
20
16
 
@@ -40,60 +36,37 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
40
36
  var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
41
37
  var styled__default = /*#__PURE__*/_interopDefault(styled);
42
38
 
43
- function _extends$2() {
44
- _extends$2 = Object.assign ? Object.assign.bind() : function (target) {
45
- for (var i = 1; i < arguments.length; i++) {
46
- var source = arguments[i];
47
- for (var key in source) {
48
- if (Object.prototype.hasOwnProperty.call(source, key)) {
49
- target[key] = source[key];
50
- }
51
- }
52
- }
53
- return target;
54
- };
55
- return _extends$2.apply(this, arguments);
56
- }
57
-
58
39
  const SIZE = ['small', 'medium', 'large'];
59
40
 
60
41
  const COMPONENT_ID$5 = 'buttons.button_group_view';
61
- const StyledButtonGroup = styled__default.default.div.attrs({
42
+ const StyledSplitButton = styled__default.default.div.attrs({
62
43
  'data-garden-id': COMPONENT_ID$5,
63
- 'data-garden-version': '9.0.0-next.2'
44
+ 'data-garden-version': '9.0.0-next.20'
64
45
  }).withConfig({
65
- displayName: "StyledButtonGroup",
66
- componentId: "sc-1fbpzef-0"
46
+ displayName: "StyledSplitButton",
47
+ componentId: "sc-1u4v04v-0"
67
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));
68
- StyledButtonGroup.defaultProps = {
49
+ StyledSplitButton.defaultProps = {
69
50
  theme: reactTheming.DEFAULT_THEME
70
51
  };
71
52
 
72
53
  const COMPONENT_ID$4 = 'buttons.icon';
73
54
  const sizeStyles$1 = props => {
74
55
  let marginProperty;
75
- if (props.position === 'start') {
56
+ if (props.$position === 'start') {
76
57
  marginProperty = `margin-${props.theme.rtl ? 'left' : 'right'}`;
77
- } else if (props.position === 'end') {
58
+ } else if (props.$position === 'end') {
78
59
  marginProperty = `margin-${props.theme.rtl ? 'right' : 'left'}`;
79
60
  }
80
61
  return marginProperty && styled.css(["", ":", "px;"], marginProperty, props.theme.space.base * 2);
81
62
  };
82
- const StyledIcon = styled__default.default(_ref => {
83
- let {
84
- children,
85
- isRotated,
86
- theme,
87
- ...props
88
- } = _ref;
89
- return React__namespace.default.cloneElement(React.Children.only(children), props);
90
- }).attrs({
63
+ const StyledIcon = styled__default.default(reactTheming.StyledBaseIcon).attrs({
91
64
  'data-garden-id': COMPONENT_ID$4,
92
- 'data-garden-version': '9.0.0-next.2'
65
+ 'data-garden-version': '9.0.0-next.20'
93
66
  }).withConfig({
94
67
  displayName: "StyledIcon",
95
68
  componentId: "sc-19meqgg-0"
96
- })(["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));
69
+ })(["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));
97
70
  StyledIcon.defaultProps = {
98
71
  theme: reactTheming.DEFAULT_THEME
99
72
  };
@@ -105,9 +78,6 @@ const getBorderRadius = props => {
105
78
  }
106
79
  return props.theme.borderRadii.md;
107
80
  };
108
- const getDisabledBackgroundColor = props => {
109
- return reactTheming.getColor('neutralHue', 200, props.theme);
110
- };
111
81
  const getHeight = props => {
112
82
  if (props.size === 'small') {
113
83
  return `${props.theme.space.base * 8}px`;
@@ -116,66 +86,228 @@ const getHeight = props => {
116
86
  }
117
87
  return `${props.theme.space.base * 10}px`;
118
88
  };
119
- const colorStyles = props => {
89
+ const colorStyles = _ref => {
90
+ let {
91
+ theme,
92
+ isLink,
93
+ isBasic,
94
+ isDanger,
95
+ isNeutral,
96
+ isPrimary,
97
+ focusInset
98
+ } = _ref;
120
99
  let retVal;
121
- let hue;
122
- if (props.disabled || props.isNeutral && (props.isPrimary || props.isSelected) && !props.isDanger) {
123
- hue = 'neutralHue';
124
- } else if (props.isDanger) {
125
- hue = 'dangerHue';
126
- } else {
127
- hue = 'primaryHue';
128
- }
129
- const shade = 600;
130
- const baseColor = reactTheming.getColor(hue, shade, props.theme);
131
- const hoverColor = reactTheming.getColor(hue, shade + 100, props.theme);
132
- const activeColor = reactTheming.getColor(hue, shade + 200, props.theme);
133
- const focusColor = reactTheming.getColor('primaryHue', shade, props.theme);
134
- const disabledBackgroundColor = getDisabledBackgroundColor(props);
135
- const disabledForegroundColor = reactTheming.getColor(hue, shade - 200, props.theme);
136
- if (props.isLink) {
137
- 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({
138
- theme: props.theme,
100
+ const disabledBackgroundColor = reactTheming.getColor({
101
+ theme,
102
+ variable: 'background.disabled'
103
+ });
104
+ const disabledForegroundColor = reactTheming.getColor({
105
+ theme,
106
+ variable: 'foreground.disabled'
107
+ });
108
+ const offset100 = {
109
+ dark: {
110
+ offset: -100
111
+ },
112
+ light: {
113
+ offset: 100
114
+ }
115
+ };
116
+ const offset200 = {
117
+ dark: {
118
+ offset: -200
119
+ },
120
+ light: {
121
+ offset: 200
122
+ }
123
+ };
124
+ if (isLink) {
125
+ const options = {
126
+ theme,
127
+ variable: isDanger ? 'foreground.danger' : 'foreground.primary'
128
+ };
129
+ const foregroundColor = reactTheming.getColor(options);
130
+ const hoverForegroundColor = reactTheming.getColor({
131
+ ...options,
132
+ ...offset100
133
+ });
134
+ const activeForegroundColor = reactTheming.getColor({
135
+ ...options,
136
+ ...offset200
137
+ });
138
+ const focusOutlineColor = reactTheming.getColor({
139
+ theme,
140
+ variable: 'border.primaryEmphasis'
141
+ });
142
+ 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({
143
+ theme,
139
144
  condition: false,
140
145
  styles: {
141
- color: baseColor,
142
- outlineColor: focusColor
146
+ color: foregroundColor ,
147
+ outlineColor: focusOutlineColor
143
148
  }
144
- }), hoverColor, activeColor, disabledForegroundColor);
145
- } else if (props.isPrimary || props.isSelected) {
146
- 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({
147
- theme: props.theme,
148
- inset: props.focusInset,
149
- shadowWidth: props.focusInset ? 'sm' : 'md',
150
- spacerWidth: props.focusInset ? 'sm' : 'xs',
151
- styles: props.isDanger && props.focusInset ? {
152
- borderColor: focusColor
149
+ }), hoverForegroundColor, activeForegroundColor, disabledForegroundColor);
150
+ } else if (isPrimary) {
151
+ let backgroundVariable;
152
+ if (isDanger) {
153
+ backgroundVariable = 'background.dangerEmphasis';
154
+ } else if (isNeutral) {
155
+ backgroundVariable = 'background.emphasis';
156
+ } else {
157
+ backgroundVariable = 'background.primaryEmphasis';
158
+ }
159
+ const options = {
160
+ theme,
161
+ variable: backgroundVariable
162
+ };
163
+ const backgroundColor = reactTheming.getColor(options);
164
+ const hoverBackgroundColor = reactTheming.getColor({
165
+ ...options,
166
+ ...offset100
167
+ });
168
+ const activeBackgroundColor = reactTheming.getColor({
169
+ ...options,
170
+ ...offset200
171
+ });
172
+ const foregroundColor = reactTheming.getColor({
173
+ theme,
174
+ variable: 'foreground.onEmphasis'
175
+ });
176
+ 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({
177
+ theme,
178
+ inset: focusInset,
179
+ shadowWidth: focusInset ? 'sm' : 'md',
180
+ spacerWidth: focusInset ? 'sm' : 'xs',
181
+ styles: (isDanger || isNeutral) && focusInset ? {
182
+ borderColor: reactTheming.getColor({
183
+ theme,
184
+ variable: 'border.primaryEmphasis'
185
+ })
153
186
  } : undefined
154
- }), activeColor, props.isPrimary && activeColor, disabledBackgroundColor, disabledForegroundColor);
187
+ }), activeBackgroundColor, disabledBackgroundColor, disabledForegroundColor);
155
188
  } else {
156
- const borderColor = props.isNeutral && !props.isDanger ? reactTheming.getColor('neutralHue', 300, props.theme) : baseColor;
157
- const foregroundColor = props.isNeutral ? props.theme.colors.foreground : baseColor;
158
- const hoverBorderColor = props.isNeutral && !props.isDanger ? baseColor : hoverColor;
159
- const hoverForegroundColor = props.isNeutral ? foregroundColor : hoverColor;
160
- 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({
161
- theme: props.theme,
162
- inset: props.focusInset,
163
- styles: props.isNeutral ? {
164
- borderColor: baseColor
165
- } : undefined
166
- }), !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);
189
+ let borderColor;
190
+ let hoverBorderColor;
191
+ let activeBorderColor;
192
+ let focusBorderColor;
193
+ let backgroundVariable;
194
+ let foregroundVariable;
195
+ if (isDanger) {
196
+ if (!isBasic) {
197
+ const borderOptions = {
198
+ theme,
199
+ variable: 'border.dangerEmphasis'
200
+ };
201
+ borderColor = reactTheming.getColor(borderOptions);
202
+ hoverBorderColor = reactTheming.getColor({
203
+ ...borderOptions,
204
+ ...offset100
205
+ });
206
+ activeBorderColor = reactTheming.getColor({
207
+ ...borderOptions,
208
+ ...offset200
209
+ });
210
+ if (isNeutral) {
211
+ focusBorderColor = reactTheming.getColor(borderOptions);
212
+ }
213
+ }
214
+ backgroundVariable = 'background.dangerEmphasis';
215
+ foregroundVariable = isNeutral ? 'foreground.default' : 'foreground.danger';
216
+ } else {
217
+ if (!isBasic) {
218
+ const borderOptions = {
219
+ theme,
220
+ variable: 'border.primaryEmphasis'
221
+ };
222
+ if (isNeutral) {
223
+ borderColor = reactTheming.getColor({
224
+ theme,
225
+ variable: 'border.default',
226
+ ...offset100
227
+ });
228
+ hoverBorderColor = reactTheming.getColor(borderOptions);
229
+ focusBorderColor = hoverBorderColor;
230
+ activeBorderColor = reactTheming.getColor({
231
+ ...borderOptions,
232
+ ...offset100
233
+ });
234
+ } else {
235
+ borderColor = reactTheming.getColor(borderOptions);
236
+ hoverBorderColor = reactTheming.getColor({
237
+ ...borderOptions,
238
+ ...offset100
239
+ });
240
+ activeBorderColor = reactTheming.getColor({
241
+ ...borderOptions,
242
+ ...offset200
243
+ });
244
+ }
245
+ }
246
+ backgroundVariable = 'background.primaryEmphasis';
247
+ foregroundVariable = isNeutral ? 'foreground.default' : 'foreground.primary';
248
+ }
249
+ const hoverBackgroundColor = reactTheming.getColor({
250
+ theme,
251
+ variable: backgroundVariable,
252
+ transparency: theme.opacity[100]
253
+ });
254
+ const activeBackgroundColor = reactTheming.getColor({
255
+ theme,
256
+ variable: backgroundVariable,
257
+ transparency: theme.opacity[200]
258
+ });
259
+ const foregroundOptions = {
260
+ theme,
261
+ variable: foregroundVariable
262
+ };
263
+ const foregroundColor = reactTheming.getColor(foregroundOptions);
264
+ let hoverForegroundColor;
265
+ let activeForegroundColor;
266
+ let iconForegroundColor;
267
+ let hoverIconForegroundColor;
268
+ let activeIconForegroundColor;
269
+ if (isNeutral) {
270
+ const iconOptions = {
271
+ theme,
272
+ variable: 'foreground.subtle'
273
+ };
274
+ iconForegroundColor = reactTheming.getColor(iconOptions);
275
+ hoverIconForegroundColor = reactTheming.getColor({
276
+ ...iconOptions,
277
+ ...offset100
278
+ });
279
+ activeIconForegroundColor = reactTheming.getColor({
280
+ ...iconOptions,
281
+ ...offset200
282
+ });
283
+ } else {
284
+ hoverForegroundColor = reactTheming.getColor({
285
+ ...foregroundOptions,
286
+ ...offset100
287
+ });
288
+ activeForegroundColor = reactTheming.getColor({
289
+ ...foregroundOptions,
290
+ ...offset200
291
+ });
292
+ }
293
+ 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({
294
+ theme,
295
+ inset: focusInset,
296
+ styles: {
297
+ borderColor: focusBorderColor
298
+ }
299
+ }), activeBorderColor, activeBackgroundColor, activeForegroundColor, disabledBackgroundColor, disabledForegroundColor, StyledIcon, iconForegroundColor, StyledIcon, StyledIcon, hoverIconForegroundColor, StyledIcon, activeIconForegroundColor, StyledIcon, disabledForegroundColor);
167
300
  }
168
301
  return retVal;
169
302
  };
170
- const groupStyles = props => {
171
- const {
303
+ const groupStyles = _ref2 => {
304
+ let {
172
305
  theme,
173
306
  isPrimary,
174
307
  isBasic,
175
- isSelected,
176
308
  isPill,
177
309
  focusInset
178
- } = props;
310
+ } = _ref2;
179
311
  const {
180
312
  rtl,
181
313
  borderWidths,
@@ -186,14 +318,24 @@ const groupStyles = props => {
186
318
  const marginOffset = borderWidths.sm;
187
319
  const marginDisplacement = `${isPrimary || isBasic ? '' : '-'}${marginOffset}`;
188
320
  const iconMarginDisplacement = isPill && '-2px';
189
- const disabledBackgroundColor = !isPrimary && getDisabledBackgroundColor(props);
321
+ const disabledBackgroundColor = !isPrimary && reactTheming.getColor({
322
+ theme,
323
+ variable: 'background.disabled'
324
+ });
190
325
  const borderColor = isBasic ? 'transparent' : 'revert';
191
- const focusColor = reactTheming.getColor('primaryHue', 600, theme);
192
- const focusBoxShadow = isBasic && !isSelected && !isPrimary && reactTheming.getFocusBoxShadow({
326
+ const focusColor = reactTheming.getColor({
327
+ theme,
328
+ variable: 'border.primaryEmphasis'
329
+ });
330
+ const focusBoxShadow = isBasic && !isPrimary && reactTheming.getFocusBoxShadow({
193
331
  theme,
194
332
  inset: focusInset,
195
- spacerHue: focusColor,
196
- hue: 'transparent'
333
+ spacerColor: {
334
+ hue: focusColor
335
+ },
336
+ color: {
337
+ hue: 'transparent'
338
+ }
197
339
  });
198
340
  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);
199
341
  };
@@ -226,13 +368,13 @@ const sizeStyles = props => {
226
368
  return retVal;
227
369
  };
228
370
  const StyledButton = styled__default.default.button.attrs(props => ({
229
- 'data-garden-id': COMPONENT_ID$3,
230
- 'data-garden-version': '9.0.0-next.2',
371
+ 'data-garden-id': props['data-garden-id'] || COMPONENT_ID$3,
372
+ 'data-garden-version': '9.0.0-next.20',
231
373
  type: props.type || 'button'
232
374
  })).withConfig({
233
375
  displayName: "StyledButton",
234
376
  componentId: "sc-qe3ace-0"
235
- })(["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));
377
+ })(["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));
236
378
  StyledButton.defaultProps = {
237
379
  theme: reactTheming.DEFAULT_THEME
238
380
  };
@@ -240,7 +382,7 @@ StyledButton.defaultProps = {
240
382
  const COMPONENT_ID$2 = 'buttons.anchor';
241
383
  const StyledAnchor = styled__default.default(StyledButton).attrs(props => ({
242
384
  'data-garden-id': COMPONENT_ID$2,
243
- 'data-garden-version': '9.0.0-next.2',
385
+ 'data-garden-version': '9.0.0-next.20',
244
386
  as: 'a',
245
387
  dir: props.theme.rtl ? 'rtl' : undefined,
246
388
  isLink: true,
@@ -248,13 +390,13 @@ const StyledAnchor = styled__default.default(StyledButton).attrs(props => ({
248
390
  })).withConfig({
249
391
  displayName: "StyledAnchor",
250
392
  componentId: "sc-xshgmo-0"
251
- })(["direction:", ";", ";"], props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
393
+ })(["direction:", ";", ";"], props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(props['data-garden-id'], props));
252
394
  StyledAnchor.defaultProps = {
253
395
  theme: reactTheming.DEFAULT_THEME
254
396
  };
255
397
 
256
398
  var _path$1;
257
- 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); }
399
+ 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); }
258
400
  var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
259
401
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
260
402
  xmlns: "http://www.w3.org/2000/svg",
@@ -274,7 +416,7 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
274
416
  const COMPONENT_ID$1 = 'buttons.external_icon';
275
417
  const StyledExternalIcon = styled__default.default(SvgNewWindowStroke).attrs({
276
418
  'data-garden-id': COMPONENT_ID$1,
277
- 'data-garden-version': '9.0.0-next.2'
419
+ 'data-garden-version': '9.0.0-next.20'
278
420
  }).withConfig({
279
421
  displayName: "StyledExternalIcon",
280
422
  componentId: "sc-16oz07e-0"
@@ -284,11 +426,33 @@ StyledExternalIcon.defaultProps = {
284
426
  };
285
427
 
286
428
  const COMPONENT_ID = 'buttons.icon_button';
287
- const iconColorStyles = props => {
288
- const shade = 600;
289
- const baseColor = reactTheming.getColor('neutralHue', shade, props.theme);
290
- const hoverColor = reactTheming.getColor('neutralHue', shade + 100, props.theme);
291
- const activeColor = reactTheming.getColor('neutralHue', shade + 200, props.theme);
429
+ const iconColorStyles = _ref => {
430
+ let {
431
+ theme
432
+ } = _ref;
433
+ const options = {
434
+ theme,
435
+ variable: 'foreground.subtle'
436
+ };
437
+ const baseColor = reactTheming.getColor(options);
438
+ const hoverColor = reactTheming.getColor({
439
+ ...options,
440
+ dark: {
441
+ offset: -100
442
+ },
443
+ light: {
444
+ offset: 100
445
+ }
446
+ });
447
+ const activeColor = reactTheming.getColor({
448
+ ...options,
449
+ dark: {
450
+ offset: -200
451
+ },
452
+ light: {
453
+ offset: 200
454
+ }
455
+ });
292
456
  return styled.css(["color:", ";&:hover{color:", ";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{color:", ";}"], baseColor, hoverColor, activeColor);
293
457
  };
294
458
  const iconButtonStyles = props => {
@@ -299,60 +463,60 @@ const iconStyles = props => {
299
463
  const size = props.theme.iconSizes.md;
300
464
  return styled.css(["width:", ";height:", ";& > svg{transition:opacity 0.15s ease-in-out;}"], size, size);
301
465
  };
302
- const StyledIconButton = styled__default.default(StyledButton).attrs({
303
- 'data-garden-id': COMPONENT_ID,
304
- 'data-garden-version': '9.0.0-next.2'
466
+ const StyledIconButton = styled__default.default(StyledButton).attrs(props => {
467
+ const externalId = props['data-garden-id'];
468
+ return {
469
+ 'data-garden-id': externalId && externalId !== COMPONENT_ID$3 ? externalId : COMPONENT_ID,
470
+ 'data-garden-version': '9.0.0-next.20'
471
+ };
305
472
  }).withConfig({
306
473
  displayName: "StyledIconButton",
307
474
  componentId: "sc-1t0ughp-0"
308
- })(["", ";& ", "{", "}", ";"], props => iconButtonStyles(props), StyledIcon, props => iconStyles(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
475
+ })(["", ";& ", "{", "}", ";"], props => iconButtonStyles(props), StyledIcon, props => iconStyles(props), props => reactTheming.retrieveComponentStyles(props['data-garden-id'], props));
309
476
  StyledIconButton.defaultProps = {
310
477
  theme: reactTheming.DEFAULT_THEME
311
478
  };
312
479
 
313
- const ButtonGroupContext = React.createContext(undefined);
314
- const useButtonGroupContext = () => {
315
- return React.useContext(ButtonGroupContext);
316
- };
317
-
318
480
  const SplitButtonContext = React.createContext(undefined);
319
481
  const useSplitButtonContext = () => {
320
482
  return React.useContext(SplitButtonContext);
321
483
  };
322
484
 
323
- const StartIconComponent = props => React__namespace.default.createElement(StyledIcon, _extends$2({
324
- position: "start"
325
- }, props));
485
+ const StartIconComponent = _ref => {
486
+ let {
487
+ isRotated,
488
+ ...props
489
+ } = _ref;
490
+ return React__namespace.default.createElement(StyledIcon, Object.assign({
491
+ $position: "start",
492
+ $isRotated: isRotated
493
+ }, props));
494
+ };
326
495
  StartIconComponent.displayName = 'Button.StartIcon';
327
496
  const StartIcon = StartIconComponent;
328
497
 
329
- const EndIconComponent = props => React__namespace.default.createElement(StyledIcon, _extends$2({
330
- position: "end"
331
- }, props));
498
+ const EndIconComponent = _ref => {
499
+ let {
500
+ isRotated,
501
+ ...props
502
+ } = _ref;
503
+ return React__namespace.default.createElement(StyledIcon, Object.assign({
504
+ $position: "end",
505
+ $isRotated: isRotated
506
+ }, props));
507
+ };
332
508
  EndIconComponent.displayName = 'Button.EndIcon';
333
509
  const EndIcon = EndIconComponent;
334
510
 
335
511
  const ButtonComponent = React.forwardRef((props, ref) => {
336
- const buttonGroupContext = useButtonGroupContext();
337
512
  const splitButtonContext = useSplitButtonContext();
338
- let computedRef = ref;
339
- let computedProps = {
513
+ const computedProps = {
340
514
  ...props,
341
- focusInset: props.focusInset || buttonGroupContext !== undefined || splitButtonContext
515
+ focusInset: props.focusInset || splitButtonContext,
516
+ $isUnderlined: props.isLink
342
517
  };
343
- if (buttonGroupContext && !props.disabled) {
344
- if (!props.value) {
345
- throw new Error('"value" prop must be provided to Button when used within a ButtonGroup');
346
- }
347
- computedProps = buttonGroupContext.getButtonProps({
348
- isSelected: props.value === buttonGroupContext.selectedItem,
349
- ...computedProps
350
- });
351
- computedRef = reactMergeRefs.mergeRefs([
352
- computedProps.ref, ref]);
353
- }
354
- return React__namespace.default.createElement(StyledButton, _extends$2({}, computedProps, {
355
- ref: computedRef
518
+ return React__namespace.default.createElement(StyledButton, Object.assign({}, computedProps, {
519
+ ref: ref
356
520
  }));
357
521
  });
358
522
  ButtonComponent.displayName = 'Button';
@@ -365,7 +529,6 @@ ButtonComponent.propTypes = {
365
529
  focusInset: PropTypes__default.default.bool,
366
530
  isLink: PropTypes__default.default.bool,
367
531
  isStretched: PropTypes__default.default.bool,
368
- isSelected: PropTypes__default.default.bool,
369
532
  size: PropTypes__default.default.oneOf(SIZE)
370
533
  };
371
534
  ButtonComponent.defaultProps = {
@@ -380,6 +543,7 @@ const Anchor = React.forwardRef((_ref, ref) => {
380
543
  children,
381
544
  isExternal,
382
545
  externalIconLabel,
546
+ isUnderlined = true,
383
547
  ...otherProps
384
548
  } = _ref;
385
549
  let anchorProps = otherProps;
@@ -396,8 +560,9 @@ const Anchor = React.forwardRef((_ref, ref) => {
396
560
  noIconLabel: 'true'
397
561
  };
398
562
  const iconAriaLabel = reactTheming.useText(Anchor, checkProps, isExternal ? 'externalIconLabel' : 'noIconLabel', '(opens in a new tab)');
399
- return React__namespace.default.createElement(StyledAnchor, _extends$2({
400
- ref: ref
563
+ return React__namespace.default.createElement(StyledAnchor, Object.assign({
564
+ ref: ref,
565
+ $isUnderlined: isUnderlined
401
566
  }, anchorProps), children, isExternal &&
402
567
  React__namespace.default.createElement(StyledExternalIcon, {
403
568
  role: "img",
@@ -409,61 +574,10 @@ Anchor.displayName = 'Anchor';
409
574
  Anchor.propTypes = {
410
575
  isExternal: PropTypes__default.default.bool,
411
576
  isDanger: PropTypes__default.default.bool,
577
+ isUnderlined: PropTypes__default.default.bool,
412
578
  externalIconLabel: PropTypes__default.default.string
413
579
  };
414
580
 
415
- const ButtonGroup = React.forwardRef((_ref, ref) => {
416
- let {
417
- children,
418
- onSelect,
419
- selectedItem: controlledSelectedValue,
420
- ...otherProps
421
- } = _ref;
422
- const {
423
- rtl
424
- } = React.useContext(styled.ThemeContext) || reactTheming.DEFAULT_THEME;
425
- const [internalSelectedValue, setInternalSelectedValue] = React.useState();
426
- const selectedValue = containerUtilities.getControlledValue(controlledSelectedValue, internalSelectedValue);
427
- const values = React.useMemo(() => React.Children.toArray(children).reduce((buttons, child) => {
428
- if ( React.isValidElement(child) && child.type !== 'string' && !child.props.disabled) {
429
- buttons.push(child.props.value);
430
- }
431
- return buttons;
432
- }, []), [children]);
433
- const {
434
- selectedValue: selectedItem,
435
- getElementProps,
436
- getGroupProps
437
- } = containerSelection.useSelection({
438
- rtl,
439
- values,
440
- defaultSelectedValue: values[0],
441
- selectedValue,
442
- onSelect: React.useCallback(value => {
443
- onSelect && onSelect(value);
444
- setInternalSelectedValue(value);
445
- }, [onSelect])
446
- });
447
- const contextValue = React.useMemo(() => ({
448
- selectedItem,
449
- getButtonProps: props => getElementProps({
450
- role: 'button',
451
- selectedAriaKey: 'aria-pressed',
452
- ...props
453
- })
454
- }), [selectedItem, getElementProps]);
455
- return React__namespace.default.createElement(ButtonGroupContext.Provider, {
456
- value: contextValue
457
- }, React__namespace.default.createElement(StyledButtonGroup, _extends$2({
458
- ref: ref
459
- }, getGroupProps(otherProps)), children));
460
- });
461
- ButtonGroup.displayName = 'ButtonGroup';
462
- ButtonGroup.propTypes = {
463
- selectedItem: PropTypes__default.default.any,
464
- onSelect: PropTypes__default.default.func
465
- };
466
-
467
581
  const IconButton = React.forwardRef((_ref, ref) => {
468
582
  let {
469
583
  children,
@@ -471,12 +585,12 @@ const IconButton = React.forwardRef((_ref, ref) => {
471
585
  ...otherProps
472
586
  } = _ref;
473
587
  const focusInset = useSplitButtonContext();
474
- return React__namespace.default.createElement(StyledIconButton, _extends$2({
588
+ return React__namespace.default.createElement(StyledIconButton, Object.assign({
475
589
  ref: ref
476
590
  }, otherProps, {
477
591
  focusInset: otherProps.focusInset || focusInset
478
592
  }), React__namespace.default.createElement(StyledIcon, {
479
- isRotated: isRotated
593
+ $isRotated: isRotated
480
594
  }, children));
481
595
  });
482
596
  IconButton.displayName = 'IconButton';
@@ -497,7 +611,7 @@ IconButton.defaultProps = {
497
611
  };
498
612
 
499
613
  var _path;
500
- 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); }
614
+ 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); }
501
615
  var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
502
616
  return /*#__PURE__*/React__namespace.createElement("svg", _extends({
503
617
  xmlns: "http://www.w3.org/2000/svg",
@@ -516,7 +630,7 @@ const ChevronButton = React.forwardRef((_ref, ref) => {
516
630
  let {
517
631
  ...buttonProps
518
632
  } = _ref;
519
- return React__namespace.default.createElement(IconButton, _extends$2({
633
+ return React__namespace.default.createElement(IconButton, Object.assign({
520
634
  ref: ref
521
635
  }, buttonProps), React__namespace.default.createElement(SvgChevronDownStroke, null));
522
636
  });
@@ -535,7 +649,7 @@ const SplitButton = React.forwardRef((_ref, ref) => {
535
649
  } = _ref;
536
650
  return React__namespace.default.createElement(SplitButtonContext.Provider, {
537
651
  value: true
538
- }, React__namespace.default.createElement(StyledButtonGroup, _extends$2({
652
+ }, React__namespace.default.createElement(StyledSplitButton, Object.assign({
539
653
  ref: ref
540
654
  }, other), children));
541
655
  });
@@ -546,7 +660,7 @@ const ToggleButton = React.forwardRef((_ref, ref) => {
546
660
  isPressed,
547
661
  ...otherProps
548
662
  } = _ref;
549
- return React__namespace.default.createElement(Button, _extends$2({
663
+ return React__namespace.default.createElement(Button, Object.assign({
550
664
  "aria-pressed": isPressed,
551
665
  ref: ref
552
666
  }, otherProps));
@@ -565,7 +679,7 @@ const ToggleIconButton = React.forwardRef((_ref, ref) => {
565
679
  isPressed,
566
680
  ...otherProps
567
681
  } = _ref;
568
- return React__namespace.default.createElement(IconButton, _extends$2({
682
+ return React__namespace.default.createElement(IconButton, Object.assign({
569
683
  "aria-pressed": isPressed,
570
684
  ref: ref
571
685
  }, otherProps));
@@ -583,7 +697,6 @@ ToggleIconButton.defaultProps = {
583
697
 
584
698
  exports.Anchor = Anchor;
585
699
  exports.Button = Button;
586
- exports.ButtonGroup = ButtonGroup;
587
700
  exports.ChevronButton = ChevronButton;
588
701
  exports.IconButton = IconButton;
589
702
  exports.SplitButton = SplitButton;