@paladen/errors
Advanced tools
Comparing version 1.6.11 to 1.9.3
@@ -5,2 +5,8 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var React = _interopDefault(require('react')); | ||
var PropTypes = _interopDefault(require('prop-types')); | ||
var reactBootstrap = require('react-bootstrap'); | ||
function _classCallCheck(instance, Constructor) { | ||
@@ -12,2 +18,61 @@ if (!(instance instanceof Constructor)) { | ||
var __jsx = React.createElement; | ||
var GenericErrors = function GenericErrors(_ref) { | ||
var errors = _ref.errors; | ||
return __jsx(reactBootstrap.Alert, { | ||
variant: "danger" | ||
}, errors.map(function (error) { | ||
return __jsx("div", { | ||
key: error.name | ||
}, error.message); | ||
})); | ||
}; | ||
GenericErrors.propTypes = { | ||
errors: PropTypes.arrayOf(PropTypes.shape({ | ||
name: PropTypes.string.isRequired, | ||
message: PropTypes.string.isRequired | ||
})) | ||
}; | ||
var __jsx$1 = React.createElement; | ||
var FormErrors = function FormErrors(_ref) { | ||
var errors = _ref.errors, | ||
field = _ref.field, | ||
includingFields = _ref.includingFields; | ||
// Errors for a specific form field | ||
if (field) { | ||
var _fieldErrors = fieldErrors(errors, field); | ||
if (!_fieldErrors.length) return null; | ||
return __jsx$1(reactBootstrap.Form.Control.Feedback, { | ||
type: "invalid" | ||
}, _fieldErrors.map(function (error) { | ||
return __jsx$1("div", { | ||
key: error.name | ||
}, error.message); | ||
})); | ||
} // Generic errors | ||
var _genericErrors = genericErrors(errors, includingFields); | ||
if (!_genericErrors.length) return null; | ||
return __jsx$1(GenericErrors, { | ||
errors: _genericErrors | ||
}); | ||
}; | ||
FormErrors.propTypes = { | ||
errors: PropTypes.arrayOf(PropTypes.shape({ | ||
name: PropTypes.string.isRequired, | ||
message: PropTypes.string.isRequired | ||
})), | ||
field: PropTypes.string, | ||
includingFields: PropTypes.arrayOf(PropTypes.string) | ||
}; | ||
var BaseError = function BaseError(props) { | ||
@@ -60,4 +125,6 @@ _classCallCheck(this, BaseError); | ||
exports.BaseError = BaseError; | ||
exports.FormErrors = FormErrors; | ||
exports.GenericErrors = GenericErrors; | ||
exports.createErrorResponseArray = createErrorResponseArray; | ||
exports.fieldErrors = fieldErrors; | ||
exports.genericErrors = genericErrors; |
{ | ||
"name": "@paladen/errors", | ||
"version": "1.6.11", | ||
"version": "1.9.3", | ||
"repository": "https://github.com/samstr/paladen", | ||
@@ -18,3 +18,15 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "6ff561fe8994c6a558ebb0145980fe7868ae4782" | ||
"dependencies": { | ||
"bootstrap": "^4.4.1", | ||
"prop-types": "^15.7.2", | ||
"react": "^16.13.1", | ||
"react-bootstrap": "^1.0.1", | ||
"react-dom": "^16.13.1" | ||
}, | ||
"peerDependencies": { | ||
"bootstrap": "^4.4.1", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1" | ||
}, | ||
"gitHead": "c7a95d07b5a3020799f5ebcfa539edbb6f91828e" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4120
105
8
+ Addedbootstrap@^4.4.1
+ Addedprop-types@^15.7.2
+ Addedreact@^16.13.1
+ Addedreact-bootstrap@^1.0.1
+ Addedreact-dom@^16.13.1
+ Added@babel/runtime@7.26.0(transitive)
+ Added@popperjs/core@2.11.8(transitive)
+ Added@restart/context@2.1.4(transitive)
+ Added@restart/hooks@0.4.16(transitive)
+ Added@types/invariant@2.2.37(transitive)
+ Added@types/prop-types@15.7.13(transitive)
+ Added@types/react@18.3.12(transitive)
+ Added@types/react-transition-group@4.4.11(transitive)
+ Added@types/warning@3.0.3(transitive)
+ Addedbootstrap@4.6.2(transitive)
+ Addedclassnames@2.5.1(transitive)
+ Addedcsstype@3.1.3(transitive)
+ Addeddequal@2.0.3(transitive)
+ Addeddom-helpers@5.2.1(transitive)
+ Addedinvariant@2.2.4(transitive)
+ Addedjquery@3.7.1(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedpopper.js@1.16.1(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedprop-types-extra@1.1.1(transitive)
+ Addedreact@16.14.0(transitive)
+ Addedreact-bootstrap@1.6.8(transitive)
+ Addedreact-dom@16.14.0(transitive)
+ Addedreact-is@16.13.1(transitive)
+ Addedreact-lifecycles-compat@3.0.4(transitive)
+ Addedreact-overlays@5.2.1(transitive)
+ Addedreact-transition-group@4.4.5(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedscheduler@0.19.1(transitive)
+ Addeduncontrollable@7.2.1(transitive)
+ Addedwarning@4.0.3(transitive)