@zendeskgarden/react-buttons 9.0.0-next.9 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/elements/Anchor.js +10 -5
- package/dist/esm/elements/Button.js +30 -12
- package/dist/esm/elements/ChevronButton.js +3 -8
- package/dist/esm/elements/IconButton.js +22 -10
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/new-window-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +1 -1
- package/dist/esm/styled/StyledAnchor.js +4 -7
- package/dist/esm/styled/StyledButton.js +239 -76
- package/dist/esm/styled/StyledExternalIcon.js +2 -5
- package/dist/esm/styled/StyledIcon.js +2 -5
- package/dist/esm/styled/StyledIconButton.js +38 -16
- package/dist/esm/styled/StyledSplitButton.js +2 -5
- package/dist/index.cjs.js +344 -141
- package/dist/typings/elements/Button.d.ts +3 -1
- package/dist/typings/styled/StyledAnchor.d.ts +1 -8
- package/dist/typings/styled/StyledButton.d.ts +16 -7
- package/dist/typings/styled/StyledIcon.d.ts +1 -2
- package/dist/typings/styled/StyledIconButton.d.ts +4 -3
- package/dist/typings/styled/index.d.ts +2 -2
- package/dist/typings/types/index.d.ts +2 -0
- package/dist/typings/utils/useSplitButtonContext.d.ts +0 -1
- package/package.json +7 -7
|
@@ -5,35 +5,57 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles,
|
|
9
|
-
import { StyledButton, getHeight } from './StyledButton.js';
|
|
8
|
+
import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledButton, COMPONENT_ID as COMPONENT_ID$1, getHeight } from './StyledButton.js';
|
|
10
10
|
import { StyledIcon } from './StyledIcon.js';
|
|
11
11
|
|
|
12
12
|
const COMPONENT_ID = 'buttons.icon_button';
|
|
13
|
-
const iconColorStyles =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
13
|
+
const iconColorStyles = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
theme
|
|
16
|
+
} = _ref;
|
|
17
|
+
const options = {
|
|
18
|
+
theme,
|
|
19
|
+
variable: 'foreground.subtle'
|
|
20
|
+
};
|
|
21
|
+
const baseColor = getColor(options);
|
|
22
|
+
const hoverColor = getColor({
|
|
23
|
+
...options,
|
|
24
|
+
dark: {
|
|
25
|
+
offset: -100
|
|
26
|
+
},
|
|
27
|
+
light: {
|
|
28
|
+
offset: 100
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const activeColor = getColor({
|
|
32
|
+
...options,
|
|
33
|
+
dark: {
|
|
34
|
+
offset: -200
|
|
35
|
+
},
|
|
36
|
+
light: {
|
|
37
|
+
offset: 200
|
|
38
|
+
}
|
|
39
|
+
});
|
|
18
40
|
return css(["color:", ";&:hover{color:", ";}&:active,&[aria-pressed='true'],&[aria-pressed='mixed']{color:", ";}"], baseColor, hoverColor, activeColor);
|
|
19
41
|
};
|
|
20
42
|
const iconButtonStyles = props => {
|
|
21
43
|
const width = getHeight(props);
|
|
22
|
-
return css(["border:", ";padding:0;width:", ";min-width:", ";", ";&:disabled{background-color:", ";}"], props
|
|
44
|
+
return css(["border:", ";padding:0;width:", ";min-width:", ";", ";&:disabled{background-color:", ";}"], props.$isBasic && 'none', width, width, props.$isBasic && !(props.$isPrimary || props.$isDanger || props.disabled) && iconColorStyles(props), !props.$isPrimary && 'transparent');
|
|
23
45
|
};
|
|
24
46
|
const iconStyles = props => {
|
|
25
47
|
const size = props.theme.iconSizes.md;
|
|
26
48
|
return css(["width:", ";height:", ";& > svg{transition:opacity 0.15s ease-in-out;}"], size, size);
|
|
27
49
|
};
|
|
28
|
-
const StyledIconButton = styled(StyledButton).attrs({
|
|
29
|
-
'data-garden-id'
|
|
30
|
-
|
|
50
|
+
const StyledIconButton = styled(StyledButton).attrs(props => {
|
|
51
|
+
const externalId = props['data-garden-id'];
|
|
52
|
+
return {
|
|
53
|
+
'data-garden-id': externalId && externalId !== COMPONENT_ID$1 ? externalId : COMPONENT_ID,
|
|
54
|
+
'data-garden-version': '9.1.0'
|
|
55
|
+
};
|
|
31
56
|
}).withConfig({
|
|
32
57
|
displayName: "StyledIconButton",
|
|
33
58
|
componentId: "sc-1t0ughp-0"
|
|
34
|
-
})(["", ";& ", "{", "}", ";"],
|
|
35
|
-
StyledIconButton.defaultProps = {
|
|
36
|
-
theme: DEFAULT_THEME
|
|
37
|
-
};
|
|
59
|
+
})(["", ";& ", "{", "}", ";"], iconButtonStyles, StyledIcon, iconStyles, props => retrieveComponentStyles(props['data-garden-id'], props));
|
|
38
60
|
|
|
39
|
-
export { StyledIconButton };
|
|
61
|
+
export { COMPONENT_ID, StyledIconButton };
|
|
@@ -5,18 +5,15 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles
|
|
8
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
10
|
const COMPONENT_ID = 'buttons.button_group_view';
|
|
11
11
|
const StyledSplitButton = styled.div.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.
|
|
13
|
+
'data-garden-version': '9.1.0'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledSplitButton",
|
|
16
16
|
componentId: "sc-1u4v04v-0"
|
|
17
17
|
})(["display:inline-flex;position:relative;z-index:0;direction:", ";white-space:nowrap;", ";"], props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
-
StyledSplitButton.defaultProps = {
|
|
19
|
-
theme: DEFAULT_THEME
|
|
20
|
-
};
|
|
21
18
|
|
|
22
19
|
export { StyledSplitButton };
|