@xyo-network/react-address-render 3.0.2 → 3.0.4

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 (33) hide show
  1. package/dist/browser/components/RenderRowBox.d.ts +14 -0
  2. package/dist/browser/components/RenderRowBox.d.ts.map +1 -0
  3. package/dist/browser/components/favorite/FavoriteIconButton.d.ts +12 -0
  4. package/dist/browser/components/favorite/FavoriteIconButton.d.ts.map +1 -0
  5. package/dist/browser/components/favorite/FavoriteToggleSVG.d.ts +5 -0
  6. package/dist/browser/components/favorite/FavoriteToggleSVG.d.ts.map +1 -0
  7. package/dist/browser/components/favorite/Popper.d.ts +12 -0
  8. package/dist/browser/components/favorite/Popper.d.ts.map +1 -0
  9. package/dist/browser/components/favorite/PopperButtonGroup.d.ts +9 -0
  10. package/dist/browser/components/favorite/PopperButtonGroup.d.ts.map +1 -0
  11. package/dist/browser/components/favorite/index.d.ts +2 -0
  12. package/dist/browser/components/favorite/index.d.ts.map +1 -0
  13. package/dist/browser/components/favorite/lib/PopperId.d.ts +2 -0
  14. package/dist/browser/components/favorite/lib/PopperId.d.ts.map +1 -0
  15. package/dist/browser/components/favorite/lib/index.d.ts +2 -0
  16. package/dist/browser/components/favorite/lib/index.d.ts.map +1 -0
  17. package/dist/browser/components/index.d.ts +4 -0
  18. package/dist/browser/components/index.d.ts.map +1 -0
  19. package/dist/browser/components/lib/FavoriteItemEvent.d.ts +9 -0
  20. package/dist/browser/components/lib/FavoriteItemEvent.d.ts.map +1 -0
  21. package/dist/browser/components/lib/index.d.ts +2 -0
  22. package/dist/browser/components/lib/index.d.ts.map +1 -0
  23. package/dist/browser/index.d.ts +2 -35
  24. package/dist/browser/index.d.ts.map +1 -0
  25. package/dist/browser/index.mjs +4 -9
  26. package/dist/browser/index.mjs.map +1 -1
  27. package/package.json +54 -48
  28. package/src/components/RenderRowBox.stories.tsx +5 -9
  29. package/src/components/RenderRowBox.tsx +3 -1
  30. package/src/components/favorite/FavoriteIconButton.tsx +6 -2
  31. package/src/components/favorite/Popper.tsx +5 -6
  32. package/src/components/favorite/PopperButtonGroup.tsx +3 -1
  33. package/xy.config.ts +1 -3
@@ -0,0 +1,14 @@
1
+ import type { FlexBoxProps } from '@xylabs/react-flexbox';
2
+ import React from 'react';
3
+ export interface AddressRenderRowBoxProps extends FlexBoxProps {
4
+ address?: string | null;
5
+ disableSharedRef?: boolean;
6
+ favorite?: boolean;
7
+ iconOnly?: boolean;
8
+ iconSize?: number;
9
+ icons?: boolean;
10
+ name?: string;
11
+ showFavorite?: boolean;
12
+ }
13
+ export declare const AddressRenderRowBox: React.ForwardRefExoticComponent<AddressRenderRowBoxProps & React.RefAttributes<HTMLElement>>;
14
+ //# sourceMappingURL=RenderRowBox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderRowBox.d.ts","sourceRoot":"","sources":["../../../src/components/RenderRowBox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAKzD,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,MAAM,WAAW,wBAAyB,SAAQ,YAAY;IAC5D,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,eAAO,MAAM,mBAAmB,8FAkD/B,CAAA"}
@@ -0,0 +1,12 @@
1
+ import type { IconButtonProps } from '@mui/material';
2
+ import type { WithChildren } from '@xylabs/react-shared';
3
+ import React from 'react';
4
+ import type { FavoriteItemEvent } from '../lib/index.ts';
5
+ export interface FavoriteIconButtonProps extends WithChildren, IconButtonProps {
6
+ favorite?: FavoriteItemEvent['favorite'];
7
+ name?: FavoriteItemEvent['name'];
8
+ value?: string;
9
+ valueType?: FavoriteItemEvent['favoriteType'];
10
+ }
11
+ export declare const FavoriteIconButton: React.ForwardRefExoticComponent<Omit<FavoriteIconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
12
+ //# sourceMappingURL=FavoriteIconButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FavoriteIconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/favorite/FavoriteIconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGxD,OAAO,KAEN,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAMxD,MAAM,WAAW,uBAAwB,SAAQ,YAAY,EAAE,eAAe;IAC5E,QAAQ,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAA;IACxC,IAAI,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAA;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAA;CAC9C;AAED,eAAO,MAAM,kBAAkB,gHAuD9B,CAAA"}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const FavoriteToggleSVG: React.FC<{
3
+ favorite?: boolean;
4
+ }>;
5
+ //# sourceMappingURL=FavoriteToggleSVG.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FavoriteToggleSVG.d.ts","sourceRoot":"","sources":["../../../../src/components/favorite/FavoriteToggleSVG.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAM9D,CAAA"}
@@ -0,0 +1,12 @@
1
+ import type { PopperProps } from '@mui/material';
2
+ import type { RefObject } from 'react';
3
+ import React from 'react';
4
+ export interface FavoritePopperProps extends PopperProps {
5
+ favorite?: boolean;
6
+ favoriteRef?: RefObject<HTMLElement>;
7
+ name?: string;
8
+ onClickAway?: (event: MouseEvent | TouchEvent) => void;
9
+ onConfirmFavorite?: (name?: string, newFavoriteState?: boolean) => void;
10
+ }
11
+ export declare const FavoritePopper: React.ForwardRefExoticComponent<Omit<FavoritePopperProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
12
+ //# sourceMappingURL=Popper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popper.d.ts","sourceRoot":"","sources":["../../../../src/components/favorite/Popper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAIhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAA+B,MAAM,OAAO,CAAA;AAKnD,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAA;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,KAAK,IAAI,CAAA;IACtD,iBAAiB,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;CACxE;AACD,eAAO,MAAM,cAAc,yGA8C1B,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { ButtonGroupProps } from '@mui/material';
2
+ import React from 'react';
3
+ export interface FavoritePopperProps extends ButtonGroupProps {
4
+ favorite?: boolean;
5
+ name?: string;
6
+ onConfirmFavorite?: (name?: string, newFavoriteState?: boolean) => void;
7
+ }
8
+ export declare const PopperButtonGroup: React.FC<FavoritePopperProps>;
9
+ //# sourceMappingURL=PopperButtonGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PopperButtonGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/favorite/PopperButtonGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iBAAiB,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;CACxE;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA+B3D,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './FavoriteIconButton.tsx';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/favorite/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const popperId = "favorite-popper";
2
+ //# sourceMappingURL=PopperId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PopperId.d.ts","sourceRoot":"","sources":["../../../../../src/components/favorite/lib/PopperId.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,oBAAoB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './PopperId.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/favorite/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './favorite/index.ts';
2
+ export * from './lib/index.ts';
3
+ export * from './RenderRowBox.tsx';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,9 @@
1
+ export interface FavoriteItemEvent {
2
+ favorite?: boolean;
3
+ favoriteType?: FavoriteType;
4
+ favoriteValue?: string;
5
+ name?: string;
6
+ }
7
+ export type FavoriteType = 'address' | 'schema' | 'hash';
8
+ export declare const generateFavoriteEvent: (favorite?: boolean, favoriteType?: FavoriteType, favoriteValue?: string, name?: string) => FavoriteItemEvent;
9
+ //# sourceMappingURL=FavoriteItemEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FavoriteItemEvent.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/FavoriteItemEvent.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAA;AAExD,eAAO,MAAM,qBAAqB,cAAe,OAAO,iBAAiB,YAAY,kBAAkB,MAAM,SAAS,MAAM,KAAG,iBAK7H,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './FavoriteItemEvent.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
@@ -1,35 +1,2 @@
1
- import { IconButtonProps } from '@mui/material';
2
- import { WithChildren } from '@xylabs/react-shared';
3
- import React from 'react';
4
- import { FlexBoxProps } from '@xylabs/react-flexbox';
5
-
6
- interface FavoriteItemEvent {
7
- favorite?: boolean;
8
- favoriteType?: FavoriteType;
9
- favoriteValue?: string;
10
- name?: string;
11
- }
12
- type FavoriteType = 'address' | 'schema' | 'hash';
13
- declare const generateFavoriteEvent: (favorite?: boolean, favoriteType?: FavoriteType, favoriteValue?: string, name?: string) => FavoriteItemEvent;
14
-
15
- interface FavoriteIconButtonProps extends WithChildren, IconButtonProps {
16
- favorite?: FavoriteItemEvent['favorite'];
17
- name?: FavoriteItemEvent['name'];
18
- value?: string;
19
- valueType?: FavoriteItemEvent['favoriteType'];
20
- }
21
- declare const FavoriteIconButton: React.ForwardRefExoticComponent<Omit<FavoriteIconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
22
-
23
- interface AddressRenderRowBoxProps extends FlexBoxProps {
24
- address?: string | null;
25
- disableSharedRef?: boolean;
26
- favorite?: boolean;
27
- iconOnly?: boolean;
28
- iconSize?: number;
29
- icons?: boolean;
30
- name?: string;
31
- showFavorite?: boolean;
32
- }
33
- declare const AddressRenderRowBox: React.ForwardRefExoticComponent<AddressRenderRowBoxProps & React.RefAttributes<HTMLElement>>;
34
-
35
- export { AddressRenderRowBox, type AddressRenderRowBoxProps, FavoriteIconButton, type FavoriteIconButtonProps, type FavoriteItemEvent, type FavoriteType, generateFavoriteEvent };
1
+ export * from './components/index.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
@@ -5,7 +5,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
5
5
  import { IconButton, styled as styled2 } from "@mui/material";
6
6
  import { useEvent } from "@xyo-network/react-event";
7
7
  import { useShareForwardedRef } from "@xyo-network/react-shared";
8
- import React4, { forwardRef as forwardRef2, useEffect as useEffect2, useRef, useState as useState2 } from "react";
8
+ import React4, { forwardRef as forwardRef2, useEffect, useRef, useState as useState2 } from "react";
9
9
 
10
10
  // src/components/lib/FavoriteItemEvent.ts
11
11
  var generateFavoriteEvent = /* @__PURE__ */ __name((favorite, favoriteType, favoriteValue, name) => ({
@@ -33,7 +33,7 @@ var popperId = "favorite-popper";
33
33
 
34
34
  // src/components/favorite/Popper.tsx
35
35
  import { Card, CardContent, ClickAwayListener, Fade, Popper, styled, TextField } from "@mui/material";
36
- import React3, { forwardRef, useEffect, useState } from "react";
36
+ import React3, { forwardRef, useState } from "react";
37
37
 
38
38
  // src/components/favorite/PopperButtonGroup.tsx
39
39
  import { Delete as DeleteIcon, Star as StarIcon2 } from "@mui/icons-material";
@@ -59,12 +59,7 @@ var PopperButtonGroup = /* @__PURE__ */ __name(({ name, onConfirmFavorite, favor
59
59
 
60
60
  // src/components/favorite/Popper.tsx
61
61
  var FavoritePopper = /* @__PURE__ */ forwardRef(({ name: nameProp, favorite, favoriteRef, onClickAway, onConfirmFavorite, ...props }, ref) => {
62
- const [name, setName] = useState(nameProp);
63
- useEffect(() => {
64
- setName(nameProp);
65
- }, [
66
- nameProp
67
- ]);
62
+ const [name, setName] = useState(() => nameProp);
68
63
  return /* @__PURE__ */ React3.createElement(ClickAwayListener, {
69
64
  onClickAway: onClickAway ?? (() => null)
70
65
  }, /* @__PURE__ */ React3.createElement(PopperStyled, {
@@ -107,7 +102,7 @@ var PopperStyled = styled(Popper, {
107
102
  var FavoriteIconButton = /* @__PURE__ */ forwardRef2(({ children, favorite: favoriteProp, name, valueType, value, ...props }, ref) => {
108
103
  const [openPopper, setOpenPopper] = useState2(false);
109
104
  const [favorite, setFavorite] = useState2(favoriteProp);
110
- useEffect2(() => {
105
+ useEffect(() => {
111
106
  setFavorite(favoriteProp);
112
107
  }, [
113
108
  favoriteProp
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/favorite/FavoriteIconButton.tsx","../../src/components/lib/FavoriteItemEvent.ts","../../src/components/favorite/FavoriteToggleSVG.tsx","../../src/components/favorite/lib/PopperId.ts","../../src/components/favorite/Popper.tsx","../../src/components/favorite/PopperButtonGroup.tsx","../../src/components/RenderRowBox.tsx"],"sourcesContent":["import type { IconButtonProps } from '@mui/material'\nimport { IconButton, styled } from '@mui/material'\nimport type { WithChildren } from '@xylabs/react-shared'\nimport { useEvent } from '@xyo-network/react-event'\nimport { useShareForwardedRef } from '@xyo-network/react-shared'\nimport React, { forwardRef, useEffect, useRef, useState } from 'react'\n\nimport type { FavoriteItemEvent } from '../lib/index.ts'\nimport { generateFavoriteEvent } from '../lib/index.ts'\nimport { FavoriteToggleSVG } from './FavoriteToggleSVG.tsx'\nimport { popperId } from './lib/index.ts'\nimport { FavoritePopper } from './Popper.tsx'\n\nexport interface FavoriteIconButtonProps extends WithChildren, IconButtonProps {\n favorite?: FavoriteItemEvent['favorite']\n name?: FavoriteItemEvent['name']\n value?: string\n valueType?: FavoriteItemEvent['favoriteType']\n}\n\nexport const FavoriteIconButton = forwardRef<HTMLButtonElement, FavoriteIconButtonProps>(\n ({ children, favorite: favoriteProp, name, valueType, value, ...props }, ref) => {\n const [openPopper, setOpenPopper] = useState(false)\n\n const [favorite, setFavorite] = useState(favoriteProp)\n useEffect(() => {\n setFavorite(favoriteProp)\n }, [favoriteProp])\n\n const sharedRef = useShareForwardedRef(ref)\n const [buttonRef, dispatch] = useEvent(undefined, sharedRef)\n\n const onConfirmFavorite = (name?: string, newFavoriteState?: boolean) => {\n const favoriteEvent = generateFavoriteEvent(!!newFavoriteState, valueType, value, name)\n dispatch('address', 'favorite', JSON.stringify(favoriteEvent))\n setFavorite(newFavoriteState)\n setOpenPopper(false)\n }\n\n const starRef = useRef<HTMLSpanElement>(null)\n\n return (\n <IconButtonCondensed\n aria-describedby={popperId}\n ref={buttonRef}\n onClick={(event) => {\n event.stopPropagation()\n setOpenPopper(!openPopper)\n }}\n onTouchStart={(event) => {\n event.stopPropagation()\n setOpenPopper(!openPopper)\n }}\n onMouseDown={e => e.stopPropagation()}\n sx={{ lineHeight: 0, p: 0.25 }}\n {...props}\n >\n <span ref={starRef}>\n <FavoriteToggleSVG favorite={favorite} />\n </span>\n <FavoritePopper\n sx={{ zIndex: 1301 }}\n name={name}\n favorite={favorite}\n favoriteRef={starRef}\n open={openPopper}\n onConfirmFavorite={onConfirmFavorite}\n onClickAway={() => setOpenPopper(false)}\n />\n {children}\n </IconButtonCondensed>\n )\n },\n)\n\nFavoriteIconButton.displayName = 'FavoriteIconButton'\n\nconst IconButtonCondensed = styled(IconButton, { name: 'IconButtonCondensed' })(({ theme }) => ({\n lineHeight: 0,\n padding: theme.spacing(0.25),\n}))\n","export interface FavoriteItemEvent {\n favorite?: boolean\n favoriteType?: FavoriteType\n favoriteValue?: string\n name?: string\n}\n\nexport type FavoriteType = 'address' | 'schema' | 'hash'\n\nexport const generateFavoriteEvent = (favorite?: boolean, favoriteType?: FavoriteType, favoriteValue?: string, name?: string): FavoriteItemEvent => ({\n favorite: !!favorite,\n favoriteType,\n favoriteValue,\n name,\n})\n","import { Star as StarIcon, StarBorder as StarBorderIcon } from '@mui/icons-material'\nimport React from 'react'\n\nexport const FavoriteToggleSVG: React.FC<{ favorite?: boolean }> = ({ favorite }) => (\n <>\n {favorite\n ? <StarIcon className=\"favorite-icon\" component=\"svg\" color=\"secondary\" fontSize=\"small\" />\n : <StarBorderIcon className=\"favorite-icon\" fontSize=\"small\" />}\n </>\n)\n","export const popperId = 'favorite-popper'\n","import type { PopperProps } from '@mui/material'\nimport { Card, CardContent, ClickAwayListener, Fade, Popper, styled, TextField } from '@mui/material'\nimport type { RefObject } from 'react'\nimport React, { forwardRef, useEffect, useState } from 'react'\n\nimport { popperId } from './lib/index.ts'\nimport { PopperButtonGroup } from './PopperButtonGroup.tsx'\n\nexport interface FavoritePopperProps extends PopperProps {\n favorite?: boolean\n favoriteRef?: RefObject<HTMLElement>\n name?: string\n onClickAway?: (event: MouseEvent | TouchEvent) => void\n onConfirmFavorite?: (name?: string, newFavoriteState?: boolean) => void\n}\nexport const FavoritePopper = forwardRef<HTMLDivElement, FavoritePopperProps>(\n (\n {\n name: nameProp,\n favorite,\n favoriteRef,\n onClickAway,\n onConfirmFavorite,\n ...props\n },\n ref,\n ) => {\n const [name, setName] = useState(nameProp)\n useEffect(() => {\n setName(nameProp)\n }, [nameProp])\n\n return (\n <ClickAwayListener onClickAway={onClickAway ?? (() => null)}>\n <PopperStyled\n id={popperId}\n anchorEl={favoriteRef?.current}\n onClick={e => e.stopPropagation()}\n onTouchStart={e => e.stopPropagation()}\n transition\n ref={ref}\n {...props}\n >\n {({ TransitionProps }) => (\n <Fade {...TransitionProps} timeout={350}>\n <Card>\n <CardContent sx={{ display: 'flex', gap: 1 }}>\n <TextField\n autoFocus\n label=\"Favorite Name\"\n placeholder=\"optional\"\n size=\"small\"\n value={name ?? ''}\n onChange={e => setName(e.target.value)}\n />\n <PopperButtonGroup favorite={favorite} onConfirmFavorite={onConfirmFavorite} name={name} />\n </CardContent>\n </Card>\n </Fade>\n )}\n </PopperStyled>\n </ClickAwayListener>\n )\n },\n)\n\nFavoritePopper.displayName = 'FavoritePopper'\n\n// Ensure the popper is over all other mui portal elements\nconst PopperStyled = styled(Popper, { name: 'PopperStyled' })(() => ({ zIndex: 9999 }))\n","import { Delete as DeleteIcon, Star as StarIcon } from '@mui/icons-material'\nimport type { ButtonGroupProps } from '@mui/material'\nimport { Button, ButtonGroup } from '@mui/material'\nimport React from 'react'\n\nexport interface FavoritePopperProps extends ButtonGroupProps {\n favorite?: boolean\n name?: string\n onConfirmFavorite?: (name?: string, newFavoriteState?: boolean) => void\n}\n\nexport const PopperButtonGroup: React.FC<FavoritePopperProps> = ({ name, onConfirmFavorite, favorite, ...props }) => {\n return (\n <ButtonGroup {...props}>\n <Button\n title=\"Save Favorite\"\n variant=\"contained\"\n onClick={(e) => {\n e.stopPropagation()\n onConfirmFavorite?.(name, true)\n }}\n >\n <StarIcon />\n </Button>\n {favorite\n ? (\n <Button\n title=\"Remove Favorite\"\n variant=\"contained\"\n onClick={(e) => {\n e.stopPropagation()\n onConfirmFavorite?.(name, false)\n }}\n >\n <DeleteIcon />\n </Button>\n )\n : null}\n </ButtonGroup>\n )\n}\n","import { ListItemIcon, useTheme } from '@mui/material'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { Identicon } from '@xylabs/react-identicon'\nimport { useEvent } from '@xyo-network/react-event'\nimport { EllipsizeBox, useShareForwardedRef } from '@xyo-network/react-shared'\nimport React, { forwardRef } from 'react'\n\nimport { FavoriteIconButton } from './favorite/index.ts'\n\nexport interface AddressRenderRowBoxProps extends FlexBoxProps {\n address?: string | null\n disableSharedRef?: boolean\n favorite?: boolean\n iconOnly?: boolean\n iconSize?: number\n icons?: boolean\n name?: string\n showFavorite?: boolean\n}\n\nexport const AddressRenderRowBox = forwardRef<HTMLElement, AddressRenderRowBoxProps>(\n (\n { address, children, disableSharedRef, favorite: favoriteProp = false, iconOnly, iconSize = 24, icons, name, showFavorite = false, ...props },\n ref,\n ) => {\n const theme = useTheme()\n\n const sharedRef = useShareForwardedRef(ref)\n const [elementRef, dispatch] = useEvent(undefined, sharedRef)\n\n return (\n <FlexRow\n gap={2}\n justifyContent=\"flex-start\"\n ref={elementRef}\n onClick={() => {\n if (address) {\n dispatch('address', 'click', address)\n }\n }}\n {...props}\n >\n {icons && address\n ? (\n <ListItemIcon sx={{ minWidth: 0 }}>\n <Identicon size={iconSize} value={address} />\n </ListItemIcon>\n )\n : null}\n {iconOnly\n ? null\n : (\n <EllipsizeBox\n disableSharedRef={disableSharedRef}\n ellipsisPosition=\"end\"\n width=\"100%\"\n typographyProps={{ fontSize: theme.typography.body1.fontSize }}\n >\n {name ?? address}\n </EllipsizeBox>\n )}\n {children}\n {showFavorite && address\n ? <FavoriteIconButton name={name} size=\"small\" value={address} valueType=\"address\" favorite={favoriteProp} />\n : null}\n </FlexRow>\n )\n },\n)\n\nAddressRenderRowBox.displayName = 'AddressRenderRowBox'\n"],"mappings":";;;;AACA,SAASA,YAAYC,UAAAA,eAAc;AAEnC,SAASC,gBAAgB;AACzB,SAASC,4BAA4B;AACrC,OAAOC,UAASC,cAAAA,aAAYC,aAAAA,YAAWC,QAAQC,YAAAA,iBAAgB;;;ACIxD,IAAMC,wBAAwB,wBAACC,UAAoBC,cAA6BC,eAAwBC,UAAsC;EACnJH,UAAU,CAAC,CAACA;EACZC;EACAC;EACAC;AACF,IALqC;;;ACTrC,SAASC,QAAQC,UAAUC,cAAcC,sBAAsB;AAC/D,OAAOC,WAAW;AAEX,IAAMC,oBAAsD,wBAAC,EAAEC,SAAQ,MAC5E,sBAAA,cAAA,MAAA,UAAA,MACGA,WACG,sBAAA,cAACC,UAAAA;EAASC,WAAU;EAAgBC,WAAU;EAAMC,OAAM;EAAYC,UAAS;KAC/E,sBAAA,cAACC,gBAAAA;EAAeJ,WAAU;EAAgBG,UAAS;KAJQ;;;ACH5D,IAAME,WAAW;;;ACCxB,SAASC,MAAMC,aAAaC,mBAAmBC,MAAMC,QAAQC,QAAQC,iBAAiB;AAEtF,OAAOC,UAASC,YAAYC,WAAWC,gBAAgB;;;ACHvD,SAASC,UAAUC,YAAYC,QAAQC,iBAAgB;AAEvD,SAASC,QAAQC,mBAAmB;AACpC,OAAOC,YAAW;AAQX,IAAMC,oBAAmD,wBAAC,EAAEC,MAAMC,mBAAmBC,UAAU,GAAGC,MAAAA,MAAO;AAC9G,SACE,gBAAAC,OAAA,cAACC,aAAgBF,OACf,gBAAAC,OAAA,cAACE,QAAAA;IACCC,OAAM;IACNC,SAAQ;IACRC,SAAS,wBAACC,MAAAA;AACRA,QAAEC,gBAAe;AACjBV,0BAAoBD,MAAM,IAAA;IAC5B,GAHS;KAKT,gBAAAI,OAAA,cAACQ,WAAAA,IAAAA,CAAAA,GAEFV,WAE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AM;IACNC,iBAAiB;MAAEC,UAAUvB,MAAMwB,WAAWC,MAAMF;IAAS;KAE5D3B,QAAQR,OAAAA,GAGhBC,UACAQ,gBAAgBT,UACb,gBAAAoB,OAAA,cAACkB,oBAAAA;IAAmB9B;IAAYqB,MAAK;IAAQC,OAAO9B;IAASuC,WAAU;IAAUpC,UAAUC;OAC3F,IAAA;AAGV,CAAA;AAGFN,oBAAoB0C,cAAc;","names":["IconButton","styled","useEvent","useShareForwardedRef","React","forwardRef","useEffect","useRef","useState","generateFavoriteEvent","favorite","favoriteType","favoriteValue","name","Star","StarIcon","StarBorder","StarBorderIcon","React","FavoriteToggleSVG","favorite","StarIcon","className","component","color","fontSize","StarBorderIcon","popperId","Card","CardContent","ClickAwayListener","Fade","Popper","styled","TextField","React","forwardRef","useEffect","useState","Delete","DeleteIcon","Star","StarIcon","Button","ButtonGroup","React","PopperButtonGroup","name","onConfirmFavorite","favorite","props","React","ButtonGroup","Button","title","variant","onClick","e","stopPropagation","StarIcon","DeleteIcon","FavoritePopper","forwardRef","name","nameProp","favorite","favoriteRef","onClickAway","onConfirmFavorite","props","ref","setName","useState","useEffect","React","ClickAwayListener","PopperStyled","id","popperId","anchorEl","current","onClick","e","stopPropagation","onTouchStart","transition","TransitionProps","Fade","timeout","Card","CardContent","sx","display","gap","TextField","autoFocus","label","placeholder","size","value","onChange","target","PopperButtonGroup","displayName","styled","Popper","zIndex","FavoriteIconButton","forwardRef","children","favorite","favoriteProp","name","valueType","value","props","ref","openPopper","setOpenPopper","useState","setFavorite","useEffect","sharedRef","useShareForwardedRef","buttonRef","dispatch","useEvent","undefined","onConfirmFavorite","newFavoriteState","favoriteEvent","generateFavoriteEvent","JSON","stringify","starRef","useRef","React","IconButtonCondensed","aria-describedby","popperId","onClick","event","stopPropagation","onTouchStart","onMouseDown","e","sx","lineHeight","p","span","FavoriteToggleSVG","FavoritePopper","zIndex","favoriteRef","open","onClickAway","displayName","styled","IconButton","theme","padding","spacing","ListItemIcon","useTheme","FlexRow","Identicon","useEvent","EllipsizeBox","useShareForwardedRef","React","forwardRef","AddressRenderRowBox","forwardRef","address","children","disableSharedRef","favorite","favoriteProp","iconOnly","iconSize","icons","name","showFavorite","props","ref","theme","useTheme","sharedRef","useShareForwardedRef","elementRef","dispatch","useEvent","undefined","React","FlexRow","gap","justifyContent","onClick","ListItemIcon","sx","minWidth","Identicon","size","value","EllipsizeBox","ellipsisPosition","width","typographyProps","fontSize","typography","body1","FavoriteIconButton","valueType","displayName"]}
1
+ {"version":3,"sources":["../../src/components/favorite/FavoriteIconButton.tsx","../../src/components/lib/FavoriteItemEvent.ts","../../src/components/favorite/FavoriteToggleSVG.tsx","../../src/components/favorite/lib/PopperId.ts","../../src/components/favorite/Popper.tsx","../../src/components/favorite/PopperButtonGroup.tsx","../../src/components/RenderRowBox.tsx"],"sourcesContent":["import type { IconButtonProps } from '@mui/material'\nimport { IconButton, styled } from '@mui/material'\nimport type { WithChildren } from '@xylabs/react-shared'\nimport { useEvent } from '@xyo-network/react-event'\nimport { useShareForwardedRef } from '@xyo-network/react-shared'\nimport React, {\n forwardRef, useEffect, useRef, useState,\n} from 'react'\n\nimport type { FavoriteItemEvent } from '../lib/index.ts'\nimport { generateFavoriteEvent } from '../lib/index.ts'\nimport { FavoriteToggleSVG } from './FavoriteToggleSVG.tsx'\nimport { popperId } from './lib/index.ts'\nimport { FavoritePopper } from './Popper.tsx'\n\nexport interface FavoriteIconButtonProps extends WithChildren, IconButtonProps {\n favorite?: FavoriteItemEvent['favorite']\n name?: FavoriteItemEvent['name']\n value?: string\n valueType?: FavoriteItemEvent['favoriteType']\n}\n\nexport const FavoriteIconButton = forwardRef<HTMLButtonElement, FavoriteIconButtonProps>(\n ({\n children, favorite: favoriteProp, name, valueType, value, ...props\n }, ref) => {\n const [openPopper, setOpenPopper] = useState(false)\n\n const [favorite, setFavorite] = useState(favoriteProp)\n useEffect(() => {\n setFavorite(favoriteProp)\n }, [favoriteProp])\n\n const sharedRef = useShareForwardedRef(ref)\n const [buttonRef, dispatch] = useEvent(undefined, sharedRef)\n\n const onConfirmFavorite = (name?: string, newFavoriteState?: boolean) => {\n const favoriteEvent = generateFavoriteEvent(!!newFavoriteState, valueType, value, name)\n dispatch('address', 'favorite', JSON.stringify(favoriteEvent))\n setFavorite(newFavoriteState)\n setOpenPopper(false)\n }\n\n const starRef = useRef<HTMLSpanElement>(null)\n\n return (\n <IconButtonCondensed\n aria-describedby={popperId}\n ref={buttonRef}\n onClick={(event) => {\n event.stopPropagation()\n setOpenPopper(!openPopper)\n }}\n onTouchStart={(event) => {\n event.stopPropagation()\n setOpenPopper(!openPopper)\n }}\n onMouseDown={e => e.stopPropagation()}\n sx={{ lineHeight: 0, p: 0.25 }}\n {...props}\n >\n <span ref={starRef}>\n <FavoriteToggleSVG favorite={favorite} />\n </span>\n <FavoritePopper\n sx={{ zIndex: 1301 }}\n name={name}\n favorite={favorite}\n favoriteRef={starRef}\n open={openPopper}\n onConfirmFavorite={onConfirmFavorite}\n onClickAway={() => setOpenPopper(false)}\n />\n {children}\n </IconButtonCondensed>\n )\n },\n)\n\nFavoriteIconButton.displayName = 'FavoriteIconButton'\n\nconst IconButtonCondensed = styled(IconButton, { name: 'IconButtonCondensed' })(({ theme }) => ({\n lineHeight: 0,\n padding: theme.spacing(0.25),\n}))\n","export interface FavoriteItemEvent {\n favorite?: boolean\n favoriteType?: FavoriteType\n favoriteValue?: string\n name?: string\n}\n\nexport type FavoriteType = 'address' | 'schema' | 'hash'\n\nexport const generateFavoriteEvent = (favorite?: boolean, favoriteType?: FavoriteType, favoriteValue?: string, name?: string): FavoriteItemEvent => ({\n favorite: !!favorite,\n favoriteType,\n favoriteValue,\n name,\n})\n","import { Star as StarIcon, StarBorder as StarBorderIcon } from '@mui/icons-material'\nimport React from 'react'\n\nexport const FavoriteToggleSVG: React.FC<{ favorite?: boolean }> = ({ favorite }) => (\n <>\n {favorite\n ? <StarIcon className=\"favorite-icon\" component=\"svg\" color=\"secondary\" fontSize=\"small\" />\n : <StarBorderIcon className=\"favorite-icon\" fontSize=\"small\" />}\n </>\n)\n","export const popperId = 'favorite-popper'\n","import type { PopperProps } from '@mui/material'\nimport {\n Card, CardContent, ClickAwayListener, Fade, Popper, styled, TextField,\n} from '@mui/material'\nimport type { RefObject } from 'react'\nimport React, { forwardRef, useState } from 'react'\n\nimport { popperId } from './lib/index.ts'\nimport { PopperButtonGroup } from './PopperButtonGroup.tsx'\n\nexport interface FavoritePopperProps extends PopperProps {\n favorite?: boolean\n favoriteRef?: RefObject<HTMLElement>\n name?: string\n onClickAway?: (event: MouseEvent | TouchEvent) => void\n onConfirmFavorite?: (name?: string, newFavoriteState?: boolean) => void\n}\nexport const FavoritePopper = forwardRef<HTMLDivElement, FavoritePopperProps>(\n (\n {\n name: nameProp,\n favorite,\n favoriteRef,\n onClickAway,\n onConfirmFavorite,\n ...props\n },\n ref,\n ) => {\n const [name, setName] = useState(() => nameProp)\n\n return (\n <ClickAwayListener onClickAway={onClickAway ?? (() => null)}>\n <PopperStyled\n id={popperId}\n anchorEl={favoriteRef?.current}\n onClick={e => e.stopPropagation()}\n onTouchStart={e => e.stopPropagation()}\n transition\n ref={ref}\n {...props}\n >\n {({ TransitionProps }) => (\n <Fade {...TransitionProps} timeout={350}>\n <Card>\n <CardContent sx={{ display: 'flex', gap: 1 }}>\n <TextField\n autoFocus\n label=\"Favorite Name\"\n placeholder=\"optional\"\n size=\"small\"\n value={name ?? ''}\n onChange={e => setName(e.target.value)}\n />\n <PopperButtonGroup favorite={favorite} onConfirmFavorite={onConfirmFavorite} name={name} />\n </CardContent>\n </Card>\n </Fade>\n )}\n </PopperStyled>\n </ClickAwayListener>\n )\n },\n)\n\nFavoritePopper.displayName = 'FavoritePopper'\n\n// Ensure the popper is over all other mui portal elements\nconst PopperStyled = styled(Popper, { name: 'PopperStyled' })(() => ({ zIndex: 9999 }))\n","import { Delete as DeleteIcon, Star as StarIcon } from '@mui/icons-material'\nimport type { ButtonGroupProps } from '@mui/material'\nimport { Button, ButtonGroup } from '@mui/material'\nimport React from 'react'\n\nexport interface FavoritePopperProps extends ButtonGroupProps {\n favorite?: boolean\n name?: string\n onConfirmFavorite?: (name?: string, newFavoriteState?: boolean) => void\n}\n\nexport const PopperButtonGroup: React.FC<FavoritePopperProps> = ({\n name, onConfirmFavorite, favorite, ...props\n}) => {\n return (\n <ButtonGroup {...props}>\n <Button\n title=\"Save Favorite\"\n variant=\"contained\"\n onClick={(e) => {\n e.stopPropagation()\n onConfirmFavorite?.(name, true)\n }}\n >\n <StarIcon />\n </Button>\n {favorite\n ? (\n <Button\n title=\"Remove Favorite\"\n variant=\"contained\"\n onClick={(e) => {\n e.stopPropagation()\n onConfirmFavorite?.(name, false)\n }}\n >\n <DeleteIcon />\n </Button>\n )\n : null}\n </ButtonGroup>\n )\n}\n","import { ListItemIcon, useTheme } from '@mui/material'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexRow } from '@xylabs/react-flexbox'\nimport { Identicon } from '@xylabs/react-identicon'\nimport { useEvent } from '@xyo-network/react-event'\nimport { EllipsizeBox, useShareForwardedRef } from '@xyo-network/react-shared'\nimport React, { forwardRef } from 'react'\n\nimport { FavoriteIconButton } from './favorite/index.ts'\n\nexport interface AddressRenderRowBoxProps extends FlexBoxProps {\n address?: string | null\n disableSharedRef?: boolean\n favorite?: boolean\n iconOnly?: boolean\n iconSize?: number\n icons?: boolean\n name?: string\n showFavorite?: boolean\n}\n\nexport const AddressRenderRowBox = forwardRef<HTMLElement, AddressRenderRowBoxProps>(\n (\n {\n address, children, disableSharedRef, favorite: favoriteProp = false, iconOnly, iconSize = 24, icons, name, showFavorite = false, ...props\n },\n ref,\n ) => {\n const theme = useTheme()\n\n const sharedRef = useShareForwardedRef(ref)\n const [elementRef, dispatch] = useEvent(undefined, sharedRef)\n\n return (\n <FlexRow\n gap={2}\n justifyContent=\"flex-start\"\n ref={elementRef}\n onClick={() => {\n if (address) {\n dispatch('address', 'click', address)\n }\n }}\n {...props}\n >\n {icons && address\n ? (\n <ListItemIcon sx={{ minWidth: 0 }}>\n <Identicon size={iconSize} value={address} />\n </ListItemIcon>\n )\n : null}\n {iconOnly\n ? null\n : (\n <EllipsizeBox\n disableSharedRef={disableSharedRef}\n ellipsisPosition=\"end\"\n width=\"100%\"\n typographyProps={{ fontSize: theme.typography.body1.fontSize }}\n >\n {name ?? address}\n </EllipsizeBox>\n )}\n {children}\n {showFavorite && address\n ? <FavoriteIconButton name={name} size=\"small\" value={address} valueType=\"address\" favorite={favoriteProp} />\n : null}\n </FlexRow>\n )\n },\n)\n\nAddressRenderRowBox.displayName = 'AddressRenderRowBox'\n"],"mappings":";;;;AACA,SAASA,YAAYC,UAAAA,eAAc;AAEnC,SAASC,gBAAgB;AACzB,SAASC,4BAA4B;AACrC,OAAOC,UACLC,cAAAA,aAAYC,WAAWC,QAAQC,YAAAA,iBAC1B;;;ACEA,IAAMC,wBAAwB,wBAACC,UAAoBC,cAA6BC,eAAwBC,UAAsC;EACnJH,UAAU,CAAC,CAACA;EACZC;EACAC;EACAC;AACF,IALqC;;;ACTrC,SAASC,QAAQC,UAAUC,cAAcC,sBAAsB;AAC/D,OAAOC,WAAW;AAEX,IAAMC,oBAAsD,wBAAC,EAAEC,SAAQ,MAC5E,sBAAA,cAAA,MAAA,UAAA,MACGA,WACG,sBAAA,cAACC,UAAAA;EAASC,WAAU;EAAgBC,WAAU;EAAMC,OAAM;EAAYC,UAAS;KAC/E,sBAAA,cAACC,gBAAAA;EAAeJ,WAAU;EAAgBG,UAAS;KAJQ;;;ACH5D,IAAME,WAAW;;;ACCxB,SACEC,MAAMC,aAAaC,mBAAmBC,MAAMC,QAAQC,QAAQC,iBACvD;AAEP,OAAOC,UAASC,YAAYC,gBAAgB;;;ACL5C,SAASC,UAAUC,YAAYC,QAAQC,iBAAgB;AAEvD,SAASC,QAAQC,mBAAmB;AACpC,OAAOC,YAAW;AAQX,IAAMC,oBAAmD,wBAAC,EAC/DC,MAAMC,mBAAm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J,gBAAAoB,OAAA,cAACK,cAAAA;IAAaC,IAAI;MAAEC,UAAU;IAAE;KAC9B,gBAAAP,OAAA,cAACQ,WAAAA;IAAUC,MAAMvB;IAAUwB,OAAO9B;QAGtC,MACHK,WACG,OAEE,gBAAAe,OAAA,cAACW,cAAAA;IACC7B;IACA8B,kBAAiB;IACjBC,OAAM;IACNC,iBAAiB;MAAEC,UAAUvB,MAAMwB,WAAWC,MAAMF;IAAS;KAE5D3B,QAAQR,OAAAA,GAGhBC,UACAQ,gBAAgBT,UACb,gBAAAoB,OAAA,cAACkB,oBAAAA;IAAmB9B;IAAYqB,MAAK;IAAQC,OAAO9B;IAASuC,WAAU;IAAUpC,UAAUC;OAC3F,IAAA;AAGV,CAAA;AAGFN,oBAAoB0C,cAAc;","names":["IconButton","styled","useEvent","useShareForwardedRef","React","forwardRef","useEffect","useRef","useState","generateFavoriteEvent","favorite","favoriteType","favoriteValue","name","Star","StarIcon","StarBorder","StarBorderIcon","React","FavoriteToggleSVG","favorite","StarIcon","className","component","color","fontSize","StarBorderIcon","popperId","Card","CardContent","ClickAwayListener","Fade","Popper","styled","TextField","React","forwardRef","useState","Delete","DeleteIcon","Star","StarIcon","Button","ButtonGroup","React","PopperButtonGroup","name","onConfirmFavorite","favorite","props","React","ButtonGroup","Button","title","variant","onClick","e","stopPropagation","StarIcon","DeleteIcon","FavoritePopper","forwardRef","name","nameProp","favorite","favoriteRef","onClickAway","onConfirmFavorite","props","ref","setName","useState","React","ClickAwayListener","PopperStyled","id","popperId","anchorEl","current","onClick","e","stopPropagation","onTouchStart","transition","TransitionProps","Fade","timeout","Card","CardContent","sx","display","gap","TextField","autoFocus","label","placeholder","size","value","onChange","target","PopperButtonGroup","displayName","styled","Popper","zIndex","FavoriteIconButton","forwardRef","children","favorite","favoriteProp","name","valueType","value","props","ref","openPopper","setOpenPopper","useState","setFavorite","useEffect","sharedRef","useShareForwardedRef","buttonRef","dispatch","useEvent","undefined","onConfirmFavorite","newFavoriteState","favoriteEvent","generateFavoriteEvent","JSON","stringify","starRef","useRef","React","IconButtonCondensed","aria-describedby","popperId","onClick","event","stopPropagation","onTouchStart","onMouseDown","e","sx","lineHeight","p","span","FavoriteToggleSVG","FavoritePopper","zIndex","favoriteRef","open","onClickAway","displayName","styled","IconButton","theme","padding","spacing","ListItemIcon","useTheme","FlexRow","Identicon","useEvent","EllipsizeBox","useShareForwardedRef","React","forwardRef","AddressRenderRowBox","forwardRef","address","children","disableSharedRef","favorite","favoriteProp","iconOnly","iconSize","icons","name","showFavorite","props","ref","theme","useTheme","sharedRef","useShareForwardedRef","elementRef","dispatch","useEvent","undefined","React","FlexRow","gap","justifyContent","onClick","ListItemIcon","sx","minWidth","Identicon","size","value","EllipsizeBox","ellipsisPosition","width","typographyProps","fontSize","typography","body1","FavoriteIconButton","valueType","displayName"]}
package/package.json CHANGED
@@ -1,20 +1,67 @@
1
1
  {
2
2
  "name": "@xyo-network/react-address-render",
3
+ "version": "3.0.4",
4
+ "description": "Common React library for all XYO projects that use React",
5
+ "keywords": [
6
+ "xyo",
7
+ "utility",
8
+ "typescript",
9
+ "react"
10
+ ],
11
+ "homepage": "https://xyo.network",
12
+ "bugs": {
13
+ "url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues",
14
+ "email": "support@xyo.network"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
19
+ },
20
+ "license": "LGPL-3.0-only",
3
21
  "author": {
4
- "email": "support@xyo.network",
5
22
  "name": "XYO Development Team",
23
+ "email": "support@xyo.network",
6
24
  "url": "https://xyo.network"
7
25
  },
8
- "bugs": {
9
- "email": "support@xyo.network",
10
- "url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
26
+ "sideEffects": false,
27
+ "type": "module",
28
+ "exports": {
29
+ ".": {
30
+ "import": {
31
+ "types": "./dist/browser/index.d.ts",
32
+ "default": "./dist/browser/index.mjs"
33
+ },
34
+ "types": "./dist/browser/index.d.ts",
35
+ "default": "./dist/browser/index.mjs"
36
+ },
37
+ "./package.json": "./package.json"
38
+ },
39
+ "module": "dist/browser/index.mjs",
40
+ "types": "dist/browser/index.d.ts",
41
+ "scripts": {
42
+ "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\"",
43
+ "lint-pkg": "npmPkgJsonLint ."
11
44
  },
12
45
  "dependencies": {
13
46
  "@xylabs/react-flexbox": "^4.0.3",
14
47
  "@xylabs/react-identicon": "^4.0.3",
15
48
  "@xylabs/react-shared": "^4.0.3",
16
- "@xyo-network/react-event": "^3.0.2",
17
- "@xyo-network/react-shared": "^3.0.2"
49
+ "@xyo-network/react-event": "^3.0.4",
50
+ "@xyo-network/react-shared": "^3.0.4"
51
+ },
52
+ "devDependencies": {
53
+ "@mui/icons-material": "^5.16.7",
54
+ "@mui/material": "^5.16.7",
55
+ "@mui/styles": "^5.16.7",
56
+ "@storybook/react": "^8.2.9",
57
+ "@xylabs/hex": "^4.0.5",
58
+ "@xylabs/ts-scripts-yarn3": "^4.0.7",
59
+ "@xylabs/tsconfig-react": "^4.0.7",
60
+ "ethers": "^6.13.2",
61
+ "react": "^18.3.1",
62
+ "react-dom": "^18.3.1",
63
+ "storybook": "^8.2.9",
64
+ "typescript": "^5.5.4"
18
65
  },
19
66
  "peerDependencies": {
20
67
  "@mui/icons-material": "^5",
@@ -23,49 +70,8 @@
23
70
  "react": "^18",
24
71
  "react-dom": "^18"
25
72
  },
26
- "description": "Common React library for all XYO projects that use React",
27
- "devDependencies": {
28
- "@storybook/react": "^8.2.9",
29
- "@xylabs/hex": "^4.0.2",
30
- "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.20",
31
- "@xylabs/tsconfig-react": "^4.0.0-rc.20",
32
- "ethers": "^6.13.2",
33
- "typescript": "^5.5.4"
34
- },
35
- "docs": "dist/docs.json",
36
- "exports": {
37
- ".": {
38
- "import": {
39
- "types": "./dist/browser/index.d.ts",
40
- "default": "./dist/browser/index.mjs"
41
- },
42
- "types": "./dist/browser/index.d.ts",
43
- "default": "./dist/browser/index.mjs"
44
- },
45
- "./package.json": "./package.json"
46
- },
47
- "module": "dist/browser/index.mjs",
48
- "homepage": "https://xyo.network",
49
- "keywords": [
50
- "xyo",
51
- "utility",
52
- "typescript",
53
- "react"
54
- ],
55
- "license": "LGPL-3.0-only",
56
73
  "publishConfig": {
57
74
  "access": "public"
58
75
  },
59
- "repository": {
60
- "type": "git",
61
- "url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
62
- },
63
- "scripts": {
64
- "lint-pkg": "npmPkgJsonLint .",
65
- "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\""
66
- },
67
- "sideEffects": false,
68
- "types": "dist/browser/index.d.ts",
69
- "version": "3.0.2",
70
- "type": "module"
76
+ "docs": "dist/docs.json"
71
77
  }
@@ -13,11 +13,7 @@ const address: Address = toHex(randomBytes(20))
13
13
  const StorybookEntry = {
14
14
  argTypes: {},
15
15
  component: AddressRenderRowBox,
16
- parameters: {
17
- docs: {
18
- page: null,
19
- },
20
- },
16
+ parameters: { docs: { page: null } },
21
17
  title: 'address/render/AddressRenderRowBox',
22
18
  } as Meta<typeof AddressRenderRowBox>
23
19
 
@@ -39,9 +35,7 @@ const Default = Template.bind({})
39
35
  Default.args = {}
40
36
 
41
37
  const WithAddress = Template.bind({})
42
- WithAddress.args = {
43
- address,
44
- }
38
+ WithAddress.args = { address }
45
39
 
46
40
  const WithIcon = Template.bind({})
47
41
  WithIcon.args = {
@@ -82,6 +76,8 @@ WithChildren.args = {
82
76
  showFavorite: true,
83
77
  }
84
78
 
85
- export { Default, WithAddress, WithChildren, WithFavorite, WithFavoriteAlias, WithIcon, WithIconOnly }
79
+ export {
80
+ Default, WithAddress, WithChildren, WithFavorite, WithFavoriteAlias, WithIcon, WithIconOnly,
81
+ }
86
82
 
87
83
  export default StorybookEntry
@@ -21,7 +21,9 @@ export interface AddressRenderRowBoxProps extends FlexBoxProps {
21
21
 
22
22
  export const AddressRenderRowBox = forwardRef<HTMLElement, AddressRenderRowBoxProps>(
23
23
  (
24
- { address, children, disableSharedRef, favorite: favoriteProp = false, iconOnly, iconSize = 24, icons, name, showFavorite = false, ...props },
24
+ {
25
+ address, children, disableSharedRef, favorite: favoriteProp = false, iconOnly, iconSize = 24, icons, name, showFavorite = false, ...props
26
+ },
25
27
  ref,
26
28
  ) => {
27
29
  const theme = useTheme()
@@ -3,7 +3,9 @@ import { IconButton, styled } from '@mui/material'
3
3
  import type { WithChildren } from '@xylabs/react-shared'
4
4
  import { useEvent } from '@xyo-network/react-event'
5
5
  import { useShareForwardedRef } from '@xyo-network/react-shared'
6
- import React, { forwardRef, useEffect, useRef, useState } from 'react'
6
+ import React, {
7
+ forwardRef, useEffect, useRef, useState,
8
+ } from 'react'
7
9
 
8
10
  import type { FavoriteItemEvent } from '../lib/index.ts'
9
11
  import { generateFavoriteEvent } from '../lib/index.ts'
@@ -19,7 +21,9 @@ export interface FavoriteIconButtonProps extends WithChildren, IconButtonProps {
19
21
  }
20
22
 
21
23
  export const FavoriteIconButton = forwardRef<HTMLButtonElement, FavoriteIconButtonProps>(
22
- ({ children, favorite: favoriteProp, name, valueType, value, ...props }, ref) => {
24
+ ({
25
+ children, favorite: favoriteProp, name, valueType, value, ...props
26
+ }, ref) => {
23
27
  const [openPopper, setOpenPopper] = useState(false)
24
28
 
25
29
  const [favorite, setFavorite] = useState(favoriteProp)
@@ -1,7 +1,9 @@
1
1
  import type { PopperProps } from '@mui/material'
2
- import { Card, CardContent, ClickAwayListener, Fade, Popper, styled, TextField } from '@mui/material'
2
+ import {
3
+ Card, CardContent, ClickAwayListener, Fade, Popper, styled, TextField,
4
+ } from '@mui/material'
3
5
  import type { RefObject } from 'react'
4
- import React, { forwardRef, useEffect, useState } from 'react'
6
+ import React, { forwardRef, useState } from 'react'
5
7
 
6
8
  import { popperId } from './lib/index.ts'
7
9
  import { PopperButtonGroup } from './PopperButtonGroup.tsx'
@@ -25,10 +27,7 @@ export const FavoritePopper = forwardRef<HTMLDivElement, FavoritePopperProps>(
25
27
  },
26
28
  ref,
27
29
  ) => {
28
- const [name, setName] = useState(nameProp)
29
- useEffect(() => {
30
- setName(nameProp)
31
- }, [nameProp])
30
+ const [name, setName] = useState(() => nameProp)
32
31
 
33
32
  return (
34
33
  <ClickAwayListener onClickAway={onClickAway ?? (() => null)}>
@@ -9,7 +9,9 @@ export interface FavoritePopperProps extends ButtonGroupProps {
9
9
  onConfirmFavorite?: (name?: string, newFavoriteState?: boolean) => void
10
10
  }
11
11
 
12
- export const PopperButtonGroup: React.FC<FavoritePopperProps> = ({ name, onConfirmFavorite, favorite, ...props }) => {
12
+ export const PopperButtonGroup: React.FC<FavoritePopperProps> = ({
13
+ name, onConfirmFavorite, favorite, ...props
14
+ }) => {
13
15
  return (
14
16
  <ButtonGroup {...props}>
15
17
  <Button
package/xy.config.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
2
  const config: XyTsupConfig = {
3
3
  compile: {
4
- browser: {
5
- src: true,
6
- },
4
+ browser: { src: true },
7
5
  node: {},
8
6
  neutral: {},
9
7
  },