@xyo-network/react-address-render 2.64.9 → 2.65.0

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 (90) hide show
  1. package/package.json +10 -10
  2. package/dist/browser/components/RenderRowBox.cjs +0 -239
  3. package/dist/browser/components/RenderRowBox.cjs.map +0 -1
  4. package/dist/browser/components/RenderRowBox.js +0 -218
  5. package/dist/browser/components/RenderRowBox.js.map +0 -1
  6. package/dist/browser/components/favorite/FavoriteIconButton.cjs +0 -191
  7. package/dist/browser/components/favorite/FavoriteIconButton.cjs.map +0 -1
  8. package/dist/browser/components/favorite/FavoriteIconButton.js +0 -170
  9. package/dist/browser/components/favorite/FavoriteIconButton.js.map +0 -1
  10. package/dist/browser/components/favorite/FavoriteToggleSVG.cjs +0 -29
  11. package/dist/browser/components/favorite/FavoriteToggleSVG.cjs.map +0 -1
  12. package/dist/browser/components/favorite/FavoriteToggleSVG.js +0 -8
  13. package/dist/browser/components/favorite/FavoriteToggleSVG.js.map +0 -1
  14. package/dist/browser/components/favorite/Popper.cjs +0 -112
  15. package/dist/browser/components/favorite/Popper.cjs.map +0 -1
  16. package/dist/browser/components/favorite/Popper.js +0 -91
  17. package/dist/browser/components/favorite/Popper.js.map +0 -1
  18. package/dist/browser/components/favorite/PopperButtonGroup.cjs +0 -57
  19. package/dist/browser/components/favorite/PopperButtonGroup.cjs.map +0 -1
  20. package/dist/browser/components/favorite/PopperButtonGroup.js +0 -36
  21. package/dist/browser/components/favorite/PopperButtonGroup.js.map +0 -1
  22. package/dist/browser/components/favorite/index.cjs +0 -193
  23. package/dist/browser/components/favorite/index.cjs.map +0 -1
  24. package/dist/browser/components/favorite/index.js +0 -170
  25. package/dist/browser/components/favorite/index.js.map +0 -1
  26. package/dist/browser/components/favorite/lib/PopperId.cjs +0 -27
  27. package/dist/browser/components/favorite/lib/PopperId.cjs.map +0 -1
  28. package/dist/browser/components/favorite/lib/PopperId.js +0 -6
  29. package/dist/browser/components/favorite/lib/PopperId.js.map +0 -1
  30. package/dist/browser/components/favorite/lib/index.cjs +0 -29
  31. package/dist/browser/components/favorite/lib/index.cjs.map +0 -1
  32. package/dist/browser/components/favorite/lib/index.js +0 -6
  33. package/dist/browser/components/favorite/lib/index.js.map +0 -1
  34. package/dist/browser/components/index.cjs +0 -241
  35. package/dist/browser/components/index.cjs.map +0 -1
  36. package/dist/browser/components/index.js +0 -218
  37. package/dist/browser/components/index.js.map +0 -1
  38. package/dist/browser/components/lib/FavoriteItemEvent.cjs +0 -32
  39. package/dist/browser/components/lib/FavoriteItemEvent.cjs.map +0 -1
  40. package/dist/browser/components/lib/FavoriteItemEvent.js +0 -11
  41. package/dist/browser/components/lib/FavoriteItemEvent.js.map +0 -1
  42. package/dist/browser/components/lib/index.cjs +0 -34
  43. package/dist/browser/components/lib/index.cjs.map +0 -1
  44. package/dist/browser/components/lib/index.js +0 -11
  45. package/dist/browser/components/lib/index.js.map +0 -1
  46. package/dist/docs.json +0 -24106
  47. package/dist/node/components/RenderRowBox.cjs +0 -243
  48. package/dist/node/components/RenderRowBox.cjs.map +0 -1
  49. package/dist/node/components/RenderRowBox.js +0 -218
  50. package/dist/node/components/RenderRowBox.js.map +0 -1
  51. package/dist/node/components/favorite/FavoriteIconButton.cjs +0 -195
  52. package/dist/node/components/favorite/FavoriteIconButton.cjs.map +0 -1
  53. package/dist/node/components/favorite/FavoriteIconButton.js +0 -170
  54. package/dist/node/components/favorite/FavoriteIconButton.js.map +0 -1
  55. package/dist/node/components/favorite/FavoriteToggleSVG.cjs +0 -33
  56. package/dist/node/components/favorite/FavoriteToggleSVG.cjs.map +0 -1
  57. package/dist/node/components/favorite/FavoriteToggleSVG.js +0 -8
  58. package/dist/node/components/favorite/FavoriteToggleSVG.js.map +0 -1
  59. package/dist/node/components/favorite/Popper.cjs +0 -116
  60. package/dist/node/components/favorite/Popper.cjs.map +0 -1
  61. package/dist/node/components/favorite/Popper.js +0 -91
  62. package/dist/node/components/favorite/Popper.js.map +0 -1
  63. package/dist/node/components/favorite/PopperButtonGroup.cjs +0 -61
  64. package/dist/node/components/favorite/PopperButtonGroup.cjs.map +0 -1
  65. package/dist/node/components/favorite/PopperButtonGroup.js +0 -36
  66. package/dist/node/components/favorite/PopperButtonGroup.js.map +0 -1
  67. package/dist/node/components/favorite/index.cjs +0 -197
  68. package/dist/node/components/favorite/index.cjs.map +0 -1
  69. package/dist/node/components/favorite/index.js +0 -170
  70. package/dist/node/components/favorite/index.js.map +0 -1
  71. package/dist/node/components/favorite/lib/PopperId.cjs +0 -31
  72. package/dist/node/components/favorite/lib/PopperId.cjs.map +0 -1
  73. package/dist/node/components/favorite/lib/PopperId.js +0 -6
  74. package/dist/node/components/favorite/lib/PopperId.js.map +0 -1
  75. package/dist/node/components/favorite/lib/index.cjs +0 -33
  76. package/dist/node/components/favorite/lib/index.cjs.map +0 -1
  77. package/dist/node/components/favorite/lib/index.js +0 -6
  78. package/dist/node/components/favorite/lib/index.js.map +0 -1
  79. package/dist/node/components/index.cjs +0 -247
  80. package/dist/node/components/index.cjs.map +0 -1
  81. package/dist/node/components/index.js +0 -218
  82. package/dist/node/components/index.js.map +0 -1
  83. package/dist/node/components/lib/FavoriteItemEvent.cjs +0 -36
  84. package/dist/node/components/lib/FavoriteItemEvent.cjs.map +0 -1
  85. package/dist/node/components/lib/FavoriteItemEvent.js +0 -11
  86. package/dist/node/components/lib/FavoriteItemEvent.js.map +0 -1
  87. package/dist/node/components/lib/index.cjs +0 -38
  88. package/dist/node/components/lib/index.cjs.map +0 -1
  89. package/dist/node/components/lib/index.js +0 -11
  90. package/dist/node/components/lib/index.js.map +0 -1
package/package.json CHANGED
@@ -10,11 +10,11 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/react-flexbox": "^3.0.15",
14
- "@xylabs/react-identicon": "^3.0.15",
15
- "@xylabs/react-shared": "^3.0.15",
16
- "@xyo-network/react-event": "~2.64.9",
17
- "@xyo-network/react-shared": "~2.64.9"
13
+ "@xylabs/react-flexbox": "^3.0.18",
14
+ "@xylabs/react-identicon": "^3.0.18",
15
+ "@xylabs/react-shared": "^3.0.18",
16
+ "@xyo-network/react-event": "~2.65.0",
17
+ "@xyo-network/react-shared": "~2.65.0"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@mui/icons-material": "^5",
@@ -27,10 +27,10 @@
27
27
  "description": "Common React library for all XYO projects that use React",
28
28
  "devDependencies": {
29
29
  "@storybook/react": "^7.4.6",
30
- "@xylabs/ts-scripts-yarn3": "^3.0.82",
31
- "@xylabs/tsconfig-react": "^3.0.82",
32
- "@xyo-network/account": "^2.75.8",
33
- "@xyo-network/react-event": "~2.64.9",
30
+ "@xylabs/ts-scripts-yarn3": "^3.1.9",
31
+ "@xylabs/tsconfig-react": "^3.1.9",
32
+ "@xyo-network/account": "^2.76.0",
33
+ "@xyo-network/react-event": "~2.65.0",
34
34
  "typescript": "^5.2.2"
35
35
  },
36
36
  "docs": "dist/docs.json",
@@ -83,6 +83,6 @@
83
83
  },
84
84
  "sideEffects": false,
85
85
  "types": "dist/browser/index.d.ts",
86
- "version": "2.64.9",
86
+ "version": "2.65.0",
87
87
  "type": "module"
88
88
  }
@@ -1,239 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/components/RenderRowBox.tsx
21
- var RenderRowBox_exports = {};
22
- __export(RenderRowBox_exports, {
23
- AddressRenderRowBox: () => AddressRenderRowBox
24
- });
25
- module.exports = __toCommonJS(RenderRowBox_exports);
26
- var import_material4 = require("@mui/material");
27
- var import_react_flexbox = require("@xylabs/react-flexbox");
28
- var import_react_identicon = require("@xylabs/react-identicon");
29
- var import_react_event2 = require("@xyo-network/react-event");
30
- var import_react_shared2 = require("@xyo-network/react-shared");
31
- var import_react3 = require("react");
32
-
33
- // src/components/favorite/FavoriteIconButton.tsx
34
- var import_material3 = require("@mui/material");
35
- var import_react_event = require("@xyo-network/react-event");
36
- var import_react_shared = require("@xyo-network/react-shared");
37
- var import_react2 = require("react");
38
-
39
- // src/components/lib/FavoriteItemEvent.ts
40
- var generateFavoriteEvent = (favorite, favoriteType, favoriteValue, name) => ({
41
- favorite: !!favorite,
42
- favoriteType,
43
- favoriteValue,
44
- name
45
- });
46
-
47
- // src/components/favorite/FavoriteToggleSVG.tsx
48
- var import_icons_material = require("@mui/icons-material");
49
- var import_jsx_runtime = require("react/jsx-runtime");
50
- var FavoriteToggleSVG = ({ favorite }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: favorite ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Star, { className: "favorite-icon", component: "svg", color: "secondary", fontSize: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.StarBorder, { className: "favorite-icon", fontSize: "small" }) });
51
-
52
- // src/components/favorite/lib/PopperId.ts
53
- var popperId = "favorite-popper";
54
-
55
- // src/components/favorite/Popper.tsx
56
- var import_material2 = require("@mui/material");
57
- var import_react = require("react");
58
-
59
- // src/components/favorite/PopperButtonGroup.tsx
60
- var import_icons_material2 = require("@mui/icons-material");
61
- var import_material = require("@mui/material");
62
- var import_jsx_runtime2 = require("react/jsx-runtime");
63
- var PopperButtonGroup = ({ name, onConfirmFavorite, favorite, ...props }) => {
64
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material.ButtonGroup, { ...props, children: [
65
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
66
- import_material.Button,
67
- {
68
- title: "Save Favorite",
69
- variant: "contained",
70
- onClick: (e) => {
71
- e.stopPropagation();
72
- onConfirmFavorite?.(name, true);
73
- },
74
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material2.Star, {})
75
- }
76
- ),
77
- favorite ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
78
- import_material.Button,
79
- {
80
- title: "Remove Favorite",
81
- variant: "contained",
82
- onClick: (e) => {
83
- e.stopPropagation();
84
- onConfirmFavorite?.(name, false);
85
- },
86
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material2.Delete, {})
87
- }
88
- ) : null
89
- ] });
90
- };
91
-
92
- // src/components/favorite/Popper.tsx
93
- var import_jsx_runtime3 = require("react/jsx-runtime");
94
- var FavoritePopper = (0, import_react.forwardRef)(
95
- ({
96
- name: nameProp,
97
- favorite,
98
- favoriteRef,
99
- onClickAway = () => {
100
- return;
101
- },
102
- onConfirmFavorite,
103
- ...props
104
- }, ref) => {
105
- const [name, setName] = (0, import_react.useState)(nameProp);
106
- (0, import_react.useEffect)(() => {
107
- setName(nameProp);
108
- }, [nameProp]);
109
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material2.ClickAwayListener, { onClickAway, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
110
- PopperStyled,
111
- {
112
- id: popperId,
113
- anchorEl: favoriteRef?.current,
114
- onClick: (e) => e.stopPropagation(),
115
- onTouchStart: (e) => e.stopPropagation(),
116
- transition: true,
117
- ref,
118
- ...props,
119
- children: ({ TransitionProps }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material2.Fade, { ...TransitionProps, timeout: 350, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material2.Card, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_material2.CardContent, { sx: { display: "flex", gap: 1 }, children: [
120
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
121
- import_material2.TextField,
122
- {
123
- autoFocus: true,
124
- label: "Favorite Name",
125
- placeholder: "optional",
126
- size: "small",
127
- value: name ?? "",
128
- onChange: (e) => setName(e.target.value)
129
- }
130
- ),
131
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PopperButtonGroup, { favorite, onConfirmFavorite, name })
132
- ] }) }) })
133
- }
134
- ) });
135
- }
136
- );
137
- FavoritePopper.displayName = "FavoritePopper";
138
- var PopperStyled = (0, import_material2.styled)(import_material2.Popper, { name: "PopperStyled" })(() => ({ zIndex: 9999 }));
139
-
140
- // src/components/favorite/FavoriteIconButton.tsx
141
- var import_jsx_runtime4 = require("react/jsx-runtime");
142
- var FavoriteIconButton = (0, import_react2.forwardRef)(
143
- ({ children, favorite: favoriteProp, name, valueType, value, ...props }, ref) => {
144
- const [openPopper, setOpenPopper] = (0, import_react2.useState)(false);
145
- const [favorite, setFavorite] = (0, import_react2.useState)(favoriteProp);
146
- (0, import_react2.useEffect)(() => {
147
- setFavorite(favoriteProp);
148
- }, [favoriteProp]);
149
- const sharedRef = (0, import_react_shared.useShareForwardedRef)(ref);
150
- const [buttonRef, dispatch] = (0, import_react_event.useEvent)(void 0, sharedRef);
151
- const onConfirmFavorite = (name2, newFavoriteState) => {
152
- const favoriteEvent = generateFavoriteEvent(!!newFavoriteState, valueType, value, name2);
153
- dispatch("address", "favorite", JSON.stringify(favoriteEvent));
154
- setFavorite(newFavoriteState);
155
- setOpenPopper(false);
156
- };
157
- const starRef = (0, import_react2.useRef)(null);
158
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
159
- IconButtonCondensed,
160
- {
161
- "aria-describedby": popperId,
162
- ref: buttonRef,
163
- onClick: (event) => {
164
- event.stopPropagation();
165
- setOpenPopper(!openPopper);
166
- },
167
- onTouchStart: (event) => {
168
- event.stopPropagation();
169
- setOpenPopper(!openPopper);
170
- },
171
- onMouseDown: (e) => e.stopPropagation(),
172
- sx: { lineHeight: 0, p: 0.25 },
173
- ...props,
174
- children: [
175
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { ref: starRef, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FavoriteToggleSVG, { favorite }) }),
176
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
177
- FavoritePopper,
178
- {
179
- sx: { zIndex: 1301 },
180
- name,
181
- favorite,
182
- favoriteRef: starRef,
183
- open: openPopper,
184
- onConfirmFavorite,
185
- onClickAway: () => setOpenPopper(false)
186
- }
187
- ),
188
- children
189
- ]
190
- }
191
- );
192
- }
193
- );
194
- FavoriteIconButton.displayName = "FavoriteIconButton";
195
- var IconButtonCondensed = (0, import_material3.styled)(import_material3.IconButton, { name: "IconButtonCondensed" })(({ theme }) => ({
196
- lineHeight: 0,
197
- padding: theme.spacing(0.25)
198
- }));
199
-
200
- // src/components/RenderRowBox.tsx
201
- var import_jsx_runtime5 = require("react/jsx-runtime");
202
- var AddressRenderRowBox = (0, import_react3.forwardRef)(
203
- ({ address, children, disableSharedRef, favorite: favoriteProp = false, iconOnly, iconSize = 24, icons, name, showFavorite = false, ...props }, ref) => {
204
- const theme = (0, import_material4.useTheme)();
205
- const sharedRef = (0, import_react_shared2.useShareForwardedRef)(ref);
206
- const [elementRef, dispatch] = (0, import_react_event2.useEvent)(void 0, sharedRef);
207
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
208
- import_react_flexbox.FlexRow,
209
- {
210
- gap: 2,
211
- justifyContent: "flex-start",
212
- ref: elementRef,
213
- onClick: () => {
214
- if (address) {
215
- dispatch("address", "click", address);
216
- }
217
- },
218
- ...props,
219
- children: [
220
- icons && address ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_material4.ListItemIcon, { sx: { minWidth: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_identicon.Identicon, { size: iconSize, value: address }) }) : null,
221
- iconOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
222
- import_react_shared2.EllipsizeBox,
223
- {
224
- disableSharedRef,
225
- ellipsisPosition: "end",
226
- width: "100%",
227
- typographyProps: { fontSize: theme.typography.body1.fontSize },
228
- children: name ?? address
229
- }
230
- ),
231
- children,
232
- showFavorite && address ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FavoriteIconButton, { name, size: "small", value: address, valueType: "address", favorite: favoriteProp }) : null
233
- ]
234
- }
235
- );
236
- }
237
- );
238
- AddressRenderRowBox.displayName = "AddressRenderRowBox";
239
- //# sourceMappingURL=RenderRowBox.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/RenderRowBox.tsx","../../../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"],"sourcesContent":["import { ListItemIcon, useTheme } from '@mui/material'\nimport { FlexBoxProps, 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 { forwardRef } from 'react'\n\nimport { FavoriteIconButton } from './favorite'\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 <ListItemIcon sx={{ minWidth: 0 }}>\n <Identicon size={iconSize} value={address} />\n </ListItemIcon>\n ) : null}\n {iconOnly ? null : (\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","import { IconButton, IconButtonProps, styled } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEvent } from '@xyo-network/react-event'\nimport { useShareForwardedRef } from '@xyo-network/react-shared'\nimport { forwardRef, useEffect, useRef, useState } from 'react'\n\nimport { FavoriteItemEvent, generateFavoriteEvent } from '../lib'\nimport { FavoriteToggleSVG } from './FavoriteToggleSVG'\nimport { popperId } from './lib'\nimport { FavoritePopper } from './Popper'\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'\n\nexport const FavoriteToggleSVG: React.FC<{ favorite?: boolean }> = ({ favorite }) => (\n <>\n {favorite ? (\n <StarIcon className=\"favorite-icon\" component={'svg'} color=\"secondary\" fontSize=\"small\" />\n ) : (\n <StarBorderIcon className=\"favorite-icon\" fontSize=\"small\" />\n )}\n </>\n)\n","export const popperId = 'favorite-popper'\n","import { Card, CardContent, ClickAwayListener, Fade, Popper, PopperProps, styled, TextField } from '@mui/material'\nimport { forwardRef, RefObject, useEffect, useState } from 'react'\n\nimport { popperId } from './lib'\nimport { PopperButtonGroup } from './PopperButtonGroup'\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 return\n },\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}>\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 { Button, ButtonGroup, ButtonGroupProps } from '@mui/material'\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 <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 ) : null}\n </ButtonGroup>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mBAAuC;AACvC,2BAAsC;AACtC,6BAA0B;AAC1B,IAAAC,sBAAyB;AACzB,IAAAC,uBAAmD;AACnD,IAAAC,gBAA2B;;;ACL3B,IAAAC,mBAAoD;AAEpD,yBAAyB;AACzB,0BAAqC;AACrC,IAAAC,gBAAwD;;;ACKjD,IAAM,wBAAwB,CAAC,UAAoB,cAA6B,eAAwB,UAAsC;AAAA,EACnJ,UAAU,CAAC,CAAC;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AACF;;;ACdA,4BAA+D;AAG7D;AADK,IAAM,oBAAsD,CAAC,EAAE,SAAS,MAC7E,2EACG,qBACC,4CAAC,sBAAAC,MAAA,EAAS,WAAU,iBAAgB,WAAW,OAAO,OAAM,aAAY,UAAS,SAAQ,IAEzF,4CAAC,sBAAAC,YAAA,EAAe,WAAU,iBAAgB,UAAS,SAAQ,GAE/D;;;ACTK,IAAM,WAAW;;;ACAxB,IAAAC,mBAAmG;AACnG,mBAA2D;;;ACD3D,IAAAC,yBAAuD;AACvD,sBAAsD;AAUlD,IAAAC,sBAAA;AAFG,IAAM,oBAAmD,CAAC,EAAE,MAAM,mB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O,SAAS,GAC7C,IACE;AAAA,UACH,WAAW,OACV;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,kBAAkB;AAAA,cAClB,OAAM;AAAA,cACN,iBAAiB,EAAE,UAAU,MAAM,WAAW,MAAM,SAAS;AAAA,cAE5D,kBAAQ;AAAA;AAAA,UACX;AAAA,UAED;AAAA,UACA,gBAAgB,UACf,6CAAC,sBAAmB,MAAY,MAAM,SAAS,OAAO,SAAS,WAAW,WAAW,UAAU,cAAc,IAC3G;AAAA;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,oBAAoB,cAAc;","names":["import_material","import_react_event","import_react_shared","import_react","import_material","import_react","StarIcon","StarBorderIcon","import_material","import_icons_material","import_jsx_runtime","StarIcon","DeleteIcon","import_jsx_runtime","import_jsx_runtime","name","import_jsx_runtime"]}
@@ -1,218 +0,0 @@
1
- // src/components/RenderRowBox.tsx
2
- import { ListItemIcon, useTheme } from "@mui/material";
3
- import { FlexRow } from "@xylabs/react-flexbox";
4
- import { Identicon } from "@xylabs/react-identicon";
5
- import { useEvent as useEvent2 } from "@xyo-network/react-event";
6
- import { EllipsizeBox, useShareForwardedRef as useShareForwardedRef2 } from "@xyo-network/react-shared";
7
- import { forwardRef as forwardRef3 } from "react";
8
-
9
- // src/components/favorite/FavoriteIconButton.tsx
10
- import { IconButton, styled as styled2 } from "@mui/material";
11
- import { useEvent } from "@xyo-network/react-event";
12
- import { useShareForwardedRef } from "@xyo-network/react-shared";
13
- import { forwardRef as forwardRef2, useEffect as useEffect2, useRef, useState as useState2 } from "react";
14
-
15
- // src/components/lib/FavoriteItemEvent.ts
16
- var generateFavoriteEvent = (favorite, favoriteType, favoriteValue, name) => ({
17
- favorite: !!favorite,
18
- favoriteType,
19
- favoriteValue,
20
- name
21
- });
22
-
23
- // src/components/favorite/FavoriteToggleSVG.tsx
24
- import { Star as StarIcon, StarBorder as StarBorderIcon } from "@mui/icons-material";
25
- import { Fragment, jsx } from "react/jsx-runtime";
26
- var FavoriteToggleSVG = ({ favorite }) => /* @__PURE__ */ jsx(Fragment, { children: favorite ? /* @__PURE__ */ jsx(StarIcon, { className: "favorite-icon", component: "svg", color: "secondary", fontSize: "small" }) : /* @__PURE__ */ jsx(StarBorderIcon, { className: "favorite-icon", fontSize: "small" }) });
27
-
28
- // src/components/favorite/lib/PopperId.ts
29
- var popperId = "favorite-popper";
30
-
31
- // src/components/favorite/Popper.tsx
32
- import { Card, CardContent, ClickAwayListener, Fade, Popper, styled, TextField } from "@mui/material";
33
- import { forwardRef, useEffect, useState } from "react";
34
-
35
- // src/components/favorite/PopperButtonGroup.tsx
36
- import { Delete as DeleteIcon, Star as StarIcon2 } from "@mui/icons-material";
37
- import { Button, ButtonGroup } from "@mui/material";
38
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
39
- var PopperButtonGroup = ({ name, onConfirmFavorite, favorite, ...props }) => {
40
- return /* @__PURE__ */ jsxs(ButtonGroup, { ...props, children: [
41
- /* @__PURE__ */ jsx2(
42
- Button,
43
- {
44
- title: "Save Favorite",
45
- variant: "contained",
46
- onClick: (e) => {
47
- e.stopPropagation();
48
- onConfirmFavorite?.(name, true);
49
- },
50
- children: /* @__PURE__ */ jsx2(StarIcon2, {})
51
- }
52
- ),
53
- favorite ? /* @__PURE__ */ jsx2(
54
- Button,
55
- {
56
- title: "Remove Favorite",
57
- variant: "contained",
58
- onClick: (e) => {
59
- e.stopPropagation();
60
- onConfirmFavorite?.(name, false);
61
- },
62
- children: /* @__PURE__ */ jsx2(DeleteIcon, {})
63
- }
64
- ) : null
65
- ] });
66
- };
67
-
68
- // src/components/favorite/Popper.tsx
69
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
70
- var FavoritePopper = forwardRef(
71
- ({
72
- name: nameProp,
73
- favorite,
74
- favoriteRef,
75
- onClickAway = () => {
76
- return;
77
- },
78
- onConfirmFavorite,
79
- ...props
80
- }, ref) => {
81
- const [name, setName] = useState(nameProp);
82
- useEffect(() => {
83
- setName(nameProp);
84
- }, [nameProp]);
85
- return /* @__PURE__ */ jsx3(ClickAwayListener, { onClickAway, children: /* @__PURE__ */ jsx3(
86
- PopperStyled,
87
- {
88
- id: popperId,
89
- anchorEl: favoriteRef?.current,
90
- onClick: (e) => e.stopPropagation(),
91
- onTouchStart: (e) => e.stopPropagation(),
92
- transition: true,
93
- ref,
94
- ...props,
95
- children: ({ TransitionProps }) => /* @__PURE__ */ jsx3(Fade, { ...TransitionProps, timeout: 350, children: /* @__PURE__ */ jsx3(Card, { children: /* @__PURE__ */ jsxs2(CardContent, { sx: { display: "flex", gap: 1 }, children: [
96
- /* @__PURE__ */ jsx3(
97
- TextField,
98
- {
99
- autoFocus: true,
100
- label: "Favorite Name",
101
- placeholder: "optional",
102
- size: "small",
103
- value: name ?? "",
104
- onChange: (e) => setName(e.target.value)
105
- }
106
- ),
107
- /* @__PURE__ */ jsx3(PopperButtonGroup, { favorite, onConfirmFavorite, name })
108
- ] }) }) })
109
- }
110
- ) });
111
- }
112
- );
113
- FavoritePopper.displayName = "FavoritePopper";
114
- var PopperStyled = styled(Popper, { name: "PopperStyled" })(() => ({ zIndex: 9999 }));
115
-
116
- // src/components/favorite/FavoriteIconButton.tsx
117
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
118
- var FavoriteIconButton = forwardRef2(
119
- ({ children, favorite: favoriteProp, name, valueType, value, ...props }, ref) => {
120
- const [openPopper, setOpenPopper] = useState2(false);
121
- const [favorite, setFavorite] = useState2(favoriteProp);
122
- useEffect2(() => {
123
- setFavorite(favoriteProp);
124
- }, [favoriteProp]);
125
- const sharedRef = useShareForwardedRef(ref);
126
- const [buttonRef, dispatch] = useEvent(void 0, sharedRef);
127
- const onConfirmFavorite = (name2, newFavoriteState) => {
128
- const favoriteEvent = generateFavoriteEvent(!!newFavoriteState, valueType, value, name2);
129
- dispatch("address", "favorite", JSON.stringify(favoriteEvent));
130
- setFavorite(newFavoriteState);
131
- setOpenPopper(false);
132
- };
133
- const starRef = useRef(null);
134
- return /* @__PURE__ */ jsxs3(
135
- IconButtonCondensed,
136
- {
137
- "aria-describedby": popperId,
138
- ref: buttonRef,
139
- onClick: (event) => {
140
- event.stopPropagation();
141
- setOpenPopper(!openPopper);
142
- },
143
- onTouchStart: (event) => {
144
- event.stopPropagation();
145
- setOpenPopper(!openPopper);
146
- },
147
- onMouseDown: (e) => e.stopPropagation(),
148
- sx: { lineHeight: 0, p: 0.25 },
149
- ...props,
150
- children: [
151
- /* @__PURE__ */ jsx4("span", { ref: starRef, children: /* @__PURE__ */ jsx4(FavoriteToggleSVG, { favorite }) }),
152
- /* @__PURE__ */ jsx4(
153
- FavoritePopper,
154
- {
155
- sx: { zIndex: 1301 },
156
- name,
157
- favorite,
158
- favoriteRef: starRef,
159
- open: openPopper,
160
- onConfirmFavorite,
161
- onClickAway: () => setOpenPopper(false)
162
- }
163
- ),
164
- children
165
- ]
166
- }
167
- );
168
- }
169
- );
170
- FavoriteIconButton.displayName = "FavoriteIconButton";
171
- var IconButtonCondensed = styled2(IconButton, { name: "IconButtonCondensed" })(({ theme }) => ({
172
- lineHeight: 0,
173
- padding: theme.spacing(0.25)
174
- }));
175
-
176
- // src/components/RenderRowBox.tsx
177
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
178
- var AddressRenderRowBox = forwardRef3(
179
- ({ address, children, disableSharedRef, favorite: favoriteProp = false, iconOnly, iconSize = 24, icons, name, showFavorite = false, ...props }, ref) => {
180
- const theme = useTheme();
181
- const sharedRef = useShareForwardedRef2(ref);
182
- const [elementRef, dispatch] = useEvent2(void 0, sharedRef);
183
- return /* @__PURE__ */ jsxs4(
184
- FlexRow,
185
- {
186
- gap: 2,
187
- justifyContent: "flex-start",
188
- ref: elementRef,
189
- onClick: () => {
190
- if (address) {
191
- dispatch("address", "click", address);
192
- }
193
- },
194
- ...props,
195
- children: [
196
- icons && address ? /* @__PURE__ */ jsx5(ListItemIcon, { sx: { minWidth: 0 }, children: /* @__PURE__ */ jsx5(Identicon, { size: iconSize, value: address }) }) : null,
197
- iconOnly ? null : /* @__PURE__ */ jsx5(
198
- EllipsizeBox,
199
- {
200
- disableSharedRef,
201
- ellipsisPosition: "end",
202
- width: "100%",
203
- typographyProps: { fontSize: theme.typography.body1.fontSize },
204
- children: name ?? address
205
- }
206
- ),
207
- children,
208
- showFavorite && address ? /* @__PURE__ */ jsx5(FavoriteIconButton, { name, size: "small", value: address, valueType: "address", favorite: favoriteProp }) : null
209
- ]
210
- }
211
- );
212
- }
213
- );
214
- AddressRenderRowBox.displayName = "AddressRenderRowBox";
215
- export {
216
- AddressRenderRowBox
217
- };
218
- //# sourceMappingURL=RenderRowBox.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/RenderRowBox.tsx","../../../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"],"sourcesContent":["import { ListItemIcon, useTheme } from '@mui/material'\nimport { FlexBoxProps, 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 { forwardRef } from 'react'\n\nimport { FavoriteIconButton } from './favorite'\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 <ListItemIcon sx={{ minWidth: 0 }}>\n <Identicon size={iconSize} value={address} />\n </ListItemIcon>\n ) : null}\n {iconOnly ? null : (\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","import { IconButton, IconButtonProps, styled } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useEvent } from '@xyo-network/react-event'\nimport { useShareForwardedRef } from '@xyo-network/react-shared'\nimport { forwardRef, useEffect, useRef, useState } from 'react'\n\nimport { FavoriteItemEvent, generateFavoriteEvent } from '../lib'\nimport { FavoriteToggleSVG } from './FavoriteToggleSVG'\nimport { popperId } from './lib'\nimport { FavoritePopper } from './Popper'\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'\n\nexport const FavoriteToggleSVG: React.FC<{ favorite?: boolean }> = ({ favorite }) => (\n <>\n {favorite ? (\n <StarIcon className=\"favorite-icon\" component={'svg'} color=\"secondary\" fontSize=\"small\" />\n ) : (\n <StarBorderIcon className=\"favorite-icon\" fontSize=\"small\" />\n )}\n </>\n)\n","export const popperId = 'favorite-popper'\n","import { Card, CardContent, ClickAwayListener, Fade, Popper, PopperProps, styled, TextField } from '@mui/material'\nimport { forwardRef, RefObject, useEffect, useState } from 'react'\n\nimport { popperId } from './lib'\nimport { PopperButtonGroup } from './PopperButtonGroup'\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 return\n },\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}>\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 { Button, ButtonGroup, ButtonGroupProps } from '@mui/material'\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 <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 ) : null}\n </ButtonGroup>\n )\n}\n"],"mappings":";AAAA,SAAS,cAAc,gBAAgB;AACvC,SAAuB,eAAe;AACtC,SAAS,iBAAiB;AAC1B,SAAS,YAAAA,iBAAgB;AACzB,SAAS,cAAc,wBAAAC,6BAA4B;AACnD,SAAS,cAAAC,mBAAkB;;;ACL3B,SAAS,YAA6B,UAAAC,eAAc;AAEpD,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AACrC,SAAS,cAAAC,aAAY,aAAAC,YAAW,QAAQ,YAAAC,iBAAgB;;;ACKjD,IAAM,wBAAwB,CAAC,UAAoB,cAA6B,eAAwB,UAAsC;AAAA,EACnJ,UAAU,CAAC,CAAC;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AACF;;;ACdA,SAAS,QAAQ,UAAU,cAAc,sBAAsB;AAG7D,mBAEI,WAFJ;AADK,IAAM,oBAAsD,CAAC,EAAE,SAAS,MAC7E,gCACG,qBACC,oBAAC,YAAS,WAAU,iBAAgB,WAAW,OAAO,OAAM,aAAY,UAAS,SAAQ,IAEzF,oBAAC,kBAAe,WAAU,iBAAgB,UAAS,SAAQ,GAE/D;;;ACTK,IAAM,WAAW;;;ACAxB,SAAS,MAAM,aAAa,mBAAmB,MAAM,QAAqB,QAAQ,iBAAiB;AACnG,SAAS,YAAuB,WAAW,gBAAgB;;;ACD3D,SAAS,UAAU,YAAY,QAAQC,iBAAgB;AACv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gBAAe;AAAA,QACf,KAAK;AAAA,QACL,SAAS,MAAM;AACb,cAAI,SAAS;AACX,qBAAS,WAAW,SAAS,OAAO;AAAA,UACtC;AAAA,QACF;AAAA,QACC,GAAG;AAAA,QAEH;AAAA,mBAAS,UACR,gBAAAD,KAAC,gBAAa,IAAI,EAAE,UAAU,EAAE,GAC9B,0BAAAA,KAAC,aAAU,MAAM,UAAU,OAAO,SAAS,GAC7C,IACE;AAAA,UACH,WAAW,OACV,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,kBAAkB;AAAA,cAClB,OAAM;AAAA,cACN,iBAAiB,EAAE,UAAU,MAAM,WAAW,MAAM,SAAS;AAAA,cAE5D,kBAAQ;AAAA;AAAA,UACX;AAAA,UAED;AAAA,UACA,gBAAgB,UACf,gBAAAA,KAAC,sBAAmB,MAAY,MAAM,SAAS,OAAO,SAAS,WAAW,WAAW,UAAU,cAAc,IAC3G;AAAA;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,oBAAoB,cAAc;","names":["useEvent","useShareForwardedRef","forwardRef","styled","forwardRef","useEffect","useState","StarIcon","jsx","jsx","jsxs","jsx","jsxs","forwardRef","useState","useEffect","name","styled","jsx","jsxs","forwardRef","useShareForwardedRef","useEvent"]}