@zendeskgarden/react-forms 9.0.0-next.8 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/elements/MediaInput.js +2 -2
- package/dist/esm/elements/Select.js +1 -0
- package/dist/esm/elements/Textarea.js +1 -1
- package/dist/esm/elements/common/Hint.js +1 -1
- package/dist/esm/elements/common/Label.js +2 -2
- package/dist/esm/elements/common/Message.js +2 -2
- package/dist/esm/elements/faux-input/components/EndIcon.js +16 -3
- package/dist/esm/elements/faux-input/components/StartIcon.js +16 -3
- package/dist/esm/elements/file-list/components/File.js +3 -2
- package/dist/esm/elements/tiles/components/Description.js +1 -1
- package/dist/esm/elements/tiles/components/Icon.js +1 -1
- package/dist/esm/elements/tiles/components/Label.js +1 -1
- package/dist/esm/elements/tiles/components/Tile.js +1 -3
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-circle-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-sm-fill.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/circle-sm-fill.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/dash-fill.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-document-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-error-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-generic-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-image-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-pdf-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-presentation-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-spreadsheet-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-zip-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/trash-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/circle-sm-fill.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-document-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-error-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-generic-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-image-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-pdf-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-presentation-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-spreadsheet-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-zip-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/trash-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckHint.js +2 -5
- package/dist/esm/styled/checkbox/StyledCheckInput.js +55 -14
- package/dist/esm/styled/checkbox/StyledCheckLabel.js +2 -5
- package/dist/esm/styled/checkbox/StyledCheckMessage.js +2 -5
- package/dist/esm/styled/checkbox/StyledCheckSvg.js +2 -5
- package/dist/esm/styled/checkbox/StyledDashSvg.js +2 -5
- package/dist/esm/styled/common/StyledField.js +2 -5
- package/dist/esm/styled/common/StyledFieldset.js +2 -5
- package/dist/esm/styled/common/StyledHint.js +6 -6
- package/dist/esm/styled/common/StyledLabel.js +6 -6
- package/dist/esm/styled/common/StyledLegend.js +2 -5
- package/dist/esm/styled/common/StyledMessage.js +33 -19
- package/dist/esm/styled/common/StyledMessageIcon.js +4 -6
- package/dist/esm/styled/file-list/StyledFile.js +49 -31
- package/dist/esm/styled/file-list/StyledFileClose.js +6 -6
- package/dist/esm/styled/file-list/StyledFileDelete.js +6 -6
- package/dist/esm/styled/file-list/StyledFileIcon.js +22 -14
- package/dist/esm/styled/file-list/StyledFileList.js +2 -5
- package/dist/esm/styled/file-list/StyledFileListItem.js +2 -5
- package/dist/esm/styled/file-upload/StyledFileUpload.js +89 -23
- package/dist/esm/styled/input-group/StyledInputGroup.js +2 -5
- package/dist/esm/styled/radio/StyledRadioHint.js +2 -5
- package/dist/esm/styled/radio/StyledRadioInput.js +85 -27
- package/dist/esm/styled/radio/StyledRadioLabel.js +2 -5
- package/dist/esm/styled/radio/StyledRadioMessage.js +2 -5
- package/dist/esm/styled/radio/StyledRadioSvg.js +2 -5
- package/dist/esm/styled/range/StyledRangeInput.js +76 -26
- package/dist/esm/styled/select/StyledSelect.js +35 -14
- package/dist/esm/styled/select/StyledSelectWrapper.js +12 -7
- package/dist/esm/styled/text/StyledTextFauxInput.js +31 -26
- package/dist/esm/styled/text/StyledTextInput.js +103 -61
- package/dist/esm/styled/text/StyledTextMediaFigure.js +37 -29
- package/dist/esm/styled/text/StyledTextMediaInput.js +2 -5
- package/dist/esm/styled/text/StyledTextarea.js +2 -5
- package/dist/esm/styled/tiles/StyledTile.js +93 -37
- package/dist/esm/styled/tiles/StyledTileDescription.js +13 -16
- package/dist/esm/styled/tiles/StyledTileIcon.js +52 -16
- package/dist/esm/styled/tiles/StyledTileInput.js +1 -5
- package/dist/esm/styled/tiles/StyledTileLabel.js +13 -18
- package/dist/esm/styled/toggle/StyledToggleHint.js +2 -5
- package/dist/esm/styled/toggle/StyledToggleInput.js +38 -16
- package/dist/esm/styled/toggle/StyledToggleLabel.js +2 -5
- package/dist/esm/styled/toggle/StyledToggleMessage.js +2 -5
- package/dist/esm/styled/toggle/StyledToggleSvg.js +2 -5
- package/dist/index.cjs.js +977 -577
- package/dist/typings/elements/common/Field.d.ts +1 -1
- package/dist/typings/elements/common/Fieldset.d.ts +3 -1
- package/dist/typings/elements/faux-input/FauxInput.d.ts +3 -1
- package/dist/typings/elements/faux-input/components/EndIcon.d.ts +1 -1
- package/dist/typings/elements/faux-input/components/StartIcon.d.ts +1 -1
- package/dist/typings/elements/file-list/FileList.d.ts +3 -1
- package/dist/typings/elements/file-list/components/File.d.ts +3 -1
- package/dist/typings/elements/tiles/Tiles.d.ts +3 -1
- package/dist/typings/styled/common/StyledMessageIcon.d.ts +2 -1
- package/dist/typings/styled/file-list/StyledFileIcon.d.ts +7 -2
- package/dist/typings/styled/select/StyledSelect.d.ts +0 -3
- package/dist/typings/styled/select/StyledSelectWrapper.d.ts +3 -1
- package/dist/typings/styled/text/StyledTextFauxInput.d.ts +0 -4
- package/dist/typings/styled/text/StyledTextMediaFigure.d.ts +6 -7
- package/dist/typings/styled/tiles/StyledTile.d.ts +4 -7
- package/dist/typings/types/index.d.ts +3 -3
- package/dist/typings/utils/useFieldContext.d.ts +0 -1
- package/dist/typings/utils/useFieldsetContext.d.ts +0 -1
- package/dist/typings/utils/useFileContext.d.ts +0 -1
- package/dist/typings/utils/useInputContext.d.ts +0 -1
- package/dist/typings/utils/useInputGroupContext.d.ts +0 -1
- package/dist/typings/utils/useTilesContext.d.ts +0 -1
- package/package.json +7 -8
- package/LICENSE.md +0 -176
|
@@ -6,31 +6,52 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
8
|
import { math } from 'polished';
|
|
9
|
-
import {
|
|
9
|
+
import { getColor } 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
|
|
47
|
+
'data-garden-version': '9.0.0',
|
|
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;}"],
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
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);
|
|
35
56
|
|
|
36
57
|
export { StyledSelect };
|
|
@@ -4,21 +4,26 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
-
import styled from 'styled-components';
|
|
8
|
-
import { SELECTOR_FOCUS_VISIBLE
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { SELECTOR_FOCUS_VISIBLE } 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
|
|
23
|
+
'data-garden-version': '9.0.0'
|
|
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);
|
|
20
|
-
StyledSelectWrapper.defaultProps = {
|
|
21
|
-
theme: DEFAULT_THEME
|
|
22
|
-
};
|
|
27
|
+
})(["position:relative;padding:0;overflow:visible;", ";& > ", "{border-color:transparent;background-color:transparent;", "{box-shadow:unset;}}"], sizeStyles, StyledSelect, SELECTOR_FOCUS_VISIBLE);
|
|
23
28
|
|
|
24
29
|
export { StyledSelectWrapper };
|
|
@@ -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,
|
|
8
|
+
import { SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles, 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,13 +57,10 @@ 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
|
|
60
|
+
'data-garden-version': '9.0.0'
|
|
53
61
|
})).withConfig({
|
|
54
62
|
displayName: "StyledTextFauxInput",
|
|
55
63
|
componentId: "sc-yqw7j9-0"
|
|
56
64
|
})(["display:", ";align-items:", ";cursor:", ";overflow:hidden;", " & > ", "{vertical-align:", ";", "{box-shadow:unset;}}& > ", "{flex-shrink:", ";}", ";"], props => props.mediaLayout ? 'inline-flex' : 'inline-block', props => props.mediaLayout && 'baseline', props => props.mediaLayout && !props.isDisabled ? 'text' : 'default', colorStyles, StyledTextInput, props => !props.mediaLayout && 'baseline', SELECTOR_FOCUS_VISIBLE, StyledTextMediaFigure, props => props.mediaLayout && '0', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
57
|
-
StyledTextFauxInput.defaultProps = {
|
|
58
|
-
theme: DEFAULT_THEME
|
|
59
|
-
};
|
|
60
65
|
|
|
61
|
-
export { StyledTextFauxInput
|
|
66
|
+
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,
|
|
11
|
+
import { retrieveComponentStyles, 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,93 +18,132 @@ 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
|
|
142
|
+
'data-garden-version': '9.0.0',
|
|
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;}
|
|
103
|
-
StyledTextInput.defaultProps = {
|
|
104
|
-
theme: DEFAULT_THEME
|
|
105
|
-
};
|
|
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));
|
|
106
148
|
|
|
107
149
|
export { StyledTextInput };
|
|
@@ -5,53 +5,61 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
8
|
-
import
|
|
9
|
-
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
|
|
8
|
+
import { StyledBaseIcon, retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
|
|
10
9
|
|
|
11
10
|
const COMPONENT_ID = 'forms.media_figure';
|
|
12
|
-
const colorStyles =
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
+
}
|
|
18
42
|
}
|
|
19
|
-
return css(["color:", ";"],
|
|
43
|
+
return css(["color:", ";"], color);
|
|
20
44
|
};
|
|
21
45
|
const sizeStyles = props => {
|
|
22
46
|
const size = props.theme.iconSizes.md;
|
|
23
47
|
const marginFirst = `1px ${props.theme.space.base * 2}px auto 0`;
|
|
24
48
|
const marginLast = `1px 0 auto ${props.theme.space.base * 2}px`;
|
|
25
49
|
let margin;
|
|
26
|
-
if (props
|
|
50
|
+
if (props.$position === 'start') {
|
|
27
51
|
margin = props.theme.rtl ? marginLast : marginFirst;
|
|
28
52
|
} else {
|
|
29
53
|
margin = props.theme.rtl ? marginFirst : marginLast;
|
|
30
54
|
}
|
|
31
55
|
return css(["margin:", ";width:", ";height:", ";"], margin, size, size);
|
|
32
56
|
};
|
|
33
|
-
const StyledTextMediaFigure = styled(
|
|
34
|
-
_ref => {
|
|
35
|
-
let {
|
|
36
|
-
children,
|
|
37
|
-
position,
|
|
38
|
-
isHovered,
|
|
39
|
-
isFocused,
|
|
40
|
-
isDisabled,
|
|
41
|
-
isRotated,
|
|
42
|
-
theme,
|
|
43
|
-
...props
|
|
44
|
-
} = _ref;
|
|
45
|
-
return React__default.cloneElement(Children.only(children), props);
|
|
46
|
-
}).attrs({
|
|
57
|
+
const StyledTextMediaFigure = styled(StyledBaseIcon).attrs({
|
|
47
58
|
'data-garden-id': COMPONENT_ID,
|
|
48
|
-
'data-garden-version': '9.0.0
|
|
59
|
+
'data-garden-version': '9.0.0'
|
|
49
60
|
}).withConfig({
|
|
50
61
|
displayName: "StyledTextMediaFigure",
|
|
51
62
|
componentId: "sc-1qepknj-0"
|
|
52
|
-
})(["transform:", ";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;", ";", " ", ";"], props => props
|
|
53
|
-
StyledTextMediaFigure.defaultProps = {
|
|
54
|
-
theme: DEFAULT_THEME
|
|
55
|
-
};
|
|
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));
|
|
56
64
|
|
|
57
65
|
export { StyledTextMediaFigure };
|
|
@@ -5,20 +5,17 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles
|
|
8
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledTextInput } from './StyledTextInput.js';
|
|
10
10
|
|
|
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
|
|
14
|
+
'data-garden-version': '9.0.0',
|
|
15
15
|
isBare: true
|
|
16
16
|
}).withConfig({
|
|
17
17
|
displayName: "StyledTextMediaInput",
|
|
18
18
|
componentId: "sc-12i9xfi-0"
|
|
19
19
|
})(["flex-grow:1;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
-
StyledTextMediaInput.defaultProps = {
|
|
21
|
-
theme: DEFAULT_THEME
|
|
22
|
-
};
|
|
23
20
|
|
|
24
21
|
export { StyledTextMediaInput };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import { retrieveComponentStyles
|
|
8
|
+
import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { StyledTextInput } from './StyledTextInput.js';
|
|
10
10
|
|
|
11
11
|
const COMPONENT_ID = 'forms.textarea';
|
|
@@ -21,13 +21,10 @@ 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
|
|
24
|
+
'data-garden-version': '9.0.0'
|
|
25
25
|
}).withConfig({
|
|
26
26
|
displayName: "StyledTextarea",
|
|
27
27
|
componentId: "sc-wxschl-0"
|
|
28
28
|
})(["resize:", ";overflow:auto;", ";", ";"], props => props.isResizable ? 'vertical' : 'none', props => props.isHidden && hiddenStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
29
|
-
StyledTextarea.defaultProps = {
|
|
30
|
-
theme: DEFAULT_THEME
|
|
31
|
-
};
|
|
32
29
|
|
|
33
30
|
export { StyledTextarea };
|