@zendeskgarden/react-forms 9.0.0-next.2 → 9.0.0-next.20

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.
Files changed (138) hide show
  1. package/README.md +4 -4
  2. package/dist/esm/elements/Checkbox.js +97 -0
  3. package/dist/esm/elements/FileUpload.js +75 -0
  4. package/dist/esm/elements/Input.js +93 -0
  5. package/dist/esm/elements/MediaInput.js +156 -0
  6. package/dist/esm/elements/Radio.js +81 -0
  7. package/dist/esm/elements/Range.js +108 -0
  8. package/dist/esm/elements/Select.js +98 -0
  9. package/dist/esm/elements/Textarea.js +170 -0
  10. package/dist/esm/elements/Toggle.js +81 -0
  11. package/dist/esm/elements/common/Field.js +97 -0
  12. package/dist/esm/elements/common/Fieldset.js +73 -0
  13. package/dist/esm/elements/common/Hint.js +92 -0
  14. package/dist/esm/elements/common/Label.js +134 -0
  15. package/dist/esm/elements/common/Legend.js +63 -0
  16. package/dist/esm/elements/common/Message.js +113 -0
  17. package/dist/esm/elements/faux-input/FauxInput.js +100 -0
  18. package/dist/esm/elements/faux-input/components/EndIcon.js +72 -0
  19. package/dist/esm/elements/faux-input/components/StartIcon.js +72 -0
  20. package/dist/esm/elements/file-list/FileList.js +66 -0
  21. package/dist/esm/elements/file-list/components/Close.js +75 -0
  22. package/dist/esm/elements/file-list/components/Delete.js +75 -0
  23. package/dist/esm/elements/file-list/components/File.js +95 -0
  24. package/dist/esm/elements/file-list/components/Item.js +64 -0
  25. package/dist/esm/elements/file-list/utils.js +50 -0
  26. package/dist/esm/elements/input-group/InputGroup.js +75 -0
  27. package/dist/esm/elements/tiles/Tiles.js +64 -0
  28. package/dist/esm/elements/tiles/components/Description.js +64 -0
  29. package/dist/esm/elements/tiles/components/Icon.js +64 -0
  30. package/dist/esm/elements/tiles/components/Label.js +73 -0
  31. package/dist/esm/elements/tiles/components/Tile.js +89 -0
  32. package/dist/esm/index.js +26 -0
  33. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-circle-stroke.svg.js +33 -0
  34. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/check-sm-fill.svg.js +29 -0
  35. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/circle-sm-fill.svg.js +27 -0
  36. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/dash-fill.svg.js +27 -0
  37. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-document-stroke.svg.js +27 -0
  38. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-error-stroke.svg.js +27 -0
  39. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-generic-stroke.svg.js +26 -0
  40. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-image-stroke.svg.js +33 -0
  41. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-pdf-stroke.svg.js +35 -0
  42. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-presentation-stroke.svg.js +26 -0
  43. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-spreadsheet-stroke.svg.js +27 -0
  44. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/file-zip-stroke.svg.js +27 -0
  45. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/trash-stroke.svg.js +27 -0
  46. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +26 -0
  47. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js +37 -0
  48. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js +32 -0
  49. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js +33 -0
  50. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +25 -0
  51. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/circle-sm-fill.svg.js +27 -0
  52. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-document-stroke.svg.js +27 -0
  53. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-error-stroke.svg.js +27 -0
  54. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-generic-stroke.svg.js +26 -0
  55. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-image-stroke.svg.js +32 -0
  56. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-pdf-stroke.svg.js +35 -0
  57. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-presentation-stroke.svg.js +26 -0
  58. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-spreadsheet-stroke.svg.js +27 -0
  59. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/file-zip-stroke.svg.js +27 -0
  60. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/trash-stroke.svg.js +27 -0
  61. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +26 -0
  62. package/dist/esm/styled/checkbox/StyledCheckHint.js +23 -0
  63. package/dist/esm/styled/checkbox/StyledCheckInput.js +78 -0
  64. package/dist/esm/styled/checkbox/StyledCheckLabel.js +23 -0
  65. package/dist/esm/styled/checkbox/StyledCheckMessage.js +23 -0
  66. package/dist/esm/styled/checkbox/StyledCheckSvg.js +25 -0
  67. package/dist/esm/styled/checkbox/StyledDashSvg.js +25 -0
  68. package/dist/esm/styled/common/StyledField.js +22 -0
  69. package/dist/esm/styled/common/StyledFieldset.js +24 -0
  70. package/dist/esm/styled/common/StyledHint.js +25 -0
  71. package/dist/esm/styled/common/StyledLabel.js +26 -0
  72. package/dist/esm/styled/common/StyledLegend.js +24 -0
  73. package/dist/esm/styled/common/StyledMessage.js +57 -0
  74. package/dist/esm/styled/common/StyledMessageIcon.js +45 -0
  75. package/dist/esm/styled/file-list/StyledFile.js +97 -0
  76. package/dist/esm/styled/file-list/StyledFileClose.js +25 -0
  77. package/dist/esm/styled/file-list/StyledFileDelete.js +26 -0
  78. package/dist/esm/styled/file-list/StyledFileIcon.js +42 -0
  79. package/dist/esm/styled/file-list/StyledFileList.js +22 -0
  80. package/dist/esm/styled/file-list/StyledFileListItem.js +24 -0
  81. package/dist/esm/styled/file-upload/StyledFileUpload.js +116 -0
  82. package/dist/esm/styled/input-group/StyledInputGroup.js +35 -0
  83. package/dist/esm/styled/radio/StyledRadioHint.js +24 -0
  84. package/dist/esm/styled/radio/StyledRadioInput.js +122 -0
  85. package/dist/esm/styled/radio/StyledRadioLabel.js +30 -0
  86. package/dist/esm/styled/radio/StyledRadioMessage.js +24 -0
  87. package/dist/esm/styled/radio/StyledRadioSvg.js +25 -0
  88. package/dist/esm/styled/range/StyledRangeInput.js +210 -0
  89. package/dist/esm/styled/select/StyledSelect.js +60 -0
  90. package/dist/esm/styled/select/StyledSelectWrapper.js +32 -0
  91. package/dist/esm/styled/text/StyledTextFauxInput.js +69 -0
  92. package/dist/esm/styled/text/StyledTextInput.js +152 -0
  93. package/dist/esm/styled/text/StyledTextMediaFigure.js +68 -0
  94. package/dist/esm/styled/text/StyledTextMediaInput.js +24 -0
  95. package/dist/esm/styled/text/StyledTextarea.js +33 -0
  96. package/dist/esm/styled/tiles/StyledTile.js +114 -0
  97. package/dist/esm/styled/tiles/StyledTileDescription.js +34 -0
  98. package/dist/esm/styled/tiles/StyledTileIcon.js +77 -0
  99. package/dist/esm/styled/tiles/StyledTileInput.js +18 -0
  100. package/dist/esm/styled/tiles/StyledTileLabel.js +34 -0
  101. package/dist/esm/styled/toggle/StyledToggleHint.js +24 -0
  102. package/dist/esm/styled/toggle/StyledToggleInput.js +65 -0
  103. package/dist/esm/styled/toggle/StyledToggleLabel.js +28 -0
  104. package/dist/esm/styled/toggle/StyledToggleMessage.js +25 -0
  105. package/dist/esm/styled/toggle/StyledToggleSvg.js +23 -0
  106. package/dist/esm/types/index.js +11 -0
  107. package/dist/esm/utils/useFieldContext.js +15 -0
  108. package/dist/esm/utils/useFieldsetContext.js +15 -0
  109. package/dist/esm/utils/useFileContext.js +14 -0
  110. package/dist/esm/utils/useInputContext.js +14 -0
  111. package/dist/esm/utils/useInputGroupContext.js +14 -0
  112. package/dist/esm/utils/useTilesContext.js +14 -0
  113. package/dist/index.cjs.js +1239 -919
  114. package/dist/typings/elements/common/Field.d.ts +10 -9
  115. package/dist/typings/elements/common/Hint.d.ts +2 -0
  116. package/dist/typings/elements/common/Label.d.ts +2 -0
  117. package/dist/typings/elements/common/Message.d.ts +2 -0
  118. package/dist/typings/elements/faux-input/FauxInput.d.ts +1 -11
  119. package/dist/typings/elements/faux-input/components/EndIcon.d.ts +1 -1
  120. package/dist/typings/elements/faux-input/components/StartIcon.d.ts +1 -1
  121. package/dist/typings/index.d.ts +3 -4
  122. package/dist/typings/styled/file-list/StyledFileIcon.d.ts +8 -2
  123. package/dist/typings/styled/index.d.ts +0 -4
  124. package/dist/typings/styled/select/StyledSelect.d.ts +1 -4
  125. package/dist/typings/styled/select/StyledSelectWrapper.d.ts +3 -1
  126. package/dist/typings/styled/text/StyledTextFauxInput.d.ts +0 -4
  127. package/dist/typings/styled/text/StyledTextMediaFigure.d.ts +7 -7
  128. package/dist/typings/styled/text/StyledTextarea.d.ts +1 -1
  129. package/dist/typings/styled/tiles/StyledTile.d.ts +4 -7
  130. package/dist/typings/types/index.d.ts +6 -33
  131. package/dist/typings/utils/useFieldContext.d.ts +1 -2
  132. package/package.json +8 -9
  133. package/dist/index.esm.js +0 -2921
  134. package/dist/typings/elements/MultiThumbRange.d.ts +0 -14
  135. package/dist/typings/styled/range/StyledSlider.d.ts +0 -10
  136. package/dist/typings/styled/range/StyledSliderThumb.d.ts +0 -13
  137. package/dist/typings/styled/range/StyledSliderTrack.d.ts +0 -14
  138. package/dist/typings/styled/range/StyledSliderTrackRail.d.ts +0 -11
@@ -0,0 +1,122 @@
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, getColor, 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 = _ref => {
15
+ let {
16
+ theme
17
+ } = _ref;
18
+ const borderColor = getColor({
19
+ theme,
20
+ variable: 'border.emphasis'
21
+ });
22
+ const backgroundColor = getColor({
23
+ theme,
24
+ variable: 'background.default'
25
+ });
26
+ const iconColor = getColor({
27
+ theme,
28
+ variable: 'foreground.onEmphasis'
29
+ });
30
+ const backgroundOptions = {
31
+ theme,
32
+ variable: 'background.primaryEmphasis'
33
+ };
34
+ const borderOptions = {
35
+ theme,
36
+ variable: 'border.primaryEmphasis'
37
+ };
38
+ const hoverBackgroundColor = getColor({
39
+ ...backgroundOptions,
40
+ transparency: theme.opacity[100]
41
+ });
42
+ const hoverBorderColor = getColor(borderOptions);
43
+ const focusBorderColor = hoverBorderColor;
44
+ const activeBackgroundColor = getColor({
45
+ ...backgroundOptions,
46
+ transparency: theme.opacity[200]
47
+ });
48
+ const activeBorderColor = focusBorderColor;
49
+ const checkedBackgroundColor = getColor(backgroundOptions);
50
+ const checkedBorderColor = focusBorderColor;
51
+ const offset100 = {
52
+ dark: {
53
+ offset: -100
54
+ },
55
+ light: {
56
+ offset: 100
57
+ }
58
+ };
59
+ const offset200 = {
60
+ dark: {
61
+ offset: -200
62
+ },
63
+ light: {
64
+ offset: 200
65
+ }
66
+ };
67
+ const checkedHoverBackgroundColor = getColor({
68
+ ...backgroundOptions,
69
+ ...offset100
70
+ });
71
+ const checkedHoverBorderColor = getColor({
72
+ ...borderOptions,
73
+ ...offset100
74
+ });
75
+ const checkedActiveBackgroundColor = getColor({
76
+ ...backgroundOptions,
77
+ ...offset200
78
+ });
79
+ const checkedActiveBorderColor = getColor({
80
+ ...borderOptions,
81
+ ...offset200
82
+ });
83
+ const disabledBackgroundColor = getColor({
84
+ theme,
85
+ variable: 'background.disabled',
86
+ transparency: theme.opacity[300]
87
+ });
88
+ 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({
89
+ theme,
90
+ styles: {
91
+ borderColor: focusBorderColor
92
+ },
93
+ selector: `&:focus-visible ~ ${StyledRadioLabel}::before`
94
+ }), StyledRadioLabel, activeBorderColor, activeBackgroundColor, StyledRadioLabel, checkedBorderColor, checkedBackgroundColor, StyledRadioLabel, checkedHoverBorderColor, checkedHoverBackgroundColor, StyledRadioLabel, checkedActiveBorderColor, checkedActiveBackgroundColor, StyledRadioLabel, disabledBackgroundColor);
95
+ };
96
+ const sizeStyles = _ref2 => {
97
+ let {
98
+ theme,
99
+ isCompact
100
+ } = _ref2;
101
+ const lineHeight = `${theme.space.base * 5}px`;
102
+ const size = `${theme.space.base * 4}px`;
103
+ const top = math(`(${lineHeight} - ${size}) / 2`);
104
+ const iconSize = theme.iconSizes.sm;
105
+ const iconPosition = math(`(${size} - ${iconSize}) / 2`);
106
+ const iconTop = math(`${iconPosition} + ${top}`);
107
+ const marginTop = `${theme.space.base * (isCompact ? 1 : 2)}px`;
108
+ return css(["top:", ";width:", ";height:", ";& ~ ", "::before{top:", ";border:", ";background-size:", ";width:", ";height:", ";box-sizing:border-box;}& ~ ", " > svg{top:", ";", ":", ";width:", ";height:", ";}&& ~ ", " ~ ", "{margin-top:", ";}"], top, size, size, StyledRadioLabel, top, theme.borders.sm, theme.iconSizes.sm, size, size, StyledRadioLabel, iconTop, theme.rtl ? 'right' : 'left', iconPosition, iconSize, iconSize, StyledRadioLabel, StyledMessage, marginTop);
109
+ };
110
+ const StyledRadioInput = styled.input.attrs({
111
+ 'data-garden-id': COMPONENT_ID,
112
+ 'data-garden-version': '9.0.0-next.20',
113
+ type: 'radio'
114
+ }).withConfig({
115
+ displayName: "StyledRadioInput",
116
+ componentId: "sc-qsavpv-0"
117
+ })(["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-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', StyledRadioLabel, sizeStyles, StyledRadioLabel, StyledRadioLabel, colorStyles, StyledRadioLabel, props => retrieveComponentStyles(COMPONENT_ID, props));
118
+ StyledRadioInput.defaultProps = {
119
+ theme: DEFAULT_THEME
120
+ };
121
+
122
+ 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': '9.0.0-next.20',
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': '9.0.0-next.20'
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': '9.0.0-next.20'
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,210 @@
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, getColor, 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 = _ref => {
60
+ let {
61
+ theme,
62
+ hasLowerTrack
63
+ } = _ref;
64
+ const options = {
65
+ theme,
66
+ variable: 'background.primaryEmphasis'
67
+ };
68
+ const thumbBackgroundColor = getColor(options);
69
+ const thumbBorderColor = thumbBackgroundColor;
70
+ const thumbBoxShadow = theme.shadows.lg(`${theme.space.base}px`, `${theme.space.base * 2}px`, getColor({
71
+ variable: 'shadow.small',
72
+ theme
73
+ }));
74
+ const thumbFocusBoxShadow = getFocusBoxShadow({
75
+ theme
76
+ });
77
+ const thumbActiveBackgroundColor = getColor({
78
+ ...options,
79
+ dark: {
80
+ offset: -200
81
+ },
82
+ light: {
83
+ offset: 200
84
+ }
85
+ });
86
+ const thumbActiveBorderColor = thumbBorderColor;
87
+ const thumbDisabledBackgroundColor = getColor({
88
+ theme,
89
+ variable: 'border.emphasis'
90
+ });
91
+ const thumbDisabledBorderColor = thumbDisabledBackgroundColor;
92
+ const thumbHoverBackgroundColor = getColor({
93
+ ...options,
94
+ dark: {
95
+ offset: -100
96
+ },
97
+ light: {
98
+ offset: 100
99
+ }
100
+ });
101
+ const thumbHoverBorderColor = thumbHoverBackgroundColor;
102
+ const trackBackgroundColor = getColor({
103
+ theme,
104
+ variable: 'border.emphasis',
105
+ dark: {
106
+ offset: 100
107
+ },
108
+ light: {
109
+ offset: -200
110
+ }
111
+ });
112
+ const trackLowerBackgroundColor = hasLowerTrack ? thumbBackgroundColor : '';
113
+ const trackBackgroundImage = hasLowerTrack ? `linear-gradient(${trackLowerBackgroundColor}, ${trackLowerBackgroundColor})` : '';
114
+ const trackDisabledBackgroundColor = getColor({
115
+ theme,
116
+ variable: 'background.disabled',
117
+ transparency: theme.opacity[200]
118
+ });
119
+ const trackDisabledLowerBackgroundColor = hasLowerTrack ? getColor({
120
+ theme,
121
+ variable: 'border.emphasis'
122
+ }) : '';
123
+ const trackDisabledBackgroundImage = hasLowerTrack ? `linear-gradient(${trackDisabledLowerBackgroundColor}, ${trackDisabledLowerBackgroundColor})` : '';
124
+ return css(["", " ", " ", " ", " ", " ", " ", " ", " ", ""], trackStyles(`
125
+ background-color: ${trackBackgroundColor};
126
+ background-image: ${trackBackgroundImage}; /* [1] */
127
+ `), thumbStyles(`
128
+ border-color: ${thumbBorderColor};
129
+ box-shadow: ${thumbBoxShadow};
130
+ background-color: ${thumbBackgroundColor};
131
+ `), trackLowerStyles(`
132
+ background-color: ${trackLowerBackgroundColor};
133
+ `), thumbStyles(`
134
+ transition:
135
+ border-color .25s ease-in-out,
136
+ background-color .25s ease-in-out;
137
+ border-color: ${thumbHoverBorderColor};
138
+ background-color: ${thumbHoverBackgroundColor};
139
+ `, ':hover'), thumbStyles(`
140
+ box-shadow: ${thumbFocusBoxShadow};
141
+ `, ':focus-visible'), thumbStyles(`
142
+ border-color: ${thumbActiveBorderColor};
143
+ background-color: ${thumbActiveBackgroundColor};
144
+ `, ':active'), trackStyles(`
145
+ background-color: ${trackDisabledBackgroundColor};
146
+ background-image: ${trackDisabledBackgroundImage};
147
+ `, ':disabled'), thumbStyles(`
148
+ border-color: ${thumbDisabledBorderColor};
149
+ box-shadow: none;
150
+ background-color: ${thumbDisabledBackgroundColor};
151
+ `, ':disabled'), trackLowerStyles(`
152
+ background-color: ${trackDisabledLowerBackgroundColor};
153
+ `, ':disabled'));
154
+ };
155
+ const sizeStyles = _ref2 => {
156
+ let {
157
+ theme
158
+ } = _ref2;
159
+ const thumbSize = `${theme.space.base * 5}px`;
160
+ const trackHeight = `${theme.space.base * 1.5}px`;
161
+ const trackBorderRadius = trackHeight;
162
+ const trackMargin = math(`(${thumbSize} - ${trackHeight}) / 2 + ${theme.shadowWidths.md}`);
163
+ const thumbMargin = math(`(${trackHeight} - ${thumbSize}) / 2`);
164
+ return css(["", ":not([hidden]) + &,", " + &,", " + &,& + ", ",& + ", "{margin-top:", ";}", ";", " ", ""], StyledLabel, StyledHint, StyledMessage, StyledHint, StyledMessage, `${theme.space.base * 2}px`, trackStyles(`
165
+ margin: ${trackMargin} 0;
166
+ border-radius: ${trackBorderRadius};
167
+ height: ${trackHeight};
168
+ `), thumbStyles(`
169
+ margin: ${thumbMargin} 0; /* [1] */
170
+ width: ${thumbSize};
171
+ height: ${thumbSize};
172
+ `), trackLowerStyles(`
173
+ border-top-${theme.rtl ? 'right' : 'left'}-radius: ${trackBorderRadius};
174
+ border-bottom-${theme.rtl ? 'right' : 'left'}-radius: ${trackBorderRadius};
175
+ height: ${trackHeight};
176
+ `));
177
+ };
178
+ const StyledRangeInput = styled.input.attrs(props => ({
179
+ 'data-garden-id': COMPONENT_ID,
180
+ 'data-garden-version': '9.0.0-next.20',
181
+ type: 'range',
182
+ style: {
183
+ backgroundSize: props.hasLowerTrack && props.backgroundSize
184
+ }
185
+ })).withConfig({
186
+ displayName: "StyledRangeInput",
187
+ componentId: "sc-1iv2yqp-0"
188
+ })(["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(`
189
+ appearance: none;
190
+ border-color: transparent; /* reset for IE */
191
+ background-repeat: repeat-y;
192
+ background-size: 0;
193
+ background-position: ${props.theme.rtl ? '100% 100%' : '0% 0%'};
194
+ width: 99.8%; /* fix for IE which cuts off the upper track's border radius */
195
+ color: transparent; /* reset for IE */
196
+ box-sizing: border-box; /* reset for IE */
197
+ `), sizeStyles, props => thumbStyles(`
198
+ appearance: none;
199
+ transition: box-shadow .1s ease-in-out;
200
+ border: ${props.theme.borders.md};
201
+ border-radius: 100%;
202
+ box-sizing: border-box;
203
+ `), colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
204
+ StyledRangeInput.defaultProps = {
205
+ backgroundSize: '0%',
206
+ hasLowerTrack: true,
207
+ theme: DEFAULT_THEME
208
+ };
209
+
210
+ export { StyledRangeInput };
@@ -0,0 +1,60 @@
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 { getColor, 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 = _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);
33
+ };
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);
44
+ };
45
+ const StyledSelect = styled(StyledTextInput).attrs({
46
+ 'data-garden-id': COMPONENT_ID,
47
+ 'data-garden-version': '9.0.0-next.20',
48
+ as: 'select'
49
+ }).withConfig({
50
+ displayName: "StyledSelect",
51
+ componentId: "sc-8xdxpt-0"
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);
56
+ StyledSelect.defaultProps = {
57
+ theme: DEFAULT_THEME
58
+ };
59
+
60
+ export { StyledSelect };
@@ -0,0 +1,32 @@
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, 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 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
+ };
21
+ const StyledSelectWrapper = styled(StyledTextFauxInput).attrs({
22
+ 'data-garden-id': COMPONENT_ID,
23
+ 'data-garden-version': '9.0.0-next.20'
24
+ }).withConfig({
25
+ displayName: "StyledSelectWrapper",
26
+ componentId: "sc-i7b6hw-0"
27
+ })(["position:relative;padding:0;overflow:visible;", ";& > ", "{border-color:transparent;background-color:transparent;", "{box-shadow:unset;}}"], sizeStyles, StyledSelect, SELECTOR_FOCUS_VISIBLE);
28
+ StyledSelectWrapper.defaultProps = {
29
+ theme: DEFAULT_THEME
30
+ };
31
+
32
+ export { StyledSelectWrapper };
@@ -0,0 +1,69 @@
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, getColor, focusStyles } 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 colorStyles = _ref => {
14
+ let {
15
+ theme,
16
+ validation,
17
+ focusInset,
18
+ isBare,
19
+ isFocused
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
+ }
42
+ return css(["", ""], focusStyles({
43
+ theme,
44
+ inset: focusInset,
45
+ color: {
46
+ variable: borderVariable
47
+ },
48
+ selector: isFocused ? '&' : '&:focus-within',
49
+ styles: {
50
+ borderColor: focusBorderColor
51
+ },
52
+ condition: !isBare
53
+ }));
54
+ };
55
+ const StyledTextFauxInput = styled(StyledTextInput).attrs(props => ({
56
+ as: 'div',
57
+ 'aria-readonly': props.isReadOnly,
58
+ 'aria-disabled': props.isDisabled,
59
+ 'data-garden-id': COMPONENT_ID,
60
+ 'data-garden-version': '9.0.0-next.20'
61
+ })).withConfig({
62
+ displayName: "StyledTextFauxInput",
63
+ componentId: "sc-yqw7j9-0"
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));
65
+ StyledTextFauxInput.defaultProps = {
66
+ theme: DEFAULT_THEME
67
+ };
68
+
69
+ export { StyledTextFauxInput };