@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.mjs CHANGED
@@ -146,7 +146,7 @@ var PortfolioSummary = o.forwardRef(
146
146
  onResetAccount,
147
147
  positionsHeading = "Current Positions",
148
148
  emptyPositionsText = "No positions yet. Start trading to build your portfolio!",
149
- formatCurrency: formatCurrency2 = defaultFormatCurrency,
149
+ formatCurrency: formatCurrency3 = defaultFormatCurrency,
150
150
  formatPercent: formatPercent2 = defaultFormatPercent,
151
151
  formatSignedCurrency = defaultFormatSignedCurrency,
152
152
  className,
@@ -184,11 +184,11 @@ var PortfolioSummary = o.forwardRef(
184
184
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
185
185
  /* @__PURE__ */ jsxs("div", { children: [
186
186
  /* @__PURE__ */ jsx("p", { className: "text-xs uppercase tracking-[0.5px] text-white/50", children: "Available Cash" }),
187
- /* @__PURE__ */ jsx("p", { className: "mt-1 text-[1.25rem] font-semibold text-white", children: formatCurrency2(availableCash) })
187
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-[1.25rem] font-semibold text-white", children: formatCurrency3(availableCash) })
188
188
  ] }),
189
189
  /* @__PURE__ */ jsxs("div", { children: [
190
190
  /* @__PURE__ */ jsx("p", { className: "text-xs uppercase tracking-[0.5px] text-white/50", children: "Portfolio Value" }),
191
- /* @__PURE__ */ jsx("p", { className: "mt-1 text-[1.25rem] font-semibold text-white", children: formatCurrency2(portfolioValue) })
191
+ /* @__PURE__ */ jsx("p", { className: "mt-1 text-[1.25rem] font-semibold text-white", children: formatCurrency3(portfolioValue) })
192
192
  ] }),
193
193
  /* @__PURE__ */ jsxs("div", { children: [
194
194
  /* @__PURE__ */ jsx("p", { className: "text-xs uppercase tracking-[0.5px] text-white/50", children: "Total Return" }),
@@ -3336,7 +3336,7 @@ function DesktopOrderbookLayout({
3336
3336
  /* @__PURE__ */ jsxs("div", { className: cn("text-lg font-semibold tabular-nums", midClass), children: [
3337
3337
  "$",
3338
3338
  formatNumber(midPrice, precision),
3339
- midChangePercent == null ? null : /* @__PURE__ */ jsxs("span", { className: "ml-2 text-sm font-semibold", children: [
3339
+ midChangePercent == null ? null : /* @__PURE__ */ jsxs("span", { className: cn("ml-2 text-sm font-semibold tabular-nums", midClass), children: [
3340
3340
  midChangePercent >= 0 ? "+" : "",
3341
3341
  midChangePercent.toFixed(2),
3342
3342
  "%"
@@ -3391,18 +3391,18 @@ function MobileOrderbookLayout({
3391
3391
  const visibleBids = o.useMemo(() => bids.slice(0, COMPACT_ROWS_VISIBLE), [bids]);
3392
3392
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3393
3393
  /* @__PURE__ */ jsx("div", { className: "px-3 pt-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
3394
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
3394
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
3395
3395
  /* @__PURE__ */ jsx(
3396
3396
  "span",
3397
3397
  {
3398
3398
  onClick: () => handleTab("orderbook"),
3399
3399
  style: {
3400
3400
  cursor: "pointer",
3401
- fontSize: "0.8rem",
3401
+ fontSize: "0.72rem",
3402
3402
  fontWeight: tab === "orderbook" ? 600 : 400,
3403
3403
  color: tab === "orderbook" ? "#fff" : "rgba(255,255,255,0.6)",
3404
3404
  borderBottom: tab === "orderbook" ? "2px solid #C9A227" : "none",
3405
- paddingBottom: "0.25rem"
3405
+ paddingBottom: "0.2rem"
3406
3406
  },
3407
3407
  children: "Orderbook"
3408
3408
  }
@@ -3413,11 +3413,11 @@ function MobileOrderbookLayout({
3413
3413
  onClick: () => handleTab("trades"),
3414
3414
  style: {
3415
3415
  cursor: "pointer",
3416
- fontSize: "0.8rem",
3416
+ fontSize: "0.72rem",
3417
3417
  fontWeight: tab === "trades" ? 600 : 400,
3418
3418
  color: tab === "trades" ? "#fff" : "rgba(255,255,255,0.6)",
3419
3419
  borderBottom: tab === "trades" ? "2px solid #C9A227" : "none",
3420
- paddingBottom: "0.25rem"
3420
+ paddingBottom: "0.2rem"
3421
3421
  },
3422
3422
  children: "Trades"
3423
3423
  }
@@ -3477,20 +3477,26 @@ function MobileOrderbookLayout({
3477
3477
  gridTemplateColumns: "1.2fr 0.8fr",
3478
3478
  padding: "0.3rem 0",
3479
3479
  fontSize: "0.8rem",
3480
- backgroundColor: "rgba(0, 123, 255, 0.05)",
3481
3480
  borderTop: "1px solid rgba(255,255,255,0.1)",
3482
3481
  borderBottom: "1px solid rgba(255,255,255,0.1)"
3483
3482
  },
3484
3483
  children: [
3485
- /* @__PURE__ */ jsxs("div", { style: { fontWeight: "bold", display: "flex", alignItems: "center", gap: "8px" }, className: midClass, children: [
3486
- "$",
3487
- formatNumber(midPrice, precision),
3488
- midChangePercent != null && /* @__PURE__ */ jsxs("span", { style: { fontSize: "0.8rem" }, className: midClass, children: [
3489
- midChangePercent >= 0 ? "+" : "",
3490
- midChangePercent.toFixed(2),
3491
- "%"
3492
- ] })
3493
- ] }),
3484
+ /* @__PURE__ */ jsxs(
3485
+ "div",
3486
+ {
3487
+ style: { fontWeight: "bold", display: "flex", alignItems: "center", gap: "8px" },
3488
+ className: midClass,
3489
+ children: [
3490
+ "$",
3491
+ formatNumber(midPrice, precision),
3492
+ midChangePercent != null && /* @__PURE__ */ jsxs("span", { className: cn("text-[0.75rem] font-semibold tabular-nums", midClass), children: [
3493
+ midChangePercent >= 0 ? "+" : "",
3494
+ midChangePercent.toFixed(2),
3495
+ "%"
3496
+ ] })
3497
+ ]
3498
+ }
3499
+ ),
3494
3500
  /* @__PURE__ */ jsx("div", {})
3495
3501
  ]
3496
3502
  }
@@ -3888,393 +3894,447 @@ var PropertyNewsUpdates = o.forwardRef(
3888
3894
  }
3889
3895
  );
3890
3896
  PropertyNewsUpdates.displayName = "PropertyNewsUpdates";
3891
- var PropertyCompareBar = o.forwardRef(
3897
+ var defaultFormat = (value) => new Intl.NumberFormat("en-US", {
3898
+ style: "currency",
3899
+ currency: "USD",
3900
+ notation: value >= 1e5 ? "compact" : "standard",
3901
+ maximumFractionDigits: value >= 1e3 ? 0 : 2
3902
+ }).format(value);
3903
+ var TradingSlider = o.forwardRef(
3892
3904
  ({
3905
+ label = "Trade size",
3906
+ helperText = "Drag to pick the desired notional.",
3907
+ min = 0,
3908
+ max = 1e5,
3909
+ step = 1e3,
3910
+ minLabel,
3911
+ maxLabel,
3912
+ formatValue = defaultFormat,
3913
+ accentColor = "#14b8a6",
3914
+ value,
3915
+ defaultValue,
3916
+ onValueChange,
3893
3917
  className,
3894
- addresses,
3895
- selectedAddressId,
3896
- onSelectAddress,
3897
- propertyValue,
3898
- propertyValueVariant = "classic",
3899
- price,
3900
- ...props
3918
+ ...rest
3901
3919
  }, ref) => {
3902
- const normalizedAddresses = o.useMemo(() => {
3903
- return addresses.map(
3904
- (option) => typeof option === "string" ? { id: option, label: option } : option
3905
- );
3906
- }, [addresses]);
3907
- const hasAddresses = normalizedAddresses.length > 0;
3908
- const firstAddressId = normalizedAddresses[0]?.id;
3909
- const isControlled = selectedAddressId !== void 0;
3910
- const [internalSelectedId, setInternalSelectedId] = o.useState(
3911
- () => isControlled ? void 0 : firstAddressId
3920
+ const isControlled = value !== void 0;
3921
+ const [internalValue, setInternalValue] = o.useState(
3922
+ defaultValue ?? (typeof min === "number" ? min : 0)
3912
3923
  );
3913
- const resolvedSelectedId = isControlled ? selectedAddressId : internalSelectedId;
3914
- o.useEffect(() => {
3924
+ const currentValue = isControlled ? Number(value) : internalValue;
3925
+ const parsedMin = Number(min ?? 0);
3926
+ const parsedMax = Number(max ?? 100);
3927
+ const percent = (currentValue - parsedMin) / (parsedMax - parsedMin || 1) * 100;
3928
+ const handleChange = (event) => {
3929
+ const next2 = Number(event.target.value);
3915
3930
  if (!isControlled) {
3916
- setInternalSelectedId((current) => {
3917
- if (current != null && normalizedAddresses.some((option) => option.id === current)) {
3918
- return current;
3919
- }
3920
- return firstAddressId;
3921
- });
3931
+ setInternalValue(next2);
3922
3932
  }
3923
- }, [firstAddressId, isControlled, normalizedAddresses]);
3924
- const selectedOption = normalizedAddresses.find((option) => option.id === resolvedSelectedId) ?? normalizedAddresses[0];
3925
- const [isDropdownOpen, setIsDropdownOpen] = o.useState(false);
3926
- const dropdownRef = o.useRef(null);
3927
- o.useEffect(() => {
3928
- if (!isDropdownOpen) return;
3929
- const handleClick = (event) => {
3930
- if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
3931
- setIsDropdownOpen(false);
3932
- }
3933
- };
3934
- const handleKey = (event) => {
3935
- if (event.key === "Escape") {
3936
- setIsDropdownOpen(false);
3937
- }
3938
- };
3939
- document.addEventListener("mousedown", handleClick);
3940
- document.addEventListener("keydown", handleKey);
3941
- return () => {
3942
- document.removeEventListener("mousedown", handleClick);
3943
- document.removeEventListener("keydown", handleKey);
3944
- };
3945
- }, [isDropdownOpen]);
3946
- const handleAddressSelect = (addressId) => {
3947
- if (!isControlled) {
3948
- setInternalSelectedId(addressId);
3949
- }
3950
- onSelectAddress?.(addressId);
3951
- setIsDropdownOpen(false);
3952
- };
3953
- const propertyValueLabel = propertyValue?.label ?? "Property Value";
3954
- const propertyValueCurrency = propertyValue?.currencySymbol ?? "$";
3955
- const propertyValueFormat = propertyValue?.formatOptions ?? {
3956
- minimumFractionDigits: 2,
3957
- maximumFractionDigits: 2
3933
+ onValueChange?.(next2, event);
3958
3934
  };
3959
- const formattedPropertyValue = propertyValue == null ? null : `${propertyValueCurrency}${propertyValue.value.toLocaleString(
3960
- void 0,
3961
- propertyValueFormat
3962
- )}`;
3963
- const formattedPropertyChange = propertyValue?.change == null ? null : `${propertyValue.change >= 0 ? "+" : "-"}${propertyValueCurrency}${Math.abs(
3964
- propertyValue.change
3965
- ).toLocaleString(void 0, propertyValueFormat)}`;
3966
- const priceCurrency = price?.currencySymbol ?? "$";
3967
- const priceFormat = price?.formatOptions ?? { minimumFractionDigits: 2, maximumFractionDigits: 2 };
3968
- const pricePercentFormat = price?.percentFormatOptions ?? { minimumFractionDigits: 2, maximumFractionDigits: 2 };
3969
- const formattedPriceValue = price == null ? null : `${priceCurrency}${price.value.toLocaleString(void 0, priceFormat)}`;
3970
- const formattedPriceChange = price?.change == null ? null : `${price.change >= 0 ? "+" : "-"}${priceCurrency}${Math.abs(price.change).toLocaleString(
3971
- void 0,
3972
- priceFormat
3973
- )}`;
3974
- const formattedPricePercent = price?.changePercent == null ? null : `${price.changePercent >= 0 ? "+" : "-"}${Math.abs(price.changePercent).toLocaleString(
3975
- void 0,
3976
- pricePercentFormat
3977
- )}%`;
3978
- const priceContent = formattedPriceValue && propertyValueVariant === "pill" ? /* @__PURE__ */ jsxs(PriceBlock, { $variant: propertyValueVariant, children: [
3979
- /* @__PURE__ */ jsx(PriceAmount, { children: formattedPriceValue }),
3980
- formattedPriceChange || formattedPricePercent ? /* @__PURE__ */ jsxs(
3981
- PriceChange,
3982
- {
3983
- $isPositive: price?.change != null ? price.change >= 0 : price?.changePercent != null ? price.changePercent >= 0 : void 0,
3984
- children: [
3985
- formattedPriceChange ? /* @__PURE__ */ jsx("span", { children: formattedPriceChange }) : null,
3986
- formattedPricePercent ? /* @__PURE__ */ jsx("span", { children: formattedPricePercent }) : null
3987
- ]
3988
- }
3989
- ) : null
3990
- ] }) : null;
3991
- const propertyValueContent = formattedPropertyValue ? /* @__PURE__ */ jsxs(PropertyValueBlock, { $variant: propertyValueVariant, children: [
3992
- /* @__PURE__ */ jsx(PropertyValueLabel, { children: propertyValueLabel }),
3993
- /* @__PURE__ */ jsx(PropertyValueAmount, { children: formattedPropertyValue }),
3994
- formattedPropertyChange ? /* @__PURE__ */ jsx(PropertyValueChange, { $isPositive: propertyValue?.change != null ? propertyValue.change >= 0 : void 0, children: formattedPropertyChange }) : null
3995
- ] }) : null;
3996
- return /* @__PURE__ */ jsxs(PropertySelectorContainer, { ref, className, $variant: propertyValueVariant, ...props, children: [
3997
- /* @__PURE__ */ jsxs(PropertySelector, { ref: dropdownRef, onClick: () => hasAddresses && setIsDropdownOpen((prev2) => !prev2), children: [
3998
- /* @__PURE__ */ jsxs(PropertyAddress, { children: [
3999
- selectedOption ? selectedOption.label : hasAddresses ? "Select address" : "No addresses available",
3935
+ return /* @__PURE__ */ jsxs("div", { className: cn("rounded-3xl border border-slate-200 bg-white p-6 shadow-sm", className), children: [
3936
+ /* @__PURE__ */ jsxs("div", { className: "flex items-end justify-between gap-4", children: [
3937
+ /* @__PURE__ */ jsxs("div", { children: [
3938
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium uppercase tracking-wide text-slate-500", children: label }),
3939
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-500", children: helperText })
3940
+ ] }),
3941
+ /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
3942
+ /* @__PURE__ */ jsx("p", { className: "text-xs uppercase tracking-wide text-slate-500", children: "Selected" }),
3943
+ /* @__PURE__ */ jsx("p", { className: "text-2xl font-semibold text-slate-900", children: formatValue(currentValue) })
3944
+ ] })
3945
+ ] }),
3946
+ /* @__PURE__ */ jsxs("div", { className: "mt-6 space-y-3", children: [
3947
+ /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3948
+ /* @__PURE__ */ jsx(
3949
+ "input",
3950
+ {
3951
+ type: "range",
3952
+ min: parsedMin,
3953
+ max: parsedMax,
3954
+ step,
3955
+ value: currentValue,
3956
+ onChange: handleChange,
3957
+ ref,
3958
+ className: "h-3 w-full appearance-none rounded-full bg-slate-200 accent-teal-500",
3959
+ style: {
3960
+ background: `linear-gradient(90deg, ${accentColor} ${percent}%, #e2e8f0 ${percent}%)`
3961
+ },
3962
+ ...rest
3963
+ }
3964
+ ),
4000
3965
  /* @__PURE__ */ jsx(
4001
- "svg",
3966
+ "div",
4002
3967
  {
4003
- className: "dropdown-icon",
4004
- xmlns: "http://www.w3.org/2000/svg",
4005
- width: "20",
4006
- height: "20",
4007
- viewBox: "0 0 24 24",
4008
- fill: "currentColor",
4009
- style: { transform: isDropdownOpen ? "rotate(180deg)" : void 0 },
4010
- children: /* @__PURE__ */ jsx("path", { d: "M7 10l5 5 5-5H7z" })
3968
+ 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",
3969
+ style: { right: `calc(${100 - percent}% - 12px)` },
3970
+ children: formatValue(currentValue)
4011
3971
  }
4012
3972
  )
4013
3973
  ] }),
4014
- /* @__PURE__ */ jsx(PropertySelectorDropdown, { $isOpen: isDropdownOpen && hasAddresses, children: normalizedAddresses.map((option) => /* @__PURE__ */ jsx(
4015
- PropertySelectorOption,
4016
- {
4017
- onClick: (event) => {
4018
- event.stopPropagation();
4019
- handleAddressSelect(option.id);
4020
- },
4021
- children: /* @__PURE__ */ jsx(PropertySelectorName, { children: option.label })
4022
- },
4023
- option.id
4024
- )) })
4025
- ] }),
4026
- propertyValueVariant === "pill" ? /* @__PURE__ */ jsxs(Fragment, { children: [
4027
- priceContent,
4028
- propertyValueContent
4029
- ] }) : propertyValueContent
3974
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-xs font-semibold text-slate-500", children: [
3975
+ /* @__PURE__ */ jsx("span", { children: minLabel ?? formatValue(parsedMin) }),
3976
+ /* @__PURE__ */ jsx("span", { children: maxLabel ?? formatValue(parsedMax) })
3977
+ ] })
3978
+ ] })
4030
3979
  ] });
4031
3980
  }
4032
3981
  );
4033
- PropertyCompareBar.displayName = "PropertyCompareBar";
4034
- var PropertySelectorContainer = at.div`
4035
- display: flex;
4036
- align-items: center;
4037
- justify-content: space-between;
4038
- padding: 1rem 1.5rem;
4039
- background-color: ${({ $variant }) => $variant === "pill" ? "#0f0f0f" : "rgba(30, 32, 38, 0.95)"};
4040
- border: ${({ $variant }) => $variant === "pill" ? "1px solid rgba(255, 255, 255, 0.15)" : "none"};
4041
- border-radius: 8px;
4042
- margin-bottom: 1.5rem;
4043
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
4044
- color: var(--color-text, #f8f9fa);
4045
- font-family: var(--font-family, "Inter", sans-serif);
4046
-
3982
+ TradingSlider.displayName = "TradingSlider";
3983
+ var MobileToggleContainer = at.div`
3984
+ display: none;
3985
+
4047
3986
  @media (max-width: 1024px) {
3987
+ display: flex;
3988
+ gap: 0.5rem;
3989
+ position: fixed;
3990
+ bottom: 0;
3991
+ left: 0;
3992
+ right: 0;
3993
+ background-color: var(--color-card-darker, #111);
4048
3994
  padding: 0.75rem 1rem;
4049
- margin-bottom: 0.75rem;
4050
- }
4051
-
4052
- @media (max-width: 768px) {
4053
- border-radius: 0;
4054
- margin-top: 0;
4055
- padding-top: 0.5rem;
4056
- }
4057
-
4058
- @media (max-width: 600px) {
4059
- width: 100%;
4060
-
4061
- ${({ $variant }) => $variant === "pill" ? rt`
4062
- display: grid;
4063
- grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 1fr);
4064
- gap: 0.35rem;
4065
- align-items: center;
4066
-
4067
- > *:nth-child(1) {
4068
- width: 100%;
4069
- }
4070
-
4071
- > *:nth-child(2) {
4072
- justify-self: center;
4073
- width: 100%;
4074
- }
4075
-
4076
- > *:nth-child(3) {
4077
- justify-self: end;
4078
- text-align: right;
4079
- }
4080
- ` : rt`
4081
- flex-direction: row;
4082
- align-items: center;
4083
- justify-content: space-between;
4084
- gap: 0.5rem;
4085
- `};
3995
+ padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
3996
+ border-top: 1px solid var(--color-border);
3997
+ z-index: 100;
3998
+ box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
4086
3999
  }
4087
4000
  `;
4088
- var PropertySelector = at.div`
4089
- position: relative;
4090
- display: flex;
4091
- align-items: center;
4092
- cursor: pointer;
4093
- padding: 0.5rem 0;
4001
+ var MobileToggleButton = at.button`
4094
4002
  flex: 1;
4095
-
4096
- &:hover {
4097
- .dropdown-icon {
4098
- transform: translateY(2px);
4099
- }
4100
- }
4101
- `;
4102
- var PropertyAddress = at.div`
4103
- font-size: 1.125rem;
4003
+ padding: 0.75rem;
4004
+ background-color: ${(props) => props.active ? "var(--color-accent)" : "transparent"};
4005
+ color: ${(props) => props.active ? "#000" : "var(--color-text-secondary)"};
4006
+ border: ${(props) => props.active ? "1px solid var(--color-accent)" : "1px solid rgba(255, 255, 255, 0.2)"};
4007
+ border-radius: 6px;
4008
+ font-size: 0.9rem;
4104
4009
  font-weight: 600;
4105
- display: flex;
4106
- align-items: center;
4107
- gap: 0.5rem;
4108
- color: inherit;
4109
-
4110
- svg {
4111
- transition: transform 0.2s;
4112
- }
4113
-
4114
- @media (max-width: 600px) {
4115
- flex-direction: column;
4116
- align-items: flex-start;
4117
- gap: 0.2rem;
4118
- font-size: 1rem;
4119
- line-height: 1.2;
4120
- white-space: normal;
4121
- }
4122
- `;
4123
- var PropertySelectorDropdown = at.div`
4124
- position: absolute;
4125
- top: 100%;
4126
- left: 0;
4127
- width: 100%;
4128
- max-width: 400px;
4129
- background-color: var(--color-card, #1f232b);
4130
- border-radius: 8px;
4131
- box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
4132
- z-index: 100;
4133
- overflow: hidden;
4134
- display: ${(props) => props.$isOpen ? "block" : "none"};
4135
- `;
4136
- var PropertySelectorOption = at.div`
4137
- padding: 0.75rem 1rem;
4138
- border-bottom: 1px solid rgba(255, 255, 255, 0.1);
4139
4010
  cursor: pointer;
4140
- transition: background-color 0.2s;
4141
-
4011
+ transition: all 0.2s ease;
4012
+ white-space: nowrap;
4013
+
4142
4014
  &:hover {
4143
- background-color: rgba(255, 255, 255, 0.05);
4144
- }
4145
-
4146
- &:last-child {
4147
- border-bottom: none;
4015
+ background-color: ${(props) => props.active ? "var(--color-accent-hover)" : "rgba(255, 255, 255, 0.05)"};
4016
+ border-color: ${(props) => props.active ? "var(--color-accent)" : "rgba(255, 255, 255, 0.3)"};
4148
4017
  }
4149
- `;
4150
- var PropertySelectorName = at.div`
4151
- font-weight: 600;
4152
- `;
4153
- var PropertyValueBlock = at.div`
4154
- display: flex;
4155
- align-items: center;
4156
- gap: 0.5rem;
4157
- margin-left: 1rem;
4158
- white-space: nowrap;
4159
-
4160
- ${({ $variant }) => $variant === "card" && rt`
4161
- margin-left: auto;
4162
- flex-direction: row;
4163
- align-items: center;
4164
- min-width: 220px;
4165
- border: none;
4166
- background: rgba(30, 32, 38, 0.95);
4167
- border-radius: 14px;
4168
- padding: 0.9rem 1.25rem;
4169
- box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
4170
- gap: 0.85rem;
4171
- justify-content: flex-end;
4172
-
4173
- @media (max-width: 600px) {
4174
- margin: 0;
4175
- width: auto;
4176
- min-width: 0;
4177
- flex-direction: column;
4178
- align-items: flex-end;
4179
- gap: 0.125rem;
4180
- padding: 0;
4181
- background: transparent;
4182
- border-radius: 0;
4183
- box-shadow: none;
4184
- }
4185
- `}
4186
-
4187
- ${({ $variant }) => $variant === "pill" && rt`
4188
- margin-left: auto;
4189
- margin-right: 1rem;
4190
- background: #191919;
4191
- border-radius: 8px;
4192
- border: 1px solid rgba(255, 255, 255, 0.05);
4193
- padding: 0.5rem 1rem;
4194
- gap: 1rem;
4195
- align-items: center;
4196
-
4197
- @media (max-width: 600px) {
4198
- margin: 0;
4199
- width: 100%;
4200
- min-width: 0;
4201
- flex-direction: column;
4202
- align-items: flex-end;
4203
- text-align: right;
4204
- gap: 0.2rem;
4205
- padding: 0;
4206
- background: transparent;
4207
- border-radius: 0;
4208
- border: none;
4209
- white-space: normal;
4210
- }
4211
- `}
4212
-
4213
- @media (max-width: 600px) {
4214
- margin: 0;
4215
- flex-direction: column;
4216
- align-items: flex-end;
4217
- gap: 0.2rem;
4218
- white-space: normal;
4018
+
4019
+ @media (max-width: 480px) {
4020
+ font-size: 0.85rem;
4021
+ padding: 0.6rem 0.5rem;
4219
4022
  }
4220
4023
  `;
4221
- var PropertyValueLabel = at.span`
4222
- font-size: 0.7rem;
4223
- color: var(--color-text-secondary, rgba(255, 255, 255, 0.6));
4224
- text-transform: uppercase;
4225
- letter-spacing: 0.5px;
4226
-
4227
- @media (max-width: 600px) {
4228
- font-size: 0.6rem;
4229
- letter-spacing: 0.4px;
4024
+ var MobileTradeNav = o.forwardRef(
4025
+ ({ className, items, activeId, onChange, ...props }, ref) => {
4026
+ return /* @__PURE__ */ jsx(MobileToggleContainer, { ref, className: cn(className), ...props, children: items.map((item) => /* @__PURE__ */ jsxs(
4027
+ MobileToggleButton,
4028
+ {
4029
+ type: "button",
4030
+ active: item.id === activeId,
4031
+ onClick: () => onChange?.(item.id),
4032
+ children: [
4033
+ item.icon,
4034
+ item.label
4035
+ ]
4036
+ },
4037
+ item.id
4038
+ )) });
4230
4039
  }
4231
- `;
4232
- var PropertyValueAmount = at.span`
4233
- font-size: 1.1rem;
4234
- font-weight: 600;
4235
- color: #fff;
4236
-
4237
- @media (max-width: 600px) {
4238
- font-size: 0.95rem;
4040
+ );
4041
+ MobileTradeNav.displayName = "MobileTradeNav";
4042
+ function formatPrice(value) {
4043
+ if (value == null || Number.isNaN(value)) {
4044
+ return "0.00";
4239
4045
  }
4240
- `;
4241
- var PropertyValueChange = at.span`
4242
- font-size: 0.75rem;
4243
- font-weight: 500;
4244
- 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)"};
4245
-
4246
- @media (max-width: 600px) {
4247
- font-size: 0.65rem;
4046
+ return value.toLocaleString(void 0, {
4047
+ minimumFractionDigits: 2,
4048
+ maximumFractionDigits: 2
4049
+ });
4050
+ }
4051
+ function formatQuantity(value) {
4052
+ if (value == null || Number.isNaN(value)) {
4053
+ return "0";
4248
4054
  }
4249
- `;
4250
- var PriceBlock = at.div`
4251
- display: none;
4252
-
4253
- ${({ $variant }) => $variant === "pill" && rt`
4254
- @media (max-width: 600px) {
4255
- display: flex;
4256
- flex: none;
4257
- flex-direction: column;
4258
- align-items: center;
4259
- justify-content: center;
4260
- gap: 0.15rem;
4261
- width: 100%;
4262
- }
4263
- `}
4264
- `;
4265
- var PriceAmount = at.span`
4266
- font-size: 1.6rem;
4267
- font-weight: 600;
4268
- color: #fff;
4269
- letter-spacing: 0.2px;
4270
- `;
4271
- var PriceChange = at.span`
4272
- font-size: 0.85rem;
4273
- font-weight: 500;
4274
- display: inline-flex;
4275
- gap: 0.35rem;
4276
- 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)"};
4277
- `;
4055
+ return value.toLocaleString(void 0, {
4056
+ minimumFractionDigits: 0,
4057
+ maximumFractionDigits: 0
4058
+ });
4059
+ }
4060
+ function formatCurrency(value) {
4061
+ if (value == null || Number.isNaN(value)) return "\u2014";
4062
+ return `$${value.toLocaleString(void 0, {
4063
+ minimumFractionDigits: 2,
4064
+ maximumFractionDigits: 2
4065
+ })}`;
4066
+ }
4067
+ var overlayStyle = {
4068
+ position: "fixed",
4069
+ top: 0,
4070
+ left: 0,
4071
+ right: 0,
4072
+ bottom: 0,
4073
+ backgroundColor: "rgba(0, 0, 0, 0.7)",
4074
+ display: "flex",
4075
+ alignItems: "center",
4076
+ justifyContent: "center",
4077
+ zIndex: 1e4,
4078
+ backdropFilter: "blur(4px)",
4079
+ padding: "1rem"
4080
+ };
4081
+ var modalBaseStyle = {
4082
+ background: "linear-gradient(135deg, rgba(26, 29, 35, 0.95) 0%, rgba(26, 29, 35, 0.98) 100%)",
4083
+ border: "1px solid rgba(255, 255, 255, 0.1)",
4084
+ borderRadius: "16px",
4085
+ padding: "2rem",
4086
+ width: "100%",
4087
+ maxWidth: "480px",
4088
+ boxShadow: "0 20px 60px rgba(0, 0, 0, 0.5)",
4089
+ color: "#fff"
4090
+ };
4091
+ var headerStyle = {
4092
+ display: "flex",
4093
+ alignItems: "center",
4094
+ justifyContent: "space-between",
4095
+ marginBottom: "1.5rem",
4096
+ paddingBottom: "1rem",
4097
+ borderBottom: "1px solid rgba(255, 255, 255, 0.1)"
4098
+ };
4099
+ var titleStyle = {
4100
+ margin: 0,
4101
+ fontSize: "1.25rem",
4102
+ fontWeight: 600,
4103
+ display: "flex",
4104
+ alignItems: "center",
4105
+ gap: "0.5rem"
4106
+ };
4107
+ var badgeBaseStyle = {
4108
+ display: "inline-block",
4109
+ padding: "0.25rem 0.75rem",
4110
+ borderRadius: "6px",
4111
+ fontSize: "0.75rem",
4112
+ fontWeight: 600,
4113
+ textTransform: "uppercase",
4114
+ letterSpacing: "0.5px"
4115
+ };
4116
+ var detailRowBase = {
4117
+ display: "flex",
4118
+ justifyContent: "space-between",
4119
+ alignItems: "center",
4120
+ padding: "0.75rem 0",
4121
+ borderBottom: "1px solid rgba(255, 255, 255, 0.08)"
4122
+ };
4123
+ var detailLabelStyle = {
4124
+ color: "rgba(255, 255, 255, 0.6)",
4125
+ fontSize: "0.9rem"
4126
+ };
4127
+ var detailValueStyle = {
4128
+ color: "#fff",
4129
+ fontWeight: 500,
4130
+ fontSize: "0.95rem"
4131
+ };
4132
+ var summaryBoxStyle = {
4133
+ background: "rgba(255, 255, 255, 0.03)",
4134
+ border: "1px solid rgba(255, 255, 255, 0.08)",
4135
+ borderRadius: "8px",
4136
+ padding: "1rem",
4137
+ marginBottom: "1.5rem"
4138
+ };
4139
+ var summaryTextStyle = {
4140
+ margin: 0,
4141
+ color: "rgba(255, 255, 255, 0.8)",
4142
+ fontSize: "0.9rem",
4143
+ lineHeight: 1.5
4144
+ };
4145
+ var rememberChoiceRowStyle = {
4146
+ display: "flex",
4147
+ alignItems: "center",
4148
+ gap: "0.5rem",
4149
+ marginBottom: "1.25rem",
4150
+ color: "rgba(255, 255, 255, 0.8)",
4151
+ fontSize: "0.85rem"
4152
+ };
4153
+ var rememberChoiceCheckboxBoxStyle = {
4154
+ width: "18px",
4155
+ height: "18px",
4156
+ borderRadius: "4px",
4157
+ border: "1px solid rgba(255, 255, 255, 0.4)",
4158
+ display: "inline-flex",
4159
+ alignItems: "center",
4160
+ justifyContent: "center",
4161
+ fontSize: "0.85rem",
4162
+ fontWeight: 700,
4163
+ transition: "all 0.2s ease",
4164
+ lineHeight: 1
4165
+ };
4166
+ var rememberChoiceHiddenInputStyle = {
4167
+ position: "absolute",
4168
+ opacity: 0,
4169
+ pointerEvents: "none",
4170
+ width: 0,
4171
+ height: 0
4172
+ };
4173
+ var buttonGroupStyle = {
4174
+ display: "flex",
4175
+ gap: "1rem",
4176
+ justifyContent: "flex-end"
4177
+ };
4178
+ var buttonBaseStyle = {
4179
+ padding: "0.75rem 1.5rem",
4180
+ borderRadius: "8px",
4181
+ fontWeight: 600,
4182
+ fontSize: "0.95rem",
4183
+ cursor: "pointer",
4184
+ transition: "all 0.2s ease",
4185
+ border: "none"
4186
+ };
4187
+ function TradeConfirmationModal({
4188
+ isOpen,
4189
+ onClose,
4190
+ onConfirm,
4191
+ orderDetails,
4192
+ className,
4193
+ estimatedFeeUsd: _estimatedFeeUsd,
4194
+ estimatedFeeBps: _estimatedFeeBps,
4195
+ totalWithFeesUsd,
4196
+ confirmDisabled,
4197
+ confirmLoading,
4198
+ rememberChoiceChecked = false,
4199
+ rememberChoiceLabel = "Remember this choice and auto-confirm next time",
4200
+ onRememberChoiceChange
4201
+ }) {
4202
+ if (!isOpen || !orderDetails) return null;
4203
+ const { type, orderType, quantity, price, totalValue, tokenSymbol, willExecuteImmediately } = orderDetails;
4204
+ const isBuy = type === "buy";
4205
+ const isLimit = orderType === "limit";
4206
+ const netLabel = `Est. Total ${isBuy ? "Cost" : "Proceeds"}`;
4207
+ const grossFallback = totalValue != null ? `$${formatPrice(totalValue)}` : "\u2014";
4208
+ const netValue = totalWithFeesUsd != null ? formatCurrency(totalWithFeesUsd) : grossFallback;
4209
+ const detailRows = [
4210
+ { label: "Order Type", value: isLimit ? "Limit Order" : "Market Order" },
4211
+ { label: "Token", value: tokenSymbol },
4212
+ { label: "Quantity", value: `${formatQuantity(quantity)} tokens`, highlight: true },
4213
+ { label: "Price", value: isLimit ? `$${formatPrice(price)}` : "Market" }
4214
+ ];
4215
+ detailRows.push({ label: netLabel, value: netValue, highlight: true });
4216
+ const accentColor = isBuy ? "#0ecb81" : "#f6465d";
4217
+ const badgeStyle = {
4218
+ ...badgeBaseStyle,
4219
+ color: accentColor,
4220
+ border: `1px solid ${isBuy ? "rgba(14, 203, 129, 0.3)" : "rgba(246, 70, 93, 0.3)"}`,
4221
+ 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%)"
4222
+ };
4223
+ const cancelButtonStyle = {
4224
+ ...buttonBaseStyle,
4225
+ background: "rgba(255, 255, 255, 0.1)",
4226
+ color: "rgba(255, 255, 255, 0.8)",
4227
+ border: "1px solid rgba(255, 255, 255, 0.2)"
4228
+ };
4229
+ const confirmButtonStyle = {
4230
+ ...buttonBaseStyle,
4231
+ color: "#fff",
4232
+ background: isBuy ? "linear-gradient(135deg, #0ecb81 0%, #0ba968 100%)" : "linear-gradient(135deg, #f6465d 0%, #d93850 100%)",
4233
+ boxShadow: isBuy ? "0 4px 12px rgba(14, 203, 129, 0.3)" : "0 4px 12px rgba(246, 70, 93, 0.3)",
4234
+ opacity: confirmDisabled || confirmLoading ? 0.6 : 1,
4235
+ cursor: confirmDisabled || confirmLoading ? "not-allowed" : "pointer"
4236
+ };
4237
+ const showRememberChoice = typeof onRememberChoiceChange === "function";
4238
+ return /* @__PURE__ */ jsx("div", { style: overlayStyle, onClick: onClose, role: "dialog", "aria-modal": "true", children: /* @__PURE__ */ jsxs("div", { style: modalBaseStyle, className, onClick: (event) => event.stopPropagation(), children: [
4239
+ /* @__PURE__ */ jsx("header", { style: headerStyle, children: /* @__PURE__ */ jsxs("h3", { style: titleStyle, children: [
4240
+ "Confirm Order",
4241
+ /* @__PURE__ */ jsx("span", { style: badgeStyle, children: isBuy ? "BUY" : "SELL" })
4242
+ ] }) }),
4243
+ /* @__PURE__ */ jsx("div", { style: { marginBottom: "1.5rem" }, children: detailRows.map((row, index) => /* @__PURE__ */ jsxs(
4244
+ "div",
4245
+ {
4246
+ style: {
4247
+ ...detailRowBase,
4248
+ borderBottom: index === detailRows.length - 1 ? "none" : detailRowBase.borderBottom
4249
+ },
4250
+ children: [
4251
+ /* @__PURE__ */ jsx("span", { style: detailLabelStyle, children: row.label }),
4252
+ /* @__PURE__ */ jsx(
4253
+ "span",
4254
+ {
4255
+ style: {
4256
+ ...detailValueStyle,
4257
+ color: row.highlight ? accentColor : detailValueStyle.color,
4258
+ fontWeight: row.highlight ? 600 : detailValueStyle.fontWeight
4259
+ },
4260
+ children: row.value
4261
+ }
4262
+ )
4263
+ ]
4264
+ },
4265
+ `${row.label}-${index}`
4266
+ )) }),
4267
+ /* @__PURE__ */ jsx("section", { style: summaryBoxStyle, children: /* @__PURE__ */ jsx("p", { style: summaryTextStyle, children: isLimit ? willExecuteImmediately ? /* @__PURE__ */ jsxs(Fragment, { children: [
4268
+ "Your limit ",
4269
+ isBuy ? "buy" : "sell",
4270
+ " order will ",
4271
+ /* @__PURE__ */ jsx("strong", { style: { color: "#fff" }, children: "execute immediately" }),
4272
+ " at market price because your limit price of ",
4273
+ /* @__PURE__ */ jsxs("strong", { style: { color: "#fff" }, children: [
4274
+ "$",
4275
+ formatPrice(price)
4276
+ ] }),
4277
+ " is",
4278
+ isBuy ? " above" : " below",
4279
+ " the current market."
4280
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
4281
+ "Your limit ",
4282
+ isBuy ? "buy" : "sell",
4283
+ " order for",
4284
+ " ",
4285
+ /* @__PURE__ */ jsxs("strong", { style: { color: "#fff" }, children: [
4286
+ formatQuantity(quantity),
4287
+ " tokens"
4288
+ ] }),
4289
+ " at",
4290
+ " ",
4291
+ /* @__PURE__ */ jsxs("strong", { style: { color: "#fff" }, children: [
4292
+ "$",
4293
+ formatPrice(price)
4294
+ ] }),
4295
+ " will be placed."
4296
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
4297
+ "Your market ",
4298
+ isBuy ? "buy" : "sell",
4299
+ " order for",
4300
+ " ",
4301
+ /* @__PURE__ */ jsxs("strong", { style: { color: "#fff" }, children: [
4302
+ formatQuantity(quantity),
4303
+ " tokens"
4304
+ ] }),
4305
+ " will execute immediately at the best available market price."
4306
+ ] }) }) }),
4307
+ showRememberChoice ? /* @__PURE__ */ jsxs("label", { style: { ...rememberChoiceRowStyle, position: "relative" }, children: [
4308
+ /* @__PURE__ */ jsx(
4309
+ "input",
4310
+ {
4311
+ type: "checkbox",
4312
+ checked: rememberChoiceChecked,
4313
+ onChange: (event) => onRememberChoiceChange?.(event.target.checked),
4314
+ style: rememberChoiceHiddenInputStyle
4315
+ }
4316
+ ),
4317
+ /* @__PURE__ */ jsx(
4318
+ "span",
4319
+ {
4320
+ "aria-hidden": "true",
4321
+ style: {
4322
+ ...rememberChoiceCheckboxBoxStyle,
4323
+ borderColor: rememberChoiceChecked ? accentColor : rememberChoiceCheckboxBoxStyle.border,
4324
+ background: rememberChoiceChecked ? `linear-gradient(135deg, ${accentColor}33, ${accentColor}22)` : "transparent",
4325
+ color: rememberChoiceChecked ? accentColor : "transparent"
4326
+ },
4327
+ children: "\u2713"
4328
+ }
4329
+ ),
4330
+ /* @__PURE__ */ jsx("span", { children: rememberChoiceLabel })
4331
+ ] }) : null,
4332
+ /* @__PURE__ */ jsxs("div", { style: buttonGroupStyle, children: [
4333
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: onClose, style: cancelButtonStyle, children: "Cancel" }),
4334
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: confirmDisabled ? void 0 : onConfirm, disabled: confirmDisabled || confirmLoading, style: confirmButtonStyle, children: confirmLoading ? "Submitting\u2026" : `Confirm ${isBuy ? "Buy" : "Sell"}` })
4335
+ ] })
4336
+ ] }) });
4337
+ }
4278
4338
  var DEFAULT_TABS = [
4279
4339
  { id: "portfolio", label: "Portfolio" },
4280
4340
  { id: "openOrders", label: "Open Orders" },
@@ -4290,10 +4350,10 @@ var panelStyle = {
4290
4350
  display: "flex",
4291
4351
  flexDirection: "column"
4292
4352
  };
4293
- var headerStyle = {
4353
+ var headerStyle2 = {
4294
4354
  padding: "1.25rem 1.5rem 0.5rem"
4295
4355
  };
4296
- var titleStyle = {
4356
+ var titleStyle2 = {
4297
4357
  margin: 0,
4298
4358
  fontSize: "1.1rem",
4299
4359
  fontWeight: 600
@@ -4322,6 +4382,30 @@ var tabContentWrapper = {
4322
4382
  gap: "0.75rem",
4323
4383
  flex: 1
4324
4384
  };
4385
+ var paginationContainerStyle = {
4386
+ display: "flex",
4387
+ justifyContent: "space-between",
4388
+ alignItems: "center",
4389
+ marginTop: "0.75rem",
4390
+ paddingTop: "0.75rem",
4391
+ borderTop: "1px solid rgba(255,255,255,0.08)",
4392
+ fontSize: "0.85rem",
4393
+ color: "rgba(255,255,255,0.7)"
4394
+ };
4395
+ var paginationButtonsStyle = {
4396
+ display: "flex",
4397
+ gap: "0.5rem"
4398
+ };
4399
+ var paginationButtonStyle = {
4400
+ border: "1px solid rgba(255,255,255,0.2)",
4401
+ background: "rgba(255,255,255,0.05)",
4402
+ color: "#fff",
4403
+ borderRadius: "6px",
4404
+ padding: "0.35rem 0.9rem",
4405
+ fontSize: "0.8rem",
4406
+ cursor: "pointer",
4407
+ transition: "opacity 0.2s ease"
4408
+ };
4325
4409
  var tableHeaderStyle = {
4326
4410
  display: "grid",
4327
4411
  gridTemplateColumns: "1.8fr 0.9fr 0.7fr 0.8fr 0.8fr 1fr",
@@ -4358,7 +4442,7 @@ var rowStyle = {
4358
4442
  padding: "0.75rem 0",
4359
4443
  borderBottom: "1px solid rgba(255,255,255,0.08)"
4360
4444
  };
4361
- var formatCurrency = (value) => {
4445
+ var formatCurrency2 = (value) => {
4362
4446
  if (value == null || Number.isNaN(value)) return "\u2014";
4363
4447
  return `$${value.toLocaleString(void 0, {
4364
4448
  minimumFractionDigits: 2,
@@ -4370,9 +4454,23 @@ var formatPercent = (value, fractionDigits = 2) => {
4370
4454
  return `${value.toFixed(fractionDigits)}%`;
4371
4455
  };
4372
4456
  var YourOrders = o.forwardRef(
4373
- ({ className, title, orders, tabs, activeTabId, onTabChange, renderOrderActions, ...props }, ref) => {
4457
+ ({
4458
+ className,
4459
+ title,
4460
+ orders,
4461
+ tabs,
4462
+ activeTabId,
4463
+ onTabChange,
4464
+ renderOrderActions,
4465
+ renderTabContent,
4466
+ ...props
4467
+ }, ref) => {
4374
4468
  const [internalActiveTab, setInternalActiveTab] = o.useState(tabs?.[0]?.id ?? "portfolio");
4469
+ const [page, setPage] = o.useState(0);
4375
4470
  const effectiveActiveTabId = activeTabId ?? internalActiveTab;
4471
+ o.useEffect(() => {
4472
+ setPage(0);
4473
+ }, [effectiveActiveTabId]);
4376
4474
  const handleTabChange = (tabId) => {
4377
4475
  if (onTabChange) {
4378
4476
  onTabChange(tabId);
@@ -4383,6 +4481,24 @@ var YourOrders = o.forwardRef(
4383
4481
  const resolvedTabs = tabs ?? DEFAULT_TABS.map((t) => ({ ...t, orders: orders ?? [], emptyState: `No ${t.label.toLowerCase()} data available.` }));
4384
4482
  const activeTab = resolvedTabs.find((t) => t.id === effectiveActiveTabId) ?? resolvedTabs[0];
4385
4483
  const activeOrders = activeTab?.orders ?? orders ?? [];
4484
+ const DEFAULT_PAGE_SIZE = 5;
4485
+ const HISTORY_PAGE_SIZE = 3;
4486
+ const pageSize = activeTab?.id === "order-history" || activeTab?.id === "trade-history" ? HISTORY_PAGE_SIZE : DEFAULT_PAGE_SIZE;
4487
+ const totalOrders = activeOrders.length;
4488
+ const totalPages = Math.max(1, Math.ceil(totalOrders / pageSize));
4489
+ const safePage = Math.min(page, totalPages - 1);
4490
+ const pageStart = safePage * pageSize;
4491
+ const paginatedOrders = activeOrders.slice(pageStart, pageStart + pageSize);
4492
+ const tabSupportsActions = activeTab?.enableCancel ?? true;
4493
+ const showActionsColumn = Boolean(renderOrderActions && tabSupportsActions);
4494
+ const columnVisibility = activeTab?.columnVisibility ?? {};
4495
+ const showPropertyPercentColumn = columnVisibility.propertyPercent !== false;
4496
+ const showPnlColumn = columnVisibility.pnl !== false;
4497
+ const columnTemplateParts = ["1.8fr", "0.9fr", "0.7fr", ...showPropertyPercentColumn ? ["0.8fr"] : [], "0.8fr", ...showPnlColumn ? ["1fr"] : []];
4498
+ if (showActionsColumn) {
4499
+ columnTemplateParts.push("0.8fr");
4500
+ }
4501
+ const gridTemplateColumns = columnTemplateParts.join(" ");
4386
4502
  const displayTitle = title ?? activeTab?.title ?? activeTab?.label ?? "Portfolio Holdings";
4387
4503
  console.log("[YourOrders] tabs:", tabs?.map((t) => ({ id: t.id, ordersCount: t.orders?.length })));
4388
4504
  console.log("[YourOrders] activeTabId prop:", activeTabId);
@@ -4395,15 +4511,16 @@ var YourOrders = o.forwardRef(
4395
4511
  return /* @__PURE__ */ jsx("div", { style: emptyStateStyle, children: emptyMessage });
4396
4512
  }
4397
4513
  return /* @__PURE__ */ jsxs(Fragment, { children: [
4398
- /* @__PURE__ */ jsxs("div", { style: tableHeaderStyle, children: [
4514
+ /* @__PURE__ */ jsxs("div", { style: { ...tableHeaderStyle, gridTemplateColumns }, children: [
4399
4515
  /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "Property" }),
4400
4516
  /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "Value" }),
4401
4517
  /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "Holding" }),
4402
- /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "% of Property" }),
4518
+ showPropertyPercentColumn ? /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "% of Property" }) : null,
4403
4519
  /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "Avg Price" }),
4404
- /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "P&L" })
4520
+ showPnlColumn ? /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "P&L" }) : null,
4521
+ showActionsColumn ? /* @__PURE__ */ jsx("div", { style: { ...tableHeaderCell, textAlign: "right" }, children: "Actions" }) : null
4405
4522
  ] }),
4406
- /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.65rem" }, children: activeOrders.map((order) => {
4523
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.65rem" }, children: paginatedOrders.map((order) => {
4407
4524
  const propertyName = order.asset;
4408
4525
  const holding = order.holdingLabel ?? `${order.amount.toLocaleString(void 0, {
4409
4526
  minimumFractionDigits: 0,
@@ -4419,7 +4536,7 @@ var YourOrders = o.forwardRef(
4419
4536
  const currentPrice = order.currentPrice ?? order.price;
4420
4537
  const priceChangePercent = order.priceChangePercent ?? order.pnlPercent;
4421
4538
  const priceChangePositive = order.priceChangePositive ?? (priceChangePercent != null ? priceChangePercent >= 0 : void 0);
4422
- return /* @__PURE__ */ 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: [
4539
+ return /* @__PURE__ */ jsxs("div", { style: { ...rowStyle, gridTemplateColumns }, children: [
4423
4540
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "1rem", alignItems: "center" }, children: [
4424
4541
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.15rem" }, children: [
4425
4542
  /* @__PURE__ */ jsx("div", { style: { fontSize: "0.9rem", fontWeight: 500 }, children: propertyName }),
@@ -4447,7 +4564,7 @@ var YourOrders = o.forwardRef(
4447
4564
  children: priceChangePositive ? "\u25B2" : "\u25BC"
4448
4565
  }
4449
4566
  ) : null,
4450
- formatCurrency(currentPrice)
4567
+ formatCurrency2(currentPrice)
4451
4568
  ]
4452
4569
  }
4453
4570
  ),
@@ -4468,11 +4585,11 @@ var YourOrders = o.forwardRef(
4468
4585
  ) : null
4469
4586
  ] }) : null
4470
4587
  ] }),
4471
- /* @__PURE__ */ jsx("div", { style: { fontSize: "0.9rem", fontWeight: 500, color: "#D4AF37" }, children: formatCurrency(value) }),
4588
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "0.9rem", fontWeight: 500, color: "#D4AF37" }, children: formatCurrency2(value) }),
4472
4589
  /* @__PURE__ */ jsx("div", { style: { fontSize: "0.9rem", color: "rgba(255,255,255,0.92)" }, children: holding }),
4473
- /* @__PURE__ */ jsx("div", { style: { fontSize: "0.9rem", color: "rgba(255,255,255,0.8)" }, children: formatPercent(propertyPercent, 3) }),
4474
- /* @__PURE__ */ jsx("div", { style: { fontSize: "0.9rem", color: "rgba(255,255,255,0.9)" }, children: formatCurrency(avgPrice) }),
4475
- /* @__PURE__ */ jsxs(
4590
+ showPropertyPercentColumn ? /* @__PURE__ */ jsx("div", { style: { fontSize: "0.9rem", color: "rgba(255,255,255,0.8)" }, children: formatPercent(propertyPercent, 3) }) : null,
4591
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "0.9rem", color: "rgba(255,255,255,0.9)" }, children: formatCurrency2(avgPrice) }),
4592
+ showPnlColumn ? /* @__PURE__ */ jsxs(
4476
4593
  "div",
4477
4594
  {
4478
4595
  style: {
@@ -4481,7 +4598,7 @@ var YourOrders = o.forwardRef(
4481
4598
  color: pnlPositive ? "#0ecb81" : "#f6465d"
4482
4599
  },
4483
4600
  children: [
4484
- pnlValue != null ? `${pnlPositive ? "+" : "-"}${formatCurrency(Math.abs(pnlValue))}` : formatCurrency(pnlValue),
4601
+ pnlValue != null ? `${pnlPositive ? "+" : "-"}${formatCurrency2(Math.abs(pnlValue))}` : formatCurrency2(pnlValue),
4485
4602
  pnlPercent != null ? /* @__PURE__ */ jsxs("span", { style: { marginLeft: "0.35rem", fontSize: "0.75rem", color: "rgba(255,255,255,0.6)" }, children: [
4486
4603
  "(",
4487
4604
  pnlPositive ? "+" : "",
@@ -4490,13 +4607,71 @@ var YourOrders = o.forwardRef(
4490
4607
  ] }) : null
4491
4608
  ]
4492
4609
  }
4493
- ),
4494
- renderOrderActions ? /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "flex-end" }, children: renderOrderActions(order) }) : null
4610
+ ) : null,
4611
+ showActionsColumn ? /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "flex-end" }, children: renderOrderActions?.(order) }) : null
4495
4612
  ] }, order.id);
4496
4613
  }) })
4497
4614
  ] });
4498
4615
  };
4499
- const tabContent = renderOrders();
4616
+ const handlePageChange = (nextPage) => {
4617
+ if (nextPage < 0 || nextPage >= totalPages) return;
4618
+ setPage(nextPage);
4619
+ };
4620
+ const customTabContent = renderTabContent?.({
4621
+ tab: activeTab,
4622
+ orders: paginatedOrders,
4623
+ page: safePage,
4624
+ totalPages,
4625
+ totalOrders,
4626
+ pageSize,
4627
+ onPageChange: handlePageChange
4628
+ });
4629
+ const tabContent = customTabContent ?? renderOrders();
4630
+ const renderPagination = () => {
4631
+ if (!hasOrders || totalPages <= 1) return null;
4632
+ const rangeStart = pageStart + 1;
4633
+ const rangeEnd = Math.min(pageStart + pageSize, totalOrders);
4634
+ return /* @__PURE__ */ jsxs("div", { style: paginationContainerStyle, children: [
4635
+ /* @__PURE__ */ jsxs("span", { children: [
4636
+ "Showing ",
4637
+ rangeStart,
4638
+ "-",
4639
+ rangeEnd,
4640
+ " of ",
4641
+ totalOrders
4642
+ ] }),
4643
+ /* @__PURE__ */ jsxs("div", { style: paginationButtonsStyle, children: [
4644
+ /* @__PURE__ */ jsx(
4645
+ "button",
4646
+ {
4647
+ type: "button",
4648
+ onClick: () => handlePageChange(safePage - 1),
4649
+ disabled: safePage === 0,
4650
+ style: {
4651
+ ...paginationButtonStyle,
4652
+ opacity: safePage === 0 ? 0.4 : 1,
4653
+ cursor: safePage === 0 ? "not-allowed" : "pointer"
4654
+ },
4655
+ children: "Prev"
4656
+ }
4657
+ ),
4658
+ /* @__PURE__ */ jsx(
4659
+ "button",
4660
+ {
4661
+ type: "button",
4662
+ onClick: () => handlePageChange(safePage + 1),
4663
+ disabled: safePage >= totalPages - 1,
4664
+ style: {
4665
+ ...paginationButtonStyle,
4666
+ opacity: safePage >= totalPages - 1 ? 0.4 : 1,
4667
+ cursor: safePage >= totalPages - 1 ? "not-allowed" : "pointer"
4668
+ },
4669
+ children: "Next"
4670
+ }
4671
+ )
4672
+ ] })
4673
+ ] });
4674
+ };
4500
4675
  return /* @__PURE__ */ jsxs(
4501
4676
  "div",
4502
4677
  {
@@ -4505,7 +4680,7 @@ var YourOrders = o.forwardRef(
4505
4680
  className,
4506
4681
  ...props,
4507
4682
  children: [
4508
- /* @__PURE__ */ jsx("div", { style: headerStyle, children: /* @__PURE__ */ jsx("h3", { style: titleStyle, children: displayTitle }) }),
4683
+ /* @__PURE__ */ jsx("div", { style: headerStyle2, children: /* @__PURE__ */ jsx("h3", { style: titleStyle2, children: displayTitle }) }),
4509
4684
  resolvedTabs.length > 1 && /* @__PURE__ */ jsx("div", { style: tabsRowStyle, children: resolvedTabs.map((tab) => {
4510
4685
  const isActive = effectiveActiveTabId === tab.id;
4511
4686
  return /* @__PURE__ */ jsxs(
@@ -4538,7 +4713,10 @@ var YourOrders = o.forwardRef(
4538
4713
  tab.id
4539
4714
  );
4540
4715
  }) }),
4541
- /* @__PURE__ */ jsx("div", { style: tabContentWrapper, children: tabContent })
4716
+ /* @__PURE__ */ jsxs("div", { style: tabContentWrapper, children: [
4717
+ tabContent,
4718
+ renderPagination()
4719
+ ] })
4542
4720
  ]
4543
4721
  }
4544
4722
  );
@@ -4658,7 +4836,7 @@ var getPriceScaleOptions = (data) => {
4658
4836
  };
4659
4837
  var defaultRanges = ["30s", "1m", "5m", "15m", "1h", "4h", "24h", "1W", "1M"];
4660
4838
  var VISIBLE_RANGE_COUNT = 4;
4661
- var formatPrice = (value, currencySymbol) => {
4839
+ var formatPrice2 = (value, currencySymbol) => {
4662
4840
  return `${currencySymbol}${value.toLocaleString(void 0, {
4663
4841
  minimumFractionDigits: 2,
4664
4842
  maximumFractionDigits: 2
@@ -4935,7 +5113,7 @@ var PriceChart = o.forwardRef(
4935
5113
  {
4936
5114
  className: cn("text-xl font-semibold tabular-nums", changeClass),
4937
5115
  style: { marginRight: "1rem" },
4938
- children: formatPrice(resolvedPrice, currencySymbol)
5116
+ children: formatPrice2(resolvedPrice, currencySymbol)
4939
5117
  }
4940
5118
  ),
4941
5119
  dollarChange != null ? /* @__PURE__ */ jsxs(
@@ -4979,7 +5157,7 @@ var PriceChart = o.forwardRef(
4979
5157
  }
4980
5158
  );
4981
5159
  PriceChart.displayName = "PriceChart";
4982
- var formatPrice2 = (value, currencySymbol) => {
5160
+ var formatPrice3 = (value, currencySymbol) => {
4983
5161
  return `${currencySymbol}${value.toLocaleString(void 0, {
4984
5162
  minimumFractionDigits: 3,
4985
5163
  maximumFractionDigits: 3
@@ -5033,8 +5211,8 @@ var PropertyHeroHeader = o.forwardRef(
5033
5211
  /* @__PURE__ */ jsx("h1", { style: headingStyle, className: "break-words", children: name }),
5034
5212
  /* @__PURE__ */ jsxs(InfoRow, { className: "mb-3 max-[768px]:mb-[0.6rem] max-[480px]:mb-[0.5rem]", children: [
5035
5213
  /* @__PURE__ */ jsx(LocationText, { children: location }),
5036
- price == null ? null : /* @__PURE__ */ jsxs(PriceBlock2, { children: [
5037
- formatPrice2(price, currencySymbol),
5214
+ price == null ? null : /* @__PURE__ */ jsxs(PriceBlock, { children: [
5215
+ formatPrice3(price, currencySymbol),
5038
5216
  changePercent == null ? null : /* @__PURE__ */ jsxs(
5039
5217
  "span",
5040
5218
  {
@@ -5315,7 +5493,7 @@ var LocationText = at.span`
5315
5493
  text-overflow: ellipsis;
5316
5494
  white-space: nowrap;
5317
5495
  `;
5318
- var PriceBlock2 = at.span`
5496
+ var PriceBlock = at.span`
5319
5497
  display: flex;
5320
5498
  align-items: center;
5321
5499
  font-size: clamp(1rem, 2.2vw, 1.25rem);
@@ -5450,66 +5628,7 @@ var PropertySubheader = o.forwardRef(
5450
5628
  }
5451
5629
  );
5452
5630
  PropertySubheader.displayName = "PropertySubheader";
5453
- var MobileToggleContainer = at.div`
5454
- display: none;
5455
-
5456
- @media (max-width: 1024px) {
5457
- display: flex;
5458
- gap: 0.5rem;
5459
- position: fixed;
5460
- bottom: 0;
5461
- left: 0;
5462
- right: 0;
5463
- background-color: var(--color-card-darker, #111);
5464
- padding: 0.75rem 1rem;
5465
- padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
5466
- border-top: 1px solid var(--color-border);
5467
- z-index: 100;
5468
- box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
5469
- }
5470
- `;
5471
- var MobileToggleButton = at.button`
5472
- flex: 1;
5473
- padding: 0.75rem;
5474
- background-color: ${(props) => props.active ? "var(--color-accent)" : "transparent"};
5475
- color: ${(props) => props.active ? "#000" : "var(--color-text-secondary)"};
5476
- border: ${(props) => props.active ? "1px solid var(--color-accent)" : "1px solid rgba(255, 255, 255, 0.2)"};
5477
- border-radius: 6px;
5478
- font-size: 0.9rem;
5479
- font-weight: 600;
5480
- cursor: pointer;
5481
- transition: all 0.2s ease;
5482
- white-space: nowrap;
5483
-
5484
- &:hover {
5485
- background-color: ${(props) => props.active ? "var(--color-accent-hover)" : "rgba(255, 255, 255, 0.05)"};
5486
- border-color: ${(props) => props.active ? "var(--color-accent)" : "rgba(255, 255, 255, 0.3)"};
5487
- }
5488
-
5489
- @media (max-width: 480px) {
5490
- font-size: 0.85rem;
5491
- padding: 0.6rem 0.5rem;
5492
- }
5493
- `;
5494
- var MobileTradeNav = o.forwardRef(
5495
- ({ className, items, activeId, onChange, ...props }, ref) => {
5496
- return /* @__PURE__ */ jsx(MobileToggleContainer, { ref, className: cn(className), ...props, children: items.map((item) => /* @__PURE__ */ jsxs(
5497
- MobileToggleButton,
5498
- {
5499
- type: "button",
5500
- active: item.id === activeId,
5501
- onClick: () => onChange?.(item.id),
5502
- children: [
5503
- item.icon,
5504
- item.label
5505
- ]
5506
- },
5507
- item.id
5508
- )) });
5509
- }
5510
- );
5511
- MobileTradeNav.displayName = "MobileTradeNav";
5512
5631
 
5513
- export { Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, HousePositionSlider, HousePositionSliderMobile, LoafLiquidityBadge, MobileTradeNav, Orderbook, PortfolioSummary, PriceChart, PropertyCompareBar, PropertyHeroHeader, PropertyNewsUpdates, PropertySubheader, PropertyTour, YourOrders, badgeVariants, buttonVariants };
5632
+ export { Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, HousePositionSlider, HousePositionSliderMobile, LoafLiquidityBadge, MobileTradeNav, Orderbook, PortfolioSummary, PriceChart, PropertyHeroHeader, PropertyNewsUpdates, PropertySubheader, PropertyTour, TradeConfirmationModal, TradingSlider, YourOrders, badgeVariants, buttonVariants };
5514
5633
  //# sourceMappingURL=index.mjs.map
5515
5634
  //# sourceMappingURL=index.mjs.map