@marianmeres/stuic 3.94.1 → 3.94.3

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.
@@ -10,6 +10,7 @@
10
10
  CheckoutValidationError,
11
11
  } from "./_internal/checkout-types.js";
12
12
  import type { NotificationsStack } from "../Notifications/notifications-stack.svelte.js";
13
+ import type { Props as CheckoutAddressFormProps } from "./CheckoutAddressForm.svelte";
13
14
 
14
15
  export interface Props extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
15
16
  /** Order data (for totals display in sidebar) */
@@ -94,6 +95,24 @@
94
95
  ]
95
96
  >;
96
97
 
98
+ /**
99
+ * Props forwarded to both inner `CheckoutAddressForm` instances (shipping
100
+ * and, when visible, billing). Use this to configure `phoneFieldProps`,
101
+ * `countryFieldProps`, `preferredCountries`, `countryList`, `countryNames`,
102
+ * `requiredFields`, or `fields` without replacing the entire left column
103
+ * via the `leftColumn` snippet.
104
+ *
105
+ * Structural props that `CheckoutShippingStep` owns (`address`, `errors`,
106
+ * `label`, `countryField`, `t`, `unstyled`, `el`) cannot be overridden via
107
+ * this object — they are applied after the spread.
108
+ */
109
+ addressFormProps?: Partial<
110
+ Omit<
111
+ CheckoutAddressFormProps,
112
+ "address" | "errors" | "label" | "countryField" | "t" | "unstyled" | "el"
113
+ >
114
+ >;
115
+
97
116
  /** Override left column entirely */
98
117
  leftColumn?: Snippet;
99
118
 
@@ -154,6 +173,7 @@
154
173
  continueLabel,
155
174
  continuingLabel,
156
175
  countryField,
176
+ addressFormProps,
157
177
  leftColumn,
158
178
  rightColumn,
159
179
  t: tProp,
@@ -267,6 +287,7 @@
267
287
  </CheckoutSectionHeader>
268
288
  <CheckoutAddressForm
269
289
  bind:this={shippingFormRef}
290
+ {...addressFormProps}
270
291
  bind:address={shippingAddress}
271
292
  label="shipping"
272
293
  errors={shippingErrors}
@@ -293,6 +314,7 @@
293
314
  </CheckoutSectionHeader>
294
315
  <CheckoutAddressForm
295
316
  bind:this={billingFormRef}
317
+ {...addressFormProps}
296
318
  bind:address={billingAddress}
297
319
  label="billing"
298
320
  errors={billingErrors}
@@ -3,6 +3,7 @@ import type { HTMLAttributes } from "svelte/elements";
3
3
  import type { TranslateFn } from "../../types.js";
4
4
  import type { CheckoutAddressData, CheckoutDeliveryOption, CheckoutOrderData, CheckoutStep, CheckoutValidationError } from "./_internal/checkout-types.js";
5
5
  import type { NotificationsStack } from "../Notifications/notifications-stack.svelte.js";
6
+ import type { Props as CheckoutAddressFormProps } from "./CheckoutAddressForm.svelte";
6
7
  export interface Props extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
7
8
  /** Order data (for totals display in sidebar) */
8
9
  order: CheckoutOrderData;
@@ -50,6 +51,18 @@ export interface Props extends Omit<HTMLAttributes<HTMLDivElement>, "children">
50
51
  id: string;
51
52
  }
52
53
  ]>;
54
+ /**
55
+ * Props forwarded to both inner `CheckoutAddressForm` instances (shipping
56
+ * and, when visible, billing). Use this to configure `phoneFieldProps`,
57
+ * `countryFieldProps`, `preferredCountries`, `countryList`, `countryNames`,
58
+ * `requiredFields`, or `fields` without replacing the entire left column
59
+ * via the `leftColumn` snippet.
60
+ *
61
+ * Structural props that `CheckoutShippingStep` owns (`address`, `errors`,
62
+ * `label`, `countryField`, `t`, `unstyled`, `el`) cannot be overridden via
63
+ * this object — they are applied after the spread.
64
+ */
65
+ addressFormProps?: Partial<Omit<CheckoutAddressFormProps, "address" | "errors" | "label" | "countryField" | "t" | "unstyled" | "el">>;
53
66
  /** Override left column entirely */
54
67
  leftColumn?: Snippet;
55
68
  /** Override right column entirely */
@@ -274,7 +274,7 @@
274
274
  });
275
275
  }
276
276
 
277
- let renderedAny = false;
277
+ let hasUserActions = false;
278
278
  if (actions.onProfile) {
279
279
  out.push({
280
280
  type: "action",
@@ -282,7 +282,7 @@
282
282
  label: L.viewProfile,
283
283
  onSelect: actions.onProfile,
284
284
  });
285
- renderedAny = true;
285
+ hasUserActions = true;
286
286
  }
287
287
  if (actions.onSettings) {
288
288
  out.push({
@@ -291,23 +291,23 @@
291
291
  label: L.settings,
292
292
  onSelect: actions.onSettings,
293
293
  });
294
- renderedAny = true;
294
+ hasUserActions = true;
295
295
  }
296
- if (csEnabled) {
297
- out.push(buildColorSchemeItem());
298
- renderedAny = true;
299
- }
300
-
301
296
  if (extraItems?.length) {
302
297
  out.push(...extraItems);
303
- renderedAny = true;
298
+ hasUserActions = true;
304
299
  }
305
300
 
306
- if (renderedAny && actions.onLogout) {
307
- out.push({ type: "divider", id: "div-logout" });
301
+ let hasColorScheme = false;
302
+ if (csEnabled) {
303
+ out.push(buildColorSchemeItem());
304
+ hasColorScheme = true;
308
305
  }
309
306
 
310
307
  if (actions.onLogout) {
308
+ if (hasUserActions || hasColorScheme) {
309
+ out.push({ type: "divider", id: "div-logout" });
310
+ }
311
311
  out.push({
312
312
  type: "action",
313
313
  id: "logout",
@@ -341,8 +341,13 @@
341
341
  onSelect: actions.onRegister,
342
342
  });
343
343
  }
344
- if (csEnabled) out.push(buildColorSchemeItem());
345
- if (extraItems?.length) out.push(...extraItems);
344
+ if (extraItems?.length) {
345
+ out.push(...extraItems);
346
+ }
347
+
348
+ if (csEnabled) {
349
+ out.push(buildColorSchemeItem());
350
+ }
346
351
  }
347
352
 
348
353
  return out;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.94.1",
3
+ "version": "3.94.3",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && pnpm run prepack",