@xyo-network/react-address-render 2.64.0-rc.7 → 2.64.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.
- package/dist/browser/components/RenderRowBox.cjs +239 -0
- package/dist/browser/components/RenderRowBox.cjs.map +1 -0
- package/dist/browser/components/RenderRowBox.d.cts +14 -0
- package/dist/browser/components/RenderRowBox.d.cts.map +1 -0
- package/dist/browser/components/favorite/FavoriteIconButton.cjs +191 -0
- package/dist/browser/components/favorite/FavoriteIconButton.cjs.map +1 -0
- package/dist/browser/components/favorite/FavoriteIconButton.d.cts +12 -0
- package/dist/browser/components/favorite/FavoriteIconButton.d.cts.map +1 -0
- package/dist/browser/components/favorite/FavoriteToggleSVG.cjs +29 -0
- package/dist/{node/components/favorite/FavoriteToggleSVG.mjs.map → browser/components/favorite/FavoriteToggleSVG.cjs.map} +1 -1
- package/dist/browser/components/favorite/FavoriteToggleSVG.d.cts +5 -0
- package/dist/browser/components/favorite/FavoriteToggleSVG.d.cts.map +1 -0
- package/dist/browser/components/favorite/Popper.cjs +112 -0
- package/dist/browser/components/favorite/Popper.cjs.map +1 -0
- package/dist/browser/components/favorite/Popper.d.cts +11 -0
- package/dist/browser/components/favorite/Popper.d.cts.map +1 -0
- package/dist/browser/components/favorite/PopperButtonGroup.cjs +57 -0
- package/dist/browser/components/favorite/PopperButtonGroup.cjs.map +1 -0
- package/dist/browser/components/favorite/PopperButtonGroup.d.cts +9 -0
- package/dist/browser/components/favorite/PopperButtonGroup.d.cts.map +1 -0
- package/dist/browser/components/favorite/index.cjs +193 -0
- package/dist/browser/components/favorite/index.cjs.map +1 -0
- package/dist/browser/components/favorite/index.d.cts +2 -0
- package/dist/browser/components/favorite/index.d.cts.map +1 -0
- package/dist/browser/components/favorite/lib/PopperId.cjs +27 -0
- package/dist/{node/components/favorite/lib/PopperId.mjs.map → browser/components/favorite/lib/PopperId.cjs.map} +1 -1
- package/dist/browser/components/favorite/lib/PopperId.d.cts +2 -0
- package/dist/browser/components/favorite/lib/PopperId.d.cts.map +1 -0
- package/dist/browser/components/favorite/lib/index.cjs +29 -0
- package/dist/browser/components/favorite/lib/index.cjs.map +1 -0
- package/dist/browser/components/favorite/lib/index.d.cts +2 -0
- package/dist/browser/components/favorite/lib/index.d.cts.map +1 -0
- package/dist/browser/components/index.cjs +241 -0
- package/dist/browser/components/index.cjs.map +1 -0
- package/dist/browser/components/index.d.cts +4 -0
- package/dist/browser/components/index.d.cts.map +1 -0
- package/dist/browser/components/lib/FavoriteItemEvent.cjs +32 -0
- package/dist/{node/components/lib/FavoriteItemEvent.mjs.map → browser/components/lib/FavoriteItemEvent.cjs.map} +1 -1
- package/dist/browser/components/lib/FavoriteItemEvent.d.cts +9 -0
- package/dist/browser/components/lib/FavoriteItemEvent.d.cts.map +1 -0
- package/dist/browser/components/lib/index.cjs +34 -0
- package/dist/browser/components/lib/index.cjs.map +1 -0
- package/dist/browser/components/lib/index.d.cts +2 -0
- package/dist/browser/components/lib/index.d.cts.map +1 -0
- package/dist/browser/index.cjs +241 -0
- package/dist/browser/index.cjs.map +1 -0
- package/dist/browser/index.d.cts +2 -0
- package/dist/browser/index.d.cts.map +1 -0
- package/dist/docs.json +24106 -0
- package/dist/node/components/RenderRowBox.cjs +243 -0
- package/dist/node/components/RenderRowBox.cjs.map +1 -0
- package/dist/node/components/RenderRowBox.d.cts +14 -0
- package/dist/node/components/RenderRowBox.d.cts.map +1 -0
- package/dist/node/components/RenderRowBox.js +187 -42
- package/dist/node/components/RenderRowBox.js.map +1 -1
- package/dist/node/components/favorite/FavoriteIconButton.cjs +195 -0
- package/dist/node/components/favorite/FavoriteIconButton.cjs.map +1 -0
- package/dist/node/components/favorite/FavoriteIconButton.d.cts +12 -0
- package/dist/node/components/favorite/FavoriteIconButton.d.cts.map +1 -0
- package/dist/node/components/favorite/FavoriteIconButton.js +123 -47
- package/dist/node/components/favorite/FavoriteIconButton.js.map +1 -1
- package/dist/node/components/favorite/FavoriteToggleSVG.cjs +33 -0
- package/dist/node/components/favorite/FavoriteToggleSVG.cjs.map +1 -0
- package/dist/node/components/favorite/FavoriteToggleSVG.d.cts +5 -0
- package/dist/node/components/favorite/FavoriteToggleSVG.d.cts.map +1 -0
- package/dist/node/components/favorite/FavoriteToggleSVG.js +6 -29
- package/dist/node/components/favorite/FavoriteToggleSVG.js.map +1 -1
- package/dist/node/components/favorite/Popper.cjs +116 -0
- package/dist/node/components/favorite/Popper.cjs.map +1 -0
- package/dist/node/components/favorite/Popper.d.cts +11 -0
- package/dist/node/components/favorite/Popper.d.cts.map +1 -0
- package/dist/node/components/favorite/Popper.js +54 -41
- package/dist/node/components/favorite/Popper.js.map +1 -1
- package/dist/node/components/favorite/PopperButtonGroup.cjs +61 -0
- package/dist/node/components/favorite/{PopperButtonGroup.mjs.map → PopperButtonGroup.cjs.map} +1 -1
- package/dist/node/components/favorite/PopperButtonGroup.d.cts +9 -0
- package/dist/node/components/favorite/PopperButtonGroup.d.cts.map +1 -0
- package/dist/node/components/favorite/PopperButtonGroup.js +16 -39
- package/dist/node/components/favorite/PopperButtonGroup.js.map +1 -1
- package/dist/node/components/favorite/index.cjs +197 -0
- package/dist/node/components/favorite/index.cjs.map +1 -0
- package/dist/node/components/favorite/index.d.cts +2 -0
- package/dist/node/components/favorite/index.d.cts.map +1 -0
- package/dist/node/components/favorite/index.js +167 -20
- package/dist/node/components/favorite/index.js.map +1 -1
- package/dist/node/components/favorite/lib/PopperId.cjs +31 -0
- package/dist/node/components/favorite/lib/PopperId.cjs.map +1 -0
- package/dist/node/components/favorite/lib/PopperId.d.cts +2 -0
- package/dist/node/components/favorite/lib/PopperId.d.cts.map +1 -0
- package/dist/node/components/favorite/lib/PopperId.js +4 -27
- package/dist/node/components/favorite/lib/PopperId.js.map +1 -1
- package/dist/node/components/favorite/lib/index.cjs +33 -0
- package/dist/node/components/favorite/lib/index.cjs.map +1 -0
- package/dist/node/components/favorite/lib/index.d.cts +2 -0
- package/dist/node/components/favorite/lib/index.d.cts.map +1 -0
- package/dist/node/components/favorite/lib/index.js +4 -21
- package/dist/node/components/favorite/lib/index.js.map +1 -1
- package/dist/node/components/index.cjs +247 -0
- package/dist/node/components/index.cjs.map +1 -0
- package/dist/node/components/index.d.cts +4 -0
- package/dist/node/components/index.d.cts.map +1 -0
- package/dist/node/components/index.js +215 -24
- package/dist/node/components/index.js.map +1 -1
- package/dist/node/components/lib/FavoriteItemEvent.cjs +36 -0
- package/dist/node/components/lib/FavoriteItemEvent.cjs.map +1 -0
- package/dist/node/components/lib/FavoriteItemEvent.d.cts +9 -0
- package/dist/node/components/lib/FavoriteItemEvent.d.cts.map +1 -0
- package/dist/node/components/lib/FavoriteItemEvent.js +4 -27
- package/dist/node/components/lib/FavoriteItemEvent.js.map +1 -1
- package/dist/node/components/lib/index.cjs +38 -0
- package/dist/node/components/lib/index.cjs.map +1 -0
- package/dist/node/components/lib/index.d.cts +2 -0
- package/dist/node/components/lib/index.d.cts.map +1 -0
- package/dist/node/components/lib/index.js +9 -21
- package/dist/node/components/lib/index.js.map +1 -1
- package/dist/node/index.cjs +247 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +2 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.js +215 -20
- package/dist/node/index.js.map +1 -1
- package/package.json +20 -20
- package/dist/browser/components/RenderRowBox.stories.js +0 -81
- package/dist/browser/components/RenderRowBox.stories.js.map +0 -1
- package/dist/node/components/RenderRowBox.mjs +0 -49
- package/dist/node/components/RenderRowBox.mjs.map +0 -1
- package/dist/node/components/RenderRowBox.stories.js +0 -111
- package/dist/node/components/RenderRowBox.stories.js.map +0 -1
- package/dist/node/components/RenderRowBox.stories.mjs +0 -81
- package/dist/node/components/RenderRowBox.stories.mjs.map +0 -1
- package/dist/node/components/favorite/FavoriteIconButton.mjs +0 -70
- package/dist/node/components/favorite/FavoriteIconButton.mjs.map +0 -1
- package/dist/node/components/favorite/FavoriteToggleSVG.mjs +0 -7
- package/dist/node/components/favorite/Popper.mjs +0 -54
- package/dist/node/components/favorite/Popper.mjs.map +0 -1
- package/dist/node/components/favorite/PopperButtonGroup.mjs +0 -35
- package/dist/node/components/favorite/index.mjs +0 -2
- package/dist/node/components/favorite/index.mjs.map +0 -1
- package/dist/node/components/favorite/lib/PopperId.mjs +0 -5
- package/dist/node/components/favorite/lib/index.mjs +0 -2
- package/dist/node/components/favorite/lib/index.mjs.map +0 -1
- package/dist/node/components/index.mjs +0 -4
- package/dist/node/components/index.mjs.map +0 -1
- package/dist/node/components/lib/FavoriteItemEvent.mjs +0 -10
- package/dist/node/components/lib/index.mjs +0 -2
- package/dist/node/components/lib/index.mjs.map +0 -1
- package/dist/node/index.mjs +0 -2
- package/dist/node/index.mjs.map +0 -1
|
@@ -0,0 +1,112 @@
|
|
|
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/favorite/Popper.tsx
|
|
21
|
+
var Popper_exports = {};
|
|
22
|
+
__export(Popper_exports, {
|
|
23
|
+
FavoritePopper: () => FavoritePopper
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Popper_exports);
|
|
26
|
+
var import_material2 = require("@mui/material");
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
|
|
29
|
+
// src/components/favorite/lib/PopperId.ts
|
|
30
|
+
var popperId = "favorite-popper";
|
|
31
|
+
|
|
32
|
+
// src/components/favorite/PopperButtonGroup.tsx
|
|
33
|
+
var import_icons_material = require("@mui/icons-material");
|
|
34
|
+
var import_material = require("@mui/material");
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var PopperButtonGroup = ({ name, onConfirmFavorite, favorite, ...props }) => {
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.ButtonGroup, { ...props, children: [
|
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
39
|
+
import_material.Button,
|
|
40
|
+
{
|
|
41
|
+
title: "Save Favorite",
|
|
42
|
+
variant: "contained",
|
|
43
|
+
onClick: (e) => {
|
|
44
|
+
e.stopPropagation();
|
|
45
|
+
onConfirmFavorite?.(name, true);
|
|
46
|
+
},
|
|
47
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Star, {})
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
favorite ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
+
import_material.Button,
|
|
52
|
+
{
|
|
53
|
+
title: "Remove Favorite",
|
|
54
|
+
variant: "contained",
|
|
55
|
+
onClick: (e) => {
|
|
56
|
+
e.stopPropagation();
|
|
57
|
+
onConfirmFavorite?.(name, false);
|
|
58
|
+
},
|
|
59
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Delete, {})
|
|
60
|
+
}
|
|
61
|
+
) : null
|
|
62
|
+
] });
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/components/favorite/Popper.tsx
|
|
66
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
67
|
+
var FavoritePopper = (0, import_react.forwardRef)(
|
|
68
|
+
({
|
|
69
|
+
name: nameProp,
|
|
70
|
+
favorite,
|
|
71
|
+
favoriteRef,
|
|
72
|
+
onClickAway = () => {
|
|
73
|
+
return;
|
|
74
|
+
},
|
|
75
|
+
onConfirmFavorite,
|
|
76
|
+
...props
|
|
77
|
+
}, ref) => {
|
|
78
|
+
const [name, setName] = (0, import_react.useState)(nameProp);
|
|
79
|
+
(0, import_react.useEffect)(() => {
|
|
80
|
+
setName(nameProp);
|
|
81
|
+
}, [nameProp]);
|
|
82
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.ClickAwayListener, { onClickAway, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
83
|
+
PopperStyled,
|
|
84
|
+
{
|
|
85
|
+
id: popperId,
|
|
86
|
+
anchorEl: favoriteRef?.current,
|
|
87
|
+
onClick: (e) => e.stopPropagation(),
|
|
88
|
+
onTouchStart: (e) => e.stopPropagation(),
|
|
89
|
+
transition: true,
|
|
90
|
+
ref,
|
|
91
|
+
...props,
|
|
92
|
+
children: ({ TransitionProps }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Fade, { ...TransitionProps, timeout: 350, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material2.Card, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material2.CardContent, { sx: { display: "flex", gap: 1 }, children: [
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
94
|
+
import_material2.TextField,
|
|
95
|
+
{
|
|
96
|
+
autoFocus: true,
|
|
97
|
+
label: "Favorite Name",
|
|
98
|
+
placeholder: "optional",
|
|
99
|
+
size: "small",
|
|
100
|
+
value: name ?? "",
|
|
101
|
+
onChange: (e) => setName(e.target.value)
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PopperButtonGroup, { favorite, onConfirmFavorite, name })
|
|
105
|
+
] }) }) })
|
|
106
|
+
}
|
|
107
|
+
) });
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
FavoritePopper.displayName = "FavoritePopper";
|
|
111
|
+
var PopperStyled = (0, import_material2.styled)(import_material2.Popper, { name: "PopperStyled" })(() => ({ zIndex: 9999 }));
|
|
112
|
+
//# sourceMappingURL=Popper.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/favorite/Popper.tsx","../../../../src/components/favorite/lib/PopperId.ts","../../../../src/components/favorite/PopperButtonGroup.tsx"],"sourcesContent":["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","export const popperId = 'favorite-popper'\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,mBAAmG;AACnG,mBAA2D;;;ACDpD,IAAM,WAAW;;;ACAxB,4BAAuD;AACvD,sBAAsD;AAUlD;AAFG,IAAM,oBAAmD,CAAC,EAAE,MAAM,mBAAmB,UAAU,GAAG,MAAM,MAAM;AACnH,SACE,6CAAC,+BAAa,GAAG,OACf;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,SAAS,CAAC,MAAM;AACd,YAAE,gBAAgB;AAClB,8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AAoB,mBAAsC,MAAY;AAAA,WAC3F,GACF,GACF;AAAA;AAAA,IAEJ,GACF;AAAA,EAEJ;AACF;AAEA,eAAe,cAAc;AAG7B,IAAM,mBAAe,yBAAO,yBAAQ,EAAE,MAAM,eAAe,CAAC,EAAE,OAAO,EAAE,QAAQ,KAAK,EAAE;","names":["import_material","StarIcon","DeleteIcon","import_jsx_runtime"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PopperProps } from '@mui/material';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
export interface FavoritePopperProps extends PopperProps {
|
|
4
|
+
favorite?: boolean;
|
|
5
|
+
favoriteRef?: RefObject<HTMLElement>;
|
|
6
|
+
name?: string;
|
|
7
|
+
onClickAway?: (event: MouseEvent | TouchEvent) => void;
|
|
8
|
+
onConfirmFavorite?: (name?: string, newFavoriteState?: boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const FavoritePopper: import("react").ForwardRefExoticComponent<Omit<FavoritePopperProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
//# 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,EAAsD,WAAW,EAAqB,MAAM,eAAe,CAAA;AAClH,OAAO,EAAc,SAAS,EAAuB,MAAM,OAAO,CAAA;AAKlE,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,6HAmD1B,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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/favorite/PopperButtonGroup.tsx
|
|
21
|
+
var PopperButtonGroup_exports = {};
|
|
22
|
+
__export(PopperButtonGroup_exports, {
|
|
23
|
+
PopperButtonGroup: () => PopperButtonGroup
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(PopperButtonGroup_exports);
|
|
26
|
+
var import_icons_material = require("@mui/icons-material");
|
|
27
|
+
var import_material = require("@mui/material");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var PopperButtonGroup = ({ name, onConfirmFavorite, favorite, ...props }) => {
|
|
30
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.ButtonGroup, { ...props, children: [
|
|
31
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
32
|
+
import_material.Button,
|
|
33
|
+
{
|
|
34
|
+
title: "Save Favorite",
|
|
35
|
+
variant: "contained",
|
|
36
|
+
onClick: (e) => {
|
|
37
|
+
e.stopPropagation();
|
|
38
|
+
onConfirmFavorite?.(name, true);
|
|
39
|
+
},
|
|
40
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Star, {})
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
favorite ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
44
|
+
import_material.Button,
|
|
45
|
+
{
|
|
46
|
+
title: "Remove Favorite",
|
|
47
|
+
variant: "contained",
|
|
48
|
+
onClick: (e) => {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
onConfirmFavorite?.(name, false);
|
|
51
|
+
},
|
|
52
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Delete, {})
|
|
53
|
+
}
|
|
54
|
+
) : null
|
|
55
|
+
] });
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=PopperButtonGroup.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/favorite/PopperButtonGroup.tsx"],"sourcesContent":["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,4BAAuD;AACvD,sBAAsD;AAUlD;AAFG,IAAM,oBAAmD,CAAC,EAAE,MAAM,mBAAmB,UAAU,GAAG,MAAM,MAAM;AACnH,SACE,6CAAC,+BAAa,GAAG,OACf;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,SAAS,CAAC,MAAM;AACd,YAAE,gBAAgB;AAClB,8BAAoB,MAAM,IAAI;AAAA,QAChC;AAAA,QAEA,sDAAC,sBAAAA,MAAA,EAAS;AAAA;AAAA,IACZ;AAAA,IACC,WACC;AAAA,MAAC;AAAA;AAAA,QACC,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,SAAS,CAAC,MAAM;AACd,YAAE,gBAAgB;AAClB,8BAAoB,MAAM,KAAK;AAAA,QACjC;AAAA,QAEA,sDAAC,sBAAAC,QAAA,EAAW;AAAA;AAAA,IACd,IACE;AAAA,KACN;AAEJ;","names":["StarIcon","DeleteIcon"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ButtonGroupProps } from '@mui/material';
|
|
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,EAAuB,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErE,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,CA2B3D,CAAA"}
|
|
@@ -0,0 +1,193 @@
|
|
|
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/favorite/index.ts
|
|
21
|
+
var favorite_exports = {};
|
|
22
|
+
__export(favorite_exports, {
|
|
23
|
+
FavoriteIconButton: () => FavoriteIconButton
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(favorite_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/favorite/FavoriteIconButton.tsx
|
|
28
|
+
var import_material3 = require("@mui/material");
|
|
29
|
+
var import_react_event = require("@xyo-network/react-event");
|
|
30
|
+
var import_react_shared = require("@xyo-network/react-shared");
|
|
31
|
+
var import_react2 = require("react");
|
|
32
|
+
|
|
33
|
+
// src/components/lib/FavoriteItemEvent.ts
|
|
34
|
+
var generateFavoriteEvent = (favorite, favoriteType, favoriteValue, name) => ({
|
|
35
|
+
favorite: !!favorite,
|
|
36
|
+
favoriteType,
|
|
37
|
+
favoriteValue,
|
|
38
|
+
name
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// src/components/favorite/FavoriteToggleSVG.tsx
|
|
42
|
+
var import_icons_material = require("@mui/icons-material");
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
+
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" }) });
|
|
45
|
+
|
|
46
|
+
// src/components/favorite/lib/PopperId.ts
|
|
47
|
+
var popperId = "favorite-popper";
|
|
48
|
+
|
|
49
|
+
// src/components/favorite/Popper.tsx
|
|
50
|
+
var import_material2 = require("@mui/material");
|
|
51
|
+
var import_react = require("react");
|
|
52
|
+
|
|
53
|
+
// src/components/favorite/PopperButtonGroup.tsx
|
|
54
|
+
var import_icons_material2 = require("@mui/icons-material");
|
|
55
|
+
var import_material = require("@mui/material");
|
|
56
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
57
|
+
var PopperButtonGroup = ({ name, onConfirmFavorite, favorite, ...props }) => {
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material.ButtonGroup, { ...props, children: [
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
60
|
+
import_material.Button,
|
|
61
|
+
{
|
|
62
|
+
title: "Save Favorite",
|
|
63
|
+
variant: "contained",
|
|
64
|
+
onClick: (e) => {
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
onConfirmFavorite?.(name, true);
|
|
67
|
+
},
|
|
68
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material2.Star, {})
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
favorite ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
72
|
+
import_material.Button,
|
|
73
|
+
{
|
|
74
|
+
title: "Remove Favorite",
|
|
75
|
+
variant: "contained",
|
|
76
|
+
onClick: (e) => {
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
onConfirmFavorite?.(name, false);
|
|
79
|
+
},
|
|
80
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material2.Delete, {})
|
|
81
|
+
}
|
|
82
|
+
) : null
|
|
83
|
+
] });
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// src/components/favorite/Popper.tsx
|
|
87
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
88
|
+
var FavoritePopper = (0, import_react.forwardRef)(
|
|
89
|
+
({
|
|
90
|
+
name: nameProp,
|
|
91
|
+
favorite,
|
|
92
|
+
favoriteRef,
|
|
93
|
+
onClickAway = () => {
|
|
94
|
+
return;
|
|
95
|
+
},
|
|
96
|
+
onConfirmFavorite,
|
|
97
|
+
...props
|
|
98
|
+
}, ref) => {
|
|
99
|
+
const [name, setName] = (0, import_react.useState)(nameProp);
|
|
100
|
+
(0, import_react.useEffect)(() => {
|
|
101
|
+
setName(nameProp);
|
|
102
|
+
}, [nameProp]);
|
|
103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material2.ClickAwayListener, { onClickAway, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
104
|
+
PopperStyled,
|
|
105
|
+
{
|
|
106
|
+
id: popperId,
|
|
107
|
+
anchorEl: favoriteRef?.current,
|
|
108
|
+
onClick: (e) => e.stopPropagation(),
|
|
109
|
+
onTouchStart: (e) => e.stopPropagation(),
|
|
110
|
+
transition: true,
|
|
111
|
+
ref,
|
|
112
|
+
...props,
|
|
113
|
+
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: [
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
115
|
+
import_material2.TextField,
|
|
116
|
+
{
|
|
117
|
+
autoFocus: true,
|
|
118
|
+
label: "Favorite Name",
|
|
119
|
+
placeholder: "optional",
|
|
120
|
+
size: "small",
|
|
121
|
+
value: name ?? "",
|
|
122
|
+
onChange: (e) => setName(e.target.value)
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PopperButtonGroup, { favorite, onConfirmFavorite, name })
|
|
126
|
+
] }) }) })
|
|
127
|
+
}
|
|
128
|
+
) });
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
FavoritePopper.displayName = "FavoritePopper";
|
|
132
|
+
var PopperStyled = (0, import_material2.styled)(import_material2.Popper, { name: "PopperStyled" })(() => ({ zIndex: 9999 }));
|
|
133
|
+
|
|
134
|
+
// src/components/favorite/FavoriteIconButton.tsx
|
|
135
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
136
|
+
var FavoriteIconButton = (0, import_react2.forwardRef)(
|
|
137
|
+
({ children, favorite: favoriteProp, name, valueType, value, ...props }, ref) => {
|
|
138
|
+
const [openPopper, setOpenPopper] = (0, import_react2.useState)(false);
|
|
139
|
+
const [favorite, setFavorite] = (0, import_react2.useState)(favoriteProp);
|
|
140
|
+
(0, import_react2.useEffect)(() => {
|
|
141
|
+
setFavorite(favoriteProp);
|
|
142
|
+
}, [favoriteProp]);
|
|
143
|
+
const sharedRef = (0, import_react_shared.useShareForwardedRef)(ref);
|
|
144
|
+
const [buttonRef, dispatch] = (0, import_react_event.useEvent)(void 0, sharedRef);
|
|
145
|
+
const onConfirmFavorite = (name2, newFavoriteState) => {
|
|
146
|
+
const favoriteEvent = generateFavoriteEvent(!!newFavoriteState, valueType, value, name2);
|
|
147
|
+
dispatch("address", "favorite", JSON.stringify(favoriteEvent));
|
|
148
|
+
setFavorite(newFavoriteState);
|
|
149
|
+
setOpenPopper(false);
|
|
150
|
+
};
|
|
151
|
+
const starRef = (0, import_react2.useRef)(null);
|
|
152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
153
|
+
IconButtonCondensed,
|
|
154
|
+
{
|
|
155
|
+
"aria-describedby": popperId,
|
|
156
|
+
ref: buttonRef,
|
|
157
|
+
onClick: (event) => {
|
|
158
|
+
event.stopPropagation();
|
|
159
|
+
setOpenPopper(!openPopper);
|
|
160
|
+
},
|
|
161
|
+
onTouchStart: (event) => {
|
|
162
|
+
event.stopPropagation();
|
|
163
|
+
setOpenPopper(!openPopper);
|
|
164
|
+
},
|
|
165
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
166
|
+
sx: { lineHeight: 0, p: 0.25 },
|
|
167
|
+
...props,
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { ref: starRef, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FavoriteToggleSVG, { favorite }) }),
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
171
|
+
FavoritePopper,
|
|
172
|
+
{
|
|
173
|
+
sx: { zIndex: 1301 },
|
|
174
|
+
name,
|
|
175
|
+
favorite,
|
|
176
|
+
favoriteRef: starRef,
|
|
177
|
+
open: openPopper,
|
|
178
|
+
onConfirmFavorite,
|
|
179
|
+
onClickAway: () => setOpenPopper(false)
|
|
180
|
+
}
|
|
181
|
+
),
|
|
182
|
+
children
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
FavoriteIconButton.displayName = "FavoriteIconButton";
|
|
189
|
+
var IconButtonCondensed = (0, import_material3.styled)(import_material3.IconButton, { name: "IconButtonCondensed" })(({ theme }) => ({
|
|
190
|
+
lineHeight: 0,
|
|
191
|
+
padding: theme.spacing(0.25)
|
|
192
|
+
}));
|
|
193
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/favorite/index.ts","../../../../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":["export * from './FavoriteIconButton'\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;;;ACAA,IAAAA,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,CA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AACvB,gBAAM,gBAAgB;AACtB,wBAAc,CAAC,UAAU;AAAA,QAC3B;AAAA,QACA,aAAa,CAAC,MAAM,EAAE,gBAAgB;AAAA,QACtC,IAAI,EAAE,YAAY,GAAG,GAAG,KAAK;AAAA,QAC5B,GAAG;AAAA,QAEJ;AAAA,uDAAC,UAAK,KAAK,SACT,uDAAC,qBAAkB,UAAoB,GACzC;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,IAAI,EAAE,QAAQ,KAAK;AAAA,cACnB;AAAA,cACA;AAAA,cACA,aAAa;AAAA,cACb,MAAM;AAAA,cACN;AAAA,cACA,aAAa,MAAM,cAAc,KAAK;AAAA;AAAA,UACxC;AAAA,UACC;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,mBAAmB,cAAc;AAEjC,IAAM,0BAAsB,yBAAO,6BAAY,EAAE,MAAM,sBAAsB,CAAC,EAAE,CAAC,EAAE,MAAM,OAAO;AAAA,EAC9F,YAAY;AAAA,EACZ,SAAS,MAAM,QAAQ,IAAI;AAC7B,EAAE;","names":["import_material","import_react","StarIcon","StarBorderIcon","import_material","import_icons_material","import_jsx_runtime","StarIcon","DeleteIcon","import_jsx_runtime","import_jsx_runtime","name"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/favorite/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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/favorite/lib/PopperId.ts
|
|
21
|
+
var PopperId_exports = {};
|
|
22
|
+
__export(PopperId_exports, {
|
|
23
|
+
popperId: () => popperId
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(PopperId_exports);
|
|
26
|
+
var popperId = "favorite-popper";
|
|
27
|
+
//# sourceMappingURL=PopperId.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/components/favorite/lib/PopperId.ts"],"sourcesContent":["export const popperId = 'favorite-popper'\n"],"mappings":"AAAO,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/favorite/lib/PopperId.ts"],"sourcesContent":["export const popperId = 'favorite-popper'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,WAAW;","names":[]}
|
|
@@ -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,29 @@
|
|
|
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/favorite/lib/index.ts
|
|
21
|
+
var lib_exports = {};
|
|
22
|
+
__export(lib_exports, {
|
|
23
|
+
popperId: () => popperId
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(lib_exports);
|
|
26
|
+
|
|
27
|
+
// src/components/favorite/lib/PopperId.ts
|
|
28
|
+
var popperId = "favorite-popper";
|
|
29
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/favorite/lib/index.ts","../../../../../src/components/favorite/lib/PopperId.ts"],"sourcesContent":["export * from './PopperId'\n","export const popperId = 'favorite-popper'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,WAAW;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/favorite/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|