@zendeskgarden/react-forms 9.0.0-next.13 → 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/LICENSE.md +176 -0
- package/dist/esm/elements/Select.js +1 -0
- package/dist/esm/elements/faux-input/components/EndIcon.js +4 -0
- package/dist/esm/elements/faux-input/components/StartIcon.js +4 -0
- package/dist/esm/elements/file-list/components/File.js +2 -1
- package/dist/esm/elements/tiles/components/Tile.js +1 -3
- package/dist/esm/styled/checkbox/StyledCheckHint.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckInput.js +55 -11
- package/dist/esm/styled/checkbox/StyledCheckLabel.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckMessage.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckSvg.js +1 -1
- package/dist/esm/styled/checkbox/StyledDashSvg.js +1 -1
- package/dist/esm/styled/common/StyledField.js +1 -1
- package/dist/esm/styled/common/StyledFieldset.js +1 -1
- package/dist/esm/styled/common/StyledHint.js +1 -1
- package/dist/esm/styled/common/StyledLabel.js +1 -1
- package/dist/esm/styled/common/StyledLegend.js +1 -1
- package/dist/esm/styled/common/StyledMessage.js +1 -1
- package/dist/esm/styled/common/StyledMessageIcon.js +1 -1
- package/dist/esm/styled/file-list/StyledFile.js +49 -28
- package/dist/esm/styled/file-list/StyledFileClose.js +6 -3
- package/dist/esm/styled/file-list/StyledFileDelete.js +6 -3
- package/dist/esm/styled/file-list/StyledFileIcon.js +24 -4
- package/dist/esm/styled/file-list/StyledFileList.js +1 -1
- package/dist/esm/styled/file-list/StyledFileListItem.js +1 -1
- package/dist/esm/styled/file-upload/StyledFileUpload.js +89 -20
- package/dist/esm/styled/input-group/StyledInputGroup.js +1 -1
- package/dist/esm/styled/radio/StyledRadioHint.js +1 -1
- package/dist/esm/styled/radio/StyledRadioInput.js +85 -24
- package/dist/esm/styled/radio/StyledRadioLabel.js +1 -1
- package/dist/esm/styled/radio/StyledRadioMessage.js +1 -1
- package/dist/esm/styled/radio/StyledRadioSvg.js +1 -1
- package/dist/esm/styled/range/StyledRangeInput.js +83 -26
- package/dist/esm/styled/select/StyledSelect.js +35 -11
- package/dist/esm/styled/select/StyledSelectWrapper.js +11 -3
- package/dist/esm/styled/text/StyledTextFauxInput.js +31 -23
- package/dist/esm/styled/text/StyledTextInput.js +103 -58
- package/dist/esm/styled/text/StyledTextMediaFigure.js +35 -10
- package/dist/esm/styled/text/StyledTextMediaInput.js +1 -1
- package/dist/esm/styled/text/StyledTextarea.js +1 -1
- package/dist/esm/styled/tiles/StyledTile.js +93 -34
- package/dist/esm/styled/tiles/StyledTileDescription.js +13 -13
- package/dist/esm/styled/tiles/StyledTileIcon.js +52 -13
- package/dist/esm/styled/tiles/StyledTileInput.js +1 -1
- package/dist/esm/styled/tiles/StyledTileLabel.js +13 -15
- package/dist/esm/styled/toggle/StyledToggleHint.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleInput.js +38 -13
- package/dist/esm/styled/toggle/StyledToggleLabel.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleMessage.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleSvg.js +1 -1
- package/dist/index.cjs.js +892 -377
- package/dist/typings/elements/faux-input/components/EndIcon.d.ts +1 -1
- package/dist/typings/elements/faux-input/components/StartIcon.d.ts +1 -1
- package/dist/typings/styled/file-list/StyledFileIcon.d.ts +7 -1
- package/dist/typings/styled/select/StyledSelect.d.ts +0 -3
- package/dist/typings/styled/select/StyledSelectWrapper.d.ts +3 -1
- package/dist/typings/styled/text/StyledTextFauxInput.d.ts +0 -4
- package/dist/typings/styled/tiles/StyledTile.d.ts +4 -7
- package/dist/typings/types/index.d.ts +3 -3
- package/package.json +4 -3
|
@@ -4,19 +4,27 @@
|
|
|
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';
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
8
|
import { SELECTOR_FOCUS_VISIBLE, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledTextFauxInput } from '../text/StyledTextFauxInput.js';
|
|
10
10
|
import { StyledSelect } from './StyledSelect.js';
|
|
11
11
|
|
|
12
12
|
const COMPONENT_ID = 'forms.select_wrapper';
|
|
13
|
+
const sizeStyles = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
theme,
|
|
16
|
+
isCompact
|
|
17
|
+
} = _ref;
|
|
18
|
+
const height = `${theme.space.base * (isCompact ? 8 : 10)}px`;
|
|
19
|
+
return css(["max-height:", ";"], height);
|
|
20
|
+
};
|
|
13
21
|
const StyledSelectWrapper = styled(StyledTextFauxInput).attrs({
|
|
14
22
|
'data-garden-id': COMPONENT_ID,
|
|
15
|
-
'data-garden-version': '9.0.0-next.
|
|
23
|
+
'data-garden-version': '9.0.0-next.14'
|
|
16
24
|
}).withConfig({
|
|
17
25
|
displayName: "StyledSelectWrapper",
|
|
18
26
|
componentId: "sc-i7b6hw-0"
|
|
19
|
-
})(["position:relative;padding:0;overflow:visible;& > ", "{border-color:transparent;background-color:transparent;", "{box-shadow:unset;}}"], StyledSelect, SELECTOR_FOCUS_VISIBLE);
|
|
27
|
+
})(["position:relative;padding:0;overflow:visible;", ";& > ", "{border-color:transparent;background-color:transparent;", "{box-shadow:unset;}}"], sizeStyles, StyledSelect, SELECTOR_FOCUS_VISIBLE);
|
|
20
28
|
StyledSelectWrapper.defaultProps = {
|
|
21
29
|
theme: DEFAULT_THEME
|
|
22
30
|
};
|
|
@@ -5,43 +5,51 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
|
-
import { SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles, DEFAULT_THEME,
|
|
8
|
+
import { SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledTextInput } from './StyledTextInput.js';
|
|
10
10
|
import { StyledTextMediaFigure } from './StyledTextMediaFigure.js';
|
|
11
11
|
|
|
12
12
|
const COMPONENT_ID = 'forms.faux_input';
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
warning: 'warningHue',
|
|
16
|
-
error: 'dangerHue'
|
|
17
|
-
};
|
|
18
|
-
function getValidationHue(validation) {
|
|
19
|
-
let defaultHue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'primaryHue';
|
|
20
|
-
if (validation) {
|
|
21
|
-
return VALIDATION_HUES[validation];
|
|
22
|
-
}
|
|
23
|
-
return defaultHue;
|
|
24
|
-
}
|
|
25
|
-
const colorStyles = props => {
|
|
26
|
-
const {
|
|
13
|
+
const colorStyles = _ref => {
|
|
14
|
+
let {
|
|
27
15
|
theme,
|
|
28
16
|
validation,
|
|
29
17
|
focusInset,
|
|
30
18
|
isBare,
|
|
31
19
|
isFocused
|
|
32
|
-
} =
|
|
20
|
+
} = _ref;
|
|
21
|
+
let borderVariable;
|
|
22
|
+
let focusBorderColor;
|
|
23
|
+
if (validation) {
|
|
24
|
+
if (validation === 'success') {
|
|
25
|
+
borderVariable = 'border.successEmphasis';
|
|
26
|
+
} else if (validation === 'warning') {
|
|
27
|
+
borderVariable = 'border.warningEmphasis';
|
|
28
|
+
} else if (validation === 'error') {
|
|
29
|
+
borderVariable = 'border.dangerEmphasis';
|
|
30
|
+
}
|
|
31
|
+
focusBorderColor = getColor({
|
|
32
|
+
theme,
|
|
33
|
+
variable: borderVariable
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
36
|
+
borderVariable = 'border.primaryEmphasis';
|
|
37
|
+
focusBorderColor = getColor({
|
|
38
|
+
theme,
|
|
39
|
+
variable: borderVariable
|
|
40
|
+
});
|
|
41
|
+
}
|
|
33
42
|
return css(["", ""], focusStyles({
|
|
34
43
|
theme,
|
|
35
44
|
inset: focusInset,
|
|
36
|
-
condition: !isBare,
|
|
37
45
|
color: {
|
|
38
|
-
|
|
39
|
-
shade: validation === 'warning' ? 700 : 600
|
|
46
|
+
variable: borderVariable
|
|
40
47
|
},
|
|
41
48
|
selector: isFocused ? '&' : '&:focus-within',
|
|
42
49
|
styles: {
|
|
43
|
-
borderColor:
|
|
44
|
-
}
|
|
50
|
+
borderColor: focusBorderColor
|
|
51
|
+
},
|
|
52
|
+
condition: !isBare
|
|
45
53
|
}));
|
|
46
54
|
};
|
|
47
55
|
const StyledTextFauxInput = styled(StyledTextInput).attrs(props => ({
|
|
@@ -49,7 +57,7 @@ const StyledTextFauxInput = styled(StyledTextInput).attrs(props => ({
|
|
|
49
57
|
'aria-readonly': props.isReadOnly,
|
|
50
58
|
'aria-disabled': props.isDisabled,
|
|
51
59
|
'data-garden-id': COMPONENT_ID,
|
|
52
|
-
'data-garden-version': '9.0.0-next.
|
|
60
|
+
'data-garden-version': '9.0.0-next.14'
|
|
53
61
|
})).withConfig({
|
|
54
62
|
displayName: "StyledTextFauxInput",
|
|
55
63
|
componentId: "sc-yqw7j9-0"
|
|
@@ -58,4 +66,4 @@ StyledTextFauxInput.defaultProps = {
|
|
|
58
66
|
theme: DEFAULT_THEME
|
|
59
67
|
};
|
|
60
68
|
|
|
61
|
-
export { StyledTextFauxInput
|
|
69
|
+
export { StyledTextFauxInput };
|
|
@@ -4,9 +4,12 @@
|
|
|
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 React__default from 'react';
|
|
8
|
+
import { renderToString } from 'react-dom/server';
|
|
7
9
|
import styled, { css } from 'styled-components';
|
|
8
10
|
import { math, em } from 'polished';
|
|
9
|
-
import { retrieveComponentStyles, DEFAULT_THEME,
|
|
11
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
|
|
12
|
+
import SvgChevronDownStroke from '../../node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js';
|
|
10
13
|
import { StyledHint } from '../common/StyledHint.js';
|
|
11
14
|
import { StyledLabel } from '../common/StyledLabel.js';
|
|
12
15
|
import { StyledMessage } from '../common/StyledMessage.js';
|
|
@@ -15,91 +18,133 @@ const COMPONENT_ID = 'forms.input';
|
|
|
15
18
|
const isInvalid = validation => {
|
|
16
19
|
return validation === 'warning' || validation === 'error';
|
|
17
20
|
};
|
|
18
|
-
const colorStyles =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const colorStyles = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
theme,
|
|
24
|
+
isBare,
|
|
25
|
+
isHovered,
|
|
26
|
+
focusInset,
|
|
27
|
+
validation
|
|
28
|
+
} = _ref;
|
|
29
|
+
const foregroundColor = getColor({
|
|
30
|
+
theme,
|
|
31
|
+
variable: 'foreground.default'
|
|
32
|
+
});
|
|
33
|
+
const backgroundColor = isBare ? 'transparent' : getColor({
|
|
34
|
+
theme,
|
|
35
|
+
variable: 'background.default'
|
|
36
|
+
});
|
|
22
37
|
let borderColor;
|
|
23
38
|
let hoverBorderColor;
|
|
39
|
+
let borderVariable;
|
|
24
40
|
let focusBorderColor;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
hue = 'warningHue';
|
|
33
|
-
focusRingShade = 700;
|
|
34
|
-
} else if (props.validation === 'error') {
|
|
35
|
-
hue = 'dangerHue';
|
|
41
|
+
if (validation) {
|
|
42
|
+
if (validation === 'success') {
|
|
43
|
+
borderVariable = 'border.successEmphasis';
|
|
44
|
+
} else if (validation === 'warning') {
|
|
45
|
+
borderVariable = 'border.warningEmphasis';
|
|
46
|
+
} else if (validation === 'error') {
|
|
47
|
+
borderVariable = 'border.dangerEmphasis';
|
|
36
48
|
}
|
|
37
|
-
borderColor =
|
|
49
|
+
borderColor = getColor({
|
|
50
|
+
theme,
|
|
51
|
+
variable: borderVariable
|
|
52
|
+
});
|
|
38
53
|
hoverBorderColor = borderColor;
|
|
39
54
|
focusBorderColor = borderColor;
|
|
40
|
-
focusRingHue = hue;
|
|
41
55
|
} else {
|
|
42
|
-
borderColor =
|
|
43
|
-
|
|
56
|
+
borderColor = getColor({
|
|
57
|
+
theme,
|
|
58
|
+
variable: 'border.default',
|
|
59
|
+
dark: {
|
|
60
|
+
offset: -100
|
|
61
|
+
},
|
|
62
|
+
light: {
|
|
63
|
+
offset: 100
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
borderVariable = 'border.primaryEmphasis';
|
|
67
|
+
hoverBorderColor = getColor({
|
|
68
|
+
theme,
|
|
69
|
+
variable: borderVariable
|
|
70
|
+
});
|
|
44
71
|
focusBorderColor = hoverBorderColor;
|
|
45
72
|
}
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
73
|
+
const disabledBackgroundColor = isBare ? undefined : getColor({
|
|
74
|
+
theme,
|
|
75
|
+
variable: 'background.disabled'
|
|
76
|
+
});
|
|
77
|
+
const disabledBorderColor = getColor({
|
|
78
|
+
theme,
|
|
79
|
+
variable: 'border.disabled'
|
|
80
|
+
});
|
|
81
|
+
const disabledForegroundColor = getColor({
|
|
82
|
+
theme,
|
|
83
|
+
variable: 'foreground.disabled'
|
|
84
|
+
});
|
|
85
|
+
const placeholderColor = disabledForegroundColor;
|
|
86
|
+
const readOnlyBackgroundColor = disabledBackgroundColor;
|
|
87
|
+
const calendarPickerColor = getColor({
|
|
88
|
+
theme,
|
|
89
|
+
variable: 'foreground.subtle'
|
|
90
|
+
});
|
|
91
|
+
const calendarPickerIcon = renderToString( React__default.createElement(SvgChevronDownStroke, {
|
|
92
|
+
color: calendarPickerColor
|
|
93
|
+
}));
|
|
94
|
+
const calendarPickerBackgroundImage = `url("data:image/svg+xml,${encodeURIComponent(calendarPickerIcon)}")`;
|
|
95
|
+
return css(["border-color:", ";background-color:", ";color:", ";&::placeholder{opacity:1;color:", ";}&::-webkit-datetime-edit{color:", ";}&::-webkit-calendar-picker-indicator{background-image:", ";}&[readonly],&[aria-readonly='true']{background-color:", ";}&:hover{border-color:", ";}", " &::-webkit-calendar-picker-indicator:focus-visible{", "}&:disabled,&[aria-disabled='true']{border-color:", ";background-color:", ";color:", ";}"], isHovered ? hoverBorderColor : borderColor, backgroundColor, foregroundColor, placeholderColor, placeholderColor, calendarPickerBackgroundImage, readOnlyBackgroundColor, hoverBorderColor, focusStyles({
|
|
96
|
+
theme,
|
|
97
|
+
inset: focusInset,
|
|
62
98
|
color: {
|
|
63
|
-
|
|
64
|
-
shade: focusRingShade
|
|
99
|
+
variable: borderVariable
|
|
65
100
|
},
|
|
66
101
|
styles: {
|
|
67
102
|
borderColor: focusBorderColor
|
|
68
|
-
}
|
|
69
|
-
|
|
103
|
+
},
|
|
104
|
+
condition: !isBare
|
|
105
|
+
}), focusStyles({
|
|
106
|
+
theme
|
|
107
|
+
}), disabledBorderColor, disabledBackgroundColor, disabledForegroundColor);
|
|
70
108
|
};
|
|
71
|
-
const sizeStyles =
|
|
72
|
-
|
|
73
|
-
|
|
109
|
+
const sizeStyles = _ref2 => {
|
|
110
|
+
let {
|
|
111
|
+
theme,
|
|
112
|
+
isBare,
|
|
113
|
+
isCompact
|
|
114
|
+
} = _ref2;
|
|
115
|
+
const fontSize = theme.fontSizes.md;
|
|
116
|
+
const paddingHorizontal = `${theme.space.base * 3}px`;
|
|
74
117
|
let height;
|
|
75
118
|
let paddingVertical;
|
|
76
119
|
let browseFontSize;
|
|
77
120
|
let swatchHeight;
|
|
78
|
-
if (
|
|
79
|
-
height = `${
|
|
80
|
-
paddingVertical = `${
|
|
81
|
-
browseFontSize = math(`${
|
|
82
|
-
swatchHeight = `${
|
|
121
|
+
if (isCompact) {
|
|
122
|
+
height = `${theme.space.base * 8}px`;
|
|
123
|
+
paddingVertical = `${theme.space.base * 1.5}px`;
|
|
124
|
+
browseFontSize = math(`${theme.fontSizes.sm} - 1`);
|
|
125
|
+
swatchHeight = `${theme.space.base * 6}px`;
|
|
83
126
|
} else {
|
|
84
|
-
height = `${
|
|
85
|
-
paddingVertical = `${
|
|
86
|
-
browseFontSize =
|
|
87
|
-
swatchHeight = `${
|
|
127
|
+
height = `${theme.space.base * 10}px`;
|
|
128
|
+
paddingVertical = `${theme.space.base * 2.5}px`;
|
|
129
|
+
browseFontSize = theme.fontSizes.sm;
|
|
130
|
+
swatchHeight = `${theme.space.base * 7}px`;
|
|
88
131
|
}
|
|
89
|
-
const lineHeight = math(`${height} - (${paddingVertical} * 2) - (${
|
|
90
|
-
const padding =
|
|
132
|
+
const lineHeight = math(`${height} - (${paddingVertical} * 2) - (${theme.borderWidths.sm} * 2)`);
|
|
133
|
+
const padding = isBare ? '0' : `${em(paddingVertical, fontSize)} ${em(paddingHorizontal, fontSize)}`;
|
|
91
134
|
const swatchMarginVertical = math(`(${lineHeight} - ${swatchHeight}) / 2`);
|
|
92
135
|
const swatchMarginHorizontal = math(`${paddingVertical} + ${swatchMarginVertical} - ${paddingHorizontal}`);
|
|
93
|
-
|
|
136
|
+
const calendarPickerSize = `${theme.space.base * 5}px`;
|
|
137
|
+
const calendarPickerBackgroundSize = theme.iconSizes.md;
|
|
138
|
+
return css(["padding:", ";min-height:", ";line-height:", ";font-size:", ";&::-ms-browse{font-size:", ";}&[type='date'],&[type='datetime-local'],&[type='file'],&[type='month'],&[type='time'],&[type='week']{max-height:", ";}&[type='file']{line-height:1;}@supports (-ms-ime-align:auto){&[type='color']{padding:", ";}}&::-moz-color-swatch{margin-top:", ";margin-left:", ";width:calc(100% + ", ");height:", ";}&::-webkit-calendar-picker-indicator{background-position:center;background-size:", ";padding:0;width:", ";height:", ";}&::-webkit-color-swatch{margin:", " ", ";}", ":not([hidden]) + &&,", " + &&,", " + &&,&& + ", ",&& ~ ", "{margin-top:", "px;}"], padding, isBare ? '1em' : height, getLineHeight(lineHeight, fontSize), fontSize, browseFontSize, height, isCompact ? '0 2px' : '1px 3px', swatchMarginVertical, swatchMarginHorizontal, math(`${swatchMarginHorizontal} * -2`), swatchHeight, calendarPickerBackgroundSize, calendarPickerSize, calendarPickerSize, swatchMarginVertical, swatchMarginHorizontal, StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, theme.space.base * (isCompact ? 1 : 2));
|
|
94
139
|
};
|
|
95
140
|
const StyledTextInput = styled.input.attrs(props => ({
|
|
96
141
|
'data-garden-id': COMPONENT_ID,
|
|
97
|
-
'data-garden-version': '9.0.0-next.
|
|
142
|
+
'data-garden-version': '9.0.0-next.14',
|
|
98
143
|
'aria-invalid': isInvalid(props.validation)
|
|
99
144
|
})).withConfig({
|
|
100
145
|
displayName: "StyledTextInput",
|
|
101
|
-
componentId: "sc-
|
|
102
|
-
})(["appearance:none;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,z-index 0.25s ease-in-out;direction:", ";border:", ";border-radius:", ";width:100%;box-sizing:border-box;vertical-align:middle;font-family:inherit;&::-ms-browse{border-radius:", ";}&::-ms-clear,&::-ms-reveal{display:none;}&::-moz-color-swatch{border:none;border-radius:", ";}&::-webkit-color-swatch{border:none;border-radius:", ";}&::-webkit-color-swatch-wrapper{padding:0;}&::-webkit-clear-button,&::-webkit-inner-spin-button,&::-webkit-search-cancel-button,&::-webkit-search-results-button{display:none;}&::-webkit-datetime-edit{direction:", ";line-height:1;}
|
|
146
|
+
componentId: "sc-1r6733h-0"
|
|
147
|
+
})(["appearance:none;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,z-index 0.25s ease-in-out;direction:", ";border:", ";border-radius:", ";width:100%;box-sizing:border-box;vertical-align:middle;font-family:inherit;&::-ms-browse{border-radius:", ";}&::-ms-clear,&::-ms-reveal{display:none;}&::-moz-color-swatch{border:none;border-radius:", ";}&::-webkit-color-swatch{border:none;border-radius:", ";}&::-webkit-color-swatch-wrapper{padding:0;}&::-webkit-clear-button,&::-webkit-inner-spin-button,&::-webkit-search-cancel-button,&::-webkit-search-results-button{display:none;}&::-webkit-datetime-edit{direction:", ";line-height:1;}&::-webkit-calendar-picker-indicator{border-radius:100%;}&:invalid{box-shadow:none;}&[type='file']::-ms-value{display:none;}@media screen and (min--moz-device-pixel-ratio:0){&[type='number']{appearance:textfield;}}", ";", ";&:disabled{cursor:default;}", ";"], props => props.theme.rtl && 'rtl', props => props.isBare ? 'none' : props.theme.borders.sm, props => props.isBare ? '0' : props.theme.borderRadii.md, props => props.theme.borderRadii.sm, props => props.theme.borderRadii.sm, props => props.theme.borderRadii.sm, props => props.theme.rtl && 'rtl', sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
103
148
|
StyledTextInput.defaultProps = {
|
|
104
149
|
theme: DEFAULT_THEME
|
|
105
150
|
};
|
|
@@ -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
|
};
|