@eldrajs/theme-cli 0.2.9 → 0.2.11

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 (169) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/package.json +3 -3
  3. package/template/.eldra/block-types.d.ts +4 -6
  4. package/template/.eldra/manifest.json +228 -246
  5. package/template/.eldra/previews.json +35 -35
  6. package/template/.storybook/eldra.ts +7 -2
  7. package/template/app/assets/main.css +5 -0
  8. package/template/app/composables/useBlockData.ts +9 -2
  9. package/template/app/composables/usePriceTokens.ts +150 -0
  10. package/template/app/composables/useQuickAdd.ts +95 -0
  11. package/template/app/composables/useRegionalFormat.ts +94 -0
  12. package/template/app/icons.ts +4 -0
  13. package/template/app/plugins/eldra-storefront.ts +2 -0
  14. package/template/app/plugins/eldra-ui-messages.ts +22 -8
  15. package/template/app/storefront/demo.ts +188 -16
  16. package/template/app/storefront/gateway.ts +19 -0
  17. package/template/app/storefront/productCardLook.ts +76 -0
  18. package/template/app/storefront/productReference.ts +17 -0
  19. package/template/app/storefront/toProductCard.ts +12 -8
  20. package/template/app/storefront/types.ts +17 -0
  21. package/template/blocks/announcement-bar/__tests__/Block.spec.ts +19 -7
  22. package/template/blocks/announcement-bar/block.json +2 -1
  23. package/template/blocks/announcement-bar/mock.json +1 -1
  24. package/template/blocks/announcement-bar/preview.png +0 -0
  25. package/template/blocks/article/Block.vue +8 -18
  26. package/template/blocks/article/block.json +3 -1
  27. package/template/blocks/article/preview.png +0 -0
  28. package/template/blocks/article-list/block.json +10 -1
  29. package/template/blocks/article-list/preview.png +0 -0
  30. package/template/blocks/breadcrumbs/Block.vue +15 -3
  31. package/template/blocks/breadcrumbs/__tests__/Block.spec.ts +13 -0
  32. package/template/blocks/breadcrumbs/block.json +1 -0
  33. package/template/blocks/breadcrumbs/preview.png +0 -0
  34. package/template/blocks/cart/Block.vue +15 -5
  35. package/template/blocks/cart/__tests__/Block.spec.ts +53 -10
  36. package/template/blocks/cart/__tests__/ShippingBar.spec.ts +10 -8
  37. package/template/blocks/cart/block.json +8 -5
  38. package/template/blocks/cart/mock.json +2 -2
  39. package/template/blocks/cart/parts/ShippingBar.vue +24 -30
  40. package/template/blocks/cart/parts/notSold.ts +4 -3
  41. package/template/blocks/collection-grid/Block.vue +168 -85
  42. package/template/blocks/collection-grid/__tests__/Block.spec.ts +101 -23
  43. package/template/blocks/collection-grid/preview.png +0 -0
  44. package/template/blocks/collection-header/Block.vue +51 -17
  45. package/template/blocks/collection-header/__tests__/Block.spec.ts +80 -4
  46. package/template/blocks/collection-header/block.json +2 -0
  47. package/template/blocks/collection-header/preview.png +0 -0
  48. package/template/blocks/contact/block.json +4 -0
  49. package/template/blocks/contact/preview.png +0 -0
  50. package/template/blocks/cta/block.json +2 -0
  51. package/template/blocks/faq/Block.vue +5 -10
  52. package/template/blocks/faq/block.json +2 -1
  53. package/template/blocks/faq/mock.json +12 -1
  54. package/template/blocks/faq/preview.png +0 -0
  55. package/template/blocks/feature-grid/__tests__/Block.spec.ts +30 -7
  56. package/template/blocks/feature-grid/block.json +3 -2
  57. package/template/blocks/feature-grid/mock.json +1 -1
  58. package/template/blocks/feature-grid/preview.png +0 -0
  59. package/template/blocks/footer/Block.vue +64 -21
  60. package/template/blocks/footer/__tests__/Block.spec.ts +97 -1
  61. package/template/blocks/footer/block.json +5 -2
  62. package/template/blocks/footer/mock.json +1 -1
  63. package/template/blocks/footer/preview.png +0 -0
  64. package/template/blocks/form/block.json +1 -0
  65. package/template/blocks/gallery/preview.png +0 -0
  66. package/template/blocks/hero/Block.vue +38 -9
  67. package/template/blocks/hero/__tests__/Block.spec.ts +71 -19
  68. package/template/blocks/hero/block.json +16 -22
  69. package/template/blocks/hero/preview.json +1 -3
  70. package/template/blocks/hero/preview.png +0 -0
  71. package/template/blocks/image/block.json +2 -1
  72. package/template/blocks/image/preview.png +0 -0
  73. package/template/blocks/logo-cloud/block.json +1 -0
  74. package/template/blocks/logo-cloud/preview.png +0 -0
  75. package/template/blocks/navigation/Block.vue +405 -159
  76. package/template/blocks/navigation/__tests__/Block.spec.ts +816 -172
  77. package/template/blocks/navigation/__tests__/currentItem.spec.ts +90 -0
  78. package/template/blocks/navigation/block.json +2 -11
  79. package/template/blocks/navigation/mock.json +3 -3
  80. package/template/blocks/navigation/parts/LocalePicker.vue +103 -0
  81. package/template/blocks/navigation/parts/currentItem.ts +82 -0
  82. package/template/blocks/navigation/preview.json +7 -1
  83. package/template/blocks/navigation/preview.png +0 -0
  84. package/template/blocks/newsletter/Block.vue +6 -2
  85. package/template/blocks/newsletter/block.json +2 -0
  86. package/template/blocks/newsletter/preview.png +0 -0
  87. package/template/blocks/order-status/Block.vue +8 -17
  88. package/template/blocks/order-status/block.json +3 -0
  89. package/template/blocks/order-status/preview.png +0 -0
  90. package/template/blocks/pricing-table/__tests__/Block.spec.ts +12 -4
  91. package/template/blocks/pricing-table/block.json +2 -0
  92. package/template/blocks/pricing-table/mock.json +6 -6
  93. package/template/blocks/pricing-table/preview.png +0 -0
  94. package/template/blocks/product-carousel/Block.vue +36 -126
  95. package/template/blocks/product-carousel/__tests__/Block.spec.ts +88 -0
  96. package/template/blocks/product-carousel/block.json +1 -0
  97. package/template/blocks/product-carousel/preview.png +0 -0
  98. package/template/blocks/product-detail/Block.vue +84 -31
  99. package/template/blocks/product-detail/__tests__/Block.spec.ts +86 -0
  100. package/template/blocks/product-detail/__tests__/specs.spec.ts +79 -0
  101. package/template/blocks/product-detail/block.json +3 -1
  102. package/template/blocks/product-detail/mock.json +54 -4
  103. package/template/blocks/product-detail/parts/Gallery.vue +8 -2
  104. package/template/blocks/product-detail/preview.png +0 -0
  105. package/template/blocks/product-detail/specs.ts +75 -0
  106. package/template/blocks/quote/block.json +1 -0
  107. package/template/blocks/rich-text/preview.png +0 -0
  108. package/template/blocks/search/Block.vue +6 -1
  109. package/template/blocks/search/TypeSection.vue +8 -1
  110. package/template/blocks/search/__tests__/Block.spec.ts +24 -1
  111. package/template/blocks/search/block.json +1 -0
  112. package/template/blocks/search/preview.png +0 -0
  113. package/template/blocks/split-content/Block.vue +12 -5
  114. package/template/blocks/split-content/__tests__/Block.spec.ts +13 -0
  115. package/template/blocks/split-content/block.json +4 -2
  116. package/template/blocks/split-content/preview.png +0 -0
  117. package/template/blocks/stats/preview.png +0 -0
  118. package/template/blocks/tabs/Block.vue +3 -4
  119. package/template/blocks/tabs/block.json +1 -1
  120. package/template/blocks/tabs/preview.png +0 -0
  121. package/template/blocks/team/block.json +3 -1
  122. package/template/blocks/team/preview.png +0 -0
  123. package/template/blocks/testimonials/block.json +2 -0
  124. package/template/blocks/testimonials/preview.png +0 -0
  125. package/template/blocks/timeline/block.json +2 -1
  126. package/template/blocks/timeline/preview.png +0 -0
  127. package/template/blocks/trust-strip/Block.vue +2 -2
  128. package/template/blocks/trust-strip/__tests__/Block.spec.ts +38 -9
  129. package/template/blocks/trust-strip/block.json +1 -1
  130. package/template/blocks/trust-strip/mock.json +1 -1
  131. package/template/blocks/trust-strip/preview.json +1 -1
  132. package/template/blocks/trust-strip/preview.png +0 -0
  133. package/template/blocks/video-embed/block.json +2 -0
  134. package/template/blocks/video-embed/preview.png +0 -0
  135. package/template/blocks/wishlist/Block.vue +2 -2
  136. package/template/blocks/wishlist/preview.png +0 -0
  137. package/template/i18n/en-US.json +13 -5
  138. package/template/i18n/is-IS.json +12 -4
  139. package/template/pages/article.page.json +1 -3
  140. package/template/pages/cart.page.json +1 -3
  141. package/template/pages/category.page.json +2 -4
  142. package/template/pages/collection.page.json +1 -3
  143. package/template/pages/home.page.json +7 -18
  144. package/template/pages/product.page.json +62 -131
  145. package/template/pages/products.page.json +1 -3
  146. package/template/pages/search.page.json +1 -3
  147. package/template/pages/wishlist.page.json +1 -3
  148. package/template/stories/generated/footer.stories.ts +6 -0
  149. package/template/stories/generated/navigation.stories.ts +0 -18
  150. package/template/test/inlineEditable.spec.ts +10 -2
  151. package/template/test/localePrefix.spec.ts +2 -19
  152. package/template/test/pages/article.spec.ts +0 -2
  153. package/template/test/pages/category.spec.ts +35 -13
  154. package/template/test/pages/home.spec.ts +33 -17
  155. package/template/test/pages/product.spec.ts +64 -44
  156. package/template/test/pages/ssr.spec.ts +3 -1
  157. package/template/test/prerenderRefresh.browser.spec.ts +30 -25
  158. package/template/test/previewParity.browser.spec.ts +36 -2
  159. package/template/test/priceTokens.spec.ts +309 -0
  160. package/template/test/regionalFormat.spec.ts +80 -0
  161. package/template/test/starter.spec.ts +23 -7
  162. package/template/test/storefront/demo.spec.ts +19 -18
  163. package/template/test/storefront/toProductCard.spec.ts +17 -2
  164. package/template/test/structuredData.generate.spec.ts +4 -2
  165. package/template/test/support/mockGateway.ts +21 -1
  166. package/template/test/support/mountBlock.ts +25 -4
  167. package/template/test/support/priceTokens.ts +20 -0
  168. package/template/test/uiMessagesPlugin.spec.ts +34 -1
  169. package/template/tokens.json +8 -8
@@ -4,47 +4,43 @@
4
4
  * `02-blocks.md` "Cart" → States, "Free shipping pending"/"Free shipping unlocked"; Accessibility:
5
5
  * "The shipping message is `role="status"` … The bar is `aria-hidden`").
6
6
  *
7
- * The threshold is a CMS string in major units ("80.00") and so is every cart amount
7
+ * The threshold is the store's own (`freeShippingThreshold` from its delivery methods, in the
8
+ * cart's currency; `blocks/cart/Block.vue`), in major units like every cart amount
8
9
  * (`app/storefront/types.ts`), so the two compare directly and only the `<Price>` below converts
9
- * (`money.minor`, because `@eldrajs/ui` money inputs read minor units).
10
- * An empty, non-numeric or non-positive threshold renders nothing at all (spec Fields table:
11
- * "Empty hides the shipping bar"), which is also what keeps a mistyped field from drawing a bar
12
- * that would claim the shopper is 0 away from anything.
10
+ * (`money.minor`, because `@eldrajs/ui` money inputs read minor units). No threshold, or a
11
+ * non-positive one, renders nothing at all, which also keeps the bar from claiming the shopper is
12
+ * 0 away from anything.
13
13
  *
14
14
  * The remaining amount is a real `<Price>` inside the sentence, not a formatted string spliced into
15
- * the translation: `awayParts` interpolates the message once against a sentinel and splits the
16
- * *result* around it, so the words either side stay translated and the money keeps the store's own
17
- * currency and locale formatting (the same technique `blocks/article/Block.vue` uses to put a
18
- * `<Link>` inside its byline). `Price`'s root is a `<p>`, so the row's own text is `<span>`s beside
19
- * it rather than a paragraph wrapping it — a `<p>` inside a `<p>` is not valid HTML.
15
+ * the translation: vue-i18n's `Translation` fills `{amount}` from a slot, so the words either side
16
+ * stay translated, the amount sits where each language puts it, and the money keeps the store's
17
+ * own currency and locale formatting. No `tag`: `Price`'s root is a `<p>`, and a `<p>` inside a
18
+ * `<span>` is not valid HTML, so the words and the price render straight into the status row.
20
19
  */
21
20
  import { computed } from 'vue';
22
21
  import { Price } from '@eldrajs/ui';
23
- import { useI18n } from 'vue-i18n';
22
+ import { Translation, useI18n } from 'vue-i18n';
24
23
  import { roundMoney, useMoney } from '../../../app/storefront/money';
25
24
  import EldraIcon from '../../../app/components/EldraIcon.vue';
26
25
 
27
26
  const props = withDefaults(
28
27
  defineProps<{
29
- /** The `freeShippingThreshold` field, in major units. Empty/invalid renders nothing. */
30
- threshold?: string;
28
+ /** The store's free-shipping threshold in the cart's currency, major units. `null` renders nothing. */
29
+ threshold?: number | null;
31
30
  /** The cart subtotal, in major units. */
32
31
  subtotal: number;
33
32
  /** `edge` spans the drawer edge to edge on `surface`; `card` is the page's rounded panel. */
34
33
  panel?: 'edge' | 'card';
35
34
  }>(),
36
- { threshold: undefined, panel: 'card' }
35
+ { threshold: null, panel: 'card' }
37
36
  );
38
37
 
39
38
  const { t } = useI18n();
40
39
  const money = useMoney();
41
40
 
42
41
  const thresholdAmount = computed<number | null>(() => {
43
- const raw = (props.threshold ?? '').trim();
44
- if (raw === '') return null;
45
- const amount = Number(raw);
46
- if (!Number.isFinite(amount) || amount <= 0) return null;
47
- return amount;
42
+ const amount = props.threshold;
43
+ return typeof amount === 'number' && Number.isFinite(amount) && amount > 0 ? amount : null;
48
44
  });
49
45
 
50
46
  const remaining = computed(() =>
@@ -60,15 +56,11 @@ const percent = computed(() => {
60
56
  });
61
57
 
62
58
  /**
63
- * The message is read *un-interpolated* and split on its own `{amount}` placeholder, so the
64
- * translated words either side of the money can render as text and the amount itself as a `<Price>`
65
- * (`useT()` returns the template verbatim when it is called with no params).
59
+ * The message's `{amount}` is filled by `Translation`'s `amount` slot, so the money renders as a
60
+ * `<Price>` wherever the translation puts it ("You're {amount} away…", "Þú ert {amount} frá…").
61
+ * Reading the template with no params and splitting it does not work: vue-i18n fills a missing
62
+ * `{amount}` with nothing, so there is no slot left to split on and the price lands at the end.
66
63
  */
67
- const AMOUNT_SLOT = '{amount}';
68
- const awayParts = computed(() => {
69
- const [before = '', after = ''] = t('cart.awayFromFree').split(AMOUNT_SLOT);
70
- return { before: before.trim(), after: after.trim() };
71
- });
72
64
 
73
65
  const rootClass = computed(() =>
74
66
  props.panel === 'edge'
@@ -89,9 +81,11 @@ const rootClass = computed(() =>
89
81
  <span>{{ t('cart.freeUnlocked') }}</span>
90
82
  </template>
91
83
  <template v-else>
92
- <span>{{ awayParts.before }}</span>
93
- <Price :amount="money.minor(remaining)" class="inline font-semibold" />
94
- <span>{{ awayParts.after }}</span>
84
+ <Translation keypath="cart.awayFromFree" scope="global">
85
+ <template #amount
86
+ ><Price :amount="money.minor(remaining)" class="inline font-semibold"
87
+ /></template>
88
+ </Translation>
95
89
  </template>
96
90
  </div>
97
91
  <div aria-hidden="true" class="bg-surface-strong mt-2 h-1 w-full overflow-hidden rounded-full">
@@ -1,13 +1,14 @@
1
1
  import { computed, type ComputedRef } from 'vue';
2
- import { useEldraUiLocale } from '@eldrajs/ui';
3
2
  import { listFormat } from '@eldrajs/sdk/format/list';
4
3
  import { useI18n } from 'vue-i18n';
5
4
  import type { CartStore } from '../../../app/storefront/cart';
6
5
 
7
6
  /** "Walnut spoon can't be bought in EUR.": the cart's lines with no price in its currency, named. */
8
7
  export function useNotSoldSentence(cart: CartStore): ComputedRef<string> {
9
- const { t } = useI18n();
10
- const locale = useEldraUiLocale();
8
+ // The list's "and" is a word of the sentence, so it follows the content locale (`useI18n`), not
9
+ // the regional format `useEldraUiLocale()` answers for numbers and dates — an English page of an
10
+ // Icelandic store says "Spoon and Bowl", not "Spoon og Bowl".
11
+ const { t, locale } = useI18n();
11
12
  return computed(() =>
12
13
  t('currency.cartNotSold', {
13
14
  currency: cart.currency.value ?? '',
@@ -83,11 +83,13 @@ import { useEditing } from '../../app/composables/useEditing';
83
83
  import { iconComponent } from '../../app/composables/iconComponent';
84
84
  import { useRevalidating } from '../../app/composables/useRevalidating';
85
85
  import { useStorefront } from '../../app/composables/useStorefront';
86
- import { useI18n } from 'vue-i18n';
86
+ import { useQuickAdd } from '../../app/composables/useQuickAdd';
87
+ import { I18nT, useI18n } from 'vue-i18n';
87
88
  import { useUiId } from '../../app/composables/useUiId';
88
89
  import EldraIcon from '../../app/components/EldraIcon.vue';
89
90
  import EldraRouterLink from '../../app/components/EldraRouterLink.vue';
90
91
  import { toProductCardEntries } from '../../app/storefront/toProductCard';
92
+ import { productCardLook } from '../../app/storefront/productCardLook';
91
93
  import { useMoney } from '../../app/storefront/money';
92
94
  import {
93
95
  collectionSelector,
@@ -141,6 +143,12 @@ const SortIcon = iconComponent('arrows-sort');
141
143
  * would push the second column off the edge. The track decides the width here, as in the carousel.
142
144
  */
143
145
  const CARD_CLASS = 'min-w-0';
146
+ /**
147
+ * The grid is its own stacking context, so nothing a card lifts — its badges, its "+ Add" (both
148
+ * `z-10`) — can rise above the sticky filter bar (also `z-10`, but earlier in the page) as the
149
+ * grid scrolls under it (WS-1277).
150
+ */
151
+ const GRID_LAYER_CLASS = 'isolate';
144
152
  /** The freshly-inserted editor hint's box icon (spec States, "Empty (freshly inserted)"). */
145
153
  const BoxIcon = iconComponent('box');
146
154
 
@@ -159,6 +167,8 @@ const { data } = useBlockData(props, 'collection-grid');
159
167
  const editing = useEditing();
160
168
  const { t } = useI18n();
161
169
  const storefront = useStorefront();
170
+ /** "+ Add" on each card: the shared quick add (`app/composables/useQuickAdd.ts`). */
171
+ const quickAdd = useQuickAdd();
162
172
  const route = storefront.route;
163
173
 
164
174
  const uid = useUiId();
@@ -1251,6 +1261,18 @@ function publishState(): void {
1251
1261
  route.setQuery(patch);
1252
1262
  }
1253
1263
 
1264
+ /** The count's number on its own, for the filter bar's bold "**N** products" — `null` whenever
1265
+ * `countText` says something else (updating, or the singular, which has no number slot). */
1266
+ const barCountNumber = computed<string | null>(() =>
1267
+ showSkeletons.value || updating.value || total.value === 1 ? null : String(total.value)
1268
+ );
1269
+ /** The design's paging row (`.nw-loadmore`): the status at body size, and its large outline
1270
+ * button — 3rem tall, as the design draws it, not the theme's 3.25rem `control-h-lg`. */
1271
+ const LOAD_MORE_CLASSES = {
1272
+ status: 'text-body',
1273
+ button: 'h-12 px-6 text-button-lg',
1274
+ };
1275
+
1254
1276
  const countText = computed(() => {
1255
1277
  if (showSkeletons.value || updating.value) return t('grid.updating');
1256
1278
  if (total.value === 1) return t('grid.oneProduct');
@@ -1488,6 +1510,12 @@ const BAR_CHIP_BASE =
1488
1510
  'motion-safe:duration-fast disabled:cursor-not-allowed disabled:opacity-50';
1489
1511
  const BAR_CHIP_ON = `${BAR_CHIP_BASE} bg-text text-background border-text`;
1490
1512
  const BAR_CHIP_OFF = `${BAR_CHIP_BASE} border-border-strong text-text hover:bg-surface`;
1513
+ /** The bar's sort below 64rem: a pill the height and outline of the filter chips beside it. */
1514
+ const SORT_SELECT_CLASSES = {
1515
+ trigger:
1516
+ '@max-content:min-h-10 @max-content:h-10 @max-content:rounded-full @max-content:border-border-strong @max-content:ps-3.5 @max-content:pe-3 @max-content:text-[0.9375rem] @max-content:font-medium',
1517
+ leadingIcon: '@content:hidden',
1518
+ };
1491
1519
  const BAR_POPOVER_CLASSES = {
1492
1520
  panel: 'w-[20rem] max-w-[calc(100vw-2rem)] max-h-[min(30rem,70vh)] overflow-y-auto px-4 pb-2',
1493
1521
  };
@@ -1659,14 +1687,15 @@ onUnmounted(() => {
1659
1687
  // ---------------------------------------------------------------------------------------------
1660
1688
 
1661
1689
  /**
1662
- * The shared product grid (spec "Product grid", 3040): 2 columns below 48rem with 2rem × 1rem
1690
+ * The shared product grid (spec "Product grid", 3040): 1 column below 23.25rem (372px) (a card half of a
1691
+ * phone that narrow is too small to read, WS-1277), 2 columns up to 48rem with 2rem × 1rem
1663
1692
  * gaps; from 48rem 3 (or 2), gaps 3rem × 1.5rem — the 4-column setting shows 3 here; `columns` from
1664
1693
  * 64rem. Static strings from a lookup, so Tailwind emits every one of them.
1665
1694
  */
1666
1695
  const GRID_COLUMNS: Record<string, string> = {
1667
- '2': 'grid-cols-2',
1668
- '3': 'grid-cols-2 @tablet:grid-cols-3',
1669
- '4': 'grid-cols-2 @tablet:grid-cols-3 @content:grid-cols-4',
1696
+ '2': 'grid-cols-1 @min-[23.25rem]:grid-cols-2',
1697
+ '3': 'grid-cols-1 @min-[23.25rem]:grid-cols-2 @tablet:grid-cols-3',
1698
+ '4': 'grid-cols-1 @min-[23.25rem]:grid-cols-2 @tablet:grid-cols-3 @content:grid-cols-4',
1670
1699
  };
1671
1700
  const gridClass: ComputedRef<string> = computed(
1672
1701
  () =>
@@ -1677,9 +1706,37 @@ const gridClass: ComputedRef<string> = computed(
1677
1706
  * Filter button — the "empty optional parts render nothing" rule, so the grid simply gets the
1678
1707
  * whole width. */
1679
1708
  const showSidebar = computed(() => hasSidebar.value && filterFacets.value.length > 0);
1709
+
1710
+ /**
1711
+ * The sticky filter rail, from 64rem. Two things make it usable on a real screen, and both broke
1712
+ * once (WS-1277): it was a sticky box as tall as its content, so a rail longer than the viewport
1713
+ * could never show its lower groups — a sticky element taller than the viewport only reveals its
1714
+ * bottom once the grid beside it has scrolled out — and it sat `--eldra-header-height` below the
1715
+ * top even with the header slid away.
1716
+ *
1717
+ * - **It scrolls itself.** Capped at the viewport less its own top offset and the same 1.5rem at
1718
+ * the bottom (`dvh`, so a phone-sized browser's toolbar is accounted for), with its own
1719
+ * `overflow-y: auto`; `overscroll-contain` keeps a wheel at its end from scrolling the page. The
1720
+ * `-m-1 p-1` pair gives every control's focus ring room inside the scroll box, which would
1721
+ * otherwise clip it at the rail's edges.
1722
+ * - **It follows the header.** `--eldra-header-height` is the header's *visible* height —
1723
+ * `navigation` publishes 0 while its bar is slid out of view — so the rail settles 1.5rem from the
1724
+ * viewport's top then and 1.5rem under the bar when it is back; `top` and `max-height`
1725
+ * transition on the same `duration-base` the bar slides with, so the two move together.
1726
+ */
1727
+ const SIDEBAR_CLASS =
1728
+ 'hidden @content:block @content:sticky @content:-m-1 @content:p-1 ' +
1729
+ '@content:top-[calc(1.5rem_+_var(--eldra-header-height,0px))] ' +
1730
+ '@content:max-h-[calc(100dvh_-_3rem_-_var(--eldra-header-height,0px))] ' +
1731
+ '@content:overflow-y-auto @content:overscroll-contain ' +
1732
+ 'motion-safe:transition-[top,max-height] motion-safe:duration-base';
1680
1733
  const hasFilters = computed(() => filterFacets.value.length > 0);
1681
1734
  const hasSort = computed(() => sortOptions.value.length > 0);
1682
1735
  const showTopBar = computed(() => hasFilters.value || hasSort.value);
1736
+ /** Any chip in the bar: the sort is set off from them by a rule while they scroll. */
1737
+ const barHasChips = computed(
1738
+ () => barPopoverFacets.value.length > 0 || barToggleFacets.value.length > 0
1739
+ );
1683
1740
 
1684
1741
  const layoutClass = computed(() =>
1685
1742
  showSidebar.value
@@ -1753,11 +1810,7 @@ function hrefForPage(page: number): string {
1753
1810
 
1754
1811
  <template v-else>
1755
1812
  <div :class="layoutClass">
1756
- <aside
1757
- v-if="showSidebar"
1758
- :aria-label="t('grid.filters')"
1759
- class="@content:block @content:sticky @content:top-[calc(1.5rem_+_var(--eldra-header-height,0px))] hidden"
1760
- >
1813
+ <aside v-if="showSidebar" :aria-label="t('grid.filters')" :class="SIDEBAR_CLASS">
1761
1814
  <!-- The panel's own head (`show-head`, the default) draws a visible "Filters" `h2`
1762
1815
  right before its `h3` group triggers, which is what keeps a whole-page axe run's
1763
1816
  `heading-order` rule happy under the page's own `h1` — no hidden heading to add
@@ -1780,91 +1833,112 @@ function hrefForPage(page: number): string {
1780
1833
  <div class="min-w-0">
1781
1834
  <!-- The filter bar (`filter-bar`): a chip per group, the pressed on/off chips and the
1782
1835
  sort, one row that wraps on a narrow screen and stays in view while the grid
1783
- scrolls from 48rem. -->
1836
+ scrolls from 48rem — right under the header while it shows, at the viewport's top
1837
+ while it is slid away (`--eldra-header-height` is the visible height), moving
1838
+ with the bar's own slide. -->
1784
1839
  <template v-if="isBar">
1785
1840
  <div
1786
1841
  v-if="showTopBar"
1787
1842
  role="group"
1788
1843
  :aria-label="t('grid.filterAndSort')"
1789
- class="border-border bg-background @tablet:sticky @tablet:top-[var(--eldra-header-height,0px)] @tablet:z-10 flex flex-wrap items-center gap-2 border-y py-3.5"
1844
+ class="border-border bg-background @tablet:sticky @tablet:top-[var(--eldra-header-height,0px)] @tablet:z-10 motion-safe:duration-base @content:gap-x-6 flex items-center gap-x-3 border-y py-3.5 motion-safe:transition-[top]"
1790
1845
  >
1791
- <Popover
1792
- v-for="facet in barPopoverFacets"
1793
- :key="facet.id"
1794
- role="dialog"
1795
- haspopup="dialog"
1796
- placement="bottom-start"
1797
- :aria-label="facet.label"
1798
- :classes="BAR_POPOVER_CLASSES"
1846
+ <!-- Below 64rem the chips are one line that scrolls sideways rather than wrapping
1847
+ into a stack, with the sort pinned at the end so it is always in reach; from
1848
+ 64rem they wrap as one row with the sort at the right. Every chip's popover is
1849
+ teleported, so the scroller clips none of them. -->
1850
+ <div
1851
+ data-eldra-filter-bar-chips
1852
+ class="@max-content:overflow-x-auto @max-content:[mask-image:linear-gradient(to_right,black_calc(100%-2rem),transparent)] @max-content:pe-6 @max-content:[scrollbar-width:none] @max-content:[&::-webkit-scrollbar]:hidden @content:flex-wrap -my-1 flex min-w-0 flex-1 items-center gap-2 py-1"
1799
1853
  >
1800
- <template #trigger="{ attrs, open }">
1801
- <button v-bind="attrs" :class="open ? BAR_CHIP_ON : BAR_CHIP_OFF">
1802
- {{ facet.label }}
1803
- <Badge
1804
- v-if="barCount(facet) > 0"
1805
- tone="primary"
1806
- pill
1807
- :hidden-suffix="t('grid.nActive', { count: barCount(facet) })"
1808
- >
1809
- <span aria-hidden="true">{{ barCount(facet) }}</span>
1810
- </Badge>
1811
- <EldraIcon
1812
- name="chevron-down"
1813
- size="sm"
1814
- :class="
1815
- open
1816
- ? 'rotate-180 motion-safe:transition-transform'
1817
- : 'motion-safe:transition-transform'
1818
- "
1819
- />
1854
+ <Popover
1855
+ v-for="facet in barPopoverFacets"
1856
+ :key="facet.id"
1857
+ role="dialog"
1858
+ haspopup="dialog"
1859
+ placement="bottom-start"
1860
+ :aria-label="facet.label"
1861
+ :classes="BAR_POPOVER_CLASSES"
1862
+ >
1863
+ <template #trigger="{ attrs, open }">
1864
+ <button v-bind="attrs" :class="open ? BAR_CHIP_ON : BAR_CHIP_OFF">
1865
+ {{ facet.label }}
1866
+ <Badge
1867
+ v-if="barCount(facet) > 0"
1868
+ tone="primary"
1869
+ pill
1870
+ :hidden-suffix="t('grid.nActive', { count: barCount(facet) })"
1871
+ >
1872
+ <span aria-hidden="true">{{ barCount(facet) }}</span>
1873
+ </Badge>
1874
+ <EldraIcon
1875
+ name="chevron-down"
1876
+ size="sm"
1877
+ :class="
1878
+ open
1879
+ ? 'rotate-180 motion-safe:transition-transform'
1880
+ : 'motion-safe:transition-transform'
1881
+ "
1882
+ />
1883
+ </button>
1884
+ </template>
1885
+ <FilterPanel
1886
+ mode="drawer"
1887
+ dense
1888
+ :show-head="false"
1889
+ :label="facet.label"
1890
+ :facets="popoverFacets(facet)"
1891
+ :model-value="panelSelection"
1892
+ :currency="money.currency.value"
1893
+ :id-prefix="`collection-grid-bar-${uid}-${facet.id}`"
1894
+ :classes="BAR_PANEL_CLASSES"
1895
+ @change="onPanelChange"
1896
+ >
1897
+ <template #foot><span /></template>
1898
+ </FilterPanel>
1899
+ </Popover>
1900
+
1901
+ <template v-for="facet in barToggleFacets" :key="facet.id">
1902
+ <button
1903
+ v-for="value in facet.values ?? []"
1904
+ :key="value.value"
1905
+ type="button"
1906
+ :aria-pressed="isBarValuePressed(facet.id, value.value) ? 'true' : 'false'"
1907
+ :disabled="value.disabled && !isBarValuePressed(facet.id, value.value)"
1908
+ :class="isBarValuePressed(facet.id, value.value) ? BAR_CHIP_ON : BAR_CHIP_OFF"
1909
+ @click="toggleBarValue(facet.id, value.value)"
1910
+ >
1911
+ {{ value.label }}
1820
1912
  </button>
1821
1913
  </template>
1822
- <FilterPanel
1823
- mode="drawer"
1824
- dense
1825
- :show-head="false"
1826
- :label="facet.label"
1827
- :facets="popoverFacets(facet)"
1828
- :model-value="panelSelection"
1829
- :currency="money.currency.value"
1830
- :id-prefix="`collection-grid-bar-${uid}-${facet.id}`"
1831
- :classes="BAR_PANEL_CLASSES"
1832
- @change="onPanelChange"
1833
- >
1834
- <template #foot><span /></template>
1835
- </FilterPanel>
1836
- </Popover>
1837
-
1838
- <template v-for="facet in barToggleFacets" :key="facet.id">
1839
- <button
1840
- v-for="value in facet.values ?? []"
1841
- :key="value.value"
1842
- type="button"
1843
- :aria-pressed="isBarValuePressed(facet.id, value.value) ? 'true' : 'false'"
1844
- :disabled="value.disabled && !isBarValuePressed(facet.id, value.value)"
1845
- :class="isBarValuePressed(facet.id, value.value) ? BAR_CHIP_ON : BAR_CHIP_OFF"
1846
- @click="toggleBarValue(facet.id, value.value)"
1847
- >
1848
- {{ value.label }}
1849
- </button>
1850
- </template>
1914
+ </div>
1851
1915
 
1852
1916
  <div
1853
- class="@tablet:ms-auto @tablet:w-auto flex w-full flex-wrap items-center gap-x-6 gap-y-2"
1917
+ data-eldra-filter-bar-sort
1918
+ :class="[
1919
+ 'flex shrink-0 items-center gap-x-6',
1920
+ barHasChips
1921
+ ? '@max-content:border-border @max-content:border-l @max-content:ps-3'
1922
+ : '',
1923
+ ]"
1854
1924
  >
1855
1925
  <FieldWrapper
1856
1926
  v-if="hasSort"
1857
1927
  :label="t('grid.sort')"
1858
- class="flex min-w-0 flex-1 items-center gap-3"
1859
- :classes="{ label: 'mb-0 shrink-0 font-semibold', control: 'min-w-0 flex-1' }"
1928
+ class="flex items-center gap-3"
1929
+ :classes="{ label: '@max-content:sr-only mb-0 shrink-0 font-semibold' }"
1860
1930
  >
1931
+ <!-- Below 64rem a chip like the filters beside it, its label read but not shown
1932
+ (the sort icon says what it is); from 64rem the labelled select. -->
1861
1933
  <Select
1862
1934
  :model-value="sort"
1863
1935
  size="md"
1864
1936
  :options="sortOptions"
1865
- class="@tablet:min-w-48 w-full"
1937
+ :classes="SORT_SELECT_CLASSES"
1866
1938
  @update:model-value="onSort"
1867
- />
1939
+ >
1940
+ <template #leading><EldraIcon name="arrows-sort" size="sm" /></template>
1941
+ </Select>
1868
1942
  </FieldWrapper>
1869
1943
  <FieldWrapper
1870
1944
  v-if="showColumnSelect"
@@ -1882,7 +1956,9 @@ function hrefForPage(page: number): string {
1882
1956
  </div>
1883
1957
  </div>
1884
1958
 
1885
- <!-- The count and the applied filters as removable tags, then Clear all. -->
1959
+ <!-- The count and the applied filters as removable tags, then Clear all. The count's
1960
+ number is bold, as the design's "**8** products" (`barCountNumber` — the same
1961
+ words `countText` reads, with the number in a `strong`). -->
1886
1962
  <div class="flex flex-wrap items-center gap-2 pt-4">
1887
1963
  <p
1888
1964
  ref="countEl"
@@ -1891,7 +1967,12 @@ function hrefForPage(page: number): string {
1891
1967
  aria-live="polite"
1892
1968
  class="text-muted me-2 tabular-nums"
1893
1969
  >
1894
- {{ countText }}
1970
+ <I18nT v-if="barCountNumber !== null" keypath="grid.nProducts" scope="global">
1971
+ <template #count>
1972
+ <strong class="font-bold">{{ barCountNumber }}</strong>
1973
+ </template>
1974
+ </I18nT>
1975
+ <template v-else>{{ countText }}</template>
1895
1976
  </p>
1896
1977
  <ul
1897
1978
  v-if="barTags.length > 0"
@@ -1900,12 +1981,12 @@ function hrefForPage(page: number): string {
1900
1981
  class="flex flex-wrap gap-2"
1901
1982
  >
1902
1983
  <li v-for="tag in barTags" :key="`${tag.facetId}:${tag.value}`">
1984
+ <!-- The design's `.nw-tag`: a 2rem filled pill, medium weight, a 1rem ×. -->
1903
1985
  <Chip
1904
- size="sm"
1905
1986
  removable
1906
1987
  :label="tag.label"
1907
1988
  :messages="barTagMessages(tag)"
1908
- class="bg-surface-strong border-transparent"
1989
+ class="bg-surface-strong min-h-8 border-transparent font-medium"
1909
1990
  @remove="removeBarTag(tag)"
1910
1991
  />
1911
1992
  </li>
@@ -2000,8 +2081,9 @@ function hrefForPage(page: number): string {
2000
2081
  </div>
2001
2082
  </div>
2002
2083
 
2003
- <!-- Results. -->
2004
- <div class="mt-6">
2084
+ <!-- Results: 2rem under the filter bar's count row (the design's own gap), 1.5rem
2085
+ under the sidebar layout's toolbar rule. -->
2086
+ <div :class="isBar ? 'mt-8' : 'mt-6'">
2005
2087
  <VisuallyHidden as="h2" :id="productsHeadingId">{{
2006
2088
  t('grid.products')
2007
2089
  }}</VisuallyHidden>
@@ -2030,19 +2112,18 @@ function hrefForPage(page: number): string {
2030
2112
  role="list"
2031
2113
  :aria-labelledby="productsHeadingId"
2032
2114
  :aria-busy="updating ? 'true' : undefined"
2033
- :class="[gridClass, updating ? UPDATING_PULSE : '']"
2115
+ :class="[GRID_LAYER_CLASS, gridClass, updating ? UPDATING_PULSE : '']"
2034
2116
  :inert="updating || undefined"
2035
2117
  >
2036
2118
  <li v-for="entry in cards" :key="entry.item.handle">
2037
- <!-- No quick add: the spec's tab order for this block runs straight from the
2038
- cards to Load more, and a cart action is `product-detail`'s own. -->
2039
2119
  <ProductCard
2120
+ v-bind="productCardLook(t, entry.product.title)"
2040
2121
  :product="entry.product"
2041
2122
  :currency="entry.currency"
2042
2123
  ratio="4x5"
2043
2124
  :heading-level="3"
2044
2125
  :class="CARD_CLASS"
2045
- :quick-add="false"
2126
+ @quick-add="quickAdd.add(entry.item)"
2046
2127
  :revalidating="entry.revalidating"
2047
2128
  :announce="false"
2048
2129
  :link-as="entry.internal ? EldraRouterLink : undefined"
@@ -2067,13 +2148,15 @@ function hrefForPage(page: number): string {
2067
2148
  </div>
2068
2149
 
2069
2150
  <!-- Paging. -->
2070
- <div v-if="showPaging" class="mt-12">
2151
+ <div v-if="showPaging" class="mt-14">
2071
2152
  <LoadMore
2072
2153
  v-if="isLoadMore"
2073
2154
  :shown="cards.length"
2074
2155
  :total="total"
2075
2156
  :noun="t('grid.productsNoun')"
2076
2157
  :pending="loadingMore"
2158
+ :classes="LOAD_MORE_CLASSES"
2159
+ class="gap-3.5"
2077
2160
  @load="onLoadMore"
2078
2161
  />
2079
2162
  <Pagination