@gearbox-protocol/ui-kit 4.0.0-next.8 → 4.0.0-next.9

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("../../../../client-adapters/styled-dialog-container/styled-dialog-container.cjs"),w=require("../../../../confirm-menu/confirm-menu.cjs"),S=require("../../../../error-message/error-line-message.cjs");require("react-intl");require("../../../../buttons/button/button.cjs");require("../../../../dialog/dialog-container.cjs");const h=require("../../../../typed-intl/index.cjs");require("react");require("@gearbox-protocol/sdk");const q=require("../../../../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../../../../utils/z-index.cjs");const C=require("../../../../modal/modal.cjs"),T=require("../../../../skeleton/skeleton-stack.cjs"),k=require("../../../../spinner/spinner.cjs"),P=require("../../../../typography/typography.cjs"),f=require("../../../../vspace/vspace.cjs"),y=require("../stepper/ProgressStepper.cjs"),M=require("../stepper/transactionExecutionStepTypes.cjs"),D=require("./computeTransactionConfirmDialogLayout.cjs"),t=require("./constants.cjs");function N(n){const{mode:r,open:u=!0,phase:d="confirm",onClose:l,title:i,titleAddon:m,hideTitleAddonOnResult:s=!0,body:o,className:a,previewClassName:c,"data-testid":_,shellTestId:g}=n;if(r==="dialog"&&!u)return null;const p=o.kind==="ready"?d:"confirm",v=p!=="confirm"&&p!=="awaiting_receipt"&&s?void 0:m,x=e.jsx(j.StyledDialogContainer,{className:q.cn(t.transactionConfirmDialogShellVariants(),r==="dialog"?t.transactionConfirmModalContainerVariants():null,a),"data-testid":_,children:e.jsx(L,{body:o,phase:p,previewClassName:c,testId:g??t.TransactionConfirmDialogTest.root,header:e.jsx(w.ConfirmMenu,{title:i,titleAddon:v,onClose:l})})});return r==="page"?x:e.jsx(C.Modal,{show:!0,onClickOutside:l,zIndexLayer:"MODAL",children:x})}function L({body:n,phase:r,previewClassName:u,testId:d,header:l}){const i=n.kind==="ready"?n.stepper:void 0,m=!!(i&&M.shouldShowTransactionProgressStepper(i.steps)),s=D.computeTransactionConfirmDialogLayout(r,m),o=n.kind==="ready"?V(n,r):void 0,a=n.kind==="ready"?n.execution:void 0;return e.jsxs("div",{className:t.transactionConfirmShellContentVariants(),"data-testid":d,children:[e.jsx("div",{className:"shrink-0",children:l}),e.jsx(f.VSpace,{size:"sm"}),s.showResult&&o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":t.TransactionConfirmDialogTest.result,children:o}):null,s.showResult?null:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[s.showPreview?e.jsx("div",{className:u??t.transactionConfirmPreviewScrollVariants(),children:e.jsx(I,{body:n})}):null,s.showPreview&&s.showExecution&&a?e.jsx(f.VSpace,{size:"md"}):null,s.showExecution&&a?e.jsx("div",{className:"min-w-0 w-full shrink-0","data-testid":t.TransactionConfirmDialogTest.execution,children:a}):null]}),s.showProgressStepper&&i?e.jsxs(e.Fragment,{children:[e.jsx(f.VSpace,{size:"md"}),e.jsx("div",{className:"shrink-0","data-testid":t.TransactionConfirmDialogTest.progress,children:e.jsx(y.ProgressStepper,{tone:"muted",steps:i.steps.map(c=>({id:c.id,status:c.status,label:i.renderLabel(c)}))})})]}):null]})}function I({body:n}){const r=h.useIntlTyped();return n.kind==="loading"?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-8",children:[e.jsx(k.Spinner,{}),e.jsx(P.Typography,{variant:"bodySmall",color:"muted",as:"p",children:e.jsx(h.FormattedMessageTyped,{messageId:"components.transactionConfirm.previewLoading"})})]}):n.kind==="error"?e.jsx(S.ErrorLineMessage,{err:n.error,title:n.title??r.formatMessage({messageId:"components.transactionConfirm.previewErrorTitle"})}):n.previewLoading?e.jsx(T.SkeletonStack,{lines:3}):e.jsx(e.Fragment,{children:n.preview})}function V(n,r){if(n.result){if(r==="success")return n.result.success;if(r==="failure")return n.result.failure}}exports.TransactionConfirmShell=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("../../../../client-adapters/styled-dialog-container/styled-dialog-container.cjs"),C=require("../../../../confirm-menu/confirm-menu.cjs"),q=require("../../../../error-message/error-line-message.cjs");require("react-intl");require("../../../../buttons/button/button.cjs");require("../../../../dialog/dialog-container.cjs");const x=require("../../../../typed-intl/index.cjs");require("react");require("@gearbox-protocol/sdk");const w=require("../../../../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../../../../utils/z-index.cjs");const S=require("../../../../modal/modal.cjs"),T=require("../../../../skeleton/skeleton-stack.cjs"),k=require("../../../../spinner/spinner.cjs"),y=require("../../../../typography/typography.cjs"),p=require("../../../../vspace/vspace.cjs"),P=require("../stepper/ProgressStepper.cjs"),M=require("./computeTransactionConfirmDialogLayout.cjs"),t=require("./constants.cjs");function D(n){const{mode:r,open:c=!0,phase:u="confirm",onClose:l,title:i,titleAddon:d,hideTitleAddonOnResult:s=!0,body:o,className:a,previewClassName:g,"data-testid":h,shellTestId:_}=n;if(r==="dialog"&&!c)return null;const m=o.kind==="ready"?u:"confirm",v=m!=="confirm"&&m!=="awaiting_receipt"&&s?void 0:d,f=e.jsx(j.StyledDialogContainer,{className:w.cn(t.transactionConfirmDialogShellVariants(),r==="dialog"?t.transactionConfirmModalContainerVariants():null,a),"data-testid":h,children:e.jsx(N,{body:o,phase:m,previewClassName:g,testId:_??t.TransactionConfirmDialogTest.root,header:e.jsx(C.ConfirmMenu,{title:i,titleAddon:v,onClose:l})})});return r==="page"?f:e.jsx(S.Modal,{show:!0,onClickOutside:l,zIndexLayer:"MODAL",children:f})}function N({body:n,phase:r,previewClassName:c,testId:u,header:l}){const i=n.kind==="ready"?n.stepper:void 0,d=!!(i&&i.length>0),s=M.computeTransactionConfirmDialogLayout(r,d),o=n.kind==="ready"?L(n,r):void 0,a=n.kind==="ready"?n.execution:void 0;return e.jsxs("div",{className:t.transactionConfirmShellContentVariants(),"data-testid":u,children:[e.jsx("div",{className:"shrink-0",children:l}),e.jsx(p.VSpace,{size:"sm"}),s.showResult&&o?e.jsx("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":t.TransactionConfirmDialogTest.result,children:o}):null,s.showResult?null:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[s.showPreview?e.jsx("div",{className:c??t.transactionConfirmPreviewScrollVariants(),children:e.jsx(I,{body:n})}):null,s.showPreview&&s.showExecution&&a?e.jsx(p.VSpace,{size:"md"}):null,s.showExecution&&a?e.jsx("div",{className:"min-w-0 w-full shrink-0","data-testid":t.TransactionConfirmDialogTest.execution,children:a}):null]}),s.showProgressStepper&&i?e.jsxs(e.Fragment,{children:[e.jsx(p.VSpace,{size:"md"}),e.jsx("div",{className:"shrink-0","data-testid":t.TransactionConfirmDialogTest.progress,children:e.jsx(P.ProgressStepper,{tone:"muted",steps:i})})]}):null]})}function I({body:n}){const r=x.useIntlTyped();return n.kind==="loading"?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-8",children:[e.jsx(k.Spinner,{}),e.jsx(y.Typography,{variant:"bodySmall",color:"muted",as:"p",children:e.jsx(x.FormattedMessageTyped,{messageId:"components.transactionConfirm.previewLoading"})})]}):n.kind==="error"?e.jsx(q.ErrorLineMessage,{err:n.error,title:n.title??r.formatMessage({messageId:"components.transactionConfirm.previewErrorTitle"})}):n.previewLoading?e.jsx(T.SkeletonStack,{lines:3}):e.jsx(e.Fragment,{children:n.preview})}function L(n,r){if(n.result){if(r==="success")return n.result.success;if(r==="failure")return n.result.failure}}exports.TransactionConfirmShell=D;
@@ -1,4 +1,4 @@
1
- import { jsx as r, jsxs as m, Fragment as g } from "react/jsx-runtime";
1
+ import { jsx as r, jsxs as l, Fragment as v } from "react/jsx-runtime";
2
2
  import { StyledDialogContainer as S } from "../../../../client-adapters/styled-dialog-container/styled-dialog-container.js";
3
3
  import { ConfirmMenu as k } from "../../../../confirm-menu/confirm-menu.js";
4
4
  import { ErrorLineMessage as T } from "../../../../error-message/error-line-message.js";
@@ -13,121 +13,110 @@ import "sonner";
13
13
  import "@gearbox-protocol/sdk/common-utils";
14
14
  import "luxon";
15
15
  import "../../../../../utils/z-index.js";
16
- import { Modal as L } from "../../../../modal/modal.js";
17
- import { SkeletonStack as M } from "../../../../skeleton/skeleton-stack.js";
16
+ import { Modal as M } from "../../../../modal/modal.js";
17
+ import { SkeletonStack as L } from "../../../../skeleton/skeleton-stack.js";
18
18
  import { Spinner as A } from "../../../../spinner/spinner.js";
19
19
  import { Typography as D } from "../../../../typography/typography.js";
20
- import { VSpace as h } from "../../../../vspace/vspace.js";
20
+ import { VSpace as f } from "../../../../vspace/vspace.js";
21
21
  import { ProgressStepper as V } from "../stepper/ProgressStepper.js";
22
- import { shouldShowTransactionProgressStepper as z } from "../stepper/transactionExecutionStepTypes.js";
23
- import { computeTransactionConfirmDialogLayout as E } from "./computeTransactionConfirmDialogLayout.js";
24
- import { TransactionConfirmDialogTest as d, transactionConfirmModalContainerVariants as R, transactionConfirmDialogShellVariants as j, transactionConfirmShellContentVariants as y, transactionConfirmPreviewScrollVariants as O } from "./constants.js";
25
- function ce(e) {
22
+ import { computeTransactionConfirmDialogLayout as z } from "./computeTransactionConfirmDialogLayout.js";
23
+ import { TransactionConfirmDialogTest as m, transactionConfirmModalContainerVariants as E, transactionConfirmDialogShellVariants as R, transactionConfirmShellContentVariants as j, transactionConfirmPreviewScrollVariants as y } from "./constants.js";
24
+ function me(e) {
26
25
  const {
27
26
  mode: t,
28
27
  open: c = !0,
29
- phase: p = "confirm",
30
- onClose: l,
28
+ phase: d = "confirm",
29
+ onClose: a,
31
30
  title: n,
32
- titleAddon: u,
31
+ titleAddon: p,
33
32
  hideTitleAddonOnResult: i = !0,
34
33
  body: o,
35
34
  className: s,
36
- previewClassName: a,
35
+ previewClassName: g,
37
36
  "data-testid": w,
38
37
  shellTestId: x
39
38
  } = e;
40
39
  if (t === "dialog" && !c) return null;
41
- const f = o.kind === "ready" ? p : "confirm", C = f !== "confirm" && f !== "awaiting_receipt" && i ? void 0 : u, v = /* @__PURE__ */ r(
40
+ const u = o.kind === "ready" ? d : "confirm", C = u !== "confirm" && u !== "awaiting_receipt" && i ? void 0 : p, h = /* @__PURE__ */ r(
42
41
  S,
43
42
  {
44
43
  className: I(
45
- j(),
46
- t === "dialog" ? R() : null,
44
+ R(),
45
+ t === "dialog" ? E() : null,
47
46
  s
48
47
  ),
49
48
  "data-testid": w,
50
49
  children: /* @__PURE__ */ r(
51
- F,
50
+ O,
52
51
  {
53
52
  body: o,
54
- phase: f,
55
- previewClassName: a,
56
- testId: x ?? d.root,
53
+ phase: u,
54
+ previewClassName: g,
55
+ testId: x ?? m.root,
57
56
  header: /* @__PURE__ */ r(
58
57
  k,
59
58
  {
60
59
  title: n,
61
60
  titleAddon: C,
62
- onClose: l
61
+ onClose: a
63
62
  }
64
63
  )
65
64
  }
66
65
  )
67
66
  }
68
67
  );
69
- return t === "page" ? v : /* @__PURE__ */ r(L, { show: !0, onClickOutside: l, zIndexLayer: "MODAL", children: v });
68
+ return t === "page" ? h : /* @__PURE__ */ r(M, { show: !0, onClickOutside: a, zIndexLayer: "MODAL", children: h });
70
69
  }
71
- function F({
70
+ function O({
72
71
  body: e,
73
72
  phase: t,
74
73
  previewClassName: c,
75
- testId: p,
76
- header: l
74
+ testId: d,
75
+ header: a
77
76
  }) {
78
- const n = e.kind === "ready" ? e.stepper : void 0, u = !!(n && z(n.steps)), i = E(t, u), o = e.kind === "ready" ? _(e, t) : void 0, s = e.kind === "ready" ? e.execution : void 0;
79
- return /* @__PURE__ */ m(
77
+ const n = e.kind === "ready" ? e.stepper : void 0, p = !!(n && n.length > 0), i = z(t, p), o = e.kind === "ready" ? B(e, t) : void 0, s = e.kind === "ready" ? e.execution : void 0;
78
+ return /* @__PURE__ */ l(
80
79
  "div",
81
80
  {
82
- className: y(),
83
- "data-testid": p,
81
+ className: j(),
82
+ "data-testid": d,
84
83
  children: [
85
- /* @__PURE__ */ r("div", { className: "shrink-0", children: l }),
86
- /* @__PURE__ */ r(h, { size: "sm" }),
84
+ /* @__PURE__ */ r("div", { className: "shrink-0", children: a }),
85
+ /* @__PURE__ */ r(f, { size: "sm" }),
87
86
  i.showResult && o ? /* @__PURE__ */ r(
88
87
  "div",
89
88
  {
90
89
  className: "flex min-h-0 flex-1 flex-col",
91
- "data-testid": d.result,
90
+ "data-testid": m.result,
92
91
  children: o
93
92
  }
94
93
  ) : null,
95
- i.showResult ? null : /* @__PURE__ */ m("div", { className: "flex min-h-0 flex-1 flex-col", children: [
94
+ i.showResult ? null : /* @__PURE__ */ l("div", { className: "flex min-h-0 flex-1 flex-col", children: [
96
95
  i.showPreview ? /* @__PURE__ */ r(
97
96
  "div",
98
97
  {
99
- className: c ?? O(),
100
- children: /* @__PURE__ */ r(B, { body: e })
98
+ className: c ?? y(),
99
+ children: /* @__PURE__ */ r(F, { body: e })
101
100
  }
102
101
  ) : null,
103
- i.showPreview && i.showExecution && s ? /* @__PURE__ */ r(h, { size: "md" }) : null,
102
+ i.showPreview && i.showExecution && s ? /* @__PURE__ */ r(f, { size: "md" }) : null,
104
103
  i.showExecution && s ? /* @__PURE__ */ r(
105
104
  "div",
106
105
  {
107
106
  className: "min-w-0 w-full shrink-0",
108
- "data-testid": d.execution,
107
+ "data-testid": m.execution,
109
108
  children: s
110
109
  }
111
110
  ) : null
112
111
  ] }),
113
- i.showProgressStepper && n ? /* @__PURE__ */ m(g, { children: [
114
- /* @__PURE__ */ r(h, { size: "md" }),
112
+ i.showProgressStepper && n ? /* @__PURE__ */ l(v, { children: [
113
+ /* @__PURE__ */ r(f, { size: "md" }),
115
114
  /* @__PURE__ */ r(
116
115
  "div",
117
116
  {
118
117
  className: "shrink-0",
119
- "data-testid": d.progress,
120
- children: /* @__PURE__ */ r(
121
- V,
122
- {
123
- tone: "muted",
124
- steps: n.steps.map((a) => ({
125
- id: a.id,
126
- status: a.status,
127
- label: n.renderLabel(a)
128
- }))
129
- }
130
- )
118
+ "data-testid": m.progress,
119
+ children: /* @__PURE__ */ r(V, { tone: "muted", steps: n })
131
120
  }
132
121
  )
133
122
  ] }) : null
@@ -135,11 +124,11 @@ function F({
135
124
  }
136
125
  );
137
126
  }
138
- function B({
127
+ function F({
139
128
  body: e
140
129
  }) {
141
130
  const t = N();
142
- return e.kind === "loading" ? /* @__PURE__ */ m("div", { className: "flex flex-col items-center justify-center gap-3 py-8", children: [
131
+ return e.kind === "loading" ? /* @__PURE__ */ l("div", { className: "flex flex-col items-center justify-center gap-3 py-8", children: [
143
132
  /* @__PURE__ */ r(A, {}),
144
133
  /* @__PURE__ */ r(D, { variant: "bodySmall", color: "muted", as: "p", children: /* @__PURE__ */ r(P, { messageId: "components.transactionConfirm.previewLoading" }) })
145
134
  ] }) : e.kind === "error" ? /* @__PURE__ */ r(
@@ -150,14 +139,14 @@ function B({
150
139
  messageId: "components.transactionConfirm.previewErrorTitle"
151
140
  })
152
141
  }
153
- ) : e.previewLoading ? /* @__PURE__ */ r(M, { lines: 3 }) : /* @__PURE__ */ r(g, { children: e.preview });
142
+ ) : e.previewLoading ? /* @__PURE__ */ r(L, { lines: 3 }) : /* @__PURE__ */ r(v, { children: e.preview });
154
143
  }
155
- function _(e, t) {
144
+ function B(e, t) {
156
145
  if (e.result) {
157
146
  if (t === "success") return e.result.success;
158
147
  if (t === "failure") return e.result.failure;
159
148
  }
160
149
  }
161
150
  export {
162
- ce as TransactionConfirmShell
151
+ me as TransactionConfirmShell
163
152
  };
@@ -1,15 +1,18 @@
1
1
  import { default as React } from 'react';
2
- import { TransactionExecutionStepView } from '../stepper/transactionExecutionStepTypes';
2
+ import { ProgressStepperStep } from '../stepper/ProgressStepper';
3
3
  import { TransactionConfirmPhase } from './transactionConfirmPhase';
4
4
  /**
5
5
  * How the card is framed. The body is identical in both: `page` drops the card
6
6
  * into page flow, `dialog` puts the same card inside a modal.
7
7
  */
8
8
  export type TransactionConfirmShellMode = "page" | "dialog";
9
- export interface TransactionConfirmShellStepper {
10
- readonly steps: ReadonlyArray<TransactionExecutionStepView>;
11
- readonly renderLabel: (step: TransactionExecutionStepView) => React.ReactNode;
12
- }
9
+ /**
10
+ * Pre-labelled, ready-to-render steps. The slot no longer restricts step ids
11
+ * to the execution union: session-plan steppers (agreement/approve/confirm
12
+ * plus a delayed request/complete tail) carry their own ids and labels, and
13
+ * visibility is the caller's decision — omit the slot to hide the stepper.
14
+ */
15
+ export type TransactionConfirmShellStepper = ReadonlyArray<ProgressStepperStep>;
13
16
  /**
14
17
  * Shown instead of preview and execution once the phase is terminal.
15
18
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/ui-kit",
3
- "version": "4.0.0-next.8",
3
+ "version": "4.0.0-next.9",
4
4
  "description": "Internal UI components",
5
5
  "repository": {
6
6
  "type": "git",