@nice-digital/nds-alert 4.0.2-alpha.0 → 4.0.3
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/es/Alert.js +1 -1
- package/package.json +3 -3
- package/es/Alert.js.map +0 -1
- package/es/Alert.test.d.ts +0 -1
- package/es/Alert.test.js +0 -21
package/es/Alert.js
CHANGED
|
@@ -25,6 +25,6 @@ const Alert = (_a) => {
|
|
|
25
25
|
alert: true,
|
|
26
26
|
[`alert--${type}`]: true
|
|
27
27
|
});
|
|
28
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: classNames, "data-component": `alert${type ? `--${type}` : ""}` }, rest, { children: children })));
|
|
29
29
|
};
|
|
30
30
|
exports.Alert = Alert;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice-digital/nds-alert",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Alert component for the NICE Design System",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"alert"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"url": "https://github.com/nice-digital/nice-design-system/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nice-digital/nds-core": "^4.0.
|
|
33
|
+
"@nice-digital/nds-core": "^4.0.3",
|
|
34
34
|
"classnames": "^2.2.6"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"@types/node": "^18.11.9",
|
|
46
46
|
"typescript": "^4.8.4"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "ae51389ba2e51dbe9ee3849e71d44fd567fb2822"
|
|
49
49
|
}
|
package/es/Alert.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","names":["React","PropTypes","classnames","allowedTypes","Alert","props","children","type","rest","classNames","alert","propTypes","oneOf","oneOfType","arrayOf","node","isRequired","defaultProps"],"sources":["../src/Alert.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport classnames from \"classnames\";\n\nimport \"../scss/alert.scss\";\n\nconst allowedTypes = [\"info\", \"caution\", \"error\", \"success\"];\n\nexport const Alert = (props) => {\n\tconst { children, type, ...rest } = props;\n\tconst classNames = classnames({\n\t\talert: true,\n\t\t[`alert--${type}`]: true\n\t});\n\treturn (\n\t\t<div {...rest} className={classNames}>\n\t\t\t{children}\n\t\t</div>\n\t);\n};\n\nAlert.propTypes = {\n\ttype: PropTypes.oneOf(allowedTypes),\n\tchildren: PropTypes.oneOfType([\n\t\tPropTypes.arrayOf(PropTypes.node),\n\t\tPropTypes.node\n\t]).isRequired\n};\n\nAlert.defaultProps = {\n\ttype: \"info\"\n};\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAO,oBAAoB;AAE3B,IAAMC,YAAY,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC;AAE5D,OAAO,IAAMC,KAAK,GAAG,SAARA,KAAK,CAAIC,KAAK,EAAK;EAAA;EAC/B,IAAQC,QAAQ,GAAoBD,KAAK,CAAjCC,QAAQ;IAAEC,IAAI,GAAcF,KAAK,CAAvBE,IAAI;IAAKC,IAAI,iCAAKH,KAAK;EACzC,IAAMI,UAAU,GAAGP,UAAU;IAC5BQ,KAAK,EAAE;EAAI,2BACAH,IAAI,IAAK,IAAI,eACvB;EACF,oBACC,wCAASC,IAAI;IAAE,SAAS,EAAEC;EAAW,IACnCH,QAAQ,CACJ;AAER,CAAC;AAEDF,KAAK,CAACO,SAAS,GAAG;EACjBJ,IAAI,EAAEN,SAAS,CAACW,KAAK,CAACT,YAAY,CAAC;EACnCG,QAAQ,EAAEL,SAAS,CAACY,SAAS,CAAC,CAC7BZ,SAAS,CAACa,OAAO,CAACb,SAAS,CAACc,IAAI,CAAC,EACjCd,SAAS,CAACc,IAAI,CACd,CAAC,CAACC;AACJ,CAAC;AAEDZ,KAAK,CAACa,YAAY,GAAG;EACpBV,IAAI,EAAE;AACP,CAAC"}
|
package/es/Alert.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/es/Alert.test.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const react_1 = require("@testing-library/react");
|
|
5
|
-
const Alert_1 = require("../src/Alert");
|
|
6
|
-
const content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h1", { children: "Alert Title" }), (0, jsx_runtime_1.jsx)("p", { children: "Alert body content" })] }));
|
|
7
|
-
describe("Alert", () => {
|
|
8
|
-
it("should match snapshot for default alert if type not supplied", () => {
|
|
9
|
-
const wrapper = (0, react_1.render)((0, jsx_runtime_1.jsx)(Alert_1.Alert, { children: content }));
|
|
10
|
-
expect(wrapper).toMatchSnapshot();
|
|
11
|
-
});
|
|
12
|
-
it("should match snapshot for a supplied type", () => {
|
|
13
|
-
const wrapper = (0, react_1.render)((0, jsx_runtime_1.jsx)(Alert_1.Alert, Object.assign({ type: "success" }, { children: content })));
|
|
14
|
-
expect(wrapper).toMatchSnapshot();
|
|
15
|
-
});
|
|
16
|
-
it("should cascade any additional attributes to the container", () => {
|
|
17
|
-
var _a;
|
|
18
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(Alert_1.Alert, Object.assign({ "data-hidden": false }, { children: content })));
|
|
19
|
-
expect((_a = container.querySelector(".alert")) === null || _a === void 0 ? void 0 : _a.getAttribute("data-hidden")).toBe("false");
|
|
20
|
-
});
|
|
21
|
-
});
|