@jsonui/react 0.0.12 → 0.1.1

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.
Files changed (65) hide show
  1. package/README.md +5 -5
  2. package/dist/cjs/index.js +12378 -8999
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/types/ReduxProviders.d.ts +18 -3
  5. package/dist/cjs/types/Renderer.d.ts +1 -1
  6. package/dist/cjs/types/ViewerWeb.d.ts +3 -4
  7. package/dist/cjs/types/Wrapper.d.ts +2 -0
  8. package/dist/cjs/types/stock/components/Button.d.ts +2 -2
  9. package/dist/cjs/types/stock/components/Edit.d.ts +3 -0
  10. package/dist/cjs/types/stock/components/FormResult.d.ts +2 -2
  11. package/dist/cjs/types/stock/components/Fragment.d.ts +2 -2
  12. package/dist/cjs/types/stock/components/HelperText.d.ts +2 -2
  13. package/dist/cjs/types/stock/components/Image.d.ts +2 -2
  14. package/dist/cjs/types/stock/components/PrimitiveProp.d.ts +2 -2
  15. package/dist/cjs/types/stock/components/Text.d.ts +2 -2
  16. package/dist/cjs/types/stock/components/View.d.ts +2 -2
  17. package/dist/cjs/types/stock/components.d.ts +1 -1
  18. package/dist/cjs/types/stock/stockToRenderer.d.ts +5 -5
  19. package/dist/cjs/types/stories/Button.d.ts +28 -0
  20. package/dist/cjs/types/stories/Button.stories.d.ts +8 -0
  21. package/dist/cjs/types/stories/Header.d.ts +12 -0
  22. package/dist/cjs/types/stories/Header.stories.d.ts +6 -0
  23. package/dist/cjs/types/stories/JsonUI.stories.d.ts +6 -0
  24. package/dist/cjs/types/stories/Page.d.ts +3 -0
  25. package/dist/cjs/types/stories/Page.stories.d.ts +6 -0
  26. package/dist/cjs/types/tests/action.test.d.ts +1 -0
  27. package/dist/cjs/types/tests/button.test.d.ts +1 -0
  28. package/dist/cjs/types/tests/input.test.d.ts +15 -0
  29. package/dist/cjs/types/tests/modifier.test.d.ts +1 -0
  30. package/dist/cjs/types/tests/pathModifier.test.d.ts +1 -0
  31. package/dist/cjs/types/tests/primitive_simple.test.d.ts +1 -0
  32. package/dist/cjs/types/tests/simple.test.d.ts +1 -0
  33. package/dist/esm/index.js +12381 -9002
  34. package/dist/esm/index.js.map +1 -1
  35. package/dist/esm/types/ReduxProviders.d.ts +18 -3
  36. package/dist/esm/types/Renderer.d.ts +1 -1
  37. package/dist/esm/types/ViewerWeb.d.ts +3 -4
  38. package/dist/esm/types/Wrapper.d.ts +2 -0
  39. package/dist/esm/types/stock/components/Button.d.ts +2 -2
  40. package/dist/esm/types/stock/components/Edit.d.ts +3 -0
  41. package/dist/esm/types/stock/components/FormResult.d.ts +2 -2
  42. package/dist/esm/types/stock/components/Fragment.d.ts +2 -2
  43. package/dist/esm/types/stock/components/HelperText.d.ts +2 -2
  44. package/dist/esm/types/stock/components/Image.d.ts +2 -2
  45. package/dist/esm/types/stock/components/PrimitiveProp.d.ts +2 -2
  46. package/dist/esm/types/stock/components/Text.d.ts +2 -2
  47. package/dist/esm/types/stock/components/View.d.ts +2 -2
  48. package/dist/esm/types/stock/components.d.ts +1 -1
  49. package/dist/esm/types/stock/stockToRenderer.d.ts +5 -5
  50. package/dist/esm/types/stories/Button.d.ts +28 -0
  51. package/dist/esm/types/stories/Button.stories.d.ts +8 -0
  52. package/dist/esm/types/stories/Header.d.ts +12 -0
  53. package/dist/esm/types/stories/Header.stories.d.ts +6 -0
  54. package/dist/esm/types/stories/JsonUI.stories.d.ts +6 -0
  55. package/dist/esm/types/stories/Page.d.ts +3 -0
  56. package/dist/esm/types/stories/Page.stories.d.ts +6 -0
  57. package/dist/esm/types/tests/action.test.d.ts +1 -0
  58. package/dist/esm/types/tests/button.test.d.ts +1 -0
  59. package/dist/esm/types/tests/input.test.d.ts +15 -0
  60. package/dist/esm/types/tests/modifier.test.d.ts +1 -0
  61. package/dist/esm/types/tests/pathModifier.test.d.ts +1 -0
  62. package/dist/esm/types/tests/primitive_simple.test.d.ts +1 -0
  63. package/dist/esm/types/tests/simple.test.d.ts +1 -0
  64. package/dist/index.d.ts +4 -1
  65. package/package.json +29 -13
@@ -1,5 +1,20 @@
1
- import { ReactNode } from 'react';
2
- declare function Providers({ children }: {
1
+ /// <reference types="redux-persist/types/types" />
2
+ import React, { ReactNode } from 'react';
3
+ import { Store, AnyAction } from 'redux';
4
+ import { Persistor } from 'redux-persist/es/types';
5
+ export interface DefaultValues {
6
+ [key: string]: Record<string, object>;
7
+ }
8
+ declare type MyProps = {
3
9
  children: ReactNode;
4
- }): JSX.Element;
10
+ defaultValues?: DefaultValues;
11
+ disabledPersist?: boolean;
12
+ };
13
+ declare class Providers extends React.Component<MyProps> {
14
+ store: Store<any, AnyAction>;
15
+ persistor: Persistor;
16
+ disabledPersist: boolean;
17
+ constructor(props: MyProps);
18
+ render(): JSX.Element;
19
+ }
5
20
  export default Providers;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  interface RendererFuncProps {
3
- viewDef: any;
3
+ model: any;
4
4
  stockInit: any;
5
5
  }
6
6
  declare const rendererFunc: (props: RendererFuncProps) => JSX.Element;
@@ -1,13 +1,12 @@
1
1
  /// <reference types="react" />
2
- export interface DefaultValues {
3
- [key: string]: Record<string, object>;
4
- }
2
+ import { DefaultValues } from './ReduxProviders';
5
3
  export interface ViewerProps {
6
- viewDef: any;
4
+ model: any;
7
5
  defaultValues?: DefaultValues;
8
6
  id?: string;
9
7
  components?: any;
10
8
  functions?: any;
9
+ disabledPersist?: boolean;
11
10
  }
12
11
  declare function ViewerWeb(props: ViewerProps): JSX.Element;
13
12
  export default ViewerWeb;
@@ -1,3 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { PropsType } from '@jsonui/core';
3
+ export declare const getStyleForWeb: (props: PropsType | undefined, component: string) => any;
2
4
  declare function WrapperOuter(props: any): JSX.Element;
3
5
  export default WrapperOuter;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- declare function CButton(props: any): JSX.Element;
3
- export default CButton;
2
+ declare function Button(props: any): JSX.Element;
3
+ export default Button;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare function Edit(props: any): JSX.Element;
3
+ export default Edit;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare function CFormResult({ value }: {
2
+ declare function FormResult({ value }: {
3
3
  value: any;
4
4
  }): JSX.Element;
5
- export default CFormResult;
5
+ export default FormResult;
@@ -1,4 +1,4 @@
1
- declare const CFragment: ({ children }: {
1
+ declare const Fragment: ({ children }: {
2
2
  children: any;
3
3
  }) => any;
4
- export default CFragment;
4
+ export default Fragment;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- declare function UHelperText(props: any): JSX.Element | null;
3
- export default UHelperText;
2
+ declare function HelperText(props: any): JSX.Element | null;
3
+ export default HelperText;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- declare function CImage(props: any): JSX.Element;
3
- export default CImage;
2
+ declare function Image(props: any): JSX.Element;
3
+ export default Image;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare function Primitive({ children }: {
2
+ declare function PrimitiveProp({ children }: {
3
3
  children: any;
4
4
  }): JSX.Element;
5
- export default Primitive;
5
+ export default PrimitiveProp;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- declare function CText(props: any): JSX.Element;
3
- export default CText;
2
+ declare function Text(props: any): JSX.Element;
3
+ export default Text;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- declare function CView(props: any): JSX.Element;
3
- export default CView;
2
+ declare function View(props: any): JSX.Element;
3
+ export default View;
@@ -1,6 +1,6 @@
1
1
  import Text from './components/Text';
2
2
  import Button from './components/Button';
3
- import Edit from './components/FieldEdit';
3
+ import Edit from './components/Edit';
4
4
  import View from './components/View';
5
5
  import Image from './components/Image';
6
6
  import _Undefined from './components/Undefined';
@@ -1,5 +1,5 @@
1
1
  import { Stock } from '@jsonui/core';
2
- export declare const getStock: (stockInit: any, viewDef: any, Wrapper: any, reduxStore: any) => Stock;
2
+ export declare const getStock: (stockInit: any, model: any, Wrapper: any, reduxStore: any) => Stock;
3
3
  declare const stock: {
4
4
  components: {
5
5
  View: typeof import("./components/View").default;
@@ -11,12 +11,12 @@ declare const stock: {
11
11
  Image: typeof import("./components/Image").default;
12
12
  Text: typeof import("./components/Text").default;
13
13
  Button: typeof import("./components/Button").default;
14
- Edit: typeof import("./components/FieldEdit").default;
14
+ Edit: typeof import("./components/Edit").default;
15
15
  };
16
16
  functions: {
17
- getStateValue: import("@jsonui/core/dist/stock/appRootFunctions").JsonUIFunctionType;
18
- get: import("@jsonui/core/dist/stock/appRootFunctions").JsonUIFunctionType;
19
- set: import("@jsonui/core/dist/stock/appRootFunctions").JsonUIFunctionType;
17
+ getStateValue: (attr: any, props: any, callerArgs: any, stock: any) => any;
18
+ get: (attr: any, props: any, callerArgs: any, stock: any) => any;
19
+ set: (attr: any, props: any, callerArgs: any, stock: any) => any;
20
20
  };
21
21
  };
22
22
  export default stock;
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ import './button.css';
3
+ export interface ButtonProps {
4
+ /**
5
+ * Is this the principal call to action on the page?
6
+ */
7
+ primary?: boolean;
8
+ /**
9
+ * What background color to use
10
+ */
11
+ backgroundColor?: string;
12
+ /**
13
+ * How large should the button be?
14
+ */
15
+ size?: 'small' | 'medium' | 'large';
16
+ /**
17
+ * Button contents
18
+ */
19
+ label: string;
20
+ /**
21
+ * Optional click handler
22
+ */
23
+ onClick?: () => void;
24
+ }
25
+ /**
26
+ * Primary UI component for user interaction
27
+ */
28
+ export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => JSX.Element;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ declare const _default: ComponentMeta<({ primary, size, backgroundColor, label, ...props }: import("./Button").ButtonProps) => JSX.Element>;
4
+ export default _default;
5
+ export declare const Primary: ComponentStory<({ primary, size, backgroundColor, label, ...props }: import("./Button").ButtonProps) => JSX.Element>;
6
+ export declare const Secondary: ComponentStory<({ primary, size, backgroundColor, label, ...props }: import("./Button").ButtonProps) => JSX.Element>;
7
+ export declare const Large: ComponentStory<({ primary, size, backgroundColor, label, ...props }: import("./Button").ButtonProps) => JSX.Element>;
8
+ export declare const Small: ComponentStory<({ primary, size, backgroundColor, label, ...props }: import("./Button").ButtonProps) => JSX.Element>;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import './header.css';
3
+ export declare type User = {
4
+ name: string;
5
+ };
6
+ export interface HeaderProps {
7
+ user?: User;
8
+ onLogin: () => void;
9
+ onLogout: () => void;
10
+ onCreateAccount: () => void;
11
+ }
12
+ export declare const Header: ({ user, onLogin, onLogout, onCreateAccount }: HeaderProps) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ declare const _default: ComponentMeta<({ user, onLogin, onLogout, onCreateAccount }: import("./Header").HeaderProps) => JSX.Element>;
4
+ export default _default;
5
+ export declare const LoggedIn: ComponentStory<({ user, onLogin, onLogout, onCreateAccount }: import("./Header").HeaderProps) => JSX.Element>;
6
+ export declare const LoggedOut: ComponentStory<({ user, onLogin, onLogout, onCreateAccount }: import("./Header").HeaderProps) => JSX.Element>;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ declare const JsonUIStory: ComponentMeta<(props: import("../ViewerWeb").ViewerProps) => JSX.Element>;
4
+ export declare const TableTest: ComponentStory<(props: import("../ViewerWeb").ViewerProps) => JSX.Element>;
5
+ export declare const InputTest: ComponentStory<(props: import("../ViewerWeb").ViewerProps) => JSX.Element>;
6
+ export default JsonUIStory;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import './page.css';
3
+ export declare const Page: React.VFC;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ declare const _default: ComponentMeta<React.VFC<{}>>;
4
+ export default _default;
5
+ export declare const LoggedOut: ComponentStory<React.VFC<{}>>;
6
+ export declare const LoggedIn: ComponentStory<React.VFC<{}>>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ export {};
2
+ /**
3
+ * TODO:
4
+ * - check actions (with nested ,promise and sync )
5
+ * - check modification (with nested ,promise and sync )
6
+ * - check modification order for example redux vs. simple function
7
+ * - check children and no children component with children prop
8
+ * - check data manipulation with mutability situation
9
+ * - check error boundary how works
10
+ * - check persistent data how works after reload
11
+ * - test with app id and multiple instance how the persistent can work
12
+ * Low:
13
+ * - check performance or memory leak???
14
+
15
+ * */
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,13 +1,16 @@
1
+ /// <reference types="redux-persist/types/types" />
1
2
  /// <reference types="react" />
2
3
  interface DefaultValues {
3
4
  [key: string]: Record<string, object>;
4
5
  }
6
+
5
7
  interface ViewerProps {
6
- viewDef: any;
8
+ model: any;
7
9
  defaultValues?: DefaultValues;
8
10
  id?: string;
9
11
  components?: any;
10
12
  functions?: any;
13
+ disabledPersist?: boolean;
11
14
  }
12
15
 
13
16
  declare type JsonUIProps = ViewerProps;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@jsonui/react",
3
- "version": "0.0.12",
3
+ "version": "0.1.1",
4
4
  "author": "Istvan Fodor <fodori@jsonui.org>",
5
5
  "contributors": [],
6
6
  "bugs": {
7
7
  "url": "https://github.com/fodori/jsonui/issues"
8
8
  },
9
- "homepage": "https://github.com/fodori/jsonui#readme",
9
+ "homepage": "http://www.jsonui.org/",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "git+https://github.com/fodori/jsonui.git"
@@ -29,18 +29,15 @@
29
29
  ],
30
30
  "types": "dist/index.d.ts",
31
31
  "scripts": {
32
- "rollup": "rollup -c",
33
- "start-module": "microbundle watch --jsx React.createElement --external none",
34
- "build-module": "microbundle build --jsx React.createElement --external none",
32
+ "build": "rollup -c",
35
33
  "lint": "eslint src --ext .jsx,.js,.tsx,.ts",
36
- "start": "react-scripts start",
37
- "build": "react-scripts build",
38
- "test": "react-scripts test",
39
- "eject": "react-scripts eject"
34
+ "storybook": "start-storybook -p 6006",
35
+ "build-storybook": "build-storybook",
36
+ "test": "jest"
40
37
  },
41
38
  "dependencies": {
42
39
  "@emotion/react": "^11.7.1",
43
- "@jsonui/core": "^0.0.12",
40
+ "@jsonui/core": "^0.1.1",
44
41
  "batchflow": "^0.4.0",
45
42
  "jsonata": "^1.8.5",
46
43
  "lodash": "^4.17.21",
@@ -50,13 +47,24 @@
50
47
  "typescript": "^4.5.4"
51
48
  },
52
49
  "devDependencies": {
50
+ "@babel/core": "^7.17.5",
51
+ "@babel/preset-env": "^7.16.11",
52
+ "@babel/preset-react": "^7.16.7",
53
+ "@emotion/jest": "^11.9.1",
53
54
  "@rollup/plugin-commonjs": "^21.0.1",
54
55
  "@rollup/plugin-json": "^4.1.0",
55
56
  "@rollup/plugin-node-resolve": "^13.1.3",
56
57
  "@rollup/plugin-typescript": "^8.3.0",
58
+ "@storybook/addon-actions": "^6.4.19",
59
+ "@storybook/addon-essentials": "^6.4.19",
60
+ "@storybook/addon-interactions": "^6.4.19",
61
+ "@storybook/addon-links": "^6.4.19",
62
+ "@storybook/react": "^6.4.19",
63
+ "@storybook/testing-library": "^0.0.9",
57
64
  "@testing-library/jest-dom": "^5.16.1",
58
65
  "@testing-library/react": "^12.1.2",
59
66
  "@testing-library/user-event": "^13.5.0",
67
+ "@types/enzyme": "^3.10.11",
60
68
  "@types/jest": "^27.4.0",
61
69
  "@types/lodash": "^4.14.178",
62
70
  "@types/node": "^16.11.19",
@@ -64,6 +72,10 @@
64
72
  "@types/react-dom": "^17.0.11",
65
73
  "@typescript-eslint/eslint-plugin": "^5.10.0",
66
74
  "@typescript-eslint/parser": "^5.10.0",
75
+ "@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
76
+ "babel-jest": "^27.5.1",
77
+ "babel-loader": "^8.2.3",
78
+ "enzyme": "^3.11.0",
67
79
  "eslint": "^8.2.0",
68
80
  "eslint-config-airbnb": "^19.0.4",
69
81
  "eslint-config-prettier": "^8.3.0",
@@ -72,14 +84,18 @@
72
84
  "eslint-plugin-prettier": "^4.0.0",
73
85
  "eslint-plugin-react": "^7.28.0",
74
86
  "eslint-plugin-react-hooks": "^4.3.0",
87
+ "eslint-plugin-storybook": "^0.5.7",
75
88
  "husky": "^7.0.4",
89
+ "jest": "^27.5.1",
76
90
  "lint-staged": "^12.2.1",
77
91
  "prettier": "^2.5.1",
78
- "react-scripts": "5.0.0",
92
+ "react-test-renderer": "^17.0.2",
79
93
  "redux-devtools": "^3.7.0",
80
94
  "rollup": "^2.66.1",
81
95
  "rollup-plugin-dts": "^4.1.0",
82
- "rollup-plugin-visualizer": "^5.5.4"
96
+ "rollup-plugin-visualizer": "^5.5.4",
97
+ "ts-jest": "^27.1.4",
98
+ "ts-node": "^10.7.0"
83
99
  },
84
100
  "peerDependencies": {
85
101
  "react": "^17.0.2",
@@ -97,5 +113,5 @@
97
113
  "last 1 safari version"
98
114
  ]
99
115
  },
100
- "gitHead": "a2fcfd73a00a402a974906ac976cfdd6503266d9"
116
+ "gitHead": "b22ae9005949d476a52810578a00fc05283304d0"
101
117
  }