@commercetools-uikit/field-errors 15.15.0 → 16.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/commercetools-uikit-field-errors.cjs.d.ts +1 -0
- package/dist/commercetools-uikit-field-errors.cjs.d.ts.map +1 -0
- package/dist/commercetools-uikit-field-errors.cjs.dev.js +9 -11
- package/dist/commercetools-uikit-field-errors.cjs.prod.js +9 -11
- package/dist/commercetools-uikit-field-errors.esm.js +9 -11
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commercetools-uikit-field-errors.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
|
|
@@ -56,11 +56,9 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["def
|
|
|
56
56
|
|
|
57
57
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
return typeof obj === 'object';
|
|
61
|
-
};
|
|
59
|
+
const isObject = obj => typeof obj === 'object';
|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
const FieldErrors = props => {
|
|
64
62
|
var _context, _context2;
|
|
65
63
|
|
|
66
64
|
if (!props.isVisible) return null;
|
|
@@ -68,26 +66,26 @@ var FieldErrors = function FieldErrors(props) {
|
|
|
68
66
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
69
67
|
children: _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](_context2 = _Object$entries__default["default"](props.errors) // Only render errors which have truthy values, to avoid
|
|
70
68
|
// rendering an error for, e.g. { missing: false }
|
|
71
|
-
).call(_context2,
|
|
72
|
-
|
|
69
|
+
).call(_context2, _ref => {
|
|
70
|
+
let _ref2 = _slicedToArray(_ref, 2),
|
|
73
71
|
error = _ref2[1];
|
|
74
72
|
|
|
75
73
|
return error;
|
|
76
|
-
})).call(_context,
|
|
77
|
-
|
|
74
|
+
})).call(_context, _ref3 => {
|
|
75
|
+
let _ref4 = _slicedToArray(_ref3, 2),
|
|
78
76
|
key = _ref4[0],
|
|
79
77
|
error = _ref4[1];
|
|
80
78
|
|
|
81
79
|
// We might not use a custom error renderer, so we fall back to null
|
|
82
80
|
// to enable the default errors to kick in
|
|
83
|
-
|
|
81
|
+
const errorElement = props.renderError ? props.renderError(key, error) : null; // Render a custom error if one was provided.
|
|
84
82
|
// Custom errors take precedence over the default errors
|
|
85
83
|
|
|
86
84
|
if (errorElement) return jsxRuntime.jsx(messages$1.ErrorMessage, {
|
|
87
85
|
id: props.id,
|
|
88
86
|
children: errorElement
|
|
89
87
|
}, key);
|
|
90
|
-
|
|
88
|
+
const defaultErrorElement = props.renderDefaultError ? props.renderDefaultError(key, error) : null; // Render a default error if one was provided.
|
|
91
89
|
// Default errors take precedence over the known errors
|
|
92
90
|
|
|
93
91
|
if (defaultErrorElement) return jsxRuntime.jsx(messages$1.ErrorMessage, {
|
|
@@ -130,7 +128,7 @@ FieldErrors.errorTypes = {
|
|
|
130
128
|
var FieldErrors$1 = FieldErrors;
|
|
131
129
|
|
|
132
130
|
// NOTE: This string will be replaced on build time with the package version.
|
|
133
|
-
var version = "
|
|
131
|
+
var version = "16.0.0";
|
|
134
132
|
|
|
135
133
|
exports["default"] = FieldErrors$1;
|
|
136
134
|
exports.version = version;
|
|
@@ -55,11 +55,9 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["def
|
|
|
55
55
|
|
|
56
56
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
return typeof obj === 'object';
|
|
60
|
-
};
|
|
58
|
+
const isObject = obj => typeof obj === 'object';
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
const FieldErrors = props => {
|
|
63
61
|
var _context, _context2;
|
|
64
62
|
|
|
65
63
|
if (!props.isVisible) return null;
|
|
@@ -67,26 +65,26 @@ var FieldErrors = function FieldErrors(props) {
|
|
|
67
65
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
68
66
|
children: _mapInstanceProperty__default["default"](_context = _filterInstanceProperty__default["default"](_context2 = _Object$entries__default["default"](props.errors) // Only render errors which have truthy values, to avoid
|
|
69
67
|
// rendering an error for, e.g. { missing: false }
|
|
70
|
-
).call(_context2,
|
|
71
|
-
|
|
68
|
+
).call(_context2, _ref => {
|
|
69
|
+
let _ref2 = _slicedToArray(_ref, 2),
|
|
72
70
|
error = _ref2[1];
|
|
73
71
|
|
|
74
72
|
return error;
|
|
75
|
-
})).call(_context,
|
|
76
|
-
|
|
73
|
+
})).call(_context, _ref3 => {
|
|
74
|
+
let _ref4 = _slicedToArray(_ref3, 2),
|
|
77
75
|
key = _ref4[0],
|
|
78
76
|
error = _ref4[1];
|
|
79
77
|
|
|
80
78
|
// We might not use a custom error renderer, so we fall back to null
|
|
81
79
|
// to enable the default errors to kick in
|
|
82
|
-
|
|
80
|
+
const errorElement = props.renderError ? props.renderError(key, error) : null; // Render a custom error if one was provided.
|
|
83
81
|
// Custom errors take precedence over the default errors
|
|
84
82
|
|
|
85
83
|
if (errorElement) return jsxRuntime.jsx(messages$1.ErrorMessage, {
|
|
86
84
|
id: props.id,
|
|
87
85
|
children: errorElement
|
|
88
86
|
}, key);
|
|
89
|
-
|
|
87
|
+
const defaultErrorElement = props.renderDefaultError ? props.renderDefaultError(key, error) : null; // Render a default error if one was provided.
|
|
90
88
|
// Default errors take precedence over the known errors
|
|
91
89
|
|
|
92
90
|
if (defaultErrorElement) return jsxRuntime.jsx(messages$1.ErrorMessage, {
|
|
@@ -123,7 +121,7 @@ FieldErrors.errorTypes = {
|
|
|
123
121
|
var FieldErrors$1 = FieldErrors;
|
|
124
122
|
|
|
125
123
|
// NOTE: This string will be replaced on build time with the package version.
|
|
126
|
-
var version = "
|
|
124
|
+
var version = "16.0.0";
|
|
127
125
|
|
|
128
126
|
exports["default"] = FieldErrors$1;
|
|
129
127
|
exports.version = version;
|
|
@@ -38,11 +38,9 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
|
38
38
|
|
|
39
39
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
return typeof obj === 'object';
|
|
43
|
-
};
|
|
41
|
+
const isObject = obj => typeof obj === 'object';
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
const FieldErrors = props => {
|
|
46
44
|
var _context, _context2;
|
|
47
45
|
|
|
48
46
|
if (!props.isVisible) return null;
|
|
@@ -50,26 +48,26 @@ var FieldErrors = function FieldErrors(props) {
|
|
|
50
48
|
return jsx(Fragment, {
|
|
51
49
|
children: _mapInstanceProperty(_context = _filterInstanceProperty(_context2 = _Object$entries(props.errors) // Only render errors which have truthy values, to avoid
|
|
52
50
|
// rendering an error for, e.g. { missing: false }
|
|
53
|
-
).call(_context2,
|
|
54
|
-
|
|
51
|
+
).call(_context2, _ref => {
|
|
52
|
+
let _ref2 = _slicedToArray(_ref, 2),
|
|
55
53
|
error = _ref2[1];
|
|
56
54
|
|
|
57
55
|
return error;
|
|
58
|
-
})).call(_context,
|
|
59
|
-
|
|
56
|
+
})).call(_context, _ref3 => {
|
|
57
|
+
let _ref4 = _slicedToArray(_ref3, 2),
|
|
60
58
|
key = _ref4[0],
|
|
61
59
|
error = _ref4[1];
|
|
62
60
|
|
|
63
61
|
// We might not use a custom error renderer, so we fall back to null
|
|
64
62
|
// to enable the default errors to kick in
|
|
65
|
-
|
|
63
|
+
const errorElement = props.renderError ? props.renderError(key, error) : null; // Render a custom error if one was provided.
|
|
66
64
|
// Custom errors take precedence over the default errors
|
|
67
65
|
|
|
68
66
|
if (errorElement) return jsx(ErrorMessage, {
|
|
69
67
|
id: props.id,
|
|
70
68
|
children: errorElement
|
|
71
69
|
}, key);
|
|
72
|
-
|
|
70
|
+
const defaultErrorElement = props.renderDefaultError ? props.renderDefaultError(key, error) : null; // Render a default error if one was provided.
|
|
73
71
|
// Default errors take precedence over the known errors
|
|
74
72
|
|
|
75
73
|
if (defaultErrorElement) return jsx(ErrorMessage, {
|
|
@@ -112,6 +110,6 @@ FieldErrors.errorTypes = {
|
|
|
112
110
|
var FieldErrors$1 = FieldErrors;
|
|
113
111
|
|
|
114
112
|
// NOTE: This string will be replaced on build time with the package version.
|
|
115
|
-
var version = "
|
|
113
|
+
var version = "16.0.0";
|
|
116
114
|
|
|
117
115
|
export { FieldErrors$1 as default, version };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/field-errors",
|
|
3
3
|
"description": "Renders errors based on configuration.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "16.0.0",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.20.13",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
24
|
-
"@commercetools-uikit/messages": "
|
|
24
|
+
"@commercetools-uikit/messages": "16.0.0",
|
|
25
25
|
"@emotion/react": "^11.10.5",
|
|
26
26
|
"@emotion/styled": "^11.10.5",
|
|
27
27
|
"prop-types": "15.8.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"react": "17.0.2",
|
|
31
|
-
"react-intl": "^
|
|
31
|
+
"react-intl": "^6.3.2"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": "17.x",
|
|
35
|
-
"react-intl": "
|
|
35
|
+
"react-intl": "6.x"
|
|
36
36
|
}
|
|
37
37
|
}
|