@xyo-network/react-wallet 2.64.0 → 2.64.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/browser/components/MaxAccounts/MaxAccountsTableRow.js +41 -11
  2. package/dist/browser/components/MaxAccounts/MaxAccountsTableRow.js.map +1 -1
  3. package/dist/browser/components/MaxAccounts/OutOfBoundsSnackBar.js +3 -2
  4. package/dist/browser/components/MaxAccounts/OutOfBoundsSnackBar.js.map +1 -1
  5. package/dist/browser/components/MaxAccounts/index.js +88 -1
  6. package/dist/browser/components/MaxAccounts/index.js.map +1 -1
  7. package/dist/browser/components/SeedPhrase/DefaultSeedPhrase.js +3 -2
  8. package/dist/browser/components/SeedPhrase/DefaultSeedPhrase.js.map +1 -1
  9. package/dist/browser/components/SeedPhrase/_shared/SeedPhraseIconButton.js +3 -2
  10. package/dist/browser/components/SeedPhrase/_shared/SeedPhraseIconButton.js.map +1 -1
  11. package/dist/browser/components/SeedPhrase/_shared/index.js +45 -1
  12. package/dist/browser/components/SeedPhrase/_shared/index.js.map +1 -1
  13. package/dist/browser/components/SeedPhrase/dialog/SeedPhraseDialog.js +295 -16
  14. package/dist/browser/components/SeedPhrase/dialog/SeedPhraseDialog.js.map +1 -1
  15. package/dist/browser/components/SeedPhrase/dialog/components/DialogActionButtons.js +13 -3
  16. package/dist/browser/components/SeedPhrase/dialog/components/DialogActionButtons.js.map +1 -1
  17. package/dist/browser/components/SeedPhrase/dialog/components/OverwriteWarning.js +13 -3
  18. package/dist/browser/components/SeedPhrase/dialog/components/OverwriteWarning.js.map +1 -1
  19. package/dist/browser/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.js +74 -12
  20. package/dist/browser/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.js.map +1 -1
  21. package/dist/browser/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.js +60 -10
  22. package/dist/browser/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.js.map +1 -1
  23. package/dist/browser/components/SeedPhrase/dialog/components/fields/index.js +125 -2
  24. package/dist/browser/components/SeedPhrase/dialog/components/fields/index.js.map +1 -1
  25. package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.js +3 -2
  26. package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.js.map +1 -1
  27. package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.js +3 -2
  28. package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.js.map +1 -1
  29. package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.js +2 -1
  30. package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.js.map +1 -1
  31. package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/index.js +57 -3
  32. package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/index.js.map +1 -1
  33. package/dist/browser/components/SeedPhrase/dialog/components/index.js +164 -3
  34. package/dist/browser/components/SeedPhrase/dialog/components/index.js.map +1 -1
  35. package/dist/browser/components/SeedPhrase/dialog/index.js +315 -1
  36. package/dist/browser/components/SeedPhrase/dialog/index.js.map +1 -1
  37. package/dist/browser/components/SeedPhrase/index.js +373 -4
  38. package/dist/browser/components/SeedPhrase/index.js.map +1 -1
  39. package/dist/browser/components/SeedPhrase/settings/SeedPhraseTableRow.js +325 -12
  40. package/dist/browser/components/SeedPhrase/settings/SeedPhraseTableRow.js.map +1 -1
  41. package/dist/browser/components/SeedPhrase/settings/index.js +339 -1
  42. package/dist/browser/components/SeedPhrase/settings/index.js.map +1 -1
  43. package/dist/browser/components/WalletAccountDetails/WalletAccountDetails.js +62 -3
  44. package/dist/browser/components/WalletAccountDetails/WalletAccountDetails.js.map +1 -1
  45. package/dist/browser/components/WalletAccountDetails/index.js +83 -1
  46. package/dist/browser/components/WalletAccountDetails/index.js.map +1 -1
  47. package/dist/browser/components/WalletAccountSelect/Select.js +70 -5
  48. package/dist/browser/components/WalletAccountSelect/Select.js.map +1 -1
  49. package/dist/browser/components/WalletAccountSelect/SelectBar.js +150 -4
  50. package/dist/browser/components/WalletAccountSelect/SelectBar.js.map +1 -1
  51. package/dist/browser/components/WalletAccountSelect/WalletInfo.js +116 -10
  52. package/dist/browser/components/WalletAccountSelect/WalletInfo.js.map +1 -1
  53. package/dist/browser/components/WalletAccountSelect/index.js +175 -2
  54. package/dist/browser/components/WalletAccountSelect/index.js.map +1 -1
  55. package/dist/browser/components/index.js +694 -4
  56. package/dist/browser/components/index.js.map +1 -1
  57. package/dist/browser/contexts/SeedPhrase/Context.js +2 -1
  58. package/dist/browser/contexts/SeedPhrase/Context.js.map +1 -1
  59. package/dist/browser/contexts/SeedPhrase/Provider.js +9 -3
  60. package/dist/browser/contexts/SeedPhrase/Provider.js.map +1 -1
  61. package/dist/browser/contexts/SeedPhrase/index.js +91 -4
  62. package/dist/browser/contexts/SeedPhrase/index.js.map +1 -1
  63. package/dist/browser/contexts/SeedPhrase/use.js +8 -2
  64. package/dist/browser/contexts/SeedPhrase/use.js.map +1 -1
  65. package/dist/browser/contexts/Wallet/Context.js +2 -1
  66. package/dist/browser/contexts/Wallet/Context.js.map +1 -1
  67. package/dist/browser/contexts/Wallet/Provider.js +90 -7
  68. package/dist/browser/contexts/Wallet/Provider.js.map +1 -1
  69. package/dist/browser/contexts/Wallet/index.js +183 -5
  70. package/dist/browser/contexts/Wallet/index.js.map +1 -1
  71. package/dist/browser/contexts/Wallet/lib/WalletPath.js +4 -3
  72. package/dist/browser/contexts/Wallet/lib/WalletPath.js.map +1 -1
  73. package/dist/browser/contexts/Wallet/lib/index.js +21 -1
  74. package/dist/browser/contexts/Wallet/lib/index.js.map +1 -1
  75. package/dist/browser/contexts/Wallet/use.js +13 -7
  76. package/dist/browser/contexts/Wallet/use.js.map +1 -1
  77. package/dist/browser/contexts/Wallet/usePromise.js +2 -1
  78. package/dist/browser/contexts/Wallet/usePromise.js.map +1 -1
  79. package/dist/browser/contexts/index.js +273 -2
  80. package/dist/browser/contexts/index.js.map +1 -1
  81. package/dist/browser/hooks/index.js +147 -4
  82. package/dist/browser/hooks/index.js.map +1 -1
  83. package/dist/browser/hooks/useAccount.js +24 -4
  84. package/dist/browser/hooks/useAccount.js.map +1 -1
  85. package/dist/browser/hooks/useWallet.js +38 -4
  86. package/dist/browser/hooks/useWallet.js.map +1 -1
  87. package/dist/browser/hooks/useWallets.js +69 -4
  88. package/dist/browser/hooks/useWallets.js.map +1 -1
  89. package/dist/browser/hooks/useWrapperAccount.js +4 -3
  90. package/dist/browser/hooks/useWrapperAccount.js.map +1 -1
  91. package/dist/browser/index.js +890 -3
  92. package/dist/browser/index.js.map +1 -1
  93. package/dist/docs.json +147 -147
  94. package/package.json +22 -22
@@ -1,33 +1,312 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Dialog, DialogContent, DialogTitle } from "@mui/material";
3
- import { SeedPhraseProvider, useSeedPhrase } from "../../../contexts";
4
- import { SeedPhraseIconButton } from "../_shared";
5
- import { DialogActionButtons, NewPhraseTextField, OverwriteWarning, SavedPhraseTextField } from "./components";
6
- const SeedPhraseDialog = ({ changeSeedPhrase, seedPhrase, ...props }) => {
1
+ // src/components/SeedPhrase/dialog/SeedPhraseDialog.tsx
2
+ import { Dialog as Dialog2, DialogContent as DialogContent2, DialogTitle as DialogTitle2 } 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/Provider.tsx
9
+ import { generateMnemonic, validateMnemonic, wordlists } from "@xyo-network/bip39";
10
+ import { useEffect, useMemo, useState } from "react";
11
+ import { jsx } from "react/jsx-runtime";
12
+ var SeedPhraseProvider = ({
13
+ children,
14
+ defaultPhrase,
15
+ handleChangeSeedPhrase,
16
+ saveCallback,
17
+ seedPhrase,
18
+ open
19
+ }) => {
20
+ const [phrase, setPhrase] = useState();
21
+ const [overwriteWarning, setOverwriteWarning] = useState(false);
22
+ useEffect(() => {
23
+ setPhrase(defaultPhrase);
24
+ }, [defaultPhrase]);
25
+ useEffect(() => {
26
+ if (!open) {
27
+ handleCancelOverwrite();
28
+ }
29
+ }, [open]);
30
+ useEffect(() => {
31
+ if (seedPhrase || open) {
32
+ setPhrase?.(seedPhrase ?? "");
33
+ }
34
+ }, [seedPhrase, open, setPhrase]);
35
+ const handleGenerate = () => {
36
+ const mnemonic = generateMnemonic(wordlists.english, 256);
37
+ setPhrase?.(mnemonic);
38
+ setOverwriteWarning?.(false);
39
+ };
40
+ const handleCancelOverwrite = () => {
41
+ setOverwriteWarning?.(false);
42
+ };
43
+ const handleClear = () => {
44
+ setPhrase?.("");
45
+ setOverwriteWarning?.(false);
46
+ };
47
+ const handleSave = () => {
48
+ if (!overwriteWarning && seedPhrase && seedPhrase !== phrase) {
49
+ setOverwriteWarning?.(true);
50
+ } else {
51
+ handleChangeSeedPhrase?.(phrase ?? "");
52
+ saveCallback?.();
53
+ }
54
+ };
55
+ const validate = (passedPhrase) => {
56
+ if (!passedPhrase) {
57
+ return null;
58
+ }
59
+ return validateMnemonic(passedPhrase, wordlists.english);
60
+ };
61
+ const validSeedPhrase = useMemo(() => validate?.(seedPhrase), [seedPhrase]);
62
+ const validPhrase = useMemo(() => validate?.(phrase), [phrase]);
7
63
  return /* @__PURE__ */ jsx(
64
+ SeedPhraseContext.Provider,
65
+ {
66
+ value: {
67
+ handleCancelOverwrite,
68
+ handleChangeSeedPhrase,
69
+ handleClear,
70
+ handleGenerate,
71
+ handleSave,
72
+ overwriteWarning,
73
+ phrase,
74
+ provided: true,
75
+ seedPhrase,
76
+ setOverwriteWarning,
77
+ setPhrase,
78
+ validPhrase,
79
+ validSeedPhrase,
80
+ validate
81
+ },
82
+ children
83
+ }
84
+ );
85
+ };
86
+
87
+ // src/contexts/SeedPhrase/use.tsx
88
+ import { useContextEx } from "@xyo-network/react-shared";
89
+ var useSeedPhrase = () => useContextEx(SeedPhraseContext, "SeedPhrase", true);
90
+
91
+ // src/components/SeedPhrase/_shared/SeedPhraseIconButton.tsx
92
+ import { HelpOutline as HelpOutlineIcon } from "@mui/icons-material";
93
+ import {
94
+ Button,
95
+ Dialog,
96
+ DialogActions,
97
+ DialogContent,
98
+ DialogTitle,
99
+ IconButton,
100
+ Link,
101
+ List,
102
+ ListItem,
103
+ Typography
104
+ } from "@mui/material";
105
+ import { useState as useState2 } from "react";
106
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
107
+ var SeedPhraseIconButton = (props) => {
108
+ const [open, setOpen] = useState2(false);
109
+ const onClose = () => setOpen(false);
110
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
111
+ /* @__PURE__ */ jsx2(IconButton, { onClick: () => setOpen(true), ...props, children: /* @__PURE__ */ jsx2(HelpOutlineIcon, { fontSize: "small" }) }),
112
+ /* @__PURE__ */ jsxs(Dialog, { open, children: [
113
+ /* @__PURE__ */ jsx2(DialogTitle, { children: "Understanding your Seed Phrase" }),
114
+ /* @__PURE__ */ jsxs(DialogContent, { children: [
115
+ /* @__PURE__ */ jsxs(Typography, { children: [
116
+ "Your Seed Phrase should adhere to the",
117
+ " ",
118
+ /* @__PURE__ */ jsx2(Link, { target: "_blank", href: "https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki", children: "bip39 specification" }),
119
+ " ",
120
+ "and is used to generate accounts which identify your data on the XYO Network."
121
+ ] }),
122
+ /* @__PURE__ */ jsxs(List, { children: [
123
+ /* @__PURE__ */ jsx2(ListItem, { children: "Do not share this phrase with anyone." }),
124
+ /* @__PURE__ */ jsx2(ListItem, { children: "Do not save it to a public computer." }),
125
+ /* @__PURE__ */ jsx2(ListItem, { children: "Do not use a existing phrase from another wallet (i.e. Metamask)." }),
126
+ /* @__PURE__ */ jsx2(ListItem, { children: "Do not use before copying it down somewhere safe." })
127
+ ] })
128
+ ] }),
129
+ /* @__PURE__ */ jsx2(DialogActions, { children: /* @__PURE__ */ jsx2(Button, { onClick: onClose, variant: "outlined", children: "OK" }) })
130
+ ] })
131
+ ] });
132
+ };
133
+
134
+ // src/components/SeedPhrase/dialog/components/DialogActionButtons.tsx
135
+ import { Button as Button2, DialogActions as DialogActions2 } from "@mui/material";
136
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
137
+ var DialogActionButtons = ({ onClose, ...props }) => {
138
+ const { handleSave, setPhrase } = useSeedPhrase();
139
+ const wrappedOnClose = (e) => {
140
+ setPhrase?.("");
141
+ onClose?.(e, "escapeKeyDown");
142
+ };
143
+ return /* @__PURE__ */ jsxs2(DialogActions2, { ...props, children: [
144
+ /* @__PURE__ */ jsx3(Button2, { variant: "outlined", onClick: wrappedOnClose, children: "Cancel" }),
145
+ /* @__PURE__ */ jsx3(Button2, { variant: "outlined", onClick: handleSave, children: "Save" })
146
+ ] });
147
+ };
148
+
149
+ // src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx
150
+ import { Button as Button3, DialogActions as DialogActions3, FormControl, FormLabel, TextField } from "@mui/material";
151
+
152
+ // src/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.ts
153
+ var colorParser = (conditional) => {
154
+ switch (conditional) {
155
+ case true:
156
+ return "success";
157
+ case false:
158
+ return "error";
159
+ default:
160
+ return void 0;
161
+ }
162
+ };
163
+
164
+ // src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx
165
+ import { Link as Link2, Typography as Typography2 } from "@mui/material";
166
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
167
+ var InvalidPhraseTypography = (props) => /* @__PURE__ */ jsxs3(Typography2, { variant: "caption", color: "error", ...props, children: [
168
+ "Invalid seed phrase. See -",
169
+ " ",
170
+ /* @__PURE__ */ jsx4(Link2, { target: "_blank", href: "https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki", children: "bip39 Proposal" })
171
+ ] });
172
+
173
+ // src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx
174
+ import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from "@mui/icons-material";
175
+ import { FlexRow } from "@xylabs/react-flexbox";
176
+ import { useMemo as useMemo2 } from "react";
177
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
178
+ var PhraseHeaderBox = ({ children, conditional, ...props }) => {
179
+ const state = useMemo2(() => {
180
+ switch (conditional) {
181
+ case true:
182
+ return "success";
183
+ case false:
184
+ return "error";
185
+ default:
186
+ return null;
187
+ }
188
+ }, [conditional]);
189
+ const Icon = useMemo2(() => {
190
+ switch (state) {
191
+ case "success":
192
+ return /* @__PURE__ */ jsx5(CheckCircleOutlineIcon, { fontSize: "small", color: "success" });
193
+ case "error":
194
+ return /* @__PURE__ */ jsx5(HighlightOffIcon, { fontSize: "small", color: "error" });
195
+ default:
196
+ return null;
197
+ }
198
+ }, [state]);
199
+ return /* @__PURE__ */ jsxs4(FlexRow, { justifyContent: "start", columnGap: 1, ...props, children: [
200
+ Icon,
201
+ children
202
+ ] });
203
+ };
204
+
205
+ // src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx
206
+ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
207
+ var NewPhraseTextField = (props) => {
208
+ const { handleClear, handleGenerate, overwriteWarning, phrase, setPhrase, validPhrase } = useSeedPhrase();
209
+ return /* @__PURE__ */ jsxs5(Fragment2, { children: [
210
+ /* @__PURE__ */ jsxs5(FormControl, { fullWidth: true, size: "small", sx: { display: "flex", flexDirection: "column", rowGap: 1 }, children: [
211
+ /* @__PURE__ */ jsx6(FormLabel, { children: /* @__PURE__ */ jsx6(PhraseHeaderBox, { conditional: validPhrase, children: "New Seed Phrase" }) }),
212
+ /* @__PURE__ */ jsx6(
213
+ TextField,
214
+ {
215
+ focused: true,
216
+ color: colorParser(validPhrase),
217
+ error: validPhrase === false,
218
+ helperText: validPhrase === false ? /* @__PURE__ */ jsx6(InvalidPhraseTypography, {}) : null,
219
+ fullWidth: true,
220
+ maxRows: Infinity,
221
+ multiline: true,
222
+ onChange: (e) => setPhrase?.(e.target.value),
223
+ value: phrase,
224
+ ...props
225
+ }
226
+ )
227
+ ] }),
228
+ /* @__PURE__ */ jsxs5(DialogActions3, { sx: { justifyContent: "center" }, children: [
229
+ /* @__PURE__ */ jsx6(Button3, { disabled: overwriteWarning, variant: "outlined", onClick: handleGenerate, children: "Generate" }),
230
+ /* @__PURE__ */ jsx6(Button3, { variant: "outlined", onClick: handleClear, children: "Clear" })
231
+ ] })
232
+ ] });
233
+ };
234
+
235
+ // src/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.tsx
236
+ import { Chip, FormControl as FormControl2, FormLabel as FormLabel2, TextField as TextField2 } from "@mui/material";
237
+ import { useState as useState3 } from "react";
238
+ import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
239
+ var SavedPhraseTextField = (props) => {
240
+ const { validSeedPhrase, seedPhrase } = useSeedPhrase();
241
+ const [visible, setVisible] = useState3(false);
242
+ return /* @__PURE__ */ jsxs6(FormControl2, { fullWidth: true, size: "small", sx: { display: "flex", flexDirection: "column", rowGap: 1 }, children: [
243
+ /* @__PURE__ */ jsx7(Chip, { label: visible ? "Hide Saved Seed Phrase" : "Reveal Saved Seed Phrase", onClick: () => setVisible(!visible) }),
244
+ visible ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
245
+ /* @__PURE__ */ jsx7(FormLabel2, { children: /* @__PURE__ */ jsx7(PhraseHeaderBox, { conditional: validSeedPhrase, children: "Saved Seed Phrase" }) }),
246
+ /* @__PURE__ */ jsx7(
247
+ TextField2,
248
+ {
249
+ defaultValue: seedPhrase,
250
+ disabled: true,
251
+ error: validSeedPhrase === false,
252
+ helperText: validSeedPhrase === false ? /* @__PURE__ */ jsx7(InvalidPhraseTypography, {}) : null,
253
+ fullWidth: true,
254
+ maxRows: Infinity,
255
+ multiline: true,
256
+ ...props
257
+ }
258
+ )
259
+ ] }) : null
260
+ ] });
261
+ };
262
+
263
+ // src/components/SeedPhrase/dialog/components/OverwriteWarning.tsx
264
+ import { Alert, Button as Button4 } from "@mui/material";
265
+ import { FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
266
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
267
+ var OverwriteWarning = () => {
268
+ const { handleCancelOverwrite, handleSave } = useSeedPhrase();
269
+ return /* @__PURE__ */ jsx8(
270
+ Alert,
271
+ {
272
+ variant: "outlined",
273
+ severity: "warning",
274
+ action: /* @__PURE__ */ jsxs7(FlexRow2, { sx: { columnGap: 1 }, children: [
275
+ /* @__PURE__ */ jsx8(Button4, { variant: "outlined", color: "inherit", size: "small", onClick: handleSave, children: "Overwrite" }),
276
+ /* @__PURE__ */ jsx8(Button4, { variant: "outlined", color: "inherit", size: "small", onClick: handleCancelOverwrite, children: "Cancel" })
277
+ ] }),
278
+ children: "Are you sure you want to overwrite existing seed phrase? This action cannot be undone."
279
+ }
280
+ );
281
+ };
282
+
283
+ // src/components/SeedPhrase/dialog/SeedPhraseDialog.tsx
284
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
285
+ var SeedPhraseDialog = ({ changeSeedPhrase, seedPhrase, ...props }) => {
286
+ return /* @__PURE__ */ jsx9(
8
287
  SeedPhraseProvider,
9
288
  {
10
289
  seedPhrase,
11
290
  handleChangeSeedPhrase: changeSeedPhrase,
12
291
  open: props.open,
13
292
  saveCallback: () => props.onClose?.({}, "escapeKeyDown"),
14
- children: /* @__PURE__ */ jsx(SeedPhraseDialogInner, { ...props })
293
+ children: /* @__PURE__ */ jsx9(SeedPhraseDialogInner, { ...props })
15
294
  }
16
295
  );
17
296
  };
18
- const SeedPhraseDialogInner = (props) => {
297
+ var SeedPhraseDialogInner = (props) => {
19
298
  const { overwriteWarning, seedPhrase } = useSeedPhrase();
20
- return /* @__PURE__ */ jsxs(Dialog, { "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description", fullWidth: true, maxWidth: "sm", ...props, children: [
21
- /* @__PURE__ */ jsxs(DialogTitle, { id: "alert-dialog-title", children: [
299
+ return /* @__PURE__ */ jsxs8(Dialog2, { "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description", fullWidth: true, maxWidth: "sm", ...props, children: [
300
+ /* @__PURE__ */ jsxs8(DialogTitle2, { id: "alert-dialog-title", children: [
22
301
  "Update Your Seed Phrase ",
23
- /* @__PURE__ */ jsx(SeedPhraseIconButton, {})
302
+ /* @__PURE__ */ jsx9(SeedPhraseIconButton, {})
24
303
  ] }),
25
- /* @__PURE__ */ jsxs(DialogContent, { sx: { display: "flex", flexDirection: "column", rowGap: 2 }, children: [
26
- /* @__PURE__ */ jsx(NewPhraseTextField, {}),
27
- seedPhrase ? /* @__PURE__ */ jsx(SavedPhraseTextField, {}) : null,
28
- overwriteWarning ? /* @__PURE__ */ jsx(OverwriteWarning, {}) : null
304
+ /* @__PURE__ */ jsxs8(DialogContent2, { sx: { display: "flex", flexDirection: "column", rowGap: 2 }, children: [
305
+ /* @__PURE__ */ jsx9(NewPhraseTextField, {}),
306
+ seedPhrase ? /* @__PURE__ */ jsx9(SavedPhraseTextField, {}) : null,
307
+ overwriteWarning ? /* @__PURE__ */ jsx9(OverwriteWarning, {}) : null
29
308
  ] }),
30
- /* @__PURE__ */ jsx(DialogActionButtons, { onClose: props.onClose })
309
+ /* @__PURE__ */ jsx9(DialogActionButtons, { onClose: props.onClose })
31
310
  ] });
32
311
  };
33
312
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/SeedPhrase/dialog/SeedPhraseDialog.tsx"],"sourcesContent":["import { Dialog, DialogContent, DialogProps, DialogTitle } from '@mui/material'\n\nimport { SeedPhraseProvider, useSeedPhrase } from '../../../contexts'\nimport { SeedPhraseIconButton } from '../_shared'\nimport { DialogActionButtons, NewPhraseTextField, OverwriteWarning, SavedPhraseTextField } from './components'\n\nexport interface SeedPhraseDialogProps extends DialogProps {\n changeSeedPhrase?: (value: string) => void\n seedPhrase?: string\n}\n\nexport const SeedPhraseDialog: React.FC<SeedPhraseDialogProps> = ({ changeSeedPhrase, seedPhrase, ...props }) => {\n return (\n <SeedPhraseProvider\n seedPhrase={seedPhrase}\n handleChangeSeedPhrase={changeSeedPhrase}\n open={props.open}\n saveCallback={() => props.onClose?.({}, 'escapeKeyDown')}\n >\n <SeedPhraseDialogInner {...props} />\n </SeedPhraseProvider>\n )\n}\n\nexport const SeedPhraseDialogInner: React.FC<SeedPhraseDialogProps> = (props) => {\n const { overwriteWarning, seedPhrase } = useSeedPhrase()\n\n return (\n <Dialog aria-labelledby=\"alert-dialog-title\" aria-describedby=\"alert-dialog-description\" fullWidth maxWidth={'sm'} {...props}>\n <DialogTitle id=\"alert-dialog-title\">\n Update Your Seed Phrase <SeedPhraseIconButton />\n </DialogTitle>\n <DialogContent sx={{ display: 'flex', flexDirection: 'column', rowGap: 2 }}>\n <NewPhraseTextField />\n {seedPhrase ? <SavedPhraseTextField /> : null}\n {overwriteWarning ? <OverwriteWarning /> : null}\n </DialogContent>\n <DialogActionButtons onClose={props.onClose} />\n </Dialog>\n )\n}\n"],"mappings":"AAmBM,cAUA,YAVA;AAnBN,SAAS,QAAQ,eAA4B,mBAAmB;AAEhE,SAAS,oBAAoB,qBAAqB;AAClD,SAAS,4BAA4B;AACrC,SAAS,qBAAqB,oBAAoB,kBAAkB,4BAA4B;AAOzF,MAAM,mBAAoD,CAAC,EAAE,kBAAkB,YAAY,GAAG,MAAM,MAAM;AAC/G,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,wBAAwB;AAAA,MACxB,MAAM,MAAM;AAAA,MACZ,cAAc,MAAM,MAAM,UAAU,CAAC,GAAG,eAAe;AAAA,MAEvD,8BAAC,yBAAuB,GAAG,OAAO;AAAA;AAAA,EACpC;AAEJ;AAEO,MAAM,wBAAyD,CAAC,UAAU;AAC/E,QAAM,EAAE,kBAAkB,WAAW,IAAI,cAAc;AAEvD,SACE,qBAAC,UAAO,mBAAgB,sBAAqB,oBAAiB,4BAA2B,WAAS,MAAC,UAAU,MAAO,GAAG,OACrH;AAAA,yBAAC,eAAY,IAAG,sBAAqB;AAAA;AAAA,MACX,oBAAC,wBAAqB;AAAA,OAChD;AAAA,IACA,qBAAC,iBAAc,IAAI,EAAE,SAAS,QAAQ,eAAe,UAAU,QAAQ,EAAE,GACvE;AAAA,0BAAC,sBAAmB;AAAA,MACnB,aAAa,oBAAC,wBAAqB,IAAK;AAAA,MACxC,mBAAmB,oBAAC,oBAAiB,IAAK;AAAA,OAC7C;AAAA,IACA,oBAAC,uBAAoB,SAAS,MAAM,SAAS;AAAA,KAC/C;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/components/SeedPhrase/dialog/SeedPhraseDialog.tsx","../../../../../src/contexts/SeedPhrase/Context.ts","../../../../../src/contexts/SeedPhrase/Provider.tsx","../../../../../src/contexts/SeedPhrase/use.tsx","../../../../../src/components/SeedPhrase/_shared/SeedPhraseIconButton.tsx","../../../../../src/components/SeedPhrase/dialog/components/DialogActionButtons.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 { Dialog, DialogContent, DialogProps, DialogTitle } from '@mui/material'\n\nimport { SeedPhraseProvider, useSeedPhrase } from '../../../contexts'\nimport { SeedPhraseIconButton } from '../_shared'\nimport { DialogActionButtons, NewPhraseTextField, OverwriteWarning, SavedPhraseTextField } from './components'\n\nexport interface SeedPhraseDialogProps extends DialogProps {\n changeSeedPhrase?: (value: string) => void\n seedPhrase?: string\n}\n\nexport const SeedPhraseDialog: React.FC<SeedPhraseDialogProps> = ({ changeSeedPhrase, seedPhrase, ...props }) => {\n return (\n <SeedPhraseProvider\n seedPhrase={seedPhrase}\n handleChangeSeedPhrase={changeSeedPhrase}\n open={props.open}\n saveCallback={() => props.onClose?.({}, 'escapeKeyDown')}\n >\n <SeedPhraseDialogInner {...props} />\n </SeedPhraseProvider>\n )\n}\n\nexport const SeedPhraseDialogInner: React.FC<SeedPhraseDialogProps> = (props) => {\n const { overwriteWarning, seedPhrase } = useSeedPhrase()\n\n return (\n <Dialog aria-labelledby=\"alert-dialog-title\" aria-describedby=\"alert-dialog-description\" fullWidth maxWidth={'sm'} {...props}>\n <DialogTitle id=\"alert-dialog-title\">\n Update Your Seed Phrase <SeedPhraseIconButton />\n </DialogTitle>\n <DialogContent sx={{ display: 'flex', flexDirection: 'column', rowGap: 2 }}>\n <NewPhraseTextField />\n {seedPhrase ? <SavedPhraseTextField /> : null}\n {overwriteWarning ? <OverwriteWarning /> : null}\n </DialogContent>\n <DialogActionButtons onClose={props.onClose} />\n </Dialog>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { SeedPhraseContextState } from './State'\n\nexport const SeedPhraseContext = createContextEx<SeedPhraseContextState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { generateMnemonic, validateMnemonic, wordlists } from '@xyo-network/bip39'\nimport { useEffect, useMemo, useState } from 'react'\n\nimport { SeedPhraseContext } from './Context'\n\nexport interface SeedPhraseProviderProps extends WithChildren {\n defaultPhrase?: string\n handleChangeSeedPhrase?: (phrase: string) => void\n open?: boolean\n saveCallback?: () => void\n seedPhrase?: string\n}\n\nexport const SeedPhraseProvider: React.FC<SeedPhraseProviderProps> = ({\n children,\n defaultPhrase,\n handleChangeSeedPhrase,\n saveCallback,\n seedPhrase,\n open,\n}) => {\n const [phrase, setPhrase] = useState<string | undefined>()\n const [overwriteWarning, setOverwriteWarning] = useState(false)\n\n useEffect(() => {\n setPhrase(defaultPhrase)\n }, [defaultPhrase])\n\n useEffect(() => {\n if (!open) {\n handleCancelOverwrite()\n }\n }, [open])\n\n useEffect(() => {\n if (seedPhrase || open) {\n setPhrase?.(seedPhrase ?? '')\n }\n }, [seedPhrase, open, setPhrase])\n\n const handleGenerate = () => {\n const mnemonic = generateMnemonic(wordlists.english, 256)\n setPhrase?.(mnemonic)\n setOverwriteWarning?.(false)\n }\n\n const handleCancelOverwrite = () => {\n setOverwriteWarning?.(false)\n }\n\n const handleClear = () => {\n setPhrase?.('')\n setOverwriteWarning?.(false)\n }\n\n const handleSave = () => {\n if (!overwriteWarning && seedPhrase && seedPhrase !== phrase) {\n setOverwriteWarning?.(true)\n } else {\n handleChangeSeedPhrase?.(phrase ?? '')\n saveCallback?.()\n }\n }\n\n const validate = (passedPhrase?: string) => {\n if (!passedPhrase) {\n return null\n }\n return validateMnemonic(passedPhrase, wordlists.english)\n }\n\n const validSeedPhrase = useMemo(() => validate?.(seedPhrase), [seedPhrase])\n const validPhrase = useMemo(() => validate?.(phrase), [phrase])\n\n return (\n <SeedPhraseContext.Provider\n value={{\n handleCancelOverwrite,\n handleChangeSeedPhrase,\n handleClear,\n handleGenerate,\n handleSave,\n overwriteWarning,\n phrase,\n provided: true,\n seedPhrase,\n setOverwriteWarning,\n setPhrase,\n validPhrase,\n validSeedPhrase,\n validate,\n }}\n >\n {children}\n </SeedPhraseContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { SeedPhraseContext } from './Context'\n\nexport const useSeedPhrase = () => useContextEx(SeedPhraseContext, 'SeedPhrase', true)\n","import { HelpOutline as HelpOutlineIcon } from '@mui/icons-material'\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n IconButton,\n IconButtonProps,\n Link,\n List,\n ListItem,\n Typography,\n} from '@mui/material'\nimport { useState } from 'react'\n\nexport const SeedPhraseIconButton: React.FC<IconButtonProps> = (props) => {\n const [open, setOpen] = useState(false)\n const onClose = () => setOpen(false)\n return (\n <>\n <IconButton onClick={() => setOpen(true)} {...props}>\n <HelpOutlineIcon fontSize=\"small\" />\n </IconButton>\n <Dialog open={open}>\n <DialogTitle>Understanding your Seed Phrase</DialogTitle>\n <DialogContent>\n <Typography>\n Your Seed Phrase should adhere to the{' '}\n <Link target={'_blank'} href=\"https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki\">\n bip39 specification\n </Link>{' '}\n and is used to generate accounts which identify your data on the XYO Network.\n </Typography>\n <List>\n <ListItem>Do not share this phrase with anyone.</ListItem>\n <ListItem>Do not save it to a public computer.</ListItem>\n <ListItem>Do not use a existing phrase from another wallet (i.e. Metamask).</ListItem>\n <ListItem>Do not use before copying it down somewhere safe.</ListItem>\n </List>\n </DialogContent>\n <DialogActions>\n <Button onClick={onClose} variant=\"outlined\">\n OK\n </Button>\n </DialogActions>\n </Dialog>\n </>\n )\n}\n","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 { 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,UAAAA,SAAQ,iBAAAC,gBAA4B,eAAAC,oBAAmB;;;ACAhE,SAAS,uBAAuB;AAIzB,IAAM,oBAAoB,gBAAwC;;;ACHzE,SAAS,kBAAkB,kBAAkB,iBAAiB;AAC9D,SAAS,WAAW,SAAS,gBAAgB;AA0EzC;AA9DG,IAAM,qBAAwD,CAAC;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,QAAQ,SAAS,IAAI,SAA6B;AACzD,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,KAAK;AAE9D,YAAU,MAAM;AACd,cAAU,aAAa;AAAA,EACzB,GAAG,CAAC,aAAa,CAAC;AAElB,YAAU,MAAM;AACd,QAAI,CAAC,MAAM;AACT,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AAET,YAAU,MAAM;AACd,QAAI,cAAc,MAAM;AACtB,kBAAY,cAAc,EAAE;AAAA,IAC9B;AAAA,EACF,GAAG,CAAC,YAAY,MAAM,SAAS,CAAC;AAEhC,QAAM,iBAAiB,MAAM;AAC3B,UAAM,WAAW,iBAAiB,UAAU,SAAS,GAAG;AACxD,gBAAY,QAAQ;AACpB,0BAAsB,KAAK;AAAA,EAC7B;AAEA,QAAM,wBAAwB,MAAM;AAClC,0BAAsB,KAAK;AAAA,EAC7B;AAEA,QAAM,cAAc,MAAM;AACxB,gBAAY,EAAE;AACd,0BAAsB,KAAK;AAAA,EAC7B;AAEA,QAAM,aAAa,MAAM;AACvB,QAAI,CAAC,oBAAoB,cAAc,eAAe,QAAQ;AAC5D,4BAAsB,IAAI;AAAA,IAC5B,OAAO;AACL,+BAAyB,UAAU,EAAE;AACrC,qBAAe;AAAA,IAC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AAC,UAAU;AAC/E,QAAM,EAAE,kBAAkB,WAAW,IAAI,cAAc;AAEvD,SACE,gBAAAC,MAACC,SAAA,EAAO,mBAAgB,sBAAqB,oBAAiB,4BAA2B,WAAS,MAAC,UAAU,MAAO,GAAG,OACrH;AAAA,oBAAAD,MAACE,cAAA,EAAY,IAAG,sBAAqB;AAAA;AAAA,MACX,gBAAAH,KAAC,wBAAqB;AAAA,OAChD;AAAA,IACA,gBAAAC,MAACG,gBAAA,EAAc,IAAI,EAAE,SAAS,QAAQ,eAAe,UAAU,QAAQ,EAAE,GACvE;AAAA,sBAAAJ,KAAC,sBAAmB;AAAA,MACnB,aAAa,gBAAAA,KAAC,wBAAqB,IAAK;AAAA,MACxC,mBAAmB,gBAAAA,KAAC,oBAAiB,IAAK;AAAA,OAC7C;AAAA,IACA,gBAAAA,KAAC,uBAAoB,SAAS,MAAM,SAAS;AAAA,KAC/C;AAEJ;","names":["Dialog","DialogContent","DialogTitle","useState","jsx","Button","DialogActions","jsx","jsxs","DialogActions","Button","Button","DialogActions","Link","Typography","jsx","jsxs","useMemo","jsx","jsxs","Fragment","jsx","jsxs","DialogActions","Button","FormControl","FormLabel","TextField","useState","Fragment","jsx","jsxs","useState","FormControl","FormLabel","TextField","Button","FlexRow","jsx","jsxs","FlexRow","Button","jsx","jsxs","Dialog","DialogTitle","DialogContent"]}
@@ -1,7 +1,17 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ // src/components/SeedPhrase/dialog/components/DialogActionButtons.tsx
2
2
  import { Button, DialogActions } from "@mui/material";
3
- import { useSeedPhrase } from "../../../../contexts";
4
- const DialogActionButtons = ({ onClose, ...props }) => {
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 }) => {
5
15
  const { handleSave, setPhrase } = useSeedPhrase();
6
16
  const wrappedOnClose = (e) => {
7
17
  setPhrase?.("");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/components/SeedPhrase/dialog/components/DialogActionButtons.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"],"mappings":"AAmBI,SACE,KADF;AAnBJ,SAAS,QAAQ,qBAAsD;AAGvE,SAAS,qBAAqB;AAMvB,MAAM,sBAA0D,CAAC,EAAE,SAAS,GAAG,MAAM,MAAM;AAChG,QAAM,EAAE,YAAY,UAAU,IAAI,cAAc;AAEhD,QAAM,iBAAiB,CAAC,MAA+B;AAErD,gBAAY,EAAE;AACd,cAAU,GAAG,eAAe;AAAA,EAC9B;AAEA,SACE,qBAAC,iBAAe,GAAG,OACjB;AAAA,wBAAC,UAAO,SAAQ,YAAW,SAAS,gBAAgB,oBAEpD;AAAA,IACA,oBAAC,UAAO,SAAQ,YAAW,SAAS,YAAY,kBAEhD;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../../src/components/SeedPhrase/dialog/components/DialogActionButtons.tsx","../../../../../../src/contexts/SeedPhrase/Context.ts","../../../../../../src/contexts/SeedPhrase/use.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"],"mappings":";AAAA,SAAS,QAAQ,qBAAsD;;;ACAvE,SAAS,uBAAuB;AAIzB,IAAM,oBAAoB,gBAAwC;;;ACJzE,SAAS,oBAAoB;AAItB,IAAM,gBAAgB,MAAM,aAAa,mBAAmB,cAAc,IAAI;;;AFejF,SACE,KADF;AAVG,IAAM,sBAA0D,CAAC,EAAE,SAAS,GAAG,MAAM,MAAM;AAChG,QAAM,EAAE,YAAY,UAAU,IAAI,cAAc;AAEhD,QAAM,iBAAiB,CAAC,MAA+B;AAErD,gBAAY,EAAE;AACd,cAAU,GAAG,eAAe;AAAA,EAC9B;AAEA,SACE,qBAAC,iBAAe,GAAG,OACjB;AAAA,wBAAC,UAAO,SAAQ,YAAW,SAAS,gBAAgB,oBAEpD;AAAA,IACA,oBAAC,UAAO,SAAQ,YAAW,SAAS,YAAY,kBAEhD;AAAA,KACF;AAEJ;","names":[]}
@@ -1,8 +1,18 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ // src/components/SeedPhrase/dialog/components/OverwriteWarning.tsx
2
2
  import { Alert, Button } from "@mui/material";
3
3
  import { FlexRow } from "@xylabs/react-flexbox";
4
- import { useSeedPhrase } from "../../../../contexts";
5
- const OverwriteWarning = () => {
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/OverwriteWarning.tsx
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ var OverwriteWarning = () => {
6
16
  const { handleCancelOverwrite, handleSave } = useSeedPhrase();
7
17
  return /* @__PURE__ */ jsx(
8
18
  Alert,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/components/SeedPhrase/dialog/components/OverwriteWarning.tsx"],"sourcesContent":["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":"AAYQ,SACE,KADF;AAZR,SAAS,OAAO,cAAc;AAC9B,SAAS,eAAe;AAExB,SAAS,qBAAqB;AAEvB,MAAM,mBAAmB,MAAM;AACpC,QAAM,EAAE,uBAAuB,WAAW,IAAI,cAAc;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,UAAS;AAAA,MACT,QACE,qBAAC,WAAQ,IAAI,EAAE,WAAW,EAAE,GAC1B;AAAA,4BAAC,UAAO,SAAQ,YAAW,OAAM,WAAU,MAAK,SAAQ,SAAS,YAAY,uBAE7E;AAAA,QACA,oBAAC,UAAO,SAAQ,YAAW,OAAM,WAAU,MAAK,SAAQ,SAAS,uBAAuB,oBAExF;AAAA,SACF;AAAA,MAEH;AAAA;AAAA,EAED;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../../src/components/SeedPhrase/dialog/components/OverwriteWarning.tsx","../../../../../../src/contexts/SeedPhrase/Context.ts","../../../../../../src/contexts/SeedPhrase/use.tsx"],"sourcesContent":["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","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"],"mappings":";AAAA,SAAS,OAAO,cAAc;AAC9B,SAAS,eAAe;;;ACDxB,SAAS,uBAAuB;AAIzB,IAAM,oBAAoB,gBAAwC;;;ACJzE,SAAS,oBAAoB;AAItB,IAAM,gBAAgB,MAAM,aAAa,mBAAmB,cAAc,IAAI;;;AFQ7E,SACE,KADF;AAPD,IAAM,mBAAmB,MAAM;AACpC,QAAM,EAAE,uBAAuB,WAAW,IAAI,cAAc;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,UAAS;AAAA,MACT,QACE,qBAAC,WAAQ,IAAI,EAAE,WAAW,EAAE,GAC1B;AAAA,4BAAC,UAAO,SAAQ,YAAW,OAAM,WAAU,MAAK,SAAQ,SAAS,YAAY,uBAE7E;AAAA,QACA,oBAAC,UAAO,SAAQ,YAAW,OAAM,WAAU,MAAK,SAAQ,SAAS,uBAAuB,oBAExF;AAAA,SACF;AAAA,MAEH;AAAA;AAAA,EAED;AAEJ;","names":[]}
@@ -1,19 +1,81 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
+ // src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx
2
2
  import { Button, DialogActions, FormControl, FormLabel, TextField } from "@mui/material";
3
- import { useSeedPhrase } from "../../../../../contexts";
4
- import { colorParser, InvalidPhraseTypography, PhraseHeaderBox } from "./validation-messages";
5
- const NewPhraseTextField = (props) => {
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) => {
6
68
  const { handleClear, handleGenerate, overwriteWarning, phrase, setPhrase, validPhrase } = useSeedPhrase();
7
- return /* @__PURE__ */ jsxs(Fragment, { children: [
8
- /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, size: "small", sx: { display: "flex", flexDirection: "column", rowGap: 1 }, children: [
9
- /* @__PURE__ */ jsx(FormLabel, { children: /* @__PURE__ */ jsx(PhraseHeaderBox, { conditional: validPhrase, children: "New Seed Phrase" }) }),
10
- /* @__PURE__ */ jsx(
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(
11
73
  TextField,
12
74
  {
13
75
  focused: true,
14
76
  color: colorParser(validPhrase),
15
77
  error: validPhrase === false,
16
- helperText: validPhrase === false ? /* @__PURE__ */ jsx(InvalidPhraseTypography, {}) : null,
78
+ helperText: validPhrase === false ? /* @__PURE__ */ jsx3(InvalidPhraseTypography, {}) : null,
17
79
  fullWidth: true,
18
80
  maxRows: Infinity,
19
81
  multiline: true,
@@ -23,9 +85,9 @@ const NewPhraseTextField = (props) => {
23
85
  }
24
86
  )
25
87
  ] }),
26
- /* @__PURE__ */ jsxs(DialogActions, { sx: { justifyContent: "center" }, children: [
27
- /* @__PURE__ */ jsx(Button, { disabled: overwriteWarning, variant: "outlined", onClick: handleGenerate, children: "Generate" }),
28
- /* @__PURE__ */ jsx(Button, { variant: "outlined", onClick: handleClear, children: "Clear" })
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" })
29
91
  ] })
30
92
  ] });
31
93
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.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"],"mappings":"AAQI,mBAGM,KAFJ,YADF;AARJ,SAAS,QAAQ,eAAe,aAAa,WAAmC,iBAAiB;AAEjG,SAAS,qBAAqB;AAC9B,SAAS,aAAa,yBAAyB,uBAAuB;AAE/D,MAAM,qBAAuD,CAAC,UAAU;AAC7E,QAAM,EAAE,aAAa,gBAAgB,kBAAkB,QAAQ,WAAW,YAAY,IAAI,cAAc;AACxG,SACE,iCACE;AAAA,yBAAC,eAAY,WAAS,MAAC,MAAK,SAAQ,IAAI,EAAE,SAAS,QAAQ,eAAe,UAAU,QAAQ,EAAE,GAC5F;AAAA,0BAAC,aACC,8BAAC,mBAAgB,aAAa,aAAa,6BAAe,GAC5D;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,SAAO;AAAA,UACP,OAAO,YAAY,WAAW;AAAA,UAC9B,OAAO,gBAAgB;AAAA,UACvB,YAAY,gBAAgB,QAAQ,oBAAC,2BAAwB,IAAK;AAAA,UAClE,WAAS;AAAA,UACT,SAAS;AAAA,UACT,WAAS;AAAA,UACT,UAAU,CAAC,MAAM,YAAY,EAAE,OAAO,KAAK;AAAA,UAC3C,OAAO;AAAA,UACN,GAAG;AAAA;AAAA,MACN;AAAA,OACF;AAAA,IACA,qBAAC,iBAAc,IAAI,EAAE,gBAAgB,SAAS,GAC5C;AAAA,0BAAC,UAAO,UAAU,kBAAkB,SAAQ,YAAW,SAAS,gBAAgB,sBAEhF;AAAA,MACA,oBAAC,UAAO,SAAQ,YAAW,SAAS,aAAa,mBAEjD;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
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"],"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"],"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,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG,CAAC,WAAW,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