@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
|
@@ -12,7 +12,7 @@ import { StyledMessage } from '../common/StyledMessage.js';
|
|
|
12
12
|
const COMPONENT_ID = 'forms.radio_message';
|
|
13
13
|
const StyledRadioMessage = styled(StyledMessage).attrs({
|
|
14
14
|
'data-garden-id': COMPONENT_ID,
|
|
15
|
-
'data-garden-version': '9.0.0-next.
|
|
15
|
+
'data-garden-version': '9.0.0-next.14'
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledRadioMessage",
|
|
18
18
|
componentId: "sc-1pmi0q8-0"
|
|
@@ -13,7 +13,7 @@ import { StyledRadioLabel } from './StyledRadioLabel.js';
|
|
|
13
13
|
const COMPONENT_ID = 'forms.radio_svg';
|
|
14
14
|
const StyledRadioSvg = styled(SvgCircleSmFill).attrs({
|
|
15
15
|
'data-garden-id': COMPONENT_ID,
|
|
16
|
-
'data-garden-version': '9.0.0-next.
|
|
16
|
+
'data-garden-version': '9.0.0-next.14'
|
|
17
17
|
}).withConfig({
|
|
18
18
|
displayName: "StyledRadioSvg",
|
|
19
19
|
componentId: "sc-1r1qtr1-0"
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import { retrieveComponentStyles, DEFAULT_THEME,
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor, getFocusBoxShadow } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledHint } from '../common/StyledHint.js';
|
|
11
11
|
import { StyledLabel } from '../common/StyledLabel.js';
|
|
12
12
|
import { StyledMessage } from '../common/StyledMessage.js';
|
|
@@ -56,28 +56,81 @@ const trackLowerStyles = function (styles) {
|
|
|
56
56
|
}
|
|
57
57
|
`;
|
|
58
58
|
};
|
|
59
|
-
const colorStyles =
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const colorStyles = _ref => {
|
|
60
|
+
let {
|
|
61
|
+
theme,
|
|
62
|
+
hasLowerTrack
|
|
63
|
+
} = _ref;
|
|
64
|
+
const options = {
|
|
65
|
+
theme,
|
|
66
|
+
variable: 'background.primaryEmphasis'
|
|
67
|
+
};
|
|
68
|
+
const thumbBackgroundColor = getColor(options);
|
|
62
69
|
const thumbBorderColor = thumbBackgroundColor;
|
|
63
|
-
const thumbBoxShadow =
|
|
70
|
+
const thumbBoxShadow = theme.shadows.lg(`${theme.space.base}px`, `${theme.space.base * 2}px`, getColor({
|
|
71
|
+
theme,
|
|
72
|
+
hue: 'neutralHue',
|
|
73
|
+
shade: 1200,
|
|
74
|
+
dark: {
|
|
75
|
+
transparency: theme.opacity[1100]
|
|
76
|
+
},
|
|
77
|
+
light: {
|
|
78
|
+
transparency: theme.opacity[200]
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
64
81
|
const thumbFocusBoxShadow = getFocusBoxShadow({
|
|
65
|
-
theme
|
|
82
|
+
theme
|
|
83
|
+
});
|
|
84
|
+
const thumbActiveBackgroundColor = getColor({
|
|
85
|
+
...options,
|
|
86
|
+
dark: {
|
|
87
|
+
offset: -200
|
|
88
|
+
},
|
|
89
|
+
light: {
|
|
90
|
+
offset: 200
|
|
91
|
+
}
|
|
66
92
|
});
|
|
67
|
-
const thumbActiveBackgroundColor = getColorV8('primaryHue', SHADE + 100, props.theme);
|
|
68
93
|
const thumbActiveBorderColor = thumbBorderColor;
|
|
69
|
-
const thumbDisabledBackgroundColor =
|
|
94
|
+
const thumbDisabledBackgroundColor = getColor({
|
|
95
|
+
theme,
|
|
96
|
+
variable: 'border.emphasis'
|
|
97
|
+
});
|
|
70
98
|
const thumbDisabledBorderColor = thumbDisabledBackgroundColor;
|
|
71
|
-
const thumbHoverBackgroundColor =
|
|
99
|
+
const thumbHoverBackgroundColor = getColor({
|
|
100
|
+
...options,
|
|
101
|
+
dark: {
|
|
102
|
+
offset: -100
|
|
103
|
+
},
|
|
104
|
+
light: {
|
|
105
|
+
offset: 100
|
|
106
|
+
}
|
|
107
|
+
});
|
|
72
108
|
const thumbHoverBorderColor = thumbHoverBackgroundColor;
|
|
73
|
-
const trackBackgroundColor =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
109
|
+
const trackBackgroundColor = getColor({
|
|
110
|
+
theme,
|
|
111
|
+
variable: 'border.emphasis',
|
|
112
|
+
dark: {
|
|
113
|
+
offset: 100
|
|
114
|
+
},
|
|
115
|
+
light: {
|
|
116
|
+
offset: -200
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const trackLowerBackgroundColor = hasLowerTrack ? thumbBackgroundColor : '';
|
|
120
|
+
const trackBackgroundImage = hasLowerTrack ? `linear-gradient(${trackLowerBackgroundColor}, ${trackLowerBackgroundColor})` : '';
|
|
121
|
+
const trackDisabledBackgroundColor = getColor({
|
|
122
|
+
theme,
|
|
123
|
+
variable: 'background.disabled',
|
|
124
|
+
transparency: theme.opacity[200]
|
|
125
|
+
});
|
|
126
|
+
const trackDisabledLowerBackgroundColor = hasLowerTrack ? getColor({
|
|
127
|
+
theme,
|
|
128
|
+
variable: 'border.emphasis'
|
|
129
|
+
}) : '';
|
|
130
|
+
const trackDisabledBackgroundImage = hasLowerTrack ? `linear-gradient(${trackDisabledLowerBackgroundColor}, ${trackDisabledLowerBackgroundColor})` : '';
|
|
78
131
|
return css(["", " ", " ", " ", " ", " ", " ", " ", " ", ""], trackStyles(`
|
|
79
132
|
background-color: ${trackBackgroundColor};
|
|
80
|
-
background-image: ${trackBackgroundImage}; /*
|
|
133
|
+
background-image: ${trackBackgroundImage}; /* [1] */
|
|
81
134
|
`), thumbStyles(`
|
|
82
135
|
border-color: ${thumbBorderColor};
|
|
83
136
|
box-shadow: ${thumbBoxShadow};
|
|
@@ -96,6 +149,7 @@ const colorStyles = props => {
|
|
|
96
149
|
border-color: ${thumbActiveBorderColor};
|
|
97
150
|
background-color: ${thumbActiveBackgroundColor};
|
|
98
151
|
`, ':active'), trackStyles(`
|
|
152
|
+
background-color: ${trackDisabledBackgroundColor};
|
|
99
153
|
background-image: ${trackDisabledBackgroundImage};
|
|
100
154
|
`, ':disabled'), thumbStyles(`
|
|
101
155
|
border-color: ${thumbDisabledBorderColor};
|
|
@@ -105,29 +159,32 @@ const colorStyles = props => {
|
|
|
105
159
|
background-color: ${trackDisabledLowerBackgroundColor};
|
|
106
160
|
`, ':disabled'));
|
|
107
161
|
};
|
|
108
|
-
const sizeStyles =
|
|
109
|
-
|
|
110
|
-
|
|
162
|
+
const sizeStyles = _ref2 => {
|
|
163
|
+
let {
|
|
164
|
+
theme
|
|
165
|
+
} = _ref2;
|
|
166
|
+
const thumbSize = `${theme.space.base * 5}px`;
|
|
167
|
+
const trackHeight = `${theme.space.base * 1.5}px`;
|
|
111
168
|
const trackBorderRadius = trackHeight;
|
|
112
|
-
const trackMargin = math(`(${thumbSize} - ${trackHeight}) / 2 + ${
|
|
169
|
+
const trackMargin = math(`(${thumbSize} - ${trackHeight}) / 2 + ${theme.shadowWidths.md}`);
|
|
113
170
|
const thumbMargin = math(`(${trackHeight} - ${thumbSize}) / 2`);
|
|
114
|
-
return css(["", ":not([hidden]) + &,", " + &,", " + &,& + ", ",& + ", "{margin-top:", ";}", ";", " ", ""], StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage,
|
|
171
|
+
return css(["", ":not([hidden]) + &,", " + &,", " + &,& + ", ",& + ", "{margin-top:", ";}", ";", " ", ""], StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, `${theme.space.base * 2}px`, trackStyles(`
|
|
115
172
|
margin: ${trackMargin} 0;
|
|
116
173
|
border-radius: ${trackBorderRadius};
|
|
117
174
|
height: ${trackHeight};
|
|
118
175
|
`), thumbStyles(`
|
|
119
|
-
margin: ${thumbMargin} 0; /*
|
|
176
|
+
margin: ${thumbMargin} 0; /* [1] */
|
|
120
177
|
width: ${thumbSize};
|
|
121
178
|
height: ${thumbSize};
|
|
122
179
|
`), trackLowerStyles(`
|
|
123
|
-
border-top-${
|
|
124
|
-
border-bottom-${
|
|
180
|
+
border-top-${theme.rtl ? 'right' : 'left'}-radius: ${trackBorderRadius};
|
|
181
|
+
border-bottom-${theme.rtl ? 'right' : 'left'}-radius: ${trackBorderRadius};
|
|
125
182
|
height: ${trackHeight};
|
|
126
183
|
`));
|
|
127
184
|
};
|
|
128
185
|
const StyledRangeInput = styled.input.attrs(props => ({
|
|
129
186
|
'data-garden-id': COMPONENT_ID,
|
|
130
|
-
'data-garden-version': '9.0.0-next.
|
|
187
|
+
'data-garden-version': '9.0.0-next.14',
|
|
131
188
|
type: 'range',
|
|
132
189
|
style: {
|
|
133
190
|
backgroundSize: props.hasLowerTrack && props.backgroundSize
|
|
@@ -144,13 +201,13 @@ const StyledRangeInput = styled.input.attrs(props => ({
|
|
|
144
201
|
width: 99.8%; /* fix for IE which cuts off the upper track's border radius */
|
|
145
202
|
color: transparent; /* reset for IE */
|
|
146
203
|
box-sizing: border-box; /* reset for IE */
|
|
147
|
-
`),
|
|
204
|
+
`), sizeStyles, props => thumbStyles(`
|
|
148
205
|
appearance: none;
|
|
149
206
|
transition: box-shadow .1s ease-in-out;
|
|
150
207
|
border: ${props.theme.borders.md};
|
|
151
208
|
border-radius: 100%;
|
|
152
209
|
box-sizing: border-box;
|
|
153
|
-
`),
|
|
210
|
+
`), colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
154
211
|
StyledRangeInput.defaultProps = {
|
|
155
212
|
backgroundSize: '0%',
|
|
156
213
|
hasLowerTrack: true,
|
|
@@ -6,29 +6,53 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import {
|
|
9
|
+
import { getColor, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
10
|
import { StyledTextInput } from '../text/StyledTextInput.js';
|
|
11
11
|
import { StyledTextMediaFigure } from '../text/StyledTextMediaFigure.js';
|
|
12
12
|
|
|
13
13
|
const COMPONENT_ID = 'forms.select';
|
|
14
|
-
const colorStyles =
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const colorStyles = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
theme
|
|
17
|
+
} = _ref;
|
|
18
|
+
const color = getColor({
|
|
19
|
+
theme,
|
|
20
|
+
variable: 'foreground.subtle',
|
|
21
|
+
dark: {
|
|
22
|
+
offset: -100
|
|
23
|
+
},
|
|
24
|
+
light: {
|
|
25
|
+
offset: 100
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const disabledColor = getColor({
|
|
29
|
+
theme,
|
|
30
|
+
variable: 'foreground.disabled'
|
|
31
|
+
});
|
|
32
|
+
return css(["&:hover + ", ",&:focus + ", ",&:focus-visible + ", "{color:", ";}&:disabled + ", "{color:", ";}"], StyledTextMediaFigure, StyledTextMediaFigure, StyledTextMediaFigure, color, StyledTextMediaFigure, disabledColor);
|
|
17
33
|
};
|
|
18
|
-
const sizeStyles =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
const sizeStyles = _ref2 => {
|
|
35
|
+
let {
|
|
36
|
+
theme,
|
|
37
|
+
isBare,
|
|
38
|
+
isCompact
|
|
39
|
+
} = _ref2;
|
|
40
|
+
const padding = isBare ? undefined : math(`${theme.iconSizes.md} + ${theme.space.base * 5}`);
|
|
41
|
+
const iconVerticalPosition = `${theme.space.base * (isCompact ? 1.5 : 2.5) + 1}px`;
|
|
42
|
+
const iconHorizontalPosition = `${theme.space.base * 3}px`;
|
|
43
|
+
return css(["padding-", ":", ";& + ", "{top:", ";", ":", ";}"], theme.rtl ? 'left' : 'right', padding, StyledTextMediaFigure, iconVerticalPosition, theme.rtl ? 'left' : 'right', iconHorizontalPosition);
|
|
23
44
|
};
|
|
24
45
|
const StyledSelect = styled(StyledTextInput).attrs({
|
|
25
46
|
'data-garden-id': COMPONENT_ID,
|
|
26
|
-
'data-garden-version': '9.0.0-next.
|
|
47
|
+
'data-garden-version': '9.0.0-next.14',
|
|
27
48
|
as: 'select'
|
|
28
49
|
}).withConfig({
|
|
29
50
|
displayName: "StyledSelect",
|
|
30
51
|
componentId: "sc-8xdxpt-0"
|
|
31
|
-
})(["cursor:pointer;text-overflow:ellipsis;", ";", ";&::-ms-expand{display:none;}&::-ms-value{background-color:transparent;color:inherit;}&:-moz-focusring{transition:none;text-shadow:0 0 0 ", ";color:transparent;}& + ", "{position:absolute;pointer-events:none;}"],
|
|
52
|
+
})(["cursor:pointer;text-overflow:ellipsis;", ";", ";&::-ms-expand{display:none;}&::-ms-value{background-color:transparent;color:inherit;}&:-moz-focusring{transition:none;text-shadow:0 0 0 ", ";color:transparent;}& + ", "{position:absolute;pointer-events:none;}"], sizeStyles, colorStyles, props => getColor({
|
|
53
|
+
theme: props.theme,
|
|
54
|
+
variable: 'foreground.default'
|
|
55
|
+
}), StyledTextMediaFigure);
|
|
32
56
|
StyledSelect.defaultProps = {
|
|
33
57
|
theme: DEFAULT_THEME
|
|
34
58
|
};
|
|
@@ -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
|
};
|