@hanzo/ui 5.3.28 → 5.3.30

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 (229) hide show
  1. package/dist/3d/button.js +298 -0
  2. package/dist/3d/button.mjs +273 -0
  3. package/dist/3d/card.js +234 -0
  4. package/dist/3d/card.mjs +207 -0
  5. package/dist/3d/carousel.js +371 -0
  6. package/dist/3d/carousel.mjs +344 -0
  7. package/dist/3d/grid.js +362 -0
  8. package/dist/3d/grid.mjs +337 -0
  9. package/dist/3d/index.js +1518 -0
  10. package/dist/3d/index.mjs +1472 -0
  11. package/dist/3d/marquee.js +352 -0
  12. package/dist/3d/marquee.mjs +327 -0
  13. package/dist/3d/pin.js +46 -0
  14. package/dist/3d/pin.mjs +24 -0
  15. package/dist/accordion.js +80 -0
  16. package/dist/accordion.mjs +55 -0
  17. package/dist/alert-dialog.js +220 -0
  18. package/dist/alert-dialog.mjs +187 -0
  19. package/dist/alert.js +68 -0
  20. package/dist/alert.mjs +64 -0
  21. package/dist/animation/animated-background.js +424 -0
  22. package/dist/animation/animated-background.mjs +418 -0
  23. package/dist/animation/animated-beam.js +119 -0
  24. package/dist/animation/animated-beam.mjs +97 -0
  25. package/dist/animation/animated-cursor.js +275 -0
  26. package/dist/animation/animated-cursor.mjs +270 -0
  27. package/dist/animation/animated-icon.js +357 -0
  28. package/dist/animation/animated-icon.mjs +351 -0
  29. package/dist/animation/animated-list.js +339 -0
  30. package/dist/animation/animated-list.mjs +333 -0
  31. package/dist/animation/animated-number.js +283 -0
  32. package/dist/animation/animated-number.mjs +277 -0
  33. package/dist/animation/animated-testimonials.js +97 -0
  34. package/dist/animation/animated-testimonials.mjs +75 -0
  35. package/dist/animation/animated-tooltip.js +67 -0
  36. package/dist/animation/animated-tooltip.mjs +45 -0
  37. package/dist/animation/apple-cards-carousel.js +308 -0
  38. package/dist/animation/apple-cards-carousel.mjs +285 -0
  39. package/dist/animation/apple-hello-effect.js +60 -0
  40. package/dist/animation/apple-hello-effect.mjs +38 -0
  41. package/dist/animation/index.js +1952 -0
  42. package/dist/animation/index.mjs +1921 -0
  43. package/dist/avatar.js +71 -0
  44. package/dist/avatar.mjs +47 -0
  45. package/dist/badge.js +66 -0
  46. package/dist/badge.mjs +40 -0
  47. package/dist/blocks/index.js +1665 -0
  48. package/dist/blocks/index.mjs +1626 -0
  49. package/dist/breadcrumb.js +107 -0
  50. package/dist/breadcrumb.mjs +99 -0
  51. package/dist/calendar.js +189 -0
  52. package/dist/calendar.mjs +164 -0
  53. package/dist/carousel.js +278 -0
  54. package/dist/carousel.mjs +249 -0
  55. package/dist/checkbox.js +60 -0
  56. package/dist/checkbox.mjs +35 -0
  57. package/dist/code/block.js +226 -0
  58. package/dist/code/block.mjs +203 -0
  59. package/dist/code/compare.js +446 -0
  60. package/dist/code/compare.mjs +423 -0
  61. package/dist/code/diff.js +430 -0
  62. package/dist/code/diff.mjs +407 -0
  63. package/dist/code/editor.js +243 -0
  64. package/dist/code/editor.mjs +218 -0
  65. package/dist/code/explorer.js +291 -0
  66. package/dist/code/explorer.mjs +268 -0
  67. package/dist/code/index.js +2551 -0
  68. package/dist/code/index.mjs +2510 -0
  69. package/dist/code/preview.js +400 -0
  70. package/dist/code/preview.mjs +377 -0
  71. package/dist/code/snippet.js +274 -0
  72. package/dist/code/snippet.mjs +250 -0
  73. package/dist/code/tabs.js +75 -0
  74. package/dist/code/tabs.mjs +53 -0
  75. package/dist/code/terminal.js +437 -0
  76. package/dist/code/terminal.mjs +414 -0
  77. package/dist/collapsible.js +33 -0
  78. package/dist/collapsible.mjs +9 -0
  79. package/dist/command.js +262 -0
  80. package/dist/command.mjs +232 -0
  81. package/dist/context-menu.js +207 -0
  82. package/dist/context-menu.mjs +171 -0
  83. package/dist/device/index.js +3 -0
  84. package/dist/device/index.mjs +2 -0
  85. package/dist/dialog.js +151 -0
  86. package/dist/dialog.mjs +121 -0
  87. package/dist/dock/basic.js +174 -0
  88. package/dist/dock/basic.mjs +151 -0
  89. package/dist/dock/index.js +628 -0
  90. package/dist/dock/index.mjs +601 -0
  91. package/dist/dock/limelight-nav.js +295 -0
  92. package/dist/dock/limelight-nav.mjs +274 -0
  93. package/dist/dock/macos.js +141 -0
  94. package/dist/dock/macos.mjs +118 -0
  95. package/dist/dock/menu.js +70 -0
  96. package/dist/dock/menu.mjs +48 -0
  97. package/dist/dock/message.js +144 -0
  98. package/dist/dock/message.mjs +122 -0
  99. package/dist/drawer.js +115 -0
  100. package/dist/drawer.mjs +103 -0
  101. package/dist/dropdown-menu.js +202 -0
  102. package/dist/dropdown-menu.mjs +166 -0
  103. package/dist/finance/AdvancedChart.js +48 -0
  104. package/dist/finance/AdvancedChart.mjs +46 -0
  105. package/dist/finance/CompanyProfile.js +48 -0
  106. package/dist/finance/CompanyProfile.mjs +46 -0
  107. package/dist/finance/CryptoScreener.js +45 -0
  108. package/dist/finance/CryptoScreener.mjs +43 -0
  109. package/dist/finance/Financials.js +52 -0
  110. package/dist/finance/Financials.mjs +50 -0
  111. package/dist/finance/ForexScreener.js +46 -0
  112. package/dist/finance/ForexScreener.mjs +44 -0
  113. package/dist/finance/MarketOverview.js +104 -0
  114. package/dist/finance/MarketOverview.mjs +102 -0
  115. package/dist/finance/NewsTimeline.js +44 -0
  116. package/dist/finance/NewsTimeline.mjs +42 -0
  117. package/dist/finance/OrderEntry.js +131 -0
  118. package/dist/finance/OrderEntry.mjs +129 -0
  119. package/dist/finance/OrdersHistory.js +64 -0
  120. package/dist/finance/OrdersHistory.mjs +62 -0
  121. package/dist/finance/PositionsList.js +80 -0
  122. package/dist/finance/PositionsList.mjs +78 -0
  123. package/dist/finance/StockScreener.js +46 -0
  124. package/dist/finance/StockScreener.mjs +44 -0
  125. package/dist/finance/SymbolInfo.js +46 -0
  126. package/dist/finance/SymbolInfo.mjs +44 -0
  127. package/dist/finance/TechnicalAnalysis.js +54 -0
  128. package/dist/finance/TechnicalAnalysis.mjs +52 -0
  129. package/dist/finance/TickerTape.js +56 -0
  130. package/dist/finance/TickerTape.mjs +54 -0
  131. package/dist/finance/TradingPanel.js +191 -0
  132. package/dist/finance/TradingPanel.mjs +189 -0
  133. package/dist/finance/index.js +930 -0
  134. package/dist/finance/index.mjs +914 -0
  135. package/dist/form/index.js +155 -0
  136. package/dist/form/index.mjs +125 -0
  137. package/dist/form.js +172 -0
  138. package/dist/form.mjs +142 -0
  139. package/dist/hover-card.js +58 -0
  140. package/dist/hover-card.mjs +34 -0
  141. package/dist/index.js +8467 -0
  142. package/dist/index.mjs +8087 -0
  143. package/dist/input-otp.js +79 -0
  144. package/dist/input-otp.mjs +54 -0
  145. package/dist/lib/utils.js +28 -0
  146. package/dist/lib/utils.mjs +24 -0
  147. package/dist/navigation/index.js +98 -0
  148. package/dist/navigation/index.mjs +79 -0
  149. package/dist/navigation-menu.js +149 -0
  150. package/dist/navigation-menu.mjs +116 -0
  151. package/dist/pattern/grid-pattern.js +333 -0
  152. package/dist/pattern/grid-pattern.mjs +310 -0
  153. package/dist/pattern/index.js +333 -0
  154. package/dist/pattern/index.mjs +310 -0
  155. package/dist/popover.js +63 -0
  156. package/dist/popover.mjs +37 -0
  157. package/dist/primitives/index.js +8467 -0
  158. package/dist/primitives/index.mjs +8087 -0
  159. package/dist/primitives-export.js +8467 -0
  160. package/dist/primitives-export.mjs +8087 -0
  161. package/dist/progress.js +62 -0
  162. package/dist/progress.mjs +37 -0
  163. package/dist/project/gantt.js +65 -0
  164. package/dist/project/gantt.mjs +43 -0
  165. package/dist/project/index.js +636 -0
  166. package/dist/project/index.mjs +611 -0
  167. package/dist/project/kanban.js +597 -0
  168. package/dist/project/kanban.mjs +572 -0
  169. package/dist/project/list.js +35 -0
  170. package/dist/project/list.mjs +12 -0
  171. package/dist/radio-group.js +68 -0
  172. package/dist/radio-group.mjs +45 -0
  173. package/dist/resizable.js +72 -0
  174. package/dist/resizable.mjs +48 -0
  175. package/dist/scroll-area.js +89 -0
  176. package/dist/scroll-area.mjs +66 -0
  177. package/dist/select.js +140 -0
  178. package/dist/select.mjs +111 -0
  179. package/dist/separator.js +59 -0
  180. package/dist/separator.mjs +34 -0
  181. package/dist/sheet.js +148 -0
  182. package/dist/sheet.mjs +117 -0
  183. package/dist/skeleton.js +32 -0
  184. package/dist/skeleton.mjs +27 -0
  185. package/dist/slider.js +99 -0
  186. package/dist/slider.mjs +73 -0
  187. package/dist/sonner.js +34 -0
  188. package/dist/sonner.mjs +29 -0
  189. package/dist/switch.js +62 -0
  190. package/dist/switch.mjs +37 -0
  191. package/dist/table.js +110 -0
  192. package/dist/table.mjs +101 -0
  193. package/dist/tabs.js +82 -0
  194. package/dist/tabs.mjs +57 -0
  195. package/dist/tailwind/index.js +2023 -0
  196. package/dist/tailwind/index.mjs +2011 -0
  197. package/dist/textarea.js +78 -0
  198. package/dist/textarea.mjs +56 -0
  199. package/dist/toggle-group.js +118 -0
  200. package/dist/toggle-group.mjs +93 -0
  201. package/dist/toggle.js +71 -0
  202. package/dist/toggle.mjs +48 -0
  203. package/dist/tooltip.js +67 -0
  204. package/dist/tooltip.mjs +40 -0
  205. package/dist/types/index.js +57 -0
  206. package/dist/types/index.mjs +51 -0
  207. package/dist/ui/announcement.js +129 -0
  208. package/dist/ui/announcement.mjs +107 -0
  209. package/dist/ui/avatar-group.js +88 -0
  210. package/dist/ui/avatar-group.mjs +65 -0
  211. package/dist/ui/banner.js +85 -0
  212. package/dist/ui/banner.mjs +62 -0
  213. package/dist/ui/cursor.js +78 -0
  214. package/dist/ui/cursor.mjs +56 -0
  215. package/dist/ui/index.js +475 -0
  216. package/dist/ui/index.mjs +442 -0
  217. package/dist/ui/marquee.js +74 -0
  218. package/dist/ui/marquee.mjs +52 -0
  219. package/dist/ui/pill.js +85 -0
  220. package/dist/ui/pill.mjs +62 -0
  221. package/dist/ui/spinner.js +28 -0
  222. package/dist/ui/spinner.mjs +26 -0
  223. package/dist/ui/tags.js +101 -0
  224. package/dist/ui/tags.mjs +79 -0
  225. package/dist/ui/ticker.js +73 -0
  226. package/dist/ui/ticker.mjs +51 -0
  227. package/dist/util/index.js +463 -0
  228. package/dist/util/index.mjs +404 -0
  229. package/package.json +1 -1
@@ -0,0 +1,189 @@
1
+ "use client";
2
+ import { useState, useEffect } from 'react';
3
+ import { TrendingUp, TrendingDown } from 'lucide-react';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ function TradingPanel({ symbol, currentPrice }) {
9
+ const [orderType, setOrderType] = useState("buy");
10
+ const [quantity, setQuantity] = useState("");
11
+ const [portfolio, setPortfolio] = useState(null);
12
+ const [message, setMessage] = useState(null);
13
+ useEffect(() => {
14
+ loadPortfolio();
15
+ }, []);
16
+ const loadPortfolio = /* @__PURE__ */ __name(() => {
17
+ const storedPortfolio = localStorage.getItem("begm_portfolio");
18
+ if (storedPortfolio) {
19
+ setPortfolio(JSON.parse(storedPortfolio));
20
+ } else {
21
+ const initialPortfolio = {
22
+ cash: 1e5,
23
+ holdings: []
24
+ };
25
+ localStorage.setItem("begm_portfolio", JSON.stringify(initialPortfolio));
26
+ setPortfolio(initialPortfolio);
27
+ }
28
+ }, "loadPortfolio");
29
+ const executeTrade = /* @__PURE__ */ __name(() => {
30
+ if (!quantity || parseFloat(quantity) <= 0) {
31
+ setMessage({ type: "error", text: "Please enter a valid quantity" });
32
+ return;
33
+ }
34
+ const qty = parseFloat(quantity);
35
+ const total = qty * currentPrice;
36
+ if (orderType === "buy") {
37
+ if (total > portfolio.cash) {
38
+ setMessage({ type: "error", text: "Insufficient funds" });
39
+ return;
40
+ }
41
+ const existingHolding = portfolio.holdings.find((h) => h.symbol === symbol);
42
+ if (existingHolding) {
43
+ const newQuantity = existingHolding.quantity + qty;
44
+ const newAveragePrice = (existingHolding.averagePrice * existingHolding.quantity + currentPrice * qty) / newQuantity;
45
+ existingHolding.quantity = newQuantity;
46
+ existingHolding.averagePrice = newAveragePrice;
47
+ existingHolding.currentPrice = currentPrice;
48
+ } else {
49
+ portfolio.holdings.push({
50
+ symbol,
51
+ quantity: qty,
52
+ averagePrice: currentPrice,
53
+ currentPrice
54
+ });
55
+ }
56
+ portfolio.cash -= total;
57
+ } else {
58
+ const existingHolding = portfolio.holdings.find((h) => h.symbol === symbol);
59
+ if (!existingHolding || existingHolding.quantity < qty) {
60
+ setMessage({ type: "error", text: "Insufficient shares" });
61
+ return;
62
+ }
63
+ existingHolding.quantity -= qty;
64
+ existingHolding.currentPrice = currentPrice;
65
+ if (existingHolding.quantity === 0) {
66
+ portfolio.holdings = portfolio.holdings.filter((h) => h.symbol !== symbol);
67
+ }
68
+ portfolio.cash += total;
69
+ }
70
+ localStorage.setItem("begm_portfolio", JSON.stringify(portfolio));
71
+ setPortfolio({ ...portfolio });
72
+ const orders = JSON.parse(localStorage.getItem("begm_orders") || "[]");
73
+ orders.push({
74
+ id: `ORD-${Date.now()}`,
75
+ symbol,
76
+ type: orderType,
77
+ quantity: qty,
78
+ price: currentPrice,
79
+ total,
80
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
81
+ status: "completed"
82
+ });
83
+ localStorage.setItem("begm_orders", JSON.stringify(orders));
84
+ setMessage({
85
+ type: "success",
86
+ text: `Successfully ${orderType === "buy" ? "bought" : "sold"} ${qty} shares of ${symbol}`
87
+ });
88
+ setQuantity("");
89
+ setTimeout(() => setMessage(null), 3e3);
90
+ }, "executeTrade");
91
+ const getHoldingInfo = /* @__PURE__ */ __name(() => {
92
+ if (!portfolio) return null;
93
+ const holding2 = portfolio.holdings.find((h) => h.symbol === symbol);
94
+ return holding2;
95
+ }, "getHoldingInfo");
96
+ const holding = getHoldingInfo();
97
+ return /* @__PURE__ */ jsxs("div", { className: "bg-white/5 border border-white/10 rounded-lg p-6 backdrop-blur-xl", children: [
98
+ /* @__PURE__ */ jsxs("h3", { className: "text-lg font-bold text-white mb-4", children: [
99
+ "Trade ",
100
+ symbol
101
+ ] }),
102
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2 mb-4", children: [
103
+ /* @__PURE__ */ jsxs(
104
+ "button",
105
+ {
106
+ onClick: () => setOrderType("buy"),
107
+ className: `flex-1 py-2 rounded-lg font-medium transition-all ${orderType === "buy" ? "bg-success text-white" : "bg-white/5 text-white/60 hover:bg-white/10"}`,
108
+ children: [
109
+ /* @__PURE__ */ jsx(TrendingUp, { size: 16, className: "inline mr-2" }),
110
+ "Buy"
111
+ ]
112
+ }
113
+ ),
114
+ /* @__PURE__ */ jsxs(
115
+ "button",
116
+ {
117
+ onClick: () => setOrderType("sell"),
118
+ className: `flex-1 py-2 rounded-lg font-medium transition-all ${orderType === "sell" ? "bg-danger text-white" : "bg-white/5 text-white/60 hover:bg-white/10"}`,
119
+ children: [
120
+ /* @__PURE__ */ jsx(TrendingDown, { size: 16, className: "inline mr-2" }),
121
+ "Sell"
122
+ ]
123
+ }
124
+ )
125
+ ] }),
126
+ holding && /* @__PURE__ */ jsxs("div", { className: "mb-4 p-3 bg-white/5 rounded-lg", children: [
127
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-white/60 mb-1", children: "Your Holdings" }),
128
+ /* @__PURE__ */ jsxs("p", { className: "text-sm text-white", children: [
129
+ holding.quantity,
130
+ " shares @ $",
131
+ holding.averagePrice.toFixed(2),
132
+ " avg"
133
+ ] })
134
+ ] }),
135
+ /* @__PURE__ */ jsxs("div", { className: "mb-4 p-3 bg-white/5 rounded-lg", children: [
136
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-white/60 mb-1", children: "Current Price" }),
137
+ /* @__PURE__ */ jsxs("p", { className: "text-lg font-bold text-white", children: [
138
+ "$",
139
+ currentPrice.toFixed(2)
140
+ ] })
141
+ ] }),
142
+ /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
143
+ /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-white/80 mb-2", children: "Quantity (Shares)" }),
144
+ /* @__PURE__ */ jsx(
145
+ "input",
146
+ {
147
+ type: "number",
148
+ value: quantity,
149
+ onChange: (e) => setQuantity(e.target.value),
150
+ min: "1",
151
+ step: "1",
152
+ placeholder: "Enter quantity",
153
+ className: "w-full px-4 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder-white/40 focus:outline-none focus:border-success"
154
+ }
155
+ )
156
+ ] }),
157
+ quantity && parseFloat(quantity) > 0 && /* @__PURE__ */ jsx("div", { className: "mb-4 p-3 bg-white/5 rounded-lg", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
158
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-white/60", children: "Estimated Total" }),
159
+ /* @__PURE__ */ jsxs("span", { className: "text-lg font-bold text-white", children: [
160
+ "$",
161
+ (parseFloat(quantity) * currentPrice).toFixed(2)
162
+ ] })
163
+ ] }) }),
164
+ /* @__PURE__ */ jsx("div", { className: "mb-4 p-3 bg-white/5 rounded-lg", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
165
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-white/60", children: "Available Cash" }),
166
+ /* @__PURE__ */ jsxs("span", { className: "text-sm font-medium text-white", children: [
167
+ "$",
168
+ portfolio?.cash.toLocaleString() || "0"
169
+ ] })
170
+ ] }) }),
171
+ message && /* @__PURE__ */ jsx("div", { className: `mb-4 p-3 rounded-lg ${message.type === "success" ? "bg-success/20 text-success" : "bg-danger/20 text-danger"}`, children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: message.text }) }),
172
+ /* @__PURE__ */ jsxs(
173
+ "button",
174
+ {
175
+ onClick: executeTrade,
176
+ className: `w-full py-3 rounded-lg font-medium transition-all ${orderType === "buy" ? "bg-success hover:bg-success/90 text-white" : "bg-danger hover:bg-danger/90 text-white"}`,
177
+ children: [
178
+ orderType === "buy" ? "Buy" : "Sell",
179
+ " ",
180
+ symbol
181
+ ]
182
+ }
183
+ ),
184
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-white/40 text-center mt-4", children: "This is a demo account. No real money is at risk." })
185
+ ] });
186
+ }
187
+ __name(TradingPanel, "TradingPanel");
188
+
189
+ export { TradingPanel };