@zendeskgarden/react-forms 9.0.0-next.8 → 9.0.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/MediaInput.js +2 -2
- package/dist/esm/elements/Select.js +1 -0
- package/dist/esm/elements/Textarea.js +1 -1
- package/dist/esm/elements/common/Hint.js +1 -1
- package/dist/esm/elements/common/Label.js +2 -2
- package/dist/esm/elements/common/Message.js +2 -2
- package/dist/esm/elements/faux-input/components/EndIcon.js +16 -3
- package/dist/esm/elements/faux-input/components/StartIcon.js +16 -3
- package/dist/esm/elements/file-list/components/File.js +3 -2
- package/dist/esm/elements/tiles/components/Description.js +1 -1
- package/dist/esm/elements/tiles/components/Icon.js +1 -1
- package/dist/esm/elements/tiles/components/Label.js +1 -1
- package/dist/esm/elements/tiles/components/Tile.js +1 -3
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-circle-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-sm-fill.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/circle-sm-fill.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/dash-fill.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-document-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-error-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-generic-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-image-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-pdf-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-presentation-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-spreadsheet-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-zip-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/trash-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-circle-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/node_modules/@zendeskgarden/svg-icons/src/16/circle-sm-fill.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-document-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-error-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-generic-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-image-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-pdf-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-presentation-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-spreadsheet-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-zip-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/trash-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckHint.js +2 -5
- package/dist/esm/styled/checkbox/StyledCheckInput.js +55 -14
- package/dist/esm/styled/checkbox/StyledCheckLabel.js +2 -5
- package/dist/esm/styled/checkbox/StyledCheckMessage.js +2 -5
- package/dist/esm/styled/checkbox/StyledCheckSvg.js +2 -5
- package/dist/esm/styled/checkbox/StyledDashSvg.js +2 -5
- package/dist/esm/styled/common/StyledField.js +2 -5
- package/dist/esm/styled/common/StyledFieldset.js +2 -5
- package/dist/esm/styled/common/StyledHint.js +6 -6
- package/dist/esm/styled/common/StyledLabel.js +6 -6
- package/dist/esm/styled/common/StyledLegend.js +2 -5
- package/dist/esm/styled/common/StyledMessage.js +33 -19
- package/dist/esm/styled/common/StyledMessageIcon.js +4 -6
- package/dist/esm/styled/file-list/StyledFile.js +49 -31
- package/dist/esm/styled/file-list/StyledFileClose.js +6 -6
- package/dist/esm/styled/file-list/StyledFileDelete.js +6 -6
- package/dist/esm/styled/file-list/StyledFileIcon.js +22 -14
- package/dist/esm/styled/file-list/StyledFileList.js +2 -5
- package/dist/esm/styled/file-list/StyledFileListItem.js +2 -5
- package/dist/esm/styled/file-upload/StyledFileUpload.js +89 -23
- package/dist/esm/styled/input-group/StyledInputGroup.js +2 -5
- package/dist/esm/styled/radio/StyledRadioHint.js +2 -5
- package/dist/esm/styled/radio/StyledRadioInput.js +85 -27
- package/dist/esm/styled/radio/StyledRadioLabel.js +2 -5
- package/dist/esm/styled/radio/StyledRadioMessage.js +2 -5
- package/dist/esm/styled/radio/StyledRadioSvg.js +2 -5
- package/dist/esm/styled/range/StyledRangeInput.js +76 -26
- package/dist/esm/styled/select/StyledSelect.js +35 -14
- package/dist/esm/styled/select/StyledSelectWrapper.js +12 -7
- package/dist/esm/styled/text/StyledTextFauxInput.js +31 -26
- package/dist/esm/styled/text/StyledTextInput.js +103 -61
- package/dist/esm/styled/text/StyledTextMediaFigure.js +37 -29
- package/dist/esm/styled/text/StyledTextMediaInput.js +2 -5
- package/dist/esm/styled/text/StyledTextarea.js +2 -5
- package/dist/esm/styled/tiles/StyledTile.js +93 -37
- package/dist/esm/styled/tiles/StyledTileDescription.js +13 -16
- package/dist/esm/styled/tiles/StyledTileIcon.js +52 -16
- package/dist/esm/styled/tiles/StyledTileInput.js +1 -5
- package/dist/esm/styled/tiles/StyledTileLabel.js +13 -18
- package/dist/esm/styled/toggle/StyledToggleHint.js +2 -5
- package/dist/esm/styled/toggle/StyledToggleInput.js +38 -16
- package/dist/esm/styled/toggle/StyledToggleLabel.js +2 -5
- package/dist/esm/styled/toggle/StyledToggleMessage.js +2 -5
- package/dist/esm/styled/toggle/StyledToggleSvg.js +2 -5
- package/dist/index.cjs.js +977 -577
- package/dist/typings/elements/common/Field.d.ts +1 -1
- package/dist/typings/elements/common/Fieldset.d.ts +3 -1
- package/dist/typings/elements/faux-input/FauxInput.d.ts +3 -1
- 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/elements/file-list/FileList.d.ts +3 -1
- package/dist/typings/elements/file-list/components/File.d.ts +3 -1
- package/dist/typings/elements/tiles/Tiles.d.ts +3 -1
- package/dist/typings/styled/common/StyledMessageIcon.d.ts +2 -1
- package/dist/typings/styled/file-list/StyledFileIcon.d.ts +7 -2
- 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/text/StyledTextMediaFigure.d.ts +6 -7
- package/dist/typings/styled/tiles/StyledTile.d.ts +4 -7
- package/dist/typings/types/index.d.ts +3 -3
- package/dist/typings/utils/useFieldContext.d.ts +0 -1
- package/dist/typings/utils/useFieldsetContext.d.ts +0 -1
- package/dist/typings/utils/useFileContext.d.ts +0 -1
- package/dist/typings/utils/useInputContext.d.ts +0 -1
- package/dist/typings/utils/useInputGroupContext.d.ts +0 -1
- package/dist/typings/utils/useTilesContext.d.ts +0 -1
- package/package.json +7 -8
- package/LICENSE.md +0 -176
|
@@ -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 = 'forms.file_list';
|
|
11
11
|
const StyledFileList = styled.ul.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0
|
|
13
|
+
'data-garden-version': '9.0.0'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledFileList",
|
|
16
16
|
componentId: "sc-gbahjg-0"
|
|
17
17
|
})(["margin:0;padding:0;list-style:none;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
-
StyledFileList.defaultProps = {
|
|
19
|
-
theme: DEFAULT_THEME
|
|
20
|
-
};
|
|
21
18
|
|
|
22
19
|
export { StyledFileList };
|
|
@@ -5,20 +5,17 @@
|
|
|
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
|
import { StyledFileList } from './StyledFileList.js';
|
|
10
10
|
import { StyledFileUpload } from '../file-upload/StyledFileUpload.js';
|
|
11
11
|
|
|
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
|
|
15
|
+
'data-garden-version': '9.0.0'
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledFileListItem",
|
|
18
18
|
componentId: "sc-1ova3lo-0"
|
|
19
19
|
})(["&:not(:first-child),", " ~ ", " > &:first-child{margin-top:", "px;}", ";"], StyledFileUpload, StyledFileList, props => props.theme.space.base * 2, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
-
StyledFileListItem.defaultProps = {
|
|
21
|
-
theme: DEFAULT_THEME
|
|
22
|
-
};
|
|
23
20
|
|
|
24
21
|
export { StyledFileListItem };
|
|
@@ -5,43 +5,109 @@
|
|
|
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,
|
|
8
|
+
import { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, 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
|
|
107
|
+
'data-garden-version': '9.0.0'
|
|
39
108
|
}).withConfig({
|
|
40
109
|
displayName: "StyledFileUpload",
|
|
41
110
|
componentId: "sc-1rodjgn-0"
|
|
42
111
|
})(["display:flex;align-items:center;justify-content:center;box-sizing:border-box;direction:", ";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;border:dashed ", ";border-radius:", ";cursor:pointer;text-align:center;user-select:none;", ";&[aria-disabled='true']{cursor:default;}", ";", ";"], props => props.theme.rtl ? 'rtl' : 'ltr', props => props.theme.borderWidths.sm, props => props.theme.borderRadii.md, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
43
|
-
StyledFileUpload.defaultProps = {
|
|
44
|
-
theme: DEFAULT_THEME
|
|
45
|
-
};
|
|
46
112
|
|
|
47
113
|
export { StyledFileUpload };
|
|
@@ -5,7 +5,7 @@
|
|
|
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
|
|
8
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledTextInput } from '../text/StyledTextInput.js';
|
|
10
10
|
import { StyledLabel } from '../common/StyledLabel.js';
|
|
11
11
|
import { StyledHint } from '../common/StyledHint.js';
|
|
@@ -23,13 +23,10 @@ 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
|
|
26
|
+
'data-garden-version': '9.0.0'
|
|
27
27
|
}).withConfig({
|
|
28
28
|
displayName: "StyledInputGroup",
|
|
29
29
|
componentId: "sc-kjh1f0-0"
|
|
30
30
|
})(["display:inline-flex;position:relative;flex-wrap:nowrap;align-items:stretch;z-index:0;width:100%;", ";", ";", ";"], props => positionStyles(props), props => itemStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
31
|
-
StyledInputGroup.defaultProps = {
|
|
32
|
-
theme: DEFAULT_THEME
|
|
33
|
-
};
|
|
34
31
|
|
|
35
32
|
export { StyledInputGroup };
|
|
@@ -6,19 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import { retrieveComponentStyles
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledHint } from '../common/StyledHint.js';
|
|
11
11
|
|
|
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
|
|
15
|
+
'data-garden-version': '9.0.0'
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledRadioHint",
|
|
18
18
|
componentId: "sc-eo8twg-0"
|
|
19
19
|
})(["padding-", ":", ";", ";"], props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 6px`), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
-
StyledRadioHint.defaultProps = {
|
|
21
|
-
theme: DEFAULT_THEME
|
|
22
|
-
};
|
|
23
20
|
|
|
24
21
|
export { StyledRadioHint };
|
|
@@ -6,56 +6,114 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import { retrieveComponentStyles,
|
|
9
|
+
import { retrieveComponentStyles, 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
|
|
112
|
+
'data-garden-version': '9.0.0',
|
|
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
|
|
57
|
-
StyledRadioInput.defaultProps = {
|
|
58
|
-
theme: DEFAULT_THEME
|
|
59
|
-
};
|
|
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));
|
|
60
118
|
|
|
61
119
|
export { StyledRadioInput };
|
|
@@ -5,7 +5,7 @@
|
|
|
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
|
|
8
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledLabel } from '../common/StyledLabel.js';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'forms.radio_label';
|
|
@@ -17,14 +17,11 @@ 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
|
|
20
|
+
'data-garden-version': '9.0.0',
|
|
21
21
|
isRadio: true
|
|
22
22
|
}).withConfig({
|
|
23
23
|
displayName: "StyledRadioLabel",
|
|
24
24
|
componentId: "sc-1aq2e5t-0"
|
|
25
25
|
})(["display:inline-block;position:relative;cursor:pointer;", ";", ";"], props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
26
|
-
StyledRadioLabel.defaultProps = {
|
|
27
|
-
theme: DEFAULT_THEME
|
|
28
|
-
};
|
|
29
26
|
|
|
30
27
|
export { StyledRadioLabel };
|
|
@@ -6,19 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import { retrieveComponentStyles
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledMessage } from '../common/StyledMessage.js';
|
|
11
11
|
|
|
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
|
|
15
|
+
'data-garden-version': '9.0.0'
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledRadioMessage",
|
|
18
18
|
componentId: "sc-1pmi0q8-0"
|
|
19
19
|
})(["padding-", ":", ";", ";"], props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 6px`), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
-
StyledRadioMessage.defaultProps = {
|
|
21
|
-
theme: DEFAULT_THEME
|
|
22
|
-
};
|
|
23
20
|
|
|
24
21
|
export { StyledRadioMessage };
|
|
@@ -6,20 +6,17 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import SvgCircleSmFill from '../../node_modules/@zendeskgarden/svg-icons/src/12/circle-sm-fill.svg.js';
|
|
9
|
-
import { retrieveComponentStyles
|
|
9
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledRadioInput } from './StyledRadioInput.js';
|
|
11
11
|
import { StyledRadioLabel } from './StyledRadioLabel.js';
|
|
12
12
|
|
|
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
|
|
16
|
+
'data-garden-version': '9.0.0'
|
|
17
17
|
}).withConfig({
|
|
18
18
|
displayName: "StyledRadioSvg",
|
|
19
19
|
componentId: "sc-1r1qtr1-0"
|
|
20
20
|
})(["transition:opacity 0.25s ease-in-out;opacity:0;", ":checked ~ ", " > &{opacity:1;}", ";"], StyledRadioInput, StyledRadioLabel, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
21
|
-
StyledRadioSvg.defaultProps = {
|
|
22
|
-
theme: DEFAULT_THEME
|
|
23
|
-
};
|
|
24
21
|
|
|
25
22
|
export { StyledRadioSvg };
|
|
@@ -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,74 @@ 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
|
+
variable: 'shadow.small',
|
|
72
|
+
theme
|
|
73
|
+
}));
|
|
64
74
|
const thumbFocusBoxShadow = getFocusBoxShadow({
|
|
65
|
-
theme
|
|
75
|
+
theme
|
|
76
|
+
});
|
|
77
|
+
const thumbActiveBackgroundColor = getColor({
|
|
78
|
+
...options,
|
|
79
|
+
dark: {
|
|
80
|
+
offset: -200
|
|
81
|
+
},
|
|
82
|
+
light: {
|
|
83
|
+
offset: 200
|
|
84
|
+
}
|
|
66
85
|
});
|
|
67
|
-
const thumbActiveBackgroundColor = getColorV8('primaryHue', SHADE + 100, props.theme);
|
|
68
86
|
const thumbActiveBorderColor = thumbBorderColor;
|
|
69
|
-
const thumbDisabledBackgroundColor =
|
|
87
|
+
const thumbDisabledBackgroundColor = getColor({
|
|
88
|
+
theme,
|
|
89
|
+
variable: 'border.emphasis'
|
|
90
|
+
});
|
|
70
91
|
const thumbDisabledBorderColor = thumbDisabledBackgroundColor;
|
|
71
|
-
const thumbHoverBackgroundColor =
|
|
92
|
+
const thumbHoverBackgroundColor = getColor({
|
|
93
|
+
...options,
|
|
94
|
+
dark: {
|
|
95
|
+
offset: -100
|
|
96
|
+
},
|
|
97
|
+
light: {
|
|
98
|
+
offset: 100
|
|
99
|
+
}
|
|
100
|
+
});
|
|
72
101
|
const thumbHoverBorderColor = thumbHoverBackgroundColor;
|
|
73
|
-
const trackBackgroundColor =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
102
|
+
const trackBackgroundColor = getColor({
|
|
103
|
+
theme,
|
|
104
|
+
variable: 'border.emphasis',
|
|
105
|
+
dark: {
|
|
106
|
+
offset: 100
|
|
107
|
+
},
|
|
108
|
+
light: {
|
|
109
|
+
offset: -200
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const trackLowerBackgroundColor = hasLowerTrack ? thumbBackgroundColor : '';
|
|
113
|
+
const trackBackgroundImage = hasLowerTrack ? `linear-gradient(${trackLowerBackgroundColor}, ${trackLowerBackgroundColor})` : '';
|
|
114
|
+
const trackDisabledBackgroundColor = getColor({
|
|
115
|
+
theme,
|
|
116
|
+
variable: 'background.disabled',
|
|
117
|
+
transparency: theme.opacity[200]
|
|
118
|
+
});
|
|
119
|
+
const trackDisabledLowerBackgroundColor = hasLowerTrack ? getColor({
|
|
120
|
+
theme,
|
|
121
|
+
variable: 'border.emphasis'
|
|
122
|
+
}) : '';
|
|
123
|
+
const trackDisabledBackgroundImage = hasLowerTrack ? `linear-gradient(${trackDisabledLowerBackgroundColor}, ${trackDisabledLowerBackgroundColor})` : '';
|
|
78
124
|
return css(["", " ", " ", " ", " ", " ", " ", " ", " ", ""], trackStyles(`
|
|
79
125
|
background-color: ${trackBackgroundColor};
|
|
80
|
-
background-image: ${trackBackgroundImage}; /*
|
|
126
|
+
background-image: ${trackBackgroundImage}; /* [1] */
|
|
81
127
|
`), thumbStyles(`
|
|
82
128
|
border-color: ${thumbBorderColor};
|
|
83
129
|
box-shadow: ${thumbBoxShadow};
|
|
@@ -96,6 +142,7 @@ const colorStyles = props => {
|
|
|
96
142
|
border-color: ${thumbActiveBorderColor};
|
|
97
143
|
background-color: ${thumbActiveBackgroundColor};
|
|
98
144
|
`, ':active'), trackStyles(`
|
|
145
|
+
background-color: ${trackDisabledBackgroundColor};
|
|
99
146
|
background-image: ${trackDisabledBackgroundImage};
|
|
100
147
|
`, ':disabled'), thumbStyles(`
|
|
101
148
|
border-color: ${thumbDisabledBorderColor};
|
|
@@ -105,29 +152,32 @@ const colorStyles = props => {
|
|
|
105
152
|
background-color: ${trackDisabledLowerBackgroundColor};
|
|
106
153
|
`, ':disabled'));
|
|
107
154
|
};
|
|
108
|
-
const sizeStyles =
|
|
109
|
-
|
|
110
|
-
|
|
155
|
+
const sizeStyles = _ref2 => {
|
|
156
|
+
let {
|
|
157
|
+
theme
|
|
158
|
+
} = _ref2;
|
|
159
|
+
const thumbSize = `${theme.space.base * 5}px`;
|
|
160
|
+
const trackHeight = `${theme.space.base * 1.5}px`;
|
|
111
161
|
const trackBorderRadius = trackHeight;
|
|
112
|
-
const trackMargin = math(`(${thumbSize} - ${trackHeight}) / 2 + ${
|
|
162
|
+
const trackMargin = math(`(${thumbSize} - ${trackHeight}) / 2 + ${theme.shadowWidths.md}`);
|
|
113
163
|
const thumbMargin = math(`(${trackHeight} - ${thumbSize}) / 2`);
|
|
114
|
-
return css(["", ":not([hidden]) + &,", " + &,", " + &,& + ", ",& + ", "{margin-top:", ";}", ";", " ", ""], StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage,
|
|
164
|
+
return css(["", ":not([hidden]) + &,", " + &,", " + &,& + ", ",& + ", "{margin-top:", ";}", ";", " ", ""], StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, `${theme.space.base * 2}px`, trackStyles(`
|
|
115
165
|
margin: ${trackMargin} 0;
|
|
116
166
|
border-radius: ${trackBorderRadius};
|
|
117
167
|
height: ${trackHeight};
|
|
118
168
|
`), thumbStyles(`
|
|
119
|
-
margin: ${thumbMargin} 0; /*
|
|
169
|
+
margin: ${thumbMargin} 0; /* [1] */
|
|
120
170
|
width: ${thumbSize};
|
|
121
171
|
height: ${thumbSize};
|
|
122
172
|
`), trackLowerStyles(`
|
|
123
|
-
border-top-${
|
|
124
|
-
border-bottom-${
|
|
173
|
+
border-top-${theme.rtl ? 'right' : 'left'}-radius: ${trackBorderRadius};
|
|
174
|
+
border-bottom-${theme.rtl ? 'right' : 'left'}-radius: ${trackBorderRadius};
|
|
125
175
|
height: ${trackHeight};
|
|
126
176
|
`));
|
|
127
177
|
};
|
|
128
178
|
const StyledRangeInput = styled.input.attrs(props => ({
|
|
129
179
|
'data-garden-id': COMPONENT_ID,
|
|
130
|
-
'data-garden-version': '9.0.0
|
|
180
|
+
'data-garden-version': '9.0.0',
|
|
131
181
|
type: 'range',
|
|
132
182
|
style: {
|
|
133
183
|
backgroundSize: props.hasLowerTrack && props.backgroundSize
|
|
@@ -144,13 +194,13 @@ const StyledRangeInput = styled.input.attrs(props => ({
|
|
|
144
194
|
width: 99.8%; /* fix for IE which cuts off the upper track's border radius */
|
|
145
195
|
color: transparent; /* reset for IE */
|
|
146
196
|
box-sizing: border-box; /* reset for IE */
|
|
147
|
-
`),
|
|
197
|
+
`), sizeStyles, props => thumbStyles(`
|
|
148
198
|
appearance: none;
|
|
149
199
|
transition: box-shadow .1s ease-in-out;
|
|
150
200
|
border: ${props.theme.borders.md};
|
|
151
201
|
border-radius: 100%;
|
|
152
202
|
box-sizing: border-box;
|
|
153
|
-
`),
|
|
203
|
+
`), colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
154
204
|
StyledRangeInput.defaultProps = {
|
|
155
205
|
backgroundSize: '0%',
|
|
156
206
|
hasLowerTrack: true,
|