@wix/headless-stores 0.0.78 → 0.0.79

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.
@@ -860,6 +860,92 @@ export declare const Action: {
860
860
  /** Pre-order action button */
861
861
  readonly PreOrder: React.ForwardRefExoticComponent<ProductActionProps & React.RefAttributes<HTMLButtonElement>>;
862
862
  };
863
+ /**
864
+ * Props for ProductVariantSKU component
865
+ */
866
+ export interface ProductVariantSKUProps {
867
+ /** Whether to render as a child component */
868
+ asChild?: boolean;
869
+ /** Custom render function when using asChild */
870
+ children?: AsChildChildren<{
871
+ sku: string | null;
872
+ }>;
873
+ /** CSS classes to apply to the default element */
874
+ className?: string;
875
+ }
876
+ /**
877
+ * Displays the selected variant SKU with customizable rendering following the documented API.
878
+ *
879
+ * @component
880
+ * @example
881
+ * ```tsx
882
+ * // Default usage
883
+ * <Product.ProductVariant.SKU className="text-content-secondary" />
884
+ *
885
+ * // asChild with primitive
886
+ * <Product.ProductVariant.SKU asChild>
887
+ * <span className="sku-value" />
888
+ * </Product.ProductVariant.SKU>
889
+ *
890
+ * // asChild with react component
891
+ * <Product.ProductVariant.SKU asChild>
892
+ * {React.forwardRef(({sku, ...props}, ref) => (
893
+ * <span ref={ref} {...props}>
894
+ * {sku}
895
+ * </span>
896
+ * ))}
897
+ * </Product.ProductVariant.SKU>
898
+ * ```
899
+ */
900
+ export declare const ProductVariantSKU: React.ForwardRefExoticComponent<ProductVariantSKUProps & React.RefAttributes<HTMLElement>>;
901
+ /**
902
+ * Props for ProductVariantWeight component
903
+ */
904
+ export interface ProductVariantWeightProps {
905
+ /** Whether to render as a child component */
906
+ asChild?: boolean;
907
+ /** Custom render function when using asChild */
908
+ children?: AsChildChildren<{
909
+ weight: string | null;
910
+ }>;
911
+ /** CSS classes to apply to the default element */
912
+ className?: string;
913
+ }
914
+ /**
915
+ * Displays the selected variant weight with customizable rendering following the documented API.
916
+ *
917
+ * @component
918
+ * @example
919
+ * ```tsx
920
+ * // Default usage
921
+ * <Product.ProductVariant.Weight className="text-content-secondary" />
922
+ *
923
+ * // asChild with primitive
924
+ * <Product.ProductVariant.Weight asChild>
925
+ * <span className="weight-value" />
926
+ * </Product.ProductVariant.Weight>
927
+ *
928
+ * // asChild with react component
929
+ * <Product.ProductVariant.Weight asChild>
930
+ * {React.forwardRef(({weight, ...props}, ref) => (
931
+ * <span ref={ref} {...props}>
932
+ * {weight}
933
+ * </span>
934
+ * ))}
935
+ * </Product.ProductVariant.Weight>
936
+ * ```
937
+ */
938
+ export declare const ProductVariantWeight: React.ForwardRefExoticComponent<ProductVariantWeightProps & React.RefAttributes<HTMLElement>>;
939
+ /**
940
+ * ProductVariant namespace containing product variant components
941
+ * following the compound component pattern: Product.ProductVariant.SKU, Product.ProductVariant.Weight
942
+ */
943
+ export declare const ProductVariant: {
944
+ /** Product variant SKU component */
945
+ readonly SKU: React.ForwardRefExoticComponent<ProductVariantSKUProps & React.RefAttributes<HTMLElement>>;
946
+ /** Product variant weight component */
947
+ readonly Weight: React.ForwardRefExoticComponent<ProductVariantWeightProps & React.RefAttributes<HTMLElement>>;
948
+ };
863
949
  /**
864
950
  * Quantity namespace containing all product quantity components
865
951
  * following the compound component pattern: Product.Quantity.Root, Product.Quantity.Decrement, etc.
@@ -47,6 +47,9 @@ var TestIds;
47
47
  TestIds["productVariants"] = "product-variants";
48
48
  TestIds["productVariantOptions"] = "product-variant-options";
49
49
  TestIds["productVariantOption"] = "product-variant-option";
50
+ TestIds["productVariant"] = "product-variant";
51
+ TestIds["productVariantSku"] = "product-variant-sku";
52
+ TestIds["productVariantWeight"] = "product-variant-weight";
50
53
  TestIds["productModifiers"] = "product-modifiers";
51
54
  TestIds["productModifierOptions"] = "product-modifier-options";
52
55
  TestIds["productModifierOption"] = "product-modifier-option";
@@ -780,7 +783,7 @@ export const ProductQuantityDecrement = React.forwardRef((props, ref) => {
780
783
  if (asChild && children) {
781
784
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productQuantityDecrement, customElement: children, customElementProps: { disabled } }));
782
785
  }
783
- return (_jsx(QuantityComponent.Decrement, { className: className, ref: ref, "data-testid": TestIds.productQuantityDecrement, disabled: disabled }));
786
+ return (_jsx(QuantityComponent.Decrement, { className: className, ref: ref, "data-testid": TestIds.productQuantityDecrement, disabled }));
784
787
  } }));
785
788
  });
786
789
  /**
@@ -821,7 +824,7 @@ export const ProductQuantityIncrement = React.forwardRef((props, ref) => {
821
824
  if (asChild && children) {
822
825
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productQuantityIncrement, customElement: children, customElementProps: { disabled } }));
823
826
  }
824
- return (_jsx(QuantityComponent.Increment, { className: className, ref: ref, "data-testid": TestIds.productQuantityIncrement, disabled: disabled }));
827
+ return (_jsx(QuantityComponent.Increment, { className: className, ref: ref, "data-testid": TestIds.productQuantityIncrement, disabled }));
825
828
  } }));
826
829
  });
827
830
  /**
@@ -935,6 +938,84 @@ export const Action = {
935
938
  /** Pre-order action button */
936
939
  PreOrder: ProductActionPreOrder,
937
940
  };
941
+ /**
942
+ * Displays the selected variant SKU with customizable rendering following the documented API.
943
+ *
944
+ * @component
945
+ * @example
946
+ * ```tsx
947
+ * // Default usage
948
+ * <Product.ProductVariant.SKU className="text-content-secondary" />
949
+ *
950
+ * // asChild with primitive
951
+ * <Product.ProductVariant.SKU asChild>
952
+ * <span className="sku-value" />
953
+ * </Product.ProductVariant.SKU>
954
+ *
955
+ * // asChild with react component
956
+ * <Product.ProductVariant.SKU asChild>
957
+ * {React.forwardRef(({sku, ...props}, ref) => (
958
+ * <span ref={ref} {...props}>
959
+ * {sku}
960
+ * </span>
961
+ * ))}
962
+ * </Product.ProductVariant.SKU>
963
+ * ```
964
+ */
965
+ export const ProductVariantSKU = React.forwardRef((props, ref) => {
966
+ const { asChild, children, className } = props;
967
+ return (_jsx(SelectedVariant.Details, { children: ({ sku }) => {
968
+ // Don't render anything if there's no SKU
969
+ if (!sku) {
970
+ return null;
971
+ }
972
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productVariantSku, customElement: children, customElementProps: { sku }, content: sku, children: _jsx("span", { children: sku }) }));
973
+ } }));
974
+ });
975
+ /**
976
+ * Displays the selected variant weight with customizable rendering following the documented API.
977
+ *
978
+ * @component
979
+ * @example
980
+ * ```tsx
981
+ * // Default usage
982
+ * <Product.ProductVariant.Weight className="text-content-secondary" />
983
+ *
984
+ * // asChild with primitive
985
+ * <Product.ProductVariant.Weight asChild>
986
+ * <span className="weight-value" />
987
+ * </Product.ProductVariant.Weight>
988
+ *
989
+ * // asChild with react component
990
+ * <Product.ProductVariant.Weight asChild>
991
+ * {React.forwardRef(({weight, ...props}, ref) => (
992
+ * <span ref={ref} {...props}>
993
+ * {weight}
994
+ * </span>
995
+ * ))}
996
+ * </Product.ProductVariant.Weight>
997
+ * ```
998
+ */
999
+ export const ProductVariantWeight = React.forwardRef((props, ref) => {
1000
+ const { asChild, children, className } = props;
1001
+ return (_jsx(SelectedVariant.Details, { children: ({ weight }) => {
1002
+ // Don't render anything if there's no weight
1003
+ if (!weight) {
1004
+ return null;
1005
+ }
1006
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productVariantWeight, customElement: children, customElementProps: { weight }, content: weight, children: _jsx("span", { children: weight }) }));
1007
+ } }));
1008
+ });
1009
+ /**
1010
+ * ProductVariant namespace containing product variant components
1011
+ * following the compound component pattern: Product.ProductVariant.SKU, Product.ProductVariant.Weight
1012
+ */
1013
+ export const ProductVariant = {
1014
+ /** Product variant SKU component */
1015
+ SKU: ProductVariantSKU,
1016
+ /** Product variant weight component */
1017
+ Weight: ProductVariantWeight,
1018
+ };
938
1019
  /**
939
1020
  * Quantity namespace containing all product quantity components
940
1021
  * following the compound component pattern: Product.Quantity.Root, Product.Quantity.Decrement, etc.
@@ -860,6 +860,92 @@ export declare const Action: {
860
860
  /** Pre-order action button */
861
861
  readonly PreOrder: React.ForwardRefExoticComponent<ProductActionProps & React.RefAttributes<HTMLButtonElement>>;
862
862
  };
863
+ /**
864
+ * Props for ProductVariantSKU component
865
+ */
866
+ export interface ProductVariantSKUProps {
867
+ /** Whether to render as a child component */
868
+ asChild?: boolean;
869
+ /** Custom render function when using asChild */
870
+ children?: AsChildChildren<{
871
+ sku: string | null;
872
+ }>;
873
+ /** CSS classes to apply to the default element */
874
+ className?: string;
875
+ }
876
+ /**
877
+ * Displays the selected variant SKU with customizable rendering following the documented API.
878
+ *
879
+ * @component
880
+ * @example
881
+ * ```tsx
882
+ * // Default usage
883
+ * <Product.ProductVariant.SKU className="text-content-secondary" />
884
+ *
885
+ * // asChild with primitive
886
+ * <Product.ProductVariant.SKU asChild>
887
+ * <span className="sku-value" />
888
+ * </Product.ProductVariant.SKU>
889
+ *
890
+ * // asChild with react component
891
+ * <Product.ProductVariant.SKU asChild>
892
+ * {React.forwardRef(({sku, ...props}, ref) => (
893
+ * <span ref={ref} {...props}>
894
+ * {sku}
895
+ * </span>
896
+ * ))}
897
+ * </Product.ProductVariant.SKU>
898
+ * ```
899
+ */
900
+ export declare const ProductVariantSKU: React.ForwardRefExoticComponent<ProductVariantSKUProps & React.RefAttributes<HTMLElement>>;
901
+ /**
902
+ * Props for ProductVariantWeight component
903
+ */
904
+ export interface ProductVariantWeightProps {
905
+ /** Whether to render as a child component */
906
+ asChild?: boolean;
907
+ /** Custom render function when using asChild */
908
+ children?: AsChildChildren<{
909
+ weight: string | null;
910
+ }>;
911
+ /** CSS classes to apply to the default element */
912
+ className?: string;
913
+ }
914
+ /**
915
+ * Displays the selected variant weight with customizable rendering following the documented API.
916
+ *
917
+ * @component
918
+ * @example
919
+ * ```tsx
920
+ * // Default usage
921
+ * <Product.ProductVariant.Weight className="text-content-secondary" />
922
+ *
923
+ * // asChild with primitive
924
+ * <Product.ProductVariant.Weight asChild>
925
+ * <span className="weight-value" />
926
+ * </Product.ProductVariant.Weight>
927
+ *
928
+ * // asChild with react component
929
+ * <Product.ProductVariant.Weight asChild>
930
+ * {React.forwardRef(({weight, ...props}, ref) => (
931
+ * <span ref={ref} {...props}>
932
+ * {weight}
933
+ * </span>
934
+ * ))}
935
+ * </Product.ProductVariant.Weight>
936
+ * ```
937
+ */
938
+ export declare const ProductVariantWeight: React.ForwardRefExoticComponent<ProductVariantWeightProps & React.RefAttributes<HTMLElement>>;
939
+ /**
940
+ * ProductVariant namespace containing product variant components
941
+ * following the compound component pattern: Product.ProductVariant.SKU, Product.ProductVariant.Weight
942
+ */
943
+ export declare const ProductVariant: {
944
+ /** Product variant SKU component */
945
+ readonly SKU: React.ForwardRefExoticComponent<ProductVariantSKUProps & React.RefAttributes<HTMLElement>>;
946
+ /** Product variant weight component */
947
+ readonly Weight: React.ForwardRefExoticComponent<ProductVariantWeightProps & React.RefAttributes<HTMLElement>>;
948
+ };
863
949
  /**
864
950
  * Quantity namespace containing all product quantity components
865
951
  * following the compound component pattern: Product.Quantity.Root, Product.Quantity.Decrement, etc.
@@ -47,6 +47,9 @@ var TestIds;
47
47
  TestIds["productVariants"] = "product-variants";
48
48
  TestIds["productVariantOptions"] = "product-variant-options";
49
49
  TestIds["productVariantOption"] = "product-variant-option";
50
+ TestIds["productVariant"] = "product-variant";
51
+ TestIds["productVariantSku"] = "product-variant-sku";
52
+ TestIds["productVariantWeight"] = "product-variant-weight";
50
53
  TestIds["productModifiers"] = "product-modifiers";
51
54
  TestIds["productModifierOptions"] = "product-modifier-options";
52
55
  TestIds["productModifierOption"] = "product-modifier-option";
@@ -780,7 +783,7 @@ export const ProductQuantityDecrement = React.forwardRef((props, ref) => {
780
783
  if (asChild && children) {
781
784
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productQuantityDecrement, customElement: children, customElementProps: { disabled } }));
782
785
  }
783
- return (_jsx(QuantityComponent.Decrement, { className: className, ref: ref, "data-testid": TestIds.productQuantityDecrement, disabled: disabled }));
786
+ return (_jsx(QuantityComponent.Decrement, { className: className, ref: ref, "data-testid": TestIds.productQuantityDecrement, disabled }));
784
787
  } }));
785
788
  });
786
789
  /**
@@ -821,7 +824,7 @@ export const ProductQuantityIncrement = React.forwardRef((props, ref) => {
821
824
  if (asChild && children) {
822
825
  return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productQuantityIncrement, customElement: children, customElementProps: { disabled } }));
823
826
  }
824
- return (_jsx(QuantityComponent.Increment, { className: className, ref: ref, "data-testid": TestIds.productQuantityIncrement, disabled: disabled }));
827
+ return (_jsx(QuantityComponent.Increment, { className: className, ref: ref, "data-testid": TestIds.productQuantityIncrement, disabled }));
825
828
  } }));
826
829
  });
827
830
  /**
@@ -935,6 +938,84 @@ export const Action = {
935
938
  /** Pre-order action button */
936
939
  PreOrder: ProductActionPreOrder,
937
940
  };
941
+ /**
942
+ * Displays the selected variant SKU with customizable rendering following the documented API.
943
+ *
944
+ * @component
945
+ * @example
946
+ * ```tsx
947
+ * // Default usage
948
+ * <Product.ProductVariant.SKU className="text-content-secondary" />
949
+ *
950
+ * // asChild with primitive
951
+ * <Product.ProductVariant.SKU asChild>
952
+ * <span className="sku-value" />
953
+ * </Product.ProductVariant.SKU>
954
+ *
955
+ * // asChild with react component
956
+ * <Product.ProductVariant.SKU asChild>
957
+ * {React.forwardRef(({sku, ...props}, ref) => (
958
+ * <span ref={ref} {...props}>
959
+ * {sku}
960
+ * </span>
961
+ * ))}
962
+ * </Product.ProductVariant.SKU>
963
+ * ```
964
+ */
965
+ export const ProductVariantSKU = React.forwardRef((props, ref) => {
966
+ const { asChild, children, className } = props;
967
+ return (_jsx(SelectedVariant.Details, { children: ({ sku }) => {
968
+ // Don't render anything if there's no SKU
969
+ if (!sku) {
970
+ return null;
971
+ }
972
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productVariantSku, customElement: children, customElementProps: { sku }, content: sku, children: _jsx("span", { children: sku }) }));
973
+ } }));
974
+ });
975
+ /**
976
+ * Displays the selected variant weight with customizable rendering following the documented API.
977
+ *
978
+ * @component
979
+ * @example
980
+ * ```tsx
981
+ * // Default usage
982
+ * <Product.ProductVariant.Weight className="text-content-secondary" />
983
+ *
984
+ * // asChild with primitive
985
+ * <Product.ProductVariant.Weight asChild>
986
+ * <span className="weight-value" />
987
+ * </Product.ProductVariant.Weight>
988
+ *
989
+ * // asChild with react component
990
+ * <Product.ProductVariant.Weight asChild>
991
+ * {React.forwardRef(({weight, ...props}, ref) => (
992
+ * <span ref={ref} {...props}>
993
+ * {weight}
994
+ * </span>
995
+ * ))}
996
+ * </Product.ProductVariant.Weight>
997
+ * ```
998
+ */
999
+ export const ProductVariantWeight = React.forwardRef((props, ref) => {
1000
+ const { asChild, children, className } = props;
1001
+ return (_jsx(SelectedVariant.Details, { children: ({ weight }) => {
1002
+ // Don't render anything if there's no weight
1003
+ if (!weight) {
1004
+ return null;
1005
+ }
1006
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productVariantWeight, customElement: children, customElementProps: { weight }, content: weight, children: _jsx("span", { children: weight }) }));
1007
+ } }));
1008
+ });
1009
+ /**
1010
+ * ProductVariant namespace containing product variant components
1011
+ * following the compound component pattern: Product.ProductVariant.SKU, Product.ProductVariant.Weight
1012
+ */
1013
+ export const ProductVariant = {
1014
+ /** Product variant SKU component */
1015
+ SKU: ProductVariantSKU,
1016
+ /** Product variant weight component */
1017
+ Weight: ProductVariantWeight,
1018
+ };
938
1019
  /**
939
1020
  * Quantity namespace containing all product quantity components
940
1021
  * following the compound component pattern: Product.Quantity.Root, Product.Quantity.Decrement, etc.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/headless-stores",
3
- "version": "0.0.78",
3
+ "version": "0.0.79",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "prebuild": "cd ../media && yarn build && cd ../ecom && yarn build",