@lendi-ui/alert
Advanced tools
Comparing version 4.1.1 to 4.1.2
## [4.0.2] - 2019-09-27 - [HUB-590](https://creditandfinance.atlassian.net/browse/HUB-590) | ||
## 4.1.2 | ||
### Patch Changes | ||
- a3be1ff2: moved icon to new build system | ||
- Updated dependencies [a3be1ff2] | ||
- @lendi-ui/icon@9.8.0 | ||
## 4.1.1 | ||
@@ -4,0 +12,0 @@ |
@@ -1,2 +0,12 @@ | ||
export * from "./declarations/src/index"; | ||
export { default } from "./declarations/src/index"; | ||
// are you seeing an error that a default export doesn't exist but your source file has a default export? | ||
// you should run `yarn` or `yarn preconstruct dev` if preconstruct dev isn't in your postinstall hook | ||
// curious why you need to? | ||
// this file exists so that you can import from the entrypoint normally | ||
// except that it points to your source file and you don't need to run build constantly | ||
// which means we need to re-export all of the modules from your source file | ||
// and since export * doesn't include default exports, we need to read your source file | ||
// to check for a default export and re-export it if it exists | ||
// it's not ideal, but it works pretty well ¯\_(ツ)_/¯ | ||
export * from "../src/index"; | ||
export { default } from "../src/index"; |
@@ -1,7 +0,21 @@ | ||
'use strict'; | ||
"use strict"; | ||
// this file might look strange and you might be wondering what it's for | ||
// it's lets you import your source files by importing this entrypoint | ||
// as you would import it if it was built with preconstruct build | ||
// this file is slightly different to some others though | ||
// it has a require hook which compiles your code with Babel | ||
// this means that you don't have to set up @babel/register or anything like that | ||
// but you can still require this module and it'll be compiled | ||
if (process.env.NODE_ENV === "production") { | ||
module.exports = require("./alert.cjs.prod.js"); | ||
} else { | ||
module.exports = require("./alert.cjs.dev.js"); | ||
} | ||
const path = require("path"); | ||
// this bit of code imports the require hook and registers it | ||
let unregister = require("../../../node_modules/@preconstruct/hook/dist/hook.cjs.js").___internalHook(path.resolve(__dirname, "../../.."), path.resolve(__dirname, "..")); | ||
// this re-exports the source file | ||
module.exports = require("../src/index.tsx"); | ||
// this unregisters the require hook so that any modules required after this one | ||
// aren't compiled with the require hook in case you have some other require hook | ||
// or something that should be used on other modules | ||
unregister(); |
@@ -1,227 +0,15 @@ | ||
import { createElement } from 'react'; | ||
import styled, { css } from 'styled-components'; | ||
import { Body } from '@lendi-ui/typography'; | ||
import { color, fg, bg } from '@lendi-ui/color'; | ||
import { p, ml, mt } from '@lendi-ui/spacing'; | ||
import { select } from '@lendi-ui/theme'; | ||
import { normalise } from '@lendi-ui/utils'; | ||
import { ErrorOutline, CheckCircleOutline, Info } from '@lendi-ui/icon'; | ||
// 👋 hey!! | ||
// you might be reading this and seeing .esm in the filename | ||
// and being confused why there is commonjs below this filename | ||
// DON'T WORRY! | ||
// this is intentional | ||
// it's only commonjs with `preconstruct dev` | ||
// when you run `preconstruct build`, it will be ESM | ||
// why is it commonjs? | ||
// we need to re-export every export from the source file | ||
// but we can't do that with ESM without knowing what the exports are (because default exports aren't included in export/import *) | ||
// and they could change after running `preconstruct dev` so we can't look at the file without forcing people to | ||
// run preconstruct dev again which wouldn't be ideal | ||
// this solution could change but for now, it's working | ||
function _templateObject11() { | ||
var data = _taggedTemplateLiteral(["\n ", ";\n"]); | ||
_templateObject11 = function _templateObject11() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject10() { | ||
var data = _taggedTemplateLiteral(["\n ", ";\n"]); | ||
_templateObject10 = function _templateObject10() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject9() { | ||
var data = _taggedTemplateLiteral(["\n line-height: 0;\n"]); | ||
_templateObject9 = function _templateObject9() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject8() { | ||
var data = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"]); | ||
_templateObject8 = function _templateObject8() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject7() { | ||
var data = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n ", " ", ";\n "]); | ||
_templateObject7 = function _templateObject7() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject6() { | ||
var data = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n ", " ", ";\n "]); | ||
_templateObject6 = function _templateObject6() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject5() { | ||
var data = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n ", " ", ";\n "]); | ||
_templateObject5 = function _templateObject5() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject4() { | ||
var data = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n ", " ", ";\n "]); | ||
_templateObject4 = function _templateObject4() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject3() { | ||
var data = _taggedTemplateLiteral(["\n flex-direction: row;\n "]); | ||
_templateObject3 = function _templateObject3() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject2() { | ||
var data = _taggedTemplateLiteral(["\n flex-direction: column;\n "]); | ||
_templateObject2 = function _templateObject2() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _templateObject() { | ||
var data = _taggedTemplateLiteral(["\n ", ";\n display: flex;\n align-items: flex-start;\n border-radius: ", ";\n ", "\n ", "\n ", "\n"]); | ||
_templateObject = function _templateObject() { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } | ||
var Wrapper = styled.div(_templateObject(), normalise, select('borderRadius'), p('sm'), (_ref) => { | ||
var { | ||
withHeading | ||
} = _ref; | ||
if (withHeading) { | ||
return css(_templateObject2()); | ||
} | ||
return css(_templateObject3()); | ||
}, (_ref2) => { | ||
var { | ||
variant | ||
} = _ref2; | ||
switch (variant) { | ||
case 'error': | ||
return css(_templateObject4(), color('error.500'), fg('error.500'), bg('error.25')); | ||
case 'info': | ||
return css(_templateObject5(), color('info.500'), fg('info.500'), bg('info.25')); | ||
case 'success': | ||
return css(_templateObject6(), color('success.500'), fg('success.500'), bg('success.25')); | ||
case 'warn': | ||
return css(_templateObject7(), color('warn.500'), fg('warn.500'), bg('warn.25')); | ||
default: | ||
return undefined; | ||
} | ||
}); | ||
var HeaderWrapper = styled.div(_templateObject8()); | ||
var IconWrapper = styled.span(_templateObject9()); | ||
var HeadingWrapper = styled(Body)(_templateObject10(), ml('xs')); | ||
var ContentWrapper = styled(Body)(_templateObject11(), (_ref3) => { | ||
var { | ||
withHeading | ||
} = _ref3; | ||
return withHeading ? mt('xxxs') : ml('xs'); | ||
}); | ||
function _extends() { _extends = Object.assign || 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); } | ||
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; } | ||
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; } | ||
var Alert = (_ref) => { | ||
var { | ||
variant, | ||
heading, | ||
children | ||
} = _ref, | ||
otherProps = _objectWithoutProperties(_ref, ["variant", "heading", "children"]); | ||
var alertIcon; | ||
var withHeading = !!heading; | ||
switch (variant) { | ||
case 'error': | ||
alertIcon = /*#__PURE__*/createElement(ErrorOutline, { | ||
color: "error.500" | ||
}); | ||
break; | ||
case 'info': | ||
alertIcon = /*#__PURE__*/createElement(Info, { | ||
color: "info.500" | ||
}); | ||
break; | ||
case 'success': | ||
alertIcon = /*#__PURE__*/createElement(CheckCircleOutline, { | ||
color: "success.500" | ||
}); | ||
break; | ||
case 'warn': | ||
alertIcon = /*#__PURE__*/createElement(ErrorOutline, { | ||
color: "warn.500" | ||
}); | ||
break; | ||
} | ||
if (withHeading) { | ||
return /*#__PURE__*/createElement(Wrapper, _extends({ | ||
variant: variant, | ||
withHeading: withHeading | ||
}, otherProps), /*#__PURE__*/createElement(HeaderWrapper, null, /*#__PURE__*/createElement(IconWrapper, null, alertIcon), /*#__PURE__*/createElement(HeadingWrapper, { | ||
size: "sm" | ||
}, /*#__PURE__*/createElement("strong", null, heading))), /*#__PURE__*/createElement(ContentWrapper, { | ||
withHeading: withHeading, | ||
size: "xs" | ||
}, children)); | ||
} | ||
return /*#__PURE__*/createElement(Wrapper, _extends({ | ||
variant: variant, | ||
withHeading: withHeading | ||
}, otherProps), /*#__PURE__*/createElement(IconWrapper, null, alertIcon), /*#__PURE__*/createElement(ContentWrapper, { | ||
withHeading: withHeading, | ||
size: "xs" | ||
}, children)); | ||
}; | ||
export default Alert; | ||
module.exports = require("../src/index.tsx") |
{ | ||
"name": "@lendi-ui/alert", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"license": "ISC", | ||
@@ -20,3 +20,3 @@ "source": "src/index.tsx", | ||
"@lendi-ui/color": "^5.1.1", | ||
"@lendi-ui/icon": "^9.7.1", | ||
"@lendi-ui/icon": "^9.8.0", | ||
"@lendi-ui/spacing": "^7.1.1", | ||
@@ -23,0 +23,0 @@ "@lendi-ui/typography": "^5.1.1", |
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
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
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
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
1
7824
6
42
Updated@lendi-ui/icon@^9.8.0