@xyo-network/react-property 2.23.7

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 (99) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +69 -0
  3. package/babel.config.json +5 -0
  4. package/dist/cjs/components/IdenticonCorner.d.ts +6 -0
  5. package/dist/cjs/components/IdenticonCorner.js +22 -0
  6. package/dist/cjs/components/IdenticonCorner.js.map +1 -0
  7. package/dist/cjs/components/Property.d.ts +3 -0
  8. package/dist/cjs/components/Property.js +33 -0
  9. package/dist/cjs/components/Property.js.map +1 -0
  10. package/dist/cjs/components/PropertyAction.d.ts +7 -0
  11. package/dist/cjs/components/PropertyAction.js +3 -0
  12. package/dist/cjs/components/PropertyAction.js.map +1 -0
  13. package/dist/cjs/components/PropertyActions.d.ts +3 -0
  14. package/dist/cjs/components/PropertyActions.js +19 -0
  15. package/dist/cjs/components/PropertyActions.js.map +1 -0
  16. package/dist/cjs/components/PropertyActionsMenu.d.ts +3 -0
  17. package/dist/cjs/components/PropertyActionsMenu.js +29 -0
  18. package/dist/cjs/components/PropertyActionsMenu.js.map +1 -0
  19. package/dist/cjs/components/PropertyActionsProps.d.ts +6 -0
  20. package/dist/cjs/components/PropertyActionsProps.js +3 -0
  21. package/dist/cjs/components/PropertyActionsProps.js.map +1 -0
  22. package/dist/cjs/components/PropertyProps.d.ts +13 -0
  23. package/dist/cjs/components/PropertyProps.js +3 -0
  24. package/dist/cjs/components/PropertyProps.js.map +1 -0
  25. package/dist/cjs/components/SizeProp.d.ts +1 -0
  26. package/dist/cjs/components/SizeProp.js +3 -0
  27. package/dist/cjs/components/SizeProp.js.map +1 -0
  28. package/dist/cjs/components/Title.d.ts +10 -0
  29. package/dist/cjs/components/Title.js +19 -0
  30. package/dist/cjs/components/Title.js.map +1 -0
  31. package/dist/cjs/components/Value.d.ts +10 -0
  32. package/dist/cjs/components/Value.js +42 -0
  33. package/dist/cjs/components/Value.js.map +1 -0
  34. package/dist/cjs/components/index.d.ts +6 -0
  35. package/dist/cjs/components/index.js +10 -0
  36. package/dist/cjs/components/index.js.map +1 -0
  37. package/dist/cjs/components/usePropertyHeroProps.d.ts +6 -0
  38. package/dist/cjs/components/usePropertyHeroProps.js +15 -0
  39. package/dist/cjs/components/usePropertyHeroProps.js.map +1 -0
  40. package/dist/cjs/index.d.ts +1 -0
  41. package/dist/cjs/index.js +5 -0
  42. package/dist/cjs/index.js.map +1 -0
  43. package/dist/docs.json +50403 -0
  44. package/dist/esm/components/IdenticonCorner.d.ts +6 -0
  45. package/dist/esm/components/IdenticonCorner.js +15 -0
  46. package/dist/esm/components/IdenticonCorner.js.map +1 -0
  47. package/dist/esm/components/Property.d.ts +3 -0
  48. package/dist/esm/components/Property.js +27 -0
  49. package/dist/esm/components/Property.js.map +1 -0
  50. package/dist/esm/components/PropertyAction.d.ts +7 -0
  51. package/dist/esm/components/PropertyAction.js +2 -0
  52. package/dist/esm/components/PropertyAction.js.map +1 -0
  53. package/dist/esm/components/PropertyActions.d.ts +3 -0
  54. package/dist/esm/components/PropertyActions.js +12 -0
  55. package/dist/esm/components/PropertyActions.js.map +1 -0
  56. package/dist/esm/components/PropertyActionsMenu.d.ts +3 -0
  57. package/dist/esm/components/PropertyActionsMenu.js +22 -0
  58. package/dist/esm/components/PropertyActionsMenu.js.map +1 -0
  59. package/dist/esm/components/PropertyActionsProps.d.ts +6 -0
  60. package/dist/esm/components/PropertyActionsProps.js +2 -0
  61. package/dist/esm/components/PropertyActionsProps.js.map +1 -0
  62. package/dist/esm/components/PropertyProps.d.ts +13 -0
  63. package/dist/esm/components/PropertyProps.js +2 -0
  64. package/dist/esm/components/PropertyProps.js.map +1 -0
  65. package/dist/esm/components/SizeProp.d.ts +1 -0
  66. package/dist/esm/components/SizeProp.js +2 -0
  67. package/dist/esm/components/SizeProp.js.map +1 -0
  68. package/dist/esm/components/Title.d.ts +10 -0
  69. package/dist/esm/components/Title.js +13 -0
  70. package/dist/esm/components/Title.js.map +1 -0
  71. package/dist/esm/components/Value.d.ts +10 -0
  72. package/dist/esm/components/Value.js +36 -0
  73. package/dist/esm/components/Value.js.map +1 -0
  74. package/dist/esm/components/index.d.ts +6 -0
  75. package/dist/esm/components/index.js +7 -0
  76. package/dist/esm/components/index.js.map +1 -0
  77. package/dist/esm/components/usePropertyHeroProps.d.ts +6 -0
  78. package/dist/esm/components/usePropertyHeroProps.js +12 -0
  79. package/dist/esm/components/usePropertyHeroProps.js.map +1 -0
  80. package/dist/esm/index.d.ts +1 -0
  81. package/dist/esm/index.js +2 -0
  82. package/dist/esm/index.js.map +1 -0
  83. package/package.json +135 -0
  84. package/src/components/IdenticonCorner.tsx +29 -0
  85. package/src/components/Property.stories.tsx +163 -0
  86. package/src/components/Property.tsx +64 -0
  87. package/src/components/PropertyAction.ts +8 -0
  88. package/src/components/PropertyActions.tsx +27 -0
  89. package/src/components/PropertyActionsMenu.tsx +41 -0
  90. package/src/components/PropertyActionsProps.ts +8 -0
  91. package/src/components/PropertyProps.tsx +15 -0
  92. package/src/components/SizeProp.ts +1 -0
  93. package/src/components/Title.stories.tsx +32 -0
  94. package/src/components/Title.tsx +38 -0
  95. package/src/components/Value.stories.tsx +29 -0
  96. package/src/components/Value.tsx +55 -0
  97. package/src/components/index.ts +6 -0
  98. package/src/components/usePropertyHeroProps.tsx +12 -0
  99. package/src/index.ts +1 -0
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { FlexBoxProps } from '@xylabs/sdk-react';
3
+ export interface IdenticonCornerProps extends FlexBoxProps {
4
+ value?: string | number | boolean | null;
5
+ }
6
+ export declare const IdenticonCorner: React.FC<IdenticonCornerProps>;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useTheme } from '@mui/material';
3
+ import { FlexRow, Identicon } from '@xylabs/sdk-react';
4
+ import { useEffect, useRef, useState } from 'react';
5
+ export const IdenticonCorner = ({ value, ...props }) => {
6
+ const theme = useTheme();
7
+ const [parentHeight, setParentHeight] = useState();
8
+ const ref = useRef(null);
9
+ useEffect(() => {
10
+ setParentHeight(ref.current?.parentElement?.parentElement?.clientHeight);
11
+ }, []);
12
+ const calculatedHeight = parentHeight ?? 0;
13
+ return (_jsx(FlexRow, { alignItems: "flex-start", height: "100%", position: "absolute", right: 0, bottom: 0, children: _jsx(FlexRow, { background: true, height: calculatedHeight, width: calculatedHeight, borderTop: `1px solid ${theme.palette.divider}`, 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
+ };
15
+ //# sourceMappingURL=IdenticonCorner.js.map
@@ -0,0 +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,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACpE,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,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,EAAC,QAAQ,EAAC,UAAU,EAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,YACpF,KAAC,OAAO,IAAC,UAAU,QAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,aAAa,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,YACtK,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"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { PropertyProps } from './PropertyProps';
3
+ export declare const Property: React.FC<PropertyProps>;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CircularProgress, useTheme } from '@mui/material';
3
+ import { FlexCol, FlexRow } from '@xylabs/sdk-react';
4
+ import { IdenticonCorner } from './IdenticonCorner';
5
+ import { PropertyActionsMenu } from './PropertyActionsMenu';
6
+ import { PropertyTitle } from './Title';
7
+ import { PropertyValue } from './Value';
8
+ export const Property = ({ title, value, children, size = 'medium', tip, actions, required, badge = false, ...props }) => {
9
+ const theme = useTheme();
10
+ const sizeTitleHeight = {
11
+ large: 36,
12
+ medium: 20,
13
+ small: 14,
14
+ };
15
+ const sizeValueHeight = {
16
+ large: 64,
17
+ medium: 36,
18
+ small: 26,
19
+ };
20
+ const sizeVariants = {
21
+ large: 'h6',
22
+ medium: 'body1',
23
+ small: 'body1',
24
+ };
25
+ return (_jsxs(FlexCol, { minWidth: 0, alignItems: "stretch", border: 1, borderColor: required && value === undefined ? theme.palette.error.main : theme.palette.divider, borderRadius: 1, overflow: "hidden", ...props, children: [title !== undefined ? (_jsx(PropertyTitle, { tip: tip, title: title, size: size, bgcolor: theme.palette.secondary.main, color: theme.palette.getContrastText(theme.palette.secondary.main), height: sizeTitleHeight[size], more: _jsx(PropertyActionsMenu, { actions: actions }) })) : null, _jsxs(FlexRow, { justifyContent: value === undefined ? 'center' : 'space-between', overflow: "hidden", height: sizeValueHeight[size], 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
+ //# sourceMappingURL=Property.js.map
@@ -0,0 +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;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,CAAC,MAAM,QAAQ,GAA4B,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAChJ,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IAExB,MAAM,eAAe,GAA6B;QAChD,KAAK,EAA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AAC,CAAC,CAAC,CACrB,KAAC,aAAa,IAAC,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,7 @@
1
+ import { ReactNode } from 'react';
2
+ export interface PropertyAction {
3
+ disabled?: boolean;
4
+ name: string;
5
+ icon?: ReactNode;
6
+ onClick?: () => void;
7
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=PropertyAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyAction.js","sourceRoot":"","sources":["../../../src/components/PropertyAction.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { PropertyActionsProps } from './PropertyActionsProps';
3
+ export declare const PropertyActions: React.FC<PropertyActionsProps>;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { IconButton, Stack } from '@mui/material';
3
+ import { ButtonEx, FlexRow } from '@xylabs/sdk-react';
4
+ export const PropertyActions = ({ buttons = false, actions, ...props }) => {
5
+ if (actions) {
6
+ return (actions?.length ?? 0) > 0 ? (_jsx(FlexRow, { ...props, children: _jsx(Stack, { direction: "row", spacing: 1, children: actions.map((action, index) => {
7
+ return action.icon ? (_jsx(IconButton, { size: "small", color: "inherit", onClick: action.onClick, children: action.icon }, index)) : buttons ? (_jsx(ButtonEx, { paddingY: 0, color: "primary", size: "small", disabled: action.disabled, onClick: action.onClick, variant: "contained", children: action.name }, index)) : null;
8
+ }) }) })) : null;
9
+ }
10
+ return null;
11
+ };
12
+ //# sourceMappingURL=PropertyActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyActions.js","sourceRoot":"","sources":["../../../src/components/PropertyActions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAIrD,MAAM,CAAC,MAAM,eAAe,GAAmC,CAAC,EAAE,OAAO,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IACxG,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAClC,KAAC,OAAO,OAAK,KAAK,YAChB,KAAC,KAAK,IAAC,SAAS,EAAC,KAAK,EAAC,OAAO,EAAE,CAAC,YAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;oBAC7B,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACnB,KAAC,UAAU,IAAC,IAAI,EAAC,OAAO,EAAa,KAAK,EAAC,SAAS,EAAC,OAAO,EAAE,MAAM,CAAC,OAAO,YACzE,MAAM,CAAC,IAAI,IADgB,KAAK,CAEtB,CACd,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACZ,KAAC,QAAQ,IAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAC,SAAS,EAAa,IAAI,EAAC,OAAO,EAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,EAAC,WAAW,YACpI,MAAM,CAAC,IAAI,IAD8B,KAAK,CAEtC,CACZ,CAAC,CAAC,CAAC,IAAI,CAAA;gBACV,CAAC,CAAC,GACI,GACA,CACX,CAAC,CAAC,CAAC,IAAI,CAAA;KACT;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { PropertyActionsProps } from './PropertyActionsProps';
3
+ export declare const PropertyActionsMenu: React.FC<PropertyActionsProps>;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
3
+ import { IconButton, Menu, MenuItem } from '@mui/material';
4
+ import { FlexRow } from '@xylabs/sdk-react';
5
+ import { useState } from 'react';
6
+ export const PropertyActionsMenu = ({ actions, ...props }) => {
7
+ const [anchorEl, setAnchorEl] = useState(null);
8
+ const open = !!anchorEl;
9
+ const handleClick = (event) => {
10
+ setAnchorEl(event.currentTarget);
11
+ };
12
+ const handleClose = () => {
13
+ setAnchorEl(null);
14
+ };
15
+ return actions && actions?.length > 0 ? (_jsxs(FlexRow, { ...props, children: [_jsx(IconButton, { size: "small", color: "inherit", onClick: handleClick, children: _jsx(MoreHorizIcon, { fontSize: "inherit" }) }), _jsx(Menu, { anchorEl: anchorEl, open: open, onClose: handleClose, children: actions?.map((action) => {
16
+ return (_jsx(MenuItem, { onClick: () => {
17
+ action?.onClick?.();
18
+ handleClose();
19
+ }, children: action.name }, action.name));
20
+ }) })] })) : null;
21
+ };
22
+ //# sourceMappingURL=PropertyActionsMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyActionsMenu.js","sourceRoot":"","sources":["../../../src/components/PropertyActionsMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,MAAM,+BAA+B,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAA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PropertyAction } from './PropertyAction';
3
+ export interface PropertyActionsProps extends FlexBoxProps {
4
+ buttons?: boolean;
5
+ actions?: PropertyAction[];
6
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=PropertyActionsProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyActionsProps.js","sourceRoot":"","sources":["../../../src/components/PropertyActionsProps.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { FlexBoxProps } from '@xylabs/sdk-react';
2
+ import { ReactNode } from 'react';
3
+ import { PropertyAction } from './PropertyAction';
4
+ import { SizeProp } from './SizeProp';
5
+ export interface PropertyProps extends FlexBoxProps {
6
+ actions?: PropertyAction[];
7
+ required?: boolean;
8
+ tip?: ReactNode;
9
+ title?: string;
10
+ value?: string | number | boolean | null;
11
+ badge?: boolean;
12
+ size?: SizeProp;
13
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=PropertyProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyProps.js","sourceRoot":"","sources":["../../../src/components/PropertyProps.tsx"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export declare type SizeProp = 'small' | 'medium' | 'large';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SizeProp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SizeProp.js","sourceRoot":"","sources":["../../../src/components/SizeProp.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { FlexBoxProps } from '@xylabs/sdk-react';
2
+ import { ReactNode } from 'react';
3
+ import { SizeProp } from './SizeProp';
4
+ export interface PropertyTitleProps extends FlexBoxProps {
5
+ tip?: ReactNode;
6
+ more?: ReactNode;
7
+ title?: string;
8
+ size?: SizeProp;
9
+ }
10
+ export declare const PropertyTitle: React.FC<PropertyTitleProps>;
@@ -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 { FlexRow, QuickTipButton } from '@xylabs/sdk-react';
4
+ export const PropertyTitle = ({ size = 'medium', tip, more, title, ...props }) => {
5
+ const sizeVariants = {
6
+ large: 'h6',
7
+ medium: 'caption',
8
+ small: 'caption',
9
+ };
10
+ const theme = useTheme();
11
+ return (_jsxs(FlexRow, { justifyContent: "space-between", ...props, children: [_jsxs(FlexRow, { paddingX: 1, children: [_jsx(Typography, { noWrap: true, variant: sizeVariants[size], children: title }), tip ? (_jsx(QuickTipButton, { style: { fontSize: theme.typography[sizeVariants[size]].fontSize }, color: "inherit", title: title ?? '', children: tip })) : null] }), more] }));
12
+ };
13
+ //# sourceMappingURL=Title.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Title.js","sourceRoot":"","sources":["../../../src/components/Title.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAqB,QAAQ,EAAE,MAAM,eAAe,CAAA;AACvE,OAAO,EAAgB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAYzE,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC7G,MAAM,YAAY,GAAwC;QACxD,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,SAAS;KACjB,CAAA;IAED,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IAExB,OAAO,CACL,MAAC,OAAO,IAAC,cAAc,EAAC,eAAe,KAAK,KAAK,aAC/C,MAAC,OAAO,IAAC,QAAQ,EAAE,CAAC,aAClB,KAAC,UAAU,IAAC,MAAM,QAAC,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,YAC3C,KAAK,GACK,EACZ,GAAG,CAAC,CAAC,CAAC,CACL,KAAC,cAAc,IAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAC,SAAS,EAAC,KAAK,EAAE,KAAK,IAAI,EAAE,YACnH,GAAG,GACW,CAClB,CAAC,CAAC,CAAC,IAAI,IACA,EACT,IAAI,IACG,CACX,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { TypographyProps } from '@mui/material';
3
+ import { Variant } from '@mui/material/styles/createTypography';
4
+ export interface PropertyValueProps extends TypographyProps<'div'> {
5
+ value?: string | number | boolean | null;
6
+ typographyVariant?: Variant;
7
+ /** @field The space that is removed from the ... at end (mainly for identicon) */
8
+ shortSpace?: number;
9
+ }
10
+ export declare const PropertyValue: React.FC<PropertyValueProps>;
@@ -0,0 +1,36 @@
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 = 'caption', ...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, marginX: 1, ref: ref, component: "div", variant: typographyVariant, fontFamily: "monospace", fontWeight: "light", ...customThemeProps, ...props, children: value })) : null;
35
+ };
36
+ //# sourceMappingURL=Value.js.map
@@ -0,0 +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,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC5H,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,EAAU,CAAA;IACxD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IAExB,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAExC,MAAM,gBAAgB,GAAG;QACvB,OAAO,EAAE,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;QAC5G,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE;KACzB,CAAA;IAED,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,aAAa,GAAG,GAAG,EAAE;YACzB,MAAM,aAAa,GAAG,sBAAsB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACzD,cAAc,CAAC,aAAa,CAAC,CAAA;QAC/B,CAAC,CAAA;QAED,MAAM,sBAAsB,GAAG,CAAC,OAA2B,EAAE,EAAE;YAC7D,IAAI,OAAO,GAAG,OAAO,EAAE,aAAa,CAAA;YACpC,IAAI,KAAK,GAAkB,IAAI,CAAA;YAC/B,OAAO,OAAO,EAAE;gBACd,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,WAAW,GAAG,KAAK,EAAE;oBACjD,KAAK,GAAG,OAAO,CAAC,WAAW,CAAA;iBAC5B;gBACD,OAAO,GAAG,OAAO,CAAC,aAAa,CAAA;aAChC;YACD,OAAO,KAAK,IAAI,SAAS,CAAA;QAC3B,CAAC,CAAA;QAED,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAA;QAEhD,cAAc,CAAC,sBAAsB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;QAEnD,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"}
@@ -0,0 +1,6 @@
1
+ export * from './Property';
2
+ export * from './PropertyAction';
3
+ export * from './PropertyProps';
4
+ export * from './SizeProp';
5
+ export * from './usePropertyHeroProps';
6
+ export * from './Value';
@@ -0,0 +1,7 @@
1
+ export * from './Property';
2
+ export * from './PropertyAction';
3
+ export * from './PropertyProps';
4
+ export * from './SizeProp';
5
+ export * from './usePropertyHeroProps';
6
+ export * from './Value';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,YAAY,CAAA;AAC1B,cAAc,wBAAwB,CAAA;AACtC,cAAc,SAAS,CAAA"}
@@ -0,0 +1,6 @@
1
+ declare const usePropertyHeroProps: (props: Record<any, any>) => {
2
+ isHero: any;
3
+ paddingFactor: any;
4
+ showBadge: any;
5
+ };
6
+ export { usePropertyHeroProps };
@@ -0,0 +1,12 @@
1
+ // Any is ok since we are destructuring props of any shape
2
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
+ const usePropertyHeroProps = (props) => {
4
+ const { isHero, paddingFactor, showBadge } = props;
5
+ return {
6
+ isHero,
7
+ paddingFactor,
8
+ showBadge,
9
+ };
10
+ };
11
+ export { usePropertyHeroProps };
12
+ //# sourceMappingURL=usePropertyHeroProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePropertyHeroProps.js","sourceRoot":"","sources":["../../../src/components/usePropertyHeroProps.tsx"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,8DAA8D;AAC9D,MAAM,oBAAoB,GAAG,CAAC,KAAuB,EAAE,EAAE;IACvD,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,KAAK,CAAA;IAClD,OAAO;QACL,MAAM;QACN,aAAa;QACb,SAAS;KACV,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAA"}
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
package/package.json ADDED
@@ -0,0 +1,135 @@
1
+ {
2
+ "name": "@xyo-network/react-property",
3
+ "author": {
4
+ "email": "support@xyo.network",
5
+ "name": "XYO Development Team",
6
+ "url": "https://xyo.network"
7
+ },
8
+ "bugs": {
9
+ "email": "support@xyo.network",
10
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
11
+ },
12
+ "workspaces": [
13
+ "packages/*"
14
+ ],
15
+ "dependencies": {
16
+ "@emotion/react": "^11.9.0",
17
+ "@emotion/styled": "^11.8.1",
18
+ "@mui/icons-material": "^5.8.0",
19
+ "@mui/lab": "^5.0.0-alpha.83",
20
+ "@mui/material": "^5.8.1",
21
+ "@xylabs/pixel": "^1.3.7",
22
+ "@xylabs/sdk-js": "^2.5.5",
23
+ "@xylabs/sdk-react": "^2.12.7",
24
+ "@xyo-network/api": "^2.20.33",
25
+ "@xyo-network/core": "^2.20.33",
26
+ "@xyo-network/network": "^2.20.33",
27
+ "@xyo-network/panel": "^2.20.33",
28
+ "@xyo-network/systeminfo-witness": "^2.20.33",
29
+ "@xyo-network/utils": "^2.20.33",
30
+ "lodash": "^4.17.21",
31
+ "luxon": "^2.4.0",
32
+ "react": "^18.1.0",
33
+ "react-dom": "^18.1.0",
34
+ "react-icons": "^4.3.1",
35
+ "react-json-view": "^1.21.3",
36
+ "react-router-dom": "^6.3.0",
37
+ "rollbar": "^2.25.0",
38
+ "typedoc": "^0.22.15"
39
+ },
40
+ "description": "Common React library for all XYO projects that use React",
41
+ "devDependencies": {
42
+ "@babel/core": "^7.18.0",
43
+ "@babel/preset-env": "^7.18.0",
44
+ "@storybook/addon-actions": "^6.5.4",
45
+ "@storybook/addon-docs": "^6.5.4",
46
+ "@storybook/addon-essentials": "^6.5.4",
47
+ "@storybook/addon-interactions": "^6.5.4",
48
+ "@storybook/addon-links": "^6.5.4",
49
+ "@storybook/addons": "^6.5.4",
50
+ "@storybook/api": "^6.5.4",
51
+ "@storybook/builder-webpack5": "^6.5.4",
52
+ "@storybook/components": "^6.5.4",
53
+ "@storybook/core-events": "^6.5.4",
54
+ "@storybook/manager-webpack5": "^6.5.4",
55
+ "@storybook/react": "^6.5.4",
56
+ "@storybook/testing-library": "^0.0.11",
57
+ "@storybook/theming": "^6.5.4",
58
+ "@types/lodash": "^4.14.182",
59
+ "@types/luxon": "^2.3.2",
60
+ "@xylabs/eslint-config-react": "^2.1.5",
61
+ "@xylabs/pixel": "^1.3.7",
62
+ "@xylabs/rollup-config": "^1.1.17",
63
+ "@xylabs/sdk-js": "^2.5.5",
64
+ "@xylabs/sdk-react": "^2.12.7",
65
+ "@xylabs/ts-scripts": "^1.0.66",
66
+ "@xylabs/tsconfig": "^1.0.13",
67
+ "assert": "^2.0.0",
68
+ "axios": "^0.27.2",
69
+ "storybook-dark-mode": "^1.1.0",
70
+ "typescript": "^4.6.4"
71
+ },
72
+ "browser": "dist/esm/index.js",
73
+ "docs": "dist/docs.json",
74
+ "exports": {
75
+ ".": {
76
+ "node": {
77
+ "import": "./dist/esm/index.js",
78
+ "require": "./dist/cjs/index.js"
79
+ },
80
+ "browser": {
81
+ "import": "./dist/esm/index.js",
82
+ "require": "./dist/cjs/index.js"
83
+ },
84
+ "default": "./dist/esm/index.js"
85
+ },
86
+ "./dist/docs.json": {
87
+ "default": "./dist/docs.json"
88
+ },
89
+ "./package.json": "./package.json"
90
+ },
91
+ "main": "dist/cjs/index.js",
92
+ "module": "dist/esm/index.js",
93
+ "homepage": "https://xyo.network",
94
+ "keywords": [
95
+ "xyo",
96
+ "utility",
97
+ "typescript",
98
+ "react"
99
+ ],
100
+ "license": "LGPL-3.0",
101
+ "peerDependencies": {
102
+ "axios": ">0.26",
103
+ "typedoc": "^0.22.13"
104
+ },
105
+ "peerDependenciesMeta": {
106
+ "typedoc": {
107
+ "optional": true
108
+ }
109
+ },
110
+ "resolutions": {
111
+ "@storybook/react/webpack": "^5",
112
+ "bn.js": "^5.2.0",
113
+ "react": "^18.1.0",
114
+ "react-dom": "^18.1.0",
115
+ "webpack": "^5"
116
+ },
117
+ "publishConfig": {
118
+ "access": "public"
119
+ },
120
+ "repository": {
121
+ "type": "git",
122
+ "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
123
+ },
124
+ "scripts": {
125
+ "deploy": "yarn deploy3",
126
+ "lint-pkg": "npmPkgJsonLint .",
127
+ "build": "yarn clean && tsc -p tsconfig.build.cjs.json && tsc -p tsconfig.build.esm.json && yarn gen:docs",
128
+ "gen:docs": "typedoc ./src/index.ts --json ./dist/docs.json --tsconfig ./tsconfig.json",
129
+ "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\""
130
+ },
131
+ "sideEffects": false,
132
+ "types": "dist/esm/index.d.ts",
133
+ "version": "2.23.7",
134
+ "packageManager": "yarn@3.1.1"
135
+ }
@@ -0,0 +1,29 @@
1
+ import { useTheme } from '@mui/material'
2
+ import { FlexBoxProps, FlexRow, Identicon } from '@xylabs/sdk-react'
3
+ import { useEffect, useRef, useState } from 'react'
4
+
5
+ export interface IdenticonCornerProps extends FlexBoxProps {
6
+ value?: string | number | boolean | null
7
+ }
8
+
9
+ export const IdenticonCorner: React.FC<IdenticonCornerProps> = ({ value, ...props }) => {
10
+ const theme = useTheme()
11
+ const [parentHeight, setParentHeight] = useState<number>()
12
+ const ref = useRef<HTMLDivElement>(null)
13
+
14
+ useEffect(() => {
15
+ setParentHeight(ref.current?.parentElement?.parentElement?.clientHeight)
16
+ }, [])
17
+
18
+ const calculatedHeight = parentHeight ?? 0
19
+
20
+ return (
21
+ <FlexRow alignItems="flex-start" height="100%" position="absolute" right={0} bottom={0}>
22
+ <FlexRow background height={calculatedHeight} width={calculatedHeight} borderTop={`1px solid ${theme.palette.divider}`} borderLeft={`1px solid ${theme.palette.divider}`}>
23
+ <div ref={ref}>
24
+ <Identicon size={calculatedHeight * 0.6} value={`${value}`} sx={{ padding: `${calculatedHeight * 0.2}px` }} {...props} />
25
+ </div>
26
+ </FlexRow>
27
+ </FlexRow>
28
+ )
29
+ }