@open-mercato/core 0.7.1-develop.7202.1.a52dc6707c → 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,188 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
5
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
6
|
+
import { SearchInput } from "@open-mercato/ui/primitives/search-input";
|
|
7
|
+
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
8
|
+
import { colors, grid, radius, shadows, typography } from "./foundation-reference-data.js";
|
|
9
|
+
function ReferenceNote({ message }) {
|
|
10
|
+
const t = useT();
|
|
11
|
+
return /* @__PURE__ */ jsx("p", { className: "max-w-3xl text-sm leading-relaxed text-muted-foreground", children: t(`design_system.foundations.reference.${message}`) });
|
|
12
|
+
}
|
|
13
|
+
function SourceTypography() {
|
|
14
|
+
const t = useT();
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
16
|
+
/* @__PURE__ */ jsx(ReferenceNote, { message: "typographyNote" }),
|
|
17
|
+
/* @__PURE__ */ jsx("div", { className: "divide-y divide-border", children: typography.map((item) => /* @__PURE__ */ jsxs("article", { className: "min-w-0 space-y-4 py-6", "data-foundation": "typography", children: [
|
|
18
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline justify-between gap-3", children: [
|
|
19
|
+
/* @__PURE__ */ jsx("h4", { className: "text-sm font-medium", children: t(`design_system.foundations.reference.type.${item.id}`) }),
|
|
20
|
+
/* @__PURE__ */ jsxs("dl", { className: "flex flex-wrap gap-x-5 gap-y-2 text-xs text-muted-foreground", children: [
|
|
21
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
22
|
+
/* @__PURE__ */ jsxs("dt", { className: "inline", children: [
|
|
23
|
+
t("design_system.foundations.reference.sizeHeight"),
|
|
24
|
+
" "
|
|
25
|
+
] }),
|
|
26
|
+
/* @__PURE__ */ jsxs("dd", { className: "inline font-mono", children: [
|
|
27
|
+
item.size,
|
|
28
|
+
"/",
|
|
29
|
+
item.lineHeight,
|
|
30
|
+
" px"
|
|
31
|
+
] })
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
34
|
+
/* @__PURE__ */ jsxs("dt", { className: "inline", children: [
|
|
35
|
+
t("design_system.foundations.reference.weight"),
|
|
36
|
+
" "
|
|
37
|
+
] }),
|
|
38
|
+
/* @__PURE__ */ jsx("dd", { className: "inline font-mono", children: item.weight })
|
|
39
|
+
] }),
|
|
40
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
41
|
+
/* @__PURE__ */ jsxs("dt", { className: "inline", children: [
|
|
42
|
+
t("design_system.foundations.reference.tracking"),
|
|
43
|
+
" "
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ jsxs("dd", { className: "inline font-mono", children: [
|
|
46
|
+
item.tracking,
|
|
47
|
+
"%"
|
|
48
|
+
] })
|
|
49
|
+
] })
|
|
50
|
+
] })
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ jsx("p", { className: "break-words font-sans", style: { fontSize: item.size, lineHeight: `${item.lineHeight}px`, fontWeight: item.weight, letterSpacing: `${item.tracking / 100}em`, textTransform: item.name.toLowerCase().startsWith("subhead") ? "uppercase" : void 0 }, children: t("design_system.gallery.samples.typeSample") })
|
|
53
|
+
] }, item.id)) })
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
function SourceRadius() {
|
|
57
|
+
const t = useT();
|
|
58
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
59
|
+
/* @__PURE__ */ jsx(ReferenceNote, { message: "radiusNote" }),
|
|
60
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-x-6 gap-y-8 sm:grid-cols-3 xl:grid-cols-4", children: radius.map((item) => /* @__PURE__ */ jsxs("article", { className: "space-y-3", "data-foundation": "radius", children: [
|
|
61
|
+
/* @__PURE__ */ jsx("div", { className: "h-24 border-2 border-foreground bg-muted/40", style: { borderRadius: item.pixels }, "aria-hidden": true }),
|
|
62
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap justify-between gap-2 text-sm", children: [
|
|
63
|
+
/* @__PURE__ */ jsx("code", { children: item.name }),
|
|
64
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
65
|
+
item.pixels,
|
|
66
|
+
" px"
|
|
67
|
+
] })
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: item.applicationClassName ?? t("design_system.foundations.reference.sourceOnly") })
|
|
70
|
+
] }, item.id)) })
|
|
71
|
+
] });
|
|
72
|
+
}
|
|
73
|
+
function SourceShadows() {
|
|
74
|
+
const t = useT();
|
|
75
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
76
|
+
/* @__PURE__ */ jsx(ReferenceNote, { message: "shadowNote" }),
|
|
77
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-6 sm:grid-cols-2 xl:grid-cols-3", children: shadows.map((item) => /* @__PURE__ */ jsxs("article", { className: "min-w-0 space-y-4 rounded-lg border border-border p-5", "data-foundation": "shadow", children: [
|
|
78
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-40 items-center justify-center overflow-hidden rounded-md", style: { backgroundColor: "#ffffff" }, children: /* @__PURE__ */ jsx("div", { className: "h-20 w-28 rounded-lg", style: { backgroundColor: "#ffffff", boxShadow: item.css }, "aria-hidden": true }) }),
|
|
79
|
+
/* @__PURE__ */ jsx("h4", { className: "text-sm font-medium", children: t(`design_system.foundations.reference.shadow.${item.id}`) }),
|
|
80
|
+
/* @__PURE__ */ jsx("code", { className: "block break-words text-xs text-muted-foreground", children: item.name }),
|
|
81
|
+
/* @__PURE__ */ jsxs("section", { className: "text-xs", children: [
|
|
82
|
+
/* @__PURE__ */ jsx("h5", { className: "text-xs font-medium", children: t("design_system.foundations.reference.shadowLayers") }),
|
|
83
|
+
/* @__PURE__ */ jsx("code", { className: "mt-3 block break-words leading-relaxed text-muted-foreground", children: item.css })
|
|
84
|
+
] })
|
|
85
|
+
] }, item.id)) })
|
|
86
|
+
] });
|
|
87
|
+
}
|
|
88
|
+
function SourceGrids() {
|
|
89
|
+
const t = useT();
|
|
90
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-8", children: [
|
|
91
|
+
/* @__PURE__ */ jsx(ReferenceNote, { message: "gridNote" }),
|
|
92
|
+
grid.map((item) => /* @__PURE__ */ jsxs("article", { className: "space-y-4", "data-foundation": "grid", children: [
|
|
93
|
+
/* @__PURE__ */ jsx("h4", { className: "text-base font-medium", children: t(`design_system.foundations.reference.grid.${item.id}`) }),
|
|
94
|
+
/* @__PURE__ */ jsxs("div", { role: "img", "aria-label": t(`design_system.foundations.reference.grid.${item.id}`), className: "relative flex h-36 overflow-hidden rounded-lg border border-border bg-background sm:h-48", children: [
|
|
95
|
+
item.sidebar > 0 ? /* @__PURE__ */ jsx("div", { className: "h-full shrink-0 bg-primary", style: { width: `${item.sidebar / item.width * 100}%` } }) : null,
|
|
96
|
+
item.submenu > 0 ? /* @__PURE__ */ jsx("div", { className: "h-full shrink-0 bg-muted", style: { width: `${item.submenu / item.width * 100}%` } }) : null,
|
|
97
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-full min-w-0 flex-1", style: { paddingInline: `${item.safe / item.width * 100}%`, gap: `${item.gutter / (item.width - item.sidebar - item.submenu - item.safe * 2) * 100}%` }, children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ jsx("div", { className: "h-full min-w-0 flex-1 bg-primary/15" }, index)) })
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ jsxs("dl", { className: "grid grid-cols-2 gap-4 text-sm sm:grid-cols-4", children: [
|
|
100
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
101
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: t("design_system.figmaFoundations.columns") }),
|
|
102
|
+
/* @__PURE__ */ jsxs("dd", { className: "mt-1 font-mono", children: [
|
|
103
|
+
"12 \xD7 ",
|
|
104
|
+
item.column,
|
|
105
|
+
" px"
|
|
106
|
+
] })
|
|
107
|
+
] }),
|
|
108
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
109
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: t("design_system.figmaFoundations.gutter") }),
|
|
110
|
+
/* @__PURE__ */ jsxs("dd", { className: "mt-1 font-mono", children: [
|
|
111
|
+
item.gutter,
|
|
112
|
+
" px"
|
|
113
|
+
] })
|
|
114
|
+
] }),
|
|
115
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
116
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: t("design_system.figmaFoundations.safeArea") }),
|
|
117
|
+
/* @__PURE__ */ jsxs("dd", { className: "mt-1 font-mono", children: [
|
|
118
|
+
item.safe,
|
|
119
|
+
" px"
|
|
120
|
+
] })
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
123
|
+
/* @__PURE__ */ jsx("dt", { className: "text-xs text-muted-foreground", children: t("design_system.figmaFoundations.sidebar") }),
|
|
124
|
+
/* @__PURE__ */ jsxs("dd", { className: "mt-1 font-mono", children: [
|
|
125
|
+
item.sidebar,
|
|
126
|
+
item.submenu ? ` + ${item.submenu}` : "",
|
|
127
|
+
" px"
|
|
128
|
+
] })
|
|
129
|
+
] })
|
|
130
|
+
] })
|
|
131
|
+
] }, item.id))
|
|
132
|
+
] });
|
|
133
|
+
}
|
|
134
|
+
function colorGroup(item) {
|
|
135
|
+
if (item.mode) return item.mode;
|
|
136
|
+
if (item.kind.startsWith("Color/")) return "brand";
|
|
137
|
+
if (item.name.includes(" [")) return item.name.split(" [")[0].toLowerCase();
|
|
138
|
+
return item.name.split("-")[0];
|
|
139
|
+
}
|
|
140
|
+
function SourceSwatch({ item }) {
|
|
141
|
+
const t = useT();
|
|
142
|
+
const value = item.opacity < 1 ? `${item.hex}${Math.round(item.opacity * 255).toString(16).padStart(2, "0")}` : item.hex;
|
|
143
|
+
const copy = async () => {
|
|
144
|
+
try {
|
|
145
|
+
await navigator.clipboard.writeText(value);
|
|
146
|
+
flash(t("design_system.gallery.tokenCopied", { token: value }), "success");
|
|
147
|
+
} catch {
|
|
148
|
+
flash(t("design_system.gallery.tokenCopyFailed"), "error");
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
return /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", onClick: copy, title: t("design_system.gallery.copyToken", { token: value }), className: "h-auto min-w-0 flex-col items-stretch justify-start gap-2 whitespace-normal rounded-md p-1.5 text-left", "data-foundation": "color", children: [
|
|
152
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "block h-16 shrink-0 overflow-hidden rounded-md border border-border bg-background", children: /* @__PURE__ */ jsx("span", { className: "block h-full", style: { backgroundColor: item.hex, opacity: item.opacity } }) }),
|
|
153
|
+
/* @__PURE__ */ jsx("span", { className: "break-words text-xs font-medium", children: item.role || item.name }),
|
|
154
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-muted-foreground", children: value.toUpperCase() }),
|
|
155
|
+
item.mismatch ? /* @__PURE__ */ jsx("span", { className: "text-overline leading-normal text-muted-foreground", children: t("design_system.foundations.reference.sourceCaption", { value: item.captions.join(", ") }) }) : null
|
|
156
|
+
] });
|
|
157
|
+
}
|
|
158
|
+
function SourceColors() {
|
|
159
|
+
const t = useT();
|
|
160
|
+
const [query, setQuery] = React.useState("");
|
|
161
|
+
const needle = query.trim().toLocaleLowerCase();
|
|
162
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
163
|
+
for (const item of colors) {
|
|
164
|
+
const group = colorGroup(item);
|
|
165
|
+
const label = t(`design_system.foundations.reference.colorGroup.${group}`, group);
|
|
166
|
+
if (needle && !`${label} ${item.name} ${item.role ?? ""} ${item.hex} ${item.captions.join(" ")}`.toLocaleLowerCase().includes(needle)) continue;
|
|
167
|
+
const items = grouped.get(group) ?? [];
|
|
168
|
+
items.push(item);
|
|
169
|
+
grouped.set(group, items);
|
|
170
|
+
}
|
|
171
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-8", children: [
|
|
172
|
+
/* @__PURE__ */ jsx(ReferenceNote, { message: "colorNote" }),
|
|
173
|
+
/* @__PURE__ */ jsx(SearchInput, { value: query, onChange: setQuery, "aria-label": t("design_system.figmaFoundations.filterColors"), placeholder: t("design_system.figmaFoundations.filterColors"), className: "max-w-xl" }),
|
|
174
|
+
Array.from(grouped, ([group, items]) => /* @__PURE__ */ jsxs("section", { className: "space-y-3", children: [
|
|
175
|
+
/* @__PURE__ */ jsx("h4", { className: "text-sm font-medium", children: t(`design_system.foundations.reference.colorGroup.${group}`, group) }),
|
|
176
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-4 xl:grid-cols-6", children: items.map((item) => /* @__PURE__ */ jsx(SourceSwatch, { item }, item.id)) })
|
|
177
|
+
] }, group)),
|
|
178
|
+
grouped.size === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("design_system.figmaFoundations.emptyResults") }) : null
|
|
179
|
+
] });
|
|
180
|
+
}
|
|
181
|
+
export {
|
|
182
|
+
SourceColors,
|
|
183
|
+
SourceGrids,
|
|
184
|
+
SourceRadius,
|
|
185
|
+
SourceShadows,
|
|
186
|
+
SourceTypography
|
|
187
|
+
};
|
|
188
|
+
//# sourceMappingURL=foundation-references.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/design_system/gallery/demos/foundation-references.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { SearchInput } from '@open-mercato/ui/primitives/search-input'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { colors, grid, radius, shadows, typography } from './foundation-reference-data'\n\nfunction ReferenceNote({ message }: { message: string }) {\n const t = useT()\n return <p className=\"max-w-3xl text-sm leading-relaxed text-muted-foreground\">{t(`design_system.foundations.reference.${message}`)}</p>\n}\n\nexport function SourceTypography() {\n const t = useT()\n return <div className=\"space-y-6\">\n <ReferenceNote message=\"typographyNote\" />\n <div className=\"divide-y divide-border\">\n {typography.map(item => <article key={item.id} className=\"min-w-0 space-y-4 py-6\" data-foundation=\"typography\">\n <div className=\"flex flex-wrap items-baseline justify-between gap-3\">\n <h4 className=\"text-sm font-medium\">{t(`design_system.foundations.reference.type.${item.id}`)}</h4>\n <dl className=\"flex flex-wrap gap-x-5 gap-y-2 text-xs text-muted-foreground\">\n <div><dt className=\"inline\">{t('design_system.foundations.reference.sizeHeight')} </dt><dd className=\"inline font-mono\">{item.size}/{item.lineHeight} px</dd></div>\n <div><dt className=\"inline\">{t('design_system.foundations.reference.weight')} </dt><dd className=\"inline font-mono\">{item.weight}</dd></div>\n <div><dt className=\"inline\">{t('design_system.foundations.reference.tracking')} </dt><dd className=\"inline font-mono\">{item.tracking}%</dd></div>\n </dl>\n </div>\n <p className=\"break-words font-sans\" style={{ fontSize: item.size, lineHeight: `${item.lineHeight}px`, fontWeight: item.weight, letterSpacing: `${item.tracking / 100}em`, textTransform: item.name.toLowerCase().startsWith('subhead') ? 'uppercase' : undefined }}>{t('design_system.gallery.samples.typeSample')}</p>\n </article>)}\n </div>\n </div>\n}\n\nexport function SourceRadius() {\n const t = useT()\n return <div className=\"space-y-6\">\n <ReferenceNote message=\"radiusNote\" />\n <div className=\"grid grid-cols-2 gap-x-6 gap-y-8 sm:grid-cols-3 xl:grid-cols-4\">\n {radius.map(item => <article key={item.id} className=\"space-y-3\" data-foundation=\"radius\">\n <div className=\"h-24 border-2 border-foreground bg-muted/40\" style={{ borderRadius: item.pixels }} aria-hidden />\n <div className=\"flex flex-wrap justify-between gap-2 text-sm\"><code>{item.name}</code><span className=\"text-muted-foreground\">{item.pixels} px</span></div>\n <p className=\"text-xs text-muted-foreground\">{item.applicationClassName ?? t('design_system.foundations.reference.sourceOnly')}</p>\n </article>)}\n </div>\n </div>\n}\n\nexport function SourceShadows() {\n const t = useT()\n return <div className=\"space-y-6\">\n <ReferenceNote message=\"shadowNote\" />\n <div className=\"grid gap-6 sm:grid-cols-2 xl:grid-cols-3\">\n {shadows.map(item => <article key={item.id} className=\"min-w-0 space-y-4 rounded-lg border border-border p-5\" data-foundation=\"shadow\">\n <div className=\"flex h-40 items-center justify-center overflow-hidden rounded-md\" style={{ backgroundColor: '#ffffff' }}>\n <div className=\"h-20 w-28 rounded-lg\" style={{ backgroundColor: '#ffffff', boxShadow: item.css }} aria-hidden />\n </div>\n <h4 className=\"text-sm font-medium\">{t(`design_system.foundations.reference.shadow.${item.id}`)}</h4>\n <code className=\"block break-words text-xs text-muted-foreground\">{item.name}</code>\n <section className=\"text-xs\">\n <h5 className=\"text-xs font-medium\">{t('design_system.foundations.reference.shadowLayers')}</h5>\n <code className=\"mt-3 block break-words leading-relaxed text-muted-foreground\">{item.css}</code>\n </section>\n </article>)}\n </div>\n </div>\n}\n\nexport function SourceGrids() {\n const t = useT()\n return <div className=\"space-y-8\">\n <ReferenceNote message=\"gridNote\" />\n {grid.map(item => <article key={item.id} className=\"space-y-4\" data-foundation=\"grid\">\n <h4 className=\"text-base font-medium\">{t(`design_system.foundations.reference.grid.${item.id}`)}</h4>\n <div role=\"img\" aria-label={t(`design_system.foundations.reference.grid.${item.id}`)} className=\"relative flex h-36 overflow-hidden rounded-lg border border-border bg-background sm:h-48\">\n {item.sidebar > 0 ? <div className=\"h-full shrink-0 bg-primary\" style={{ width: `${item.sidebar / item.width * 100}%` }} /> : null}\n {item.submenu > 0 ? <div className=\"h-full shrink-0 bg-muted\" style={{ width: `${item.submenu / item.width * 100}%` }} /> : null}\n <div className=\"flex h-full min-w-0 flex-1\" style={{ paddingInline: `${item.safe / item.width * 100}%`, gap: `${item.gutter / (item.width - item.sidebar - item.submenu - item.safe * 2) * 100}%` }}>\n {Array.from({ length: 12 }, (_, index) => <div key={index} className=\"h-full min-w-0 flex-1 bg-primary/15\" />)}\n </div>\n </div>\n <dl className=\"grid grid-cols-2 gap-4 text-sm sm:grid-cols-4\">\n <div><dt className=\"text-xs text-muted-foreground\">{t('design_system.figmaFoundations.columns')}</dt><dd className=\"mt-1 font-mono\">12 \u00D7 {item.column} px</dd></div>\n <div><dt className=\"text-xs text-muted-foreground\">{t('design_system.figmaFoundations.gutter')}</dt><dd className=\"mt-1 font-mono\">{item.gutter} px</dd></div>\n <div><dt className=\"text-xs text-muted-foreground\">{t('design_system.figmaFoundations.safeArea')}</dt><dd className=\"mt-1 font-mono\">{item.safe} px</dd></div>\n <div><dt className=\"text-xs text-muted-foreground\">{t('design_system.figmaFoundations.sidebar')}</dt><dd className=\"mt-1 font-mono\">{item.sidebar}{item.submenu ? ` + ${item.submenu}` : ''} px</dd></div>\n </dl>\n </article>)}\n </div>\n}\n\nfunction colorGroup(item: typeof colors[number]) {\n if (item.mode) return item.mode\n if (item.kind.startsWith('Color/')) return 'brand'\n if (item.name.includes(' [')) return item.name.split(' [')[0].toLowerCase()\n return item.name.split('-')[0]\n}\n\nfunction SourceSwatch({ item }: { item: typeof colors[number] }) {\n const t = useT()\n const value = item.opacity < 1 ? `${item.hex}${Math.round(item.opacity * 255).toString(16).padStart(2, '0')}` : item.hex\n const copy = async () => {\n try {\n await navigator.clipboard.writeText(value)\n flash(t('design_system.gallery.tokenCopied', { token: value }), 'success')\n } catch {\n flash(t('design_system.gallery.tokenCopyFailed'), 'error')\n }\n }\n return <Button type=\"button\" variant=\"ghost\" onClick={copy} title={t('design_system.gallery.copyToken', { token: value })} className=\"h-auto min-w-0 flex-col items-stretch justify-start gap-2 whitespace-normal rounded-md p-1.5 text-left\" data-foundation=\"color\">\n <span aria-hidden className=\"block h-16 shrink-0 overflow-hidden rounded-md border border-border bg-background\"><span className=\"block h-full\" style={{ backgroundColor: item.hex, opacity: item.opacity }} /></span>\n <span className=\"break-words text-xs font-medium\">{item.role || item.name}</span>\n <span className=\"font-mono text-xs text-muted-foreground\">{value.toUpperCase()}</span>\n {item.mismatch ? <span className=\"text-overline leading-normal text-muted-foreground\">{t('design_system.foundations.reference.sourceCaption', { value: item.captions.join(', ') })}</span> : null}\n </Button>\n}\n\nexport function SourceColors() {\n const t = useT()\n const [query, setQuery] = React.useState('')\n const needle = query.trim().toLocaleLowerCase()\n const grouped = new Map<string, Array<typeof colors[number]>>()\n for (const item of colors) {\n const group = colorGroup(item)\n const label = t(`design_system.foundations.reference.colorGroup.${group}`, group)\n if (needle && !`${label} ${item.name} ${item.role ?? ''} ${item.hex} ${item.captions.join(' ')}`.toLocaleLowerCase().includes(needle)) continue\n const items = grouped.get(group) ?? []\n items.push(item)\n grouped.set(group, items)\n }\n return <div className=\"space-y-8\">\n <ReferenceNote message=\"colorNote\" />\n <SearchInput value={query} onChange={setQuery} aria-label={t('design_system.figmaFoundations.filterColors')} placeholder={t('design_system.figmaFoundations.filterColors')} className=\"max-w-xl\" />\n {Array.from(grouped, ([group, items]) => <section key={group} className=\"space-y-3\">\n <h4 className=\"text-sm font-medium\">{t(`design_system.foundations.reference.colorGroup.${group}`, group)}</h4>\n <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-4 xl:grid-cols-6\">{items.map(item => <SourceSwatch key={item.id} item={item} />)}</div>\n </section>)}\n {grouped.size === 0 ? <p className=\"text-sm text-muted-foreground\">{t('design_system.figmaFoundations.emptyResults')}</p> : null}\n </div>\n}\n"],
|
|
5
|
+
"mappings": ";AAWS,cAYQ,YAZR;AATT,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,QAAQ,MAAM,QAAQ,SAAS,kBAAkB;AAE1D,SAAS,cAAc,EAAE,QAAQ,GAAwB;AACvD,QAAM,IAAI,KAAK;AACf,SAAO,oBAAC,OAAE,WAAU,2DAA2D,YAAE,uCAAuC,OAAO,EAAE,GAAE;AACrI;AAEO,SAAS,mBAAmB;AACjC,QAAM,IAAI,KAAK;AACf,SAAO,qBAAC,SAAI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,oBAAC,eAAY,OAAO,OAAO,UAAU,UAAU,cAAY,EAAE,6CAA6C,GAAG,aAAa,EAAE,6CAA6C,GAAG,WAAU,YAAW;AAAA,IAChM,MAAM,KAAK,SAAS,CAAC,CAAC,OAAO,KAAK,MAAM,qBAAC,aAAoB,WAAU,aACtE;AAAA,0BAAC,QAAG,WAAU,uBAAuB,YAAE,kDAAkD,KAAK,IAAI,KAAK,GAAE;AAAA,MACzG,oBAAC,SAAI,WAAU,wDAAwD,gBAAM,IAAI,UAAQ,oBAAC,gBAA2B,QAAT,KAAK,EAAgB,CAAE,GAAE;AAAA,SAFhF,KAGvD,CAAU;AAAA,IACT,QAAQ,SAAS,IAAI,oBAAC,OAAE,WAAU,iCAAiC,YAAE,6CAA6C,GAAE,IAAO;AAAA,KAC9H;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const source = "import * as React from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { FieldLabel } from '@open-mercato/ui/primitives/label'\nimport { HintText } from '@open-mercato/ui/primitives/hint-text'\nimport { FormField } from '@open-mercato/ui/primitives/form-field'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { CompactButton } from '@open-mercato/ui/primitives/compact-button'\nimport { LinkButton } from '@open-mercato/ui/primitives/link-button'\nimport { SimpleTooltip } from '@open-mercato/ui/primitives/tooltip'\nimport { CheckboxField } from '@open-mercato/ui/primitives/checkbox-field'\nimport { Avatar } from '@open-mercato/ui/primitives/avatar'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Switch } from '@open-mercato/ui/primitives/switch'\nimport { ContentLabel } from '@open-mercato/ui/primitives/content-label'\nimport { ContentCard } from '@open-mercato/ui/primitives/content-card'\nimport { KeyIcon, KeyIconGlyph, type KeyIconColor } from '@open-mercato/ui/primitives/key-icon'\nimport { PaymentIcon, type PaymentIconCategory } from '@open-mercato/ui/primitives/payment-icon'\nimport { ChartLegend, ChartLegendDot, type ChartLegendColor } from '@open-mercato/ui/primitives/chart-legend'\nimport { navigationBrandArtwork } from '@open-mercato/ui/assets/navigation-brand-artwork'\nimport mastercard from '../assets/menu-mastercard.svg'\nimport spotify from '../assets/menu-spotify.svg'\nimport avatar from '../assets/avatar-photo.png'\n\nconst imageSource = (asset: string | { readonly src: string }) => typeof asset === 'string' ? asset : asset.src\nconst prefix = 'design_system.gallery.examples.keyComponents.'\ntype ContentKind = 'basic' | 'icon' | 'avatar' | 'provider' | 'brand' | 'company'\n\nfunction ContentLeading({ kind, size = 40 }: { kind: ContentKind; size?: 40 | 48 }) {\n if (kind === 'basic') return null\n if (kind === 'icon') return <KeyIcon size={size}><KeyIconGlyph /></KeyIcon>\n if (kind === 'avatar') return <Avatar label=\"James Brown\" size={size} src={imageSource(avatar)} />\n if (kind === 'provider') return <img alt=\"\" src={imageSource(mastercard)} className=\"h-6 w-8 object-contain\" />\n return <img alt=\"\" src={kind === 'company' ? navigationBrandArtwork.synergyOriginal : imageSource(spotify)} className={size === 40 ? 'size-10 object-contain' : 'size-12 object-contain'} />\n}\n\nexport function FieldLabelExample({ disabled = false, kind = 'all' }: { disabled?: boolean; kind?: 'all' | 'required' | 'optional' | 'information' | 'action' }) {\n const t = useT()\n const inputId = React.useId()\n const helpId = React.useId()\n const [help, setHelp] = React.useState(false)\n const information = <SimpleTooltip content={t(`${prefix}helpText`)}><CompactButton type=\"button\" size={20} appearance=\"ghost\" disabled={disabled} aria-label={t(`${prefix}information`)}><KeyIconGlyph name=\"labelInformation\" /></CompactButton></SimpleTooltip>\n const action = <LinkButton type=\"button\" size=\"sm\" variant=\"gray\" disabled={disabled} className=\"disabled:text-text-disabled disabled:opacity-100\" aria-expanded={help} aria-controls={helpId} onClick={() => setHelp(value => !value)}>{t(`${prefix}help`)}</LinkButton>\n return <div className=\"grid w-80 max-w-full gap-2\">\n <FieldLabel htmlFor={inputId} disabled={disabled} required={kind === 'required'} sublabel={kind === 'all' || kind === 'optional' ? t(`${prefix}optional`) : undefined} information={kind === 'all' || kind === 'information' ? information : undefined} action={kind === 'all' || kind === 'action' ? action : undefined}>{t(`${prefix}label`)}</FieldLabel>\n <Input id={inputId} disabled={disabled} aria-required={kind === 'required'} aria-describedby={help ? helpId : undefined} />\n <p id={helpId} hidden={!help} className=\"text-xs text-muted-foreground\">{t(`${prefix}helpText`)}</p>\n </div>\n}\n\nexport function FormFieldLabelExample() {\n const t = useT()\n return <div className=\"grid w-80 max-w-full gap-5\">{[false, true].map(disabled => <FormField key={String(disabled)} sourceLabel label={t(`${prefix}label`)} labelSublabel={t(`${prefix}optional`)} disabled={disabled} description={t(`${prefix}hint`)}><Input /></FormField>)}</div>\n}\n\nexport function HintTextExample({ state = 'default', icon = true }: { state?: 'default' | 'error' | 'disabled'; icon?: boolean }) {\n const t = useT()\n return <HintText state={state} leading={icon ? <KeyIconGlyph name=\"information\" /> : undefined}>{t(`${prefix}hint`)}</HintText>\n}\n\nexport function ContentLabelExample({ kind = 'basic', size = 40, configurable = false }: { kind?: Exclude<ContentKind, 'provider'>; size?: 40 | 48; configurable?: boolean }) {\n const t = useT()\n const [sublabel, setSublabel] = React.useState(true)\n const [badge, setBadge] = React.useState(false)\n const [toggle, setToggle] = React.useState(false)\n const [enabled, setEnabled] = React.useState(false)\n return <div className=\"grid w-full gap-5\">\n {configurable ? <div className=\"flex flex-wrap gap-4\"><CheckboxField label={t(`${prefix}sublabelControl`)} checked={sublabel} onCheckedChange={checked => setSublabel(checked === true)} /><CheckboxField label={t(`${prefix}badgeControl`)} checked={badge} onCheckedChange={checked => setBadge(checked === true)} /><CheckboxField label={t(`${prefix}toggleControl`)} checked={toggle} onCheckedChange={checked => setToggle(checked === true)} /></div> : null}\n <ContentLabel size={size} label={t(`${prefix}label`)} description={t(`${prefix}description`)} sublabel={sublabel ? t(`${prefix}sublabel`) : undefined} leading={kind === 'basic' ? undefined : <ContentLeading kind={kind} size={size} />} badge={badge ? <Badge size={20} tone=\"info\" appearance=\"light\">{t(`${prefix}new`)}</Badge> : undefined} trailing={toggle ? <Switch aria-label={t(`${prefix}enabled`)} checked={enabled} onCheckedChange={setEnabled} /> : undefined} className={configurable ? 'w-full max-w-md' : 'w-75 max-w-full'} />\n {toggle ? <output className=\"text-xs text-muted-foreground\">{t(`${prefix}${enabled ? 'enabled' : 'disabled'}`)}</output> : null}\n </div>\n}\n\nexport function ContentCardExample({ kind = 'basic', disabled = false }: { kind?: ContentKind; disabled?: boolean }) {\n const t = useT()\n const [visible, setVisible] = React.useState(true)\n return <div className=\"grid w-90 max-w-full gap-3\">\n {visible ? <ContentCard label={t(`${prefix}label`)} description={t(`${prefix}description`)} sublabel={t(`${prefix}sublabel`)} leading={kind === 'basic' ? undefined : <ContentLeading kind={kind} />} badge={<Badge size={16} tone=\"info\" appearance=\"light\">{t(`${prefix}new`)}</Badge>} onDismiss={() => setVisible(false)} dismissLabel={t(`${prefix}dismiss`)} disabled={disabled} /> : <><output className=\"text-sm text-muted-foreground\">{t(`${prefix}dismissed`)}</output><Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => setVisible(true)}>{t(`${prefix}restore`)}</Button></>}\n </div>\n}\n\nconst keyColors: KeyIconColor[] = ['gray', 'blue', 'orange', 'red', 'green', 'yellow', 'purple', 'pink', 'teal']\nconst legendColors: ChartLegendColor[] = ['gray', 'light-gray', 'blue', 'orange', 'red', 'green', 'yellow', 'purple', 'sky', 'pink', 'teal']\n\nexport function KeyIconExamples({ appearance = 'stroke' }: { appearance?: 'stroke' | 'lighter' }) {\n const t = useT()\n return <div className=\"grid w-full gap-4\"><p className=\"max-w-xl text-sm text-muted-foreground\">{t(`${prefix}paletteNote`)}</p>{keyColors.map(color => <div key={color} className=\"flex flex-wrap items-center gap-4\"><span className=\"w-20 text-xs text-muted-foreground\">{t(`${prefix}color.${color}`)}</span>{([64, 56, 48, 40, 32] as const).map(size => <KeyIcon key={size} color={color} appearance={appearance} size={size} aria-label={`${t(`${prefix}color.${color}`)} ${size}`}><KeyIconGlyph /></KeyIcon>)}</div>)}</div>\n}\n\nexport function PaymentIconExamples() {\n const t = useT()\n return <div className=\"grid grid-cols-2 gap-6 sm:grid-cols-4\">{(['water', 'gas', 'electricity', 'donate', 'internet', 'phone', 'rent', 'tax'] as PaymentIconCategory[]).map(category => <div key={category} className=\"flex items-center gap-3\"><PaymentIcon category={category} /><span className=\"text-sm text-foreground\">{t(`${prefix}payment.${category}`)}</span></div>)}</div>\n}\n\nexport function ChartLegendExamples({ interactive = false }: { interactive?: boolean }) {\n const t = useT()\n const [hidden, setHidden] = React.useState<ChartLegendColor[]>([])\n return <div className=\"grid w-full gap-5\"><div className=\"flex flex-wrap gap-5\">{legendColors.map(color => interactive ? <Button key={color} type=\"button\" variant=\"ghost\" size=\"sm\" aria-pressed={!hidden.includes(color)} onClick={() => setHidden(items => items.includes(color) ? items.filter(item => item !== color) : [...items, color])}><ChartLegend color={color} disabled={hidden.includes(color)}>{t(`${prefix}color.${color}`)}</ChartLegend></Button> : <ChartLegend key={color} color={color}>{t(`${prefix}color.${color}`)}</ChartLegend>)}{!interactive ? <ChartLegend disabled>{t(`${prefix}disabled`)}</ChartLegend> : null}</div>\n {interactive ? <div className=\"flex flex-wrap gap-3\" role=\"list\" aria-label={t(`${prefix}visibleSeries`)}>{legendColors.filter(color => !hidden.includes(color)).map(color => <div key={color} role=\"listitem\" className=\"rounded-md border border-border p-3\"><ChartLegend color={color}>{t(`${prefix}color.${color}`)}</ChartLegend></div>)}</div> : null}\n </div>\n}\n\nexport function ChartLegendDotExamples({ size = 16 }: { size?: 16 | 20 }) {\n const t = useT()\n return <div className=\"flex flex-wrap items-center gap-5\">{legendColors.map(color => <div key={color} className=\"flex items-center gap-1\"><ChartLegendDot color={color} size={size} /><span className=\"text-xs text-muted-foreground\">{t(`${prefix}color.${color}`)}</span></div>)}</div>\n}\n";
|
|
2
|
+
const keyComponentExampleCode = (expression) => source + "\n" + expression + "\n";
|
|
3
|
+
export {
|
|
4
|
+
keyComponentExampleCode
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=key-components-code.generated.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/design_system/gallery/demos/key-components-code.generated.ts"],
|
|
4
|
+
"sourcesContent": ["// Generated by yarn storybook:generate from key-components.tsx.\nconst source = \"import * as React from 'react'\\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\\nimport { FieldLabel } from '@open-mercato/ui/primitives/label'\\nimport { HintText } from '@open-mercato/ui/primitives/hint-text'\\nimport { FormField } from '@open-mercato/ui/primitives/form-field'\\nimport { Input } from '@open-mercato/ui/primitives/input'\\nimport { Button } from '@open-mercato/ui/primitives/button'\\nimport { CompactButton } from '@open-mercato/ui/primitives/compact-button'\\nimport { LinkButton } from '@open-mercato/ui/primitives/link-button'\\nimport { SimpleTooltip } from '@open-mercato/ui/primitives/tooltip'\\nimport { CheckboxField } from '@open-mercato/ui/primitives/checkbox-field'\\nimport { Avatar } from '@open-mercato/ui/primitives/avatar'\\nimport { Badge } from '@open-mercato/ui/primitives/badge'\\nimport { Switch } from '@open-mercato/ui/primitives/switch'\\nimport { ContentLabel } from '@open-mercato/ui/primitives/content-label'\\nimport { ContentCard } from '@open-mercato/ui/primitives/content-card'\\nimport { KeyIcon, KeyIconGlyph, type KeyIconColor } from '@open-mercato/ui/primitives/key-icon'\\nimport { PaymentIcon, type PaymentIconCategory } from '@open-mercato/ui/primitives/payment-icon'\\nimport { ChartLegend, ChartLegendDot, type ChartLegendColor } from '@open-mercato/ui/primitives/chart-legend'\\nimport { navigationBrandArtwork } from '@open-mercato/ui/assets/navigation-brand-artwork'\\nimport mastercard from '../assets/menu-mastercard.svg'\\nimport spotify from '../assets/menu-spotify.svg'\\nimport avatar from '../assets/avatar-photo.png'\\n\\nconst imageSource = (asset: string | { readonly src: string }) => typeof asset === 'string' ? asset : asset.src\\nconst prefix = 'design_system.gallery.examples.keyComponents.'\\ntype ContentKind = 'basic' | 'icon' | 'avatar' | 'provider' | 'brand' | 'company'\\n\\nfunction ContentLeading({ kind, size = 40 }: { kind: ContentKind; size?: 40 | 48 }) {\\n if (kind === 'basic') return null\\n if (kind === 'icon') return <KeyIcon size={size}><KeyIconGlyph /></KeyIcon>\\n if (kind === 'avatar') return <Avatar label=\\\"James Brown\\\" size={size} src={imageSource(avatar)} />\\n if (kind === 'provider') return <img alt=\\\"\\\" src={imageSource(mastercard)} className=\\\"h-6 w-8 object-contain\\\" />\\n return <img alt=\\\"\\\" src={kind === 'company' ? navigationBrandArtwork.synergyOriginal : imageSource(spotify)} className={size === 40 ? 'size-10 object-contain' : 'size-12 object-contain'} />\\n}\\n\\nexport function FieldLabelExample({ disabled = false, kind = 'all' }: { disabled?: boolean; kind?: 'all' | 'required' | 'optional' | 'information' | 'action' }) {\\n const t = useT()\\n const inputId = React.useId()\\n const helpId = React.useId()\\n const [help, setHelp] = React.useState(false)\\n const information = <SimpleTooltip content={t(`${prefix}helpText`)}><CompactButton type=\\\"button\\\" size={20} appearance=\\\"ghost\\\" disabled={disabled} aria-label={t(`${prefix}information`)}><KeyIconGlyph name=\\\"labelInformation\\\" /></CompactButton></SimpleTooltip>\\n const action = <LinkButton type=\\\"button\\\" size=\\\"sm\\\" variant=\\\"gray\\\" disabled={disabled} className=\\\"disabled:text-text-disabled disabled:opacity-100\\\" aria-expanded={help} aria-controls={helpId} onClick={() => setHelp(value => !value)}>{t(`${prefix}help`)}</LinkButton>\\n return <div className=\\\"grid w-80 max-w-full gap-2\\\">\\n <FieldLabel htmlFor={inputId} disabled={disabled} required={kind === 'required'} sublabel={kind === 'all' || kind === 'optional' ? t(`${prefix}optional`) : undefined} information={kind === 'all' || kind === 'information' ? information : undefined} action={kind === 'all' || kind === 'action' ? action : undefined}>{t(`${prefix}label`)}</FieldLabel>\\n <Input id={inputId} disabled={disabled} aria-required={kind === 'required'} aria-describedby={help ? helpId : undefined} />\\n <p id={helpId} hidden={!help} className=\\\"text-xs text-muted-foreground\\\">{t(`${prefix}helpText`)}</p>\\n </div>\\n}\\n\\nexport function FormFieldLabelExample() {\\n const t = useT()\\n return <div className=\\\"grid w-80 max-w-full gap-5\\\">{[false, true].map(disabled => <FormField key={String(disabled)} sourceLabel label={t(`${prefix}label`)} labelSublabel={t(`${prefix}optional`)} disabled={disabled} description={t(`${prefix}hint`)}><Input /></FormField>)}</div>\\n}\\n\\nexport function HintTextExample({ state = 'default', icon = true }: { state?: 'default' | 'error' | 'disabled'; icon?: boolean }) {\\n const t = useT()\\n return <HintText state={state} leading={icon ? <KeyIconGlyph name=\\\"information\\\" /> : undefined}>{t(`${prefix}hint`)}</HintText>\\n}\\n\\nexport function ContentLabelExample({ kind = 'basic', size = 40, configurable = false }: { kind?: Exclude<ContentKind, 'provider'>; size?: 40 | 48; configurable?: boolean }) {\\n const t = useT()\\n const [sublabel, setSublabel] = React.useState(true)\\n const [badge, setBadge] = React.useState(false)\\n const [toggle, setToggle] = React.useState(false)\\n const [enabled, setEnabled] = React.useState(false)\\n return <div className=\\\"grid w-full gap-5\\\">\\n {configurable ? <div className=\\\"flex flex-wrap gap-4\\\"><CheckboxField label={t(`${prefix}sublabelControl`)} checked={sublabel} onCheckedChange={checked => setSublabel(checked === true)} /><CheckboxField label={t(`${prefix}badgeControl`)} checked={badge} onCheckedChange={checked => setBadge(checked === true)} /><CheckboxField label={t(`${prefix}toggleControl`)} checked={toggle} onCheckedChange={checked => setToggle(checked === true)} /></div> : null}\\n <ContentLabel size={size} label={t(`${prefix}label`)} description={t(`${prefix}description`)} sublabel={sublabel ? t(`${prefix}sublabel`) : undefined} leading={kind === 'basic' ? undefined : <ContentLeading kind={kind} size={size} />} badge={badge ? <Badge size={20} tone=\\\"info\\\" appearance=\\\"light\\\">{t(`${prefix}new`)}</Badge> : undefined} trailing={toggle ? <Switch aria-label={t(`${prefix}enabled`)} checked={enabled} onCheckedChange={setEnabled} /> : undefined} className={configurable ? 'w-full max-w-md' : 'w-75 max-w-full'} />\\n {toggle ? <output className=\\\"text-xs text-muted-foreground\\\">{t(`${prefix}${enabled ? 'enabled' : 'disabled'}`)}</output> : null}\\n </div>\\n}\\n\\nexport function ContentCardExample({ kind = 'basic', disabled = false }: { kind?: ContentKind; disabled?: boolean }) {\\n const t = useT()\\n const [visible, setVisible] = React.useState(true)\\n return <div className=\\\"grid w-90 max-w-full gap-3\\\">\\n {visible ? <ContentCard label={t(`${prefix}label`)} description={t(`${prefix}description`)} sublabel={t(`${prefix}sublabel`)} leading={kind === 'basic' ? undefined : <ContentLeading kind={kind} />} badge={<Badge size={16} tone=\\\"info\\\" appearance=\\\"light\\\">{t(`${prefix}new`)}</Badge>} onDismiss={() => setVisible(false)} dismissLabel={t(`${prefix}dismiss`)} disabled={disabled} /> : <><output className=\\\"text-sm text-muted-foreground\\\">{t(`${prefix}dismissed`)}</output><Button type=\\\"button\\\" variant=\\\"outline\\\" size=\\\"sm\\\" onClick={() => setVisible(true)}>{t(`${prefix}restore`)}</Button></>}\\n </div>\\n}\\n\\nconst keyColors: KeyIconColor[] = ['gray', 'blue', 'orange', 'red', 'green', 'yellow', 'purple', 'pink', 'teal']\\nconst legendColors: ChartLegendColor[] = ['gray', 'light-gray', 'blue', 'orange', 'red', 'green', 'yellow', 'purple', 'sky', 'pink', 'teal']\\n\\nexport function KeyIconExamples({ appearance = 'stroke' }: { appearance?: 'stroke' | 'lighter' }) {\\n const t = useT()\\n return <div className=\\\"grid w-full gap-4\\\"><p className=\\\"max-w-xl text-sm text-muted-foreground\\\">{t(`${prefix}paletteNote`)}</p>{keyColors.map(color => <div key={color} className=\\\"flex flex-wrap items-center gap-4\\\"><span className=\\\"w-20 text-xs text-muted-foreground\\\">{t(`${prefix}color.${color}`)}</span>{([64, 56, 48, 40, 32] as const).map(size => <KeyIcon key={size} color={color} appearance={appearance} size={size} aria-label={`${t(`${prefix}color.${color}`)} ${size}`}><KeyIconGlyph /></KeyIcon>)}</div>)}</div>\\n}\\n\\nexport function PaymentIconExamples() {\\n const t = useT()\\n return <div className=\\\"grid grid-cols-2 gap-6 sm:grid-cols-4\\\">{(['water', 'gas', 'electricity', 'donate', 'internet', 'phone', 'rent', 'tax'] as PaymentIconCategory[]).map(category => <div key={category} className=\\\"flex items-center gap-3\\\"><PaymentIcon category={category} /><span className=\\\"text-sm text-foreground\\\">{t(`${prefix}payment.${category}`)}</span></div>)}</div>\\n}\\n\\nexport function ChartLegendExamples({ interactive = false }: { interactive?: boolean }) {\\n const t = useT()\\n const [hidden, setHidden] = React.useState<ChartLegendColor[]>([])\\n return <div className=\\\"grid w-full gap-5\\\"><div className=\\\"flex flex-wrap gap-5\\\">{legendColors.map(color => interactive ? <Button key={color} type=\\\"button\\\" variant=\\\"ghost\\\" size=\\\"sm\\\" aria-pressed={!hidden.includes(color)} onClick={() => setHidden(items => items.includes(color) ? items.filter(item => item !== color) : [...items, color])}><ChartLegend color={color} disabled={hidden.includes(color)}>{t(`${prefix}color.${color}`)}</ChartLegend></Button> : <ChartLegend key={color} color={color}>{t(`${prefix}color.${color}`)}</ChartLegend>)}{!interactive ? <ChartLegend disabled>{t(`${prefix}disabled`)}</ChartLegend> : null}</div>\\n {interactive ? <div className=\\\"flex flex-wrap gap-3\\\" role=\\\"list\\\" aria-label={t(`${prefix}visibleSeries`)}>{legendColors.filter(color => !hidden.includes(color)).map(color => <div key={color} role=\\\"listitem\\\" className=\\\"rounded-md border border-border p-3\\\"><ChartLegend color={color}>{t(`${prefix}color.${color}`)}</ChartLegend></div>)}</div> : null}\\n </div>\\n}\\n\\nexport function ChartLegendDotExamples({ size = 16 }: { size?: 16 | 20 }) {\\n const t = useT()\\n return <div className=\\\"flex flex-wrap items-center gap-5\\\">{legendColors.map(color => <div key={color} className=\\\"flex items-center gap-1\\\"><ChartLegendDot color={color} size={size} /><span className=\\\"text-xs text-muted-foreground\\\">{t(`${prefix}color.${color}`)}</span></div>)}</div>\\n}\\n\"\nexport const keyComponentExampleCode = (expression: string) => source + \"\\n\" + expression + \"\\n\"\n"],
|
|
5
|
+
"mappings": "AACA,MAAM,SAAS;AACR,MAAM,0BAA0B,CAAC,eAAuB,SAAS,OAAO,aAAa;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
4
|
+
import { FieldLabel } from "@open-mercato/ui/primitives/label";
|
|
5
|
+
import { HintText } from "@open-mercato/ui/primitives/hint-text";
|
|
6
|
+
import { FormField } from "@open-mercato/ui/primitives/form-field";
|
|
7
|
+
import { Input } from "@open-mercato/ui/primitives/input";
|
|
8
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
9
|
+
import { CompactButton } from "@open-mercato/ui/primitives/compact-button";
|
|
10
|
+
import { LinkButton } from "@open-mercato/ui/primitives/link-button";
|
|
11
|
+
import { SimpleTooltip } from "@open-mercato/ui/primitives/tooltip";
|
|
12
|
+
import { CheckboxField } from "@open-mercato/ui/primitives/checkbox-field";
|
|
13
|
+
import { Avatar } from "@open-mercato/ui/primitives/avatar";
|
|
14
|
+
import { Badge } from "@open-mercato/ui/primitives/badge";
|
|
15
|
+
import { Switch } from "@open-mercato/ui/primitives/switch";
|
|
16
|
+
import { ContentLabel } from "@open-mercato/ui/primitives/content-label";
|
|
17
|
+
import { ContentCard } from "@open-mercato/ui/primitives/content-card";
|
|
18
|
+
import { KeyIcon, KeyIconGlyph } from "@open-mercato/ui/primitives/key-icon";
|
|
19
|
+
import { PaymentIcon } from "@open-mercato/ui/primitives/payment-icon";
|
|
20
|
+
import { ChartLegend, ChartLegendDot } from "@open-mercato/ui/primitives/chart-legend";
|
|
21
|
+
import { navigationBrandArtwork } from "@open-mercato/ui/assets/navigation-brand-artwork";
|
|
22
|
+
import mastercard from "../assets/menu-mastercard.svg";
|
|
23
|
+
import spotify from "../assets/menu-spotify.svg";
|
|
24
|
+
import avatar from "../assets/avatar-photo.png";
|
|
25
|
+
const imageSource = (asset) => typeof asset === "string" ? asset : asset.src;
|
|
26
|
+
const prefix = "design_system.gallery.examples.keyComponents.";
|
|
27
|
+
function ContentLeading({ kind, size = 40 }) {
|
|
28
|
+
if (kind === "basic") return null;
|
|
29
|
+
if (kind === "icon") return /* @__PURE__ */ jsx(KeyIcon, { size, children: /* @__PURE__ */ jsx(KeyIconGlyph, {}) });
|
|
30
|
+
if (kind === "avatar") return /* @__PURE__ */ jsx(Avatar, { label: "James Brown", size, src: imageSource(avatar) });
|
|
31
|
+
if (kind === "provider") return /* @__PURE__ */ jsx("img", { alt: "", src: imageSource(mastercard), className: "h-6 w-8 object-contain" });
|
|
32
|
+
return /* @__PURE__ */ jsx("img", { alt: "", src: kind === "company" ? navigationBrandArtwork.synergyOriginal : imageSource(spotify), className: size === 40 ? "size-10 object-contain" : "size-12 object-contain" });
|
|
33
|
+
}
|
|
34
|
+
function FieldLabelExample({ disabled = false, kind = "all" }) {
|
|
35
|
+
const t = useT();
|
|
36
|
+
const inputId = React.useId();
|
|
37
|
+
const helpId = React.useId();
|
|
38
|
+
const [help, setHelp] = React.useState(false);
|
|
39
|
+
const information = /* @__PURE__ */ jsx(SimpleTooltip, { content: t(`${prefix}helpText`), children: /* @__PURE__ */ jsx(CompactButton, { type: "button", size: 20, appearance: "ghost", disabled, "aria-label": t(`${prefix}information`), children: /* @__PURE__ */ jsx(KeyIconGlyph, { name: "labelInformation" }) }) });
|
|
40
|
+
const action = /* @__PURE__ */ jsx(LinkButton, { type: "button", size: "sm", variant: "gray", disabled, className: "disabled:text-text-disabled disabled:opacity-100", "aria-expanded": help, "aria-controls": helpId, onClick: () => setHelp((value) => !value), children: t(`${prefix}help`) });
|
|
41
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid w-80 max-w-full gap-2", children: [
|
|
42
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: inputId, disabled, required: kind === "required", sublabel: kind === "all" || kind === "optional" ? t(`${prefix}optional`) : void 0, information: kind === "all" || kind === "information" ? information : void 0, action: kind === "all" || kind === "action" ? action : void 0, children: t(`${prefix}label`) }),
|
|
43
|
+
/* @__PURE__ */ jsx(Input, { id: inputId, disabled, "aria-required": kind === "required", "aria-describedby": help ? helpId : void 0 }),
|
|
44
|
+
/* @__PURE__ */ jsx("p", { id: helpId, hidden: !help, className: "text-xs text-muted-foreground", children: t(`${prefix}helpText`) })
|
|
45
|
+
] });
|
|
46
|
+
}
|
|
47
|
+
function FormFieldLabelExample() {
|
|
48
|
+
const t = useT();
|
|
49
|
+
return /* @__PURE__ */ jsx("div", { className: "grid w-80 max-w-full gap-5", children: [false, true].map((disabled) => /* @__PURE__ */ jsx(FormField, { sourceLabel: true, label: t(`${prefix}label`), labelSublabel: t(`${prefix}optional`), disabled, description: t(`${prefix}hint`), children: /* @__PURE__ */ jsx(Input, {}) }, String(disabled))) });
|
|
50
|
+
}
|
|
51
|
+
function HintTextExample({ state = "default", icon = true }) {
|
|
52
|
+
const t = useT();
|
|
53
|
+
return /* @__PURE__ */ jsx(HintText, { state, leading: icon ? /* @__PURE__ */ jsx(KeyIconGlyph, { name: "information" }) : void 0, children: t(`${prefix}hint`) });
|
|
54
|
+
}
|
|
55
|
+
function ContentLabelExample({ kind = "basic", size = 40, configurable = false }) {
|
|
56
|
+
const t = useT();
|
|
57
|
+
const [sublabel, setSublabel] = React.useState(true);
|
|
58
|
+
const [badge, setBadge] = React.useState(false);
|
|
59
|
+
const [toggle, setToggle] = React.useState(false);
|
|
60
|
+
const [enabled, setEnabled] = React.useState(false);
|
|
61
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid w-full gap-5", children: [
|
|
62
|
+
configurable ? /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-4", children: [
|
|
63
|
+
/* @__PURE__ */ jsx(CheckboxField, { label: t(`${prefix}sublabelControl`), checked: sublabel, onCheckedChange: (checked) => setSublabel(checked === true) }),
|
|
64
|
+
/* @__PURE__ */ jsx(CheckboxField, { label: t(`${prefix}badgeControl`), checked: badge, onCheckedChange: (checked) => setBadge(checked === true) }),
|
|
65
|
+
/* @__PURE__ */ jsx(CheckboxField, { label: t(`${prefix}toggleControl`), checked: toggle, onCheckedChange: (checked) => setToggle(checked === true) })
|
|
66
|
+
] }) : null,
|
|
67
|
+
/* @__PURE__ */ jsx(ContentLabel, { size, label: t(`${prefix}label`), description: t(`${prefix}description`), sublabel: sublabel ? t(`${prefix}sublabel`) : void 0, leading: kind === "basic" ? void 0 : /* @__PURE__ */ jsx(ContentLeading, { kind, size }), badge: badge ? /* @__PURE__ */ jsx(Badge, { size: 20, tone: "info", appearance: "light", children: t(`${prefix}new`) }) : void 0, trailing: toggle ? /* @__PURE__ */ jsx(Switch, { "aria-label": t(`${prefix}enabled`), checked: enabled, onCheckedChange: setEnabled }) : void 0, className: configurable ? "w-full max-w-md" : "w-75 max-w-full" }),
|
|
68
|
+
toggle ? /* @__PURE__ */ jsx("output", { className: "text-xs text-muted-foreground", children: t(`${prefix}${enabled ? "enabled" : "disabled"}`) }) : null
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
function ContentCardExample({ kind = "basic", disabled = false }) {
|
|
72
|
+
const t = useT();
|
|
73
|
+
const [visible, setVisible] = React.useState(true);
|
|
74
|
+
return /* @__PURE__ */ jsx("div", { className: "grid w-90 max-w-full gap-3", children: visible ? /* @__PURE__ */ jsx(ContentCard, { label: t(`${prefix}label`), description: t(`${prefix}description`), sublabel: t(`${prefix}sublabel`), leading: kind === "basic" ? void 0 : /* @__PURE__ */ jsx(ContentLeading, { kind }), badge: /* @__PURE__ */ jsx(Badge, { size: 16, tone: "info", appearance: "light", children: t(`${prefix}new`) }), onDismiss: () => setVisible(false), dismissLabel: t(`${prefix}dismiss`), disabled }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
75
|
+
/* @__PURE__ */ jsx("output", { className: "text-sm text-muted-foreground", children: t(`${prefix}dismissed`) }),
|
|
76
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setVisible(true), children: t(`${prefix}restore`) })
|
|
77
|
+
] }) });
|
|
78
|
+
}
|
|
79
|
+
const keyColors = ["gray", "blue", "orange", "red", "green", "yellow", "purple", "pink", "teal"];
|
|
80
|
+
const legendColors = ["gray", "light-gray", "blue", "orange", "red", "green", "yellow", "purple", "sky", "pink", "teal"];
|
|
81
|
+
function KeyIconExamples({ appearance = "stroke" }) {
|
|
82
|
+
const t = useT();
|
|
83
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid w-full gap-4", children: [
|
|
84
|
+
/* @__PURE__ */ jsx("p", { className: "max-w-xl text-sm text-muted-foreground", children: t(`${prefix}paletteNote`) }),
|
|
85
|
+
keyColors.map((color) => /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
86
|
+
/* @__PURE__ */ jsx("span", { className: "w-20 text-xs text-muted-foreground", children: t(`${prefix}color.${color}`) }),
|
|
87
|
+
[64, 56, 48, 40, 32].map((size) => /* @__PURE__ */ jsx(KeyIcon, { color, appearance, size, "aria-label": `${t(`${prefix}color.${color}`)} ${size}`, children: /* @__PURE__ */ jsx(KeyIconGlyph, {}) }, size))
|
|
88
|
+
] }, color))
|
|
89
|
+
] });
|
|
90
|
+
}
|
|
91
|
+
function PaymentIconExamples() {
|
|
92
|
+
const t = useT();
|
|
93
|
+
return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-6 sm:grid-cols-4", children: ["water", "gas", "electricity", "donate", "internet", "phone", "rent", "tax"].map((category) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
94
|
+
/* @__PURE__ */ jsx(PaymentIcon, { category }),
|
|
95
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-foreground", children: t(`${prefix}payment.${category}`) })
|
|
96
|
+
] }, category)) });
|
|
97
|
+
}
|
|
98
|
+
function ChartLegendExamples({ interactive = false }) {
|
|
99
|
+
const t = useT();
|
|
100
|
+
const [hidden, setHidden] = React.useState([]);
|
|
101
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid w-full gap-5", children: [
|
|
102
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-5", children: [
|
|
103
|
+
legendColors.map((color) => interactive ? /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "sm", "aria-pressed": !hidden.includes(color), onClick: () => setHidden((items) => items.includes(color) ? items.filter((item) => item !== color) : [...items, color]), children: /* @__PURE__ */ jsx(ChartLegend, { color, disabled: hidden.includes(color), children: t(`${prefix}color.${color}`) }) }, color) : /* @__PURE__ */ jsx(ChartLegend, { color, children: t(`${prefix}color.${color}`) }, color)),
|
|
104
|
+
!interactive ? /* @__PURE__ */ jsx(ChartLegend, { disabled: true, children: t(`${prefix}disabled`) }) : null
|
|
105
|
+
] }),
|
|
106
|
+
interactive ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", role: "list", "aria-label": t(`${prefix}visibleSeries`), children: legendColors.filter((color) => !hidden.includes(color)).map((color) => /* @__PURE__ */ jsx("div", { role: "listitem", className: "rounded-md border border-border p-3", children: /* @__PURE__ */ jsx(ChartLegend, { color, children: t(`${prefix}color.${color}`) }) }, color)) }) : null
|
|
107
|
+
] });
|
|
108
|
+
}
|
|
109
|
+
function ChartLegendDotExamples({ size = 16 }) {
|
|
110
|
+
const t = useT();
|
|
111
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-5", children: legendColors.map((color) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
112
|
+
/* @__PURE__ */ jsx(ChartLegendDot, { color, size }),
|
|
113
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t(`${prefix}color.${color}`) })
|
|
114
|
+
] }, color)) });
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
ChartLegendDotExamples,
|
|
118
|
+
ChartLegendExamples,
|
|
119
|
+
ContentCardExample,
|
|
120
|
+
ContentLabelExample,
|
|
121
|
+
FieldLabelExample,
|
|
122
|
+
FormFieldLabelExample,
|
|
123
|
+
HintTextExample,
|
|
124
|
+
KeyIconExamples,
|
|
125
|
+
PaymentIconExamples
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=key-components.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/design_system/gallery/demos/key-components.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { FieldLabel } from '@open-mercato/ui/primitives/label'\nimport { HintText } from '@open-mercato/ui/primitives/hint-text'\nimport { FormField } from '@open-mercato/ui/primitives/form-field'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { CompactButton } from '@open-mercato/ui/primitives/compact-button'\nimport { LinkButton } from '@open-mercato/ui/primitives/link-button'\nimport { SimpleTooltip } from '@open-mercato/ui/primitives/tooltip'\nimport { CheckboxField } from '@open-mercato/ui/primitives/checkbox-field'\nimport { Avatar } from '@open-mercato/ui/primitives/avatar'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Switch } from '@open-mercato/ui/primitives/switch'\nimport { ContentLabel } from '@open-mercato/ui/primitives/content-label'\nimport { ContentCard } from '@open-mercato/ui/primitives/content-card'\nimport { KeyIcon, KeyIconGlyph, type KeyIconColor } from '@open-mercato/ui/primitives/key-icon'\nimport { PaymentIcon, type PaymentIconCategory } from '@open-mercato/ui/primitives/payment-icon'\nimport { ChartLegend, ChartLegendDot, type ChartLegendColor } from '@open-mercato/ui/primitives/chart-legend'\nimport { navigationBrandArtwork } from '@open-mercato/ui/assets/navigation-brand-artwork'\nimport mastercard from '../assets/menu-mastercard.svg'\nimport spotify from '../assets/menu-spotify.svg'\nimport avatar from '../assets/avatar-photo.png'\n\nconst imageSource = (asset: string | { readonly src: string }) => typeof asset === 'string' ? asset : asset.src\nconst prefix = 'design_system.gallery.examples.keyComponents.'\ntype ContentKind = 'basic' | 'icon' | 'avatar' | 'provider' | 'brand' | 'company'\n\nfunction ContentLeading({ kind, size = 40 }: { kind: ContentKind; size?: 40 | 48 }) {\n if (kind === 'basic') return null\n if (kind === 'icon') return <KeyIcon size={size}><KeyIconGlyph /></KeyIcon>\n if (kind === 'avatar') return <Avatar label=\"James Brown\" size={size} src={imageSource(avatar)} />\n if (kind === 'provider') return <img alt=\"\" src={imageSource(mastercard)} className=\"h-6 w-8 object-contain\" />\n return <img alt=\"\" src={kind === 'company' ? navigationBrandArtwork.synergyOriginal : imageSource(spotify)} className={size === 40 ? 'size-10 object-contain' : 'size-12 object-contain'} />\n}\n\nexport function FieldLabelExample({ disabled = false, kind = 'all' }: { disabled?: boolean; kind?: 'all' | 'required' | 'optional' | 'information' | 'action' }) {\n const t = useT()\n const inputId = React.useId()\n const helpId = React.useId()\n const [help, setHelp] = React.useState(false)\n const information = <SimpleTooltip content={t(`${prefix}helpText`)}><CompactButton type=\"button\" size={20} appearance=\"ghost\" disabled={disabled} aria-label={t(`${prefix}information`)}><KeyIconGlyph name=\"labelInformation\" /></CompactButton></SimpleTooltip>\n const action = <LinkButton type=\"button\" size=\"sm\" variant=\"gray\" disabled={disabled} className=\"disabled:text-text-disabled disabled:opacity-100\" aria-expanded={help} aria-controls={helpId} onClick={() => setHelp(value => !value)}>{t(`${prefix}help`)}</LinkButton>\n return <div className=\"grid w-80 max-w-full gap-2\">\n <FieldLabel htmlFor={inputId} disabled={disabled} required={kind === 'required'} sublabel={kind === 'all' || kind === 'optional' ? t(`${prefix}optional`) : undefined} information={kind === 'all' || kind === 'information' ? information : undefined} action={kind === 'all' || kind === 'action' ? action : undefined}>{t(`${prefix}label`)}</FieldLabel>\n <Input id={inputId} disabled={disabled} aria-required={kind === 'required'} aria-describedby={help ? helpId : undefined} />\n <p id={helpId} hidden={!help} className=\"text-xs text-muted-foreground\">{t(`${prefix}helpText`)}</p>\n </div>\n}\n\nexport function FormFieldLabelExample() {\n const t = useT()\n return <div className=\"grid w-80 max-w-full gap-5\">{[false, true].map(disabled => <FormField key={String(disabled)} sourceLabel label={t(`${prefix}label`)} labelSublabel={t(`${prefix}optional`)} disabled={disabled} description={t(`${prefix}hint`)}><Input /></FormField>)}</div>\n}\n\nexport function HintTextExample({ state = 'default', icon = true }: { state?: 'default' | 'error' | 'disabled'; icon?: boolean }) {\n const t = useT()\n return <HintText state={state} leading={icon ? <KeyIconGlyph name=\"information\" /> : undefined}>{t(`${prefix}hint`)}</HintText>\n}\n\nexport function ContentLabelExample({ kind = 'basic', size = 40, configurable = false }: { kind?: Exclude<ContentKind, 'provider'>; size?: 40 | 48; configurable?: boolean }) {\n const t = useT()\n const [sublabel, setSublabel] = React.useState(true)\n const [badge, setBadge] = React.useState(false)\n const [toggle, setToggle] = React.useState(false)\n const [enabled, setEnabled] = React.useState(false)\n return <div className=\"grid w-full gap-5\">\n {configurable ? <div className=\"flex flex-wrap gap-4\"><CheckboxField label={t(`${prefix}sublabelControl`)} checked={sublabel} onCheckedChange={checked => setSublabel(checked === true)} /><CheckboxField label={t(`${prefix}badgeControl`)} checked={badge} onCheckedChange={checked => setBadge(checked === true)} /><CheckboxField label={t(`${prefix}toggleControl`)} checked={toggle} onCheckedChange={checked => setToggle(checked === true)} /></div> : null}\n <ContentLabel size={size} label={t(`${prefix}label`)} description={t(`${prefix}description`)} sublabel={sublabel ? t(`${prefix}sublabel`) : undefined} leading={kind === 'basic' ? undefined : <ContentLeading kind={kind} size={size} />} badge={badge ? <Badge size={20} tone=\"info\" appearance=\"light\">{t(`${prefix}new`)}</Badge> : undefined} trailing={toggle ? <Switch aria-label={t(`${prefix}enabled`)} checked={enabled} onCheckedChange={setEnabled} /> : undefined} className={configurable ? 'w-full max-w-md' : 'w-75 max-w-full'} />\n {toggle ? <output className=\"text-xs text-muted-foreground\">{t(`${prefix}${enabled ? 'enabled' : 'disabled'}`)}</output> : null}\n </div>\n}\n\nexport function ContentCardExample({ kind = 'basic', disabled = false }: { kind?: ContentKind; disabled?: boolean }) {\n const t = useT()\n const [visible, setVisible] = React.useState(true)\n return <div className=\"grid w-90 max-w-full gap-3\">\n {visible ? <ContentCard label={t(`${prefix}label`)} description={t(`${prefix}description`)} sublabel={t(`${prefix}sublabel`)} leading={kind === 'basic' ? undefined : <ContentLeading kind={kind} />} badge={<Badge size={16} tone=\"info\" appearance=\"light\">{t(`${prefix}new`)}</Badge>} onDismiss={() => setVisible(false)} dismissLabel={t(`${prefix}dismiss`)} disabled={disabled} /> : <><output className=\"text-sm text-muted-foreground\">{t(`${prefix}dismissed`)}</output><Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => setVisible(true)}>{t(`${prefix}restore`)}</Button></>}\n </div>\n}\n\nconst keyColors: KeyIconColor[] = ['gray', 'blue', 'orange', 'red', 'green', 'yellow', 'purple', 'pink', 'teal']\nconst legendColors: ChartLegendColor[] = ['gray', 'light-gray', 'blue', 'orange', 'red', 'green', 'yellow', 'purple', 'sky', 'pink', 'teal']\n\nexport function KeyIconExamples({ appearance = 'stroke' }: { appearance?: 'stroke' | 'lighter' }) {\n const t = useT()\n return <div className=\"grid w-full gap-4\"><p className=\"max-w-xl text-sm text-muted-foreground\">{t(`${prefix}paletteNote`)}</p>{keyColors.map(color => <div key={color} className=\"flex flex-wrap items-center gap-4\"><span className=\"w-20 text-xs text-muted-foreground\">{t(`${prefix}color.${color}`)}</span>{([64, 56, 48, 40, 32] as const).map(size => <KeyIcon key={size} color={color} appearance={appearance} size={size} aria-label={`${t(`${prefix}color.${color}`)} ${size}`}><KeyIconGlyph /></KeyIcon>)}</div>)}</div>\n}\n\nexport function PaymentIconExamples() {\n const t = useT()\n return <div className=\"grid grid-cols-2 gap-6 sm:grid-cols-4\">{(['water', 'gas', 'electricity', 'donate', 'internet', 'phone', 'rent', 'tax'] as PaymentIconCategory[]).map(category => <div key={category} className=\"flex items-center gap-3\"><PaymentIcon category={category} /><span className=\"text-sm text-foreground\">{t(`${prefix}payment.${category}`)}</span></div>)}</div>\n}\n\nexport function ChartLegendExamples({ interactive = false }: { interactive?: boolean }) {\n const t = useT()\n const [hidden, setHidden] = React.useState<ChartLegendColor[]>([])\n return <div className=\"grid w-full gap-5\"><div className=\"flex flex-wrap gap-5\">{legendColors.map(color => interactive ? <Button key={color} type=\"button\" variant=\"ghost\" size=\"sm\" aria-pressed={!hidden.includes(color)} onClick={() => setHidden(items => items.includes(color) ? items.filter(item => item !== color) : [...items, color])}><ChartLegend color={color} disabled={hidden.includes(color)}>{t(`${prefix}color.${color}`)}</ChartLegend></Button> : <ChartLegend key={color} color={color}>{t(`${prefix}color.${color}`)}</ChartLegend>)}{!interactive ? <ChartLegend disabled>{t(`${prefix}disabled`)}</ChartLegend> : null}</div>\n {interactive ? <div className=\"flex flex-wrap gap-3\" role=\"list\" aria-label={t(`${prefix}visibleSeries`)}>{legendColors.filter(color => !hidden.includes(color)).map(color => <div key={color} role=\"listitem\" className=\"rounded-md border border-border p-3\"><ChartLegend color={color}>{t(`${prefix}color.${color}`)}</ChartLegend></div>)}</div> : null}\n </div>\n}\n\nexport function ChartLegendDotExamples({ size = 16 }: { size?: 16 | 20 }) {\n const t = useT()\n return <div className=\"flex flex-wrap items-center gap-5\">{legendColors.map(color => <div key={color} className=\"flex items-center gap-1\"><ChartLegendDot color={color} size={size} /><span className=\"text-xs text-muted-foreground\">{t(`${prefix}color.${color}`)}</span></div>)}</div>\n}\n"],
|
|
5
|
+
"mappings": "AA8BmD,SA+C6U,UA/C7U,KAa1C,YAb0C;AA9BnD,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;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Ae,YAAE,GAAG,MAAM,SAAS,KAAK,EAAE,KAAjD,KAAmD,CAAc;AAAA,MAAG,CAAC,cAAc,oBAAC,eAAY,UAAQ,MAAE,YAAE,GAAG,MAAM,UAAU,GAAE,IAAiB;AAAA,OAAK;AAAA,IAC5mB,cAAc,oBAAC,SAAI,WAAU,wBAAuB,MAAK,QAAO,cAAY,EAAE,GAAG,MAAM,eAAe,GAAI,uBAAa,OAAO,WAAS,CAAC,OAAO,SAAS,KAAK,CAAC,EAAE,IAAI,WAAS,oBAAC,SAAgB,MAAK,YAAW,WAAU,uCAAsC,8BAAC,eAAY,OAAe,YAAE,GAAG,MAAM,SAAS,KAAK,EAAE,GAAE,KAAhI,KAA8I,CAAM,GAAE,IAAS;AAAA,KACzV;AACF;AAEO,SAAS,uBAAuB,EAAE,OAAO,GAAG,GAAuB;AACxE,QAAM,IAAI,KAAK;AACf,SAAO,oBAAC,SAAI,WAAU,qCAAqC,uBAAa,IAAI,WAAS,qBAAC,SAAgB,WAAU,2BAA0B;AAAA,wBAAC,kBAAe,OAAc,MAAY;AAAA,IAAE,oBAAC,UAAK,WAAU,iCAAiC,YAAE,GAAG,MAAM,SAAS,KAAK,EAAE,GAAE;AAAA,OAArK,KAA4K,CAAM,GAAE;AACrR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const source = `import * as React from 'react'
|
|
2
|
+
import { CheckCircle2, ChevronRight, Info, Pencil, UserRound } from 'lucide-react'
|
|
3
|
+
import { useLocale, useT } from '@open-mercato/shared/lib/i18n/context'
|
|
4
|
+
import { cn } from '@open-mercato/shared/lib/utils'
|
|
5
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
6
|
+
import { Input } from '@open-mercato/ui/primitives/input'
|
|
7
|
+
import { InlineInput } from '@open-mercato/ui/primitives/inline-input'
|
|
8
|
+
import { InlineSelectTrigger } from '@open-mercato/ui/primitives/inline-select'
|
|
9
|
+
import { Label } from '@open-mercato/ui/primitives/label'
|
|
10
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@open-mercato/ui/primitives/select'
|
|
11
|
+
import { Textarea } from '@open-mercato/ui/primitives/textarea'
|
|
12
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@open-mercato/ui/primitives/tooltip'
|
|
13
|
+
import { marketingProducts } from '../assets/marketing-artwork'
|
|
14
|
+
|
|
15
|
+
export type MarketingControlState = 'default' | 'hover' | 'active' | 'filled' | 'placeholder' | 'focus' | 'disabled' | 'complete' | 'selected'
|
|
16
|
+
export type MarketingControlKind = 'step-item' | 'select' | 'input' | 'textarea' | 'amount' | 'tab-menu' | 'inline-input' | 'inline-select' | 'chart-tooltip' | 'selected-button' | 'product-image'
|
|
17
|
+
type ControlProps = { kind: MarketingControlKind; state?: MarketingControlState; size?: 'medium' | 'large'; side?: 'right' | 'left' | 'bottom' | 'top'; product?: number }
|
|
18
|
+
const key = (name: string) => \`design_system.gallery.samples.marketing.\${name}\`
|
|
19
|
+
const focusStyle = 'focus-within:border-accent-orange-border focus-within:shadow-none'
|
|
20
|
+
|
|
21
|
+
function UnderlineField({ kind, state = 'default', size = 'medium' }: ControlProps) {
|
|
22
|
+
const t = useT()
|
|
23
|
+
const id = React.useId()
|
|
24
|
+
const large = size === 'large' || kind === 'amount'
|
|
25
|
+
const label = t(key(kind === 'textarea' ? 'description' : kind === 'amount' ? 'productPricing' : kind === 'select' ? 'category' : 'productName'))
|
|
26
|
+
const placeholder = t(key(kind === 'textarea' ? 'productDescriptionPlaceholder' : kind === 'select' ? 'categoryPlaceholder' : 'productNamePlaceholder'))
|
|
27
|
+
const [value, setValue] = React.useState(state === 'filled' ? kind === 'select' ? 'accessories' : kind === 'amount' ? '800' : t(key(kind === 'textarea' ? 'productDescription' : 'productNameExample')) : '')
|
|
28
|
+
const active = state === 'active'
|
|
29
|
+
return <div data-slot="marketing-control" data-kind={kind} className={cn('relative flex w-93 max-w-full flex-col gap-1.5 pb-3.5 after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-border focus-within:after:h-0.5 focus-within:after:bg-accent-orange-border', large ? 'h-20' : 'h-16', active && 'after:h-0.5 after:bg-accent-orange-border')}>
|
|
30
|
+
<Label htmlFor={id} className="flex h-5 shrink-0 items-center gap-1 text-sm font-medium text-muted-foreground">{label}<Info aria-hidden="true" className="size-3 text-text-disabled" /></Label>
|
|
31
|
+
{kind === 'select' ? <Select value={value} onValueChange={setValue}><SelectTrigger id={id} aria-label={label} className={cn('h-6 rounded-none border-0 bg-transparent p-0 text-lg font-medium shadow-none hover:bg-transparent focus:border-0 focus:shadow-none', state === 'hover' && 'text-muted-foreground', active && '[&_svg]:text-accent-orange-text')}><SelectValue placeholder={placeholder} /></SelectTrigger><SelectContent>{['accessories','computers','audio'].map(option => <SelectItem key={option} value={option}>{t(key(option))}</SelectItem>)}</SelectContent></Select> : kind === 'textarea' ? <Textarea id={id} aria-label={label} rows={1} value={value} onChange={event => setValue(event.target.value)} placeholder={placeholder} autoFocus={active} className={cn('h-6 min-h-6 resize-none rounded-none border-0 bg-transparent p-0 text-lg font-medium leading-6 shadow-none hover:bg-transparent focus-visible:shadow-none', state === 'hover' && 'placeholder:text-muted-foreground')} /> : <Input id={id} aria-label={label} value={value} onChange={event => setValue(event.target.value)} type={kind === 'amount' ? 'number' : 'text'} min={kind === 'amount' ? 0 : undefined} step={kind === 'amount' ? '0.01' : undefined} autoFocus={active} placeholder={kind === 'amount' ? '0.00' : placeholder} leading={kind === 'amount' ? <span aria-hidden="true" className={cn('text-title-4 font-medium', !value && !active && 'text-text-disabled')}>$</span> : undefined} className={cn('rounded-none border-0 bg-transparent p-0 shadow-none hover:bg-transparent focus-within:shadow-none', large ? 'h-10' : 'h-6')} inputClassName={cn('font-medium placeholder:text-text-disabled', large ? 'text-title-4 leading-10' : 'text-lg leading-6', state === 'hover' && 'placeholder:text-muted-foreground')} />}
|
|
32
|
+
</div>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function InlineEditor({ state = 'placeholder' }: { state?: MarketingControlState }) {
|
|
36
|
+
const t = useT()
|
|
37
|
+
const [value, setValue] = React.useState(state === 'filled' ? 'James Brown' : '')
|
|
38
|
+
const [draft, setDraft] = React.useState(value)
|
|
39
|
+
const [editing, setEditing] = React.useState(state === 'focus')
|
|
40
|
+
const disabled = state === 'disabled'
|
|
41
|
+
const save = () => { setValue(draft.trim()); setEditing(false) }
|
|
42
|
+
const cancel = () => { setDraft(value); setEditing(false) }
|
|
43
|
+
return <div data-slot="marketing-control" data-kind="inline-input" className="w-78 max-w-full">
|
|
44
|
+
{editing ? <InlineInput autoFocus value={draft} onChange={event => setDraft(event.target.value)} aria-label={t(key('name'))} placeholder={t(key('namePlaceholder'))} className={cn('h-10 gap-2 rounded-lg border-accent-orange-border bg-background px-3', focusStyle)} onKeyDown={event => { if (event.key === 'Escape') { event.preventDefault(); cancel() } if (event.key === 'Enter') { event.preventDefault(); save() } }} trailing={<div className="flex gap-2"><Button variant="ghost" className="h-5 p-0 text-sm font-normal" onClick={cancel}>{t(key('cancel'))}</Button><Button variant="ghost" className="h-5 p-0 text-sm font-normal text-accent-orange-text" onClick={save}>{t(key('save'))}</Button></div>} /> : <Button disabled={disabled} variant="ghost" onClick={() => setEditing(true)} className={cn('h-10 w-full justify-between rounded-lg px-3 text-sm font-normal', state === 'hover' && 'bg-muted', !value && 'text-muted-foreground')}><span className="truncate">{value || t(key('namePlaceholder'))}</span><Pencil aria-hidden="true" className="size-4 shrink-0 text-text-disabled" /></Button>}
|
|
45
|
+
</div>
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function InlineLanguage({ state = 'placeholder' }: { state?: MarketingControlState }) {
|
|
49
|
+
const t = useT()
|
|
50
|
+
const [value, setValue] = React.useState(state === 'filled' ? 'en' : '')
|
|
51
|
+
const [open, setOpen] = React.useState(false)
|
|
52
|
+
return <div data-slot="marketing-control" data-kind="inline-select" className="w-64 max-w-full"><Select value={value} onValueChange={setValue} open={open} onOpenChange={setOpen} disabled={state === 'disabled'}><InlineSelectTrigger aria-label={t(key('language'))} className={cn('h-10 rounded-lg px-3 focus:border-accent-orange-border focus:shadow-none', state === 'hover' && 'bg-muted', state === 'focus' && 'border-accent-orange-border')}><SelectValue placeholder={t(key('languagePlaceholder'))} /></InlineSelectTrigger><SelectContent>{['en','pl','de','es','ko'].map(language => <SelectItem key={language} value={language}>{t(key(\`language\${language}\`))}</SelectItem>)}</SelectContent></Select></div>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function StepItem({ state = 'default' }: { state?: MarketingControlState }) {
|
|
56
|
+
const t = useT()
|
|
57
|
+
const [selected, setSelected] = React.useState(state === 'active')
|
|
58
|
+
return <Button data-slot="marketing-control" data-kind="step-item" variant="ghost" aria-pressed={selected} onClick={() => setSelected(current => !current)} className={cn('h-11 w-45 max-w-full flex-col items-start justify-start gap-1 rounded-none border-r-2 border-transparent p-0 pr-6 text-sm font-normal hover:bg-transparent', selected && 'border-r-accent-orange')}><span className={cn('flex h-5 items-center gap-1', selected ? 'text-accent-orange-text' : 'text-muted-foreground')}>{t(key('step'), undefined, { current: 1, total: 5 })}{state === 'complete' ? <CheckCircle2 aria-hidden="true" className="size-3.5 fill-status-success-icon text-status-success-foreground" /> : null}</span><span className="h-5">{t(key('generalInformation'))}</span></Button>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function SelectedAmount({ state = 'default' }: { state?: MarketingControlState }) {
|
|
62
|
+
const locale = useLocale()
|
|
63
|
+
const [selected,setSelected] = React.useState(state === 'selected')
|
|
64
|
+
return <Button data-slot="marketing-control" data-kind="selected-button" aria-pressed={selected} disabled={state === 'disabled'} variant={selected ? 'default' : 'outline'} onClick={() => setSelected(current => !current)} className={cn('h-7 gap-1.5 rounded-md border border-border px-2.5 py-1 font-normal', state === 'hover' && 'bg-muted', selected && 'border-transparent bg-accent-orange/10 text-accent-orange-text hover:bg-accent-orange/20')}>
|
|
65
|
+
{selected ? <CheckCircle2 aria-hidden="true" className="size-3.5" /> : null}{new Intl.NumberFormat(locale).format(800)}
|
|
66
|
+
</Button>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function MenuItem({ state = 'default' }: { state?: MarketingControlState }) {
|
|
70
|
+
const t = useT()
|
|
71
|
+
const [selected,setSelected] = React.useState(state === 'active')
|
|
72
|
+
return <Button data-slot="marketing-control" data-kind="tab-menu" variant="ghost" aria-pressed={selected} onClick={() => setSelected(current => !current)} className={cn('h-9 w-56 max-w-full justify-start gap-2 rounded-lg p-2 text-sm font-medium', (state === 'hover' || selected) && 'bg-muted')}><UserRound aria-hidden="true" className={cn('size-5', selected ? 'text-accent-orange-text' : 'text-muted-foreground')} /><span className="flex-1 text-left">{t(key('accountSettings'))}</span><ChevronRight aria-hidden="true" className="size-4 text-muted-foreground" /></Button>
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function ChartTooltipExample({ side = 'right' }: { side?: 'right' | 'left' | 'bottom' | 'top' }) {
|
|
76
|
+
const t = useT()
|
|
77
|
+
const locale = useLocale()
|
|
78
|
+
const [open,setOpen] = React.useState(true)
|
|
79
|
+
return <div data-slot="marketing-control" data-kind="chart-tooltip" className="flex h-40 w-80 max-w-full items-center justify-center"><TooltipProvider delayDuration={0}><Tooltip open={open} onOpenChange={setOpen}><Button asChild variant="ghost" size="sm"><TooltipTrigger>{t(key('chartPoint'))}</TooltipTrigger></Button><TooltipContent side={side === 'right' ? 'left' : side === 'left' ? 'right' : side === 'bottom' ? 'top' : 'bottom'} variant="light" className="h-16 w-39.5 rounded-lg p-3 shadow-lg"><p className="text-xs leading-4 text-muted-foreground">{new Intl.DateTimeFormat(locale,{weekday:'short',month:'short',day:'numeric',timeZone:'UTC'}).format(new Date('2026-01-08T00:00:00Z'))}</p><div className="mt-1 flex items-center gap-1.5"><span className="text-lg font-medium leading-6">{new Intl.NumberFormat(locale).format(3484)}</span><span className="text-xs text-status-success-icon">+7.1%</span><span className="text-xs text-muted-foreground">{t(key('versusPrevious'))}</span></div></TooltipContent></Tooltip></TooltipProvider></div>
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function MarketingControlDemo(props: ControlProps) {
|
|
83
|
+
if (['input','select','textarea','amount'].includes(props.kind)) return <UnderlineField {...props} />
|
|
84
|
+
if (props.kind === 'inline-input') return <InlineEditor state={props.state} />
|
|
85
|
+
if (props.kind === 'inline-select') return <InlineLanguage state={props.state} />
|
|
86
|
+
if (props.kind === 'step-item') return <StepItem state={props.state} />
|
|
87
|
+
if (props.kind === 'selected-button') return <SelectedAmount state={props.state} />
|
|
88
|
+
if (props.kind === 'tab-menu') return <MenuItem state={props.state} />
|
|
89
|
+
if (props.kind === 'chart-tooltip') return <ChartTooltipExample side={props.side} />
|
|
90
|
+
const product = marketingProducts[props.product ?? 0]
|
|
91
|
+
return <img data-slot="marketing-control" data-kind="product-image" src={product.src} alt={product.name} className="size-50 max-w-full object-contain" />
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
94
|
+
const marketingControlExampleCode = (expression) => source + "\n" + expression + "\n";
|
|
95
|
+
export {
|
|
96
|
+
marketingControlExampleCode
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=marketing-controls-code.generated.js.map
|