@shopify/hydrogen-react 0.0.0-next-96e1bb8 → 0.0.0-next-182fb2f
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/dist/dev/AddToCartButton.js +95 -0
- package/dist/dev/AddToCartButton.js.map +1 -0
- package/dist/dev/AddToCartButton.mjs +95 -0
- package/dist/dev/AddToCartButton.mjs.map +1 -0
- package/dist/dev/MediaFile.js.map +1 -1
- package/dist/dev/MediaFile.mjs.map +1 -1
- package/dist/dev/index.js +2 -0
- package/dist/dev/index.js.map +1 -1
- package/dist/dev/index.mjs +2 -0
- package/dist/dev/index.mjs.map +1 -1
- package/dist/prod/AddToCartButton.js +95 -0
- package/dist/prod/AddToCartButton.js.map +1 -0
- package/dist/prod/AddToCartButton.mjs +95 -0
- package/dist/prod/AddToCartButton.mjs.map +1 -0
- package/dist/prod/MediaFile.js.map +1 -1
- package/dist/prod/MediaFile.mjs.map +1 -1
- package/dist/prod/index.js +2 -0
- package/dist/prod/index.js.map +1 -1
- package/dist/prod/index.mjs +2 -0
- package/dist/prod/index.mjs.map +1 -1
- package/dist/types/AddToCartButton.d.ts +36 -0
- package/dist/types/MediaFile.d.ts +4 -1
- package/dist/types/index.d.cts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/umd/hydrogen-react.dev.js +304 -203
- package/dist/umd/hydrogen-react.dev.js.map +1 -1
- package/dist/umd/hydrogen-react.prod.js +17 -17
- package/dist/umd/hydrogen-react.prod.js.map +1 -1
- package/package.json +1 -1
package/dist/prod/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Ref, ReactNode } from 'react';
|
|
2
|
+
interface AddToCartButtonProps {
|
|
3
|
+
/** An array of cart line attributes that belong to the item being added to the cart. */
|
|
4
|
+
attributes?: {
|
|
5
|
+
key: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
8
|
+
/** The ID of the variant. */
|
|
9
|
+
variantId?: string | null;
|
|
10
|
+
/** The item quantity. */
|
|
11
|
+
quantity?: number;
|
|
12
|
+
/** The text that is announced by the screen reader when the item is being added to the cart. Used for accessibility purposes only and not displayed on the page. */
|
|
13
|
+
accessibleAddingToCartLabel?: string;
|
|
14
|
+
/** The selling plan ID of the subscription variant */
|
|
15
|
+
sellingPlanId?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The `AddToCartButton` component renders a button that adds an item to the cart when pressed.
|
|
19
|
+
* It must be a descendent of the `CartProvider` component.
|
|
20
|
+
*/
|
|
21
|
+
export declare function AddToCartButton<AsType extends React.ElementType = 'button'>(props: AddToCartButtonProps & BaseButtonProps<AsType>): JSX.Element;
|
|
22
|
+
export interface CustomBaseButtonProps<AsType> {
|
|
23
|
+
/** Provide a React element or component to render as the underlying button. Note: for accessibility compliance, almost always you should use a `button` element, or a component that renders an underlying button. */
|
|
24
|
+
as?: AsType;
|
|
25
|
+
/** Any ReactNode elements. */
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
/** Click event handler. Default behaviour triggers unless prevented */
|
|
28
|
+
onClick?: (event?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | boolean;
|
|
29
|
+
/** A default onClick behavior */
|
|
30
|
+
defaultOnClick?: (event?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | boolean;
|
|
31
|
+
/** A ref to the underlying button */
|
|
32
|
+
buttonRef?: Ref<HTMLButtonElement>;
|
|
33
|
+
}
|
|
34
|
+
export declare type BaseButtonProps<AsType extends React.ElementType> = CustomBaseButtonProps<AsType> & Omit<React.ComponentPropsWithoutRef<AsType>, keyof CustomBaseButtonProps<AsType>>;
|
|
35
|
+
export declare function BaseButton<AsType extends React.ElementType = 'button'>(props: BaseButtonProps<AsType>): JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -4,7 +4,9 @@ import { ExternalVideo } from './ExternalVideo.js';
|
|
|
4
4
|
import { ModelViewer } from './ModelViewer.js';
|
|
5
5
|
import type { MediaEdge as MediaEdgeType } from './storefront-api-types.js';
|
|
6
6
|
import type { PartialDeep } from 'type-fest';
|
|
7
|
-
|
|
7
|
+
import type { ModelViewerElement } from '@google/model-viewer/lib/model-viewer.js';
|
|
8
|
+
declare type BaseProps = React.HTMLAttributes<HTMLImageElement | HTMLVideoElement | HTMLIFrameElement | ModelViewerElement>;
|
|
9
|
+
export interface MediaFileProps extends BaseProps {
|
|
8
10
|
/** An object with fields that correspond to the Storefront API's [Media object](https://shopify.dev/api/storefront/reference/products/media). */
|
|
9
11
|
data: PartialDeep<MediaEdgeType['node'], {
|
|
10
12
|
recurseIntoArrays: true;
|
|
@@ -27,3 +29,4 @@ export interface MediaFileProps {
|
|
|
27
29
|
* `Video`, an `ExternalVideo`, or a `ModelViewer` depending on the `__typename` of the `data` prop.
|
|
28
30
|
*/
|
|
29
31
|
export declare function MediaFile({ data, mediaOptions, ...passthroughProps }: MediaFileProps): JSX.Element | null;
|
|
32
|
+
export {};
|
package/dist/types/index.d.cts
CHANGED
package/dist/types/index.d.ts
CHANGED