@zendeskgarden/react-forms 8.75.1 → 8.76.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/Checkbox.js +101 -0
- package/dist/esm/elements/FileUpload.js +79 -0
- package/dist/esm/elements/Input.js +97 -0
- package/dist/esm/elements/MediaInput.js +160 -0
- package/dist/esm/elements/MultiThumbRange.js +166 -0
- package/dist/esm/elements/Radio.js +85 -0
- package/dist/esm/elements/Range.js +112 -0
- package/dist/esm/elements/Select.js +101 -0
- package/dist/esm/elements/Textarea.js +174 -0
- package/dist/esm/elements/Toggle.js +85 -0
- package/dist/esm/elements/common/Field.js +96 -0
- package/dist/esm/elements/common/Fieldset.js +77 -0
- package/dist/esm/elements/common/Hint.js +96 -0
- package/dist/esm/elements/common/Label.js +142 -0
- package/dist/esm/elements/common/Legend.js +67 -0
- package/dist/esm/elements/common/Message.js +117 -0
- package/dist/esm/elements/faux-input/FauxInput.js +104 -0
- package/dist/esm/elements/faux-input/components/EndIcon.js +63 -0
- package/dist/esm/elements/faux-input/components/StartIcon.js +63 -0
- package/dist/esm/elements/file-list/FileList.js +70 -0
- package/dist/esm/elements/file-list/components/Close.js +79 -0
- package/dist/esm/elements/file-list/components/Delete.js +79 -0
- package/dist/esm/elements/file-list/components/File.js +98 -0
- package/dist/esm/elements/file-list/components/Item.js +68 -0
- package/dist/esm/elements/file-list/utils.js +50 -0
- package/dist/esm/elements/input-group/InputGroup.js +79 -0
- package/dist/esm/elements/tiles/Tiles.js +64 -0
- package/dist/esm/elements/tiles/components/Description.js +68 -0
- package/dist/esm/elements/tiles/components/Icon.js +68 -0
- package/dist/esm/elements/tiles/components/Label.js +77 -0
- package/dist/esm/elements/tiles/components/Tile.js +95 -0
- package/dist/esm/index.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-circle-stroke.svg.js +33 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-sm-fill.svg.js +29 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/circle-sm-fill.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/dash-fill.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-document-stroke.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-error-stroke.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-generic-stroke.svg.js +26 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-image-stroke.svg.js +33 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-pdf-stroke.svg.js +35 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-presentation-stroke.svg.js +26 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-spreadsheet-stroke.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-zip-stroke.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/trash-stroke.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +26 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js +37 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js +32 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js +33 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +25 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/circle-sm-fill.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-document-stroke.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-error-stroke.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-generic-stroke.svg.js +26 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-image-stroke.svg.js +32 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-pdf-stroke.svg.js +35 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-presentation-stroke.svg.js +26 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-spreadsheet-stroke.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-zip-stroke.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/trash-stroke.svg.js +27 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +26 -0
- package/dist/esm/styled/checkbox/StyledCheckHint.js +23 -0
- package/dist/esm/styled/checkbox/StyledCheckInput.js +34 -0
- package/dist/esm/styled/checkbox/StyledCheckLabel.js +23 -0
- package/dist/esm/styled/checkbox/StyledCheckMessage.js +23 -0
- package/dist/esm/styled/checkbox/StyledCheckSvg.js +25 -0
- package/dist/esm/styled/checkbox/StyledDashSvg.js +25 -0
- package/dist/esm/styled/common/StyledField.js +22 -0
- package/dist/esm/styled/common/StyledFieldset.js +24 -0
- package/dist/esm/styled/common/StyledHint.js +22 -0
- package/dist/esm/styled/common/StyledLabel.js +23 -0
- package/dist/esm/styled/common/StyledLegend.js +24 -0
- package/dist/esm/styled/common/StyledMessage.js +40 -0
- package/dist/esm/styled/common/StyledMessageIcon.js +45 -0
- package/dist/esm/styled/file-list/StyledFile.js +74 -0
- package/dist/esm/styled/file-list/StyledFileClose.js +22 -0
- package/dist/esm/styled/file-list/StyledFileDelete.js +23 -0
- package/dist/esm/styled/file-list/StyledFileIcon.js +31 -0
- package/dist/esm/styled/file-list/StyledFileList.js +22 -0
- package/dist/esm/styled/file-list/StyledFileListItem.js +24 -0
- package/dist/esm/styled/file-upload/StyledFileUpload.js +45 -0
- package/dist/esm/styled/input-group/StyledInputGroup.js +35 -0
- package/dist/esm/styled/radio/StyledRadioHint.js +24 -0
- package/dist/esm/styled/radio/StyledRadioInput.js +61 -0
- package/dist/esm/styled/radio/StyledRadioLabel.js +30 -0
- package/dist/esm/styled/radio/StyledRadioMessage.js +24 -0
- package/dist/esm/styled/radio/StyledRadioSvg.js +25 -0
- package/dist/esm/styled/range/StyledRangeInput.js +160 -0
- package/dist/esm/styled/range/StyledSlider.js +26 -0
- package/dist/esm/styled/range/StyledSliderThumb.js +45 -0
- package/dist/esm/styled/range/StyledSliderTrack.js +42 -0
- package/dist/esm/styled/range/StyledSliderTrackRail.js +28 -0
- package/dist/esm/styled/select/StyledSelect.js +36 -0
- package/dist/esm/styled/select/StyledSelectWrapper.js +24 -0
- package/dist/esm/styled/text/StyledTextFauxInput.js +59 -0
- package/dist/esm/styled/text/StyledTextInput.js +105 -0
- package/dist/esm/styled/text/StyledTextMediaFigure.js +57 -0
- package/dist/esm/styled/text/StyledTextMediaInput.js +24 -0
- package/dist/esm/styled/text/StyledTextarea.js +33 -0
- package/dist/esm/styled/tiles/StyledTile.js +53 -0
- package/dist/esm/styled/tiles/StyledTileDescription.js +34 -0
- package/dist/esm/styled/tiles/StyledTileIcon.js +38 -0
- package/dist/esm/styled/tiles/StyledTileInput.js +18 -0
- package/dist/esm/styled/tiles/StyledTileLabel.js +36 -0
- package/dist/esm/styled/toggle/StyledToggleHint.js +24 -0
- package/dist/esm/styled/toggle/StyledToggleInput.js +40 -0
- package/dist/esm/styled/toggle/StyledToggleLabel.js +28 -0
- package/dist/esm/styled/toggle/StyledToggleMessage.js +25 -0
- package/dist/esm/styled/toggle/StyledToggleSvg.js +23 -0
- package/dist/esm/types/index.js +11 -0
- package/dist/esm/utils/useFieldContext.js +15 -0
- package/dist/esm/utils/useFieldsetContext.js +15 -0
- package/dist/esm/utils/useFileContext.js +14 -0
- package/dist/esm/utils/useInputContext.js +14 -0
- package/dist/esm/utils/useInputGroupContext.js +14 -0
- package/dist/esm/utils/useTilesContext.js +14 -0
- package/dist/index.cjs.js +82 -98
- package/package.json +5 -5
- package/dist/index.esm.js +0 -2921
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles, DEFAULT_THEME, focusStyles, getColorV8 } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledTextInput } from './StyledTextInput.js';
|
|
10
|
+
import { StyledTextMediaFigure } from './StyledTextMediaFigure.js';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'forms.faux_input';
|
|
13
|
+
const VALIDATION_HUES = {
|
|
14
|
+
success: 'successHue',
|
|
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 {
|
|
27
|
+
theme,
|
|
28
|
+
validation,
|
|
29
|
+
focusInset,
|
|
30
|
+
isBare,
|
|
31
|
+
isFocused
|
|
32
|
+
} = props;
|
|
33
|
+
return css(["", ""], focusStyles({
|
|
34
|
+
theme,
|
|
35
|
+
inset: focusInset,
|
|
36
|
+
condition: !isBare,
|
|
37
|
+
hue: getValidationHue(validation),
|
|
38
|
+
shade: validation === 'warning' ? 700 : 600,
|
|
39
|
+
selector: isFocused ? '&' : '&:focus-within',
|
|
40
|
+
styles: {
|
|
41
|
+
borderColor: getColorV8(getValidationHue(validation), 600, theme)
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
const StyledTextFauxInput = styled(StyledTextInput).attrs(props => ({
|
|
46
|
+
as: 'div',
|
|
47
|
+
'aria-readonly': props.isReadOnly,
|
|
48
|
+
'aria-disabled': props.isDisabled,
|
|
49
|
+
'data-garden-id': COMPONENT_ID,
|
|
50
|
+
'data-garden-version': '8.76.0'
|
|
51
|
+
})).withConfig({
|
|
52
|
+
displayName: "StyledTextFauxInput",
|
|
53
|
+
componentId: "sc-yqw7j9-0"
|
|
54
|
+
})(["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));
|
|
55
|
+
StyledTextFauxInput.defaultProps = {
|
|
56
|
+
theme: DEFAULT_THEME
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export { StyledTextFauxInput, getValidationHue };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { math, em } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledHint } from '../common/StyledHint.js';
|
|
11
|
+
import { StyledLabel } from '../common/StyledLabel.js';
|
|
12
|
+
import { StyledMessage } from '../common/StyledMessage.js';
|
|
13
|
+
|
|
14
|
+
const COMPONENT_ID = 'forms.input';
|
|
15
|
+
const isInvalid = validation => {
|
|
16
|
+
return validation === 'warning' || validation === 'error';
|
|
17
|
+
};
|
|
18
|
+
const colorStyles = props => {
|
|
19
|
+
const HUE = 'primaryHue';
|
|
20
|
+
const SHADE = 600;
|
|
21
|
+
const placeholderColor = getColorV8('neutralHue', SHADE - 200, props.theme);
|
|
22
|
+
let borderColor;
|
|
23
|
+
let hoverBorderColor;
|
|
24
|
+
let focusBorderColor;
|
|
25
|
+
let focusRingHue = HUE;
|
|
26
|
+
let focusRingShade = SHADE;
|
|
27
|
+
if (props.validation) {
|
|
28
|
+
let hue = HUE;
|
|
29
|
+
if (props.validation === 'success') {
|
|
30
|
+
hue = 'successHue';
|
|
31
|
+
} else if (props.validation === 'warning') {
|
|
32
|
+
hue = 'warningHue';
|
|
33
|
+
focusRingShade = 700;
|
|
34
|
+
} else if (props.validation === 'error') {
|
|
35
|
+
hue = 'dangerHue';
|
|
36
|
+
}
|
|
37
|
+
borderColor = getColorV8(hue, SHADE, props.theme);
|
|
38
|
+
hoverBorderColor = borderColor;
|
|
39
|
+
focusBorderColor = borderColor;
|
|
40
|
+
focusRingHue = hue;
|
|
41
|
+
} else {
|
|
42
|
+
borderColor = getColorV8('neutralHue', SHADE - 300, props.theme);
|
|
43
|
+
hoverBorderColor = getColorV8('primaryHue', SHADE, props.theme);
|
|
44
|
+
focusBorderColor = hoverBorderColor;
|
|
45
|
+
}
|
|
46
|
+
const readOnlyBackgroundColor = getColorV8('neutralHue', SHADE - 500, props.theme);
|
|
47
|
+
const readOnlyBorderColor = getColorV8('neutralHue', SHADE - 300, props.theme);
|
|
48
|
+
const disabledBackgroundColor = readOnlyBackgroundColor;
|
|
49
|
+
const disabledBorderColor = getColorV8('neutralHue', SHADE - 400, props.theme);
|
|
50
|
+
const disabledForegroundColor = getColorV8('neutralHue', SHADE - 200, props.theme);
|
|
51
|
+
let controlledBorderColor = borderColor;
|
|
52
|
+
if (props.isFocused) {
|
|
53
|
+
controlledBorderColor = focusBorderColor;
|
|
54
|
+
}
|
|
55
|
+
if (props.isHovered) {
|
|
56
|
+
controlledBorderColor = hoverBorderColor;
|
|
57
|
+
}
|
|
58
|
+
return css(["border-color:", ";background-color:", ";color:", ";&::placeholder{color:", ";}&[readonly],&[aria-readonly='true']{border-color:", ";background-color:", ";}&:hover{border-color:", ";}", " &:disabled,&[aria-disabled='true']{border-color:", ";background-color:", ";color:", ";}"], controlledBorderColor, props.isBare ? 'transparent' : getColorV8('background', 600 , props.theme), getColorV8('foreground', 600 , props.theme), placeholderColor, readOnlyBorderColor, !props.isBare && readOnlyBackgroundColor, hoverBorderColor, focusStyles({
|
|
59
|
+
theme: props.theme,
|
|
60
|
+
inset: props.focusInset,
|
|
61
|
+
condition: !props.isBare,
|
|
62
|
+
hue: focusRingHue,
|
|
63
|
+
shade: focusRingShade,
|
|
64
|
+
styles: {
|
|
65
|
+
borderColor: focusBorderColor
|
|
66
|
+
}
|
|
67
|
+
}), disabledBorderColor, !props.isBare && disabledBackgroundColor, disabledForegroundColor);
|
|
68
|
+
};
|
|
69
|
+
const sizeStyles = props => {
|
|
70
|
+
const fontSize = props.theme.fontSizes.md;
|
|
71
|
+
const paddingHorizontal = `${props.theme.space.base * 3}px`;
|
|
72
|
+
let height;
|
|
73
|
+
let paddingVertical;
|
|
74
|
+
let browseFontSize;
|
|
75
|
+
let swatchHeight;
|
|
76
|
+
if (props.isCompact) {
|
|
77
|
+
height = `${props.theme.space.base * 8}px`;
|
|
78
|
+
paddingVertical = `${props.theme.space.base * 1.5}px`;
|
|
79
|
+
browseFontSize = math(`${props.theme.fontSizes.sm} - 1`);
|
|
80
|
+
swatchHeight = `${props.theme.space.base * 6}px`;
|
|
81
|
+
} else {
|
|
82
|
+
height = `${props.theme.space.base * 10}px`;
|
|
83
|
+
paddingVertical = `${props.theme.space.base * 2.5}px`;
|
|
84
|
+
browseFontSize = props.theme.fontSizes.sm;
|
|
85
|
+
swatchHeight = `${props.theme.space.base * 7}px`;
|
|
86
|
+
}
|
|
87
|
+
const lineHeight = math(`${height} - (${paddingVertical} * 2) - (${props.theme.borderWidths.sm} * 2)`);
|
|
88
|
+
const padding = props.isBare ? '0' : `${em(paddingVertical, fontSize)} ${em(paddingHorizontal, fontSize)}`;
|
|
89
|
+
const swatchMarginVertical = math(`(${lineHeight} - ${swatchHeight}) / 2`);
|
|
90
|
+
const swatchMarginHorizontal = math(`${paddingVertical} + ${swatchMarginVertical} - ${paddingHorizontal}`);
|
|
91
|
+
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-color-swatch{margin:", " ", ";}", ":not([hidden]) + &&,", " + &&,", " + &&,&& + ", ",&& + ", "{margin-top:", "px;}"], padding, props.isBare ? '1em' : height, getLineHeight(lineHeight, fontSize), fontSize, browseFontSize, height, props.isCompact ? '0 2px' : '1px 3px', swatchMarginVertical, swatchMarginHorizontal, math(`${swatchMarginHorizontal} * -2`), swatchHeight, swatchMarginVertical, swatchMarginHorizontal, StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, props.theme.space.base * (props.isCompact ? 1 : 2));
|
|
92
|
+
};
|
|
93
|
+
const StyledTextInput = styled.input.attrs(props => ({
|
|
94
|
+
'data-garden-id': COMPONENT_ID,
|
|
95
|
+
'data-garden-version': '8.76.0',
|
|
96
|
+
'aria-invalid': isInvalid(props.validation)
|
|
97
|
+
})).withConfig({
|
|
98
|
+
displayName: "StyledTextInput",
|
|
99
|
+
componentId: "sc-k12n8x-0"
|
|
100
|
+
})(["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;}&::placeholder{opacity:1;}&: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', props => sizeStyles(props), props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
101
|
+
StyledTextInput.defaultProps = {
|
|
102
|
+
theme: DEFAULT_THEME
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export { StyledTextInput };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import React__default, { Children } from 'react';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.media_figure';
|
|
12
|
+
const colorStyles = props => {
|
|
13
|
+
let shade = 600;
|
|
14
|
+
if (props.isDisabled) {
|
|
15
|
+
shade = 400;
|
|
16
|
+
} else if (props.isHovered || props.isFocused) {
|
|
17
|
+
shade = 700;
|
|
18
|
+
}
|
|
19
|
+
return css(["color:", ";"], getColorV8('neutralHue', shade, props.theme));
|
|
20
|
+
};
|
|
21
|
+
const sizeStyles = props => {
|
|
22
|
+
const size = props.theme.iconSizes.md;
|
|
23
|
+
const marginFirst = `1px ${props.theme.space.base * 2}px auto 0`;
|
|
24
|
+
const marginLast = `1px 0 auto ${props.theme.space.base * 2}px`;
|
|
25
|
+
let margin;
|
|
26
|
+
if (props.position === 'start') {
|
|
27
|
+
margin = props.theme.rtl ? marginLast : marginFirst;
|
|
28
|
+
} else {
|
|
29
|
+
margin = props.theme.rtl ? marginFirst : marginLast;
|
|
30
|
+
}
|
|
31
|
+
return css(["margin:", ";width:", ";height:", ";"], margin, size, size);
|
|
32
|
+
};
|
|
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({
|
|
47
|
+
'data-garden-id': COMPONENT_ID,
|
|
48
|
+
'data-garden-version': '8.76.0'
|
|
49
|
+
}).withConfig({
|
|
50
|
+
displayName: "StyledTextMediaFigure",
|
|
51
|
+
componentId: "sc-1qepknj-0"
|
|
52
|
+
})(["transform:", ";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;", ";", " ", ";"], props => props.isRotated && `rotate(${props.theme.rtl ? '-' : '+'}180deg)`, props => colorStyles(props), props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
53
|
+
StyledTextMediaFigure.defaultProps = {
|
|
54
|
+
theme: DEFAULT_THEME
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { StyledTextMediaFigure };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledTextInput } from './StyledTextInput.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.media_input';
|
|
12
|
+
const StyledTextMediaInput = styled(StyledTextInput).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '8.76.0',
|
|
15
|
+
isBare: true
|
|
16
|
+
}).withConfig({
|
|
17
|
+
displayName: "StyledTextMediaInput",
|
|
18
|
+
componentId: "sc-12i9xfi-0"
|
|
19
|
+
})(["flex-grow:1;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
+
StyledTextMediaInput.defaultProps = {
|
|
21
|
+
theme: DEFAULT_THEME
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { StyledTextMediaInput };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledTextInput } from './StyledTextInput.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.textarea';
|
|
12
|
+
const hiddenStyles = `
|
|
13
|
+
visibility: hidden;
|
|
14
|
+
position: absolute;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
height: 0;
|
|
17
|
+
top: 0;
|
|
18
|
+
left: 0;
|
|
19
|
+
transform: translateZ(0);
|
|
20
|
+
`;
|
|
21
|
+
const StyledTextarea = styled(StyledTextInput).attrs({
|
|
22
|
+
as: 'textarea',
|
|
23
|
+
'data-garden-id': COMPONENT_ID,
|
|
24
|
+
'data-garden-version': '8.76.0'
|
|
25
|
+
}).withConfig({
|
|
26
|
+
displayName: "StyledTextarea",
|
|
27
|
+
componentId: "sc-wxschl-0"
|
|
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
|
+
|
|
33
|
+
export { StyledTextarea };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8, focusStyles } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledTileIcon } from './StyledTileIcon.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.tile';
|
|
12
|
+
const colorStyles = props => {
|
|
13
|
+
const SHADE = 600;
|
|
14
|
+
const iconColor = getColorV8('neutralHue', SHADE, props.theme);
|
|
15
|
+
const color = getColorV8('neutralHue', SHADE + 200, props.theme);
|
|
16
|
+
const borderColor = getColorV8('neutralHue', SHADE - 300, props.theme);
|
|
17
|
+
const hoverBackgroundColor = getColorV8('primaryHue', SHADE, props.theme, 0.08);
|
|
18
|
+
const hoverBorderColor = getColorV8('primaryHue', SHADE, props.theme);
|
|
19
|
+
const focusBorderColor = hoverBorderColor;
|
|
20
|
+
const activeBackgroundColor = getColorV8('primaryHue', SHADE, props.theme, 0.2);
|
|
21
|
+
const activeBorderColor = focusBorderColor;
|
|
22
|
+
const disabledBackgroundColor = getColorV8('neutralHue', SHADE - 500, props.theme);
|
|
23
|
+
const disabledBorderColor = getColorV8('neutralHue', SHADE - 400, props.theme);
|
|
24
|
+
const disabledColor = getColorV8('neutralHue', SHADE - 200, props.theme);
|
|
25
|
+
const selectedBorderColor = focusBorderColor;
|
|
26
|
+
const selectedBackgroundColor = selectedBorderColor;
|
|
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
|
+
hue: focusBorderColor,
|
|
35
|
+
styles: {
|
|
36
|
+
borderColor: focusBorderColor
|
|
37
|
+
},
|
|
38
|
+
selector: `&:focus-within`
|
|
39
|
+
}), activeBorderColor, activeBackgroundColor, StyledTileIcon, color, selectedBorderColor, selectedBackgroundColor, getColorV8('background', 600 , props.theme), StyledTileIcon, getColorV8('background', 600 , props.theme), selectedHoverBorderColor, selectedHoverBackgroundColor, getColorV8('background', 600 , props.theme), StyledTileIcon, getColorV8('background', 600 , props.theme), selectedActiveBorderColor, selectedActiveBackgroundColor, getColorV8('background', 600 , props.theme), StyledTileIcon, getColorV8('background', 600 , props.theme), disabledBorderColor, disabledBackgroundColor, disabledColor, StyledTileIcon, disabledColor, selectedDisabledBackgroundColor, disabledColor, StyledTileIcon, disabledColor);
|
|
40
|
+
};
|
|
41
|
+
const StyledTile = styled.label.attrs(props => ({
|
|
42
|
+
'data-garden-id': COMPONENT_ID,
|
|
43
|
+
'data-garden-version': '8.76.0',
|
|
44
|
+
'data-garden-selected': props.isSelected
|
|
45
|
+
})).withConfig({
|
|
46
|
+
displayName: "StyledTile",
|
|
47
|
+
componentId: "sc-1jjvmxs-0"
|
|
48
|
+
})(["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:", ";cursor:", ";padding:", "px;direction:", ";min-width:132px;word-break:break-word;", ";", ";"], props => props.theme.borderRadii.md, props => !props.isDisabled && 'pointer', props => props.theme.space.base * 5, props => props.theme.rtl && 'rtl', props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
49
|
+
StyledTile.defaultProps = {
|
|
50
|
+
theme: DEFAULT_THEME
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export { StyledTile };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { math } from 'polished';
|
|
9
|
+
import { getLineHeight, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.tile_description';
|
|
12
|
+
const sizeStyles = props => {
|
|
13
|
+
let marginDirection = 'left';
|
|
14
|
+
let marginValue;
|
|
15
|
+
if (props.theme.rtl) {
|
|
16
|
+
marginDirection = 'right';
|
|
17
|
+
}
|
|
18
|
+
if (!props.isCentered) {
|
|
19
|
+
marginValue = math(`(${props.theme.iconSizes.md} * 2) + ${props.theme.space.base * 5}px`);
|
|
20
|
+
}
|
|
21
|
+
return css(["margin-top:", "px;margin-", ":", ";"], props.theme.space.base, marginDirection, marginValue);
|
|
22
|
+
};
|
|
23
|
+
const StyledTileDescription = styled.span.attrs({
|
|
24
|
+
'data-garden-id': COMPONENT_ID,
|
|
25
|
+
'data-garden-version': '8.76.0'
|
|
26
|
+
}).withConfig({
|
|
27
|
+
displayName: "StyledTileDescription",
|
|
28
|
+
componentId: "sc-xfuu7u-0"
|
|
29
|
+
})(["display:block;text-align:", ";line-height:", ";font-size:", ";", ";", ";"], props => props.isCentered && 'center', props => getLineHeight(props.theme.space.base * 4, props.theme.fontSizes.sm), props => props.theme.fontSizes.sm, props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
30
|
+
StyledTileDescription.defaultProps = {
|
|
31
|
+
theme: DEFAULT_THEME
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { StyledTileDescription };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { math } from 'polished';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.tile_icon';
|
|
12
|
+
const sizeStyles = props => {
|
|
13
|
+
const iconSize = math(`${props.theme.iconSizes.md} * 2`);
|
|
14
|
+
let position;
|
|
15
|
+
let top;
|
|
16
|
+
let horizontalValue;
|
|
17
|
+
if (!props.isCentered) {
|
|
18
|
+
position = 'absolute';
|
|
19
|
+
top = `${props.theme.space.base * 6}px`;
|
|
20
|
+
horizontalValue = `left: ${props.theme.space.base * 5}px`;
|
|
21
|
+
if (props.theme.rtl) {
|
|
22
|
+
horizontalValue = `right: ${props.theme.space.base * 5}px`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return css(["position:", ";top:", ";", ";& > *{width:", ";height:", ";}"], position, top, horizontalValue, iconSize, iconSize);
|
|
26
|
+
};
|
|
27
|
+
const StyledTileIcon = styled.span.attrs({
|
|
28
|
+
'data-garden-id': COMPONENT_ID,
|
|
29
|
+
'data-garden-version': '8.76.0'
|
|
30
|
+
}).withConfig({
|
|
31
|
+
displayName: "StyledTileIcon",
|
|
32
|
+
componentId: "sc-1wazhg4-0"
|
|
33
|
+
})(["display:block;transition:color 0.25s ease-in-out;text-align:center;line-height:0;", ";", ";"], props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
34
|
+
StyledTileIcon.defaultProps = {
|
|
35
|
+
theme: DEFAULT_THEME
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { StyledTileIcon };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const StyledTileInput = styled.input.withConfig({
|
|
11
|
+
displayName: "StyledTileInput",
|
|
12
|
+
componentId: "sc-1nq2m6q-0"
|
|
13
|
+
})(["position:absolute;border:0;clip:rect(1px,1px,1px,1px);padding:0;width:1px;height:1px;overflow:hidden;white-space:nowrap;"]);
|
|
14
|
+
StyledTileInput.defaultProps = {
|
|
15
|
+
theme: DEFAULT_THEME
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { StyledTileInput };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { math } from 'polished';
|
|
9
|
+
import { getLineHeight, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.tile_label';
|
|
12
|
+
const sizeStyles = props => {
|
|
13
|
+
let marginDirection = 'left';
|
|
14
|
+
let marginTop = `${props.theme.space.base * 2}px`;
|
|
15
|
+
let marginValue;
|
|
16
|
+
if (props.theme.rtl) {
|
|
17
|
+
marginDirection = 'right';
|
|
18
|
+
}
|
|
19
|
+
if (!props.isCentered) {
|
|
20
|
+
marginValue = math(`(${props.theme.iconSizes.md} * 2) + ${props.theme.space.base * 5}px`);
|
|
21
|
+
marginTop = '0';
|
|
22
|
+
}
|
|
23
|
+
return css(["margin-top:", ";margin-", ":", ";"], marginTop, marginDirection, marginValue);
|
|
24
|
+
};
|
|
25
|
+
const StyledTileLabel = styled.span.attrs({
|
|
26
|
+
'data-garden-id': COMPONENT_ID,
|
|
27
|
+
'data-garden-version': '8.76.0'
|
|
28
|
+
}).withConfig({
|
|
29
|
+
displayName: "StyledTileLabel",
|
|
30
|
+
componentId: "sc-1mypv27-0"
|
|
31
|
+
})(["display:block;text-align:", ";line-height:", ";font-size:", ";font-weight:", ";", ";", ";"], props => props.isCentered && 'center', props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => props.theme.fontSizes.md, props => props.theme.fontWeights.semibold, props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
32
|
+
StyledTileLabel.defaultProps = {
|
|
33
|
+
theme: DEFAULT_THEME
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { StyledTileLabel };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledHint } from '../common/StyledHint.js';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'forms.toggle_hint';
|
|
13
|
+
const StyledToggleHint = styled(StyledHint).attrs({
|
|
14
|
+
'data-garden-id': COMPONENT_ID,
|
|
15
|
+
'data-garden-version': '8.76.0'
|
|
16
|
+
}).withConfig({
|
|
17
|
+
displayName: "StyledToggleHint",
|
|
18
|
+
componentId: "sc-nziggu-0"
|
|
19
|
+
})(["padding-", ":", ";", ";"], props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 12px`), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
+
StyledToggleHint.defaultProps = {
|
|
21
|
+
theme: DEFAULT_THEME
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { StyledToggleHint };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledCheckInput } from '../checkbox/StyledCheckInput.js';
|
|
11
|
+
import { StyledToggleLabel } from './StyledToggleLabel.js';
|
|
12
|
+
|
|
13
|
+
const COMPONENT_ID = 'forms.toggle';
|
|
14
|
+
const colorStyles = props => {
|
|
15
|
+
const SHADE = 600;
|
|
16
|
+
const backgroundColor = getColorV8('neutralHue', SHADE - 100, props.theme);
|
|
17
|
+
const hoverBackgroundColor = getColorV8('neutralHue', SHADE, props.theme);
|
|
18
|
+
const activeBackgroundColor = getColorV8('neutralHue', SHADE + 100, props.theme);
|
|
19
|
+
return css(["& ~ ", "::before{background-color:", ";}&:enabled ~ ", ":hover::before{background-color:", ";}&:enabled ~ ", ":active::before{background-color:", ";}"], StyledToggleLabel, backgroundColor, StyledToggleLabel, hoverBackgroundColor, StyledToggleLabel, activeBackgroundColor);
|
|
20
|
+
};
|
|
21
|
+
const sizeStyles = props => {
|
|
22
|
+
const height = `${props.theme.space.base * 5}px`;
|
|
23
|
+
const width = `${props.theme.space.base * 10}px`;
|
|
24
|
+
const iconSize = props.theme.iconSizes.md;
|
|
25
|
+
const iconPosition = math(`(${height} - ${iconSize}) / 2`);
|
|
26
|
+
const checkedIconPosition = math(`${width} - ${iconSize} - ${iconPosition}`);
|
|
27
|
+
return css(["top:0;width:", ";height:", ";& ~ ", "::before{width:", ";height:", ";}& ~ ", " > svg{top:", ";", ":", ";width:", ";height:", ";}&:checked ~ ", " > svg{", ":", ";}"], width, height, StyledToggleLabel, width, height, StyledToggleLabel, iconPosition, props.theme.rtl ? 'right' : 'left', iconPosition, iconSize, iconSize, StyledToggleLabel, props.theme.rtl ? 'right' : 'left', checkedIconPosition);
|
|
28
|
+
};
|
|
29
|
+
const StyledToggleInput = styled(StyledCheckInput).attrs({
|
|
30
|
+
'data-garden-id': COMPONENT_ID,
|
|
31
|
+
'data-garden-version': '8.76.0'
|
|
32
|
+
}).withConfig({
|
|
33
|
+
displayName: "StyledToggleInput",
|
|
34
|
+
componentId: "sc-sgp47s-0"
|
|
35
|
+
})(["& ~ ", "::before{top:0;transition:box-shadow .1s ease-in-out,background-color .15s ease-in-out,color .25s ease-in-out;border:none;border-radius:100px;}", ";", ";", ";"], StyledToggleLabel, props => sizeStyles(props), props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
36
|
+
StyledToggleInput.defaultProps = {
|
|
37
|
+
theme: DEFAULT_THEME
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { StyledToggleInput };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledCheckLabel } from '../checkbox/StyledCheckLabel.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.toggle_label';
|
|
12
|
+
const sizeStyles = props => {
|
|
13
|
+
const size = props.theme.space.base * 10;
|
|
14
|
+
const padding = size + props.theme.space.base * 2;
|
|
15
|
+
return css(["padding-", ":", "px;&[hidden]{padding-", ":", "px;}"], props.theme.rtl ? 'right' : 'left', padding, props.theme.rtl ? 'right' : 'left', size);
|
|
16
|
+
};
|
|
17
|
+
const StyledToggleLabel = styled(StyledCheckLabel).attrs({
|
|
18
|
+
'data-garden-id': COMPONENT_ID,
|
|
19
|
+
'data-garden-version': '8.76.0'
|
|
20
|
+
}).withConfig({
|
|
21
|
+
displayName: "StyledToggleLabel",
|
|
22
|
+
componentId: "sc-e0asdk-0"
|
|
23
|
+
})(["", ";", ";"], props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
24
|
+
StyledToggleLabel.defaultProps = {
|
|
25
|
+
theme: DEFAULT_THEME
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { StyledToggleLabel };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledMessage } from '../common/StyledMessage.js';
|
|
11
|
+
import { StyledMessageIcon } from '../common/StyledMessageIcon.js';
|
|
12
|
+
|
|
13
|
+
const COMPONENT_ID = 'forms.toggle_message';
|
|
14
|
+
const StyledToggleMessage = styled(StyledMessage).attrs({
|
|
15
|
+
'data-garden-id': COMPONENT_ID,
|
|
16
|
+
'data-garden-version': '8.76.0'
|
|
17
|
+
}).withConfig({
|
|
18
|
+
displayName: "StyledToggleMessage",
|
|
19
|
+
componentId: "sc-13vuvl1-0"
|
|
20
|
+
})(["padding-", ":", ";& ", "{", ":", ";}", ";"], props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 12px`), StyledMessageIcon, props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 10px - ${props.theme.iconSizes.md}`), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
21
|
+
StyledToggleMessage.defaultProps = {
|
|
22
|
+
theme: DEFAULT_THEME
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { StyledToggleMessage };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import SvgCircleSmFill from '../../node_modules/@zendeskgarden/svg-icons/src/16/circle-sm-fill.svg.js';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.toggle_svg';
|
|
12
|
+
const StyledToggleSvg = styled(SvgCircleSmFill).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '8.76.0'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledToggleSvg",
|
|
17
|
+
componentId: "sc-162xbyx-0"
|
|
18
|
+
})(["transition:all 0.15s ease-in-out;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledToggleSvg.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledToggleSvg };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
const VALIDATION = ['success', 'warning', 'error'];
|
|
8
|
+
const FILE_VALIDATION = ['success', 'error'];
|
|
9
|
+
const FILE_TYPE = ['pdf', 'zip', 'image', 'document', 'spreadsheet', 'presentation', 'generic'];
|
|
10
|
+
|
|
11
|
+
export { FILE_TYPE, FILE_VALIDATION, VALIDATION };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { createContext, useContext } from 'react';
|
|
8
|
+
|
|
9
|
+
const FieldContext = createContext(undefined);
|
|
10
|
+
const useFieldContext = () => {
|
|
11
|
+
const fieldContext = useContext(FieldContext);
|
|
12
|
+
return fieldContext;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { FieldContext, useFieldContext as default };
|