@eldrajs/theme-cli 0.2.10 → 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 (168) hide show
  1. package/CHANGELOG.md +11 -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 +34 -11
  45. package/template/blocks/collection-header/__tests__/Block.spec.ts +3 -3
  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 +404 -159
  76. package/template/blocks/navigation/__tests__/Block.spec.ts +806 -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/priceTokens.spec.ts +309 -0
  159. package/template/test/regionalFormat.spec.ts +80 -0
  160. package/template/test/starter.spec.ts +23 -7
  161. package/template/test/storefront/demo.spec.ts +19 -18
  162. package/template/test/storefront/toProductCard.spec.ts +17 -2
  163. package/template/test/structuredData.generate.spec.ts +4 -2
  164. package/template/test/support/mockGateway.ts +21 -1
  165. package/template/test/support/mountBlock.ts +25 -4
  166. package/template/test/support/priceTokens.ts +20 -0
  167. package/template/test/uiMessagesPlugin.spec.ts +34 -1
  168. package/template/tokens.json +8 -8
@@ -11,13 +11,14 @@ import {
11
11
  EditorPlaceholder,
12
12
  Link,
13
13
  NavMenu,
14
- SearchBar,
15
14
  SearchModal,
16
15
  } from '@eldrajs/ui';
17
16
  import type {
18
17
  NavMenuItem,
19
18
  NavMenuLink,
20
19
  NavMenuPart,
20
+ NavMenuSection,
21
+ NavMenuTone,
21
22
  SearchResultItem,
22
23
  SearchResults,
23
24
  UiMessages,
@@ -28,21 +29,21 @@ import { useStorefront } from '../../app/composables/useStorefront';
28
29
  import { useWishlist } from '../../app/composables/useWishlist';
29
30
  import { useI18n } from 'vue-i18n';
30
31
  import EldraIcon from '../../app/components/EldraIcon.vue';
32
+ import LocalePicker from './parts/LocalePicker.vue';
31
33
  import EldraRouterLink from '../../app/components/EldraRouterLink.vue';
32
- import { isInternalHref, safeHref, SEARCH_PATH } from '../../app/utils/links';
34
+ import { categoryHref, isInternalHref, safeHref, SEARCH_PATH } from '../../app/utils/links';
33
35
  import { useMoney } from '../../app/storefront/money';
34
36
  import type { StorefrontSearchResponse } from '../../app/storefront/types';
35
37
  import MenuLink from './parts/MenuLink.vue';
38
+ import { markCurrent } from './parts/currentItem';
36
39
 
37
- /** One panel column. `@eldrajs/ui` does not export this type by name (only `NavMenuItem`, whose
38
- * `sections` it is), so it is read off the item. */
39
- type NavMenuSection = NonNullable<NavMenuItem['sections']>[number];
40
40
  import blockJson from './block.json';
41
41
 
42
42
  const props = defineProps<{ entry: EldraBlockEntry<'navigation'> }>();
43
43
  const { data } = useBlockData(props, 'navigation');
44
44
 
45
- const { t } = useI18n();
45
+ /** Currency names are words in the page's language; prices follow the regional format instead. */
46
+ const { t, locale: contentLocale } = useI18n();
46
47
  const isEditing = useEditing();
47
48
  const storefront = useStorefront();
48
49
 
@@ -53,8 +54,8 @@ const variant = computed<'default' | 'centered' | 'minimal'>(() => data.value.va
53
54
  // The bar gives up width in stages, each measured against the header's own `@container` (so the
54
55
  // stages follow the block's width, not the window's):
55
56
  //
56
- // - from 80rem (`@wide:`): brand, inline links, a "Search the shop" pill and the labelled tools;
57
- // - 68.8125rem–80rem (1101–1279px): the pill becomes a labelled Search button;
57
+ // - from 68.8125rem (1101px): brand, inline links, a labelled Search button and the labelled
58
+ // tools (from 80rem, `@wide:`, the links only spread further apart);
58
59
  // - below 68.8125rem (≤1100px): the links move into the Menu drawer; Menu and Search sit at the
59
60
  // start, the brand in the middle of a symmetric grid, Saved and Cart at the end;
60
61
  // - below 47.5625rem (≤760px): a shorter bar and narrower tools, and the info strip keeps only its
@@ -179,6 +180,17 @@ function sectionExtras(raw: unknown, sections: ResolvedSection[]): LinkExtras[][
179
180
  });
180
181
  }
181
182
 
183
+ /**
184
+ * A top-level link the merchant marked `tone: "accent"` — the design's "Sale" — is drawn in the
185
+ * accent colour, in the bar and as a drawer row (`NavMenuLink.tone`). It is the link's own
186
+ * setting rather than a rule about a label or a position, so it survives a translation, a rename
187
+ * and a reorder. Like `badge` and `description` it rides on the stored link value as an extra key
188
+ * (Studio's link editor has no field for it yet), and is read straight off the item it is on.
189
+ */
190
+ function linkTone(raw: unknown): NavMenuTone | undefined {
191
+ return plainString(raw, 'tone') === 'accent' ? 'accent' : undefined;
192
+ }
193
+
182
194
  /**
183
195
  * The picture crop of a menu card: the `aspect` this block's own `links` field declares in
184
196
  * `cards`, so the declaration and the drawing cannot drift. `NavMenu` falls back to 4:3 on a
@@ -195,13 +207,13 @@ const cardAspect = (
195
207
  )?.metadata?.item?.metadata?.tree?.cards?.aspect;
196
208
 
197
209
  /** A resolved link as the menu draws it, `display` and `card` (child and section links only) kept. */
198
- function toNavLink(link: ResolvedLink, extras: LinkExtras = {}): NavMenuLink {
210
+ function toNavLink(link: ResolvedLink, extras: LinkExtras = {}, held = true): NavMenuLink {
199
211
  return {
200
212
  label: link.label,
201
213
  href: link.href,
202
214
  newTab: link.newTab,
203
215
  group: link.group,
204
- current: isCurrent(link.href),
216
+ current: held && isCurrent(link.href),
205
217
  display: link.display,
206
218
  card: link.card,
207
219
  badge: extras.badge,
@@ -209,13 +221,17 @@ function toNavLink(link: ResolvedLink, extras: LinkExtras = {}): NavMenuLink {
209
221
  };
210
222
  }
211
223
 
212
- function toNavSection(section: ResolvedSection, extras: LinkExtras[] = []): NavMenuSection {
224
+ function toNavSection(
225
+ section: ResolvedSection,
226
+ extras: LinkExtras[] = [],
227
+ held = true
228
+ ): NavMenuSection {
213
229
  return {
214
230
  heading: section.heading,
215
- headingLink: section.headingLink === null ? null : toNavLink(section.headingLink),
231
+ headingLink: section.headingLink === null ? null : toNavLink(section.headingLink, {}, held),
216
232
  display: section.display,
217
- links: section.links.map((link, index) => toNavLink(link, extras[index])),
218
- seeAll: section.seeAll === null ? null : toNavLink(section.seeAll),
233
+ links: section.links.map((link, index) => toNavLink(link, extras[index], held)),
234
+ seeAll: section.seeAll === null ? null : toNavLink(section.seeAll, {}, held),
219
235
  };
220
236
  }
221
237
 
@@ -240,38 +256,52 @@ function isDropdown(sections: ResolvedSection[]): boolean {
240
256
  * grouped by their `group`, which is what a menu stored before sections existed still is.
241
257
  */
242
258
  const navItems = computed<NavMenuItem[]>(() =>
243
- linkEntries.value.map(({ resolved: link, raw }) => {
259
+ linkEntries.value.map(({ resolved: link, raw }, at) => {
260
+ // Only the one marked entry holds the current page; a link inside another entry's panel is not
261
+ // marked even when its path is the page's, so at most one entry is ever current.
262
+ const mark = currentMarks.value[at];
263
+ const held = mark !== undefined;
244
264
  const sections = link.sections ?? [];
245
265
  const children = link.children.filter((child) => child.label !== null);
266
+ const tone = linkTone(raw);
246
267
  if (sections.length === 0 && children.length === 0) {
247
268
  return {
248
269
  label: link.label,
249
270
  href: link.href,
250
271
  newTab: link.newTab,
251
- current: isCurrent(link.href),
272
+ current: mark,
273
+ tone,
252
274
  };
253
275
  }
254
276
  if (sections.length === 0) {
255
277
  return {
256
278
  label: link.label,
257
279
  layout: 'mega',
258
- children: children.map((c) => toNavLink(c)),
280
+ tone,
281
+ current: mark,
282
+ children: children.map((c) => toNavLink(c, {}, held)),
259
283
  };
260
284
  }
261
285
  const extras = sectionExtras(raw, sections);
262
286
  return {
263
287
  label: link.label,
288
+ tone,
264
289
  layout: isDropdown(sections) ? 'dropdown' : 'mega',
265
- sections: sections.map((section, index) => toNavSection(section, extras[index])),
290
+ current: mark,
291
+ sections: sections.map((section, index) => toNavSection(section, extras[index], held)),
266
292
  };
267
293
  })
268
294
  );
269
295
 
270
- /** The panel's own "View all" footer — left out when a column already ends in its own "see all"
271
- * link, which is the design's way of offering the same thing. */
296
+ /**
297
+ * The panel's own "View all" footer, for a menu stored before sections existed: a panel of
298
+ * `children` has no headings to link from, so the parent's own page is offered under it. A panel of
299
+ * sections has none (the design's Shop and Ceramics panels end on their columns): its headings and
300
+ * "see all" links are how an author points at a department's page.
301
+ */
272
302
  function viewAllHref(index: number): string | undefined {
273
303
  const link = links.value[index];
274
- if (link?.sections?.some((section) => section.seeAll !== null) === true) return undefined;
304
+ if ((link?.sections?.length ?? 0) > 0) return undefined;
275
305
  return link?.href ?? undefined;
276
306
  }
277
307
 
@@ -342,16 +372,6 @@ function infoItemClass(index: number): string {
342
372
  // --- search ------------------------------------------------------------------------------------
343
373
 
344
374
  const showSearch = computed(() => data.value.showSearch !== false);
345
- /** `inline` only ever applies to `centered`; otherwise it falls back to `icon` (spec: "inline:
346
- * centered variant only"). */
347
- const searchStyle = computed<'icon' | 'field' | 'inline'>(() => {
348
- const style = data.value.searchStyle ?? 'icon';
349
- if (style === 'inline' && variant.value !== 'centered') return 'icon';
350
- // `minimal` is a tool row at every width, and its brand is centred by the two sides matching:
351
- // a pill field on one side would push it off the middle.
352
- if (style === 'field' && variant.value === 'minimal') return 'icon';
353
- return style;
354
- });
355
375
 
356
376
  const searchOpen = ref(false);
357
377
  const searchQuery = ref('');
@@ -364,7 +384,7 @@ const money = useMoney();
364
384
  *
365
385
  * Three destinations, none of which `EldraRouterLink` can reach:
366
386
  *
367
- * 1. `SearchBar`/`SearchModal` render a real `<form role="search" method="get" :action>`, so
387
+ * 1. `SearchModal` renders a real `<form role="search" method="get" :action>`, so
368
388
  * pressing Enter with no active option is a native document submit. Left to its default the
369
389
  * action is `/search`, and a shopper searching from `/is-IS/products/x` lands on the **English**
370
390
  * results page.
@@ -429,8 +449,8 @@ const searchAnswer = computed(() => {
429
449
  const answer = searchResult.data.value;
430
450
  return answer !== null && answer.query === searchQuery.value ? answer : null;
431
451
  });
432
- /** `undefined` while there is no answer for this query — which is how both `SearchBar` and
433
- * `SearchModal` are told "nothing yet", as opposed to "nothing found". */
452
+ /** `undefined` while there is no answer for this query — which is how `SearchModal` is told
453
+ * "nothing yet", as opposed to "nothing found". */
434
454
  const searchResults = computed(() => toSearchResults(searchAnswer.value));
435
455
  /**
436
456
  * `loading`, not `pending`: `pending` is the skeleton flag and means "a read in flight with nothing
@@ -579,12 +599,10 @@ const wishlistBadgeLabel = computed(() =>
579
599
  // --- current page ------------------------------------------------------------------------------
580
600
 
581
601
  /**
582
- * `window.location` (a plain browser API, not a Nuxt global — `useRoute()` is what the starter's
583
- * "no Nuxt globals in blocks" rule forbids) is the only way a block can tell which link is
584
- * "current" without reading the router. `popstate` catches back/forward navigation; a same-site
585
- * `Link`/`Button` click elsewhere on the page (pushed via the router, not a full reload) does not
586
- * fire it, so the highlighted link can go stale until the next popstate/reload — a known
587
- * limitation of staying router-free, not something this block can close without one.
602
+ * The path comes from `storefront.route.path`, which the storefront plugin keeps equal to the
603
+ * router's committed route, so the mark moves on every client-side navigation (a block may not call
604
+ * `useRoute()` itself). Only where there is no router — Storybook, a block spec — is that path empty,
605
+ * and `window.location` with a `popstate` listener stands in.
588
606
  *
589
607
  * Every `watchEffect` below opens with `if (typeof window === 'undefined') return;`. That is not
590
608
  * defensive padding: a `flush: 'pre'` effect with no callback runs its body *immediately*, during
@@ -603,10 +621,57 @@ watchEffect((onCleanup) => {
603
621
  window.addEventListener('popstate', onPopState);
604
622
  onCleanup(() => window.removeEventListener('popstate', onPopState));
605
623
  });
624
+ /**
625
+ * The page's path: the storefront's route (the router's committed route, reactive on every
626
+ * client-side navigation), and `window.location` only where there is no router (Storybook, a spec).
627
+ */
628
+ const pagePath = computed(() => storefront.route.path || currentPath.value);
606
629
  function isCurrent(href: string | null | undefined): boolean {
607
- return typeof href === 'string' && href === currentPath.value;
630
+ return typeof href === 'string' && href === pagePath.value;
608
631
  }
609
632
 
633
+ /**
634
+ * The page's main category, for the header's one "current" entry. A product page names it through
635
+ * the product's `categoryTrail`, which the storefront walks from the product's primary category
636
+ * (`primaryCategoryId`), so the first-category fallback is not needed; a category page names it by
637
+ * its route, which follows the router; the product is the one this page resolved at setup.
638
+ */
639
+ // The product handle is captured at setup, as `breadcrumbs` does: this block's page is created
640
+ // fresh against the committed route, and a live handle would make the departing page's header read
641
+ // the product a clicked card points at (a second read the destination already has).
642
+ const routeProductHandle = storefront.route.productHandle;
643
+ const navProduct = storefront.catalog.product(computed(() => routeProductHandle));
644
+ const mainCategoryTrail = computed<string[]>(() => {
645
+ const categoryPath = storefront.route.categoryPath;
646
+ if (categoryPath !== null) {
647
+ const segments = categoryPath.split('/').filter((segment) => segment !== '');
648
+ return segments.map((_, depth) => categoryHref(segments.slice(0, depth + 1).join('/')));
649
+ }
650
+ // Only while the route is still that product's page: once it moves on, its category no longer counts.
651
+ if (routeProductHandle === null || storefront.route.productHandle !== routeProductHandle)
652
+ return [];
653
+ return (navProduct.data.value?.categoryTrail ?? []).map((level) => level.href);
654
+ });
655
+
656
+ function menuHrefs(link: ResolvedLink): (string | null)[] {
657
+ return [
658
+ ...link.children.map((child) => child.href),
659
+ ...(link.sections ?? []).flatMap((section) => [
660
+ section.headingLink?.href ?? null,
661
+ section.seeAll?.href ?? null,
662
+ ...section.links.map((child) => child.href),
663
+ ]),
664
+ ];
665
+ }
666
+
667
+ /** One mark per top-level entry; at most one is not `undefined`. */
668
+ const currentMarks = computed(() =>
669
+ markCurrent(
670
+ linkEntries.value.map(({ resolved }) => ({ href: resolved.href, menu: menuHrefs(resolved) })),
671
+ { path: pagePath.value, trail: mainCategoryTrail.value }
672
+ )
673
+ );
674
+
610
675
  // --- sticky, scroll padding and scrolled shadow -----------------------------------------------
611
676
 
612
677
  const sticky = computed(() => data.value.sticky !== false);
@@ -718,7 +783,8 @@ watchEffect((onCleanup) => {
718
783
  * one place that variable is ever written: a `ResizeObserver` (guarded for an environment with
719
784
  * none, e.g. jsdom under Vitest — the same guard `trust-strip`'s own list-overflow measurement
720
785
  * uses) keeps the published value equal to the bar's real rendered height, which changes with
721
- * `sticky`/`variant`/`searchStyle` and the mobile/tablet/desktop breakpoint. The property is
786
+ * `sticky`/`variant` and the mobile/tablet/desktop breakpoint — or 0 while the bar
787
+ * is slid out of view (the effect after this one). The property is
722
788
  * removed — not just left stale — the moment `sticky` turns off, so a non-sticky header never
723
789
  * claims space it doesn't occupy in the page's fixed flow, and on unmount (`onCleanup`), so it
724
790
  * never survives past this instance of the block.
@@ -736,10 +802,9 @@ watchEffect((onCleanup) => {
736
802
  }
737
803
  const el = barRoot.value;
738
804
  const publish = (): void => {
739
- const height = el.getBoundingClientRect().height;
740
- document.documentElement.style.setProperty('--eldra-header-height', `${height}px`);
741
- // The same measurement the spacer reserves, so the two can never disagree.
742
- barHeight.value = height;
805
+ // The same measurement the spacer reserves, so the two can never disagree; the effect below
806
+ // publishes it.
807
+ barHeight.value = el.getBoundingClientRect().height;
743
808
  };
744
809
  const observer = new ResizeObserver(publish);
745
810
  observer.observe(el);
@@ -750,6 +815,23 @@ watchEffect((onCleanup) => {
750
815
  barHeight.value = null;
751
816
  });
752
817
  });
818
+ /**
819
+ * What is published is the bar's **visible** height: its measured height while it shows, `0px`
820
+ * while it is slid out of view (`barHidden`). A reader offsets a sticky box by it to sit under the
821
+ * bar, and a bar that has slid away covers nothing — publishing its full height then left every
822
+ * such box (the collection grid's filter rail and filter bar, `faq`'s head column) hanging a
823
+ * header's height below the viewport's top over an empty strip (WS-1277). The spacer keeps
824
+ * reserving the full `barHeight`, since the page's flow never changes as the bar slides. `sync`,
825
+ * so a resize is published in the observer's own callback, as it was when that callback wrote it.
826
+ */
827
+ watchEffect(
828
+ () => {
829
+ if (typeof document === 'undefined' || barHeight.value === null) return;
830
+ const visible = barHidden.value ? 0 : barHeight.value;
831
+ document.documentElement.style.setProperty('--eldra-header-height', `${visible}px`);
832
+ },
833
+ { flush: 'sync' }
834
+ );
753
835
 
754
836
  // --- transparent-over-hero -----------------------------------------------------------------------
755
837
 
@@ -875,8 +957,66 @@ const drawerLayout = computed<'accordion' | 'sections'>(() =>
875
957
  /** More than one currency to shop in. On a phone the picker sits in the menu when there is one. */
876
958
  const currency = storefront.currency;
877
959
  const hasCurrencies = computed(() => currency.offered.value.length > 1);
878
- /** The bar's picker only where the links are inline; with a drawer it lives in the drawer's footer. */
960
+ /**
961
+ * More than one language to read the site in. The language picker sits beside the currency picker,
962
+ * wherever that one would: strip, drawer footer or bar. A site with one locale (or none configured,
963
+ * and every story and unit mount) has no language picker at all; `LocalePicker` checks the same.
964
+ */
965
+ const hasLocales = computed(() => activeLocale.supported.length > 1);
966
+ /** Something for the visitor to set: a language, a currency, or both. */
967
+ const hasSettings = computed(() => hasCurrencies.value || hasLocales.value);
968
+ /**
969
+ * With an info strip the pickers sit at its end, "EN · Prices in ISK", from 47.625rem up: settings
970
+ * next to Help and Order status rather than boxed controls among the tools. Phones have no room in
971
+ * the strip, so there they are in the drawer's footer (or in the bar, with no drawer).
972
+ */
973
+ const stripPicker = computed(() => hasInfo.value && hasSettings.value);
974
+ /**
975
+ * The divider before it, wherever the strip's end items show beside it: a hairline 1.25rem before
976
+ * the button, pulled 0.25rem back towards the links so the gap either side of the rule reads even.
977
+ */
978
+ const stripPickerClass = computed(() => {
979
+ if (infoEnd.value.length === 0) return '';
980
+ const divider = isTransparent.value ? 'border-primary-contrast/24' : 'border-border';
981
+ return infoStart.value.length > 0
982
+ ? `@min-[68.8125rem]:-ms-1 @min-[68.8125rem]:border-l @min-[68.8125rem]:ps-5 ${divider}`
983
+ : `-ms-1 border-l ps-5 ${divider}`;
984
+ });
985
+ /**
986
+ * A picker's list is teleported out of the header, so it lifts itself over the fixed bar's own
987
+ * `z-40` (a popover's `z-popover`, 30, sits under it).
988
+ */
989
+ const PICKER_PANEL_LIFT = 'z-41';
990
+ /**
991
+ * The strip's picker reads as a setting in the strip, not as a field: no box, the strip's own size,
992
+ * the words in `text` with the code bold, an underline under the words on hover. Its list is a
993
+ * 17rem card under the button's end: each row the currency's name, its code muted beside it and
994
+ * the check, the chosen row on `surface-strong`. Its padding is the header's dropdown menus' own
995
+ * (0.5rem at the top and sides, 0.75rem below), counting the `0.25rem` the list adds inside it.
996
+ */
997
+ const stripPickerClasses = computed(() => ({
998
+ trigger: [
999
+ 'h-9 min-h-9 w-auto gap-1.5 rounded-sm border-0 bg-transparent px-1 text-[0.8125rem] shadow-none hover:bg-transparent',
1000
+ isTransparent.value ? 'text-current' : 'text-text',
1001
+ '[&:hover_[data-eldra-header-setting-words]]:underline underline-offset-[0.2em]',
1002
+ // Open from a pointer it is a setting, not a field: no ring. A keyboard keeps its ring.
1003
+ 'aria-expanded:not-focus-visible:[--eldra-focus-alpha:0]',
1004
+ ].join(' '),
1005
+ leadingIcon: 'size-4',
1006
+ value: 'overflow-visible',
1007
+ chevron:
1008
+ 'size-3.5 text-current motion-safe:transition-[rotate] motion-safe:duration-fast [[aria-expanded=true]_&]:rotate-180',
1009
+ panel: `${PICKER_PANEL_LIFT} w-68 rounded-lg border-border bg-background px-1 pt-1 pb-2 text-[0.9375rem] shadow-md`,
1010
+ option:
1011
+ 'min-h-11 gap-3 rounded-md px-3 text-[0.9375rem] hover:bg-surface aria-selected:bg-surface-strong aria-selected:font-semibold',
1012
+ optionCheck: 'size-5 text-primary',
1013
+ }));
1014
+ /**
1015
+ * The bar's picker: without a strip, only where the links are inline (with a drawer it lives in the
1016
+ * drawer's footer); with a strip, only on a phone with no drawer to hold it.
1017
+ */
879
1018
  const barPickerClass = computed(() => {
1019
+ if (stripPicker.value) return drawerHasContent.value ? 'hidden' : 'ml-1 @min-[47.625rem]:hidden';
880
1020
  if (!drawerHasContent.value) return 'ml-1';
881
1021
  return variant.value === 'minimal' ? 'hidden' : '@min-[68.8125rem]:block ml-1 hidden';
882
1022
  });
@@ -884,12 +1024,20 @@ const showLinksPlaceholder = computed(
884
1024
  () => isEditing.value && variant.value !== 'minimal' && links.value.length === 0
885
1025
  );
886
1026
 
887
- /** The Menu tool's accessible name is its visible label (WCAG 2.5.3). */
1027
+ /** The Menu tool's accessible name is its visible label (WCAG 2.5.3): Menu, and Close while the
1028
+ * menu is open under the bar. */
888
1029
  const navMenuMessages = computed<Partial<UiMessages>>(() => ({
889
1030
  navMenuOpen: t('header.menu'),
890
1031
  navMenuDrawer: t('header.menu'),
1032
+ close: t('header.close'),
891
1033
  }));
892
1034
 
1035
+ /** A drawer footer row's icon: its own, else a phone for a `tel:` number. */
1036
+ function footerIcon(item: InfoEntry): string | undefined {
1037
+ if (item.icon) return item.icon;
1038
+ return item.href?.startsWith('tel:') === true ? 'phone' : undefined;
1039
+ }
1040
+
893
1041
  /**
894
1042
  * The bar's grid. Below 68.8125rem (and at every width in `minimal`) it is six tracks —
895
1043
  * `Menu | Search | 1fr | brand | 1fr | Saved+Cart` — and because the tools are one fixed width and the
@@ -942,10 +1090,12 @@ const toolSpacerClass = computed(() =>
942
1090
  : `${TOOL_WIDTH_CLASSES} @min-[68.8125rem]:hidden`
943
1091
  );
944
1092
 
945
- /** Dropdown panels and mega panels share `NavMenu`'s `content` part; a dropdown's carries the
946
- * package's own `eldra-nav-menu-dropdown` class, which is how the rules below tell them apart. */
947
- const DROPDOWN = '[&[class~="eldra:eldra-nav-menu-dropdown"]]';
948
-
1093
+ /**
1094
+ * Dropdown panels and mega panels share `NavMenu`'s `panel` and `content` parts, each marked with
1095
+ * its `data-layout`; a link inside one is styled through `in-data-[layout=…]:`. Every rule below
1096
+ * that differs between the two is written once per layout, so no element carries two values for
1097
+ * one property — and written out in full, since Tailwind only generates a class it can read.
1098
+ */
949
1099
  /** What this header draws differently from `NavMenu`'s own look, part by part. */
950
1100
  const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
951
1101
  nav: `@max-[68.8125rem]:hidden self-stretch ${linksPositionClass.value}`,
@@ -955,20 +1105,26 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
955
1105
  : 'h-full flex-nowrap gap-0.5',
956
1106
  // The design's pill entries: 2.75rem tall, full radius, `surface` on hover and while open, the
957
1107
  // current page on `surface-strong`. The pill marks the current page, so the package's underline
958
- // for it is turned off here, as on `trigger`.
959
- link: 'min-h-11 rounded-full px-3 text-base font-medium hover:bg-surface aria-[current=page]:no-underline aria-[current=page]:bg-surface-strong',
1108
+ // for it is turned off here, as on `trigger`. An entry that only holds the page (`aria-current=true`)
1109
+ // gets the same pill. An accent entry (`tone`) keeps its colour.
1110
+ link: 'min-h-11 rounded-full px-3 text-base font-medium hover:bg-surface aria-[current=page]:no-underline aria-[current=page]:bg-surface-strong aria-[current=true]:no-underline aria-[current=true]:bg-surface-strong',
960
1111
  trigger:
961
1112
  'min-h-11 rounded-full px-3 text-base font-medium hover:bg-surface aria-expanded:bg-surface data-current:no-underline data-current:bg-surface-strong',
962
1113
  // The Menu tool: shown below 68.8125rem (the package hides it from `@content`), a labelled tool
963
1114
  // like its neighbours.
964
1115
  toggle: `${TOOL_CLASSES} @max-[68.8125rem]:inline-flex col-start-1 row-start-1 max-md:size-auto rounded-md`,
965
- // A mega panel hangs from the whole header (its positioning box), full-bleed, with the columns
966
- // inside the same wide container the bar uses; a dropdown hangs under its trigger.
967
- panel: 'pt-0',
1116
+ // A mega panel hangs from the whole header (its positioning box), full-bleed, flush under the
1117
+ // bar; a dropdown hangs 0.5rem under its trigger — padding, not a margin, so the pointer crossing
1118
+ // the gap is still over the menu.
1119
+ panel: `data-[layout=mega]:pt-0 data-[layout=dropdown]:pt-2`,
968
1120
  content: [
969
- 'rounded-none border-0 border-b border-border bg-(--eldra-header-surface) shadow-(--eldra-shadow-float)',
970
- 'py-8 px-(--eldra-gutter-mobile) @tablet:px-(--eldra-gutter-tablet) @content:px-(--eldra-gutter-desktop)',
971
- `${DROPDOWN}:mt-2 ${DROPDOWN}:w-[21rem] ${DROPDOWN}:rounded-lg ${DROPDOWN}:border ${DROPDOWN}:px-2 ${DROPDOWN}:pt-2 ${DROPDOWN}:pb-3`,
1121
+ // The design's panel shadow is a deep, soft one under the sheet: the theme's `md` shadow.
1122
+ 'border-border bg-(--eldra-header-surface) shadow-md',
1123
+ // Mega: a square sheet with a bottom rule, 2rem above and below, the page's gutters at the sides.
1124
+ `data-[layout=mega]:rounded-none data-[layout=mega]:border-0 data-[layout=mega]:border-b data-[layout=mega]:py-8`,
1125
+ `data-[layout=mega]:px-(--eldra-gutter-mobile) data-[layout=mega]:@tablet:px-(--eldra-gutter-tablet) data-[layout=mega]:@content:px-(--eldra-gutter-desktop)`,
1126
+ // Dropdown: a 21rem rounded card, 0.5rem inside (0.75rem at the foot).
1127
+ `data-[layout=dropdown]:w-[21rem] data-[layout=dropdown]:rounded-lg data-[layout=dropdown]:border data-[layout=dropdown]:px-2 data-[layout=dropdown]:pt-2 data-[layout=dropdown]:pb-3`,
972
1128
  ].join(' '),
973
1129
  // Link columns in equal tracks; a column of cards spans two of them. Inside the wide container.
974
1130
  columns:
@@ -978,48 +1134,59 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
978
1134
  groupHeading:
979
1135
  'font-heading px-0 pb-3 text-xl leading-tight font-medium tracking-normal normal-case text-text',
980
1136
  groupLink: 'text-text no-underline hover:underline underline-offset-[0.2em]',
981
- panelList: 'gap-0.5',
982
- // Quiet links that underline on hover; a link with a description (the dropdown) is a padded row
983
- // with its title in `text` and a `surface` hover.
1137
+ // Two cards side by side, 1rem apart; a column of links nearly touching; a dropdown's rows flush.
1138
+ panelList: `gap-0.5 [[data-cards]>&]:gap-4 in-data-[layout=dropdown]:gap-0`,
984
1139
  panelLink: [
985
- 'px-0 py-1.5 text-muted hover:bg-transparent hover:text-text hover:underline underline-offset-[0.2em]',
986
- '[&:has([data-part=description])]:rounded-md [&:has([data-part=description])]:px-3 [&:has([data-part=description])]:py-2.5 [&:has([data-part=description])]:text-text [&:has([data-part=description])]:no-underline [&:has([data-part=description])]:hover:bg-surface',
1140
+ // Mega: quiet links that underline on hover; a card's link underlines only its title.
1141
+ `in-data-[layout=mega]:px-0 in-data-[layout=mega]:py-1.5 in-data-[layout=mega]:text-muted in-data-[layout=mega]:hover:bg-transparent in-data-[layout=mega]:hover:text-text`,
1142
+ `in-data-[layout=mega]:hover:underline underline-offset-[0.2em] has-data-[part=card]:py-0 has-data-[part=card]:hover:no-underline`,
1143
+ // Dropdown: padded rows, the title in `text`, `surface` on hover.
1144
+ `in-data-[layout=dropdown]:px-3 in-data-[layout=dropdown]:py-2.5 in-data-[layout=dropdown]:text-text in-data-[layout=dropdown]:hover:bg-surface`,
987
1145
  // The column's "see all": primary, semibold, with an arrow.
988
1146
  'data-see-all:mt-2 data-see-all:text-[0.9375rem] data-see-all:font-semibold data-see-all:text-primary',
989
- // In a dropdown it lines up with the padded rows above it.
990
- 'in-[[class~="eldra:eldra-nav-menu-dropdown"]]:data-see-all:px-3',
1147
+ // In a dropdown it lines up with the rows' text, a 2.25rem line under them that underlines.
1148
+ `in-data-[layout=dropdown]:data-see-all:mt-1 in-data-[layout=dropdown]:data-see-all:min-h-9 in-data-[layout=dropdown]:data-see-all:justify-center in-data-[layout=dropdown]:data-see-all:py-0`,
1149
+ `in-data-[layout=dropdown]:data-see-all:hover:bg-transparent in-data-[layout=dropdown]:data-see-all:hover:underline`,
991
1150
  ].join(' '),
992
- panelLabel: `gap-x-2 text-base font-normal in-data-see-all:font-semibold in-data-see-all:after:content-['→'] [[data-part=panelLink]:has([data-part=description])_&]:font-semibold`,
993
- description: 'text-sm leading-snug',
1151
+ panelLabel: `gap-x-2 text-base font-normal in-data-[layout=dropdown]:font-semibold in-data-see-all:text-[0.9375rem] in-data-see-all:font-semibold in-data-see-all:relative in-data-see-all:w-fit in-data-see-all:after:absolute in-data-see-all:after:start-full in-data-see-all:after:ms-2 in-data-see-all:after:content-['→']`,
1152
+ description: 'text-sm leading-[1.4]',
994
1153
  badge:
995
1154
  'min-h-0 rounded-sm bg-accent px-1.5 py-0 text-[0.6875rem] leading-[1.4] font-bold tracking-[0.04em] text-accent-contrast',
996
- // Cards: the picture, a semibold title and the price under it.
1155
+ // Cards: the picture (rounded, on `surface` while it loads), a semibold title and the price
1156
+ // under it in `muted`.
997
1157
  card: 'gap-2',
998
1158
  cardImage: 'rounded-lg',
999
- cardTitle: 'text-base leading-snug font-semibold',
1000
- cardPrice: 'text-[0.9375rem]',
1159
+ cardTitle: 'text-base leading-[1.3] font-semibold [a:hover_&]:underline underline-offset-[0.2em]',
1160
+ cardPrice: 'mt-0.5 text-[0.9375rem]',
1001
1161
  footer:
1002
1162
  'mx-auto w-full max-w-[calc(var(--eldra-container-wide)-2*var(--eldra-gutter-desktop))] justify-end border-0 pt-2',
1003
- // The drawer: serif rows, section headings as small capitals, links at body size.
1163
+ // The inline drawer: serif rows with chevrons, section headings as small capitals, links at body
1164
+ // size; from 37.5rem its columns sit two abreast and a column of cards spans both, four across.
1004
1165
  drawerBody: 'px-0 pt-0',
1005
1166
  drawerLink: 'font-heading min-h-14 px-4 text-xl font-normal',
1006
1167
  drawerTrigger:
1007
1168
  'min-h-14 px-4 py-3 hover:no-underline [&_[data-part=title]]:font-heading [&_[data-part=title]]:text-xl [&_[data-part=title]]:font-normal [&_[data-part=title]]:no-underline',
1008
- drawerSectionHeading: 'font-heading min-h-14 px-4 text-xl font-normal',
1169
+ // A section's heading row links to its page, with an arrow at the end in place of a chevron.
1170
+ drawerSectionHeading:
1171
+ "font-heading min-h-14 px-4 py-0 text-xl font-normal after:ms-auto after:font-body after:text-muted after:content-['→']",
1172
+ drawerItem: 'pb-0',
1009
1173
  drawerPanel: 'pb-0',
1010
- drawerNest: 'ms-0 border-s-0 px-4 pb-5',
1011
- drawerColumns: 'gap-5',
1174
+ drawerNest: 'ms-0 border-s-0 px-4 pt-1 pb-5',
1175
+ drawerColumns: 'gap-5 @min-[37.5rem]:grid @min-[37.5rem]:grid-cols-2 @min-[37.5rem]:gap-x-8',
1176
+ drawerGroup: '@min-[37.5rem]:data-cards:col-span-full',
1012
1177
  drawerGroupHeading: 'px-0 pb-1 text-xs font-bold tracking-[0.12em] uppercase text-muted',
1013
1178
  drawerGroupLink: 'text-muted no-underline hover:underline',
1014
- drawerPanelLink:
1015
- 'py-2 text-[1.0625rem] data-see-all:mt-1 data-see-all:text-[0.9375rem] data-see-all:font-semibold data-see-all:text-primary',
1016
- drawerPanelLabel: `font-normal in-data-see-all:font-semibold in-data-see-all:after:content-['→']`,
1179
+ drawerPanelList: '[[data-cards]>&]:gap-3 @min-[37.5rem]:[[data-cards]>&]:grid-cols-4',
1180
+ // Links at 1.0625rem with 0.5rem above and below; the "see all" smaller, tucked under them.
1181
+ drawerPanelLink: 'py-2 data-see-all:mt-0 data-see-all:py-1 data-see-all:text-primary',
1182
+ drawerPanelLabel: `text-[1.0625rem] font-normal in-data-see-all:text-[0.9375rem] in-data-see-all:font-semibold in-data-see-all:relative in-data-see-all:w-fit in-data-see-all:after:absolute in-data-see-all:after:start-full in-data-see-all:after:ms-2 in-data-see-all:after:content-['→']`,
1017
1183
  drawerBadge:
1018
1184
  'min-h-0 rounded-sm bg-accent px-1.5 py-0 text-[0.6875rem] leading-[1.4] font-bold tracking-[0.04em] text-accent-contrast',
1019
- drawerCardImage: 'rounded-lg',
1185
+ // Square pictures in the drawer, whatever the bar's crop.
1186
+ drawerCardImage: 'rounded-lg aspect-square',
1020
1187
  drawerCardTitle: 'font-semibold',
1021
- drawerFooter:
1022
- 'flex-col items-stretch gap-3 bg-surface px-4 pt-5 pb-5 [&>[data-eldra-header-drawer-links]]:-mx-0',
1188
+ // The foot, on `surface`: account, saved items, the strip's own links and the currency.
1189
+ drawerFooter: 'gap-3 px-4 pt-5 text-[0.9375rem]',
1023
1190
  }));
1024
1191
  </script>
1025
1192
 
@@ -1074,33 +1241,91 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
1074
1241
  <span v-else>{{ item.text }}</span>
1075
1242
  </li>
1076
1243
  </ul>
1077
- <ul v-if="infoEnd.length > 0" :class="['m-0 flex list-none gap-6 p-0', infoEndClass]">
1078
- <li
1079
- v-for="(item, index) in infoEnd"
1080
- :key="`end-${index}`"
1081
- :class="[
1082
- 'inline-flex items-center gap-1.5',
1083
- infoStart.length > 0 ? '' : infoItemClass(index),
1084
- ]"
1244
+ <div
1245
+ v-if="infoEnd.length > 0 || stripPicker"
1246
+ data-eldra-header-info-end
1247
+ class="flex items-center gap-4"
1248
+ >
1249
+ <ul v-if="infoEnd.length > 0" :class="['m-0 flex list-none gap-6 p-0', infoEndClass]">
1250
+ <li
1251
+ v-for="(item, index) in infoEnd"
1252
+ :key="`end-${index}`"
1253
+ :class="[
1254
+ 'inline-flex items-center gap-1.5',
1255
+ infoStart.length > 0 ? '' : infoItemClass(index),
1256
+ ]"
1257
+ >
1258
+ <EldraIcon
1259
+ v-if="item.icon"
1260
+ :name="item.icon"
1261
+ size="sm"
1262
+ :class="['size-4', isTransparent ? '' : 'text-primary']"
1263
+ />
1264
+ <Link
1265
+ v-if="item.href"
1266
+ :href="item.href"
1267
+ :as="item.linkAs"
1268
+ variant="standalone"
1269
+ :underline="false"
1270
+ :class="['font-normal', isTransparent ? 'text-current' : 'text-text']"
1271
+ >{{ item.text }}</Link
1272
+ >
1273
+ <span v-else>{{ item.text }}</span>
1274
+ </li>
1275
+ </ul>
1276
+ <div
1277
+ v-if="stripPicker"
1278
+ data-eldra-header-currency
1279
+ :class="['flex items-center gap-3 @max-[47.5625rem]:hidden', stripPickerClass]"
1085
1280
  >
1086
- <EldraIcon
1087
- v-if="item.icon"
1088
- :name="item.icon"
1089
- size="sm"
1090
- :class="['size-4', isTransparent ? '' : 'text-primary']"
1091
- />
1092
- <Link
1093
- v-if="item.href"
1094
- :href="item.href"
1095
- :as="item.linkAs"
1096
- variant="standalone"
1097
- :underline="false"
1098
- :class="['font-normal', isTransparent ? 'text-current' : 'text-text']"
1099
- >{{ item.text }}</Link
1281
+ <LocalePicker :label="t('header.language')" :classes="stripPickerClasses">
1282
+ <template #leading
1283
+ ><EldraIcon
1284
+ name="language"
1285
+ size="sm"
1286
+ :class="['size-4', isTransparent ? '' : 'text-primary']"
1287
+ /></template>
1288
+ <template #value="{ code }"
1289
+ ><span data-eldra-header-setting-words
1290
+ ><b class="font-semibold">{{ code }}</b></span
1291
+ ></template
1292
+ >
1293
+ <template #optionContent="{ code, label }">
1294
+ <span class="min-w-0 flex-1">{{ label }}</span>
1295
+ <small class="text-muted text-[0.8125rem] font-medium tracking-[0.04em]">{{
1296
+ code
1297
+ }}</small>
1298
+ </template>
1299
+ </LocalePicker>
1300
+ <CurrencyPicker
1301
+ :locale="contentLocale"
1302
+ :currencies="currency.offered.value"
1303
+ :model-value="currency.active.value"
1304
+ :busy="currency.busy.value"
1305
+ :label="t('header.pricesIn')"
1306
+ :classes="stripPickerClasses"
1307
+ @update:model-value="currency.choose"
1100
1308
  >
1101
- <span v-else>{{ item.text }}</span>
1102
- </li>
1103
- </ul>
1309
+ <template #leading
1310
+ ><EldraIcon
1311
+ name="world"
1312
+ size="sm"
1313
+ :class="['size-4', isTransparent ? '' : 'text-primary']"
1314
+ /></template>
1315
+ <template #value="{ code }"
1316
+ ><span data-eldra-header-setting-words
1317
+ >{{ t('header.pricesIn') }}&nbsp;<b class="font-semibold">{{ code }}</b></span
1318
+ ></template
1319
+ >
1320
+ <template #optionContent="{ code, currencyName }">
1321
+ <span class="min-w-0 flex-1">{{ currencyName }}</span>
1322
+ <small class="text-muted text-[0.8125rem] font-medium tracking-[0.04em]">{{
1323
+ code
1324
+ }}</small>
1325
+ </template>
1326
+ </CurrencyPicker>
1327
+ </div>
1328
+ </div>
1104
1329
  </Container>
1105
1330
  </div>
1106
1331
 
@@ -1152,16 +1377,17 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
1152
1377
  :aria-label="t('header.primary')"
1153
1378
  :collapse-below="variant === 'minimal' ? 'always' : '@content'"
1154
1379
  :drawer-layout="drawerLayout"
1155
- open-on-hover
1380
+ drawer-mode="inline"
1156
1381
  :link-as="MenuLink"
1157
1382
  :card-aspect="cardAspect"
1158
1383
  :messages="navMenuMessages"
1159
1384
  class="static contents"
1160
1385
  :classes="navMenuClasses"
1161
1386
  >
1162
- <template #toggle>
1163
- <EldraIcon name="menu-2" size="md" :class="TOOL_ICON_CLASSES" />
1164
- <span class="whitespace-nowrap">{{ t('header.menu') }}</span>
1387
+ <!-- Menu, and Close with an × while the menu is open under the bar. -->
1388
+ <template #toggle="{ open }">
1389
+ <EldraIcon :name="open ? 'x' : 'menu-2'" size="md" :class="TOOL_ICON_CLASSES" />
1390
+ <span class="whitespace-nowrap">{{ open ? t('header.close') : t('header.menu') }}</span>
1165
1391
  </template>
1166
1392
  <template #panelFooter="{ item, index }">
1167
1393
  <Link
@@ -1178,11 +1404,13 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
1178
1404
  {{ t('header.viewAll') }}
1179
1405
  </Link>
1180
1406
  </template>
1407
+ <!-- The foot, on `surface`: Account, Saved items, the strip's own links (its phone line
1408
+ among them) and, under a rule, the currency as a labelled select. -->
1181
1409
  <template #drawerFooter="{ close }">
1182
1410
  <ul
1183
1411
  v-if="accountHref || variant !== 'minimal' || infoEndLinks.length > 0"
1184
1412
  data-eldra-header-drawer-links
1185
- class="m-0 grid list-none gap-3 p-0 text-[0.9375rem]"
1413
+ class="m-0 grid list-none gap-3 p-0"
1186
1414
  >
1187
1415
  <li v-if="accountHref">
1188
1416
  <Link
@@ -1220,20 +1448,64 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
1220
1448
  :classes="{ label: 'inline-flex items-center gap-2' }"
1221
1449
  @click="close"
1222
1450
  >
1223
- <EldraIcon v-if="item.icon" :name="item.icon" size="md" />{{ item.text }}
1451
+ <EldraIcon v-if="footerIcon(item)" :name="footerIcon(item)!" size="md" />{{
1452
+ item.text
1453
+ }}
1224
1454
  </Link>
1225
1455
  </li>
1226
1456
  </ul>
1227
- <CurrencyPicker
1228
- :currencies="currency.offered.value"
1229
- :model-value="currency.active.value"
1230
- :busy="currency.busy.value"
1231
- show-label
1232
- size="md"
1233
- placement="above"
1234
- class="w-full"
1235
- @update:model-value="currency.choose"
1236
- />
1457
+ <div
1458
+ v-if="hasSettings"
1459
+ data-eldra-header-drawer-currency
1460
+ :class="[
1461
+ 'grid gap-4',
1462
+ accountHref || variant !== 'minimal' || infoEndLinks.length > 0
1463
+ ? 'border-border border-t pt-3'
1464
+ : '',
1465
+ ]"
1466
+ >
1467
+ <LocalePicker
1468
+ :label="t('header.language')"
1469
+ show-label
1470
+ size="md"
1471
+ placement="above"
1472
+ class="w-full"
1473
+ :classes="{
1474
+ label: 'text-text mb-0 inline-flex items-center gap-2 font-medium',
1475
+ panel: PICKER_PANEL_LIFT,
1476
+ }"
1477
+ >
1478
+ <template #label
1479
+ ><EldraIcon name="language" size="md" class="text-primary" />{{
1480
+ t('header.language')
1481
+ }}</template
1482
+ >
1483
+ <template #value="{ label }">{{ label }}</template>
1484
+ </LocalePicker>
1485
+ <CurrencyPicker
1486
+ :locale="contentLocale"
1487
+ :currencies="currency.offered.value"
1488
+ :model-value="currency.active.value"
1489
+ :busy="currency.busy.value"
1490
+ :label="t('header.pricesIn')"
1491
+ show-label
1492
+ size="md"
1493
+ placement="above"
1494
+ class="w-full"
1495
+ :classes="{
1496
+ label: 'text-text mb-0 inline-flex items-center gap-2 font-medium',
1497
+ panel: PICKER_PANEL_LIFT,
1498
+ }"
1499
+ @update:model-value="currency.choose"
1500
+ >
1501
+ <template #label
1502
+ ><EldraIcon name="world" size="md" class="text-primary" />{{
1503
+ t('header.pricesIn')
1504
+ }}</template
1505
+ >
1506
+ <template #value="{ label }">{{ label }}</template>
1507
+ </CurrencyPicker>
1508
+ </div>
1237
1509
  <Button
1238
1510
  v-if="hasCta"
1239
1511
  variant="primary"
@@ -1261,46 +1533,12 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
1261
1533
 
1262
1534
  <div :class="['flex items-center', searchPositionClass]">
1263
1535
  <template v-if="showSearch">
1264
- <!-- `field`: the "Search the shop" pill from 80rem, the labelled Search tool below.
1265
- `inline`: the live search bar, centered variant only, from 68.8125rem. `icon`: the
1266
- labelled tool at every width. All but the live bar open the search overlay. -->
1267
- <Button
1268
- v-if="searchStyle === 'field'"
1269
- variant="ghost"
1270
- size="md"
1271
- aria-haspopup="dialog"
1272
- class="bg-surface text-muted hover:border-border-strong hover:bg-surface @wide:inline-flex hidden w-60 justify-start gap-2.5 rounded-full border border-transparent px-3.5 font-normal"
1273
- :classes="{ label: 'text-base' }"
1274
- @click="openSearch"
1275
- >
1276
- <template #leadingIcon>
1277
- <EldraIcon name="search" size="md" class="size-[1.125rem]" />
1278
- </template>
1279
- {{ t('header.searchField') }}
1280
- </Button>
1281
- <SearchBar
1282
- v-else-if="searchStyle === 'inline'"
1283
- v-model="searchQuery"
1284
- size="md"
1285
- pill
1286
- :action="searchAction"
1287
- :label="t('header.searchField')"
1288
- :results="searchResults"
1289
- :loading="searchLoading"
1290
- class="hidden w-64 @min-[68.8125rem]:block"
1291
- />
1536
+ <!-- A labelled Search button at every width; it opens the search overlay. -->
1292
1537
  <Button
1293
1538
  variant="ghost"
1294
1539
  size="sm"
1295
1540
  aria-haspopup="dialog"
1296
- :class="[
1297
- TOOL_CLASSES,
1298
- searchStyle === 'field'
1299
- ? '@wide:hidden'
1300
- : searchStyle === 'inline'
1301
- ? '@min-[68.8125rem]:hidden'
1302
- : '',
1303
- ]"
1541
+ :class="TOOL_CLASSES"
1304
1542
  @click="openSearch"
1305
1543
  >
1306
1544
  <template #leadingIcon>
@@ -1390,10 +1628,17 @@ const navMenuClasses = computed<Partial<Record<NavMenuPart, string>>>(() => ({
1390
1628
  />
1391
1629
  </span>
1392
1630
 
1631
+ <LocalePicker
1632
+ :label="t('header.language')"
1633
+ :classes="{ panel: PICKER_PANEL_LIFT }"
1634
+ :class="barPickerClass"
1635
+ />
1393
1636
  <CurrencyPicker
1637
+ :locale="contentLocale"
1394
1638
  :currencies="currency.offered.value"
1395
1639
  :model-value="currency.active.value"
1396
1640
  :busy="currency.busy.value"
1641
+ :classes="{ panel: PICKER_PANEL_LIFT }"
1397
1642
  :class="barPickerClass"
1398
1643
  @update:model-value="currency.choose"
1399
1644
  />