@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
|
@@ -5,17 +5,42 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
|
-
import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME,
|
|
8
|
+
import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
10
|
const COMPONENT_ID = 'forms.media_figure';
|
|
11
|
-
const colorStyles =
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
const colorStyles = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
theme,
|
|
14
|
+
$isDisabled,
|
|
15
|
+
$isHovered,
|
|
16
|
+
$isFocused
|
|
17
|
+
} = _ref;
|
|
18
|
+
let color;
|
|
19
|
+
if ($isDisabled) {
|
|
20
|
+
color = getColor({
|
|
21
|
+
theme,
|
|
22
|
+
variable: 'foreground.disabled'
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
const options = {
|
|
26
|
+
theme,
|
|
27
|
+
variable: 'foreground.subtle'
|
|
28
|
+
};
|
|
29
|
+
if ($isHovered || $isFocused) {
|
|
30
|
+
color = getColor({
|
|
31
|
+
...options,
|
|
32
|
+
dark: {
|
|
33
|
+
offset: -100
|
|
34
|
+
},
|
|
35
|
+
light: {
|
|
36
|
+
offset: 100
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
color = getColor(options);
|
|
41
|
+
}
|
|
17
42
|
}
|
|
18
|
-
return css(["color:", ";"],
|
|
43
|
+
return css(["color:", ";"], color);
|
|
19
44
|
};
|
|
20
45
|
const sizeStyles = props => {
|
|
21
46
|
const size = props.theme.iconSizes.md;
|
|
@@ -31,11 +56,11 @@ const sizeStyles = props => {
|
|
|
31
56
|
};
|
|
32
57
|
const StyledTextMediaFigure = styled(StyledBaseIcon).attrs({
|
|
33
58
|
'data-garden-id': COMPONENT_ID,
|
|
34
|
-
'data-garden-version': '9.0.0-next.
|
|
59
|
+
'data-garden-version': '9.0.0-next.14'
|
|
35
60
|
}).withConfig({
|
|
36
61
|
displayName: "StyledTextMediaFigure",
|
|
37
62
|
componentId: "sc-1qepknj-0"
|
|
38
|
-
})(["transform:", ";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;", ";", " ", ";"], props => props.$isRotated && `rotate(${props.theme.rtl ? '-' : '+'}180deg)`,
|
|
63
|
+
})(["transform:", ";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;", ";", " ", ";"], props => props.$isRotated && `rotate(${props.theme.rtl ? '-' : '+'}180deg)`, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
39
64
|
StyledTextMediaFigure.defaultProps = {
|
|
40
65
|
theme: DEFAULT_THEME
|
|
41
66
|
};
|
|
@@ -11,7 +11,7 @@ import { StyledTextInput } from './StyledTextInput.js';
|
|
|
11
11
|
const COMPONENT_ID = 'forms.media_input';
|
|
12
12
|
const StyledTextMediaInput = styled(StyledTextInput).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
|
isBare: true
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledTextMediaInput",
|
|
@@ -21,7 +21,7 @@ const hiddenStyles = `
|
|
|
21
21
|
const StyledTextarea = styled(StyledTextInput).attrs({
|
|
22
22
|
as: 'textarea',
|
|
23
23
|
'data-garden-id': COMPONENT_ID,
|
|
24
|
-
'data-garden-version': '9.0.0-next.
|
|
24
|
+
'data-garden-version': '9.0.0-next.14'
|
|
25
25
|
}).withConfig({
|
|
26
26
|
displayName: "StyledTextarea",
|
|
27
27
|
componentId: "sc-wxschl-0"
|
|
@@ -5,49 +5,108 @@
|
|
|
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,
|
|
9
|
-
import { StyledTileIcon } from './StyledTileIcon.js';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles } from '@zendeskgarden/react-theming';
|
|
10
9
|
|
|
11
10
|
const COMPONENT_ID = 'forms.tile';
|
|
12
|
-
const colorStyles =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const selectedHoverBorderColor = getColorV8('primaryHue', SHADE + 100, props.theme);
|
|
28
|
-
const selectedHoverBackgroundColor = selectedHoverBorderColor;
|
|
29
|
-
const selectedActiveBorderColor = getColorV8('primaryHue', SHADE + 200, props.theme);
|
|
30
|
-
const selectedActiveBackgroundColor = selectedActiveBorderColor;
|
|
31
|
-
const selectedDisabledBackgroundColor = disabledBorderColor;
|
|
32
|
-
return css(["border:", " ", ";border-color:", ";background-color:", ";color:", ";", "{color:", ";}&:hover:not([aria-disabled='true']){border-color:", ";background-color:", ";", "{color:", ";}}", " &:active:not([aria-disabled='true']){border-color:", ";background-color:", ";", "{color:", ";}}&[data-garden-selected='true']{border-color:", ";background-color:", ";color:", ";", "{color:", ";}}&[data-garden-selected='true']:not([aria-disabled='true']):hover{border-color:", ";background-color:", ";color:", ";", "{color:", ";}}&[data-garden-selected='true']:not([aria-disabled='true']):active{border-color:", ";background-color:", ";color:", ";", "{color:", ";}}&[aria-disabled='true']{border-color:", ";background-color:", ";color:", ";", "{color:", ";}}&[data-garden-selected='true'][aria-disabled='true']{background-color:", ";color:", ";", "{color:", ";}}"], props.theme.borders.sm, getColorV8('neutralHue', SHADE - 300, props.theme), borderColor, getColorV8('background', 600 , props.theme), color, StyledTileIcon, iconColor, hoverBorderColor, hoverBackgroundColor, StyledTileIcon, color, focusStyles({
|
|
33
|
-
theme: props.theme,
|
|
34
|
-
color: {
|
|
35
|
-
hue: focusBorderColor
|
|
11
|
+
const colorStyles = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
theme
|
|
14
|
+
} = _ref;
|
|
15
|
+
const offset100 = {
|
|
16
|
+
dark: {
|
|
17
|
+
offset: -100
|
|
18
|
+
},
|
|
19
|
+
light: {
|
|
20
|
+
offset: 100
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const offset200 = {
|
|
24
|
+
dark: {
|
|
25
|
+
offset: -200
|
|
36
26
|
},
|
|
27
|
+
light: {
|
|
28
|
+
offset: 200
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const backgroundColor = getColor({
|
|
32
|
+
theme,
|
|
33
|
+
variable: 'background.default'
|
|
34
|
+
});
|
|
35
|
+
const borderColor = getColor({
|
|
36
|
+
theme,
|
|
37
|
+
variable: 'border.default',
|
|
38
|
+
...offset100
|
|
39
|
+
});
|
|
40
|
+
const foregroundColor = getColor({
|
|
41
|
+
theme,
|
|
42
|
+
variable: 'foreground.default'
|
|
43
|
+
});
|
|
44
|
+
const backgroundOptions = {
|
|
45
|
+
theme,
|
|
46
|
+
variable: 'background.primaryEmphasis'
|
|
47
|
+
};
|
|
48
|
+
const hoverBackgroundColor = getColor({
|
|
49
|
+
...backgroundOptions,
|
|
50
|
+
transparency: theme.opacity[100]
|
|
51
|
+
});
|
|
52
|
+
const hoverBorderColor = getColor({
|
|
53
|
+
theme,
|
|
54
|
+
variable: 'border.primaryEmphasis'
|
|
55
|
+
});
|
|
56
|
+
const activeBackgroundColor = getColor({
|
|
57
|
+
...backgroundOptions,
|
|
58
|
+
transparency: theme.opacity[200]
|
|
59
|
+
});
|
|
60
|
+
const focusBorderColor = hoverBorderColor;
|
|
61
|
+
const activeBorderColor = hoverBorderColor;
|
|
62
|
+
const checkedBackgroundColor = getColor(backgroundOptions);
|
|
63
|
+
const checkedForegroundColor = getColor({
|
|
64
|
+
theme,
|
|
65
|
+
variable: 'foreground.onEmphasis'
|
|
66
|
+
});
|
|
67
|
+
const checkedHoverBackgroundColor = getColor({
|
|
68
|
+
...backgroundOptions,
|
|
69
|
+
...offset100
|
|
70
|
+
});
|
|
71
|
+
const checkedActiveBackgroundColor = getColor({
|
|
72
|
+
...backgroundOptions,
|
|
73
|
+
...offset200
|
|
74
|
+
});
|
|
75
|
+
const disabledBackgroundColor = getColor({
|
|
76
|
+
theme,
|
|
77
|
+
variable: 'background.disabled'
|
|
78
|
+
});
|
|
79
|
+
const disabledBorderColor = getColor({
|
|
80
|
+
theme,
|
|
81
|
+
variable: 'border.disabled'
|
|
82
|
+
});
|
|
83
|
+
const disabledForegroundColor = getColor({
|
|
84
|
+
theme,
|
|
85
|
+
variable: 'foreground.disabled'
|
|
86
|
+
});
|
|
87
|
+
return css(["border-color:", ";background-color:", ";color:", ";&:hover{border-color:", ";background-color:", ";}", ";&:active{border-color:", ";background-color:", ";}&:has(:checked){border-color:transparent;background-color:", ";color:", ";}&:hover:has(:checked){background-color:", ";}&:active:has(:checked){background-color:", ";}&[aria-disabled='true']{border-color:", ";background-color:", ";color:", ";}"], borderColor, backgroundColor, foregroundColor, hoverBorderColor, hoverBackgroundColor, focusStyles({
|
|
88
|
+
theme,
|
|
89
|
+
selector: '&:has(:focus-visible)',
|
|
37
90
|
styles: {
|
|
38
91
|
borderColor: focusBorderColor
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
92
|
+
}
|
|
93
|
+
}), activeBorderColor, activeBackgroundColor, checkedBackgroundColor, checkedForegroundColor, checkedHoverBackgroundColor, checkedActiveBackgroundColor, disabledBorderColor, disabledBackgroundColor, disabledForegroundColor);
|
|
94
|
+
};
|
|
95
|
+
const sizeStyles = _ref2 => {
|
|
96
|
+
let {
|
|
97
|
+
theme
|
|
98
|
+
} = _ref2;
|
|
99
|
+
const border = theme.borders.sm;
|
|
100
|
+
const padding = `${theme.space.base * 5}px`;
|
|
101
|
+
return css(["border:", ";padding:", ";min-width:132px;"], border, padding);
|
|
42
102
|
};
|
|
43
|
-
const StyledTile = styled.label.attrs(
|
|
103
|
+
const StyledTile = styled.label.attrs({
|
|
44
104
|
'data-garden-id': COMPONENT_ID,
|
|
45
|
-
'data-garden-version': '9.0.0-next.
|
|
46
|
-
|
|
47
|
-
})).withConfig({
|
|
105
|
+
'data-garden-version': '9.0.0-next.14'
|
|
106
|
+
}).withConfig({
|
|
48
107
|
displayName: "StyledTile",
|
|
49
108
|
componentId: "sc-1jjvmxs-0"
|
|
50
|
-
})(["display:block;position:relative;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:", ";
|
|
109
|
+
})(["display:block;position:relative;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:", ";direction:", ";word-break:break-word;", ";", ";", ";"], props => props.theme.borderRadii.md, props => props.theme.rtl && 'rtl', sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
51
110
|
StyledTile.defaultProps = {
|
|
52
111
|
theme: DEFAULT_THEME
|
|
53
112
|
};
|
|
@@ -6,27 +6,27 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import {
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getLineHeight } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'forms.tile_description';
|
|
12
|
-
const sizeStyles =
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return css(["margin-top:", "
|
|
12
|
+
const sizeStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
theme,
|
|
15
|
+
isCentered
|
|
16
|
+
} = _ref;
|
|
17
|
+
const marginTop = `${theme.space.base}px`;
|
|
18
|
+
const marginHorizontal = isCentered ? undefined : math(`(${theme.iconSizes.md} * 2) + ${theme.space.base * 5}px`);
|
|
19
|
+
const fontSize = theme.fontSizes.sm;
|
|
20
|
+
const lineHeight = getLineHeight(theme.space.base * 4, fontSize);
|
|
21
|
+
return css(["margin-top:", ";margin-", ":", ";line-height:", ";font-size:", ";"], marginTop, theme.rtl ? 'right' : 'left', marginHorizontal, lineHeight, fontSize);
|
|
22
22
|
};
|
|
23
23
|
const StyledTileDescription = styled.span.attrs({
|
|
24
24
|
'data-garden-id': COMPONENT_ID,
|
|
25
|
-
'data-garden-version': '9.0.0-next.
|
|
25
|
+
'data-garden-version': '9.0.0-next.14'
|
|
26
26
|
}).withConfig({
|
|
27
27
|
displayName: "StyledTileDescription",
|
|
28
28
|
componentId: "sc-xfuu7u-0"
|
|
29
|
-
})(["display:block;text-align:", ";
|
|
29
|
+
})(["display:block;text-align:", ";", ";", ";"], props => props.isCentered && 'center', sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
30
30
|
StyledTileDescription.defaultProps = {
|
|
31
31
|
theme: DEFAULT_THEME
|
|
32
32
|
};
|
|
@@ -5,32 +5,71 @@
|
|
|
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 } from '@zendeskgarden/react-theming';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { math } from 'polished';
|
|
10
|
+
import { StyledTile } from './StyledTile.js';
|
|
10
11
|
|
|
11
12
|
const COMPONENT_ID = 'forms.tile_icon';
|
|
12
|
-
const
|
|
13
|
-
|
|
13
|
+
const colorStyles = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
theme
|
|
16
|
+
} = _ref;
|
|
17
|
+
const options = {
|
|
18
|
+
theme,
|
|
19
|
+
variable: 'foreground.subtle'
|
|
20
|
+
};
|
|
21
|
+
const color = getColor(options);
|
|
22
|
+
const hoverColor = getColor({
|
|
23
|
+
...options,
|
|
24
|
+
dark: {
|
|
25
|
+
offset: -100
|
|
26
|
+
},
|
|
27
|
+
light: {
|
|
28
|
+
offset: 100
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const activeColor = getColor({
|
|
32
|
+
...options,
|
|
33
|
+
dark: {
|
|
34
|
+
offset: -200
|
|
35
|
+
},
|
|
36
|
+
light: {
|
|
37
|
+
offset: 200
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const checkedColor = getColor({
|
|
41
|
+
theme,
|
|
42
|
+
variable: 'foreground.onEmphasis'
|
|
43
|
+
});
|
|
44
|
+
const disabledColor = getColor({
|
|
45
|
+
theme,
|
|
46
|
+
variable: 'foreground.disabled'
|
|
47
|
+
});
|
|
48
|
+
return css(["color:", ";", ":hover &&{color:", ";}", ":active &&{color:", ";}", ":has(:checked) &&{color:", ";}", "[aria-disabled='true'] &&{color:", ";}"], color, StyledTile, hoverColor, StyledTile, activeColor, StyledTile, checkedColor, StyledTile, disabledColor);
|
|
49
|
+
};
|
|
50
|
+
const sizeStyles = _ref2 => {
|
|
51
|
+
let {
|
|
52
|
+
theme,
|
|
53
|
+
isCentered
|
|
54
|
+
} = _ref2;
|
|
55
|
+
const iconSize = math(`${theme.iconSizes.md} * 2`);
|
|
14
56
|
let position;
|
|
15
57
|
let top;
|
|
16
|
-
let
|
|
17
|
-
if (!
|
|
58
|
+
let horizontal;
|
|
59
|
+
if (!isCentered) {
|
|
18
60
|
position = 'absolute';
|
|
19
|
-
top = `${
|
|
20
|
-
|
|
21
|
-
if (props.theme.rtl) {
|
|
22
|
-
horizontalValue = `right: ${props.theme.space.base * 5}px`;
|
|
23
|
-
}
|
|
61
|
+
top = `${theme.space.base * 6}px`;
|
|
62
|
+
horizontal = `${theme.space.base * 5}px`;
|
|
24
63
|
}
|
|
25
|
-
return css(["position:", ";top:", ";", ";& > *{width:", ";height:", ";}"], position, top,
|
|
64
|
+
return css(["position:", ";top:", ";", ":", ";line-height:0;& > *{width:", ";height:", ";}"], position, top, theme.rtl ? 'right' : 'left', horizontal, iconSize, iconSize);
|
|
26
65
|
};
|
|
27
66
|
const StyledTileIcon = styled.span.attrs({
|
|
28
67
|
'data-garden-id': COMPONENT_ID,
|
|
29
|
-
'data-garden-version': '9.0.0-next.
|
|
68
|
+
'data-garden-version': '9.0.0-next.14'
|
|
30
69
|
}).withConfig({
|
|
31
70
|
displayName: "StyledTileIcon",
|
|
32
71
|
componentId: "sc-1wazhg4-0"
|
|
33
|
-
})(["display:block;transition:color 0.25s ease-in-out;text-align:center;
|
|
72
|
+
})(["display:block;transition:color 0.25s ease-in-out;text-align:center;", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
34
73
|
StyledTileIcon.defaultProps = {
|
|
35
74
|
theme: DEFAULT_THEME
|
|
36
75
|
};
|
|
@@ -10,7 +10,7 @@ import { DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
|
10
10
|
const StyledTileInput = styled.input.withConfig({
|
|
11
11
|
displayName: "StyledTileInput",
|
|
12
12
|
componentId: "sc-1nq2m6q-0"
|
|
13
|
-
})(["position:absolute;
|
|
13
|
+
})(["position:absolute;top:0;left:0;opacity:0;z-index:1;margin:0;cursor:", ";width:100%;height:100%;"], props => props.disabled ? 'default' : 'pointer');
|
|
14
14
|
StyledTileInput.defaultProps = {
|
|
15
15
|
theme: DEFAULT_THEME
|
|
16
16
|
};
|
|
@@ -6,29 +6,27 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import {
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getLineHeight } from '@zendeskgarden/react-theming';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'forms.tile_label';
|
|
12
|
-
const sizeStyles =
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
return css(["margin-top:", ";margin-", ":", ";"], marginTop, marginDirection, marginValue);
|
|
12
|
+
const sizeStyles = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
theme,
|
|
15
|
+
isCentered
|
|
16
|
+
} = _ref;
|
|
17
|
+
const marginTop = isCentered ? `${theme.space.base * 2}px` : 0;
|
|
18
|
+
const marginHorizontal = isCentered ? undefined : math(`(${theme.iconSizes.md} * 2) + ${theme.space.base * 5}px`);
|
|
19
|
+
const fontSize = theme.fontSizes.md;
|
|
20
|
+
const lineHeight = getLineHeight(theme.space.base * 5, fontSize);
|
|
21
|
+
return css(["margin-top:", ";margin-", ":", ";line-height:", ";font-size:", ";"], marginTop, theme.rtl ? 'right' : 'left', marginHorizontal, lineHeight, fontSize);
|
|
24
22
|
};
|
|
25
23
|
const StyledTileLabel = styled.span.attrs({
|
|
26
24
|
'data-garden-id': COMPONENT_ID,
|
|
27
|
-
'data-garden-version': '9.0.0-next.
|
|
25
|
+
'data-garden-version': '9.0.0-next.14'
|
|
28
26
|
}).withConfig({
|
|
29
27
|
displayName: "StyledTileLabel",
|
|
30
28
|
componentId: "sc-1mypv27-0"
|
|
31
|
-
})(["display:block;text-align:", ";
|
|
29
|
+
})(["display:block;text-align:", ";font-weight:", ";", ";", ";"], props => props.isCentered && 'center', props => props.theme.fontWeights.semibold, sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
32
30
|
StyledTileLabel.defaultProps = {
|
|
33
31
|
theme: DEFAULT_THEME
|
|
34
32
|
};
|
|
@@ -12,7 +12,7 @@ import { StyledHint } from '../common/StyledHint.js';
|
|
|
12
12
|
const COMPONENT_ID = 'forms.toggle_hint';
|
|
13
13
|
const StyledToggleHint = 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: "StyledToggleHint",
|
|
18
18
|
componentId: "sc-nziggu-0"
|
|
@@ -6,33 +6,58 @@
|
|
|
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 } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledCheckInput } from '../checkbox/StyledCheckInput.js';
|
|
11
11
|
import { StyledToggleLabel } from './StyledToggleLabel.js';
|
|
12
12
|
|
|
13
13
|
const COMPONENT_ID = 'forms.toggle';
|
|
14
|
-
const colorStyles =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
14
|
+
const colorStyles = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
theme
|
|
17
|
+
} = _ref;
|
|
18
|
+
const backgroundOptions = {
|
|
19
|
+
theme,
|
|
20
|
+
variable: 'background.emphasis'
|
|
21
|
+
};
|
|
22
|
+
const backgroundColor = getColor(backgroundOptions);
|
|
23
|
+
const hoverBackgroundColor = getColor({
|
|
24
|
+
...backgroundOptions,
|
|
25
|
+
dark: {
|
|
26
|
+
offset: -100
|
|
27
|
+
},
|
|
28
|
+
light: {
|
|
29
|
+
offset: 100
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const activeBackgroundColor = getColor({
|
|
33
|
+
...backgroundOptions,
|
|
34
|
+
dark: {
|
|
35
|
+
offset: -200
|
|
36
|
+
},
|
|
37
|
+
light: {
|
|
38
|
+
offset: 200
|
|
39
|
+
}
|
|
40
|
+
});
|
|
19
41
|
return css(["& ~ ", "::before{background-color:", ";}&:enabled ~ ", ":hover::before{background-color:", ";}&:enabled ~ ", ":active::before{background-color:", ";}"], StyledToggleLabel, backgroundColor, StyledToggleLabel, hoverBackgroundColor, StyledToggleLabel, activeBackgroundColor);
|
|
20
42
|
};
|
|
21
|
-
const sizeStyles =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
43
|
+
const sizeStyles = _ref2 => {
|
|
44
|
+
let {
|
|
45
|
+
theme
|
|
46
|
+
} = _ref2;
|
|
47
|
+
const height = `${theme.space.base * 5}px`;
|
|
48
|
+
const width = `${theme.space.base * 10}px`;
|
|
49
|
+
const iconSize = theme.iconSizes.md;
|
|
25
50
|
const iconPosition = math(`(${height} - ${iconSize}) / 2`);
|
|
26
51
|
const checkedIconPosition = math(`${width} - ${iconSize} - ${iconPosition}`);
|
|
27
|
-
return css(["top:0;width:", ";height:", ";& ~ ", "::before{width:", ";height:", ";}& ~ ", " > svg{top:", ";", ":", ";width:", ";height:", ";}&:checked ~ ", " > svg{", ":", ";}"], width, height, StyledToggleLabel, width, height, StyledToggleLabel, iconPosition,
|
|
52
|
+
return css(["top:0;width:", ";height:", ";& ~ ", "::before{width:", ";height:", ";}& ~ ", " > svg{top:", ";", ":", ";width:", ";height:", ";}&:checked ~ ", " > svg{", ":", ";}"], width, height, StyledToggleLabel, width, height, StyledToggleLabel, iconPosition, theme.rtl ? 'right' : 'left', iconPosition, iconSize, iconSize, StyledToggleLabel, theme.rtl ? 'right' : 'left', checkedIconPosition);
|
|
28
53
|
};
|
|
29
54
|
const StyledToggleInput = styled(StyledCheckInput).attrs({
|
|
30
55
|
'data-garden-id': COMPONENT_ID,
|
|
31
|
-
'data-garden-version': '9.0.0-next.
|
|
56
|
+
'data-garden-version': '9.0.0-next.14'
|
|
32
57
|
}).withConfig({
|
|
33
58
|
displayName: "StyledToggleInput",
|
|
34
59
|
componentId: "sc-sgp47s-0"
|
|
35
|
-
})(["& ~ ", "::before{top:0;transition:box-shadow .1s ease-in-out,background-color .15s ease-in-out,color .25s ease-in-out;border:none;border-radius:100px;}", ";", ";", ";"], StyledToggleLabel,
|
|
60
|
+
})(["& ~ ", "::before{top:0;transition:box-shadow .1s ease-in-out,background-color .15s ease-in-out,color .25s ease-in-out;border:none;border-radius:100px;}", ";", ";", ";"], StyledToggleLabel, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
36
61
|
StyledToggleInput.defaultProps = {
|
|
37
62
|
theme: DEFAULT_THEME
|
|
38
63
|
};
|
|
@@ -16,7 +16,7 @@ const sizeStyles = props => {
|
|
|
16
16
|
};
|
|
17
17
|
const StyledToggleLabel = styled(StyledCheckLabel).attrs({
|
|
18
18
|
'data-garden-id': COMPONENT_ID,
|
|
19
|
-
'data-garden-version': '9.0.0-next.
|
|
19
|
+
'data-garden-version': '9.0.0-next.14'
|
|
20
20
|
}).withConfig({
|
|
21
21
|
displayName: "StyledToggleLabel",
|
|
22
22
|
componentId: "sc-e0asdk-0"
|
|
@@ -13,7 +13,7 @@ import { StyledMessageIcon } from '../common/StyledMessageIcon.js';
|
|
|
13
13
|
const COMPONENT_ID = 'forms.toggle_message';
|
|
14
14
|
const StyledToggleMessage = styled(StyledMessage).attrs({
|
|
15
15
|
'data-garden-id': COMPONENT_ID,
|
|
16
|
-
'data-garden-version': '9.0.0-next.
|
|
16
|
+
'data-garden-version': '9.0.0-next.14'
|
|
17
17
|
}).withConfig({
|
|
18
18
|
displayName: "StyledToggleMessage",
|
|
19
19
|
componentId: "sc-13vuvl1-0"
|
|
@@ -11,7 +11,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
11
11
|
const COMPONENT_ID = 'forms.toggle_svg';
|
|
12
12
|
const StyledToggleSvg = styled(SvgCircleSmFill).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: "StyledToggleSvg",
|
|
17
17
|
componentId: "sc-162xbyx-0"
|