@xyo-network/react-schema 2.25.23 → 2.25.26
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/dist/cjs/components/Property/SchemaProperty.js +4 -3
- package/dist/cjs/components/Property/SchemaProperty.js.map +1 -1
- package/dist/docs.json +5 -5
- package/dist/esm/components/Property/SchemaProperty.js +2 -2
- package/dist/esm/components/Property/SchemaProperty.js.map +1 -1
- package/package.json +14 -14
- package/src/components/Property/SchemaProperty.stories.tsx +5 -2
- package/src/components/Property/SchemaProperty.tsx +2 -3
- package/src/components/SelectEx/SchemaSelectEx.stories.tsx +70 -0
|
@@ -25,10 +25,11 @@ const useResolveSchema = (schema) => {
|
|
|
25
25
|
}), [schema]);
|
|
26
26
|
return entry;
|
|
27
27
|
};
|
|
28
|
-
const SchemaProperty = (
|
|
29
|
-
var
|
|
28
|
+
const SchemaProperty = (_a) => {
|
|
29
|
+
var _b, _c;
|
|
30
|
+
var { titleProps, value, viewSchemaUrl = 'https://explore.xyo.network/' } = _a, props = tslib_1.__rest(_a, ["titleProps", "value", "viewSchemaUrl"]);
|
|
30
31
|
const resolvedSchema = useResolveSchema(value);
|
|
31
|
-
return ((0, jsx_runtime_1.jsxs)(react_property_1.Property, Object.assign({
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)(react_property_1.Property, Object.assign({ title: "Schema", value: value, tip: "Schema sent with the payload", titleProps: titleProps }, props, { children: [value ? (resolvedSchema === null ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ rel: "noopener noreferrer", size: "small", target: "_blank", href: `${viewSchemaUrl}${value}` }, { children: (0, jsx_runtime_1.jsx)(NewReleases_1.default, { color: "warning", fontSize: "inherit" }) }))) : resolvedSchema === undefined ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ rel: "noopener noreferrer", size: "small", target: "_blank", href: `${viewSchemaUrl}${value}` }, { children: (0, jsx_runtime_1.jsx)(NewReleases_1.default, { color: "disabled", fontSize: "inherit" }) }))) : ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ rel: "noopener noreferrer", size: "small", target: "_blank", href: (_c = (_b = resolvedSchema === null || resolvedSchema === void 0 ? void 0 : resolvedSchema.huri) === null || _b === void 0 ? void 0 : _b.href) !== null && _c !== void 0 ? _c : '' }, { children: (0, jsx_runtime_1.jsx)(Verified_1.default, { color: "success", fontSize: "inherit" }) })))) : null, value ? ((0, jsx_runtime_1.jsx)(sdk_react_1.LinkEx, Object.assign({ flexGrow: 1, alignItems: "center", href: `${viewSchemaUrl}${value}`, rel: "noopener noreferrer", display: "flex" }, { children: (0, jsx_runtime_1.jsx)(react_property_1.PropertyValue, { value: value, title: "view schema in new window" }) }))) : null, value ? ((0, jsx_runtime_1.jsx)(sdk_react_1.LinkEx, Object.assign({ marginX: 1, alignItems: "center", href: `${viewSchemaUrl}${value}`, target: "_blank", rel: "noopener noreferrer", display: "flex" }, { children: (0, jsx_runtime_1.jsx)(OpenInNew_1.default, { fontSize: "inherit" }) }))) : null] })));
|
|
32
33
|
};
|
|
33
34
|
exports.SchemaProperty = SchemaProperty;
|
|
34
35
|
//# sourceMappingURL=SchemaProperty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaProperty.js","sourceRoot":"","sources":["../../../../src/components/Property/SchemaProperty.tsx"],"names":[],"mappings":";;;;;AAAA,0FAA6D;AAC7D,sFAAyD;AACzD,oFAAuD;AACvD,4CAA0C;AAC1C,iDAA0D;AAC1D,gEAAoF;
|
|
1
|
+
{"version":3,"file":"SchemaProperty.js","sourceRoot":"","sources":["../../../../src/components/Property/SchemaProperty.tsx"],"names":[],"mappings":";;;;;AAAA,0FAA6D;AAC7D,sFAAyD;AACzD,oFAAuD;AACvD,4CAA0C;AAC1C,iDAA0D;AAC1D,gEAAoF;AACpF,8CAAwE;AACxE,iCAAgC;AAOhC,MAAM,gBAAgB,GAAG,CAAC,MAAe,EAAE,EAAE;IAC3C,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
277
277
|
"fileName": "schema/src/components/Property/SchemaProperty.tsx",
|
|
278
|
-
"line":
|
|
278
|
+
"line": 10,
|
|
279
279
|
"character": 12
|
|
280
280
|
}
|
|
281
281
|
],
|
|
@@ -306,7 +306,7 @@
|
|
|
306
306
|
"sources": [
|
|
307
307
|
{
|
|
308
308
|
"fileName": "schema/src/components/Property/SchemaProperty.tsx",
|
|
309
|
-
"line":
|
|
309
|
+
"line": 11,
|
|
310
310
|
"character": 2
|
|
311
311
|
}
|
|
312
312
|
],
|
|
@@ -326,7 +326,7 @@
|
|
|
326
326
|
"sources": [
|
|
327
327
|
{
|
|
328
328
|
"fileName": "schema/src/components/Property/SchemaProperty.tsx",
|
|
329
|
-
"line":
|
|
329
|
+
"line": 12,
|
|
330
330
|
"character": 2
|
|
331
331
|
}
|
|
332
332
|
],
|
|
@@ -349,7 +349,7 @@
|
|
|
349
349
|
"sources": [
|
|
350
350
|
{
|
|
351
351
|
"fileName": "schema/src/components/Property/SchemaProperty.tsx",
|
|
352
|
-
"line":
|
|
352
|
+
"line": 10,
|
|
353
353
|
"character": 50
|
|
354
354
|
}
|
|
355
355
|
]
|
|
@@ -472,7 +472,7 @@
|
|
|
472
472
|
"sources": [
|
|
473
473
|
{
|
|
474
474
|
"fileName": "schema/src/components/Property/SchemaProperty.tsx",
|
|
475
|
-
"line":
|
|
475
|
+
"line": 32,
|
|
476
476
|
"character": 13
|
|
477
477
|
}
|
|
478
478
|
],
|
|
@@ -21,8 +21,8 @@ const useResolveSchema = (schema) => {
|
|
|
21
21
|
}, [schema]);
|
|
22
22
|
return entry;
|
|
23
23
|
};
|
|
24
|
-
export const SchemaProperty = ({ titleProps, value, viewSchemaUrl = 'https://explore.xyo.network/' }) => {
|
|
24
|
+
export const SchemaProperty = ({ titleProps, value, viewSchemaUrl = 'https://explore.xyo.network/', ...props }) => {
|
|
25
25
|
const resolvedSchema = useResolveSchema(value);
|
|
26
|
-
return (_jsxs(Property, {
|
|
26
|
+
return (_jsxs(Property, { title: "Schema", value: value, tip: "Schema sent with the payload", titleProps: titleProps, ...props, children: [value ? (resolvedSchema === null ? (_jsx(IconButton, { rel: "noopener noreferrer", size: "small", target: "_blank", href: `${viewSchemaUrl}${value}`, children: _jsx(NewReleasesIcon, { color: "warning", fontSize: "inherit" }) })) : resolvedSchema === undefined ? (_jsx(IconButton, { rel: "noopener noreferrer", size: "small", target: "_blank", href: `${viewSchemaUrl}${value}`, children: _jsx(NewReleasesIcon, { color: "disabled", fontSize: "inherit" }) })) : (_jsx(IconButton, { rel: "noopener noreferrer", size: "small", target: "_blank", href: resolvedSchema?.huri?.href ?? '', children: _jsx(VerifiedIcon, { color: "success", fontSize: "inherit" }) }))) : null, value ? (_jsx(LinkEx, { flexGrow: 1, alignItems: "center", href: `${viewSchemaUrl}${value}`, rel: "noopener noreferrer", display: "flex", children: _jsx(PropertyValue, { value: value, title: "view schema in new window" }) })) : null, value ? (_jsx(LinkEx, { marginX: 1, alignItems: "center", href: `${viewSchemaUrl}${value}`, target: "_blank", rel: "noopener noreferrer", display: "flex", children: _jsx(OpenInNewIcon, { fontSize: "inherit" }) })) : null] }));
|
|
27
27
|
};
|
|
28
28
|
//# sourceMappingURL=SchemaProperty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaProperty.js","sourceRoot":"","sources":["../../../../src/components/Property/SchemaProperty.tsx"],"names":[],"mappings":";AAAA,OAAO,eAAe,MAAM,iCAAiC,CAAA;AAC7D,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,YAAY,MAAM,8BAA8B,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAiB,aAAa,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"SchemaProperty.js","sourceRoot":"","sources":["../../../../src/components/Property/S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C,QAAQ,EAAC,IAAI,EAAE,GAAG,aAAa,GAAG,KAAK,EAAE,EAAE,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,qBAAqB,EAAC,OAAO,EAAC,MAAM,YAChI,KAAC,aAAa,IAAC,QAAQ,EAAC,SAAS,GAAG,GAC7B,CACV,CAAC,CAAC,CAAC,IAAI,IACC,CACZ,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"@emotion/styled": "^11.8.1",
|
|
15
15
|
"@mui/material": "^5.8.1",
|
|
16
16
|
"@xylabs/sdk-react": "^2.12.10",
|
|
17
|
-
"@xyo-network/api": "^2.20.
|
|
18
|
-
"@xyo-network/core": "^2.20.
|
|
19
|
-
"@xyo-network/react-archive": "^2.25.
|
|
20
|
-
"@xyo-network/react-archivist-api": "^2.25.
|
|
21
|
-
"@xyo-network/react-shared": "^2.25.
|
|
22
|
-
"@xyo-network/react-theme": "^2.25.
|
|
23
|
-
"@xyo-network/utils": "^2.20.
|
|
17
|
+
"@xyo-network/api": "^2.20.38",
|
|
18
|
+
"@xyo-network/core": "^2.20.38",
|
|
19
|
+
"@xyo-network/react-archive": "^2.25.26",
|
|
20
|
+
"@xyo-network/react-archivist-api": "^2.25.26",
|
|
21
|
+
"@xyo-network/react-shared": "^2.25.26",
|
|
22
|
+
"@xyo-network/react-theme": "^2.25.26",
|
|
23
|
+
"@xyo-network/utils": "^2.20.38",
|
|
24
24
|
"lodash": "^4.17.21",
|
|
25
25
|
"react": "^18.1.0",
|
|
26
26
|
"react-dom": "^18.1.0",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/core": "^7.18.2",
|
|
34
34
|
"@babel/preset-env": "^7.18.2",
|
|
35
|
-
"@storybook/addons": "^6.5.
|
|
36
|
-
"@storybook/api": "^6.5.
|
|
37
|
-
"@storybook/components": "^6.5.
|
|
38
|
-
"@storybook/core-events": "^6.5.
|
|
39
|
-
"@storybook/react": "^6.5.
|
|
40
|
-
"@storybook/theming": "^6.5.
|
|
35
|
+
"@storybook/addons": "^6.5.6",
|
|
36
|
+
"@storybook/api": "^6.5.6",
|
|
37
|
+
"@storybook/components": "^6.5.6",
|
|
38
|
+
"@storybook/core-events": "^6.5.6",
|
|
39
|
+
"@storybook/react": "^6.5.6",
|
|
40
|
+
"@storybook/theming": "^6.5.6",
|
|
41
41
|
"@types/lodash": "^4.14.182",
|
|
42
42
|
"@xylabs/sdk-react": "^2.12.10",
|
|
43
43
|
"@xylabs/ts-scripts": "^1.0.66",
|
|
@@ -104,6 +104,6 @@
|
|
|
104
104
|
},
|
|
105
105
|
"sideEffects": false,
|
|
106
106
|
"types": "dist/esm/index.d.ts",
|
|
107
|
-
"version": "2.25.
|
|
107
|
+
"version": "2.25.26",
|
|
108
108
|
"packageManager": "yarn@3.1.1"
|
|
109
109
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentStory, Meta } from '@storybook/react'
|
|
2
2
|
|
|
3
|
-
import { appThemeDecorator } from '
|
|
3
|
+
import { appThemeDecorator } from '../../../../../.storybook'
|
|
4
4
|
import { SchemaProperty } from './SchemaProperty'
|
|
5
5
|
|
|
6
6
|
const StorybookEntry: Meta = {
|
|
@@ -24,10 +24,13 @@ Default.args = {}
|
|
|
24
24
|
const WithVerfiedValue = Template.bind({})
|
|
25
25
|
WithVerfiedValue.args = { value: 'network.xyo.schema' }
|
|
26
26
|
|
|
27
|
+
const WithVerfiedValuePaper = Template.bind({})
|
|
28
|
+
WithVerfiedValuePaper.args = { paper: true, value: 'network.xyo.schema' }
|
|
29
|
+
|
|
27
30
|
const WithUnverfiedValue = Template.bind({})
|
|
28
31
|
WithUnverfiedValue.args = { value: 'network.xyo.blahblah' }
|
|
29
32
|
|
|
30
|
-
export { Default, WithUnverfiedValue, WithVerfiedValue }
|
|
33
|
+
export { Default, WithUnverfiedValue, WithVerfiedValue, WithVerfiedValuePaper }
|
|
31
34
|
|
|
32
35
|
// eslint-disable-next-line import/no-default-export
|
|
33
36
|
export default StorybookEntry
|
|
@@ -4,7 +4,6 @@ import VerifiedIcon from '@mui/icons-material/Verified'
|
|
|
4
4
|
import { IconButton } from '@mui/material'
|
|
5
5
|
import { LinkEx, useAsyncEffect } from '@xylabs/sdk-react'
|
|
6
6
|
import { Property, PropertyProps, PropertyValue } from '@xyo-network/react-property'
|
|
7
|
-
import { PropertyTitleProps } from '@xyo-network/react-property/dist/esm/components/Title'
|
|
8
7
|
import { XyoSchemaCache, XyoSchemaCacheEntry } from '@xyo-network/utils'
|
|
9
8
|
import { useState } from 'react'
|
|
10
9
|
|
|
@@ -30,10 +29,10 @@ const useResolveSchema = (schema?: string) => {
|
|
|
30
29
|
return entry
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
export const SchemaProperty: React.FC<SchemaPropertyProps> = ({ titleProps, value, viewSchemaUrl = 'https://explore.xyo.network/' }) => {
|
|
32
|
+
export const SchemaProperty: React.FC<SchemaPropertyProps> = ({ titleProps, value, viewSchemaUrl = 'https://explore.xyo.network/', ...props }) => {
|
|
34
33
|
const resolvedSchema = useResolveSchema(value)
|
|
35
34
|
return (
|
|
36
|
-
<Property
|
|
35
|
+
<Property title="Schema" value={value} tip="Schema sent with the payload" titleProps={titleProps} {...props}>
|
|
37
36
|
{value ? (
|
|
38
37
|
resolvedSchema === null ? (
|
|
39
38
|
<IconButton rel="noopener noreferrer" size="small" target="_blank" href={`${viewSchemaUrl}${value}`}>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* eslint-disable import/no-internal-modules */
|
|
2
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react'
|
|
3
|
+
import { SelectExProps } from '@xylabs/sdk-react'
|
|
4
|
+
|
|
5
|
+
import { authDecorator, authServiceList, WrappedArgs } from '../../../../../.storybook'
|
|
6
|
+
import { ArchivistApiProvider } from '../../../../archivist-api/src'
|
|
7
|
+
import { SchemaMemoryProvider } from '../../contexts'
|
|
8
|
+
import { SchemaSelectEx } from './SchemaSelectEx'
|
|
9
|
+
|
|
10
|
+
const StorybookEntry = {
|
|
11
|
+
argTypes: {
|
|
12
|
+
authState: {
|
|
13
|
+
defaultValue: {
|
|
14
|
+
authServiceList,
|
|
15
|
+
jwtToken: 'badToken',
|
|
16
|
+
loggedInAccount: 'none@none.com',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
component: SchemaSelectEx,
|
|
21
|
+
decorators: [authDecorator],
|
|
22
|
+
parameters: {
|
|
23
|
+
docs: {
|
|
24
|
+
page: null,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
title: 'schema/SchemaSelectEx',
|
|
28
|
+
} as ComponentMeta<typeof SchemaSelectEx>
|
|
29
|
+
|
|
30
|
+
const Template: ComponentStory<typeof SchemaSelectEx> = (args) => {
|
|
31
|
+
return <SchemaSelectEx {...args}></SchemaSelectEx>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const TemplateWithProvider: ComponentStory<typeof SchemaSelectEx> = (args) => {
|
|
35
|
+
const combinedArgs = args as WrappedArgs & SelectExProps<string>
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
37
|
+
const { authState, ...props } = combinedArgs
|
|
38
|
+
return (
|
|
39
|
+
<SchemaMemoryProvider knownSchemaList={['network.xyo.schema', 'network.xyo.domain']}>
|
|
40
|
+
<SchemaSelectEx {...props}></SchemaSelectEx>
|
|
41
|
+
</SchemaMemoryProvider>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const TemplateWithApi: ComponentStory<typeof SchemaSelectEx> = (args) => {
|
|
46
|
+
const combinedArgs = args as WrappedArgs & SelectExProps<string>
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
48
|
+
const { authState, ...props } = combinedArgs
|
|
49
|
+
return (
|
|
50
|
+
<ArchivistApiProvider apiDomain="https://beta.api.archivist.xyo.network">
|
|
51
|
+
<SchemaMemoryProvider>
|
|
52
|
+
<SchemaSelectEx {...props}></SchemaSelectEx>
|
|
53
|
+
</SchemaMemoryProvider>
|
|
54
|
+
</ArchivistApiProvider>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const Default = Template.bind({})
|
|
59
|
+
Default.args = {}
|
|
60
|
+
|
|
61
|
+
const WithProvider = TemplateWithProvider.bind({})
|
|
62
|
+
WithProvider.args = {}
|
|
63
|
+
|
|
64
|
+
const WithApi = TemplateWithApi.bind({})
|
|
65
|
+
WithApi.args = {}
|
|
66
|
+
|
|
67
|
+
export { Default, WithApi, WithProvider }
|
|
68
|
+
|
|
69
|
+
// eslint-disable-next-line import/no-default-export
|
|
70
|
+
export default StorybookEntry
|