@xyo-network/react-payload-details 2.61.0 → 2.62.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.
Files changed (103) hide show
  1. package/dist/components/Details/DataDetails.d.mts.map +1 -0
  2. package/dist/components/Details/DataDetails.d.ts +11 -0
  3. package/dist/components/Details/DataDetails.d.ts.map +1 -0
  4. package/dist/components/Details/Details.d.mts +20 -0
  5. package/dist/components/Details/Details.d.mts.map +1 -0
  6. package/dist/{types/components → components}/Details/Details.d.ts +2 -2
  7. package/dist/components/Details/Details.d.ts.map +1 -0
  8. package/dist/components/Details/Details.stories.d.mts +58 -0
  9. package/dist/components/Details/Details.stories.d.mts.map +1 -0
  10. package/dist/components/Details/Details.stories.d.ts +58 -0
  11. package/dist/components/Details/Details.stories.d.ts.map +1 -0
  12. package/dist/components/Details/HashSourceDetails.d.mts.map +1 -0
  13. package/dist/components/Details/HashSourceDetails.d.ts +9 -0
  14. package/dist/components/Details/HashSourceDetails.d.ts.map +1 -0
  15. package/dist/components/Details/JsonDetails.d.mts.map +1 -0
  16. package/dist/components/Details/JsonDetails.d.ts +10 -0
  17. package/dist/components/Details/JsonDetails.d.ts.map +1 -0
  18. package/dist/components/Details/ValidationDetails/ValidationDetails.d.mts.map +1 -0
  19. package/dist/components/Details/ValidationDetails/ValidationDetails.d.ts +4 -0
  20. package/dist/components/Details/ValidationDetails/ValidationDetails.d.ts.map +1 -0
  21. package/dist/components/Details/ValidationDetails/ValidationDetails.stories.d.mts +9 -0
  22. package/dist/components/Details/ValidationDetails/ValidationDetails.stories.d.mts.map +1 -0
  23. package/dist/components/Details/ValidationDetails/ValidationDetails.stories.d.ts +9 -0
  24. package/dist/components/Details/ValidationDetails/ValidationDetails.stories.d.ts.map +1 -0
  25. package/dist/components/Details/ValidationDetails/ValidationDetailsProps.d.mts.map +1 -0
  26. package/dist/components/Details/ValidationDetails/ValidationDetailsProps.d.ts +7 -0
  27. package/dist/components/Details/ValidationDetails/ValidationDetailsProps.d.ts.map +1 -0
  28. package/dist/components/Details/ValidationDetails/index.d.mts.map +1 -0
  29. package/dist/{esm/components/Details/ValidationDetails/index.js → components/Details/ValidationDetails/index.d.ts} +1 -1
  30. package/dist/components/Details/ValidationDetails/index.d.ts.map +1 -0
  31. package/dist/components/Details/index.d.mts.map +1 -0
  32. package/dist/{esm/components/Details/index.js → components/Details/index.d.ts} +1 -1
  33. package/dist/components/Details/index.d.ts.map +1 -0
  34. package/dist/components/index.d.mts.map +1 -0
  35. package/dist/components/index.d.ts +2 -0
  36. package/dist/components/index.d.ts.map +1 -0
  37. package/dist/docs.json +1319 -0
  38. package/dist/index.d.mts.map +1 -0
  39. package/dist/index.d.ts +2 -0
  40. package/dist/{types/index.d.ts.map → index.d.ts.map} +1 -1
  41. package/dist/index.js +209 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/index.mjs +169 -0
  44. package/dist/index.mjs.map +1 -0
  45. package/package.json +35 -27
  46. package/src/components/Details/DataDetails.tsx +3 -3
  47. package/src/components/Details/HashSourceDetails.tsx +3 -3
  48. package/dist/cjs/components/Details/DataDetails.js +0 -44
  49. package/dist/cjs/components/Details/DataDetails.js.map +0 -1
  50. package/dist/cjs/components/Details/Details.js +0 -16
  51. package/dist/cjs/components/Details/Details.js.map +0 -1
  52. package/dist/cjs/components/Details/HashSourceDetails.js +0 -19
  53. package/dist/cjs/components/Details/HashSourceDetails.js.map +0 -1
  54. package/dist/cjs/components/Details/JsonDetails.js +0 -24
  55. package/dist/cjs/components/Details/JsonDetails.js.map +0 -1
  56. package/dist/cjs/components/Details/ValidationDetails/ValidationDetails.js +0 -27
  57. package/dist/cjs/components/Details/ValidationDetails/ValidationDetails.js.map +0 -1
  58. package/dist/cjs/components/Details/ValidationDetails/ValidationDetailsProps.js +0 -3
  59. package/dist/cjs/components/Details/ValidationDetails/ValidationDetailsProps.js.map +0 -1
  60. package/dist/cjs/components/Details/ValidationDetails/index.js +0 -6
  61. package/dist/cjs/components/Details/ValidationDetails/index.js.map +0 -1
  62. package/dist/cjs/components/Details/index.js +0 -8
  63. package/dist/cjs/components/Details/index.js.map +0 -1
  64. package/dist/cjs/components/index.js +0 -5
  65. package/dist/cjs/components/index.js.map +0 -1
  66. package/dist/cjs/index.js +0 -5
  67. package/dist/cjs/index.js.map +0 -1
  68. package/dist/esm/components/Details/DataDetails.js +0 -36
  69. package/dist/esm/components/Details/DataDetails.js.map +0 -1
  70. package/dist/esm/components/Details/Details.js +0 -11
  71. package/dist/esm/components/Details/Details.js.map +0 -1
  72. package/dist/esm/components/Details/HashSourceDetails.js +0 -12
  73. package/dist/esm/components/Details/HashSourceDetails.js.map +0 -1
  74. package/dist/esm/components/Details/JsonDetails.js +0 -17
  75. package/dist/esm/components/Details/JsonDetails.js.map +0 -1
  76. package/dist/esm/components/Details/ValidationDetails/ValidationDetails.js +0 -20
  77. package/dist/esm/components/Details/ValidationDetails/ValidationDetails.js.map +0 -1
  78. package/dist/esm/components/Details/ValidationDetails/ValidationDetailsProps.js +0 -2
  79. package/dist/esm/components/Details/ValidationDetails/ValidationDetailsProps.js.map +0 -1
  80. package/dist/esm/components/Details/ValidationDetails/index.js.map +0 -1
  81. package/dist/esm/components/Details/index.js.map +0 -1
  82. package/dist/esm/components/index.js +0 -2
  83. package/dist/esm/components/index.js.map +0 -1
  84. package/dist/esm/index.js +0 -2
  85. package/dist/esm/index.js.map +0 -1
  86. package/dist/types/components/Details/DataDetails.d.ts.map +0 -1
  87. package/dist/types/components/Details/Details.d.ts.map +0 -1
  88. package/dist/types/components/Details/HashSourceDetails.d.ts.map +0 -1
  89. package/dist/types/components/Details/JsonDetails.d.ts.map +0 -1
  90. package/dist/types/components/Details/ValidationDetails/ValidationDetails.d.ts.map +0 -1
  91. package/dist/types/components/Details/ValidationDetails/ValidationDetailsProps.d.ts.map +0 -1
  92. package/dist/types/components/Details/ValidationDetails/index.d.ts.map +0 -1
  93. package/dist/types/components/Details/index.d.ts.map +0 -1
  94. package/dist/types/components/index.d.ts.map +0 -1
  95. /package/dist/{types/components/Details/DataDetails.d.ts → components/Details/DataDetails.d.mts} +0 -0
  96. /package/dist/{types/components/Details/HashSourceDetails.d.ts → components/Details/HashSourceDetails.d.mts} +0 -0
  97. /package/dist/{types/components/Details/JsonDetails.d.ts → components/Details/JsonDetails.d.mts} +0 -0
  98. /package/dist/{types/components/Details/ValidationDetails/ValidationDetails.d.ts → components/Details/ValidationDetails/ValidationDetails.d.mts} +0 -0
  99. /package/dist/{types/components/Details/ValidationDetails/ValidationDetailsProps.d.ts → components/Details/ValidationDetails/ValidationDetailsProps.d.mts} +0 -0
  100. /package/dist/{types/components/Details/ValidationDetails/index.d.ts → components/Details/ValidationDetails/index.d.mts} +0 -0
  101. /package/dist/{types/components/Details/index.d.ts → components/Details/index.d.mts} +0 -0
  102. /package/dist/{types/components/index.d.ts → components/index.d.mts} +0 -0
  103. /package/dist/{types/index.d.ts → index.d.mts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ PayloadDataDetails: () => PayloadDataDetails,
34
+ PayloadDetails: () => PayloadDetails,
35
+ PayloadJsonDetails: () => PayloadJsonDetails,
36
+ PayloadValidationDetails: () => PayloadValidationDetails
37
+ });
38
+ module.exports = __toCommonJS(src_exports);
39
+
40
+ // src/components/Details/DataDetails.tsx
41
+ var import_ContentCopy2 = __toESM(require("@mui/icons-material/ContentCopy"));
42
+ var import_Visibility = __toESM(require("@mui/icons-material/Visibility"));
43
+ var import_material2 = require("@mui/material");
44
+ var import_react_button = require("@xylabs/react-button");
45
+ var import_hash2 = require("@xyo-network/hash");
46
+ var import_react_property = require("@xyo-network/react-property");
47
+ var import_react_shared = require("@xyo-network/react-shared");
48
+ var import_react = require("react");
49
+
50
+ // src/components/Details/HashSourceDetails.tsx
51
+ var import_ContentCopy = __toESM(require("@mui/icons-material/ContentCopy"));
52
+ var import_material = require("@mui/material");
53
+ var import_react_flexbox = require("@xylabs/react-flexbox");
54
+ var import_react_quick_tip_button = require("@xylabs/react-quick-tip-button");
55
+ var import_hash = require("@xyo-network/hash");
56
+ var import_jsx_runtime = require("react/jsx-runtime");
57
+ var PayloadHashSourceDetails = ({ noTitle = false, payload, ...props }) => {
58
+ const theme = (0, import_material.useTheme)();
59
+ const payloadString = payload ? JSON.stringify(import_hash.PayloadHasher.hashFields(payload), null, 2) : "";
60
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexCol, { alignItems: "stretch", ...props, children: [
61
+ noTitle ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexRow, { margin: 1, justifyContent: "flex-start", children: [
62
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { children: "Hash Source" }),
63
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_quick_tip_button.QuickTipButton, { title: "Hash Source", children: "The actual string used to generate the hash (SHA256)" })
64
+ ] }),
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexRow, { children: [
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_flexbox.FlexGrowRow, { background: true, border: 1, borderColor: theme.palette.divider, justifyContent: "start", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { padding: 2, fontFamily: "monospace", variant: "body1", sx: { overflowWrap: "break-word", wordBreak: "break-all" }, children: payloadString }) }),
67
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ContentCopy.default, {}) })
68
+ ] }),
69
+ noTitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_flexbox.FlexRow, { margin: 1, justifyContent: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "body2", children: "The actual string used to generate the hash (SHA256). This can be used to validate the hash manually." }) }) : null
70
+ ] });
71
+ };
72
+
73
+ // src/components/Details/DataDetails.tsx
74
+ var import_jsx_runtime2 = require("react/jsx-runtime");
75
+ var PayloadDataDetails = ({ size, badge, payload, ...props }) => {
76
+ const payloadString = payload ? JSON.stringify(import_hash2.PayloadHasher.hashFields(payload), null, 2) : "";
77
+ const [viewSourceOpen, setViewSourceOpen] = (0, import_react.useState)(false);
78
+ const hash = (0, import_react_shared.usePayloadHash)(payload);
79
+ let elevation = 2;
80
+ if (props.paper) {
81
+ elevation += props.elevation ?? 0;
82
+ }
83
+ const actions = [
84
+ {
85
+ icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_Visibility.default, {}),
86
+ name: "View",
87
+ onClick: () => setViewSourceOpen(true)
88
+ },
89
+ {
90
+ icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ContentCopy2.default, {}),
91
+ name: "Copy",
92
+ onClick: async () => await navigator.clipboard.writeText(hash ?? "")
93
+ }
94
+ ];
95
+ const onCopy = async () => {
96
+ await navigator.clipboard.writeText(payloadString);
97
+ };
98
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
99
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
100
+ import_react_property.Property,
101
+ {
102
+ titleProps: { elevation },
103
+ badge,
104
+ size,
105
+ actions,
106
+ title: "Payload Hash",
107
+ value: hash ?? "<Unknown>",
108
+ tip: "This is the payload hash",
109
+ ...props
110
+ }
111
+ ),
112
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material2.Dialog, { open: viewSourceOpen, onClose: () => setViewSourceOpen(false), children: [
113
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.DialogTitle, { children: "Hash Source" }),
114
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PayloadHashSourceDetails, { noTitle: true, payload }) }),
115
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material2.DialogActions, { children: [
116
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_button.ButtonEx, { color: "secondary", onClick: onCopy, children: "Copy" }),
117
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_button.ButtonEx, { color: "secondary", onClick: () => setViewSourceOpen(false), children: "Close" })
118
+ ] })
119
+ ] })
120
+ ] });
121
+ };
122
+
123
+ // src/components/Details/Details.tsx
124
+ var import_react_flexbox4 = require("@xylabs/react-flexbox");
125
+ var import_react3 = require("react");
126
+
127
+ // src/components/Details/JsonDetails.tsx
128
+ var import_material3 = require("@mui/material");
129
+ var import_react_flexbox2 = require("@xylabs/react-flexbox");
130
+ var import_react_property2 = require("@xyo-network/react-property");
131
+ var import_react2 = require("react");
132
+ var import_jsx_runtime3 = require("react/jsx-runtime");
133
+ var JsonView = (0, import_react2.lazy)(() => import(
134
+ /* webpackChunkName: "jsonView" */
135
+ "react-json-view"
136
+ ));
137
+ var PayloadJsonDetails = ({ jsonViewProps, payload = {}, ...props }) => {
138
+ const { breakpoints, palette } = (0, import_material3.useTheme)();
139
+ const belowSm = (0, import_material3.useMediaQuery)(breakpoints.down("sm"));
140
+ let elevation = 2;
141
+ if (props.paper) {
142
+ elevation += props.elevation ?? 0;
143
+ }
144
+ const jsonTheme = palette.mode === "dark" ? "shapeshifter" : void 0;
145
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_property2.PropertyGroup, { titleProps: { elevation }, title: "JSON", tip: "The raw JSON of the payload", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material3.Paper, { square: true, variant: "elevation", style: { overflow: "hidden", padding: "16px", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react2.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_flexbox2.FlexGrowRow, {}), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
146
+ JsonView,
147
+ {
148
+ groupArraysAfterLength: 20,
149
+ style: { backgroundColor: void 0, overflow: "hidden" },
150
+ src: payload,
151
+ enableClipboard: true,
152
+ theme: jsonTheme,
153
+ collapseStringsAfterLength: belowSm ? 24 : 32,
154
+ ...jsonViewProps
155
+ }
156
+ ) }) }) });
157
+ };
158
+
159
+ // src/components/Details/ValidationDetails/ValidationDetails.tsx
160
+ var import_material4 = require("@mui/material");
161
+ var import_react_flexbox3 = require("@xylabs/react-flexbox");
162
+ var import_react_promise = require("@xylabs/react-promise");
163
+ var import_payload_validator = require("@xyo-network/payload-validator");
164
+ var import_react_property3 = require("@xyo-network/react-property");
165
+ var import_react_schema = require("@xyo-network/react-schema");
166
+ var import_jsx_runtime4 = require("react/jsx-runtime");
167
+ var PayloadValidationDetails = ({ skipBody = false, value, ...props }) => {
168
+ const [validateErrors] = (0, import_react_promise.usePromise)(async () => value ? await new import_payload_validator.PayloadValidator(value).validate() : void 0, [value]);
169
+ const bodyErrors = skipBody ? [] : validateErrors ?? [];
170
+ const errors = [...bodyErrors];
171
+ let elevation = 2;
172
+ if (props.paper) {
173
+ elevation += props.elevation ?? 0;
174
+ }
175
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_property3.PropertyGroup, { titleProps: { elevation }, title: "Validation", tip: "The results from validating the payload", ...props, children: [
176
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
177
+ import_react_property3.Property,
178
+ {
179
+ titleProps: { elevation },
180
+ flexGrow: 1,
181
+ title: "Valid",
182
+ value: errors.length === 0 ? "True" : "False",
183
+ tip: errors.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_flexbox3.FlexCol, { children: errors.map((error, index) => {
184
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material4.Typography, { children: error.toString() }, index);
185
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_material4.Typography, { children: "No Errors" })
186
+ }
187
+ ),
188
+ value?.schema && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_schema.SchemaProperty, { flexGrow: 1, titleProps: { elevation }, value: value.schema })
189
+ ] });
190
+ };
191
+
192
+ // src/components/Details/Details.tsx
193
+ var import_jsx_runtime5 = require("react/jsx-runtime");
194
+ var PayloadDetails = (0, import_react3.forwardRef)(({ paper, payload, ...props }, ref) => {
195
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_flexbox4.FlexCol, { gap: 1, justifyContent: "flex-start", alignItems: "stretch", marginTop: 2, marginBottom: 8, ref, ...props, children: [
196
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PayloadDataDetails, { paper, size: "large", badge: true, payload }),
197
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PayloadValidationDetails, { paper, value: payload }),
198
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PayloadJsonDetails, { paper, payload })
199
+ ] });
200
+ });
201
+ PayloadDetails.displayName = "PayloadDetails";
202
+ // Annotate the CommonJS export names for ESM import in node:
203
+ 0 && (module.exports = {
204
+ PayloadDataDetails,
205
+ PayloadDetails,
206
+ PayloadJsonDetails,
207
+ PayloadValidationDetails
208
+ });
209
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/components/Details/DataDetails.tsx","../src/components/Details/HashSourceDetails.tsx","../src/components/Details/Details.tsx","../src/components/Details/JsonDetails.tsx","../src/components/Details/ValidationDetails/ValidationDetails.tsx"],"sourcesContent":["export * from './components'\n","import ContentCopyIcon from '@mui/icons-material/ContentCopy'\nimport VisibilityIcon from '@mui/icons-material/Visibility'\nimport { Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { Payload } from '@xyo-network/payload-model'\nimport { Property, PropertyAction, PropertyProps } from '@xyo-network/react-property'\nimport { SizeProp, usePayloadHash } from '@xyo-network/react-shared'\nimport { useState } from 'react'\n\nimport { PayloadHashSourceDetails } from './HashSourceDetails'\n\nexport type PayloadDataDetailsProps = PropertyProps & {\n badge?: boolean\n payload?: Payload\n size?: SizeProp\n}\n\nexport const PayloadDataDetails: React.FC<PayloadDataDetailsProps> = ({ size, badge, payload, ...props }) => {\n const payloadString = payload ? JSON.stringify(PayloadHasher.hashFields(payload), null, 2) : ''\n\n const [viewSourceOpen, setViewSourceOpen] = useState(false)\n const hash = usePayloadHash(payload)\n\n let elevation = 2\n if (props.paper) {\n elevation += props.elevation ?? 0\n }\n\n const actions: PropertyAction[] = [\n {\n icon: <VisibilityIcon />,\n name: 'View',\n onClick: () => setViewSourceOpen(true),\n },\n {\n icon: <ContentCopyIcon />,\n name: 'Copy',\n onClick: async () => await navigator.clipboard.writeText(hash ?? ''),\n },\n ]\n\n const onCopy = async () => {\n await navigator.clipboard.writeText(payloadString)\n }\n\n return (\n <>\n <Property\n titleProps={{ elevation }}\n badge={badge}\n size={size}\n actions={actions}\n title=\"Payload Hash\"\n value={hash ?? '<Unknown>'}\n tip=\"This is the payload hash\"\n {...props}\n />\n <Dialog open={viewSourceOpen} onClose={() => setViewSourceOpen(false)}>\n <DialogTitle>Hash Source</DialogTitle>\n <DialogContent>\n <PayloadHashSourceDetails noTitle payload={payload} />\n </DialogContent>\n <DialogActions>\n <ButtonEx color=\"secondary\" onClick={onCopy}>\n Copy\n </ButtonEx>\n <ButtonEx color=\"secondary\" onClick={() => setViewSourceOpen(false)}>\n Close\n </ButtonEx>\n </DialogActions>\n </Dialog>\n </>\n )\n}\n","import ContentCopyIcon from '@mui/icons-material/ContentCopy'\nimport { IconButton, Typography, useTheme } from '@mui/material'\nimport { FlexBoxProps, FlexCol, FlexGrowRow, FlexRow } from '@xylabs/react-flexbox'\nimport { QuickTipButton } from '@xylabs/react-quick-tip-button'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface PayloadHashSourceDetailsProps extends FlexBoxProps {\n noTitle?: boolean\n payload?: Payload\n}\n\nexport const PayloadHashSourceDetails: React.FC<PayloadHashSourceDetailsProps> = ({ noTitle = false, payload, ...props }) => {\n const theme = useTheme()\n const payloadString = payload ? JSON.stringify(PayloadHasher.hashFields(payload), null, 2) : ''\n\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n {noTitle ? null : (\n <FlexRow margin={1} justifyContent=\"flex-start\">\n <Typography>Hash Source</Typography>\n <QuickTipButton title=\"Hash Source\">The actual string used to generate the hash (SHA256)</QuickTipButton>\n </FlexRow>\n )}\n <FlexRow>\n <FlexGrowRow background border={1} borderColor={theme.palette.divider} justifyContent=\"start\">\n <Typography padding={2} fontFamily=\"monospace\" variant=\"body1\" sx={{ overflowWrap: 'break-word', wordBreak: 'break-all' }}>\n {payloadString}\n </Typography>\n </FlexGrowRow>\n <IconButton>\n <ContentCopyIcon />\n </IconButton>\n </FlexRow>\n {noTitle ? (\n <FlexRow margin={1} justifyContent=\"flex-start\">\n <Typography variant=\"body2\">\n The actual string used to generate the hash (SHA256). This can be used to validate the hash manually.\n </Typography>\n </FlexRow>\n ) : null}\n </FlexCol>\n )\n}\n","import { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { forwardRef } from 'react'\n\nimport { PayloadDataDetails } from './DataDetails'\nimport { PayloadJsonDetails } from './JsonDetails'\nimport { PayloadValidationDetails } from './ValidationDetails'\n\nexport type WithPaper<T> = T & { paper: true }\nexport type WithoutPaper<T> = T & { paper?: false }\n\nexport type PayloadDetailsProps = FlexBoxProps & {\n paper?: boolean\n payload?: Payload\n}\n\nexport const PayloadDetails = forwardRef<HTMLDivElement, PayloadDetailsProps>(({ paper, payload, ...props }, ref) => {\n return (\n <FlexCol gap={1} justifyContent=\"flex-start\" alignItems=\"stretch\" marginTop={2} marginBottom={8} ref={ref} {...props}>\n <PayloadDataDetails paper={paper} size=\"large\" badge payload={payload} />\n <PayloadValidationDetails paper={paper} value={payload} />\n <PayloadJsonDetails paper={paper} payload={payload} />\n </FlexCol>\n )\n})\n\nPayloadDetails.displayName = 'PayloadDetails'\n","import { Paper, useMediaQuery, useTheme } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { PropertyGroup, PropertyGroupProps } from '@xyo-network/react-property'\nimport { lazy, Suspense } from 'react'\nimport { ReactJsonViewProps } from 'react-json-view'\n\nconst JsonView = lazy(() => import(/* webpackChunkName: \"jsonView\" */ 'react-json-view'))\n\nexport type PayloadJsonDetailsProps = PropertyGroupProps & {\n jsonViewProps?: ReactJsonViewProps\n payload?: Payload\n}\n\nexport const PayloadJsonDetails: React.FC<PayloadJsonDetailsProps> = ({ jsonViewProps, payload = {}, ...props }) => {\n const { breakpoints, palette } = useTheme()\n const belowSm = useMediaQuery(breakpoints.down('sm'))\n\n let elevation = 2\n if (props.paper) {\n elevation += props.elevation ?? 0\n }\n\n const jsonTheme = palette.mode === 'dark' ? 'shapeshifter' : undefined\n\n return (\n <PropertyGroup titleProps={{ elevation }} title=\"JSON\" tip=\"The raw JSON of the payload\" {...props}>\n <Paper square variant=\"elevation\" style={{ overflow: 'hidden', padding: '16px', width: '100%' }}>\n <Suspense fallback={<FlexGrowRow />}>\n <JsonView\n groupArraysAfterLength={20}\n style={{ backgroundColor: undefined, overflow: 'hidden' }}\n src={payload}\n enableClipboard\n theme={jsonTheme}\n collapseStringsAfterLength={belowSm ? 24 : 32}\n {...jsonViewProps}\n />\n </Suspense>\n </Paper>\n </PropertyGroup>\n )\n}\n","import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { PayloadValidator } from '@xyo-network/payload-validator'\nimport { Property, PropertyGroup } from '@xyo-network/react-property'\nimport { SchemaProperty } from '@xyo-network/react-schema'\n\nimport { PayloadValidationDetailsProps } from './ValidationDetailsProps'\n\nexport const PayloadValidationDetails: React.FC<PayloadValidationDetailsProps> = ({ skipBody = false, value, ...props }) => {\n const [validateErrors] = usePromise(async () => (value ? await new PayloadValidator(value).validate() : undefined), [value])\n\n const bodyErrors = skipBody ? [] : validateErrors ?? []\n const errors: Error[] = [...bodyErrors]\n\n let elevation = 2\n if (props.paper) {\n elevation += props.elevation ?? 0\n }\n\n return (\n <PropertyGroup titleProps={{ elevation }} title=\"Validation\" tip=\"The results from validating the payload\" {...props}>\n <Property\n titleProps={{ elevation }}\n flexGrow={1}\n title=\"Valid\"\n value={errors.length === 0 ? 'True' : 'False'}\n tip={\n errors.length > 0 ? (\n <FlexCol>\n {errors.map((error, index) => {\n return <Typography key={index}>{error.toString()}</Typography>\n })}\n </FlexCol>\n ) : (\n <Typography>No Errors</Typography>\n )\n }\n />\n {value?.schema && <SchemaProperty flexGrow={1} titleProps={{ elevation }} value={value.schema} />}\n </PropertyGroup>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,sBAA4B;AAC5B,wBAA2B;AAC3B,IAAAC,mBAAkE;AAClE,0BAAyB;AACzB,IAAAC,eAA8B;AAE9B,4BAAwD;AACxD,0BAAyC;AACzC,mBAAyB;;;ACRzB,yBAA4B;AAC5B,sBAAiD;AACjD,2BAA4D;AAC5D,oCAA+B;AAC/B,kBAA8B;AAetB;AAPD,IAAM,2BAAoE,CAAC,EAAE,UAAU,OAAO,SAAS,GAAG,MAAM,MAAM;AAC3H,QAAM,YAAQ,0BAAS;AACvB,QAAM,gBAAgB,UAAU,KAAK,UAAU,0BAAc,WAAW,OAAO,GAAG,MAAM,CAAC,IAAI;AAE7F,SACE,6CAAC,gCAAQ,YAAW,WAAW,GAAG,OAC/B;AAAA,cAAU,OACT,6CAAC,gCAAQ,QAAQ,GAAG,gBAAe,cACjC;AAAA,kDAAC,8BAAW,yBAAW;AAAA,MACvB,4CAAC,gDAAe,OAAM,eAAc,kEAAoD;AAAA,OAC1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FxBI,IAAAC,sBAAA;AAFG,IAAM,qBAAiB,0BAAgD,CAAC,EAAE,OAAO,SAAS,GAAG,MAAM,GAAG,QAAQ;AACnH,SACE,8CAAC,iCAAQ,KAAK,GAAG,gBAAe,cAAa,YAAW,WAAU,WAAW,GAAG,cAAc,GAAG,KAAW,GAAG,OAC7G;AAAA,iDAAC,sBAAmB,OAAc,MAAK,SAAQ,OAAK,MAAC,SAAkB;AAAA,IACvE,6CAAC,4BAAyB,OAAc,OAAO,SAAS;AAAA,IACxD,6CAAC,sBAAmB,OAAc,SAAkB;AAAA,KACtD;AAEJ,CAAC;AAED,eAAe,cAAc;","names":["import_ContentCopy","import_material","import_hash","ContentCopyIcon","import_jsx_runtime","VisibilityIcon","ContentCopyIcon","import_react_flexbox","import_react","import_material","import_react_flexbox","import_react_property","import_react","import_jsx_runtime","import_material","import_react_flexbox","import_react_property","import_jsx_runtime","import_jsx_runtime"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,169 @@
1
+ // src/components/Details/DataDetails.tsx
2
+ import ContentCopyIcon2 from "@mui/icons-material/ContentCopy";
3
+ import VisibilityIcon from "@mui/icons-material/Visibility";
4
+ import { Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
5
+ import { ButtonEx } from "@xylabs/react-button";
6
+ import { PayloadHasher as PayloadHasher2 } from "@xyo-network/hash";
7
+ import { Property } from "@xyo-network/react-property";
8
+ import { usePayloadHash } from "@xyo-network/react-shared";
9
+ import { useState } from "react";
10
+
11
+ // src/components/Details/HashSourceDetails.tsx
12
+ import ContentCopyIcon from "@mui/icons-material/ContentCopy";
13
+ import { IconButton, Typography, useTheme } from "@mui/material";
14
+ import { FlexCol, FlexGrowRow, FlexRow } from "@xylabs/react-flexbox";
15
+ import { QuickTipButton } from "@xylabs/react-quick-tip-button";
16
+ import { PayloadHasher } from "@xyo-network/hash";
17
+ import { jsx, jsxs } from "react/jsx-runtime";
18
+ var PayloadHashSourceDetails = ({ noTitle = false, payload, ...props }) => {
19
+ const theme = useTheme();
20
+ const payloadString = payload ? JSON.stringify(PayloadHasher.hashFields(payload), null, 2) : "";
21
+ return /* @__PURE__ */ jsxs(FlexCol, { alignItems: "stretch", ...props, children: [
22
+ noTitle ? null : /* @__PURE__ */ jsxs(FlexRow, { margin: 1, justifyContent: "flex-start", children: [
23
+ /* @__PURE__ */ jsx(Typography, { children: "Hash Source" }),
24
+ /* @__PURE__ */ jsx(QuickTipButton, { title: "Hash Source", children: "The actual string used to generate the hash (SHA256)" })
25
+ ] }),
26
+ /* @__PURE__ */ jsxs(FlexRow, { children: [
27
+ /* @__PURE__ */ jsx(FlexGrowRow, { background: true, border: 1, borderColor: theme.palette.divider, justifyContent: "start", children: /* @__PURE__ */ jsx(Typography, { padding: 2, fontFamily: "monospace", variant: "body1", sx: { overflowWrap: "break-word", wordBreak: "break-all" }, children: payloadString }) }),
28
+ /* @__PURE__ */ jsx(IconButton, { children: /* @__PURE__ */ jsx(ContentCopyIcon, {}) })
29
+ ] }),
30
+ noTitle ? /* @__PURE__ */ jsx(FlexRow, { margin: 1, justifyContent: "flex-start", children: /* @__PURE__ */ jsx(Typography, { variant: "body2", children: "The actual string used to generate the hash (SHA256). This can be used to validate the hash manually." }) }) : null
31
+ ] });
32
+ };
33
+
34
+ // src/components/Details/DataDetails.tsx
35
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
36
+ var PayloadDataDetails = ({ size, badge, payload, ...props }) => {
37
+ const payloadString = payload ? JSON.stringify(PayloadHasher2.hashFields(payload), null, 2) : "";
38
+ const [viewSourceOpen, setViewSourceOpen] = useState(false);
39
+ const hash = usePayloadHash(payload);
40
+ let elevation = 2;
41
+ if (props.paper) {
42
+ elevation += props.elevation ?? 0;
43
+ }
44
+ const actions = [
45
+ {
46
+ icon: /* @__PURE__ */ jsx2(VisibilityIcon, {}),
47
+ name: "View",
48
+ onClick: () => setViewSourceOpen(true)
49
+ },
50
+ {
51
+ icon: /* @__PURE__ */ jsx2(ContentCopyIcon2, {}),
52
+ name: "Copy",
53
+ onClick: async () => await navigator.clipboard.writeText(hash ?? "")
54
+ }
55
+ ];
56
+ const onCopy = async () => {
57
+ await navigator.clipboard.writeText(payloadString);
58
+ };
59
+ return /* @__PURE__ */ jsxs2(Fragment, { children: [
60
+ /* @__PURE__ */ jsx2(
61
+ Property,
62
+ {
63
+ titleProps: { elevation },
64
+ badge,
65
+ size,
66
+ actions,
67
+ title: "Payload Hash",
68
+ value: hash ?? "<Unknown>",
69
+ tip: "This is the payload hash",
70
+ ...props
71
+ }
72
+ ),
73
+ /* @__PURE__ */ jsxs2(Dialog, { open: viewSourceOpen, onClose: () => setViewSourceOpen(false), children: [
74
+ /* @__PURE__ */ jsx2(DialogTitle, { children: "Hash Source" }),
75
+ /* @__PURE__ */ jsx2(DialogContent, { children: /* @__PURE__ */ jsx2(PayloadHashSourceDetails, { noTitle: true, payload }) }),
76
+ /* @__PURE__ */ jsxs2(DialogActions, { children: [
77
+ /* @__PURE__ */ jsx2(ButtonEx, { color: "secondary", onClick: onCopy, children: "Copy" }),
78
+ /* @__PURE__ */ jsx2(ButtonEx, { color: "secondary", onClick: () => setViewSourceOpen(false), children: "Close" })
79
+ ] })
80
+ ] })
81
+ ] });
82
+ };
83
+
84
+ // src/components/Details/Details.tsx
85
+ import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
86
+ import { forwardRef } from "react";
87
+
88
+ // src/components/Details/JsonDetails.tsx
89
+ import { Paper, useMediaQuery, useTheme as useTheme2 } from "@mui/material";
90
+ import { FlexGrowRow as FlexGrowRow2 } from "@xylabs/react-flexbox";
91
+ import { PropertyGroup } from "@xyo-network/react-property";
92
+ import { lazy, Suspense } from "react";
93
+ import { jsx as jsx3 } from "react/jsx-runtime";
94
+ var JsonView = lazy(() => import(
95
+ /* webpackChunkName: "jsonView" */
96
+ "react-json-view"
97
+ ));
98
+ var PayloadJsonDetails = ({ jsonViewProps, payload = {}, ...props }) => {
99
+ const { breakpoints, palette } = useTheme2();
100
+ const belowSm = useMediaQuery(breakpoints.down("sm"));
101
+ let elevation = 2;
102
+ if (props.paper) {
103
+ elevation += props.elevation ?? 0;
104
+ }
105
+ const jsonTheme = palette.mode === "dark" ? "shapeshifter" : void 0;
106
+ return /* @__PURE__ */ jsx3(PropertyGroup, { titleProps: { elevation }, title: "JSON", tip: "The raw JSON of the payload", ...props, children: /* @__PURE__ */ jsx3(Paper, { square: true, variant: "elevation", style: { overflow: "hidden", padding: "16px", width: "100%" }, children: /* @__PURE__ */ jsx3(Suspense, { fallback: /* @__PURE__ */ jsx3(FlexGrowRow2, {}), children: /* @__PURE__ */ jsx3(
107
+ JsonView,
108
+ {
109
+ groupArraysAfterLength: 20,
110
+ style: { backgroundColor: void 0, overflow: "hidden" },
111
+ src: payload,
112
+ enableClipboard: true,
113
+ theme: jsonTheme,
114
+ collapseStringsAfterLength: belowSm ? 24 : 32,
115
+ ...jsonViewProps
116
+ }
117
+ ) }) }) });
118
+ };
119
+
120
+ // src/components/Details/ValidationDetails/ValidationDetails.tsx
121
+ import { Typography as Typography2 } from "@mui/material";
122
+ import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
123
+ import { usePromise } from "@xylabs/react-promise";
124
+ import { PayloadValidator } from "@xyo-network/payload-validator";
125
+ import { Property as Property2, PropertyGroup as PropertyGroup2 } from "@xyo-network/react-property";
126
+ import { SchemaProperty } from "@xyo-network/react-schema";
127
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
128
+ var PayloadValidationDetails = ({ skipBody = false, value, ...props }) => {
129
+ const [validateErrors] = usePromise(async () => value ? await new PayloadValidator(value).validate() : void 0, [value]);
130
+ const bodyErrors = skipBody ? [] : validateErrors ?? [];
131
+ const errors = [...bodyErrors];
132
+ let elevation = 2;
133
+ if (props.paper) {
134
+ elevation += props.elevation ?? 0;
135
+ }
136
+ return /* @__PURE__ */ jsxs3(PropertyGroup2, { titleProps: { elevation }, title: "Validation", tip: "The results from validating the payload", ...props, children: [
137
+ /* @__PURE__ */ jsx4(
138
+ Property2,
139
+ {
140
+ titleProps: { elevation },
141
+ flexGrow: 1,
142
+ title: "Valid",
143
+ value: errors.length === 0 ? "True" : "False",
144
+ tip: errors.length > 0 ? /* @__PURE__ */ jsx4(FlexCol2, { children: errors.map((error, index) => {
145
+ return /* @__PURE__ */ jsx4(Typography2, { children: error.toString() }, index);
146
+ }) }) : /* @__PURE__ */ jsx4(Typography2, { children: "No Errors" })
147
+ }
148
+ ),
149
+ value?.schema && /* @__PURE__ */ jsx4(SchemaProperty, { flexGrow: 1, titleProps: { elevation }, value: value.schema })
150
+ ] });
151
+ };
152
+
153
+ // src/components/Details/Details.tsx
154
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
155
+ var PayloadDetails = forwardRef(({ paper, payload, ...props }, ref) => {
156
+ return /* @__PURE__ */ jsxs4(FlexCol3, { gap: 1, justifyContent: "flex-start", alignItems: "stretch", marginTop: 2, marginBottom: 8, ref, ...props, children: [
157
+ /* @__PURE__ */ jsx5(PayloadDataDetails, { paper, size: "large", badge: true, payload }),
158
+ /* @__PURE__ */ jsx5(PayloadValidationDetails, { paper, value: payload }),
159
+ /* @__PURE__ */ jsx5(PayloadJsonDetails, { paper, payload })
160
+ ] });
161
+ });
162
+ PayloadDetails.displayName = "PayloadDetails";
163
+ export {
164
+ PayloadDataDetails,
165
+ PayloadDetails,
166
+ PayloadJsonDetails,
167
+ PayloadValidationDetails
168
+ };
169
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Details/DataDetails.tsx","../src/components/Details/HashSourceDetails.tsx","../src/components/Details/Details.tsx","../src/components/Details/JsonDetails.tsx","../src/components/Details/ValidationDetails/ValidationDetails.tsx"],"sourcesContent":["import ContentCopyIcon from '@mui/icons-material/ContentCopy'\nimport VisibilityIcon from '@mui/icons-material/Visibility'\nimport { Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { Payload } from '@xyo-network/payload-model'\nimport { Property, PropertyAction, PropertyProps } from '@xyo-network/react-property'\nimport { SizeProp, usePayloadHash } from '@xyo-network/react-shared'\nimport { useState } from 'react'\n\nimport { PayloadHashSourceDetails } from './HashSourceDetails'\n\nexport type PayloadDataDetailsProps = PropertyProps & {\n badge?: boolean\n payload?: Payload\n size?: SizeProp\n}\n\nexport const PayloadDataDetails: React.FC<PayloadDataDetailsProps> = ({ size, badge, payload, ...props }) => {\n const payloadString = payload ? JSON.stringify(PayloadHasher.hashFields(payload), null, 2) : ''\n\n const [viewSourceOpen, setViewSourceOpen] = useState(false)\n const hash = usePayloadHash(payload)\n\n let elevation = 2\n if (props.paper) {\n elevation += props.elevation ?? 0\n }\n\n const actions: PropertyAction[] = [\n {\n icon: <VisibilityIcon />,\n name: 'View',\n onClick: () => setViewSourceOpen(true),\n },\n {\n icon: <ContentCopyIcon />,\n name: 'Copy',\n onClick: async () => await navigator.clipboard.writeText(hash ?? ''),\n },\n ]\n\n const onCopy = async () => {\n await navigator.clipboard.writeText(payloadString)\n }\n\n return (\n <>\n <Property\n titleProps={{ elevation }}\n badge={badge}\n size={size}\n actions={actions}\n title=\"Payload Hash\"\n value={hash ?? '<Unknown>'}\n tip=\"This is the payload hash\"\n {...props}\n />\n <Dialog open={viewSourceOpen} onClose={() => setViewSourceOpen(false)}>\n <DialogTitle>Hash Source</DialogTitle>\n <DialogContent>\n <PayloadHashSourceDetails noTitle payload={payload} />\n </DialogContent>\n <DialogActions>\n <ButtonEx color=\"secondary\" onClick={onCopy}>\n Copy\n </ButtonEx>\n <ButtonEx color=\"secondary\" onClick={() => setViewSourceOpen(false)}>\n Close\n </ButtonEx>\n </DialogActions>\n </Dialog>\n </>\n )\n}\n","import ContentCopyIcon from '@mui/icons-material/ContentCopy'\nimport { IconButton, Typography, useTheme } from '@mui/material'\nimport { FlexBoxProps, FlexCol, FlexGrowRow, FlexRow } from '@xylabs/react-flexbox'\nimport { QuickTipButton } from '@xylabs/react-quick-tip-button'\nimport { PayloadHasher } from '@xyo-network/hash'\nimport { Payload } from '@xyo-network/payload-model'\n\nexport interface PayloadHashSourceDetailsProps extends FlexBoxProps {\n noTitle?: boolean\n payload?: Payload\n}\n\nexport const PayloadHashSourceDetails: React.FC<PayloadHashSourceDetailsProps> = ({ noTitle = false, payload, ...props }) => {\n const theme = useTheme()\n const payloadString = payload ? JSON.stringify(PayloadHasher.hashFields(payload), null, 2) : ''\n\n return (\n <FlexCol alignItems=\"stretch\" {...props}>\n {noTitle ? null : (\n <FlexRow margin={1} justifyContent=\"flex-start\">\n <Typography>Hash Source</Typography>\n <QuickTipButton title=\"Hash Source\">The actual string used to generate the hash (SHA256)</QuickTipButton>\n </FlexRow>\n )}\n <FlexRow>\n <FlexGrowRow background border={1} borderColor={theme.palette.divider} justifyContent=\"start\">\n <Typography padding={2} fontFamily=\"monospace\" variant=\"body1\" sx={{ overflowWrap: 'break-word', wordBreak: 'break-all' }}>\n {payloadString}\n </Typography>\n </FlexGrowRow>\n <IconButton>\n <ContentCopyIcon />\n </IconButton>\n </FlexRow>\n {noTitle ? (\n <FlexRow margin={1} justifyContent=\"flex-start\">\n <Typography variant=\"body2\">\n The actual string used to generate the hash (SHA256). This can be used to validate the hash manually.\n </Typography>\n </FlexRow>\n ) : null}\n </FlexCol>\n )\n}\n","import { FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { forwardRef } from 'react'\n\nimport { PayloadDataDetails } from './DataDetails'\nimport { PayloadJsonDetails } from './JsonDetails'\nimport { PayloadValidationDetails } from './ValidationDetails'\n\nexport type WithPaper<T> = T & { paper: true }\nexport type WithoutPaper<T> = T & { paper?: false }\n\nexport type PayloadDetailsProps = FlexBoxProps & {\n paper?: boolean\n payload?: Payload\n}\n\nexport const PayloadDetails = forwardRef<HTMLDivElement, PayloadDetailsProps>(({ paper, payload, ...props }, ref) => {\n return (\n <FlexCol gap={1} justifyContent=\"flex-start\" alignItems=\"stretch\" marginTop={2} marginBottom={8} ref={ref} {...props}>\n <PayloadDataDetails paper={paper} size=\"large\" badge payload={payload} />\n <PayloadValidationDetails paper={paper} value={payload} />\n <PayloadJsonDetails paper={paper} payload={payload} />\n </FlexCol>\n )\n})\n\nPayloadDetails.displayName = 'PayloadDetails'\n","import { Paper, useMediaQuery, useTheme } from '@mui/material'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { Payload } from '@xyo-network/payload-model'\nimport { PropertyGroup, PropertyGroupProps } from '@xyo-network/react-property'\nimport { lazy, Suspense } from 'react'\nimport { ReactJsonViewProps } from 'react-json-view'\n\nconst JsonView = lazy(() => import(/* webpackChunkName: \"jsonView\" */ 'react-json-view'))\n\nexport type PayloadJsonDetailsProps = PropertyGroupProps & {\n jsonViewProps?: ReactJsonViewProps\n payload?: Payload\n}\n\nexport const PayloadJsonDetails: React.FC<PayloadJsonDetailsProps> = ({ jsonViewProps, payload = {}, ...props }) => {\n const { breakpoints, palette } = useTheme()\n const belowSm = useMediaQuery(breakpoints.down('sm'))\n\n let elevation = 2\n if (props.paper) {\n elevation += props.elevation ?? 0\n }\n\n const jsonTheme = palette.mode === 'dark' ? 'shapeshifter' : undefined\n\n return (\n <PropertyGroup titleProps={{ elevation }} title=\"JSON\" tip=\"The raw JSON of the payload\" {...props}>\n <Paper square variant=\"elevation\" style={{ overflow: 'hidden', padding: '16px', width: '100%' }}>\n <Suspense fallback={<FlexGrowRow />}>\n <JsonView\n groupArraysAfterLength={20}\n style={{ backgroundColor: undefined, overflow: 'hidden' }}\n src={payload}\n enableClipboard\n theme={jsonTheme}\n collapseStringsAfterLength={belowSm ? 24 : 32}\n {...jsonViewProps}\n />\n </Suspense>\n </Paper>\n </PropertyGroup>\n )\n}\n","import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { PayloadValidator } from '@xyo-network/payload-validator'\nimport { Property, PropertyGroup } from '@xyo-network/react-property'\nimport { SchemaProperty } from '@xyo-network/react-schema'\n\nimport { PayloadValidationDetailsProps } from './ValidationDetailsProps'\n\nexport const PayloadValidationDetails: React.FC<PayloadValidationDetailsProps> = ({ skipBody = false, value, ...props }) => {\n const [validateErrors] = usePromise(async () => (value ? await new PayloadValidator(value).validate() : undefined), [value])\n\n const bodyErrors = skipBody ? [] : validateErrors ?? []\n const errors: Error[] = [...bodyErrors]\n\n let elevation = 2\n if (props.paper) {\n elevation += props.elevation ?? 0\n }\n\n return (\n <PropertyGroup titleProps={{ elevation }} title=\"Validation\" tip=\"The results from validating the payload\" {...props}>\n <Property\n titleProps={{ elevation }}\n flexGrow={1}\n title=\"Valid\"\n value={errors.length === 0 ? 'True' : 'False'}\n tip={\n errors.length > 0 ? (\n <FlexCol>\n {errors.map((error, index) => {\n return <Typography key={index}>{error.toString()}</Typography>\n })}\n </FlexCol>\n ) : (\n <Typography>No Errors</Typography>\n )\n }\n />\n {value?.schema && <SchemaProperty flexGrow={1} titleProps={{ elevation }} value={value.schema} />}\n </PropertyGroup>\n )\n}\n"],"mappings":";AAAA,OAAOA,sBAAqB;AAC5B,OAAO,oBAAoB;AAC3B,SAAS,QAAQ,eAAe,eAAe,mBAAmB;AAClE,SAAS,gBAAgB;AACzB,SAAS,iBAAAC,sBAAqB;AAE9B,SAAS,gBAA+C;AACxD,SAAmB,sBAAsB;AACzC,SAAS,gBAAgB;;;ACRzB,OAAO,qBAAqB;AAC5B,SAAS,YAAY,YAAY,gBAAgB;AACjD,SAAuB,SAAS,aAAa,eAAe;AAC5D,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAetB,SACE,KADF;AAPD,IAAM,2BAAoE,CAAC,EAAE,UAAU,OAAO,SAAS,GAAG,MAAM,MAAM;AAC3H,QAAM,QAAQ,SAAS;AACvB,QAAM,gBAAgB,UAAU,KAAK,UAAU,cAAc,WAAW,OAAO,GAAG,MAAM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AACF;AAAA,MAAA;AAAA,QACC,YAAY,EAAE,UAAU;AAAA,QACxB,UAAU;AAAA,QACV,OAAM;AAAA,QACN,OAAO,OAAO,WAAW,IAAI,SAAS;AAAA,QACtC,KACE,OAAO,SAAS,IACd,gBAAAE,KAACH,UAAA,EACE,iBAAO,IAAI,CAAC,OAAO,UAAU;AAC5B,iBAAO,gBAAAG,KAACJ,aAAA,EAAwB,gBAAM,SAAS,KAAvB,KAAyB;AAAA,QACnD,CAAC,GACH,IAEA,gBAAAI,KAACJ,aAAA,EAAW,uBAAS;AAAA;AAAA,IAG3B;AAAA,IACC,OAAO,UAAU,gBAAAI,KAAC,kBAAe,UAAU,GAAG,YAAY,EAAE,UAAU,GAAG,OAAO,MAAM,QAAQ;AAAA,KACjG;AAEJ;;;AFxBI,SACE,OAAAE,MADF,QAAAC,aAAA;AAFG,IAAM,iBAAiB,WAAgD,CAAC,EAAE,OAAO,SAAS,GAAG,MAAM,GAAG,QAAQ;AACnH,SACE,gBAAAA,MAACC,UAAA,EAAQ,KAAK,GAAG,gBAAe,cAAa,YAAW,WAAU,WAAW,GAAG,cAAc,GAAG,KAAW,GAAG,OAC7G;AAAA,oBAAAF,KAAC,sBAAmB,OAAc,MAAK,SAAQ,OAAK,MAAC,SAAkB;AAAA,IACvE,gBAAAA,KAAC,4BAAyB,OAAc,OAAO,SAAS;AAAA,IACxD,gBAAAA,KAAC,sBAAmB,OAAc,SAAkB;AAAA,KACtD;AAEJ,CAAC;AAED,eAAe,cAAc;","names":["ContentCopyIcon","PayloadHasher","jsx","jsxs","PayloadHasher","ContentCopyIcon","FlexCol","useTheme","FlexGrowRow","jsx","Typography","FlexCol","Property","PropertyGroup","jsx","jsxs","jsx","jsxs","FlexCol"]}
package/package.json CHANGED
@@ -10,23 +10,23 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/react-button": "~2.17.15",
14
- "@xylabs/react-flexbox": "~2.17.15",
15
- "@xylabs/react-promise": "~2.17.15",
16
- "@xylabs/react-quick-tip-button": "~2.17.15",
17
- "@xyo-network/payload-model": "^2.73.3",
18
- "@xyo-network/payload-validator": "^2.73.3",
19
- "@xyo-network/payload-wrapper": "^2.73.3",
20
- "@xyo-network/react-property": "~2.61.0",
21
- "@xyo-network/react-schema": "~2.61.0",
22
- "@xyo-network/react-shared": "~2.61.0",
13
+ "@xylabs/react-button": "~2.18.4",
14
+ "@xylabs/react-flexbox": "~2.18.4",
15
+ "@xylabs/react-promise": "~2.18.4",
16
+ "@xylabs/react-quick-tip-button": "~2.18.4",
17
+ "@xyo-network/hash": "^2.74.1",
18
+ "@xyo-network/payload-model": "^2.74.1",
19
+ "@xyo-network/payload-validator": "^2.74.1",
20
+ "@xyo-network/react-property": "~2.62.3",
21
+ "@xyo-network/react-schema": "~2.62.3",
22
+ "@xyo-network/react-shared": "~2.62.3",
23
23
  "react-json-view": "^1.21.3"
24
24
  },
25
25
  "devDependencies": {
26
- "@storybook/react": "^7.4.0",
27
- "@xylabs/ts-scripts-yarn3": "^2.19.5",
28
- "@xylabs/tsconfig-react": "^2.19.5",
29
- "@xyo-network/react-storybook": "~2.61.0",
26
+ "@storybook/react": "^7.4.3",
27
+ "@xylabs/ts-scripts-yarn3": "^3.0.28",
28
+ "@xylabs/tsconfig-react": "^3.0.28",
29
+ "@xyo-network/react-storybook": "~2.62.3",
30
30
  "typescript": "^5.2.2"
31
31
  },
32
32
  "peerDependencies": {
@@ -39,27 +39,35 @@
39
39
  "react-router-dom": "^6"
40
40
  },
41
41
  "description": "Common React library for all XYO projects that use React",
42
- "browser": "dist/esm/index.js",
43
42
  "docs": "dist/docs.json",
44
43
  "exports": {
45
44
  ".": {
46
45
  "node": {
47
- "import": "./dist/esm/index.js",
48
- "require": "./dist/cjs/index.js"
46
+ "import": {
47
+ "types": "./dist/index.d.mts",
48
+ "default": "./dist/index.mjs"
49
+ },
50
+ "require": {
51
+ "types": "./dist/index.d.ts",
52
+ "default": "./dist/index.js"
53
+ }
49
54
  },
50
55
  "browser": {
51
- "import": "./dist/esm/index.js",
52
- "require": "./dist/cjs/index.js"
56
+ "import": {
57
+ "types": "./dist/index.d.mts",
58
+ "default": "./dist/index.mjs"
59
+ },
60
+ "require": {
61
+ "types": "./dist/index.d.ts",
62
+ "default": "./dist/index.js"
63
+ }
53
64
  },
54
- "default": "./dist/esm/index.js"
55
- },
56
- "./dist/docs.json": {
57
- "default": "./dist/docs.json"
65
+ "default": "./dist/index.mjs"
58
66
  },
59
67
  "./package.json": "./package.json"
60
68
  },
61
- "main": "dist/cjs/index.js",
62
- "module": "dist/esm/index.js",
69
+ "main": "dist/index.js",
70
+ "module": "dist/index.mjs",
63
71
  "homepage": "https://xyo.network",
64
72
  "keywords": [
65
73
  "xyo",
@@ -80,6 +88,6 @@
80
88
  "license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\""
81
89
  },
82
90
  "sideEffects": false,
83
- "types": "dist/types/index.d.ts",
84
- "version": "2.61.0"
91
+ "types": "dist/index.d.ts",
92
+ "version": "2.62.3"
85
93
  }
@@ -2,8 +2,8 @@ import ContentCopyIcon from '@mui/icons-material/ContentCopy'
2
2
  import VisibilityIcon from '@mui/icons-material/Visibility'
3
3
  import { Dialog, DialogActions, DialogContent, DialogTitle } from '@mui/material'
4
4
  import { ButtonEx } from '@xylabs/react-button'
5
+ import { PayloadHasher } from '@xyo-network/hash'
5
6
  import { Payload } from '@xyo-network/payload-model'
6
- import { PayloadWrapper } from '@xyo-network/payload-wrapper'
7
7
  import { Property, PropertyAction, PropertyProps } from '@xyo-network/react-property'
8
8
  import { SizeProp, usePayloadHash } from '@xyo-network/react-shared'
9
9
  import { useState } from 'react'
@@ -17,7 +17,7 @@ export type PayloadDataDetailsProps = PropertyProps & {
17
17
  }
18
18
 
19
19
  export const PayloadDataDetails: React.FC<PayloadDataDetailsProps> = ({ size, badge, payload, ...props }) => {
20
- const wrapper = payload ? PayloadWrapper.wrap(payload) : undefined
20
+ const payloadString = payload ? JSON.stringify(PayloadHasher.hashFields(payload), null, 2) : ''
21
21
 
22
22
  const [viewSourceOpen, setViewSourceOpen] = useState(false)
23
23
  const hash = usePayloadHash(payload)
@@ -41,7 +41,7 @@ export const PayloadDataDetails: React.FC<PayloadDataDetailsProps> = ({ size, ba
41
41
  ]
42
42
 
43
43
  const onCopy = async () => {
44
- await navigator.clipboard.writeText(wrapper?.stringified ?? '')
44
+ await navigator.clipboard.writeText(payloadString)
45
45
  }
46
46
 
47
47
  return (
@@ -2,8 +2,8 @@ import ContentCopyIcon from '@mui/icons-material/ContentCopy'
2
2
  import { IconButton, Typography, useTheme } from '@mui/material'
3
3
  import { FlexBoxProps, FlexCol, FlexGrowRow, FlexRow } from '@xylabs/react-flexbox'
4
4
  import { QuickTipButton } from '@xylabs/react-quick-tip-button'
5
+ import { PayloadHasher } from '@xyo-network/hash'
5
6
  import { Payload } from '@xyo-network/payload-model'
6
- import { PayloadWrapper } from '@xyo-network/payload-wrapper'
7
7
 
8
8
  export interface PayloadHashSourceDetailsProps extends FlexBoxProps {
9
9
  noTitle?: boolean
@@ -12,7 +12,7 @@ export interface PayloadHashSourceDetailsProps extends FlexBoxProps {
12
12
 
13
13
  export const PayloadHashSourceDetails: React.FC<PayloadHashSourceDetailsProps> = ({ noTitle = false, payload, ...props }) => {
14
14
  const theme = useTheme()
15
- const payloadWrapper = payload ? PayloadWrapper.wrap(payload) : null
15
+ const payloadString = payload ? JSON.stringify(PayloadHasher.hashFields(payload), null, 2) : ''
16
16
 
17
17
  return (
18
18
  <FlexCol alignItems="stretch" {...props}>
@@ -25,7 +25,7 @@ export const PayloadHashSourceDetails: React.FC<PayloadHashSourceDetailsProps> =
25
25
  <FlexRow>
26
26
  <FlexGrowRow background border={1} borderColor={theme.palette.divider} justifyContent="start">
27
27
  <Typography padding={2} fontFamily="monospace" variant="body1" sx={{ overflowWrap: 'break-word', wordBreak: 'break-all' }}>
28
- {payloadWrapper?.stringified ?? ''}
28
+ {payloadString}
29
29
  </Typography>
30
30
  </FlexGrowRow>
31
31
  <IconButton>