@hanzo/ui 5.3.19 → 5.3.22

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