@zendeskgarden/react-buttons 8.62.1 → 8.62.2
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 +58 -61
- package/dist/index.esm.js +6 -6
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
10
|
var React = require('react');
|
|
13
11
|
var PropTypes = require('prop-types');
|
|
14
12
|
var styled = require('styled-components');
|
|
@@ -16,7 +14,7 @@ var reactTheming = require('@zendeskgarden/react-theming');
|
|
|
16
14
|
var polished = require('polished');
|
|
17
15
|
var containerButtongroup = require('@zendeskgarden/container-buttongroup');
|
|
18
16
|
|
|
19
|
-
function
|
|
17
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
18
|
|
|
21
19
|
function _interopNamespace(e) {
|
|
22
20
|
if (e && e.__esModule) return e;
|
|
@@ -32,14 +30,13 @@ function _interopNamespace(e) {
|
|
|
32
30
|
}
|
|
33
31
|
});
|
|
34
32
|
}
|
|
35
|
-
n
|
|
33
|
+
n.default = e;
|
|
36
34
|
return Object.freeze(n);
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
40
37
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
41
|
-
var PropTypes__default = /*#__PURE__*/
|
|
42
|
-
var styled__default = /*#__PURE__*/
|
|
38
|
+
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
39
|
+
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
43
40
|
|
|
44
41
|
function _extends$2() {
|
|
45
42
|
_extends$2 = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -59,9 +56,9 @@ function _extends$2() {
|
|
|
59
56
|
const SIZE = ['small', 'medium', 'large'];
|
|
60
57
|
|
|
61
58
|
const COMPONENT_ID$5 = 'buttons.button_group_view';
|
|
62
|
-
const StyledButtonGroup = styled__default
|
|
59
|
+
const StyledButtonGroup = styled__default.default.div.attrs({
|
|
63
60
|
'data-garden-id': COMPONENT_ID$5,
|
|
64
|
-
'data-garden-version': '8.62.
|
|
61
|
+
'data-garden-version': '8.62.2'
|
|
65
62
|
}).withConfig({
|
|
66
63
|
displayName: "StyledButtonGroup",
|
|
67
64
|
componentId: "sc-1fbpzef-0"
|
|
@@ -80,17 +77,17 @@ const sizeStyles$1 = props => {
|
|
|
80
77
|
}
|
|
81
78
|
return marginProperty && styled.css(["", ":", "px;"], marginProperty, props.theme.space.base * 2);
|
|
82
79
|
};
|
|
83
|
-
const StyledIcon = styled__default
|
|
80
|
+
const StyledIcon = styled__default.default(_ref => {
|
|
84
81
|
let {
|
|
85
82
|
children,
|
|
86
83
|
isRotated,
|
|
87
84
|
theme,
|
|
88
85
|
...props
|
|
89
86
|
} = _ref;
|
|
90
|
-
return
|
|
87
|
+
return React__namespace.default.cloneElement(React.Children.only(children), props);
|
|
91
88
|
}).attrs({
|
|
92
89
|
'data-garden-id': COMPONENT_ID$4,
|
|
93
|
-
'data-garden-version': '8.62.
|
|
90
|
+
'data-garden-version': '8.62.2'
|
|
94
91
|
}).withConfig({
|
|
95
92
|
displayName: "StyledIcon",
|
|
96
93
|
componentId: "sc-19meqgg-0"
|
|
@@ -187,9 +184,9 @@ const sizeStyles = props => {
|
|
|
187
184
|
}
|
|
188
185
|
return retVal;
|
|
189
186
|
};
|
|
190
|
-
const StyledButton = styled__default
|
|
187
|
+
const StyledButton = styled__default.default.button.attrs(props => ({
|
|
191
188
|
'data-garden-id': COMPONENT_ID$3,
|
|
192
|
-
'data-garden-version': '8.62.
|
|
189
|
+
'data-garden-version': '8.62.2',
|
|
193
190
|
type: props.type || 'button'
|
|
194
191
|
})).withConfig({
|
|
195
192
|
displayName: "StyledButton",
|
|
@@ -200,9 +197,9 @@ StyledButton.defaultProps = {
|
|
|
200
197
|
};
|
|
201
198
|
|
|
202
199
|
const COMPONENT_ID$2 = 'buttons.anchor';
|
|
203
|
-
const StyledAnchor = styled__default
|
|
200
|
+
const StyledAnchor = styled__default.default(StyledButton).attrs(props => ({
|
|
204
201
|
'data-garden-id': COMPONENT_ID$2,
|
|
205
|
-
'data-garden-version': '8.62.
|
|
202
|
+
'data-garden-version': '8.62.2',
|
|
206
203
|
as: 'a',
|
|
207
204
|
dir: props.theme.rtl ? 'rtl' : undefined,
|
|
208
205
|
isLink: true,
|
|
@@ -237,9 +234,9 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
|
237
234
|
};
|
|
238
235
|
|
|
239
236
|
const COMPONENT_ID$1 = 'buttons.external_icon';
|
|
240
|
-
const StyledExternalIcon = styled__default
|
|
237
|
+
const StyledExternalIcon = styled__default.default(SvgNewWindowStroke).attrs({
|
|
241
238
|
'data-garden-id': COMPONENT_ID$1,
|
|
242
|
-
'data-garden-version': '8.62.
|
|
239
|
+
'data-garden-version': '8.62.2'
|
|
243
240
|
}).withConfig({
|
|
244
241
|
displayName: "StyledExternalIcon",
|
|
245
242
|
componentId: "sc-16oz07e-0"
|
|
@@ -264,9 +261,9 @@ const iconStyles = props => {
|
|
|
264
261
|
const size = props.theme.iconSizes.md;
|
|
265
262
|
return styled.css(["width:", ";height:", ";& > svg{transition:opacity 0.15s ease-in-out;}"], size, size);
|
|
266
263
|
};
|
|
267
|
-
const StyledIconButton = styled__default
|
|
264
|
+
const StyledIconButton = styled__default.default(StyledButton).attrs({
|
|
268
265
|
'data-garden-id': COMPONENT_ID,
|
|
269
|
-
'data-garden-version': '8.62.
|
|
266
|
+
'data-garden-version': '8.62.2'
|
|
270
267
|
}).withConfig({
|
|
271
268
|
displayName: "StyledIconButton",
|
|
272
269
|
componentId: "sc-1t0ughp-0"
|
|
@@ -285,13 +282,13 @@ const useSplitButtonContext = () => {
|
|
|
285
282
|
return React.useContext(SplitButtonContext);
|
|
286
283
|
};
|
|
287
284
|
|
|
288
|
-
const StartIconComponent = props =>
|
|
285
|
+
const StartIconComponent = props => React__namespace.default.createElement(StyledIcon, _extends$2({
|
|
289
286
|
position: "start"
|
|
290
287
|
}, props));
|
|
291
288
|
StartIconComponent.displayName = 'Button.StartIcon';
|
|
292
289
|
const StartIcon = StartIconComponent;
|
|
293
290
|
|
|
294
|
-
const EndIconComponent = props =>
|
|
291
|
+
const EndIconComponent = props => React__namespace.default.createElement(StyledIcon, _extends$2({
|
|
295
292
|
position: "end"
|
|
296
293
|
}, props));
|
|
297
294
|
EndIconComponent.displayName = 'Button.EndIcon';
|
|
@@ -310,27 +307,27 @@ const ButtonComponent = React.forwardRef((props, ref) => {
|
|
|
310
307
|
}
|
|
311
308
|
computedProps = buttonGroupContext.getButtonProps({
|
|
312
309
|
item: props.value,
|
|
313
|
-
focusRef:
|
|
310
|
+
focusRef: React__namespace.default.createRef(),
|
|
314
311
|
isSelected: props.value === buttonGroupContext.selectedItem,
|
|
315
312
|
...computedProps
|
|
316
313
|
});
|
|
317
314
|
}
|
|
318
|
-
return
|
|
315
|
+
return React__namespace.default.createElement(StyledButton, _extends$2({
|
|
319
316
|
ref: ref
|
|
320
317
|
}, computedProps));
|
|
321
318
|
});
|
|
322
319
|
ButtonComponent.displayName = 'Button';
|
|
323
320
|
ButtonComponent.propTypes = {
|
|
324
|
-
isNeutral: PropTypes__default
|
|
325
|
-
isPrimary: PropTypes__default
|
|
326
|
-
isDanger: PropTypes__default
|
|
327
|
-
isPill: PropTypes__default
|
|
328
|
-
isBasic: PropTypes__default
|
|
329
|
-
focusInset: PropTypes__default
|
|
330
|
-
isLink: PropTypes__default
|
|
331
|
-
isStretched: PropTypes__default
|
|
332
|
-
isSelected: PropTypes__default
|
|
333
|
-
size: PropTypes__default
|
|
321
|
+
isNeutral: PropTypes__default.default.bool,
|
|
322
|
+
isPrimary: PropTypes__default.default.bool,
|
|
323
|
+
isDanger: PropTypes__default.default.bool,
|
|
324
|
+
isPill: PropTypes__default.default.bool,
|
|
325
|
+
isBasic: PropTypes__default.default.bool,
|
|
326
|
+
focusInset: PropTypes__default.default.bool,
|
|
327
|
+
isLink: PropTypes__default.default.bool,
|
|
328
|
+
isStretched: PropTypes__default.default.bool,
|
|
329
|
+
isSelected: PropTypes__default.default.bool,
|
|
330
|
+
size: PropTypes__default.default.oneOf(SIZE)
|
|
334
331
|
};
|
|
335
332
|
ButtonComponent.defaultProps = {
|
|
336
333
|
size: 'medium'
|
|
@@ -360,9 +357,9 @@ const Anchor = React.forwardRef((_ref, ref) => {
|
|
|
360
357
|
noIconLabel: 'true'
|
|
361
358
|
};
|
|
362
359
|
const iconAriaLabel = reactTheming.useText(Anchor, checkProps, isExternal ? 'externalIconLabel' : 'noIconLabel', '(opens in a new tab)');
|
|
363
|
-
return
|
|
360
|
+
return React__namespace.default.createElement(StyledAnchor, _extends$2({
|
|
364
361
|
ref: ref
|
|
365
|
-
}, anchorProps), children, isExternal &&
|
|
362
|
+
}, anchorProps), children, isExternal && React__namespace.default.createElement(StyledExternalIcon, {
|
|
366
363
|
role: "img",
|
|
367
364
|
"aria-label": iconAriaLabel,
|
|
368
365
|
"aria-hidden": undefined
|
|
@@ -370,9 +367,9 @@ const Anchor = React.forwardRef((_ref, ref) => {
|
|
|
370
367
|
});
|
|
371
368
|
Anchor.displayName = 'Anchor';
|
|
372
369
|
Anchor.propTypes = {
|
|
373
|
-
isExternal: PropTypes__default
|
|
374
|
-
isDanger: PropTypes__default
|
|
375
|
-
externalIconLabel: PropTypes__default
|
|
370
|
+
isExternal: PropTypes__default.default.bool,
|
|
371
|
+
isDanger: PropTypes__default.default.bool,
|
|
372
|
+
externalIconLabel: PropTypes__default.default.string
|
|
376
373
|
};
|
|
377
374
|
|
|
378
375
|
const ButtonGroup = React.forwardRef((_ref, ref) => {
|
|
@@ -395,16 +392,16 @@ const ButtonGroup = React.forwardRef((_ref, ref) => {
|
|
|
395
392
|
selectedItem,
|
|
396
393
|
getButtonProps
|
|
397
394
|
}), [selectedItem, getButtonProps]);
|
|
398
|
-
return
|
|
395
|
+
return React__namespace.default.createElement(ButtonGroupContext.Provider, {
|
|
399
396
|
value: contextValue
|
|
400
|
-
},
|
|
397
|
+
}, React__namespace.default.createElement(StyledButtonGroup, _extends$2({
|
|
401
398
|
ref: ref
|
|
402
399
|
}, getGroupProps(otherProps)), children));
|
|
403
400
|
});
|
|
404
401
|
ButtonGroup.displayName = 'ButtonGroup';
|
|
405
402
|
ButtonGroup.propTypes = {
|
|
406
|
-
selectedItem: PropTypes__default
|
|
407
|
-
onSelect: PropTypes__default
|
|
403
|
+
selectedItem: PropTypes__default.default.any,
|
|
404
|
+
onSelect: PropTypes__default.default.func
|
|
408
405
|
};
|
|
409
406
|
|
|
410
407
|
const IconButton = React.forwardRef((_ref, ref) => {
|
|
@@ -414,24 +411,24 @@ const IconButton = React.forwardRef((_ref, ref) => {
|
|
|
414
411
|
...otherProps
|
|
415
412
|
} = _ref;
|
|
416
413
|
const focusInset = useSplitButtonContext();
|
|
417
|
-
return
|
|
414
|
+
return React__namespace.default.createElement(StyledIconButton, _extends$2({
|
|
418
415
|
ref: ref
|
|
419
416
|
}, otherProps, {
|
|
420
417
|
focusInset: otherProps.focusInset || focusInset
|
|
421
|
-
}),
|
|
418
|
+
}), React__namespace.default.createElement(StyledIcon, {
|
|
422
419
|
isRotated: isRotated
|
|
423
420
|
}, children));
|
|
424
421
|
});
|
|
425
422
|
IconButton.displayName = 'IconButton';
|
|
426
423
|
IconButton.propTypes = {
|
|
427
|
-
isDanger: PropTypes__default
|
|
428
|
-
size: PropTypes__default
|
|
429
|
-
isNeutral: PropTypes__default
|
|
430
|
-
isPrimary: PropTypes__default
|
|
431
|
-
isBasic: PropTypes__default
|
|
432
|
-
isPill: PropTypes__default
|
|
433
|
-
focusInset: PropTypes__default
|
|
434
|
-
isRotated: PropTypes__default
|
|
424
|
+
isDanger: PropTypes__default.default.bool,
|
|
425
|
+
size: PropTypes__default.default.oneOf(SIZE),
|
|
426
|
+
isNeutral: PropTypes__default.default.bool,
|
|
427
|
+
isPrimary: PropTypes__default.default.bool,
|
|
428
|
+
isBasic: PropTypes__default.default.bool,
|
|
429
|
+
isPill: PropTypes__default.default.bool,
|
|
430
|
+
focusInset: PropTypes__default.default.bool,
|
|
431
|
+
isRotated: PropTypes__default.default.bool
|
|
435
432
|
};
|
|
436
433
|
IconButton.defaultProps = {
|
|
437
434
|
isPill: true,
|
|
@@ -462,9 +459,9 @@ const ChevronButton = React.forwardRef((_ref, ref) => {
|
|
|
462
459
|
let {
|
|
463
460
|
...buttonProps
|
|
464
461
|
} = _ref;
|
|
465
|
-
return
|
|
462
|
+
return React__namespace.default.createElement(IconButton, _extends$2({
|
|
466
463
|
ref: ref
|
|
467
|
-
}, buttonProps),
|
|
464
|
+
}, buttonProps), React__namespace.default.createElement(SvgChevronDownStroke, null));
|
|
468
465
|
});
|
|
469
466
|
ChevronButton.displayName = 'ChevronButton';
|
|
470
467
|
ChevronButton.propTypes = IconButton.propTypes;
|
|
@@ -479,9 +476,9 @@ const SplitButton = React.forwardRef((_ref, ref) => {
|
|
|
479
476
|
children,
|
|
480
477
|
...other
|
|
481
478
|
} = _ref;
|
|
482
|
-
return
|
|
479
|
+
return React__namespace.default.createElement(SplitButtonContext.Provider, {
|
|
483
480
|
value: true
|
|
484
|
-
},
|
|
481
|
+
}, React__namespace.default.createElement(StyledButtonGroup, _extends$2({
|
|
485
482
|
ref: ref
|
|
486
483
|
}, other), children));
|
|
487
484
|
});
|
|
@@ -492,7 +489,7 @@ const ToggleButton = React.forwardRef((_ref, ref) => {
|
|
|
492
489
|
isPressed,
|
|
493
490
|
...otherProps
|
|
494
491
|
} = _ref;
|
|
495
|
-
return
|
|
492
|
+
return React__namespace.default.createElement(Button, _extends$2({
|
|
496
493
|
"aria-pressed": isPressed,
|
|
497
494
|
ref: ref
|
|
498
495
|
}, otherProps));
|
|
@@ -500,7 +497,7 @@ const ToggleButton = React.forwardRef((_ref, ref) => {
|
|
|
500
497
|
ToggleButton.displayName = 'ToggleButton';
|
|
501
498
|
ToggleButton.propTypes = {
|
|
502
499
|
...Button.propTypes,
|
|
503
|
-
isPressed: PropTypes__default
|
|
500
|
+
isPressed: PropTypes__default.default.oneOf([true, false, 'mixed'])
|
|
504
501
|
};
|
|
505
502
|
ToggleButton.defaultProps = {
|
|
506
503
|
size: 'medium'
|
|
@@ -511,7 +508,7 @@ const ToggleIconButton = React.forwardRef((_ref, ref) => {
|
|
|
511
508
|
isPressed,
|
|
512
509
|
...otherProps
|
|
513
510
|
} = _ref;
|
|
514
|
-
return
|
|
511
|
+
return React__namespace.default.createElement(IconButton, _extends$2({
|
|
515
512
|
"aria-pressed": isPressed,
|
|
516
513
|
ref: ref
|
|
517
514
|
}, otherProps));
|
|
@@ -519,7 +516,7 @@ const ToggleIconButton = React.forwardRef((_ref, ref) => {
|
|
|
519
516
|
ToggleIconButton.displayName = 'ToggleIconButton';
|
|
520
517
|
ToggleIconButton.propTypes = {
|
|
521
518
|
...IconButton.propTypes,
|
|
522
|
-
isPressed: PropTypes__default
|
|
519
|
+
isPressed: PropTypes__default.default.oneOf([true, false, 'mixed'])
|
|
523
520
|
};
|
|
524
521
|
ToggleIconButton.defaultProps = {
|
|
525
522
|
isPill: true,
|
package/dist/index.esm.js
CHANGED
|
@@ -33,7 +33,7 @@ const SIZE = ['small', 'medium', 'large'];
|
|
|
33
33
|
const COMPONENT_ID$5 = 'buttons.button_group_view';
|
|
34
34
|
const StyledButtonGroup = styled.div.attrs({
|
|
35
35
|
'data-garden-id': COMPONENT_ID$5,
|
|
36
|
-
'data-garden-version': '8.62.
|
|
36
|
+
'data-garden-version': '8.62.2'
|
|
37
37
|
}).withConfig({
|
|
38
38
|
displayName: "StyledButtonGroup",
|
|
39
39
|
componentId: "sc-1fbpzef-0"
|
|
@@ -62,7 +62,7 @@ const StyledIcon = styled(_ref => {
|
|
|
62
62
|
return React__default.cloneElement(Children.only(children), props);
|
|
63
63
|
}).attrs({
|
|
64
64
|
'data-garden-id': COMPONENT_ID$4,
|
|
65
|
-
'data-garden-version': '8.62.
|
|
65
|
+
'data-garden-version': '8.62.2'
|
|
66
66
|
}).withConfig({
|
|
67
67
|
displayName: "StyledIcon",
|
|
68
68
|
componentId: "sc-19meqgg-0"
|
|
@@ -161,7 +161,7 @@ const sizeStyles = props => {
|
|
|
161
161
|
};
|
|
162
162
|
const StyledButton = styled.button.attrs(props => ({
|
|
163
163
|
'data-garden-id': COMPONENT_ID$3,
|
|
164
|
-
'data-garden-version': '8.62.
|
|
164
|
+
'data-garden-version': '8.62.2',
|
|
165
165
|
type: props.type || 'button'
|
|
166
166
|
})).withConfig({
|
|
167
167
|
displayName: "StyledButton",
|
|
@@ -174,7 +174,7 @@ StyledButton.defaultProps = {
|
|
|
174
174
|
const COMPONENT_ID$2 = 'buttons.anchor';
|
|
175
175
|
const StyledAnchor = styled(StyledButton).attrs(props => ({
|
|
176
176
|
'data-garden-id': COMPONENT_ID$2,
|
|
177
|
-
'data-garden-version': '8.62.
|
|
177
|
+
'data-garden-version': '8.62.2',
|
|
178
178
|
as: 'a',
|
|
179
179
|
dir: props.theme.rtl ? 'rtl' : undefined,
|
|
180
180
|
isLink: true,
|
|
@@ -211,7 +211,7 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
|
211
211
|
const COMPONENT_ID$1 = 'buttons.external_icon';
|
|
212
212
|
const StyledExternalIcon = styled(SvgNewWindowStroke).attrs({
|
|
213
213
|
'data-garden-id': COMPONENT_ID$1,
|
|
214
|
-
'data-garden-version': '8.62.
|
|
214
|
+
'data-garden-version': '8.62.2'
|
|
215
215
|
}).withConfig({
|
|
216
216
|
displayName: "StyledExternalIcon",
|
|
217
217
|
componentId: "sc-16oz07e-0"
|
|
@@ -238,7 +238,7 @@ const iconStyles = props => {
|
|
|
238
238
|
};
|
|
239
239
|
const StyledIconButton = styled(StyledButton).attrs({
|
|
240
240
|
'data-garden-id': COMPONENT_ID,
|
|
241
|
-
'data-garden-version': '8.62.
|
|
241
|
+
'data-garden-version': '8.62.2'
|
|
242
242
|
}).withConfig({
|
|
243
243
|
displayName: "StyledIconButton",
|
|
244
244
|
componentId: "sc-1t0ughp-0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-buttons",
|
|
3
|
-
"version": "8.62.
|
|
3
|
+
"version": "8.62.2",
|
|
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>",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@zendeskgarden/react-theming": "^8.62.
|
|
36
|
+
"@zendeskgarden/react-theming": "^8.62.2",
|
|
37
37
|
"@zendeskgarden/svg-icons": "6.33.0"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"zendeskgarden:src": "src/index.ts",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "27a7d6c021f3360396af60d51ecbf66e9076a405"
|
|
50
50
|
}
|