@vectoriox/iox-ui 5.96.1 → 5.97.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.
@@ -1,6 +1,6 @@
1
1
  import { readOwnedTrait, writeOwnedTrait, ROW_INDEX_ATTRIBUTE, elementStyleById, switchElementStyle, LinkType, setColorScheme, COLOR_SCHEME_TRAIT, repeatedRowIndex, roleClass as roleClass$1, headerBehaviourOf, HeaderTrait, headerEdgeOf, headerStaysAtTop } from '@vectoriox/iox-ui/design-core';
2
2
  export { ROW_INDEX_ATTRIBUTE } from '@vectoriox/iox-ui/design-core';
3
- import { shopWord, ShopWord, emptyCartView, QuantityStep, stepQuantity, ShopSlot, productOptions, productVariants, defaultChoice, findVariant, quantityBounds, chooseValue, clampQuantity, variantWords, optionValueStates, canStep, cartIssueWords, formatMoney, CartTransportError, CartTransportErrorCode, CART_TRANSPORT_ERROR_LABELS } from '@vectoriox/iox-ui/commerce-core';
3
+ import { shopWord, ShopWord, emptyCartView, QuantityStep, stepQuantity, ShopSlot, productOptions, productVariants, defaultChoice, findVariant, quantityBounds, chooseValue, clampQuantity, variantSlotOf, optionValueStates, canStep, cartIssueWords, formatMoney, CartTransportError, CartTransportErrorCode, CART_TRANSPORT_ERROR_LABELS } from '@vectoriox/iox-ui/commerce-core';
4
4
 
5
5
  /** What a recipe asks its consumer to create: a NEW node of `type`, the way that consumer creates one
6
6
  * (the builder's `createConfig`, generation-core's `createSerializedNode`), with these props and this
@@ -5025,7 +5025,7 @@ function buildVariantPickerRecipe(create) {
5025
5025
  /** Quantity: − · the count · + (min 1, max from the variant's stock). `compact` = a cart line's. */
5026
5026
  function buildQuantityRecipe(create, compact = false, key = 'quantity') {
5027
5027
  const size = compact ? '30px' : 'var(--iox-stepper-size)';
5028
- const root = part(create, key, Type.Container, ShopRole.Quantity, Style.Quantity, {}, SHOP_LABELS.quantity, { ...ROW, alignItems: 'stretch', gap: '0px', ...(compact ? { minHeight: size } : {}) });
5028
+ const root = part(create, key, Type.Container, ShopRole.Quantity, Style.Quantity, {}, SHOP_LABELS.quantity, { ...ROW, alignItems: 'stretch', gap: '0px', minHeight: size });
5029
5029
  const down = button(create, `${key}-down`, ShopRole.QuantityDown, Style.QuantityButton, 'Decrease', 'Decrease quantity', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: size, padding: ZERO });
5030
5030
  down.children = [icon(create, `${key}-down-icon`, 'ph ph-minus', compact ? '14px' : '16px')];
5031
5031
  const value = text(create, `${key}-value`, ShopRole.QuantityValue, Style.Body, SHOP_RECIPE_WORDS.quantity, 'Count', { ...WORDS, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', minWidth: compact ? '32px' : '40px', fontVariantNumeric: 'tabular-nums' }, 'span');
@@ -5054,7 +5054,7 @@ function buildBuyNowRecipe(create) {
5054
5054
  /** The bag button with its live count ($cart.count); it opens the page's cart drawer. */
5055
5055
  function buildCartButtonRecipe(create) {
5056
5056
  const root = button(create, 'cart-button', ShopRole.CartButton, Style.CartButton, SHOP_LABELS.cartButton, SHOP_RECIPE_WORDS.cart, { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto', padding: '6px 6px 6px 6px', position: 'relative' });
5057
- const count = part(create, 'cart-count', Type.Container, ShopRole.CartCount, Style.CartCount, {}, 'Count', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto', minHeight: 'auto', padding: '0px 4px 0px 4px', position: 'absolute', top: '-5px', right: '-5px' });
5057
+ const count = part(create, 'cart-count', Type.Container, ShopRole.CartCount, Style.CartCount, {}, 'Count', { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 'auto', height: 'auto', minHeight: 'var(--iox-cart-count-size)', padding: '0px 4px 0px 4px', position: 'absolute', top: '-5px', right: '-5px' });
5058
5058
  const words = text(create, 'cart-count-text', null, Style.Label, SHOP_RECIPE_WORDS.count, 'Text', { ...WORDS, lineHeight: '1' }, 'span');
5059
5059
  bindSlot(words, 'content', '$cart', 'count');
5060
5060
  count.children = [words];
@@ -5430,13 +5430,7 @@ class ShopRuntime {
5430
5430
  this.stamp();
5431
5431
  }
5432
5432
  publishVariant(state) {
5433
- const variant = this.variantOf(state);
5434
- this.publish(ShopSlot.Variant, variant ? {
5435
- ...variant,
5436
- productId: state.product._id,
5437
- words: variantWords(variant.choice, state.options),
5438
- quantity: state.quantity,
5439
- } : null);
5433
+ this.publish(ShopSlot.Variant, variantSlotOf(state.product, state.choice, state.quantity));
5440
5434
  }
5441
5435
  publish(slot, value) {
5442
5436
  const json = JSON.stringify(value ?? null);