@xyo-network/react-property 2.37.6 → 2.37.8

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.
@@ -11,6 +11,6 @@ export const IdenticonCorner = ({ value, ...props }) => {
11
11
  setParentHeight(ref.current?.parentElement?.parentElement?.clientHeight);
12
12
  }, []);
13
13
  const calculatedHeight = parentHeight ?? 0;
14
- return (_jsx(FlexRow, { alignItems: "flex-start", height: "100%", position: "absolute", right: 0, bottom: 0, children: _jsx(FlexRow, { background: true, height: calculatedHeight, width: calculatedHeight, borderLeft: `1px solid ${theme.palette.divider}`, children: _jsx("div", { ref: ref, children: _jsx(Identicon, { size: calculatedHeight * 0.6, value: `${value}`, sx: { padding: `${calculatedHeight * 0.2}px` }, ...props }) }) }) }));
14
+ return (_jsx(FlexRow, { alignItems: "flex-start", height: "100%", children: _jsx(FlexRow, { background: true, height: calculatedHeight, width: calculatedHeight, borderLeft: `1px solid ${theme.palette.divider}`, children: _jsx("div", { ref: ref, children: _jsx(Identicon, { size: calculatedHeight * 0.6, value: `${value}`, sx: { padding: `${calculatedHeight * 0.2}px` }, ...props }) }) }) }));
15
15
  };
16
16
  //# sourceMappingURL=IdenticonCorner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IdenticonCorner.js","sourceRoot":"","sources":["../../../src/components/IdenticonCorner.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAgB,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAMnD,MAAM,CAAC,MAAM,eAAe,GAAmC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACrF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MA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KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACrF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,EAAU,CAAA;IAC1D,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAExC,SAAS,CAAC,GAAG,EAAE;QACb,eAAe,CAAC,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,CAAC,CAAA;IAC1E,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,gBAAgB,GAAG,YAAY,IAAI,CAAC,CAAA;IAE1C,OAAO,CACL,KAAC,OAAO,IAAC,UAAU,EAAC,YAAY,EAAC,MAAM,EAAC,MAAM,YAC5C,KAAC,OAAO,IAAC,UAAU,QAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,aAAa,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,YACrH,cAAK,GAAG,EAAE,GAAG,YACX,KAAC,SAAS,IAAC,IAAI,EAAE,gBAAgB,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,gBAAgB,GAAG,GAAG,IAAI,EAAE,KAAM,KAAK,GAAI,GACrH,GACE,GACF,CACX,CAAA;AACH,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Property.d.ts","sourceRoot":"","sources":["../../../src/components/Property.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAwC,aAAa,EAAE,MAAM,SAAS,CAAA;AA6D7E,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAE5C,CAAA"}
1
+ {"version":3,"file":"Property.d.ts","sourceRoot":"","sources":["../../../src/components/Property.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAwC,aAAa,EAAE,MAAM,SAAS,CAAA;AAmE7E,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAE5C,CAAA"}
@@ -16,7 +16,7 @@ const PropertyBox = ({ titleProps, title, value, children, size = 'medium', tip,
16
16
  medium: 'body1',
17
17
  small: 'body2',
18
18
  };
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, { paddingX: 1, 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] })] }));
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
20
  };
21
21
  const PropertyPaper = ({ style, variant, elevation = 2, square, ...props }) => {
22
22
  return (_jsx(Paper, { style: { minWidth: 0, overflow: 'hidden', ...style }, variant: variant, elevation: elevation, square: square, children: _jsx(PropertyBox, { ...props, paper: false }) }));
@@ -1 +1 @@
1
- {"version":3,"file":"Property.js","sourceRoot":"","sources":["../../../src/components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QAAQ,GAA4B,CAAC,KAAK,EAAE,EAAE;IACzD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAC,aAAa,OAAK,KAAK,GAAI,CAAC,CAAC,CAAC,KAAC,WAAW,OAAK,KAAK,GAAI,CAAA;AAChF,CAAC,CAAA"}
@@ -1,11 +1,9 @@
1
1
  /// <reference types="react" />
2
- import { TypographyProps } from '@mui/material';
3
2
  import { Variant } from '@mui/material/styles/createTypography';
4
- export interface PropertyValueProps extends TypographyProps<'div'> {
3
+ import { EllipsizeBoxProps } from '@xyo-network/react-shared';
4
+ export interface PropertyValueProps extends EllipsizeBoxProps {
5
5
  value?: string | number | boolean | null;
6
6
  typographyVariant?: Variant;
7
- /** @field The space that is removed from the ... at end (mainly for identicon) */
8
- shortSpace?: number;
9
7
  }
10
8
  export declare const PropertyValue: React.FC<PropertyValueProps>;
11
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,EAAc,eAAe,EAAY,MAAM,eAAe,CAAA;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAA;AAG/D,MAAM,WAAW,kBAAmB,SAAQ,eAAe,CAAC,KAAK,CAAC;IAChE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;IACxC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoDtD,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;AAE3E,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;IACxC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAMtD,CAAA"}
@@ -1,36 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Typography, useTheme } from '@mui/material';
3
- import { useEffect, useRef, useState } from 'react';
4
- export const PropertyValue = ({ value, shortSpace, typographyVariant = 'body1', ...props }) => {
5
- const [parentWidth, setParentWidth] = useState();
6
- const theme = useTheme();
7
- const ref = useRef(null);
8
- const customThemeProps = {
9
- clamped: parentWidth && theme ? parentWidth - parseInt(theme.spacing(2), 10) - (shortSpace ?? 0) : undefined,
10
- title: value?.toString(),
11
- };
12
- useEffect(() => {
13
- const resizeHandler = () => {
14
- const smallestWidth = getSmallestParentWidth(ref.current);
15
- setParentWidth(smallestWidth);
16
- };
17
- const getSmallestParentWidth = (element) => {
18
- let current = element?.parentElement;
19
- let width = null;
20
- while (current) {
21
- if (width === null || current.clientWidth < width) {
22
- width = current.clientWidth;
23
- }
24
- current = current.parentElement;
25
- }
26
- return width ?? undefined;
27
- };
28
- window.addEventListener('resize', resizeHandler);
29
- setParentWidth(getSmallestParentWidth(ref.current));
30
- return () => {
31
- window?.removeEventListener('resize', resizeHandler);
32
- };
33
- }, []);
34
- return value !== undefined ? (_jsx(Typography, { minWidth: 0, ref: ref, component: "div", variant: typographyVariant, fontFamily: "monospace", fontWeight: "light", ...customThemeProps, ...props, children: value })) : null;
2
+ import { EllipsizeBox } from '@xyo-network/react-shared';
3
+ export const PropertyValue = ({ value, typographyVariant = 'body1', ...props }) => {
4
+ return value !== undefined ? (_jsx(EllipsizeBox, { typographyProps: { component: undefined, title: value?.toString(), variant: typographyVariant }, width: "100%", ...props, children: value }))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GACO,CAChB,CAAC,CAAC,CAAC,IAAI,CAAA;AACV,CAAC,CAAA"}
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "@xylabs/react-flexbox": "^2.15.1",
15
15
  "@xylabs/react-identicon": "^2.15.1",
16
16
  "@xylabs/react-quick-tip-button": "^2.15.1",
17
- "@xyo-network/react-shared": "^2.37.6",
17
+ "@xyo-network/react-shared": "^2.37.8",
18
18
  "tslib": "^2.4.0"
19
19
  },
20
20
  "peerDependencies": {
@@ -71,5 +71,5 @@
71
71
  },
72
72
  "sideEffects": false,
73
73
  "types": "dist/esm/index.d.ts",
74
- "version": "2.37.6"
74
+ "version": "2.37.8"
75
75
  }
@@ -19,7 +19,7 @@ export const IdenticonCorner: React.FC<IdenticonCornerProps> = ({ value, ...prop
19
19
  const calculatedHeight = parentHeight ?? 0
20
20
 
21
21
  return (
22
- <FlexRow alignItems="flex-start" height="100%" position="absolute" right={0} bottom={0}>
22
+ <FlexRow alignItems="flex-start" height="100%">
23
23
  <FlexRow background height={calculatedHeight} width={calculatedHeight} borderLeft={`1px solid ${theme.palette.divider}`}>
24
24
  <div ref={ref}>
25
25
  <Identicon size={calculatedHeight * 0.6} value={`${value}`} sx={{ padding: `${calculatedHeight * 0.2}px` }} {...props} />
@@ -43,11 +43,17 @@ const PropertyBox: React.FC<PropertyBoxProps> = ({
43
43
  {...titleProps}
44
44
  />
45
45
  ) : null}
46
- <FlexRow paddingX={1} justifyContent={value === undefined ? 'center' : 'space-between'} overflow="hidden" height={sizeValueHeight[size]}>
46
+ <FlexRow
47
+ pl={1}
48
+ columnGap={1}
49
+ justifyContent={value === undefined ? 'center' : 'space-between'}
50
+ overflow="hidden"
51
+ height={sizeValueHeight[size]}
52
+ >
47
53
  {children ? (
48
54
  children
49
55
  ) : value !== undefined ? (
50
- <PropertyValue shortSpace={badge ? sizeValueHeight[size] : 0} value={value} typographyVariant={sizeVariants[size]} />
56
+ <PropertyValue value={value} typographyVariant={sizeVariants[size]} />
51
57
  ) : (
52
58
  <CircularProgress size={16} />
53
59
  )}
@@ -1,64 +1,15 @@
1
- import { Typography, TypographyProps, useTheme } from '@mui/material'
2
1
  import { Variant } from '@mui/material/styles/createTypography'
3
- import { useEffect, useRef, useState } from 'react'
2
+ import { EllipsizeBox, EllipsizeBoxProps } from '@xyo-network/react-shared'
4
3
 
5
- export interface PropertyValueProps extends TypographyProps<'div'> {
4
+ export interface PropertyValueProps extends EllipsizeBoxProps {
6
5
  value?: string | number | boolean | null
7
6
  typographyVariant?: Variant
8
- /** @field The space that is removed from the ... at end (mainly for identicon) */
9
- shortSpace?: number
10
7
  }
11
8
 
12
- export const PropertyValue: React.FC<PropertyValueProps> = ({ value, shortSpace, typographyVariant = 'body1', ...props }) => {
13
- const [parentWidth, setParentWidth] = useState<number>()
14
- const theme = useTheme()
15
-
16
- const ref = useRef<HTMLDivElement>(null)
17
-
18
- const customThemeProps = {
19
- clamped: parentWidth && theme ? parentWidth - parseInt(theme.spacing(2), 10) - (shortSpace ?? 0) : undefined,
20
- title: value?.toString(),
21
- }
22
-
23
- useEffect(() => {
24
- const resizeHandler = () => {
25
- const smallestWidth = getSmallestParentWidth(ref.current)
26
- setParentWidth(smallestWidth)
27
- }
28
-
29
- const getSmallestParentWidth = (element: HTMLElement | null) => {
30
- let current = element?.parentElement
31
- let width: number | null = null
32
- while (current) {
33
- if (width === null || current.clientWidth < width) {
34
- width = current.clientWidth
35
- }
36
- current = current.parentElement
37
- }
38
- return width ?? undefined
39
- }
40
-
41
- window.addEventListener('resize', resizeHandler)
42
-
43
- setParentWidth(getSmallestParentWidth(ref.current))
44
-
45
- return () => {
46
- window?.removeEventListener('resize', resizeHandler)
47
- }
48
- }, [])
49
-
9
+ export const PropertyValue: React.FC<PropertyValueProps> = ({ value, typographyVariant = 'body1', ...props }) => {
50
10
  return value !== undefined ? (
51
- <Typography
52
- minWidth={0}
53
- ref={ref}
54
- component="div"
55
- variant={typographyVariant}
56
- fontFamily="monospace"
57
- fontWeight="light"
58
- {...customThemeProps}
59
- {...props}
60
- >
11
+ <EllipsizeBox typographyProps={{ component: undefined, title: value?.toString(), variant: typographyVariant }} width="100%" {...props}>
61
12
  {value}
62
- </Typography>
13
+ </EllipsizeBox>
63
14
  ) : null
64
15
  }