@hyperbridge/ui 0.0.29 → 0.0.31

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
@@ -494,7 +494,7 @@ function TagButton(props) {
494
494
  }
495
495
  function SwapTokenButton(props) {
496
496
  const _a = props, { token, network } = _a, _props = __objRest(_a, ["token", "network"]);
497
- return /* @__PURE__ */ jsxs6(BaseButton, __spreadProps(__spreadValues({ className: "cursor-pointer" }, _props), { children: [
497
+ return /* @__PURE__ */ jsxs6(BaseButton, __spreadProps(__spreadValues({ className: "cursor-pointer !transition-none" }, _props), { children: [
498
498
  /* @__PURE__ */ jsx7("span", { className: "inline-flex text-[0.875rem]", children: /* @__PURE__ */ jsx7(
499
499
  BadgeIcon,
500
500
  {
@@ -505,7 +505,7 @@ function SwapTokenButton(props) {
505
505
  }
506
506
  ) }),
507
507
  /* @__PURE__ */ jsxs6("span", { className: "flex flex-col font-medium shrink-0 text-start max-w-[10ch]", children: [
508
- /* @__PURE__ */ jsx7("span", { className: "text-sm uppercase text-brand-white-500 leading-[1.2]", children: token.symbol.toLowerCase() }),
508
+ /* @__PURE__ */ jsx7("span", { className: "text-sm uppercase text-brand-white-500 leading-[1.2]", children: token.symbol.toLowerCase() }),
509
509
  /* @__PURE__ */ jsxs6("span", { className: "text-xs text-brand-black-100 leading-[1.2]", children: [
510
510
  "on ",
511
511
  /* @__PURE__ */ jsx7("span", { className: "capitalize", children: network.name.toLowerCase() })
@@ -714,7 +714,7 @@ function SwapForm({
714
714
  onClick: () => onPercentageChange == null ? void 0 : onPercentageChange(percent_value),
715
715
  disabled: isLoading,
716
716
  className: cn(
717
- "rounded-[60px] h-6 py-1 px-[9.5px] text-caption transition-colors",
717
+ "rounded-[60px] h-6 py-1 px-[9.5px] text-caption transition-none",
718
718
  percentage.value === percent_value ? "bg-white text-brand-black-500 hover:bg-white/90" : "text-brand-black-100 hover:text-white hover:bg-brand-black-200"
719
719
  ),
720
720
  variant: "message",
@@ -1098,7 +1098,7 @@ function NetworkSwitcherButton(props) {
1098
1098
  "button",
1099
1099
  __spreadProps(__spreadValues({}, _props), {
1100
1100
  type: "button",
1101
- className: "bg-brand-black-500 select-none rounded-[16px] py-[10px] px-3 w-[49%] cursor-pointer hover:bg-brand-black-300 duration-200 transition-all",
1101
+ className: "bg-brand-black-500 select-none rounded-[16px] py-[10px] px-3 w-[49%] cursor-pointer hover:brightness-110",
1102
1102
  children: /* @__PURE__ */ jsxs9("span", { className: "flex gap-3 items-center", children: [
1103
1103
  /* @__PURE__ */ jsx14(TokenImage, { className: "size-8", src: image.src, alt: image.alt }),
1104
1104
  /* @__PURE__ */ jsxs9("span", { className: "flex flex-col items-start", children: [
@@ -1210,7 +1210,7 @@ function EmptyState(props) {
1210
1210
 
1211
1211
  // src/components/molecules/modal.tsx
1212
1212
  import { AnimatePresence, motion } from "motion/react";
1213
- import { useEffect as useEffect3 } from "react";
1213
+ import { useEffect as useEffect4 } from "react";
1214
1214
 
1215
1215
  // src/hooks/is-mobile.ts
1216
1216
  import { useEffect as useEffect2, useState as useState3 } from "react";
@@ -1227,6 +1227,31 @@ var useIsMobile = () => {
1227
1227
  return isMobile;
1228
1228
  };
1229
1229
 
1230
+ // src/hooks/use-viewport-height.ts
1231
+ import { useEffect as useEffect3, useState as useState4 } from "react";
1232
+ function useViewportHeight(enabled = true) {
1233
+ const [viewportHeight, setViewportHeight] = useState4(null);
1234
+ useEffect3(() => {
1235
+ if (!enabled) return;
1236
+ const handleResize = () => {
1237
+ if (window.visualViewport) {
1238
+ setViewportHeight(window.visualViewport.height);
1239
+ }
1240
+ };
1241
+ if (window.visualViewport) {
1242
+ window.visualViewport.addEventListener("resize", handleResize);
1243
+ handleResize();
1244
+ }
1245
+ return () => {
1246
+ if (window.visualViewport) {
1247
+ window.visualViewport.removeEventListener("resize", handleResize);
1248
+ }
1249
+ setViewportHeight(null);
1250
+ };
1251
+ }, [enabled]);
1252
+ return viewportHeight;
1253
+ }
1254
+
1230
1255
  // src/lib/animations.ts
1231
1256
  var modalVariants = {
1232
1257
  initial: {
@@ -1398,8 +1423,22 @@ import { jsx as jsx17 } from "react/jsx-runtime";
1398
1423
  var Modal = (props) => {
1399
1424
  const { isOpen, children, onClose } = props;
1400
1425
  const isMobile = useIsMobile();
1426
+ const viewportHeight = useViewportHeight(isMobile && isOpen);
1401
1427
  if (isMobile) {
1402
- return /* @__PURE__ */ jsx17(Drawer, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ jsx17(DrawerContent, { className: "bg-brand-black-550 border-brand-black-300 min-h-[90dvh]", children }) });
1428
+ return /* @__PURE__ */ jsx17(Drawer, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ jsx17(
1429
+ DrawerContent,
1430
+ {
1431
+ className: "bg-brand-black-550 border-brand-black-300",
1432
+ style: viewportHeight ? {
1433
+ height: `${viewportHeight}px`,
1434
+ maxHeight: `${viewportHeight}px`,
1435
+ minHeight: "auto"
1436
+ } : {
1437
+ minHeight: "90dvh"
1438
+ },
1439
+ children
1440
+ }
1441
+ ) });
1403
1442
  }
1404
1443
  return /* @__PURE__ */ jsx17(DestkopModal, __spreadValues({}, props));
1405
1444
  };
@@ -1412,7 +1451,7 @@ function DestkopModal(props) {
1412
1451
  className
1413
1452
  } = props;
1414
1453
  const { variants, transition } = animationPresets[animationPreset];
1415
- useEffect3(() => {
1454
+ useEffect4(() => {
1416
1455
  const handleEscapeKey = (event) => {
1417
1456
  if (event.key === "Escape" && isOpen && onClose) {
1418
1457
  onClose();
@@ -2100,7 +2139,7 @@ function BridgeInput(props) {
2100
2139
  disabled: isLoading,
2101
2140
  variant: "message",
2102
2141
  className: cn(
2103
- "rounded-[60px] h-6 py-1 px-[9.5px] text-caption transition-colors",
2142
+ "rounded-[60px] h-6 py-1 px-[9.5px] text-caption transition-none",
2104
2143
  percentage.value === percent_value ? "bg-white text-brand-black-500 hover:bg-white/90" : "text-brand-black-100 hover:text-white hover:bg-brand-black-200"
2105
2144
  ),
2106
2145
  onClick: () => props.onPercentageChange(percent_value),
@@ -2197,14 +2236,14 @@ function BridgeForm({
2197
2236
  senderBalance = "0",
2198
2237
  senderUsdValue = "0",
2199
2238
  senderToken = {
2200
- image: "https://app.hyperbridge.network/networks/polkadot.png",
2239
+ image: "https://app.hyperbridge.network/networks/polkadot.svg",
2201
2240
  symbol: "DOT"
2202
2241
  },
2203
2242
  onSenderAmountChange,
2204
2243
  receiverAmount = "0",
2205
2244
  receiverUsdValue = "0",
2206
2245
  receiverToken = {
2207
- image: "https://app.hyperbridge.network/networks/polkadot.png",
2246
+ image: "https://app.hyperbridge.network/networks/polkadot.svg",
2208
2247
  symbol: "DOT"
2209
2248
  },
2210
2249
  percentagePresets = [25, 50, 100],
@@ -2389,7 +2428,7 @@ function BridgeForm({
2389
2428
  TokenChangeButton: /* @__PURE__ */ jsx24(TokenSelectorDialog, { children: /* @__PURE__ */ jsx24(
2390
2429
  TagButton,
2391
2430
  {
2392
- className: "cursor-pointer",
2431
+ className: "cursor-pointer !transition-none",
2393
2432
  src: senderToken.image,
2394
2433
  symbol: senderToken.symbol,
2395
2434
  variant: "trigger",
@@ -4839,8 +4878,22 @@ function CWDrawerContent(_a) {
4839
4878
  "children"
4840
4879
  ]);
4841
4880
  const isMobile = useIsMobile();
4881
+ const viewportHeight = useViewportHeight(isMobile);
4842
4882
  if (isMobile) {
4843
- return /* @__PURE__ */ jsx48(HBDrawerContent, { className: "bg-brand-black-550 rounded-t-[1rem] w-full px-[1rem] border-t border-brand-black-300 min-h-[90dvh]", children: /* @__PURE__ */ jsx48("div", { className: "flex flex-col flex-1", children }) });
4883
+ return /* @__PURE__ */ jsx48(
4884
+ HBDrawerContent,
4885
+ {
4886
+ className: "bg-brand-black-550 rounded-t-[1rem] w-full px-[1rem] border-t border-brand-black-300",
4887
+ style: viewportHeight ? {
4888
+ height: `${viewportHeight}px`,
4889
+ maxHeight: `${viewportHeight}px`,
4890
+ minHeight: "auto"
4891
+ } : {
4892
+ minHeight: "90dvh"
4893
+ },
4894
+ children: /* @__PURE__ */ jsx48("div", { className: "flex flex-col flex-1", children })
4895
+ }
4896
+ );
4844
4897
  }
4845
4898
  return /* @__PURE__ */ jsx48(
4846
4899
  SheetContent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperbridge/ui",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "sideEffects": false,
5
5
  "license": "MIT",
6
6
  "private": false,
package/styles/base.css CHANGED
@@ -294,3 +294,11 @@ input[type="number"]::-webkit-inner-spin-button {
294
294
  }
295
295
 
296
296
  /* End Dialog */
297
+
298
+ @media (max-width: 768px) {
299
+ body:has([data-drawer="true"]) {
300
+ position: fixed;
301
+ width: 100%;
302
+ height: 100vh;
303
+ }
304
+ }