@revenexx/cover 0.22.0 → 0.22.1

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 (91) hide show
  1. package/app/api/categories.ts +1 -0
  2. package/app/api/offers.ts +1 -0
  3. package/app/app.config.ts +13 -0
  4. package/app/components/OgImage/CoverPage.takumi.vue +37 -0
  5. package/app/components/RevenexxForm.vue +21 -6
  6. package/app/components/account/approvals/AccountPendingApprovals.vue +19 -1
  7. package/app/components/account/approvals/AccountPendingOrderDetail.vue +3 -0
  8. package/app/components/account/carts/AccountCartsTable.vue +11 -1
  9. package/app/components/account/orderlists/AccountOrderListDetail.vue +32 -3
  10. package/app/components/account/organization/AccountOrganization.vue +1 -1
  11. package/app/components/auth/AuthForgotPasswordPanel.vue +7 -2
  12. package/app/components/auth/AuthLoginPanel.vue +23 -8
  13. package/app/components/auth/AuthRegisterTeaser.vue +1 -1
  14. package/app/components/cart/position/CartPosition.vue +11 -4
  15. package/app/components/cart/quickadd/CartQuickAdd.vue +4 -2
  16. package/app/components/cart/recommend/CartRecommendCard.vue +1 -0
  17. package/app/components/cart/switcher/CartSwitcher.vue +1 -0
  18. package/app/components/cart/view/CartListHeader.vue +5 -0
  19. package/app/components/cart/view/CartSummaryPanel.vue +7 -2
  20. package/app/components/cart/view/CartView.vue +4 -2
  21. package/app/components/checkout/onepage/CheckoutGate.vue +4 -2
  22. package/app/components/checkout/onepage/CheckoutGuestDetailsSection.vue +2 -1
  23. package/app/components/checkout/onepage/CheckoutPaymentSection.vue +1 -1
  24. package/app/components/layout/header/LocaleSwitcher.vue +7 -9
  25. package/app/components/product/detail/ProductDetailAddToCart.vue +17 -11
  26. package/app/components/product/detail/ProductDetailImageGallery.vue +101 -8
  27. package/app/components/product/detail/ProductDetailVariantRow.vue +84 -4
  28. package/app/components/product/detail/ProductDetailVariants.vue +75 -11
  29. package/app/components/product/detail/ProductDetailView.vue +64 -69
  30. package/app/composables/useAuthStore.ts +21 -4
  31. package/app/composables/useCategories.ts +24 -0
  32. package/app/composables/useCategoryAnswer.ts +30 -0
  33. package/app/composables/useCategorySeo.ts +62 -0
  34. package/app/composables/useDefaultUiLanguage.ts +14 -0
  35. package/app/composables/useOgImageReady.ts +16 -0
  36. package/app/composables/useProductAnswer.ts +121 -0
  37. package/app/composables/useProductLocales.ts +21 -10
  38. package/app/composables/useProductSeo.ts +145 -0
  39. package/app/composables/useRouteSubject.ts +23 -3
  40. package/app/composables/useSeoContext.ts +164 -0
  41. package/app/composables/useSeoHead.ts +189 -0
  42. package/app/composables/useSeoRules.ts +23 -0
  43. package/app/interfaces/seo.ts +48 -0
  44. package/app/layouts/default.vue +2 -8
  45. package/app/layouts/focus.vue +3 -1
  46. package/app/payments/psp/novalnet.ts +25 -3
  47. package/app/payments/psp/novalnetStyle.ts +186 -0
  48. package/app/shared/categoryTree.ts +7 -0
  49. package/app/shared/locale.ts +8 -0
  50. package/app/shared/productLocales.ts +62 -1
  51. package/app/shared/seoRules.ts +297 -0
  52. package/app/shared/structuredData.ts +104 -0
  53. package/i18n/locales/de/account.json +4 -0
  54. package/i18n/locales/de/common.json +6 -0
  55. package/i18n/locales/de/pages.json +109 -0
  56. package/i18n/locales/en/account.json +4 -0
  57. package/i18n/locales/en/common.json +6 -0
  58. package/i18n/locales/en/pages.json +109 -0
  59. package/nuxt.config.ts +140 -1
  60. package/package.json +10 -3
  61. package/server/api/auth/otp.post.ts +4 -8
  62. package/server/api/auth/otp.put.ts +20 -11
  63. package/server/api/categories/[slug]/exists.get.ts +28 -0
  64. package/server/api/offers/guest.get.ts +53 -0
  65. package/server/api/orders/index.post.ts +1 -11
  66. package/server/api/payment/methods.post.ts +2 -33
  67. package/server/api/product/[id]/locales.get.ts +9 -3
  68. package/server/data/product-detail.json +0 -20
  69. package/server/dev/errorHandler.ts +9 -5
  70. package/server/dev/typesense/autoSeed.ts +63 -0
  71. package/server/dev/typesense/seed.ts +4 -43
  72. package/server/dev/typesense/seedProducts.ts +87 -0
  73. package/server/interfaces/category.ts +5 -0
  74. package/server/interfaces/product.ts +13 -6
  75. package/server/middleware/missing-media.ts +2 -2
  76. package/server/plugins/previewHostNoindex.ts +21 -0
  77. package/server/plugins/seoSiteConfig.ts +62 -0
  78. package/server/routes/robots.txt.ts +21 -0
  79. package/server/services/ApiCategoryService.ts +6 -0
  80. package/server/services/ApiProductService.ts +2 -2
  81. package/server/services/LocalFileCategoryService.ts +6 -0
  82. package/server/utils/liveCatalog.ts +83 -18
  83. package/server/utils/livePrices.ts +12 -3
  84. package/server/utils/locale.ts +3 -8
  85. package/server/utils/offerService.ts +8 -3
  86. package/server/utils/paymentOptions.ts +49 -0
  87. package/server/utils/promotionsService.ts +25 -0
  88. package/server/utils/revenexxSdk.ts +7 -1
  89. package/server/utils/seoRequestHost.ts +21 -0
  90. package/server/utils/storefrontMessages.ts +5 -5
  91. package/server/utils/storefrontSeoRules.ts +298 -0
@@ -130,7 +130,7 @@ const messageColor = (severity: string) =>
130
130
  variant="outline"
131
131
  size="sm"
132
132
  tabindex="0"
133
- class="print:hidden"
133
+ class="print:hidden max-lg:min-h-11"
134
134
  :label="t('cart.quickAdd.action')"
135
135
  @click="quickAddOpen = true"
136
136
  />
@@ -178,6 +178,7 @@ const messageColor = (severity: string) =>
178
178
  variant="soft"
179
179
  size="xs"
180
180
  tabindex="0"
181
+ class="max-lg:min-h-11"
181
182
  :label="t('cart.requisition.load')"
182
183
  @click="loadRequisition(requisition)"
183
184
  />
@@ -211,7 +212,7 @@ const messageColor = (severity: string) =>
211
212
  :description="t('cart.emptyState.description')"
212
213
  class="mb-6"
213
214
  />
214
- <div class="grid sm:grid-cols-2 gap-8 items-start">
215
+ <div class="grid grid-cols-1 sm:grid-cols-2 gap-8 items-start">
215
216
  <div
216
217
  v-if="!isReadOnly"
217
218
  class="border border-(--ui-border) rounded-xl p-4 md:p-5 space-y-3"
@@ -341,6 +342,7 @@ const messageColor = (severity: string) =>
341
342
  :title="t('directOrder.title')"
342
343
  :description="t('directOrder.description')"
343
344
  :ui="{ content: 'sm:max-w-4xl' }"
345
+ :close="{ class: 'max-lg:size-11 max-lg:justify-center' }"
344
346
  >
345
347
  <template #body>
346
348
  <AccountDirectOrder
@@ -29,12 +29,12 @@ const { b2b: guestB2b, b2c: guestB2c } = useGuestOrdering();
29
29
  </p>
30
30
  </div>
31
31
 
32
- <div class="grid sm:grid-cols-2 gap-10 max-w-5xl">
32
+ <div class="grid grid-cols-1 sm:grid-cols-2 gap-10 max-w-5xl">
33
33
  <AuthLoginPanel @success="emit('signedIn')" />
34
34
 
35
35
  <div
36
36
  v-if="guestB2b || guestB2c"
37
- class="border border-default py-6 px-8 rounded-lg flex flex-col gap-4"
37
+ class="border border-default py-6 px-6 sm:px-8 rounded-lg flex flex-col gap-4"
38
38
  >
39
39
  <h2 class="text-xl font-semibold text-highlighted">
40
40
  {{ t('onepage.gate.guestTitle') }}
@@ -48,6 +48,7 @@ const { b2b: guestB2b, b2c: guestB2c } = useGuestOrdering();
48
48
  variant="outline"
49
49
  block
50
50
  class="min-h-11 lg:min-h-0"
51
+ :ui="{ label: 'whitespace-normal' }"
51
52
  tabindex="0"
52
53
  :icon="icon('company')"
53
54
  :label="t('onepage.gate.guestBusiness')"
@@ -59,6 +60,7 @@ const { b2b: guestB2b, b2c: guestB2c } = useGuestOrdering();
59
60
  variant="outline"
60
61
  block
61
62
  class="min-h-11 lg:min-h-0"
63
+ :ui="{ label: 'whitespace-normal' }"
62
64
  tabindex="0"
63
65
  :icon="icon('user')"
64
66
  :label="t('onepage.gate.guestPrivate')"
@@ -40,7 +40,8 @@ const addressFields: AddressFieldRow[] = [
40
40
 
41
41
  <template>
42
42
  <div class="bg-(--ui-bg) border border-(--ui-border) rounded-xl p-6 space-y-6">
43
- <div class="flex items-center justify-between gap-3">
43
+ <!-- The badge drops under the title when both don't fit (German at 320 px). -->
44
+ <div class="flex flex-wrap items-center justify-between gap-3">
44
45
  <CheckoutSectionTitle
45
46
  :step="1"
46
47
  :title="t('onepage.sections.guestDetails')"
@@ -273,7 +273,7 @@ if (import.meta.client) {
273
273
  <div
274
274
  v-show="!psp.hostedFallback.value"
275
275
  ref="cardEl"
276
- class="w-full sm:max-w-sm p-3 rounded-lg border border-(--ui-border) bg-(--ui-bg)"
276
+ class="w-full sm:max-w-sm p-3 rounded-lg border border-(--ui-border) bg-(--ui-bg) data-[psp-fields=own]:p-0 data-[psp-fields=own]:border-0 data-[psp-fields=own]:rounded-none data-[psp-fields=own]:bg-transparent"
277
277
  />
278
278
  <p v-if="psp.hostedFallback.value" class="text-sm text-muted">{{ t('onepage.payment.cardOnProviderPage') }}</p>
279
279
  <p v-if="cardError" class="text-sm text-error-500">{{ cardError }}</p>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { marketLanguageOptions } from "../../../shared/locale";
2
+ import { CONTENT_LOCALE_COOKIE, marketLanguageOptions } from "../../../shared/locale";
3
3
 
4
4
  /**
5
5
  * Locale selector (Smashing Magazine, "Designing A Better Language
@@ -20,13 +20,12 @@ const { icon } = useIcons();
20
20
  const { t, locale, locales } = useI18n();
21
21
  const switchLocalePath = useSwitchLocalePath();
22
22
  const localePath = useLocalePath();
23
- const { hasPage, fallbackPath } = useProductLocales();
24
- const runtimeConfig = useRuntimeConfig();
23
+ const { hasPage, fallbackPath, localizePath } = useProductLocales();
25
24
  const { markets } = useMarkets();
26
25
  const { market, setMarket, region, currencies, currency, currencySymbol, setCurrency } = useLocalePreferences(markets);
27
26
 
28
27
  /** The market locale the buyer chose (`de-CH`, `fr-FR`); read by the BFF for catalogue + search. */
29
- const contentLocale = useCookie<string>("cover-content-locale", { default: () => "", watch: true });
28
+ const contentLocale = useCookie<string>(CONTENT_LOCALE_COOKIE, { default: () => "", watch: true });
30
29
 
31
30
  const open = ref(false);
32
31
 
@@ -38,10 +37,7 @@ const marketItems = computed(() => markets.value.map(entry => ({
38
37
 
39
38
  const uiLanguages = computed(() => locales.value.map(entry => entry.code));
40
39
 
41
- const defaultUiLanguage = computed(() => {
42
- const i18nConfig = (runtimeConfig.public as { i18n?: { defaultLocale?: string }; defaultLocale?: string });
43
- return i18nConfig.i18n?.defaultLocale || i18nConfig.defaultLocale || uiLanguages.value[0] || "de";
44
- });
40
+ const defaultUiLanguage = useDefaultUiLanguage();
45
41
 
46
42
  /** The language's own name ("Deutsch", "Français"), for languages without an i18n entry. */
47
43
  function nativeLanguageName(language: string): string {
@@ -68,7 +64,9 @@ interface LanguageItem {
68
64
 
69
65
  /** Where a UI language leads: the same page, or the product's category when the product has no page there (PE-914). */
70
66
  function languageTarget(uiLocale: string): string {
71
- return hasPage(uiLocale) ? switchLocalePath(uiLocale as typeof locale.value) : localePath(fallbackPath.value, uiLocale as typeof locale.value);
67
+ return hasPage(uiLocale)
68
+ ? localizePath(switchLocalePath(uiLocale as typeof locale.value), uiLocale)
69
+ : localePath(fallbackPath.value, uiLocale as typeof locale.value);
72
70
  }
73
71
 
74
72
  const languageItems = computed<LanguageItem[]>(() => {
@@ -160,7 +160,9 @@ onUnmounted(() => {
160
160
 
161
161
  <template>
162
162
  <div class="space-y-4">
163
- <div class="flex gap-3">
163
+ <!-- Wraps on narrow phones: when the stepper and the CTA pair don't fit one
164
+ row (320 px; 375 px in German when signed in), the pair takes the next. -->
165
+ <div class="flex flex-wrap gap-3">
164
166
  <div
165
167
  class="flex items-center rounded-lg border border-(--ui-border) overflow-hidden
166
168
  shrink-0"
@@ -196,16 +198,20 @@ onUnmounted(() => {
196
198
  @click="increase"
197
199
  />
198
200
  </div>
199
- <UButton
200
- :icon="icon('cart')"
201
- size="lg"
202
- class="flex-1 justify-center min-h-11 lg:min-h-0"
203
- tabindex="0"
204
- :label="t('product.actions.addToCart')"
205
- :disabled="quantityInvalid"
206
- @click="addToCart"
207
- />
208
- <slot name="after-cta" />
201
+ <!-- CTA and the after-cta slot (signed in: the order-list button) wrap
202
+ as one pair, so the slot never ends up alone on a second row. -->
203
+ <div class="flex flex-[1_1_10rem] gap-3">
204
+ <UButton
205
+ :icon="icon('cart')"
206
+ size="lg"
207
+ class="flex-1 justify-center min-h-11 lg:min-h-0"
208
+ tabindex="0"
209
+ :label="t('product.actions.addToCart')"
210
+ :disabled="quantityInvalid"
211
+ @click="addToCart"
212
+ />
213
+ <slot name="after-cta" />
214
+ </div>
209
215
  </div>
210
216
 
211
217
  <UiFeedbackErrorBoundary
@@ -17,16 +17,89 @@ const has3d = computed(() => !!props.modelUrl);
17
17
  const initialMode = (): "image" | "model" => (props.images.length || !props.modelUrl ? "image" : "model");
18
18
  const mode = ref<"image" | "model">(initialMode());
19
19
  const selectedIndex = ref(0);
20
- const selectedImage = computed(() => props.images[selectedIndex.value]);
20
+ // The stills sit side by side in a scroll-snap track, so a finger swipe (or a
21
+ // trackpad's sideways scroll) moves between them natively; the track's scroll
22
+ // position is the source of truth for which still is shown.
23
+ const track = ref<HTMLElement | null>(null);
24
+
25
+ // A thumbnail click sets the selection first and then smooth-scrolls the track;
26
+ // the scroll events on the way pass every still in between (and round to the
27
+ // old one first), which would drag the selection back through them. While the
28
+ // code is scrolling, those events are not the user's and are ignored — until
29
+ // `scrollend`, or a timeout where the browser has no `scrollend` (Safari < 18.2).
30
+ const PROGRAMMATIC_SCROLL_TIMEOUT_MS = 1000;
31
+ let isProgrammaticScroll = false;
32
+ let programmaticScrollTimer: ReturnType<typeof setTimeout> | null = null;
33
+
34
+ function endProgrammaticScroll(): void {
35
+ isProgrammaticScroll = false;
36
+ if (programmaticScrollTimer) {
37
+ clearTimeout(programmaticScrollTimer);
38
+ programmaticScrollTimer = null;
39
+ }
40
+ }
41
+
42
+ function scrollTrackTo(index: number, isAnimated: boolean): void {
43
+ const el = track.value;
44
+ if (!el) {
45
+ return;
46
+ }
47
+ const isReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
48
+ const isSmooth = isAnimated && !isReducedMotion;
49
+ endProgrammaticScroll();
50
+ if (isSmooth) {
51
+ isProgrammaticScroll = true;
52
+ programmaticScrollTimer = setTimeout(endProgrammaticScroll, PROGRAMMATIC_SCROLL_TIMEOUT_MS);
53
+ }
54
+ el.scrollTo({ left: index * el.clientWidth, behavior: isSmooth ? "smooth" : "auto" });
55
+ }
56
+
57
+ /** The scroll came to rest: whatever moved it, the still in view is the selected one. */
58
+ function onTrackScrollEnd(): void {
59
+ endProgrammaticScroll();
60
+ onTrackScroll();
61
+ }
62
+
63
+ /** A finger or wheel on the track during a programmatic scroll takes over from it. */
64
+ function onTrackUserInput(): void {
65
+ endProgrammaticScroll();
66
+ }
67
+
68
+ function onTrackScroll(): void {
69
+ const el = track.value;
70
+ if (!el || el.clientWidth === 0 || isProgrammaticScroll) {
71
+ return;
72
+ }
73
+ const index = Math.round(el.scrollLeft / el.clientWidth);
74
+ if (index !== selectedIndex.value && index >= 0 && index < props.images.length) {
75
+ selectedIndex.value = index;
76
+ }
77
+ }
21
78
 
22
79
  function showImage(index: number): void {
80
+ const wasModel = mode.value === "model";
23
81
  selectedIndex.value = index;
24
82
  mode.value = "image";
83
+ // Coming back from 3D the track mounts fresh; the track watcher positions it.
84
+ if (!wasModel) {
85
+ scrollTrackTo(index, true);
86
+ }
25
87
  }
26
88
 
89
+ // A freshly mounted track (first render, or back from the 3D viewer) starts on
90
+ // the selected still.
91
+ watch(track, (el) => {
92
+ if (el) {
93
+ scrollTrackTo(selectedIndex.value, false);
94
+ }
95
+ });
96
+
97
+ onBeforeUnmount(endProgrammaticScroll);
98
+
27
99
  watch([() => props.images, () => props.modelUrl], () => {
28
100
  selectedIndex.value = 0;
29
101
  mode.value = initialMode();
102
+ scrollTrackTo(0, false);
30
103
  });
31
104
  </script>
32
105
 
@@ -34,7 +107,7 @@ watch([() => props.images, () => props.modelUrl], () => {
34
107
  <div class="flex flex-col gap-3">
35
108
  <div
36
109
  class="w-full aspect-square rounded-2xl overflow-hidden bg-elevated/60
37
- ring-1 ring-(--ui-border) flex items-center justify-center p-8"
110
+ ring-1 ring-(--ui-border) flex items-center justify-center"
38
111
  >
39
112
  <!-- Interactive 3D (sovereign three.js engine; no AR). The square box
40
113
  gives model-viewer a definite height so its canvas doesn't collapse. -->
@@ -43,14 +116,34 @@ watch([() => props.images, () => props.modelUrl], () => {
43
116
  :src="modelUrl"
44
117
  :poster="modelPoster || undefined"
45
118
  auto-rotate
46
- class="w-full h-full"
119
+ class="w-full h-full p-8"
47
120
  />
48
- <img
49
- v-else-if="selectedImage"
50
- :src="getImageUrl(selectedImage.url)"
51
- :alt="`Product image ${selectedIndex + 1}`"
52
- class="max-w-full max-h-full object-contain"
121
+ <div
122
+ v-else-if="images.length"
123
+ ref="track"
124
+ class="flex w-full h-full overflow-x-auto overflow-y-hidden snap-x snap-mandatory overscroll-x-contain
125
+ [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
126
+ data-testid="gallery-track"
127
+ @scroll.passive="onTrackScroll"
128
+ @scrollend="onTrackScrollEnd"
129
+ @touchstart.passive="onTrackUserInput"
130
+ @wheel.passive="onTrackUserInput"
131
+ @pointerdown="onTrackUserInput"
53
132
  >
133
+ <div
134
+ v-for="(image, index) in images"
135
+ :key="image.url"
136
+ class="w-full h-full shrink-0 snap-center snap-always flex items-center justify-center p-8"
137
+ >
138
+ <img
139
+ :src="getImageUrl(image.url)"
140
+ :alt="`Product image ${index + 1}`"
141
+ :loading="index === 0 ? 'eager' : 'lazy'"
142
+ draggable="false"
143
+ class="max-w-full max-h-full object-contain"
144
+ >
145
+ </div>
146
+ </div>
54
147
  </div>
55
148
 
56
149
  <div
@@ -13,6 +13,11 @@
13
13
  * the cue that tells a screen reader which row you are on; and the order
14
14
  * button's absolutely positioned empty span pads its hit area out to 3rem on
15
15
  * coarse pointers only.
16
+ *
17
+ * `layout="card"` is the same variant as a card for the phone list below md
18
+ * (PO-23): seven columns do not fit a phone, and in a sideways scroller the
19
+ * price and the order button were the ones off-screen. It reuses the row's
20
+ * composables, which is why it lives here and not in a component of its own.
16
21
  */
17
22
  import type { ProductList } from "../../../interfaces/product-list";
18
23
  import type { ProductVariantAxis, ProductVariantRow } from "../../../interfaces/product-variants";
@@ -27,9 +32,11 @@ const props = withDefaults(defineProps<{
27
32
  categorySlug?: string;
28
33
  subcategorySlug?: string;
29
34
  showOrderButton?: boolean;
35
+ layout?: "row" | "card";
30
36
  }>(), {
31
37
  categorySlug: "",
32
38
  showOrderButton: true,
39
+ layout: "row",
33
40
  });
34
41
 
35
42
  const { t } = useI18n();
@@ -59,14 +66,87 @@ const addToCartLabel = computed(() => t("product.actions.addToCart"));
59
66
  </script>
60
67
 
61
68
  <template>
62
- <tr :class="row.isSelf ? 'bg-primary/5' : 'hover:bg-elevated/40'">
69
+ <div
70
+ v-if="layout === 'card'"
71
+ class="-m-4 p-4 space-y-2"
72
+ :class="row.isSelf ? 'bg-primary/5 border-l-2 border-primary' : ''"
73
+ >
74
+ <div class="flex items-center justify-between gap-3">
75
+ <NuxtLink
76
+ :to="to"
77
+ class="-my-3 inline-flex min-h-11 items-center tabular-nums"
78
+ :class="row.isSelf ? 'font-semibold text-highlighted' : 'font-medium text-primary hover:underline'"
79
+ >
80
+ {{ row.sku }}
81
+ </NuxtLink>
82
+ <span class="inline-flex shrink-0 items-center gap-1.5 text-sm">
83
+ <span
84
+ class="size-2 shrink-0 rounded-full"
85
+ :class="isInStock ? 'bg-success' : 'bg-error'"
86
+ aria-hidden="true"
87
+ />
88
+ <span :class="isInStock ? 'text-success' : 'text-error'">
89
+ {{ isInStock ? t('product.stock.available') : t('product.stock.unavailable') }}
90
+ </span>
91
+ </span>
92
+ </div>
93
+
94
+ <dl
95
+ v-if="axes.length"
96
+ class="flex flex-wrap gap-x-4 gap-y-1 text-sm"
97
+ >
98
+ <div
99
+ v-for="axis in axes"
100
+ :key="axis.code"
101
+ class="flex gap-1.5"
102
+ >
103
+ <dt class="text-muted">
104
+ {{ axis.unit ? `${axis.label} (${axis.unit})` : axis.label }}
105
+ </dt>
106
+ <dd
107
+ class="tabular-nums"
108
+ :class="row.values[axis.code] ? 'text-highlighted' : 'text-muted'"
109
+ >
110
+ {{ row.values[axis.code] ?? '—' }}
111
+ </dd>
112
+ </div>
113
+ </dl>
114
+
115
+ <p
116
+ v-if="row.shortName"
117
+ class="text-sm text-muted"
118
+ >
119
+ {{ row.shortName }}
120
+ </p>
121
+
122
+ <div class="flex items-center justify-between gap-3 pt-1">
123
+ <CategoryInfoCategoryPrice :product="asProduct" />
124
+ <UButton
125
+ v-if="showOrderButton"
126
+ color="primary"
127
+ variant="outline"
128
+ class="min-h-11 shrink-0 cursor-pointer"
129
+ :disabled="!canOrder"
130
+ :title="canOrder ? addToCartLabel : t('product.variants.notOrderable')"
131
+ :aria-label="t('product.variants.addToCartAria', { sku: row.sku })"
132
+ :icon="icon('cart')"
133
+ :label="t('product.actions.order')"
134
+ @click="addToCart()"
135
+ />
136
+ </div>
137
+ </div>
138
+
139
+ <tr
140
+ v-else
141
+ :class="row.isSelf ? 'bg-primary/5' : 'hover:bg-elevated/40'"
142
+ >
63
143
  <td
64
144
  class="py-3 pr-4 whitespace-nowrap"
65
145
  :class="row.isSelf ? 'border-l-2 border-primary pl-3' : 'pl-0'"
66
146
  >
67
147
  <NuxtLink
68
148
  :to="to"
69
- class="tabular-nums"
149
+ class="tabular-nums max-lg:-my-3 max-lg:inline-flex max-lg:min-h-11 max-lg:items-center"
70
150
  :class="row.isSelf ? 'font-semibold text-highlighted' : 'text-primary hover:underline'"
71
151
  >
72
152
  {{ row.sku }}
@@ -113,7 +193,7 @@ const addToCartLabel = computed(() => t("product.actions.addToCart"));
113
193
  <button
114
194
  type="button"
115
195
  :disabled="!canOrder"
116
- class="relative inline-flex items-center gap-1.5 rounded-md py-1.5 pr-2.5 pl-2
196
+ class="relative inline-flex items-center gap-1.5 rounded-md py-1.5 pr-2.5 pl-2 max-lg:min-h-11 max-lg:min-w-11 max-lg:justify-center
117
197
  text-sm font-medium ring-1 cursor-pointer text-primary ring-(--ui-border)
118
198
  hover:bg-primary/5 disabled:cursor-not-allowed disabled:text-dimmed
119
199
  disabled:ring-(--ui-border) disabled:hover:bg-transparent
@@ -132,7 +212,7 @@ const addToCartLabel = computed(() => t("product.actions.addToCart"));
132
212
  :name="icon('cart')"
133
213
  class="size-4 shrink-0"
134
214
  />
135
- <span class="max-sm:sr-only">{{ t('product.actions.order') }}</span>
215
+ <span class="max-lg:sr-only">{{ t('product.actions.order') }}</span>
136
216
  </button>
137
217
  </td>
138
218
  </tr>
@@ -16,6 +16,9 @@
16
16
  *
17
17
  * A chip's absolutely positioned empty span pads its remove button out to a
18
18
  * 3rem hit area on coarse pointers only.
19
+ *
20
+ * Below md the table gives way to a card list (UiTableCardList, PO-23) and a
21
+ * sort select stands in for the header buttons; both read the same sort state.
19
22
  */
20
23
  import type {
21
24
  ProductVariant,
@@ -300,6 +303,30 @@ const priceHeader = computed(() => {
300
303
  function axisLabel(axis: ProductVariantAxis): string {
301
304
  return axis.unit ? `${axis.label} (${axis.unit})` : axis.label;
302
305
  }
306
+
307
+ /** The header sort buttons as select entries for the phone card list. */
308
+ const mobileSortTargets = computed<{ target: ProductVariantSort; label: string }[]>(() => [
309
+ { target: { kind: "sku" }, label: t("product.detail.sku") },
310
+ ...props.axes.map(axis => ({ target: { kind: "axis", code: axis.code } as ProductVariantSort, label: axisLabel(axis) })),
311
+ { target: { kind: "name" }, label: t("product.variants.columns.name") },
312
+ ]);
313
+
314
+ const mobileSortItems = computed(() => mobileSortTargets.value.flatMap(({ target, label }) => [
315
+ { value: `${sortId(target)}|asc`, label: t("table.sortAsc", { column: label }) },
316
+ { value: `${sortId(target)}|desc`, label: t("table.sortDesc", { column: label }) },
317
+ ]));
318
+
319
+ const mobileSort = computed({
320
+ get: () => `${sortId(sort.value)}|${isAscending.value ? "asc" : "desc"}`,
321
+ set: (value: string) => {
322
+ const [id, direction] = value.split("|");
323
+ const match = mobileSortTargets.value.find(entry => sortId(entry.target) === id);
324
+ if (match) {
325
+ sort.value = match.target;
326
+ isAscending.value = direction !== "desc";
327
+ }
328
+ },
329
+ });
303
330
  </script>
304
331
 
305
332
  <template>
@@ -338,7 +365,8 @@ function axisLabel(axis: ProductVariantAxis): string {
338
365
  type="search"
339
366
  inputmode="numeric"
340
367
  size="sm"
341
- class="w-44"
368
+ class="w-full md:w-44"
369
+ :ui="{ base: 'max-lg:min-h-11' }"
342
370
  :icon="icon('search')"
343
371
  :placeholder="t('product.detail.sku')"
344
372
  :aria-label="t('product.variants.filterSkuAria')"
@@ -353,7 +381,7 @@ function axisLabel(axis: ProductVariantAxis): string {
353
381
  variant="outline"
354
382
  size="sm"
355
383
  tabindex="0"
356
- class="cursor-pointer"
384
+ class="cursor-pointer max-lg:min-h-11"
357
385
  :trailing-icon="icon('chevron-down')"
358
386
  >
359
387
  {{ axisLabel(axis) }}
@@ -380,7 +408,7 @@ function axisLabel(axis: ProductVariantAxis): string {
380
408
  v-for="option in axisOptions(axis.code)"
381
409
  :key="option.value"
382
410
  >
383
- <label class="group/row flex cursor-pointer items-center gap-2.5">
411
+ <label class="group/row flex cursor-pointer items-center gap-2.5 max-lg:min-h-11">
384
412
  <UCheckbox
385
413
  :model-value="isSelected(axis.code, option.value)"
386
414
  tabindex="0"
@@ -403,7 +431,7 @@ function axisLabel(axis: ProductVariantAxis): string {
403
431
  variant="ghost"
404
432
  size="sm"
405
433
  block
406
- class="cursor-pointer"
434
+ class="cursor-pointer max-lg:min-h-11"
407
435
  @click="clearAxis(axis.code)"
408
436
  >
409
437
  {{ t('product.variants.clearAxis') }}
@@ -418,7 +446,7 @@ function axisLabel(axis: ProductVariantAxis): string {
418
446
  :variant="availableOnly ? 'subtle' : 'outline'"
419
447
  size="sm"
420
448
  tabindex="0"
421
- class="cursor-pointer"
449
+ class="cursor-pointer max-lg:min-h-11"
422
450
  :aria-pressed="availableOnly"
423
451
  @click="availableOnly = !availableOnly"
424
452
  >
@@ -461,7 +489,7 @@ function axisLabel(axis: ProductVariantAxis): string {
461
489
  color="neutral"
462
490
  variant="ghost"
463
491
  size="sm"
464
- class="cursor-pointer"
492
+ class="cursor-pointer max-lg:min-h-11"
465
493
  @click="resetFilters"
466
494
  >
467
495
  {{ t('product.variants.resetAll') }}
@@ -469,7 +497,43 @@ function axisLabel(axis: ProductVariantAxis): string {
469
497
  </div>
470
498
  </div>
471
499
 
472
- <div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
500
+ <UiTableCardList
501
+ v-model:sort="mobileSort"
502
+ class="mt-4"
503
+ :rows="visibleRows"
504
+ :row-key="row => row.id"
505
+ :sort-items="mobileSortItems"
506
+ >
507
+ <template #item="{ row }">
508
+ <ProductDetailVariantRow
509
+ layout="card"
510
+ :row="row"
511
+ :axes="axes"
512
+ :to="linkFor(row)"
513
+ :tax-rate="taxRate"
514
+ :category-slug="categorySlug"
515
+ :subcategory-slug="subcategorySlug"
516
+ :show-order-button="showOrderButton"
517
+ />
518
+ </template>
519
+ <template #empty>
520
+ <p class="py-8 text-center text-sm text-muted">
521
+ {{ t('product.variants.empty') }}
522
+ <button
523
+ type="button"
524
+ class="text-primary hover:underline cursor-pointer min-h-11"
525
+ @click="resetFilters"
526
+ >
527
+ {{ t('product.variants.reset') }}
528
+ </button>
529
+ </p>
530
+ </template>
531
+ </UiTableCardList>
532
+
533
+ <!-- relative: the order column's sr-only header label is absolutely
534
+ positioned; without a positioned ancestor here it escaped this
535
+ scroller and widened the whole page on phones by ~300px. -->
536
+ <div class="relative hidden md:block -mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
473
537
  <div class="inline-block min-w-full px-4 py-2 align-middle sm:px-6 lg:px-8">
474
538
  <table class="w-full text-sm">
475
539
  <thead>
@@ -480,7 +544,7 @@ function axisLabel(axis: ProductVariantAxis): string {
480
544
  >
481
545
  <button
482
546
  type="button"
483
- class="inline-flex items-center gap-1 hover:text-highlighted cursor-pointer"
547
+ class="inline-flex items-center gap-1 hover:text-highlighted cursor-pointer max-lg:min-h-11"
484
548
  @click="toggleSort({ kind: 'sku' })"
485
549
  >
486
550
  {{ t('product.detail.sku') }}
@@ -499,7 +563,7 @@ function axisLabel(axis: ProductVariantAxis): string {
499
563
  >
500
564
  <button
501
565
  type="button"
502
- class="inline-flex items-center gap-1 hover:text-highlighted cursor-pointer"
566
+ class="inline-flex items-center gap-1 hover:text-highlighted cursor-pointer max-lg:min-h-11"
503
567
  @click="toggleSort({ kind: 'axis', code: axis.code })"
504
568
  >
505
569
  {{ axisLabel(axis) }}
@@ -518,7 +582,7 @@ function axisLabel(axis: ProductVariantAxis): string {
518
582
  >
519
583
  <button
520
584
  type="button"
521
- class="inline-flex items-center gap-1 hover:text-highlighted cursor-pointer"
585
+ class="inline-flex items-center gap-1 hover:text-highlighted cursor-pointer max-lg:min-h-11"
522
586
  @click="toggleSort({ kind: 'name' })"
523
587
  >
524
588
  {{ t('product.variants.columns.name') }}
@@ -589,7 +653,7 @@ function axisLabel(axis: ProductVariantAxis): string {
589
653
  color="neutral"
590
654
  variant="outline"
591
655
  size="sm"
592
- class="cursor-pointer"
656
+ class="cursor-pointer max-lg:min-h-11"
593
657
  :trailing-icon="icon('chevron-down')"
594
658
  :label="t('product.variants.showAll', { count: sortedRows.length })"
595
659
  @click="isExpanded = true"