@xyo-network/react-property 2.46.7 → 2.46.9
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.js +13 -10
- package/dist/cjs/components/Property.js.map +1 -1
- package/dist/cjs/components/Value.js +5 -4
- package/dist/cjs/components/Value.js.map +1 -1
- package/dist/docs.json +1251 -1197
- package/dist/esm/components/Property.js +13 -9
- package/dist/esm/components/Property.js.map +1 -1
- package/dist/esm/components/Value.js +5 -3
- package/dist/esm/components/Value.js.map +1 -1
- package/dist/types/components/Property.d.ts +2 -2
- package/dist/types/components/Property.d.ts.map +1 -1
- package/dist/types/components/Value.d.ts +2 -2
- package/dist/types/components/Value.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/Property.tsx +52 -57
- package/src/components/Value.tsx +7 -4
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CircularProgress, Paper } from '@mui/material';
|
|
3
3
|
import { FlexRow } from '@xylabs/react-flexbox';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
4
5
|
import { PropertyActionsMenu } from './ActionsMenu';
|
|
5
6
|
import { IdenticonCorner } from './IdenticonCorner';
|
|
6
7
|
import { PropertyTitle } from './Title';
|
|
7
8
|
import { PropertyValue } from './Value';
|
|
8
|
-
const PropertyBox = ({ titleProps, title, value, children, size = 'medium', tip, actions, required, badge = false, ...props }) => {
|
|
9
|
+
const PropertyBox = forwardRef(({ titleProps, title, value, children, size = 'medium', tip, actions, required, badge = false, ...props }, ref) => {
|
|
9
10
|
const sizeValueHeight = {
|
|
10
11
|
large: 48,
|
|
11
12
|
medium: 36,
|
|
@@ -16,12 +17,15 @@ const PropertyBox = ({ titleProps, title, value, children, size = 'medium', tip,
|
|
|
16
17
|
medium: 'body1',
|
|
17
18
|
small: 'body2',
|
|
18
19
|
};
|
|
19
|
-
return (_jsxs(FlexRow, { flexDirection: "column", minWidth: 0, alignItems: "stretch", overflow: "hidden", ...props, children: [title !== undefined ? (_jsx(PropertyTitle, { tip: tip, title: required ? `${title}*` : title, size: size, more: _jsx(PropertyActionsMenu, { actions: actions }), ...titleProps })) : null, _jsxs(FlexRow, { pl: 1, columnGap: 1, justifyContent: value === undefined ? 'center' : 'space-between', overflow: "hidden", height: sizeValueHeight[size], children: [children ? (children) : value !== undefined ? (_jsx(PropertyValue, { value: value, typographyVariant: sizeVariants[size] })) : (_jsx(CircularProgress, { size: 16 })), value !== undefined ? badge ? _jsx(IdenticonCorner, { value: value }) : null : null] })] }));
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
return (_jsxs(FlexRow, { ref: ref, flexDirection: "column", minWidth: 0, alignItems: "stretch", overflow: "hidden", ...props, children: [title !== undefined ? (_jsx(PropertyTitle, { tip: tip, title: required ? `${title}*` : title, size: size, more: _jsx(PropertyActionsMenu, { actions: actions }), ...titleProps })) : null, _jsxs(FlexRow, { pl: 1, columnGap: 1, justifyContent: value === undefined ? 'center' : 'space-between', overflow: "hidden", height: sizeValueHeight[size], children: [children ? (children) : value !== undefined ? (_jsx(PropertyValue, { value: value, typographyVariant: sizeVariants[size] })) : (_jsx(CircularProgress, { size: 16 })), value !== undefined ? badge ? _jsx(IdenticonCorner, { value: value }) : null : null] })] }));
|
|
21
|
+
});
|
|
22
|
+
PropertyBox.displayName = 'PropertyBox';
|
|
23
|
+
const PropertyPaper = forwardRef(({ style, variant, elevation = 2, square, ...props }, ref) => {
|
|
24
|
+
return (_jsx(Paper, { ref: ref, style: { minWidth: 0, overflow: 'hidden', ...style }, variant: variant, elevation: elevation, square: square, children: _jsx(PropertyBox, { ...props, paper: false }) }));
|
|
25
|
+
});
|
|
26
|
+
PropertyPaper.displayName = 'PropertyPaper';
|
|
27
|
+
export const Property = forwardRef((props, ref) => {
|
|
28
|
+
return props.paper ? _jsx(PropertyPaper, { ref: ref, ...props }) : _jsx(PropertyBox, { ref: ref, ...props });
|
|
29
|
+
});
|
|
30
|
+
Property.displayName = 'Property';
|
|
27
31
|
//# sourceMappingURL=Property.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Property.js","sourceRoot":"","sources":["../../../src/components/Property.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"Property.js","sourceRoot":"","sources":["../../../src/components/Property.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { EllipsizeBox } from '@xyo-network/react-shared';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
export const PropertyValue = forwardRef(({ typographyVariant = 'body1', value, ...props }, ref) => {
|
|
5
|
+
return value !== undefined ? (_jsx(EllipsizeBox, { typographyProps: { component: undefined, title: value?.toString(), variant: typographyVariant }, width: "100%", ref: ref, ...props, children: value })) : null;
|
|
6
|
+
});
|
|
7
|
+
PropertyValue.displayName = 'PropertyValue';
|
|
6
8
|
//# sourceMappingURL=Value.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Value.js","sourceRoot":"","sources":["../../../src/components/Value.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAqB,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"Value.js","sourceRoot":"","sources":["../../../src/components/Value.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAqB,MAAM,2BAA2B,CAAA;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAOlC,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAqC,CAAC,EAAE,iBAAiB,GAAG,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACpI,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAC3B,KAAC,YAAY,IAAC,eAAe,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,KAAK,EAAC,MAAM,EAAC,GAAG,EAAE,GAAG,KAAM,KAAK,YAC5I,KAAK,GACO,CAChB,CAAC,CAAC,CAAC,IAAI,CAAA;AACV,CAAC,CAAC,CAAA;AAEF,aAAa,CAAC,WAAW,GAAG,eAAe,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export declare const Property:
|
|
2
|
+
import { PropertyBoxProps, PropertyPaperProps } from './Props';
|
|
3
|
+
export declare const Property: import("react").ForwardRefExoticComponent<(PropertyBoxProps | Omit<PropertyPaperProps, "ref">) & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
4
|
//# sourceMappingURL=Property.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Property.d.ts","sourceRoot":"","sources":["../../../src/components/Property.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Property.d.ts","sourceRoot":"","sources":["../../../src/components/Property.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAiB,MAAM,SAAS,CAAA;AA4D7E,eAAO,MAAM,QAAQ,iJAEnB,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Variant } from '@mui/material/styles/createTypography';
|
|
3
3
|
import { EllipsizeBoxProps } from '@xyo-network/react-shared';
|
|
4
|
-
export interface PropertyValueProps extends EllipsizeBoxProps {
|
|
4
|
+
export interface PropertyValueProps extends Omit<EllipsizeBoxProps, 'ref'> {
|
|
5
5
|
typographyVariant?: Variant;
|
|
6
6
|
value?: string | number | boolean | null;
|
|
7
7
|
}
|
|
8
|
-
export declare const PropertyValue:
|
|
8
|
+
export declare const PropertyValue: import("react").ForwardRefExoticComponent<PropertyValueProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
9
|
//# sourceMappingURL=Value.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Value.d.ts","sourceRoot":"","sources":["../../../src/components/Value.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAA;AAC/D,OAAO,EAAgB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"Value.d.ts","sourceRoot":"","sources":["../../../src/components/Value.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAA;AAC/D,OAAO,EAAgB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAG3E,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC;IACxE,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;CACzC;AAED,eAAO,MAAM,aAAa,+GAMxB,CAAA"}
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@xylabs/react-flexbox": "^2.16.11",
|
|
15
15
|
"@xylabs/react-identicon": "^2.16.11",
|
|
16
16
|
"@xylabs/react-quick-tip-button": "^2.16.11",
|
|
17
|
-
"@xyo-network/react-shared": "^2.46.
|
|
17
|
+
"@xyo-network/react-shared": "^2.46.9"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@mui/icons-material": "^5",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"@storybook/react": "^6.5.16",
|
|
30
30
|
"@xylabs/ts-scripts-yarn3": "^2.16.1",
|
|
31
31
|
"@xylabs/tsconfig-react": "^2.16.1",
|
|
32
|
-
"@xyo-network/payload-wrapper": "^2.53.
|
|
33
|
-
"@xyo-network/react-storybook": "^2.46.
|
|
34
|
-
"@xyo-network/typeof": "^2.53.
|
|
32
|
+
"@xyo-network/payload-wrapper": "^2.53.3",
|
|
33
|
+
"@xyo-network/react-storybook": "^2.46.9",
|
|
34
|
+
"@xyo-network/typeof": "^2.53.3",
|
|
35
35
|
"require-from-string": "^2.0.2",
|
|
36
36
|
"typescript": "^4.9.5"
|
|
37
37
|
},
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
},
|
|
79
79
|
"sideEffects": false,
|
|
80
80
|
"types": "dist/types/index.d.ts",
|
|
81
|
-
"version": "2.46.
|
|
81
|
+
"version": "2.46.9"
|
|
82
82
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CircularProgress, Paper, TypographyVariant } from '@mui/material'
|
|
2
2
|
import { FlexRow } from '@xylabs/react-flexbox'
|
|
3
3
|
import { SizeProp } from '@xyo-network/react-shared'
|
|
4
|
+
import { forwardRef } from 'react'
|
|
4
5
|
|
|
5
6
|
import { PropertyActionsMenu } from './ActionsMenu'
|
|
6
7
|
import { IdenticonCorner } from './IdenticonCorner'
|
|
@@ -8,69 +9,63 @@ import { PropertyBoxProps, PropertyPaperProps, PropertyProps } from './Props'
|
|
|
8
9
|
import { PropertyTitle } from './Title'
|
|
9
10
|
import { PropertyValue } from './Value'
|
|
10
11
|
|
|
11
|
-
const PropertyBox
|
|
12
|
-
titleProps,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
actions,
|
|
19
|
-
required,
|
|
20
|
-
badge = false,
|
|
21
|
-
...props
|
|
22
|
-
}) => {
|
|
23
|
-
const sizeValueHeight: Record<SizeProp, number> = {
|
|
24
|
-
large: 48,
|
|
25
|
-
medium: 36,
|
|
26
|
-
small: 24,
|
|
27
|
-
}
|
|
12
|
+
const PropertyBox = forwardRef<HTMLDivElement, PropertyBoxProps>(
|
|
13
|
+
({ titleProps, title, value, children, size = 'medium', tip, actions, required, badge = false, ...props }, ref) => {
|
|
14
|
+
const sizeValueHeight: Record<SizeProp, number> = {
|
|
15
|
+
large: 48,
|
|
16
|
+
medium: 36,
|
|
17
|
+
small: 24,
|
|
18
|
+
}
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
const sizeVariants: Record<SizeProp, TypographyVariant> = {
|
|
21
|
+
large: 'h6',
|
|
22
|
+
medium: 'body1',
|
|
23
|
+
small: 'body2',
|
|
24
|
+
}
|
|
34
25
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
26
|
+
return (
|
|
27
|
+
<FlexRow ref={ref} flexDirection="column" minWidth={0} alignItems="stretch" overflow="hidden" {...props}>
|
|
28
|
+
{title !== undefined ? (
|
|
29
|
+
<PropertyTitle
|
|
30
|
+
tip={tip}
|
|
31
|
+
title={required ? `${title}*` : title}
|
|
32
|
+
size={size}
|
|
33
|
+
more={<PropertyActionsMenu actions={actions} />}
|
|
34
|
+
{...titleProps}
|
|
35
|
+
/>
|
|
36
|
+
) : null}
|
|
37
|
+
<FlexRow
|
|
38
|
+
pl={1}
|
|
39
|
+
columnGap={1}
|
|
40
|
+
justifyContent={value === undefined ? 'center' : 'space-between'}
|
|
41
|
+
overflow="hidden"
|
|
42
|
+
height={sizeValueHeight[size]}
|
|
43
|
+
>
|
|
44
|
+
{children ? (
|
|
45
|
+
children
|
|
46
|
+
) : value !== undefined ? (
|
|
47
|
+
<PropertyValue value={value} typographyVariant={sizeVariants[size]} />
|
|
48
|
+
) : (
|
|
49
|
+
<CircularProgress size={16} />
|
|
50
|
+
)}
|
|
51
|
+
{value !== undefined ? badge ? <IdenticonCorner value={value} /> : null : null}
|
|
52
|
+
</FlexRow>
|
|
61
53
|
</FlexRow>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
)
|
|
55
|
+
},
|
|
56
|
+
)
|
|
57
|
+
PropertyBox.displayName = 'PropertyBox'
|
|
65
58
|
|
|
66
|
-
const PropertyPaper
|
|
59
|
+
const PropertyPaper = forwardRef<HTMLDivElement, PropertyPaperProps>(({ style, variant, elevation = 2, square, ...props }, ref) => {
|
|
67
60
|
return (
|
|
68
|
-
<Paper style={{ minWidth: 0, overflow: 'hidden', ...style }} variant={variant} elevation={elevation} square={square}>
|
|
61
|
+
<Paper ref={ref} style={{ minWidth: 0, overflow: 'hidden', ...style }} variant={variant} elevation={elevation} square={square}>
|
|
69
62
|
<PropertyBox {...props} paper={false} />
|
|
70
63
|
</Paper>
|
|
71
64
|
)
|
|
72
|
-
}
|
|
65
|
+
})
|
|
66
|
+
PropertyPaper.displayName = 'PropertyPaper'
|
|
73
67
|
|
|
74
|
-
export const Property
|
|
75
|
-
return props.paper ? <PropertyPaper {...props} /> : <PropertyBox {...props} />
|
|
76
|
-
}
|
|
68
|
+
export const Property = forwardRef<HTMLDivElement, PropertyProps>((props, ref) => {
|
|
69
|
+
return props.paper ? <PropertyPaper ref={ref} {...props} /> : <PropertyBox ref={ref} {...props} />
|
|
70
|
+
})
|
|
71
|
+
Property.displayName = 'Property'
|
package/src/components/Value.tsx
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { Variant } from '@mui/material/styles/createTypography'
|
|
2
2
|
import { EllipsizeBox, EllipsizeBoxProps } from '@xyo-network/react-shared'
|
|
3
|
+
import { forwardRef } from 'react'
|
|
3
4
|
|
|
4
|
-
export interface PropertyValueProps extends EllipsizeBoxProps {
|
|
5
|
+
export interface PropertyValueProps extends Omit<EllipsizeBoxProps, 'ref'> {
|
|
5
6
|
typographyVariant?: Variant
|
|
6
7
|
value?: string | number | boolean | null
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
export const PropertyValue
|
|
10
|
+
export const PropertyValue = forwardRef<HTMLDivElement, PropertyValueProps>(({ typographyVariant = 'body1', value, ...props }, ref) => {
|
|
10
11
|
return value !== undefined ? (
|
|
11
|
-
<EllipsizeBox typographyProps={{ component: undefined, title: value?.toString(), variant: typographyVariant }} width="100%" {...props}>
|
|
12
|
+
<EllipsizeBox typographyProps={{ component: undefined, title: value?.toString(), variant: typographyVariant }} width="100%" ref={ref} {...props}>
|
|
12
13
|
{value}
|
|
13
14
|
</EllipsizeBox>
|
|
14
15
|
) : null
|
|
15
|
-
}
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
PropertyValue.displayName = 'PropertyValue'
|