@canton-network/core-wallet-ui-components 1.19.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,62 +1,63 @@
1
- import { A as e, At as t, C as n, E as r, Mt as i, T as a, Z as o, ct as s, f as c, ft as ee, g as te, i as l, j as u, l as d, lt as f, m as p, nt as m, ot as h, s as g, t as _, v, vt as y } from "../error-toast-DQZ4SB72.js";
2
- import b, { createContext as ne, useCallback as x, useContext as re, useEffect as S, useMemo as C, useRef as w, useState as T } from "react";
3
- import { createComponent as E } from "@lit/react";
4
- import { Alert as D, AlertTitle as O, Box as k, Button as A, CircularProgress as j, IconButton as M, Snackbar as N, Stack as P, TextField as F, Tooltip as I, Typography as L } from "@mui/material";
5
- import { jsx as R, jsxs as z } from "react/jsx-runtime";
6
- import B from "@mui/icons-material/ChevronLeft";
7
- import V from "@mui/icons-material/ContentCopy";
1
+ import { A as e, C as t, E as n, G as r, K as i, P as a, T as o, U as s, Y as c, f as l, g as ee, ht as u, i as d, l as f, m as p, pt as m, s as h, t as g, tt as _, v, z as y } from "../error-toast-CpOdjSpE.js";
2
+ import b, { createContext as te, useCallback as x, useContext as ne, useEffect as re, useMemo as S, useRef as C, useState as w } from "react";
3
+ import { createComponent as T } from "@lit/react";
4
+ import { Alert as E, AlertTitle as D, Box as O, Button as k, CircularProgress as A, IconButton as j, Snackbar as M, Stack as N, TextField as P, Tooltip as F, Typography as I } from "@mui/material";
5
+ import { jsx as L, jsxs as R } from "react/jsx-runtime";
6
+ import z from "@mui/icons-material/ChevronLeft";
7
+ import B from "@mui/icons-material/ContentCopy";
8
+ import { getLogger as V } from "@logtape/logtape";
8
9
  import { keyframes as H } from "@mui/material/styles";
9
10
  // src/react/components/ApiKeyCard.tsx
10
- var U = E({
11
+ var U = T({
11
12
  tagName: "api-key-card",
12
- elementClass: i,
13
+ elementClass: u,
13
14
  react: b,
14
15
  events: { onRevoke: "revoke" }
15
- }), W = () => /* @__PURE__ */ R(j, {
16
+ }), W = () => /* @__PURE__ */ L(A, {
16
17
  size: 16,
17
18
  color: "inherit",
18
19
  "aria-hidden": "true"
19
- }), G = ({ onApprove: e, onReject: t, approveLabel: n = "Approve", approving: r = !1, rejecting: i = !1, signing: a = !1, disabled: o = !1 }) => /* @__PURE__ */ z(P, {
20
+ }), G = ({ onApprove: e, onReject: t, approveLabel: n = "Approve", approving: r = !1, rejecting: i = !1, signing: a = !1, disabled: o = !1 }) => /* @__PURE__ */ R(N, {
20
21
  direction: "row",
21
22
  spacing: 2,
22
- children: [t && /* @__PURE__ */ R(A, {
23
+ children: [t && /* @__PURE__ */ L(k, {
23
24
  variant: "outlined",
24
25
  color: "error",
25
26
  fullWidth: !0,
26
27
  disabled: o || r || i,
27
- startIcon: i ? /* @__PURE__ */ R(W, {}) : void 0,
28
+ startIcon: i ? /* @__PURE__ */ L(W, {}) : void 0,
28
29
  onClick: t,
29
30
  children: "Reject"
30
- }), /* @__PURE__ */ R(A, {
31
+ }), /* @__PURE__ */ L(k, {
31
32
  variant: "contained",
32
33
  fullWidth: !0,
33
34
  disabled: o || r || i || a,
34
- startIcon: r || a ? /* @__PURE__ */ R(W, {}) : void 0,
35
+ startIcon: r || a ? /* @__PURE__ */ L(W, {}) : void 0,
35
36
  onClick: e,
36
37
  children: n
37
38
  })]
38
- }), K = E({
39
+ }), K = T({
39
40
  tagName: "api-key-form",
40
- elementClass: t,
41
+ elementClass: m,
41
42
  react: b,
42
43
  events: { onApiKeyGenerate: "api-key-generate" }
43
- }), q = E({
44
+ }), q = T({
44
45
  tagName: "app-header",
45
- elementClass: y,
46
+ elementClass: _,
46
47
  react: b,
47
48
  events: {
48
49
  onLogout: "logout",
49
50
  onCopyDappApiUrl: "copy-dapp-api-url"
50
51
  }
51
- }), J = ({ label: e = "Back", href: t, onClick: n }) => /* @__PURE__ */ R(A, {
52
+ }), J = ({ label: e = "Back", href: t, onClick: n }) => /* @__PURE__ */ L(k, {
52
53
  color: "inherit",
53
54
  size: "small",
54
- startIcon: /* @__PURE__ */ R(B, {}),
55
+ startIcon: /* @__PURE__ */ L(z, {}),
55
56
  ...t === void 0 ? { onClick: n } : { href: t },
56
57
  children: e
57
58
  }), Y = ({ label: e, value: t, title: n = typeof t == "string" ? t : void 0, muted: r = !1, action: i }) => {
58
59
  let a = typeof t == "string";
59
- return /* @__PURE__ */ z(k, {
60
+ return /* @__PURE__ */ R(O, {
60
61
  sx: {
61
62
  display: "flex",
62
63
  alignItems: "center",
@@ -65,7 +66,7 @@ var U = E({
65
66
  minHeight: 40
66
67
  },
67
68
  children: [
68
- /* @__PURE__ */ R(L, {
69
+ /* @__PURE__ */ L(I, {
69
70
  variant: "body2",
70
71
  noWrap: !0,
71
72
  sx: {
@@ -75,7 +76,7 @@ var U = E({
75
76
  },
76
77
  children: e
77
78
  }),
78
- /* @__PURE__ */ R(L, {
79
+ /* @__PURE__ */ L(I, {
79
80
  variant: "body2",
80
81
  component: "div",
81
82
  noWrap: a,
@@ -95,7 +96,7 @@ var U = E({
95
96
  },
96
97
  children: t
97
98
  }),
98
- i && /* @__PURE__ */ R(k, {
99
+ i && /* @__PURE__ */ L(O, {
99
100
  sx: {
100
101
  position: "relative",
101
102
  zIndex: 1,
@@ -105,11 +106,11 @@ var U = E({
105
106
  })
106
107
  ]
107
108
  });
108
- }, ie = u(["core", "wallet-ui-components/react"]), ae = ({ onCopy: e, value: t, label: n = "Copy to clipboard" }) => {
109
- let [r, i] = T(!1), a = w(void 0);
110
- return S(() => () => clearTimeout(a.current), []), /* @__PURE__ */ R(I, {
109
+ }, ie = V(["core", "wallet-ui-components/react"]), ae = ({ onCopy: e, value: t, label: n = "Copy to clipboard" }) => {
110
+ let [r, i] = w(!1), a = C(void 0);
111
+ return re(() => () => clearTimeout(a.current), []), /* @__PURE__ */ L(F, {
111
112
  title: r ? "Copied" : n,
112
- children: /* @__PURE__ */ R(M, {
113
+ children: /* @__PURE__ */ L(j, {
113
114
  "aria-label": n,
114
115
  onClick: async (n) => {
115
116
  if (n.stopPropagation(), t) try {
@@ -120,29 +121,29 @@ var U = E({
120
121
  ie.getChild("CopyButton").error("Unable to copy value", { error: e });
121
122
  }
122
123
  },
123
- children: /* @__PURE__ */ R(V, { color: r ? "success" : "inherit" })
124
+ children: /* @__PURE__ */ L(B, { color: r ? "success" : "inherit" })
124
125
  })
125
126
  });
126
- }, oe = E({
127
+ }, oe = T({
127
128
  tagName: "wg-error-page",
128
- elementClass: ee,
129
+ elementClass: c,
129
130
  react: b,
130
131
  events: {
131
132
  onErrorBack: "error-back",
132
133
  onErrorRefresh: "error-refresh"
133
134
  }
134
- }), se = E({
135
+ }), se = T({
135
136
  tagName: "idp-card",
136
- elementClass: h,
137
+ elementClass: s,
137
138
  react: b,
138
139
  events: {
139
140
  onIdpReview: "idp-review",
140
141
  onDelete: "delete",
141
142
  onUpdate: "update"
142
143
  }
143
- }), ce = E({
144
+ }), ce = T({
144
145
  tagName: "idp-form",
145
- elementClass: m,
146
+ elementClass: y,
146
147
  react: b,
147
148
  events: {
148
149
  onIdpFormSave: "idp-form-save",
@@ -159,7 +160,7 @@ var U = E({
159
160
  transform: scale(1);
160
161
  opacity: 1;
161
162
  }
162
- `, ue = ({ text: e = "Loading" }) => /* @__PURE__ */ z(P, {
163
+ `, ue = ({ text: e = "Loading" }) => /* @__PURE__ */ R(N, {
163
164
  role: "status",
164
165
  "aria-live": "polite",
165
166
  spacing: 2,
@@ -169,7 +170,7 @@ var U = E({
169
170
  alignItems: "center",
170
171
  p: 3
171
172
  },
172
- children: [/* @__PURE__ */ R(P, {
173
+ children: [/* @__PURE__ */ L(N, {
173
174
  direction: "row",
174
175
  spacing: 1,
175
176
  "aria-hidden": "true",
@@ -177,7 +178,7 @@ var U = E({
177
178
  0,
178
179
  1,
179
180
  2
180
- ].map((e) => /* @__PURE__ */ R(k, { sx: {
181
+ ].map((e) => /* @__PURE__ */ L(O, { sx: {
181
182
  width: 8,
182
183
  height: 8,
183
184
  borderRadius: "50%",
@@ -186,37 +187,37 @@ var U = E({
186
187
  animationDelay: `${e * .15}s`,
187
188
  "@media (prefers-reduced-motion: reduce)": { animation: "none" }
188
189
  } }, e))
189
- }), /* @__PURE__ */ R(L, {
190
+ }), /* @__PURE__ */ L(I, {
190
191
  variant: "body1",
191
192
  color: "text.secondary",
192
193
  children: e
193
194
  })]
194
- }), de = E({
195
+ }), de = T({
195
196
  tagName: "wg-login-form",
196
- elementClass: c,
197
+ elementClass: l,
197
198
  react: b,
198
199
  events: {
199
200
  onLoginConnect: "login-connect",
200
201
  onLoginBack: "login-back"
201
202
  }
202
- }), fe = E({
203
+ }), fe = T({
203
204
  tagName: "wg-message-detail",
204
- elementClass: l,
205
+ elementClass: d,
205
206
  react: b,
206
207
  events: {
207
208
  onMessageApprove: "message-approve",
208
209
  onMessageDelete: "message-delete"
209
210
  }
210
- }), pe = E({
211
+ }), pe = T({
211
212
  tagName: "network-card",
212
- elementClass: o,
213
+ elementClass: a,
213
214
  react: b,
214
215
  events: {
215
216
  onNetworkReview: "network-review",
216
217
  onDelete: "delete",
217
218
  onUpdate: "update"
218
219
  }
219
- }), me = E({
220
+ }), me = T({
220
221
  tagName: "network-form",
221
222
  elementClass: e,
222
223
  react: b,
@@ -225,22 +226,22 @@ var U = E({
225
226
  onNetworkEditSave: "network-edit-save",
226
227
  onNetworkDelete: "network-delete"
227
228
  }
228
- }), he = E({
229
+ }), he = T({
229
230
  tagName: "not-found",
230
- elementClass: r,
231
+ elementClass: n,
231
232
  react: b
232
- }), ge = E({
233
+ }), ge = T({
233
234
  tagName: "wg-page-header",
234
- elementClass: f,
235
+ elementClass: i,
235
236
  react: b
236
- }), _e = E({
237
+ }), _e = T({
237
238
  tagName: "wg-pagination",
238
- elementClass: s,
239
+ elementClass: r,
239
240
  react: b,
240
241
  events: { onPageChange: "page-change" }
241
242
  }), ve = ({ signingProviders: e, value: t, onChange: n, disabled: r = !1, disabledProviders: i = [] }) => {
242
243
  let a = e === void 0, o = e?.length === 0;
243
- return /* @__PURE__ */ z(F, {
244
+ return /* @__PURE__ */ R(P, {
244
245
  id: "signing-provider-id",
245
246
  select: !0,
246
247
  label: "Signing Provider",
@@ -253,19 +254,19 @@ var U = E({
253
254
  select: { native: !0 },
254
255
  inputLabel: { shrink: !0 }
255
256
  },
256
- children: [/* @__PURE__ */ R("option", {
257
+ children: [/* @__PURE__ */ L("option", {
257
258
  value: "",
258
259
  disabled: !0,
259
260
  children: a ? "Loading signing providers..." : o ? "No signing providers available" : "Select signing provider"
260
- }), e?.map((e) => /* @__PURE__ */ R("option", {
261
+ }), e?.map((e) => /* @__PURE__ */ L("option", {
261
262
  value: e,
262
263
  disabled: i.includes(e),
263
264
  children: e
264
265
  }, e))]
265
266
  });
266
267
  }, X = ({ title: e, message: t, type: n = "error", buttonText: r = "Dismiss notification", autoHideDuration: i, onExited: a }) => {
267
- let [o, s] = T(!0);
268
- return /* @__PURE__ */ R(N, {
268
+ let [o, s] = w(!0);
269
+ return /* @__PURE__ */ L(M, {
269
270
  open: o,
270
271
  autoHideDuration: i,
271
272
  onClose: (e, t) => {
@@ -276,31 +277,31 @@ var U = E({
276
277
  position: "static",
277
278
  pointerEvents: "auto"
278
279
  },
279
- children: /* @__PURE__ */ z(D, {
280
+ children: /* @__PURE__ */ R(E, {
280
281
  role: n === "error" ? "alert" : "status",
281
282
  severity: n,
282
283
  closeText: r,
283
284
  onClose: () => s(!1),
284
285
  sx: { width: "100%" },
285
- children: [/* @__PURE__ */ R(O, { children: e }), t]
286
+ children: [/* @__PURE__ */ L(D, { children: e }), t]
286
287
  })
287
288
  });
288
- }, ye = E({
289
+ }, ye = T({
289
290
  tagName: "wg-transaction-card",
290
- elementClass: d,
291
+ elementClass: f,
291
292
  react: b,
292
293
  events: { onTransactionReview: "transaction-review" }
293
- }), be = E({
294
+ }), be = T({
294
295
  tagName: "wg-transaction-detail",
295
- elementClass: g,
296
+ elementClass: h,
296
297
  react: b,
297
298
  events: {
298
299
  onTransactionApprove: "transaction-approve",
299
300
  onTransactionDelete: "transaction-delete"
300
301
  }
301
- }), xe = E({
302
+ }), xe = T({
302
303
  tagName: "wg-wallet-card",
303
- elementClass: n,
304
+ elementClass: t,
304
305
  react: b,
305
306
  events: {
306
307
  onWalletSetPrimary: "wallet-set-primary",
@@ -308,15 +309,15 @@ var U = E({
308
309
  onWalletAllocate: "wallet-allocate",
309
310
  onWalletSelect: "wallet-select"
310
311
  }
311
- }), Se = E({
312
+ }), Se = T({
312
313
  tagName: "wg-wallet-create-form",
313
- elementClass: te,
314
+ elementClass: ee,
314
315
  react: b,
315
316
  events: {
316
317
  onWalletCreate: "wallet-create",
317
318
  onSigningProviderChange: "signing-provider-change"
318
319
  }
319
- }), Z = E({
320
+ }), Z = T({
320
321
  tagName: "wg-wallet-edit-form",
321
322
  elementClass: p,
322
323
  react: b,
@@ -326,7 +327,7 @@ var U = E({
326
327
  }
327
328
  }), Ce = ({ children: e, onSubmit: t, submitLabel: n, submittingLabel: r, submittingMessage: i, submitting: a = !1, loading: o = !1, submitDisabled: s = !1 }) => {
328
329
  let c = a || o || s;
329
- return /* @__PURE__ */ z(k, {
330
+ return /* @__PURE__ */ R(O, {
330
331
  component: "form",
331
332
  onSubmit: (e) => {
332
333
  e.preventDefault(), c || t();
@@ -336,27 +337,27 @@ var U = E({
336
337
  flexDirection: "column",
337
338
  height: "100%"
338
339
  },
339
- children: [/* @__PURE__ */ R(P, {
340
+ children: [/* @__PURE__ */ L(N, {
340
341
  spacing: 2,
341
342
  children: e
342
- }), /* @__PURE__ */ z(P, {
343
+ }), /* @__PURE__ */ R(N, {
343
344
  spacing: 1,
344
345
  sx: {
345
346
  mt: "auto",
346
347
  pt: 3
347
348
  },
348
- children: [/* @__PURE__ */ R(A, {
349
+ children: [/* @__PURE__ */ L(k, {
349
350
  type: "submit",
350
351
  variant: "contained",
351
352
  fullWidth: !0,
352
353
  disabled: c,
353
- startIcon: a ? /* @__PURE__ */ R(j, {
354
+ startIcon: a ? /* @__PURE__ */ L(A, {
354
355
  size: 16,
355
356
  color: "inherit",
356
357
  "aria-hidden": "true"
357
358
  }) : void 0,
358
359
  children: a ? r : n
359
- }), a && /* @__PURE__ */ R(L, {
360
+ }), a && /* @__PURE__ */ L(I, {
360
361
  variant: "body2",
361
362
  color: "text.secondary",
362
363
  role: "status",
@@ -365,7 +366,7 @@ var U = E({
365
366
  })]
366
367
  })]
367
368
  });
368
- }, we = E({
369
+ }, we = T({
369
370
  tagName: "wg-wallet-list",
370
371
  elementClass: v,
371
372
  react: b,
@@ -374,21 +375,21 @@ var U = E({
374
375
  onWalletEdit: "wallet-edit",
375
376
  onWalletSetPrimary: "wallet-set-primary"
376
377
  }
377
- }), Te = E({
378
+ }), Te = T({
378
379
  tagName: "wg-wallets-sync",
379
- elementClass: a,
380
+ elementClass: o,
380
381
  react: b,
381
382
  events: { onWalletsSync: "wallets-sync" }
382
- }), Q = ne(null), Ee = ({ children: e, autoHideDuration: t = 5e3 }) => {
383
- let [n, r] = T([]), i = w(0), a = x((e) => {
383
+ }), Q = te(null), Ee = ({ children: e, autoHideDuration: t = 5e3 }) => {
384
+ let [n, r] = w([]), i = C(0), a = x((e) => {
384
385
  r((t) => [...t, {
385
386
  ...e,
386
387
  id: i.current++
387
388
  }]);
388
- }, []), o = C(() => ({ showToast: a }), [a]);
389
- return /* @__PURE__ */ z(Q.Provider, {
389
+ }, []), o = S(() => ({ showToast: a }), [a]);
390
+ return /* @__PURE__ */ R(Q.Provider, {
390
391
  value: o,
391
- children: [e, n.length > 0 && /* @__PURE__ */ R(P, {
392
+ children: [e, n.length > 0 && /* @__PURE__ */ L(N, {
392
393
  spacing: 1,
393
394
  sx: {
394
395
  position: "fixed",
@@ -408,7 +409,7 @@ var U = E({
408
409
  maxWidth: "calc(100vw - 32px)",
409
410
  pointerEvents: "none"
410
411
  },
411
- children: n.map(({ id: e, ...n }) => /* @__PURE__ */ R(X, {
412
+ children: n.map(({ id: e, ...n }) => /* @__PURE__ */ L(X, {
412
413
  ...n,
413
414
  autoHideDuration: t,
414
415
  onExited: () => r((t) => t.filter((t) => t.id !== e))
@@ -416,13 +417,13 @@ var U = E({
416
417
  })]
417
418
  });
418
419
  }, $ = () => {
419
- let e = re(Q);
420
+ let e = ne(Q);
420
421
  if (!e) throw Error("useToast must be used within a ToastProvider");
421
422
  return e;
422
423
  }, De = () => {
423
424
  let { showToast: e } = $();
424
425
  return x((t, n) => e({
425
- ..._(t, n),
426
+ ...g(t, n),
426
427
  type: "error"
427
428
  }), [e]);
428
429
  };