@newskit-render/standalone-components 0.2.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/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # @newskit-render/standalone-components
2
+
3
+ .
4
+ .
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("@testing-library/jest-dom/extend-expect");
4
+ //# sourceMappingURL=setupTests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupTests.js","sourceRoot":"","sources":["../../../src/helpers/setupTests.ts"],"names":[],"mappings":";;AAAA,mDAAgD"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { RenderOptions } from '@testing-library/react';
3
+ import { UncompiledTheme } from 'newskit';
4
+ export declare const renderWithThemeTsl: <T extends {}>(Component: React.ComponentType<T>, props?: (T & {
5
+ children?: React.ReactNode;
6
+ }) | undefined, theme?: UncompiledTheme, options?: Omit<RenderOptions<typeof import("@testing-library/dom/types/queries"), HTMLElement>, "wrapper"> | undefined) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.renderWithThemeTsl = void 0;
18
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types */
19
+ /** Added as described in Jest docs: https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
20
+ * Needed because at least one component uses <MediaQueryProvider> from newskit, which uses window.matchmedia
21
+ */
22
+ Object.defineProperty(window, 'matchMedia', {
23
+ writable: true,
24
+ value: jest.fn().mockImplementation(function (query) { return ({
25
+ matches: false,
26
+ media: query,
27
+ onchange: null,
28
+ addListener: jest.fn(),
29
+ removeListener: jest.fn(),
30
+ addEventListener: jest.fn(),
31
+ removeEventListener: jest.fn(),
32
+ dispatchEvent: jest.fn(),
33
+ }); }),
34
+ });
35
+ var react_1 = __importDefault(require("react"));
36
+ var react_2 = require("@testing-library/react");
37
+ var newskit_1 = require("newskit");
38
+ var renderWithThemeTsl = function (Component, props, theme, options) {
39
+ if (theme === void 0) { theme = newskit_1.newskitLightTheme; }
40
+ return (0, react_2.render)(react_1.default.createElement(Component, __assign({}, props)), __assign(__assign({}, options), { wrapper: function (_a) {
41
+ var children = _a.children;
42
+ return (react_1.default.createElement(newskit_1.ThemeProvider, { theme: theme }, children));
43
+ } }));
44
+ };
45
+ exports.renderWithThemeTsl = renderWithThemeTsl;
46
+ //# sourceMappingURL=testHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testHelpers.js","sourceRoot":"","sources":["../../../src/helpers/testHelpers.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oGAAoG;AACpG;;GAEG;AACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE;IAC1C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC;QAC9C,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC3B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC9B,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;KACzB,CAAC,EAT6C,CAS7C,CAAC;CACJ,CAAC,CAAA;AAEF,gDAAyB;AACzB,gDAA2E;AAC3E,mCAA2E;AACpE,IAAM,kBAAkB,GAAG,UAChC,SAAiC,EACjC,KAA0C,EAC1C,KAA0C,EAC1C,OAAwC;IADxC,sBAAA,EAAA,QAAyB,2BAAiB;IAG1C,OAAA,IAAA,cAAS,EAAC,8BAAC,SAAS,eAAM,KAAW,EAAI,wBACpC,OAAO,KACV,OAAO,EAAE,UAAC,EAAY;gBAAV,QAAQ,cAAA;YAAO,OAAA,CACzB,8BAAC,uBAAa,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAAiB,CACxD;QAF0B,CAE1B,IACD;AALF,CAKE,CAAA;AAXS,QAAA,kBAAkB,sBAW3B"}
@@ -0,0 +1 @@
1
+ export declare const test = "test";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.test = void 0;
4
+ exports.test = 'test';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,MAAM,CAAA"}
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("@testing-library/jest-dom/extend-expect");
4
+ //# sourceMappingURL=setupTests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupTests.js","sourceRoot":"","sources":["../../src/helpers/setupTests.ts"],"names":[],"mappings":";;AAAA,mDAAgD"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { RenderOptions } from '@testing-library/react';
3
+ import { UncompiledTheme } from 'newskit';
4
+ export declare const renderWithThemeTsl: <T extends {}>(Component: React.ComponentType<T>, props?: (T & {
5
+ children?: React.ReactNode;
6
+ }) | undefined, theme?: UncompiledTheme, options?: Omit<RenderOptions<typeof import("@testing-library/dom/types/queries"), HTMLElement>, "wrapper"> | undefined) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.renderWithThemeTsl = void 0;
18
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types */
19
+ /** Added as described in Jest docs: https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
20
+ * Needed because at least one component uses <MediaQueryProvider> from newskit, which uses window.matchmedia
21
+ */
22
+ Object.defineProperty(window, 'matchMedia', {
23
+ writable: true,
24
+ value: jest.fn().mockImplementation(function (query) { return ({
25
+ matches: false,
26
+ media: query,
27
+ onchange: null,
28
+ addListener: jest.fn(),
29
+ removeListener: jest.fn(),
30
+ addEventListener: jest.fn(),
31
+ removeEventListener: jest.fn(),
32
+ dispatchEvent: jest.fn(),
33
+ }); }),
34
+ });
35
+ var react_1 = __importDefault(require("react"));
36
+ var react_2 = require("@testing-library/react");
37
+ var newskit_1 = require("newskit");
38
+ var renderWithThemeTsl = function (Component, props, theme, options) {
39
+ if (theme === void 0) { theme = newskit_1.newskitLightTheme; }
40
+ return (0, react_2.render)(react_1.default.createElement(Component, __assign({}, props)), __assign(__assign({}, options), { wrapper: function (_a) {
41
+ var children = _a.children;
42
+ return (react_1.default.createElement(newskit_1.ThemeProvider, { theme: theme }, children));
43
+ } }));
44
+ };
45
+ exports.renderWithThemeTsl = renderWithThemeTsl;
46
+ //# sourceMappingURL=testHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testHelpers.js","sourceRoot":"","sources":["../../src/helpers/testHelpers.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oGAAoG;AACpG;;GAEG;AACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE;IAC1C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC;QAC9C,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC3B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC9B,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;KACzB,CAAC,EAT6C,CAS7C,CAAC;CACJ,CAAC,CAAA;AAEF,gDAAyB;AACzB,gDAA2E;AAC3E,mCAA2E;AACpE,IAAM,kBAAkB,GAAG,UAChC,SAAiC,EACjC,KAA0C,EAC1C,KAA0C,EAC1C,OAAwC;IADxC,sBAAA,EAAA,QAAyB,2BAAiB;IAG1C,OAAA,IAAA,cAAS,EAAC,8BAAC,SAAS,eAAM,KAAW,EAAI,wBACpC,OAAO,KACV,OAAO,EAAE,UAAC,EAAY;gBAAV,QAAQ,cAAA;YAAO,OAAA,CACzB,8BAAC,uBAAa,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAAiB,CACxD;QAF0B,CAE1B,IACD;AALF,CAKE,CAAA;AAXS,QAAA,kBAAkB,sBAW3B"}
@@ -0,0 +1 @@
1
+ export declare const test = "test";
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.test = void 0;
4
+ exports.test = 'test';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,MAAM,CAAA"}
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@newskit-render/standalone-components",
3
+ "version": "0.2.0",
4
+ "description": "Newskit Render Standalone Components",
5
+ "author": "",
6
+ "license": "UNLICENSED",
7
+ "keywords": [],
8
+ "main": "dist/cjs/index.js",
9
+ "module": "dist/esm/index.js",
10
+ "types": "dist/esm/index.d.ts",
11
+ "sideEffects": false,
12
+ "engines": {
13
+ "node": ">=16.13"
14
+ },
15
+ "scripts": {
16
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && tsc -p tsconfig.build.json --module CommonJS --outDir './dist/cjs'",
17
+ "build:watch": "tsc -b tsconfig.build.json -w",
18
+ "test:unit": "jest --coverage",
19
+ "test:unit:watch": "jest --watch",
20
+ "test:unit:ci": "JEST_JUNIT_OUTPUT_NAME=create-render-app.xml node --max_old_space_size=4096 --expose-gc ./node_modules/.bin/jest --ci --coverage --reporters=default --reporters=jest-junit --runInBand --logHeapUsage",
21
+ "lint": "eslint --ext .js,.jsx,.ts,.tsx . --color",
22
+ "lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --color --fix && prettier --write './**/*.{js,jsx,ts,tsx,json}'",
23
+ "precommit:lint": "eslint",
24
+ "precommit": "lint-staged",
25
+ "clean": "rm -rf node_modules & rm -f package-lock.json & rm -f yarn.lock",
26
+ "storybook": "start-storybook -p 6006 -s ./static",
27
+ "build-storybook": "build-storybook"
28
+ },
29
+ "peerDependencies": {
30
+ "next": "12.1.0",
31
+ "react": "17.0.2",
32
+ "react-dom": "17.0.2"
33
+ },
34
+ "devDependencies": {
35
+ "@babel/core": "7.14.0",
36
+ "@babel/polyfill": "7.10.1",
37
+ "@babel/register": "7.10.1",
38
+ "@emotion/jest": "11.3.0",
39
+ "@storybook/addon-actions": "6.2.9",
40
+ "@storybook/react": "6.2.9",
41
+ "@testing-library/jest-dom": "5.12.0",
42
+ "@testing-library/react": "11.2.6",
43
+ "@types/jest": "27.0.2",
44
+ "@types/react": "17.0.2",
45
+ "@typescript-eslint/eslint-plugin": "4.9.0",
46
+ "@typescript-eslint/parser": "4.9.0",
47
+ "babel-loader": "8.2.2",
48
+ "eslint": "7.14.0",
49
+ "eslint-config-prettier": "6.15.0",
50
+ "eslint-plugin-cypress": "2.11.3",
51
+ "eslint-plugin-prettier": "3.2.0",
52
+ "eslint-plugin-react": "7.22.0",
53
+ "jest": "27.4.7",
54
+ "jest-junit": "12.0.0",
55
+ "jest-watch-typeahead": "0.6.3",
56
+ "lint-staged": "12.1.7",
57
+ "newskit": "5.1.1",
58
+ "prettier": "2.2.1",
59
+ "react": "17.0.2",
60
+ "react-dom": "17.0.2",
61
+ "ts-jest": "27.1.3",
62
+ "typescript": "4.4.3"
63
+ },
64
+ "files": [
65
+ "dist"
66
+ ],
67
+ "precommit": [
68
+ "precommit"
69
+ ],
70
+ "lint-staged": {
71
+ "**/*.(ts|tsx)": [
72
+ "yarn run precommit:lint"
73
+ ]
74
+ },
75
+ "publishConfig": {
76
+ "access": "public"
77
+ },
78
+ "dependencies": {
79
+ "@hookform/resolvers": "2.8.3",
80
+ "striptags": "3.2.0"
81
+ }
82
+ }