@eldrajs/theme-cli 0.2.8 → 0.2.9

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.
Files changed (163) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/package.json +1 -1
  3. package/template/.eldra/block-types.d.ts +28 -7
  4. package/template/.eldra/manifest.json +1034 -355
  5. package/template/.eldra/previews.json +35 -35
  6. package/template/README.md +32 -0
  7. package/template/app/assets/main.css +23 -0
  8. package/template/app/plugins/eldra-storefront.ts +3 -0
  9. package/template/app/storefront/demo.ts +75 -24
  10. package/template/app/storefront/gateway.ts +16 -2
  11. package/template/blocks/announcement-bar/preview.png +0 -0
  12. package/template/blocks/article/preview.json +4 -4
  13. package/template/blocks/article/preview.png +0 -0
  14. package/template/blocks/article-list/Block.vue +48 -19
  15. package/template/blocks/article-list/__tests__/Block.spec.ts +15 -0
  16. package/template/blocks/article-list/preview.json +43 -43
  17. package/template/blocks/article-list/preview.png +0 -0
  18. package/template/blocks/breadcrumbs/preview.png +0 -0
  19. package/template/blocks/cart/preview.png +0 -0
  20. package/template/blocks/collection-grid/Block.vue +260 -9
  21. package/template/blocks/collection-grid/__tests__/Block.spec.ts +202 -0
  22. package/template/blocks/collection-grid/block.json +3 -3
  23. package/template/blocks/collection-grid/preview.png +0 -0
  24. package/template/blocks/collection-header/Block.vue +65 -52
  25. package/template/blocks/collection-header/preview.json +4 -4
  26. package/template/blocks/collection-header/preview.png +0 -0
  27. package/template/blocks/contact/preview.png +0 -0
  28. package/template/blocks/cta/preview.json +4 -4
  29. package/template/blocks/cta/preview.png +0 -0
  30. package/template/blocks/faq/preview.png +0 -0
  31. package/template/blocks/feature-grid/Block.vue +73 -4
  32. package/template/blocks/feature-grid/__tests__/Block.spec.ts +43 -1
  33. package/template/blocks/feature-grid/block.json +2 -2
  34. package/template/blocks/feature-grid/preview.json +49 -24
  35. package/template/blocks/feature-grid/preview.png +0 -0
  36. package/template/blocks/footer/Block.vue +186 -71
  37. package/template/blocks/footer/__tests__/Block.spec.ts +127 -32
  38. package/template/blocks/footer/block.json +42 -4
  39. package/template/blocks/footer/mock.json +31 -34
  40. package/template/blocks/footer/preview.png +0 -0
  41. package/template/blocks/form/preview.png +0 -0
  42. package/template/blocks/gallery/preview.json +24 -24
  43. package/template/blocks/gallery/preview.png +0 -0
  44. package/template/blocks/hero/Block.vue +117 -19
  45. package/template/blocks/hero/__tests__/Block.spec.ts +46 -0
  46. package/template/blocks/hero/block.json +36 -1
  47. package/template/blocks/hero/preview.json +33 -25
  48. package/template/blocks/hero/preview.png +0 -0
  49. package/template/blocks/image/preview.json +4 -4
  50. package/template/blocks/image/preview.png +0 -0
  51. package/template/blocks/logo-cloud/preview.png +0 -0
  52. package/template/blocks/navigation/Block.vue +622 -184
  53. package/template/blocks/navigation/__tests__/Block.spec.ts +406 -68
  54. package/template/blocks/navigation/__tests__/fixtures/menu.json +182 -0
  55. package/template/blocks/navigation/block.json +102 -6
  56. package/template/blocks/navigation/mock.json +279 -52
  57. package/template/blocks/navigation/preview.json +311 -0
  58. package/template/blocks/navigation/preview.png +0 -0
  59. package/template/blocks/newsletter/Block.vue +248 -144
  60. package/template/blocks/newsletter/__tests__/Block.spec.ts +42 -0
  61. package/template/blocks/newsletter/block.json +61 -2
  62. package/template/blocks/newsletter/preview.json +35 -0
  63. package/template/blocks/newsletter/preview.png +0 -0
  64. package/template/blocks/order-status/preview.png +0 -0
  65. package/template/blocks/pricing-table/preview.png +0 -0
  66. package/template/blocks/product-carousel/Block.vue +272 -26
  67. package/template/blocks/product-carousel/__tests__/Block.spec.ts +90 -0
  68. package/template/blocks/product-carousel/block.json +61 -0
  69. package/template/blocks/product-carousel/preview.json +12 -0
  70. package/template/blocks/product-carousel/preview.png +0 -0
  71. package/template/blocks/product-detail/Block.vue +148 -96
  72. package/template/blocks/product-detail/__tests__/Block.spec.ts +98 -74
  73. package/template/blocks/product-detail/block.json +11 -4
  74. package/template/blocks/product-detail/mock.json +53 -22
  75. package/template/blocks/product-detail/parts/Gallery.vue +52 -103
  76. package/template/blocks/product-detail/preview.png +0 -0
  77. package/template/blocks/quote/preview.png +0 -0
  78. package/template/blocks/rich-text/preview.png +0 -0
  79. package/template/blocks/search/Block.vue +1 -0
  80. package/template/blocks/search/TypeSection.vue +1 -0
  81. package/template/blocks/search/__tests__/Block.spec.ts +23 -0
  82. package/template/blocks/search/preview.png +0 -0
  83. package/template/blocks/split-content/Block.vue +98 -20
  84. package/template/blocks/split-content/__tests__/Block.spec.ts +57 -18
  85. package/template/blocks/split-content/block.json +72 -6
  86. package/template/blocks/split-content/preview.json +34 -13
  87. package/template/blocks/split-content/preview.png +0 -0
  88. package/template/blocks/stats/preview.png +0 -0
  89. package/template/blocks/tabs/preview.json +16 -16
  90. package/template/blocks/tabs/preview.png +0 -0
  91. package/template/blocks/team/preview.png +0 -0
  92. package/template/blocks/testimonials/preview.png +0 -0
  93. package/template/blocks/timeline/preview.png +0 -0
  94. package/template/blocks/trust-strip/Block.vue +67 -1
  95. package/template/blocks/trust-strip/__tests__/Block.spec.ts +30 -1
  96. package/template/blocks/trust-strip/block.json +4 -4
  97. package/template/blocks/trust-strip/preview.json +21 -0
  98. package/template/blocks/trust-strip/preview.png +0 -0
  99. package/template/blocks/video-embed/preview.png +0 -0
  100. package/template/blocks/wishlist/preview.png +0 -0
  101. package/template/i18n/en-US.json +16 -9
  102. package/template/i18n/is-IS.json +16 -9
  103. package/template/pages/article.page.json +19 -18
  104. package/template/pages/cart.page.json +3 -13
  105. package/template/pages/category.page.json +15 -7
  106. package/template/pages/collection.page.json +15 -14
  107. package/template/pages/home.page.json +217 -182
  108. package/template/pages/product.page.json +46 -36
  109. package/template/pages/products.page.json +3 -13
  110. package/template/pages/search.page.json +3 -13
  111. package/template/pages/wishlist.page.json +3 -13
  112. package/template/public/images/CREDITS.md +28 -0
  113. package/template/public/images/clay-hands.webp +0 -0
  114. package/template/public/images/coffee-table.webp +0 -0
  115. package/template/public/images/cup.webp +0 -0
  116. package/template/public/images/enamel-cups.webp +0 -0
  117. package/template/public/images/hero.webp +0 -0
  118. package/template/public/images/kitchen.webp +0 -0
  119. package/template/public/images/mug.webp +0 -0
  120. package/template/public/images/northwind-mark.svg +1 -0
  121. package/template/public/images/planters.webp +0 -0
  122. package/template/public/images/plates.webp +0 -0
  123. package/template/public/images/reading.webp +0 -0
  124. package/template/public/images/sweater.webp +0 -0
  125. package/template/public/images/terracotta.webp +0 -0
  126. package/template/public/images/throws.webp +0 -0
  127. package/template/public/images/vase.webp +0 -0
  128. package/template/public/images/wheel.webp +0 -0
  129. package/template/public/images/yarn-tools.webp +0 -0
  130. package/template/public/images/yarn.webp +0 -0
  131. package/template/stories/generated/collection-grid.stories.ts +6 -0
  132. package/template/stories/generated/feature-grid.stories.ts +6 -0
  133. package/template/stories/generated/footer.stories.ts +4 -4
  134. package/template/stories/generated/hero.stories.ts +6 -0
  135. package/template/stories/generated/navigation.stories.ts +14 -1
  136. package/template/stories/generated/newsletter.stories.ts +2 -1
  137. package/template/stories/generated/product-carousel.stories.ts +12 -0
  138. package/template/stories/generated/split-content.stories.ts +12 -0
  139. package/template/stories/generated/trust-strip.stories.ts +8 -1
  140. package/template/stories/pages/article.stories.ts +2 -1
  141. package/template/stories/pages/cart.stories.ts +2 -1
  142. package/template/stories/pages/category.stories.ts +2 -1
  143. package/template/stories/pages/collection.stories.ts +2 -1
  144. package/template/stories/pages/home.stories.ts +2 -1
  145. package/template/stories/pages/product.stories.ts +2 -1
  146. package/template/stories/pages/products.stories.ts +2 -1
  147. package/template/stories/pages/search.stories.ts +2 -1
  148. package/template/stories/pages/wishlist.stories.ts +2 -1
  149. package/template/stories/support/demoChrome.ts +32 -0
  150. package/template/stories/support/pageBlocks.ts +2 -4
  151. package/template/test/countPill.browser.spec.ts +21 -13
  152. package/template/test/localePrefix.spec.ts +11 -6
  153. package/template/test/pages/article.spec.ts +1 -1
  154. package/template/test/pages/category.spec.ts +34 -11
  155. package/template/test/pages/collection.spec.ts +182 -148
  156. package/template/test/pages/home.spec.ts +35 -40
  157. package/template/test/pages/hydration.spec.ts +4 -4
  158. package/template/test/pages/product.spec.ts +17 -14
  159. package/template/test/pages/seededPages.spec.ts +11 -6
  160. package/template/test/prerenderRefresh.browser.spec.ts +36 -15
  161. package/template/test/starter.spec.ts +31 -15
  162. package/template/test/storefront/gatewayPrerender.spec.ts +26 -0
  163. package/template/tokens.json +13 -13
@@ -11,9 +11,14 @@
11
11
  * section. With neither, the editor sees the "Choose a product" placeholder and the live site
12
12
  * renders nothing (Global Constraints, "Editor vs live").
13
13
  *
14
+ * **The layout** is an image mosaic beside a sticky buy panel from 60rem of the block's width,
15
+ * stacked below it: the panel carries the option pills, a pill-shaped quantity stepper with Add to
16
+ * cart and the heart, the delivery promises (`perks`) as a ruled list, and the `tabs` entries as an
17
+ * accordion with the first row open.
18
+ *
14
19
  * **`gallery-right` mirrors visually only.** The gallery is first in the DOM in both variants and
15
- * only the `@tablet:order-*` utilities swap the columns, so reading and focus order never change
16
- * (spec Variants, `gallery-right` row).
20
+ * only the `@min-[60rem]:order-*` utilities swap the columns, so reading and focus order never
21
+ * change (spec Variants, `gallery-right` row).
17
22
  *
18
23
  * **The buy area is a real `<form>`**, the way a storefront's add-to-cart form always is: the
19
24
  * pickers are its radio groups, the stepper its quantity field and Add to cart its submit button,
@@ -36,6 +41,8 @@
36
41
  */
37
42
  import { computed, nextTick, onMounted, ref, watch } from 'vue';
38
43
  import {
44
+ Accordion,
45
+ AccordionItem,
39
46
  Badge,
40
47
  Button,
41
48
  Container,
@@ -50,9 +57,6 @@ import {
50
57
  Rating,
51
58
  Section,
52
59
  StockBadge,
53
- Tab,
54
- TabPanel,
55
- Tabs,
56
60
  VariantPicker,
57
61
  useToast,
58
62
  type FormLayoutSubmitPayload,
@@ -626,25 +630,54 @@ async function submitNotify(payload: FormLayoutSubmitPayload): Promise<void> {
626
630
  /* Presentation */
627
631
  /* ------------------------------------------------------------------------- */
628
632
 
629
- /** Spec Container/Section line: 1rem top below 48rem block width, 2rem from 48rem, `section-md`
630
- * bottom — `Section`'s own `spacing` steps are symmetrical, so the block sets its own halves
631
- * through the sanctioned `classes` prop. */
632
- const SECTION_SPACING = 'pt-4 @tablet:pt-8 pb-[var(--eldra-section-md)]';
633
+ /** 1rem top below 48rem block width, 1.5rem from it, 4rem bottom — the design's own steps, which
634
+ * `Section`'s symmetrical `spacing` presets do not carry, so the block sets its own halves. */
635
+ const SECTION_SPACING = 'pt-4 @tablet:pt-6 pb-16';
633
636
 
634
- /** Spec Layout: the `h1` is "styled at the h2 scale" — 1.625rem, stepping up to the `text-h2`
635
- * token's own 2rem from 64rem. */
636
- const TITLE_CLASS =
637
- 'font-heading text-[1.625rem] leading-[1.15] font-bold tracking-[-0.015em] text-balance ' +
638
- '@content:text-h2';
637
+ /** Two columns from 60rem of the block's width (the design's 960px edge, so a tablet gets the
638
+ * stacked page): the mosaic a little wider than the buy panel. */
639
+ const LAYOUT_CLASS =
640
+ 'grid grid-cols-1 gap-8 @min-[60rem]:grid-cols-[minmax(0,1.25fr)_minmax(0,1fr)] ' +
641
+ '@min-[60rem]:items-start @min-[60rem]:gap-14';
639
642
 
640
- const quantityStepperClasses = { decrease: 'size-12', increase: 'size-12', input: 'h-12' };
643
+ /** The title: the serif at 2.25rem, 2.5rem from 48rem. */
644
+ const TITLE_CLASS =
645
+ 'font-heading text-[2.25rem] leading-[1.08] font-medium tracking-[-0.015em] text-balance ' +
646
+ '@tablet:text-[2.5rem]';
641
647
 
642
- const tabsRoot = ref<HTMLElement | null>(null);
643
- useRichTextScrollRegions(tabsRoot, (caption) => caption ?? t('product.tabsLabel'));
648
+ /** A pill-shaped stepper at the Add to cart button's own 3.25rem height. */
649
+ const quantityStepperClasses = {
650
+ decrease: 'h-13 w-11 aspect-auto',
651
+ increase: 'h-13 w-11 aspect-auto',
652
+ input: 'h-13 w-9',
653
+ };
654
+ const QUANTITY_STEPPER_CLASS = '[--eldra-stepper-radius:var(--eldra-radius-full)]';
644
655
 
645
- function tabValue(index: number): string {
646
- return String(index);
647
- }
656
+ /**
657
+ * Option pills. The package's colour swatch is a bare disc with its name kept for assistive
658
+ * technology only; here each colour reads as a pill — disc and name — the way the size pills read,
659
+ * so a shopper never has to guess a colour from a 2.75rem dot. All of it through `classes`: the
660
+ * swatch's own name is un-hidden (`not-sr-only`), the drawn radio grows to fit it, and the resting
661
+ * ring is a 1px `border-strong` line that becomes the package's own 2px `text` ring when checked
662
+ * (the padding steps by the same 1px, so the pill never changes size).
663
+ */
664
+ const SWATCH_PILL_CLASSES = {
665
+ radio:
666
+ 'size-auto h-11 justify-start gap-2 ps-1.5 pe-4 ' +
667
+ 'not-has-checked:[--eldra-variant-swatch-ring-width:1px] not-has-checked:border-border-strong ' +
668
+ 'not-has-checked:ps-[calc(0.375rem+1px)] not-has-checked:pe-[calc(1rem+1px)]',
669
+ swatch: 'size-7 shrink-0',
670
+ // The sold-out stroke crosses the disc only, never the name beside it.
671
+ soldOutLine: 'inset-auto start-[calc(0.375rem+1px)] top-1/2 size-7 -translate-y-1/2',
672
+ label: 'not-sr-only text-[0.9375rem] font-medium whitespace-nowrap',
673
+ };
674
+ const PILL_CLASSES = { radio: 'rounded-full min-h-11 px-5' };
675
+
676
+ /** Which accordion rows are open: the first one, as the design opens Details. */
677
+ const openSections = ref<boolean[]>([true]);
678
+
679
+ const detailsRoot = ref<HTMLElement | null>(null);
680
+ useRichTextScrollRegions(detailsRoot, (caption) => caption ?? t('product.tabsLabel'));
648
681
  </script>
649
682
 
650
683
  <template>
@@ -655,42 +688,40 @@ function tabValue(index: number): string {
655
688
  :aria-busy="refreshing ? 'true' : undefined"
656
689
  :class="SECTION_SPACING"
657
690
  >
658
- <Container width="content">
659
- <div
660
- class="@tablet:grid-cols-[7fr_5fr] @tablet:items-start @tablet:gap-8 @content:gap-12 grid gap-6"
661
- >
691
+ <Container width="wide">
692
+ <div :class="LAYOUT_CLASS">
662
693
  <!-- Gallery first in the DOM in both variants; only the order utilities mirror. -->
663
694
  <Gallery
664
- class="@tablet:sticky @tablet:top-6"
665
- :class="galleryRight ? '@tablet:order-2' : '@tablet:order-1'"
695
+ :class="galleryRight ? '@min-[60rem]:order-2' : '@min-[60rem]:order-1'"
666
696
  :images="product.images"
667
697
  :title="product.title"
668
698
  :on-sale="onSale"
669
699
  />
670
700
 
701
+ <!-- The buy panel stays in view beside a tall mosaic from 60rem. -->
671
702
  <div
672
703
  role="group"
673
704
  :aria-label="t('product.information')"
674
- class="flex flex-col gap-6"
675
- :class="galleryRight ? '@tablet:order-1' : '@tablet:order-2'"
705
+ class="flex flex-col gap-5 @min-[60rem]:sticky @min-[60rem]:top-[calc(1.5rem_+_var(--eldra-header-height,0px))]"
706
+ :class="galleryRight ? '@min-[60rem]:order-1' : '@min-[60rem]:order-2'"
676
707
  >
677
- <div class="flex flex-col gap-2">
678
- <!--
679
- One label, not a trail, and deliberately not a `<nav>`: a second landmark named
680
- "Breadcrumb" beside the `breadcrumbs` block's own is the duplication this used to
681
- ship (see `categoryLeaf`). It stays a link because the destination is useful — the
682
- catalogue filtered by that category — and `p` rather than a bare `Link` so the line
683
- keeps its own type size whatever the link's tone does.
684
- -->
685
- <p v-if="showCategory && categoryLeaf !== null" class="text-[0.875rem]">
686
- <Link :href="categoryLeaf.href" :as="EldraRouterLink" tone="muted">
687
- {{ categoryLeaf.label }}
688
- </Link>
689
- </p>
708
+ <!--
709
+ One label, not a trail, and deliberately not a `<nav>`: a second landmark named
710
+ "Breadcrumb" beside the `breadcrumbs` block's own is the duplication this used to
711
+ ship (see `categoryLeaf`). It stays a link because the destination is useful — the
712
+ catalogue filtered by that category — and `p` rather than a bare `Link` so the line
713
+ keeps its own type size whatever the link's tone does.
714
+ -->
715
+ <p v-if="showCategory && categoryLeaf !== null" class="-mb-3 text-[0.875rem]">
716
+ <Link :href="categoryLeaf.href" :as="EldraRouterLink" tone="muted">
717
+ {{ categoryLeaf.label }}
718
+ </Link>
719
+ </p>
720
+
721
+ <h1 :id="titleId" :class="TITLE_CLASS">{{ product.title }}</h1>
690
722
 
691
- <h1 :id="titleId" :class="TITLE_CLASS">{{ product.title }}</h1>
692
-
693
- <div class="mt-2 flex flex-wrap items-center gap-x-4 gap-y-2">
723
+ <div class="flex flex-col gap-2">
724
+ <div class="flex flex-wrap items-baseline gap-x-3 gap-y-2">
694
725
  <p v-if="notSold" class="text-text" data-eldra-not-sold>
695
726
  {{ t('currency.notSoldInLong', { currency: shopperCurrency }) }}
696
727
  </p>
@@ -704,25 +735,25 @@ function tabValue(index: number): string {
704
735
  "
705
736
  :currency="product.price.currency"
706
737
  :revalidating="priceRevalidating"
738
+ :classes="{ current: 'text-[1.5rem] font-semibold' }"
707
739
  />
708
740
  <Badge
709
741
  v-if="saving && !notSold"
710
742
  variant="sale"
711
743
  :label="t('product.saving', { amount: saving })"
712
744
  />
713
- <Rating
714
- v-if="showRating && rating"
715
- :value="rating.value"
716
- :count="rating.count"
717
- href="#reviews"
718
- :as="EldraRouterLink"
719
- />
745
+ <span class="text-muted text-[0.875rem]">{{ t('product.taxNote') }}</span>
720
746
  </div>
721
-
722
- <p class="text-muted text-[0.875rem]">{{ t('product.taxNote') }}</p>
747
+ <Rating
748
+ v-if="showRating && rating"
749
+ :value="rating.value"
750
+ :count="rating.count"
751
+ href="#reviews"
752
+ :as="EldraRouterLink"
753
+ />
723
754
  </div>
724
755
 
725
- <hr class="border-border" />
756
+ <p v-if="product.description" class="text-muted">{{ product.description }}</p>
726
757
 
727
758
  <form class="flex flex-col gap-5" @submit.prevent="primaryAction">
728
759
  <!--
@@ -755,6 +786,7 @@ function tabValue(index: number): string {
755
786
  :legend="option.label"
756
787
  :type="option.type"
757
788
  :options="option.values"
789
+ :classes="option.type === 'swatches' ? SWATCH_PILL_CLASSES : PILL_CLASSES"
758
790
  />
759
791
  <Link
760
792
  v-if="optionIndex === sizeGuideOptionIndex && sizeGuideHref"
@@ -780,26 +812,34 @@ function tabValue(index: number): string {
780
812
  }}</span>
781
813
  </p>
782
814
 
783
- <FieldWrapper
784
- v-if="showQuantity && !soldOut && !notSold"
785
- :label="t('product.quantity')"
786
- class="gap-2"
787
- >
788
- <QuantityStepper
789
- v-model="quantity"
790
- name="quantity"
791
- :max="stockLine.max"
792
- :classes="quantityStepperClasses"
793
- />
794
- </FieldWrapper>
795
-
796
- <div class="grid grid-cols-[1fr_auto] items-center gap-3">
797
- <div ref="addToCartEl" class="contents">
815
+ <!-- Stepper, Add to cart and the heart on one row; below 48rem the button takes a row
816
+ of its own under the other two (`order`, visual only: the DOM keeps quantity →
817
+ add → save, the order a keyboard walks). -->
818
+ <div class="@tablet:flex-nowrap flex flex-wrap items-center gap-3">
819
+ <FieldWrapper
820
+ v-if="showQuantity && !soldOut && !notSold"
821
+ :label="t('product.quantity')"
822
+ class="shrink-0"
823
+ :classes="{ label: 'sr-only' }"
824
+ >
825
+ <QuantityStepper
826
+ v-model="quantity"
827
+ name="quantity"
828
+ :max="stockLine.max"
829
+ :class="QUANTITY_STEPPER_CLASS"
830
+ :classes="quantityStepperClasses"
831
+ />
832
+ </FieldWrapper>
833
+ <div
834
+ ref="addToCartEl"
835
+ class="@tablet:order-none @tablet:basis-auto order-last min-w-0 flex-1 basis-full"
836
+ >
798
837
  <Button
799
838
  type="submit"
800
839
  variant="primary"
801
840
  size="lg"
802
841
  block
842
+ class="rounded-full"
803
843
  :loading="cartBusy"
804
844
  :disabled="notSoldAnywhere"
805
845
  :label="addToCartLabel"
@@ -816,6 +856,7 @@ function tabValue(index: number): string {
816
856
  icon-only
817
857
  variant="outline"
818
858
  size="lg"
859
+ class="shrink-0 rounded-full"
819
860
  :pressed="wishlisted"
820
861
  :label="wishlistLabel"
821
862
  @click="toggleWishlist"
@@ -833,41 +874,52 @@ function tabValue(index: number): string {
833
874
  <ul
834
875
  v-if="perks.length > 0"
835
876
  role="list"
836
- class="bg-surface flex flex-col gap-3 rounded-lg p-4"
877
+ class="border-border divide-border divide-y rounded-lg border"
837
878
  >
838
- <li v-for="(perk, index) in perks" :key="index" class="flex gap-3 text-[0.875rem]">
839
- <EldraIcon v-if="perk.icon" :name="perk.icon" size="md" class="text-text shrink-0" />
840
- <div class="min-w-0">
841
- <p class="font-semibold">{{ perk.title }}</p>
842
- <p v-if="perk.text" class="text-muted">{{ perk.text }}</p>
843
- </div>
879
+ <li
880
+ v-for="(perk, index) in perks"
881
+ :key="index"
882
+ class="flex items-start gap-3 px-4 py-3.5 text-[0.9375rem]"
883
+ >
884
+ <EldraIcon
885
+ v-if="perk.icon"
886
+ :name="perk.icon"
887
+ size="md"
888
+ class="text-primary mt-0.5 shrink-0"
889
+ />
890
+ <p class="min-w-0">
891
+ <b class="font-semibold">{{ perk.title }}</b
892
+ >{{ perk.text ? ` ${perk.text}` : '' }}
893
+ </p>
844
894
  </li>
845
895
  </ul>
846
896
 
847
- <div v-if="tabs.length > 0" ref="tabsRoot">
848
- <Tabs variant="underline" :ariaLabel="t('product.tabsLabel')">
849
- <template #tabs>
850
- <Tab
851
- v-for="(tab, index) in tabs"
852
- :key="index"
853
- :value="tabValue(index)"
854
- :title="tab.label"
855
- />
856
- </template>
857
- <TabPanel v-for="(tab, index) in tabs" :key="index" :value="tabValue(index)">
858
- <!-- A `Tab` label is a button, not a heading, so the nearest heading above a
859
- panel is this block's own `h1` (the product title) — the panel body's headings
860
- therefore start at `h2`. Floored at 2 rather than 3 on purpose: with no `h2`
861
- in between, an `h3` straight after the `h1` would be a level skip. -->
897
+ <!-- The details as an accordion, Details open: each row a native disclosure, so the
898
+ keyboard and assistive technology get the browser's own behaviour. -->
899
+ <div v-if="tabs.length > 0" ref="detailsRoot" class="border-border border-t">
900
+ <Accordion>
901
+ <AccordionItem
902
+ v-for="(tab, index) in tabs"
903
+ :key="index"
904
+ v-model="openSections[index]"
905
+ :title="tab.label!"
906
+ :heading-level="2"
907
+ :classes="{
908
+ summary: 'min-h-13 px-0',
909
+ title: 'text-body font-semibold font-body',
910
+ panel: 'px-0 pb-5 text-muted',
911
+ }"
912
+ >
913
+ <!-- Under this row's own `h2`, so the body's headings start at `h3`. -->
862
914
  <EldraRichText
863
915
  class="prose-eldra [&>*+*]:mt-3"
864
916
  :entry-id="entryId"
865
917
  :field="`tabs.${index}.body`"
866
918
  :doc="tab.body"
867
- :min-heading-level="2"
919
+ :min-heading-level="3"
868
920
  />
869
- </TabPanel>
870
- </Tabs>
921
+ </AccordionItem>
922
+ </Accordion>
871
923
  </div>
872
924
  </div>
873
925
  </div>
@@ -920,7 +972,7 @@ function tabValue(index: number): string {
920
972
  </Section>
921
973
 
922
974
  <Section v-else-if="showStatus" spacing="none" :class="SECTION_SPACING">
923
- <Container width="content">
975
+ <Container width="wide">
924
976
  <p role="status" class="text-muted">
925
977
  {{ productResult.error.value ? t('storefront.error') : t('storefront.loading') }}
926
978
  </p>
@@ -931,7 +983,7 @@ function tabValue(index: number): string {
931
983
  editor hint below, because on a live page this is what a visitor who followed an old link
932
984
  sees and the hint is not for them. -->
933
985
  <Section v-else-if="notFound" spacing="none" :class="SECTION_SPACING">
934
- <Container width="content">
986
+ <Container width="wide">
935
987
  <p role="status" class="text-muted">{{ t('storefront.notFound') }}</p>
936
988
  </Container>
937
989
  </Section>
@@ -3,7 +3,7 @@ import { flushPromises, mount } from '@vue/test-utils';
3
3
  import { computed, defineComponent, h, nextTick, ref, watch } from 'vue';
4
4
  import { ELDRA_KEY, type EldraLocaleState } from '@eldrajs/theme-vue';
5
5
  import { EldraHttpError } from '@eldrajs/sdk';
6
- import { useToast, type ToastAction } from '@eldrajs/ui';
6
+ import { Lightbox, useToast, type ToastAction } from '@eldrajs/ui';
7
7
  import { afterEach, describe, expect, it, vi } from 'vitest';
8
8
  import { axe } from '../../../test/support/axe';
9
9
  import { mountOptions } from '../../../test/support/mountBlock';
@@ -106,13 +106,10 @@ async function mountReady(
106
106
 
107
107
  type Wrapper = Awaited<ReturnType<typeof mountReady>>;
108
108
 
109
- /** The gallery's own strip. Scoped by its name so the `Lightbox`'s own thumbnails ("Go to image n")
110
- * are never counted once the viewer is open. */
111
- function thumbnails(wrapper: Wrapper) {
112
- return wrapper.findAll('button[aria-label^="Show image"]');
113
- }
114
- function zoomButton(wrapper: Wrapper) {
115
- return wrapper.get('button[aria-haspopup="dialog"]');
109
+ /** The mosaic's own tiles. Scoped by their name so the `Lightbox`'s own thumbnails ("Go to image
110
+ * n") are never counted once the viewer is open. */
111
+ function tiles(wrapper: Wrapper) {
112
+ return wrapper.findAll('button[aria-label^="Open image"]');
116
113
  }
117
114
  function lightbox(wrapper: Wrapper) {
118
115
  return wrapper.get('dialog[aria-label="Merino crew sweater, images"]');
@@ -397,14 +394,14 @@ describe('product-detail block', () => {
397
394
  expect(wrapper.text()).toContain('Merino crew sweater');
398
395
  expect(wrapper.text()).toContain('$96.00');
399
396
  expect(wrapper.text()).toContain('Knitwear');
400
- expect(wrapper.text()).toContain('Free delivery over $80.');
397
+ expect(wrapper.text()).toContain('Free delivery on orders over $80');
401
398
  expect(await axe(wrapper.element)).toHaveNoViolations();
402
399
  });
403
400
 
404
401
  it('renders the bare fixture — no perks, no tabs, no size guide — axe-clean', async () => {
405
402
  const wrapper = await mountReady(bare);
406
403
  expect(wrapper.text()).toContain('Merino crew sweater');
407
- expect(wrapper.find('[role="tablist"]').exists()).toBe(false);
404
+ expect(wrapper.find('details').exists()).toBe(false);
408
405
  expect(wrapper.text()).not.toContain('Size guide');
409
406
  expect(await axe(wrapper.element)).toHaveNoViolations();
410
407
  });
@@ -424,11 +421,12 @@ describe('product-detail block', () => {
424
421
  gallery.element.compareDocumentPosition(info.element) & Node.DOCUMENT_POSITION_FOLLOWING
425
422
  ).toBeTruthy();
426
423
  // … only which column each one is painted in.
424
+ // The two columns start at 60rem (the design's own edge), so that is where they mirror.
427
425
  expect(gallery.classes()).toContain(
428
- variant === 'gallery-right' ? '@tablet:order-2' : '@tablet:order-1'
426
+ variant === 'gallery-right' ? '@min-[60rem]:order-2' : '@min-[60rem]:order-1'
429
427
  );
430
428
  expect(info.classes()).toContain(
431
- variant === 'gallery-right' ? '@tablet:order-1' : '@tablet:order-2'
429
+ variant === 'gallery-right' ? '@min-[60rem]:order-1' : '@min-[60rem]:order-2'
432
430
  );
433
431
  }
434
432
  });
@@ -585,62 +583,78 @@ describe('product-detail block', () => {
585
583
  expect(wrapper.find('nav[aria-label="Breadcrumb"]').exists()).toBe(false);
586
584
  });
587
585
 
586
+ /**
587
+ * The gallery is a mosaic now: every image on the page at once, each one a button that opens the
588
+ * viewer at itself. The thumbnail strip, its "current" marker, the index pill and the single zoom
589
+ * button went with the single stage they served.
590
+ */
588
591
  describe('gallery', () => {
589
- it('names every thumbnail by position and alt text, marking the current one', async () => {
592
+ it('draws every image as a tile named by position and alt text, the first one wide', async () => {
590
593
  const wrapper = await mountReady(mock);
591
- const buttons = thumbnails(wrapper);
592
- expect(buttons.length).toBeGreaterThan(1);
594
+ const buttons = tiles(wrapper);
595
+ expect(buttons).toHaveLength(3);
596
+ const alts = [
597
+ 'Merino crew sweater',
598
+ 'Merino crew sweater, alternate view',
599
+ 'Merino crew sweater, in use',
600
+ ];
593
601
  buttons.forEach((button, index) => {
594
602
  expect(button.attributes('aria-label')).toBe(
595
- `Show image ${index + 1} of ${buttons.length}: ${
596
- index === 0 ? 'Merino crew sweater' : 'Merino crew sweater, alternate view'
597
- }`
603
+ `Open image ${index + 1} of ${buttons.length}: ${alts[index]}`
598
604
  );
605
+ expect(button.attributes('aria-haspopup')).toBe('dialog');
606
+ // The photo inside is decorative: the button already says what it shows.
607
+ expect(button.get('img').attributes('alt')).toBe('');
599
608
  });
600
- expect(buttons[0]!.attributes('aria-current')).toBe('true');
601
- expect(buttons[1]!.attributes('aria-current')).toBeUndefined();
602
609
  });
603
610
 
604
- it('moves the current thumbnail, the index pill and the zoom name together', async () => {
605
- const wrapper = await mountReady(mock);
606
- const buttons = thumbnails(wrapper);
607
- expect(zoomButton(wrapper).attributes('aria-label')).toBe(
608
- `Zoom image 1 of ${buttons.length}`
609
- );
610
- expect(wrapper.text()).toContain(`1 / ${buttons.length}`);
611
-
612
- await buttons[1]!.trigger('click');
613
- expect(thumbnails(wrapper)[1]!.attributes('aria-current')).toBe('true');
614
- expect(thumbnails(wrapper)[0]!.attributes('aria-current')).toBeUndefined();
615
- expect(zoomButton(wrapper).attributes('aria-label')).toBe(
616
- `Zoom image 2 of ${buttons.length}`
617
- );
618
- expect(wrapper.text()).toContain(`2 / ${buttons.length}`);
611
+ it('lays two images side by side, and leads with a wide one from three', async () => {
612
+ const spans = async (count: number) => {
613
+ const images = Array.from({ length: count }, (_, index) => ({
614
+ src: `/images/tile-${index}.webp`,
615
+ alt: `Tile ${index + 1}`,
616
+ width: 1200,
617
+ height: 1500,
618
+ }));
619
+ const wrapper = mountBlock(mock, { storefront: storefrontWith({ images }) });
620
+ await flushPromises();
621
+ await nextTick();
622
+ return tiles(wrapper).map((tile) => tile.element.parentElement!.className);
623
+ };
624
+ expect(await spans(1)).toEqual([expect.stringContaining('col-span-2')]);
625
+ expect((await spans(2)).every((span) => span.includes('col-span-1'))).toBe(true);
626
+ const three = await spans(3);
627
+ expect(three.map((span) => span.includes('col-span-2'))).toEqual([true, false, false]);
628
+ // An odd one out at the end spans the row, so the mosaic closes square.
629
+ const four = await spans(4);
630
+ expect(four.map((span) => span.includes('col-span-2'))).toEqual([true, false, false, true]);
619
631
  });
620
632
 
621
- it('opens the viewer from zoom, arrows between images, and Esc returns focus', async () => {
633
+ it('opens the viewer at the tile pressed, with zoom, arrows between images, and Esc returns focus', async () => {
622
634
  const wrapper = await mountReady(mock);
623
- const zoom = zoomButton(wrapper);
624
- zoom.element.focus();
625
- await zoom.trigger('click');
635
+ const second = tiles(wrapper)[1]!;
636
+ second.element.focus();
637
+ await second.trigger('click');
626
638
  await nextTick();
627
639
 
628
640
  const dialog = lightbox(wrapper);
629
641
  expect(dialog.attributes('open')).toBe('');
630
642
  expect(await axe(wrapper.element)).toHaveNoViolations();
631
643
 
632
- const count = thumbnails(wrapper).length;
633
- expect(dialog.text()).toContain(`1 / ${count}`);
634
- await dialog.trigger('keydown', { key: 'ArrowRight' });
644
+ const count = tiles(wrapper).length;
635
645
  expect(dialog.text()).toContain(`2 / ${count}`);
646
+ // `zoom` is on, so a photo larger than it is shown can be enlarged and panned.
647
+ expect(wrapper.findComponent(Lightbox).props('zoom')).toBe(true);
636
648
  await dialog.trigger('keydown', { key: 'ArrowLeft' });
637
649
  expect(dialog.text()).toContain(`1 / ${count}`);
650
+ await dialog.trigger('keydown', { key: 'ArrowRight' });
651
+ expect(dialog.text()).toContain(`2 / ${count}`);
638
652
 
639
653
  document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));
640
654
  await new Promise((resolve) => setTimeout(resolve));
641
655
  await nextTick();
642
656
  expect(lightbox(wrapper).attributes('open')).toBeUndefined();
643
- expect(document.activeElement).toBe(zoom.element);
657
+ expect(document.activeElement).toBe(second.element);
644
658
  });
645
659
  });
646
660
 
@@ -1286,48 +1300,58 @@ describe('product-detail block', () => {
1286
1300
  });
1287
1301
  });
1288
1302
 
1289
- describe('tabs', () => {
1290
- it('renders one tab per entry, only the selected one in the tab order', async () => {
1303
+ /** The `tabs` entries render as an accordion now (the design's Details / Care / Delivery and
1304
+ * returns rows), the first one open — each row a native disclosure. */
1305
+ describe('details accordion', () => {
1306
+ const rows = (wrapper: Wrapper) => wrapper.findAll('details');
1307
+ const summaries = (wrapper: Wrapper) => wrapper.findAll('details > summary');
1308
+
1309
+ it('renders one row per entry under an h2 each, only the first open', async () => {
1291
1310
  const wrapper = await mountReady(mock);
1292
- const tabs = wrapper.findAll('[role="tab"]');
1293
- expect(tabs.map((tab) => tab.text())).toEqual(['Details', 'Shipping', 'Returns']);
1294
- expect(tabs.map((tab) => tab.attributes('tabindex'))).toEqual(['0', '-1', '-1']);
1295
- expect(wrapper.get('[role="tablist"]').attributes('aria-label')).toBe('Product details');
1296
- expect(wrapper.text()).toContain('extra-fine Merino in a family mill in Biella');
1311
+ expect(summaries(wrapper).map((summary) => summary.text())).toEqual([
1312
+ 'Details',
1313
+ 'Care',
1314
+ 'Delivery and returns',
1315
+ ]);
1316
+ expect(rows(wrapper).map((row) => row.attributes('open') !== undefined)).toEqual([
1317
+ true,
1318
+ false,
1319
+ false,
1320
+ ]);
1321
+ expect(summaries(wrapper).map((summary) => summary.find('h2').text())).toEqual([
1322
+ 'Details',
1323
+ 'Care',
1324
+ 'Delivery and returns',
1325
+ ]);
1326
+ expect(wrapper.text()).toContain('100% extra-fine Merino wool');
1297
1327
  });
1298
1328
 
1299
- it('moves between tabs with arrows (wrapping) and Home/End', async () => {
1329
+ it('opens and closes a row from the keyboard, its summary being the one tab stop', async () => {
1300
1330
  const wrapper = await mountReady(mock);
1301
- const tabs = () => wrapper.findAll('[role="tab"]');
1302
- await tabs()[0]!.trigger('keydown', { key: 'ArrowRight' });
1303
- expect(tabs()[1]!.attributes('aria-selected')).toBe('true');
1304
- await tabs()[1]!.trigger('keydown', { key: 'ArrowLeft' });
1305
- expect(tabs()[0]!.attributes('aria-selected')).toBe('true');
1306
- // Wraps backwards from the first to the last.
1307
- await tabs()[0]!.trigger('keydown', { key: 'ArrowLeft' });
1308
- expect(tabs()[2]!.attributes('aria-selected')).toBe('true');
1309
- await tabs()[2]!.trigger('keydown', { key: 'Home' });
1310
- expect(tabs()[0]!.attributes('aria-selected')).toBe('true');
1311
- await tabs()[0]!.trigger('keydown', { key: 'End' });
1312
- expect(tabs()[2]!.attributes('aria-selected')).toBe('true');
1331
+ const care = summaries(wrapper)[1]!;
1332
+ (care.element as HTMLElement).focus();
1333
+ expect(document.activeElement).toBe(care.element);
1334
+ // A browser turns Enter/Space on a focused <summary> into a click that toggles its <details>.
1335
+ await care.trigger('click');
1336
+ await nextTick();
1337
+ expect(rows(wrapper)[1]!.attributes('open')).toBeDefined();
1338
+ await care.trigger('click');
1339
+ await nextTick();
1340
+ expect(rows(wrapper)[1]!.attributes('open')).toBeUndefined();
1313
1341
  });
1314
1342
 
1315
- it('keeps every panel reachable by keyboard', async () => {
1343
+ it('stays axe-clean with every row open', async () => {
1316
1344
  const wrapper = await mountReady(mock);
1317
- const panels = wrapper.findAll('[role="tabpanel"]');
1318
- expect(panels).toHaveLength(3);
1319
- // Panels with no focusable content of their own carry `tabindex="0"` so the text is
1320
- // reachable (`TabPanel`'s own rule); these three are plain prose.
1321
- for (const panel of panels) expect(panel.attributes('tabindex')).toBe('0');
1345
+ for (const summary of summaries(wrapper).slice(1)) await summary.trigger('click');
1346
+ await nextTick();
1347
+ expect(await axe(wrapper.element)).toHaveNoViolations();
1322
1348
  });
1323
1349
 
1324
- it('puts Add to cart before the tabs in reading order', async () => {
1350
+ it('puts Add to cart before the details in reading order', async () => {
1325
1351
  const wrapper = await mountReady(mock);
1326
1352
  const button = addToCart(wrapper).element;
1327
- const tablist = wrapper.get('[role="tablist"]').element;
1328
- expect(
1329
- button.compareDocumentPosition(tablist) & Node.DOCUMENT_POSITION_FOLLOWING
1330
- ).toBeTruthy();
1353
+ const first = summaries(wrapper)[0]!.element;
1354
+ expect(button.compareDocumentPosition(first) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
1331
1355
  });
1332
1356
  });
1333
1357