@xyo-network/react-property 7.5.8 → 7.5.11
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/components/Group.d.ts.map +1 -1
- package/dist/browser/components/IdenticonCorner.d.ts.map +1 -1
- package/dist/browser/components/Title.d.ts.map +1 -1
- package/dist/browser/index.mjs +205 -189
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +95 -32
- package/src/components/Action.ts +0 -8
- package/src/components/Actions.tsx +0 -45
- package/src/components/ActionsMenu.tsx +0 -45
- package/src/components/ActionsProps.ts +0 -8
- package/src/components/Group.tsx +0 -62
- package/src/components/IdenticonCorner.tsx +0 -28
- package/src/components/Property.tsx +0 -86
- package/src/components/PropertyBox.stories.tsx +0 -173
- package/src/components/PropertyPaper.stories.tsx +0 -191
- package/src/components/Props.ts +0 -48
- package/src/components/Title.stories.tsx +0 -30
- package/src/components/Title.tsx +0 -82
- package/src/components/Value.stories.tsx +0 -24
- package/src/components/Value.tsx +0 -30
- package/src/components/index.ts +0 -6
- package/src/global.d.ts +0 -1
- package/src/index.ts +0 -1
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { Replay as ReplayIcon } from '@mui/icons-material'
|
|
2
|
-
import { TextField } from '@mui/material'
|
|
3
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
4
|
-
import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
|
|
5
|
-
import React from 'react'
|
|
6
|
-
|
|
7
|
-
import { Property } from './Property.tsx'
|
|
8
|
-
import type { PropertyPaperProps, PropertyProps } from './Props.ts'
|
|
9
|
-
|
|
10
|
-
const StorybookEntry = {
|
|
11
|
-
argTypes: {},
|
|
12
|
-
component: Property,
|
|
13
|
-
parameters: { docs: { page: null } },
|
|
14
|
-
title: 'property/PropertyPaper',
|
|
15
|
-
} as Meta<typeof Property>
|
|
16
|
-
|
|
17
|
-
const Template: StoryFn = (args: PropertyProps) => <Property {...(args as PropertyPaperProps)} paper={true}></Property>
|
|
18
|
-
|
|
19
|
-
const TemplateWithCompare: StoryFn = (args: PropertyProps) => (
|
|
20
|
-
<FlexCol gap={1} alignItems="stretch">
|
|
21
|
-
<FlexRow gap={1}>
|
|
22
|
-
<TextField size="small" value="Sample text Field" />
|
|
23
|
-
<Property {...(args as PropertyPaperProps)} paper={true} size="small"></Property>
|
|
24
|
-
</FlexRow>
|
|
25
|
-
<FlexRow gap={1}>
|
|
26
|
-
<Property {...(args as PropertyPaperProps)} paper={true} size="small"></Property>
|
|
27
|
-
<Property {...(args as PropertyPaperProps)} paper={true} size="small"></Property>
|
|
28
|
-
</FlexRow>
|
|
29
|
-
<FlexRow gap={1}>
|
|
30
|
-
<TextField size="medium" value="Sample text Field" />
|
|
31
|
-
<Property {...(args as PropertyPaperProps)} paper={true} size="medium"></Property>
|
|
32
|
-
</FlexRow>
|
|
33
|
-
<FlexRow gap={1}>
|
|
34
|
-
<Property {...(args as PropertyPaperProps)} paper={true} size="medium"></Property>
|
|
35
|
-
<Property {...(args as PropertyPaperProps)} paper={true} size="medium"></Property>
|
|
36
|
-
</FlexRow>
|
|
37
|
-
<FlexRow gap={1}>
|
|
38
|
-
<TextField value="Sample text Field" />
|
|
39
|
-
<Property {...(args as PropertyPaperProps)} paper={true} size="large"></Property>
|
|
40
|
-
</FlexRow>
|
|
41
|
-
<FlexRow gap={1}>
|
|
42
|
-
<Property {...(args as PropertyPaperProps)} paper={true} size="large"></Property>
|
|
43
|
-
<Property {...(args as PropertyPaperProps)} paper={true} size="large"></Property>
|
|
44
|
-
</FlexRow>
|
|
45
|
-
</FlexCol>
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
const Default = Template.bind({})
|
|
49
|
-
Default.args = {}
|
|
50
|
-
|
|
51
|
-
const WithTitle = Template.bind({})
|
|
52
|
-
WithTitle.args = { title: 'No Data' }
|
|
53
|
-
|
|
54
|
-
const WithUndefinedData = Template.bind({})
|
|
55
|
-
WithUndefinedData.args = { title: 'Block Hash' }
|
|
56
|
-
|
|
57
|
-
const WithData = Template.bind({})
|
|
58
|
-
WithData.args = {
|
|
59
|
-
title: 'Block Hash',
|
|
60
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const WithDataSmall = Template.bind({})
|
|
64
|
-
WithDataSmall.args = {
|
|
65
|
-
size: 'small',
|
|
66
|
-
title: 'Block Hash',
|
|
67
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const WithDataCompare = TemplateWithCompare.bind({})
|
|
71
|
-
WithDataCompare.args = {
|
|
72
|
-
tip: 'This is the block hash',
|
|
73
|
-
title: 'Block Hash',
|
|
74
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const WithDataCompareOutlined = TemplateWithCompare.bind({})
|
|
78
|
-
WithDataCompareOutlined.args = {
|
|
79
|
-
tip: 'This is the block hash',
|
|
80
|
-
title: 'Block Hash',
|
|
81
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
82
|
-
variant: 'outlined',
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const WithDataCompareElevation = TemplateWithCompare.bind({})
|
|
86
|
-
WithDataCompareElevation.args = {
|
|
87
|
-
tip: 'This is the block hash',
|
|
88
|
-
title: 'Block Hash',
|
|
89
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
90
|
-
variant: 'elevation',
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const WithDataAndBadgeSmall = Template.bind({})
|
|
94
|
-
WithDataAndBadgeSmall.args = {
|
|
95
|
-
badge: true,
|
|
96
|
-
size: 'small',
|
|
97
|
-
tip: 'This is the block hash',
|
|
98
|
-
title: 'Block Hash',
|
|
99
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const WithDataAndBadgeMedium = Template.bind({})
|
|
103
|
-
WithDataAndBadgeMedium.args = {
|
|
104
|
-
badge: true,
|
|
105
|
-
size: 'medium',
|
|
106
|
-
tip: 'This is the block hash',
|
|
107
|
-
title: 'Block Hash',
|
|
108
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const WithDataAndBadgeLarge = Template.bind({})
|
|
112
|
-
WithDataAndBadgeLarge.args = {
|
|
113
|
-
badge: true,
|
|
114
|
-
size: 'large',
|
|
115
|
-
tip: 'This is the block hash',
|
|
116
|
-
title: 'Block Hash',
|
|
117
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const WithTip = Template.bind({})
|
|
121
|
-
WithTip.args = {
|
|
122
|
-
tip: 'This is the block hash',
|
|
123
|
-
title: 'Block Hash',
|
|
124
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const WithTipAndBadge = Template.bind({})
|
|
128
|
-
WithTipAndBadge.args = {
|
|
129
|
-
badge: true,
|
|
130
|
-
tip: 'This is the block hash',
|
|
131
|
-
title: 'Block Hash',
|
|
132
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const WithActions = Template.bind({})
|
|
136
|
-
WithActions.args = {
|
|
137
|
-
actions: [{ name: 'ActionOne' }, { name: 'ActionTwo' }],
|
|
138
|
-
tip: 'This is the block hash',
|
|
139
|
-
title: 'Block Hash',
|
|
140
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const LargeWithValue = Template.bind({})
|
|
144
|
-
LargeWithValue.args = {
|
|
145
|
-
badge: true,
|
|
146
|
-
size: 'large',
|
|
147
|
-
tip: 'This is the block hash',
|
|
148
|
-
title: 'Block Hash',
|
|
149
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const LargeWithValueAndActions = Template.bind({})
|
|
153
|
-
LargeWithValueAndActions.args = {
|
|
154
|
-
actions: [{ icon: <ReplayIcon />, name: 'ActionOne' }, { name: 'ActionTwo' }],
|
|
155
|
-
badge: true,
|
|
156
|
-
size: 'large',
|
|
157
|
-
tip: 'This is the block hash',
|
|
158
|
-
title: 'Block Hash',
|
|
159
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const SmallWithValueAndActions = Template.bind({})
|
|
163
|
-
SmallWithValueAndActions.args = {
|
|
164
|
-
actions: [{ icon: <ReplayIcon />, name: 'ActionOne' }, { name: 'ActionTwo' }],
|
|
165
|
-
badge: true,
|
|
166
|
-
size: 'small',
|
|
167
|
-
tip: 'This is the block hash',
|
|
168
|
-
title: 'Block Hash',
|
|
169
|
-
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef',
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export {
|
|
173
|
-
Default,
|
|
174
|
-
LargeWithValue,
|
|
175
|
-
LargeWithValueAndActions,
|
|
176
|
-
SmallWithValueAndActions,
|
|
177
|
-
WithActions,
|
|
178
|
-
WithData,
|
|
179
|
-
WithDataAndBadgeLarge,
|
|
180
|
-
WithDataAndBadgeMedium,
|
|
181
|
-
WithDataAndBadgeSmall,
|
|
182
|
-
WithDataCompare,
|
|
183
|
-
WithDataCompareElevation,
|
|
184
|
-
WithDataCompareOutlined,
|
|
185
|
-
WithDataSmall,
|
|
186
|
-
WithTip,
|
|
187
|
-
WithTipAndBadge,
|
|
188
|
-
WithUndefinedData,
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export default StorybookEntry
|
package/src/components/Props.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { PaperProps } from '@mui/material'
|
|
2
|
-
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
3
|
-
import type { SizeProp } from '@xyo-network/react-shared'
|
|
4
|
-
import type { ReactNode } from 'react'
|
|
5
|
-
|
|
6
|
-
import type { PropertyAction } from './Action.ts'
|
|
7
|
-
import type { PropertyTitleProps } from './Title.tsx'
|
|
8
|
-
|
|
9
|
-
export interface PropertyBaseProps {
|
|
10
|
-
paper?: boolean
|
|
11
|
-
tip?: ReactNode
|
|
12
|
-
title?: string
|
|
13
|
-
titleProps?: PropertyTitleProps
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type PropertyFieldBaseProps = PropertyBaseProps & {
|
|
17
|
-
actions?: PropertyAction[]
|
|
18
|
-
badge?: boolean
|
|
19
|
-
required?: boolean
|
|
20
|
-
size?: SizeProp
|
|
21
|
-
value?: string | number | boolean | null
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type PropertyBoxProps = PropertyFieldBaseProps
|
|
25
|
-
& FlexBoxProps & {
|
|
26
|
-
paper?: false
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type PropertyPaperProps = PropertyFieldBaseProps
|
|
30
|
-
& PaperProps & {
|
|
31
|
-
paper: true
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type PropertyProps = PropertyBoxProps | PropertyPaperProps
|
|
35
|
-
|
|
36
|
-
export type PropertyGroupBaseProps = PropertyBaseProps
|
|
37
|
-
|
|
38
|
-
export type PropertyGroupBoxProps = PropertyGroupBaseProps
|
|
39
|
-
& FlexBoxProps & {
|
|
40
|
-
paper?: false
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export type PropertyGroupPaperProps = PropertyGroupBaseProps
|
|
44
|
-
& PaperProps & {
|
|
45
|
-
paper: true
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type PropertyGroupProps = PropertyGroupBoxProps | PropertyGroupPaperProps
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import { PropertyTitle } from './Title.tsx'
|
|
5
|
-
|
|
6
|
-
const StorybookEntry = {
|
|
7
|
-
argTypes: {},
|
|
8
|
-
component: PropertyTitle,
|
|
9
|
-
parameters: { docs: { page: null } },
|
|
10
|
-
title: 'property/Title',
|
|
11
|
-
} as Meta<typeof PropertyTitle>
|
|
12
|
-
|
|
13
|
-
const Template: StoryFn<typeof PropertyTitle> = args => <PropertyTitle {...args}></PropertyTitle>
|
|
14
|
-
|
|
15
|
-
const Default = Template.bind({})
|
|
16
|
-
Default.args = {}
|
|
17
|
-
|
|
18
|
-
const WithData = Template.bind({})
|
|
19
|
-
|
|
20
|
-
WithData.args = { title: 'Sample Title' }
|
|
21
|
-
|
|
22
|
-
const WithDataAndActions = Template.bind({})
|
|
23
|
-
|
|
24
|
-
WithDataAndActions.args = { title: 'Sample Title' }
|
|
25
|
-
|
|
26
|
-
export {
|
|
27
|
-
Default, WithData, WithDataAndActions,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default StorybookEntry
|
package/src/components/Title.tsx
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type { TypographyVariant } from '@mui/material'
|
|
2
|
-
import {
|
|
3
|
-
Typography, useColorScheme, useTheme,
|
|
4
|
-
} from '@mui/material'
|
|
5
|
-
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
6
|
-
import { FlexRow } from '@xylabs/react-flexbox'
|
|
7
|
-
import { QuickTipButton } from '@xylabs/react-quick-tip-button'
|
|
8
|
-
import { darkenCss, useIsDark } from '@xylabs/react-theme'
|
|
9
|
-
import type { SizeProp } from '@xyo-network/react-shared'
|
|
10
|
-
import type { ReactNode } from 'react'
|
|
11
|
-
import React from 'react'
|
|
12
|
-
|
|
13
|
-
export type TitleSizeProp = SizeProp | 'full'
|
|
14
|
-
|
|
15
|
-
export interface PropertyTitleProps extends FlexBoxProps {
|
|
16
|
-
elevation?: number
|
|
17
|
-
more?: ReactNode
|
|
18
|
-
size?: TitleSizeProp
|
|
19
|
-
tip?: ReactNode
|
|
20
|
-
title?: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const PropertyTitle: React.FC<PropertyTitleProps> = ({
|
|
24
|
-
elevation = 1, size = 'medium', tip, more, title, ...props
|
|
25
|
-
}) => {
|
|
26
|
-
const sizeVariants: Record<TitleSizeProp, TypographyVariant> = {
|
|
27
|
-
full: 'caption',
|
|
28
|
-
large: 'caption',
|
|
29
|
-
medium: 'caption',
|
|
30
|
-
small: 'caption',
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const sizeTitleHeight: Record<TitleSizeProp, number | undefined> = {
|
|
34
|
-
full: undefined,
|
|
35
|
-
large: 32,
|
|
36
|
-
medium: 20,
|
|
37
|
-
small: 16,
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const sizeFontSize: Record<TitleSizeProp, number> = {
|
|
41
|
-
full: 16,
|
|
42
|
-
large: 16,
|
|
43
|
-
medium: 14,
|
|
44
|
-
small: 10,
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const quickTipSize = Math.min(sizeFontSize[size], 16)
|
|
48
|
-
|
|
49
|
-
const theme = useTheme()
|
|
50
|
-
const {} = useColorScheme()
|
|
51
|
-
const isDark = useIsDark()
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<FlexRow
|
|
55
|
-
bgcolor={
|
|
56
|
-
isDark
|
|
57
|
-
? darkenCss(theme.vars.palette.background.paper, 0.75 * elevation)
|
|
58
|
-
: darkenCss(theme.vars.palette.background.paper, 0.025 * elevation)
|
|
59
|
-
}
|
|
60
|
-
alignItems="center"
|
|
61
|
-
height={sizeTitleHeight[size]}
|
|
62
|
-
justifyContent="space-between"
|
|
63
|
-
{...props}
|
|
64
|
-
>
|
|
65
|
-
<FlexRow paddingX={1} paddingY={0.5}>
|
|
66
|
-
<Typography fontWeight={500} noWrap variant={sizeVariants[size]} fontSize={sizeFontSize[size]}>
|
|
67
|
-
<small>
|
|
68
|
-
<strong>{title}</strong>
|
|
69
|
-
</small>
|
|
70
|
-
</Typography>
|
|
71
|
-
{tip
|
|
72
|
-
? (
|
|
73
|
-
<QuickTipButton style={{ fontSize: quickTipSize }} color="inherit" title={title ?? ''}>
|
|
74
|
-
{tip}
|
|
75
|
-
</QuickTipButton>
|
|
76
|
-
)
|
|
77
|
-
: null}
|
|
78
|
-
</FlexRow>
|
|
79
|
-
{more}
|
|
80
|
-
</FlexRow>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import { PropertyValue } from './Value.tsx'
|
|
5
|
-
|
|
6
|
-
const StorybookEntry = {
|
|
7
|
-
argTypes: {},
|
|
8
|
-
component: PropertyValue,
|
|
9
|
-
parameters: { docs: { page: null } },
|
|
10
|
-
title: 'property/Value',
|
|
11
|
-
} as Meta<typeof PropertyValue>
|
|
12
|
-
|
|
13
|
-
const Template: StoryFn<typeof PropertyValue> = args => <PropertyValue {...args}></PropertyValue>
|
|
14
|
-
|
|
15
|
-
const Default = Template.bind({})
|
|
16
|
-
Default.args = {}
|
|
17
|
-
|
|
18
|
-
const WithData = Template.bind({})
|
|
19
|
-
|
|
20
|
-
WithData.args = {}
|
|
21
|
-
|
|
22
|
-
export { Default, WithData }
|
|
23
|
-
|
|
24
|
-
export default StorybookEntry
|
package/src/components/Value.tsx
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { TypographyVariant } from '@mui/material'
|
|
2
|
-
import type { EllipsizeBoxProps } from '@xyo-network/react-shared'
|
|
3
|
-
import { EllipsizeBox } from '@xyo-network/react-shared'
|
|
4
|
-
import React from 'react'
|
|
5
|
-
|
|
6
|
-
export interface PropertyValueProps extends EllipsizeBoxProps {
|
|
7
|
-
typographyVariant?: TypographyVariant
|
|
8
|
-
value?: string | number | boolean | null
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const PropertyValue = ({
|
|
12
|
-
ref, typographyVariant = 'body1', value, ...props
|
|
13
|
-
}: PropertyValueProps) => {
|
|
14
|
-
return value === undefined
|
|
15
|
-
? null
|
|
16
|
-
: (
|
|
17
|
-
<EllipsizeBox
|
|
18
|
-
typographyProps={{
|
|
19
|
-
component: undefined, title: value?.toString(), variant: typographyVariant,
|
|
20
|
-
}}
|
|
21
|
-
width="100%"
|
|
22
|
-
ref={ref}
|
|
23
|
-
{...props}
|
|
24
|
-
>
|
|
25
|
-
{value}
|
|
26
|
-
</EllipsizeBox>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
PropertyValue.displayName = 'PropertyValue'
|
package/src/components/index.ts
DELETED
package/src/global.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@mui/material/themeCssVarsAugmentation'
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components/index.ts'
|