@canonical/react-components 3.3.0 → 3.4.1

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.
@@ -22,6 +22,10 @@ export type Props = PropsWithSpread<{
22
22
  * Help text to show below the field.
23
23
  */
24
24
  help?: ReactNode;
25
+ /**
26
+ * Optional class(es) to pass to the help text element.
27
+ */
28
+ helpClassName?: string;
25
29
  /**
26
30
  * The id of the input.
27
31
  */
@@ -68,5 +72,5 @@ export type Props = PropsWithSpread<{
68
72
  *
69
73
  * Use the Select component to create a drop-down list.
70
74
  */
71
- declare const Select: ({ caution, className, error, help, id, label, labelClassName, onChange, options, required, stacked, success, takeFocus, wrapperClassName, ...selectProps }: Props) => React.JSX.Element;
75
+ declare const Select: ({ caution, className, error, help, helpClassName, id, label, labelClassName, onChange, options, required, stacked, success, takeFocus, wrapperClassName, ...selectProps }: Props) => React.JSX.Element;
72
76
  export default Select;
@@ -38,6 +38,7 @@ const Select = _ref2 => {
38
38
  className,
39
39
  error,
40
40
  help,
41
+ helpClassName,
41
42
  id,
42
43
  label,
43
44
  labelClassName,
@@ -67,6 +68,7 @@ const Select = _ref2 => {
67
68
  error: error,
68
69
  forId: selectId,
69
70
  help: help,
71
+ helpClassName: helpClassName,
70
72
  helpId: helpId,
71
73
  isSelect: true,
72
74
  label: label,
@@ -82,7 +84,8 @@ const Select = _ref2 => {
82
84
  className: (0, _classnames.default)("p-form-validation__input", className),
83
85
  id: selectId,
84
86
  onChange: evt => onChange && onChange(evt),
85
- ref: selectRef
87
+ ref: selectRef,
88
+ required: required
86
89
  }, selectProps), generateOptions(options)));
87
90
  };
88
91
  var _default = exports.default = Select;
@@ -108,7 +108,8 @@ const Textarea = _ref => {
108
108
  overflow: "hidden",
109
109
  boxSizing: "border-box",
110
110
  ...style
111
- } || style
111
+ } || style,
112
+ required: required
112
113
  }, props, {
113
114
  value: (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : innerValue
114
115
  })));
@@ -22,6 +22,10 @@ export type Props = PropsWithSpread<{
22
22
  * Help text to show below the field.
23
23
  */
24
24
  help?: ReactNode;
25
+ /**
26
+ * Optional class(es) to pass to the help text element.
27
+ */
28
+ helpClassName?: string;
25
29
  /**
26
30
  * The id of the input.
27
31
  */
@@ -68,5 +72,5 @@ export type Props = PropsWithSpread<{
68
72
  *
69
73
  * Use the Select component to create a drop-down list.
70
74
  */
71
- declare const Select: ({ caution, className, error, help, id, label, labelClassName, onChange, options, required, stacked, success, takeFocus, wrapperClassName, ...selectProps }: Props) => React.JSX.Element;
75
+ declare const Select: ({ caution, className, error, help, helpClassName, id, label, labelClassName, onChange, options, required, stacked, success, takeFocus, wrapperClassName, ...selectProps }: Props) => React.JSX.Element;
72
76
  export default Select;
@@ -1,5 +1,5 @@
1
1
  var _excluded = ["label", "value"],
2
- _excluded2 = ["caution", "className", "error", "help", "id", "label", "labelClassName", "onChange", "options", "required", "stacked", "success", "takeFocus", "wrapperClassName"];
2
+ _excluded2 = ["caution", "className", "error", "help", "helpClassName", "id", "label", "labelClassName", "onChange", "options", "required", "stacked", "success", "takeFocus", "wrapperClassName"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -34,6 +34,7 @@ var Select = _ref2 => {
34
34
  className,
35
35
  error,
36
36
  help,
37
+ helpClassName,
37
38
  id,
38
39
  label,
39
40
  labelClassName,
@@ -63,6 +64,7 @@ var Select = _ref2 => {
63
64
  error: error,
64
65
  forId: selectId,
65
66
  help: help,
67
+ helpClassName: helpClassName,
66
68
  helpId: helpId,
67
69
  isSelect: true,
68
70
  label: label,
@@ -78,7 +80,8 @@ var Select = _ref2 => {
78
80
  className: classNames("p-form-validation__input", className),
79
81
  id: selectId,
80
82
  onChange: evt => _onChange && _onChange(evt),
81
- ref: selectRef
83
+ ref: selectRef,
84
+ required: required
82
85
  }, selectProps), generateOptions(options)));
83
86
  };
84
87
  export default Select;
@@ -107,7 +107,8 @@ var Textarea = _ref => {
107
107
  resize: "none",
108
108
  overflow: "hidden",
109
109
  boxSizing: "border-box"
110
- }, style) || style
110
+ }, style) || style,
111
+ required: required
111
112
  }, props, {
112
113
  value: (_props$value = props.value) !== null && _props$value !== void 0 ? _props$value : innerValue
113
114
  })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonical/react-components",
3
- "version": "3.3.0",
3
+ "version": "3.4.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": {