@edel-finance/swap-widget 0.0.1 → 0.1.5-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/theme.js CHANGED
@@ -69,6 +69,16 @@ export function getIsolatedWidgetCss(theme) {
69
69
  justify-content: space-between;
70
70
  margin-bottom: 16px;
71
71
  }
72
+ .edel-sw-brand {
73
+ display: inline-flex;
74
+ align-items: center;
75
+ gap: 8px;
76
+ }
77
+ .edel-sw-brand-mark {
78
+ color: ${theme === "dark" ? "#52E0A8" : t.accent};
79
+ flex-shrink: 0;
80
+ display: block;
81
+ }
72
82
  .edel-sw-title {
73
83
  font-size: 16px;
74
84
  font-weight: 700;
@@ -113,15 +123,105 @@ export function getIsolatedWidgetCss(theme) {
113
123
  color: ${t.text};
114
124
  min-width: 0;
115
125
  }
116
- .edel-sw-select {
126
+ .edel-sw-token-picker {
127
+ position: relative;
128
+ flex-shrink: 0;
129
+ }
130
+ .edel-sw-token-trigger {
131
+ display: inline-flex;
132
+ align-items: center;
133
+ gap: 8px;
117
134
  background: ${t.cardBg};
118
135
  color: ${t.text};
119
136
  border: 1px solid ${t.borderStrong};
120
- border-radius: 10px;
121
- padding: 7px 10px;
137
+ border-radius: 999px;
138
+ padding: 6px 11px 6px 7px;
122
139
  font-size: 14px;
123
140
  font-weight: 600;
124
141
  cursor: pointer;
142
+ outline: none;
143
+ transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
144
+ white-space: nowrap;
145
+ }
146
+ .edel-sw-token-trigger:hover {
147
+ background: ${t.surfaceHover};
148
+ border-color: #52E0A8;
149
+ }
150
+ .edel-sw-token-trigger:focus-visible,
151
+ .edel-sw-token-trigger[aria-expanded="true"] {
152
+ outline: none;
153
+ border-color: #52E0A8;
154
+ box-shadow: 0 0 0 2px rgba(82, 224, 168, 0.28);
155
+ }
156
+ .edel-sw-token-icon {
157
+ display: block;
158
+ flex-shrink: 0;
159
+ border-radius: 999px;
160
+ }
161
+ .edel-sw-token-symbol {
162
+ letter-spacing: -0.01em;
163
+ }
164
+ .edel-sw-token-chevron {
165
+ color: ${t.textMuted};
166
+ flex-shrink: 0;
167
+ transition: transform 0.15s ease;
168
+ }
169
+ .edel-sw-token-trigger[aria-expanded="true"] .edel-sw-token-chevron {
170
+ transform: rotate(180deg);
171
+ color: #52E0A8;
172
+ }
173
+ .edel-sw-token-menu {
174
+ position: absolute;
175
+ top: calc(100% + 6px);
176
+ right: 0;
177
+ min-width: 158px;
178
+ max-height: 236px;
179
+ overflow-y: auto;
180
+ padding: 5px;
181
+ border-radius: 14px;
182
+ background: ${t.cardBg};
183
+ border: 1px solid ${t.borderStrong};
184
+ box-shadow: 0 14px 32px rgba(0, 0, 0, 0.36);
185
+ z-index: 20;
186
+ display: flex;
187
+ flex-direction: column;
188
+ gap: 2px;
189
+ }
190
+ .edel-sw-token-option {
191
+ display: flex;
192
+ align-items: center;
193
+ justify-content: space-between;
194
+ gap: 8px;
195
+ width: 100%;
196
+ padding: 7px 9px;
197
+ border: none;
198
+ border-radius: 9px;
199
+ background: transparent;
200
+ color: ${t.text};
201
+ font-size: 13px;
202
+ font-weight: 600;
203
+ cursor: pointer;
204
+ text-align: left;
205
+ outline: none;
206
+ transition: background-color 0.12s ease;
207
+ }
208
+ .edel-sw-token-option:hover,
209
+ .edel-sw-token-option:focus-visible {
210
+ background: ${t.surfaceHover};
211
+ outline: none;
212
+ }
213
+ .edel-sw-token-option[aria-selected="true"] {
214
+ background: ${t.surfaceBg};
215
+ color: ${theme === "dark" ? "#52E0A8" : t.accent};
216
+ }
217
+ .edel-sw-token-option-main {
218
+ display: inline-flex;
219
+ align-items: center;
220
+ gap: 8px;
221
+ }
222
+ .edel-sw-token-check {
223
+ font-size: 12px;
224
+ color: ${theme === "dark" ? "#52E0A8" : t.accent};
125
225
  }
126
226
  .edel-sw-flip-wrap {
127
227
  display: flex;
@@ -140,9 +240,16 @@ export function getIsolatedWidgetCss(theme) {
140
240
  font-size: 16px;
141
241
  font-weight: 700;
142
242
  cursor: pointer;
243
+ outline: none;
143
244
  display: inline-flex;
144
245
  align-items: center;
145
246
  justify-content: center;
247
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
248
+ }
249
+ .edel-sw-flip:focus-visible {
250
+ outline: none;
251
+ border-color: #52E0A8;
252
+ box-shadow: 0 0 0 2px rgba(82, 224, 168, 0.28);
146
253
  }
147
254
  .edel-sw-fees {
148
255
  margin-top: 14px;
@@ -188,6 +295,12 @@ export function getIsolatedWidgetCss(theme) {
188
295
  font-size: 15px;
189
296
  font-weight: 700;
190
297
  cursor: pointer;
298
+ outline: none;
299
+ transition: background-color 0.15s ease, box-shadow 0.15s ease;
300
+ }
301
+ .edel-sw-cta:focus-visible {
302
+ outline: none;
303
+ box-shadow: 0 0 0 2px rgba(82, 224, 168, 0.35);
191
304
  }
192
305
  .edel-sw-cta:disabled {
193
306
  opacity: 0.5;
@@ -263,7 +376,14 @@ export function getIsolatedWidgetCss(theme) {
263
376
  font-size: 12px;
264
377
  font-weight: 600;
265
378
  cursor: pointer;
379
+ outline: none;
266
380
  text-align: center;
381
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
382
+ }
383
+ .edel-sw-pill:focus-visible {
384
+ outline: none;
385
+ border-color: #52E0A8;
386
+ box-shadow: 0 0 0 2px rgba(82, 224, 168, 0.28);
267
387
  }
268
388
  .edel-sw-pill[data-active="true"] {
269
389
  border-color: ${t.accent};
@@ -278,6 +398,11 @@ export function getIsolatedWidgetCss(theme) {
278
398
  border: 1px solid ${t.border};
279
399
  border-radius: 8px;
280
400
  padding: 0 8px;
401
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
402
+ }
403
+ .edel-sw-custom-wrap:focus-within {
404
+ border-color: #52E0A8;
405
+ box-shadow: 0 0 0 2px rgba(82, 224, 168, 0.28);
281
406
  }
282
407
  .edel-sw-custom-wrap[data-active="true"] {
283
408
  border-color: ${t.accent};
package/dist/widget.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare const SWAP_STATUS_STEPS: ReadonlyArray<{
5
5
  status: SwapOrderStatus;
6
6
  label: string;
7
7
  }>;
8
- export declare const DEFAULT_SWAP_ASSETS: readonly ["CC", "USDCx", "ETH", "BTC"];
8
+ export declare const DEFAULT_SWAP_ASSETS: readonly ["CC", "USDCx", "EDELx", "NVDAe", "SPYe", "QQQe", "SPCXe", "ANTe", "TTWOe"];
9
9
  /** Alpine Forest II slippage presets: 1.0% (default), 2.0%, 3.0%. */
10
10
  export declare const SLIPPAGE_PRESETS_BPS: readonly [100, 200, 300];
11
11
  export declare const DEFAULT_WIDGET_SLIPPAGE_BPS = 100;
@@ -50,6 +50,10 @@ export interface EdelSwapWidgetProps {
50
50
  initialQuote?: SwapQuote | null;
51
51
  /** Optional initial active order (useful for SSR preview or testing). */
52
52
  initialOrder?: SwapOrder | null;
53
+ /** Callback fired whenever a live quote is fetched. */
54
+ onQuote?: (quote: SwapQuote) => void;
55
+ /** Callback fired when the user updates max slippage (in basis points). */
56
+ onSlippageChange?: (maxSlippageBps: number) => void;
53
57
  /** Callback fired when an active swap reaches the "settled" state. */
54
58
  onSwapComplete?: (order: SwapOrder) => void;
55
59
  /** Callback fired when an order is submitted via POST /v2/swaps/orders/:swapId/submit. */
package/dist/widget.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { DEFAULT_MAX_SLIPPAGE_BPS, DEFAULT_QUOTE_TTL_SECONDS, EdelClient, MAX_SLIPPAGE_BPS, MIN_SLIPPAGE_BPS, } from "@edel-finance/sdk";
3
3
  import { useEffect, useMemo, useRef, useState } from "react";
4
+ import { EdelBrandMark, TokenLogo } from "./logos.js";
4
5
  import { getIsolatedWidgetCss } from "./theme.js";
5
6
  export const SWAP_STATUS_STEPS = [
6
7
  { status: "quoted", label: "Quoted" },
@@ -9,7 +10,17 @@ export const SWAP_STATUS_STEPS = [
9
10
  { status: "filled", label: "Filled" },
10
11
  { status: "settled", label: "Settled" },
11
12
  ];
12
- export const DEFAULT_SWAP_ASSETS = ["CC", "USDCx", "ETH", "BTC"];
13
+ export const DEFAULT_SWAP_ASSETS = [
14
+ "CC",
15
+ "USDCx",
16
+ "EDELx",
17
+ "NVDAe",
18
+ "SPYe",
19
+ "QQQe",
20
+ "SPCXe",
21
+ "ANTe",
22
+ "TTWOe",
23
+ ];
13
24
  /** Alpine Forest II slippage presets: 1.0% (default), 2.0%, 3.0%. */
14
25
  export const SLIPPAGE_PRESETS_BPS = [100, 200, 300];
15
26
  export const DEFAULT_WIDGET_SLIPPAGE_BPS = DEFAULT_MAX_SLIPPAGE_BPS;
@@ -63,8 +74,43 @@ export function formatBps(bps) {
63
74
  export function formatPresetPercent(bps) {
64
75
  return `${(bps / 100).toFixed(1)}%`;
65
76
  }
77
+ function TokenSelector({ ariaLabel, value, options, onChange, testId }) {
78
+ const [open, setOpen] = useState(false);
79
+ const containerRef = useRef(null);
80
+ useEffect(() => {
81
+ if (!open)
82
+ return;
83
+ const handlePointerDown = (event) => {
84
+ const container = containerRef.current;
85
+ if (!container)
86
+ return;
87
+ const path = typeof event.composedPath === "function" ? event.composedPath() : [];
88
+ if (path.length > 0 ? !path.includes(container) : !container.contains(event.target)) {
89
+ setOpen(false);
90
+ }
91
+ };
92
+ const handleKeyDown = (event) => {
93
+ if (event.key === "Escape") {
94
+ setOpen(false);
95
+ }
96
+ };
97
+ document.addEventListener("pointerdown", handlePointerDown);
98
+ document.addEventListener("keydown", handleKeyDown);
99
+ return () => {
100
+ document.removeEventListener("pointerdown", handlePointerDown);
101
+ document.removeEventListener("keydown", handleKeyDown);
102
+ };
103
+ }, [open]);
104
+ return (_jsxs("div", { className: "edel-sw-token-picker", ref: containerRef, "data-testid": testId, children: [_jsxs("button", { type: "button", className: "edel-sw-token-trigger", "aria-label": ariaLabel, "aria-haspopup": "listbox", "aria-expanded": open, "data-selected-asset": value, onClick: () => setOpen((prev) => !prev), children: [_jsx(TokenLogo, { symbol: value, size: 22, className: "edel-sw-token-icon" }), _jsx("span", { className: "edel-sw-token-symbol", children: value }), _jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "edel-sw-token-chevron", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "M3 4.5L6 7.5L9 4.5", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), open && (_jsx("div", { className: "edel-sw-token-menu", role: "listbox", "aria-label": ariaLabel, children: options.map((sym) => {
105
+ const selected = sym === value;
106
+ return (_jsxs("button", { type: "button", role: "option", "aria-selected": selected, className: "edel-sw-token-option", "data-token-option": sym, onClick: () => {
107
+ onChange(sym);
108
+ setOpen(false);
109
+ }, children: [_jsxs("span", { className: "edel-sw-token-option-main", children: [_jsx(TokenLogo, { symbol: sym, size: 20, className: "edel-sw-token-icon" }), _jsx("span", { children: sym })] }), selected && (_jsx("span", { className: "edel-sw-token-check", "aria-hidden": "true", children: "\u2713" }))] }, sym));
110
+ }) }))] }));
111
+ }
66
112
  export function EdelSwapWidget(props) {
67
- const { integratorId, partnerId, theme = "dark", network = "mainnet", defaultFrom, defaultTo, defaultFromAsset, defaultToAsset, defaultMaxSlippageBps, recipientAddress = "", integratorFeeBps, client: providedClient, initialQuote = null, initialOrder = null, onSwapComplete, onOrderSubmitted, onError, style, } = props;
113
+ const { integratorId, partnerId, theme = "dark", network = "mainnet", defaultFrom, defaultTo, defaultFromAsset, defaultToAsset, defaultMaxSlippageBps, recipientAddress = "", integratorFeeBps, client: providedClient, initialQuote = null, initialOrder = null, onQuote, onSlippageChange, onSwapComplete, onOrderSubmitted, onError, style, } = props;
68
114
  const effectiveIntegratorId = integratorId ?? partnerId;
69
115
  const client = useMemo(() => providedClient ?? new EdelClient({ network }), [providedClient, network]);
70
116
  const initialSlippage = resolveInitialSlippageBps(defaultMaxSlippageBps);
@@ -141,6 +187,7 @@ export function EdelSwapWidget(props) {
141
187
  const fallbackTtl = q.ttlSeconds || DEFAULT_WIDGET_QUOTE_TTL_SECONDS;
142
188
  const secs = Math.max(0, Math.ceil((q.expiresAtEpochMs - Date.now()) / 1000));
143
189
  setRemainingSec(secs || fallbackTtl);
190
+ onQuote?.(q);
144
191
  })
145
192
  .catch((err) => {
146
193
  if (cancelled)
@@ -165,6 +212,7 @@ export function EdelSwapWidget(props) {
165
212
  effectiveIntegratorId,
166
213
  integratorFeeBps,
167
214
  recipient,
215
+ onQuote,
168
216
  onError,
169
217
  ]);
170
218
  // Countdown quote TTL (20s default window)
@@ -222,6 +270,7 @@ export function EdelSwapWidget(props) {
222
270
  setCustomMode(false);
223
271
  setCustomSlippageInput("");
224
272
  setMaxSlippageBps(bps);
273
+ onSlippageChange?.(bps);
225
274
  };
226
275
  const handleCustomSlippageChange = (raw) => {
227
276
  setCustomMode(true);
@@ -229,6 +278,7 @@ export function EdelSwapWidget(props) {
229
278
  const parsed = parseCustomSlippagePercent(raw);
230
279
  if (parsed !== null) {
231
280
  setMaxSlippageBps(parsed);
281
+ onSlippageChange?.(parsed);
232
282
  }
233
283
  };
234
284
  const handleSwap = async () => {
@@ -289,7 +339,7 @@ export function EdelSwapWidget(props) {
289
339
  ? Math.max(0, Math.min(100, (remainingSec / effectiveTtlSeconds) * 100))
290
340
  : 0;
291
341
  const canSubmitOrder = order !== null && (order.status === "quoted" || order.status === "awaiting_lock");
292
- return (_jsxs("div", { className: "edel-sw-root", "data-edel-theme": theme, "data-edel-network": network, "data-max-slippage-bps": maxSlippageBps, style: style, children: [_jsx("style", { children: getIsolatedWidgetCss(theme) }), _jsxs("div", { className: "edel-sw-header", children: [_jsx("span", { className: "edel-sw-title", children: "Edel Swap" }), _jsx("span", { className: "edel-sw-badge", children: network === "mainnet" ? "MainNet" : "TestNet" })] }), _jsxs("div", { className: "edel-sw-box", children: [_jsx("div", { className: "edel-sw-label", children: "You pay" }), _jsxs("div", { className: "edel-sw-row", children: [_jsx("input", { "aria-label": "From amount", className: "edel-sw-input", inputMode: "decimal", value: fromAmount, onChange: (e) => setFromAmount(e.target.value), placeholder: "0.00" }), _jsx("select", { "aria-label": "From asset", className: "edel-sw-select", value: fromAsset, onChange: (e) => setFromAsset(e.target.value), children: assetSymbols.map((sym) => (_jsx("option", { value: sym, children: sym }, sym))) })] })] }), _jsx("div", { className: "edel-sw-flip-wrap", children: _jsx("button", { type: "button", className: "edel-sw-flip", "aria-label": "Flip swap pair", onClick: handleFlip, children: "\u2195" }) }), _jsxs("div", { className: "edel-sw-box", children: [_jsx("div", { className: "edel-sw-label", children: "You receive" }), _jsxs("div", { className: "edel-sw-row", children: [_jsx("input", { "aria-label": "To amount", className: "edel-sw-input", readOnly: true, value: loadingQuote ? "..." : (quote?.toAmount ?? "0.00") }), _jsx("select", { "aria-label": "To asset", className: "edel-sw-select", value: toAsset, onChange: (e) => setToAsset(e.target.value), children: assetSymbols.map((sym) => (_jsx("option", { value: sym, children: sym }, sym))) })] })] }), _jsxs("div", { className: "edel-sw-slippage", "data-testid": "slippage-selector", children: [_jsxs("div", { className: "edel-sw-slippage-header", children: [_jsx("span", { children: "Max slippage" }), _jsx("strong", { children: formatBps(maxSlippageBps) })] }), _jsxs("fieldset", { className: "edel-sw-slippage-pills", "aria-label": "Max slippage presets", children: [SLIPPAGE_PRESETS_BPS.map((bps) => {
342
+ return (_jsxs("div", { className: "edel-sw-root", "data-edel-theme": theme, "data-edel-network": network, "data-max-slippage-bps": maxSlippageBps, style: style, children: [_jsx("style", { children: getIsolatedWidgetCss(theme) }), _jsxs("div", { className: "edel-sw-header", children: [_jsxs("span", { className: "edel-sw-brand", children: [_jsx(EdelBrandMark, { size: 22, className: "edel-sw-brand-mark" }), _jsx("span", { className: "edel-sw-title", children: "Edel Swap" })] }), _jsx("span", { className: "edel-sw-badge", children: network === "mainnet" ? "MainNet" : "TestNet" })] }), _jsxs("div", { className: "edel-sw-box", children: [_jsx("div", { className: "edel-sw-label", children: "You pay" }), _jsxs("div", { className: "edel-sw-row", children: [_jsx("input", { "aria-label": "From amount", className: "edel-sw-input", inputMode: "decimal", value: fromAmount, onChange: (e) => setFromAmount(e.target.value), placeholder: "0.00" }), _jsx(TokenSelector, { ariaLabel: "From asset", testId: "from-asset-selector", value: fromAsset, options: assetSymbols, onChange: setFromAsset })] })] }), _jsx("div", { className: "edel-sw-flip-wrap", children: _jsx("button", { type: "button", className: "edel-sw-flip", "aria-label": "Flip swap pair", onClick: handleFlip, children: "\u2195" }) }), _jsxs("div", { className: "edel-sw-box", children: [_jsx("div", { className: "edel-sw-label", children: "You receive" }), _jsxs("div", { className: "edel-sw-row", children: [_jsx("input", { "aria-label": "To amount", className: "edel-sw-input", readOnly: true, value: loadingQuote ? "..." : (quote?.toAmount ?? "0.00") }), _jsx(TokenSelector, { ariaLabel: "To asset", testId: "to-asset-selector", value: toAsset, options: assetSymbols, onChange: setToAsset })] })] }), _jsxs("div", { className: "edel-sw-slippage", "data-testid": "slippage-selector", children: [_jsxs("div", { className: "edel-sw-slippage-header", children: [_jsx("span", { children: "Max slippage" }), _jsx("strong", { children: formatBps(maxSlippageBps) })] }), _jsxs("fieldset", { className: "edel-sw-slippage-pills", "aria-label": "Max slippage presets", children: [SLIPPAGE_PRESETS_BPS.map((bps) => {
293
343
  const isActive = !customMode && maxSlippageBps === bps;
294
344
  return (_jsx("button", { type: "button", className: "edel-sw-pill", "data-slippage-bps": bps, "data-active": isActive ? "true" : "false", "aria-pressed": isActive, onClick: () => handleSelectPreset(bps), children: formatPresetPercent(bps) }, bps));
295
345
  }), _jsxs("div", { className: "edel-sw-custom-wrap", "data-active": customMode ? "true" : "false", children: [_jsx("input", { "aria-label": "Custom slippage percent", className: "edel-sw-custom-input", inputMode: "decimal", placeholder: "Custom", value: customSlippageInput, onFocus: () => setCustomMode(true), onChange: (e) => handleCustomSlippageChange(e.target.value) }), _jsx("span", { className: "edel-sw-custom-suffix", children: "%" })] })] })] }), quote && (_jsxs("div", { className: "edel-sw-fees", "data-testid": "quote-fee-breakdown", "data-min-amount-out-atoms": quote.minAmountOutAtoms, children: [_jsxs("div", { className: "edel-sw-fee-line", children: [_jsx("span", { children: "Rate" }), _jsxs("strong", { children: ["1 ", quote.fromAsset, " = ", quote.rate, " ", quote.toAsset] })] }), _jsxs("div", { className: "edel-sw-fee-line", children: [_jsxs("span", { children: ["Edel RFQ fee (", formatBps(quote.fees.edelRfqFeeBps), ")"] }), _jsxs("strong", { children: [quote.fees.edelRfqFeeAmount, " ", quote.toAsset] })] }), _jsxs("div", { className: "edel-sw-fee-line", children: [_jsx("span", { children: "Network fee" }), _jsxs("strong", { children: [quote.fees.networkFeeAmount, " ", quote.fees.networkFeeAsset] })] }), _jsxs("div", { className: "edel-sw-fee-line", children: [_jsxs("span", { children: ["Integrator markup (", formatBps(quote.fees.integratorFeeBps), ")"] }), _jsxs("strong", { children: [quote.fees.integratorFeeAmount, " ", quote.toAsset] })] }), _jsxs("div", { className: "edel-sw-fee-line", children: [_jsx("span", { children: "Price impact" }), _jsx("strong", { children: formatBps(quote.priceImpactBps) })] }), _jsxs("div", { className: "edel-sw-fee-line", children: [_jsx("span", { children: "Min received" }), _jsxs("strong", { children: [quote.minReceived, " ", quote.toAsset] })] }), quote.minAmountOutAtoms !== undefined && (_jsxs("div", { className: "edel-sw-fee-line", children: [_jsx("span", { children: "Min output (atoms)" }), _jsx("strong", { children: quote.minAmountOutAtoms })] })), quote.estimatedSeconds !== undefined && (_jsxs("div", { className: "edel-sw-fee-line", children: [_jsx("span", { children: "Estimated settlement" }), _jsxs("strong", { children: ["~", quote.estimatedSeconds, "s"] })] })), _jsxs("div", { className: "edel-sw-fee-line", children: [_jsx("span", { children: "Quote expires in" }), _jsxs("strong", { children: [remainingSec, "s"] })] }), _jsx("div", { className: "edel-sw-ttl-bar", children: _jsx("div", { className: "edel-sw-ttl-fill", style: { width: `${ttlPercent}%` } }) })] })), order && (_jsxs("div", { className: "edel-sw-tracker", "data-testid": "swap-status-tracker", children: [_jsxs("div", { className: "edel-sw-fee-line", children: [_jsxs("span", { children: ["Order ", order.swapId ?? order.orderId] }), _jsx("strong", { children: order.status })] }), _jsx("div", { className: "edel-sw-steps", children: SWAP_STATUS_STEPS.map((step) => (_jsx("div", { className: "edel-sw-step", "data-status": step.status, "data-state": getStepState(step.status, order.status), children: step.label }, step.status))) }), canSubmitOrder && (_jsx("button", { type: "button", className: "edel-sw-submit-btn", "data-testid": "submit-swap-order-btn", disabled: submittingSigned, onClick: handleSubmitOrder, children: submittingSigned ? "Submitting swap..." : "Submit Swap Order" }))] })), errorMessage && (_jsx("div", { className: "edel-sw-error", role: "alert", children: errorMessage })), _jsx("button", { type: "button", className: "edel-sw-cta", disabled: !quote || submitting || remainingSec === 0, onClick: handleSwap, children: submitting
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@edel-finance/swap-widget",
3
- "version": "0.0.1",
4
- "description": "Embeddable React component, Web Component, and iframe Swap Widget for Edel Markets.",
3
+ "version": "0.1.5-alpha",
4
+ "description": "Embeddable React, Vue 3, Svelte 5, Angular, SolidJS, Shadow DOM Web Component, and iframe Swap Widget for Edel Markets.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -9,6 +9,22 @@
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.js"
12
+ },
13
+ "./vue": {
14
+ "types": "./dist/adapters/vue.d.ts",
15
+ "import": "./dist/adapters/vue.js"
16
+ },
17
+ "./svelte": {
18
+ "types": "./dist/adapters/svelte.d.ts",
19
+ "import": "./dist/adapters/svelte.js"
20
+ },
21
+ "./angular": {
22
+ "types": "./dist/adapters/angular.d.ts",
23
+ "import": "./dist/adapters/angular.js"
24
+ },
25
+ "./solid": {
26
+ "types": "./dist/adapters/solid.d.ts",
27
+ "import": "./dist/adapters/solid.js"
12
28
  }
13
29
  },
14
30
  "files": [
@@ -16,21 +32,28 @@
16
32
  "README.md"
17
33
  ],
18
34
  "dependencies": {
19
- "@edel-finance/sdk": "0.0.1"
35
+ "@edel-finance/sdk": "0.1.5-alpha"
20
36
  },
21
37
  "peerDependencies": {
22
- "react": ">=18.2.0"
38
+ "react": ">=18.2.0",
39
+ "react-dom": ">=18.2.0"
23
40
  },
24
41
  "devDependencies": {
42
+ "@storybook/react-vite": "^11.0.2",
25
43
  "@types/react": "^19.0.0",
26
44
  "@types/react-dom": "^19.0.0",
27
45
  "@typescript/native-preview": "^7.0.0-dev",
46
+ "@vitejs/plugin-react": "^6.3.1",
28
47
  "react": "^19.0.0",
29
- "react-dom": "^19.0.0"
48
+ "react-dom": "^19.0.0",
49
+ "storybook": "^11.0.2",
50
+ "vite": "^8.4.1"
30
51
  },
31
52
  "license": "MIT",
32
53
  "scripts": {
33
54
  "build": "tsgo -p tsconfig.json",
55
+ "build-storybook": "storybook build -o storybook-static",
56
+ "storybook": "storybook dev -p 6006",
34
57
  "test": "bun test",
35
58
  "typecheck": "tsgo --noEmit -p tsconfig.json"
36
59
  }