@rhc-shared-components/form-group-container 1.0.1 → 2.0.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/index.js CHANGED
@@ -38,6 +38,76 @@ function _objectWithoutPropertiesLoose(source, excluded) {
38
38
 
39
39
  var css_248z = ".form-group .max-char-length {\n float: right;\n color: #6A6E73;\n font-size: var(--pf-v5-c-form__helper-text--FontSize);\n margin-top: var(--pf-v5-c-form__helper-text--MarginTop);\n}\n.form-group .maxlength-error {\n color: var(--pf-v5-c-form--m-error--Color);\n}";
40
40
 
41
+ /******************************************************************************
42
+ Copyright (c) Microsoft Corporation.
43
+
44
+ Permission to use, copy, modify, and/or distribute this software for any
45
+ purpose with or without fee is hereby granted.
46
+
47
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
48
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
49
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
50
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
51
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
52
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
53
+ PERFORMANCE OF THIS SOFTWARE.
54
+ ***************************************************************************** */
55
+
56
+ function __rest(s, e) {
57
+ var t = {};
58
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
59
+ t[p] = s[p];
60
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
61
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
62
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
63
+ t[p[i]] = s[p[i]];
64
+ }
65
+ return t;
66
+ }
67
+
68
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
69
+ var e = new Error(message);
70
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
71
+ };
72
+
73
+ let currentId = 0;
74
+ /**
75
+ * Factory to create Icon class components for consumers
76
+ */
77
+ function createIcon({ name, xOffset = 0, yOffset = 0, width, height, svgPath }) {
78
+ var _a;
79
+ return _a = class SVGIcon extends React__namespace.Component {
80
+ constructor() {
81
+ super(...arguments);
82
+ this.id = `icon-title-${currentId++}`;
83
+ }
84
+ render() {
85
+ const _a = this.props, { title, className } = _a, props = __rest(_a, ["title", "className"]);
86
+ const classes = className ? `pf-v5-svg ${className}` : 'pf-v5-svg';
87
+ const hasTitle = Boolean(title);
88
+ const viewBox = [xOffset, yOffset, width, height].join(' ');
89
+ return (React__namespace.createElement("svg", Object.assign({ className: classes, viewBox: viewBox, fill: "currentColor", "aria-labelledby": hasTitle ? this.id : null, "aria-hidden": hasTitle ? null : true, role: "img", width: "1em", height: "1em" }, props),
90
+ hasTitle && React__namespace.createElement("title", { id: this.id }, title),
91
+ React__namespace.createElement("path", { d: svgPath })));
92
+ }
93
+ },
94
+ _a.displayName = name,
95
+ _a;
96
+ }
97
+
98
+ const ExclamationCircleIconConfig = {
99
+ name: 'ExclamationCircleIcon',
100
+ height: 512,
101
+ width: 512,
102
+ svgPath: 'M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z',
103
+ yOffset: 0,
104
+ xOffset: 0,
105
+ };
106
+
107
+ const ExclamationCircleIcon = createIcon(ExclamationCircleIconConfig);
108
+
109
+ var ExclamationCircleIcon$1 = ExclamationCircleIcon;
110
+
41
111
  var _excluded = ["children", "helperTextInvalid", "validated", "helperText", "labelIcon", "onClick"];
42
112
 
43
113
  var FormGroupContainer = function FormGroupContainer(_ref) {
@@ -57,6 +127,7 @@ var FormGroupContainer = function FormGroupContainer(_ref) {
57
127
  }, onClick && {
58
128
  onClick: onClick
59
129
  }, rest), children, React__namespace.createElement(reactCore.FormHelperText, null, React__namespace.createElement(reactCore.HelperText, null, React__namespace.createElement(reactCore.HelperTextItem, {
130
+ icon: validated === reactCore.ValidatedOptions.error ? React__namespace.createElement(ExclamationCircleIcon$1, null) : null,
60
131
  variant: validated
61
132
  }, validated === reactCore.ValidatedOptions.error ? helperTextInvalid : helperText))));
62
133
  };
@@ -18,6 +18,76 @@ function _objectWithoutPropertiesLoose(source, excluded) {
18
18
 
19
19
  var css_248z = ".form-group .max-char-length {\n float: right;\n color: #6A6E73;\n font-size: var(--pf-v5-c-form__helper-text--FontSize);\n margin-top: var(--pf-v5-c-form__helper-text--MarginTop);\n}\n.form-group .maxlength-error {\n color: var(--pf-v5-c-form--m-error--Color);\n}";
20
20
 
21
+ /******************************************************************************
22
+ Copyright (c) Microsoft Corporation.
23
+
24
+ Permission to use, copy, modify, and/or distribute this software for any
25
+ purpose with or without fee is hereby granted.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
28
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
29
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
30
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
31
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
32
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
33
+ PERFORMANCE OF THIS SOFTWARE.
34
+ ***************************************************************************** */
35
+
36
+ function __rest(s, e) {
37
+ var t = {};
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
+ t[p] = s[p];
40
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
+ t[p[i]] = s[p[i]];
44
+ }
45
+ return t;
46
+ }
47
+
48
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
49
+ var e = new Error(message);
50
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
51
+ };
52
+
53
+ let currentId = 0;
54
+ /**
55
+ * Factory to create Icon class components for consumers
56
+ */
57
+ function createIcon({ name, xOffset = 0, yOffset = 0, width, height, svgPath }) {
58
+ var _a;
59
+ return _a = class SVGIcon extends React.Component {
60
+ constructor() {
61
+ super(...arguments);
62
+ this.id = `icon-title-${currentId++}`;
63
+ }
64
+ render() {
65
+ const _a = this.props, { title, className } = _a, props = __rest(_a, ["title", "className"]);
66
+ const classes = className ? `pf-v5-svg ${className}` : 'pf-v5-svg';
67
+ const hasTitle = Boolean(title);
68
+ const viewBox = [xOffset, yOffset, width, height].join(' ');
69
+ return (React.createElement("svg", Object.assign({ className: classes, viewBox: viewBox, fill: "currentColor", "aria-labelledby": hasTitle ? this.id : null, "aria-hidden": hasTitle ? null : true, role: "img", width: "1em", height: "1em" }, props),
70
+ hasTitle && React.createElement("title", { id: this.id }, title),
71
+ React.createElement("path", { d: svgPath })));
72
+ }
73
+ },
74
+ _a.displayName = name,
75
+ _a;
76
+ }
77
+
78
+ const ExclamationCircleIconConfig = {
79
+ name: 'ExclamationCircleIcon',
80
+ height: 512,
81
+ width: 512,
82
+ svgPath: 'M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z',
83
+ yOffset: 0,
84
+ xOffset: 0,
85
+ };
86
+
87
+ const ExclamationCircleIcon = createIcon(ExclamationCircleIconConfig);
88
+
89
+ var ExclamationCircleIcon$1 = ExclamationCircleIcon;
90
+
21
91
  const _excluded = ["children", "helperTextInvalid", "validated", "helperText", "labelIcon", "onClick"];
22
92
 
23
93
  const FormGroupContainer = _ref => {
@@ -39,6 +109,7 @@ const FormGroupContainer = _ref => {
39
109
  }, onClick && {
40
110
  onClick
41
111
  }, rest), children, React.createElement(FormHelperText, null, React.createElement(HelperText, null, React.createElement(HelperTextItem, {
112
+ icon: validated === ValidatedOptions.error ? React.createElement(ExclamationCircleIcon$1, null) : null,
42
113
  variant: validated
43
114
  }, validated === ValidatedOptions.error ? helperTextInvalid : helperText))));
44
115
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhc-shared-components/form-group-container",
3
- "version": "1.0.1",
3
+ "version": "2.0.0",
4
4
  "description": "Form group container for Red Hat certified technology apps",
5
5
  "author": "gautamkrishnar",
6
6
  "license": "MIT",