@open-mercato/core 0.7.1-develop.7203.1.9396450b78 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/build.mjs +11 -0
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js +23 -0
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/[id]/page.js +2 -1
- package/dist/modules/customers/backend/customers/companies/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js +2 -1
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/[id]/page.js +2 -2
- package/dist/modules/customers/backend/customers/people/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js +2 -1
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/lib/detailHelpers.js +4 -0
- package/dist/modules/customers/lib/detailHelpers.js.map +2 -2
- package/dist/modules/customers/lib/todoCompatibility.js +5 -0
- package/dist/modules/customers/lib/todoCompatibility.js.map +2 -2
- package/dist/modules/design_system/backend/design-system/page.meta.js +3 -2
- package/dist/modules/design_system/backend/design-system/page.meta.js.map +2 -2
- package/dist/modules/design_system/gallery/assets/ai-prompt-image.png +0 -0
- package/dist/modules/design_system/gallery/assets/avatar-illustration.png +0 -0
- package/dist/modules/design_system/gallery/assets/avatar-memoji.png +0 -0
- package/dist/modules/design_system/gallery/assets/avatar-photo.png +0 -0
- package/dist/modules/design_system/gallery/assets/blog-photo-0.png +0 -0
- package/dist/modules/design_system/gallery/assets/contact-support-portrait.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-ada.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-avax.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-bnb.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-brand.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-btc.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-clock.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-crown.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-dot.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-eth.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-hbar.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-history.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-link.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-menu.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-metamask.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-more.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-phantom.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-rewards.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-sad-face.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-sol.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-star.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-status-cancelled.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-status-pending.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-status-success.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-status-warning.svg +3 -0
- package/dist/modules/design_system/gallery/assets/crypto-trx.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-usdc.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-usdt.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-walletconnect.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-wei.png +0 -0
- package/dist/modules/design_system/gallery/assets/crypto-xrp.png +0 -0
- package/dist/modules/design_system/gallery/assets/cryptocurrency-artwork.js +67 -0
- package/dist/modules/design_system/gallery/assets/cryptocurrency-artwork.js.map +7 -0
- package/dist/modules/design_system/gallery/assets/github-logo.png +0 -0
- package/dist/modules/design_system/gallery/assets/images.d.js +1 -0
- package/dist/modules/design_system/gallery/assets/images.d.js.map +7 -0
- package/dist/modules/design_system/gallery/assets/input-european-union.svg +18 -0
- package/dist/modules/design_system/gallery/assets/landing-teams-01.png +0 -0
- package/dist/modules/design_system/gallery/assets/marketing-artwork.js +83 -0
- package/dist/modules/design_system/gallery/assets/marketing-artwork.js.map +7 -0
- package/dist/modules/design_system/gallery/assets/menu-apex.svg +18 -0
- package/dist/modules/design_system/gallery/assets/menu-mastercard.svg +7 -0
- package/dist/modules/design_system/gallery/assets/menu-spotify.svg +4 -0
- package/dist/modules/design_system/gallery/assets/menu-united-states.svg +16 -0
- package/dist/modules/design_system/gallery/assets/select-google.png +0 -0
- package/dist/modules/design_system/gallery/assets/select-poland.png +0 -0
- package/dist/modules/design_system/gallery/assets/selection-artwork.js +5 -0
- package/dist/modules/design_system/gallery/assets/selection-artwork.js.map +7 -0
- package/dist/modules/design_system/gallery/assets/social-apple-filled.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-apple-stroke.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-dropbox-filled.svg +5 -0
- package/dist/modules/design_system/gallery/assets/social-dropbox-stroke.svg +5 -0
- package/dist/modules/design_system/gallery/assets/social-facebook-filled.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-facebook-stroke.svg +10 -0
- package/dist/modules/design_system/gallery/assets/social-github-filled.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-github-stroke.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-google-filled.svg +7 -0
- package/dist/modules/design_system/gallery/assets/social-google-stroke.svg +7 -0
- package/dist/modules/design_system/gallery/assets/social-linkedin-filled.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-linkedin-stroke.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-x-filled.svg +4 -0
- package/dist/modules/design_system/gallery/assets/social-x-stroke.svg +4 -0
- package/dist/modules/design_system/gallery/assets/style-studio-product.png +0 -0
- package/dist/modules/design_system/gallery/assets/upload-images.js +8 -0
- package/dist/modules/design_system/gallery/assets/upload-images.js.map +7 -0
- package/dist/modules/design_system/gallery/components/BrandStylePreview.js +74 -0
- package/dist/modules/design_system/gallery/components/BrandStylePreview.js.map +7 -0
- package/dist/modules/design_system/gallery/components/CodeSnippet.js +31 -31
- package/dist/modules/design_system/gallery/components/CodeSnippet.js.map +2 -2
- package/dist/modules/design_system/gallery/components/ColorPlayground.js +408 -0
- package/dist/modules/design_system/gallery/components/ColorPlayground.js.map +7 -0
- package/dist/modules/design_system/gallery/components/ColorStudioCompositions.js +166 -0
- package/dist/modules/design_system/gallery/components/ColorStudioCompositions.js.map +7 -0
- package/dist/modules/design_system/gallery/components/ColorStudioSpecimen.js +182 -0
- package/dist/modules/design_system/gallery/components/ColorStudioSpecimen.js.map +7 -0
- package/dist/modules/design_system/gallery/components/CompactEntrySpecimen.js +80 -0
- package/dist/modules/design_system/gallery/components/CompactEntrySpecimen.js.map +7 -0
- package/dist/modules/design_system/gallery/components/ComponentIndex.js +42 -0
- package/dist/modules/design_system/gallery/components/ComponentIndex.js.map +7 -0
- package/dist/modules/design_system/gallery/components/DesignSystemHome.js +69 -0
- package/dist/modules/design_system/gallery/components/DesignSystemHome.js.map +7 -0
- package/dist/modules/design_system/gallery/components/EntryCard.js +47 -41
- package/dist/modules/design_system/gallery/components/EntryCard.js.map +2 -2
- package/dist/modules/design_system/gallery/components/EntryHeader.js +68 -0
- package/dist/modules/design_system/gallery/components/EntryHeader.js.map +7 -0
- package/dist/modules/design_system/gallery/components/FamilyEntryPreview.js +19 -0
- package/dist/modules/design_system/gallery/components/FamilyEntryPreview.js.map +7 -0
- package/dist/modules/design_system/gallery/components/FoundationGuide.js +46 -0
- package/dist/modules/design_system/gallery/components/FoundationGuide.js.map +7 -0
- package/dist/modules/design_system/gallery/components/GalleryLink.js +21 -0
- package/dist/modules/design_system/gallery/components/GalleryLink.js.map +7 -0
- package/dist/modules/design_system/gallery/components/GalleryNavigation.js +82 -0
- package/dist/modules/design_system/gallery/components/GalleryNavigation.js.map +7 -0
- package/dist/modules/design_system/gallery/components/GalleryShell.js +147 -67
- package/dist/modules/design_system/gallery/components/GalleryShell.js.map +3 -3
- package/dist/modules/design_system/gallery/components/IconsBrowser.js +33 -0
- package/dist/modules/design_system/gallery/components/IconsBrowser.js.map +7 -0
- package/dist/modules/design_system/gallery/components/SourceLibrary.js +93 -0
- package/dist/modules/design_system/gallery/components/SourceLibrary.js.map +7 -0
- package/dist/modules/design_system/gallery/components/StyleAgents.js +139 -0
- package/dist/modules/design_system/gallery/components/StyleAgents.js.map +7 -0
- package/dist/modules/design_system/gallery/components/ThemeTokenReference.js +101 -0
- package/dist/modules/design_system/gallery/components/ThemeTokenReference.js.map +7 -0
- package/dist/modules/design_system/gallery/components/VariantPreview.js +2 -2
- package/dist/modules/design_system/gallery/components/VariantPreview.js.map +2 -2
- package/dist/modules/design_system/gallery/components/colorPreview.js +58 -0
- package/dist/modules/design_system/gallery/components/colorPreview.js.map +7 -0
- package/dist/modules/design_system/gallery/components/colorStudio.js +218 -0
- package/dist/modules/design_system/gallery/components/colorStudio.js.map +7 -0
- package/dist/modules/design_system/gallery/components/styleAgentBranding.js +46 -0
- package/dist/modules/design_system/gallery/components/styleAgentBranding.js.map +7 -0
- package/dist/modules/design_system/gallery/components/themeTokens.js +32 -0
- package/dist/modules/design_system/gallery/components/themeTokens.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/ai-product-code.generated.js +194 -0
- package/dist/modules/design_system/gallery/demos/ai-product-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/ai-product.js +423 -0
- package/dist/modules/design_system/gallery/demos/ai-product.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/buttons.js +289 -0
- package/dist/modules/design_system/gallery/demos/buttons.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/cryptocurrency.js +1708 -0
- package/dist/modules/design_system/gallery/demos/cryptocurrency.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/feeds-code.generated.js +92 -0
- package/dist/modules/design_system/gallery/demos/feeds-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/feeds.js +148 -0
- package/dist/modules/design_system/gallery/demos/feeds.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/file-upload.js +72 -0
- package/dist/modules/design_system/gallery/demos/file-upload.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/foundation-reference-data.js +4875 -0
- package/dist/modules/design_system/gallery/demos/foundation-reference-data.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/foundation-references.js +188 -0
- package/dist/modules/design_system/gallery/demos/foundation-references.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/key-components-code.generated.js +6 -0
- package/dist/modules/design_system/gallery/demos/key-components-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/key-components.js +127 -0
- package/dist/modules/design_system/gallery/demos/key-components.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/marketing-controls-code.generated.js +98 -0
- package/dist/modules/design_system/gallery/demos/marketing-controls-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/marketing-controls.js +134 -0
- package/dist/modules/design_system/gallery/demos/marketing-controls.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/marketing-widgets-code.generated.js +195 -0
- package/dist/modules/design_system/gallery/demos/marketing-widgets-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/marketing-widgets.js +586 -0
- package/dist/modules/design_system/gallery/demos/marketing-widgets.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/menu-fixtures.js +40 -0
- package/dist/modules/design_system/gallery/demos/menu-fixtures.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/menu-sources.js +295 -0
- package/dist/modules/design_system/gallery/demos/menu-sources.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/menus.js +150 -0
- package/dist/modules/design_system/gallery/demos/menus.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/rating-reviews.js +53 -0
- package/dist/modules/design_system/gallery/demos/rating-reviews.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/registered-icons.js +104 -0
- package/dist/modules/design_system/gallery/demos/registered-icons.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/selection-cards.js +99 -0
- package/dist/modules/design_system/gallery/demos/selection-cards.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/shell-code.generated.js +189 -0
- package/dist/modules/design_system/gallery/demos/shell-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/shell.js +330 -0
- package/dist/modules/design_system/gallery/demos/shell.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/source-artwork.js +120 -0
- package/dist/modules/design_system/gallery/demos/source-artwork.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/source-filters-code.generated.js +125 -0
- package/dist/modules/design_system/gallery/demos/source-filters-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/source-filters.js +185 -0
- package/dist/modules/design_system/gallery/demos/source-filters.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/source-icons.js +69 -0
- package/dist/modules/design_system/gallery/demos/source-icons.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/table-cells-code.generated.js +150 -0
- package/dist/modules/design_system/gallery/demos/table-cells-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/table-cells.js +181 -0
- package/dist/modules/design_system/gallery/demos/table-cells.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/text-inputs.js +113 -0
- package/dist/modules/design_system/gallery/demos/text-inputs.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/time-picker-code.generated.js +41 -0
- package/dist/modules/design_system/gallery/demos/time-picker-code.generated.js.map +7 -0
- package/dist/modules/design_system/gallery/demos/time-picker.js +41 -0
- package/dist/modules/design_system/gallery/demos/time-picker.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/banners.js +123 -60
- package/dist/modules/design_system/gallery/entries/banners.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/buttons-snippets.js +433 -0
- package/dist/modules/design_system/gallery/entries/buttons-snippets.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/buttons.js +127 -148
- package/dist/modules/design_system/gallery/entries/buttons.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/charts.js +532 -186
- package/dist/modules/design_system/gallery/entries/charts.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/dates.js +191 -3
- package/dist/modules/design_system/gallery/entries/dates.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/detail.js +118 -77
- package/dist/modules/design_system/gallery/entries/detail.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/display.js +1449 -240
- package/dist/modules/design_system/gallery/entries/display.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/feedback.js +1058 -132
- package/dist/modules/design_system/gallery/entries/feedback.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/filters.js +231 -103
- package/dist/modules/design_system/gallery/entries/filters.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/foundations.js +368 -57
- package/dist/modules/design_system/gallery/entries/foundations.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/icons.js +29 -91
- package/dist/modules/design_system/gallery/entries/icons.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/inputs-snippets.js +154 -0
- package/dist/modules/design_system/gallery/entries/inputs-snippets.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/inputs.js +2043 -306
- package/dist/modules/design_system/gallery/entries/inputs.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/library.js +20 -0
- package/dist/modules/design_system/gallery/entries/library.js.map +7 -0
- package/dist/modules/design_system/gallery/entries/messages.js +121 -103
- package/dist/modules/design_system/gallery/entries/messages.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/navigation.js +676 -103
- package/dist/modules/design_system/gallery/entries/navigation.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/notifications.js +131 -78
- package/dist/modules/design_system/gallery/entries/notifications.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/overlays.js +611 -203
- package/dist/modules/design_system/gallery/entries/overlays.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/scaffolding.js +1175 -120
- package/dist/modules/design_system/gallery/entries/scaffolding.js.map +2 -2
- package/dist/modules/design_system/gallery/entries/schedule.js +79 -54
- package/dist/modules/design_system/gallery/entries/schedule.js.map +2 -2
- package/dist/modules/design_system/gallery/presentation.js +108 -0
- package/dist/modules/design_system/gallery/presentation.js.map +7 -0
- package/dist/modules/design_system/gallery/registry.js +8 -5
- package/dist/modules/design_system/gallery/registry.js.map +2 -2
- package/dist/modules/design_system/gallery/source-library.generated.js +5 -0
- package/dist/modules/design_system/gallery/source-library.generated.js.map +7 -0
- package/dist/modules/design_system/i18n/de.json +7167 -0
- package/dist/modules/design_system/i18n/en.json +7167 -0
- package/dist/modules/design_system/i18n/es.json +7167 -0
- package/dist/modules/design_system/i18n/ko.json +7167 -0
- package/dist/modules/design_system/i18n/pl.json +7167 -0
- package/dist/modules/push_notifications/lib/queue.js +1 -31
- package/dist/modules/push_notifications/lib/queue.js.map +2 -2
- package/jest.config.cjs +1 -0
- package/jest.mocks/image.js +1 -0
- package/package.json +8 -9
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +50 -0
- package/src/modules/customers/backend/customers/companies/[id]/page.tsx +2 -1
- package/src/modules/customers/backend/customers/companies-v2/[id]/page.tsx +2 -1
- package/src/modules/customers/backend/customers/people/[id]/page.tsx +2 -2
- package/src/modules/customers/backend/customers/people-v2/[id]/page.tsx +2 -1
- package/src/modules/customers/lib/detailHelpers.ts +4 -0
- package/src/modules/customers/lib/todoCompatibility.ts +10 -0
- package/src/modules/design_system/backend/design-system/page.meta.ts +3 -2
- package/src/modules/design_system/gallery/assets/README.md +30 -0
- package/src/modules/design_system/gallery/assets/ai-prompt-image.png +0 -0
- package/src/modules/design_system/gallery/assets/avatar-illustration.png +0 -0
- package/src/modules/design_system/gallery/assets/avatar-memoji.png +0 -0
- package/src/modules/design_system/gallery/assets/avatar-photo.png +0 -0
- package/src/modules/design_system/gallery/assets/blog-photo-0.png +0 -0
- package/src/modules/design_system/gallery/assets/contact-support-portrait.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-ada.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-avax.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-bnb.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-brand.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-btc.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-clock.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-crown.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-dot.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-eth.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-hbar.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-history.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-link.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-menu.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-metamask.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-more.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-phantom.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-rewards.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-sad-face.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-sol.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-star.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-status-cancelled.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-status-pending.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-status-success.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-status-warning.svg +3 -0
- package/src/modules/design_system/gallery/assets/crypto-trx.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-usdc.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-usdt.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-walletconnect.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-wei.png +0 -0
- package/src/modules/design_system/gallery/assets/crypto-xrp.png +0 -0
- package/src/modules/design_system/gallery/assets/cryptocurrency-artwork.ts +63 -0
- package/src/modules/design_system/gallery/assets/github-logo.png +0 -0
- package/src/modules/design_system/gallery/assets/images.d.ts +9 -0
- package/src/modules/design_system/gallery/assets/input-european-union.svg +18 -0
- package/src/modules/design_system/gallery/assets/landing-teams-01.png +0 -0
- package/src/modules/design_system/gallery/assets/marketing-artwork.ts +79 -0
- package/src/modules/design_system/gallery/assets/menu-apex.svg +18 -0
- package/src/modules/design_system/gallery/assets/menu-mastercard.svg +7 -0
- package/src/modules/design_system/gallery/assets/menu-spotify.svg +4 -0
- package/src/modules/design_system/gallery/assets/menu-united-states.svg +16 -0
- package/src/modules/design_system/gallery/assets/select-google.png +0 -0
- package/src/modules/design_system/gallery/assets/select-poland.png +0 -0
- package/src/modules/design_system/gallery/assets/selection-artwork.ts +1 -0
- package/src/modules/design_system/gallery/assets/social-apple-filled.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-apple-stroke.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-dropbox-filled.svg +5 -0
- package/src/modules/design_system/gallery/assets/social-dropbox-stroke.svg +5 -0
- package/src/modules/design_system/gallery/assets/social-facebook-filled.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-facebook-stroke.svg +10 -0
- package/src/modules/design_system/gallery/assets/social-github-filled.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-github-stroke.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-google-filled.svg +7 -0
- package/src/modules/design_system/gallery/assets/social-google-stroke.svg +7 -0
- package/src/modules/design_system/gallery/assets/social-linkedin-filled.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-linkedin-stroke.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-x-filled.svg +4 -0
- package/src/modules/design_system/gallery/assets/social-x-stroke.svg +4 -0
- package/src/modules/design_system/gallery/assets/style-studio-product.png +0 -0
- package/src/modules/design_system/gallery/assets/upload-images.ts +5 -0
- package/src/modules/design_system/gallery/components/BrandStylePreview.tsx +94 -0
- package/src/modules/design_system/gallery/components/CodeSnippet.tsx +34 -34
- package/src/modules/design_system/gallery/components/ColorPlayground.tsx +324 -0
- package/src/modules/design_system/gallery/components/ColorStudioCompositions.tsx +96 -0
- package/src/modules/design_system/gallery/components/ColorStudioSpecimen.tsx +164 -0
- package/src/modules/design_system/gallery/components/CompactEntrySpecimen.tsx +65 -0
- package/src/modules/design_system/gallery/components/ComponentIndex.tsx +47 -0
- package/src/modules/design_system/gallery/components/DesignSystemHome.tsx +66 -0
- package/src/modules/design_system/gallery/components/EntryCard.tsx +52 -37
- package/src/modules/design_system/gallery/components/EntryHeader.tsx +80 -0
- package/src/modules/design_system/gallery/components/FamilyEntryPreview.tsx +22 -0
- package/src/modules/design_system/gallery/components/FoundationGuide.tsx +43 -0
- package/src/modules/design_system/gallery/components/GalleryLink.tsx +19 -0
- package/src/modules/design_system/gallery/components/GalleryNavigation.tsx +86 -0
- package/src/modules/design_system/gallery/components/GalleryShell.tsx +149 -63
- package/src/modules/design_system/gallery/components/IconsBrowser.tsx +40 -0
- package/src/modules/design_system/gallery/components/SourceLibrary.tsx +90 -0
- package/src/modules/design_system/gallery/components/StyleAgents.tsx +115 -0
- package/src/modules/design_system/gallery/components/ThemeTokenReference.tsx +76 -0
- package/src/modules/design_system/gallery/components/VariantPreview.tsx +2 -2
- package/src/modules/design_system/gallery/components/colorPreview.ts +63 -0
- package/src/modules/design_system/gallery/components/colorStudio.ts +260 -0
- package/src/modules/design_system/gallery/components/styleAgentBranding.ts +42 -0
- package/src/modules/design_system/gallery/components/themeTokens.ts +26 -0
- package/src/modules/design_system/gallery/demos/ai-product-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/ai-product.tsx +188 -0
- package/src/modules/design_system/gallery/demos/buttons.tsx +331 -0
- package/src/modules/design_system/gallery/demos/cryptocurrency.tsx +1943 -0
- package/src/modules/design_system/gallery/demos/feeds-code.generated.ts +4 -0
- package/src/modules/design_system/gallery/demos/feeds.tsx +82 -0
- package/src/modules/design_system/gallery/demos/file-upload.tsx +61 -0
- package/src/modules/design_system/gallery/demos/foundation-reference-data.ts +4872 -0
- package/src/modules/design_system/gallery/demos/foundation-references.tsx +140 -0
- package/src/modules/design_system/gallery/demos/key-components-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/key-components.tsx +106 -0
- package/src/modules/design_system/gallery/demos/marketing-controls-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/marketing-controls.tsx +92 -0
- package/src/modules/design_system/gallery/demos/marketing-widgets-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/marketing-widgets.tsx +189 -0
- package/src/modules/design_system/gallery/demos/menu-fixtures.tsx +48 -0
- package/src/modules/design_system/gallery/demos/menu-sources.ts +5 -0
- package/src/modules/design_system/gallery/demos/menus.tsx +122 -0
- package/src/modules/design_system/gallery/demos/rating-reviews.tsx +44 -0
- package/src/modules/design_system/gallery/demos/registered-icons.tsx +117 -0
- package/src/modules/design_system/gallery/demos/selection-cards.tsx +97 -0
- package/src/modules/design_system/gallery/demos/shell-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/shell.tsx +183 -0
- package/src/modules/design_system/gallery/demos/source-artwork.tsx +88 -0
- package/src/modules/design_system/gallery/demos/source-filters-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/source-filters.tsx +119 -0
- package/src/modules/design_system/gallery/demos/source-icons.tsx +62 -0
- package/src/modules/design_system/gallery/demos/table-cells-code.generated.ts +3 -0
- package/src/modules/design_system/gallery/demos/table-cells.tsx +144 -0
- package/src/modules/design_system/gallery/demos/text-inputs.tsx +90 -0
- package/src/modules/design_system/gallery/demos/time-picker-code.generated.ts +5 -0
- package/src/modules/design_system/gallery/demos/time-picker.tsx +31 -0
- package/src/modules/design_system/gallery/entries/banners.tsx +143 -94
- package/src/modules/design_system/gallery/entries/buttons-snippets.ts +432 -0
- package/src/modules/design_system/gallery/entries/buttons.tsx +125 -196
- package/src/modules/design_system/gallery/entries/charts.tsx +545 -233
- package/src/modules/design_system/gallery/entries/dates.tsx +171 -3
- package/src/modules/design_system/gallery/entries/detail.tsx +142 -115
- package/src/modules/design_system/gallery/entries/display.tsx +1691 -319
- package/src/modules/design_system/gallery/entries/feedback.tsx +1082 -169
- package/src/modules/design_system/gallery/entries/filters.tsx +238 -143
- package/src/modules/design_system/gallery/entries/foundations.tsx +404 -61
- package/src/modules/design_system/gallery/entries/icons.tsx +31 -117
- package/src/modules/design_system/gallery/entries/inputs-snippets.ts +156 -0
- package/src/modules/design_system/gallery/entries/inputs.tsx +2146 -503
- package/src/modules/design_system/gallery/entries/library.tsx +16 -0
- package/src/modules/design_system/gallery/entries/messages.tsx +114 -106
- package/src/modules/design_system/gallery/entries/navigation.tsx +782 -192
- package/src/modules/design_system/gallery/entries/notifications.tsx +145 -120
- package/src/modules/design_system/gallery/entries/overlays.tsx +696 -280
- package/src/modules/design_system/gallery/entries/scaffolding.tsx +1192 -158
- package/src/modules/design_system/gallery/entries/schedule.tsx +72 -58
- package/src/modules/design_system/gallery/presentation.ts +106 -0
- package/src/modules/design_system/gallery/registry.ts +8 -6
- package/src/modules/design_system/gallery/source-library.generated.ts +2 -0
- package/src/modules/design_system/i18n/de.json +7112 -3
- package/src/modules/design_system/i18n/en.json +7112 -3
- package/src/modules/design_system/i18n/es.json +7112 -3
- package/src/modules/design_system/i18n/ko.json +7112 -3
- package/src/modules/design_system/i18n/pl.json +7112 -3
- package/src/modules/push_notifications/AGENTS.md +9 -5
- package/src/modules/push_notifications/lib/queue.ts +15 -44
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { Plus } from 'lucide-react'
|
|
5
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
6
|
+
import { Alert, AlertDescription, AlertTitle } from '@open-mercato/ui/primitives/alert'
|
|
7
|
+
import { Banner } from '@open-mercato/ui/primitives/banner'
|
|
8
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
9
|
+
import { CompactButton } from '@open-mercato/ui/primitives/compact-button'
|
|
10
|
+
import { KeyIcon, KeyIconGlyph } from '@open-mercato/ui/primitives/key-icon'
|
|
11
|
+
import { EmptyStateIllustration } from '@open-mercato/ui/primitives/empty-state-illustration'
|
|
12
|
+
|
|
13
|
+
function CompactButtons() {
|
|
14
|
+
const t = useT()
|
|
15
|
+
const [pressed, setPressed] = React.useState<Record<string, boolean>>({})
|
|
16
|
+
return <div className="flex flex-wrap items-center gap-4">
|
|
17
|
+
{(['stroke', 'ghost', 'white', 'modifiable'] as const).map(appearance => <div key={appearance} className={appearance === 'modifiable' ? 'rounded-md bg-primary p-2 text-primary-foreground' : 'p-2'}>
|
|
18
|
+
<CompactButton type="button" appearance={appearance} size={24}
|
|
19
|
+
aria-label={t('design_system.gallery.examples.buttons.compactAction')}
|
|
20
|
+
aria-pressed={pressed[appearance] ?? false}
|
|
21
|
+
onClick={() => setPressed(current => ({ ...current, [appearance]: !current[appearance] }))}>
|
|
22
|
+
<Plus aria-hidden />
|
|
23
|
+
</CompactButton>
|
|
24
|
+
</div>)}
|
|
25
|
+
</div>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function KeyIcons() {
|
|
29
|
+
const t = useT()
|
|
30
|
+
return <div className="flex flex-wrap items-center gap-4">
|
|
31
|
+
{(['gray', 'blue', 'green', 'orange', 'purple'] as const).map((color, index) => <KeyIcon key={color} color={color} size={40} appearance={index < 2 ? 'stroke' : 'lighter'} aria-label={t(`design_system.gallery.examples.keyComponents.color.${color}`)}><KeyIconGlyph /></KeyIcon>)}
|
|
32
|
+
</div>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function AlertSpecimen() {
|
|
36
|
+
const t = useT()
|
|
37
|
+
return <Alert status="information" style="light" size="default" className="w-full">
|
|
38
|
+
<AlertTitle>{t('design_system.gallery.samples.banner.title')}</AlertTitle>
|
|
39
|
+
<AlertDescription>{t('design_system.gallery.samples.banner.description')}</AlertDescription>
|
|
40
|
+
</Alert>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function BannerSpecimen() {
|
|
44
|
+
const t = useT()
|
|
45
|
+
const [dismissed, setDismissed] = React.useState(false)
|
|
46
|
+
const [expanded, setExpanded] = React.useState(false)
|
|
47
|
+
if (dismissed) return <Button variant="outline" size="sm" onClick={() => { setDismissed(false); setExpanded(false) }}>{t('design_system.gallery.samples.banner.restore')}</Button>
|
|
48
|
+
return <div className="w-full space-y-3">
|
|
49
|
+
<Banner status="information" style="lighter" title={t('design_system.gallery.samples.banner.title')}
|
|
50
|
+
onDismiss={() => setDismissed(true)}
|
|
51
|
+
action={<Button variant="link" className="h-auto p-0 text-inherit underline" aria-expanded={expanded} onClick={() => setExpanded(value => !value)}>{t('design_system.gallery.samples.banner.details')}</Button>} />
|
|
52
|
+
{expanded ? <p role="status" className="text-sm text-muted-foreground">{t('design_system.gallery.samples.banner.detailsBody')}</p> : null}
|
|
53
|
+
</div>
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function getCompactEntrySpecimen(entryId: string): React.ReactNode | undefined {
|
|
57
|
+
switch (entryId) {
|
|
58
|
+
case 'compact-button': return <CompactButtons />
|
|
59
|
+
case 'key-icon': return <KeyIcons />
|
|
60
|
+
case 'alert': return <AlertSpecimen />
|
|
61
|
+
case 'banner': return <BannerSpecimen />
|
|
62
|
+
case 'empty-state-illustration': return <EmptyStateIllustration kind="mercato-records" />
|
|
63
|
+
default: return undefined
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { GalleryLink as Link } from './GalleryLink'
|
|
5
|
+
import { ArrowRight } from 'lucide-react'
|
|
6
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
7
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
8
|
+
import { Skeleton } from '@open-mercato/ui/primitives/skeleton'
|
|
9
|
+
import { GALLERY_BASE_PATH } from '../registry'
|
|
10
|
+
import type { GalleryEntry, GalleryFamily } from '../types'
|
|
11
|
+
import { FamilyEntryPreview } from './FamilyEntryPreview'
|
|
12
|
+
|
|
13
|
+
const representativeEntries: Record<string, string> = {
|
|
14
|
+
inputs: 'input',
|
|
15
|
+
dates: 'date-picker',
|
|
16
|
+
filters: 'quick-filters',
|
|
17
|
+
scaffolding: 'section-header',
|
|
18
|
+
notifications: 'notification-item',
|
|
19
|
+
schedule: 'schedule-agenda',
|
|
20
|
+
messages: 'message-object-preview',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function ComponentIndex({ families, loaded, failed, onRetry }: {
|
|
24
|
+
families: GalleryFamily[]
|
|
25
|
+
loaded: Record<string, GalleryEntry[]>
|
|
26
|
+
failed: Record<string, boolean>
|
|
27
|
+
onRetry: (family: GalleryFamily) => void
|
|
28
|
+
}) {
|
|
29
|
+
const t = useT()
|
|
30
|
+
return <div className="columns-1 gap-6 @3xl:columns-2">
|
|
31
|
+
{families.map(family => {
|
|
32
|
+
const entries = loaded[family.id]
|
|
33
|
+
const entry = entries?.find(candidate => candidate.id === representativeEntries[family.id]) ?? entries?.[0]
|
|
34
|
+
return <section key={family.id} aria-labelledby={`gallery-family-${family.id}`} className="relative mb-6 min-w-0 break-inside-avoid rounded-lg border border-border bg-card">
|
|
35
|
+
<h2 id={`gallery-family-${family.id}`} className="text-base font-semibold">
|
|
36
|
+
<Link href={`${GALLERY_BASE_PATH}?family=${family.id}`} className="flex items-center justify-between gap-3 p-5 after:absolute after:inset-0 after:rounded-lg hover:bg-muted/30 focus-visible:outline-none focus-visible:after:shadow-focus">
|
|
37
|
+
<span className="flex items-center gap-3">{family.icon}{t(family.labelKey, family.id)}</span>
|
|
38
|
+
<ArrowRight aria-hidden className="size-4 shrink-0 text-muted-foreground" />
|
|
39
|
+
</Link>
|
|
40
|
+
</h2>
|
|
41
|
+
<div className="min-h-40 border-t border-border bg-muted/20 p-5">
|
|
42
|
+
{entry ? <div inert aria-hidden="true" className="flex min-h-28 min-w-0 flex-wrap items-center gap-3 [&>*]:max-w-full"><FamilyEntryPreview entry={entry} /></div> : failed[family.id] ? <div className="space-y-3"><p className="text-sm text-muted-foreground">{t('design_system.gallery.loadFailed', 'Could not load this family')}</p><Button type="button" variant="outline" size="sm" className="relative z-10" onClick={() => onRetry(family)}>{t('design_system.gallery.retry', 'Retry')}</Button></div> : <Skeleton className="h-28 w-full" />}
|
|
43
|
+
</div>
|
|
44
|
+
</section>
|
|
45
|
+
})}
|
|
46
|
+
</div>
|
|
47
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { GalleryLink as Link } from './GalleryLink'
|
|
5
|
+
import { ArrowRight, Code2, Keyboard, Layers, Palette } from 'lucide-react'
|
|
6
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
7
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
8
|
+
import { GALLERY_BASE_PATH } from '../registry'
|
|
9
|
+
|
|
10
|
+
const paths = {
|
|
11
|
+
foundations: `${GALLERY_BASE_PATH}?family=foundations`,
|
|
12
|
+
components: `${GALLERY_BASE_PATH}?view=components`,
|
|
13
|
+
button: `${GALLERY_BASE_PATH}?family=buttons&entry=button`,
|
|
14
|
+
patterns: `${GALLERY_BASE_PATH}?family=scaffolding`,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const principles = [
|
|
18
|
+
{ id: 'semantics', icon: Palette, href: `${paths.foundations}&entry=color-roles` },
|
|
19
|
+
{ id: 'states', icon: Layers, href: `${GALLERY_BASE_PATH}?family=feedback` },
|
|
20
|
+
{ id: 'keyboard', icon: Keyboard, href: `${GALLERY_BASE_PATH}?family=overlays` },
|
|
21
|
+
{ id: 'handoff', icon: Code2, href: paths.button },
|
|
22
|
+
] as const
|
|
23
|
+
|
|
24
|
+
export function DesignSystemPrinciples() {
|
|
25
|
+
const t = useT()
|
|
26
|
+
return <section className="space-y-8" aria-labelledby="ds-principles-title">
|
|
27
|
+
<div className="max-w-2xl space-y-3">
|
|
28
|
+
<p className="text-xs font-medium uppercase tracking-widest text-muted-foreground">{t('design_system.portal.principles.eyebrow')}</p>
|
|
29
|
+
<h2 id="ds-principles-title" className="text-2xl font-semibold tracking-tight">{t('design_system.portal.principles.title')}</h2>
|
|
30
|
+
<p className="text-base leading-relaxed text-muted-foreground">{t('design_system.portal.principles.description')}</p>
|
|
31
|
+
</div>
|
|
32
|
+
<div className="grid gap-x-8 gap-y-6 sm:grid-cols-2">
|
|
33
|
+
{principles.map(({ id, icon: Icon, href }) => <article key={id} className="space-y-3 border-t border-border py-6">
|
|
34
|
+
<Icon className="size-5 text-muted-foreground" aria-hidden />
|
|
35
|
+
<h3 className="text-lg font-medium">{t(`design_system.portal.principles.${id}.title`)}</h3>
|
|
36
|
+
<p className="max-w-prose text-sm leading-relaxed text-muted-foreground">{t(`design_system.portal.principles.${id}.description`)}</p>
|
|
37
|
+
<Link href={href} className="inline-flex items-center gap-2 rounded-sm text-sm underline underline-offset-4 focus-visible:outline-none focus-visible:shadow-focus">{t('design_system.portal.seeExamples')}<ArrowRight className="size-4" aria-hidden /></Link>
|
|
38
|
+
</article>)}
|
|
39
|
+
</div>
|
|
40
|
+
</section>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function DesignSystemHome() {
|
|
44
|
+
const t = useT()
|
|
45
|
+
return <div className="space-y-12 pb-8" data-example="design-system-home">
|
|
46
|
+
<header id="gallery-page-heading" className="scroll-mt-36 border-b border-border pb-8 lg:scroll-mt-24">
|
|
47
|
+
<div className="max-w-3xl space-y-6">
|
|
48
|
+
<p className="text-xs font-medium uppercase tracking-widest text-muted-foreground">{t('design_system.portal.eyebrow')}</p>
|
|
49
|
+
<h1 className="max-w-2xl text-3xl font-medium leading-tight tracking-tight sm:text-5xl">{t('design_system.portal.title')}</h1>
|
|
50
|
+
<p className="max-w-xl text-base leading-relaxed text-muted-foreground">{t('design_system.portal.description')}</p>
|
|
51
|
+
<div className="flex flex-wrap gap-3">
|
|
52
|
+
<Button asChild size="lg"><Link href={paths.components}>{t('design_system.portal.browse')}<ArrowRight aria-hidden /></Link></Button>
|
|
53
|
+
<Button asChild size="lg" variant="outline"><Link href={paths.foundations}>{t('design_system.portal.start')}</Link></Button>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</header>
|
|
57
|
+
|
|
58
|
+
<section className="space-y-4 rounded-xl border border-border bg-card p-6">
|
|
59
|
+
<Palette className="size-6 text-muted-foreground" aria-hidden />
|
|
60
|
+
<h2 className="text-2xl font-medium">{t('design_system.styleAgents.title')}</h2>
|
|
61
|
+
<p className="max-w-2xl text-sm leading-relaxed text-muted-foreground">{t('design_system.styleAgents.description')}</p>
|
|
62
|
+
<Button asChild variant="outline"><Link href={`${GALLERY_BASE_PATH}?view=style-agents`}>{t('design_system.styleAgents.open')}<ArrowRight aria-hidden /></Link></Button>
|
|
63
|
+
</section>
|
|
64
|
+
|
|
65
|
+
</div>
|
|
66
|
+
}
|
|
@@ -1,43 +1,50 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import * as React from 'react'
|
|
4
|
-
import {
|
|
4
|
+
import { GalleryLink as Link } from './GalleryLink'
|
|
5
|
+
import { ArrowRight, Check, ExternalLink, X } from 'lucide-react'
|
|
5
6
|
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
6
7
|
import { LinkButton } from '@open-mercato/ui/primitives/link-button'
|
|
7
8
|
import type { GalleryEntry } from '../types'
|
|
8
|
-
import { DS_DOCS_URL
|
|
9
|
+
import { DS_DOCS_URL } from '../registry'
|
|
9
10
|
import { VariantPreview } from './VariantPreview'
|
|
10
11
|
import { CodeSnippet } from './CodeSnippet'
|
|
12
|
+
import { FamilyEntryPreview } from './FamilyEntryPreview'
|
|
13
|
+
import { EntryHeader } from './EntryHeader'
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
type EntryCardProps = {
|
|
16
|
+
entry: GalleryEntry
|
|
17
|
+
href?: string
|
|
18
|
+
summary?: boolean
|
|
19
|
+
summaryPreview?: boolean
|
|
20
|
+
onNavigate?: () => void
|
|
21
|
+
hideTitle?: boolean
|
|
22
|
+
fullWidth?: boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function EntryCard({ entry, href, summary = false, summaryPreview = false, onNavigate, hideTitle = false, fullWidth = false }: EntryCardProps) {
|
|
13
26
|
const t = useT()
|
|
27
|
+
const availableVariants = React.useMemo(() => entry.id === 'file-upload' ? entry.variants.filter(variant => variant.id !== 'drag-and-drop') : entry.variants, [entry.id, entry.variants])
|
|
28
|
+
|
|
14
29
|
|
|
15
30
|
return (
|
|
16
31
|
<section
|
|
17
32
|
id={`gallery-entry-${entry.id}`}
|
|
18
|
-
aria-
|
|
19
|
-
|
|
33
|
+
aria-label={hideTitle ? entry.title : undefined}
|
|
34
|
+
aria-labelledby={hideTitle ? undefined : `gallery-entry-${entry.id}-title`}
|
|
35
|
+
className={summary ? `relative min-w-0 rounded-lg border border-border bg-card p-4 sm:p-5 ${summaryPreview ? `flex flex-col gap-4 ${fullWidth ? '@3xl:col-span-2' : ''}` : 'space-y-4'}` : 'min-w-0 space-y-6'}
|
|
20
36
|
>
|
|
21
|
-
<div className="flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between">
|
|
22
|
-
<div className="min-w-0 space-y-1">
|
|
37
|
+
{!hideTitle ? <div className="flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between">
|
|
38
|
+
<div className="min-w-0 flex-1 space-y-1">
|
|
23
39
|
<h3 id={`gallery-entry-${entry.id}-title`} className="text-base font-semibold leading-tight">
|
|
24
|
-
{entry.title}
|
|
40
|
+
{href ? <Link href={href} onNavigate={onNavigate} className="flex items-center justify-between gap-3 rounded-sm after:absolute after:inset-0 after:rounded-lg focus-visible:outline-none focus-visible:after:shadow-focus">{entry.title}{summaryPreview ? <ArrowRight className="size-4 shrink-0 text-muted-foreground" aria-hidden /> : null}</Link> : entry.title}
|
|
25
41
|
</h3>
|
|
26
|
-
{entry.descriptionKey ? (
|
|
42
|
+
{entry.descriptionKey && !summaryPreview ? (
|
|
27
43
|
<p className="text-sm text-muted-foreground">{t(entry.descriptionKey, entry.title)}</p>
|
|
28
44
|
) : null}
|
|
29
|
-
<code className="block truncate text-xs text-muted-foreground">{entry.importPath}</code>
|
|
30
45
|
</div>
|
|
31
|
-
<div className="flex shrink-0 items-center gap-3">
|
|
32
|
-
{entry.
|
|
33
|
-
<LinkButton asChild size="sm">
|
|
34
|
-
<a href={figmaNodeUrl(entry.figmaNodeId)} target="_blank" rel="noreferrer">
|
|
35
|
-
{t('design_system.gallery.openInFigma', 'Open in Figma')}
|
|
36
|
-
<ExternalLink />
|
|
37
|
-
</a>
|
|
38
|
-
</LinkButton>
|
|
39
|
-
) : null}
|
|
40
|
-
{entry.docsAnchor ? (
|
|
46
|
+
<div className="flex shrink-0 flex-wrap items-center gap-3">
|
|
47
|
+
{entry.docsAnchor && !summary ? (
|
|
41
48
|
<LinkButton asChild size="sm" variant="gray">
|
|
42
49
|
<a href={`${DS_DOCS_URL}${entry.docsAnchor}`} target="_blank" rel="noreferrer">
|
|
43
50
|
{t('design_system.gallery.viewDocs', 'View docs')}
|
|
@@ -46,19 +53,35 @@ export function EntryCard({ entry }: { entry: GalleryEntry }) {
|
|
|
46
53
|
</LinkButton>
|
|
47
54
|
) : null}
|
|
48
55
|
</div>
|
|
49
|
-
</div>
|
|
50
|
-
{
|
|
51
|
-
<div className="
|
|
56
|
+
</div> : null}
|
|
57
|
+
{summary && summaryPreview && entry.variants.length ? <div inert aria-hidden="true" className="flex flex-1">
|
|
58
|
+
<div className="flex min-h-32 min-w-0 flex-1 flex-wrap items-center gap-4 rounded-md bg-muted/20 p-4 [&>*]:max-w-full">
|
|
59
|
+
<FamilyEntryPreview entry={entry} />
|
|
60
|
+
</div>
|
|
61
|
+
</div> : null}
|
|
62
|
+
{!summary ? <EntryHeader entry={entry} variants={availableVariants} /> : null}
|
|
63
|
+
{!summary ? <div className="space-y-8">
|
|
64
|
+
{availableVariants.map((variant) => (
|
|
65
|
+
<div key={variant.id} id={`gallery-variant-${entry.id}-${variant.id}`} className="scroll-mt-36 lg:scroll-mt-24 space-y-3">
|
|
66
|
+
{availableVariants.length > 1 ? <h2 className="text-lg font-medium">{t(`design_system.gallery.variantTitles.${variant.title}`, variant.title)}</h2> : null}
|
|
67
|
+
<CodeSnippet code={variant.code} preview={<VariantPreview framed={!fullWidth}>{variant.render()}</VariantPreview>} />
|
|
68
|
+
</div>
|
|
69
|
+
))}
|
|
70
|
+
</div> : null}
|
|
71
|
+
{!summary && entry.usage && (entry.usage.do?.length || entry.usage.dont?.length) ? (
|
|
72
|
+
<section className="rounded-md border border-border">
|
|
73
|
+
<h3 className="p-4 text-sm font-medium">{t('design_system.portal.nav.principles')}</h3>
|
|
74
|
+
<div className="grid gap-4 border-t border-border p-4 sm:grid-cols-2">
|
|
52
75
|
{entry.usage.do?.length ? (
|
|
53
76
|
<div className="space-y-1.5">
|
|
54
77
|
<div className="text-xs font-medium uppercase tracking-wider text-muted-foreground">
|
|
55
78
|
{t('design_system.gallery.usageDo', 'Do')}
|
|
56
79
|
</div>
|
|
57
80
|
<ul className="space-y-1.5">
|
|
58
|
-
{entry.usage.do.map((rule) => (
|
|
81
|
+
{entry.usage.do.map((rule, index) => (
|
|
59
82
|
<li key={rule} className="flex items-start gap-2 text-sm text-foreground">
|
|
60
83
|
<Check aria-hidden className="mt-0.5 size-3.5 shrink-0 text-status-success-icon" />
|
|
61
|
-
<span>{rule}</span>
|
|
84
|
+
<span>{t(`design_system.gallery.usage.${entry.id}.do.${index}`, rule)}</span>
|
|
62
85
|
</li>
|
|
63
86
|
))}
|
|
64
87
|
</ul>
|
|
@@ -70,26 +93,18 @@ export function EntryCard({ entry }: { entry: GalleryEntry }) {
|
|
|
70
93
|
{t('design_system.gallery.usageDont', "Don't")}
|
|
71
94
|
</div>
|
|
72
95
|
<ul className="space-y-1.5">
|
|
73
|
-
{entry.usage.dont.map((rule) => (
|
|
96
|
+
{entry.usage.dont.map((rule, index) => (
|
|
74
97
|
<li key={rule} className="flex items-start gap-2 text-sm text-foreground">
|
|
75
98
|
<X aria-hidden className="mt-0.5 size-3.5 shrink-0 text-status-error-icon" />
|
|
76
|
-
<span>{rule}</span>
|
|
99
|
+
<span>{t(`design_system.gallery.usage.${entry.id}.dont.${index}`, rule)}</span>
|
|
77
100
|
</li>
|
|
78
101
|
))}
|
|
79
102
|
</ul>
|
|
80
103
|
</div>
|
|
81
104
|
) : null}
|
|
82
|
-
</div>
|
|
83
|
-
) : null}
|
|
84
|
-
<div className="space-y-4">
|
|
85
|
-
{entry.variants.map((variant) => (
|
|
86
|
-
<div key={variant.id} className="space-y-2">
|
|
87
|
-
<div className="text-sm font-medium text-foreground">{variant.title}</div>
|
|
88
|
-
<VariantPreview>{variant.render()}</VariantPreview>
|
|
89
|
-
<CodeSnippet code={variant.code} />
|
|
90
105
|
</div>
|
|
91
|
-
|
|
92
|
-
|
|
106
|
+
</section>
|
|
107
|
+
) : null}
|
|
93
108
|
</section>
|
|
94
109
|
)
|
|
95
110
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { Copy, LayoutTemplate } from 'lucide-react'
|
|
5
|
+
import { useSearchParams } from 'next/navigation'
|
|
6
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
7
|
+
import { IconButton } from '@open-mercato/ui/primitives/icon-button'
|
|
8
|
+
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
9
|
+
import type { GalleryEntry, GalleryVariant } from '../types'
|
|
10
|
+
import { GALLERY_BASE_PATH } from '../registry'
|
|
11
|
+
import { GalleryLink as Link } from './GalleryLink'
|
|
12
|
+
import { copyTextToClipboard } from './CodeSnippet'
|
|
13
|
+
|
|
14
|
+
const VARIANT_INDEX_THRESHOLD = 4
|
|
15
|
+
|
|
16
|
+
export function isPatternEntry(entry: GalleryEntry): boolean {
|
|
17
|
+
return entry.importPath.includes('/design_system/gallery/')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function resolveImportStatement(entry: GalleryEntry): string {
|
|
21
|
+
const escapedPath = entry.importPath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
22
|
+
const statement = new RegExp(`import[^;'"]*?from\\s+['"]${escapedPath}['"]`)
|
|
23
|
+
for (const variant of entry.variants) {
|
|
24
|
+
const match = variant.code.match(statement)
|
|
25
|
+
if (match) return match[0].replace(/\s+/g, ' ')
|
|
26
|
+
}
|
|
27
|
+
return entry.importPath
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function EntryHeader({ entry, variants }: { entry: GalleryEntry; variants: GalleryVariant[] }) {
|
|
31
|
+
const t = useT()
|
|
32
|
+
const searchParams = useSearchParams()
|
|
33
|
+
const familyId = searchParams?.get('family') ?? null
|
|
34
|
+
const importStatement = React.useMemo(() => resolveImportStatement(entry), [entry])
|
|
35
|
+
const copyLabel = t('design_system.gallery.copyImport', 'Copy import')
|
|
36
|
+
|
|
37
|
+
const onCopy = React.useCallback(async () => {
|
|
38
|
+
try {
|
|
39
|
+
await copyTextToClipboard(importStatement)
|
|
40
|
+
flash(t('design_system.gallery.importCopied', 'Import copied to clipboard'), 'success')
|
|
41
|
+
} catch {
|
|
42
|
+
flash(t('design_system.gallery.copyFailed', 'Could not copy the snippet'), 'error')
|
|
43
|
+
}
|
|
44
|
+
}, [importStatement, t])
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className="space-y-4" data-testid="gallery-entry-header">
|
|
48
|
+
{isPatternEntry(entry) ? (
|
|
49
|
+
<p className="flex items-start gap-2 rounded-md border border-status-info-border bg-status-info-bg p-3 text-sm text-status-info-text">
|
|
50
|
+
<LayoutTemplate aria-hidden className="mt-0.5 size-4 shrink-0 text-status-info-icon" />
|
|
51
|
+
<span>{t('design_system.gallery.patternNote', 'This is a sample layout composed from library components, not an importable component. Use it as a pattern.')}</span>
|
|
52
|
+
</p>
|
|
53
|
+
) : (
|
|
54
|
+
<div className="flex min-w-0 items-center gap-2 rounded-md border border-border bg-muted/50 py-1 pl-3 pr-1">
|
|
55
|
+
<span className="shrink-0 text-xs font-medium uppercase tracking-wider text-muted-foreground">{t('design_system.gallery.importLabel', 'Import')}</span>
|
|
56
|
+
<code className="min-w-0 flex-1 overflow-x-auto whitespace-nowrap py-1 text-xs">{importStatement}</code>
|
|
57
|
+
<IconButton type="button" variant="ghost" size="sm" aria-label={copyLabel} title={copyLabel} onClick={onCopy}><Copy /></IconButton>
|
|
58
|
+
</div>
|
|
59
|
+
)}
|
|
60
|
+
{variants.length >= VARIANT_INDEX_THRESHOLD ? (
|
|
61
|
+
<nav aria-label={t('design_system.gallery.variantsNav', 'Variants')} className="space-y-2">
|
|
62
|
+
<p className="text-xs font-medium uppercase tracking-wider text-muted-foreground">{t('design_system.gallery.variantsNav', 'Variants')} ({variants.length})</p>
|
|
63
|
+
<ul className="flex flex-wrap gap-x-4 gap-y-1">
|
|
64
|
+
{variants.map((variant) => {
|
|
65
|
+
const label = t(`design_system.gallery.variantTitles.${variant.title}`, variant.title)
|
|
66
|
+
const className = 'rounded-sm text-sm text-muted-foreground underline-offset-4 hover:text-foreground hover:underline focus-visible:outline-none focus-visible:shadow-focus'
|
|
67
|
+
return (
|
|
68
|
+
<li key={variant.id}>
|
|
69
|
+
{familyId
|
|
70
|
+
? <Link href={`${GALLERY_BASE_PATH}?family=${familyId}&entry=${entry.id}&variant=${variant.id}`} className={className}>{label}</Link>
|
|
71
|
+
: <a href={`#gallery-variant-${entry.id}-${variant.id}`} className={className}>{label}</a>}
|
|
72
|
+
</li>
|
|
73
|
+
)
|
|
74
|
+
})}
|
|
75
|
+
</ul>
|
|
76
|
+
</nav>
|
|
77
|
+
) : null}
|
|
78
|
+
</div>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { SourceIcon } from '@open-mercato/ui/assets/source-icons'
|
|
5
|
+
import type { GalleryEntry } from '../types'
|
|
6
|
+
import { representativeVariantIds } from '../presentation'
|
|
7
|
+
import { getCompactEntrySpecimen } from './CompactEntrySpecimen'
|
|
8
|
+
|
|
9
|
+
export function FamilyEntryPreview({ entry }: { entry: GalleryEntry }) {
|
|
10
|
+
const compact = getCompactEntrySpecimen(entry.id)
|
|
11
|
+
if (compact !== undefined) return compact
|
|
12
|
+
|
|
13
|
+
if (entry.id === 'button') return <>{entry.variants.filter(variant => ['default', 'outline', 'ghost'].includes(variant.id)).map(variant => <React.Fragment key={variant.id}>{variant.render()}</React.Fragment>)}</>
|
|
14
|
+
|
|
15
|
+
if (entry.id === 'icon-registry') return <div className="grid grid-cols-4 gap-6">{(['activity', 'arrow-right', 'bell', 'calendar', 'check', 'house', 'plus', 'search'] as const).map(name => <SourceIcon key={name} name={name} aria-hidden="true" className="size-6" />)}</div>
|
|
16
|
+
|
|
17
|
+
const overviewVariant = [representativeVariantIds[entry.id], 'default']
|
|
18
|
+
.map(id => entry.variants.find(variant => variant.id === id))
|
|
19
|
+
.find(Boolean) ?? entry.variants[0]
|
|
20
|
+
if (entry.id === 'table') return <div className="w-full min-w-0 overflow-x-auto">{overviewVariant?.render()}</div>
|
|
21
|
+
return overviewVariant?.render() ?? null
|
|
22
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { GalleryLink as Link } from './GalleryLink'
|
|
5
|
+
import { ArrowRight } from 'lucide-react'
|
|
6
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
7
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
8
|
+
import type { GalleryEntry } from '../types'
|
|
9
|
+
import { CodeSnippet } from './CodeSnippet'
|
|
10
|
+
import { ThemeTokenReference } from './ThemeTokenReference'
|
|
11
|
+
import { GALLERY_BASE_PATH } from '../registry'
|
|
12
|
+
|
|
13
|
+
export function FoundationGuide({ entries }: { entries: GalleryEntry[] }) {
|
|
14
|
+
const t = useT()
|
|
15
|
+
return <div className="space-y-12 pb-12">
|
|
16
|
+
<p className="max-w-2xl text-base leading-relaxed text-muted-foreground">{t('design_system.foundations.intro')}</p>
|
|
17
|
+
{entries.some(entry => entry.id === 'brand-colors' || entry.id === 'color-tokens') ? <div className="flex flex-wrap items-center justify-between gap-4 rounded-lg border border-border bg-muted/30 p-4">
|
|
18
|
+
<p className="max-w-xl text-sm text-muted-foreground">{t('design_system.styleAgents.referenceHint')}</p>
|
|
19
|
+
<Button asChild variant="outline"><Link href={`${GALLERY_BASE_PATH}?view=style-agents`}>{t('design_system.styleAgents.open')}<ArrowRight aria-hidden /></Link></Button>
|
|
20
|
+
</div> : null}
|
|
21
|
+
{entries.map(entry => <section key={entry.id} id={`gallery-entry-${entry.id}`} aria-labelledby={`gallery-entry-${entry.id}-title`} className="min-w-0 scroll-mt-36 lg:scroll-mt-24 space-y-8 border-t border-border pt-8">
|
|
22
|
+
<header className="max-w-2xl space-y-3">
|
|
23
|
+
<h2 id={`gallery-entry-${entry.id}-title`} className="text-2xl font-medium tracking-tight">{t(`design_system.foundations.${entry.id}.title`, entry.title)}</h2>
|
|
24
|
+
<p className="text-base leading-relaxed text-muted-foreground">{t(`design_system.foundations.${entry.id}.description`)}</p>
|
|
25
|
+
</header>
|
|
26
|
+
<CodeSnippet code={entry.variants.map(variant => variant.code).join('\n\n')} preview={<div className="space-y-8">{entry.variants.map(variant => <div key={variant.id} id={`gallery-variant-${entry.id}-${variant.id}`} className="min-w-0 scroll-mt-36 space-y-4 lg:scroll-mt-24">
|
|
27
|
+
{entry.variants.length > 1 && entry.id !== 'typography' ? <h3 className="text-sm font-medium text-muted-foreground">{t(`design_system.foundations.variants.${variant.id}`, variant.title)}</h3> : null}
|
|
28
|
+
<div className="min-w-0 overflow-x-auto py-2">{variant.render()}</div>
|
|
29
|
+
</div>)}
|
|
30
|
+
{entry.id === 'color-tokens' ? <ThemeTokenReference /> : null}
|
|
31
|
+
</div>} />
|
|
32
|
+
{entry.usage ? <section className="rounded-md border border-border">
|
|
33
|
+
<h3 className="p-4 text-sm font-medium">{t('design_system.portal.nav.principles')}</h3>
|
|
34
|
+
<div className="grid gap-6 border-t border-border p-4 sm:grid-cols-2">
|
|
35
|
+
{(['do', 'dont'] as const).map(kind => entry.usage?.[kind]?.length ? <div key={kind} className="space-y-3">
|
|
36
|
+
<h3 className="text-sm font-medium">{t(kind === 'do' ? 'design_system.gallery.usageDo' : 'design_system.gallery.usageDont')}</h3>
|
|
37
|
+
<ul className="list-disc space-y-2 pl-4 text-sm leading-relaxed text-muted-foreground">{entry.usage[kind]?.map((rule, index) => <li key={rule}>{t(`design_system.gallery.usage.${entry.id}.${kind}.${index}`, rule)}</li>)}</ul>
|
|
38
|
+
</div> : null)}
|
|
39
|
+
</div>
|
|
40
|
+
</section> : null}
|
|
41
|
+
</section>)}
|
|
42
|
+
</div>
|
|
43
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import Link from 'next/link'
|
|
5
|
+
import { GALLERY_BASE_PATH } from '../registry'
|
|
6
|
+
|
|
7
|
+
export function navigateGallery(href: string): boolean {
|
|
8
|
+
const target = new URL(href, window.location.href)
|
|
9
|
+
if (target.origin !== window.location.origin || target.pathname !== GALLERY_BASE_PATH || window.location.pathname !== GALLERY_BASE_PATH) return false
|
|
10
|
+
if (target.href !== window.location.href) window.history.pushState(null, '', target.href)
|
|
11
|
+
return true
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function GalleryLink({ onNavigate, ...props }: React.ComponentProps<typeof Link>) {
|
|
15
|
+
return <Link {...props} prefetch={false} onNavigate={event => {
|
|
16
|
+
if (typeof props.href === 'string' && navigateGallery(props.href)) event.preventDefault()
|
|
17
|
+
onNavigate?.(event)
|
|
18
|
+
}} />
|
|
19
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { GalleryLink as Link } from './GalleryLink'
|
|
5
|
+
import { ChevronRight, Menu, X } from 'lucide-react'
|
|
6
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
7
|
+
import { cn } from '@open-mercato/shared/lib/utils'
|
|
8
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
9
|
+
import { IconButton } from '@open-mercato/ui/primitives/icon-button'
|
|
10
|
+
import { Skeleton } from '@open-mercato/ui/primitives/skeleton'
|
|
11
|
+
import type { SectionNavGroup, SectionNavItem } from '@open-mercato/ui/backend/section-page'
|
|
12
|
+
import { useInjectedMenuItems } from '@open-mercato/ui/backend/injection/useInjectedMenuItems'
|
|
13
|
+
import { mergeMenuItems } from '@open-mercato/ui/backend/injection/mergeMenuItems'
|
|
14
|
+
import { resolveInjectedIcon } from '@open-mercato/ui/backend/injection/resolveInjectedIcon'
|
|
15
|
+
|
|
16
|
+
export function GalleryNavigation({ sections, activePath, activeFamilyId, onExpand, onNavigate, failed, onRetry }: {
|
|
17
|
+
sections: SectionNavGroup[]
|
|
18
|
+
activePath: string
|
|
19
|
+
activeFamilyId: string | null
|
|
20
|
+
onExpand: (id: string) => void
|
|
21
|
+
onNavigate: () => void
|
|
22
|
+
failed: Record<string, boolean>
|
|
23
|
+
onRetry: (id: string) => void
|
|
24
|
+
}) {
|
|
25
|
+
const t = useT()
|
|
26
|
+
const prefix = React.useId()
|
|
27
|
+
const [mobileOpen, setMobileOpen] = React.useState(false)
|
|
28
|
+
const [expanded, setExpanded] = React.useState<Record<string, boolean>>({})
|
|
29
|
+
const { items: injectedItems } = useInjectedMenuItems('menu:sidebar:settings:design_system')
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
if (activeFamilyId) setExpanded(previous => ({ ...previous, [activeFamilyId]: true }))
|
|
32
|
+
setMobileOpen(false)
|
|
33
|
+
}, [activeFamilyId, activePath])
|
|
34
|
+
|
|
35
|
+
const navigate = () => { setMobileOpen(false); onNavigate() }
|
|
36
|
+
const itemLabel = (item: SectionNavItem) => t(item.labelKey ?? item.label, item.label)
|
|
37
|
+
const renderLink = (item: SectionNavItem, nested = false) => {
|
|
38
|
+
const active = activePath === item.href
|
|
39
|
+
return <Button asChild variant="ghost" size="sm" className={cn('w-full min-w-0 justify-start gap-2 rounded-md px-3 text-left text-sm font-normal text-muted-foreground', !nested && 'w-0 flex-1', active && 'bg-accent font-semibold text-accent-foreground', nested && 'border-l-2 rounded-l-none', nested && (active ? 'border-foreground' : 'border-transparent'))}>
|
|
40
|
+
<Link href={item.href} aria-current={active ? 'page' : undefined} onClick={navigate}>
|
|
41
|
+
{!nested && item.icon ? <span className="shrink-0" aria-hidden>{item.icon}</span> : null}
|
|
42
|
+
<span className="min-w-0 truncate">{itemLabel(item)}</span>
|
|
43
|
+
</Link>
|
|
44
|
+
</Button>
|
|
45
|
+
}
|
|
46
|
+
const renderItem = (item: SectionNavItem) => {
|
|
47
|
+
const expandable = item.children !== undefined
|
|
48
|
+
const open = expanded[item.id] ?? false
|
|
49
|
+
const label = itemLabel(item)
|
|
50
|
+
const contentId = `${prefix}-${item.id}`
|
|
51
|
+
return <li key={item.id} className="min-w-0">
|
|
52
|
+
<div className="flex min-w-0 items-center gap-1">
|
|
53
|
+
{renderLink(item)}
|
|
54
|
+
{expandable ? <IconButton type="button" variant="ghost" size="sm" className="shrink-0 text-muted-foreground" aria-label={t(open ? 'design_system.gallery.navigation.collapse' : 'design_system.gallery.navigation.expand', { category: label })} aria-expanded={open} aria-controls={contentId} onClick={() => {
|
|
55
|
+
setExpanded(previous => ({ ...previous, [item.id]: !open }))
|
|
56
|
+
if (!open) onExpand(item.id)
|
|
57
|
+
}}><ChevronRight className={cn('size-4 transition-transform', open && 'rotate-90')} /></IconButton> : null}
|
|
58
|
+
</div>
|
|
59
|
+
{expandable && open ? <div id={contentId} className="mb-2 ml-5 mt-1 border-l border-border pl-2">
|
|
60
|
+
{failed[item.id] ? <Button type="button" variant="ghost" size="sm" onClick={() => onRetry(item.id)}>{t('design_system.gallery.retry')}</Button> : item.children?.length ? <ul className="space-y-0.5">{item.children.map(child => <li key={child.id}>{renderLink(child, true)}</li>)}</ul> : <div className="space-y-2 p-2" role="status" aria-label={t('common.loading', 'Loading…')}><Skeleton className="h-5 w-3/4" /><Skeleton className="h-5 w-1/2" /></div>}
|
|
61
|
+
</div> : null}
|
|
62
|
+
</li>
|
|
63
|
+
}
|
|
64
|
+
return <aside className="sticky top-16 z-20 min-w-0 bg-background lg:top-20 lg:w-60 lg:shrink-0 lg:self-start lg:border-r lg:border-border">
|
|
65
|
+
<Button type="button" variant="outline" className="my-2 w-full justify-between lg:hidden" aria-expanded={mobileOpen} aria-controls={`${prefix}-navigation`} onClick={() => setMobileOpen(value => !value)}>
|
|
66
|
+
{t('design_system.gallery.navigation.browse')}{mobileOpen ? <X aria-hidden /> : <Menu aria-hidden />}
|
|
67
|
+
</Button>
|
|
68
|
+
<nav id={`${prefix}-navigation`} aria-label={t('design_system.gallery.navigation.label')} className={cn('max-h-screen overflow-y-auto overscroll-contain py-4 pr-3 pb-24 lg:block', !mobileOpen && 'hidden')}>
|
|
69
|
+
<Link href="/backend/design-system" onClick={navigate} className="mb-5 block px-3 text-base font-semibold tracking-tight">{t('design_system.nav.title')}</Link>
|
|
70
|
+
<div className="space-y-5">{sections.map(section => {
|
|
71
|
+
const additions = injectedItems.filter(item => (item.groupId ?? section.id) === section.id)
|
|
72
|
+
const items = mergeMenuItems(section.items.map(item => ({ id: item.id, item })), additions).flatMap(item => {
|
|
73
|
+
if (item.source === 'built-in') {
|
|
74
|
+
const original = section.items.find(candidate => candidate.id === item.id)
|
|
75
|
+
return original ? [original] : []
|
|
76
|
+
}
|
|
77
|
+
return item.href ? [{ id: item.id, label: item.label ?? item.id, labelKey: item.labelKey, href: item.href, icon: resolveInjectedIcon(item.icon) }] : []
|
|
78
|
+
})
|
|
79
|
+
return <section key={section.id}>
|
|
80
|
+
{section.label ? <p className="mb-2 px-3 text-xs font-medium uppercase tracking-wider text-muted-foreground">{t(section.labelKey ?? section.label, section.label)}</p> : null}
|
|
81
|
+
<ul className="space-y-1">{items.map(item => renderItem(item))}</ul>
|
|
82
|
+
</section>
|
|
83
|
+
})}</div>
|
|
84
|
+
</nav>
|
|
85
|
+
</aside>
|
|
86
|
+
}
|