@marianmeres/stuic 3.78.0 → 3.79.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.
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
import CheckoutLoginForm from "./CheckoutLoginForm.svelte";
|
|
120
120
|
import LoginFormModal from "../LoginForm/LoginFormModal.svelte";
|
|
121
121
|
import LoginOrRegisterFormModal from "../LoginOrRegisterForm/LoginOrRegisterFormModal.svelte";
|
|
122
|
-
import
|
|
122
|
+
import ButtonGroupRadio from "../ButtonGroupRadio/ButtonGroupRadio.svelte";
|
|
123
123
|
import { H, type HLevel } from "../H/index.js";
|
|
124
124
|
import CheckoutSectionHeader from "./CheckoutSectionHeader.svelte";
|
|
125
125
|
|
|
@@ -254,27 +254,9 @@
|
|
|
254
254
|
}
|
|
255
255
|
});
|
|
256
256
|
|
|
257
|
-
let
|
|
258
|
-
{
|
|
259
|
-
{
|
|
260
|
-
id: "login",
|
|
261
|
-
label: loginTabLabel ?? t("checkout.guest_or_login.login_tab"),
|
|
262
|
-
...(_useLoginOrRegisterModal
|
|
263
|
-
? {
|
|
264
|
-
onSelect: () => {
|
|
265
|
-
loginOrRegisterModalRef?.open();
|
|
266
|
-
return false;
|
|
267
|
-
},
|
|
268
|
-
}
|
|
269
|
-
: _useLoginModal
|
|
270
|
-
? {
|
|
271
|
-
onSelect: () => {
|
|
272
|
-
loginModalRef?.open();
|
|
273
|
-
return false;
|
|
274
|
-
},
|
|
275
|
-
}
|
|
276
|
-
: {}),
|
|
277
|
-
},
|
|
257
|
+
let tabOptions = $derived([
|
|
258
|
+
{ value: "guest", label: guestTabLabel ?? t("checkout.guest_or_login.guest_tab") },
|
|
259
|
+
{ value: "login", label: loginTabLabel ?? t("checkout.guest_or_login.login_tab") },
|
|
278
260
|
]);
|
|
279
261
|
|
|
280
262
|
let _class = $derived(
|
|
@@ -305,23 +287,26 @@
|
|
|
305
287
|
<CheckoutLoginForm {...loginForm} {notifications} t={tProp} {unstyled} />
|
|
306
288
|
{/if}
|
|
307
289
|
{:else if formMode === "tabbed"}
|
|
308
|
-
<
|
|
309
|
-
|
|
310
|
-
value={activeTab}
|
|
311
|
-
onSelect={(item) => {
|
|
312
|
-
activeTab = item.id as "guest" | "login";
|
|
313
|
-
}}
|
|
314
|
-
{unstyled}
|
|
290
|
+
<ButtonGroupRadio
|
|
291
|
+
options={tabOptions}
|
|
292
|
+
bind:value={activeTab as string}
|
|
315
293
|
class={unstyled ? undefined : "stuic-checkout-guest-or-login-tabs"}
|
|
294
|
+
onButtonClick={(index) => {
|
|
295
|
+
if (tabOptions[index]?.value !== "login") return;
|
|
296
|
+
if (_useLoginOrRegisterModal) {
|
|
297
|
+
loginOrRegisterModalRef?.open();
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
if (_useLoginModal) {
|
|
301
|
+
loginModalRef?.open();
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
}}
|
|
316
305
|
/>
|
|
317
306
|
{#if activeTab === "guest" && guestForm}
|
|
318
|
-
<
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
{:else if activeTab === "login" && loginForm && !_useLoginOrRegisterModal}
|
|
322
|
-
<div role="tabpanel">
|
|
323
|
-
<CheckoutLoginForm {...loginForm} {notifications} t={tProp} {unstyled} />
|
|
324
|
-
</div>
|
|
307
|
+
<CheckoutGuestForm {...guestForm} {notifications} t={tProp} {unstyled} />
|
|
308
|
+
{:else if activeTab === "login" && loginForm && !_useLoginOrRegisterModal && !_useLoginModal}
|
|
309
|
+
<CheckoutLoginForm {...loginForm} {notifications} t={tProp} {unstyled} />
|
|
325
310
|
{/if}
|
|
326
311
|
{:else if formMode === "stacked"}
|
|
327
312
|
{#if loginForm}
|
|
@@ -26,7 +26,7 @@ Each step container renders a `CheckoutProgress` indicator (unless `hideProgress
|
|
|
26
26
|
| `CheckoutOrderSummary` | Totals (subtotal/tax/shipping/discount/total) |
|
|
27
27
|
| `CheckoutOrderReview` | Read-only order dump (items + addresses + delivery) |
|
|
28
28
|
| `CheckoutOrderConfirmation` | Completed-order summary with order number & next steps |
|
|
29
|
-
| `CheckoutGuestOrLoginForm` |
|
|
29
|
+
| `CheckoutGuestOrLoginForm` | Guest / login switcher (segmented pill) |
|
|
30
30
|
| `CheckoutGuestForm` | Guest-checkout fields |
|
|
31
31
|
| `CheckoutLoginForm` | Login (adapts the generic `LoginForm` to checkout i18n) |
|
|
32
32
|
| `CheckoutAddressForm` | Structured address input |
|
|
@@ -221,7 +221,7 @@ By default `CheckoutGuestOrLoginForm` in tabbed mode renders an inline `<Checkou
|
|
|
221
221
|
|
|
222
222
|
- `CheckoutProgress` renders past/current/future steps with `aria-current="step"` on the active step.
|
|
223
223
|
- Form submissions do **not** automatically move focus to the first error field. Consumers wanting this behavior should do it in their `onContinue` handler after receiving validation errors.
|
|
224
|
-
- `CheckoutGuestOrLoginForm` uses
|
|
224
|
+
- `CheckoutGuestOrLoginForm` uses `ButtonGroupRadio` (`role="radiogroup"`) for the guest/login switch; focus does not auto-move to the panel heading on switch.
|
|
225
225
|
|
|
226
226
|
## Address equality (advanced)
|
|
227
227
|
|
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
--stuic-checkout-guest-or-login-gap: 0.25rem;
|
|
4
4
|
--stuic-checkout-guest-or-login-divider-color: var(--stuic-color-border);
|
|
5
5
|
--stuic-checkout-guest-or-login-tabs-margin-bottom: 1.5rem;
|
|
6
|
-
--stuic-checkout-guest-or-login-tabs-background-color: var(--stuic-color-muted);
|
|
7
|
-
--stuic-checkout-guest-or-login-tabs-active-background-color: var(
|
|
8
|
-
--stuic-color-muted-foreground
|
|
9
|
-
);
|
|
10
6
|
}
|
|
11
7
|
|
|
12
8
|
@layer components {
|
|
@@ -16,32 +12,11 @@
|
|
|
16
12
|
gap: var(--stuic-checkout-guest-or-login-gap);
|
|
17
13
|
}
|
|
18
14
|
|
|
19
|
-
/*
|
|
15
|
+
/* Spacing below the guest/login switcher (ButtonGroupRadio) */
|
|
20
16
|
.stuic-checkout-guest-or-login-tabs {
|
|
21
|
-
--stuic-tabbed-menu-radius: 9999px;
|
|
22
|
-
--stuic-tabbed-menu-item-max-width: none;
|
|
23
|
-
background-color: var(--stuic-checkout-guest-or-login-tabs-background-color);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.stuic-checkout-guest-or-login-tabs.stuic-tabbed-menu {
|
|
27
|
-
padding: 3px;
|
|
28
|
-
border: 1px solid var(--stuic-checkout-guest-or-login-divider-color);
|
|
29
|
-
border-radius: 9999px;
|
|
30
17
|
margin-bottom: var(--stuic-checkout-guest-or-login-tabs-margin-bottom);
|
|
31
18
|
}
|
|
32
19
|
|
|
33
|
-
/* Override TabbedMenu's top-only border-radius to full pill shape */
|
|
34
|
-
.stuic-checkout-guest-or-login-tabs .stuic-tabbed-menu-tab {
|
|
35
|
-
border-radius: 9999px;
|
|
36
|
-
background-color: var(--stuic-checkout-guest-or-login-tabs-background-color);
|
|
37
|
-
border: 0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.stuic-checkout-guest-or-login-tabs .stuic-tabbed-menu-tab[aria-selected="true"] {
|
|
41
|
-
border-color: var(--stuic-tabbed-menu-border-active);
|
|
42
|
-
background-color: var(--stuic-checkout-guest-or-login-tabs-active-background-color);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
20
|
/* Divider (stacked mode) */
|
|
46
21
|
.stuic-checkout-guest-or-login-divider {
|
|
47
22
|
display: flex;
|