@open-mercato/core 0.7.1-develop.7203.1.9396450b78 → 0.8.0
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/.turbo/turbo-build.log +1 -1
- package/build.mjs +11 -0
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js +23 -0
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/[id]/page.js +2 -1
- package/dist/modules/customers/backend/customers/companies/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js +2 -1
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/[id]/page.js +2 -2
- package/dist/modules/customers/backend/customers/people/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js +2 -1
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/lib/detailHelpers.js +4 -0
- package/dist/modules/customers/lib/detailHelpers.js.map +2 -2
- package/dist/modules/customers/lib/todoCompatibility.js +5 -0
- package/dist/modules/customers/lib/todoCompatibility.js.map +2 -2
- package/dist/modules/design_system/backend/design-system/page.meta.js +3 -2
- package/dist/modules/design_system/backend/design-system/page.meta.js.map +2 -2
- package/dist/modules/design_system/gallery/assets/ai-prompt-image.png +0 -0
- package/dist/modules/design_system/gallery/assets/avatar-illustration.png +0 -0
- package/dist/modules/design_system/gallery/assets/avatar-memoji.png +0 -0
- package/dist/modules/design_system/gallery/assets/avatar-photo.png +0 -0
- package/dist/modules/design_system/gallery/assets/blog-photo-0.png +0 -0
- package/dist/modules/design_system/gallery/assets/contact-support-portrait.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-ada.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-avax.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-bnb.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-brand.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-btc.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-clock.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-crown.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-dot.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-eth.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-hbar.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-history.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-link.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-menu.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-metamask.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-more.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-phantom.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-rewards.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-sad-face.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-sol.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-star.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-status-cancelled.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-status-pending.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-status-success.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-status-warning.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-trx.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-usdc.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-usdt.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-walletconnect.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-wei.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-xrp.png +0 -0
- package/dist/modules/design_system/gallery/assets/cryptocurrency-artwork.js +67 -0
- package/dist/modules/design_system/gallery/assets/cryptocurrency-artwork.js.map +7 -0
- package/dist/modules/design_system/gallery/assets/github-logo.png +0 -0
- package/dist/modules/design_system/gallery/assets/images.d.js +1 -0
- package/dist/modules/design_system/gallery/assets/images.d.js.map +7 -0
- package/dist/modules/design_system/gallery/assets/input-european-union.svg +18 -0
- package/dist/modules/design_system/gallery/assets/landing-teams-01.png +0 -0
- package/dist/modules/design_system/gallery/assets/marketing-artwork.js +83 -0
- package/dist/modules/design_system/gallery/assets/marketing-artwork.js.map +7 -0
- package/dist/modules/design_system/gallery/assets/menu-apex.svg +18 -0
- package/dist/modules/design_system/gallery/assets/menu-mastercard.svg +7 -0
- package/dist/modules/design_system/gallery/assets/menu-spotify.svg +4 -0
- package/dist/modules/design_system/gallery/assets/menu-united-states.svg +16 -0
- package/dist/modules/design_system/gallery/assets/select-google.png +0 -0
- package/dist/modules/design_system/gallery/assets/select-poland.png +0 -0
- package/dist/modules/design_system/gallery/assets/selection-artwork.js +5 -0
- package/dist/modules/design_system/gallery/assets/selection-artwork.js.map +7 -0
- package/dist/modules/design_system/gallery/assets/social-apple-filled.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-apple-stroke.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-dropbox-filled.svg +5 -0
- package/dist/modules/design_system/gallery/assets/social-dropbox-stroke.svg +5 -0
- package/dist/modules/design_system/gallery/assets/social-facebook-filled.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-facebook-stroke.svg +10 -0
- package/dist/modules/design_system/gallery/assets/social-github-filled.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-github-stroke.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-google-filled.svg +7 -0
- package/dist/modules/design_system/gallery/assets/social-google-stroke.svg +7 -0
- package/dist/modules/design_system/gallery/assets/social-linkedin-filled.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-linkedin-stroke.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-x-filled.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-x-stroke.svg +4 -0
- package/dist/modules/design_system/gallery/assets/style-studio-product.png +0 -0
- package/dist/modules/design_system/gallery/assets/upload-images.js +8 -0
- package/dist/modules/design_system/gallery/assets/upload-images.js.map +7 -0
- package/dist/modules/design_system/gallery/components/BrandStylePreview.js +74 -0
- package/dist/modules/design_system/gallery/components/BrandStylePreview.js.map +7 -0
- package/dist/modules/design_system/gallery/components/CodeSnippet.js +31 -31
- package/dist/modules/design_system/gallery/components/CodeSnippet.js.map +2 -2
- package/dist/modules/design_system/gallery/components/ColorPlayground.js +408 -0
- package/dist/modules/design_system/gallery/components/ColorPlayground.js.map +7 -0
- package/dist/modules/design_system/gallery/components/ColorStudioCompositions.js +166 -0
- package/dist/modules/design_system/gallery/components/ColorStudioCompositions.js.map +7 -0
- package/dist/modules/design_system/gallery/components/ColorStudioSpecimen.js +182 -0
- package/dist/modules/design_system/gallery/components/ColorStudioSpecimen.js.map +7 -0
- package/dist/modules/design_system/gallery/components/CompactEntrySpecimen.js +80 -0
- package/dist/modules/design_system/gallery/components/CompactEntrySpecimen.js.map +7 -0
- package/dist/modules/design_system/gallery/components/ComponentIndex.js +42 -0
- package/dist/modules/design_system/gallery/components/ComponentIndex.js.map +7 -0
- package/dist/modules/design_system/gallery/components/DesignSystemHome.js +69 -0
- package/dist/modules/design_system/gallery/components/DesignSystemHome.js.map +7 -0
- package/dist/modules/design_system/gallery/components/EntryCard.js +47 -41
- package/dist/modules/design_system/gallery/components/EntryCard.js.map +2 -2
- package/dist/modules/design_system/gallery/components/EntryHeader.js +68 -0
- package/dist/modules/design_system/gallery/components/EntryHeader.js.map +7 -0
- package/dist/modules/design_system/gallery/components/FamilyEntryPreview.js +19 -0
- package/dist/modules/design_system/gallery/components/FamilyEntryPreview.js.map +7 -0
- package/dist/modules/design_system/gallery/components/FoundationGuide.js +46 -0
- package/dist/modules/design_system/gallery/components/FoundationGuide.js.map +7 -0
- package/dist/modules/design_system/gallery/components/GalleryLink.js +21 -0
- package/dist/modules/design_system/gallery/components/GalleryLink.js.map +7 -0
- package/dist/modules/design_system/gallery/components/GalleryNavigation.js +82 -0
- package/dist/modules/design_system/gallery/components/GalleryNavigation.js.map +7 -0
- package/dist/modules/design_system/gallery/components/GalleryShell.js +147 -67
- package/dist/modules/design_system/gallery/components/GalleryShell.js.map +3 -3
- package/dist/modules/design_system/gallery/components/IconsBrowser.js +33 -0
- package/dist/modules/design_system/gallery/components/IconsBrowser.js.map +7 -0
- package/dist/modules/design_system/gallery/components/SourceLibrary.js +93 -0
- package/dist/modules/design_system/gallery/components/SourceLibrary.js.map +7 -0
- package/dist/modules/design_system/gallery/components/StyleAgents.js +139 -0
- package/dist/modules/design_system/gallery/components/StyleAgents.js.map +7 -0
- package/dist/modules/design_system/gallery/components/ThemeTokenReference.js +101 -0
- package/dist/modules/design_system/gallery/components/ThemeTokenReference.js.map +7 -0
- package/dist/modules/design_system/gallery/components/VariantPreview.js +2 -2
- package/dist/modules/design_system/gallery/components/VariantPreview.js.map +2 -2
- package/dist/modules/design_system/gallery/components/colorPreview.js +58 -0
- package/dist/modules/design_system/gallery/components/colorPreview.js.map +7 -0
- package/dist/modules/design_system/gallery/components/colorStudio.js +218 -0
- package/dist/modules/design_system/gallery/components/colorStudio.js.map +7 -0
- package/dist/modules/design_system/gallery/components/styleAgentBranding.js +46 -0
- package/dist/modules/design_system/gallery/components/styleAgentBranding.js.map +7 -0
- package/dist/modules/design_system/gallery/components/themeTokens.js +32 -0
- package/dist/modules/design_system/gallery/components/themeTokens.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/ai-product-code.generated.js +194 -0
- package/dist/modules/design_system/gallery/demos/ai-product-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/ai-product.js +423 -0
- package/dist/modules/design_system/gallery/demos/ai-product.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/buttons.js +289 -0
- package/dist/modules/design_system/gallery/demos/buttons.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/cryptocurrency.js +1708 -0
- package/dist/modules/design_system/gallery/demos/cryptocurrency.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/feeds-code.generated.js +92 -0
- package/dist/modules/design_system/gallery/demos/feeds-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/feeds.js +148 -0
- package/dist/modules/design_system/gallery/demos/feeds.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/file-upload.js +72 -0
- package/dist/modules/design_system/gallery/demos/file-upload.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/foundation-reference-data.js +4875 -0
- package/dist/modules/design_system/gallery/demos/foundation-reference-data.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/foundation-references.js +188 -0
- package/dist/modules/design_system/gallery/demos/foundation-references.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/key-components-code.generated.js +6 -0
- package/dist/modules/design_system/gallery/demos/key-components-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/key-components.js +127 -0
- package/dist/modules/design_system/gallery/demos/key-components.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/marketing-controls-code.generated.js +98 -0
- package/dist/modules/design_system/gallery/demos/marketing-controls-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/marketing-controls.js +134 -0
- package/dist/modules/design_system/gallery/demos/marketing-controls.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/marketing-widgets-code.generated.js +195 -0
- package/dist/modules/design_system/gallery/demos/marketing-widgets-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/marketing-widgets.js +586 -0
- package/dist/modules/design_system/gallery/demos/marketing-widgets.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/menu-fixtures.js +40 -0
- package/dist/modules/design_system/gallery/demos/menu-fixtures.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/menu-sources.js +295 -0
- package/dist/modules/design_system/gallery/demos/menu-sources.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/menus.js +150 -0
- package/dist/modules/design_system/gallery/demos/menus.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/rating-reviews.js +53 -0
- package/dist/modules/design_system/gallery/demos/rating-reviews.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/registered-icons.js +104 -0
- package/dist/modules/design_system/gallery/demos/registered-icons.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/selection-cards.js +99 -0
- package/dist/modules/design_system/gallery/demos/selection-cards.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/shell-code.generated.js +189 -0
- package/dist/modules/design_system/gallery/demos/shell-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/shell.js +330 -0
- package/dist/modules/design_system/gallery/demos/shell.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/source-artwork.js +120 -0
- package/dist/modules/design_system/gallery/demos/source-artwork.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/source-filters-code.generated.js +125 -0
- package/dist/modules/design_system/gallery/demos/source-filters-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/source-filters.js +185 -0
- package/dist/modules/design_system/gallery/demos/source-filters.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/source-icons.js +69 -0
- package/dist/modules/design_system/gallery/demos/source-icons.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/table-cells-code.generated.js +150 -0
- package/dist/modules/design_system/gallery/demos/table-cells-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/table-cells.js +181 -0
- package/dist/modules/design_system/gallery/demos/table-cells.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/text-inputs.js +113 -0
- package/dist/modules/design_system/gallery/demos/text-inputs.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/time-picker-code.generated.js +41 -0
- package/dist/modules/design_system/gallery/demos/time-picker-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/time-picker.js +41 -0
- package/dist/modules/design_system/gallery/demos/time-picker.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/banners.js +123 -60
- package/dist/modules/design_system/gallery/entries/banners.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/buttons-snippets.js +433 -0
- package/dist/modules/design_system/gallery/entries/buttons-snippets.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/buttons.js +127 -148
- package/dist/modules/design_system/gallery/entries/buttons.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/charts.js +532 -186
- package/dist/modules/design_system/gallery/entries/charts.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/dates.js +191 -3
- package/dist/modules/design_system/gallery/entries/dates.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/detail.js +118 -77
- package/dist/modules/design_system/gallery/entries/detail.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/display.js +1449 -240
- package/dist/modules/design_system/gallery/entries/display.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/feedback.js +1058 -132
- package/dist/modules/design_system/gallery/entries/feedback.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/filters.js +231 -103
- package/dist/modules/design_system/gallery/entries/filters.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/foundations.js +368 -57
- package/dist/modules/design_system/gallery/entries/foundations.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/icons.js +29 -91
- package/dist/modules/design_system/gallery/entries/icons.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/inputs-snippets.js +154 -0
- package/dist/modules/design_system/gallery/entries/inputs-snippets.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/inputs.js +2043 -306
- package/dist/modules/design_system/gallery/entries/inputs.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/library.js +20 -0
- package/dist/modules/design_system/gallery/entries/library.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/messages.js +121 -103
- package/dist/modules/design_system/gallery/entries/messages.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/navigation.js +676 -103
- package/dist/modules/design_system/gallery/entries/navigation.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/notifications.js +131 -78
- package/dist/modules/design_system/gallery/entries/notifications.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/overlays.js +611 -203
- package/dist/modules/design_system/gallery/entries/overlays.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/scaffolding.js +1175 -120
- package/dist/modules/design_system/gallery/entries/scaffolding.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/schedule.js +79 -54
- package/dist/modules/design_system/gallery/entries/schedule.js.map +2 -2
- package/dist/modules/design_system/gallery/presentation.js +108 -0
- package/dist/modules/design_system/gallery/presentation.js.map +7 -0
- package/dist/modules/design_system/gallery/registry.js +8 -5
- package/dist/modules/design_system/gallery/registry.js.map +2 -2
- package/dist/modules/design_system/gallery/source-library.generated.js +5 -0
- package/dist/modules/design_system/gallery/source-library.generated.js.map +7 -0
- package/dist/modules/design_system/i18n/de.json +7167 -0
- package/dist/modules/design_system/i18n/en.json +7167 -0
- package/dist/modules/design_system/i18n/es.json +7167 -0
- package/dist/modules/design_system/i18n/ko.json +7167 -0
- package/dist/modules/design_system/i18n/pl.json +7167 -0
- package/dist/modules/push_notifications/lib/queue.js +1 -31
- package/dist/modules/push_notifications/lib/queue.js.map +2 -2
- package/jest.config.cjs +1 -0
- package/jest.mocks/image.js +1 -0
- package/package.json +8 -9
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +50 -0
- package/src/modules/customers/backend/customers/companies/[id]/page.tsx +2 -1
- package/src/modules/customers/backend/customers/companies-v2/[id]/page.tsx +2 -1
- package/src/modules/customers/backend/customers/people/[id]/page.tsx +2 -2
- package/src/modules/customers/backend/customers/people-v2/[id]/page.tsx +2 -1
- package/src/modules/customers/lib/detailHelpers.ts +4 -0
- package/src/modules/customers/lib/todoCompatibility.ts +10 -0
- package/src/modules/design_system/backend/design-system/page.meta.ts +3 -2
- package/src/modules/design_system/gallery/assets/README.md +30 -0
- package/src/modules/design_system/gallery/assets/ai-prompt-image.png +0 -0
- package/src/modules/design_system/gallery/assets/avatar-illustration.png +0 -0
- package/src/modules/design_system/gallery/assets/avatar-memoji.png +0 -0
- package/src/modules/design_system/gallery/assets/avatar-photo.png +0 -0
- package/src/modules/design_system/gallery/assets/blog-photo-0.png +0 -0
- package/src/modules/design_system/gallery/assets/contact-support-portrait.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-ada.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-avax.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-bnb.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-brand.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-btc.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-clock.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-crown.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-dot.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-eth.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-hbar.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-history.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-link.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-menu.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-metamask.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-more.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-phantom.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-rewards.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-sad-face.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-sol.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-star.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-status-cancelled.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-status-pending.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-status-success.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-status-warning.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-trx.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-usdc.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-usdt.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-walletconnect.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-wei.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-xrp.png +0 -0
- package/src/modules/design_system/gallery/assets/cryptocurrency-artwork.ts +63 -0
- package/src/modules/design_system/gallery/assets/github-logo.png +0 -0
- package/src/modules/design_system/gallery/assets/images.d.ts +9 -0
- package/src/modules/design_system/gallery/assets/input-european-union.svg +18 -0
- package/src/modules/design_system/gallery/assets/landing-teams-01.png +0 -0
- package/src/modules/design_system/gallery/assets/marketing-artwork.ts +79 -0
- package/src/modules/design_system/gallery/assets/menu-apex.svg +18 -0
- package/src/modules/design_system/gallery/assets/menu-mastercard.svg +7 -0
- package/src/modules/design_system/gallery/assets/menu-spotify.svg +4 -0
- package/src/modules/design_system/gallery/assets/menu-united-states.svg +16 -0
- package/src/modules/design_system/gallery/assets/select-google.png +0 -0
- package/src/modules/design_system/gallery/assets/select-poland.png +0 -0
- package/src/modules/design_system/gallery/assets/selection-artwork.ts +1 -0
- package/src/modules/design_system/gallery/assets/social-apple-filled.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-apple-stroke.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-dropbox-filled.svg +5 -0
- package/src/modules/design_system/gallery/assets/social-dropbox-stroke.svg +5 -0
- package/src/modules/design_system/gallery/assets/social-facebook-filled.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-facebook-stroke.svg +10 -0
- package/src/modules/design_system/gallery/assets/social-github-filled.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-github-stroke.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-google-filled.svg +7 -0
- package/src/modules/design_system/gallery/assets/social-google-stroke.svg +7 -0
- package/src/modules/design_system/gallery/assets/social-linkedin-filled.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-linkedin-stroke.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-x-filled.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-x-stroke.svg +4 -0
- package/src/modules/design_system/gallery/assets/style-studio-product.png +0 -0
- package/src/modules/design_system/gallery/assets/upload-images.ts +5 -0
- package/src/modules/design_system/gallery/components/BrandStylePreview.tsx +94 -0
- package/src/modules/design_system/gallery/components/CodeSnippet.tsx +34 -34
- package/src/modules/design_system/gallery/components/ColorPlayground.tsx +324 -0
- package/src/modules/design_system/gallery/components/ColorStudioCompositions.tsx +96 -0
- package/src/modules/design_system/gallery/components/ColorStudioSpecimen.tsx +164 -0
- package/src/modules/design_system/gallery/components/CompactEntrySpecimen.tsx +65 -0
- package/src/modules/design_system/gallery/components/ComponentIndex.tsx +47 -0
- package/src/modules/design_system/gallery/components/DesignSystemHome.tsx +66 -0
- package/src/modules/design_system/gallery/components/EntryCard.tsx +52 -37
- package/src/modules/design_system/gallery/components/EntryHeader.tsx +80 -0
- package/src/modules/design_system/gallery/components/FamilyEntryPreview.tsx +22 -0
- package/src/modules/design_system/gallery/components/FoundationGuide.tsx +43 -0
- package/src/modules/design_system/gallery/components/GalleryLink.tsx +19 -0
- package/src/modules/design_system/gallery/components/GalleryNavigation.tsx +86 -0
- package/src/modules/design_system/gallery/components/GalleryShell.tsx +149 -63
- package/src/modules/design_system/gallery/components/IconsBrowser.tsx +40 -0
- package/src/modules/design_system/gallery/components/SourceLibrary.tsx +90 -0
- package/src/modules/design_system/gallery/components/StyleAgents.tsx +115 -0
- package/src/modules/design_system/gallery/components/ThemeTokenReference.tsx +76 -0
- package/src/modules/design_system/gallery/components/VariantPreview.tsx +2 -2
- package/src/modules/design_system/gallery/components/colorPreview.ts +63 -0
- package/src/modules/design_system/gallery/components/colorStudio.ts +260 -0
- package/src/modules/design_system/gallery/components/styleAgentBranding.ts +42 -0
- package/src/modules/design_system/gallery/components/themeTokens.ts +26 -0
- package/src/modules/design_system/gallery/demos/ai-product-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/ai-product.tsx +188 -0
- package/src/modules/design_system/gallery/demos/buttons.tsx +331 -0
- package/src/modules/design_system/gallery/demos/cryptocurrency.tsx +1943 -0
- package/src/modules/design_system/gallery/demos/feeds-code.generated.ts +4 -0
- package/src/modules/design_system/gallery/demos/feeds.tsx +82 -0
- package/src/modules/design_system/gallery/demos/file-upload.tsx +61 -0
- package/src/modules/design_system/gallery/demos/foundation-reference-data.ts +4872 -0
- package/src/modules/design_system/gallery/demos/foundation-references.tsx +140 -0
- package/src/modules/design_system/gallery/demos/key-components-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/key-components.tsx +106 -0
- package/src/modules/design_system/gallery/demos/marketing-controls-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/marketing-controls.tsx +92 -0
- package/src/modules/design_system/gallery/demos/marketing-widgets-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/marketing-widgets.tsx +189 -0
- package/src/modules/design_system/gallery/demos/menu-fixtures.tsx +48 -0
- package/src/modules/design_system/gallery/demos/menu-sources.ts +5 -0
- package/src/modules/design_system/gallery/demos/menus.tsx +122 -0
- package/src/modules/design_system/gallery/demos/rating-reviews.tsx +44 -0
- package/src/modules/design_system/gallery/demos/registered-icons.tsx +117 -0
- package/src/modules/design_system/gallery/demos/selection-cards.tsx +97 -0
- package/src/modules/design_system/gallery/demos/shell-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/shell.tsx +183 -0
- package/src/modules/design_system/gallery/demos/source-artwork.tsx +88 -0
- package/src/modules/design_system/gallery/demos/source-filters-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/source-filters.tsx +119 -0
- package/src/modules/design_system/gallery/demos/source-icons.tsx +62 -0
- package/src/modules/design_system/gallery/demos/table-cells-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/table-cells.tsx +144 -0
- package/src/modules/design_system/gallery/demos/text-inputs.tsx +90 -0
- package/src/modules/design_system/gallery/demos/time-picker-code.generated.ts +5 -0
- package/src/modules/design_system/gallery/demos/time-picker.tsx +31 -0
- package/src/modules/design_system/gallery/entries/banners.tsx +143 -94
- package/src/modules/design_system/gallery/entries/buttons-snippets.ts +432 -0
- package/src/modules/design_system/gallery/entries/buttons.tsx +125 -196
- package/src/modules/design_system/gallery/entries/charts.tsx +545 -233
- package/src/modules/design_system/gallery/entries/dates.tsx +171 -3
- package/src/modules/design_system/gallery/entries/detail.tsx +142 -115
- package/src/modules/design_system/gallery/entries/display.tsx +1691 -319
- package/src/modules/design_system/gallery/entries/feedback.tsx +1082 -169
- package/src/modules/design_system/gallery/entries/filters.tsx +238 -143
- package/src/modules/design_system/gallery/entries/foundations.tsx +404 -61
- package/src/modules/design_system/gallery/entries/icons.tsx +31 -117
- package/src/modules/design_system/gallery/entries/inputs-snippets.ts +156 -0
- package/src/modules/design_system/gallery/entries/inputs.tsx +2146 -503
- package/src/modules/design_system/gallery/entries/library.tsx +16 -0
- package/src/modules/design_system/gallery/entries/messages.tsx +114 -106
- package/src/modules/design_system/gallery/entries/navigation.tsx +782 -192
- package/src/modules/design_system/gallery/entries/notifications.tsx +145 -120
- package/src/modules/design_system/gallery/entries/overlays.tsx +696 -280
- package/src/modules/design_system/gallery/entries/scaffolding.tsx +1192 -158
- package/src/modules/design_system/gallery/entries/schedule.tsx +72 -58
- package/src/modules/design_system/gallery/presentation.ts +106 -0
- package/src/modules/design_system/gallery/registry.ts +8 -6
- package/src/modules/design_system/gallery/source-library.generated.ts +2 -0
- package/src/modules/design_system/i18n/de.json +7112 -3
- package/src/modules/design_system/i18n/en.json +7112 -3
- package/src/modules/design_system/i18n/es.json +7112 -3
- package/src/modules/design_system/i18n/ko.json +7112 -3
- package/src/modules/design_system/i18n/pl.json +7112 -3
- package/src/modules/push_notifications/AGENTS.md +9 -5
- package/src/modules/push_notifications/lib/queue.ts +15 -44
|
@@ -0,0 +1,1708 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Command } from "cmdk";
|
|
5
|
+
import {
|
|
6
|
+
ArrowDown,
|
|
7
|
+
ArrowDownUp,
|
|
8
|
+
ArrowUpRight,
|
|
9
|
+
Bell,
|
|
10
|
+
Check,
|
|
11
|
+
ChevronDown,
|
|
12
|
+
ChevronRight,
|
|
13
|
+
Copy,
|
|
14
|
+
Gift,
|
|
15
|
+
House,
|
|
16
|
+
Info,
|
|
17
|
+
LoaderCircle,
|
|
18
|
+
LogOut,
|
|
19
|
+
MessageSquare,
|
|
20
|
+
Moon,
|
|
21
|
+
Search,
|
|
22
|
+
Settings,
|
|
23
|
+
Share2,
|
|
24
|
+
ShieldCheck,
|
|
25
|
+
SlidersHorizontal,
|
|
26
|
+
Star,
|
|
27
|
+
X
|
|
28
|
+
} from "lucide-react";
|
|
29
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
30
|
+
import { cn } from "@open-mercato/shared/lib/utils";
|
|
31
|
+
import { Avatar } from "@open-mercato/ui/primitives/avatar";
|
|
32
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
33
|
+
import { Card } from "@open-mercato/ui/primitives/card";
|
|
34
|
+
import { Checkbox } from "@open-mercato/ui/primitives/checkbox";
|
|
35
|
+
import {
|
|
36
|
+
CommandMenuInput,
|
|
37
|
+
CommandMenuList,
|
|
38
|
+
CommandMenuItem,
|
|
39
|
+
CommandMenuEmpty,
|
|
40
|
+
CommandMenuFooter
|
|
41
|
+
} from "@open-mercato/ui/primitives/command-menu";
|
|
42
|
+
import { Dialog, DialogContent, DialogTitle, DialogDescription } from "@open-mercato/ui/primitives/dialog";
|
|
43
|
+
import { Input } from "@open-mercato/ui/primitives/input";
|
|
44
|
+
import { Popover, PopoverContent, PopoverTrigger } from "@open-mercato/ui/primitives/popover";
|
|
45
|
+
import { SearchInput } from "@open-mercato/ui/primitives/search-input";
|
|
46
|
+
import { SegmentedControl, SegmentedControlItem } from "@open-mercato/ui/primitives/segmented-control";
|
|
47
|
+
import { Switch } from "@open-mercato/ui/primitives/switch";
|
|
48
|
+
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@open-mercato/ui/primitives/tabs";
|
|
49
|
+
import { cryptoArtwork } from "../assets/cryptocurrency-artwork.js";
|
|
50
|
+
const useCryptoLabels = () => {
|
|
51
|
+
const t = useT();
|
|
52
|
+
return (key, params) => t(`design_system.gallery.samples.crypto.${key}`, params);
|
|
53
|
+
};
|
|
54
|
+
const tokenFixtures = [
|
|
55
|
+
{ symbol: "btc", name: "Bitcoin", price: 116236.51, change: 2.5, balance: 95e-4 },
|
|
56
|
+
{ symbol: "eth", name: "Ethereum", price: 2348, change: 1.3, balance: 242.4 },
|
|
57
|
+
{ symbol: "xrp", name: "XRP", price: 1.55, change: -0.2, balance: 510.82 },
|
|
58
|
+
{ symbol: "usdt", name: "TetherUS", price: 1, change: 0, balance: 125.63 },
|
|
59
|
+
{ symbol: "trx", name: "Tron", price: 123.08, change: -1.1, balance: 0 },
|
|
60
|
+
{ symbol: "sol", name: "Solana", price: 765.12, change: -2.3, balance: 0 },
|
|
61
|
+
{ symbol: "usdc", name: "USDC", price: 1, change: 0, balance: 100 },
|
|
62
|
+
{ symbol: "bnb", name: "BNB", price: 456.18, change: -1.5, balance: 0 },
|
|
63
|
+
{ symbol: "avax", name: "Avalanche", price: 789.7, change: -2, balance: 0 },
|
|
64
|
+
{ symbol: "ada", name: "Cardano", price: 101.26, change: 0.4, balance: 0 },
|
|
65
|
+
{ symbol: "hbar", name: "Hedera", price: 0.18, change: 0.1, balance: 0 },
|
|
66
|
+
{ symbol: "dot", name: "Polkadot", price: 4.2, change: -0.4, balance: 0 }
|
|
67
|
+
];
|
|
68
|
+
const tokenBySymbol = (symbol) => tokenFixtures.find((token) => token.symbol === symbol) ?? tokenFixtures[0];
|
|
69
|
+
const formatAmount = (amount, maximumFractionDigits = 2) => new Intl.NumberFormat("en-US", { maximumFractionDigits }).format(amount);
|
|
70
|
+
const money = (amount) => `$${new Intl.NumberFormat("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(amount)}`;
|
|
71
|
+
const greenButton = "rounded-full bg-status-success-solid text-status-success-solid-foreground hover:bg-status-success-solid/90";
|
|
72
|
+
const pill = "rounded-full text-muted-foreground hover:bg-muted hover:text-foreground";
|
|
73
|
+
const previewSurface = (state) => (state === "hover" || state === "active") && "bg-muted text-foreground";
|
|
74
|
+
function CryptoGlyph({
|
|
75
|
+
name,
|
|
76
|
+
className
|
|
77
|
+
}) {
|
|
78
|
+
return /* @__PURE__ */ jsx(
|
|
79
|
+
"span",
|
|
80
|
+
{
|
|
81
|
+
"aria-hidden": "true",
|
|
82
|
+
className: cn("inline-block size-4.5 shrink-0 bg-current", className),
|
|
83
|
+
style: {
|
|
84
|
+
maskImage: `url(${cryptoArtwork[name]})`,
|
|
85
|
+
WebkitMaskImage: `url(${cryptoArtwork[name]})`,
|
|
86
|
+
maskSize: "contain",
|
|
87
|
+
WebkitMaskSize: "contain",
|
|
88
|
+
maskRepeat: "no-repeat",
|
|
89
|
+
WebkitMaskRepeat: "no-repeat",
|
|
90
|
+
maskPosition: "center",
|
|
91
|
+
WebkitMaskPosition: "center"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
function TokenIcon({ symbol, className }) {
|
|
97
|
+
return /* @__PURE__ */ jsx("img", { src: cryptoArtwork[symbol], alt: "", className: cn("size-4 shrink-0 rounded-full", className) });
|
|
98
|
+
}
|
|
99
|
+
function CryptoPanel({ children, className }) {
|
|
100
|
+
return /* @__PURE__ */ jsx(
|
|
101
|
+
Card,
|
|
102
|
+
{
|
|
103
|
+
className: cn(
|
|
104
|
+
"gap-0 overflow-hidden rounded-2xl border-0 bg-background p-0 shadow-md ring-1 ring-inset ring-border",
|
|
105
|
+
className
|
|
106
|
+
),
|
|
107
|
+
children
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
function CryptoNotice({ message }) {
|
|
112
|
+
return message ? /* @__PURE__ */ jsx("p", { role: "status", className: "px-4 py-2 text-xs text-status-success-text", children: message }) : null;
|
|
113
|
+
}
|
|
114
|
+
function CryptoNavigationItem({
|
|
115
|
+
state = "default",
|
|
116
|
+
size = 28,
|
|
117
|
+
label,
|
|
118
|
+
onClick,
|
|
119
|
+
pressed
|
|
120
|
+
}) {
|
|
121
|
+
const cryptoLabel = useCryptoLabels();
|
|
122
|
+
const [selected, setSelected] = React.useState(state === "active");
|
|
123
|
+
return /* @__PURE__ */ jsx(
|
|
124
|
+
Button,
|
|
125
|
+
{
|
|
126
|
+
type: "button",
|
|
127
|
+
variant: "ghost",
|
|
128
|
+
size: "2xs",
|
|
129
|
+
"aria-pressed": pressed ?? selected,
|
|
130
|
+
onClick: () => {
|
|
131
|
+
setSelected(!selected);
|
|
132
|
+
onClick?.();
|
|
133
|
+
},
|
|
134
|
+
className: cn(
|
|
135
|
+
pill,
|
|
136
|
+
"px-3 py-0.5 font-medium",
|
|
137
|
+
size === 24 ? "h-6 text-compact" : "h-7 text-sm",
|
|
138
|
+
previewSurface(state),
|
|
139
|
+
(pressed ?? selected) && "bg-muted text-foreground"
|
|
140
|
+
),
|
|
141
|
+
children: label ?? cryptoLabel("overview")
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
function CryptoSegments({
|
|
146
|
+
type = "chart",
|
|
147
|
+
initialValue,
|
|
148
|
+
size = 24,
|
|
149
|
+
itemOnly = false,
|
|
150
|
+
state = "default"
|
|
151
|
+
}) {
|
|
152
|
+
const cryptoLabel = useCryptoLabels();
|
|
153
|
+
const values = type === "chart" ? ["1D", "1W", "1M", "3M", "1Y"] : ["compact", "detailed"];
|
|
154
|
+
const [value, setValue] = React.useState(initialValue ?? (itemOnly && state !== "active" ? "" : values[0]));
|
|
155
|
+
return /* @__PURE__ */ jsx(
|
|
156
|
+
SegmentedControl,
|
|
157
|
+
{
|
|
158
|
+
size: "sm",
|
|
159
|
+
value,
|
|
160
|
+
onValueChange: setValue,
|
|
161
|
+
"aria-label": cryptoLabel(type === "chart" ? "chartRange" : "tableDensity"),
|
|
162
|
+
className: cn(
|
|
163
|
+
"border-0 bg-muted",
|
|
164
|
+
type === "chart" ? "h-6 p-0.75" : "p-0",
|
|
165
|
+
type === "table" && (size === 28 ? "h-7" : "h-6"),
|
|
166
|
+
itemOnly && "h-auto p-0"
|
|
167
|
+
),
|
|
168
|
+
children: (itemOnly ? [values[0]] : values).map((option) => /* @__PURE__ */ jsx(
|
|
169
|
+
SegmentedControlItem,
|
|
170
|
+
{
|
|
171
|
+
value: option,
|
|
172
|
+
className: cn(
|
|
173
|
+
"px-0 text-xs leading-4 font-medium data-[state=checked]:font-medium",
|
|
174
|
+
type === "chart" ? "h-4.5 w-10" : size === 28 ? "h-7 w-20" : "h-6 w-20",
|
|
175
|
+
previewSurface(state)
|
|
176
|
+
),
|
|
177
|
+
children: type === "chart" ? option : cryptoLabel(option)
|
|
178
|
+
},
|
|
179
|
+
option
|
|
180
|
+
))
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
function CryptoTokenList({
|
|
185
|
+
onSelect,
|
|
186
|
+
favorites,
|
|
187
|
+
onFavorite,
|
|
188
|
+
showPrices = false,
|
|
189
|
+
query = "",
|
|
190
|
+
limit = 10
|
|
191
|
+
}) {
|
|
192
|
+
const cryptoLabel = useCryptoLabels();
|
|
193
|
+
const matches = tokenFixtures.slice(0, limit).filter((token) => `${token.name} ${token.symbol}`.toLowerCase().includes(query.toLowerCase()));
|
|
194
|
+
return /* @__PURE__ */ jsx("div", { className: "min-h-0 overflow-auto p-2", "data-slot": "crypto-token-list", children: matches.length === 0 ? /* @__PURE__ */ jsx("div", { className: "p-6 text-center text-sm text-muted-foreground", children: cryptoLabel("noTokens") }) : matches.map((token) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 rounded-xl hover:bg-muted", children: [
|
|
195
|
+
/* @__PURE__ */ jsxs(
|
|
196
|
+
Button,
|
|
197
|
+
{
|
|
198
|
+
type: "button",
|
|
199
|
+
variant: "ghost",
|
|
200
|
+
size: "sm",
|
|
201
|
+
onClick: () => onSelect?.(token.symbol),
|
|
202
|
+
className: "h-10 min-w-0 flex-1 justify-start gap-2 rounded-xl px-2 text-compact font-medium",
|
|
203
|
+
"aria-label": token.name,
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ jsx(TokenIcon, { symbol: token.symbol, className: "size-4.5" }),
|
|
206
|
+
/* @__PURE__ */ jsxs("span", { className: "truncate", children: [
|
|
207
|
+
token.name,
|
|
208
|
+
" ",
|
|
209
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-muted-foreground", children: `{${token.symbol.toUpperCase()}}` })
|
|
210
|
+
] }),
|
|
211
|
+
showPrices && /* @__PURE__ */ jsxs("span", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
|
|
212
|
+
/* @__PURE__ */ jsxs("span", { className: "font-mono text-sm", children: [
|
|
213
|
+
"$",
|
|
214
|
+
formatAmount(token.price)
|
|
215
|
+
] }),
|
|
216
|
+
/* @__PURE__ */ jsxs(
|
|
217
|
+
"span",
|
|
218
|
+
{
|
|
219
|
+
className: cn(
|
|
220
|
+
"text-xs",
|
|
221
|
+
token.change < 0 ? "text-status-error-text" : token.change > 0 ? "text-status-success-text" : "text-muted-foreground"
|
|
222
|
+
),
|
|
223
|
+
children: [
|
|
224
|
+
token.change > 0 ? "+" : "",
|
|
225
|
+
token.change,
|
|
226
|
+
"%"
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
] })
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
onFavorite && /* @__PURE__ */ jsx(
|
|
235
|
+
Button,
|
|
236
|
+
{
|
|
237
|
+
type: "button",
|
|
238
|
+
variant: "ghost",
|
|
239
|
+
size: "2xs",
|
|
240
|
+
className: "size-7 rounded-full p-1",
|
|
241
|
+
"aria-label": cryptoLabel(favorites?.includes(token.symbol) ? "removeFavorite" : "addFavorite", {
|
|
242
|
+
token: token.name
|
|
243
|
+
}),
|
|
244
|
+
"aria-pressed": favorites?.includes(token.symbol),
|
|
245
|
+
onClick: () => onFavorite(token.symbol),
|
|
246
|
+
children: /* @__PURE__ */ jsx(
|
|
247
|
+
Star,
|
|
248
|
+
{
|
|
249
|
+
className: cn(
|
|
250
|
+
"size-4",
|
|
251
|
+
favorites?.includes(token.symbol) ? "fill-status-warning-icon text-status-warning-icon" : "text-muted-foreground"
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] }, token.symbol)) });
|
|
258
|
+
}
|
|
259
|
+
function CryptoTokenPicker({
|
|
260
|
+
value = "btc",
|
|
261
|
+
onValueChange,
|
|
262
|
+
appearance = "lighter",
|
|
263
|
+
state = "default",
|
|
264
|
+
disabled
|
|
265
|
+
}) {
|
|
266
|
+
const cryptoLabel = useCryptoLabels();
|
|
267
|
+
const [selection, setSelection] = React.useState(value);
|
|
268
|
+
const [open, setOpen] = React.useState(false);
|
|
269
|
+
const [query, setQuery] = React.useState("");
|
|
270
|
+
React.useEffect(() => setSelection(value), [value]);
|
|
271
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
272
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
273
|
+
Button,
|
|
274
|
+
{
|
|
275
|
+
type: "button",
|
|
276
|
+
variant: "ghost",
|
|
277
|
+
size: "2xs",
|
|
278
|
+
disabled,
|
|
279
|
+
"aria-label": cryptoLabel("selectToken"),
|
|
280
|
+
className: cn(
|
|
281
|
+
pill,
|
|
282
|
+
"h-7 gap-1 px-1.5 font-mono text-sm",
|
|
283
|
+
appearance === "stroke" ? "border border-border bg-background" : "bg-muted",
|
|
284
|
+
previewSurface(state)
|
|
285
|
+
),
|
|
286
|
+
children: [
|
|
287
|
+
/* @__PURE__ */ jsx(TokenIcon, { symbol: selection }),
|
|
288
|
+
selection.toUpperCase(),
|
|
289
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn("size-4 transition-transform", open && "rotate-180") })
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
) }),
|
|
293
|
+
/* @__PURE__ */ jsxs(PopoverContent, { className: "w-70 min-w-0 overflow-hidden rounded-2xl", align: "end", children: [
|
|
294
|
+
/* @__PURE__ */ jsx(
|
|
295
|
+
SearchInput,
|
|
296
|
+
{
|
|
297
|
+
"aria-label": cryptoLabel("searchTokens"),
|
|
298
|
+
placeholder: cryptoLabel("searchTokens"),
|
|
299
|
+
value: query,
|
|
300
|
+
onChange: setQuery,
|
|
301
|
+
className: "h-10 rounded-none border-0 border-b shadow-none",
|
|
302
|
+
inputClassName: "text-compact"
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-68 overflow-auto", children: /* @__PURE__ */ jsx(
|
|
306
|
+
CryptoTokenList,
|
|
307
|
+
{
|
|
308
|
+
query,
|
|
309
|
+
onSelect: (token) => {
|
|
310
|
+
setSelection(token);
|
|
311
|
+
onValueChange?.(token);
|
|
312
|
+
setOpen(false);
|
|
313
|
+
},
|
|
314
|
+
limit: 12
|
|
315
|
+
}
|
|
316
|
+
) })
|
|
317
|
+
] })
|
|
318
|
+
] });
|
|
319
|
+
}
|
|
320
|
+
function CryptoSearch({
|
|
321
|
+
state = "default",
|
|
322
|
+
inputOnly = false,
|
|
323
|
+
onSelect
|
|
324
|
+
}) {
|
|
325
|
+
const cryptoLabel = useCryptoLabels();
|
|
326
|
+
const [query, setQuery] = React.useState(
|
|
327
|
+
state === "empty" ? "unlisted token" : state === "searching" || state === "active" ? "Ethereum" : ""
|
|
328
|
+
);
|
|
329
|
+
const [selected, setSelected] = React.useState("");
|
|
330
|
+
const [tab, setTab] = React.useState("tokens");
|
|
331
|
+
const searchTokens = query.toLowerCase().includes("ethereum") ? [
|
|
332
|
+
{ ...tokenFixtures[1], name: "Ethereum" },
|
|
333
|
+
{ ...tokenFixtures[1], name: "Arbitrum ETH", price: 123.08, change: -0.2 },
|
|
334
|
+
{ ...tokenFixtures[1], name: "Optimistic ETH", price: 98.04, change: 0.9 },
|
|
335
|
+
{ ...tokenFixtures[1], name: "Base ETH", price: 456.18, change: -2.3 }
|
|
336
|
+
] : tokenFixtures.slice(0, 10);
|
|
337
|
+
return /* @__PURE__ */ jsxs(
|
|
338
|
+
CryptoPanel,
|
|
339
|
+
{
|
|
340
|
+
className: cn(
|
|
341
|
+
"w-120 max-w-full",
|
|
342
|
+
!inputOnly && (query ? "h-99" : "h-137"),
|
|
343
|
+
inputOnly && "rounded-none border-0 shadow-none"
|
|
344
|
+
),
|
|
345
|
+
children: [
|
|
346
|
+
/* @__PURE__ */ jsxs(
|
|
347
|
+
Command,
|
|
348
|
+
{
|
|
349
|
+
shouldFilter: !query.toLowerCase().includes("ethereum"),
|
|
350
|
+
className: "flex min-h-0 flex-1 flex-col",
|
|
351
|
+
label: cryptoLabel("searchTokens"),
|
|
352
|
+
children: [
|
|
353
|
+
/* @__PURE__ */ jsx(
|
|
354
|
+
CommandMenuInput,
|
|
355
|
+
{
|
|
356
|
+
value: query,
|
|
357
|
+
onValueChange: setQuery,
|
|
358
|
+
showShortcut: false,
|
|
359
|
+
showClear: true,
|
|
360
|
+
appearance: "source",
|
|
361
|
+
placeholder: cryptoLabel("searchPairs"),
|
|
362
|
+
"aria-label": cryptoLabel("searchPairs"),
|
|
363
|
+
className: "text-compact",
|
|
364
|
+
wrapperClassName: "h-12 shrink-0 px-4 py-3.5 [&>svg]:size-4.5 focus-within:[&>svg]:text-status-success-icon"
|
|
365
|
+
}
|
|
366
|
+
),
|
|
367
|
+
!inputOnly && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
368
|
+
!query && /* @__PURE__ */ jsx(
|
|
369
|
+
"div",
|
|
370
|
+
{
|
|
371
|
+
className: "flex h-9 shrink-0 items-center gap-5 border-b border-border px-5",
|
|
372
|
+
role: "tablist",
|
|
373
|
+
"aria-label": cryptoLabel("searchCategory"),
|
|
374
|
+
children: ["tokens", "trade", "rewards"].map((option) => /* @__PURE__ */ jsx(
|
|
375
|
+
Button,
|
|
376
|
+
{
|
|
377
|
+
type: "button",
|
|
378
|
+
role: "tab",
|
|
379
|
+
"aria-selected": tab === option,
|
|
380
|
+
variant: "ghost",
|
|
381
|
+
size: "2xs",
|
|
382
|
+
onClick: () => setTab(option),
|
|
383
|
+
className: cn(
|
|
384
|
+
"h-10 rounded-none border-b px-0 font-mono text-xs uppercase",
|
|
385
|
+
tab === option ? "border-status-success-icon text-foreground" : "border-transparent text-muted-foreground"
|
|
386
|
+
),
|
|
387
|
+
children: cryptoLabel(option)
|
|
388
|
+
},
|
|
389
|
+
option
|
|
390
|
+
))
|
|
391
|
+
}
|
|
392
|
+
),
|
|
393
|
+
query && /* @__PURE__ */ jsx("div", { className: "flex h-9 shrink-0 items-end px-5 pb-1 font-mono text-overline text-muted-foreground", children: cryptoLabel("results") }),
|
|
394
|
+
/* @__PURE__ */ jsxs(CommandMenuList, { className: "min-h-0 max-h-none flex-1 p-2", children: [
|
|
395
|
+
/* @__PURE__ */ jsxs(CommandMenuEmpty, { className: "flex h-full flex-col items-center justify-center gap-3 p-8 text-center", children: [
|
|
396
|
+
/* @__PURE__ */ jsx("span", { className: "flex size-20 items-center justify-center rounded-full bg-muted", children: /* @__PURE__ */ jsx("img", { src: cryptoArtwork.sadFace, alt: "", className: "size-8" }) }),
|
|
397
|
+
/* @__PURE__ */ jsx("strong", { className: "text-compact font-medium text-foreground", children: cryptoLabel("noTokens") }),
|
|
398
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs", children: cryptoLabel("tryAnotherSearch") })
|
|
399
|
+
] }),
|
|
400
|
+
searchTokens.map((token) => /* @__PURE__ */ jsx(
|
|
401
|
+
CommandMenuItem,
|
|
402
|
+
{
|
|
403
|
+
value: token.name,
|
|
404
|
+
keywords: [token.symbol],
|
|
405
|
+
onSelect: () => {
|
|
406
|
+
setSelected(cryptoLabel("selectedToken", { token: token.name }));
|
|
407
|
+
onSelect?.(token.symbol);
|
|
408
|
+
},
|
|
409
|
+
hideChevron: true,
|
|
410
|
+
className: "h-10 gap-2 rounded-xl px-2 py-2 text-compact [&_[data-slot=command-menu-item-text]>div>span]:text-compact",
|
|
411
|
+
leading: /* @__PURE__ */ jsx(TokenIcon, { symbol: token.symbol }),
|
|
412
|
+
sublabel: `{${token.symbol.toUpperCase()}}`,
|
|
413
|
+
shortcut: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
414
|
+
/* @__PURE__ */ jsxs("span", { className: "font-mono text-sm", children: [
|
|
415
|
+
"$",
|
|
416
|
+
formatAmount(token.price)
|
|
417
|
+
] }),
|
|
418
|
+
/* @__PURE__ */ jsxs(
|
|
419
|
+
"span",
|
|
420
|
+
{
|
|
421
|
+
className: cn(
|
|
422
|
+
"text-xs",
|
|
423
|
+
token.change < 0 ? "text-status-error-text" : "text-status-success-text"
|
|
424
|
+
),
|
|
425
|
+
children: [
|
|
426
|
+
token.change > 0 ? "+" : "",
|
|
427
|
+
token.change,
|
|
428
|
+
"%"
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
)
|
|
432
|
+
] }),
|
|
433
|
+
children: token.name
|
|
434
|
+
},
|
|
435
|
+
token.name
|
|
436
|
+
))
|
|
437
|
+
] }),
|
|
438
|
+
/* @__PURE__ */ jsx(CommandMenuFooter, { className: "h-12 shrink-0 border-t border-border px-4 font-mono text-overline uppercase [&_kbd]:rounded-full" })
|
|
439
|
+
] })
|
|
440
|
+
]
|
|
441
|
+
}
|
|
442
|
+
),
|
|
443
|
+
/* @__PURE__ */ jsx(CryptoNotice, { message: selected })
|
|
444
|
+
]
|
|
445
|
+
}
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
function CryptoNavigationSearch({ state = "default" }) {
|
|
449
|
+
const cryptoLabel = useCryptoLabels();
|
|
450
|
+
const [open, setOpen] = React.useState(false);
|
|
451
|
+
React.useEffect(() => {
|
|
452
|
+
const onKey = (event) => {
|
|
453
|
+
if (event.defaultPrevented || event.target instanceof HTMLElement && event.target.isContentEditable) return;
|
|
454
|
+
if ((event.ctrlKey || event.metaKey) && event.key === "k" || event.key === "/" && !(event.target instanceof HTMLInputElement) && !(event.target instanceof HTMLTextAreaElement)) {
|
|
455
|
+
event.preventDefault();
|
|
456
|
+
setOpen(true);
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
window.addEventListener("keydown", onKey);
|
|
460
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
461
|
+
}, []);
|
|
462
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
463
|
+
/* @__PURE__ */ jsxs(
|
|
464
|
+
Button,
|
|
465
|
+
{
|
|
466
|
+
type: "button",
|
|
467
|
+
variant: "ghost",
|
|
468
|
+
size: "sm",
|
|
469
|
+
onClick: () => setOpen(true),
|
|
470
|
+
className: cn(
|
|
471
|
+
"h-8 w-91 max-w-full justify-start gap-2 rounded-full bg-muted py-1.5 pl-2 pr-1.5 text-compact text-muted-foreground",
|
|
472
|
+
previewSurface(state)
|
|
473
|
+
),
|
|
474
|
+
children: [
|
|
475
|
+
/* @__PURE__ */ jsx(Search, { className: "size-4" }),
|
|
476
|
+
cryptoLabel("searchPairs"),
|
|
477
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto flex size-5 items-center justify-center rounded-full bg-background text-xs", children: "/" })
|
|
478
|
+
]
|
|
479
|
+
}
|
|
480
|
+
),
|
|
481
|
+
/* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "w-120 max-w-full border-0 bg-transparent p-0 shadow-none [&>button]:hidden", children: [
|
|
482
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "sr-only", children: cryptoLabel("searchTokens") }),
|
|
483
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "sr-only", children: cryptoLabel("chooseToken") }),
|
|
484
|
+
/* @__PURE__ */ jsx(CryptoSearch, { onSelect: () => setOpen(false) })
|
|
485
|
+
] }) })
|
|
486
|
+
] });
|
|
487
|
+
}
|
|
488
|
+
function CryptoSwapInput({
|
|
489
|
+
type = "selling",
|
|
490
|
+
state = "default",
|
|
491
|
+
value: controlledValue,
|
|
492
|
+
onValueChange,
|
|
493
|
+
token: controlledToken,
|
|
494
|
+
onTokenChange,
|
|
495
|
+
available = 95e-4
|
|
496
|
+
}) {
|
|
497
|
+
const cryptoLabel = useCryptoLabels();
|
|
498
|
+
const [inputValue, setInputValue] = React.useState(
|
|
499
|
+
["active", "filled", "error"].includes(state) ? type === "receive" ? "1050.64" : "0.0095" : ""
|
|
500
|
+
);
|
|
501
|
+
const [token, setToken] = React.useState(type === "receive" ? "usdc" : "btc");
|
|
502
|
+
const value = controlledValue ?? inputValue;
|
|
503
|
+
const activeToken = controlledToken ?? token;
|
|
504
|
+
const error = state === "error" || type !== "receive" && value !== "" && (!Number.isFinite(Number(value)) || Number(value) < 0 || Number(value) > available);
|
|
505
|
+
const tokenValue = tokenBySymbol(activeToken);
|
|
506
|
+
return /* @__PURE__ */ jsx(
|
|
507
|
+
"div",
|
|
508
|
+
{
|
|
509
|
+
"data-slot": "crypto-swap-input",
|
|
510
|
+
className: "relative flex h-32 w-94 max-w-full gap-4 bg-background px-6 pt-6 pb-5",
|
|
511
|
+
children: /* @__PURE__ */ jsxs(
|
|
512
|
+
"div",
|
|
513
|
+
{
|
|
514
|
+
className: cn(
|
|
515
|
+
"min-w-0 flex-1 border-b border-border pb-4 focus-within:border-status-success-icon",
|
|
516
|
+
error && "border-status-error-icon focus-within:border-status-error-icon",
|
|
517
|
+
state === "active" && "border-status-success-icon"
|
|
518
|
+
),
|
|
519
|
+
children: [
|
|
520
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2", children: [
|
|
521
|
+
/* @__PURE__ */ jsxs("label", { className: "min-w-0 flex-1 text-compact text-muted-foreground", children: [
|
|
522
|
+
cryptoLabel(type === "receive" ? "receiving" : "selling"),
|
|
523
|
+
/* @__PURE__ */ jsx(
|
|
524
|
+
Input,
|
|
525
|
+
{
|
|
526
|
+
"aria-label": cryptoLabel(type === "receive" ? "receiving" : "selling"),
|
|
527
|
+
type: "text",
|
|
528
|
+
inputMode: "decimal",
|
|
529
|
+
value,
|
|
530
|
+
onChange: (event) => {
|
|
531
|
+
setInputValue(event.target.value);
|
|
532
|
+
onValueChange?.(event.target.value);
|
|
533
|
+
},
|
|
534
|
+
placeholder: "0",
|
|
535
|
+
disabled: state === "disabled",
|
|
536
|
+
"aria-invalid": error || void 0,
|
|
537
|
+
className: "h-10 border-0 bg-transparent p-0 shadow-none hover:bg-transparent focus-within:shadow-none has-[input:disabled]:bg-transparent",
|
|
538
|
+
inputClassName: cn("text-title-4 tracking-tight text-foreground", error && "text-status-error-text")
|
|
539
|
+
}
|
|
540
|
+
)
|
|
541
|
+
] }),
|
|
542
|
+
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 flex-col items-end gap-4", children: [
|
|
543
|
+
/* @__PURE__ */ jsx(
|
|
544
|
+
CryptoTokenPicker,
|
|
545
|
+
{
|
|
546
|
+
value: activeToken,
|
|
547
|
+
onValueChange: (next) => {
|
|
548
|
+
setToken(next);
|
|
549
|
+
onTokenChange?.(next);
|
|
550
|
+
},
|
|
551
|
+
disabled: state === "disabled"
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
type !== "receive" && value && /* @__PURE__ */ jsxs(
|
|
555
|
+
Button,
|
|
556
|
+
{
|
|
557
|
+
type: "button",
|
|
558
|
+
variant: "ghost",
|
|
559
|
+
size: "2xs",
|
|
560
|
+
className: "h-4 gap-1 px-0 text-xs text-muted-foreground hover:bg-transparent",
|
|
561
|
+
disabled: state === "disabled",
|
|
562
|
+
onClick: () => {
|
|
563
|
+
const next = String(available);
|
|
564
|
+
setInputValue(next);
|
|
565
|
+
onValueChange?.(next);
|
|
566
|
+
},
|
|
567
|
+
children: [
|
|
568
|
+
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: cryptoLabel("available") }),
|
|
569
|
+
/* @__PURE__ */ jsxs("span", { className: "underline", children: [
|
|
570
|
+
available,
|
|
571
|
+
" ",
|
|
572
|
+
activeToken.toUpperCase()
|
|
573
|
+
] })
|
|
574
|
+
]
|
|
575
|
+
}
|
|
576
|
+
)
|
|
577
|
+
] })
|
|
578
|
+
] }),
|
|
579
|
+
/* @__PURE__ */ jsx("p", { className: "font-mono text-xs text-muted-foreground", children: money(Number.isFinite(Number(value)) ? Number(value) * tokenValue.price : 0) })
|
|
580
|
+
]
|
|
581
|
+
}
|
|
582
|
+
)
|
|
583
|
+
}
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
function CryptoSwap({ step = 1 }) {
|
|
587
|
+
const cryptoLabel = useCryptoLabels();
|
|
588
|
+
const [amount, setAmount] = React.useState(step === 1 ? "" : "0.0095");
|
|
589
|
+
const [sellingToken, setSellingToken] = React.useState("btc");
|
|
590
|
+
const [receivingToken, setReceivingToken] = React.useState("usdc");
|
|
591
|
+
const [phase, setPhase] = React.useState(
|
|
592
|
+
step === 1 ? "input" : step === 2 ? "quote" : "ready"
|
|
593
|
+
);
|
|
594
|
+
const [mode, setMode] = React.useState("swap");
|
|
595
|
+
const [slippage, setSlippage] = React.useState("0.5");
|
|
596
|
+
const selling = tokenBySymbol(sellingToken);
|
|
597
|
+
const receiving = tokenBySymbol(receivingToken);
|
|
598
|
+
const numericAmount = Number(amount);
|
|
599
|
+
const valid = amount.trim() !== "" && Number.isFinite(numericAmount) && numericAmount > 0 && numericAmount <= selling.balance && sellingToken !== receivingToken;
|
|
600
|
+
const quote = valid ? numericAmount * selling.price / receiving.price : 0;
|
|
601
|
+
const updateAmount = (next) => {
|
|
602
|
+
setAmount(next);
|
|
603
|
+
setPhase("input");
|
|
604
|
+
};
|
|
605
|
+
const submit = () => {
|
|
606
|
+
if (!valid) return;
|
|
607
|
+
setPhase(phase === "ready" ? "confirmed" : "ready");
|
|
608
|
+
};
|
|
609
|
+
return /* @__PURE__ */ jsxs(
|
|
610
|
+
"div",
|
|
611
|
+
{
|
|
612
|
+
className: "flex min-h-129 w-94 max-w-full flex-col bg-background",
|
|
613
|
+
"data-slot": "crypto-swap",
|
|
614
|
+
onKeyDown: (event) => {
|
|
615
|
+
if ((event.metaKey || event.ctrlKey) && event.key === "Enter") {
|
|
616
|
+
event.preventDefault();
|
|
617
|
+
submit();
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
children: [
|
|
621
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-12 items-center justify-between gap-2 border-b border-border px-4", children: [
|
|
622
|
+
/* @__PURE__ */ jsx(
|
|
623
|
+
SegmentedControl,
|
|
624
|
+
{
|
|
625
|
+
size: "sm",
|
|
626
|
+
value: mode,
|
|
627
|
+
onValueChange: setMode,
|
|
628
|
+
className: "h-6 border-0 bg-transparent p-0",
|
|
629
|
+
"aria-label": cryptoLabel("transactionMode"),
|
|
630
|
+
children: ["swap", "send", "buy"].map((option) => /* @__PURE__ */ jsx(
|
|
631
|
+
SegmentedControlItem,
|
|
632
|
+
{
|
|
633
|
+
value: option,
|
|
634
|
+
className: "h-6 px-3 text-compact data-[state=checked]:bg-muted data-[state=checked]:shadow-none",
|
|
635
|
+
children: cryptoLabel(option)
|
|
636
|
+
},
|
|
637
|
+
option
|
|
638
|
+
))
|
|
639
|
+
}
|
|
640
|
+
),
|
|
641
|
+
/* @__PURE__ */ jsxs(Popover, { children: [
|
|
642
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
643
|
+
Button,
|
|
644
|
+
{
|
|
645
|
+
type: "button",
|
|
646
|
+
variant: "ghost",
|
|
647
|
+
size: "2xs",
|
|
648
|
+
className: "size-7 rounded-full p-1",
|
|
649
|
+
"aria-label": cryptoLabel("swapSettings"),
|
|
650
|
+
children: /* @__PURE__ */ jsx(Settings, { className: "size-4" })
|
|
651
|
+
}
|
|
652
|
+
) }),
|
|
653
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-60 min-w-0 p-4", children: /* @__PURE__ */ jsxs("label", { className: "grid gap-2 text-sm", children: [
|
|
654
|
+
cryptoLabel("slippage"),
|
|
655
|
+
/* @__PURE__ */ jsx(
|
|
656
|
+
Input,
|
|
657
|
+
{
|
|
658
|
+
type: "number",
|
|
659
|
+
min: "0",
|
|
660
|
+
max: "5",
|
|
661
|
+
step: "0.1",
|
|
662
|
+
value: slippage,
|
|
663
|
+
onChange: (event) => setSlippage(event.target.value)
|
|
664
|
+
}
|
|
665
|
+
)
|
|
666
|
+
] }) })
|
|
667
|
+
] })
|
|
668
|
+
] }),
|
|
669
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex flex-1 flex-col ring-1 ring-inset ring-border", children: [
|
|
670
|
+
/* @__PURE__ */ jsx(
|
|
671
|
+
CryptoSwapInput,
|
|
672
|
+
{
|
|
673
|
+
value: amount,
|
|
674
|
+
onValueChange: updateAmount,
|
|
675
|
+
token: sellingToken,
|
|
676
|
+
onTokenChange: (token) => {
|
|
677
|
+
setSellingToken(token);
|
|
678
|
+
setAmount("");
|
|
679
|
+
setPhase("input");
|
|
680
|
+
},
|
|
681
|
+
available: selling.balance
|
|
682
|
+
}
|
|
683
|
+
),
|
|
684
|
+
/* @__PURE__ */ jsx(
|
|
685
|
+
Button,
|
|
686
|
+
{
|
|
687
|
+
type: "button",
|
|
688
|
+
variant: "ghost",
|
|
689
|
+
size: "2xs",
|
|
690
|
+
className: "absolute top-28 left-1/2 z-10 size-9 -translate-x-1/2 rounded-full border-4 border-background bg-muted p-1.5",
|
|
691
|
+
"aria-label": cryptoLabel("reverseTokens"),
|
|
692
|
+
onClick: () => {
|
|
693
|
+
setSellingToken(receivingToken);
|
|
694
|
+
setReceivingToken(sellingToken);
|
|
695
|
+
setAmount("");
|
|
696
|
+
setPhase("input");
|
|
697
|
+
},
|
|
698
|
+
children: /* @__PURE__ */ jsx(ArrowDown, { className: "size-4" })
|
|
699
|
+
}
|
|
700
|
+
),
|
|
701
|
+
/* @__PURE__ */ jsx(
|
|
702
|
+
CryptoSwapInput,
|
|
703
|
+
{
|
|
704
|
+
type: "receive",
|
|
705
|
+
value: phase === "ready" || phase === "confirmed" ? String(Number(quote.toFixed(receivingToken === "usdc" || receivingToken === "usdt" ? 2 : 6))) : "",
|
|
706
|
+
onValueChange: (next) => {
|
|
707
|
+
const input = Number(next) * receiving.price / selling.price;
|
|
708
|
+
updateAmount(Number.isFinite(input) ? String(input) : "");
|
|
709
|
+
},
|
|
710
|
+
token: receivingToken,
|
|
711
|
+
onTokenChange: (token) => {
|
|
712
|
+
setReceivingToken(token);
|
|
713
|
+
setPhase("input");
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
),
|
|
717
|
+
/* @__PURE__ */ jsxs("div", { className: "grid min-h-44 flex-1 gap-3 border-t border-border px-6 py-6", children: [
|
|
718
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-2 text-xs text-muted-foreground", children: ["transactionFee", "serviceFee", "executionDifference"].map((key, index) => /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
719
|
+
/* @__PURE__ */ jsx("span", { children: cryptoLabel(key) }),
|
|
720
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono", children: index === 0 ? `0 ${receivingToken.toUpperCase()}` : "0%" })
|
|
721
|
+
] }, key)) }),
|
|
722
|
+
/* @__PURE__ */ jsxs(
|
|
723
|
+
Button,
|
|
724
|
+
{
|
|
725
|
+
type: "button",
|
|
726
|
+
disabled: !valid || phase === "confirmed",
|
|
727
|
+
onClick: submit,
|
|
728
|
+
className: cn(
|
|
729
|
+
"w-full rounded-full",
|
|
730
|
+
phase === "ready" ? greenButton : "bg-muted text-foreground hover:bg-muted/70"
|
|
731
|
+
),
|
|
732
|
+
children: [
|
|
733
|
+
phase === "quote" && /* @__PURE__ */ jsx(LoaderCircle, { "aria-hidden": "true", className: "size-4 animate-spin text-status-success-icon" }),
|
|
734
|
+
cryptoLabel(
|
|
735
|
+
phase === "confirmed" ? "swapConfirmed" : phase === "ready" ? "confirmSwap" : phase === "quote" ? "finalizingQuote" : valid ? "getQuote" : "enterAmount"
|
|
736
|
+
)
|
|
737
|
+
]
|
|
738
|
+
}
|
|
739
|
+
),
|
|
740
|
+
amount && !valid && /* @__PURE__ */ jsx("p", { role: "alert", className: "text-xs text-status-error-text", children: cryptoLabel(sellingToken === receivingToken ? "differentTokens" : "invalidAmount") })
|
|
741
|
+
] })
|
|
742
|
+
] }),
|
|
743
|
+
/* @__PURE__ */ jsx("p", { className: "flex h-9 shrink-0 items-center justify-center px-6 text-center text-xs text-muted-foreground", children: cryptoLabel("localSimulation") })
|
|
744
|
+
]
|
|
745
|
+
}
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
const filterValues = {
|
|
749
|
+
type: ["swap", "buy", "send"],
|
|
750
|
+
date: ["last24Hours", "last7Days", "lastMonth", "lastQuarter", "lastYear"],
|
|
751
|
+
status: ["success", "pending", "failed", "cancelled"],
|
|
752
|
+
token: tokenFixtures.slice(0, 7).map((token) => token.symbol)
|
|
753
|
+
};
|
|
754
|
+
function CryptoFilterOptions({
|
|
755
|
+
kind,
|
|
756
|
+
value,
|
|
757
|
+
onChange
|
|
758
|
+
}) {
|
|
759
|
+
const cryptoLabel = useCryptoLabels();
|
|
760
|
+
const [query, setQuery] = React.useState("");
|
|
761
|
+
const options = filterValues[kind] ?? filterValues.type;
|
|
762
|
+
const shown = options.filter(
|
|
763
|
+
(option) => (kind === "token" ? tokenBySymbol(option).name : cryptoLabel(option)).toLowerCase().includes(query.toLowerCase())
|
|
764
|
+
);
|
|
765
|
+
const toggle = (option) => onChange(value.includes(option) ? value.filter((item) => item !== option) : [...value, option]);
|
|
766
|
+
const all = options.every((option) => value.includes(option));
|
|
767
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(kind === "token" ? "w-93 max-w-full" : "w-42"), "data-slot": "crypto-filter-options", children: [
|
|
768
|
+
kind === "token" && /* @__PURE__ */ jsx(
|
|
769
|
+
SearchInput,
|
|
770
|
+
{
|
|
771
|
+
"aria-label": cryptoLabel("searchTokens"),
|
|
772
|
+
placeholder: cryptoLabel("searchTokens"),
|
|
773
|
+
value: query,
|
|
774
|
+
onChange: setQuery,
|
|
775
|
+
className: "h-10 rounded-none border-0 border-b shadow-none",
|
|
776
|
+
inputClassName: "text-compact"
|
|
777
|
+
}
|
|
778
|
+
),
|
|
779
|
+
/* @__PURE__ */ jsxs("div", { className: cn("overflow-auto p-1", kind === "token" ? "max-h-79.5" : "max-h-80 pb-1.5"), children: [
|
|
780
|
+
/* @__PURE__ */ jsxs("label", { className: "mx-1 flex h-8 cursor-pointer items-center gap-2 border-b border-border px-1 text-xs", children: [
|
|
781
|
+
/* @__PURE__ */ jsx(
|
|
782
|
+
Checkbox,
|
|
783
|
+
{
|
|
784
|
+
checked: all ? true : value.length ? "indeterminate" : false,
|
|
785
|
+
onCheckedChange: () => onChange(all ? [] : [...options]),
|
|
786
|
+
className: "size-3.5 rounded-sm data-[state=checked]:border-status-success-icon data-[state=checked]:bg-status-success-icon data-[state=indeterminate]:bg-status-success-icon data-[state=indeterminate]:border-status-success-icon"
|
|
787
|
+
}
|
|
788
|
+
),
|
|
789
|
+
cryptoLabel(kind === "date" ? "allTime" : "selectAll"),
|
|
790
|
+
kind === "token" && /* @__PURE__ */ jsx(
|
|
791
|
+
Button,
|
|
792
|
+
{
|
|
793
|
+
type: "button",
|
|
794
|
+
variant: "ghost",
|
|
795
|
+
size: "2xs",
|
|
796
|
+
className: "ml-auto h-6 px-1 text-xs text-muted-foreground",
|
|
797
|
+
onClick: (event) => {
|
|
798
|
+
event.preventDefault();
|
|
799
|
+
onChange([]);
|
|
800
|
+
},
|
|
801
|
+
children: cryptoLabel("clear")
|
|
802
|
+
}
|
|
803
|
+
)
|
|
804
|
+
] }),
|
|
805
|
+
shown.map((option) => /* @__PURE__ */ jsxs(
|
|
806
|
+
"label",
|
|
807
|
+
{
|
|
808
|
+
className: cn(
|
|
809
|
+
"flex cursor-pointer items-center gap-2 rounded-lg px-2 text-xs hover:bg-muted",
|
|
810
|
+
kind === "token" ? "h-10" : "h-7.5"
|
|
811
|
+
),
|
|
812
|
+
children: [
|
|
813
|
+
/* @__PURE__ */ jsx(
|
|
814
|
+
Checkbox,
|
|
815
|
+
{
|
|
816
|
+
checked: value.includes(option),
|
|
817
|
+
onCheckedChange: () => toggle(option),
|
|
818
|
+
className: "size-3.5 rounded-sm data-[state=checked]:border-status-success-icon data-[state=checked]:bg-status-success-icon"
|
|
819
|
+
}
|
|
820
|
+
),
|
|
821
|
+
kind === "token" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
822
|
+
/* @__PURE__ */ jsx(TokenIcon, { symbol: tokenBySymbol(option).symbol }),
|
|
823
|
+
tokenBySymbol(option).name,
|
|
824
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-muted-foreground", children: `{${option.toUpperCase()}}` })
|
|
825
|
+
] }) : cryptoLabel(option)
|
|
826
|
+
]
|
|
827
|
+
},
|
|
828
|
+
option
|
|
829
|
+
)),
|
|
830
|
+
shown.length === 0 && /* @__PURE__ */ jsx("p", { className: "p-4 text-xs text-muted-foreground", children: cryptoLabel("noTokens") })
|
|
831
|
+
] })
|
|
832
|
+
] });
|
|
833
|
+
}
|
|
834
|
+
function CryptoFilter({
|
|
835
|
+
kind = "type",
|
|
836
|
+
state = "default",
|
|
837
|
+
standalone = false
|
|
838
|
+
}) {
|
|
839
|
+
const cryptoLabel = useCryptoLabels();
|
|
840
|
+
const [value, setValue] = React.useState(
|
|
841
|
+
state === "selected" ? [kind === "date" ? "last24Hours" : kind === "token" ? "eth" : kind === "status" ? "pending" : "swap"] : standalone ? [kind === "date" ? "lastMonth" : kind === "token" ? "usdt" : kind === "status" ? "failed" : "send"] : []
|
|
842
|
+
);
|
|
843
|
+
const [open, setOpen] = React.useState(false);
|
|
844
|
+
if (standalone)
|
|
845
|
+
return /* @__PURE__ */ jsx(CryptoPanel, { className: "w-fit max-w-full", children: /* @__PURE__ */ jsx(CryptoFilterOptions, { kind, value, onChange: setValue }) });
|
|
846
|
+
const selectedLabel = value.length === 0 ? cryptoLabel(kind === "date" ? "allTime" : "all") : value.length === 1 ? kind === "token" ? tokenBySymbol(value[0]).name : cryptoLabel(value[0]) : cryptoLabel("selectedCount", { count: value.length });
|
|
847
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
848
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
849
|
+
Button,
|
|
850
|
+
{
|
|
851
|
+
type: "button",
|
|
852
|
+
variant: "ghost",
|
|
853
|
+
size: "2xs",
|
|
854
|
+
"aria-label": cryptoLabel("filterBy", { filter: cryptoLabel(kind) }),
|
|
855
|
+
className: "h-6 gap-0 overflow-hidden rounded-full border border-border p-0 text-xs",
|
|
856
|
+
children: [
|
|
857
|
+
/* @__PURE__ */ jsx("span", { className: "flex h-full items-center border-r border-border px-3 text-muted-foreground", children: cryptoLabel(kind) }),
|
|
858
|
+
/* @__PURE__ */ jsxs("span", { className: cn("flex h-full items-center gap-1 pr-2 pl-2.5", previewSurface(state)), children: [
|
|
859
|
+
kind === "token" && value.length === 1 && /* @__PURE__ */ jsx(TokenIcon, { symbol: tokenBySymbol(value[0]).symbol, className: "size-3.5" }),
|
|
860
|
+
kind === "status" && value.length === 1 && /* @__PURE__ */ jsx("img", { src: cryptoArtwork.statusPending, alt: "", className: "size-3" }),
|
|
861
|
+
selectedLabel,
|
|
862
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: cn("size-4", open && "rotate-180") })
|
|
863
|
+
] })
|
|
864
|
+
]
|
|
865
|
+
}
|
|
866
|
+
) }),
|
|
867
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-fit min-w-0 rounded-xl", children: /* @__PURE__ */ jsx(CryptoFilterOptions, { kind, value, onChange: setValue }) })
|
|
868
|
+
] });
|
|
869
|
+
}
|
|
870
|
+
function CryptoTableTabs({ kind = "transaction", state = "default" }) {
|
|
871
|
+
const cryptoLabel = useCryptoLabels();
|
|
872
|
+
const [value, setValue] = React.useState(state === "active" ? kind : "");
|
|
873
|
+
return /* @__PURE__ */ jsxs(Tabs, { variant: "underline", value, onValueChange: setValue, children: [
|
|
874
|
+
/* @__PURE__ */ jsx(TabsList, { className: "h-9 gap-6 border-0 p-0", children: [kind].map((option) => /* @__PURE__ */ jsx(
|
|
875
|
+
TabsTrigger,
|
|
876
|
+
{
|
|
877
|
+
value: option,
|
|
878
|
+
leading: /* @__PURE__ */ jsx(
|
|
879
|
+
CryptoGlyph,
|
|
880
|
+
{
|
|
881
|
+
name: option === "transaction" ? "history" : option === "open-orders" ? "clock" : "rewards"
|
|
882
|
+
}
|
|
883
|
+
),
|
|
884
|
+
className: cn(
|
|
885
|
+
"h-9 gap-1.5 rounded-none border-b border-border px-0 pt-0 pb-4 text-sm hover:bg-transparent hover:text-foreground [&_[data-slot=tabs-trigger-leading]]:text-current [&_[data-slot=tabs-trigger-leading]]:group-hover:text-current data-[state=active]:border-status-success-icon data-[state=active]:text-foreground after:hidden",
|
|
886
|
+
previewSurface(state)
|
|
887
|
+
),
|
|
888
|
+
children: cryptoLabel(option === "transaction" ? "transactions" : option === "open-orders" ? "openOrders" : "rewards")
|
|
889
|
+
},
|
|
890
|
+
option
|
|
891
|
+
)) }),
|
|
892
|
+
/* @__PURE__ */ jsx(TabsContent, { value: kind, className: "sr-only", children: /* @__PURE__ */ jsx("p", { className: "sr-only", children: cryptoLabel("selectedTab") }) })
|
|
893
|
+
] });
|
|
894
|
+
}
|
|
895
|
+
function CryptoTableButton({ kind = "explorer", state = "default" }) {
|
|
896
|
+
const cryptoLabel = useCryptoLabels();
|
|
897
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
898
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
899
|
+
Button,
|
|
900
|
+
{
|
|
901
|
+
type: "button",
|
|
902
|
+
variant: "ghost",
|
|
903
|
+
size: "2xs",
|
|
904
|
+
"aria-label": cryptoLabel(kind === "explorer" ? "explorer" : "transactionDetails"),
|
|
905
|
+
className: cn(pill, "size-7 p-1", previewSurface(state)),
|
|
906
|
+
children: /* @__PURE__ */ jsx(CryptoGlyph, { name: kind === "explorer" ? "link" : "more", className: "size-5" })
|
|
907
|
+
}
|
|
908
|
+
) }),
|
|
909
|
+
/* @__PURE__ */ jsxs(PopoverContent, { className: "w-72 p-4", children: [
|
|
910
|
+
/* @__PURE__ */ jsx("h4", { className: "text-sm font-medium", children: cryptoLabel("transactionDetails") }),
|
|
911
|
+
/* @__PURE__ */ jsxs("dl", { className: "mt-3 grid gap-2 text-xs", children: [
|
|
912
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
913
|
+
/* @__PURE__ */ jsx("dt", { children: cryptoLabel("type") }),
|
|
914
|
+
/* @__PURE__ */ jsx("dd", { children: cryptoLabel("swap") })
|
|
915
|
+
] }),
|
|
916
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
917
|
+
/* @__PURE__ */ jsx("dt", { children: cryptoLabel("status") }),
|
|
918
|
+
/* @__PURE__ */ jsx("dd", { className: "text-status-success-text", children: cryptoLabel("success") })
|
|
919
|
+
] }),
|
|
920
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
921
|
+
/* @__PURE__ */ jsx("dt", { children: cryptoLabel("transactionId") }),
|
|
922
|
+
/* @__PURE__ */ jsx("dd", { className: "font-mono", children: "0x7a4b\u2026c8f2" })
|
|
923
|
+
] })
|
|
924
|
+
] }),
|
|
925
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-xs text-muted-foreground", children: cryptoLabel("localSimulation") })
|
|
926
|
+
] })
|
|
927
|
+
] });
|
|
928
|
+
}
|
|
929
|
+
function CryptoSocialButton({
|
|
930
|
+
provider = "phantom",
|
|
931
|
+
onlyIcon = false,
|
|
932
|
+
state = "default",
|
|
933
|
+
onConnect
|
|
934
|
+
}) {
|
|
935
|
+
const cryptoLabel = useCryptoLabels();
|
|
936
|
+
const [connected, setConnected] = React.useState(false);
|
|
937
|
+
const key = provider === "walletconnect" ? "walletconnect" : provider === "metamask" ? "metamask" : "phantom";
|
|
938
|
+
const name = key === "walletconnect" ? "WalletConnect" : key === "metamask" ? "MetaMask" : "Phantom";
|
|
939
|
+
return /* @__PURE__ */ jsxs(
|
|
940
|
+
Button,
|
|
941
|
+
{
|
|
942
|
+
type: "button",
|
|
943
|
+
variant: "ghost",
|
|
944
|
+
"aria-label": cryptoLabel(connected ? "connectedProvider" : "connectProvider", { provider: name }),
|
|
945
|
+
onClick: () => {
|
|
946
|
+
setConnected(true);
|
|
947
|
+
onConnect?.(name);
|
|
948
|
+
},
|
|
949
|
+
className: cn(
|
|
950
|
+
"max-w-full gap-3 rounded-full bg-muted text-sm text-foreground hover:bg-accent",
|
|
951
|
+
onlyIcon ? "w-30" : "w-94",
|
|
952
|
+
state === "hover" && "bg-accent"
|
|
953
|
+
),
|
|
954
|
+
children: [
|
|
955
|
+
/* @__PURE__ */ jsx("img", { src: cryptoArtwork[key], alt: "", className: "size-5" }),
|
|
956
|
+
!onlyIcon && /* @__PURE__ */ jsx("span", { children: connected ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
957
|
+
/* @__PURE__ */ jsx(Check, { className: "mr-1 inline size-4" }),
|
|
958
|
+
cryptoLabel("connectedProvider", { provider: name })
|
|
959
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
960
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
961
|
+
cryptoLabel("connect"),
|
|
962
|
+
" "
|
|
963
|
+
] }),
|
|
964
|
+
name
|
|
965
|
+
] }) })
|
|
966
|
+
]
|
|
967
|
+
}
|
|
968
|
+
);
|
|
969
|
+
}
|
|
970
|
+
function CryptoConnectWallet({ onConnect }) {
|
|
971
|
+
const cryptoLabel = useCryptoLabels();
|
|
972
|
+
const [connected, setConnected] = React.useState("");
|
|
973
|
+
const [help, setHelp] = React.useState(false);
|
|
974
|
+
return /* @__PURE__ */ jsxs(CryptoPanel, { className: "w-112 max-w-full rounded-4xl p-9 text-center", children: [
|
|
975
|
+
/* @__PURE__ */ jsx("img", { src: cryptoArtwork.brand, className: "mx-auto size-14 rounded-full border border-border p-3", alt: "" }),
|
|
976
|
+
/* @__PURE__ */ jsx("h3", { className: "mt-4 text-base font-medium", children: cryptoLabel(connected ? "walletConnected" : "connectWallet") }),
|
|
977
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: connected ? cryptoLabel("connectedProvider", { provider: connected }) : cryptoLabel("chooseWallet") }),
|
|
978
|
+
/* @__PURE__ */ jsx("div", { className: "mt-6 grid gap-2", children: ["phantom", "walletconnect", "metamask"].map((provider) => /* @__PURE__ */ jsx(
|
|
979
|
+
CryptoSocialButton,
|
|
980
|
+
{
|
|
981
|
+
provider,
|
|
982
|
+
onConnect: (name) => {
|
|
983
|
+
setConnected(name);
|
|
984
|
+
onConnect?.(name);
|
|
985
|
+
}
|
|
986
|
+
},
|
|
987
|
+
provider
|
|
988
|
+
)) }),
|
|
989
|
+
/* @__PURE__ */ jsxs(
|
|
990
|
+
Button,
|
|
991
|
+
{
|
|
992
|
+
type: "button",
|
|
993
|
+
variant: "link",
|
|
994
|
+
size: "2xs",
|
|
995
|
+
onClick: () => setHelp(!help),
|
|
996
|
+
className: "mt-5 h-6 text-status-success-text",
|
|
997
|
+
children: [
|
|
998
|
+
cryptoLabel("setUpWallet"),
|
|
999
|
+
/* @__PURE__ */ jsx(ArrowUpRight, { className: "size-4" })
|
|
1000
|
+
]
|
|
1001
|
+
}
|
|
1002
|
+
),
|
|
1003
|
+
help && /* @__PURE__ */ jsx("p", { role: "status", className: "mt-2 text-xs text-muted-foreground", children: cryptoLabel("walletHelp") })
|
|
1004
|
+
] });
|
|
1005
|
+
}
|
|
1006
|
+
function CryptoFavorites() {
|
|
1007
|
+
const cryptoLabel = useCryptoLabels();
|
|
1008
|
+
const [favorites, setFavorites] = React.useState(["btc", "eth", "xrp", "usdt"]);
|
|
1009
|
+
const [query, setQuery] = React.useState("");
|
|
1010
|
+
const [selected, setSelected] = React.useState("");
|
|
1011
|
+
return /* @__PURE__ */ jsxs(CryptoPanel, { className: "w-93 max-w-full", children: [
|
|
1012
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-12 items-center justify-between border-b border-border px-4 text-compact", children: [
|
|
1013
|
+
/* @__PURE__ */ jsx("span", { children: cryptoLabel("favoritesCount", { count: favorites.length }) }),
|
|
1014
|
+
/* @__PURE__ */ jsx(
|
|
1015
|
+
Button,
|
|
1016
|
+
{
|
|
1017
|
+
type: "button",
|
|
1018
|
+
variant: "ghost",
|
|
1019
|
+
size: "2xs",
|
|
1020
|
+
onClick: () => setFavorites([]),
|
|
1021
|
+
className: "px-0 text-compact text-muted-foreground",
|
|
1022
|
+
children: cryptoLabel("clear")
|
|
1023
|
+
}
|
|
1024
|
+
)
|
|
1025
|
+
] }),
|
|
1026
|
+
/* @__PURE__ */ jsx(
|
|
1027
|
+
SearchInput,
|
|
1028
|
+
{
|
|
1029
|
+
"aria-label": cryptoLabel("searchTokens"),
|
|
1030
|
+
placeholder: cryptoLabel("searchTokens"),
|
|
1031
|
+
value: query,
|
|
1032
|
+
onChange: setQuery,
|
|
1033
|
+
className: "h-11 rounded-none border-0 border-b px-4 shadow-none",
|
|
1034
|
+
inputClassName: "text-compact"
|
|
1035
|
+
}
|
|
1036
|
+
),
|
|
1037
|
+
/* @__PURE__ */ jsx("div", { className: "h-99 overflow-auto", children: /* @__PURE__ */ jsx(
|
|
1038
|
+
CryptoTokenList,
|
|
1039
|
+
{
|
|
1040
|
+
query,
|
|
1041
|
+
favorites,
|
|
1042
|
+
onFavorite: (token) => setFavorites(favorites.includes(token) ? favorites.filter((item) => item !== token) : [...favorites, token]),
|
|
1043
|
+
onSelect: (token) => setSelected(cryptoLabel("selectedToken", { token: tokenBySymbol(token).name }))
|
|
1044
|
+
}
|
|
1045
|
+
) }),
|
|
1046
|
+
/* @__PURE__ */ jsx(CryptoNotice, { message: selected })
|
|
1047
|
+
] });
|
|
1048
|
+
}
|
|
1049
|
+
function CryptoMenu({ profile = false }) {
|
|
1050
|
+
const cryptoLabel = useCryptoLabels();
|
|
1051
|
+
const [dark, setDark] = React.useState(false);
|
|
1052
|
+
const [message, setMessage] = React.useState("");
|
|
1053
|
+
const items = [
|
|
1054
|
+
{ key: profile ? "accountSettings" : "settings", Icon: Settings },
|
|
1055
|
+
{ key: "preferences", Icon: SlidersHorizontal },
|
|
1056
|
+
{ key: "helpCenter", Icon: MessageSquare },
|
|
1057
|
+
{ key: "community", Icon: Share2 }
|
|
1058
|
+
];
|
|
1059
|
+
const divider = /* @__PURE__ */ jsx("div", { className: "flex h-1 items-center", children: /* @__PURE__ */ jsx("div", { className: "h-px w-full bg-border" }) });
|
|
1060
|
+
return /* @__PURE__ */ jsx("div", { className: dark ? "dark" : void 0, "data-slot": "crypto-menu-theme", children: /* @__PURE__ */ jsxs(CryptoPanel, { className: "w-74 max-w-full gap-1 p-1.5", children: [
|
|
1061
|
+
profile && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1062
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-14 items-center gap-3 p-2", children: [
|
|
1063
|
+
/* @__PURE__ */ jsx(Avatar, { label: "Wei Chen", src: cryptoArtwork.wei, size: 40 }),
|
|
1064
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1065
|
+
/* @__PURE__ */ jsx("strong", { className: "block text-sm font-medium", children: "Wei Chen" }),
|
|
1066
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: "wei@example.com" })
|
|
1067
|
+
] })
|
|
1068
|
+
] }),
|
|
1069
|
+
divider
|
|
1070
|
+
] }),
|
|
1071
|
+
/* @__PURE__ */ jsxs("label", { className: "flex h-9 cursor-pointer items-center gap-2 px-2.5 text-sm", children: [
|
|
1072
|
+
/* @__PURE__ */ jsx(Moon, { className: "size-5 text-muted-foreground" }),
|
|
1073
|
+
cryptoLabel("darkMode"),
|
|
1074
|
+
/* @__PURE__ */ jsx(Switch, { checked: dark, onCheckedChange: setDark, className: "ml-auto" })
|
|
1075
|
+
] }),
|
|
1076
|
+
divider,
|
|
1077
|
+
items.map(({ key, Icon }, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
1078
|
+
index === 3 && !profile && divider,
|
|
1079
|
+
/* @__PURE__ */ jsxs(
|
|
1080
|
+
Button,
|
|
1081
|
+
{
|
|
1082
|
+
type: "button",
|
|
1083
|
+
variant: "ghost",
|
|
1084
|
+
size: "sm",
|
|
1085
|
+
className: "h-9 w-full justify-start rounded-xl px-2.5 text-sm font-normal",
|
|
1086
|
+
onClick: () => setMessage(cryptoLabel("openedPanel", { panel: cryptoLabel(key) })),
|
|
1087
|
+
children: [
|
|
1088
|
+
/* @__PURE__ */ jsx(Icon, { className: "size-5 text-muted-foreground" }),
|
|
1089
|
+
cryptoLabel(key),
|
|
1090
|
+
key === "preferences" && /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto size-5" })
|
|
1091
|
+
]
|
|
1092
|
+
}
|
|
1093
|
+
)
|
|
1094
|
+
] }, key)),
|
|
1095
|
+
profile && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1096
|
+
divider,
|
|
1097
|
+
/* @__PURE__ */ jsxs(
|
|
1098
|
+
Button,
|
|
1099
|
+
{
|
|
1100
|
+
type: "button",
|
|
1101
|
+
variant: "ghost",
|
|
1102
|
+
size: "sm",
|
|
1103
|
+
className: "h-9 justify-start px-2.5 text-sm font-normal",
|
|
1104
|
+
onClick: () => setMessage(cryptoLabel("signedOut")),
|
|
1105
|
+
children: [
|
|
1106
|
+
/* @__PURE__ */ jsx(LogOut, { className: "size-5 text-status-error-icon" }),
|
|
1107
|
+
cryptoLabel("signOut")
|
|
1108
|
+
]
|
|
1109
|
+
}
|
|
1110
|
+
)
|
|
1111
|
+
] }),
|
|
1112
|
+
/* @__PURE__ */ jsx("p", { className: "flex h-8 items-center px-2.5 text-xs text-muted-foreground", children: cryptoLabel("demoTerms") }),
|
|
1113
|
+
/* @__PURE__ */ jsx(CryptoNotice, { message })
|
|
1114
|
+
] }) });
|
|
1115
|
+
}
|
|
1116
|
+
function CryptoWallet() {
|
|
1117
|
+
const cryptoLabel = useCryptoLabels();
|
|
1118
|
+
const [copied, setCopied] = React.useState(false);
|
|
1119
|
+
const [connected, setConnected] = React.useState(true);
|
|
1120
|
+
const [verified, setVerified] = React.useState(false);
|
|
1121
|
+
const [all, setAll] = React.useState(false);
|
|
1122
|
+
const [action, setAction] = React.useState("");
|
|
1123
|
+
const copy = async () => {
|
|
1124
|
+
try {
|
|
1125
|
+
await navigator.clipboard.writeText("0x1cf2000000000000000000000000000000009a56");
|
|
1126
|
+
setCopied(true);
|
|
1127
|
+
} catch {
|
|
1128
|
+
setAction(cryptoLabel("copyUnavailable"));
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1131
|
+
return /* @__PURE__ */ jsxs(CryptoPanel, { className: "w-91 max-w-full", children: [
|
|
1132
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-18 items-center gap-3 border-b border-border px-4", children: [
|
|
1133
|
+
/* @__PURE__ */ jsx("span", { className: "flex size-10 items-center justify-center rounded-full bg-muted", children: /* @__PURE__ */ jsx(CryptoGlyph, { name: "crown", className: "size-5 text-status-success-icon" }) }),
|
|
1134
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
1135
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: "0x1cf2\u20269a56" }),
|
|
1136
|
+
/* @__PURE__ */ jsx("p", { className: cn("text-compact", connected ? "text-status-success-text" : "text-muted-foreground"), children: cryptoLabel(connected ? "connected" : "disconnected") })
|
|
1137
|
+
] }),
|
|
1138
|
+
/* @__PURE__ */ jsxs(
|
|
1139
|
+
Button,
|
|
1140
|
+
{
|
|
1141
|
+
type: "button",
|
|
1142
|
+
variant: "ghost",
|
|
1143
|
+
size: "2xs",
|
|
1144
|
+
onClick: copy,
|
|
1145
|
+
className: "ml-auto h-6 rounded-full bg-muted text-xs",
|
|
1146
|
+
children: [
|
|
1147
|
+
/* @__PURE__ */ jsx(Copy, { className: "size-3" }),
|
|
1148
|
+
cryptoLabel(copied ? "copied" : "copy")
|
|
1149
|
+
]
|
|
1150
|
+
}
|
|
1151
|
+
)
|
|
1152
|
+
] }),
|
|
1153
|
+
/* @__PURE__ */ jsxs("div", { className: "grid min-h-33 gap-4 border-b border-border p-4", children: [
|
|
1154
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
|
|
1155
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1156
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: cryptoLabel("totalBalance") }),
|
|
1157
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-2xl font-medium tracking-tight", children: "$460,890.02" })
|
|
1158
|
+
] }),
|
|
1159
|
+
/* @__PURE__ */ jsx(CryptoTokenPicker, { value: "eth", appearance: "stroke" })
|
|
1160
|
+
] }),
|
|
1161
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-2", children: ["swap", "buy", "send"].map((mode) => /* @__PURE__ */ jsxs(
|
|
1162
|
+
Button,
|
|
1163
|
+
{
|
|
1164
|
+
type: "button",
|
|
1165
|
+
variant: "ghost",
|
|
1166
|
+
size: "2xs",
|
|
1167
|
+
disabled: !connected,
|
|
1168
|
+
className: "rounded-full bg-muted px-3 text-sm",
|
|
1169
|
+
onClick: () => setAction(mode),
|
|
1170
|
+
children: [
|
|
1171
|
+
/* @__PURE__ */ jsx(ArrowDownUp, { className: "size-4 text-status-success-icon" }),
|
|
1172
|
+
cryptoLabel(mode)
|
|
1173
|
+
]
|
|
1174
|
+
},
|
|
1175
|
+
mode
|
|
1176
|
+
)) })
|
|
1177
|
+
] }),
|
|
1178
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 p-2", children: [
|
|
1179
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-7.5 items-center justify-between px-2 text-xs uppercase text-muted-foreground", children: [
|
|
1180
|
+
/* @__PURE__ */ jsx("span", { children: cryptoLabel("topAssets") }),
|
|
1181
|
+
/* @__PURE__ */ jsx(
|
|
1182
|
+
Button,
|
|
1183
|
+
{
|
|
1184
|
+
type: "button",
|
|
1185
|
+
variant: "ghost",
|
|
1186
|
+
size: "2xs",
|
|
1187
|
+
className: "px-0 font-mono text-xs text-status-success-text",
|
|
1188
|
+
onClick: () => setAll(!all),
|
|
1189
|
+
children: cryptoLabel(all ? "showLess" : "viewAll")
|
|
1190
|
+
}
|
|
1191
|
+
)
|
|
1192
|
+
] }),
|
|
1193
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-1 items-center", children: /* @__PURE__ */ jsx("div", { className: "h-px w-full bg-border" }) }),
|
|
1194
|
+
tokenFixtures.slice(0, all ? 10 : 4).map((token) => /* @__PURE__ */ jsxs("div", { className: "flex h-9 items-center gap-2 rounded-xl px-2 hover:bg-muted", children: [
|
|
1195
|
+
/* @__PURE__ */ jsx(TokenIcon, { symbol: token.symbol }),
|
|
1196
|
+
/* @__PURE__ */ jsxs("span", { className: "text-compact", children: [
|
|
1197
|
+
token.name,
|
|
1198
|
+
" ",
|
|
1199
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-muted-foreground", children: token.symbol.toUpperCase() })
|
|
1200
|
+
] }),
|
|
1201
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto font-mono text-xs", children: formatAmount(token.balance, 6) })
|
|
1202
|
+
] }, token.symbol))
|
|
1203
|
+
] }),
|
|
1204
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-18 items-center gap-3 border-y border-border px-4", children: [
|
|
1205
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1206
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: cryptoLabel("verify2FA") }),
|
|
1207
|
+
/* @__PURE__ */ jsx("p", { className: "text-compact text-muted-foreground", children: cryptoLabel("securityHint") })
|
|
1208
|
+
] }),
|
|
1209
|
+
/* @__PURE__ */ jsx(
|
|
1210
|
+
Button,
|
|
1211
|
+
{
|
|
1212
|
+
type: "button",
|
|
1213
|
+
variant: "ghost",
|
|
1214
|
+
size: "2xs",
|
|
1215
|
+
className: "ml-auto rounded-full bg-status-success-bg px-4 text-status-success-text",
|
|
1216
|
+
onClick: () => setVerified(!verified),
|
|
1217
|
+
children: cryptoLabel(verified ? "verified" : "verify")
|
|
1218
|
+
}
|
|
1219
|
+
)
|
|
1220
|
+
] }),
|
|
1221
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-2 p-2", children: [
|
|
1222
|
+
/* @__PURE__ */ jsxs(
|
|
1223
|
+
Button,
|
|
1224
|
+
{
|
|
1225
|
+
type: "button",
|
|
1226
|
+
variant: "ghost",
|
|
1227
|
+
size: "sm",
|
|
1228
|
+
className: "h-9 justify-start text-sm font-normal",
|
|
1229
|
+
onClick: () => setAction("settings"),
|
|
1230
|
+
children: [
|
|
1231
|
+
/* @__PURE__ */ jsx(Settings, { className: "size-4.5 text-muted-foreground" }),
|
|
1232
|
+
cryptoLabel("walletSettings")
|
|
1233
|
+
]
|
|
1234
|
+
}
|
|
1235
|
+
),
|
|
1236
|
+
/* @__PURE__ */ jsxs(
|
|
1237
|
+
Button,
|
|
1238
|
+
{
|
|
1239
|
+
type: "button",
|
|
1240
|
+
variant: "ghost",
|
|
1241
|
+
size: "sm",
|
|
1242
|
+
className: "h-9 justify-start text-sm font-normal",
|
|
1243
|
+
onClick: () => setConnected(!connected),
|
|
1244
|
+
children: [
|
|
1245
|
+
/* @__PURE__ */ jsx(LogOut, { className: "size-4.5 text-status-error-icon" }),
|
|
1246
|
+
cryptoLabel(connected ? "disconnectWallet" : "connectWallet")
|
|
1247
|
+
]
|
|
1248
|
+
}
|
|
1249
|
+
)
|
|
1250
|
+
] }),
|
|
1251
|
+
/* @__PURE__ */ jsx("p", { className: "px-4 pb-4 text-xs text-muted-foreground", children: cryptoLabel("demoTerms") }),
|
|
1252
|
+
action && /* @__PURE__ */ jsx(
|
|
1253
|
+
CryptoNotice,
|
|
1254
|
+
{
|
|
1255
|
+
message: ["swap", "buy", "send", "settings"].includes(action) ? cryptoLabel("openedPanel", { panel: cryptoLabel(action) }) : action
|
|
1256
|
+
}
|
|
1257
|
+
)
|
|
1258
|
+
] });
|
|
1259
|
+
}
|
|
1260
|
+
function CryptoNotifications() {
|
|
1261
|
+
const cryptoLabel = useCryptoLabels();
|
|
1262
|
+
const [read, setRead] = React.useState([]);
|
|
1263
|
+
const [viewAll, setViewAll] = React.useState(false);
|
|
1264
|
+
const rows = [
|
|
1265
|
+
{
|
|
1266
|
+
id: "security",
|
|
1267
|
+
title: "notificationSecurity",
|
|
1268
|
+
body: "notificationDevice",
|
|
1269
|
+
time: "fiveMinutes",
|
|
1270
|
+
Icon: Info,
|
|
1271
|
+
tone: "text-status-error-icon"
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
id: "swap",
|
|
1275
|
+
title: "notificationSwap",
|
|
1276
|
+
body: "notificationSwapBody",
|
|
1277
|
+
time: "now",
|
|
1278
|
+
Icon: ArrowDownUp,
|
|
1279
|
+
tone: "text-status-success-icon"
|
|
1280
|
+
},
|
|
1281
|
+
{
|
|
1282
|
+
id: "reward",
|
|
1283
|
+
title: "notificationRewards",
|
|
1284
|
+
body: "notificationRewardsBody",
|
|
1285
|
+
time: "oneHour",
|
|
1286
|
+
Icon: Gift,
|
|
1287
|
+
tone: "text-status-success-icon"
|
|
1288
|
+
},
|
|
1289
|
+
{
|
|
1290
|
+
id: "login",
|
|
1291
|
+
title: "notificationLogin",
|
|
1292
|
+
body: "notificationDevice",
|
|
1293
|
+
time: "tenMinutes",
|
|
1294
|
+
Icon: ShieldCheck,
|
|
1295
|
+
tone: "text-status-warning-icon"
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
id: "maintenance",
|
|
1299
|
+
title: "notificationMaintenance",
|
|
1300
|
+
body: "notificationMaintenanceBody",
|
|
1301
|
+
time: "yesterday",
|
|
1302
|
+
Icon: Settings,
|
|
1303
|
+
tone: "text-badge-purple-solid"
|
|
1304
|
+
}
|
|
1305
|
+
];
|
|
1306
|
+
return /* @__PURE__ */ jsxs(CryptoPanel, { className: "w-100 max-w-full", children: [
|
|
1307
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-12 items-center justify-between border-b border-border px-4 text-compact", children: [
|
|
1308
|
+
/* @__PURE__ */ jsx("span", { children: cryptoLabel("notifications") }),
|
|
1309
|
+
/* @__PURE__ */ jsx(
|
|
1310
|
+
Button,
|
|
1311
|
+
{
|
|
1312
|
+
type: "button",
|
|
1313
|
+
variant: "ghost",
|
|
1314
|
+
size: "2xs",
|
|
1315
|
+
className: "px-0 text-xs text-status-success-text",
|
|
1316
|
+
onClick: () => setRead(rows.map((row) => row.id)),
|
|
1317
|
+
children: cryptoLabel("markAllRead")
|
|
1318
|
+
}
|
|
1319
|
+
)
|
|
1320
|
+
] }),
|
|
1321
|
+
rows.map(({ id, title, body, time, Icon, tone }) => /* @__PURE__ */ jsxs(
|
|
1322
|
+
Button,
|
|
1323
|
+
{
|
|
1324
|
+
type: "button",
|
|
1325
|
+
variant: "ghost",
|
|
1326
|
+
className: cn(
|
|
1327
|
+
"w-full items-start gap-3 rounded-none border-b border-border px-4 py-4 text-left font-normal",
|
|
1328
|
+
!read.includes(id) && ["swap", "login"].includes(id) && "bg-muted",
|
|
1329
|
+
["security", "reward"].includes(id) ? "h-18" : "h-19"
|
|
1330
|
+
),
|
|
1331
|
+
onClick: () => setRead([...read, id]),
|
|
1332
|
+
children: [
|
|
1333
|
+
/* @__PURE__ */ jsx(Icon, { className: cn("mt-0.5 size-4.5 shrink-0", tone) }),
|
|
1334
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
1335
|
+
/* @__PURE__ */ jsx("strong", { className: "block whitespace-normal text-compact font-medium", children: cryptoLabel(title) }),
|
|
1336
|
+
/* @__PURE__ */ jsx(
|
|
1337
|
+
"span",
|
|
1338
|
+
{
|
|
1339
|
+
className: cn(
|
|
1340
|
+
"block whitespace-normal text-compact text-muted-foreground",
|
|
1341
|
+
!["security", "reward"].includes(id) && "mt-1"
|
|
1342
|
+
),
|
|
1343
|
+
children: cryptoLabel(body)
|
|
1344
|
+
}
|
|
1345
|
+
)
|
|
1346
|
+
] }),
|
|
1347
|
+
/* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-2 text-xs text-muted-foreground", children: [
|
|
1348
|
+
cryptoLabel(time),
|
|
1349
|
+
!read.includes(id) && ["swap", "login"].includes(id) && /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-status-success-icon" })
|
|
1350
|
+
] })
|
|
1351
|
+
]
|
|
1352
|
+
},
|
|
1353
|
+
id
|
|
1354
|
+
)),
|
|
1355
|
+
/* @__PURE__ */ jsx(
|
|
1356
|
+
Button,
|
|
1357
|
+
{
|
|
1358
|
+
type: "button",
|
|
1359
|
+
variant: "ghost",
|
|
1360
|
+
className: "h-12 rounded-none text-compact",
|
|
1361
|
+
onClick: () => setViewAll(!viewAll),
|
|
1362
|
+
children: cryptoLabel("viewAllNotifications")
|
|
1363
|
+
}
|
|
1364
|
+
),
|
|
1365
|
+
viewAll && /* @__PURE__ */ jsx(CryptoNotice, { message: cryptoLabel("allNotificationsShown", { count: rows.length }) })
|
|
1366
|
+
] });
|
|
1367
|
+
}
|
|
1368
|
+
function CryptoWalletTrigger({ state = "default" }) {
|
|
1369
|
+
const cryptoLabel = useCryptoLabels();
|
|
1370
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
1371
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1372
|
+
Button,
|
|
1373
|
+
{
|
|
1374
|
+
type: "button",
|
|
1375
|
+
variant: "ghost",
|
|
1376
|
+
size: "2xs",
|
|
1377
|
+
className: cn(pill, "h-7 gap-1.5 pl-2.5 pr-1.75 text-sm", previewSurface(state)),
|
|
1378
|
+
"aria-label": cryptoLabel("wallet"),
|
|
1379
|
+
children: [
|
|
1380
|
+
/* @__PURE__ */ jsx(CryptoGlyph, { name: "crown", className: "size-4 text-status-success-icon" }),
|
|
1381
|
+
"0x1cf2\u20269a56",
|
|
1382
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "size-5" })
|
|
1383
|
+
]
|
|
1384
|
+
}
|
|
1385
|
+
) }),
|
|
1386
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-fit min-w-0 border-0 bg-transparent shadow-none", children: /* @__PURE__ */ jsx(CryptoWallet, {}) })
|
|
1387
|
+
] });
|
|
1388
|
+
}
|
|
1389
|
+
function CryptoAction({
|
|
1390
|
+
kind = "favorite",
|
|
1391
|
+
state = "default",
|
|
1392
|
+
profile = false
|
|
1393
|
+
}) {
|
|
1394
|
+
const cryptoLabel = useCryptoLabels();
|
|
1395
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
1396
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1397
|
+
Button,
|
|
1398
|
+
{
|
|
1399
|
+
type: "button",
|
|
1400
|
+
variant: "ghost",
|
|
1401
|
+
size: "2xs",
|
|
1402
|
+
className: cn(pill, "relative size-7 p-1.25", previewSurface(state)),
|
|
1403
|
+
"aria-label": cryptoLabel(
|
|
1404
|
+
profile ? "profile" : kind === "favorite" ? "favorites" : kind === "notification" ? "notifications" : "menu"
|
|
1405
|
+
),
|
|
1406
|
+
children: profile ? /* @__PURE__ */ jsx(Avatar, { label: "Wei Chen", src: cryptoArtwork.wei, size: 24 }) : kind === "notification" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1407
|
+
/* @__PURE__ */ jsx(Bell, { className: "size-4.5" }),
|
|
1408
|
+
/* @__PURE__ */ jsx("span", { className: "absolute top-1 right-1 size-1 rounded-full bg-status-warning-icon" })
|
|
1409
|
+
] }) : /* @__PURE__ */ jsx(CryptoGlyph, { name: kind === "favorite" ? "star" : "menu" })
|
|
1410
|
+
}
|
|
1411
|
+
) }),
|
|
1412
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-fit min-w-0 border-0 bg-transparent shadow-none", align: "end", children: profile ? /* @__PURE__ */ jsx(CryptoMenu, { profile: true }) : kind === "favorite" ? /* @__PURE__ */ jsx(CryptoFavorites, {}) : kind === "notification" ? /* @__PURE__ */ jsx(CryptoNotifications, {}) : /* @__PURE__ */ jsx(CryptoMenu, {}) })
|
|
1413
|
+
] });
|
|
1414
|
+
}
|
|
1415
|
+
function CryptoNavigation({ profile = false, mobile = false }) {
|
|
1416
|
+
const cryptoLabel = useCryptoLabels();
|
|
1417
|
+
const [selected, setSelected] = React.useState("overview");
|
|
1418
|
+
return /* @__PURE__ */ jsxs(
|
|
1419
|
+
"div",
|
|
1420
|
+
{
|
|
1421
|
+
className: cn(
|
|
1422
|
+
"flex h-16 items-center gap-3 border-y border-border bg-background",
|
|
1423
|
+
mobile ? "w-97.5 max-w-full px-4" : "w-full min-w-0 flex-wrap px-4 lg:flex-nowrap lg:px-11"
|
|
1424
|
+
),
|
|
1425
|
+
"data-slot": "crypto-navigation",
|
|
1426
|
+
children: [
|
|
1427
|
+
mobile && /* @__PURE__ */ jsx(CryptoAction, { kind: "hamburger" }),
|
|
1428
|
+
/* @__PURE__ */ jsx("img", { src: cryptoArtwork.brand, className: "size-7 shrink-0", alt: cryptoLabel("cryptoBrand") }),
|
|
1429
|
+
!mobile && /* @__PURE__ */ jsx("div", { className: "hidden items-center gap-1 md:flex", children: ["overview", "markets", "trade", "rewards"].map((item) => /* @__PURE__ */ jsx(
|
|
1430
|
+
CryptoNavigationItem,
|
|
1431
|
+
{
|
|
1432
|
+
state: selected === item ? "active" : "default",
|
|
1433
|
+
pressed: selected === item,
|
|
1434
|
+
label: cryptoLabel(item),
|
|
1435
|
+
onClick: () => setSelected(item)
|
|
1436
|
+
},
|
|
1437
|
+
item
|
|
1438
|
+
)) }),
|
|
1439
|
+
!mobile && /* @__PURE__ */ jsx("div", { className: "mx-auto hidden min-w-0 lg:block", children: /* @__PURE__ */ jsx(CryptoNavigationSearch, {}) }),
|
|
1440
|
+
/* @__PURE__ */ jsxs("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
1441
|
+
!mobile && /* @__PURE__ */ jsx("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx(CryptoWalletTrigger, {}) }),
|
|
1442
|
+
/* @__PURE__ */ jsx(CryptoAction, { kind: "favorite" }),
|
|
1443
|
+
/* @__PURE__ */ jsx(CryptoAction, { kind: "notification" }),
|
|
1444
|
+
mobile ? /* @__PURE__ */ jsxs(Popover, { children: [
|
|
1445
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1446
|
+
Button,
|
|
1447
|
+
{
|
|
1448
|
+
type: "button",
|
|
1449
|
+
variant: "ghost",
|
|
1450
|
+
size: "2xs",
|
|
1451
|
+
"aria-label": cryptoLabel("searchTokens"),
|
|
1452
|
+
className: "size-7 rounded-full p-1",
|
|
1453
|
+
children: /* @__PURE__ */ jsx(Search, { className: "size-4.5" })
|
|
1454
|
+
}
|
|
1455
|
+
) }),
|
|
1456
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-fit min-w-0 border-0 bg-transparent shadow-none", align: "end", children: /* @__PURE__ */ jsx(CryptoSearch, {}) })
|
|
1457
|
+
] }) : /* @__PURE__ */ jsx(CryptoAction, { kind: "hamburger", profile }),
|
|
1458
|
+
mobile && /* @__PURE__ */ jsxs(Popover, { children: [
|
|
1459
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1460
|
+
Button,
|
|
1461
|
+
{
|
|
1462
|
+
type: "button",
|
|
1463
|
+
variant: "ghost",
|
|
1464
|
+
size: "sm",
|
|
1465
|
+
"aria-label": cryptoLabel("wallet"),
|
|
1466
|
+
className: "size-8 rounded-full bg-status-success-bg p-2",
|
|
1467
|
+
children: /* @__PURE__ */ jsx(CryptoGlyph, { name: "crown", className: "size-4 text-status-success-icon" })
|
|
1468
|
+
}
|
|
1469
|
+
) }),
|
|
1470
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-fit min-w-0 border-0 bg-transparent shadow-none", align: "end", children: /* @__PURE__ */ jsx(CryptoWallet, {}) })
|
|
1471
|
+
] })
|
|
1472
|
+
] })
|
|
1473
|
+
]
|
|
1474
|
+
}
|
|
1475
|
+
);
|
|
1476
|
+
}
|
|
1477
|
+
function CryptoBanner() {
|
|
1478
|
+
const cryptoLabel = useCryptoLabels();
|
|
1479
|
+
const [visible, setVisible] = React.useState(true);
|
|
1480
|
+
const [claimed, setClaimed] = React.useState(false);
|
|
1481
|
+
return visible ? /* @__PURE__ */ jsxs("div", { className: "flex min-h-9 w-full items-center justify-center gap-2 border-b border-border px-3 py-1 text-xs", children: [
|
|
1482
|
+
/* @__PURE__ */ jsx(Gift, { className: "size-3.5 shrink-0 text-status-success-icon" }),
|
|
1483
|
+
/* @__PURE__ */ jsx("span", { children: cryptoLabel(claimed ? "bonusClaimed" : "bonusOffer") }),
|
|
1484
|
+
/* @__PURE__ */ jsxs(
|
|
1485
|
+
Button,
|
|
1486
|
+
{
|
|
1487
|
+
type: "button",
|
|
1488
|
+
variant: "ghost",
|
|
1489
|
+
size: "2xs",
|
|
1490
|
+
disabled: claimed,
|
|
1491
|
+
className: "h-6 px-1 text-xs text-status-success-text",
|
|
1492
|
+
onClick: () => setClaimed(true),
|
|
1493
|
+
children: [
|
|
1494
|
+
cryptoLabel("claimNow"),
|
|
1495
|
+
/* @__PURE__ */ jsx(ArrowUpRight, { className: "size-3" })
|
|
1496
|
+
]
|
|
1497
|
+
}
|
|
1498
|
+
),
|
|
1499
|
+
/* @__PURE__ */ jsx(
|
|
1500
|
+
Button,
|
|
1501
|
+
{
|
|
1502
|
+
type: "button",
|
|
1503
|
+
variant: "ghost",
|
|
1504
|
+
size: "2xs",
|
|
1505
|
+
className: "ml-auto size-6 p-1 text-muted-foreground",
|
|
1506
|
+
"aria-label": cryptoLabel("dismissBanner"),
|
|
1507
|
+
onClick: () => setVisible(false),
|
|
1508
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-3" })
|
|
1509
|
+
}
|
|
1510
|
+
)
|
|
1511
|
+
] }) : /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "2xs", onClick: () => setVisible(true), children: cryptoLabel("showBanner") });
|
|
1512
|
+
}
|
|
1513
|
+
function CryptoMobileBottom() {
|
|
1514
|
+
const cryptoLabel = useCryptoLabels();
|
|
1515
|
+
const [selected, setSelected] = React.useState("home");
|
|
1516
|
+
const [open, setOpen] = React.useState(false);
|
|
1517
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-97.5 max-w-full bg-background pt-9", children: [
|
|
1518
|
+
/* @__PURE__ */ jsx(Button, { type: "button", className: cn(greenButton, "mb-4 w-full"), onClick: () => setOpen(true), children: cryptoLabel("swapSendBuy") }),
|
|
1519
|
+
/* @__PURE__ */ jsx("div", { className: "grid h-16 grid-cols-4 border-t border-border", children: [
|
|
1520
|
+
{ key: "home", Icon: House },
|
|
1521
|
+
{ key: "markets", Icon: SlidersHorizontal },
|
|
1522
|
+
{ key: "trade", Icon: ArrowDownUp },
|
|
1523
|
+
{ key: "rewards", Icon: Gift }
|
|
1524
|
+
].map(({ key, Icon }) => /* @__PURE__ */ jsxs(
|
|
1525
|
+
Button,
|
|
1526
|
+
{
|
|
1527
|
+
type: "button",
|
|
1528
|
+
variant: "ghost",
|
|
1529
|
+
onClick: () => setSelected(key),
|
|
1530
|
+
"aria-pressed": selected === key,
|
|
1531
|
+
className: cn(
|
|
1532
|
+
"h-16 flex-col gap-1 rounded-none border-t px-1 font-mono text-xs uppercase",
|
|
1533
|
+
selected === key ? "border-status-success-icon text-status-success-text" : "border-transparent text-muted-foreground"
|
|
1534
|
+
),
|
|
1535
|
+
children: [
|
|
1536
|
+
/* @__PURE__ */ jsx(Icon, { className: "size-4" }),
|
|
1537
|
+
cryptoLabel(key)
|
|
1538
|
+
]
|
|
1539
|
+
},
|
|
1540
|
+
key
|
|
1541
|
+
)) }),
|
|
1542
|
+
/* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "w-94 border-0 p-0 [&>button]:hidden", children: [
|
|
1543
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "sr-only", children: cryptoLabel("swapSendBuy") }),
|
|
1544
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "sr-only", children: cryptoLabel("localSimulation") }),
|
|
1545
|
+
/* @__PURE__ */ jsx(CryptoSwap, {})
|
|
1546
|
+
] }) })
|
|
1547
|
+
] });
|
|
1548
|
+
}
|
|
1549
|
+
function CryptocurrencyDemo({
|
|
1550
|
+
part,
|
|
1551
|
+
state = "default",
|
|
1552
|
+
kind,
|
|
1553
|
+
size = 28,
|
|
1554
|
+
onlyIcon = false,
|
|
1555
|
+
profile = false,
|
|
1556
|
+
step = 1
|
|
1557
|
+
}) {
|
|
1558
|
+
const cryptoLabel = useCryptoLabels();
|
|
1559
|
+
let content;
|
|
1560
|
+
switch (part) {
|
|
1561
|
+
case "status-icon": {
|
|
1562
|
+
const key = kind === "pending" ? "statusPending" : kind === "warning" ? "statusWarning" : kind === "cancelled" ? "statusCancelled" : "statusSuccess";
|
|
1563
|
+
content = /* @__PURE__ */ jsx("img", { src: cryptoArtwork[key], alt: cryptoLabel(kind ?? "success"), className: "size-3" });
|
|
1564
|
+
break;
|
|
1565
|
+
}
|
|
1566
|
+
case "token-icon":
|
|
1567
|
+
content = /* @__PURE__ */ jsx(
|
|
1568
|
+
"img",
|
|
1569
|
+
{
|
|
1570
|
+
src: cryptoArtwork[tokenBySymbol(kind ?? "btc").symbol],
|
|
1571
|
+
alt: tokenBySymbol(kind ?? "btc").name,
|
|
1572
|
+
className: "size-6 rounded-full"
|
|
1573
|
+
}
|
|
1574
|
+
);
|
|
1575
|
+
break;
|
|
1576
|
+
case "navigation-item":
|
|
1577
|
+
content = /* @__PURE__ */ jsx(CryptoNavigationItem, { state, size });
|
|
1578
|
+
break;
|
|
1579
|
+
case "navigation-search":
|
|
1580
|
+
content = /* @__PURE__ */ jsx(CryptoNavigationSearch, { state });
|
|
1581
|
+
break;
|
|
1582
|
+
case "navigation-wallet":
|
|
1583
|
+
content = /* @__PURE__ */ jsx(CryptoWalletTrigger, { state });
|
|
1584
|
+
break;
|
|
1585
|
+
case "navigation-action":
|
|
1586
|
+
content = /* @__PURE__ */ jsx(CryptoAction, { kind, state });
|
|
1587
|
+
break;
|
|
1588
|
+
case "chart-item":
|
|
1589
|
+
content = /* @__PURE__ */ jsx(CryptoSegments, { itemOnly: true, state });
|
|
1590
|
+
break;
|
|
1591
|
+
case "swap-select":
|
|
1592
|
+
content = /* @__PURE__ */ jsx(CryptoTokenPicker, { appearance: kind, state });
|
|
1593
|
+
break;
|
|
1594
|
+
case "chart-switch":
|
|
1595
|
+
content = /* @__PURE__ */ jsx(CryptoSegments, { initialValue: kind });
|
|
1596
|
+
break;
|
|
1597
|
+
case "table-button":
|
|
1598
|
+
content = /* @__PURE__ */ jsx(CryptoTableButton, { kind, state });
|
|
1599
|
+
break;
|
|
1600
|
+
case "table-switch-item":
|
|
1601
|
+
content = /* @__PURE__ */ jsx(CryptoSegments, { type: "table", itemOnly: true, size: 24, state });
|
|
1602
|
+
break;
|
|
1603
|
+
case "table-tab":
|
|
1604
|
+
content = /* @__PURE__ */ jsx(CryptoTableTabs, { kind, state });
|
|
1605
|
+
break;
|
|
1606
|
+
case "table-filter":
|
|
1607
|
+
content = /* @__PURE__ */ jsx(CryptoFilter, { kind, state });
|
|
1608
|
+
break;
|
|
1609
|
+
case "table-switch":
|
|
1610
|
+
content = /* @__PURE__ */ jsx(CryptoSegments, { type: "table", initialValue: kind, size });
|
|
1611
|
+
break;
|
|
1612
|
+
case "swap-input":
|
|
1613
|
+
content = /* @__PURE__ */ jsx(CryptoSwapInput, { type: kind, state, available: state === "error" ? 0 : 95e-4 });
|
|
1614
|
+
break;
|
|
1615
|
+
case "swap":
|
|
1616
|
+
content = /* @__PURE__ */ jsx(CryptoSwap, { step });
|
|
1617
|
+
break;
|
|
1618
|
+
case "search-modal":
|
|
1619
|
+
content = /* @__PURE__ */ jsx(CryptoSearch, { state });
|
|
1620
|
+
break;
|
|
1621
|
+
case "search-input":
|
|
1622
|
+
content = /* @__PURE__ */ jsx(CryptoSearch, { state, inputOnly: true });
|
|
1623
|
+
break;
|
|
1624
|
+
case "navigation":
|
|
1625
|
+
content = /* @__PURE__ */ jsx(CryptoNavigation, { profile });
|
|
1626
|
+
break;
|
|
1627
|
+
case "social-button":
|
|
1628
|
+
content = /* @__PURE__ */ jsx(CryptoSocialButton, { provider: kind, onlyIcon, state });
|
|
1629
|
+
break;
|
|
1630
|
+
case "menu-dropdown":
|
|
1631
|
+
content = /* @__PURE__ */ jsx(CryptoMenu, {});
|
|
1632
|
+
break;
|
|
1633
|
+
case "favorites-dropdown":
|
|
1634
|
+
content = /* @__PURE__ */ jsx(CryptoFavorites, {});
|
|
1635
|
+
break;
|
|
1636
|
+
case "profile-dropdown":
|
|
1637
|
+
content = /* @__PURE__ */ jsx(CryptoMenu, { profile: true });
|
|
1638
|
+
break;
|
|
1639
|
+
case "wallet-dropdown":
|
|
1640
|
+
content = /* @__PURE__ */ jsx(CryptoWallet, {});
|
|
1641
|
+
break;
|
|
1642
|
+
case "swap-token-dropdown":
|
|
1643
|
+
content = /* @__PURE__ */ jsx(CryptoStandaloneTokenList, {});
|
|
1644
|
+
break;
|
|
1645
|
+
case "notifications-dropdown":
|
|
1646
|
+
content = /* @__PURE__ */ jsx(CryptoNotifications, {});
|
|
1647
|
+
break;
|
|
1648
|
+
case "connect-wallet":
|
|
1649
|
+
content = /* @__PURE__ */ jsx(CryptoConnectWallet, {});
|
|
1650
|
+
break;
|
|
1651
|
+
case "banner":
|
|
1652
|
+
content = /* @__PURE__ */ jsx(CryptoBanner, {});
|
|
1653
|
+
break;
|
|
1654
|
+
case "filter-type":
|
|
1655
|
+
case "filter-date":
|
|
1656
|
+
case "filter-status":
|
|
1657
|
+
case "filter-token":
|
|
1658
|
+
content = /* @__PURE__ */ jsx(CryptoFilter, { kind: part.slice(7), standalone: true });
|
|
1659
|
+
break;
|
|
1660
|
+
case "mobile-navigation":
|
|
1661
|
+
content = /* @__PURE__ */ jsx(CryptoNavigation, { mobile: true });
|
|
1662
|
+
break;
|
|
1663
|
+
case "mobile-bottom-navigation":
|
|
1664
|
+
content = /* @__PURE__ */ jsx(CryptoMobileBottom, {});
|
|
1665
|
+
break;
|
|
1666
|
+
}
|
|
1667
|
+
return /* @__PURE__ */ jsx(
|
|
1668
|
+
"div",
|
|
1669
|
+
{
|
|
1670
|
+
"data-slot": "crypto-demo",
|
|
1671
|
+
"data-crypto-part": part,
|
|
1672
|
+
"data-preview-state": state,
|
|
1673
|
+
className: cn("flex max-w-full text-foreground", part === "navigation" || part === "banner" ? "w-full" : "w-fit"),
|
|
1674
|
+
children: content
|
|
1675
|
+
}
|
|
1676
|
+
);
|
|
1677
|
+
}
|
|
1678
|
+
function CryptoStandaloneTokenList() {
|
|
1679
|
+
const cryptoLabel = useCryptoLabels();
|
|
1680
|
+
const [query, setQuery] = React.useState("");
|
|
1681
|
+
const [selected, setSelected] = React.useState("");
|
|
1682
|
+
return /* @__PURE__ */ jsxs(CryptoPanel, { className: "w-70 max-w-full", children: [
|
|
1683
|
+
/* @__PURE__ */ jsx(
|
|
1684
|
+
SearchInput,
|
|
1685
|
+
{
|
|
1686
|
+
"aria-label": cryptoLabel("searchTokens"),
|
|
1687
|
+
placeholder: cryptoLabel("searchTokens"),
|
|
1688
|
+
value: query,
|
|
1689
|
+
onChange: setQuery,
|
|
1690
|
+
className: "h-10 rounded-none border-0 border-b shadow-none",
|
|
1691
|
+
inputClassName: "text-compact"
|
|
1692
|
+
}
|
|
1693
|
+
),
|
|
1694
|
+
/* @__PURE__ */ jsx("div", { className: "h-68.5 overflow-auto", children: /* @__PURE__ */ jsx(
|
|
1695
|
+
CryptoTokenList,
|
|
1696
|
+
{
|
|
1697
|
+
query,
|
|
1698
|
+
limit: 12,
|
|
1699
|
+
onSelect: (token) => setSelected(cryptoLabel("selectedToken", { token: tokenBySymbol(token).name }))
|
|
1700
|
+
}
|
|
1701
|
+
) }),
|
|
1702
|
+
/* @__PURE__ */ jsx(CryptoNotice, { message: selected })
|
|
1703
|
+
] });
|
|
1704
|
+
}
|
|
1705
|
+
export {
|
|
1706
|
+
CryptocurrencyDemo
|
|
1707
|
+
};
|
|
1708
|
+
//# sourceMappingURL=cryptocurrency.js.map
|