@xyo-network/react-property 2.25.16 → 2.25.19
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 +3 -2
- package/dist/cjs/components/Property.js.map +1 -1
- package/dist/cjs/components/PropertyGroup.d.ts +3 -0
- package/dist/cjs/components/PropertyGroup.js +19 -0
- package/dist/cjs/components/PropertyGroup.js.map +1 -0
- package/dist/cjs/components/PropertyProps.d.ts +8 -3
- package/dist/cjs/components/Value.js +1 -1
- package/dist/cjs/components/Value.js.map +1 -1
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/docs.json +27463 -2313
- package/dist/esm/components/Property.js +3 -2
- package/dist/esm/components/Property.js.map +1 -1
- package/dist/esm/components/PropertyGroup.d.ts +3 -0
- package/dist/esm/components/PropertyGroup.js +13 -0
- package/dist/esm/components/PropertyGroup.js.map +1 -0
- package/dist/esm/components/PropertyProps.d.ts +8 -3
- package/dist/esm/components/Value.js +1 -1
- package/dist/esm/components/Value.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/Property.tsx +27 -9
- package/src/components/PropertyGroup.tsx +45 -0
- package/src/components/PropertyProps.tsx +9 -3
- package/src/components/Value.tsx +1 -1
- package/src/components/index.ts +1 -0
|
@@ -5,7 +5,7 @@ import { IdenticonCorner } from './IdenticonCorner';
|
|
|
5
5
|
import { PropertyActionsMenu } from './PropertyActionsMenu';
|
|
6
6
|
import { PropertyTitle } from './Title';
|
|
7
7
|
import { PropertyValue } from './Value';
|
|
8
|
-
export const Property = ({ title, value, children, size = 'medium', tip, actions, required, badge = false, ...props }) => {
|
|
8
|
+
export const Property = ({ border, borderColor, borderRadius, variant, title, color = 'secondary', value, children, size = 'medium', tip, actions, required, badge = false, ...props }) => {
|
|
9
9
|
const theme = useTheme();
|
|
10
10
|
const sizeTitleHeight = {
|
|
11
11
|
large: 36,
|
|
@@ -22,6 +22,7 @@ export const Property = ({ title, value, children, size = 'medium', tip, actions
|
|
|
22
22
|
medium: 'body1',
|
|
23
23
|
small: 'body1',
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
const bgcolor = color === 'primary' || color === 'secondary' ? theme.palette[color].main : color;
|
|
26
|
+
return (_jsxs(FlexCol, { minWidth: 0, alignItems: "stretch", border: border ?? variant === 'outlined' ? 1 : undefined, borderColor: borderColor ?? variant === 'outlined' ? theme.palette.divider : undefined, borderRadius: borderRadius ?? variant === 'outlined' ? 1 : undefined, overflow: "hidden", ...props, children: [title !== undefined ? (_jsx(PropertyTitle, { tip: tip, title: required ? `${title}*` : title, size: size, bgcolor: bgcolor, color: theme.palette.getContrastText(bgcolor), height: sizeTitleHeight[size], more: _jsx(PropertyActionsMenu, { actions: actions }) })) : null, _jsxs(FlexRow, { justifyContent: value === undefined ? 'center' : 'space-between', overflow: "hidden", height: sizeValueHeight[size], children: [children ? (children) : value !== undefined ? (_jsx(PropertyValue, { shortSpace: badge ? sizeValueHeight[size] : 0, value: value, typographyVariant: sizeVariants[size] })) : (_jsx(CircularProgress, { size: 16 })), value !== undefined ? badge ? _jsx(IdenticonCorner, { value: value }) : null : null] })] }));
|
|
26
27
|
};
|
|
27
28
|
//# sourceMappingURL=Property.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Property.js","sourceRoot":"","sources":["../../../src/components/Property.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAqB,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAGpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAA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,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,YAAY,CAAC,IAAI,CAAC,GAAI,CACtH,CAAC,CAAC,CAAC,CACF,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,GAAI,CAC/B,EACA,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAC,eAAe,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IACtE,IACF,CACX,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Typography, useTheme } from '@mui/material';
|
|
3
|
+
import { FlexGrowRow, FlexRow, QuickTipButton } from '@xylabs/sdk-react';
|
|
4
|
+
import { typeOf } from '@xyo-network/core';
|
|
5
|
+
export const PropertyGroup = ({ border, borderColor, borderRadius, variant = 'outlined', children, title, color = 'secondary', tip, ...props }) => {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
const bgcolor = color === 'primary' || color === 'secondary' ? theme.palette[color].main : color;
|
|
8
|
+
const childrenArray = typeOf(children) === 'array' ? children : undefined;
|
|
9
|
+
return (_jsxs(FlexRow, { border: border ?? variant === 'outlined' ? 1 : 0, borderColor: borderColor ?? variant === 'outlined' ? theme.palette.divider : undefined, borderRadius: borderRadius ?? variant === 'outlined' ? 1 : undefined, overflow: "hidden", justifyContent: "flex-start", alignItems: "stretch", ...props, children: [_jsxs(FlexRow, { padding: 1, justifyContent: "start", bgcolor: bgcolor, color: theme.palette.getContrastText(bgcolor), children: [_jsx(Typography, { children: title }), tip ? (_jsx(QuickTipButton, { color: "inherit", title: title, children: tip })) : null] }), childrenArray ? (_jsx(FlexGrowRow, { children: childrenArray?.map((child, index) => {
|
|
10
|
+
return child ? (_jsx(FlexGrowRow, { borderLeft: 1, borderColor: theme.palette.divider, children: child }, index)) : null;
|
|
11
|
+
}) })) : (children)] }));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=PropertyGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyGroup.js","sourceRoot":"","sources":["../../../src/components/PropertyGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAK1C,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,GAAG,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,WAAW,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC9K,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,OAAO,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;IAChG,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,OAAO,CAAC,CAAC,CAAE,QAA2B,CAAC,CAAC,CAAC,SAAS,CAAA;IAC7F,OAAO,CACL,MAAC,OAAO,IACN,MAAM,EAAE,MAAM,IAAI,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAChD,WAAW,EAAE,WAAW,IAAI,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EACtF,YAAY,EAAE,YAAY,IAAI,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EACpE,QAAQ,EAAC,QAAQ,EACjB,cAAc,EAAC,YAAY,EAC3B,UAAU,EAAC,SAAS,KAChB,KAAK,aAET,MAAC,OAAO,IAAC,OAAO,EAAE,CAAC,EAAE,cAAc,EAAC,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,aACzG,KAAC,UAAU,cAAE,KAAK,GAAc,EAC/B,GAAG,CAAC,CAAC,CAAC,CACL,KAAC,cAAc,IAAC,KAAK,EAAC,SAAS,EAAC,KAAK,EAAE,KAAK,YACzC,GAAG,GACW,CAClB,CAAC,CAAC,CAAC,IAAI,IACA,EACT,aAAa,CAAC,CAAC,CAAC,CACf,KAAC,WAAW,cACT,aAAa,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;oBACnC,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,WAAW,IAAa,UAAU,EAAE,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,YACvE,KAAK,IADU,KAAK,CAET,CACf,CAAC,CAAC,CAAC,IAAI,CAAA;gBACV,CAAC,CAAC,GACU,CACf,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,IACO,CACX,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -2,12 +2,17 @@ import { FlexBoxProps } from '@xylabs/sdk-react';
|
|
|
2
2
|
import { SizeProp } from '@xyo-network/react-shared';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
import { PropertyAction } from './PropertyAction';
|
|
5
|
-
export interface
|
|
6
|
-
actions?: PropertyAction[];
|
|
7
|
-
required?: boolean;
|
|
5
|
+
export interface PropertyBaseProps extends FlexBoxProps {
|
|
8
6
|
tip?: ReactNode;
|
|
9
7
|
title?: string;
|
|
8
|
+
color?: 'primary' | 'secondary' | string;
|
|
9
|
+
variant?: 'outlined' | 'default';
|
|
10
|
+
}
|
|
11
|
+
export interface PropertyProps extends PropertyBaseProps {
|
|
12
|
+
actions?: PropertyAction[];
|
|
13
|
+
required?: boolean;
|
|
10
14
|
value?: string | number | boolean | null;
|
|
11
15
|
badge?: boolean;
|
|
12
16
|
size?: SizeProp;
|
|
13
17
|
}
|
|
18
|
+
export declare type PropertyGroupProps = PropertyBaseProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Typography, useTheme } from '@mui/material';
|
|
3
3
|
import { useEffect, useRef, useState } from 'react';
|
|
4
|
-
export const PropertyValue = ({ value, shortSpace, typographyVariant = '
|
|
4
|
+
export const PropertyValue = ({ value, shortSpace, typographyVariant = 'body1', ...props }) => {
|
|
5
5
|
const [parentWidth, setParentWidth] = useState();
|
|
6
6
|
const theme = useTheme();
|
|
7
7
|
const ref = useRef(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Value.js","sourceRoot":"","sources":["../../../src/components/Value.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAmB,QAAQ,EAAE,MAAM,eAAe,CAAA;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AASnD,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"Value.js","sourceRoot":"","sources":["../../../src/components/Value.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAmB,QAAQ,EAAE,MAAM,eAAe,CAAA;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AASnD,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAAE,KAAK,EA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OAAO,GAAG,EAAE;YACV,MAAM,EAAE,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAA;QACtD,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAC3B,KAAC,UAAU,IAAC,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAC,KAAK,EAAC,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAC,WAAW,EAAC,UAAU,EAAC,OAAO,KAAK,gBAAgB,KAAM,KAAK,YACjK,KAAK,GACK,CACd,CAAC,CAAC,CAAC,IAAI,CAAA;AACV,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,SAAS,CAAA"}
|
package/package.json
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"@mui/material": "^5.8.1",
|
|
17
17
|
"@xylabs/sdk-react": "^2.12.8",
|
|
18
18
|
"@xyo-network/core": "^2.20.33",
|
|
19
|
-
"@xyo-network/react-shared": "^2.25.
|
|
20
|
-
"@xyo-network/react-theme": "^2.25.
|
|
19
|
+
"@xyo-network/react-shared": "^2.25.19",
|
|
20
|
+
"@xyo-network/react-theme": "^2.25.19",
|
|
21
21
|
"lodash": "^4.17.21",
|
|
22
22
|
"react": "^18.1.0",
|
|
23
23
|
"react-dom": "^18.1.0",
|
|
@@ -100,6 +100,6 @@
|
|
|
100
100
|
},
|
|
101
101
|
"sideEffects": false,
|
|
102
102
|
"types": "dist/esm/index.d.ts",
|
|
103
|
-
"version": "2.25.
|
|
103
|
+
"version": "2.25.19",
|
|
104
104
|
"packageManager": "yarn@3.1.1"
|
|
105
105
|
}
|
|
@@ -8,7 +8,22 @@ import { PropertyProps } from './PropertyProps'
|
|
|
8
8
|
import { PropertyTitle } from './Title'
|
|
9
9
|
import { PropertyValue } from './Value'
|
|
10
10
|
|
|
11
|
-
export const Property: React.FC<PropertyProps> = ({
|
|
11
|
+
export const Property: React.FC<PropertyProps> = ({
|
|
12
|
+
border,
|
|
13
|
+
borderColor,
|
|
14
|
+
borderRadius,
|
|
15
|
+
variant,
|
|
16
|
+
title,
|
|
17
|
+
color = 'secondary',
|
|
18
|
+
value,
|
|
19
|
+
children,
|
|
20
|
+
size = 'medium',
|
|
21
|
+
tip,
|
|
22
|
+
actions,
|
|
23
|
+
required,
|
|
24
|
+
badge = false,
|
|
25
|
+
...props
|
|
26
|
+
}) => {
|
|
12
27
|
const theme = useTheme()
|
|
13
28
|
|
|
14
29
|
const sizeTitleHeight: Record<SizeProp, number> = {
|
|
@@ -29,30 +44,33 @@ export const Property: React.FC<PropertyProps> = ({ title, value, children, size
|
|
|
29
44
|
small: 'body1',
|
|
30
45
|
}
|
|
31
46
|
|
|
47
|
+
const bgcolor = color === 'primary' || color === 'secondary' ? theme.palette[color].main : color
|
|
48
|
+
|
|
32
49
|
return (
|
|
33
50
|
<FlexCol
|
|
34
51
|
minWidth={0}
|
|
35
52
|
alignItems="stretch"
|
|
36
|
-
border={1}
|
|
37
|
-
borderColor={
|
|
38
|
-
borderRadius={1}
|
|
53
|
+
border={border ?? variant === 'outlined' ? 1 : undefined}
|
|
54
|
+
borderColor={borderColor ?? variant === 'outlined' ? theme.palette.divider : undefined}
|
|
55
|
+
borderRadius={borderRadius ?? variant === 'outlined' ? 1 : undefined}
|
|
39
56
|
overflow="hidden"
|
|
40
57
|
{...props}
|
|
41
58
|
>
|
|
42
59
|
{title !== undefined ? (
|
|
43
60
|
<PropertyTitle
|
|
44
61
|
tip={tip}
|
|
45
|
-
title={title}
|
|
62
|
+
title={required ? `${title}*` : title}
|
|
46
63
|
size={size}
|
|
47
|
-
bgcolor={
|
|
48
|
-
color={theme.palette.getContrastText(
|
|
64
|
+
bgcolor={bgcolor}
|
|
65
|
+
color={theme.palette.getContrastText(bgcolor)}
|
|
49
66
|
height={sizeTitleHeight[size]}
|
|
50
67
|
more={<PropertyActionsMenu actions={actions} />}
|
|
51
68
|
/>
|
|
52
69
|
) : null}
|
|
53
70
|
<FlexRow justifyContent={value === undefined ? 'center' : 'space-between'} overflow="hidden" height={sizeValueHeight[size]}>
|
|
54
|
-
{children
|
|
55
|
-
|
|
71
|
+
{children ? (
|
|
72
|
+
children
|
|
73
|
+
) : value !== undefined ? (
|
|
56
74
|
<PropertyValue shortSpace={badge ? sizeValueHeight[size] : 0} value={value} typographyVariant={sizeVariants[size]} />
|
|
57
75
|
) : (
|
|
58
76
|
<CircularProgress size={16} />
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Typography, useTheme } from '@mui/material'
|
|
2
|
+
import { FlexGrowRow, FlexRow, QuickTipButton } from '@xylabs/sdk-react'
|
|
3
|
+
import { typeOf } from '@xyo-network/core'
|
|
4
|
+
import { ReactElement } from 'react'
|
|
5
|
+
|
|
6
|
+
import { PropertyGroupProps } from './PropertyProps'
|
|
7
|
+
|
|
8
|
+
export const PropertyGroup: React.FC<PropertyGroupProps> = ({ border, borderColor, borderRadius, variant = 'outlined', children, title, color = 'secondary', tip, ...props }) => {
|
|
9
|
+
const theme = useTheme()
|
|
10
|
+
const bgcolor = color === 'primary' || color === 'secondary' ? theme.palette[color].main : color
|
|
11
|
+
const childrenArray = typeOf(children) === 'array' ? (children as ReactElement[]) : undefined
|
|
12
|
+
return (
|
|
13
|
+
<FlexRow
|
|
14
|
+
border={border ?? variant === 'outlined' ? 1 : 0}
|
|
15
|
+
borderColor={borderColor ?? variant === 'outlined' ? theme.palette.divider : undefined}
|
|
16
|
+
borderRadius={borderRadius ?? variant === 'outlined' ? 1 : undefined}
|
|
17
|
+
overflow="hidden"
|
|
18
|
+
justifyContent="flex-start"
|
|
19
|
+
alignItems="stretch"
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
<FlexRow padding={1} justifyContent="start" bgcolor={bgcolor} color={theme.palette.getContrastText(bgcolor)}>
|
|
23
|
+
<Typography>{title}</Typography>
|
|
24
|
+
{tip ? (
|
|
25
|
+
<QuickTipButton color="inherit" title={title}>
|
|
26
|
+
{tip}
|
|
27
|
+
</QuickTipButton>
|
|
28
|
+
) : null}
|
|
29
|
+
</FlexRow>
|
|
30
|
+
{childrenArray ? (
|
|
31
|
+
<FlexGrowRow>
|
|
32
|
+
{childrenArray?.map((child, index) => {
|
|
33
|
+
return child ? (
|
|
34
|
+
<FlexGrowRow key={index} borderLeft={1} borderColor={theme.palette.divider}>
|
|
35
|
+
{child}
|
|
36
|
+
</FlexGrowRow>
|
|
37
|
+
) : null
|
|
38
|
+
})}
|
|
39
|
+
</FlexGrowRow>
|
|
40
|
+
) : (
|
|
41
|
+
children
|
|
42
|
+
)}
|
|
43
|
+
</FlexRow>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -4,12 +4,18 @@ import { ReactNode } from 'react'
|
|
|
4
4
|
|
|
5
5
|
import { PropertyAction } from './PropertyAction'
|
|
6
6
|
|
|
7
|
-
export interface
|
|
8
|
-
actions?: PropertyAction[]
|
|
9
|
-
required?: boolean
|
|
7
|
+
export interface PropertyBaseProps extends FlexBoxProps {
|
|
10
8
|
tip?: ReactNode
|
|
11
9
|
title?: string
|
|
10
|
+
color?: 'primary' | 'secondary' | string
|
|
11
|
+
variant?: 'outlined' | 'default'
|
|
12
|
+
}
|
|
13
|
+
export interface PropertyProps extends PropertyBaseProps {
|
|
14
|
+
actions?: PropertyAction[]
|
|
15
|
+
required?: boolean
|
|
12
16
|
value?: string | number | boolean | null
|
|
13
17
|
badge?: boolean
|
|
14
18
|
size?: SizeProp
|
|
15
19
|
}
|
|
20
|
+
|
|
21
|
+
export type PropertyGroupProps = PropertyBaseProps
|
package/src/components/Value.tsx
CHANGED
|
@@ -9,7 +9,7 @@ export interface PropertyValueProps extends TypographyProps<'div'> {
|
|
|
9
9
|
shortSpace?: number
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const PropertyValue: React.FC<PropertyValueProps> = ({ value, shortSpace, typographyVariant = '
|
|
12
|
+
export const PropertyValue: React.FC<PropertyValueProps> = ({ value, shortSpace, typographyVariant = 'body1', ...props }) => {
|
|
13
13
|
const [parentWidth, setParentWidth] = useState<number>()
|
|
14
14
|
const theme = useTheme()
|
|
15
15
|
|