@zendeskgarden/react-forms 9.0.0-next.13 → 9.0.0-next.15
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/LICENSE.md +176 -0
- package/dist/esm/elements/Select.js +1 -0
- package/dist/esm/elements/faux-input/components/EndIcon.js +4 -0
- package/dist/esm/elements/faux-input/components/StartIcon.js +4 -0
- package/dist/esm/elements/file-list/components/File.js +2 -1
- package/dist/esm/elements/tiles/components/Tile.js +1 -3
- package/dist/esm/styled/checkbox/StyledCheckHint.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckInput.js +55 -11
- package/dist/esm/styled/checkbox/StyledCheckLabel.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckMessage.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckSvg.js +1 -1
- package/dist/esm/styled/checkbox/StyledDashSvg.js +1 -1
- package/dist/esm/styled/common/StyledField.js +1 -1
- package/dist/esm/styled/common/StyledFieldset.js +1 -1
- package/dist/esm/styled/common/StyledHint.js +1 -1
- package/dist/esm/styled/common/StyledLabel.js +1 -1
- package/dist/esm/styled/common/StyledLegend.js +1 -1
- package/dist/esm/styled/common/StyledMessage.js +1 -1
- package/dist/esm/styled/common/StyledMessageIcon.js +1 -1
- package/dist/esm/styled/file-list/StyledFile.js +49 -28
- package/dist/esm/styled/file-list/StyledFileClose.js +6 -3
- package/dist/esm/styled/file-list/StyledFileDelete.js +6 -3
- package/dist/esm/styled/file-list/StyledFileIcon.js +24 -4
- package/dist/esm/styled/file-list/StyledFileList.js +1 -1
- package/dist/esm/styled/file-list/StyledFileListItem.js +1 -1
- package/dist/esm/styled/file-upload/StyledFileUpload.js +89 -20
- package/dist/esm/styled/input-group/StyledInputGroup.js +1 -1
- package/dist/esm/styled/radio/StyledRadioHint.js +1 -1
- package/dist/esm/styled/radio/StyledRadioInput.js +85 -24
- package/dist/esm/styled/radio/StyledRadioLabel.js +1 -1
- package/dist/esm/styled/radio/StyledRadioMessage.js +1 -1
- package/dist/esm/styled/radio/StyledRadioSvg.js +1 -1
- package/dist/esm/styled/range/StyledRangeInput.js +83 -26
- package/dist/esm/styled/select/StyledSelect.js +35 -11
- package/dist/esm/styled/select/StyledSelectWrapper.js +11 -3
- package/dist/esm/styled/text/StyledTextFauxInput.js +31 -23
- package/dist/esm/styled/text/StyledTextInput.js +103 -58
- package/dist/esm/styled/text/StyledTextMediaFigure.js +35 -10
- package/dist/esm/styled/text/StyledTextMediaInput.js +1 -1
- package/dist/esm/styled/text/StyledTextarea.js +1 -1
- package/dist/esm/styled/tiles/StyledTile.js +93 -34
- package/dist/esm/styled/tiles/StyledTileDescription.js +13 -13
- package/dist/esm/styled/tiles/StyledTileIcon.js +52 -13
- package/dist/esm/styled/tiles/StyledTileInput.js +1 -1
- package/dist/esm/styled/tiles/StyledTileLabel.js +13 -15
- package/dist/esm/styled/toggle/StyledToggleHint.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleInput.js +38 -13
- package/dist/esm/styled/toggle/StyledToggleLabel.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleMessage.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleSvg.js +1 -1
- package/dist/index.cjs.js +892 -377
- package/dist/typings/elements/faux-input/components/EndIcon.d.ts +1 -1
- package/dist/typings/elements/faux-input/components/StartIcon.d.ts +1 -1
- package/dist/typings/styled/file-list/StyledFileIcon.d.ts +7 -1
- package/dist/typings/styled/select/StyledSelect.d.ts +0 -3
- package/dist/typings/styled/select/StyledSelectWrapper.d.ts +3 -1
- package/dist/typings/styled/text/StyledTextFauxInput.d.ts +0 -4
- package/dist/typings/styled/tiles/StyledTile.d.ts +4 -7
- package/dist/typings/types/index.d.ts +3 -3
- package/package.json +4 -3
|
@@ -4,17 +4,37 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
-
import styled from 'styled-components';
|
|
8
|
-
import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
10
|
const COMPONENT_ID = 'forms.file.icon';
|
|
11
|
+
const colorStyles = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
theme,
|
|
14
|
+
$validation
|
|
15
|
+
} = _ref;
|
|
16
|
+
const color = $validation ? undefined : getColor({
|
|
17
|
+
theme,
|
|
18
|
+
variable: 'foreground.subtle'
|
|
19
|
+
});
|
|
20
|
+
return css(["color:", ";"], color);
|
|
21
|
+
};
|
|
22
|
+
const sizeStyles = _ref2 => {
|
|
23
|
+
let {
|
|
24
|
+
$isCompact,
|
|
25
|
+
theme
|
|
26
|
+
} = _ref2;
|
|
27
|
+
const width = $isCompact ? theme.iconSizes.sm : theme.iconSizes.md;
|
|
28
|
+
const margin = `${theme.space.base * 2}px`;
|
|
29
|
+
return css(["width:", ";margin-", ":", ";"], width, theme.rtl ? 'left' : 'right', margin);
|
|
30
|
+
};
|
|
11
31
|
const StyledFileIcon = styled(StyledBaseIcon).attrs({
|
|
12
32
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
33
|
+
'data-garden-version': '9.0.0-next.15'
|
|
14
34
|
}).withConfig({
|
|
15
35
|
displayName: "StyledFileIcon",
|
|
16
36
|
componentId: "sc-7b3q0c-0"
|
|
17
|
-
})(["flex-shrink:0;
|
|
37
|
+
})(["flex-shrink:0;", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
38
|
StyledFileIcon.defaultProps = {
|
|
19
39
|
theme: DEFAULT_THEME
|
|
20
40
|
};
|
|
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
10
10
|
const COMPONENT_ID = 'forms.file_list';
|
|
11
11
|
const StyledFileList = styled.ul.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.15'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledFileList",
|
|
16
16
|
componentId: "sc-gbahjg-0"
|
|
@@ -12,7 +12,7 @@ import { StyledFileUpload } from '../file-upload/StyledFileUpload.js';
|
|
|
12
12
|
const COMPONENT_ID = 'forms.file_list.item';
|
|
13
13
|
const StyledFileListItem = styled.li.attrs({
|
|
14
14
|
'data-garden-id': COMPONENT_ID,
|
|
15
|
-
'data-garden-version': '9.0.0-next.
|
|
15
|
+
'data-garden-version': '9.0.0-next.15'
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledFileListItem",
|
|
18
18
|
componentId: "sc-1ova3lo-0"
|
|
@@ -5,37 +5,106 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
|
-
import {
|
|
9
|
-
import { retrieveComponentStyles, DEFAULT_THEME,
|
|
8
|
+
import { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledLabel } from '../common/StyledLabel.js';
|
|
11
11
|
import { StyledHint } from '../common/StyledHint.js';
|
|
12
12
|
import { StyledMessage } from '../common/StyledMessage.js';
|
|
13
13
|
|
|
14
14
|
const COMPONENT_ID = 'forms.file_upload';
|
|
15
|
-
const colorStyles =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
const colorStyles = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
theme,
|
|
18
|
+
isDragging
|
|
19
|
+
} = _ref;
|
|
20
|
+
const borderOptions = {
|
|
21
|
+
theme,
|
|
22
|
+
variable: 'border.primaryEmphasis'
|
|
23
|
+
};
|
|
24
|
+
const backgroundOptions = {
|
|
25
|
+
theme,
|
|
26
|
+
variable: 'background.primaryEmphasis'
|
|
27
|
+
};
|
|
28
|
+
const foregroundOptions = {
|
|
29
|
+
theme,
|
|
30
|
+
variable: 'foreground.primary'
|
|
31
|
+
};
|
|
32
|
+
const offset100 = {
|
|
33
|
+
dark: {
|
|
34
|
+
offset: -100
|
|
35
|
+
},
|
|
36
|
+
light: {
|
|
37
|
+
offset: 100
|
|
25
38
|
}
|
|
26
|
-
}
|
|
39
|
+
};
|
|
40
|
+
const offset200 = {
|
|
41
|
+
dark: {
|
|
42
|
+
offset: -200
|
|
43
|
+
},
|
|
44
|
+
light: {
|
|
45
|
+
offset: 200
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const borderColor = getColor({
|
|
49
|
+
theme,
|
|
50
|
+
variable: 'border.emphasis'
|
|
51
|
+
});
|
|
52
|
+
const foregroundColor = getColor(foregroundOptions);
|
|
53
|
+
const hoverBorderColor = getColor({
|
|
54
|
+
...borderOptions,
|
|
55
|
+
...offset100
|
|
56
|
+
});
|
|
57
|
+
const hoverBackgroundColor = getColor({
|
|
58
|
+
...backgroundOptions,
|
|
59
|
+
transparency: theme.opacity[100]
|
|
60
|
+
});
|
|
61
|
+
const hoverForegroundColor = getColor({
|
|
62
|
+
...foregroundOptions,
|
|
63
|
+
...offset100
|
|
64
|
+
});
|
|
65
|
+
const activeBorderColor = getColor({
|
|
66
|
+
...borderOptions,
|
|
67
|
+
...offset200
|
|
68
|
+
});
|
|
69
|
+
const activeBackgroundColor = getColor({
|
|
70
|
+
...backgroundOptions,
|
|
71
|
+
transparency: theme.opacity[200]
|
|
72
|
+
});
|
|
73
|
+
const activeForegroundColor = getColor({
|
|
74
|
+
...foregroundOptions,
|
|
75
|
+
...offset200
|
|
76
|
+
});
|
|
77
|
+
const disabledBorderColor = getColor({
|
|
78
|
+
theme,
|
|
79
|
+
variable: 'border.disabled'
|
|
80
|
+
});
|
|
81
|
+
const disabledBackgroundColor = getColor({
|
|
82
|
+
theme,
|
|
83
|
+
variable: 'background.disabled'
|
|
84
|
+
});
|
|
85
|
+
const disabledForegroundColor = getColor({
|
|
86
|
+
theme,
|
|
87
|
+
variable: 'foreground.disabled'
|
|
88
|
+
});
|
|
89
|
+
return css(["border-color:", ";background-color:", ";color:", ";&:hover{border-color:", ";background-color:", ";color:", ";}", " &:active{border-color:", ";background-color:", ";color:", ";}&[aria-disabled='true']{border-color:", ";background-color:", ";color:", ";}"], isDragging ? activeBorderColor : borderColor, isDragging ? activeBackgroundColor : undefined, isDragging ? activeForegroundColor : foregroundColor, hoverBorderColor, hoverBackgroundColor, hoverForegroundColor, focusStyles({
|
|
90
|
+
theme
|
|
91
|
+
}), activeBorderColor, activeBackgroundColor, activeForegroundColor, disabledBorderColor, disabledBackgroundColor, disabledForegroundColor);
|
|
27
92
|
};
|
|
28
|
-
const sizeStyles =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
93
|
+
const sizeStyles = _ref2 => {
|
|
94
|
+
let {
|
|
95
|
+
theme,
|
|
96
|
+
isCompact
|
|
97
|
+
} = _ref2;
|
|
98
|
+
const marginTop = `${theme.space.base * (isCompact ? 1 : 2)}px`;
|
|
99
|
+
const paddingHorizontal = `${isCompact ? 2 : 4}em`;
|
|
100
|
+
const paddingVertical = math(`${theme.space.base * (isCompact ? 2.5 : 5)} - ${theme.borderWidths.sm}`);
|
|
101
|
+
const fontSize = theme.fontSizes.md;
|
|
102
|
+
const lineHeight = getLineHeight(theme.space.base * 5, fontSize);
|
|
34
103
|
return css(["padding:", " ", ";min-width:4em;line-height:", ";font-size:", ";", ":not([hidden]) + &&,", " + &&,", " + &&,&& + ", ",&& + ", "{margin-top:", ";}"], paddingVertical, paddingHorizontal, lineHeight, fontSize, StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, marginTop);
|
|
35
104
|
};
|
|
36
105
|
const StyledFileUpload = styled.div.attrs({
|
|
37
106
|
'data-garden-id': COMPONENT_ID,
|
|
38
|
-
'data-garden-version': '9.0.0-next.
|
|
107
|
+
'data-garden-version': '9.0.0-next.15'
|
|
39
108
|
}).withConfig({
|
|
40
109
|
displayName: "StyledFileUpload",
|
|
41
110
|
componentId: "sc-1rodjgn-0"
|
|
@@ -23,7 +23,7 @@ const itemStyles = props => {
|
|
|
23
23
|
};
|
|
24
24
|
const StyledInputGroup = styled.div.attrs({
|
|
25
25
|
'data-garden-id': COMPONENT_ID,
|
|
26
|
-
'data-garden-version': '9.0.0-next.
|
|
26
|
+
'data-garden-version': '9.0.0-next.15'
|
|
27
27
|
}).withConfig({
|
|
28
28
|
displayName: "StyledInputGroup",
|
|
29
29
|
componentId: "sc-kjh1f0-0"
|
|
@@ -12,7 +12,7 @@ import { StyledHint } from '../common/StyledHint.js';
|
|
|
12
12
|
const COMPONENT_ID = 'forms.radio_hint';
|
|
13
13
|
const StyledRadioHint = styled(StyledHint).attrs({
|
|
14
14
|
'data-garden-id': COMPONENT_ID,
|
|
15
|
-
'data-garden-version': '9.0.0-next.
|
|
15
|
+
'data-garden-version': '9.0.0-next.15'
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledRadioHint",
|
|
18
18
|
componentId: "sc-eo8twg-0"
|
|
@@ -6,54 +6,115 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import { retrieveComponentStyles, DEFAULT_THEME,
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledRadioLabel } from './StyledRadioLabel.js';
|
|
11
11
|
import { StyledMessage } from '../common/StyledMessage.js';
|
|
12
12
|
|
|
13
13
|
const COMPONENT_ID = 'forms.radio';
|
|
14
|
-
const colorStyles =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const colorStyles = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
theme
|
|
17
|
+
} = _ref;
|
|
18
|
+
const borderColor = getColor({
|
|
19
|
+
theme,
|
|
20
|
+
variable: 'border.emphasis'
|
|
21
|
+
});
|
|
22
|
+
const backgroundColor = getColor({
|
|
23
|
+
theme,
|
|
24
|
+
variable: 'background.default'
|
|
25
|
+
});
|
|
26
|
+
const iconColor = getColor({
|
|
27
|
+
theme,
|
|
28
|
+
variable: 'foreground.onEmphasis'
|
|
29
|
+
});
|
|
30
|
+
const backgroundOptions = {
|
|
31
|
+
theme,
|
|
32
|
+
variable: 'background.primaryEmphasis'
|
|
33
|
+
};
|
|
34
|
+
const borderOptions = {
|
|
35
|
+
theme,
|
|
36
|
+
variable: 'border.primaryEmphasis'
|
|
37
|
+
};
|
|
38
|
+
const hoverBackgroundColor = getColor({
|
|
39
|
+
...backgroundOptions,
|
|
40
|
+
transparency: theme.opacity[100]
|
|
41
|
+
});
|
|
42
|
+
const hoverBorderColor = getColor(borderOptions);
|
|
21
43
|
const focusBorderColor = hoverBorderColor;
|
|
22
|
-
const activeBackgroundColor =
|
|
44
|
+
const activeBackgroundColor = getColor({
|
|
45
|
+
...backgroundOptions,
|
|
46
|
+
transparency: theme.opacity[200]
|
|
47
|
+
});
|
|
23
48
|
const activeBorderColor = focusBorderColor;
|
|
49
|
+
const checkedBackgroundColor = getColor(backgroundOptions);
|
|
24
50
|
const checkedBorderColor = focusBorderColor;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
51
|
+
const offset100 = {
|
|
52
|
+
dark: {
|
|
53
|
+
offset: -100
|
|
54
|
+
},
|
|
55
|
+
light: {
|
|
56
|
+
offset: 100
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const offset200 = {
|
|
60
|
+
dark: {
|
|
61
|
+
offset: -200
|
|
62
|
+
},
|
|
63
|
+
light: {
|
|
64
|
+
offset: 200
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const checkedHoverBackgroundColor = getColor({
|
|
68
|
+
...backgroundOptions,
|
|
69
|
+
...offset100
|
|
70
|
+
});
|
|
71
|
+
const checkedHoverBorderColor = getColor({
|
|
72
|
+
...borderOptions,
|
|
73
|
+
...offset100
|
|
74
|
+
});
|
|
75
|
+
const checkedActiveBackgroundColor = getColor({
|
|
76
|
+
...backgroundOptions,
|
|
77
|
+
...offset200
|
|
78
|
+
});
|
|
79
|
+
const checkedActiveBorderColor = getColor({
|
|
80
|
+
...borderOptions,
|
|
81
|
+
...offset200
|
|
82
|
+
});
|
|
83
|
+
const disabledBackgroundColor = getColor({
|
|
84
|
+
theme,
|
|
85
|
+
variable: 'background.disabled',
|
|
86
|
+
transparency: theme.opacity[300]
|
|
87
|
+
});
|
|
31
88
|
return css(["& ~ ", "::before{border-color:", ";background-color:", ";}& ~ ", " > svg{color:", ";}& ~ ", ":hover::before{border-color:", ";background-color:", ";}", " & ~ ", ":active::before{border-color:", ";background-color:", ";}&:checked ~ ", "::before{border-color:", ";background-color:", ";}&:enabled:checked ~ ", ":hover::before{border-color:", ";background-color:", ";}&:enabled:checked ~ ", ":active::before{border-color:", ";background-color:", ";}&:disabled ~ ", "::before{border-color:transparent;background-color:", ";}"], StyledRadioLabel, borderColor, backgroundColor, StyledRadioLabel, iconColor, StyledRadioLabel, hoverBorderColor, hoverBackgroundColor, focusStyles({
|
|
32
|
-
theme
|
|
89
|
+
theme,
|
|
33
90
|
styles: {
|
|
34
91
|
borderColor: focusBorderColor
|
|
35
92
|
},
|
|
36
93
|
selector: `&:focus-visible ~ ${StyledRadioLabel}::before`
|
|
37
94
|
}), StyledRadioLabel, activeBorderColor, activeBackgroundColor, StyledRadioLabel, checkedBorderColor, checkedBackgroundColor, StyledRadioLabel, checkedHoverBorderColor, checkedHoverBackgroundColor, StyledRadioLabel, checkedActiveBorderColor, checkedActiveBackgroundColor, StyledRadioLabel, disabledBackgroundColor);
|
|
38
95
|
};
|
|
39
|
-
const sizeStyles =
|
|
40
|
-
|
|
41
|
-
|
|
96
|
+
const sizeStyles = _ref2 => {
|
|
97
|
+
let {
|
|
98
|
+
theme,
|
|
99
|
+
isCompact
|
|
100
|
+
} = _ref2;
|
|
101
|
+
const lineHeight = `${theme.space.base * 5}px`;
|
|
102
|
+
const size = `${theme.space.base * 4}px`;
|
|
42
103
|
const top = math(`(${lineHeight} - ${size}) / 2`);
|
|
43
|
-
const iconSize =
|
|
104
|
+
const iconSize = theme.iconSizes.sm;
|
|
44
105
|
const iconPosition = math(`(${size} - ${iconSize}) / 2`);
|
|
45
106
|
const iconTop = math(`${iconPosition} + ${top}`);
|
|
46
|
-
const marginTop = `${
|
|
47
|
-
return css(["top:", ";width:", ";height:", ";& ~ ", "::before{top:", ";background-size:", ";width:", ";height:", ";box-sizing:border-box;}& ~ ", " > svg{top:", ";", ":", ";width:", ";height:", ";}&& ~ ", " ~ ", "{margin-top:", ";}"], top, size, size, StyledRadioLabel, top,
|
|
107
|
+
const marginTop = `${theme.space.base * (isCompact ? 1 : 2)}px`;
|
|
108
|
+
return css(["top:", ";width:", ";height:", ";& ~ ", "::before{top:", ";border:", ";background-size:", ";width:", ";height:", ";box-sizing:border-box;}& ~ ", " > svg{top:", ";", ":", ";width:", ";height:", ";}&& ~ ", " ~ ", "{margin-top:", ";}"], top, size, size, StyledRadioLabel, top, theme.borders.sm, theme.iconSizes.sm, size, size, StyledRadioLabel, iconTop, theme.rtl ? 'right' : 'left', iconPosition, iconSize, iconSize, StyledRadioLabel, StyledMessage, marginTop);
|
|
48
109
|
};
|
|
49
110
|
const StyledRadioInput = styled.input.attrs({
|
|
50
111
|
'data-garden-id': COMPONENT_ID,
|
|
51
|
-
'data-garden-version': '9.0.0-next.
|
|
112
|
+
'data-garden-version': '9.0.0-next.15',
|
|
52
113
|
type: 'radio'
|
|
53
114
|
}).withConfig({
|
|
54
115
|
displayName: "StyledRadioInput",
|
|
55
116
|
componentId: "sc-qsavpv-0"
|
|
56
|
-
})(["position:absolute;opacity:0;margin:0;& ~ ", "::before{position:absolute;", ":0;transition:border-color .25s ease-in-out,box-shadow .1s ease-in-out,background-color .25s ease-in-out,color .25s ease-in-out;border
|
|
117
|
+
})(["position:absolute;opacity:0;margin:0;& ~ ", "::before{position:absolute;", ":0;transition:border-color .25s ease-in-out,box-shadow .1s ease-in-out,background-color .25s ease-in-out,color .25s ease-in-out;border-radius:50%;background-repeat:no-repeat;background-position:center;content:'';}& ~ ", " > svg{position:absolute;}", ";&:focus ~ ", "::before{outline:none;}& ~ ", ":active::before{transition:border-color 0.1s ease-in-out,background-color 0.1s ease-in-out,color 0.1s ease-in-out;}", ";&:disabled ~ ", "{cursor:default;}", ";"], StyledRadioLabel, props => props.theme.rtl ? 'right' : 'left', StyledRadioLabel, sizeStyles, StyledRadioLabel, StyledRadioLabel, colorStyles, StyledRadioLabel, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
57
118
|
StyledRadioInput.defaultProps = {
|
|
58
119
|
theme: DEFAULT_THEME
|
|
59
120
|
};
|
|
@@ -17,7 +17,7 @@ const sizeStyles = props => {
|
|
|
17
17
|
};
|
|
18
18
|
const StyledRadioLabel = styled(StyledLabel).attrs({
|
|
19
19
|
'data-garden-id': COMPONENT_ID,
|
|
20
|
-
'data-garden-version': '9.0.0-next.
|
|
20
|
+
'data-garden-version': '9.0.0-next.15',
|
|
21
21
|
isRadio: true
|
|
22
22
|
}).withConfig({
|
|
23
23
|
displayName: "StyledRadioLabel",
|
|
@@ -12,7 +12,7 @@ import { StyledMessage } from '../common/StyledMessage.js';
|
|
|
12
12
|
const COMPONENT_ID = 'forms.radio_message';
|
|
13
13
|
const StyledRadioMessage = styled(StyledMessage).attrs({
|
|
14
14
|
'data-garden-id': COMPONENT_ID,
|
|
15
|
-
'data-garden-version': '9.0.0-next.
|
|
15
|
+
'data-garden-version': '9.0.0-next.15'
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledRadioMessage",
|
|
18
18
|
componentId: "sc-1pmi0q8-0"
|
|
@@ -13,7 +13,7 @@ import { StyledRadioLabel } from './StyledRadioLabel.js';
|
|
|
13
13
|
const COMPONENT_ID = 'forms.radio_svg';
|
|
14
14
|
const StyledRadioSvg = styled(SvgCircleSmFill).attrs({
|
|
15
15
|
'data-garden-id': COMPONENT_ID,
|
|
16
|
-
'data-garden-version': '9.0.0-next.
|
|
16
|
+
'data-garden-version': '9.0.0-next.15'
|
|
17
17
|
}).withConfig({
|
|
18
18
|
displayName: "StyledRadioSvg",
|
|
19
19
|
componentId: "sc-1r1qtr1-0"
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import { retrieveComponentStyles, DEFAULT_THEME,
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor, getFocusBoxShadow } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledHint } from '../common/StyledHint.js';
|
|
11
11
|
import { StyledLabel } from '../common/StyledLabel.js';
|
|
12
12
|
import { StyledMessage } from '../common/StyledMessage.js';
|
|
@@ -56,28 +56,81 @@ const trackLowerStyles = function (styles) {
|
|
|
56
56
|
}
|
|
57
57
|
`;
|
|
58
58
|
};
|
|
59
|
-
const colorStyles =
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const colorStyles = _ref => {
|
|
60
|
+
let {
|
|
61
|
+
theme,
|
|
62
|
+
hasLowerTrack
|
|
63
|
+
} = _ref;
|
|
64
|
+
const options = {
|
|
65
|
+
theme,
|
|
66
|
+
variable: 'background.primaryEmphasis'
|
|
67
|
+
};
|
|
68
|
+
const thumbBackgroundColor = getColor(options);
|
|
62
69
|
const thumbBorderColor = thumbBackgroundColor;
|
|
63
|
-
const thumbBoxShadow =
|
|
70
|
+
const thumbBoxShadow = theme.shadows.lg(`${theme.space.base}px`, `${theme.space.base * 2}px`, getColor({
|
|
71
|
+
theme,
|
|
72
|
+
hue: 'neutralHue',
|
|
73
|
+
shade: 1200,
|
|
74
|
+
dark: {
|
|
75
|
+
transparency: theme.opacity[1100]
|
|
76
|
+
},
|
|
77
|
+
light: {
|
|
78
|
+
transparency: theme.opacity[200]
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
64
81
|
const thumbFocusBoxShadow = getFocusBoxShadow({
|
|
65
|
-
theme
|
|
82
|
+
theme
|
|
83
|
+
});
|
|
84
|
+
const thumbActiveBackgroundColor = getColor({
|
|
85
|
+
...options,
|
|
86
|
+
dark: {
|
|
87
|
+
offset: -200
|
|
88
|
+
},
|
|
89
|
+
light: {
|
|
90
|
+
offset: 200
|
|
91
|
+
}
|
|
66
92
|
});
|
|
67
|
-
const thumbActiveBackgroundColor = getColorV8('primaryHue', SHADE + 100, props.theme);
|
|
68
93
|
const thumbActiveBorderColor = thumbBorderColor;
|
|
69
|
-
const thumbDisabledBackgroundColor =
|
|
94
|
+
const thumbDisabledBackgroundColor = getColor({
|
|
95
|
+
theme,
|
|
96
|
+
variable: 'border.emphasis'
|
|
97
|
+
});
|
|
70
98
|
const thumbDisabledBorderColor = thumbDisabledBackgroundColor;
|
|
71
|
-
const thumbHoverBackgroundColor =
|
|
99
|
+
const thumbHoverBackgroundColor = getColor({
|
|
100
|
+
...options,
|
|
101
|
+
dark: {
|
|
102
|
+
offset: -100
|
|
103
|
+
},
|
|
104
|
+
light: {
|
|
105
|
+
offset: 100
|
|
106
|
+
}
|
|
107
|
+
});
|
|
72
108
|
const thumbHoverBorderColor = thumbHoverBackgroundColor;
|
|
73
|
-
const trackBackgroundColor =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
109
|
+
const trackBackgroundColor = getColor({
|
|
110
|
+
theme,
|
|
111
|
+
variable: 'border.emphasis',
|
|
112
|
+
dark: {
|
|
113
|
+
offset: 100
|
|
114
|
+
},
|
|
115
|
+
light: {
|
|
116
|
+
offset: -200
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const trackLowerBackgroundColor = hasLowerTrack ? thumbBackgroundColor : '';
|
|
120
|
+
const trackBackgroundImage = hasLowerTrack ? `linear-gradient(${trackLowerBackgroundColor}, ${trackLowerBackgroundColor})` : '';
|
|
121
|
+
const trackDisabledBackgroundColor = getColor({
|
|
122
|
+
theme,
|
|
123
|
+
variable: 'background.disabled',
|
|
124
|
+
transparency: theme.opacity[200]
|
|
125
|
+
});
|
|
126
|
+
const trackDisabledLowerBackgroundColor = hasLowerTrack ? getColor({
|
|
127
|
+
theme,
|
|
128
|
+
variable: 'border.emphasis'
|
|
129
|
+
}) : '';
|
|
130
|
+
const trackDisabledBackgroundImage = hasLowerTrack ? `linear-gradient(${trackDisabledLowerBackgroundColor}, ${trackDisabledLowerBackgroundColor})` : '';
|
|
78
131
|
return css(["", " ", " ", " ", " ", " ", " ", " ", " ", ""], trackStyles(`
|
|
79
132
|
background-color: ${trackBackgroundColor};
|
|
80
|
-
background-image: ${trackBackgroundImage}; /*
|
|
133
|
+
background-image: ${trackBackgroundImage}; /* [1] */
|
|
81
134
|
`), thumbStyles(`
|
|
82
135
|
border-color: ${thumbBorderColor};
|
|
83
136
|
box-shadow: ${thumbBoxShadow};
|
|
@@ -96,6 +149,7 @@ const colorStyles = props => {
|
|
|
96
149
|
border-color: ${thumbActiveBorderColor};
|
|
97
150
|
background-color: ${thumbActiveBackgroundColor};
|
|
98
151
|
`, ':active'), trackStyles(`
|
|
152
|
+
background-color: ${trackDisabledBackgroundColor};
|
|
99
153
|
background-image: ${trackDisabledBackgroundImage};
|
|
100
154
|
`, ':disabled'), thumbStyles(`
|
|
101
155
|
border-color: ${thumbDisabledBorderColor};
|
|
@@ -105,29 +159,32 @@ const colorStyles = props => {
|
|
|
105
159
|
background-color: ${trackDisabledLowerBackgroundColor};
|
|
106
160
|
`, ':disabled'));
|
|
107
161
|
};
|
|
108
|
-
const sizeStyles =
|
|
109
|
-
|
|
110
|
-
|
|
162
|
+
const sizeStyles = _ref2 => {
|
|
163
|
+
let {
|
|
164
|
+
theme
|
|
165
|
+
} = _ref2;
|
|
166
|
+
const thumbSize = `${theme.space.base * 5}px`;
|
|
167
|
+
const trackHeight = `${theme.space.base * 1.5}px`;
|
|
111
168
|
const trackBorderRadius = trackHeight;
|
|
112
|
-
const trackMargin = math(`(${thumbSize} - ${trackHeight}) / 2 + ${
|
|
169
|
+
const trackMargin = math(`(${thumbSize} - ${trackHeight}) / 2 + ${theme.shadowWidths.md}`);
|
|
113
170
|
const thumbMargin = math(`(${trackHeight} - ${thumbSize}) / 2`);
|
|
114
|
-
return css(["", ":not([hidden]) + &,", " + &,", " + &,& + ", ",& + ", "{margin-top:", ";}", ";", " ", ""], StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage,
|
|
171
|
+
return css(["", ":not([hidden]) + &,", " + &,", " + &,& + ", ",& + ", "{margin-top:", ";}", ";", " ", ""], StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, `${theme.space.base * 2}px`, trackStyles(`
|
|
115
172
|
margin: ${trackMargin} 0;
|
|
116
173
|
border-radius: ${trackBorderRadius};
|
|
117
174
|
height: ${trackHeight};
|
|
118
175
|
`), thumbStyles(`
|
|
119
|
-
margin: ${thumbMargin} 0; /*
|
|
176
|
+
margin: ${thumbMargin} 0; /* [1] */
|
|
120
177
|
width: ${thumbSize};
|
|
121
178
|
height: ${thumbSize};
|
|
122
179
|
`), trackLowerStyles(`
|
|
123
|
-
border-top-${
|
|
124
|
-
border-bottom-${
|
|
180
|
+
border-top-${theme.rtl ? 'right' : 'left'}-radius: ${trackBorderRadius};
|
|
181
|
+
border-bottom-${theme.rtl ? 'right' : 'left'}-radius: ${trackBorderRadius};
|
|
125
182
|
height: ${trackHeight};
|
|
126
183
|
`));
|
|
127
184
|
};
|
|
128
185
|
const StyledRangeInput = styled.input.attrs(props => ({
|
|
129
186
|
'data-garden-id': COMPONENT_ID,
|
|
130
|
-
'data-garden-version': '9.0.0-next.
|
|
187
|
+
'data-garden-version': '9.0.0-next.15',
|
|
131
188
|
type: 'range',
|
|
132
189
|
style: {
|
|
133
190
|
backgroundSize: props.hasLowerTrack && props.backgroundSize
|
|
@@ -144,13 +201,13 @@ const StyledRangeInput = styled.input.attrs(props => ({
|
|
|
144
201
|
width: 99.8%; /* fix for IE which cuts off the upper track's border radius */
|
|
145
202
|
color: transparent; /* reset for IE */
|
|
146
203
|
box-sizing: border-box; /* reset for IE */
|
|
147
|
-
`),
|
|
204
|
+
`), sizeStyles, props => thumbStyles(`
|
|
148
205
|
appearance: none;
|
|
149
206
|
transition: box-shadow .1s ease-in-out;
|
|
150
207
|
border: ${props.theme.borders.md};
|
|
151
208
|
border-radius: 100%;
|
|
152
209
|
box-sizing: border-box;
|
|
153
|
-
`),
|
|
210
|
+
`), colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
154
211
|
StyledRangeInput.defaultProps = {
|
|
155
212
|
backgroundSize: '0%',
|
|
156
213
|
hasLowerTrack: true,
|
|
@@ -6,29 +6,53 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import {
|
|
9
|
+
import { getColor, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledTextInput } from '../text/StyledTextInput.js';
|
|
11
11
|
import { StyledTextMediaFigure } from '../text/StyledTextMediaFigure.js';
|
|
12
12
|
|
|
13
13
|
const COMPONENT_ID = 'forms.select';
|
|
14
|
-
const colorStyles =
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const colorStyles = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
theme
|
|
17
|
+
} = _ref;
|
|
18
|
+
const color = getColor({
|
|
19
|
+
theme,
|
|
20
|
+
variable: 'foreground.subtle',
|
|
21
|
+
dark: {
|
|
22
|
+
offset: -100
|
|
23
|
+
},
|
|
24
|
+
light: {
|
|
25
|
+
offset: 100
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const disabledColor = getColor({
|
|
29
|
+
theme,
|
|
30
|
+
variable: 'foreground.disabled'
|
|
31
|
+
});
|
|
32
|
+
return css(["&:hover + ", ",&:focus + ", ",&:focus-visible + ", "{color:", ";}&:disabled + ", "{color:", ";}"], StyledTextMediaFigure, StyledTextMediaFigure, StyledTextMediaFigure, color, StyledTextMediaFigure, disabledColor);
|
|
17
33
|
};
|
|
18
|
-
const sizeStyles =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
const sizeStyles = _ref2 => {
|
|
35
|
+
let {
|
|
36
|
+
theme,
|
|
37
|
+
isBare,
|
|
38
|
+
isCompact
|
|
39
|
+
} = _ref2;
|
|
40
|
+
const padding = isBare ? undefined : math(`${theme.iconSizes.md} + ${theme.space.base * 5}`);
|
|
41
|
+
const iconVerticalPosition = `${theme.space.base * (isCompact ? 1.5 : 2.5) + 1}px`;
|
|
42
|
+
const iconHorizontalPosition = `${theme.space.base * 3}px`;
|
|
43
|
+
return css(["padding-", ":", ";& + ", "{top:", ";", ":", ";}"], theme.rtl ? 'left' : 'right', padding, StyledTextMediaFigure, iconVerticalPosition, theme.rtl ? 'left' : 'right', iconHorizontalPosition);
|
|
23
44
|
};
|
|
24
45
|
const StyledSelect = styled(StyledTextInput).attrs({
|
|
25
46
|
'data-garden-id': COMPONENT_ID,
|
|
26
|
-
'data-garden-version': '9.0.0-next.
|
|
47
|
+
'data-garden-version': '9.0.0-next.15',
|
|
27
48
|
as: 'select'
|
|
28
49
|
}).withConfig({
|
|
29
50
|
displayName: "StyledSelect",
|
|
30
51
|
componentId: "sc-8xdxpt-0"
|
|
31
|
-
})(["cursor:pointer;text-overflow:ellipsis;", ";", ";&::-ms-expand{display:none;}&::-ms-value{background-color:transparent;color:inherit;}&:-moz-focusring{transition:none;text-shadow:0 0 0 ", ";color:transparent;}& + ", "{position:absolute;pointer-events:none;}"],
|
|
52
|
+
})(["cursor:pointer;text-overflow:ellipsis;", ";", ";&::-ms-expand{display:none;}&::-ms-value{background-color:transparent;color:inherit;}&:-moz-focusring{transition:none;text-shadow:0 0 0 ", ";color:transparent;}& + ", "{position:absolute;pointer-events:none;}"], sizeStyles, colorStyles, props => getColor({
|
|
53
|
+
theme: props.theme,
|
|
54
|
+
variable: 'foreground.default'
|
|
55
|
+
}), StyledTextMediaFigure);
|
|
32
56
|
StyledSelect.defaultProps = {
|
|
33
57
|
theme: DEFAULT_THEME
|
|
34
58
|
};
|