@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,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 { StyledFileList } from './StyledFileList.js';
|
|
10
|
+
import { StyledFileUpload } from '../file-upload/StyledFileUpload.js';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'forms.file_list.item';
|
|
13
|
+
const StyledFileListItem = styled.li.attrs({
|
|
14
|
+
'data-garden-id': COMPONENT_ID,
|
|
15
|
+
'data-garden-version': '8.76.0'
|
|
16
|
+
}).withConfig({
|
|
17
|
+
displayName: "StyledFileListItem",
|
|
18
|
+
componentId: "sc-1ova3lo-0"
|
|
19
|
+
})(["&:not(:first-child),", " ~ ", " > &:first-child{margin-top:", "px;}", ";"], StyledFileUpload, StyledFileList, props => props.theme.space.base * 2, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
+
StyledFileListItem.defaultProps = {
|
|
21
|
+
theme: DEFAULT_THEME
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { StyledFileListItem };
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { rgba, math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledLabel } from '../common/StyledLabel.js';
|
|
11
|
+
import { StyledHint } from '../common/StyledHint.js';
|
|
12
|
+
import { StyledMessage } from '../common/StyledMessage.js';
|
|
13
|
+
|
|
14
|
+
const COMPONENT_ID = 'forms.file_upload';
|
|
15
|
+
const colorStyles = props => {
|
|
16
|
+
const baseColor = getColorV8('primaryHue', 600, props.theme);
|
|
17
|
+
const hoverColor = getColorV8('primaryHue', 700, props.theme);
|
|
18
|
+
const activeColor = getColorV8('primaryHue', 800, props.theme);
|
|
19
|
+
const disabledBackgroundColor = getColorV8('neutralHue', 200, props.theme);
|
|
20
|
+
const disabledForegroundColor = getColorV8('neutralHue', 400, props.theme);
|
|
21
|
+
return css(["border-color:", ";background-color:", ";color:", ";&:hover{border-color:", ";background-color:", ";color:", ";}", " &:active{border-color:", ";background-color:", ";color:", ";}&[aria-disabled='true']{border-color:", ";background-color:", ";color:", ";}"], props.isDragging ? activeColor : getColorV8('neutralHue', 600, props.theme), props.isDragging && rgba(baseColor, 0.2), props.isDragging ? activeColor : baseColor, hoverColor, rgba(baseColor, 0.08), hoverColor, focusStyles({
|
|
22
|
+
theme: props.theme,
|
|
23
|
+
hue: baseColor
|
|
24
|
+
}), activeColor, rgba(baseColor, 0.2), activeColor, disabledForegroundColor, disabledBackgroundColor, disabledForegroundColor);
|
|
25
|
+
};
|
|
26
|
+
const sizeStyles = props => {
|
|
27
|
+
const marginTop = `${props.theme.space.base * (props.isCompact ? 1 : 2)}px`;
|
|
28
|
+
const paddingHorizontal = `${props.isCompact ? 2 : 4}em`;
|
|
29
|
+
const paddingVertical = math(`${props.theme.space.base * (props.isCompact ? 2.5 : 5)} - ${props.theme.borderWidths.sm}`);
|
|
30
|
+
const fontSize = props.theme.fontSizes.md;
|
|
31
|
+
const lineHeight = getLineHeight(props.theme.space.base * 5, fontSize);
|
|
32
|
+
return css(["padding:", " ", ";min-width:4em;line-height:", ";font-size:", ";", ":not([hidden]) + &&,", " + &&,", " + &&,&& + ", ",&& + ", "{margin-top:", ";}"], paddingVertical, paddingHorizontal, lineHeight, fontSize, StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, marginTop);
|
|
33
|
+
};
|
|
34
|
+
const StyledFileUpload = styled.div.attrs({
|
|
35
|
+
'data-garden-id': COMPONENT_ID,
|
|
36
|
+
'data-garden-version': '8.76.0'
|
|
37
|
+
}).withConfig({
|
|
38
|
+
displayName: "StyledFileUpload",
|
|
39
|
+
componentId: "sc-1rodjgn-0"
|
|
40
|
+
})(["display:flex;align-items:center;justify-content:center;box-sizing:border-box;direction:", ";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;border:dashed ", ";border-radius:", ";cursor:pointer;text-align:center;user-select:none;", ";&[aria-disabled='true']{cursor:default;}", ";", ";"], props => props.theme.rtl ? 'rtl' : 'ltr', props => props.theme.borderWidths.sm, props => props.theme.borderRadii.md, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
41
|
+
StyledFileUpload.defaultProps = {
|
|
42
|
+
theme: DEFAULT_THEME
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { StyledFileUpload };
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { StyledTextInput } from '../text/StyledTextInput.js';
|
|
10
|
+
import { StyledLabel } from '../common/StyledLabel.js';
|
|
11
|
+
import { StyledHint } from '../common/StyledHint.js';
|
|
12
|
+
import { StyledMessage } from '../common/StyledMessage.js';
|
|
13
|
+
|
|
14
|
+
const COMPONENT_ID = 'forms.input_group';
|
|
15
|
+
const positionStyles = props => {
|
|
16
|
+
const topMargin = `${props.theme.space.base * (props.isCompact ? 1 : 2)}px`;
|
|
17
|
+
return css(["", ":not([hidden]) + &&,", " + &&,", " + &&,&& + ", ",&& + ", "{margin-top:", ";}& > ", "{position:relative;flex:1 1 auto;margin-top:0;margin-bottom:0;width:auto;min-width:0;}"], StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, topMargin, StyledTextInput);
|
|
18
|
+
};
|
|
19
|
+
const itemStyles = props => {
|
|
20
|
+
const startDirection = props.theme.rtl ? 'right' : 'left';
|
|
21
|
+
const endDirection = props.theme.rtl ? 'left' : 'right';
|
|
22
|
+
return css(["& > *{z-index:-1;}& > ", "{z-index:0;}& > ", ":disabled{z-index:-2;}& > ", ":hover,& > button:hover,& > ", ":focus-visible,& > button:focus-visible,& > ", "[data-garden-focus-visible],& > button[data-garden-focus-visible],& > ", ":active,& > button:active,& > button[aria-pressed='true'],& > button[aria-pressed='mixed']{z-index:1;}& > button:disabled{border-top-width:0;border-bottom-width:0;}& > *:not(:first-child){margin-", ":-", ";}& > *:first-child:not(:last-child){border-top-", "-radius:0;border-bottom-", "-radius:0;}& > *:last-child:not(:first-child){border-top-", "-radius:0;border-bottom-", "-radius:0;}& > *:not(:first-child):not(:last-child){border-radius:0;}"], StyledTextInput, StyledTextInput, StyledTextInput, StyledTextInput, StyledTextInput, StyledTextInput, startDirection, props.theme.borderWidths.sm, endDirection, endDirection, startDirection, startDirection);
|
|
23
|
+
};
|
|
24
|
+
const StyledInputGroup = styled.div.attrs({
|
|
25
|
+
'data-garden-id': COMPONENT_ID,
|
|
26
|
+
'data-garden-version': '8.76.0'
|
|
27
|
+
}).withConfig({
|
|
28
|
+
displayName: "StyledInputGroup",
|
|
29
|
+
componentId: "sc-kjh1f0-0"
|
|
30
|
+
})(["display:inline-flex;position:relative;flex-wrap:nowrap;align-items:stretch;z-index:0;width:100%;", ";", ";", ";"], props => positionStyles(props), props => itemStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
31
|
+
StyledInputGroup.defaultProps = {
|
|
32
|
+
theme: DEFAULT_THEME
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { StyledInputGroup };
|
|
@@ -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.radio_hint';
|
|
13
|
+
const StyledRadioHint = styled(StyledHint).attrs({
|
|
14
|
+
'data-garden-id': COMPONENT_ID,
|
|
15
|
+
'data-garden-version': '8.76.0'
|
|
16
|
+
}).withConfig({
|
|
17
|
+
displayName: "StyledRadioHint",
|
|
18
|
+
componentId: "sc-eo8twg-0"
|
|
19
|
+
})(["padding-", ":", ";", ";"], props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 6px`), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
+
StyledRadioHint.defaultProps = {
|
|
21
|
+
theme: DEFAULT_THEME
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { StyledRadioHint };
|
|
@@ -0,0 +1,61 @@
|
|
|
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, focusStyles } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledRadioLabel } from './StyledRadioLabel.js';
|
|
11
|
+
import { StyledMessage } from '../common/StyledMessage.js';
|
|
12
|
+
|
|
13
|
+
const COMPONENT_ID = 'forms.radio';
|
|
14
|
+
const colorStyles = props => {
|
|
15
|
+
const SHADE = 600;
|
|
16
|
+
const borderColor = getColorV8('neutralHue', SHADE - 300, props.theme);
|
|
17
|
+
const backgroundColor = getColorV8('background', 600 , props.theme);
|
|
18
|
+
const iconColor = backgroundColor;
|
|
19
|
+
const hoverBackgroundColor = getColorV8('primaryHue', SHADE, props.theme, 0.08);
|
|
20
|
+
const hoverBorderColor = getColorV8('primaryHue', SHADE, props.theme);
|
|
21
|
+
const focusBorderColor = hoverBorderColor;
|
|
22
|
+
const activeBackgroundColor = getColorV8('primaryHue', SHADE, props.theme, 0.2);
|
|
23
|
+
const activeBorderColor = focusBorderColor;
|
|
24
|
+
const checkedBorderColor = focusBorderColor;
|
|
25
|
+
const checkedBackgroundColor = checkedBorderColor;
|
|
26
|
+
const checkedHoverBorderColor = getColorV8('primaryHue', SHADE + 100, props.theme);
|
|
27
|
+
const checkedHoverBackgroundColor = checkedHoverBorderColor;
|
|
28
|
+
const checkedActiveBorderColor = getColorV8('primaryHue', SHADE + 200, props.theme);
|
|
29
|
+
const checkedActiveBackgroundColor = checkedActiveBorderColor;
|
|
30
|
+
const disabledBackgroundColor = getColorV8('neutralHue', SHADE - 400, props.theme);
|
|
31
|
+
return css(["& ~ ", "::before{border-color:", ";background-color:", ";}& ~ ", " > svg{color:", ";}& ~ ", ":hover::before{border-color:", ";background-color:", ";}", " & ~ ", ":active::before{border-color:", ";background-color:", ";}&:checked ~ ", "::before{border-color:", ";background-color:", ";}&:enabled:checked ~ ", ":hover::before{border-color:", ";background-color:", ";}&:enabled:checked ~ ", ":active::before{border-color:", ";background-color:", ";}&:disabled ~ ", "::before{border-color:transparent;background-color:", ";}"], StyledRadioLabel, borderColor, backgroundColor, StyledRadioLabel, iconColor, StyledRadioLabel, hoverBorderColor, hoverBackgroundColor, focusStyles({
|
|
32
|
+
theme: props.theme,
|
|
33
|
+
styles: {
|
|
34
|
+
borderColor: focusBorderColor
|
|
35
|
+
},
|
|
36
|
+
selector: `&:focus-visible ~ ${StyledRadioLabel}::before, &[data-garden-focus-visible='true'] ~ ${StyledRadioLabel}::before`
|
|
37
|
+
}), StyledRadioLabel, activeBorderColor, activeBackgroundColor, StyledRadioLabel, checkedBorderColor, checkedBackgroundColor, StyledRadioLabel, checkedHoverBorderColor, checkedHoverBackgroundColor, StyledRadioLabel, checkedActiveBorderColor, checkedActiveBackgroundColor, StyledRadioLabel, disabledBackgroundColor);
|
|
38
|
+
};
|
|
39
|
+
const sizeStyles = props => {
|
|
40
|
+
const lineHeight = `${props.theme.space.base * 5}px`;
|
|
41
|
+
const size = `${props.theme.space.base * 4}px`;
|
|
42
|
+
const top = math(`(${lineHeight} - ${size}) / 2`);
|
|
43
|
+
const iconSize = props.theme.iconSizes.sm;
|
|
44
|
+
const iconPosition = math(`(${size} - ${iconSize}) / 2`);
|
|
45
|
+
const iconTop = math(`${iconPosition} + ${top}`);
|
|
46
|
+
const marginTop = `${props.theme.space.base * (props.isCompact ? 1 : 2)}px`;
|
|
47
|
+
return css(["top:", ";width:", ";height:", ";& ~ ", "::before{top:", ";background-size:", ";width:", ";height:", ";box-sizing:border-box;}& ~ ", " > svg{top:", ";", ":", ";width:", ";height:", ";}&& ~ ", " ~ ", "{margin-top:", ";}"], top, size, size, StyledRadioLabel, top, props.theme.iconSizes.sm, size, size, StyledRadioLabel, iconTop, props.theme.rtl ? 'right' : 'left', iconPosition, iconSize, iconSize, StyledRadioLabel, StyledMessage, marginTop);
|
|
48
|
+
};
|
|
49
|
+
const StyledRadioInput = styled.input.attrs({
|
|
50
|
+
'data-garden-id': COMPONENT_ID,
|
|
51
|
+
'data-garden-version': '8.76.0',
|
|
52
|
+
type: 'radio'
|
|
53
|
+
}).withConfig({
|
|
54
|
+
displayName: "StyledRadioInput",
|
|
55
|
+
componentId: "sc-qsavpv-0"
|
|
56
|
+
})(["position:absolute;opacity:0;margin:0;& ~ ", "::before{position:absolute;", ":0;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:", ";border-radius:50%;background-repeat:no-repeat;background-position:center;content:'';}& ~ ", " > svg{position:absolute;}", ";&:focus ~ ", "::before{outline:none;}& ~ ", ":active::before{transition:border-color 0.1s ease-in-out,background-color 0.1s ease-in-out,color 0.1s ease-in-out;}", ";&:disabled ~ ", "{cursor:default;}", ";"], StyledRadioLabel, props => props.theme.rtl ? 'right' : 'left', props => props.theme.borders.sm, StyledRadioLabel, props => sizeStyles(props), StyledRadioLabel, StyledRadioLabel, props => colorStyles(props), StyledRadioLabel, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
57
|
+
StyledRadioInput.defaultProps = {
|
|
58
|
+
theme: DEFAULT_THEME
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { StyledRadioInput };
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { StyledLabel } from '../common/StyledLabel.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.radio_label';
|
|
12
|
+
const sizeStyles = props => {
|
|
13
|
+
const size = props.theme.space.base * 4;
|
|
14
|
+
const padding = size + props.theme.space.base * 2;
|
|
15
|
+
const lineHeight = props.theme.space.base * 5;
|
|
16
|
+
return css(["padding-", ":", "px;&[hidden]{padding-", ":", "px;line-height:", "px;}"], props.theme.rtl ? 'right' : 'left', padding, props.theme.rtl ? 'right' : 'left', size, lineHeight);
|
|
17
|
+
};
|
|
18
|
+
const StyledRadioLabel = styled(StyledLabel).attrs({
|
|
19
|
+
'data-garden-id': COMPONENT_ID,
|
|
20
|
+
'data-garden-version': '8.76.0',
|
|
21
|
+
isRadio: true
|
|
22
|
+
}).withConfig({
|
|
23
|
+
displayName: "StyledRadioLabel",
|
|
24
|
+
componentId: "sc-1aq2e5t-0"
|
|
25
|
+
})(["display:inline-block;position:relative;cursor:pointer;", ";", ";"], props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
26
|
+
StyledRadioLabel.defaultProps = {
|
|
27
|
+
theme: DEFAULT_THEME
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { StyledRadioLabel };
|
|
@@ -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 { StyledMessage } from '../common/StyledMessage.js';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'forms.radio_message';
|
|
13
|
+
const StyledRadioMessage = styled(StyledMessage).attrs({
|
|
14
|
+
'data-garden-id': COMPONENT_ID,
|
|
15
|
+
'data-garden-version': '8.76.0'
|
|
16
|
+
}).withConfig({
|
|
17
|
+
displayName: "StyledRadioMessage",
|
|
18
|
+
componentId: "sc-1pmi0q8-0"
|
|
19
|
+
})(["padding-", ":", ";", ";"], props => props.theme.rtl ? 'right' : 'left', props => math(`${props.theme.space.base} * 6px`), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
+
StyledRadioMessage.defaultProps = {
|
|
21
|
+
theme: DEFAULT_THEME
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { StyledRadioMessage };
|
|
@@ -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 SvgCircleSmFill from '../../node_modules/@zendeskgarden/svg-icons/src/12/circle-sm-fill.svg.js';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledRadioInput } from './StyledRadioInput.js';
|
|
11
|
+
import { StyledRadioLabel } from './StyledRadioLabel.js';
|
|
12
|
+
|
|
13
|
+
const COMPONENT_ID = 'forms.radio_svg';
|
|
14
|
+
const StyledRadioSvg = styled(SvgCircleSmFill).attrs({
|
|
15
|
+
'data-garden-id': COMPONENT_ID,
|
|
16
|
+
'data-garden-version': '8.76.0'
|
|
17
|
+
}).withConfig({
|
|
18
|
+
displayName: "StyledRadioSvg",
|
|
19
|
+
componentId: "sc-1r1qtr1-0"
|
|
20
|
+
})(["transition:opacity 0.25s ease-in-out;opacity:0;", ":checked ~ ", " > &{opacity:1;}", ";"], StyledRadioInput, StyledRadioLabel, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
21
|
+
StyledRadioSvg.defaultProps = {
|
|
22
|
+
theme: DEFAULT_THEME
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { StyledRadioSvg };
|
|
@@ -0,0 +1,160 @@
|
|
|
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, getFocusBoxShadow } 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.range';
|
|
15
|
+
const thumbStyles = function (styles) {
|
|
16
|
+
let modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
17
|
+
return `
|
|
18
|
+
&${modifier}::-moz-range-thumb {
|
|
19
|
+
${styles}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&${modifier}::-ms-thumb {
|
|
23
|
+
${styles}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&${modifier}::-webkit-slider-thumb {
|
|
27
|
+
${styles}
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
};
|
|
31
|
+
const trackStyles = function (styles) {
|
|
32
|
+
let modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
33
|
+
return `
|
|
34
|
+
&${modifier}::-moz-range-track {
|
|
35
|
+
${styles}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&${modifier}::-ms-track {
|
|
39
|
+
${styles}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&${modifier}::-webkit-slider-runnable-track {
|
|
43
|
+
${styles}
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
};
|
|
47
|
+
const trackLowerStyles = function (styles) {
|
|
48
|
+
let modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
49
|
+
return `
|
|
50
|
+
&${modifier}::-moz-range-progress {
|
|
51
|
+
${styles}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&${modifier}::-ms-fill-lower {
|
|
55
|
+
${styles}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
};
|
|
59
|
+
const colorStyles = props => {
|
|
60
|
+
const SHADE = 600;
|
|
61
|
+
const thumbBackgroundColor = getColorV8('primaryHue', SHADE, props.theme);
|
|
62
|
+
const thumbBorderColor = thumbBackgroundColor;
|
|
63
|
+
const thumbBoxShadow = props.theme.shadows.lg(math(`${props.theme.space.base} * 1px`), math(`${props.theme.space.base} * 2px`), getColorV8('neutralHue', SHADE + 200, props.theme, 0.24));
|
|
64
|
+
const thumbFocusBoxShadow = getFocusBoxShadow({
|
|
65
|
+
theme: props.theme
|
|
66
|
+
});
|
|
67
|
+
const thumbActiveBackgroundColor = getColorV8('primaryHue', SHADE + 100, props.theme);
|
|
68
|
+
const thumbActiveBorderColor = thumbBorderColor;
|
|
69
|
+
const thumbDisabledBackgroundColor = getColorV8('neutralHue', SHADE - 300, props.theme);
|
|
70
|
+
const thumbDisabledBorderColor = thumbDisabledBackgroundColor;
|
|
71
|
+
const thumbHoverBackgroundColor = thumbActiveBackgroundColor;
|
|
72
|
+
const thumbHoverBorderColor = thumbHoverBackgroundColor;
|
|
73
|
+
const trackBackgroundColor = getColorV8('neutralHue', SHADE - 400, props.theme);
|
|
74
|
+
const trackLowerBackgroundColor = props.hasLowerTrack ? thumbBackgroundColor : '';
|
|
75
|
+
const trackBackgroundImage = props.hasLowerTrack ? `linear-gradient(${trackLowerBackgroundColor}, ${trackLowerBackgroundColor})` : '';
|
|
76
|
+
const trackDisabledLowerBackgroundColor = props.hasLowerTrack ? thumbDisabledBackgroundColor : '';
|
|
77
|
+
const trackDisabledBackgroundImage = props.hasLowerTrack ? `linear-gradient(${trackDisabledLowerBackgroundColor}, ${trackDisabledLowerBackgroundColor})` : '';
|
|
78
|
+
return css(["", " ", " ", " ", " ", " ", " ", " ", " ", ""], trackStyles(`
|
|
79
|
+
background-color: ${trackBackgroundColor};
|
|
80
|
+
background-image: ${trackBackgroundImage}; /* provide means for styling lower range on WebKit */
|
|
81
|
+
`), thumbStyles(`
|
|
82
|
+
border-color: ${thumbBorderColor};
|
|
83
|
+
box-shadow: ${thumbBoxShadow};
|
|
84
|
+
background-color: ${thumbBackgroundColor};
|
|
85
|
+
`), trackLowerStyles(`
|
|
86
|
+
background-color: ${trackLowerBackgroundColor};
|
|
87
|
+
`), thumbStyles(`
|
|
88
|
+
transition:
|
|
89
|
+
border-color .25s ease-in-out,
|
|
90
|
+
background-color .25s ease-in-out;
|
|
91
|
+
border-color: ${thumbHoverBorderColor};
|
|
92
|
+
background-color: ${thumbHoverBackgroundColor};
|
|
93
|
+
`, ':hover'), thumbStyles(`
|
|
94
|
+
box-shadow: ${thumbFocusBoxShadow};
|
|
95
|
+
`, '[data-garden-focus-visible="true"]'), thumbStyles(`
|
|
96
|
+
border-color: ${thumbActiveBorderColor};
|
|
97
|
+
background-color: ${thumbActiveBackgroundColor};
|
|
98
|
+
`, ':active'), trackStyles(`
|
|
99
|
+
background-image: ${trackDisabledBackgroundImage};
|
|
100
|
+
`, ':disabled'), thumbStyles(`
|
|
101
|
+
border-color: ${thumbDisabledBorderColor};
|
|
102
|
+
box-shadow: none;
|
|
103
|
+
background-color: ${thumbDisabledBackgroundColor};
|
|
104
|
+
`, ':disabled'), trackLowerStyles(`
|
|
105
|
+
background-color: ${trackDisabledLowerBackgroundColor};
|
|
106
|
+
`, ':disabled'));
|
|
107
|
+
};
|
|
108
|
+
const sizeStyles = props => {
|
|
109
|
+
const thumbSize = math(`${props.theme.space.base} * 5px`);
|
|
110
|
+
const trackHeight = math(`${props.theme.space.base} * 1.5px`);
|
|
111
|
+
const trackBorderRadius = trackHeight;
|
|
112
|
+
const trackMargin = math(`(${thumbSize} - ${trackHeight}) / 2 + ${props.theme.shadowWidths.md}`);
|
|
113
|
+
const thumbMargin = math(`(${trackHeight} - ${thumbSize}) / 2`);
|
|
114
|
+
return css(["", ":not([hidden]) + &,", " + &,", " + &,& + ", ",& + ", "{margin-top:", ";}", ";", " ", ""], StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, math(`${props.theme.space.base} * 2px`), trackStyles(`
|
|
115
|
+
margin: ${trackMargin} 0;
|
|
116
|
+
border-radius: ${trackBorderRadius};
|
|
117
|
+
height: ${trackHeight};
|
|
118
|
+
`), thumbStyles(`
|
|
119
|
+
margin: ${thumbMargin} 0; /* reset for IE */
|
|
120
|
+
width: ${thumbSize};
|
|
121
|
+
height: ${thumbSize};
|
|
122
|
+
`), trackLowerStyles(`
|
|
123
|
+
border-top-${props.theme.rtl ? 'right' : 'left'}-radius: ${trackBorderRadius};
|
|
124
|
+
border-bottom-${props.theme.rtl ? 'right' : 'left'}-radius: ${trackBorderRadius};
|
|
125
|
+
height: ${trackHeight};
|
|
126
|
+
`));
|
|
127
|
+
};
|
|
128
|
+
const StyledRangeInput = styled.input.attrs(props => ({
|
|
129
|
+
'data-garden-id': COMPONENT_ID,
|
|
130
|
+
'data-garden-version': '8.76.0',
|
|
131
|
+
type: 'range',
|
|
132
|
+
style: {
|
|
133
|
+
backgroundSize: props.hasLowerTrack && props.backgroundSize
|
|
134
|
+
}
|
|
135
|
+
})).withConfig({
|
|
136
|
+
displayName: "StyledRangeInput",
|
|
137
|
+
componentId: "sc-1iv2yqp-0"
|
|
138
|
+
})(["appearance:none;direction:", ";margin:0;background-color:inherit;cursor:pointer;padding:0;width:100%;vertical-align:middle;", " &::-webkit-slider-container,&::-webkit-slider-runnable-track{background-size:inherit;}", ";", " ", ";&::-moz-focus-outer{border:0;}&::-ms-tooltip{display:none;}&:focus{outline:none;}&:disabled{cursor:default;}", ";"], props => props.theme.rtl && 'rtl', props => trackStyles(`
|
|
139
|
+
appearance: none;
|
|
140
|
+
border-color: transparent; /* reset for IE */
|
|
141
|
+
background-repeat: repeat-y;
|
|
142
|
+
background-size: 0;
|
|
143
|
+
background-position: ${props.theme.rtl ? '100% 100%' : '0% 0%'};
|
|
144
|
+
width: 99.8%; /* fix for IE which cuts off the upper track's border radius */
|
|
145
|
+
color: transparent; /* reset for IE */
|
|
146
|
+
box-sizing: border-box; /* reset for IE */
|
|
147
|
+
`), props => sizeStyles(props), props => thumbStyles(`
|
|
148
|
+
appearance: none;
|
|
149
|
+
transition: box-shadow .1s ease-in-out;
|
|
150
|
+
border: ${props.theme.borders.md};
|
|
151
|
+
border-radius: 100%;
|
|
152
|
+
box-sizing: border-box;
|
|
153
|
+
`), props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
154
|
+
StyledRangeInput.defaultProps = {
|
|
155
|
+
backgroundSize: '0%',
|
|
156
|
+
hasLowerTrack: true,
|
|
157
|
+
theme: DEFAULT_THEME
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export { StyledRangeInput };
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
import { StyledLabel } from '../common/StyledLabel.js';
|
|
12
|
+
import { StyledMessage } from '../common/StyledMessage.js';
|
|
13
|
+
|
|
14
|
+
const COMPONENT_ID = 'forms.slider';
|
|
15
|
+
const StyledSlider = styled.div.attrs({
|
|
16
|
+
'data-garden-id': COMPONENT_ID,
|
|
17
|
+
'data-garden-version': '8.76.0'
|
|
18
|
+
}).withConfig({
|
|
19
|
+
displayName: "StyledSlider",
|
|
20
|
+
componentId: "sc-1di437a-0"
|
|
21
|
+
})(["display:block;position:relative;z-index:0;cursor:pointer;height:", ";&[aria-disabled='true']{cursor:default;}", ":not([hidden]) + &,", " + &,", " + &,& + ", ",& + ", "{margin-top:", ";}", ";"], props => math(`(${props.theme.space.base} * 5px) + (${props.theme.shadowWidths.md} * 2)`), StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, props => math(`${props.theme.space.base} * 2px`), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
22
|
+
StyledSlider.defaultProps = {
|
|
23
|
+
theme: DEFAULT_THEME
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { StyledSlider };
|
|
@@ -0,0 +1,45 @@
|
|
|
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, focusStyles } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.slider_thumb';
|
|
12
|
+
const colorStyles = props => {
|
|
13
|
+
const SHADE = 600;
|
|
14
|
+
const backgroundColor = getColorV8('primaryHue', SHADE, props.theme);
|
|
15
|
+
const borderColor = backgroundColor;
|
|
16
|
+
const boxShadow = props.theme.shadows.lg(math(`${props.theme.space.base} * 1px`), math(`${props.theme.space.base} * 2px`), getColorV8('neutralHue', SHADE + 200, props.theme, 0.24));
|
|
17
|
+
const activeBackgroundColor = getColorV8('primaryHue', SHADE + 100, props.theme);
|
|
18
|
+
const activeBorderColor = borderColor;
|
|
19
|
+
const hoverBackgroundColor = activeBackgroundColor;
|
|
20
|
+
const hoverBorderColor = hoverBackgroundColor;
|
|
21
|
+
const disabledBackgroundColor = getColorV8('neutralHue', SHADE - 300, props.theme);
|
|
22
|
+
const disabledBorderColor = disabledBackgroundColor;
|
|
23
|
+
return css(["border-color:", ";box-shadow:", ";background-color:", ";&:hover,&[data-garden-hover='true']{border-color:", ";background-color:", ";}", " &:active,&[data-garden-active='true']{border-color:", ";background-color:", ";}&[aria-disabled='true']{border-color:", ";box-shadow:none;background-color:", ";}"], borderColor, boxShadow, backgroundColor, hoverBorderColor, hoverBackgroundColor, focusStyles({
|
|
24
|
+
theme: props.theme
|
|
25
|
+
}), activeBorderColor, activeBackgroundColor, disabledBorderColor, disabledBackgroundColor);
|
|
26
|
+
};
|
|
27
|
+
const sizeStyles = props => {
|
|
28
|
+
const size = math(`${props.theme.space.base} * 5px`);
|
|
29
|
+
const marginTop = math(`${size} / -2`);
|
|
30
|
+
return css(["margin-top:", ";width:", ";height:", ";"], marginTop, size, size);
|
|
31
|
+
};
|
|
32
|
+
const StyledSliderThumb = styled.div.attrs(props => ({
|
|
33
|
+
'data-garden-id': COMPONENT_ID,
|
|
34
|
+
'data-garden-version': '8.76.0',
|
|
35
|
+
'aria-disabled': props.isDisabled
|
|
36
|
+
})).withConfig({
|
|
37
|
+
displayName: "StyledSliderThumb",
|
|
38
|
+
componentId: "sc-yspbwa-0"
|
|
39
|
+
})(["appearance:none;position:absolute;top:50%;", ":", ";transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out;z-index:1;border:", ";border-radius:100%;cursor:inherit;box-sizing:border-box;font-size:0;", ";", ";", ";"], props => props.theme.rtl ? 'right' : 'left', props => math(`${props.position} * 1px`), props => props.theme.borders.md, props => sizeStyles(props), props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
40
|
+
StyledSliderThumb.defaultProps = {
|
|
41
|
+
position: 0,
|
|
42
|
+
theme: DEFAULT_THEME
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { StyledSliderThumb };
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.slider_track';
|
|
12
|
+
const colorStyles = props => {
|
|
13
|
+
const SHADE = 600;
|
|
14
|
+
const backgroundColor = getColorV8('neutralHue', SHADE - 400, props.theme);
|
|
15
|
+
const backgroundImageColor = getColorV8('primaryHue', SHADE, props.theme);
|
|
16
|
+
const disabledBackgroundColor = getColorV8('neutralHue', SHADE - 300, props.theme);
|
|
17
|
+
return css(["background-color:", ";background-image:linear-gradient(", ",", ");&[aria-disabled='true']{background-image:linear-gradient(", ",", ");}"], backgroundColor, backgroundImageColor, backgroundImageColor, disabledBackgroundColor, disabledBackgroundColor);
|
|
18
|
+
};
|
|
19
|
+
const sizeStyles = props => {
|
|
20
|
+
const height = math(`${props.theme.space.base} * 1.5px`);
|
|
21
|
+
const backgroundPosition = math(`${props.backgroundPosition} * 1px`);
|
|
22
|
+
const backgroundSize = math(`${props.backgroundSize} * 1px`);
|
|
23
|
+
const borderRadius = height;
|
|
24
|
+
const marginTop = math(`${height} / -2`);
|
|
25
|
+
const padding = math(`${props.theme.space.base} * 2.5px`);
|
|
26
|
+
return css(["margin-top:", ";border-radius:", ";background-position:", ";background-size:", ";padding:0 ", ";"], marginTop, borderRadius, backgroundPosition, backgroundSize, padding);
|
|
27
|
+
};
|
|
28
|
+
const StyledSliderTrack = styled.div.attrs(props => ({
|
|
29
|
+
'data-garden-id': COMPONENT_ID,
|
|
30
|
+
'data-garden-version': '8.76.0',
|
|
31
|
+
'aria-disabled': props.isDisabled
|
|
32
|
+
})).withConfig({
|
|
33
|
+
displayName: "StyledSliderTrack",
|
|
34
|
+
componentId: "sc-aw5m6g-0"
|
|
35
|
+
})(["position:absolute;top:50%;box-sizing:border-box;background-origin:content-box;background-repeat:repeat-y;width:100%;", ";", ";", ";"], props => sizeStyles(props), props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
36
|
+
StyledSliderTrack.defaultProps = {
|
|
37
|
+
backgroundSize: 0,
|
|
38
|
+
backgroundPosition: 0,
|
|
39
|
+
theme: DEFAULT_THEME
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { StyledSliderTrack };
|
|
@@ -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 { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'forms.slider_track_rail';
|
|
12
|
+
const sizeStyles = props => {
|
|
13
|
+
const height = math(`${props.theme.space.base} * 1.5px`);
|
|
14
|
+
const margin = math(`${props.theme.space.base} * 2.5px`);
|
|
15
|
+
return css(["margin:0 ", " 0 ", ";height:", ";"], props.theme.rtl ? `-${margin}` : margin, props.theme.rtl ? margin : `-${margin}`, height);
|
|
16
|
+
};
|
|
17
|
+
const StyledSliderTrackRail = styled.div.attrs({
|
|
18
|
+
'data-garden-id': COMPONENT_ID,
|
|
19
|
+
'data-garden-version': '8.76.0'
|
|
20
|
+
}).withConfig({
|
|
21
|
+
displayName: "StyledSliderTrackRail",
|
|
22
|
+
componentId: "sc-1o5owbd-0"
|
|
23
|
+
})(["position:relative;", ";", ";"], props => sizeStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
24
|
+
StyledSliderTrackRail.defaultProps = {
|
|
25
|
+
theme: DEFAULT_THEME
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { StyledSliderTrackRail };
|
|
@@ -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 { getColorV8, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledTextInput } from '../text/StyledTextInput.js';
|
|
11
|
+
import { StyledTextMediaFigure } from '../text/StyledTextMediaFigure.js';
|
|
12
|
+
|
|
13
|
+
const COMPONENT_ID = 'forms.select';
|
|
14
|
+
const colorStyles = props => {
|
|
15
|
+
const color = getColorV8('neutralHue', 700, props.theme);
|
|
16
|
+
return css(["&:hover + ", ",&:focus + ", ",&:focus-visible + ", ",&[data-garden-focus-visible='true'] + ", "{color:", ";}"], StyledTextMediaFigure, StyledTextMediaFigure, StyledTextMediaFigure, StyledTextMediaFigure, color);
|
|
17
|
+
};
|
|
18
|
+
const sizeStyles = props => {
|
|
19
|
+
const padding = math(`${props.theme.iconSizes.md} + ${props.theme.space.base * 5}`);
|
|
20
|
+
const iconVerticalPosition = `${props.theme.space.base * (props.isCompact ? 1.5 : 2.5) + 1}px`;
|
|
21
|
+
const iconHorizontalPosition = `${props.theme.space.base * 3}px`;
|
|
22
|
+
return css(["padding-", ":", ";& + ", "{top:", ";", ":", ";}"], props.theme.rtl ? 'left' : 'right', !props.isBare && padding, StyledTextMediaFigure, iconVerticalPosition, props.theme.rtl ? 'left' : 'right', iconHorizontalPosition);
|
|
23
|
+
};
|
|
24
|
+
const StyledSelect = styled(StyledTextInput).attrs({
|
|
25
|
+
'data-garden-id': COMPONENT_ID,
|
|
26
|
+
'data-garden-version': '8.76.0',
|
|
27
|
+
as: 'select'
|
|
28
|
+
}).withConfig({
|
|
29
|
+
displayName: "StyledSelect",
|
|
30
|
+
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;}"], props => sizeStyles(props), props => colorStyles(props), props => getColorV8('foreground', 600 , props.theme), StyledTextMediaFigure);
|
|
32
|
+
StyledSelect.defaultProps = {
|
|
33
|
+
theme: DEFAULT_THEME
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { StyledSelect };
|
|
@@ -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 { SELECTOR_FOCUS_VISIBLE, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledTextFauxInput } from '../text/StyledTextFauxInput.js';
|
|
10
|
+
import { StyledSelect } from './StyledSelect.js';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'forms.select_wrapper';
|
|
13
|
+
const StyledSelectWrapper = styled(StyledTextFauxInput).attrs({
|
|
14
|
+
'data-garden-id': COMPONENT_ID,
|
|
15
|
+
'data-garden-version': '8.76.0'
|
|
16
|
+
}).withConfig({
|
|
17
|
+
displayName: "StyledSelectWrapper",
|
|
18
|
+
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
|
+
};
|
|
23
|
+
|
|
24
|
+
export { StyledSelectWrapper };
|