@zendeskgarden/react-forms 9.0.0-next.12 → 9.0.0-next.14
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/Select.js +1 -0
- package/dist/esm/elements/common/Label.js +1 -1
- 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/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 +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 +6 -3
- package/dist/esm/styled/common/StyledLabel.js +6 -3
- package/dist/esm/styled/common/StyledLegend.js +1 -1
- package/dist/esm/styled/common/StyledMessage.js +33 -16
- 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 +953 -415
- 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 +5 -5
|
@@ -6,16 +6,19 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { hideVisually } from 'polished';
|
|
9
|
-
import { getLineHeight,
|
|
9
|
+
import { getLineHeight, getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'forms.input_label';
|
|
12
12
|
const StyledLabel = styled.label.attrs(props => ({
|
|
13
13
|
'data-garden-id': props['data-garden-id'] || COMPONENT_ID,
|
|
14
|
-
'data-garden-version': props['data-garden-version'] || '9.0.0-next.
|
|
14
|
+
'data-garden-version': props['data-garden-version'] || '9.0.0-next.14'
|
|
15
15
|
})).withConfig({
|
|
16
16
|
displayName: "StyledLabel",
|
|
17
17
|
componentId: "sc-2utmsz-0"
|
|
18
|
-
})(["direction:", ";vertical-align:middle;line-height:", ";color:", ";font-size:", ";font-weight:", ";&[hidden]{display:", ";vertical-align:", ";text-indent:", ";font-size:", ";", ";}", ";"], props => props.theme.rtl && 'rtl', props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props =>
|
|
18
|
+
})(["direction:", ";vertical-align:middle;line-height:", ";color:", ";font-size:", ";font-weight:", ";&[hidden]{display:", ";vertical-align:", ";text-indent:", ";font-size:", ";", ";}", ";"], props => props.theme.rtl && 'rtl', props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => getColor({
|
|
19
|
+
theme: props.theme,
|
|
20
|
+
variable: 'foreground.default'
|
|
21
|
+
}), props => props.theme.fontSizes.md, props => props.isRegular ? props.theme.fontWeights.regular : props.theme.fontWeights.semibold, props => props.isRadio ? 'inline-block' : 'inline', props => props.isRadio && 'top', props => props.isRadio && '-100%', props => props.isRadio && '0', props => !props.isRadio && hideVisually(), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
22
|
StyledLabel.defaultProps = {
|
|
20
23
|
theme: DEFAULT_THEME
|
|
21
24
|
};
|
|
@@ -12,7 +12,7 @@ const COMPONENT_ID = 'forms.fieldset_legend';
|
|
|
12
12
|
const StyledLegend = styled(StyledLabel).attrs({
|
|
13
13
|
as: 'legend',
|
|
14
14
|
'data-garden-id': COMPONENT_ID,
|
|
15
|
-
'data-garden-version': '9.0.0-next.
|
|
15
|
+
'data-garden-version': '9.0.0-next.14'
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledLegend",
|
|
18
18
|
componentId: "sc-6s0zwq-0"
|
|
@@ -6,33 +6,50 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import {
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor, getLineHeight } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledMessageIcon } from './StyledMessageIcon.js';
|
|
11
11
|
import { StyledLabel } from './StyledLabel.js';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
const COMPONENT_ID = 'forms.input_message';
|
|
14
|
+
const colorStyles = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
theme,
|
|
17
|
+
validation
|
|
18
|
+
} = _ref;
|
|
19
|
+
let variable;
|
|
20
|
+
if (validation === 'error') {
|
|
21
|
+
variable = 'foreground.danger';
|
|
22
|
+
} else if (validation === 'success') {
|
|
23
|
+
variable = 'foreground.success';
|
|
24
|
+
} else if (validation === 'warning') {
|
|
25
|
+
variable = 'foreground.warning';
|
|
23
26
|
} else {
|
|
24
|
-
|
|
27
|
+
variable = 'foreground.subtle';
|
|
25
28
|
}
|
|
26
|
-
|
|
29
|
+
const foregroundColor = getColor({
|
|
30
|
+
theme,
|
|
31
|
+
variable
|
|
32
|
+
});
|
|
33
|
+
return css(["color:", ";"], foregroundColor);
|
|
34
|
+
};
|
|
35
|
+
const sizeStyles = _ref2 => {
|
|
36
|
+
let {
|
|
37
|
+
theme,
|
|
38
|
+
validation
|
|
39
|
+
} = _ref2;
|
|
40
|
+
const fontSize = theme.fontSizes.sm;
|
|
41
|
+
const lineHeight = getLineHeight(theme.iconSizes.md, theme.fontSizes.sm);
|
|
42
|
+
const marginTop = `${theme.space.base}px`;
|
|
43
|
+
const paddingHorizontal = validation ? math(`${theme.space.base * 2} + ${theme.iconSizes.md}`) : undefined;
|
|
44
|
+
return css(["padding-", ":", ";line-height:", ";font-size:", ";", ":not([hidden]) + &{margin-top:", ";}"], theme.rtl ? 'right' : 'left', paddingHorizontal, lineHeight, fontSize, StyledLabel, marginTop);
|
|
27
45
|
};
|
|
28
|
-
const COMPONENT_ID = 'forms.input_message';
|
|
29
46
|
const StyledMessage = styled.div.attrs(props => ({
|
|
30
47
|
'data-garden-id': props['data-garden-id'] || COMPONENT_ID,
|
|
31
|
-
'data-garden-version': props['data-garden-version'] || '9.0.0-next.
|
|
48
|
+
'data-garden-version': props['data-garden-version'] || '9.0.0-next.14'
|
|
32
49
|
})).withConfig({
|
|
33
50
|
displayName: "StyledMessage",
|
|
34
51
|
componentId: "sc-30hgg7-0"
|
|
35
|
-
})(["direction:", ";display:inline-block;position:relative;vertical-align:middle;
|
|
52
|
+
})(["direction:", ";display:inline-block;position:relative;vertical-align:middle;", ";", ";& ", "{position:absolute;top:-1px;", ":0;}", ":not([hidden]) + &{display:block;}", ";"], props => props.theme.rtl && 'rtl', sizeStyles, colorStyles, StyledMessageIcon, props => props.theme.rtl ? 'right' : 'left', StyledLabel, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
36
53
|
StyledMessage.defaultProps = {
|
|
37
54
|
theme: DEFAULT_THEME
|
|
38
55
|
};
|
|
@@ -32,7 +32,7 @@ const MessageIcon = _ref => {
|
|
|
32
32
|
const COMPONENT_ID = 'forms.input_message_icon';
|
|
33
33
|
const StyledMessageIcon = styled(MessageIcon).attrs({
|
|
34
34
|
'data-garden-id': COMPONENT_ID,
|
|
35
|
-
'data-garden-version': '9.0.0-next.
|
|
35
|
+
'data-garden-version': '9.0.0-next.14',
|
|
36
36
|
'aria-hidden': null
|
|
37
37
|
}).withConfig({
|
|
38
38
|
displayName: "StyledMessageIcon",
|
|
@@ -5,47 +5,68 @@
|
|
|
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, DEFAULT_THEME,
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledFileClose } from './StyledFileClose.js';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'forms.file';
|
|
12
|
-
const colorStyles =
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
const colorStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
theme,
|
|
15
|
+
focusInset,
|
|
16
|
+
validation
|
|
17
|
+
} = _ref;
|
|
18
|
+
let borderVariable;
|
|
19
|
+
let focusBorderVariable;
|
|
20
|
+
let foregroundVariable;
|
|
21
|
+
if (validation === 'success') {
|
|
22
|
+
borderVariable = 'border.successEmphasis';
|
|
23
|
+
focusBorderVariable = borderVariable;
|
|
24
|
+
foregroundVariable = 'foreground.success';
|
|
25
|
+
} else if (validation === 'error') {
|
|
26
|
+
borderVariable = 'border.dangerEmphasis';
|
|
27
|
+
focusBorderVariable = borderVariable;
|
|
28
|
+
foregroundVariable = 'foreground.danger';
|
|
24
29
|
} else {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
borderVariable = 'border.default';
|
|
31
|
+
focusBorderVariable = 'border.primaryEmphasis';
|
|
32
|
+
foregroundVariable = 'foreground.default';
|
|
28
33
|
}
|
|
34
|
+
const borderColor = getColor({
|
|
35
|
+
theme,
|
|
36
|
+
variable: borderVariable
|
|
37
|
+
});
|
|
38
|
+
const focusBorderColor = getColor({
|
|
39
|
+
theme,
|
|
40
|
+
variable: focusBorderVariable
|
|
41
|
+
});
|
|
42
|
+
const foregroundColor = getColor({
|
|
43
|
+
theme,
|
|
44
|
+
variable: foregroundVariable
|
|
45
|
+
});
|
|
29
46
|
return css(["border-color:", ";color:", ";", ""], borderColor, foregroundColor, focusStyles({
|
|
30
|
-
theme
|
|
31
|
-
inset:
|
|
47
|
+
theme,
|
|
48
|
+
inset: focusInset,
|
|
32
49
|
color: {
|
|
33
|
-
|
|
50
|
+
variable: focusBorderVariable
|
|
34
51
|
},
|
|
35
52
|
styles: {
|
|
36
53
|
borderColor: focusBorderColor
|
|
37
54
|
}
|
|
38
55
|
}));
|
|
39
56
|
};
|
|
40
|
-
const sizeStyles =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
57
|
+
const sizeStyles = _ref2 => {
|
|
58
|
+
let {
|
|
59
|
+
theme,
|
|
60
|
+
isCompact
|
|
61
|
+
} = _ref2;
|
|
62
|
+
const size = `${theme.space.base * (isCompact ? 7 : 10)}px`;
|
|
63
|
+
const spacing = `${theme.space.base * (isCompact ? 2 : 3)}px`;
|
|
64
|
+
const fontSize = theme.fontSizes.md;
|
|
65
|
+
const lineHeight = getLineHeight(theme.space.base * 5, fontSize);
|
|
45
66
|
return `
|
|
46
67
|
box-sizing: border-box;
|
|
47
|
-
border: ${
|
|
48
|
-
border-radius: ${
|
|
68
|
+
border: ${theme.borders.sm};
|
|
69
|
+
border-radius: ${theme.borderRadii.md};
|
|
49
70
|
padding: 0 ${spacing};
|
|
50
71
|
height: ${size};
|
|
51
72
|
line-height: ${lineHeight};
|
|
@@ -58,13 +79,13 @@ const sizeStyles = props => {
|
|
|
58
79
|
& > ${StyledFileClose} {
|
|
59
80
|
width: ${size};
|
|
60
81
|
height: ${size};
|
|
61
|
-
margin-${
|
|
82
|
+
margin-${theme.rtl ? 'left' : 'right'}: -${spacing};
|
|
62
83
|
}
|
|
63
84
|
`;
|
|
64
85
|
};
|
|
65
86
|
const StyledFile = styled.div.attrs({
|
|
66
87
|
'data-garden-id': COMPONENT_ID,
|
|
67
|
-
'data-garden-version': '9.0.0-next.
|
|
88
|
+
'data-garden-version': '9.0.0-next.14'
|
|
68
89
|
}).withConfig({
|
|
69
90
|
displayName: "StyledFile",
|
|
70
91
|
componentId: "sc-195lzp1-0"
|
|
@@ -5,16 +5,19 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import {
|
|
8
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
10
|
const COMPONENT_ID = 'forms.file.close';
|
|
11
11
|
const StyledFileClose = styled.button.attrs({
|
|
12
12
|
'data-garden-id': COMPONENT_ID,
|
|
13
|
-
'data-garden-version': '9.0.0-next.
|
|
13
|
+
'data-garden-version': '9.0.0-next.14'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledFileClose",
|
|
16
16
|
componentId: "sc-1m31jbf-0"
|
|
17
|
-
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:0.8;border:none;background:transparent;cursor:pointer;color:", ";appearance:none;&:hover{opacity:0.9;}&:focus{outline:none;}", ";"], props =>
|
|
17
|
+
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:0.8;border:none;background:transparent;cursor:pointer;color:", ";appearance:none;&:hover{opacity:0.9;}&:focus{outline:none;}", ";"], props => getColor({
|
|
18
|
+
theme: props.theme,
|
|
19
|
+
variable: 'foreground.subtle'
|
|
20
|
+
}), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
21
|
StyledFileClose.defaultProps = {
|
|
19
22
|
theme: DEFAULT_THEME
|
|
20
23
|
};
|
|
@@ -5,17 +5,20 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import {
|
|
8
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledFileClose } from './StyledFileClose.js';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'forms.file.delete';
|
|
12
12
|
const StyledFileDelete = styled(StyledFileClose).attrs({
|
|
13
13
|
'data-garden-id': COMPONENT_ID,
|
|
14
|
-
'data-garden-version': '9.0.0-next.
|
|
14
|
+
'data-garden-version': '9.0.0-next.14'
|
|
15
15
|
}).withConfig({
|
|
16
16
|
displayName: "StyledFileDelete",
|
|
17
17
|
componentId: "sc-a8nnhx-0"
|
|
18
|
-
})(["color:", ";", ";"], props =>
|
|
18
|
+
})(["color:", ";", ";"], props => getColor({
|
|
19
|
+
theme: props.theme,
|
|
20
|
+
variable: 'foreground.danger'
|
|
21
|
+
}), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
22
|
StyledFileDelete.defaultProps = {
|
|
20
23
|
theme: DEFAULT_THEME
|
|
21
24
|
};
|
|
@@ -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.14'
|
|
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.14'
|
|
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.14'
|
|
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.14'
|
|
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.14'
|
|
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.14'
|
|
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.14',
|
|
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.14',
|
|
21
21
|
isRadio: true
|
|
22
22
|
}).withConfig({
|
|
23
23
|
displayName: "StyledRadioLabel",
|