@xyo-network/react-wallet 2.64.0 → 2.64.3
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/MaxAccounts/MaxAccountsTableRow.js +41 -11
- package/dist/browser/components/MaxAccounts/MaxAccountsTableRow.js.map +1 -1
- package/dist/browser/components/MaxAccounts/OutOfBoundsSnackBar.js +3 -2
- package/dist/browser/components/MaxAccounts/OutOfBoundsSnackBar.js.map +1 -1
- package/dist/browser/components/MaxAccounts/index.js +88 -1
- package/dist/browser/components/MaxAccounts/index.js.map +1 -1
- package/dist/browser/components/SeedPhrase/DefaultSeedPhrase.js +3 -2
- package/dist/browser/components/SeedPhrase/DefaultSeedPhrase.js.map +1 -1
- package/dist/browser/components/SeedPhrase/_shared/SeedPhraseIconButton.js +3 -2
- package/dist/browser/components/SeedPhrase/_shared/SeedPhraseIconButton.js.map +1 -1
- package/dist/browser/components/SeedPhrase/_shared/index.js +45 -1
- package/dist/browser/components/SeedPhrase/_shared/index.js.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/SeedPhraseDialog.js +295 -16
- package/dist/browser/components/SeedPhrase/dialog/SeedPhraseDialog.js.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/DialogActionButtons.js +13 -3
- package/dist/browser/components/SeedPhrase/dialog/components/DialogActionButtons.js.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/OverwriteWarning.js +13 -3
- package/dist/browser/components/SeedPhrase/dialog/components/OverwriteWarning.js.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.js +74 -12
- package/dist/browser/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.js.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.js +60 -10
- package/dist/browser/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.js.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/index.js +125 -2
- package/dist/browser/components/SeedPhrase/dialog/components/fields/index.js.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.js +3 -2
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.js.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.js +3 -2
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.js.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.js +2 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.js.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/index.js +57 -3
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/index.js.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/index.js +164 -3
- package/dist/browser/components/SeedPhrase/dialog/components/index.js.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/index.js +315 -1
- package/dist/browser/components/SeedPhrase/dialog/index.js.map +1 -1
- package/dist/browser/components/SeedPhrase/index.js +373 -4
- package/dist/browser/components/SeedPhrase/index.js.map +1 -1
- package/dist/browser/components/SeedPhrase/settings/SeedPhraseTableRow.js +325 -12
- package/dist/browser/components/SeedPhrase/settings/SeedPhraseTableRow.js.map +1 -1
- package/dist/browser/components/SeedPhrase/settings/index.js +339 -1
- package/dist/browser/components/SeedPhrase/settings/index.js.map +1 -1
- package/dist/browser/components/WalletAccountDetails/WalletAccountDetails.js +62 -3
- package/dist/browser/components/WalletAccountDetails/WalletAccountDetails.js.map +1 -1
- package/dist/browser/components/WalletAccountDetails/index.js +83 -1
- package/dist/browser/components/WalletAccountDetails/index.js.map +1 -1
- package/dist/browser/components/WalletAccountSelect/Select.js +70 -5
- package/dist/browser/components/WalletAccountSelect/Select.js.map +1 -1
- package/dist/browser/components/WalletAccountSelect/SelectBar.js +150 -4
- package/dist/browser/components/WalletAccountSelect/SelectBar.js.map +1 -1
- package/dist/browser/components/WalletAccountSelect/WalletInfo.js +116 -10
- package/dist/browser/components/WalletAccountSelect/WalletInfo.js.map +1 -1
- package/dist/browser/components/WalletAccountSelect/index.js +175 -2
- package/dist/browser/components/WalletAccountSelect/index.js.map +1 -1
- package/dist/browser/components/index.js +694 -4
- package/dist/browser/components/index.js.map +1 -1
- package/dist/browser/contexts/SeedPhrase/Context.js +2 -1
- package/dist/browser/contexts/SeedPhrase/Context.js.map +1 -1
- package/dist/browser/contexts/SeedPhrase/Provider.js +9 -3
- package/dist/browser/contexts/SeedPhrase/Provider.js.map +1 -1
- package/dist/browser/contexts/SeedPhrase/index.js +91 -4
- package/dist/browser/contexts/SeedPhrase/index.js.map +1 -1
- package/dist/browser/contexts/SeedPhrase/use.js +8 -2
- package/dist/browser/contexts/SeedPhrase/use.js.map +1 -1
- package/dist/browser/contexts/Wallet/Context.js +2 -1
- package/dist/browser/contexts/Wallet/Context.js.map +1 -1
- package/dist/browser/contexts/Wallet/Provider.js +90 -7
- package/dist/browser/contexts/Wallet/Provider.js.map +1 -1
- package/dist/browser/contexts/Wallet/index.js +183 -5
- package/dist/browser/contexts/Wallet/index.js.map +1 -1
- package/dist/browser/contexts/Wallet/lib/WalletPath.js +4 -3
- package/dist/browser/contexts/Wallet/lib/WalletPath.js.map +1 -1
- package/dist/browser/contexts/Wallet/lib/index.js +21 -1
- package/dist/browser/contexts/Wallet/lib/index.js.map +1 -1
- package/dist/browser/contexts/Wallet/use.js +13 -7
- package/dist/browser/contexts/Wallet/use.js.map +1 -1
- package/dist/browser/contexts/Wallet/usePromise.js +2 -1
- package/dist/browser/contexts/Wallet/usePromise.js.map +1 -1
- package/dist/browser/contexts/index.js +273 -2
- package/dist/browser/contexts/index.js.map +1 -1
- package/dist/browser/hooks/index.js +147 -4
- package/dist/browser/hooks/index.js.map +1 -1
- package/dist/browser/hooks/useAccount.js +24 -4
- package/dist/browser/hooks/useAccount.js.map +1 -1
- package/dist/browser/hooks/useWallet.js +38 -4
- package/dist/browser/hooks/useWallet.js.map +1 -1
- package/dist/browser/hooks/useWallets.js +69 -4
- package/dist/browser/hooks/useWallets.js.map +1 -1
- package/dist/browser/hooks/useWrapperAccount.js +4 -3
- package/dist/browser/hooks/useWrapperAccount.js.map +1 -1
- package/dist/browser/index.js +890 -3
- package/dist/browser/index.js.map +1 -1
- package/dist/docs.json +147 -147
- package/package.json +22 -22
|
@@ -1,22 +1,72 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.tsx
|
|
2
2
|
import { Chip, FormControl, FormLabel, TextField } from "@mui/material";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
|
|
5
|
+
// src/contexts/SeedPhrase/Context.ts
|
|
6
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
|
7
|
+
var SeedPhraseContext = createContextEx();
|
|
8
|
+
|
|
9
|
+
// src/contexts/SeedPhrase/use.tsx
|
|
10
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
|
11
|
+
var useSeedPhrase = () => useContextEx(SeedPhraseContext, "SeedPhrase", true);
|
|
12
|
+
|
|
13
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx
|
|
14
|
+
import { Link, Typography } from "@mui/material";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
var InvalidPhraseTypography = (props) => /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "error", ...props, children: [
|
|
17
|
+
"Invalid seed phrase. See -",
|
|
18
|
+
" ",
|
|
19
|
+
/* @__PURE__ */ jsx(Link, { target: "_blank", href: "https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki", children: "bip39 Proposal" })
|
|
20
|
+
] });
|
|
21
|
+
|
|
22
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx
|
|
23
|
+
import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from "@mui/icons-material";
|
|
24
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
|
25
|
+
import { useMemo } from "react";
|
|
26
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
27
|
+
var PhraseHeaderBox = ({ children, conditional, ...props }) => {
|
|
28
|
+
const state = useMemo(() => {
|
|
29
|
+
switch (conditional) {
|
|
30
|
+
case true:
|
|
31
|
+
return "success";
|
|
32
|
+
case false:
|
|
33
|
+
return "error";
|
|
34
|
+
default:
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}, [conditional]);
|
|
38
|
+
const Icon = useMemo(() => {
|
|
39
|
+
switch (state) {
|
|
40
|
+
case "success":
|
|
41
|
+
return /* @__PURE__ */ jsx2(CheckCircleOutlineIcon, { fontSize: "small", color: "success" });
|
|
42
|
+
case "error":
|
|
43
|
+
return /* @__PURE__ */ jsx2(HighlightOffIcon, { fontSize: "small", color: "error" });
|
|
44
|
+
default:
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}, [state]);
|
|
48
|
+
return /* @__PURE__ */ jsxs2(FlexRow, { justifyContent: "start", columnGap: 1, ...props, children: [
|
|
49
|
+
Icon,
|
|
50
|
+
children
|
|
51
|
+
] });
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.tsx
|
|
55
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
56
|
+
var SavedPhraseTextField = (props) => {
|
|
7
57
|
const { validSeedPhrase, seedPhrase } = useSeedPhrase();
|
|
8
58
|
const [visible, setVisible] = useState(false);
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
visible ? /* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ jsxs3(FormControl, { fullWidth: true, size: "small", sx: { display: "flex", flexDirection: "column", rowGap: 1 }, children: [
|
|
60
|
+
/* @__PURE__ */ jsx3(Chip, { label: visible ? "Hide Saved Seed Phrase" : "Reveal Saved Seed Phrase", onClick: () => setVisible(!visible) }),
|
|
61
|
+
visible ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
62
|
+
/* @__PURE__ */ jsx3(FormLabel, { children: /* @__PURE__ */ jsx3(PhraseHeaderBox, { conditional: validSeedPhrase, children: "Saved Seed Phrase" }) }),
|
|
63
|
+
/* @__PURE__ */ jsx3(
|
|
14
64
|
TextField,
|
|
15
65
|
{
|
|
16
66
|
defaultValue: seedPhrase,
|
|
17
67
|
disabled: true,
|
|
18
68
|
error: validSeedPhrase === false,
|
|
19
|
-
helperText: validSeedPhrase === false ? /* @__PURE__ */
|
|
69
|
+
helperText: validSeedPhrase === false ? /* @__PURE__ */ jsx3(InvalidPhraseTypography, {}) : null,
|
|
20
70
|
fullWidth: true,
|
|
21
71
|
maxRows: Infinity,
|
|
22
72
|
multiline: true,
|
package/dist/browser/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.tsx"],"sourcesContent":["import { Chip, FormControl, FormLabel, StandardTextFieldProps, TextField } from '@mui/material'\nimport { useState } from 'react'\n\nimport { useSeedPhrase } from '../../../../../contexts'\nimport { InvalidPhraseTypography, PhraseHeaderBox } from './validation-messages'\n\nexport const SavedPhraseTextField: React.FC<StandardTextFieldProps> = (props) => {\n const { validSeedPhrase, seedPhrase } = useSeedPhrase()\n\n const [visible, setVisible] = useState(false)\n\n return (\n <FormControl fullWidth size=\"small\" sx={{ display: 'flex', flexDirection: 'column', rowGap: 1 }}>\n <Chip label={visible ? 'Hide Saved Seed Phrase' : 'Reveal Saved Seed Phrase'} onClick={() => setVisible(!visible)} />\n {visible ? (\n <>\n <FormLabel>\n <PhraseHeaderBox conditional={validSeedPhrase}>Saved Seed Phrase</PhraseHeaderBox>\n </FormLabel>\n <TextField\n defaultValue={seedPhrase}\n disabled\n error={validSeedPhrase === false}\n helperText={validSeedPhrase === false ? <InvalidPhraseTypography /> : null}\n fullWidth\n maxRows={Infinity}\n multiline\n {...props}\n />\n </>\n ) : null}\n </FormControl>\n )\n}\n"
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.tsx","../../../../../../../src/contexts/SeedPhrase/Context.ts","../../../../../../../src/contexts/SeedPhrase/use.tsx","../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx","../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx"],"sourcesContent":["import { Chip, FormControl, FormLabel, StandardTextFieldProps, TextField } from '@mui/material'\nimport { useState } from 'react'\n\nimport { useSeedPhrase } from '../../../../../contexts'\nimport { InvalidPhraseTypography, PhraseHeaderBox } from './validation-messages'\n\nexport const SavedPhraseTextField: React.FC<StandardTextFieldProps> = (props) => {\n const { validSeedPhrase, seedPhrase } = useSeedPhrase()\n\n const [visible, setVisible] = useState(false)\n\n return (\n <FormControl fullWidth size=\"small\" sx={{ display: 'flex', flexDirection: 'column', rowGap: 1 }}>\n <Chip label={visible ? 'Hide Saved Seed Phrase' : 'Reveal Saved Seed Phrase'} onClick={() => setVisible(!visible)} />\n {visible ? (\n <>\n <FormLabel>\n <PhraseHeaderBox conditional={validSeedPhrase}>Saved Seed Phrase</PhraseHeaderBox>\n </FormLabel>\n <TextField\n defaultValue={seedPhrase}\n disabled\n error={validSeedPhrase === false}\n helperText={validSeedPhrase === false ? <InvalidPhraseTypography /> : null}\n fullWidth\n maxRows={Infinity}\n multiline\n {...props}\n />\n </>\n ) : null}\n </FormControl>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SeedPhraseContextState } from './State'\n\nexport const SeedPhraseContext = createContextEx<SeedPhraseContextState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SeedPhraseContext } from './Context'\n\nexport const useSeedPhrase = () => useContextEx(SeedPhraseContext, 'SeedPhrase', true)\n","import { Link, Typography, TypographyProps } from '@mui/material'\n\nexport const InvalidPhraseTypography: React.FC<TypographyProps> = (props) => (\n <Typography variant={'caption'} color={'error'} {...props}>\n Invalid seed phrase. See -{' '}\n <Link target={'_blank'} href=\"https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\">\n bip39 Proposal\n </Link>\n </Typography>\n)\n","import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from '@mui/icons-material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useMemo } from 'react'\n\ninterface PhraseHeaderBox extends FlexBoxProps, WithChildren {\n conditional?: boolean | null\n}\n\nexport const PhraseHeaderBox: React.FC<PhraseHeaderBox> = ({ children, conditional, ...props }) => {\n const state = useMemo(() => {\n switch (conditional) {\n case true:\n return 'success'\n case false:\n return 'error'\n default:\n return null\n }\n }, [conditional])\n\n const Icon = useMemo(() => {\n switch (state) {\n case 'success':\n return <CheckCircleOutlineIcon fontSize=\"small\" color=\"success\" />\n case 'error':\n return <HighlightOffIcon fontSize=\"small\" color=\"error\" />\n default:\n return null\n }\n }, [state])\n\n return (\n <FlexRow justifyContent={'start'} columnGap={1} {...props}>\n {Icon}\n {children}\n </FlexRow>\n )\n}\n"],"mappings":";AAAA,SAAS,MAAM,aAAa,WAAmC,iBAAiB;AAChF,SAAS,gBAAgB;;;ACDzB,SAAS,uBAAuB;AAIzB,IAAM,oBAAoB,gBAAwC;;;ACJzE,SAAS,oBAAoB;AAItB,IAAM,gBAAgB,MAAM,aAAa,mBAAmB,cAAc,IAAI;;;ACJrF,SAAS,MAAM,kBAAmC;AAGhD,SAEE,KAFF;AADK,IAAM,0BAA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A2B,4BAA4B,SAAS,MAAM,WAAW,CAAC,OAAO,GAAG;AAAA,IAClH,UACC,gBAAAC,MAAA,YACE;AAAA,sBAAAD,KAAC,aACC,0BAAAA,KAAC,mBAAgB,aAAa,iBAAiB,+BAAiB,GAClE;AAAA,MACA,gBAAAA;AAAA,QAAC;AAAA;AAAA,UACC,cAAc;AAAA,UACd,UAAQ;AAAA,UACR,OAAO,oBAAoB;AAAA,UAC3B,YAAY,oBAAoB,QAAQ,gBAAAA,KAAC,2BAAwB,IAAK;AAAA,UACtE,WAAS;AAAA,UACT,SAAS;AAAA,UACT,WAAS;AAAA,UACR,GAAG;AAAA;AAAA,MACN;AAAA,OACF,IACE;AAAA,KACN;AAEJ;","names":["jsx","jsxs","jsx","jsxs"]}
|
|
@@ -1,3 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx
|
|
2
|
+
import { Button, DialogActions, FormControl, FormLabel, TextField } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
// src/contexts/SeedPhrase/Context.ts
|
|
5
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
|
6
|
+
var SeedPhraseContext = createContextEx();
|
|
7
|
+
|
|
8
|
+
// src/contexts/SeedPhrase/use.tsx
|
|
9
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
|
10
|
+
var useSeedPhrase = () => useContextEx(SeedPhraseContext, "SeedPhrase", true);
|
|
11
|
+
|
|
12
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.ts
|
|
13
|
+
var colorParser = (conditional) => {
|
|
14
|
+
switch (conditional) {
|
|
15
|
+
case true:
|
|
16
|
+
return "success";
|
|
17
|
+
case false:
|
|
18
|
+
return "error";
|
|
19
|
+
default:
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx
|
|
25
|
+
import { Link, Typography } from "@mui/material";
|
|
26
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
27
|
+
var InvalidPhraseTypography = (props) => /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "error", ...props, children: [
|
|
28
|
+
"Invalid seed phrase. See -",
|
|
29
|
+
" ",
|
|
30
|
+
/* @__PURE__ */ jsx(Link, { target: "_blank", href: "https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki", children: "bip39 Proposal" })
|
|
31
|
+
] });
|
|
32
|
+
|
|
33
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx
|
|
34
|
+
import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from "@mui/icons-material";
|
|
35
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
|
36
|
+
import { useMemo } from "react";
|
|
37
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
38
|
+
var PhraseHeaderBox = ({ children, conditional, ...props }) => {
|
|
39
|
+
const state = useMemo(() => {
|
|
40
|
+
switch (conditional) {
|
|
41
|
+
case true:
|
|
42
|
+
return "success";
|
|
43
|
+
case false:
|
|
44
|
+
return "error";
|
|
45
|
+
default:
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}, [conditional]);
|
|
49
|
+
const Icon = useMemo(() => {
|
|
50
|
+
switch (state) {
|
|
51
|
+
case "success":
|
|
52
|
+
return /* @__PURE__ */ jsx2(CheckCircleOutlineIcon, { fontSize: "small", color: "success" });
|
|
53
|
+
case "error":
|
|
54
|
+
return /* @__PURE__ */ jsx2(HighlightOffIcon, { fontSize: "small", color: "error" });
|
|
55
|
+
default:
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}, [state]);
|
|
59
|
+
return /* @__PURE__ */ jsxs2(FlexRow, { justifyContent: "start", columnGap: 1, ...props, children: [
|
|
60
|
+
Icon,
|
|
61
|
+
children
|
|
62
|
+
] });
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx
|
|
66
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
67
|
+
var NewPhraseTextField = (props) => {
|
|
68
|
+
const { handleClear, handleGenerate, overwriteWarning, phrase, setPhrase, validPhrase } = useSeedPhrase();
|
|
69
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
70
|
+
/* @__PURE__ */ jsxs3(FormControl, { fullWidth: true, size: "small", sx: { display: "flex", flexDirection: "column", rowGap: 1 }, children: [
|
|
71
|
+
/* @__PURE__ */ jsx3(FormLabel, { children: /* @__PURE__ */ jsx3(PhraseHeaderBox, { conditional: validPhrase, children: "New Seed Phrase" }) }),
|
|
72
|
+
/* @__PURE__ */ jsx3(
|
|
73
|
+
TextField,
|
|
74
|
+
{
|
|
75
|
+
focused: true,
|
|
76
|
+
color: colorParser(validPhrase),
|
|
77
|
+
error: validPhrase === false,
|
|
78
|
+
helperText: validPhrase === false ? /* @__PURE__ */ jsx3(InvalidPhraseTypography, {}) : null,
|
|
79
|
+
fullWidth: true,
|
|
80
|
+
maxRows: Infinity,
|
|
81
|
+
multiline: true,
|
|
82
|
+
onChange: (e) => setPhrase?.(e.target.value),
|
|
83
|
+
value: phrase,
|
|
84
|
+
...props
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] }),
|
|
88
|
+
/* @__PURE__ */ jsxs3(DialogActions, { sx: { justifyContent: "center" }, children: [
|
|
89
|
+
/* @__PURE__ */ jsx3(Button, { disabled: overwriteWarning, variant: "outlined", onClick: handleGenerate, children: "Generate" }),
|
|
90
|
+
/* @__PURE__ */ jsx3(Button, { variant: "outlined", onClick: handleClear, children: "Clear" })
|
|
91
|
+
] })
|
|
92
|
+
] });
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// src/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.tsx
|
|
96
|
+
import { Chip, FormControl as FormControl2, FormLabel as FormLabel2, TextField as TextField2 } from "@mui/material";
|
|
97
|
+
import { useState } from "react";
|
|
98
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
99
|
+
var SavedPhraseTextField = (props) => {
|
|
100
|
+
const { validSeedPhrase, seedPhrase } = useSeedPhrase();
|
|
101
|
+
const [visible, setVisible] = useState(false);
|
|
102
|
+
return /* @__PURE__ */ jsxs4(FormControl2, { fullWidth: true, size: "small", sx: { display: "flex", flexDirection: "column", rowGap: 1 }, children: [
|
|
103
|
+
/* @__PURE__ */ jsx4(Chip, { label: visible ? "Hide Saved Seed Phrase" : "Reveal Saved Seed Phrase", onClick: () => setVisible(!visible) }),
|
|
104
|
+
visible ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
105
|
+
/* @__PURE__ */ jsx4(FormLabel2, { children: /* @__PURE__ */ jsx4(PhraseHeaderBox, { conditional: validSeedPhrase, children: "Saved Seed Phrase" }) }),
|
|
106
|
+
/* @__PURE__ */ jsx4(
|
|
107
|
+
TextField2,
|
|
108
|
+
{
|
|
109
|
+
defaultValue: seedPhrase,
|
|
110
|
+
disabled: true,
|
|
111
|
+
error: validSeedPhrase === false,
|
|
112
|
+
helperText: validSeedPhrase === false ? /* @__PURE__ */ jsx4(InvalidPhraseTypography, {}) : null,
|
|
113
|
+
fullWidth: true,
|
|
114
|
+
maxRows: Infinity,
|
|
115
|
+
multiline: true,
|
|
116
|
+
...props
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] }) : null
|
|
120
|
+
] });
|
|
121
|
+
};
|
|
122
|
+
export {
|
|
123
|
+
NewPhraseTextField,
|
|
124
|
+
SavedPhraseTextField
|
|
125
|
+
};
|
|
3
126
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/components/SeedPhrase/dialog/components/fields/
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx","../../../../../../../src/contexts/SeedPhrase/Context.ts","../../../../../../../src/contexts/SeedPhrase/use.tsx","../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.ts","../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx","../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx","../../../../../../../src/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.tsx"],"sourcesContent":["import { Button, DialogActions, FormControl, FormLabel, StandardTextFieldProps, TextField } from '@mui/material'\n\nimport { useSeedPhrase } from '../../../../../contexts'\nimport { colorParser, InvalidPhraseTypography, PhraseHeaderBox } from './validation-messages'\n\nexport const NewPhraseTextField: React.FC<StandardTextFieldProps> = (props) => {\n const { handleClear, handleGenerate, overwriteWarning, phrase, setPhrase, validPhrase } = useSeedPhrase()\n return (\n <>\n <FormControl fullWidth size=\"small\" sx={{ display: 'flex', flexDirection: 'column', rowGap: 1 }}>\n <FormLabel>\n <PhraseHeaderBox conditional={validPhrase}>New Seed Phrase</PhraseHeaderBox>\n </FormLabel>\n <TextField\n focused\n color={colorParser(validPhrase)}\n error={validPhrase === false}\n helperText={validPhrase === false ? <InvalidPhraseTypography /> : null}\n fullWidth\n maxRows={Infinity}\n multiline\n onChange={(e) => setPhrase?.(e.target.value)}\n value={phrase}\n {...props}\n />\n </FormControl>\n <DialogActions sx={{ justifyContent: 'center' }}>\n <Button disabled={overwriteWarning} variant=\"outlined\" onClick={handleGenerate}>\n Generate\n </Button>\n <Button variant=\"outlined\" onClick={handleClear}>\n Clear\n </Button>\n </DialogActions>\n </>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SeedPhraseContextState } from './State'\n\nexport const SeedPhraseContext = createContextEx<SeedPhraseContextState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SeedPhraseContext } from './Context'\n\nexport const useSeedPhrase = () => useContextEx(SeedPhraseContext, 'SeedPhrase', true)\n","export const colorParser = (conditional?: boolean | null) => {\n switch (conditional) {\n case true:\n return 'success'\n case false:\n return 'error'\n default:\n return undefined\n }\n}\n","import { Link, Typography, TypographyProps } from '@mui/material'\n\nexport const InvalidPhraseTypography: React.FC<TypographyProps> = (props) => (\n <Typography variant={'caption'} color={'error'} {...props}>\n Invalid seed phrase. See -{' '}\n <Link target={'_blank'} href=\"https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\">\n bip39 Proposal\n </Link>\n </Typography>\n)\n","import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from '@mui/icons-material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useMemo } from 'react'\n\ninterface PhraseHeaderBox extends FlexBoxProps, WithChildren {\n conditional?: boolean | null\n}\n\nexport const PhraseHeaderBox: React.FC<PhraseHeaderBox> = ({ children, conditional, ...props }) => {\n const state = useMemo(() => {\n switch (conditional) {\n case true:\n return 'success'\n case false:\n return 'error'\n default:\n return null\n }\n }, [conditional])\n\n const Icon = useMemo(() => {\n switch (state) {\n case 'success':\n return <CheckCircleOutlineIcon fontSize=\"small\" color=\"success\" />\n case 'error':\n return <HighlightOffIcon fontSize=\"small\" color=\"error\" />\n default:\n return null\n }\n }, [state])\n\n return (\n <FlexRow justifyContent={'start'} columnGap={1} {...props}>\n {Icon}\n {children}\n </FlexRow>\n )\n}\n","import { Chip, FormControl, FormLabel, StandardTextFieldProps, TextField } from '@mui/material'\nimport { useState } from 'react'\n\nimport { useSeedPhrase } from '../../../../../contexts'\nimport { InvalidPhraseTypography, PhraseHeaderBox } from './validation-messages'\n\nexport const SavedPhraseTextField: React.FC<StandardTextFieldProps> = (props) => {\n const { validSeedPhrase, seedPhrase } = useSeedPhrase()\n\n const [visible, setVisible] = useState(false)\n\n return (\n <FormControl fullWidth size=\"small\" sx={{ display: 'flex', flexDirection: 'column', rowGap: 1 }}>\n <Chip label={visible ? 'Hide Saved Seed Phrase' : 'Reveal Saved Seed Phrase'} onClick={() => setVisible(!visible)} />\n {visible ? (\n <>\n <FormLabel>\n <PhraseHeaderBox conditional={validSeedPhrase}>Saved Seed Phrase</PhraseHeaderBox>\n </FormLabel>\n <TextField\n defaultValue={seedPhrase}\n disabled\n error={validSeedPhrase === false}\n helperText={validSeedPhrase === false ? <InvalidPhraseTypography /> : null}\n fullWidth\n maxRows={Infinity}\n multiline\n {...props}\n />\n </>\n ) : null}\n </FormControl>\n )\n}\n"],"mappings":";AAAA,SAAS,QAAQ,eAAe,aAAa,WAAmC,iBAAiB;;;ACAjG,SAAS,uBAAuB;AAIzB,IAAM,oBAAoB,gBAAwC;;;ACJzE,SAAS,oBAAoB;AAItB,IAAM,gBAAgB,MAAM,aAAa,mBAAmB,cAAc,IAAI;;;ACJ9E,IAAM,cAAc,CAAC,gBAAiC;AAC3D,UAAQ,aAAa;AAAA,IACnB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;;;ACTA,SAAS,MAAM,kBAAmC;AAGhD,SAEE,KAFF;AADK,IAAM,0BAAqD,CAAC,UACjE,qBAAC,cAAW,SAAS,WAAW,OAAO,SAAU,GAAG,OAAO;AAAA;AAAA,EAC9B;AAAA,EAC3B,oBAAC,QAAK,QAAQ,UAAU,MAAK,kEAAiE,4BAE9F;AAAA,GACF;;;ACRF,SAAS,sBAAsB,wBAAwB,gBAAgB,wBAAwB;AAC/F,SAAuB,eAAe;AAEtC,SAAS,eAAe;AAqBT,gBAAAA,MASX,QAAAC,aATW;AAfR,IAAM,kBAA6C,CAAC,EAAE,UAAU,aAAa,GAAG,MAAM,MAAM;AACjG,QAAM,QAAQ,QAAQ,MAAM;AAC1B,YAAQ,aAAa;AAAA,MACnB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,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C,UAAO,UAAU,kBAAkB,SAAQ,YAAW,SAAS,gBAAgB,sBAEhF;AAAA,MACA,gBAAAA,KAAC,UAAO,SAAQ,YAAW,SAAS,aAAa,mBAEjD;AAAA,OACF;AAAA,KACF;AAEJ;;;AMpCA,SAAS,MAAM,eAAAE,cAAa,aAAAC,YAAmC,aAAAC,kBAAiB;AAChF,SAAS,gBAAgB;AAYnB,SAEE,YAAAC,WAFF,OAAAC,MAEE,QAAAC,aAFF;AAPC,IAAM,uBAAyD,CAAC,UAAU;AAC/E,QAAM,EAAE,iBAAiB,WAAW,IAAI,cAAc;AAEtD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAE5C,SACE,gBAAAA,MAACC,cAAA,EAAY,WAAS,MAAC,MAAK,SAAQ,IAAI,EAAE,SAAS,QAAQ,eAAe,UAAU,QAAQ,EAAE,GAC5F;AAAA,oBAAAF,KAAC,QAAK,OAAO,UAAU,2BAA2B,4BAA4B,SAAS,MAAM,WAAW,CAAC,OAAO,GAAG;AAAA,IAClH,UACC,gBAAAC,MAAAF,WAAA,EACE;AAAA,sBAAAC,KAACG,YAAA,EACC,0BAAAH,KAAC,mBAAgB,aAAa,iBAAiB,+BAAiB,GAClE;AAAA,MACA,gBAAAA;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,cAAc;AAAA,UACd,UAAQ;AAAA,UACR,OAAO,oBAAoB;AAAA,UAC3B,YAAY,oBAAoB,QAAQ,gBAAAJ,KAAC,2BAAwB,IAAK;AAAA,UACtE,WAAS;AAAA,UACT,SAAS;AAAA,UACT,WAAS;AAAA,UACR,GAAG;AAAA;AAAA,MACN;AAAA,OACF,IACE;AAAA,KACN;AAEJ;","names":["jsx","jsxs","jsx","jsxs","FormControl","FormLabel","TextField","Fragment","jsx","jsxs","FormControl","FormLabel","TextField"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx
|
|
2
2
|
import { Link, Typography } from "@mui/material";
|
|
3
|
-
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var InvalidPhraseTypography = (props) => /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "error", ...props, children: [
|
|
4
5
|
"Invalid seed phrase. See -",
|
|
5
6
|
" ",
|
|
6
7
|
/* @__PURE__ */ jsx(Link, { target: "_blank", href: "https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki", children: "bip39 Proposal" })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx"],"sourcesContent":["import { Link, Typography, TypographyProps } from '@mui/material'\n\nexport const InvalidPhraseTypography: React.FC<TypographyProps> = (props) => (\n <Typography variant={'caption'} color={'error'} {...props}>\n Invalid seed phrase. See -{' '}\n <Link target={'_blank'} href=\"https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\">\n bip39 Proposal\n </Link>\n </Typography>\n)\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx"],"sourcesContent":["import { Link, Typography, TypographyProps } from '@mui/material'\n\nexport const InvalidPhraseTypography: React.FC<TypographyProps> = (props) => (\n <Typography variant={'caption'} color={'error'} {...props}>\n Invalid seed phrase. See -{' '}\n <Link target={'_blank'} href=\"https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\">\n bip39 Proposal\n </Link>\n </Typography>\n)\n"],"mappings":";AAAA,SAAS,MAAM,kBAAmC;AAGhD,SAEE,KAFF;AADK,IAAM,0BAAqD,CAAC,UACjE,qBAAC,cAAW,SAAS,WAAW,OAAO,SAAU,GAAG,OAAO;AAAA;AAAA,EAC9B;AAAA,EAC3B,oBAAC,QAAK,QAAQ,UAAU,MAAK,kEAAiE,4BAE9F;AAAA,GACF;","names":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx
|
|
2
2
|
import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from "@mui/icons-material";
|
|
3
3
|
import { FlexRow } from "@xylabs/react-flexbox";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
|
-
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var PhraseHeaderBox = ({ children, conditional, ...props }) => {
|
|
6
7
|
const state = useMemo(() => {
|
|
7
8
|
switch (conditional) {
|
|
8
9
|
case true:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx"],"sourcesContent":["import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from '@mui/icons-material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useMemo } from 'react'\n\ninterface PhraseHeaderBox extends FlexBoxProps, WithChildren {\n conditional?: boolean | null\n}\n\nexport const PhraseHeaderBox: React.FC<PhraseHeaderBox> = ({ children, conditional, ...props }) => {\n const state = useMemo(() => {\n switch (conditional) {\n case true:\n return 'success'\n case false:\n return 'error'\n default:\n return null\n }\n }, [conditional])\n\n const Icon = useMemo(() => {\n switch (state) {\n case 'success':\n return <CheckCircleOutlineIcon fontSize=\"small\" color=\"success\" />\n case 'error':\n return <HighlightOffIcon fontSize=\"small\" color=\"error\" />\n default:\n return null\n }\n }, [state])\n\n return (\n <FlexRow justifyContent={'start'} columnGap={1} {...props}>\n {Icon}\n {children}\n </FlexRow>\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx"],"sourcesContent":["import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from '@mui/icons-material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useMemo } from 'react'\n\ninterface PhraseHeaderBox extends FlexBoxProps, WithChildren {\n conditional?: boolean | null\n}\n\nexport const PhraseHeaderBox: React.FC<PhraseHeaderBox> = ({ children, conditional, ...props }) => {\n const state = useMemo(() => {\n switch (conditional) {\n case true:\n return 'success'\n case false:\n return 'error'\n default:\n return null\n }\n }, [conditional])\n\n const Icon = useMemo(() => {\n switch (state) {\n case 'success':\n return <CheckCircleOutlineIcon fontSize=\"small\" color=\"success\" />\n case 'error':\n return <HighlightOffIcon fontSize=\"small\" color=\"error\" />\n default:\n return null\n }\n }, [state])\n\n return (\n <FlexRow justifyContent={'start'} columnGap={1} {...props}>\n {Icon}\n {children}\n </FlexRow>\n )\n}\n"],"mappings":";AAAA,SAAS,sBAAsB,wBAAwB,gBAAgB,wBAAwB;AAC/F,SAAuB,eAAe;AAEtC,SAAS,eAAe;AAqBT,cASX,YATW;AAfR,IAAM,kBAA6C,CAAC,EAAE,UAAU,aAAa,GAAG,MAAM,MAAM;AACjG,QAAM,QAAQ,QAAQ,MAAM;AAC1B,YAAQ,aAAa;AAAA,MACnB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAEhB,QAAM,OAAO,QAAQ,MAAM;AACzB,YAAQ,OAAO;AAAA,MACb,KAAK;AACH,eAAO,oBAAC,0BAAuB,UAAS,SAAQ,OAAM,WAAU;AAAA,MAClE,KAAK;AACH,eAAO,oBAAC,oBAAiB,UAAS,SAAQ,OAAM,SAAQ;AAAA,MAC1D;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAEV,SACE,qBAAC,WAAQ,gBAAgB,SAAS,WAAW,GAAI,GAAG,OACjD;AAAA;AAAA,IACA;AAAA,KACH;AAEJ;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.ts"],"sourcesContent":["export const colorParser = (conditional?: boolean | null) => {\n switch (conditional) {\n case true:\n return 'success'\n case false:\n return 'error'\n default:\n return undefined\n }\n}\n"],"mappings":"AAAO,
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.ts"],"sourcesContent":["export const colorParser = (conditional?: boolean | null) => {\n switch (conditional) {\n case true:\n return 'success'\n case false:\n return 'error'\n default:\n return undefined\n }\n}\n"],"mappings":";AAAO,IAAM,cAAc,CAAC,gBAAiC;AAC3D,UAAQ,aAAa;AAAA,IACnB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
|
package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/index.js
CHANGED
|
@@ -1,4 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.ts
|
|
2
|
+
var colorParser = (conditional) => {
|
|
3
|
+
switch (conditional) {
|
|
4
|
+
case true:
|
|
5
|
+
return "success";
|
|
6
|
+
case false:
|
|
7
|
+
return "error";
|
|
8
|
+
default:
|
|
9
|
+
return void 0;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx
|
|
14
|
+
import { Link, Typography } from "@mui/material";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
var InvalidPhraseTypography = (props) => /* @__PURE__ */ jsxs(Typography, { variant: "caption", color: "error", ...props, children: [
|
|
17
|
+
"Invalid seed phrase. See -",
|
|
18
|
+
" ",
|
|
19
|
+
/* @__PURE__ */ jsx(Link, { target: "_blank", href: "https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki", children: "bip39 Proposal" })
|
|
20
|
+
] });
|
|
21
|
+
|
|
22
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx
|
|
23
|
+
import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from "@mui/icons-material";
|
|
24
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
|
25
|
+
import { useMemo } from "react";
|
|
26
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
27
|
+
var PhraseHeaderBox = ({ children, conditional, ...props }) => {
|
|
28
|
+
const state = useMemo(() => {
|
|
29
|
+
switch (conditional) {
|
|
30
|
+
case true:
|
|
31
|
+
return "success";
|
|
32
|
+
case false:
|
|
33
|
+
return "error";
|
|
34
|
+
default:
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}, [conditional]);
|
|
38
|
+
const Icon = useMemo(() => {
|
|
39
|
+
switch (state) {
|
|
40
|
+
case "success":
|
|
41
|
+
return /* @__PURE__ */ jsx2(CheckCircleOutlineIcon, { fontSize: "small", color: "success" });
|
|
42
|
+
case "error":
|
|
43
|
+
return /* @__PURE__ */ jsx2(HighlightOffIcon, { fontSize: "small", color: "error" });
|
|
44
|
+
default:
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}, [state]);
|
|
48
|
+
return /* @__PURE__ */ jsxs2(FlexRow, { justifyContent: "start", columnGap: 1, ...props, children: [
|
|
49
|
+
Icon,
|
|
50
|
+
children
|
|
51
|
+
] });
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
InvalidPhraseTypography,
|
|
55
|
+
PhraseHeaderBox,
|
|
56
|
+
colorParser
|
|
57
|
+
};
|
|
4
58
|
//# sourceMappingURL=index.js.map
|
package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.ts","../../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx","../../../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx"],"sourcesContent":["export const colorParser = (conditional?: boolean | null) => {\n switch (conditional) {\n case true:\n return 'success'\n case false:\n return 'error'\n default:\n return undefined\n }\n}\n","import { Link, Typography, TypographyProps } from '@mui/material'\n\nexport const InvalidPhraseTypography: React.FC<TypographyProps> = (props) => (\n <Typography variant={'caption'} color={'error'} {...props}>\n Invalid seed phrase. See -{' '}\n <Link target={'_blank'} href=\"https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\">\n bip39 Proposal\n </Link>\n </Typography>\n)\n","import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from '@mui/icons-material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useMemo } from 'react'\n\ninterface PhraseHeaderBox extends FlexBoxProps, WithChildren {\n conditional?: boolean | null\n}\n\nexport const PhraseHeaderBox: React.FC<PhraseHeaderBox> = ({ children, conditional, ...props }) => {\n const state = useMemo(() => {\n switch (conditional) {\n case true:\n return 'success'\n case false:\n return 'error'\n default:\n return null\n }\n }, [conditional])\n\n const Icon = useMemo(() => {\n switch (state) {\n case 'success':\n return <CheckCircleOutlineIcon fontSize=\"small\" color=\"success\" />\n case 'error':\n return <HighlightOffIcon fontSize=\"small\" color=\"error\" />\n default:\n return null\n }\n }, [state])\n\n return (\n <FlexRow justifyContent={'start'} columnGap={1} {...props}>\n {Icon}\n {children}\n </FlexRow>\n )\n}\n"],"mappings":";AAAO,IAAM,cAAc,CAAC,gBAAiC;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ions } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
// src/contexts/SeedPhrase/Context.ts
|
|
5
|
+
import { createContextEx } from "@xyo-network/react-shared";
|
|
6
|
+
var SeedPhraseContext = createContextEx();
|
|
7
|
+
|
|
8
|
+
// src/contexts/SeedPhrase/use.tsx
|
|
9
|
+
import { useContextEx } from "@xyo-network/react-shared";
|
|
10
|
+
var useSeedPhrase = () => useContextEx(SeedPhraseContext, "SeedPhrase", true);
|
|
11
|
+
|
|
12
|
+
// src/components/SeedPhrase/dialog/components/DialogActionButtons.tsx
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
var DialogActionButtons = ({ onClose, ...props }) => {
|
|
15
|
+
const { handleSave, setPhrase } = useSeedPhrase();
|
|
16
|
+
const wrappedOnClose = (e) => {
|
|
17
|
+
setPhrase?.("");
|
|
18
|
+
onClose?.(e, "escapeKeyDown");
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ jsxs(DialogActions, { ...props, children: [
|
|
21
|
+
/* @__PURE__ */ jsx(Button, { variant: "outlined", onClick: wrappedOnClose, children: "Cancel" }),
|
|
22
|
+
/* @__PURE__ */ jsx(Button, { variant: "outlined", onClick: handleSave, children: "Save" })
|
|
23
|
+
] });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx
|
|
27
|
+
import { Button as Button2, DialogActions as DialogActions2, FormControl, FormLabel, TextField } from "@mui/material";
|
|
28
|
+
|
|
29
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.ts
|
|
30
|
+
var colorParser = (conditional) => {
|
|
31
|
+
switch (conditional) {
|
|
32
|
+
case true:
|
|
33
|
+
return "success";
|
|
34
|
+
case false:
|
|
35
|
+
return "error";
|
|
36
|
+
default:
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx
|
|
42
|
+
import { Link, Typography } from "@mui/material";
|
|
43
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
44
|
+
var InvalidPhraseTypography = (props) => /* @__PURE__ */ jsxs2(Typography, { variant: "caption", color: "error", ...props, children: [
|
|
45
|
+
"Invalid seed phrase. See -",
|
|
46
|
+
" ",
|
|
47
|
+
/* @__PURE__ */ jsx2(Link, { target: "_blank", href: "https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki", children: "bip39 Proposal" })
|
|
48
|
+
] });
|
|
49
|
+
|
|
50
|
+
// src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx
|
|
51
|
+
import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from "@mui/icons-material";
|
|
52
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
|
53
|
+
import { useMemo } from "react";
|
|
54
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
55
|
+
var PhraseHeaderBox = ({ children, conditional, ...props }) => {
|
|
56
|
+
const state = useMemo(() => {
|
|
57
|
+
switch (conditional) {
|
|
58
|
+
case true:
|
|
59
|
+
return "success";
|
|
60
|
+
case false:
|
|
61
|
+
return "error";
|
|
62
|
+
default:
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}, [conditional]);
|
|
66
|
+
const Icon = useMemo(() => {
|
|
67
|
+
switch (state) {
|
|
68
|
+
case "success":
|
|
69
|
+
return /* @__PURE__ */ jsx3(CheckCircleOutlineIcon, { fontSize: "small", color: "success" });
|
|
70
|
+
case "error":
|
|
71
|
+
return /* @__PURE__ */ jsx3(HighlightOffIcon, { fontSize: "small", color: "error" });
|
|
72
|
+
default:
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}, [state]);
|
|
76
|
+
return /* @__PURE__ */ jsxs3(FlexRow, { justifyContent: "start", columnGap: 1, ...props, children: [
|
|
77
|
+
Icon,
|
|
78
|
+
children
|
|
79
|
+
] });
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx
|
|
83
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
84
|
+
var NewPhraseTextField = (props) => {
|
|
85
|
+
const { handleClear, handleGenerate, overwriteWarning, phrase, setPhrase, validPhrase } = useSeedPhrase();
|
|
86
|
+
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
87
|
+
/* @__PURE__ */ jsxs4(FormControl, { fullWidth: true, size: "small", sx: { display: "flex", flexDirection: "column", rowGap: 1 }, children: [
|
|
88
|
+
/* @__PURE__ */ jsx4(FormLabel, { children: /* @__PURE__ */ jsx4(PhraseHeaderBox, { conditional: validPhrase, children: "New Seed Phrase" }) }),
|
|
89
|
+
/* @__PURE__ */ jsx4(
|
|
90
|
+
TextField,
|
|
91
|
+
{
|
|
92
|
+
focused: true,
|
|
93
|
+
color: colorParser(validPhrase),
|
|
94
|
+
error: validPhrase === false,
|
|
95
|
+
helperText: validPhrase === false ? /* @__PURE__ */ jsx4(InvalidPhraseTypography, {}) : null,
|
|
96
|
+
fullWidth: true,
|
|
97
|
+
maxRows: Infinity,
|
|
98
|
+
multiline: true,
|
|
99
|
+
onChange: (e) => setPhrase?.(e.target.value),
|
|
100
|
+
value: phrase,
|
|
101
|
+
...props
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ jsxs4(DialogActions2, { sx: { justifyContent: "center" }, children: [
|
|
106
|
+
/* @__PURE__ */ jsx4(Button2, { disabled: overwriteWarning, variant: "outlined", onClick: handleGenerate, children: "Generate" }),
|
|
107
|
+
/* @__PURE__ */ jsx4(Button2, { variant: "outlined", onClick: handleClear, children: "Clear" })
|
|
108
|
+
] })
|
|
109
|
+
] });
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// src/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.tsx
|
|
113
|
+
import { Chip, FormControl as FormControl2, FormLabel as FormLabel2, TextField as TextField2 } from "@mui/material";
|
|
114
|
+
import { useState } from "react";
|
|
115
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
116
|
+
var SavedPhraseTextField = (props) => {
|
|
117
|
+
const { validSeedPhrase, seedPhrase } = useSeedPhrase();
|
|
118
|
+
const [visible, setVisible] = useState(false);
|
|
119
|
+
return /* @__PURE__ */ jsxs5(FormControl2, { fullWidth: true, size: "small", sx: { display: "flex", flexDirection: "column", rowGap: 1 }, children: [
|
|
120
|
+
/* @__PURE__ */ jsx5(Chip, { label: visible ? "Hide Saved Seed Phrase" : "Reveal Saved Seed Phrase", onClick: () => setVisible(!visible) }),
|
|
121
|
+
visible ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
122
|
+
/* @__PURE__ */ jsx5(FormLabel2, { children: /* @__PURE__ */ jsx5(PhraseHeaderBox, { conditional: validSeedPhrase, children: "Saved Seed Phrase" }) }),
|
|
123
|
+
/* @__PURE__ */ jsx5(
|
|
124
|
+
TextField2,
|
|
125
|
+
{
|
|
126
|
+
defaultValue: seedPhrase,
|
|
127
|
+
disabled: true,
|
|
128
|
+
error: validSeedPhrase === false,
|
|
129
|
+
helperText: validSeedPhrase === false ? /* @__PURE__ */ jsx5(InvalidPhraseTypography, {}) : null,
|
|
130
|
+
fullWidth: true,
|
|
131
|
+
maxRows: Infinity,
|
|
132
|
+
multiline: true,
|
|
133
|
+
...props
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
] }) : null
|
|
137
|
+
] });
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// src/components/SeedPhrase/dialog/components/OverwriteWarning.tsx
|
|
141
|
+
import { Alert, Button as Button3 } from "@mui/material";
|
|
142
|
+
import { FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
143
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
144
|
+
var OverwriteWarning = () => {
|
|
145
|
+
const { handleCancelOverwrite, handleSave } = useSeedPhrase();
|
|
146
|
+
return /* @__PURE__ */ jsx6(
|
|
147
|
+
Alert,
|
|
148
|
+
{
|
|
149
|
+
variant: "outlined",
|
|
150
|
+
severity: "warning",
|
|
151
|
+
action: /* @__PURE__ */ jsxs6(FlexRow2, { sx: { columnGap: 1 }, children: [
|
|
152
|
+
/* @__PURE__ */ jsx6(Button3, { variant: "outlined", color: "inherit", size: "small", onClick: handleSave, children: "Overwrite" }),
|
|
153
|
+
/* @__PURE__ */ jsx6(Button3, { variant: "outlined", color: "inherit", size: "small", onClick: handleCancelOverwrite, children: "Cancel" })
|
|
154
|
+
] }),
|
|
155
|
+
children: "Are you sure you want to overwrite existing seed phrase? This action cannot be undone."
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
export {
|
|
160
|
+
DialogActionButtons,
|
|
161
|
+
NewPhraseTextField,
|
|
162
|
+
OverwriteWarning,
|
|
163
|
+
SavedPhraseTextField
|
|
164
|
+
};
|
|
4
165
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/components/SeedPhrase/dialog/components/index.ts"],"sourcesContent":["export * from './DialogActionButtons'\nexport * from './fields'\nexport * from './OverwriteWarning'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/components/SeedPhrase/dialog/components/DialogActionButtons.tsx","../../../../../../src/contexts/SeedPhrase/Context.ts","../../../../../../src/contexts/SeedPhrase/use.tsx","../../../../../../src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx","../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.ts","../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx","../../../../../../src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx","../../../../../../src/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.tsx","../../../../../../src/components/SeedPhrase/dialog/components/OverwriteWarning.tsx"],"sourcesContent":["import { Button, DialogActions, DialogActionsProps, DialogProps } from '@mui/material'\nimport { MouseEvent } from 'react'\n\nimport { useSeedPhrase } from '../../../../contexts'\n\ninterface DialogActionButtonsProps extends DialogActionsProps {\n onClose?: DialogProps['onClose']\n}\n\nexport const DialogActionButtons: React.FC<DialogActionButtonsProps> = ({ onClose, ...props }) => {\n const { handleSave, setPhrase } = useSeedPhrase()\n\n const wrappedOnClose = (e: MouseEvent<HTMLElement>) => {\n // clear local copy of phrase when modal closes\n setPhrase?.('')\n onClose?.(e, 'escapeKeyDown')\n }\n\n return (\n <DialogActions {...props}>\n <Button variant=\"outlined\" onClick={wrappedOnClose}>\n Cancel\n </Button>\n <Button variant=\"outlined\" onClick={handleSave}>\n Save\n </Button>\n </DialogActions>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SeedPhraseContextState } from './State'\n\nexport const SeedPhraseContext = createContextEx<SeedPhraseContextState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SeedPhraseContext } from './Context'\n\nexport const useSeedPhrase = () => useContextEx(SeedPhraseContext, 'SeedPhrase', true)\n","import { Button, DialogActions, FormControl, FormLabel, StandardTextFieldProps, TextField } from '@mui/material'\n\nimport { useSeedPhrase } from '../../../../../contexts'\nimport { colorParser, InvalidPhraseTypography, PhraseHeaderBox } from './validation-messages'\n\nexport const NewPhraseTextField: React.FC<StandardTextFieldProps> = (props) => {\n const { handleClear, handleGenerate, overwriteWarning, phrase, setPhrase, validPhrase } = useSeedPhrase()\n return (\n <>\n <FormControl fullWidth size=\"small\" sx={{ display: 'flex', flexDirection: 'column', rowGap: 1 }}>\n <FormLabel>\n <PhraseHeaderBox conditional={validPhrase}>New Seed Phrase</PhraseHeaderBox>\n </FormLabel>\n <TextField\n focused\n color={colorParser(validPhrase)}\n error={validPhrase === false}\n helperText={validPhrase === false ? <InvalidPhraseTypography /> : null}\n fullWidth\n maxRows={Infinity}\n multiline\n onChange={(e) => setPhrase?.(e.target.value)}\n value={phrase}\n {...props}\n />\n </FormControl>\n <DialogActions sx={{ justifyContent: 'center' }}>\n <Button disabled={overwriteWarning} variant=\"outlined\" onClick={handleGenerate}>\n Generate\n </Button>\n <Button variant=\"outlined\" onClick={handleClear}>\n Clear\n </Button>\n </DialogActions>\n </>\n )\n}\n","export const colorParser = (conditional?: boolean | null) => {\n switch (conditional) {\n case true:\n return 'success'\n case false:\n return 'error'\n default:\n return undefined\n }\n}\n","import { Link, Typography, TypographyProps } from '@mui/material'\n\nexport const InvalidPhraseTypography: React.FC<TypographyProps> = (props) => (\n <Typography variant={'caption'} color={'error'} {...props}>\n Invalid seed phrase. See -{' '}\n <Link target={'_blank'} href=\"https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\">\n bip39 Proposal\n </Link>\n </Typography>\n)\n","import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from '@mui/icons-material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { useMemo } from 'react'\n\ninterface PhraseHeaderBox extends FlexBoxProps, WithChildren {\n conditional?: boolean | null\n}\n\nexport const PhraseHeaderBox: React.FC<PhraseHeaderBox> = ({ children, conditional, ...props }) => {\n const state = useMemo(() => {\n switch (conditional) {\n case true:\n return 'success'\n case false:\n return 'error'\n default:\n return null\n }\n }, [conditional])\n\n const Icon = useMemo(() => {\n switch (state) {\n case 'success':\n return <CheckCircleOutlineIcon fontSize=\"small\" color=\"success\" />\n case 'error':\n return <HighlightOffIcon fontSize=\"small\" color=\"error\" />\n default:\n return null\n }\n }, [state])\n\n return (\n <FlexRow justifyContent={'start'} columnGap={1} {...props}>\n {Icon}\n {children}\n </FlexRow>\n )\n}\n","import { Chip, FormControl, FormLabel, StandardTextFieldProps, TextField } from '@mui/material'\nimport { useState } from 'react'\n\nimport { useSeedPhrase } from '../../../../../contexts'\nimport { InvalidPhraseTypography, PhraseHeaderBox } from './validation-messages'\n\nexport const SavedPhraseTextField: React.FC<StandardTextFieldProps> = (props) => {\n const { validSeedPhrase, seedPhrase } = useSeedPhrase()\n\n const [visible, setVisible] = useState(false)\n\n return (\n <FormControl fullWidth size=\"small\" sx={{ display: 'flex', flexDirection: 'column', rowGap: 1 }}>\n <Chip label={visible ? 'Hide Saved Seed Phrase' : 'Reveal Saved Seed Phrase'} onClick={() => setVisible(!visible)} />\n {visible ? (\n <>\n <FormLabel>\n <PhraseHeaderBox conditional={validSeedPhrase}>Saved Seed Phrase</PhraseHeaderBox>\n </FormLabel>\n <TextField\n defaultValue={seedPhrase}\n disabled\n error={validSeedPhrase === false}\n helperText={validSeedPhrase === false ? <InvalidPhraseTypography /> : null}\n fullWidth\n maxRows={Infinity}\n multiline\n {...props}\n />\n </>\n ) : null}\n </FormControl>\n )\n}\n","import { Alert, Button } from '@mui/material'\nimport { FlexRow } from '@xylabs/react-flexbox'\n\nimport { useSeedPhrase } from '../../../../contexts'\n\nexport const OverwriteWarning = () => {\n const { handleCancelOverwrite, handleSave } = useSeedPhrase()\n return (\n <Alert\n variant=\"outlined\"\n severity=\"warning\"\n action={\n <FlexRow sx={{ columnGap: 1 }}>\n <Button variant=\"outlined\" color=\"inherit\" size=\"small\" onClick={handleSave}>\n Overwrite\n </Button>\n <Button variant=\"outlined\" color=\"inherit\" size=\"small\" onClick={handleCancelOverwrite}>\n Cancel\n </Button>\n </FlexRow>\n }\n >\n Are you sure you want to overwrite existing seed phrase? This action cannot be undone.\n </Alert>\n )\n}\n"],"mappings":";AAAA,SAAS,QAAQ,qBAAsD;;;ACAvE,SAAS,uBAAuB;AAIzB,IAAM,oBAAoB,gBAAwC;;;ACJzE,SAAS,oBAAoB;AAItB,IAAM,gBAAgB,MAAM,aAAa,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,MACR,UAAS;AAAA,MACT,QACE,gBAAAC,MAACC,UAAA,EAAQ,IAAI,EAAE,WAAW,EAAE,GAC1B;AAAA,wBAAAF,KAACG,SAAA,EAAO,SAAQ,YAAW,OAAM,WAAU,MAAK,SAAQ,SAAS,YAAY,uBAE7E;AAAA,QACA,gBAAAH,KAACG,SAAA,EAAO,SAAQ,YAAW,OAAM,WAAU,MAAK,SAAQ,SAAS,uBAAuB,oBAExF;AAAA,SACF;AAAA,MAEH;AAAA;AAAA,EAED;AAEJ;","names":["Button","DialogActions","jsx","jsxs","jsx","jsxs","jsx","jsxs","DialogActions","Button","FormControl","FormLabel","TextField","Fragment","jsx","jsxs","FormControl","FormLabel","TextField","Button","FlexRow","jsx","jsxs","FlexRow","Button"]}
|