@xyo-network/react-property 5.1.4 → 5.1.6
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/browser/index.mjs
CHANGED
|
@@ -8,9 +8,10 @@ import { typeOf } from "@xyo-network/typeof";
|
|
|
8
8
|
import React2 from "react";
|
|
9
9
|
|
|
10
10
|
// src/components/Title.tsx
|
|
11
|
-
import { darken,
|
|
11
|
+
import { darken, Typography, useColorScheme, useTheme } from "@mui/material";
|
|
12
12
|
import { FlexRow } from "@xylabs/react-flexbox";
|
|
13
13
|
import { QuickTipButton } from "@xylabs/react-quick-tip-button";
|
|
14
|
+
import { useIsDark } from "@xylabs/react-theme";
|
|
14
15
|
import React from "react";
|
|
15
16
|
var PropertyTitle = /* @__PURE__ */ __name(({ elevation = 1, size = "medium", tip, more, title, ...props }) => {
|
|
16
17
|
const sizeVariants = {
|
|
@@ -33,8 +34,10 @@ var PropertyTitle = /* @__PURE__ */ __name(({ elevation = 1, size = "medium", ti
|
|
|
33
34
|
};
|
|
34
35
|
const quickTipSize = Math.min(sizeFontSize[size], 16);
|
|
35
36
|
const theme = useTheme();
|
|
37
|
+
const {} = useColorScheme();
|
|
38
|
+
const isDark = useIsDark();
|
|
36
39
|
return /* @__PURE__ */ React.createElement(FlexRow, {
|
|
37
|
-
bgcolor:
|
|
40
|
+
bgcolor: isDark ? darken(theme.palette.background.paper, 0.75 * elevation) : darken(theme.palette.background.paper, 0.025 * elevation),
|
|
38
41
|
alignItems: "center",
|
|
39
42
|
height: sizeTitleHeight[size],
|
|
40
43
|
justifyContent: "space-between",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Group.tsx","../../src/components/Title.tsx","../../src/components/Property.tsx","../../src/components/ActionsMenu.tsx","../../src/components/IdenticonCorner.tsx","../../src/components/Value.tsx"],"sourcesContent":["import { Paper, useTheme } from '@mui/material'\nimport {\n FlexCol, FlexGrowRow, FlexRow,\n} from '@xylabs/react-flexbox'\nimport { typeOf } from '@xyo-network/typeof'\nimport type { ReactElement } from 'react'\nimport React from 'react'\n\nimport type {\n PropertyGroupBoxProps, PropertyGroupPaperProps, PropertyGroupProps,\n} from './Props.ts'\nimport { PropertyTitle } from './Title.tsx'\n\nconst PropertyGroupBox: React.FC<PropertyGroupBoxProps> = ({\n titleProps, children, title, tip, ...props\n}) => {\n const theme = useTheme()\n const childrenArray = typeOf(children) === 'array' ? (children as ReactElement[]) : undefined\n return (\n <FlexCol alignItems=\"stretch\" overflow=\"hidden\" {...props}>\n <FlexRow overflow=\"hidden\" justifyContent=\"stretch\" alignItems=\"stretch\">\n <PropertyTitle alignItems=\"flex-start\" size=\"full\" title={title} tip={tip} {...titleProps} />\n {childrenArray\n ? (\n <FlexGrowRow>\n {childrenArray?.map((child, index) => {\n return child\n ? (\n <FlexGrowRow key={index} borderLeft={1} borderColor={theme.palette.divider}>\n {child}\n </FlexGrowRow>\n )\n : null\n })}\n </FlexGrowRow>\n )\n : <FlexGrowRow overflow=\"hidden\">{children}</FlexGrowRow>}\n </FlexRow>\n </FlexCol>\n )\n}\n\nconst PropertyGroupPaper: React.FC<PropertyGroupPaperProps> = ({\n style, variant, elevation, square, ...props\n}) => {\n return (\n <Paper\n style={{\n minWidth: 0, overflow: 'hidden', ...style,\n }}\n variant={variant}\n elevation={elevation}\n square={square}\n >\n <PropertyGroupBox {...props} paper={false} />\n </Paper>\n )\n}\n\nexport const PropertyGroup: React.FC<PropertyGroupProps> = (props) => {\n return props.paper ? <PropertyGroupPaper {...props} /> : <PropertyGroupBox {...props} />\n}\n","import type { TypographyVariant } from '@mui/material'\nimport {\n darken, lighten, Typography, useTheme,\n} from '@mui/material'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { QuickTipButton } from '@xylabs/react-quick-tip-button'\nimport type { SizeProp } from '@xyo-network/react-shared'\nimport type { ReactNode } from 'react'\nimport React from 'react'\n\nexport type TitleSizeProp = SizeProp | 'full'\n\nexport interface PropertyTitleProps extends FlexBoxProps {\n elevation?: number\n more?: ReactNode\n size?: TitleSizeProp\n tip?: ReactNode\n title?: string\n}\n\nexport const PropertyTitle: React.FC<PropertyTitleProps> = ({\n elevation = 1, size = 'medium', tip, more, title, ...props\n}) => {\n const sizeVariants: Record<TitleSizeProp, TypographyVariant> = {\n full: 'caption',\n large: 'caption',\n medium: 'caption',\n small: 'caption',\n }\n\n const sizeTitleHeight: Record<TitleSizeProp, number | undefined> = {\n full: undefined,\n large: 32,\n medium: 20,\n small: 16,\n }\n\n const sizeFontSize: Record<TitleSizeProp, number> = {\n full: 16,\n large: 16,\n medium: 14,\n small: 10,\n }\n\n const quickTipSize = Math.min(sizeFontSize[size], 16)\n\n const theme = useTheme()\n\n return (\n <FlexRow\n bgcolor={\n theme.palette.mode === 'dark'\n ? lighten(theme.palette.background.paper, 0.05 * elevation)\n : darken(theme.palette.background.paper, 0.025 * elevation)\n }\n alignItems=\"center\"\n height={sizeTitleHeight[size]}\n justifyContent=\"space-between\"\n {...props}\n >\n <FlexRow paddingX={1} paddingY={0.5}>\n <Typography fontWeight={500} noWrap variant={sizeVariants[size]} fontSize={sizeFontSize[size]}>\n <small>\n <strong>{title}</strong>\n </small>\n </Typography>\n {tip\n ? (\n <QuickTipButton style={{ fontSize: quickTipSize }} color=\"inherit\" title={title ?? ''}>\n {tip}\n </QuickTipButton>\n )\n : null}\n </FlexRow>\n {more}\n </FlexRow>\n )\n}\n","import type { TypographyVariant } from '@mui/material'\nimport { CircularProgress, Paper } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport type { SizeProp } from '@xyo-network/react-shared'\nimport React from 'react'\n\nimport { PropertyActionsMenu } from './ActionsMenu.tsx'\nimport { IdenticonCorner } from './IdenticonCorner.tsx'\nimport type {\n PropertyBoxProps, PropertyPaperProps, PropertyProps,\n} from './Props.ts'\nimport { PropertyTitle } from './Title.tsx'\nimport { PropertyValue } from './Value.tsx'\n\nconst PropertyBox: React.FC<PropertyBoxProps> = ({\n titleProps, title, value, children, size = 'medium', tip, actions, required, badge = false, ...props\n}) => {\n const sizeValueHeight: Record<SizeProp, number> = {\n large: 48,\n medium: 36,\n small: 24,\n }\n\n const sizeVariants: Record<SizeProp, TypographyVariant> = {\n large: 'h6',\n medium: 'body1',\n small: 'body2',\n }\n\n return (\n <FlexRow flexDirection=\"column\" minWidth={0} alignItems=\"stretch\" overflow=\"hidden\" {...props}>\n {title === undefined\n ? null\n : (\n <PropertyTitle\n tip={tip}\n title={required ? `${title}*` : title}\n size={size}\n more={<PropertyActionsMenu actions={actions} />}\n {...titleProps}\n />\n )}\n <FlexRow\n pl={1}\n columnGap={1}\n justifyContent={value === undefined ? 'center' : 'space-between'}\n overflow=\"hidden\"\n height={sizeValueHeight[size]}\n >\n {children ?? ((value === undefined)\n ? <CircularProgress size={16} />\n : <PropertyValue value={value} typographyVariant={sizeVariants[size]} />)}\n {value === undefined\n ? null\n : badge\n ? <IdenticonCorner value={value} />\n : null}\n </FlexRow>\n </FlexRow>\n )\n}\nPropertyBox.displayName = 'PropertyBox'\n\nconst PropertyPaper: React.FC<PropertyPaperProps> = ({\n ref, style, variant, elevation = 2, square, ...props\n}) => {\n return (\n <Paper\n ref={ref}\n style={{\n minWidth: 0, overflow: 'hidden', ...style,\n }}\n variant={variant}\n elevation={elevation}\n square={square}\n >\n <PropertyBox {...props} paper={false} />\n </Paper>\n )\n}\nPropertyPaper.displayName = 'PropertyPaper'\n\nexport const Property: React.FC<PropertyProps> = ({ ...props }) => {\n return props.paper ? <PropertyPaper {...props} /> : <PropertyBox {...props} />\n}\nProperty.displayName = 'Property'\n","import { MoreHoriz as MoreHorizIcon } from '@mui/icons-material'\nimport {\n IconButton, Menu, MenuItem,\n} from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport React, { useState } from 'react'\n\nimport type { PropertyActionsProps } from './ActionsProps.ts'\n\nexport const PropertyActionsMenu: React.FC<PropertyActionsProps> = ({ actions, ...props }) => {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null)\n const open = !!anchorEl\n\n const handleClick = (event: React.MouseEvent<HTMLElement>) => {\n setAnchorEl(event.currentTarget)\n }\n const handleClose = () => {\n setAnchorEl(null)\n }\n\n return actions && actions?.length > 0\n ? (\n <FlexRow {...props}>\n <IconButton size=\"small\" color=\"inherit\" onClick={handleClick}>\n <MoreHorizIcon fontSize=\"inherit\" />\n </IconButton>\n <Menu anchorEl={anchorEl} open={open} onClose={handleClose}>\n {actions?.map((action) => {\n return (\n <MenuItem\n key={action.name}\n onClick={() => {\n action?.onClick?.()\n handleClose()\n }}\n >\n {action.name}\n </MenuItem>\n )\n })}\n </Menu>\n </FlexRow>\n )\n : null\n}\n","import { useTheme } from '@mui/material'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { Identicon } from '@xylabs/react-identicon'\nimport React, { useMemo, useRef } from 'react'\n\nexport interface IdenticonCornerProps extends FlexBoxProps {\n value?: string | number | boolean | null\n}\n\nexport const IdenticonCorner: React.FC<IdenticonCornerProps> = ({ value, ...props }) => {\n const theme = useTheme()\n const ref = useRef<HTMLDivElement>(null)\n\n const parentHeight = useMemo(() => ref.current?.parentElement?.parentElement?.clientHeight, [ref.current])\n\n const calculatedHeight = parentHeight ?? 0\n\n return (\n <FlexRow alignItems=\"flex-start\" height=\"100%\">\n <FlexRow background height={calculatedHeight} width={calculatedHeight} borderLeft={`1px solid ${theme.palette.divider}`}>\n <div ref={ref}>\n <Identicon size={calculatedHeight * 0.6} value={`${value}`} sx={{ padding: `${calculatedHeight * 0.2}px` }} {...props} />\n </div>\n </FlexRow>\n </FlexRow>\n )\n}\n","import type { TypographyVariant } from '@mui/material'\nimport type { EllipsizeBoxProps } from '@xyo-network/react-shared'\nimport { EllipsizeBox } from '@xyo-network/react-shared'\nimport React from 'react'\n\nexport interface PropertyValueProps extends EllipsizeBoxProps {\n typographyVariant?: TypographyVariant\n value?: string | number | boolean | null\n}\n\nexport const PropertyValue = ({\n ref, typographyVariant = 'body1', value, ...props\n}: PropertyValueProps) => {\n return value === undefined\n ? null\n : (\n <EllipsizeBox\n typographyProps={{\n component: undefined, title: value?.toString(), variant: typographyVariant,\n }}\n width=\"100%\"\n ref={ref}\n {...props}\n >\n {value}\n </EllipsizeBox>\n )\n}\n\nPropertyValue.displayName = 'PropertyValue'\n"],"mappings":";;;;AAAA,SAASA,OAAOC,YAAAA,iBAAgB;AAChC,SACEC,SAASC,aAAaC,WAAAA,gBACjB;AACP,SAASC,cAAc;AAEvB,OAAOC,YAAW;;;ACLlB,SACEC,QAAQC,SAASC,YAAYC,gBACxB;AAEP,SAASC,eAAe;AACxB,SAASC,sBAAsB;AAG/B,OAAOC,WAAW;AAYX,IAAMC,gBAA8C,wBAAC,EAC1DC,YAAY,GAAGC,OAAO,UAAUC,KAAKC,MAAMC,OAAO,GAAGC,MAAAA,MACtD;AACC,QAAMC,eAAyD;IAC7DC,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRC,OAAO;EACT;AAEA,QAAMC,kBAA6D;IACjEJ,MAAMK;IACNJ,OAAO;IACPC,QAAQ;IACRC,OAAO;EACT;AAEA,QAAMG,eAA8C;IAClDN,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRC,OAAO;EACT;AAEA,QAAMI,eAAeC,KAAKC,IAAIH,aAAaZ,IAAAA,GAAO,EAAA;AAElD,QAAMgB,QAAQC,SAAAA;AAEd,SACE,sBAAA,cAACC,SAAAA;IACCC,SACEH,MAAMI,QAAQC,SAAS,SACnBC,QAAQN,MAAMI,QAAQG,WAAWC,OAAO,OAAOzB,SAAAA,IAC/C0B,OAAOT,MAAMI,QAAQG,WAAWC,OAAO,QAAQzB,SAAAA;IAErD2B,YAAW;IACXC,QAAQjB,gBAAgBV,IAAAA;IACxB4B,gBAAe;IACd,GAAGxB;KAEJ,sBAAA,cAACc,SAAAA;IAAQW,UAAU;IA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AAc;AAErB,IAAMS,WAAoC,wBAAC,EAAE,GAAGjC,MAAAA,MAAO;AAC5D,SAAOA,MAAMgC,QAAQ,gBAAA1B,OAAA,cAACmB,eAAkBzB,KAAAA,IAAY,gBAAAM,OAAA,cAAChB,aAAgBU,KAAAA;AACvE,GAFiD;AAGjDiC,SAAST,cAAc;","names":["Paper","useTheme","FlexCol","FlexGrowRow","FlexRow","typeOf","React","darken","lighten","Typography","useTheme","FlexRow","QuickTipButton","React","PropertyTitle","elevation","size","tip","more","title","props","sizeVariants","full","large","medium","small","sizeTitleHeight","undefined","sizeFontSize","quickTipSize","Math","min","theme","useTheme","FlexRow","bgcolor","palette","mode","lighten","background","paper","darken","alignItems","height","justifyContent","paddingX","paddingY","Typography","fontWeight","noWrap","variant","fontSize","strong","QuickTipButton","style","color","PropertyGroupBox","titleProps","children","title","tip","props","theme","useTheme","childrenArray","typeOf","undefined","React","FlexCol","alignItems","overflow","FlexRow","justifyContent","PropertyTitle","size","FlexGrowRow","map","child","index","key","borderLeft","borderColor","palette","divider","PropertyGroupPaper","style","variant","elevation","square","Paper","minWidth","paper","PropertyGroup","CircularProgress","Paper","FlexRow","React","MoreHoriz","MoreHorizIcon","IconButton","Menu","MenuItem","FlexRow","React","useState","PropertyActionsMenu","actions","props","anchorEl","setAnchorEl","useState","open","handleClick","event","currentTarget","handleClose","length","React","FlexRow","IconButton","size","color","onClick","MoreHorizIcon","fontSize","Menu","onClose","map","action","MenuItem","key","name","useTheme","FlexRow","Identicon","React","useMemo","useRef","IdenticonCorner","value","props","theme","useTheme","ref","useRef","parentHeight","useMemo","current","parentElement","clientHeight","calculatedHeight","React","FlexRow","alignItems","height","background","width","borderLeft","palette","divider","div","Identicon","size","sx","padding","EllipsizeBox","React","PropertyValue","ref","typographyVariant","value","props","undefined","React","EllipsizeBox","typographyProps","component","title","toString","variant","width","displayName","PropertyBox","titleProps","title","value","children","size","tip","actions","required","badge","props","sizeValueHeight","large","medium","small","sizeVariants","React","FlexRow","flexDirection","minWidth","alignItems","overflow","undefined","PropertyTitle","more","PropertyActionsMenu","pl","columnGap","justifyContent","height","CircularProgress","PropertyValue","typographyVariant","IdenticonCorner","displayName","PropertyPaper","ref","style","variant","elevation","square","Paper","paper","Property"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/Group.tsx","../../src/components/Title.tsx","../../src/components/Property.tsx","../../src/components/ActionsMenu.tsx","../../src/components/IdenticonCorner.tsx","../../src/components/Value.tsx"],"sourcesContent":["import { Paper, useTheme } from '@mui/material'\nimport {\n FlexCol, FlexGrowRow, FlexRow,\n} from '@xylabs/react-flexbox'\nimport { typeOf } from '@xyo-network/typeof'\nimport type { ReactElement } from 'react'\nimport React from 'react'\n\nimport type {\n PropertyGroupBoxProps, PropertyGroupPaperProps, PropertyGroupProps,\n} from './Props.ts'\nimport { PropertyTitle } from './Title.tsx'\n\nconst PropertyGroupBox: React.FC<PropertyGroupBoxProps> = ({\n titleProps, children, title, tip, ...props\n}) => {\n const theme = useTheme()\n const childrenArray = typeOf(children) === 'array' ? (children as ReactElement[]) : undefined\n return (\n <FlexCol alignItems=\"stretch\" overflow=\"hidden\" {...props}>\n <FlexRow overflow=\"hidden\" justifyContent=\"stretch\" alignItems=\"stretch\">\n <PropertyTitle alignItems=\"flex-start\" size=\"full\" title={title} tip={tip} {...titleProps} />\n {childrenArray\n ? (\n <FlexGrowRow>\n {childrenArray?.map((child, index) => {\n return child\n ? (\n <FlexGrowRow key={index} borderLeft={1} borderColor={theme.palette.divider}>\n {child}\n </FlexGrowRow>\n )\n : null\n })}\n </FlexGrowRow>\n )\n : <FlexGrowRow overflow=\"hidden\">{children}</FlexGrowRow>}\n </FlexRow>\n </FlexCol>\n )\n}\n\nconst PropertyGroupPaper: React.FC<PropertyGroupPaperProps> = ({\n style, variant, elevation, square, ...props\n}) => {\n return (\n <Paper\n style={{\n minWidth: 0, overflow: 'hidden', ...style,\n }}\n variant={variant}\n elevation={elevation}\n square={square}\n >\n <PropertyGroupBox {...props} paper={false} />\n </Paper>\n )\n}\n\nexport const PropertyGroup: React.FC<PropertyGroupProps> = (props) => {\n return props.paper ? <PropertyGroupPaper {...props} /> : <PropertyGroupBox {...props} />\n}\n","import type { TypographyVariant } from '@mui/material'\nimport {\n darken, lighten, Typography, useColorScheme, useTheme,\n} from '@mui/material'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { QuickTipButton } from '@xylabs/react-quick-tip-button'\nimport { useIsDark } from '@xylabs/react-theme'\nimport type { SizeProp } from '@xyo-network/react-shared'\nimport type { ReactNode } from 'react'\nimport React from 'react'\n\nexport type TitleSizeProp = SizeProp | 'full'\n\nexport interface PropertyTitleProps extends FlexBoxProps {\n elevation?: number\n more?: ReactNode\n size?: TitleSizeProp\n tip?: ReactNode\n title?: string\n}\n\nexport const PropertyTitle: React.FC<PropertyTitleProps> = ({\n elevation = 1, size = 'medium', tip, more, title, ...props\n}) => {\n const sizeVariants: Record<TitleSizeProp, TypographyVariant> = {\n full: 'caption',\n large: 'caption',\n medium: 'caption',\n small: 'caption',\n }\n\n const sizeTitleHeight: Record<TitleSizeProp, number | undefined> = {\n full: undefined,\n large: 32,\n medium: 20,\n small: 16,\n }\n\n const sizeFontSize: Record<TitleSizeProp, number> = {\n full: 16,\n large: 16,\n medium: 14,\n small: 10,\n }\n\n const quickTipSize = Math.min(sizeFontSize[size], 16)\n\n const theme = useTheme()\n const {} = useColorScheme()\n const isDark = useIsDark()\n\n return (\n <FlexRow\n bgcolor={\n isDark\n ? darken(theme.palette.background.paper, 0.75 * elevation)\n : darken(theme.palette.background.paper, 0.025 * elevation)\n }\n alignItems=\"center\"\n height={sizeTitleHeight[size]}\n justifyContent=\"space-between\"\n {...props}\n >\n <FlexRow paddingX={1} paddingY={0.5}>\n <Typography fontWeight={500} noWrap variant={sizeVariants[size]} fontSize={sizeFontSize[size]}>\n <small>\n <strong>{title}</strong>\n </small>\n </Typography>\n {tip\n ? (\n <QuickTipButton style={{ fontSize: quickTipSize }} color=\"inherit\" title={title ?? ''}>\n {tip}\n </QuickTipButton>\n )\n : null}\n </FlexRow>\n {more}\n </FlexRow>\n )\n}\n","import type { TypographyVariant } from '@mui/material'\nimport { CircularProgress, Paper } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport type { SizeProp } from '@xyo-network/react-shared'\nimport React from 'react'\n\nimport { PropertyActionsMenu } from './ActionsMenu.tsx'\nimport { IdenticonCorner } from './IdenticonCorner.tsx'\nimport type {\n PropertyBoxProps, PropertyPaperProps, PropertyProps,\n} from './Props.ts'\nimport { PropertyTitle } from './Title.tsx'\nimport { PropertyValue } from './Value.tsx'\n\nconst PropertyBox: React.FC<PropertyBoxProps> = ({\n titleProps, title, value, children, size = 'medium', tip, actions, required, badge = false, ...props\n}) => {\n const sizeValueHeight: Record<SizeProp, number> = {\n large: 48,\n medium: 36,\n small: 24,\n }\n\n const sizeVariants: Record<SizeProp, TypographyVariant> = {\n large: 'h6',\n medium: 'body1',\n small: 'body2',\n }\n\n return (\n <FlexRow flexDirection=\"column\" minWidth={0} alignItems=\"stretch\" overflow=\"hidden\" {...props}>\n {title === undefined\n ? null\n : (\n <PropertyTitle\n tip={tip}\n title={required ? `${title}*` : title}\n size={size}\n more={<PropertyActionsMenu actions={actions} />}\n {...titleProps}\n />\n )}\n <FlexRow\n pl={1}\n columnGap={1}\n justifyContent={value === undefined ? 'center' : 'space-between'}\n overflow=\"hidden\"\n height={sizeValueHeight[size]}\n >\n {children ?? ((value === undefined)\n ? <CircularProgress size={16} />\n : <PropertyValue value={value} typographyVariant={sizeVariants[size]} />)}\n {value === undefined\n ? null\n : badge\n ? <IdenticonCorner value={value} />\n : null}\n </FlexRow>\n </FlexRow>\n )\n}\nPropertyBox.displayName = 'PropertyBox'\n\nconst PropertyPaper: React.FC<PropertyPaperProps> = ({\n ref, style, variant, elevation = 2, square, ...props\n}) => {\n return (\n <Paper\n ref={ref}\n style={{\n minWidth: 0, overflow: 'hidden', ...style,\n }}\n variant={variant}\n elevation={elevation}\n square={square}\n >\n <PropertyBox {...props} paper={false} />\n </Paper>\n )\n}\nPropertyPaper.displayName = 'PropertyPaper'\n\nexport const Property: React.FC<PropertyProps> = ({ ...props }) => {\n return props.paper ? <PropertyPaper {...props} /> : <PropertyBox {...props} />\n}\nProperty.displayName = 'Property'\n","import { MoreHoriz as MoreHorizIcon } from '@mui/icons-material'\nimport {\n IconButton, Menu, MenuItem,\n} from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport React, { useState } from 'react'\n\nimport type { PropertyActionsProps } from './ActionsProps.ts'\n\nexport const PropertyActionsMenu: React.FC<PropertyActionsProps> = ({ actions, ...props }) => {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null)\n const open = !!anchorEl\n\n const handleClick = (event: React.MouseEvent<HTMLElement>) => {\n setAnchorEl(event.currentTarget)\n }\n const handleClose = () => {\n setAnchorEl(null)\n }\n\n return actions && actions?.length > 0\n ? (\n <FlexRow {...props}>\n <IconButton size=\"small\" color=\"inherit\" onClick={handleClick}>\n <MoreHorizIcon fontSize=\"inherit\" />\n </IconButton>\n <Menu anchorEl={anchorEl} open={open} onClose={handleClose}>\n {actions?.map((action) => {\n return (\n <MenuItem\n key={action.name}\n onClick={() => {\n action?.onClick?.()\n handleClose()\n }}\n >\n {action.name}\n </MenuItem>\n )\n })}\n </Menu>\n </FlexRow>\n )\n : null\n}\n","import { useTheme } from '@mui/material'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { Identicon } from '@xylabs/react-identicon'\nimport React, { useMemo, useRef } from 'react'\n\nexport interface IdenticonCornerProps extends FlexBoxProps {\n value?: string | number | boolean | null\n}\n\nexport const IdenticonCorner: React.FC<IdenticonCornerProps> = ({ value, ...props }) => {\n const theme = useTheme()\n const ref = useRef<HTMLDivElement>(null)\n\n const parentHeight = useMemo(() => ref.current?.parentElement?.parentElement?.clientHeight, [ref.current])\n\n const calculatedHeight = parentHeight ?? 0\n\n return (\n <FlexRow alignItems=\"flex-start\" height=\"100%\">\n <FlexRow background height={calculatedHeight} width={calculatedHeight} borderLeft={`1px solid ${theme.palette.divider}`}>\n <div ref={ref}>\n <Identicon size={calculatedHeight * 0.6} value={`${value}`} sx={{ padding: `${calculatedHeight * 0.2}px` }} {...props} />\n </div>\n </FlexRow>\n </FlexRow>\n )\n}\n","import type { TypographyVariant } from '@mui/material'\nimport type { EllipsizeBoxProps } from '@xyo-network/react-shared'\nimport { EllipsizeBox } from '@xyo-network/react-shared'\nimport React from 'react'\n\nexport interface PropertyValueProps extends EllipsizeBoxProps {\n typographyVariant?: TypographyVariant\n value?: string | number | boolean | null\n}\n\nexport const PropertyValue = ({\n ref, typographyVariant = 'body1', value, ...props\n}: PropertyValueProps) => {\n return value === undefined\n ? null\n : (\n <EllipsizeBox\n typographyProps={{\n component: undefined, title: value?.toString(), variant: typographyVariant,\n }}\n width=\"100%\"\n ref={ref}\n {...props}\n >\n {value}\n </EllipsizeBox>\n )\n}\n\nPropertyValue.displayName = 'PropertyValue'\n"],"mappings":";;;;AAAA,SAASA,OAAOC,YAAAA,iBAAgB;AAChC,SACEC,SAASC,aAAaC,WAAAA,gBACjB;AACP,SAASC,cAAc;AAEvB,OAAOC,YAAW;;;ACLlB,SACEC,QAAiBC,YAAYC,gBAAgBC,gBACxC;AAEP,SAASC,eAAe;AACxB,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;AAG1B,OAAOC,WAAW;AAYX,IAAMC,gBAA8C,wBAAC,EAC1DC,YAAY,GAAGC,OAAO,UAAUC,KAAKC,MAAMC,OAAO,GAAGC,MAAAA,MACtD;AACC,QAAMC,eAAyD;IAC7DC,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRC,OAAO;EACT;AAEA,QAAMC,kBAA6D;IACjEJ,MAAMK;IACNJ,OAAO;IACPC,QAAQ;IACRC,OAAO;EACT;AAEA,QAAMG,eAA8C;IACl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;IAAc6B,mBAAmBjB,aAAaV,IAAAA;OAChEF,UAAUmB,SACP,OACAb,QACE,gBAAAO,OAAA,cAACiB,iBAAAA;IAAgB9B;OACjB,IAAA,CAAA;AAId,GA9CgD;AA+ChDH,YAAYkC,cAAc;AAE1B,IAAMC,gBAA8C,wBAAC,EACnDC,KAAKC,OAAOC,SAASC,YAAY,GAAGC,QAAQ,GAAG9B,MAAAA,MAChD;AACC,SACE,gBAAAM,OAAA,cAACyB,QAAAA;IACCL;IACAC,OAAO;MACLlB,UAAU;MAAGE,UAAU;MAAU,GAAGgB;IACtC;IACAC;IACAC;IACAC;KAEA,gBAAAxB,OAAA,cAAChB,aAAAA;IAAa,GAAGU;IAAOgC,OAAO;;AAGrC,GAhBoD;AAiBpDP,cAAcD,cAAc;AAErB,IAAMS,WAAoC,wBAAC,EAAE,GAAGjC,MAAAA,MAAO;AAC5D,SAAOA,MAAMgC,QAAQ,gBAAA1B,OAAA,cAACmB,eAAkBzB,KAAAA,IAAY,gBAAAM,OAAA,cAAChB,aAAgBU,KAAAA;AACvE,GAFiD;AAGjDiC,SAAST,cAAc;","names":["Paper","useTheme","FlexCol","FlexGrowRow","FlexRow","typeOf","React","darken","Typography","useColorScheme","useTheme","FlexRow","QuickTipButton","useIsDark","React","PropertyTitle","elevation","size","tip","more","title","props","sizeVariants","full","large","medium","small","sizeTitleHeight","undefined","sizeFontSize","quickTipSize","Math","min","theme","useTheme","useColorScheme","isDark","useIsDark","FlexRow","bgcolor","darken","palette","background","paper","alignItems","height","justifyContent","paddingX","paddingY","Typography","fontWeight","noWrap","variant","fontSize","strong","QuickTipButton","style","color","PropertyGroupBox","titleProps","children","title","tip","props","theme","useTheme","childrenArray","typeOf","undefined","React","FlexCol","alignItems","overflow","FlexRow","justifyContent","PropertyTitle","size","FlexGrowRow","map","child","index","key","borderLeft","borderColor","palette","divider","PropertyGroupPaper","style","variant","elevation","square","Paper","minWidth","paper","PropertyGroup","CircularProgress","Paper","FlexRow","React","MoreHoriz","MoreHorizIcon","IconButton","Menu","MenuItem","FlexRow","React","useState","PropertyActionsMenu","actions","props","anchorEl","setAnchorEl","useState","open","handleClick","event","currentTarget","handleClose","length","React","FlexRow","IconButton","size","color","onClick","MoreHorizIcon","fontSize","Menu","onClose","map","action","MenuItem","key","name","useTheme","FlexRow","Identicon","React","useMemo","useRef","IdenticonCorner","value","props","theme","useTheme","ref","useRef","parentHeight","useMemo","current","parentElement","clientHeight","calculatedHeight","React","FlexRow","alignItems","height","background","width","borderLeft","palette","divider","div","Identicon","size","sx","padding","EllipsizeBox","React","PropertyValue","ref","typographyVariant","value","props","undefined","React","EllipsizeBox","typographyProps","component","title","toString","variant","width","displayName","PropertyBox","titleProps","title","value","children","size","tip","actions","required","badge","props","sizeValueHeight","large","medium","small","sizeVariants","React","FlexRow","flexDirection","minWidth","alignItems","overflow","undefined","PropertyTitle","more","PropertyActionsMenu","pl","columnGap","justifyContent","height","CircularProgress","PropertyValue","typographyVariant","IdenticonCorner","displayName","PropertyPaper","ref","style","variant","elevation","square","Paper","paper","Property"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Title.d.ts","sourceRoot":"","sources":["../../../src/components/Title.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"Title.d.ts","sourceRoot":"","sources":["../../../src/components/Title.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAIzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE7C,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,GAAG,CAAC,EAAE,SAAS,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA2DtD,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-property",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.6",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"@xylabs/react-flexbox": "^6.1.15",
|
|
43
43
|
"@xylabs/react-identicon": "^6.1.15",
|
|
44
44
|
"@xylabs/react-quick-tip-button": "^6.1.15",
|
|
45
|
-
"@xyo-network/react-shared": "^5.1.
|
|
45
|
+
"@xyo-network/react-shared": "^5.1.6",
|
|
46
46
|
"@xyo-network/typeof": "^3.12.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@mui/icons-material": "^7.0.2",
|
|
50
50
|
"@mui/material": "^7.0.2",
|
|
51
51
|
"@storybook/react": "^8.6.12",
|
|
52
|
-
"@types/react": "^19.1.
|
|
52
|
+
"@types/react": "^19.1.2",
|
|
53
53
|
"@xylabs/ts-scripts-yarn3": "^6.2.1",
|
|
54
54
|
"@xylabs/tsconfig-react": "^6.2.1",
|
|
55
55
|
"react": "^19.1.0",
|
|
@@ -57,28 +57,28 @@ WithUndefinedData.args = { title: 'Block Hash' }
|
|
|
57
57
|
const WithData = Template.bind({})
|
|
58
58
|
WithData.args = {
|
|
59
59
|
title: 'Block Hash',
|
|
60
|
-
|
|
60
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
const WithDataSmall = Template.bind({})
|
|
64
64
|
WithDataSmall.args = {
|
|
65
65
|
size: 'small',
|
|
66
66
|
title: 'Block Hash',
|
|
67
|
-
|
|
67
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
const WithDataCompare = TemplateWithCompare.bind({})
|
|
71
71
|
WithDataCompare.args = {
|
|
72
72
|
tip: 'This is the block hash',
|
|
73
73
|
title: 'Block Hash',
|
|
74
|
-
|
|
74
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
const WithDataCompareOutlined = TemplateWithCompare.bind({})
|
|
78
78
|
WithDataCompareOutlined.args = {
|
|
79
79
|
tip: 'This is the block hash',
|
|
80
80
|
title: 'Block Hash',
|
|
81
|
-
|
|
81
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
82
82
|
variant: 'outlined',
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -86,7 +86,7 @@ const WithDataCompareElevation = TemplateWithCompare.bind({})
|
|
|
86
86
|
WithDataCompareElevation.args = {
|
|
87
87
|
tip: 'This is the block hash',
|
|
88
88
|
title: 'Block Hash',
|
|
89
|
-
|
|
89
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
90
90
|
variant: 'elevation',
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -96,7 +96,7 @@ WithDataAndBadgeSmall.args = {
|
|
|
96
96
|
size: 'small',
|
|
97
97
|
tip: 'This is the block hash',
|
|
98
98
|
title: 'Block Hash',
|
|
99
|
-
|
|
99
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
const WithDataAndBadgeMedium = Template.bind({})
|
|
@@ -105,7 +105,7 @@ WithDataAndBadgeMedium.args = {
|
|
|
105
105
|
size: 'medium',
|
|
106
106
|
tip: 'This is the block hash',
|
|
107
107
|
title: 'Block Hash',
|
|
108
|
-
|
|
108
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
const WithDataAndBadgeLarge = Template.bind({})
|
|
@@ -114,14 +114,14 @@ WithDataAndBadgeLarge.args = {
|
|
|
114
114
|
size: 'large',
|
|
115
115
|
tip: 'This is the block hash',
|
|
116
116
|
title: 'Block Hash',
|
|
117
|
-
|
|
117
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
const WithTip = Template.bind({})
|
|
121
121
|
WithTip.args = {
|
|
122
122
|
tip: 'This is the block hash',
|
|
123
123
|
title: 'Block Hash',
|
|
124
|
-
|
|
124
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
const WithTipAndBadge = Template.bind({})
|
|
@@ -129,7 +129,7 @@ WithTipAndBadge.args = {
|
|
|
129
129
|
badge: true,
|
|
130
130
|
tip: 'This is the block hash',
|
|
131
131
|
title: 'Block Hash',
|
|
132
|
-
|
|
132
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
const WithActions = Template.bind({})
|
|
@@ -137,7 +137,7 @@ WithActions.args = {
|
|
|
137
137
|
actions: [{ name: 'ActionOne' }, { name: 'ActionTwo' }],
|
|
138
138
|
tip: 'This is the block hash',
|
|
139
139
|
title: 'Block Hash',
|
|
140
|
-
|
|
140
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
const LargeWithValue = Template.bind({})
|
|
@@ -146,7 +146,7 @@ LargeWithValue.args = {
|
|
|
146
146
|
size: 'large',
|
|
147
147
|
tip: 'This is the block hash',
|
|
148
148
|
title: 'Block Hash',
|
|
149
|
-
|
|
149
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
const LargeWithValueAndActions = Template.bind({})
|
|
@@ -156,7 +156,7 @@ LargeWithValueAndActions.args = {
|
|
|
156
156
|
size: 'large',
|
|
157
157
|
tip: 'This is the block hash',
|
|
158
158
|
title: 'Block Hash',
|
|
159
|
-
|
|
159
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
const SmallWithValueAndActions = Template.bind({})
|
|
@@ -166,7 +166,7 @@ SmallWithValueAndActions.args = {
|
|
|
166
166
|
size: 'small',
|
|
167
167
|
tip: 'This is the block hash',
|
|
168
168
|
title: 'Block Hash',
|
|
169
|
-
|
|
169
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
export {
|
package/src/components/Title.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { TypographyVariant } from '@mui/material'
|
|
2
2
|
import {
|
|
3
|
-
darken, lighten, Typography, useTheme,
|
|
3
|
+
darken, lighten, Typography, useColorScheme, useTheme,
|
|
4
4
|
} from '@mui/material'
|
|
5
5
|
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
6
6
|
import { FlexRow } from '@xylabs/react-flexbox'
|
|
7
7
|
import { QuickTipButton } from '@xylabs/react-quick-tip-button'
|
|
8
|
+
import { useIsDark } from '@xylabs/react-theme'
|
|
8
9
|
import type { SizeProp } from '@xyo-network/react-shared'
|
|
9
10
|
import type { ReactNode } from 'react'
|
|
10
11
|
import React from 'react'
|
|
@@ -46,12 +47,14 @@ export const PropertyTitle: React.FC<PropertyTitleProps> = ({
|
|
|
46
47
|
const quickTipSize = Math.min(sizeFontSize[size], 16)
|
|
47
48
|
|
|
48
49
|
const theme = useTheme()
|
|
50
|
+
const {} = useColorScheme()
|
|
51
|
+
const isDark = useIsDark()
|
|
49
52
|
|
|
50
53
|
return (
|
|
51
54
|
<FlexRow
|
|
52
55
|
bgcolor={
|
|
53
|
-
|
|
54
|
-
?
|
|
56
|
+
isDark
|
|
57
|
+
? darken(theme.palette.background.paper, 0.75 * elevation)
|
|
55
58
|
: darken(theme.palette.background.paper, 0.025 * elevation)
|
|
56
59
|
}
|
|
57
60
|
alignItems="center"
|