create-tanqory-theme 0.0.0-stage → 0.2.3
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/LICENSE +21 -0
- package/README.md +55 -2
- package/bin/create-tanqory-theme.mjs +13 -0
- package/lib/agents.mjs +118 -0
- package/lib/create.mjs +245 -0
- package/package.json +39 -4
- package/templates/blank/README.md +13 -0
- package/templates/blank/config/settings.json +3 -0
- package/templates/blank/locales/en.json +22 -0
- package/templates/blank/locales/th.json +22 -0
- package/templates/blank/package.json +34 -0
- package/templates/blank/regions/footer.json +35 -0
- package/templates/blank/regions/header.json +13 -0
- package/templates/blank/scripts/build.mjs +193 -0
- package/templates/blank/scripts/probe.ts +4 -0
- package/templates/blank/src/bundle.ts +15 -0
- package/templates/blank/src/components/parts.tsx +32 -0
- package/templates/blank/src/entry.client.tsx +6 -0
- package/templates/blank/src/entry.server.tsx +13 -0
- package/templates/blank/src/sections/chrome.tsx +132 -0
- package/templates/blank/src/sections/commerce.tsx +242 -0
- package/templates/blank/src/sections/content.tsx +111 -0
- package/templates/blank/src/sections/editorial.tsx +107 -0
- package/templates/blank/src/settings.ts +15 -0
- package/templates/blank/src/styles/theme.css +195 -0
- package/templates/blank/src/templates.ts +14 -0
- package/templates/blank/src/theme.tsx +76 -0
- package/templates/blank/template.json +24 -0
- package/templates/blank/templates/404.json +14 -0
- package/templates/blank/templates/account.json +14 -0
- package/templates/blank/templates/article.json +14 -0
- package/templates/blank/templates/blog.json +14 -0
- package/templates/blank/templates/cart.json +14 -0
- package/templates/blank/templates/collection.json +14 -0
- package/templates/blank/templates/index.json +36 -0
- package/templates/blank/templates/page.contact.json +18 -0
- package/templates/blank/templates/page.json +14 -0
- package/templates/blank/templates/product.json +18 -0
- package/templates/blank/templates/search.json +14 -0
- package/templates/blank/tests/theme.test.ts +49 -0
- package/templates/blank/tsconfig.json +17 -0
- package/templates/blank/vite.client.config.ts +17 -0
- package/templates/blank/vite.probe.config.ts +16 -0
- package/templates/blank/vite.server.config.ts +32 -0
- package/templates/blank/vitest.config.ts +9 -0
- package/templates/common/.claude/settings.json +8 -0
- package/templates/common/.codex/config.toml +4 -0
- package/templates/common/.gemini/settings.json +12 -0
- package/templates/common/.github/workflows/theme-check.yml +44 -0
- package/templates/common/.mcp.json +12 -0
- package/templates/common/.vscode/mcp.json +9 -0
- package/templates/common/_gitignore +9 -0
- package/templates/common/scripts/check.mjs +44 -0
- package/templates/common/scripts/dev.mjs +30 -0
- package/templates/common/tanqory.config.json +6 -0
- package/templates/nova/.gitattributes +3 -0
- package/templates/nova/.tanqory/contracts/LOCK.json +66 -0
- package/templates/nova/.tanqory/contracts/nova-01.json +1092 -0
- package/templates/nova/.tanqory/contracts/nova-12A.json +2674 -0
- package/templates/nova/.tanqory/contracts/nova-12B.json +2285 -0
- package/templates/nova/.tanqory/contracts/nova-12C.json +2848 -0
- package/templates/nova/.tanqory/contracts/nova-12D.json +3039 -0
- package/templates/nova/.tanqory/contracts/nova-12E.json +1473 -0
- package/templates/nova/.tanqory/contracts/nova-12F.json +1670 -0
- package/templates/nova/.tanqory/contracts/nova-12G.json +1661 -0
- package/templates/nova/.tanqory/contracts/nova-13.json +301 -0
- package/templates/nova/.tanqory/contracts/nova-14.json +172 -0
- package/templates/nova/.tanqory/legacy-settings.json +1121 -0
- package/templates/nova/README.md +150 -0
- package/templates/nova/_gitignore +28 -0
- package/templates/nova/assets/ai-tokens.css +6 -0
- package/templates/nova/assets/starter/starter-art-1200x800-0b773ac4.svg +1 -0
- package/templates/nova/assets/starter/starter-art-1200x900-59600290.svg +1 -0
- package/templates/nova/assets/starter/starter-art-1200x900-c549d496.svg +1 -0
- package/templates/nova/assets/starter/starter-art-1600x900-8f979fcb.svg +1 -0
- package/templates/nova/assets/starter/starter-art-2100x900-cbb71bfd.svg +1 -0
- package/templates/nova/config/legacy-settings.json +438 -0
- package/templates/nova/config/promotion-popup.schema.ts +29 -0
- package/templates/nova/config/settings.json +23 -0
- package/templates/nova/config/settings.schema.ts +231 -0
- package/templates/nova/entry.abi.tsx +27 -0
- package/templates/nova/groups/footer.json +39 -0
- package/templates/nova/groups/header.json +11 -0
- package/templates/nova/lib/abi/abi.css +41 -0
- package/templates/nova/lib/bundle-core.ts +35 -0
- package/templates/nova/lib/bundle.client.ts +15 -0
- package/templates/nova/lib/bundle.ts +15 -0
- package/templates/nova/lib/legacy-settings.ts +104 -0
- package/templates/nova/locales/ar.json +590 -0
- package/templates/nova/locales/en.json +590 -0
- package/templates/nova/locales/th.json +590 -0
- package/templates/nova/main.abi.tsx +12 -0
- package/templates/nova/package.json +44 -0
- package/templates/nova/scripts/abi/build.mjs +145 -0
- package/templates/nova/scripts/abi/check-content.mjs +99 -0
- package/templates/nova/scripts/abi/jcs.mjs +27 -0
- package/templates/nova/scripts/abi/local-host.mjs +294 -0
- package/templates/nova/scripts/abi/manifest.mjs +392 -0
- package/templates/nova/scripts/abi/starter-assets.mjs +32 -0
- package/templates/nova/scripts/compiler/checks/check-a11y.mjs +88 -0
- package/templates/nova/scripts/compiler/checks/check-layout-sanity.mjs +169 -0
- package/templates/nova/scripts/compiler/checks/check-page-headings.mjs +67 -0
- package/templates/nova/scripts/compiler/checks/check-product-jsonld.mjs +80 -0
- package/templates/nova/scripts/compiler/checks/theme-spec/check.mjs +88 -0
- package/templates/nova/scripts/compiler/contracts/extract.mjs +188 -0
- package/templates/nova/scripts/compiler/contracts/index.ts +125 -0
- package/templates/nova/scripts/compiler/contracts/validate.ts +347 -0
- package/templates/nova/scripts/compiler/manifest/gen-manifest.mjs +156 -0
- package/templates/nova/scripts/compiler/manifest/manifest-entry.ts +386 -0
- package/templates/nova/scripts/compiler/manifest/manifest-sections.ts +247 -0
- package/templates/nova/scripts/compiler/migrate/migrate-content.mjs +171 -0
- package/templates/nova/scripts/compiler/migrate/migrate-groups.mjs +159 -0
- package/templates/nova/scripts/parity/case-shim.ts +14 -0
- package/templates/nova/scripts/parity/emit.ts +206 -0
- package/templates/nova/scripts/parity/index.html +12 -0
- package/templates/nova/scripts/parity/main.tsx +23 -0
- package/templates/nova/scripts/parity/pages.tsx +123 -0
- package/templates/nova/scripts/parity/vite.config.ts +29 -0
- package/templates/nova/src/components/base/Accordion.css +20 -0
- package/templates/nova/src/components/base/Accordion.tsx +50 -0
- package/templates/nova/src/components/base/Badge.css +17 -0
- package/templates/nova/src/components/base/Badge.tsx +26 -0
- package/templates/nova/src/components/base/Button.css +73 -0
- package/templates/nova/src/components/base/Button.tsx +64 -0
- package/templates/nova/src/components/base/Checkbox.tsx +18 -0
- package/templates/nova/src/components/base/Chip.css +20 -0
- package/templates/nova/src/components/base/Chip.tsx +33 -0
- package/templates/nova/src/components/base/Divider.css +6 -0
- package/templates/nova/src/components/base/Divider.tsx +28 -0
- package/templates/nova/src/components/base/IconButton.css +34 -0
- package/templates/nova/src/components/base/IconButton.tsx +41 -0
- package/templates/nova/src/components/base/Input.css +21 -0
- package/templates/nova/src/components/base/Input.tsx +24 -0
- package/templates/nova/src/components/base/Link.css +15 -0
- package/templates/nova/src/components/base/Link.tsx +23 -0
- package/templates/nova/src/components/base/Radio.tsx +13 -0
- package/templates/nova/src/components/base/Select.css +18 -0
- package/templates/nova/src/components/base/Select.tsx +34 -0
- package/templates/nova/src/components/base/Skeleton.css +17 -0
- package/templates/nova/src/components/base/Skeleton.tsx +23 -0
- package/templates/nova/src/components/base/Spinner.css +13 -0
- package/templates/nova/src/components/base/Spinner.tsx +8 -0
- package/templates/nova/src/components/base/Switch.tsx +16 -0
- package/templates/nova/src/components/base/Tabs.css +24 -0
- package/templates/nova/src/components/base/Tabs.tsx +61 -0
- package/templates/nova/src/components/base/Textarea.css +1 -0
- package/templates/nova/src/components/base/Textarea.tsx +8 -0
- package/templates/nova/src/components/base/choice-props.ts +9 -0
- package/templates/nova/src/components/base/choice.css +69 -0
- package/templates/nova/src/components/commerce/AddToCart.css +4 -0
- package/templates/nova/src/components/commerce/AddToCart.tsx +77 -0
- package/templates/nova/src/components/commerce/CartLine.css +26 -0
- package/templates/nova/src/components/commerce/CartLine.tsx +82 -0
- package/templates/nova/src/components/commerce/CartSummary.css +23 -0
- package/templates/nova/src/components/commerce/CartSummary.tsx +120 -0
- package/templates/nova/src/components/commerce/CollectionCard.css +66 -0
- package/templates/nova/src/components/commerce/CollectionCard.tsx +57 -0
- package/templates/nova/src/components/commerce/ComparisonTable.css +33 -0
- package/templates/nova/src/components/commerce/ComparisonTable.tsx +113 -0
- package/templates/nova/src/components/commerce/EarnHint.css +3 -0
- package/templates/nova/src/components/commerce/EarnHint.tsx +31 -0
- package/templates/nova/src/components/commerce/Hotspot.css +16 -0
- package/templates/nova/src/components/commerce/Hotspot.tsx +64 -0
- package/templates/nova/src/components/commerce/ListingParts.css +79 -0
- package/templates/nova/src/components/commerce/ListingParts.tsx +211 -0
- package/templates/nova/src/components/commerce/LookItem.css +19 -0
- package/templates/nova/src/components/commerce/LookItem.tsx +41 -0
- package/templates/nova/src/components/commerce/MiniCartLine.css +20 -0
- package/templates/nova/src/components/commerce/MiniCartLine.tsx +93 -0
- package/templates/nova/src/components/commerce/PaymentMark.css +2 -0
- package/templates/nova/src/components/commerce/PaymentMark.tsx +55 -0
- package/templates/nova/src/components/commerce/Price.css +27 -0
- package/templates/nova/src/components/commerce/Price.tsx +55 -0
- package/templates/nova/src/components/commerce/ProductCard.css +66 -0
- package/templates/nova/src/components/commerce/ProductCard.tsx +117 -0
- package/templates/nova/src/components/commerce/ProductGallery.css +72 -0
- package/templates/nova/src/components/commerce/ProductGallery.tsx +98 -0
- package/templates/nova/src/components/commerce/QuantitySelector.css +23 -0
- package/templates/nova/src/components/commerce/QuantitySelector.tsx +45 -0
- package/templates/nova/src/components/commerce/Reviews.css +34 -0
- package/templates/nova/src/components/commerce/Reviews.tsx +112 -0
- package/templates/nova/src/components/commerce/Stars.css +7 -0
- package/templates/nova/src/components/commerce/Stars.tsx +38 -0
- package/templates/nova/src/components/commerce/VariantPicker.css +31 -0
- package/templates/nova/src/components/commerce/VariantPicker.tsx +122 -0
- package/templates/nova/src/components/commerce/blocks/Badge.css +6 -0
- package/templates/nova/src/components/commerce/blocks/Badge.tsx +33 -0
- package/templates/nova/src/components/commerce/blocks/PaymentIcons.tsx +43 -0
- package/templates/nova/src/components/commerce/blocks/Swatches.tsx +17 -0
- package/templates/nova/src/components/commerce/blocks/payment.css +2 -0
- package/templates/nova/src/components/commerce/cart-limit.ts +11 -0
- package/templates/nova/src/components/commerce/money.ts +34 -0
- package/templates/nova/src/components/commerce/swatch.ts +54 -0
- package/templates/nova/src/components/content/ArticleCard.css +22 -0
- package/templates/nova/src/components/content/ArticleCard.tsx +53 -0
- package/templates/nova/src/components/content/BeforeAfterSlider.css +38 -0
- package/templates/nova/src/components/content/BeforeAfterSlider.tsx +87 -0
- package/templates/nova/src/components/content/CardRow.css +80 -0
- package/templates/nova/src/components/content/CardRow.tsx +140 -0
- package/templates/nova/src/components/content/CarouselControls.css +61 -0
- package/templates/nova/src/components/content/CarouselControls.tsx +90 -0
- package/templates/nova/src/components/content/ContentsNav.css +16 -0
- package/templates/nova/src/components/content/ContentsNav.tsx +55 -0
- package/templates/nova/src/components/content/Countdown.css +24 -0
- package/templates/nova/src/components/content/Countdown.tsx +115 -0
- package/templates/nova/src/components/content/HeroCopy.css +92 -0
- package/templates/nova/src/components/content/HeroCopy.tsx +148 -0
- package/templates/nova/src/components/content/HeroFrame.css +75 -0
- package/templates/nova/src/components/content/HeroFrame.tsx +49 -0
- package/templates/nova/src/components/content/HeroMedia.css +40 -0
- package/templates/nova/src/components/content/HeroMedia.tsx +170 -0
- package/templates/nova/src/components/content/LongForm.css +40 -0
- package/templates/nova/src/components/content/LongForm.tsx +56 -0
- package/templates/nova/src/components/content/MediaFrame.css +5 -0
- package/templates/nova/src/components/content/MediaFrame.tsx +52 -0
- package/templates/nova/src/components/content/RichText.tsx +30 -0
- package/templates/nova/src/components/content/SectionHead.css +8 -0
- package/templates/nova/src/components/content/SectionHead.tsx +34 -0
- package/templates/nova/src/components/content/ShareButtons.css +2 -0
- package/templates/nova/src/components/content/ShareButtons.tsx +40 -0
- package/templates/nova/src/components/content/StoreCard.css +14 -0
- package/templates/nova/src/components/content/StoreCard.tsx +60 -0
- package/templates/nova/src/components/content/TestimonialCard.css +36 -0
- package/templates/nova/src/components/content/TestimonialCard.tsx +102 -0
- package/templates/nova/src/components/content/UgcTile.css +8 -0
- package/templates/nova/src/components/content/UgcTile.tsx +33 -0
- package/templates/nova/src/components/content/blocks/Button.tsx +36 -0
- package/templates/nova/src/components/content/blocks/Column.tsx +30 -0
- package/templates/nova/src/components/content/blocks/Heading.tsx +31 -0
- package/templates/nova/src/components/content/blocks/Icon.tsx +25 -0
- package/templates/nova/src/components/content/blocks/Image.tsx +42 -0
- package/templates/nova/src/components/content/blocks/Text.tsx +26 -0
- package/templates/nova/src/components/content/blocks/Video.tsx +44 -0
- package/templates/nova/src/components/content/blocks/content.css +25 -0
- package/templates/nova/src/components/content/blocks/shared.ts +5 -0
- package/templates/nova/src/components/forms/ContactForm.css +19 -0
- package/templates/nova/src/components/forms/ContactForm.tsx +139 -0
- package/templates/nova/src/components/forms/FormField.css +15 -0
- package/templates/nova/src/components/forms/FormField.tsx +77 -0
- package/templates/nova/src/components/forms/GatewayFields.tsx +79 -0
- package/templates/nova/src/components/forms/NewsletterForm.css +9 -0
- package/templates/nova/src/components/forms/NewsletterForm.tsx +141 -0
- package/templates/nova/src/components/forms/SearchField.css +7 -0
- package/templates/nova/src/components/forms/SearchField.tsx +68 -0
- package/templates/nova/src/components/forms/blocks/Newsletter.css +5 -0
- package/templates/nova/src/components/forms/blocks/Newsletter.tsx +71 -0
- package/templates/nova/src/components/forms/validate.ts +4 -0
- package/templates/nova/src/components/listing/ProductListing.tsx +200 -0
- package/templates/nova/src/components/navigation/BrandLogo.tsx +35 -0
- package/templates/nova/src/components/navigation/Breadcrumb.css +16 -0
- package/templates/nova/src/components/navigation/Breadcrumb.tsx +59 -0
- package/templates/nova/src/components/navigation/LineAddFriend.css +5 -0
- package/templates/nova/src/components/navigation/LineAddFriend.tsx +42 -0
- package/templates/nova/src/components/navigation/LocaleSelector.css +33 -0
- package/templates/nova/src/components/navigation/LocaleSelector.tsx +64 -0
- package/templates/nova/src/components/navigation/Menu.tsx +26 -0
- package/templates/nova/src/components/navigation/Pagination.css +24 -0
- package/templates/nova/src/components/navigation/Pagination.tsx +74 -0
- package/templates/nova/src/components/navigation/RecoveryLinks.css +8 -0
- package/templates/nova/src/components/navigation/RecoveryLinks.tsx +23 -0
- package/templates/nova/src/components/navigation/SocialLinks.css +5 -0
- package/templates/nova/src/components/navigation/SocialLinks.tsx +51 -0
- package/templates/nova/src/components/navigation/blocks/SocialLinks.tsx +23 -0
- package/templates/nova/src/components/overlays/AccountMenu.css +11 -0
- package/templates/nova/src/components/overlays/AccountMenu.tsx +91 -0
- package/templates/nova/src/components/overlays/CartDrawer.css +17 -0
- package/templates/nova/src/components/overlays/CartDrawer.tsx +118 -0
- package/templates/nova/src/components/overlays/ConfirmationDialog.tsx +49 -0
- package/templates/nova/src/components/overlays/CookieConsent.css +56 -0
- package/templates/nova/src/components/overlays/CookieConsent.tsx +170 -0
- package/templates/nova/src/components/overlays/Drawer.css +38 -0
- package/templates/nova/src/components/overlays/Drawer.tsx +66 -0
- package/templates/nova/src/components/overlays/FriendOfferPanel.tsx +79 -0
- package/templates/nova/src/components/overlays/MarketSelector.css +111 -0
- package/templates/nova/src/components/overlays/MarketSelector.tsx +450 -0
- package/templates/nova/src/components/overlays/Menu.css +9 -0
- package/templates/nova/src/components/overlays/Menu.tsx +124 -0
- package/templates/nova/src/components/overlays/MobileNavDrawer.css +28 -0
- package/templates/nova/src/components/overlays/MobileNavDrawer.tsx +166 -0
- package/templates/nova/src/components/overlays/Modal.css +52 -0
- package/templates/nova/src/components/overlays/Modal.tsx +88 -0
- package/templates/nova/src/components/overlays/Popover.css +4 -0
- package/templates/nova/src/components/overlays/Popover.tsx +115 -0
- package/templates/nova/src/components/overlays/ProductLightbox.css +20 -0
- package/templates/nova/src/components/overlays/ProductLightbox.tsx +70 -0
- package/templates/nova/src/components/overlays/PromoPopup.css +32 -0
- package/templates/nova/src/components/overlays/PromoPopup.tsx +198 -0
- package/templates/nova/src/components/overlays/QuickView.css +31 -0
- package/templates/nova/src/components/overlays/QuickView.tsx +127 -0
- package/templates/nova/src/components/overlays/ReferralPanel.css +16 -0
- package/templates/nova/src/components/overlays/ReferralPanel.tsx +138 -0
- package/templates/nova/src/components/overlays/RewardsLauncher.css +22 -0
- package/templates/nova/src/components/overlays/RewardsLauncher.tsx +270 -0
- package/templates/nova/src/components/overlays/SearchModal.css +48 -0
- package/templates/nova/src/components/overlays/SearchModal.tsx +302 -0
- package/templates/nova/src/components/overlays/Sheet.css +16 -0
- package/templates/nova/src/components/overlays/Sheet.tsx +48 -0
- package/templates/nova/src/components/overlays/SizeGuide.css +8 -0
- package/templates/nova/src/components/overlays/SizeGuide.tsx +74 -0
- package/templates/nova/src/components/overlays/Toast.css +20 -0
- package/templates/nova/src/components/overlays/Toast.tsx +164 -0
- package/templates/nova/src/components/overlays/Tooltip.css +6 -0
- package/templates/nova/src/components/overlays/Tooltip.tsx +59 -0
- package/templates/nova/src/components/overlays/use-dialog.ts +74 -0
- package/templates/nova/src/components/section/shared.css +42 -0
- package/templates/nova/src/components/section/shared.ts +120 -0
- package/templates/nova/src/components/section/shell.tsx +29 -0
- package/templates/nova/src/components/states/Alert.css +10 -0
- package/templates/nova/src/components/states/Alert.tsx +50 -0
- package/templates/nova/src/components/states/EditorFrame.css +31 -0
- package/templates/nova/src/components/states/EditorFrame.tsx +43 -0
- package/templates/nova/src/components/states/MediaState.css +1 -0
- package/templates/nova/src/components/states/MediaState.tsx +49 -0
- package/templates/nova/src/components/states/OfflineNotice.css +4 -0
- package/templates/nova/src/components/states/OfflineNotice.tsx +24 -0
- package/templates/nova/src/components/states/SkeletonLayout.css +22 -0
- package/templates/nova/src/components/states/SkeletonLayout.tsx +104 -0
- package/templates/nova/src/components/states/StateBlock.css +22 -0
- package/templates/nova/src/components/states/StateBlock.tsx +39 -0
- package/templates/nova/src/components/states/media/MediaError.css +6 -0
- package/templates/nova/src/components/states/media/MediaError.tsx +49 -0
- package/templates/nova/src/components/states/media/MediaPlaceholder.css +24 -0
- package/templates/nova/src/components/states/media/MediaPlaceholder.tsx +101 -0
- package/templates/nova/src/components/states/media/placeholder-art.ts +142 -0
- package/templates/nova/src/layouts/Main.tsx +80 -0
- package/templates/nova/src/sections/Account/Account.tsx +109 -0
- package/templates/nova/src/sections/Account/index.ts +22 -0
- package/templates/nova/src/sections/Account/presets.ts +6 -0
- package/templates/nova/src/sections/Account/schema.ts +29 -0
- package/templates/nova/src/sections/AnnouncementBar/AnnouncementBar.css +37 -0
- package/templates/nova/src/sections/AnnouncementBar/AnnouncementBar.tsx +151 -0
- package/templates/nova/src/sections/AnnouncementBar/index.ts +20 -0
- package/templates/nova/src/sections/AnnouncementBar/presets.ts +10 -0
- package/templates/nova/src/sections/AnnouncementBar/schema.ts +26 -0
- package/templates/nova/src/sections/ArticleBody/ArticleBody.tsx +129 -0
- package/templates/nova/src/sections/ArticleBody/index.ts +21 -0
- package/templates/nova/src/sections/ArticleBody/presets.ts +10 -0
- package/templates/nova/src/sections/ArticleBody/schema.ts +40 -0
- package/templates/nova/src/sections/BeforeAfter/BeforeAfter.tsx +47 -0
- package/templates/nova/src/sections/BeforeAfter/blocks/Comparison.tsx +20 -0
- package/templates/nova/src/sections/BeforeAfter/index.ts +28 -0
- package/templates/nova/src/sections/BeforeAfter/presets.ts +10 -0
- package/templates/nova/src/sections/BeforeAfter/schema.ts +34 -0
- package/templates/nova/src/sections/BlogPosts/BlogPosts.tsx +106 -0
- package/templates/nova/src/sections/BlogPosts/index.ts +30 -0
- package/templates/nova/src/sections/BlogPosts/presets.ts +10 -0
- package/templates/nova/src/sections/BlogPosts/schema.ts +42 -0
- package/templates/nova/src/sections/Breadcrumbs/Breadcrumbs.css +10 -0
- package/templates/nova/src/sections/Breadcrumbs/Breadcrumbs.tsx +41 -0
- package/templates/nova/src/sections/Breadcrumbs/index.ts +20 -0
- package/templates/nova/src/sections/Breadcrumbs/presets.ts +6 -0
- package/templates/nova/src/sections/Breadcrumbs/schema.ts +24 -0
- package/templates/nova/src/sections/CartItems/CartItems.tsx +170 -0
- package/templates/nova/src/sections/CartItems/blocks/CartBadge.tsx +14 -0
- package/templates/nova/src/sections/CartItems/index.ts +37 -0
- package/templates/nova/src/sections/CartItems/presets.ts +8 -0
- package/templates/nova/src/sections/CartItems/schema.ts +34 -0
- package/templates/nova/src/sections/CollectionBanner/CollectionBanner.tsx +120 -0
- package/templates/nova/src/sections/CollectionBanner/index.ts +25 -0
- package/templates/nova/src/sections/CollectionBanner/presets.ts +10 -0
- package/templates/nova/src/sections/CollectionBanner/schema.ts +37 -0
- package/templates/nova/src/sections/CollectionLinks/CollectionLinks.tsx +47 -0
- package/templates/nova/src/sections/CollectionLinks/index.ts +20 -0
- package/templates/nova/src/sections/CollectionLinks/presets.ts +8 -0
- package/templates/nova/src/sections/CollectionLinks/schema.ts +33 -0
- package/templates/nova/src/sections/CollectionList/CollectionList.tsx +89 -0
- package/templates/nova/src/sections/CollectionList/blocks/CollectionItem.tsx +25 -0
- package/templates/nova/src/sections/CollectionList/index.ts +33 -0
- package/templates/nova/src/sections/CollectionList/presets.ts +10 -0
- package/templates/nova/src/sections/CollectionList/schema.ts +41 -0
- package/templates/nova/src/sections/ComparisonTable/ComparisonTable.tsx +52 -0
- package/templates/nova/src/sections/ComparisonTable/blocks/CompareItem.tsx +26 -0
- package/templates/nova/src/sections/ComparisonTable/index.ts +31 -0
- package/templates/nova/src/sections/ComparisonTable/presets.ts +8 -0
- package/templates/nova/src/sections/ComparisonTable/schema.ts +31 -0
- package/templates/nova/src/sections/ContactForm/ContactForm.tsx +83 -0
- package/templates/nova/src/sections/ContactForm/blocks/ContactDetail.tsx +13 -0
- package/templates/nova/src/sections/ContactForm/index.ts +29 -0
- package/templates/nova/src/sections/ContactForm/presets.ts +8 -0
- package/templates/nova/src/sections/ContactForm/schema.ts +34 -0
- package/templates/nova/src/sections/Divider/Divider.css +17 -0
- package/templates/nova/src/sections/Divider/Divider.tsx +21 -0
- package/templates/nova/src/sections/Divider/index.ts +20 -0
- package/templates/nova/src/sections/Divider/presets.ts +10 -0
- package/templates/nova/src/sections/Divider/schema.ts +24 -0
- package/templates/nova/src/sections/Faq/Faq.tsx +51 -0
- package/templates/nova/src/sections/Faq/blocks/FaqItem.tsx +13 -0
- package/templates/nova/src/sections/Faq/index.ts +28 -0
- package/templates/nova/src/sections/Faq/presets.ts +8 -0
- package/templates/nova/src/sections/Faq/schema.ts +32 -0
- package/templates/nova/src/sections/FeatureGridBlocks/FeatureGridBlocks.tsx +90 -0
- package/templates/nova/src/sections/FeatureGridBlocks/index.ts +35 -0
- package/templates/nova/src/sections/FeatureGridBlocks/presets.ts +8 -0
- package/templates/nova/src/sections/FeatureGridBlocks/schema.ts +35 -0
- package/templates/nova/src/sections/FeatureHighlights/FeatureHighlights.tsx +56 -0
- package/templates/nova/src/sections/FeatureHighlights/index.ts +20 -0
- package/templates/nova/src/sections/FeatureHighlights/presets.ts +6 -0
- package/templates/nova/src/sections/FeatureHighlights/schema.ts +27 -0
- package/templates/nova/src/sections/FeaturedCollection/FeaturedCollection.tsx +67 -0
- package/templates/nova/src/sections/FeaturedCollection/index.ts +21 -0
- package/templates/nova/src/sections/FeaturedCollection/presets.ts +10 -0
- package/templates/nova/src/sections/FeaturedCollection/schema.ts +39 -0
- package/templates/nova/src/sections/FeaturedProduct/FeaturedProduct.tsx +107 -0
- package/templates/nova/src/sections/FeaturedProduct/index.ts +23 -0
- package/templates/nova/src/sections/FeaturedProduct/presets.ts +8 -0
- package/templates/nova/src/sections/FeaturedProduct/schema.ts +35 -0
- package/templates/nova/src/sections/Footer/Footer.css +81 -0
- package/templates/nova/src/sections/Footer/Footer.tsx +256 -0
- package/templates/nova/src/sections/Footer/blocks/FooterBrand.tsx +40 -0
- package/templates/nova/src/sections/Footer/blocks/FooterLine.tsx +11 -0
- package/templates/nova/src/sections/Footer/blocks/FooterMenu.tsx +14 -0
- package/templates/nova/src/sections/Footer/blocks/FooterText.tsx +8 -0
- package/templates/nova/src/sections/Footer/blocks/footer.css +7 -0
- package/templates/nova/src/sections/Footer/index.ts +38 -0
- package/templates/nova/src/sections/Footer/presets.ts +10 -0
- package/templates/nova/src/sections/Footer/schema.ts +27 -0
- package/templates/nova/src/sections/Group/Group.css +59 -0
- package/templates/nova/src/sections/Group/Group.tsx +167 -0
- package/templates/nova/src/sections/Group/blocks/Accordion.tsx +26 -0
- package/templates/nova/src/sections/Group/blocks/JumboText.tsx +20 -0
- package/templates/nova/src/sections/Group/blocks/Spacer.tsx +16 -0
- package/templates/nova/src/sections/Group/index.ts +36 -0
- package/templates/nova/src/sections/Group/presets.ts +12 -0
- package/templates/nova/src/sections/Group/schema.ts +35 -0
- package/templates/nova/src/sections/Header/Header.css +185 -0
- package/templates/nova/src/sections/Header/Header.tsx +478 -0
- package/templates/nova/src/sections/Header/index.ts +32 -0
- package/templates/nova/src/sections/Header/presets.ts +10 -0
- package/templates/nova/src/sections/Header/schema.ts +32 -0
- package/templates/nova/src/sections/Hero/Hero.tsx +128 -0
- package/templates/nova/src/sections/Hero/index.ts +24 -0
- package/templates/nova/src/sections/Hero/presets.ts +16 -0
- package/templates/nova/src/sections/Hero/schema.ts +56 -0
- package/templates/nova/src/sections/ImageGallery/ImageGallery.tsx +86 -0
- package/templates/nova/src/sections/ImageGallery/index.ts +28 -0
- package/templates/nova/src/sections/ImageGallery/presets.ts +10 -0
- package/templates/nova/src/sections/ImageGallery/schema.ts +34 -0
- package/templates/nova/src/sections/ImageWithText/ImageWithText.tsx +62 -0
- package/templates/nova/src/sections/ImageWithText/index.ts +23 -0
- package/templates/nova/src/sections/ImageWithText/presets.ts +12 -0
- package/templates/nova/src/sections/ImageWithText/schema.ts +45 -0
- package/templates/nova/src/sections/LineAddFriend/LineAddFriend.tsx +25 -0
- package/templates/nova/src/sections/LineAddFriend/index.ts +20 -0
- package/templates/nova/src/sections/LineAddFriend/presets.ts +3 -0
- package/templates/nova/src/sections/LineAddFriend/schema.ts +25 -0
- package/templates/nova/src/sections/LogoList/LogoList.tsx +40 -0
- package/templates/nova/src/sections/LogoList/blocks/Logo.tsx +18 -0
- package/templates/nova/src/sections/LogoList/index.ts +29 -0
- package/templates/nova/src/sections/LogoList/presets.ts +8 -0
- package/templates/nova/src/sections/LogoList/schema.ts +29 -0
- package/templates/nova/src/sections/MainCollection/MainCollection.tsx +51 -0
- package/templates/nova/src/sections/MainCollection/index.ts +26 -0
- package/templates/nova/src/sections/MainCollection/presets.ts +10 -0
- package/templates/nova/src/sections/MainCollection/schema.ts +29 -0
- package/templates/nova/src/sections/Marquee/Marquee.tsx +114 -0
- package/templates/nova/src/sections/Marquee/index.ts +20 -0
- package/templates/nova/src/sections/Marquee/presets.ts +10 -0
- package/templates/nova/src/sections/Marquee/schema.ts +23 -0
- package/templates/nova/src/sections/Multicolumn/Multicolumn.tsx +56 -0
- package/templates/nova/src/sections/Multicolumn/index.ts +25 -0
- package/templates/nova/src/sections/Multicolumn/presets.ts +8 -0
- package/templates/nova/src/sections/Multicolumn/schema.ts +34 -0
- package/templates/nova/src/sections/Newsletter/Newsletter.tsx +64 -0
- package/templates/nova/src/sections/Newsletter/index.ts +20 -0
- package/templates/nova/src/sections/Newsletter/presets.ts +10 -0
- package/templates/nova/src/sections/Newsletter/schema.ts +36 -0
- package/templates/nova/src/sections/NotFound/NotFound.tsx +41 -0
- package/templates/nova/src/sections/NotFound/index.ts +20 -0
- package/templates/nova/src/sections/NotFound/presets.ts +6 -0
- package/templates/nova/src/sections/NotFound/schema.ts +30 -0
- package/templates/nova/src/sections/PageBody/PageBody.tsx +35 -0
- package/templates/nova/src/sections/PageBody/index.ts +21 -0
- package/templates/nova/src/sections/PageBody/presets.ts +6 -0
- package/templates/nova/src/sections/PageBody/schema.ts +29 -0
- package/templates/nova/src/sections/PolicyPage/PolicyPage.tsx +62 -0
- package/templates/nova/src/sections/PolicyPage/index.ts +23 -0
- package/templates/nova/src/sections/PolicyPage/presets.ts +6 -0
- package/templates/nova/src/sections/PolicyPage/schema.ts +27 -0
- package/templates/nova/src/sections/ProductDetails/ProductDetails.tsx +269 -0
- package/templates/nova/src/sections/ProductDetails/blocks/AddToCartBlock.tsx +15 -0
- package/templates/nova/src/sections/ProductDetails/blocks/ProductDescription.tsx +15 -0
- package/templates/nova/src/sections/ProductDetails/blocks/ProductInventory.tsx +38 -0
- package/templates/nova/src/sections/ProductDetails/blocks/ProductPrice.tsx +19 -0
- package/templates/nova/src/sections/ProductDetails/blocks/ProductSku.tsx +15 -0
- package/templates/nova/src/sections/ProductDetails/blocks/ProductTitle.tsx +17 -0
- package/templates/nova/src/sections/ProductDetails/blocks/Quantity.tsx +14 -0
- package/templates/nova/src/sections/ProductDetails/blocks/Tab.tsx +23 -0
- package/templates/nova/src/sections/ProductDetails/blocks/VariantPickerBlock.tsx +44 -0
- package/templates/nova/src/sections/ProductDetails/blocks/commerce-blocks.css +13 -0
- package/templates/nova/src/sections/ProductDetails/index.ts +44 -0
- package/templates/nova/src/sections/ProductDetails/presets.ts +10 -0
- package/templates/nova/src/sections/ProductDetails/schema.ts +44 -0
- package/templates/nova/src/sections/ProductGrid/ProductGrid.tsx +38 -0
- package/templates/nova/src/sections/ProductGrid/index.ts +25 -0
- package/templates/nova/src/sections/ProductGrid/presets.ts +6 -0
- package/templates/nova/src/sections/ProductGrid/schema.ts +37 -0
- package/templates/nova/src/sections/ProductRecommendations/ProductRecommendations.tsx +45 -0
- package/templates/nova/src/sections/ProductRecommendations/index.ts +20 -0
- package/templates/nova/src/sections/ProductRecommendations/presets.ts +8 -0
- package/templates/nova/src/sections/ProductRecommendations/schema.ts +28 -0
- package/templates/nova/src/sections/ProductReviews/ProductReviews.tsx +136 -0
- package/templates/nova/src/sections/ProductReviews/index.ts +22 -0
- package/templates/nova/src/sections/ProductReviews/presets.ts +6 -0
- package/templates/nova/src/sections/ProductReviews/schema.ts +31 -0
- package/templates/nova/src/sections/PromoBanner/PromoBanner.tsx +78 -0
- package/templates/nova/src/sections/PromoBanner/index.ts +20 -0
- package/templates/nova/src/sections/PromoBanner/presets.ts +10 -0
- package/templates/nova/src/sections/PromoBanner/schema.ts +38 -0
- package/templates/nova/src/sections/RecentlyViewed/RecentlyViewed.tsx +53 -0
- package/templates/nova/src/sections/RecentlyViewed/index.ts +20 -0
- package/templates/nova/src/sections/RecentlyViewed/presets.ts +6 -0
- package/templates/nova/src/sections/RecentlyViewed/schema.ts +26 -0
- package/templates/nova/src/sections/RichText/RichText.tsx +38 -0
- package/templates/nova/src/sections/RichText/index.ts +20 -0
- package/templates/nova/src/sections/RichText/presets.ts +10 -0
- package/templates/nova/src/sections/RichText/schema.ts +37 -0
- package/templates/nova/src/sections/SearchResults/SearchResults.tsx +112 -0
- package/templates/nova/src/sections/SearchResults/index.ts +26 -0
- package/templates/nova/src/sections/SearchResults/presets.ts +8 -0
- package/templates/nova/src/sections/SearchResults/schema.ts +30 -0
- package/templates/nova/src/sections/ShopTheLook/ShopTheLook.tsx +112 -0
- package/templates/nova/src/sections/ShopTheLook/blocks/Hotspot.tsx +22 -0
- package/templates/nova/src/sections/ShopTheLook/index.ts +33 -0
- package/templates/nova/src/sections/ShopTheLook/presets.ts +8 -0
- package/templates/nova/src/sections/ShopTheLook/schema.ts +31 -0
- package/templates/nova/src/sections/Slideshow/Slideshow.tsx +199 -0
- package/templates/nova/src/sections/Slideshow/blocks/Slide.tsx +93 -0
- package/templates/nova/src/sections/Slideshow/index.ts +30 -0
- package/templates/nova/src/sections/Slideshow/presets.ts +10 -0
- package/templates/nova/src/sections/Slideshow/schema.ts +36 -0
- package/templates/nova/src/sections/StoreLocator/StoreLocator.tsx +66 -0
- package/templates/nova/src/sections/StoreLocator/index.ts +20 -0
- package/templates/nova/src/sections/StoreLocator/presets.ts +6 -0
- package/templates/nova/src/sections/StoreLocator/schema.ts +34 -0
- package/templates/nova/src/sections/TeamFounders/TeamFounders.tsx +74 -0
- package/templates/nova/src/sections/TeamFounders/blocks/Person.tsx +28 -0
- package/templates/nova/src/sections/TeamFounders/index.ts +28 -0
- package/templates/nova/src/sections/TeamFounders/presets.ts +10 -0
- package/templates/nova/src/sections/TeamFounders/schema.ts +36 -0
- package/templates/nova/src/sections/Testimonials/Testimonials.tsx +83 -0
- package/templates/nova/src/sections/Testimonials/blocks/Testimonial.tsx +30 -0
- package/templates/nova/src/sections/Testimonials/index.ts +29 -0
- package/templates/nova/src/sections/Testimonials/presets.ts +10 -0
- package/templates/nova/src/sections/Testimonials/schema.ts +35 -0
- package/templates/nova/src/sections/Timeline/Timeline.tsx +43 -0
- package/templates/nova/src/sections/Timeline/blocks/Step.tsx +19 -0
- package/templates/nova/src/sections/Timeline/index.ts +28 -0
- package/templates/nova/src/sections/Timeline/presets.ts +8 -0
- package/templates/nova/src/sections/Timeline/schema.ts +31 -0
- package/templates/nova/src/sections/TrustBadges/TrustBadges.tsx +42 -0
- package/templates/nova/src/sections/TrustBadges/index.ts +29 -0
- package/templates/nova/src/sections/TrustBadges/presets.ts +8 -0
- package/templates/nova/src/sections/TrustBadges/schema.ts +29 -0
- package/templates/nova/src/sections/UgcGallery/UgcGallery.tsx +58 -0
- package/templates/nova/src/sections/UgcGallery/blocks/UgcImage.tsx +27 -0
- package/templates/nova/src/sections/UgcGallery/index.ts +31 -0
- package/templates/nova/src/sections/UgcGallery/presets.ts +8 -0
- package/templates/nova/src/sections/UgcGallery/schema.ts +35 -0
- package/templates/nova/src/sections/VideoHero/VideoHero.tsx +75 -0
- package/templates/nova/src/sections/VideoHero/index.ts +22 -0
- package/templates/nova/src/sections/VideoHero/presets.ts +8 -0
- package/templates/nova/src/sections/VideoHero/schema.ts +43 -0
- package/templates/nova/src/sections/data.ts +115 -0
- package/templates/nova/src/sections/shipped-copy.ts +25 -0
- package/templates/nova/src/sections/starter.ts +49 -0
- package/templates/nova/src/styles/Container.css +6 -0
- package/templates/nova/src/styles/Container.tsx +13 -0
- package/templates/nova/src/styles/Icon.css +2 -0
- package/templates/nova/src/styles/Icon.tsx +101 -0
- package/templates/nova/src/styles/NovaProvider.tsx +91 -0
- package/templates/nova/src/styles/base.css +142 -0
- package/templates/nova/src/styles/blocks.css +6 -0
- package/templates/nova/src/styles/fonts/OFL.txt +93 -0
- package/templates/nova/src/styles/fonts/geist-cyrillic-ext.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-cyrillic.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-latin-ext.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-latin.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-mono-cyrillic-ext.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-mono-cyrillic.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-mono-latin-ext.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-mono-latin.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-mono-vietnamese.woff2 +0 -0
- package/templates/nova/src/styles/fonts/geist-vietnamese.woff2 +0 -0
- package/templates/nova/src/styles/fonts.css +95 -0
- package/templates/nova/src/styles/global-settings.css +88 -0
- package/templates/nova/src/styles/index.css +6 -0
- package/templates/nova/src/styles/motion.ts +53 -0
- package/templates/nova/src/styles/scroll.ts +24 -0
- package/templates/nova/src/styles/sections/commerce.css +147 -0
- package/templates/nova/src/styles/sections/content.css +304 -0
- package/templates/nova/src/styles/sections/editorial.css +131 -0
- package/templates/nova/src/styles/sections/promotion.css +336 -0
- package/templates/nova/src/styles/sections/trust.css +117 -0
- package/templates/nova/src/styles/sections/utility.css +190 -0
- package/templates/nova/src/styles/strings.ts +492 -0
- package/templates/nova/src/styles/text.ts +4 -0
- package/templates/nova/src/styles/theme.ts +171 -0
- package/templates/nova/src/styles/tokens.css +600 -0
- package/templates/nova/src/styles/viewport.ts +23 -0
- package/templates/nova/template.json +94 -0
- package/templates/nova/templates/404.json +30 -0
- package/templates/nova/templates/account.json +15 -0
- package/templates/nova/templates/article.json +41 -0
- package/templates/nova/templates/article.longform.json +17 -0
- package/templates/nova/templates/blog.featured.json +22 -0
- package/templates/nova/templates/blog.json +29 -0
- package/templates/nova/templates/cart.json +67 -0
- package/templates/nova/templates/collection.featured.json +43 -0
- package/templates/nova/templates/collection.json +30 -0
- package/templates/nova/templates/contact.json +65 -0
- package/templates/nova/templates/index.json +167 -0
- package/templates/nova/templates/list-collections.json +19 -0
- package/templates/nova/templates/page.about.json +134 -0
- package/templates/nova/templates/page.contact.json +27 -0
- package/templates/nova/templates/page.json +27 -0
- package/templates/nova/templates/policy.json +23 -0
- package/templates/nova/templates/product.bundle.json +145 -0
- package/templates/nova/templates/product.json +119 -0
- package/templates/nova/templates/search.json +17 -0
- package/templates/nova/tests/abi-ai-contract.test.ts +99 -0
- package/templates/nova/tests/abi-forms.test.tsx +269 -0
- package/templates/nova/tests/abi-inventory.test.tsx +197 -0
- package/templates/nova/tests/abi-legacy-settings.test.tsx +105 -0
- package/templates/nova/tests/abi-opt-in.test.tsx +100 -0
- package/templates/nova/tests/abi-parity.test.tsx +95 -0
- package/templates/nova/tests/abi-r5-store-settings.test.tsx +337 -0
- package/templates/nova/tests/abi-render.test.tsx +178 -0
- package/templates/nova/tests/abi-shop-links.test.tsx +141 -0
- package/templates/nova/tests/abi-storefront-basics.test.tsx +233 -0
- package/templates/nova/tests/abi-variant-url.test.tsx +73 -0
- package/templates/nova/tests/add-refused-no-success.test.tsx +193 -0
- package/templates/nova/tests/architecture.test.ts +63 -0
- package/templates/nova/tests/architecture.ts +160 -0
- package/templates/nova/tests/audit-guards.test.ts +31 -0
- package/templates/nova/tests/bundle-split.test.ts +29 -0
- package/templates/nova/tests/cart-limit-message.test.tsx +212 -0
- package/templates/nova/tests/cart-link-message.test.tsx +98 -0
- package/templates/nova/tests/cases/components/Overview.cases.tsx +8 -0
- package/templates/nova/tests/cases/components/base/Accordion.cases.tsx +40 -0
- package/templates/nova/tests/cases/components/base/Badge.cases.tsx +30 -0
- package/templates/nova/tests/cases/components/base/Button.cases.tsx +73 -0
- package/templates/nova/tests/cases/components/base/Checkbox.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/base/Chip.cases.tsx +37 -0
- package/templates/nova/tests/cases/components/base/Divider.cases.tsx +26 -0
- package/templates/nova/tests/cases/components/base/IconButton.cases.tsx +28 -0
- package/templates/nova/tests/cases/components/base/Input.cases.tsx +28 -0
- package/templates/nova/tests/cases/components/base/Link.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/base/Radio.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/base/Select.cases.tsx +26 -0
- package/templates/nova/tests/cases/components/base/Skeleton.cases.tsx +29 -0
- package/templates/nova/tests/cases/components/base/Spinner.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/base/Switch.cases.tsx +26 -0
- package/templates/nova/tests/cases/components/base/Tabs.cases.tsx +39 -0
- package/templates/nova/tests/cases/components/base/Textarea.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/commerce/AddToCart.cases.tsx +36 -0
- package/templates/nova/tests/cases/components/commerce/CartLine.cases.tsx +20 -0
- package/templates/nova/tests/cases/components/commerce/CartSummary.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/commerce/CollectionCard.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/commerce/ComparisonTable.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/commerce/Hotspot.cases.tsx +25 -0
- package/templates/nova/tests/cases/components/commerce/LookItem.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/commerce/PaymentMark.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/commerce/Price.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/commerce/ProductCard.cases.tsx +67 -0
- package/templates/nova/tests/cases/components/commerce/ProductGallery.cases.tsx +39 -0
- package/templates/nova/tests/cases/components/commerce/QuantitySelector.cases.tsx +31 -0
- package/templates/nova/tests/cases/components/commerce/Reviews.cases.tsx +35 -0
- package/templates/nova/tests/cases/components/commerce/Stars.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/commerce/VariantPicker.cases.tsx +38 -0
- package/templates/nova/tests/cases/components/commerce/blocks/Badge.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/commerce/blocks/PaymentIcons.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/commerce/blocks/Swatches.cases.tsx +22 -0
- package/templates/nova/tests/cases/components/content/ArticleCard.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/content/BeforeAfterSlider.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/content/CardRow.cases.tsx +23 -0
- package/templates/nova/tests/cases/components/content/CarouselControls.cases.tsx +48 -0
- package/templates/nova/tests/cases/components/content/ContentsNav.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/content/Countdown.cases.tsx +28 -0
- package/templates/nova/tests/cases/components/content/HeroCopy.cases.tsx +42 -0
- package/templates/nova/tests/cases/components/content/HeroFrame.cases.tsx +22 -0
- package/templates/nova/tests/cases/components/content/HeroMedia.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/content/LongForm.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/content/MediaFrame.cases.tsx +32 -0
- package/templates/nova/tests/cases/components/content/RichText.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/content/SectionHead.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/content/ShareButtons.cases.tsx +24 -0
- package/templates/nova/tests/cases/components/content/StoreCard.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/content/TestimonialCard.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/content/UgcTile.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/content/blocks/Button.cases.tsx +20 -0
- package/templates/nova/tests/cases/components/content/blocks/Column.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/content/blocks/Heading.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/content/blocks/Icon.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/content/blocks/Image.cases.tsx +22 -0
- package/templates/nova/tests/cases/components/content/blocks/Text.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/content/blocks/Video.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/forms/ContactForm.cases.tsx +29 -0
- package/templates/nova/tests/cases/components/forms/FormField.cases.tsx +61 -0
- package/templates/nova/tests/cases/components/forms/NewsletterForm.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/forms/SearchField.cases.tsx +25 -0
- package/templates/nova/tests/cases/components/forms/blocks/Newsletter.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/navigation/BrandLogo.cases.tsx +29 -0
- package/templates/nova/tests/cases/components/navigation/Breadcrumb.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/navigation/LocaleSelector.cases.tsx +32 -0
- package/templates/nova/tests/cases/components/navigation/Menu.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/navigation/Pagination.cases.tsx +25 -0
- package/templates/nova/tests/cases/components/navigation/RecoveryLinks.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/navigation/SocialLinks.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/navigation/blocks/SocialLinks.cases.tsx +17 -0
- package/templates/nova/tests/cases/components/overlays/AccountMenu.cases.tsx +28 -0
- package/templates/nova/tests/cases/components/overlays/CartDrawer.cases.tsx +30 -0
- package/templates/nova/tests/cases/components/overlays/ConfirmationDialog.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/overlays/CookieConsent.cases.tsx +23 -0
- package/templates/nova/tests/cases/components/overlays/CookiePreferences.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/overlays/Drawer.cases.tsx +52 -0
- package/templates/nova/tests/cases/components/overlays/MarketSelector.cases.tsx +82 -0
- package/templates/nova/tests/cases/components/overlays/Menu.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/overlays/MobileNavDrawer.cases.tsx +32 -0
- package/templates/nova/tests/cases/components/overlays/Modal.cases.tsx +71 -0
- package/templates/nova/tests/cases/components/overlays/Popover.cases.tsx +50 -0
- package/templates/nova/tests/cases/components/overlays/PromoPopup.cases.tsx +19 -0
- package/templates/nova/tests/cases/components/overlays/QuickView.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/overlays/SearchModal.cases.tsx +60 -0
- package/templates/nova/tests/cases/components/overlays/Sheet.cases.tsx +32 -0
- package/templates/nova/tests/cases/components/overlays/SizeGuide.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/overlays/Toast.cases.tsx +48 -0
- package/templates/nova/tests/cases/components/overlays/Tooltip.cases.tsx +33 -0
- package/templates/nova/tests/cases/components/states/Alert.cases.tsx +27 -0
- package/templates/nova/tests/cases/components/states/EditorFrame.cases.tsx +36 -0
- package/templates/nova/tests/cases/components/states/Empty.cases.tsx +30 -0
- package/templates/nova/tests/cases/components/states/Error.cases.tsx +38 -0
- package/templates/nova/tests/cases/components/states/Loading.cases.tsx +15 -0
- package/templates/nova/tests/cases/components/states/MediaState.cases.tsx +29 -0
- package/templates/nova/tests/cases/components/states/SkeletonLayout.cases.tsx +20 -0
- package/templates/nova/tests/cases/components/states/Unavailable.cases.tsx +16 -0
- package/templates/nova/tests/cases/components/states/media/MediaError.cases.tsx +18 -0
- package/templates/nova/tests/cases/components/states/media/MediaPlaceholder.cases.tsx +87 -0
- package/templates/nova/tests/cases/sections/Overview.cases.tsx +8 -0
- package/templates/nova/tests/cases/sections/commerce/collection-list/CollectionList.cases.tsx +46 -0
- package/templates/nova/tests/cases/sections/commerce/collection-list/blocks/CollectionItem.cases.tsx +18 -0
- package/templates/nova/tests/cases/sections/commerce/featured-collection/FeaturedCollection.cases.tsx +46 -0
- package/templates/nova/tests/cases/sections/commerce/featured-product/FeaturedProduct.cases.tsx +40 -0
- package/templates/nova/tests/cases/sections/commerce/main-collection/MainCollection.cases.tsx +81 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/ProductDetails.cases.tsx +110 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/AddToCartBlock.cases.tsx +21 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/ProductDescription.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/ProductInventory.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/ProductPrice.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/ProductSku.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/ProductTitle.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/Quantity.cases.tsx +20 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/Tab.cases.tsx +29 -0
- package/templates/nova/tests/cases/sections/commerce/product-details/blocks/VariantPickerBlock.cases.tsx +32 -0
- package/templates/nova/tests/cases/sections/commerce/product-grid/ProductGrid.cases.tsx +48 -0
- package/templates/nova/tests/cases/sections/commerce/product-recommendations/ProductRecommendations.cases.tsx +27 -0
- package/templates/nova/tests/cases/sections/commerce/recently-viewed/RecentlyViewed.cases.tsx +36 -0
- package/templates/nova/tests/cases/sections/content/article-body/ArticleBody.cases.tsx +32 -0
- package/templates/nova/tests/cases/sections/content/before-after/BeforeAfter.cases.tsx +40 -0
- package/templates/nova/tests/cases/sections/content/before-after/blocks/Comparison.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/content/blog-posts/BlogPosts.cases.tsx +47 -0
- package/templates/nova/tests/cases/sections/content/collection-links/CollectionLinks.cases.tsx +36 -0
- package/templates/nova/tests/cases/sections/content/faq/Faq.cases.tsx +38 -0
- package/templates/nova/tests/cases/sections/content/faq/blocks/FaqItem.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/content/feature-grid-blocks/FeatureGridBlocks.cases.tsx +31 -0
- package/templates/nova/tests/cases/sections/content/feature-highlights/FeatureHighlights.cases.tsx +26 -0
- package/templates/nova/tests/cases/sections/content/image-gallery/ImageGallery.cases.tsx +31 -0
- package/templates/nova/tests/cases/sections/content/image-with-text/ImageWithText.cases.tsx +35 -0
- package/templates/nova/tests/cases/sections/content/multicolumn/Multicolumn.cases.tsx +32 -0
- package/templates/nova/tests/cases/sections/content/page-body/PageBody.cases.tsx +31 -0
- package/templates/nova/tests/cases/sections/content/rich-text/RichTextSection.cases.tsx +33 -0
- package/templates/nova/tests/cases/sections/content/team-founders/TeamFounders.cases.tsx +31 -0
- package/templates/nova/tests/cases/sections/content/team-founders/blocks/Person.cases.tsx +18 -0
- package/templates/nova/tests/cases/sections/content/timeline/Timeline.cases.tsx +27 -0
- package/templates/nova/tests/cases/sections/content/timeline/blocks/Step.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/layout/announcement-bar/AnnouncementBar.cases.tsx +119 -0
- package/templates/nova/tests/cases/sections/layout/breadcrumbs/Breadcrumbs.cases.tsx +73 -0
- package/templates/nova/tests/cases/sections/layout/divider/Divider.cases.tsx +81 -0
- package/templates/nova/tests/cases/sections/layout/footer/Footer.cases.tsx +116 -0
- package/templates/nova/tests/cases/sections/layout/footer/blocks/FooterBrand.cases.tsx +27 -0
- package/templates/nova/tests/cases/sections/layout/footer/blocks/FooterMenu.cases.tsx +22 -0
- package/templates/nova/tests/cases/sections/layout/footer/blocks/FooterText.cases.tsx +20 -0
- package/templates/nova/tests/cases/sections/layout/group/Group.cases.tsx +185 -0
- package/templates/nova/tests/cases/sections/layout/group/blocks/Accordion.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/layout/group/blocks/JumboText.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/layout/group/blocks/Spacer.cases.tsx +33 -0
- package/templates/nova/tests/cases/sections/layout/header/Header.cases.tsx +277 -0
- package/templates/nova/tests/cases/sections/marketing/collection-banner/CollectionBanner.cases.tsx +62 -0
- package/templates/nova/tests/cases/sections/marketing/hero/Hero.cases.tsx +138 -0
- package/templates/nova/tests/cases/sections/marketing/marquee/Marquee.cases.tsx +63 -0
- package/templates/nova/tests/cases/sections/marketing/promo-banner/PromoBanner.cases.tsx +87 -0
- package/templates/nova/tests/cases/sections/marketing/slideshow/Slideshow.cases.tsx +113 -0
- package/templates/nova/tests/cases/sections/marketing/slideshow/blocks/Slide.cases.tsx +26 -0
- package/templates/nova/tests/cases/sections/marketing/video-hero/VideoHero.cases.tsx +72 -0
- package/templates/nova/tests/cases/sections/trust/comparison-table/ComparisonTableSection.cases.tsx +42 -0
- package/templates/nova/tests/cases/sections/trust/comparison-table/blocks/CompareItem.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/trust/logo-list/LogoList.cases.tsx +29 -0
- package/templates/nova/tests/cases/sections/trust/logo-list/blocks/Logo.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/trust/product-reviews/ProductReviews.cases.tsx +51 -0
- package/templates/nova/tests/cases/sections/trust/shop-the-look/ShopTheLook.cases.tsx +51 -0
- package/templates/nova/tests/cases/sections/trust/shop-the-look/blocks/Hotspot.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/trust/testimonials/Testimonials.cases.tsx +61 -0
- package/templates/nova/tests/cases/sections/trust/testimonials/blocks/Testimonial.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/trust/trust-badges/TrustBadges.cases.tsx +30 -0
- package/templates/nova/tests/cases/sections/trust/ugc-gallery/UgcGallery.cases.tsx +32 -0
- package/templates/nova/tests/cases/sections/trust/ugc-gallery/blocks/UgcImage.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/utility/account/Account.cases.tsx +44 -0
- package/templates/nova/tests/cases/sections/utility/cart-items/CartItems.cases.tsx +43 -0
- package/templates/nova/tests/cases/sections/utility/cart-items/blocks/CartBadge.cases.tsx +16 -0
- package/templates/nova/tests/cases/sections/utility/contact-form/ContactFormSection.cases.tsx +52 -0
- package/templates/nova/tests/cases/sections/utility/contact-form/blocks/ContactDetail.cases.tsx +17 -0
- package/templates/nova/tests/cases/sections/utility/newsletter/NewsletterSection.cases.tsx +109 -0
- package/templates/nova/tests/cases/sections/utility/not-found/NotFound.cases.tsx +28 -0
- package/templates/nova/tests/cases/sections/utility/policy-page/PolicyPage.cases.tsx +29 -0
- package/templates/nova/tests/cases/sections/utility/search-results/SearchResultsSection.cases.tsx +39 -0
- package/templates/nova/tests/cases/sections/utility/store-locator/StoreLocator.cases.tsx +40 -0
- package/templates/nova/tests/cases/styles/Borders.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/Breakpoints.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/Colors.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/Elevation.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/Icon.cases.tsx +23 -0
- package/templates/nova/tests/cases/styles/Layout.cases.tsx +8 -0
- package/templates/nova/tests/cases/styles/Motion.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/Overview.cases.tsx +8 -0
- package/templates/nova/tests/cases/styles/Radius.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/SharedThemeSettings.cases.tsx +19 -0
- package/templates/nova/tests/cases/styles/Spacing.cases.tsx +10 -0
- package/templates/nova/tests/cases/styles/Typography.cases.tsx +10 -0
- package/templates/nova/tests/cases.test.tsx +38 -0
- package/templates/nova/tests/components/PromoPopup.test.ts +21 -0
- package/templates/nova/tests/components/RichText.test.tsx +65 -0
- package/templates/nova/tests/components/formatDate.test.ts +10 -0
- package/templates/nova/tests/contract-locks.test.ts +23 -0
- package/templates/nova/tests/contracts.test.ts +153 -0
- package/templates/nova/tests/cookie-consent-privacy.test.tsx +128 -0
- package/templates/nova/tests/empty-store.test.tsx +81 -0
- package/templates/nova/tests/fixtures/commerce.ts +128 -0
- package/templates/nova/tests/fixtures/content.ts +58 -0
- package/templates/nova/tests/fixtures/index.ts +8 -0
- package/templates/nova/tests/fixtures/merch.ts +161 -0
- package/templates/nova/tests/fixtures/navigation.ts +125 -0
- package/templates/nova/tests/fixtures/promotion.ts +43 -0
- package/templates/nova/tests/fixtures/sample-store.json +1674 -0
- package/templates/nova/tests/fixtures/shop.ts +88 -0
- package/templates/nova/tests/fixtures/stress.ts +21 -0
- package/templates/nova/tests/inert.test.tsx +285 -0
- package/templates/nova/tests/line-add-friend.test.tsx +108 -0
- package/templates/nova/tests/localized-copy.test.ts +330 -0
- package/templates/nova/tests/product-template-blocks.test.ts +28 -0
- package/templates/nova/tests/rewards-launcher.test.tsx +401 -0
- package/templates/nova/tests/schema.test.ts +65 -0
- package/templates/nova/tests/schema.typetest.ts +7 -0
- package/templates/nova/tests/section-groups.test.ts +189 -0
- package/templates/nova/tests/sections/Group.test.tsx +37 -0
- package/templates/nova/tests/setup.ts +30 -0
- package/templates/nova/tests/starter.test.ts +56 -0
- package/templates/nova/tests/storefront-click-path.test.tsx +157 -0
- package/templates/nova/tests/styles/button-brand.test.ts +24 -0
- package/templates/nova/tests/styles/theme.test.ts +43 -0
- package/templates/nova/tests/styles/tokens.test.ts +35 -0
- package/templates/nova/tests/support/abi-ctx.ts +136 -0
- package/templates/nova/tests/support/block-stories.tsx +13 -0
- package/templates/nova/tests/support/case.tsx +102 -0
- package/templates/nova/tests/support/contracts.ts +30 -0
- package/templates/nova/tests/support/foundation-pages.tsx +260 -0
- package/templates/nova/tests/support/ia-pages.tsx +154 -0
- package/templates/nova/tests/support/listing-demo.tsx +29 -0
- package/templates/nova/tests/support/presets.ts +14 -0
- package/templates/nova/tests/support/sections.ts +36 -0
- package/templates/nova/tests/support/story-content.ts +321 -0
- package/templates/nova/tests/support/story-helpers.tsx +37 -0
- package/templates/nova/tests/support/with-nova.tsx +26 -0
- package/templates/nova/tests/theme-config.test.ts +82 -0
- package/templates/nova/tests/theme-integrity.test.ts +315 -0
- package/templates/nova/theme.config.ts +134 -0
- package/templates/nova/theme.manifest.json +17495 -0
- package/templates/nova/tsconfig.json +19 -0
- package/templates/nova/vite.abi-ssr.config.ts +37 -0
- package/templates/nova/vite.abi.config.ts +26 -0
- package/templates/nova/vitest.config.ts +20 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { sx, sxJoin } from '@tanqory/theme-kit'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import type { Product } from '@tanqory/theme-kit'
|
|
4
|
+
import { Badge, pickBadge } from '../base/Badge'
|
|
5
|
+
import { IconButton } from '../base/IconButton'
|
|
6
|
+
import { Icon } from '../../styles/Icon'
|
|
7
|
+
import { useNova } from '../../styles/NovaProvider'
|
|
8
|
+
import { fmt } from '../../styles/strings'
|
|
9
|
+
import { Price } from './Price'
|
|
10
|
+
import { discountPercent, hasOptions, hasPriceRange } from './money'
|
|
11
|
+
import { isColorOption, swatchColor } from './swatch'
|
|
12
|
+
import './ProductCard.css'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 12C · 00 the ONE product card every product row uses — image-first, no
|
|
16
|
+
* container, title then price.
|
|
17
|
+
*
|
|
18
|
+
* media the global product ratio (1:1 default) or the row's; radius 8;
|
|
19
|
+
* a second image on hover (desktop pointers only)
|
|
20
|
+
* badge top-start, one max: sale −% · New · Sold out · a merchant badge
|
|
21
|
+
* vendor optional, 12 muted · title 14 / 500, two-line clamp (the link
|
|
22
|
+
* keeps the full title) · price (From for ranges)
|
|
23
|
+
* swatches up to 4 colour dots + "+n" (colours inferred from names)
|
|
24
|
+
* quick add product-grid only: adds a single-variant product, opens the
|
|
25
|
+
* variant sheet otherwise (the owner decides — onQuickAdd)
|
|
26
|
+
* Rating stars are not shown anywhere until reviews data exists.
|
|
27
|
+
*/
|
|
28
|
+
export type CardRatio = 'square' | 'portrait' | 'landscape' | 'adapt'
|
|
29
|
+
|
|
30
|
+
export interface ProductCardProps {
|
|
31
|
+
product: Product
|
|
32
|
+
/** Absent = the global product media ratio (--ratio-product). */
|
|
33
|
+
ratio?: CardRatio
|
|
34
|
+
showVendor?: boolean
|
|
35
|
+
showSwatches?: boolean
|
|
36
|
+
/** Recently viewed: 1:1, one-line title, price only. */
|
|
37
|
+
compact?: boolean
|
|
38
|
+
/** Above the fold: load the image eagerly. */
|
|
39
|
+
priority?: boolean
|
|
40
|
+
/** The title element; the row decides the outline (h3 under a section h2). */
|
|
41
|
+
titleAs?: 'h2' | 'h3' | 'h4' | 'p'
|
|
42
|
+
/** Presence turns quick add on. */
|
|
43
|
+
onQuickAdd?: (product: Product) => void
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function ProductCard({ product: p, ratio, showVendor, showSwatches = true, compact, priority, titleAs: T = 'h3', onQuickAdd }: ProductCardProps): JSX.Element {
|
|
47
|
+
const { strings } = useNova()
|
|
48
|
+
const [hover, setHover] = useState(false)
|
|
49
|
+
const image = p.featuredImage ?? p.images[0] ?? null
|
|
50
|
+
const second = p.images.find((i) => i !== image && i.src !== image?.src) ?? null
|
|
51
|
+
const price = p.priceRange.min
|
|
52
|
+
const compareAt = p.compareAtPriceRange?.min ?? null
|
|
53
|
+
const soldOut = !p.available
|
|
54
|
+
const percent = discountPercent(price, compareAt)
|
|
55
|
+
const tone = compact ? null : pickBadge({ soldOut, sale: percent != null, custom: p.badge, isNew: p.tags?.includes('new') })
|
|
56
|
+
const badgeText = tone === 'sale' ? fmt(strings.discountBadge, { percent: percent! }) : tone === 'sold-out' ? strings.soldOut : tone === 'new' ? strings.newBadge : tone === 'custom' ? p.badge : null
|
|
57
|
+
const colours = !compact && showSwatches ? (p.options.find(isColorOption)?.values ?? []) : []
|
|
58
|
+
const aspect = ratio === 'adapt' && image ? `${image.width} / ${image.height}` : undefined
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div className="nv-card" data-compact={compact ? '' : undefined} data-ratio={compact ? 'square' : ratio} data-sold-out={soldOut ? '' : undefined} onPointerEnter={(e) => e.pointerType === 'mouse' && setHover(true)} onPointerLeave={() => setHover(false)}>
|
|
62
|
+
<div className={sxJoin("nv-card__media", sx(aspect ? { aspectRatio: aspect } : undefined))}>
|
|
63
|
+
{image ? (
|
|
64
|
+
<>
|
|
65
|
+
<img className="nv-card__img" src={image.src} srcSet={image.srcSet} sizes="(min-width: 1024px) 25vw, 50vw" alt="" width={image.width} height={image.height} loading={priority ? 'eager' : 'lazy'} decoding="async" />
|
|
66
|
+
{second && !compact && <img className="nv-card__img nv-card__img--alt" data-shown={hover ? '' : undefined} src={second.src} alt="" width={second.width} height={second.height} loading="lazy" decoding="async" />}
|
|
67
|
+
</>
|
|
68
|
+
) : (
|
|
69
|
+
<span className="nv-card__missing">
|
|
70
|
+
<Icon name="image" size="md" />
|
|
71
|
+
<span>{strings.noImage}</span>
|
|
72
|
+
</span>
|
|
73
|
+
)}
|
|
74
|
+
{badgeText && (
|
|
75
|
+
<span className="nv-card__badge">
|
|
76
|
+
<Badge tone={tone!}>{badgeText}</Badge>
|
|
77
|
+
</span>
|
|
78
|
+
)}
|
|
79
|
+
{onQuickAdd && !soldOut && (
|
|
80
|
+
<IconButton
|
|
81
|
+
className="nv-card__quick"
|
|
82
|
+
variant="on-media"
|
|
83
|
+
icon="plus"
|
|
84
|
+
label={fmt(hasOptions(p) ? strings.chooseOptions : strings.quickAdd, { title: p.title })}
|
|
85
|
+
onClick={() => onQuickAdd(p)}
|
|
86
|
+
/>
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
<div className="nv-card__info">
|
|
90
|
+
{showVendor && p.vendor && !compact && <p className="nv-card__vendor"><bdi>{p.vendor}</bdi></p>}
|
|
91
|
+
<T className="nv-card__title">
|
|
92
|
+
<a href={p.url} className="nv-card__link">
|
|
93
|
+
<bdi>{p.title}</bdi>
|
|
94
|
+
</a>
|
|
95
|
+
</T>
|
|
96
|
+
<Price price={price} compareAt={compareAt} from={hasPriceRange(p)} soldOut={soldOut} />
|
|
97
|
+
{colours.length > 1 && (
|
|
98
|
+
<p className="nv-card__swatches">
|
|
99
|
+
{colours.slice(0, 4).map((c) => (
|
|
100
|
+
<span key={c} className={sxJoin("nv-card__dot", sx({ background: swatchColor(c) ?? undefined }))} title={c} aria-hidden />
|
|
101
|
+
))}
|
|
102
|
+
<span className="nv-card__swatch-label">
|
|
103
|
+
{colours.length > 4 ? (
|
|
104
|
+
<>
|
|
105
|
+
<span aria-hidden>+{colours.length - 4}</span>
|
|
106
|
+
<span className="nv-visually-hidden">{fmt(strings.colourCount, { count: colours.length })}</span>
|
|
107
|
+
</>
|
|
108
|
+
) : (
|
|
109
|
+
fmt(strings.colourCount, { count: colours.length })
|
|
110
|
+
)}
|
|
111
|
+
</span>
|
|
112
|
+
</p>
|
|
113
|
+
)}
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* 12C · product gallery. */
|
|
2
|
+
.nv-gallery { --nv-gallery-ratio: 4 / 5; display: grid; gap: var(--space-3); min-width: 0; }
|
|
3
|
+
.nv-gallery[data-ratio='square'] { --nv-gallery-ratio: 1; }
|
|
4
|
+
.nv-gallery[data-layout='thumbnails-left'] { grid-template-columns: var(--pdp-thumb) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
|
|
5
|
+
.nv-gallery[data-layout='thumbnails-left'][data-single] { grid-template-columns: minmax(0, 1fr); }
|
|
6
|
+
.nv-gallery[data-layout='thumbnails-below'] .nv-gallery__thumbs { order: 2; flex-direction: row; }
|
|
7
|
+
.nv-gallery__thumbs { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
|
|
8
|
+
.nv-gallery__thumb {
|
|
9
|
+
flex: none;
|
|
10
|
+
width: var(--pdp-thumb);
|
|
11
|
+
aspect-ratio: var(--nv-gallery-ratio);
|
|
12
|
+
padding: 0;
|
|
13
|
+
border-radius: var(--radius-sm);
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
background: var(--color-media-bg);
|
|
16
|
+
box-shadow: inset 0 0 0 var(--border-width) transparent;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
19
|
+
.nv-gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
|
|
20
|
+
.nv-gallery__thumb[aria-current='true'] { outline: 1.5px solid var(--color-fg); outline-offset: 2px; }
|
|
21
|
+
.nv-gallery__stage { position: relative; min-width: 0; }
|
|
22
|
+
.nv-gallery__strip { display: grid; }
|
|
23
|
+
.nv-gallery__slide { position: relative; grid-area: 1 / 1; margin: 0; aspect-ratio: var(--nv-gallery-ratio); border-radius: var(--radius-media); overflow: hidden; background: var(--color-media-bg); visibility: hidden; }
|
|
24
|
+
.nv-gallery__slide[data-active] { visibility: visible; }
|
|
25
|
+
.nv-gallery__slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
|
|
26
|
+
.nv-gallery__zoom.nv-icon-btn { position: absolute; inset-block-end: var(--space-4); inset-inline-end: var(--space-4); }
|
|
27
|
+
.nv-gallery__badge { position: absolute; z-index: var(--z-raised); inset-block-start: var(--space-4); inset-inline-start: var(--space-4); }
|
|
28
|
+
.nv-gallery__counter { display: none; }
|
|
29
|
+
.nv-gallery__empty {
|
|
30
|
+
display: grid;
|
|
31
|
+
place-items: center;
|
|
32
|
+
aspect-ratio: var(--nv-gallery-ratio);
|
|
33
|
+
padding: var(--space-6);
|
|
34
|
+
border-radius: var(--radius-media);
|
|
35
|
+
background: var(--color-bg-muted);
|
|
36
|
+
color: var(--color-fg-muted);
|
|
37
|
+
font-weight: var(--weight-medium);
|
|
38
|
+
text-align: center;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* stacked: 1 large + a 2-up grid, all visible. */
|
|
42
|
+
.nv-gallery[data-layout='stacked'] .nv-gallery__strip { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
|
|
43
|
+
.nv-gallery[data-layout='stacked'] .nv-gallery__slide { grid-area: auto; visibility: visible; }
|
|
44
|
+
.nv-gallery[data-layout='stacked'] .nv-gallery__slide:first-child { grid-column: 1 / -1; }
|
|
45
|
+
|
|
46
|
+
/* < 1024: every layout is a swipe strip with a counter; no thumbnails. */
|
|
47
|
+
@media (max-width: 1023.98px) {
|
|
48
|
+
.nv-gallery, .nv-gallery[data-layout] { grid-template-columns: minmax(0, 1fr); }
|
|
49
|
+
.nv-gallery__thumbs { display: none; }
|
|
50
|
+
.nv-gallery .nv-gallery__strip, .nv-gallery[data-layout='stacked'] .nv-gallery__strip {
|
|
51
|
+
display: flex;
|
|
52
|
+
gap: 0;
|
|
53
|
+
overflow-x: auto;
|
|
54
|
+
scroll-snap-type: x mandatory;
|
|
55
|
+
scrollbar-width: none;
|
|
56
|
+
border-radius: var(--radius-media);
|
|
57
|
+
}
|
|
58
|
+
.nv-gallery__strip::-webkit-scrollbar { display: none; }
|
|
59
|
+
.nv-gallery .nv-gallery__slide { flex: 0 0 100%; visibility: visible; scroll-snap-align: start; border-radius: 0; }
|
|
60
|
+
.nv-gallery__counter {
|
|
61
|
+
display: block;
|
|
62
|
+
position: absolute;
|
|
63
|
+
inset-block-end: var(--space-3);
|
|
64
|
+
inset-inline-end: var(--space-3);
|
|
65
|
+
padding: var(--space-1) var(--space-2);
|
|
66
|
+
border-radius: var(--radius-pill);
|
|
67
|
+
background: var(--color-bg);
|
|
68
|
+
font-size: var(--type-label);
|
|
69
|
+
font-weight: var(--weight-medium);
|
|
70
|
+
}
|
|
71
|
+
.nv-gallery__zoom.nv-icon-btn { display: none; }
|
|
72
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { sx, sxJoin } from '@tanqory/theme-kit'
|
|
2
|
+
import { useEffect, useRef, type CSSProperties, type ReactNode } from 'react'
|
|
3
|
+
import { useScrollRegion } from '../../styles/scroll'
|
|
4
|
+
import type { NovaImage } from '@tanqory/theme-kit'
|
|
5
|
+
import { IconButton } from '../base/IconButton'
|
|
6
|
+
import { useNova } from '../../styles/NovaProvider'
|
|
7
|
+
import { fmt } from '../../styles/strings'
|
|
8
|
+
import './ProductGallery.css'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 12C · product-details gallery.
|
|
12
|
+
*
|
|
13
|
+
* thumbnails-left a 64 thumbnail column beside the main image (default)
|
|
14
|
+
* thumbnails-below a thumbnail row under it (best for 2–5 images)
|
|
15
|
+
* stacked 1 large + a 2-up grid, scrolling beside the sticky buy box
|
|
16
|
+
* < 1024 every layout is a swipe strip with a "1 / 6" counter
|
|
17
|
+
* one image → no thumbnails, counter or dots · none → a neutral tile with
|
|
18
|
+
* the product name, no zoom (the editor asks for images)
|
|
19
|
+
* Zoom opens the owner's lightbox (onZoom). Controlled: the owner keeps index.
|
|
20
|
+
*/
|
|
21
|
+
export interface ProductGalleryProps {
|
|
22
|
+
images: NovaImage[]
|
|
23
|
+
/** The product name, for the no-image tile and image labels. */
|
|
24
|
+
title: string
|
|
25
|
+
layout?: 'thumbnails-left' | 'thumbnails-below' | 'stacked'
|
|
26
|
+
ratio?: 'adapt' | 'portrait' | 'square'
|
|
27
|
+
index: number
|
|
28
|
+
onIndex: (index: number) => void
|
|
29
|
+
/** Presence turns zoom on. */
|
|
30
|
+
onZoom?: (index: number) => void
|
|
31
|
+
/** Overlay top-start (the sale badge). */
|
|
32
|
+
badge?: ReactNode
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function ProductGallery({ images, title, layout = 'thumbnails-left', ratio = 'portrait', index, onIndex, onZoom, badge }: ProductGalleryProps): JSX.Element {
|
|
36
|
+
const { strings } = useNova()
|
|
37
|
+
const strip = useRef<HTMLDivElement>(null)
|
|
38
|
+
const count = images.length
|
|
39
|
+
// The swipe strip (< 1024) is a keyboard-scrollable region only while it scrolls.
|
|
40
|
+
const region = useScrollRegion(strip, strings.productImages, [count])
|
|
41
|
+
const aspect = ratio === 'adapt' && images[0] ? `${images[0].width} / ${images[0].height}` : undefined
|
|
42
|
+
|
|
43
|
+
// Keep the swipe strip on the chosen image (thumbnail click, variant change).
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const el = strip.current
|
|
46
|
+
const slide = el?.children[index] as HTMLElement | undefined
|
|
47
|
+
if (el && slide && Math.abs(el.scrollLeft - slide.offsetLeft) > 2 && getComputedStyle(el).overflowX !== 'visible') el.scrollTo({ left: slide.offsetLeft, behavior: 'smooth' })
|
|
48
|
+
}, [index])
|
|
49
|
+
|
|
50
|
+
if (!count) {
|
|
51
|
+
return (
|
|
52
|
+
<div className="nv-gallery" data-layout="empty" data-ratio={ratio}>
|
|
53
|
+
<div className="nv-gallery__empty">
|
|
54
|
+
<span><bdi>{title}</bdi></span>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const onScroll = () => {
|
|
61
|
+
const el = strip.current
|
|
62
|
+
if (!el || getComputedStyle(el).overflowX === 'visible') return
|
|
63
|
+
const i = Math.round(Math.abs(el.scrollLeft) / el.clientWidth)
|
|
64
|
+
if (i !== index && i < count) onIndex(i)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div className={sxJoin("nv-gallery", sx(aspect ? ({ '--nv-gallery-ratio': aspect } as CSSProperties) : undefined))} data-layout={layout} data-ratio={ratio} data-single={count === 1 ? '' : undefined}>
|
|
69
|
+
{count > 1 && layout !== 'stacked' && (
|
|
70
|
+
<div className="nv-gallery__thumbs" role="group" aria-label={strings.productImages}>
|
|
71
|
+
{images.map((img, i) => (
|
|
72
|
+
<button key={img.src + i} type="button" className="nv-gallery__thumb" aria-current={i === index ? 'true' : undefined} aria-label={fmt(strings.imageOf, { index: i + 1, count })} onClick={() => onIndex(i)}>
|
|
73
|
+
<img src={img.src} alt="" width={img.width} height={img.height} loading="lazy" decoding="async" />
|
|
74
|
+
</button>
|
|
75
|
+
))}
|
|
76
|
+
</div>
|
|
77
|
+
)}
|
|
78
|
+
<div className="nv-gallery__stage">
|
|
79
|
+
{badge && <span className="nv-gallery__badge">{badge}</span>}
|
|
80
|
+
<div ref={strip} className="nv-gallery__strip" onScroll={onScroll} {...region}>
|
|
81
|
+
{images.map((img, i) => (
|
|
82
|
+
<figure key={img.src + i} className="nv-gallery__slide" data-active={i === index ? '' : undefined} aria-hidden={layout !== 'stacked' && i !== index ? true : undefined}>
|
|
83
|
+
<img src={img.src} srcSet={img.srcSet} sizes="(min-width: 1024px) 50vw, 100vw" alt={img.alt ?? ''} width={img.width} height={img.height} loading={i === 0 ? 'eager' : 'lazy'} decoding="async" />
|
|
84
|
+
{onZoom && (layout === 'stacked' || i === index) && (
|
|
85
|
+
<IconButton className="nv-gallery__zoom" variant="on-media" icon="zoom" label={strings.zoomImage} onClick={() => onZoom(i)} />
|
|
86
|
+
)}
|
|
87
|
+
</figure>
|
|
88
|
+
))}
|
|
89
|
+
</div>
|
|
90
|
+
{count > 1 && (
|
|
91
|
+
<span className="nv-gallery__counter nv-tabular" aria-hidden>
|
|
92
|
+
{index + 1} / {count}
|
|
93
|
+
</span>
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.nv-qty {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
min-height: var(--btn-height-lg);
|
|
5
|
+
padding-inline: var(--space-1);
|
|
6
|
+
border-radius: var(--btn-radius);
|
|
7
|
+
box-shadow: inset 0 0 0 var(--border-width) var(--color-border-input);
|
|
8
|
+
}
|
|
9
|
+
.nv-qty__input {
|
|
10
|
+
/* The number is its own 44×44 target: as tall as the stepper, at least 44 wide (WCAG 2.5.5). */
|
|
11
|
+
align-self: stretch;
|
|
12
|
+
width: 2.5ch;
|
|
13
|
+
min-width: 44px;
|
|
14
|
+
border: 0;
|
|
15
|
+
background: transparent;
|
|
16
|
+
color: inherit;
|
|
17
|
+
font: inherit;
|
|
18
|
+
font-size: var(--type-body);
|
|
19
|
+
text-align: center;
|
|
20
|
+
-moz-appearance: textfield;
|
|
21
|
+
}
|
|
22
|
+
.nv-qty__input::-webkit-inner-spin-button, .nv-qty__input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
|
|
23
|
+
@media (max-width: 639.98px) { .nv-qty { min-height: var(--space-7); } }
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { IconButton } from '../base/IconButton'
|
|
2
|
+
import { useNova } from '../../styles/NovaProvider'
|
|
3
|
+
import './QuantitySelector.css'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 12C · quantity stepper — 52 tall beside the add button (48 at 390); − and +
|
|
7
|
+
* are 44 targets; the number is a real input (type a quantity). Controlled.
|
|
8
|
+
*/
|
|
9
|
+
export interface QuantitySelectorProps {
|
|
10
|
+
value: number
|
|
11
|
+
onChange: (value: number) => void
|
|
12
|
+
min?: number
|
|
13
|
+
/** Stock limit, when known. */
|
|
14
|
+
max?: number
|
|
15
|
+
disabled?: boolean
|
|
16
|
+
id?: string
|
|
17
|
+
/** Group name — per line in a cart ("Quantity of Mug"); defaults to "Quantity". */
|
|
18
|
+
label?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function QuantitySelector({ value, onChange, min = 1, max, disabled, id, label }: QuantitySelectorProps): JSX.Element {
|
|
22
|
+
const { strings } = useNova()
|
|
23
|
+
const clamp = (n: number) => Math.max(min, max ? Math.min(max, n) : n)
|
|
24
|
+
return (
|
|
25
|
+
<div className="nv-qty" role="group" aria-label={label ?? strings.quantity} data-disabled={disabled ? '' : undefined}>
|
|
26
|
+
<IconButton icon="minus" label={strings.decreaseQuantity} disabled={disabled || value <= min} onClick={() => onChange(clamp(value - 1))} />
|
|
27
|
+
<input
|
|
28
|
+
id={id}
|
|
29
|
+
className="nv-qty__input nv-tabular"
|
|
30
|
+
type="number"
|
|
31
|
+
inputMode="numeric"
|
|
32
|
+
min={min}
|
|
33
|
+
max={max}
|
|
34
|
+
value={value}
|
|
35
|
+
disabled={disabled}
|
|
36
|
+
aria-label={strings.quantity}
|
|
37
|
+
onChange={(e) => {
|
|
38
|
+
const n = Number.parseInt(e.target.value, 10)
|
|
39
|
+
if (Number.isFinite(n)) onChange(clamp(n))
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
<IconButton icon="plus" label={strings.increaseQuantity} disabled={disabled || (max != null && value >= max)} onClick={() => onChange(clamp(value + 1))} />
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* 12F · product reviews. Summary 56 / 1 score; bars 4px ink on muted; review rows hairline-separated. */
|
|
2
|
+
.nv-rating-summary { display: grid; gap: var(--space-3); }
|
|
3
|
+
.nv-rating-summary__score { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-2); margin: 0; }
|
|
4
|
+
.nv-rating-summary__value { font-size: 3.5rem; line-height: 1; letter-spacing: var(--tracking-display); font-weight: var(--weight-heading); }
|
|
5
|
+
.nv-rating-summary__of { font-size: var(--type-body-sm); color: var(--color-fg-muted); }
|
|
6
|
+
|
|
7
|
+
.nv-rating-bars { display: grid; gap: 2px; }
|
|
8
|
+
.nv-rating-bars__row { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) 3rem; align-items: center; gap: var(--space-3); width: 100%; min-height: 32px; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--color-fg); font: inherit; font-size: var(--type-body-sm); text-align: start; cursor: pointer; }
|
|
9
|
+
.nv-rating-bars__row:disabled { cursor: default; }
|
|
10
|
+
.nv-rating-bars__row:focus-visible { outline: var(--focus-ring-width) solid var(--color-focus); outline-offset: 2px; }
|
|
11
|
+
.nv-rating-bars__track { height: 4px; border-radius: 2px; background: var(--color-bg-muted); overflow: hidden; }
|
|
12
|
+
.nv-rating-bars__track span { display: block; height: 100%; min-width: 2px; background: var(--color-fg); }
|
|
13
|
+
.nv-rating-bars__count { text-align: end; color: var(--color-fg-muted); }
|
|
14
|
+
.nv-rating-bars__row[aria-pressed='true'] .nv-rating-bars__stars { font-weight: var(--weight-medium); text-decoration: underline; text-underline-offset: var(--underline-offset); }
|
|
15
|
+
.nv-rating-bars__row:hover:not(:disabled) .nv-rating-bars__track { background: var(--color-bg-muted-hover); }
|
|
16
|
+
|
|
17
|
+
.nv-review { display: grid; gap: var(--space-3); padding-block: var(--space-5); border-block-end: 1px solid var(--color-border); }
|
|
18
|
+
.nv-review__top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
|
|
19
|
+
.nv-review__date { font-size: var(--type-body-sm); color: var(--color-fg-muted); }
|
|
20
|
+
.nv-review__title { font-size: 1rem; line-height: 1.35; font-weight: var(--weight-medium); letter-spacing: 0; }
|
|
21
|
+
.nv-review__body { max-width: 68ch; font-size: 0.9375rem; line-height: 1.65; }
|
|
22
|
+
.nv-review__photos { display: flex; flex-wrap: wrap; gap: var(--space-2); }
|
|
23
|
+
.nv-review__photo { display: block; width: 72px; height: 72px; padding: 0; border: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-media-bg); cursor: zoom-in; }
|
|
24
|
+
.nv-review__photo img { width: 100%; height: 100%; object-fit: cover; }
|
|
25
|
+
.nv-review__photo:focus-visible { outline: var(--focus-ring-width) solid var(--color-focus); outline-offset: 2px; }
|
|
26
|
+
.nv-review__meta { font-size: var(--type-body-sm); color: var(--color-fg-muted); }
|
|
27
|
+
.nv-review__author { font-weight: var(--weight-medium); color: var(--color-fg); }
|
|
28
|
+
.nv-review__verified { color: var(--color-success); }
|
|
29
|
+
.nv-review__verified-short, .nv-review__meta-date { display: none; }
|
|
30
|
+
@media (max-width: 639.98px) {
|
|
31
|
+
.nv-review__date, .nv-review__verified-long, .nv-review__variant { display: none; }
|
|
32
|
+
.nv-review__verified-short, .nv-review__meta-date { display: inline; }
|
|
33
|
+
.nv-review__body { font-size: 0.875rem; }
|
|
34
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { sx } from '@tanqory/theme-kit'
|
|
2
|
+
import { useNova } from '../../styles/NovaProvider'
|
|
3
|
+
import { fmt } from '../../styles/strings'
|
|
4
|
+
import type { NovaImage, Review } from '@tanqory/theme-kit'
|
|
5
|
+
import { Stars } from './Stars'
|
|
6
|
+
import { formatDate } from '../content/ArticleCard'
|
|
7
|
+
import './Reviews.css'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 12F · product reviews, the pieces a reviews source feeds (DATA REQUIREMENT).
|
|
11
|
+
* Real data only: no placeholder stars, no "0 reviews" before a source exists.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export function RatingSummary({ average, count }: { average: number; count: number }): JSX.Element {
|
|
15
|
+
const { strings, locale } = useNova()
|
|
16
|
+
const avg = new Intl.NumberFormat(locale, { minimumFractionDigits: 1, maximumFractionDigits: 1 }).format(average)
|
|
17
|
+
return (
|
|
18
|
+
<div className="nv-rating-summary">
|
|
19
|
+
<p className="nv-rating-summary__score">
|
|
20
|
+
<span className="nv-rating-summary__value nv-tabular">{avg}</span>
|
|
21
|
+
<span className="nv-rating-summary__of">
|
|
22
|
+
{strings.outOfFive} · {fmt(strings.reviewsCount, { count: new Intl.NumberFormat(locale).format(count) })}
|
|
23
|
+
</span>
|
|
24
|
+
</p>
|
|
25
|
+
<Stars value={average} size="lg" />
|
|
26
|
+
</div>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface RatingBreakdownProps {
|
|
31
|
+
/** Counts for 5 · 4 · 3 · 2 · 1 stars. */
|
|
32
|
+
distribution: readonly number[]
|
|
33
|
+
/** The star filter in force (null = all). */
|
|
34
|
+
active?: number | null
|
|
35
|
+
onSelect?: (stars: number | null) => void
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Distribution bars are buttons that filter the list (12F rules); pressing the active bar clears it. */
|
|
39
|
+
export function RatingBreakdown({ distribution, active = null, onSelect }: RatingBreakdownProps): JSX.Element {
|
|
40
|
+
const { strings, locale } = useNova()
|
|
41
|
+
const total = distribution.reduce((a, b) => a + b, 0) || 1
|
|
42
|
+
const nf = new Intl.NumberFormat(locale)
|
|
43
|
+
return (
|
|
44
|
+
<ul className="nv-rating-bars" aria-label={strings.filterReviews}>
|
|
45
|
+
{distribution.map((n, i) => {
|
|
46
|
+
const stars = 5 - i
|
|
47
|
+
return (
|
|
48
|
+
<li key={stars}>
|
|
49
|
+
<button
|
|
50
|
+
type="button"
|
|
51
|
+
className="nv-rating-bars__row"
|
|
52
|
+
aria-pressed={active === stars}
|
|
53
|
+
aria-label={fmt(strings.starsFilter, { n: stars, count: nf.format(n) })}
|
|
54
|
+
disabled={n === 0}
|
|
55
|
+
onClick={() => onSelect?.(active === stars ? null : stars)}
|
|
56
|
+
>
|
|
57
|
+
<span className="nv-rating-bars__stars nv-tabular" aria-hidden>{fmt(strings.starsShort, { n: stars })}</span>
|
|
58
|
+
<span className="nv-rating-bars__track" aria-hidden>
|
|
59
|
+
<span className={sx({ width: `${(n / total) * 100}%` })} />
|
|
60
|
+
</span>
|
|
61
|
+
<span className="nv-rating-bars__count nv-tabular" aria-hidden>{nf.format(n)}</span>
|
|
62
|
+
</button>
|
|
63
|
+
</li>
|
|
64
|
+
)
|
|
65
|
+
})}
|
|
66
|
+
</ul>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface ReviewItemProps {
|
|
71
|
+
review: Review
|
|
72
|
+
showPhotos?: boolean
|
|
73
|
+
onOpenPhoto?: (photos: NovaImage[], index: number) => void
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function ReviewItem({ review: r, showPhotos = true, onOpenPhoto }: ReviewItemProps): JSX.Element {
|
|
77
|
+
const { strings, locale } = useNova()
|
|
78
|
+
const date = formatDate(r.createdAt, locale)
|
|
79
|
+
const photos = showPhotos ? (r.photos ?? []) : []
|
|
80
|
+
return (
|
|
81
|
+
<article className="nv-review">
|
|
82
|
+
<div className="nv-review__top">
|
|
83
|
+
<Stars value={r.rating} />
|
|
84
|
+
<time className="nv-review__date" dateTime={r.createdAt}>{date}</time>
|
|
85
|
+
</div>
|
|
86
|
+
{r.title && <h3 className="nv-review__title"><bdi>{r.title}</bdi></h3>}
|
|
87
|
+
<p className="nv-review__body"><bdi>{r.body}</bdi></p>
|
|
88
|
+
{photos.length > 0 && (
|
|
89
|
+
<ul className="nv-review__photos" aria-label={fmt(strings.reviewPhotos, { name: r.author })}>
|
|
90
|
+
{photos.map((p, i) => (
|
|
91
|
+
<li key={i}>
|
|
92
|
+
<button type="button" className="nv-review__photo" onClick={() => onOpenPhoto?.(photos, i)} aria-label={p.alt || fmt(strings.imageOf, { index: i + 1, count: photos.length })}>
|
|
93
|
+
<img src={p.src} alt="" width={p.width} height={p.height} loading="lazy" decoding="async" />
|
|
94
|
+
</button>
|
|
95
|
+
</li>
|
|
96
|
+
))}
|
|
97
|
+
</ul>
|
|
98
|
+
)}
|
|
99
|
+
<p className="nv-review__meta">
|
|
100
|
+
<span className="nv-review__author"><bdi>{r.author}</bdi></span>
|
|
101
|
+
{r.verified && (
|
|
102
|
+
<span className="nv-review__verified">
|
|
103
|
+
{' · '}✓ <span className="nv-review__verified-long">{strings.verifiedBuyer}</span>
|
|
104
|
+
<span className="nv-review__verified-short">{strings.verified}</span>
|
|
105
|
+
</span>
|
|
106
|
+
)}
|
|
107
|
+
{r.variant && <span className="nv-review__variant"> · {r.variant}</span>}
|
|
108
|
+
<span className="nv-review__meta-date"> · {date}</span>
|
|
109
|
+
</p>
|
|
110
|
+
</article>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
.nv-stars { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--color-fg); }
|
|
2
|
+
.nv-stars__row { display: inline-flex; gap: 2px; }
|
|
3
|
+
.nv-stars svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
|
|
4
|
+
.nv-stars svg[data-filled] { fill: currentColor; }
|
|
5
|
+
.nv-stars[data-size='sm'] svg { width: 13px; height: 13px; }
|
|
6
|
+
.nv-stars[data-size='lg'] svg { width: 20px; height: 20px; }
|
|
7
|
+
.nv-stars__label { font-size: var(--type-caption); color: var(--color-fg-muted); }
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useNova } from '../../styles/NovaProvider'
|
|
2
|
+
import { fmt } from '../../styles/strings'
|
|
3
|
+
import './Stars.css'
|
|
4
|
+
|
|
5
|
+
export interface StarsProps {
|
|
6
|
+
/** 0–5. Whole stars fill (4.8 → five); the exact number is in the label. */
|
|
7
|
+
value: number
|
|
8
|
+
size?: 'sm' | 'md' | 'lg'
|
|
9
|
+
/** Show "4.8 out of 5" beside the stars instead of only to screen readers. */
|
|
10
|
+
showLabel?: boolean
|
|
11
|
+
className?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const STAR = 'M12 3.5 14.6 9l6 .6-4.5 4 1.4 5.9L12 16.4 6.5 19.5 7.9 13.6 3.4 9.6l6-.6z'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Stars always paired with the number ("4.8 out of 5") — never shape alone
|
|
18
|
+
* (12F rules). Ink outline / fill, 16 px by default. Rendering 0 is the
|
|
19
|
+
* caller's decision: a 0 rating hides the stars, it is not "no stars".
|
|
20
|
+
*/
|
|
21
|
+
export function Stars({ value, size = 'md', showLabel, className }: StarsProps): JSX.Element {
|
|
22
|
+
const { strings, locale } = useNova()
|
|
23
|
+
const v = Math.max(0, Math.min(5, value))
|
|
24
|
+
const filled = Math.round(v)
|
|
25
|
+
const label = fmt(strings.ratingOutOf, { value: new Intl.NumberFormat(locale, { maximumFractionDigits: 1 }).format(v), max: 5 })
|
|
26
|
+
return (
|
|
27
|
+
<span className={['nv-stars', className].filter(Boolean).join(' ')} data-size={size}>
|
|
28
|
+
<span className="nv-stars__row" aria-hidden>
|
|
29
|
+
{[0, 1, 2, 3, 4].map((i) => (
|
|
30
|
+
<svg key={i} viewBox="0 0 24 24" data-filled={i < filled ? '' : undefined}>
|
|
31
|
+
<path d={STAR} />
|
|
32
|
+
</svg>
|
|
33
|
+
))}
|
|
34
|
+
</span>
|
|
35
|
+
<span className={showLabel ? 'nv-stars__label' : 'nv-visually-hidden'}>{label}</span>
|
|
36
|
+
</span>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* 12C · option picker — each option its own row. */
|
|
2
|
+
.nv-variants { display: grid; gap: var(--space-5); }
|
|
3
|
+
.nv-variants__option { display: grid; gap: var(--space-3); min-width: 0; margin: 0; padding: 0; border: 0; }
|
|
4
|
+
.nv-variants__legend { padding: 0; font-size: var(--type-body-sm); font-weight: var(--weight-medium); width: 100%; }
|
|
5
|
+
.nv-variants__legend-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
|
|
6
|
+
.nv-variants__current { color: var(--color-fg-muted); font-weight: var(--weight-body); }
|
|
7
|
+
.nv-variants__values { display: flex; flex-wrap: wrap; gap: var(--space-2); }
|
|
8
|
+
.nv-variants__value { position: relative; display: inline-grid; place-items: center; cursor: pointer; }
|
|
9
|
+
.nv-variants__input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
|
|
10
|
+
|
|
11
|
+
/* buttons — 44 tall, equal widths that share the row (4 sizes fit at 390), ink ring when chosen. */
|
|
12
|
+
[data-kind='buttons'] .nv-variants__values { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.25rem, 1fr)); }
|
|
13
|
+
[data-kind='buttons'] .nv-variants__value {
|
|
14
|
+
min-height: var(--touch-target);
|
|
15
|
+
padding-inline: var(--space-2);
|
|
16
|
+
border-radius: var(--btn-radius);
|
|
17
|
+
box-shadow: inset 0 0 0 var(--border-width) var(--color-border-input);
|
|
18
|
+
font-size: var(--type-body);
|
|
19
|
+
}
|
|
20
|
+
[data-kind='buttons'] .nv-variants__value:has(:checked) { box-shadow: inset 0 0 0 1.5px var(--color-fg); }
|
|
21
|
+
[data-kind='buttons'] .nv-variants__value[data-unavailable] { color: var(--color-fg-subtle); box-shadow: inset 0 0 0 var(--border-width) var(--color-border); background: linear-gradient(to top right, transparent calc(50% - 0.5px), var(--color-border) 50%, transparent calc(50% + 0.5px)); }
|
|
22
|
+
[data-kind='buttons'] .nv-variants__value[data-unavailable]:has(:checked) { box-shadow: inset 0 0 0 1.5px var(--color-fg-muted); }
|
|
23
|
+
|
|
24
|
+
/* swatches — a 32 dot in a 44 target, ring when chosen. */
|
|
25
|
+
[data-kind='swatches'] .nv-variants__value { width: var(--touch-target); height: var(--touch-target); border-radius: var(--radius-circle); }
|
|
26
|
+
.nv-variants__dot { width: var(--swatch-size); height: var(--swatch-size); border-radius: var(--radius-circle); background: var(--color-bg-muted); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-fg) 12%, transparent); }
|
|
27
|
+
[data-kind='swatches'] .nv-variants__value:has(:checked) { box-shadow: 0 0 0 1.5px var(--color-fg); }
|
|
28
|
+
[data-kind='swatches'] .nv-variants__value[data-unavailable] .nv-variants__dot { opacity: 0.45; }
|
|
29
|
+
[data-kind='swatches'] .nv-variants__value[data-unavailable]::after { content: ''; position: absolute; width: var(--swatch-size); height: 1.5px; background: var(--color-fg-muted); transform: rotate(-45deg); }
|
|
30
|
+
|
|
31
|
+
.nv-variants__value:has(:focus-visible) { outline: var(--focus-ring-width) solid var(--color-focus); outline-offset: var(--focus-ring-offset); }
|