@xyo-network/react-address-render 2.53.0 → 2.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/RenderRowBox.js +1 -1
- package/dist/cjs/components/RenderRowBox.js.map +1 -1
- package/dist/cjs/components/favorite/FavoriteIconButton.js +1 -1
- package/dist/cjs/components/favorite/FavoriteIconButton.js.map +1 -1
- package/dist/docs.json +6470 -1529
- package/dist/esm/components/RenderRowBox.js +2 -2
- package/dist/esm/components/RenderRowBox.js.map +1 -1
- package/dist/esm/components/favorite/FavoriteIconButton.js +2 -2
- package/dist/esm/components/favorite/FavoriteIconButton.js.map +1 -1
- package/package.json +6 -6
- package/src/components/RenderRowBox.stories.tsx +2 -2
- package/src/components/RenderRowBox.tsx +2 -2
- package/src/components/favorite/FavoriteIconButton.tsx +2 -2
|
@@ -2,14 +2,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { ListItemIcon, ListItemText, useTheme } from '@mui/material';
|
|
3
3
|
import { FlexGrowRow } from '@xylabs/react-flexbox';
|
|
4
4
|
import { Identicon } from '@xylabs/react-identicon';
|
|
5
|
-
import {
|
|
5
|
+
import { useEvent } from '@xyo-network/react-event';
|
|
6
6
|
import { EllipsizeBox, useShareForwardedRef } from '@xyo-network/react-shared';
|
|
7
7
|
import { forwardRef } from 'react';
|
|
8
8
|
import { FavoriteIconButton } from './favorite';
|
|
9
9
|
export const AddressRenderRowBox = forwardRef(({ address, children, favorite: favoriteProp = false, iconOnly, iconSize = 24, icons, name, showFavorite = false, ...props }, ref) => {
|
|
10
10
|
const theme = useTheme();
|
|
11
11
|
const sharedRef = useShareForwardedRef(ref);
|
|
12
|
-
const [elementRef, dispatch] =
|
|
12
|
+
const [elementRef, dispatch] = useEvent(undefined, sharedRef);
|
|
13
13
|
const handleClickedAddress = () => (address ? dispatch('address', 'click', address) : undefined);
|
|
14
14
|
return (_jsxs(FlexGrowRow, { gap: 2, justifyContent: "flex-start", ref: elementRef, onClick: handleClickedAddress, ...props, children: [icons && address ? (_jsx(ListItemIcon, { sx: { minWidth: 0 }, children: _jsx(Identicon, { size: iconSize, value: address }) })) : null, iconOnly ? null : (_jsx(ListItemText, { sx: { my: 0 }, children: _jsx(EllipsizeBox, { ellipsisPosition: 'end', width: "100%", typographyProps: { fontSize: theme.typography.body1.fontSize }, children: name ?? address }) })), children, showFavorite && address ? (_jsx(FavoriteIconButton, { name: name, size: 'small', value: address, valueType: 'address', favorite: favoriteProp })) : null] }));
|
|
15
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderRowBox.js","sourceRoot":"","sources":["../../../src/components/RenderRowBox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACpE,OAAO,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAEnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"RenderRowBox.js","sourceRoot":"","sources":["../../../src/components/RenderRowBox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACpE,OAAO,EAAgB,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAc/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAC3C,CAAC,EAAE,OAAO,EAAE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AY,IAAI,OAAO,CAAC,CAAC,CAAC,CACzB,KAAC,kBAAkB,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,GAAI,CAChH,CAAC,CAAC,CAAC,IAAI,IACI,CACf,CAAA;AACH,CAAC,CACF,CAAA;AAED,mBAAmB,CAAC,WAAW,GAAG,qBAAqB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { IconButton, styled } from '@mui/material';
|
|
3
|
-
import {
|
|
3
|
+
import { useEvent } from '@xyo-network/react-event';
|
|
4
4
|
import { useShareForwardedRef } from '@xyo-network/react-shared';
|
|
5
5
|
import { forwardRef, useEffect, useRef, useState } from 'react';
|
|
6
6
|
import { generateFavoriteEvent } from '../lib';
|
|
@@ -14,7 +14,7 @@ export const FavoriteIconButton = forwardRef(({ children, favorite: favoriteProp
|
|
|
14
14
|
setFavorite(favoriteProp);
|
|
15
15
|
}, [favoriteProp]);
|
|
16
16
|
const sharedRef = useShareForwardedRef(ref);
|
|
17
|
-
const [buttonRef, dispatch] =
|
|
17
|
+
const [buttonRef, dispatch] = useEvent(undefined, sharedRef);
|
|
18
18
|
const onConfirmFavorite = (name, newFavoriteState) => {
|
|
19
19
|
const favoriteEvent = generateFavoriteEvent(!!newFavoriteState, valueType, value, name);
|
|
20
20
|
dispatch('address', 'favorite', JSON.stringify(favoriteEvent));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoriteIconButton.js","sourceRoot":"","sources":["../../../../src/components/favorite/FavoriteIconButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,EAAE,MAAM,eAAe,CAAA;AAEnE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"FavoriteIconButton.js","sourceRoot":"","sources":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MAAM,mBAAmB,GAAG,MAAM,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9F,UAAU,EAAE,CAAC;IACb,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;CAC7B,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"@xylabs/react-flexbox": "^2.17.3",
|
|
14
14
|
"@xylabs/react-identicon": "^2.17.3",
|
|
15
15
|
"@xylabs/react-shared": "^2.17.3",
|
|
16
|
-
"@xyo-network/react-event": "^2.
|
|
17
|
-
"@xyo-network/react-shared": "^2.
|
|
16
|
+
"@xyo-network/react-event": "^2.54.1",
|
|
17
|
+
"@xyo-network/react-shared": "^2.54.1"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@mui/icons-material": "^5",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"description": "Common React library for all XYO projects that use React",
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@storybook/react": "^7.0.21",
|
|
31
|
-
"@xylabs/ts-scripts-yarn3": "^2.17.
|
|
32
|
-
"@xylabs/tsconfig-react": "^2.17.
|
|
31
|
+
"@xylabs/ts-scripts-yarn3": "^2.17.14",
|
|
32
|
+
"@xylabs/tsconfig-react": "^2.17.14",
|
|
33
33
|
"@xyo-network/account": "^2.62.1",
|
|
34
|
-
"@xyo-network/react-event": "^2.
|
|
34
|
+
"@xyo-network/react-event": "^2.54.1",
|
|
35
35
|
"typescript": "^5.1.3"
|
|
36
36
|
},
|
|
37
37
|
"browser": "dist/esm/index.js",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
},
|
|
77
77
|
"sideEffects": false,
|
|
78
78
|
"types": "dist/types/index.d.ts",
|
|
79
|
-
"version": "2.
|
|
79
|
+
"version": "2.54.1"
|
|
80
80
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryFn } from '@storybook/react'
|
|
2
2
|
import { Account } from '@xyo-network/account'
|
|
3
|
-
import {
|
|
3
|
+
import { useEvent } from '@xyo-network/react-event'
|
|
4
4
|
import { useState } from 'react'
|
|
5
5
|
|
|
6
6
|
import { FavoriteItemEvent } from './lib'
|
|
@@ -20,7 +20,7 @@ const StorybookEntry = {
|
|
|
20
20
|
} as Meta<typeof AddressRenderRowBox>
|
|
21
21
|
|
|
22
22
|
const Template: StoryFn<typeof AddressRenderRowBox> = (args) => {
|
|
23
|
-
const [ref] =
|
|
23
|
+
const [ref] = useEvent<HTMLLIElement>((noun, verb, data) => {
|
|
24
24
|
console.log(`${noun}|${verb}|${data}`)
|
|
25
25
|
const parsedEvent = JSON.parse(data ?? '') as FavoriteItemEvent
|
|
26
26
|
if (parsedEvent.favorite) {
|
|
@@ -2,7 +2,7 @@ import { ListItemIcon, ListItemText, useTheme } from '@mui/material'
|
|
|
2
2
|
import { FlexBoxProps, FlexGrowRow } from '@xylabs/react-flexbox'
|
|
3
3
|
import { Identicon } from '@xylabs/react-identicon'
|
|
4
4
|
import { WithChildren } from '@xylabs/react-shared'
|
|
5
|
-
import {
|
|
5
|
+
import { useEvent } from '@xyo-network/react-event'
|
|
6
6
|
import { EllipsizeBox, useShareForwardedRef } from '@xyo-network/react-shared'
|
|
7
7
|
import { forwardRef } from 'react'
|
|
8
8
|
|
|
@@ -25,7 +25,7 @@ export const AddressRenderRowBox = forwardRef<HTMLElement, AddressRenderRowBoxPr
|
|
|
25
25
|
const theme = useTheme()
|
|
26
26
|
|
|
27
27
|
const sharedRef = useShareForwardedRef(ref)
|
|
28
|
-
const [elementRef, dispatch] =
|
|
28
|
+
const [elementRef, dispatch] = useEvent(undefined, sharedRef)
|
|
29
29
|
|
|
30
30
|
const handleClickedAddress = () => (address ? dispatch('address', 'click', address) : undefined)
|
|
31
31
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IconButton, IconButtonProps, styled } from '@mui/material'
|
|
2
2
|
import { WithChildren } from '@xylabs/react-shared'
|
|
3
|
-
import {
|
|
3
|
+
import { useEvent } from '@xyo-network/react-event'
|
|
4
4
|
import { useShareForwardedRef } from '@xyo-network/react-shared'
|
|
5
5
|
import { forwardRef, useEffect, useRef, useState } from 'react'
|
|
6
6
|
|
|
@@ -26,7 +26,7 @@ export const FavoriteIconButton = forwardRef<HTMLButtonElement, FavoriteIconButt
|
|
|
26
26
|
}, [favoriteProp])
|
|
27
27
|
|
|
28
28
|
const sharedRef = useShareForwardedRef(ref)
|
|
29
|
-
const [buttonRef, dispatch] =
|
|
29
|
+
const [buttonRef, dispatch] = useEvent(undefined, sharedRef)
|
|
30
30
|
|
|
31
31
|
const onConfirmFavorite = (name?: string, newFavoriteState?: boolean) => {
|
|
32
32
|
const favoriteEvent = generateFavoriteEvent(!!newFavoriteState, valueType, value, name)
|