@eldrajs/theme-cli 0.0.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -0
- package/LICENSE +21 -0
- package/README.md +26 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +203 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +3 -0
- package/dist/validate-DprFpjV7.js +535 -0
- package/package.json +50 -2
- package/template/.eldra/block-types.d.ts +429 -0
- package/template/.eldra/manifest.json +9378 -0
- package/template/.eldra/previews.json +36 -0
- package/template/.github/workflows/eldra-deploy.yml +24 -0
- package/template/.gitlab-ci.yml +16 -0
- package/template/.storybook/eldra.ts +123 -0
- package/template/.storybook/i18n.ts +23 -0
- package/template/.storybook/main.ts +59 -0
- package/template/.storybook/nuxt-link-stub.ts +23 -0
- package/template/.storybook/preview.ts +53 -0
- package/template/.storybook/shims-vue.d.ts +10 -0
- package/template/.storybook/virtual-eldra.d.ts +32 -0
- package/template/README.md +293 -0
- package/template/app/app.vue +126 -0
- package/template/app/assets/main.css +404 -0
- package/template/app/components/EldraIcon.vue +66 -0
- package/template/app/components/EldraRouterLink.vue +62 -0
- package/template/app/components/ui/UiImage.stories.ts +30 -0
- package/template/app/components/ui/UiImage.vue +224 -0
- package/template/app/components/ui/__tests__/UiImage.spec.ts +292 -0
- package/template/app/composables/iconComponent.ts +84 -0
- package/template/app/composables/iconFetcher.ts +14 -0
- package/template/app/composables/useBlockData.ts +30 -0
- package/template/app/composables/useEditing.ts +31 -0
- package/template/app/composables/useEldraIcon.ts +46 -0
- package/template/app/composables/useRevalidating.ts +69 -0
- package/template/app/composables/useRichTextScrollRegions.ts +80 -0
- package/template/app/composables/useStorefront.ts +18 -0
- package/template/app/composables/useStorefrontFeedback.ts +49 -0
- package/template/app/composables/useUiId.ts +18 -0
- package/template/app/composables/useWishlist.ts +42 -0
- package/template/app/i18n.d.ts +28 -0
- package/template/app/icons.ts +185 -0
- package/template/app/pages/[...slug].vue +134 -0
- package/template/app/plugins/eldra-i18n.ts +98 -0
- package/template/app/plugins/eldra-storefront.ts +288 -0
- package/template/app/plugins/eldra-ui-messages.ts +112 -0
- package/template/app/storefront/cart.ts +245 -0
- package/template/app/storefront/categories.ts +283 -0
- package/template/app/storefront/collectionSelector.ts +60 -0
- package/template/app/storefront/commerce.ts +58 -0
- package/template/app/storefront/demo.ts +1313 -0
- package/template/app/storefront/facets.ts +476 -0
- package/template/app/storefront/feedback.ts +122 -0
- package/template/app/storefront/gateway.ts +2256 -0
- package/template/app/storefront/history.ts +233 -0
- package/template/app/storefront/money.ts +248 -0
- package/template/app/storefront/options.ts +71 -0
- package/template/app/storefront/prerender.ts +77 -0
- package/template/app/storefront/refresh.ts +222 -0
- package/template/app/storefront/toProductCard.ts +154 -0
- package/template/app/storefront/types.ts +815 -0
- package/template/app/storefront/volatile.ts +211 -0
- package/template/app/templates.ts +544 -0
- package/template/app/utils/classes.ts +40 -0
- package/template/app/utils/links.ts +70 -0
- package/template/app/utils/pageStructure.ts +77 -0
- package/template/app/utils/pageTitle.ts +37 -0
- package/template/app/virtual-eldra.d.ts +12 -0
- package/template/bitbucket-pipelines.yml +19 -0
- package/template/blocks/announcement-bar/Block.vue +203 -0
- package/template/blocks/announcement-bar/__tests__/Block.spec.ts +227 -0
- package/template/blocks/announcement-bar/block.json +45 -0
- package/template/blocks/announcement-bar/mock.json +7 -0
- package/template/blocks/announcement-bar/preview.png +0 -0
- package/template/blocks/article/Block.vue +317 -0
- package/template/blocks/article/__tests__/Block.spec.ts +229 -0
- package/template/blocks/article/block.json +148 -0
- package/template/blocks/article/mock.json +512 -0
- package/template/blocks/article/preview.json +16 -0
- package/template/blocks/article/preview.png +0 -0
- package/template/blocks/article-list/Block.vue +343 -0
- package/template/blocks/article-list/__tests__/Block.spec.ts +279 -0
- package/template/blocks/article-list/block.json +181 -0
- package/template/blocks/article-list/mock.json +68 -0
- package/template/blocks/article-list/preview.json +84 -0
- package/template/blocks/article-list/preview.png +0 -0
- package/template/blocks/breadcrumbs/Block.vue +278 -0
- package/template/blocks/breadcrumbs/__tests__/Block.spec.ts +461 -0
- package/template/blocks/breadcrumbs/block.json +89 -0
- package/template/blocks/breadcrumbs/mock.json +11 -0
- package/template/blocks/breadcrumbs/preview.json +3 -0
- package/template/blocks/breadcrumbs/preview.png +0 -0
- package/template/blocks/cart/Block.vue +372 -0
- package/template/blocks/cart/__tests__/Block.spec.ts +561 -0
- package/template/blocks/cart/__tests__/ShippingBar.spec.ts +78 -0
- package/template/blocks/cart/__tests__/Summary.spec.ts +245 -0
- package/template/blocks/cart/block.json +74 -0
- package/template/blocks/cart/mock.json +11 -0
- package/template/blocks/cart/parts/CartLines.vue +257 -0
- package/template/blocks/cart/parts/ShippingBar.vue +105 -0
- package/template/blocks/cart/parts/Summary.vue +291 -0
- package/template/blocks/cart/preview.png +0 -0
- package/template/blocks/collection-grid/Block.vue +1832 -0
- package/template/blocks/collection-grid/__tests__/Block.spec.ts +3037 -0
- package/template/blocks/collection-grid/__tests__/groups.spec.ts +731 -0
- package/template/blocks/collection-grid/block.json +187 -0
- package/template/blocks/collection-grid/mock.json +23 -0
- package/template/blocks/collection-grid/parts/groups.ts +861 -0
- package/template/blocks/collection-grid/preview.json +7 -0
- package/template/blocks/collection-grid/preview.png +0 -0
- package/template/blocks/collection-header/Block.vue +533 -0
- package/template/blocks/collection-header/__tests__/Block.spec.ts +381 -0
- package/template/blocks/collection-header/block.json +140 -0
- package/template/blocks/collection-header/mock.json +28 -0
- package/template/blocks/collection-header/preview.json +14 -0
- package/template/blocks/collection-header/preview.png +0 -0
- package/template/blocks/contact/Block.vue +621 -0
- package/template/blocks/contact/__tests__/Block.spec.ts +347 -0
- package/template/blocks/contact/block.json +174 -0
- package/template/blocks/contact/mock.json +28 -0
- package/template/blocks/contact/preview.json +9 -0
- package/template/blocks/contact/preview.png +0 -0
- package/template/blocks/cta/Block.vue +383 -0
- package/template/blocks/cta/__tests__/Block.spec.ts +309 -0
- package/template/blocks/cta/block.json +86 -0
- package/template/blocks/cta/mock.json +10 -0
- package/template/blocks/cta/preview.json +9 -0
- package/template/blocks/cta/preview.png +0 -0
- package/template/blocks/faq/Block.vue +254 -0
- package/template/blocks/faq/__tests__/Block.spec.ts +312 -0
- package/template/blocks/faq/block.json +113 -0
- package/template/blocks/faq/mock.json +115 -0
- package/template/blocks/faq/preview.png +0 -0
- package/template/blocks/feature-grid/Block.vue +241 -0
- package/template/blocks/feature-grid/__tests__/Block.spec.ts +311 -0
- package/template/blocks/feature-grid/block.json +106 -0
- package/template/blocks/feature-grid/mock.json +29 -0
- package/template/blocks/feature-grid/preview.json +45 -0
- package/template/blocks/feature-grid/preview.png +0 -0
- package/template/blocks/footer/Block.vue +652 -0
- package/template/blocks/footer/__tests__/Block.spec.ts +700 -0
- package/template/blocks/footer/block.json +240 -0
- package/template/blocks/footer/mock.json +161 -0
- package/template/blocks/footer/preview.png +0 -0
- package/template/blocks/gallery/Block.vue +416 -0
- package/template/blocks/gallery/__tests__/Block.spec.ts +289 -0
- package/template/blocks/gallery/block.json +87 -0
- package/template/blocks/gallery/mock.json +16 -0
- package/template/blocks/gallery/preview.json +64 -0
- package/template/blocks/gallery/preview.png +0 -0
- package/template/blocks/hero/Block.vue +378 -0
- package/template/blocks/hero/__tests__/Block.spec.ts +324 -0
- package/template/blocks/hero/block.json +146 -0
- package/template/blocks/hero/mock.json +11 -0
- package/template/blocks/hero/preview.json +55 -0
- package/template/blocks/hero/preview.png +0 -0
- package/template/blocks/image/Block.vue +232 -0
- package/template/blocks/image/__tests__/Block.spec.ts +224 -0
- package/template/blocks/image/block.json +67 -0
- package/template/blocks/image/mock.json +7 -0
- package/template/blocks/image/preview.json +9 -0
- package/template/blocks/image/preview.png +0 -0
- package/template/blocks/logo-cloud/Block.vue +206 -0
- package/template/blocks/logo-cloud/__tests__/Block.spec.ts +210 -0
- package/template/blocks/logo-cloud/block.json +79 -0
- package/template/blocks/logo-cloud/mock.json +15 -0
- package/template/blocks/logo-cloud/preview.json +92 -0
- package/template/blocks/logo-cloud/preview.png +0 -0
- package/template/blocks/navigation/Block.vue +1348 -0
- package/template/blocks/navigation/__tests__/Block.spec.ts +2030 -0
- package/template/blocks/navigation/block.json +167 -0
- package/template/blocks/navigation/mock.json +191 -0
- package/template/blocks/navigation/preview.png +0 -0
- package/template/blocks/navigation/useMegaMenuKeys.ts +276 -0
- package/template/blocks/newsletter/Block.vue +399 -0
- package/template/blocks/newsletter/__tests__/Block.spec.ts +365 -0
- package/template/blocks/newsletter/block.json +105 -0
- package/template/blocks/newsletter/mock.json +31 -0
- package/template/blocks/newsletter/preview.png +0 -0
- package/template/blocks/order-status/Block.vue +754 -0
- package/template/blocks/order-status/__tests__/Block.spec.ts +515 -0
- package/template/blocks/order-status/block.json +138 -0
- package/template/blocks/order-status/mock.json +19 -0
- package/template/blocks/order-status/preview.png +0 -0
- package/template/blocks/pricing-table/Block.vue +297 -0
- package/template/blocks/pricing-table/__tests__/Block.spec.ts +357 -0
- package/template/blocks/pricing-table/block.json +155 -0
- package/template/blocks/pricing-table/mock.json +47 -0
- package/template/blocks/pricing-table/preview.png +0 -0
- package/template/blocks/product-carousel/Block.vue +459 -0
- package/template/blocks/product-carousel/__tests__/Block.spec.ts +957 -0
- package/template/blocks/product-carousel/block.json +71 -0
- package/template/blocks/product-carousel/mock.json +9 -0
- package/template/blocks/product-carousel/preview.json +7 -0
- package/template/blocks/product-carousel/preview.png +0 -0
- package/template/blocks/product-detail/Block.vue +886 -0
- package/template/blocks/product-detail/__tests__/Block.spec.ts +1492 -0
- package/template/blocks/product-detail/__tests__/stock.spec.ts +119 -0
- package/template/blocks/product-detail/block.json +155 -0
- package/template/blocks/product-detail/mock.json +113 -0
- package/template/blocks/product-detail/parts/Gallery.vue +181 -0
- package/template/blocks/product-detail/parts/StickyBuyBar.vue +99 -0
- package/template/blocks/product-detail/preview.png +0 -0
- package/template/blocks/product-detail/stock.ts +150 -0
- package/template/blocks/quote/Block.vue +206 -0
- package/template/blocks/quote/__tests__/Block.spec.ts +265 -0
- package/template/blocks/quote/block.json +76 -0
- package/template/blocks/quote/mock.json +9 -0
- package/template/blocks/quote/preview.json +16 -0
- package/template/blocks/quote/preview.png +0 -0
- package/template/blocks/rich-text/Block.vue +143 -0
- package/template/blocks/rich-text/__tests__/Block.spec.ts +191 -0
- package/template/blocks/rich-text/block.json +57 -0
- package/template/blocks/rich-text/mock.json +87 -0
- package/template/blocks/rich-text/preview.png +0 -0
- package/template/blocks/search/Block.vue +589 -0
- package/template/blocks/search/PopularChips.vue +40 -0
- package/template/blocks/search/TypeSection.vue +148 -0
- package/template/blocks/search/__tests__/Block.spec.ts +718 -0
- package/template/blocks/search/__tests__/results.spec.ts +166 -0
- package/template/blocks/search/block.json +102 -0
- package/template/blocks/search/mock.json +18 -0
- package/template/blocks/search/preview.png +0 -0
- package/template/blocks/search/results.ts +85 -0
- package/template/blocks/split-content/Block.vue +195 -0
- package/template/blocks/split-content/__tests__/Block.spec.ts +225 -0
- package/template/blocks/split-content/block.json +70 -0
- package/template/blocks/split-content/mock.json +45 -0
- package/template/blocks/split-content/preview.json +58 -0
- package/template/blocks/split-content/preview.png +0 -0
- package/template/blocks/stats/Block.vue +159 -0
- package/template/blocks/stats/__tests__/Block.spec.ts +194 -0
- package/template/blocks/stats/block.json +73 -0
- package/template/blocks/stats/mock.json +12 -0
- package/template/blocks/stats/preview.png +0 -0
- package/template/blocks/tabs/Block.vue +278 -0
- package/template/blocks/tabs/__tests__/Block.spec.ts +303 -0
- package/template/blocks/tabs/block.json +97 -0
- package/template/blocks/tabs/mock.json +129 -0
- package/template/blocks/tabs/preview.json +153 -0
- package/template/blocks/tabs/preview.png +0 -0
- package/template/blocks/team/Block.vue +288 -0
- package/template/blocks/team/__tests__/Block.spec.ts +221 -0
- package/template/blocks/team/block.json +125 -0
- package/template/blocks/team/mock.json +39 -0
- package/template/blocks/team/preview.json +62 -0
- package/template/blocks/team/preview.png +0 -0
- package/template/blocks/testimonials/Block.vue +408 -0
- package/template/blocks/testimonials/__tests__/Block.spec.ts +319 -0
- package/template/blocks/testimonials/block.json +121 -0
- package/template/blocks/testimonials/mock.json +46 -0
- package/template/blocks/testimonials/preview.json +68 -0
- package/template/blocks/testimonials/preview.png +0 -0
- package/template/blocks/timeline/Block.vue +274 -0
- package/template/blocks/timeline/__tests__/Block.spec.ts +310 -0
- package/template/blocks/timeline/block.json +98 -0
- package/template/blocks/timeline/mock.json +27 -0
- package/template/blocks/timeline/preview.png +0 -0
- package/template/blocks/trust-strip/Block.vue +330 -0
- package/template/blocks/trust-strip/__tests__/Block.spec.ts +290 -0
- package/template/blocks/trust-strip/block.json +117 -0
- package/template/blocks/trust-strip/mock.json +37 -0
- package/template/blocks/trust-strip/preview.png +0 -0
- package/template/blocks/video-embed/Block.vue +354 -0
- package/template/blocks/video-embed/__tests__/Block.spec.ts +219 -0
- package/template/blocks/video-embed/__tests__/embed.spec.ts +76 -0
- package/template/blocks/video-embed/block.json +94 -0
- package/template/blocks/video-embed/embed.ts +84 -0
- package/template/blocks/video-embed/mock.json +13 -0
- package/template/blocks/video-embed/preview.json +9 -0
- package/template/blocks/video-embed/preview.png +0 -0
- package/template/blocks/wishlist/Block.vue +367 -0
- package/template/blocks/wishlist/__tests__/Block.spec.ts +508 -0
- package/template/blocks/wishlist/block.json +42 -0
- package/template/blocks/wishlist/mock.json +9 -0
- package/template/blocks/wishlist/preview.png +0 -0
- package/template/i18n/en-US.json +602 -0
- package/template/i18n/is-IS.json +602 -0
- package/template/nuxt.config.ts +156 -0
- package/template/package.json +56 -0
- package/template/pages/article.page.json +731 -0
- package/template/pages/cart.page.json +85 -0
- package/template/pages/category.page.json +133 -0
- package/template/pages/collection.page.json +194 -0
- package/template/pages/home.page.json +353 -0
- package/template/pages/product.page.json +323 -0
- package/template/pages/products.page.json +144 -0
- package/template/pages/search.page.json +83 -0
- package/template/pages/wishlist.page.json +88 -0
- package/template/public/apple-touch-icon.png +0 -0
- package/template/public/demo/article-cover.svg +1 -0
- package/template/public/demo/article-figure.svg +1 -0
- package/template/public/demo/avatar-1.svg +3 -0
- package/template/public/demo/avatar-2.svg +3 -0
- package/template/public/demo/avatar-3.svg +3 -0
- package/template/public/demo/avatar-4.svg +3 -0
- package/template/public/demo/avatar-5.svg +3 -0
- package/template/public/demo/avatar-6.svg +3 -0
- package/template/public/demo/avatar-7.svg +3 -0
- package/template/public/demo/avatar-8.svg +3 -0
- package/template/public/demo/collection-1.svg +1 -0
- package/template/public/demo/collection-2.svg +1 -0
- package/template/public/demo/cta-split.svg +1 -0
- package/template/public/demo/feature-1.svg +1 -0
- package/template/public/demo/feature-2.svg +1 -0
- package/template/public/demo/feature-3.svg +1 -0
- package/template/public/demo/feature-4.svg +1 -0
- package/template/public/demo/gallery-1.svg +1 -0
- package/template/public/demo/gallery-2.svg +1 -0
- package/template/public/demo/gallery-3.svg +1 -0
- package/template/public/demo/gallery-4.svg +1 -0
- package/template/public/demo/gallery-5.svg +1 -0
- package/template/public/demo/gallery-6.svg +1 -0
- package/template/public/demo/gallery-7.svg +1 -0
- package/template/public/demo/gallery-8.svg +1 -0
- package/template/public/demo/hero-slide-1.svg +1 -0
- package/template/public/demo/hero-slide-2.svg +1 -0
- package/template/public/demo/hero-slide-3.svg +1 -0
- package/template/public/demo/hero-slide-4.svg +1 -0
- package/template/public/demo/hero-wide.svg +1 -0
- package/template/public/demo/hero.svg +1 -0
- package/template/public/demo/logo-1.svg +4 -0
- package/template/public/demo/logo-2.svg +4 -0
- package/template/public/demo/logo-3.svg +4 -0
- package/template/public/demo/logo-4.svg +4 -0
- package/template/public/demo/logo-5.svg +4 -0
- package/template/public/demo/logo-6.svg +4 -0
- package/template/public/demo/logo-7.svg +4 -0
- package/template/public/demo/logo-8.svg +4 -0
- package/template/public/demo/logo.svg +3 -0
- package/template/public/demo/map.svg +1 -0
- package/template/public/demo/poster.svg +1 -0
- package/template/public/demo/product-1.svg +4 -0
- package/template/public/demo/product-10.svg +4 -0
- package/template/public/demo/product-11.svg +4 -0
- package/template/public/demo/product-12.svg +4 -0
- package/template/public/demo/product-2.svg +4 -0
- package/template/public/demo/product-3.svg +4 -0
- package/template/public/demo/product-4.svg +4 -0
- package/template/public/demo/product-5.svg +4 -0
- package/template/public/demo/product-6.svg +4 -0
- package/template/public/demo/product-7.svg +4 -0
- package/template/public/demo/product-8.svg +4 -0
- package/template/public/demo/product-9.svg +4 -0
- package/template/public/demo/product-square-1.svg +4 -0
- package/template/public/demo/product-square-2.svg +4 -0
- package/template/public/demo/product-square-3.svg +4 -0
- package/template/public/demo/product-square-4.svg +4 -0
- package/template/public/demo/product-square-5.svg +4 -0
- package/template/public/demo/product-square-6.svg +4 -0
- package/template/public/demo/quote-portrait.svg +4 -0
- package/template/public/demo/split-1.svg +1 -0
- package/template/public/demo/split-2.svg +1 -0
- package/template/public/demo/split-3.svg +1 -0
- package/template/public/demo/split-4.svg +1 -0
- package/template/public/demo/team-1.svg +4 -0
- package/template/public/demo/team-2.svg +4 -0
- package/template/public/demo/team-3.svg +4 -0
- package/template/public/demo/team-4.svg +4 -0
- package/template/public/favicon.ico +0 -0
- package/template/scripts/demo-images.mjs +393 -0
- package/template/scripts/generate-stories.mjs +156 -0
- package/template/scripts/previewHash.mjs +125 -0
- package/template/scripts/previews.mjs +149 -0
- package/template/stories/generated/announcement-bar.stories.ts +44 -0
- package/template/stories/generated/article-list.stories.ts +87 -0
- package/template/stories/generated/article.stories.ts +27 -0
- package/template/stories/generated/breadcrumbs.stories.ts +39 -0
- package/template/stories/generated/cart.stories.ts +38 -0
- package/template/stories/generated/collection-grid.stories.ts +117 -0
- package/template/stories/generated/collection-header.stories.ts +51 -0
- package/template/stories/generated/contact.stories.ts +45 -0
- package/template/stories/generated/cta.stories.ts +51 -0
- package/template/stories/generated/faq.stories.ts +56 -0
- package/template/stories/generated/feature-grid.stories.ts +69 -0
- package/template/stories/generated/footer.stories.ts +50 -0
- package/template/stories/generated/gallery.stories.ts +81 -0
- package/template/stories/generated/hero.stories.ts +75 -0
- package/template/stories/generated/image.stories.ts +99 -0
- package/template/stories/generated/logo-cloud.stories.ts +57 -0
- package/template/stories/generated/navigation.stories.ts +62 -0
- package/template/stories/generated/newsletter.stories.ts +68 -0
- package/template/stories/generated/order-status.stories.ts +32 -0
- package/template/stories/generated/pricing-table.stories.ts +44 -0
- package/template/stories/generated/product-carousel.stories.ts +75 -0
- package/template/stories/generated/product-detail.stories.ts +62 -0
- package/template/stories/generated/quote.stories.ts +69 -0
- package/template/stories/generated/rich-text.stories.ts +50 -0
- package/template/stories/generated/search.stories.ts +56 -0
- package/template/stories/generated/split-content.stories.ts +39 -0
- package/template/stories/generated/stats.stories.ts +68 -0
- package/template/stories/generated/tabs.stories.ts +45 -0
- package/template/stories/generated/team.stories.ts +45 -0
- package/template/stories/generated/testimonials.stories.ts +69 -0
- package/template/stories/generated/timeline.stories.ts +80 -0
- package/template/stories/generated/trust-strip.stories.ts +62 -0
- package/template/stories/generated/video-embed.stories.ts +63 -0
- package/template/stories/generated/wishlist.stories.ts +26 -0
- package/template/stories/pages/article.stories.ts +51 -0
- package/template/stories/pages/cart.stories.ts +56 -0
- package/template/stories/pages/category.stories.ts +56 -0
- package/template/stories/pages/collection.stories.ts +51 -0
- package/template/stories/pages/home.stories.ts +51 -0
- package/template/stories/pages/product.stories.ts +47 -0
- package/template/stories/pages/products.stories.ts +58 -0
- package/template/stories/pages/search.stories.ts +54 -0
- package/template/stories/pages/wishlist.stories.ts +53 -0
- package/template/stories/support/pageBlocks.ts +115 -0
- package/template/test/blocksEmptyData.spec.ts +52 -0
- package/template/test/carouselKeyboard.spec.ts +272 -0
- package/template/test/carouselRing.browser.spec.ts +193 -0
- package/template/test/carouselSlideWidth.browser.spec.ts +102 -0
- package/template/test/cartDrawer.spec.ts +295 -0
- package/template/test/cartToast.spec.ts +86 -0
- package/template/test/countPill.browser.spec.ts +196 -0
- package/template/test/demoImages.spec.ts +140 -0
- package/template/test/deps.spec.ts +102 -0
- package/template/test/eldraIcon.spec.ts +58 -0
- package/template/test/framing.spec.ts +76 -0
- package/template/test/i18n.spec.ts +200 -0
- package/template/test/iconComponent.spec.ts +91 -0
- package/template/test/inlineEditable.spec.ts +335 -0
- package/template/test/localePrefix.spec.ts +342 -0
- package/template/test/mainCss.spec.ts +107 -0
- package/template/test/mockGatewayContract.spec.ts +122 -0
- package/template/test/mocks/blocks.ts +20 -0
- package/template/test/mocks/breakpoints.ts +7 -0
- package/template/test/mocks/manifest.ts +11 -0
- package/template/test/moneyFormatting.spec.ts +85 -0
- package/template/test/pageTitle.spec.ts +49 -0
- package/template/test/pages/article.spec.ts +231 -0
- package/template/test/pages/category.spec.ts +185 -0
- package/template/test/pages/collection.spec.ts +396 -0
- package/template/test/pages/home.spec.ts +295 -0
- package/template/test/pages/hydration.spec.ts +557 -0
- package/template/test/pages/product.spec.ts +396 -0
- package/template/test/pages/seededPages.spec.ts +190 -0
- package/template/test/pages/ssr.spec.ts +387 -0
- package/template/test/prerenderCommerce.spec.ts +134 -0
- package/template/test/prerenderFailure.spec.ts +130 -0
- package/template/test/prerenderRefresh.browser.spec.ts +1431 -0
- package/template/test/previewsFresh.spec.ts +56 -0
- package/template/test/richText.spec.ts +164 -0
- package/template/test/richTextTypography.spec.ts +182 -0
- package/template/test/setup.ts +21 -0
- package/template/test/slugPage.spec.ts +244 -0
- package/template/test/slugPageTemplate.spec.ts +194 -0
- package/template/test/starter.spec.ts +1416 -0
- package/template/test/storefront/cart.spec.ts +404 -0
- package/template/test/storefront/categories.spec.ts +235 -0
- package/template/test/storefront/collectionSelector.spec.ts +74 -0
- package/template/test/storefront/demo.spec.ts +555 -0
- package/template/test/storefront/facets.spec.ts +425 -0
- package/template/test/storefront/feedback.spec.ts +97 -0
- package/template/test/storefront/gateway.spec.ts +2673 -0
- package/template/test/storefront/gatewayCart.spec.ts +289 -0
- package/template/test/storefront/gatewayPrerender.spec.ts +1037 -0
- package/template/test/storefront/history.spec.ts +341 -0
- package/template/test/storefront/money.spec.ts +170 -0
- package/template/test/storefront/toProductCard.spec.ts +138 -0
- package/template/test/storefront/volatile.spec.ts +284 -0
- package/template/test/support/axe.ts +14 -0
- package/template/test/support/dialog.ts +51 -0
- package/template/test/support/hydrate.ts +118 -0
- package/template/test/support/i18nText.ts +11 -0
- package/template/test/support/mockGateway.ts +1017 -0
- package/template/test/support/mountBlock.ts +194 -0
- package/template/test/support/mountPage.spec.ts +72 -0
- package/template/test/support/mountPage.ts +254 -0
- package/template/test/support/mountProbe.client.ts +69 -0
- package/template/test/support/renderSsr.ts +97 -0
- package/template/test/support/staticServer.ts +96 -0
- package/template/test/themeIcons.spec.ts +140 -0
- package/template/test/toastAnnouncement.spec.ts +133 -0
- package/template/test/tokens.spec.ts +102 -0
- package/template/test/uiMessagesPlugin.spec.ts +104 -0
- package/template/test/useBlockData.spec.ts +49 -0
- package/template/test/useEditing.spec.ts +54 -0
- package/template/test/useEldraIcon.spec.ts +126 -0
- package/template/test/useUiId.spec.ts +40 -0
- package/template/tokens.json +149 -0
- package/template/tsconfig.json +3 -0
- package/template/tsconfig.storybook.json +17 -0
- package/template/vitest-axe.d.ts +13 -0
- package/template/vitest.config.ts +44 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"people": [
|
|
3
|
+
{
|
|
4
|
+
"name": "Ingrid Solberg",
|
|
5
|
+
"role": "Founder and buyer",
|
|
6
|
+
"bio": "Started Northwind on a market stall in 2014 and still chooses every piece we stock.",
|
|
7
|
+
"links": [
|
|
8
|
+
{ "type": "instagram", "href": "https://instagram.com/ingrid.northwind" },
|
|
9
|
+
{ "type": "email", "href": "mailto:ingrid@northwind.example" }
|
|
10
|
+
],
|
|
11
|
+
"photo": {
|
|
12
|
+
"assetId": "demo-team-1",
|
|
13
|
+
"url": "/demo/team-1.svg",
|
|
14
|
+
"altText": "",
|
|
15
|
+
"width": 1000,
|
|
16
|
+
"height": 1250
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "Tomás Ferreira",
|
|
21
|
+
"role": "Head potter",
|
|
22
|
+
"bio": "Throws about sixty mugs a day. Found our speckled glaze by accident in 2016.",
|
|
23
|
+
"links": [{ "type": "instagram", "href": "https://instagram.com/tomas.throws" }],
|
|
24
|
+
"photo": {
|
|
25
|
+
"assetId": "demo-team-2",
|
|
26
|
+
"url": "/demo/team-2.svg",
|
|
27
|
+
"altText": "",
|
|
28
|
+
"width": 1000,
|
|
29
|
+
"height": 1250
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "Aiko Mori",
|
|
34
|
+
"role": "Weaver",
|
|
35
|
+
"bio": "Runs the 1960s Dobcross loom and teaches the Saturday weaving class.",
|
|
36
|
+
"links": [
|
|
37
|
+
{ "type": "instagram", "href": "https://instagram.com/aiko.weaves" },
|
|
38
|
+
{ "type": "website", "href": "https://aikomori.example" }
|
|
39
|
+
],
|
|
40
|
+
"photo": {
|
|
41
|
+
"assetId": "demo-team-3",
|
|
42
|
+
"url": "/demo/team-3.svg",
|
|
43
|
+
"altText": "",
|
|
44
|
+
"width": 1000,
|
|
45
|
+
"height": 1250
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "Dele Okafor",
|
|
50
|
+
"role": "Customer care lead",
|
|
51
|
+
"bio": "Answers your emails, sorts your returns and knows where every parcel is.",
|
|
52
|
+
"links": [{ "type": "email", "href": "mailto:dele@northwind.example" }],
|
|
53
|
+
"photo": {
|
|
54
|
+
"assetId": "demo-team-4",
|
|
55
|
+
"url": "/demo/team-4.svg",
|
|
56
|
+
"altText": "",
|
|
57
|
+
"width": 1000,
|
|
58
|
+
"height": 1250
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Customer reviews as a grid of cards, a swipeable carousel or one large featured quote, each with
|
|
4
|
+
* an optional star rating and the product it refers to (spec `02-blocks.md` 1274–1404,
|
|
5
|
+
* "Testimonials"). `variant`:
|
|
6
|
+
*
|
|
7
|
+
* - `grid`: 1 → 2 → 3 columns of cards, every review visible at once. The spec's own column
|
|
8
|
+
* breakpoints are 40rem and 60rem of the block's own width — not this package's `@tablet`/
|
|
9
|
+
* `@content` (48rem/64rem) — so `gridClass` below uses Tailwind's arbitrary `@min-[…]:`
|
|
10
|
+
* container-query syntax directly rather than the package's three named breakpoints, which
|
|
11
|
+
* only exist at 48/64/80rem (`--container-tablet`/`-content`/`-wide` in `tailwind.css`). A
|
|
12
|
+
* single rendered card is centred and capped at 36rem instead of stretching a lone grid cell.
|
|
13
|
+
* - `carousel`: the same cards inside `@eldrajs/ui`'s `Carousel`. Its own `perView` breakpoints
|
|
14
|
+
* (`md`/`lg`) are hard-coded to exactly those two package breakpoints — 48rem/64rem, resolved
|
|
15
|
+
* into inline `--eldra-carousel-per-view-*` custom properties by `useCarousel.ts`'s
|
|
16
|
+
* `carouselPerViewStyle()` — so, unlike the grid above, there is no way to
|
|
17
|
+
* honour the spec's literal 40rem/60rem here; `{ base: 1.16, md: 2, lg: 3 }` is this block's own
|
|
18
|
+
* resolution, deliberately using the component's real 48rem/64rem edges instead.
|
|
19
|
+
* - `single-large`: the first review only, centred, with a larger quote in the heading font and
|
|
20
|
+
* the heading itself shrunk to a small label ("Customer review" in the default content).
|
|
21
|
+
*
|
|
22
|
+
* Every review is a `<figure>` with a `<blockquote>` and a `<figcaption>` (`Avatar`, `<cite>` name,
|
|
23
|
+
* the meta line, `Rating`) — one shared shape, written once for `grid`/`carousel`'s card and once
|
|
24
|
+
* more (larger) for `single-large`, the same "one shape, sized differently per variant" split
|
|
25
|
+
* `hero`'s own image/copy markup uses. In `carousel`, each card is wrapped in a plain `<div>` — the
|
|
26
|
+
* default slot's real top-level element `Carousel`'s `useCarousel` annotates as the slide itself
|
|
27
|
+
* (`role="group"`, `aria-roledescription`, `aria-label="n of N"`) — rather than the `<figure>`
|
|
28
|
+
* being that slide directly: axe's `aria-allowed-role` only lets `figure` keep an explicit role
|
|
29
|
+
* once it has a `<figcaption>` child when that role is `doc-example`, never `group` (see the
|
|
30
|
+
* carousel branch's own comment).
|
|
31
|
+
*
|
|
32
|
+
* `Rating`'s own no-reviews state only fires at `count: 0`; passing `count="1"` alongside
|
|
33
|
+
* `showValue={false} showCount={false}` shows just the stars with the one accessible sentence, the
|
|
34
|
+
* same trade `stats`'/the pre-rebuild `testimonials` block already made — the true review count is
|
|
35
|
+
* never modelled by this block's fields, only a 1–5 average per item.
|
|
36
|
+
*
|
|
37
|
+
* On a `primary` section the head (heading/summary/link) and each review's stars invert through
|
|
38
|
+
* `Section`'s own `group-data-[section=primary]/section:` mechanism (`Link`/`RatingStars`'s own
|
|
39
|
+
* copy of it) — but the spec also says "cards stay light, with normal colours inside" for
|
|
40
|
+
* `grid`/`carousel`, and that mechanism has no idea a card sits in between: it matches the
|
|
41
|
+
* *nearest* `.group/section` ancestor, not by DOM distance or intervening background colour. Each
|
|
42
|
+
* card is therefore marked `class="group/section"` itself, with no `data-section` — the same
|
|
43
|
+
* "mark a surface by hand" tool `cta`'s own accent `banner` panel uses to *start* a new inverted
|
|
44
|
+
* scope, used here in reverse to *stop* one, so a card's own `Rating`/product `Link` never read the
|
|
45
|
+
* outer primary section at all. `single-large` has no such card (the review sits directly on the
|
|
46
|
+
* section's own ground), so its `Rating` is deliberately left to invert normally — the one place in
|
|
47
|
+
* this package's whole component set where that on-primary star/link inversion actually renders
|
|
48
|
+
* (see `RatingStars.vue`'s own comment: "inert until a coloured `Section` … provides the group").
|
|
49
|
+
* `text`/`muted` are plain fixed tokens with no such mechanism (`stats`'s own doc comment); the
|
|
50
|
+
* heading, the quote and the name all carry no colour class of their own — inside a card that
|
|
51
|
+
* inherits `text-text` from the card's own explicit `bg-surface`/`bg-background` (see
|
|
52
|
+
* `cardBackgroundClass`), directly on the ground everywhere else — so they simply inherit the
|
|
53
|
+
* right one, and
|
|
54
|
+
* only the two genuinely `muted` parts (`summary`, the plain-text meta line) branch on `isInverted`.
|
|
55
|
+
*/
|
|
56
|
+
import { computed } from 'vue';
|
|
57
|
+
import { Avatar, Carousel, Container, EditorPlaceholder, Link, Rating, Section } from '@eldrajs/ui';
|
|
58
|
+
import type { ContainerWidth, SectionBackground } from '@eldrajs/ui';
|
|
59
|
+
import { useBlockData } from '../../app/composables/useBlockData';
|
|
60
|
+
import { useEditing } from '../../app/composables/useEditing';
|
|
61
|
+
import { useI18n } from 'vue-i18n';
|
|
62
|
+
import { useUiId } from '../../app/composables/useUiId';
|
|
63
|
+
import EldraRouterLink from '../../app/components/EldraRouterLink.vue';
|
|
64
|
+
import { isInternalHref, safeHref } from '../../app/utils/links';
|
|
65
|
+
|
|
66
|
+
const props = defineProps<{ entry: EldraBlockEntry<'testimonials'> }>();
|
|
67
|
+
const { data } = useBlockData(props, 'testimonials');
|
|
68
|
+
const { t } = useI18n();
|
|
69
|
+
const isEditing = useEditing();
|
|
70
|
+
const headingId = `testimonials-heading-${useUiId()}`;
|
|
71
|
+
|
|
72
|
+
const variant = computed(() => data.value.variant ?? 'grid');
|
|
73
|
+
const isCarousel = computed(() => variant.value === 'carousel');
|
|
74
|
+
const isSingleLarge = computed(() => variant.value === 'single-large');
|
|
75
|
+
|
|
76
|
+
/** `single-large` defaults to `surface` (spec "Testimonials" → Fields, `sectionBackground` row);
|
|
77
|
+
* every other variant defaults to `none`, same shape as `hero`'s own variant-dependent default. */
|
|
78
|
+
const sectionBackground = computed<SectionBackground>(
|
|
79
|
+
() => data.value.sectionBackground ?? (isSingleLarge.value ? 'surface' : 'none')
|
|
80
|
+
);
|
|
81
|
+
const isInverted = computed(() => sectionBackground.value === 'primary');
|
|
82
|
+
const containerWidth = computed<ContainerWidth>(() => (isSingleLarge.value ? 'content' : 'wide'));
|
|
83
|
+
|
|
84
|
+
const heading = computed(() => (data.value.heading ?? '').trim());
|
|
85
|
+
const hasHeading = computed(() => heading.value !== '');
|
|
86
|
+
const showHeadingHint = computed(() => isEditing.value && !hasHeading.value);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Only labels the outer `Section` for `grid`/`single-large`: `carousel`'s own `Carousel` below
|
|
90
|
+
* already renders a named `role="region"` (`aria-label` — see `carouselAriaLabel`), and naming the
|
|
91
|
+
* `Section` too would give two nested landmarks an identical accessible name (axe
|
|
92
|
+
* `landmark-unique`) — the same reasoning `hero`'s `split-carousel` variant uses. `as="section"`
|
|
93
|
+
* keeps the root a real, `@container`-bearing `<section>` regardless of which branch is active.
|
|
94
|
+
*/
|
|
95
|
+
const sectionLabelledBy = computed(() => (isCarousel.value ? undefined : headingId));
|
|
96
|
+
const carouselAriaLabel = computed(() => heading.value || t('testimonials.carousel'));
|
|
97
|
+
/** Bound below as `:ariaLabel` (camelCase), not `:aria-label` — see `blocks/hero/Block.vue`'s own
|
|
98
|
+
* `carouselAriaLabel` comment: `Carousel`'s `ariaLabel` is a *required* prop, and the kebab→camel
|
|
99
|
+
* prop match Vue applies to a bound attribute is a runtime-only behaviour, invisible to
|
|
100
|
+
* `nuxi typecheck`'s template type-checking. */
|
|
101
|
+
|
|
102
|
+
/** `summary`/`linkLabel`/`linkHref` are not shown in `single-large` (spec's field table, both
|
|
103
|
+
* rows: "Not shown in single-large"). */
|
|
104
|
+
const summary = computed(() => (isSingleLarge.value ? '' : (data.value.summary ?? '').trim()));
|
|
105
|
+
const hasSummary = computed(() => summary.value !== '');
|
|
106
|
+
|
|
107
|
+
const linkHref = computed(() => (isSingleLarge.value ? null : safeHref(data.value.linkHref)));
|
|
108
|
+
const hasLink = computed(() => Boolean(data.value.linkLabel) && linkHref.value !== null);
|
|
109
|
+
const linkAs = computed(() =>
|
|
110
|
+
linkHref.value !== null && isInternalHref(linkHref.value) ? EldraRouterLink : undefined
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const hasHead = computed(
|
|
114
|
+
() =>
|
|
115
|
+
!isSingleLarge.value &&
|
|
116
|
+
(hasHeading.value || hasSummary.value || hasLink.value || showHeadingHint.value)
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
interface TestimonialItem {
|
|
120
|
+
quote?: string;
|
|
121
|
+
name?: string;
|
|
122
|
+
meta?: string;
|
|
123
|
+
avatar?: { url?: string } | null;
|
|
124
|
+
rating?: string;
|
|
125
|
+
productHref?: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function isItemEmpty(item: TestimonialItem): boolean {
|
|
129
|
+
return (item.quote ?? '').trim() === '' && (item.name ?? '').trim() === '';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const allItems = computed<TestimonialItem[]>(() => data.value.items ?? []);
|
|
133
|
+
/** Live: only reviews with content render (Global Constraints, "Editor vs live"); editing: every
|
|
134
|
+
* review renders, so an empty one shows its own hint instead of vanishing — Studio seeds exactly
|
|
135
|
+
* one blank repeater item on insert (spec States → Empty: "the first testimonial"). */
|
|
136
|
+
const renderedItems = computed(() =>
|
|
137
|
+
isEditing.value ? allItems.value : allItems.value.filter((item) => !isItemEmpty(item))
|
|
138
|
+
);
|
|
139
|
+
/** Spec "Testimonials" → Variants, `grid` row: "A single item is centred at max 36rem." */
|
|
140
|
+
const isSingleItem = computed(
|
|
141
|
+
() => !isCarousel.value && !isSingleLarge.value && renderedItems.value.length === 1
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const firstItem = computed<TestimonialItem | undefined>(() => allItems.value[0]);
|
|
145
|
+
const showFirstItemHint = computed(
|
|
146
|
+
() => isEditing.value && (firstItem.value === undefined || isItemEmpty(firstItem.value))
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
/** `rating`'s stored value is the select's string option (`"none"` | `"1"`–`"5"`); `"none"` (and a
|
|
150
|
+
* freshly-inserted item's unset value) hides the row entirely (spec States: "No rating: the
|
|
151
|
+
* rating row is omitted"). */
|
|
152
|
+
function ratingValue(item: TestimonialItem): number | null {
|
|
153
|
+
const raw = item.rating;
|
|
154
|
+
if (raw === undefined || raw === 'none') return null;
|
|
155
|
+
const value = Number(raw);
|
|
156
|
+
return Number.isFinite(value) ? value : null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Spec "Testimonials" → Field → layout mapping: "meta → the meta line (a link when product is
|
|
160
|
+
* set)" — gated on `productHref` alone, not on `productLabel`, which is stored for Studio's own
|
|
161
|
+
* product picker and never rendered directly. */
|
|
162
|
+
function metaHref(item: TestimonialItem): string | null {
|
|
163
|
+
return safeHref(item.productHref);
|
|
164
|
+
}
|
|
165
|
+
function metaLinkAs(item: TestimonialItem) {
|
|
166
|
+
const href = metaHref(item);
|
|
167
|
+
return href !== null && isInternalHref(href) ? EldraRouterLink : undefined;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** See the module doc comment's `gridClass` note: 40rem/60rem are the spec's own literal numbers,
|
|
171
|
+
* not this package's `@tablet`/`@content` (48rem/64rem). */
|
|
172
|
+
const GRID_CLASS =
|
|
173
|
+
'grid grid-cols-1 gap-4 @min-[40rem]:grid-cols-2 @min-[60rem]:grid-cols-3 @min-[60rem]:gap-6';
|
|
174
|
+
|
|
175
|
+
/** Spec "Testimonials" → Card: "`surface` fill (`background` when the section is `surface` or
|
|
176
|
+
* `surface-strong`)" — keeps a card visible against a ground that is itself `surface`-toned. */
|
|
177
|
+
const cardBackgroundClass = computed(() =>
|
|
178
|
+
sectionBackground.value === 'surface' || sectionBackground.value === 'surface-strong'
|
|
179
|
+
? 'bg-background'
|
|
180
|
+
: 'bg-surface'
|
|
181
|
+
);
|
|
182
|
+
</script>
|
|
183
|
+
|
|
184
|
+
<template>
|
|
185
|
+
<Section
|
|
186
|
+
:background="sectionBackground"
|
|
187
|
+
spacing="md"
|
|
188
|
+
as="section"
|
|
189
|
+
:labelled-by="sectionLabelledBy"
|
|
190
|
+
>
|
|
191
|
+
<Container :width="containerWidth">
|
|
192
|
+
<!-- grid / carousel: heading + summary left, link right -->
|
|
193
|
+
<div v-if="hasHead" class="mb-8 flex flex-wrap items-end justify-between gap-x-8 gap-y-4">
|
|
194
|
+
<div class="max-w-[40rem]">
|
|
195
|
+
<h2
|
|
196
|
+
v-if="hasHeading"
|
|
197
|
+
:id="headingId"
|
|
198
|
+
class="font-heading @tablet:text-h2 text-[1.625rem] leading-[1.15] font-bold tracking-[-0.015em]"
|
|
199
|
+
>
|
|
200
|
+
{{ heading }}
|
|
201
|
+
</h2>
|
|
202
|
+
<EditorPlaceholder
|
|
203
|
+
v-else-if="showHeadingHint"
|
|
204
|
+
:id="headingId"
|
|
205
|
+
inline
|
|
206
|
+
:label="t('testimonials.headingHintLabel')"
|
|
207
|
+
:help="t('testimonials.headingHintHelp')"
|
|
208
|
+
/>
|
|
209
|
+
<p v-if="hasSummary" class="mt-2 text-base" :class="isInverted ? '' : 'text-muted'">
|
|
210
|
+
{{ summary }}
|
|
211
|
+
</p>
|
|
212
|
+
</div>
|
|
213
|
+
<Link
|
|
214
|
+
v-if="hasLink"
|
|
215
|
+
:href="linkHref!"
|
|
216
|
+
:as="linkAs"
|
|
217
|
+
variant="standalone"
|
|
218
|
+
arrow
|
|
219
|
+
:underline="false"
|
|
220
|
+
>
|
|
221
|
+
{{ data.linkLabel }}
|
|
222
|
+
</Link>
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
<!-- single-large: the first review only -->
|
|
226
|
+
<div
|
|
227
|
+
v-if="isSingleLarge"
|
|
228
|
+
class="mx-auto flex max-w-[36rem] flex-col items-center gap-6 text-center"
|
|
229
|
+
>
|
|
230
|
+
<h2
|
|
231
|
+
v-if="hasHeading"
|
|
232
|
+
:id="headingId"
|
|
233
|
+
class="text-body-sm font-semibold"
|
|
234
|
+
:class="isInverted ? '' : 'text-muted'"
|
|
235
|
+
>
|
|
236
|
+
{{ heading }}
|
|
237
|
+
</h2>
|
|
238
|
+
<EditorPlaceholder
|
|
239
|
+
v-else-if="showHeadingHint"
|
|
240
|
+
:id="headingId"
|
|
241
|
+
inline
|
|
242
|
+
:label="t('testimonials.headingHintLabel')"
|
|
243
|
+
:help="t('testimonials.headingHintHelp')"
|
|
244
|
+
/>
|
|
245
|
+
|
|
246
|
+
<figure
|
|
247
|
+
v-if="firstItem && !isItemEmpty(firstItem)"
|
|
248
|
+
class="flex flex-col items-center gap-6"
|
|
249
|
+
>
|
|
250
|
+
<Rating
|
|
251
|
+
v-if="ratingValue(firstItem!) !== null"
|
|
252
|
+
:value="ratingValue(firstItem!)!"
|
|
253
|
+
size="lg"
|
|
254
|
+
:count="1"
|
|
255
|
+
:show-value="false"
|
|
256
|
+
:show-count="false"
|
|
257
|
+
/>
|
|
258
|
+
<blockquote
|
|
259
|
+
class="font-heading @tablet:text-[1.75rem] max-w-[36ch] text-[1.375rem] leading-[1.35] font-medium tracking-[-0.01em] text-balance"
|
|
260
|
+
>
|
|
261
|
+
“{{ firstItem!.quote }}”
|
|
262
|
+
</blockquote>
|
|
263
|
+
<figcaption class="flex items-center gap-3 text-left">
|
|
264
|
+
<Avatar :src="firstItem!.avatar?.url" :name="firstItem!.name" size="lg" />
|
|
265
|
+
<div class="min-w-0">
|
|
266
|
+
<cite class="block text-base font-semibold not-italic">{{ firstItem!.name }}</cite>
|
|
267
|
+
<Link
|
|
268
|
+
v-if="firstItem!.meta && metaHref(firstItem!) !== null"
|
|
269
|
+
:href="metaHref(firstItem!)!"
|
|
270
|
+
:as="metaLinkAs(firstItem!)"
|
|
271
|
+
class="text-body-sm"
|
|
272
|
+
>
|
|
273
|
+
{{ firstItem!.meta }}
|
|
274
|
+
</Link>
|
|
275
|
+
<span
|
|
276
|
+
v-else-if="firstItem!.meta"
|
|
277
|
+
class="text-body-sm block"
|
|
278
|
+
:class="isInverted ? '' : 'text-muted'"
|
|
279
|
+
>
|
|
280
|
+
{{ firstItem!.meta }}
|
|
281
|
+
</span>
|
|
282
|
+
</div>
|
|
283
|
+
</figcaption>
|
|
284
|
+
</figure>
|
|
285
|
+
<EditorPlaceholder
|
|
286
|
+
v-else-if="showFirstItemHint"
|
|
287
|
+
inline
|
|
288
|
+
:label="t('testimonials.itemHintLabel')"
|
|
289
|
+
:help="t('testimonials.itemHintHelp')"
|
|
290
|
+
/>
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
<!-- carousel: the same cards inside Carousel -->
|
|
294
|
+
<Carousel
|
|
295
|
+
v-else-if="isCarousel"
|
|
296
|
+
:ariaLabel="carouselAriaLabel"
|
|
297
|
+
controls="below"
|
|
298
|
+
:dots="false"
|
|
299
|
+
draggable
|
|
300
|
+
:per-view="{ base: 1.16, md: 2, lg: 3 }"
|
|
301
|
+
>
|
|
302
|
+
<!--
|
|
303
|
+
The slide (this `<div>`, annotated `role="group"`/`aria-roledescription="slide"` by
|
|
304
|
+
`useCarousel` since it isn't an `<li>`) has to be a different element from the review's
|
|
305
|
+
own `<figure>`: axe's `aria-allowed-role` only allows `figure` to keep its *implicit*
|
|
306
|
+
role once it has a `<figcaption>` child — an explicit `role="group"` on that same element
|
|
307
|
+
is flagged (axe-core's `figure` role data: `allowedRoles: ['doc-example']` whenever
|
|
308
|
+
`hasChild: 'figcaption'`, `true` only for a plain `figure`). The `<figure>` inside keeps
|
|
309
|
+
its own default role untouched.
|
|
310
|
+
-->
|
|
311
|
+
<div v-for="(item, index) in renderedItems" :key="index" class="h-full">
|
|
312
|
+
<figure
|
|
313
|
+
class="group/section flex h-full flex-col gap-5 rounded-lg p-6"
|
|
314
|
+
:class="cardBackgroundClass"
|
|
315
|
+
>
|
|
316
|
+
<template v-if="isEditing && isItemEmpty(item)">
|
|
317
|
+
<EditorPlaceholder
|
|
318
|
+
inline
|
|
319
|
+
:label="t('testimonials.itemHintLabel')"
|
|
320
|
+
:help="t('testimonials.itemHintHelp')"
|
|
321
|
+
/>
|
|
322
|
+
</template>
|
|
323
|
+
<template v-else>
|
|
324
|
+
<Rating
|
|
325
|
+
v-if="ratingValue(item) !== null"
|
|
326
|
+
:value="ratingValue(item)!"
|
|
327
|
+
size="md"
|
|
328
|
+
:count="1"
|
|
329
|
+
:show-value="false"
|
|
330
|
+
:show-count="false"
|
|
331
|
+
/>
|
|
332
|
+
<blockquote class="text-text flex-1 text-[1.125rem] leading-[1.55]">
|
|
333
|
+
{{ item.quote }}
|
|
334
|
+
</blockquote>
|
|
335
|
+
<!-- 0.875rem / 1.4 (the spec's own literal recipe for the attribution row) — the
|
|
336
|
+
`text-body-sm` token is 0.875rem / 1.5, so no token pairs this size with this
|
|
337
|
+
line-height, the same "no matching token" exception `announcement-bar` documents
|
|
338
|
+
for its own bar copy. The block's other 0.875rem sites, which *are* 1.5, use the
|
|
339
|
+
token. -->
|
|
340
|
+
<figcaption class="flex items-center gap-3 text-[0.875rem] leading-[1.4]">
|
|
341
|
+
<Avatar :src="item.avatar?.url" :name="item.name" size="md" />
|
|
342
|
+
<div class="min-w-0">
|
|
343
|
+
<cite class="text-text block font-semibold not-italic">{{ item.name }}</cite>
|
|
344
|
+
<Link
|
|
345
|
+
v-if="item.meta && metaHref(item) !== null"
|
|
346
|
+
:href="metaHref(item)!"
|
|
347
|
+
:as="metaLinkAs(item)"
|
|
348
|
+
tone="muted"
|
|
349
|
+
>
|
|
350
|
+
{{ item.meta }}
|
|
351
|
+
</Link>
|
|
352
|
+
<span v-else-if="item.meta" class="text-muted block">{{ item.meta }}</span>
|
|
353
|
+
</div>
|
|
354
|
+
</figcaption>
|
|
355
|
+
</template>
|
|
356
|
+
</figure>
|
|
357
|
+
</div>
|
|
358
|
+
</Carousel>
|
|
359
|
+
|
|
360
|
+
<!-- grid -->
|
|
361
|
+
<div v-else :class="GRID_CLASS">
|
|
362
|
+
<figure
|
|
363
|
+
v-for="(item, index) in renderedItems"
|
|
364
|
+
:key="index"
|
|
365
|
+
class="group/section flex h-full flex-col gap-5 rounded-lg p-6"
|
|
366
|
+
:class="[cardBackgroundClass, isSingleItem ? 'mx-auto w-full max-w-[36rem]' : '']"
|
|
367
|
+
>
|
|
368
|
+
<template v-if="isEditing && isItemEmpty(item)">
|
|
369
|
+
<EditorPlaceholder
|
|
370
|
+
inline
|
|
371
|
+
:label="t('testimonials.itemHintLabel')"
|
|
372
|
+
:help="t('testimonials.itemHintHelp')"
|
|
373
|
+
/>
|
|
374
|
+
</template>
|
|
375
|
+
<template v-else>
|
|
376
|
+
<Rating
|
|
377
|
+
v-if="ratingValue(item) !== null"
|
|
378
|
+
:value="ratingValue(item)!"
|
|
379
|
+
size="md"
|
|
380
|
+
:count="1"
|
|
381
|
+
:show-value="false"
|
|
382
|
+
:show-count="false"
|
|
383
|
+
/>
|
|
384
|
+
<blockquote class="text-text flex-1 text-[1.125rem] leading-[1.55]">
|
|
385
|
+
{{ item.quote }}
|
|
386
|
+
</blockquote>
|
|
387
|
+
<!-- Same 0.875rem / 1.4 exception as the grid variant above. -->
|
|
388
|
+
<figcaption class="flex items-center gap-3 text-[0.875rem] leading-[1.4]">
|
|
389
|
+
<Avatar :src="item.avatar?.url" :name="item.name" size="md" />
|
|
390
|
+
<div class="min-w-0">
|
|
391
|
+
<cite class="text-text block font-semibold not-italic">{{ item.name }}</cite>
|
|
392
|
+
<Link
|
|
393
|
+
v-if="item.meta && metaHref(item) !== null"
|
|
394
|
+
:href="metaHref(item)!"
|
|
395
|
+
:as="metaLinkAs(item)"
|
|
396
|
+
tone="muted"
|
|
397
|
+
>
|
|
398
|
+
{{ item.meta }}
|
|
399
|
+
</Link>
|
|
400
|
+
<span v-else-if="item.meta" class="text-muted block">{{ item.meta }}</span>
|
|
401
|
+
</div>
|
|
402
|
+
</figcaption>
|
|
403
|
+
</template>
|
|
404
|
+
</figure>
|
|
405
|
+
</div>
|
|
406
|
+
</Container>
|
|
407
|
+
</Section>
|
|
408
|
+
</template>
|