@loafmarkets/ui 0.1.4 → 0.1.6

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/index.js CHANGED
@@ -168,7 +168,7 @@ var PortfolioSummary = o__namespace.forwardRef(
168
168
  onResetAccount,
169
169
  positionsHeading = "Current Positions",
170
170
  emptyPositionsText = "No positions yet. Start trading to build your portfolio!",
171
- formatCurrency: formatCurrency2 = defaultFormatCurrency,
171
+ formatCurrency: formatCurrency3 = defaultFormatCurrency,
172
172
  formatPercent: formatPercent2 = defaultFormatPercent,
173
173
  formatSignedCurrency = defaultFormatSignedCurrency,
174
174
  className,
@@ -206,11 +206,11 @@ var PortfolioSummary = o__namespace.forwardRef(
206
206
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
207
207
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
208
208
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs uppercase tracking-[0.5px] text-white/50", children: "Available Cash" }),
209
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-[1.25rem] font-semibold text-white", children: formatCurrency2(availableCash) })
209
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-[1.25rem] font-semibold text-white", children: formatCurrency3(availableCash) })
210
210
  ] }),
211
211
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
212
212
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs uppercase tracking-[0.5px] text-white/50", children: "Portfolio Value" }),
213
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-[1.25rem] font-semibold text-white", children: formatCurrency2(portfolioValue) })
213
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-[1.25rem] font-semibold text-white", children: formatCurrency3(portfolioValue) })
214
214
  ] }),
215
215
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
216
216
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs uppercase tracking-[0.5px] text-white/50", children: "Total Return" }),
@@ -3358,7 +3358,7 @@ function DesktopOrderbookLayout({
3358
3358
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("text-lg font-semibold tabular-nums", midClass), children: [
3359
3359
  "$",
3360
3360
  formatNumber(midPrice, precision),
3361
- midChangePercent == null ? null : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-2 text-sm font-semibold", children: [
3361
+ midChangePercent == null ? null : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn("ml-2 text-sm font-semibold tabular-nums", midClass), children: [
3362
3362
  midChangePercent >= 0 ? "+" : "",
3363
3363
  midChangePercent.toFixed(2),
3364
3364
  "%"
@@ -3413,18 +3413,18 @@ function MobileOrderbookLayout({
3413
3413
  const visibleBids = o__namespace.useMemo(() => bids.slice(0, COMPACT_ROWS_VISIBLE), [bids]);
3414
3414
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3415
3415
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 pt-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
3416
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
3416
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
3417
3417
  /* @__PURE__ */ jsxRuntime.jsx(
3418
3418
  "span",
3419
3419
  {
3420
3420
  onClick: () => handleTab("orderbook"),
3421
3421
  style: {
3422
3422
  cursor: "pointer",
3423
- fontSize: "0.8rem",
3423
+ fontSize: "0.72rem",
3424
3424
  fontWeight: tab === "orderbook" ? 600 : 400,
3425
3425
  color: tab === "orderbook" ? "#fff" : "rgba(255,255,255,0.6)",
3426
3426
  borderBottom: tab === "orderbook" ? "2px solid #C9A227" : "none",
3427
- paddingBottom: "0.25rem"
3427
+ paddingBottom: "0.2rem"
3428
3428
  },
3429
3429
  children: "Orderbook"
3430
3430
  }
@@ -3435,11 +3435,11 @@ function MobileOrderbookLayout({
3435
3435
  onClick: () => handleTab("trades"),
3436
3436
  style: {
3437
3437
  cursor: "pointer",
3438
- fontSize: "0.8rem",
3438
+ fontSize: "0.72rem",
3439
3439
  fontWeight: tab === "trades" ? 600 : 400,
3440
3440
  color: tab === "trades" ? "#fff" : "rgba(255,255,255,0.6)",
3441
3441
  borderBottom: tab === "trades" ? "2px solid #C9A227" : "none",
3442
- paddingBottom: "0.25rem"
3442
+ paddingBottom: "0.2rem"
3443
3443
  },
3444
3444
  children: "Trades"
3445
3445
  }
@@ -3499,20 +3499,26 @@ function MobileOrderbookLayout({
3499
3499
  gridTemplateColumns: "1.2fr 0.8fr",
3500
3500
  padding: "0.3rem 0",
3501
3501
  fontSize: "0.8rem",
3502
- backgroundColor: "rgba(0, 123, 255, 0.05)",
3503
3502
  borderTop: "1px solid rgba(255,255,255,0.1)",
3504
3503
  borderBottom: "1px solid rgba(255,255,255,0.1)"
3505
3504
  },
3506
3505
  children: [
3507
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontWeight: "bold", display: "flex", alignItems: "center", gap: "8px" }, className: midClass, children: [
3508
- "$",
3509
- formatNumber(midPrice, precision),
3510
- midChangePercent != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "0.8rem" }, className: midClass, children: [
3511
- midChangePercent >= 0 ? "+" : "",
3512
- midChangePercent.toFixed(2),
3513
- "%"
3514
- ] })
3515
- ] }),
3506
+ /* @__PURE__ */ jsxRuntime.jsxs(
3507
+ "div",
3508
+ {
3509
+ style: { fontWeight: "bold", display: "flex", alignItems: "center", gap: "8px" },
3510
+ className: midClass,
3511
+ children: [
3512
+ "$",
3513
+ formatNumber(midPrice, precision),
3514
+ midChangePercent != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn("text-[0.75rem] font-semibold tabular-nums", midClass), children: [
3515
+ midChangePercent >= 0 ? "+" : "",
3516
+ midChangePercent.toFixed(2),
3517
+ "%"
3518
+ ] })
3519
+ ]
3520
+ }
3521
+ ),
3516
3522
  /* @__PURE__ */ jsxRuntime.jsx("div", {})
3517
3523
  ]
3518
3524
  }
@@ -3910,393 +3916,447 @@ var PropertyNewsUpdates = o__namespace.forwardRef(
3910
3916
  }
3911
3917
  );
3912
3918
  PropertyNewsUpdates.displayName = "PropertyNewsUpdates";
3913
- var PropertyCompareBar = o__namespace.forwardRef(
3919
+ var defaultFormat = (value) => new Intl.NumberFormat("en-US", {
3920
+ style: "currency",
3921
+ currency: "USD",
3922
+ notation: value >= 1e5 ? "compact" : "standard",
3923
+ maximumFractionDigits: value >= 1e3 ? 0 : 2
3924
+ }).format(value);
3925
+ var TradingSlider = o__namespace.forwardRef(
3914
3926
  ({
3927
+ label = "Trade size",
3928
+ helperText = "Drag to pick the desired notional.",
3929
+ min = 0,
3930
+ max = 1e5,
3931
+ step = 1e3,
3932
+ minLabel,
3933
+ maxLabel,
3934
+ formatValue = defaultFormat,
3935
+ accentColor = "#14b8a6",
3936
+ value,
3937
+ defaultValue,
3938
+ onValueChange,
3915
3939
  className,
3916
- addresses,
3917
- selectedAddressId,
3918
- onSelectAddress,
3919
- propertyValue,
3920
- propertyValueVariant = "classic",
3921
- price,
3922
- ...props
3940
+ ...rest
3923
3941
  }, ref) => {
3924
- const normalizedAddresses = o__namespace.useMemo(() => {
3925
- return addresses.map(
3926
- (option) => typeof option === "string" ? { id: option, label: option } : option
3927
- );
3928
- }, [addresses]);
3929
- const hasAddresses = normalizedAddresses.length > 0;
3930
- const firstAddressId = normalizedAddresses[0]?.id;
3931
- const isControlled = selectedAddressId !== void 0;
3932
- const [internalSelectedId, setInternalSelectedId] = o__namespace.useState(
3933
- () => isControlled ? void 0 : firstAddressId
3942
+ const isControlled = value !== void 0;
3943
+ const [internalValue, setInternalValue] = o__namespace.useState(
3944
+ defaultValue ?? (typeof min === "number" ? min : 0)
3934
3945
  );
3935
- const resolvedSelectedId = isControlled ? selectedAddressId : internalSelectedId;
3936
- o__namespace.useEffect(() => {
3946
+ const currentValue = isControlled ? Number(value) : internalValue;
3947
+ const parsedMin = Number(min ?? 0);
3948
+ const parsedMax = Number(max ?? 100);
3949
+ const percent = (currentValue - parsedMin) / (parsedMax - parsedMin || 1) * 100;
3950
+ const handleChange = (event) => {
3951
+ const next2 = Number(event.target.value);
3937
3952
  if (!isControlled) {
3938
- setInternalSelectedId((current) => {
3939
- if (current != null && normalizedAddresses.some((option) => option.id === current)) {
3940
- return current;
3941
- }
3942
- return firstAddressId;
3943
- });
3953
+ setInternalValue(next2);
3944
3954
  }
3945
- }, [firstAddressId, isControlled, normalizedAddresses]);
3946
- const selectedOption = normalizedAddresses.find((option) => option.id === resolvedSelectedId) ?? normalizedAddresses[0];
3947
- const [isDropdownOpen, setIsDropdownOpen] = o__namespace.useState(false);
3948
- const dropdownRef = o__namespace.useRef(null);
3949
- o__namespace.useEffect(() => {
3950
- if (!isDropdownOpen) return;
3951
- const handleClick = (event) => {
3952
- if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
3953
- setIsDropdownOpen(false);
3954
- }
3955
- };
3956
- const handleKey = (event) => {
3957
- if (event.key === "Escape") {
3958
- setIsDropdownOpen(false);
3959
- }
3960
- };
3961
- document.addEventListener("mousedown", handleClick);
3962
- document.addEventListener("keydown", handleKey);
3963
- return () => {
3964
- document.removeEventListener("mousedown", handleClick);
3965
- document.removeEventListener("keydown", handleKey);
3966
- };
3967
- }, [isDropdownOpen]);
3968
- const handleAddressSelect = (addressId) => {
3969
- if (!isControlled) {
3970
- setInternalSelectedId(addressId);
3971
- }
3972
- onSelectAddress?.(addressId);
3973
- setIsDropdownOpen(false);
3974
- };
3975
- const propertyValueLabel = propertyValue?.label ?? "Property Value";
3976
- const propertyValueCurrency = propertyValue?.currencySymbol ?? "$";
3977
- const propertyValueFormat = propertyValue?.formatOptions ?? {
3978
- minimumFractionDigits: 2,
3979
- maximumFractionDigits: 2
3955
+ onValueChange?.(next2, event);
3980
3956
  };
3981
- const formattedPropertyValue = propertyValue == null ? null : `${propertyValueCurrency}${propertyValue.value.toLocaleString(
3982
- void 0,
3983
- propertyValueFormat
3984
- )}`;
3985
- const formattedPropertyChange = propertyValue?.change == null ? null : `${propertyValue.change >= 0 ? "+" : "-"}${propertyValueCurrency}${Math.abs(
3986
- propertyValue.change
3987
- ).toLocaleString(void 0, propertyValueFormat)}`;
3988
- const priceCurrency = price?.currencySymbol ?? "$";
3989
- const priceFormat = price?.formatOptions ?? { minimumFractionDigits: 2, maximumFractionDigits: 2 };
3990
- const pricePercentFormat = price?.percentFormatOptions ?? { minimumFractionDigits: 2, maximumFractionDigits: 2 };
3991
- const formattedPriceValue = price == null ? null : `${priceCurrency}${price.value.toLocaleString(void 0, priceFormat)}`;
3992
- const formattedPriceChange = price?.change == null ? null : `${price.change >= 0 ? "+" : "-"}${priceCurrency}${Math.abs(price.change).toLocaleString(
3993
- void 0,
3994
- priceFormat
3995
- )}`;
3996
- const formattedPricePercent = price?.changePercent == null ? null : `${price.changePercent >= 0 ? "+" : "-"}${Math.abs(price.changePercent).toLocaleString(
3997
- void 0,
3998
- pricePercentFormat
3999
- )}%`;
4000
- const priceContent = formattedPriceValue && propertyValueVariant === "pill" ? /* @__PURE__ */ jsxRuntime.jsxs(PriceBlock, { $variant: propertyValueVariant, children: [
4001
- /* @__PURE__ */ jsxRuntime.jsx(PriceAmount, { children: formattedPriceValue }),
4002
- formattedPriceChange || formattedPricePercent ? /* @__PURE__ */ jsxRuntime.jsxs(
4003
- PriceChange,
4004
- {
4005
- $isPositive: price?.change != null ? price.change >= 0 : price?.changePercent != null ? price.changePercent >= 0 : void 0,
4006
- children: [
4007
- formattedPriceChange ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: formattedPriceChange }) : null,
4008
- formattedPricePercent ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: formattedPricePercent }) : null
4009
- ]
4010
- }
4011
- ) : null
4012
- ] }) : null;
4013
- const propertyValueContent = formattedPropertyValue ? /* @__PURE__ */ jsxRuntime.jsxs(PropertyValueBlock, { $variant: propertyValueVariant, children: [
4014
- /* @__PURE__ */ jsxRuntime.jsx(PropertyValueLabel, { children: propertyValueLabel }),
4015
- /* @__PURE__ */ jsxRuntime.jsx(PropertyValueAmount, { children: formattedPropertyValue }),
4016
- formattedPropertyChange ? /* @__PURE__ */ jsxRuntime.jsx(PropertyValueChange, { $isPositive: propertyValue?.change != null ? propertyValue.change >= 0 : void 0, children: formattedPropertyChange }) : null
4017
- ] }) : null;
4018
- return /* @__PURE__ */ jsxRuntime.jsxs(PropertySelectorContainer, { ref, className, $variant: propertyValueVariant, ...props, children: [
4019
- /* @__PURE__ */ jsxRuntime.jsxs(PropertySelector, { ref: dropdownRef, onClick: () => hasAddresses && setIsDropdownOpen((prev2) => !prev2), children: [
4020
- /* @__PURE__ */ jsxRuntime.jsxs(PropertyAddress, { children: [
4021
- selectedOption ? selectedOption.label : hasAddresses ? "Select address" : "No addresses available",
3957
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("rounded-3xl border border-slate-200 bg-white p-6 shadow-sm", className), children: [
3958
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-end justify-between gap-4", children: [
3959
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3960
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium uppercase tracking-wide text-slate-500", children: label }),
3961
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-slate-500", children: helperText })
3962
+ ] }),
3963
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-right", children: [
3964
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs uppercase tracking-wide text-slate-500", children: "Selected" }),
3965
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-2xl font-semibold text-slate-900", children: formatValue(currentValue) })
3966
+ ] })
3967
+ ] }),
3968
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-6 space-y-3", children: [
3969
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
3970
+ /* @__PURE__ */ jsxRuntime.jsx(
3971
+ "input",
3972
+ {
3973
+ type: "range",
3974
+ min: parsedMin,
3975
+ max: parsedMax,
3976
+ step,
3977
+ value: currentValue,
3978
+ onChange: handleChange,
3979
+ ref,
3980
+ className: "h-3 w-full appearance-none rounded-full bg-slate-200 accent-teal-500",
3981
+ style: {
3982
+ background: `linear-gradient(90deg, ${accentColor} ${percent}%, #e2e8f0 ${percent}%)`
3983
+ },
3984
+ ...rest
3985
+ }
3986
+ ),
4022
3987
  /* @__PURE__ */ jsxRuntime.jsx(
4023
- "svg",
3988
+ "div",
4024
3989
  {
4025
- className: "dropdown-icon",
4026
- xmlns: "http://www.w3.org/2000/svg",
4027
- width: "20",
4028
- height: "20",
4029
- viewBox: "0 0 24 24",
4030
- fill: "currentColor",
4031
- style: { transform: isDropdownOpen ? "rotate(180deg)" : void 0 },
4032
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 10l5 5 5-5H7z" })
3990
+ className: "pointer-events-none absolute -top-7 translate-x-1/2 rounded-full border border-slate-200 bg-white px-3 py-1 text-xs font-medium text-slate-700 shadow",
3991
+ style: { right: `calc(${100 - percent}% - 12px)` },
3992
+ children: formatValue(currentValue)
4033
3993
  }
4034
3994
  )
4035
3995
  ] }),
4036
- /* @__PURE__ */ jsxRuntime.jsx(PropertySelectorDropdown, { $isOpen: isDropdownOpen && hasAddresses, children: normalizedAddresses.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
4037
- PropertySelectorOption,
4038
- {
4039
- onClick: (event) => {
4040
- event.stopPropagation();
4041
- handleAddressSelect(option.id);
4042
- },
4043
- children: /* @__PURE__ */ jsxRuntime.jsx(PropertySelectorName, { children: option.label })
4044
- },
4045
- option.id
4046
- )) })
4047
- ] }),
4048
- propertyValueVariant === "pill" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4049
- priceContent,
4050
- propertyValueContent
4051
- ] }) : propertyValueContent
3996
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-xs font-semibold text-slate-500", children: [
3997
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: minLabel ?? formatValue(parsedMin) }),
3998
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: maxLabel ?? formatValue(parsedMax) })
3999
+ ] })
4000
+ ] })
4052
4001
  ] });
4053
4002
  }
4054
4003
  );
4055
- PropertyCompareBar.displayName = "PropertyCompareBar";
4056
- var PropertySelectorContainer = at.div`
4057
- display: flex;
4058
- align-items: center;
4059
- justify-content: space-between;
4060
- padding: 1rem 1.5rem;
4061
- background-color: ${({ $variant }) => $variant === "pill" ? "#0f0f0f" : "rgba(30, 32, 38, 0.95)"};
4062
- border: ${({ $variant }) => $variant === "pill" ? "1px solid rgba(255, 255, 255, 0.15)" : "none"};
4063
- border-radius: 8px;
4064
- margin-bottom: 1.5rem;
4065
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
4066
- color: var(--color-text, #f8f9fa);
4067
- font-family: var(--font-family, "Inter", sans-serif);
4068
-
4004
+ TradingSlider.displayName = "TradingSlider";
4005
+ var MobileToggleContainer = at.div`
4006
+ display: none;
4007
+
4069
4008
  @media (max-width: 1024px) {
4009
+ display: flex;
4010
+ gap: 0.5rem;
4011
+ position: fixed;
4012
+ bottom: 0;
4013
+ left: 0;
4014
+ right: 0;
4015
+ background-color: var(--color-card-darker, #111);
4070
4016
  padding: 0.75rem 1rem;
4071
- margin-bottom: 0.75rem;
4072
- }
4073
-
4074
- @media (max-width: 768px) {
4075
- border-radius: 0;
4076
- margin-top: 0;
4077
- padding-top: 0.5rem;
4078
- }
4079
-
4080
- @media (max-width: 600px) {
4081
- width: 100%;
4082
-
4083
- ${({ $variant }) => $variant === "pill" ? rt`
4084
- display: grid;
4085
- grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 1fr);
4086
- gap: 0.35rem;
4087
- align-items: center;
4088
-
4089
- > *:nth-child(1) {
4090
- width: 100%;
4091
- }
4092
-
4093
- > *:nth-child(2) {
4094
- justify-self: center;
4095
- width: 100%;
4096
- }
4097
-
4098
- > *:nth-child(3) {
4099
- justify-self: end;
4100
- text-align: right;
4101
- }
4102
- ` : rt`
4103
- flex-direction: row;
4104
- align-items: center;
4105
- justify-content: space-between;
4106
- gap: 0.5rem;
4107
- `};
4017
+ padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
4018
+ border-top: 1px solid var(--color-border);
4019
+ z-index: 100;
4020
+ box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
4108
4021
  }
4109
4022
  `;
4110
- var PropertySelector = at.div`
4111
- position: relative;
4112
- display: flex;
4113
- align-items: center;
4114
- cursor: pointer;
4115
- padding: 0.5rem 0;
4023
+ var MobileToggleButton = at.button`
4116
4024
  flex: 1;
4117
-
4118
- &:hover {
4119
- .dropdown-icon {
4120
- transform: translateY(2px);
4121
- }
4122
- }
4123
- `;
4124
- var PropertyAddress = at.div`
4125
- font-size: 1.125rem;
4025
+ padding: 0.75rem;
4026
+ background-color: ${(props) => props.active ? "var(--color-accent)" : "transparent"};
4027
+ color: ${(props) => props.active ? "#000" : "var(--color-text-secondary)"};
4028
+ border: ${(props) => props.active ? "1px solid var(--color-accent)" : "1px solid rgba(255, 255, 255, 0.2)"};
4029
+ border-radius: 6px;
4030
+ font-size: 0.9rem;
4126
4031
  font-weight: 600;
4127
- display: flex;
4128
- align-items: center;
4129
- gap: 0.5rem;
4130
- color: inherit;
4131
-
4132
- svg {
4133
- transition: transform 0.2s;
4134
- }
4135
-
4136
- @media (max-width: 600px) {
4137
- flex-direction: column;
4138
- align-items: flex-start;
4139
- gap: 0.2rem;
4140
- font-size: 1rem;
4141
- line-height: 1.2;
4142
- white-space: normal;
4143
- }
4144
- `;
4145
- var PropertySelectorDropdown = at.div`
4146
- position: absolute;
4147
- top: 100%;
4148
- left: 0;
4149
- width: 100%;
4150
- max-width: 400px;
4151
- background-color: var(--color-card, #1f232b);
4152
- border-radius: 8px;
4153
- box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
4154
- z-index: 100;
4155
- overflow: hidden;
4156
- display: ${(props) => props.$isOpen ? "block" : "none"};
4157
- `;
4158
- var PropertySelectorOption = at.div`
4159
- padding: 0.75rem 1rem;
4160
- border-bottom: 1px solid rgba(255, 255, 255, 0.1);
4161
4032
  cursor: pointer;
4162
- transition: background-color 0.2s;
4163
-
4033
+ transition: all 0.2s ease;
4034
+ white-space: nowrap;
4035
+
4164
4036
  &:hover {
4165
- background-color: rgba(255, 255, 255, 0.05);
4166
- }
4167
-
4168
- &:last-child {
4169
- border-bottom: none;
4037
+ background-color: ${(props) => props.active ? "var(--color-accent-hover)" : "rgba(255, 255, 255, 0.05)"};
4038
+ border-color: ${(props) => props.active ? "var(--color-accent)" : "rgba(255, 255, 255, 0.3)"};
4170
4039
  }
4171
- `;
4172
- var PropertySelectorName = at.div`
4173
- font-weight: 600;
4174
- `;
4175
- var PropertyValueBlock = at.div`
4176
- display: flex;
4177
- align-items: center;
4178
- gap: 0.5rem;
4179
- margin-left: 1rem;
4180
- white-space: nowrap;
4181
-
4182
- ${({ $variant }) => $variant === "card" && rt`
4183
- margin-left: auto;
4184
- flex-direction: row;
4185
- align-items: center;
4186
- min-width: 220px;
4187
- border: none;
4188
- background: rgba(30, 32, 38, 0.95);
4189
- border-radius: 14px;
4190
- padding: 0.9rem 1.25rem;
4191
- box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
4192
- gap: 0.85rem;
4193
- justify-content: flex-end;
4194
-
4195
- @media (max-width: 600px) {
4196
- margin: 0;
4197
- width: auto;
4198
- min-width: 0;
4199
- flex-direction: column;
4200
- align-items: flex-end;
4201
- gap: 0.125rem;
4202
- padding: 0;
4203
- background: transparent;
4204
- border-radius: 0;
4205
- box-shadow: none;
4206
- }
4207
- `}
4208
-
4209
- ${({ $variant }) => $variant === "pill" && rt`
4210
- margin-left: auto;
4211
- margin-right: 1rem;
4212
- background: #191919;
4213
- border-radius: 8px;
4214
- border: 1px solid rgba(255, 255, 255, 0.05);
4215
- padding: 0.5rem 1rem;
4216
- gap: 1rem;
4217
- align-items: center;
4218
-
4219
- @media (max-width: 600px) {
4220
- margin: 0;
4221
- width: 100%;
4222
- min-width: 0;
4223
- flex-direction: column;
4224
- align-items: flex-end;
4225
- text-align: right;
4226
- gap: 0.2rem;
4227
- padding: 0;
4228
- background: transparent;
4229
- border-radius: 0;
4230
- border: none;
4231
- white-space: normal;
4232
- }
4233
- `}
4234
-
4235
- @media (max-width: 600px) {
4236
- margin: 0;
4237
- flex-direction: column;
4238
- align-items: flex-end;
4239
- gap: 0.2rem;
4240
- white-space: normal;
4040
+
4041
+ @media (max-width: 480px) {
4042
+ font-size: 0.85rem;
4043
+ padding: 0.6rem 0.5rem;
4241
4044
  }
4242
4045
  `;
4243
- var PropertyValueLabel = at.span`
4244
- font-size: 0.7rem;
4245
- color: var(--color-text-secondary, rgba(255, 255, 255, 0.6));
4246
- text-transform: uppercase;
4247
- letter-spacing: 0.5px;
4248
-
4249
- @media (max-width: 600px) {
4250
- font-size: 0.6rem;
4251
- letter-spacing: 0.4px;
4046
+ var MobileTradeNav = o__namespace.forwardRef(
4047
+ ({ className, items, activeId, onChange, ...props }, ref) => {
4048
+ return /* @__PURE__ */ jsxRuntime.jsx(MobileToggleContainer, { ref, className: cn(className), ...props, children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
4049
+ MobileToggleButton,
4050
+ {
4051
+ type: "button",
4052
+ active: item.id === activeId,
4053
+ onClick: () => onChange?.(item.id),
4054
+ children: [
4055
+ item.icon,
4056
+ item.label
4057
+ ]
4058
+ },
4059
+ item.id
4060
+ )) });
4252
4061
  }
4253
- `;
4254
- var PropertyValueAmount = at.span`
4255
- font-size: 1.1rem;
4256
- font-weight: 600;
4257
- color: #fff;
4258
-
4259
- @media (max-width: 600px) {
4260
- font-size: 0.95rem;
4062
+ );
4063
+ MobileTradeNav.displayName = "MobileTradeNav";
4064
+ function formatPrice(value) {
4065
+ if (value == null || Number.isNaN(value)) {
4066
+ return "0.00";
4261
4067
  }
4262
- `;
4263
- var PropertyValueChange = at.span`
4264
- font-size: 0.75rem;
4265
- font-weight: 500;
4266
- color: ${(props) => props.$isPositive == null ? "var(--color-text-secondary, rgba(255, 255, 255, 0.6))" : props.$isPositive ? "var(--color-positive, #0ecb81)" : "var(--color-negative, #f6465d)"};
4267
-
4268
- @media (max-width: 600px) {
4269
- font-size: 0.65rem;
4068
+ return value.toLocaleString(void 0, {
4069
+ minimumFractionDigits: 2,
4070
+ maximumFractionDigits: 2
4071
+ });
4072
+ }
4073
+ function formatQuantity(value) {
4074
+ if (value == null || Number.isNaN(value)) {
4075
+ return "0";
4270
4076
  }
4271
- `;
4272
- var PriceBlock = at.div`
4273
- display: none;
4274
-
4275
- ${({ $variant }) => $variant === "pill" && rt`
4276
- @media (max-width: 600px) {
4277
- display: flex;
4278
- flex: none;
4279
- flex-direction: column;
4280
- align-items: center;
4281
- justify-content: center;
4282
- gap: 0.15rem;
4283
- width: 100%;
4284
- }
4285
- `}
4286
- `;
4287
- var PriceAmount = at.span`
4288
- font-size: 1.6rem;
4289
- font-weight: 600;
4290
- color: #fff;
4291
- letter-spacing: 0.2px;
4292
- `;
4293
- var PriceChange = at.span`
4294
- font-size: 0.85rem;
4295
- font-weight: 500;
4296
- display: inline-flex;
4297
- gap: 0.35rem;
4298
- color: ${(props) => props.$isPositive == null ? "var(--color-text-secondary, rgba(255, 255, 255, 0.6))" : props.$isPositive ? "var(--color-positive, #0ecb81)" : "var(--color-negative, #f6465d)"};
4299
- `;
4077
+ return value.toLocaleString(void 0, {
4078
+ minimumFractionDigits: 0,
4079
+ maximumFractionDigits: 0
4080
+ });
4081
+ }
4082
+ function formatCurrency(value) {
4083
+ if (value == null || Number.isNaN(value)) return "\u2014";
4084
+ return `$${value.toLocaleString(void 0, {
4085
+ minimumFractionDigits: 2,
4086
+ maximumFractionDigits: 2
4087
+ })}`;
4088
+ }
4089
+ var overlayStyle = {
4090
+ position: "fixed",
4091
+ top: 0,
4092
+ left: 0,
4093
+ right: 0,
4094
+ bottom: 0,
4095
+ backgroundColor: "rgba(0, 0, 0, 0.7)",
4096
+ display: "flex",
4097
+ alignItems: "center",
4098
+ justifyContent: "center",
4099
+ zIndex: 1e4,
4100
+ backdropFilter: "blur(4px)",
4101
+ padding: "1rem"
4102
+ };
4103
+ var modalBaseStyle = {
4104
+ background: "linear-gradient(135deg, rgba(26, 29, 35, 0.95) 0%, rgba(26, 29, 35, 0.98) 100%)",
4105
+ border: "1px solid rgba(255, 255, 255, 0.1)",
4106
+ borderRadius: "16px",
4107
+ padding: "2rem",
4108
+ width: "100%",
4109
+ maxWidth: "480px",
4110
+ boxShadow: "0 20px 60px rgba(0, 0, 0, 0.5)",
4111
+ color: "#fff"
4112
+ };
4113
+ var headerStyle = {
4114
+ display: "flex",
4115
+ alignItems: "center",
4116
+ justifyContent: "space-between",
4117
+ marginBottom: "1.5rem",
4118
+ paddingBottom: "1rem",
4119
+ borderBottom: "1px solid rgba(255, 255, 255, 0.1)"
4120
+ };
4121
+ var titleStyle = {
4122
+ margin: 0,
4123
+ fontSize: "1.25rem",
4124
+ fontWeight: 600,
4125
+ display: "flex",
4126
+ alignItems: "center",
4127
+ gap: "0.5rem"
4128
+ };
4129
+ var badgeBaseStyle = {
4130
+ display: "inline-block",
4131
+ padding: "0.25rem 0.75rem",
4132
+ borderRadius: "6px",
4133
+ fontSize: "0.75rem",
4134
+ fontWeight: 600,
4135
+ textTransform: "uppercase",
4136
+ letterSpacing: "0.5px"
4137
+ };
4138
+ var detailRowBase = {
4139
+ display: "flex",
4140
+ justifyContent: "space-between",
4141
+ alignItems: "center",
4142
+ padding: "0.75rem 0",
4143
+ borderBottom: "1px solid rgba(255, 255, 255, 0.08)"
4144
+ };
4145
+ var detailLabelStyle = {
4146
+ color: "rgba(255, 255, 255, 0.6)",
4147
+ fontSize: "0.9rem"
4148
+ };
4149
+ var detailValueStyle = {
4150
+ color: "#fff",
4151
+ fontWeight: 500,
4152
+ fontSize: "0.95rem"
4153
+ };
4154
+ var summaryBoxStyle = {
4155
+ background: "rgba(255, 255, 255, 0.03)",
4156
+ border: "1px solid rgba(255, 255, 255, 0.08)",
4157
+ borderRadius: "8px",
4158
+ padding: "1rem",
4159
+ marginBottom: "1.5rem"
4160
+ };
4161
+ var summaryTextStyle = {
4162
+ margin: 0,
4163
+ color: "rgba(255, 255, 255, 0.8)",
4164
+ fontSize: "0.9rem",
4165
+ lineHeight: 1.5
4166
+ };
4167
+ var rememberChoiceRowStyle = {
4168
+ display: "flex",
4169
+ alignItems: "center",
4170
+ gap: "0.5rem",
4171
+ marginBottom: "1.25rem",
4172
+ color: "rgba(255, 255, 255, 0.8)",
4173
+ fontSize: "0.85rem"
4174
+ };
4175
+ var rememberChoiceCheckboxBoxStyle = {
4176
+ width: "18px",
4177
+ height: "18px",
4178
+ borderRadius: "4px",
4179
+ border: "1px solid rgba(255, 255, 255, 0.4)",
4180
+ display: "inline-flex",
4181
+ alignItems: "center",
4182
+ justifyContent: "center",
4183
+ fontSize: "0.85rem",
4184
+ fontWeight: 700,
4185
+ transition: "all 0.2s ease",
4186
+ lineHeight: 1
4187
+ };
4188
+ var rememberChoiceHiddenInputStyle = {
4189
+ position: "absolute",
4190
+ opacity: 0,
4191
+ pointerEvents: "none",
4192
+ width: 0,
4193
+ height: 0
4194
+ };
4195
+ var buttonGroupStyle = {
4196
+ display: "flex",
4197
+ gap: "1rem",
4198
+ justifyContent: "flex-end"
4199
+ };
4200
+ var buttonBaseStyle = {
4201
+ padding: "0.75rem 1.5rem",
4202
+ borderRadius: "8px",
4203
+ fontWeight: 600,
4204
+ fontSize: "0.95rem",
4205
+ cursor: "pointer",
4206
+ transition: "all 0.2s ease",
4207
+ border: "none"
4208
+ };
4209
+ function TradeConfirmationModal({
4210
+ isOpen,
4211
+ onClose,
4212
+ onConfirm,
4213
+ orderDetails,
4214
+ className,
4215
+ estimatedFeeUsd: _estimatedFeeUsd,
4216
+ estimatedFeeBps: _estimatedFeeBps,
4217
+ totalWithFeesUsd,
4218
+ confirmDisabled,
4219
+ confirmLoading,
4220
+ rememberChoiceChecked = false,
4221
+ rememberChoiceLabel = "Remember this choice and auto-confirm next time",
4222
+ onRememberChoiceChange
4223
+ }) {
4224
+ if (!isOpen || !orderDetails) return null;
4225
+ const { type, orderType, quantity, price, totalValue, tokenSymbol, willExecuteImmediately } = orderDetails;
4226
+ const isBuy = type === "buy";
4227
+ const isLimit = orderType === "limit";
4228
+ const netLabel = `Est. Total ${isBuy ? "Cost" : "Proceeds"}`;
4229
+ const grossFallback = totalValue != null ? `$${formatPrice(totalValue)}` : "\u2014";
4230
+ const netValue = totalWithFeesUsd != null ? formatCurrency(totalWithFeesUsd) : grossFallback;
4231
+ const detailRows = [
4232
+ { label: "Order Type", value: isLimit ? "Limit Order" : "Market Order" },
4233
+ { label: "Token", value: tokenSymbol },
4234
+ { label: "Quantity", value: `${formatQuantity(quantity)} tokens`, highlight: true },
4235
+ { label: "Price", value: isLimit ? `$${formatPrice(price)}` : "Market" }
4236
+ ];
4237
+ detailRows.push({ label: netLabel, value: netValue, highlight: true });
4238
+ const accentColor = isBuy ? "#0ecb81" : "#f6465d";
4239
+ const badgeStyle = {
4240
+ ...badgeBaseStyle,
4241
+ color: accentColor,
4242
+ border: `1px solid ${isBuy ? "rgba(14, 203, 129, 0.3)" : "rgba(246, 70, 93, 0.3)"}`,
4243
+ background: isBuy ? "linear-gradient(135deg, rgba(14, 203, 129, 0.2) 0%, rgba(14, 203, 129, 0.1) 100%)" : "linear-gradient(135deg, rgba(246, 70, 93, 0.2) 0%, rgba(246, 70, 93, 0.1) 100%)"
4244
+ };
4245
+ const cancelButtonStyle = {
4246
+ ...buttonBaseStyle,
4247
+ background: "rgba(255, 255, 255, 0.1)",
4248
+ color: "rgba(255, 255, 255, 0.8)",
4249
+ border: "1px solid rgba(255, 255, 255, 0.2)"
4250
+ };
4251
+ const confirmButtonStyle = {
4252
+ ...buttonBaseStyle,
4253
+ color: "#fff",
4254
+ background: isBuy ? "linear-gradient(135deg, #0ecb81 0%, #0ba968 100%)" : "linear-gradient(135deg, #f6465d 0%, #d93850 100%)",
4255
+ boxShadow: isBuy ? "0 4px 12px rgba(14, 203, 129, 0.3)" : "0 4px 12px rgba(246, 70, 93, 0.3)",
4256
+ opacity: confirmDisabled || confirmLoading ? 0.6 : 1,
4257
+ cursor: confirmDisabled || confirmLoading ? "not-allowed" : "pointer"
4258
+ };
4259
+ const showRememberChoice = typeof onRememberChoiceChange === "function";
4260
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: overlayStyle, onClick: onClose, role: "dialog", "aria-modal": "true", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: modalBaseStyle, className, onClick: (event) => event.stopPropagation(), children: [
4261
+ /* @__PURE__ */ jsxRuntime.jsx("header", { style: headerStyle, children: /* @__PURE__ */ jsxRuntime.jsxs("h3", { style: titleStyle, children: [
4262
+ "Confirm Order",
4263
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: badgeStyle, children: isBuy ? "BUY" : "SELL" })
4264
+ ] }) }),
4265
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginBottom: "1.5rem" }, children: detailRows.map((row, index) => /* @__PURE__ */ jsxRuntime.jsxs(
4266
+ "div",
4267
+ {
4268
+ style: {
4269
+ ...detailRowBase,
4270
+ borderBottom: index === detailRows.length - 1 ? "none" : detailRowBase.borderBottom
4271
+ },
4272
+ children: [
4273
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: detailLabelStyle, children: row.label }),
4274
+ /* @__PURE__ */ jsxRuntime.jsx(
4275
+ "span",
4276
+ {
4277
+ style: {
4278
+ ...detailValueStyle,
4279
+ color: row.highlight ? accentColor : detailValueStyle.color,
4280
+ fontWeight: row.highlight ? 600 : detailValueStyle.fontWeight
4281
+ },
4282
+ children: row.value
4283
+ }
4284
+ )
4285
+ ]
4286
+ },
4287
+ `${row.label}-${index}`
4288
+ )) }),
4289
+ /* @__PURE__ */ jsxRuntime.jsx("section", { style: summaryBoxStyle, children: /* @__PURE__ */ jsxRuntime.jsx("p", { style: summaryTextStyle, children: isLimit ? willExecuteImmediately ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4290
+ "Your limit ",
4291
+ isBuy ? "buy" : "sell",
4292
+ " order will ",
4293
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { style: { color: "#fff" }, children: "execute immediately" }),
4294
+ " at market price because your limit price of ",
4295
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { style: { color: "#fff" }, children: [
4296
+ "$",
4297
+ formatPrice(price)
4298
+ ] }),
4299
+ " is",
4300
+ isBuy ? " above" : " below",
4301
+ " the current market."
4302
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4303
+ "Your limit ",
4304
+ isBuy ? "buy" : "sell",
4305
+ " order for",
4306
+ " ",
4307
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { style: { color: "#fff" }, children: [
4308
+ formatQuantity(quantity),
4309
+ " tokens"
4310
+ ] }),
4311
+ " at",
4312
+ " ",
4313
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { style: { color: "#fff" }, children: [
4314
+ "$",
4315
+ formatPrice(price)
4316
+ ] }),
4317
+ " will be placed."
4318
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4319
+ "Your market ",
4320
+ isBuy ? "buy" : "sell",
4321
+ " order for",
4322
+ " ",
4323
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { style: { color: "#fff" }, children: [
4324
+ formatQuantity(quantity),
4325
+ " tokens"
4326
+ ] }),
4327
+ " will execute immediately at the best available market price."
4328
+ ] }) }) }),
4329
+ showRememberChoice ? /* @__PURE__ */ jsxRuntime.jsxs("label", { style: { ...rememberChoiceRowStyle, position: "relative" }, children: [
4330
+ /* @__PURE__ */ jsxRuntime.jsx(
4331
+ "input",
4332
+ {
4333
+ type: "checkbox",
4334
+ checked: rememberChoiceChecked,
4335
+ onChange: (event) => onRememberChoiceChange?.(event.target.checked),
4336
+ style: rememberChoiceHiddenInputStyle
4337
+ }
4338
+ ),
4339
+ /* @__PURE__ */ jsxRuntime.jsx(
4340
+ "span",
4341
+ {
4342
+ "aria-hidden": "true",
4343
+ style: {
4344
+ ...rememberChoiceCheckboxBoxStyle,
4345
+ borderColor: rememberChoiceChecked ? accentColor : rememberChoiceCheckboxBoxStyle.border,
4346
+ background: rememberChoiceChecked ? `linear-gradient(135deg, ${accentColor}33, ${accentColor}22)` : "transparent",
4347
+ color: rememberChoiceChecked ? accentColor : "transparent"
4348
+ },
4349
+ children: "\u2713"
4350
+ }
4351
+ ),
4352
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: rememberChoiceLabel })
4353
+ ] }) : null,
4354
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: buttonGroupStyle, children: [
4355
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: onClose, style: cancelButtonStyle, children: "Cancel" }),
4356
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: confirmDisabled ? void 0 : onConfirm, disabled: confirmDisabled || confirmLoading, style: confirmButtonStyle, children: confirmLoading ? "Submitting\u2026" : `Confirm ${isBuy ? "Buy" : "Sell"}` })
4357
+ ] })
4358
+ ] }) });
4359
+ }
4300
4360
  var DEFAULT_TABS = [
4301
4361
  { id: "portfolio", label: "Portfolio" },
4302
4362
  { id: "openOrders", label: "Open Orders" },
@@ -4312,10 +4372,10 @@ var panelStyle = {
4312
4372
  display: "flex",
4313
4373
  flexDirection: "column"
4314
4374
  };
4315
- var headerStyle = {
4375
+ var headerStyle2 = {
4316
4376
  padding: "1.25rem 1.5rem 0.5rem"
4317
4377
  };
4318
- var titleStyle = {
4378
+ var titleStyle2 = {
4319
4379
  margin: 0,
4320
4380
  fontSize: "1.1rem",
4321
4381
  fontWeight: 600
@@ -4344,6 +4404,30 @@ var tabContentWrapper = {
4344
4404
  gap: "0.75rem",
4345
4405
  flex: 1
4346
4406
  };
4407
+ var paginationContainerStyle = {
4408
+ display: "flex",
4409
+ justifyContent: "space-between",
4410
+ alignItems: "center",
4411
+ marginTop: "0.75rem",
4412
+ paddingTop: "0.75rem",
4413
+ borderTop: "1px solid rgba(255,255,255,0.08)",
4414
+ fontSize: "0.85rem",
4415
+ color: "rgba(255,255,255,0.7)"
4416
+ };
4417
+ var paginationButtonsStyle = {
4418
+ display: "flex",
4419
+ gap: "0.5rem"
4420
+ };
4421
+ var paginationButtonStyle = {
4422
+ border: "1px solid rgba(255,255,255,0.2)",
4423
+ background: "rgba(255,255,255,0.05)",
4424
+ color: "#fff",
4425
+ borderRadius: "6px",
4426
+ padding: "0.35rem 0.9rem",
4427
+ fontSize: "0.8rem",
4428
+ cursor: "pointer",
4429
+ transition: "opacity 0.2s ease"
4430
+ };
4347
4431
  var tableHeaderStyle = {
4348
4432
  display: "grid",
4349
4433
  gridTemplateColumns: "1.8fr 0.9fr 0.7fr 0.8fr 0.8fr 1fr",
@@ -4380,7 +4464,7 @@ var rowStyle = {
4380
4464
  padding: "0.75rem 0",
4381
4465
  borderBottom: "1px solid rgba(255,255,255,0.08)"
4382
4466
  };
4383
- var formatCurrency = (value) => {
4467
+ var formatCurrency2 = (value) => {
4384
4468
  if (value == null || Number.isNaN(value)) return "\u2014";
4385
4469
  return `$${value.toLocaleString(void 0, {
4386
4470
  minimumFractionDigits: 2,
@@ -4392,9 +4476,23 @@ var formatPercent = (value, fractionDigits = 2) => {
4392
4476
  return `${value.toFixed(fractionDigits)}%`;
4393
4477
  };
4394
4478
  var YourOrders = o__namespace.forwardRef(
4395
- ({ className, title, orders, tabs, activeTabId, onTabChange, renderOrderActions, ...props }, ref) => {
4479
+ ({
4480
+ className,
4481
+ title,
4482
+ orders,
4483
+ tabs,
4484
+ activeTabId,
4485
+ onTabChange,
4486
+ renderOrderActions,
4487
+ renderTabContent,
4488
+ ...props
4489
+ }, ref) => {
4396
4490
  const [internalActiveTab, setInternalActiveTab] = o__namespace.useState(tabs?.[0]?.id ?? "portfolio");
4491
+ const [page, setPage] = o__namespace.useState(0);
4397
4492
  const effectiveActiveTabId = activeTabId ?? internalActiveTab;
4493
+ o__namespace.useEffect(() => {
4494
+ setPage(0);
4495
+ }, [effectiveActiveTabId]);
4398
4496
  const handleTabChange = (tabId) => {
4399
4497
  if (onTabChange) {
4400
4498
  onTabChange(tabId);
@@ -4405,6 +4503,24 @@ var YourOrders = o__namespace.forwardRef(
4405
4503
  const resolvedTabs = tabs ?? DEFAULT_TABS.map((t) => ({ ...t, orders: orders ?? [], emptyState: `No ${t.label.toLowerCase()} data available.` }));
4406
4504
  const activeTab = resolvedTabs.find((t) => t.id === effectiveActiveTabId) ?? resolvedTabs[0];
4407
4505
  const activeOrders = activeTab?.orders ?? orders ?? [];
4506
+ const DEFAULT_PAGE_SIZE = 5;
4507
+ const HISTORY_PAGE_SIZE = 3;
4508
+ const pageSize = activeTab?.id === "order-history" || activeTab?.id === "trade-history" ? HISTORY_PAGE_SIZE : DEFAULT_PAGE_SIZE;
4509
+ const totalOrders = activeOrders.length;
4510
+ const totalPages = Math.max(1, Math.ceil(totalOrders / pageSize));
4511
+ const safePage = Math.min(page, totalPages - 1);
4512
+ const pageStart = safePage * pageSize;
4513
+ const paginatedOrders = activeOrders.slice(pageStart, pageStart + pageSize);
4514
+ const tabSupportsActions = activeTab?.enableCancel ?? true;
4515
+ const showActionsColumn = Boolean(renderOrderActions && tabSupportsActions);
4516
+ const columnVisibility = activeTab?.columnVisibility ?? {};
4517
+ const showPropertyPercentColumn = columnVisibility.propertyPercent !== false;
4518
+ const showPnlColumn = columnVisibility.pnl !== false;
4519
+ const columnTemplateParts = ["1.8fr", "0.9fr", "0.7fr", ...showPropertyPercentColumn ? ["0.8fr"] : [], "0.8fr", ...showPnlColumn ? ["1fr"] : []];
4520
+ if (showActionsColumn) {
4521
+ columnTemplateParts.push("0.8fr");
4522
+ }
4523
+ const gridTemplateColumns = columnTemplateParts.join(" ");
4408
4524
  const displayTitle = title ?? activeTab?.title ?? activeTab?.label ?? "Portfolio Holdings";
4409
4525
  console.log("[YourOrders] tabs:", tabs?.map((t) => ({ id: t.id, ordersCount: t.orders?.length })));
4410
4526
  console.log("[YourOrders] activeTabId prop:", activeTabId);
@@ -4417,15 +4533,16 @@ var YourOrders = o__namespace.forwardRef(
4417
4533
  return /* @__PURE__ */ jsxRuntime.jsx("div", { style: emptyStateStyle, children: emptyMessage });
4418
4534
  }
4419
4535
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4420
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: tableHeaderStyle, children: [
4536
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...tableHeaderStyle, gridTemplateColumns }, children: [
4421
4537
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "Property" }),
4422
4538
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "Value" }),
4423
4539
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "Holding" }),
4424
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "% of Property" }),
4540
+ showPropertyPercentColumn ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "% of Property" }) : null,
4425
4541
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "Avg Price" }),
4426
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "P&L" })
4542
+ showPnlColumn ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "P&L" }) : null,
4543
+ showActionsColumn ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...tableHeaderCell, textAlign: "right" }, children: "Actions" }) : null
4427
4544
  ] }),
4428
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.65rem" }, children: activeOrders.map((order) => {
4545
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.65rem" }, children: paginatedOrders.map((order) => {
4429
4546
  const propertyName = order.asset;
4430
4547
  const holding = order.holdingLabel ?? `${order.amount.toLocaleString(void 0, {
4431
4548
  minimumFractionDigits: 0,
@@ -4441,7 +4558,7 @@ var YourOrders = o__namespace.forwardRef(
4441
4558
  const currentPrice = order.currentPrice ?? order.price;
4442
4559
  const priceChangePercent = order.priceChangePercent ?? order.pnlPercent;
4443
4560
  const priceChangePositive = order.priceChangePositive ?? (priceChangePercent != null ? priceChangePercent >= 0 : void 0);
4444
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...rowStyle, gridTemplateColumns: renderOrderActions ? "1.8fr 0.8fr 0.7fr 0.8fr 0.8fr 0.9fr 0.8fr" : "1.8fr 0.9fr 0.7fr 0.8fr 0.8fr 1fr" }, children: [
4561
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...rowStyle, gridTemplateColumns }, children: [
4445
4562
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "1rem", alignItems: "center" }, children: [
4446
4563
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.15rem" }, children: [
4447
4564
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "0.9rem", fontWeight: 500 }, children: propertyName }),
@@ -4469,7 +4586,7 @@ var YourOrders = o__namespace.forwardRef(
4469
4586
  children: priceChangePositive ? "\u25B2" : "\u25BC"
4470
4587
  }
4471
4588
  ) : null,
4472
- formatCurrency(currentPrice)
4589
+ formatCurrency2(currentPrice)
4473
4590
  ]
4474
4591
  }
4475
4592
  ),
@@ -4490,11 +4607,11 @@ var YourOrders = o__namespace.forwardRef(
4490
4607
  ) : null
4491
4608
  ] }) : null
4492
4609
  ] }),
4493
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "0.9rem", fontWeight: 500, color: "#D4AF37" }, children: formatCurrency(value) }),
4610
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "0.9rem", fontWeight: 500, color: "#D4AF37" }, children: formatCurrency2(value) }),
4494
4611
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "0.9rem", color: "rgba(255,255,255,0.92)" }, children: holding }),
4495
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "0.9rem", color: "rgba(255,255,255,0.8)" }, children: formatPercent(propertyPercent, 3) }),
4496
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "0.9rem", color: "rgba(255,255,255,0.9)" }, children: formatCurrency(avgPrice) }),
4497
- /* @__PURE__ */ jsxRuntime.jsxs(
4612
+ showPropertyPercentColumn ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "0.9rem", color: "rgba(255,255,255,0.8)" }, children: formatPercent(propertyPercent, 3) }) : null,
4613
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "0.9rem", color: "rgba(255,255,255,0.9)" }, children: formatCurrency2(avgPrice) }),
4614
+ showPnlColumn ? /* @__PURE__ */ jsxRuntime.jsxs(
4498
4615
  "div",
4499
4616
  {
4500
4617
  style: {
@@ -4503,7 +4620,7 @@ var YourOrders = o__namespace.forwardRef(
4503
4620
  color: pnlPositive ? "#0ecb81" : "#f6465d"
4504
4621
  },
4505
4622
  children: [
4506
- pnlValue != null ? `${pnlPositive ? "+" : "-"}${formatCurrency(Math.abs(pnlValue))}` : formatCurrency(pnlValue),
4623
+ pnlValue != null ? `${pnlPositive ? "+" : "-"}${formatCurrency2(Math.abs(pnlValue))}` : formatCurrency2(pnlValue),
4507
4624
  pnlPercent != null ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { marginLeft: "0.35rem", fontSize: "0.75rem", color: "rgba(255,255,255,0.6)" }, children: [
4508
4625
  "(",
4509
4626
  pnlPositive ? "+" : "",
@@ -4512,13 +4629,71 @@ var YourOrders = o__namespace.forwardRef(
4512
4629
  ] }) : null
4513
4630
  ]
4514
4631
  }
4515
- ),
4516
- renderOrderActions ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", justifyContent: "flex-end" }, children: renderOrderActions(order) }) : null
4632
+ ) : null,
4633
+ showActionsColumn ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", justifyContent: "flex-end" }, children: renderOrderActions?.(order) }) : null
4517
4634
  ] }, order.id);
4518
4635
  }) })
4519
4636
  ] });
4520
4637
  };
4521
- const tabContent = renderOrders();
4638
+ const handlePageChange = (nextPage) => {
4639
+ if (nextPage < 0 || nextPage >= totalPages) return;
4640
+ setPage(nextPage);
4641
+ };
4642
+ const customTabContent = renderTabContent?.({
4643
+ tab: activeTab,
4644
+ orders: paginatedOrders,
4645
+ page: safePage,
4646
+ totalPages,
4647
+ totalOrders,
4648
+ pageSize,
4649
+ onPageChange: handlePageChange
4650
+ });
4651
+ const tabContent = customTabContent ?? renderOrders();
4652
+ const renderPagination = () => {
4653
+ if (!hasOrders || totalPages <= 1) return null;
4654
+ const rangeStart = pageStart + 1;
4655
+ const rangeEnd = Math.min(pageStart + pageSize, totalOrders);
4656
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: paginationContainerStyle, children: [
4657
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4658
+ "Showing ",
4659
+ rangeStart,
4660
+ "-",
4661
+ rangeEnd,
4662
+ " of ",
4663
+ totalOrders
4664
+ ] }),
4665
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: paginationButtonsStyle, children: [
4666
+ /* @__PURE__ */ jsxRuntime.jsx(
4667
+ "button",
4668
+ {
4669
+ type: "button",
4670
+ onClick: () => handlePageChange(safePage - 1),
4671
+ disabled: safePage === 0,
4672
+ style: {
4673
+ ...paginationButtonStyle,
4674
+ opacity: safePage === 0 ? 0.4 : 1,
4675
+ cursor: safePage === 0 ? "not-allowed" : "pointer"
4676
+ },
4677
+ children: "Prev"
4678
+ }
4679
+ ),
4680
+ /* @__PURE__ */ jsxRuntime.jsx(
4681
+ "button",
4682
+ {
4683
+ type: "button",
4684
+ onClick: () => handlePageChange(safePage + 1),
4685
+ disabled: safePage >= totalPages - 1,
4686
+ style: {
4687
+ ...paginationButtonStyle,
4688
+ opacity: safePage >= totalPages - 1 ? 0.4 : 1,
4689
+ cursor: safePage >= totalPages - 1 ? "not-allowed" : "pointer"
4690
+ },
4691
+ children: "Next"
4692
+ }
4693
+ )
4694
+ ] })
4695
+ ] });
4696
+ };
4522
4697
  return /* @__PURE__ */ jsxRuntime.jsxs(
4523
4698
  "div",
4524
4699
  {
@@ -4527,7 +4702,7 @@ var YourOrders = o__namespace.forwardRef(
4527
4702
  className,
4528
4703
  ...props,
4529
4704
  children: [
4530
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: headerStyle, children: /* @__PURE__ */ jsxRuntime.jsx("h3", { style: titleStyle, children: displayTitle }) }),
4705
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: headerStyle2, children: /* @__PURE__ */ jsxRuntime.jsx("h3", { style: titleStyle2, children: displayTitle }) }),
4531
4706
  resolvedTabs.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: tabsRowStyle, children: resolvedTabs.map((tab) => {
4532
4707
  const isActive = effectiveActiveTabId === tab.id;
4533
4708
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4560,7 +4735,10 @@ var YourOrders = o__namespace.forwardRef(
4560
4735
  tab.id
4561
4736
  );
4562
4737
  }) }),
4563
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: tabContentWrapper, children: tabContent })
4738
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: tabContentWrapper, children: [
4739
+ tabContent,
4740
+ renderPagination()
4741
+ ] })
4564
4742
  ]
4565
4743
  }
4566
4744
  );
@@ -4680,7 +4858,7 @@ var getPriceScaleOptions = (data) => {
4680
4858
  };
4681
4859
  var defaultRanges = ["30s", "1m", "5m", "15m", "1h", "4h", "24h", "1W", "1M"];
4682
4860
  var VISIBLE_RANGE_COUNT = 4;
4683
- var formatPrice = (value, currencySymbol) => {
4861
+ var formatPrice2 = (value, currencySymbol) => {
4684
4862
  return `${currencySymbol}${value.toLocaleString(void 0, {
4685
4863
  minimumFractionDigits: 2,
4686
4864
  maximumFractionDigits: 2
@@ -4957,7 +5135,7 @@ var PriceChart = o__namespace.forwardRef(
4957
5135
  {
4958
5136
  className: cn("text-xl font-semibold tabular-nums", changeClass),
4959
5137
  style: { marginRight: "1rem" },
4960
- children: formatPrice(resolvedPrice, currencySymbol)
5138
+ children: formatPrice2(resolvedPrice, currencySymbol)
4961
5139
  }
4962
5140
  ),
4963
5141
  dollarChange != null ? /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5001,7 +5179,7 @@ var PriceChart = o__namespace.forwardRef(
5001
5179
  }
5002
5180
  );
5003
5181
  PriceChart.displayName = "PriceChart";
5004
- var formatPrice2 = (value, currencySymbol) => {
5182
+ var formatPrice3 = (value, currencySymbol) => {
5005
5183
  return `${currencySymbol}${value.toLocaleString(void 0, {
5006
5184
  minimumFractionDigits: 3,
5007
5185
  maximumFractionDigits: 3
@@ -5055,8 +5233,8 @@ var PropertyHeroHeader = o__namespace.forwardRef(
5055
5233
  /* @__PURE__ */ jsxRuntime.jsx("h1", { style: headingStyle, className: "break-words", children: name }),
5056
5234
  /* @__PURE__ */ jsxRuntime.jsxs(InfoRow, { className: "mb-3 max-[768px]:mb-[0.6rem] max-[480px]:mb-[0.5rem]", children: [
5057
5235
  /* @__PURE__ */ jsxRuntime.jsx(LocationText, { children: location }),
5058
- price == null ? null : /* @__PURE__ */ jsxRuntime.jsxs(PriceBlock2, { children: [
5059
- formatPrice2(price, currencySymbol),
5236
+ price == null ? null : /* @__PURE__ */ jsxRuntime.jsxs(PriceBlock, { children: [
5237
+ formatPrice3(price, currencySymbol),
5060
5238
  changePercent == null ? null : /* @__PURE__ */ jsxRuntime.jsxs(
5061
5239
  "span",
5062
5240
  {
@@ -5337,7 +5515,7 @@ var LocationText = at.span`
5337
5515
  text-overflow: ellipsis;
5338
5516
  white-space: nowrap;
5339
5517
  `;
5340
- var PriceBlock2 = at.span`
5518
+ var PriceBlock = at.span`
5341
5519
  display: flex;
5342
5520
  align-items: center;
5343
5521
  font-size: clamp(1rem, 2.2vw, 1.25rem);
@@ -5472,65 +5650,6 @@ var PropertySubheader = o__namespace.forwardRef(
5472
5650
  }
5473
5651
  );
5474
5652
  PropertySubheader.displayName = "PropertySubheader";
5475
- var MobileToggleContainer = at.div`
5476
- display: none;
5477
-
5478
- @media (max-width: 1024px) {
5479
- display: flex;
5480
- gap: 0.5rem;
5481
- position: fixed;
5482
- bottom: 0;
5483
- left: 0;
5484
- right: 0;
5485
- background-color: var(--color-card-darker, #111);
5486
- padding: 0.75rem 1rem;
5487
- padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
5488
- border-top: 1px solid var(--color-border);
5489
- z-index: 100;
5490
- box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
5491
- }
5492
- `;
5493
- var MobileToggleButton = at.button`
5494
- flex: 1;
5495
- padding: 0.75rem;
5496
- background-color: ${(props) => props.active ? "var(--color-accent)" : "transparent"};
5497
- color: ${(props) => props.active ? "#000" : "var(--color-text-secondary)"};
5498
- border: ${(props) => props.active ? "1px solid var(--color-accent)" : "1px solid rgba(255, 255, 255, 0.2)"};
5499
- border-radius: 6px;
5500
- font-size: 0.9rem;
5501
- font-weight: 600;
5502
- cursor: pointer;
5503
- transition: all 0.2s ease;
5504
- white-space: nowrap;
5505
-
5506
- &:hover {
5507
- background-color: ${(props) => props.active ? "var(--color-accent-hover)" : "rgba(255, 255, 255, 0.05)"};
5508
- border-color: ${(props) => props.active ? "var(--color-accent)" : "rgba(255, 255, 255, 0.3)"};
5509
- }
5510
-
5511
- @media (max-width: 480px) {
5512
- font-size: 0.85rem;
5513
- padding: 0.6rem 0.5rem;
5514
- }
5515
- `;
5516
- var MobileTradeNav = o__namespace.forwardRef(
5517
- ({ className, items, activeId, onChange, ...props }, ref) => {
5518
- return /* @__PURE__ */ jsxRuntime.jsx(MobileToggleContainer, { ref, className: cn(className), ...props, children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
5519
- MobileToggleButton,
5520
- {
5521
- type: "button",
5522
- active: item.id === activeId,
5523
- onClick: () => onChange?.(item.id),
5524
- children: [
5525
- item.icon,
5526
- item.label
5527
- ]
5528
- },
5529
- item.id
5530
- )) });
5531
- }
5532
- );
5533
- MobileTradeNav.displayName = "MobileTradeNav";
5534
5653
 
5535
5654
  exports.Badge = Badge;
5536
5655
  exports.Button = Button;
@@ -5547,11 +5666,12 @@ exports.MobileTradeNav = MobileTradeNav;
5547
5666
  exports.Orderbook = Orderbook;
5548
5667
  exports.PortfolioSummary = PortfolioSummary;
5549
5668
  exports.PriceChart = PriceChart;
5550
- exports.PropertyCompareBar = PropertyCompareBar;
5551
5669
  exports.PropertyHeroHeader = PropertyHeroHeader;
5552
5670
  exports.PropertyNewsUpdates = PropertyNewsUpdates;
5553
5671
  exports.PropertySubheader = PropertySubheader;
5554
5672
  exports.PropertyTour = PropertyTour;
5673
+ exports.TradeConfirmationModal = TradeConfirmationModal;
5674
+ exports.TradingSlider = TradingSlider;
5555
5675
  exports.YourOrders = YourOrders;
5556
5676
  exports.badgeVariants = badgeVariants;
5557
5677
  exports.buttonVariants = buttonVariants;