@zendeskgarden/react-forms 9.0.0 → 9.1.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.
Files changed (89) hide show
  1. package/LICENSE.md +176 -0
  2. package/dist/esm/elements/Checkbox.js +4 -3
  3. package/dist/esm/elements/FileUpload.js +7 -3
  4. package/dist/esm/elements/Input.js +18 -17
  5. package/dist/esm/elements/Radio.js +4 -3
  6. package/dist/esm/elements/Range.js +9 -9
  7. package/dist/esm/elements/Select.js +9 -9
  8. package/dist/esm/elements/Textarea.js +23 -13
  9. package/dist/esm/elements/Toggle.js +4 -3
  10. package/dist/esm/elements/common/Fieldset.js +10 -5
  11. package/dist/esm/elements/common/Label.js +33 -31
  12. package/dist/esm/elements/common/Legend.js +1 -3
  13. package/dist/esm/elements/common/Message.js +6 -5
  14. package/dist/esm/elements/common/MessageIcon.js +78 -0
  15. package/dist/esm/elements/faux-input/FauxInput.js +20 -8
  16. package/dist/esm/elements/file-list/components/File.js +3 -3
  17. package/dist/esm/elements/input-group/InputGroup.js +3 -3
  18. package/dist/esm/elements/tiles/components/Description.js +1 -1
  19. package/dist/esm/elements/tiles/components/Icon.js +1 -1
  20. package/dist/esm/elements/tiles/components/Label.js +1 -1
  21. package/dist/esm/styled/checkbox/StyledCheckHint.js +1 -1
  22. package/dist/esm/styled/checkbox/StyledCheckInput.js +1 -1
  23. package/dist/esm/styled/checkbox/StyledCheckLabel.js +1 -1
  24. package/dist/esm/styled/checkbox/StyledCheckMessage.js +1 -1
  25. package/dist/esm/styled/checkbox/StyledCheckSvg.js +1 -1
  26. package/dist/esm/styled/checkbox/StyledDashSvg.js +1 -1
  27. package/dist/esm/styled/common/StyledField.js +1 -1
  28. package/dist/esm/styled/common/StyledFieldset.js +2 -2
  29. package/dist/esm/styled/common/StyledHint.js +1 -1
  30. package/dist/esm/styled/common/StyledLabel.js +2 -2
  31. package/dist/esm/styled/common/StyledLegend.js +1 -1
  32. package/dist/esm/styled/common/StyledMessage.js +7 -7
  33. package/dist/esm/styled/common/StyledMessageIcon.js +3 -27
  34. package/dist/esm/styled/file-list/StyledFile.js +9 -9
  35. package/dist/esm/styled/file-list/StyledFileClose.js +1 -1
  36. package/dist/esm/styled/file-list/StyledFileDelete.js +1 -1
  37. package/dist/esm/styled/file-list/StyledFileIcon.js +1 -1
  38. package/dist/esm/styled/file-list/StyledFileList.js +1 -1
  39. package/dist/esm/styled/file-list/StyledFileListItem.js +1 -1
  40. package/dist/esm/styled/file-upload/StyledFileUpload.js +7 -7
  41. package/dist/esm/styled/input-group/StyledInputGroup.js +2 -2
  42. package/dist/esm/styled/radio/StyledRadioHint.js +1 -1
  43. package/dist/esm/styled/radio/StyledRadioInput.js +3 -3
  44. package/dist/esm/styled/radio/StyledRadioLabel.js +2 -2
  45. package/dist/esm/styled/radio/StyledRadioMessage.js +1 -1
  46. package/dist/esm/styled/radio/StyledRadioSvg.js +1 -1
  47. package/dist/esm/styled/range/StyledRangeInput.js +9 -9
  48. package/dist/esm/styled/select/StyledSelect.js +6 -6
  49. package/dist/esm/styled/select/StyledSelectWrapper.js +3 -3
  50. package/dist/esm/styled/text/StyledTextFauxInput.js +15 -15
  51. package/dist/esm/styled/text/StyledTextInput.js +22 -22
  52. package/dist/esm/styled/text/StyledTextMediaFigure.js +1 -1
  53. package/dist/esm/styled/text/StyledTextMediaInput.js +2 -2
  54. package/dist/esm/styled/text/StyledTextarea.js +2 -2
  55. package/dist/esm/styled/tiles/StyledTile.js +1 -1
  56. package/dist/esm/styled/tiles/StyledTileDescription.js +4 -4
  57. package/dist/esm/styled/tiles/StyledTileIcon.js +3 -3
  58. package/dist/esm/styled/tiles/StyledTileLabel.js +5 -5
  59. package/dist/esm/styled/toggle/StyledToggleHint.js +1 -1
  60. package/dist/esm/styled/toggle/StyledToggleInput.js +1 -1
  61. package/dist/esm/styled/toggle/StyledToggleLabel.js +1 -1
  62. package/dist/esm/styled/toggle/StyledToggleMessage.js +1 -1
  63. package/dist/esm/styled/toggle/StyledToggleSvg.js +1 -1
  64. package/dist/index.cjs.js +401 -365
  65. package/dist/typings/elements/common/MessageIcon.d.ts +9 -0
  66. package/dist/typings/styled/checkbox/StyledCheckLabel.d.ts +2 -2
  67. package/dist/typings/styled/common/StyledFieldset.d.ts +1 -1
  68. package/dist/typings/styled/common/StyledLabel.d.ts +2 -2
  69. package/dist/typings/styled/common/StyledLegend.d.ts +1 -5
  70. package/dist/typings/styled/common/StyledMessage.d.ts +1 -1
  71. package/dist/typings/styled/common/StyledMessageIcon.d.ts +2 -10
  72. package/dist/typings/styled/file-list/StyledFile.d.ts +3 -3
  73. package/dist/typings/styled/file-list/StyledFileIcon.d.ts +1 -1
  74. package/dist/typings/styled/file-upload/StyledFileUpload.d.ts +2 -2
  75. package/dist/typings/styled/input-group/StyledInputGroup.d.ts +1 -1
  76. package/dist/typings/styled/radio/StyledRadioInput.d.ts +1 -1
  77. package/dist/typings/styled/radio/StyledRadioLabel.d.ts +2 -2
  78. package/dist/typings/styled/range/StyledRangeInput.d.ts +2 -2
  79. package/dist/typings/styled/text/StyledTextFauxInput.d.ts +3 -3
  80. package/dist/typings/styled/text/StyledTextInput.d.ts +6 -6
  81. package/dist/typings/styled/text/StyledTextMediaFigure.d.ts +1 -1
  82. package/dist/typings/styled/text/StyledTextMediaInput.d.ts +2 -2
  83. package/dist/typings/styled/text/StyledTextarea.d.ts +2 -2
  84. package/dist/typings/styled/tiles/StyledTileDescription.d.ts +1 -1
  85. package/dist/typings/styled/tiles/StyledTileIcon.d.ts +1 -1
  86. package/dist/typings/styled/tiles/StyledTileLabel.d.ts +1 -1
  87. package/dist/typings/styled/toggle/StyledToggleLabel.d.ts +2 -2
  88. package/dist/typings/types/index.d.ts +6 -0
  89. package/package.json +6 -5
package/LICENSE.md ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -58,7 +58,8 @@ const Checkbox = React__default.forwardRef((_ref, ref) => {
58
58
  let {
59
59
  indeterminate,
60
60
  children,
61
- ...props
61
+ isCompact,
62
+ ...other
62
63
  } = _ref;
63
64
  const fieldsetContext = useFieldsetContext();
64
65
  const fieldContext = useFieldContext();
@@ -77,9 +78,9 @@ const Checkbox = React__default.forwardRef((_ref, ref) => {
77
78
  });
78
79
  };
79
80
  let combinedProps = {
81
+ $isCompact: fieldsetContext ? fieldsetContext.isCompact : isCompact,
80
82
  ref: combinedRef,
81
- ...props,
82
- ...fieldsetContext
83
+ ...other
83
84
  };
84
85
  if (fieldContext) {
85
86
  combinedProps = fieldContext.getInputProps(combinedProps);
@@ -54,13 +54,17 @@ import '../styled/tiles/StyledTileLabel.js';
54
54
  const FileUpload = React__default.forwardRef((_ref, ref) => {
55
55
  let {
56
56
  disabled,
57
- ...props
57
+ isCompact,
58
+ isDragging,
59
+ ...other
58
60
  } = _ref;
59
61
  return (
60
62
  React__default.createElement(StyledFileUpload, Object.assign({
61
63
  ref: ref,
62
- "aria-disabled": disabled
63
- }, props, {
64
+ "aria-disabled": disabled,
65
+ $isCompact: isCompact,
66
+ $isDragging: isDragging
67
+ }, other, {
64
68
  role: "button"
65
69
  }))
66
70
  );
@@ -58,29 +58,30 @@ import '../styled/tiles/StyledTileLabel.js';
58
58
  const Input = React__default.forwardRef((_ref, ref) => {
59
59
  let {
60
60
  onSelect,
61
- ...props
61
+ isBare,
62
+ isCompact,
63
+ focusInset,
64
+ validation,
65
+ ...other
62
66
  } = _ref;
63
67
  const fieldContext = useFieldContext();
64
68
  const inputGroupContext = useInputGroupContext();
65
- const onSelectHandler = props.readOnly ? composeEventHandlers(onSelect, event => {
66
- event.currentTarget.select();
67
- }) : onSelect;
68
- let combinedProps = {
69
- ref,
70
- onSelect: onSelectHandler,
71
- ...props
72
- };
73
- if (inputGroupContext) {
74
- combinedProps = {
75
- ...combinedProps,
76
- isCompact: inputGroupContext.isCompact || combinedProps.isCompact,
77
- focusInset: props.focusInset === undefined ? true : props.focusInset
78
- };
79
- }
69
+ let combinedProps = other;
80
70
  if (fieldContext) {
81
71
  combinedProps = fieldContext.getInputProps(combinedProps);
82
72
  }
83
- return React__default.createElement(StyledTextInput, combinedProps);
73
+ const onSelectHandler = other.readOnly ? composeEventHandlers(onSelect, event => {
74
+ event.currentTarget.select();
75
+ }) : onSelect;
76
+ return React__default.createElement(StyledTextInput, Object.assign({
77
+ ref: ref,
78
+ onSelect: onSelectHandler
79
+ }, combinedProps, {
80
+ $isBare: isBare,
81
+ $isCompact: inputGroupContext ? inputGroupContext.isCompact : isCompact,
82
+ $focusInset: inputGroupContext && focusInset === undefined ? true : focusInset,
83
+ $validation: validation
84
+ }));
84
85
  });
85
86
  Input.propTypes = {
86
87
  isCompact: PropTypes.bool,
@@ -57,14 +57,15 @@ import useFieldsetContext from '../utils/useFieldsetContext.js';
57
57
  const Radio = React__default.forwardRef((_ref, ref) => {
58
58
  let {
59
59
  children,
60
- ...props
60
+ isCompact,
61
+ ...other
61
62
  } = _ref;
62
63
  const fieldsetContext = useFieldsetContext();
63
64
  const fieldContext = useFieldContext();
64
65
  let combinedProps = {
66
+ $isCompact: fieldsetContext ? fieldsetContext.isCompact : isCompact,
65
67
  ref,
66
- ...props,
67
- ...fieldsetContext
68
+ ...other
68
69
  };
69
70
  if (fieldContext) {
70
71
  combinedProps = fieldContext.getInputProps(combinedProps);
@@ -59,7 +59,7 @@ const Range = React__default.forwardRef((_ref, ref) => {
59
59
  min,
60
60
  max,
61
61
  step,
62
- ...props
62
+ ...other
63
63
  } = _ref;
64
64
  const [backgroundSize, setBackgroundSize] = useState('0');
65
65
  const rangeRef = useRef();
@@ -78,18 +78,18 @@ const Range = React__default.forwardRef((_ref, ref) => {
78
78
  [max, min, step]);
79
79
  useEffect(() => {
80
80
  updateBackgroundWidthFromInput(rangeRef.current);
81
- }, [rangeRef, updateBackgroundWidthFromInput, props.value]);
82
- const onChange = hasLowerTrack ? composeEventHandlers(props.onChange, event => {
81
+ }, [rangeRef, updateBackgroundWidthFromInput, other.value]);
82
+ const onChange = hasLowerTrack ? composeEventHandlers(other.onChange, event => {
83
83
  updateBackgroundWidthFromInput(event.target);
84
- }) : props.onChange;
84
+ }) : other.onChange;
85
85
  let combinedProps = {
86
- ref: mergeRefs([rangeRef, ref]),
87
- hasLowerTrack,
88
- min,
86
+ $backgroundSize: backgroundSize,
87
+ $hasLowerTrack: hasLowerTrack,
89
88
  max,
89
+ min,
90
+ ref: mergeRefs([rangeRef, ref]),
90
91
  step,
91
- backgroundSize,
92
- ...props,
92
+ ...other,
93
93
  onChange
94
94
  };
95
95
  if (fieldContext) {
@@ -66,11 +66,11 @@ const Select = React__default.forwardRef((_ref, ref) => {
66
66
  } = _ref;
67
67
  const fieldContext = useFieldContext();
68
68
  let combinedProps = {
69
+ $focusInset: focusInset,
70
+ $isBare: isBare,
71
+ $isCompact: isCompact,
72
+ $validation: validation,
69
73
  disabled,
70
- isBare,
71
- isCompact,
72
- validation,
73
- focusInset,
74
74
  ref,
75
75
  ...props
76
76
  };
@@ -78,11 +78,11 @@ const Select = React__default.forwardRef((_ref, ref) => {
78
78
  combinedProps = fieldContext.getInputProps(combinedProps);
79
79
  }
80
80
  return React__default.createElement(StyledSelectWrapper, {
81
- isCompact: isCompact,
82
- isBare: isBare,
83
- isDisabled: disabled,
84
- validation: validation,
85
- focusInset: focusInset
81
+ $isCompact: isCompact,
82
+ $isBare: isBare,
83
+ $isDisabled: disabled,
84
+ $validation: validation,
85
+ $focusInset: focusInset
86
86
  }, React__default.createElement(StyledSelect, combinedProps), !isBare && React__default.createElement(FauxInput.EndIcon, {
87
87
  isDisabled: disabled
88
88
  }, React__default.createElement(SvgChevronDownStroke, null)));
@@ -60,12 +60,17 @@ const parseStyleValue = value => {
60
60
  };
61
61
  const Textarea = React__default.forwardRef((_ref, ref) => {
62
62
  let {
63
+ isCompact,
64
+ isBare,
65
+ focusInset,
66
+ isResizable,
63
67
  minRows,
64
68
  maxRows,
65
69
  style,
70
+ validation,
66
71
  onChange,
67
72
  onSelect,
68
- ...props
73
+ ...other
69
74
  } = _ref;
70
75
  const fieldContext = useFieldContext();
71
76
  const textAreaRef = useRef();
@@ -74,8 +79,8 @@ const Textarea = React__default.forwardRef((_ref, ref) => {
74
79
  overflow: false,
75
80
  height: 0
76
81
  });
77
- const isControlled = props.value !== null && props.value !== undefined;
78
- const isAutoResizable = (minRows !== undefined || maxRows !== undefined) && !props.isResizable;
82
+ const isControlled = other.value !== null && other.value !== undefined;
83
+ const isAutoResizable = (minRows !== undefined || maxRows !== undefined) && !isResizable;
79
84
  const calculateHeight = useCallback(() => {
80
85
  if (!isAutoResizable) {
81
86
  return;
@@ -127,33 +132,38 @@ const Textarea = React__default.forwardRef((_ref, ref) => {
127
132
  computedStyle.height = state.height;
128
133
  computedStyle.overflow = state.overflow ? 'hidden' : undefined;
129
134
  }
130
- const onSelectHandler = props.readOnly ? composeEventHandlers(onSelect, event => {
135
+ const onSelectHandler = other.readOnly ? composeEventHandlers(onSelect, event => {
131
136
  event.currentTarget.select();
132
137
  }) : onSelect;
133
138
  let combinedProps = {
134
- ref: mergeRefs([textAreaRef, ref]),
135
- rows: minRows,
139
+ $focusInset: focusInset,
140
+ $isBare: isBare,
141
+ $isCompact: isCompact,
142
+ $isResizable: isResizable,
143
+ $validation: validation,
136
144
  onChange: onChangeHandler,
137
145
  onSelect: onSelectHandler,
146
+ ref: mergeRefs([textAreaRef, ref]),
147
+ rows: minRows,
138
148
  style: {
139
149
  ...computedStyle,
140
150
  ...style
141
151
  },
142
- ...props
152
+ ...other
143
153
  };
144
154
  if (fieldContext) {
145
155
  combinedProps = fieldContext.getInputProps(combinedProps);
146
156
  }
147
157
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(StyledTextarea, combinedProps), !!isAutoResizable && React__default.createElement(StyledTextarea, {
158
+ $isBare: isBare,
159
+ $isCompact: isCompact,
160
+ $isHidden: true,
148
161
  "aria-hidden": true,
162
+ className: other.className,
149
163
  readOnly: true,
150
- isHidden: true,
151
- className: props.className,
152
164
  ref: shadowTextAreaRef,
153
- tabIndex: -1,
154
- isBare: props.isBare,
155
- isCompact: props.isCompact,
156
- style: style
165
+ style: style,
166
+ tabIndex: -1
157
167
  }));
158
168
  });
159
169
  Textarea.propTypes = {
@@ -57,14 +57,15 @@ import useFieldsetContext from '../utils/useFieldsetContext.js';
57
57
  const Toggle = React__default.forwardRef((_ref, ref) => {
58
58
  let {
59
59
  children,
60
- ...props
60
+ isCompact,
61
+ ...other
61
62
  } = _ref;
62
63
  const fieldsetContext = useFieldsetContext();
63
64
  const fieldContext = useFieldContext();
64
65
  let combinedProps = {
66
+ $isCompact: fieldsetContext ? fieldsetContext.isCompact : isCompact,
65
67
  ref,
66
- ...props,
67
- ...fieldsetContext
68
+ ...other
68
69
  };
69
70
  if (fieldContext) {
70
71
  combinedProps = fieldContext.getInputProps(combinedProps);
@@ -53,14 +53,19 @@ import '../../styled/tiles/StyledTileInput.js';
53
53
  import '../../styled/tiles/StyledTileLabel.js';
54
54
  import { FieldsetContext } from '../../utils/useFieldsetContext.js';
55
55
 
56
- const FieldsetComponent = forwardRef((props, ref) => {
56
+ const FieldsetComponent = forwardRef((_ref, ref) => {
57
+ let {
58
+ isCompact,
59
+ ...other
60
+ } = _ref;
57
61
  const fieldsetContext = useMemo(() => ({
58
- isCompact: props.isCompact
59
- }), [props.isCompact]);
62
+ isCompact
63
+ }), [isCompact]);
60
64
  return React__default.createElement(FieldsetContext.Provider, {
61
65
  value: fieldsetContext
62
- }, React__default.createElement(StyledFieldset, Object.assign({}, props, {
63
- ref: ref
66
+ }, React__default.createElement(StyledFieldset, Object.assign({}, other, {
67
+ ref: ref,
68
+ $isCompact: isCompact
64
69
  })));
65
70
  });
66
71
  FieldsetComponent.displayName = 'Fieldset';
@@ -55,11 +55,17 @@ import '../../styled/tiles/StyledTileIcon.js';
55
55
  import '../../styled/tiles/StyledTileInput.js';
56
56
  import '../../styled/tiles/StyledTileLabel.js';
57
57
 
58
- const Label = React__default.forwardRef((props, ref) => {
58
+ const Label = React__default.forwardRef((_ref, ref) => {
59
+ let {
60
+ children,
61
+ isRegular,
62
+ ...other
63
+ } = _ref;
59
64
  const fieldContext = useFieldContext();
60
65
  const fieldsetContext = useFieldsetContext();
61
66
  const type = useInputContext();
62
- let combinedProps = props;
67
+ const $isRegular = fieldsetContext && isRegular === undefined ? true : isRegular;
68
+ let combinedProps = other;
63
69
  if (fieldContext) {
64
70
  combinedProps = fieldContext.getLabelProps(combinedProps);
65
71
  if (type === undefined) {
@@ -67,33 +73,26 @@ const Label = React__default.forwardRef((props, ref) => {
67
73
  setIsLabelActive,
68
74
  setIsLabelHovered
69
75
  } = fieldContext;
70
- combinedProps = {
71
- ...combinedProps,
72
- onMouseUp: composeEventHandlers(props.onMouseUp, () => {
73
- setIsLabelActive(false);
74
- }),
75
- onMouseDown: composeEventHandlers(props.onMouseDown, () => {
76
- setIsLabelActive(true);
77
- }),
78
- onMouseEnter: composeEventHandlers(props.onMouseEnter, () => {
79
- setIsLabelHovered(true);
80
- }),
81
- onMouseLeave: composeEventHandlers(props.onMouseLeave, () => {
82
- setIsLabelHovered(false);
83
- })
84
- };
76
+ combinedProps.onMouseUp = composeEventHandlers(other.onMouseUp, () => {
77
+ setIsLabelActive(false);
78
+ });
79
+ combinedProps.onMouseDown = composeEventHandlers(other.onMouseDown, () => {
80
+ setIsLabelActive(true);
81
+ });
82
+ combinedProps.onMouseEnter = composeEventHandlers(other.onMouseEnter, () => {
83
+ setIsLabelHovered(true);
84
+ });
85
+ combinedProps.onMouseLeave = composeEventHandlers(other.onMouseLeave, () => {
86
+ setIsLabelHovered(false);
87
+ });
85
88
  }
86
89
  }
87
- if (fieldsetContext) {
88
- combinedProps = {
89
- ...combinedProps,
90
- isRegular: combinedProps.isRegular === undefined ? true : combinedProps.isRegular
91
- };
92
- }
93
90
  if (type === 'radio') {
94
91
  return React__default.createElement(StyledRadioLabel, Object.assign({
95
92
  ref: ref
96
- }, combinedProps), React__default.createElement(StyledRadioSvg, null), props.children);
93
+ }, combinedProps, {
94
+ $isRegular: $isRegular
95
+ }), React__default.createElement(StyledRadioSvg, null), children);
97
96
  } else if (type === 'checkbox') {
98
97
  const onLabelSelect = e => {
99
98
  const isFirefox = navigator?.userAgent.toLowerCase().indexOf('firefox') > -1;
@@ -110,21 +109,24 @@ const Label = React__default.forwardRef((props, ref) => {
110
109
  }
111
110
  }
112
111
  };
113
- combinedProps = {
114
- ...combinedProps,
115
- onClick: composeEventHandlers(combinedProps.onClick, onLabelSelect)
116
- };
112
+ combinedProps.onClick = composeEventHandlers(combinedProps.onClick, onLabelSelect);
117
113
  return React__default.createElement(StyledCheckLabel, Object.assign({
118
114
  ref: ref
119
- }, combinedProps), React__default.createElement(StyledCheckSvg, null), React__default.createElement(StyledDashSvg, null), props.children);
115
+ }, combinedProps, {
116
+ $isRegular: $isRegular
117
+ }), React__default.createElement(StyledCheckSvg, null), React__default.createElement(StyledDashSvg, null), children);
120
118
  } else if (type === 'toggle') {
121
119
  return React__default.createElement(StyledToggleLabel, Object.assign({
122
120
  ref: ref
123
- }, combinedProps), React__default.createElement(StyledToggleSvg, null), props.children);
121
+ }, combinedProps, {
122
+ $isRegular: $isRegular
123
+ }), React__default.createElement(StyledToggleSvg, null), children);
124
124
  }
125
125
  return React__default.createElement(StyledLabel, Object.assign({
126
126
  ref: ref
127
- }, combinedProps));
127
+ }, combinedProps, {
128
+ $isRegular: $isRegular
129
+ }), children);
128
130
  });
129
131
  Label.displayName = 'Field.Label';
130
132
  Label.propTypes = {
@@ -49,11 +49,9 @@ import '../../styled/tiles/StyledTileDescription.js';
49
49
  import '../../styled/tiles/StyledTileIcon.js';
50
50
  import '../../styled/tiles/StyledTileInput.js';
51
51
  import '../../styled/tiles/StyledTileLabel.js';
52
- import useFieldsetContext from '../../utils/useFieldsetContext.js';
53
52
 
54
53
  const LegendComponent = forwardRef((props, ref) => {
55
- const fieldsetContext = useFieldsetContext();
56
- return React__default.createElement(StyledLegend, Object.assign({}, props, fieldsetContext, {
54
+ return React__default.createElement(StyledLegend, Object.assign({}, props, {
57
55
  ref: ref
58
56
  }));
59
57
  });
@@ -16,7 +16,7 @@ import '../../styled/common/StyledLegend.js';
16
16
  import '../../styled/common/StyledHint.js';
17
17
  import '../../styled/common/StyledLabel.js';
18
18
  import { StyledMessage } from '../../styled/common/StyledMessage.js';
19
- import { StyledMessageIcon } from '../../styled/common/StyledMessageIcon.js';
19
+ import '../../styled/common/StyledMessageIcon.js';
20
20
  import '../../styled/text/StyledTextInput.js';
21
21
  import '../../styled/text/StyledTextarea.js';
22
22
  import '../../styled/text/StyledTextFauxInput.js';
@@ -54,13 +54,14 @@ import '../../styled/tiles/StyledTileDescription.js';
54
54
  import '../../styled/tiles/StyledTileIcon.js';
55
55
  import '../../styled/tiles/StyledTileInput.js';
56
56
  import '../../styled/tiles/StyledTileLabel.js';
57
+ import { MessageIcon } from './MessageIcon.js';
57
58
 
58
59
  const Message = React__default.forwardRef((_ref, ref) => {
59
60
  let {
60
61
  validation,
61
62
  validationLabel,
62
63
  children,
63
- ...props
64
+ ...other
64
65
  } = _ref;
65
66
  const {
66
67
  hasMessage,
@@ -89,9 +90,9 @@ const Message = React__default.forwardRef((_ref, ref) => {
89
90
  MessageComponent = StyledMessage;
90
91
  }
91
92
  let combinedProps = {
92
- validation,
93
+ $validation: validation,
93
94
  validationLabel,
94
- ...props
95
+ ...other
95
96
  };
96
97
  if (getMessageProps) {
97
98
  combinedProps = getMessageProps(combinedProps);
@@ -99,7 +100,7 @@ const Message = React__default.forwardRef((_ref, ref) => {
99
100
  const ariaLabel = useText(Message, combinedProps, 'validationLabel', validation, validation !== undefined);
100
101
  return React__default.createElement(MessageComponent, Object.assign({
101
102
  ref: ref
102
- }, combinedProps), !!validation && React__default.createElement(StyledMessageIcon, {
103
+ }, combinedProps), !!validation && React__default.createElement(MessageIcon, {
103
104
  validation: validation,
104
105
  "aria-label": ariaLabel
105
106
  }), children);