@hanzo/ui 8.27.9 → 8.27.11
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/backends/gui/3d-card.cjs +100 -0
- package/dist/backends/gui/3d-card.d.ts +59 -0
- package/dist/backends/gui/3d-card.d.ts.map +1 -0
- package/dist/backends/gui/3d-card.js +92 -0
- package/dist/backends/gui/3d-card.js.map +1 -0
- package/dist/backends/gui/3d-marquee.cjs +225 -0
- package/dist/backends/gui/3d-marquee.d.ts +114 -0
- package/dist/backends/gui/3d-marquee.d.ts.map +1 -0
- package/dist/backends/gui/3d-marquee.js +190 -0
- package/dist/backends/gui/3d-marquee.js.map +1 -0
- package/dist/backends/gui/3d-pin.cjs +51 -0
- package/dist/backends/gui/3d-pin.d.ts +14 -0
- package/dist/backends/gui/3d-pin.d.ts.map +1 -0
- package/dist/backends/gui/3d-pin.js +49 -0
- package/dist/backends/gui/3d-pin.js.map +1 -0
- package/dist/backends/gui/advanced-chart.cjs +61 -0
- package/dist/backends/gui/advanced-chart.d.ts +38 -0
- package/dist/backends/gui/advanced-chart.d.ts.map +1 -0
- package/dist/backends/gui/advanced-chart.js +59 -0
- package/dist/backends/gui/advanced-chart.js.map +1 -0
- package/dist/backends/gui/alert.cjs +106 -0
- package/dist/backends/gui/alert.d.ts +39 -0
- package/dist/backends/gui/alert.d.ts.map +1 -0
- package/dist/backends/gui/alert.js +102 -0
- package/dist/backends/gui/alert.js.map +1 -0
- package/dist/backends/gui/android.cjs +52 -0
- package/dist/backends/gui/android.d.ts +16 -0
- package/dist/backends/gui/android.d.ts.map +1 -0
- package/dist/backends/gui/android.js +50 -0
- package/dist/backends/gui/android.js.map +1 -0
- package/dist/backends/gui/animated-beam.cjs +97 -0
- package/dist/backends/gui/animated-beam.d.ts +57 -0
- package/dist/backends/gui/animated-beam.d.ts.map +1 -0
- package/dist/backends/gui/animated-beam.js +62 -0
- package/dist/backends/gui/animated-beam.js.map +1 -0
- package/dist/backends/gui/animated-cursor.cjs +183 -0
- package/dist/backends/gui/animated-cursor.d.ts +42 -0
- package/dist/backends/gui/animated-cursor.d.ts.map +1 -0
- package/dist/backends/gui/animated-cursor.js +181 -0
- package/dist/backends/gui/animated-cursor.js.map +1 -0
- package/dist/backends/gui/animated-testimonials.cjs +109 -0
- package/dist/backends/gui/animated-testimonials.d.ts +23 -0
- package/dist/backends/gui/animated-testimonials.d.ts.map +1 -0
- package/dist/backends/gui/animated-testimonials.js +74 -0
- package/dist/backends/gui/animated-testimonials.js.map +1 -0
- package/dist/backends/gui/animated-tooltip.cjs +100 -0
- package/dist/backends/gui/animated-tooltip.d.ts +15 -0
- package/dist/backends/gui/animated-tooltip.d.ts.map +1 -0
- package/dist/backends/gui/animated-tooltip.js +65 -0
- package/dist/backends/gui/animated-tooltip.js.map +1 -0
- package/dist/backends/gui/announcement.cjs +54 -0
- package/dist/backends/gui/announcement.d.ts +26 -0
- package/dist/backends/gui/announcement.d.ts.map +1 -0
- package/dist/backends/gui/announcement.js +52 -0
- package/dist/backends/gui/announcement.js.map +1 -0
- package/dist/backends/gui/apple-cards-carousel.cjs +198 -0
- package/dist/backends/gui/apple-cards-carousel.d.ts +45 -0
- package/dist/backends/gui/apple-cards-carousel.d.ts.map +1 -0
- package/dist/backends/gui/apple-cards-carousel.js +162 -0
- package/dist/backends/gui/apple-cards-carousel.js.map +1 -0
- package/dist/backends/gui/apple-hello-effect.cjs +38 -0
- package/dist/backends/gui/apple-hello-effect.d.ts +9 -0
- package/dist/backends/gui/apple-hello-effect.d.ts.map +1 -0
- package/dist/backends/gui/apple-hello-effect.js +36 -0
- package/dist/backends/gui/apple-hello-effect.js.map +1 -0
- package/dist/backends/gui/banner.cjs +108 -0
- package/dist/backends/gui/banner.d.ts +33 -0
- package/dist/backends/gui/banner.d.ts.map +1 -0
- package/dist/backends/gui/banner.js +106 -0
- package/dist/backends/gui/banner.js.map +1 -0
- package/dist/backends/gui/calendar.cjs +152 -0
- package/dist/backends/gui/calendar.d.ts +41 -0
- package/dist/backends/gui/calendar.d.ts.map +1 -0
- package/dist/backends/gui/calendar.js +151 -0
- package/dist/backends/gui/calendar.js.map +1 -0
- package/dist/backends/gui/choicebox.cjs +50 -0
- package/dist/backends/gui/choicebox.d.ts +33 -0
- package/dist/backends/gui/choicebox.d.ts.map +1 -0
- package/dist/backends/gui/choicebox.js +49 -0
- package/dist/backends/gui/choicebox.js.map +1 -0
- package/dist/backends/gui/code-block.cjs +120 -0
- package/dist/backends/gui/code-block.d.ts +22 -0
- package/dist/backends/gui/code-block.d.ts.map +1 -0
- package/dist/backends/gui/code-block.js +118 -0
- package/dist/backends/gui/code-block.js.map +1 -0
- package/dist/backends/gui/code-editor.cjs +195 -0
- package/dist/backends/gui/code-editor.d.ts +43 -0
- package/dist/backends/gui/code-editor.d.ts.map +1 -0
- package/dist/backends/gui/code-editor.js +160 -0
- package/dist/backends/gui/code-editor.js.map +1 -0
- package/dist/backends/gui/code-tabs.cjs +21 -0
- package/dist/backends/gui/code-tabs.d.ts +22 -0
- package/dist/backends/gui/code-tabs.d.ts.map +1 -0
- package/dist/backends/gui/code-tabs.js +19 -0
- package/dist/backends/gui/code-tabs.js.map +1 -0
- package/dist/backends/gui/color-picker.cjs +141 -0
- package/dist/backends/gui/color-picker.d.ts +25 -0
- package/dist/backends/gui/color-picker.d.ts.map +1 -0
- package/dist/backends/gui/color-picker.js +139 -0
- package/dist/backends/gui/color-picker.js.map +1 -0
- package/dist/backends/gui/combobox.cjs +42 -0
- package/dist/backends/gui/combobox.d.ts +39 -0
- package/dist/backends/gui/combobox.d.ts.map +1 -0
- package/dist/backends/gui/combobox.js +40 -0
- package/dist/backends/gui/combobox.js.map +1 -0
- package/dist/backends/gui/company-profile.cjs +43 -0
- package/dist/backends/gui/company-profile.d.ts +33 -0
- package/dist/backends/gui/company-profile.d.ts.map +1 -0
- package/dist/backends/gui/company-profile.js +41 -0
- package/dist/backends/gui/company-profile.js.map +1 -0
- package/dist/backends/gui/comparison.cjs +39 -0
- package/dist/backends/gui/comparison.d.ts +15 -0
- package/dist/backends/gui/comparison.d.ts.map +1 -0
- package/dist/backends/gui/comparison.js +37 -0
- package/dist/backends/gui/comparison.js.map +1 -0
- package/dist/backends/gui/credit-card.cjs +80 -0
- package/dist/backends/gui/credit-card.d.ts +21 -0
- package/dist/backends/gui/credit-card.d.ts.map +1 -0
- package/dist/backends/gui/credit-card.js +78 -0
- package/dist/backends/gui/credit-card.js.map +1 -0
- package/dist/backends/gui/crypto-market.cjs +128 -0
- package/dist/backends/gui/crypto-market.d.ts +52 -0
- package/dist/backends/gui/crypto-market.d.ts.map +1 -0
- package/dist/backends/gui/crypto-market.js +126 -0
- package/dist/backends/gui/crypto-market.js.map +1 -0
- package/dist/backends/gui/crypto-screener.cjs +45 -0
- package/dist/backends/gui/crypto-screener.d.ts +38 -0
- package/dist/backends/gui/crypto-screener.d.ts.map +1 -0
- package/dist/backends/gui/crypto-screener.js +43 -0
- package/dist/backends/gui/crypto-screener.js.map +1 -0
- package/dist/backends/gui/cursor.cjs +37 -0
- package/dist/backends/gui/cursor.d.ts +17 -0
- package/dist/backends/gui/cursor.d.ts.map +1 -0
- package/dist/backends/gui/cursor.js +35 -0
- package/dist/backends/gui/cursor.js.map +1 -0
- package/dist/backends/gui/data-table.cjs +171 -0
- package/dist/backends/gui/data-table.d.ts +91 -0
- package/dist/backends/gui/data-table.d.ts.map +1 -0
- package/dist/backends/gui/data-table.js +169 -0
- package/dist/backends/gui/data-table.js.map +1 -0
- package/dist/backends/gui/date-picker.cjs +66 -0
- package/dist/backends/gui/date-picker.d.ts +29 -0
- package/dist/backends/gui/date-picker.d.ts.map +1 -0
- package/dist/backends/gui/date-picker.js +64 -0
- package/dist/backends/gui/date-picker.js.map +1 -0
- package/dist/backends/gui/desktop-spotlight.cjs +46 -0
- package/dist/backends/gui/desktop-spotlight.d.ts +34 -0
- package/dist/backends/gui/desktop-spotlight.d.ts.map +1 -0
- package/dist/backends/gui/desktop-spotlight.js +44 -0
- package/dist/backends/gui/desktop-spotlight.js.map +1 -0
- package/dist/backends/gui/desktop-window.cjs +180 -0
- package/dist/backends/gui/desktop-window.d.ts +51 -0
- package/dist/backends/gui/desktop-window.d.ts.map +1 -0
- package/dist/backends/gui/desktop-window.js +177 -0
- package/dist/backends/gui/desktop-window.js.map +1 -0
- package/dist/backends/gui/desktop.cjs +238 -0
- package/dist/backends/gui/desktop.d.ts +109 -0
- package/dist/backends/gui/desktop.d.ts.map +1 -0
- package/dist/backends/gui/desktop.js +199 -0
- package/dist/backends/gui/desktop.js.map +1 -0
- package/dist/backends/gui/dialog-stack.cjs +26 -0
- package/dist/backends/gui/dialog-stack.d.ts +23 -0
- package/dist/backends/gui/dialog-stack.d.ts.map +1 -0
- package/dist/backends/gui/dialog-stack.js +24 -0
- package/dist/backends/gui/dialog-stack.js.map +1 -0
- package/dist/backends/gui/dock.cjs +99 -0
- package/dist/backends/gui/dock.d.ts +41 -0
- package/dist/backends/gui/dock.d.ts.map +1 -0
- package/dist/backends/gui/dock.js +96 -0
- package/dist/backends/gui/dock.js.map +1 -0
- package/dist/backends/gui/dropzone.cjs +142 -0
- package/dist/backends/gui/dropzone.d.ts +12 -0
- package/dist/backends/gui/dropzone.d.ts.map +1 -0
- package/dist/backends/gui/dropzone.js +140 -0
- package/dist/backends/gui/dropzone.js.map +1 -0
- package/dist/backends/gui/editor.cjs +84 -0
- package/dist/backends/gui/editor.d.ts +23 -0
- package/dist/backends/gui/editor.d.ts.map +1 -0
- package/dist/backends/gui/editor.js +49 -0
- package/dist/backends/gui/editor.js.map +1 -0
- package/dist/backends/gui/empty.cjs +71 -0
- package/dist/backends/gui/empty.d.ts +43 -0
- package/dist/backends/gui/empty.d.ts.map +1 -0
- package/dist/backends/gui/empty.js +63 -0
- package/dist/backends/gui/empty.js.map +1 -0
- package/dist/backends/gui/field.cjs +132 -0
- package/dist/backends/gui/field.d.ts +74 -0
- package/dist/backends/gui/field.d.ts.map +1 -0
- package/dist/backends/gui/field.js +121 -0
- package/dist/backends/gui/field.js.map +1 -0
- package/dist/backends/gui/financials.cjs +45 -0
- package/dist/backends/gui/financials.d.ts +36 -0
- package/dist/backends/gui/financials.d.ts.map +1 -0
- package/dist/backends/gui/financials.js +43 -0
- package/dist/backends/gui/financials.js.map +1 -0
- package/dist/backends/gui/forex-market.cjs +21 -0
- package/dist/backends/gui/forex-market.d.ts +17 -0
- package/dist/backends/gui/forex-market.d.ts.map +1 -0
- package/dist/backends/gui/forex-market.js +19 -0
- package/dist/backends/gui/forex-market.js.map +1 -0
- package/dist/backends/gui/forex-screener.cjs +57 -0
- package/dist/backends/gui/forex-screener.d.ts +45 -0
- package/dist/backends/gui/forex-screener.d.ts.map +1 -0
- package/dist/backends/gui/forex-screener.js +55 -0
- package/dist/backends/gui/forex-screener.js.map +1 -0
- package/dist/backends/gui/gantt.cjs +48 -0
- package/dist/backends/gui/gantt.d.ts +18 -0
- package/dist/backends/gui/gantt.d.ts.map +1 -0
- package/dist/backends/gui/gantt.js +46 -0
- package/dist/backends/gui/gantt.js.map +1 -0
- package/dist/backends/gui/glimpse.cjs +88 -0
- package/dist/backends/gui/glimpse.d.ts +57 -0
- package/dist/backends/gui/glimpse.d.ts.map +1 -0
- package/dist/backends/gui/glimpse.js +81 -0
- package/dist/backends/gui/glimpse.js.map +1 -0
- package/dist/backends/gui/grid-pattern.cjs +119 -0
- package/dist/backends/gui/grid-pattern.d.ts +96 -0
- package/dist/backends/gui/grid-pattern.d.ts.map +1 -0
- package/dist/backends/gui/grid-pattern.js +84 -0
- package/dist/backends/gui/grid-pattern.js.map +1 -0
- package/dist/backends/gui/image-crop.cjs +35 -0
- package/dist/backends/gui/image-crop.d.ts +20 -0
- package/dist/backends/gui/image-crop.d.ts.map +1 -0
- package/dist/backends/gui/image-crop.js +33 -0
- package/dist/backends/gui/image-crop.js.map +1 -0
- package/dist/backends/gui/image-zoom.cjs +58 -0
- package/dist/backends/gui/image-zoom.d.ts +16 -0
- package/dist/backends/gui/image-zoom.d.ts.map +1 -0
- package/dist/backends/gui/image-zoom.js +56 -0
- package/dist/backends/gui/image-zoom.js.map +1 -0
- package/dist/backends/gui/index.cjs +266 -1
- package/dist/backends/gui/index.d.ts +90 -0
- package/dist/backends/gui/index.d.ts.map +1 -1
- package/dist/backends/gui/index.js +90 -0
- package/dist/backends/gui/index.js.map +1 -1
- package/dist/backends/gui/interactive-grid-pattern.cjs +61 -0
- package/dist/backends/gui/interactive-grid-pattern.d.ts +28 -0
- package/dist/backends/gui/interactive-grid-pattern.d.ts.map +1 -0
- package/dist/backends/gui/interactive-grid-pattern.js +26 -0
- package/dist/backends/gui/interactive-grid-pattern.js.map +1 -0
- package/dist/backends/gui/iphone-15-pro.cjs +83 -0
- package/dist/backends/gui/iphone-15-pro.d.ts +16 -0
- package/dist/backends/gui/iphone-15-pro.d.ts.map +1 -0
- package/dist/backends/gui/iphone-15-pro.js +81 -0
- package/dist/backends/gui/iphone-15-pro.js.map +1 -0
- package/dist/backends/gui/item.cjs +154 -0
- package/dist/backends/gui/item.d.ts +72 -0
- package/dist/backends/gui/item.d.ts.map +1 -0
- package/dist/backends/gui/item.js +143 -0
- package/dist/backends/gui/item.js.map +1 -0
- package/dist/backends/gui/kanban.cjs +247 -0
- package/dist/backends/gui/kanban.d.ts +37 -0
- package/dist/backends/gui/kanban.d.ts.map +1 -0
- package/dist/backends/gui/kanban.js +212 -0
- package/dist/backends/gui/kanban.js.map +1 -0
- package/dist/backends/gui/kbd.cjs +45 -0
- package/dist/backends/gui/kbd.d.ts +8 -0
- package/dist/backends/gui/kbd.d.ts.map +1 -0
- package/dist/backends/gui/kbd.js +42 -0
- package/dist/backends/gui/kbd.js.map +1 -0
- package/dist/backends/gui/limelight-nav.cjs +201 -0
- package/dist/backends/gui/limelight-nav.d.ts +20 -0
- package/dist/backends/gui/limelight-nav.d.ts.map +1 -0
- package/dist/backends/gui/limelight-nav.js +166 -0
- package/dist/backends/gui/limelight-nav.js.map +1 -0
- package/dist/backends/gui/list.cjs +26 -0
- package/dist/backends/gui/list.d.ts +15 -0
- package/dist/backends/gui/list.d.ts.map +1 -0
- package/dist/backends/gui/list.js +23 -0
- package/dist/backends/gui/list.js.map +1 -0
- package/dist/backends/gui/macos-dock.cjs +84 -0
- package/dist/backends/gui/macos-dock.d.ts +30 -0
- package/dist/backends/gui/macos-dock.d.ts.map +1 -0
- package/dist/backends/gui/macos-dock.js +82 -0
- package/dist/backends/gui/macos-dock.js.map +1 -0
- package/dist/backends/gui/magnetic.cjs +40 -0
- package/dist/backends/gui/magnetic.d.ts +12 -0
- package/dist/backends/gui/magnetic.d.ts.map +1 -0
- package/dist/backends/gui/magnetic.js +38 -0
- package/dist/backends/gui/magnetic.js.map +1 -0
- package/dist/backends/gui/marquee.cjs +110 -0
- package/dist/backends/gui/marquee.d.ts +44 -0
- package/dist/backends/gui/marquee.d.ts.map +1 -0
- package/dist/backends/gui/marquee.js +75 -0
- package/dist/backends/gui/marquee.js.map +1 -0
- package/dist/backends/gui/menu-dock.cjs +64 -0
- package/dist/backends/gui/menu-dock.d.ts +21 -0
- package/dist/backends/gui/menu-dock.d.ts.map +1 -0
- package/dist/backends/gui/menu-dock.js +62 -0
- package/dist/backends/gui/menu-dock.js.map +1 -0
- package/dist/backends/gui/menubar.cjs +227 -0
- package/dist/backends/gui/menubar.d.ts +106 -0
- package/dist/backends/gui/menubar.d.ts.map +1 -0
- package/dist/backends/gui/menubar.js +177 -0
- package/dist/backends/gui/menubar.js.map +1 -0
- package/dist/backends/gui/message-dock.cjs +111 -0
- package/dist/backends/gui/message-dock.d.ts +22 -0
- package/dist/backends/gui/message-dock.d.ts.map +1 -0
- package/dist/backends/gui/message-dock.js +110 -0
- package/dist/backends/gui/message-dock.js.map +1 -0
- package/dist/backends/gui/mini-calendar.cjs +25 -0
- package/dist/backends/gui/mini-calendar.d.ts +22 -0
- package/dist/backends/gui/mini-calendar.d.ts.map +1 -0
- package/dist/backends/gui/mini-calendar.js +24 -0
- package/dist/backends/gui/mini-calendar.js.map +1 -0
- package/dist/backends/gui/minimal-tiptap.cjs +56 -0
- package/dist/backends/gui/minimal-tiptap.d.ts +20 -0
- package/dist/backends/gui/minimal-tiptap.d.ts.map +1 -0
- package/dist/backends/gui/minimal-tiptap.js +21 -0
- package/dist/backends/gui/minimal-tiptap.js.map +1 -0
- package/dist/backends/gui/motion-highlight.cjs +83 -0
- package/dist/backends/gui/motion-highlight.d.ts +27 -0
- package/dist/backends/gui/motion-highlight.d.ts.map +1 -0
- package/dist/backends/gui/motion-highlight.js +48 -0
- package/dist/backends/gui/motion-highlight.js.map +1 -0
- package/dist/backends/gui/navigation-bar.cjs +47 -0
- package/dist/backends/gui/navigation-bar.d.ts +48 -0
- package/dist/backends/gui/navigation-bar.d.ts.map +1 -0
- package/dist/backends/gui/navigation-bar.js +45 -0
- package/dist/backends/gui/navigation-bar.js.map +1 -0
- package/dist/backends/gui/news-timeline.cjs +47 -0
- package/dist/backends/gui/news-timeline.d.ts +39 -0
- package/dist/backends/gui/news-timeline.d.ts.map +1 -0
- package/dist/backends/gui/news-timeline.js +45 -0
- package/dist/backends/gui/news-timeline.js.map +1 -0
- package/dist/backends/gui/order-entry.cjs +53 -0
- package/dist/backends/gui/order-entry.d.ts +21 -0
- package/dist/backends/gui/order-entry.d.ts.map +1 -0
- package/dist/backends/gui/order-entry.js +52 -0
- package/dist/backends/gui/order-entry.js.map +1 -0
- package/dist/backends/gui/orders-history.cjs +102 -0
- package/dist/backends/gui/orders-history.d.ts +24 -0
- package/dist/backends/gui/orders-history.d.ts.map +1 -0
- package/dist/backends/gui/orders-history.js +67 -0
- package/dist/backends/gui/orders-history.js.map +1 -0
- package/dist/backends/gui/pagination.cjs +51 -0
- package/dist/backends/gui/pagination.d.ts +52 -0
- package/dist/backends/gui/pagination.d.ts.map +1 -0
- package/dist/backends/gui/pagination.js +42 -0
- package/dist/backends/gui/pagination.js.map +1 -0
- package/dist/backends/gui/particles-background.cjs +135 -0
- package/dist/backends/gui/particles-background.d.ts +24 -0
- package/dist/backends/gui/particles-background.d.ts.map +1 -0
- package/dist/backends/gui/particles-background.js +133 -0
- package/dist/backends/gui/particles-background.js.map +1 -0
- package/dist/backends/gui/particles.cjs +145 -0
- package/dist/backends/gui/particles.d.ts +25 -0
- package/dist/backends/gui/particles.d.ts.map +1 -0
- package/dist/backends/gui/particles.js +143 -0
- package/dist/backends/gui/particles.js.map +1 -0
- package/dist/backends/gui/pill.cjs +82 -0
- package/dist/backends/gui/pill.d.ts +12 -0
- package/dist/backends/gui/pill.d.ts.map +1 -0
- package/dist/backends/gui/pill.js +78 -0
- package/dist/backends/gui/pill.js.map +1 -0
- package/dist/backends/gui/pin-list.cjs +82 -0
- package/dist/backends/gui/pin-list.d.ts +42 -0
- package/dist/backends/gui/pin-list.d.ts.map +1 -0
- package/dist/backends/gui/pin-list.js +80 -0
- package/dist/backends/gui/pin-list.js.map +1 -0
- package/dist/backends/gui/pixel-image.cjs +63 -0
- package/dist/backends/gui/pixel-image.d.ts +21 -0
- package/dist/backends/gui/pixel-image.d.ts.map +1 -0
- package/dist/backends/gui/pixel-image.js +61 -0
- package/dist/backends/gui/pixel-image.js.map +1 -0
- package/dist/backends/gui/positions-list.cjs +60 -0
- package/dist/backends/gui/positions-list.d.ts +14 -0
- package/dist/backends/gui/positions-list.d.ts.map +1 -0
- package/dist/backends/gui/positions-list.js +58 -0
- package/dist/backends/gui/positions-list.js.map +1 -0
- package/dist/backends/gui/qr-code.cjs +438 -0
- package/dist/backends/gui/qr-code.d.ts +42 -0
- package/dist/backends/gui/qr-code.d.ts.map +1 -0
- package/dist/backends/gui/qr-code.js +402 -0
- package/dist/backends/gui/qr-code.js.map +1 -0
- package/dist/backends/gui/relative-time.cjs +167 -0
- package/dist/backends/gui/relative-time.d.ts +10 -0
- package/dist/backends/gui/relative-time.d.ts.map +1 -0
- package/dist/backends/gui/relative-time.js +132 -0
- package/dist/backends/gui/relative-time.js.map +1 -0
- package/dist/backends/gui/safari.cjs +65 -0
- package/dist/backends/gui/safari.d.ts +23 -0
- package/dist/backends/gui/safari.d.ts.map +1 -0
- package/dist/backends/gui/safari.js +63 -0
- package/dist/backends/gui/safari.js.map +1 -0
- package/dist/backends/gui/snippet.cjs +144 -0
- package/dist/backends/gui/snippet.d.ts +38 -0
- package/dist/backends/gui/snippet.d.ts.map +1 -0
- package/dist/backends/gui/snippet.js +141 -0
- package/dist/backends/gui/snippet.js.map +1 -0
- package/dist/backends/gui/stars-scrolling-wheel.cjs +106 -0
- package/dist/backends/gui/stars-scrolling-wheel.d.ts +24 -0
- package/dist/backends/gui/stars-scrolling-wheel.d.ts.map +1 -0
- package/dist/backends/gui/stars-scrolling-wheel.js +104 -0
- package/dist/backends/gui/stars-scrolling-wheel.js.map +1 -0
- package/dist/backends/gui/status.cjs +79 -0
- package/dist/backends/gui/status.d.ts +15 -0
- package/dist/backends/gui/status.d.ts.map +1 -0
- package/dist/backends/gui/status.js +77 -0
- package/dist/backends/gui/status.js.map +1 -0
- package/dist/backends/gui/stock-market.cjs +21 -0
- package/dist/backends/gui/stock-market.d.ts +17 -0
- package/dist/backends/gui/stock-market.d.ts.map +1 -0
- package/dist/backends/gui/stock-market.js +19 -0
- package/dist/backends/gui/stock-market.js.map +1 -0
- package/dist/backends/gui/stock-screener.cjs +55 -0
- package/dist/backends/gui/stock-screener.d.ts +41 -0
- package/dist/backends/gui/stock-screener.d.ts.map +1 -0
- package/dist/backends/gui/stock-screener.js +53 -0
- package/dist/backends/gui/stock-screener.js.map +1 -0
- package/dist/backends/gui/symbol-info.cjs +46 -0
- package/dist/backends/gui/symbol-info.d.ts +36 -0
- package/dist/backends/gui/symbol-info.d.ts.map +1 -0
- package/dist/backends/gui/symbol-info.js +44 -0
- package/dist/backends/gui/symbol-info.js.map +1 -0
- package/dist/backends/gui/table.cjs +104 -0
- package/dist/backends/gui/table.d.ts +57 -0
- package/dist/backends/gui/table.d.ts.map +1 -0
- package/dist/backends/gui/table.js +95 -0
- package/dist/backends/gui/table.js.map +1 -0
- package/dist/backends/gui/tags.cjs +22 -0
- package/dist/backends/gui/tags.d.ts +22 -0
- package/dist/backends/gui/tags.d.ts.map +1 -0
- package/dist/backends/gui/tags.js +20 -0
- package/dist/backends/gui/tags.js.map +1 -0
- package/dist/backends/gui/technical-analysis.cjs +58 -0
- package/dist/backends/gui/technical-analysis.d.ts +41 -0
- package/dist/backends/gui/technical-analysis.d.ts.map +1 -0
- package/dist/backends/gui/technical-analysis.js +56 -0
- package/dist/backends/gui/technical-analysis.js.map +1 -0
- package/dist/backends/gui/terminal.cjs +266 -0
- package/dist/backends/gui/terminal.d.ts +38 -0
- package/dist/backends/gui/terminal.d.ts.map +1 -0
- package/dist/backends/gui/terminal.js +231 -0
- package/dist/backends/gui/terminal.js.map +1 -0
- package/dist/backends/gui/ticker.cjs +79 -0
- package/dist/backends/gui/ticker.d.ts +19 -0
- package/dist/backends/gui/ticker.d.ts.map +1 -0
- package/dist/backends/gui/ticker.js +44 -0
- package/dist/backends/gui/ticker.js.map +1 -0
- package/dist/backends/gui/timeline.cjs +154 -0
- package/dist/backends/gui/timeline.d.ts +42 -0
- package/dist/backends/gui/timeline.d.ts.map +1 -0
- package/dist/backends/gui/timeline.js +118 -0
- package/dist/backends/gui/timeline.js.map +1 -0
- package/dist/backends/gui/toggle.cjs +96 -0
- package/dist/backends/gui/toggle.d.ts +29 -0
- package/dist/backends/gui/toggle.d.ts.map +1 -0
- package/dist/backends/gui/toggle.js +95 -0
- package/dist/backends/gui/toggle.js.map +1 -0
- package/dist/backends/gui/video-player.cjs +383 -0
- package/dist/backends/gui/video-player.d.ts +54 -0
- package/dist/backends/gui/video-player.d.ts.map +1 -0
- package/dist/backends/gui/video-player.js +348 -0
- package/dist/backends/gui/video-player.js.map +1 -0
- package/dist/chat/Composer.cjs +10 -10
- package/dist/chat/Composer.d.ts +16 -17
- package/dist/chat/Composer.d.ts.map +1 -1
- package/dist/chat/Composer.js +11 -11
- package/dist/chat/Composer.js.map +1 -1
- package/dist/gallery.cjs +180 -1
- package/dist/gallery.d.ts.map +1 -1
- package/dist/gallery.html +391 -3
- package/dist/gallery.js +181 -2
- package/dist/gallery.js.map +1 -1
- package/dist/index.cjs +179 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/index.node.cjs +179 -1
- package/dist/index.node.js +3 -0
- package/dist/styles.css +356 -0
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* NewsTimeline — a TradingView news feed, in a gui frame.
|
|
5
|
+
*
|
|
6
|
+
* The headlines are TradingView's, drawn inside TradingView's own document, so
|
|
7
|
+
* the feed is an `<iframe>` and nothing here draws a pixel of it. What this
|
|
8
|
+
* owns is the frame around it and the settings the feed opens with — which
|
|
9
|
+
* mode it filters by, which market or symbol that mode reads, the theme —
|
|
10
|
+
* written into the iframe's address the way TradingView's own embed script
|
|
11
|
+
* writes them: `/embed-widget/timeline/?locale=…#<settings as JSON>`. Nothing
|
|
12
|
+
* is fetched or injected at mount, so the markup is the same on the server and
|
|
13
|
+
* in the browser, and the frame has its height before the feed arrives.
|
|
14
|
+
*
|
|
15
|
+
* `feedMode` picks what narrows the headlines: `all_symbols` takes none of
|
|
16
|
+
* `market`/`symbol`, `market` reads `market`, and `symbol` reads `symbol`.
|
|
17
|
+
*
|
|
18
|
+
* The iframe is keyed on that address. A browser treats a `src` that differs
|
|
19
|
+
* only in its fragment as a same-document navigation and does not reload, so
|
|
20
|
+
* without the key a changed prop would leave the old feed on screen.
|
|
21
|
+
*/
|
|
22
|
+
import { YStack, isWeb } from '@hanzo/gui';
|
|
23
|
+
import { slot } from './slot.js';
|
|
24
|
+
const EMBED = 'https://www.tradingview-widget.com/embed-widget/timeline/?locale=';
|
|
25
|
+
/** The settings TradingView reads, with the documented defaults filled in. */
|
|
26
|
+
const settings = ({ feedMode = 'all_symbols', market = 'crypto', symbol, width = '100%', height = 400, colorTheme = 'dark', isTransparent = false, }) => ({
|
|
27
|
+
displayMode: 'regular',
|
|
28
|
+
feedMode,
|
|
29
|
+
...(feedMode === 'market' ? { market } : {}),
|
|
30
|
+
...(feedMode === 'symbol' ? { symbol: symbol ?? '' } : {}),
|
|
31
|
+
colorTheme,
|
|
32
|
+
isTransparent,
|
|
33
|
+
width,
|
|
34
|
+
height,
|
|
35
|
+
});
|
|
36
|
+
const NewsTimeline = ({ feedMode, market, symbol, width, height, colorTheme, locale = 'en', isTransparent, ...props }) => {
|
|
37
|
+
const s = settings({ feedMode, market, symbol, width, height, colorTheme, isTransparent });
|
|
38
|
+
const src = `${EMBED}${locale}#${encodeURIComponent(JSON.stringify(s))}`;
|
|
39
|
+
return (_jsx(YStack, { ...slot('news-timeline'), "data-feed-mode": s.feedMode, "data-color-theme": s.colorTheme,
|
|
40
|
+
// The documented size is TradingView's — a number or a percent string —
|
|
41
|
+
// and gui declares a narrower one; on web both reach CSS as written.
|
|
42
|
+
width: s.width, height: s.height, overflow: "hidden", position: "relative", bg: "$panel", ...props, children: isWeb && (_jsx("iframe", { src: src, title: "News timeline", loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
|
|
43
|
+
};
|
|
44
|
+
export { NewsTimeline };
|
|
45
|
+
//# sourceMappingURL=news-timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"news-timeline.js","sourceRoot":"","sources":["../../../src/backends/gui/news-timeline.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAoB,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAqB7B,MAAM,KAAK,GAAG,mEAAmE,CAAA;AAEjF,8EAA8E;A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AAC,UAAU,EACnB,EAAE,EAAC,QAAQ,KACP,KAAK,YAER,KAAK,IAAI,CACR,iBAEE,GAAG,EAAE,GAAG,EACR,KAAK,EAAC,eAAe,EACrB,OAAO,EAAC,MAAM,EACd,SAAS,EAAC,IAAI,EACd,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,IALhE,GAAG,CAMR,CACH,GACM,CACV,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.OrderEntry = OrderEntry;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* OrderEntry — a trading ticket: buying power, buy/sell side, market/limit
|
|
8
|
+
* type, a share count and, for a limit order, a limit price, ending in one
|
|
9
|
+
* submit button that reads the side and the ticker back to the trader.
|
|
10
|
+
*
|
|
11
|
+
* The two segmented rows (side, order type) are `Grid` with two equal tracks
|
|
12
|
+
* rather than a stack, matching the two-dimensional layout the original
|
|
13
|
+
* markup used (`grid-cols-2`) instead of approximating it with flex.
|
|
14
|
+
*/
|
|
15
|
+
const gui_1 = require("@hanzo/gui");
|
|
16
|
+
const react_1 = require("react");
|
|
17
|
+
const grid_1 = require("../../grid.cjs");
|
|
18
|
+
const button_1 = require("./button.cjs");
|
|
19
|
+
const input_1 = require("./input.cjs");
|
|
20
|
+
const label_1 = require("./label.cjs");
|
|
21
|
+
const slot_1 = require("./slot.cjs");
|
|
22
|
+
const ticker = (symbol) => symbol.split(':')[1] || symbol;
|
|
23
|
+
const SIDE_ON = { buy: '$green9', sell: '$red9' };
|
|
24
|
+
function OrderEntry({ symbol = 'NASDAQ:AAPL', accountBalance = 10000, onPlaceOrder = () => { }, disabled = false, }) {
|
|
25
|
+
const [orderType, setOrderType] = (0, react_1.useState)('market');
|
|
26
|
+
const [orderSide, setOrderSide] = (0, react_1.useState)('buy');
|
|
27
|
+
const [shares, setShares] = (0, react_1.useState)('');
|
|
28
|
+
const [limitPrice, setLimitPrice] = (0, react_1.useState)('');
|
|
29
|
+
const canSubmit = !disabled && !!shares && (orderType !== 'limit' || !!limitPrice);
|
|
30
|
+
const submit = () => {
|
|
31
|
+
if (!canSubmit)
|
|
32
|
+
return;
|
|
33
|
+
onPlaceOrder({
|
|
34
|
+
symbol,
|
|
35
|
+
side: orderSide,
|
|
36
|
+
orderType,
|
|
37
|
+
shares: parseInt(shares, 10),
|
|
38
|
+
limitPrice: orderType === 'limit' ? parseFloat(limitPrice) : undefined,
|
|
39
|
+
});
|
|
40
|
+
setShares('');
|
|
41
|
+
setLimitPrice('');
|
|
42
|
+
};
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('order-entry'), p: "$4", gap: "$4", children: [(0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('order-entry-balance'), bg: "$hover", rounded: "$3", p: "$3", children: [(0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$1", color: "$quiet", mb: "$1", children: "Buying Power" }), (0, jsx_runtime_1.jsxs)(gui_1.SizableText, { size: "$5", fontWeight: "600", color: "$ink", children: ["$", accountBalance.toLocaleString()] })] }), (0, jsx_runtime_1.jsx)(grid_1.Grid, { ...(0, slot_1.slot)('order-entry-side'), columns: 2, gap: "$2", children: ['buy', 'sell'].map((side) => ((0, jsx_runtime_1.jsx)(grid_1.Cell, { children: (0, jsx_runtime_1.jsx)(button_1.Button, { ...(0, slot_1.slot)('order-entry-side-option'), "data-state": orderSide === side ? 'on' : 'off', role: "radio", "aria-checked": orderSide === side, variant: "ghost", width: "100%", disabled: disabled, onPress: () => setOrderSide(side), bg: orderSide === side ? SIDE_ON[side] : '$hover',
|
|
44
|
+
// `color` reaches Button.Frame through gui's own text-context —
|
|
45
|
+
// applied at runtime but never declared on the Frame's own prop
|
|
46
|
+
// type, the same gap `toggle-group.tsx` casts around elsewhere.
|
|
47
|
+
// @ts-expect-error color is a real, working prop the Frame's type omits
|
|
48
|
+
color: orderSide === side ? '$white1' : '$quiet', hoverStyle: orderSide === side ? { bg: SIDE_ON[side] } : { bg: '$edge' }, fontWeight: "600", children: side === 'buy' ? 'Buy' : 'Sell' }) }, side))) }), (0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('order-entry-type'), gap: "$2", children: [(0, jsx_runtime_1.jsx)(label_1.Label, { children: "Order Type" }), (0, jsx_runtime_1.jsx)(grid_1.Grid, { columns: 2, gap: "$2", children: ['market', 'limit'].map((kind) => ((0, jsx_runtime_1.jsx)(grid_1.Cell, { children: (0, jsx_runtime_1.jsx)(button_1.Button, { ...(0, slot_1.slot)('order-entry-type-option'), "data-state": orderType === kind ? 'on' : 'off', role: "radio", "aria-checked": orderType === kind, variant: "ghost", size: "sm", width: "100%", disabled: disabled, onPress: () => setOrderType(kind), bg: orderType === kind ? '$rim' : '$hover',
|
|
49
|
+
// @ts-expect-error color is a real, working prop the Frame's type omits
|
|
50
|
+
color: orderType === kind ? '$ink' : '$quiet', hoverStyle: orderType === kind ? { bg: '$rim' } : { bg: '$edge' }, children: kind === 'market' ? 'Market' : 'Limit' }) }, kind))) })] }), (0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('order-entry-shares'), gap: "$2", children: [(0, jsx_runtime_1.jsx)(label_1.Label, { htmlFor: "order-entry-shares-input", children: "Shares" }), (0, jsx_runtime_1.jsx)(input_1.Input, { id: "order-entry-shares-input", type: "number", placeholder: "0", value: shares, onChangeText: setShares, disabled: disabled })] }), orderType === 'limit' && ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('order-entry-limit-price'), gap: "$2", children: [(0, jsx_runtime_1.jsx)(label_1.Label, { htmlFor: "order-entry-limit-price-input", children: "Limit Price" }), (0, jsx_runtime_1.jsx)(input_1.Input, { id: "order-entry-limit-price-input", type: "number", step: "0.01", placeholder: "0.00", value: limitPrice, onChangeText: setLimitPrice, disabled: disabled })] })), (0, jsx_runtime_1.jsxs)(button_1.Button, { ...(0, slot_1.slot)('order-entry-submit'), variant: "ghost", size: "lg", width: "100%", disabled: !canSubmit, onPress: submit, bg: SIDE_ON[orderSide],
|
|
51
|
+
// @ts-expect-error color is a real, working prop the Frame's type omits
|
|
52
|
+
color: "$white1", fontWeight: "600", hoverStyle: { bg: SIDE_ON[orderSide], opacity: 0.9 }, children: [orderSide === 'buy' ? 'Buy' : 'Sell', " ", ticker(symbol)] })] }));
|
|
53
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type OrderSide = 'buy' | 'sell';
|
|
2
|
+
export type OrderKind = 'market' | 'limit';
|
|
3
|
+
export interface PlacedOrder {
|
|
4
|
+
symbol: string;
|
|
5
|
+
side: OrderSide;
|
|
6
|
+
orderType: OrderKind;
|
|
7
|
+
shares: number;
|
|
8
|
+
limitPrice?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface OrderEntryProps {
|
|
11
|
+
/** Trading symbol, e.g. `"NASDAQ:AAPL"`. The part after `:` is the ticker shown on the submit button. */
|
|
12
|
+
symbol?: string;
|
|
13
|
+
/** Buying power shown at the top of the ticket. */
|
|
14
|
+
accountBalance?: number;
|
|
15
|
+
/** Fired with the composed order when the trader submits it; the form then clears. */
|
|
16
|
+
onPlaceOrder?: (order: PlacedOrder) => void;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare function OrderEntry({ symbol, accountBalance, onPlaceOrder, disabled, }: OrderEntryProps): import("react").JSX.Element;
|
|
20
|
+
export { OrderEntry };
|
|
21
|
+
//# sourceMappingURL=order-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-entry.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/order-entry.tsx"],"names":[],"mappings":"AAmBA,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAA;AACtC,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE1C,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,SAAS,CAAA;IACf,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,yGAAyG;IACzG,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mDAAmD;IACnD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,sFAAsF;IACtF,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAMD,iBAAS,UAAU,CAAC,EAClB,MAAsB,EACtB,cAAsB,EACtB,YAAuB,EACvB,QAAgB,GACjB,EAAE,eAAe,+BAkIjB;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* OrderEntry — a trading ticket: buying power, buy/sell side, market/limit
|
|
5
|
+
* type, a share count and, for a limit order, a limit price, ending in one
|
|
6
|
+
* submit button that reads the side and the ticker back to the trader.
|
|
7
|
+
*
|
|
8
|
+
* The two segmented rows (side, order type) are `Grid` with two equal tracks
|
|
9
|
+
* rather than a stack, matching the two-dimensional layout the original
|
|
10
|
+
* markup used (`grid-cols-2`) instead of approximating it with flex.
|
|
11
|
+
*/
|
|
12
|
+
import { SizableText, YStack } from '@hanzo/gui';
|
|
13
|
+
import { useState } from 'react';
|
|
14
|
+
import { Grid, Cell } from '../../grid.js';
|
|
15
|
+
import { Button } from './button.js';
|
|
16
|
+
import { Input } from './input.js';
|
|
17
|
+
import { Label } from './label.js';
|
|
18
|
+
import { slot } from './slot.js';
|
|
19
|
+
const ticker = (symbol) => symbol.split(':')[1] || symbol;
|
|
20
|
+
const SIDE_ON = { buy: '$green9', sell: '$red9' };
|
|
21
|
+
function OrderEntry({ symbol = 'NASDAQ:AAPL', accountBalance = 10000, onPlaceOrder = () => { }, disabled = false, }) {
|
|
22
|
+
const [orderType, setOrderType] = useState('market');
|
|
23
|
+
const [orderSide, setOrderSide] = useState('buy');
|
|
24
|
+
const [shares, setShares] = useState('');
|
|
25
|
+
const [limitPrice, setLimitPrice] = useState('');
|
|
26
|
+
const canSubmit = !disabled && !!shares && (orderType !== 'limit' || !!limitPrice);
|
|
27
|
+
const submit = () => {
|
|
28
|
+
if (!canSubmit)
|
|
29
|
+
return;
|
|
30
|
+
onPlaceOrder({
|
|
31
|
+
symbol,
|
|
32
|
+
side: orderSide,
|
|
33
|
+
orderType,
|
|
34
|
+
shares: parseInt(shares, 10),
|
|
35
|
+
limitPrice: orderType === 'limit' ? parseFloat(limitPrice) : undefined,
|
|
36
|
+
});
|
|
37
|
+
setShares('');
|
|
38
|
+
setLimitPrice('');
|
|
39
|
+
};
|
|
40
|
+
return (_jsxs(YStack, { ...slot('order-entry'), p: "$4", gap: "$4", children: [_jsxs(YStack, { ...slot('order-entry-balance'), bg: "$hover", rounded: "$3", p: "$3", children: [_jsx(SizableText, { size: "$1", color: "$quiet", mb: "$1", children: "Buying Power" }), _jsxs(SizableText, { size: "$5", fontWeight: "600", color: "$ink", children: ["$", accountBalance.toLocaleString()] })] }), _jsx(Grid, { ...slot('order-entry-side'), columns: 2, gap: "$2", children: ['buy', 'sell'].map((side) => (_jsx(Cell, { children: _jsx(Button, { ...slot('order-entry-side-option'), "data-state": orderSide === side ? 'on' : 'off', role: "radio", "aria-checked": orderSide === side, variant: "ghost", width: "100%", disabled: disabled, onPress: () => setOrderSide(side), bg: orderSide === side ? SIDE_ON[side] : '$hover',
|
|
41
|
+
// `color` reaches Button.Frame through gui's own text-context —
|
|
42
|
+
// applied at runtime but never declared on the Frame's own prop
|
|
43
|
+
// type, the same gap `toggle-group.tsx` casts around elsewhere.
|
|
44
|
+
// @ts-expect-error color is a real, working prop the Frame's type omits
|
|
45
|
+
color: orderSide === side ? '$white1' : '$quiet', hoverStyle: orderSide === side ? { bg: SIDE_ON[side] } : { bg: '$edge' }, fontWeight: "600", children: side === 'buy' ? 'Buy' : 'Sell' }) }, side))) }), _jsxs(YStack, { ...slot('order-entry-type'), gap: "$2", children: [_jsx(Label, { children: "Order Type" }), _jsx(Grid, { columns: 2, gap: "$2", children: ['market', 'limit'].map((kind) => (_jsx(Cell, { children: _jsx(Button, { ...slot('order-entry-type-option'), "data-state": orderType === kind ? 'on' : 'off', role: "radio", "aria-checked": orderType === kind, variant: "ghost", size: "sm", width: "100%", disabled: disabled, onPress: () => setOrderType(kind), bg: orderType === kind ? '$rim' : '$hover',
|
|
46
|
+
// @ts-expect-error color is a real, working prop the Frame's type omits
|
|
47
|
+
color: orderType === kind ? '$ink' : '$quiet', hoverStyle: orderType === kind ? { bg: '$rim' } : { bg: '$edge' }, children: kind === 'market' ? 'Market' : 'Limit' }) }, kind))) })] }), _jsxs(YStack, { ...slot('order-entry-shares'), gap: "$2", children: [_jsx(Label, { htmlFor: "order-entry-shares-input", children: "Shares" }), _jsx(Input, { id: "order-entry-shares-input", type: "number", placeholder: "0", value: shares, onChangeText: setShares, disabled: disabled })] }), orderType === 'limit' && (_jsxs(YStack, { ...slot('order-entry-limit-price'), gap: "$2", children: [_jsx(Label, { htmlFor: "order-entry-limit-price-input", children: "Limit Price" }), _jsx(Input, { id: "order-entry-limit-price-input", type: "number", step: "0.01", placeholder: "0.00", value: limitPrice, onChangeText: setLimitPrice, disabled: disabled })] })), _jsxs(Button, { ...slot('order-entry-submit'), variant: "ghost", size: "lg", width: "100%", disabled: !canSubmit, onPress: submit, bg: SIDE_ON[orderSide],
|
|
48
|
+
// @ts-expect-error color is a real, working prop the Frame's type omits
|
|
49
|
+
color: "$white1", fontWeight: "600", hoverStyle: { bg: SIDE_ON[orderSide], opacity: 0.9 }, children: [orderSide === 'buy' ? 'Buy' : 'Sell', " ", ticker(symbol)] })] }));
|
|
50
|
+
}
|
|
51
|
+
export { OrderEntry };
|
|
52
|
+
//# sourceMappingURL=order-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-entry.js","sourceRoot":"","sources":["../../../src/backends/gui/order-entry.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;GAQG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAuB7B,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAA;AAEjE,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAW,CAAA;AAE1D,SAAS,UAAU,CAAC,EAClB,MAAM,GAAG,aAAa,EACtB,cAAc,GAAG,KAAK,EACtB,YAAY,GAAG,GAAG,EAAE,GAAE,CAAC,EACvB,QAAQ,GAAG,KAAK,GACA;IAChB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAY,QAAQ,CAAC,C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AAyB,CAAC,EAAE,GAAG,EAAC,IAAI,aACnD,KAAC,KAAK,IAAC,OAAO,EAAC,+BAA+B,4BAAoB,EAClE,KAAC,KAAK,IACJ,EAAE,EAAC,+BAA+B,EAClC,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,MAAM,EACX,WAAW,EAAC,MAAM,EAClB,KAAK,EAAE,UAAU,EACjB,YAAY,EAAE,aAAa,EAC3B,QAAQ,EAAE,QAAQ,GAClB,IACK,CACV,EAED,MAAC,MAAM,OACD,IAAI,CAAC,oBAAoB,CAAC,EAC9B,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,IAAI,EACT,KAAK,EAAC,MAAM,EACZ,QAAQ,EAAE,CAAC,SAAS,EACpB,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,OAAO,CAAC,SAAS,CAAC;gBACtB,wEAAwE;gBACxE,KAAK,EAAC,SAAS,EACf,UAAU,EAAC,KAAK,EAChB,UAAU,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,aAEnD,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,OAAG,MAAM,CAAC,MAAM,CAAC,IAC/C,IACF,CACV,CAAA;AACH,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.OrdersHistory = OrdersHistory;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
/**
|
|
40
|
+
* OrdersHistory — a list of trading orders, each row showing its symbol, time,
|
|
41
|
+
* status, side, share count and price, with an optional cancel action on the
|
|
42
|
+
* still-open ones and an optional click-through to the order.
|
|
43
|
+
*
|
|
44
|
+
* `showFilters` adds a status filter row above the list (All / Open / Filled /
|
|
45
|
+
* Cancelled / Pending) that narrows which orders render; the filter is local
|
|
46
|
+
* state, since it changes what is SHOWN and not the data itself. The three
|
|
47
|
+
* stats in a row (side, shares, price) sit in `@hanzo/ui`'s own `Grid` — a real
|
|
48
|
+
* CSS grid, so the columns stay even regardless of how wide any one value is.
|
|
49
|
+
*/
|
|
50
|
+
const gui_1 = require("@hanzo/gui");
|
|
51
|
+
const React = __importStar(require("react"));
|
|
52
|
+
const badge_1 = require("./badge.cjs");
|
|
53
|
+
const button_1 = require("./button.cjs");
|
|
54
|
+
const grid_1 = require("../../grid.cjs");
|
|
55
|
+
const ink_1 = require("./ink.cjs");
|
|
56
|
+
const slot_1 = require("./slot.cjs");
|
|
57
|
+
const STATUS_COLOR = {
|
|
58
|
+
open: '$blue9',
|
|
59
|
+
filled: '$green9',
|
|
60
|
+
cancelled: '$quiet',
|
|
61
|
+
pending: '$yellow9',
|
|
62
|
+
};
|
|
63
|
+
const SIDE_COLOR = {
|
|
64
|
+
buy: '$green9',
|
|
65
|
+
sell: '$red9',
|
|
66
|
+
};
|
|
67
|
+
const FILTERS = ['all', 'open', 'filled', 'cancelled', 'pending'];
|
|
68
|
+
const cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
69
|
+
/** The ticker half of an exchange-qualified symbol, e.g. `NASDAQ:AAPL` -> `AAPL`. */
|
|
70
|
+
const ticker = (symbol) => symbol.split(':')[1] || symbol;
|
|
71
|
+
const RowFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
72
|
+
name: 'OrdersHistoryRow',
|
|
73
|
+
bg: '$hover',
|
|
74
|
+
rounded: '$4',
|
|
75
|
+
p: '$3',
|
|
76
|
+
gap: '$2',
|
|
77
|
+
variants: {
|
|
78
|
+
clickable: { true: { cursor: 'pointer', hoverStyle: { bg: '$edge' } } },
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
function OrderRow({ order, onCancelOrder, onOrderClick, }) {
|
|
82
|
+
return ((0, jsx_runtime_1.jsxs)(RowFrame, { ...(0, slot_1.slot)('orders-history-row'), "data-status": order.status, clickable: !!onOrderClick, onPress: onOrderClick ? () => onOrderClick(order) : undefined, children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { justify: "space-between", items: "flex-start", children: [(0, jsx_runtime_1.jsxs)(gui_1.YStack, { children: [(0, ink_1.ink)(ticker(order.symbol), gui_1.SizableText, { fontWeight: '600' }), (0, ink_1.ink)(new Date(order.timestamp).toLocaleString(), gui_1.SizableText, {
|
|
83
|
+
size: '$1',
|
|
84
|
+
color: '$quiet',
|
|
85
|
+
})] }), (0, jsx_runtime_1.jsx)(badge_1.Badge, { ...(0, slot_1.slot)('orders-history-status'), variant: "outline", style: { borderColor: STATUS_COLOR[order.status], color: STATUS_COLOR[order.status] }, children: cap(order.status) })] }), (0, jsx_runtime_1.jsxs)(grid_1.Grid, { columns: 3, gap: "$2", children: [(0, jsx_runtime_1.jsx)(grid_1.Cell, { children: (0, jsx_runtime_1.jsxs)(gui_1.YStack, { gap: "$1", children: [(0, ink_1.ink)('Side', gui_1.SizableText, { size: '$1', color: '$quiet' }), (0, ink_1.ink)(order.type.toUpperCase(), gui_1.SizableText, {
|
|
86
|
+
size: '$1',
|
|
87
|
+
fontWeight: '500',
|
|
88
|
+
color: SIDE_COLOR[order.type],
|
|
89
|
+
})] }) }), (0, jsx_runtime_1.jsx)(grid_1.Cell, { children: (0, jsx_runtime_1.jsxs)(gui_1.YStack, { gap: "$1", children: [(0, ink_1.ink)('Shares', gui_1.SizableText, { size: '$1', color: '$quiet' }), (0, ink_1.ink)(String(order.shares), gui_1.SizableText, { size: '$1', fontWeight: '500' })] }) }), (0, jsx_runtime_1.jsx)(grid_1.Cell, { children: (0, jsx_runtime_1.jsxs)(gui_1.YStack, { gap: "$1", children: [(0, ink_1.ink)('Price', gui_1.SizableText, { size: '$1', color: '$quiet' }), (0, ink_1.ink)(order.price > 0 ? `$${order.price.toFixed(2)}` : 'Market', gui_1.SizableText, {
|
|
90
|
+
size: '$1',
|
|
91
|
+
fontWeight: '500',
|
|
92
|
+
})] }) })] }), order.orderType ? ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { gap: "$1", children: [(0, ink_1.ink)('Type:', gui_1.SizableText, { size: '$1', color: '$quiet' }), (0, ink_1.ink)(cap(order.orderType), gui_1.SizableText, { size: '$1', fontWeight: '500' })] })) : null, order.status === 'open' && onCancelOrder ? ((0, jsx_runtime_1.jsx)(button_1.Button, { ...(0, slot_1.slot)('orders-history-cancel'), variant: "outline", size: "sm", onPress: (e) => {
|
|
93
|
+
e.stopPropagation();
|
|
94
|
+
onCancelOrder(order.id);
|
|
95
|
+
}, children: "Cancel Order" })) : null] }));
|
|
96
|
+
}
|
|
97
|
+
function OrdersHistory({ orders = [], onCancelOrder, onOrderClick, showFilters = true, }) {
|
|
98
|
+
const [filter, setFilter] = React.useState('all');
|
|
99
|
+
const shown = filter === 'all' ? orders : orders.filter((order) => order.status === filter);
|
|
100
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('orders-history'), gap: "$3", p: "$4", children: [showFilters ? ((0, jsx_runtime_1.jsx)(gui_1.XStack, { ...(0, slot_1.slot)('orders-history-filters'), gap: "$2", flexWrap: "wrap", children: FILTERS.map((f) => ((0, jsx_runtime_1.jsx)(badge_1.Badge, { ...(0, slot_1.slot)('orders-history-filter'), "data-active": filter === f, variant: filter === f ? 'default' : 'outline', onClick: () => setFilter(f), style: { cursor: 'pointer' }, children: cap(f) }, f))) })) : null, shown.length === 0 ? ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('orders-history-empty'), items: "center", py: "$8", children: (0, ink_1.ink)('No orders yet', gui_1.SizableText, { size: '$2', color: '$quiet' }) })) : ((0, jsx_runtime_1.jsx)(gui_1.YStack, { gap: "$2", children: shown.map((order) => ((0, jsx_runtime_1.jsx)(OrderRow, { order: order, onCancelOrder: onCancelOrder, onOrderClick: onOrderClick }, order.id))) }))] }));
|
|
101
|
+
}
|
|
102
|
+
exports.default = OrdersHistory;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type OrdersHistorySide = 'buy' | 'sell';
|
|
3
|
+
export type OrdersHistoryStatus = 'open' | 'filled' | 'cancelled' | 'pending';
|
|
4
|
+
export type OrdersHistoryOrderType = 'market' | 'limit';
|
|
5
|
+
export interface Order {
|
|
6
|
+
id: string;
|
|
7
|
+
symbol: string;
|
|
8
|
+
type: OrdersHistorySide;
|
|
9
|
+
shares: number;
|
|
10
|
+
price: number;
|
|
11
|
+
status: OrdersHistoryStatus;
|
|
12
|
+
timestamp: number;
|
|
13
|
+
orderType?: OrdersHistoryOrderType;
|
|
14
|
+
}
|
|
15
|
+
export interface OrdersHistoryProps {
|
|
16
|
+
orders: Order[];
|
|
17
|
+
onCancelOrder?: (orderId: string) => void;
|
|
18
|
+
onOrderClick?: (order: Order) => void;
|
|
19
|
+
/** Shows the status filter row above the list. Defaults to true. */
|
|
20
|
+
showFilters?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function OrdersHistory({ orders, onCancelOrder, onOrderClick, showFilters, }: OrdersHistoryProps): React.JSX.Element;
|
|
23
|
+
export default OrdersHistory;
|
|
24
|
+
//# sourceMappingURL=orders-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders-history.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/orders-history.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,MAAM,CAAA;AAC9C,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAA;AAC7E,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEvD,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,iBAAiB,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,mBAAmB,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,sBAAsB,CAAA;CACnC;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IACrC,oEAAoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAuHD,wBAAgB,aAAa,CAAC,EAC5B,MAAW,EACX,aAAa,EACb,YAAY,EACZ,WAAkB,GACnB,EAAE,kBAAkB,qBAyCpB;eAEc,aAAa"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* OrdersHistory — a list of trading orders, each row showing its symbol, time,
|
|
5
|
+
* status, side, share count and price, with an optional cancel action on the
|
|
6
|
+
* still-open ones and an optional click-through to the order.
|
|
7
|
+
*
|
|
8
|
+
* `showFilters` adds a status filter row above the list (All / Open / Filled /
|
|
9
|
+
* Cancelled / Pending) that narrows which orders render; the filter is local
|
|
10
|
+
* state, since it changes what is SHOWN and not the data itself. The three
|
|
11
|
+
* stats in a row (side, shares, price) sit in `@hanzo/ui`'s own `Grid` — a real
|
|
12
|
+
* CSS grid, so the columns stay even regardless of how wide any one value is.
|
|
13
|
+
*/
|
|
14
|
+
import { SizableText, XStack, YStack, styled } from '@hanzo/gui';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import { Badge } from './badge.js';
|
|
17
|
+
import { Button } from './button.js';
|
|
18
|
+
import { Cell, Grid } from '../../grid.js';
|
|
19
|
+
import { ink } from './ink.js';
|
|
20
|
+
import { slot } from './slot.js';
|
|
21
|
+
const STATUS_COLOR = {
|
|
22
|
+
open: '$blue9',
|
|
23
|
+
filled: '$green9',
|
|
24
|
+
cancelled: '$quiet',
|
|
25
|
+
pending: '$yellow9',
|
|
26
|
+
};
|
|
27
|
+
const SIDE_COLOR = {
|
|
28
|
+
buy: '$green9',
|
|
29
|
+
sell: '$red9',
|
|
30
|
+
};
|
|
31
|
+
const FILTERS = ['all', 'open', 'filled', 'cancelled', 'pending'];
|
|
32
|
+
const cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
33
|
+
/** The ticker half of an exchange-qualified symbol, e.g. `NASDAQ:AAPL` -> `AAPL`. */
|
|
34
|
+
const ticker = (symbol) => symbol.split(':')[1] || symbol;
|
|
35
|
+
const RowFrame = styled(YStack, {
|
|
36
|
+
name: 'OrdersHistoryRow',
|
|
37
|
+
bg: '$hover',
|
|
38
|
+
rounded: '$4',
|
|
39
|
+
p: '$3',
|
|
40
|
+
gap: '$2',
|
|
41
|
+
variants: {
|
|
42
|
+
clickable: { true: { cursor: 'pointer', hoverStyle: { bg: '$edge' } } },
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
function OrderRow({ order, onCancelOrder, onOrderClick, }) {
|
|
46
|
+
return (_jsxs(RowFrame, { ...slot('orders-history-row'), "data-status": order.status, clickable: !!onOrderClick, onPress: onOrderClick ? () => onOrderClick(order) : undefined, children: [_jsxs(XStack, { justify: "space-between", items: "flex-start", children: [_jsxs(YStack, { children: [ink(ticker(order.symbol), SizableText, { fontWeight: '600' }), ink(new Date(order.timestamp).toLocaleString(), SizableText, {
|
|
47
|
+
size: '$1',
|
|
48
|
+
color: '$quiet',
|
|
49
|
+
})] }), _jsx(Badge, { ...slot('orders-history-status'), variant: "outline", style: { borderColor: STATUS_COLOR[order.status], color: STATUS_COLOR[order.status] }, children: cap(order.status) })] }), _jsxs(Grid, { columns: 3, gap: "$2", children: [_jsx(Cell, { children: _jsxs(YStack, { gap: "$1", children: [ink('Side', SizableText, { size: '$1', color: '$quiet' }), ink(order.type.toUpperCase(), SizableText, {
|
|
50
|
+
size: '$1',
|
|
51
|
+
fontWeight: '500',
|
|
52
|
+
color: SIDE_COLOR[order.type],
|
|
53
|
+
})] }) }), _jsx(Cell, { children: _jsxs(YStack, { gap: "$1", children: [ink('Shares', SizableText, { size: '$1', color: '$quiet' }), ink(String(order.shares), SizableText, { size: '$1', fontWeight: '500' })] }) }), _jsx(Cell, { children: _jsxs(YStack, { gap: "$1", children: [ink('Price', SizableText, { size: '$1', color: '$quiet' }), ink(order.price > 0 ? `$${order.price.toFixed(2)}` : 'Market', SizableText, {
|
|
54
|
+
size: '$1',
|
|
55
|
+
fontWeight: '500',
|
|
56
|
+
})] }) })] }), order.orderType ? (_jsxs(XStack, { gap: "$1", children: [ink('Type:', SizableText, { size: '$1', color: '$quiet' }), ink(cap(order.orderType), SizableText, { size: '$1', fontWeight: '500' })] })) : null, order.status === 'open' && onCancelOrder ? (_jsx(Button, { ...slot('orders-history-cancel'), variant: "outline", size: "sm", onPress: (e) => {
|
|
57
|
+
e.stopPropagation();
|
|
58
|
+
onCancelOrder(order.id);
|
|
59
|
+
}, children: "Cancel Order" })) : null] }));
|
|
60
|
+
}
|
|
61
|
+
export function OrdersHistory({ orders = [], onCancelOrder, onOrderClick, showFilters = true, }) {
|
|
62
|
+
const [filter, setFilter] = React.useState('all');
|
|
63
|
+
const shown = filter === 'all' ? orders : orders.filter((order) => order.status === filter);
|
|
64
|
+
return (_jsxs(YStack, { ...slot('orders-history'), gap: "$3", p: "$4", children: [showFilters ? (_jsx(XStack, { ...slot('orders-history-filters'), gap: "$2", flexWrap: "wrap", children: FILTERS.map((f) => (_jsx(Badge, { ...slot('orders-history-filter'), "data-active": filter === f, variant: filter === f ? 'default' : 'outline', onClick: () => setFilter(f), style: { cursor: 'pointer' }, children: cap(f) }, f))) })) : null, shown.length === 0 ? (_jsx(YStack, { ...slot('orders-history-empty'), items: "center", py: "$8", children: ink('No orders yet', SizableText, { size: '$2', color: '$quiet' }) })) : (_jsx(YStack, { gap: "$2", children: shown.map((order) => (_jsx(OrderRow, { order: order, onCancelOrder: onCancelOrder, onOrderClick: onOrderClick }, order.id))) }))] }));
|
|
65
|
+
}
|
|
66
|
+
export default OrdersHistory;
|
|
67
|
+
//# sourceMappingURL=orders-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders-history.js","sourceRoot":"","sources":["../../../src/backends/gui/orders-history.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;GAUG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAyB7B,MAAM,YAAY,GAAwC;IACxD,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,QAAQ;IACnB,OAAO,EAAE,UAAU;CACpB,CAAA;AAED,MAAM,UAAU,GAAsC;IACpD,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,OAAO;CACd,CAAA;AAED,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,CAAU,CAAA;AAG1E,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAEjE,qFAAqF;AACrF,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CA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AAG,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,YACjE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAClB,KAAC,KAAK,OAEA,IAAI,CAAC,uBAAuB,CAAC,iBACpB,MAAM,KAAK,CAAC,EACzB,OAAO,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAC7C,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAC3B,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,YAE3B,GAAG,CAAC,CAAC,CAAC,IAPF,CAAC,CAQA,CACT,CAAC,GACK,CACV,CAAC,CAAC,CAAC,IAAI,EAEP,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CACpB,KAAC,MAAM,OAAK,IAAI,CAAC,sBAAsB,CAAC,EAAE,KAAK,EAAC,QAAQ,EAAC,EAAE,EAAC,IAAI,YAC7D,GAAG,CAAC,eAAe,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,GAC5D,CACV,CAAC,CAAC,CAAC,CACF,KAAC,MAAM,IAAC,GAAG,EAAC,IAAI,YACb,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACpB,KAAC,QAAQ,IAEP,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,IAHrB,KAAK,CAAC,EAAE,CAIb,CACH,CAAC,GACK,CACV,IACM,CACV,CAAA;AACH,CAAC;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PaginationEllipsis = exports.PaginationNext = exports.PaginationPrevious = exports.PaginationLink = exports.PaginationItem = exports.PaginationContent = exports.Pagination = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const gui_1 = require("@hanzo/gui");
|
|
7
|
+
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
8
|
+
const button_1 = require("./button.cjs");
|
|
9
|
+
const slot_1 = require("./slot.cjs");
|
|
10
|
+
const ICON = 16;
|
|
11
|
+
const Nav = (0, gui_1.styled)(gui_1.XStack, {
|
|
12
|
+
name: 'Pagination',
|
|
13
|
+
render: 'nav',
|
|
14
|
+
width: '100%',
|
|
15
|
+
justify: 'center',
|
|
16
|
+
});
|
|
17
|
+
const Pagination = (props) => ((0, jsx_runtime_1.jsx)(Nav, { ...(0, slot_1.slot)('pagination'), role: "navigation", "aria-label": "pagination", ...props }));
|
|
18
|
+
exports.Pagination = Pagination;
|
|
19
|
+
const List = (0, gui_1.styled)(gui_1.XStack, {
|
|
20
|
+
name: 'PaginationContent',
|
|
21
|
+
render: 'ul',
|
|
22
|
+
flexDirection: 'row',
|
|
23
|
+
items: 'center',
|
|
24
|
+
gap: '$1',
|
|
25
|
+
});
|
|
26
|
+
const PaginationContent = (props) => ((0, jsx_runtime_1.jsx)(List, { ...(0, slot_1.slot)('pagination-content'), ...props }));
|
|
27
|
+
exports.PaginationContent = PaginationContent;
|
|
28
|
+
const Item = (0, gui_1.styled)(gui_1.XStack, {
|
|
29
|
+
name: 'PaginationItem',
|
|
30
|
+
render: 'li',
|
|
31
|
+
});
|
|
32
|
+
const PaginationItem = (props) => ((0, jsx_runtime_1.jsx)(Item, { ...(0, slot_1.slot)('pagination-item'), ...props }));
|
|
33
|
+
exports.PaginationItem = PaginationItem;
|
|
34
|
+
/** One page number, or any other stop in the trail. Renders as an anchor. */
|
|
35
|
+
const PaginationLink = ({ isActive, size = 'icon', href, children, ...props }) => ((0, jsx_runtime_1.jsx)(button_1.Button, { asChild: true, ...(0, slot_1.slot)('pagination-link'), "data-active": isActive || undefined, "aria-current": isActive ? 'page' : undefined, variant: isActive ? 'outline' : 'ghost', size: size, ...props, children: (0, jsx_runtime_1.jsx)("a", { href: href, children: children }) }));
|
|
36
|
+
exports.PaginationLink = PaginationLink;
|
|
37
|
+
const PaginationPrevious = (props) => ((0, jsx_runtime_1.jsxs)(exports.PaginationLink, { "aria-label": "Go to previous page", size: "default", gap: "$1", pl: "$2.5", ...props, children: [(0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronLeft, { size: ICON }), "Previous"] }));
|
|
38
|
+
exports.PaginationPrevious = PaginationPrevious;
|
|
39
|
+
const PaginationNext = (props) => ((0, jsx_runtime_1.jsxs)(exports.PaginationLink, { "aria-label": "Go to next page", size: "default", gap: "$1", pr: "$2.5", ...props, children: ["Next", (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronRight, { size: ICON })] }));
|
|
40
|
+
exports.PaginationNext = PaginationNext;
|
|
41
|
+
const Ellipsis = (0, gui_1.styled)(gui_1.XStack, {
|
|
42
|
+
name: 'PaginationEllipsis',
|
|
43
|
+
render: 'span',
|
|
44
|
+
height: 36,
|
|
45
|
+
width: 36,
|
|
46
|
+
items: 'center',
|
|
47
|
+
justify: 'center',
|
|
48
|
+
});
|
|
49
|
+
/** A gap too long to enumerate. Decorative — the count still comes from the list. */
|
|
50
|
+
const PaginationEllipsis = (props) => ((0, jsx_runtime_1.jsxs)(Ellipsis, { ...(0, slot_1.slot)('pagination-ellipsis'), "aria-hidden": true, ...props, children: [(0, jsx_runtime_1.jsx)(lucide_icons_2_1.MoreHorizontal, { size: ICON }), (0, jsx_runtime_1.jsx)(gui_1.VisuallyHidden, { children: "More pages" })] }));
|
|
51
|
+
exports.PaginationEllipsis = PaginationEllipsis;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pagination — a trail of page links, framed as a navigation landmark.
|
|
3
|
+
*
|
|
4
|
+
* `Pagination` is a `<nav aria-label="pagination">` around `PaginationContent`,
|
|
5
|
+
* a real `<ul>` so a screen reader counts the pages the way it counts a list.
|
|
6
|
+
* `PaginationLink` wears the same `Button` frame every other control on the
|
|
7
|
+
* page wears — ghost for a page you can go to, outline for the one you are
|
|
8
|
+
* on — so the current page reads as pressed rather than as a colour choice.
|
|
9
|
+
* `PaginationPrevious`/`PaginationNext` are that link with an icon and a
|
|
10
|
+
* label; `PaginationEllipsis` is a decorative gap, `aria-hidden`, with its own
|
|
11
|
+
* "More pages" line for whoever is not looking at it.
|
|
12
|
+
*/
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { Button, type ButtonSize } from './button.js';
|
|
15
|
+
declare const Nav: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
16
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
17
|
+
fullscreen?: boolean | undefined;
|
|
18
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
19
|
+
export type PaginationProps = React.ComponentProps<typeof Nav>;
|
|
20
|
+
export declare const Pagination: (props: PaginationProps) => React.JSX.Element;
|
|
21
|
+
declare const List: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
22
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
23
|
+
fullscreen?: boolean | undefined;
|
|
24
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
25
|
+
export type PaginationContentProps = React.ComponentProps<typeof List>;
|
|
26
|
+
export declare const PaginationContent: (props: PaginationContentProps) => React.JSX.Element;
|
|
27
|
+
declare const Item: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
28
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
29
|
+
fullscreen?: boolean | undefined;
|
|
30
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
31
|
+
export type PaginationItemProps = React.ComponentProps<typeof Item>;
|
|
32
|
+
export declare const PaginationItem: (props: PaginationItemProps) => React.JSX.Element;
|
|
33
|
+
export type PaginationLinkProps = {
|
|
34
|
+
isActive?: boolean;
|
|
35
|
+
size?: ButtonSize;
|
|
36
|
+
href?: string;
|
|
37
|
+
} & Omit<React.ComponentProps<typeof Button>, 'variant' | 'size' | 'asChild'>;
|
|
38
|
+
/** One page number, or any other stop in the trail. Renders as an anchor. */
|
|
39
|
+
export declare const PaginationLink: ({ isActive, size, href, children, ...props }: PaginationLinkProps) => React.JSX.Element;
|
|
40
|
+
export type PaginationPreviousProps = Omit<PaginationLinkProps, 'size' | 'children'>;
|
|
41
|
+
export declare const PaginationPrevious: (props: PaginationPreviousProps) => React.JSX.Element;
|
|
42
|
+
export type PaginationNextProps = Omit<PaginationLinkProps, 'size' | 'children'>;
|
|
43
|
+
export declare const PaginationNext: (props: PaginationNextProps) => React.JSX.Element;
|
|
44
|
+
declare const Ellipsis: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
45
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
46
|
+
fullscreen?: boolean | undefined;
|
|
47
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
48
|
+
export type PaginationEllipsisProps = React.ComponentProps<typeof Ellipsis>;
|
|
49
|
+
/** A gap too long to enumerate. Decorative — the count still comes from the list. */
|
|
50
|
+
export declare const PaginationEllipsis: (props: PaginationEllipsisProps) => React.JSX.Element;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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AC,mBAAmB,EAAE,MAAM,GAAG,UAAU,CAAC,CAAA;AAEhF,eAAO,MAAM,cAAc,UAAW,mBAAmB,sBAKxD,CAAA;AAED,QAAA,MAAM,QAAQ;;;8CAOZ,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,CAAA;AAE3E,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,UAAW,uBAAuB,sBAKhE,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { VisuallyHidden, XStack, styled } from '@hanzo/gui';
|
|
4
|
+
import { ChevronLeft, ChevronRight, MoreHorizontal } from '@hanzogui/lucide-icons-2';
|
|
5
|
+
import { Button } from './button.js';
|
|
6
|
+
import { slot } from './slot.js';
|
|
7
|
+
const ICON = 16;
|
|
8
|
+
const Nav = styled(XStack, {
|
|
9
|
+
name: 'Pagination',
|
|
10
|
+
render: 'nav',
|
|
11
|
+
width: '100%',
|
|
12
|
+
justify: 'center',
|
|
13
|
+
});
|
|
14
|
+
export const Pagination = (props) => (_jsx(Nav, { ...slot('pagination'), role: "navigation", "aria-label": "pagination", ...props }));
|
|
15
|
+
const List = styled(XStack, {
|
|
16
|
+
name: 'PaginationContent',
|
|
17
|
+
render: 'ul',
|
|
18
|
+
flexDirection: 'row',
|
|
19
|
+
items: 'center',
|
|
20
|
+
gap: '$1',
|
|
21
|
+
});
|
|
22
|
+
export const PaginationContent = (props) => (_jsx(List, { ...slot('pagination-content'), ...props }));
|
|
23
|
+
const Item = styled(XStack, {
|
|
24
|
+
name: 'PaginationItem',
|
|
25
|
+
render: 'li',
|
|
26
|
+
});
|
|
27
|
+
export const PaginationItem = (props) => (_jsx(Item, { ...slot('pagination-item'), ...props }));
|
|
28
|
+
/** One page number, or any other stop in the trail. Renders as an anchor. */
|
|
29
|
+
export const PaginationLink = ({ isActive, size = 'icon', href, children, ...props }) => (_jsx(Button, { asChild: true, ...slot('pagination-link'), "data-active": isActive || undefined, "aria-current": isActive ? 'page' : undefined, variant: isActive ? 'outline' : 'ghost', size: size, ...props, children: _jsx("a", { href: href, children: children }) }));
|
|
30
|
+
export const PaginationPrevious = (props) => (_jsxs(PaginationLink, { "aria-label": "Go to previous page", size: "default", gap: "$1", pl: "$2.5", ...props, children: [_jsx(ChevronLeft, { size: ICON }), "Previous"] }));
|
|
31
|
+
export const PaginationNext = (props) => (_jsxs(PaginationLink, { "aria-label": "Go to next page", size: "default", gap: "$1", pr: "$2.5", ...props, children: ["Next", _jsx(ChevronRight, { size: ICON })] }));
|
|
32
|
+
const Ellipsis = styled(XStack, {
|
|
33
|
+
name: 'PaginationEllipsis',
|
|
34
|
+
render: 'span',
|
|
35
|
+
height: 36,
|
|
36
|
+
width: 36,
|
|
37
|
+
items: 'center',
|
|
38
|
+
justify: 'center',
|
|
39
|
+
});
|
|
40
|
+
/** A gap too long to enumerate. Decorative — the count still comes from the list. */
|
|
41
|
+
export const PaginationEllipsis = (props) => (_jsxs(Ellipsis, { ...slot('pagination-ellipsis'), "aria-hidden": true, ...props, children: [_jsx(MoreHorizontal, { size: ICON }), _jsx(VisuallyHidden, { children: "More pages" })] }));
|
|
42
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../src/backends/gui/pagination.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAeZ,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEpF,OAAO,EAAE,MAAM,EAAmB,MAAM,UAAU,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,MAAM,IAAI,GA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