@zendeskgarden/react-buttons 9.12.3 → 9.12.4
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 +8 -9
- package/dist/esm/elements/Button.js +12 -13
- package/dist/esm/elements/ChevronButton.js +11 -14
- package/dist/esm/elements/IconButton.js +12 -13
- package/dist/esm/elements/SplitButton.js +8 -11
- package/dist/esm/elements/ToggleButton.js +9 -12
- package/dist/esm/elements/ToggleIconButton.js +13 -16
- package/dist/esm/elements/components/EndIcon.js +7 -10
- package/dist/esm/elements/components/StartIcon.js +7 -10
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/new-window-stroke.svg.js +4 -4
- package/dist/esm/styled/StyledAnchor.js +3 -3
- package/dist/esm/styled/StyledButton.js +22 -24
- package/dist/esm/styled/StyledExternalIcon.js +3 -3
- package/dist/esm/styled/StyledIcon.js +5 -5
- package/dist/esm/styled/StyledIconButton.js +4 -5
- package/dist/esm/styled/StyledSplitButton.js +3 -3
- package/dist/index.cjs.js +112 -136
- package/package.json +4 -4
|
@@ -14,15 +14,14 @@ import '../styled/StyledIcon.js';
|
|
|
14
14
|
import '../styled/StyledIconButton.js';
|
|
15
15
|
import { useText } from '@zendeskgarden/react-theming';
|
|
16
16
|
|
|
17
|
-
const Anchor = forwardRef((
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} = _ref;
|
|
17
|
+
const Anchor = forwardRef(({
|
|
18
|
+
children,
|
|
19
|
+
externalIconLabel,
|
|
20
|
+
isDanger,
|
|
21
|
+
isExternal,
|
|
22
|
+
isUnderlined = true,
|
|
23
|
+
...other
|
|
24
|
+
}, ref) => {
|
|
26
25
|
let anchorProps = other;
|
|
27
26
|
if (isExternal) {
|
|
28
27
|
anchorProps = {
|
|
@@ -17,19 +17,18 @@ import { useSplitButtonContext } from '../utils/useSplitButtonContext.js';
|
|
|
17
17
|
import { StartIcon } from './components/StartIcon.js';
|
|
18
18
|
import { EndIcon } from './components/EndIcon.js';
|
|
19
19
|
|
|
20
|
-
const ButtonComponent = forwardRef((
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} = _ref;
|
|
20
|
+
const ButtonComponent = forwardRef(({
|
|
21
|
+
focusInset,
|
|
22
|
+
isBasic,
|
|
23
|
+
isDanger,
|
|
24
|
+
isLink,
|
|
25
|
+
isNeutral,
|
|
26
|
+
isPill,
|
|
27
|
+
isPrimary,
|
|
28
|
+
isStretched,
|
|
29
|
+
size = 'medium',
|
|
30
|
+
...other
|
|
31
|
+
}, ref) => {
|
|
33
32
|
const splitButtonFocusInset = useSplitButtonContext();
|
|
34
33
|
return React__default.createElement(StyledButton, Object.assign({}, other, {
|
|
35
34
|
$focusInset: focusInset || splitButtonFocusInset,
|
|
@@ -8,20 +8,17 @@ import React__default, { forwardRef } from 'react';
|
|
|
8
8
|
import { IconButton } from './IconButton.js';
|
|
9
9
|
import SvgChevronDownStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js';
|
|
10
10
|
|
|
11
|
-
const ChevronButton = forwardRef((
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
size: size
|
|
23
|
-
}, props), React__default.createElement(SvgChevronDownStroke, null));
|
|
24
|
-
});
|
|
11
|
+
const ChevronButton = forwardRef(({
|
|
12
|
+
isBasic = false,
|
|
13
|
+
isPill = false,
|
|
14
|
+
size = 'medium',
|
|
15
|
+
...props
|
|
16
|
+
}, ref) => React__default.createElement(IconButton, Object.assign({
|
|
17
|
+
ref: ref,
|
|
18
|
+
isBasic: isBasic,
|
|
19
|
+
isPill: isPill,
|
|
20
|
+
size: size
|
|
21
|
+
}, props), React__default.createElement(SvgChevronDownStroke, null)));
|
|
25
22
|
ChevronButton.displayName = 'ChevronButton';
|
|
26
23
|
ChevronButton.propTypes = IconButton.propTypes;
|
|
27
24
|
|
|
@@ -15,19 +15,18 @@ import { StyledIcon } from '../styled/StyledIcon.js';
|
|
|
15
15
|
import { StyledIconButton } from '../styled/StyledIconButton.js';
|
|
16
16
|
import { useSplitButtonContext } from '../utils/useSplitButtonContext.js';
|
|
17
17
|
|
|
18
|
-
const IconButton = forwardRef((
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = _ref;
|
|
18
|
+
const IconButton = forwardRef(({
|
|
19
|
+
children,
|
|
20
|
+
focusInset,
|
|
21
|
+
isBasic = true,
|
|
22
|
+
isDanger,
|
|
23
|
+
isNeutral,
|
|
24
|
+
isPill = true,
|
|
25
|
+
isPrimary,
|
|
26
|
+
isRotated,
|
|
27
|
+
size = 'medium',
|
|
28
|
+
...other
|
|
29
|
+
}, ref) => {
|
|
31
30
|
const splitButtonFocusInset = useSplitButtonContext();
|
|
32
31
|
return React__default.createElement(StyledIconButton, Object.assign({}, other, {
|
|
33
32
|
$isBasic: isBasic,
|
|
@@ -13,17 +13,14 @@ import '../styled/StyledIcon.js';
|
|
|
13
13
|
import '../styled/StyledIconButton.js';
|
|
14
14
|
import { SplitButtonContext } from '../utils/useSplitButtonContext.js';
|
|
15
15
|
|
|
16
|
-
const SplitButton = forwardRef((
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
ref: ref
|
|
25
|
-
}, other), children));
|
|
26
|
-
});
|
|
16
|
+
const SplitButton = forwardRef(({
|
|
17
|
+
children,
|
|
18
|
+
...other
|
|
19
|
+
}, ref) => React__default.createElement(SplitButtonContext.Provider, {
|
|
20
|
+
value: true
|
|
21
|
+
}, React__default.createElement(StyledSplitButton, Object.assign({
|
|
22
|
+
ref: ref
|
|
23
|
+
}, other), children)));
|
|
27
24
|
SplitButton.displayName = 'SplitButton';
|
|
28
25
|
|
|
29
26
|
export { SplitButton };
|
|
@@ -8,18 +8,15 @@ import React__default, { forwardRef } from 'react';
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { Button } from './Button.js';
|
|
10
10
|
|
|
11
|
-
const ToggleButton = forwardRef((
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
ref: ref
|
|
21
|
-
}, otherProps));
|
|
22
|
-
});
|
|
11
|
+
const ToggleButton = forwardRef(({
|
|
12
|
+
isPressed,
|
|
13
|
+
size = 'medium',
|
|
14
|
+
...otherProps
|
|
15
|
+
}, ref) => React__default.createElement(Button, Object.assign({
|
|
16
|
+
"aria-pressed": isPressed,
|
|
17
|
+
size: size,
|
|
18
|
+
ref: ref
|
|
19
|
+
}, otherProps)));
|
|
23
20
|
ToggleButton.displayName = 'ToggleButton';
|
|
24
21
|
ToggleButton.propTypes = {
|
|
25
22
|
...Button.propTypes,
|
|
@@ -8,22 +8,19 @@ import React__default, { forwardRef } from 'react';
|
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { IconButton } from './IconButton.js';
|
|
10
10
|
|
|
11
|
-
const ToggleIconButton = forwardRef((
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
ref: ref
|
|
25
|
-
}, otherProps));
|
|
26
|
-
});
|
|
11
|
+
const ToggleIconButton = forwardRef(({
|
|
12
|
+
isPressed,
|
|
13
|
+
isPill = true,
|
|
14
|
+
isBasic = true,
|
|
15
|
+
size = 'medium',
|
|
16
|
+
...otherProps
|
|
17
|
+
}, ref) => React__default.createElement(IconButton, Object.assign({
|
|
18
|
+
"aria-pressed": isPressed,
|
|
19
|
+
isPill: isPill,
|
|
20
|
+
isBasic: isBasic,
|
|
21
|
+
size: size,
|
|
22
|
+
ref: ref
|
|
23
|
+
}, otherProps)));
|
|
27
24
|
ToggleIconButton.displayName = 'ToggleIconButton';
|
|
28
25
|
ToggleIconButton.propTypes = {
|
|
29
26
|
...IconButton.propTypes,
|
|
@@ -12,16 +12,13 @@ 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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
$isRotated: isRotated
|
|
23
|
-
}, props));
|
|
24
|
-
};
|
|
15
|
+
const EndIconComponent = ({
|
|
16
|
+
isRotated,
|
|
17
|
+
...props
|
|
18
|
+
}) => React__default.createElement(StyledIcon, Object.assign({
|
|
19
|
+
$position: "end",
|
|
20
|
+
$isRotated: isRotated
|
|
21
|
+
}, props));
|
|
25
22
|
EndIconComponent.displayName = 'Button.EndIcon';
|
|
26
23
|
const EndIcon = EndIconComponent;
|
|
27
24
|
|
|
@@ -12,16 +12,13 @@ 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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
$isRotated: isRotated
|
|
23
|
-
}, props));
|
|
24
|
-
};
|
|
15
|
+
const StartIconComponent = ({
|
|
16
|
+
isRotated,
|
|
17
|
+
...props
|
|
18
|
+
}) => React__default.createElement(StyledIcon, Object.assign({
|
|
19
|
+
$position: "start",
|
|
20
|
+
$isRotated: isRotated
|
|
21
|
+
}, props));
|
|
25
22
|
StartIconComponent.displayName = 'Button.StartIcon';
|
|
26
23
|
const StartIcon = StartIconComponent;
|
|
27
24
|
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
|
-
var _path;
|
|
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); }
|
|
9
|
+
var _path$1;
|
|
10
|
+
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); }
|
|
11
11
|
var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
12
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
14
|
width: 12,
|
|
15
15
|
height: 12,
|
|
16
16
|
focusable: "false",
|
|
17
17
|
viewBox: "0 0 12 12",
|
|
18
18
|
"aria-hidden": "true"
|
|
19
|
-
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
19
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
20
20
|
fill: "none",
|
|
21
21
|
stroke: "currentColor",
|
|
22
22
|
strokeLinecap: "round",
|
|
@@ -8,10 +8,10 @@ import styled from 'styled-components';
|
|
|
8
8
|
import { componentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledButton } from './StyledButton.js';
|
|
10
10
|
|
|
11
|
-
const COMPONENT_ID = 'buttons.anchor';
|
|
11
|
+
const COMPONENT_ID$2 = 'buttons.anchor';
|
|
12
12
|
const StyledAnchor = styled(StyledButton).attrs(props => ({
|
|
13
|
-
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.12.
|
|
13
|
+
'data-garden-id': COMPONENT_ID$2,
|
|
14
|
+
'data-garden-version': '9.12.4',
|
|
15
15
|
as: 'a',
|
|
16
16
|
dir: props.theme.rtl ? 'rtl' : undefined,
|
|
17
17
|
$isLink: true,
|
|
@@ -10,7 +10,7 @@ import { SELECTOR_FOCUS_VISIBLE, componentStyles, getColor, focusStyles, getFocu
|
|
|
10
10
|
import { StyledSplitButton } from './StyledSplitButton.js';
|
|
11
11
|
import { StyledIcon } from './StyledIcon.js';
|
|
12
12
|
|
|
13
|
-
const COMPONENT_ID = 'buttons.button';
|
|
13
|
+
const COMPONENT_ID$3 = 'buttons.button';
|
|
14
14
|
const getBorderRadius = props => {
|
|
15
15
|
if (props.$isPill) {
|
|
16
16
|
return '100px';
|
|
@@ -25,16 +25,15 @@ const getHeight = props => {
|
|
|
25
25
|
}
|
|
26
26
|
return `${props.theme.space.base * 10}px`;
|
|
27
27
|
};
|
|
28
|
-
const colorStyles =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = _ref;
|
|
28
|
+
const colorStyles = ({
|
|
29
|
+
theme,
|
|
30
|
+
$isLink,
|
|
31
|
+
$isBasic,
|
|
32
|
+
$isDanger,
|
|
33
|
+
$isNeutral,
|
|
34
|
+
$isPrimary,
|
|
35
|
+
$focusInset
|
|
36
|
+
}) => {
|
|
38
37
|
let retVal;
|
|
39
38
|
const disabledBackgroundColor = getColor({
|
|
40
39
|
theme,
|
|
@@ -239,14 +238,13 @@ const colorStyles = _ref => {
|
|
|
239
238
|
}
|
|
240
239
|
return retVal;
|
|
241
240
|
};
|
|
242
|
-
const groupStyles =
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
} = _ref2;
|
|
241
|
+
const groupStyles = ({
|
|
242
|
+
theme,
|
|
243
|
+
$isPrimary,
|
|
244
|
+
$isBasic,
|
|
245
|
+
$isPill,
|
|
246
|
+
$focusInset
|
|
247
|
+
}) => {
|
|
250
248
|
const {
|
|
251
249
|
rtl,
|
|
252
250
|
borderWidths,
|
|
@@ -278,7 +276,7 @@ const groupStyles = _ref2 => {
|
|
|
278
276
|
});
|
|
279
277
|
return css(["position:relative;transition:border-color 0.1s ease-in-out,background-color 0.1s ease-in-out,box-shadow 0.1s ease-in-out,color 0.1s ease-in-out,margin-", " 0.1s ease-in-out,outline-color 0.1s ease-in-out,z-index 0.25s ease-in-out;border:", " ", ";", "{border-color:", ";box-shadow:", ";}&:hover,&:active,", "{z-index:1;}&:disabled{z-index:-1;background-color:", ";}&:not(:first-of-type){margin-", ":", ";}&:not(:first-of-type):disabled{margin-", ":", ";}&:not(:first-of-type):not(:last-of-type){border-radius:0;}&:first-of-type:not(:last-of-type){border-top-", "-radius:0;border-bottom-", "-radius:0;}&:last-of-type:not(:first-of-type){border-top-", "-radius:0;border-bottom-", "-radius:0;}&:first-of-type:not(:last-of-type) ", "{margin-", ":", ";}&:last-of-type:not(:first-of-type) ", "{margin-", ":", ";}"], startPosition, borders.sm, borderColor, SELECTOR_FOCUS_VISIBLE, focusColor, focusBoxShadow, SELECTOR_FOCUS_VISIBLE, disabledBackgroundColor, startPosition, marginDisplacement, startPosition, marginOffset, endPosition, endPosition, startPosition, startPosition, StyledIcon, endPosition, iconMarginDisplacement, StyledIcon, startPosition, iconMarginDisplacement);
|
|
280
278
|
};
|
|
281
|
-
const iconStyles = props => {
|
|
279
|
+
const iconStyles$1 = props => {
|
|
282
280
|
const $size = props.$size === 'small' ? props.theme.iconSizes.sm : props.theme.iconSizes.md;
|
|
283
281
|
return css(["width:", ";min-width:", ";height:", ";vertical-align:", ";"], $size, $size, $size, props.$isLink && 'middle');
|
|
284
282
|
};
|
|
@@ -307,12 +305,12 @@ const sizeStyles = props => {
|
|
|
307
305
|
return retVal;
|
|
308
306
|
};
|
|
309
307
|
const StyledButton = styled.button.attrs(props => ({
|
|
310
|
-
'data-garden-id': props['data-garden-id'] || COMPONENT_ID,
|
|
311
|
-
'data-garden-version': '9.12.
|
|
308
|
+
'data-garden-id': props['data-garden-id'] || COMPONENT_ID$3,
|
|
309
|
+
'data-garden-version': '9.12.4',
|
|
312
310
|
type: props.type || 'button'
|
|
313
311
|
})).withConfig({
|
|
314
312
|
displayName: "StyledButton",
|
|
315
313
|
componentId: "sc-qe3ace-0"
|
|
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), componentStyles);
|
|
314
|
+
})(["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$1(props), StyledSplitButton, props => groupStyles(props), componentStyles);
|
|
317
315
|
|
|
318
|
-
export { COMPONENT_ID, StyledButton, getHeight };
|
|
316
|
+
export { COMPONENT_ID$3 as COMPONENT_ID, StyledButton, getHeight };
|
|
@@ -8,10 +8,10 @@ import styled from 'styled-components';
|
|
|
8
8
|
import SvgNewWindowStroke from '../node_modules/@zendeskgarden/svg-icons/src/12/new-window-stroke.svg.js';
|
|
9
9
|
import { componentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
11
|
-
const COMPONENT_ID = 'buttons.external_icon';
|
|
11
|
+
const COMPONENT_ID$1 = 'buttons.external_icon';
|
|
12
12
|
const StyledExternalIcon = styled(SvgNewWindowStroke).attrs({
|
|
13
|
-
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.12.
|
|
13
|
+
'data-garden-id': COMPONENT_ID$1,
|
|
14
|
+
'data-garden-version': '9.12.4'
|
|
15
15
|
}).withConfig({
|
|
16
16
|
displayName: "StyledExternalIcon",
|
|
17
17
|
componentId: "sc-16oz07e-0"
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { StyledBaseIcon, componentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
|
-
const COMPONENT_ID = 'buttons.icon';
|
|
11
|
-
const sizeStyles = props => {
|
|
10
|
+
const COMPONENT_ID$4 = 'buttons.icon';
|
|
11
|
+
const sizeStyles$1 = props => {
|
|
12
12
|
let marginProperty;
|
|
13
13
|
if (props.$position === 'start') {
|
|
14
14
|
marginProperty = `margin-${props.theme.rtl ? 'left' : 'right'}`;
|
|
@@ -18,11 +18,11 @@ const sizeStyles = props => {
|
|
|
18
18
|
return marginProperty && css(["", ":", "px;"], marginProperty, props.theme.space.base * 2);
|
|
19
19
|
};
|
|
20
20
|
const StyledIcon = styled(StyledBaseIcon).attrs({
|
|
21
|
-
'data-garden-id': COMPONENT_ID,
|
|
22
|
-
'data-garden-version': '9.12.
|
|
21
|
+
'data-garden-id': COMPONENT_ID$4,
|
|
22
|
+
'data-garden-version': '9.12.4'
|
|
23
23
|
}).withConfig({
|
|
24
24
|
displayName: "StyledIcon",
|
|
25
25
|
componentId: "sc-19meqgg-0"
|
|
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), componentStyles);
|
|
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$1(props), componentStyles);
|
|
27
27
|
|
|
28
28
|
export { StyledIcon };
|
|
@@ -10,10 +10,9 @@ import { StyledButton, COMPONENT_ID as COMPONENT_ID$1, getHeight } from './Style
|
|
|
10
10
|
import { StyledIcon } from './StyledIcon.js';
|
|
11
11
|
|
|
12
12
|
const COMPONENT_ID = 'buttons.icon_button';
|
|
13
|
-
const iconColorStyles =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} = _ref;
|
|
13
|
+
const iconColorStyles = ({
|
|
14
|
+
theme
|
|
15
|
+
}) => {
|
|
17
16
|
const options = {
|
|
18
17
|
theme,
|
|
19
18
|
variable: 'foreground.subtle'
|
|
@@ -51,7 +50,7 @@ const StyledIconButton = styled(StyledButton).attrs(props => {
|
|
|
51
50
|
const externalId = props['data-garden-id'];
|
|
52
51
|
return {
|
|
53
52
|
'data-garden-id': externalId && externalId !== COMPONENT_ID$1 ? externalId : COMPONENT_ID,
|
|
54
|
-
'data-garden-version': '9.12.
|
|
53
|
+
'data-garden-version': '9.12.4'
|
|
55
54
|
};
|
|
56
55
|
}).withConfig({
|
|
57
56
|
displayName: "StyledIconButton",
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { componentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
|
-
const COMPONENT_ID = 'buttons.button_group_view';
|
|
10
|
+
const COMPONENT_ID$5 = 'buttons.button_group_view';
|
|
11
11
|
const StyledSplitButton = styled.div.attrs({
|
|
12
|
-
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.12.
|
|
12
|
+
'data-garden-id': COMPONENT_ID$5,
|
|
13
|
+
'data-garden-version': '9.12.4'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledSplitButton",
|
|
16
16
|
componentId: "sc-1u4v04v-0"
|
package/dist/index.cjs.js
CHANGED
|
@@ -41,7 +41,7 @@ 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.12.
|
|
44
|
+
'data-garden-version': '9.12.4'
|
|
45
45
|
}).withConfig({
|
|
46
46
|
displayName: "StyledSplitButton",
|
|
47
47
|
componentId: "sc-1u4v04v-0"
|
|
@@ -59,7 +59,7 @@ const sizeStyles$1 = props => {
|
|
|
59
59
|
};
|
|
60
60
|
const StyledIcon = styled__default.default(reactTheming.StyledBaseIcon).attrs({
|
|
61
61
|
'data-garden-id': COMPONENT_ID$4,
|
|
62
|
-
'data-garden-version': '9.12.
|
|
62
|
+
'data-garden-version': '9.12.4'
|
|
63
63
|
}).withConfig({
|
|
64
64
|
displayName: "StyledIcon",
|
|
65
65
|
componentId: "sc-19meqgg-0"
|
|
@@ -80,16 +80,15 @@ const getHeight = props => {
|
|
|
80
80
|
}
|
|
81
81
|
return `${props.theme.space.base * 10}px`;
|
|
82
82
|
};
|
|
83
|
-
const colorStyles =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
} = _ref;
|
|
83
|
+
const colorStyles = ({
|
|
84
|
+
theme,
|
|
85
|
+
$isLink,
|
|
86
|
+
$isBasic,
|
|
87
|
+
$isDanger,
|
|
88
|
+
$isNeutral,
|
|
89
|
+
$isPrimary,
|
|
90
|
+
$focusInset
|
|
91
|
+
}) => {
|
|
93
92
|
let retVal;
|
|
94
93
|
const disabledBackgroundColor = reactTheming.getColor({
|
|
95
94
|
theme,
|
|
@@ -294,14 +293,13 @@ const colorStyles = _ref => {
|
|
|
294
293
|
}
|
|
295
294
|
return retVal;
|
|
296
295
|
};
|
|
297
|
-
const groupStyles =
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
} = _ref2;
|
|
296
|
+
const groupStyles = ({
|
|
297
|
+
theme,
|
|
298
|
+
$isPrimary,
|
|
299
|
+
$isBasic,
|
|
300
|
+
$isPill,
|
|
301
|
+
$focusInset
|
|
302
|
+
}) => {
|
|
305
303
|
const {
|
|
306
304
|
rtl,
|
|
307
305
|
borderWidths,
|
|
@@ -363,7 +361,7 @@ const sizeStyles = props => {
|
|
|
363
361
|
};
|
|
364
362
|
const StyledButton = styled__default.default.button.attrs(props => ({
|
|
365
363
|
'data-garden-id': props['data-garden-id'] || COMPONENT_ID$3,
|
|
366
|
-
'data-garden-version': '9.12.
|
|
364
|
+
'data-garden-version': '9.12.4',
|
|
367
365
|
type: props.type || 'button'
|
|
368
366
|
})).withConfig({
|
|
369
367
|
displayName: "StyledButton",
|
|
@@ -373,7 +371,7 @@ const StyledButton = styled__default.default.button.attrs(props => ({
|
|
|
373
371
|
const COMPONENT_ID$2 = 'buttons.anchor';
|
|
374
372
|
const StyledAnchor = styled__default.default(StyledButton).attrs(props => ({
|
|
375
373
|
'data-garden-id': COMPONENT_ID$2,
|
|
376
|
-
'data-garden-version': '9.12.
|
|
374
|
+
'data-garden-version': '9.12.4',
|
|
377
375
|
as: 'a',
|
|
378
376
|
dir: props.theme.rtl ? 'rtl' : undefined,
|
|
379
377
|
$isLink: true,
|
|
@@ -404,17 +402,16 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
|
|
|
404
402
|
const COMPONENT_ID$1 = 'buttons.external_icon';
|
|
405
403
|
const StyledExternalIcon = styled__default.default(SvgNewWindowStroke).attrs({
|
|
406
404
|
'data-garden-id': COMPONENT_ID$1,
|
|
407
|
-
'data-garden-version': '9.12.
|
|
405
|
+
'data-garden-version': '9.12.4'
|
|
408
406
|
}).withConfig({
|
|
409
407
|
displayName: "StyledExternalIcon",
|
|
410
408
|
componentId: "sc-16oz07e-0"
|
|
411
409
|
})(["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)', reactTheming.componentStyles);
|
|
412
410
|
|
|
413
411
|
const COMPONENT_ID = 'buttons.icon_button';
|
|
414
|
-
const iconColorStyles =
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
} = _ref;
|
|
412
|
+
const iconColorStyles = ({
|
|
413
|
+
theme
|
|
414
|
+
}) => {
|
|
418
415
|
const options = {
|
|
419
416
|
theme,
|
|
420
417
|
variable: 'foreground.subtle'
|
|
@@ -452,7 +449,7 @@ const StyledIconButton = styled__default.default(StyledButton).attrs(props => {
|
|
|
452
449
|
const externalId = props['data-garden-id'];
|
|
453
450
|
return {
|
|
454
451
|
'data-garden-id': externalId && externalId !== COMPONENT_ID$3 ? externalId : COMPONENT_ID,
|
|
455
|
-
'data-garden-version': '9.12.
|
|
452
|
+
'data-garden-version': '9.12.4'
|
|
456
453
|
};
|
|
457
454
|
}).withConfig({
|
|
458
455
|
displayName: "StyledIconButton",
|
|
@@ -464,45 +461,38 @@ const useSplitButtonContext = () => {
|
|
|
464
461
|
return React.useContext(SplitButtonContext);
|
|
465
462
|
};
|
|
466
463
|
|
|
467
|
-
const StartIconComponent =
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
$isRotated: isRotated
|
|
475
|
-
}, props));
|
|
476
|
-
};
|
|
464
|
+
const StartIconComponent = ({
|
|
465
|
+
isRotated,
|
|
466
|
+
...props
|
|
467
|
+
}) => React__namespace.default.createElement(StyledIcon, Object.assign({
|
|
468
|
+
$position: "start",
|
|
469
|
+
$isRotated: isRotated
|
|
470
|
+
}, props));
|
|
477
471
|
StartIconComponent.displayName = 'Button.StartIcon';
|
|
478
472
|
const StartIcon = StartIconComponent;
|
|
479
473
|
|
|
480
|
-
const EndIconComponent =
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
$isRotated: isRotated
|
|
488
|
-
}, props));
|
|
489
|
-
};
|
|
474
|
+
const EndIconComponent = ({
|
|
475
|
+
isRotated,
|
|
476
|
+
...props
|
|
477
|
+
}) => React__namespace.default.createElement(StyledIcon, Object.assign({
|
|
478
|
+
$position: "end",
|
|
479
|
+
$isRotated: isRotated
|
|
480
|
+
}, props));
|
|
490
481
|
EndIconComponent.displayName = 'Button.EndIcon';
|
|
491
482
|
const EndIcon = EndIconComponent;
|
|
492
483
|
|
|
493
|
-
const ButtonComponent = React.forwardRef((
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
} = _ref;
|
|
484
|
+
const ButtonComponent = React.forwardRef(({
|
|
485
|
+
focusInset,
|
|
486
|
+
isBasic,
|
|
487
|
+
isDanger,
|
|
488
|
+
isLink,
|
|
489
|
+
isNeutral,
|
|
490
|
+
isPill,
|
|
491
|
+
isPrimary,
|
|
492
|
+
isStretched,
|
|
493
|
+
size = 'medium',
|
|
494
|
+
...other
|
|
495
|
+
}, ref) => {
|
|
506
496
|
const splitButtonFocusInset = useSplitButtonContext();
|
|
507
497
|
return React__namespace.default.createElement(StyledButton, Object.assign({}, other, {
|
|
508
498
|
$focusInset: focusInset || splitButtonFocusInset,
|
|
@@ -534,15 +524,14 @@ const Button = ButtonComponent;
|
|
|
534
524
|
Button.EndIcon = EndIcon;
|
|
535
525
|
Button.StartIcon = StartIcon;
|
|
536
526
|
|
|
537
|
-
const Anchor = React.forwardRef((
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
} = _ref;
|
|
527
|
+
const Anchor = React.forwardRef(({
|
|
528
|
+
children,
|
|
529
|
+
externalIconLabel,
|
|
530
|
+
isDanger,
|
|
531
|
+
isExternal,
|
|
532
|
+
isUnderlined = true,
|
|
533
|
+
...other
|
|
534
|
+
}, ref) => {
|
|
546
535
|
let anchorProps = other;
|
|
547
536
|
if (isExternal) {
|
|
548
537
|
anchorProps = {
|
|
@@ -576,19 +565,18 @@ Anchor.propTypes = {
|
|
|
576
565
|
externalIconLabel: PropTypes__default.default.string
|
|
577
566
|
};
|
|
578
567
|
|
|
579
|
-
const IconButton = React.forwardRef((
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
} = _ref;
|
|
568
|
+
const IconButton = React.forwardRef(({
|
|
569
|
+
children,
|
|
570
|
+
focusInset,
|
|
571
|
+
isBasic = true,
|
|
572
|
+
isDanger,
|
|
573
|
+
isNeutral,
|
|
574
|
+
isPill = true,
|
|
575
|
+
isPrimary,
|
|
576
|
+
isRotated,
|
|
577
|
+
size = 'medium',
|
|
578
|
+
...other
|
|
579
|
+
}, ref) => {
|
|
592
580
|
const splitButtonFocusInset = useSplitButtonContext();
|
|
593
581
|
return React__namespace.default.createElement(StyledIconButton, Object.assign({}, other, {
|
|
594
582
|
$isBasic: isBasic,
|
|
@@ -631,70 +619,58 @@ var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
|
|
|
631
619
|
})));
|
|
632
620
|
};
|
|
633
621
|
|
|
634
|
-
const ChevronButton = React.forwardRef((
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
size: size
|
|
646
|
-
}, props), React__namespace.default.createElement(SvgChevronDownStroke, null));
|
|
647
|
-
});
|
|
622
|
+
const ChevronButton = React.forwardRef(({
|
|
623
|
+
isBasic = false,
|
|
624
|
+
isPill = false,
|
|
625
|
+
size = 'medium',
|
|
626
|
+
...props
|
|
627
|
+
}, ref) => React__namespace.default.createElement(IconButton, Object.assign({
|
|
628
|
+
ref: ref,
|
|
629
|
+
isBasic: isBasic,
|
|
630
|
+
isPill: isPill,
|
|
631
|
+
size: size
|
|
632
|
+
}, props), React__namespace.default.createElement(SvgChevronDownStroke, null)));
|
|
648
633
|
ChevronButton.displayName = 'ChevronButton';
|
|
649
634
|
ChevronButton.propTypes = IconButton.propTypes;
|
|
650
635
|
|
|
651
|
-
const SplitButton = React.forwardRef((
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
ref: ref
|
|
660
|
-
}, other), children));
|
|
661
|
-
});
|
|
636
|
+
const SplitButton = React.forwardRef(({
|
|
637
|
+
children,
|
|
638
|
+
...other
|
|
639
|
+
}, ref) => React__namespace.default.createElement(SplitButtonContext.Provider, {
|
|
640
|
+
value: true
|
|
641
|
+
}, React__namespace.default.createElement(StyledSplitButton, Object.assign({
|
|
642
|
+
ref: ref
|
|
643
|
+
}, other), children)));
|
|
662
644
|
SplitButton.displayName = 'SplitButton';
|
|
663
645
|
|
|
664
|
-
const ToggleButton = React.forwardRef((
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
ref: ref
|
|
674
|
-
}, otherProps));
|
|
675
|
-
});
|
|
646
|
+
const ToggleButton = React.forwardRef(({
|
|
647
|
+
isPressed,
|
|
648
|
+
size = 'medium',
|
|
649
|
+
...otherProps
|
|
650
|
+
}, ref) => React__namespace.default.createElement(Button, Object.assign({
|
|
651
|
+
"aria-pressed": isPressed,
|
|
652
|
+
size: size,
|
|
653
|
+
ref: ref
|
|
654
|
+
}, otherProps)));
|
|
676
655
|
ToggleButton.displayName = 'ToggleButton';
|
|
677
656
|
ToggleButton.propTypes = {
|
|
678
657
|
...Button.propTypes,
|
|
679
658
|
isPressed: PropTypes__default.default.oneOf([true, false, 'mixed'])
|
|
680
659
|
};
|
|
681
660
|
|
|
682
|
-
const ToggleIconButton = React.forwardRef((
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
ref: ref
|
|
696
|
-
}, otherProps));
|
|
697
|
-
});
|
|
661
|
+
const ToggleIconButton = React.forwardRef(({
|
|
662
|
+
isPressed,
|
|
663
|
+
isPill = true,
|
|
664
|
+
isBasic = true,
|
|
665
|
+
size = 'medium',
|
|
666
|
+
...otherProps
|
|
667
|
+
}, ref) => React__namespace.default.createElement(IconButton, Object.assign({
|
|
668
|
+
"aria-pressed": isPressed,
|
|
669
|
+
isPill: isPill,
|
|
670
|
+
isBasic: isBasic,
|
|
671
|
+
size: size,
|
|
672
|
+
ref: ref
|
|
673
|
+
}, otherProps)));
|
|
698
674
|
ToggleIconButton.displayName = 'ToggleIconButton';
|
|
699
675
|
ToggleIconButton.propTypes = {
|
|
700
676
|
...IconButton.propTypes,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-buttons",
|
|
3
|
-
"version": "9.12.
|
|
3
|
+
"version": "9.12.4",
|
|
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,8 +33,8 @@
|
|
|
33
33
|
"styled-components": "^5.3.1 || ^6.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@zendeskgarden/react-theming": "^9.12.
|
|
37
|
-
"@zendeskgarden/svg-icons": "7.
|
|
36
|
+
"@zendeskgarden/react-theming": "^9.12.4",
|
|
37
|
+
"@zendeskgarden/svg-icons": "7.6.0"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
40
40
|
"components",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"zendeskgarden:src": "src/index.ts",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "e79e9687e6bcbd097c059add2938cdae59a5173b"
|
|
50
50
|
}
|