@shopbite-de/storefront 1.31.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yaml +54 -0
- package/CLAUDE.md +23 -8
- package/app/app.vue +10 -6
- package/app/assets/css/main.css +100 -61
- package/app/components/AddToWishlist.vue +15 -25
- package/app/components/Address/Card.vue +6 -11
- package/app/components/Address/Detail.vue +23 -23
- package/app/components/Address/Fields.vue +175 -73
- package/app/components/Address/Form.vue +107 -106
- package/app/components/Cart/Bar.vue +6 -9
- package/app/components/Cart/Item.vue +48 -63
- package/app/components/Cart/QuickView.vue +38 -25
- package/app/components/Cart/Upsell.vue +24 -62
- package/app/components/Category/Breadcrumb.vue +29 -3
- package/app/components/Category/FilterGroup.vue +20 -41
- package/app/components/Category/Listing.vue +100 -130
- package/app/components/Category/SearchInput.vue +22 -19
- package/app/components/Checkout/DeliveryTimeSelect.vue +55 -77
- package/app/components/Checkout/LoginOrRegister.vue +28 -29
- package/app/components/Checkout/PaymentAndDelivery.vue +114 -86
- package/app/components/Checkout/Summary.vue +90 -60
- package/app/components/Checkout/VoucherInput.vue +40 -27
- package/app/components/Contact/Form.vue +164 -192
- package/app/components/DemoBanner.vue +5 -5
- package/app/components/Footer/StoreStatus.vue +2 -2
- package/app/components/Footer.vue +125 -57
- package/app/components/Header.vue +283 -18
- package/app/components/Home/Categories.vue +116 -0
- package/app/components/Home/Facts.vue +71 -0
- package/app/components/Home/Faq.vue +34 -16
- package/app/components/Home/Hero.vue +172 -0
- package/app/components/Home/Highlights.vue +29 -37
- package/app/components/Home/Restaurant.vue +102 -0
- package/app/components/Menu/BonCard.vue +180 -0
- package/app/components/Menu/CartPanel.vue +24 -0
- package/app/components/Menu/CategoryIndex.vue +54 -0
- package/app/components/Menu/OrderMode.vue +20 -0
- package/app/components/Menu/SectionHeader.vue +38 -0
- package/app/components/Navigation/MobileTop.vue +23 -15
- package/app/components/Order/Confirmation.vue +119 -0
- package/app/components/Order/Detail.vue +80 -88
- package/app/components/Product/CardSkeleton.vue +8 -12
- package/app/components/Product/Configurator.vue +8 -16
- package/app/components/Product/CrossSelling.vue +75 -83
- package/app/components/Product/DeselectIngredient.vue +17 -22
- package/app/components/Product/Detail.vue +35 -27
- package/app/components/Product/QuickView.vue +80 -51
- package/app/components/SalesChannelSwitch.vue +14 -28
- package/app/components/Sb/Button.vue +70 -0
- package/app/components/Sb/Checkbox.vue +73 -0
- package/app/components/Sb/Chip.vue +51 -0
- package/app/components/Sb/ChoiceGroup.vue +82 -0
- package/app/components/Sb/ConfirmDialog.vue +60 -0
- package/app/components/Sb/Field.vue +77 -0
- package/app/components/Sb/Icon.vue +66 -0
- package/app/components/Sb/IconButton.vue +55 -0
- package/app/components/Sb/Input.vue +23 -0
- package/app/components/Sb/SegmentedControl.vue +34 -0
- package/app/components/Sb/Select.vue +49 -0
- package/app/components/Sb/Sheet.vue +83 -0
- package/app/components/Sb/Stars.vue +60 -0
- package/app/components/Sb/StatusPill.vue +38 -0
- package/app/components/Sb/Stepper.vue +72 -0
- package/app/components/User/AccountHeader.vue +16 -0
- package/app/components/User/AuthPanel.vue +41 -0
- package/app/components/User/Detail.vue +32 -29
- package/app/components/User/LoginForm.vue +92 -98
- package/app/components/User/RegistrationForm.vue +285 -249
- package/app/components/Wishlist.vue +55 -155
- package/app/composables/useCartMutations.ts +9 -27
- package/app/composables/useCheckoutMethodGuard.ts +2 -24
- package/app/composables/useContactForm.ts +66 -0
- package/app/composables/useHomeMenuCategories.ts +41 -0
- package/app/composables/useNavigation.ts +10 -2
- package/app/composables/useOrderMode.ts +65 -0
- package/app/composables/useRegistrationForm.ts +161 -0
- package/app/composables/useRestaurantSchema.ts +1 -1
- package/app/composables/useShareLink.ts +3 -13
- package/app/composables/useSortingSelection.ts +13 -0
- package/app/composables/useThemePreset.ts +15 -0
- package/app/composables/useVoucherCode.ts +7 -16
- package/app/composables/useWishlistActions.ts +0 -51
- package/app/error.vue +31 -9
- package/app/layouts/account.vue +45 -50
- package/app/layouts/default.vue +2 -3
- package/app/layouts/listing.vue +3 -5
- package/app/pages/[...all].vue +8 -4
- package/app/pages/account/recover/password/index.vue +113 -80
- package/app/pages/anmelden.vue +11 -10
- package/app/pages/bestellung/[id]/erfolg.vue +1 -15
- package/app/pages/bestellung/[id]/fehler.vue +63 -51
- package/app/pages/bestellung/[id]/index.vue +3 -85
- package/app/pages/bestellung/kasse.vue +29 -0
- package/app/pages/bestellung.vue +8 -60
- package/app/pages/index.vue +12 -52
- package/app/pages/kontakt.vue +27 -7
- package/app/pages/konto/adressen.vue +106 -102
- package/app/pages/konto/bestellung/[id].vue +9 -43
- package/app/pages/konto/bestellungen.vue +55 -33
- package/app/pages/konto/index.vue +47 -62
- package/app/pages/konto/profil.vue +162 -100
- package/app/pages/maintenance.vue +8 -6
- package/app/pages/merkliste.vue +7 -8
- package/app/pages/passwort-vergessen.vue +92 -75
- package/app/pages/registrierung/bestaetigen.vue +20 -48
- package/app/pages/registrierung/index.vue +16 -7
- package/app/pages/suche.vue +94 -95
- package/app/plugins/theme-preset.ts +9 -0
- package/app/utils/highlight.ts +25 -0
- package/app/utils/product.ts +9 -0
- package/app/validation/registrationSchema.ts +1 -1
- package/modules/theme.ts +115 -0
- package/nuxt.config.ts +27 -15
- package/package.json +6 -8
- package/playwright.config.ts +11 -0
- package/server/api/listing/[categoryId].get.ts +3 -0
- package/shared/theme/presets.ts +303 -0
- package/test/a11y/presets.test.ts +225 -0
- package/test/nuxt/AccountPagesPreset.test.ts +191 -0
- package/test/nuxt/AuthPagesPreset.test.ts +87 -0
- package/test/nuxt/CartCheckoutPreset.test.ts +154 -0
- package/test/nuxt/CartItem.test.ts +18 -3
- package/test/nuxt/CartUpsell.test.ts +1 -2
- package/test/nuxt/CheckoutFormsPreset.test.ts +120 -0
- package/test/nuxt/CheckoutOnePage.test.ts +115 -0
- package/test/nuxt/CheckoutSummary.test.ts +6 -6
- package/test/nuxt/CheckoutVoucherInput.test.ts +20 -32
- package/test/nuxt/ContactFormPreset.test.ts +115 -0
- package/test/nuxt/FooterStoreStatus.test.ts +2 -2
- package/test/nuxt/HeaderFooterPreset.test.ts +134 -0
- package/test/nuxt/HomeFaq.test.ts +3 -2
- package/test/nuxt/MenuBonCard.test.ts +122 -0
- package/test/nuxt/OrderPagesPreset.test.ts +132 -0
- package/test/nuxt/PaymentAndDelivery.test.ts +0 -4
- package/test/nuxt/ProductCrossSelling.test.ts +2 -1
- package/test/nuxt/ProductDeselectIngredient.test.ts +5 -3
- package/test/nuxt/ProductSheetPreset.test.ts +105 -0
- package/test/nuxt/RegisterConfirmPage.test.ts +0 -8
- package/test/nuxt/RegistrationForm.test.ts +89 -270
- package/test/nuxt/SbBaseComponents.test.ts +170 -0
- package/test/nuxt/SbStars.test.ts +25 -0
- package/test/nuxt/useCartMutations.test.ts +3 -17
- package/test/nuxt/useCartUpsell.test.ts +1 -1
- package/test/nuxt/useCheckoutMethodGuard.test.ts +0 -27
- package/test/nuxt/useShareLink.test.ts +1 -9
- package/test/nuxt/useWishlistActions.test.ts +3 -26
- package/test/unit/highlight.spec.ts +31 -0
- package/test/unit/product.spec.ts +12 -0
- package/test/unit/themePresets.spec.ts +61 -0
- package/app/app.config.ts +0 -19
- package/app/components/AnimatedSection.vue +0 -74
- package/app/components/BottomNavi.vue +0 -70
- package/app/components/Category/Header.vue +0 -48
- package/app/components/Checkout/PaymentMethod.vue +0 -30
- package/app/components/Checkout/ShippingMethod.vue +0 -30
- package/app/components/Cta.vue +0 -30
- package/app/components/Feature/Card.vue +0 -121
- package/app/components/Features.vue +0 -42
- package/app/components/Footer/Contact.vue +0 -82
- package/app/components/Header/Body.vue +0 -82
- package/app/components/Header/Right.vue +0 -187
- package/app/components/Header/Title.vue +0 -10
- package/app/components/Hero.vue +0 -233
- package/app/components/Home/MenuCategories.vue +0 -148
- package/app/components/ImageGallery.vue +0 -63
- package/app/components/Loading.vue +0 -29
- package/app/components/Navigation/DesktopLeft.vue +0 -39
- package/app/components/Product/Card.vue +0 -177
- package/app/components/Product/CardCompact.vue +0 -72
- package/app/components/Product/CardDietBadges.vue +0 -43
- package/app/components/Product/CardIngredients.vue +0 -35
- package/app/components/Product/CardKitchen.vue +0 -34
- package/app/components/Product/SearchBar.vue +0 -95
- package/app/components/PublicAnnouncement.vue +0 -17
- package/app/pages/bestellung/bestaetigen.vue +0 -16
- package/app/pages/bestellung/warenkorb.vue +0 -49
- package/app/pages/bestellung/zahlung-versand.vue +0 -25
- package/test/nuxt/AddressFields.test.ts +0 -222
- package/test/nuxt/AnimatedSection.test.ts +0 -67
- package/test/nuxt/ContactForm.test.ts +0 -207
- package/test/nuxt/FooterContact.test.ts +0 -102
- package/test/nuxt/HeaderRight.test.ts +0 -142
- package/test/nuxt/Hero.test.ts +0 -126
- package/test/nuxt/HomeMenuCategories.test.ts +0 -94
- package/test/nuxt/LoginForm.test.ts +0 -159
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
AlertDialogCancel,
|
|
4
|
+
AlertDialogContent,
|
|
5
|
+
AlertDialogDescription,
|
|
6
|
+
AlertDialogOverlay,
|
|
7
|
+
AlertDialogPortal,
|
|
8
|
+
AlertDialogRoot,
|
|
9
|
+
AlertDialogTitle,
|
|
10
|
+
} from "reka-ui";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Confirmation for actions that cannot be undone (#445), e.g. deleting the
|
|
14
|
+
* customer account. Reka's alert dialog traps the focus and starts on
|
|
15
|
+
* "Abbrechen"; the confirm button runs `confirm` and the dialog stays open
|
|
16
|
+
* until the caller closes it, so a failure can show inside.
|
|
17
|
+
*/
|
|
18
|
+
withDefaults(
|
|
19
|
+
defineProps<{
|
|
20
|
+
title: string;
|
|
21
|
+
description: string;
|
|
22
|
+
confirmLabel: string;
|
|
23
|
+
cancelLabel?: string;
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
}>(),
|
|
26
|
+
{ cancelLabel: "Abbrechen", loading: false },
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const emit = defineEmits<{ confirm: [] }>();
|
|
30
|
+
const open = defineModel<boolean>("open", { default: false });
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<AlertDialogRoot v-model:open="open">
|
|
35
|
+
<AlertDialogPortal>
|
|
36
|
+
<AlertDialogOverlay
|
|
37
|
+
class="fixed inset-0 z-50 bg-black/45 motion-safe:data-[state=open]:animate-[sb-fade-in_150ms_ease-out]"
|
|
38
|
+
/>
|
|
39
|
+
<AlertDialogContent
|
|
40
|
+
class="fixed top-1/2 left-1/2 z-50 flex w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 flex-col gap-4 rounded-sb-card bg-sb-surface p-6 font-body text-sb-ink shadow-2xl focus:outline-none motion-safe:data-[state=open]:animate-[sb-fade-in_150ms_ease-out]"
|
|
41
|
+
>
|
|
42
|
+
<AlertDialogTitle class="font-display text-2xl leading-tight">
|
|
43
|
+
{{ title }}
|
|
44
|
+
</AlertDialogTitle>
|
|
45
|
+
<AlertDialogDescription class="text-sb-ink-muted">
|
|
46
|
+
{{ description }}
|
|
47
|
+
</AlertDialogDescription>
|
|
48
|
+
<slot />
|
|
49
|
+
<div class="flex flex-col-reverse gap-3 sm:flex-row sm:justify-end">
|
|
50
|
+
<AlertDialogCancel as-child>
|
|
51
|
+
<SbButton variant="secondary">{{ cancelLabel }}</SbButton>
|
|
52
|
+
</AlertDialogCancel>
|
|
53
|
+
<SbButton :loading="loading" @click="emit('confirm')">{{
|
|
54
|
+
confirmLabel
|
|
55
|
+
}}</SbButton>
|
|
56
|
+
</div>
|
|
57
|
+
</AlertDialogContent>
|
|
58
|
+
</AlertDialogPortal>
|
|
59
|
+
</AlertDialogRoot>
|
|
60
|
+
</template>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Label, hint and error around a form control (#440). The default slot
|
|
4
|
+
* gets the ids to wire up: `id` for the control, `describedBy` for
|
|
5
|
+
* `aria-describedby` and `invalid` for `aria-invalid`. Errors are words,
|
|
6
|
+
* not only a red border (WCAG 3.3.1).
|
|
7
|
+
*/
|
|
8
|
+
const props = withDefaults(
|
|
9
|
+
defineProps<{
|
|
10
|
+
label: string;
|
|
11
|
+
hint?: string;
|
|
12
|
+
error?: string;
|
|
13
|
+
/** marks the field as optional; required fields are not marked */
|
|
14
|
+
optional?: boolean;
|
|
15
|
+
hideLabel?: boolean;
|
|
16
|
+
/** fixed id of the control, e.g. for links from an error summary */
|
|
17
|
+
id?: string;
|
|
18
|
+
}>(),
|
|
19
|
+
{
|
|
20
|
+
hint: undefined,
|
|
21
|
+
error: undefined,
|
|
22
|
+
optional: false,
|
|
23
|
+
hideLabel: false,
|
|
24
|
+
id: undefined,
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const generatedId = useId();
|
|
29
|
+
const id = computed(() => props.id ?? generatedId);
|
|
30
|
+
const hintId = computed(() => `${id.value}-hint`);
|
|
31
|
+
const errorId = computed(() => `${id.value}-error`);
|
|
32
|
+
|
|
33
|
+
const describedBy = computed(
|
|
34
|
+
() =>
|
|
35
|
+
[props.error ? errorId.value : null, props.hint ? hintId.value : null]
|
|
36
|
+
.filter(Boolean)
|
|
37
|
+
.join(" ") || undefined,
|
|
38
|
+
);
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<div class="flex flex-col gap-1.5 font-body">
|
|
43
|
+
<label
|
|
44
|
+
:for="id"
|
|
45
|
+
:class="hideLabel ? 'sr-only' : 'text-sm font-bold text-sb-ink'"
|
|
46
|
+
>
|
|
47
|
+
{{ label }}
|
|
48
|
+
<span v-if="optional" class="font-medium text-sb-ink-muted"
|
|
49
|
+
>(optional)</span
|
|
50
|
+
>
|
|
51
|
+
</label>
|
|
52
|
+
<slot :id="id" :described-by="describedBy" :invalid="!!error" />
|
|
53
|
+
<p
|
|
54
|
+
v-if="error"
|
|
55
|
+
:id="errorId"
|
|
56
|
+
class="flex items-center gap-1.5 text-sm font-semibold text-sb-danger"
|
|
57
|
+
>
|
|
58
|
+
<svg
|
|
59
|
+
width="14"
|
|
60
|
+
height="14"
|
|
61
|
+
viewBox="0 0 24 24"
|
|
62
|
+
fill="none"
|
|
63
|
+
stroke="currentColor"
|
|
64
|
+
stroke-width="2.4"
|
|
65
|
+
stroke-linecap="round"
|
|
66
|
+
aria-hidden="true"
|
|
67
|
+
>
|
|
68
|
+
<circle cx="12" cy="12" r="9" />
|
|
69
|
+
<path d="M12 8v5M12 16h.01" />
|
|
70
|
+
</svg>
|
|
71
|
+
{{ error }}
|
|
72
|
+
</p>
|
|
73
|
+
<p v-if="hint" :id="hintId" class="text-[13px] text-sb-ink-muted">
|
|
74
|
+
{{ hint }}
|
|
75
|
+
</p>
|
|
76
|
+
</div>
|
|
77
|
+
</template>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The few stroke icons the base components need (#440), inline so they
|
|
4
|
+
* render in the SSR HTML without an icon request. Decorative only: the
|
|
5
|
+
* control that holds the icon carries the accessible name.
|
|
6
|
+
*/
|
|
7
|
+
type IconName =
|
|
8
|
+
| "plus"
|
|
9
|
+
| "minus"
|
|
10
|
+
| "trash"
|
|
11
|
+
| "check"
|
|
12
|
+
| "chevron-right"
|
|
13
|
+
| "chevron-down"
|
|
14
|
+
| "close"
|
|
15
|
+
| "search"
|
|
16
|
+
| "phone"
|
|
17
|
+
| "heart"
|
|
18
|
+
| "bag"
|
|
19
|
+
| "chevron-up";
|
|
20
|
+
|
|
21
|
+
withDefaults(
|
|
22
|
+
defineProps<{ name: IconName; size?: number; filled?: boolean }>(),
|
|
23
|
+
{ size: 18, filled: false },
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const PATHS: Record<IconName, string[]> = {
|
|
27
|
+
plus: ["M12 5v14", "M5 12h14"],
|
|
28
|
+
minus: ["M5 12h14"],
|
|
29
|
+
trash: ["M4 7h16", "M10 11v6", "M14 11v6", "M6 7l1 13h10l1-13", "M9 7V4h6v3"],
|
|
30
|
+
check: ["m5 12 5 5L20 7"],
|
|
31
|
+
"chevron-right": ["m9 6 6 6-6 6"],
|
|
32
|
+
"chevron-down": ["m6 9 6 6 6-6"],
|
|
33
|
+
close: ["M18 6 6 18", "M6 6l12 12"],
|
|
34
|
+
search: ["M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14z", "m20 20-3.5-3.5"],
|
|
35
|
+
bag: [
|
|
36
|
+
"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",
|
|
37
|
+
"M3 6h18",
|
|
38
|
+
"M16 10a4 4 0 0 1-8 0",
|
|
39
|
+
],
|
|
40
|
+
"chevron-up": ["m18 15-6-6-6 6"],
|
|
41
|
+
heart: [
|
|
42
|
+
"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",
|
|
43
|
+
],
|
|
44
|
+
phone: [
|
|
45
|
+
"M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8 9.8a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2z",
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<svg
|
|
52
|
+
:width="size"
|
|
53
|
+
:height="size"
|
|
54
|
+
viewBox="0 0 24 24"
|
|
55
|
+
:fill="filled ? 'currentColor' : 'none'"
|
|
56
|
+
stroke="currentColor"
|
|
57
|
+
stroke-width="2.2"
|
|
58
|
+
stroke-linecap="round"
|
|
59
|
+
stroke-linejoin="round"
|
|
60
|
+
aria-hidden="true"
|
|
61
|
+
focusable="false"
|
|
62
|
+
class="shrink-0"
|
|
63
|
+
>
|
|
64
|
+
<path v-for="d in PATHS[name]" :key="d" :d="d" />
|
|
65
|
+
</svg>
|
|
66
|
+
</template>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { RouteLocationRaw } from "vue-router";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Square icon button, 44 × 44 px (#440). `label` is required: it is the
|
|
6
|
+
* accessible name, icon-only controls have no visible text.
|
|
7
|
+
*/
|
|
8
|
+
const props = withDefaults(
|
|
9
|
+
defineProps<{
|
|
10
|
+
label: string;
|
|
11
|
+
variant?: "primary" | "tint" | "surface" | "ghost";
|
|
12
|
+
to?: RouteLocationRaw;
|
|
13
|
+
type?: "button" | "submit";
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
pressed?: boolean;
|
|
16
|
+
}>(),
|
|
17
|
+
{
|
|
18
|
+
variant: "surface",
|
|
19
|
+
to: undefined,
|
|
20
|
+
type: "button",
|
|
21
|
+
disabled: false,
|
|
22
|
+
pressed: undefined,
|
|
23
|
+
},
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const VARIANTS = {
|
|
27
|
+
primary: "bg-sb-primary text-sb-on-primary hover:bg-sb-primary-hover",
|
|
28
|
+
tint: "bg-sb-primary-tint text-sb-primary-ink hover:brightness-95",
|
|
29
|
+
surface: "bg-sb-muted text-sb-ink hover:brightness-95",
|
|
30
|
+
ghost: "bg-transparent text-sb-ink hover:bg-sb-muted",
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
const classes = computed(() => [
|
|
34
|
+
"relative inline-flex size-11 shrink-0 items-center justify-center rounded-sb-control font-body text-[15px] font-bold transition-colors",
|
|
35
|
+
"focus-visible:outline-3 focus-visible:outline-offset-2 focus-visible:outline-sb-focus",
|
|
36
|
+
"disabled:cursor-not-allowed disabled:opacity-60",
|
|
37
|
+
VARIANTS[props.variant],
|
|
38
|
+
]);
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<NuxtLink v-if="to" :to="to" :class="classes" :aria-label="label">
|
|
43
|
+
<slot />
|
|
44
|
+
</NuxtLink>
|
|
45
|
+
<button
|
|
46
|
+
v-else
|
|
47
|
+
:type="type"
|
|
48
|
+
:class="classes"
|
|
49
|
+
:aria-label="label"
|
|
50
|
+
:aria-pressed="pressed"
|
|
51
|
+
:disabled="disabled"
|
|
52
|
+
>
|
|
53
|
+
<slot />
|
|
54
|
+
</button>
|
|
55
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Text input in the preset style (#440), 50 px high, 16 px text so iOS
|
|
4
|
+
* does not zoom in. Use inside SbField and bind its `id`, `describedBy`
|
|
5
|
+
* and `invalid`.
|
|
6
|
+
*/
|
|
7
|
+
withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
invalid?: boolean;
|
|
10
|
+
}>(),
|
|
11
|
+
{ invalid: false },
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const model = defineModel<string>({ default: "" });
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<input
|
|
19
|
+
v-model="model"
|
|
20
|
+
:aria-invalid="invalid || undefined"
|
|
21
|
+
class="min-h-[50px] w-full rounded-sb-control border-[1.5px] border-sb-control bg-sb-surface px-3.5 font-body text-base text-sb-ink placeholder:text-sb-ink-muted focus-visible:outline-3 focus-visible:outline-offset-1 focus-visible:outline-sb-focus aria-invalid:border-sb-danger"
|
|
22
|
+
/>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup lang="ts" generic="T extends string">
|
|
2
|
+
import { RadioGroupItem, RadioGroupRoot } from "reka-ui";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Two to four mutually exclusive options side by side, e.g. Lieferung /
|
|
6
|
+
* Abholung (#440). A radio group for assistive technology (arrow keys move
|
|
7
|
+
* the selection), segments for the eye.
|
|
8
|
+
*/
|
|
9
|
+
defineProps<{
|
|
10
|
+
options: { value: T; label: string }[];
|
|
11
|
+
/** accessible name of the group */
|
|
12
|
+
label: string;
|
|
13
|
+
}>();
|
|
14
|
+
|
|
15
|
+
const model = defineModel<T>({ required: true });
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<RadioGroupRoot
|
|
20
|
+
v-model="model"
|
|
21
|
+
:aria-label="label"
|
|
22
|
+
orientation="horizontal"
|
|
23
|
+
class="grid auto-cols-fr grid-flow-col gap-1 rounded-sb-control bg-sb-muted p-1"
|
|
24
|
+
>
|
|
25
|
+
<RadioGroupItem
|
|
26
|
+
v-for="option in options"
|
|
27
|
+
:key="option.value"
|
|
28
|
+
:value="option.value"
|
|
29
|
+
class="min-h-10 rounded-[calc(var(--sb-radius-control)-3px)] px-4 font-body text-sm font-semibold text-sb-ink-muted transition-colors hover:text-sb-ink focus-visible:outline-3 focus-visible:outline-offset-1 focus-visible:outline-sb-focus data-[state=checked]:bg-sb-ink data-[state=checked]:font-bold data-[state=checked]:text-sb-surface"
|
|
30
|
+
>
|
|
31
|
+
{{ option.label }}
|
|
32
|
+
</RadioGroupItem>
|
|
33
|
+
</RadioGroupRoot>
|
|
34
|
+
</template>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script setup lang="ts" generic="T extends string">
|
|
2
|
+
/**
|
|
3
|
+
* Native select with a visible label (#445), e.g. the sorting of the menu
|
|
4
|
+
* and the search. The browser's own picker is the most accessible one on
|
|
5
|
+
* phones; only the closed control is styled.
|
|
6
|
+
*/
|
|
7
|
+
defineProps<{
|
|
8
|
+
label: string;
|
|
9
|
+
options: { value: T; label: string }[];
|
|
10
|
+
/** shown while no option is selected */
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
}>();
|
|
13
|
+
|
|
14
|
+
const model = defineModel<T>();
|
|
15
|
+
const id = useId();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<div class="flex items-center gap-3 font-body text-sb-ink">
|
|
20
|
+
<label :for="id" class="shrink-0 text-sm font-bold">{{ label }}</label>
|
|
21
|
+
<div class="relative min-w-0 flex-1">
|
|
22
|
+
<select
|
|
23
|
+
:id="id"
|
|
24
|
+
v-model="model"
|
|
25
|
+
class="min-h-11 w-full appearance-none rounded-sb-control border-[1.5px] border-sb-control bg-sb-surface ps-3.5 pe-10 text-base text-sb-ink focus-visible:outline-3 focus-visible:outline-offset-1 focus-visible:outline-sb-focus"
|
|
26
|
+
>
|
|
27
|
+
<option
|
|
28
|
+
v-if="placeholder && !options.some((o) => o.value === model)"
|
|
29
|
+
:value="model"
|
|
30
|
+
disabled
|
|
31
|
+
>
|
|
32
|
+
{{ placeholder }}
|
|
33
|
+
</option>
|
|
34
|
+
<option
|
|
35
|
+
v-for="option in options"
|
|
36
|
+
:key="option.value"
|
|
37
|
+
:value="option.value"
|
|
38
|
+
>
|
|
39
|
+
{{ option.label }}
|
|
40
|
+
</option>
|
|
41
|
+
</select>
|
|
42
|
+
<span
|
|
43
|
+
class="pointer-events-none absolute inset-y-0 end-3 flex items-center text-sb-ink-muted"
|
|
44
|
+
>
|
|
45
|
+
<SbIcon name="chevron-down" />
|
|
46
|
+
</span>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
DialogClose,
|
|
4
|
+
DialogContent,
|
|
5
|
+
DialogDescription,
|
|
6
|
+
DialogOverlay,
|
|
7
|
+
DialogPortal,
|
|
8
|
+
DialogRoot,
|
|
9
|
+
DialogTitle,
|
|
10
|
+
} from "reka-ui";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Bottom sheet on phones, side panel from 768 px (#440). Built on Reka's
|
|
14
|
+
* dialog: it traps the focus, closes with Esc and returns the focus to the
|
|
15
|
+
* trigger. Mount it on first use (`v-if`), not with the page (#314).
|
|
16
|
+
*/
|
|
17
|
+
withDefaults(
|
|
18
|
+
defineProps<{
|
|
19
|
+
title: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
/** hide the title visually, it stays the dialog's accessible name */
|
|
22
|
+
hideTitle?: boolean;
|
|
23
|
+
}>(),
|
|
24
|
+
{ description: undefined, hideTitle: false },
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const open = defineModel<boolean>("open", { default: false });
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<DialogRoot v-model:open="open">
|
|
32
|
+
<DialogPortal>
|
|
33
|
+
<DialogOverlay
|
|
34
|
+
class="fixed inset-0 z-50 bg-black/45 motion-safe:data-[state=open]:animate-[sb-fade-in_150ms_ease-out]"
|
|
35
|
+
/>
|
|
36
|
+
<DialogContent
|
|
37
|
+
class="fixed inset-x-0 bottom-0 z-50 flex max-h-[92dvh] flex-col rounded-t-[calc(var(--sb-radius-card)+8px)] bg-sb-surface text-sb-ink shadow-2xl focus:outline-none md:inset-y-0 md:right-0 md:left-auto md:max-h-none md:w-[440px] md:rounded-none md:rounded-l-[calc(var(--sb-radius-card)+8px)] motion-safe:data-[state=open]:animate-[sb-sheet-in_200ms_ease-out]"
|
|
38
|
+
>
|
|
39
|
+
<div class="flex justify-center pt-2.5 md:hidden" aria-hidden="true">
|
|
40
|
+
<span class="h-1 w-9 rounded-full bg-sb-line" />
|
|
41
|
+
</div>
|
|
42
|
+
<header class="flex items-start gap-3 px-5 pt-3 pb-2 md:pt-6">
|
|
43
|
+
<div class="min-w-0 flex-1">
|
|
44
|
+
<slot name="header">
|
|
45
|
+
<DialogTitle
|
|
46
|
+
:class="
|
|
47
|
+
hideTitle
|
|
48
|
+
? 'sr-only'
|
|
49
|
+
: 'font-display text-2xl leading-tight text-sb-ink'
|
|
50
|
+
"
|
|
51
|
+
>
|
|
52
|
+
{{ title }}
|
|
53
|
+
</DialogTitle>
|
|
54
|
+
<DialogDescription
|
|
55
|
+
v-if="description"
|
|
56
|
+
class="mt-1 text-sm text-sb-ink-muted"
|
|
57
|
+
>
|
|
58
|
+
{{ description }}
|
|
59
|
+
</DialogDescription>
|
|
60
|
+
</slot>
|
|
61
|
+
</div>
|
|
62
|
+
<slot name="actions" />
|
|
63
|
+
<DialogClose as-child>
|
|
64
|
+
<SbIconButton label="Schließen">
|
|
65
|
+
<SbIcon name="close" />
|
|
66
|
+
</SbIconButton>
|
|
67
|
+
</DialogClose>
|
|
68
|
+
</header>
|
|
69
|
+
<div
|
|
70
|
+
class="flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain px-5 pb-5"
|
|
71
|
+
>
|
|
72
|
+
<slot />
|
|
73
|
+
</div>
|
|
74
|
+
<footer
|
|
75
|
+
v-if="$slots.footer"
|
|
76
|
+
class="border-t border-sb-line bg-sb-surface px-4 pt-3 pb-[max(1.25rem,env(safe-area-inset-bottom))]"
|
|
77
|
+
>
|
|
78
|
+
<slot name="footer" />
|
|
79
|
+
</footer>
|
|
80
|
+
</DialogContent>
|
|
81
|
+
</DialogPortal>
|
|
82
|
+
</DialogRoot>
|
|
83
|
+
</template>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Rating stars (#444), e.g. 4,5 as four full and one half star. A graphic
|
|
4
|
+
* only: the rating always stands next to it in words, so the stars are
|
|
5
|
+
* hidden from assistive technology.
|
|
6
|
+
*/
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
/** 0 to 5, half steps are drawn half filled */
|
|
10
|
+
value: number;
|
|
11
|
+
size?: number;
|
|
12
|
+
}>(),
|
|
13
|
+
{ size: 14 },
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
const STAR =
|
|
17
|
+
"m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.8L12 17.8 5.8 21l1.2-6.8-5-4.9 6.9-1z";
|
|
18
|
+
|
|
19
|
+
const stars = computed(() =>
|
|
20
|
+
Array.from({ length: 5 }, (_, index) => {
|
|
21
|
+
const fill = Math.min(Math.max(props.value - index, 0), 1);
|
|
22
|
+
// round to whole and half stars
|
|
23
|
+
return fill >= 0.75 ? 1 : fill >= 0.25 ? 0.5 : 0;
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const clipId = useId();
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<span class="inline-flex gap-0.5 text-sb-star" aria-hidden="true">
|
|
32
|
+
<svg
|
|
33
|
+
v-for="(fill, index) in stars"
|
|
34
|
+
:key="index"
|
|
35
|
+
:width="size"
|
|
36
|
+
:height="size"
|
|
37
|
+
viewBox="0 0 24 24"
|
|
38
|
+
focusable="false"
|
|
39
|
+
>
|
|
40
|
+
<defs v-if="fill === 0.5">
|
|
41
|
+
<clipPath :id="`${clipId}-${index}`">
|
|
42
|
+
<rect x="0" y="0" width="12" height="24" />
|
|
43
|
+
</clipPath>
|
|
44
|
+
</defs>
|
|
45
|
+
<path
|
|
46
|
+
:d="STAR"
|
|
47
|
+
fill="none"
|
|
48
|
+
stroke="currentColor"
|
|
49
|
+
stroke-width="1.6"
|
|
50
|
+
stroke-linejoin="round"
|
|
51
|
+
/>
|
|
52
|
+
<path
|
|
53
|
+
v-if="fill > 0"
|
|
54
|
+
:d="STAR"
|
|
55
|
+
fill="currentColor"
|
|
56
|
+
:clip-path="fill === 0.5 ? `url(#${clipId}-${index})` : undefined"
|
|
57
|
+
/>
|
|
58
|
+
</svg>
|
|
59
|
+
</span>
|
|
60
|
+
</template>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Store status, e.g. "Geöffnet bis 23:00" (#440). The text carries the
|
|
4
|
+
* meaning; the dot only repeats it.
|
|
5
|
+
*/
|
|
6
|
+
withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
tone?: "open" | "closed" | "neutral";
|
|
9
|
+
}>(),
|
|
10
|
+
{ tone: "neutral" },
|
|
11
|
+
);
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<span
|
|
16
|
+
:class="[
|
|
17
|
+
'inline-flex min-h-8 items-center gap-2 rounded-sb-control px-3 font-body text-sm font-bold',
|
|
18
|
+
tone === 'open'
|
|
19
|
+
? 'bg-sb-primary-tint text-sb-primary-ink'
|
|
20
|
+
: tone === 'closed'
|
|
21
|
+
? 'bg-sb-muted text-sb-ink'
|
|
22
|
+
: 'bg-sb-muted text-sb-ink-muted',
|
|
23
|
+
]"
|
|
24
|
+
>
|
|
25
|
+
<span
|
|
26
|
+
aria-hidden="true"
|
|
27
|
+
:class="[
|
|
28
|
+
'size-2 rounded-full',
|
|
29
|
+
tone === 'open'
|
|
30
|
+
? 'bg-sb-primary'
|
|
31
|
+
: tone === 'closed'
|
|
32
|
+
? 'bg-sb-danger'
|
|
33
|
+
: 'bg-sb-ink-muted',
|
|
34
|
+
]"
|
|
35
|
+
/>
|
|
36
|
+
<slot />
|
|
37
|
+
</span>
|
|
38
|
+
</template>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Quantity stepper (#440). At the minimum the minus button turns into a
|
|
4
|
+
* remove button when `removable` is set. `itemName` goes into the button
|
|
5
|
+
* labels ("Pizza Mix, eine mehr"), the quantity is announced politely.
|
|
6
|
+
*/
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
itemName: string;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
removable?: boolean;
|
|
13
|
+
size?: "md" | "lg";
|
|
14
|
+
}>(),
|
|
15
|
+
{ min: 1, max: 99, removable: false, size: "md" },
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const emit = defineEmits<{ remove: [] }>();
|
|
19
|
+
const model = defineModel<number>({ required: true });
|
|
20
|
+
|
|
21
|
+
const atMin = computed(() => model.value <= props.min);
|
|
22
|
+
const showRemove = computed(() => props.removable && atMin.value);
|
|
23
|
+
|
|
24
|
+
function decrease() {
|
|
25
|
+
if (showRemove.value) {
|
|
26
|
+
emit("remove");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (!atMin.value) model.value -= 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function increase() {
|
|
33
|
+
if (model.value < props.max) model.value += 1;
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<div
|
|
39
|
+
role="group"
|
|
40
|
+
:aria-label="`Menge ${itemName}`"
|
|
41
|
+
:class="[
|
|
42
|
+
'inline-flex items-center rounded-sb-control bg-sb-muted font-body text-sb-ink',
|
|
43
|
+
size === 'lg' ? 'h-14' : 'h-10',
|
|
44
|
+
]"
|
|
45
|
+
>
|
|
46
|
+
<button
|
|
47
|
+
type="button"
|
|
48
|
+
class="inline-flex h-full w-11 items-center justify-center rounded-sb-control focus-visible:outline-3 focus-visible:outline-offset-1 focus-visible:outline-sb-focus disabled:opacity-40"
|
|
49
|
+
:aria-label="
|
|
50
|
+
showRemove ? `${itemName} entfernen` : `${itemName}, eine weniger`
|
|
51
|
+
"
|
|
52
|
+
:disabled="atMin && !removable"
|
|
53
|
+
@click="decrease"
|
|
54
|
+
>
|
|
55
|
+
<SbIcon :name="showRemove ? 'trash' : 'minus'" :size="16" />
|
|
56
|
+
</button>
|
|
57
|
+
<output
|
|
58
|
+
class="min-w-5 text-center font-bold tabular-nums"
|
|
59
|
+
aria-live="polite"
|
|
60
|
+
>{{ model }}</output
|
|
61
|
+
>
|
|
62
|
+
<button
|
|
63
|
+
type="button"
|
|
64
|
+
class="inline-flex h-full w-11 items-center justify-center rounded-sb-control focus-visible:outline-3 focus-visible:outline-offset-1 focus-visible:outline-sb-focus disabled:opacity-40"
|
|
65
|
+
:aria-label="`${itemName}, eine mehr`"
|
|
66
|
+
:disabled="model >= max"
|
|
67
|
+
@click="increase"
|
|
68
|
+
>
|
|
69
|
+
<SbIcon name="plus" :size="16" />
|
|
70
|
+
</button>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/** Heading of the account pages in the presets (#445). */
|
|
3
|
+
defineProps<{ title: string; description?: string }>();
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<header class="mb-6 flex flex-col gap-2 font-body">
|
|
8
|
+
<p class="text-sm font-bold tracking-wide text-sb-accent uppercase">
|
|
9
|
+
Kundenkonto
|
|
10
|
+
</p>
|
|
11
|
+
<h1 class="font-display text-4xl leading-tight text-sb-ink sm:text-5xl">
|
|
12
|
+
{{ title }}
|
|
13
|
+
</h1>
|
|
14
|
+
<p v-if="description" class="text-sb-ink-muted">{{ description }}</p>
|
|
15
|
+
</header>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Frame of the login, registration and password pages in the presets
|
|
4
|
+
* (#445): page heading, an optional intro and the form on a card.
|
|
5
|
+
*/
|
|
6
|
+
withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
title: string;
|
|
9
|
+
kicker?: string;
|
|
10
|
+
wide?: boolean;
|
|
11
|
+
}>(),
|
|
12
|
+
{ kicker: "Kundenkonto", wide: false },
|
|
13
|
+
);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div
|
|
18
|
+
:class="[
|
|
19
|
+
'mx-auto flex w-full flex-col gap-6 px-4 pt-8 pb-16 font-body text-sb-ink sm:pt-12',
|
|
20
|
+
wide ? 'max-w-2xl' : 'max-w-md',
|
|
21
|
+
]"
|
|
22
|
+
>
|
|
23
|
+
<header class="flex flex-col gap-2">
|
|
24
|
+
<p class="text-sm font-bold tracking-wide text-sb-accent uppercase">
|
|
25
|
+
{{ kicker }}
|
|
26
|
+
</p>
|
|
27
|
+
<h1 class="font-display text-4xl leading-tight sm:text-5xl">
|
|
28
|
+
{{ title }}
|
|
29
|
+
</h1>
|
|
30
|
+
<div v-if="$slots.intro" class="flex flex-col gap-2 text-sb-ink-muted">
|
|
31
|
+
<slot name="intro" />
|
|
32
|
+
</div>
|
|
33
|
+
</header>
|
|
34
|
+
<div class="rounded-sb-card border border-sb-line bg-sb-surface p-6">
|
|
35
|
+
<slot />
|
|
36
|
+
</div>
|
|
37
|
+
<div v-if="$slots.footer" class="text-sm text-sb-ink-muted">
|
|
38
|
+
<slot name="footer" />
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|