@hot-labs/kit 1.6.1 → 1.6.2

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.
Files changed (72) hide show
  1. package/build/activity.d.ts +2 -0
  2. package/build/activity.js +8 -1
  3. package/build/activity.js.map +1 -1
  4. package/build/core/defuse.d.ts +61 -0
  5. package/build/core/defuse.js +47 -0
  6. package/build/core/defuse.js.map +1 -0
  7. package/build/core/exchange.d.ts +8 -4
  8. package/build/core/exchange.js +33 -7
  9. package/build/core/exchange.js.map +1 -1
  10. package/build/core/pendings.d.ts +26 -12
  11. package/build/core/pendings.js +43 -34
  12. package/build/core/pendings.js.map +1 -1
  13. package/build/ui/bridge/Bridge.js +11 -186
  14. package/build/ui/bridge/Bridge.js.map +1 -1
  15. package/build/ui/bridge/SelectSender.d.ts +2 -1
  16. package/build/ui/bridge/SelectSender.js +10 -2
  17. package/build/ui/bridge/SelectSender.js.map +1 -1
  18. package/build/ui/bridge/SelectToken.d.ts +2 -1
  19. package/build/ui/bridge/SelectToken.js +14 -6
  20. package/build/ui/bridge/SelectToken.js.map +1 -1
  21. package/build/ui/bridge/TokenAmountCard.d.ts +39 -0
  22. package/build/ui/bridge/TokenAmountCard.js +186 -0
  23. package/build/ui/bridge/TokenAmountCard.js.map +1 -0
  24. package/build/ui/icons/warning.js +1 -1
  25. package/build/ui/icons/warning.js.map +1 -1
  26. package/build/ui/profile/DepositFlow.d.ts +3 -0
  27. package/build/ui/profile/DepositFlow.js +128 -9
  28. package/build/ui/profile/DepositFlow.js.map +1 -1
  29. package/build/ui/profile/DepositQR.d.ts +11 -4
  30. package/build/ui/profile/DepositQR.js +81 -37
  31. package/build/ui/profile/DepositQR.js.map +1 -1
  32. package/build/ui/profile/Payment.js +3 -9
  33. package/build/ui/profile/Payment.js.map +1 -1
  34. package/build/ui/profile/Profile.d.ts +8 -3
  35. package/build/ui/profile/Profile.js +15 -10
  36. package/build/ui/profile/Profile.js.map +1 -1
  37. package/build/ui/router.d.ts +4 -2
  38. package/build/ui/router.js +4 -6
  39. package/build/ui/router.js.map +1 -1
  40. package/build/ui/styles.js +2 -1
  41. package/build/ui/styles.js.map +1 -1
  42. package/build/ui/toast/index.js +2 -0
  43. package/build/ui/toast/index.js.map +1 -1
  44. package/build/ui/uikit/animationts.d.ts +5 -0
  45. package/build/ui/uikit/animationts.js +19 -0
  46. package/build/ui/uikit/animationts.js.map +1 -0
  47. package/build/ui/uikit/badge.d.ts +5 -0
  48. package/build/ui/uikit/badge.js +19 -0
  49. package/build/ui/uikit/badge.js.map +1 -0
  50. package/build/ui/uikit/tabs.d.ts +2 -1
  51. package/build/ui/uikit/tabs.js +31 -17
  52. package/build/ui/uikit/tabs.js.map +1 -1
  53. package/package.json +1 -1
  54. package/src/activity.ts +10 -1
  55. package/src/core/defuse.ts +102 -0
  56. package/src/core/exchange.ts +38 -10
  57. package/src/core/pendings.ts +51 -38
  58. package/src/ui/bridge/Bridge.tsx +30 -312
  59. package/src/ui/bridge/SelectSender.tsx +24 -2
  60. package/src/ui/bridge/SelectToken.tsx +15 -6
  61. package/src/ui/bridge/TokenAmountCard.tsx +347 -0
  62. package/src/ui/icons/warning.tsx +1 -1
  63. package/src/ui/profile/DepositFlow.tsx +286 -10
  64. package/src/ui/profile/DepositQR.tsx +194 -74
  65. package/src/ui/profile/Payment.tsx +4 -27
  66. package/src/ui/profile/Profile.tsx +100 -92
  67. package/src/ui/router.tsx +5 -7
  68. package/src/ui/styles.ts +2 -1
  69. package/src/ui/toast/index.tsx +2 -0
  70. package/src/ui/uikit/animationts.ts +20 -0
  71. package/src/ui/uikit/badge.tsx +24 -0
  72. package/src/ui/uikit/tabs.tsx +38 -24
@@ -177,6 +177,7 @@ const Root = styled.div`
177
177
  flex-direction: column;
178
178
  gap: 12px;
179
179
  z-index: 1000000000;
180
+ pointer-events: none;
180
181
  `;
181
182
 
182
183
  const ToastContent = styled.div`
@@ -202,6 +203,7 @@ const Container = styled.div<{ $type: "success" | "failed" | "pending" }>`
202
203
  box-shadow: -6px 6px 16px 0 rgba(0, 0, 0, 0.6);
203
204
  overflow: hidden;
204
205
  position: relative;
206
+ pointer-events: all;
205
207
 
206
208
  cursor: pointer;
207
209
  width: 320px;
@@ -0,0 +1,20 @@
1
+ import { useState } from "react";
2
+
3
+ let isInitialized = false;
4
+ const animations = {
5
+ success: "https://hex.exchange/success.json",
6
+ failed: "https://hex.exchange/error.json",
7
+ loading: "https://hex.exchange/loading.json",
8
+ };
9
+
10
+ export const useAnimations = () => {
11
+ useState(() => {
12
+ if (isInitialized) return;
13
+ isInitialized = true;
14
+ fetch(animations.loading);
15
+ fetch(animations.success);
16
+ fetch(animations.failed);
17
+ });
18
+
19
+ return animations;
20
+ };
@@ -0,0 +1,24 @@
1
+ import styled from "styled-components";
2
+ import { WarningIcon } from "../icons/warning";
3
+ import { PSmall } from "./text";
4
+
5
+ export const WarningBox = ({ style, children, type = "warning" }: { style?: React.CSSProperties; children: React.ReactNode; type?: "warning" | "error" }) => {
6
+ return (
7
+ <WarningBadge $type={type} style={style}>
8
+ <WarningIcon color={type === "warning" ? "#F3AE47" : "#FF453A"} style={{ flexShrink: 0 }} />
9
+ <PSmall style={{ color: type === "warning" ? "#F3AE47" : "#FF453A", fontWeight: "bold" }}>{children}</PSmall>
10
+ </WarningBadge>
11
+ );
12
+ };
13
+
14
+ const WarningBadge = styled.div<{ $type: "warning" | "error" }>`
15
+ border-radius: 8px;
16
+ width: 100%;
17
+ border: 1px solid ${(p) => (p.$type === "warning" ? "#f3ae47" : "#FF453A")};
18
+ background: ${(p) => (p.$type === "warning" ? "#3f311d" : "#1c1c1c")};
19
+ align-items: center;
20
+ padding: 8px;
21
+ display: flex;
22
+ gap: 8px;
23
+ text-align: left;
24
+ `;
@@ -1,25 +1,35 @@
1
1
  import styled from "styled-components";
2
+ import { PSmall, PTiny } from "./text";
3
+ import { Button } from "./button";
2
4
 
3
5
  interface SegmentedControlProps {
4
- options: { label: string; value: string; color?: string; background?: string }[];
5
- value: string;
6
+ options: { label: string; value: string; color?: string; background?: string; badge?: string }[];
6
7
  onChange: (value: string) => void;
8
+ value: string;
7
9
  }
8
10
 
9
11
  const SegmentedControl = ({ options, value, onChange }: SegmentedControlProps) => {
10
12
  return (
11
13
  <Tabs>
14
+ <div
15
+ style={{
16
+ position: "absolute",
17
+ transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
18
+ left: `${(100 / options.length) * options.findIndex((option) => option.value === value)}%`,
19
+ background: options.find((option) => option.value === value)?.background || "#1f1f1f",
20
+ width: `calc(${100 / options.length}% - 4px)`,
21
+ height: "calc(100% - 4px)",
22
+ borderRadius: 10,
23
+ margin: "2px",
24
+ zIndex: 0,
25
+ top: 0,
26
+ }}
27
+ />
28
+
12
29
  {options.map((option) => (
13
- <Tab
14
- key={option.value}
15
- onClick={() => onChange(option.value)}
16
- $active={option.value === value}
17
- style={{
18
- background: option.value === value ? option.background || "#1D1F20" : "transparent",
19
- color: option.value === value ? option.color : "#6b6661",
20
- }}
21
- >
22
- {option.label}
30
+ <Tab key={option.value} onClick={() => onChange(option.value)} $active={option.value === value}>
31
+ <PSmall style={{ transition: "color 0.2s", color: option.value === value ? option.color : "var(--text-text-secondary, #BFBFBF)" }}>{option.label}</PSmall>
32
+ {option.badge && <PTiny style={{ minWidth: 16, textAlign: "center", fontSize: 9, color: "#b2b2b2", fontWeight: "bold", background: "#262729", padding: "0 4px", borderRadius: "8px" }}>{option.badge}</PTiny>}
23
33
  </Tab>
24
34
  ))}
25
35
  </Tabs>
@@ -28,29 +38,33 @@ const SegmentedControl = ({ options, value, onChange }: SegmentedControlProps) =
28
38
 
29
39
  const Tabs = styled.div`
30
40
  display: flex;
31
- border-radius: 16px;
32
- border: 1px solid var(--border-lowest-solid, #242627);
33
- padding: 0;
34
41
  flex-shrink: 0;
35
42
  height: 40px;
36
- padding: 2px;
37
43
  width: 100%;
44
+ padding: 0;
45
+
46
+ border-radius: var(--border-radius-12, 12px);
47
+ border: 1px solid var(--border-border-default, #323232);
48
+ position: relative;
38
49
  `;
39
50
 
40
- const Tab = styled.button<{ $active?: boolean }>`
51
+ const Tab = styled(Button)<{ $active?: boolean }>`
41
52
  display: flex;
42
- flex-direction: column;
53
+ flex-direction: row;
43
54
  justify-content: center;
44
55
  align-items: center;
45
- border-radius: 14px;
46
- height: 100%;
47
- border: none;
56
+ gap: 4px;
57
+
48
58
  outline: none;
49
59
  cursor: pointer;
50
- transition: 0.2s background-color;
60
+ transition: 0.2s background-color, 0.2s opacity;
61
+ z-index: 1;
51
62
  flex: 1;
52
- font-size: 14px;
53
- font-weight: 500;
63
+ white-space: nowrap;
64
+
65
+ p {
66
+ color: ${(p) => (p.$active ? "var(--text-text-primary, #fff)" : "var(--text-text-secondary, #BFBFBF)")};
67
+ }
54
68
  `;
55
69
 
56
70
  export default SegmentedControl;