@fremtind/jkl-alert-message-react
Advanced tools
Comparing version 8.0.3 to 8.0.4
@@ -1,135 +0,27 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var jklIconButtonReact = require('@fremtind/jkl-icon-button-react'); | ||
var classNames = require('classnames'); | ||
var React = require('react'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames); | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
const MessageIcon = ({ | ||
messageType | ||
}) => { | ||
switch (messageType) { | ||
case "error": | ||
return /*#__PURE__*/React__default["default"].createElement("svg", { | ||
className: "jkl-alert-message__icon", | ||
"aria-hidden": true, | ||
viewBox: "0 0 24 24", | ||
fill: "none", | ||
xmlns: "http://www.w3.org/2000/svg" | ||
}, /*#__PURE__*/React__default["default"].createElement("path", { | ||
fillRule: "evenodd", | ||
clipRule: "evenodd", | ||
d: "M12 24C18.8503 24 24 18.6274 24 12C24 5.37258 18.8503 0 12 0C5.59548 0 0 5.37258 0 12C0 18.6274 5.59548 24 12 24ZM17.43 8.41421L13.6371 12.2071L17.43 16L16.0158 17.4142L12 13.6213L8.43001 17.4142L7.01579 16L10.8087 12.2071L7.01579 8.41421L8.43001 7L12 10.7929L16.0158 7L17.43 8.41421Z", | ||
fill: "currentColor" | ||
})); | ||
case "info": | ||
return /*#__PURE__*/React__default["default"].createElement("svg", { | ||
className: "jkl-alert-message__icon", | ||
"aria-hidden": true, | ||
viewBox: "0 0 24 24", | ||
fill: "none", | ||
xmlns: "http://www.w3.org/2000/svg" | ||
}, /*#__PURE__*/React__default["default"].createElement("path", { | ||
fillRule: "evenodd", | ||
clipRule: "evenodd", | ||
d: "M24 12C24 18.6274 18.8503 24 12 24C5.59548 24 0 18.6274 0 12C0 5.37258 5.59548 0 12 0C18.8503 0 24 5.37258 24 12ZM11 17.4142V10H13.2229V17.4142H11.2229ZM12 8.5C12.9133 8.5 13.4729 7.94036 13.4729 7.25C13.4729 6.55964 12.9133 6 12 6C11.5325 6 10.9729 6.55964 10.9729 7.25C10.9729 7.94036 11.5325 8.5 12 8.5Z", | ||
fill: "currentColor" | ||
})); | ||
case "success": | ||
return /*#__PURE__*/React__default["default"].createElement("svg", { | ||
className: "jkl-alert-message__icon", | ||
"aria-hidden": true, | ||
viewBox: "0 0 24 24", | ||
fill: "none", | ||
xmlns: "http://www.w3.org/2000/svg" | ||
}, /*#__PURE__*/React__default["default"].createElement("path", { | ||
fillRule: "evenodd", | ||
clipRule: "evenodd", | ||
d: "M12 24C18.8503 24 24 18.6274 24 12C24 5.37258 18.8503 0 12 0C5.59548 0 0 5.37258 0 12C0 18.6274 5.59548 24 12 24ZM11.5503 16.7071L19.0503 9.20711L17.6361 7.79289L10.8432 14.5858L7.26909 11.0116L5.85486 12.4258L10.1361 16.7071L10.8432 17.4142L11.5503 16.7071Z", | ||
fill: "currentColor" | ||
})); | ||
case "warning": | ||
return /*#__PURE__*/React__default["default"].createElement("svg", { | ||
className: "jkl-alert-message__icon", | ||
"aria-hidden": true, | ||
viewBox: "2 3 20 18", | ||
fill: "none", | ||
xmlns: "http://www.w3.org/2000/svg" | ||
}, /*#__PURE__*/React__default["default"].createElement("path", { | ||
fillRule: "evenodd", | ||
clipRule: "evenodd", | ||
d: "M18.3588 20.5107L5.64157 20.5107C3.33259 20.5107 1.88917 18.0116 3.04301 16.0116L9.40163 4.98996C10.5561 2.98885 13.4443 2.98885 14.5987 4.98996L20.9574 16.0116C22.1112 18.0116 20.6678 20.5107 18.3588 20.5107ZM12.7515 13.6525L12.7515 7.63131L11.9988 7.63131L11.2462 7.63131L11.2462 13.6525L12.7515 13.6525ZM12.0012 15.0458C11.441 15.0458 10.9868 15.5 10.9868 16.0602C10.9868 16.6205 11.441 17.0747 12.0012 17.0747C12.5615 17.0747 13.0157 16.6205 13.0157 16.0602C13.0157 15.5 12.5615 15.0458 12.0012 15.0458Z", | ||
fill: "currentColor" | ||
})); | ||
default: | ||
return null; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
function alertFactory(messageType) { | ||
const AlertMessage = ({ | ||
className = "", | ||
maxContentWidth, | ||
paddingLeft, | ||
role = "status", | ||
dismissed, | ||
dismissAction, | ||
children | ||
}) => { | ||
const componentClassName = classNames__default["default"]("jkl-alert-message", "jkl-alert-message--" + messageType, className, { | ||
"jkl-alert-message--dismissed": dismissed | ||
}); | ||
const styles = { | ||
maxWidth: maxContentWidth, | ||
paddingLeft | ||
}; | ||
return /*#__PURE__*/React__default["default"].createElement("div", { | ||
className: componentClassName, | ||
role: role, | ||
"data-theme": "light" | ||
}, /*#__PURE__*/React__default["default"].createElement("div", { | ||
className: "jkl-alert-message__content", | ||
"data-testid": "alert-message-content", | ||
style: { ...styles | ||
} | ||
}, /*#__PURE__*/React__default["default"].createElement("div", { | ||
"aria-hidden": true, | ||
className: "jkl-alert-message__icon" | ||
}, /*#__PURE__*/React__default["default"].createElement(MessageIcon, { | ||
messageType: messageType | ||
})), /*#__PURE__*/React__default["default"].createElement("span", { | ||
className: "jkl-alert-message__message jkl-body" | ||
}, children), (dismissAction === null || dismissAction === void 0 ? void 0 : dismissAction.handleDismiss) && /*#__PURE__*/React__default["default"].createElement(jklIconButtonReact.IconButton, { | ||
className: "jkl-alert-message__dismiss-button", | ||
iconType: "clear", | ||
buttonTitle: dismissAction.buttonTitle || "Lukk", | ||
onClick: dismissAction.handleDismiss | ||
}))); | ||
}; | ||
return AlertMessage; | ||
} | ||
const InfoAlertMessage = alertFactory("info"); | ||
InfoAlertMessage.displayName = "InfoAlertMessage"; | ||
const ErrorAlertMessage = alertFactory("error"); | ||
ErrorAlertMessage.displayName = "ErrorAlertMessage"; | ||
const WarningAlertMessage = alertFactory("warning"); | ||
WarningAlertMessage.displayName = "WarningAlertMessage"; | ||
const SuccessAlertMessage = alertFactory("success"); | ||
SuccessAlertMessage.displayName = "SuccessAlertMessage"; | ||
exports.ErrorAlertMessage = ErrorAlertMessage; | ||
exports.InfoAlertMessage = InfoAlertMessage; | ||
exports.SuccessAlertMessage = SuccessAlertMessage; | ||
exports.WarningAlertMessage = WarningAlertMessage; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
ErrorAlertMessage: () => import_AlertMessage.ErrorAlertMessage, | ||
InfoAlertMessage: () => import_AlertMessage.InfoAlertMessage, | ||
SuccessAlertMessage: () => import_AlertMessage.SuccessAlertMessage, | ||
WarningAlertMessage: () => import_AlertMessage.WarningAlertMessage | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
var import_AlertMessage = require("./AlertMessage"); | ||
//# sourceMappingURL=index.js.map |
@@ -1,123 +0,8 @@ | ||
import { IconButton } from '@fremtind/jkl-icon-button-react'; | ||
import classNames from 'classnames'; | ||
import React from 'react'; | ||
const MessageIcon = ({ | ||
messageType | ||
}) => { | ||
switch (messageType) { | ||
case "error": | ||
return /*#__PURE__*/React.createElement("svg", { | ||
className: "jkl-alert-message__icon", | ||
"aria-hidden": true, | ||
viewBox: "0 0 24 24", | ||
fill: "none", | ||
xmlns: "http://www.w3.org/2000/svg" | ||
}, /*#__PURE__*/React.createElement("path", { | ||
fillRule: "evenodd", | ||
clipRule: "evenodd", | ||
d: "M12 24C18.8503 24 24 18.6274 24 12C24 5.37258 18.8503 0 12 0C5.59548 0 0 5.37258 0 12C0 18.6274 5.59548 24 12 24ZM17.43 8.41421L13.6371 12.2071L17.43 16L16.0158 17.4142L12 13.6213L8.43001 17.4142L7.01579 16L10.8087 12.2071L7.01579 8.41421L8.43001 7L12 10.7929L16.0158 7L17.43 8.41421Z", | ||
fill: "currentColor" | ||
})); | ||
case "info": | ||
return /*#__PURE__*/React.createElement("svg", { | ||
className: "jkl-alert-message__icon", | ||
"aria-hidden": true, | ||
viewBox: "0 0 24 24", | ||
fill: "none", | ||
xmlns: "http://www.w3.org/2000/svg" | ||
}, /*#__PURE__*/React.createElement("path", { | ||
fillRule: "evenodd", | ||
clipRule: "evenodd", | ||
d: "M24 12C24 18.6274 18.8503 24 12 24C5.59548 24 0 18.6274 0 12C0 5.37258 5.59548 0 12 0C18.8503 0 24 5.37258 24 12ZM11 17.4142V10H13.2229V17.4142H11.2229ZM12 8.5C12.9133 8.5 13.4729 7.94036 13.4729 7.25C13.4729 6.55964 12.9133 6 12 6C11.5325 6 10.9729 6.55964 10.9729 7.25C10.9729 7.94036 11.5325 8.5 12 8.5Z", | ||
fill: "currentColor" | ||
})); | ||
case "success": | ||
return /*#__PURE__*/React.createElement("svg", { | ||
className: "jkl-alert-message__icon", | ||
"aria-hidden": true, | ||
viewBox: "0 0 24 24", | ||
fill: "none", | ||
xmlns: "http://www.w3.org/2000/svg" | ||
}, /*#__PURE__*/React.createElement("path", { | ||
fillRule: "evenodd", | ||
clipRule: "evenodd", | ||
d: "M12 24C18.8503 24 24 18.6274 24 12C24 5.37258 18.8503 0 12 0C5.59548 0 0 5.37258 0 12C0 18.6274 5.59548 24 12 24ZM11.5503 16.7071L19.0503 9.20711L17.6361 7.79289L10.8432 14.5858L7.26909 11.0116L5.85486 12.4258L10.1361 16.7071L10.8432 17.4142L11.5503 16.7071Z", | ||
fill: "currentColor" | ||
})); | ||
case "warning": | ||
return /*#__PURE__*/React.createElement("svg", { | ||
className: "jkl-alert-message__icon", | ||
"aria-hidden": true, | ||
viewBox: "2 3 20 18", | ||
fill: "none", | ||
xmlns: "http://www.w3.org/2000/svg" | ||
}, /*#__PURE__*/React.createElement("path", { | ||
fillRule: "evenodd", | ||
clipRule: "evenodd", | ||
d: "M18.3588 20.5107L5.64157 20.5107C3.33259 20.5107 1.88917 18.0116 3.04301 16.0116L9.40163 4.98996C10.5561 2.98885 13.4443 2.98885 14.5987 4.98996L20.9574 16.0116C22.1112 18.0116 20.6678 20.5107 18.3588 20.5107ZM12.7515 13.6525L12.7515 7.63131L11.9988 7.63131L11.2462 7.63131L11.2462 13.6525L12.7515 13.6525ZM12.0012 15.0458C11.441 15.0458 10.9868 15.5 10.9868 16.0602C10.9868 16.6205 11.441 17.0747 12.0012 17.0747C12.5615 17.0747 13.0157 16.6205 13.0157 16.0602C13.0157 15.5 12.5615 15.0458 12.0012 15.0458Z", | ||
fill: "currentColor" | ||
})); | ||
default: | ||
return null; | ||
} | ||
import { InfoAlertMessage, WarningAlertMessage, ErrorAlertMessage, SuccessAlertMessage } from "./AlertMessage"; | ||
export { | ||
ErrorAlertMessage, | ||
InfoAlertMessage, | ||
SuccessAlertMessage, | ||
WarningAlertMessage | ||
}; | ||
function alertFactory(messageType) { | ||
const AlertMessage = ({ | ||
className = "", | ||
maxContentWidth, | ||
paddingLeft, | ||
role = "status", | ||
dismissed, | ||
dismissAction, | ||
children | ||
}) => { | ||
const componentClassName = classNames("jkl-alert-message", "jkl-alert-message--" + messageType, className, { | ||
"jkl-alert-message--dismissed": dismissed | ||
}); | ||
const styles = { | ||
maxWidth: maxContentWidth, | ||
paddingLeft | ||
}; | ||
return /*#__PURE__*/React.createElement("div", { | ||
className: componentClassName, | ||
role: role, | ||
"data-theme": "light" | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: "jkl-alert-message__content", | ||
"data-testid": "alert-message-content", | ||
style: { ...styles | ||
} | ||
}, /*#__PURE__*/React.createElement("div", { | ||
"aria-hidden": true, | ||
className: "jkl-alert-message__icon" | ||
}, /*#__PURE__*/React.createElement(MessageIcon, { | ||
messageType: messageType | ||
})), /*#__PURE__*/React.createElement("span", { | ||
className: "jkl-alert-message__message jkl-body" | ||
}, children), (dismissAction === null || dismissAction === void 0 ? void 0 : dismissAction.handleDismiss) && /*#__PURE__*/React.createElement(IconButton, { | ||
className: "jkl-alert-message__dismiss-button", | ||
iconType: "clear", | ||
buttonTitle: dismissAction.buttonTitle || "Lukk", | ||
onClick: dismissAction.handleDismiss | ||
}))); | ||
}; | ||
return AlertMessage; | ||
} | ||
const InfoAlertMessage = alertFactory("info"); | ||
InfoAlertMessage.displayName = "InfoAlertMessage"; | ||
const ErrorAlertMessage = alertFactory("error"); | ||
ErrorAlertMessage.displayName = "ErrorAlertMessage"; | ||
const WarningAlertMessage = alertFactory("warning"); | ||
WarningAlertMessage.displayName = "WarningAlertMessage"; | ||
const SuccessAlertMessage = alertFactory("success"); | ||
SuccessAlertMessage.displayName = "SuccessAlertMessage"; | ||
export { ErrorAlertMessage, InfoAlertMessage, SuccessAlertMessage, WarningAlertMessage }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@fremtind/jkl-alert-message-react", | ||
"version": "8.0.3", | ||
"version": "8.0.4", | ||
"publishConfig": { | ||
@@ -19,3 +19,7 @@ "access": "public" | ||
"module": "./build/esm/index.js", | ||
"browser": "./build/browser/index.js", | ||
"browser": "./build/esm/index.js", | ||
"sideEffects": [ | ||
"*.css", | ||
"*.scss" | ||
], | ||
"directories": { | ||
@@ -30,18 +34,17 @@ "lib": "build" | ||
"build:types": "tsc -p tsconfig-for-declarations.json", | ||
"build:scripts": "rollup --config ../../rollup.config.js", | ||
"build:scripts": "node ./esbuild.prod.mjs", | ||
"build": "run-s build:*", | ||
"test": "echo \"Error: run tests from root\" && exit 1", | ||
"dev:js": "ESBUILD_WATCH=true node ./esbuild.mjs", | ||
"dev:js": "ESBUILD_WATCH=true node ./esbuild.dev.mjs", | ||
"dev:server": "node ./dist/server.js", | ||
"predev": "node ./esbuild.mjs", | ||
"predev": "node ./esbuild.dev.mjs", | ||
"dev": "run-p dev:*" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.17.8", | ||
"@fremtind/jkl-alert-message": "^6.0.2", | ||
"@fremtind/jkl-icon-button-react": "^1.0.3", | ||
"@fremtind/jkl-alert-message": "^6.0.3", | ||
"@fremtind/jkl-icon-button-react": "^1.0.4", | ||
"classnames": "^2.2.6" | ||
}, | ||
"devDependencies": { | ||
"@fremtind/jkl-core": "^10.0.2" | ||
"@fremtind/jkl-core": "^10.0.3" | ||
}, | ||
@@ -61,3 +64,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "d471a0c0caacdb01d183d59ed2e7bdc190646f61" | ||
"gitHead": "41c541ee1ca9b890f50d931d7541d69e1ccd61ac" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
40353
7
18
386
1
- Removed@babel/runtime@^7.17.8
- Removed@babel/runtime@7.26.0(transitive)
- Removedregenerator-runtime@0.14.1(transitive)